- Timestamp:
- 05/26/05 17:22:54 (4 years ago)
- svk:copy_cache_prev:
- 5482
- Location:
- src/perl5
- Files:
-
- 4 modified
-
perl5.c (modified) (4 diffs)
-
perl5.h (modified) (1 diff)
-
pugsembed.c (modified) (1 diff)
-
pugsembed.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
src/perl5/perl5.c
r3911 r3918 2 2 #include <XSUB.h> 3 3 #include "perlxsi.c" 4 #include "pugsembed.c" 4 5 5 6 /* Workaround for mapstart: the only op which needs a different ppaddr */ … … 126 127 } 127 128 129 int 130 perl5_SvIV ( SV *sv ) 131 { 132 return((int)SvIV(sv)); 133 } 134 135 double 136 perl5_SvNV ( SV *sv ) 137 { 138 return((double)SvNV(sv)); 139 } 140 128 141 bool 129 142 perl5_SvTRUE ( SV * sv ) … … 134 147 } 135 148 136 void *137 perl5_SvPtr ( SV *sv )138 {139 if (!sv_isa(sv, "pugs")) {140 return NULL;141 }142 IV tmp = SvIV((SV*)SvRV(sv));143 return((void *)tmp);144 }145 146 149 SV * 147 150 perl5_newSVpv ( char * pv ) … … 154 157 { 155 158 return(newSViv(iv)); 156 }157 158 SV *159 perl5_newSVptr ( void * ptr )160 {161 SV *sv = newSV(0);162 sv_setref_pv(sv, "pugs", ptr);163 return(sv);164 159 } 165 160 -
src/perl5/perl5.h
r3901 r3918 5 5 PerlInterpreter * perl5_init ( int argc, char **argv ); 6 6 char * perl5_SvPV ( SV * sv ); 7 int perl5_SvIV ( SV * sv ); 8 double perl5_SvNV ( SV * sv ); 7 9 bool perl5_SvTRUE ( SV * sv ); 8 void * perl5_SvPtr ( SV * sv );9 10 SV * perl5_newSVpv ( char * pv ); 10 11 SV * perl5_newSViv ( int iv ); 11 SV * perl5_newSVptr ( void * ptr );12 12 SV * perl5_call(char *subname, int argc, SV** args, int cxt); 13 13 bool perl5_can(SV *inv, char *subname); -
src/perl5/pugsembed.c
r3917 r3918 18 18 return (sv); 19 19 } 20 21 Val *pugs_Eval ( char *code ) { return NULL; } 22 23 Val *pugs_Apply ( Val *sub, Val *inv, Val **args ) { return NULL; } 24 25 Val *pugs_IvToVal ( IV iv ) { return NULL; } 26 27 Val *pugs_NvToVal ( NV iv ) { return NULL; } 28 29 Val *pugs_PvToVal ( char *pv ) { return NULL; } 30 31 Val *pugs_MkSvRef ( SV *sv ) { return NULL; } 32 33 SV *pugs_ValToSv ( Val *val ) { return NULL; } -
src/perl5/pugsembed.h
r3917 r3918 1 1 #include "perl5.h" 2 #include <HsFFI.h> 2 3 3 typedef void Val; 4 #ifndef PugsValDefined 5 #define PugsValDefined 1 6 /* #define PUGS_EXTERN extern */ 7 #define PUGS_EXTERN 8 typedef HsStablePtr Val; 9 #endif 4 10 5 externVal *pugs_Eval ( char *code );6 externVal *pugs_Apply ( Val *sub, Val *inv, Val **args );11 PUGS_EXTERN Val *pugs_Eval ( char *code ); 12 PUGS_EXTERN Val *pugs_Apply ( Val *sub, Val *inv, Val **args ); 7 13 8 externVal *pugs_IvToVal ( IV iv );9 externVal *pugs_NvToVal ( NV iv );10 externVal *pugs_PvToVal ( char *pv );14 PUGS_EXTERN Val *pugs_IvToVal ( IV iv ); 15 PUGS_EXTERN Val *pugs_NvToVal ( NV iv ); 16 PUGS_EXTERN Val *pugs_PvToVal ( char *pv ); 11 17 12 externVal *pugs_MkSvRef ( SV *sv );13 externSV *pugs_ValToSv ( Val *val );18 PUGS_EXTERN Val *pugs_MkSvRef ( SV *sv ); 19 PUGS_EXTERN SV *pugs_ValToSv ( Val *val ); 14 20 15 21 Val *pugs_SvToVal ( SV *sv );
