| 1 |
|
| #define PERL_NO_GET_CONTEXT |
| 2 |
|
| #include "EXTERN.h" |
| 3 |
|
| #include "perl.h" |
| 4 |
|
| #include "XSUB.h" |
| 5 |
|
| |
| 6 |
|
| #include <stdint.h> |
| 7 |
|
| #include <string.h> |
| 8 |
|
| #include <stdio.h> |
| 9 |
|
| #include <stdarg.h> |
| 10 |
|
| |
| 11 |
|
| #define MY_CXT_KEY "Time::Keeper::Recurrence::_guts" XS_VERSION |
| 12 |
|
| |
| 13 |
|
| #include "time_keeper_abi.h" |
| 14 |
|
| #include "time_keeper_zone_abi.h" |
| 15 |
|
| #include "tkr/tkr_abi_in.h" |
| 16 |
|
| #include "tkr/tkr_civil.h" |
| 17 |
|
| #include "tkr/tkr_rule.h" |
| 18 |
|
| #include "tkr/tkr_rrule.h" |
| 19 |
|
| #include "tkr/tkr_cron.h" |
| 20 |
|
| #include "tkr/tkr_describe.h" |
| 21 |
|
| #include "tkr/tkr_obj.h" |
| 22 |
|
| #include "tkr/tkr_zone.h" |
| 23 |
|
| #include "tkr/tkr_walk.h" |
| 24 |
|
| #include "tkr/tkr_walk_sv.h" |
| 25 |
|
| #include "tkr/tkr_set.h" |
| 26 |
|
| #include "tkr/tkr_ical.h" |
| 27 |
|
| #include "tkr/tkr_set_sv.h" |
| 28 |
|
| #include <math.h> |
| 29 |
|
| #include "time_keeper_recurrence_abi.h" |
| 30 |
|
| #include "tkr/tkr_abi_impl.h" |
| 31 |
|
| #include "tkr/tkr_abi_selftest.h" |
| 32 |
|
| |
| 33 |
|
| typedef struct { |
| 34 |
|
| HV *stash; /* Time::Keeper::Recurrence's */ |
| 35 |
|
| HV *set_stash; /* Time::Keeper::Recurrence::Set's */ |
| 36 |
|
| } my_cxt_t; |
| 37 |
|
| START_MY_CXT |
| 38 |
|
| |
| 39 |
73 |
| static HV *tkr_rule_stash(pTHX) { dMY_CXT; return MY_CXT.stash; } |
| 40 |
1208 |
| static HV *tkr_set_stash(pTHX) { dMY_CXT; return MY_CXT.set_stash; } |
| 41 |
|
| |
| 42 |
|
| /* The stash to bless into: the class named, or the rule's own. */ |
| 43 |
|
| static HV * |
| 44 |
2784 |
| tkr_stash_for(pTHX_ SV *class_or_obj) |
| 45 |
|
| { |
| 46 |
|
| dMY_CXT; |
| 47 |
2784 |
▶ | if (SvROK(class_or_obj)) |
Branch: 1 branch
| Branch | True | False | Total |
| if (SvROK(class_or_obj)) |
0 |
2784 |
2784 |
|
| 48 |
0 |
| return SvSTASH(SvRV(class_or_obj)); |
| 49 |
2784 |
▶ | if (SvPOK(class_or_obj)) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (SvPOK(class_or_obj)) { |
2784 |
0 |
2784 |
|
| 50 |
2784 |
| HV *st = gv_stashsv(class_or_obj, 0); |
| 51 |
2784 |
▶ | if (st) |
Branch: 1 branch
| Branch | True | False | Total |
| if (st) |
2784 |
0 |
2784 |
|
| 52 |
2784 |
| return st; |
| 53 |
|
| } |
| 54 |
0 |
| return MY_CXT.stash; |
| 55 |
|
| } |
| 56 |
|
| |
| 57 |
|
| MODULE = Time::Keeper::Recurrence PACKAGE = Time::Keeper::Recurrence |
| 58 |
|
| |
| 59 |
|
| PROTOTYPES: DISABLE |
| 60 |
|
| |
| 61 |
|
| BOOT: |
| 62 |
|
| { |
| 63 |
|
| MY_CXT_INIT; |
| 64 |
20 |
| MY_CXT.stash = gv_stashpvs("Time::Keeper::Recurrence", GV_ADD); |
| 65 |
20 |
| MY_CXT.set_stash = gv_stashpvs("Time::Keeper::Recurrence::Set", GV_ADD); |
| 66 |
20 |
| tkr_tk(aTHX); |
| 67 |
|
| } |
| 68 |
|
| |
| 69 |
|
| void |
| 70 |
|
| CLONE(...) |
| 71 |
|
| CODE: |
| 72 |
|
| { |
| 73 |
|
| MY_CXT_CLONE; |
| 74 |
0 |
| MY_CXT.stash = gv_stashpvs("Time::Keeper::Recurrence", GV_ADD); |
| 75 |
0 |
| MY_CXT.set_stash = gv_stashpvs("Time::Keeper::Recurrence::Set", GV_ADD); |
| 76 |
|
| PERL_UNUSED_VAR(items); |
| 77 |
|
| } |
| 78 |
|
| |
| 79 |
|
| INCLUDE: xs/abi_in.xs |
| 80 |
|
| INCLUDE: xs/rule.xs |
| 81 |
|
| INCLUDE: xs/walk.xs |
| 82 |
|
| INCLUDE: xs/set.xs |
| 83 |
|
| INCLUDE: xs/abi.xs |