| 1 | #include "EXTERN.h" | ||
| 2 | #include "perl.h" | ||
| 3 | #include "XSUB.h" | ||
| 4 | #include "inlinebc.h" | ||
| 5 | |||
| 6 | /* parse and compile the bc code down to byte code */ | ||
| 7 | 0 | SV* bc_parse(SV* code){ | |
| 8 | |||
| 9 | 0 | return newSVpv(my_perl_bc_parse(SvPV(code, SvCUR(code))), 0); | |
| 10 | |||
| 11 | } | ||
| 12 | |||
| 13 | /* execute bc byte code */ | ||
| 14 | 0 | SV* bc_run(SV* code){ | |
| 15 | |||
| 16 | 0 | return newSVpv(my_perl_bc_run(SvPV(code, SvCUR(code))), 0); | |
| 17 | |||
| 18 | } | ||
| 19 | |||
| 20 | /* initialise the bc interpreter */ | ||
| 21 | 0 | void bc_init(int use_math_lib){ | |
| 22 | |||
| 23 | 0 | my_perl_bc_init(use_math_lib); | |
| 24 | |||
| 25 | 0 | } | |
| 26 | |||
| 27 | |||
| 28 | MODULE = Inline::BC PACKAGE = Inline::BC | ||
| 29 | |||
| 30 | BOOT: | ||
| 31 | #ifdef CREATE_RUBY | ||
| 32 | do_rdinit(); | ||
| 33 | #endif | ||
| 34 | |||
| 35 | PROTOTYPES: DISABLE | ||
| 36 | |||
| 37 | |||
| 38 | SV * | ||
| 39 | bc_parse (code) | ||
| 40 | SV * code | ||
| 41 | |||
| 42 | SV * | ||
| 43 | bc_run (code) | ||
| 44 | SV * code | ||
| 45 | |||
| 46 | void | ||
| 47 | bc_init (use_math_lib) | ||
| 48 | int use_math_lib |