From: Perl 5 Porters Date: Wed, 2 Apr 1997 22:03:25 +0000 (+1200) Subject: [inseparable changes from match from perl-5.003_97 to perl-5.003_97a] X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=5aabfad66ac77650f584e2f07af91645e19fe296;p=p5sagit%2Fp5-mst-13.2.git [inseparable changes from match from perl-5.003_97 to perl-5.003_97a] CORE PORTABILITY Subject: Add support for Cygwin32 (GNU-Win32) -- very low impact Date: Thu, 3 Apr 1997 09:21:17 +0100 From: John Cerney Files: MANIFEST README.cygwin32 cygwin32/cw32imp.h cygwin32/gcc2 cygwin32/ld2 cygwin32/perlgcc cygwin32/perlld ext/DynaLoader/dl_cygwin32.xs hints/cygwin32.sh perl.h pp_sys.c Msg-ID: 199704030821.JAA08762@pluto.tiuk.ti.com (applied based on p5p patch as commit 2a079e0090406b1b2e50643540f149206c9e9de8) Subject: Win32 update (six patches) From: Gurusamy Sarathy Files: MANIFEST README.win32 dosish.h t/io/fs.t t/io/tell.t t/lib/io_tell.t t/op/magic.t t/op/mkdir.t t/op/runlevel.t t/op/stat.t t/op/taint.t win32/Makefile win32/VC-2.0/pod.mak win32/makedef.pl win32/pod.mak win32/win32.c win32/win32.h win32/win32io.c win32/win32io.h win32/win32iop.h LIBRARY AND EXTENSIONS Subject: Math::Trig, based on (and from an author of) Math::Complex From: Chip Salzenberg Files: MANIFEST lib/Math/Complex.pm lib/Math/Trig.pm pod/perldelta.pod t/lib/complex.t t/lib/trig.t OTHER CORE CHANGES Subject: Fix const-sub-related panic on C From: Chip Salzenberg Files: op.c Subject: Fix warning for useless C<1..2> From: Chip Salzenberg Files: op.c Subject: Minor cleanups Date: Thu, 03 Apr 1997 19:56:57 -0500 From: Gurusamy Sarathy Files: mg.c mg.h perl.c Msg-ID: 199704040056.TAA22253@aatma.engin.umich.edu (applied based on p5p patch as commit 609794497049cf42bdd2396c04cbb7728e10374d) Subject: Eliminate unreliable warning with %SIG and strict refs From: Chip Salzenberg Files: mg.c Subject: Fix impossible test in vivification From: Chip Salzenberg Files: mg.c --- diff --git a/Changes b/Changes index 38c3e0a..8419886 100644 --- a/Changes +++ b/Changes @@ -16,7 +16,7 @@ To save space, and to give due honor to those who have made Perl 5.004 what is is today, here are some of the more common names in the Changes file, and their current addresses (as of March 1997): - Gisle Aas + Gisle Aas Kenneth Albanowski Charles Bailey Graham Barr @@ -24,10 +24,12 @@ file, and their current addresses (as of March 1997): Tim Bunce Tom Christiansen Hallvard B Furuseth + M. J. T. Guy Gurusamy Sarathy Jarkko Hietaniemi Nick Ing-Simmons Andreas Koenig + Doug MacEachern Paul Marquess Jeff Okamoto Ulrich Pfeifer @@ -42,6 +44,133 @@ And the Keepers of the Patch Pumpkin: Chip Salzenberg +------------------- + Version 5.003_97a +------------------- + +This release gets a letter instead of a full subversion because I'm +planning on making 5.003_98 the second public beta. + + CORE LANGUAGE CHANGES + + Title: "Fix AUTOLOAD, or kill me" + From: Chip Salzenberg + Files: gv.c pp.c t/op/method.t + + CORE PORTABILITY + + Title: "Add support for Cygwin32 (GNU-Win32) -- very low impact" + From: John Cerney + Msg-ID: <199704030821.JAA08762@pluto.tiuk.ti.com> + Date: Thu, 3 Apr 1997 09:21:17 +0100 + Files: MANIFEST README.cygwin32 cygwin32/cw32imp.h cygwin32/gcc2 + cygwin32/ld2 cygwin32/perlgcc cygwin32/perlld + ext/DynaLoader/dl_cygwin32.xs hints/cygwin32.sh perl.h + pp_sys.c + + Title: "Win32 update (six patches)" + From: Gurusamy Sarathy + Files: MANIFEST README.win32 dosish.h t/io/fs.t t/io/tell.t + t/lib/io_tell.t t/op/magic.t t/op/mkdir.t t/op/runlevel.t + t/op/stat.t t/op/taint.t win32/Makefile win32/VC-2.0/pod.mak + win32/makedef.pl win32/pod.mak win32/win32.c win32/win32.h + win32/win32io.c win32/win32io.h win32/win32iop.h + + Title: "AmigaOS update" + From: Norbert Pueschel + Msg-ID: <77724828@Armageddon.meb.uni-bonn.de> + Date: Thu, 03 Apr 1997 16:16:51 +0200 + Files: README.amiga hints/amigaos.sh + + OTHER CORE CHANGES + + Title: "Fix const-sub-related panic on C" + From: Chip Salzenberg + Files: op.c + + Title: "Fix warning for useless C<1..2>" + From: Chip Salzenberg + Files: op.c + + Title: "Minor cleanups" + From: Gurusamy Sarathy + Msg-ID: <199704040056.TAA22253@aatma.engin.umich.edu> + Date: Thu, 03 Apr 1997 19:56:57 -0500 + Files: mg.c mg.h perl.c + + Title: "Eliminate unreliable warning with %SIG and strict refs" + From: Chip Salzenberg + Files: mg.c + + Title: "Fix impossible test in vivification" + From: Chip Salzenberg + Files: mg.c + + Title: "runlevel is I32, not int" + From: Roderick Schertler + Msg-ID: <2848.860109823@eeyore.ibcinc.com> + Date: Thu, 03 Apr 1997 18:23:43 -0500 + Files: pp_ctl.c util.c + + BUILD PROCESS + + Title: "Re: shared lib compilation problem with miniperl5.003_97" + From: Andy Dougherty + Msg-ID: " + From: Chip Salzenberg and Tim Bunce + Files: lib/AutoLoader.pm + + Title: "CPAN & TRL-Gnu" + From: Achim Bohnet + Msg-ID: <9704040809.AA26143@o09.rosat.mpe-garching.mpg.de> + Date: Fri, 04 Apr 1997 10:09:03 +0200 + Files: lib/CPAN.pm + + Title: "Limit @ISA to actual DBM in AnyDBM" + From: Chip Salzenberg + Files: lib/AnyDBM_File.pm + + Title: "Don't use $4 when it might be undef" + From: Chip Salzenberg + Files: lib/bigfloat.pl + + TESTS + + Title: "Make *dbm tests work with Win32" + From: Chip Salzenberg + Files: t/lib/anydbm.t t/lib/gdbm.t t/lib/ndbm.t t/lib/odbm.t + t/lib/sdbm.t + + UTILITIES + + (no changes) + + DOCUMENTATION + + Title: "Update INSTALL" + From: Andy Dougherty + Files: INSTALL + + Title: "Pod style" + From: Nathan Torkington + Files: pod/perlcall.pod pod/perldata.pod pod/perldebug.pod + pod/perldiag.pod pod/perlform.pod pod/perlfunc.pod + pod/perlipc.pod pod/perllocale.pod pod/perlmod.pod + pod/perlop.pod pod/perlre.pod pod/perlrun.pod + pod/perlstyle.pod pod/perltoc.pod pod/perlvar.pod + + ------------------ Version 5.003_97 ------------------ @@ -291,7 +420,7 @@ And the Keepers of the Patch Pumpkin: Files: perl.h pp_sys.c Title: "Eliminate unused dummy variable" - From: Doug MacEachern + From: Doug MacEachern Msg-ID: <199703270123.UAA25454@postman.osf.org> Date: Wed, 26 Mar 1997 20:23:14 -0500 Files: lib/ExtUtils/Embed.pm unixish.h writemain.SH @@ -529,7 +658,7 @@ And the Keepers of the Patch Pumpkin: Files: lib/Pod/Text.pm Title: "Exporting UNIVERSAL::can" - From: "M.J.T. Guy" + From: "M.J.T. Guy" Msg-ID: Date: Mon, 24 Mar 1997 17:54:01 +0000 Files: lib/UNIVERSAL.pm @@ -579,13 +708,13 @@ And the Keepers of the Patch Pumpkin: Files: pod/perldelta.pod Title: "pods for subroutine argument autovivication" - From: "M.J.T. Guy" + From: "M.J.T. Guy" Msg-ID: Date: Mon, 24 Mar 1997 07:25:21 +0000 Files: pod/perldelta.pod pod/perlsub.pod Title: "Missing item in perldiag" - From: "M.J.T. Guy" + From: "M.J.T. Guy" Msg-ID: Date: Sun, 23 Mar 1997 09:24:09 +0000 Files: pod/perldiag.pod @@ -756,7 +885,7 @@ And the Keepers of the Patch Pumpkin: x2p/util.c Title: "Warn about missing -DMULTIPLICITY if likely a problem" - From: Doug MacEachern + From: Doug MacEachern Msg-ID: <199703192345.SAA15070@postman.osf.org> Date: Wed, 19 Mar 1997 18:45:53 -0500 Files: perl.c @@ -834,7 +963,7 @@ And the Keepers of the Patch Pumpkin: Files: lib/File/Path.pm Title: "Fix typo in -l*perl* pattern" - From: Doug MacEachern + From: Doug MacEachern Msg-ID: <199703110414.XAA12884@berlin.atlantic.net> Date: Mon, 10 Mar 1997 22:58:38 -0500 Files: lib/ExtUtils/Embed.pm @@ -865,7 +994,7 @@ And the Keepers of the Patch Pumpkin: Files: lib/Carp.pm Title: "Re: NUL in die and other messages" - From: "M.J.T. Guy" + From: "M.J.T. Guy" Msg-ID: Date: Fri, 21 Mar 1997 09:58:17 +0000 Files: lib/Carp.pm @@ -875,7 +1004,7 @@ And the Keepers of the Patch Pumpkin: Files: lib/Pod/Functions.pm Title: "Fix typos in IO::Socket documentation" - From: "M.J.T. Guy" + From: "M.J.T. Guy" Msg-ID: Date: Tue, 18 Mar 1997 20:50:16 +0000 Files: ext/IO/lib/IO/Socket.pm @@ -920,7 +1049,7 @@ And the Keepers of the Patch Pumpkin: Files: pod/perldelta.pod Title: "Re: Embedding success with _93 " - From: Doug MacEachern + From: Doug MacEachern Msg-ID: <199703112255.RAA22775@postman.osf.org> Date: Tue, 11 Mar 1997 17:55:05 -0500 Files: pod/perldelta.pod @@ -968,7 +1097,7 @@ And the Keepers of the Patch Pumpkin: Files: pod/perlcall.pod pod/perlguts.pod pod/perlxstut.pod Title: "Document return from do FILE" - From: "M.J.T. Guy" + From: "M.J.T. Guy" Msg-ID: Date: Tue, 18 Mar 1997 14:50:10 +0000 Files: pod/perlfunc.pod @@ -1022,7 +1151,7 @@ Me, now: Files: op.c pod/perldelta.pod pod/perlsub.pod pod/perltrap.pod Title: "Support READ and GETC for tied handles" - From: Doug MacEachern + From: Doug MacEachern Msg-ID: <199703090019.TAA32591@postman.osf.org> Date: Sat, 08 Mar 1997 19:19:38 -0500 Files: pod/perldelta.pod pod/perltie.pod pp_sys.c t/op/misc.t @@ -1096,7 +1225,7 @@ Me, now: LIBRARY AND EXTENSIONS Title: "Carp with multiple arguments" - From: "M.J.T. Guy" + From: "M.J.T. Guy" Msg-ID: Date: Sat, 8 Mar 1997 20:12:17 +0000 Files: lib/Carp.pm @@ -1501,7 +1630,7 @@ This is (should be? must be!) the public beta of 5.004. Files: lib/IPC/Open3.pm Title: "Follow up on elimination of $` $& $' in libraries" - From: "M.J.T. Guy" + From: "M.J.T. Guy" Msg-ID: Date: Fri, 28 Feb 1997 13:59:42 +0000 Files: lib/Getopt/Long.pm lib/diagnostics.pm @@ -1513,7 +1642,7 @@ This is (should be? must be!) the public beta of 5.004. Files: lib/ExtUtils/MakeMaker.pm Title: "Allow explicit '-lperl' in link arguments" - From: Doug MacEachern + From: Doug MacEachern Msg-ID: <199702271625.LAA25402@postman.osf.org> Date: Thu, 27 Feb 1997 11:25:04 -0500 Files: lib/ExtUtils/Embed.pm @@ -3227,7 +3356,7 @@ significant changes: Files: MANIFEST pod/roffitall pod/rofftoc Title: "Re: documentation correction (i.e. patch) for perlsyn.pod" - From: "M.J.T. Guy" + From: "M.J.T. Guy" Msg-ID: Date: Fri, 10 Jan 1997 18:06:37 +0000 Files: pod/perlsyn.pod @@ -3304,7 +3433,7 @@ updates, and expanded tests. This is good stuff. "I love you, man!" Files: perly.c perly.c.diff perly.y Title: "plug for safe/opcode leaks" - From: Doug MacEachern + From: Doug MacEachern Msg-ID: <199701072220.RAA02117@postman.osf.org> Date: Tue, 07 Jan 1997 17:20:46 -0500 Files: op.c @@ -3485,7 +3614,7 @@ Here's a list of the more significant changes... Files: op.c pod/perldiag.pod Title: "5.003_18: perl_{con,des}truct fixes" - From: Doug MacEachern + From: Doug MacEachern Msg-ID: <199701032042.PAA06766@postman.osf.org> Date: Fri, 03 Jan 1997 15:42:04 -0500 Files: perl.c perl.h pod/perlembed.pod pod/perltoc.pod t/op/sysio.t diff --git a/MANIFEST b/MANIFEST index d67c42d..22c7eab 100644 --- a/MANIFEST +++ b/MANIFEST @@ -17,6 +17,7 @@ Porting/Glossary Glossary of config.sh variables Porting/pumpkin.pod Guidelines and hints for Perl maintainers README The Instructions README.amiga Notes about AmigaOS port +README.cygwin32 Notes about Cygwin32 port README.os2 Notes about OS/2 port README.plan9 Notes about Plan9 port README.qnx Notes about QNX port @@ -33,6 +34,11 @@ config_h.SH Produces config.h configpm Produces lib/Config.pm cop.h Control operator header cv.h Code value header +cygwin32/cw32imp.h Cygwin32 port +cygwin32/gcc2 Cygwin32 port +cygwin32/ld2 Cygwin32 port +cygwin32/perlgcc Cygwin32 port +cygwin32/perlld Cygwin32 port deb.c Debugging routines doio.c I/O operations doop.c Support code for various operations @@ -112,6 +118,7 @@ ext/DynaLoader/DynaLoader.pm Dynamic Loader perl module ext/DynaLoader/Makefile.PL Dynamic Loader makefile writer ext/DynaLoader/README Dynamic Loader notes and intro ext/DynaLoader/dl_aix.xs AIX implementation +ext/DynaLoader/dl_cygwin32.xs Cygwin32 implementation ext/DynaLoader/dl_dld.xs GNU dld style implementation ext/DynaLoader/dl_dlopen.xs BSD/SunOS4&5 dlopen() style implementation ext/DynaLoader/dl_hpux.xs HP-UX implementation @@ -231,6 +238,7 @@ hints/broken-db.msg Warning message for systems with broken DB library hints/bsdos.sh Hints for named architecture hints/convexos.sh Hints for named architecture hints/cxux.sh Hints for named architecture +hints/cygwin32.sh Hints for named architecture hints/dcosx.sh Hints for named architecture hints/dec_osf.sh Hints for named architecture hints/dgux.sh Hints for named architecture @@ -351,6 +359,7 @@ lib/IPC/Open3.pm Open a three-ended pipe! lib/Math/BigFloat.pm An arbitrary precision floating-point arithmetic package lib/Math/BigInt.pm An arbitrary precision integer arithmetic package lib/Math/Complex.pm A Complex package +lib/Math/Trig.pm A simple interface to complex trigonometry lib/Net/Ping.pm Hello, anybody home? lib/Net/hostent.pm By-name interface to Perl's built-in gethost* lib/Net/netent.pm By-name interface to Perl's built-in getnet* @@ -676,6 +685,7 @@ t/lib/symbol.t See if Symbol works t/lib/texttabs.t See if Text::Tabs works t/lib/textwrap.t See if Text::Wrap works t/lib/timelocal.t See if Time::Local works +t/lib/trig.t See if Math::Trig works t/op/append.t See if . works t/op/arith.t See if arithmetic works t/op/array.t See if array operations work @@ -818,6 +828,7 @@ win32/VC-2.0/modules.mak Win32 port win32/VC-2.0/perl.mak Win32 port win32/VC-2.0/perldll.mak Win32 port win32/VC-2.0/perlglob.mak Win32 port +win32/VC-2.0/pod.mak Win32 port win32/autosplit.pl Win32 port win32/bin/network.pl Win32 port win32/bin/pl2bat.bat Win32 port @@ -846,6 +857,7 @@ win32/perldll.mak Win32 port win32/perlglob.c Win32 port win32/perlglob.mak Win32 port win32/perllib.c Win32 port +win32/pod.mak Win32 port win32/runperl.c Win32 port win32/splittree.pl Win32 port win32/win32.c Win32 port diff --git a/README.cygwin32 b/README.cygwin32 new file mode 100644 index 0000000..d7950f6 --- /dev/null +++ b/README.cygwin32 @@ -0,0 +1,59 @@ +The following assumes you have the GNU-Win32 package, version b17.1 or +later, installed and configured on your system. See +http://www.cygnus.com/misc/gnu-win32/ for details on the GNU-Win32 +project and the Cygwin32 API. + +1) Copy the contents of the cygwin32 directory to the Perl source + root directory. + +2) Modify the ld2 script by making the PERLPATH variable contain the + Perl source root directory. For example, if you extracted perl to + "/perl5.004", change the script so it contains the line: + + PERLPATH=/perl5.004 + +3) Copy the two scripts ld2 and gcc2 from the cygwin32 subdirectory to a + directory in your PATH environment variable. For example, copy to + /bin, assuming /bin is in your PATH. (These two scripts are 'wrapper' + scripts that encapsulate the multiple-pass dll building steps used by + GNU-Win32 ld/gcc.) + +4) Run the perl Configuration script as stated in the perl README file: + + sh Configure + + When confronted with this prompt: + + First time through, eh? I have some defaults handy for the + following systems: + . + . + . + Which of these apply, if any? + + Select "cygwin32". + + The defaults should be OK for everything, except for the specific + pathnames for the cygwin32 libs, include files, installation dirs, + etc. on your system; answer those questions appropriately. + + NOTE: On windows 95, the configuration script only stops every other + time for responses from the command line. In this case you can manually + copy hints/cygwin32.sh to config.sh, edit config.sh for your paths, and + run Configure non-interactively using sh Configure -d. + +5) Run "make" as stated in the perl README file. + +6) Run "make test". Some tests will fail, but you should get around a + 83% success rate. (Most failures seem to be due to Unixisms that don't + apply to win32.) + +7) Install. If you just run "perl installperl", it appears that perl + can't find itself when it forks because it changes to another directory + during the install process. You can get around this by invoking the + install script using a full pathname for perl, such as: + + /perl5.004/perl installperl + + This should complete the installation process. + diff --git a/README.win32 b/README.win32 index 82c9bac..63763cd 100644 --- a/README.win32 +++ b/README.win32 @@ -4,12 +4,17 @@ specially designed to be readable as is. =head1 NAME -perlwin32 - Perl under WindowsNT [XXX and perhaps under Windows95] +perlwin32 - Perl under Win32 =head1 SYNOPSIS These are instructions for building Perl under WindowsNT (versions -3.51 or 4.0), using Visual C++. +3.51 or 4.0), using Visual C++ (versions 2.0 through 5.0). Currently, +this port may also build under Windows95, but you can expect problems +stemming from the unmentionable command shell that infests that +platform. Note this caveat is only about B perl. Once +built, you should be able to B it on either Win32 platform (modulo +the problems arising from the inferior command shell). =head1 DESCRIPTION @@ -37,7 +42,11 @@ port of Perl to Win32 platforms. The resulting Perl requires no additional software to run (other than what came with your operating system). Currently, this port is only capable of using Microsoft's Visual C++ compiler. The ultimate goal is to support the other major -compilers that can be used on the platforms. +compilers that can be used to build Win32 applications. + +This port currently supports MakeMaker (the set of modules that +is used to build extensions to perl). Therefore, you should be +able to build and install most extensions found in the CPAN sites. =head2 Setting Up @@ -47,7 +56,8 @@ compilers that can be used on the platforms. Use the default "cmd" shell that comes with NT. In particular, do *not* use the 4DOS/NT shell. The Makefile has commands that are not -compatible with that shell. +compatible with that shell. You are mostly on your own if you can +muster the temerity to attempt this with Windows95. =item * @@ -128,34 +138,25 @@ PATH environment variable to C:\PERL\BIN (or D:\FOO\PERL\BIN). =head2 Testing Type "nmake test". This will run most of the tests from the -testsuite (many tests will be skipped, and some tests will fail). -Most failures are due to UNIXisms in the standard perl testsuite. +testsuite (many tests will be skipped, and a few tests may fail). -To get a more detailed breakdown of the tests that failed, say: +To get a more detailed breakdown of the tests that failed, +you may want to say: cd ..\t .\perl harness -This should produce a summary very similar to the following: +This should produce a summary of the failed tests. Currently, the +only known failure is lib\findbin.t: Failed Test Status Wstat Total Fail Failed List of failed ------------------------------------------------------------------------------ - io/fs.t 26 16 61.54% 1-5, 7-11, 16-18, 23-25 - lib/anydbm.t 12 1 8.33% 2 lib/findbin.t 1 1 100.00% 1 - lib/sdbm.t 12 1 8.33% 2 - op/magic.t 28 1 3.57% 16 - op/mkdir.t 7 2 28.57% 3, 7 - op/runlevel.t 8 1 12.50% 4 - op/stat.t 56 3 5.36% 2-3, 20 - op/taint.t 98 20 20.41% 1-6, 14, 16, 19-21, 24, 26, 35-3 - pragma/locale.t 98 40 40.82% 1, 13-14, 21-27, 33, 39, 45-53, - Failed 10/149 test scripts, 93.29% okay. 86/3871 subtests failed, 97.78% okay. + Failed 1/151 test scripts, 99.34% okay. 1/3902 subtests failed, 99.97% okay. Check if any additional tests other than the ones shown here -failed. The standard testsuite will ultimately be modified so -that the testsuite avoids running irrelevant tests on Win32. +failed, and report them as described under L. =head1 BUGS AND CAVEATS @@ -166,9 +167,9 @@ utilities/modules, and supported perl functionality. Specifically, functionality that supports the Win32 environment may ultimately be supported as either core modules or extensions. -Many tests from the standard testsuite either fail or produce different -results under this port. Most of the problems fall under one of these -categories +If you have had prior exposure to Perl on Unix platforms, this port +may exhibit behavior different from what is documented. Most of the +differences fall under one of these categories. =over 8 @@ -181,9 +182,10 @@ platforms, and some fields may be completely bogus. =item * The following functions are currently unavailable: C, C, -C, C, C, C, C, C, +C, C, C, C, C, C, C, C, C, -C, C, C. This list is possibly incomplete. +C, C, C. This list is possibly very +incomplete. =item * @@ -201,7 +203,10 @@ when used to call interactive commands, is ill-defined. =item * -C<$!> doesn't work reliably yet. +C<$?> ends up with the exitstatus of the subprocess (this is different +from Unix, where the exitstatus is actually given by "$? >> 8"). +Failure to spawn() the subprocess is indicated by setting $? to +"255<<8". This is subject to change. =item * @@ -259,7 +264,7 @@ at the time. Nick Ing-Simmons and Gurusamy Sarathy have made numerous and sundry hacks since then. -Last updated: 19 March 1997 +Last updated: 04 April 1997 =cut diff --git a/cygwin32/cw32imp.h b/cygwin32/cw32imp.h new file mode 100644 index 0000000..1fb11d3 --- /dev/null +++ b/cygwin32/cw32imp.h @@ -0,0 +1,356 @@ +/* include file for building of extension libs using GNU-Win32 toolkit, + which is based on the Cygnus Cygwin32 API. This file is included by + the extension dlls when they are built. Global vars defined in perl + exe are referenced by the extension module dll by using __imp_varName, + where varName is the name of the global variable in perl.exe. + GNU-Win32 has no equivalent to MSVC's __declspec(dllimport) keyword to + define a imported global, so we have to use this approach to access + globals exported by perl.exe. + -jc 4/1/97 +*/ + +#define impure_setupptr (*__imp_impure_setupptr) +#define Perl_reall_srchlen (*__imp_Perl_reall_srchlen) +#define Perl_yychar (*__imp_Perl_yychar) +#define Perl_yycheck (*__imp_Perl_yycheck) +#define Perl_yydebug (*__imp_Perl_yydebug) +#define Perl_yydefred (*__imp_Perl_yydefred) +#define Perl_yydgoto (*__imp_Perl_yydgoto) +#define Perl_yyerrflag (*__imp_Perl_yyerrflag) +#define Perl_yygindex (*__imp_Perl_yygindex) +#define Perl_yylen (*__imp_Perl_yylen) +#define Perl_yylhs (*__imp_Perl_yylhs) +#define Perl_yylval (*__imp_Perl_yylval) +#define Perl_yynerrs (*__imp_Perl_yynerrs) +#define Perl_yyrindex (*__imp_Perl_yyrindex) +#define Perl_yysindex (*__imp_Perl_yysindex) +#define Perl_yytable (*__imp_Perl_yytable) +#define Perl_yyval (*__imp_Perl_yyval) +#define Perl_regarglen (*__imp_Perl_regarglen) +#define Perl_regdummy (*__imp_Perl_regdummy) +#define Perl_regkind (*__imp_Perl_regkind) +#define Perl_simple (*__imp_Perl_simple) +#define Perl_varies (*__imp_Perl_varies) +#define Perl_watchaddr (*__imp_Perl_watchaddr) +#define Perl_watchok (*__imp_Perl_watchok) +#define Argv (*__imp_Argv) +#define Cmd (*__imp_Cmd) +#define DBgv (*__imp_DBgv) +#define DBline (*__imp_DBline) +#define DBsignal (*__imp_DBsignal) +#define DBsingle (*__imp_DBsingle) +#define DBsub (*__imp_DBsub) +#define DBtrace (*__imp_DBtrace) +#define Error (*__imp_Error) +#define Perl_AMG_names (*__imp_Perl_AMG_names) +#define Perl_No (*__imp_Perl_No) +#define Perl_Sv (*__imp_Perl_Sv) +#define Perl_Xpv (*__imp_Perl_Xpv) +#define Perl_Yes (*__imp_Perl_Yes) +#define Perl_amagic_generation (*__imp_Perl_amagic_generation) +#define Perl_an (*__imp_Perl_an) +#define Perl_buf (*__imp_Perl_buf) +#define Perl_bufend (*__imp_Perl_bufend) +#define Perl_bufptr (*__imp_Perl_bufptr) +#define Perl_check (*__imp_Perl_check) +#define Perl_collation_ix (*__imp_Perl_collation_ix) +#define Perl_collation_name (*__imp_Perl_collation_name) +#define Perl_collation_standard (*__imp_Perl_collation_standard) +#define Perl_collxfrm_base (*__imp_Perl_collxfrm_base) +#define Perl_collxfrm_mult (*__imp_Perl_collxfrm_mult) +#define Perl_compcv (*__imp_Perl_compcv) +#define Perl_compiling (*__imp_Perl_compiling) +#define Perl_comppad (*__imp_Perl_comppad) +#define Perl_comppad_name (*__imp_Perl_comppad_name) +#define Perl_comppad_name_fill (*__imp_Perl_comppad_name_fill) +#define Perl_cop_seqmax (*__imp_Perl_cop_seqmax) +#define Perl_curcop (*__imp_Perl_curcop) +#define Perl_curcopdb (*__imp_Perl_curcopdb) +#define Perl_curinterp (*__imp_Perl_curinterp) +#define Perl_curpad (*__imp_Perl_curpad) +#define Perl_dc (*__imp_Perl_dc) +#define Perl_di (*__imp_Perl_di) +#define Perl_ds (*__imp_Perl_ds) +#define Perl_egid (*__imp_Perl_egid) +#define Perl_envgv (*__imp_Perl_envgv) +#define Perl_error_count (*__imp_Perl_error_count) +#define Perl_euid (*__imp_Perl_euid) +#define Perl_evalseq (*__imp_Perl_evalseq) +#define Perl_expect (*__imp_Perl_expect) +#define Perl_fold_locale (*__imp_Perl_fold_locale) +#define Perl_gid (*__imp_Perl_gid) +#define Perl_he_root (*__imp_Perl_he_root) +#define Perl_hexdigit (*__imp_Perl_hexdigit) +#define Perl_hints (*__imp_Perl_hints) +#define Perl_in_my (*__imp_Perl_in_my) +#define Perl_last_lop (*__imp_Perl_last_lop) +#define Perl_last_lop_op (*__imp_Perl_last_lop_op) +#define Perl_last_uni (*__imp_Perl_last_uni) +#define Perl_lex_brackets (*__imp_Perl_lex_brackets) +#define Perl_lex_brackstack (*__imp_Perl_lex_brackstack) +#define Perl_lex_casemods (*__imp_Perl_lex_casemods) +#define Perl_lex_casestack (*__imp_Perl_lex_casestack) +#define Perl_lex_defer (*__imp_Perl_lex_defer) +#define Perl_lex_dojoin (*__imp_Perl_lex_dojoin) +#define Perl_lex_expect (*__imp_Perl_lex_expect) +#define Perl_lex_fakebrack (*__imp_Perl_lex_fakebrack) +#define Perl_lex_formbrack (*__imp_Perl_lex_formbrack) +#define Perl_lex_inpat (*__imp_Perl_lex_inpat) +#define Perl_lex_inwhat (*__imp_Perl_lex_inwhat) +#define Perl_lex_op (*__imp_Perl_lex_op) +#define Perl_lex_repl (*__imp_Perl_lex_repl) +#define Perl_lex_starts (*__imp_Perl_lex_starts) +#define Perl_lex_state (*__imp_Perl_lex_state) +#define Perl_lex_stuff (*__imp_Perl_lex_stuff) +#define Perl_linestr (*__imp_Perl_linestr) +#define Perl_markstack (*__imp_Perl_markstack) +#define Perl_markstack_max (*__imp_Perl_markstack_max) +#define Perl_markstack_ptr (*__imp_Perl_markstack_ptr) +#define Perl_max_intro_pending (*__imp_Perl_max_intro_pending) +#define Perl_maxo (*__imp_Perl_maxo) +#define Perl_min_intro_pending (*__imp_Perl_min_intro_pending) +#define Perl_multi_close (*__imp_Perl_multi_close) +#define Perl_multi_end (*__imp_Perl_multi_end) +#define Perl_multi_open (*__imp_Perl_multi_open) +#define Perl_multi_start (*__imp_Perl_multi_start) +#define Perl_na (*__imp_Perl_na) +#define Perl_nexttoke (*__imp_Perl_nexttoke) +#define Perl_nexttype (*__imp_Perl_nexttype) +#define Perl_nextval (*__imp_Perl_nextval) +#define Perl_nomemok (*__imp_Perl_nomemok) +#define Perl_numeric_local (*__imp_Perl_numeric_local) +#define Perl_numeric_name (*__imp_Perl_numeric_name) +#define Perl_numeric_standard (*__imp_Perl_numeric_standard) +#define Perl_oldbufptr (*__imp_Perl_oldbufptr) +#define Perl_oldoldbufptr (*__imp_Perl_oldoldbufptr) +#define Perl_op (*__imp_Perl_op) +#define Perl_op_desc (*__imp_Perl_op_desc) +#define Perl_op_name (*__imp_Perl_op_name) +#define Perl_op_seqmax (*__imp_Perl_op_seqmax) +#define Perl_opargs (*__imp_Perl_opargs) +#define Perl_origalen (*__imp_Perl_origalen) +#define Perl_origenviron (*__imp_Perl_origenviron) +#define Perl_osname (*__imp_Perl_osname) +#define Perl_padix (*__imp_Perl_padix) +#define Perl_patleave (*__imp_Perl_patleave) +#define Perl_pidstatus (*__imp_Perl_pidstatus) +#define Perl_ppaddr (*__imp_Perl_ppaddr) +#define Perl_profiledata (*__imp_Perl_profiledata) +#define Perl_psig_name (*__imp_Perl_psig_name) +#define Perl_psig_ptr (*__imp_Perl_psig_ptr) +#define Perl_regbol (*__imp_Perl_regbol) +#define Perl_regcode (*__imp_Perl_regcode) +#define Perl_regendp (*__imp_Perl_regendp) +#define Perl_regeol (*__imp_Perl_regeol) +#define Perl_reginput (*__imp_Perl_reginput) +#define Perl_reglastparen (*__imp_Perl_reglastparen) +#define Perl_regnaughty (*__imp_Perl_regnaughty) +#define Perl_regnpar (*__imp_Perl_regnpar) +#define Perl_regparse (*__imp_Perl_regparse) +#define Perl_regprecomp (*__imp_Perl_regprecomp) +#define Perl_regprev (*__imp_Perl_regprev) +#define Perl_regsawback (*__imp_Perl_regsawback) +#define Perl_regsize (*__imp_Perl_regsize) +#define Perl_regstartp (*__imp_Perl_regstartp) +#define Perl_regtill (*__imp_Perl_regtill) +#define Perl_regxend (*__imp_Perl_regxend) +#define Perl_retstack (*__imp_Perl_retstack) +#define Perl_retstack_ix (*__imp_Perl_retstack_ix) +#define Perl_retstack_max (*__imp_Perl_retstack_max) +#define Perl_rsfp (*__imp_Perl_rsfp) +#define Perl_rsfp_filters (*__imp_Perl_rsfp_filters) +#define Perl_savestack (*__imp_Perl_savestack) +#define Perl_savestack_ix (*__imp_Perl_savestack_ix) +#define Perl_savestack_max (*__imp_Perl_savestack_max) +#define Perl_scopestack (*__imp_Perl_scopestack) +#define Perl_scopestack_ix (*__imp_Perl_scopestack_ix) +#define Perl_scopestack_max (*__imp_Perl_scopestack_max) +#define Perl_scrgv (*__imp_Perl_scrgv) +#define Perl_sh_path (*__imp_Perl_sh_path) +#define Perl_sig_name (*__imp_Perl_sig_name) +#define Perl_sig_num (*__imp_Perl_sig_num) +#define Perl_siggv (*__imp_Perl_siggv) +#define Perl_stack_base (*__imp_Perl_stack_base) +#define Perl_stack_max (*__imp_Perl_stack_max) +#define Perl_stack_sp (*__imp_Perl_stack_sp) +#define Perl_statbuf (*__imp_Perl_statbuf) +#define Perl_sub_generation (*__imp_Perl_sub_generation) +#define Perl_subline (*__imp_Perl_subline) +#define Perl_subname (*__imp_Perl_subname) +#define Perl_sv_no (*__imp_Perl_sv_no) +#define Perl_sv_undef (*__imp_Perl_sv_undef) +#define Perl_sv_yes (*__imp_Perl_sv_yes) +#define Perl_tainting (*__imp_Perl_tainting) +#define Perl_thisexpr (*__imp_Perl_thisexpr) +#define Perl_timesbuf (*__imp_Perl_timesbuf) +#define Perl_tokenbuf (*__imp_Perl_tokenbuf) +#define Perl_uid (*__imp_Perl_uid) +#define Perl_vert (*__imp_Perl_vert) +#define Perl_vtbl_amagic (*__imp_Perl_vtbl_amagic) +#define Perl_vtbl_amagicelem (*__imp_Perl_vtbl_amagicelem) +#define Perl_vtbl_arylen (*__imp_Perl_vtbl_arylen) +#define Perl_vtbl_bm (*__imp_Perl_vtbl_bm) +#define Perl_vtbl_collxfrm (*__imp_Perl_vtbl_collxfrm) +#define Perl_vtbl_dbline (*__imp_Perl_vtbl_dbline) +#define Perl_vtbl_env (*__imp_Perl_vtbl_env) +#define Perl_vtbl_envelem (*__imp_Perl_vtbl_envelem) +#define Perl_vtbl_fm (*__imp_Perl_vtbl_fm) +#define Perl_vtbl_glob (*__imp_Perl_vtbl_glob) +#define Perl_vtbl_isa (*__imp_Perl_vtbl_isa) +#define Perl_vtbl_isaelem (*__imp_Perl_vtbl_isaelem) +#define Perl_vtbl_itervar (*__imp_Perl_vtbl_itervar) +#define Perl_vtbl_mglob (*__imp_Perl_vtbl_mglob) +#define Perl_vtbl_nkeys (*__imp_Perl_vtbl_nkeys) +#define Perl_vtbl_pack (*__imp_Perl_vtbl_pack) +#define Perl_vtbl_packelem (*__imp_Perl_vtbl_packelem) +#define Perl_vtbl_pos (*__imp_Perl_vtbl_pos) +#define Perl_vtbl_sig (*__imp_Perl_vtbl_sig) +#define Perl_vtbl_sigelem (*__imp_Perl_vtbl_sigelem) +#define Perl_vtbl_substr (*__imp_Perl_vtbl_substr) +#define Perl_vtbl_sv (*__imp_Perl_vtbl_sv) +#define Perl_vtbl_taint (*__imp_Perl_vtbl_taint) +#define Perl_vtbl_uvar (*__imp_Perl_vtbl_uvar) +#define Perl_vtbl_vec (*__imp_Perl_vtbl_vec) +#define Perl_xiv_arenaroot (*__imp_Perl_xiv_arenaroot) +#define Perl_xiv_root (*__imp_Perl_xiv_root) +#define Perl_xnv_root (*__imp_Perl_xnv_root) +#define Perl_xpv_root (*__imp_Perl_xpv_root) +#define Perl_xrv_root (*__imp_Perl_xrv_root) +#define ampergv (*__imp_ampergv) +#define argvgv (*__imp_argvgv) +#define argvoutgv (*__imp_argvoutgv) +#define basetime (*__imp_basetime) +#define beginav (*__imp_beginav) +#define bodytarget (*__imp_bodytarget) +#define cddir (*__imp_cddir) +#define chopset (*__imp_chopset) +#define comppad_name_floor (*__imp_comppad_name_floor) +#define copline (*__imp_copline) +#define curpm (*__imp_curpm) +#define curstack (*__imp_curstack) +#define curstash (*__imp_curstash) +#define curstname (*__imp_curstname) +#define cxstack (*__imp_cxstack) +#define cxstack_ix (*__imp_cxstack_ix) +#define cxstack_max (*__imp_cxstack_max) +#define dbargs (*__imp_dbargs) +#define debdelim (*__imp_debdelim) +#define debname (*__imp_debname) +#define debstash (*__imp_debstash) +#define debug (*__imp_debug) +#define defgv (*__imp_defgv) +#define defoutgv (*__imp_defoutgv) +#define defstash (*__imp_defstash) +#define delaymagic (*__imp_delaymagic) +#define diehook (*__imp_diehook) +#define dirty (*__imp_dirty) +#define dlevel (*__imp_dlevel) +#define dlmax (*__imp_dlmax) +#define do_undump (*__imp_do_undump) +#define doextract (*__imp_doextract) +#define doswitches (*__imp_doswitches) +#define dowarn (*__imp_dowarn) +#define dumplvl (*__imp_dumplvl) +#define e_fp (*__imp_e_fp) +#define e_tmpname (*__imp_e_tmpname) +#define endav (*__imp_endav) +#define errgv (*__imp_errgv) +#define eval_root (*__imp_eval_root) +#define eval_start (*__imp_eval_start) +#define fdpid (*__imp_fdpid) +#define filemode (*__imp_filemode) +#define firstgv (*__imp_firstgv) +#define forkprocess (*__imp_forkprocess) +#define formfeed (*__imp_formfeed) +#define formtarget (*__imp_formtarget) +#define gensym (*__imp_gensym) +#define in_eval (*__imp_in_eval) +#define incgv (*__imp_incgv) +#define inplace (*__imp_inplace) +#define last_in_gv (*__imp_last_in_gv) +#define lastfd (*__imp_lastfd) +#define lastscream (*__imp_lastscream) +#define lastsize (*__imp_lastsize) +#define lastspbase (*__imp_lastspbase) +#define laststatval (*__imp_laststatval) +#define laststype (*__imp_laststype) +#define leftgv (*__imp_leftgv) +#define lineary (*__imp_lineary) +#define localizing (*__imp_localizing) +#define localpatches (*__imp_localpatches) +#define main_cv (*__imp_main_cv) +#define main_root (*__imp_main_root) +#define main_start (*__imp_main_start) +#define mainstack (*__imp_mainstack) +#define maxscream (*__imp_maxscream) +#define maxsysfd (*__imp_maxsysfd) +#define minus_F (*__imp_minus_F) +#define minus_a (*__imp_minus_a) +#define minus_c (*__imp_minus_c) +#define minus_l (*__imp_minus_l) +#define minus_n (*__imp_minus_n) +#define minus_p (*__imp_minus_p) +#define multiline (*__imp_multiline) +#define mystack_base (*__imp_mystack_base) +#define mystack_max (*__imp_mystack_max) +#define mystack_sp (*__imp_mystack_sp) +#define mystrk (*__imp_mystrk) +#define nice_chunk (*__imp_nice_chunk) +#define nice_chunk_size (*__imp_nice_chunk_size) +#define nrs (*__imp_nrs) +#define ofmt (*__imp_ofmt) +#define ofs (*__imp_ofs) +#define ofslen (*__imp_ofslen) +#define oldlastpm (*__imp_oldlastpm) +#define oldname (*__imp_oldname) +#define op_mask (*__imp_op_mask) +#define origargc (*__imp_origargc) +#define origargv (*__imp_origargv) +#define origfilename (*__imp_origfilename) +#define ors (*__imp_ors) +#define orslen (*__imp_orslen) +#define pad_reset_pending (*__imp_pad_reset_pending) +#define padix_floor (*__imp_padix_floor) +#define parsehook (*__imp_parsehook) +#define patchlevel (*__imp_patchlevel) +#define perl_destruct_level (*__imp_perl_destruct_level) +#define perldb (*__imp_perldb) +#define preambleav (*__imp_preambleav) +#define preambled (*__imp_preambled) +#define preprocess (*__imp_preprocess) +#define regflags (*__imp_regflags) +#define restartop (*__imp_restartop) +#define rightgv (*__imp_rightgv) +#define rs (*__imp_rs) +#define runlevel (*__imp_runlevel) +#define sawampersand (*__imp_sawampersand) +#define sawstudy (*__imp_sawstudy) +#define sawvec (*__imp_sawvec) +#define screamfirst (*__imp_screamfirst) +#define screamnext (*__imp_screamnext) +#define secondgv (*__imp_secondgv) +#define signalstack (*__imp_signalstack) +#define sortcop (*__imp_sortcop) +#define sortstack (*__imp_sortstack) +#define sortstash (*__imp_sortstash) +#define splitstr (*__imp_splitstr) +#define statcache (*__imp_statcache) +#define statgv (*__imp_statgv) +#define statname (*__imp_statname) +#define statusvalue (*__imp_statusvalue) +#define stdingv (*__imp_stdingv) +#define strchop (*__imp_strchop) +#define strtab (*__imp_strtab) +#define sv_arenaroot (*__imp_sv_arenaroot) +#define sv_count (*__imp_sv_count) +#define sv_objcount (*__imp_sv_objcount) +#define sv_root (*__imp_sv_root) +#define tainted (*__imp_tainted) +#define tmps_floor (*__imp_tmps_floor) +#define tmps_ix (*__imp_tmps_ix) +#define tmps_max (*__imp_tmps_max) +#define tmps_stack (*__imp_tmps_stack) +#define top_env (*__imp_top_env) +#define toptarget (*__imp_toptarget) +#define unsafe (*__imp_unsafe) +#define warnhook (*__imp_warnhook) diff --git a/cygwin32/gcc2 b/cygwin32/gcc2 new file mode 100644 index 0000000..3da705c --- /dev/null +++ b/cygwin32/gcc2 @@ -0,0 +1,12 @@ +#!/bin/sh +# +# gcc wrapper for building dynamic lib version of perl +# if -buildperl found on command line, then all args passed to +# perlgcc, else pass all args to gcc. +# jc 3/24/97 +# + +case "$*" in +*-buildperl*) miniperl perlgcc "$@" ;; +*) gcc "$@" ;; +esac diff --git a/cygwin32/ld2 b/cygwin32/ld2 new file mode 100644 index 0000000..9aec879 --- /dev/null +++ b/cygwin32/ld2 @@ -0,0 +1,9 @@ +#!/bin/sh +# +# ld wrapper for building dynamic lib version of perl; +# passes all args to ld. +# + +PERLPATH=/perl5.004 + +$PERLPATH/perl $PERLPATH/perlld "$@" diff --git a/cygwin32/perlgcc b/cygwin32/perlgcc new file mode 100644 index 0000000..97d7d1a --- /dev/null +++ b/cygwin32/perlgcc @@ -0,0 +1,77 @@ +# + +# Perl script be a wrapper around the gnu gcc. the exportable perl.exe +# is built, special processing is done. +# This script is caled by the gcc2 shell script when the flag +# -buildperl is passed to gcc2 + +print "perlgcc: building exportable perl...\n"; + +# get all libs: +my @libobs; +my @obs; +my @libFlags; +my $libstring; +foreach (@ARGV){ + if( /\.[a]$/){ + push @libobs,$_; + } + elsif(/^\-l/){ + push @libFlags,$_; + } + if( /\.[o]$/){ + push @obs,$_; + } +} +$libstring = join(" ",@libobs); +$obsString = join(" ",@obs); +$libflagString = join(" ",@libFlags); + +# make exports file +my $command = "echo EXPORTS > perl.def"; +print "$command\n"; +system($command); + +$command ="nm $libstring | grep '^........ [TCD] _'| grep -v _impure_ptr | sed 's/[^_]*_//' >> perl.def"; +print "$command\n"; +system($command); + +# Build the perl.a lib to link to: +$command ="dlltool --as=as --dllname perl.exe --def perl.def --output-lib perl.a"; +print "$command\n"; +system($command); + +# change name of export lib to libperlexp so that is can be understood by ld2/perlld +$command ="mv perl.a libperlexp.a"; +print "$command\n"; +system($command); + +# get the full path name of a few libs: +my $crt0 = `gcc -print-file-name=crt0.o`; +chomp $crt0; +my $libdir = `gcc -print-file-name=libcygwin.a`; +chomp $libdir; +$libdir =~ s/libcygwin\.a//g; + +# Link exe: +$command = "ld --base-file perl.base -o perl.exe $crt0 $obsString $libstring -L$libdir $libflagString"; +print "$command\n"; +system($command); + +$command = "dlltool --as=as --dllname perl.exe --def perl.def --base-file perl.base --output-exp perl.exp"; +print "$command\n"; +system($command); + +$command = "ld --base-file perl.base perl.exp -o perl.exe $crt0 $obsString $libstring -L$libdir $libflagString"; +print "$command\n"; +system($command); + +$command = "dlltool --as=as --dllname perl.exe --def perl.def --base-file perl.base --output-exp perl.exp"; +print "$command\n"; +system($command); + +$command = "ld perl.exp -o perl.exe $crt0 $obsString $libstring -L$libdir $libflagString"; +print "$command\n"; +system($command); + +print "perlgcc: Completed\n"; diff --git a/cygwin32/perlld b/cygwin32/perlld new file mode 100644 index 0000000..1622f2f --- /dev/null +++ b/cygwin32/perlld @@ -0,0 +1,192 @@ +# +# Perl script be a wrapper around the gnu ld. When a dll is specified to +# to be built, special processing is done, else the standard ld is called. +# +# Modified 3/14/97 to include the impure_ptr setup routine in init.cc +# Modified to make dll in current directory then copy to another dir if +# a path name specified on the command name with the -o parm. +# + +my $args = join(" ",@ARGV); # get args +my $arg; + +my @objs; +my @flags; +my $libname; +my $init = "init"; +my $fixup = "fixup"; + +my $path; + + +sub writefixup; +sub writeInit; + +if( $args=~/\-o (.+?)\.dll/i){ + $libname = $1; + # print "libname = <$libname>\n"; + # Check for path: + if( $libname =~ /($\.+?\/)(\w+$)/){ + $path = $1; + $libname = $2; + # print "<$path> <$libname>\n"; + } + + foreach $arg(@ARGV){ + if( $arg=~/\.[oa]$/){ + push @objs,$arg; + next; + } + if( $arg =~/\-o/ or $arg =~ /.+?\.dll/i ){ + next; + } + push @flags,$arg; + } + + writefixup(); + writeInit(); + $command = "gcc -c $fixup.c\n"; + print $command; + system($command); + $command = "gcc -c $init.cc\n"; + print $command; + system($command); + + $command = "echo EXPORTS > $libname.def\n"; + print $command; + system($command); + $command = "nm ".join(" ",@objs)." $init.o $fixup.o | grep '^........ [TCD] _' | sed 's/[^_]*_//' >> $libname.def\n"; + print $command; + system($command); + + $command = "ld --base-file $libname.base --dll -o $libname.dll ".join(" ",@objs)." $init.o $fixup.o "; + $command .= join(" ",@flags)." -e _dll_entry\@12 \n"; + print $command; + system($command); + + $command = "dlltool --as=as --dllname $libname.dll --def $libname.def --base-file $libname.base --output-exp $libname.exp\n"; + print $command; + system($command); + + $command = "ld --base-file $libname.base $libname.exp --dll -o $libname.dll ".join(" ",@objs)." $init.o $fixup.o "; + $command .= join(" ",@flags)." -e _dll_entry\@12 \n"; + print $command; + system($command); + + $command = "dlltool --as=as --dllname $libname.dll --def $libname.def --base-file $libname.base --output-exp $libname.exp\n"; + print $command; + system($command); + + $command = "ld $libname.exp --dll -o $libname.dll ".join(" ",@objs)." $init.o $fixup.o "; + $command .= join(" ",@flags)." -e _dll_entry\@12 \n"; + print $command; + system($command); + + print "Build the import lib\n"; + $command = "dlltool --as=as --dllname $libname.dll --def $libname.def --output-lib $libname.a\n"; + print $command; + system($command); + + # if there was originally a path, copy the dll and a to that location: + if($path && $path ne "./" && $path."\n" ne "`pwd`"){ + $command = "mv $libname.dll $path".$libname.".dll\n"; + print $command; + system($command); + $command = "mv $libname.a $path".$libname.".a\n"; + print $command; + system($command); + + } + +} +else{ # no special processing, just call ld + $command = "ld $args\n"; + print $command; + system($command); +} + +#--------------------------------------------------------------------------- +sub writeInit{ + +open(OUTFILE,">$init.cc") or die("Can't open $init.cc\n"); + +print OUTFILE <<'EOF'; +/* init.cc for WIN32. + + Copyright 1996 Cygnus Solutions + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +// Added impure_ptr initialization routine. This is needed for any DLL that needs +// to output to the main (calling) executable's stdout, stderr, etc. This routine +// needs to be called from the executable using the DLL before any other DLL +// routines are called. jc 3/14/97 + +#include + +extern "C" +{ + int WINAPI dll_entry (HANDLE h, DWORD reason, void *ptr); + void impure_setup(struct _reent *_impure_ptrMain); +}; + +struct _reent *_impure_ptr; // this will be the Dlls local copy of impure ptr + +int WINAPI dll_entry (HANDLE , + DWORD reason, + void *) +{ + switch (reason) + { + case DLL_PROCESS_ATTACH: + break; + case DLL_PROCESS_DETACH: + break; + case DLL_THREAD_ATTACH: + break; + case DLL_THREAD_DETACH: + break; + } + return 1; +} + + +//******************************************** +// Function to set our local (in this dll) copy of impure_ptr to the +// main's (calling executable's) impure_ptr +void impure_setup(struct _reent *_impure_ptrMain){ + + _impure_ptr = _impure_ptrMain; + +} +EOF + +close OUTFILE; + +} + +#--------------------------------------------------------------------------- +sub writefixup{ + +open(OUTFILE,">$fixup.c") or die("Can't open $fixup.c\n"); + +print OUTFILE <<'EOF'; +/* This is needed to terminate the list of inport stuff */ +/* Copied from winsup/dcrt0.cc in the cygwin32 source distribution. */ + asm(".section .idata$3\n" ".long 0,0,0,0, 0,0,0,0"); + +EOF +close OUTFILE; +} diff --git a/dosish.h b/dosish.h index dfc5e35..7bdea44 100644 --- a/dosish.h +++ b/dosish.h @@ -23,6 +23,7 @@ void Perl_DJGPP_init(); #ifdef WIN32 #define HAS_UTIME +#define HAS_KILL #endif /* diff --git a/ext/DynaLoader/dl_cygwin32.xs b/ext/DynaLoader/dl_cygwin32.xs new file mode 100644 index 0000000..2b75637 --- /dev/null +++ b/ext/DynaLoader/dl_cygwin32.xs @@ -0,0 +1,153 @@ +/* dl_cygwin32.xs + * + * Platform: Win32 (Windows NT/Windows 95) + * Author: Wei-Yuen Tan (wyt@hip.com) + * Created: A warm day in June, 1995 + * + * Modified: + * August 23rd 1995 - rewritten after losing everything when I + * wiped off my NT partition (eek!) + */ +/* Modified from the original dl_win32.xs to work with cygwin32 + -John Cerney 3/26/97 +*/ +/* Porting notes: + +I merely took Paul's dl_dlopen.xs, took out extraneous stuff and +replaced the appropriate SunOS calls with the corresponding Win32 +calls. + +*/ + +#define WIN32_LEAN_AND_MEAN +// Defines from windows needed for this function only. Can't include full +// Cygwin32 windows headers because of problems with CONTEXT redefinition +// Removed logic to tell not dynamically load static modules. It is assumed that all +// modules are dynamically built. This should be similar to the behavoir on sunOS. +// Leaving in the logic would have required changes to the standard perlmain.c code +// +// // Includes call a dll function to initialize it's impure_ptr. +#include +void (*impure_setupptr)(struct _reent *); // pointer to the impure_setup routine + +//#include +#define LOAD_WITH_ALTERED_SEARCH_PATH (8) +typedef void *HANDLE; +typedef HANDLE HINSTANCE; +#define STDCALL __attribute__ ((stdcall)) +typedef int STDCALL (*FARPROC)(); + +HINSTANCE +STDCALL +LoadLibraryExA( + char* lpLibFileName, + HANDLE hFile, + unsigned int dwFlags + ); +unsigned int +STDCALL +GetLastError( + void + ); +FARPROC +STDCALL +GetProcAddress( + HINSTANCE hModule, + char* lpProcName + ); + +#include + +#include "EXTERN.h" +#include "perl.h" +#include "XSUB.h" + +#include "dlutils.c" /* SaveError() etc */ + +static void +dl_private_init() +{ + (void)dl_generic_private_init(); +} + + +MODULE = DynaLoader PACKAGE = DynaLoader + +BOOT: + (void)dl_private_init(); + +void * +dl_load_file(filename,flags=0) + char * filename + int flags + PREINIT: + CODE: + DLDEBUG(1,fprintf(stderr,"dl_load_file(%s):\n", filename)); + + RETVAL = (void*) LoadLibraryExA(filename, NULL, LOAD_WITH_ALTERED_SEARCH_PATH ) ; + + DLDEBUG(2,fprintf(stderr," libref=%x\n", RETVAL)); + ST(0) = sv_newmortal() ; + if (RETVAL == NULL){ + SaveError("%d",GetLastError()) ; + } + else{ + // setup the dll's impure_ptr: + impure_setupptr = GetProcAddress(RETVAL, "impure_setup"); + if( impure_setupptr == NULL){ + printf( + "Cygwin32 dynaloader error: could not load impure_setup symbol\n"); + RETVAL = NULL; + } + else{ + // setup the DLLs impure_ptr: + (*impure_setupptr)(_impure_ptr); + sv_setiv( ST(0), (IV)RETVAL); + } + } + + + +void * +dl_find_symbol(libhandle, symbolname) + void * libhandle + char * symbolname + CODE: + DLDEBUG(2,fprintf(stderr,"dl_find_symbol(handle=%x, symbol=%s)\n", + libhandle, symbolname)); + RETVAL = (void*) GetProcAddress((HINSTANCE) libhandle, symbolname); + DLDEBUG(2,fprintf(stderr," symbolref = %x\n", RETVAL)); + ST(0) = sv_newmortal() ; + if (RETVAL == NULL) + SaveError("%d",GetLastError()) ; + else + sv_setiv( ST(0), (IV)RETVAL); + + +void +dl_undef_symbols() + PPCODE: + + + +# These functions should not need changing on any platform: + +void +dl_install_xsub(perl_name, symref, filename="$Package") + char * perl_name + void * symref + char * filename + CODE: + DLDEBUG(2,fprintf(stderr,"dl_install_xsub(name=%s, symref=%x)\n", + perl_name, symref)); + ST(0)=sv_2mortal(newRV((SV*)newXS(perl_name, (void(*)())symref, filename))); + + +char * +dl_error() + CODE: + RETVAL = LastError ; + OUTPUT: + RETVAL + +# end. diff --git a/hints/cygwin32.sh b/hints/cygwin32.sh new file mode 100644 index 0000000..5853499 --- /dev/null +++ b/hints/cygwin32.sh @@ -0,0 +1,50 @@ +#! /bin/sh +# cygwin32.sh - hintsfile for building perl on Windows NT using the +# Cygnus Win32 Development Kit. +# See "http://www.cygnus.com/misc/gnu-win32/" to learn about the kit. +# +path_sep=\; +exe_ext='.exe' +firstmakefile='GNUmakefile' +if test -f $sh.exe; then sh=$sh.exe; fi +startsh="#!$sh" +cc='gcc2' +ld='ld2' +usrinc='/gnuwin32/H-i386-cygwin32/i386-cygwin32/include' +libpth='/gnuwin32/H-i386-cygwin32/i386-cygwin32/lib /gnuwin32/H-i386-cygwin32/lib' +libs='-lcygwin -lm -lc -lkernel32' +# dynamic lib stuff +so='dll' +#i_dlfcn='define' +dlsrc='dl_cygwin32.xs' +usedl='y' +# flag to include the perl.exe export variable translation file cw32imp.h +# when building extension libs +cccdlflags='-DCYGWIN32 -DDLLIMPORT ' +# flag that signals gcc2 to build exportable perl +ccdlflags='-buildperl ' +lddlflags='-L../.. -L/gnuwin32/H-i386-cygwin32/i386-cygwin32/lib -lperlexp -lcygwin' +d_voidsig='undef' +extensions='Fcntl IO Opcode SDBM_File' +lns='cp' +signal_t='int' +useposix='false' +rd_nodata='0' +eagain='EAGAIN' +archname='cygwin32' +# + +installbin='/usr/local/bin' +installman1dir='' +installman3dir='' +installprivlib='/usr/local/lib/perl5' +installscript='/usr/local/bin' + +installsitelib='/usr/local/lib/perl5/site_perl' +libc='/gnuwin32/H-i386-cygwin32/i386-cygwin32/lib/libc.a' + +perlpath='/usr/local/bin/perl' + +sitelib='/usr/local/lib/perl5/site_perl' +sitelibexp='/usr/local/lib/perl5/site_perl' +usrinc='/gnuwin32/H-i386-cygwin32/i386-cygwin32/include' diff --git a/hints/titanos.sh b/hints/titanos.sh index 5147af0..cea99f8 100644 --- a/hints/titanos.sh +++ b/hints/titanos.sh @@ -1,6 +1,6 @@ # Hints file (perl 4.019) for Kubota Pacific's Titan 3000 Series Machines. # Created by: JT McDuffie (jt@kpc.com) 26 DEC 1991 -# p5ed by: Jarkko Hietaniemi Aug 27 1994 +# p5ed by: Jarkko Hietaniemi Aug 27 1994 # NOTE: You should run Configure with tcsh (yes, tcsh). # Comments by Andy Dougherty 28 Mar 1995 alignbytes="8" diff --git a/lib/Benchmark.pm b/lib/Benchmark.pm index fa5c9e8..13acf86 100644 --- a/lib/Benchmark.pm +++ b/lib/Benchmark.pm @@ -195,8 +195,7 @@ code and therefore the difference might end up being E 0. =head1 AUTHORS -Jarkko Hietaniemi EFE, -Tim Bunce EFE +Jarkko Hietaniemi >, Tim Bunce > =head1 MODIFICATION HISTORY diff --git a/lib/I18N/Collate.pm b/lib/I18N/Collate.pm index 343cb02..6961dc2 100644 --- a/lib/I18N/Collate.pm +++ b/lib/I18N/Collate.pm @@ -47,10 +47,10 @@ European character set. # I18N::Collate.pm # -# Author: Jarkko Hietaniemi +# Author: Jarkko Hietaniemi > # Helsinki University of Technology, Finland # -# Acks: Guy Decoux understood +# Acks: Guy Decoux > understood # overloading magic much deeper than I and told # how to cut the size of this code by more than half. # (my first version did overload all of lt gt eq le ge cmp) diff --git a/lib/Math/Complex.pm b/lib/Math/Complex.pm index 30194eb..9000543 100644 --- a/lib/Math/Complex.pm +++ b/lib/Math/Complex.pm @@ -5,26 +5,41 @@ # -- Jarkko Hietaniemi, March 1997 require Exporter; -package Math::Complex; @ISA = qw(Exporter); +package Math::Complex; use strict; -use vars qw(@EXPORT $package $display +use vars qw($VERSION @ISA + @EXPORT %EXPORT_TAGS + $package $display $pi $i $ilog10 $logn %logn); -@EXPORT = qw( - pi i Re Im arg - sqrt exp log ln - log10 logn cbrt root - tan - cosec csc sec cotan cot - asin acos atan - acosec acsc asec acotan acot - sinh cosh tanh - cosech csch sech cotanh coth - asinh acosh atanh - acosech acsch asech acotanh acoth - cplx cplxe +@ISA = qw(Exporter); + +$VERSION = 1.01; + +my @trig = qw( + pi + tan + csc cosec sec cot cotan + asin acos atan + acsc acosec asec acot acotan + sinh cosh tanh + csch cosech sech coth cotanh + asinh acosh atanh + acsch acosech asech acoth acotanh + ); + +@EXPORT = (qw( + i Re Im arg + sqrt exp log ln + log10 logn cbrt root + cplx cplxe + ), + @trig); + +%EXPORT_TAGS = ( + 'trig' => [@trig], ); use overload @@ -236,7 +251,7 @@ sub multiply { # Die on division by zero. # sub divbyzero { - warn $package . '::' . "$_[0]: Division by zero.\n"; + warn "$_[0]: Division by zero.\n"; warn "(Because in the definition of $_[0], $_[1] is 0)\n" if (defined $_[1]); my @up = caller(1); @@ -1002,6 +1017,7 @@ Math::Complex - complex numbers and associated mathematical functions =head1 SYNOPSIS use Math::Complex; + $z = Math::Complex->make(5, 6); $t = 4 - 3*i + $z; $j = cplxe(1, 2*pi/3); @@ -1195,32 +1211,32 @@ numbers: tan(z) = sin(z) / cos(z) - csc(z) = 1 / sin(z) - sec(z) = 1 / cos(z) + csc(z) = 1 / sin(z) + sec(z) = 1 / cos(z) cot(z) = 1 / tan(z) asin(z) = -i * log(i*z + sqrt(1-z*z)) acos(z) = -i * log(z + sqrt(z*z-1)) atan(z) = i/2 * log((i+z) / (i-z)) - acsc(z) = asin(1 / z) - asec(z) = acos(1 / z) + acsc(z) = asin(1 / z) + asec(z) = acos(1 / z) acot(z) = -i/2 * log((i+z) / (z-i)) sinh(z) = 1/2 (exp(z) - exp(-z)) cosh(z) = 1/2 (exp(z) + exp(-z)) tanh(z) = sinh(z) / cosh(z) = (exp(z) - exp(-z)) / (exp(z) + exp(-z)) - csch(z) = 1 / sinh(z) - sech(z) = 1 / cosh(z) + csch(z) = 1 / sinh(z) + sech(z) = 1 / cosh(z) coth(z) = 1 / tanh(z) asinh(z) = log(z + sqrt(z*z+1)) acosh(z) = log(z + sqrt(z*z-1)) atanh(z) = 1/2 * log((1+z) / (1-z)) - acsch(z) = asinh(1 / z) - asech(z) = acosh(1 / z) + acsch(z) = asinh(1 / z) + asech(z) = acosh(1 / z) acoth(z) = atanh(1 / z) = 1/2 * log((1+z) / (z-1)) I, I, I, I, I, I, I, @@ -1325,6 +1341,32 @@ Here are some examples: $k = exp(i * 2*pi/3); print "$j - $k = ", $j - $k, "\n"; +=head1 CAVEATS + +The division (/) and the following functions + + tan + sec + csc + cot + atan + acot + tanh + sech + csch + coth + atanh + asech + acsch + acoth + +cannot be computed for all arguments because that would mean dividing +by zero. These situations cause fatal runtime errors looking like this + + cot(0): Division by zero. + (Because in the definition of cot(0), sin(0) is 0) + Died at ... + =head1 BUGS Saying C exports many mathematical routines in the caller diff --git a/lib/Math/Trig.pm b/lib/Math/Trig.pm new file mode 100644 index 0000000..7c3570c --- /dev/null +++ b/lib/Math/Trig.pm @@ -0,0 +1,242 @@ +# +# Trigonometric functions, mostly inherited from Math::Complex. +# -- Jarkko Hietaniemi, April 1997 +# + +require Exporter; +package Math::Trig; + +use strict; + +use Math::Complex qw(:trig); + +use vars qw($VERSION $PACKAGE + @ISA + @EXPORT + $pi2 $DR $RD $DG $GD $RG $GR); + +@ISA = qw(Exporter); + +$VERSION = 1.00; + +my @angcnv = qw(rad_to_deg rad_to_grad + deg_to_rad deg_to_grad + grad_to_rad grad_to_dec); + +@EXPORT = (@{$Math::Complex::EXPORT_TAGS{'trig'}}, + @angcnv); + +sub pi2 () { + $pi2 = 2 * pi unless ($pi2); + $pi2; +} + +sub DR () { + $DR = pi2/360 unless ($DR); + $DR; +} + +sub RD () { + $RD = 360/pi2 unless ($RD); + $RD; +} + +sub DG () { + $DG = 400/360 unless ($DG); + $DG; +} + +sub GD () { + $GD = 360/400 unless ($GD); + $GD; +} + +sub RG () { + $RG = 400/pi2 unless ($RG); + $RG; +} + +sub GR () { + $GR = pi2/400 unless ($GR); + $GR; +} + +# +# Truncating remainder. +# + +sub remt ($$) { + # Oh yes, POSIX::fmod() would be faster. Possibly. If it is available. + $_[0] - $_[1] * int($_[0] / $_[1]); +} + +# +# Angle conversions. +# + +sub rad_to_deg ($) { + remt(RD * $_[0], 360); +} + +sub deg_to_rad ($) { + remt(DR * $_[0], pi2); +} + +sub grad_to_deg ($) { + remt(GD * $_[0], 360); +} + +sub deg_to_grad ($) { + remt(DG * $_[0], 400); +} + +sub rad_to_grad ($) { + remt(RG * $_[0], 400); +} + +sub grad_to_rad ($) { + remt(GR * $_[0], pi2); +} + +=head1 NAME + +Math::Trig - trigonometric functions + +=head1 SYNOPSIS + + use Math::Trig; + + $x = tan(0.9); + $y = acos(3.7); + $z = asin(2.4); + + $halfpi = pi/2; + + $rad = deg_to_rad(120); + +=head1 DESCRIPTION + +C defines many trigonometric functions not defined by the +core Perl (which defines only the C and C. The constant +B is also defined as are a few convenience functions for angle +conversions. + +=head1 TRIGONOMETRIC FUNCTIONS + +The tangent + + tan + +The cofunctions of the sine, cosine, and tangent (cosec/csc and cotan/cot +are aliases) + + csc cosec sec cot cotan + +The arcus (also known as the inverse) functions of the sine, cosine, +and tangent + + asin acos atan + +The principal value of the arc tangent of y/x + + atan2(y, x) + +The arcus cofunctions of the sine, cosine, and tangent (acosec/acsc +and acotan/acot are aliases) + + acsc acosec asec acot acotan + +The hyperbolic sine, cosine, and tangent + + sinh cosh tanh + +The cofunctions of the hyperbolic sine, cosine, and tangent (cosech/csch +and cotanh/coth are aliases) + + csch cosech sech coth cotanh + +The arcus (also known as the inverse) functions of the hyperbolic +sine, cosine, and tangent + + asinh acosh atanh + +The arcus cofunctions of the hyperbolic sine, cosine, and tangent +(acsch/acosech and acoth/acotanh are aliases) + + acsch acosech asech acoth acotanh + +The trigonometric constant B is also defined. + + $pi2 = 2 * pi; + +=head2 SIMPLE ARGUMENTS, COMPLEX RESULTS + +Please note that some of the trigonometric functions can break out +from the B into the B. For example +C has no definition for plain real numbers but it has +definition for complex numbers. + +In Perl terms this means that supplying the usual Perl numbers (also +known as scalars, please see L) as input for the +trigonometric functions might produce as output results that no more +are simple real numbers: instead they are complex numbers. + +The C handles this by using the C package +which knows how to handle complex numbers, please see L +for more information. In practice you need not to worry about getting +complex numbers as results because the C takes care of +details like for example how to display complex numbers. For example: + + print asin(2), "\n"; + +should produce something like this (take or leave few last decimals): + + 1.5707963267949-1.31695789692482i + +That is, a complex number with the real part of approximately E<1.571> +and the imaginary part of approximately E<-1.317>. + +=head1 ANGLE CONVERSIONS + +(Plane, 2-dimensional) angles may be converted with the following functions. + + $radians = deg_to_rad($degrees); + $radians = grad_to_rad($gradians); + + $degrees = rad_to_deg($radians); + $degrees = grad_to_deg($gradians); + + $gradians = deg_to_grad($degrees); + $gradians = rad_to_grad($radians); + +The full circle is 2 B radians or E<360> degrees or E<400> gradians. + +=head1 + +The following functions + + tan + sec + csc + cot + atan + acot + tanh + sech + csch + coth + atanh + asech + acsch + acoth + +cannot be computed for all arguments because that would mean dividing +by zero. These situations cause fatal runtime errors looking like this + + cot(0): Division by zero. + (Because in the definition of cot(0), sin(0) is 0) + Died at ... + +=cut + +# eof diff --git a/mg.c b/mg.c index 5b25c40..f1dc828 100644 --- a/mg.c +++ b/mg.c @@ -581,27 +581,20 @@ MAGIC* mg; { register char *s; char *ptr; - STRLEN len; + STRLEN len, klen; I32 i; s = SvPV(sv,len); - ptr = MgPV(mg); + ptr = MgPV(mg,klen); my_setenv(ptr, s); #ifdef DYNAMIC_ENV_FETCH /* We just undefd an environment var. Is a replacement */ /* waiting in the wings? */ if (!len) { - HE *envhe; - SV *keysv; - if (mg->mg_len == HEf_SVKEY) - keysv = (SV *)mg->mg_ptr; - else - keysv = newSVpv(mg->mg_ptr, mg->mg_len); - if ((envhe = hv_fetch_ent(GvHVn(envgv), keysv, FALSE, 0))) - s = SvPV(HeVAL(envhe), len); - if (mg->mg_len != HEf_SVKEY) - SvREFCNT_dec(keysv); + SV **valp; + if ((valp = hv_fetch(GvHVn(envgv), ptr, klen, FALSE))) + s = SvPV(*valp, len); } #endif @@ -611,7 +604,7 @@ MAGIC* mg; if (tainting) { MgTAINTEDDIR_off(mg); #ifdef VMS - if (s && strnEQ(ptr, "DCL$PATH", 8)) { + if (s && klen == 8 && strEQ(ptr, "DCL$PATH")) { char pathbuf[256], eltbuf[256], *cp, *elt = s; struct stat sbuf; int i = 0, j = 0; @@ -636,7 +629,7 @@ MAGIC* mg; } while (my_trnlnm(s, pathbuf, i++) && (elt = pathbuf)); } #endif /* VMS */ - if (s && strEQ(ptr,"PATH")) { + if (s && klen == 4 && strEQ(ptr,"PATH")) { char *strend = s + len; while (s < strend) { @@ -661,7 +654,7 @@ magic_clearenv(sv,mg) SV* sv; MAGIC* mg; { - my_setenv(MgPV(mg),Nullch); + my_setenv(MgPV(mg,na),Nullch); return 0; } @@ -672,7 +665,7 @@ MAGIC* mg; { I32 i; /* Are we fetching a signal entry? */ - i = whichsig(MgPV(mg)); + i = whichsig(MgPV(mg,na)); if (i) { if(psig_ptr[i]) sv_setsv(sv,psig_ptr[i]); @@ -697,7 +690,7 @@ MAGIC* mg; { I32 i; /* Are we clearing a signal entry? */ - i = whichsig(MgPV(mg)); + i = whichsig(MgPV(mg,na)); if (i) { if(psig_ptr[i]) { SvREFCNT_dec(psig_ptr[i]); @@ -720,7 +713,7 @@ MAGIC* mg; I32 i; SV** svp; - s = MgPV(mg); + s = MgPV(mg,na); if (*s == '_') { if (strEQ(s,"__DIE__")) svp = &diehook; @@ -771,8 +764,11 @@ MAGIC* mg; *svp = 0; } else { - if(hints & HINT_STRICT_REFS) - die(no_symref,s,"a subroutine"); + /* + * We should warn if HINT_STRICT_REFS, but without + * access to a known hint bit in a known OP, we can't + * tell whether HINT_STRICT_REFS is in force or not. + */ if (!strchr(s,':') && !strchr(s,'\'')) { sprintf(tokenbuf, "main::%s",s); sv_setpv(sv,tokenbuf); @@ -958,7 +954,7 @@ MAGIC* mg; gv = DBline; i = SvTRUE(sv); svp = av_fetch(GvAV(gv), - atoi(MgPV(mg)), FALSE); + atoi(MgPV(mg,na)), FALSE); if (svp && SvIOKp(*svp) && (o = (OP*)SvSTASH(*svp))) o->op_private = i; else @@ -1200,7 +1196,7 @@ SV* sv; } else { AV* av = (AV*)LvTARG(sv); - if (LvTARGLEN(sv) < 0 && (I32)LvTARGOFF(sv) > AvFILL(av)) + if ((I32)LvTARGLEN(sv) < 0 && (I32)LvTARGOFF(sv) > AvFILL(av)) LvTARG(sv) = Nullsv; /* array can't be extended */ else { SV** svp = av_fetch(av, LvTARGOFF(sv), TRUE); diff --git a/mg.h b/mg.h index c40a866..c464746 100644 --- a/mg.h +++ b/mg.h @@ -36,6 +36,6 @@ struct magic { #define MgTAINTEDDIR_on(mg) (mg->mg_flags |= MGf_TAINTEDDIR) #define MgTAINTEDDIR_off(mg) (mg->mg_flags &= ~MGf_TAINTEDDIR) -#define MgPV(mg) ((mg)->mg_len == HEf_SVKEY) ? \ - SvPV((SV*)((mg)->mg_ptr),na) : \ - (mg)->mg_ptr +#define MgPV(mg,lp) (((lp = (mg)->mg_len) == HEf_SVKEY) ? \ + SvPV((SV*)((mg)->mg_ptr),lp) : \ + (mg)->mg_ptr) diff --git a/op.c b/op.c index 34b1d3c..ef2940a 100644 --- a/op.c +++ b/op.c @@ -811,17 +811,13 @@ OP *op; for (kid = cUNOP->op_first->op_sibling; kid; kid = kid->op_sibling) scalarvoid(kid); break; + case OP_NULL: if (op->op_targ == OP_NEXTSTATE || op->op_targ == OP_DBSTATE) curcop = ((COP*)op); /* for warning below */ if (op->op_flags & OPf_STACKED) break; - - case OP_REQUIRE: - /* since all requires must return a value, they're never void */ - op->op_flags &= ~OPf_WANT; - return scalar(op); - + /* FALL THROUGH */ case OP_ENTERTRY: case OP_ENTER: case OP_SCALAR: @@ -837,6 +833,10 @@ OP *op; for (kid = cLISTOP->op_first; kid; kid = kid->op_sibling) scalarvoid(kid); break; + case OP_REQUIRE: + /* since all requires must return a value, they're never void */ + op->op_flags &= ~OPf_WANT; + return scalar(op); case OP_SPLIT: if ((kid = ((LISTOP*)op)->op_first) && kid->op_type == OP_PUSHRE) { if (!kPMOP->op_pmreplroot) @@ -3185,17 +3185,14 @@ CV* cv; else if (type == OP_PADSV) { AV* pad = (AV*)(AvARRAY(CvPADLIST(cv))[1]); sv = pad ? AvARRAY(pad)[o->op_targ] : Nullsv; - if (!sv) + if (!sv || (!SvREADONLY(sv) && SvREFCNT(sv) > 1)) return Nullsv; - if (!SvREADONLY(sv)) { - if (SvREFCNT(sv) > 1) - return Nullsv; - SvREADONLY_on(sv); - } } else return Nullsv; } + if (sv) + SvREADONLY_on(sv); return sv; } diff --git a/patchlevel.h b/patchlevel.h index 75b45f0..6cc0f69 100644 --- a/patchlevel.h +++ b/patchlevel.h @@ -38,6 +38,7 @@ */ static char *local_patches[] = { NULL + ,"Dev97A - First development patch to 5.003_97" ,NULL }; diff --git a/perl.c b/perl.c index 9f06f13..2b53a81 100644 --- a/perl.c +++ b/perl.c @@ -2278,7 +2278,7 @@ register char **env; HV *hv; GvMULTI_on(envgv); hv = GvHVn(envgv); - hv_clear(hv); + hv_magic(hv, envgv, 'E'); #ifndef VMS /* VMS doesn't have environ array */ /* Note that if the supplied env parameter is actually a copy of the global environ then it may now point to free'd memory @@ -2287,16 +2287,13 @@ register char **env; */ if (!env) env = environ; - if (env != environ) { + if (env != environ) environ[0] = Nullch; - hv_magic(hv, envgv, 'E'); - } for (; *env; env++) { if (!(s = strchr(*env,'='))) continue; *s++ = '\0'; sv = newSVpv(s--,0); - sv_magic(sv, sv, 'e', *env, s - *env); (void)hv_store(hv, *env, s - *env, sv, 0); *s = '='; } @@ -2304,7 +2301,6 @@ register char **env; #ifdef DYNAMIC_ENV_FETCH HvNAME(hv) = savepv(ENV_HV_NAME); #endif - hv_magic(hv, envgv, 'E'); } TAINT_NOT; if (tmpgv = gv_fetchpv("$",TRUE, SVt_PV)) diff --git a/perl.h b/perl.h index 6651ddf..f196eac 100644 --- a/perl.h +++ b/perl.h @@ -983,6 +983,11 @@ union any { void (*any_dptr) _((void*)); }; +/* Work around some cygwin32 problems with importing global symbols */ +#if defined(CYGWIN32) && defined(DLLIMPORT) +# include "cw32imp.h" +#endif + #include "regexp.h" #include "sv.h" #include "util.h" diff --git a/pod/perldelta.pod b/pod/perldelta.pod index 2e29341..0d3dd84 100644 --- a/pod/perldelta.pod +++ b/pod/perldelta.pod @@ -703,6 +703,11 @@ And these functions are now exported: sinh cosh tanh cotanh asinh acosh atanh acotanh cplx cplxe +=head2 Math::Trig + +This module provides a simpler interface to parts of Math::Complex for +those who need trigonometric functions only for real numbers. + =head2 DB_File There have been quite a few changes made to DB_File. Here are a few of diff --git a/pod/perltie.pod b/pod/perltie.pod index 8dc7c17..847340d 100644 --- a/pod/perltie.pod +++ b/pod/perltie.pod @@ -60,10 +60,10 @@ And now whenever either of those variables is accessed, its current system priority is retrieved and returned. If those variables are set, then the process's priority is changed! -We'll use Jarkko Hietaniemi >'s -BSD::Resource class (not included) to access the PRIO_PROCESS, PRIO_MIN, -and PRIO_MAX constants from your system, as well as the getpriority() and -setpriority() system calls. Here's the preamble of the class. +We'll use Jarkko Hietaniemi >'s BSD::Resource class (not +included) to access the PRIO_PROCESS, PRIO_MIN, and PRIO_MAX constants +from your system, as well as the getpriority() and setpriority() system +calls. Here's the preamble of the class. package Nice; use Carp; diff --git a/pp_sys.c b/pp_sys.c index 00012c3..45290d6 100644 --- a/pp_sys.c +++ b/pp_sys.c @@ -3991,7 +3991,7 @@ PP(pp_gpwent) PP(pp_spwent) { dSP; -#ifdef HAS_PASSWD +#if defined(HAS_PASSWD) && !defined(CYGWIN32) setpwent(); RETPUSHYES; #else diff --git a/t/io/fs.t b/t/io/fs.t index 461d2d6..d83fe1a 100755 --- a/t/io/fs.t +++ b/t/io/fs.t @@ -9,6 +9,9 @@ BEGIN { use Config; +# avoid win32 (for now) +do { print "1..0\n"; exit(0); } if $^O eq 'MSWin32'; + print "1..26\n"; $wd = (($^O eq 'MSWin32') ? `cd` : `pwd`); diff --git a/t/io/tell.t b/t/io/tell.t index 5badafe..83904e8 100755 --- a/t/io/tell.t +++ b/t/io/tell.t @@ -7,7 +7,7 @@ print "1..13\n"; $TST = 'tst'; open($TST, '../Configure') || (die "Can't open ../Configure"); - +binmode $TST if $^O eq 'MSWin32'; if (eof(tst)) { print "not ok 1\n"; } else { print "ok 1\n"; } $firstline = <$TST>; diff --git a/t/lib/complex.t b/t/lib/complex.t index 3bb52c0..46114fb 100755 --- a/t/lib/complex.t +++ b/t/lib/complex.t @@ -2,19 +2,21 @@ # $RCSfile$ # -# Regression tests for the new Math::Complex pacakge -# -- Raphael Manfredi, Septemeber 1996 -# -- Jarkko Hietaniemi Manfredi, March 1997 +# Regression tests for the Math::Complex pacakge +# -- Raphael Manfredi, September 1996 +# -- Jarkko Hietaniemi, March 1997 + BEGIN { chdir 't' if -d 't'; @INC = '../lib'; } + use Math::Complex; $test = 0; $| = 1; @script = (); -my $eps = 1e-4; # for example root() is quite bad +my $eps = 1e-11; while () { s/^\s+//; diff --git a/t/lib/io_tell.t b/t/lib/io_tell.t index f45d21e..d8ebae2 100755 --- a/t/lib/io_tell.t +++ b/t/lib/io_tell.t @@ -27,7 +27,7 @@ print "1..13\n"; use IO::File; $tst = IO::File->new("$tell_file","r") || die("Can't open $tell_file"); - +binmode $tst if $^O eq 'MSWin32'; if ($tst->eof) { print "not ok 1\n"; } else { print "ok 1\n"; } $firstline = <$tst>; diff --git a/t/lib/trig.t b/t/lib/trig.t new file mode 100644 index 0000000..57746fd --- /dev/null +++ b/t/lib/trig.t @@ -0,0 +1,54 @@ +#!./perl + +# +# Regression tests for the Math::Trig package +# +# The tests are quite modest as the Math::Complex tests exercise +# these quite vigorously. +# +# -- Jarkko Hietaniemi, April 1997 + +BEGIN { + chdir 't' if -d 't'; + @INC = '../lib'; +} + +use Math::Trig; + +use strict; + +use vars qw($x $y $z); + +my $eps = 1e-11; + +sub near ($$;$) { + abs($_[0] - $_[1]) < (defined $_[2] ? $_[2] : $eps); +} + +print "1..6\n"; + +$x = 0.9; +print 'not ' unless (near(tan($x), sin($x) / cos($x))); +print "ok 1\n"; + +print 'not ' unless (near(sinh(2), 3.62686040784702)); +print "ok 2\n"; + +print 'not ' unless (near(acsch(0.1), 2.99822295029797)); +print "ok 3\n"; + +$x = asin(2); +print 'not ' unless (ref $x eq 'Math::Complex'); +print "ok 4\n"; + +# avoid using Math::Complex here +$x =~ /^([^-]+)(-[^i]+)i$/; +($y, $z) = ($1, $2); +print 'not ' unless (near($y, 1.5707963267949) and + near($z, -1.31695789692482)); +print "ok 5\n"; + +print 'not ' unless (near(deg_to_rad(90), pi/2)); +print "ok 6\n"; + +# eof diff --git a/t/op/magic.t b/t/op/magic.t index b338d96..c2be2e5 100755 --- a/t/op/magic.t +++ b/t/op/magic.t @@ -94,9 +94,9 @@ ok 13, (keys %h)[0] eq "foo\034bar", (keys %h)[0]; } # $?, $@, $$ -system "$PERL -e 'exit(0)'"; +system qq[$PERL -e "exit(0)"]; ok 15, $? == 0, $?; -system "$PERL -e 'exit(1)'"; +system qq[$PERL -e "exit(1)"]; ok 16, $? != 0, $?; eval { die "foo\n" }; diff --git a/t/op/mkdir.t b/t/op/mkdir.t index 1ffeaa1..5a6dfe5 100755 --- a/t/op/mkdir.t +++ b/t/op/mkdir.t @@ -4,7 +4,7 @@ print "1..7\n"; -$^O eq 'MSWin32' ? `cmd /x /c del /s /q blurfl` : `rm -rf blurfl`; +$^O eq 'MSWin32' ? `del /s /q blurfl 2>&1` : `rm -rf blurfl`; print (mkdir('blurfl',0777) ? "ok 1\n" : "not ok 1\n"); print (mkdir('blurfl',0777) ? "not ok 2\n" : "ok 2\n"); diff --git a/t/op/runlevel.t b/t/op/runlevel.t index 336b164..2be2eec 100755 --- a/t/op/runlevel.t +++ b/t/op/runlevel.t @@ -258,7 +258,7 @@ package main; open FH, ">&STDOUT"; tie *FH, TEST; print FH "OK\n"; -print "DONE\n"; +print STDERR "DONE\n"; EXPECT PRINT CALLED DONE diff --git a/t/op/stat.t b/t/op/stat.t index 0713007..84c5283 100755 --- a/t/op/stat.t +++ b/t/op/stat.t @@ -27,7 +27,8 @@ $junk = `ls Op.stat.tmp` unless $Is_MSWin32; ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime, $blksize,$blocks) = stat(FOO); if ($nlink == 1) {print "ok 1\n";} else {print "not ok 1\n";} -if ($mtime && $mtime == $ctime) {print "ok 2\n";} else {print "not ok 2\n";} +if ($Is_MSWin32 || ($mtime && $mtime == $ctime)) {print "ok 2\n";} +else {print "# |$mtime| vs |$ctime|\nnot ok 2\n";} print FOO "Now is the time for all good men to come to.\n"; close(FOO); @@ -42,16 +43,16 @@ else { ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime, $blksize,$blocks) = stat('Op.stat.tmp'); -if ($Config{dont_use_nlink} || $nlink == 2) - {print "ok 3\n";} else {print "not ok 3\n";} +if ($Is_MSWin32 || $Config{dont_use_nlink} || $nlink == 2) + {print "ok 3\n";} else {print "# \$nlink is |$nlink|\nnot ok 3\n";} -if (($mtime && $mtime != $ctime) || $cwd =~ m#/afs/# || $^O eq 'amigaos') { +if ($Is_MSWin32 || ($mtime && $mtime != $ctime) || $cwd =~ m#/afs/# || $^O eq 'amigaos') { print "ok 4\n"; } else { print "not ok 4\n"; - print '#4 If test op/stat.t fails test 4, check if you are on a tmpfs'; - print '#4 of some sort. Building in /tmp sometimes has this problem.'; + print "#4 If test op/stat.t fails test 4, check if you are on a tmpfs\n"; + print "#4 of some sort. Building in /tmp sometimes has this problem.\n"; } print "#4 :$mtime: != :$ctime:\n"; @@ -84,7 +85,7 @@ foreach ((12,13,14,15,16,17)) { chmod 0700,'Op.stat.tmp'; if (-r 'Op.stat.tmp') {print "ok 18\n";} else {print "not ok 18\n";} if (-w 'Op.stat.tmp') {print "ok 19\n";} else {print "not ok 19\n";} -if (-x 'Op.stat.tmp') {print "ok 20\n";} else {print "not ok 20\n";} +if ($Is_MSWin32 or -x 'Op.stat.tmp') {print "ok 20\n";} else {print "not ok 20\n";} if (-f 'Op.stat.tmp') {print "ok 21\n";} else {print "not ok 21\n";} if (! -d 'Op.stat.tmp') {print "ok 22\n";} else {print "not ok 22\n";} diff --git a/t/op/taint.t b/t/op/taint.t index d0ba887..81d698a 100755 --- a/t/op/taint.t +++ b/t/op/taint.t @@ -72,7 +72,7 @@ sub test ($$;$) { } # We need an external program to call. -my $ECHO = "./echo$$"; +my $ECHO = ($Is_MSWin32 ? ".\\echo$$" : "./echo$$"); END { unlink $ECHO } open PROG, "> $ECHO" or die "Can't create $ECHO: $!"; print PROG 'print "@ARGV\n"', "\n"; @@ -87,18 +87,23 @@ print "1..112\n"; { $ENV{'DCL$PATH'} = '' if $Is_VMS; - $ENV{PATH} = $TAINT; - $ENV{IFS} = " \t\n"; - test 1, eval { `$echo 1` } eq ''; - test 2, $@ =~ /^Insecure \$ENV{PATH}/, $@; - - $ENV{PATH} = ''; - $ENV{IFS} = $TAINT; - test 3, eval { `$echo 1` } eq ''; - test 4, $@ =~ /^Insecure \$ENV{IFS}/, $@; + if ($Is_MSWin32) { + print "# PATH/IFS tainting tests skipped\n"; + for (1..4) { print "ok $_\n" } + } + else { + $ENV{PATH} = $TAINT; + $ENV{IFS} = " \t\n"; + test 1, eval { `$echo 1` } eq ''; + test 2, $@ =~ /^Insecure \$ENV{PATH}/, $@; + $ENV{PATH} = ''; + $ENV{IFS} = $TAINT; + test 3, eval { `$echo 1` } eq ''; + test 4, $@ =~ /^Insecure \$ENV{IFS}/, $@; + } my $tmp; - if ($^O eq 'os2' || $^O eq 'amigaos') { + if ($^O eq 'os2' || $^O eq 'amigaos' || $Is_MSWin32) { print "# all directories are writeable\n"; } else { diff --git a/win32/Makefile b/win32/Makefile index 1136d15..3da20e7 100644 --- a/win32/Makefile +++ b/win32/Makefile @@ -220,16 +220,8 @@ $(OPCODE_DLL): $(OPCODE).c $(PERLDLL) $(MAKE) -f $(*B).mak CFG="$(*B) - Win32 $(CFG)" doc: $(PERLEXE) - $(PERLEXE) $(POD2HTML).PL - $(PERLEXE) $(POD2MAN).PL - $(PERLEXE) $(POD2LATEX).PL - $(PERLEXE) $(POD2TEXT).PL - $(PERLEXE) $(PL2BAT) $(POD2HTML) - $(PERLEXE) $(PL2BAT) $(POD2MAN) - $(PERLEXE) $(PL2BAT) $(POD2LATEX) - $(PERLEXE) $(PL2BAT) $(POD2TEXT) cd $(PODDIR) - $(PERLEXE) pod2html.bat *.pod + nmake -f ../win32/pod.mak cd ..\win32 utils: $(PERLEXE) diff --git a/win32/VC-2.0/pod.mak b/win32/VC-2.0/pod.mak new file mode 100644 index 0000000..538cfa3 --- /dev/null +++ b/win32/VC-2.0/pod.mak @@ -0,0 +1,272 @@ +CONVERTERS = pod2html pod2latex pod2man pod2text checkpods + +HTMLROOT = / # Change this to fix cross-references in HTML +POD2HTML = pod2html \ + --htmlroot=$(HTMLROOT) \ + --podroot=.. --podpath=pod:lib:ext:vms \ + --libpods=perlfunc:perlguts:perlvar:perlrun:perlop + +all: $(CONVERTERS) html + +PERL = ..\miniperl.exe +PL2BAT = ..\win32\bin\pl2bat.bat + +POD = \ + perl.pod \ + perldelta.pod \ + perldata.pod \ + perlsyn.pod \ + perlop.pod \ + perlre.pod \ + perlrun.pod \ + perlfunc.pod \ + perlvar.pod \ + perlsub.pod \ + perlmod.pod \ + perlform.pod \ + perllocale.pod \ + perlref.pod \ + perldsc.pod \ + perllol.pod \ + perltoot.pod \ + perlobj.pod \ + perltie.pod \ + perlbot.pod \ + perlipc.pod \ + perldebug.pod \ + perldiag.pod \ + perlsec.pod \ + perltrap.pod \ + perlstyle.pod \ + perlpod.pod \ + perlbook.pod \ + perlembed.pod \ + perlapio.pod \ + perlxs.pod \ + perlxstut.pod \ + perlguts.pod \ + perlcall.pod \ + perlfaq.pod \ + perlfaq1.pod \ + perlfaq2.pod \ + perlfaq3.pod \ + perlfaq4.pod \ + perlfaq5.pod \ + perlfaq6.pod \ + perlfaq7.pod \ + perlfaq8.pod \ + perlfaq9.pod \ + perltoc.pod + +MAN = \ + perl.man \ + perldelta.man \ + perldata.man \ + perlsyn.man \ + perlop.man \ + perlre.man \ + perlrun.man \ + perlfunc.man \ + perlvar.man \ + perlsub.man \ + perlmod.man \ + perlform.man \ + perllocale.man \ + perlref.man \ + perldsc.man \ + perllol.man \ + perltoot.man \ + perlobj.man \ + perltie.man \ + perlbot.man \ + perlipc.man \ + perldebug.man \ + perldiag.man \ + perlsec.man \ + perltrap.man \ + perlstyle.man \ + perlpod.man \ + perlbook.man \ + perlembed.man \ + perlapio.man \ + perlxs.man \ + perlxstut.man \ + perlguts.man \ + perlcall.man \ + perlfaq.man \ + perlfaq1.man \ + perlfaq2.man \ + perlfaq3.man \ + perlfaq4.man \ + perlfaq5.man \ + perlfaq6.man \ + perlfaq7.man \ + perlfaq8.man \ + perlfaq9.man \ + perltoc.man + +HTML = \ + perl.html \ + perldelta.html \ + perldata.html \ + perlsyn.html \ + perlop.html \ + perlre.html \ + perlrun.html \ + perlfunc.html \ + perlvar.html \ + perlsub.html \ + perlmod.html \ + perlform.html \ + perllocale.html \ + perlref.html \ + perldsc.html \ + perllol.html \ + perltoot.html \ + perlobj.html \ + perltie.html \ + perlbot.html \ + perlipc.html \ + perldebug.html \ + perldiag.html \ + perlsec.html \ + perltrap.html \ + perlstyle.html \ + perlpod.html \ + perlbook.html \ + perlembed.html \ + perlapio.html \ + perlxs.html \ + perlxstut.html \ + perlguts.html \ + perlcall.html \ + perlfaq.html \ + perlfaq1.html \ + perlfaq2.html \ + perlfaq3.html \ + perlfaq4.html \ + perlfaq5.html \ + perlfaq6.html \ + perlfaq7.html \ + perlfaq8.html \ + perlfaq9.html +# not perltoc.html + +TEX = \ + perl.tex \ + perldelta.tex \ + perldata.tex \ + perlsyn.tex \ + perlop.tex \ + perlre.tex \ + perlrun.tex \ + perlfunc.tex \ + perlvar.tex \ + perlsub.tex \ + perlmod.tex \ + perlform.tex \ + perllocale.tex \ + perlref.tex \ + perldsc.tex \ + perllol.tex \ + perltoot.tex \ + perlobj.tex \ + perltie.tex \ + perlbot.tex \ + perlipc.tex \ + perldebug.tex \ + perldiag.tex \ + perlsec.tex \ + perltrap.tex \ + perlstyle.tex \ + perlpod.tex \ + perlbook.tex \ + perlembed.tex \ + perlapio.tex \ + perlxs.tex \ + perlxstut.tex \ + perlguts.tex \ + perlcall.tex \ + perlfaq.tex \ + perlfaq1.tex \ + perlfaq2.tex \ + perlfaq3.tex \ + perlfaq4.tex \ + perlfaq5.tex \ + perlfaq6.tex \ + perlfaq7.tex \ + perlfaq8.tex \ + perlfaq9.tex \ + perltoc.tex + +man: pod2man $(MAN) + +html: pod2html $(HTML) + +tex: pod2latex $(TEX) + +toc: + $(PERL) -I..\lib buildtoc >perltoc.pod + +.SUFFIXES: .pm .pod + +.SUFFIXES: .man + +.pm.man: + $(PERL) -I..\lib pod2man $*.pm >$*.man + +.pod.man: + $(PERL) -I..\lib pod2man $*.pod >$*.man + +.SUFFIXES: .html + +.pm.html: + $(PERL) -I..\lib $(POD2HTML) --infile=$*.pm --outfile=$*.html + +.pod.html: + $(PERL) -I..\lib $(POD2HTML) --infile=$*.pod --outfile=$*.html + +.SUFFIXES: .tex + +.pm.tex: + $(PERL) -I..\lib pod2latex $*.pm + +.pod.tex: + $(PERL) -I..\lib pod2latex $*.pod + +clean: + del /f $(MAN) $(HTML) $(TEX) + del /f pod2html-*cache + del /f *.aux *.log + +realclean: clean + del /f $(CONVERTERS) + +distclean: realclean + +check: checkpods + @echo "checking..."; \ + $(PERL) -I..\lib checkpods $(POD) + +# Dependencies. +pod2latex: pod2latex.PL ..\lib\Config.pm + $(PERL) -I..\lib pod2latex.PL + $(PERL) $(PL2BAT) pod2latex + +pod2html: pod2html.PL ..\lib\Config.pm + $(PERL) -I..\lib pod2html.PL + $(PERL) $(PL2BAT) pod2html + +pod2man: pod2man.PL ..\lib\Config.pm + $(PERL) -I..\lib pod2man.PL + $(PERL) $(PL2BAT) pod2man + +pod2text: pod2text.PL ..\lib\Config.pm + $(PERL) -I..\lib pod2text.PL + $(PERL) $(PL2BAT) pod2text + +checkpods: checkpods.PL ..\lib\Config.pm + $(PERL) -I..\lib checkpods.PL + $(PERL) $(PL2BAT) checkpods + + diff --git a/win32/makedef.pl b/win32/makedef.pl index 7a1ddb2..0d510ae 100644 --- a/win32/makedef.pl +++ b/win32/makedef.pl @@ -252,6 +252,9 @@ win32_read win32_write win32_spawnvpe win32_spawnle +win32_mkdir +win32_rmdir +win32_chdir win32_htons win32_ntohs win32_htonl diff --git a/win32/pod.mak b/win32/pod.mak new file mode 100644 index 0000000..538cfa3 --- /dev/null +++ b/win32/pod.mak @@ -0,0 +1,272 @@ +CONVERTERS = pod2html pod2latex pod2man pod2text checkpods + +HTMLROOT = / # Change this to fix cross-references in HTML +POD2HTML = pod2html \ + --htmlroot=$(HTMLROOT) \ + --podroot=.. --podpath=pod:lib:ext:vms \ + --libpods=perlfunc:perlguts:perlvar:perlrun:perlop + +all: $(CONVERTERS) html + +PERL = ..\miniperl.exe +PL2BAT = ..\win32\bin\pl2bat.bat + +POD = \ + perl.pod \ + perldelta.pod \ + perldata.pod \ + perlsyn.pod \ + perlop.pod \ + perlre.pod \ + perlrun.pod \ + perlfunc.pod \ + perlvar.pod \ + perlsub.pod \ + perlmod.pod \ + perlform.pod \ + perllocale.pod \ + perlref.pod \ + perldsc.pod \ + perllol.pod \ + perltoot.pod \ + perlobj.pod \ + perltie.pod \ + perlbot.pod \ + perlipc.pod \ + perldebug.pod \ + perldiag.pod \ + perlsec.pod \ + perltrap.pod \ + perlstyle.pod \ + perlpod.pod \ + perlbook.pod \ + perlembed.pod \ + perlapio.pod \ + perlxs.pod \ + perlxstut.pod \ + perlguts.pod \ + perlcall.pod \ + perlfaq.pod \ + perlfaq1.pod \ + perlfaq2.pod \ + perlfaq3.pod \ + perlfaq4.pod \ + perlfaq5.pod \ + perlfaq6.pod \ + perlfaq7.pod \ + perlfaq8.pod \ + perlfaq9.pod \ + perltoc.pod + +MAN = \ + perl.man \ + perldelta.man \ + perldata.man \ + perlsyn.man \ + perlop.man \ + perlre.man \ + perlrun.man \ + perlfunc.man \ + perlvar.man \ + perlsub.man \ + perlmod.man \ + perlform.man \ + perllocale.man \ + perlref.man \ + perldsc.man \ + perllol.man \ + perltoot.man \ + perlobj.man \ + perltie.man \ + perlbot.man \ + perlipc.man \ + perldebug.man \ + perldiag.man \ + perlsec.man \ + perltrap.man \ + perlstyle.man \ + perlpod.man \ + perlbook.man \ + perlembed.man \ + perlapio.man \ + perlxs.man \ + perlxstut.man \ + perlguts.man \ + perlcall.man \ + perlfaq.man \ + perlfaq1.man \ + perlfaq2.man \ + perlfaq3.man \ + perlfaq4.man \ + perlfaq5.man \ + perlfaq6.man \ + perlfaq7.man \ + perlfaq8.man \ + perlfaq9.man \ + perltoc.man + +HTML = \ + perl.html \ + perldelta.html \ + perldata.html \ + perlsyn.html \ + perlop.html \ + perlre.html \ + perlrun.html \ + perlfunc.html \ + perlvar.html \ + perlsub.html \ + perlmod.html \ + perlform.html \ + perllocale.html \ + perlref.html \ + perldsc.html \ + perllol.html \ + perltoot.html \ + perlobj.html \ + perltie.html \ + perlbot.html \ + perlipc.html \ + perldebug.html \ + perldiag.html \ + perlsec.html \ + perltrap.html \ + perlstyle.html \ + perlpod.html \ + perlbook.html \ + perlembed.html \ + perlapio.html \ + perlxs.html \ + perlxstut.html \ + perlguts.html \ + perlcall.html \ + perlfaq.html \ + perlfaq1.html \ + perlfaq2.html \ + perlfaq3.html \ + perlfaq4.html \ + perlfaq5.html \ + perlfaq6.html \ + perlfaq7.html \ + perlfaq8.html \ + perlfaq9.html +# not perltoc.html + +TEX = \ + perl.tex \ + perldelta.tex \ + perldata.tex \ + perlsyn.tex \ + perlop.tex \ + perlre.tex \ + perlrun.tex \ + perlfunc.tex \ + perlvar.tex \ + perlsub.tex \ + perlmod.tex \ + perlform.tex \ + perllocale.tex \ + perlref.tex \ + perldsc.tex \ + perllol.tex \ + perltoot.tex \ + perlobj.tex \ + perltie.tex \ + perlbot.tex \ + perlipc.tex \ + perldebug.tex \ + perldiag.tex \ + perlsec.tex \ + perltrap.tex \ + perlstyle.tex \ + perlpod.tex \ + perlbook.tex \ + perlembed.tex \ + perlapio.tex \ + perlxs.tex \ + perlxstut.tex \ + perlguts.tex \ + perlcall.tex \ + perlfaq.tex \ + perlfaq1.tex \ + perlfaq2.tex \ + perlfaq3.tex \ + perlfaq4.tex \ + perlfaq5.tex \ + perlfaq6.tex \ + perlfaq7.tex \ + perlfaq8.tex \ + perlfaq9.tex \ + perltoc.tex + +man: pod2man $(MAN) + +html: pod2html $(HTML) + +tex: pod2latex $(TEX) + +toc: + $(PERL) -I..\lib buildtoc >perltoc.pod + +.SUFFIXES: .pm .pod + +.SUFFIXES: .man + +.pm.man: + $(PERL) -I..\lib pod2man $*.pm >$*.man + +.pod.man: + $(PERL) -I..\lib pod2man $*.pod >$*.man + +.SUFFIXES: .html + +.pm.html: + $(PERL) -I..\lib $(POD2HTML) --infile=$*.pm --outfile=$*.html + +.pod.html: + $(PERL) -I..\lib $(POD2HTML) --infile=$*.pod --outfile=$*.html + +.SUFFIXES: .tex + +.pm.tex: + $(PERL) -I..\lib pod2latex $*.pm + +.pod.tex: + $(PERL) -I..\lib pod2latex $*.pod + +clean: + del /f $(MAN) $(HTML) $(TEX) + del /f pod2html-*cache + del /f *.aux *.log + +realclean: clean + del /f $(CONVERTERS) + +distclean: realclean + +check: checkpods + @echo "checking..."; \ + $(PERL) -I..\lib checkpods $(POD) + +# Dependencies. +pod2latex: pod2latex.PL ..\lib\Config.pm + $(PERL) -I..\lib pod2latex.PL + $(PERL) $(PL2BAT) pod2latex + +pod2html: pod2html.PL ..\lib\Config.pm + $(PERL) -I..\lib pod2html.PL + $(PERL) $(PL2BAT) pod2html + +pod2man: pod2man.PL ..\lib\Config.pm + $(PERL) -I..\lib pod2man.PL + $(PERL) $(PL2BAT) pod2man + +pod2text: pod2text.PL ..\lib\Config.pm + $(PERL) -I..\lib pod2text.PL + $(PERL) $(PL2BAT) pod2text + +checkpods: checkpods.PL ..\lib\Config.pm + $(PERL) -I..\lib checkpods.PL + $(PERL) $(PL2BAT) checkpods + + diff --git a/win32/win32.c b/win32/win32.c index 5efca7c..7bb003d 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -345,7 +345,7 @@ do_aspawn(void* really, void** mark, void** arglast) SV *sv = (SV*)really; SV** pSv = (SV**)mark; - New(1110, argv, (arglast - mark) + 3, char*); + New(1110, argv, (arglast - mark) + 4, char*); if(sv != Nullsv) { cmd = SvPV(sv, length); @@ -356,8 +356,8 @@ do_aspawn(void* really, void** mark, void** arglast) argv[index++] = "/c"; } - while(pSv <= (SV**)arglast) { - sv = *pSv++; + while(++pSv <= (SV**)arglast) { + sv = *pSv; strPtr = SvPV(sv, length); if(strPtr != NULL && *strPtr != '\0') argv[index++] = strPtr; @@ -369,8 +369,12 @@ do_aspawn(void* really, void** mark, void** arglast) Safefree(argv); - /* set statusvalue the perl variable $? */ - return (statusvalue = status*256); + if (status < 0) { + if (dowarn) + warn("Can't spawn \"%s\": %s", cmd, strerror(errno)); + status = 255 << 8; + } + return (status); } int @@ -421,9 +425,13 @@ do_spawn(char *cmd) "/x", "/c", cmd, (char*)0, environ); } - - /* set statusvalue the perl variable $? */ - return (statusvalue = status*256); + if (status < 0) { + if (dowarn) + warn("Can't spawn \"%s\": %s", needToTry ? shell : argv[0], + strerror(errno)); + status = 255 << 8; + } + return (status); } @@ -1034,6 +1042,21 @@ win32_write(int fd, const char *buf, unsigned int cnt) } DllExport int +win32_mkdir(const char *dir, int mode) +{ + return pIOSubSystem->pfnmkdir(dir); /* just ignore mode */ +} +DllExport int +win32_rmdir(const char *dir) +{ + return pIOSubSystem->pfnrmdir(dir); +} +DllExport int +win32_chdir(const char *dir) +{ + return pIOSubSystem->pfnchdir(dir); +} +DllExport int win32_spawnvpe(int mode, const char *cmdname, const char *const *argv, const char *const *envp) { diff --git a/win32/win32.h b/win32/win32.h index 7d252f7..31dfde0 100644 --- a/win32/win32.h +++ b/win32/win32.h @@ -52,15 +52,6 @@ extern FILE *myfdopen(int, char *); #define OP_BINARY _O_BINARY /* Mistake in in pp_sys.c. */ -#undef mkdir -#define mkdir(nm, md) _mkdir(nm) /* For UNIX compatibility. */ - -#undef chdir -#define chdir(nm) _chdir(nm) - -#undef rmdir -#define rmdir(nm) _rmdir(nm) - #undef pipe #define pipe(fd) win32_pipe((fd), 512, _O_BINARY) /* the pipe call is a bit different */ diff --git a/win32/win32io.c b/win32/win32io.c index 333b64a..b4f5824 100644 --- a/win32/win32io.c +++ b/win32/win32io.c @@ -16,7 +16,7 @@ extern "C" { #include #include #include - +#include #include "win32iop.h" /* @@ -231,6 +231,9 @@ WIN32_IOSUBSYSTEM win32stdio = { my_open_osfhandle, my_get_osfhandle, spawnvpe, + _mkdir, + _rmdir, + _chdir, 87654321L, /* end of structure */ }; diff --git a/win32/win32io.h b/win32/win32io.h index 3ebc70a..f73eea1 100644 --- a/win32/win32io.h +++ b/win32/win32io.h @@ -51,6 +51,9 @@ int (*pfnopenmode)(int mode); int (*pfn_open_osfhandle)(long handle, int flags); long (*pfn_get_osfhandle)(int fd); int (*pfnspawnvpe)(int mode, const char *cmdname, const char *const *argv, const char *const *envp); +int (*pfnmkdir)(const char *path); +int (*pfnrmdir)(const char *path); +int (*pfnchdir)(const char *path); int signature_end; } WIN32_IOSUBSYSTEM; diff --git a/win32/win32iop.h b/win32/win32iop.h index c0d1d57..d699e03 100644 --- a/win32/win32iop.h +++ b/win32/win32iop.h @@ -58,6 +58,9 @@ EXT int win32_write(int fd, const void *buf, unsigned int cnt); EXT int win32_spawnvpe(int mode, const char *cmdname, const char *const *argv, const char *const *envp); EXT int win32_spawnle(int mode, const char *cmdname, const char *,...); +EXT int win32_mkdir(const char *dir, int mode); +EXT int win32_rmdir(const char *dir); +EXT int win32_chdir(const char *dir); /* * these two are win32 specific but still io related @@ -129,6 +132,9 @@ void * SetIOSubSystem(void *piosubsystem); #define _get_osfhandle stolen_get_osfhandle #define spawnvpe win32_spawnvpe #define spawnle win32_spawnle +#define mkdir win32_mkdir +#define rmdir win32_rmdir +#define chdir win32_chdir #endif /* WIN32IO_IS_STDIO */ #endif /* WIN32IOP_H */