Changeset 3948
- Timestamp:
- 05/27/05 04:03:10 (4 years ago)
- svk:copy_cache_prev:
- 5515
- Location:
- src
- Files:
-
- 4 modified
-
Pugs/Run/Perl5.hs (modified) (4 diffs)
-
perl5/perl5.c (modified) (1 diff)
-
perl5/pugsembed.c (modified) (1 diff)
-
perl5/pugsembed.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
src/Pugs/Run/Perl5.hs
r3945 r3948 18 18 19 19 foreign export ccall "pugs_Apply" 20 pugs_apply :: PugsVal -> PugsVal -> Ptr PugsVal -> IO P ugsVal20 pugs_apply :: PugsVal -> PugsVal -> Ptr PugsVal -> IO PerlSV 21 21 22 22 foreign export ccall "pugs_ValToSv" … … 60 60 mkVal val 61 61 62 pugs_apply :: PugsVal -> PugsVal -> Ptr PugsVal -> IO P ugsVal62 pugs_apply :: PugsVal -> PugsVal -> Ptr PugsVal -> IO PerlSV 63 63 pugs_apply subPtr invPtr argsPtr = do 64 64 -- print "DEREF #0" … … 66 66 -- print "DEREF #1" 67 67 sub <- deVal subPtr 68 -- print "DEREF #2"68 -- print ("DEREF #2", sub) 69 69 inv <- deValMaybe invPtr 70 70 -- print ("DEREF #3", inv) … … 75 75 _ -> Val sub 76 76 val <- runEvalIO env $ evalExp (App subExp (fmap Val inv) (map Val args)) 77 mkVal val 77 case val of 78 PerlSV sv -> return sv 79 VStr str -> vstrToSV str 80 VBool bool -> vintToSV (fromEnum bool) 81 VInt int -> vintToSV int 82 VRat rat -> vnumToSV rat 83 VNum num -> vnumToSV num 84 _ -> mkValRef val 78 85 79 86 deVal :: PugsVal -> IO Val -
src/perl5/perl5.c
r3946 r3948 44 44 45 45 /* fprintf(stderr, "back to pugs\n"); */ 46 ret = pugs_ ValToSv(pugs_Apply (val, inv, stack));46 ret = pugs_Apply(val, inv, stack); 47 47 free (stack); 48 48 49 ST(0) = ret;49 sv_setsv(ST(0), ret); 50 50 51 51 XSRETURN(1); -
src/perl5/pugsembed.c
r3946 r3948 23 23 isa[0] = pugs_PvToVal("Code"); 24 24 isa[1] = NULL; 25 if ( pugs_ValToIv(pugs_Apply(pugs_PvToVal("&isa"), val, isa))) {25 if (SvTRUE(pugs_Apply(pugs_PvToVal("&isa"), val, isa))) { 26 26 if (__init) { 27 27 stack[0] = sv; 28 28 stack[1] = NULL; 29 fprintf (stderr, "isa code\n");29 /* fprintf (stderr, "isa code\n"); */ 30 30 sv = perl5_apply(newSVpv("code", 0), newSVpv("pugs::guts", 0), stack, NULL, G_SCALAR); 31 31 } -
src/perl5/pugsembed.h
r3943 r3948 8 8 9 9 extern Val *pugs_Eval ( char *code ); 10 extern Val*pugs_Apply ( Val *sub, Val *inv, Val **args );10 extern SV *pugs_Apply ( Val *sub, Val *inv, Val **args ); 11 11 12 12 extern Val *pugs_IvToVal ( IV iv );
