line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
void |
2
|
|
|
|
|
|
|
constant(sv) |
3
|
|
|
|
|
|
|
PREINIT: |
4
|
|
|
|
|
|
|
#ifdef dXSTARG |
5
|
0
|
0
|
|
|
|
|
dXSTARG; /* Faster if we have it. */ |
6
|
|
|
|
|
|
|
#else |
7
|
|
|
|
|
|
|
dTARGET; |
8
|
|
|
|
|
|
|
#endif |
9
|
|
|
|
|
|
|
STRLEN len; |
10
|
|
|
|
|
|
|
int type; |
11
|
|
|
|
|
|
|
/* IV iv; Uncomment this if you need to return IVs */ |
12
|
|
|
|
|
|
|
/* NV nv; Uncomment this if you need to return NVs */ |
13
|
|
|
|
|
|
|
/* const char *pv; Uncomment this if you need to return PVs */ |
14
|
|
|
|
|
|
|
INPUT: |
15
|
|
|
|
|
|
|
SV * sv; |
16
|
|
|
|
|
|
|
const char * s = SvPV(sv, len); |
17
|
|
|
|
|
|
|
PPCODE: |
18
|
0
|
|
|
|
|
|
type = constant(aTHX_ s, len); |
19
|
|
|
|
|
|
|
/* Return 1 or 2 items. First is error message, or undef if no error. |
20
|
|
|
|
|
|
|
Second, if present, is found value */ |
21
|
0
|
|
|
|
|
|
switch (type) { |
22
|
|
|
|
|
|
|
case PERL_constant_NOTFOUND: |
23
|
0
|
|
|
|
|
|
sv = |
24
|
0
|
|
|
|
|
|
sv_2mortal(newSVpvf("%s is not a valid match::simple::XS macro", s)); |
25
|
0
|
|
|
|
|
|
PUSHs(sv); |
26
|
0
|
|
|
|
|
|
break; |
27
|
|
|
|
|
|
|
case PERL_constant_NOTDEF: |
28
|
0
|
|
|
|
|
|
sv = sv_2mortal(newSVpvf( |
29
|
|
|
|
|
|
|
"Your vendor has not defined match::simple::XS macro %s, used", |
30
|
|
|
|
|
|
|
s)); |
31
|
0
|
|
|
|
|
|
PUSHs(sv); |
32
|
0
|
|
|
|
|
|
break; |
33
|
|
|
|
|
|
|
/* Uncomment this if you need to return IVs |
34
|
|
|
|
|
|
|
case PERL_constant_ISIV: |
35
|
|
|
|
|
|
|
EXTEND(SP, 1); |
36
|
|
|
|
|
|
|
PUSHs(&PL_sv_undef); |
37
|
|
|
|
|
|
|
PUSHi(iv); |
38
|
|
|
|
|
|
|
break; */ |
39
|
|
|
|
|
|
|
/* Uncomment this if you need to return NOs |
40
|
|
|
|
|
|
|
case PERL_constant_ISNO: |
41
|
|
|
|
|
|
|
EXTEND(SP, 1); |
42
|
|
|
|
|
|
|
PUSHs(&PL_sv_undef); |
43
|
|
|
|
|
|
|
PUSHs(&PL_sv_no); |
44
|
|
|
|
|
|
|
break; */ |
45
|
|
|
|
|
|
|
/* Uncomment this if you need to return NVs |
46
|
|
|
|
|
|
|
case PERL_constant_ISNV: |
47
|
|
|
|
|
|
|
EXTEND(SP, 1); |
48
|
|
|
|
|
|
|
PUSHs(&PL_sv_undef); |
49
|
|
|
|
|
|
|
PUSHn(nv); |
50
|
|
|
|
|
|
|
break; */ |
51
|
|
|
|
|
|
|
/* Uncomment this if you need to return PVs |
52
|
|
|
|
|
|
|
case PERL_constant_ISPV: |
53
|
|
|
|
|
|
|
EXTEND(SP, 1); |
54
|
|
|
|
|
|
|
PUSHs(&PL_sv_undef); |
55
|
|
|
|
|
|
|
PUSHp(pv, strlen(pv)); |
56
|
|
|
|
|
|
|
break; */ |
57
|
|
|
|
|
|
|
/* Uncomment this if you need to return PVNs |
58
|
|
|
|
|
|
|
case PERL_constant_ISPVN: |
59
|
|
|
|
|
|
|
EXTEND(SP, 1); |
60
|
|
|
|
|
|
|
PUSHs(&PL_sv_undef); |
61
|
|
|
|
|
|
|
PUSHp(pv, iv); |
62
|
|
|
|
|
|
|
break; */ |
63
|
|
|
|
|
|
|
/* Uncomment this if you need to return SVs |
64
|
|
|
|
|
|
|
case PERL_constant_ISSV: |
65
|
|
|
|
|
|
|
EXTEND(SP, 1); |
66
|
|
|
|
|
|
|
PUSHs(&PL_sv_undef); |
67
|
|
|
|
|
|
|
PUSHs(sv); |
68
|
|
|
|
|
|
|
break; */ |
69
|
|
|
|
|
|
|
/* Uncomment this if you need to return UNDEFs |
70
|
|
|
|
|
|
|
case PERL_constant_ISUNDEF: |
71
|
|
|
|
|
|
|
break; */ |
72
|
|
|
|
|
|
|
/* Uncomment this if you need to return UVs |
73
|
|
|
|
|
|
|
case PERL_constant_ISUV: |
74
|
|
|
|
|
|
|
EXTEND(SP, 1); |
75
|
|
|
|
|
|
|
PUSHs(&PL_sv_undef); |
76
|
|
|
|
|
|
|
PUSHu((UV)iv); |
77
|
|
|
|
|
|
|
break; */ |
78
|
|
|
|
|
|
|
/* Uncomment this if you need to return YESs |
79
|
|
|
|
|
|
|
case PERL_constant_ISYES: |
80
|
|
|
|
|
|
|
EXTEND(SP, 1); |
81
|
|
|
|
|
|
|
PUSHs(&PL_sv_undef); |
82
|
|
|
|
|
|
|
PUSHs(&PL_sv_yes); |
83
|
|
|
|
|
|
|
break; */ |
84
|
|
|
|
|
|
|
default: |
85
|
0
|
|
|
|
|
|
sv = sv_2mortal(newSVpvf( |
86
|
|
|
|
|
|
|
"Unexpected return type %d while processing match::simple::XS macro %s, used", |
87
|
|
|
|
|
|
|
type, s)); |
88
|
0
|
|
|
|
|
|
PUSHs(sv); |
89
|
|
|
|
|
|
|
} |