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