| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
/* You may distribute under the terms of either the GNU General Public License |
|
2
|
|
|
|
|
|
|
* or the Artistic License (the same terms as Perl itself) |
|
3
|
|
|
|
|
|
|
* |
|
4
|
|
|
|
|
|
|
* (C) Paul Evans, 2024 -- leonerd@leonerd.org.uk |
|
5
|
|
|
|
|
|
|
*/ |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
#include "EXTERN.h" |
|
8
|
|
|
|
|
|
|
#include "perl.h" |
|
9
|
|
|
|
|
|
|
#include "XSUB.h" |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
#include "DataChecks.h" |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
#define HAVE_PERL_VERSION(R, V, S) \ |
|
14
|
|
|
|
|
|
|
(PERL_REVISION > (R) || (PERL_REVISION == (R) && (PERL_VERSION > (V) || (PERL_VERSION == (V) && (PERL_SUBVERSION >= (S)))))) |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
#include "optree-additions.c.inc" |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
MODULE = t::test PACKAGE = t::test |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
TYPEMAP: <
|
|
21
|
|
|
|
|
|
|
struct DataChecks_Checker * T_PTR |
|
22
|
|
|
|
|
|
|
HERE |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
struct DataChecks_Checker *make_checkdata(SV *checkspec, SV *name, SV *constraint = &PL_sv_undef) |
|
25
|
|
|
|
|
|
|
CODE: |
|
26
|
30
|
|
|
|
|
|
RETVAL = make_checkdata(checkspec); |
|
27
|
30
|
|
|
|
|
|
gen_assertmess(RETVAL, name, constraint); |
|
28
|
|
|
|
|
|
|
OUTPUT: |
|
29
|
|
|
|
|
|
|
RETVAL |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
void free_checkdata(struct DataChecks_Checker *checker); |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
bool check_value(struct DataChecks_Checker *checker, SV *value) |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
void assert_value(struct DataChecks_Checker *checker, SV *value) |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
SV *make_asserter_sub(struct DataChecks_Checker *checker, SV *flagname = &PL_sv_undef) |
|
38
|
|
|
|
|
|
|
CODE: |
|
39
|
|
|
|
|
|
|
{ |
|
40
|
6
|
50
|
|
|
|
|
if(!PL_parser) { |
|
41
|
|
|
|
|
|
|
/* We need to generate just enough of a PL_parser to keep newSTATEOP() |
|
42
|
|
|
|
|
|
|
* happy, otherwise it will SIGSEGV |
|
43
|
|
|
|
|
|
|
*/ |
|
44
|
6
|
|
|
|
|
|
SAVEVPTR(PL_parser); |
|
45
|
6
|
|
|
|
|
|
Newxz(PL_parser, 1, yy_parser); |
|
46
|
6
|
|
|
|
|
|
SAVEFREEPV(PL_parser); |
|
47
|
|
|
|
|
|
|
|
|
48
|
6
|
|
|
|
|
|
PL_parser->copline = NOLINE; |
|
49
|
6
|
|
|
|
|
|
PL_parser->preambling = NOLINE; |
|
50
|
|
|
|
|
|
|
} |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
U32 flags = 0; |
|
53
|
6
|
50
|
|
|
|
|
if(flagname && SvOK(flagname)) { |
|
|
|
100
|
|
|
|
|
|
|
54
|
1
|
50
|
|
|
|
|
if(SvPOK(flagname) && strEQ(SvPVX(flagname), "void")) |
|
|
|
50
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
flags = OPf_WANT_VOID; |
|
56
|
|
|
|
|
|
|
} |
|
57
|
|
|
|
|
|
|
|
|
58
|
6
|
|
|
|
|
|
I32 floorix = start_subparse(FALSE, 0); |
|
59
|
6
|
|
|
|
|
|
OP *body = newLISTOPn(OP_RETURN, 0, |
|
60
|
|
|
|
|
|
|
make_assertop_flags(checker, flags, newSLUGOP(0)), |
|
61
|
|
|
|
|
|
|
NULL); |
|
62
|
6
|
|
|
|
|
|
CV *cv = newATTRSUB(floorix, NULL, NULL, NULL, body); |
|
63
|
6
|
|
|
|
|
|
RETVAL = newRV_noinc((SV *)cv); |
|
64
|
|
|
|
|
|
|
} |
|
65
|
|
|
|
|
|
|
OUTPUT: |
|
66
|
|
|
|
|
|
|
RETVAL |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
BOOT: |
|
69
|
8
|
|
|
|
|
|
boot_data_checks(0); |