Commit | Line | Data |
---|---|---|
c619428f FC |
1 | #define PERL_NO_GET_CONTEXT |
2 | ||
3 | #include "EXTERN.h" | |
4 | #include "perl.h" | |
5 | #include "XSUB.h" | |
6 | ||
7fddb138 FC |
7 | #define MY_CXT_KEY "File::Glob::_guts" XS_VERSION |
8 | ||
9 | typedef struct { | |
10 | HV * x_DG_ENTRIES; | |
11 | Perl_ophook_t x_DG_OLD_OPHOOK; | |
12 | } my_cxt_t; | |
13 | ||
14 | START_MY_CXT | |
15 | ||
16 | static void | |
17 | glob_ophook(pTHX_ OP *o) | |
18 | { | |
b8bafbdc FC |
19 | if (PL_dirty) return; |
20 | { | |
7fddb138 FC |
21 | dMY_CXT; |
22 | if (!MY_CXT.x_DG_ENTRIES) | |
23 | MY_CXT.x_DG_ENTRIES = get_hv("File::DosGlob::entries", 0); | |
24 | if (MY_CXT.x_DG_ENTRIES) | |
d53d746d | 25 | (void)hv_delete(MY_CXT.x_DG_ENTRIES, (char *)&o, sizeof(OP *),G_DISCARD); |
7fddb138 | 26 | if (MY_CXT.x_DG_OLD_OPHOOK) MY_CXT.x_DG_OLD_OPHOOK(aTHX_ o); |
b8bafbdc | 27 | } |
7fddb138 FC |
28 | } |
29 | ||
c619428f FC |
30 | MODULE = File::DosGlob PACKAGE = File::DosGlob |
31 | ||
32 | PROTOTYPES: DISABLE | |
33 | ||
7fddb138 | 34 | BOOT: |
09391cc5 | 35 | { |
7fddb138 FC |
36 | MY_CXT_INIT; |
37 | { | |
38 | dMY_CXT; | |
39 | MY_CXT.x_DG_ENTRIES = NULL; | |
40 | MY_CXT.x_DG_OLD_OPHOOK = PL_opfreehook; | |
41 | PL_opfreehook = glob_ophook; | |
42 | } | |
09391cc5 | 43 | } |
7fddb138 | 44 | |
c619428f FC |
45 | SV * |
46 | _callsite(...) | |
47 | CODE: | |
d53d746d | 48 | PERL_UNUSED_VAR(items); |
c619428f FC |
49 | RETVAL = newSVpvn( |
50 | (char *)&cxstack[cxstack_ix].blk_sub.retop, sizeof(OP *) | |
51 | ); | |
52 | OUTPUT: | |
53 | RETVAL |