This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perlop - Invocant only needs to be an object or class name for method calls
[perl5.git] / dist / ExtUtils-ParseXS / t / XSTest.xs
1 #include "EXTERN.h"
2 #include "perl.h"
3 #include "XSUB.h"
4
5 void
6 xstest_something (char * some_thing)
7 {
8         some_thing = some_thing;
9 }
10
11 void
12 xstest_something2 (char * some_thing)
13 {
14         some_thing = some_thing;
15 }
16
17
18 MODULE = XSTest         PACKAGE = XSTest        PREFIX = xstest_
19
20 PROTOTYPES: DISABLE
21
22 int
23 is_even(input)
24         int     input
25     CODE:
26         RETVAL = (input % 2 == 0);
27     OUTPUT:
28         RETVAL
29
30 void
31 xstest_something (myclass, some_thing)
32         char * some_thing
33     C_ARGS:
34         some_thing
35
36 void
37 xstest_something2 (some_thing)
38         char * some_thing
39
40 void
41 xstest_something3 (myclass, some_thing)
42         SV   * myclass
43         char * some_thing
44     PREINIT:
45         int i = 0;
46     PPCODE:
47         /* it's up to us clear these warnings */
48         myclass = myclass;
49         some_thing = some_thing;
50         i = i;
51         XSRETURN_UNDEF;
52         
53 int
54 consts (myclass)
55         SV * myclass
56     ALIAS:
57         const_one = 1
58         const_two = 2
59         const_three = 3
60     CODE:
61         /* it's up to us clear these warnings */
62         myclass = myclass;
63         ix = ix;
64         RETVAL = 1;
65     OUTPUT:
66         RETVAL
67
68 bool
69 T_BOOL(in)
70         bool in
71     CODE:
72         RETVAL = in;
73     OUTPUT: RETVAL
74
75 bool
76 T_BOOL_2(in)
77         bool in
78     CODE:
79         PERL_UNUSED_VAR(RETVAL);
80     OUTPUT: in
81
82 void
83 T_BOOL_OUT( out, in )
84         bool out
85         bool in
86     CODE:
87         out = in;
88     OUTPUT: out