Changeset 4241 for src/perl5

Show
Ignore:
Timestamp:
06/01/05 06:58:50 (4 years ago)
Author:
mugwump
svk:copy_cache_prev:
5801
Message:

Make perl5embed startup noise easier to read, easy to enable/disable (disabled per default)

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • src/perl5/perl5.c

    r4231 r4241  
    33#include "perlxsi.c" 
    44#include "pugsembed.c" 
     5 
     6/* undefine to enable pugsembed debug messages */ 
     7#define oRZ "#" 
     8#define hate Perl_croak(aTHX_ "hate software") 
    59 
    610/* Workaround for mapstart: the only op which needs a different ppaddr */ 
     
    1519 
    1620const char pugs_guts_code[] = 
    17 "use strict;" 
    18  
    19 "package pugs;" 
    20  
    21 "our $AUTOLOAD;" 
    22 "sub AUTOLOAD { pugs::guts::invoke($AUTOLOAD, @_) } " 
    23 "sub DESTROY {}" 
    24  
    25 "package pugs::guts;" 
    26 "our @ISA=('pugs');" 
    27 "sub Block { my ($class, $val) = @_;" 
    28 "            sub { pugs::guts::invoke($val, undef, @_) } }" 
    29  
    30 "sub Array { my ($class, $val) = @_;" 
    31 "            my $array; tie @$array, 'pugs::array', $val;" 
    32 "      warn 'returning '.$array;" 
    33 "            return $array; }" 
    34  
    35 "our $AUTOLOAD;" 
    36 "sub AUTOLOAD { my $type = $AUTOLOAD; $type =~ s/.*:://;" 
    37 "               return if $type =~ m/^[A-Z]*$/; die 'unhandled supported type: '.$type } " 
    38 "warn 'compiled .'.__PACKAGE__;" 
    39  
    40 "package pugs::array;" 
    41 "sub TIEARRAY {" 
    42 "       my ($class, $val) = @_;" 
    43 "       bless \\$val, $class; }" 
    44  
    45 "sub STORE {" 
    46 "       my ($self, $index, $elem) = @_;" 
    47 "       warn 'store! '.$elem;" 
    48 "       pugs::guts::eval_apply('{ $^x[$^y] = $^z }', $$self, $index, $elem) }" 
    49  
    50 "sub FETCHSIZE {" 
    51 "       my ($self) = @_;" 
    52 "       my $ret = pugs::guts::invoke('elems', $$self); " 
    53 "       warn 'FETCHSIZE: '.$ret; $ret; }" 
    54  
    55 "sub FETCH {" 
    56 "       my ($self, $index) = @_;" 
    57 "       pugs::guts::eval_apply('{ $^x[$^y] }', $$self, $index) }" 
    58 "warn 'compiled';" 
    59 "1;"; 
     21"use strict;\n\n" 
     22 
     23"package pugs;\n\n" 
     24 
     25"our $AUTOLOAD;\n" 
     26"sub AUTOLOAD { pugs::guts::invoke($AUTOLOAD, @_) } \n" 
     27"sub DESTROY {}\n\n" 
     28 
     29"package pugs::guts;\n" 
     30"our @ISA=('pugs');\n" 
     31"sub Block { my ($class, $val) = @_;\n" 
     32"            sub { pugs::guts::invoke($val, undef, @_) } }\n" 
     33 
     34"sub Array { my ($class, $val) = @_;\n" 
     35"            my $array; tie @$array, 'pugs::array', $val;\n" 
     36oRZ"   warn 'returning '.$array;\n" 
     37"            return $array; }\n\n" 
     38 
     39"our $AUTOLOAD;\n" 
     40"sub AUTOLOAD { my $type = $AUTOLOAD; $type =~ s/.*:://;\n" 
     41"               return if $type =~ m/^[A-Z]*$/; die 'unhandled supported type: '.$type } \n" 
     42oRZ"warn 'compiled .'.__PACKAGE__;\n\n" 
     43 
     44"package pugs::array;\n" 
     45"sub TIEARRAY {\n" 
     46"       my ($class, $val) = @_;\n" 
     47"       bless \\$val, $class; }\n\n" 
     48 
     49"sub STORE {\n" 
     50"       my ($self, $index, $elem) = @_;\n" 
     51oRZ"    warn 'store! '.$elem;\n" 
     52"       pugs::guts::eval_apply('{ $^x[$^y] = $^z }', $$self, $index, $elem) }\n\n" 
     53 
     54"sub FETCHSIZE {\n" 
     55"       my ($self) = @_;\n" 
     56"       my $ret = pugs::guts::invoke('elems', $$self); \n" 
     57oRZ"    warn 'FETCHSIZE: '.$ret; $ret; }\n\n" 
     58 
     59"sub FETCH {\n" 
     60"       my ($self, $index) = @_;\n" 
     61"       pugs::guts::eval_apply('{ $^x[$^y] }', $$self, $index) }\n" 
     62oRZ"warn 'compiled';\n" 
     63"1;\n"; 
    6064 
    6165XS(_pugs_guts_invoke) { 
     
    6569    dXSARGS; 
    6670    if (items < 1) 
    67         Perl_croak(aTHX_ "hate software"); 
     71      hate; 
    6872 
    6973    sv = ST(0); 
     
    99103    dXSARGS; 
    100104    if (items < 1) 
    101         Perl_croak(aTHX_ "hate software"); 
     105        hate; 
    102106 
    103107    val = pugs_Eval(SvPV_nolen(ST(0))); 
     
    209213    newXS((char*) "pugs::guts::eval_apply", _pugs_guts_eval_apply, (char*)__FILE__); 
    210214 
     215#ifndef oRZ 
    211216    fprintf(stderr, "(%s)", pugs_guts_code); 
     217#endif 
    212218    eval_pv(pugs_guts_code, TRUE); 
    213219