summaryrefslogtreecommitdiff
path: root/gnu/usr.bin
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>1999-04-29 22:39:18 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>1999-04-29 22:39:18 +0000
commitef07f45b4e6f9c262e28a09e7a9c0bcce09c99c4 (patch)
treec32e2e8217bfe2876a7c90d1050890d817351a08 /gnu/usr.bin
parent4ca3e266c706ed297103a44ccc16432c7ee32c58 (diff)
perl5.005_03
Diffstat (limited to 'gnu/usr.bin')
-rw-r--r--gnu/usr.bin/perl/README.hpux747
-rw-r--r--gnu/usr.bin/perl/README.hurd64
-rw-r--r--gnu/usr.bin/perl/README.os390396
-rw-r--r--gnu/usr.bin/perl/djgpp/djgppsed.sh14
-rw-r--r--gnu/usr.bin/perl/embedvar.h1312
-rw-r--r--gnu/usr.bin/perl/ext/B/B.pm893
-rw-r--r--gnu/usr.bin/perl/ext/B/B.xs2314
-rw-r--r--gnu/usr.bin/perl/ext/B/B/Showlex.pm167
-rw-r--r--gnu/usr.bin/perl/ext/B/Makefile.PL88
-rw-r--r--gnu/usr.bin/perl/ext/B/typemap59
-rw-r--r--gnu/usr.bin/perl/ext/DynaLoader/DynaLoader_pm.PL458
-rw-r--r--gnu/usr.bin/perl/ext/re/Makefile.PL78
-rw-r--r--gnu/usr.bin/perl/ext/re/re.pm614
-rw-r--r--gnu/usr.bin/perl/ext/re/re.xs126
-rw-r--r--gnu/usr.bin/perl/iperlsys.h1720
-rw-r--r--gnu/usr.bin/perl/perlvars.h400
-rw-r--r--gnu/usr.bin/perl/pp_proto.h624
-rw-r--r--gnu/usr.bin/perl/regcomp.sym363
-rw-r--r--gnu/usr.bin/perl/regnodes.h980
-rw-r--r--gnu/usr.bin/perl/thread.h557
20 files changed, 4065 insertions, 7909 deletions
diff --git a/gnu/usr.bin/perl/README.hpux b/gnu/usr.bin/perl/README.hpux
index 6f65c6b22df..4cdcf58d9b0 100644
--- a/gnu/usr.bin/perl/README.hpux
+++ b/gnu/usr.bin/perl/README.hpux
@@ -1,170 +1,49 @@
-If you read this file _as_is_, just ignore the funny characters you see.
-It is written in the POD format (see pod/perlpod.pod) which is specially
-designed to be readable as is.
+If you read this file _as_is_, just ignore the funny characters you
+see. It is written in the POD format (see pod/perlpod.pod) which is
+specially designed to be readable as is.
=head1 NAME
-perlhpux - Perl version 5 on Hewlett-Packard Unix (HP-UX) systems
+README.hpux - Perl version 5 on Hewlett-Packard Unix (HP-UX) systems
=head1 DESCRIPTION
-This document describes various features of HP's Unix operating system
-(HP-UX) that will affect how Perl version 5 (hereafter just Perl) is
-compiled and/or runs.
-
-=head2 Using perl as shipped with HP-UX
-
-Application release September 2001, HP-UX 11.00 is the first to ship
-with Perl. By the time it was perl-5.6.1 in /opt/perl. The first
-occurrence is on CD 5012-7954 and can be installed using
-
- swinstall -s /cdrom perl
-
-assuming you have mounted that CD on /cdrom.
-
-That build was a portable hppa-1.1 multithread build that supports large
-files compiled with gcc-2.9-hppa-991112.
-
-If you perform a new installation, then (a newer) Perl will be installed
-automatically. Pre-installed HP-UX systems now have more recent versions
-of Perl and the updated modules.
-
-The official (threaded) builds from HP, as they are shipped on the
-Application DVD/CD's are available on
-L<http://www.software.hp.com/portal/swdepot/displayProductInfo.do?productNumber=PERL>
-for both PA-RISC and IPF (Itanium Processor Family). They are built
-with the HP ANSI-C compiler. Up till 5.8.8 that was done by ActiveState.
-
-To see what version is included on the DVD (assumed here to be mounted
-on /cdrom), issue this command:
-
- # swlist -s /cdrom perl
- # perl D.5.8.8.B 5.8.8 Perl Programming Language
- perl.Perl5-32 D.5.8.8.B 32-bit 5.8.8 Perl Programming Language with Extensions
- perl.Perl5-64 D.5.8.8.B 64-bit 5.8.8 Perl Programming Language with Extensions
-
-To see what is installed on your system:
-
- # swlist -R perl
- # perl E.5.8.8.J Perl Programming Language
- # perl.Perl5-32 E.5.8.8.J 32-bit Perl Programming Language with Extensions
- perl.Perl5-32.PERL-MAN E.5.8.8.J 32-bit Perl Man Pages for IA
- perl.Perl5-32.PERL-RUN E.5.8.8.J 32-bit Perl Binaries for IA
- # perl.Perl5-64 E.5.8.8.J 64-bit Perl Programming Language with Extensions
- perl.Perl5-64.PERL-MAN E.5.8.8.J 64-bit Perl Man Pages for IA
- perl.Perl5-64.PERL-RUN E.5.8.8.J 64-bit Perl Binaries for IA
-
-=head2 Using perl from HP's porting centre
-
-HP porting centre tries to keep up with customer demand and release
-updates from the Open Source community. Having precompiled Perl binaries
-available is obvious, though "up-to-date" is something relative. At the
-moment of writing only perl-5.10.1 was available (with 5.16.3 being the
-latest stable release from the porters point of view).
-
-The HP porting centres are limited in what systems they are allowed
-to port to and they usually choose the two most recent OS versions
-available.
-
-HP has asked the porting centre to move Open Source binaries
-from /opt to /usr/local, so binaries produced since the start
-of July 2002 are located in /usr/local.
-
-One of HP porting centres URL's is L<http://hpux.connect.org.uk/>
-The port currently available is built with GNU gcc.
-
-=head2 Other prebuilt perl binaries
-
-To get even more recent perl depots for the whole range of HP-UX, visit
-H.Merijn Brand's site at L<http://mirrors.develooper.com/hpux/#Perl>.
-Carefully read the notes to see if the available versions suit your needs.
+This document describes various features of HP's Unix operating system (HP-UX)
+that will affect how Perl version 5 (hereafter just Perl) is compiled and/or
+runs.
=head2 Compiling Perl 5 on HP-UX
-When compiling Perl, you must use an ANSI C compiler. The C compiler
-that ships with all HP-UX systems is a K&R compiler that should only be
-used to build new kernels.
+When compiling Perl, the use of an ANSI C compiler is highly recommended.
+The C compiler that ships with all HP-UX systems is a K&R compiler that
+should only be used to build new kernels.
Perl can be compiled with either HP's ANSI C compiler or with gcc. The
-former is recommended, as not only can it compile Perl with no
-difficulty, but also can take advantage of features listed later that
-require the use of HP compiler-specific command-line flags.
+former is recommended, as not only can it compile Perl with no difficulty,
+but also can take advantage of features listed later that require the use
+of HP compiler-specific command-line flags.
-If you decide to use gcc, make sure your installation is recent and
-complete, and be sure to read the Perl INSTALL file for more gcc-specific
-details.
+If you decide to use gcc, make sure your installation is recent and complete,
+and be sure to read the Perl README file for more gcc-specific details.
=head2 PA-RISC
-HP's HP9000 Unix systems run on HP's own Precision Architecture
-(PA-RISC) chip. HP-UX used to run on the Motorola MC68000 family of
-chips, but any machine with this chip in it is quite obsolete and this
-document will not attempt to address issues for compiling Perl on the
-Motorola chipset.
-
-The version of PA-RISC at the time of this document's last update is 2.0,
-which is also the last there will be. HP PA-RISC systems are usually
-refered to with model description "HP 9000". The last CPU in this series
-is the PA-8900. Support for PA-RISC architectured machines officially
-ends as shown in the following table:
-
- PA-RISC End-of-Life Roadmap
- +--------+----------------+----------------+-----------------+
- | HP9000 | Superdome | PA-8700 | Spring 2011 |
- | 4-128 | | PA-8800/sx1000 | Summer 2012 |
- | cores | | PA-8900/sx1000 | 2014 |
- | | | PA-8900/sx2000 | 2015 |
- +--------+----------------+----------------+-----------------+
- | HP9000 | rp7410, rp8400 | PA-8700 | Spring 2011 |
- | 2-32 | rp7420, rp8420 | PA-8800/sx1000 | 2012 |
- | cores | rp7440, rp8440 | PA-8900/sx1000 | Autumn 2013 |
- | | | PA-8900/sx2000 | 2015 |
- +--------+----------------+----------------+-----------------+
- | HP9000 | rp44x0 | PA-8700 | Spring 2011 |
- | 1-8 | | PA-8800/rp44x0 | 2012 |
- | cores | | PA-8900/rp44x0 | 2014 |
- +--------+----------------+----------------+-----------------+
- | HP9000 | rp34x0 | PA-8700 | Spring 2011 |
- | 1-4 | | PA-8800/rp34x0 | 2012 |
- | cores | | PA-8900/rp34x0 | 2014 |
- +--------+----------------+----------------+-----------------+
-
-From L<http://www.hp.com/products1/evolution/9000/faqs.html>
-
- The last order date for HP 9000 systems was December 31, 2008.
-
-A complete list of models at the time the OS was built is in the file
-/usr/sam/lib/mo/sched.models. The first column corresponds to the last
-part of the output of the "model" command. The second column is the
-PA-RISC version and the third column is the exact chip type used.
-(Start browsing at the bottom to prevent confusion ;-)
-
- # model
- 9000/800/L1000-44
- # grep L1000-44 /usr/sam/lib/mo/sched.models
- L1000-44 2.0 PA8500
-
-=head2 Portability Between PA-RISC Versions
-
-An executable compiled on a PA-RISC 2.0 platform will not execute on a
-PA-RISC 1.1 platform, even if they are running the same version of
-HP-UX. If you are building Perl on a PA-RISC 2.0 platform and want that
-Perl to also run on a PA-RISC 1.1, the compiler flags +DAportable and
-+DS32 should be used.
+HP's current Unix systems run on its own Precision Architecture (PA-RISC) chip.
+HP-UX used to run on the Motorola MC68000 family of chips, but any machine with
+this chip in it is quite obsolete and this document will not attempt to address
+issues for compiling Perl on the Motorola chipset.
-It is no longer possible to compile PA-RISC 1.0 executables on either
-the PA-RISC 1.1 or 2.0 platforms. The command-line flags are accepted,
-but the resulting executable will not run when transferred to a PA-RISC
-1.0 system.
+The most recent version of PA-RISC at the time of this document's last update
+is 2.0.
=head2 PA-RISC 1.0
The original version of PA-RISC, HP no longer sells any system with this chip.
-The following systems contained PA-RISC 1.0 chips:
+The following systems contain PA-RISC 1.0 chips:
- 600, 635, 645, 808, 815, 822, 825, 832, 834, 835, 840, 842, 845, 850,
- 852, 855, 860, 865, 870, 890
+ 600, 635, 645, 800, 808, 815, 822, 825, 832, 834, 835, 840,
+ 842, 845, 850, 852, 855, 860, 865, 870, 890
=head2 PA-RISC 1.1
@@ -173,142 +52,62 @@ system.
The following systems contain with PA-RISC 1.1 chips:
- 705, 710, 712, 715, 720, 722, 725, 728, 730, 735, 742, 743, 744, 745,
- 747, 750, 755, 770, 777, 778, 779, 800, 801, 803, 806, 807, 809, 811,
- 813, 816, 817, 819, 821, 826, 827, 829, 831, 837, 839, 841, 847, 849,
- 851, 856, 857, 859, 867, 869, 877, 887, 891, 892, 897, A180, A180C,
- B115, B120, B132L, B132L+, B160L, B180L, C100, C110, C115, C120,
- C160L, D200, D210, D220, D230, D250, D260, D310, D320, D330, D350,
- D360, D410, DX0, DX5, DXO, E25, E35, E45, E55, F10, F20, F30, G30,
- G40, G50, G60, G70, H20, H30, H40, H50, H60, H70, I30, I40, I50, I60,
- I70, J200, J210, J210XC, K100, K200, K210, K220, K230, K400, K410,
- K420, S700i, S715, S744, S760, T500, T520
+ 705, 710, 712, 715, 720, 722, 725, 728, 730, 735, 743, 745, 747, 750,
+ 755, 770, 807S, 817S, 827S, 837S, 847S, 857S, 867S, 877S, 887S, 897S,
+ D200, D210, D220, D230, D250, D260, D310, D320, D330, D350, D360, D400,
+ E25, E35, E45, E55, F10, F20, F30, G30, G40, G50, G60, G70, H30, H40,
+ H50, H60, H70, I30, I40, I50, I60, I70, K100, K200, K210, K220, K400,
+ K410, K420, T500, T520
+
=head2 PA-RISC 2.0
-The most recent upgrade to the PA-RISC design, it added support for
-64-bit integer data.
-
-As of the date of this document's last update, the following systems
-contain PA-RISC 2.0 chips:
-
- 700, 780, 781, 782, 783, 785, 802, 804, 810, 820, 861, 871, 879, 889,
- 893, 895, 896, 898, 899, A400, A500, B1000, B2000, C130, C140, C160,
- C180, C180+, C180-XP, C200+, C400+, C3000, C360, C3600, CB260, D270,
- D280, D370, D380, D390, D650, J220, J2240, J280, J282, J400, J410,
- J5000, J5500XM, J5600, J7000, J7600, K250, K260, K260-EG, K270, K360,
- K370, K380, K450, K460, K460-EG, K460-XP, K470, K570, K580, L1000,
- L2000, L3000, N4000, R380, R390, SD16000, SD32000, SD64000, T540,
- T600, V2000, V2200, V2250, V2500, V2600
-
-Just before HP took over Compaq, some systems were renamed. the link
-that contained the explanation is dead, so here's a short summary:
-
- HP 9000 A-Class servers, now renamed HP Server rp2400 series.
- HP 9000 L-Class servers, now renamed HP Server rp5400 series.
- HP 9000 N-Class servers, now renamed HP Server rp7400.
-
- rp2400, rp2405, rp2430, rp2450, rp2470, rp3410, rp3440, rp4410,
- rp4440, rp5400, rp5405, rp5430, rp5450, rp5470, rp7400, rp7405,
- rp7410, rp7420, rp7440, rp8400, rp8420, rp8440, Superdome
-
-The current naming convention is:
-
- aadddd
- ||||`+- 00 - 99 relative capacity & newness (upgrades, etc.)
- |||`--- unique number for each architecture to ensure different
- ||| systems do not have the same numbering across
- ||| architectures
- ||`---- 1 - 9 identifies family and/or relative positioning
- ||
- |`----- c = ia32 (cisc)
- | p = pa-risc
- | x = ia-64 (Itanium & Itanium 2)
- | h = housing
- `------ t = tower
- r = rack optimized
- s = super scalable
- b = blade
- sa = appliance
-
-=head2 Itanium Processor Family (IPF) and HP-UX
-
-HP-UX also runs on the new Itanium processor. This requires the use
-of a different version of HP-UX (currently 11.23 or 11i v2), and with
-the exception of a few differences detailed below and in later sections,
-Perl should compile with no problems.
-
-Although PA-RISC binaries can run on Itanium systems, you should not
-attempt to use a PA-RISC version of Perl on an Itanium system. This is
-because shared libraries created on an Itanium system cannot be loaded
-while running a PA-RISC executable.
-
-HP Itanium 2 systems are usually refered to with model description
-"HP Integrity".
-
-=head2 Itanium, Itanium 2 & Madison 6
-
-HP also ships servers with the 128-bit Itanium processor(s). The cx26x0
-is told to have Madison 6. As of the date of this document's last update,
-the following systems contain Itanium or Itanium 2 chips (this is likely
-to be out of date):
-
- BL60p, BL860c, BL870c, BL890c, cx2600, cx2620, rx1600, rx1620, rx2600,
- rx2600hptc, rx2620, rx2660, rx2800, rx3600, rx4610, rx4640, rx5670,
- rx6600, rx7420, rx7620, rx7640, rx8420, rx8620, rx8640, rx9610,
- sx1000, sx2000
-
-To see all about your machine, type
-
- # model
- ia64 hp server rx2600
- # /usr/contrib/bin/machinfo
-
-=head2 HP-UX versions
-
-Not all architectures (PA = PA-RISC, IPF = Itanium Processor Family)
-support all versions of HP-UX, here is a short list
-
- HP-UX version Kernel Architecture End-of-factory support
- ------------- ------ ------------ ----------------------------------
- 10.20 32 bit PA 30-Jun-2003
- 11.00 32/64 PA 31-Dec-2006
- 11.11 11i v1 32/64 PA 31-Dec-2015
- 11.22 11i v2 64 IPF 30-Apr-2004
- 11.23 11i v2 64 PA & IPF 31-Dec-2015
- 11.31 11i v3 64 PA & IPF 31-Dec-2020 (PA) 31-Dec-2022 (IPF)
-
-See for the full list of hardware/OS support and expected end-of-life
-L<http://www.hp.com/go/hpuxservermatrix>
+The most recent upgrade to the PA-RISC design, it added support for 64-bit
+integer data.
+
+The following systems contain PA-RISC 2.0 chips (this is very likely to be
+out of date):
+
+ D270, D280, D370, D380, K250, K260, K370, K380, K450, K460, K570, K580,
+ T600, V2200
+
+A complete list of models at the time the OS was built is in the file
+/opt/langtools/lib/sched.models.
+The first column corresponds to the output of the "uname -m" command
+(without the leading "9000/").
+The second column is the PA-RISC version
+and the third column is the exact chip type used.
+
+=head2 Portability Between PA-RISC Versions
+
+An executable compiled on a PA-RISC 2.0 platform will not execute on a
+PA-RISC 1.1 platform, even if they are running the same version of HP-UX.
+If you are building Perl on a PA-RISC 2.0 platform and want that Perl to
+to also run on a PA-RISC 1.1, the compiler flags +DAportable and +DS32
+should be used.
+
+It is no longer possible to compile PA-RISC 1.0 executables on either the
+PA-RISC 1.1 or 2.0 platforms.
=head2 Building Dynamic Extensions on HP-UX
HP-UX supports dynamically loadable libraries (shared libraries).
-Shared libraries end with the suffix .sl. On Itanium systems,
-they end with the suffix .so.
+Shared libraries end with the suffix .sl.
-Shared libraries created on a platform using a particular PA-RISC
-version are not usable on platforms using an earlier PA-RISC version by
-default. However, this backwards compatibility may be enabled using the
-same +DAportable compiler flag (with the same PA-RISC 1.0 caveat
-mentioned above).
-
-Shared libraries created on an Itanium platform cannot be loaded on
-a PA-RISC platform. Shared libraries created on a PA-RISC platform
-can only be loaded on an Itanium platform if it is a PA-RISC executable
-that is attempting to load the PA-RISC library. A PA-RISC shared
-library cannot be loaded into an Itanium executable nor vice-versa.
+Shared libraries created on a platform using a particular PA-RISC version
+are not usable on platforms using an earlier PA-RISC version by default.
+However, this backwards compatibility may be enabled using the same
++DAportable compiler flag (with the same PA-RISC 1.0 caveat mentioned above).
To create a shared library, the following steps must be performed:
- 1. Compile source modules with +z or +Z flag to create a .o module
- which contains Position-Independent Code (PIC). The linker will
- tell you in the next step if +Z was needed.
- (For gcc, the appropriate flag is -fpic or -fPIC.)
+ 1. Compile source modules with +z or +Z flag to create a .o module
+ which contains Position-Independent Code (PIC). The linker will
+ tell you in the next step if +Z was needed.
- 2. Link the shared library using the -b flag. If the code calls
- any functions in other system libraries (e.g., libm), it must
- be included on this line.
+ 2. Link the shared library using the -b flag. If the code calls
+ any functions in other system libraries (e.g., libm), it must
+ be included on this line.
(Note that these steps are usually handled automatically by the extension's
Makefile).
@@ -317,365 +116,111 @@ If these dependent libraries are not listed at shared library creation
time, you will get fatal "Unresolved symbol" errors at run time when the
library is loaded.
-You may create a shared library that refers to another library, which
-may be either an archive library or a shared library. If this second
-library is a shared library, this is called a "dependent library". The
-dependent library's name is recorded in the main shared library, but it
-is not linked into the shared library. Instead, it is loaded when the
-main shared library is loaded. This can cause problems if you build an
-extension on one system and move it to another system where the
-libraries may not be located in the same place as on the first system.
+You may create a shared library that referers to another library, which
+may be either an archive library or a shared library. If it is a
+shared library, this is called a "dependent library".
+The dependent library's name is recorded in the main shared library,
+but it is not linked into the shared library.
+Instead, it is loaded when the main shared library is loaded.
If the referred library is an archive library, then it is treated as a
simple collection of .o modules (all of which must contain PIC). These
modules are then linked into the shared library.
-Note that it is okay to create a library which contains a dependent
-library that is already linked into perl.
-
-Some extensions, like DB_File and Compress::Zlib use/require prebuilt
-libraries for the perl extensions/modules to work. If these libraries
-are built using the default configuration, it might happen that you
-run into an error like "invalid loader fixup" during load phase.
-HP is aware of this problem. Search the HP-UX cxx-dev forums for
-discussions about the subject. The short answer is that B<everything>
-(all libraries, everything) must be compiled with C<+z> or C<+Z> to be
-PIC (position independent code). (For gcc, that would be
-C<-fpic> or C<-fPIC>). In HP-UX 11.00 or newer the linker
-error message should tell the name of the offending object file.
-
-A more general approach is to intervene manually, as with an example for
-the DB_File module, which requires SleepyCat's libdb.sl:
-
- # cd .../db-3.2.9/build_unix
- # vi Makefile
- ... add +Z to all cflags to create shared objects
- CFLAGS= -c $(CPPFLAGS) +Z -Ae +O2 +Onolimit \
- -I/usr/local/include -I/usr/include/X11R6
- CXXFLAGS= -c $(CPPFLAGS) +Z -Ae +O2 +Onolimit \
- -I/usr/local/include -I/usr/include/X11R6
-
- # make clean
- # make
- # mkdir tmp
- # cd tmp
- # ar x ../libdb.a
- # ld -b -o libdb-3.2.sl *.o
- # mv libdb-3.2.sl /usr/local/lib
- # rm *.o
- # cd /usr/local/lib
- # rm -f libdb.sl
- # ln -s libdb-3.2.sl libdb.sl
-
- # cd .../DB_File-1.76
- # make distclean
- # perl Makefile.PL
- # make
- # make test
- # make install
-
-As of db-4.2.x it is no longer needed to do this by hand. Sleepycat
-has changed the configuration process to add +z on HP-UX automatically.
-
- # cd .../db-4.2.25/build_unix
- # env CFLAGS=+DD64 LDFLAGS=+DD64 ../dist/configure
-
-should work to generate 64bit shared libraries for HP-UX 11.00 and 11i.
-
-It is no longer possible to link PA-RISC 1.0 shared libraries (even
-though the command-line flags are still present).
-
-PA-RISC and Itanium object files are not interchangeable. Although
-you may be able to use ar to create an archive library of PA-RISC
-object files on an Itanium system, you cannot link against it using
-an Itanium link editor.
+Note that it is okay to create a library which contains a dependent library
+that is already linked into perl.
-=head2 The HP ANSI C Compiler
+It is no longer possible to link PA-RISC 1.0 shared libraries.
-When using this compiler to build Perl, you should make sure that the
-flag -Aa is added to the cpprun and cppstdin variables in the config.sh
-file (though see the section on 64-bit perl below). If you are using a
-recent version of the Perl distribution, these flags are set automatically.
-
-Even though HP-UX 10.20 and 11.00 are not actively maintained by HP
-anymore, updates for the HP ANSI C compiler are still available from
-time to time, and it might be advisable to see if updates are applicable.
-At the moment of writing, the latests available patches for 11.00 that
-should be applied are PHSS_35098, PHSS_35175, PHSS_35100, PHSS_33036,
-and PHSS_33902). If you have a SUM account, you can use it to search
-for updates/patches. Enter "ANSI" as keyword.
-
-=head2 The GNU C Compiler
-
-When you are going to use the GNU C compiler (gcc), and you don't have
-gcc yet, you can either build it yourself from the sources (available
-from e.g. L<http://gcc.gnu.org/mirrors.html>) or fetch
-a prebuilt binary from the HP porting center
-at L<http://hpux.connect.org.uk/hppd/cgi-bin/search?term=gcc&Search=Search>
-or from the DSPP (you need to be a member) at
-L<http://h21007.www2.hp.com/portal/site/dspp/menuitem.863c3e4cbcdc3f3515b49c108973a801?ciid=2a08725cc2f02110725cc2f02110275d6e10RCRD&jumpid=reg_r1002_usen_c-001_title_r0001>
-(Browse through the list, because there are often multiple versions of
-the same package available).
-
-Most mentioned distributions are depots. H.Merijn Brand has made prebuilt
-gcc binaries available on L<http://mirrors.develooper.com/hpux/> and/or
-L<http://www.cmve.net/~merijn/> for HP-UX 10.20 (only 32bit), HP-UX 11.00,
-HP-UX 11.11 (HP-UX 11i v1), and HP-UX 11.23 (HP-UX 11i v2 PA-RISC) in both
-32- and 64-bit versions. For HP-UX 11.23 IPF and HP-UX 11.31 IPF depots are
-available too. The IPF versions do not need two versions of GNU gcc.
-
-On PA-RISC you need a different compiler for 32-bit applications and for
-64-bit applications. On PA-RISC, 32-bit objects and 64-bit objects do
-not mix. Period. There is no different behaviour for HP C-ANSI-C or GNU
-gcc. So if you require your perl binary to use 64-bit libraries, like
-Oracle-64bit, you MUST build a 64-bit perl.
-
-Building a 64-bit capable gcc on PA-RISC from source is possible only when
-you have the HP C-ANSI C compiler or an already working 64-bit binary of
-gcc available. Best performance for perl is achieved with HP's native
-compiler.
-
-=head2 Using Large Files with Perl on HP-UX
-
-Beginning with HP-UX version 10.20, files larger than 2GB (2^31 bytes)
-may be created and manipulated. Three separate methods of doing this
-are available. Of these methods, the best method for Perl is to compile
-using the -Duselargefiles flag to Configure. This causes Perl to be
-compiled using structures and functions in which these are 64 bits wide,
-rather than 32 bits wide. (Note that this will only work with HP's ANSI
-C compiler. If you want to compile Perl using gcc, you will have to get
-a version of the compiler that supports 64-bit operations. See above for
-where to find it.)
-
-There are some drawbacks to this approach. One is that any extension
-which calls any file-manipulating C function will need to be recompiled
-(just follow the usual "perl Makefile.PL; make; make test; make install"
-procedure).
+=head2 The HP ANSI C Compiler
+When using this compiler to build Perl, you should make sure that
+the flag -Aa is added to the cpprun and cppstdin variables in the
+config.sh file.
+
+=head2 Using Large Files with Perl
+
+Beginning with HP-UX version 10.20, files larger than 2GB (2^31) may be
+created and manipulated.
+Three separate methods of doing this are available.
+Of these methods,
+the best method for Perl is to compile using the -D_FILE_OFFSET_BITS=64
+compiler flag.
+This causes Perl to be compiled using structures and functions in which
+these are 64 bits wide, rather than 32 bits wide.
+
+There are only two drawbacks to this approach:
+the first is that the seek and tell functions (both the builtin version
+and the POSIX module's version) will not correctly
+function for these large files
+(the offset arguments in seek and tell are implemented as type long).
+The second is that any extension which calls any file-manipulating C function
+will need to be recompiled using the above-mentioned -D_FILE_OFFSET_BITS=64
+flag.
The list of functions that will need to recompiled is:
- creat, fgetpos, fopen,
- freopen, fsetpos, fstat,
- fstatvfs, fstatvfsdev, ftruncate,
- ftw, lockf, lseek,
- lstat, mmap, nftw,
- open, prealloc, stat,
- statvfs, statvfsdev, tmpfile,
- truncate, getrlimit, setrlimit
-
-Another drawback is only valid for Perl versions before 5.6.0. This
-drawback is that the seek and tell functions (both the builtin version
-and POSIX module version) will not perform correctly.
-
-It is strongly recommended that you use this flag when you run
-Configure. If you do not do this, but later answer the question about
-large files when Configure asks you, you may get a configuration that
-cannot be compiled, or that does not function as expected.
-
-=head2 Threaded Perl on HP-UX
-
-It is possible to compile a version of threaded Perl on any version of
-HP-UX before 10.30, but it is strongly suggested that you be running on
+creat, fgetpos, fopen,
+freopen, fsetpos, fstat,
+fstatvfs, fstatvfsdev, ftruncate,
+ftw, lockf, lseek,
+lstat, mmap, nftw,
+open, prealloc, stat,
+statvfs, statvfsdev, tmpfile,
+truncate, getrlimit, setrlimit
+
+=head2 Threaded Perl
+
+It is impossible to compile a version of threaded Perl on any version of
+HP-UX before 10.30, and it is strongly suggested that you be running on
HP-UX 11.00 at least.
-To compile Perl with threads, add -Dusethreads to the arguments of
-Configure. Verify that the -D_POSIX_C_SOURCE=199506L compiler flag is
-automatically added to the list of flags. Also make sure that -lpthread
-is listed before -lc in the list of libraries to link Perl with. The
-hints provided for HP-UX during Configure will try very hard to get
-this right for you.
-
-HP-UX versions before 10.30 require a separate installation of a POSIX
-threads library package. Two examples are the HP DCE package, available
-on "HP-UX Hardware Extensions 3.0, Install and Core OS, Release 10.20,
-April 1999 (B3920-13941)" or the Freely available PTH package, available
-on H.Merijn's site (L<http://mirrors.develooper.com/hpux/>). The use of PTH
-will be unsupported in perl-5.12 and up and is rather buggy in 5.11.x.
-
-If you are going to use the HP DCE package, the library used for threading
-is /usr/lib/libcma.sl, but there have been multiple updates of that
-library over time. Perl will build with the first version, but it
-will not pass the test suite. Older Oracle versions might be a compelling
-reason not to update that library, otherwise please find a newer version
-in one of the following patches: PHSS_19739, PHSS_20608, or PHSS_23672
-
-reformatted output:
-
- d3:/usr/lib 106 > what libcma-*.1
- libcma-00000.1:
- HP DCE/9000 1.5 Module: libcma.sl (Export)
- Date: Apr 29 1996 22:11:24
- libcma-19739.1:
- HP DCE/9000 1.5 PHSS_19739-40 Module: libcma.sl (Export)
- Date: Sep 4 1999 01:59:07
- libcma-20608.1:
- HP DCE/9000 1.5 PHSS_20608 Module: libcma.1 (Export)
- Date: Dec 8 1999 18:41:23
- libcma-23672.1:
- HP DCE/9000 1.5 PHSS_23672 Module: libcma.1 (Export)
- Date: Apr 9 2001 10:01:06
- d3:/usr/lib 107 >
-
-If you choose for the PTH package, use swinstall to install pth in
-the default location (/opt/pth), and then make symbolic links to the
-libraries from /usr/lib
-
- # cd /usr/lib
- # ln -s /opt/pth/lib/libpth* .
-
-For building perl to support Oracle, it needs to be linked with libcl
-and libpthread. So even if your perl is an unthreaded build, these
-libraries might be required. See "Oracle on HP-UX" below.
-
-=head2 64-bit Perl on HP-UX
-
-Beginning with HP-UX 11.00, programs compiled under HP-UX can take
-advantage of the LP64 programming environment (LP64 means Longs and
-Pointers are 64 bits wide), in which scalar variables will be able
-to hold numbers larger than 2^32 with complete precision. Perl has
-proven to be consistent and reliable in 64bit mode since 5.8.1 on
-all HP-UX 11.xx.
-
-As of the date of this document, Perl is fully 64-bit compliant on
-HP-UX 11.00 and up for both cc- and gcc builds. If you are about to
-build a 64-bit perl with GNU gcc, please read the gcc section carefully.
-
-Should a user have the need for compiling Perl in the LP64 environment,
-use the -Duse64bitall flag to Configure. This will force Perl to be
-compiled in a pure LP64 environment (with the +DD64 flag for HP C-ANSI-C,
-with no additional options for GNU gcc 64-bit on PA-RISC, and with
--mlp64 for GNU gcc on Itanium).
-If you want to compile Perl using gcc, you will have to get a version of
-the compiler that supports 64-bit operations.)
-
-You can also use the -Duse64bitint flag to Configure. Although there
-are some minor differences between compiling Perl with this flag versus
-the -Duse64bitall flag, they should not be noticeable from a Perl user's
-perspective. When configuring -Duse64bitint using a 64bit gcc on a
-pa-risc architecture, -Duse64bitint is silently promoted to -Duse64bitall.
-
-In both cases, it is strongly recommended that you use these flags when
-you run Configure. If you do not use do this, but later answer the
-questions about 64-bit numbers when Configure asks you, you may get a
-configuration that cannot be compiled, or that does not function as
-expected.
-
-=head2 Oracle on HP-UX
-
-Using perl to connect to Oracle databases through DBI and DBD::Oracle
-has caused a lot of people many headaches. Read README.hpux in the
-DBD::Oracle for much more information. The reason to mention it here
-is that Oracle requires a perl built with libcl and libpthread, the
-latter even when perl is build without threads. Building perl using
-all defaults, but still enabling to build DBD::Oracle later on can be
-achieved using
-
- Configure -A prepend:libswanted='cl pthread ' ...
-
-Do not forget the space before the trailing quote.
-
-Also note that this does not (yet) work with all configurations,
-it is known to fail with 64-bit versions of GCC.
-
-=head2 GDBM and Threads on HP-UX
-
-If you attempt to compile Perl with (POSIX) threads on an 11.X system
-and also link in the GDBM library, then Perl will immediately core dump
-when it starts up. The only workaround at this point is to relink the
-GDBM library under 11.X, then relink it into Perl.
-
-the error might show something like:
-
-Pthread internal error: message: __libc_reinit() failed, file: ../pthreads/pthread.c, line: 1096
-Return Pointer is 0xc082bf33
-sh: 5345 Quit(coredump)
-
-and Configure will give up.
-
-=head2 NFS filesystems and utime(2) on HP-UX
+To compile Perl with thread, add -Dusethreads to the arguments of Configure.
+Ensure that the -D_POSIX_C_SOURCE=199506L compiler flag is automatically
+added to the list of flags. Also make sure that -lpthread is listed before
+-lc in the list of libraries to link Perl with.
-If you are compiling Perl on a remotely-mounted NFS filesystem, the test
-io/fs.t may fail on test #18. This appears to be a bug in HP-UX and no
-fix is currently available.
-
-=head2 HP-UX Kernel Parameters (maxdsiz) for Compiling Perl
-
-By default, HP-UX comes configured with a maximum data segment size of
-64MB. This is too small to correctly compile Perl with the maximum
-optimization levels. You can increase the size of the maxdsiz kernel
-parameter through the use of SAM.
-
-When using the GUI version of SAM, click on the Kernel Configuration
-icon, then the Configurable Parameters icon. Scroll down and select
-the maxdsiz line. From the Actions menu, select the Modify Configurable
-Parameter item. Insert the new formula into the Formula/Value box.
-Then follow the instructions to rebuild your kernel and reboot your
-system.
-
-In general, a value of 256MB (or "256*1024*1024") is sufficient for
-Perl to compile at maximum optimization.
+As of the date of this document, Perl threads are not fully supported on HP-UX.
-=head1 nss_delete core dump from op/pwent or op/grent
+=head2 64-bit Perl
-You may get a bus error core dump from the op/pwent or op/grent
-tests. If compiled with -g you will see a stack trace much like
-the following:
+Beginning with HP-UX 11.00, programs compiled under HP-UX can take advantage
+of the LP64 programming environment (LP64 means Longs and Pointers are 64 bits
+wide).
- #0 0xc004216c in () from /usr/lib/libc.2
- #1 0xc00d7550 in __nss_src_state_destr () from /usr/lib/libc.2
- #2 0xc00d7768 in __nss_src_state_destr () from /usr/lib/libc.2
- #3 0xc00d78a8 in nss_delete () from /usr/lib/libc.2
- #4 0xc01126d8 in endpwent () from /usr/lib/libc.2
- #5 0xd1950 in Perl_pp_epwent () from ./perl
- #6 0x94d3c in Perl_runops_standard () from ./perl
- #7 0x23728 in S_run_body () from ./perl
- #8 0x23428 in perl_run () from ./perl
- #9 0x2005c in main () from ./perl
+Work is being performed on Perl to make it 64-bit compliant on all versions
+of Unix. Once this is complete, scalar variables will be able to hold
+numbers larger than 2^32 with complete precision.
-The key here is the C<nss_delete> call. One workaround for this
-bug seems to be to create add to the file F</etc/nsswitch.conf>
-(at least) the following lines
+As of the date of this document, Perl is not 64-bit compliant on HP-UX.
- group: files
- passwd: files
+Should a user wish to experiment with compiling Perl in the LP64 environment,
+the following steps must be taken: libraries must be searched only within
+/lib/pa20_64, the compiler flag +DD64 must be used, and the C library is
+now located at /lib/pa20_64/libc.sl.
-Whether you are using NIS does not matter. Amazingly enough,
-the same bug also affects Solaris.
+On the brighter side, the large file problem goes away, as longs are now
+64 bits wide.
-=head1 error: pasting ")" and "l" does not give a valid preprocessing token
+=head2 GDBM and Threads
-There seems to be a broken system header file in HP-UX 11.00 that
-breaks perl building in 32bit mode with GNU gcc-4.x causing this
-error. The same file for HP-UX 11.11 (even though the file is older)
-does not show this failure, and has the correct definition, so the
-best fix is to patch the header to match:
+If you attempt to compile Perl with threads on an 11.X system and also link
+in the GDBM library, then Perl will immediately core dump when it starts up.
+The only workaround at this point is to relink the GDBM library under 11.X,
+then relink it into Perl.
- --- /usr/include/inttypes.h 2001-04-20 18:42:14 +0200
- +++ /usr/include/inttypes.h 2000-11-14 09:00:00 +0200
- @@ -72,7 +72,7 @@
- #define UINT32_C(__c) __CONCAT_U__(__c)
- #else /* __LP64 */
- #define INT32_C(__c) __CONCAT__(__c,l)
- -#define UINT32_C(__c) __CONCAT__(__CONCAT_U__(__c),l)
- +#define UINT32_C(__c) __CONCAT__(__c,ul)
- #endif /* __LP64 */
+=head2 NFS filesystems and utime(2)
- #define INT64_C(__c) __CONCAT_L__(__c,l)
-
-
-=head1 Miscellaneous
-
-HP-UX 11 Y2K patch "Y2K-1100 B.11.00.B0125 HP-UX Core OS Year 2000
-Patch Bundle" has been reported to break the io/fs test #18 which
-tests whether utime() can change timestamps. The Y2K patch seems to
-break utime() so that over NFS the timestamps do not get changed
-(on local filesystems utime() still works). This has probably been
-fixed on your system by now.
+If you are compiling Perl on a remotely-mounted NFS filesystem, the test
+io/fs.t may fail on test #18.
+This appears to be a bug in HP-UX and no fix is currently available.
=head1 AUTHOR
-H.Merijn Brand <h.m.brand@xs4all.nl>
Jeff Okamoto <okamoto@corp.hp.com>
With much assistance regarding shared libraries from Marc Sabatella.
+=head1 DATE
+
+Version 0.2: 1999/03/01
+
=cut
diff --git a/gnu/usr.bin/perl/README.hurd b/gnu/usr.bin/perl/README.hurd
index 7f9b4a98868..40e1ba996d8 100644
--- a/gnu/usr.bin/perl/README.hurd
+++ b/gnu/usr.bin/perl/README.hurd
@@ -1,54 +1,40 @@
-If you read this file _as_is_, just ignore the funny characters you see.
-It is written in the POD format (see pod/perlpod.pod) which is specially
-designed to be readable as is.
-
-=head1 NAME
-
-perlhurd - Perl version 5 on Hurd
-
-=head1 DESCRIPTION
+Notes on Perl on the Hurd
+Last Updated: Sat, 6 Mar 1999 16:07:59 +0100
+Written by: Mark Kettenis <kettenis@gnu.org>
If you want to use Perl on the Hurd, I recommend using the Debian
-GNU/Hurd distribution ( see http://www.debian.org/ ), even if an
-official, stable release has not yet been made. The old "gnu-0.2"
+GNU/Hurd distribution (see http://www.debian.org), even if an
+official, stable release has not yet been made. The old `gnu-0.2'
binary distribution will most certainly have additional problems.
-=head2 Known Problems with Perl on Hurd
+* Known Problems
-The Perl test suite may still report some errors on the Hurd. The
-"lib/anydbm" and "pragma/warnings" tests will almost certainly fail.
-Both failures are not really specific to the Hurd, as indicated by the
-test suite output.
+The Perl testsuite may still report some errors on the Hurd. The
+`lib/anydbm.t' and `op/stat.t' tests will most certainly fail. The
+first fails because Berkeley DB 2 does not allow empty keys and the
+test tries to use them anyway. This is not really a Hurd bug. The
+same test fails on Linux with version 2.1 of the GNU C Library. The
+second failure is caused by a bug in the Hurd's filesystem servers,
+that we have not been able to fix yet. I don't think it is crucial.
The socket tests may fail if the network is not configured. You have
-to make "/hurd/pfinet" the translator for "/servers/socket/2", giving
-it the right arguments. Try "/hurd/pfinet --help" for more
+to make `/hurd/pfinet' the translator for `/servers/socket/2', giving
+it the right arguments. Try `/hurd/pfinet --help' for more
information.
-Here are the statistics for Perl 5.005_62 on my system:
-
- Failed Test Status Wstat Total Fail Failed List of failed
- -------------------------------------------------------------------------
- lib/anydbm.t 12 1 8.33% 12
- pragma/warnings 333 1 0.30% 215
+Here are the statistics for Perl 5.005_03 on my system:
- 8 tests and 24 subtests skipped.
- Failed 2/229 test scripts, 99.13% okay. 2/10850 subtests failed, 99.98% okay.
+Failed Test Status Wstat Total Fail Failed List of failed
+-------------------------------------------------------------------------------
+lib/anydbm.t 12 1 8.33% 12
+op/stat.t 58 1 1.72% 4
+5 tests skipped, plus 14 subtests skipped.
+Failed 2/189 test scripts, 98.94% okay. 2/6669 subtests failed, 99.97% okay.
There are quite a few systems out there that do worse!
However, since I am running a very recent Hurd snapshot, in which a lot of
-bugs that were exposed by the Perl test suite have been fixed, you may
-encounter more failures. Likely candidates are: "op/stat", "lib/io_pipe",
-"lib/io_sock", "lib/io_udp" and "lib/time".
-
-In any way, if you're seeing failures beyond those mentioned in this
-document, please consider upgrading to the latest Hurd before reporting
-the failure as a bug.
-
-=head1 AUTHOR
-
-Mark Kettenis <kettenis@gnu.org>
-
-Last Updated: Fri, 29 Oct 1999 22:50:30 +0200
+bugs that were exposed by the Perl testsuite have been fixed, you may
+encounter more failures. Likely candidates are: `lib/io_pipe.t',
+`lib/io_sock.t', `lib/io_udp.t' and `lib/time.t'.
diff --git a/gnu/usr.bin/perl/README.os390 b/gnu/usr.bin/perl/README.os390
index 645d10e40dc..5fcdfc01216 100644
--- a/gnu/usr.bin/perl/README.os390
+++ b/gnu/usr.bin/perl/README.os390
@@ -1,118 +1,56 @@
-This document is written in pod format hence there are punctuation
-characters in odd places. Do not worry, you've apparently got the
-ASCII->EBCDIC translation worked out correctly. You can read more
-about pod in pod/perlpod.pod or the short summary in the INSTALL file.
+This document is written in pod format hence there are punctuation
+characters in in odd places. Do not worry, you've apparently got
+the ASCII->EBCDIC translation worked out correctly. You can read
+more about pod in pod/perlpod.pod or the short summary in the
+INSTALL file.
=head1 NAME
-perlos390 - building and installing Perl for OS/390 and z/OS
+README.os390 - building and installing Perl for OS/390.
=head1 SYNOPSIS
This document will help you Configure, build, test and install Perl
-on OS/390 (aka z/OS) Unix System Services.
+on OS/390 Unix System Services.
=head1 DESCRIPTION
-This is a fully ported Perl for OS/390 Version 2 Release 3, 5, 6, 7,
-8, and 9. It may work on other versions or releases, but those are
-the ones we've tested it on.
+This is a fully ported perl for OS/390 Release 3, 5 and 6.
+It may work on other versions, but those are the ones we've
+tested it on.
-You may need to carry out some system configuration tasks before
-running the Configure script for Perl.
+You may need to carry out some system configuration tasks before
+running the Configure script for perl.
-
-=head2 Tools
-
-The z/OS Unix Tools and Toys list may prove helpful and contains links
-to ports of much of the software helpful for building Perl.
-http://www.ibm.com/servers/eserver/zseries/zos/unix/bpxa1toy.html
-
-
-=head2 Unpacking Perl distribution on OS/390
-
-If using ftp remember to transfer the distribution in binary format.
+=head2 Unpacking
Gunzip/gzip for OS/390 is discussed at:
- http://www.ibm.com/servers/eserver/zseries/zos/unix/bpxa1ty1.html
+ http://www.s390.ibm.com/products/oe/bpxqp1.html
to extract an ASCII tar archive on OS/390, try this:
pax -o to=IBM-1047,from=ISO8859-1 -r < latest.tar
-or
-
- zcat latest.tar.Z | pax -o to=IBM-1047,from=ISO8859-1 -r
-
-If you get lots of errors of the form
-
- tar: FSUM7171 ...: cannot set uid/gid: EDC5139I Operation not permitted.
-
-you didn't read the above and tried to use tar instead of pax, you'll
-first have to remove the (now corrupt) perl directory
-
- rm -rf perl-...
-
-and then use pax.
-
-=head2 Setup and utilities for Perl on OS/390
+=head2 Setup and utilities
Be sure that your yacc installation is in place including any necessary
parser template files. If you have not already done so then be sure to:
cp /samples/yyparse.c /etc
-This may also be a good time to ensure that your /etc/protocol file
+This may also be a good time to ensure that your /etc/protocol file
and either your /etc/resolv.conf or /etc/hosts files are in place.
-The IBM document that described such USS system setup issues was
-SC28-1890-07 "OS/390 UNIX System Services Planning", in particular
-Chapter 6 on customizing the OE shell.
-
-GNU make for OS/390, which is recommended for the build of perl (as
-well as building CPAN modules and extensions), is available from the
-L</Tools>.
-
-Some people have reported encountering "Out of memory!" errors while
-trying to build Perl using GNU make binaries. If you encounter such
-trouble then try to download the source code kit and build GNU make
-from source to eliminate any such trouble. You might also find GNU make
-(as well as Perl and Apache) in the red-piece/book "Open Source Software
-for OS/390 UNIX", SG24-5944-00 from IBM.
-
-If instead of the recommended GNU make you would like to use the system
-supplied make program then be sure to install the default rules file
-properly via the shell command:
-
- cp /samples/startup.mk /etc
-
-and be sure to also set the environment variable _C89_CCMODE=1 (exporting
-_C89_CCMODE=1 is also a good idea for users of GNU make).
-You might also want to have GNU groff for OS/390 installed before
-running the "make install" step for Perl.
+GNU make for OS/390, which may be required for the build of perl,
+is available from:
-There is a syntax error in the /usr/include/sys/socket.h header file
-that IBM supplies with USS V2R7, V2R8, and possibly V2R9. The problem with
-the header file is that near the definition of the SO_REUSEPORT constant
-there is a spurious extra '/' character outside of a comment like so:
+ http://www.mks.com/s390/gnu/index.htm
- #define SO_REUSEPORT 0x0200 /* allow local address & port
- reuse */ /
+=head2 Configure
-You could edit that header yourself to remove that last '/', or you might
-note that Language Environment (LE) APAR PQ39997 describes the problem
-and PTF's UQ46272 and UQ46271 are the (R8 at least) fixes and apply them.
-If left unattended that syntax error will turn up as an inability for Perl
-to build its "Socket" extension.
-
-For successful testing you may need to turn on the sticky bit for your
-world readable /tmp directory if you have not already done so (see man chmod).
-
-=head2 Configure Perl on OS/390
-
-Once you've unpacked the distribution, run "sh Configure" (see INSTALL
-for a full discussion of the Configure options). There is a "hints" file
+Once you've unpacked the distribution, run "sh Configure" (see INSTALL
+for a full discussion of the Configure options). There is a "hints" file
for os390 that specifies the correct values for most things. Some things
to watch out for include:
@@ -120,46 +58,25 @@ to watch out for include:
=item *
-A message of the form:
-
- (I see you are using the Korn shell. Some ksh's blow up on Configure,
- mainly on older exotic systems. If yours does, try the Bourne shell instead.)
-
-is nothing to worry about at all.
-
-=item *
-
Some of the parser default template files in /samples are needed in /etc.
In particular be sure that you at least copy /samples/yyparse.c to /etc
-before running Perl's Configure. This step ensures successful extraction
-of EBCDIC versions of parser files such as perly.c, perly.h, and x2p/a2p.c.
-This has to be done before running Configure the first time. If you failed
-to do so then the easiest way to re-Configure Perl is to delete your
-misconfigured build root and re-extract the source from the tar ball.
-Then you must ensure that /etc/yyparse.c is properly in place before
-attempting to re-run Configure.
+before running perl's Configure. This step ensures successful extraction
+of EBCDIC versions of parser files such as perly.c.
=item *
-This port will support dynamic loading, but it is not selected by
-default. If you would like to experiment with dynamic loading then
-be sure to specify -Dusedl in the arguments to the Configure script.
-See the comments in hints/os390.sh for more information on dynamic loading.
-If you build with dynamic loading then you will need to add the
-$archlibexp/CORE directory to your LIBPATH environment variable in order
-for perl to work. See the config.sh file for the value of $archlibexp.
-If in trying to use Perl you see an error message similar to:
+This port doesn't support dynamic loading. Although
+OS/390 has support for DLLs, there are some differences
+that cause problems for perl.
- CEE3501S The module libperl.dll was not found.
- From entry point __dllstaticinit at compile unit offset +00000194 at
+=item *
-then your LIBPATH does not have the location of libperl.x and either
-libperl.dll or libperl.so in it. Add that directory to your LIBPATH and
-proceed.
+You may see a "WHOA THERE!!!" message for $d_shmatprototype
+it is OK to keep the recommended "define".
=item *
-Do not turn on the compiler optimization flag "-O". There is
+Don't turn on the compiler optimization flag "-O". There's
a bug in either the optimizer or perl that causes perl to
not work correctly when the optimizer is on.
@@ -168,17 +85,14 @@ not work correctly when the optimizer is on.
Some of the configuration files in /etc used by the
networking APIs are either missing or have the wrong
names. In particular, make sure that there's either
-an /etc/resolv.conf or an /etc/hosts, so that
+an /etc/resolv.conf or and /etc/hosts, so that
gethostbyname() works, and make sure that the file
/etc/proto has been renamed to /etc/protocol (NOT
/etc/protocols, as used by other Unix systems).
-You may have to look for things like HOSTNAME and DOMAINORIGIN
-in the "//'SYS1.TCPPARMS(TCPDATA)'" PDS member in order to
-properly set up your /etc networking files.
=back
-=head2 Build, Test, Install Perl on OS/390
+=head2 Build, test, install
Simply put:
@@ -186,7 +100,7 @@ Simply put:
make
make test
-if everything looks ok (see the next section for test/IVP diagnosis) then:
+if everything looks ok then:
make install
@@ -194,251 +108,51 @@ this last step may or may not require UID=0 privileges depending
on how you answered the questions that Configure asked and whether
or not you have write access to the directories you specified.
-=head2 Build Anomalies with Perl on OS/390
-
-"Out of memory!" messages during the build of Perl are most often fixed
-by re building the GNU make utility for OS/390 from a source code kit.
-
-Another memory limiting item to check is your MAXASSIZE parameter in your
-'SYS1.PARMLIB(BPXPRMxx)' data set (note too that as of V2R8 address space
-limits can be set on a per user ID basis in the USS segment of a RACF
-profile). People have reported successful builds of Perl with MAXASSIZE
-parameters as small as 503316480 (and it may be possible to build Perl
-with a MAXASSIZE smaller than that).
-
-Within USS your /etc/profile or $HOME/.profile may limit your ulimit
-settings. Check that the following command returns reasonable values:
-
- ulimit -a
-
-To conserve memory you should have your compiler modules loaded into the
-Link Pack Area (LPA/ELPA) rather than in a link list or step lib.
-
-If the c89 compiler complains of syntax errors during the build of the
-Socket extension then be sure to fix the syntax error in the system
-header /usr/include/sys/socket.h.
-
-=head2 Testing Anomalies with Perl on OS/390
-
-The "make test" step runs a Perl Verification Procedure, usually before
-installation. You might encounter STDERR messages even during a successful
-run of "make test". Here is a guide to some of the more commonly seen
-anomalies:
-
-=over 4
-
-=item *
-
-A message of the form:
-
- io/openpid...........CEE5210S The signal SIGHUP was received.
- CEE5210S The signal SIGHUP was received.
- CEE5210S The signal SIGHUP was received.
- ok
-
-indicates that the t/io/openpid.t test of Perl has passed but done so
-with extraneous messages on stderr from CEE.
-
-=item *
-
-A message of the form:
-
- lib/ftmp-security....File::Temp::_gettemp: Parent directory (/tmp/) is not safe
- (sticky bit not set when world writable?) at lib/ftmp-security.t line 100
- File::Temp::_gettemp: Parent directory (/tmp/) is not safe (sticky bit not
- set when world writable?) at lib/ftmp-security.t line 100
- ok
-
-indicates a problem with the permissions on your /tmp directory within the HFS.
-To correct that problem issue the command:
-
- chmod a+t /tmp
-
-from an account with write access to the directory entry for /tmp.
-
-=item *
-
-Out of Memory!
-
-Recent perl test suite is quite memory hungry. In addition to the comments
-above on memory limitations it is also worth checking for _CEE_RUNOPTS
-in your environment. Perl now has (in miniperlmain.c) a C #pragma
-to set CEE run options, but the environment variable wins.
-
-The C code asks for:
-
- #pragma runopts(HEAP(2M,500K,ANYWHERE,KEEP,8K,4K) STACK(,,ANY,) ALL31(ON))
-
-The important parts of that are the second argument (the increment) to HEAP,
-and allowing the stack to be "Above the (16M) line". If the heap
-increment is too small then when perl (for example loading unicode/Name.pl) tries
-to create a "big" (400K+) string it cannot fit in a single segment
-and you get "Out of Memory!" - even if there is still plenty of memory
-available.
-
-A related issue is use with perl's malloc. Perl's malloc uses C<sbrk()>
-to get memory, and C<sbrk()> is limited to the first allocation so in this
-case something like:
-
- HEAP(8M,500K,ANYWHERE,KEEP,8K,4K)
-
-is needed to get through the test suite.
-
-
-=back
-
-=head2 Installation Anomalies with Perl on OS/390
-
-The installman script will try to run on OS/390. There will be fewer errors
-if you have a roff utility installed. You can obtain GNU groff from the
-Redbook SG24-5944-00 ftp site.
-
-=head2 Usage Hints for Perl on OS/390
+=head2 Usage Hints
When using perl on OS/390 please keep in mind that the EBCDIC and ASCII
-character sets are different. See perlebcdic.pod for more on such character
-set issues. Perl builtin functions that may behave differently under
-EBCDIC are also mentioned in the perlport.pod document.
+character sets are different. Perl builtin functions that may behave
+differently under EBCDIC are mentioned in the perlport.pod document.
-Open Edition (UNIX System Services) from V2R8 onward does support
-#!/path/to/perl script invocation. There is a PTF available from
-IBM for V2R7 that will allow shell/kernel support for #!. USS
-releases prior to V2R7 did not support the #! means of script invocation.
-If you are running V2R6 or earlier then see:
+OpenEdition (UNIX System Services) does not (yet) support the #! means
+of script invokation.
+See:
head `whence perldoc`
for an example of how to use the "eval exec" trick to ask the shell to
-have Perl run your scripts on those older releases of Unix System Services.
-
-If you are having trouble with square brackets then consider switching your
-rlogin or telnet client. Try to avoid older 3270 emulators and ISHELL for
-working with Perl on USS.
-
-=head2 Floating Point Anomalies with Perl on OS/390
-
-There appears to be a bug in the floating point implementation on S/390
-systems such that calling int() on the product of a number and a small
-magnitude number is not the same as calling int() on the quotient of
-that number and a large magnitude number. For example, in the following
-Perl code:
-
- my $x = 100000.0;
- my $y = int($x * 1e-5) * 1e5; # '0'
- my $z = int($x / 1e+5) * 1e5; # '100000'
- print "\$y is $y and \$z is $z\n"; # $y is 0 and $z is 100000
-
-Although one would expect the quantities $y and $z to be the same and equal
-to 100000 they will differ and instead will be 0 and 100000 respectively.
-
-The problem can be further examined in a roughly equivalent C program:
-
- #include <stdio.h>
- #include <math.h>
- main()
- {
- double r1,r2;
- double x = 100000.0;
- double y = 0.0;
- double z = 0.0;
- x = 100000.0 * 1e-5;
- r1 = modf (x,&y);
- x = 100000.0 / 1e+5;
- r2 = modf (x,&z);
- printf("y is %e and z is %e\n",y*1e5,z*1e5);
- /* y is 0.000000e+00 and z is 1.000000e+05 (with c89) */
- }
-
-=head2 Modules and Extensions for Perl on OS/390
-
-Pure pure (that is non xs) modules may be installed via the usual:
-
- perl Makefile.PL
- make
- make test
- make install
-
-If you built perl with dynamic loading capability then that would also
-be the way to build xs based extensions. However, if you built perl with
-the default static linking you can still build xs based extensions for OS/390
-but you will need to follow the instructions in ExtUtils::MakeMaker for
-building statically linked perl binaries. In the simplest configurations
-building a static perl + xs extension boils down to:
-
- perl Makefile.PL
- make
- make perl
- make test
- make install
- make -f Makefile.aperl inst_perl MAP_TARGET=perl
+have perl run your scripts for you.
-In most cases people have reported better results with GNU make rather
-than the system's /bin/make program, whether for plain modules or for
-xs based extensions.
+=head2 Extensions
-If the make process encounters trouble with either compilation or
-linking then try setting the _C89_CCMODE to 1. Assuming sh is your
-login shell then run:
-
- export _C89_CCMODE=1
-
-If tcsh is your login shell then use the setenv command.
+You can build xs based extensions to Perl for OS/390 but will need to
+follow the instructions in ExtUtils::MakeMaker for building statically
+linked perl binaries. In most cases people have reported better
+results with GNU make rather than the system's /bin/make.
=head1 AUTHORS
-David Fiander and Peter Prymmer with thanks to Dennis Longnecker
-and William Raffloer for valuable reports, LPAR and PTF feedback.
-Thanks to Mike MacIsaac and Egon Terwedow for SG24-5944-00.
-Thanks to Ignasi Roca for pointing out the floating point problems.
-Thanks to John Goodyear for dynamic loading help.
+David Fiander and Peter Prymmer.
=head1 SEE ALSO
-L<INSTALL>, L<perlport>, L<perlebcdic>, L<ExtUtils::MakeMaker>.
-
- http://www.ibm.com/servers/eserver/zseries/zos/unix/bpxa1toy.html
-
- http://www.redbooks.ibm.com/redbooks/SG245944.html
-
- http://www.ibm.com/servers/eserver/zseries/zos/unix/bpxa1ty1.html#opensrc
+L<INSTALL>, L<perlport>, L<ExtUtils::MakeMaker>.
- http://www.xray.mpe.mpg.de/mailing-lists/perl-mvs/
+=head2 Mailing list
- http://publibz.boulder.ibm.com:80/cgi-bin/bookmgr_OS390/BOOKS/ceea3030/
+The Perl Institute (http://www.perl.org/) maintains a perl-mvs
+mailing list of interest to all folks building and/or
+using perl on EBCDIC platforms. To subscibe, send a message of:
- http://publibz.boulder.ibm.com:80/cgi-bin/bookmgr_OS390/BOOKS/CBCUG030/
+ subscribe perl-mvs
-=head2 Mailing list for Perl on OS/390
-
-If you are interested in the z/OS (formerly known as OS/390)
-and POSIX-BC (BS2000) ports of Perl then see the perl-mvs mailing list.
-To subscribe, send an empty message to perl-mvs-subscribe@perl.org.
-
-See also:
-
- http://lists.perl.org/list/perl-mvs.html
-
-There are web archives of the mailing list at:
-
- http://www.xray.mpe.mpg.de/mailing-lists/perl-mvs/
- http://archive.develooper.com/perl-mvs@perl.org/
+to majordomo@perl.org.
=head1 HISTORY
This document was originally written by David Fiander for the 5.005
release of Perl.
-This document was podified for the 5.005_03 release of Perl 11 March 1999.
-
-Updated 28 November 2001 for broken URLs.
-
-Updated 12 November 2000 for the 5.7.1 release of Perl.
-
-Updated 15 January 2001 for the 5.7.1 release of Perl.
-
-Updated 24 January 2001 to mention dynamic loading.
-
-Updated 12 March 2001 to mention //'SYS1.TCPPARMS(TCPDATA)'.
+This document was podified for the 5.005_03 release of perl 11 March 1999.
=cut
-
diff --git a/gnu/usr.bin/perl/djgpp/djgppsed.sh b/gnu/usr.bin/perl/djgpp/djgppsed.sh
index f84452e6360..5276f4f67fb 100644
--- a/gnu/usr.bin/perl/djgpp/djgppsed.sh
+++ b/gnu/usr.bin/perl/djgpp/djgppsed.sh
@@ -17,14 +17,13 @@ SCOR='s=c\\\.c|=c\_c|=g'
SHSED='s=\.\(hsed\)=_\1=g'
SDEPTMP='s=\.\(deptmp\)=_\1=g'
SCPP='s=\.\(cpp\.\)=_\1=g'
-SARGV='s=Io_argv\(.\)\.=i\1_=g'
+SARGV='s=\.\(argv\.\)=_\1=g'
SABC='s=\.\([abc][^a]\)=_\1=g'
SDBMX='s=\.\(dbmx\)=_\1=g'
SDBHASH='s=dbhash\.tmp=dbhash_tmp=g'
SSTAT='s=\.\(stat\.\)=_\1=g'
STMP2='s=tmp2=tm2=g'
SPACKLIST='s=\.\(packlist\)=_\1=g'
-SDOTTMP='s=\.tmp=_tmp=g'
sed -e $SCONFIG -e $SGREPTMP -e $SECHOTMP -e $SDDC -e $SOUT -e 's=\.\( \./\$file\)$=sh\1=g' Configure |tr -d '\r' >s; mv -f s Configure
sed -e $SEXISTS -e $SLIST -e $SCONFIG Makefile.SH |tr -d '\r' >s; mv -f s Makefile.SH
@@ -34,16 +33,17 @@ sed -e $SEXISTS -e $SPACKLIST installperl >s; mv -f s installperl
sed -e $SPOD2HTML lib/Pod/Html.pm |tr -d '\r' >s; mv -f s lib/Pod/Html.pm
sed -e $SCC -e $SLIST -e $SFILEC -e $SCOR -e $SDEPTMP -e $SHSED makedepend.SH |tr -d '\r' >s; mv -f s makedepend.SH
sed -e $SCPP t/comp/cpp.aux |tr -d '\r' >s; mv -f s t/comp/cpp.aux
-sed -e $SARGV -e $SDOTTMP t/io/argv.t >s; mv -f s t/io/argv.t
+sed -e $SARGV t/io/argv.t >s; mv -f s t/io/argv.t
sed -e $SABC t/io/inplace.t >s; mv -f s t/io/inplace.t
-sed -e $SDBMX -e $SDBHASH ext/GDBM_File/t/gdbm.t >s; mv -f s ext/GDBM_File/t/gdbm.t
+sed -e $SDBMX t/lib/anydbm.t >s; mv -f s t/lib/anydbm.t
+sed -e $SDBMX -e $SDBHASH t/lib/gdbm.t >s; mv -f s t/lib/gdbm.t
+sed -e $SDBMX -e $SDBHASH t/lib/sdbm.t >s; mv -f s t/lib/sdbm.t
sed -e $SSTAT -e $STMP2 t/op/stat.t >s; mv -f s t/op/stat.t
sed -e $SLIST x2p/Makefile.SH |tr -d '\r' >s; mv -f s x2p/Makefile.SH
-#sed -e 's=^#define.\([A-Z]\+\)_EXP.*$=#define \1_EXP djgpp_pathexp("\1")=g' config_h.SH >s; mv -f s config_h.SH
+sed -e 's=^#define.\([A-Z]\+\)_EXP.*$=#define \1_EXP djgpp_pathexp("\1")=g' config_h.SH >s; mv -f s config_h.SH
sed -e 's=:^/:={^([a-z]:)?[\\\\/]}=g' lib/termcap.pl >s; mv -f s lib/termcap.pl
sed -e $SPACKLIST installman >s; mv -f s installman
sed -e $SPACKLIST lib/ExtUtils/Installed.pm >s; mv -f s lib/ExtUtils/Installed.pm
sed -e $SPACKLIST lib/ExtUtils/Packlist.pm >s; mv -f s lib/ExtUtils/Packlist.pm
+sed -e $SPACKLIST lib/ExtUtils/inst >s; mv -f s lib/ExtUtils/inst
sed -e $SABC t/io/iprefix.t >s; mv -f s t/io/iprefix.t
-sed -e 's=L_ctermid==g' ext/POSIX/Makefile.PL >s; mv -f s ext/POSIX/Makefile.PL
-sed -e $SPACKLIST lib/ExtUtils/t/Installed.t >s; mv -f s lib/ExtUtils/t/Installed.t
diff --git a/gnu/usr.bin/perl/embedvar.h b/gnu/usr.bin/perl/embedvar.h
index 5ae8d051b17..25b31e01556 100644
--- a/gnu/usr.bin/perl/embedvar.h
+++ b/gnu/usr.bin/perl/embedvar.h
@@ -1,435 +1,895 @@
-/* -*- buffer-read-only: t -*-
- *
- * embedvar.h
- *
- * Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
- * 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by Larry Wall and others
- *
- * You may distribute under the terms of either the GNU General Public
- * License or the Artistic License, as specified in the README file.
- *
- * !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
- * This file is built by regen/embed.pl from data in embed.fnc,
- * regen/embed.pl, regen/opcodes, intrpvar.h and perlvars.h.
- * Any changes made here will be lost!
- *
- * Edit those files and run 'make regen_headers' to effect changes.
- */
+/* !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
+ This file is built by embed.pl from global.sym, intrpvar.h,
+ and thrdvar.h. Any changes made here will be lost!
+*/
/* (Doing namespace management portably in C is really gross.) */
-/*
- The following combinations of MULTIPLICITY and PERL_IMPLICIT_CONTEXT
- are supported:
- 1) none
- 2) MULTIPLICITY # supported for compatibility
- 3) MULTIPLICITY && PERL_IMPLICIT_CONTEXT
+/* EMBED has no run-time penalty, but helps keep the Perl namespace
+ from colliding with that used by other libraries pulled in
+ by extensions or by embedding perl. Allow a cc -DNO_EMBED
+ override, however, to keep binary compatability with previous
+ versions of perl.
+*/
+
- All other combinations of these flags are errors.
+/* Put interpreter-specific symbols into a struct? */
- only #3 is supported directly, while #2 is a special
- case of #3 (supported by redefining vTHX appropriately).
-*/
+#ifdef MULTIPLICITY
+
+#ifndef USE_THREADS
+/* If we do not have threads then per-thread vars are per-interpreter */
+
+#define PL_Sv (PL_curinterp->TSv)
+#define PL_Xpv (PL_curinterp->TXpv)
+#define PL_av_fetch_sv (PL_curinterp->Tav_fetch_sv)
+#define PL_bodytarget (PL_curinterp->Tbodytarget)
+#define PL_bostr (PL_curinterp->Tbostr)
+#define PL_chopset (PL_curinterp->Tchopset)
+#define PL_colors (PL_curinterp->Tcolors)
+#define PL_colorset (PL_curinterp->Tcolorset)
+#define PL_curcop (PL_curinterp->Tcurcop)
+#define PL_curpad (PL_curinterp->Tcurpad)
+#define PL_curpm (PL_curinterp->Tcurpm)
+#define PL_curstack (PL_curinterp->Tcurstack)
+#define PL_curstackinfo (PL_curinterp->Tcurstackinfo)
+#define PL_curstash (PL_curinterp->Tcurstash)
+#define PL_defoutgv (PL_curinterp->Tdefoutgv)
+#define PL_defstash (PL_curinterp->Tdefstash)
+#define PL_delaymagic (PL_curinterp->Tdelaymagic)
+#define PL_dirty (PL_curinterp->Tdirty)
+#define PL_extralen (PL_curinterp->Textralen)
+#define PL_firstgv (PL_curinterp->Tfirstgv)
+#define PL_formtarget (PL_curinterp->Tformtarget)
+#define PL_hv_fetch_ent_mh (PL_curinterp->Thv_fetch_ent_mh)
+#define PL_hv_fetch_sv (PL_curinterp->Thv_fetch_sv)
+#define PL_in_eval (PL_curinterp->Tin_eval)
+#define PL_last_in_gv (PL_curinterp->Tlast_in_gv)
+#define PL_lastgotoprobe (PL_curinterp->Tlastgotoprobe)
+#define PL_lastscream (PL_curinterp->Tlastscream)
+#define PL_localizing (PL_curinterp->Tlocalizing)
+#define PL_mainstack (PL_curinterp->Tmainstack)
+#define PL_markstack (PL_curinterp->Tmarkstack)
+#define PL_markstack_max (PL_curinterp->Tmarkstack_max)
+#define PL_markstack_ptr (PL_curinterp->Tmarkstack_ptr)
+#define PL_maxscream (PL_curinterp->Tmaxscream)
+#define PL_modcount (PL_curinterp->Tmodcount)
+#define PL_nrs (PL_curinterp->Tnrs)
+#define PL_ofs (PL_curinterp->Tofs)
+#define PL_ofslen (PL_curinterp->Tofslen)
+#define PL_op (PL_curinterp->Top)
+#define PL_opsave (PL_curinterp->Topsave)
+#define PL_reg_eval_set (PL_curinterp->Treg_eval_set)
+#define PL_reg_flags (PL_curinterp->Treg_flags)
+#define PL_reg_start_tmp (PL_curinterp->Treg_start_tmp)
+#define PL_reg_start_tmpl (PL_curinterp->Treg_start_tmpl)
+#define PL_regbol (PL_curinterp->Tregbol)
+#define PL_regcc (PL_curinterp->Tregcc)
+#define PL_regcode (PL_curinterp->Tregcode)
+#define PL_regcomp_parse (PL_curinterp->Tregcomp_parse)
+#define PL_regcomp_rx (PL_curinterp->Tregcomp_rx)
+#define PL_regcompp (PL_curinterp->Tregcompp)
+#define PL_regdata (PL_curinterp->Tregdata)
+#define PL_regdummy (PL_curinterp->Tregdummy)
+#define PL_regendp (PL_curinterp->Tregendp)
+#define PL_regeol (PL_curinterp->Tregeol)
+#define PL_regexecp (PL_curinterp->Tregexecp)
+#define PL_regflags (PL_curinterp->Tregflags)
+#define PL_regindent (PL_curinterp->Tregindent)
+#define PL_reginput (PL_curinterp->Treginput)
+#define PL_reginterp_cnt (PL_curinterp->Treginterp_cnt)
+#define PL_reglastparen (PL_curinterp->Treglastparen)
+#define PL_regnarrate (PL_curinterp->Tregnarrate)
+#define PL_regnaughty (PL_curinterp->Tregnaughty)
+#define PL_regnpar (PL_curinterp->Tregnpar)
+#define PL_regprecomp (PL_curinterp->Tregprecomp)
+#define PL_regprev (PL_curinterp->Tregprev)
+#define PL_regprogram (PL_curinterp->Tregprogram)
+#define PL_regsawback (PL_curinterp->Tregsawback)
+#define PL_regseen (PL_curinterp->Tregseen)
+#define PL_regsize (PL_curinterp->Tregsize)
+#define PL_regstartp (PL_curinterp->Tregstartp)
+#define PL_regtill (PL_curinterp->Tregtill)
+#define PL_regxend (PL_curinterp->Tregxend)
+#define PL_restartop (PL_curinterp->Trestartop)
+#define PL_retstack (PL_curinterp->Tretstack)
+#define PL_retstack_ix (PL_curinterp->Tretstack_ix)
+#define PL_retstack_max (PL_curinterp->Tretstack_max)
+#define PL_rs (PL_curinterp->Trs)
+#define PL_savestack (PL_curinterp->Tsavestack)
+#define PL_savestack_ix (PL_curinterp->Tsavestack_ix)
+#define PL_savestack_max (PL_curinterp->Tsavestack_max)
+#define PL_scopestack (PL_curinterp->Tscopestack)
+#define PL_scopestack_ix (PL_curinterp->Tscopestack_ix)
+#define PL_scopestack_max (PL_curinterp->Tscopestack_max)
+#define PL_screamfirst (PL_curinterp->Tscreamfirst)
+#define PL_screamnext (PL_curinterp->Tscreamnext)
+#define PL_secondgv (PL_curinterp->Tsecondgv)
+#define PL_seen_evals (PL_curinterp->Tseen_evals)
+#define PL_seen_zerolen (PL_curinterp->Tseen_zerolen)
+#define PL_sortcop (PL_curinterp->Tsortcop)
+#define PL_sortcxix (PL_curinterp->Tsortcxix)
+#define PL_sortstash (PL_curinterp->Tsortstash)
+#define PL_stack_base (PL_curinterp->Tstack_base)
+#define PL_stack_max (PL_curinterp->Tstack_max)
+#define PL_stack_sp (PL_curinterp->Tstack_sp)
+#define PL_start_env (PL_curinterp->Tstart_env)
+#define PL_statbuf (PL_curinterp->Tstatbuf)
+#define PL_statcache (PL_curinterp->Tstatcache)
+#define PL_statgv (PL_curinterp->Tstatgv)
+#define PL_statname (PL_curinterp->Tstatname)
+#define PL_tainted (PL_curinterp->Ttainted)
+#define PL_timesbuf (PL_curinterp->Ttimesbuf)
+#define PL_tmps_floor (PL_curinterp->Ttmps_floor)
+#define PL_tmps_ix (PL_curinterp->Ttmps_ix)
+#define PL_tmps_max (PL_curinterp->Ttmps_max)
+#define PL_tmps_stack (PL_curinterp->Ttmps_stack)
+#define PL_top_env (PL_curinterp->Ttop_env)
+#define PL_toptarget (PL_curinterp->Ttoptarget)
+
+#endif /* !USE_THREADS */
+
+/* These are always per-interpreter if there is more than one */
+
+#define PL_Argv (PL_curinterp->IArgv)
+#define PL_Cmd (PL_curinterp->ICmd)
+#define PL_DBcv (PL_curinterp->IDBcv)
+#define PL_DBgv (PL_curinterp->IDBgv)
+#define PL_DBline (PL_curinterp->IDBline)
+#define PL_DBsignal (PL_curinterp->IDBsignal)
+#define PL_DBsingle (PL_curinterp->IDBsingle)
+#define PL_DBsub (PL_curinterp->IDBsub)
+#define PL_DBtrace (PL_curinterp->IDBtrace)
+#define PL_ampergv (PL_curinterp->Iampergv)
+#define PL_archpat_auto (PL_curinterp->Iarchpat_auto)
+#define PL_argvgv (PL_curinterp->Iargvgv)
+#define PL_argvoutgv (PL_curinterp->Iargvoutgv)
+#define PL_basetime (PL_curinterp->Ibasetime)
+#define PL_beginav (PL_curinterp->Ibeginav)
+#define PL_bytecode_iv_overflows (PL_curinterp->Ibytecode_iv_overflows)
+#define PL_bytecode_obj_list (PL_curinterp->Ibytecode_obj_list)
+#define PL_bytecode_obj_list_fill (PL_curinterp->Ibytecode_obj_list_fill)
+#define PL_bytecode_pv (PL_curinterp->Ibytecode_pv)
+#define PL_bytecode_sv (PL_curinterp->Ibytecode_sv)
+#define PL_cddir (PL_curinterp->Icddir)
+#define PL_compcv (PL_curinterp->Icompcv)
+#define PL_compiling (PL_curinterp->Icompiling)
+#define PL_comppad (PL_curinterp->Icomppad)
+#define PL_comppad_name (PL_curinterp->Icomppad_name)
+#define PL_comppad_name_fill (PL_curinterp->Icomppad_name_fill)
+#define PL_comppad_name_floor (PL_curinterp->Icomppad_name_floor)
+#define PL_copline (PL_curinterp->Icopline)
+#define PL_curcopdb (PL_curinterp->Icurcopdb)
+#define PL_curstname (PL_curinterp->Icurstname)
+#define PL_dbargs (PL_curinterp->Idbargs)
+#define PL_debdelim (PL_curinterp->Idebdelim)
+#define PL_debname (PL_curinterp->Idebname)
+#define PL_debstash (PL_curinterp->Idebstash)
+#define PL_defgv (PL_curinterp->Idefgv)
+#define PL_diehook (PL_curinterp->Idiehook)
+#define PL_dlevel (PL_curinterp->Idlevel)
+#define PL_dlmax (PL_curinterp->Idlmax)
+#define PL_doextract (PL_curinterp->Idoextract)
+#define PL_doswitches (PL_curinterp->Idoswitches)
+#define PL_dowarn (PL_curinterp->Idowarn)
+#define PL_dumplvl (PL_curinterp->Idumplvl)
+#define PL_e_script (PL_curinterp->Ie_script)
+#define PL_endav (PL_curinterp->Iendav)
+#define PL_envgv (PL_curinterp->Ienvgv)
+#define PL_errgv (PL_curinterp->Ierrgv)
+#define PL_eval_root (PL_curinterp->Ieval_root)
+#define PL_eval_start (PL_curinterp->Ieval_start)
+#define PL_exitlist (PL_curinterp->Iexitlist)
+#define PL_exitlistlen (PL_curinterp->Iexitlistlen)
+#define PL_fdpid (PL_curinterp->Ifdpid)
+#define PL_filemode (PL_curinterp->Ifilemode)
+#define PL_forkprocess (PL_curinterp->Iforkprocess)
+#define PL_formfeed (PL_curinterp->Iformfeed)
+#define PL_generation (PL_curinterp->Igeneration)
+#define PL_gensym (PL_curinterp->Igensym)
+#define PL_globalstash (PL_curinterp->Iglobalstash)
+#define PL_hintgv (PL_curinterp->Ihintgv)
+#define PL_in_clean_all (PL_curinterp->Iin_clean_all)
+#define PL_in_clean_objs (PL_curinterp->Iin_clean_objs)
+#define PL_incgv (PL_curinterp->Iincgv)
+#define PL_initav (PL_curinterp->Iinitav)
+#define PL_inplace (PL_curinterp->Iinplace)
+#define PL_last_proto (PL_curinterp->Ilast_proto)
+#define PL_lastfd (PL_curinterp->Ilastfd)
+#define PL_lastsize (PL_curinterp->Ilastsize)
+#define PL_lastspbase (PL_curinterp->Ilastspbase)
+#define PL_laststatval (PL_curinterp->Ilaststatval)
+#define PL_laststype (PL_curinterp->Ilaststype)
+#define PL_leftgv (PL_curinterp->Ileftgv)
+#define PL_lineary (PL_curinterp->Ilineary)
+#define PL_linestart (PL_curinterp->Ilinestart)
+#define PL_localpatches (PL_curinterp->Ilocalpatches)
+#define PL_main_cv (PL_curinterp->Imain_cv)
+#define PL_main_root (PL_curinterp->Imain_root)
+#define PL_main_start (PL_curinterp->Imain_start)
+#define PL_maxsysfd (PL_curinterp->Imaxsysfd)
+#define PL_mess_sv (PL_curinterp->Imess_sv)
+#define PL_minus_F (PL_curinterp->Iminus_F)
+#define PL_minus_a (PL_curinterp->Iminus_a)
+#define PL_minus_c (PL_curinterp->Iminus_c)
+#define PL_minus_l (PL_curinterp->Iminus_l)
+#define PL_minus_n (PL_curinterp->Iminus_n)
+#define PL_minus_p (PL_curinterp->Iminus_p)
+#define PL_modglobal (PL_curinterp->Imodglobal)
+#define PL_multiline (PL_curinterp->Imultiline)
+#define PL_mystrk (PL_curinterp->Imystrk)
+#define PL_ofmt (PL_curinterp->Iofmt)
+#define PL_oldlastpm (PL_curinterp->Ioldlastpm)
+#define PL_oldname (PL_curinterp->Ioldname)
+#define PL_op_mask (PL_curinterp->Iop_mask)
+#define PL_origargc (PL_curinterp->Iorigargc)
+#define PL_origargv (PL_curinterp->Iorigargv)
+#define PL_origfilename (PL_curinterp->Iorigfilename)
+#define PL_ors (PL_curinterp->Iors)
+#define PL_orslen (PL_curinterp->Iorslen)
+#define PL_parsehook (PL_curinterp->Iparsehook)
+#define PL_patchlevel (PL_curinterp->Ipatchlevel)
+#define PL_pending_ident (PL_curinterp->Ipending_ident)
+#define PL_perl_destruct_level (PL_curinterp->Iperl_destruct_level)
+#define PL_perldb (PL_curinterp->Iperldb)
+#define PL_preambleav (PL_curinterp->Ipreambleav)
+#define PL_preambled (PL_curinterp->Ipreambled)
+#define PL_preprocess (PL_curinterp->Ipreprocess)
+#define PL_profiledata (PL_curinterp->Iprofiledata)
+#define PL_replgv (PL_curinterp->Ireplgv)
+#define PL_rightgv (PL_curinterp->Irightgv)
+#define PL_rsfp (PL_curinterp->Irsfp)
+#define PL_rsfp_filters (PL_curinterp->Irsfp_filters)
+#define PL_sawampersand (PL_curinterp->Isawampersand)
+#define PL_sawstudy (PL_curinterp->Isawstudy)
+#define PL_sawvec (PL_curinterp->Isawvec)
+#define PL_siggv (PL_curinterp->Isiggv)
+#define PL_splitstr (PL_curinterp->Isplitstr)
+#define PL_statusvalue (PL_curinterp->Istatusvalue)
+#define PL_statusvalue_vms (PL_curinterp->Istatusvalue_vms)
+#define PL_stdingv (PL_curinterp->Istdingv)
+#define PL_strchop (PL_curinterp->Istrchop)
+#define PL_strtab (PL_curinterp->Istrtab)
+#define PL_strtab_mutex (PL_curinterp->Istrtab_mutex)
+#define PL_sub_generation (PL_curinterp->Isub_generation)
+#define PL_sublex_info (PL_curinterp->Isublex_info)
+#define PL_sv_arenaroot (PL_curinterp->Isv_arenaroot)
+#define PL_sv_count (PL_curinterp->Isv_count)
+#define PL_sv_objcount (PL_curinterp->Isv_objcount)
+#define PL_sv_root (PL_curinterp->Isv_root)
+#define PL_sys_intern (PL_curinterp->Isys_intern)
+#define PL_tainting (PL_curinterp->Itainting)
+#define PL_threadnum (PL_curinterp->Ithreadnum)
+#define PL_thrsv (PL_curinterp->Ithrsv)
+#define PL_unsafe (PL_curinterp->Iunsafe)
+#define PL_warnhook (PL_curinterp->Iwarnhook)
+
+#else /* !MULTIPLICITY */
+
+#define PL_IArgv PL_Argv
+#define PL_ICmd PL_Cmd
+#define PL_IDBcv PL_DBcv
+#define PL_IDBgv PL_DBgv
+#define PL_IDBline PL_DBline
+#define PL_IDBsignal PL_DBsignal
+#define PL_IDBsingle PL_DBsingle
+#define PL_IDBsub PL_DBsub
+#define PL_IDBtrace PL_DBtrace
+#define PL_Iampergv PL_ampergv
+#define PL_Iarchpat_auto PL_archpat_auto
+#define PL_Iargvgv PL_argvgv
+#define PL_Iargvoutgv PL_argvoutgv
+#define PL_Ibasetime PL_basetime
+#define PL_Ibeginav PL_beginav
+#define PL_Ibytecode_iv_overflows PL_bytecode_iv_overflows
+#define PL_Ibytecode_obj_list PL_bytecode_obj_list
+#define PL_Ibytecode_obj_list_fill PL_bytecode_obj_list_fill
+#define PL_Ibytecode_pv PL_bytecode_pv
+#define PL_Ibytecode_sv PL_bytecode_sv
+#define PL_Icddir PL_cddir
+#define PL_Icompcv PL_compcv
+#define PL_Icompiling PL_compiling
+#define PL_Icomppad PL_comppad
+#define PL_Icomppad_name PL_comppad_name
+#define PL_Icomppad_name_fill PL_comppad_name_fill
+#define PL_Icomppad_name_floor PL_comppad_name_floor
+#define PL_Icopline PL_copline
+#define PL_Icurcopdb PL_curcopdb
+#define PL_Icurstname PL_curstname
+#define PL_Idbargs PL_dbargs
+#define PL_Idebdelim PL_debdelim
+#define PL_Idebname PL_debname
+#define PL_Idebstash PL_debstash
+#define PL_Idefgv PL_defgv
+#define PL_Idiehook PL_diehook
+#define PL_Idlevel PL_dlevel
+#define PL_Idlmax PL_dlmax
+#define PL_Idoextract PL_doextract
+#define PL_Idoswitches PL_doswitches
+#define PL_Idowarn PL_dowarn
+#define PL_Idumplvl PL_dumplvl
+#define PL_Ie_script PL_e_script
+#define PL_Iendav PL_endav
+#define PL_Ienvgv PL_envgv
+#define PL_Ierrgv PL_errgv
+#define PL_Ieval_root PL_eval_root
+#define PL_Ieval_start PL_eval_start
+#define PL_Iexitlist PL_exitlist
+#define PL_Iexitlistlen PL_exitlistlen
+#define PL_Ifdpid PL_fdpid
+#define PL_Ifilemode PL_filemode
+#define PL_Iforkprocess PL_forkprocess
+#define PL_Iformfeed PL_formfeed
+#define PL_Igeneration PL_generation
+#define PL_Igensym PL_gensym
+#define PL_Iglobalstash PL_globalstash
+#define PL_Ihintgv PL_hintgv
+#define PL_Iin_clean_all PL_in_clean_all
+#define PL_Iin_clean_objs PL_in_clean_objs
+#define PL_Iincgv PL_incgv
+#define PL_Iinitav PL_initav
+#define PL_Iinplace PL_inplace
+#define PL_Ilast_proto PL_last_proto
+#define PL_Ilastfd PL_lastfd
+#define PL_Ilastsize PL_lastsize
+#define PL_Ilastspbase PL_lastspbase
+#define PL_Ilaststatval PL_laststatval
+#define PL_Ilaststype PL_laststype
+#define PL_Ileftgv PL_leftgv
+#define PL_Ilineary PL_lineary
+#define PL_Ilinestart PL_linestart
+#define PL_Ilocalpatches PL_localpatches
+#define PL_Imain_cv PL_main_cv
+#define PL_Imain_root PL_main_root
+#define PL_Imain_start PL_main_start
+#define PL_Imaxsysfd PL_maxsysfd
+#define PL_Imess_sv PL_mess_sv
+#define PL_Iminus_F PL_minus_F
+#define PL_Iminus_a PL_minus_a
+#define PL_Iminus_c PL_minus_c
+#define PL_Iminus_l PL_minus_l
+#define PL_Iminus_n PL_minus_n
+#define PL_Iminus_p PL_minus_p
+#define PL_Imodglobal PL_modglobal
+#define PL_Imultiline PL_multiline
+#define PL_Imystrk PL_mystrk
+#define PL_Iofmt PL_ofmt
+#define PL_Ioldlastpm PL_oldlastpm
+#define PL_Ioldname PL_oldname
+#define PL_Iop_mask PL_op_mask
+#define PL_Iorigargc PL_origargc
+#define PL_Iorigargv PL_origargv
+#define PL_Iorigfilename PL_origfilename
+#define PL_Iors PL_ors
+#define PL_Iorslen PL_orslen
+#define PL_Iparsehook PL_parsehook
+#define PL_Ipatchlevel PL_patchlevel
+#define PL_Ipending_ident PL_pending_ident
+#define PL_Iperl_destruct_level PL_perl_destruct_level
+#define PL_Iperldb PL_perldb
+#define PL_Ipreambleav PL_preambleav
+#define PL_Ipreambled PL_preambled
+#define PL_Ipreprocess PL_preprocess
+#define PL_Iprofiledata PL_profiledata
+#define PL_Ireplgv PL_replgv
+#define PL_Irightgv PL_rightgv
+#define PL_Irsfp PL_rsfp
+#define PL_Irsfp_filters PL_rsfp_filters
+#define PL_Isawampersand PL_sawampersand
+#define PL_Isawstudy PL_sawstudy
+#define PL_Isawvec PL_sawvec
+#define PL_Isiggv PL_siggv
+#define PL_Isplitstr PL_splitstr
+#define PL_Istatusvalue PL_statusvalue
+#define PL_Istatusvalue_vms PL_statusvalue_vms
+#define PL_Istdingv PL_stdingv
+#define PL_Istrchop PL_strchop
+#define PL_Istrtab PL_strtab
+#define PL_Istrtab_mutex PL_strtab_mutex
+#define PL_Isub_generation PL_sub_generation
+#define PL_Isublex_info PL_sublex_info
+#define PL_Isv_arenaroot PL_sv_arenaroot
+#define PL_Isv_count PL_sv_count
+#define PL_Isv_objcount PL_sv_objcount
+#define PL_Isv_root PL_sv_root
+#define PL_Isys_intern PL_sys_intern
+#define PL_Itainting PL_tainting
+#define PL_Ithreadnum PL_threadnum
+#define PL_Ithrsv PL_thrsv
+#define PL_Iunsafe PL_unsafe
+#define PL_Iwarnhook PL_warnhook
+
+#ifndef USE_THREADS
+
+#define PL_TSv PL_Sv
+#define PL_TXpv PL_Xpv
+#define PL_Tav_fetch_sv PL_av_fetch_sv
+#define PL_Tbodytarget PL_bodytarget
+#define PL_Tbostr PL_bostr
+#define PL_Tchopset PL_chopset
+#define PL_Tcolors PL_colors
+#define PL_Tcolorset PL_colorset
+#define PL_Tcurcop PL_curcop
+#define PL_Tcurpad PL_curpad
+#define PL_Tcurpm PL_curpm
+#define PL_Tcurstack PL_curstack
+#define PL_Tcurstackinfo PL_curstackinfo
+#define PL_Tcurstash PL_curstash
+#define PL_Tdefoutgv PL_defoutgv
+#define PL_Tdefstash PL_defstash
+#define PL_Tdelaymagic PL_delaymagic
+#define PL_Tdirty PL_dirty
+#define PL_Textralen PL_extralen
+#define PL_Tfirstgv PL_firstgv
+#define PL_Tformtarget PL_formtarget
+#define PL_Thv_fetch_ent_mh PL_hv_fetch_ent_mh
+#define PL_Thv_fetch_sv PL_hv_fetch_sv
+#define PL_Tin_eval PL_in_eval
+#define PL_Tlast_in_gv PL_last_in_gv
+#define PL_Tlastgotoprobe PL_lastgotoprobe
+#define PL_Tlastscream PL_lastscream
+#define PL_Tlocalizing PL_localizing
+#define PL_Tmainstack PL_mainstack
+#define PL_Tmarkstack PL_markstack
+#define PL_Tmarkstack_max PL_markstack_max
+#define PL_Tmarkstack_ptr PL_markstack_ptr
+#define PL_Tmaxscream PL_maxscream
+#define PL_Tmodcount PL_modcount
+#define PL_Tnrs PL_nrs
+#define PL_Tofs PL_ofs
+#define PL_Tofslen PL_ofslen
+#define PL_Top PL_op
+#define PL_Topsave PL_opsave
+#define PL_Treg_eval_set PL_reg_eval_set
+#define PL_Treg_flags PL_reg_flags
+#define PL_Treg_start_tmp PL_reg_start_tmp
+#define PL_Treg_start_tmpl PL_reg_start_tmpl
+#define PL_Tregbol PL_regbol
+#define PL_Tregcc PL_regcc
+#define PL_Tregcode PL_regcode
+#define PL_Tregcomp_parse PL_regcomp_parse
+#define PL_Tregcomp_rx PL_regcomp_rx
+#define PL_Tregcompp PL_regcompp
+#define PL_Tregdata PL_regdata
+#define PL_Tregdummy PL_regdummy
+#define PL_Tregendp PL_regendp
+#define PL_Tregeol PL_regeol
+#define PL_Tregexecp PL_regexecp
+#define PL_Tregflags PL_regflags
+#define PL_Tregindent PL_regindent
+#define PL_Treginput PL_reginput
+#define PL_Treginterp_cnt PL_reginterp_cnt
+#define PL_Treglastparen PL_reglastparen
+#define PL_Tregnarrate PL_regnarrate
+#define PL_Tregnaughty PL_regnaughty
+#define PL_Tregnpar PL_regnpar
+#define PL_Tregprecomp PL_regprecomp
+#define PL_Tregprev PL_regprev
+#define PL_Tregprogram PL_regprogram
+#define PL_Tregsawback PL_regsawback
+#define PL_Tregseen PL_regseen
+#define PL_Tregsize PL_regsize
+#define PL_Tregstartp PL_regstartp
+#define PL_Tregtill PL_regtill
+#define PL_Tregxend PL_regxend
+#define PL_Trestartop PL_restartop
+#define PL_Tretstack PL_retstack
+#define PL_Tretstack_ix PL_retstack_ix
+#define PL_Tretstack_max PL_retstack_max
+#define PL_Trs PL_rs
+#define PL_Tsavestack PL_savestack
+#define PL_Tsavestack_ix PL_savestack_ix
+#define PL_Tsavestack_max PL_savestack_max
+#define PL_Tscopestack PL_scopestack
+#define PL_Tscopestack_ix PL_scopestack_ix
+#define PL_Tscopestack_max PL_scopestack_max
+#define PL_Tscreamfirst PL_screamfirst
+#define PL_Tscreamnext PL_screamnext
+#define PL_Tsecondgv PL_secondgv
+#define PL_Tseen_evals PL_seen_evals
+#define PL_Tseen_zerolen PL_seen_zerolen
+#define PL_Tsortcop PL_sortcop
+#define PL_Tsortcxix PL_sortcxix
+#define PL_Tsortstash PL_sortstash
+#define PL_Tstack_base PL_stack_base
+#define PL_Tstack_max PL_stack_max
+#define PL_Tstack_sp PL_stack_sp
+#define PL_Tstart_env PL_start_env
+#define PL_Tstatbuf PL_statbuf
+#define PL_Tstatcache PL_statcache
+#define PL_Tstatgv PL_statgv
+#define PL_Tstatname PL_statname
+#define PL_Ttainted PL_tainted
+#define PL_Ttimesbuf PL_timesbuf
+#define PL_Ttmps_floor PL_tmps_floor
+#define PL_Ttmps_ix PL_tmps_ix
+#define PL_Ttmps_max PL_tmps_max
+#define PL_Ttmps_stack PL_tmps_stack
+#define PL_Ttop_env PL_top_env
+#define PL_Ttoptarget PL_toptarget
+
+#endif /* USE_THREADS */
+
+/* Hide what would have been interpreter-specific symbols? */
+
+#ifdef EMBED
-#if defined(MULTIPLICITY)
-/* cases 2 and 3 above */
-
-# if defined(PERL_IMPLICIT_CONTEXT)
-# define vTHX aTHX
-# else
-# define vTHX PERL_GET_INTERP
-# endif
-
-#define PL_AboveLatin1 (vTHX->IAboveLatin1)
-#define PL_Argv (vTHX->IArgv)
-#define PL_Cmd (vTHX->ICmd)
-#define PL_DBcv (vTHX->IDBcv)
-#define PL_DBgv (vTHX->IDBgv)
-#define PL_DBline (vTHX->IDBline)
-#define PL_DBsignal (vTHX->IDBsignal)
-#define PL_DBsingle (vTHX->IDBsingle)
-#define PL_DBsub (vTHX->IDBsub)
-#define PL_DBtrace (vTHX->IDBtrace)
-#define PL_Dir (vTHX->IDir)
-#define PL_Env (vTHX->IEnv)
-#define PL_HasMultiCharFold (vTHX->IHasMultiCharFold)
-#define PL_LIO (vTHX->ILIO)
-#define PL_Latin1 (vTHX->ILatin1)
-#define PL_Mem (vTHX->IMem)
-#define PL_MemParse (vTHX->IMemParse)
-#define PL_MemShared (vTHX->IMemShared)
-#define PL_NonL1NonFinalFold (vTHX->INonL1NonFinalFold)
-#define PL_Posix_ptrs (vTHX->IPosix_ptrs)
-#define PL_Proc (vTHX->IProc)
-#define PL_Sock (vTHX->ISock)
-#define PL_StdIO (vTHX->IStdIO)
-#define PL_Sv (vTHX->ISv)
-#define PL_UpperLatin1 (vTHX->IUpperLatin1)
-#define PL_XPosix_ptrs (vTHX->IXPosix_ptrs)
-#define PL_Xpv (vTHX->IXpv)
-#define PL_an (vTHX->Ian)
-#define PL_apiversion (vTHX->Iapiversion)
-#define PL_argvgv (vTHX->Iargvgv)
-#define PL_argvout_stack (vTHX->Iargvout_stack)
-#define PL_argvoutgv (vTHX->Iargvoutgv)
-#define PL_basetime (vTHX->Ibasetime)
-#define PL_beginav (vTHX->Ibeginav)
-#define PL_beginav_save (vTHX->Ibeginav_save)
-#define PL_blockhooks (vTHX->Iblockhooks)
-#define PL_body_arenas (vTHX->Ibody_arenas)
-#define PL_body_roots (vTHX->Ibody_roots)
-#define PL_bodytarget (vTHX->Ibodytarget)
-#define PL_breakable_sub_gen (vTHX->Ibreakable_sub_gen)
-#define PL_checkav (vTHX->Icheckav)
-#define PL_checkav_save (vTHX->Icheckav_save)
-#define PL_chopset (vTHX->Ichopset)
-#define PL_clocktick (vTHX->Iclocktick)
-#define PL_collation_ix (vTHX->Icollation_ix)
-#define PL_collation_name (vTHX->Icollation_name)
-#define PL_collation_standard (vTHX->Icollation_standard)
-#define PL_collxfrm_base (vTHX->Icollxfrm_base)
-#define PL_collxfrm_mult (vTHX->Icollxfrm_mult)
-#define PL_colors (vTHX->Icolors)
-#define PL_colorset (vTHX->Icolorset)
-#define PL_compcv (vTHX->Icompcv)
-#define PL_compiling (vTHX->Icompiling)
-#define PL_comppad (vTHX->Icomppad)
-#define PL_comppad_name (vTHX->Icomppad_name)
-#define PL_comppad_name_fill (vTHX->Icomppad_name_fill)
-#define PL_comppad_name_floor (vTHX->Icomppad_name_floor)
-#define PL_cop_seqmax (vTHX->Icop_seqmax)
-#define PL_cryptseen (vTHX->Icryptseen)
-#define PL_curcop (vTHX->Icurcop)
-#define PL_curcopdb (vTHX->Icurcopdb)
-#define PL_curpad (vTHX->Icurpad)
-#define PL_curpm (vTHX->Icurpm)
-#define PL_curstack (vTHX->Icurstack)
-#define PL_curstackinfo (vTHX->Icurstackinfo)
-#define PL_curstash (vTHX->Icurstash)
-#define PL_curstname (vTHX->Icurstname)
-#define PL_custom_op_descs (vTHX->Icustom_op_descs)
-#define PL_custom_op_names (vTHX->Icustom_op_names)
-#define PL_custom_ops (vTHX->Icustom_ops)
-#define PL_cv_has_eval (vTHX->Icv_has_eval)
-#define PL_dbargs (vTHX->Idbargs)
-#define PL_debstash (vTHX->Idebstash)
-#define PL_debug (vTHX->Idebug)
-#define PL_debug_pad (vTHX->Idebug_pad)
-#define PL_def_layerlist (vTHX->Idef_layerlist)
-#define PL_defgv (vTHX->Idefgv)
-#define PL_defoutgv (vTHX->Idefoutgv)
-#define PL_defstash (vTHX->Idefstash)
-#define PL_delaymagic (vTHX->Idelaymagic)
-#define PL_delaymagic_egid (vTHX->Idelaymagic_egid)
-#define PL_delaymagic_euid (vTHX->Idelaymagic_euid)
-#define PL_delaymagic_gid (vTHX->Idelaymagic_gid)
-#define PL_delaymagic_uid (vTHX->Idelaymagic_uid)
-#define PL_destroyhook (vTHX->Idestroyhook)
-#define PL_diehook (vTHX->Idiehook)
-#define PL_doswitches (vTHX->Idoswitches)
-#define PL_dowarn (vTHX->Idowarn)
-#define PL_dumper_fd (vTHX->Idumper_fd)
-#define PL_dumpindent (vTHX->Idumpindent)
-#define PL_e_script (vTHX->Ie_script)
-#define PL_efloatbuf (vTHX->Iefloatbuf)
-#define PL_efloatsize (vTHX->Iefloatsize)
-#define PL_encoding (vTHX->Iencoding)
-#define PL_endav (vTHX->Iendav)
-#define PL_envgv (vTHX->Ienvgv)
-#define PL_errgv (vTHX->Ierrgv)
-#define PL_errors (vTHX->Ierrors)
-#define PL_eval_root (vTHX->Ieval_root)
-#define PL_eval_start (vTHX->Ieval_start)
-#define PL_evalseq (vTHX->Ievalseq)
-#define PL_exit_flags (vTHX->Iexit_flags)
-#define PL_exitlist (vTHX->Iexitlist)
-#define PL_exitlistlen (vTHX->Iexitlistlen)
-#define PL_fdpid (vTHX->Ifdpid)
-#define PL_filemode (vTHX->Ifilemode)
-#define PL_firstgv (vTHX->Ifirstgv)
-#define PL_forkprocess (vTHX->Iforkprocess)
-#define PL_formtarget (vTHX->Iformtarget)
-#define PL_generation (vTHX->Igeneration)
-#define PL_gensym (vTHX->Igensym)
-#define PL_globalstash (vTHX->Iglobalstash)
-#define PL_globhook (vTHX->Iglobhook)
-#define PL_hash_rand_bits (vTHX->Ihash_rand_bits)
-#define PL_hash_rand_bits_enabled (vTHX->Ihash_rand_bits_enabled)
-#define PL_hintgv (vTHX->Ihintgv)
-#define PL_hv_fetch_ent_mh (vTHX->Ihv_fetch_ent_mh)
-#define PL_in_clean_all (vTHX->Iin_clean_all)
-#define PL_in_clean_objs (vTHX->Iin_clean_objs)
-#define PL_in_eval (vTHX->Iin_eval)
-#define PL_in_load_module (vTHX->Iin_load_module)
-#define PL_in_utf8_CTYPE_locale (vTHX->Iin_utf8_CTYPE_locale)
-#define PL_incgv (vTHX->Iincgv)
-#define PL_initav (vTHX->Iinitav)
-#define PL_inplace (vTHX->Iinplace)
-#define PL_isarev (vTHX->Iisarev)
-#define PL_known_layers (vTHX->Iknown_layers)
-#define PL_last_in_gv (vTHX->Ilast_in_gv)
-#define PL_last_swash_hv (vTHX->Ilast_swash_hv)
-#define PL_last_swash_key (vTHX->Ilast_swash_key)
-#define PL_last_swash_klen (vTHX->Ilast_swash_klen)
-#define PL_last_swash_slen (vTHX->Ilast_swash_slen)
-#define PL_last_swash_tmps (vTHX->Ilast_swash_tmps)
-#define PL_lastfd (vTHX->Ilastfd)
-#define PL_lastgotoprobe (vTHX->Ilastgotoprobe)
-#define PL_laststatval (vTHX->Ilaststatval)
-#define PL_laststype (vTHX->Ilaststype)
-#define PL_localizing (vTHX->Ilocalizing)
-#define PL_localpatches (vTHX->Ilocalpatches)
-#define PL_lockhook (vTHX->Ilockhook)
-#define PL_madskills (vTHX->Imadskills)
-#define PL_main_cv (vTHX->Imain_cv)
-#define PL_main_root (vTHX->Imain_root)
-#define PL_main_start (vTHX->Imain_start)
-#define PL_mainstack (vTHX->Imainstack)
-#define PL_markstack (vTHX->Imarkstack)
-#define PL_markstack_max (vTHX->Imarkstack_max)
-#define PL_markstack_ptr (vTHX->Imarkstack_ptr)
-#define PL_max_intro_pending (vTHX->Imax_intro_pending)
-#define PL_maxo (vTHX->Imaxo)
-#define PL_maxsysfd (vTHX->Imaxsysfd)
-#define PL_memory_debug_header (vTHX->Imemory_debug_header)
-#define PL_mess_sv (vTHX->Imess_sv)
-#define PL_min_intro_pending (vTHX->Imin_intro_pending)
-#define PL_minus_E (vTHX->Iminus_E)
-#define PL_minus_F (vTHX->Iminus_F)
-#define PL_minus_a (vTHX->Iminus_a)
-#define PL_minus_c (vTHX->Iminus_c)
-#define PL_minus_l (vTHX->Iminus_l)
-#define PL_minus_n (vTHX->Iminus_n)
-#define PL_minus_p (vTHX->Iminus_p)
-#define PL_modcount (vTHX->Imodcount)
-#define PL_modglobal (vTHX->Imodglobal)
-#define PL_my_cxt_keys (vTHX->Imy_cxt_keys)
-#define PL_my_cxt_list (vTHX->Imy_cxt_list)
-#define PL_my_cxt_size (vTHX->Imy_cxt_size)
-#define PL_na (vTHX->Ina)
-#define PL_nomemok (vTHX->Inomemok)
-#define PL_numeric_local (vTHX->Inumeric_local)
-#define PL_numeric_name (vTHX->Inumeric_name)
-#define PL_numeric_radix_sv (vTHX->Inumeric_radix_sv)
-#define PL_numeric_standard (vTHX->Inumeric_standard)
-#define PL_ofsgv (vTHX->Iofsgv)
-#define PL_oldname (vTHX->Ioldname)
-#define PL_op (vTHX->Iop)
-#define PL_op_exec_cnt (vTHX->Iop_exec_cnt)
-#define PL_op_mask (vTHX->Iop_mask)
-#define PL_opfreehook (vTHX->Iopfreehook)
-#define PL_origalen (vTHX->Iorigalen)
-#define PL_origargc (vTHX->Iorigargc)
-#define PL_origargv (vTHX->Iorigargv)
-#define PL_origenviron (vTHX->Iorigenviron)
-#define PL_origfilename (vTHX->Iorigfilename)
-#define PL_ors_sv (vTHX->Iors_sv)
-#define PL_osname (vTHX->Iosname)
-#define PL_pad_reset_pending (vTHX->Ipad_reset_pending)
-#define PL_padix (vTHX->Ipadix)
-#define PL_padix_floor (vTHX->Ipadix_floor)
-#define PL_parser (vTHX->Iparser)
-#define PL_patchlevel (vTHX->Ipatchlevel)
-#define PL_peepp (vTHX->Ipeepp)
-#define PL_perl_destruct_level (vTHX->Iperl_destruct_level)
-#define PL_perldb (vTHX->Iperldb)
-#define PL_perlio (vTHX->Iperlio)
-#define PL_phase (vTHX->Iphase)
-#define PL_pidstatus (vTHX->Ipidstatus)
-#define PL_preambleav (vTHX->Ipreambleav)
-#define PL_profiledata (vTHX->Iprofiledata)
-#define PL_psig_name (vTHX->Ipsig_name)
-#define PL_psig_pend (vTHX->Ipsig_pend)
-#define PL_psig_ptr (vTHX->Ipsig_ptr)
-#define PL_ptr_table (vTHX->Iptr_table)
-#define PL_random_state (vTHX->Irandom_state)
-#define PL_reentrant_buffer (vTHX->Ireentrant_buffer)
-#define PL_reentrant_retint (vTHX->Ireentrant_retint)
-#define PL_reg_curpm (vTHX->Ireg_curpm)
-#define PL_regex_pad (vTHX->Iregex_pad)
-#define PL_regex_padav (vTHX->Iregex_padav)
-#define PL_registered_mros (vTHX->Iregistered_mros)
-#define PL_regmatch_slab (vTHX->Iregmatch_slab)
-#define PL_regmatch_state (vTHX->Iregmatch_state)
-#define PL_replgv (vTHX->Ireplgv)
-#define PL_restartjmpenv (vTHX->Irestartjmpenv)
-#define PL_restartop (vTHX->Irestartop)
-#define PL_rpeepp (vTHX->Irpeepp)
-#define PL_rs (vTHX->Irs)
-#define PL_runops (vTHX->Irunops)
-#define PL_savebegin (vTHX->Isavebegin)
-#define PL_savestack (vTHX->Isavestack)
-#define PL_savestack_ix (vTHX->Isavestack_ix)
-#define PL_savestack_max (vTHX->Isavestack_max)
-#ifndef PL_sawampersand
-#define PL_sawampersand (vTHX->Isawampersand)
-#endif
-#define PL_scopestack (vTHX->Iscopestack)
-#define PL_scopestack_ix (vTHX->Iscopestack_ix)
-#define PL_scopestack_max (vTHX->Iscopestack_max)
-#define PL_scopestack_name (vTHX->Iscopestack_name)
-#define PL_secondgv (vTHX->Isecondgv)
-#define PL_sharehook (vTHX->Isharehook)
-#define PL_sig_pending (vTHX->Isig_pending)
-#define PL_sighandlerp (vTHX->Isighandlerp)
-#define PL_signalhook (vTHX->Isignalhook)
-#define PL_signals (vTHX->Isignals)
-#define PL_sort_RealCmp (vTHX->Isort_RealCmp)
-#define PL_sortcop (vTHX->Isortcop)
-#define PL_sortstash (vTHX->Isortstash)
-#define PL_splitstr (vTHX->Isplitstr)
-#define PL_srand_called (vTHX->Isrand_called)
-#define PL_stack_base (vTHX->Istack_base)
-#define PL_stack_max (vTHX->Istack_max)
-#define PL_stack_sp (vTHX->Istack_sp)
-#define PL_start_env (vTHX->Istart_env)
-#define PL_stashcache (vTHX->Istashcache)
-#define PL_stashpad (vTHX->Istashpad)
-#define PL_stashpadix (vTHX->Istashpadix)
-#define PL_stashpadmax (vTHX->Istashpadmax)
-#define PL_statbuf (vTHX->Istatbuf)
-#define PL_statcache (vTHX->Istatcache)
-#define PL_statgv (vTHX->Istatgv)
-#define PL_statname (vTHX->Istatname)
-#define PL_statusvalue (vTHX->Istatusvalue)
-#define PL_statusvalue_posix (vTHX->Istatusvalue_posix)
-#define PL_statusvalue_vms (vTHX->Istatusvalue_vms)
-#define PL_stderrgv (vTHX->Istderrgv)
-#define PL_stdingv (vTHX->Istdingv)
-#define PL_strtab (vTHX->Istrtab)
-#define PL_sub_generation (vTHX->Isub_generation)
-#define PL_subline (vTHX->Isubline)
-#define PL_subname (vTHX->Isubname)
-#define PL_sv_arenaroot (vTHX->Isv_arenaroot)
-#define PL_sv_consts (vTHX->Isv_consts)
-#define PL_sv_count (vTHX->Isv_count)
-#define PL_sv_no (vTHX->Isv_no)
-#define PL_sv_objcount (vTHX->Isv_objcount)
-#define PL_sv_root (vTHX->Isv_root)
-#define PL_sv_serial (vTHX->Isv_serial)
-#define PL_sv_undef (vTHX->Isv_undef)
-#define PL_sv_yes (vTHX->Isv_yes)
-#define PL_sys_intern (vTHX->Isys_intern)
-#define PL_taint_warn (vTHX->Itaint_warn)
-#define PL_tainted (vTHX->Itainted)
-#define PL_tainting (vTHX->Itainting)
-#define PL_threadhook (vTHX->Ithreadhook)
-#define PL_timesbuf (vTHX->Itimesbuf)
-#define PL_tmps_floor (vTHX->Itmps_floor)
-#define PL_tmps_ix (vTHX->Itmps_ix)
-#define PL_tmps_max (vTHX->Itmps_max)
-#define PL_tmps_stack (vTHX->Itmps_stack)
-#define PL_top_env (vTHX->Itop_env)
-#define PL_toptarget (vTHX->Itoptarget)
-#define PL_unicode (vTHX->Iunicode)
-#define PL_unitcheckav (vTHX->Iunitcheckav)
-#define PL_unitcheckav_save (vTHX->Iunitcheckav_save)
-#define PL_unlockhook (vTHX->Iunlockhook)
-#define PL_unsafe (vTHX->Iunsafe)
-#define PL_utf8_X_extend (vTHX->Iutf8_X_extend)
-#define PL_utf8_X_regular_begin (vTHX->Iutf8_X_regular_begin)
-#define PL_utf8_charname_begin (vTHX->Iutf8_charname_begin)
-#define PL_utf8_charname_continue (vTHX->Iutf8_charname_continue)
-#define PL_utf8_foldable (vTHX->Iutf8_foldable)
-#define PL_utf8_foldclosures (vTHX->Iutf8_foldclosures)
-#define PL_utf8_idcont (vTHX->Iutf8_idcont)
-#define PL_utf8_idstart (vTHX->Iutf8_idstart)
-#define PL_utf8_mark (vTHX->Iutf8_mark)
-#define PL_utf8_perl_idcont (vTHX->Iutf8_perl_idcont)
-#define PL_utf8_perl_idstart (vTHX->Iutf8_perl_idstart)
-#define PL_utf8_swash_ptrs (vTHX->Iutf8_swash_ptrs)
-#define PL_utf8_tofold (vTHX->Iutf8_tofold)
-#define PL_utf8_tolower (vTHX->Iutf8_tolower)
-#define PL_utf8_totitle (vTHX->Iutf8_totitle)
-#define PL_utf8_toupper (vTHX->Iutf8_toupper)
-#define PL_utf8_xidcont (vTHX->Iutf8_xidcont)
-#define PL_utf8_xidstart (vTHX->Iutf8_xidstart)
-#define PL_utf8cache (vTHX->Iutf8cache)
-#define PL_utf8locale (vTHX->Iutf8locale)
-#define PL_warnhook (vTHX->Iwarnhook)
-#define PL_watchaddr (vTHX->Iwatchaddr)
-#define PL_watchok (vTHX->Iwatchok)
-#define PL_xmlfp (vTHX->Ixmlfp)
-
-#endif /* MULTIPLICITY */
-
-#if defined(PERL_GLOBAL_STRUCT)
-
-#define PL_appctx (my_vars->Gappctx)
-#define PL_Gappctx (my_vars->Gappctx)
-#define PL_check (my_vars->Gcheck)
-#define PL_Gcheck (my_vars->Gcheck)
-#define PL_check_mutex (my_vars->Gcheck_mutex)
-#define PL_Gcheck_mutex (my_vars->Gcheck_mutex)
-#define PL_csighandlerp (my_vars->Gcsighandlerp)
-#define PL_Gcsighandlerp (my_vars->Gcsighandlerp)
-#define PL_curinterp (my_vars->Gcurinterp)
-#define PL_Gcurinterp (my_vars->Gcurinterp)
-#define PL_do_undump (my_vars->Gdo_undump)
-#define PL_Gdo_undump (my_vars->Gdo_undump)
-#define PL_dollarzero_mutex (my_vars->Gdollarzero_mutex)
-#define PL_Gdollarzero_mutex (my_vars->Gdollarzero_mutex)
-#define PL_fold_locale (my_vars->Gfold_locale)
-#define PL_Gfold_locale (my_vars->Gfold_locale)
-#define PL_hash_seed (my_vars->Ghash_seed)
-#define PL_Ghash_seed (my_vars->Ghash_seed)
-#define PL_hash_seed_set (my_vars->Ghash_seed_set)
-#define PL_Ghash_seed_set (my_vars->Ghash_seed_set)
-#define PL_hints_mutex (my_vars->Ghints_mutex)
-#define PL_Ghints_mutex (my_vars->Ghints_mutex)
-#define PL_keyword_plugin (my_vars->Gkeyword_plugin)
-#define PL_Gkeyword_plugin (my_vars->Gkeyword_plugin)
-#define PL_malloc_mutex (my_vars->Gmalloc_mutex)
-#define PL_Gmalloc_mutex (my_vars->Gmalloc_mutex)
-#define PL_mmap_page_size (my_vars->Gmmap_page_size)
-#define PL_Gmmap_page_size (my_vars->Gmmap_page_size)
-#define PL_my_ctx_mutex (my_vars->Gmy_ctx_mutex)
-#define PL_Gmy_ctx_mutex (my_vars->Gmy_ctx_mutex)
-#define PL_my_cxt_index (my_vars->Gmy_cxt_index)
-#define PL_Gmy_cxt_index (my_vars->Gmy_cxt_index)
-#define PL_op_mutex (my_vars->Gop_mutex)
-#define PL_Gop_mutex (my_vars->Gop_mutex)
-#define PL_op_seq (my_vars->Gop_seq)
-#define PL_Gop_seq (my_vars->Gop_seq)
-#define PL_op_sequence (my_vars->Gop_sequence)
-#define PL_Gop_sequence (my_vars->Gop_sequence)
-#define PL_perlio_debug_fd (my_vars->Gperlio_debug_fd)
-#define PL_Gperlio_debug_fd (my_vars->Gperlio_debug_fd)
-#define PL_perlio_fd_refcnt (my_vars->Gperlio_fd_refcnt)
-#define PL_Gperlio_fd_refcnt (my_vars->Gperlio_fd_refcnt)
-#define PL_perlio_fd_refcnt_size (my_vars->Gperlio_fd_refcnt_size)
-#define PL_Gperlio_fd_refcnt_size (my_vars->Gperlio_fd_refcnt_size)
-#define PL_perlio_mutex (my_vars->Gperlio_mutex)
-#define PL_Gperlio_mutex (my_vars->Gperlio_mutex)
-#define PL_ppaddr (my_vars->Gppaddr)
-#define PL_Gppaddr (my_vars->Gppaddr)
-#ifdef OS2
-#define PL_sh_path (my_vars->Gsh_path)
-#define PL_Gsh_path (my_vars->Gsh_path)
-#endif
-#define PL_sig_defaulting (my_vars->Gsig_defaulting)
-#define PL_Gsig_defaulting (my_vars->Gsig_defaulting)
-#define PL_sig_handlers_initted (my_vars->Gsig_handlers_initted)
-#define PL_Gsig_handlers_initted (my_vars->Gsig_handlers_initted)
-#define PL_sig_ignoring (my_vars->Gsig_ignoring)
-#define PL_Gsig_ignoring (my_vars->Gsig_ignoring)
-#define PL_sig_trapped (my_vars->Gsig_trapped)
-#define PL_Gsig_trapped (my_vars->Gsig_trapped)
-#define PL_sigfpe_saved (my_vars->Gsigfpe_saved)
-#define PL_Gsigfpe_saved (my_vars->Gsigfpe_saved)
-#define PL_sv_placeholder (my_vars->Gsv_placeholder)
-#define PL_Gsv_placeholder (my_vars->Gsv_placeholder)
-#define PL_thr_key (my_vars->Gthr_key)
-#define PL_Gthr_key (my_vars->Gthr_key)
-#define PL_timesbase (my_vars->Gtimesbase)
-#define PL_Gtimesbase (my_vars->Gtimesbase)
-#define PL_use_safe_putenv (my_vars->Guse_safe_putenv)
-#define PL_Guse_safe_putenv (my_vars->Guse_safe_putenv)
-#define PL_veto_cleanup (my_vars->Gveto_cleanup)
-#define PL_Gveto_cleanup (my_vars->Gveto_cleanup)
-#define PL_watch_pvx (my_vars->Gwatch_pvx)
-#define PL_Gwatch_pvx (my_vars->Gwatch_pvx)
+#ifndef USE_THREADS
+
+
+#endif /* USE_THREADS */
+#endif /* EMBED */
+#endif /* MULTIPLICITY */
+
+/* Now same trickey for per-thread variables */
+
+#ifdef USE_THREADS
+
+#define PL_Sv (thr->TSv)
+#define PL_Xpv (thr->TXpv)
+#define PL_av_fetch_sv (thr->Tav_fetch_sv)
+#define PL_bodytarget (thr->Tbodytarget)
+#define PL_bostr (thr->Tbostr)
+#define PL_chopset (thr->Tchopset)
+#define PL_colors (thr->Tcolors)
+#define PL_colorset (thr->Tcolorset)
+#define PL_curcop (thr->Tcurcop)
+#define PL_curpad (thr->Tcurpad)
+#define PL_curpm (thr->Tcurpm)
+#define PL_curstack (thr->Tcurstack)
+#define PL_curstackinfo (thr->Tcurstackinfo)
+#define PL_curstash (thr->Tcurstash)
+#define PL_defoutgv (thr->Tdefoutgv)
+#define PL_defstash (thr->Tdefstash)
+#define PL_delaymagic (thr->Tdelaymagic)
+#define PL_dirty (thr->Tdirty)
+#define PL_extralen (thr->Textralen)
+#define PL_firstgv (thr->Tfirstgv)
+#define PL_formtarget (thr->Tformtarget)
+#define PL_hv_fetch_ent_mh (thr->Thv_fetch_ent_mh)
+#define PL_hv_fetch_sv (thr->Thv_fetch_sv)
+#define PL_in_eval (thr->Tin_eval)
+#define PL_last_in_gv (thr->Tlast_in_gv)
+#define PL_lastgotoprobe (thr->Tlastgotoprobe)
+#define PL_lastscream (thr->Tlastscream)
+#define PL_localizing (thr->Tlocalizing)
+#define PL_mainstack (thr->Tmainstack)
+#define PL_markstack (thr->Tmarkstack)
+#define PL_markstack_max (thr->Tmarkstack_max)
+#define PL_markstack_ptr (thr->Tmarkstack_ptr)
+#define PL_maxscream (thr->Tmaxscream)
+#define PL_modcount (thr->Tmodcount)
+#define PL_nrs (thr->Tnrs)
+#define PL_ofs (thr->Tofs)
+#define PL_ofslen (thr->Tofslen)
+#define PL_op (thr->Top)
+#define PL_opsave (thr->Topsave)
+#define PL_reg_eval_set (thr->Treg_eval_set)
+#define PL_reg_flags (thr->Treg_flags)
+#define PL_reg_start_tmp (thr->Treg_start_tmp)
+#define PL_reg_start_tmpl (thr->Treg_start_tmpl)
+#define PL_regbol (thr->Tregbol)
+#define PL_regcc (thr->Tregcc)
+#define PL_regcode (thr->Tregcode)
+#define PL_regcomp_parse (thr->Tregcomp_parse)
+#define PL_regcomp_rx (thr->Tregcomp_rx)
+#define PL_regcompp (thr->Tregcompp)
+#define PL_regdata (thr->Tregdata)
+#define PL_regdummy (thr->Tregdummy)
+#define PL_regendp (thr->Tregendp)
+#define PL_regeol (thr->Tregeol)
+#define PL_regexecp (thr->Tregexecp)
+#define PL_regflags (thr->Tregflags)
+#define PL_regindent (thr->Tregindent)
+#define PL_reginput (thr->Treginput)
+#define PL_reginterp_cnt (thr->Treginterp_cnt)
+#define PL_reglastparen (thr->Treglastparen)
+#define PL_regnarrate (thr->Tregnarrate)
+#define PL_regnaughty (thr->Tregnaughty)
+#define PL_regnpar (thr->Tregnpar)
+#define PL_regprecomp (thr->Tregprecomp)
+#define PL_regprev (thr->Tregprev)
+#define PL_regprogram (thr->Tregprogram)
+#define PL_regsawback (thr->Tregsawback)
+#define PL_regseen (thr->Tregseen)
+#define PL_regsize (thr->Tregsize)
+#define PL_regstartp (thr->Tregstartp)
+#define PL_regtill (thr->Tregtill)
+#define PL_regxend (thr->Tregxend)
+#define PL_restartop (thr->Trestartop)
+#define PL_retstack (thr->Tretstack)
+#define PL_retstack_ix (thr->Tretstack_ix)
+#define PL_retstack_max (thr->Tretstack_max)
+#define PL_rs (thr->Trs)
+#define PL_savestack (thr->Tsavestack)
+#define PL_savestack_ix (thr->Tsavestack_ix)
+#define PL_savestack_max (thr->Tsavestack_max)
+#define PL_scopestack (thr->Tscopestack)
+#define PL_scopestack_ix (thr->Tscopestack_ix)
+#define PL_scopestack_max (thr->Tscopestack_max)
+#define PL_screamfirst (thr->Tscreamfirst)
+#define PL_screamnext (thr->Tscreamnext)
+#define PL_secondgv (thr->Tsecondgv)
+#define PL_seen_evals (thr->Tseen_evals)
+#define PL_seen_zerolen (thr->Tseen_zerolen)
+#define PL_sortcop (thr->Tsortcop)
+#define PL_sortcxix (thr->Tsortcxix)
+#define PL_sortstash (thr->Tsortstash)
+#define PL_stack_base (thr->Tstack_base)
+#define PL_stack_max (thr->Tstack_max)
+#define PL_stack_sp (thr->Tstack_sp)
+#define PL_start_env (thr->Tstart_env)
+#define PL_statbuf (thr->Tstatbuf)
+#define PL_statcache (thr->Tstatcache)
+#define PL_statgv (thr->Tstatgv)
+#define PL_statname (thr->Tstatname)
+#define PL_tainted (thr->Ttainted)
+#define PL_timesbuf (thr->Ttimesbuf)
+#define PL_tmps_floor (thr->Ttmps_floor)
+#define PL_tmps_ix (thr->Ttmps_ix)
+#define PL_tmps_max (thr->Ttmps_max)
+#define PL_tmps_stack (thr->Ttmps_stack)
+#define PL_top_env (thr->Ttop_env)
+#define PL_toptarget (thr->Ttoptarget)
+
+#endif /* USE_THREADS */
+
+#ifdef PERL_GLOBAL_STRUCT
+
+#define PL_No (PL_Vars.GNo)
+#define PL_Yes (PL_Vars.GYes)
+#define PL_amagic_generation (PL_Vars.Gamagic_generation)
+#define PL_an (PL_Vars.Gan)
+#define PL_bufend (PL_Vars.Gbufend)
+#define PL_bufptr (PL_Vars.Gbufptr)
+#define PL_collation_ix (PL_Vars.Gcollation_ix)
+#define PL_collation_name (PL_Vars.Gcollation_name)
+#define PL_collation_standard (PL_Vars.Gcollation_standard)
+#define PL_collxfrm_base (PL_Vars.Gcollxfrm_base)
+#define PL_collxfrm_mult (PL_Vars.Gcollxfrm_mult)
+#define PL_cop_seqmax (PL_Vars.Gcop_seqmax)
+#define PL_cred_mutex (PL_Vars.Gcred_mutex)
+#define PL_cryptseen (PL_Vars.Gcryptseen)
+#define PL_cshlen (PL_Vars.Gcshlen)
+#define PL_cshname (PL_Vars.Gcshname)
+#define PL_curinterp (PL_Vars.Gcurinterp)
+#define PL_curthr (PL_Vars.Gcurthr)
+#define PL_debug (PL_Vars.Gdebug)
+#define PL_do_undump (PL_Vars.Gdo_undump)
+#define PL_egid (PL_Vars.Gegid)
+#define PL_error_count (PL_Vars.Gerror_count)
+#define PL_euid (PL_Vars.Geuid)
+#define PL_eval_cond (PL_Vars.Geval_cond)
+#define PL_eval_mutex (PL_Vars.Geval_mutex)
+#define PL_eval_owner (PL_Vars.Geval_owner)
+#define PL_evalseq (PL_Vars.Gevalseq)
+#define PL_expect (PL_Vars.Gexpect)
+#define PL_gid (PL_Vars.Ggid)
+#define PL_he_root (PL_Vars.Ghe_root)
+#define PL_hexdigit (PL_Vars.Ghexdigit)
+#define PL_hints (PL_Vars.Ghints)
+#define PL_in_my (PL_Vars.Gin_my)
+#define PL_in_my_stash (PL_Vars.Gin_my_stash)
+#define PL_last_lop (PL_Vars.Glast_lop)
+#define PL_last_lop_op (PL_Vars.Glast_lop_op)
+#define PL_last_uni (PL_Vars.Glast_uni)
+#define PL_lex_brackets (PL_Vars.Glex_brackets)
+#define PL_lex_brackstack (PL_Vars.Glex_brackstack)
+#define PL_lex_casemods (PL_Vars.Glex_casemods)
+#define PL_lex_casestack (PL_Vars.Glex_casestack)
+#define PL_lex_defer (PL_Vars.Glex_defer)
+#define PL_lex_dojoin (PL_Vars.Glex_dojoin)
+#define PL_lex_expect (PL_Vars.Glex_expect)
+#define PL_lex_fakebrack (PL_Vars.Glex_fakebrack)
+#define PL_lex_formbrack (PL_Vars.Glex_formbrack)
+#define PL_lex_inpat (PL_Vars.Glex_inpat)
+#define PL_lex_inwhat (PL_Vars.Glex_inwhat)
+#define PL_lex_op (PL_Vars.Glex_op)
+#define PL_lex_repl (PL_Vars.Glex_repl)
+#define PL_lex_starts (PL_Vars.Glex_starts)
+#define PL_lex_state (PL_Vars.Glex_state)
+#define PL_lex_stuff (PL_Vars.Glex_stuff)
+#define PL_linestr (PL_Vars.Glinestr)
+#define PL_malloc_mutex (PL_Vars.Gmalloc_mutex)
+#define PL_max_intro_pending (PL_Vars.Gmax_intro_pending)
+#define PL_maxo (PL_Vars.Gmaxo)
+#define PL_min_intro_pending (PL_Vars.Gmin_intro_pending)
+#define PL_multi_close (PL_Vars.Gmulti_close)
+#define PL_multi_end (PL_Vars.Gmulti_end)
+#define PL_multi_open (PL_Vars.Gmulti_open)
+#define PL_multi_start (PL_Vars.Gmulti_start)
+#define PL_na (PL_Vars.Gna)
+#define PL_nexttoke (PL_Vars.Gnexttoke)
+#define PL_nexttype (PL_Vars.Gnexttype)
+#define PL_nextval (PL_Vars.Gnextval)
+#define PL_nice_chunk (PL_Vars.Gnice_chunk)
+#define PL_nice_chunk_size (PL_Vars.Gnice_chunk_size)
+#define PL_ninterps (PL_Vars.Gninterps)
+#define PL_nomemok (PL_Vars.Gnomemok)
+#define PL_nthreads (PL_Vars.Gnthreads)
+#define PL_nthreads_cond (PL_Vars.Gnthreads_cond)
+#define PL_numeric_local (PL_Vars.Gnumeric_local)
+#define PL_numeric_name (PL_Vars.Gnumeric_name)
+#define PL_numeric_standard (PL_Vars.Gnumeric_standard)
+#define PL_oldbufptr (PL_Vars.Goldbufptr)
+#define PL_oldoldbufptr (PL_Vars.Goldoldbufptr)
+#define PL_op_seqmax (PL_Vars.Gop_seqmax)
+#define PL_origalen (PL_Vars.Gorigalen)
+#define PL_origenviron (PL_Vars.Gorigenviron)
+#define PL_osname (PL_Vars.Gosname)
+#define PL_pad_reset_pending (PL_Vars.Gpad_reset_pending)
+#define PL_padix (PL_Vars.Gpadix)
+#define PL_padix_floor (PL_Vars.Gpadix_floor)
+#define PL_patleave (PL_Vars.Gpatleave)
+#define PL_pidstatus (PL_Vars.Gpidstatus)
+#define PL_runops (PL_Vars.Grunops)
+#define PL_sh_path (PL_Vars.Gsh_path)
+#define PL_sighandlerp (PL_Vars.Gsighandlerp)
+#define PL_specialsv_list (PL_Vars.Gspecialsv_list)
+#define PL_subline (PL_Vars.Gsubline)
+#define PL_subname (PL_Vars.Gsubname)
+#define PL_sv_mutex (PL_Vars.Gsv_mutex)
+#define PL_sv_no (PL_Vars.Gsv_no)
+#define PL_sv_undef (PL_Vars.Gsv_undef)
+#define PL_sv_yes (PL_Vars.Gsv_yes)
+#define PL_svref_mutex (PL_Vars.Gsvref_mutex)
+#define PL_thisexpr (PL_Vars.Gthisexpr)
+#define PL_thr_key (PL_Vars.Gthr_key)
+#define PL_threads_mutex (PL_Vars.Gthreads_mutex)
+#define PL_threadsv_names (PL_Vars.Gthreadsv_names)
+#define PL_tokenbuf (PL_Vars.Gtokenbuf)
+#define PL_uid (PL_Vars.Guid)
+#define PL_xiv_arenaroot (PL_Vars.Gxiv_arenaroot)
+#define PL_xiv_root (PL_Vars.Gxiv_root)
+#define PL_xnv_root (PL_Vars.Gxnv_root)
+#define PL_xpv_root (PL_Vars.Gxpv_root)
+#define PL_xrv_root (PL_Vars.Gxrv_root)
+
+#else /* !PERL_GLOBAL_STRUCT */
+
+#define PL_GNo PL_No
+#define PL_GYes PL_Yes
+#define PL_Gamagic_generation PL_amagic_generation
+#define PL_Gan PL_an
+#define PL_Gbufend PL_bufend
+#define PL_Gbufptr PL_bufptr
+#define PL_Gcollation_ix PL_collation_ix
+#define PL_Gcollation_name PL_collation_name
+#define PL_Gcollation_standard PL_collation_standard
+#define PL_Gcollxfrm_base PL_collxfrm_base
+#define PL_Gcollxfrm_mult PL_collxfrm_mult
+#define PL_Gcop_seqmax PL_cop_seqmax
+#define PL_Gcred_mutex PL_cred_mutex
+#define PL_Gcryptseen PL_cryptseen
+#define PL_Gcshlen PL_cshlen
+#define PL_Gcshname PL_cshname
+#define PL_Gcurinterp PL_curinterp
+#define PL_Gcurthr PL_curthr
+#define PL_Gdebug PL_debug
+#define PL_Gdo_undump PL_do_undump
+#define PL_Gegid PL_egid
+#define PL_Gerror_count PL_error_count
+#define PL_Geuid PL_euid
+#define PL_Geval_cond PL_eval_cond
+#define PL_Geval_mutex PL_eval_mutex
+#define PL_Geval_owner PL_eval_owner
+#define PL_Gevalseq PL_evalseq
+#define PL_Gexpect PL_expect
+#define PL_Ggid PL_gid
+#define PL_Ghe_root PL_he_root
+#define PL_Ghexdigit PL_hexdigit
+#define PL_Ghints PL_hints
+#define PL_Gin_my PL_in_my
+#define PL_Gin_my_stash PL_in_my_stash
+#define PL_Glast_lop PL_last_lop
+#define PL_Glast_lop_op PL_last_lop_op
+#define PL_Glast_uni PL_last_uni
+#define PL_Glex_brackets PL_lex_brackets
+#define PL_Glex_brackstack PL_lex_brackstack
+#define PL_Glex_casemods PL_lex_casemods
+#define PL_Glex_casestack PL_lex_casestack
+#define PL_Glex_defer PL_lex_defer
+#define PL_Glex_dojoin PL_lex_dojoin
+#define PL_Glex_expect PL_lex_expect
+#define PL_Glex_fakebrack PL_lex_fakebrack
+#define PL_Glex_formbrack PL_lex_formbrack
+#define PL_Glex_inpat PL_lex_inpat
+#define PL_Glex_inwhat PL_lex_inwhat
+#define PL_Glex_op PL_lex_op
+#define PL_Glex_repl PL_lex_repl
+#define PL_Glex_starts PL_lex_starts
+#define PL_Glex_state PL_lex_state
+#define PL_Glex_stuff PL_lex_stuff
+#define PL_Glinestr PL_linestr
+#define PL_Gmalloc_mutex PL_malloc_mutex
+#define PL_Gmax_intro_pending PL_max_intro_pending
+#define PL_Gmaxo PL_maxo
+#define PL_Gmin_intro_pending PL_min_intro_pending
+#define PL_Gmulti_close PL_multi_close
+#define PL_Gmulti_end PL_multi_end
+#define PL_Gmulti_open PL_multi_open
+#define PL_Gmulti_start PL_multi_start
+#define PL_Gna PL_na
+#define PL_Gnexttoke PL_nexttoke
+#define PL_Gnexttype PL_nexttype
+#define PL_Gnextval PL_nextval
+#define PL_Gnice_chunk PL_nice_chunk
+#define PL_Gnice_chunk_size PL_nice_chunk_size
+#define PL_Gninterps PL_ninterps
+#define PL_Gnomemok PL_nomemok
+#define PL_Gnthreads PL_nthreads
+#define PL_Gnthreads_cond PL_nthreads_cond
+#define PL_Gnumeric_local PL_numeric_local
+#define PL_Gnumeric_name PL_numeric_name
+#define PL_Gnumeric_standard PL_numeric_standard
+#define PL_Goldbufptr PL_oldbufptr
+#define PL_Goldoldbufptr PL_oldoldbufptr
+#define PL_Gop_seqmax PL_op_seqmax
+#define PL_Gorigalen PL_origalen
+#define PL_Gorigenviron PL_origenviron
+#define PL_Gosname PL_osname
+#define PL_Gpad_reset_pending PL_pad_reset_pending
+#define PL_Gpadix PL_padix
+#define PL_Gpadix_floor PL_padix_floor
+#define PL_Gpatleave PL_patleave
+#define PL_Gpidstatus PL_pidstatus
+#define PL_Grunops PL_runops
+#define PL_Gsh_path PL_sh_path
+#define PL_Gsighandlerp PL_sighandlerp
+#define PL_Gspecialsv_list PL_specialsv_list
+#define PL_Gsubline PL_subline
+#define PL_Gsubname PL_subname
+#define PL_Gsv_mutex PL_sv_mutex
+#define PL_Gsv_no PL_sv_no
+#define PL_Gsv_undef PL_sv_undef
+#define PL_Gsv_yes PL_sv_yes
+#define PL_Gsvref_mutex PL_svref_mutex
+#define PL_Gthisexpr PL_thisexpr
+#define PL_Gthr_key PL_thr_key
+#define PL_Gthreads_mutex PL_threads_mutex
+#define PL_Gthreadsv_names PL_threadsv_names
+#define PL_Gtokenbuf PL_tokenbuf
+#define PL_Guid PL_uid
+#define PL_Gxiv_arenaroot PL_xiv_arenaroot
+#define PL_Gxiv_root PL_xiv_root
+#define PL_Gxnv_root PL_xnv_root
+#define PL_Gxpv_root PL_xpv_root
+#define PL_Gxrv_root PL_xrv_root
+
+#ifdef EMBED
+
+
+#endif /* EMBED */
#endif /* PERL_GLOBAL_STRUCT */
-/* ex: set ro: */
+
+#ifndef MIN_PERL_DEFINE
+
+#define DBsingle PL_DBsingle
+#define DBsub PL_DBsub
+#define compiling PL_compiling
+#define curcop PL_curcop
+#define curstash PL_curstash
+#define debstash PL_debstash
+#define defgv PL_defgv
+#define diehook PL_diehook
+#define dirty PL_dirty
+#define dowarn PL_dowarn
+#define errgv PL_errgv
+#define na PL_na
+#define perl_destruct_level PL_perl_destruct_level
+#define perldb PL_perldb
+#define rsfp PL_rsfp
+#define rsfp_filters PL_rsfp_filters
+#define stack_base PL_stack_base
+#define stack_sp PL_stack_sp
+#define stdingv PL_stdingv
+#define sv_arenaroot PL_sv_arenaroot
+#define sv_no PL_sv_no
+#define sv_undef PL_sv_undef
+#define sv_yes PL_sv_yes
+#define tainted PL_tainted
+#define tainting PL_tainting
+
+#endif /* MIN_PERL_DEFINE */
diff --git a/gnu/usr.bin/perl/ext/B/B.pm b/gnu/usr.bin/perl/ext/B/B.pm
index 952475db2c2..75dcfb3b74d 100644
--- a/gnu/usr.bin/perl/ext/B/B.pm
+++ b/gnu/usr.bin/perl/ext/B/B.pm
@@ -6,51 +6,27 @@
# License or the Artistic License, as specified in the README file.
#
package B;
-use strict;
-
+require DynaLoader;
require Exporter;
-@B::ISA = qw(Exporter);
-
-# walkoptree_slow comes from B.pm (you are there),
-# walkoptree comes from B.xs
-
-BEGIN {
- $B::VERSION = '1.48';
- @B::EXPORT_OK = ();
-
- # Our BOOT code needs $VERSION set, and will append to @EXPORT_OK.
- # Want our constants loaded before the compiler meets OPf_KIDS below, as
- # the combination of having the constant stay a Proxy Constant Subroutine
- # and its value being inlined saves a little over .5K
-
- require XSLoader;
- XSLoader::load();
-}
-
-push @B::EXPORT_OK, (qw(minus_c ppname save_BEGINs
- class peekop cast_I32 cstring cchar hash threadsv_names
- main_root main_start main_cv svref_2object opnumber
- sub_generation amagic_generation perlstring
- walkoptree_slow walkoptree walkoptree_exec walksymtable
- parents comppadlist sv_undef compile_stats timing_info
- begin_av init_av check_av end_av regex_padav dowarn
- defstash curstash warnhook diehook inc_gv @optype
- @specialsv_name unitcheck_av));
+@ISA = qw(Exporter DynaLoader);
+@EXPORT_OK = qw(byteload_fh byteload_string minus_c ppname
+ class peekop cast_I32 cstring cchar hash threadsv_names
+ main_root main_start main_cv svref_2object
+ walkoptree walkoptree_slow walkoptree_exec walksymtable
+ parents comppadlist sv_undef compile_stats timing_info init_av);
+use strict;
@B::SV::ISA = 'B::OBJECT';
@B::NULL::ISA = 'B::SV';
@B::PV::ISA = 'B::SV';
@B::IV::ISA = 'B::SV';
-@B::NV::ISA = 'B::SV';
-# RV is eliminated with 5.11.0, but effectively is a specialisation of IV now.
-@B::RV::ISA = $] >= 5.011 ? 'B::IV' : 'B::SV';
+@B::NV::ISA = 'B::IV';
+@B::RV::ISA = 'B::SV';
@B::PVIV::ISA = qw(B::PV B::IV);
-@B::PVNV::ISA = qw(B::PVIV B::NV);
+@B::PVNV::ISA = qw(B::PV B::NV);
@B::PVMG::ISA = 'B::PVNV';
-@B::REGEXP::ISA = 'B::PVMG' if $] >= 5.011;
-@B::INVLIST::ISA = 'B::PV' if $] >= 5.019;
-@B::PVLV::ISA = 'B::GV';
-@B::BM::ISA = 'B::GV';
+@B::PVLV::ISA = 'B::PVMG';
+@B::BM::ISA = 'B::PVMG';
@B::AV::ISA = 'B::PVMG';
@B::GV::ISA = 'B::PVMG';
@B::HV::ISA = 'B::PVMG';
@@ -62,61 +38,23 @@ push @B::EXPORT_OK, (qw(minus_c ppname save_BEGINs
@B::UNOP::ISA = 'B::OP';
@B::BINOP::ISA = 'B::UNOP';
@B::LOGOP::ISA = 'B::UNOP';
+@B::CONDOP::ISA = 'B::UNOP';
@B::LISTOP::ISA = 'B::BINOP';
@B::SVOP::ISA = 'B::OP';
-@B::PADOP::ISA = 'B::OP';
+@B::GVOP::ISA = 'B::OP';
@B::PVOP::ISA = 'B::OP';
+@B::CVOP::ISA = 'B::OP';
@B::LOOP::ISA = 'B::LISTOP';
@B::PMOP::ISA = 'B::LISTOP';
@B::COP::ISA = 'B::OP';
@B::SPECIAL::ISA = 'B::OBJECT';
-@B::optype = qw(OP UNOP BINOP LOGOP LISTOP PMOP SVOP PADOP PVOP LOOP COP);
-# bytecode.pl contained the following comment:
-# Nullsv *must* come first in the following so that the condition
-# ($$sv == 0) can continue to be used to test (sv == Nullsv).
-@B::specialsv_name = qw(Nullsv &PL_sv_undef &PL_sv_yes &PL_sv_no
- (SV*)pWARN_ALL (SV*)pWARN_NONE (SV*)pWARN_STD);
-
{
# Stop "-w" from complaining about the lack of a real B::OBJECT class
package B::OBJECT;
}
-sub B::GV::SAFENAME {
- my $name = (shift())->NAME;
-
- # The regex below corresponds to the isCONTROLVAR macro
- # from toke.c
-
- $name =~ s/^\c?/^?/
- or $name =~ s/^([\cA-\cZ\c\\c[\c]\c_\c^])/
- "^" . chr( utf8::unicode_to_native( 64 ^ ord($1) ))/e;
-
- # When we say unicode_to_native we really mean ascii_to_native,
- # which matters iff this is a non-ASCII platform (EBCDIC). '\c?' would
- # not have to be special cased, except for non-ASCII.
-
- return $name;
-}
-
-sub B::IV::int_value {
- my ($self) = @_;
- return (($self->FLAGS() & SVf_IVisUV()) ? $self->UVX : $self->IV);
-}
-
-sub B::NULL::as_string() {""}
-*B::IV::as_string = \*B::IV::int_value;
-*B::PV::as_string = \*B::PV::PV;
-
-# The input typemap checking makes no distinction between different SV types,
-# so the XS body will generate the same C code, despite the different XS
-# "types". So there is no change in behaviour from doing "newXS" like this,
-# compared with the old approach of having a (near) duplicate XS body.
-# We should fix the typemap checking.
-*B::IV::RV = \*B::PV::RV if $] > 5.012;
-
my $debug;
my $op_count = 0;
my @parents = ();
@@ -127,6 +65,10 @@ sub debug {
walkoptree_debug($value);
}
+# sub OPf_KIDS;
+# add to .xs for perl5.002
+sub OPf_KIDS () { 4 }
+
sub class {
my $obj = shift;
my $name = ref $obj;
@@ -139,7 +81,7 @@ sub parents { \@parents }
# For debugging
sub peekop {
my $op = shift;
- return sprintf("%s (0x%x) %s", class($op), $$op, $op->name);
+ return sprintf("%s (0x%x) %s", class($op), $$op, $op->ppaddr);
}
sub walkoptree_slow {
@@ -147,7 +89,7 @@ sub walkoptree_slow {
$op_count++; # just for statistics
$level ||= 0;
warn(sprintf("walkoptree: %d. %s\n", $level, peekop($op))) if $debug;
- $op->$method($level) if $op->can($method);
+ $op->$method($level);
if ($$op && ($op->flags & OPf_KIDS)) {
my $kid;
unshift(@parents, $op);
@@ -156,15 +98,6 @@ sub walkoptree_slow {
}
shift @parents;
}
- if (class($op) eq 'PMOP'
- && ref($op->pmreplroot)
- && ${$op->pmreplroot}
- && $op->pmreplroot->isa( 'B::OP' ))
- {
- unshift(@parents, $op);
- walkoptree_slow($op->pmreplroot, $method, $level + 1);
- shift @parents;
- }
}
sub compile_stats {
@@ -179,11 +112,6 @@ sub timing_info {
}
my %symtable;
-
-sub clearsym {
- %symtable = ();
-}
-
sub savesym {
my ($obj, $value) = @_;
# warn(sprintf("savesym: sym_%x => %s\n", $$obj, $value)); # debug
@@ -197,7 +125,6 @@ sub objsym {
sub walkoptree_exec {
my ($op, $method, $level) = @_;
- $level ||= 0;
my ($sym, $ppname);
my $prefix = " " x $level;
for (; $$op; $op = $op->next) {
@@ -208,26 +135,37 @@ sub walkoptree_exec {
}
savesym($op, sprintf("%s (0x%lx)", class($op), $$op));
$op->$method($level);
- $ppname = $op->name;
- if ($ppname =~
- /^(d?or(assign)?|and(assign)?|mapwhile|grepwhile|entertry|range|cond_expr)$/)
- {
+ $ppname = $op->ppaddr;
+ if ($ppname =~ /^pp_(or|and|mapwhile|grepwhile|entertry)$/) {
print $prefix, uc($1), " => {\n";
walkoptree_exec($op->other, $method, $level + 1);
print $prefix, "}\n";
- } elsif ($ppname eq "match" || $ppname eq "subst") {
+ } elsif ($ppname eq "pp_match" || $ppname eq "pp_subst") {
my $pmreplstart = $op->pmreplstart;
if ($$pmreplstart) {
print $prefix, "PMREPLSTART => {\n";
walkoptree_exec($pmreplstart, $method, $level + 1);
print $prefix, "}\n";
}
- } elsif ($ppname eq "substcont") {
+ } elsif ($ppname eq "pp_substcont") {
print $prefix, "SUBSTCONT => {\n";
walkoptree_exec($op->other->pmreplstart, $method, $level + 1);
print $prefix, "}\n";
$op = $op->other;
- } elsif ($ppname eq "enterloop") {
+ } elsif ($ppname eq "pp_cond_expr") {
+ # pp_cond_expr never returns op_next
+ print $prefix, "TRUE => {\n";
+ walkoptree_exec($op->true, $method, $level + 1);
+ print $prefix, "}\n";
+ $op = $op->false;
+ redo;
+ } elsif ($ppname eq "pp_range") {
+ print $prefix, "TRUE => {\n";
+ walkoptree_exec($op->true, $method, $level + 1);
+ print $prefix, "}\n", $prefix, "FALSE => {\n";
+ walkoptree_exec($op->false, $method, $level + 1);
+ print $prefix, "}\n";
+ } elsif ($ppname eq "pp_enterloop") {
print $prefix, "REDO => {\n";
walkoptree_exec($op->redoop, $method, $level + 1);
print $prefix, "}\n", $prefix, "NEXT => {\n";
@@ -235,7 +173,7 @@ sub walkoptree_exec {
print $prefix, "}\n", $prefix, "LAST => {\n";
walkoptree_exec($op->lastop, $method, $level + 1);
print $prefix, "}\n";
- } elsif ($ppname eq "subst") {
+ } elsif ($ppname eq "pp_subst") {
my $replstart = $op->pmreplstart;
if ($$replstart) {
print $prefix, "SUBST => {\n";
@@ -249,20 +187,16 @@ sub walkoptree_exec {
sub walksymtable {
my ($symref, $method, $recurse, $prefix) = @_;
my $sym;
- my $ref;
- my $fullname;
- no strict 'refs';
- $prefix = '' unless defined $prefix;
- foreach my $sym ( sort keys %$symref ) {
- $ref= $symref->{$sym};
- $fullname = "*main::".$prefix.$sym;
+ no strict 'vars';
+ local(*glob);
+ while (($sym, *glob) = each %$symref) {
if ($sym =~ /::$/) {
$sym = $prefix . $sym;
- if (svref_2object(\*$sym)->NAME ne "main::" && $sym ne "<none>::" && &$recurse($sym)) {
- walksymtable(\%$fullname, $method, $recurse, $sym);
+ if ($sym ne "main::" && &$recurse($sym)) {
+ walksymtable(\%glob, $method, $recurse, $sym);
}
} else {
- svref_2object(\*$fullname)->$method();
+ svref_2object(\*glob)->EGV->$method();
}
}
}
@@ -271,7 +205,7 @@ sub walksymtable {
package B::Section;
my $output_fh;
my %sections;
-
+
sub new {
my ($class, $section, $symtable, $default) = @_;
$output_fh ||= FileHandle->new_tmpfile;
@@ -279,7 +213,7 @@ sub walksymtable {
$sections{$section} = $obj;
return $obj;
}
-
+
sub get {
my ($class, $section) = @_;
return $sections{$section};
@@ -307,12 +241,12 @@ sub walksymtable {
my $section = shift;
return $section->[2];
}
-
+
sub default {
my $section = shift;
return $section->[3];
}
-
+
sub output {
my ($section, $fh, $format) = @_;
my $name = $section->name;
@@ -333,13 +267,15 @@ sub walksymtable {
}
}
+bootstrap B;
+
1;
__END__
=head1 NAME
-B - The Perl Compiler Backend
+B - The Perl Compiler
=head1 SYNOPSIS
@@ -348,330 +284,41 @@ B - The Perl Compiler Backend
=head1 DESCRIPTION
The C<B> module supplies classes which allow a Perl program to delve
-into its own innards. It is the module used to implement the
-"backends" of the Perl compiler. Usage of the compiler does not
+into its own innards. It is the module used to implement the
+"backends" of the Perl compiler. Usage of the compiler does not
require knowledge of this module: see the F<O> module for the
-user-visible part. The C<B> module is of use to those who want to
-write new compiler backends. This documentation assumes that the
+user-visible part. The C<B> module is of use to those who want to
+write new compiler backends. This documentation assumes that the
reader knows a fair amount about perl's internals including such
things as SVs, OPs and the internal symbol table and syntax tree
of a program.
-=head1 OVERVIEW
-
-The C<B> module contains a set of utility functions for querying the
-current state of the Perl interpreter; typically these functions
-return objects from the B::SV and B::OP classes, or their derived
-classes. These classes in turn define methods for querying the
-resulting objects about their own internal state.
-
-=head1 Utility Functions
-
-The C<B> module exports a variety of functions: some are simple
-utility functions, others provide a Perl program with a way to
-get an initial "handle" on an internal object.
-
-=head2 Functions Returning C<B::SV>, C<B::AV>, C<B::HV>, and C<B::CV> objects
-
-For descriptions of the class hierarchy of these objects and the
-methods that can be called on them, see below, L<"OVERVIEW OF
-CLASSES"> and L<"SV-RELATED CLASSES">.
-
-=over 4
-
-=item sv_undef
-
-Returns the SV object corresponding to the C variable C<sv_undef>.
-
-=item sv_yes
-
-Returns the SV object corresponding to the C variable C<sv_yes>.
-
-=item sv_no
-
-Returns the SV object corresponding to the C variable C<sv_no>.
-
-=item svref_2object(SVREF)
-
-Takes a reference to any Perl value, and turns the referred-to value
-into an object in the appropriate B::OP-derived or B::SV-derived
-class. Apart from functions such as C<main_root>, this is the primary
-way to get an initial "handle" on an internal perl data structure
-which can then be followed with the other access methods.
-
-The returned object will only be valid as long as the underlying OPs
-and SVs continue to exist. Do not attempt to use the object after the
-underlying structures are freed.
-
-=item amagic_generation
-
-Returns the SV object corresponding to the C variable C<amagic_generation>.
-As of Perl 5.18, this is just an alias to C<PL_na>, so its value is
-meaningless.
-
-=item init_av
-
-Returns the AV object (i.e. in class B::AV) representing INIT blocks.
-
-=item check_av
-
-Returns the AV object (i.e. in class B::AV) representing CHECK blocks.
-
-=item unitcheck_av
-
-Returns the AV object (i.e. in class B::AV) representing UNITCHECK blocks.
-
-=item begin_av
-
-Returns the AV object (i.e. in class B::AV) representing BEGIN blocks.
-
-=item end_av
-
-Returns the AV object (i.e. in class B::AV) representing END blocks.
-
-=item comppadlist
-
-Returns the PADLIST object (i.e. in class B::PADLIST) of the global
-comppadlist. In Perl 5.16 and earlier it returns an AV object (class
-B::AV).
-
-=item regex_padav
-
-Only when perl was compiled with ithreads.
-
-=item main_cv
-
-Return the (faked) CV corresponding to the main part of the Perl
-program.
-
-=back
-
-=head2 Functions for Examining the Symbol Table
-
-=over 4
-
-=item walksymtable(SYMREF, METHOD, RECURSE, PREFIX)
-
-Walk the symbol table starting at SYMREF and call METHOD on each
-symbol (a B::GV object) visited. When the walk reaches package
-symbols (such as "Foo::") it invokes RECURSE, passing in the symbol
-name, and only recurses into the package if that sub returns true.
-
-PREFIX is the name of the SYMREF you're walking.
-
-For example:
-
- # Walk CGI's symbol table calling print_subs on each symbol.
- # Recurse only into CGI::Util::
- walksymtable(\%CGI::, 'print_subs',
- sub { $_[0] eq 'CGI::Util::' }, 'CGI::');
-
-print_subs() is a B::GV method you have declared. Also see L<"B::GV
-Methods">, below.
-
-=back
-
-=head2 Functions Returning C<B::OP> objects or for walking op trees
-
-For descriptions of the class hierarchy of these objects and the
-methods that can be called on them, see below, L<"OVERVIEW OF
-CLASSES"> and L<"OP-RELATED CLASSES">.
-
-=over 4
-
-=item main_root
-
-Returns the root op (i.e. an object in the appropriate B::OP-derived
-class) of the main part of the Perl program.
-
-=item main_start
-
-Returns the starting op of the main part of the Perl program.
-
-=item walkoptree(OP, METHOD)
-
-Does a tree-walk of the syntax tree based at OP and calls METHOD on
-each op it visits. Each node is visited before its children. If
-C<walkoptree_debug> (see below) has been called to turn debugging on then
-the method C<walkoptree_debug> is called on each op before METHOD is
-called.
-
-=item walkoptree_debug(DEBUG)
-
-Returns the current debugging flag for C<walkoptree>. If the optional
-DEBUG argument is non-zero, it sets the debugging flag to that. See
-the description of C<walkoptree> above for what the debugging flag
-does.
-
-=back
-
-=head2 Miscellaneous Utility Functions
-
-=over 4
-
-=item ppname(OPNUM)
-
-Return the PP function name (e.g. "pp_add") of op number OPNUM.
-
-=item hash(STR)
-
-Returns a string in the form "0x..." representing the value of the
-internal hash function used by perl on string STR.
-
-=item cast_I32(I)
-
-Casts I to the internal I32 type used by that perl.
-
-=item minus_c
-
-Does the equivalent of the C<-c> command-line option. Obviously, this
-is only useful in a BEGIN block or else the flag is set too late.
-
-=item cstring(STR)
-
-Returns a double-quote-surrounded escaped version of STR which can
-be used as a string in C source code.
-
-=item perlstring(STR)
-
-Returns a double-quote-surrounded escaped version of STR which can
-be used as a string in Perl source code.
-
-=item class(OBJ)
-
-Returns the class of an object without the part of the classname
-preceding the first C<"::">. This is used to turn C<"B::UNOP"> into
-C<"UNOP"> for example.
-
-=item threadsv_names
-
-In a perl compiled for threads, this returns a list of the special
-per-thread threadsv variables.
-
-=back
-
-=head2 Exported utility variables
-
-=over 4
-
-=item @optype
-
- my $op_type = $optype[$op_type_num];
-
-A simple mapping of the op type number to its type (like 'COP' or 'BINOP').
-
-=item @specialsv_name
-
- my $sv_name = $specialsv_name[$sv_index];
-
-Certain SV types are considered 'special'. They're represented by
-B::SPECIAL and are referred to by a number from the specialsv_list.
-This array maps that number back to the name of the SV (like 'Nullsv'
-or '&PL_sv_undef').
-
-=back
-
-
=head1 OVERVIEW OF CLASSES
The C structures used by Perl's internals to hold SV and OP
information (PVIV, AV, HV, ..., OP, SVOP, UNOP, ...) are modelled on a
class hierarchy and the C<B> module gives access to them via a true
-object hierarchy. Structure fields which point to other objects
+object hierarchy. Structure fields which point to other objects
(whether types of SV or types of OP) are represented by the C<B>
-module as Perl objects of the appropriate class.
-
-The bulk of the C<B> module is the methods for accessing fields of
-these structures.
-
-Note that all access is read-only. You cannot modify the internals by
-using this module. Also, note that the B::OP and B::SV objects created
-by this module are only valid for as long as the underlying objects
-exist; their creation doesn't increase the reference counts of the
-underlying objects. Trying to access the fields of a freed object will
-give incomprehensible results, or worse.
+module as Perl objects of the appropriate class. The bulk of the C<B>
+module is the methods for accessing fields of these structures. Note
+that all access is read-only: you cannot modify the internals by
+using this module.
=head2 SV-RELATED CLASSES
-B::IV, B::NV, B::RV, B::PV, B::PVIV, B::PVNV, B::PVMG, B::BM (5.9.5 and
-earlier), B::PVLV, B::AV, B::HV, B::CV, B::GV, B::FM, B::IO. These classes
-correspond in the obvious way to the underlying C structures of similar names.
-The inheritance hierarchy mimics the underlying C "inheritance". For the
-5.10.x branch, (I<ie> 5.10.0, 5.10.1 I<etc>) this is:
-
- B::SV
- |
- +------------+------------+------------+
- | | | |
- B::PV B::IV B::NV B::RV
- \ / /
- \ / /
- B::PVIV /
- \ /
- \ /
- \ /
- B::PVNV
- |
- |
- B::PVMG
- |
- +-----+-----+-----+-----+
- | | | | |
- B::AV B::GV B::HV B::CV B::IO
- | |
- | |
- B::PVLV B::FM
-
-For 5.9.0 and earlier, PVLV is a direct subclass of PVMG, and BM is still
-present as a distinct type, so the base of this diagram is
-
-
- |
- |
- B::PVMG
- |
- +------+-----+-----+-----+-----+-----+
- | | | | | | |
- B::PVLV B::BM B::AV B::GV B::HV B::CV B::IO
- |
- |
- B::FM
-
-For 5.11.0 and later, B::RV is abolished, and IVs can be used to store
-references, and a new type B::REGEXP is introduced, giving this structure:
-
- B::SV
- |
- +------------+------------+
- | | |
- B::PV B::IV B::NV
- \ / /
- \ / /
- B::PVIV /
- \ /
- \ /
- \ /
- B::PVNV
- |
- |
- B::PVMG
- |
- +-------+-------+---+---+-------+-------+
- | | | | | |
- B::AV B::GV B::HV B::CV B::IO B::REGEXP
- | |
- | |
- B::PVLV B::FM
-
-
-Access methods correspond to the underlying C macros for field access,
+B::IV, B::NV, B::RV, B::PV, B::PVIV, B::PVNV, B::PVMG, B::BM, B::PVLV,
+B::AV, B::HV, B::CV, B::GV, B::FM, B::IO. These classes correspond in
+the obvious way to the underlying C structures of similar names. The
+inheritance hierarchy mimics the underlying C "inheritance". Access
+methods correspond to the underlying C macros for field access,
usually with the leading "class indication" prefix removed (Sv, Av,
-Hv, ...). The leading prefix is only left in cases where its removal
-would cause a clash in method name. For example, C<GvREFCNT> stays
+Hv, ...). The leading prefix is only left in cases where its removal
+would cause a clash in method name. For example, C<GvREFCNT> stays
as-is since its abbreviation would clash with the "superclass" method
C<REFCNT> (corresponding to the C function C<SvREFCNT>).
-=head2 B::SV Methods
+=head2 B::SV METHODS
=over 4
@@ -679,45 +326,23 @@ C<REFCNT> (corresponding to the C function C<SvREFCNT>).
=item FLAGS
-=item object_2svref
-
-Returns a reference to the regular scalar corresponding to this
-B::SV object. In other words, this method is the inverse operation
-to the svref_2object() subroutine. This scalar and other data it points
-at should be considered read-only: modifying them is neither safe nor
-guaranteed to have a sensible effect.
-
=back
-=head2 B::IV Methods
+=head2 B::IV METHODS
=over 4
=item IV
-Returns the value of the IV, I<interpreted as
-a signed integer>. This will be misleading
-if C<FLAGS & SVf_IVisUV>. Perhaps you want the
-C<int_value> method instead?
-
=item IVX
-=item UVX
-
-=item int_value
-
-This method returns the value of the IV as an integer.
-It differs from C<IV> in that it returns the correct
-value regardless of whether it's stored signed or
-unsigned.
-
=item needs64bits
=item packiv
=back
-=head2 B::NV Methods
+=head2 B::NV METHODS
=over 4
@@ -727,7 +352,7 @@ unsigned.
=back
-=head2 B::RV Methods
+=head2 B::RV METHODS
=over 4
@@ -735,46 +360,15 @@ unsigned.
=back
-=head2 B::PV Methods
+=head2 B::PV METHODS
=over 4
=item PV
-This method is the one you usually want. It constructs a
-string using the length and offset information in the struct:
-for ordinary scalars it will return the string that you'd see
-from Perl, even if it contains null characters.
-
-=item RV
-
-Same as B::RV::RV, except that it will die() if the PV isn't
-a reference.
-
-=item PVX
-
-This method is less often useful. It assumes that the string
-stored in the struct is null-terminated, and disregards the
-length information.
-
-It is the appropriate method to use if you need to get the name
-of a lexical variable from a padname array. Lexical variable names
-are always stored with a null terminator, and the length field
-(CUR) is overloaded for other purposes and can't be relied on here.
-
-=item CUR
-
-This method returns the internal length field, which consists of the number
-of internal bytes, not necessarily the number of logical characters.
-
-=item LEN
-
-This method returns the number of bytes allocated (via malloc) for storing
-the string. This is 0 if the scalar does not "own" the string.
-
=back
-=head2 B::PVMG Methods
+=head2 B::PVMG METHODS
=over 4
@@ -784,16 +378,12 @@ the string. This is 0 if the scalar does not "own" the string.
=back
-=head2 B::MAGIC Methods
+=head2 B::MAGIC METHODS
=over 4
=item MOREMAGIC
-=item precomp
-
-Only valid on r-magic, returns the string that generated the regexp.
-
=item PRIVATE
=item TYPE
@@ -802,18 +392,11 @@ Only valid on r-magic, returns the string that generated the regexp.
=item OBJ
-Will die() if called on r-magic.
-
=item PTR
-=item REGEX
-
-Only valid on r-magic, returns the integer value of the REGEX stored
-in the MAGIC.
-
=back
-=head2 B::PVLV Methods
+=head2 B::PVLV METHODS
=over 4
@@ -827,7 +410,7 @@ in the MAGIC.
=back
-=head2 B::BM Methods
+=head2 B::BM METHODS
=over 4
@@ -841,31 +424,12 @@ in the MAGIC.
=back
-=head2 B::GV Methods
+=head2 B::GV METHODS
=over 4
-=item is_empty
-
-This method returns TRUE if the GP field of the GV is NULL.
-
=item NAME
-=item SAFENAME
-
-This method returns the name of the glob, but if the first
-character of the name is a control character, then it converts
-it to ^X first, so that *^G would return "^G" rather than "\cG".
-
-It's useful if you want to print out the name of a variable.
-If you restrict yourself to globs which exist at compile-time
-then the result ought to be unambiguous, because code like
-C<${"^G"} = 1> is compiled as two ops - a constant string and
-a dereference (rv2gv) - so that the glob is created at runtime.
-
-If you're working with globs at runtime, and need to disambiguate
-*^G from *{"^G"}, then you should use the raw NAME method.
-
=item STASH
=item SV
@@ -886,8 +450,6 @@ If you're working with globs at runtime, and need to disambiguate
=item LINE
-=item FILE
-
=item FILEGV
=item GvREFCNT
@@ -896,16 +458,7 @@ If you're working with globs at runtime, and need to disambiguate
=back
-=head2 B::IO Methods
-
-B::IO objects derive from IO objects and you will get more information from
-the IO object itself.
-
-For example:
-
- $gvio = B::svref_2object(\*main::stdin)->IO;
- $IO = $gvio->object_2svref();
- $fd = $IO->fileno();
+=head2 B::IO METHODS
=over 4
@@ -933,33 +486,11 @@ For example:
=item IoTYPE
-A character symbolizing the type of IO Handle.
-
- - STDIN/OUT
- I STDIN/OUT/ERR
- < read-only
- > write-only
- a append
- + read and write
- s socket
- | pipe
- I IMPLICIT
- # NUMERIC
- space closed handle
- \0 closed internal handle
-
=item IoFLAGS
-=item IsSTD
-
-Takes one argument ( 'stdin' | 'stdout' | 'stderr' ) and returns true
-if the IoIFP of the object is equal to the handle whose name was
-passed as argument; i.e., $io->IsSTD('stderr') is true if
-IoIFP($io) == PerlIO_stderr().
-
=back
-=head2 B::AV Methods
+=head2 B::AV METHODS
=over 4
@@ -967,27 +498,15 @@ IoIFP($io) == PerlIO_stderr().
=item MAX
-=item ARRAY
-
-=item ARRAYelt
-
-Like C<ARRAY>, but takes an index as an argument to get only one element,
-rather than a list of all of them.
-
=item OFF
-This method is deprecated if running under Perl 5.8, and is no longer present
-if running under Perl 5.9
+=item ARRAY
=item AvFLAGS
-This method returns the AV specific
-flags. In Perl 5.9 these are now stored
-in with the main SV flags, so this method is no longer present.
-
=back
-=head2 B::CV Methods
+=head2 B::CV METHODS
=over 4
@@ -999,36 +518,23 @@ in with the main SV flags, so this method is no longer present.
=item GV
-=item FILE
+=item FILEGV
=item DEPTH
=item PADLIST
-Returns a B::PADLIST object under Perl 5.18 or higher, or a B::AV in
-earlier versions.
-
=item OUTSIDE
-=item OUTSIDE_SEQ
-
=item XSUB
=item XSUBANY
-For constant subroutines, returns the constant SV returned by the subroutine.
-
=item CvFLAGS
-=item const_sv
-
-=item NAME_HEK
-
-Returns the name of a lexical sub, otherwise C<undef>.
-
=back
-=head2 B::HV Methods
+=head2 B::HV METHODS
=over 4
@@ -1042,46 +548,23 @@ Returns the name of a lexical sub, otherwise C<undef>.
=item NAME
-=item ARRAY
-
=item PMROOT
-This method is not present if running under Perl 5.9, as the PMROOT
-information is no longer stored directly in the hash.
+=item ARRAY
=back
=head2 OP-RELATED CLASSES
-C<B::OP>, C<B::UNOP>, C<B::BINOP>, C<B::LOGOP>, C<B::LISTOP>, C<B::PMOP>,
-C<B::SVOP>, C<B::PADOP>, C<B::PVOP>, C<B::LOOP>, C<B::COP>.
-
-These classes correspond in the obvious way to the underlying C
-structures of similar names. The inheritance hierarchy mimics the
-underlying C "inheritance":
+B::OP, B::UNOP, B::BINOP, B::LOGOP, B::CONDOP, B::LISTOP, B::PMOP,
+B::SVOP, B::GVOP, B::PVOP, B::CVOP, B::LOOP, B::COP.
+These classes correspond in
+the obvious way to the underlying C structures of similar names. The
+inheritance hierarchy mimics the underlying C "inheritance". Access
+methods correspond to the underlying C structre field names, with the
+leading "class indication" prefix removed (op_).
- B::OP
- |
- +---------------+--------+--------+-------+
- | | | | |
- B::UNOP B::SVOP B::PADOP B::COP B::PVOP
- ,' `-.
- / `--.
- B::BINOP B::LOGOP
- |
- |
- B::LISTOP
- ,' `.
- / \
- B::LOOP B::PMOP
-
-Access methods correspond to the underlying C structure field names,
-with the leading "class indication" prefix (C<"op_">) removed.
-
-=head2 B::OP Methods
-
-These methods get the values of similarly named fields within the OP
-data structure. See top of C<op.h> for more info.
+=head2 B::OP METHODS
=over 4
@@ -1089,14 +572,9 @@ data structure. See top of C<op.h> for more info.
=item sibling
-=item name
-
-This returns the op name as a string (e.g. "add", "rv2av").
-
=item ppaddr
-This returns the function name as a string (e.g. "PL_ppaddr[OP_ADD]",
-"PL_ppaddr[OP_RV2AV]").
+This returns the function name as a string (e.g. pp_add, pp_rv2av).
=item desc
@@ -1107,14 +585,12 @@ This returns the op description from the global C PL_op_desc array
=item type
-=item opt
+=item seq
=item flags
=item private
-=item spare
-
=back
=head2 B::UNOP METHOD
@@ -1141,6 +617,16 @@ This returns the op description from the global C PL_op_desc array
=back
+=head2 B::CONDOP METHODS
+
+=over 4
+
+=item true
+
+=item false
+
+=back
+
=head2 B::LISTOP METHOD
=over 4
@@ -1149,7 +635,7 @@ This returns the op description from the global C PL_op_desc array
=back
-=head2 B::PMOP Methods
+=head2 B::PMOP METHODS
=over 4
@@ -1159,24 +645,14 @@ This returns the op description from the global C PL_op_desc array
=item pmnext
-Only up to Perl 5.9.4
+=item pmregexp
=item pmflags
-=item extflags
-
-Since Perl 5.9.5
+=item pmpermflags
=item precomp
-=item pmoffset
-
-Only when perl was compiled with ithreads.
-
-=item code_list
-
-Since perl 5.17.1
-
=back
=head2 B::SVOP METHOD
@@ -1185,15 +661,13 @@ Since perl 5.17.1
=item sv
-=item gv
-
=back
-=head2 B::PADOP METHOD
+=head2 B::GVOP METHOD
=over 4
-=item padix
+=item gv
=back
@@ -1205,7 +679,7 @@ Since perl 5.17.1
=back
-=head2 B::LOOP Methods
+=head2 B::LOOP METHODS
=over 4
@@ -1217,7 +691,7 @@ Since perl 5.17.1
=back
-=head2 B::COP Methods
+=head2 B::COP METHODS
=over 4
@@ -1225,11 +699,7 @@ Since perl 5.17.1
=item stash
-=item stashpv
-
-=item stashoff (threaded only)
-
-=item file
+=item filegv
=item cop_seq
@@ -1237,63 +707,122 @@ Since perl 5.17.1
=item line
-=item warnings
+=back
-=item io
+=head1 FUNCTIONS EXPORTED BY C<B>
-=item hints
+The C<B> module exports a variety of functions: some are simple
+utility functions, others provide a Perl program with a way to
+get an initial "handle" on an internal object.
-=item hints_hash
+=over 4
-=back
+=item main_cv
-=head2 OTHER CLASSES
+Return the (faked) CV corresponding to the main part of the Perl
+program.
-Perl 5.18 introduces a new class, B::PADLIST, returned by B::CV's
-C<PADLIST> method.
+=item init_av
-=head2 B::PADLIST Methods
+Returns the AV object (i.e. in class B::AV) representing INIT blocks.
-=over 4
+=item main_root
-=item MAX
+Returns the root op (i.e. an object in the appropriate B::OP-derived
+class) of the main part of the Perl program.
-=item ARRAY
+=item main_start
+
+Returns the starting op of the main part of the Perl program.
-A list of pads. The first one contains the names. These are currently
-B::AV objects, but that is likely to change in future versions.
+=item comppadlist
-=item ARRAYelt
+Returns the AV object (i.e. in class B::AV) of the global comppadlist.
-Like C<ARRAY>, but takes an index as an argument to get only one element,
-rather than a list of all of them.
+=item sv_undef
-=item REFCNT
+Returns the SV object corresponding to the C variable C<sv_undef>.
-=back
+=item sv_yes
-=head2 $B::overlay
+Returns the SV object corresponding to the C variable C<sv_yes>.
-Although the optree is read-only, there is an overlay facility that allows
-you to override what values the various B::*OP methods return for a
-particular op. C<$B::overlay> should be set to reference a two-deep hash:
-indexed by OP address, then method name. Whenever a an op method is
-called, the value in the hash is returned if it exists. This facility is
-used by B::Deparse to "undo" some optimisations. For example:
+=item sv_no
+Returns the SV object corresponding to the C variable C<sv_no>.
- local $B::overlay = {};
- ...
- if ($op->name eq "foo") {
- $B::overlay->{$$op} = {
- name => 'bar',
- next => $op->next->next,
- };
- }
- ...
- $op->name # returns "bar"
- $op->next # returns the next op but one
+=item walkoptree(OP, METHOD)
+
+Does a tree-walk of the syntax tree based at OP and calls METHOD on
+each op it visits. Each node is visited before its children. If
+C<walkoptree_debug> (q.v.) has been called to turn debugging on then
+the method C<walkoptree_debug> is called on each op before METHOD is
+called.
+
+=item walkoptree_debug(DEBUG)
+
+Returns the current debugging flag for C<walkoptree>. If the optional
+DEBUG argument is non-zero, it sets the debugging flag to that. See
+the description of C<walkoptree> above for what the debugging flag
+does.
+=item walksymtable(SYMREF, METHOD, RECURSE)
+
+Walk the symbol table starting at SYMREF and call METHOD on each
+symbol visited. When the walk reached package symbols "Foo::" it
+invokes RECURSE and only recurses into the package if that sub
+returns true.
+
+=item svref_2object(SV)
+
+Takes any Perl variable and turns it into an object in the
+appropriate B::OP-derived or B::SV-derived class. Apart from functions
+such as C<main_root>, this is the primary way to get an initial
+"handle" on a internal perl data structure which can then be followed
+with the other access methods.
+
+=item ppname(OPNUM)
+
+Return the PP function name (e.g. "pp_add") of op number OPNUM.
+
+=item hash(STR)
+
+Returns a string in the form "0x..." representing the value of the
+internal hash function used by perl on string STR.
+
+=item cast_I32(I)
+
+Casts I to the internal I32 type used by that perl.
+
+
+=item minus_c
+
+Does the equivalent of the C<-c> command-line option. Obviously, this
+is only useful in a BEGIN block or else the flag is set too late.
+
+
+=item cstring(STR)
+
+Returns a double-quote-surrounded escaped version of STR which can
+be used as a string in C source code.
+
+=item class(OBJ)
+
+Returns the class of an object without the part of the classname
+preceding the first "::". This is used to turn "B::UNOP" into
+"UNOP" for example.
+
+=item threadsv_names
+
+In a perl compiled for threads, this returns a list of the special
+per-thread threadsv variables.
+
+=item byteload_fh(FILEHANDLE)
+
+Load the contents of FILEHANDLE as bytecode. See documentation for
+the B<Bytecode> module in F<B::Backend> for how to generate bytecode.
+
+=back
=head1 AUTHOR
diff --git a/gnu/usr.bin/perl/ext/B/B.xs b/gnu/usr.bin/perl/ext/B/B.xs
index 1c44857219e..6610ae8d523 100644
--- a/gnu/usr.bin/perl/ext/B/B.xs
+++ b/gnu/usr.bin/perl/ext/B/B.xs
@@ -7,10 +7,19 @@
*
*/
-#define PERL_NO_GET_CONTEXT
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
+#include "INTERN.h"
+
+#ifdef PERL_OBJECT
+#undef op_name
+#undef opargs
+#undef op_desc
+#define op_name (pPerl->Perl_get_op_names())
+#define opargs (pPerl->Perl_get_opargs())
+#define op_desc (pPerl->Perl_get_op_descs())
+#endif
#ifdef PerlIO
typedef PerlIO * InputStream;
@@ -19,31 +28,21 @@ typedef FILE * InputStream;
#endif
-static const char* const svclassnames[] = {
+static char *svclassnames[] = {
"B::NULL",
-#if PERL_VERSION < 19
- "B::BIND",
-#endif
"B::IV",
"B::NV",
-#if PERL_VERSION <= 10
"B::RV",
-#endif
"B::PV",
-#if PERL_VERSION >= 19
- "B::INVLIST",
-#endif
"B::PVIV",
"B::PVNV",
"B::PVMG",
-#if PERL_VERSION >= 11
- "B::REGEXP",
-#endif
- "B::GV",
+ "B::BM",
"B::PVLV",
"B::AV",
"B::HV",
"B::CV",
+ "B::GV",
"B::FM",
"B::IO",
};
@@ -54,62 +53,39 @@ typedef enum {
OPc_UNOP, /* 2 */
OPc_BINOP, /* 3 */
OPc_LOGOP, /* 4 */
- OPc_LISTOP, /* 5 */
- OPc_PMOP, /* 6 */
- OPc_SVOP, /* 7 */
- OPc_PADOP, /* 8 */
- OPc_PVOP, /* 9 */
- OPc_LOOP, /* 10 */
- OPc_COP /* 11 */
+ OPc_CONDOP, /* 5 */
+ OPc_LISTOP, /* 6 */
+ OPc_PMOP, /* 7 */
+ OPc_SVOP, /* 8 */
+ OPc_GVOP, /* 9 */
+ OPc_PVOP, /* 10 */
+ OPc_CVOP, /* 11 */
+ OPc_LOOP, /* 12 */
+ OPc_COP /* 13 */
} opclass;
-static const char* const opclassnames[] = {
+static char *opclassnames[] = {
"B::NULL",
"B::OP",
"B::UNOP",
"B::BINOP",
"B::LOGOP",
+ "B::CONDOP",
"B::LISTOP",
"B::PMOP",
"B::SVOP",
- "B::PADOP",
+ "B::GVOP",
"B::PVOP",
+ "B::CVOP",
"B::LOOP",
"B::COP"
};
-static const size_t opsizes[] = {
- 0,
- sizeof(OP),
- sizeof(UNOP),
- sizeof(BINOP),
- sizeof(LOGOP),
- sizeof(LISTOP),
- sizeof(PMOP),
- sizeof(SVOP),
- sizeof(PADOP),
- sizeof(PVOP),
- sizeof(LOOP),
- sizeof(COP)
-};
-
-#define MY_CXT_KEY "B::_guts" XS_VERSION
-
-typedef struct {
- int x_walkoptree_debug; /* Flag for walkoptree debug hook */
- SV * x_specialsv_list[7];
-} my_cxt_t;
-
-START_MY_CXT
-
-#define walkoptree_debug (MY_CXT.x_walkoptree_debug)
-#define specialsv_list (MY_CXT.x_specialsv_list)
+static int walkoptree_debug = 0; /* Flag for walkoptree debug hook */
static opclass
-cc_opclass(pTHX_ const OP *o)
+cc_opclass(OP *o)
{
- bool custom = 0;
-
if (!o)
return OPc_NULL;
@@ -119,29 +95,7 @@ cc_opclass(pTHX_ const OP *o)
if (o->op_type == OP_SASSIGN)
return ((o->op_private & OPpASSIGN_BACKWARDS) ? OPc_UNOP : OPc_BINOP);
- if (o->op_type == OP_AELEMFAST) {
-#if PERL_VERSION <= 14
- if (o->op_flags & OPf_SPECIAL)
- return OPc_BASEOP;
- else
-#endif
-#ifdef USE_ITHREADS
- return OPc_PADOP;
-#else
- return OPc_SVOP;
-#endif
- }
-
-#ifdef USE_ITHREADS
- if (o->op_type == OP_GV || o->op_type == OP_GVSV ||
- o->op_type == OP_RCATLINE)
- return OPc_PADOP;
-#endif
-
- if (o->op_type == OP_CUSTOM)
- custom = 1;
-
- switch (OP_CLASS(o)) {
+ switch (opargs[o->op_type] & OA_CLASS_MASK) {
case OA_BASEOP:
return OPc_BASEOP;
@@ -154,6 +108,9 @@ cc_opclass(pTHX_ const OP *o)
case OA_LOGOP:
return OPc_LOGOP;
+ case OA_CONDOP:
+ return OPc_CONDOP;
+
case OA_LISTOP:
return OPc_LISTOP;
@@ -163,26 +120,11 @@ cc_opclass(pTHX_ const OP *o)
case OA_SVOP:
return OPc_SVOP;
- case OA_PADOP:
- return OPc_PADOP;
-
- case OA_PVOP_OR_SVOP:
- /*
- * Character translations (tr///) are usually a PVOP, keeping a
- * pointer to a table of shorts used to look up translations.
- * Under utf8, however, a simple table isn't practical; instead,
- * the OP is an SVOP (or, under threads, a PADOP),
- * and the SV is a reference to a swash
- * (i.e., an RV pointing to an HV).
- */
- return (!custom &&
- (o->op_private & (OPpTRANS_TO_UTF|OPpTRANS_FROM_UTF))
- )
-#if defined(USE_ITHREADS)
- ? OPc_PADOP : OPc_PVOP;
-#else
- ? OPc_SVOP : OPc_PVOP;
-#endif
+ case OA_GVOP:
+ return OPc_GVOP;
+
+ case OA_PVOP:
+ return OPc_PVOP;
case OA_LOOP:
return OPc_LOOP;
@@ -208,14 +150,11 @@ cc_opclass(pTHX_ const OP *o)
* return OPc_UNOP so that walkoptree can find our children. If
* OPf_KIDS is not set then we check OPf_REF. Without OPf_REF set
* (no argument to the operator) it's an OP; with OPf_REF set it's
- * an SVOP (and op_sv is the GV for the filehandle argument).
+ * a GVOP (and op_gv is the GV for the filehandle argument).
*/
return ((o->op_flags & OPf_KIDS) ? OPc_UNOP :
-#ifdef USE_ITHREADS
- (o->op_flags & OPf_REF) ? OPc_PADOP : OPc_BASEOP);
-#else
- (o->op_flags & OPf_REF) ? OPc_SVOP : OPc_BASEOP);
-#endif
+ (o->op_flags & OPf_REF) ? OPc_GVOP : OPc_BASEOP);
+
case OA_LOOPEXOP:
/*
* next, last, redo, dump and goto use OPf_SPECIAL to indicate that a
@@ -234,355 +173,243 @@ cc_opclass(pTHX_ const OP *o)
return OPc_PVOP;
}
warn("can't determine class of operator %s, assuming BASEOP\n",
- OP_NAME(o));
+ op_name[o->op_type]);
return OPc_BASEOP;
}
-static SV *
-make_op_object(pTHX_ const OP *o)
-{
- SV *opsv = sv_newmortal();
- sv_setiv(newSVrv(opsv, opclassnames[cc_opclass(aTHX_ o)]), PTR2IV(o));
- return opsv;
-}
-
-
-static SV *
-get_overlay_object(pTHX_ const OP *o, const char * const name, U32 namelen)
+static char *
+cc_opclassname(OP *o)
{
- HE *he;
- SV **svp;
- SV *key;
- SV *sv =get_sv("B::overlay", 0);
- if (!sv || !SvROK(sv))
- return NULL;
- sv = SvRV(sv);
- if (SvTYPE(sv) != SVt_PVHV)
- return NULL;
- key = newSViv(PTR2IV(o));
- he = hv_fetch_ent((HV*)sv, key, 0, 0);
- SvREFCNT_dec(key);
- if (!he)
- return NULL;
- sv = HeVAL(he);
- if (!sv || !SvROK(sv))
- return NULL;
- sv = SvRV(sv);
- if (SvTYPE(sv) != SVt_PVHV)
- return NULL;
- svp = hv_fetch((HV*)sv, name, namelen, 0);
- if (!svp)
- return NULL;
- sv = *svp;
- return sv;
+ return opclassnames[cc_opclass(o)];
}
-
static SV *
-make_sv_object(pTHX_ SV *sv)
+make_sv_object(SV *arg, SV *sv)
{
- SV *const arg = sv_newmortal();
- const char *type = 0;
+ char *type = 0;
IV iv;
- dMY_CXT;
-
- for (iv = 0; iv < (IV)(sizeof(specialsv_list)/sizeof(SV*)); iv++) {
- if (sv == specialsv_list[iv]) {
+
+ for (iv = 0; iv < sizeof(PL_specialsv_list)/sizeof(SV*); iv++) {
+ if (sv == PL_specialsv_list[iv]) {
type = "B::SPECIAL";
break;
}
}
if (!type) {
type = svclassnames[SvTYPE(sv)];
- iv = PTR2IV(sv);
+ iv = (IV)sv;
}
sv_setiv(newSVrv(arg, type), iv);
return arg;
}
static SV *
-make_temp_object(pTHX_ SV *temp)
+make_mg_object(SV *arg, MAGIC *mg)
{
- SV *target;
- SV *arg = sv_newmortal();
- const char *const type = svclassnames[SvTYPE(temp)];
- const IV iv = PTR2IV(temp);
-
- target = newSVrv(arg, type);
- sv_setiv(target, iv);
-
- /* Need to keep our "temp" around as long as the target exists.
- Simplest way seems to be to hang it from magic, and let that clear
- it up. No vtable, so won't actually get in the way of anything. */
- sv_magicext(target, temp, PERL_MAGIC_sv, NULL, NULL, 0);
- /* magic object has had its reference count increased, so we must drop
- our reference. */
- SvREFCNT_dec(temp);
+ sv_setiv(newSVrv(arg, "B::MAGIC"), (IV)mg);
return arg;
}
static SV *
-make_warnings_object(pTHX_ const COP *const cop)
-{
- const STRLEN *const warnings = cop->cop_warnings;
- const char *type = 0;
- dMY_CXT;
- IV iv = sizeof(specialsv_list)/sizeof(SV*);
-
- /* Counting down is deliberate. Before the split between make_sv_object
- and make_warnings_obj there appeared to be a bug - Nullsv and pWARN_STD
- were both 0, so you could never get a B::SPECIAL for pWARN_STD */
-
- while (iv--) {
- if ((SV*)warnings == specialsv_list[iv]) {
- type = "B::SPECIAL";
- break;
- }
- }
- if (type) {
- SV *arg = sv_newmortal();
- sv_setiv(newSVrv(arg, type), iv);
- return arg;
- } else {
- /* B assumes that warnings are a regular SV. Seems easier to keep it
- happy by making them into a regular SV. */
- return make_temp_object(aTHX_ newSVpvn((char *)(warnings + 1), *warnings));
- }
-}
-
-static SV *
-make_cop_io_object(pTHX_ COP *cop)
+cstring(SV *sv)
{
- SV *const value = newSV(0);
-
- Perl_emulate_cop_io(aTHX_ cop, value);
-
- if(SvOK(value)) {
- return make_sv_object(aTHX_ value);
- } else {
- SvREFCNT_dec(value);
- return make_sv_object(aTHX_ NULL);
- }
-}
-
-static SV *
-make_mg_object(pTHX_ MAGIC *mg)
-{
- SV *arg = sv_newmortal();
- sv_setiv(newSVrv(arg, "B::MAGIC"), PTR2IV(mg));
- return arg;
-}
-
-static SV *
-cstring(pTHX_ SV *sv, bool perlstyle)
-{
- SV *sstr;
+ SV *sstr = newSVpv("", 0);
+ STRLEN len;
+ char *s;
if (!SvOK(sv))
- return newSVpvs_flags("0", SVs_TEMP);
-
- sstr = newSVpvs_flags("\"", SVs_TEMP);
-
- if (perlstyle && SvUTF8(sv)) {
- SV *tmpsv = sv_newmortal(); /* Temporary SV to feed sv_uni_display */
- const STRLEN len = SvCUR(sv);
- const char *s = sv_uni_display(tmpsv, sv, 8*len, UNI_DISPLAY_QQ);
- while (*s)
- {
- if (*s == '"')
- sv_catpvs(sstr, "\\\"");
- else if (*s == '$')
- sv_catpvs(sstr, "\\$");
- else if (*s == '@')
- sv_catpvs(sstr, "\\@");
- else if (*s == '\\')
- {
- if (strchr("nrftax\\",*(s+1)))
- sv_catpvn(sstr, s++, 2);
- else
- sv_catpvs(sstr, "\\\\");
- }
- else /* should always be printable */
- sv_catpvn(sstr, s, 1);
- ++s;
- }
- }
+ sv_setpvn(sstr, "0", 1);
else
{
/* XXX Optimise? */
- STRLEN len;
- const char *s = SvPV(sv, len);
+ s = SvPV(sv, len);
+ sv_catpv(sstr, "\"");
for (; len; len--, s++)
{
/* At least try a little for readability */
if (*s == '"')
- sv_catpvs(sstr, "\\\"");
+ sv_catpv(sstr, "\\\"");
else if (*s == '\\')
- sv_catpvs(sstr, "\\\\");
- /* trigraphs - bleagh */
- else if (!perlstyle && *s == '?' && len>=3 && s[1] == '?') {
- Perl_sv_catpvf(aTHX_ sstr, "\\%03o", '?');
- }
- else if (perlstyle && *s == '$')
- sv_catpvs(sstr, "\\$");
- else if (perlstyle && *s == '@')
- sv_catpvs(sstr, "\\@");
- else if (isPRINT(*s))
+ sv_catpv(sstr, "\\\\");
+ else if (*s >= ' ' && *s < 127) /* XXX not portable */
sv_catpvn(sstr, s, 1);
else if (*s == '\n')
- sv_catpvs(sstr, "\\n");
+ sv_catpv(sstr, "\\n");
else if (*s == '\r')
- sv_catpvs(sstr, "\\r");
+ sv_catpv(sstr, "\\r");
else if (*s == '\t')
- sv_catpvs(sstr, "\\t");
+ sv_catpv(sstr, "\\t");
else if (*s == '\a')
- sv_catpvs(sstr, "\\a");
+ sv_catpv(sstr, "\\a");
else if (*s == '\b')
- sv_catpvs(sstr, "\\b");
+ sv_catpv(sstr, "\\b");
else if (*s == '\f')
- sv_catpvs(sstr, "\\f");
- else if (!perlstyle && *s == '\v')
- sv_catpvs(sstr, "\\v");
+ sv_catpv(sstr, "\\f");
+ else if (*s == '\v')
+ sv_catpv(sstr, "\\v");
else
{
+ /* no trigraph support */
+ char escbuff[5]; /* to fit backslash, 3 octals + trailing \0 */
/* Don't want promotion of a signed -1 char in sprintf args */
- const unsigned char c = (unsigned char) *s;
- Perl_sv_catpvf(aTHX_ sstr, "\\%03o", c);
+ unsigned char c = (unsigned char) *s;
+ sprintf(escbuff, "\\%03o", c);
+ sv_catpv(sstr, escbuff);
}
/* XXX Add line breaks if string is long */
}
+ sv_catpv(sstr, "\"");
}
- sv_catpvs(sstr, "\"");
return sstr;
}
static SV *
-cchar(pTHX_ SV *sv)
+cchar(SV *sv)
{
- SV *sstr = newSVpvs_flags("'", SVs_TEMP);
- const char *s = SvPV_nolen(sv);
- /* Don't want promotion of a signed -1 char in sprintf args */
- const unsigned char c = (unsigned char) *s;
-
- if (c == '\'')
- sv_catpvs(sstr, "\\'");
- else if (c == '\\')
- sv_catpvs(sstr, "\\\\");
- else if (isPRINT(c))
+ SV *sstr = newSVpv("'", 0);
+ STRLEN n_a;
+ char *s = SvPV(sv, n_a);
+
+ if (*s == '\'')
+ sv_catpv(sstr, "\\'");
+ else if (*s == '\\')
+ sv_catpv(sstr, "\\\\");
+ else if (*s >= ' ' && *s < 127) /* XXX not portable */
sv_catpvn(sstr, s, 1);
- else if (c == '\n')
- sv_catpvs(sstr, "\\n");
- else if (c == '\r')
- sv_catpvs(sstr, "\\r");
- else if (c == '\t')
- sv_catpvs(sstr, "\\t");
- else if (c == '\a')
- sv_catpvs(sstr, "\\a");
- else if (c == '\b')
- sv_catpvs(sstr, "\\b");
- else if (c == '\f')
- sv_catpvs(sstr, "\\f");
- else if (c == '\v')
- sv_catpvs(sstr, "\\v");
+ else if (*s == '\n')
+ sv_catpv(sstr, "\\n");
+ else if (*s == '\r')
+ sv_catpv(sstr, "\\r");
+ else if (*s == '\t')
+ sv_catpv(sstr, "\\t");
+ else if (*s == '\a')
+ sv_catpv(sstr, "\\a");
+ else if (*s == '\b')
+ sv_catpv(sstr, "\\b");
+ else if (*s == '\f')
+ sv_catpv(sstr, "\\f");
+ else if (*s == '\v')
+ sv_catpv(sstr, "\\v");
else
- Perl_sv_catpvf(aTHX_ sstr, "\\%03o", c);
- sv_catpvs(sstr, "'");
+ {
+ /* no trigraph support */
+ char escbuff[5]; /* to fit backslash, 3 octals + trailing \0 */
+ /* Don't want promotion of a signed -1 char in sprintf args */
+ unsigned char c = (unsigned char) *s;
+ sprintf(escbuff, "\\%03o", c);
+ sv_catpv(sstr, escbuff);
+ }
+ sv_catpv(sstr, "'");
return sstr;
}
-#define PMOP_pmreplstart(o) o->op_pmstashstartu.op_pmreplstart
-#define PMOP_pmreplroot(o) o->op_pmreplrootu.op_pmreplroot
+#ifdef INDIRECT_BGET_MACROS
+void freadpv(U32 len, void *data)
+{
+ New(666, pv.xpv_pv, len, char);
+ fread(pv.xpv_pv, 1, len, (FILE*)data);
+ pv.xpv_len = len;
+ pv.xpv_cur = len - 1;
+}
-static SV *
-walkoptree(pTHX_ OP *o, const char *method, SV *ref)
+void byteload_fh(InputStream fp)
{
- dSP;
- OP *kid;
- SV *object;
- const char *const classname = opclassnames[cc_opclass(aTHX_ o)];
- dMY_CXT;
-
- /* Check that no-one has changed our reference, or is holding a reference
- to it. */
- if (SvREFCNT(ref) == 1 && SvROK(ref) && SvTYPE(ref) == SVt_RV
- && (object = SvRV(ref)) && SvREFCNT(object) == 1
- && SvTYPE(object) == SVt_PVMG && SvIOK_only(object)
- && !SvMAGICAL(object) && !SvMAGIC(object) && SvSTASH(object)) {
- /* Looks good, so rebless it for the class we need: */
- sv_bless(ref, gv_stashpv(classname, GV_ADD));
- } else {
- /* Need to make a new one. */
- ref = sv_newmortal();
- object = newSVrv(ref, classname);
- }
- sv_setiv(object, PTR2IV(o));
+ struct bytestream bs;
+ bs.data = fp;
+ bs.fgetc = (int(*) _((void*)))fgetc;
+ bs.fread = (int(*) _((char*,size_t,size_t,void*)))fread;
+ bs.freadpv = freadpv;
+ byterun(bs);
+}
+
+static int fgetc_fromstring(void *data)
+{
+ char **strp = (char **)data;
+ return *(*strp)++;
+}
+
+static int fread_fromstring(char *argp, size_t elemsize, size_t nelem,
+ void *data)
+{
+ char **strp = (char **)data;
+ size_t len = elemsize * nelem;
+
+ memcpy(argp, *strp, len);
+ *strp += len;
+ return (int)len;
+}
+static void freadpv_fromstring(U32 len, void *data)
+{
+ char **strp = (char **)data;
+
+ New(666, pv.xpv_pv, len, char);
+ memcpy(pv.xpv_pv, *strp, len);
+ pv.xpv_len = len;
+ pv.xpv_cur = len - 1;
+ *strp += len;
+}
+
+void byteload_string(char *str)
+{
+ struct bytestream bs;
+ bs.data = &str;
+ bs.fgetc = fgetc_fromstring;
+ bs.fread = fread_fromstring;
+ bs.freadpv = freadpv_fromstring;
+ byterun(bs);
+}
+#else
+void byteload_fh(InputStream fp)
+{
+ byterun(fp);
+}
+
+void byteload_string(char *str)
+{
+ croak("Must compile with -DINDIRECT_BGET_MACROS for byteload_string");
+}
+#endif /* INDIRECT_BGET_MACROS */
+
+void
+walkoptree(SV *opsv, char *method)
+{
+ dSP;
+ OP *o;
+
+ if (!SvROK(opsv))
+ croak("opsv is not a reference");
+ opsv = sv_mortalcopy(opsv);
+ o = (OP*)SvIV((SV*)SvRV(opsv));
if (walkoptree_debug) {
PUSHMARK(sp);
- XPUSHs(ref);
+ XPUSHs(opsv);
PUTBACK;
perl_call_method("walkoptree_debug", G_DISCARD);
}
PUSHMARK(sp);
- XPUSHs(ref);
+ XPUSHs(opsv);
PUTBACK;
perl_call_method(method, G_DISCARD);
if (o && (o->op_flags & OPf_KIDS)) {
+ OP *kid;
for (kid = ((UNOP*)o)->op_first; kid; kid = kid->op_sibling) {
- ref = walkoptree(aTHX_ kid, method, ref);
- }
- }
- if (o && (cc_opclass(aTHX_ o) == OPc_PMOP) && o->op_type != OP_PUSHRE
- && (kid = PMOP_pmreplroot(cPMOPo)))
- {
- ref = walkoptree(aTHX_ kid, method, ref);
- }
- return ref;
-}
-
-static SV **
-oplist(pTHX_ OP *o, SV **SP)
-{
- for(; o; o = o->op_next) {
- if (o->op_opt == 0)
- break;
- o->op_opt = 0;
- XPUSHs(make_op_object(aTHX_ o));
- switch (o->op_type) {
- case OP_SUBST:
- SP = oplist(aTHX_ PMOP_pmreplstart(cPMOPo), SP);
- continue;
- case OP_SORT:
- if (o->op_flags & OPf_STACKED && o->op_flags & OPf_SPECIAL) {
- OP *kid = cLISTOPo->op_first->op_sibling; /* pass pushmark */
- kid = kUNOP->op_first; /* pass rv2gv */
- kid = kUNOP->op_first; /* pass leave */
- SP = oplist(aTHX_ kid->op_next, SP);
- }
- continue;
- }
- switch (PL_opargs[o->op_type] & OA_CLASS_MASK) {
- case OA_LOGOP:
- SP = oplist(aTHX_ cLOGOPo->op_other, SP);
- break;
- case OA_LOOP:
- SP = oplist(aTHX_ cLOOPo->op_lastop, SP);
- SP = oplist(aTHX_ cLOOPo->op_nextop, SP);
- SP = oplist(aTHX_ cLOOPo->op_redoop, SP);
- break;
+ /* Use the same opsv. Rely on methods not to mess it up. */
+ sv_setiv(newSVrv(opsv, cc_opclassname(kid)), (IV)kid);
+ walkoptree(opsv, method);
}
}
- return SP;
}
typedef OP *B__OP;
typedef UNOP *B__UNOP;
typedef BINOP *B__BINOP;
typedef LOGOP *B__LOGOP;
+typedef CONDOP *B__CONDOP;
typedef LISTOP *B__LISTOP;
typedef PMOP *B__PMOP;
typedef SVOP *B__SVOP;
-typedef PADOP *B__PADOP;
+typedef GVOP *B__GVOP;
typedef PVOP *B__PVOP;
typedef LOOP *B__LOOP;
typedef COP *B__COP;
@@ -592,13 +419,9 @@ typedef SV *B__IV;
typedef SV *B__PV;
typedef SV *B__NV;
typedef SV *B__PVMG;
-#if PERL_VERSION >= 11
-typedef SV *B__REGEXP;
-#endif
typedef SV *B__PVLV;
typedef SV *B__BM;
typedef SV *B__RV;
-typedef SV *B__FM;
typedef AV *B__AV;
typedef HV *B__HV;
typedef CV *B__CV;
@@ -606,315 +429,116 @@ typedef GV *B__GV;
typedef IO *B__IO;
typedef MAGIC *B__MAGIC;
-typedef HE *B__HE;
-typedef struct refcounted_he *B__RHE;
-#ifdef PadlistARRAY
-typedef PADLIST *B__PADLIST;
-#endif
-
-#ifdef MULTIPLICITY
-# define ASSIGN_COMMON_ALIAS(prefix, var) \
- STMT_START { XSANY.any_i32 = offsetof(struct interpreter, prefix##var); } STMT_END
-#else
-# define ASSIGN_COMMON_ALIAS(prefix, var) \
- STMT_START { XSANY.any_ptr = (void *)&PL_##var; } STMT_END
-#endif
-
-/* This needs to be ALIASed in a custom way, hence can't easily be defined as
- a regular XSUB. */
-static XSPROTO(intrpvar_sv_common); /* prototype to pass -Wmissing-prototypes */
-static XSPROTO(intrpvar_sv_common)
-{
- dVAR;
- dXSARGS;
- SV *ret;
- if (items != 0)
- croak_xs_usage(cv, "");
-#ifdef MULTIPLICITY
- ret = *(SV **)(XSANY.any_i32 + (char *)my_perl);
-#else
- ret = *(SV **)(XSANY.any_ptr);
-#endif
- ST(0) = make_sv_object(aTHX_ ret);
- XSRETURN(1);
-}
+MODULE = B PACKAGE = B PREFIX = B_
+PROTOTYPES: DISABLE
-#define SVp 0x0
-#define U32p 0x1
-#define line_tp 0x2
-#define OPp 0x3
-#define PADOFFSETp 0x4
-#define U8p 0x5
-#define IVp 0x6
-#define char_pp 0x7
-/* Keep this last: */
-#define op_offset_special 0x8
-
-/* table that drives most of the B::*OP methods */
-
-struct OP_methods {
- const char *name;
- U8 namelen;
- U8 type; /* if op_offset_special, access is handled on a case-by-case basis */
- U16 offset;
-} op_methods[] = {
- { STR_WITH_LEN("next"), OPp, offsetof(struct op, op_next), },/* 0*/
- { STR_WITH_LEN("sibling"), OPp, offsetof(struct op, op_sibling), },/* 1*/
- { STR_WITH_LEN("targ"), PADOFFSETp, offsetof(struct op, op_targ), },/* 2*/
- { STR_WITH_LEN("flags"), U8p, offsetof(struct op, op_flags), },/* 3*/
- { STR_WITH_LEN("private"), U8p, offsetof(struct op, op_private), },/* 4*/
- { STR_WITH_LEN("first"), OPp, offsetof(struct unop, op_first), },/* 5*/
- { STR_WITH_LEN("last"), OPp, offsetof(struct binop, op_last), },/* 6*/
- { STR_WITH_LEN("other"), OPp, offsetof(struct logop, op_other), },/* 7*/
- { STR_WITH_LEN("pmreplstart"), op_offset_special, 0, },/* 8*/
- { STR_WITH_LEN("redoop"), OPp, offsetof(struct loop, op_redoop), },/* 9*/
- { STR_WITH_LEN("nextop"), OPp, offsetof(struct loop, op_nextop), },/*10*/
- { STR_WITH_LEN("lastop"), OPp, offsetof(struct loop, op_lastop), },/*11*/
- { STR_WITH_LEN("pmflags"), U32p, offsetof(struct pmop, op_pmflags),},/*12*/
-#if PERL_VERSION >= 17
- { STR_WITH_LEN("code_list"),OPp, offsetof(struct pmop, op_code_list),},/*13*/
-#else
- { STR_WITH_LEN("code_list"),op_offset_special, 0,
-#endif
- { STR_WITH_LEN("sv"), SVp, offsetof(struct svop, op_sv), },/*14*/
- { STR_WITH_LEN("gv"), SVp, offsetof(struct svop, op_sv), },/*15*/
- { STR_WITH_LEN("padix"), PADOFFSETp,offsetof(struct padop, op_padix),},/*16*/
- { STR_WITH_LEN("cop_seq"), U32p, offsetof(struct cop, cop_seq), },/*17*/
- { STR_WITH_LEN("line"), line_tp, offsetof(struct cop, cop_line), },/*18*/
- { STR_WITH_LEN("hints"), U32p, offsetof(struct cop, cop_hints), },/*19*/
-#ifdef USE_ITHREADS
- { STR_WITH_LEN("pmoffset"),IVp, offsetof(struct pmop, op_pmoffset),},/*20*/
- { STR_WITH_LEN("filegv"), op_offset_special, 0, },/*21*/
- { STR_WITH_LEN("file"), char_pp, offsetof(struct cop, cop_file), },/*22*/
- { STR_WITH_LEN("stash"), op_offset_special, 0, },/*23*/
-# if PERL_VERSION < 17
- { STR_WITH_LEN("stashpv"), char_pp, offsetof(struct cop, cop_stashpv),}, /*24*/
- { STR_WITH_LEN("stashoff"),op_offset_special, 0, },/*25*/
-# else
- { STR_WITH_LEN("stashpv"), op_offset_special, 0, },/*24*/
- { STR_WITH_LEN("stashoff"),PADOFFSETp,offsetof(struct cop,cop_stashoff),},/*25*/
-# endif
-#else
- { STR_WITH_LEN("pmoffset"),op_offset_special, 0, },/*20*/
- { STR_WITH_LEN("filegv"), SVp, offsetof(struct cop, cop_filegv),},/*21*/
- { STR_WITH_LEN("file"), op_offset_special, 0, },/*22*/
- { STR_WITH_LEN("stash"), SVp, offsetof(struct cop, cop_stash), },/*23*/
- { STR_WITH_LEN("stashpv"), op_offset_special, 0, },/*24*/
- { STR_WITH_LEN("stashoff"),op_offset_special, 0, },/*25*/
-#endif
- { STR_WITH_LEN("size"), op_offset_special, 0, },/*26*/
- { STR_WITH_LEN("name"), op_offset_special, 0, },/*27*/
- { STR_WITH_LEN("desc"), op_offset_special, 0, },/*28*/
- { STR_WITH_LEN("ppaddr"), op_offset_special, 0, },/*29*/
- { STR_WITH_LEN("type"), op_offset_special, 0, },/*30*/
- { STR_WITH_LEN("opt"), op_offset_special, 0, },/*31*/
- { STR_WITH_LEN("spare"), op_offset_special, 0, },/*32*/
- { STR_WITH_LEN("children"),op_offset_special, 0, },/*33*/
- { STR_WITH_LEN("pmreplroot"), op_offset_special, 0, },/*34*/
- { STR_WITH_LEN("pmstashpv"), op_offset_special, 0, },/*35*/
- { STR_WITH_LEN("pmstash"), op_offset_special, 0, },/*36*/
- { STR_WITH_LEN("precomp"), op_offset_special, 0, },/*37*/
- { STR_WITH_LEN("reflags"), op_offset_special, 0, },/*38*/
- { STR_WITH_LEN("sv"), op_offset_special, 0, },/*39*/
- { STR_WITH_LEN("gv"), op_offset_special, 0, },/*40*/
- { STR_WITH_LEN("pv"), op_offset_special, 0, },/*41*/
- { STR_WITH_LEN("label"), op_offset_special, 0, },/*42*/
- { STR_WITH_LEN("arybase"), op_offset_special, 0, },/*43*/
- { STR_WITH_LEN("warnings"),op_offset_special, 0, },/*44*/
- { STR_WITH_LEN("io"), op_offset_special, 0, },/*45*/
- { STR_WITH_LEN("hints_hash"),op_offset_special, 0, },/*46*/
-#if PERL_VERSION >= 17
- { STR_WITH_LEN("slabbed"), op_offset_special, 0, },/*47*/
- { STR_WITH_LEN("savefree"),op_offset_special, 0, },/*48*/
- { STR_WITH_LEN("static"), op_offset_special, 0, },/*49*/
-# if PERL_VERSION >= 19
- { STR_WITH_LEN("folded"), op_offset_special, 0, },/*50*/
-# endif
-#endif
-};
+BOOT:
+ INIT_SPECIALSV_LIST;
-#include "const-c.inc"
+#define B_main_cv() PL_main_cv
+#define B_init_av() PL_initav
+#define B_main_root() PL_main_root
+#define B_main_start() PL_main_start
+#define B_comppadlist() (PL_main_cv ? CvPADLIST(PL_main_cv) : CvPADLIST(PL_compcv))
+#define B_sv_undef() &PL_sv_undef
+#define B_sv_yes() &PL_sv_yes
+#define B_sv_no() &PL_sv_no
-MODULE = B PACKAGE = B
+B::AV
+B_init_av()
-INCLUDE: const-xs.inc
+B::CV
+B_main_cv()
-PROTOTYPES: DISABLE
+B::OP
+B_main_root()
-BOOT:
-{
- CV *cv;
- const char *file = __FILE__;
- MY_CXT_INIT;
- specialsv_list[0] = Nullsv;
- specialsv_list[1] = &PL_sv_undef;
- specialsv_list[2] = &PL_sv_yes;
- specialsv_list[3] = &PL_sv_no;
- specialsv_list[4] = (SV *) pWARN_ALL;
- specialsv_list[5] = (SV *) pWARN_NONE;
- specialsv_list[6] = (SV *) pWARN_STD;
-
- cv = newXS("B::init_av", intrpvar_sv_common, file);
- ASSIGN_COMMON_ALIAS(I, initav);
- cv = newXS("B::check_av", intrpvar_sv_common, file);
- ASSIGN_COMMON_ALIAS(I, checkav_save);
- cv = newXS("B::unitcheck_av", intrpvar_sv_common, file);
- ASSIGN_COMMON_ALIAS(I, unitcheckav_save);
- cv = newXS("B::begin_av", intrpvar_sv_common, file);
- ASSIGN_COMMON_ALIAS(I, beginav_save);
- cv = newXS("B::end_av", intrpvar_sv_common, file);
- ASSIGN_COMMON_ALIAS(I, endav);
- cv = newXS("B::main_cv", intrpvar_sv_common, file);
- ASSIGN_COMMON_ALIAS(I, main_cv);
- cv = newXS("B::inc_gv", intrpvar_sv_common, file);
- ASSIGN_COMMON_ALIAS(I, incgv);
- cv = newXS("B::defstash", intrpvar_sv_common, file);
- ASSIGN_COMMON_ALIAS(I, defstash);
- cv = newXS("B::curstash", intrpvar_sv_common, file);
- ASSIGN_COMMON_ALIAS(I, curstash);
-#ifdef PL_formfeed
- cv = newXS("B::formfeed", intrpvar_sv_common, file);
- ASSIGN_COMMON_ALIAS(I, formfeed);
-#endif
-#ifdef USE_ITHREADS
- cv = newXS("B::regex_padav", intrpvar_sv_common, file);
- ASSIGN_COMMON_ALIAS(I, regex_padav);
-#endif
- cv = newXS("B::warnhook", intrpvar_sv_common, file);
- ASSIGN_COMMON_ALIAS(I, warnhook);
- cv = newXS("B::diehook", intrpvar_sv_common, file);
- ASSIGN_COMMON_ALIAS(I, diehook);
-}
+B::OP
+B_main_start()
-#ifndef PL_formfeed
-
-void
-formfeed()
- PPCODE:
- PUSHs(make_sv_object(aTHX_ GvSV(gv_fetchpvs("\f", GV_ADD, SVt_PV))));
-
-#endif
+B::AV
+B_comppadlist()
-long
-amagic_generation()
- CODE:
- RETVAL = PL_amagic_generation;
- OUTPUT:
- RETVAL
+B::SV
+B_sv_undef()
-void
-comppadlist()
- PREINIT:
- PADLIST *padlist = CvPADLIST(PL_main_cv ? PL_main_cv : PL_compcv);
- PPCODE:
-#ifdef PadlistARRAY
- {
- SV * const rv = sv_newmortal();
- sv_setiv(newSVrv(rv, padlist ? "B::PADLIST" : "B::NULL"),
- PTR2IV(padlist));
- PUSHs(rv);
- }
-#else
- PUSHs(make_sv_object(aTHX_ (SV *)padlist));
-#endif
+B::SV
+B_sv_yes()
-void
-sv_undef()
- ALIAS:
- sv_no = 1
- sv_yes = 2
- PPCODE:
- PUSHs(make_sv_object(aTHX_ ix > 1 ? &PL_sv_yes
- : ix < 1 ? &PL_sv_undef
- : &PL_sv_no));
+B::SV
+B_sv_no()
-void
-main_root()
- ALIAS:
- main_start = 1
- PPCODE:
- PUSHs(make_op_object(aTHX_ ix ? PL_main_start : PL_main_root));
+MODULE = B PACKAGE = B
-UV
-sub_generation()
- ALIAS:
- dowarn = 1
- CODE:
- RETVAL = ix ? PL_dowarn : PL_sub_generation;
- OUTPUT:
- RETVAL
void
-walkoptree(op, method)
- B::OP op
- const char * method
- CODE:
- (void) walkoptree(aTHX_ op, method, &PL_sv_undef);
+walkoptree(opsv, method)
+ SV * opsv
+ char * method
int
walkoptree_debug(...)
CODE:
- dMY_CXT;
RETVAL = walkoptree_debug;
if (items > 0 && SvTRUE(ST(1)))
walkoptree_debug = 1;
OUTPUT:
RETVAL
-#define address(sv) PTR2IV(sv)
+int
+byteload_fh(fp)
+ InputStream fp
+ CODE:
+ byteload_fh(fp);
+ RETVAL = 1;
+ OUTPUT:
+ RETVAL
+
+void
+byteload_string(str)
+ char * str
+
+#define address(sv) (IV)sv
IV
address(sv)
SV * sv
-void
+B::SV
svref_2object(sv)
SV * sv
- PPCODE:
+ CODE:
if (!SvROK(sv))
croak("argument is not a reference");
- PUSHs(make_sv_object(aTHX_ SvRV(sv)));
-
-void
-opnumber(name)
-const char * name
-CODE:
-{
- int i;
- IV result = -1;
- ST(0) = sv_newmortal();
- if (strncmp(name,"pp_",3) == 0)
- name += 3;
- for (i = 0; i < PL_maxo; i++)
- {
- if (strcmp(name, PL_op_name[i]) == 0)
- {
- result = i;
- break;
- }
- }
- sv_setiv(ST(0),result);
-}
+ RETVAL = (SV*)SvRV(sv);
+ OUTPUT:
+ RETVAL
void
ppname(opnum)
int opnum
CODE:
ST(0) = sv_newmortal();
- if (opnum >= 0 && opnum < PL_maxo)
- Perl_sv_setpvf(aTHX_ ST(0), "pp_%s", PL_op_name[opnum]);
+ if (opnum >= 0 && opnum < PL_maxo) {
+ sv_setpvn(ST(0), "pp_", 3);
+ sv_catpv(ST(0), op_name[opnum]);
+ }
void
hash(sv)
SV * sv
CODE:
+ char *s;
STRLEN len;
U32 hash = 0;
- const char *s = SvPVbyte(sv, len);
- PERL_HASH(hash, s, len);
- ST(0) = sv_2mortal(Perl_newSVpvf(aTHX_ "0x%"UVxf, (UV)hash));
+ char hexhash[11]; /* must fit "0xffffffff" plus trailing \0 */
+ s = SvPV(sv, len);
+ while (len--)
+ hash = hash * 33 + *s++;
+ sprintf(hexhash, "0x%x", hash);
+ ST(0) = sv_2mortal(newSVpv(hexhash, 0));
#define cast_I32(foo) (I32)foo
IV
@@ -923,546 +547,296 @@ cast_I32(i)
void
minus_c()
- ALIAS:
- save_BEGINs = 1
CODE:
- if (ix)
- PL_savebegin = TRUE;
- else
- PL_minus_c = TRUE;
+ PL_minus_c = TRUE;
-void
+SV *
cstring(sv)
SV * sv
- ALIAS:
- perlstring = 1
- cchar = 2
- PPCODE:
- PUSHs(ix == 2 ? cchar(aTHX_ sv) : cstring(aTHX_ sv, (bool)ix));
+
+SV *
+cchar(sv)
+ SV * sv
void
threadsv_names()
PPCODE:
+#ifdef USE_THREADS
+ int i;
+ STRLEN len = strlen(PL_threadsv_names);
+ EXTEND(sp, len);
+ for (i = 0; i < len; i++)
+ PUSHs(sv_2mortal(newSVpv(&PL_threadsv_names[i], 1)));
+#endif
+#define OP_next(o) o->op_next
+#define OP_sibling(o) o->op_sibling
+#define OP_desc(o) op_desc[o->op_type]
+#define OP_targ(o) o->op_targ
+#define OP_type(o) o->op_type
+#define OP_seq(o) o->op_seq
+#define OP_flags(o) o->op_flags
+#define OP_private(o) o->op_private
-MODULE = B PACKAGE = B::OP
+MODULE = B PACKAGE = B::OP PREFIX = OP_
+B::OP
+OP_next(o)
+ B::OP o
-# The type checking code in B has always been identical for all OP types,
-# irrespective of whether the action is actually defined on that OP.
-# We should fix this
-void
-next(o)
+B::OP
+OP_sibling(o)
B::OP o
- ALIAS:
- B::OP::next = 0
- B::OP::sibling = 1
- B::OP::targ = 2
- B::OP::flags = 3
- B::OP::private = 4
- B::UNOP::first = 5
- B::BINOP::last = 6
- B::LOGOP::other = 7
- B::PMOP::pmreplstart = 8
- B::LOOP::redoop = 9
- B::LOOP::nextop = 10
- B::LOOP::lastop = 11
- B::PMOP::pmflags = 12
- B::PMOP::code_list = 13
- B::SVOP::sv = 14
- B::SVOP::gv = 15
- B::PADOP::padix = 16
- B::COP::cop_seq = 17
- B::COP::line = 18
- B::COP::hints = 19
- B::PMOP::pmoffset = 20
- B::COP::filegv = 21
- B::COP::file = 22
- B::COP::stash = 23
- B::COP::stashpv = 24
- B::COP::stashoff = 25
- B::OP::size = 26
- B::OP::name = 27
- B::OP::desc = 28
- B::OP::ppaddr = 29
- B::OP::type = 30
- B::OP::opt = 31
- B::OP::spare = 32
- B::LISTOP::children = 33
- B::PMOP::pmreplroot = 34
- B::PMOP::pmstashpv = 35
- B::PMOP::pmstash = 36
- B::PMOP::precomp = 37
- B::PMOP::reflags = 38
- B::PADOP::sv = 39
- B::PADOP::gv = 40
- B::PVOP::pv = 41
- B::COP::label = 42
- B::COP::arybase = 43
- B::COP::warnings = 44
- B::COP::io = 45
- B::COP::hints_hash = 46
- B::OP::slabbed = 47
- B::OP::savefree = 48
- B::OP::static = 49
- B::OP::folded = 50
- PREINIT:
- SV *ret;
- PPCODE:
- if (ix < 0 || (U32)ix >= C_ARRAY_LENGTH(op_methods))
- croak("Illegal alias %d for B::*OP::next", (int)ix);
- ret = get_overlay_object(aTHX_ o,
- op_methods[ix].name, op_methods[ix].namelen);
- if (ret) {
- ST(0) = ret;
- XSRETURN(1);
- }
- /* handle non-direct field access */
-
- if (op_methods[ix].type == op_offset_special)
- switch (ix) {
- case 8: /* pmreplstart */
- ret = make_op_object(aTHX_
- cPMOPo->op_type == OP_SUBST
- ? cPMOPo->op_pmstashstartu.op_pmreplstart
- : NULL
- );
- break;
-#ifdef USE_ITHREADS
- case 21: /* filegv */
- ret = make_sv_object(aTHX_ (SV *)CopFILEGV((COP*)o));
- break;
-#endif
-#ifndef USE_ITHREADS
- case 22: /* file */
- ret = sv_2mortal(newSVpv(CopFILE((COP*)o), 0));
- break;
-#endif
-#ifdef USE_ITHREADS
- case 23: /* stash */
- ret = make_sv_object(aTHX_ (SV *)CopSTASH((COP*)o));
- break;
-#endif
-#if PERL_VERSION >= 17 || !defined USE_ITHREADS
- case 24: /* stashpv */
-# if PERL_VERSION >= 17
- ret = sv_2mortal(CopSTASH((COP*)o)
- && SvTYPE(CopSTASH((COP*)o)) == SVt_PVHV
- ? newSVhek(HvNAME_HEK(CopSTASH((COP*)o)))
- : &PL_sv_undef);
-# else
- ret = sv_2mortal(newSVpv(CopSTASHPV((COP*)o), 0));
-# endif
- break;
-#endif
- case 26: /* size */
- ret = sv_2mortal(newSVuv((UV)(opsizes[cc_opclass(aTHX_ o)])));
- break;
- case 27: /* name */
- case 28: /* desc */
- ret = sv_2mortal(newSVpv(
- (char *)(ix == 28 ? OP_DESC(o) : OP_NAME(o)), 0));
- break;
- case 29: /* ppaddr */
- {
- int i;
- ret = sv_2mortal(Perl_newSVpvf(aTHX_ "PL_ppaddr[OP_%s]",
- PL_op_name[o->op_type]));
- for (i=13; (STRLEN)i < SvCUR(ret); ++i)
- SvPVX(ret)[i] = toUPPER(SvPVX(ret)[i]);
- }
- break;
- case 30: /* type */
- case 31: /* opt */
- case 32: /* spare */
-#if PERL_VERSION >= 17
- case 47: /* slabbed */
- case 48: /* savefree */
- case 49: /* static */
-#if PERL_VERSION >= 19
- case 50: /* folded */
-#endif
-#endif
- /* These are all bitfields, so we can't take their addresses */
- ret = sv_2mortal(newSVuv((UV)(
- ix == 30 ? o->op_type
- : ix == 31 ? o->op_opt
- : ix == 47 ? o->op_slabbed
- : ix == 48 ? o->op_savefree
- : ix == 49 ? o->op_static
- : ix == 50 ? o->op_folded
- : o->op_spare)));
- break;
- case 33: /* children */
- {
- OP *kid;
- UV i = 0;
- for (kid = ((LISTOP*)o)->op_first; kid; kid = kid->op_sibling)
- i++;
- ret = sv_2mortal(newSVuv(i));
- }
- break;
- case 34: /* pmreplroot */
- if (cPMOPo->op_type == OP_PUSHRE) {
-#ifdef USE_ITHREADS
- ret = sv_newmortal();
- sv_setiv(ret, cPMOPo->op_pmreplrootu.op_pmtargetoff);
-#else
- GV *const target = cPMOPo->op_pmreplrootu.op_pmtargetgv;
- ret = sv_newmortal();
- sv_setiv(newSVrv(ret, target ?
- svclassnames[SvTYPE((SV*)target)] : "B::SV"),
- PTR2IV(target));
-#endif
- }
- else {
- OP *const root = cPMOPo->op_pmreplrootu.op_pmreplroot;
- ret = make_op_object(aTHX_ root);
- }
- break;
-#ifdef USE_ITHREADS
- case 35: /* pmstashpv */
- ret = sv_2mortal(newSVpv(PmopSTASHPV(cPMOPo),0));
- break;
-#else
- case 36: /* pmstash */
- ret = make_sv_object(aTHX_ (SV *) PmopSTASH(cPMOPo));
- break;
-#endif
- case 37: /* precomp */
- case 38: /* reflags */
- {
- REGEXP *rx = PM_GETRE(cPMOPo);
- ret = sv_newmortal();
- if (rx) {
- if (ix==38) {
- sv_setuv(ret, RX_EXTFLAGS(rx));
- }
- else {
- sv_setpvn(ret, RX_PRECOMP(rx), RX_PRELEN(rx));
- if (RX_UTF8(rx))
- SvUTF8_on(ret);
- }
- }
- }
- break;
- case 39: /* sv */
- case 40: /* gv */
- /* It happens that the output typemaps for B::SV and B::GV
- * are identical. The "smarts" are in make_sv_object(),
- * which determines which class to use based on SvTYPE(),
- * rather than anything baked in at compile time. */
- if (cPADOPo->op_padix) {
- ret = PAD_SVl(cPADOPo->op_padix);
- if (ix == 40 && SvTYPE(ret) != SVt_PVGV)
- ret = NULL;
- } else {
- ret = NULL;
- }
- ret = make_sv_object(aTHX_ ret);
- break;
- case 41: /* pv */
- /* OP_TRANS uses op_pv to point to a table of 256 or >=258
- * shorts whereas other PVOPs point to a null terminated
- * string. */
- if ( (cPVOPo->op_type == OP_TRANS
- || cPVOPo->op_type == OP_TRANSR) &&
- (cPVOPo->op_private & OPpTRANS_COMPLEMENT) &&
- !(cPVOPo->op_private & OPpTRANS_DELETE))
- {
- const short* const tbl = (short*)cPVOPo->op_pv;
- const short entries = 257 + tbl[256];
- ret = newSVpvn_flags(cPVOPo->op_pv, entries * sizeof(short), SVs_TEMP);
- }
- else if (cPVOPo->op_type == OP_TRANS || cPVOPo->op_type == OP_TRANSR) {
- ret = newSVpvn_flags(cPVOPo->op_pv, 256 * sizeof(short), SVs_TEMP);
- }
- else
- ret = newSVpvn_flags(cPVOPo->op_pv, strlen(cPVOPo->op_pv), SVs_TEMP);
- break;
- case 42: /* label */
- ret = sv_2mortal(newSVpv(CopLABEL(cCOPo),0));
- break;
- case 43: /* arybase */
- ret = sv_2mortal(newSVuv(0));
- break;
- case 44: /* warnings */
- ret = make_warnings_object(aTHX_ cCOPo);
- break;
- case 45: /* io */
- ret = make_cop_io_object(aTHX_ cCOPo);
- break;
- case 46: /* hints_hash */
- ret = sv_newmortal();
- sv_setiv(newSVrv(ret, "B::RHE"),
- PTR2IV(CopHINTHASH_get(cCOPo)));
- break;
- default:
- croak("method %s not implemented", op_methods[ix].name);
- } else {
- /* do a direct structure offset lookup */
- const char *const ptr = (char *)o + op_methods[ix].offset;
- switch (op_methods[ix].type) {
- case OPp:
- ret = make_op_object(aTHX_ *((OP **)ptr));
- break;
- case PADOFFSETp:
- ret = sv_2mortal(newSVuv(*((PADOFFSET*)ptr)));
- break;
- case U8p:
- ret = sv_2mortal(newSVuv(*((U8*)ptr)));
- break;
- case U32p:
- ret = sv_2mortal(newSVuv(*((U32*)ptr)));
- break;
- case SVp:
- ret = make_sv_object(aTHX_ *((SV **)ptr));
- break;
- case line_tp:
- ret = sv_2mortal(newSVuv(*((line_t *)ptr)));
- break;
- case IVp:
- ret = sv_2mortal(newSViv(*((IV*)ptr)));
- break;
- case char_pp:
- ret = sv_2mortal(newSVpv(*((char **)ptr), 0));
- break;
- default:
- croak("Illegal type 0x%x for B::*OP::%s",
- (unsigned)op_methods[ix].type, op_methods[ix].name);
- }
- }
- ST(0) = ret;
- XSRETURN(1);
+char *
+OP_ppaddr(o)
+ B::OP o
+ CODE:
+ ST(0) = sv_newmortal();
+ sv_setpvn(ST(0), "pp_", 3);
+ sv_catpv(ST(0), op_name[o->op_type]);
+char *
+OP_desc(o)
+ B::OP o
-void
-oplist(o)
+U16
+OP_targ(o)
B::OP o
- PPCODE:
- SP = oplist(aTHX_ o, SP);
+U16
+OP_type(o)
+ B::OP o
+
+U16
+OP_seq(o)
+ B::OP o
+
+U8
+OP_flags(o)
+ B::OP o
+
+U8
+OP_private(o)
+ B::OP o
+
+#define UNOP_first(o) o->op_first
+
+MODULE = B PACKAGE = B::UNOP PREFIX = UNOP_
+
+B::OP
+UNOP_first(o)
+ B::UNOP o
+
+#define BINOP_last(o) o->op_last
+
+MODULE = B PACKAGE = B::BINOP PREFIX = BINOP_
-MODULE = B PACKAGE = B::SV
+B::OP
+BINOP_last(o)
+ B::BINOP o
-#define MAGICAL_FLAG_BITS (SVs_GMG|SVs_SMG|SVs_RMG)
+#define LOGOP_other(o) o->op_other
+
+MODULE = B PACKAGE = B::LOGOP PREFIX = LOGOP_
+
+B::OP
+LOGOP_other(o)
+ B::LOGOP o
+
+#define CONDOP_true(o) o->op_true
+#define CONDOP_false(o) o->op_false
+
+MODULE = B PACKAGE = B::CONDOP PREFIX = CONDOP_
+
+B::OP
+CONDOP_true(o)
+ B::CONDOP o
+
+B::OP
+CONDOP_false(o)
+ B::CONDOP o
+
+#define LISTOP_children(o) o->op_children
+
+MODULE = B PACKAGE = B::LISTOP PREFIX = LISTOP_
U32
-REFCNT(sv)
- B::SV sv
- ALIAS:
- FLAGS = 0xFFFFFFFF
- SvTYPE = SVTYPEMASK
- POK = SVf_POK
- ROK = SVf_ROK
- MAGICAL = MAGICAL_FLAG_BITS
+LISTOP_children(o)
+ B::LISTOP o
+
+#define PMOP_pmreplroot(o) o->op_pmreplroot
+#define PMOP_pmreplstart(o) o->op_pmreplstart
+#define PMOP_pmnext(o) o->op_pmnext
+#define PMOP_pmregexp(o) o->op_pmregexp
+#define PMOP_pmflags(o) o->op_pmflags
+#define PMOP_pmpermflags(o) o->op_pmpermflags
+
+MODULE = B PACKAGE = B::PMOP PREFIX = PMOP_
+
+void
+PMOP_pmreplroot(o)
+ B::PMOP o
+ OP * root = NO_INIT
CODE:
- RETVAL = ix ? (SvFLAGS(sv) & (U32)ix) : SvREFCNT(sv);
- OUTPUT:
- RETVAL
+ ST(0) = sv_newmortal();
+ root = o->op_pmreplroot;
+ /* OP_PUSHRE stores an SV* instead of an OP* in op_pmreplroot */
+ if (o->op_type == OP_PUSHRE) {
+ sv_setiv(newSVrv(ST(0), root ?
+ svclassnames[SvTYPE((SV*)root)] : "B::SV"),
+ (IV)root);
+ }
+ else {
+ sv_setiv(newSVrv(ST(0), cc_opclassname(root)), (IV)root);
+ }
+
+B::OP
+PMOP_pmreplstart(o)
+ B::PMOP o
+
+B::PMOP
+PMOP_pmnext(o)
+ B::PMOP o
+
+U16
+PMOP_pmflags(o)
+ B::PMOP o
+
+U16
+PMOP_pmpermflags(o)
+ B::PMOP o
+
+void
+PMOP_precomp(o)
+ B::PMOP o
+ REGEXP * rx = NO_INIT
+ CODE:
+ ST(0) = sv_newmortal();
+ rx = o->op_pmregexp;
+ if (rx)
+ sv_setpvn(ST(0), rx->precomp, rx->prelen);
+
+#define SVOP_sv(o) o->op_sv
+
+MODULE = B PACKAGE = B::SVOP PREFIX = SVOP_
+
+
+B::SV
+SVOP_sv(o)
+ B::SVOP o
+
+#define GVOP_gv(o) o->op_gv
+
+MODULE = B PACKAGE = B::GVOP PREFIX = GVOP_
+
+
+B::GV
+GVOP_gv(o)
+ B::GVOP o
+
+MODULE = B PACKAGE = B::PVOP PREFIX = PVOP_
void
-object_2svref(sv)
+PVOP_pv(o)
+ B::PVOP o
+ CODE:
+ /*
+ * OP_TRANS uses op_pv to point to a table of 256 shorts
+ * whereas other PVOPs point to a null terminated string.
+ */
+ ST(0) = sv_2mortal(newSVpv(o->op_pv, (o->op_type == OP_TRANS) ?
+ 256 * sizeof(short) : 0));
+
+#define LOOP_redoop(o) o->op_redoop
+#define LOOP_nextop(o) o->op_nextop
+#define LOOP_lastop(o) o->op_lastop
+
+MODULE = B PACKAGE = B::LOOP PREFIX = LOOP_
+
+
+B::OP
+LOOP_redoop(o)
+ B::LOOP o
+
+B::OP
+LOOP_nextop(o)
+ B::LOOP o
+
+B::OP
+LOOP_lastop(o)
+ B::LOOP o
+
+#define COP_label(o) o->cop_label
+#define COP_stash(o) o->cop_stash
+#define COP_filegv(o) o->cop_filegv
+#define COP_cop_seq(o) o->cop_seq
+#define COP_arybase(o) o->cop_arybase
+#define COP_line(o) o->cop_line
+
+MODULE = B PACKAGE = B::COP PREFIX = COP_
+
+char *
+COP_label(o)
+ B::COP o
+
+B::HV
+COP_stash(o)
+ B::COP o
+
+B::GV
+COP_filegv(o)
+ B::COP o
+
+U32
+COP_cop_seq(o)
+ B::COP o
+
+I32
+COP_arybase(o)
+ B::COP o
+
+U16
+COP_line(o)
+ B::COP o
+
+MODULE = B PACKAGE = B::SV PREFIX = Sv
+
+U32
+SvREFCNT(sv)
B::SV sv
- PPCODE:
- ST(0) = sv_2mortal(newRV(sv));
- XSRETURN(1);
-
+
+U32
+SvFLAGS(sv)
+ B::SV sv
+
MODULE = B PACKAGE = B::IV PREFIX = Sv
IV
SvIV(sv)
B::IV sv
-MODULE = B PACKAGE = B::IV
-
-#define sv_SVp 0x00000
-#define sv_IVp 0x10000
-#define sv_UVp 0x20000
-#define sv_STRLENp 0x30000
-#define sv_U32p 0x40000
-#define sv_U8p 0x50000
-#define sv_char_pp 0x60000
-#define sv_NVp 0x70000
-#define sv_char_p 0x80000
-#define sv_SSize_tp 0x90000
-#define sv_I32p 0xA0000
-#define sv_U16p 0xB0000
-
-#define IV_ivx_ix sv_IVp | offsetof(struct xpviv, xiv_iv)
-#define IV_uvx_ix sv_UVp | offsetof(struct xpvuv, xuv_uv)
-#define NV_nvx_ix sv_NVp | offsetof(struct xpvnv, xnv_u.xnv_nv)
-
-#define NV_cop_seq_range_low_ix \
- sv_U32p | offsetof(struct xpvnv, xnv_u.xpad_cop_seq.xlow)
-#define NV_cop_seq_range_high_ix \
- sv_U32p | offsetof(struct xpvnv, xnv_u.xpad_cop_seq.xhigh)
-#define NV_parent_pad_index_ix \
- sv_U32p | offsetof(struct xpvnv, xnv_u.xpad_cop_seq.xlow)
-#define NV_parent_fakelex_flags_ix \
- sv_U32p | offsetof(struct xpvnv, xnv_u.xpad_cop_seq.xhigh)
-
-#define PV_cur_ix sv_STRLENp | offsetof(struct xpv, xpv_cur)
-#define PV_len_ix sv_STRLENp | offsetof(struct xpv, xpv_len)
-
-#define PVMG_stash_ix sv_SVp | offsetof(struct xpvmg, xmg_stash)
-
-#if PERL_VERSION > 18
-# define PVBM_useful_ix sv_IVp | offsetof(struct xpviv, xiv_u.xivu_iv)
-#elif PERL_VERSION > 14
-# define PVBM_useful_ix sv_I32p | offsetof(struct xpvgv, xnv_u.xbm_s.xbm_useful)
-#else
-#define PVBM_useful_ix sv_I32p | offsetof(struct xpvgv, xiv_u.xivu_i32)
-#endif
-
-#define PVLV_targoff_ix sv_U32p | offsetof(struct xpvlv, xlv_targoff)
-#define PVLV_targlen_ix sv_U32p | offsetof(struct xpvlv, xlv_targlen)
-#define PVLV_targ_ix sv_SVp | offsetof(struct xpvlv, xlv_targ)
-#define PVLV_type_ix sv_char_p | offsetof(struct xpvlv, xlv_type)
-
-#define PVGV_stash_ix sv_SVp | offsetof(struct xpvgv, xnv_u.xgv_stash)
-#define PVGV_flags_ix sv_STRLENp | offsetof(struct xpvgv, xpv_cur)
-#define PVIO_lines_ix sv_IVp | offsetof(struct xpvio, xiv_iv)
-
-#define PVIO_page_ix sv_IVp | offsetof(struct xpvio, xio_page)
-#define PVIO_page_len_ix sv_IVp | offsetof(struct xpvio, xio_page_len)
-#define PVIO_lines_left_ix sv_IVp | offsetof(struct xpvio, xio_lines_left)
-#define PVIO_top_name_ix sv_char_pp | offsetof(struct xpvio, xio_top_name)
-#define PVIO_top_gv_ix sv_SVp | offsetof(struct xpvio, xio_top_gv)
-#define PVIO_fmt_name_ix sv_char_pp | offsetof(struct xpvio, xio_fmt_name)
-#define PVIO_fmt_gv_ix sv_SVp | offsetof(struct xpvio, xio_fmt_gv)
-#define PVIO_bottom_name_ix sv_char_pp | offsetof(struct xpvio, xio_bottom_name)
-#define PVIO_bottom_gv_ix sv_SVp | offsetof(struct xpvio, xio_bottom_gv)
-#define PVIO_type_ix sv_char_p | offsetof(struct xpvio, xio_type)
-#define PVIO_flags_ix sv_U8p | offsetof(struct xpvio, xio_flags)
-
-#define PVAV_max_ix sv_SSize_tp | offsetof(struct xpvav, xav_max)
-
-#define PVCV_stash_ix sv_SVp | offsetof(struct xpvcv, xcv_stash)
-#if PERL_VERSION > 17 || (PERL_VERSION == 17 && PERL_SUBVERSION >= 3)
-# define PVCV_gv_ix sv_SVp | offsetof(struct xpvcv, xcv_gv_u.xcv_gv)
-#else
-# define PVCV_gv_ix sv_SVp | offsetof(struct xpvcv, xcv_gv)
-#endif
-#define PVCV_file_ix sv_char_pp | offsetof(struct xpvcv, xcv_file)
-#define PVCV_outside_ix sv_SVp | offsetof(struct xpvcv, xcv_outside)
-#define PVCV_outside_seq_ix sv_U32p | offsetof(struct xpvcv, xcv_outside_seq)
-#define PVCV_flags_ix sv_U32p | offsetof(struct xpvcv, xcv_flags)
+IV
+SvIVX(sv)
+ B::IV sv
-#define PVHV_max_ix sv_STRLENp | offsetof(struct xpvhv, xhv_max)
+MODULE = B PACKAGE = B::IV
-#if PERL_VERSION > 12
-#define PVHV_keys_ix sv_STRLENp | offsetof(struct xpvhv, xhv_keys)
-#else
-#define PVHV_keys_ix sv_IVp | offsetof(struct xpvhv, xhv_keys)
-#endif
+#define needs64bits(sv) ((I32)SvIVX(sv) != SvIVX(sv))
-# The type checking code in B has always been identical for all SV types,
-# irrespective of whether the action is actually defined on that SV.
-# We should fix this
-void
-IVX(sv)
- B::SV sv
- ALIAS:
- B::IV::IVX = IV_ivx_ix
- B::IV::UVX = IV_uvx_ix
- B::NV::NVX = NV_nvx_ix
- B::NV::COP_SEQ_RANGE_LOW = NV_cop_seq_range_low_ix
- B::NV::COP_SEQ_RANGE_HIGH = NV_cop_seq_range_high_ix
- B::NV::PARENT_PAD_INDEX = NV_parent_pad_index_ix
- B::NV::PARENT_FAKELEX_FLAGS = NV_parent_fakelex_flags_ix
- B::PV::CUR = PV_cur_ix
- B::PV::LEN = PV_len_ix
- B::PVMG::SvSTASH = PVMG_stash_ix
- B::PVLV::TARGOFF = PVLV_targoff_ix
- B::PVLV::TARGLEN = PVLV_targlen_ix
- B::PVLV::TARG = PVLV_targ_ix
- B::PVLV::TYPE = PVLV_type_ix
- B::GV::STASH = PVGV_stash_ix
- B::GV::GvFLAGS = PVGV_flags_ix
- B::BM::USEFUL = PVBM_useful_ix
- B::IO::LINES = PVIO_lines_ix
- B::IO::PAGE = PVIO_page_ix
- B::IO::PAGE_LEN = PVIO_page_len_ix
- B::IO::LINES_LEFT = PVIO_lines_left_ix
- B::IO::TOP_NAME = PVIO_top_name_ix
- B::IO::TOP_GV = PVIO_top_gv_ix
- B::IO::FMT_NAME = PVIO_fmt_name_ix
- B::IO::FMT_GV = PVIO_fmt_gv_ix
- B::IO::BOTTOM_NAME = PVIO_bottom_name_ix
- B::IO::BOTTOM_GV = PVIO_bottom_gv_ix
- B::IO::IoTYPE = PVIO_type_ix
- B::IO::IoFLAGS = PVIO_flags_ix
- B::AV::MAX = PVAV_max_ix
- B::CV::STASH = PVCV_stash_ix
- B::CV::FILE = PVCV_file_ix
- B::CV::OUTSIDE = PVCV_outside_ix
- B::CV::OUTSIDE_SEQ = PVCV_outside_seq_ix
- B::CV::CvFLAGS = PVCV_flags_ix
- B::HV::MAX = PVHV_max_ix
- B::HV::KEYS = PVHV_keys_ix
- PREINIT:
- char *ptr;
- SV *ret;
- PPCODE:
- ptr = (ix & 0xFFFF) + (char *)SvANY(sv);
- switch ((U8)(ix >> 16)) {
- case (U8)(sv_SVp >> 16):
- ret = make_sv_object(aTHX_ *((SV **)ptr));
- break;
- case (U8)(sv_IVp >> 16):
- ret = sv_2mortal(newSViv(*((IV *)ptr)));
- break;
- case (U8)(sv_UVp >> 16):
- ret = sv_2mortal(newSVuv(*((UV *)ptr)));
- break;
- case (U8)(sv_STRLENp >> 16):
- ret = sv_2mortal(newSVuv(*((STRLEN *)ptr)));
- break;
- case (U8)(sv_U32p >> 16):
- ret = sv_2mortal(newSVuv(*((U32 *)ptr)));
- break;
- case (U8)(sv_U8p >> 16):
- ret = sv_2mortal(newSVuv(*((U8 *)ptr)));
- break;
- case (U8)(sv_char_pp >> 16):
- ret = sv_2mortal(newSVpv(*((char **)ptr), 0));
- break;
- case (U8)(sv_NVp >> 16):
- ret = sv_2mortal(newSVnv(*((NV *)ptr)));
- break;
- case (U8)(sv_char_p >> 16):
- ret = newSVpvn_flags((char *)ptr, 1, SVs_TEMP);
- break;
- case (U8)(sv_SSize_tp >> 16):
- ret = sv_2mortal(newSViv(*((SSize_t *)ptr)));
- break;
- case (U8)(sv_I32p >> 16):
- ret = sv_2mortal(newSVuv(*((I32 *)ptr)));
- break;
- case (U8)(sv_U16p >> 16):
- ret = sv_2mortal(newSVuv(*((U16 *)ptr)));
- break;
- default:
- croak("Illegal alias 0x%08x for B::*IVX", (unsigned)ix);
- }
- ST(0) = ret;
- XSRETURN(1);
+int
+needs64bits(sv)
+ B::IV sv
void
packiv(sv)
B::IV sv
- ALIAS:
- needs64bits = 1
CODE:
- if (ix) {
- ST(0) = boolSV((I32)SvIVX(sv) != SvIVX(sv));
- } else if (sizeof(IV) == 8) {
+ if (sizeof(IV) == 8) {
U32 wp[2];
- const IV iv = SvIVX(sv);
+ IV iv = SvIVX(sv);
/*
* The following way of spelling 32 is to stop compilers on
* 32-bit architectures from moaning about the shift count
@@ -1470,359 +844,250 @@ packiv(sv)
* reach this code anyway (unless sizeof(IV) > 8 but then
* everything else breaks too so I'm not fussed at the moment).
*/
-#ifdef UV_IS_QUAD
- wp[0] = htonl(((UV)iv) >> (sizeof(UV)*4));
-#else
- wp[0] = htonl(((U32)iv) >> (sizeof(UV)*4));
-#endif
+ wp[0] = htonl(((U32)iv) >> (sizeof(IV)*4));
wp[1] = htonl(iv & 0xffffffff);
- ST(0) = newSVpvn_flags((char *)wp, 8, SVs_TEMP);
+ ST(0) = sv_2mortal(newSVpv((char *)wp, 8));
} else {
U32 w = htonl((U32)SvIVX(sv));
- ST(0) = newSVpvn_flags((char *)&w, 4, SVs_TEMP);
+ ST(0) = sv_2mortal(newSVpv((char *)&w, 4));
}
MODULE = B PACKAGE = B::NV PREFIX = Sv
-NV
+double
SvNV(sv)
B::NV sv
-#if PERL_VERSION < 11
+double
+SvNVX(sv)
+ B::NV sv
MODULE = B PACKAGE = B::RV PREFIX = Sv
-void
+B::SV
SvRV(sv)
B::RV sv
- PPCODE:
- PUSHs(make_sv_object(aTHX_ SvRV(sv)));
-#else
-
-MODULE = B PACKAGE = B::REGEXP
+MODULE = B PACKAGE = B::PV PREFIX = Sv
void
-REGEX(sv)
- B::REGEXP sv
- ALIAS:
- precomp = 1
- PPCODE:
- if (ix) {
- PUSHs(newSVpvn_flags(RX_PRECOMP(sv), RX_PRELEN(sv), SVs_TEMP));
- } else {
- dXSTARG;
- /* FIXME - can we code this method more efficiently? */
- PUSHi(PTR2IV(sv));
- }
-
-#endif
-
-MODULE = B PACKAGE = B::PV
-
-void
-RV(sv)
- B::PV sv
- PPCODE:
- if (!SvROK(sv))
- croak( "argument is not SvROK" );
- PUSHs(make_sv_object(aTHX_ SvRV(sv)));
-
-void
-PV(sv)
+SvPV(sv)
B::PV sv
- ALIAS:
- PVX = 1
- PVBM = 2
- B::BM::TABLE = 3
- PREINIT:
- const char *p;
- STRLEN len = 0;
- U32 utf8 = 0;
CODE:
- if (ix == 3) {
-#ifndef PERL_FBM_TABLE_OFFSET
- const MAGIC *const mg = mg_find(sv, PERL_MAGIC_bm);
-
- if (!mg)
- croak("argument to B::BM::TABLE is not a PVBM");
- p = mg->mg_ptr;
- len = mg->mg_len;
-#else
- p = SvPV(sv, len);
- /* Boyer-Moore table is just after string and its safety-margin \0 */
- p += len + PERL_FBM_TABLE_OFFSET;
- len = 256;
-#endif
- } else if (ix == 2) {
- /* This used to read 257. I think that that was buggy - should have
- been 258. (The "\0", the flags byte, and 256 for the table.)
- The only user of this method is B::Bytecode in B::PV::bsave.
- I'm guessing that nothing tested the runtime correctness of
- output of bytecompiled string constant arguments to index (etc).
-
- Note the start pointer is and has always been SvPVX(sv), not
- SvPVX(sv) + SvCUR(sv) PVBM was added in 651aa52ea1faa806, and
- first used by the compiler in 651aa52ea1faa806. It's used to
- get a "complete" dump of the buffer at SvPVX(), not just the
- PVBM table. This permits the generated bytecode to "load"
- SvPVX in "one" hit.
-
- 5.15 and later store the BM table via MAGIC, so the compiler
- should handle this just fine without changes if PVBM now
- always returns the SvPVX() buffer. */
-#ifdef isREGEXP
- p = isREGEXP(sv)
- ? RX_WRAPPED_const((REGEXP*)sv)
- : SvPVX_const(sv);
-#else
- p = SvPVX_const(sv);
-#endif
-#ifdef PERL_FBM_TABLE_OFFSET
- len = SvCUR(sv) + (SvVALID(sv) ? 256 + PERL_FBM_TABLE_OFFSET : 0);
-#else
- len = SvCUR(sv);
-#endif
- } else if (ix) {
-#ifdef isREGEXP
- p = isREGEXP(sv) ? RX_WRAPPED((REGEXP*)sv) : SvPVX(sv);
-#else
- p = SvPVX(sv);
-#endif
- len = strlen(p);
- } else if (SvPOK(sv)) {
- len = SvCUR(sv);
- p = SvPVX_const(sv);
- utf8 = SvUTF8(sv);
- }
-#ifdef isREGEXP
- else if (isREGEXP(sv)) {
- len = SvCUR(sv);
- p = RX_WRAPPED_const((REGEXP*)sv);
- utf8 = SvUTF8(sv);
- }
-#endif
- else {
- /* XXX for backward compatibility, but should fail */
- /* croak( "argument is not SvPOK" ); */
- p = NULL;
- }
- ST(0) = newSVpvn_flags(p, len, SVs_TEMP | utf8);
+ ST(0) = sv_newmortal();
+ sv_setpvn(ST(0), SvPVX(sv), SvCUR(sv));
-MODULE = B PACKAGE = B::PVMG
+MODULE = B PACKAGE = B::PVMG PREFIX = Sv
void
-MAGIC(sv)
+SvMAGIC(sv)
B::PVMG sv
MAGIC * mg = NO_INIT
PPCODE:
for (mg = SvMAGIC(sv); mg; mg = mg->mg_moremagic)
- XPUSHs(make_mg_object(aTHX_ mg));
+ XPUSHs(make_mg_object(sv_newmortal(), mg));
+
+MODULE = B PACKAGE = B::PVMG
+
+B::HV
+SvSTASH(sv)
+ B::PVMG sv
+
+#define MgMOREMAGIC(mg) mg->mg_moremagic
+#define MgPRIVATE(mg) mg->mg_private
+#define MgTYPE(mg) mg->mg_type
+#define MgFLAGS(mg) mg->mg_flags
+#define MgOBJ(mg) mg->mg_obj
+
+MODULE = B PACKAGE = B::MAGIC PREFIX = Mg
+
+B::MAGIC
+MgMOREMAGIC(mg)
+ B::MAGIC mg
-MODULE = B PACKAGE = B::MAGIC
+U16
+MgPRIVATE(mg)
+ B::MAGIC mg
+
+char
+MgTYPE(mg)
+ B::MAGIC mg
+
+U8
+MgFLAGS(mg)
+ B::MAGIC mg
+
+B::SV
+MgOBJ(mg)
+ B::MAGIC mg
void
-MOREMAGIC(mg)
+MgPTR(mg)
B::MAGIC mg
- ALIAS:
- PRIVATE = 1
- TYPE = 2
- FLAGS = 3
- LENGTH = 4
- OBJ = 5
- PTR = 6
- REGEX = 7
- precomp = 8
- PPCODE:
- switch (ix) {
- case 0:
- XPUSHs(mg->mg_moremagic ? make_mg_object(aTHX_ mg->mg_moremagic)
- : &PL_sv_undef);
- break;
- case 1:
- mPUSHu(mg->mg_private);
- break;
- case 2:
- PUSHs(newSVpvn_flags(&(mg->mg_type), 1, SVs_TEMP));
- break;
- case 3:
- mPUSHu(mg->mg_flags);
- break;
- case 4:
- mPUSHi(mg->mg_len);
- break;
- case 5:
- PUSHs(make_sv_object(aTHX_ mg->mg_obj));
- break;
- case 6:
- if (mg->mg_ptr) {
- if (mg->mg_len >= 0) {
- PUSHs(newSVpvn_flags(mg->mg_ptr, mg->mg_len, SVs_TEMP));
- } else if (mg->mg_len == HEf_SVKEY) {
- PUSHs(make_sv_object(aTHX_ (SV*)mg->mg_ptr));
- } else
- PUSHs(sv_newmortal());
- } else
- PUSHs(sv_newmortal());
- break;
- case 7:
- if(mg->mg_type == PERL_MAGIC_qr) {
- mPUSHi(PTR2IV(mg->mg_obj));
- } else {
- croak("REGEX is only meaningful on r-magic");
- }
- break;
- case 8:
- if (mg->mg_type == PERL_MAGIC_qr) {
- REGEXP *rx = (REGEXP *)mg->mg_obj;
- PUSHs(newSVpvn_flags(rx ? RX_PRECOMP(rx) : NULL,
- rx ? RX_PRELEN(rx) : 0, SVs_TEMP));
- } else {
- croak( "precomp is only meaningful on r-magic" );
- }
- break;
- }
+ CODE:
+ ST(0) = sv_newmortal();
+ if (mg->mg_ptr)
+ sv_setpvn(ST(0), mg->mg_ptr, mg->mg_len);
-MODULE = B PACKAGE = B::BM PREFIX = Bm
+MODULE = B PACKAGE = B::PVLV PREFIX = Lv
U32
-BmPREVIOUS(sv)
+LvTARGOFF(sv)
+ B::PVLV sv
+
+U32
+LvTARGLEN(sv)
+ B::PVLV sv
+
+char
+LvTYPE(sv)
+ B::PVLV sv
+
+B::SV
+LvTARG(sv)
+ B::PVLV sv
+
+MODULE = B PACKAGE = B::BM PREFIX = Bm
+
+I32
+BmUSEFUL(sv)
B::BM sv
- CODE:
-#if PERL_VERSION >= 19
- PERL_UNUSED_VAR(sv);
-#endif
- RETVAL = BmPREVIOUS(sv);
- OUTPUT:
- RETVAL
+U16
+BmPREVIOUS(sv)
+ B::BM sv
U8
BmRARE(sv)
B::BM sv
- CODE:
-#if PERL_VERSION >= 19
- PERL_UNUSED_VAR(sv);
-#endif
- RETVAL = BmRARE(sv);
- OUTPUT:
- RETVAL
+void
+BmTABLE(sv)
+ B::BM sv
+ STRLEN len = NO_INIT
+ char * str = NO_INIT
+ CODE:
+ str = SvPV(sv, len);
+ /* Boyer-Moore table is just after string and its safety-margin \0 */
+ ST(0) = sv_2mortal(newSVpv(str + len + 1, 256));
MODULE = B PACKAGE = B::GV PREFIX = Gv
void
GvNAME(gv)
B::GV gv
- ALIAS:
- FILE = 1
- B::HV::NAME = 2
- CODE:
- ST(0) = sv_2mortal(newSVhek(!ix ? GvNAME_HEK(gv)
- : (ix == 1 ? GvFILE_HEK(gv)
- : HvNAME_HEK((HV *)gv))));
-
-bool
-is_empty(gv)
- B::GV gv
- ALIAS:
- isGV_with_GP = 1
CODE:
- if (ix) {
- RETVAL = isGV_with_GP(gv) ? TRUE : FALSE;
- } else {
- RETVAL = GvGP(gv) == Null(GP*);
- }
- OUTPUT:
- RETVAL
+ ST(0) = sv_2mortal(newSVpv(GvNAME(gv), GvNAMELEN(gv)));
-void*
-GvGP(gv)
+B::HV
+GvSTASH(gv)
B::GV gv
-#define GP_sv_ix (SVp << 16) | offsetof(struct gp, gp_sv)
-#define GP_io_ix (SVp << 16) | offsetof(struct gp, gp_io)
-#define GP_cv_ix (SVp << 16) | offsetof(struct gp, gp_cv)
-#define GP_cvgen_ix (U32p << 16) | offsetof(struct gp, gp_cvgen)
-#define GP_refcnt_ix (U32p << 16) | offsetof(struct gp, gp_refcnt)
-#define GP_hv_ix (SVp << 16) | offsetof(struct gp, gp_hv)
-#define GP_av_ix (SVp << 16) | offsetof(struct gp, gp_av)
-#define GP_form_ix (SVp << 16) | offsetof(struct gp, gp_form)
-#define GP_egv_ix (SVp << 16) | offsetof(struct gp, gp_egv)
-#define GP_line_ix (line_tp << 16) | offsetof(struct gp, gp_line)
+B::SV
+GvSV(gv)
+ B::GV gv
-void
-SV(gv)
+B::IO
+GvIO(gv)
B::GV gv
- ALIAS:
- SV = GP_sv_ix
- IO = GP_io_ix
- CV = GP_cv_ix
- CVGEN = GP_cvgen_ix
- GvREFCNT = GP_refcnt_ix
- HV = GP_hv_ix
- AV = GP_av_ix
- FORM = GP_form_ix
- EGV = GP_egv_ix
- LINE = GP_line_ix
- PREINIT:
- GP *gp;
- char *ptr;
- SV *ret;
- PPCODE:
- gp = GvGP(gv);
- if (!gp) {
- const GV *const gv = CvGV(cv);
- Perl_croak(aTHX_ "NULL gp in B::GV::%s", gv ? GvNAME(gv) : "???");
- }
- ptr = (ix & 0xFFFF) + (char *)gp;
- switch ((U8)(ix >> 16)) {
- case SVp:
- ret = make_sv_object(aTHX_ *((SV **)ptr));
- break;
- case U32p:
- ret = sv_2mortal(newSVuv(*((U32*)ptr)));
- break;
- case line_tp:
- ret = sv_2mortal(newSVuv(*((line_t *)ptr)));
- break;
- default:
- croak("Illegal alias 0x%08x for B::*SV", (unsigned)ix);
- }
- ST(0) = ret;
- XSRETURN(1);
-void
-FILEGV(gv)
+B::CV
+GvFORM(gv)
+ B::GV gv
+
+B::AV
+GvAV(gv)
+ B::GV gv
+
+B::HV
+GvHV(gv)
+ B::GV gv
+
+B::GV
+GvEGV(gv)
+ B::GV gv
+
+B::CV
+GvCV(gv)
+ B::GV gv
+
+U32
+GvCVGEN(gv)
+ B::GV gv
+
+U16
+GvLINE(gv)
+ B::GV gv
+
+B::GV
+GvFILEGV(gv)
+ B::GV gv
+
+MODULE = B PACKAGE = B::GV
+
+U32
+GvREFCNT(gv)
+ B::GV gv
+
+U8
+GvFLAGS(gv)
B::GV gv
- PPCODE:
- PUSHs(make_sv_object(aTHX_ (SV *)GvFILEGV(gv)));
MODULE = B PACKAGE = B::IO PREFIX = Io
+long
+IoLINES(io)
+ B::IO io
-bool
-IsSTD(io,name)
+long
+IoPAGE(io)
+ B::IO io
+
+long
+IoPAGE_LEN(io)
+ B::IO io
+
+long
+IoLINES_LEFT(io)
+ B::IO io
+
+char *
+IoTOP_NAME(io)
+ B::IO io
+
+B::GV
+IoTOP_GV(io)
+ B::IO io
+
+char *
+IoFMT_NAME(io)
+ B::IO io
+
+B::GV
+IoFMT_GV(io)
+ B::IO io
+
+char *
+IoBOTTOM_NAME(io)
+ B::IO io
+
+B::GV
+IoBOTTOM_GV(io)
+ B::IO io
+
+short
+IoSUBPROCESS(io)
+ B::IO io
+
+MODULE = B PACKAGE = B::IO
+
+char
+IoTYPE(io)
+ B::IO io
+
+U8
+IoFLAGS(io)
B::IO io
- const char* name
- PREINIT:
- PerlIO* handle = 0;
- CODE:
- if( strEQ( name, "stdin" ) ) {
- handle = PerlIO_stdin();
- }
- else if( strEQ( name, "stdout" ) ) {
- handle = PerlIO_stdout();
- }
- else if( strEQ( name, "stderr" ) ) {
- handle = PerlIO_stderr();
- }
- else {
- croak( "Invalid value '%s'", name );
- }
- RETVAL = handle == IoIFP(io);
- OUTPUT:
- RETVAL
MODULE = B PACKAGE = B::AV PREFIX = Av
@@ -1830,6 +1095,16 @@ SSize_t
AvFILL(av)
B::AV av
+SSize_t
+AvMAX(av)
+ B::AV av
+
+#define AvOFF(av) ((XPVAV*)SvANY(av))->xof_off
+
+IV
+AvOFF(av)
+ B::AV av
+
void
AvARRAY(av)
B::AV av
@@ -1838,104 +1113,68 @@ AvARRAY(av)
SV **svp = AvARRAY(av);
I32 i;
for (i = 0; i <= AvFILL(av); i++)
- XPUSHs(make_sv_object(aTHX_ svp[i]));
+ XPUSHs(make_sv_object(sv_newmortal(), svp[i]));
}
-void
-AvARRAYelt(av, idx)
- B::AV av
- int idx
- PPCODE:
- if (idx >= 0 && AvFILL(av) >= 0 && idx <= AvFILL(av))
- XPUSHs(make_sv_object(aTHX_ (AvARRAY(av)[idx])));
- else
- XPUSHs(make_sv_object(aTHX_ NULL));
-
-
-MODULE = B PACKAGE = B::FM PREFIX = Fm
-
-IV
-FmLINES(format)
- B::FM format
- CODE:
- PERL_UNUSED_VAR(format);
- RETVAL = 0;
- OUTPUT:
- RETVAL
+MODULE = B PACKAGE = B::AV
+U8
+AvFLAGS(av)
+ B::AV av
MODULE = B PACKAGE = B::CV PREFIX = Cv
-U32
-CvCONST(cv)
+B::HV
+CvSTASH(cv)
B::CV cv
-void
+B::OP
CvSTART(cv)
B::CV cv
- ALIAS:
- ROOT = 1
- PPCODE:
- PUSHs(make_op_object(aTHX_ CvISXSUB(cv) ? NULL
- : ix ? CvROOT(cv) : CvSTART(cv)));
-I32
-CvDEPTH(cv)
- B::CV cv
+B::OP
+CvROOT(cv)
+ B::CV cv
-#ifdef PadlistARRAY
+B::GV
+CvGV(cv)
+ B::CV cv
-B::PADLIST
-CvPADLIST(cv)
+B::GV
+CvFILEGV(cv)
B::CV cv
-#else
+long
+CvDEPTH(cv)
+ B::CV cv
B::AV
CvPADLIST(cv)
B::CV cv
- PPCODE:
- PUSHs(make_sv_object(aTHX_ (SV *)CvPADLIST(cv)));
-
-#endif
+B::CV
+CvOUTSIDE(cv)
+ B::CV cv
void
CvXSUB(cv)
B::CV cv
- ALIAS:
- XSUBANY = 1
CODE:
- ST(0) = ix && CvCONST(cv)
- ? make_sv_object(aTHX_ (SV *)CvXSUBANY(cv).any_ptr)
- : sv_2mortal(newSViv(CvISXSUB(cv)
- ? (ix ? CvXSUBANY(cv).any_iv
- : PTR2IV(CvXSUB(cv)))
- : 0));
+ ST(0) = sv_2mortal(newSViv((IV)CvXSUB(cv)));
-void
-const_sv(cv)
- B::CV cv
- PPCODE:
- PUSHs(make_sv_object(aTHX_ (SV *)cv_const_sv(cv)));
void
-GV(cv)
- B::CV cv
+CvXSUBANY(cv)
+ B::CV cv
CODE:
- ST(0) = make_sv_object(aTHX_ (SV*)CvGV(cv));
+ ST(0) = sv_2mortal(newSViv(CvXSUBANY(cv).any_iv));
-#if PERL_VERSION > 17
+MODULE = B PACKAGE = B::CV
-SV *
-NAME_HEK(cv)
- B::CV cv
- CODE:
- RETVAL = CvNAMED(cv) ? newSVhek(CvNAME_HEK(cv)) : &PL_sv_undef;
- OUTPUT:
- RETVAL
+U8
+CvFLAGS(cv)
+ B::CV cv
-#endif
MODULE = B PACKAGE = B::HV PREFIX = Hv
@@ -1943,93 +1182,38 @@ STRLEN
HvFILL(hv)
B::HV hv
+STRLEN
+HvMAX(hv)
+ B::HV hv
+
+I32
+HvKEYS(hv)
+ B::HV hv
+
I32
HvRITER(hv)
B::HV hv
+char *
+HvNAME(hv)
+ B::HV hv
+
+B::PMOP
+HvPMROOT(hv)
+ B::HV hv
+
void
HvARRAY(hv)
B::HV hv
PPCODE:
- if (HvUSEDKEYS(hv) > 0) {
- HE *he;
+ if (HvKEYS(hv) > 0) {
+ SV *sv;
+ char *key;
+ I32 len;
(void)hv_iterinit(hv);
- EXTEND(sp, HvUSEDKEYS(hv) * 2);
- while ((he = hv_iternext(hv))) {
- if (HeSVKEY(he)) {
- mPUSHs(HeSVKEY(he));
- } else if (HeKUTF8(he)) {
- PUSHs(newSVpvn_flags(HeKEY(he), HeKLEN(he), SVf_UTF8|SVs_TEMP));
- } else {
- mPUSHp(HeKEY(he), HeKLEN(he));
- }
- PUSHs(make_sv_object(aTHX_ HeVAL(he)));
+ EXTEND(sp, HvKEYS(hv) * 2);
+ while (sv = hv_iternextsv(hv, &key, &len)) {
+ PUSHs(newSVpv(key, len));
+ PUSHs(make_sv_object(sv_newmortal(), sv));
}
}
-
-MODULE = B PACKAGE = B::HE PREFIX = He
-
-void
-HeVAL(he)
- B::HE he
- ALIAS:
- SVKEY_force = 1
- PPCODE:
- PUSHs(make_sv_object(aTHX_ ix ? HeSVKEY_force(he) : HeVAL(he)));
-
-U32
-HeHASH(he)
- B::HE he
-
-MODULE = B PACKAGE = B::RHE
-
-SV*
-HASH(h)
- B::RHE h
- CODE:
- RETVAL = newRV( (SV*)cophh_2hv(h, 0) );
- OUTPUT:
- RETVAL
-
-
-#ifdef PadlistARRAY
-
-MODULE = B PACKAGE = B::PADLIST PREFIX = Padlist
-
-SSize_t
-PadlistMAX(padlist)
- B::PADLIST padlist
-
-void
-PadlistARRAY(padlist)
- B::PADLIST padlist
- PPCODE:
- if (PadlistMAX(padlist) >= 0) {
- PAD **padp = PadlistARRAY(padlist);
- SSize_t i;
- for (i = 0; i <= PadlistMAX(padlist); i++)
- XPUSHs(make_sv_object(aTHX_ (SV *)padp[i]));
- }
-
-void
-PadlistARRAYelt(padlist, idx)
- B::PADLIST padlist
- SSize_t idx
- PPCODE:
- if (PadlistMAX(padlist) >= 0
- && idx <= PadlistMAX(padlist))
- XPUSHs(make_sv_object(aTHX_
- (SV *)PadlistARRAY(padlist)[idx]));
- else
- XPUSHs(make_sv_object(aTHX_ NULL));
-
-U32
-PadlistREFCNT(padlist)
- B::PADLIST padlist
- CODE:
- PERL_UNUSED_VAR(padlist);
- RETVAL = PadlistREFCNT(padlist);
- OUTPUT:
- RETVAL
-
-#endif
diff --git a/gnu/usr.bin/perl/ext/B/B/Showlex.pm b/gnu/usr.bin/perl/ext/B/B/Showlex.pm
index ab684516100..648f95dcc0a 100644
--- a/gnu/usr.bin/perl/ext/B/B/Showlex.pm
+++ b/gnu/usr.bin/perl/ext/B/B/Showlex.pm
@@ -1,11 +1,7 @@
package B::Showlex;
-
-our $VERSION = '1.04';
-
use strict;
use B qw(svref_2object comppadlist class);
use B::Terse ();
-use B::Concise ();
#
# Invoke as
@@ -14,108 +10,48 @@ use B::Concise ();
# or as
# perl -MO=Showlex bar.pl
# to see the names of file scope lexicals used by bar.pl
-#
-
-
-# borrowed from B::Concise
-our $walkHandle = \*STDOUT;
+#
-sub walk_output { # updates $walkHandle
- $walkHandle = B::Concise::walk_output(@_);
- #print "got $walkHandle";
- #print $walkHandle "using it";
- $walkHandle;
-}
-
-sub shownamearray {
+sub showarray {
my ($name, $av) = @_;
my @els = $av->ARRAY;
my $count = @els;
my $i;
- print $walkHandle "$name has $count entries\n";
+ print "$name has $count entries\n";
for ($i = 0; $i < $count; $i++) {
- my $sv = $els[$i];
- if (class($sv) ne "SPECIAL") {
- printf $walkHandle "$i: %s (0x%lx) %s\n", class($sv), $$sv, $sv->PVX;
- } else {
- printf $walkHandle "$i: %s\n", $sv->terse;
- #printf $walkHandle "$i: %s\n", B::Concise::concise_sv($sv);
- }
- }
-}
-
-sub showvaluearray {
- my ($name, $av) = @_;
- my @els = $av->ARRAY;
- my $count = @els;
- my $i;
- print $walkHandle "$name has $count entries\n";
- for ($i = 0; $i < $count; $i++) {
- printf $walkHandle "$i: %s\n", $els[$i]->terse;
- #print $walkHandle "$i: %s\n", B::Concise::concise_sv($els[$i]);
+ print "$i: ";
+ $els[$i]->terse;
}
}
sub showlex {
my ($objname, $namesav, $valsav) = @_;
- shownamearray("Pad of lexical names for $objname", $namesav);
- showvaluearray("Pad of lexical values for $objname", $valsav);
-}
-
-my ($newlex, $nosp1); # rendering state vars
-
-sub newlex { # drop-in for showlex
- my ($objname, $names, $vals) = @_;
- my @names = $names->ARRAY;
- my @vals = $vals->ARRAY;
- my $count = @names;
- print $walkHandle "$objname Pad has $count entries\n";
- printf $walkHandle "0: %s\n", $names[0]->terse unless $nosp1;
- for (my $i = 1; $i < $count; $i++) {
- printf $walkHandle "$i: %s = %s\n", $names[$i]->terse, $vals[$i]->terse
- unless $nosp1 and $names[$i]->terse =~ /SPECIAL/;
- }
+ showarray("Pad of lexical names for $objname", $namesav);
+ showarray("Pad of lexical values for $objname", $valsav);
}
sub showlex_obj {
my ($objname, $obj) = @_;
$objname =~ s/^&main::/&/;
- showlex($objname, svref_2object($obj)->PADLIST->ARRAY) if !$newlex;
- newlex ($objname, svref_2object($obj)->PADLIST->ARRAY) if $newlex;
+ showlex($objname, svref_2object($obj)->PADLIST->ARRAY);
}
sub showlex_main {
- showlex("comppadlist", comppadlist->ARRAY) if !$newlex;
- newlex ("main", comppadlist->ARRAY) if $newlex;
+ showlex("comppadlist", comppadlist->ARRAY);
}
sub compile {
- my @options = grep(/^-/, @_);
- my @args = grep(!/^-/, @_);
- for my $o (@options) {
- $newlex = 1 if $o eq "-newlex";
- $nosp1 = 1 if $o eq "-nosp";
- }
-
- return \&showlex_main unless @args;
- return sub {
- my $objref;
- foreach my $objname (@args) {
- next unless $objname; # skip nulls w/o carping
-
- if (ref $objname) {
- print $walkHandle "B::Showlex::compile($objname)\n";
- $objref = $objname;
- } else {
+ my @options = @_;
+ if (@options) {
+ return sub {
+ my $objname;
+ foreach $objname (@options) {
$objname = "main::$objname" unless $objname =~ /::/;
- print $walkHandle "$objname:\n";
- no strict 'refs';
- die "err: unknown function ($objname)\n"
- unless *{$objname}{CODE};
- $objref = \&$objname;
+ eval "showlex_obj('&$objname', \\&$objname)";
}
- showlex_obj($objname, $objref);
}
+ } else {
+ return \&showlex_main;
}
}
@@ -129,74 +65,13 @@ B::Showlex - Show lexical variables used in functions or files
=head1 SYNOPSIS
- perl -MO=Showlex[,-OPTIONS][,SUBROUTINE] foo.pl
+ perl -MO=Showlex[,SUBROUTINE] foo.pl
=head1 DESCRIPTION
-When a comma-separated list of subroutine names is given as options, Showlex
-prints the lexical variables used in those subroutines. Otherwise, it prints
-the file-scope lexicals in the file.
-
-=head1 EXAMPLES
-
-Traditional form:
-
- $ perl -MO=Showlex -e 'my ($i,$j,$k)=(1,"foo")'
- Pad of lexical names for comppadlist has 4 entries
- 0: SPECIAL #1 &PL_sv_undef
- 1: PVNV (0x9db0fb0) $i
- 2: PVNV (0x9db0f38) $j
- 3: PVNV (0x9db0f50) $k
- Pad of lexical values for comppadlist has 5 entries
- 0: SPECIAL #1 &PL_sv_undef
- 1: NULL (0x9da4234)
- 2: NULL (0x9db0f2c)
- 3: NULL (0x9db0f44)
- 4: NULL (0x9da4264)
- -e syntax OK
-
-New-style form:
-
- $ perl -MO=Showlex,-newlex -e 'my ($i,$j,$k)=(1,"foo")'
- main Pad has 4 entries
- 0: SPECIAL #1 &PL_sv_undef
- 1: PVNV (0xa0c4fb8) "$i" = NULL (0xa0b8234)
- 2: PVNV (0xa0c4f40) "$j" = NULL (0xa0c4f34)
- 3: PVNV (0xa0c4f58) "$k" = NULL (0xa0c4f4c)
- -e syntax OK
-
-New form, no specials, outside O framework:
-
- $ perl -MB::Showlex -e \
- 'my ($i,$j,$k)=(1,"foo"); B::Showlex::compile(-newlex,-nosp)->()'
- main Pad has 4 entries
- 1: PVNV (0x998ffb0) "$i" = IV (0x9983234) 1
- 2: PVNV (0x998ff68) "$j" = PV (0x998ff5c) "foo"
- 3: PVNV (0x998ff80) "$k" = NULL (0x998ff74)
-
-Note that this example shows the values of the lexicals, whereas the other
-examples did not (as they're compile-time only).
-
-=head2 OPTIONS
-
-The C<-newlex> option produces a more readable C<< name => value >> format,
-and is shown in the second example above.
-
-The C<-nosp> option eliminates reporting of SPECIALs, such as C<0: SPECIAL
-#1 &PL_sv_undef> above. Reporting of SPECIALs can sometimes overwhelm
-your declared lexicals.
-
-=head1 SEE ALSO
-
-L<B::Showlex> can also be used outside of the O framework, as in the third
-example. See L<B::Concise> for a fuller explanation of reasons.
-
-=head1 TODO
-
-Some of the reported info, such as hex addresses, is not particularly
-valuable. Other information would be more useful for the typical
-programmer, such as line-numbers, pad-slot reuses, etc.. Given this,
--newlex is not a particularly good flag-name.
+When a subroutine name is provided in OPTIONS, prints the lexical
+variables used in that subroutine. Otherwise, prints the file-scope
+lexicals in the file.
=head1 AUTHOR
diff --git a/gnu/usr.bin/perl/ext/B/Makefile.PL b/gnu/usr.bin/perl/ext/B/Makefile.PL
index 8767b5e3dd7..80e5e1b905d 100644
--- a/gnu/usr.bin/perl/ext/B/Makefile.PL
+++ b/gnu/usr.bin/perl/ext/B/Makefile.PL
@@ -1,60 +1,46 @@
use ExtUtils::MakeMaker;
-use ExtUtils::Constant 0.23 'WriteConstants';
-use File::Spec;
-use strict;
-use warnings;
+use Config;
-my $core = grep { $_ eq 'PERL_CORE=1' } @ARGV;
+my $e = $Config{'exe_ext'};
+my $o = $Config{'obj_ext'};
+my $exeout_flag = '-o ';
+if ($^O eq 'MSWin32') {
+ if ($Config{'cc'} =~ /^cl/i) {
+ $exeout_flag = '-Fe';
+ }
+ elsif ($Config{'cc'} =~ /^bcc/i) {
+ $exeout_flag = '-e';
+ }
+}
WriteMakefile(
- NAME => "B",
- VERSION_FROM => "B.pm",
- realclean => {FILES=> 'const-c.inc const-xs.inc'},
+ NAME => "B",
+ VERSION => "a5",
+ MAN3PODS => {},
+ clean => {
+ FILES => "perl$e byteperl$e *$o B.c *~"
+ }
);
-my $headerpath;
-if ($core) {
- $headerpath = File::Spec->catdir(File::Spec->updir, File::Spec->updir);
-} else {
- require Config;
- $headerpath = File::Spec->catdir($Config::Config{archlibexp}, "CORE");
+sub MY::post_constants {
+ "\nLIBS = $Config{libs}\n"
}
-my @names = ({ name => 'HEf_SVKEY', macro => 1, type => "IV" },
- qw(SVTYPEMASK SVt_PVGV SVt_PVHV PAD_FAKELEX_ANON PAD_FAKELEX_MULTI));
-
+# Leave out doing byteperl for now. Probably should be built in the
+# core directory or somewhere else rather than here
+#sub MY::top_targets {
+# my $self = shift;
+# my $targets = $self->MM::top_targets();
+# $targets =~ s/^(all ::.*)$/$1 byteperl$e/m;
+# return <<"EOT" . $targets;
-# First element in each tuple is the file; second is a regex snippet
-# giving the prefix to limit the names of symbols to define that come
-# from that file. If none, all symbols will be defined whose values
-# match the pattern below.
-foreach my $tuple (['cop.h'],
- ['cv.h', 'CVf'],
- ['gv.h', 'GVf'],
- ['op.h'],
- ['op_reg_common.h','(?:(?:RXf_)?PMf_)'],
- ['regexp.h','RXf_'],
- ['sv.h', 'SV(?:[fps]|pad)_'],
- ) {
- my $file = $tuple->[0];
- my $pfx = $tuple->[1] || '';
- my $path = File::Spec->catfile($headerpath, $file);
- open my $fh, '<', $path or die "Cannot open $path: $!";
- while (<$fh>) {
- push @names, $1 if (/ \#define \s+ ( $pfx \w+ ) \s+
- ( [()|\dx]+ # Parens, '|', digits, 'x'
- | \(? \d+ \s* << .*? # digits left shifted by anything
- ) \s* (?: $| \/ \* ) # ending at comment or $
- /x);
- }
- close $fh;
-}
-
-# Currently only SVt_PVGV and SVt_PVHV aren't macros, but everything we name
-# should exist, so ensure that the C compile breaks if anything does not.
-WriteConstants(
- PROXYSUBS => {push => 'EXPORT_OK'},
- NAME => 'B',
- NAMES => [map {ref $_ ? $_ : {name=>$_, macro=>1, type=>"UV"}} @names],
- XS_SUBNAME => undef,
-);
+#
+# byteperl is *not* a standard perl+XSUB executable. It's a special
+# program for running standalone bytecode executables. It isn't an XSUB
+# at the moment because a standlone Perl program needs to set up curpad
+# which is overwritten on exit from an XSUB.
+#
+#byteperl$e : byteperl$o B$o \$(PERL_SRC)/byterun$o
+# \$(CC) ${exeout_flag}byteperl$e byteperl$o B$o byterun$o \$(LDFLAGS) \$(PERL_ARCHLIB)/CORE/$Config{libperl} \$(LIBS)
+#EOT
+#}
diff --git a/gnu/usr.bin/perl/ext/B/typemap b/gnu/usr.bin/perl/ext/B/typemap
index e97fb76d94f..7206a6a2e11 100644
--- a/gnu/usr.bin/perl/ext/B/typemap
+++ b/gnu/usr.bin/perl/ext/B/typemap
@@ -4,11 +4,13 @@ B::OP T_OP_OBJ
B::UNOP T_OP_OBJ
B::BINOP T_OP_OBJ
B::LOGOP T_OP_OBJ
+B::CONDOP T_OP_OBJ
B::LISTOP T_OP_OBJ
B::PMOP T_OP_OBJ
B::SVOP T_OP_OBJ
-B::PADOP T_OP_OBJ
+B::GVOP T_OP_OBJ
B::PVOP T_OP_OBJ
+B::CVOP T_OP_OBJ
B::LOOP T_OP_OBJ
B::COP T_OP_OBJ
@@ -17,7 +19,6 @@ B::PV T_SV_OBJ
B::IV T_SV_OBJ
B::NV T_SV_OBJ
B::PVMG T_SV_OBJ
-B::REGEXP T_SV_OBJ
B::PVLV T_SV_OBJ
B::BM T_SV_OBJ
B::RV T_SV_OBJ
@@ -26,23 +27,16 @@ B::CV T_SV_OBJ
B::HV T_SV_OBJ
B::AV T_SV_OBJ
B::IO T_SV_OBJ
-B::FM T_SV_OBJ
B::MAGIC T_MG_OBJ
SSize_t T_IV
-STRLEN T_UV
-PADOFFSET T_UV
-
-B::HE T_HE_OBJ
-B::RHE T_RHE_OBJ
-
-B::PADLIST T_PL_OBJ
+STRLEN T_IV
INPUT
T_OP_OBJ
if (SvROK($arg)) {
IV tmp = SvIV((SV*)SvRV($arg));
- $var = INT2PTR($type,tmp);
+ $var = ($type) tmp;
}
else
croak(\"$var is not a reference\")
@@ -50,7 +44,7 @@ T_OP_OBJ
T_SV_OBJ
if (SvROK($arg)) {
IV tmp = SvIV((SV*)SvRV($arg));
- $var = INT2PTR($type,tmp);
+ $var = ($type) tmp;
}
else
croak(\"$var is not a reference\")
@@ -58,45 +52,18 @@ T_SV_OBJ
T_MG_OBJ
if (SvROK($arg)) {
IV tmp = SvIV((SV*)SvRV($arg));
- $var = INT2PTR($type,tmp);
- }
- else
- croak(\"$var is not a reference\")
-
-T_HE_OBJ
- if (SvROK($arg)) {
- IV tmp = SvIV((SV*)SvRV($arg));
- $var = INT2PTR($type,tmp);
- }
- else
- croak(\"$var is not a reference\")
-
-T_RHE_OBJ
- if (SvROK($arg)) {
- IV tmp = SvIV((SV*)SvRV($arg));
- $var = INT2PTR($type,tmp);
- }
- else
- croak(\"$var is not a reference\")
-
-T_PL_OBJ
- if (SvROK($arg)) {
- IV tmp = SvIV((SV*)SvRV($arg));
- $var = INT2PTR($type,tmp);
+ $var = ($type) tmp;
}
else
croak(\"$var is not a reference\")
OUTPUT
-T_MG_OBJ
- sv_setiv(newSVrv($arg, "B::MAGIC"), PTR2IV($var));
+T_OP_OBJ
+ sv_setiv(newSVrv($arg, cc_opclassname((OP*)$var)), (IV)$var);
-T_HE_OBJ
- sv_setiv(newSVrv($arg, "B::HE"), PTR2IV($var));
+T_SV_OBJ
+ make_sv_object(($arg), (SV*)($var));
-T_RHE_OBJ
- sv_setiv(newSVrv($arg, "B::RHE"), PTR2IV($var));
-T_PL_OBJ
- sv_setiv(newSVrv($arg, $var ? "B::PADLIST" : "B::NULL"),
- PTR2IV($var));
+T_MG_OBJ
+ sv_setiv(newSVrv($arg, "B::MAGIC"), (IV)$var);
diff --git a/gnu/usr.bin/perl/ext/DynaLoader/DynaLoader_pm.PL b/gnu/usr.bin/perl/ext/DynaLoader/DynaLoader_pm.PL
index 5fb52a27684..cf7d7085bc8 100644
--- a/gnu/usr.bin/perl/ext/DynaLoader/DynaLoader_pm.PL
+++ b/gnu/usr.bin/perl/ext/DynaLoader/DynaLoader_pm.PL
@@ -1,74 +1,18 @@
+
use Config;
sub to_string {
my ($value) = @_;
- $value =~ s/\\/\\\\/g;
+ $value =~ s/\\/\\\\'/g;
$value =~ s/'/\\'/g;
return "'$value'";
}
-#
-# subroutine expand_os_specific expands $^O-specific preprocessing information
-# so that it will not be re-calculated at runtime in Dynaloader.pm
-#
-# Syntax of preprocessor should be kept extremely simple:
-# - directives are in double angle brackets <<...>>
-# - <<=string>> will be just evaluated
-# - for $^O-specific there are two forms:
-# <<$^O-eq-osname>>
-# <<$^O-ne-osname>>
-# this directive should be closed with respectively
-# <</$^O-eq-osname>>
-# <</$^O-ne-osname>>
-# construct <<|$^O-ne-osname>> means #else
-# nested <<$^O...>>-constructs are allowed but nested values must be for
-# different OS-names!
-#
-# -- added by VKON, 03-10-2004 to separate $^O-specific between OSes
-# (so that Win32 never checks for $^O eq 'VMS' for example)
-#
-# The $^O tests test both for $^O and for $Config{osname}.
-# The latter is better for some for cross-compilation setups.
-#
-sub expand_os_specific {
- my $s = shift;
- for ($s) {
- s/<<=(.*?)>>/$1/gee;
- s/<<\$\^O-(eq|ne)-(\w+)>>(.*?)<<\/\$\^O-\1-\2>>/
- my ($op, $os, $expr) = ($1,$2,$3);
- if ($op ne 'eq' and $op ne 'ne') {die "wrong eq-ne arg in $&"};
- if ($expr =~ m[^(.*?)<<\|\$\^O-$op-$os>>(.*?)$]s) {
- # #if;#else;#endif
- my ($if,$el) = ($1,$2);
- if (($op eq 'eq' and ($^O eq $os || $Config{osname} eq $os)) || ($op eq 'ne' and ($^O ne $os || $Config{osname} ne $os))) {
- $if
- }
- else {
- $el
- }
- }
- else {
- # #if;#endif
- if (($op eq 'eq' and ($^O eq $os || $Config{osname} eq $os)) || ($op eq 'ne' and ($^O ne $os || $Config{osname} ne $os))) {
- $expr
- }
- else {
- ""
- }
- }
- /ges;
- if (/<<(=|\$\^O-)/) {die "bad <<\$^O-eq/ne-osname>> expression.".
- " Unclosed brackets?";
- }
- }
- $s;
-}
-
unlink "DynaLoader.pm" if -f "DynaLoader.pm";
open OUT, ">DynaLoader.pm" or die $!;
print OUT <<'EOT';
-# Generated from DynaLoader_pm.PL
+# Generated from DynaLoader.pm.PL (resolved %Config::Config values)
package DynaLoader;
@@ -77,18 +21,25 @@ package DynaLoader;
# feast like to keep their secret; for wonder makes the words of
# praise louder.'
-# (Quote from Tolkien suggested by Anno Siegel.)
+# (Quote from Tolkien sugested by Anno Siegel.)
#
# See pod text at end of file for documentation.
# See also ext/DynaLoader/README in source tree for other information.
#
# Tim.Bunce@ig.co.uk, August 1994
-BEGIN {
- $VERSION = '1.25';
-}
+$VERSION = $VERSION = "1.03"; # avoid typo warning
+
+require AutoLoader;
+*AUTOLOAD = \&AutoLoader::AUTOLOAD;
+
+# The following require can't be removed during maintenance
+# releases, sadly, because of the risk of buggy code that does
+# require Carp; Carp::croak "..."; without brackets dying
+# if Carp hasn't been loaded in earlier compile time. :-(
+# We'll let those bugs get found on the development track.
+require Carp if $] < 5.00450;
-use Config;
# enable debug/trace messages from DynaLoader perl code
$dl_debug = $ENV{PERL_DL_DEBUG} || 0 unless defined $dl_debug;
@@ -98,7 +49,6 @@ $dl_debug = $ENV{PERL_DL_DEBUG} || 0 unless defined $dl_debug;
# 0x01 make symbols available for linking later dl_load_file's.
# (only known to work on Solaris 2 using dlopen(RTLD_GLOBAL))
# (ignored under VMS; effect is built-in to image linking)
-# (ignored under Android; the linker always uses RTLD_LOCAL)
#
# This is called as a class method $module->dl_load_flags. The
# definition here will be inherited and result on "default" loading
@@ -107,168 +57,53 @@ $dl_debug = $ENV{PERL_DL_DEBUG} || 0 unless defined $dl_debug;
sub dl_load_flags { 0x00 }
+# ($dl_dlext, $dlsrc)
+# = @Config::Config{'dlext', 'dlsrc'};
EOT
-if ($ENV{PERL_BUILD_EXPAND_CONFIG_VARS}) {
- print OUT "(\$dl_dlext, \$dl_so, \$dlsrc) = (",
- to_string($Config{'dlext'}), ",",
- to_string($Config{'so'}), ",",
- to_string($Config{'dlsrc'}), ")\n;" ;
-}
-else {
- print OUT <<'EOT';
-($dl_dlext, $dl_so, $dlsrc) = @Config::Config{qw(dlext so dlsrc)};
-EOT
-}
+print OUT " (\$dl_dlext, \$dlsrc) = (",
+ to_string($Config::Config{'dlext'}), ",",
+ to_string($Config::Config{'dlsrc'}), ")\n;" ;
-print OUT expand_os_specific(<<'EOT');
+print OUT <<'EOT';
-<<$^O-eq-VMS>>
# Some systems need special handling to expand file specifications
# (VMS support by Charles Bailey <bailey@HMIVAX.HUMGEN.UPENN.EDU>)
# See dl_expandspec() for more details. Should be harmless but
# inefficient to define on systems that don't need it.
-$Is_VMS = $^O eq 'VMS';
-<</$^O-eq-VMS>>
-$do_expand = <<$^O-eq-VMS>>1<<|$^O-eq-VMS>>0<</$^O-eq-VMS>>;
+$do_expand = $Is_VMS = $^O eq 'VMS';
@dl_require_symbols = (); # names of symbols we need
@dl_resolve_using = (); # names of files to link with
@dl_library_path = (); # path to look for files
-
-#XSLoader.pm may have added elements before we were required
-#@dl_shared_objects = (); # shared objects for symbols we have
-#@dl_librefs = (); # things we have loaded
-#@dl_modules = (); # Modules we have loaded
+@dl_librefs = (); # things we have loaded
+@dl_modules = (); # Modules we have loaded
# This is a fix to support DLD's unfortunate desire to relink -lc
@dl_resolve_using = dl_findfile('-lc') if $dlsrc eq "dl_dld.xs";
-EOT
+# Initialise @dl_library_path with the 'standard' library path
+# for this platform as determined by Configure
-my $cfg_dl_library_path = <<'EOT';
-push(@dl_library_path, split(' ', $Config::Config{libpth}));
+# push(@dl_library_path, split(' ', $Config::Config{'libpth'});
EOT
-sub dquoted_comma_list {
- join(", ", map {'"'.quotemeta($_).'"'} @_);
-}
-
-if ($ENV{PERL_BUILD_EXPAND_CONFIG_VARS}) {
- eval $cfg_dl_library_path;
- if (!$ENV{PERL_BUILD_EXPAND_ENV_VARS}) {
- my $dl_library_path = dquoted_comma_list(@dl_library_path);
- print OUT <<EOT;
-# The below \@dl_library_path has been expanded (%Config) in Perl build time.
-
-\@dl_library_path = ($dl_library_path);
-
-EOT
- }
-}
-else {
- print OUT <<EOT;
-# Initialise \@dl_library_path with the 'standard' library path
-# for this platform as determined by Configure.
+print OUT "push(\@dl_library_path, split(' ', ",
+ to_string($Config::Config{'libpth'}), "));\n";
-$cfg_dl_library_path
-
-EOT
-}
-
-my $ldlibpthname;
-my $ldlibpthname_defined;
-my $pthsep;
-
-if ($ENV{PERL_BUILD_EXPAND_CONFIG_VARS}) {
- $ldlibpthname = to_string($Config::Config{ldlibpthname});
- $ldlibpthname_defined = to_string(defined $Config::Config{ldlibpthname} ? 1 : 0);
- $pthsep = to_string($Config::Config{path_sep});
-}
-else {
- $ldlibpthname = q($Config::Config{ldlibpthname});
- $ldlibpthname_defined = q(defined $Config::Config{ldlibpthname});
- $pthsep = q($Config::Config{path_sep});
-}
-print OUT <<EOT;
-my \$ldlibpthname = $ldlibpthname;
-my \$ldlibpthname_defined = $ldlibpthname_defined;
-my \$pthsep = $pthsep;
-
-EOT
-
-my $env_dl_library_path = <<'EOT';
-if ($ldlibpthname_defined &&
- exists $ENV{$ldlibpthname}) {
- push(@dl_library_path, split(/$pthsep/, $ENV{$ldlibpthname}));
-}
-
-# E.g. HP-UX supports both its native SHLIB_PATH *and* LD_LIBRARY_PATH.
-
-if ($ldlibpthname_defined &&
- $ldlibpthname ne 'LD_LIBRARY_PATH' &&
- exists $ENV{LD_LIBRARY_PATH}) {
- push(@dl_library_path, split(/$pthsep/, $ENV{LD_LIBRARY_PATH}));
-}
-EOT
-
-if ($ENV{PERL_BUILD_EXPAND_CONFIG_VARS} && $ENV{PERL_BUILD_EXPAND_ENV_VARS}) {
- eval $env_dl_library_path;
-}
-else {
- print OUT <<EOT;
-# Add to \@dl_library_path any extra directories we can gather from environment
-# during runtime.
-
-$env_dl_library_path
-
-EOT
-}
-
-if ($ENV{PERL_BUILD_EXPAND_CONFIG_VARS} && $ENV{PERL_BUILD_EXPAND_ENV_VARS}) {
- my $dl_library_path = dquoted_comma_list(@dl_library_path);
- print OUT <<EOT;
-# The below \@dl_library_path has been expanded (%Config, %ENV)
-# in Perl build time.
-
-\@dl_library_path = ($dl_library_path);
+print OUT <<'EOT';
-EOT
-}
+# Add to @dl_library_path any extra directories we can gather from
+# environment variables. So far LD_LIBRARY_PATH is the only known
+# variable used for this purpose. Others may be added later.
+push(@dl_library_path, split(/:/, $ENV{LD_LIBRARY_PATH}))
+ if $ENV{LD_LIBRARY_PATH};
-if ( $Config::Config{d_libname_unique} ) {
- printf OUT <<'EOT', length($Config::Config{dlext}) + 1;
-sub mod2fname {
- my $parts = shift;
- my $so_len = %d;
- my $name_max = 255; # No easy way to get this here
-
- my $libname = "PL_" . join("__", @$parts);
-
- return $libname if (length($libname)+$so_len) <= $name_max;
-
- # It's too darned big, so we need to go strip. We use the same
- # algorithm as xsubpp does. First, strip out doubled __
- $libname =~ s/__/_/g;
- return $libname if (length($libname)+$so_len) <= $name_max;
-
- # Strip duplicate letters
- 1 while $libname =~ s/(.)\1/\U$1/i;
- return $libname if (length($libname)+$so_len) <= $name_max;
-
- # Still too long. Truncate.
- $libname = substr($libname, 0, $name_max - $so_len);
- return $libname;
-}
-EOT
-}
-# following long string contains $^O-specific stuff, which is factored out
-print OUT expand_os_specific(<<'EOT');
# No prizes for guessing why we don't say 'bootstrap DynaLoader;' here.
-# NOTE: All dl_*.xs (including dl_none.xs) define a dl_error() XSUB
boot_DynaLoader('DynaLoader') if defined(&boot_DynaLoader) &&
- !defined(&dl_error);
+ !defined(&dl_load_file);
+
if ($dl_debug) {
print STDERR "DynaLoader.pm loaded (@INC, @dl_library_path)\n";
@@ -281,13 +116,8 @@ if ($dl_debug) {
sub croak { require Carp; Carp::croak(@_) }
-sub bootstrap_inherit {
- my $module = $_[0];
- local *isa = *{"$module\::ISA"};
- local @isa = (@isa, 'DynaLoader');
- # Cannot goto due to delocalization. Will report errors on a wrong line?
- bootstrap(@_);
-}
+# The bootstrap function cannot be autoloaded (without complications)
+# so we define it here:
sub bootstrap {
# use local vars to enable $module.bs script to edit values
@@ -307,12 +137,6 @@ sub bootstrap {
" dynamic loading or has the $module module statically linked into it.)\n")
unless defined(&dl_load_file);
-
- <<$^O-eq-os2>>
- # Can dynaload, but cannot dynaload Perl modules...
- die 'Dynaloaded Perl modules are not available in this build of Perl' if $OS2::is_static;
-
- <</$^O-eq-os2>>
my @modparts = split(/::/,$module);
my $modfname = $modparts[-1];
@@ -321,29 +145,20 @@ sub bootstrap {
# It may also edit @modparts if required.
$modfname = &mod2fname(\@modparts) if defined &mod2fname;
- <<$^O-eq-NetWare>>
- # Truncate the module name to 8.3 format for NetWare
- if ((length($modfname) > 8)) {
- $modfname = substr($modfname, 0, 8);
- }
- <</$^O-eq-NetWare>>
-
my $modpname = join('/',@modparts);
print STDERR "DynaLoader::bootstrap for $module ",
- "(auto/$modpname/$modfname.$dl_dlext)\n"
- if $dl_debug;
+ "(auto/$modpname/$modfname.$dl_dlext)\n" if $dl_debug;
foreach (@INC) {
- <<$^O-eq-VMS>>chop($_ = VMS::Filespec::unixpath($_));<</$^O-eq-VMS>>
- my $dir = "$_/auto/$modpname";
-
+ chop($_ = VMS::Filespec::unixpath($_)) if $Is_VMS;
+ my $dir = "$_/auto/$modpname";
next unless -d $dir; # skip over uninteresting directories
-
+
# check for common cases to avoid autoload of dl_findfile
- my $try = "$dir/$modfname.$dl_dlext";
- last if $file = ($do_expand) ? dl_expandspec($try) : ((-f $try) && $try);
-
+ my $try = "$dir/$modfname.$dl_dlext";
+ last if $file = ($do_expand) ? dl_expandspec($try) : (-f $try && $try);
+
# no luck here, save dir for possible later dl_findfile search
push @dirs, $dir;
}
@@ -353,7 +168,6 @@ sub bootstrap {
croak("Can't locate loadable object for module $module in \@INC (\@INC contains: @INC)")
unless $file; # wording similar to error from 'require'
- <<$^O-eq-VMS>>$file = uc($file) if $Config::Config{d_vms_case_sensitive_symbols};<</$^O-eq-VMS>>
my $bootname = "boot_$module";
$bootname =~ s/\W/_/g;
@dl_require_symbols = ($bootname);
@@ -362,21 +176,13 @@ sub bootstrap {
# The .bs file can be used to configure @dl_resolve_using etc to
# match the needs of the individual module on this architecture.
my $bs = $file;
- $bs =~ s/(\.\w+)?(;\d*)?$/\.bs/; # look for .bs 'beside' the library
+ $bs =~ s/(\.\w+)?$/\.bs/; # look for .bs 'beside' the library
if (-s $bs) { # only read file if it's not empty
print STDERR "BS: $bs ($^O, $dlsrc)\n" if $dl_debug;
eval { do $bs; };
warn "$bs: $@\n" if $@;
}
- my $boot_symbol_ref;
-
- <<$^O-eq-darwin>>
- if ($boot_symbol_ref = dl_find_symbol(0, $bootname)) {
- goto boot; #extension library has already been loaded, e.g. darwin
- }
- <</$^O-eq-darwin>>
-
# Many dynamic extension loading problems will appear to come from
# this section of code: XYZ failed at line 123 of DynaLoader.pm.
# Often these errors are actually occurring in the initialisation
@@ -384,13 +190,8 @@ sub bootstrap {
# in this perl code simply because this was the last perl code
# it executed.
- my $flags = $module->dl_load_flags;
- <<$^O-eq-android>>
- # See the note above regarding the linker.
- $flags = 0x00;
- <</$^O-eq-android>>
- my $libref = dl_load_file($file, $flags) or
- croak("Can't load '$file' for module $module: ".dl_error());
+ my $libref = dl_load_file($file, $module->dl_load_flags) or
+ croak("Can't load '$file' for module $module: ".dl_error()."\n");
push(@dl_librefs,$libref); # record loaded object
@@ -400,21 +201,30 @@ sub bootstrap {
Carp::carp("Undefined symbols present after loading $file: @unresolved\n");
}
- $boot_symbol_ref = dl_find_symbol($libref, $bootname) or
+ my $boot_symbol_ref = dl_find_symbol($libref, $bootname) or
croak("Can't find '$bootname' symbol in $file\n");
- push(@dl_modules, $module); # record loaded module
-
- boot:
my $xs = dl_install_xsub("${module}::bootstrap", $boot_symbol_ref, $file);
- # See comment block above
-
- push(@dl_shared_objects, $file); # record files loaded
+ push(@dl_modules, $module); # record loaded module
+ # See comment block above
&$xs(@args);
}
+
+#sub _check_file { # private utility to handle dl_expandspec vs -f tests
+# my($file) = @_;
+# return $file if (!$do_expand && -f $file); # the common case
+# return $file if ( $do_expand && ($file=dl_expandspec($file)));
+# return undef;
+#}
+
+
+# Let autosplit and the autoloader deal with these functions:
+__END__
+
+
sub dl_findfile {
# Read ext/DynaLoader/DynaLoader.doc for detailed information.
# This function does not automatically consider the architecture
@@ -422,28 +232,30 @@ sub dl_findfile {
my (@args) = @_;
my (@dirs, $dir); # which directories to search
my (@found); # full paths to real files we have found
- #my $dl_ext= <<=to_string($Config::Config{'dlext'})>>; # $Config::Config{'dlext'} suffix for perl extensions
- #my $dl_so = <<=to_string($Config::Config{'so'})>>; # $Config::Config{'so'} suffix for shared libraries
+EOT
+
+print OUT ' my $dl_ext= ' . to_string($Config::Config{'dlext'}) .
+ "; # \$Config::Config{'dlext'} suffix for perl extensions\n";
+print OUT ' my $dl_so = ' . to_string($Config::Config{'so'}) .
+ "; # \$Config::Config{'so'} suffix for shared libraries\n";
+
+print OUT <<'EOT';
print STDERR "dl_findfile(@args)\n" if $dl_debug;
# accumulate directories but process files as they appear
arg: foreach(@args) {
# Special fast case: full filepath requires no search
- <<$^O-eq-VMS>>
- if (m%[:>/\]]% && -f $_) {
+ if ($Is_VMS && m%[:>/\]]% && -f $_) {
push(@found,dl_expandspec(VMS::Filespec::vmsify($_)));
last arg unless wantarray;
next;
}
- <</$^O-eq-VMS>>
- <<$^O-ne-VMS>>
- if (m:/: && -f $_) {
+ elsif (m:/: && -f $_ && !$do_expand) {
push(@found,$_);
last arg unless wantarray;
next;
}
- <</$^O-ne-VMS>>
# Deal with directories first:
# Using a -L prefix is the preferred option (faster and more robust)
@@ -453,11 +265,9 @@ sub dl_findfile {
# (this is a more complicated issue than it first appears)
if (m:/: && -d $_) { push(@dirs, $_); next; }
- <<$^O-eq-VMS>>
- # VMS: we may be using native VMS directory syntax instead of
+ # VMS: we may be using native VMS directry syntax instead of
# Unix emulation, so check this as well
- if (/[:>\]]/ && -d $_) { push(@dirs, $_); next; }
- <</$^O-eq-VMS>>
+ if ($Is_VMS && /[:>\]]/ && -d $_) { push(@dirs, $_); next; }
# Only files should get this far...
my(@names, $name); # what filenames to look for
@@ -467,31 +277,17 @@ sub dl_findfile {
push(@names,"lib$_.a");
} else { # Umm, a bare name. Try various alternatives:
# these should be ordered with the most likely first
- push(@names,"$_.$dl_dlext") unless m/\.$dl_dlext$/o;
+ push(@names,"$_.$dl_ext") unless m/\.$dl_ext$/o;
push(@names,"$_.$dl_so") unless m/\.$dl_so$/o;
- <<$^O-eq-cygwin>>
- push(@names,"cyg$_.$dl_so") unless m:/:;
- <</$^O-eq-cygwin>>
push(@names,"lib$_.$dl_so") unless m:/:;
push(@names,"$_.a") if !m/\.a$/ and $dlsrc eq "dl_dld.xs";
push(@names, $_);
}
- my $dirsep = '/';
- <<$^O-eq-symbian>>
- $dirsep = '\\';
- if ($0 =~ /^([a-z]):/i) {
- my $drive = $1;
- @dirs = map { "$drive:$_" } @dirs;
- @dl_library_path = map { "$drive:$_" } @dl_library_path;
- }
- <</$^O-eq-symbian>>
foreach $dir (@dirs, @dl_library_path) {
next unless -d $dir;
- <<$^O-eq-VMS>>
- chop($dir = VMS::Filespec::unixpath($dir));
- <</$^O-eq-VMS>>
+ chop($dir = VMS::Filespec::unixpath($dir)) if $Is_VMS;
foreach $name (@names) {
- my($file) = "$dir$dirsep$name";
+ my($file) = "$dir/$name";
print STDERR " checking in $dir for $name\n" if $dl_debug;
$file = ($do_expand) ? dl_expandspec($file) : (-f $file && $file);
#$file = _check_file($file);
@@ -513,15 +309,12 @@ sub dl_findfile {
}
-<<$^O-eq-VMS>>
-# dl_expandspec should be defined in dl_vms.xs
-<<|$^O-eq-VMS>>
sub dl_expandspec {
my($spec) = @_;
# Optional function invoked if DynaLoader.pm sets $do_expand.
# Most systems do not require or use this function.
# Some systems may implement it in the dl_*.xs file in which case
- # this Perl version should be excluded at build time.
+ # this autoload version will not be called but is harmless.
# This function is designed to deal with systems which treat some
# 'filenames' in a special way. For example VMS 'Logical Names'
@@ -532,11 +325,15 @@ sub dl_expandspec {
my $file = $spec; # default output to input
+ if ($Is_VMS) { # dl_expandspec should be defined in dl_vms.xs
+ require Carp;
+ Carp::croak("dl_expandspec: should be defined in XS file!\n");
+ } else {
return undef unless -f $file;
+ }
print STDERR "dl_expandspec($spec) => $file\n" if $dl_debug;
$file;
}
-<</$^O-eq-VMS>>
sub dl_find_symbol_anywhere
{
@@ -549,12 +346,12 @@ sub dl_find_symbol_anywhere
return undef;
}
-__END__
-
=head1 NAME
DynaLoader - Dynamically load C libraries into Perl code
+dl_error(), dl_findfile(), dl_expandspec(), dl_load_file(), dl_find_symbol(), dl_find_symbol_anywhere(), dl_undef_symbols(), dl_install_xsub(), dl_load_flags(), bootstrap() - routines used by DynaLoader modules
+
=head1 SYNOPSIS
package YourPackage;
@@ -588,9 +385,7 @@ useless for accessing non-Perl libraries because it provides almost no
Perl-to-C 'glue'. There is, for example, no mechanism for calling a C
library function or supplying arguments. A C::DynaLib module
is available from CPAN sites which performs that function for some
-common system types. And since the year 2000, there's also Inline::C,
-a module that allows you to write Perl subroutines in C. Also available
-from your local CPAN site.
+common system types.
DynaLoader Interface Summary
@@ -598,10 +393,8 @@ DynaLoader Interface Summary
@dl_resolve_using
@dl_require_symbols
$dl_debug
- $dl_dlext
@dl_librefs
@dl_modules
- @dl_shared_objects
Implemented in:
bootstrap($modulename) Perl
@filepaths = dl_findfile(@names) Perl
@@ -609,7 +402,6 @@ DynaLoader Interface Summary
$symref = dl_find_symbol_anywhere($symbol) Perl
$libref = dl_load_file($filename, $flags) C
- $status = dl_unload_file($libref) C
$symref = dl_find_symbol($libref, $symbol) C
@symbols = dl_undef_symbols() C
dl_install_xsub($name, $symref [, $filename]) C
@@ -677,10 +469,6 @@ the loaded files.
An array of module (package) names that have been bootstrap'ed.
-=item @dl_shared_objects
-
-An array of file names for the shared objects that were loaded.
-
=item dl_error()
Syntax:
@@ -711,19 +499,6 @@ built with the B<-DDEBUGGING> flag. This can also be set via the
PERL_DL_DEBUG environment variable. Set to 1 for minimal information or
higher for more.
-=item $dl_dlext
-
-When specified (localised) in a module's F<.pm> file, indicates the extension
-which the module's loadable object will have. For example:
-
- local $DynaLoader::dl_dlext = 'unusual_ext';
-
-would indicate that the module's loadable object has an extension of
-C<unusual_ext> instead of the more usual C<$Config{dlext}>. NOTE: This also
-requires that the module's F<Makefile.PL> specify (in C<WriteMakefile()>):
-
- DLEXT => 'unusual_ext',
-
=item dl_findfile()
Syntax:
@@ -765,8 +540,9 @@ Some unusual systems, such as VMS, require special filename handling in
order to deal with symbolic names for files (i.e., VMS's Logical Names).
To support these systems a dl_expandspec() function can be implemented
-either in the F<dl_*.xs> file or code can be added to the dl_expandspec()
-function in F<DynaLoader.pm>. See F<DynaLoader_pm.PL> for more information.
+either in the F<dl_*.xs> file or code can be added to the autoloadable
+dl_expandspec() function in F<DynaLoader.pm>. See F<DynaLoader.pm> for
+more information.
=item dl_load_file()
@@ -803,48 +579,11 @@ current values of @dl_require_symbols and @dl_resolve_using if required.
Linux, and is a common choice when providing a "wrapper" on other
mechanisms as is done in the OS/2 port.)
-=item dl_unload_file()
-
-Syntax:
-
- $status = dl_unload_file($libref)
-
-Dynamically unload $libref, which must be an opaque 'library reference' as
-returned from dl_load_file. Returns one on success and zero on failure.
-This function is optional and may not necessarily be provided on all platforms.
-
-If it is defined and perl is compiled with the C macro C<DL_UNLOAD_ALL_AT_EXIT>
-defined, then it is called automatically when the interpreter exits for
-every shared object or library loaded by DynaLoader::bootstrap. All such
-library references are stored in @dl_librefs by DynaLoader::Bootstrap as it
-loads the libraries. The files are unloaded in last-in, first-out order.
-
-This unloading is usually necessary when embedding a shared-object perl (e.g.
-one configured with -Duseshrplib) within a larger application, and the perl
-interpreter is created and destroyed several times within the lifetime of the
-application. In this case it is possible that the system dynamic linker will
-unload and then subsequently reload the shared libperl without relocating any
-references to it from any files DynaLoaded by the previous incarnation of the
-interpreter. As a result, any shared objects opened by DynaLoader may point to
-a now invalid 'ghost' of the libperl shared object, causing apparently random
-memory corruption and crashes. This behaviour is most commonly seen when using
-Apache and mod_perl built with the APXS mechanism.
-
- SunOS: dlclose($libref)
- HP-UX: ???
- Linux: ???
- NeXT: ???
- VMS: ???
-
-(The dlclose() function is also used by Solaris and some versions of
-Linux, and is a common choice when providing a "wrapper" on other
-mechanisms as is done in the OS/2 port.)
-
-=item dl_load_flags()
+=item dl_loadflags()
Syntax:
- $flags = dl_load_flags $modulename;
+ $flags = dl_loadflags $modulename;
Designed to be a method call, and to be overridden by a derived class
(i.e. a class which has DynaLoader in its @ISA). The definition in
@@ -914,7 +653,7 @@ $filename is not defined then "DynaLoader" will be used.
Syntax:
-bootstrap($module [...])
+bootstrap($module)
This is the normal entry point for automatic dynamic loading in Perl.
@@ -967,13 +706,6 @@ it uses the function reference returned by dl_install_xsub for speed)
=back
-All arguments to bootstrap() are passed to the module's bootstrap function.
-The default code generated by F<xsubpp> expects $module [, $version]
-If the optional $version argument is not given, it defaults to
-C<$XS_VERSION // $VERSION> in the module's symbol table. The default code
-compares the Perl-space version with the version of the compiled XS code,
-and croaks with an error if they do not match.
-
=back
diff --git a/gnu/usr.bin/perl/ext/re/Makefile.PL b/gnu/usr.bin/perl/ext/re/Makefile.PL
index c6338c7ea2f..040b085f4fa 100644
--- a/gnu/usr.bin/perl/ext/re/Makefile.PL
+++ b/gnu/usr.bin/perl/ext/re/Makefile.PL
@@ -1,71 +1,41 @@
use ExtUtils::MakeMaker;
-use File::Spec;
-use Config;
-
-my $object = 're_exec$(OBJ_EXT) re_comp$(OBJ_EXT) re$(OBJ_EXT)';
-
-my $defines = '-DPERL_EXT_RE_BUILD -DPERL_EXT_RE_DEBUG -DPERL_EXT';
-
WriteMakefile(
NAME => 're',
VERSION_FROM => 're.pm',
+ MAN3PODS => {}, # Pods will be built by installman.
XSPROTOARG => '-noprototypes',
- OBJECT => $object,
- DEFINE => $defines,
+ OBJECT => 're_exec$(OBJ_EXT) re_comp$(OBJ_EXT) re$(OBJ_EXT)',
+ DEFINE => '-DPERL_EXT_RE_BUILD',
clean => { FILES => '*$(OBJ_EXT) *.c ../../lib/re.pm' },
);
-package MY;
-
-sub upupfile {
- File::Spec->catfile(File::Spec->updir, File::Spec->updir, $_[0]);
-}
+sub MY::postamble {
+ if ($^O eq 'VMS') {
+ return <<'VMS_EOF';
+re_comp.c : [--]regcomp.c
+ - $(RM_F) $(MMS$TARGET_NAME)
+ $(CP) [--]regcomp.c $(MMS$TARGET_NAME)
-sub postamble {
- my $regcomp_c = upupfile('regcomp.c');
- my $regexec_c = upupfile('regexec.c');
- my $dquote_static_c = upupfile('dquote_static.c');
- my $inline_invlist_c = upupfile('inline_invlist.c');
+re_comp$(OBJ_EXT) : re_comp.c
- <<EOF;
-re_comp.c : $regcomp_c
- - \$(RM_F) re_comp.c
- \$(CP) $regcomp_c re_comp.c
+re_exec.c : [--]regexec.c
+ - $(RM_F) $(MMS$TARGET_NAME)
+ $(CP) [--]regexec.c $(MMS$TARGET_NAME)
-re_comp\$(OBJ_EXT) : re_comp.c dquote_static.c inline_invlist.c
+re_exec$(OBJ_EXT) : re_exec.c
-re_exec.c : $regexec_c
- - \$(RM_F) re_exec.c
- \$(CP) $regexec_c re_exec.c
-re_exec\$(OBJ_EXT) : re_exec.c inline_invlist.c
+VMS_EOF
+ } else {
+ return <<'EOF';
+re_comp.c: ../../regcomp.c
+ -$(RM_F) $@
+ $(CP) ../../regcomp.c $@
-dquote_static.c : $dquote_static_c
- - \$(RM_F) dquote_static.c
- \$(CP) $dquote_static_c dquote_static.c
-
-inline_invlist.c : $inline_invlist_c
- - \$(RM_F) inline_invlist.c
- \$(CP) $inline_invlist_c inline_invlist.c
+re_exec.c: ../../regexec.c
+ -$(RM_F) $@
+ $(CP) ../../regexec.c $@
EOF
-}
-
-sub MY::c_o {
- my($self) = @_;
- package MY; # so that "SUPER" works right
- my $inh = $self->SUPER::c_o(@_);
- use Config;
- if ($Config{osname} eq 'aix' && $Config{ccversion} eq '5.0.1.0') {
- # Known buggy optimizer.
- my $cccmd = $self->const_cccmd;
- $cccmd =~ s/^CCCMD\s*=\s*//;
- $cccmd =~ s/\s\$\(OPTIMIZE\)\s/ /;
- $inh .= qq{
-
-re_comp\$\(OBJ_EXT\): re_comp.c
-\t$cccmd \$(CCCDLFLAGS) -I\$(PERL_INC) \$(DEFINE) \$*.c
-};
- }
- $inh;
+ }
}
diff --git a/gnu/usr.bin/perl/ext/re/re.pm b/gnu/usr.bin/perl/ext/re/re.pm
index ea7e3d021ad..83e7dbafe56 100644
--- a/gnu/usr.bin/perl/ext/re/re.pm
+++ b/gnu/usr.bin/perl/ext/re/re.pm
@@ -1,228 +1,6 @@
package re;
-# pragma for controlling the regexp engine
-use strict;
-use warnings;
-
-our $VERSION = "0.26";
-our @ISA = qw(Exporter);
-our @EXPORT_OK = ('regmust',
- qw(is_regexp regexp_pattern
- regname regnames regnames_count));
-our %EXPORT_OK = map { $_ => 1 } @EXPORT_OK;
-
-my %bitmask = (
- taint => 0x00100000, # HINT_RE_TAINT
- eval => 0x00200000, # HINT_RE_EVAL
-);
-
-my $flags_hint = 0x02000000; # HINT_RE_FLAGS
-my $PMMOD_SHIFT = 0;
-my %reflags = (
- m => 1 << ($PMMOD_SHIFT + 0),
- s => 1 << ($PMMOD_SHIFT + 1),
- i => 1 << ($PMMOD_SHIFT + 2),
- x => 1 << ($PMMOD_SHIFT + 3),
- p => 1 << ($PMMOD_SHIFT + 4),
-# special cases:
- d => 0,
- l => 1,
- u => 2,
- a => 3,
- aa => 4,
-);
-
-sub setcolor {
- eval { # Ignore errors
- require Term::Cap;
-
- my $terminal = Tgetent Term::Cap ({OSPEED => 9600}); # Avoid warning.
- my $props = $ENV{PERL_RE_TC} || 'md,me,so,se,us,ue';
- my @props = split /,/, $props;
- my $colors = join "\t", map {$terminal->Tputs($_,1)} @props;
-
- $colors =~ s/\0//g;
- $ENV{PERL_RE_COLORS} = $colors;
- };
- if ($@) {
- $ENV{PERL_RE_COLORS} ||= qq'\t\t> <\t> <\t\t';
- }
-
-}
-
-my %flags = (
- COMPILE => 0x0000FF,
- PARSE => 0x000001,
- OPTIMISE => 0x000002,
- TRIEC => 0x000004,
- DUMP => 0x000008,
- FLAGS => 0x000010,
-
- EXECUTE => 0x00FF00,
- INTUIT => 0x000100,
- MATCH => 0x000200,
- TRIEE => 0x000400,
-
- EXTRA => 0xFF0000,
- TRIEM => 0x010000,
- OFFSETS => 0x020000,
- OFFSETSDBG => 0x040000,
- STATE => 0x080000,
- OPTIMISEM => 0x100000,
- STACK => 0x280000,
- BUFFERS => 0x400000,
- GPOS => 0x800000,
-);
-$flags{ALL} = -1 & ~($flags{OFFSETS}|$flags{OFFSETSDBG}|$flags{BUFFERS});
-$flags{All} = $flags{all} = $flags{DUMP} | $flags{EXECUTE};
-$flags{Extra} = $flags{EXECUTE} | $flags{COMPILE} | $flags{GPOS};
-$flags{More} = $flags{MORE} = $flags{All} | $flags{TRIEC} | $flags{TRIEM} | $flags{STATE};
-$flags{State} = $flags{DUMP} | $flags{EXECUTE} | $flags{STATE};
-$flags{TRIE} = $flags{DUMP} | $flags{EXECUTE} | $flags{TRIEC};
-
-if (defined &DynaLoader::boot_DynaLoader) {
- require XSLoader;
- XSLoader::load();
-}
-# else we're miniperl
-# We need to work for miniperl, because the XS toolchain uses Text::Wrap, which
-# uses re 'taint'.
-
-sub _load_unload {
- my ($on)= @_;
- if ($on) {
- # We call install() every time, as if we didn't, we wouldn't
- # "see" any changes to the color environment var since
- # the last time it was called.
-
- # install() returns an integer, which if casted properly
- # in C resolves to a structure containing the regexp
- # hooks. Setting it to a random integer will guarantee
- # segfaults.
- $^H{regcomp} = install();
- } else {
- delete $^H{regcomp};
- }
-}
-
-sub bits {
- my $on = shift;
- my $bits = 0;
- ARG:
- foreach my $idx (0..$#_){
- my $s=$_[$idx];
- if ($s eq 'Debug' or $s eq 'Debugcolor') {
- setcolor() if $s =~/color/i;
- ${^RE_DEBUG_FLAGS} = 0 unless defined ${^RE_DEBUG_FLAGS};
- for my $idx ($idx+1..$#_) {
- if ($flags{$_[$idx]}) {
- if ($on) {
- ${^RE_DEBUG_FLAGS} |= $flags{$_[$idx]};
- } else {
- ${^RE_DEBUG_FLAGS} &= ~ $flags{$_[$idx]};
- }
- } else {
- require Carp;
- Carp::carp("Unknown \"re\" Debug flag '$_[$idx]', possible flags: ",
- join(", ",sort keys %flags ) );
- }
- }
- _load_unload($on ? 1 : ${^RE_DEBUG_FLAGS});
- last;
- } elsif ($s eq 'debug' or $s eq 'debugcolor') {
- setcolor() if $s =~/color/i;
- _load_unload($on);
- last;
- } elsif (exists $bitmask{$s}) {
- $bits |= $bitmask{$s};
- } elsif ($EXPORT_OK{$s}) {
- require Exporter;
- re->export_to_level(2, 're', $s);
- } elsif ($s =~ s/^\///) {
- my $reflags = $^H{reflags} || 0;
- my $seen_charset;
- while ($s =~ m/( . )/gx) {
- local $_ = $1;
- if (/[adul]/) {
- # The 'a' may be repeated; hide this from the rest of the
- # code by counting and getting rid of all of them, then
- # changing to 'aa' if there is a repeat.
- if ($_ eq 'a') {
- my $sav_pos = pos $s;
- my $a_count = $s =~ s/a//g;
- pos $s = $sav_pos - 1; # -1 because got rid of the 'a'
- if ($a_count > 2) {
- require Carp;
- Carp::carp(
- qq 'The "a" flag may only appear a maximum of twice'
- );
- }
- elsif ($a_count == 2) {
- $_ = 'aa';
- }
- }
- if ($on) {
- if ($seen_charset) {
- require Carp;
- if ($seen_charset ne $_) {
- Carp::carp(
- qq 'The "$seen_charset" and "$_" flags '
- .qq 'are exclusive'
- );
- }
- else {
- Carp::carp(
- qq 'The "$seen_charset" flag may not appear '
- .qq 'twice'
- );
- }
- }
- $^H{reflags_charset} = $reflags{$_};
- $seen_charset = $_;
- }
- else {
- delete $^H{reflags_charset}
- if defined $^H{reflags_charset}
- && $^H{reflags_charset} == $reflags{$_};
- }
- } elsif (exists $reflags{$_}) {
- $on
- ? $reflags |= $reflags{$_}
- : ($reflags &= ~$reflags{$_});
- } else {
- require Carp;
- Carp::carp(
- qq'Unknown regular expression flag "$_"'
- );
- next ARG;
- }
- }
- ($^H{reflags} = $reflags or defined $^H{reflags_charset})
- ? $^H |= $flags_hint
- : ($^H &= ~$flags_hint);
- } else {
- require Carp;
- Carp::carp("Unknown \"re\" subpragma '$s' (known ones are: ",
- join(', ', map {qq('$_')} 'debug', 'debugcolor', sort keys %bitmask),
- ")");
- }
- }
- $bits;
-}
-
-sub import {
- shift;
- $^H |= bits(1, @_);
-}
-
-sub unimport {
- shift;
- $^H &= ~ bits(0, @_);
-}
-
-1;
-
-__END__
+$VERSION = 0.02;
=head1 NAME
@@ -235,117 +13,50 @@ re - Perl pragma to alter regular expression behaviour
$pat = '(?{ $foo = 1 })';
use re 'eval';
- /foo${pat}bar/; # won't fail (when not under -T
- # switch)
+ /foo${pat}bar/; # won't fail (when not under -T switch)
{
no re 'taint'; # the default
($x) = ($^X =~ /^(.*)$/s); # $x is not tainted here
no re 'eval'; # the default
- /foo${pat}bar/; # disallowed (with or without -T
- # switch)
+ /foo${pat}bar/; # disallowed (with or without -T switch)
}
- use re '/ix';
- "FOO" =~ / foo /; # /ix implied
- no re '/x';
- "FOO" =~ /foo/; # just /i implied
-
- use re 'debug'; # output debugging info during
- /^(.*)$/s; # compile and run time
-
+ use re 'debug'; # NOT lexically scoped (as others are)
+ /^(.*)$/s; # output debugging info during
+ # compile and run time
- use re 'debugcolor'; # same as 'debug', but with colored
- # output
+ use re 'debugcolor'; # same as 'debug', but with colored output
...
- use re qw(Debug All); # Same as "use re 'debug'", but you
- # can use "Debug" with things other
- # than 'All'
- use re qw(Debug More); # 'All' plus output more details
- no re qw(Debug ALL); # Turn on (almost) all re debugging
- # in this scope
-
- use re qw(is_regexp regexp_pattern); # import utility functions
- my ($pat,$mods)=regexp_pattern(qr/foo/i);
- if (is_regexp($obj)) {
- print "Got regexp: ",
- scalar regexp_pattern($obj); # just as perl would stringify
- } # it but no hassle with blessed
- # re's.
-
(We use $^X in these examples because it's tainted by default.)
=head1 DESCRIPTION
-=head2 'taint' mode
-
When C<use re 'taint'> is in effect, and a tainted string is the target
-of a regexp, the regexp memories (or values returned by the m// operator
-in list context) are tainted. This feature is useful when regexp operations
+of a regex, the regex memories (or values returned by the m// operator
+in list context) are tainted. This feature is useful when regex operations
on tainted data aren't meant to extract safe substrings, but to perform
other transformations.
-=head2 'eval' mode
-
-When C<use re 'eval'> is in effect, a regexp is allowed to contain
-C<(?{ ... })> zero-width assertions and C<(??{ ... })> postponed
-subexpressions that are derived from variable interpolation, rather than
-appearing literally within the regexp. That is normally disallowed, since
-it is a
+When C<use re 'eval'> is in effect, a regex is allowed to contain
+C<(?{ ... })> zero-width assertions even if the regex contains
+variable interpolation. This is normally disallowed, since it is a
potential security risk. Note that this pragma is ignored when the regular
expression is obtained from tainted data, i.e. evaluation is always
-disallowed with tainted regular expressions. See L<perlre/(?{ code })>
-and L<perlre/(??{ code })>.
+disallowed with tainted regular expressions. See L<perlre/(?{ code })>.
-For the purpose of this pragma, interpolation of precompiled regular
+For the purpose of this pragma, interpolation of precompiled regular
expressions (i.e., the result of C<qr//>) is I<not> considered variable
interpolation. Thus:
/foo${pat}bar/
-I<is> allowed if $pat is a precompiled regular expression, even
-if $pat contains C<(?{ ... })> assertions or C<(??{ ... })> subexpressions.
-
-=head2 '/flags' mode
-
-When C<use re '/flags'> is specified, the given flags are automatically
-added to every regular expression till the end of the lexical scope.
-
-C<no re '/flags'> will turn off the effect of C<use re '/flags'> for the
-given flags.
-
-For example, if you want all your regular expressions to have /msx on by
-default, simply put
+I<is> allowed if $pat is a precompiled regular expression, even
+if $pat contains C<(?{ ... })> assertions.
- use re '/msx';
-
-at the top of your code.
-
-The character set /adul flags cancel each other out. So, in this example,
-
- use re "/u";
- "ss" =~ /\xdf/;
- use re "/d";
- "ss" =~ /\xdf/;
-
-the second C<use re> does an implicit C<no re '/u'>.
-
-Turning on one of the character set flags with C<use re> takes precedence over the
-C<locale> pragma and the 'unicode_strings' C<feature>, for regular
-expressions. Turning off one of these flags when it is active reverts to
-the behaviour specified by whatever other pragmata are in scope. For
-example:
-
- use feature "unicode_strings";
- no re "/u"; # does nothing
- use re "/l";
- no re "/l"; # reverts to unicode_strings behaviour
-
-=head2 'debug' mode
-
-When C<use re 'debug'> is in effect, perl emits debugging messages when
+When C<use re 'debug'> is in effect, perl emits debugging messages when
compiling and using regular expressions. The output is the same as that
obtained by running a C<-DDEBUGGING>-enabled perl interpreter with the
B<-Dr> switch. It may be quite voluminous depending on the complexity
@@ -353,257 +64,68 @@ of the match. Using C<debugcolor> instead of C<debug> enables a
form of output that can be used to get a colorful display on terminals
that understand termcap color sequences. Set C<$ENV{PERL_RE_TC}> to a
comma-separated list of C<termcap> properties to use for highlighting
-strings on/off, pre-point part on/off.
-See L<perldebug/"Debugging Regular Expressions"> for additional info.
+strings on/off, pre-point part on/off.
+See L<perldebug/"Debugging regular expressions"> for additional info.
-As of 5.9.5 the directive C<use re 'debug'> and its equivalents are
-lexically scoped, as the other directives are. However they have both
-compile-time and run-time effects.
+The directive C<use re 'debug'> is I<not lexically scoped>, as the
+other directives are. It has both compile-time and run-time effects.
See L<perlmodlib/Pragmatic Modules>.
-=head2 'Debug' mode
-
-Similarly C<use re 'Debug'> produces debugging output, the difference
-being that it allows the fine tuning of what debugging output will be
-emitted. Options are divided into three groups, those related to
-compilation, those related to execution and those related to special
-purposes. The options are as follows:
-
-=over 4
-
-=item Compile related options
-
-=over 4
-
-=item COMPILE
-
-Turns on all compile related debug options.
-
-=item PARSE
-
-Turns on debug output related to the process of parsing the pattern.
-
-=item OPTIMISE
-
-Enables output related to the optimisation phase of compilation.
-
-=item TRIEC
-
-Detailed info about trie compilation.
-
-=item DUMP
-
-Dump the final program out after it is compiled and optimised.
-
-=back
-
-=item Execute related options
-
-=over 4
-
-=item EXECUTE
-
-Turns on all execute related debug options.
-
-=item MATCH
-
-Turns on debugging of the main matching loop.
-
-=item TRIEE
-
-Extra debugging of how tries execute.
-
-=item INTUIT
-
-Enable debugging of start-point optimisations.
-
-=back
-
-=item Extra debugging options
-
-=over 4
-
-=item EXTRA
-
-Turns on all "extra" debugging options.
-
-=item BUFFERS
-
-Enable debugging the capture group storage during match. Warning,
-this can potentially produce extremely large output.
-
-=item TRIEM
-
-Enable enhanced TRIE debugging. Enhances both TRIEE
-and TRIEC.
-
-=item STATE
-
-Enable debugging of states in the engine.
-
-=item STACK
-
-Enable debugging of the recursion stack in the engine. Enabling
-or disabling this option automatically does the same for debugging
-states as well. This output from this can be quite large.
-
-=item OPTIMISEM
-
-Enable enhanced optimisation debugging and start-point optimisations.
-Probably not useful except when debugging the regexp engine itself.
-
-=item OFFSETS
-
-Dump offset information. This can be used to see how regops correlate
-to the pattern. Output format is
-
- NODENUM:POSITION[LENGTH]
-
-Where 1 is the position of the first char in the string. Note that position
-can be 0, or larger than the actual length of the pattern, likewise length
-can be zero.
-
-=item OFFSETSDBG
-
-Enable debugging of offsets information. This emits copious
-amounts of trace information and doesn't mesh well with other
-debug options.
-
-Almost definitely only useful to people hacking
-on the offsets part of the debug engine.
-
-=back
-
-=item Other useful flags
-
-These are useful shortcuts to save on the typing.
-
-=over 4
-
-=item ALL
-
-Enable all options at once except OFFSETS, OFFSETSDBG and BUFFERS.
-(To get every single option without exception, use both ALL and EXTRA.)
-
-=item All
-
-Enable DUMP and all execute options. Equivalent to:
-
- use re 'debug';
-
-=item MORE
-
-=item More
-
-Enable the options enabled by "All", plus STATE, TRIEC, and TRIEM.
-
-=back
-
-=back
-
-As of 5.9.5 the directive C<use re 'debug'> and its equivalents are
-lexically scoped, as are the other directives. However they have both
-compile-time and run-time effects.
-
-=head2 Exportable Functions
-
-As of perl 5.9.5 're' debug contains a number of utility functions that
-may be optionally exported into the caller's namespace. They are listed
-below.
-
-=over 4
-
-=item is_regexp($ref)
-
-Returns true if the argument is a compiled regular expression as returned
-by C<qr//>, false if it is not.
-
-This function will not be confused by overloading or blessing. In
-internals terms, this extracts the regexp pointer out of the
-PERL_MAGIC_qr structure so it cannot be fooled.
-
-=item regexp_pattern($ref)
-
-If the argument is a compiled regular expression as returned by C<qr//>,
-then this function returns the pattern.
-
-In list context it returns a two element list, the first element
-containing the pattern and the second containing the modifiers used when
-the pattern was compiled.
-
- my ($pat, $mods) = regexp_pattern($ref);
-
-In scalar context it returns the same as perl would when stringifying a raw
-C<qr//> with the same pattern inside. If the argument is not a compiled
-reference then this routine returns false but defined in scalar context,
-and the empty list in list context. Thus the following
-
- if (regexp_pattern($ref) eq '(?^i:foo)')
-
-will be warning free regardless of what $ref actually is.
-
-Like C<is_regexp> this function will not be confused by overloading
-or blessing of the object.
-
-=item regmust($ref)
-
-If the argument is a compiled regular expression as returned by C<qr//>,
-then this function returns what the optimiser considers to be the longest
-anchored fixed string and longest floating fixed string in the pattern.
-
-A I<fixed string> is defined as being a substring that must appear for the
-pattern to match. An I<anchored fixed string> is a fixed string that must
-appear at a particular offset from the beginning of the match. A I<floating
-fixed string> is defined as a fixed string that can appear at any point in
-a range of positions relative to the start of the match. For example,
-
- my $qr = qr/here .* there/x;
- my ($anchored, $floating) = regmust($qr);
- print "anchored:'$anchored'\nfloating:'$floating'\n";
-
-results in
-
- anchored:'here'
- floating:'there'
-
-Because the C<here> is before the C<.*> in the pattern, its position
-can be determined exactly. That's not true, however, for the C<there>;
-it could appear at any point after where the anchored string appeared.
-Perl uses both for its optimisations, preferring the longer, or, if they are
-equal, the floating.
-
-B<NOTE:> This may not necessarily be the definitive longest anchored and
-floating string. This will be what the optimiser of the Perl that you
-are using thinks is the longest. If you believe that the result is wrong
-please report it via the L<perlbug> utility.
-
-=item regname($name,$all)
+=cut
-Returns the contents of a named buffer of the last successful match. If
-$all is true, then returns an array ref containing one entry per buffer,
-otherwise returns the first defined buffer.
+my %bitmask = (
+taint => 0x00100000,
+eval => 0x00200000,
+);
-=item regnames($all)
+sub setcolor {
+ eval { # Ignore errors
+ require Term::Cap;
-Returns a list of all of the named buffers defined in the last successful
-match. If $all is true, then it returns all names defined, if not it returns
-only names which were involved in the match.
+ my $terminal = Tgetent Term::Cap ({OSPEED => 9600}); # Avoid warning.
+ my $props = $ENV{PERL_RE_TC} || 'md,me,so,se'; # can use us/ue later
+ my @props = split /,/, $props;
-=item regnames_count()
-Returns the number of distinct names defined in the pattern used
-for the last successful match.
+ $ENV{TERMCAP_COLORS} = join "\t", map {$terminal->Tputs($_,1)} @props;
+ };
-B<Note:> this result is always the actual number of distinct
-named buffers defined, it may not actually match that which is
-returned by C<regnames()> and related routines when those routines
-have not been called with the $all parameter set.
+ not defined $ENV{TERMCAP_COLORS} or ($ENV{TERMCAP_COLORS} =~ tr/\t/\t/) >= 4
+ or not defined $ENV{PERL_RE_TC}
+ or die "Not enough fields in \$ENV{PERL_RE_TC}=`$ENV{PERL_RE_TC}'";
+}
-=back
+sub bits {
+ my $on = shift;
+ my $bits = 0;
+ unless(@_) {
+ require Carp;
+ Carp::carp("Useless use of \"re\" pragma");
+ }
+ foreach my $s (@_){
+ if ($s eq 'debug' or $s eq 'debugcolor') {
+ setcolor() if $s eq 'debugcolor';
+ require DynaLoader;
+ @ISA = ('DynaLoader');
+ bootstrap re;
+ install() if $on;
+ uninstall() unless $on;
+ next;
+ }
+ $bits |= $bitmask{$s} || 0;
+ }
+ $bits;
+}
-=head1 SEE ALSO
+sub import {
+ shift;
+ $^H |= bits(1,@_);
+}
-L<perlmodlib/Pragmatic Modules>.
+sub unimport {
+ shift;
+ $^H &= ~ bits(0,@_);
+}
-=cut
+1;
diff --git a/gnu/usr.bin/perl/ext/re/re.xs b/gnu/usr.bin/perl/ext/re/re.xs
index 2be0773ffbb..7230d626dc2 100644
--- a/gnu/usr.bin/perl/ext/re/re.xs
+++ b/gnu/usr.bin/perl/ext/re/re.xs
@@ -1,116 +1,46 @@
-#if defined(PERL_EXT_RE_DEBUG) && !defined(DEBUGGING)
+/* We need access to debugger hooks */
+#ifndef DEBUGGING
# define DEBUGGING
#endif
-#define PERL_NO_GET_CONTEXT
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
-#include "re_comp.h"
+extern regexp* my_regcomp _((char* exp, char* xend, PMOP* pm));
+extern I32 my_regexec _((regexp* prog, char* stringarg, char* strend,
+ char* strbeg, I32 minend, SV* screamer,
+ void* data, U32 flags));
-START_EXTERN_C
+static int oldfl;
-extern REGEXP* my_re_compile (pTHX_ SV * const pattern, const U32 pm_flags);
-extern REGEXP* my_re_op_compile (pTHX_ SV ** const patternp, int pat_count,
- OP *expr, const regexp_engine* eng, REGEXP *VOL old_re,
- bool *is_bare_re, U32 rx_flags, U32 pm_flags);
+#define R_DB 512
-extern I32 my_regexec (pTHX_ REGEXP * const prog, char* stringarg, char* strend,
- char* strbeg, SSize_t minend, SV* screamer,
- void* data, U32 flags);
-
-extern char* my_re_intuit_start(pTHX_
- REGEXP * const rx,
- SV *sv,
- const char * const strbeg,
- char *strpos,
- char *strend,
- const U32 flags,
- re_scream_pos_data *data);
-
-extern SV* my_re_intuit_string (pTHX_ REGEXP * const prog);
-
-extern void my_regfree (pTHX_ REGEXP * const r);
-
-extern void my_reg_numbered_buff_fetch(pTHX_ REGEXP * const rx, const I32 paren,
- SV * const usesv);
-extern void my_reg_numbered_buff_store(pTHX_ REGEXP * const rx, const I32 paren,
- SV const * const value);
-extern I32 my_reg_numbered_buff_length(pTHX_ REGEXP * const rx,
- const SV * const sv, const I32 paren);
-
-extern SV* my_reg_named_buff(pTHX_ REGEXP * const, SV * const, SV * const,
- const U32);
-extern SV* my_reg_named_buff_iter(pTHX_ REGEXP * const rx,
- const SV * const lastkey, const U32 flags);
-
-extern SV* my_reg_qr_package(pTHX_ REGEXP * const rx);
-#if defined(USE_ITHREADS)
-extern void* my_regdupe (pTHX_ REGEXP * const r, CLONE_PARAMS *param);
-#endif
-
-EXTERN_C const struct regexp_engine my_reg_engine;
-
-END_EXTERN_C
+static void
+deinstall(void)
+{
+ dTHR;
+ PL_regexecp = &regexec_flags;
+ PL_regcompp = &pregcomp;
+ if (!oldfl)
+ PL_debug &= ~R_DB;
+}
-const struct regexp_engine my_reg_engine = {
- my_re_compile,
- my_regexec,
- my_re_intuit_start,
- my_re_intuit_string,
- my_regfree,
- my_reg_numbered_buff_fetch,
- my_reg_numbered_buff_store,
- my_reg_numbered_buff_length,
- my_reg_named_buff,
- my_reg_named_buff_iter,
- my_reg_qr_package,
-#if defined(USE_ITHREADS)
- my_regdupe,
-#endif
- my_re_op_compile,
-};
+static void
+install(void)
+{
+ dTHR;
+ PL_colorset = 0; /* Allow reinspection of ENV. */
+ PL_regexecp = &my_regexec;
+ PL_regcompp = &my_regcomp;
+ oldfl = PL_debug & R_DB;
+ PL_debug |= R_DB;
+}
MODULE = re PACKAGE = re
void
install()
- PPCODE:
- PL_colorset = 0; /* Allow reinspection of ENV. */
- /* PL_debug |= DEBUG_r_FLAG; */
- XPUSHs(sv_2mortal(newSViv(PTR2IV(&my_reg_engine))));
void
-regmust(sv)
- SV * sv
-PROTOTYPE: $
-PREINIT:
- REGEXP *re;
-PPCODE:
-{
- if ((re = SvRX(sv)) /* assign deliberate */
- /* only for re engines we know about */
- && (RX_ENGINE(re) == &my_reg_engine
- || RX_ENGINE(re) == &PL_core_reg_engine))
- {
- SV *an = &PL_sv_no;
- SV *fl = &PL_sv_no;
- if (RX_ANCHORED_SUBSTR(re)) {
- an = sv_2mortal(newSVsv(RX_ANCHORED_SUBSTR(re)));
- } else if (RX_ANCHORED_UTF8(re)) {
- an = sv_2mortal(newSVsv(RX_ANCHORED_UTF8(re)));
- }
- if (RX_FLOAT_SUBSTR(re)) {
- fl = sv_2mortal(newSVsv(RX_FLOAT_SUBSTR(re)));
- } else if (RX_FLOAT_UTF8(re)) {
- fl = sv_2mortal(newSVsv(RX_FLOAT_UTF8(re)));
- }
- EXTEND(SP, 2);
- PUSHs(an);
- PUSHs(fl);
- XSRETURN(2);
- }
- XSRETURN_UNDEF;
-}
-
+deinstall()
diff --git a/gnu/usr.bin/perl/iperlsys.h b/gnu/usr.bin/perl/iperlsys.h
index 003405f690f..da8c5d6ac93 100644
--- a/gnu/usr.bin/perl/iperlsys.h
+++ b/gnu/usr.bin/perl/iperlsys.h
@@ -7,6 +7,11 @@
* that can be #defined to the system-level function (or a wrapper
* provided elsewhere).
*
+ * When using C++ with -DPERL_OBJECT, this definition is in the
+ * form of a set of virtual base classes which must be subclassed to
+ * provide a real implementation. The Perl Object will use instances
+ * of this implementation to use the system-level functionality.
+ *
* GSAR 21-JUN-98
*/
@@ -44,396 +49,382 @@
*
*/
+
/*
- Interface for perl stdio functions, or whatever we are Configure-d
- to use.
+ Interface for perl stdio functions
*/
-#include "perlio.h"
-#ifndef Sighandler_t
-# if defined(HAS_SIGACTION) && defined(SA_SIGINFO)
-typedef Signal_t (*Sighandler_t) (int, siginfo_t*, void*);
-# else
-typedef Signal_t (*Sighandler_t) (int);
+
+/* Clean up (or at least document) the various possible #defines.
+ This section attempts to match the 5.003_03 Configure variables
+ onto the 5.003_02 header file values.
+ I can't figure out where USE_STDIO was supposed to be set.
+ --AD
+*/
+#ifndef USE_PERLIO
+# define PERLIO_IS_STDIO
+#endif
+
+/* Below is the 5.003_02 stuff. */
+#ifdef USE_STDIO
+# ifndef PERLIO_IS_STDIO
+# define PERLIO_IS_STDIO
# endif
+#else
+extern void PerlIO_init _((void));
#endif
-#if defined(PERL_IMPLICIT_SYS)
-
-/* IPerlStdIO */
-struct IPerlStdIO;
-struct IPerlStdIOInfo;
-typedef FILE* (*LPStdin)(struct IPerlStdIO*);
-typedef FILE* (*LPStdout)(struct IPerlStdIO*);
-typedef FILE* (*LPStderr)(struct IPerlStdIO*);
-typedef FILE* (*LPOpen)(struct IPerlStdIO*, const char*,
- const char*);
-typedef int (*LPClose)(struct IPerlStdIO*, FILE*);
-typedef int (*LPEof)(struct IPerlStdIO*, FILE*);
-typedef int (*LPError)(struct IPerlStdIO*, FILE*);
-typedef void (*LPClearerr)(struct IPerlStdIO*, FILE*);
-typedef int (*LPGetc)(struct IPerlStdIO*, FILE*);
-typedef STDCHAR* (*LPGetBase)(struct IPerlStdIO*, FILE*);
-typedef int (*LPGetBufsiz)(struct IPerlStdIO*, FILE*);
-typedef int (*LPGetCnt)(struct IPerlStdIO*, FILE*);
-typedef STDCHAR* (*LPGetPtr)(struct IPerlStdIO*, FILE*);
-typedef char* (*LPGets)(struct IPerlStdIO*, char*, int, FILE*);
-typedef int (*LPPutc)(struct IPerlStdIO*, int, FILE*);
-typedef int (*LPPuts)(struct IPerlStdIO*, const char *, FILE*);
-typedef int (*LPFlush)(struct IPerlStdIO*, FILE*);
-typedef int (*LPUngetc)(struct IPerlStdIO*, int,FILE*);
-typedef int (*LPFileno)(struct IPerlStdIO*, FILE*);
-typedef FILE* (*LPFdopen)(struct IPerlStdIO*, int, const char*);
-typedef FILE* (*LPReopen)(struct IPerlStdIO*, const char*,
- const char*, FILE*);
-typedef SSize_t (*LPRead)(struct IPerlStdIO*, void*, Size_t, Size_t, FILE *);
-typedef SSize_t (*LPWrite)(struct IPerlStdIO*, const void*, Size_t, Size_t, FILE *);
-typedef void (*LPSetBuf)(struct IPerlStdIO*, FILE*, char*);
-typedef int (*LPSetVBuf)(struct IPerlStdIO*, FILE*, char*, int,
- Size_t);
-typedef void (*LPSetCnt)(struct IPerlStdIO*, FILE*, int);
-
-#ifndef NETWARE
-typedef void (*LPSetPtr)(struct IPerlStdIO*, FILE*, STDCHAR*);
-#elif defined(NETWARE)
-typedef void (*LPSetPtr)(struct IPerlStdIO*, FILE*, STDCHAR*, int);
-#endif
-
-typedef void (*LPSetlinebuf)(struct IPerlStdIO*, FILE*);
-typedef int (*LPPrintf)(struct IPerlStdIO*, FILE*, const char*,
- ...);
-typedef int (*LPVprintf)(struct IPerlStdIO*, FILE*, const char*,
- va_list);
-typedef Off_t (*LPTell)(struct IPerlStdIO*, FILE*);
-typedef int (*LPSeek)(struct IPerlStdIO*, FILE*, Off_t, int);
-typedef void (*LPRewind)(struct IPerlStdIO*, FILE*);
-typedef FILE* (*LPTmpfile)(struct IPerlStdIO*);
-typedef int (*LPGetpos)(struct IPerlStdIO*, FILE*, Fpos_t*);
-typedef int (*LPSetpos)(struct IPerlStdIO*, FILE*,
- const Fpos_t*);
-typedef void (*LPInit)(struct IPerlStdIO*);
-typedef void (*LPInitOSExtras)(struct IPerlStdIO*);
-typedef FILE* (*LPFdupopen)(struct IPerlStdIO*, FILE*);
-
-struct IPerlStdIO
-{
- LPStdin pStdin;
- LPStdout pStdout;
- LPStderr pStderr;
- LPOpen pOpen;
- LPClose pClose;
- LPEof pEof;
- LPError pError;
- LPClearerr pClearerr;
- LPGetc pGetc;
- LPGetBase pGetBase;
- LPGetBufsiz pGetBufsiz;
- LPGetCnt pGetCnt;
- LPGetPtr pGetPtr;
- LPGets pGets;
- LPPutc pPutc;
- LPPuts pPuts;
- LPFlush pFlush;
- LPUngetc pUngetc;
- LPFileno pFileno;
- LPFdopen pFdopen;
- LPReopen pReopen;
- LPRead pRead;
- LPWrite pWrite;
- LPSetBuf pSetBuf;
- LPSetVBuf pSetVBuf;
- LPSetCnt pSetCnt;
- LPSetPtr pSetPtr;
- LPSetlinebuf pSetlinebuf;
- LPPrintf pPrintf;
- LPVprintf pVprintf;
- LPTell pTell;
- LPSeek pSeek;
- LPRewind pRewind;
- LPTmpfile pTmpfile;
- LPGetpos pGetpos;
- LPSetpos pSetpos;
- LPInit pInit;
- LPInitOSExtras pInitOSExtras;
- LPFdupopen pFdupopen;
-};
+#ifdef PERL_OBJECT
+
+#ifndef PerlIO
+typedef struct _PerlIO PerlIO;
+#endif
-struct IPerlStdIOInfo
+class IPerlStdIO
{
- unsigned long nCount; /* number of entries expected */
- struct IPerlStdIO perlStdIOList;
+public:
+ virtual PerlIO * Stdin(void) = 0;
+ virtual PerlIO * Stdout(void) = 0;
+ virtual PerlIO * Stderr(void) = 0;
+ virtual PerlIO * Open(const char *, const char *, int &err) = 0;
+ virtual int Close(PerlIO*, int &err) = 0;
+ virtual int Eof(PerlIO*, int &err) = 0;
+ virtual int Error(PerlIO*, int &err) = 0;
+ virtual void Clearerr(PerlIO*, int &err) = 0;
+ virtual int Getc(PerlIO*, int &err) = 0;
+ virtual char * GetBase(PerlIO *, int &err) = 0;
+ virtual int GetBufsiz(PerlIO *, int &err) = 0;
+ virtual int GetCnt(PerlIO *, int &err) = 0;
+ virtual char * GetPtr(PerlIO *, int &err) = 0;
+ virtual char * Gets(PerlIO*, char*, int, int& err) = 0;
+ virtual int Putc(PerlIO*, int, int &err) = 0;
+ virtual int Puts(PerlIO*, const char *, int &err) = 0;
+ virtual int Flush(PerlIO*, int &err) = 0;
+ virtual int Ungetc(PerlIO*,int, int &err) = 0;
+ virtual int Fileno(PerlIO*, int &err) = 0;
+ virtual PerlIO * Fdopen(int, const char *, int &err) = 0;
+ virtual PerlIO * Reopen(const char*, const char*, PerlIO*, int &err) = 0;
+ virtual SSize_t Read(PerlIO*,void *,Size_t, int &err) = 0;
+ virtual SSize_t Write(PerlIO*,const void *,Size_t, int &err) = 0;
+ virtual void SetBuf(PerlIO *, char*, int &err) = 0;
+ virtual int SetVBuf(PerlIO *, char*, int, Size_t, int &err) = 0;
+ virtual void SetCnt(PerlIO *, int, int &err) = 0;
+ virtual void SetPtrCnt(PerlIO *, char *, int, int& err) = 0;
+ virtual void Setlinebuf(PerlIO*, int &err) = 0;
+ virtual int Printf(PerlIO*, int &err, const char *,...) = 0;
+ virtual int Vprintf(PerlIO*, int &err, const char *, va_list) = 0;
+ virtual long Tell(PerlIO*, int &err) = 0;
+ virtual int Seek(PerlIO*, Off_t, int, int &err) = 0;
+ virtual void Rewind(PerlIO*, int &err) = 0;
+ virtual PerlIO * Tmpfile(int &err) = 0;
+ virtual int Getpos(PerlIO*, Fpos_t *, int &err) = 0;
+ virtual int Setpos(PerlIO*, const Fpos_t *, int &err) = 0;
+ virtual void Init(int &err) = 0;
+ virtual void InitOSExtras(void* p) = 0;
+#ifdef WIN32
+ virtual int OpenOSfhandle(long osfhandle, int flags) = 0;
+ virtual int GetOSfhandle(int filenum) = 0;
+#endif
};
-/* These do not belong here ... NI-S, 14 Nov 2000 */
+
#ifdef USE_STDIO_PTR
-# define PerlSIO_has_cntptr(f) 1
-# ifdef STDIO_PTR_LVALUE
-# ifdef STDIO_CNT_LVALUE
-# define PerlSIO_canset_cnt(f) 1
-# ifdef STDIO_PTR_LVAL_NOCHANGE_CNT
-# define PerlSIO_fast_gets(f) 1
-# endif
-# else /* STDIO_CNT_LVALUE */
-# define PerlSIO_canset_cnt(f) 0
-# endif
-# else /* STDIO_PTR_LVALUE */
-# ifdef STDIO_PTR_LVAL_SETS_CNT
-# define PerlSIO_fast_gets(f) 1
+# define PerlIO_has_cntptr(f) 1
+# ifdef STDIO_CNT_LVALUE
+# define PerlIO_canset_cnt(f) 1
+# ifdef STDIO_PTR_LVALUE
+# define PerlIO_fast_gets(f) 1
# endif
+# else
+# define PerlIO_canset_cnt(f) 0
# endif
#else /* USE_STDIO_PTR */
-# define PerlSIO_has_cntptr(f) 0
-# define PerlSIO_canset_cnt(f) 0
+# define PerlIO_has_cntptr(f) 0
+# define PerlIO_canset_cnt(f) 0
#endif /* USE_STDIO_PTR */
-#ifndef PerlSIO_fast_gets
-#define PerlSIO_fast_gets(f) 0
+#ifndef PerlIO_fast_gets
+#define PerlIO_fast_gets(f) 0
#endif
#ifdef FILE_base
-#define PerlSIO_has_base(f) 1
+#define PerlIO_has_base(f) 1
#else
-#define PerlSIO_has_base(f) 0
-#endif
-
-/* Now take FILE * via function table */
-
-#define PerlSIO_stdin \
- (*PL_StdIO->pStdin)(PL_StdIO)
-#define PerlSIO_stdout \
- (*PL_StdIO->pStdout)(PL_StdIO)
-#define PerlSIO_stderr \
- (*PL_StdIO->pStderr)(PL_StdIO)
-#define PerlSIO_fopen(x,y) \
- (*PL_StdIO->pOpen)(PL_StdIO, (x),(y))
-#define PerlSIO_fclose(f) \
- (*PL_StdIO->pClose)(PL_StdIO, (f))
-#define PerlSIO_feof(f) \
- (*PL_StdIO->pEof)(PL_StdIO, (f))
-#define PerlSIO_ferror(f) \
- (*PL_StdIO->pError)(PL_StdIO, (f))
-#define PerlSIO_clearerr(f) \
- (*PL_StdIO->pClearerr)(PL_StdIO, (f))
-#define PerlSIO_fgetc(f) \
- (*PL_StdIO->pGetc)(PL_StdIO, (f))
-#define PerlSIO_get_base(f) \
- (*PL_StdIO->pGetBase)(PL_StdIO, (f))
-#define PerlSIO_get_bufsiz(f) \
- (*PL_StdIO->pGetBufsiz)(PL_StdIO, (f))
-#define PerlSIO_get_cnt(f) \
- (*PL_StdIO->pGetCnt)(PL_StdIO, (f))
-#define PerlSIO_get_ptr(f) \
- (*PL_StdIO->pGetPtr)(PL_StdIO, (f))
-#define PerlSIO_fputc(c,f) \
- (*PL_StdIO->pPutc)(PL_StdIO, (c),(f))
-#define PerlSIO_fputs(s,f) \
- (*PL_StdIO->pPuts)(PL_StdIO, (s),(f))
-#define PerlSIO_fflush(f) \
- (*PL_StdIO->pFlush)(PL_StdIO, (f))
-#define PerlSIO_fgets(s, n, f) \
- (*PL_StdIO->pGets)(PL_StdIO, s, n, (f))
-#define PerlSIO_ungetc(c,f) \
- (*PL_StdIO->pUngetc)(PL_StdIO, (c),(f))
-#define PerlSIO_fileno(f) \
- (*PL_StdIO->pFileno)(PL_StdIO, (f))
-#define PerlSIO_fdopen(f, s) \
- (*PL_StdIO->pFdopen)(PL_StdIO, (f),(s))
-#define PerlSIO_freopen(p, m, f) \
- (*PL_StdIO->pReopen)(PL_StdIO, (p), (m), (f))
-#define PerlSIO_fread(buf,sz,count,f) \
- (*PL_StdIO->pRead)(PL_StdIO, (buf), (sz), (count), (f))
-#define PerlSIO_fwrite(buf,sz,count,f) \
- (*PL_StdIO->pWrite)(PL_StdIO, (buf), (sz), (count), (f))
-#define PerlSIO_setbuf(f,b) \
- (*PL_StdIO->pSetBuf)(PL_StdIO, (f), (b))
-#define PerlSIO_setvbuf(f,b,t,s) \
- (*PL_StdIO->pSetVBuf)(PL_StdIO, (f),(b),(t),(s))
-#define PerlSIO_set_cnt(f,c) \
- (*PL_StdIO->pSetCnt)(PL_StdIO, (f), (c))
-#define PerlSIO_set_ptr(f,p) \
- (*PL_StdIO->pSetPtr)(PL_StdIO, (f), (p))
-#define PerlSIO_setlinebuf(f) \
- (*PL_StdIO->pSetlinebuf)(PL_StdIO, (f))
-#define PerlSIO_printf Perl_fprintf_nocontext
-#define PerlSIO_stdoutf Perl_printf_nocontext
-#define PerlSIO_vprintf(f,fmt,a) \
- (*PL_StdIO->pVprintf)(PL_StdIO, (f),(fmt),a)
-#define PerlSIO_ftell(f) \
- (*PL_StdIO->pTell)(PL_StdIO, (f))
-#define PerlSIO_fseek(f,o,w) \
- (*PL_StdIO->pSeek)(PL_StdIO, (f),(o),(w))
-#define PerlSIO_fgetpos(f,p) \
- (*PL_StdIO->pGetpos)(PL_StdIO, (f),(p))
-#define PerlSIO_fsetpos(f,p) \
- (*PL_StdIO->pSetpos)(PL_StdIO, (f),(p))
-#define PerlSIO_rewind(f) \
- (*PL_StdIO->pRewind)(PL_StdIO, (f))
-#define PerlSIO_tmpfile() \
- (*PL_StdIO->pTmpfile)(PL_StdIO)
-#define PerlSIO_init() \
- (*PL_StdIO->pInit)(PL_StdIO)
+#define PerlIO_has_base(f) 0
+#endif
+
+#define PerlIO_stdin() PL_piStdIO->Stdin()
+#define PerlIO_stdout() PL_piStdIO->Stdout()
+#define PerlIO_stderr() PL_piStdIO->Stderr()
+#define PerlIO_open(x,y) PL_piStdIO->Open((x),(y), ErrorNo())
+#define PerlIO_close(f) PL_piStdIO->Close((f), ErrorNo())
+#define PerlIO_eof(f) PL_piStdIO->Eof((f), ErrorNo())
+#define PerlIO_error(f) PL_piStdIO->Error((f), ErrorNo())
+#define PerlIO_clearerr(f) PL_piStdIO->Clearerr((f), ErrorNo())
+#define PerlIO_getc(f) PL_piStdIO->Getc((f), ErrorNo())
+#define PerlIO_get_base(f) PL_piStdIO->GetBase((f), ErrorNo())
+#define PerlIO_get_bufsiz(f) PL_piStdIO->GetBufsiz((f), ErrorNo())
+#define PerlIO_get_cnt(f) PL_piStdIO->GetCnt((f), ErrorNo())
+#define PerlIO_get_ptr(f) PL_piStdIO->GetPtr((f), ErrorNo())
+#define PerlIO_putc(f,c) PL_piStdIO->Putc((f),(c), ErrorNo())
+#define PerlIO_puts(f,s) PL_piStdIO->Puts((f),(s), ErrorNo())
+#define PerlIO_flush(f) PL_piStdIO->Flush((f), ErrorNo())
+#define PerlIO_gets(s, n, fp) PL_piStdIO->Gets((fp), s, n, ErrorNo())
+#define PerlIO_ungetc(f,c) PL_piStdIO->Ungetc((f),(c), ErrorNo())
+#define PerlIO_fileno(f) PL_piStdIO->Fileno((f), ErrorNo())
+#define PerlIO_fdopen(f, s) PL_piStdIO->Fdopen((f),(s), ErrorNo())
+#define PerlIO_reopen(p, m, f) PL_piStdIO->Reopen((p), (m), (f), ErrorNo())
+#define PerlIO_read(f,buf,count) \
+ (SSize_t)PL_piStdIO->Read((f), (buf), (count), ErrorNo())
+#define PerlIO_write(f,buf,count) \
+ PL_piStdIO->Write((f), (buf), (count), ErrorNo())
+#define PerlIO_setbuf(f,b) PL_piStdIO->SetBuf((f), (b), ErrorNo())
+#define PerlIO_setvbuf(f,b,t,s) PL_piStdIO->SetVBuf((f), (b), (t), (s), ErrorNo())
+#define PerlIO_set_cnt(f,c) PL_piStdIO->SetCnt((f), (c), ErrorNo())
+#define PerlIO_set_ptrcnt(f,p,c) \
+ PL_piStdIO->SetPtrCnt((f), (p), (c), ErrorNo())
+#define PerlIO_setlinebuf(f) PL_piStdIO->Setlinebuf((f), ErrorNo())
+#define PerlIO_printf fprintf
+#define PerlIO_stdoutf PL_piStdIO->Printf
+#define PerlIO_vprintf(f,fmt,a) PL_piStdIO->Vprintf((f), ErrorNo(), (fmt),a)
+#define PerlIO_tell(f) PL_piStdIO->Tell((f), ErrorNo())
+#define PerlIO_seek(f,o,w) PL_piStdIO->Seek((f),(o),(w), ErrorNo())
+#define PerlIO_getpos(f,p) PL_piStdIO->Getpos((f),(p), ErrorNo())
+#define PerlIO_setpos(f,p) PL_piStdIO->Setpos((f),(p), ErrorNo())
+#define PerlIO_rewind(f) PL_piStdIO->Rewind((f), ErrorNo())
+#define PerlIO_tmpfile() PL_piStdIO->Tmpfile(ErrorNo())
+#define PerlIO_init() PL_piStdIO->Init(ErrorNo())
#undef init_os_extras
-#define init_os_extras() \
- (*PL_StdIO->pInitOSExtras)(PL_StdIO)
-#define PerlSIO_fdupopen(f) \
- (*PL_StdIO->pFdupopen)(PL_StdIO, (f))
-
-#else /* PERL_IMPLICIT_SYS */
-
-#define PerlSIO_stdin stdin
-#define PerlSIO_stdout stdout
-#define PerlSIO_stderr stderr
-#define PerlSIO_fopen(x,y) fopen(x,y)
-#ifdef __VOS__
-/* Work around VOS bug posix-979, wrongly setting errno when at end of file. */
-#define PerlSIO_fclose(f) (((errno==1025)?errno=0:0),fclose(f))
-#define PerlSIO_feof(f) (((errno==1025)?errno=0:0),feof(f))
-#define PerlSIO_ferror(f) (((errno==1025)?errno=0:0),ferror(f))
-#else
-#define PerlSIO_fclose(f) fclose(f)
-#define PerlSIO_feof(f) feof(f)
-#define PerlSIO_ferror(f) ferror(f)
+#define init_os_extras() PL_piStdIO->InitOSExtras(this)
+
+#else /* PERL_OBJECT */
+
+#include "perlsdio.h"
+
+#endif /* PERL_OBJECT */
+
+#ifndef PERLIO_IS_STDIO
+#ifdef USE_SFIO
+#include "perlsfio.h"
+#endif /* USE_SFIO */
+#endif /* PERLIO_IS_STDIO */
+
+#ifndef EOF
+#define EOF (-1)
#endif
-#define PerlSIO_clearerr(f) clearerr(f)
-#define PerlSIO_fgetc(f) fgetc(f)
-#ifdef FILE_base
-#define PerlSIO_get_base(f) FILE_base(f)
-#define PerlSIO_get_bufsiz(f) FILE_bufsiz(f)
-#else
-#define PerlSIO_get_base(f) NULL
-#define PerlSIO_get_bufsiz(f) 0
+
+/* This is to catch case with no stdio */
+#ifndef BUFSIZ
+#define BUFSIZ 1024
#endif
-#ifdef USE_STDIO_PTR
-#define PerlSIO_get_cnt(f) FILE_cnt(f)
-#define PerlSIO_get_ptr(f) FILE_ptr(f)
-#else
-#define PerlSIO_get_cnt(f) 0
-#define PerlSIO_get_ptr(f) NULL
-#endif
-#define PerlSIO_fputc(c,f) fputc(c,f)
-#define PerlSIO_fputs(s,f) fputs(s,f)
-#define PerlSIO_fflush(f) Fflush(f)
-#define PerlSIO_fgets(s, n, f) fgets(s,n,f)
-#if defined(VMS) && defined(__DECC)
- /* Unusual definition of ungetc() here to accommodate fast_sv_gets()'
- * belief that it can mix getc/ungetc with reads from stdio buffer */
- int decc$ungetc(int __c, FILE *__stream);
-# define PerlSIO_ungetc(c,f) ((c) == EOF ? EOF : \
- ((*(f) && !((*(f))->_flag & _IONBF) && \
- ((*(f))->_ptr > (*(f))->_base)) ? \
- ((*(f))->_cnt++, *(--(*(f))->_ptr) = (c)) : decc$ungetc(c,f)))
-#else
-# define PerlSIO_ungetc(c,f) ungetc(c,f)
-#endif
-#define PerlSIO_fileno(f) fileno(f)
-#define PerlSIO_fdopen(f, s) fdopen(f,s)
-#define PerlSIO_freopen(p, m, f) freopen(p,m,f)
-#define PerlSIO_fread(buf,sz,count,f) fread(buf,sz,count,f)
-#define PerlSIO_fwrite(buf,sz,count,f) fwrite(buf,sz,count,f)
-#define PerlSIO_setbuf(f,b) setbuf(f,b)
-#define PerlSIO_setvbuf(f,b,t,s) setvbuf(f,b,t,s)
-#if defined(USE_STDIO_PTR) && defined(STDIO_CNT_LVALUE)
-#define PerlSIO_set_cnt(f,c) FILE_cnt(f) = (c)
-#else
-#define PerlSIO_set_cnt(f,c) PerlIOProc_abort()
+
+#ifndef SEEK_SET
+#define SEEK_SET 0
#endif
-#if defined(USE_STDIO_PTR) && defined(STDIO_PTR_LVALUE)
-#define PerlSIO_set_ptr(f,p) (FILE_ptr(f) = (p))
-#else
-#define PerlSIO_set_ptr(f,p) PerlIOProc_abort()
-#endif
-#define PerlSIO_setlinebuf(f) setlinebuf(f)
-#define PerlSIO_printf fprintf
-#define PerlSIO_stdoutf printf
-#define PerlSIO_vprintf(f,fmt,a) vfprintf(f,fmt,a)
-#define PerlSIO_ftell(f) ftell(f)
-#define PerlSIO_fseek(f,o,w) fseek(f,o,w)
-#define PerlSIO_fgetpos(f,p) fgetpos(f,p)
-#define PerlSIO_fsetpos(f,p) fsetpos(f,p)
-#define PerlSIO_rewind(f) rewind(f)
-#define PerlSIO_tmpfile() tmpfile()
-#define PerlSIO_fdupopen(f) (f)
-
-#endif /* PERL_IMPLICIT_SYS */
-/*
- * Interface for directory functions
- */
+#ifndef SEEK_CUR
+#define SEEK_CUR 1
+#endif
-#if defined(PERL_IMPLICIT_SYS)
-
-/* IPerlDir */
-struct IPerlDir;
-struct IPerlDirInfo;
-typedef int (*LPMakedir)(struct IPerlDir*, const char*, int);
-typedef int (*LPChdir)(struct IPerlDir*, const char*);
-typedef int (*LPRmdir)(struct IPerlDir*, const char*);
-typedef int (*LPDirClose)(struct IPerlDir*, DIR*);
-typedef DIR* (*LPDirOpen)(struct IPerlDir*, const char*);
-typedef struct direct* (*LPDirRead)(struct IPerlDir*, DIR*);
-typedef void (*LPDirRewind)(struct IPerlDir*, DIR*);
-typedef void (*LPDirSeek)(struct IPerlDir*, DIR*, long);
-typedef long (*LPDirTell)(struct IPerlDir*, DIR*);
-#ifdef WIN32
-typedef char* (*LPDirMapPathA)(struct IPerlDir*, const char*);
-typedef WCHAR* (*LPDirMapPathW)(struct IPerlDir*, const WCHAR*);
+#ifndef SEEK_END
+#define SEEK_END 2
#endif
-struct IPerlDir
-{
- LPMakedir pMakedir;
- LPChdir pChdir;
- LPRmdir pRmdir;
- LPDirClose pClose;
- LPDirOpen pOpen;
- LPDirRead pRead;
- LPDirRewind pRewind;
- LPDirSeek pSeek;
- LPDirTell pTell;
-#ifdef WIN32
- LPDirMapPathA pMapPathA;
- LPDirMapPathW pMapPathW;
+#ifndef PerlIO
+struct _PerlIO;
+#define PerlIO struct _PerlIO
+#endif /* No PerlIO */
+
+#ifndef Fpos_t
+#define Fpos_t long
+#endif
+
+#ifndef NEXT30_NO_ATTRIBUTE
+#ifndef HASATTRIBUTE /* disable GNU-cc attribute checking? */
+#ifdef __attribute__ /* Avoid possible redefinition errors */
+#undef __attribute__
+#endif
+#define __attribute__(attr)
+#endif
#endif
-};
-struct IPerlDirInfo
+#ifndef PerlIO_stdoutf
+extern int PerlIO_stdoutf _((const char *,...))
+ __attribute__((format (printf, 1, 2)));
+#endif
+#ifndef PerlIO_puts
+extern int PerlIO_puts _((PerlIO *,const char *));
+#endif
+#ifndef PerlIO_open
+extern PerlIO * PerlIO_open _((const char *,const char *));
+#endif
+#ifndef PerlIO_close
+extern int PerlIO_close _((PerlIO *));
+#endif
+#ifndef PerlIO_eof
+extern int PerlIO_eof _((PerlIO *));
+#endif
+#ifndef PerlIO_error
+extern int PerlIO_error _((PerlIO *));
+#endif
+#ifndef PerlIO_clearerr
+extern void PerlIO_clearerr _((PerlIO *));
+#endif
+#ifndef PerlIO_getc
+extern int PerlIO_getc _((PerlIO *));
+#endif
+#ifndef PerlIO_putc
+extern int PerlIO_putc _((PerlIO *,int));
+#endif
+#ifndef PerlIO_flush
+extern int PerlIO_flush _((PerlIO *));
+#endif
+#ifndef PerlIO_ungetc
+extern int PerlIO_ungetc _((PerlIO *,int));
+#endif
+#ifndef PerlIO_fileno
+extern int PerlIO_fileno _((PerlIO *));
+#endif
+#ifndef PerlIO_fdopen
+extern PerlIO * PerlIO_fdopen _((int, const char *));
+#endif
+#ifndef PerlIO_importFILE
+extern PerlIO * PerlIO_importFILE _((FILE *,int));
+#endif
+#ifndef PerlIO_exportFILE
+extern FILE * PerlIO_exportFILE _((PerlIO *,int));
+#endif
+#ifndef PerlIO_findFILE
+extern FILE * PerlIO_findFILE _((PerlIO *));
+#endif
+#ifndef PerlIO_releaseFILE
+extern void PerlIO_releaseFILE _((PerlIO *,FILE *));
+#endif
+#ifndef PerlIO_read
+extern SSize_t PerlIO_read _((PerlIO *,void *,Size_t));
+#endif
+#ifndef PerlIO_write
+extern SSize_t PerlIO_write _((PerlIO *,const void *,Size_t));
+#endif
+#ifndef PerlIO_setlinebuf
+extern void PerlIO_setlinebuf _((PerlIO *));
+#endif
+#ifndef PerlIO_printf
+extern int PerlIO_printf _((PerlIO *, const char *,...))
+ __attribute__((format (printf, 2, 3)));
+#endif
+#ifndef PerlIO_sprintf
+extern int PerlIO_sprintf _((char *, int, const char *,...))
+ __attribute__((format (printf, 3, 4)));
+#endif
+#ifndef PerlIO_vprintf
+extern int PerlIO_vprintf _((PerlIO *, const char *, va_list));
+#endif
+#ifndef PerlIO_tell
+extern Off_t PerlIO_tell _((PerlIO *));
+#endif
+#ifndef PerlIO_seek
+extern int PerlIO_seek _((PerlIO *, Off_t, int));
+#endif
+#ifndef PerlIO_rewind
+extern void PerlIO_rewind _((PerlIO *));
+#endif
+#ifndef PerlIO_has_base
+extern int PerlIO_has_base _((PerlIO *));
+#endif
+#ifndef PerlIO_has_cntptr
+extern int PerlIO_has_cntptr _((PerlIO *));
+#endif
+#ifndef PerlIO_fast_gets
+extern int PerlIO_fast_gets _((PerlIO *));
+#endif
+#ifndef PerlIO_canset_cnt
+extern int PerlIO_canset_cnt _((PerlIO *));
+#endif
+#ifndef PerlIO_get_ptr
+extern STDCHAR * PerlIO_get_ptr _((PerlIO *));
+#endif
+#ifndef PerlIO_get_cnt
+extern int PerlIO_get_cnt _((PerlIO *));
+#endif
+#ifndef PerlIO_set_cnt
+extern void PerlIO_set_cnt _((PerlIO *,int));
+#endif
+#ifndef PerlIO_set_ptrcnt
+extern void PerlIO_set_ptrcnt _((PerlIO *,STDCHAR *,int));
+#endif
+#ifndef PerlIO_get_base
+extern STDCHAR * PerlIO_get_base _((PerlIO *));
+#endif
+#ifndef PerlIO_get_bufsiz
+extern int PerlIO_get_bufsiz _((PerlIO *));
+#endif
+#ifndef PerlIO_tmpfile
+extern PerlIO * PerlIO_tmpfile _((void));
+#endif
+#ifndef PerlIO_stdin
+extern PerlIO * PerlIO_stdin _((void));
+#endif
+#ifndef PerlIO_stdout
+extern PerlIO * PerlIO_stdout _((void));
+#endif
+#ifndef PerlIO_stderr
+extern PerlIO * PerlIO_stderr _((void));
+#endif
+#ifndef PerlIO_getpos
+extern int PerlIO_getpos _((PerlIO *,Fpos_t *));
+#endif
+#ifndef PerlIO_setpos
+extern int PerlIO_setpos _((PerlIO *,const Fpos_t *));
+#endif
+
+
+/*
+ * Interface for directory functions
+ */
+
+#ifdef PERL_OBJECT
+
+class IPerlDir
{
- unsigned long nCount; /* number of entries expected */
- struct IPerlDir perlDirList;
+public:
+ virtual int Makedir(const char *dirname, int mode, int &err) = 0;
+ virtual int Chdir(const char *dirname, int &err) = 0;
+ virtual int Rmdir(const char *dirname, int &err) = 0;
+ virtual int Close(DIR *dirp, int &err) = 0;
+ virtual DIR * Open(char *filename, int &err) = 0;
+ virtual struct direct *Read(DIR *dirp, int &err) = 0;
+ virtual void Rewind(DIR *dirp, int &err) = 0;
+ virtual void Seek(DIR *dirp, long loc, int &err) = 0;
+ virtual long Tell(DIR *dirp, int &err) = 0;
};
#define PerlDir_mkdir(name, mode) \
- (*PL_Dir->pMakedir)(PL_Dir, (name), (mode))
+ PL_piDir->Makedir((name), (mode), ErrorNo())
#define PerlDir_chdir(name) \
- (*PL_Dir->pChdir)(PL_Dir, (name))
+ PL_piDir->Chdir((name), ErrorNo())
#define PerlDir_rmdir(name) \
- (*PL_Dir->pRmdir)(PL_Dir, (name))
+ PL_piDir->Rmdir((name), ErrorNo())
#define PerlDir_close(dir) \
- (*PL_Dir->pClose)(PL_Dir, (dir))
+ PL_piDir->Close((dir), ErrorNo())
#define PerlDir_open(name) \
- (*PL_Dir->pOpen)(PL_Dir, (name))
+ PL_piDir->Open((name), ErrorNo())
#define PerlDir_read(dir) \
- (*PL_Dir->pRead)(PL_Dir, (dir))
+ PL_piDir->Read((dir), ErrorNo())
#define PerlDir_rewind(dir) \
- (*PL_Dir->pRewind)(PL_Dir, (dir))
+ PL_piDir->Rewind((dir), ErrorNo())
#define PerlDir_seek(dir, loc) \
- (*PL_Dir->pSeek)(PL_Dir, (dir), (loc))
+ PL_piDir->Seek((dir), (loc), ErrorNo())
#define PerlDir_tell(dir) \
- (*PL_Dir->pTell)(PL_Dir, (dir))
-#ifdef WIN32
-#define PerlDir_mapA(dir) \
- (*PL_Dir->pMapPathA)(PL_Dir, (dir))
-#define PerlDir_mapW(dir) \
- (*PL_Dir->pMapPathW)(PL_Dir, (dir))
-#endif
+ PL_piDir->Tell((dir), ErrorNo())
-#else /* PERL_IMPLICIT_SYS */
+#else /* PERL_OBJECT */
#define PerlDir_mkdir(name, mode) Mkdir((name), (mode))
#ifdef VMS
-# define PerlDir_chdir(n) Chdir((n))
-#else
+# define PerlDir_chdir(n) chdir(((n) && *(n)) ? (n) : "SYS$LOGIN")
+#else
# define PerlDir_chdir(name) chdir((name))
#endif
#define PerlDir_rmdir(name) rmdir((name))
@@ -443,303 +434,137 @@ struct IPerlDirInfo
#define PerlDir_rewind(dir) rewinddir((dir))
#define PerlDir_seek(dir, loc) seekdir((dir), (loc))
#define PerlDir_tell(dir) telldir((dir))
-#ifdef WIN32
-#define PerlDir_mapA(dir) dir
-#define PerlDir_mapW(dir) dir
-#endif
-#endif /* PERL_IMPLICIT_SYS */
+#endif /* PERL_OBJECT */
/*
Interface for perl environment functions
*/
-#if defined(PERL_IMPLICIT_SYS)
-
-/* IPerlEnv */
-struct IPerlEnv;
-struct IPerlEnvInfo;
-typedef char* (*LPEnvGetenv)(struct IPerlEnv*, const char*);
-typedef int (*LPEnvPutenv)(struct IPerlEnv*, const char*);
-typedef char* (*LPEnvGetenv_len)(struct IPerlEnv*,
- const char *varname, unsigned long *len);
-typedef int (*LPEnvUname)(struct IPerlEnv*, struct utsname *name);
-typedef void (*LPEnvClearenv)(struct IPerlEnv*);
-typedef void* (*LPEnvGetChildenv)(struct IPerlEnv*);
-typedef void (*LPEnvFreeChildenv)(struct IPerlEnv*, void* env);
-typedef char* (*LPEnvGetChilddir)(struct IPerlEnv*);
-typedef void (*LPEnvFreeChilddir)(struct IPerlEnv*, char* dir);
-#ifdef HAS_ENVGETENV
-typedef char* (*LPENVGetenv)(struct IPerlEnv*, const char *varname);
-typedef char* (*LPENVGetenv_len)(struct IPerlEnv*,
- const char *varname, unsigned long *len);
-#endif
-#ifdef WIN32
-typedef unsigned long (*LPEnvOsID)(struct IPerlEnv*);
-typedef char* (*LPEnvLibPath)(struct IPerlEnv*, const char*,
- STRLEN *const len);
-typedef char* (*LPEnvSiteLibPath)(struct IPerlEnv*, const char*,
- STRLEN *const len);
-typedef char* (*LPEnvVendorLibPath)(struct IPerlEnv*, const char*,
- STRLEN *const len);
-typedef void (*LPEnvGetChildIO)(struct IPerlEnv*, child_IO_table*);
-#endif
-
-struct IPerlEnv
-{
- LPEnvGetenv pGetenv;
- LPEnvPutenv pPutenv;
- LPEnvGetenv_len pGetenv_len;
- LPEnvUname pEnvUname;
- LPEnvClearenv pClearenv;
- LPEnvGetChildenv pGetChildenv;
- LPEnvFreeChildenv pFreeChildenv;
- LPEnvGetChilddir pGetChilddir;
- LPEnvFreeChilddir pFreeChilddir;
-#ifdef HAS_ENVGETENV
- LPENVGetenv pENVGetenv;
- LPENVGetenv_len pENVGetenv_len;
-#endif
-#ifdef WIN32
- LPEnvOsID pEnvOsID;
- LPEnvLibPath pLibPath;
- LPEnvSiteLibPath pSiteLibPath;
- LPEnvVendorLibPath pVendorLibPath;
- LPEnvGetChildIO pGetChildIO;
-#endif
-};
+#ifdef PERL_OBJECT
-struct IPerlEnvInfo
+class IPerlEnv
{
- unsigned long nCount; /* number of entries expected */
- struct IPerlEnv perlEnvList;
+public:
+ virtual char * Getenv(const char *varname, int &err) = 0;
+ virtual int Putenv(const char *envstring, int &err) = 0;
+ virtual char * LibPath(char *patchlevel) =0;
+ virtual char * SiteLibPath(char *patchlevel) =0;
};
-#define PerlEnv_putenv(str) \
- (*PL_Env->pPutenv)(PL_Env,(str))
-#define PerlEnv_getenv(str) \
- (*PL_Env->pGetenv)(PL_Env,(str))
-#define PerlEnv_getenv_len(str,l) \
- (*PL_Env->pGetenv_len)(PL_Env,(str), (l))
-#define PerlEnv_clearenv() \
- (*PL_Env->pClearenv)(PL_Env)
-#define PerlEnv_get_childenv() \
- (*PL_Env->pGetChildenv)(PL_Env)
-#define PerlEnv_free_childenv(e) \
- (*PL_Env->pFreeChildenv)(PL_Env, (e))
-#define PerlEnv_get_childdir() \
- (*PL_Env->pGetChilddir)(PL_Env)
-#define PerlEnv_free_childdir(d) \
- (*PL_Env->pFreeChilddir)(PL_Env, (d))
-#ifdef HAS_ENVGETENV
-# define PerlEnv_ENVgetenv(str) \
- (*PL_Env->pENVGetenv)(PL_Env,(str))
-# define PerlEnv_ENVgetenv_len(str,l) \
- (*PL_Env->pENVGetenv_len)(PL_Env,(str), (l))
-#else
-# define PerlEnv_ENVgetenv(str) \
- PerlEnv_getenv((str))
-# define PerlEnv_ENVgetenv_len(str,l) \
- PerlEnv_getenv_len((str),(l))
-#endif
-#define PerlEnv_uname(name) \
- (*PL_Env->pEnvUname)(PL_Env,(name))
+#define PerlEnv_putenv(str) PL_piENV->Putenv((str), ErrorNo())
+#define PerlEnv_getenv(str) PL_piENV->Getenv((str), ErrorNo())
#ifdef WIN32
-#define PerlEnv_os_id() \
- (*PL_Env->pEnvOsID)(PL_Env)
-#define PerlEnv_lib_path(str, lenp) \
- (*PL_Env->pLibPath)(PL_Env,(str),(lenp))
-#define PerlEnv_sitelib_path(str, lenp) \
- (*PL_Env->pSiteLibPath)(PL_Env,(str),(lenp))
-#define PerlEnv_vendorlib_path(str, lenp) \
- (*PL_Env->pVendorLibPath)(PL_Env,(str),(lenp))
-#define PerlEnv_get_child_IO(ptr) \
- (*PL_Env->pGetChildIO)(PL_Env, ptr)
+#define PerlEnv_lib_path(str) PL_piENV->LibPath((str))
+#define PerlEnv_sitelib_path(str) PL_piENV->SiteLibPath((str))
#endif
-#else /* PERL_IMPLICIT_SYS */
+#else /* PERL_OBJECT */
#define PerlEnv_putenv(str) putenv((str))
#define PerlEnv_getenv(str) getenv((str))
-#define PerlEnv_getenv_len(str,l) getenv_len((str), (l))
-#ifdef HAS_ENVGETENV
-# define PerlEnv_ENVgetenv(str) ENVgetenv((str))
-# define PerlEnv_ENVgetenv_len(str,l) ENVgetenv_len((str), (l))
-#else
-# define PerlEnv_ENVgetenv(str) PerlEnv_getenv((str))
-# define PerlEnv_ENVgetenv_len(str,l) PerlEnv_getenv_len((str), (l))
-#endif
-#define PerlEnv_uname(name) uname((name))
-
-#ifdef WIN32
-#define PerlEnv_os_id() win32_os_id()
-#define PerlEnv_lib_path(str, lenp) win32_get_privlib(str, lenp)
-#define PerlEnv_sitelib_path(str, lenp) win32_get_sitelib(str, lenp)
-#define PerlEnv_vendorlib_path(str, lenp) win32_get_vendorlib(str, lenp)
-#define PerlEnv_get_child_IO(ptr) win32_get_child_IO(ptr)
-#define PerlEnv_clearenv() win32_clearenv()
-#define PerlEnv_get_childenv() win32_get_childenv()
-#define PerlEnv_free_childenv(e) win32_free_childenv((e))
-#define PerlEnv_get_childdir() win32_get_childdir()
-#define PerlEnv_free_childdir(d) win32_free_childdir((d))
-#else
-#define PerlEnv_clearenv() clearenv()
-#define PerlEnv_get_childenv() get_childenv()
-#define PerlEnv_free_childenv(e) free_childenv((e))
-#define PerlEnv_get_childdir() get_childdir()
-#define PerlEnv_free_childdir(d) free_childdir((d))
-#endif
-#endif /* PERL_IMPLICIT_SYS */
+#endif /* PERL_OBJECT */
/*
Interface for perl low-level IO functions
*/
-#if defined(PERL_IMPLICIT_SYS)
-
-/* IPerlLIO */
-struct IPerlLIO;
-struct IPerlLIOInfo;
-typedef int (*LPLIOAccess)(struct IPerlLIO*, const char*, int);
-typedef int (*LPLIOChmod)(struct IPerlLIO*, const char*, int);
-typedef int (*LPLIOChown)(struct IPerlLIO*, const char*, uid_t,
- gid_t);
-typedef int (*LPLIOChsize)(struct IPerlLIO*, int, Off_t);
-typedef int (*LPLIOClose)(struct IPerlLIO*, int);
-typedef int (*LPLIODup)(struct IPerlLIO*, int);
-typedef int (*LPLIODup2)(struct IPerlLIO*, int, int);
-typedef int (*LPLIOFlock)(struct IPerlLIO*, int, int);
-typedef int (*LPLIOFileStat)(struct IPerlLIO*, int, Stat_t*);
-typedef int (*LPLIOIOCtl)(struct IPerlLIO*, int, unsigned int,
- char*);
-typedef int (*LPLIOIsatty)(struct IPerlLIO*, int);
-typedef int (*LPLIOLink)(struct IPerlLIO*, const char*,
- const char *);
-typedef Off_t (*LPLIOLseek)(struct IPerlLIO*, int, Off_t, int);
-typedef int (*LPLIOLstat)(struct IPerlLIO*, const char*,
- Stat_t*);
-typedef char* (*LPLIOMktemp)(struct IPerlLIO*, char*);
-typedef int (*LPLIOOpen)(struct IPerlLIO*, const char*, int);
-typedef int (*LPLIOOpen3)(struct IPerlLIO*, const char*, int, int);
-typedef int (*LPLIORead)(struct IPerlLIO*, int, void*, unsigned int);
-typedef int (*LPLIORename)(struct IPerlLIO*, const char*,
- const char*);
-#ifdef NETWARE
-typedef int (*LPLIOSetmode)(struct IPerlLIO*, FILE*, int);
-#else
-typedef int (*LPLIOSetmode)(struct IPerlLIO*, int, int);
-#endif /* NETWARE */
-typedef int (*LPLIONameStat)(struct IPerlLIO*, const char*,
- Stat_t*);
-typedef char* (*LPLIOTmpnam)(struct IPerlLIO*, char*);
-typedef int (*LPLIOUmask)(struct IPerlLIO*, int);
-typedef int (*LPLIOUnlink)(struct IPerlLIO*, const char*);
-typedef int (*LPLIOUtime)(struct IPerlLIO*, const char*, struct utimbuf*);
-typedef int (*LPLIOWrite)(struct IPerlLIO*, int, const void*,
- unsigned int);
-
-struct IPerlLIO
-{
- LPLIOAccess pAccess;
- LPLIOChmod pChmod;
- LPLIOChown pChown;
- LPLIOChsize pChsize;
- LPLIOClose pClose;
- LPLIODup pDup;
- LPLIODup2 pDup2;
- LPLIOFlock pFlock;
- LPLIOFileStat pFileStat;
- LPLIOIOCtl pIOCtl;
- LPLIOIsatty pIsatty;
- LPLIOLink pLink;
- LPLIOLseek pLseek;
- LPLIOLstat pLstat;
- LPLIOMktemp pMktemp;
- LPLIOOpen pOpen;
- LPLIOOpen3 pOpen3;
- LPLIORead pRead;
- LPLIORename pRename;
- LPLIOSetmode pSetmode;
- LPLIONameStat pNameStat;
- LPLIOTmpnam pTmpnam;
- LPLIOUmask pUmask;
- LPLIOUnlink pUnlink;
- LPLIOUtime pUtime;
- LPLIOWrite pWrite;
-};
+#ifdef PERL_OBJECT
-struct IPerlLIOInfo
+class IPerlLIO
{
- unsigned long nCount; /* number of entries expected */
- struct IPerlLIO perlLIOList;
+public:
+ virtual int Access(const char *path, int mode, int &err) = 0;
+ virtual int Chmod(const char *filename, int pmode, int &err) = 0;
+ virtual int Chown(const char *filename, uid_t owner,
+ gid_t group, int &err) = 0;
+ virtual int Chsize(int handle, long size, int &err) = 0;
+ virtual int Close(int handle, int &err) = 0;
+ virtual int Dup(int handle, int &err) = 0;
+ virtual int Dup2(int handle1, int handle2, int &err) = 0;
+ virtual int Flock(int fd, int oper, int &err) = 0;
+ virtual int FileStat(int handle, struct stat *buffer, int &err) = 0;
+ virtual int IOCtl(int i, unsigned int u, char *data, int &err) = 0;
+ virtual int Isatty(int handle, int &err) = 0;
+ virtual long Lseek(int handle, long offset, int origin, int &err) = 0;
+ virtual int Lstat(const char *path, struct stat *buffer, int &err) = 0;
+ virtual char * Mktemp(char *Template, int &err) = 0;
+ virtual int Open(const char *filename, int oflag, int &err) = 0;
+ virtual int Open(const char *filename, int oflag,
+ int pmode, int &err) = 0;
+ virtual int Read(int handle, void *buffer,
+ unsigned int count, int &err) = 0;
+ virtual int Rename(const char *oname,
+ const char *newname, int &err) = 0;
+ virtual int Setmode(int handle, int mode, int &err) = 0;
+ virtual int NameStat(const char *path,
+ struct stat *buffer, int &err) = 0;
+ virtual char * Tmpnam(char *string, int &err) = 0;
+ virtual int Umask(int pmode, int &err) = 0;
+ virtual int Unlink(const char *filename, int &err) = 0;
+ virtual int Utime(char *filename, struct utimbuf *times, int &err) = 0;
+ virtual int Write(int handle, const void *buffer,
+ unsigned int count, int &err) = 0;
};
#define PerlLIO_access(file, mode) \
- (*PL_LIO->pAccess)(PL_LIO, (file), (mode))
+ PL_piLIO->Access((file), (mode), ErrorNo())
#define PerlLIO_chmod(file, mode) \
- (*PL_LIO->pChmod)(PL_LIO, (file), (mode))
+ PL_piLIO->Chmod((file), (mode), ErrorNo())
#define PerlLIO_chown(file, owner, group) \
- (*PL_LIO->pChown)(PL_LIO, (file), (owner), (group))
+ PL_piLIO->Chown((file), (owner), (group), ErrorNo())
#define PerlLIO_chsize(fd, size) \
- (*PL_LIO->pChsize)(PL_LIO, (fd), (size))
+ PL_piLIO->Chsize((fd), (size), ErrorNo())
#define PerlLIO_close(fd) \
- (*PL_LIO->pClose)(PL_LIO, (fd))
+ PL_piLIO->Close((fd), ErrorNo())
#define PerlLIO_dup(fd) \
- (*PL_LIO->pDup)(PL_LIO, (fd))
+ PL_piLIO->Dup((fd), ErrorNo())
#define PerlLIO_dup2(fd1, fd2) \
- (*PL_LIO->pDup2)(PL_LIO, (fd1), (fd2))
+ PL_piLIO->Dup2((fd1), (fd2), ErrorNo())
#define PerlLIO_flock(fd, op) \
- (*PL_LIO->pFlock)(PL_LIO, (fd), (op))
+ PL_piLIO->Flock((fd), (op), ErrorNo())
#define PerlLIO_fstat(fd, buf) \
- (*PL_LIO->pFileStat)(PL_LIO, (fd), (buf))
+ PL_piLIO->FileStat((fd), (buf), ErrorNo())
#define PerlLIO_ioctl(fd, u, buf) \
- (*PL_LIO->pIOCtl)(PL_LIO, (fd), (u), (buf))
+ PL_piLIO->IOCtl((fd), (u), (buf), ErrorNo())
#define PerlLIO_isatty(fd) \
- (*PL_LIO->pIsatty)(PL_LIO, (fd))
-#define PerlLIO_link(oldname, newname) \
- (*PL_LIO->pLink)(PL_LIO, (oldname), (newname))
+ PL_piLIO->Isatty((fd), ErrorNo())
#define PerlLIO_lseek(fd, offset, mode) \
- (*PL_LIO->pLseek)(PL_LIO, (fd), (offset), (mode))
+ PL_piLIO->Lseek((fd), (offset), (mode), ErrorNo())
#define PerlLIO_lstat(name, buf) \
- (*PL_LIO->pLstat)(PL_LIO, (name), (buf))
+ PL_piLIO->Lstat((name), (buf), ErrorNo())
#define PerlLIO_mktemp(file) \
- (*PL_LIO->pMktemp)(PL_LIO, (file))
+ PL_piLIO->Mktemp((file), ErrorNo())
#define PerlLIO_open(file, flag) \
- (*PL_LIO->pOpen)(PL_LIO, (file), (flag))
+ PL_piLIO->Open((file), (flag), ErrorNo())
#define PerlLIO_open3(file, flag, perm) \
- (*PL_LIO->pOpen3)(PL_LIO, (file), (flag), (perm))
+ PL_piLIO->Open((file), (flag), (perm), ErrorNo())
#define PerlLIO_read(fd, buf, count) \
- (*PL_LIO->pRead)(PL_LIO, (fd), (buf), (count))
+ PL_piLIO->Read((fd), (buf), (count), ErrorNo())
#define PerlLIO_rename(oname, newname) \
- (*PL_LIO->pRename)(PL_LIO, (oname), (newname))
+ PL_piLIO->Rename((oname), (newname), ErrorNo())
#define PerlLIO_setmode(fd, mode) \
- (*PL_LIO->pSetmode)(PL_LIO, (fd), (mode))
+ PL_piLIO->Setmode((fd), (mode), ErrorNo())
#define PerlLIO_stat(name, buf) \
- (*PL_LIO->pNameStat)(PL_LIO, (name), (buf))
+ PL_piLIO->NameStat((name), (buf), ErrorNo())
#define PerlLIO_tmpnam(str) \
- (*PL_LIO->pTmpnam)(PL_LIO, (str))
+ PL_piLIO->Tmpnam((str), ErrorNo())
#define PerlLIO_umask(mode) \
- (*PL_LIO->pUmask)(PL_LIO, (mode))
+ PL_piLIO->Umask((mode), ErrorNo())
#define PerlLIO_unlink(file) \
- (*PL_LIO->pUnlink)(PL_LIO, (file))
+ PL_piLIO->Unlink((file), ErrorNo())
#define PerlLIO_utime(file, time) \
- (*PL_LIO->pUtime)(PL_LIO, (file), (time))
+ PL_piLIO->Utime((file), (time), ErrorNo())
#define PerlLIO_write(fd, buf, count) \
- (*PL_LIO->pWrite)(PL_LIO, (fd), (buf), (count))
+ PL_piLIO->Write((fd), (buf), (count), ErrorNo())
-#else /* PERL_IMPLICIT_SYS */
+#else /* PERL_OBJECT */
#define PerlLIO_access(file, mode) access((file), (mode))
#define PerlLIO_chmod(file, mode) chmod((file), (mode))
#define PerlLIO_chown(file, owner, grp) chown((file), (owner), (grp))
-#if defined(HAS_TRUNCATE)
-# define PerlLIO_chsize(fd, size) ftruncate((fd), (size))
-#elif defined(HAS_CHSIZE)
-# define PerlLIO_chsize(fd, size) chsize((fd), (size))
-#else
-# define PerlLIO_chsize(fd, size) my_chsize((fd), (size))
-#endif
+#define PerlLIO_chsize(fd, size) chsize((fd), (size))
#define PerlLIO_close(fd) close((fd))
#define PerlLIO_dup(fd) dup((fd))
#define PerlLIO_dup2(fd1, fd2) dup2((fd1), (fd2))
@@ -747,14 +572,8 @@ struct IPerlLIOInfo
#define PerlLIO_fstat(fd, buf) Fstat((fd), (buf))
#define PerlLIO_ioctl(fd, u, buf) ioctl((fd), (u), (buf))
#define PerlLIO_isatty(fd) isatty((fd))
-#define PerlLIO_link(oldname, newname) link((oldname), (newname))
#define PerlLIO_lseek(fd, offset, mode) lseek((fd), (offset), (mode))
-#define PerlLIO_stat(name, buf) Stat((name), (buf))
-#ifdef HAS_LSTAT
-# define PerlLIO_lstat(name, buf) lstat((name), (buf))
-#else
-# define PerlLIO_lstat(name, buf) PerlLIO_stat((name), (buf))
-#endif
+#define PerlLIO_lstat(name, buf) lstat((name), (buf))
#define PerlLIO_mktemp(file) mktemp((file))
#define PerlLIO_mkstemp(file) mkstemp((file))
#define PerlLIO_open(file, flag) open((file), (flag))
@@ -762,329 +581,138 @@ struct IPerlLIOInfo
#define PerlLIO_read(fd, buf, count) read((fd), (buf), (count))
#define PerlLIO_rename(old, new) rename((old), (new))
#define PerlLIO_setmode(fd, mode) setmode((fd), (mode))
+#define PerlLIO_stat(name, buf) Stat((name), (buf))
#define PerlLIO_tmpnam(str) tmpnam((str))
#define PerlLIO_umask(mode) umask((mode))
#define PerlLIO_unlink(file) unlink((file))
#define PerlLIO_utime(file, time) utime((file), (time))
#define PerlLIO_write(fd, buf, count) write((fd), (buf), (count))
-#endif /* PERL_IMPLICIT_SYS */
+#endif /* PERL_OBJECT */
/*
Interface for perl memory allocation
*/
-#if defined(PERL_IMPLICIT_SYS)
-
-/* IPerlMem */
-struct IPerlMem;
-struct IPerlMemInfo;
-typedef void* (*LPMemMalloc)(struct IPerlMem*, size_t);
-typedef void* (*LPMemRealloc)(struct IPerlMem*, void*, size_t);
-typedef void (*LPMemFree)(struct IPerlMem*, void*);
-typedef void* (*LPMemCalloc)(struct IPerlMem*, size_t, size_t);
-typedef void (*LPMemGetLock)(struct IPerlMem*);
-typedef void (*LPMemFreeLock)(struct IPerlMem*);
-typedef int (*LPMemIsLocked)(struct IPerlMem*);
-
-struct IPerlMem
-{
- LPMemMalloc pMalloc;
- LPMemRealloc pRealloc;
- LPMemFree pFree;
- LPMemCalloc pCalloc;
- LPMemGetLock pGetLock;
- LPMemFreeLock pFreeLock;
- LPMemIsLocked pIsLocked;
-};
+#ifdef PERL_OBJECT
-struct IPerlMemInfo
+class IPerlMem
{
- unsigned long nCount; /* number of entries expected */
- struct IPerlMem perlMemList;
+public:
+ virtual void * Malloc(size_t) = 0;
+ virtual void * Realloc(void*, size_t) = 0;
+ virtual void Free(void*) = 0;
};
-/* Interpreter specific memory macros */
-#define PerlMem_malloc(size) \
- (*PL_Mem->pMalloc)(PL_Mem, (size))
-#define PerlMem_realloc(buf, size) \
- (*PL_Mem->pRealloc)(PL_Mem, (buf), (size))
-#define PerlMem_free(buf) \
- (*PL_Mem->pFree)(PL_Mem, (buf))
-#define PerlMem_calloc(num, size) \
- (*PL_Mem->pCalloc)(PL_Mem, (num), (size))
-#define PerlMem_get_lock() \
- (*PL_Mem->pGetLock)(PL_Mem)
-#define PerlMem_free_lock() \
- (*PL_Mem->pFreeLock)(PL_Mem)
-#define PerlMem_is_locked() \
- (*PL_Mem->pIsLocked)(PL_Mem)
-
-/* Shared memory macros */
-#ifdef NETWARE
-
-#define PerlMemShared_malloc(size) \
- (*PL_Mem->pMalloc)(PL_Mem, (size))
-#define PerlMemShared_realloc(buf, size) \
- (*PL_Mem->pRealloc)(PL_Mem, (buf), (size))
-#define PerlMemShared_free(buf) \
- (*PL_Mem->pFree)(PL_Mem, (buf))
-#define PerlMemShared_calloc(num, size) \
- (*PL_Mem->pCalloc)(PL_Mem, (num), (size))
-#define PerlMemShared_get_lock() \
- (*PL_Mem->pGetLock)(PL_Mem)
-#define PerlMemShared_free_lock() \
- (*PL_Mem->pFreeLock)(PL_Mem)
-#define PerlMemShared_is_locked() \
- (*PL_Mem->pIsLocked)(PL_Mem)
+#define PerlMem_malloc(size) PL_piMem->Malloc((size))
+#define PerlMem_realloc(buf, size) PL_piMem->Realloc((buf), (size))
+#define PerlMem_free(buf) PL_piMem->Free((buf))
-#else
+#else /* PERL_OBJECT */
-#define PerlMemShared_malloc(size) \
- (*PL_MemShared->pMalloc)(PL_MemShared, (size))
-#define PerlMemShared_realloc(buf, size) \
- (*PL_MemShared->pRealloc)(PL_MemShared, (buf), (size))
-#define PerlMemShared_free(buf) \
- (*PL_MemShared->pFree)(PL_MemShared, (buf))
-#define PerlMemShared_calloc(num, size) \
- (*PL_MemShared->pCalloc)(PL_MemShared, (num), (size))
-#define PerlMemShared_get_lock() \
- (*PL_MemShared->pGetLock)(PL_MemShared)
-#define PerlMemShared_free_lock() \
- (*PL_MemShared->pFreeLock)(PL_MemShared)
-#define PerlMemShared_is_locked() \
- (*PL_MemShared->pIsLocked)(PL_MemShared)
-
-#endif
-
-/* Parse tree memory macros */
-#define PerlMemParse_malloc(size) \
- (*PL_MemParse->pMalloc)(PL_MemParse, (size))
-#define PerlMemParse_realloc(buf, size) \
- (*PL_MemParse->pRealloc)(PL_MemParse, (buf), (size))
-#define PerlMemParse_free(buf) \
- (*PL_MemParse->pFree)(PL_MemParse, (buf))
-#define PerlMemParse_calloc(num, size) \
- (*PL_MemParse->pCalloc)(PL_MemParse, (num), (size))
-#define PerlMemParse_get_lock() \
- (*PL_MemParse->pGetLock)(PL_MemParse)
-#define PerlMemParse_free_lock() \
- (*PL_MemParse->pFreeLock)(PL_MemParse)
-#define PerlMemParse_is_locked() \
- (*PL_MemParse->pIsLocked)(PL_MemParse)
-
-
-#else /* PERL_IMPLICIT_SYS */
-
-/* Interpreter specific memory macros */
#define PerlMem_malloc(size) malloc((size))
#define PerlMem_realloc(buf, size) realloc((buf), (size))
#define PerlMem_free(buf) free((buf))
-#define PerlMem_calloc(num, size) calloc((num), (size))
-#define PerlMem_get_lock()
-#define PerlMem_free_lock()
-#define PerlMem_is_locked() 0
-
-/* Shared memory macros */
-#define PerlMemShared_malloc(size) malloc((size))
-#define PerlMemShared_realloc(buf, size) realloc((buf), (size))
-#define PerlMemShared_free(buf) free((buf))
-#define PerlMemShared_calloc(num, size) calloc((num), (size))
-#define PerlMemShared_get_lock()
-#define PerlMemShared_free_lock()
-#define PerlMemShared_is_locked() 0
-
-/* Parse tree memory macros */
-#define PerlMemParse_malloc(size) malloc((size))
-#define PerlMemParse_realloc(buf, size) realloc((buf), (size))
-#define PerlMemParse_free(buf) free((buf))
-#define PerlMemParse_calloc(num, size) calloc((num), (size))
-#define PerlMemParse_get_lock()
-#define PerlMemParse_free_lock()
-#define PerlMemParse_is_locked() 0
-
-#endif /* PERL_IMPLICIT_SYS */
+
+#endif /* PERL_OBJECT */
/*
Interface for perl process functions
*/
-#if defined(PERL_IMPLICIT_SYS)
+#ifdef PERL_OBJECT
+#ifndef Sighandler_t
+typedef Signal_t (*Sighandler_t) _((int));
+#endif
#ifndef jmp_buf
#include <setjmp.h>
#endif
-/* IPerlProc */
-struct IPerlProc;
-struct IPerlProcInfo;
-typedef void (*LPProcAbort)(struct IPerlProc*);
-typedef char* (*LPProcCrypt)(struct IPerlProc*, const char*,
- const char*);
-typedef void (*LPProcExit)(struct IPerlProc*, int)
- __attribute__noreturn__;
-typedef void (*LPProc_Exit)(struct IPerlProc*, int)
- __attribute__noreturn__;
-typedef int (*LPProcExecl)(struct IPerlProc*, const char*,
- const char*, const char*, const char*,
- const char*);
-typedef int (*LPProcExecv)(struct IPerlProc*, const char*,
- const char*const*);
-typedef int (*LPProcExecvp)(struct IPerlProc*, const char*,
- const char*const*);
-typedef Uid_t (*LPProcGetuid)(struct IPerlProc*);
-typedef Uid_t (*LPProcGeteuid)(struct IPerlProc*);
-typedef Gid_t (*LPProcGetgid)(struct IPerlProc*);
-typedef Gid_t (*LPProcGetegid)(struct IPerlProc*);
-typedef char* (*LPProcGetlogin)(struct IPerlProc*);
-typedef int (*LPProcKill)(struct IPerlProc*, int, int);
-typedef int (*LPProcKillpg)(struct IPerlProc*, int, int);
-typedef int (*LPProcPauseProc)(struct IPerlProc*);
-typedef PerlIO* (*LPProcPopen)(struct IPerlProc*, const char*,
- const char*);
-typedef PerlIO* (*LPProcPopenList)(struct IPerlProc*, const char*,
- IV narg, SV **args);
-typedef int (*LPProcPclose)(struct IPerlProc*, PerlIO*);
-typedef int (*LPProcPipe)(struct IPerlProc*, int*);
-typedef int (*LPProcSetuid)(struct IPerlProc*, uid_t);
-typedef int (*LPProcSetgid)(struct IPerlProc*, gid_t);
-typedef int (*LPProcSleep)(struct IPerlProc*, unsigned int);
-typedef int (*LPProcTimes)(struct IPerlProc*, struct tms*);
-typedef int (*LPProcWait)(struct IPerlProc*, int*);
-typedef int (*LPProcWaitpid)(struct IPerlProc*, int, int*, int);
-typedef Sighandler_t (*LPProcSignal)(struct IPerlProc*, int, Sighandler_t);
-typedef int (*LPProcFork)(struct IPerlProc*);
-typedef int (*LPProcGetpid)(struct IPerlProc*);
-#ifdef WIN32
-typedef void* (*LPProcDynaLoader)(struct IPerlProc*, const char*);
-typedef void (*LPProcGetOSError)(struct IPerlProc*,
- SV* sv, DWORD dwErr);
-typedef int (*LPProcSpawnvp)(struct IPerlProc*, int, const char*,
- const char*const*);
-#endif
-typedef int (*LPProcLastHost)(struct IPerlProc*);
-typedef int (*LPProcGetTimeOfDay)(struct IPerlProc*,
- struct timeval*, void*);
-
-struct IPerlProc
+class IPerlProc
{
- LPProcAbort pAbort;
- LPProcCrypt pCrypt;
- LPProcExit pExit;
- LPProc_Exit p_Exit;
- LPProcExecl pExecl;
- LPProcExecv pExecv;
- LPProcExecvp pExecvp;
- LPProcGetuid pGetuid;
- LPProcGeteuid pGeteuid;
- LPProcGetgid pGetgid;
- LPProcGetegid pGetegid;
- LPProcGetlogin pGetlogin;
- LPProcKill pKill;
- LPProcKillpg pKillpg;
- LPProcPauseProc pPauseProc;
- LPProcPopen pPopen;
- LPProcPclose pPclose;
- LPProcPipe pPipe;
- LPProcSetuid pSetuid;
- LPProcSetgid pSetgid;
- LPProcSleep pSleep;
- LPProcTimes pTimes;
- LPProcWait pWait;
- LPProcWaitpid pWaitpid;
- LPProcSignal pSignal;
- LPProcFork pFork;
- LPProcGetpid pGetpid;
+public:
+ virtual void Abort(void) = 0;
+ virtual char * Crypt(const char* clear, const char* salt) = 0;
+ virtual void Exit(int status) = 0;
+ virtual void _Exit(int status) = 0;
+ virtual int Execl(const char *cmdname, const char *arg0,
+ const char *arg1, const char *arg2,
+ const char *arg3) = 0;
+ virtual int Execv(const char *cmdname, const char *const *argv) = 0;
+ virtual int Execvp(const char *cmdname, const char *const *argv) = 0;
+ virtual uid_t Getuid(void) = 0;
+ virtual uid_t Geteuid(void) = 0;
+ virtual gid_t Getgid(void) = 0;
+ virtual gid_t Getegid(void) = 0;
+ virtual char * Getlogin(void) = 0;
+ virtual int Kill(int pid, int sig) = 0;
+ virtual int Killpg(int pid, int sig) = 0;
+ virtual int PauseProc(void) = 0;
+ virtual PerlIO * Popen(const char *command, const char *mode) = 0;
+ virtual int Pclose(PerlIO *stream) = 0;
+ virtual int Pipe(int *phandles) = 0;
+ virtual int Setuid(uid_t uid) = 0;
+ virtual int Setgid(gid_t gid) = 0;
+ virtual int Sleep(unsigned int) = 0;
+ virtual int Times(struct tms *timebuf) = 0;
+ virtual int Wait(int *status) = 0;
+ virtual int Waitpid(int pid, int *status, int flags) = 0;
+ virtual Sighandler_t Signal(int sig, Sighandler_t subcode) = 0;
#ifdef WIN32
- LPProcDynaLoader pDynaLoader;
- LPProcGetOSError pGetOSError;
- LPProcSpawnvp pSpawnvp;
+ virtual void GetSysMsg(char*& msg, DWORD& dwLen, DWORD dwErr) = 0;
+ virtual void FreeBuf(char* msg) = 0;
+ virtual BOOL DoCmd(char *cmd) = 0;
+ virtual int Spawn(char*cmds) = 0;
+ virtual int Spawnvp(int mode, const char *cmdname,
+ const char *const *argv) = 0;
+ virtual int ASpawn(void *vreally, void **vmark, void **vsp) = 0;
#endif
- LPProcLastHost pLastHost;
- LPProcPopenList pPopenList;
- LPProcGetTimeOfDay pGetTimeOfDay;
-};
-
-struct IPerlProcInfo
-{
- unsigned long nCount; /* number of entries expected */
- struct IPerlProc perlProcList;
};
-#define PerlProc_abort() \
- (*PL_Proc->pAbort)(PL_Proc)
-#define PerlProc_crypt(c,s) \
- (*PL_Proc->pCrypt)(PL_Proc, (c), (s))
-#define PerlProc_exit(s) \
- (*PL_Proc->pExit)(PL_Proc, (s))
-#define PerlProc__exit(s) \
- (*PL_Proc->p_Exit)(PL_Proc, (s))
+#define PerlProc_abort() PL_piProc->Abort()
+#define PerlProc_crypt(c,s) PL_piProc->Crypt((c), (s))
+#define PerlProc_exit(s) PL_piProc->Exit((s))
+#define PerlProc__exit(s) PL_piProc->_Exit((s))
#define PerlProc_execl(c, w, x, y, z) \
- (*PL_Proc->pExecl)(PL_Proc, (c), (w), (x), (y), (z))
-#define PerlProc_execv(c, a) \
- (*PL_Proc->pExecv)(PL_Proc, (c), (a))
-#define PerlProc_execvp(c, a) \
- (*PL_Proc->pExecvp)(PL_Proc, (c), (a))
-#define PerlProc_getuid() \
- (*PL_Proc->pGetuid)(PL_Proc)
-#define PerlProc_geteuid() \
- (*PL_Proc->pGeteuid)(PL_Proc)
-#define PerlProc_getgid() \
- (*PL_Proc->pGetgid)(PL_Proc)
-#define PerlProc_getegid() \
- (*PL_Proc->pGetegid)(PL_Proc)
-#define PerlProc_getlogin() \
- (*PL_Proc->pGetlogin)(PL_Proc)
-#define PerlProc_kill(i, a) \
- (*PL_Proc->pKill)(PL_Proc, (i), (a))
-#define PerlProc_killpg(i, a) \
- (*PL_Proc->pKillpg)(PL_Proc, (i), (a))
-#define PerlProc_pause() \
- (*PL_Proc->pPauseProc)(PL_Proc)
-#define PerlProc_popen(c, m) \
- (*PL_Proc->pPopen)(PL_Proc, (c), (m))
-#define PerlProc_popen_list(m, n, a) \
- (*PL_Proc->pPopenList)(PL_Proc, (m), (n), (a))
-#define PerlProc_pclose(f) \
- (*PL_Proc->pPclose)(PL_Proc, (f))
-#define PerlProc_pipe(fd) \
- (*PL_Proc->pPipe)(PL_Proc, (fd))
-#define PerlProc_setuid(u) \
- (*PL_Proc->pSetuid)(PL_Proc, (u))
-#define PerlProc_setgid(g) \
- (*PL_Proc->pSetgid)(PL_Proc, (g))
-#define PerlProc_sleep(t) \
- (*PL_Proc->pSleep)(PL_Proc, (t))
-#define PerlProc_times(t) \
- (*PL_Proc->pTimes)(PL_Proc, (t))
-#define PerlProc_wait(t) \
- (*PL_Proc->pWait)(PL_Proc, (t))
-#define PerlProc_waitpid(p,s,f) \
- (*PL_Proc->pWaitpid)(PL_Proc, (p), (s), (f))
-#define PerlProc_signal(n, h) \
- (*PL_Proc->pSignal)(PL_Proc, (n), (h))
-#define PerlProc_fork() \
- (*PL_Proc->pFork)(PL_Proc)
-#define PerlProc_getpid() \
- (*PL_Proc->pGetpid)(PL_Proc)
-#define PerlProc_setjmp(b, n) Sigsetjmp((b), (n))
-#define PerlProc_longjmp(b, n) Siglongjmp((b), (n))
+ PL_piProc->Execl((c), (w), (x), (y), (z))
+
+#define PerlProc_execv(c, a) PL_piProc->Execv((c), (a))
+#define PerlProc_execvp(c, a) PL_piProc->Execvp((c), (a))
+#define PerlProc_getuid() PL_piProc->Getuid()
+#define PerlProc_geteuid() PL_piProc->Geteuid()
+#define PerlProc_getgid() PL_piProc->Getgid()
+#define PerlProc_getegid() PL_piProc->Getegid()
+#define PerlProc_getlogin() PL_piProc->Getlogin()
+#define PerlProc_kill(i, a) PL_piProc->Kill((i), (a))
+#define PerlProc_killpg(i, a) PL_piProc->Killpg((i), (a))
+#define PerlProc_pause() PL_piProc->PauseProc()
+#define PerlProc_popen(c, m) PL_piProc->Popen((c), (m))
+#define PerlProc_pclose(f) PL_piProc->Pclose((f))
+#define PerlProc_pipe(fd) PL_piProc->Pipe((fd))
+#define PerlProc_setuid(u) PL_piProc->Setuid((u))
+#define PerlProc_setgid(g) PL_piProc->Setgid((g))
+#define PerlProc_sleep(t) PL_piProc->Sleep((t))
+#define PerlProc_times(t) PL_piProc->Times((t))
+#define PerlProc_wait(t) PL_piProc->Wait((t))
+#define PerlProc_waitpid(p,s,f) PL_piProc->Waitpid((p), (s), (f))
+#define PerlProc_setjmp(b, n) Sigsetjmp((b), (n))
+#define PerlProc_longjmp(b, n) Siglongjmp((b), (n))
+#define PerlProc_signal(n, h) PL_piProc->Signal((n), (h))
#ifdef WIN32
-#define PerlProc_DynaLoad(f) \
- (*PL_Proc->pDynaLoader)(PL_Proc, (f))
-#define PerlProc_GetOSError(s,e) \
- (*PL_Proc->pGetOSError)(PL_Proc, (s), (e))
-#define PerlProc_spawnvp(m, c, a) \
- (*PL_Proc->pSpawnvp)(PL_Proc, (m), (c), (a))
+#define PerlProc_GetSysMsg(s,l,e) \
+ PL_piProc->GetSysMsg((s), (l), (e))
+
+#define PerlProc_FreeBuf(s) PL_piProc->FreeBuf((s))
+#define PerlProc_Cmd(s) PL_piProc->DoCmd((s))
+#define do_spawn(s) PL_piProc->Spawn((s))
+#define do_spawnvp(m, c, a) PL_piProc->Spawnvp((m), (c), (a))
+#define PerlProc_aspawn(m,c,a) PL_piProc->ASpawn((m), (c), (a))
#endif
-#define PerlProc_lasthost() \
- (*PL_Proc->pLastHost)(PL_Proc)
-#define PerlProc_gettimeofday(t,z) \
- (*PL_Proc->pGetTimeOfDay)(PL_Proc,(t),(z))
-#else /* PERL_IMPLICIT_SYS */
+#else /* PERL_OBJECT */
#define PerlProc_abort() abort()
#define PerlProc_crypt(c,s) crypt((c), (s))
@@ -1103,7 +731,6 @@ struct IPerlProcInfo
#define PerlProc_killpg(i, a) killpg((i), (a))
#define PerlProc_pause() Pause()
#define PerlProc_popen(c, m) my_popen((c), (m))
-#define PerlProc_popen_list(m,n,a) my_popen_list((m),(n),(a))
#define PerlProc_pclose(f) my_pclose((f))
#define PerlProc_pipe(fd) pipe((fd))
#define PerlProc_setuid(u) setuid((u))
@@ -1115,242 +742,135 @@ struct IPerlProcInfo
#define PerlProc_setjmp(b, n) Sigsetjmp((b), (n))
#define PerlProc_longjmp(b, n) Siglongjmp((b), (n))
#define PerlProc_signal(n, h) signal((n), (h))
-#define PerlProc_fork() my_fork()
-#define PerlProc_getpid() getpid()
-#define PerlProc_gettimeofday(t,z) gettimeofday((t),(z))
-#ifdef WIN32
-#define PerlProc_DynaLoad(f) \
- win32_dynaload((f))
-#define PerlProc_GetOSError(s,e) \
- win32_str_os_error((s), (e))
-#define PerlProc_spawnvp(m, c, a) \
- win32_spawnvp((m), (c), (a))
-#undef PerlProc_signal
-#define PerlProc_signal(n, h) win32_signal((n), (h))
-#endif
-#endif /* PERL_IMPLICIT_SYS */
+
+#endif /* PERL_OBJECT */
/*
Interface for perl socket functions
*/
-#if defined(PERL_IMPLICIT_SYS)
-
-/* PerlSock */
-struct IPerlSock;
-struct IPerlSockInfo;
-typedef u_long (*LPHtonl)(struct IPerlSock*, u_long);
-typedef u_short (*LPHtons)(struct IPerlSock*, u_short);
-typedef u_long (*LPNtohl)(struct IPerlSock*, u_long);
-typedef u_short (*LPNtohs)(struct IPerlSock*, u_short);
-typedef SOCKET (*LPAccept)(struct IPerlSock*, SOCKET,
- struct sockaddr*, int*);
-typedef int (*LPBind)(struct IPerlSock*, SOCKET,
- const struct sockaddr*, int);
-typedef int (*LPConnect)(struct IPerlSock*, SOCKET,
- const struct sockaddr*, int);
-typedef void (*LPEndhostent)(struct IPerlSock*);
-typedef void (*LPEndnetent)(struct IPerlSock*);
-typedef void (*LPEndprotoent)(struct IPerlSock*);
-typedef void (*LPEndservent)(struct IPerlSock*);
-typedef int (*LPGethostname)(struct IPerlSock*, char*, int);
-typedef int (*LPGetpeername)(struct IPerlSock*, SOCKET,
- struct sockaddr*, int*);
-typedef struct hostent* (*LPGethostbyaddr)(struct IPerlSock*, const char*,
- int, int);
-typedef struct hostent* (*LPGethostbyname)(struct IPerlSock*, const char*);
-typedef struct hostent* (*LPGethostent)(struct IPerlSock*);
-typedef struct netent* (*LPGetnetbyaddr)(struct IPerlSock*, long, int);
-typedef struct netent* (*LPGetnetbyname)(struct IPerlSock*, const char*);
-typedef struct netent* (*LPGetnetent)(struct IPerlSock*);
-typedef struct protoent*(*LPGetprotobyname)(struct IPerlSock*, const char*);
-typedef struct protoent*(*LPGetprotobynumber)(struct IPerlSock*, int);
-typedef struct protoent*(*LPGetprotoent)(struct IPerlSock*);
-typedef struct servent* (*LPGetservbyname)(struct IPerlSock*, const char*,
- const char*);
-typedef struct servent* (*LPGetservbyport)(struct IPerlSock*, int,
- const char*);
-typedef struct servent* (*LPGetservent)(struct IPerlSock*);
-typedef int (*LPGetsockname)(struct IPerlSock*, SOCKET,
- struct sockaddr*, int*);
-typedef int (*LPGetsockopt)(struct IPerlSock*, SOCKET, int, int,
- char*, int*);
-typedef unsigned long (*LPInetAddr)(struct IPerlSock*, const char*);
-typedef char* (*LPInetNtoa)(struct IPerlSock*, struct in_addr);
-typedef int (*LPListen)(struct IPerlSock*, SOCKET, int);
-typedef int (*LPRecv)(struct IPerlSock*, SOCKET, char*, int, int);
-typedef int (*LPRecvfrom)(struct IPerlSock*, SOCKET, char*, int,
- int, struct sockaddr*, int*);
-typedef int (*LPSelect)(struct IPerlSock*, int, char*, char*,
- char*, const struct timeval*);
-typedef int (*LPSend)(struct IPerlSock*, SOCKET, const char*, int,
- int);
-typedef int (*LPSendto)(struct IPerlSock*, SOCKET, const char*,
- int, int, const struct sockaddr*, int);
-typedef void (*LPSethostent)(struct IPerlSock*, int);
-typedef void (*LPSetnetent)(struct IPerlSock*, int);
-typedef void (*LPSetprotoent)(struct IPerlSock*, int);
-typedef void (*LPSetservent)(struct IPerlSock*, int);
-typedef int (*LPSetsockopt)(struct IPerlSock*, SOCKET, int, int,
- const char*, int);
-typedef int (*LPShutdown)(struct IPerlSock*, SOCKET, int);
-typedef SOCKET (*LPSocket)(struct IPerlSock*, int, int, int);
-typedef int (*LPSocketpair)(struct IPerlSock*, int, int, int,
- int*);
-#ifdef WIN32
-typedef int (*LPClosesocket)(struct IPerlSock*, SOCKET s);
-#endif
+#ifdef PERL_OBJECT
-struct IPerlSock
+class IPerlSock
{
- LPHtonl pHtonl;
- LPHtons pHtons;
- LPNtohl pNtohl;
- LPNtohs pNtohs;
- LPAccept pAccept;
- LPBind pBind;
- LPConnect pConnect;
- LPEndhostent pEndhostent;
- LPEndnetent pEndnetent;
- LPEndprotoent pEndprotoent;
- LPEndservent pEndservent;
- LPGethostname pGethostname;
- LPGetpeername pGetpeername;
- LPGethostbyaddr pGethostbyaddr;
- LPGethostbyname pGethostbyname;
- LPGethostent pGethostent;
- LPGetnetbyaddr pGetnetbyaddr;
- LPGetnetbyname pGetnetbyname;
- LPGetnetent pGetnetent;
- LPGetprotobyname pGetprotobyname;
- LPGetprotobynumber pGetprotobynumber;
- LPGetprotoent pGetprotoent;
- LPGetservbyname pGetservbyname;
- LPGetservbyport pGetservbyport;
- LPGetservent pGetservent;
- LPGetsockname pGetsockname;
- LPGetsockopt pGetsockopt;
- LPInetAddr pInetAddr;
- LPInetNtoa pInetNtoa;
- LPListen pListen;
- LPRecv pRecv;
- LPRecvfrom pRecvfrom;
- LPSelect pSelect;
- LPSend pSend;
- LPSendto pSendto;
- LPSethostent pSethostent;
- LPSetnetent pSetnetent;
- LPSetprotoent pSetprotoent;
- LPSetservent pSetservent;
- LPSetsockopt pSetsockopt;
- LPShutdown pShutdown;
- LPSocket pSocket;
- LPSocketpair pSocketpair;
+public:
+ virtual u_long Htonl(u_long hostlong) = 0;
+ virtual u_short Htons(u_short hostshort) = 0;
+ virtual u_long Ntohl(u_long netlong) = 0;
+ virtual u_short Ntohs(u_short netshort) = 0;
+ virtual SOCKET Accept(SOCKET s, struct sockaddr* addr,
+ int* addrlen, int &err) = 0;
+ virtual int Bind(SOCKET s, const struct sockaddr* name,
+ int namelen, int &err) = 0;
+ virtual int Connect(SOCKET s, const struct sockaddr* name,
+ int namelen, int &err) = 0;
+ virtual void Endhostent(int &err) = 0;
+ virtual void Endnetent(int &err) = 0;
+ virtual void Endprotoent(int &err) = 0;
+ virtual void Endservent(int &err) = 0;
+ virtual int Gethostname(char* name, int namelen, int &err) = 0;
+ virtual int Getpeername(SOCKET s, struct sockaddr* name,
+ int* namelen, int &err) = 0;
+ virtual struct hostent * Gethostbyaddr(const char* addr, int len,
+ int type, int &err) = 0;
+ virtual struct hostent * Gethostbyname(const char* name, int &err) = 0;
+ virtual struct hostent * Gethostent(int &err) = 0;
+ virtual struct netent * Getnetbyaddr(long net, int type, int &err) = 0;
+ virtual struct netent * Getnetbyname(const char *, int &err) = 0;
+ virtual struct netent * Getnetent(int &err) = 0;
+ virtual struct protoent * Getprotobyname(const char* name, int &err) = 0;
+ virtual struct protoent * Getprotobynumber(int number, int &err) = 0;
+ virtual struct protoent * Getprotoent(int &err) = 0;
+ virtual struct servent * Getservbyname(const char* name,
+ const char* proto, int &err) = 0;
+ virtual struct servent * Getservbyport(int port, const char* proto,
+ int &err) = 0;
+ virtual struct servent * Getservent(int &err) = 0;
+ virtual int Getsockname(SOCKET s, struct sockaddr* name,
+ int* namelen, int &err) = 0;
+ virtual int Getsockopt(SOCKET s, int level, int optname,
+ char* optval, int* optlen, int &err) = 0;
+ virtual unsigned long InetAddr(const char* cp, int &err) = 0;
+ virtual char * InetNtoa(struct in_addr in, int &err) = 0;
+ virtual int Listen(SOCKET s, int backlog, int &err) = 0;
+ virtual int Recv(SOCKET s, char* buf, int len,
+ int flags, int &err) = 0;
+ virtual int Recvfrom(SOCKET s, char* buf, int len, int flags,
+ struct sockaddr* from, int* fromlen, int &err) = 0;
+ virtual int Select(int nfds, char* readfds, char* writefds,
+ char* exceptfds, const struct timeval* timeout,
+ int &err) = 0;
+ virtual int Send(SOCKET s, const char* buf, int len,
+ int flags, int &err) = 0;
+ virtual int Sendto(SOCKET s, const char* buf, int len, int flags,
+ const struct sockaddr* to, int tolen, int &err) = 0;
+ virtual void Sethostent(int stayopen, int &err) = 0;
+ virtual void Setnetent(int stayopen, int &err) = 0;
+ virtual void Setprotoent(int stayopen, int &err) = 0;
+ virtual void Setservent(int stayopen, int &err) = 0;
+ virtual int Setsockopt(SOCKET s, int level, int optname,
+ const char* optval, int optlen, int &err) = 0;
+ virtual int Shutdown(SOCKET s, int how, int &err) = 0;
+ virtual SOCKET Socket(int af, int type, int protocol, int &err) = 0;
+ virtual int Socketpair(int domain, int type, int protocol,
+ int* fds, int &err) = 0;
#ifdef WIN32
- LPClosesocket pClosesocket;
+ virtual int Closesocket(SOCKET s, int& err) = 0;
+ virtual int Ioctlsocket(SOCKET s, long cmd, u_long *argp,
+ int& err) = 0;
#endif
};
-struct IPerlSockInfo
-{
- unsigned long nCount; /* number of entries expected */
- struct IPerlSock perlSockList;
-};
-
-#define PerlSock_htonl(x) \
- (*PL_Sock->pHtonl)(PL_Sock, x)
-#define PerlSock_htons(x) \
- (*PL_Sock->pHtons)(PL_Sock, x)
-#define PerlSock_ntohl(x) \
- (*PL_Sock->pNtohl)(PL_Sock, x)
-#define PerlSock_ntohs(x) \
- (*PL_Sock->pNtohs)(PL_Sock, x)
-#define PerlSock_accept(s, a, l) \
- (*PL_Sock->pAccept)(PL_Sock, s, a, l)
-#define PerlSock_bind(s, n, l) \
- (*PL_Sock->pBind)(PL_Sock, s, n, l)
-#define PerlSock_connect(s, n, l) \
- (*PL_Sock->pConnect)(PL_Sock, s, n, l)
-#define PerlSock_endhostent() \
- (*PL_Sock->pEndhostent)(PL_Sock)
-#define PerlSock_endnetent() \
- (*PL_Sock->pEndnetent)(PL_Sock)
-#define PerlSock_endprotoent() \
- (*PL_Sock->pEndprotoent)(PL_Sock)
-#define PerlSock_endservent() \
- (*PL_Sock->pEndservent)(PL_Sock)
-#define PerlSock_gethostbyaddr(a, l, t) \
- (*PL_Sock->pGethostbyaddr)(PL_Sock, a, l, t)
-#define PerlSock_gethostbyname(n) \
- (*PL_Sock->pGethostbyname)(PL_Sock, n)
-#define PerlSock_gethostent() \
- (*PL_Sock->pGethostent)(PL_Sock)
-#define PerlSock_gethostname(n, l) \
- (*PL_Sock->pGethostname)(PL_Sock, n, l)
-#define PerlSock_getnetbyaddr(n, t) \
- (*PL_Sock->pGetnetbyaddr)(PL_Sock, n, t)
-#define PerlSock_getnetbyname(c) \
- (*PL_Sock->pGetnetbyname)(PL_Sock, c)
-#define PerlSock_getnetent() \
- (*PL_Sock->pGetnetent)(PL_Sock)
-#define PerlSock_getpeername(s, n, l) \
- (*PL_Sock->pGetpeername)(PL_Sock, s, n, l)
-#define PerlSock_getprotobyname(n) \
- (*PL_Sock->pGetprotobyname)(PL_Sock, n)
-#define PerlSock_getprotobynumber(n) \
- (*PL_Sock->pGetprotobynumber)(PL_Sock, n)
-#define PerlSock_getprotoent() \
- (*PL_Sock->pGetprotoent)(PL_Sock)
-#define PerlSock_getservbyname(n, p) \
- (*PL_Sock->pGetservbyname)(PL_Sock, n, p)
-#define PerlSock_getservbyport(port, p) \
- (*PL_Sock->pGetservbyport)(PL_Sock, port, p)
-#define PerlSock_getservent() \
- (*PL_Sock->pGetservent)(PL_Sock)
-#define PerlSock_getsockname(s, n, l) \
- (*PL_Sock->pGetsockname)(PL_Sock, s, n, l)
-#define PerlSock_getsockopt(s,l,n,v,i) \
- (*PL_Sock->pGetsockopt)(PL_Sock, s, l, n, v, i)
-#define PerlSock_inet_addr(c) \
- (*PL_Sock->pInetAddr)(PL_Sock, c)
-#define PerlSock_inet_ntoa(i) \
- (*PL_Sock->pInetNtoa)(PL_Sock, i)
-#define PerlSock_listen(s, b) \
- (*PL_Sock->pListen)(PL_Sock, s, b)
-#define PerlSock_recv(s, b, l, f) \
- (*PL_Sock->pRecv)(PL_Sock, s, b, l, f)
+#define PerlSock_htonl(x) PL_piSock->Htonl(x)
+#define PerlSock_htons(x) PL_piSock->Htons(x)
+#define PerlSock_ntohl(x) PL_piSock->Ntohl(x)
+#define PerlSock_ntohs(x) PL_piSock->Ntohs(x)
+#define PerlSock_accept(s, a, l) PL_piSock->Accept(s, a, l, ErrorNo())
+#define PerlSock_bind(s, n, l) PL_piSock->Bind(s, n, l, ErrorNo())
+#define PerlSock_connect(s, n, l) PL_piSock->Connect(s, n, l, ErrorNo())
+#define PerlSock_endhostent() PL_piSock->Endhostent(ErrorNo())
+#define PerlSock_endnetent() PL_piSock->Endnetent(ErrorNo())
+#define PerlSock_endprotoent() PL_piSock->Endprotoent(ErrorNo())
+#define PerlSock_endservent() PL_piSock->Endservent(ErrorNo())
+#define PerlSock_gethostbyaddr(a, l, t) PL_piSock->Gethostbyaddr(a, l, t, ErrorNo())
+#define PerlSock_gethostbyname(n) PL_piSock->Gethostbyname(n, ErrorNo())
+#define PerlSock_gethostent() PL_piSock->Gethostent(ErrorNo())
+#define PerlSock_gethostname(n, l) PL_piSock->Gethostname(n, l, ErrorNo())
+#define PerlSock_getnetbyaddr(n, t) PL_piSock->Getnetbyaddr(n, t, ErrorNo())
+#define PerlSock_getnetbyname(c) PL_piSock->Getnetbyname(c, ErrorNo())
+#define PerlSock_getnetent() PL_piSock->Getnetent(ErrorNo())
+#define PerlSock_getpeername(s, n, l) PL_piSock->Getpeername(s, n, l, ErrorNo())
+#define PerlSock_getprotobyname(n) PL_piSock->Getprotobyname(n, ErrorNo())
+#define PerlSock_getprotobynumber(n) PL_piSock->Getprotobynumber(n, ErrorNo())
+#define PerlSock_getprotoent() PL_piSock->Getprotoent(ErrorNo())
+#define PerlSock_getservbyname(n, p) PL_piSock->Getservbyname(n, p, ErrorNo())
+#define PerlSock_getservbyport(port, p) PL_piSock->Getservbyport(port, p, ErrorNo())
+#define PerlSock_getservent() PL_piSock->Getservent(ErrorNo())
+#define PerlSock_getsockname(s, n, l) PL_piSock->Getsockname(s, n, l, ErrorNo())
+#define PerlSock_getsockopt(s,l,n,v,i) PL_piSock->Getsockopt(s, l, n, v, i, ErrorNo())
+#define PerlSock_inet_addr(c) PL_piSock->InetAddr(c, ErrorNo())
+#define PerlSock_inet_ntoa(i) PL_piSock->InetNtoa(i, ErrorNo())
+#define PerlSock_listen(s, b) PL_piSock->Listen(s, b, ErrorNo())
+#define PerlSock_recv(s, b, l, f) PL_piSock->Recv(s, b, l, f, ErrorNo())
#define PerlSock_recvfrom(s,b,l,f,from,fromlen) \
- (*PL_Sock->pRecvfrom)(PL_Sock, s, b, l, f, from, fromlen)
+ PL_piSock->Recvfrom(s, b, l, f, from, fromlen, ErrorNo())
#define PerlSock_select(n, r, w, e, t) \
- (*PL_Sock->pSelect)(PL_Sock, n, (char*)r, (char*)w, (char*)e, t)
-#define PerlSock_send(s, b, l, f) \
- (*PL_Sock->pSend)(PL_Sock, s, b, l, f)
+ PL_piSock->Select(n, (char*)r, (char*)w, (char*)e, t, ErrorNo())
+#define PerlSock_send(s, b, l, f) PL_piSock->Send(s, b, l, f, ErrorNo())
#define PerlSock_sendto(s, b, l, f, t, tlen) \
- (*PL_Sock->pSendto)(PL_Sock, s, b, l, f, t, tlen)
-#define PerlSock_sethostent(f) \
- (*PL_Sock->pSethostent)(PL_Sock, f)
-#define PerlSock_setnetent(f) \
- (*PL_Sock->pSetnetent)(PL_Sock, f)
-#define PerlSock_setprotoent(f) \
- (*PL_Sock->pSetprotoent)(PL_Sock, f)
-#define PerlSock_setservent(f) \
- (*PL_Sock->pSetservent)(PL_Sock, f)
+ PL_piSock->Sendto(s, b, l, f, t, tlen, ErrorNo())
+#define PerlSock_sethostent(f) PL_piSock->Sethostent(f, ErrorNo())
+#define PerlSock_setnetent(f) PL_piSock->Setnetent(f, ErrorNo())
+#define PerlSock_setprotoent(f) PL_piSock->Setprotoent(f, ErrorNo())
+#define PerlSock_setservent(f) PL_piSock->Setservent(f, ErrorNo())
#define PerlSock_setsockopt(s, l, n, v, len) \
- (*PL_Sock->pSetsockopt)(PL_Sock, s, l, n, v, len)
-#define PerlSock_shutdown(s, h) \
- (*PL_Sock->pShutdown)(PL_Sock, s, h)
-#define PerlSock_socket(a, t, p) \
- (*PL_Sock->pSocket)(PL_Sock, a, t, p)
-#define PerlSock_socketpair(a, t, p, f) \
- (*PL_Sock->pSocketpair)(PL_Sock, a, t, p, f)
+ PL_piSock->Setsockopt(s, l, n, v, len, ErrorNo())
+#define PerlSock_shutdown(s, h) PL_piSock->Shutdown(s, h, ErrorNo())
+#define PerlSock_socket(a, t, p) PL_piSock->Socket(a, t, p, ErrorNo())
+#define PerlSock_socketpair(a, t, p, f) PL_piSock->Socketpair(a, t, p, f, ErrorNo())
-#ifdef WIN32
-#define PerlSock_closesocket(s) \
- (*PL_Sock->pClosesocket)(PL_Sock, s)
-#endif
-
-#else /* PERL_IMPLICIT_SYS */
+#else /* PERL_OBJECT */
#define PerlSock_htonl(x) htonl(x)
#define PerlSock_htons(x) htons(x)
@@ -1404,20 +924,8 @@ struct IPerlSockInfo
#define PerlSock_socket(a, t, p) socket(a, t, p)
#define PerlSock_socketpair(a, t, p, f) socketpair(a, t, p, f)
-#ifdef WIN32
-#define PerlSock_closesocket(s) closesocket(s)
-#endif
-#endif /* PERL_IMPLICIT_SYS */
+#endif /* PERL_OBJECT */
#endif /* __Inc__IPerl___ */
-/*
- * Local variables:
- * c-indentation-style: bsd
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
- * ex: set ts=8 sts=4 sw=4 et:
- */
diff --git a/gnu/usr.bin/perl/perlvars.h b/gnu/usr.bin/perl/perlvars.h
index 7bafa40882f..ffb3fe60e4f 100644
--- a/gnu/usr.bin/perl/perlvars.h
+++ b/gnu/usr.bin/perl/perlvars.h
@@ -1,23 +1,8 @@
-/* perlvars.h
- *
- * Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
- * by Larry Wall and others
- *
- * You may distribute under the terms of either the GNU General Public
- * License or the Artistic License, as specified in the README file.
- *
- */
-
-/*
-=head1 Global Variables
+/****************/
+/* Truly global */
+/****************/
-These variables are global to an entire process. They are shared between
-all interpreters and all threads in a process.
-
-=cut
-*/
-
-/* Don't forget to re-run regen/embed.pl to propagate changes! */
+/* Don't forget to re-run embed.pl to propagate changes! */
/* This file describes the "global" variables used by perl
* This used to be in perl.h directly but we want to abstract out into
@@ -25,215 +10,174 @@ all interpreters and all threads in a process.
* and how they're initialized.
*
* The 'G' prefix is only needed for vars that need appropriate #defines
- * generated in embed*.h. Such symbols are also used to generate
- * the appropriate export list for win32. */
-
-/* global state */
-#if defined(USE_ITHREADS)
-PERLVAR(G, op_mutex, perl_mutex) /* Mutex for op refcounting */
-#endif
-PERLVARI(G, curinterp, PerlInterpreter *, NULL)
- /* currently running interpreter
- * (initial parent interpreter under
- * useithreads) */
-#if defined(USE_ITHREADS)
-PERLVAR(G, thr_key, perl_key) /* key to retrieve per-thread struct */
-#endif
-
-/* XXX does anyone even use this? */
-PERLVARI(G, do_undump, bool, FALSE) /* -u or dump seen? */
-
-#ifndef PERL_USE_SAFE_PUTENV
-PERLVARI(G, use_safe_putenv, bool, TRUE)
-#endif
-
-#if defined(FAKE_PERSISTENT_SIGNAL_HANDLERS)||defined(FAKE_DEFAULT_SIGNAL_HANDLERS)
-PERLVARI(G, sig_handlers_initted, int, 0)
-#endif
-#ifdef FAKE_PERSISTENT_SIGNAL_HANDLERS
-PERLVARA(G, sig_ignoring, SIG_SIZE, int)
- /* which signals we are ignoring */
-#endif
-#ifdef FAKE_DEFAULT_SIGNAL_HANDLERS
-PERLVARA(G, sig_defaulting, SIG_SIZE, int)
-#endif
-
-/* XXX signals are process-wide anyway, so we
- * ignore the implications of this for threading */
-#ifndef HAS_SIGACTION
-PERLVARI(G, sig_trapped, int, 0)
-#endif
-
-#ifndef PERL_MICRO
-/* If Perl has to ignore SIGPFE, this is its saved state.
- * See perl.h macros PERL_FPU_INIT and PERL_FPU_{PRE,POST}_EXEC. */
-PERLVAR(G, sigfpe_saved, Sighandler_t)
-PERLVARI(G, csighandlerp, Sighandler_t, Perl_csighandler)
- /* Pointer to C-level sighandler */
-#endif
-
-/* This is constant on most architectures, a global on OS/2 */
-#ifdef OS2
-PERLVARI(G, sh_path, char *, SH_PATH) /* full path of shell */
-#endif
-
-#ifdef USE_PERLIO
-
-# if defined(USE_ITHREADS)
-PERLVAR(G, perlio_mutex, perl_mutex) /* Mutex for perlio fd refcounts */
-# endif
-
-PERLVARI(G, perlio_fd_refcnt, int *, 0) /* Pointer to array of fd refcounts. */
-PERLVARI(G, perlio_fd_refcnt_size, int, 0) /* Size of the array */
-PERLVARI(G, perlio_debug_fd, int, 0) /* the fd to write perlio debug into, 0 means not set yet */
-#endif
-
-#ifdef HAS_MMAP
-PERLVARI(G, mmap_page_size, IV, 0)
-#endif
-
-#if defined(USE_ITHREADS)
-PERLVAR(G, hints_mutex, perl_mutex) /* Mutex for refcounted he refcounting */
-#endif
-
-#ifdef DEBUGGING
-PERLVARI(G, watch_pvx, char *, NULL)
-#endif
-
-/*
-=for apidoc AmU|Perl_check_t *|PL_check
-
-Array, indexed by opcode, of functions that will be called for the "check"
-phase of optree building during compilation of Perl code. For most (but
-not all) types of op, once the op has been initially built and populated
-with child ops it will be filtered through the check function referenced
-by the appropriate element of this array. The new op is passed in as the
-sole argument to the check function, and the check function returns the
-completed op. The check function may (as the name suggests) check the op
-for validity and signal errors. It may also initialise or modify parts of
-the ops, or perform more radical surgery such as adding or removing child
-ops, or even throw the op away and return a different op in its place.
-
-This array of function pointers is a convenient place to hook into the
-compilation process. An XS module can put its own custom check function
-in place of any of the standard ones, to influence the compilation of a
-particular type of op. However, a custom check function must never fully
-replace a standard check function (or even a custom check function from
-another module). A module modifying checking must instead B<wrap> the
-preexisting check function. A custom check function must be selective
-about when to apply its custom behaviour. In the usual case where
-it decides not to do anything special with an op, it must chain the
-preexisting op function. Check functions are thus linked in a chain,
-with the core's base checker at the end.
-
-For thread safety, modules should not write directly to this array.
-Instead, use the function L</wrap_op_checker>.
-
-=cut
-*/
-
-#if defined(USE_ITHREADS)
-PERLVAR(G, check_mutex, perl_mutex) /* Mutex for PL_check */
-#endif
-#ifdef PERL_GLOBAL_STRUCT
-PERLVAR(G, ppaddr, Perl_ppaddr_t *) /* or opcode.h */
-PERLVAR(G, check, Perl_check_t *) /* or opcode.h */
-PERLVARA(G, fold_locale, 256, unsigned char) /* or perl.h */
-#endif
-
-#ifdef PERL_NEED_APPCTX
-PERLVAR(G, appctx, void*) /* the application context */
-#endif
-
-#if defined(HAS_TIMES) && defined(PERL_NEED_TIMESBASE)
-PERLVAR(G, timesbase, struct tms)
-#endif
-
-/* allocate a unique index to every module that calls MY_CXT_INIT */
-
-#ifdef PERL_IMPLICIT_CONTEXT
-# ifdef USE_ITHREADS
-PERLVAR(G, my_ctx_mutex, perl_mutex)
-# endif
-PERLVARI(G, my_cxt_index, int, 0)
-#endif
-
-/* this is currently set without MUTEX protection, so keep it a type which
- * can be set atomically (ie not a bit field) */
-PERLVARI(G, veto_cleanup, int, FALSE) /* exit without cleanup */
-
-/*
-=for apidoc AmUx|Perl_keyword_plugin_t|PL_keyword_plugin
-
-Function pointer, pointing at a function used to handle extended keywords.
-The function should be declared as
-
- int keyword_plugin_function(pTHX_
- char *keyword_ptr, STRLEN keyword_len,
- OP **op_ptr)
-
-The function is called from the tokeniser, whenever a possible keyword
-is seen. C<keyword_ptr> points at the word in the parser's input
-buffer, and C<keyword_len> gives its length; it is not null-terminated.
-The function is expected to examine the word, and possibly other state
-such as L<%^H|perlvar/%^H>, to decide whether it wants to handle it
-as an extended keyword. If it does not, the function should return
-C<KEYWORD_PLUGIN_DECLINE>, and the normal parser process will continue.
-
-If the function wants to handle the keyword, it first must
-parse anything following the keyword that is part of the syntax
-introduced by the keyword. See L</Lexer interface> for details.
-
-When a keyword is being handled, the plugin function must build
-a tree of C<OP> structures, representing the code that was parsed.
-The root of the tree must be stored in C<*op_ptr>. The function then
-returns a constant indicating the syntactic role of the construct that
-it has parsed: C<KEYWORD_PLUGIN_STMT> if it is a complete statement, or
-C<KEYWORD_PLUGIN_EXPR> if it is an expression. Note that a statement
-construct cannot be used inside an expression (except via C<do BLOCK>
-and similar), and an expression is not a complete statement (it requires
-at least a terminating semicolon).
-
-When a keyword is handled, the plugin function may also have
-(compile-time) side effects. It may modify C<%^H>, define functions, and
-so on. Typically, if side effects are the main purpose of a handler,
-it does not wish to generate any ops to be included in the normal
-compilation. In this case it is still required to supply an op tree,
-but it suffices to generate a single null op.
-
-That's how the C<*PL_keyword_plugin> function needs to behave overall.
-Conventionally, however, one does not completely replace the existing
-handler function. Instead, take a copy of C<PL_keyword_plugin> before
-assigning your own function pointer to it. Your handler function should
-look for keywords that it is interested in and handle those. Where it
-is not interested, it should call the saved plugin function, passing on
-the arguments it received. Thus C<PL_keyword_plugin> actually points
-at a chain of handler functions, all of which have an opportunity to
-handle keywords, and only the last function in the chain (built into
-the Perl core) will normally return C<KEYWORD_PLUGIN_DECLINE>.
-
-=cut
-*/
-
-PERLVARI(G, keyword_plugin, Perl_keyword_plugin_t, Perl_keyword_plugin_standard)
-
-PERLVARI(G, op_sequence, HV *, NULL) /* dump.c */
-PERLVARI(G, op_seq, UV, 0) /* dump.c */
-
-#ifdef USE_ITHREADS
-PERLVAR(G, dollarzero_mutex, perl_mutex) /* Modifying $0 */
-#endif
-
-/* Restricted hashes placeholder value.
- In theory, the contents are never used, only the address.
- In practice, &PL_sv_placeholder is returned by some APIs, and the calling
- code is checking SvOK(). */
+ * generated when built with or without EMBED. It is also used to generate
+ * the appropriate export list for win32.
+ *
+ * Avoid build-specific #ifdefs here, like DEBUGGING. That way,
+ * we can keep binary compatibility of the curinterp structure */
-PERLVAR(G, sv_placeholder, SV)
-#if defined(MYMALLOC) && defined(USE_ITHREADS)
-PERLVAR(G, malloc_mutex, perl_mutex) /* Mutex for malloc */
+/* global state */
+PERLVAR(Gcurinterp, PerlInterpreter *)
+ /* currently running interpreter */
+#ifdef USE_THREADS
+PERLVAR(Gthr_key, perl_key) /* For per-thread struct perl_thread* */
+PERLVAR(Gsv_mutex, perl_mutex) /* Mutex for allocating SVs in sv.c */
+PERLVAR(Gmalloc_mutex, perl_mutex) /* Mutex for malloc */
+PERLVAR(Geval_mutex, perl_mutex) /* Mutex for doeval */
+PERLVAR(Geval_cond, perl_cond) /* Condition variable for doeval */
+PERLVAR(Geval_owner, struct perl_thread *)
+ /* Owner thread for doeval */
+PERLVAR(Gnthreads, int) /* Number of threads currently */
+PERLVAR(Gthreads_mutex, perl_mutex) /* Mutex for nthreads and thread list */
+PERLVAR(Gnthreads_cond, perl_cond) /* Condition variable for nthreads */
+PERLVAR(Gsvref_mutex, perl_mutex) /* Mutex for SvREFCNT_{inc,dec} */
+PERLVARI(Gthreadsv_names,char *, THREADSV_NAMES)
+#ifdef FAKE_THREADS
+PERLVAR(Gcurthr, struct perl_thread *)
+ /* Currently executing (fake) thread */
+#endif
+#endif /* USE_THREADS */
+
+PERLVAR(Gninterps, int) /* number of active interpreters */
+
+PERLVAR(Guid, int) /* current real user id */
+PERLVAR(Geuid, int) /* current effective user id */
+PERLVAR(Ggid, int) /* current real group id */
+PERLVAR(Gegid, int) /* current effective group id */
+PERLVAR(Gnomemok, bool) /* let malloc context handle nomem */
+PERLVAR(Gan, U32) /* malloc sequence number */
+PERLVAR(Gcop_seqmax, U32) /* statement sequence number */
+PERLVAR(Gop_seqmax, U16) /* op sequence number */
+PERLVAR(Gevalseq, U32) /* eval sequence number */
+PERLVAR(Gorigenviron, char **)
+PERLVAR(Gorigalen, U32)
+PERLVAR(Gpidstatus, HV *) /* pid-to-status mappings for waitpid */
+PERLVARI(Gmaxo, int, MAXO) /* maximum number of ops */
+PERLVAR(Gosname, char *) /* operating system */
+PERLVARI(Gsh_path, char *, SH_PATH)/* full path of shell */
+PERLVAR(Gsighandlerp, Sighandler_t)
+
+PERLVAR(Gxiv_arenaroot, XPV*) /* list of allocated xiv areas */
+PERLVAR(Gxiv_root, IV *) /* free xiv list--shared by interpreters */
+PERLVAR(Gxnv_root, double *) /* free xnv list--shared by interpreters */
+PERLVAR(Gxrv_root, XRV *) /* free xrv list--shared by interpreters */
+PERLVAR(Gxpv_root, XPV *) /* free xpv list--shared by interpreters */
+PERLVAR(Ghe_root, HE *) /* free he list--shared by interpreters */
+PERLVAR(Gnice_chunk, char *) /* a nice chunk of memory to reuse */
+PERLVAR(Gnice_chunk_size, U32) /* how nice the chunk of memory is */
+
+#ifdef PERL_OBJECT
+PERLVARI(Grunops, runops_proc_t, FUNC_NAME_TO_PTR(RUNOPS_DEFAULT))
+#else
+PERLVARI(Grunops, runops_proc_t *, RUNOPS_DEFAULT)
+#endif
+
+PERLVAR(Gtokenbuf[256], char)
+PERLVAR(Gna, STRLEN) /* for use in SvPV when length is
+ Not Applicable */
+
+PERLVAR(Gsv_undef, SV)
+PERLVAR(Gsv_no, SV)
+PERLVAR(Gsv_yes, SV)
+#ifdef CSH
+PERLVARI(Gcshname, char *, CSH)
+PERLVAR(Gcshlen, I32)
+#endif
+
+PERLVAR(Glex_state, U32) /* next token is determined */
+PERLVAR(Glex_defer, U32) /* state after determined token */
+PERLVAR(Glex_expect, expectation) /* expect after determined token */
+PERLVAR(Glex_brackets, I32) /* bracket count */
+PERLVAR(Glex_formbrack, I32) /* bracket count at outer format level */
+PERLVAR(Glex_fakebrack, I32) /* outer bracket is mere delimiter */
+PERLVAR(Glex_casemods, I32) /* casemod count */
+PERLVAR(Glex_dojoin, I32) /* doing an array interpolation */
+PERLVAR(Glex_starts, I32) /* how many interps done on level */
+PERLVAR(Glex_stuff, SV *) /* runtime pattern from m// or s/// */
+PERLVAR(Glex_repl, SV *) /* runtime replacement from s/// */
+PERLVAR(Glex_op, OP *) /* extra info to pass back on op */
+PERLVAR(Glex_inpat, OP *) /* in pattern $) and $| are special */
+PERLVAR(Glex_inwhat, I32) /* what kind of quoting are we in */
+PERLVAR(Glex_brackstack,char *) /* what kind of brackets to pop */
+PERLVAR(Glex_casestack, char *) /* what kind of case mods in effect */
+
+/* What we know when we're in LEX_KNOWNEXT state. */
+PERLVAR(Gnextval[5], YYSTYPE) /* value of next token, if any */
+PERLVAR(Gnexttype[5], I32) /* type of next token */
+PERLVAR(Gnexttoke, I32)
+
+PERLVAR(Glinestr, SV *)
+PERLVAR(Gbufptr, char *)
+PERLVAR(Goldbufptr, char *)
+PERLVAR(Goldoldbufptr, char *)
+PERLVAR(Gbufend, char *)
+PERLVARI(Gexpect,expectation, XSTATE) /* how to interpret ambiguous tokens */
+
+PERLVAR(Gmulti_start, I32) /* 1st line of multi-line string */
+PERLVAR(Gmulti_end, I32) /* last line of multi-line string */
+PERLVAR(Gmulti_open, I32) /* delimiter of said string */
+PERLVAR(Gmulti_close, I32) /* delimiter of said string */
+
+PERLVAR(Gerror_count, I32) /* how many errors so far, max 10 */
+PERLVAR(Gsubline, I32) /* line this subroutine began on */
+PERLVAR(Gsubname, SV *) /* name of current subroutine */
+
+PERLVAR(Gmin_intro_pending, I32) /* start of vars to introduce */
+PERLVAR(Gmax_intro_pending, I32) /* end of vars to introduce */
+PERLVAR(Gpadix, I32) /* max used index in current "register" pad */
+PERLVAR(Gpadix_floor, I32) /* how low may inner block reset padix */
+PERLVAR(Gpad_reset_pending, I32) /* reset pad on next attempted alloc */
+
+PERLVAR(Gthisexpr, I32) /* name id for nothing_in_common() */
+PERLVAR(Glast_uni, char *) /* position of last named-unary op */
+PERLVAR(Glast_lop, char *) /* position of last list operator */
+PERLVAR(Glast_lop_op, OPCODE) /* last list operator */
+PERLVAR(Gin_my, bool) /* we're compiling a "my" declaration */
+PERLVAR(Gin_my_stash, HV *) /* declared class of this "my" declaration */
+#ifdef FCRYPT
+PERLVAR(Gcryptseen, I32) /* has fast crypt() been initialized? */
+#endif
+
+PERLVAR(Ghints, U32) /* pragma-tic compile-time flags */
+
+PERLVAR(Gdo_undump, bool) /* -u or dump seen? */
+PERLVAR(Gdebug, VOL U32) /* flags given to -D switch */
+
+
+#ifdef OVERLOAD
+
+PERLVAR(Gamagic_generation, long)
+
+#endif
+
+#ifdef USE_LOCALE_COLLATE
+PERLVAR(Gcollation_ix, U32) /* Collation generation index */
+PERLVAR(Gcollation_name,char *) /* Name of current collation */
+PERLVARI(Gcollation_standard, bool, TRUE)
+ /* Assume simple collation */
+PERLVAR(Gcollxfrm_base, Size_t) /* Basic overhead in *xfrm() */
+PERLVARI(Gcollxfrm_mult,Size_t, 2) /* Expansion factor in *xfrm() */
+#endif /* USE_LOCALE_COLLATE */
+
+#ifdef USE_LOCALE_NUMERIC
+
+PERLVAR(Gnumeric_name, char *) /* Name of current numeric locale */
+PERLVARI(Gnumeric_standard, bool, TRUE)
+ /* Assume simple numerics */
+PERLVARI(Gnumeric_local, bool, TRUE)
+ /* Assume local numerics */
+
+#endif /* !USE_LOCALE_NUMERIC */
+
+/* constants (these are not literals to facilitate pointer comparisons) */
+PERLVARIC(GYes, char *, "1")
+PERLVARIC(GNo, char *, "")
+PERLVARIC(Ghexdigit, char *, "0123456789abcdef0123456789ABCDEF")
+PERLVARIC(Gpatleave, char *, "\\.^$@dDwWsSbB+*?|()-nrtfeaxc0123456789[{]}")
+
+PERLVAR(Gspecialsv_list[4],SV *) /* from byterun.h */
+
+#ifdef USE_THREADS
+PERLVAR(Gcred_mutex, perl_mutex) /* altered credentials in effect */
#endif
-
-PERLVARI(G, hash_seed_set, bool, FALSE) /* perl.c */
-PERLVARA(G, hash_seed, PERL_HASH_SEED_BYTES, unsigned char) /* perl.c and hv.h */
diff --git a/gnu/usr.bin/perl/pp_proto.h b/gnu/usr.bin/perl/pp_proto.h
index 73ff532b5c8..ad82696849b 100644
--- a/gnu/usr.bin/perl/pp_proto.h
+++ b/gnu/usr.bin/perl/pp_proto.h
@@ -1,280 +1,344 @@
-/* -*- buffer-read-only: t -*-
- !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
- This file is built by opcode.pl from its data.
- Any changes made here will be lost!
- */
-
-PERL_CALLCONV OP *Perl_do_kv(pTHX);
-PERL_CALLCONV OP *Perl_pp_aassign(pTHX);
-PERL_CALLCONV OP *Perl_pp_abs(pTHX);
-PERL_CALLCONV OP *Perl_pp_accept(pTHX);
-PERL_CALLCONV OP *Perl_pp_add(pTHX);
-PERL_CALLCONV OP *Perl_pp_aeach(pTHX);
-PERL_CALLCONV OP *Perl_pp_aelem(pTHX);
-PERL_CALLCONV OP *Perl_pp_aelemfast(pTHX);
-PERL_CALLCONV OP *Perl_pp_akeys(pTHX);
-PERL_CALLCONV OP *Perl_pp_alarm(pTHX);
-PERL_CALLCONV OP *Perl_pp_and(pTHX);
-PERL_CALLCONV OP *Perl_pp_anoncode(pTHX);
-PERL_CALLCONV OP *Perl_pp_anonhash(pTHX);
-PERL_CALLCONV OP *Perl_pp_anonlist(pTHX);
-PERL_CALLCONV OP *Perl_pp_aslice(pTHX);
-PERL_CALLCONV OP *Perl_pp_atan2(pTHX);
-PERL_CALLCONV OP *Perl_pp_av2arylen(pTHX);
-PERL_CALLCONV OP *Perl_pp_backtick(pTHX);
-PERL_CALLCONV OP *Perl_pp_bind(pTHX);
-PERL_CALLCONV OP *Perl_pp_binmode(pTHX);
-PERL_CALLCONV OP *Perl_pp_bit_and(pTHX);
-PERL_CALLCONV OP *Perl_pp_bit_or(pTHX);
-PERL_CALLCONV OP *Perl_pp_bless(pTHX);
-PERL_CALLCONV OP *Perl_pp_break(pTHX);
-PERL_CALLCONV OP *Perl_pp_caller(pTHX);
-PERL_CALLCONV OP *Perl_pp_chdir(pTHX);
-PERL_CALLCONV OP *Perl_pp_chop(pTHX);
-PERL_CALLCONV OP *Perl_pp_chown(pTHX);
-PERL_CALLCONV OP *Perl_pp_chr(pTHX);
-PERL_CALLCONV OP *Perl_pp_chroot(pTHX);
-PERL_CALLCONV OP *Perl_pp_clonecv(pTHX);
-PERL_CALLCONV OP *Perl_pp_close(pTHX);
-PERL_CALLCONV OP *Perl_pp_closedir(pTHX);
-PERL_CALLCONV OP *Perl_pp_complement(pTHX);
-PERL_CALLCONV OP *Perl_pp_concat(pTHX);
-PERL_CALLCONV OP *Perl_pp_cond_expr(pTHX);
-PERL_CALLCONV OP *Perl_pp_const(pTHX);
-PERL_CALLCONV OP *Perl_pp_continue(pTHX);
-PERL_CALLCONV OP *Perl_pp_coreargs(pTHX);
-PERL_CALLCONV OP *Perl_pp_crypt(pTHX);
-PERL_CALLCONV OP *Perl_pp_dbmopen(pTHX);
-PERL_CALLCONV OP *Perl_pp_dbstate(pTHX);
-PERL_CALLCONV OP *Perl_pp_defined(pTHX);
-PERL_CALLCONV OP *Perl_pp_delete(pTHX);
-PERL_CALLCONV OP *Perl_pp_die(pTHX);
-PERL_CALLCONV OP *Perl_pp_divide(pTHX);
-PERL_CALLCONV OP *Perl_pp_each(pTHX);
-PERL_CALLCONV OP *Perl_pp_ehostent(pTHX);
-PERL_CALLCONV OP *Perl_pp_enter(pTHX);
-PERL_CALLCONV OP *Perl_pp_entereval(pTHX);
-PERL_CALLCONV OP *Perl_pp_entergiven(pTHX);
-PERL_CALLCONV OP *Perl_pp_enteriter(pTHX);
-PERL_CALLCONV OP *Perl_pp_enterloop(pTHX);
-PERL_CALLCONV OP *Perl_pp_entersub(pTHX);
-PERL_CALLCONV OP *Perl_pp_entertry(pTHX);
-PERL_CALLCONV OP *Perl_pp_enterwhen(pTHX);
-PERL_CALLCONV OP *Perl_pp_enterwrite(pTHX);
-PERL_CALLCONV OP *Perl_pp_eof(pTHX);
-PERL_CALLCONV OP *Perl_pp_eq(pTHX);
-PERL_CALLCONV OP *Perl_pp_exec(pTHX);
-PERL_CALLCONV OP *Perl_pp_exists(pTHX);
-PERL_CALLCONV OP *Perl_pp_exit(pTHX);
-PERL_CALLCONV OP *Perl_pp_fc(pTHX);
-PERL_CALLCONV OP *Perl_pp_fileno(pTHX);
-PERL_CALLCONV OP *Perl_pp_flip(pTHX);
-PERL_CALLCONV OP *Perl_pp_flock(pTHX);
-PERL_CALLCONV OP *Perl_pp_flop(pTHX);
-PERL_CALLCONV OP *Perl_pp_fork(pTHX);
-PERL_CALLCONV OP *Perl_pp_formline(pTHX);
-PERL_CALLCONV OP *Perl_pp_ftis(pTHX);
-PERL_CALLCONV OP *Perl_pp_ftlink(pTHX);
-PERL_CALLCONV OP *Perl_pp_ftrowned(pTHX);
-PERL_CALLCONV OP *Perl_pp_ftrread(pTHX);
-PERL_CALLCONV OP *Perl_pp_fttext(pTHX);
-PERL_CALLCONV OP *Perl_pp_fttty(pTHX);
-PERL_CALLCONV OP *Perl_pp_ge(pTHX);
-PERL_CALLCONV OP *Perl_pp_gelem(pTHX);
-PERL_CALLCONV OP *Perl_pp_getc(pTHX);
-PERL_CALLCONV OP *Perl_pp_getlogin(pTHX);
-PERL_CALLCONV OP *Perl_pp_getpeername(pTHX);
-PERL_CALLCONV OP *Perl_pp_getpgrp(pTHX);
-PERL_CALLCONV OP *Perl_pp_getppid(pTHX);
-PERL_CALLCONV OP *Perl_pp_getpriority(pTHX);
-PERL_CALLCONV OP *Perl_pp_ggrent(pTHX);
-PERL_CALLCONV OP *Perl_pp_ghostent(pTHX);
-PERL_CALLCONV OP *Perl_pp_glob(pTHX);
-PERL_CALLCONV OP *Perl_pp_gmtime(pTHX);
-PERL_CALLCONV OP *Perl_pp_gnetent(pTHX);
-PERL_CALLCONV OP *Perl_pp_goto(pTHX);
-PERL_CALLCONV OP *Perl_pp_gprotoent(pTHX);
-PERL_CALLCONV OP *Perl_pp_gpwent(pTHX);
-PERL_CALLCONV OP *Perl_pp_grepstart(pTHX);
-PERL_CALLCONV OP *Perl_pp_grepwhile(pTHX);
-PERL_CALLCONV OP *Perl_pp_gservent(pTHX);
-PERL_CALLCONV OP *Perl_pp_gt(pTHX);
-PERL_CALLCONV OP *Perl_pp_gv(pTHX);
-PERL_CALLCONV OP *Perl_pp_gvsv(pTHX);
-PERL_CALLCONV OP *Perl_pp_helem(pTHX);
-PERL_CALLCONV OP *Perl_pp_hintseval(pTHX);
-PERL_CALLCONV OP *Perl_pp_hslice(pTHX);
-PERL_CALLCONV OP *Perl_pp_i_add(pTHX);
-PERL_CALLCONV OP *Perl_pp_i_divide(pTHX);
-PERL_CALLCONV OP *Perl_pp_i_eq(pTHX);
-PERL_CALLCONV OP *Perl_pp_i_ge(pTHX);
-PERL_CALLCONV OP *Perl_pp_i_gt(pTHX);
-PERL_CALLCONV OP *Perl_pp_i_le(pTHX);
-PERL_CALLCONV OP *Perl_pp_i_lt(pTHX);
-PERL_CALLCONV OP *Perl_pp_i_modulo(pTHX);
-PERL_CALLCONV OP *Perl_pp_i_multiply(pTHX);
-PERL_CALLCONV OP *Perl_pp_i_ncmp(pTHX);
-PERL_CALLCONV OP *Perl_pp_i_ne(pTHX);
-PERL_CALLCONV OP *Perl_pp_i_negate(pTHX);
-PERL_CALLCONV OP *Perl_pp_i_subtract(pTHX);
-PERL_CALLCONV OP *Perl_pp_index(pTHX);
-PERL_CALLCONV OP *Perl_pp_int(pTHX);
-PERL_CALLCONV OP *Perl_pp_introcv(pTHX);
-PERL_CALLCONV OP *Perl_pp_ioctl(pTHX);
-PERL_CALLCONV OP *Perl_pp_iter(pTHX);
-PERL_CALLCONV OP *Perl_pp_join(pTHX);
-PERL_CALLCONV OP *Perl_pp_kvaslice(pTHX);
-PERL_CALLCONV OP *Perl_pp_kvhslice(pTHX);
-PERL_CALLCONV OP *Perl_pp_last(pTHX);
-PERL_CALLCONV OP *Perl_pp_lc(pTHX);
-PERL_CALLCONV OP *Perl_pp_le(pTHX);
-PERL_CALLCONV OP *Perl_pp_leave(pTHX);
-PERL_CALLCONV OP *Perl_pp_leaveeval(pTHX);
-PERL_CALLCONV OP *Perl_pp_leavegiven(pTHX);
-PERL_CALLCONV OP *Perl_pp_leaveloop(pTHX);
-PERL_CALLCONV OP *Perl_pp_leavesub(pTHX);
-PERL_CALLCONV OP *Perl_pp_leavesublv(pTHX);
-PERL_CALLCONV OP *Perl_pp_leavetry(pTHX);
-PERL_CALLCONV OP *Perl_pp_leavewhen(pTHX);
-PERL_CALLCONV OP *Perl_pp_leavewrite(pTHX);
-PERL_CALLCONV OP *Perl_pp_left_shift(pTHX);
-PERL_CALLCONV OP *Perl_pp_length(pTHX);
-PERL_CALLCONV OP *Perl_pp_link(pTHX);
-PERL_CALLCONV OP *Perl_pp_list(pTHX);
-PERL_CALLCONV OP *Perl_pp_listen(pTHX);
-PERL_CALLCONV OP *Perl_pp_lock(pTHX);
-PERL_CALLCONV OP *Perl_pp_lslice(pTHX);
-PERL_CALLCONV OP *Perl_pp_lt(pTHX);
-PERL_CALLCONV OP *Perl_pp_mapwhile(pTHX);
-PERL_CALLCONV OP *Perl_pp_match(pTHX);
-PERL_CALLCONV OP *Perl_pp_method(pTHX);
-PERL_CALLCONV OP *Perl_pp_method_named(pTHX);
-PERL_CALLCONV OP *Perl_pp_mkdir(pTHX);
-PERL_CALLCONV OP *Perl_pp_modulo(pTHX);
-PERL_CALLCONV OP *Perl_pp_multiply(pTHX);
-PERL_CALLCONV OP *Perl_pp_ncmp(pTHX);
-PERL_CALLCONV OP *Perl_pp_ne(pTHX);
-PERL_CALLCONV OP *Perl_pp_negate(pTHX);
-PERL_CALLCONV OP *Perl_pp_next(pTHX);
-PERL_CALLCONV OP *Perl_pp_nextstate(pTHX);
-PERL_CALLCONV OP *Perl_pp_not(pTHX);
-PERL_CALLCONV OP *Perl_pp_null(pTHX);
-PERL_CALLCONV OP *Perl_pp_oct(pTHX);
-PERL_CALLCONV OP *Perl_pp_once(pTHX);
-PERL_CALLCONV OP *Perl_pp_open(pTHX);
-PERL_CALLCONV OP *Perl_pp_open_dir(pTHX);
-PERL_CALLCONV OP *Perl_pp_or(pTHX);
-PERL_CALLCONV OP *Perl_pp_ord(pTHX);
-PERL_CALLCONV OP *Perl_pp_pack(pTHX);
-PERL_CALLCONV OP *Perl_pp_padav(pTHX);
-PERL_CALLCONV OP *Perl_pp_padcv(pTHX);
-PERL_CALLCONV OP *Perl_pp_padhv(pTHX);
-PERL_CALLCONV OP *Perl_pp_padrange(pTHX);
-PERL_CALLCONV OP *Perl_pp_padsv(pTHX);
-PERL_CALLCONV OP *Perl_pp_pipe_op(pTHX);
-PERL_CALLCONV OP *Perl_pp_pos(pTHX);
-PERL_CALLCONV OP *Perl_pp_postinc(pTHX);
-PERL_CALLCONV OP *Perl_pp_pow(pTHX);
-PERL_CALLCONV OP *Perl_pp_preinc(pTHX);
-PERL_CALLCONV OP *Perl_pp_print(pTHX);
-PERL_CALLCONV OP *Perl_pp_prototype(pTHX);
-PERL_CALLCONV OP *Perl_pp_prtf(pTHX);
-PERL_CALLCONV OP *Perl_pp_push(pTHX);
-PERL_CALLCONV OP *Perl_pp_pushmark(pTHX);
-PERL_CALLCONV OP *Perl_pp_pushre(pTHX);
-PERL_CALLCONV OP *Perl_pp_qr(pTHX);
-PERL_CALLCONV OP *Perl_pp_quotemeta(pTHX);
-PERL_CALLCONV OP *Perl_pp_rand(pTHX);
-PERL_CALLCONV OP *Perl_pp_range(pTHX);
-PERL_CALLCONV OP *Perl_pp_rcatline(pTHX);
-PERL_CALLCONV OP *Perl_pp_readdir(pTHX);
-PERL_CALLCONV OP *Perl_pp_readline(pTHX);
-PERL_CALLCONV OP *Perl_pp_readlink(pTHX);
-PERL_CALLCONV OP *Perl_pp_redo(pTHX);
-PERL_CALLCONV OP *Perl_pp_ref(pTHX);
-PERL_CALLCONV OP *Perl_pp_refgen(pTHX);
-PERL_CALLCONV OP *Perl_pp_regcomp(pTHX);
-PERL_CALLCONV OP *Perl_pp_regcreset(pTHX);
-PERL_CALLCONV OP *Perl_pp_rename(pTHX);
-PERL_CALLCONV OP *Perl_pp_repeat(pTHX);
-PERL_CALLCONV OP *Perl_pp_require(pTHX);
-PERL_CALLCONV OP *Perl_pp_reset(pTHX);
-PERL_CALLCONV OP *Perl_pp_return(pTHX);
-PERL_CALLCONV OP *Perl_pp_reverse(pTHX);
-PERL_CALLCONV OP *Perl_pp_rewinddir(pTHX);
-PERL_CALLCONV OP *Perl_pp_right_shift(pTHX);
-PERL_CALLCONV OP *Perl_pp_rkeys(pTHX);
-PERL_CALLCONV OP *Perl_pp_rmdir(pTHX);
-PERL_CALLCONV OP *Perl_pp_runcv(pTHX);
-PERL_CALLCONV OP *Perl_pp_rv2av(pTHX);
-PERL_CALLCONV OP *Perl_pp_rv2cv(pTHX);
-PERL_CALLCONV OP *Perl_pp_rv2gv(pTHX);
-PERL_CALLCONV OP *Perl_pp_rv2sv(pTHX);
-PERL_CALLCONV OP *Perl_pp_sassign(pTHX);
-PERL_CALLCONV OP *Perl_pp_schop(pTHX);
-PERL_CALLCONV OP *Perl_pp_scmp(pTHX);
-PERL_CALLCONV OP *Perl_pp_seekdir(pTHX);
-PERL_CALLCONV OP *Perl_pp_select(pTHX);
-PERL_CALLCONV OP *Perl_pp_semctl(pTHX);
-PERL_CALLCONV OP *Perl_pp_semget(pTHX);
-PERL_CALLCONV OP *Perl_pp_seq(pTHX);
-PERL_CALLCONV OP *Perl_pp_setpgrp(pTHX);
-PERL_CALLCONV OP *Perl_pp_setpriority(pTHX);
-PERL_CALLCONV OP *Perl_pp_shift(pTHX);
-PERL_CALLCONV OP *Perl_pp_shmwrite(pTHX);
-PERL_CALLCONV OP *Perl_pp_shostent(pTHX);
-PERL_CALLCONV OP *Perl_pp_shutdown(pTHX);
-PERL_CALLCONV OP *Perl_pp_sin(pTHX);
-PERL_CALLCONV OP *Perl_pp_sle(pTHX);
-PERL_CALLCONV OP *Perl_pp_sleep(pTHX);
-PERL_CALLCONV OP *Perl_pp_smartmatch(pTHX);
-PERL_CALLCONV OP *Perl_pp_sne(pTHX);
-PERL_CALLCONV OP *Perl_pp_socket(pTHX);
-PERL_CALLCONV OP *Perl_pp_sockpair(pTHX);
-PERL_CALLCONV OP *Perl_pp_sort(pTHX);
-PERL_CALLCONV OP *Perl_pp_splice(pTHX);
-PERL_CALLCONV OP *Perl_pp_split(pTHX);
-PERL_CALLCONV OP *Perl_pp_sprintf(pTHX);
-PERL_CALLCONV OP *Perl_pp_srand(pTHX);
-PERL_CALLCONV OP *Perl_pp_srefgen(pTHX);
-PERL_CALLCONV OP *Perl_pp_sselect(pTHX);
-PERL_CALLCONV OP *Perl_pp_ssockopt(pTHX);
-PERL_CALLCONV OP *Perl_pp_stat(pTHX);
-PERL_CALLCONV OP *Perl_pp_stringify(pTHX);
-PERL_CALLCONV OP *Perl_pp_stub(pTHX);
-PERL_CALLCONV OP *Perl_pp_study(pTHX);
-PERL_CALLCONV OP *Perl_pp_subst(pTHX);
-PERL_CALLCONV OP *Perl_pp_substcont(pTHX);
-PERL_CALLCONV OP *Perl_pp_substr(pTHX);
-PERL_CALLCONV OP *Perl_pp_subtract(pTHX);
-PERL_CALLCONV OP *Perl_pp_syscall(pTHX);
-PERL_CALLCONV OP *Perl_pp_sysopen(pTHX);
-PERL_CALLCONV OP *Perl_pp_sysread(pTHX);
-PERL_CALLCONV OP *Perl_pp_sysseek(pTHX);
-PERL_CALLCONV OP *Perl_pp_system(pTHX);
-PERL_CALLCONV OP *Perl_pp_syswrite(pTHX);
-PERL_CALLCONV OP *Perl_pp_tell(pTHX);
-PERL_CALLCONV OP *Perl_pp_telldir(pTHX);
-PERL_CALLCONV OP *Perl_pp_tie(pTHX);
-PERL_CALLCONV OP *Perl_pp_tied(pTHX);
-PERL_CALLCONV OP *Perl_pp_time(pTHX);
-PERL_CALLCONV OP *Perl_pp_tms(pTHX);
-PERL_CALLCONV OP *Perl_pp_trans(pTHX);
-PERL_CALLCONV OP *Perl_pp_truncate(pTHX);
-PERL_CALLCONV OP *Perl_pp_uc(pTHX);
-PERL_CALLCONV OP *Perl_pp_ucfirst(pTHX);
-PERL_CALLCONV OP *Perl_pp_umask(pTHX);
-PERL_CALLCONV OP *Perl_pp_undef(pTHX);
-PERL_CALLCONV OP *Perl_pp_unpack(pTHX);
-PERL_CALLCONV OP *Perl_pp_unshift(pTHX);
-PERL_CALLCONV OP *Perl_pp_unstack(pTHX);
-PERL_CALLCONV OP *Perl_pp_untie(pTHX);
-PERL_CALLCONV OP *Perl_pp_vec(pTHX);
-PERL_CALLCONV OP *Perl_pp_wait(pTHX);
-PERL_CALLCONV OP *Perl_pp_waitpid(pTHX);
-PERL_CALLCONV OP *Perl_pp_wantarray(pTHX);
-PERL_CALLCONV OP *Perl_pp_warn(pTHX);
-PERL_CALLCONV OP *Perl_pp_xor(pTHX);
-PERL_CALLCONV OP *Perl_unimplemented_op(pTHX);
-
-/* ex: set ro: */
+PPDEF(pp_null)
+PPDEF(pp_stub)
+PPDEF(pp_scalar)
+PPDEF(pp_pushmark)
+PPDEF(pp_wantarray)
+PPDEF(pp_const)
+PPDEF(pp_gvsv)
+PPDEF(pp_gv)
+PPDEF(pp_gelem)
+PPDEF(pp_padsv)
+PPDEF(pp_padav)
+PPDEF(pp_padhv)
+PPDEF(pp_padany)
+PPDEF(pp_pushre)
+PPDEF(pp_rv2gv)
+PPDEF(pp_rv2sv)
+PPDEF(pp_av2arylen)
+PPDEF(pp_rv2cv)
+PPDEF(pp_anoncode)
+PPDEF(pp_prototype)
+PPDEF(pp_refgen)
+PPDEF(pp_srefgen)
+PPDEF(pp_ref)
+PPDEF(pp_bless)
+PPDEF(pp_backtick)
+PPDEF(pp_glob)
+PPDEF(pp_readline)
+PPDEF(pp_rcatline)
+PPDEF(pp_regcmaybe)
+PPDEF(pp_regcreset)
+PPDEF(pp_regcomp)
+PPDEF(pp_match)
+PPDEF(pp_qr)
+PPDEF(pp_subst)
+PPDEF(pp_substcont)
+PPDEF(pp_trans)
+PPDEF(pp_sassign)
+PPDEF(pp_aassign)
+PPDEF(pp_chop)
+PPDEF(pp_schop)
+PPDEF(pp_chomp)
+PPDEF(pp_schomp)
+PPDEF(pp_defined)
+PPDEF(pp_undef)
+PPDEF(pp_study)
+PPDEF(pp_pos)
+PPDEF(pp_preinc)
+PPDEF(pp_predec)
+PPDEF(pp_postinc)
+PPDEF(pp_postdec)
+PPDEF(pp_pow)
+PPDEF(pp_multiply)
+PPDEF(pp_i_multiply)
+PPDEF(pp_divide)
+PPDEF(pp_i_divide)
+PPDEF(pp_modulo)
+PPDEF(pp_i_modulo)
+PPDEF(pp_repeat)
+PPDEF(pp_add)
+PPDEF(pp_i_add)
+PPDEF(pp_subtract)
+PPDEF(pp_i_subtract)
+PPDEF(pp_concat)
+PPDEF(pp_stringify)
+PPDEF(pp_left_shift)
+PPDEF(pp_right_shift)
+PPDEF(pp_lt)
+PPDEF(pp_i_lt)
+PPDEF(pp_gt)
+PPDEF(pp_i_gt)
+PPDEF(pp_le)
+PPDEF(pp_i_le)
+PPDEF(pp_ge)
+PPDEF(pp_i_ge)
+PPDEF(pp_eq)
+PPDEF(pp_i_eq)
+PPDEF(pp_ne)
+PPDEF(pp_i_ne)
+PPDEF(pp_ncmp)
+PPDEF(pp_i_ncmp)
+PPDEF(pp_slt)
+PPDEF(pp_sgt)
+PPDEF(pp_sle)
+PPDEF(pp_sge)
+PPDEF(pp_seq)
+PPDEF(pp_sne)
+PPDEF(pp_scmp)
+PPDEF(pp_bit_and)
+PPDEF(pp_bit_xor)
+PPDEF(pp_bit_or)
+PPDEF(pp_negate)
+PPDEF(pp_i_negate)
+PPDEF(pp_not)
+PPDEF(pp_complement)
+PPDEF(pp_atan2)
+PPDEF(pp_sin)
+PPDEF(pp_cos)
+PPDEF(pp_rand)
+PPDEF(pp_srand)
+PPDEF(pp_exp)
+PPDEF(pp_log)
+PPDEF(pp_sqrt)
+PPDEF(pp_int)
+PPDEF(pp_hex)
+PPDEF(pp_oct)
+PPDEF(pp_abs)
+PPDEF(pp_length)
+PPDEF(pp_substr)
+PPDEF(pp_vec)
+PPDEF(pp_index)
+PPDEF(pp_rindex)
+PPDEF(pp_sprintf)
+PPDEF(pp_formline)
+PPDEF(pp_ord)
+PPDEF(pp_chr)
+PPDEF(pp_crypt)
+PPDEF(pp_ucfirst)
+PPDEF(pp_lcfirst)
+PPDEF(pp_uc)
+PPDEF(pp_lc)
+PPDEF(pp_quotemeta)
+PPDEF(pp_rv2av)
+PPDEF(pp_aelemfast)
+PPDEF(pp_aelem)
+PPDEF(pp_aslice)
+PPDEF(pp_each)
+PPDEF(pp_values)
+PPDEF(pp_keys)
+PPDEF(pp_delete)
+PPDEF(pp_exists)
+PPDEF(pp_rv2hv)
+PPDEF(pp_helem)
+PPDEF(pp_hslice)
+PPDEF(pp_unpack)
+PPDEF(pp_pack)
+PPDEF(pp_split)
+PPDEF(pp_join)
+PPDEF(pp_list)
+PPDEF(pp_lslice)
+PPDEF(pp_anonlist)
+PPDEF(pp_anonhash)
+PPDEF(pp_splice)
+PPDEF(pp_push)
+PPDEF(pp_pop)
+PPDEF(pp_shift)
+PPDEF(pp_unshift)
+PPDEF(pp_sort)
+PPDEF(pp_reverse)
+PPDEF(pp_grepstart)
+PPDEF(pp_grepwhile)
+PPDEF(pp_mapstart)
+PPDEF(pp_mapwhile)
+PPDEF(pp_range)
+PPDEF(pp_flip)
+PPDEF(pp_flop)
+PPDEF(pp_and)
+PPDEF(pp_or)
+PPDEF(pp_xor)
+PPDEF(pp_cond_expr)
+PPDEF(pp_andassign)
+PPDEF(pp_orassign)
+PPDEF(pp_method)
+PPDEF(pp_entersub)
+PPDEF(pp_leavesub)
+PPDEF(pp_caller)
+PPDEF(pp_warn)
+PPDEF(pp_die)
+PPDEF(pp_reset)
+PPDEF(pp_lineseq)
+PPDEF(pp_nextstate)
+PPDEF(pp_dbstate)
+PPDEF(pp_unstack)
+PPDEF(pp_enter)
+PPDEF(pp_leave)
+PPDEF(pp_scope)
+PPDEF(pp_enteriter)
+PPDEF(pp_iter)
+PPDEF(pp_enterloop)
+PPDEF(pp_leaveloop)
+PPDEF(pp_return)
+PPDEF(pp_last)
+PPDEF(pp_next)
+PPDEF(pp_redo)
+PPDEF(pp_dump)
+PPDEF(pp_goto)
+PPDEF(pp_exit)
+PPDEF(pp_open)
+PPDEF(pp_close)
+PPDEF(pp_pipe_op)
+PPDEF(pp_fileno)
+PPDEF(pp_umask)
+PPDEF(pp_binmode)
+PPDEF(pp_tie)
+PPDEF(pp_untie)
+PPDEF(pp_tied)
+PPDEF(pp_dbmopen)
+PPDEF(pp_dbmclose)
+PPDEF(pp_sselect)
+PPDEF(pp_select)
+PPDEF(pp_getc)
+PPDEF(pp_read)
+PPDEF(pp_enterwrite)
+PPDEF(pp_leavewrite)
+PPDEF(pp_prtf)
+PPDEF(pp_print)
+PPDEF(pp_sysopen)
+PPDEF(pp_sysseek)
+PPDEF(pp_sysread)
+PPDEF(pp_syswrite)
+PPDEF(pp_send)
+PPDEF(pp_recv)
+PPDEF(pp_eof)
+PPDEF(pp_tell)
+PPDEF(pp_seek)
+PPDEF(pp_truncate)
+PPDEF(pp_fcntl)
+PPDEF(pp_ioctl)
+PPDEF(pp_flock)
+PPDEF(pp_socket)
+PPDEF(pp_sockpair)
+PPDEF(pp_bind)
+PPDEF(pp_connect)
+PPDEF(pp_listen)
+PPDEF(pp_accept)
+PPDEF(pp_shutdown)
+PPDEF(pp_gsockopt)
+PPDEF(pp_ssockopt)
+PPDEF(pp_getsockname)
+PPDEF(pp_getpeername)
+PPDEF(pp_lstat)
+PPDEF(pp_stat)
+PPDEF(pp_ftrread)
+PPDEF(pp_ftrwrite)
+PPDEF(pp_ftrexec)
+PPDEF(pp_fteread)
+PPDEF(pp_ftewrite)
+PPDEF(pp_fteexec)
+PPDEF(pp_ftis)
+PPDEF(pp_fteowned)
+PPDEF(pp_ftrowned)
+PPDEF(pp_ftzero)
+PPDEF(pp_ftsize)
+PPDEF(pp_ftmtime)
+PPDEF(pp_ftatime)
+PPDEF(pp_ftctime)
+PPDEF(pp_ftsock)
+PPDEF(pp_ftchr)
+PPDEF(pp_ftblk)
+PPDEF(pp_ftfile)
+PPDEF(pp_ftdir)
+PPDEF(pp_ftpipe)
+PPDEF(pp_ftlink)
+PPDEF(pp_ftsuid)
+PPDEF(pp_ftsgid)
+PPDEF(pp_ftsvtx)
+PPDEF(pp_fttty)
+PPDEF(pp_fttext)
+PPDEF(pp_ftbinary)
+PPDEF(pp_chdir)
+PPDEF(pp_chown)
+PPDEF(pp_chroot)
+PPDEF(pp_unlink)
+PPDEF(pp_chmod)
+PPDEF(pp_utime)
+PPDEF(pp_rename)
+PPDEF(pp_link)
+PPDEF(pp_symlink)
+PPDEF(pp_readlink)
+PPDEF(pp_mkdir)
+PPDEF(pp_rmdir)
+PPDEF(pp_open_dir)
+PPDEF(pp_readdir)
+PPDEF(pp_telldir)
+PPDEF(pp_seekdir)
+PPDEF(pp_rewinddir)
+PPDEF(pp_closedir)
+PPDEF(pp_fork)
+PPDEF(pp_wait)
+PPDEF(pp_waitpid)
+PPDEF(pp_system)
+PPDEF(pp_exec)
+PPDEF(pp_kill)
+PPDEF(pp_getppid)
+PPDEF(pp_getpgrp)
+PPDEF(pp_setpgrp)
+PPDEF(pp_getpriority)
+PPDEF(pp_setpriority)
+PPDEF(pp_time)
+PPDEF(pp_tms)
+PPDEF(pp_localtime)
+PPDEF(pp_gmtime)
+PPDEF(pp_alarm)
+PPDEF(pp_sleep)
+PPDEF(pp_shmget)
+PPDEF(pp_shmctl)
+PPDEF(pp_shmread)
+PPDEF(pp_shmwrite)
+PPDEF(pp_msgget)
+PPDEF(pp_msgctl)
+PPDEF(pp_msgsnd)
+PPDEF(pp_msgrcv)
+PPDEF(pp_semget)
+PPDEF(pp_semctl)
+PPDEF(pp_semop)
+PPDEF(pp_require)
+PPDEF(pp_dofile)
+PPDEF(pp_entereval)
+PPDEF(pp_leaveeval)
+PPDEF(pp_entertry)
+PPDEF(pp_leavetry)
+PPDEF(pp_ghbyname)
+PPDEF(pp_ghbyaddr)
+PPDEF(pp_ghostent)
+PPDEF(pp_gnbyname)
+PPDEF(pp_gnbyaddr)
+PPDEF(pp_gnetent)
+PPDEF(pp_gpbyname)
+PPDEF(pp_gpbynumber)
+PPDEF(pp_gprotoent)
+PPDEF(pp_gsbyname)
+PPDEF(pp_gsbyport)
+PPDEF(pp_gservent)
+PPDEF(pp_shostent)
+PPDEF(pp_snetent)
+PPDEF(pp_sprotoent)
+PPDEF(pp_sservent)
+PPDEF(pp_ehostent)
+PPDEF(pp_enetent)
+PPDEF(pp_eprotoent)
+PPDEF(pp_eservent)
+PPDEF(pp_gpwnam)
+PPDEF(pp_gpwuid)
+PPDEF(pp_gpwent)
+PPDEF(pp_spwent)
+PPDEF(pp_epwent)
+PPDEF(pp_ggrnam)
+PPDEF(pp_ggrgid)
+PPDEF(pp_ggrent)
+PPDEF(pp_sgrent)
+PPDEF(pp_egrent)
+PPDEF(pp_getlogin)
+PPDEF(pp_syscall)
+PPDEF(pp_lock)
+PPDEF(pp_threadsv)
diff --git a/gnu/usr.bin/perl/regcomp.sym b/gnu/usr.bin/perl/regcomp.sym
index bea2a8e7162..9775b9374da 100644
--- a/gnu/usr.bin/perl/regcomp.sym
+++ b/gnu/usr.bin/perl/regcomp.sym
@@ -1,255 +1,112 @@
-# regcomp.sym
+# Format:
+# NAME \t TYPE, arg-description [num-args] [longjump-len] \t DESCRIPTION
+
+# Empty rows and #-comment rows are ignored.
+
+# Exit points
+END END, no End of program.
+SUCCEED END, no Return from a subroutine, basically.
+
+# Anchors:
+BOL BOL, no Match "" at beginning of line.
+MBOL BOL, no Same, assuming multiline.
+SBOL BOL, no Same, assuming singleline.
+EOS EOL, no Match "" at end of string.
+EOL EOL, no Match "" at end of line.
+MEOL EOL, no Same, assuming multiline.
+SEOL EOL, no Same, assuming singleline.
+BOUND BOUND, no Match "" at any word boundary
+BOUNDL BOUND, no Match "" at any word boundary
+NBOUND NBOUND, no Match "" at any word non-boundary
+NBOUNDL NBOUND, no Match "" at any word non-boundary
+GPOS GPOS, no Matches where last m//g left off.
+
+# [Special] alternatives
+ANY ANY, no Match any one character (except newline).
+SANY ANY, no Match any one character.
+ANYOF ANYOF, sv Match character in (or not in) this class.
+ALNUM ALNUM, no Match any alphanumeric character
+ALNUML ALNUM, no Match any alphanumeric char in locale
+NALNUM NALNUM, no Match any non-alphanumeric character
+NALNUML NALNUM, no Match any non-alphanumeric char in locale
+SPACE SPACE, no Match any whitespace character
+SPACEL SPACE, no Match any whitespace char in locale
+NSPACE NSPACE, no Match any non-whitespace character
+NSPACEL NSPACE, no Match any non-whitespace char in locale
+DIGIT DIGIT, no Match any numeric character
+NDIGIT NDIGIT, no Match any non-numeric character
+
+# BRANCH The set of branches constituting a single choice are hooked
+# together with their "next" pointers, since precedence prevents
+# anything being concatenated to any individual branch. The
+# "next" pointer of the last BRANCH in a choice points to the
+# thing following the whole choice. This is also where the
+# final "next" pointer of each individual branch points; each
+# branch starts with the operand node of a BRANCH node.
#
-# File has two sections, divided by a line of dashes '-'.
+BRANCH BRANCH, node Match this alternative, or the next...
+
+# BACK Normal "next" pointers all implicitly point forward; BACK
+# exists to make loop structures possible.
+# not used
+BACK BACK, no Match "", "next" ptr points backward.
+
+# Literals
+EXACT EXACT, sv Match this string (preceded by length).
+EXACTF EXACT, sv Match this string, folded (prec. by length).
+EXACTFL EXACT, sv Match this string, folded in locale (w/len).
+
+# Do nothing
+NOTHING NOTHING,no Match empty string.
+# A variant of above which delimits a group, thus stops optimizations
+TAIL NOTHING,no Match empty string. Can jump here from outside.
+
+# STAR,PLUS '?', and complex '*' and '+', are implemented as circular
+# BRANCH structures using BACK. Simple cases (one character
+# per match) are implemented with STAR and PLUS for speed
+# and to minimize recursive plunges.
#
-# Lines beginning with # are ignored, except for those that start with #*
-# which are included in pod/perldebguts.pod. # within a line may be part
-# of a description.
-#
-# First section is for regops, second section is for regmatch-states
-#
-# Note that the order in this file is important.
-#
-# Format for first section:
-# NAME \s+ TYPE, arg-description [num-args] [flags] [longjump-len] ; DESCRIPTION
-# flag <S> means is REGNODE_SIMPLE; flag <V> means is REGNODE_VARIES
-#
-#
-# run perl regen.pl after editing this file
-
-
-
-#* Exit points
-
-END END, no ; End of program.
-SUCCEED END, no ; Return from a subroutine, basically.
-
-#* Anchors:
-
-BOL BOL, no ; Match "" at beginning of line.
-MBOL BOL, no ; Same, assuming multiline.
-SBOL BOL, no ; Same, assuming singleline.
-EOS EOL, no ; Match "" at end of string.
-EOL EOL, no ; Match "" at end of line.
-MEOL EOL, no ; Same, assuming multiline.
-SEOL EOL, no ; Same, assuming singleline.
-# The regops that have varieties that vary depending on the character set regex
-# modifiers have to ordered thusly: /d, /l, /u, /a, /aa. This is because code
-# in regcomp.c uses the enum value of the modifier as an offset from the /d
-# version. The complements must come after the non-complements.
-# BOUND, POSIX and their complements are affected, as well as EXACTF.
-BOUND BOUND, no ; Match "" at any word boundary using native charset rules for non-utf8
-BOUNDL BOUND, no ; Match "" at any locale word boundary
-BOUNDU BOUND, no ; Match "" at any word boundary using Unicode rules
-BOUNDA BOUND, no ; Match "" at any word boundary using ASCII rules
-# All NBOUND nodes are required by code in regexec.c to be greater than all BOUND ones
-NBOUND NBOUND, no ; Match "" at any word non-boundary using native charset rules for non-utf8
-NBOUNDL NBOUND, no ; Match "" at any locale word non-boundary
-NBOUNDU NBOUND, no ; Match "" at any word non-boundary using Unicode rules
-NBOUNDA NBOUND, no ; Match "" at any word non-boundary using ASCII rules
-GPOS GPOS, no ; Matches where last m//g left off.
-
-#* [Special] alternatives:
-
-REG_ANY REG_ANY, no 0 S ; Match any one character (except newline).
-SANY REG_ANY, no 0 S ; Match any one character.
-CANY REG_ANY, no 0 S ; Match any one byte.
-ANYOF ANYOF, sv 0 S ; Match character in (or not in) this class, single char match only
-
-# Order of the below is important. See ordering comment above.
-POSIXD POSIXD, none 0 S ; Some [[:class:]] under /d; the FLAGS field gives which one
-POSIXL POSIXD, none 0 S ; Some [[:class:]] under /l; the FLAGS field gives which one
-POSIXU POSIXD, none 0 S ; Some [[:class:]] under /u; the FLAGS field gives which one
-POSIXA POSIXD, none 0 S ; Some [[:class:]] under /a; the FLAGS field gives which one
-NPOSIXD NPOSIXD, none 0 S ; complement of POSIXD, [[:^class:]]
-NPOSIXL NPOSIXD, none 0 S ; complement of POSIXL, [[:^class:]]
-NPOSIXU NPOSIXD, none 0 S ; complement of POSIXU, [[:^class:]]
-NPOSIXA NPOSIXD, none 0 S ; complement of POSIXA, [[:^class:]]
-# End of order is important
-
-CLUMP CLUMP, no 0 V ; Match any extended grapheme cluster sequence
-
-#* Alternation
-
-#* BRANCH The set of branches constituting a single choice are
-#* hooked together with their "next" pointers, since
-#* precedence prevents anything being concatenated to
-#* any individual branch. The "next" pointer of the last
-#* BRANCH in a choice points to the thing following the
-#* whole choice. This is also where the final "next"
-#* pointer of each individual branch points; each branch
-#* starts with the operand node of a BRANCH node.
-#*
-BRANCH BRANCH, node 0 V ; Match this alternative, or the next...
-
-#*Back pointer
-
-#* BACK Normal "next" pointers all implicitly point forward;
-#* BACK exists to make loop structures possible.
-#* not used
-BACK BACK, no 0 V ; Match "", "next" ptr points backward.
-
-#*Literals
-# NOTE: the relative ordering of these types is important do not change it
-
-EXACT EXACT, str ; Match this string (preceded by length).
-EXACTF EXACT, str ; Match this non-UTF-8 string (not guaranteed to be folded) using /id rules (w/len).
-EXACTFL EXACT, str ; Match this string (not guaranteed to be folded) using /il rules (w/len).
-EXACTFU EXACT, str ; Match this string (folded iff in UTF-8, length in folding doesn't change if not in UTF-8) using /iu rules (w/len).
-EXACTFA EXACT, str ; Match this string (not guaranteed to be folded) using /iaa rules (w/len).
-EXACTFU_SS EXACT, str ; Match this string (folded iff in UTF-8, length in folding may change even if not in UTF-8) using /iu rules (w/len).
-EXACTFA_NO_TRIE EXACT, str ; Match this string (which is not trie-able; not guaranteed to be folded) using /iaa rules (w/len).
-
-#*Do nothing types
-
-NOTHING NOTHING, no ; Match empty string.
-#*A variant of above which delimits a group, thus stops optimizations
-TAIL NOTHING, no ; Match empty string. Can jump here from outside.
-
-#*Loops
-
-#* STAR,PLUS '?', and complex '*' and '+', are implemented as
-#* circular BRANCH structures using BACK. Simple cases
-#* (one character per match) are implemented with STAR
-#* and PLUS for speed and to minimize recursive plunges.
-#*
-STAR STAR, node 0 V ; Match this (simple) thing 0 or more times.
-PLUS PLUS, node 0 V ; Match this (simple) thing 1 or more times.
-
-CURLY CURLY, sv 2 V ; Match this simple thing {n,m} times.
-CURLYN CURLY, no 2 V ; Capture next-after-this simple thing
-CURLYM CURLY, no 2 V ; Capture this medium-complex thing {n,m} times.
-CURLYX CURLY, sv 2 V ; Match this complex thing {n,m} times.
-
-#*This terminator creates a loop structure for CURLYX
-WHILEM WHILEM, no 0 V ; Do curly processing and see if rest matches.
-
-#*Buffer related
-
-#*OPEN,CLOSE,GROUPP ...are numbered at compile time.
-OPEN OPEN, num 1 ; Mark this point in input as start of #n.
-CLOSE CLOSE, num 1 ; Analogous to OPEN.
-
-REF REF, num 1 V ; Match some already matched string
-REFF REF, num 1 V ; Match already matched string, folded using native charset rules for non-utf8
-REFFL REF, num 1 V ; Match already matched string, folded in loc.
-# N?REFF[AU] could have been implemented using the FLAGS field of the
-# regnode, but by having a separate node type, we can use the existing switch
-# statement to avoid some tests
-REFFU REF, num 1 V ; Match already matched string, folded using unicode rules for non-utf8
-REFFA REF, num 1 V ; Match already matched string, folded using unicode rules for non-utf8, no mixing ASCII, non-ASCII
-
-#*Named references. Code in regcomp.c assumes that these all are after
-#*the numbered references
-NREF REF, no-sv 1 V ; Match some already matched string
-NREFF REF, no-sv 1 V ; Match already matched string, folded using native charset rules for non-utf8
-NREFFL REF, no-sv 1 V ; Match already matched string, folded in loc.
-NREFFU REF, num 1 V ; Match already matched string, folded using unicode rules for non-utf8
-NREFFA REF, num 1 V ; Match already matched string, folded using unicode rules for non-utf8, no mixing ASCII, non-ASCII
-
-IFMATCH BRANCHJ, off 1 . 2 ; Succeeds if the following matches.
-UNLESSM BRANCHJ, off 1 . 2 ; Fails if the following matches.
-SUSPEND BRANCHJ, off 1 V 1 ; "Independent" sub-RE.
-IFTHEN BRANCHJ, off 1 V 1 ; Switch, should be preceded by switcher.
-GROUPP GROUPP, num 1 ; Whether the group matched.
-
-#*Support for long RE
-
-LONGJMP LONGJMP, off 1 . 1 ; Jump far away.
-BRANCHJ BRANCHJ, off 1 V 1 ; BRANCH with long offset.
-
-#*The heavy worker
-
-EVAL EVAL, evl 1 ; Execute some Perl code.
-
-#*Modifiers
-
-MINMOD MINMOD, no ; Next operator is not greedy.
-LOGICAL LOGICAL, no ; Next opcode should set the flag only.
-
-#*This is not used yet
-RENUM BRANCHJ, off 1 . 1 ; Group with independently numbered parens.
-
-#*Trie Related
-
-#* Behave the same as A|LIST|OF|WORDS would. The '..C' variants
-#* have inline charclass data (ascii only), the 'C' store it in the
-#* structure.
-# NOTE: the relative order of the TRIE-like regops is significant
-
-TRIE TRIE, trie 1 ; Match many EXACT(F[ALU]?)? at once. flags==type
-TRIEC TRIE,trie charclass ; Same as TRIE, but with embedded charclass data
-
-# For start classes, contains an added fail table.
-AHOCORASICK TRIE, trie 1 ; Aho Corasick stclass. flags==type
-AHOCORASICKC TRIE,trie charclass ; Same as AHOCORASICK, but with embedded charclass data
-
-#*Regex Subroutines
-GOSUB GOSUB, num/ofs 2L ; recurse to paren arg1 at (signed) ofs arg2
-GOSTART GOSTART, no ; recurse to start of pattern
-
-#*Special conditionals
-NGROUPP NGROUPP, no-sv 1 ; Whether the group matched.
-INSUBP INSUBP, num 1 ; Whether we are in a specific recurse.
-DEFINEP DEFINEP, none 1 ; Never execute directly.
-
-#*Backtracking Verbs
-ENDLIKE ENDLIKE, none ; Used only for the type field of verbs
-OPFAIL ENDLIKE, none ; Same as (?!)
-ACCEPT ENDLIKE, parno 1 ; Accepts the current matched string.
-
-
-#*Verbs With Arguments
-VERB VERB, no-sv 1 ; Used only for the type field of verbs
-PRUNE VERB, no-sv 1 ; Pattern fails at this startpoint if no-backtracking through this
-MARKPOINT VERB, no-sv 1 ; Push the current location for rollback by cut.
-SKIP VERB, no-sv 1 ; On failure skip forward (to the mark) before retrying
-COMMIT VERB, no-sv 1 ; Pattern fails outright if backtracking through this
-CUTGROUP VERB, no-sv 1 ; On failure go to the next alternation in the group
-
-#*Control what to keep in $&.
-KEEPS KEEPS, no ; $& begins here.
-
-#*New charclass like patterns
-LNBREAK LNBREAK, none ; generic newline pattern
-
-# NEW STUFF SOMEWHERE ABOVE THIS LINE
-
-################################################################################
-
-#*SPECIAL REGOPS
-
-#* This is not really a node, but an optimized away piece of a "long"
-#* node. To simplify debugging output, we mark it as if it were a node
-OPTIMIZED NOTHING, off ; Placeholder for dump.
-
-#* Special opcode with the property that no opcode in a compiled program
-#* will ever be of this type. Thus it can be used as a flag value that
-#* no other opcode has been seen. END is used similarly, in that an END
-#* node cant be optimized. So END implies "unoptimizable" and PSEUDO
-#* mean "not seen anything to optimize yet".
-PSEUDO PSEUDO, off ; Pseudo opcode for internal use.
-
--------------------------------------------------------------------------------
-# Format for second section:
-# REGOP \t typelist [ \t typelist]
-# typelist= namelist
-# = namelist:FAIL
-# = name:count
-
-# Anything below is a state
-#
-#
-TRIE next:FAIL
-EVAL AB:FAIL
-CURLYX end:FAIL
-WHILEM A_pre,A_min,A_max,B_min,B_max:FAIL
-BRANCH next:FAIL
-CURLYM A,B:FAIL
-IFMATCH A:FAIL
-CURLY B_min_known,B_min,B_max:FAIL
-COMMIT next:FAIL
-MARKPOINT next:FAIL
-SKIP next:FAIL
-CUTGROUP next:FAIL
-KEEPS next:FAIL
+STAR STAR, node Match this (simple) thing 0 or more times.
+PLUS PLUS, node Match this (simple) thing 1 or more times.
+
+CURLY CURLY, sv 2 Match this simple thing {n,m} times.
+CURLYN CURLY, no 2 Match next-after-this simple thing
+# {n,m} times, set parenths.
+CURLYM CURLY, no 2 Match this medium-complex thing {n,m} times.
+CURLYX CURLY, sv 2 Match this complex thing {n,m} times.
+
+# This terminator creates a loop structure for CURLYX
+WHILEM WHILEM, no Do curly processing and see if rest matches.
+
+# OPEN,CLOSE,GROUPP ...are numbered at compile time.
+OPEN OPEN, num 1 Mark this point in input as start of #n.
+CLOSE CLOSE, num 1 Analogous to OPEN.
+
+REF REF, num 1 Match some already matched string
+REFF REF, num 1 Match already matched string, folded
+REFFL REF, num 1 Match already matched string, folded in loc.
+
+# grouping assertions
+IFMATCH BRANCHJ,off 1 2 Succeeds if the following matches.
+UNLESSM BRANCHJ,off 1 2 Fails if the following matches.
+SUSPEND BRANCHJ,off 1 1 "Independent" sub-RE.
+IFTHEN BRANCHJ,off 1 1 Switch, should be preceeded by switcher .
+GROUPP GROUPP, num 1 Whether the group matched.
+
+# Support for long RE
+LONGJMP LONGJMP,off 1 1 Jump far away.
+BRANCHJ BRANCHJ,off 1 1 BRANCH with long offset.
+
+# The heavy worker
+EVAL EVAL, evl 1 Execute some Perl code.
+
+# Modifiers
+MINMOD MINMOD, no Next operator is not greedy.
+LOGICAL LOGICAL,no Next opcode should set the flag only.
+
+# This is not used yet
+RENUM BRANCHJ,off 1 1 Group with independently numbered parens.
+
+# This is not really a node, but an optimized away piece of a "long" node.
+# To simplify debugging output, we mark it as if it were a node
+OPTIMIZED NOTHING,off Placeholder for dump.
diff --git a/gnu/usr.bin/perl/regnodes.h b/gnu/usr.bin/perl/regnodes.h
index 43ec681967c..c494daed12b 100644
--- a/gnu/usr.bin/perl/regnodes.h
+++ b/gnu/usr.bin/perl/regnodes.h
@@ -1,754 +1,254 @@
-/* -*- buffer-read-only: t -*-
- !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
- This file is built by regen/regcomp.pl from regcomp.sym.
+/* !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
+ This file is built by regcomp.pl from regcomp.sym.
Any changes made here will be lost!
- */
-
-/* Regops and State definitions */
-
-#define REGNODE_MAX 93
-#define REGMATCH_STATE_MAX 133
-
-#define END 0 /* 0000 End of program. */
-#define SUCCEED 1 /* 0x01 Return from a subroutine, basically. */
-#define BOL 2 /* 0x02 Match "" at beginning of line. */
-#define MBOL 3 /* 0x03 Same, assuming multiline. */
-#define SBOL 4 /* 0x04 Same, assuming singleline. */
-#define EOS 5 /* 0x05 Match "" at end of string. */
-#define EOL 6 /* 0x06 Match "" at end of line. */
-#define MEOL 7 /* 0x07 Same, assuming multiline. */
-#define SEOL 8 /* 0x08 Same, assuming singleline. */
-#define BOUND 9 /* 0x09 Match "" at any word boundary using native charset rules for non-utf8 */
-#define BOUNDL 10 /* 0x0a Match "" at any locale word boundary */
-#define BOUNDU 11 /* 0x0b Match "" at any word boundary using Unicode rules */
-#define BOUNDA 12 /* 0x0c Match "" at any word boundary using ASCII rules */
-#define NBOUND 13 /* 0x0d Match "" at any word non-boundary using native charset rules for non-utf8 */
-#define NBOUNDL 14 /* 0x0e Match "" at any locale word non-boundary */
-#define NBOUNDU 15 /* 0x0f Match "" at any word non-boundary using Unicode rules */
-#define NBOUNDA 16 /* 0x10 Match "" at any word non-boundary using ASCII rules */
-#define GPOS 17 /* 0x11 Matches where last m//g left off. */
-#define REG_ANY 18 /* 0x12 Match any one character (except newline). */
-#define SANY 19 /* 0x13 Match any one character. */
-#define CANY 20 /* 0x14 Match any one byte. */
-#define ANYOF 21 /* 0x15 Match character in (or not in) this class, single char match only */
-#define POSIXD 22 /* 0x16 Some [[:class:]] under /d; the FLAGS field gives which one */
-#define POSIXL 23 /* 0x17 Some [[:class:]] under /l; the FLAGS field gives which one */
-#define POSIXU 24 /* 0x18 Some [[:class:]] under /u; the FLAGS field gives which one */
-#define POSIXA 25 /* 0x19 Some [[:class:]] under /a; the FLAGS field gives which one */
-#define NPOSIXD 26 /* 0x1a complement of POSIXD, [[:^class:]] */
-#define NPOSIXL 27 /* 0x1b complement of POSIXL, [[:^class:]] */
-#define NPOSIXU 28 /* 0x1c complement of POSIXU, [[:^class:]] */
-#define NPOSIXA 29 /* 0x1d complement of POSIXA, [[:^class:]] */
-#define CLUMP 30 /* 0x1e Match any extended grapheme cluster sequence */
-#define BRANCH 31 /* 0x1f Match this alternative, or the next... */
-#define BACK 32 /* 0x20 Match "", "next" ptr points backward. */
-#define EXACT 33 /* 0x21 Match this string (preceded by length). */
-#define EXACTF 34 /* 0x22 Match this non-UTF-8 string (not guaranteed to be folded) using /id rules (w/len). */
-#define EXACTFL 35 /* 0x23 Match this string (not guaranteed to be folded) using /il rules (w/len). */
-#define EXACTFU 36 /* 0x24 Match this string (folded iff in UTF-8, length in folding doesn't change if not in UTF-8) using /iu rules (w/len). */
-#define EXACTFA 37 /* 0x25 Match this string (not guaranteed to be folded) using /iaa rules (w/len). */
-#define EXACTFU_SS 38 /* 0x26 Match this string (folded iff in UTF-8, length in folding may change even if not in UTF-8) using /iu rules (w/len). */
-#define EXACTFA_NO_TRIE 39 /* 0x27 Match this string (which is not trie-able; not guaranteed to be folded) using /iaa rules (w/len). */
-#define NOTHING 40 /* 0x28 Match empty string. */
-#define TAIL 41 /* 0x29 Match empty string. Can jump here from outside. */
-#define STAR 42 /* 0x2a Match this (simple) thing 0 or more times. */
-#define PLUS 43 /* 0x2b Match this (simple) thing 1 or more times. */
-#define CURLY 44 /* 0x2c Match this simple thing {n,m} times. */
-#define CURLYN 45 /* 0x2d Capture next-after-this simple thing */
-#define CURLYM 46 /* 0x2e Capture this medium-complex thing {n,m} times. */
-#define CURLYX 47 /* 0x2f Match this complex thing {n,m} times. */
-#define WHILEM 48 /* 0x30 Do curly processing and see if rest matches. */
-#define OPEN 49 /* 0x31 Mark this point in input as start of #n. */
-#define CLOSE 50 /* 0x32 Analogous to OPEN. */
-#define REF 51 /* 0x33 Match some already matched string */
-#define REFF 52 /* 0x34 Match already matched string, folded using native charset rules for non-utf8 */
-#define REFFL 53 /* 0x35 Match already matched string, folded in loc. */
-#define REFFU 54 /* 0x36 Match already matched string, folded using unicode rules for non-utf8 */
-#define REFFA 55 /* 0x37 Match already matched string, folded using unicode rules for non-utf8, no mixing ASCII, non-ASCII */
-#define NREF 56 /* 0x38 Match some already matched string */
-#define NREFF 57 /* 0x39 Match already matched string, folded using native charset rules for non-utf8 */
-#define NREFFL 58 /* 0x3a Match already matched string, folded in loc. */
-#define NREFFU 59 /* 0x3b Match already matched string, folded using unicode rules for non-utf8 */
-#define NREFFA 60 /* 0x3c Match already matched string, folded using unicode rules for non-utf8, no mixing ASCII, non-ASCII */
-#define IFMATCH 61 /* 0x3d Succeeds if the following matches. */
-#define UNLESSM 62 /* 0x3e Fails if the following matches. */
-#define SUSPEND 63 /* 0x3f "Independent" sub-RE. */
-#define IFTHEN 64 /* 0x40 Switch, should be preceded by switcher. */
-#define GROUPP 65 /* 0x41 Whether the group matched. */
-#define LONGJMP 66 /* 0x42 Jump far away. */
-#define BRANCHJ 67 /* 0x43 BRANCH with long offset. */
-#define EVAL 68 /* 0x44 Execute some Perl code. */
-#define MINMOD 69 /* 0x45 Next operator is not greedy. */
-#define LOGICAL 70 /* 0x46 Next opcode should set the flag only. */
-#define RENUM 71 /* 0x47 Group with independently numbered parens. */
-#define TRIE 72 /* 0x48 Match many EXACT(F[ALU]?)? at once. flags==type */
-#define TRIEC 73 /* 0x49 Same as TRIE, but with embedded charclass data */
-#define AHOCORASICK 74 /* 0x4a Aho Corasick stclass. flags==type */
-#define AHOCORASICKC 75 /* 0x4b Same as AHOCORASICK, but with embedded charclass data */
-#define GOSUB 76 /* 0x4c recurse to paren arg1 at (signed) ofs arg2 */
-#define GOSTART 77 /* 0x4d recurse to start of pattern */
-#define NGROUPP 78 /* 0x4e Whether the group matched. */
-#define INSUBP 79 /* 0x4f Whether we are in a specific recurse. */
-#define DEFINEP 80 /* 0x50 Never execute directly. */
-#define ENDLIKE 81 /* 0x51 Used only for the type field of verbs */
-#define OPFAIL 82 /* 0x52 Same as (?!) */
-#define ACCEPT 83 /* 0x53 Accepts the current matched string. */
-#define VERB 84 /* 0x54 Used only for the type field of verbs */
-#define PRUNE 85 /* 0x55 Pattern fails at this startpoint if no-backtracking through this */
-#define MARKPOINT 86 /* 0x56 Push the current location for rollback by cut. */
-#define SKIP 87 /* 0x57 On failure skip forward (to the mark) before retrying */
-#define COMMIT 88 /* 0x58 Pattern fails outright if backtracking through this */
-#define CUTGROUP 89 /* 0x59 On failure go to the next alternation in the group */
-#define KEEPS 90 /* 0x5a $& begins here. */
-#define LNBREAK 91 /* 0x5b generic newline pattern */
-#define OPTIMIZED 92 /* 0x5c Placeholder for dump. */
-#define PSEUDO 93 /* 0x5d Pseudo opcode for internal use. */
- /* ------------ States ------------- */
-#define TRIE_next (REGNODE_MAX + 1) /* state for TRIE */
-#define TRIE_next_fail (REGNODE_MAX + 2) /* state for TRIE */
-#define EVAL_AB (REGNODE_MAX + 3) /* state for EVAL */
-#define EVAL_AB_fail (REGNODE_MAX + 4) /* state for EVAL */
-#define CURLYX_end (REGNODE_MAX + 5) /* state for CURLYX */
-#define CURLYX_end_fail (REGNODE_MAX + 6) /* state for CURLYX */
-#define WHILEM_A_pre (REGNODE_MAX + 7) /* state for WHILEM */
-#define WHILEM_A_pre_fail (REGNODE_MAX + 8) /* state for WHILEM */
-#define WHILEM_A_min (REGNODE_MAX + 9) /* state for WHILEM */
-#define WHILEM_A_min_fail (REGNODE_MAX + 10) /* state for WHILEM */
-#define WHILEM_A_max (REGNODE_MAX + 11) /* state for WHILEM */
-#define WHILEM_A_max_fail (REGNODE_MAX + 12) /* state for WHILEM */
-#define WHILEM_B_min (REGNODE_MAX + 13) /* state for WHILEM */
-#define WHILEM_B_min_fail (REGNODE_MAX + 14) /* state for WHILEM */
-#define WHILEM_B_max (REGNODE_MAX + 15) /* state for WHILEM */
-#define WHILEM_B_max_fail (REGNODE_MAX + 16) /* state for WHILEM */
-#define BRANCH_next (REGNODE_MAX + 17) /* state for BRANCH */
-#define BRANCH_next_fail (REGNODE_MAX + 18) /* state for BRANCH */
-#define CURLYM_A (REGNODE_MAX + 19) /* state for CURLYM */
-#define CURLYM_A_fail (REGNODE_MAX + 20) /* state for CURLYM */
-#define CURLYM_B (REGNODE_MAX + 21) /* state for CURLYM */
-#define CURLYM_B_fail (REGNODE_MAX + 22) /* state for CURLYM */
-#define IFMATCH_A (REGNODE_MAX + 23) /* state for IFMATCH */
-#define IFMATCH_A_fail (REGNODE_MAX + 24) /* state for IFMATCH */
-#define CURLY_B_min_known (REGNODE_MAX + 25) /* state for CURLY */
-#define CURLY_B_min_known_fail (REGNODE_MAX + 26) /* state for CURLY */
-#define CURLY_B_min (REGNODE_MAX + 27) /* state for CURLY */
-#define CURLY_B_min_fail (REGNODE_MAX + 28) /* state for CURLY */
-#define CURLY_B_max (REGNODE_MAX + 29) /* state for CURLY */
-#define CURLY_B_max_fail (REGNODE_MAX + 30) /* state for CURLY */
-#define COMMIT_next (REGNODE_MAX + 31) /* state for COMMIT */
-#define COMMIT_next_fail (REGNODE_MAX + 32) /* state for COMMIT */
-#define MARKPOINT_next (REGNODE_MAX + 33) /* state for MARKPOINT */
-#define MARKPOINT_next_fail (REGNODE_MAX + 34) /* state for MARKPOINT */
-#define SKIP_next (REGNODE_MAX + 35) /* state for SKIP */
-#define SKIP_next_fail (REGNODE_MAX + 36) /* state for SKIP */
-#define CUTGROUP_next (REGNODE_MAX + 37) /* state for CUTGROUP */
-#define CUTGROUP_next_fail (REGNODE_MAX + 38) /* state for CUTGROUP */
-#define KEEPS_next (REGNODE_MAX + 39) /* state for KEEPS */
-#define KEEPS_next_fail (REGNODE_MAX + 40) /* state for KEEPS */
-
-/* PL_regkind[] What type of regop or state is this. */
+*/
+
+#define END 0 /* 0 End of program. */
+#define SUCCEED 1 /* 0x1 Return from a subroutine, basically. */
+#define BOL 2 /* 0x2 Match "" at beginning of line. */
+#define MBOL 3 /* 0x3 Same, assuming multiline. */
+#define SBOL 4 /* 0x4 Same, assuming singleline. */
+#define EOS 5 /* 0x5 Match "" at end of string. */
+#define EOL 6 /* 0x6 Match "" at end of line. */
+#define MEOL 7 /* 0x7 Same, assuming multiline. */
+#define SEOL 8 /* 0x8 Same, assuming singleline. */
+#define BOUND 9 /* 0x9 Match "" at any word boundary */
+#define BOUNDL 10 /* 0xa Match "" at any word boundary */
+#define NBOUND 11 /* 0xb Match "" at any word non-boundary */
+#define NBOUNDL 12 /* 0xc Match "" at any word non-boundary */
+#define GPOS 13 /* 0xd Matches where last m//g left off. */
+#define ANY 14 /* 0xe Match any one character (except newline). */
+#define SANY 15 /* 0xf Match any one character. */
+#define ANYOF 16 /* 0x10 Match character in (or not in) this class. */
+#define ALNUM 17 /* 0x11 Match any alphanumeric character */
+#define ALNUML 18 /* 0x12 Match any alphanumeric char in locale */
+#define NALNUM 19 /* 0x13 Match any non-alphanumeric character */
+#define NALNUML 20 /* 0x14 Match any non-alphanumeric char in locale */
+#define SPACE 21 /* 0x15 Match any whitespace character */
+#define SPACEL 22 /* 0x16 Match any whitespace char in locale */
+#define NSPACE 23 /* 0x17 Match any non-whitespace character */
+#define NSPACEL 24 /* 0x18 Match any non-whitespace char in locale */
+#define DIGIT 25 /* 0x19 Match any numeric character */
+#define NDIGIT 26 /* 0x1a Match any non-numeric character */
+#define BRANCH 27 /* 0x1b Match this alternative, or the next... */
+#define BACK 28 /* 0x1c Match "", "next" ptr points backward. */
+#define EXACT 29 /* 0x1d Match this string (preceded by length). */
+#define EXACTF 30 /* 0x1e Match this string, folded (prec. by length). */
+#define EXACTFL 31 /* 0x1f Match this string, folded in locale (w/len). */
+#define NOTHING 32 /* 0x20 Match empty string. */
+#define TAIL 33 /* 0x21 Match empty string. Can jump here from outside. */
+#define STAR 34 /* 0x22 Match this (simple) thing 0 or more times. */
+#define PLUS 35 /* 0x23 Match this (simple) thing 1 or more times. */
+#define CURLY 36 /* 0x24 Match this simple thing {n,m} times. */
+#define CURLYN 37 /* 0x25 Match next-after-this simple thing */
+#define CURLYM 38 /* 0x26 Match this medium-complex thing {n,m} times. */
+#define CURLYX 39 /* 0x27 Match this complex thing {n,m} times. */
+#define WHILEM 40 /* 0x28 Do curly processing and see if rest matches. */
+#define OPEN 41 /* 0x29 Mark this point in input as start of #n. */
+#define CLOSE 42 /* 0x2a Analogous to OPEN. */
+#define REF 43 /* 0x2b Match some already matched string */
+#define REFF 44 /* 0x2c Match already matched string, folded */
+#define REFFL 45 /* 0x2d Match already matched string, folded in loc. */
+#define IFMATCH 46 /* 0x2e Succeeds if the following matches. */
+#define UNLESSM 47 /* 0x2f Fails if the following matches. */
+#define SUSPEND 48 /* 0x30 "Independent" sub-RE. */
+#define IFTHEN 49 /* 0x31 Switch, should be preceeded by switcher . */
+#define GROUPP 50 /* 0x32 Whether the group matched. */
+#define LONGJMP 51 /* 0x33 Jump far away. */
+#define BRANCHJ 52 /* 0x34 BRANCH with long offset. */
+#define EVAL 53 /* 0x35 Execute some Perl code. */
+#define MINMOD 54 /* 0x36 Next operator is not greedy. */
+#define LOGICAL 55 /* 0x37 Next opcode should set the flag only. */
+#define RENUM 56 /* 0x38 Group with independently numbered parens. */
+#define OPTIMIZED 57 /* 0x39 Placeholder for dump. */
#ifndef DOINIT
-EXTCONST U8 PL_regkind[];
+EXTCONST U8 regkind[];
#else
-EXTCONST U8 PL_regkind[] = {
- END, /* END */
- END, /* SUCCEED */
- BOL, /* BOL */
- BOL, /* MBOL */
- BOL, /* SBOL */
- EOL, /* EOS */
- EOL, /* EOL */
- EOL, /* MEOL */
- EOL, /* SEOL */
- BOUND, /* BOUND */
- BOUND, /* BOUNDL */
- BOUND, /* BOUNDU */
- BOUND, /* BOUNDA */
- NBOUND, /* NBOUND */
- NBOUND, /* NBOUNDL */
- NBOUND, /* NBOUNDU */
- NBOUND, /* NBOUNDA */
- GPOS, /* GPOS */
- REG_ANY, /* REG_ANY */
- REG_ANY, /* SANY */
- REG_ANY, /* CANY */
- ANYOF, /* ANYOF */
- POSIXD, /* POSIXD */
- POSIXD, /* POSIXL */
- POSIXD, /* POSIXU */
- POSIXD, /* POSIXA */
- NPOSIXD, /* NPOSIXD */
- NPOSIXD, /* NPOSIXL */
- NPOSIXD, /* NPOSIXU */
- NPOSIXD, /* NPOSIXA */
- CLUMP, /* CLUMP */
- BRANCH, /* BRANCH */
- BACK, /* BACK */
- EXACT, /* EXACT */
- EXACT, /* EXACTF */
- EXACT, /* EXACTFL */
- EXACT, /* EXACTFU */
- EXACT, /* EXACTFA */
- EXACT, /* EXACTFU_SS */
- EXACT, /* EXACTFA_NO_TRIE */
- NOTHING, /* NOTHING */
- NOTHING, /* TAIL */
- STAR, /* STAR */
- PLUS, /* PLUS */
- CURLY, /* CURLY */
- CURLY, /* CURLYN */
- CURLY, /* CURLYM */
- CURLY, /* CURLYX */
- WHILEM, /* WHILEM */
- OPEN, /* OPEN */
- CLOSE, /* CLOSE */
- REF, /* REF */
- REF, /* REFF */
- REF, /* REFFL */
- REF, /* REFFU */
- REF, /* REFFA */
- REF, /* NREF */
- REF, /* NREFF */
- REF, /* NREFFL */
- REF, /* NREFFU */
- REF, /* NREFFA */
- BRANCHJ, /* IFMATCH */
- BRANCHJ, /* UNLESSM */
- BRANCHJ, /* SUSPEND */
- BRANCHJ, /* IFTHEN */
- GROUPP, /* GROUPP */
- LONGJMP, /* LONGJMP */
- BRANCHJ, /* BRANCHJ */
- EVAL, /* EVAL */
- MINMOD, /* MINMOD */
- LOGICAL, /* LOGICAL */
- BRANCHJ, /* RENUM */
- TRIE, /* TRIE */
- TRIE, /* TRIEC */
- TRIE, /* AHOCORASICK */
- TRIE, /* AHOCORASICKC */
- GOSUB, /* GOSUB */
- GOSTART, /* GOSTART */
- NGROUPP, /* NGROUPP */
- INSUBP, /* INSUBP */
- DEFINEP, /* DEFINEP */
- ENDLIKE, /* ENDLIKE */
- ENDLIKE, /* OPFAIL */
- ENDLIKE, /* ACCEPT */
- VERB, /* VERB */
- VERB, /* PRUNE */
- VERB, /* MARKPOINT */
- VERB, /* SKIP */
- VERB, /* COMMIT */
- VERB, /* CUTGROUP */
- KEEPS, /* KEEPS */
- LNBREAK, /* LNBREAK */
- NOTHING, /* OPTIMIZED */
- PSEUDO, /* PSEUDO */
- /* ------------ States ------------- */
- TRIE, /* TRIE_next */
- TRIE, /* TRIE_next_fail */
- EVAL, /* EVAL_AB */
- EVAL, /* EVAL_AB_fail */
- CURLYX, /* CURLYX_end */
- CURLYX, /* CURLYX_end_fail */
- WHILEM, /* WHILEM_A_pre */
- WHILEM, /* WHILEM_A_pre_fail */
- WHILEM, /* WHILEM_A_min */
- WHILEM, /* WHILEM_A_min_fail */
- WHILEM, /* WHILEM_A_max */
- WHILEM, /* WHILEM_A_max_fail */
- WHILEM, /* WHILEM_B_min */
- WHILEM, /* WHILEM_B_min_fail */
- WHILEM, /* WHILEM_B_max */
- WHILEM, /* WHILEM_B_max_fail */
- BRANCH, /* BRANCH_next */
- BRANCH, /* BRANCH_next_fail */
- CURLYM, /* CURLYM_A */
- CURLYM, /* CURLYM_A_fail */
- CURLYM, /* CURLYM_B */
- CURLYM, /* CURLYM_B_fail */
- IFMATCH, /* IFMATCH_A */
- IFMATCH, /* IFMATCH_A_fail */
- CURLY, /* CURLY_B_min_known */
- CURLY, /* CURLY_B_min_known_fail */
- CURLY, /* CURLY_B_min */
- CURLY, /* CURLY_B_min_fail */
- CURLY, /* CURLY_B_max */
- CURLY, /* CURLY_B_max_fail */
- COMMIT, /* COMMIT_next */
- COMMIT, /* COMMIT_next_fail */
- MARKPOINT, /* MARKPOINT_next */
- MARKPOINT, /* MARKPOINT_next_fail */
- SKIP, /* SKIP_next */
- SKIP, /* SKIP_next_fail */
- CUTGROUP, /* CUTGROUP_next */
- CUTGROUP, /* CUTGROUP_next_fail */
- KEEPS, /* KEEPS_next */
- KEEPS, /* KEEPS_next_fail */
+EXTCONST U8 regkind[] = {
+ END, /* END */
+ END, /* SUCCEED */
+ BOL, /* BOL */
+ BOL, /* MBOL */
+ BOL, /* SBOL */
+ EOL, /* EOS */
+ EOL, /* EOL */
+ EOL, /* MEOL */
+ EOL, /* SEOL */
+ BOUND, /* BOUND */
+ BOUND, /* BOUNDL */
+ NBOUND, /* NBOUND */
+ NBOUND, /* NBOUNDL */
+ GPOS, /* GPOS */
+ ANY, /* ANY */
+ ANY, /* SANY */
+ ANYOF, /* ANYOF */
+ ALNUM, /* ALNUM */
+ ALNUM, /* ALNUML */
+ NALNUM, /* NALNUM */
+ NALNUM, /* NALNUML */
+ SPACE, /* SPACE */
+ SPACE, /* SPACEL */
+ NSPACE, /* NSPACE */
+ NSPACE, /* NSPACEL */
+ DIGIT, /* DIGIT */
+ NDIGIT, /* NDIGIT */
+ BRANCH, /* BRANCH */
+ BACK, /* BACK */
+ EXACT, /* EXACT */
+ EXACT, /* EXACTF */
+ EXACT, /* EXACTFL */
+ NOTHING, /* NOTHING */
+ NOTHING, /* TAIL */
+ STAR, /* STAR */
+ PLUS, /* PLUS */
+ CURLY, /* CURLY */
+ CURLY, /* CURLYN */
+ CURLY, /* CURLYM */
+ CURLY, /* CURLYX */
+ WHILEM, /* WHILEM */
+ OPEN, /* OPEN */
+ CLOSE, /* CLOSE */
+ REF, /* REF */
+ REF, /* REFF */
+ REF, /* REFFL */
+ BRANCHJ, /* IFMATCH */
+ BRANCHJ, /* UNLESSM */
+ BRANCHJ, /* SUSPEND */
+ BRANCHJ, /* IFTHEN */
+ GROUPP, /* GROUPP */
+ LONGJMP, /* LONGJMP */
+ BRANCHJ, /* BRANCHJ */
+ EVAL, /* EVAL */
+ MINMOD, /* MINMOD */
+ LOGICAL, /* LOGICAL */
+ BRANCHJ, /* RENUM */
+ NOTHING, /* OPTIMIZED */
};
#endif
-/* regarglen[] - How large is the argument part of the node (in regnodes) */
#ifdef REG_COMP_C
-static const U8 regarglen[] = {
- 0, /* END */
- 0, /* SUCCEED */
- 0, /* BOL */
- 0, /* MBOL */
- 0, /* SBOL */
- 0, /* EOS */
- 0, /* EOL */
- 0, /* MEOL */
- 0, /* SEOL */
- 0, /* BOUND */
- 0, /* BOUNDL */
- 0, /* BOUNDU */
- 0, /* BOUNDA */
- 0, /* NBOUND */
- 0, /* NBOUNDL */
- 0, /* NBOUNDU */
- 0, /* NBOUNDA */
- 0, /* GPOS */
- 0, /* REG_ANY */
- 0, /* SANY */
- 0, /* CANY */
- 0, /* ANYOF */
- 0, /* POSIXD */
- 0, /* POSIXL */
- 0, /* POSIXU */
- 0, /* POSIXA */
- 0, /* NPOSIXD */
- 0, /* NPOSIXL */
- 0, /* NPOSIXU */
- 0, /* NPOSIXA */
- 0, /* CLUMP */
- 0, /* BRANCH */
- 0, /* BACK */
- 0, /* EXACT */
- 0, /* EXACTF */
- 0, /* EXACTFL */
- 0, /* EXACTFU */
- 0, /* EXACTFA */
- 0, /* EXACTFU_SS */
- 0, /* EXACTFA_NO_TRIE */
- 0, /* NOTHING */
- 0, /* TAIL */
- 0, /* STAR */
- 0, /* PLUS */
- EXTRA_SIZE(struct regnode_2), /* CURLY */
- EXTRA_SIZE(struct regnode_2), /* CURLYN */
- EXTRA_SIZE(struct regnode_2), /* CURLYM */
- EXTRA_SIZE(struct regnode_2), /* CURLYX */
- 0, /* WHILEM */
- EXTRA_SIZE(struct regnode_1), /* OPEN */
- EXTRA_SIZE(struct regnode_1), /* CLOSE */
- EXTRA_SIZE(struct regnode_1), /* REF */
- EXTRA_SIZE(struct regnode_1), /* REFF */
- EXTRA_SIZE(struct regnode_1), /* REFFL */
- EXTRA_SIZE(struct regnode_1), /* REFFU */
- EXTRA_SIZE(struct regnode_1), /* REFFA */
- EXTRA_SIZE(struct regnode_1), /* NREF */
- EXTRA_SIZE(struct regnode_1), /* NREFF */
- EXTRA_SIZE(struct regnode_1), /* NREFFL */
- EXTRA_SIZE(struct regnode_1), /* NREFFU */
- EXTRA_SIZE(struct regnode_1), /* NREFFA */
- EXTRA_SIZE(struct regnode_1), /* IFMATCH */
- EXTRA_SIZE(struct regnode_1), /* UNLESSM */
- EXTRA_SIZE(struct regnode_1), /* SUSPEND */
- EXTRA_SIZE(struct regnode_1), /* IFTHEN */
- EXTRA_SIZE(struct regnode_1), /* GROUPP */
- EXTRA_SIZE(struct regnode_1), /* LONGJMP */
- EXTRA_SIZE(struct regnode_1), /* BRANCHJ */
- EXTRA_SIZE(struct regnode_1), /* EVAL */
- 0, /* MINMOD */
- 0, /* LOGICAL */
- EXTRA_SIZE(struct regnode_1), /* RENUM */
- EXTRA_SIZE(struct regnode_1), /* TRIE */
- EXTRA_SIZE(struct regnode_charclass), /* TRIEC */
- EXTRA_SIZE(struct regnode_1), /* AHOCORASICK */
- EXTRA_SIZE(struct regnode_charclass), /* AHOCORASICKC */
- EXTRA_SIZE(struct regnode_2L), /* GOSUB */
- 0, /* GOSTART */
- EXTRA_SIZE(struct regnode_1), /* NGROUPP */
- EXTRA_SIZE(struct regnode_1), /* INSUBP */
- EXTRA_SIZE(struct regnode_1), /* DEFINEP */
- 0, /* ENDLIKE */
- 0, /* OPFAIL */
- EXTRA_SIZE(struct regnode_1), /* ACCEPT */
- EXTRA_SIZE(struct regnode_1), /* VERB */
- EXTRA_SIZE(struct regnode_1), /* PRUNE */
- EXTRA_SIZE(struct regnode_1), /* MARKPOINT */
- EXTRA_SIZE(struct regnode_1), /* SKIP */
- EXTRA_SIZE(struct regnode_1), /* COMMIT */
- EXTRA_SIZE(struct regnode_1), /* CUTGROUP */
- 0, /* KEEPS */
- 0, /* LNBREAK */
- 0, /* OPTIMIZED */
- 0, /* PSEUDO */
+const static U8 regarglen[] = {
+ 0, /* END */
+ 0, /* SUCCEED */
+ 0, /* BOL */
+ 0, /* MBOL */
+ 0, /* SBOL */
+ 0, /* EOS */
+ 0, /* EOL */
+ 0, /* MEOL */
+ 0, /* SEOL */
+ 0, /* BOUND */
+ 0, /* BOUNDL */
+ 0, /* NBOUND */
+ 0, /* NBOUNDL */
+ 0, /* GPOS */
+ 0, /* ANY */
+ 0, /* SANY */
+ 0, /* ANYOF */
+ 0, /* ALNUM */
+ 0, /* ALNUML */
+ 0, /* NALNUM */
+ 0, /* NALNUML */
+ 0, /* SPACE */
+ 0, /* SPACEL */
+ 0, /* NSPACE */
+ 0, /* NSPACEL */
+ 0, /* DIGIT */
+ 0, /* NDIGIT */
+ 0, /* BRANCH */
+ 0, /* BACK */
+ 0, /* EXACT */
+ 0, /* EXACTF */
+ 0, /* EXACTFL */
+ 0, /* NOTHING */
+ 0, /* TAIL */
+ 0, /* STAR */
+ 0, /* PLUS */
+ EXTRA_SIZE(struct regnode_2), /* CURLY */
+ EXTRA_SIZE(struct regnode_2), /* CURLYN */
+ EXTRA_SIZE(struct regnode_2), /* CURLYM */
+ EXTRA_SIZE(struct regnode_2), /* CURLYX */
+ 0, /* WHILEM */
+ EXTRA_SIZE(struct regnode_1), /* OPEN */
+ EXTRA_SIZE(struct regnode_1), /* CLOSE */
+ EXTRA_SIZE(struct regnode_1), /* REF */
+ EXTRA_SIZE(struct regnode_1), /* REFF */
+ EXTRA_SIZE(struct regnode_1), /* REFFL */
+ EXTRA_SIZE(struct regnode_1), /* IFMATCH */
+ EXTRA_SIZE(struct regnode_1), /* UNLESSM */
+ EXTRA_SIZE(struct regnode_1), /* SUSPEND */
+ EXTRA_SIZE(struct regnode_1), /* IFTHEN */
+ EXTRA_SIZE(struct regnode_1), /* GROUPP */
+ EXTRA_SIZE(struct regnode_1), /* LONGJMP */
+ EXTRA_SIZE(struct regnode_1), /* BRANCHJ */
+ EXTRA_SIZE(struct regnode_1), /* EVAL */
+ 0, /* MINMOD */
+ 0, /* LOGICAL */
+ EXTRA_SIZE(struct regnode_1), /* RENUM */
+ 0, /* OPTIMIZED */
};
-/* reg_off_by_arg[] - Which argument holds the offset to the next node */
-
-static const char reg_off_by_arg[] = {
- 0, /* END */
- 0, /* SUCCEED */
- 0, /* BOL */
- 0, /* MBOL */
- 0, /* SBOL */
- 0, /* EOS */
- 0, /* EOL */
- 0, /* MEOL */
- 0, /* SEOL */
- 0, /* BOUND */
- 0, /* BOUNDL */
- 0, /* BOUNDU */
- 0, /* BOUNDA */
- 0, /* NBOUND */
- 0, /* NBOUNDL */
- 0, /* NBOUNDU */
- 0, /* NBOUNDA */
- 0, /* GPOS */
- 0, /* REG_ANY */
- 0, /* SANY */
- 0, /* CANY */
- 0, /* ANYOF */
- 0, /* POSIXD */
- 0, /* POSIXL */
- 0, /* POSIXU */
- 0, /* POSIXA */
- 0, /* NPOSIXD */
- 0, /* NPOSIXL */
- 0, /* NPOSIXU */
- 0, /* NPOSIXA */
- 0, /* CLUMP */
- 0, /* BRANCH */
- 0, /* BACK */
- 0, /* EXACT */
- 0, /* EXACTF */
- 0, /* EXACTFL */
- 0, /* EXACTFU */
- 0, /* EXACTFA */
- 0, /* EXACTFU_SS */
- 0, /* EXACTFA_NO_TRIE */
- 0, /* NOTHING */
- 0, /* TAIL */
- 0, /* STAR */
- 0, /* PLUS */
- 0, /* CURLY */
- 0, /* CURLYN */
- 0, /* CURLYM */
- 0, /* CURLYX */
- 0, /* WHILEM */
- 0, /* OPEN */
- 0, /* CLOSE */
- 0, /* REF */
- 0, /* REFF */
- 0, /* REFFL */
- 0, /* REFFU */
- 0, /* REFFA */
- 0, /* NREF */
- 0, /* NREFF */
- 0, /* NREFFL */
- 0, /* NREFFU */
- 0, /* NREFFA */
- 2, /* IFMATCH */
- 2, /* UNLESSM */
- 1, /* SUSPEND */
- 1, /* IFTHEN */
- 0, /* GROUPP */
- 1, /* LONGJMP */
- 1, /* BRANCHJ */
- 0, /* EVAL */
- 0, /* MINMOD */
- 0, /* LOGICAL */
- 1, /* RENUM */
- 0, /* TRIE */
- 0, /* TRIEC */
- 0, /* AHOCORASICK */
- 0, /* AHOCORASICKC */
- 0, /* GOSUB */
- 0, /* GOSTART */
- 0, /* NGROUPP */
- 0, /* INSUBP */
- 0, /* DEFINEP */
- 0, /* ENDLIKE */
- 0, /* OPFAIL */
- 0, /* ACCEPT */
- 0, /* VERB */
- 0, /* PRUNE */
- 0, /* MARKPOINT */
- 0, /* SKIP */
- 0, /* COMMIT */
- 0, /* CUTGROUP */
- 0, /* KEEPS */
- 0, /* LNBREAK */
- 0, /* OPTIMIZED */
- 0, /* PSEUDO */
+const static char reg_off_by_arg[] = {
+ 0, /* END */
+ 0, /* SUCCEED */
+ 0, /* BOL */
+ 0, /* MBOL */
+ 0, /* SBOL */
+ 0, /* EOS */
+ 0, /* EOL */
+ 0, /* MEOL */
+ 0, /* SEOL */
+ 0, /* BOUND */
+ 0, /* BOUNDL */
+ 0, /* NBOUND */
+ 0, /* NBOUNDL */
+ 0, /* GPOS */
+ 0, /* ANY */
+ 0, /* SANY */
+ 0, /* ANYOF */
+ 0, /* ALNUM */
+ 0, /* ALNUML */
+ 0, /* NALNUM */
+ 0, /* NALNUML */
+ 0, /* SPACE */
+ 0, /* SPACEL */
+ 0, /* NSPACE */
+ 0, /* NSPACEL */
+ 0, /* DIGIT */
+ 0, /* NDIGIT */
+ 0, /* BRANCH */
+ 0, /* BACK */
+ 0, /* EXACT */
+ 0, /* EXACTF */
+ 0, /* EXACTFL */
+ 0, /* NOTHING */
+ 0, /* TAIL */
+ 0, /* STAR */
+ 0, /* PLUS */
+ 0, /* CURLY */
+ 0, /* CURLYN */
+ 0, /* CURLYM */
+ 0, /* CURLYX */
+ 0, /* WHILEM */
+ 0, /* OPEN */
+ 0, /* CLOSE */
+ 0, /* REF */
+ 0, /* REFF */
+ 0, /* REFFL */
+ 2, /* IFMATCH */
+ 2, /* UNLESSM */
+ 1, /* SUSPEND */
+ 1, /* IFTHEN */
+ 0, /* GROUPP */
+ 1, /* LONGJMP */
+ 1, /* BRANCHJ */
+ 0, /* EVAL */
+ 0, /* MINMOD */
+ 0, /* LOGICAL */
+ 1, /* RENUM */
+ 0, /* OPTIMIZED */
};
-
#endif /* REG_COMP_C */
-/* reg_name[] - Opcode/state names in string form, for debugging */
-
-#ifndef DOINIT
-EXTCONST char * PL_reg_name[];
-#else
-EXTCONST char * const PL_reg_name[] = {
- "END", /* 0000 */
- "SUCCEED", /* 0x01 */
- "BOL", /* 0x02 */
- "MBOL", /* 0x03 */
- "SBOL", /* 0x04 */
- "EOS", /* 0x05 */
- "EOL", /* 0x06 */
- "MEOL", /* 0x07 */
- "SEOL", /* 0x08 */
- "BOUND", /* 0x09 */
- "BOUNDL", /* 0x0a */
- "BOUNDU", /* 0x0b */
- "BOUNDA", /* 0x0c */
- "NBOUND", /* 0x0d */
- "NBOUNDL", /* 0x0e */
- "NBOUNDU", /* 0x0f */
- "NBOUNDA", /* 0x10 */
- "GPOS", /* 0x11 */
- "REG_ANY", /* 0x12 */
- "SANY", /* 0x13 */
- "CANY", /* 0x14 */
- "ANYOF", /* 0x15 */
- "POSIXD", /* 0x16 */
- "POSIXL", /* 0x17 */
- "POSIXU", /* 0x18 */
- "POSIXA", /* 0x19 */
- "NPOSIXD", /* 0x1a */
- "NPOSIXL", /* 0x1b */
- "NPOSIXU", /* 0x1c */
- "NPOSIXA", /* 0x1d */
- "CLUMP", /* 0x1e */
- "BRANCH", /* 0x1f */
- "BACK", /* 0x20 */
- "EXACT", /* 0x21 */
- "EXACTF", /* 0x22 */
- "EXACTFL", /* 0x23 */
- "EXACTFU", /* 0x24 */
- "EXACTFA", /* 0x25 */
- "EXACTFU_SS", /* 0x26 */
- "EXACTFA_NO_TRIE", /* 0x27 */
- "NOTHING", /* 0x28 */
- "TAIL", /* 0x29 */
- "STAR", /* 0x2a */
- "PLUS", /* 0x2b */
- "CURLY", /* 0x2c */
- "CURLYN", /* 0x2d */
- "CURLYM", /* 0x2e */
- "CURLYX", /* 0x2f */
- "WHILEM", /* 0x30 */
- "OPEN", /* 0x31 */
- "CLOSE", /* 0x32 */
- "REF", /* 0x33 */
- "REFF", /* 0x34 */
- "REFFL", /* 0x35 */
- "REFFU", /* 0x36 */
- "REFFA", /* 0x37 */
- "NREF", /* 0x38 */
- "NREFF", /* 0x39 */
- "NREFFL", /* 0x3a */
- "NREFFU", /* 0x3b */
- "NREFFA", /* 0x3c */
- "IFMATCH", /* 0x3d */
- "UNLESSM", /* 0x3e */
- "SUSPEND", /* 0x3f */
- "IFTHEN", /* 0x40 */
- "GROUPP", /* 0x41 */
- "LONGJMP", /* 0x42 */
- "BRANCHJ", /* 0x43 */
- "EVAL", /* 0x44 */
- "MINMOD", /* 0x45 */
- "LOGICAL", /* 0x46 */
- "RENUM", /* 0x47 */
- "TRIE", /* 0x48 */
- "TRIEC", /* 0x49 */
- "AHOCORASICK", /* 0x4a */
- "AHOCORASICKC", /* 0x4b */
- "GOSUB", /* 0x4c */
- "GOSTART", /* 0x4d */
- "NGROUPP", /* 0x4e */
- "INSUBP", /* 0x4f */
- "DEFINEP", /* 0x50 */
- "ENDLIKE", /* 0x51 */
- "OPFAIL", /* 0x52 */
- "ACCEPT", /* 0x53 */
- "VERB", /* 0x54 */
- "PRUNE", /* 0x55 */
- "MARKPOINT", /* 0x56 */
- "SKIP", /* 0x57 */
- "COMMIT", /* 0x58 */
- "CUTGROUP", /* 0x59 */
- "KEEPS", /* 0x5a */
- "LNBREAK", /* 0x5b */
- "OPTIMIZED", /* 0x5c */
- "PSEUDO", /* 0x5d */
- /* ------------ States ------------- */
- "TRIE_next", /* REGNODE_MAX +0x01 */
- "TRIE_next_fail", /* REGNODE_MAX +0x02 */
- "EVAL_AB", /* REGNODE_MAX +0x03 */
- "EVAL_AB_fail", /* REGNODE_MAX +0x04 */
- "CURLYX_end", /* REGNODE_MAX +0x05 */
- "CURLYX_end_fail", /* REGNODE_MAX +0x06 */
- "WHILEM_A_pre", /* REGNODE_MAX +0x07 */
- "WHILEM_A_pre_fail", /* REGNODE_MAX +0x08 */
- "WHILEM_A_min", /* REGNODE_MAX +0x09 */
- "WHILEM_A_min_fail", /* REGNODE_MAX +0x0a */
- "WHILEM_A_max", /* REGNODE_MAX +0x0b */
- "WHILEM_A_max_fail", /* REGNODE_MAX +0x0c */
- "WHILEM_B_min", /* REGNODE_MAX +0x0d */
- "WHILEM_B_min_fail", /* REGNODE_MAX +0x0e */
- "WHILEM_B_max", /* REGNODE_MAX +0x0f */
- "WHILEM_B_max_fail", /* REGNODE_MAX +0x10 */
- "BRANCH_next", /* REGNODE_MAX +0x11 */
- "BRANCH_next_fail", /* REGNODE_MAX +0x12 */
- "CURLYM_A", /* REGNODE_MAX +0x13 */
- "CURLYM_A_fail", /* REGNODE_MAX +0x14 */
- "CURLYM_B", /* REGNODE_MAX +0x15 */
- "CURLYM_B_fail", /* REGNODE_MAX +0x16 */
- "IFMATCH_A", /* REGNODE_MAX +0x17 */
- "IFMATCH_A_fail", /* REGNODE_MAX +0x18 */
- "CURLY_B_min_known", /* REGNODE_MAX +0x19 */
- "CURLY_B_min_known_fail", /* REGNODE_MAX +0x1a */
- "CURLY_B_min", /* REGNODE_MAX +0x1b */
- "CURLY_B_min_fail", /* REGNODE_MAX +0x1c */
- "CURLY_B_max", /* REGNODE_MAX +0x1d */
- "CURLY_B_max_fail", /* REGNODE_MAX +0x1e */
- "COMMIT_next", /* REGNODE_MAX +0x1f */
- "COMMIT_next_fail", /* REGNODE_MAX +0x20 */
- "MARKPOINT_next", /* REGNODE_MAX +0x21 */
- "MARKPOINT_next_fail", /* REGNODE_MAX +0x22 */
- "SKIP_next", /* REGNODE_MAX +0x23 */
- "SKIP_next_fail", /* REGNODE_MAX +0x24 */
- "CUTGROUP_next", /* REGNODE_MAX +0x25 */
- "CUTGROUP_next_fail", /* REGNODE_MAX +0x26 */
- "KEEPS_next", /* REGNODE_MAX +0x27 */
- "KEEPS_next_fail", /* REGNODE_MAX +0x28 */
-};
-#endif /* DOINIT */
-
-/* PL_reg_extflags_name[] - Opcode/state names in string form, for debugging */
-
-#ifndef DOINIT
-EXTCONST char * PL_reg_extflags_name[];
-#else
-EXTCONST char * const PL_reg_extflags_name[] = {
- /* Bits in extflags defined: 11111110111111111111111111111111 */
- "MULTILINE", /* 0x00000001 */
- "SINGLELINE", /* 0x00000002 */
- "FOLD", /* 0x00000004 */
- "EXTENDED", /* 0x00000008 */
- "KEEPCOPY", /* 0x00000010 */
- "CHARSET0", /* 0x00000020 : "CHARSET" - 0x000000e0 */
- "CHARSET1", /* 0x00000040 : "CHARSET" - 0x000000e0 */
- "CHARSET2", /* 0x00000080 : "CHARSET" - 0x000000e0 */
- "SPLIT", /* 0x00000100 */
- "IS_ANCHORED", /* 0x00000200 */
- "UNUSED1", /* 0x00000400 */
- "UNUSED2", /* 0x00000800 */
- "UNUSED3", /* 0x00001000 */
- "UNUSED4", /* 0x00002000 */
- "UNUSED5", /* 0x00004000 */
- "NO_INPLACE_SUBST", /* 0x00008000 */
- "EVAL_SEEN", /* 0x00010000 */
- "UNUSED8", /* 0x00020000 */
- "UNBOUNDED_QUANTIFIER_SEEN",/* 0x00040000 */
- "CHECK_ALL", /* 0x00080000 */
- "MATCH_UTF8", /* 0x00100000 */
- "USE_INTUIT_NOML", /* 0x00200000 */
- "USE_INTUIT_ML", /* 0x00400000 */
- "INTUIT_TAIL", /* 0x00800000 */
- "UNUSED_BIT_24", /* 0x01000000 */
- "COPY_DONE", /* 0x02000000 */
- "TAINTED_SEEN", /* 0x04000000 */
- "TAINTED", /* 0x08000000 */
- "START_ONLY", /* 0x10000000 */
- "SKIPWHITE", /* 0x20000000 */
- "WHITE", /* 0x40000000 */
- "NULL", /* 0x80000000 */
-};
-#endif /* DOINIT */
-
-#ifdef DEBUGGING
-# define REG_EXTFLAGS_NAME_SIZE 32
-#endif
-
-/* PL_reg_intflags_name[] - Opcode/state names in string form, for debugging */
-
-#ifndef DOINIT
-EXTCONST char * PL_reg_intflags_name[];
-#else
-EXTCONST char * const PL_reg_intflags_name[] = {
- "SKIP", /* 0x00000001 - PREGf_SKIP */
- "IMPLICIT", /* 0x00000002 - PREGf_IMPLICIT - Converted .* to ^.* */
- "NAUGHTY", /* 0x00000004 - PREGf_NAUGHTY - how exponential is this pattern? */
- "VERBARG_SEEN", /* 0x00000008 - PREGf_VERBARG_SEEN */
- "CUTGROUP_SEEN", /* 0x00000010 - PREGf_CUTGROUP_SEEN */
- "USE_RE_EVAL", /* 0x00000020 - PREGf_USE_RE_EVAL - compiled with "use re 'eval'" */
- "NOSCAN", /* 0x00000040 - PREGf_NOSCAN */
- "CANY_SEEN", /* 0x00000080 - PREGf_CANY_SEEN */
- "GPOS_SEEN", /* 0x00000100 - PREGf_GPOS_SEEN */
- "GPOS_FLOAT", /* 0x00000200 - PREGf_GPOS_FLOAT */
- "ANCH_BOL", /* 0x00000400 - PREGf_ANCH_BOL */
- "ANCH_MBOL", /* 0x00000800 - PREGf_ANCH_MBOL */
- "ANCH_SBOL", /* 0x00001000 - PREGf_ANCH_SBOL */
- "ANCH_GPOS", /* 0x00002000 - PREGf_ANCH_GPOS */
-};
-#endif /* DOINIT */
-
-#ifdef DEBUGGING
-# define REG_INTFLAGS_NAME_SIZE 14
-#endif
-
-/* The following have no fixed length. U8 so we can do strchr() on it. */
-#define REGNODE_VARIES(node) (PL_varies_bitmask[(node) >> 3] & (1 << ((node) & 7)))
-
-#ifndef DOINIT
-EXTCONST U8 PL_varies[] __attribute__deprecated__;
-#else
-EXTCONST U8 PL_varies[] __attribute__deprecated__ = {
- CLUMP, BRANCH, BACK, STAR, PLUS, CURLY, CURLYN, CURLYM, CURLYX, WHILEM,
- REF, REFF, REFFL, REFFU, REFFA, NREF, NREFF, NREFFL, NREFFU, NREFFA,
- SUSPEND, IFTHEN, BRANCHJ,
- 0
-};
-#endif /* DOINIT */
-
-#ifndef DOINIT
-EXTCONST U8 PL_varies_bitmask[];
-#else
-EXTCONST U8 PL_varies_bitmask[] = {
- 0x00, 0x00, 0x00, 0xC0, 0x01, 0xFC, 0xF9, 0x9F, 0x09, 0x00, 0x00, 0x00
-};
-#endif /* DOINIT */
-
-/* The following always have a length of 1. U8 we can do strchr() on it. */
-/* (Note that length 1 means "one character" under UTF8, not "one octet".) */
-#define REGNODE_SIMPLE(node) (PL_simple_bitmask[(node) >> 3] & (1 << ((node) & 7)))
-
-#ifndef DOINIT
-EXTCONST U8 PL_simple[] __attribute__deprecated__;
-#else
-EXTCONST U8 PL_simple[] __attribute__deprecated__ = {
- REG_ANY, SANY, CANY, ANYOF, POSIXD, POSIXL, POSIXU, POSIXA, NPOSIXD,
- NPOSIXL, NPOSIXU, NPOSIXA,
- 0
-};
-#endif /* DOINIT */
-
-#ifndef DOINIT
-EXTCONST U8 PL_simple_bitmask[];
-#else
-EXTCONST U8 PL_simple_bitmask[] = {
- 0x00, 0x00, 0xFC, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-};
-#endif /* DOINIT */
-
-/* ex: set ro: */
diff --git a/gnu/usr.bin/perl/thread.h b/gnu/usr.bin/perl/thread.h
index 43932fbb3b3..089077c0f54 100644
--- a/gnu/usr.bin/perl/thread.h
+++ b/gnu/usr.bin/perl/thread.h
@@ -1,102 +1,37 @@
-/* thread.h
- *
- * Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
- * by Larry Wall and others
- *
- * You may distribute under the terms of either the GNU General Public
- * License or the Artistic License, as specified in the README file.
- *
- */
-
-#if defined(USE_ITHREADS)
-
-#if defined(VMS)
-#include <builtins.h>
-#endif
+#ifdef USE_THREADS
#ifdef WIN32
# include <win32thread.h>
#else
-#ifdef NETWARE
-# include <nw5thread.h>
-#else
-# ifdef OLD_PTHREADS_API /* Here be dragons. */
-# define DETACH(t) \
- STMT_START { \
- int _eC_; \
- if ((_eC_ = pthread_detach(&(t)->self))) { \
- MUTEX_UNLOCK(&(t)->mutex); \
- Perl_croak_nocontext("panic: DETACH (%d) [%s:%d]", \
- _eC_, __FILE__, __LINE__); \
- } \
- } STMT_END
-
-# define PERL_GET_CONTEXT Perl_get_context()
-# define PERL_SET_CONTEXT(t) Perl_set_context((void*)t)
-
-# define PTHREAD_GETSPECIFIC_INT
-# ifdef DJGPP
-# define pthread_addr_t any_t
-# define NEED_PTHREAD_INIT
-# define PTHREAD_CREATE_JOINABLE (1)
-# endif
-# ifdef OEMVS
-# define pthread_addr_t void *
-# define pthread_create(t,a,s,d) pthread_create(t,&(a),s,d)
-# define pthread_keycreate pthread_key_create
-# endif
-# ifdef VMS
-# define pthread_attr_init(a) pthread_attr_create(a)
-# define PTHREAD_ATTR_SETDETACHSTATE(a,s) pthread_setdetach_np(a,s)
-# define PTHREAD_CREATE(t,a,s,d) pthread_create(t,a,s,d)
-# define pthread_key_create(k,d) pthread_keycreate(k,(pthread_destructor_t)(d))
-# define pthread_mutexattr_init(a) pthread_mutexattr_create(a)
-# define pthread_mutexattr_settype(a,t) pthread_mutexattr_setkind_np(a,t)
-# endif
-# if defined(__hpux) && defined(__ux_version) && __ux_version <= 1020
-# define pthread_attr_init(a) pthread_attr_create(a)
- /* XXX pthread_setdetach_np() missing in DCE threads on HP-UX 10.20 */
-# define PTHREAD_ATTR_SETDETACHSTATE(a,s) (0)
-# define PTHREAD_CREATE(t,a,s,d) pthread_create(t,a,s,d)
-# define pthread_key_create(k,d) pthread_keycreate(k,(pthread_destructor_t)(d))
-# define pthread_mutexattr_init(a) pthread_mutexattr_create(a)
-# define pthread_mutexattr_settype(a,t) pthread_mutexattr_setkind_np(a,t)
-# endif
-# if defined(DJGPP) || defined(OEMVS)
-# define PTHREAD_ATTR_SETDETACHSTATE(a,s) pthread_attr_setdetachstate(a,&(s))
-# define YIELD pthread_yield(NULL)
-# endif
-# endif
-# if !defined(__hpux) || !defined(__ux_version) || __ux_version > 1020
-# define pthread_mutexattr_default NULL
-# define pthread_condattr_default NULL
-# endif
-#endif /* NETWARE */
-#endif
-#ifndef PTHREAD_CREATE
-/* You are not supposed to pass NULL as the 2nd arg of PTHREAD_CREATE(). */
-# define PTHREAD_CREATE(t,a,s,d) pthread_create(t,&(a),s,d)
-#endif
-
-#ifndef PTHREAD_ATTR_SETDETACHSTATE
-# define PTHREAD_ATTR_SETDETACHSTATE(a,s) pthread_attr_setdetachstate(a,s)
+#ifndef DJGPP
+/* POSIXish threads */
+#ifdef OLD_PTHREADS_API
+# define pthread_mutexattr_init(a) pthread_mutexattr_create(a)
+# define pthread_mutexattr_settype(a,t) pthread_mutexattr_setkind_np(a,t)
+# define pthread_key_create(k,d) pthread_keycreate(k,(pthread_destructor_t)(d))
+# define YIELD pthread_yield()
+# define DETACH(t) \
+ STMT_START { \
+ if (pthread_detach(&(t)->self)) { \
+ MUTEX_UNLOCK(&(t)->mutex); \
+ croak("panic: DETACH"); \
+ } \
+ } STMT_END
+#else
+# define pthread_mutexattr_default NULL
+# define pthread_condattr_default NULL
+#endif /* OLD_PTHREADS_API */
#endif
-
-#ifndef PTHREAD_CREATE_JOINABLE
-# ifdef OLD_PTHREAD_CREATE_JOINABLE
-# define PTHREAD_CREATE_JOINABLE OLD_PTHREAD_CREATE_JOINABLE
-# else
-# define PTHREAD_CREATE_JOINABLE 0 /* Panic? No, guess. */
-# endif
#endif
-#ifdef __VMS
- /* Default is 1024 on VAX, 8192 otherwise */
-# ifdef __ia64
-# define THREAD_CREATE_NEEDS_STACK (48*1024)
+#ifdef PTHREADS_CREATED_JOINABLE
+# define ATTR_JOINABLE PTHREAD_CREATE_JOINABLE
+#else
+# ifdef PTHREAD_CREATE_UNDETACHED
+# define ATTR_JOINABLE PTHREAD_CREATE_UNDETACHED
# else
-# define THREAD_CREATE_NEEDS_STACK (32*1024)
+# define ATTR_JOINABLE PTHREAD_CREATE_JOINABLE
# endif
#endif
@@ -106,45 +41,42 @@
/* #include <mach/cthreads.h> is in perl.h #ifdef I_MACH_CTHREADS */
-#define MUTEX_INIT(m) \
- STMT_START { \
- *m = mutex_alloc(); \
- if (*m) { \
- mutex_init(*m); \
- } else { \
- Perl_croak_nocontext("panic: MUTEX_INIT [%s:%d]", \
- __FILE__, __LINE__); \
- } \
- } STMT_END
-
-#define MUTEX_LOCK(m) mutex_lock(*m)
-#define MUTEX_UNLOCK(m) mutex_unlock(*m)
-#define MUTEX_DESTROY(m) \
- STMT_START { \
- mutex_free(*m); \
- *m = 0; \
- } STMT_END
-
-#define COND_INIT(c) \
- STMT_START { \
- *c = condition_alloc(); \
- if (*c) { \
- condition_init(*c); \
- } \
- else { \
- Perl_croak_nocontext("panic: COND_INIT [%s:%d]", \
- __FILE__, __LINE__); \
- } \
- } STMT_END
+#define MUTEX_INIT(m) \
+ STMT_START { \
+ *m = mutex_alloc(); \
+ if (*m) { \
+ mutex_init(*m); \
+ } else { \
+ croak("panic: MUTEX_INIT"); \
+ } \
+ } STMT_END
+
+#define MUTEX_LOCK(m) mutex_lock(*m)
+#define MUTEX_UNLOCK(m) mutex_unlock(*m)
+#define MUTEX_DESTROY(m) \
+ STMT_START { \
+ mutex_free(*m); \
+ *m = 0; \
+ } STMT_END
+
+#define COND_INIT(c) \
+ STMT_START { \
+ *c = condition_alloc(); \
+ if (*c) { \
+ condition_init(*c); \
+ } else { \
+ croak("panic: COND_INIT"); \
+ } \
+ } STMT_END
#define COND_SIGNAL(c) condition_signal(*c)
#define COND_BROADCAST(c) condition_broadcast(*c)
#define COND_WAIT(c, m) condition_wait(*c, *m)
-#define COND_DESTROY(c) \
- STMT_START { \
- condition_free(*c); \
- *c = 0; \
- } STMT_END
+#define COND_DESTROY(c) \
+ STMT_START { \
+ condition_free(*c); \
+ *c = 0; \
+ } STMT_END
#define THREAD_CREATE(thr, f) (thr->self = cthread_fork(f, thr), 0)
#define THREAD_POST_CREATE(thr)
@@ -153,31 +85,24 @@
#define THREAD_RET_CAST(x) ((any_t) x)
#define DETACH(t) cthread_detach(t->self)
-#define JOIN(t, avp) (*(avp) = MUTABLE_AV(cthread_join(t->self)))
+#define JOIN(t, avp) (*(avp) = (AV *)cthread_join(t->self))
-#define PERL_SET_CONTEXT(t) cthread_set_data(cthread_self(), t)
-#define PERL_GET_CONTEXT cthread_data(cthread_self())
+#define SET_THR(thr) cthread_set_data(cthread_self(), thr)
+#define THR cthread_data(cthread_self())
#define INIT_THREADS cthread_init()
#define YIELD cthread_yield()
-#define ALLOC_THREAD_KEY NOOP
-#define FREE_THREAD_KEY NOOP
+#define ALLOC_THREAD_KEY
#define SET_THREAD_SELF(thr) (thr->self = cthread_self())
#endif /* I_MACH_CTHREADS */
#ifndef YIELD
-# ifdef SCHED_YIELD
-# define YIELD SCHED_YIELD
+# ifdef HAS_SCHED_YIELD
+# define YIELD sched_yield()
# else
-# ifdef HAS_SCHED_YIELD
-# define YIELD sched_yield()
-# else
-# ifdef HAS_PTHREAD_YIELD
- /* pthread_yield(NULL) platforms are expected
- * to have #defined YIELD for themselves. */
-# define YIELD pthread_yield()
-# endif
+# ifdef HAS_PTHREAD_YIELD
+# define YIELD pthread_yield()
# endif
# endif
#endif
@@ -187,255 +112,213 @@
#endif
#ifndef MUTEX_INIT
-
-# ifdef MUTEX_INIT_NEEDS_MUTEX_ZEROED
+#ifdef MUTEX_INIT_NEEDS_MUTEX_ZEROED
/* Temporary workaround, true bug is deeper. --jhi 1999-02-25 */
-# define MUTEX_INIT(m) \
+#define MUTEX_INIT(m) \
STMT_START { \
- int _eC_; \
Zero((m), 1, perl_mutex); \
- if ((_eC_ = pthread_mutex_init((m), pthread_mutexattr_default))) \
- Perl_croak_nocontext("panic: MUTEX_INIT (%d) [%s:%d]", \
- _eC_, __FILE__, __LINE__); \
+ if (pthread_mutex_init((m), pthread_mutexattr_default)) \
+ croak("panic: MUTEX_INIT"); \
} STMT_END
-# else
-# define MUTEX_INIT(m) \
+#else
+#define MUTEX_INIT(m) \
STMT_START { \
- int _eC_; \
- if ((_eC_ = pthread_mutex_init((m), pthread_mutexattr_default))) \
- Perl_croak_nocontext("panic: MUTEX_INIT (%d) [%s:%d]", \
- _eC_, __FILE__, __LINE__); \
+ if (pthread_mutex_init((m), pthread_mutexattr_default)) \
+ croak("panic: MUTEX_INIT"); \
} STMT_END
-# endif
-
-# define MUTEX_LOCK(m) \
- STMT_START { \
- int _eC_; \
- if ((_eC_ = pthread_mutex_lock((m)))) \
- Perl_croak_nocontext("panic: MUTEX_LOCK (%d) [%s:%d]", \
- _eC_, __FILE__, __LINE__); \
+#endif
+#define MUTEX_LOCK(m) \
+ STMT_START { \
+ if (pthread_mutex_lock((m))) \
+ croak("panic: MUTEX_LOCK"); \
} STMT_END
-
-# define MUTEX_UNLOCK(m) \
- STMT_START { \
- int _eC_; \
- if ((_eC_ = pthread_mutex_unlock((m)))) \
- Perl_croak_nocontext("panic: MUTEX_UNLOCK (%d) [%s:%d]", \
- _eC_, __FILE__, __LINE__); \
+#define MUTEX_UNLOCK(m) \
+ STMT_START { \
+ if (pthread_mutex_unlock((m))) \
+ croak("panic: MUTEX_UNLOCK"); \
} STMT_END
-
-# define MUTEX_DESTROY(m) \
- STMT_START { \
- int _eC_; \
- if ((_eC_ = pthread_mutex_destroy((m)))) \
- Perl_croak_nocontext("panic: MUTEX_DESTROY (%d) [%s:%d]", \
- _eC_, __FILE__, __LINE__); \
+#define MUTEX_DESTROY(m) \
+ STMT_START { \
+ if (pthread_mutex_destroy((m))) \
+ croak("panic: MUTEX_DESTROY"); \
} STMT_END
#endif /* MUTEX_INIT */
#ifndef COND_INIT
-# define COND_INIT(c) \
+#define COND_INIT(c) \
STMT_START { \
- int _eC_; \
- if ((_eC_ = pthread_cond_init((c), pthread_condattr_default))) \
- Perl_croak_nocontext("panic: COND_INIT (%d) [%s:%d]", \
- _eC_, __FILE__, __LINE__); \
+ if (pthread_cond_init((c), pthread_condattr_default)) \
+ croak("panic: COND_INIT"); \
} STMT_END
-
-# define COND_SIGNAL(c) \
- STMT_START { \
- int _eC_; \
- if ((_eC_ = pthread_cond_signal((c)))) \
- Perl_croak_nocontext("panic: COND_SIGNAL (%d) [%s:%d]", \
- _eC_, __FILE__, __LINE__); \
+#define COND_SIGNAL(c) \
+ STMT_START { \
+ if (pthread_cond_signal((c))) \
+ croak("panic: COND_SIGNAL"); \
} STMT_END
-
-# define COND_BROADCAST(c) \
- STMT_START { \
- int _eC_; \
- if ((_eC_ = pthread_cond_broadcast((c)))) \
- Perl_croak_nocontext("panic: COND_BROADCAST (%d) [%s:%d]", \
- _eC_, __FILE__, __LINE__); \
+#define COND_BROADCAST(c) \
+ STMT_START { \
+ if (pthread_cond_broadcast((c))) \
+ croak("panic: COND_BROADCAST"); \
} STMT_END
-
-# define COND_WAIT(c, m) \
- STMT_START { \
- int _eC_; \
- if ((_eC_ = pthread_cond_wait((c), (m)))) \
- Perl_croak_nocontext("panic: COND_WAIT (%d) [%s:%d]", \
- _eC_, __FILE__, __LINE__); \
+#define COND_WAIT(c, m) \
+ STMT_START { \
+ if (pthread_cond_wait((c), (m))) \
+ croak("panic: COND_WAIT"); \
} STMT_END
-
-# define COND_DESTROY(c) \
- STMT_START { \
- int _eC_; \
- if ((_eC_ = pthread_cond_destroy((c)))) \
- Perl_croak_nocontext("panic: COND_DESTROY (%d) [%s:%d]", \
- _eC_, __FILE__, __LINE__); \
+#define COND_DESTROY(c) \
+ STMT_START { \
+ if (pthread_cond_destroy((c))) \
+ croak("panic: COND_DESTROY"); \
} STMT_END
#endif /* COND_INIT */
/* DETACH(t) must only be called while holding t->mutex */
#ifndef DETACH
-# define DETACH(t) \
- STMT_START { \
- int _eC_; \
- if ((_eC_ = pthread_detach((t)->self))) { \
- MUTEX_UNLOCK(&(t)->mutex); \
- Perl_croak_nocontext("panic: DETACH (%d) [%s:%d]", \
- _eC_, __FILE__, __LINE__); \
- } \
+#define DETACH(t) \
+ STMT_START { \
+ if (pthread_detach((t)->self)) { \
+ MUTEX_UNLOCK(&(t)->mutex); \
+ croak("panic: DETACH"); \
+ } \
} STMT_END
#endif /* DETACH */
#ifndef JOIN
-# define JOIN(t, avp) \
- STMT_START { \
- int _eC_; \
- if ((_eC_ = pthread_join((t)->self, (void**)(avp)))) \
- Perl_croak_nocontext("panic: pthread_join (%d) [%s:%d]", \
- _eC_, __FILE__, __LINE__); \
+#define JOIN(t, avp) \
+ STMT_START { \
+ if (pthread_join((t)->self, (void**)(avp))) \
+ croak("panic: pthread_join"); \
} STMT_END
#endif /* JOIN */
-/* Use an unchecked fetch of thread-specific data instead of a checked one.
- * It would fail if the key were bogus, but if the key were bogus then
- * Really Bad Things would be happening anyway. --dan */
-#if (defined(__ALPHA) && (__VMS_VER >= 70000000)) || \
- (defined(__alpha) && defined(__osf__) && !defined(__GNUC__)) /* Available only on >= 4.0 */
-# define HAS_PTHREAD_UNCHECKED_GETSPECIFIC_NP /* Configure test needed */
-#endif
-
-#ifdef HAS_PTHREAD_UNCHECKED_GETSPECIFIC_NP
-# define PTHREAD_GETSPECIFIC(key) pthread_unchecked_getspecific_np(key)
-#else
-# define PTHREAD_GETSPECIFIC(key) pthread_getspecific(key)
-#endif
+#ifndef SET_THR
+#define SET_THR(t) \
+ STMT_START { \
+ if (pthread_setspecific(PL_thr_key, (void *) (t))) \
+ croak("panic: pthread_setspecific"); \
+ } STMT_END
+#endif /* SET_THR */
-#ifndef PERL_GET_CONTEXT
-# define PERL_GET_CONTEXT PTHREAD_GETSPECIFIC(PL_thr_key)
-#endif
+#ifndef THR
+# ifdef OLD_PTHREADS_API
+struct perl_thread *getTHR _((void));
+# define THR getTHR()
+# else
+# define THR ((struct perl_thread *) pthread_getspecific(PL_thr_key))
+# endif /* OLD_PTHREADS_API */
+#endif /* THR */
-#ifndef PERL_SET_CONTEXT
-# define PERL_SET_CONTEXT(t) \
- STMT_START { \
- int _eC_; \
- if ((_eC_ = pthread_setspecific(PL_thr_key, (void *)(t)))) \
- Perl_croak_nocontext("panic: pthread_setspecific (%d) [%s:%d]", \
- _eC_, __FILE__, __LINE__); \
- } STMT_END
-#endif /* PERL_SET_CONTEXT */
+/*
+ * dTHR is performance-critical. Here, we only do the pthread_get_specific
+ * if there may be more than one thread in existence, otherwise we get thr
+ * from thrsv which is cached in the per-interpreter structure.
+ * Systems with very fast pthread_get_specific (which should be all systems
+ * but unfortunately isn't) may wish to simplify to "...*thr = THR".
+ *
+ * The use of PL_threadnum should be safe here.
+ */
+#ifndef dTHR
+# define dTHR \
+ struct perl_thread *thr = PL_threadnum? THR : (struct perl_thread*)SvPVX(PL_thrsv)
+#endif /* dTHR */
#ifndef INIT_THREADS
# ifdef NEED_PTHREAD_INIT
# define INIT_THREADS pthread_init()
+# else
+# define INIT_THREADS NOOP
# endif
#endif
-#ifndef ALLOC_THREAD_KEY
-# define ALLOC_THREAD_KEY \
- STMT_START { \
- if (pthread_key_create(&PL_thr_key, 0)) { \
- PERL_UNUSED_RESULT(write(2, STR_WITH_LEN("panic: pthread_key_create failed\n"))); \
- exit(1); \
- } \
+/* Accessor for per-thread SVs */
+#define THREADSV(i) (thr->threadsvp[i])
+
+/*
+ * LOCK_SV_MUTEX and UNLOCK_SV_MUTEX are performance-critical. Here, we
+ * try only locking them if there may be more than one thread in existence.
+ * Systems with very fast mutexes (and/or slow conditionals) may wish to
+ * remove the "if (threadnum) ..." test.
+ * XXX do NOT use C<if (PL_threadnum) ...> -- it sets up race conditions!
+ */
+#define LOCK_SV_MUTEX \
+ STMT_START { \
+ MUTEX_LOCK(&PL_sv_mutex); \
} STMT_END
-#endif
-#ifndef FREE_THREAD_KEY
-# define FREE_THREAD_KEY \
- STMT_START { \
- pthread_key_delete(PL_thr_key); \
+#define UNLOCK_SV_MUTEX \
+ STMT_START { \
+ MUTEX_UNLOCK(&PL_sv_mutex); \
} STMT_END
-#endif
-#ifndef PTHREAD_ATFORK
-# ifdef HAS_PTHREAD_ATFORK
-# define PTHREAD_ATFORK(prepare,parent,child) \
- pthread_atfork(prepare,parent,child)
-# else
-# define PTHREAD_ATFORK(prepare,parent,child) \
- NOOP
-# endif
-#endif
+/* Likewise for strtab_mutex */
+#define LOCK_STRTAB_MUTEX \
+ STMT_START { \
+ MUTEX_LOCK(&PL_strtab_mutex); \
+ } STMT_END
+
+#define UNLOCK_STRTAB_MUTEX \
+ STMT_START { \
+ MUTEX_UNLOCK(&PL_strtab_mutex); \
+ } STMT_END
#ifndef THREAD_RET_TYPE
# define THREAD_RET_TYPE void *
# define THREAD_RET_CAST(p) ((void *)(p))
#endif /* THREAD_RET */
-# define LOCK_DOLLARZERO_MUTEX MUTEX_LOCK(&PL_dollarzero_mutex)
-# define UNLOCK_DOLLARZERO_MUTEX MUTEX_UNLOCK(&PL_dollarzero_mutex)
-
-#endif /* USE_ITHREADS */
-
-#ifndef MUTEX_LOCK
-# define MUTEX_LOCK(m)
-#endif
-#ifndef MUTEX_UNLOCK
-# define MUTEX_UNLOCK(m)
-#endif
+/* Values and macros for thr->flags */
+#define THRf_STATE_MASK 7
+#define THRf_R_JOINABLE 0
+#define THRf_R_JOINED 1
+#define THRf_R_DETACHED 2
+#define THRf_ZOMBIE 3
+#define THRf_DEAD 4
-#ifndef MUTEX_INIT
-# define MUTEX_INIT(m)
-#endif
+#define THRf_DID_DIE 8
-#ifndef MUTEX_DESTROY
-# define MUTEX_DESTROY(m)
-#endif
-
-#ifndef COND_INIT
-# define COND_INIT(c)
-#endif
-
-#ifndef COND_SIGNAL
-# define COND_SIGNAL(c)
-#endif
-
-#ifndef COND_BROADCAST
-# define COND_BROADCAST(c)
-#endif
-
-#ifndef COND_WAIT
-# define COND_WAIT(c, m)
-#endif
-
-#ifndef COND_DESTROY
-# define COND_DESTROY(c)
-#endif
-
-#ifndef LOCK_DOLLARZERO_MUTEX
-# define LOCK_DOLLARZERO_MUTEX
-#endif
-
-#ifndef UNLOCK_DOLLARZERO_MUTEX
-# define UNLOCK_DOLLARZERO_MUTEX
-#endif
-
-/* THR, SET_THR, and dTHR are there for compatibility with old versions */
-#ifndef THR
-# define THR PERL_GET_THX
-#endif
+/* ThrSTATE(t) and ThrSETSTATE(t) must only be called while holding t->mutex */
+#define ThrSTATE(t) ((t)->flags & THRf_STATE_MASK)
+#define ThrSETSTATE(t, s) STMT_START { \
+ (t)->flags &= ~THRf_STATE_MASK; \
+ (t)->flags |= (s); \
+ DEBUG_S(PerlIO_printf(PerlIO_stderr(), \
+ "thread %p set to state %d\n", (t), (s))); \
+ } STMT_END
-#ifndef SET_THR
-# define SET_THR(t) PERL_SET_THX(t)
-#endif
+typedef struct condpair {
+ perl_mutex mutex; /* Protects all other fields */
+ perl_cond owner_cond; /* For when owner changes at all */
+ perl_cond cond; /* For cond_signal and cond_broadcast */
+ Thread owner; /* Currently owning thread */
+} condpair_t;
-#ifndef dTHR
-# define dTHR dNOOP
-#endif
+#define MgMUTEXP(mg) (&((condpair_t *)(mg->mg_ptr))->mutex)
+#define MgOWNERCONDP(mg) (&((condpair_t *)(mg->mg_ptr))->owner_cond)
+#define MgCONDP(mg) (&((condpair_t *)(mg->mg_ptr))->cond)
+#define MgOWNER(mg) ((condpair_t *)(mg->mg_ptr))->owner
-#ifndef INIT_THREADS
-# define INIT_THREADS NOOP
+#else
+/* USE_THREADS is not defined */
+#define MUTEX_LOCK(m)
+#define MUTEX_UNLOCK(m)
+#define MUTEX_INIT(m)
+#define MUTEX_DESTROY(m)
+#define COND_INIT(c)
+#define COND_SIGNAL(c)
+#define COND_BROADCAST(c)
+#define COND_WAIT(c, m)
+#define COND_DESTROY(c)
+#define LOCK_SV_MUTEX
+#define UNLOCK_SV_MUTEX
+#define LOCK_STRTAB_MUTEX
+#define UNLOCK_STRTAB_MUTEX
+
+#define THR
+/* Rats: if dTHR is just blank then the subsequent ";" throws an error */
+#ifdef WIN32
+#define dTHR extern int Perl___notused
+#else
+#define dTHR extern int errno
#endif
-
-/*
- * Local variables:
- * c-indentation-style: bsd
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
- * ex: set ts=8 sts=4 sw=4 et:
- */
+#endif /* USE_THREADS */