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