PageRenderTime 22ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/perl/bin/xsubpp

http://github.com/dwimperl/perl-5.14.2.1-32bit-windows
Perl | 173 lines | 114 code | 58 blank | 1 comment | 7 complexity | 4d75bc2f7becceb6a194afa3670840d7 MD5 | raw file
Possible License(s): LGPL-3.0, Unlicense, GPL-2.0, LGPL-2.0, BSD-3-Clause, LGPL-2.1, AGPL-1.0, GPL-3.0
  1. #!perl
  2. use 5.006;
  3. use strict;
  4. eval {
  5. require ExtUtils::ParseXS;
  6. ExtUtils::ParseXS->import(
  7. qw(
  8. process_file
  9. report_error_count
  10. )
  11. );
  12. 1;
  13. }
  14. or do {
  15. my $err = $@ || 'Zombie error';
  16. my $v = $ExtUtils::ParseXS::VERSION;
  17. $v = '<undef>' if not defined $v;
  18. die "Failed to load or import from ExtUtils::ParseXS (version $v). Please check that ExtUtils::ParseXS is installed correctly and that the newest version will be found in your \@INC path: $err";
  19. };
  20. use Getopt::Long;
  21. my %args = ();
  22. my $usage = "Usage: xsubpp [-v] [-csuffix csuffix] [-except] [-prototypes] [-noversioncheck] [-nolinenumbers] [-nooptimize] [-noinout] [-noargtypes] [-s pattern] [-typemap typemap]... file.xs\n";
  23. Getopt::Long::Configure qw(no_auto_abbrev no_ignore_case);
  24. @ARGV = grep {$_ ne '-C++'} @ARGV; # Allow -C++ for backward compatibility
  25. GetOptions(\%args, qw(hiertype!
  26. prototypes!
  27. versioncheck!
  28. linenumbers!
  29. optimize!
  30. inout!
  31. argtypes!
  32. object_capi!
  33. except!
  34. v
  35. typemap=s@
  36. output=s
  37. s=s
  38. csuffix=s
  39. ))
  40. or die $usage;
  41. if ($args{v}) {
  42. print "xsubpp version $ExtUtils::ParseXS::VERSION\n";
  43. exit;
  44. }
  45. @ARGV == 1 or die $usage;
  46. $args{filename} = shift @ARGV;
  47. process_file(%args);
  48. exit( report_error_count() ? 1 : 0 );
  49. __END__
  50. =head1 NAME
  51. xsubpp - compiler to convert Perl XS code into C code
  52. =head1 SYNOPSIS
  53. B<xsubpp> [B<-v>] [B<-except>] [B<-s pattern>] [B<-prototypes>] [B<-noversioncheck>] [B<-nolinenumbers>] [B<-nooptimize>] [B<-typemap typemap>] [B<-output filename>]... file.xs
  54. =head1 DESCRIPTION
  55. This compiler is typically run by the makefiles created by L<ExtUtils::MakeMaker>
  56. or by L<Module::Build> or other Perl module build tools.
  57. I<xsubpp> will compile XS code into C code by embedding the constructs
  58. necessary to let C functions manipulate Perl values and creates the glue
  59. necessary to let Perl access those functions. The compiler uses typemaps to
  60. determine how to map C function parameters and variables to Perl values.
  61. The compiler will search for typemap files called I<typemap>. It will use
  62. the following search path to find default typemaps, with the rightmost
  63. typemap taking precedence.
  64. ../../../typemap:../../typemap:../typemap:typemap
  65. It will also use a default typemap installed as C<ExtUtils::typemap>.
  66. =head1 OPTIONS
  67. Note that the C<XSOPT> MakeMaker option may be used to add these options to
  68. any makefiles generated by MakeMaker.
  69. =over 5
  70. =item B<-hiertype>
  71. Retains '::' in type names so that C++ hierarchical types can be mapped.
  72. =item B<-except>
  73. Adds exception handling stubs to the C code.
  74. =item B<-typemap typemap>
  75. Indicates that a user-supplied typemap should take precedence over the
  76. default typemaps. This option may be used multiple times, with the last
  77. typemap having the highest precedence.
  78. =item B<-output filename>
  79. Specifies the name of the output file to generate. If no file is
  80. specified, output will be written to standard output.
  81. =item B<-v>
  82. Prints the I<xsubpp> version number to standard output, then exits.
  83. =item B<-prototypes>
  84. By default I<xsubpp> will not automatically generate prototype code for
  85. all xsubs. This flag will enable prototypes.
  86. =item B<-noversioncheck>
  87. Disables the run time test that determines if the object file (derived
  88. from the C<.xs> file) and the C<.pm> files have the same version
  89. number.
  90. =item B<-nolinenumbers>
  91. Prevents the inclusion of `#line' directives in the output.
  92. =item B<-nooptimize>
  93. Disables certain optimizations. The only optimization that is currently
  94. affected is the use of I<target>s by the output C code (see L<perlguts>).
  95. This may significantly slow down the generated code, but this is the way
  96. B<xsubpp> of 5.005 and earlier operated.
  97. =item B<-noinout>
  98. Disable recognition of C<IN>, C<OUT_LIST> and C<INOUT_LIST> declarations.
  99. =item B<-noargtypes>
  100. Disable recognition of ANSI-like descriptions of function signature.
  101. =item B<-C++>
  102. Currently doesn't do anything at all. This flag has been a no-op for
  103. many versions of perl, at least as far back as perl5.003_07. It's
  104. allowed here for backwards compatibility.
  105. =back
  106. =head1 ENVIRONMENT
  107. No environment variables are used.
  108. =head1 AUTHOR
  109. Originally by Larry Wall. Turned into the C<ExtUtils::ParseXS> module
  110. by Ken Williams.
  111. =head1 MODIFICATION HISTORY
  112. See the file F<Changes>.
  113. =head1 SEE ALSO
  114. perl(1), perlxs(1), perlxstut(1), ExtUtils::ParseXS
  115. =cut