This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Make $FH no longer a global
[perl5.git] / dist / ExtUtils-ParseXS / lib / ExtUtils / xsubpp
CommitLineData
2304df62 1#!./miniperl
75f92628 2
6b09c160 3require 5.002;
c74be726
JK
4use ExtUtils::ParseXS qw(
5 process_file
6 report_error_count
7);
6b09c160
YST
8use Getopt::Long;
9
10my %args = ();
11
008fb49c 12my $usage = "Usage: xsubpp [-v] [-csuffix csuffix] [-except] [-prototypes] [-noversioncheck] [-nolinenumbers] [-nooptimize] [-noinout] [-noargtypes] [-s pattern] [-typemap typemap]... file.xs\n";
6b09c160
YST
13
14Getopt::Long::Configure qw(no_auto_abbrev no_ignore_case);
15
16@ARGV = grep {$_ ne '-C++'} @ARGV; # Allow -C++ for backward compatibility
17GetOptions(\%args, qw(hiertype!
18 prototypes!
19 versioncheck!
20 linenumbers!
21 optimize!
22 inout!
23 argtypes!
24 object_capi!
25 except!
26 v
27 typemap=s@
28 output=s
29 s=s
008fb49c 30 csuffix=s
6b09c160
YST
31 ))
32 or die $usage;
33
34if ($args{v}) {
35 print "xsubpp version $ExtUtils::ParseXS::VERSION\n";
36 exit;
37}
38
39@ARGV == 1 or die $usage;
40
41$args{filename} = shift @ARGV;
42
43process_file(%args);
c74be726 44exit( report_error_count() ? 1 : 0 );
6b09c160
YST
45
46__END__
47
75f92628
AD
48=head1 NAME
49
50xsubpp - compiler to convert Perl XS code into C code
51
52=head1 SYNOPSIS
53
6b09c160 54B<xsubpp> [B<-v>] [B<-except>] [B<-s pattern>] [B<-prototypes>] [B<-noversioncheck>] [B<-nolinenumbers>] [B<-nooptimize>] [B<-typemap typemap>] [B<-output filename>]... file.xs
75f92628
AD
55
56=head1 DESCRIPTION
57
b26a54d0
GS
58This compiler is typically run by the makefiles created by L<ExtUtils::MakeMaker>.
59
75f92628
AD
60I<xsubpp> will compile XS code into C code by embedding the constructs
61necessary to let C functions manipulate Perl values and creates the glue
62necessary to let Perl access those functions. The compiler uses typemaps to
63determine how to map C function parameters and variables to Perl values.
64
65The compiler will search for typemap files called I<typemap>. It will use
66the following search path to find default typemaps, with the rightmost
67typemap taking precedence.
68
69 ../../../typemap:../../typemap:../typemap:typemap
70
6b09c160
YST
71It will also use a default typemap installed as C<ExtUtils::typemap>.
72
75f92628
AD
73=head1 OPTIONS
74
b26a54d0
GS
75Note that the C<XSOPT> MakeMaker option may be used to add these options to
76any makefiles generated by MakeMaker.
77
75f92628
AD
78=over 5
79
0ab125c1
NIS
80=item B<-hiertype>
81
863b2ca0 82Retains '::' in type names so that C++ hierarchical types can be mapped.
0ab125c1 83
75f92628
AD
84=item B<-except>
85
86Adds exception handling stubs to the C code.
87
88=item B<-typemap typemap>
89
90Indicates that a user-supplied typemap should take precedence over the
91default typemaps. This option may be used multiple times, with the last
92typemap having the highest precedence.
93
6b09c160
YST
94=item B<-output filename>
95
96Specifies the name of the output file to generate. If no file is
97specified, output will be written to standard output.
98
8e07c86e
AD
99=item B<-v>
100
101Prints the I<xsubpp> version number to standard output, then exits.
102
8fc38fda 103=item B<-prototypes>
382b8d97 104
8fc38fda 105By default I<xsubpp> will not automatically generate prototype code for
106all xsubs. This flag will enable prototypes.
107
108=item B<-noversioncheck>
109
110Disables the run time test that determines if the object file (derived
111from the C<.xs> file) and the C<.pm> files have the same version
112number.
382b8d97 113
6f1abe2b
JT
114=item B<-nolinenumbers>
115
116Prevents the inclusion of `#line' directives in the output.
117
b26a54d0
GS
118=item B<-nooptimize>
119
120Disables certain optimizations. The only optimization that is currently
121affected is the use of I<target>s by the output C code (see L<perlguts>).
122This may significantly slow down the generated code, but this is the way
123B<xsubpp> of 5.005 and earlier operated.
124
11416672
GS
125=item B<-noinout>
126
127Disable recognition of C<IN>, C<OUT_LIST> and C<INOUT_LIST> declarations.
128
129=item B<-noargtypes>
130
131Disable recognition of ANSI-like descriptions of function signature.
132
6b09c160
YST
133=item B<-C++>
134
135Currently doesn't do anything at all. This flag has been a no-op for
136many versions of perl, at least as far back as perl5.003_07. It's
137allowed here for backwards compatibility.
138
c5be433b 139=back
75f92628
AD
140
141=head1 ENVIRONMENT
142
143No environment variables are used.
144
145=head1 AUTHOR
146
6b09c160
YST
147Originally by Larry Wall. Turned into the C<ExtUtils::ParseXS> module
148by Ken Williams.
75f92628 149
f06db76b
AD
150=head1 MODIFICATION HISTORY
151
6b09c160 152See the file F<Changes>.
e50aee73 153
75f92628
AD
154=head1 SEE ALSO
155
6b09c160 156perl(1), perlxs(1), perlxstut(1), ExtUtils::ParseXS
75f92628
AD
157
158=cut
93a17b20 159