- Timestamp:
- 06/01/05 13:28:02 (4 years ago)
- svk:copy_cache_prev:
- 5801
- Location:
- src/perl5
- Files:
-
- 3 modified
Legend:
- Unmodified
- Added
- Removed
-
src/perl5/README
r4092 r4262 15 15 them to actual caller P6 namespace. 16 16 17 =item Reference a rgs17 =item Reference access from perl5 18 18 19 Make C<Getopt::Long> work. 19 =over 20 21 =item scalar 22 23 Make C<Getopt::Long> work. C<MkValRef> gets dereferenced value, pending the fix to this. 24 25 =item array 26 27 C<STORE> / C<PUSH> fails, the array is correct in the accessor applied 28 in perl5 tie, but not properly propogate back. perhaps because args 29 not marked as rw at the beginning. 30 31 =item hash 32 33 Requires C<eval_apply> to return multiple value so we can store the 34 list for key iterator. 35 36 =back 20 37 21 38 =back -
src/perl5/perl5.c
r4241 r4262 4 4 #include "pugsembed.c" 5 5 6 /* undefine to enable pugsembed debug messages */ 6 /* define to enable pugsembed debug messages */ 7 #define PERL5_EMBED_DEBUG 0 8 9 #if PERL5_EMBED_DEBUG 10 #define oRZ "" 11 #define hate Perl_croak(aTHX_ "hate software") 12 #else 7 13 #define oRZ "#" 8 #define hate Perl_croak(aTHX_ "hate software") 14 #define hate 15 #endif 9 16 10 17 /* Workaround for mapstart: the only op which needs a different ppaddr */ … … 37 44 " return $array; }\n\n" 38 45 46 "sub Hash { my ($class, $val) = @_;\n" 47 " my $hash; tie %$hash, 'pugs::hash', $val;\n" 48 oRZ" warn 'returning '.$hash;\n" 49 " return $hash; }\n\n" 50 39 51 "our $AUTOLOAD;\n" 40 52 "sub AUTOLOAD { my $type = $AUTOLOAD; $type =~ s/.*:://;\n" … … 43 55 44 56 "package pugs::array;\n" 57 58 "our $AUTOLOAD;\n" 59 "sub AUTOLOAD { my $type = $AUTOLOAD; $type =~ s/.*:://;\n" 60 " warn 'unhandled supported: '.$type } \n" 61 45 62 "sub TIEARRAY {\n" 46 63 " my ($class, $val) = @_;\n" … … 50 67 " my ($self, $index, $elem) = @_;\n" 51 68 oRZ" warn 'store! '.$elem;\n" 52 " pugs::guts::eval_apply('{ $^x[$^y] = $^z }', $$self, $index, $elem) }\n\n" 69 " pugs::guts::eval_apply('sub ($x is rw, $y, $z) { $x[$y] = $z;\n" 70 oRZ" warn $x\n" 71 " }', $$self, $index, $elem) }\n\n" 72 73 "sub PUSH {\n" 74 " my ($self, $elem) = @_;\n" 75 " pugs::guts::eval_apply('sub ($x is rw, $z) { $x.push($z);\n" 76 oRZ" warn $x\n" 77 " }', $$self, $elem) }\n\n" 53 78 54 79 "sub FETCHSIZE {\n" 55 80 " my ($self) = @_;\n" 56 81 " my $ret = pugs::guts::invoke('elems', $$self); \n" 57 oRZ" warn 'FETCHSIZE: '.$ret; $ret; }\n\n" 82 oRZ" warn 'FETCHSIZE: '.$ret;\n" 83 " $ret; }\n\n" 84 85 "sub EXISTS {\n" 86 " my ($self, $index) = @_;\n" 87 " pugs::guts::eval_apply('sub ($x, $y) { $x.exists($y) }', $$self, $index) }\n" 58 88 59 89 "sub FETCH {\n" 60 90 " my ($self, $index) = @_;\n" 61 " pugs::guts::eval_apply('{ $^x[$^y] }', $$self, $index) }\n" 91 oRZ" warn 'FETCH: '.$index;\n" 92 " pugs::guts::eval_apply('sub ($x, $y) { $x.[$y] }', $$self, $index) }\n" 93 94 "package pugs::hash;\n" 95 96 "our $AUTOLOAD;\n" 97 "sub AUTOLOAD { my $type = $AUTOLOAD; $type =~ s/.*:://;\n" 98 " warn 'unhandled supported: '.$type } \n" 99 100 "sub TIEHASH {\n" 101 " my ($class, $val) = @_;\n" 102 " bless [$val,0], $class; }\n\n" 103 104 "sub FIRSTKEY {\n" 105 " my ($self) = @_;\n" 106 " my $ret = pugs::guts::invoke('keys', $self->[0]); \n" 107 oRZ" warn $ret;\n" 108 " $self->[1] = 0; $self->[2] = $ret;" 109 " $self->NEXTKEY; }\n" 110 111 "sub NEXTKEY {\n" 112 " my ($self) = @_;\n" 113 " return undef if $self->[1] > $#{$self->[2]};" 114 " $self->[2]->[$self->[1]++]; }" 115 116 62 117 oRZ"warn 'compiled';\n" 63 118 "1;\n"; … … 68 123 int i; 69 124 dXSARGS; 70 if (items < 1) 125 if (items < 1) { 71 126 hate; 127 } 72 128 73 129 sv = ST(0); … … 102 158 int i; 103 159 dXSARGS; 104 if (items < 1) 160 if (items < 1) { 105 161 hate; 162 } 106 163 107 164 val = pugs_Eval(SvPV_nolen(ST(0))); … … 109 166 stack = (Val **)malloc(sizeof(Val*)*items-1); 110 167 for (i = 1; i < items; ++i) { 168 #if PERL5_EMBED_DEBUG 111 169 fprintf(stderr, "put into stack: %s\n", SvPV_nolen(ST(i))); 170 #endif 112 171 stack[i-1] = pugs_SvToVal(ST(i)); 113 172 } … … 213 272 newXS((char*) "pugs::guts::eval_apply", _pugs_guts_eval_apply, (char*)__FILE__); 214 273 215 #if ndef oRZ274 #if PERL5_EMBED_DEBUG 216 275 fprintf(stderr, "(%s)", pugs_guts_code); 217 276 #endif … … 219 278 220 279 if (SvTRUE(ERRSV)) { 221 fprintf(stderr, "Hate!\n");222 280 STRLEN n_a; 223 281 printf("Error init perl: %s\n", SvPV(ERRSV,n_a)); … … 308 366 SPAGAIN; 309 367 310 /* fprintf(stderr, "%d is count\n", count); */311 368 Newz(42, out, count+1, SV*); 312 369 -
src/perl5/pugsembed.c
r4231 r4262 28 28 29 29 type = pugs_Apply(pugs_PvToVal("&ref"), val, isa, G_SCALAR); 30 #if PERL5_EMBED_DEBUG 30 31 fprintf(stderr, "query the type: got %s\n", SvPV_nolen(type)); 32 #endif 31 33 if (SvTRUE( type )) { 32 34 SV **rv; … … 40 42 } 41 43 else { 44 /* for scalar ref, should still turn into tied one */ 45 #if PERL5_EMBED_DEBUG 42 46 fprintf(stderr, "unknown type\n"); 47 #endif 43 48 } 44 49 }
