|
|
@ -1,23 +1,240 @@
|
|
|
|
From bd2b15a246ebcb8cee2c060b18f9157481a084f9 Mon Sep 17 00:00:00 2001
|
|
|
|
From c85261a4cef59150c379ff88a21d0f9ca6374dc2 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Jitka Plesnikova <jplesnik@redhat.com>
|
|
|
|
From: Jitka Plesnikova <jplesnik@redhat.com>
|
|
|
|
Date: Fri, 7 Jan 2022 11:03:48 +0100
|
|
|
|
Date: Thu, 24 May 2018 09:57:37 +0200
|
|
|
|
Subject: [PATCH] Add perlxs* man pages
|
|
|
|
Subject: [PATCH] Upgrade to 3.39
|
|
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
---
|
|
|
|
lib/perlxs.pod | 2429 +++++++++++++++++++++++++++++++++++++++++
|
|
|
|
Changes | 6 +
|
|
|
|
lib/perlxstut.pod | 1425 ++++++++++++++++++++++++
|
|
|
|
lib/ExtUtils/ParseXS.pm | 14 +-
|
|
|
|
lib/perlxstypemap.pod | 711 ++++++++++++
|
|
|
|
lib/ExtUtils/ParseXS/Constants.pm | 2 +-
|
|
|
|
3 files changed, 4565 insertions(+)
|
|
|
|
lib/ExtUtils/ParseXS/CountLines.pm | 2 +-
|
|
|
|
|
|
|
|
lib/ExtUtils/ParseXS/Eval.pm | 6 +-
|
|
|
|
|
|
|
|
lib/ExtUtils/ParseXS/Utilities.pm | 2 +-
|
|
|
|
|
|
|
|
lib/ExtUtils/Typemaps.pm | 6 +-
|
|
|
|
|
|
|
|
lib/ExtUtils/Typemaps/Cmd.pm | 2 +-
|
|
|
|
|
|
|
|
lib/ExtUtils/Typemaps/InputMap.pm | 2 +-
|
|
|
|
|
|
|
|
lib/ExtUtils/Typemaps/OutputMap.pm | 2 +-
|
|
|
|
|
|
|
|
lib/ExtUtils/Typemaps/Type.pm | 2 +-
|
|
|
|
|
|
|
|
lib/perlxs.pod | 2354 ++++++++++++++++++++++++++++++++++++
|
|
|
|
|
|
|
|
lib/perlxstut.pod | 1401 +++++++++++++++++++++
|
|
|
|
|
|
|
|
lib/perlxstypemap.pod | 711 +++++++++++
|
|
|
|
|
|
|
|
t/XSTest.xs | 1 +
|
|
|
|
|
|
|
|
t/XSUsage.xs | 2 +
|
|
|
|
|
|
|
|
16 files changed, 4497 insertions(+), 18 deletions(-)
|
|
|
|
create mode 100644 lib/perlxs.pod
|
|
|
|
create mode 100644 lib/perlxs.pod
|
|
|
|
create mode 100644 lib/perlxstut.pod
|
|
|
|
create mode 100644 lib/perlxstut.pod
|
|
|
|
create mode 100644 lib/perlxstypemap.pod
|
|
|
|
create mode 100644 lib/perlxstypemap.pod
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/Changes b/Changes
|
|
|
|
|
|
|
|
index 0181371..f9fb36e 100644
|
|
|
|
|
|
|
|
--- a/Changes
|
|
|
|
|
|
|
|
+++ b/Changes
|
|
|
|
|
|
|
|
@@ -1,5 +1,11 @@
|
|
|
|
|
|
|
|
Revision history for Perl extension ExtUtils::ParseXS.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+3.36
|
|
|
|
|
|
|
|
+ - Make generated code avoid warnings about the "items" variable
|
|
|
|
|
|
|
|
+ being unused
|
|
|
|
|
|
|
|
+ - Avoid some unused-variable warnings generated by XS code in the
|
|
|
|
|
|
|
|
+ test suite
|
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
3.35 - Mon Jul 31 17:50:00 CET 2017
|
|
|
|
|
|
|
|
- Fix ExtUtils-ParseXS/t/*.t that needed '.' in @INC (David Mitchell)
|
|
|
|
|
|
|
|
- Remove impediment to compiling under C++11 (Karl Williamson)
|
|
|
|
|
|
|
|
diff --git a/lib/ExtUtils/ParseXS.pm b/lib/ExtUtils/ParseXS.pm
|
|
|
|
|
|
|
|
index d629cf6..e1f0940 100644
|
|
|
|
|
|
|
|
--- a/lib/ExtUtils/ParseXS.pm
|
|
|
|
|
|
|
|
+++ b/lib/ExtUtils/ParseXS.pm
|
|
|
|
|
|
|
|
@@ -11,12 +11,12 @@ use Symbol;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
our $VERSION;
|
|
|
|
|
|
|
|
BEGIN {
|
|
|
|
|
|
|
|
- $VERSION = '3.35';
|
|
|
|
|
|
|
|
+ $VERSION = '3.39';
|
|
|
|
|
|
|
|
+ require ExtUtils::ParseXS::Constants; ExtUtils::ParseXS::Constants->VERSION($VERSION);
|
|
|
|
|
|
|
|
+ require ExtUtils::ParseXS::CountLines; ExtUtils::ParseXS::CountLines->VERSION($VERSION);
|
|
|
|
|
|
|
|
+ require ExtUtils::ParseXS::Utilities; ExtUtils::ParseXS::Utilities->VERSION($VERSION);
|
|
|
|
|
|
|
|
+ require ExtUtils::ParseXS::Eval; ExtUtils::ParseXS::Eval->VERSION($VERSION);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
-use ExtUtils::ParseXS::Constants $VERSION;
|
|
|
|
|
|
|
|
-use ExtUtils::ParseXS::CountLines $VERSION;
|
|
|
|
|
|
|
|
-use ExtUtils::ParseXS::Utilities $VERSION;
|
|
|
|
|
|
|
|
-use ExtUtils::ParseXS::Eval $VERSION;
|
|
|
|
|
|
|
|
$VERSION = eval $VERSION if $VERSION =~ /_/;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
use ExtUtils::ParseXS::Utilities qw(
|
|
|
|
|
|
|
|
@@ -519,9 +519,10 @@ EOF
|
|
|
|
|
|
|
|
EOF
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
- # cv likely to be unused
|
|
|
|
|
|
|
|
+ # cv and items likely to be unused
|
|
|
|
|
|
|
|
print Q(<<"EOF");
|
|
|
|
|
|
|
|
# PERL_UNUSED_VAR(cv); /* -W */
|
|
|
|
|
|
|
|
+# PERL_UNUSED_VAR(items); /* -W */
|
|
|
|
|
|
|
|
EOF
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -871,6 +872,7 @@ EOF
|
|
|
|
|
|
|
|
#XS_EUPXS(XS_$self->{Packid}_nil)
|
|
|
|
|
|
|
|
#{
|
|
|
|
|
|
|
|
# dXSARGS;
|
|
|
|
|
|
|
|
+# PERL_UNUSED_VAR(items);
|
|
|
|
|
|
|
|
# XSRETURN_EMPTY;
|
|
|
|
|
|
|
|
#}
|
|
|
|
|
|
|
|
#
|
|
|
|
|
|
|
|
diff --git a/lib/ExtUtils/ParseXS/Constants.pm b/lib/ExtUtils/ParseXS/Constants.pm
|
|
|
|
|
|
|
|
index 2150fb8..45b5674 100644
|
|
|
|
|
|
|
|
--- a/lib/ExtUtils/ParseXS/Constants.pm
|
|
|
|
|
|
|
|
+++ b/lib/ExtUtils/ParseXS/Constants.pm
|
|
|
|
|
|
|
|
@@ -3,7 +3,7 @@ use strict;
|
|
|
|
|
|
|
|
use warnings;
|
|
|
|
|
|
|
|
use Symbol;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-our $VERSION = '3.35';
|
|
|
|
|
|
|
|
+our $VERSION = '3.39';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
=head1 NAME
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/lib/ExtUtils/ParseXS/CountLines.pm b/lib/ExtUtils/ParseXS/CountLines.pm
|
|
|
|
|
|
|
|
index ad86b57..5b48449 100644
|
|
|
|
|
|
|
|
--- a/lib/ExtUtils/ParseXS/CountLines.pm
|
|
|
|
|
|
|
|
+++ b/lib/ExtUtils/ParseXS/CountLines.pm
|
|
|
|
|
|
|
|
@@ -1,7 +1,7 @@
|
|
|
|
|
|
|
|
package ExtUtils::ParseXS::CountLines;
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-our $VERSION = '3.35';
|
|
|
|
|
|
|
|
+our $VERSION = '3.39';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
our $SECTION_END_MARKER;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/lib/ExtUtils/ParseXS/Eval.pm b/lib/ExtUtils/ParseXS/Eval.pm
|
|
|
|
|
|
|
|
index 6b06bf5..9eba5e5 100644
|
|
|
|
|
|
|
|
--- a/lib/ExtUtils/ParseXS/Eval.pm
|
|
|
|
|
|
|
|
+++ b/lib/ExtUtils/ParseXS/Eval.pm
|
|
|
|
|
|
|
|
@@ -2,7 +2,7 @@ package ExtUtils::ParseXS::Eval;
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
|
|
|
|
use warnings;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-our $VERSION = '3.35';
|
|
|
|
|
|
|
|
+our $VERSION = '3.39';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
=head1 NAME
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -29,7 +29,7 @@ Warns the contents of C<$@> if any.
|
|
|
|
|
|
|
|
Not all these variables are necessarily considered "public" wrt. use in
|
|
|
|
|
|
|
|
typemaps, so beware. Variables set up from the ExtUtils::ParseXS object:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- $Package $Alias $func_name $Full_func_name $pname
|
|
|
|
|
|
|
|
+ $Package $ALIAS $func_name $Full_func_name $pname
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Variables set up from C<$other_hashref>:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -63,7 +63,7 @@ Warns the contents of C<$@> if any.
|
|
|
|
|
|
|
|
Not all these variables are necessarily considered "public" wrt. use in
|
|
|
|
|
|
|
|
typemaps, so beware. Variables set up from the ExtUtils::ParseXS object:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- $Package $Alias $func_name $Full_func_name $pname
|
|
|
|
|
|
|
|
+ $Package $ALIAS $func_name $Full_func_name $pname
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Variables set up from C<$other_hashref>:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/lib/ExtUtils/ParseXS/Utilities.pm b/lib/ExtUtils/ParseXS/Utilities.pm
|
|
|
|
|
|
|
|
index bc1e098..ae25b33 100644
|
|
|
|
|
|
|
|
--- a/lib/ExtUtils/ParseXS/Utilities.pm
|
|
|
|
|
|
|
|
+++ b/lib/ExtUtils/ParseXS/Utilities.pm
|
|
|
|
|
|
|
|
@@ -5,7 +5,7 @@ use Exporter;
|
|
|
|
|
|
|
|
use File::Spec;
|
|
|
|
|
|
|
|
use ExtUtils::ParseXS::Constants ();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-our $VERSION = '3.35';
|
|
|
|
|
|
|
|
+our $VERSION = '3.39';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
our (@ISA, @EXPORT_OK);
|
|
|
|
|
|
|
|
@ISA = qw(Exporter);
|
|
|
|
|
|
|
|
diff --git a/lib/ExtUtils/Typemaps.pm b/lib/ExtUtils/Typemaps.pm
|
|
|
|
|
|
|
|
index 992d15b..a762322 100644
|
|
|
|
|
|
|
|
--- a/lib/ExtUtils/Typemaps.pm
|
|
|
|
|
|
|
|
+++ b/lib/ExtUtils/Typemaps.pm
|
|
|
|
|
|
|
|
@@ -2,7 +2,7 @@ package ExtUtils::Typemaps;
|
|
|
|
|
|
|
|
use 5.006001;
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
|
|
|
|
use warnings;
|
|
|
|
|
|
|
|
-our $VERSION = '3.35';
|
|
|
|
|
|
|
|
+our $VERSION = '3.38';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
require ExtUtils::ParseXS;
|
|
|
|
|
|
|
|
require ExtUtils::ParseXS::Constants;
|
|
|
|
|
|
|
|
@@ -781,7 +781,9 @@ corresponding OUTPUT code:
|
|
|
|
|
|
|
|
$var.context.value().size());
|
|
|
|
|
|
|
|
',
|
|
|
|
|
|
|
|
'T_OUT' => ' {
|
|
|
|
|
|
|
|
- GV *gv = newGVgen("$Package");
|
|
|
|
|
|
|
|
+ GV *gv = (GV *)sv_newmortal();
|
|
|
|
|
|
|
|
+ gv_init_pvn(gv, gv_stashpvs("$Package",1),
|
|
|
|
|
|
|
|
+ "__ANONIO__",10,0);
|
|
|
|
|
|
|
|
if ( do_open(gv, "+>&", 3, FALSE, 0, 0, $var) )
|
|
|
|
|
|
|
|
sv_setsv(
|
|
|
|
|
|
|
|
$arg,
|
|
|
|
|
|
|
|
diff --git a/lib/ExtUtils/Typemaps/Cmd.pm b/lib/ExtUtils/Typemaps/Cmd.pm
|
|
|
|
|
|
|
|
index 7ff0780..3c33f54 100644
|
|
|
|
|
|
|
|
--- a/lib/ExtUtils/Typemaps/Cmd.pm
|
|
|
|
|
|
|
|
+++ b/lib/ExtUtils/Typemaps/Cmd.pm
|
|
|
|
|
|
|
|
@@ -2,7 +2,7 @@ package ExtUtils::Typemaps::Cmd;
|
|
|
|
|
|
|
|
use 5.006001;
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
|
|
|
|
use warnings;
|
|
|
|
|
|
|
|
-our $VERSION = '3.35';
|
|
|
|
|
|
|
|
+our $VERSION = '3.38';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
use ExtUtils::Typemaps;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/lib/ExtUtils/Typemaps/InputMap.pm b/lib/ExtUtils/Typemaps/InputMap.pm
|
|
|
|
|
|
|
|
index b626973..bf19df1 100644
|
|
|
|
|
|
|
|
--- a/lib/ExtUtils/Typemaps/InputMap.pm
|
|
|
|
|
|
|
|
+++ b/lib/ExtUtils/Typemaps/InputMap.pm
|
|
|
|
|
|
|
|
@@ -2,7 +2,7 @@ package ExtUtils::Typemaps::InputMap;
|
|
|
|
|
|
|
|
use 5.006001;
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
|
|
|
|
use warnings;
|
|
|
|
|
|
|
|
-our $VERSION = '3.35';
|
|
|
|
|
|
|
|
+our $VERSION = '3.38';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
=head1 NAME
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/lib/ExtUtils/Typemaps/OutputMap.pm b/lib/ExtUtils/Typemaps/OutputMap.pm
|
|
|
|
|
|
|
|
index 8c72e5b..90adb48 100644
|
|
|
|
|
|
|
|
--- a/lib/ExtUtils/Typemaps/OutputMap.pm
|
|
|
|
|
|
|
|
+++ b/lib/ExtUtils/Typemaps/OutputMap.pm
|
|
|
|
|
|
|
|
@@ -2,7 +2,7 @@ package ExtUtils::Typemaps::OutputMap;
|
|
|
|
|
|
|
|
use 5.006001;
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
|
|
|
|
use warnings;
|
|
|
|
|
|
|
|
-our $VERSION = '3.35';
|
|
|
|
|
|
|
|
+our $VERSION = '3.38';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
=head1 NAME
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/lib/ExtUtils/Typemaps/Type.pm b/lib/ExtUtils/Typemaps/Type.pm
|
|
|
|
|
|
|
|
index 7909bbe..01bd51d 100644
|
|
|
|
|
|
|
|
--- a/lib/ExtUtils/Typemaps/Type.pm
|
|
|
|
|
|
|
|
+++ b/lib/ExtUtils/Typemaps/Type.pm
|
|
|
|
|
|
|
|
@@ -4,7 +4,7 @@ use strict;
|
|
|
|
|
|
|
|
use warnings;
|
|
|
|
|
|
|
|
require ExtUtils::Typemaps;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-our $VERSION = '3.35';
|
|
|
|
|
|
|
|
+our $VERSION = '3.38';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
=head1 NAME
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/lib/perlxs.pod b/lib/perlxs.pod
|
|
|
|
diff --git a/lib/perlxs.pod b/lib/perlxs.pod
|
|
|
|
new file mode 100644
|
|
|
|
new file mode 100644
|
|
|
|
index 0000000..aa7ccad
|
|
|
|
index 0000000..1419ee0
|
|
|
|
--- /dev/null
|
|
|
|
--- /dev/null
|
|
|
|
+++ b/lib/perlxs.pod
|
|
|
|
+++ b/lib/perlxs.pod
|
|
|
|
@@ -0,0 +1,2429 @@
|
|
|
|
@@ -0,0 +1,2354 @@
|
|
|
|
+=head1 NAME
|
|
|
|
+=head1 NAME
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+perlxs - XS language reference manual
|
|
|
|
+perlxs - XS language reference manual
|
|
|
@ -42,8 +259,8 @@ index 0000000..aa7ccad
|
|
|
|
+calling conventions.
|
|
|
|
+calling conventions.
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+The glue code pulls the arguments from the Perl stack, converts these
|
|
|
|
+The glue code pulls the arguments from the Perl stack, converts these
|
|
|
|
+Perl values to the formats expected by a C function, calls this C function,
|
|
|
|
+Perl values to the formats expected by a C function, call this C function,
|
|
|
|
+and then transfers the return values of the C function back to Perl.
|
|
|
|
+transfers the return values of the C function back to Perl.
|
|
|
|
+Return values here may be a conventional C return value or any C
|
|
|
|
+Return values here may be a conventional C return value or any C
|
|
|
|
+function arguments that may serve as output parameters. These return
|
|
|
|
+function arguments that may serve as output parameters. These return
|
|
|
|
+values may be passed back to Perl either by putting them on the
|
|
|
|
+values may be passed back to Perl either by putting them on the
|
|
|
@ -99,11 +316,6 @@ index 0000000..aa7ccad
|
|
|
|
+significantly more convenient mechanism for creating the extension
|
|
|
|
+significantly more convenient mechanism for creating the extension
|
|
|
|
+glue code. See L<http://www.swig.org/> for more information.
|
|
|
|
+glue code. See L<http://www.swig.org/> for more information.
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+For simple bindings to C libraries as well as other machine code libraries,
|
|
|
|
|
|
|
|
+consider instead using the much simpler
|
|
|
|
|
|
|
|
+L<libffi|http://sourceware.org/libffi/> interface via CPAN modules like
|
|
|
|
|
|
|
|
+L<FFI::Platypus> or L<FFI::Raw>.
|
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
+=head2 On The Road
|
|
|
|
+=head2 On The Road
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+Many of the examples which follow will concentrate on creating an interface
|
|
|
|
+Many of the examples which follow will concentrate on creating an interface
|
|
|
@ -219,7 +431,7 @@ index 0000000..aa7ccad
|
|
|
|
+ bool make_char_uppercase(char *c);
|
|
|
|
+ bool make_char_uppercase(char *c);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+are used in absolutely incompatible manner. Parameters to these functions
|
|
|
|
+are used in absolutely incompatible manner. Parameters to these functions
|
|
|
|
+could be described to B<xsubpp> like this:
|
|
|
|
+could be described B<xsubpp> like this:
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ char * s
|
|
|
|
+ char * s
|
|
|
|
+ char &c
|
|
|
|
+ char &c
|
|
|
@ -623,7 +835,7 @@ index 0000000..aa7ccad
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ bool_t
|
|
|
|
+ bool_t
|
|
|
|
+ rpcb_gettime(host,timep)
|
|
|
|
+ rpcb_gettime(host,timep)
|
|
|
|
+ char *host = (char *)SvPVbyte_nolen($arg);
|
|
|
|
+ char *host = (char *)SvPV_nolen($arg);
|
|
|
|
+ time_t &timep = 0;
|
|
|
|
+ time_t &timep = 0;
|
|
|
|
+ OUTPUT:
|
|
|
|
+ OUTPUT:
|
|
|
|
+ timep
|
|
|
|
+ timep
|
|
|
@ -650,7 +862,7 @@ index 0000000..aa7ccad
|
|
|
|
+ bool_t
|
|
|
|
+ bool_t
|
|
|
|
+ rpcb_gettime(host,timep)
|
|
|
|
+ rpcb_gettime(host,timep)
|
|
|
|
+ time_t &timep; /* \$v{timep}=@{[$v{timep}=$arg]} */
|
|
|
|
+ time_t &timep; /* \$v{timep}=@{[$v{timep}=$arg]} */
|
|
|
|
+ char *host + SvOK($v{timep}) ? SvPVbyte_nolen($arg) : NULL;
|
|
|
|
+ char *host + SvOK($v{timep}) ? SvPV_nolen($arg) : NULL;
|
|
|
|
+ OUTPUT:
|
|
|
|
+ OUTPUT:
|
|
|
|
+ timep
|
|
|
|
+ timep
|
|
|
|
+
|
|
|
|
+
|
|
|
@ -1013,7 +1225,7 @@ index 0000000..aa7ccad
|
|
|
|
+ char *host = "localhost";
|
|
|
|
+ char *host = "localhost";
|
|
|
|
+ CODE:
|
|
|
|
+ CODE:
|
|
|
|
+ if( items > 1 )
|
|
|
|
+ if( items > 1 )
|
|
|
|
+ host = (char *)SvPVbyte_nolen(ST(1));
|
|
|
|
+ host = (char *)SvPV_nolen(ST(1));
|
|
|
|
+ RETVAL = rpcb_gettime( host, &timep );
|
|
|
|
+ RETVAL = rpcb_gettime( host, &timep );
|
|
|
|
+ OUTPUT:
|
|
|
|
+ OUTPUT:
|
|
|
|
+ timep
|
|
|
|
+ timep
|
|
|
@ -1314,7 +1526,7 @@ index 0000000..aa7ccad
|
|
|
|
+ char *host = "localhost";
|
|
|
|
+ char *host = "localhost";
|
|
|
|
+ CODE:
|
|
|
|
+ CODE:
|
|
|
|
+ if( items > 1 )
|
|
|
|
+ if( items > 1 )
|
|
|
|
+ host = (char *)SvPVbyte_nolen(ST(1));
|
|
|
|
+ host = (char *)SvPV_nolen(ST(1));
|
|
|
|
+ RETVAL = rpcb_gettime( host, &timep );
|
|
|
|
+ RETVAL = rpcb_gettime( host, &timep );
|
|
|
|
+ OUTPUT:
|
|
|
|
+ OUTPUT:
|
|
|
|
+ timep
|
|
|
|
+ timep
|
|
|
@ -1352,46 +1564,6 @@ index 0000000..aa7ccad
|
|
|
|
+ OUTPUT:
|
|
|
|
+ OUTPUT:
|
|
|
|
+ timep
|
|
|
|
+ timep
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+A warning will be produced when you create more than one alias to the same
|
|
|
|
|
|
|
|
+value. This may be worked around in a backwards compatible way by creating
|
|
|
|
|
|
|
|
+multiple defines which resolve to the same value, or with a modern version
|
|
|
|
|
|
|
|
+of ExtUtils::ParseXS you can use a symbolic alias, which are denoted with
|
|
|
|
|
|
|
|
+a C<< => >> instead of a C<< = >>. For instance you could change the above
|
|
|
|
|
|
|
|
+so that the alias section looked like this:
|
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
+ ALIAS:
|
|
|
|
|
|
|
|
+ FOO::gettime = 1
|
|
|
|
|
|
|
|
+ BAR::getit = 2
|
|
|
|
|
|
|
|
+ BAZ::gettime => FOO::gettime
|
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
+this would have the same effect as this:
|
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
+ ALIAS:
|
|
|
|
|
|
|
|
+ FOO::gettime = 1
|
|
|
|
|
|
|
|
+ BAR::getit = 2
|
|
|
|
|
|
|
|
+ BAZ::gettime = 1
|
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
+except that the latter will produce warnings during the build process. A
|
|
|
|
|
|
|
|
+mechanism that would work in a backwards compatible way with older
|
|
|
|
|
|
|
|
+versions of our tool chain would be to do this:
|
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
+ #define FOO_GETTIME 1
|
|
|
|
|
|
|
|
+ #define BAR_GETIT 2
|
|
|
|
|
|
|
|
+ #define BAZ_GETTIME 1
|
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
+ bool_t
|
|
|
|
|
|
|
|
+ rpcb_gettime(host,timep)
|
|
|
|
|
|
|
|
+ char *host
|
|
|
|
|
|
|
|
+ time_t &timep
|
|
|
|
|
|
|
|
+ ALIAS:
|
|
|
|
|
|
|
|
+ FOO::gettime = FOO_GETTIME
|
|
|
|
|
|
|
|
+ BAR::getit = BAR_GETIT
|
|
|
|
|
|
|
|
+ BAZ::gettime = BAZ_GETTIME
|
|
|
|
|
|
|
|
+ INIT:
|
|
|
|
|
|
|
|
+ printf("# ix = %d\n", ix );
|
|
|
|
|
|
|
|
+ OUTPUT:
|
|
|
|
|
|
|
|
+ timep
|
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
+=head2 The OVERLOAD: Keyword
|
|
|
|
+=head2 The OVERLOAD: Keyword
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+Instead of writing an overloaded interface using pure Perl, you
|
|
|
|
+Instead of writing an overloaded interface using pure Perl, you
|
|
|
@ -1808,8 +1980,8 @@ index 0000000..aa7ccad
|
|
|
|
+ if( sv_isobject($arg) && (SvTYPE(SvRV($arg)) == SVt_PVMG) )
|
|
|
|
+ if( sv_isobject($arg) && (SvTYPE(SvRV($arg)) == SVt_PVMG) )
|
|
|
|
+ $var = ($type)SvIV((SV*)SvRV( $arg ));
|
|
|
|
+ $var = ($type)SvIV((SV*)SvRV( $arg ));
|
|
|
|
+ else{
|
|
|
|
+ else{
|
|
|
|
+ warn(\"${Package}::$func_name() -- \"
|
|
|
|
+ warn("${Package}::$func_name() -- " .
|
|
|
|
+ \"$var is not a blessed SV reference\");
|
|
|
|
+ "$var is not a blessed SV reference");
|
|
|
|
+ XSRETURN_UNDEF;
|
|
|
|
+ XSRETURN_UNDEF;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
@ -2045,8 +2217,6 @@ index 0000000..aa7ccad
|
|
|
|
+Always place the START_MY_CXT macro directly after the declaration
|
|
|
|
+Always place the START_MY_CXT macro directly after the declaration
|
|
|
|
+of C<my_cxt_t>.
|
|
|
|
+of C<my_cxt_t>.
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+=for apidoc Amnh||START_MY_CXT
|
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
+=item MY_CXT_INIT
|
|
|
|
+=item MY_CXT_INIT
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+The MY_CXT_INIT macro initializes storage for the C<my_cxt_t> struct.
|
|
|
|
+The MY_CXT_INIT macro initializes storage for the C<my_cxt_t> struct.
|
|
|
@ -2056,15 +2226,11 @@ index 0000000..aa7ccad
|
|
|
|
+interpreter instance, except for interpreters cloned from existing ones.
|
|
|
|
+interpreter instance, except for interpreters cloned from existing ones.
|
|
|
|
+(But see L</MY_CXT_CLONE> below.)
|
|
|
|
+(But see L</MY_CXT_CLONE> below.)
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+=for apidoc Amnh||MY_CXT_INIT
|
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
+=item dMY_CXT
|
|
|
|
+=item dMY_CXT
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+Use the dMY_CXT macro (a declaration) in all the functions that access
|
|
|
|
+Use the dMY_CXT macro (a declaration) in all the functions that access
|
|
|
|
+MY_CXT.
|
|
|
|
+MY_CXT.
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+=for apidoc Amnh||dMY_CXT
|
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
+=item MY_CXT
|
|
|
|
+=item MY_CXT
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+Use the MY_CXT macro to access members of the C<my_cxt_t> struct. For
|
|
|
|
+Use the MY_CXT macro to access members of the C<my_cxt_t> struct. For
|
|
|
@ -2085,14 +2251,6 @@ index 0000000..aa7ccad
|
|
|
|
+of invoking it in each function it is possible to pass the declaration
|
|
|
|
+of invoking it in each function it is possible to pass the declaration
|
|
|
|
+onto other functions using the C<aMY_CXT>/C<pMY_CXT> macros, eg
|
|
|
|
+onto other functions using the C<aMY_CXT>/C<pMY_CXT> macros, eg
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+=for apidoc Amnh||_aMY_CXT
|
|
|
|
|
|
|
|
+=for apidoc Amnh||aMY_CXT
|
|
|
|
|
|
|
|
+=for apidoc Amnh||aMY_CXT_
|
|
|
|
|
|
|
|
+=for apidoc Amnh||_pMY_CXT
|
|
|
|
|
|
|
|
+=for apidoc Amnh||pMY_CXT
|
|
|
|
|
|
|
|
+=for apidoc Amnh||pMY_CXT_
|
|
|
|
|
|
|
|
+=for apidoc Amnh||MY_CXT
|
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
+ void sub1() {
|
|
|
|
+ void sub1() {
|
|
|
|
+ dMY_CXT;
|
|
|
|
+ dMY_CXT;
|
|
|
|
+ MY_CXT.index = 1;
|
|
|
|
+ MY_CXT.index = 1;
|
|
|
@ -2115,8 +2273,6 @@ index 0000000..aa7ccad
|
|
|
|
+C<CLONE()> function), causes a byte-for-byte copy of the structure to be
|
|
|
|
+C<CLONE()> function), causes a byte-for-byte copy of the structure to be
|
|
|
|
+taken, and any future dMY_CXT will cause the copy to be accessed instead.
|
|
|
|
+taken, and any future dMY_CXT will cause the copy to be accessed instead.
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+=for apidoc Amnh||MY_CXT_CLONE
|
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
+=item MY_CXT_INIT_INTERP(my_perl)
|
|
|
|
+=item MY_CXT_INIT_INTERP(my_perl)
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+=item dMY_CXT_INTERP(my_perl)
|
|
|
|
+=item dMY_CXT_INTERP(my_perl)
|
|
|
@ -2163,8 +2319,7 @@ index 0000000..aa7ccad
|
|
|
|
+ #include "perl.h"
|
|
|
|
+ #include "perl.h"
|
|
|
|
+ #include "XSUB.h"
|
|
|
|
+ #include "XSUB.h"
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /* Note: On glibc 2.13 and earlier, this needs be <rpc/rpc.h> */
|
|
|
|
+ #include <rpc/rpc.h>
|
|
|
|
+ #include <tirpc/rpc.h>
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ typedef struct netconfig Netconfig;
|
|
|
|
+ typedef struct netconfig Netconfig;
|
|
|
|
+
|
|
|
|
+
|
|
|
@ -2224,8 +2379,6 @@ index 0000000..aa7ccad
|
|
|
|
+ print "time = $a\n";
|
|
|
|
+ print "time = $a\n";
|
|
|
|
+ print "netconf = $netconf\n";
|
|
|
|
+ print "netconf = $netconf\n";
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+In Makefile.PL add -ltirpc and -I/usr/include/tirpc.
|
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
+=head1 CAVEATS
|
|
|
|
+=head1 CAVEATS
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+XS code has full access to system calls including C library functions.
|
|
|
|
+XS code has full access to system calls including C library functions.
|
|
|
@ -2336,7 +2489,7 @@ index 0000000..aa7ccad
|
|
|
|
+continues to use C<POSIX::setlocale()>, and the interpreter translates
|
|
|
|
+continues to use C<POSIX::setlocale()>, and the interpreter translates
|
|
|
|
+that into the per-thread functions.
|
|
|
|
+that into the per-thread functions.
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+All other locale-sensitive functions automatically use the per-thread
|
|
|
|
+All other locale-senstive functions automatically use the per-thread
|
|
|
|
+locale, if that is turned on, and failing that, the global locale. Thus
|
|
|
|
+locale, if that is turned on, and failing that, the global locale. Thus
|
|
|
|
+calls to C<setlocale> are ineffective on POSIX systems for the current
|
|
|
|
+calls to C<setlocale> are ineffective on POSIX systems for the current
|
|
|
|
+thread if that thread is using a per-thread locale. If perl is compiled
|
|
|
|
+thread if that thread is using a per-thread locale. If perl is compiled
|
|
|
@ -2429,30 +2582,19 @@ index 0000000..aa7ccad
|
|
|
|
+=head1 XS VERSION
|
|
|
|
+=head1 XS VERSION
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+This document covers features supported by C<ExtUtils::ParseXS>
|
|
|
|
+This document covers features supported by C<ExtUtils::ParseXS>
|
|
|
|
+(also known as C<xsubpp>) 3.51
|
|
|
|
+(also known as C<xsubpp>) 3.13_01.
|
|
|
|
+
|
|
|
|
|
|
|
|
+=head1 AUTHOR DIAGNOSTICS
|
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
+As of version 3.49 certain warnings are disabled by default. While developing
|
|
|
|
|
|
|
|
+you can set C<$ENV{AUTHOR_WARNINGS}> to true in your environment or in your
|
|
|
|
|
|
|
|
+Makefile.PL, or set C<$ExtUtils::ParseXS::AUTHOR_WARNINGS> to true via code, or
|
|
|
|
|
|
|
|
+pass C<< author_warnings=>1 >> into process_file() explicitly. Currently this will
|
|
|
|
|
|
|
|
+enable stricter alias checking but more warnings might be added in the future.
|
|
|
|
|
|
|
|
+The kind of warnings this will enable are only helpful to the author of the XS
|
|
|
|
|
|
|
|
+file, and the diagnostics produced will not include installation specific
|
|
|
|
|
|
|
|
+details so they are only useful to the maintainer of the XS code itself.
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+=head1 AUTHOR
|
|
|
|
+=head1 AUTHOR
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+Originally written by Dean Roehrich <F<roehrich@cray.com>>.
|
|
|
|
+Originally written by Dean Roehrich <F<roehrich@cray.com>>.
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+Maintained since 1996 by The Perl Porters <F<perl5-porters@perl.org>>.
|
|
|
|
+Maintained since 1996 by The Perl Porters <F<perlbug@perl.org>>.
|
|
|
|
diff --git a/lib/perlxstut.pod b/lib/perlxstut.pod
|
|
|
|
diff --git a/lib/perlxstut.pod b/lib/perlxstut.pod
|
|
|
|
new file mode 100644
|
|
|
|
new file mode 100644
|
|
|
|
index 0000000..fcafa58
|
|
|
|
index 0000000..ef154ad
|
|
|
|
--- /dev/null
|
|
|
|
--- /dev/null
|
|
|
|
+++ b/lib/perlxstut.pod
|
|
|
|
+++ b/lib/perlxstut.pod
|
|
|
|
@@ -0,0 +1,1425 @@
|
|
|
|
@@ -0,0 +1,1401 @@
|
|
|
|
+=head1 NAME
|
|
|
|
+=head1 NAME
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+perlxstut - Tutorial for writing XSUBs
|
|
|
|
+perlxstut - Tutorial for writing XSUBs
|
|
|
@ -2570,15 +2712,14 @@ index 0000000..fcafa58
|
|
|
|
+The file Makefile.PL should look something like this:
|
|
|
|
+The file Makefile.PL should look something like this:
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ use ExtUtils::MakeMaker;
|
|
|
|
+ use ExtUtils::MakeMaker;
|
|
|
|
+
|
|
|
|
|
|
|
|
+ # See lib/ExtUtils/MakeMaker.pm for details of how to influence
|
|
|
|
+ # See lib/ExtUtils/MakeMaker.pm for details of how to influence
|
|
|
|
+ # the contents of the Makefile that is written.
|
|
|
|
+ # the contents of the Makefile that is written.
|
|
|
|
+ WriteMakefile(
|
|
|
|
+ WriteMakefile(
|
|
|
|
+ NAME => 'Mytest',
|
|
|
|
+ NAME => 'Mytest',
|
|
|
|
+ VERSION_FROM => 'Mytest.pm', # finds $VERSION
|
|
|
|
+ VERSION_FROM => 'Mytest.pm', # finds $VERSION
|
|
|
|
+ LIBS => [''], # e.g., '-lm'
|
|
|
|
+ LIBS => [''], # e.g., '-lm'
|
|
|
|
+ DEFINE => '', # e.g., '-DHAVE_SOMETHING'
|
|
|
|
+ DEFINE => '', # e.g., '-DHAVE_SOMETHING'
|
|
|
|
+ INC => '-I', # e.g., '-I. -I/usr/include/other'
|
|
|
|
+ INC => '', # e.g., '-I/usr/include/other'
|
|
|
|
+ );
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+The file Mytest.pm should start with something like this:
|
|
|
|
+The file Mytest.pm should start with something like this:
|
|
|
@ -2732,9 +2873,9 @@ index 0000000..fcafa58
|
|
|
|
+ # so read its man page ( perldoc Test::More ) for help writing this
|
|
|
|
+ # so read its man page ( perldoc Test::More ) for help writing this
|
|
|
|
+ # test script.
|
|
|
|
+ # test script.
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ is( Mytest::is_even(0), 1 );
|
|
|
|
+ is(&Mytest::is_even(0), 1);
|
|
|
|
+ is( Mytest::is_even(1), 0 );
|
|
|
|
+ is(&Mytest::is_even(1), 0);
|
|
|
|
+ is( Mytest::is_even(2), 1 );
|
|
|
|
+ is(&Mytest::is_even(2), 1);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+We will be calling the test script through the command "C<make test>". You
|
|
|
|
+We will be calling the test script through the command "C<make test>". You
|
|
|
|
+should see output that looks something like this:
|
|
|
|
+should see output that looks something like this:
|
|
|
@ -2846,32 +2987,16 @@ index 0000000..fcafa58
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+Edit the Makefile.PL file so that the corresponding line looks like this:
|
|
|
|
+Edit the Makefile.PL file so that the corresponding line looks like this:
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ LIBS => ['-lm'], # e.g., '-lm'
|
|
|
|
+ 'LIBS' => ['-lm'], # e.g., '-lm'
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+Generate the Makefile and run make. Change the test number in Mytest.t to
|
|
|
|
+Generate the Makefile and run make. Change the test number in Mytest.t to
|
|
|
|
+"9" and add the following tests:
|
|
|
|
+"9" and add the following tests:
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ my $i;
|
|
|
|
+ $i = -1.5; &Mytest::round($i); is( $i, -2.0 );
|
|
|
|
+
|
|
|
|
+ $i = -1.1; &Mytest::round($i); is( $i, -1.0 );
|
|
|
|
+ $i = -1.5;
|
|
|
|
+ $i = 0.0; &Mytest::round($i); is( $i, 0.0 );
|
|
|
|
+ Mytest::round($i);
|
|
|
|
+ $i = 0.5; &Mytest::round($i); is( $i, 1.0 );
|
|
|
|
+ is( $i, -2.0, 'Rounding -1.5 to -2.0' );
|
|
|
|
+ $i = 1.2; &Mytest::round($i); is( $i, 1.0 );
|
|
|
|
+
|
|
|
|
|
|
|
|
+ $i = -1.1;
|
|
|
|
|
|
|
|
+ Mytest::round($i);
|
|
|
|
|
|
|
|
+ is( $i, -1.0, 'Rounding -1.1 to -1.0' );
|
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
+ $i = 0.0;
|
|
|
|
|
|
|
|
+ Mytest::round($i);
|
|
|
|
|
|
|
|
+ is( $i, 0.0, 'Rounding 0.0 to 0.0' );
|
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
+ $i = 0.5;
|
|
|
|
|
|
|
|
+ Mytest::round($i);
|
|
|
|
|
|
|
|
+ is( $i, 1.0, 'Rounding 0.5 to 1.0' );
|
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
+ $i = 1.2;
|
|
|
|
|
|
|
|
+ Mytest::round($i);
|
|
|
|
|
|
|
|
+ is( $i, 1.0, 'Rounding 1.2 to 1.0' );
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+Running "C<make test>" should now print out that all nine tests are okay.
|
|
|
|
+Running "C<make test>" should now print out that all nine tests are okay.
|
|
|
|
+
|
|
|
|
+
|
|
|
@ -2879,7 +3004,7 @@ index 0000000..fcafa58
|
|
|
|
+scalar variable. You might be wondering if you can round a constant or
|
|
|
|
+scalar variable. You might be wondering if you can round a constant or
|
|
|
|
+literal. To see what happens, temporarily add the following line to Mytest.t:
|
|
|
|
+literal. To see what happens, temporarily add the following line to Mytest.t:
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ Mytest::round(3);
|
|
|
|
+ &Mytest::round(3);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+Run "C<make test>" and notice that Perl dies with a fatal error. Perl won't
|
|
|
|
+Run "C<make test>" and notice that Perl dies with a fatal error. Perl won't
|
|
|
|
+let you change the value of constants!
|
|
|
|
+let you change the value of constants!
|
|
|
@ -3006,7 +3131,7 @@ index 0000000..fcafa58
|
|
|
|
+Also create a file mylib.c that looks like this:
|
|
|
|
+Also create a file mylib.c that looks like this:
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ #include <stdlib.h>
|
|
|
|
+ #include <stdlib.h>
|
|
|
|
+ #include "mylib.h"
|
|
|
|
+ #include "./mylib.h"
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ double
|
|
|
|
+ double
|
|
|
|
+ foo(int a, long b, const char *c)
|
|
|
|
+ foo(int a, long b, const char *c)
|
|
|
@ -3019,9 +3144,9 @@ index 0000000..fcafa58
|
|
|
|
+ use ExtUtils::MakeMaker;
|
|
|
|
+ use ExtUtils::MakeMaker;
|
|
|
|
+ $Verbose = 1;
|
|
|
|
+ $Verbose = 1;
|
|
|
|
+ WriteMakefile(
|
|
|
|
+ WriteMakefile(
|
|
|
|
+ NAME => 'Mytest2::mylib',
|
|
|
|
+ NAME => 'Mytest2::mylib',
|
|
|
|
+ SKIP => [qw(all static static_lib dynamic dynamic_lib)],
|
|
|
|
+ SKIP => [qw(all static static_lib dynamic dynamic_lib)],
|
|
|
|
+ clean => {'FILES' => 'libmylib$(LIB_EXT)'},
|
|
|
|
+ clean => {'FILES' => 'libmylib$(LIB_EXT)'},
|
|
|
|
+ );
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
@ -3048,7 +3173,7 @@ index 0000000..fcafa58
|
|
|
|
+We will now create the main top-level Mytest2 files. Change to the directory
|
|
|
|
+We will now create the main top-level Mytest2 files. Change to the directory
|
|
|
|
+above Mytest2 and run the following command:
|
|
|
|
+above Mytest2 and run the following command:
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ % h2xs -O -n Mytest2 Mytest2/mylib/mylib.h
|
|
|
|
+ % h2xs -O -n Mytest2 ./Mytest2/mylib/mylib.h
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+This will print out a warning about overwriting Mytest2, but that's okay.
|
|
|
|
+This will print out a warning about overwriting Mytest2, but that's okay.
|
|
|
|
+Our files are stored in Mytest2/mylib, and will be untouched.
|
|
|
|
+Our files are stored in Mytest2/mylib, and will be untouched.
|
|
|
@ -3059,12 +3184,12 @@ index 0000000..fcafa58
|
|
|
|
+the WriteMakefile call so that it looks like this:
|
|
|
|
+the WriteMakefile call so that it looks like this:
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ WriteMakefile(
|
|
|
|
+ WriteMakefile(
|
|
|
|
+ NAME => 'Mytest2',
|
|
|
|
+ 'NAME' => 'Mytest2',
|
|
|
|
+ VERSION_FROM => 'Mytest2.pm', # finds $VERSION
|
|
|
|
+ 'VERSION_FROM' => 'Mytest2.pm', # finds $VERSION
|
|
|
|
+ LIBS => [''], # e.g., '-lm'
|
|
|
|
+ 'LIBS' => [''], # e.g., '-lm'
|
|
|
|
+ DEFINE => '', # e.g., '-DHAVE_SOMETHING'
|
|
|
|
+ 'DEFINE' => '', # e.g., '-DHAVE_SOMETHING'
|
|
|
|
+ INC => '', # e.g., '-I/usr/include/other'
|
|
|
|
+ 'INC' => '', # e.g., '-I/usr/include/other'
|
|
|
|
+ MYEXTLIB => 'mylib/libmylib$(LIB_EXT)',
|
|
|
|
+ 'MYEXTLIB' => 'mylib/libmylib$(LIB_EXT)',
|
|
|
|
+ );
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+and then at the end add a subroutine (which will override the pre-existing
|
|
|
|
+and then at the end add a subroutine (which will override the pre-existing
|
|
|
@ -3078,7 +3203,9 @@ index 0000000..fcafa58
|
|
|
|
+ ';
|
|
|
|
+ ';
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+Let's also fix the MANIFEST file by appending the following three lines:
|
|
|
|
+Let's also fix the MANIFEST file so that it accurately reflects the contents
|
|
|
|
|
|
|
|
+of our extension. The single line that says "mylib" should be replaced by
|
|
|
|
|
|
|
|
+the following three lines:
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ mylib/Makefile.PL
|
|
|
|
+ mylib/Makefile.PL
|
|
|
|
+ mylib/mylib.c
|
|
|
|
+ mylib/mylib.c
|
|
|
@ -3112,12 +3239,12 @@ index 0000000..fcafa58
|
|
|
|
+Makefile in the mylib directory. Run make and watch that it does cd into
|
|
|
|
+Makefile in the mylib directory. Run make and watch that it does cd into
|
|
|
|
+the mylib directory and run make in there as well.
|
|
|
|
+the mylib directory and run make in there as well.
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+Now edit the Mytest2.t script and change the number of tests to "5",
|
|
|
|
+Now edit the Mytest2.t script and change the number of tests to "4",
|
|
|
|
+and add the following lines to the end of the script:
|
|
|
|
+and add the following lines to the end of the script:
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ is( Mytest2::foo( 1, 2, "Hello, world!" ), 7 );
|
|
|
|
+ is( &Mytest2::foo(1, 2, "Hello, world!"), 7 );
|
|
|
|
+ is( Mytest2::foo( 1, 2, "0.0" ), 7 );
|
|
|
|
+ is( &Mytest2::foo(1, 2, "0.0"), 7 );
|
|
|
|
+ ok( abs( Mytest2::foo( 0, 0, "-3.4" ) - 0.6 ) <= 0.01 );
|
|
|
|
+ ok( abs(&Mytest2::foo(0, 0, "-3.4") - 0.6) <= 0.01 );
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+(When dealing with floating-point comparisons, it is best to not check for
|
|
|
|
+(When dealing with floating-point comparisons, it is best to not check for
|
|
|
|
+equality, but rather that the difference between the expected and actual
|
|
|
|
+equality, but rather that the difference between the expected and actual
|
|
|
@ -3177,7 +3304,7 @@ index 0000000..fcafa58
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+=head2 Anatomy of .xs file
|
|
|
|
+=head2 Anatomy of .xs file
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+The .xs file of L</EXAMPLE 4> contained some new elements. To understand
|
|
|
|
+The .xs file of L<"EXAMPLE 4"> contained some new elements. To understand
|
|
|
|
+the meaning of these elements, pay attention to the line which reads
|
|
|
|
+the meaning of these elements, pay attention to the line which reads
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ MODULE = Mytest2 PACKAGE = Mytest2
|
|
|
|
+ MODULE = Mytest2 PACKAGE = Mytest2
|
|
|
@ -3207,7 +3334,7 @@ index 0000000..fcafa58
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+=head2 Getting the fat out of XSUBs
|
|
|
|
+=head2 Getting the fat out of XSUBs
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+In L</EXAMPLE 4> the second part of .xs file contained the following
|
|
|
|
+In L<"EXAMPLE 4"> the second part of .xs file contained the following
|
|
|
|
+description of an XSUB:
|
|
|
|
+description of an XSUB:
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ double
|
|
|
|
+ double
|
|
|
@ -3487,12 +3614,9 @@ index 0000000..fcafa58
|
|
|
|
+Also add the following code segment to Mytest.t while incrementing the "9"
|
|
|
|
+Also add the following code segment to Mytest.t while incrementing the "9"
|
|
|
|
+tests to "11":
|
|
|
|
+tests to "11":
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ my @a;
|
|
|
|
+ @a = &Mytest::statfs("/blech");
|
|
|
|
+
|
|
|
|
|
|
|
|
+ @a = Mytest::statfs("/blech");
|
|
|
|
|
|
|
|
+ ok( scalar(@a) == 1 && $a[0] == 2 );
|
|
|
|
+ ok( scalar(@a) == 1 && $a[0] == 2 );
|
|
|
|
+
|
|
|
|
+ @a = &Mytest::statfs("/");
|
|
|
|
+ @a = Mytest::statfs("/");
|
|
|
|
|
|
|
|
+ is( scalar(@a), 7 );
|
|
|
|
+ is( scalar(@a), 7 );
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+=head2 New Things in this Example
|
|
|
|
+=head2 New Things in this Example
|
|
|
@ -3598,8 +3722,7 @@ index 0000000..fcafa58
|
|
|
|
+ for (n = 0; n <= numpaths; n++) {
|
|
|
|
+ for (n = 0; n <= numpaths; n++) {
|
|
|
|
+ HV * rh;
|
|
|
|
+ HV * rh;
|
|
|
|
+ STRLEN l;
|
|
|
|
+ STRLEN l;
|
|
|
|
+ SV * path = *av_fetch((AV *)SvRV(paths), n, 0);
|
|
|
|
+ char * fn = SvPV(*av_fetch((AV *)SvRV(paths), n, 0), l);
|
|
|
|
+ char * fn = SvPVbyte(path, l);
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ i = statfs(fn, &buf);
|
|
|
|
+ i = statfs(fn, &buf);
|
|
|
|
+ if (i != 0) {
|
|
|
|
+ if (i != 0) {
|
|
|
@ -3626,7 +3749,7 @@ index 0000000..fcafa58
|
|
|
|
+And add the following code to Mytest.t, while incrementing the "11"
|
|
|
|
+And add the following code to Mytest.t, while incrementing the "11"
|
|
|
|
+tests to "13":
|
|
|
|
+tests to "13":
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ my $results = Mytest::multi_statfs([ '/', '/blech' ]);
|
|
|
|
+ $results = Mytest::multi_statfs([ '/', '/blech' ]);
|
|
|
|
+ ok( ref $results->[0] );
|
|
|
|
+ ok( ref $results->[0] );
|
|
|
|
+ ok( ! ref $results->[1] );
|
|
|
|
+ ok( ! ref $results->[1] );
|
|
|
|
+
|
|
|
|
+
|
|
|
@ -3720,24 +3843,21 @@ index 0000000..fcafa58
|
|
|
|
+Suppose that for some strange reason we need a wrapper around the
|
|
|
|
+Suppose that for some strange reason we need a wrapper around the
|
|
|
|
+standard C library function C<fputs()>. This is all we need:
|
|
|
|
+standard C library function C<fputs()>. This is all we need:
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ #define PERLIO_NOT_STDIO 0 /* For co-existence with stdio only */
|
|
|
|
+ #define PERLIO_NOT_STDIO 0
|
|
|
|
+ #define PERL_NO_GET_CONTEXT /* This is more efficient */
|
|
|
|
+ #define PERL_NO_GET_CONTEXT
|
|
|
|
+ #include "EXTERN.h"
|
|
|
|
+ #include "EXTERN.h"
|
|
|
|
+ #include "perl.h"
|
|
|
|
+ #include "perl.h"
|
|
|
|
+ #include "XSUB.h"
|
|
|
|
+ #include "XSUB.h"
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ #include <stdio.h>
|
|
|
|
+ #include <stdio.h>
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ int
|
|
|
|
+ int
|
|
|
|
+ fputs(s, stream)
|
|
|
|
+ fputs(s, stream)
|
|
|
|
+ char * s
|
|
|
|
+ char * s
|
|
|
|
+ FILE * stream
|
|
|
|
+ FILE * stream
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+The real work is done in the standard typemap.
|
|
|
|
+The real work is done in the standard typemap.
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+For more details, see
|
|
|
|
|
|
|
|
+L<perlapio/"Co-existence with stdio">.
|
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
+B<But> you lose all the fine stuff done by the perlio layers. This
|
|
|
|
+B<But> you lose all the fine stuff done by the perlio layers. This
|
|
|
|
+calls the stdio function C<fputs()>, which knows nothing about them.
|
|
|
|
+calls the stdio function C<fputs()>, which knows nothing about them.
|
|
|
|
+
|
|
|
|
+
|
|
|
@ -3859,7 +3979,7 @@ index 0000000..fcafa58
|
|
|
|
+=head1 See also
|
|
|
|
+=head1 See also
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+For more information, consult L<perlguts>, L<perlapi>, L<perlxs>, L<perlmod>,
|
|
|
|
+For more information, consult L<perlguts>, L<perlapi>, L<perlxs>, L<perlmod>,
|
|
|
|
+L<perlapio>, and L<perlpod>
|
|
|
|
+and L<perlpod>.
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+=head1 Author
|
|
|
|
+=head1 Author
|
|
|
|
+
|
|
|
|
+
|
|
|
@ -3873,11 +3993,9 @@ index 0000000..fcafa58
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+Changes for h2xs as of Perl 5.8.x by Renee Baecker
|
|
|
|
+Changes for h2xs as of Perl 5.8.x by Renee Baecker
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+This document is now maintained as part of Perl itself.
|
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
+=head2 Last Changed
|
|
|
|
+=head2 Last Changed
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+2020-10-05
|
|
|
|
+2012-01-20
|
|
|
|
diff --git a/lib/perlxstypemap.pod b/lib/perlxstypemap.pod
|
|
|
|
diff --git a/lib/perlxstypemap.pod b/lib/perlxstypemap.pod
|
|
|
|
new file mode 100644
|
|
|
|
new file mode 100644
|
|
|
|
index 0000000..7d1f73c
|
|
|
|
index 0000000..7d1f73c
|
|
|
@ -4595,6 +4713,31 @@ index 0000000..7d1f73c
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+=back
|
|
|
|
+=back
|
|
|
|
+
|
|
|
|
+
|
|
|
|
|
|
|
|
diff --git a/t/XSTest.xs b/t/XSTest.xs
|
|
|
|
|
|
|
|
index 89df22f..452d3db 100644
|
|
|
|
|
|
|
|
--- a/t/XSTest.xs
|
|
|
|
|
|
|
|
+++ b/t/XSTest.xs
|
|
|
|
|
|
|
|
@@ -76,6 +76,7 @@ bool
|
|
|
|
|
|
|
|
T_BOOL_2(in)
|
|
|
|
|
|
|
|
bool in
|
|
|
|
|
|
|
|
CODE:
|
|
|
|
|
|
|
|
+ PERL_UNUSED_VAR(RETVAL);
|
|
|
|
|
|
|
|
OUTPUT: in
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
|
|
|
diff --git a/t/XSUsage.xs b/t/XSUsage.xs
|
|
|
|
|
|
|
|
index 9a8d93d..ed3c8f8 100644
|
|
|
|
|
|
|
|
--- a/t/XSUsage.xs
|
|
|
|
|
|
|
|
+++ b/t/XSUsage.xs
|
|
|
|
|
|
|
|
@@ -35,6 +35,8 @@ xsusage_two()
|
|
|
|
|
|
|
|
ALIAS:
|
|
|
|
|
|
|
|
two_x = 1
|
|
|
|
|
|
|
|
FOO::two = 2
|
|
|
|
|
|
|
|
+ INIT:
|
|
|
|
|
|
|
|
+ PERL_UNUSED_VAR(ix);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
|
|
|
interface_v_i()
|
|
|
|
--
|
|
|
|
--
|
|
|
|
2.31.1
|
|
|
|
2.14.3
|
|
|
|
|
|
|
|
|