This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Argument sanity checking.
[perl5.git] / ext / XS / APItest / APItest.xs
1 #include "EXTERN.h"
2 #include "perl.h"
3 #include "XSUB.h"
4
5 MODULE = XS::APItest            PACKAGE = XS::APItest
6
7 PROTOTYPES: DISABLE
8
9 void
10 print_double(val)
11         double val
12         CODE:
13         printf("%5.3f\n",val);
14
15 int
16 have_long_double()
17         CODE:
18 #ifdef HAS_LONG_DOUBLE
19         RETVAL = 1;
20 #else
21         RETVAL = 0;
22 #endif
23         OUTPUT:
24         RETVAL
25
26 void
27 print_long_double()
28         CODE:
29 #ifdef HAS_LONG_DOUBLE
30 #   if defined(PERL_PRIfldbl) && (LONG_DOUBLESIZE > DOUBLESIZE)
31         long double val = 7.0;
32         printf("%5.3" PERL_PRIfldbl "\n",val);
33 #   else
34         double val = 7.0;
35         printf("%5.3f\n",val);
36 #   endif
37 #endif
38
39 void
40 print_int(val)
41         int val
42         CODE:
43         printf("%d\n",val);
44
45 void
46 print_long(val)
47         long val
48         CODE:
49         printf("%ld\n",val);
50
51 void
52 print_float(val)
53         float val
54         CODE:
55         printf("%5.3f\n",val);
56         
57 void
58 print_flush()
59         CODE:
60         fflush(stdout);