line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
/* |
2
|
|
|
|
|
|
|
* |
3
|
|
|
|
|
|
|
* Copyright (c) 2018, Nicolas R. |
4
|
|
|
|
|
|
|
* |
5
|
|
|
|
|
|
|
* This is free software; you can redistribute it and/or modify it under the |
6
|
|
|
|
|
|
|
* same terms as Perl itself. |
7
|
|
|
|
|
|
|
* |
8
|
|
|
|
|
|
|
*/ |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
#include |
11
|
|
|
|
|
|
|
#include |
12
|
|
|
|
|
|
|
#include |
13
|
|
|
|
|
|
|
#include |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
#if PERL_REVISION >= 5 && PERL_VERSION >= 10 |
16
|
|
|
|
|
|
|
# define CAN_USE_IX_FOR_PERL_PHASE 1 |
17
|
|
|
|
|
|
|
#else |
18
|
|
|
|
|
|
|
# define CAN_USE_IX_FOR_PERL_PHASE 0 |
19
|
|
|
|
|
|
|
#endif |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
MODULE = Check__GlobalPhase PACKAGE = Check::GlobalPhase |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
SV* |
24
|
|
|
|
|
|
|
in_global_phase_construct() |
25
|
|
|
|
|
|
|
ALIAS: |
26
|
|
|
|
|
|
|
in_global_phase_start = 1 |
27
|
|
|
|
|
|
|
in_global_phase_check = 2 |
28
|
|
|
|
|
|
|
in_global_phase_init = 3 |
29
|
|
|
|
|
|
|
in_global_phase_run = 4 |
30
|
|
|
|
|
|
|
in_global_phase_end = 5 |
31
|
|
|
|
|
|
|
in_global_phase_destruct = 6 |
32
|
|
|
|
|
|
|
PPCODE: |
33
|
|
|
|
|
|
|
{ |
34
|
|
|
|
|
|
|
/* using ix when we can -- probably most/all versions? */ |
35
|
|
|
|
|
|
|
#if CAN_USE_IX_FOR_PERL_PHASE |
36
|
30
|
|
|
|
|
|
int phase = ix; |
37
|
|
|
|
|
|
|
#else |
38
|
|
|
|
|
|
|
int phase = PERL_PHASE_CONSTRUCT; |
39
|
|
|
|
|
|
|
if ( ix == 1 ) { |
40
|
|
|
|
|
|
|
phase = PERL_PHASE_START; |
41
|
|
|
|
|
|
|
} else if ( ix == 2 ) { |
42
|
|
|
|
|
|
|
phase = PERL_PHASE_CHECK; |
43
|
|
|
|
|
|
|
} else if ( ix == 3 ) { |
44
|
|
|
|
|
|
|
phase = PERL_PHASE_INIT; |
45
|
|
|
|
|
|
|
} else if ( ix == 4 ) { |
46
|
|
|
|
|
|
|
phase = PERL_PHASE_RUN; |
47
|
|
|
|
|
|
|
} else if ( ix == 5 ) { |
48
|
|
|
|
|
|
|
phase = PERL_PHASE_END; |
49
|
|
|
|
|
|
|
} else if ( ix == 6 ) { |
50
|
|
|
|
|
|
|
phase = PERL_PHASE_DESTRUCT; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
#endif |
53
|
|
|
|
|
|
|
|
54
|
30
|
100
|
|
|
|
|
if ( PL_phase == phase ) { |
55
|
5
|
|
|
|
|
|
XSRETURN_YES; |
56
|
|
|
|
|
|
|
} else { |
57
|
25
|
|
|
|
|
|
XSRETURN_NO; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
SV* |
62
|
|
|
|
|
|
|
current_phase() |
63
|
|
|
|
|
|
|
PPCODE: |
64
|
|
|
|
|
|
|
{ |
65
|
5
|
50
|
|
|
|
|
XPUSHs(newSViv(PL_phase)); |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
BOOT: |
69
|
|
|
|
|
|
|
{ |
70
|
|
|
|
|
|
|
HV *stash; |
71
|
|
|
|
|
|
|
|
72
|
2
|
|
|
|
|
|
stash = gv_stashpvn("Check::GlobalPhase", 18, TRUE); |
73
|
|
|
|
|
|
|
|
74
|
2
|
|
|
|
|
|
newCONSTSUB(stash, "_loaded", &PL_sv_yes ); |
75
|
|
|
|
|
|
|
|
76
|
2
|
|
|
|
|
|
newCONSTSUB(stash, "PERL_PHASE_CONSTRUCT", newSViv(PERL_PHASE_CONSTRUCT) ); |
77
|
2
|
|
|
|
|
|
newCONSTSUB(stash, "PERL_PHASE_START", newSViv(PERL_PHASE_START) ); |
78
|
2
|
|
|
|
|
|
newCONSTSUB(stash, "PERL_PHASE_CHECK", newSViv(PERL_PHASE_CHECK) ); |
79
|
2
|
|
|
|
|
|
newCONSTSUB(stash, "PERL_PHASE_INIT", newSViv(PERL_PHASE_INIT) ); |
80
|
2
|
|
|
|
|
|
newCONSTSUB(stash, "PERL_PHASE_RUN", newSViv(PERL_PHASE_RUN) ); |
81
|
2
|
|
|
|
|
|
newCONSTSUB(stash, "PERL_PHASE_END", newSViv(PERL_PHASE_END) ); |
82
|
2
|
|
|
|
|
|
newCONSTSUB(stash, "PERL_PHASE_DESTRUCT", newSViv(PERL_PHASE_DESTRUCT) ); |
83
|
|
|
|
|
|
|
} |