| 1 |
|
| #define PERL_NO_GET_CONTEXT |
| 2 |
|
| #include <EXTERN.h> |
| 3 |
|
| #include <perl.h> |
| 4 |
|
| #include <XSUB.h> |
| 5 |
|
| |
| 6 |
|
| #ifdef USE_PPPORT |
| 7 |
|
| #include "ppport.h" |
| 8 |
|
| #endif |
| 9 |
|
| |
| 10 |
|
| static IV |
| 11 |
1 |
| hidek_get_age(pTHX_ SV* const hidek) { |
| 12 |
1 |
| dSP; |
| 13 |
|
| IV retval; |
| 14 |
1 |
▶ | PUSHMARK(SP); |
Branch: 1 branch
| Branch | True | False | Total |
| PUSHMARK(SP); |
0 |
1 |
1 |
|
| 15 |
1 |
▶ | XPUSHs(hidek); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(hidek); |
0 |
1 |
1 |
|
| 16 |
1 |
| PUTBACK; |
| 17 |
1 |
| call_method("age", G_SCALAR); |
| 18 |
1 |
| SPAGAIN; |
| 19 |
1 |
| retval = POPi; |
| 20 |
1 |
| PUTBACK; |
| 21 |
1 |
| return retval; |
| 22 |
|
| } |
| 23 |
|
| |
| 24 |
|
| MODULE = Acme::Hidek PACKAGE = Acme::Hidek |
| 25 |
|
| |
| 26 |
|
| PROTOTYPES: DISABLE |
| 27 |
|
| |
| 28 |
|
| void |
| 29 |
|
| we_love_hidek(SV* hidek) |
| 30 |
|
| CODE: |
| 31 |
|
| { |
| 32 |
|
| IV i; |
| 33 |
1 |
| IV age = hidek_get_age(aTHX_ hidek) * 100; |
| 34 |
5601 |
▶ | for(i = 0; i < age; i++) { |
Branch: 1 branch
| Branch | True | False | Total |
| for(i = 0; i < age; i++) { |
5600 |
1 |
5601 |
|
| 35 |
5600 |
| PerlIO_stdoutf("We love hidek!\n"); |
| 36 |
|
| } |
| 37 |
|
| } |