Changeset 3956
- Timestamp:
- 05/27/05 04:31:40 (4 years ago)
- svk:copy_cache_prev:
- 5515
- Location:
- src
- Files:
-
- 5 modified
-
Pugs/Run/Perl5.hs (modified) (4 diffs)
-
Pugs/Types.hs (modified) (1 diff)
-
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
r3948 r3956 9 9 import Pugs.Prim.Eval 10 10 import Pugs.Embed.Perl5 11 import Pugs.Types 11 12 import Foreign 12 13 import Foreign.C.Types … … 18 19 19 20 foreign export ccall "pugs_Apply" 20 pugs_apply :: PugsVal -> PugsVal -> Ptr PugsVal -> IO PerlSV21 pugs_apply :: PugsVal -> PugsVal -> Ptr PugsVal -> CInt -> IO PerlSV 21 22 22 23 foreign export ccall "pugs_ValToSv" … … 60 61 mkVal val 61 62 62 pugs_apply :: PugsVal -> PugsVal -> Ptr PugsVal -> IO PerlSV63 pugs_apply subPtr invPtr argsPtr = do63 pugs_apply :: PugsVal -> PugsVal -> Ptr PugsVal -> CInt -> IO PerlSV 64 pugs_apply subPtr invPtr argsPtr cxt = do 64 65 -- print "DEREF #0" 65 66 env <- askPerl5Env … … 74 75 VStr name -> Var name 75 76 _ -> Val sub 76 val <- runEvalIO env $ evalExp (App subExp (fmap Val inv) (map Val args)) 77 val <- runEvalIO env $ 78 evalExp (Cxt (cxtEnum cxt) $ App subExp (fmap Val inv) (map Val args)) 77 79 case val of 78 80 PerlSV sv -> return sv -
src/Pugs/Types.hs
r3887 r3956 81 81 enumCxt (CxtSlurpy _) = 1 82 82 83 cxtEnum :: (Show a, Num a) => a -> Cxt 84 cxtEnum 128 = CxtVoid 85 cxtEnum 0 = cxtItemAny 86 cxtEnum 1 = cxtSlurpyAny 87 cxtEnum n = error ("Invalid cxt: " ++ show n) 88 83 89 -- |Make a type value representing the type with the specified name. 84 90 -- Recognises conjunctive (&) and disjunctive (|) types. -
src/perl5/perl5.c
r3955 r3956 52 52 stack[i-2] = NULL; 53 53 54 ST(0) = pugs_Apply(val, inv, stack );54 ST(0) = pugs_Apply(val, inv, stack, GIMME_V); 55 55 sv_dump (ret); 56 56 free (stack); -
src/perl5/pugsembed.c
r3948 r3956 23 23 isa[0] = pugs_PvToVal("Code"); 24 24 isa[1] = NULL; 25 if (SvTRUE(pugs_Apply(pugs_PvToVal("&isa"), val, isa ))) {25 if (SvTRUE(pugs_Apply(pugs_PvToVal("&isa"), val, isa, G_SCALAR))) { 26 26 if (__init) { 27 27 stack[0] = sv; -
src/perl5/pugsembed.h
r3948 r3956 8 8 9 9 extern Val *pugs_Eval ( char *code ); 10 extern SV *pugs_Apply ( Val *sub, Val *inv, Val **args );10 extern SV *pugs_Apply ( Val *sub, Val *inv, Val **args, int cxt ); 11 11 12 12 extern Val *pugs_IvToVal ( IV iv );
