This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Move ExtUtils::ParseXS from cpan/ to dist/
[perl5.git] / dist / ExtUtils-ParseXS / t / XSMore.xs
1 #include "EXTERN.h"
2 #include "perl.h"
3 #include "XSUB.h"
4
5 =for testing
6
7 This parts are ignored.
8
9 =cut
10
11 STATIC void
12 outlist(int* a, int* b){
13         *a = 'a';
14         *b = 'b';
15 }
16
17 STATIC int
18 len(const char* const s, int const l){
19         return l;
20 }
21
22 MODULE = XSMore         PACKAGE = XSMore
23
24 =for testing
25
26 This parts are also ignored.
27
28 =cut
29
30 PROTOTYPES: ENABLE
31
32 VERSIONCHECK: DISABLE
33
34 REQUIRE: 2.20
35
36 SCOPE: DISABLE
37
38 FALLBACK: TRUE
39
40 BOOT:
41         sv_setiv(get_sv("XSMore::boot_ok", TRUE), 100);
42
43
44 void
45 prototype_ssa()
46 PROTOTYPE: $$@
47 CODE:
48         NOOP;
49
50 void
51 attr_method(self, ...)
52 ATTRS: method
53 CODE:
54         NOOP;
55
56 #define RET_1 1
57 #define RET_2 2
58
59 int
60 return_1()
61 CASE: ix == 1
62         ALIAS:
63                 return_1 = RET_1
64                 return_2 = RET_2
65         CODE:
66                 RETVAL = ix;
67         OUTPUT:
68                 RETVAL
69 CASE: ix == 2
70         CODE:
71                 RETVAL = ix;
72         OUTPUT:
73                 RETVAL
74
75 int
76 arg_init(x)
77         int x = SvIV($arg);
78 CODE:
79         RETVAL = x;
80 OUTPUT:
81         RETVAL
82
83 int
84 myabs(...)
85 OVERLOAD: abs
86 CODE:
87         RETVAL = 42;
88 OUTPUT:
89         RETVAL
90
91 void
92 hook(IN AV* av)
93 INIT:
94         av_push(av, newSVpv("INIT", 0));
95 CODE:
96         av_push(av, newSVpv("CODE", 0));
97 POSTCALL:
98         av_push(av, newSVpv("POSTCALL", 0));
99 CLEANUP:
100         av_push(av, newSVpv("CLEANUP", 0));
101
102
103 void
104 outlist(OUTLIST int a, OUTLIST int b)
105
106 int
107 len(char* s, int length(s))
108
109 INCLUDE_COMMAND: $^X -Ilib -It/lib -MIncludeTester -e IncludeTester::print_xs
110
111 #if 1
112
113 INCLUDE: XSInclude.xsh
114
115 #else
116
117 # for testing #else directive
118
119 #endif