diff options
author | Perl 5 Porters <perl5-porters@africa.nicoh.com> | 1997-01-29 18:11:00 +1200 |
---|---|---|
committer | Chip Salzenberg <chip@atlantic.net> | 1997-01-29 18:11:00 +1200 |
commit | 0a753a764065f2260004b6e6975085378b850346 (patch) | |
tree | e5163ab53209cc4bf655cabaf4067f18036a9106 | |
parent | 4b094ceb80288fc9f7c15ae78fc662051510284d (diff) | |
download | perl-0a753a764065f2260004b6e6975085378b850346.tar.gz |
[inseparable changes from patch from perl5.003_23 to perl5.003_24]perl-5.003_24
CORE LANGUAGE CHANGES
Subject: glob defaults to $_
Date: Mon, 27 Jan 1997 03:09:13 -0500
From: Gurusamy Sarathy <gsar@engin.umich.edu>
Files: op.c opcode.pl pod/perlfunc.pod t/op/glob.t
private-msgid: <199701270809.DAA00934@aatma.engin.umich.edu>
Subject: Re: an overloading bug
Date: Sun, 26 Jan 1997 19:07:45 -0500
From: Gurusamy Sarathy <gsar@engin.umich.edu>
Files: pod/perldiag.pod pod/perlfunc.pod pp_ctl.c
private-msgid: <199701270007.TAA26525@aatma.engin.umich.edu>
CORE PORTABILITY
Subject: Win32 port
From: Gary Ng <71564.1743@compuserve.com>
Files: MANIFEST win32/*
Subject: Amiga files
Date: Sun, 26 Jan 1997 17:42:15 +0100
From: Norbert Pueschel <pueschel@imsdd.meb.uni-bonn.de>
Files: MANIFEST README.amiga hints/amigaos.sh
private-msgid: <77724712@Armageddon.meb.uni-bonn.de>
DOCUMENTATION
Subject: perldelta Fcntl enhancement
Date: Sat, 25 Jan 1997 17:05:34 +0200 (EET)
From: Jarkko Hietaniemi <jhi@cc.hut.fi>
Files: pod/perldelta.pod
private-msgid: <199701251505.RAA22159@alpha.hut.fi>
Subject: Updates to perldelta re: Fcntl, DB_File, Net::Ping
From: Paul Marquess <pmarquess@bfsec.bt.co.uk>
Files: pod/perldelta.pod
Subject: Document restrictions on gv_fetchmethod() and perl_call_sv()
From: Chip Salzenberg <chip@atlantic.net>
Files: pod/perldelta.pod pod/perlguts.pod
Subject: perldiag.pod: No comma allowed after %s
Date: Sat, 25 Jan 1997 17:41:53 +0200 (EET)
From: Jarkko Hietaniemi <Jarkko.Hietaniemi@cc.hut.fi>
Files: pod/perldiag.pod
private-msgid: <199701251541.RAA04120@alpha.hut.fi>
Subject: perlfunc.pod: localtime
Date: Sat, 25 Jan 1997 18:29:37 +0200 (EET)
From: Jarkko Hietaniemi <jhi@cc.hut.fi>
Files: pod/perlfunc.pod
private-msgid: <199701251629.SAA08114@alpha.hut.fi>
Subject: perlfunc diff: gmtime
Date: Tue, 28 Jan 1997 14:52:08 +0000
From: Peter Haworth <pmh@edison.ioppublishing.com>
Files: pod/perlfunc.pod
private-msgid: <32EE1298.7B90@edison.ioppublishing.com>
Subject: Updates to guts
Date: Sun, 26 Jan 1997 19:34:18 -0500 (EST)
From: Ilya Zakharevich <ilya@math.ohio-state.edu>
Files: pod/perlguts.pod
private-msgid: <199701270034.TAA13177@monk.mps.ohio-state.edu>
TESTS
Subject: New test op/closure.t
From: Tom Phoenix <rootbeer@teleport.com>
Files: MANIFEST t/op/closure.t
67 files changed, 17144 insertions, 114 deletions
@@ -9,6 +9,192 @@ releases.) ---------------- +Version 5.003_24 +---------------- + +This release is the second candidate for a public beta test. +It's, well, bunches better than _23. + + CORE LANGUAGE CHANGES + + Title: "glob defaults to $_" + From: Gurusamy Sarathy <gsar@engin.umich.edu> + Msg-ID: <199701270809.DAA00934@aatma.engin.umich.edu> + Date: Mon, 27 Jan 1997 03:09:13 -0500 + Files: op.c opcode.pl pod/perlfunc.pod t/op/glob.t + + Title: "Re: an overloading bug " + From: Gurusamy Sarathy <gsar@engin.umich.edu> + Msg-ID: <199701270007.TAA26525@aatma.engin.umich.edu> + Date: Sun, 26 Jan 1997 19:07:45 -0500 + Files: pod/perldiag.pod pod/perlfunc.pod pp_ctl.c + + Title: "Don't warn on C<$\ = undef>" + From: Chip Salzenberg <chip@atlantic.net> + Files: mg.c + + CORE PORTABILITY + + Title: "Win32 port" + From: Gary Ng <71564.1743@compuserve.com> + Files: MANIFEST win32/* + + Title: "Amiga files" + From: Norbert Pueschel <pueschel@imsdd.meb.uni-bonn.de> + Msg-ID: <77724712@Armageddon.meb.uni-bonn.de> + Date: Sun, 26 Jan 1997 17:42:15 +0100 + Files: MANIFEST README.amiga hints/amigaos.sh + + Title: "New dec_osf hints" + From: Jarkko.Hietaniemi@cc.hut.fi + Msg-ID: <199701271233.OAA21548@alpha.hut.fi> + Date: Mon, 27 Jan 1997 14:33:01 +0200 (EET) + Files: hints/dec_osf.sh + + OTHER CORE CHANGES + + Title: "Prevent premature death of @_ during leavesub" + From: Chip Salzenberg <chip@atlantic.net> + Files: pp_hot.c t/op/misc.t + + Title: "Deref old stash when re-blessing" + From: Chip Salzenberg <chip@atlantic.net> + Files: sv.c + + Title: "Don't abort when RCHECK and DEBUGGING" + From: Tim Bunce <Tim.Bunce@ig.co.uk> + Msg-ID: <9701272339.AA16537@toad.ig.co.uk> + Date: Mon, 27 Jan 1997 23:39:48 +0000 + Files: malloc.c + + Title: "Fix overloading macro conflict with Digital 'cc -fast'" + From: Jarkko Hietaniemi <jhi@cc.hut.fi> + Msg-ID: <199701272216.AAA04557@alpha.hut.fi> + Date: Tue, 28 Jan 1997 00:16:49 +0200 (EET) + Files: perl.h + + Title: "global.sym: typo?" + From: Jarkko Hietaniemi <jhi@cc.hut.fi> + Msg-ID: <199701261937.VAA07556@alpha.hut.fi> + Date: Sun, 26 Jan 1997 21:37:59 +0200 (EET) + Files: global.sym + + BUILD PROCESS + + Title: "Put all extensions' modules in $archlib" + From: Chip Salzenberg <chip@atlantic.net> + Files: installperl + + Title: "Configure fixes: set $archlib, omit _NO_PROTO" + From: Chip Salzenberg <chip@atlantic.net> + Files: Configure + + Title: "Make configure{,.gnu} ignore --cache-file option" + From: Norbert Pueschel <pueschel@imsdd.meb.uni-bonn.de> + Files: configure configure.gnu + + LIBRARY AND EXTENSIONS + + Title: "Version checking in XS bootstrap is optional" + From: Chip Salzenberg <chip@atlantic.net> + Files: XSUB.h + + Title: "Update $VERSION of DynaLoader and POSIX" + From: Chip Salzenberg <chip@atlantic.net> + Files: ext/DynaLoader/DynaLoader.pm ext/POSIX/POSIX.pm + + Title: "Refresh Text::Wrap to 97.011701" + From: Chip Salzenberg <chip@atlantic.net> + Files: lib/Text/Wrap.pm + + Title: "Fcntl.xs: F_[GS]ETOWN were in wrong case branch" + From: Jarkko Hietaniemi <jhi@cc.hut.fi> + Msg-ID: <199701251510.RAA05142@alpha.hut.fi> + Date: Sat, 25 Jan 1997 17:10:20 +0200 (EET) + Files: ext/Fcntl/Fcntl.pm ext/Fcntl/Fcntl.xs + + Title: "Fix $Is_VMS typo in Test::Harness" + From: Chip Salzenberg <chip@atlantic.net> + Files: lib/Test/Harness.pm + + Title: "Allow for really big keys in Tie::SubstrHash" + From: data-drift@so.uio.no + Msg-ID: <199701282014.VAA12645@selters.uio.no> + Date: Tue, 28 Jan 1997 21:14:34 +0100 (MET) + Files: lib/Tie/SubstrHash.pm + + Title: "Avoid newRV_noinc() in IO, for compiling with old Perls" + From: Chip Salzenberg <chip@atlantic.net> + Files: ext/IO/IO.xs + + TESTS + + Title: "New test op/closure.t" + From: Tom Phoenix <rootbeer@teleport.com>, Ulrich Pfeifer + Files: MANIFEST t/op/closure.t + + UTILITIES + + Title: "xsubpp handing of void funcs breaks extensions using XST_m*()" + From: Tim Bunce <Tim.Bunce@ig.co.uk> + Msg-ID: <9701271659.AA15137@toad.ig.co.uk> + Date: Mon, 27 Jan 1997 16:59:06 +0000 + Files: lib/ExtUtils/xsubpp + + DOCUMENTATION + + Title: "perldelta Fcntl enhancement" + From: Jarkko Hietaniemi <jhi@cc.hut.fi> + Msg-ID: <199701251505.RAA22159@alpha.hut.fi> + Date: Sat, 25 Jan 1997 17:05:34 +0200 (EET) + Files: pod/perldelta.pod + + Title: "Updates to perldelta re: Fcntl, DB_File, Net::Ping" + From: pmarquess@bfsec.bt.co.uk (Paul Marquess) + Files: pod/perldelta.pod + + Title: "Document restrictions on gv_fetchmethod() and perl_call_sv()" + From: Chip Salzenberg <chip@atlantic.net> + Files: pod/perldelta.pod pod/perlguts.pod + + Title: "perldiag.pod: No comma allowed after %s" + From: Jarkko.Hietaniemi@cc.hut.fi + Msg-ID: <199701251541.RAA04120@alpha.hut.fi> + Date: Sat, 25 Jan 1997 17:41:53 +0200 (EET) + Files: pod/perldiag.pod + + Title: "perlfunc.pod: localtime" + From: Jarkko Hietaniemi <jhi@cc.hut.fi> + Msg-ID: <199701251629.SAA08114@alpha.hut.fi> + Date: Sat, 25 Jan 1997 18:29:37 +0200 (EET) + Files: pod/perlfunc.pod + + Title: "perlfunc diff: gmtime" + From: Peter Haworth <pmh@edison.ioppublishing.com> + Msg-ID: <32EE1298.7B90@edison.ioppublishing.com> + Date: Tue, 28 Jan 1997 14:52:08 +0000 + Files: pod/perlfunc.pod + + Title: "Updates to guts" + From: Ilya Zakharevich <ilya@math.ohio-state.edu> + Msg-ID: <199701270034.TAA13177@monk.mps.ohio-state.edu> + Date: Sun, 26 Jan 1997 19:34:18 -0500 (EST) + Files: pod/perlguts.pod + + Title: "perltoot fixes" + From: Tom Christiansen <tchrist@mox.perl.com> + Msg-ID: <6807.854214205@jinete> + Date: Sat, 25 Jan 1997 09:43:25 -0800 + Files: pod/perltoot.pod + + Title: "5.003_23: small typo in perlsyn.pod" + From: Gurusamy Sarathy <gsar@engin.umich.edu> + Msg-ID: <199701270824.DAA01169@aatma.engin.umich.edu> + Date: Mon, 27 Jan 1997 03:24:25 -0500 + Files: pod/perlsyn.pod + + +---------------- Version 5.003_23 ---------------- @@ -15,6 +15,7 @@ MANIFEST This list of files Makefile.SH A script that generates Makefile Porting/Glossary Glossary of config.sh variables README The Instructions +README.amiga Notes about AmigaOS port README.os2 Notes about OS/2 port README.plan9 Notes about Plan9 port README.qnx Notes about QNX port @@ -528,7 +529,7 @@ pod/perlxstut.pod XS tutorial pod/pod2html.PL Precursor for translator to turn pod into HTML pod/pod2latex.PL Precursor for translator to turn pod into LaTeX pod/pod2man.PL Precursor for translator to turn pod into manpage -pod/pod2text.PL Precursor for translator to turn pod into text +pod/pod2text.PL Precursor for translator to turn pod into text pod/roffitall troff the whole man page set pod/rofftoc Generate a table of contents in troff format pod/splitman Splits perlfunc into multiple man pages @@ -641,6 +642,7 @@ t/op/assignwarn.t See if OP= operators warn correctly for undef targets t/op/auto.t See if autoincrement et all work t/op/bop.t See if bitops work t/op/chop.t See if chop works +t/op/closure.t See if closures work t/op/cmp.t See if the various string and numeric compare work t/op/cond.t See if conditional expressions work t/op/delete.t See if delete works @@ -752,6 +754,53 @@ vms/vms.c VMS-specific C code for Perl core vms/vms_yfix.pl convert Unix perly.[ch] to VMS perly_[ch].vms vms/vmsish.h VMS-specific C header for Perl core vms/writemain.pl Generate perlmain.c from miniperlmain.c+extensions +win32/EXTERN.h Win32 port +win32/Fcntl.mak Win32 port +win32/IO.mak Win32 port +win32/Makefile Win32 port +win32/Opcode.mak Win32 port +win32/README Win32 port +win32/SDBM_File.mak Win32 port +win32/Socket.mak Win32 port +win32/TEST Win32 port +win32/autosplit.pl Win32 port +win32/bin/PL2BAT.BAT Win32 port +win32/bin/network.pl Win32 port +win32/bin/search.bat Win32 port +win32/bin/test.bat Win32 port +win32/bin/webget.bat Win32 port +win32/bin/www.pl Win32 port +win32/config.h Win32 port +win32/config.w32 Win32 port +win32/dl_win32.xs Win32 port +win32/dosish.diff Win32 port +win32/dosish.h Win32 port +win32/genxsdef.pl Win32 port +win32/include/arpa/inet.h Win32 port +win32/include/dirent.h Win32 port +win32/include/netdb.h Win32 port +win32/include/sys/socket.h Win32 port +win32/libperl.mak Win32 port +win32/makedef.pl Win32 port +win32/makemain.pl Win32 port +win32/makeperldef.pl Win32 port +win32/miniperl.mak Win32 port +win32/modules.mak Win32 port +win32/perl.mak Win32 port +win32/perldll.mak Win32 port +win32/perlglob.c Win32 port +win32/perlglob.mak Win32 port +win32/perllib.c Win32 port +win32/perlmain.c Win32 port +win32/runperl.c Win32 port +win32/splittree.pl Win32 port +win32/win32.c Win32 port +win32/win32.h Win32 port +win32/win32aux.cpp Win32 port +win32/win32io.cpp Win32 port +win32/win32io.h Win32 port +win32/win32iop.h Win32 port +win32/win32sck.c Win32 port writemain.SH Generate perlmain.c from miniperlmain.c+extensions x2p/EXTERN.h Same as above x2p/INTERN.h Same as above diff --git a/README.amiga b/README.amiga new file mode 100644 index 0000000000..b20c0239ae --- /dev/null +++ b/README.amiga @@ -0,0 +1,233 @@ +If you read this file _as_is_, just ignore the funny characters you +see. It is written in the POD format (see perlpod manpage) which is +specially designed to be readable as is. + +=head1 NAME + +perlamiga - Perl under Amiga OS + +=head1 SYNOPSIS + +One can read this document in the following formats: + + man perlamiga + multiview perlamiga.guide + +to list some (not all may be available simultaneously), or it may +be read I<as is>: either as F<README.amiga>, or F<pod/perlamiga.pod>. + +=cut + +Contents + + perlamiga - Perl under Amiga OS + + NAME + SYNOPSIS + DESCRIPTION + - Prerequisites + - Starting Perl programs under AmigaOS + INSTALLATION + Accessing documentation + - Manpages + - HTML + - GNU info files + - LaTeX docs + BUILD + - Prerequisites + - Getting the perl source + - Application of the patches + - Making + - Testing + - Installing the built perl + AUTHOR + SEE ALSO + +=head1 DESCRIPTION + +=head2 Prerequisites + +=over 6 + +=item B<Unix emulation for AmigaOS: ixemul.library> + +You need the Unix emulation for AmigaOS, whose most important part is +B<ixemul.library>. For a minimum setup, get the following archives from +ftp://ftp.ninemoons.com/pub/ade/current or a mirror: + +ixemul-45.1-bin.lha +ixemul-45.1-env-bin.lha +pdksh-4.9-bin.lha +ADE-misc-bin.lha + +Note that there might be newer versions available by the time you read +this. + +Note also that this is a minimum setup; you might want to add other +packages of B<ADE> (the I<Amiga Developers Environment>). + +=item B<Version of Amiga OS> + +You need at the very least AmigaOS version 2.0. Recommended is version 3.1. + +=back + +=head2 Starting Perl programs under AmigaOS + +Start your Perl program F<foo> with arguments C<arg1 arg2 arg3> the +same way as on any other platform, by + + perl foo arg1 arg2 arg3 + +If you want to specify perl options C<-my_opts> to the perl itself (as +opposed to to your program), use + + perl -my_opts foo arg1 arg2 arg3 + +Alternately, you can try to get a replacement for the system's B<Execute> +command that honors the #!/usr/bin/perl syntax in scripts and set the s-Bit +of your scripts. Then you can invoke your scripts like under UNIX with + + foo arg1 arg2 arg3 + +(Note that having *nixish full path to perl F</usr/bin/perl> is not +necessary, F<perl> would be enough, but having full path would make it +easier to use your script under *nix.) + +=head1 INSTALLATION + +Change to the installation directory (most probably ADE:), and +extract the binary distribution: + +lha -mraxe x perl-5.003-bin.lha + +or + +tar xvzpf perl-5.003-bin.tgz + +(Of course you need lha or tar and gunzip for this.) + +For installation of the Unix emulation, read the appropriate docs. + +=head1 Accessing documentation + +=head2 Manpages + +If you have C<man> installed on your system, and you installed perl +manpages, use something like this: + + man perlfunc + man less + man ExtUtils.MakeMaker + +to access documentation for different components of Perl. Start with + + man perl + +Note: You have to modify your man.conf file to search for manpages +in the /ade/lib/perl5/man/man3 directory, or the man pages for the +perl library will not be found. + +Note that dot (F<.>) is used as a package separator for documentation +for packages, and as usual, sometimes you need to give the section - C<3> +above - to avoid shadowing by the I<less(1) manpage>. + + +=head2 B<HTML> + +If you have some WWW browser available, you can build B<HTML> docs. +Cd to directory with F<.pod> files, and do like this + + cd /ade/lib/perl5/pod + pod2html + +After this you can direct your browser the file F<perl.html> in this +directory, and go ahead with reading docs. + +Alternatively you may be able to get these docs prebuilt from C<CPAN>. + +=head2 B<GNU> C<info> files + +Users of C<Emacs> would appreciate it very much, especially with +C<CPerl> mode loaded. You need to get latest C<pod2info> from C<CPAN>, +or, alternately, prebuilt info pages. + +=head2 C<LaTeX> docs + +can be constructed using C<pod2latex>. + +=head1 BUILD + +Here we discuss how to build Perl under AmigaOS. + +=head2 Prerequisites + +You need to have the latest B<ADE> (Amiga Developers Environment) +from ftp://ftp.ninemoons.com/pub/ade/current. +Also, you need a lot of free memory, probably at least 8MB. + +=head2 Getting the perl source + +You can either get the latest perl-for-amiga source from Ninemoons +and extract it with: + + tar xvzpf perl-5.004-src.tgz + +or get the official source from CPAN: + + http://www.perl.com/CPAN/src/5.0 + +Extract it like this + + tar xvzpf perl5.004.tar.gz + +You will see a message about errors while extracting F<Configure>. This +is normal and expected. (There is a conflict with a similarly-named file +F<configure>, but it causes no harm.) + +=head2 Making + + sh configure.gnu --prefix=/ade + +Now + + make + +=head2 Testing + +Now run + + make test + +Some tests will fail. Here is which, and why: + +=over 8 + +=item F<io/fs.t>, F<op/stat.t>, F<lib/*dbm.t>, F<lib/db-*.t> + +Check I<file system> operations. Failures result from the inability to +emulate some Unixisms with the standard Amiga filesystem. + +=item F<io/pipe.t>, F<op/fork.t>, F<lib/filehand.t>, F<lib/open2.t>, + F<lib/open3.t>, F<lib/io_pipe.t>, F<lib/io_sock.t> + +These tests will be skipped because they use the fork() function, which is not +supported under AmigaOS. + +=back + +=head2 Installing the built perl + +Run + + make install + +=head1 AUTHOR + +Norbert Pueschel, pueschel@imsdd.meb.uni-bonn.de + +=head1 SEE ALSO + +perl(1). + +=cut @@ -850,7 +850,6 @@ #define push_return Perl_push_return #define push_scope Perl_push_scope #define q Perl_q -#define qrt_amg Perl_qrt_amg #define rcsid Perl_rcsid #define reall_srchlen Perl_reall_srchlen #define ref Perl_ref @@ -970,6 +969,7 @@ #define sle_amg Perl_sle_amg #define slt_amg Perl_slt_amg #define sne_amg Perl_sne_amg +#define sqrt_amg Perl_sqrt_amg #define stack_base Perl_stack_base #define stack_grow Perl_stack_grow #define stack_max Perl_stack_max diff --git a/hints/amigaos.sh b/hints/amigaos.sh index 6c00d7638c..29d3880a50 100644 --- a/hints/amigaos.sh +++ b/hints/amigaos.sh @@ -6,10 +6,7 @@ archname='m68k-amigaos' cc='gcc' firstmakefile='GNUmakefile' -ccflags='-DAMIGAOS -mstackextend' -optimize='-O2 -fomit-frame-pointer' - -usenm='y' +usenm='true' usemymalloc='n' usevfork='true' useperlio='true' @@ -18,21 +15,37 @@ d_fork='undef' d_vfork='define' groupstype='int' +# compiler & linker flags + +ccflags='-DAMIGAOS -mstackextend' +ldflags='' +optimize='-O2 -fomit-frame-pointer' + +# uncomment the following settings if you are compiling for an 68020+ system + +# ccflags='-DAMIGAOS -mstackextend -m68020 -resident32' +# ldflags='-m68020 -resident32' + # libs -libpth="/local/lib $prefix/lib" +libpth="$prefix/lib /local/lib" glibpth="$libpth" xlibpth="$libpth" -libswanted='dld m c gdbm' +libswanted='gdbm m' so=' ' # dynamic loading -dlext='o' -cccdlflags='none' -ccdlflags='none' -lddlflags='-oformat a.out-amiga -r' +usedl='n' + +# uncomment the following line if a working version of dld is available + +# usedl='y' +# dlext='o' +# cccdlflags='none' +# ccdlflags='none' +# lddlflags='-oformat a.out-amiga -r' # Avoid telldir prototype conflict in pp_sys.c (AmigaOS uses const DIR *) # Configure should test for this. Volunteers? @@ -3880,6 +3880,8 @@ OP *op; newGVOP(OP_GV, 0, gv))))); return ck_subr(op); } + if ((op->op_flags & OPf_KIDS) && !cLISTOP->op_first->op_sibling) + append_elem(OP_GLOB, op, newSVREF(newGVOP(OP_GV, 0, defgv))); gv = newGVgen("main"); gv_IOadd(gv); append_elem(OP_GLOB, op, newGVOP(OP_GV, 0, gv)); @@ -2158,7 +2158,7 @@ EXT U32 opargs[] = { 0x0000098c, /* ref */ 0x00009104, /* bless */ 0x00000008, /* backtick */ - 0x00001108, /* glob */ + 0x00009908, /* glob */ 0x00000008, /* readline */ 0x00000008, /* rcatline */ 0x00000104, /* regcmaybe */ @@ -224,7 +224,8 @@ bless bless ck_fun s S S? # Pushy I/O. backtick backticks ck_null t -glob glob ck_glob t S S +# glob defaults its first arg to $_ +glob glob ck_glob t S? S? readline <HANDLE> ck_null t rcatline append I/O operator ck_null t diff --git a/patchlevel.h b/patchlevel.h index 2603bc141a..603aaa3ac4 100644 --- a/patchlevel.h +++ b/patchlevel.h @@ -1,5 +1,5 @@ #define PATCHLEVEL 3 -#define SUBVERSION 23 +#define SUBVERSION 24 /* local_patches -- list of locally applied less-than-subversion patches. diff --git a/pod/perldelta.pod b/pod/perldelta.pod index b33f1ff81f..04e9a45ab8 100644 --- a/pod/perldelta.pod +++ b/pod/perldelta.pod @@ -34,21 +34,6 @@ application of opcode masks. The revised Safe module has a new API and is implemented using the new Opcode module. Please read the new Opcode and Safe documentation. -=head2 Extended Fcntl Module - -The Fcntl module now supports these new constants - - F_GETOWN F_SETOWN - O_ASYNC O_DEFER O_DSYNC O_RSYNC O_SYNC - O_EXLOCK O_SHLOCK - -provided that your operating system supports these constants. The -constants are for use with the Perl sysopen() and fcntl(). These -constants are also visible for the basic database modules like the -SDBM_File. For the exact meaning of these contants and other Fcntl -constants please refer to the fcntl() documentation of your operating -system. Unsupported constants will cause run-time errors. - =head2 Internal Change: FileHandle Deprecated Filehandles are now stored internally as type IO::Handle. @@ -243,7 +228,7 @@ before, and is fine now: The C<UNIVERSAL> package automatically contains the following methods that are inherited by all other classes: -=over 4 +=over =item isa(CLASS) @@ -429,6 +414,21 @@ provided that your operating system happens to support them: O_ASYNC O_DEFER O_DSYNC O_FSYNC O_SYNC O_EXLOCK O_SHLOCK +These constants are intended for use with the Perl operators sysopen() +and fcntl() and the basic database modules like SDBM_File. For the +exact meaning of these and other Fcntl constants please refer to your +operating system's documentation for fcntl() and open(). + +In addition, the Fcntl module now provides these constants for use +with the Perl operator flock(): + + LOCK_SH LOCK_EX LOCK_NB LOCK_UN + +These constants are defined in all environments (because where there is +no flock() system call, Perl emulates it). However, for historical +reasons, these constants are not exported unless they are explicitly +requested with the ":flock" tag (e.g. C<use Fcntl ':flock'>). + =head2 Module Information Summary Brand new modules, arranged by topic rather than strictly @@ -499,6 +499,52 @@ And these functions are now exported: sinh cosh tanh cotanh asinh acosh atanh acotanh cplx cplxe +=head2 DB_File + +There have been quite a few changes made to DB_File. Here are a few of +the highlights: + +=over + +=item * + +Fixed a handful of bugs. + +=item * + +By public demand, added support for the standard hash function exists(). + +=item * + +Made it compatible with Berkeley DB 1.86. + +=item * + +Made negative subscripts work with RECNO interface. + +=item * + +Changed the default flags from O_RDWR to O_CREAT|O_RDWR and the default +mode from 0640 to 0666. + +=item * + +Made DB_File automatically import the open() constants (O_RDWR, +O_CREAT etc.) from Fcntl, if available. + +=item * + +Updated documentation. + +=back + +Refer to the HISTORY section in DB_File.pm for a complete list of +changes. Everything after DB_File 1.01 has been added since 5.003. + +=head2 Net::Ping + +Major rewrite - support added for both udp echo and real icmp pings. + =head2 Overridden Built-ins Many of the Perl built-ins returning lists now have @@ -524,6 +570,8 @@ For example, you can now say =head2 xsubpp +=over + =item C<void> XSUBs now default to returning nothing Due to a documentation/implementation bug in previous versions of @@ -543,12 +591,34 @@ It does so by examining the text of the XSUB: if I<xsubpp> finds what looks like an assignment to C<ST(0)>, it assumes that the XSUB's return type is really C<SV *>. +=back + +=head1 C Language API Changes + +=over + +=item C<gv_fetchmethod> and C<perl_call_sv> + +The C<gv_fetchmethod> function finds a method for an object, just like +in Perl 5.003. The GV it returns may be a method cache entry. +However, in Perl 5.004, method cache entries are not visible to users; +therefore, they can no longer be passed directly to C<perl_call_sv>. +Instead, you should use the C<GvCV> macro on the GV to extract its CV, +and pass the CV to C<perl_call_sv>. + +The most likely symptom of passing the result of C<gv_fetchmethod> to +C<perl_call_sv> is Perl's producing an "Undefined subroutine called" +error on the I<second> call to a given method (since there is no cache +on the first call). + +=back + =head1 Documentation Changes Many of the base and library pods were updated. These new pods are included in section 1: -=over 4 +=over =item L<perldelta> @@ -592,7 +662,7 @@ increasing order of desperation): (X) A very fatal error (non-trappable). (A) An alien error message (not generated by Perl). -=over 4 +=over =item "my" variable %s masks earlier declaration in same scope diff --git a/pod/perldiag.pod b/pod/perldiag.pod index 0f204a868a..018ebb757a 100644 --- a/pod/perldiag.pod +++ b/pod/perldiag.pod @@ -342,30 +342,37 @@ the return value of your socket() call? See L<perlfunc/bind>. (F) A subroutine invoked from an external package via perl_call_sv() exited by calling exit. +=item Can't "goto" outside a block + +(F) A "goto" statement was executed to jump out of what might look +like a block, except that it isn't a proper block. This usually +occurs if you tried to jump out of a sort() block or subroutine, which +is a no-no. See L<perlfunc/goto>. + =item Can't "last" outside a block (F) A "last" statement was executed to break out of the current block, except that there's this itty bitty problem called there isn't a current block. Note that an "if" or "else" block doesn't count as a -"loopish" block. You can usually double the curlies to get the same -effect though, because the inner curlies will be considered a block -that loops once. See L<perlfunc/last>. +"loopish" block, as doesn't a block given to sort(). You can usually double +the curlies to get the same effect though, because the inner curlies +will be considered a block that loops once. See L<perlfunc/last>. =item Can't "next" outside a block (F) A "next" statement was executed to reiterate the current block, but there isn't a current block. Note that an "if" or "else" block doesn't -count as a "loopish" block. You can usually double the curlies to get -the same effect though, because the inner curlies will be considered a block -that loops once. See L<perlfunc/last>. +count as a "loopish" block, as doesn't a block given to sort(). You can +usually double the curlies to get the same effect though, because the inner +curlies will be considered a block that loops once. See L<perlfunc/last>. =item Can't "redo" outside a block (F) A "redo" statement was executed to restart the current block, but there isn't a current block. Note that an "if" or "else" block doesn't -count as a "loopish" block. You can usually double the curlies to get -the same effect though, because the inner curlies will be considered a block -that loops once. See L<perlfunc/last>. +count as a "loopish" block, as doesn't a block given to sort(). You can +usually double the curlies to get the same effect though, because the inner +curlies will be considered a block that loops once. See L<perlfunc/last>. =item Can't bless non-reference value @@ -922,6 +929,12 @@ case the conversion routines don't handle. Drat. (W) You are exiting an eval by unconventional means, such as a goto, or a loop control statement. +=item Exiting pseudo-block via %s + +(W) You are exiting a rather special block construct (like a sort block or +subroutine) by unconventional means, such as a goto, or a loop control +statement. See L<perlfunc/sort>. + =item Exiting subroutine via %s (W) You are exiting a subroutine by unconventional means, such as @@ -1304,6 +1317,18 @@ See L<perlsec>. allowed to have a comma between that and the following arguments. Otherwise it'd be just another one of the arguments. +One possible cause for this is that you expected to have imported a +constant to your name space with B<use> or B<import> while no such +importing took place, it may for example be that your operating system +does not support that particular constant. Hopefully you did use an +explicit import list for the constants you expect to see, please see +L<perlfunc/use> and L<perlfunc/import>. While an explicit import list +would probably have caught this error earlier it naturally does not +remedy the fact that your operating system still does not support that +constant. Maybe you have a typo in the constants of the symbol import +list of B<use> or B<import> or in the constant name at the line where +this error was triggered? + =item No command into which to pipe on command line (F) An error peculiar to VMS. Perl handles its own command line redirection, diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod index 99231b9ffd..e532ed2aa3 100644 --- a/pod/perlfunc.pod +++ b/pod/perlfunc.pod @@ -1408,9 +1408,12 @@ Returns the socket option requested, or undefined if there is an error. =item glob EXPR +=item glob + Returns the value of EXPR with filename expansions such as a shell would do. This is the internal function implementing the E<lt>*.*E<gt> operator, except it's easier to use. +If EXPR is omitted, $_ is used. =item gmtime EXPR @@ -1426,6 +1429,13 @@ All array elements are numeric, and come straight out of a struct tm. In particular this means that $mon has the range 0..11 and $wday has the range 0..6. If EXPR is omitted, does C<gmtime(time())>. +In a scalar context, prints out the ctime(3) value: + + $now_string = gmtime; # e.g., "Thu Oct 13 04:54:34 1994" + +Also see the F<timegm.pl> library, and the strftime(3) function available +via the POSIX module. + =item goto LABEL =item goto EXPR @@ -1435,8 +1445,9 @@ the range 0..6. If EXPR is omitted, does C<gmtime(time())>. The goto-LABEL form finds the statement labeled with LABEL and resumes execution there. It may not be used to go into any construct that requires initialization, such as a subroutine or a foreach loop. It -also can't be used to go into a construct that is optimized away. It -can be used to go almost anywhere else within the dynamic scope, +also can't be used to go into a construct that is optimized away, +or to get out of a block or subroutine given to sort(). +It can be used to go almost anywhere else within the dynamic scope, including out of subroutines, but it's usually better to use some other construct such as last or die. The author of Perl has never felt the need to use this form of goto (in Perl, that is--C is another matter). @@ -1692,13 +1703,14 @@ follows: All array elements are numeric, and come straight out of a struct tm. In particular this means that $mon has the range 0..11 and $wday has -the range 0..6. If EXPR is omitted, does localtime(time). +the range 0..6 and $year is year-1900, that is, $year is 123 in year +2023. If EXPR is omitted, uses the current time ("localtime(time)"). -In a scalar context, prints out the ctime(3) value: +In a scalar context, returns the ctime(3) value: $now_string = localtime; # e.g., "Thu Oct 13 04:54:34 1994" -Also see the F<timelocal.pl> library, and the strftime(3) function available +Also see the Time::Local module, and the strftime(3) function available via the POSIX module. =item log EXPR @@ -2787,6 +2799,9 @@ the subroutine not via @_ but as the package global variables $a and $b (see example below). They are passed by reference, so don't modify $a and $b. And don't try to declare them as lexicals either. +You also cannot exit out of the sort block or subroutine using any of the +loop control operators described in L<perlsyn> or with goto(). + When C<use locale> is in effect, C<sort LIST> sorts LIST according to the current collation locale. See L<perllocale>. diff --git a/pod/perlguts.pod b/pod/perlguts.pod index a7b11c6e87..3d16f94f25 100644 --- a/pod/perlguts.pod +++ b/pod/perlguts.pod @@ -8,6 +8,8 @@ This document attempts to describe some of the internal functions of the Perl executable. It is far from complete and probably contains many errors. Please refer any questions or comments to the author below. +=head1 Variables + =head2 Datatypes Perl has three typedefs that handle Perl's three main data types: @@ -557,7 +559,47 @@ as any other SV. For more information on references and blessings, consult L<perlref>. -=head2 Magic +=head2 Double-Typed SV's + +Scalar variables normally contain only one type of value, an integer, +double, pointer, or reference. Perl will automatically convert the +actual scalar data from the stored type into the requested type. + +Some scalar variables contain more than one type of scalar data. For +example, the variable C<$!> contains either the numeric value of C<errno> +or its string equivalent from either C<strerror> or C<sys_errlist[]>. + +To force multiple data values into an SV, you must do two things: use the +C<sv_set*v> routines to add the additional scalar type, then set a flag +so that Perl will believe it contains more than one type of data. The +four macros to set the flags are: + + SvIOK_on + SvNOK_on + SvPOK_on + SvROK_on + +The particular macro you must use depends on which C<sv_set*v> routine +you called first. This is because every C<sv_set*v> routine turns on +only the bit for the particular type of data being set, and turns off +all the rest. + +For example, to create a new Perl variable called "dberror" that contains +both the numeric and descriptive string error values, you could use the +following code: + + extern int dberror; + extern char *dberror_list; + + SV* sv = perl_get_sv("dberror", TRUE); + sv_setiv(sv, (IV) dberror); + sv_setpv(sv, dberror_list[dberror]); + SvIOK_on(sv); + +If the order of C<sv_setiv> and C<sv_setpv> had been reversed, then the +macro C<SvPOK_on> would need to be called instead of C<SvIOK_on>. + +=head2 Magic Variables [This section still under construction. Ignore everything here. Post no bills. Everything not permitted is forbidden.] @@ -724,45 +766,7 @@ This routine checks to see what types of magic C<sv> has. If the mg_type field is an upper-case letter, then the mg_obj is copied to C<nsv>, but the mg_type field is changed to be the lower-case letter. -=head2 Double-Typed SV's - -Scalar variables normally contain only one type of value, an integer, -double, pointer, or reference. Perl will automatically convert the -actual scalar data from the stored type into the requested type. - -Some scalar variables contain more than one type of scalar data. For -example, the variable C<$!> contains either the numeric value of C<errno> -or its string equivalent from either C<strerror> or C<sys_errlist[]>. - -To force multiple data values into an SV, you must do two things: use the -C<sv_set*v> routines to add the additional scalar type, then set a flag -so that Perl will believe it contains more than one type of data. The -four macros to set the flags are: - - SvIOK_on - SvNOK_on - SvPOK_on - SvROK_on - -The particular macro you must use depends on which C<sv_set*v> routine -you called first. This is because every C<sv_set*v> routine turns on -only the bit for the particular type of data being set, and turns off -all the rest. - -For example, to create a new Perl variable called "dberror" that contains -both the numeric and descriptive string error values, you could use the -following code: - - extern int dberror; - extern char *dberror_list; - - SV* sv = perl_get_sv("dberror", TRUE); - sv_setiv(sv, (IV) dberror); - sv_setpv(sv, dberror_list[dberror]); - SvIOK_on(sv); - -If the order of C<sv_setiv> and C<sv_setpv> had been reversed, then the -macro C<SvPOK_on> would need to be called instead of C<SvIOK_on>. +=head1 Subroutines =head2 XSUB's and the Argument Stack @@ -914,8 +918,6 @@ is being used. For a complete description of the PerlIO abstraction, consult L<perlapio>. -=head2 Scratchpads - =head2 Putting a C value on Perl stack A lot of opcodes (this is an elementary operation in the internal perl @@ -924,7 +926,7 @@ the corresponding SV is (usually) not recreated each time. The opcodes reuse specially assigned SVs (I<target>s) which are (as a corollary) not constantly freed/created. -Each of the targets is created only once (but see +Each of the targets is created only once (but see L<Scratchpads and recursion> below), and when an opcode needs to put an integer, a double, or a string on stack, it just sets the corresponding parts of its I<target> and puts the I<target> on stack. @@ -973,7 +975,144 @@ if it is, new scratchpad is created and pushed into the array. The I<target>s on this scratchpad are C<undef>s, but they are already marked with correct flags. -=head2 API LISTING +=head1 Compiled code + +=head2 Code tree + +Here we describe the internal form your code is converted to by +Perl. Start with a simple example: + + $a = $b + $c; + +This is converted to a tree similar to this one: + + assign-to + / \ + + $a + / \ + $b $c + +(but slightly more complicated). This tree reflect the way Perl +parsed your code, but has nothing to do with the execution order. +There is an additional "thread" going through the nodes of the tree +which shows the order of execution of the nodes. In our simplified +example above it looks like: + + $b ---> $c ---> + ---> $a ---> assign-to + +But with the actual compile tree for C<$a = $b + $c> it is different: +some nodes I<optimized away>. As a corollary, though the actual tree +contains more nodes than our simplified example, the execution order +is the same as in our example. + +=head2 Examining the tree + +If you have your perl compiled for debugging (usually done with C<-D +optimize=-g> on C<Configure> command line), you may examine the +compiled tree by specifying C<-Dx> on the Perl command line. The +output takes several lines per node, and for C<$b+$c> it looks like +this: + + 5 TYPE = add ===> 6 + TARG = 1 + FLAGS = (SCALAR,KIDS) + { + TYPE = null ===> (4) + (was rv2sv) + FLAGS = (SCALAR,KIDS) + { + 3 TYPE = gvsv ===> 4 + FLAGS = (SCALAR) + GV = main::b + } + } + { + TYPE = null ===> (5) + (was rv2sv) + FLAGS = (SCALAR,KIDS) + { + 4 TYPE = gvsv ===> 5 + FLAGS = (SCALAR) + GV = main::c + } + } + +This tree has 5 nodes (one per C<TYPE> specifier), only 3 of them are +not optimized away (one per number in the left column). The immediate +children of the given node correspond to C<{}> pairs on the same level +of indentation, thus this listing corresponds to the tree: + + add + / \ + null null + | | + gvsv gvsv + +The execution order is indicated by C<===E<gt>> marks, thus it is C<3 +4 5 6> (node C<6> is not included into above listing), i.e., +C<gvsv gvsv add whatever>. + +=head2 Compile pass 1: check routines + +The tree is created by the I<pseudo-compiler> while yacc code feeds it +the constructions it recognizes. Since yacc works bottom-up, so does +the first pass of perl compilation. + +What makes this pass interesting for perl developers is that some +optimization may be performed on this pass. This is optimization by +so-called I<check routines>. The correspondence between node names +and corresponding check routines is described in F<opcode.pl> (do not +forget to run C<make regen_headers> if you modify this file). + +A check routine is called when the node is fully constructed except +for the execution-order thread. Since at this time there is no +back-links to the currently constructed node, one can do most any +operation to the top-level node, including freeing it and/or creating +new nodes above/below it. + +The check routine returns the node which should be inserted into the +tree (if the top-level node was not modified, check routine returns +its argument). + +By convention, check routines have names C<ck_*>. They are usually +called from C<new*OP> subroutines (or C<convert>) (which in turn are +called from F<perly.y>). + +=head2 Compile pass 1a: constant folding + +Immediately after the check routine is called the returned node is +checked for being compile-time executable. If it is (the value is +judged to be constant) it is immediately executed, and a I<constant> +node with the "return value" of the corresponding subtree is +substituted instead. The subtree is deleted. + +If constant folding was not performed, the execution-order thread is +created. + +=head2 Compile pass 2: context propagation + +When a context for a part of compile tree is known, it is propagated +down through the tree. Aat this time the context can have 5 values +(instead of 2 for runtime context): void, boolean, scalar, list, and +lvalue. In contrast with the pass 1 this pass is processed from top +to bottom: a node's context determines the context for its children. + +Additional context-dependent optimizations are performed at this time. +Since at this moment the compile tree contains back-references (via +"thread" pointers), nodes cannot be free()d now. To allow +optimized-away nodes at this stage, such nodes are null()ified instead +of free()ing (i.e. their type is changed to OP_NULL). + +=head2 Compile pass 3: peephole optimization + +After the compile tree for a subroutine (or for an C<eval> or a file) +is created, an additional pass over the code is performed. This pass +is neither top-down or bottom-up, but in the execution order (with +additional compilications for conditionals). These optimizations are +done in the subroutine peep(). Optimizations performed at this stage +are subject to the same restrictions as in the pass 2. + +=head1 API LISTING This is a listing of functions, macros, flags, and variables that may be useful to extension writers or that may be found while reading other @@ -1192,10 +1331,16 @@ Returns the glob with the given C<name> and a defined subroutine or C<NULL>. The glob lives in the given C<stash>, or in the stashes accessable via @ISA and @<UNIVERSAL>. -As a side-effect creates a glob with the given C<name> in the given C<stash> -which in the case of success contains an alias for the subroutine, and -sets up caching info for this glob. Similarly for all the searched -stashes. +The argument C<level> should be either 0 or -1. If C<level==0>, as a +side-effect creates a glob with the given C<name> in the given +C<stash> which in the case of success contains an alias for the +subroutine, and sets up caching info for this glob. Similarly for all +the searched stashes. + +The GV returned from C<gv_fetchmeth> may be a method cache entry, +which is not visible to Perl code. So when calling C<perl_call_sv>, +you should not use the GV directly; instead, you should use the +method's CV, which can be obtained from the GV with the C<GvCV> macro. GV* gv_fetchmeth _((HV* stash, char* name, STRLEN len, I32 level)); @@ -1214,8 +1359,10 @@ Use the glob created via a side effect to do this. This function grants C<"SUPER"> token as prefix of name or postfix of the stash name. -Has the same side-effects and as C<gv_fetchmeth()>. C<name> should be -writable if contains C<':'> or C<'\''>. +Has the same side-effects and as C<gv_fetchmeth> with C<level==0>. +C<name> should be writable if contains C<':'> or C<'\''>. +The warning against passing the GV returned by C<gv_fetchmeth> to +C<perl_call_sv> apply equally to C<gv_fetchmethod>. GV* gv_fetchmethod _((HV* stash, char* name)); @@ -2601,4 +2748,4 @@ API Listing by Dean Roehrich <roehrich@cray.com>. =head1 DATE -Version 30: 1997/1/17 +Version 31: 1997/1/27 diff --git a/pod/perltoc.pod b/pod/perltoc.pod index f451606df5..8c97163e05 100644 --- a/pod/perltoc.pod +++ b/pod/perltoc.pod @@ -54,8 +54,6 @@ HOME, LOGDIR, PATH, PERL5LIB, PERL5DB, PERL_DESTRUCT_LEVEL, PERLLIB =item New Opcode Module and Revised Safe Module -=item Extended Fcntl Module - =item Internal Change: FileHandle Deprecated =item Internal Change: PerlIO internal IO abstraction interface @@ -99,6 +97,10 @@ use blib, use blib 'dir', use locale, use ops =item Math::Complex +=item DB_File + +=item Net::Ping + =item Overridden Built-ins =back @@ -113,6 +115,10 @@ C<void> XSUBs now default to returning nothing =back +=item C Language API Changes + +C<gv_fetchmethod> and C<perl_call_sv> + =item Documentation Changes L<perldelta>, L<perllocale>, L<perltoot>, L<perlapio>, L<perldebug>, @@ -353,8 +359,8 @@ getgrent, gethostent, getnetent, getprotoent, getservent, setpwent, setgrent, sethostent STAYOPEN, setnetent STAYOPEN, setprotoent STAYOPEN, setservent STAYOPEN, endpwent, endgrent, endhostent, endnetent, endprotoent, endservent, getsockname SOCKET, getsockopt -SOCKET,LEVEL,OPTNAME, glob EXPR, gmtime EXPR, goto LABEL, goto EXPR, goto -&NAME, grep BLOCK LIST, grep EXPR,LIST, hex EXPR, hex, import, index +SOCKET,LEVEL,OPTNAME, glob EXPR, glob, gmtime EXPR, goto LABEL, goto EXPR, +goto &NAME, grep BLOCK LIST, grep EXPR,LIST, hex EXPR, hex, import, index STR,SUBSTR,POSITION, index STR,SUBSTR, int EXPR, int, ioctl FILEHANDLE,FUNCTION,SCALAR, join EXPR,LIST, keys ASSOC_ARRAY, kill LIST, last LABEL, last, lc EXPR, lc, lcfirst EXPR, lcfirst, length EXPR, length, @@ -1395,6 +1401,8 @@ B<PerlIO_get_base(f)>, B<PerlIO_get_bufsiz(f)> =item DESCRIPTION +=item Variables + =over =item Datatypes @@ -1419,7 +1427,9 @@ B<PerlIO_get_base(f)>, B<PerlIO_get_bufsiz(f)> =item Stashes and Globs -=item Magic +=item Double-Typed SV's + +=item Magic Variables =item Assigning Magic @@ -1427,7 +1437,11 @@ B<PerlIO_get_base(f)>, B<PerlIO_get_bufsiz(f)> =item Finding Magic -=item Double-Typed SV's +=back + +=item Subroutines + +=over =item XSUB's and the Argument Stack @@ -1437,14 +1451,32 @@ B<PerlIO_get_base(f)>, B<PerlIO_get_bufsiz(f)> =item PerlIO -=item Scratchpads - =item Putting a C value on Perl stack =item Scratchpads =item Scratchpads and recursions +=back + +=item Compiled code + +=over + +=item Code tree + +=item Examining the tree + +=item Compile pass 1: check routines + +=item Compile pass 1a: constant folding + +=item Compile pass 2: context propagation + +=item Compile pass 3: peephole optimization + +=back + =item API LISTING AvFILL, av_clear, av_extend, av_fetch, av_len, av_make, av_pop, av_push, @@ -1482,8 +1514,6 @@ XSRETURN, XSRETURN_EMPTY, XSRETURN_IV, XSRETURN_NO, XSRETURN_NV, XSRETURN_PV, XSRETURN_UNDEF, XSRETURN_YES, XST_mIV, XST_mNV, XST_mNO, XST_mPV, XST_mUNDEF, XST_mYES, XS_VERSION, XS_VERSION_BOOTCHECK, Zero -=back - =item EDITOR =item DATE @@ -3410,6 +3440,8 @@ unexpand(1) =item EXAMPLE +=item BUGS + =item AUTHOR =head2 Tie::Hash, Tie::StdHash - base class definitions for tied hashes @@ -643,7 +643,7 @@ PP(pp_sort) SAVESPTR(GvSV(firstgv)); SAVESPTR(GvSV(secondgv)); - PUSHBLOCK(cx, CXt_LOOP, stack_base); + PUSHBLOCK(cx, CXt_NULL, stack_base); sortcxix = cxstack_ix; qsort((char*)(myorigmark+1), max, sizeof(SV*), sortcv); @@ -784,6 +784,10 @@ char *label; if (dowarn) warn("Exiting eval via %s", op_name[op->op_type]); break; + case CXt_NULL: + if (dowarn) + warn("Exiting pseudo-block via %s", op_name[op->op_type]); + return -1; case CXt_LOOP: if (!cx->blk_loop.label || strNE(label, cx->blk_loop.label) ) { @@ -873,6 +877,10 @@ I32 startingblock; if (dowarn) warn("Exiting eval via %s", op_name[op->op_type]); break; + case CXt_NULL: + if (dowarn) + warn("Exiting pseudo-block via %s", op_name[op->op_type]); + return -1; case CXt_LOOP: DEBUG_l( deb("(Found loop #%d)\n", i)); return i; @@ -904,6 +912,7 @@ I32 cxix; case CXt_LOOP: POPLOOP(cx); break; + case CXt_NULL: case CXt_SUBST: break; } @@ -1752,6 +1761,9 @@ PP(pp_goto) else gotoprobe = main_root; break; + case CXt_NULL: + DIE("Can't \"goto\" outside a block"); + break; default: if (ix) DIE("panic: goto"); diff --git a/t/op/closure.t b/t/op/closure.t index e69de29bb2..752f30c9c6 100755 --- a/t/op/closure.t +++ b/t/op/closure.t @@ -0,0 +1,417 @@ +#!./perl +# -*- Mode: Perl -*- +# closure.t: +# Original written by Ulrich Pfeifer on 2 Jan 1997. +# Greatly extended by Tom Phoenix <rootbeer@teleport.com> on 28 Jan 1997. +# + +print "1..167\n"; + +my $test = 1; +sub test (&) { + print ((&{$_[0]})?"ok $test\n":"not ok $test\n"); + $test++; +} + +my $i = 1; +sub foo { $i = shift if @_; $i } + +# no closure +test { foo == 1 }; +foo(2); +test { foo == 2 }; + +# closure: lexical outside sub +my $foo = sub {$i = shift if @_; $i }; +my $bar = sub {$i = shift if @_; $i }; +test {&$foo() == 2 }; +&$foo(3); +test {&$foo() == 3 }; +# did the lexical change? +test { foo == 3 and $i == 3}; +# did the second closure notice? +test {&$bar() == 3 }; + +# closure: lexical inside sub +sub bar { + my $i = shift; + sub { $i = shift if @_; $i } +} + +$foo = bar(4); +$bar = bar(5); +test {&$foo() == 4 }; +&$foo(6); +test {&$foo() == 6 }; +test {&$bar() == 5 }; + +# nested closures +sub bizz { + my $i = 7; + if (@_) { + my $i = shift; + sub {$i = shift if @_; $i }; + } else { + my $i = $i; + sub {$i = shift if @_; $i }; + } +} +$foo = bizz(); +$bar = bizz(); +test {&$foo() == 7 }; +&$foo(8); +test {&$foo() == 8 }; +test {&$bar() == 7 }; + +$foo = bizz(9); +$bar = bizz(10); +test {&$foo(11)-1 == &$bar()}; + +my @foo; +for (qw(0 1 2 3 4)) { + my $i = $_; + $foo[$_] = sub {$i = shift if @_; $i }; +} + +test { + &{$foo[0]}() == 0 and + &{$foo[1]}() == 1 and + &{$foo[2]}() == 2 and + &{$foo[3]}() == 3 and + &{$foo[4]}() == 4 + }; + +for (0 .. 4) { + &{$foo[$_]}(4-$_); +} + +test { + &{$foo[0]}() == 4 and + &{$foo[1]}() == 3 and + &{$foo[2]}() == 2 and + &{$foo[3]}() == 1 and + &{$foo[4]}() == 0 + }; + +sub barf { + my @foo; + for (qw(0 1 2 3 4)) { + my $i = $_; + $foo[$_] = sub {$i = shift if @_; $i }; + } + @foo; +} + +@foo = barf(); +test { + &{$foo[0]}() == 0 and + &{$foo[1]}() == 1 and + &{$foo[2]}() == 2 and + &{$foo[3]}() == 3 and + &{$foo[4]}() == 4 + }; + +for (0 .. 4) { + &{$foo[$_]}(4-$_); +} + +test { + &{$foo[0]}() == 4 and + &{$foo[1]}() == 3 and + &{$foo[2]}() == 2 and + &{$foo[3]}() == 1 and + &{$foo[4]}() == 0 + }; + +# Additional tests by Tom Phoenix <rootbeer@teleport.com>. + +{ + BEGIN { + if (-d 't') { + unshift @INC, "lib" + } else { + unshift @INC, '../lib' + } + } + use strict; + + use vars qw!$test!; + my($debugging, %expected, $inner_type, $where_declared, $within); + my($nc_attempt, $call_outer, $call_inner, $undef_outer); + my($code, $inner_sub_test, $expected, $line, $errors, $output); + my(@inners, $sub_test, $pid); + $debugging = 1 if defined($ARGV[0]) and $ARGV[0] eq '-debug'; + + # The expected values for these tests + %expected = ( + 'global_scalar' => 1001, + 'global_array' => 2101, + 'global_hash' => 3004, + 'fs_scalar' => 4001, + 'fs_array' => 5101, + 'fs_hash' => 6004, + 'sub_scalar' => 7001, + 'sub_array' => 8101, + 'sub_hash' => 9004, + 'foreach' => 10011, + ); + + # Our innermost sub is either named or anonymous + for $inner_type (qw!named anon!) { + # And it may be declared at filescope, within a named + # sub, or within an anon sub + for $where_declared (qw!filescope in_named in_anon!) { + # And that, in turn, may be within a foreach loop, + # a naked block, or another named sub + for $within (qw!foreach naked other_sub!) { + + # Here are a number of variables which show what's + # going on, in a way. + $nc_attempt = 0+ # Named closure attempted + ( ($inner_type eq 'named') || + ($within eq 'other_sub') ) ; + $call_inner = 0+ # Need to call &inner + ( ($inner_type eq 'anon') && + ($within eq 'other_sub') ) ; + $call_outer = 0+ # Need to call &outer or &$outer + ( ($inner_type eq 'anon') && + ($within ne 'other_sub') ) ; + $undef_outer = 0+ # $outer is created but unused + ( ($where_declared eq 'in_anon') && + (not $call_outer) ) ; + + $code = "# This is a test script built by t/op/closure.t\n\n"; + + $code .= <<"DEBUG_INFO" if $debugging; +# inner_type: $inner_type +# where_declared: $where_declared +# within: $within +# nc_attempt: $nc_attempt +# call_inner: $call_inner +# call_outer: $call_outer +# undef_outer: $undef_outer +DEBUG_INFO + + $code .= <<"END_MARK_ONE"; + +BEGIN { \$SIG{__WARN__} = sub { + my \$msg = \$_[0]; +END_MARK_ONE + + $code .= <<"END_MARK_TWO" if $nc_attempt; + return if index(\$msg, 'will not stay shared') != -1; + return if index(\$msg, 'may be unavailable') != -1; +END_MARK_TWO + + $code .= <<"END_MARK_THREE"; # Backwhack a lot! + print "not ok: got unexpected warning \$msg\\n"; +} } + +{ + my \$test = $test; + sub test (&) { + my \$result = &{\$_[0]}; + print "not " unless \$result; + print "ok \$test\\n"; + \$test++; + } +} + +# some of the variables which the closure will access +\$global_scalar = 1000; +\@global_array = (2000, 2100, 2200, 2300); +%global_hash = 3000..3009; + +my \$fs_scalar = 4000; +my \@fs_array = (5000, 5100, 5200, 5300); +my %fs_hash = 6000..6009; + +END_MARK_THREE + + if ($where_declared eq 'filescope') { + # Nothing here + } elsif ($where_declared eq 'in_named') { + $code .= <<'END'; +sub outer { + my $sub_scalar = 7000; + my @sub_array = (8000, 8100, 8200, 8300); + my %sub_hash = 9000..9009; +END + # } + } elsif ($where_declared eq 'in_anon') { + $code .= <<'END'; +$outer = sub { + my $sub_scalar = 7000; + my @sub_array = (8000, 8100, 8200, 8300); + my %sub_hash = 9000..9009; +END + # } + } else { + die "What was $where_declared?" + } + + if ($within eq 'foreach') { + $code .= " + my \$foreach = 12000; + my \@list = (10000, 10010); + foreach \$foreach (\@list) { + " # } + } elsif ($within eq 'naked') { + $code .= " { # naked block\n" # } + } elsif ($within eq 'other_sub') { + $code .= " sub inner_sub {\n" # } + } else { + die "What was $within?" + } + + $sub_test = $test; + @inners = ( qw!global_scalar global_array global_hash! , + qw!fs_scalar fs_array fs_hash! ); + push @inners, 'foreach' if $within eq 'foreach'; + if ($where_declared ne 'filescope') { + push @inners, qw!sub_scalar sub_array sub_hash!; + } + for $inner_sub_test (@inners) { + + if ($inner_type eq 'named') { + $code .= " sub named_$sub_test " + } elsif ($inner_type eq 'anon') { + $code .= " \$anon_$sub_test = sub " + } else { + die "What was $inner_type?" + } + + # Now to write the body of the test sub + if ($inner_sub_test eq 'global_scalar') { + $code .= '{ ++$global_scalar }' + } elsif ($inner_sub_test eq 'fs_scalar') { + $code .= '{ ++$fs_scalar }' + } elsif ($inner_sub_test eq 'sub_scalar') { + $code .= '{ ++$sub_scalar }' + } elsif ($inner_sub_test eq 'global_array') { + $code .= '{ ++$global_array[1] }' + } elsif ($inner_sub_test eq 'fs_array') { + $code .= '{ ++$fs_array[1] }' + } elsif ($inner_sub_test eq 'sub_array') { + $code .= '{ ++$sub_array[1] }' + } elsif ($inner_sub_test eq 'global_hash') { + $code .= '{ ++$global_hash{3002} }' + } elsif ($inner_sub_test eq 'fs_hash') { + $code .= '{ ++$fs_hash{6002} }' + } elsif ($inner_sub_test eq 'sub_hash') { + $code .= '{ ++$sub_hash{9002} }' + } elsif ($inner_sub_test eq 'foreach') { + $code .= '{ ++$foreach }' + } else { + die "What was $inner_sub_test?" + } + + # Close up + if ($inner_type eq 'anon') { + $code .= ';' + } + $code .= "\n"; + $sub_test++; # sub name sequence number + + } # End of foreach $inner_sub_test + + # Close up $within block # { + $code .= " }\n\n"; + + # Close up $where_declared block + if ($where_declared eq 'in_named') { # { + $code .= "}\n\n"; + } elsif ($where_declared eq 'in_anon') { # { + $code .= "};\n\n"; + } + + # We may need to do something with the sub we just made... + $code .= "undef \$outer;\n" if $undef_outer; + $code .= "&inner_sub;\n" if $call_inner; + if ($call_outer) { + if ($where_declared eq 'in_named') { + $code .= "&outer;\n\n"; + } elsif ($where_declared eq 'in_anon') { + $code .= "&\$outer;\n\n" + } + } + + # Now, we can actually prep to run the tests. + for $inner_sub_test (@inners) { + $expected = $expected{$inner_sub_test} or + die "expected $inner_sub_test missing"; + + # Named closures won't access the expected vars + if ( $nc_attempt and + substr($inner_sub_test, 0, 4) eq "sub_" ) { + $expected = 1; + } + + # If you make a sub within a foreach loop, + # what happens if it tries to access the + # foreach index variable? If it's a named + # sub, it gets the var from "outside" the loop, + # but if it's anon, it gets the value to which + # the index variable is aliased. + # + # Of course, if the value was set only + # within another sub which was never called, + # the value has not been set yet. + # + if ($inner_sub_test eq 'foreach') { + if ($inner_type eq 'named') { + if ($call_outer || ($where_declared eq 'filescope')) { + $expected = 12001 + } else { + $expected = 1 + } + } + } + + # Here's the test: + if ($inner_type eq 'anon') { + $code .= "test { &\$anon_$test == $expected };\n" + } else { + $code .= "test { &named_$test == $expected };\n" + } + $test++; + } + + # Fork off a new perl to run the tests. + # (This is so we can catch spurious warnings.) + $| = 1; print ""; $| = 0; # flush output before forking + pipe READ, WRITE or die "Can't make pipe: $!"; + pipe READ2, WRITE2 or die "Can't make second pipe: $!"; + die "Can't fork: $!" unless defined($pid = open PERL, "|-"); + unless ($pid) { + # Child process here. We're going to send errors back + # through the extra pipe. + close READ; + close READ2; + open STDOUT, ">&WRITE" or die "Can't redirect STDOUT: $!"; + open STDERR, ">&WRITE2" or die "Can't redirect STDERR: $!"; + exec './perl', '-w', '-' + or die "Can't exec ./perl: $!"; + } + # Parent process here. + close WRITE; + close WRITE2; + print PERL $code; + close PERL; + $output = join '', <READ>; + $errors = join '', <READ2>; + print $output, $errors; + if ($debugging && ($errors || $? || ($output =~ /not ok/))) { + my $lnum = 0; + for $line (split '\n', $code) { + printf "%3d: %s\n", ++$lnum, $line; + } + } + printf "not ok: exited with error code %04lX\n",$? if $?; + print "-" x 30, $/ if $debugging; + + } # End of foreach $within + } # End of foreach $where_declared + } # End of foreach $inner_type + +} diff --git a/t/op/glob.t b/t/op/glob.t index fce2952968..cc60a17a72 100755 --- a/t/op/glob.t +++ b/t/op/glob.t @@ -2,9 +2,9 @@ # $RCSfile: glob.t,v $$Revision: 4.1 $$Date: 92/08/07 18:27:55 $ -print "1..4\n"; +print "1..6\n"; -@ops = <op/*>; +@oops = @ops = <op/*>; map { $files{$_}++ } <op/*>; map { delete $files{$_} } split /[\s\n]/, `echo op/*`; @@ -21,3 +21,11 @@ while (<jskdfjskdfj* op/* jskdjfjkosvk*>) { print "${not}ok 3\n"; print $/ eq "\n" ? "ok 4\n" : "not ok 4\n"; + +# test the "glob" operator +$_ = "op/*"; +@glops = glob $_; +print "@glops" eq "@oops" ? "ok 5\n" : "not ok 5\n"; + +@glops = glob; +print "@glops" eq "@oops" ? "ok 6\n" : "not ok 6\n"; diff --git a/vms/Makefile b/vms/Makefile index f84139ecb5..e0b293fd5e 100644 --- a/vms/Makefile +++ b/vms/Makefile @@ -32,7 +32,7 @@ ARCH = VMS_VAX OBJVAL = $@ # Updated by fndvers.com -- do not edit by hand -PERL_VERSION = 5_00323# +PERL_VERSION = 5_00324# ARCHDIR = [.lib.$(ARCH).$(PERL_VERSION)] diff --git a/vms/config.vms b/vms/config.vms index 75bf30220f..95aefec05a 100644 --- a/vms/config.vms +++ b/vms/config.vms @@ -76,7 +76,7 @@ * when Perl is built. Please do not change it by hand; make * any changes to FndVers.Com instead. */ -#define ARCHLIB_EXP "/perl_root/lib/VMS_VAX/5_00323" /**/ +#define ARCHLIB_EXP "/perl_root/lib/VMS_VAX/5_00324" /**/ #define ARCHLIB ARCHLIB_EXP /*config-skip*/ /* ARCHNAME: diff --git a/vms/descrip.mms b/vms/descrip.mms index c66736f278..cfa4b660f4 100644 --- a/vms/descrip.mms +++ b/vms/descrip.mms @@ -65,7 +65,7 @@ OBJVAL = $(MMS$TARGET_NAME)$(O) .endif # Updated by fndvers.com -- do not edit by hand -PERL_VERSION = 5_00323# +PERL_VERSION = 5_00324# ARCHDIR = [.lib.$(ARCH).$(PERL_VERSION)] diff --git a/win32/EXTERN.h b/win32/EXTERN.h new file mode 100644 index 0000000000..f9dc77c89b --- /dev/null +++ b/win32/EXTERN.h @@ -0,0 +1,47 @@ +/* EXTERN.h + * + * Copyright (c) 1991-1994, Larry Wall + * + * You may distribute under the terms of either the GNU General Public + * License or the Artistic License, as specified in the README file. + * + */ + +/* + * EXT designates a global var which is defined in perl.h + * dEXT designates a global var which is defined in another + * file, so we can't count on finding it in perl.h + * (this practice should be avoided). + */ +#undef EXT +#undef dEXT +#undef EXTCONST +#undef dEXTCONST +#if defined(VMS) && !defined(__GNUC__) +# define EXT globalref +# define dEXT globaldef {"$GLOBAL_RW_VARS"} noshare +# define EXTCONST globalref +# define dEXTCONST globaldef {"$GLOBAL_RO_VARS"} readonly +#elif defined(_MSC_VER) && defined(_WIN32) +# ifdef PERLDLL +# define EXT __declspec(dllexport) +# define dEXT +# define EXTCONST __declspec(dllexport) const +# define dEXTCONST const +# else +# define EXT __declspec(dllimport) +# define dEXT +# define EXTCONST __declspec(dllimport) const +# define dEXTCONST const +# endif +#else +# define EXT extern +# define dEXT +# define EXTCONST extern const +# define dEXTCONST const +#endif + +#undef INIT +#define INIT(x) + +#undef DOINIT diff --git a/win32/Fcntl.mak b/win32/Fcntl.mak new file mode 100644 index 0000000000..4e07efbb2a --- /dev/null +++ b/win32/Fcntl.mak @@ -0,0 +1,247 @@ +# Microsoft Developer Studio Generated NMAKE File, Format Version 4.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +!IF "$(CFG)" == "" +CFG=Fcntl - Win32 Debug +!MESSAGE No configuration specified. Defaulting to Fcntl - Win32 Debug. +!ENDIF + +!IF "$(CFG)" != "Fcntl - Win32 Release" && "$(CFG)" != "Fcntl - Win32 Debug" +!MESSAGE Invalid configuration "$(CFG)" specified. +!MESSAGE You can specify a configuration when running NMAKE on this makefile +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "Fcntl.mak" CFG="Fcntl - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "Fcntl - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "Fcntl - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE +!ERROR An invalid configuration is specified. +!ENDIF + +!IF "$(OS)" == "Windows_NT" +NULL= +!ELSE +NULL=nul +!ENDIF +################################################################################ +# Begin Project +CPP=cl.exe +RSC=rc.exe +MTL=mktyplib.exe + +!IF "$(CFG)" == "Fcntl - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Fcntl___" +# PROP BASE Intermediate_Dir "Fcntl___" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Target_Dir "" +OUTDIR=.\Release +INTDIR=.\Release + +ALL : "$(OUTDIR)\Fcntl.dll" + +CLEAN : + -@erase "..\lib\auto\Fcntl\Fcntl.dll" + -@erase ".\Release\Fcntl.obj" + -@erase ".\Release\Fcntl.lib" + -@erase ".\Release\Fcntl.exp" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c +# ADD CPP /nologo /MT /W3 /GX /O2 /I ".\include" /I "." /I ".." /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c +CPP_PROJ=/nologo /MT /W3 /GX /O2 /I ".\include" /I "." /I ".." /D "WIN32" /D\ + "NDEBUG" /D "_WINDOWS" /Fp"$(INTDIR)/Fcntl.pch" /YX /Fo"$(INTDIR)/" /c +CPP_OBJS=.\Release/ +CPP_SBRS= +# ADD BASE MTL /nologo /D "NDEBUG" /win32 +# ADD MTL /nologo /D "NDEBUG" /win32 +MTL_PROJ=/nologo /D "NDEBUG" /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +BSC32_FLAGS=/nologo /o"$(OUTDIR)/Fcntl.bsc" +BSC32_SBRS= +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /dll /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /dll /pdb:none /machine:I386 /out:"../lib/auto/Fcntl/Fcntl.dll" +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ + advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo\ + /subsystem:windows /dll /pdb:none /machine:I386 /def:".\Fcntl.def"\ + /out:"../lib/auto/Fcntl/Fcntl.dll" /implib:"$(OUTDIR)/Fcntl.lib" +DEF_FILE= \ + ".\Fcntl.def" +LINK32_OBJS= \ + ".\Release\Fcntl.obj" \ + "..\perl.lib" + +"$(OUTDIR)\Fcntl.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ELSEIF "$(CFG)" == "Fcntl - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Fcntl__0" +# PROP BASE Intermediate_Dir "Fcntl__0" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Target_Dir "" +OUTDIR=.\Debug +INTDIR=.\Debug + +ALL : "$(OUTDIR)\Fcntl.dll" + +CLEAN : + -@erase "..\lib\auto\Fcntl\Fcntl.dll" + -@erase ".\Debug\Fcntl.obj" + -@erase ".\Debug\vc40.pdb" + -@erase ".\Debug\vc40.idb" + -@erase ".\Debug\Fcntl.lib" + -@erase ".\Debug\Fcntl.exp" + -@erase ".\Debug\Fcntl.pdb" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c +# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I ".\include" /I "." /I ".." /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c +CPP_PROJ=/nologo /MTd /W3 /Gm /GX /Zi /Od /I ".\include" /I "." /I ".." /D\ + "WIN32" /D "_DEBUG" /D "_WINDOWS" /Fp"$(INTDIR)/Fcntl.pch" /YX /Fo"$(INTDIR)/"\ + /Fd"$(INTDIR)/" /c +CPP_OBJS=.\Debug/ +CPP_SBRS= +# ADD BASE MTL /nologo /D "_DEBUG" /win32 +# ADD MTL /nologo /D "_DEBUG" /win32 +MTL_PROJ=/nologo /D "_DEBUG" /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +BSC32_FLAGS=/nologo /o"$(OUTDIR)/Fcntl.bsc" +BSC32_SBRS= +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /dll /debug /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /dll /incremental:no /debug /machine:I386 /out:"../lib/auto/Fcntl/Fcntl.dll" +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ + advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo\ + /subsystem:windows /dll /incremental:no /pdb:"$(OUTDIR)/Fcntl.pdb" /debug\ + /machine:I386 /def:".\Fcntl.def" /out:"../lib/auto/Fcntl/Fcntl.dll"\ + /implib:"$(OUTDIR)/Fcntl.lib" +DEF_FILE= \ + ".\Fcntl.def" +LINK32_OBJS= \ + ".\Debug\Fcntl.obj" \ + "..\perl.lib" + +"$(OUTDIR)\Fcntl.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ENDIF + +.c{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.cpp{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.cxx{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.c{$(CPP_SBRS)}.sbr: + $(CPP) $(CPP_PROJ) $< + +.cpp{$(CPP_SBRS)}.sbr: + $(CPP) $(CPP_PROJ) $< + +.cxx{$(CPP_SBRS)}.sbr: + $(CPP) $(CPP_PROJ) $< + +################################################################################ +# Begin Target + +# Name "Fcntl - Win32 Release" +# Name "Fcntl - Win32 Debug" + +!IF "$(CFG)" == "Fcntl - Win32 Release" + +!ELSEIF "$(CFG)" == "Fcntl - Win32 Debug" + +!ENDIF + +################################################################################ +# Begin Source File + +SOURCE=..\ext\Fcntl\Fcntl.c +NODEP_CPP_FCNTL=\ + "..\ext\Fcntl\EXTERN.h"\ + "..\ext\Fcntl\perl.h"\ + "..\ext\Fcntl\XSUB.h"\ + + +!IF "$(CFG)" == "Fcntl - Win32 Release" + + +"$(INTDIR)\Fcntl.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "Fcntl - Win32 Debug" + + +"$(INTDIR)\Fcntl.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\Fcntl.def + +!IF "$(CFG)" == "Fcntl - Win32 Release" + +!ELSEIF "$(CFG)" == "Fcntl - Win32 Debug" + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=..\perl.lib + +!IF "$(CFG)" == "Fcntl - Win32 Release" + +!ELSEIF "$(CFG)" == "Fcntl - Win32 Debug" + +!ENDIF + +# End Source File +# End Target +# End Project +################################################################################ diff --git a/win32/IO.mak b/win32/IO.mak new file mode 100644 index 0000000000..7cd744ee07 --- /dev/null +++ b/win32/IO.mak @@ -0,0 +1,245 @@ +# Microsoft Developer Studio Generated NMAKE File, Format Version 4.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +!IF "$(CFG)" == "" +CFG=IO - Win32 Debug +!MESSAGE No configuration specified. Defaulting to IO - Win32 Debug. +!ENDIF + +!IF "$(CFG)" != "IO - Win32 Release" && "$(CFG)" != "IO - Win32 Debug" +!MESSAGE Invalid configuration "$(CFG)" specified. +!MESSAGE You can specify a configuration when running NMAKE on this makefile +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "IO.mak" CFG="IO - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "IO - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "IO - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE +!ERROR An invalid configuration is specified. +!ENDIF + +!IF "$(OS)" == "Windows_NT" +NULL= +!ELSE +NULL=nul +!ENDIF +################################################################################ +# Begin Project +CPP=cl.exe +RSC=rc.exe +MTL=mktyplib.exe + +!IF "$(CFG)" == "IO - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "IO___Win" +# PROP BASE Intermediate_Dir "IO___Win" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Target_Dir "" +OUTDIR=.\Release +INTDIR=.\Release + +ALL : "$(OUTDIR)\IO.dll" + +CLEAN : + -@erase "..\lib\auto\IO\IO.dll" + -@erase ".\Release\IO.obj" + -@erase ".\Release\IO.lib" + -@erase ".\Release\IO.exp" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c +# ADD CPP /nologo /MT /W3 /GX /O2 /I ".\include" /I "." /I ".." /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c +CPP_PROJ=/nologo /MT /W3 /GX /O2 /I ".\include" /I "." /I ".." /D "WIN32" /D\ + "NDEBUG" /D "_WINDOWS" /Fp"$(INTDIR)/IO.pch" /YX /Fo"$(INTDIR)/" /c +CPP_OBJS=.\Release/ +CPP_SBRS= +# ADD BASE MTL /nologo /D "NDEBUG" /win32 +# ADD MTL /nologo /D "NDEBUG" /win32 +MTL_PROJ=/nologo /D "NDEBUG" /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +BSC32_FLAGS=/nologo /o"$(OUTDIR)/IO.bsc" +BSC32_SBRS= +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /dll /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /dll /pdb:none /machine:I386 /out:"..\lib\auto\IO\IO.dll" +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ + advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo\ + /subsystem:windows /dll /pdb:none /machine:I386 /def:".\IO.def"\ + /out:"..\lib\auto\IO\IO.dll" /implib:"$(OUTDIR)/IO.lib" +DEF_FILE= \ + ".\IO.def" +LINK32_OBJS= \ + ".\Release\IO.obj" \ + "..\perl.lib" + +"$(OUTDIR)\IO.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ELSEIF "$(CFG)" == "IO - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Target_Dir "" +OUTDIR=.\Debug +INTDIR=.\Debug + +ALL : "$(OUTDIR)\IO.dll" + +CLEAN : + -@erase ".\Debug\IO.lib" + -@erase ".\Debug\IO.obj" + -@erase ".\Debug\IO.exp" + -@erase ".\Debug\vc40.pdb" + -@erase ".\Debug\vc40.idb" + -@erase "..\lib\auto\IO\IO.dll" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c +# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I ".\include" /I "." /I ".." /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c +CPP_PROJ=/nologo /MTd /W3 /Gm /GX /Zi /Od /I ".\include" /I "." /I ".." /D\ + "WIN32" /D "_DEBUG" /D "_WINDOWS" /Fp"$(INTDIR)/IO.pch" /YX /Fo"$(INTDIR)/"\ + /Fd"$(INTDIR)/" /c +CPP_OBJS=.\Debug/ +CPP_SBRS= +# ADD BASE MTL /nologo /D "_DEBUG" /win32 +# ADD MTL /nologo /D "_DEBUG" /win32 +MTL_PROJ=/nologo /D "_DEBUG" /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +BSC32_FLAGS=/nologo /o"$(OUTDIR)/IO.bsc" +BSC32_SBRS= +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /dll /debug /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /dll /pdb:none /debug /machine:I386 /out:"..\lib\auto\IO\IO.dll" +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ + advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo\ + /subsystem:windows /dll /pdb:none /debug /machine:I386 /def:".\IO.def"\ + /out:"..\lib\auto\IO\IO.dll" /implib:"$(OUTDIR)/IO.lib" +DEF_FILE= \ + ".\IO.def" +LINK32_OBJS= \ + ".\Debug\IO.obj" \ + "..\perl.lib" + +"$(OUTDIR)\IO.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ENDIF + +.c{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.cpp{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.cxx{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.c{$(CPP_SBRS)}.sbr: + $(CPP) $(CPP_PROJ) $< + +.cpp{$(CPP_SBRS)}.sbr: + $(CPP) $(CPP_PROJ) $< + +.cxx{$(CPP_SBRS)}.sbr: + $(CPP) $(CPP_PROJ) $< + +################################################################################ +# Begin Target + +# Name "IO - Win32 Release" +# Name "IO - Win32 Debug" + +!IF "$(CFG)" == "IO - Win32 Release" + +!ELSEIF "$(CFG)" == "IO - Win32 Debug" + +!ENDIF + +################################################################################ +# Begin Source File + +SOURCE=..\ext\Io\IO.c +NODEP_CPP_IO_C0=\ + "..\ext\Io\EXTERN.h"\ + "..\ext\Io\perl.h"\ + "..\ext\Io\XSUB.h"\ + + +!IF "$(CFG)" == "IO - Win32 Release" + + +"$(INTDIR)\IO.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "IO - Win32 Debug" + + +"$(INTDIR)\IO.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\IO.def + +!IF "$(CFG)" == "IO - Win32 Release" + +!ELSEIF "$(CFG)" == "IO - Win32 Debug" + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=..\perl.lib + +!IF "$(CFG)" == "IO - Win32 Release" + +!ELSEIF "$(CFG)" == "IO - Win32 Debug" + +!ENDIF + +# End Source File +# End Target +# End Project +################################################################################ diff --git a/win32/Makefile b/win32/Makefile new file mode 100644 index 0000000000..07e781efb5 --- /dev/null +++ b/win32/Makefile @@ -0,0 +1,126 @@ + +LIBDIR=..\..\lib +EXTDIR=..\ext +EXTUTILSDIR=$(LIBDIR)\extutils +XSUBPP=..\..\miniperl $(EXTUTILSDIR)\xsubpp -C++ -prototypes +AUTOSPLIT=..\..\miniperl ..\..\win32\autosplit.pl +DEST=..\ + +EXTENSIONS=DynaLoader Socket IO Fcntl Opcode SDBM_File +#STATICLINKMODUES=DynaLoader Socket Fcntl Opcode SDBM_File +STATICLINKMODUES= +#DYNALOADMODULES=IO.dll +DYNALOADMODULES=Socket.dll Fcntl.dll Opcode.dll SDBM_File.dll IO.dll + +ALL: perl + +!IF "$(CFG)" =="" +CFG=Release +!ENDIF + +modules : $(EXTENSIONS) + nmake -A -f modules.mak CFG="modules - Win32 $(CFG)" + +perlglob.exe: + nmake -f perlglob.mak CFG="perlglob - Win32 Release" + +libperl.lib: + attrib -r ..\*.h + copy dosish.h .. + copy EXTERN.h .. + nmake -f libperl.mak CFG="libperl - Win32 $(CFG)" + +miniperl.exe: libperl.lib + nmake -A -f miniperl.mak CFG="miniperl - Win32 $(CFG)" + copy config.w32 ..\config.sh + cd .. + miniperl configpm + cd win32 + if exist lib\* xcopy lib\*.* ..\lib\ /s/e + copy bin\test.bat ..\t + +perldll: miniperl.exe libperl.lib + ..\miniperl -w makedef.pl > perldll.def + nmake -A -f perldll.mak CFG="perldll - Win32 $(CFG)" + +dynamodules: $(DYNALOADMODULES) + +perl: miniperl.exe modules perldll perlglob.exe dynamodules + ..\miniperl makemain.pl $(STATICLINKMODUES) > perlmain.c + ..\miniperl makeperldef.pl $(STATICLINKMODUES) > perl.def + copy runperl.c perlmain.c + nmake -A -f perl.mak CFG="perl - Win32 $(CFG)" + copy ..\_perl.exe ..\perl.exe + del ..\_perl.exe + del ..\*.exp + copy splittree.pl .. + ..\miniperl ..\splittree.pl "../LIB" "../LIB/auto" + attrib -r ..\t\*.* + copy test ..\t + xcopy ..\perl.h ..\lib\CORE\*.* + +DynaLoader: + md ..\lib\auto + cd $(EXTDIR)\$* + copy ..\..\win32\dl_win32.xs . + copy $*.pm $(LIBDIR) + $(XSUBPP) dl_win32.xs > $*.c + cd ..\..\win32 + +Socket: + md ..\lib\auto\$* + ..\miniperl genxsdef.pl $* > $*.def + cd $(EXTDIR)\$* + copy $*.pm $(LIBDIR) + $(XSUBPP) $*.xs > $*.c + cd ..\..\win32 + +Socket.dll: + nmake -f $*.mak CFG="$* - Win32 $(CFG)" + +IO: + md ..\lib\auto\$* + ..\miniperl genxsdef.pl $* > $*.def + cd $(EXTDIR)\$* + copy $*.pm $(LIBDIR) + xcopy lib\*.* $(LIBDIR) /s + $(XSUBPP) $*.xs > $*.c + cd ..\..\win32 + +IO.dll: + nmake -f $*.mak CFG="$* - Win32 $(CFG)" + +SDBM_File: + md ..\lib\auto\$* + ..\miniperl genxsdef.pl $* > $*.def + cd $(EXTDIR)\$* + copy $*.pm $(LIBDIR) + $(XSUBPP) -typemap ./typemap $*.xs > $*.c + cd ..\..\win32 + +SDBM_File.dll: + nmake -f $*.mak CFG="$* - Win32 $(CFG)" + +Fcntl: + md ..\lib\auto\$* + ..\miniperl genxsdef.pl $* > $*.def + cd $(EXTDIR)\$* + copy $*.pm $(LIBDIR) + $(XSUBPP) $*.xs > $*.c + cd ..\..\win32 + +Fcntl.dll: + nmake -f $*.mak CFG="$* - Win32 $(CFG)" + +Opcode: + md ..\lib\auto\$* + ..\miniperl genxsdef.pl $* > $*.def + cd $(EXTDIR)\$* + xcopy *.pm $(LIBDIR) + $(XSUBPP) $*.xs > $*.c + cd ..\..\win32 + +Opcode.dll: + nmake -f $*.mak CFG="$* - Win32 $(CFG)" + + diff --git a/win32/Opcode.mak b/win32/Opcode.mak new file mode 100644 index 0000000000..6e40b32e7a --- /dev/null +++ b/win32/Opcode.mak @@ -0,0 +1,247 @@ +# Microsoft Developer Studio Generated NMAKE File, Format Version 4.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +!IF "$(CFG)" == "" +CFG=Opcode - Win32 Debug +!MESSAGE No configuration specified. Defaulting to Opcode - Win32 Debug. +!ENDIF + +!IF "$(CFG)" != "Opcode - Win32 Release" && "$(CFG)" != "Opcode - Win32 Debug" +!MESSAGE Invalid configuration "$(CFG)" specified. +!MESSAGE You can specify a configuration when running NMAKE on this makefile +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "Opcode.mak" CFG="Opcode - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "Opcode - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "Opcode - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE +!ERROR An invalid configuration is specified. +!ENDIF + +!IF "$(OS)" == "Windows_NT" +NULL= +!ELSE +NULL=nul +!ENDIF +################################################################################ +# Begin Project +CPP=cl.exe +RSC=rc.exe +MTL=mktyplib.exe + +!IF "$(CFG)" == "Opcode - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Opcode__" +# PROP BASE Intermediate_Dir "Opcode__" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Target_Dir "" +OUTDIR=.\Release +INTDIR=.\Release + +ALL : "$(OUTDIR)\Opcode.dll" + +CLEAN : + -@erase "..\lib\auto\Opcode\Opcode.dll" + -@erase ".\Release\Opcode.obj" + -@erase ".\Release\Opcode.lib" + -@erase ".\Release\Opcode.exp" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c +# ADD CPP /nologo /MT /W3 /GX /O2 /I ".\include" /I "." /I ".." /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c +CPP_PROJ=/nologo /MT /W3 /GX /O2 /I ".\include" /I "." /I ".." /D "WIN32" /D\ + "NDEBUG" /D "_WINDOWS" /Fp"$(INTDIR)/Opcode.pch" /YX /Fo"$(INTDIR)/" /c +CPP_OBJS=.\Release/ +CPP_SBRS= +# ADD BASE MTL /nologo /D "NDEBUG" /win32 +# ADD MTL /nologo /D "NDEBUG" /win32 +MTL_PROJ=/nologo /D "NDEBUG" /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +BSC32_FLAGS=/nologo /o"$(OUTDIR)/Opcode.bsc" +BSC32_SBRS= +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /dll /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /dll /pdb:none /machine:I386 /out:"../lib/auto/Opcode/Opcode.dll" +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ + advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo\ + /subsystem:windows /dll /pdb:none /machine:I386 /def:".\Opcode.def"\ + /out:"../lib/auto/Opcode/Opcode.dll" /implib:"$(OUTDIR)/Opcode.lib" +DEF_FILE= \ + ".\Opcode.def" +LINK32_OBJS= \ + ".\Release\Opcode.obj" \ + "..\perl.lib" + +"$(OUTDIR)\Opcode.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ELSEIF "$(CFG)" == "Opcode - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Opcode_0" +# PROP BASE Intermediate_Dir "Opcode_0" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Target_Dir "" +OUTDIR=.\Debug +INTDIR=.\Debug + +ALL : "$(OUTDIR)\Opcode.dll" + +CLEAN : + -@erase "..\lib\auto\Opcode\Opcode.dll" + -@erase ".\Debug\Opcode.obj" + -@erase ".\Debug\vc40.pdb" + -@erase ".\Debug\vc40.idb" + -@erase ".\Debug\Opcode.lib" + -@erase ".\Debug\Opcode.exp" + -@erase ".\Debug\Opcode.pdb" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c +# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I ".\include" /I "." /I ".." /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c +CPP_PROJ=/nologo /MTd /W3 /Gm /GX /Zi /Od /I ".\include" /I "." /I ".." /D\ + "WIN32" /D "_DEBUG" /D "_WINDOWS" /Fp"$(INTDIR)/Opcode.pch" /YX /Fo"$(INTDIR)/"\ + /Fd"$(INTDIR)/" /c +CPP_OBJS=.\Debug/ +CPP_SBRS= +# ADD BASE MTL /nologo /D "_DEBUG" /win32 +# ADD MTL /nologo /D "_DEBUG" /win32 +MTL_PROJ=/nologo /D "_DEBUG" /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +BSC32_FLAGS=/nologo /o"$(OUTDIR)/Opcode.bsc" +BSC32_SBRS= +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /dll /debug /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /dll /incremental:no /debug /machine:I386 /out:"../lib/auto/Opcode/Opcode.dll" +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ + advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo\ + /subsystem:windows /dll /incremental:no /pdb:"$(OUTDIR)/Opcode.pdb" /debug\ + /machine:I386 /def:".\Opcode.def" /out:"../lib/auto/Opcode/Opcode.dll"\ + /implib:"$(OUTDIR)/Opcode.lib" +DEF_FILE= \ + ".\Opcode.def" +LINK32_OBJS= \ + ".\Debug\Opcode.obj" \ + "..\perl.lib" + +"$(OUTDIR)\Opcode.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ENDIF + +.c{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.cpp{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.cxx{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.c{$(CPP_SBRS)}.sbr: + $(CPP) $(CPP_PROJ) $< + +.cpp{$(CPP_SBRS)}.sbr: + $(CPP) $(CPP_PROJ) $< + +.cxx{$(CPP_SBRS)}.sbr: + $(CPP) $(CPP_PROJ) $< + +################################################################################ +# Begin Target + +# Name "Opcode - Win32 Release" +# Name "Opcode - Win32 Debug" + +!IF "$(CFG)" == "Opcode - Win32 Release" + +!ELSEIF "$(CFG)" == "Opcode - Win32 Debug" + +!ENDIF + +################################################################################ +# Begin Source File + +SOURCE=.\Opcode.def + +!IF "$(CFG)" == "Opcode - Win32 Release" + +!ELSEIF "$(CFG)" == "Opcode - Win32 Debug" + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=..\ext\Opcode\Opcode.c +NODEP_CPP_OPCOD=\ + "..\ext\Opcode\EXTERN.h"\ + "..\ext\Opcode\perl.h"\ + "..\ext\Opcode\XSUB.h"\ + + +!IF "$(CFG)" == "Opcode - Win32 Release" + + +"$(INTDIR)\Opcode.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "Opcode - Win32 Debug" + + +"$(INTDIR)\Opcode.obj" : $(SOURCE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=..\perl.lib + +!IF "$(CFG)" == "Opcode - Win32 Release" + +!ELSEIF "$(CFG)" == "Opcode - Win32 Debug" + +!ENDIF + +# End Source File +# End Target +# End Project +################################################################################ diff --git a/win32/README b/win32/README new file mode 100644 index 0000000000..aec049ab7b --- /dev/null +++ b/win32/README @@ -0,0 +1,25 @@ +How to build + +1. setup VC environment (VCVARS32) +2. make sure you are in the win32 subdirectory +3. NMAKE + +The resulting perl.exe , perl.dll, perlglob.exe would be put +under the main directory. + +the LIB subdirectory is also properly handled which can be +copy to the final location. If you make the directory structure as +the following : + +perl.exe +perl.dll +perlglob.exe +LIB\..... here goes all the module stuff + + +you can save the PERLLIB= line in the environment. this port would +search the LIB sub-directory where the perl.dll is located. + + +That's it + diff --git a/win32/SDBM_File.mak b/win32/SDBM_File.mak new file mode 100644 index 0000000000..0bf5d1adf6 --- /dev/null +++ b/win32/SDBM_File.mak @@ -0,0 +1,361 @@ +# Microsoft Developer Studio Generated NMAKE File, Format Version 4.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +!IF "$(CFG)" == "" +CFG=SDBM_File - Win32 Debug +!MESSAGE No configuration specified. Defaulting to SDBM_File - Win32 Debug. +!ENDIF + +!IF "$(CFG)" != "SDBM_File - Win32 Release" && "$(CFG)" !=\ + "SDBM_File - Win32 Debug" +!MESSAGE Invalid configuration "$(CFG)" specified. +!MESSAGE You can specify a configuration when running NMAKE on this makefile +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "SDBM_File.mak" CFG="SDBM_File - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "SDBM_File - Win32 Release" (based on\ + "Win32 (x86) Dynamic-Link Library") +!MESSAGE "SDBM_File - Win32 Debug" (based on\ + "Win32 (x86) Dynamic-Link Library") +!MESSAGE +!ERROR An invalid configuration is specified. +!ENDIF + +!IF "$(OS)" == "Windows_NT" +NULL= +!ELSE +NULL=nul +!ENDIF +################################################################################ +# Begin Project +# PROP Target_Last_Scanned "SDBM_File - Win32 Debug" +CPP=cl.exe +RSC=rc.exe +MTL=mktyplib.exe + +!IF "$(CFG)" == "SDBM_File - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "SDBM_Fil" +# PROP BASE Intermediate_Dir "SDBM_Fil" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Target_Dir "" +OUTDIR=.\Release +INTDIR=.\Release + +ALL : "$(OUTDIR)\SDBM_File.dll" + +CLEAN : + -@erase "..\lib\auto\SDBM_File\SDBM_File.dll" + -@erase ".\Release\sdbm.obj" + -@erase ".\Release\pair.obj" + -@erase ".\Release\hash.obj" + -@erase ".\Release\SDBM_File.obj" + -@erase ".\Release\SDBM_File.lib" + -@erase ".\Release\SDBM_File.exp" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c +# ADD CPP /nologo /MT /W3 /GX /O2 /I ".\include" /I "." /I ".." /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "MSDOS" /YX /c +CPP_PROJ=/nologo /MT /W3 /GX /O2 /I ".\include" /I "." /I ".." /D "NDEBUG" /D\ + "WIN32" /D "_WINDOWS" /D "MSDOS" /Fp"$(INTDIR)/SDBM_File.pch" /YX\ + /Fo"$(INTDIR)/" /c +CPP_OBJS=.\Release/ +CPP_SBRS= +# ADD BASE MTL /nologo /D "NDEBUG" /win32 +# ADD MTL /nologo /D "NDEBUG" /win32 +MTL_PROJ=/nologo /D "NDEBUG" /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +BSC32_FLAGS=/nologo /o"$(OUTDIR)/SDBM_File.bsc" +BSC32_SBRS= +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /dll /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /dll /pdb:none /machine:I386 /out:"../lib/auto/SDBM_File/SDBM_File.dll" +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ + advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo\ + /subsystem:windows /dll /pdb:none /machine:I386 /def:".\SDBM_File.def"\ + /out:"../lib/auto/SDBM_File/SDBM_File.dll" /implib:"$(OUTDIR)/SDBM_File.lib" +DEF_FILE= \ + ".\SDBM_File.def" +LINK32_OBJS= \ + "$(INTDIR)/sdbm.obj" \ + "$(INTDIR)/pair.obj" \ + "$(INTDIR)/hash.obj" \ + "$(INTDIR)/SDBM_File.obj" \ + "..\perl.lib" + +"$(OUTDIR)\SDBM_File.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ELSEIF "$(CFG)" == "SDBM_File - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Target_Dir "" +OUTDIR=.\Debug +INTDIR=.\Debug + +ALL : "$(OUTDIR)\SDBM_File.dll" + +CLEAN : + -@erase ".\Debug\vc40.pdb" + -@erase ".\Debug\vc40.idb" + -@erase "..\lib\auto\SDBM_File\SDBM_File.dll" + -@erase ".\Debug\hash.obj" + -@erase ".\Debug\pair.obj" + -@erase ".\Debug\SDBM_File.obj" + -@erase ".\Debug\sdbm.obj" + -@erase ".\Debug\SDBM_File.lib" + -@erase ".\Debug\SDBM_File.exp" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c +# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I ".\include" /I "." /I ".." /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "MSDOS" /YX /c +CPP_PROJ=/nologo /MTd /W3 /Gm /GX /Zi /Od /I ".\include" /I "." /I ".." /D\ + "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "MSDOS" /Fp"$(INTDIR)/SDBM_File.pch" /YX\ + /Fo"$(INTDIR)/" /Fd"$(INTDIR)/" /c +CPP_OBJS=.\Debug/ +CPP_SBRS= +# ADD BASE MTL /nologo /D "_DEBUG" /win32 +# ADD MTL /nologo /D "_DEBUG" /win32 +MTL_PROJ=/nologo /D "_DEBUG" /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +BSC32_FLAGS=/nologo /o"$(OUTDIR)/SDBM_File.bsc" +BSC32_SBRS= +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /dll /debug /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /dll /pdb:none /debug /machine:I386 /out:"../lib/auto/SDBM_File/SDBM_File.dll" +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ + advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo\ + /subsystem:windows /dll /pdb:none /debug /machine:I386 /def:".\SDBM_File.def"\ + /out:"../lib/auto/SDBM_File/SDBM_File.dll" /implib:"$(OUTDIR)/SDBM_File.lib" +DEF_FILE= \ + ".\SDBM_File.def" +LINK32_OBJS= \ + "$(INTDIR)/hash.obj" \ + "$(INTDIR)/pair.obj" \ + "$(INTDIR)/SDBM_File.obj" \ + "$(INTDIR)/sdbm.obj" \ + "..\perl.lib" + +"$(OUTDIR)\SDBM_File.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ENDIF + +.c{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.cpp{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.cxx{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.c{$(CPP_SBRS)}.sbr: + $(CPP) $(CPP_PROJ) $< + +.cpp{$(CPP_SBRS)}.sbr: + $(CPP) $(CPP_PROJ) $< + +.cxx{$(CPP_SBRS)}.sbr: + $(CPP) $(CPP_PROJ) $< + +################################################################################ +# Begin Target + +# Name "SDBM_File - Win32 Release" +# Name "SDBM_File - Win32 Debug" + +!IF "$(CFG)" == "SDBM_File - Win32 Release" + +!ELSEIF "$(CFG)" == "SDBM_File - Win32 Debug" + +!ENDIF + +################################################################################ +# Begin Source File + +SOURCE=..\ext\SDBM_File\SDBM_File.c +DEP_CPP_SDBM_=\ + ".\EXTERN.h"\ + ".\..\perl.h"\ + ".\..\XSUB.h"\ + ".\..\ext\SDBM_File\sdbm\sdbm.h"\ + ".\..\embed.h"\ + ".\config.h"\ + {$(INCLUDE)}"\sys\Types.h"\ + ".\..\perlio.h"\ + {$(INCLUDE)}"\sys\Stat.h"\ + ".\include\dirent.h"\ + ".\..\handy.h"\ + ".\..\dosish.h"\ + ".\..\plan9\plan9ish.h"\ + ".\..\unixish.h"\ + ".\..\regexp.h"\ + ".\..\sv.h"\ + ".\..\util.h"\ + ".\..\form.h"\ + ".\..\gv.h"\ + ".\..\cv.h"\ + ".\..\opcode.h"\ + ".\..\op.h"\ + ".\..\cop.h"\ + ".\..\av.h"\ + ".\..\hv.h"\ + ".\..\mg.h"\ + ".\..\scope.h"\ + ".\..\perly.h"\ + ".\..\pp.h"\ + ".\..\proto.h"\ + ".\win32.h"\ + ".\include\sys/socket.h"\ + ".\include\netdb.h"\ + ".\..\perlsdio.h"\ + ".\..\perlsfio.h"\ + ".\..\nostdio.h"\ + +NODEP_CPP_SDBM_=\ + ".\..\os2ish.h"\ + ".\..\vmsish.h"\ + + +!IF "$(CFG)" == "SDBM_File - Win32 Release" + + +"$(INTDIR)\SDBM_File.obj" : $(SOURCE) $(DEP_CPP_SDBM_) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "SDBM_File - Win32 Debug" + + +"$(INTDIR)\SDBM_File.obj" : $(SOURCE) $(DEP_CPP_SDBM_) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=..\ext\SDBM_File\sdbm\sdbm.c +DEP_CPP_SDBM_C=\ + ".\config.h"\ + ".\..\ext\SDBM_File\sdbm\sdbm.h"\ + ".\..\ext\SDBM_File\sdbm\tune.h"\ + ".\win32.h"\ + ".\include\dirent.h"\ + ".\include\sys/socket.h"\ + ".\include\netdb.h"\ + {$(INCLUDE)}"\sys\Types.h"\ + {$(INCLUDE)}"\sys\Stat.h"\ + + +"$(INTDIR)\sdbm.obj" : $(SOURCE) $(DEP_CPP_SDBM_C) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=..\ext\SDBM_File\sdbm\pair.c +DEP_CPP_PAIR_=\ + ".\config.h"\ + ".\..\ext\SDBM_File\sdbm\sdbm.h"\ + ".\..\ext\SDBM_File\sdbm\tune.h"\ + ".\win32.h"\ + ".\include\dirent.h"\ + ".\include\sys/socket.h"\ + ".\include\netdb.h"\ + {$(INCLUDE)}"\sys\Types.h"\ + {$(INCLUDE)}"\sys\Stat.h"\ + + +"$(INTDIR)\pair.obj" : $(SOURCE) $(DEP_CPP_PAIR_) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=..\ext\SDBM_File\sdbm\hash.c +DEP_CPP_HASH_=\ + ".\config.h"\ + ".\..\ext\SDBM_File\sdbm\sdbm.h"\ + ".\win32.h"\ + ".\include\dirent.h"\ + ".\include\sys/socket.h"\ + ".\include\netdb.h"\ + {$(INCLUDE)}"\sys\Types.h"\ + {$(INCLUDE)}"\sys\Stat.h"\ + + +"$(INTDIR)\hash.obj" : $(SOURCE) $(DEP_CPP_HASH_) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\SDBM_File.def + +!IF "$(CFG)" == "SDBM_File - Win32 Release" + +!ELSEIF "$(CFG)" == "SDBM_File - Win32 Debug" + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=..\perl.lib + +!IF "$(CFG)" == "SDBM_File - Win32 Release" + +!ELSEIF "$(CFG)" == "SDBM_File - Win32 Debug" + +!ENDIF + +# End Source File +# End Target +# End Project +################################################################################ diff --git a/win32/Socket.mak b/win32/Socket.mak new file mode 100644 index 0000000000..f2a09dce95 --- /dev/null +++ b/win32/Socket.mak @@ -0,0 +1,276 @@ +# Microsoft Developer Studio Generated NMAKE File, Format Version 4.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +!IF "$(CFG)" == "" +CFG=Socket - Win32 Debug +!MESSAGE No configuration specified. Defaulting to Socket - Win32 Debug. +!ENDIF + +!IF "$(CFG)" != "Socket - Win32 Release" && "$(CFG)" != "Socket - Win32 Debug" +!MESSAGE Invalid configuration "$(CFG)" specified. +!MESSAGE You can specify a configuration when running NMAKE on this makefile +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "Socket.mak" CFG="Socket - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "Socket - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "Socket - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE +!ERROR An invalid configuration is specified. +!ENDIF + +!IF "$(OS)" == "Windows_NT" +NULL= +!ELSE +NULL=nul +!ENDIF +################################################################################ +# Begin Project +# PROP Target_Last_Scanned "Socket - Win32 Debug" +CPP=cl.exe +RSC=rc.exe +MTL=mktyplib.exe + +!IF "$(CFG)" == "Socket - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Socket__" +# PROP BASE Intermediate_Dir "Socket__" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "release" +# PROP Intermediate_Dir "release" +# PROP Target_Dir "" +OUTDIR=.\release +INTDIR=.\release + +ALL : "$(OUTDIR)\Socket.dll" + +CLEAN : + -@erase "..\lib\auto\Socket\Socket.dll" + -@erase ".\release\Socket.obj" + -@erase ".\release\Socket.lib" + -@erase ".\release\Socket.exp" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c +# ADD CPP /nologo /MT /W3 /GX /O2 /I ".\include" /I "." /I ".." /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c +CPP_PROJ=/nologo /MT /W3 /GX /O2 /I ".\include" /I "." /I ".." /D "WIN32" /D\ + "NDEBUG" /D "_WINDOWS" /Fp"$(INTDIR)/Socket.pch" /YX /Fo"$(INTDIR)/" /c +CPP_OBJS=.\release/ +CPP_SBRS= +# ADD BASE MTL /nologo /D "NDEBUG" /win32 +# ADD MTL /nologo /D "NDEBUG" /win32 +MTL_PROJ=/nologo /D "NDEBUG" /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +BSC32_FLAGS=/nologo /o"$(OUTDIR)/Socket.bsc" +BSC32_SBRS= +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /dll /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /dll /machine:I386 /out:"..\lib\auto\Socket\Socket.dll" +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ + advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo\ + /subsystem:windows /dll /incremental:no /pdb:"$(OUTDIR)/Socket.pdb"\ + /machine:I386 /def:".\Socket.def" /out:"..\lib\auto\Socket\Socket.dll"\ + /implib:"$(OUTDIR)/Socket.lib" +DEF_FILE= \ + ".\Socket.def" +LINK32_OBJS= \ + "$(INTDIR)/Socket.obj" \ + "..\perl.lib" + +"$(OUTDIR)\Socket.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ELSEIF "$(CFG)" == "Socket - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Socket_0" +# PROP BASE Intermediate_Dir "Socket_0" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "debug" +# PROP Intermediate_Dir "debug" +# PROP Target_Dir "" +OUTDIR=.\debug +INTDIR=.\debug + +ALL : "$(OUTDIR)\Socket.dll" + +CLEAN : + -@erase ".\debug\vc40.pdb" + -@erase ".\debug\vc40.idb" + -@erase ".\debug\Socket.dll" + -@erase ".\debug\Socket.obj" + -@erase ".\debug\Socket.ilk" + -@erase ".\debug\Socket.lib" + -@erase ".\debug\Socket.exp" + -@erase ".\debug\Socket.pdb" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c +# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I ".\include" /I "." /I ".." /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c +CPP_PROJ=/nologo /MTd /W3 /Gm /GX /Zi /Od /I ".\include" /I "." /I ".." /D\ + "WIN32" /D "_DEBUG" /D "_WINDOWS" /Fp"$(INTDIR)/Socket.pch" /YX /Fo"$(INTDIR)/"\ + /Fd"$(INTDIR)/" /c +CPP_OBJS=.\debug/ +CPP_SBRS= +# ADD BASE MTL /nologo /D "_DEBUG" /win32 +# ADD MTL /nologo /D "_DEBUG" /win32 +MTL_PROJ=/nologo /D "_DEBUG" /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +BSC32_FLAGS=/nologo /o"$(OUTDIR)/Socket.bsc" +BSC32_SBRS= +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /dll /debug /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /dll /debug /machine:I386 +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ + advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo\ + /subsystem:windows /dll /incremental:yes /pdb:"$(OUTDIR)/Socket.pdb" /debug\ + /machine:I386 /def:".\Socket.def" /out:"$(OUTDIR)/Socket.dll"\ + /implib:"$(OUTDIR)/Socket.lib" +DEF_FILE= \ + ".\Socket.def" +LINK32_OBJS= \ + "$(INTDIR)/Socket.obj" \ + "..\perl.lib" + +"$(OUTDIR)\Socket.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ENDIF + +.c{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.cpp{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.cxx{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.c{$(CPP_SBRS)}.sbr: + $(CPP) $(CPP_PROJ) $< + +.cpp{$(CPP_SBRS)}.sbr: + $(CPP) $(CPP_PROJ) $< + +.cxx{$(CPP_SBRS)}.sbr: + $(CPP) $(CPP_PROJ) $< + +################################################################################ +# Begin Target + +# Name "Socket - Win32 Release" +# Name "Socket - Win32 Debug" + +!IF "$(CFG)" == "Socket - Win32 Release" + +!ELSEIF "$(CFG)" == "Socket - Win32 Debug" + +!ENDIF + +################################################################################ +# Begin Source File + +SOURCE=..\ext\Socket\Socket.c +DEP_CPP_SOCKE=\ + ".\EXTERN.h"\ + ".\..\perl.h"\ + ".\..\XSUB.h"\ + {$(INCLUDE)}"\sys\Types.h"\ + ".\include\sys/socket.h"\ + ".\include\netdb.h"\ + ".\include\arpa/inet.h"\ + ".\..\embed.h"\ + ".\config.h"\ + ".\..\perlio.h"\ + {$(INCLUDE)}"\sys\Stat.h"\ + ".\include\dirent.h"\ + ".\..\handy.h"\ + ".\..\dosish.h"\ + ".\..\plan9\plan9ish.h"\ + ".\..\unixish.h"\ + ".\..\regexp.h"\ + ".\..\sv.h"\ + ".\..\util.h"\ + ".\..\form.h"\ + ".\..\gv.h"\ + ".\..\cv.h"\ + ".\..\opcode.h"\ + ".\..\op.h"\ + ".\..\cop.h"\ + ".\..\av.h"\ + ".\..\hv.h"\ + ".\..\mg.h"\ + ".\..\scope.h"\ + ".\..\perly.h"\ + ".\..\pp.h"\ + ".\..\proto.h"\ + ".\win32.h"\ + ".\..\perlsdio.h"\ + ".\..\perlsfio.h"\ + ".\..\nostdio.h"\ + +NODEP_CPP_SOCKE=\ + ".\..\ext\Socket\sockadapt.h"\ + ".\..\os2ish.h"\ + ".\..\vmsish.h"\ + + +"$(INTDIR)\Socket.obj" : $(SOURCE) $(DEP_CPP_SOCKE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=..\perl.lib + +!IF "$(CFG)" == "Socket - Win32 Release" + +!ELSEIF "$(CFG)" == "Socket - Win32 Debug" + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\Socket.def + +!IF "$(CFG)" == "Socket - Win32 Release" + +!ELSEIF "$(CFG)" == "Socket - Win32 Debug" + +!ENDIF + +# End Source File +# End Target +# End Project +################################################################################ diff --git a/win32/TEST b/win32/TEST new file mode 100644 index 0000000000..bd9f7b7186 --- /dev/null +++ b/win32/TEST @@ -0,0 +1,145 @@ +#!./perl + +# Last change: Fri Jan 10 09:57:03 WET 1997 + +# This is written in a peculiar style, since we're trying to avoid +# most of the constructs we'll be testing for. + +$| = 1; + +if ($ARGV[0] eq '-v') { + $verbose = 1; + shift; +} + +chdir 't' if -f 't/TEST'; + +die "You need to run \"make test\" first to set things up.\n" + unless -e 'perl' or -e 'perl.exe'; + +$ENV{EMXSHELL} = 'sh'; # For OS/2 + +if ($ARGV[0] eq '') { + push( @ARGV, `dir/s/b base` ); + push( @ARGV, `dir/s/b comp` ); + push( @ARGV, `dir/s/b cmd` ); + push( @ARGV, `dir/s/b io` ); + push( @ARGV, `dir/s/b op` ); + push( @ARGV, `dir/s/b lib` ); + push( @ARGV, `dir/s/b nt` ); + + grep( chomp, @ARGV ); + @ARGV = grep( /\.t$/, @ARGV ); + grep( s/.*t\\//, @ARGV ); +# @ARGV = split(/[ \n]/, +# `echo base/*.t comp/*.t cmd/*.t io/*.t; echo op/*.t pragma/*.t lib/*.t`); +} + +if ($^O eq 'os2' || $^O eq 'qnx' || 1) { + $sharpbang = 0; +} +else { + open(CONFIG, "../config.sh"); + while (<CONFIG>) { + if (/sharpbang='(.*)'/) { + $sharpbang = ($1 eq '#!'); + last; + } + } + close(CONFIG); +} + +$bad = 0; +$good = 0; +$total = @ARGV; +while ($test = shift) { + if ($test =~ /^$/) { + next; + } + $te = $test; + chop($te); + print "$te" . '.' x (18 - length($te)); + if ($sharpbang) { + open(results,"./$test |") || (print "can't run.\n"); + } else { + open(script,"$test") || die "Can't run $test.\n"; + $_ = <script>; + close(script); + if (/#!..perl(.*)/) { + $switch = $1; + if ($^O eq 'VMS') { + # Must protect uppercase switches with "" on command line + $switch =~ s/-([A-Z]\S*)/"-$1"/g; + } + } else { + $switch = ''; + } + open(results,"perl$switch $test |") || (print "can't run.\n"); + } + $ok = 0; + $next = 0; + while (<results>) { + if (/^$/) { next;}; + if ($verbose) { + print $_; + } + unless (/^#/) { + if (/^1\.\.([0-9]+)/) { + $max = $1; + $totmax += $max; + $files += 1; + $next = 1; + $ok = 1; + } else { + $next = $1, $ok = 0, last if /^not ok ([0-9]*)/; + if (/^ok (.*)/ && $1 == $next) { + $next = $next + 1; + } else { + $ok = 0; + } + } + } + } + $next = $next - 1; + if ($ok && $next == $max) { + if ($max) { + print "ok\n"; + $good = $good + 1; + } else { + print "skipping test on this platform\n"; + $files -= 1; + } + } else { + $next += 1; + print "FAILED on test $next\n"; + $bad = $bad + 1; + $_ = $test; + if (/^base/) { + die "Failed a basic test--cannot continue.\n"; + } + } +} + +if ($bad == 0) { + if ($ok) { + print "All tests successful.\n"; + } else { + die "FAILED--no tests were run for some reason.\n"; + } +} else { + $pct = sprintf("%.2f", $good / $total * 100); + if ($bad == 1) { + warn "Failed 1 test script out of $total, $pct% okay.\n"; + } else { + warn "Failed $bad test scripts out of $total, $pct% okay.\n"; + } + warn <<'SHRDLU'; + ### Since not all tests were successful, you may want to run some + ### of them individually and examine any diagnostic messages they + ### produce. See the INSTALL document's section on "make test". +SHRDLU +} +($user,$sys,$cuser,$csys) = times; +print sprintf("u=%g s=%g cu=%g cs=%g scripts=%d tests=%d\n", + $user,$sys,$cuser,$csys,$files,$totmax); +exit $bad != 0; diff --git a/win32/autosplit.pl b/win32/autosplit.pl new file mode 100644 index 0000000000..26ce2c358c --- /dev/null +++ b/win32/autosplit.pl @@ -0,0 +1,3 @@ +use AutoSplit; + +autosplit($ARGV[0], $ARGV[1], 0, 1, 1); diff --git a/win32/bin/PL2BAT.BAT b/win32/bin/PL2BAT.BAT new file mode 100644 index 0000000000..462affa7d0 --- /dev/null +++ b/win32/bin/PL2BAT.BAT @@ -0,0 +1,40 @@ +@rem = ' +@echo off +perl -S %0.bat %1 %2 %3 %4 %5 %6 %7 %8 %9 +goto endofperl +@rem '; + +$head = <<'--end--'; +@rem = '--*-Perl-*--'; +@rem = ' +@echo off +perl -S %0.bat %1 %2 %3 %4 %5 %6 %7 %8 %9 +goto endofperl +@rem '; +--end-- + +$tail = "__END__\n:endofperl\n"; + +if ( @ARGV ) { + LOOP: + foreach ( @ARGV ) { + open( FILE, $_ ); + @file = <FILE>; + if ( grep( /:endofperl/, @file ) ) { + warn "$_ has already been converted to a batch file!!\n"; + next LOOP; + } + close( FILE, $_ ); + s/\.pl//; + s/\.bat//; + open( FILE, ">$_.bat" ); + print FILE $head, @file, $tail; + close( FILE ); + } +} else { + @file = <STDIN>; + print $head, @file, $tail; +} + +__END__ +:endofperl diff --git a/win32/bin/network.pl b/win32/bin/network.pl new file mode 100644 index 0000000000..f49045333d --- /dev/null +++ b/win32/bin/network.pl @@ -0,0 +1,211 @@ +## +## Jeffrey Friedl (jfriedl@omron.co.jp) +## Copyri.... ah hell, just take it. +## +## July 1994 +## +package network; +$version = "950311.5"; + +## version 950311.5 -- turned off warnings when requiring 'socket.ph'; +## version 941028.4 -- some changes to quiet perl5 warnings. +## version 940826.3 -- added check for "socket.ph", and alternate use of +## socket STREAM value for SunOS5.x +## + +## BLURB: +## A few simple and easy-to-use routines to make internet connections. +## Similar to "chat2.pl" (but actually commented, and a bit more portable). +## Should work even on SunOS5.x. +## + +##> +## +## connect_to() -- make an internet connection to a server. +## +## Two uses: +## $error = &network'connect_to(*FILEHANDLE, $fromsockaddr, $tosockaddr) +## $error = &network'connect_to(*FILEHANDLE, $hostname, $portnum) +## +## Makes the given connection and returns an error string, or undef if +## no error. +## +## In the first form, FROMSOCKADDR and TOSOCKADDR are of the form returned +## by SOCKET'GET_ADDR and SOCKET'MY_ADDR. +## +##< +sub connect_to +{ + local(*FD, $arg1, $arg2) = @_; + local($from, $to) = ($arg1, $arg2); ## for one interpretation. + local($host, $port) = ($arg1, $arg2); ## for the other + + if (defined($to) && length($from)==16 && length($to)==16) { + ## ok just as is + } elsif (defined($host)) { + $to = &get_addr($host, $port); + return qq/unknown address "$host"/ unless defined $to; + $from = &my_addr; + } else { + return "unknown arguments to network'connect_to"; + } + + return "connect_to failed (socket: $!)" unless &my_inet_socket(*FD); + return "connect_to failed (bind: $!)" unless bind(FD, $from); + return "connect_to failed (connect: $!)" unless connect(FD, $to); + local($old) = select(FD); $| = 1; select($old); + undef; +} + + + +##> +## +## listen_at() - used by a server to indicate that it will accept requests +## at the port number given. +## +## Used as +## $error = &network'listen_at(*LISTEN, $portnumber); +## (returns undef upon success) +## +## You can then do something like +## $addr = accept(REMOTE, LISTEN); +## print "contact from ", &network'addr_to_ascii($addr), ".\n"; +## while (<REMOTE>) { +## .... process request.... +## } +## close(REMOTE); +## +##< +sub listen_at +{ + local(*FD, $port) = @_; + local($empty) = pack('S n a4 x8', 2 ,$port, "\0\0\0\0"); + return "listen_for failed (socket: $!)" unless &my_inet_socket(*FD); + return "listen_for failed (bind: $!)" unless bind(FD, $empty); + return "listen_for failed (listen: $!)" unless listen(FD, 5); + local($old) = select(FD); $| = 1; select($old); + undef; +} + + +##> +## +## Given an internal packed internet address (as returned by &connect_to +## or &get_addr), return a printable ``1.2.3.4'' version. +## +##< +sub addr_to_ascii +{ + local($addr) = @_; + return "bad arg" if length $addr != 16; + return join('.', unpack("CCCC", (unpack('S n a4 x8', $addr))[2])); +} + +## +## +## Given a host and a port name, returns the packed socket addresss. +## Mostly for internal use. +## +## +sub get_addr +{ + local($host, $port) = @_; + return $addr{$host,$port} if defined $addr{$host,$port}; + local($addr); + + if ($host =~ m/^\d+\.\d+\.\d+\.\d+$/) + { + $addr = pack("C4", split(/\./, $host)); + } + elsif ($addr = (gethostbyname($host))[4], !defined $addr) + { + local(@lookup) = `nslookup $host 2>&1`; + if (@lookup) + { + local($lookup) = join('', @lookup[2 .. $#lookup]); + if ($lookup =~ m/^Address:\s*(\d+\.\d+\.\d+\.\d+)/) { + $addr = pack("C4", split(/\./, $1)); + } + } + if (!defined $addr) { + ## warn "$host: SOL, dude\n"; + return undef; + } + } + $addr{$host,$port} = pack('S n a4 x8', 2 ,$port, $addr); +} + + +## +## my_addr() +## Returns the packed socket address of the local host (port 0) +## Mostly for internal use. +## +## +sub my_addr +{ + local(@x) = gethostbyname('localhost'); + local(@y) = gethostbyname($x[0]); +# local($name,$aliases,$addrtype,$length,@addrs) = gethostbyname($x[0]); +# local(@bytes) = unpack("C4",$addrs[0]); +# return pack('S n a4 x8', 2 ,0, $addr); + return pack('S n a4 x8', 2 ,0, $y[4]); +} + + +## +## my_inet_socket(*FD); +## +## Local routine to do socket(PF_INET, SOCK_STREAM, AF_NS). +## Takes care of figuring out the proper values for the args. Hopefully. +## +## Returns the same value as 'socket'. +## +sub my_inet_socket +{ + local(*FD) = @_; + local($socket); + + if (!defined $socket_values_queried) + { + ## try to load some "socket.ph" + if (!defined &main'_SYS_SOCKET_H_) { + eval 'package main; + local($^W) = 0; + require("sys/socket.ph")||require("socket.ph");'; + } + + ## we'll use "the regular defaults" if for PF_INET and AF_NS if unknown + $PF_INET = defined &main'PF_INET ? &main'PF_INET : 2; + $AF_NS = defined &main'AF_NS ? &main'AF_NS : 6; + $SOCK_STREAM = &main'SOCK_STREAM if defined &main'SOCK_STREAM; + + $socket_values_queried = 1; + } + + if (defined $SOCK_STREAM) { + $socket = socket(FD, $PF_INET, $SOCK_STREAM, $AF_NS); + } else { + ## + ## We'll try the "regular default" of 1. If that returns a + ## "not supported" error, we'll try 2, which SunOS5.x uses. + ## + $socket = socket(FD, $PF_INET, 1, $AF_NS); + if ($socket) { + $SOCK_STREAM = 1; ## got it. + } elsif ($! =~ m/not supported/i) { + ## we'll just assume from now on that it's 2. + $socket = socket(FD, $PF_INET, $SOCK_STREAM = 2, $AF_NS); + } + } + $socket; +} + +## This here just to quiet -w warnings. +sub dummy { + 1 || $version || &dummy; +} + +1; +__END__ diff --git a/win32/bin/search.bat b/win32/bin/search.bat new file mode 100644 index 0000000000..0bb123759f --- /dev/null +++ b/win32/bin/search.bat @@ -0,0 +1,1873 @@ +@rem = '--*-Perl-*--'; +@rem = ' +@echo off +perl -S %0.bat %1 %2 %3 %4 %5 %6 %7 %8 %9 +goto endofperl +@rem '; +#!/usr/local/bin/perl -w +'di'; +'ig00'; +############################################################################## +## +## search +## +## Jeffrey Friedl (jfriedl@omron.co.jp), Dec 1994. +## Copyright 19.... ah hell, just take it. +## +## BLURB: +## A combo of find and grep -- more or less do a 'grep' on a whole +## directory tree. Fast, with lots of options. Much more powerful than +## the simple "find ... | xargs grep ....". Has a full man page. +## Powerfully customizable. +## +## This file is big, but mostly comments and man page. +## +## See man page for usage info. +## Return value: 2=error, 1=nothing found, 0=something found. +## + +$version = "950918.5"; +## +## "950918.5"; +## Changed all 'sysread' to 'read' because Linux perl's don't seem +## to like sysread() +## +## "941227.4"; +## Added -n, -u +## +## "941222.3" +## Added -nice (due to Lionel Cons <Lionel.Cons@cern.ch>) +## Removed any leading "./" from name. +## Added default flags for ~/.search, including TTY, -nice, -list, etc. +## Program name now has path removed when printed in diagnostics. +## Added simple tilde-expansion to -dir arg. +## Added -dskip, etc. Fixed -iregex bug. +## Changed -dir to be additive, adding -ddir. +## Now screen out devices, pipes, and sockets. +## More tidying and lots of expanding of the man page +## +## +## "941217.2"; +## initial release. + +$stripped=0; + +&init; +$rc_file = join('/', $ENV{'HOME'}, ".search"); + +&check_args; + +## Make sure we've got a regex. +## Don't need one if -find or -showrc was specified. +$!=2, die "expecting regex arguments.\n" + if $FIND_ONLY == 0 && $showrc == 0 && @ARGV == 0; + +&prepare_to_search($rc_file); + +&import_program if !defined &dodir; ## BIG key to speed. + +## do search while there are directories to be done. +&dodir(shift(@todo)) while @todo; + +&clear_message if $VERBOSE && $STDERR_IS_TTY; +exit($retval); +############################################################################### + +sub init +{ + ## initialize variables that might be reset by command-line args + $DOREP=0; ## set true by -dorep (redo multi-hardlink files) + $DO_SORT=0; ## set by -sort (sort files in a dir before checking) + $FIND_ONLY=0; ## set by -find (don't search files) + $LIST_ONLY=0; ## set true by -l (list filenames only) + $NEWER=0; ## set by -newer, "-mtime -###" + $NICE=0; ## set by -nice (print human-readable output) + $NOLINKS=0; ## set true by -nolinks (don't follow symlinks) + $OLDER=0; ## set by -older, "-mtime ###" + $PREPEND_FILENAME=1; ## set false by -h (don't prefix lines with filename) + $REPORT_LINENUM=0; ## set true by -n (show line numbers) + $VERBOSE=0; ## set to a value by -v, -vv, etc. (verbose messages) + $WHY=0; ## set true by -why, -vvv+ (report why skipped) + $XDEV=0; ## set true by -xdev (stay on one filesystem) + $all=0; ## set true by -all (don't skip many kinds of files) + $iflag = ''; ## set to 'i' by -i (ignore case); + $norc=0; ## set by -norc (don't load rc file) + $showrc=0; ## set by -showrc (show what happens with rc file) + $underlineOK=0; ## set true by -u (watch for underline stuff) + $words=0; ## set true by -w (match whole-words only) + $DELAY=0; ## inter-file delay (seconds) + $retval=1; ## will set to 0 if we find anything. + + ## various elements of stat() that we might access + $STAT_DEV = 1; + $STAT_INODE = 2; + $STAT_MTIME = 9; + + $VV_PRINT_COUNT = 50; ## with -vv, print every VV_PRINT_COUNT files, or... + $VV_SIZE = 1024*1024; ## ...every VV_SIZE bytes searched + $vv_print = $vv_size = 0; ## running totals. + + ## set default options, in case the rc file wants them + $opt{'TTY'}= 1 if -t STDOUT; + + ## want to know this for debugging message stuff + $STDERR_IS_TTY = -t STDERR ? 1 : 0; + $STDERR_SCREWS_STDOUT = ($STDERR_IS_TTY && -t STDOUT) ? 1 : 0; + + $0 =~ s,.*/,,; ## clean up $0 for any diagnostics we'll be printing. +} + +## +## Check arguments. +## +sub check_args +{ + while (@ARGV && $ARGV[0] =~ m/^-/) + { + $arg = shift(@ARGV); + + if ($arg eq '-version' || ($VERBOSE && $arg eq '-help')) { + print qq/Jeffrey's file search, version "$version".\n/; + exit(0) unless $arg eq '-help'; + } + if ($arg eq '-help') { + print <<INLINE_LITERAL_TEXT; +usage: $0 [options] [-e] [PerlRegex ....] +OPTIONS TELLING *WHERE* TO SEARCH: + -dir DIR start search at the named directory (default is current dir). + -xdev stay on starting file system. + -sort sort the files in each directory before processing. + -nolinks don't follow symbolic links. +OPTIONS TELLING WHICH FILES TO EVEN CONSIDER: + -mtime # consider files modified > # days ago (-# for < # days old) + -newer FILE consider files modified more recently than FILE (also -older) + -name GLOB consider files whose name matches pattern (also -regex). + -skip GLOB opposite of -name: identifies files to not consider. + -path GLOB like -name, but for files whose whole path is described. + -dpath/-dregex/-dskip versions for selecting or pruning directories. + -all don't skip any files marked to be skipped by the startup file. + -x<SPECIAL> (see manual, and/or try -showrc). + -why report why a file isn't checked (also implied by -vvvv). +OPTIONS TELLING WHAT TO DO WITH FILES THAT WILL BE CONSIDERED: + -f | -find just list files (PerlRegex ignored). Default is to grep them. + -ff | -ffind Does a faster -find (implies -find -all -dorep) +OPTIONS CONTROLLING HOW THE SEARCH IS DONE (AND WHAT IS PRINTED): + -l | -list only list files with matches, not the lines themselves. + -nice | -nnice print more "human readable" output. + -n prefix each output line with its line number in the file. + -h don't prefix output lines with file name. + -u also look "inside" manpage-style underlined text + -i do case-insensitive searching. + -w match words only (as defined by perl's \\b). +OTHER OPTIONS: + -v, -vv, -vvv various levels of message verbosity. + -e end of options (in case a regex looks like an option). + -showrc show what the rc file sets, then exit. + -norc don't load the rc file. + -dorep check files with multiple hard links multiple times. +INLINE_LITERAL_TEXT + print "Use -v -help for more verbose help.\n" unless $VERBOSE; + print "This script file is also a man page.\n" unless $stripped; + print <<INLINE_LITERAL_TEXT if $VERBOSE; + +If -f (or -find) given, PerlRegex is optional and ignored. +Otherwise, will search for files with lines matching any of the given regexes. + +Combining things like -name and -mtime implies boolean AND. +However, duplicating things (such as -name '*.c' -name '*.txt') implies OR. + +-mtime may be given floating point (i.e. 1.5 is a day and a half). +-iskip/-idskip/-ipath/... etc are case-insensitive versions. + +If any letter in -newer/-older is upper case, "or equal" is +inserted into the test. + +You can always find the latest version on the World Wide Web in + http://www.wg.omron.co.jp/~jfriedl/perl/ +INLINE_LITERAL_TEXT + exit(0); + } + $DOREP=1, next if $arg eq '-dorep'; ## do repeats + $DO_SORT=1, next if $arg eq '-sort'; ## sort files + $NOLINKS=1, next if $arg eq '-nolinks'; ## no sym. links + $PREPEND_FILENAME=0, next if $arg eq '-h'; ## no filename prefix + $REPORT_LINENUM=1, next if $arg eq '-n'; ## show line numbers + $WHY=1, next if $arg eq '-why'; ## tell why skipped + $XDEV=1, next if $arg eq '-xdev'; ## don't leave F.S. + $all=1,$opt{'-all'}=1,next if $arg eq '-all'; ## don't skip *.Z, etc + $iflag='i', next if $arg eq '-i'; ## ignore case + $norc=1, next if $arg eq '-norc'; ## don't load rc file + $showrc=1, next if $arg eq '-showrc'; ## show rc file + $underlineOK=1, next if $arg eq '-u'; ## look throuh underln. + $words=1, next if $arg eq '-w'; ## match "words" only + &strip if $arg eq '-strip'; ## dump this program + last if $arg eq '-e'; + $DELAY=$1, next if $arg =~ m/-delay(\d+)/; + + $FIND_ONLY=1, next if $arg =~/^-f(ind)?$/;## do "find" only + + $FIND_ONLY=1, $DOREP=1, $all=1, + next if $arg =~/^-ff(ind)?$/;## fast -find + $LIST_ONLY=1,$opt{'-list'}=1, + next if $arg =~/^-l(ist)?$/;## only list files + + if ($arg =~ m/^-(v+)$/) { ## verbosity + $VERBOSE =length($1); + foreach $len (1..$VERBOSE) { $opt{'-'.('v' x $len)}=1 } + next; + } + if ($arg =~ m/^-(n+)ice$/) { ## "nice" output + $NICE =length($1); + foreach $len (1..$NICE) { $opt{'-'.('n' x $len).'ice'}=1 } + next; + } + + if ($arg =~ m/^-(i?)(d?)skip$/) { + local($i) = $1 eq 'i'; + local($d) = $2 eq 'd'; + $! = 2, die qq/$0: expecting glob arg to -$arg\n/ unless @ARGV; + foreach (split(/\s+/, shift @ARGV)) { + if ($d) { + $idskip{$_}=1 if $i; + $dskip{$_}=1; + } else { + $iskip{$_}=1 if $i; + $skip{$_}=1; + } + } + next; + } + + + if ($arg =~ m/^-(i?)(d?)(regex|path|name)$/) { + local($i) = $1 eq 'i'; + $! = 2, die qq/$0: expecting arg to -$arg\n/ unless @ARGV; + foreach (split(/\s+/, shift @ARGV)) { + $iname{join(',', $arg, $_)}=1 if $i; + $name{join(',', $arg, $_)}=1; + } + next; + } + + if ($arg =~ m/^-d?dir$/) { + $opt{'-dir'}=1; + $! = 2, die qq/$0: expecting filename arg to -$arg\n/ unless @ARGV; + $start = shift(@ARGV); + $start =~ s#^~(/+|$)#$ENV{'HOME'}$1# if defined $ENV{'HOME'}; + $! = 2, die qq/$0: can't find ${arg}'s "$start"\n/ unless -e $start; + $! = 2, die qq/$0: ${arg}'s "$start" not a directory.\n/ unless -d _; + undef(@todo), $opt{'-ddir'}=1 if $arg eq '-ddir'; + push(@todo, $start); + next; + } + + if ($arg =~ m/^-(new|old)er$/i) { + $! = 2, die "$0: expecting filename arg to -$arg\n" unless @ARGV; + local($file, $time) = shift(@ARGV); + $! = 2, die qq/$0: can't stat -${arg}'s "$file"./ + unless $time = (stat($file))[$STAT_MTIME]; + local($upper) = $arg =~ tr/A-Z//; + if ($arg =~ m/new/i) { + $time++ unless $upper; + $NEWER = $time if $NEWER < $time; + } else { + $time-- unless $upper; + $OLDER = $time if $OLDER == 0 || $OLDER > $time; + } + next; + } + + if ($arg =~ m/-mtime/) { + $! = 2, die "$0: expecting numerical arg to -$arg\n" unless @ARGV; + local($days) = shift(@ARGV); + $! = 2, die qq/$0: inappropriate arg ($days) to $arg\n/ if $days==0; + $days *= 3600 * 24; + if ($days < 0) { + local($time) = $^T + $days; + $NEWER = $time if $NEWER < $time; + } else { + local($time) = $^T - $days; + $OLDER = $time if $OLDER == 0 || $OLDER > $time; + } + next; + } + + ## special user options + if ($arg =~ m/^-x(.+)/) { + foreach (split(/[\s,]+/, $1)) { $user_opt{$_} = $opt{$_}= 1; } + next; + } + + $! = 2, die "$0: unknown arg [$arg]\n"; + } +} + +## +## Given a filename glob, return a regex. +## If the glob has no globbing chars (no * ? or [..]), then +## prepend an effective '*' to it. +## +sub glob_to_regex +{ + local($glob) = @_; + local(@parts) = $glob =~ m/\\.|[*?]|\[]?[^]]*]|[^[\\*?]+/g; + local($trueglob)=0; + foreach (@parts) { + if ($_ eq '*' || $_ eq '?') { + $_ = ".$_"; + $trueglob=1; ## * and ? are a real glob + } elsif (substr($_, 0, 1) eq '[') { + $trueglob=1; ## [..] is a real glob + } else { + s/^\\//; ## remove any leading backslash; + s/\W/\\$&/g; ## now quote anything dangerous; + } + } + unshift(@parts, '.*') unless $trueglob; + join('', '^', @parts, '$'); +} + +sub prepare_to_search +{ + local($rc_file) = @_; + + $HEADER_BYTES=0; ## Might be set nonzero in &read_rc; + $last_message_length = 0; ## For &message and &clear_message. + + &read_rc($rc_file, $showrc) unless $norc; + exit(0) if $showrc; + + $NEXT_DIR_ENTRY = $DO_SORT ? 'shift @files' : 'readdir(DIR)'; + $WHY = 1 if $VERBOSE > 3; ## Arg -vvvv or above implies -why. + @todo = ('.') if @todo == 0; ## Where we'll start looking + + ## see if any user options were specified that weren't accounted for + foreach $opt (keys %user_opt) { + next if defined $seen_opt{$opt}; + warn "warning: -x$opt never considered.\n"; + } + + die "$0: multiple time constraints exclude all possible files.\n" + if ($NEWER && $OLDER) && ($NEWER > $OLDER); + + ## + ## Process any -skip/-iskip args that had been given + ## + local(@skip_test); + foreach $glob (keys %skip) { + $i = defined($iskip{$glob}) ? 'i': ''; + push(@skip_test, '$name =~ m/'. &glob_to_regex($glob). "/$i"); + } + if (@skip_test) { + $SKIP_TEST = join('||',@skip_test); + $DO_SKIP_TEST = 1; + } else { + $DO_SKIP_TEST = $SKIP_TEST = 0; + } + + ## + ## Process any -dskip/-idskip args that had been given + ## + local(@dskip_test); + foreach $glob (keys %dskip) { + $i = defined($idskip{$glob}) ? 'i': ''; + push(@dskip_test, '$name =~ m/'. &glob_to_regex($glob). "/$i"); + } + if (@dskip_test) { + $DSKIP_TEST = join('||',@dskip_test); + $DO_DSKIP_TEST = 1; + } else { + $DO_DSKIP_TEST = $DSKIP_TEST = 0; + } + + + ## + ## Process any -name, -path, -regex, etc. args that had been given. + ## + undef @name_test; + undef @dname_test; + foreach $key (keys %name) { + local($type, $pat) = split(/,/, $key, 2); + local($i) = defined($iname{$key}) ? 'i' : ''; + if ($type =~ /regex/) { + $pat =~ s/!/\\!/g; + $test = "\$name =~ m!^$pat\$!$i"; + } else { + local($var) = $type eq 'name' ? '$name' : '$file'; + $test = "$var =~ m/". &glob_to_regex($pat). "/$i"; + } + if ($type =~ m/^-i?d/) { + push(@dname_test, $test); + } else { + push(@name_test, $test); + } + } + if (@name_test) { + $GLOB_TESTS = join('||', @name_test); + + $DO_GLOB_TESTS = 1; + } else { + $GLOB_TESTS = $DO_GLOB_TESTS = 0; + } + if (@dname_test) { + $DGLOB_TESTS = join('||', @dname_test); + $DO_DGLOB_TESTS = 1; + } else { + $DGLOB_TESTS = $DO_DGLOB_TESTS = 0; + } + + + ## + ## Process any 'magic' things from the startup file. + ## + if (@magic_tests && $HEADER_BYTES) { + ## the $magic' one is for when &dodir is not inlined + $tests = join('||',@magic_tests); + $MAGIC_TESTS = " { package magic; \$val = ($tests) }"; + $DO_MAGIC_TESTS = 1; + } else { + $MAGIC_TESTS = 1; + $DO_MAGIC_TESTS = 0; + } + + ## + ## Prepare regular expressions. + ## + { + local(@regex_tests); + + if ($LIST_ONLY) { + $mflag = ''; + ## need to have $* set, but perl5 just won''t shut up about it. + if ($] >= 5) { + $mflag = 'm'; + } else { + eval ' $* = 1 '; + } + } + + ## + ## Until I figure out a better way to deal with it, + ## We have to worry about a regex like [^xyz] when doing $LIST_ONLY. + ## Such a regex *will* match \n, and if I'm pulling in multiple + ## lines, it can allow lines to match that would otherwise not match. + ## + ## Therefore, if there is a '[^' in a regex, we can NOT take a chance + ## an use the fast listonly. + ## + $CAN_USE_FAST_LISTONLY = $LIST_ONLY; + + local(@extra); + local($underline_glue) = ($] >= 5) ? '(:?_\cH)?' : '(_\cH)?'; + while (@ARGV) { + $regex = shift(@ARGV); + ## + ## If watching for underlined things too, add another regex. + ## + if ($underlineOK) { + if ($regex =~ m/[?*+{}()\\.|^\$[]/) { + warn "$0: warning, can't underline-safe ``$regex''.\n"; + } else { + $regex = join($underline_glue, split(//, $regex)); + } + } + + ## If nothing special in the regex, just use index... + ## is quite a bit faster. + if (($iflag eq '') && ($words == 0) && + $regex !~ m/[?*+{}()\\.|^\$[]/) + { + push(@regex_tests, "(index(\$_, q+$regex+)>=0)"); + + } else { + $regex =~ s#[\$\@\/]\w#\\$&#; + if ($words) { + if ($regex =~ m/\|/) { + ## could be dangerous -- see if we can wrap in parens. + if ($regex =~ m/\\\d/) { + warn "warning: -w and a | in a regex is dangerous.\n" + } else { + $regex = join($regex, '(', ')'); + } + } + $regex = join($regex, '\b', '\b'); + } + $CAN_USE_FAST_LISTONLY = 0 if substr($regex, "[^") >= 0; + push(@regex_tests, "m/$regex/$iflag$mflag"); + } + + ## If we're done, but still have @extra to do, get set for that. + if (@ARGV == 0 && @extra) { + @ARGV = @extra; ## now deal with the extra stuff. + $underlineOK = 0; ## but no more of this. + undef @extra; ## or this. + } + } + if (@regex_tests) { + $REGEX_TEST = join('||', @regex_tests); + ## print STDERR $REGEX_TEST, "\n"; exit; + } else { + ## must be doing -find -- just give something syntactically correct. + $REGEX_TEST = 1; + } + } + + ## + ## Make sure we can read the first item(s). + ## + foreach $start (@todo) { + $! = 2, die qq/$0: can't stat "$start"\n/ + unless ($dev,$inode) = (stat($start))[$STAT_DEV,$STAT_INODE]; + + if (defined $dir_done{"$dev,$inode"}) { + ## ignore the repeat. + warn(qq/ignoring "$start" (same as "$dir_done{"$dev,$inode"}").\n/) + if $VERBOSE; + next; + } + + ## if -xdev was given, remember the device. + $xdev{$dev} = 1 if $XDEV; + + ## Note that we won't want to do it again + $dir_done{"$dev,$inode"} = $start; + } +} + + +## +## See the comment above the __END__ above the 'sub dodir' below. +## +sub import_program +{ + sub bad { + print STDERR "$0: internal error (@_)\n"; + exit 2; + } + + ## Read from data, up to next __END__. This will be &dodir. + local($/) = "\n__END__"; + $prog = <DATA>; + close(DATA); + + $prog =~ s/\beval\b//g; ## remove any 'eval' + + ## Inline uppercase $-variables by their current values. + if ($] >= 5) { + $prog =~ s/\$([A-Z][A-Z0-9_]{2,}\b)/ + &bad($1) if !defined ${$main::{$1}}; ${$main::{$1}};/eg; + } else { + $prog =~ s/\$([A-Z][A-Z0-9_]{2,}\b)/local(*VAR) = $_main{$1}; + &bad($1) if !defined $VAR; $VAR;/eg; + } + + eval $prog; ## now do it. This will define &dodir; + $!=2, die "$0 internal error: $@\n" if $@; +} + +########################################################################### + +## +## Read the .search file: +## Blank lines and lines that are only #-comments ignored. +## Newlines may be escaped to create long lines +## Other lines are directives. +## +## A directive may begin with an optional tag in the form <...> +## Things inside the <...> are evaluated as with: +## <(this || that) && must> +## will be true if +## -xmust -xthis or -xmust -xthat +## were specified on the command line (order doesn't matter, though) +## A directive is not done if there is a tag and it's false. +## Any characters but whitespace and &|()>,! may appear after an -x +## (although "-xdev" is special). -xmust,this is the same as -xmust -xthis. +## Something like -x~ would make <~> true, and <!~> false. +## +## Directives are in the form: +## option: STRING +## magic : NUMBYTES : EXPR +## +## With option: +## The STRING is parsed like a Bourne shell command line, and the +## options are used as if given on the command line. +## No comments are allowed on 'option' lines. +## Examples: +## # skip objects and libraries +## option: -skip '.o .a' +## # skip emacs *~ and *# files, unless -x~ given: +## <!~> option: -skip '~ #' +## +## With magic: +## EXPR can be pretty much any perl (comments allowed!). +## If it evaluates to true for any particular file, it is skipped. +## The only info you'll have about a file is the variable $H, which +## will have at least the first NUMBYTES of the file (less if the file +## is shorter than that, of course, and maybe more). You'll also have +## any variables you set in previous 'magic' lines. +## Examples: +## magic: 6 : ($x6 = substr($H, 0, 6)) eq 'GIF87a' +## magic: 6 : $x6 eq 'GIF89a' +## +## magic: 6 : (($x6 = substr($H, 0, 6)) eq 'GIF87a' ## old gif \ +## || $x6 eq 'GIF89a' ## new gif +## (the above two sets are the same) +## ## Check the first 32 bytes for "binarish" looking bytes. +## ## Don't blindly dump on any high-bit set, as non-ASCII text +## ## often has them set. \x80 and \xff seem to be special, though. +## ## Require two in a row to not get things like perl's $^T. +## ## This is known to get *.Z, *.gz, pkzip, *.elc and about any +## ## executable you'll find. +## magic: 32 : $H =~ m/[\x00-\x06\x10-\x1a\x1c-\x1f\x80\xff]{2}/ +## +sub read_rc +{ + local($file, $show) = @_; + local($line_num, $ln, $tag) = 0; + local($use_default, @default) = 0; + + { package magic; $ = 0; } ## turn off warnings for when we run EXPR's + + unless (open(RC, "$file")) { + $use_default=1; + $file = "<internal default startup file>"; + ## no RC file -- use this default. + @default = split(/\n/,<<'--------INLINE_LITERAL_TEXT'); + magic: 32 : $H =~ m/[\x00-\x06\x10-\x1a\x1c-\x1f\x80\xff]{2}/ + option: -skip '.a .COM .elc .EXE .gz .o .pbm .xbm .dvi' + option: -iskip '.tarz .zip .z .lzh .jpg .jpeg .gif .uu' + <!~> option: -skip '~ #' +--------INLINE_LITERAL_TEXT + } + + ## + ## Make an eval error pretty. + ## + sub clean_eval_error { + local($_) = @_; + s/ in file \(eval\) at line \d+,//g; ## perl4-style error + s/ at \(eval \d+\) line \d+,//g; ## perl5-style error + $_ = $` if m/\n/; ## remove all but first line + "$_\n"; + } + + print "reading RC file: $file\n" if $show; + + while ($_ = ($use_default ? shift(@default) : <RC>)) { + $ln = ++$line_num; ## note starting line num. + $_ .= <RC>, $line_num++ while s/\\\n?$/\n/; ## allow continuations + next if /^\s*(#.*)?$/; ## skip blank or comment-only lines. + $do = ''; + + ## look for an initial <...> tag. + if (s/^\s*<([^>]*)>//) { + ## This simple s// will make the tag ready to eval. + ($tag = $msg = $1) =~ + s/[^\s&|(!)]+/ + $seen_opt{$&}=1; ## note seen option + "defined(\$opt{q>$&>})" ## (q>> is safe quoting here) + /eg; + + ## see if the tag is true or not, abort this line if not. + $dothis = (eval $tag); + $!=2, die "$file $ln <$msg>: $_".&clean_eval_error($@) if $@; + + if ($show) { + $msg =~ s/[^\s&|(!)]+/-x$&/; + $msg =~ s/\s*!\s*/ no /g; + $msg =~ s/\s*&&\s*/ and /g; + $msg =~ s/\s*\|\|\s*/ or /g; + $msg =~ s/^\s+//; $msg =~ s/\s+$//; + $do = $dothis ? "(doing because $msg)" : + "(do if $msg)"; + } elsif (!$dothis) { + next; + } + } + + if (m/^\s*option\s*:\s*/) { + next if $all && !$show; ## -all turns off these checks; + local($_) = $'; + s/\n$//; + local($orig) = $_; + print " $do option: $_\n" if $show; + local($0) = "$0 ($file)"; ## for any error message. + local(@ARGV); + local($this); + ## + ## Parse $_ as a Bourne shell line -- fill @ARGV + ## + while (length) { + if (s/^\s+//) { + push(@ARGV, $this) if defined $this; + undef $this; + next; + } + $this = '' if !defined $this; + $this .= $1 while s/^'([^']*)'// || + s/^"([^"]*)"// || + s/^([^'"\s\\]+)//|| + s/^(\\[\D\d])//; + die "$file $ln: error parsing $orig at $_\n" if m/^\S/; + } + push(@ARGV, $this) if defined $this; + &check_args; + die qq/$file $ln: unused arg "@ARGV".\n/ if @ARGV; + next; + } + + if (m/^\s*magic\s*:\s*(\d+)\s*:\s*/) { + next if $all && !$show; ## -all turns off these checks; + local($bytes, $check) = ($1, $'); + + if ($show) { + $check =~ s/\n?$/\n/; + print " $do contents: $check"; + } + ## Check to make sure the thing at least compiles. + eval "package magic; (\$H = '1'x \$main'bytes) && (\n$check\n)\n"; + $! = 2, die "$file $ln: ".&clean_eval_error($@) if $@; + + $HEADER_BYTES = $bytes if $bytes > $HEADER_BYTES; + push(@magic_tests, "(\n$check\n)"); + next; + } + $! = 2, die "$file $ln: unknown command\n"; + } + close(RC); +} + +sub message +{ + if (!$STDERR_IS_TTY) { + print STDERR $_[0], "\n"; + } else { + local($text) = @_; + $thislength = length($text); + if ($thislength >= $last_message_length) { + print STDERR $text, "\r"; + } else { + print STDERR $text, ' 'x ($last_message_length-$thislength),"\r"; + } + $last_message_length = $thislength; + } +} + +sub clear_message +{ + print STDERR ' ' x $last_message_length, "\r" if $last_message_length; + $vv_print = $vv_size = $last_message_length = 0; +} + +## +## Output a copy of this program with comments, extra whitespace, and +## the trailing man page removed. On an ultra slow machine, such a copy +## might load faster (but I can't tell any difference on my machine). +## +sub strip { + seek(DATA, 0, 0) || die "$0: can't reset internal pointer.\n"; + while(<DATA>) { + print, next if /INLINE_LITERAL_TEXT/.../INLINE_LITERAL_TEXT/; + ## must mention INLINE_LITERAL_TEXT on this line! + s/\#\#.*|^\s+|\s+$//; ## remove cruft + last if $_ eq '.00;'; + next if ($_ eq '') || ($_ eq "'di'") || ($_ eq "'ig00'"); + s/\$stripped=0;/\$stripped=1;/; + s/\s\s+/ /; ## squish multiple whitespaces down to one. + print $_, "\n"; + } + exit(0); +} + +## +## Just to shut up -w. Never executed. +## +sub dummy { + + 1 || &dummy || &dir_done || &bad || &message || $NEXT_DIR_ENTRY || + $DELAY || $VV_SIZE || $VV_PRINT_COUNT || $STDERR_SCREWS_STDOUT || + @files || @files || $magic'H || $magic'H || $xdev{''} || &clear_message; + +} + +## +## If the following __END__ is in place, what follows will be +## inlined when the program first starts up. Any $ variable name +## all in upper case, specifically, any string matching +## \$([A-Z][A-Z0-9_]{2,}\b +## will have the true value for that variable inlined. Also, any 'eval' is +## removed +## +## The idea is that when the whole thing is then eval'ed to define &dodir, +## the perl optimizer will make all the decisions that are based upon +## command-line options (such as $VERBOSE), since they'll be inlined as +## constants +## +## Also, and here's the big win, the tests for matching the regex, and a +## few others, are all inlined. Should be blinding speed here. +## +## See the read from <DATA> above for where all this takes place. +## But all-in-all, you *want* the __END__ here. Comment it out only for +## debugging.... +## + +__END__ + +## +## Given a directory, check all "appropriate" files in it. +## Shove any subdirectories into the global @todo, so they'll be done +## later. +## +## Be careful about adding any upper-case variables, as they are subject +## to being inlined. See comments above the __END__ above. +## +sub dodir +{ + local($dir) = @_; + $dir =~ s,/+$,,; ## remove any trailing slash. + unless (opendir(DIR, "$dir/.")) { + &clear_message if $VERBOSE && $STDERR_SCREWS_STDOUT; + warn qq($0: can't opendir "$dir/".\n); + return; + } + + if ($VERBOSE) { + &message($dir); + $vv_print = $vv_size = 0; + } + + @files = sort readdir(DIR) if $DO_SORT; + + while (defined($name = eval $NEXT_DIR_ENTRY)) + { + next if $name eq '.' || $name eq '..'; ## never follow these. + + ## create full relative pathname. + $file = $dir eq '.' ? $name : "$dir/$name"; + + ## if link and skipping them, do so. + if ($NOLINKS && -l $file) { + warn qq/skip (symlink): $file\n/ if $WHY; + next; + } + + ## skip things unless files or directories + unless (-f $file || -d _) { + if ($WHY) { + $why = (-S _ && "socket") || + (-p _ && "pipe") || + (-b _ && "block special")|| + (-c _ && "char special") || "somekinda special"; + warn qq/skip ($why): $file\n/; + } + next; + } + + ## skip things we can't read + unless (-r _) { + if ($WHY) { + $why = (-l $file) ? "follow" : "read"; + warn qq/skip (can't $why): $file\n/; + } + next; + } + + ## skip things that are empty + unless (-s _) { + warn qq/skip (empty): $file\n/ if $WHY; + next; + } + + ## Note file device & inode. If -xdev, skip if appropriate. + ($dev, $inode) = (stat(_))[$STAT_DEV, $STAT_INODE]; + if ($XDEV && defined $xdev{$dev}) { + warn qq/skip (other device): $file\n/ if $WHY; + next; + } + $id = "$dev,$inode"; + + ## special work for a directory + if (-d _) { + ## Do checks for directory file endings. + if ($DO_DSKIP_TEST && (eval $DSKIP_TEST)) { + warn qq/skip (-dskip): $file\n/ if $WHY; + next; + } + ## do checks for -name/-regex/-path tests + if ($DO_DGLOB_TESTS && !(eval $DGLOB_TESTS)) { + warn qq/skip (dirname): $file\n/ if $WHY; + next; + } + + ## _never_ redo a directory + if (defined $dir_done{$id}) { + warn qq/skip (did as "$dir_done{$id}"): $file\n/ if $WHY; + next; + } + $dir_done{$id} = $file; ## mark it done. + unshift(@todo, $file); ## add to the list to do. + next; + } + if ($WHY == 0 && $VERBOSE > 1) { + if ($VERBOSE>2||$vv_print++>$VV_PRINT_COUNT||($vv_size+=-s _)>$VV_SIZE){ + &message($file); + $vv_print = $vv_size = 0; + } + } + + ## do time-related tests + if ($NEWER || $OLDER) { + $_ = (stat(_))[$STAT_MTIME]; + if ($NEWER && $_ < $NEWER) { + warn qq/skip (too old): $file\n/ if $WHY; + next; + } + if ($OLDER && $_ > $OLDER) { + warn qq/skip (too new): $file\n/ if $WHY; + next; + } + } + + ## do checks for file endings + if ($DO_SKIP_TEST && (eval $SKIP_TEST)) { + warn qq/skip (-skip): $file\n/ if $WHY; + next; + } + + ## do checks for -name/-regex/-path tests + if ($DO_GLOB_TESTS && !(eval $GLOB_TESTS)) { + warn qq/skip (filename): $file\n/ if $WHY; + next; + } + + + ## If we're not repeating files, + ## skip this one if we've done it, or note we're doing it. + unless ($DOREP) { + if (defined $file_done{$id}) { + warn qq/skip (did as "$file_done{$id}"): $file\n/ if $WHY; + next; + } + $file_done{$id} = $file; + } + + if ($DO_MAGIC_TESTS) { + if (!open(FILE_IN, $file)) { + &clear_message if $VERBOSE && $STDERR_SCREWS_STDOUT; + warn qq/$0: can't open: $file\n/; + next; + } + unless (read(FILE_IN, $magic'H, $HEADER_BYTES)) { + &clear_message if $VERBOSE && $STDERR_SCREWS_STDOUT; + warn qq/$0: can't read from "$file"\n"/; + close(FILE_IN); + next; + } + + eval $MAGIC_TESTS; + if ($magic'val) { + close(FILE_IN); + warn qq/skip (magic): $file\n/ if $WHY; + next; + } + seek(FILE_IN, 0, 0); ## reset for later <FILE_IN> + } + + if ($WHY != 0 && $VERBOSE > 1) { + if ($VERBOSE>2||$vv_print++>$VV_PRINT_COUNT||($vv_size+=-s _)>$VV_SIZE){ + &message($file); + $vv_print = $vv_size = 0; + } + } + + if ($DELAY) { + sleep($DELAY); + } + + if ($FIND_ONLY) { + &clear_message if $VERBOSE && $STDERR_SCREWS_STDOUT; + print $file, "\n"; + $retval=0; ## we've found something + close(FILE_IN) if $DO_MAGIC_TESTS; + next; + } else { + ## if we weren't doing magic tests, file won't be open yet... + if (!$DO_MAGIC_TESTS && !open(FILE_IN, $file)) { + &clear_message if $VERBOSE && $STDERR_SCREWS_STDOUT; + warn qq/$0: can't open: $file\n/; + next; + } + if ($LIST_ONLY && $CAN_USE_FAST_LISTONLY) { + ## + ## This is rather complex, but buys us a LOT when we're just + ## listing files and not the individual internal lines. + ## + local($size) = 4096; ## block-size in which to do reads + local($nl); ## will point to $_'s ending newline. + local($read); ## will be how many bytes read. + local($_) = ''; ## Starts out empty + local($hold); ## (see below) + + while (($read = read(FILE_IN,$_,$size,length($_)))||length($_)) + { + undef @parts; + ## if read a full block, but no newline, need to read more. + while ($read == $size && ($nl = rindex($_, "\n")) < 0) { + push(@parts, $_); ## save that part + $read = read(FILE_IN, $_, $size); ## keep trying + } + + ## + ## If we had to save parts, must now combine them together. + ## adjusting $nl to reflect the now-larger $_. This should + ## be a lot more efficient than using any kind of .= in the + ## loop above. + ## + if (@parts) { + local($lastlen) = length($_); #only need if $nl >= 0 + $_ = join('', @parts, $_); + $nl = length($_) - ($lastlen - $nl) if $nl >= 0; + } + + ## + ## If we're at the end of the file, then we can use $_ as + ## is. Otherwise, we need to remove the final partial-line + ## and save it so that it'll be at the beginning of the + ## next read (where the rest of the line will be layed in + ## right after it). $hold will be what we should save + ## until next time. + ## + if ($read != $size || $nl < 0) { + $hold = ''; + } else { + $hold = substr($_, $nl + 1); + substr($_, $nl + 1) = ''; + } + + ## + ## Now have a bunch of full lines in $_. Use it. + ## + if (eval $REGEX_TEST) { + &clear_message if $VERBOSE && $STDERR_SCREWS_STDOUT; + print $file, "\n"; + $retval=0; ## we've found something + + last; + } + + ## Prepare for next read.... + $_ = $hold; + } + + } else { ## else not using faster block scanning..... + + $lines_printed = 0 if $NICE; + while (<FILE_IN>) { + study; + next unless (eval $REGEX_TEST); + + ## + ## We found a matching line. + ## + $retval=0; + &clear_message if $VERBOSE && $STDERR_SCREWS_STDOUT; + if ($LIST_ONLY) { + print $file, "\n"; + last; + } else { + ## prepare to print line. + if ($NICE && $lines_printed++ == 0) { + print '-' x 70, "\n" if $NICE > 1; + print $file, ":\n"; + } + + ## + ## Print all the prelim stuff. This looks less efficient + ## than it needs to be, but that's so that when the eval + ## is compiled (and the tests are optimized away), the + ## result will be less actual PRINTs than the more natural + ## way of doing these tests.... + ## + if ($NICE) { + if ($REPORT_LINENUM) { + print " line $.: "; + } else { + print " "; + } + } elsif ($REPORT_LINENUM && $PREPEND_FILENAME) { + print "$file,:$.: "; + } elsif ($PREPEND_FILENAME) { + print "$file: "; + } elsif ($REPORT_LINENUM) { + print "$.: "; + } + print $_; + print "\n" unless m/\n$/; + } + } + print "\n" if ($NICE > 1) && $lines_printed; + } + close(FILE_IN); + } + } + closedir(DIR); +} + +__END__ +.00; ## finish .ig + +'di \" finish diversion--previous line must be blank +.nr nl 0-1 \" fake up transition to first page again +.nr % 0 \" start at page 1 +.\"__________________NORMAL_MAN_PAGE_BELOW_________________ +.ll+10n +.TH search 1 "Dec 17, 1994" +.SH SEARCH +search \- search files (a'la grep) in a whole directory tree. +.SH SYNOPSIS +search [ grep-like and find-like options] [regex ....] +.SH DESCRIPTION +.I Search +is more or less a combo of 'find' and 'grep' (although the regular +expression flavor is that of the perl being used, which is closer to +egrep's than grep's). + +.I Search +does generally the same kind of thing that +.nf + find <blah blah> | xargs egrep <blah blah> +.fi +does, but is +.I much +more powerful and efficient (and intuitive, I think). + +This manual describes +.I search +as of version "941227.4". You can always find the latest version at +.nf + http://www.wg.omron.co.jp/~jfriedl/perl/index.html +.fi + +.SH "QUICK EXAMPLE" +Basic use is simple: +.nf + % search jeff +.fi +will search files in the current directory, and all sub directories, for +files that have "jeff" in them. The lines will be listed with the +containing file's name prepended. +.PP +If you list more than one regex, such as with +.nf + % search jeff Larry Randal+ 'Stoc?k' 'C.*son' +.fi +then a line containing any of the regexes will be listed. +This makes it effectively the same as +.nf + % search 'jeff|Larry|Randal+|Stoc?k|C.*son' +.fi +However, listing them separately is much more efficient (and is easier +to type). +.PP +Note that in the case of these examples, the +.B \-w +(list whole-words only) option would be useful. +.PP +Normally, various kinds of files are automatically removed from consideration. +If it has has a certain ending (such as ".tar", ".Z", ".o", .etc), or if +the beginning of the file looks like a binary, it'll be excluded. +You can control exactly how this works -- see below. One quick way to +override this is to use the +.B \-all +option, which means to consider all the files that would normally be +automatically excluded. +Or, if you're curious, you can use +.B \-why +to have notes about what files are skipped (and why) printed to stderr. + +.SH "BASIC OVERVIEW" +Normally, the search starts in the current directory, considering files in +all subdirectories. + +You can use the +.I ~/.search +file to control ways to automatically exclude files. +If you don't have this file, a default one will kick in, which automatically +add +.nf + -skip .o .Z .gif +.fi +(among others) to exclude those kinds of files (which you probably want to +skip when searching for text, as is normal). +Files that look to be be binary will also be excluded. + +Files ending with "#" and "~" will also be excluded unless the +.B -x~ +option is given. + +You can use +.B -showrc +to show what kinds of files will normally be skipped. +See the section on the startup file +for more info. + +You can use the +.B -all +option to indicate you want to consider all files that would otherwise be +skipped by the startup file. + +Based upon various other flags (see "WHICH FILES TO CONSIDER" below), +more files might be removed from consideration. For example +.nf + -mtime 3 +.fi +will exclude files that aren't at least three days old (change the 3 to -3 +to exclude files that are more than three days old), while +.nf + -skip .* +.fi +would exclude any file beginning with a dot (of course, '.' and '..' are +special and always excluded). + +If you'd like to see what files are being excluded, and why, you can get the +list via the +.B \-why +option. + +If a file makes it past all the checks, it is then "considered". +This usually means it is greped for the regular expressions you gave +on the command line. + +If any of the regexes match a line, the line is printed. +However, if +.B -list +is given, just the filename is printed. Or, if +.B -nice +is given, a somewhat more (human-)readable output is generated. + +If you're searching a huge tree and want to keep informed about how +the search is progressing, +.B -v +will print (to stderr) the current directory being searched. +Using +.B -vv +will also print the current file "every so often", which could be useful +if a directory is huge. Using +.B -vvv +will print the update with every file. + +Below is the full listing of options. + +.SH "OPTIONS TELLING *WHERE* TO SEARCH" +.TP +.BI -dir " DIR" +Start searching at the named directory instead of the current directory. +If multiple +.B -dir +arguments are given, multiple trees will be searched. +.TP +.BI -ddir " DIR" +Like +.B -dir +except it flushes any previous +.B -dir +directories (i.e. "-dir A -dir B -dir C" will search A, B, and C, while +"-dir A -ddir B -dir C" will search only B and C. This might be of use +in the startup file (see that section below). +.TP +.B -xdev +Stay on the same filesystem as the starting directory/directories. +.TP +.B -sort +Sort the items in a directory before processing them. +Normally they are processed in whatever order they happen to be read from +the directory. +.TP +.B -nolinks +Don't follow symbolic links. Normally they're followed. + +.SH "OPTIONS CONTROLLING WHICH FILES TO CONSIDER AND EXCLUDE" +.TP +.BI -mtime " NUM" +Only consider files that were last changed more than +.I NUM +days ago +(less than +.I NUM +days if +.I NUM +has '-' prepended, i.e. "-mtime -2.5" means to consider files that +have been changed in the last two and a half days). +.TP +.B -older FILE +Only consider files that have not changed since +.I FILE +was last changed. +If there is any upper case in the "-older", "or equal" is added to the sense +of the test. Therefore, "search -older ./file regex" will never consider +"./file", while "search -Older ./file regex" will. + +If a file is a symbolic link, the time used is that of the file and not the +link. +.TP +.BI -newer " FILE" +Opposite of +.BR -older . +.TP +.BI -name " GLOB" +Only consider files that match the shell filename pattern +.IR GLOB . +The check is only done on a file's name (use +.B -path +to check the whole path, and use +.B -dname +to check directory names). + +Multiple specifications can be given by separating them with spaces, a'la +.nf + -name '*.c *.h' +.fi +to consider C source and header files. +If +.I GLOB +doesn't contain any special pattern characters, a '*' is prepended. +This last example could have been given as +.nf + -name '.c .h' +.fi +It could also be given as +.nf + -name .c -name .h +.fi +or +.nf + -name '*.c' -name '*.h' +.fi +or +.nf + -name '*.[ch]' +.fi +(among others) +but in this last case, you have to be sure to supply the leading '*'. +.TP +.BI -path " GLOB" +Like +.B -name +except the entire path is checked against the pattern. +.TP +.B -regex " REGEX" +Considers files whose names (not paths) match the given perl regex +exactly. +.TP +.BI -iname " GLOB" +Case-insensitive version of +.BR -name . +.TP +.BI -ipath " GLOB" +Case-insensitive version of +.BR -path . +.TP +.BI -iregex " REGEX" +Case-insensitive version of +.BR -regex . + +.TP +.BI -dpath " GLOB" +Only search down directories whose path matches the given pattern (this +doesn't apply to the initial directory given by +.BI -dir , +of course). +Something like +.nf + -dir /usr/man -dpath /usr/man/man* +.fi +would completely skip +"/usr/man/cat1", "/usr/man/cat2", etc. +.TP +.BI -dskip " GLOB" +Skips directories whose name (not path) matches the given pattern. +Something like +.nf + -dir /usr/man -dskip cat* +.fi +would completely skip any directory in the tree whose name begins with "cat" +(including "/usr/man/cat1", "/usr/man/cat2", etc.). +.TP +.BI -dregex " REGEX" +Like +.BI -dpath , +but the pattern is a full perl regex. Note that this quite different +from +.B -regex +which considers only file names (not paths). This option considers +full directory paths (not just names). It's much more useful this way. +Sorry if it's confusing. +.TP +.BI -dpath " GLOB" +This option exists, but is probably not very useful. It probably wants to +be like the '-below' or something I mention in the "TODO" section. +.TP +.BI -idpath " GLOB" +Case-insensitive version of +.BR -dpath . +.TP +.BI -idskip " GLOB" +Case-insensitive version of +.BR -dskip . +.TP +.BI -idregex " REGEX" +Case-insensitive version of +.BR -dregex . +.TP +.B -all +Ignore any 'magic' or 'option' lines in the startup file. +The effect is that all files that would otherwise be automatically +excluded are considered. +.TP +.BI -x SPECIAL +Arguments starting with +.B -x +(except +.BR -xdev , +explained elsewhere) do special interaction with the +.I ~/.search +startup file. Something like +.nf + -xflag1 -xflag2 +.fi +will turn on "flag1" and "flag2" in the startup file (and is +the same as "-xflag1,flag2"). You can use this to write your own +rules for what kinds of files are to be considered. + +For example, the internal-default startup file contains the line +.nf + <!~> option: -skip '~ #' +.fi +This means that if the +.B -x~ +flag is +.I not +seen, the option +.nf + -skip '~ #' +.fi +should be done. +The effect is that emacs temp and backup files are not normally +considered, but you can included them with the -x~ flag. + +You can write your own rules to customize +.I search +in powerful ways. See the STARTUP FILE section below. +.TP +.B -why +Print a message (to stderr) when and why a file is not considered. + +.SH "OPTIONS TELLING WHAT TO DO WITH FILES THAT WILL BE CONSIDERED" +.TP +.B -find +(you can use +.B -f +as well). +This option changes the basic action of +.IR search . + +Normally, if a file is considered, it is searched +for the regular expressions as described earlier. However, if this option +is given, the filename is printed and no searching takes place. This turns +.I search +into a 'find' of some sorts. + +In this case, no regular expressions are needed on the command line +(any that are there are silently ignored). + +This is not intended to be a replacement for the 'find' program, +but to aid +you in understanding just what files are getting past the exclusion checks. +If you really want to use it as a sort of replacement for the 'find' program, +you might want to use +.B -all +so that it doesn't waste time checking to see if the file is binary, etc +(unless you really want that, of course). + +If you use +.BR -find , +none of the "GREP-LIKE OPTIONS" (below) matter. + +As a replacement for 'find', +.I search +is probably a bit slower (or in the case of GNU find, a lot slower -- +GNU find is +.I unbelievably +fast). +However, "search -ffind" +might be more useful than 'find' when options such as +.B -skip +are used (at least until 'find' gets such functionality). +.TP +.B -ffind +(or +.BR -ff ) +A faster more 'find'-like find. Does +.nf + -find -all -dorep +.fi +.SH "GREP-LIKE OPTIONS" +These options control how a searched file is accessed, +and how things are printed. +.TP +.B -i +Ignore letter case when matching. +.TP +.B -w +Consider only whole-word matches ("whole word" as defined by perl's "\\b" +regex). +.TP +.B -u +If the regex(es) is/are simple, try to modify them so that they'll work +in manpage-like underlined text (i.e. like _^Ht_^Hh_^Hi_^Hs). +This is very rudimentary at the moment. +.TP +.B -list +(you can use +.B -l +too). +Don't print matching lines, but the names of files that contain matching +lines. This will likely be *much* faster, as special optimizations are +made -- particularly with large files. +.TP +.B -n +Pepfix each line by its line number. +.TP +.B -nice +Not a grep-like option, but similar to +.BR -list , +so included here. +.B -nice +will have the output be a bit more human-readable, with matching lines printed +slightly indented after the filename, a'la +.nf + + % search foo + somedir/somefile: line with foo in it + somedir/somefile: some food for thought + anotherdir/x: don't be a buffoon! + % + +.fi +will become +.nf + + % search -nice foo + somedir/somefile: + line with foo in it + some food for thought + anotherdir/x: + don't be a buffoon! + % + +.fi +This option due to Lionel Cons. +.TP +.B -nnice +Be a bit nicer than +.BR -nice . +Prefix each file's output by a rule line, and follow with an extra blank line. +.TP +.B -h +Don't prepend each output line with the name of the file +(meaningless when +.B -find +or +.B -l +are given). + +.SH "OTHER OPTIONS" +.TP +.B -help +Print the usage information. +.TP +.B -version +Print the version information and quit. +.TP +.B -v +Set the level of message verbosity. +.B -v +will print a note whenever a new directory is entered. +.B -vv +will also print a note "every so often". This can be useful to see +what's happening when searching huge directories. +.B -vvv +will print a new with every file. +.B -vvvv +is +-vvv +plus +.BR -why . +.TP +.B -e +This ends the options, and can be useful if the regex begins with '-'. +.TP +.B -showrc +Shows what is being considered in the startup file, then exits. +.TP +.B -dorep +Normally, an identical file won't be checked twice (even with multiple +hard or symbolic links). If you're just trying to do a fast +.BR -find , +the bookkeeping to remember which files have been seen is not desirable, +so you can eliminate the bookkeeping with this flag. + +.SH "STARTUP FILE" +When +.I search +starts up, it processes the directives in +.IR ~/.search . +If no such file exists, a default +internal version is used. + +The internal version looks like: +.nf + + magic: 32 : $H =~ m/[\ex00-\ex06\ex10-\ex1a\ex1c-\ex1f\ex80\exff]{2}/ + option: -skip '.a .COM .elc .EXE .gz .o .pbm .xbm .dvi' + option: -iskip '.tarz .zip .z .lzh .jpg .jpeg .gif .uu' + <!~> option: -skip '~ #' + +.fi +If you wish to create your own "~/.search", +you might consider copying the above, and then working from there. + +There are two kinds of directives in a startup file: "magic" and "option". +.RS 0n +.TP +OPTION +Option lines will automatically do the command-line options given. +For example, the line +.nf + option: -v +.fi +in you startup file will turn on -v every time, without needing to type it +on the command line. + +The text on the line after the "option:" directive is processed +like the Bourne shell, so make sure to pay attention to quoting. +.nf + option: -skip .exe .com +.fi +will give an error (".com" by itself isn't a valid option), while +.nf + option: -skip ".exe .com" +.fi +will properly include it as part of -skip's argument. + +.TP +MAGIC +Magic lines are used to determine if a file should be considered a binary +or not (the term "magic" refers to checking a file's magic number). These +are described in more detail below. +.RE + +Blank lines and comments (lines beginning with '#') are allowed. + +If a line begins with <...>, then it's a check to see if the +directive on the line should be done or not. The stuff inside the <...> +can contain perl's && (and), || (or), ! (not), and parens for grouping, +along with "flags" that might be indicated by the user with +.BI -x flag +options. + +For example, using "-xfoo" will cause "foo" to be true inside the <...> +blocks. Therefore, a line beginning with "<foo>" would be done only when +"-xfoo" had been specified, while a line beginning with "<!foo>" would be +done only when "-xfoo" is not specified (of course, a line without any <...> +is done in either case). + +A realistic example might be +.nf + <!v> -vv +.fi +This will cause -vv messages to be the default, but allow "-xv" to override. + +There are a few flags that are set automatically: +.RS +.TP +.B TTY +true if the output is to the screen (as opposed to being redirected to a file). +You can force this (as with all the other automatic flags) with -xTTY. +.TP +.B -v +True if -v was specified. If -vv was specified, both +.B -v +and +.B -vv +flags are true (and so on). +.TP +.B -nice +True if -nice was specified. Same thing about -nnice as for -vv. +.PP +.TP +.B -list +true if -list (or -l) was given. +.TP +.B -dir +true if -dir was given. +.RE + +Using this info, you might change the last example to +.nf + + <!v && !-v> option: -vv + +.fi +The added "&& !-v" means "and if the '-v' option not given". +This will allow you to use "-v" alone on the command line, and not +have this directive add the more verbose "-vv" automatically. + +.RS 0 +Some other examples: +.TP +<!-dir && !here> option: -dir ~/ +Effectively make the default directory your home directory (instead of the +current directory). Using -dir or -xhere will undo this. +.TP +<tex> option: -name .tex -dir ~/pub +Create '-xtex' to search only "*.tex" files in your ~/pub directory tree. +Actually, this could be made a bit better. If you combine '-xtex' and '-dir' +on the command line, this directive will add ~/pub to the list, when you +probably want to use the -dir directory only. You could do +.nf + + <tex> option: -name .tex + <tex && !-dir> option: -dir ~/pub +.fi + +to will allow '-xtex' to work as before, but allow a command-line "-dir" +to take precedence with respect to ~/pub. +.TP +<fluff> option: -nnice -sort -i -vvv +Combine a few user-friendly options into one '-xfluff' option. +.TP +<man> option: -ddir /usr/man -v -w +When the '-xman' option is given, search "/usr/man" for whole-words +(of whatever regex or regexes are given on the command line), with -v. +.RE + +The lines in the startup file are executed from top to bottom, so something +like +.nf + + <both> option: -xflag1 -xflag2 + <flag1> option: ...whatever... + <flag2> option: ...whatever... + +.fi +will allow '-xboth' to be the same as '-xflag1 -xflag2' (or '-xflag1,flag2' +for that matter). However, if you put the "<both>" line below the others, +they will not be true when encountered, so the result would be different +(and probably undesired). + +The "magic" directives are used to determine if a file looks to be binary +or not. The form of a magic line is +.nf + magic: \fISIZE\fP : \fIPERLCODE\fP +.fi +where +.I SIZE +is the number of bytes of the file you need to check, and +.I PERLCODE +is the code to do the check. Within +.IR PERLCODE , +the variable $H will hold at least the first +.I SIZE +bytes of the file (unless the file is shorter than that, of course). +It might hold more bytes. The perl should evaluate to true if the file +should be considered a binary. + +An example might be +.nf + magic: 6 : substr($H, 0, 6) eq 'GIF87a' +.fi +to test for a GIF ("-iskip .gif" is better, but this might be useful +if you have images in files without the ".gif" extension). + +Since the startup file is checked from top to bottom, you can be a bit +efficient: +.nf + magic: 6 : ($x6 = substr($H, 0, 6)) eq 'GIF87a' + magic: 6 : $x6 eq 'GIF89a' +.fi +You could also write the same thing as +.nf + magic: 6 : (($x6 = substr($H, 0, 6)) eq 'GIF87a') || ## an old gif, or.. \e + $x6 eq 'GIF89a' ## .. a new one. +.fi +since newlines may be escaped. + +The default internal startup file includes +.nf + magic: 32 : $H =~ m/[\ex00-\ex06\ex10-\ex1a\ex1c-\ex1f\ex80\exff]{2}/ +.fi +which checks for certain non-printable characters, and catches a large +number of binary files, including most system's executables, linkable +objects, compressed, tarred, and otherwise folded, spindled, and mutilated +files. + +Another example might be +.nf + ## an archive library + magic: 17 : substr($H, 0, 17) eq "!<arch>\en__.SYMDEF" +.fi + +.SH "RETURN VALUE" +.I Search +returns zero if lines (or files, if appropriate) were found, +or if no work was requested (such as with +.BR -help ). +Returns 1 if no lines (or files) were found. +Returns 2 on error. + +.SH TODO +Things I'd like to add some day: +.nf + + show surrounding lines (context). + + highlight matched portions of lines. + + add '-and', which can go between regexes to override + the default logical or of the regexes. + + add something like + -below GLOB + which will examine a tree and only consider files that + lie in a directory deeper than one named by the pattern. + + add 'warning' and 'error' directives. + + add 'help' directive. +.fi +.SH BUGS +If -xdev and multiple -dir arguments are given, any file in any of the +target filesystems are allowed. It would be better to allow each filesystem +for each separate tree. + +Multiple -dir args might also cause some confusing effects. Doing +.nf + -dir some/dir -dir other +.fi +will search "some/dir" completely, then search "other" completely. This +is good. However, something like +.nf + -dir some/dir -dir some/dir/more/specific +.fi +will search "some/dir" completely *except for* "some/dir/more/specific", +after which it will return and be searched. Not really a bug, but just sort +of odd. + +File times (for -newer, etc.) of symbolic links are for the file, not the +link. This could cause some misunderstandings. + +Probably more. Please let me know. +.SH AUTHOR +Jeffrey Friedl, Omron Corp (jfriedl@omron.co.jp) +.br +http://www.wg.omron.co.jp/cgi-bin/j-e/jfriedl.html + +.SH "LATEST SOURCE" +See http://www.wg.omron.co.jp/~jfriedl/perl/index.html +__END__ +:endofperl diff --git a/win32/bin/test.bat b/win32/bin/test.bat new file mode 100644 index 0000000000..e6b7b38160 --- /dev/null +++ b/win32/bin/test.bat @@ -0,0 +1,143 @@ +@rem = ' +@echo off +if exist perl.exe goto perlhere +echo Cannot run without perl.exe in current directory!! Did you build it? +pause +goto endofperl +:perlhere +if exist perlglob.exe goto perlglobhere +echo Cannot run without perlglob.exe in current directory!! Did you build it? +pause +goto endofperl +:perlglobhere +perl %0.bat %1 %2 %3 %4 %5 %6 %7 %8 %9 +goto endofperl +@rem '; + +#Portions (C) 1995 Microsoft Corporation. All rights reserved. +# Developed by hip communications inc., http://info.hip.com/info/ + + +# This is written in a peculiar style, since we're trying to avoid +# most of the constructs we'll be testing for. + +$| = 1; + +if ($ARGV[0] eq '-v') { + $verbose = 1; + shift; +} + + +# WYT 1995-05-02 +chdir 't' if -f 't/TESTNT'; + + +if ($ARGV[0] eq '') { +# @ARGV = split(/[ \n]/, +# `echo base/*.t comp/*.t cmd/*.t io/*.t; echo op/*.t lib/*.t`); +# `ls base/*.t comp/*.t cmd/*.t io/*.t op/*.t lib/*.t`); + +# WYT 1995-05-02 wildcard expansion, +# `perl -e "print( join( ' ', \@ARGV ) )" base/*.t comp/*.t cmd/*.t io/*.t op/*.t lib/*.t nt/*.t`); + +# WYT 1995-06-01 removed all dependency on perlglob +# WYT 1995-11-28 hacked up to cope with braindead Win95 console. + push( @ARGV, `dir/s/b base` ); + push( @ARGV, `dir/s/b comp` ); + push( @ARGV, `dir/s/b cmd` ); + push( @ARGV, `dir/s/b io` ); + push( @ARGV, `dir/s/b op` ); + push( @ARGV, `dir/s/b lib` ); + push( @ARGV, `dir/s/b nt` ); + + grep( chomp, @ARGV ); + @ARGV = grep( /\.t$/, @ARGV ); + grep( s/.*t\\//, @ARGV ); +} + +$sharpbang = 0; + +$bad = 0; +$good = 0; +$total = @ARGV; +while ($test = shift) { + if ($test =~ /^$/) { + next; + } + $te = $test; +# chop off 't' extension + chop($te); + print "$te" . '.' x (15 - length($te)); + if ($sharpbang) { + open(results,"./$test |") || (print "can't run.\n"); + } else { + $switch = ''; +# open(results,"./perl$switch $test |") || (print "can't run.\n"); + open(results,"perl$switch $test |") || (print "can't run.\n"); + } + $ok = 0; + $next = 0; + while (<results>) { + if ($verbose) { + print $_; + } + unless (/^#/||/^$/) { + if (/^1\.\.([0-9]+)/) { + $max = $1; + $totmax += $max; + $files += 1; + $next = 1; + $ok = 1; + } else { + $next = $1, $ok = 0, last if /^not ok ([0-9]*)/; + if (/^ok (.*)/ && $1 == $next) { + $next = $next + 1; + } else { + $ok = 0; + } + } + } + } + $next = $next - 1; + if ($ok && $next == $max) { + print "ok\n"; + $good = $good + 1; + } else { + $next += 1; + print "FAILED on test $next\n"; + $bad = $bad + 1; + $_ = $test; + if (/^base/) { + die "Failed a basic test--cannot continue.\n"; + } + } +} + +if ($bad == 0) { + if ($ok) { + print "All tests successful.\n"; + } else { + die "FAILED--no tests were run for some reason.\n"; + } +} else { + $pct = sprintf("%.2f", $good / $total * 100); + if ($bad == 1) { + warn "Failed 1 test, $pct% okay.\n"; + } else { + die "Failed $bad/$total tests, $pct% okay.\n"; + } +} + + +# WYT 1995-05-03 times not implemented. +#($user,$sys,$cuser,$csys) = times; +#print sprintf("u=%g s=%g cu=%g cs=%g files=%d tests=%d\n", +# $user,$sys,$cuser,$csys,$files,$totmax); + +#`del /f Cmd_while.tmp Comp.try null 2>NULL`; + +unlink 'Cmd_while.tmp', 'Comp.try', 'null'; + +__END__ +:endofperl diff --git a/win32/bin/webget.bat b/win32/bin/webget.bat new file mode 100644 index 0000000000..e77bb88ced --- /dev/null +++ b/win32/bin/webget.bat @@ -0,0 +1,1099 @@ +@rem = '--*-Perl-*--'; +@rem = ' +@echo off +perl -S %0.bat %1 %2 %3 %4 %5 %6 %7 %8 %9 +goto endofperl +@rem '; +#!/usr/local/bin/perl -w + +#- +#!/usr/local/bin/perl -w +$version = "951121.18"; +$comments = 'jfriedl@omron.co.jp'; + +## +## This is "webget" +## +## Jeffrey Friedl (jfriedl@omron.co.jp), July 1994. +## Copyright 19.... ah hell, just take it. +## Should work with either perl4 or perl5 +## +## BLURB: +## Given a URL on the command line (HTTP and FTP supported at the moment), +## webget fetches the named object (HTML text, images, audio, whatever the +## object happens to be). Will automatically use a proxy if one is defined +## in the environment, follow "this URL has moved" responses, and retry +## "can't find host" responses from a proxy in case host lookup was slow). +## Supports users & passwords (FTP), Basic Authorization (HTTP), update-if- +## modified (HTTP), and much more. Works with perl4 or perl5. + +## +## More-detailed instructions in the comment block below the history list. +## + +## +## To-do: +## Add gopher support. +## Fix up how error messages are passed among this and the libraries. +## + +## 951219.19 +## Lost ftp connections now die with a bit more grace. +## +## 951121.18 +## Add -nnab. +## Brought the "usage" string in line with reality. +## +## 951114.17 +## Added -head. +## Added -update/-refresh/-IfNewerThan. If any URL was not pulled +## because it was not out of date, an exit value of 2 is returned. +## +## 951031.16 +## Added -timeout. Cleaned up (a bit) the exit value. Now exits +## with 1 if all URLs had some error (timeout exits immediately with +## code 3, though. This is subject to change). Exits with 0 if any +## URL was brought over safely. +## +## 951017.15 +## Neat -pf, -postfile idea from Lorrie Cranor +## (http://www.ccrc.wustl.edu/~lorracks/) +## +## 950912.14 +## Sigh, fixed a typo. +## +## 950911.13 +## Added Basic Authorization support for http. See "PASSWORDS AND STUFF" +## in the documentation. +## +## 950911.12 +## Implemented a most-excellent suggestion by Anthony D'Atri +## (aad@nwnet.net), to be able to automatically grab to a local file of +## the same name as the URL. See the '-nab' flag. +## +## 950706.11 +## Quelled small -w warning (thanks: Lars Rasmussen <gnort@daimi.aau.dk>) +## +## 950630.10 +## Steve Campbell to the rescue again. FTP now works when supplied +## with a userid & password (eg ftp://user:pass@foo.bar.com/index.txt). +## +## 950623.9 +## Incorporated changes from Steve Campbell (steven_campbell@uk.ibm.com) +## so that the ftp will work when no password is required of a user. +## +## 950530.8 +## Minor changes: +## Eliminate read-size warning message when size unknown. +## Pseudo-debug/warning messages at the end of debug_read now go to +## stderr. Some better error handling when trying to contact systems +## that aren't really set up for ftp. Fixed a bug concerning FTP access +## to a root directory. Added proxy documentation at head of file. +## +## 950426.6,7 +## Complete Overhaul: +## Renamed from httpget. Added ftp support (very sketchy at the moment). +## Redid to work with new 'www.pl' library; chucked 'Www.pl' library. +## More or less new and/or improved in many ways, but probably introduced +## a few bugs along the way. +## +## 941227.5 +## Added follow stuff (with -nofollow, etc.) +## Added -updateme. Cool! +## Some general tidying up. +## +## 941107.4 +## Allowed for ^M ending a header line... PCs give those kind of headers. +## +## 940820.3 +## First sorta'clean net release. +## +## + +## +##> +## +## Fetch http and/or ftp URL(s) given on the command line and spit to +## STDOUT. +## +## Options include: +## -V, -version +## Print version information; exit. +## +## -p, -post +## If the URL looks like a reply to a form (i.e. has a '?' in it), +## the request is POST'ed instead of GET'ed. +## +## -head +## Gets the header only (for HTTP). This might include such useful +## things as 'Last-modified' and 'Content-length' fields +## (a lack of a 'Last-modified' might be a good indication that it's +## a CGI). +## +## The "-head" option implies "-nostrip", but does *not* imply, +## for example "-nofollow". +## +## +## -pf, -postfile +## The item after the '?' is taken as a local filename, and the contents +## are POST'ed as with -post +## +## -nab, -f, -file +## Rather than spit the URL(s) to standard output, unconditionally +## dump to a file (or files) whose name is that as used in the URL, +## sans path. I like '-nab', but supply '-file' as well since that's +## what was originally suggested. Also see '-update' below for the +## only-if-changed version. +## +## -nnab +## Like -nab, but in addtion to dumping to a file, dump to stdout as well. +## Sort of like the 'tee' command. +## +## -update, -refresh +## Do the same thing as -nab, etc., but does not bother pulling the +## URL if it older than the localfile. Only applies to HTTP. +## Uses the HTTP "If-Modified-Since" field. If the URL was not modified +## (and hence not changed), the return value is '2'. +## +## -IfNewerThan FILE +## -int FILE +## Only pulls URLs if they are newer than the date the local FILE was +## last written. +## +## -q, -quiet +## Suppresses all non-essential informational messages. +## +## -nf, -nofollow +## Normally, a "this URL has moved" HTTP response is automatically +## followed. Not done with -nofollow. +## +## -nr, -noretry +## Normally, an HTTP proxy response of "can't find host" is retried +## up to three times, to give the remote hostname lookup time to +## come back with an answer. This suppresses the retries. This is the +## same as '-retry 0'. +## +## -r#, -retry#, -r #, -retry # +## Sets the number of times to retry. Default 3. +## +## -ns, -nostrip +## For HTTP items (including other items going through an HTTP proxy), +## the HTTP response header is printed rather than stripped as default. +## +## -np, -noproxy +## A proxy is not used, even if defined for the protocol. +## +## -h, -help +## Show a usage message and exit. +## +## -d, -debug +## Show some debugging messages. +## +## -updateme +## The special and rather cool flag "-updateme" will see if webget has +## been updated since you got your version, and prepare a local +## version of the new version for you to use. Keep updated! (although +## you can always ask to be put on the ping list to be notified when +## there's a new version -- see the author's perl web page). +## +## -timeout TIMESPAN +## -to TIMESPAN +## Time out if a connection can not be made within the specified time +## period. TIMESPAN is normally in seconds, although a 'm' or 'h' may +## be appended to indicate minutes and hours. "-to 1.5m" would timeout +## after 90 seconds. +## +## (At least for now), a timeout causes immediate program death (with +## exit value 3). For some reason, the alarm doesn't always cause a +## waiting read or connect to abort, so I just die immediately.. /-: +## +## I might consider adding an "entire fetch" timeout, if someone +## wants it. +## +## PASSWORDS AND SUCH +## +## You can use webget to do FTP fetches from non-Anonymous systems and +## accounts. Just put the required username and password into the URL, +## as with +## webget 'ftp:/user:password@ftp.somesite.com/pub/pix/babe.gif +## ^^^^^^^^^^^^^ +## Note the user:password is separated from the hostname by a '@'. +## +## You can use the same kind of thing with HTTP, and if so it will provide +## what's know as Basic Authorization. This is >weak< authorization. It +## also provides >zero< security -- I wouldn't be sending any credit-card +## numbers this way (unless you send them 'round my way :-). It seems to +## be used most by providers of free stuff where they want to make some +## attempt to limit access to "known users". +## +## PROXY STUFF +## +## If you need to go through a gateway to get out to the whole internet, +## you can use a proxy if one's been set up on the gateway. This is done +## by setting the "http_proxy" environmental variable to point to the +## proxy server. Other variables are used for other target protocols.... +## "gopher_proxy", "ftp_proxy", "wais_proxy", etc. +## +## For example, I have the following in my ".login" file (for use with csh): +## +## setenv http_proxy http://local.gateway.machine:8080/ +## +## This is to indicate that any http URL should go to local.gateway.machine +## (port 8080) via HTTP. Additionally, I have +## +## setenv gopher_proxy "$http_proxy" +## setenv wais_proxy "$http_proxy" +## setenv ftp_proxy "$http_proxy" +## +## This means that any gopher, wais, or ftp URL should also go to the +## same place, also via HTTP. This allows webget to get, for example, +## GOPHER URLs even though it doesn't support GOPHER itself. It uses HTTP +## to talk to the proxy, which then uses GOPHER to talk to the destination. +## +## Finally, if there are sites inside your gateway that you would like to +## connect to, you can list them in the "no_proxy" variable. This will allow +## you to connect to them directly and skip going through the proxy: +## +## setenv no_proxy "www.this,www.that,www.other" +## +## I (jfriedl@omron.co.jp) have little personal experience with proxies +## except what I deal with here at Omron, so if this is not representative +## of your situation, please let me know. +## +## RETURN VALUE +## The value returned to the system by webget is rather screwed up because +## I didn't think about dealing with it until things were already +## complicated. Since there can be more than one URL on the command line, +## it's hard to decide what to return when one times out, another is fetched, +## another doesn't need to be fetched, and a fourth isn't found. +## +## So, here's the current status: +## +## Upon any timeout (via the -timeout arg), webget immediately +## returns 3. End of story. Otherwise.... +## +## If any URL was fetched with a date limit (i.e. via +## '-update/-refresh/-IfNewerThan' and was found to not have changed, +## 2 is returned. Otherwise.... +## +## If any URL was successfully fetched, 0 is returned. Otherwise... +## +## If there were any errors, 1 is returned. Otherwise... +## +## Must have been an info-only or do-nothing instance. 0 is returned. +## +## Phew. Hopefully useful to someone. +##< +## + +## Where latest version should be. +$WEB_normal = 'http://www.wg.omron.co.jp/~jfriedl/perl/webget'; +$WEB_inlined = 'http://www.wg.omron.co.jp/~jfriedl/perl/inlined/webget'; + + +require 'network.pl'; ## inline if possible (directive to a tool of mine) +require 'www.pl'; ## inline if possible (directive to a tool of mine) +$inlined=0; ## this might be changed by a the inline thing. + +## +## Exit values. All screwed up. +## +$EXIT_ok = 0; +$EXIT_error = 1; +$EXIT_notmodified = 2; +$EXIT_timeout = 3; + +## +## + +warn qq/WARNING:\n$0: need a newer version of "network.pl"\n/ if + !defined($network'version) || $network'version < "950311.5"; +warn qq/WARNING:\n$0: need a newer version of "www.pl"\n/ if + !defined($www'version) || $www'version < "951114.8"; + +$WEB = $inlined ? $WEB_inlined : $WEB_normal; + +$debug = 0; +$strip = 1; ## default is to strip +$quiet = 0; ## also normally off. +$follow = 1; ## normally, we follow "Found (302)" links +$retry = 3; ## normally, retry proxy hostname lookups up to 3 times. +$nab = 0; ## If true, grab to a local file of the same name. +$refresh = 0; ## If true, use 'If-Modified-Since' with -nab get. +$postfile = 0; ## If true, filename is given after the '?' +$defaultdelta2print = 2048; +$TimeoutSpan = 0; ## seconds after which we should time out. + +while (@ARGV && $ARGV[0] =~ m/^-/) +{ + $arg = shift(@ARGV); + + $nab = 1, next if $arg =~ m/^-f(ile)?$/; + $nab = 1, next if $arg =~ m/^-nab$/; + $nab = 2, next if $arg =~ m/^-nnab$/; + $post = 1, next if $arg =~ m/^-p(ost)?$/i; + $post = $postfile = 1, next if $arg =~ m/^-p(ost)?f(ile)?$/i; + $quiet=1, next if $arg =~ m/^-q(uiet)?$/; + $follow = 0, next if $arg =~ m/^-no?f(ollow)?$/; + $strip = 0, next if $arg =~ m/^-no?s(trip)?$/; + $debug=1, next if $arg =~ m/^-d(ebug)?$/; + $noproxy=1, next if $arg =~ m/^-no?p(roxy)?$/; + $retry=0, next if $arg =~ m/^-no?r(etry)?$/; + $retry=$2, next if $arg =~ m/^-r(etry)?(\d+)$/; + &updateme if $arg eq '-updateme'; + $strip = 0, $head = 1, next if $arg =~ m/^-head(er)?/; + $nab = $refresh = 1, next if $arg =~ m/^-(refresh|update)/; + + &usage($EXIT_ok) if $arg =~ m/^-h(elp)?$/; + &show_version, exit($EXIT_ok) if $arg eq '-version' || $arg eq '-V'; + + if ($arg =~ m/^-t(ime)?o(ut)?$/i) { + local($num) = shift(@ARGV); + &usage($EXIT_error, "expecting timespan argument to $arg\n") unless + $num =~ m/^\d+(\d*)?[hms]?$/; + &timeout_arg($num); + next; + } + + if ($arg =~ m/^-if?n(ewer)?t(han)?$/i) { + $reference_file = shift(@ARGV); + &usage($EXIT_error, "expecting filename arg to $arg") + if !defined $reference_file; + if (!-f $reference_file) { + warn qq/$0: ${arg}'s "$reference_file" not found.\n/; + exit($EXIT_error); + } + next; + } + + if ($arg eq '-r' || $arg eq '-retry') { + local($num) = shift(@ARGV); + &usage($EXIT_error, "expecting numerical arg to $arg\n") unless + defined($num) && $num =~ m/^\d+$/; + $retry = $num; + next; + } + &usage($EXIT_error, qq/$0: unknown option "$arg"\n/); +} + +if ($head && $post) { + warn "$0: combining -head and -post makes no sense, ignoring -post.\n"; + $post = 0; + undef $postfile; +} + +if ($refresh && defined($reference_file)) { + warn "$0: combining -update and -IfNewerThan make no sense, ignoring -IfNewerThan.\n"; + undef $reference_file; +} + +if (@ARGV == 0) { + warn "$0: nothing to do. Use -help for info.\n"; + exit($EXIT_ok); +} + + +## +## Now run through the remaining arguments (mostly URLs) and do a quick +## check to see if they look well-formed. We won't *do* anything -- just +## want to catch quick errors before really starting the work. +## +@tmp = @ARGV; +$errors = 0; +while (@tmp) { + $arg = shift(@tmp); + if ($arg =~ m/^-t(ime)?o(ut)?$/) { + local($num) = shift(@tmp); + if ($num !~ m/^\d+(\d*)?[hms]?$/) { + &warn("expecting timespan argument to $arg\n"); + $errors++; + } + } else { + local($protocol) = &www'grok_URL($arg, $noproxy); + + if (!defined $protocol) { + warn qq/can't grok "$arg"/; + $errors++; + } elsif (!$quiet && ($protocol eq 'ftp')) { + warn qq/warning: -head ignored for ftp URLs\n/ if $head; + warn qq/warning: -refresh ignored for ftp URLs\n/if $refresh; + warn qq/warning: -IfNewerThan ignored for ftp URLs\n/if defined($reference_file); + + } + } +} + +exit($EXIT_error) if $errors; + + +$SuccessfulCount = 0; +$NotModifiedCount = 0; + +## +## Now do the real thing. +## +while (@ARGV) { + $arg = shift(@ARGV); + if ($arg =~ m/^-t(ime)?o(ut)?$/) { + &timeout_arg(shift(@ARGV)); + } else { + &fetch_url($arg); + } +} + +if ($NotModifiedCount) { + exit($EXIT_notmodified); +} elsif ($SuccessfulCount) { + exit($EXIT_ok); +} else { + exit($EXIT_error); +} + +########################################################################### +########################################################################### + +sub timeout_arg +{ + ($TimeoutSpan) = @_; + $TimeoutSpan =~ s/s//; + $TimeoutSpan *= 60 if $TimeoutSpan =~ m/m/; + $TimeoutSpan *= 3600 if $TimeoutSpan =~ m/h/; + +} + +## +## As a byproduct, returns the basename of $0. +## +sub show_version +{ + local($base) = $0; + $base =~ s,.*/,,; + print STDERR "This is $base version $version\n"; + $base; +} + +## +## &usage(exitval, message); +## +## Prints a usage message to STDERR. +## If MESSAGE is defined, prints that first. +## If exitval is defined, exits with that value. Otherwise, returns. +## +sub usage +{ + local($exit, $message) = @_; + + print STDERR $message if defined $message; + local($base) = &show_version; + print STDERR <<INLINE_LITERAL_TEXT; +usage: $0 [options] URL ... + Fetches and displays the named URL(s). Supports http and ftp. + (if no protocol is given, a leading "http://" is normally used). + +Options are from among: + -V, -version Print version information; exit. + -p, -post If URL looks like a form reply, does POST instead of GET. + -pf, -postfile Like -post, but takes everything after ? to be a filename. + -q, -quiet All non-essential informational messages are suppressed. + -nf, -nofollow Don't follow "this document has moved" replies. + -nr, -noretry Doesn't retry a failed hostname lookup (same as -retry 0) + -r #, -retry # Sets failed-hostname-lookup-retry to # (default $retry) + -np, -noproxy Uses no proxy, even if one defined for the protocol. + -ns, -nostrip The HTTP header, normally elided, is printed. + -head gets item header only (implies -ns) + -nab, -file Dumps output to file whose name taken from URL, minus path + -nnab Like -nab, but *also* dumps to stdout. + -update HTTP only. Like -nab, but only if the page has been modified. + -h, -help Prints this message. + -IfNewerThan F HTTP only. Only brings page if it is newer than named file. + -timeout T Fail if a connection can't be made in the specified time. + + -updateme Pull the latest version of $base from + $WEB + and reports if it is newer than your current version. + +Comments to $comments. +INLINE_LITERAL_TEXT + + exit($exit) if defined $exit; +} + +## +## Pull the latest version of this program to a local file. +## Clip the first couple lines from this executing file so that we +## preserve the local invocation style. +## +sub updateme +{ + ## + ## Open a temp file to hold the new version, + ## redirecting STDOUT to it. + ## + open(STDOUT, '>'.($tempFile="/tmp/webget.new")) || + open(STDOUT, '>'.($tempFile="/usr/tmp/webget.new")) || + open(STDOUT, '>'.($tempFile="/webget.new")) || + open(STDOUT, '>'.($tempFile="webget.new")) || + die "$0: can't open a temp file.\n"; + + ## + ## See if we can figure out how we were called. + ## The seek will rewind not to the start of the data, but to the + ## start of the whole program script. + ## + ## Keep the first line if it begins with #!, and the next two if they + ## look like the trick mentioned in the perl man page for getting + ## around the lack of #!-support. + ## + if (seek(DATA, 0, 0)) { ## + $_ = <DATA>; if (m/^#!/) { print STDOUT; + $_ = <DATA>; if (m/^\s*eval/) { print STDOUT; + $_ = <DATA>; if (m/^\s*if/) { print STDOUT; } + } + } + print STDOUT "\n#-\n"; + } + + ## Go get the latest one... + local(@options); + push(@options, 'head') if $head; + push(@options, 'nofollow') unless $follow; + push(@options, ('retry') x $retry) if $retry; + push(@options, 'quiet') if $quiet; + push(@options, 'debug') if $debug; + local($status, $memo, %info) = &www'open_http_url(*IN, $WEB, @options); + die "fetching $WEB:\n $memo\n" unless $status eq 'ok'; + + $size = $info{'content-length'}; + while (<IN>) + { + $size -= length; + print STDOUT; + if (!defined $fetched_version && m/version\s*=\s*"([^"]+)"/) { + $fetched_version = $1; + &general_read(*IN, $size); + last; + } + } + + $fetched_version = "<unknown>" unless defined $fetched_version; + + ## + ## Try to update the mode of the temp file with the mode of this file. + ## Don't worry if it fails. + ## + chmod($mode, $tempFile) if $mode = (stat($0))[2]; + + $as_well = ''; + if ($fetched_version eq $version) + { + print STDERR "You already have the most-recent version ($version).\n", + qq/FWIW, the newly fetched one has been left in "$tempFile".\n/; + } + elsif ($fetched_version <= $version) + { + print STDERR + "Mmm, your current version seems newer (?!):\n", + qq/ your version: "$version"\n/, + qq/ new version: "$fetched_version"\n/, + qq/FWIW, fetched one left in "$tempFile".\n/; + } + else + { + print STDERR + "Indeed, your current version was old:\n", + qq/ your version: "$version"\n/, + qq/ new version: "$fetched_version"\n/, + qq/The file "$tempFile" is ready to replace the old one.\n/; + print STDERR qq/Just do:\n % mv $tempFile $0\n/ if -f $0; + $as_well = ' as well'; + } + print STDERR "Note that the libraries it uses may (or may not) need updating$as_well.\n" + unless $inlined; + exit($EXIT_ok); +} + +## +## Given a list of URLs, fetch'em. +## Parses the URL and calls the routine for the appropriate protocol +## +sub fetch_url +{ + local(@todo) = @_; + local(%circref, %hold_circref); + + URL_LOOP: while (@todo) + { + $URL = shift(@todo); + %hold_circref = %circref; undef %circref; + + local($protocol, @args) = &www'grok_URL($URL, $noproxy); + + if (!defined $protocol) { + &www'message(1, qq/can't grok "$URL"/); + next URL_LOOP; + } + + ## call protocol-specific handler + $func = "fetch_via_" . $protocol; + $error = &$func(@args, $TimeoutSpan); + if (defined $error) { + &www'message(1, "$URL: $error"); + } else { + $SuccessfulCount++; + } + } +} + +sub filedate +{ + local($filename) = @_; + local($filetime) = (stat($filename))[9]; + return 0 if !defined $filetime; + local($sec, $min, $hour, $mday, $mon, $year, $wday) = gmtime($filetime); + return 0 if !defined $wday; + sprintf(qq/"%s, %02d-%s-%02d %02d:%02d:%02d GMT"/, + ("Sunday", "Monday", "Tuesdsy", "Wednesday", + "Thursday", "Friday", "Saturday")[$wday], + $mday, + ("Jan", "Feb", "Mar", "Apr", "May", "Jun", + "Jul", "Aug", "Sep", "Oct", "Nov", "Dec")[$mon], + $year, + $hour, + $min, + $sec); +} + +sub local_filename +{ + local($filename) = @_; + $filename =~ s,/+$,,; ## remove any trailing slashes + $filename =~ s,.*/,,; ## remove any leading path + if ($filename eq '') { + ## empty -- pick a random name + $filename = "file0000"; + ## look for a free random name. + $filename++ while -f $filename; + } + $filename; +} + +sub set_output_file +{ + local($filename) = @_; + if (!open(OUT, ">$filename")) { + &www'message(1, "$0: can't open [$filename] for output"); + } else { + open(SAVEOUT, ">>&STDOUT") || die "$!";; + open(STDOUT, ">>&OUT"); + } +} + +sub close_output_file +{ + local($filename) = @_; + unless ($quiet) + { + local($note) = qq/"$filename" written/; + if (defined $error) { + $note .= " (possibly corrupt due to error above)"; + } + &www'message(1, "$note."); + } + close(STDOUT); + open(STDOUT, ">&SAVEOUT"); +} + +sub http_alarm +{ + &www'message(1, "ERROR: $AlarmNote."); + exit($EXIT_timeout); ## the alarm doesn't seem to cause a waiting syscall to break? +# $HaveAlarm = 1; +} + +## +## Given the host, port, and path, and (for info only) real target, +## fetch via HTTP. +## +## If there is a user and/or password, use that for Basic Authorization. +## +## If $timeout is nonzero, time out after that many seconds. +## +sub fetch_via_http +{ + local($host, $port, $path, $target, $user, $password, $timeout) = @_; + local(@options); + local($local_filename); + + ## + ## If we're posting, but -postfile was given, we need to interpret + ## the item in $path after '?' as a filename, and replace it with + ## the contents of the file. + ## + if ($postfile && $path =~ s/\?([\d\D]*)//) { + local($filename) = $1; + return("can't open [$filename] to POST") if !open(IN, "<$filename"); + local($/) = ''; ## want to suck up the whole file. + $path .= '?' . <IN>; + close(IN); + } + + $local_filename = &local_filename($path) + if $refresh || $nab || defined($reference_file); + $refresh = &filedate($local_filename) if $refresh; + $refresh = &filedate($reference_file) if defined($reference_file); + + push(@options, 'head') if $head; + push(@options, 'post') if $post; + push(@options, 'nofollow') unless $follow; + push(@options, ('retry') x 3); + push(@options, 'quiet') if $quiet; + push(@options, 'debug') if $debug; + push(@options, "ifmodifiedsince=$refresh") if $refresh; + + if (defined $password || defined $user) { + local($auth) = join(':', ($user || ''), ($password || '')); + push(@options, "authorization=$auth"); + } + + local($old_alarm); + if ($timeout) { + $old_alarm = $SIG{'ALRM'} || 'DEFAULT'; + $SIG{'ALRM'} = "main'http_alarm"; +# $HaveAlarm = 0; + $AlarmNote = "host $host"; + $AlarmNote .= ":$port" if $port != $www'default_port{'http'}; + $AlarmNote .= " timed out after $timeout second"; + $AlarmNote .= 's' if $timeout > 1; + alarm($timeout); + } + local($result, $memo, %info) = + &www'open_http_connection(*HTTP, $host,$port,$path,$target,@options); + + if ($timeout) { + alarm(0); + $SIG{'ALRM'} = $old_alarm; + } + +# if ($HaveAlarm) { +# close(HTTP); +# $error = "timeout after $timeout second"; +# $error .= "s" if $timeout > 1; +# return $error; +# } + + if ($follow && ($result eq 'follow')) { + %circref = %hold_circref; + $circref{$memo} = 1; + unshift(@todo, $memo); + return undef; + } + + + return $memo if $result eq 'error'; + if (!$quiet && $result eq 'status' && ! -t STDOUT) { + #&www'message(1, "Warning: $memo"); + $error = "Warning: $memo"; + } + + if ($info{'CODE'} == 304) { ## 304 is magic for "Not Modified" + close(HTTP); + &www'message(1, "$URL: Not Modified") unless $quiet; + $NotModifiedCount++; + return undef; ## no error + } + + + &set_output_file($local_filename) if $nab; + + unless($strip) { + print $info{'STATUS'}, "\n", $info{'HEADER'}, "\n"; + + print SAVEOUT $info{'STATUS'}, "\n", $info{'HEADER'}, "\n" if $nab==2; + } + + if (defined $info{'BODY'}) { + print $info{'BODY'}; + print SAVEOUT $info{'BODY'} if $nab==2; + } + + if (!$head) { + &general_read(*HTTP, $info{'content-length'}); + } + close(HTTP); + &close_output_file($local_filename) if $nab; + + $error; ## will be 'undef' if no error; +} + +sub fetch_via_ftp +{ + local($host, $port, $path, $target, $user, $password, $timeout) = @_; + local($local_filename) = &local_filename($path); + local($ftp_debug) = $debug; + local(@password) = ($password); + $path =~ s,^/,,; ## remove a leading / from the path. + $path = '.' if $path eq ''; ## make sure we have something + + if (!defined $user) { + $user = 'anonymous'; + $password = $ENV{'USER'} || 'WWWuser'; + @password = ($password.'@'. &network'addr_to_ascii(&network'my_addr), + $password.'@'); + } elsif (!defined $password) { + @password = (""); + } + + local($_last_ftp_reply, $_passive_host, $_passive_port); + local($size); + + sub _ftp_get_reply + { + local($text) = scalar(<FTP_CONTROL>); + die "lost connection to $host\n" if !defined $text; + local($_, $tmp); + print STDERR "READ: $text" if $ftp_debug; + die "internal error: expected reply code in response from ". + "ftp server [$text]" unless $text =~ s/^(\d+)([- ])//; + local($code) = $1; + if ($2 eq '-') { + while (<FTP_CONTROL>) { + ($tmp = $_) =~ s/^\d+[- ]//; + $text .= $tmp; + last if m/^$code /; + } + } + $text =~ s/^\d+ ?/<foo>/g; + ($code, $text); + } + + sub _ftp_expect + { + local($code, $text) = &_ftp_get_reply; + $_last_ftp_reply = $text; + foreach $expect (@_) { + return ($code, $text) if $code == $expect; + } + die "internal error: expected return code ". + join('|',@_).", got [$text]"; + } + + sub _ftp_send + { + print STDERR "SEND: ", @_ if $ftp_debug; + print FTP_CONTROL @_; + } + + sub _ftp_do_passive + { + local(@commands) = @_; + + &_ftp_send("PASV\r\n"); + local($code) = &_ftp_expect(227, 125); + + if ($code == 227) + { + die "internal error: can't grok passive reply [$_last_ftp_reply]" + unless $_last_ftp_reply =~ m/\(([\d,]+)\)/; + local($a,$b,$c,$d, $p1, $p2) = split(/,/, $1); + ($_passive_host, $_passive_port) = + ("$a.$b.$c.$d", $p1*256 + $p2); + } + + foreach(@commands) { + &_ftp_send($_); + } + + local($error)= + &network'connect_to(*PASSIVE, $_passive_host, $_passive_port); + die "internal error: passive ftp connect [$error]" if $error; + } + + ## make the connection to the host + &www'message($debug, "connecting to $host...") unless $quiet; + + local($old_alarm); + if ($timeout) { + $old_alarm = $SIG{'ALRM'} || 'DEFAULT'; + $SIG{'ALRM'} = "main'http_alarm"; ## can use this for now +# $HaveAlarm = 0; + $AlarmNote = "host $host"; + $AlarmNote .= ":$port" if $port != $www'default_port{'ftp'}; + $AlarmNote .= " timed out after $timeout second"; + $AlarmNote .= 's' if $timeout > 1; + alarm($timeout); + } + + local($error) = &network'connect_to(*FTP_CONTROL, $host, $port); + + if ($timeout) { + alarm(0); + $SIG{'ALRM'} = $old_alarm; + } + + return $error if $error; + + local ($code, $text) = &_ftp_get_reply(*FTP_CONTROL); + close(FTP_CONTROL), return "internal ftp error: [$text]" unless $code==220; + + ## log in + &www'message($debug, "logging in as $user...") unless $quiet; + foreach $password (@password) + { + &_ftp_send("USER $user\r\n"); + ($code, $text) = &_ftp_expect(230,331,530); + close(FTP_CONTROL), return $text if ($code == 530); + last if $code == 230; ## hey, already logged in, cool. + + &_ftp_send("PASS $password\r\n"); + ($code, $text) = &_ftp_expect(220,230,530,550,332); + last if $code != 550; + last if $text =~ m/can't change directory/; + } + + if ($code == 550) + { + $text =~ s/\n+$//; + &www'message(1, "Can't log in $host: $text") unless $quiet; + exit($EXIT_error); + } + + if ($code == 332) + { + &_ftp_send("ACCT noaccount\r\n"); + ($code, $text) = &_ftp_expect(230, 202, 530, 500,501,503, 421) + } + close(FTP_CONTROL), return $text if $code >= 300; + + &_ftp_send("TYPE I\r\n"); + &_ftp_expect(200); + + unless ($quiet) { + local($name) = $path; + $name =~ s,.*/([^/]),$1,; + &www'message($debug, "requesting $name..."); + } + ## get file + &_ftp_do_passive("RETR $path\r\n"); + ($code,$text) = &_ftp_expect(125, 150, 550, 530); + close(FTP_CONTROL), return $text if $code == 530; + + if ($code == 550) + { + close(PASSIVE); + if ($text =~ /directory/i) { + ## probably from "no such file or directory", so just return now. + close(FTP_CONTROL); + return $text; + } + + ## do like Mosaic and try getting a directory listing. + &_ftp_send("CWD $path\r\n"); + ($code) = &_ftp_expect(250,550); + if ($code == 550) { + close(FTP_CONTROL); + return $text; + } + &_ftp_do_passive("LIST\r\n"); + &_ftp_expect(125, 150); + } + + $size = $1 if $text =~ m/(\d+)\s+bytes/; + binmode(PASSIVE); ## just in case. + &www'message($debug, "waiting for data...") unless $quiet; + &set_output_file($local_filename) if $nab; + &general_read(*PASSIVE, $size); + &close_output_file($local_filename) if $nab; + + close(PASSIVE); + close(FTP_CONTROL); + undef; +} + +sub general_read +{ + local(*INPUT, $size) = @_; + local($lastcount, $bytes) = (0,0); + local($need_to_clear) = 0; + local($start_time) = time; + local($last_time, $time) = $start_time; + ## Figure out how often to print the "bytes read" message + local($delta2print) = + (defined $size) ? int($size/50) : $defaultdelta2print; + + &www'message(0, "read 0 bytes") unless $quiet; + + ## so $! below is set only if a real error happens from now + eval 'local($^W) = 0; undef $!'; + + + while (defined($_ = <INPUT>)) + { + ## shove it out. + &www'clear_message if $need_to_clear; + print; + print SAVEOUT if $nab==2; + + ## if we know the content-size, keep track of what we're reading. + $bytes += length; + + last if eof || (defined $size && $bytes >= $size); + + if (!$quiet && $bytes > ($lastcount + $delta2print)) + { + if ($time = time, $last_time == $time) { + $delta2print *= 1.5; + } else { + $last_time = $time; + $lastcount = $bytes; + local($time_delta) = $time - $start_time; + local($text); + + $delta2print /= $time_delta; + if (defined $size) { + $text = sprintf("read $bytes bytes (%.0f%%)", + $bytes*100/$size); + } else { + $text = "read $bytes bytes"; + } + + if ($time_delta > 5 || ($time_delta && $bytes > 10240)) + { + local($rate) = int($bytes / $time_delta); + if ($rate < 5000) { + $text .= " ($rate bytes/sec)"; + } elsif ($rate < 1024 * 10) { + $text .= sprintf(" (%.1f k/sec)", $rate/1024); + } else { + $text .= sprintf(" (%.0f k/sec)", $rate/1024); + } + } + &www'message(0, "$text..."); + $need_to_clear = -t STDOUT; + } + } + } + + if (!$quiet) + { + if ($size && ($size != $bytes)) { + &www'message("WARNING: Expected $size bytes, read $bytes bytes.\n"); + } +# if ($!) { +# print STDERR "\$! is [$!]\n"; +# } +# if ($@) { +# print STDERR "\$\@ is [$@]\n"; +# } + } + &www'clear_message($text) unless $quiet; +} + +sub dummy { + 1 || &dummy || &fetch_via_ftp || &fetch_via_http || &http_alarm; + 1 || close(OUT); + 1 || close(SAVEOUT); +} + +__END__ +__END__ +:endofperl diff --git a/win32/bin/www.pl b/win32/bin/www.pl new file mode 100644 index 0000000000..8022597454 --- /dev/null +++ b/win32/bin/www.pl @@ -0,0 +1,901 @@ +## +## Jeffrey Friedl (jfriedl@omron.co.jp) +## Copyri.... ah hell, just take it. +## +## This is "www.pl". +## Include (require) to use, execute ("perl www.pl") to print a man page. +## Requires my 'network.pl' library. +package www; +$version = "951219.9"; + +## +## 951219.9 +## -- oops, stopped sending garbage Authorization line when no +## authorization was requested. +## +## 951114.8 +## -- added support for HEAD, If-Modified-Since +## +## 951017.7 +## -- Change to allow a POST'ed HTTP text to have newlines in it. +## Added 'NewURL to the open_http_connection %info. Idea courtesy +## of Bryan Schmersal (http://www.transarc.com/~bryans/Home.html). +## +## +## 950921.6 +## -- added more robust HTTP error reporting +## (due to steven_campbell@uk.ibm.com) +## +## 950911.5 +## -- added Authorization support +## + +## +## HTTP return status codes. +## +%http_return_code = + (200,"OK", + 201,"Created", + 202,"Accepted", + 203,"Partial Information", + 204,"No Response", + 301,"Moved", + 302,"Found", + 303,"Method", + 304,"Not modified", + 400,"Bad request", + 401,"Unauthorized", + 402,"Payment required", + 403,"Forbidden", + 404,"Not found", + 500,"Internal error", + 501,"Not implemented", + 502,"Service temporarily overloaded", + 503,"Gateway timeout"); + +## +## If executed directly as a program, print as a man page. +## +if (length($0) >= 6 && substr($0, -6) eq 'www.pl') +{ + seek(DATA, 0, 0) || die "$0: can't reset internal pointer.\n"; + print "www.pl version $version\n", '=' x 60, "\n"; + while (<DATA>) { + next unless /^##>/../^##</; ## select lines to print + s/^##[<> ]?//; ## clean up + print; + } + exit(0); +} + +## +## History: +## version 950425.4 +## added require for "network.pl" +## +## version 950425.3 +## re-did from "Www.pl" which was a POS. +## +## +## BLURB: +## A group of routines for dealing with URLs, HTTP sessions, proxies, etc. +## Requires my 'network.pl' package. The library file can be executed +## directly to produce a man page. + +##> +## A motley group of routines for dealing with URLs, HTTP sessions, proxies, +## etc. Requires my 'network.pl' package. +## +## Latest version, as well as other stuff (including network.pl) available +## at http://www.wg.omron.co.jp/~jfriedl/perl/ +## +## Simpleton complete program to dump a URL given on the command-line: +## +## require 'network.pl'; ## required for www.pl +## require 'www.pl'; ## main routines +## $URL = shift; ## get URL +## ($status, $memo) = &www'open_http_url(*IN, $URL); ## connect +## die "$memo\n" if $status ne 'ok'; ## report any error +## print while <IN>; ## dump contents +## +## There are various options available for open_http_url. +## For example, adding 'quiet' to the call, i.e. vvvvvvv-----added +## ($status, $memo) = &www'open_http_url(*IN, $URL, 'quiet'); +## suppresses the normal informational messages such as "waiting for data...". +## +## The options, as well as the various other public routines in the package, +## are discussed below. +## +##< + +## +## Default port for the protocols whose URL we'll at least try to recognize. +## +%default_port = ('http', 80, + 'ftp', 21, + 'gopher', 70, + 'telnet', 23, + 'wais', 210, + ); + +## +## A "URL" to "ftp.blah.com" without a protocol specified is probably +## best reached via ftp. If the hostname begins with a protocol name, it's +## easy. But something like "www." maps to "http", so that mapping is below: +## +%name2protocol = ( + 'www', 'http', + 'wwwcgi','http', +); + +$last_message_length = 0; +$useragent = "www.pl/$version"; + +## +##> +############################################################################## +## routine: open_http_url +## +## Used as +## ($status, $memo, %info) = &www'open_http_url(*FILEHANDLE, $URL, options..) +## +## Given an unused filehandle, a URL, and a list of options, opens a socket +## to the URL and returns with the filehandle ready to read the data of the +## URL. The HTTP header, as well as other information, is returned in %info. +## +## OPTIONS are from among: +## +## "post" +## If PATH appears to be a query (i.e. has a ? in it), contact +## via a POST rather than a GET. +## +## "nofollow" +## Normally, if the initial contact indicates that the URL has moved +## to a different location, the new location is automatically contacted. +## "nofollow" inhibits this. +## +## "noproxy" +## Normally, a proxy will be used if 'http_proxy' is defined in the +## environment. This option inhibits the use of a proxy. +## +## "retry" +## If a host's address can't be found, it may well be because the +## nslookup just didn't return in time and that retrying the lookup +## after a few seconds will succeed. If this option is given, will +## wait five seconds and try again. May be given multiple times to +## retry multiple times. +## +## "quiet" +## Informational messages will be suppressed. +## +## "debug" +## Additional messages will be printed. +## +## "head" +## Requests only the file header to be sent +## +## +## +## +## The return array is ($STATUS, $MEMO, %INFO). +## +## STATUS is 'ok', 'error', 'status', or 'follow' +## +## If 'error', the MEMO will indicate why (URL was not http, can't +## connect, etc.). INFO is probably empty, but may have some data. +## See below. +## +## If 'status', the connnection was made but the reply was not a normal +## "OK" successful reply (i.e. "Not found", etc.). MEMO is a note. +## INFO is filled as noted below. Filehandle is ready to read (unless +## $info{'BODY'} is filled -- see below), but probably most useful +## to treat this as an 'error' response. +## +## If 'follow', MEMO is the new URL (for when 'nofollow' was used to +## turn off automatic following) and INFO is filled as described +## below. Unless you wish to give special treatment to these types of +## responses, you can just treat 'follow' responses like 'ok' +## responses. +## +## If 'ok', the connection went well and the filehandle is ready to +## read. +## +## INFO contains data as described at the read_http_header() function (in +## short, the HTTP response header) and additional informational fields. +## In addition, the following fields are filled in which describe the raw +## connection made or attempted: +## +## PROTOCOL, HOST, PORT, PATH +## +## Note that if a proxy is being used, these will describe the proxy. +## The field TARGET will describe the host or host:port ultimately being +## contacted. When no proxy is being used, this will be the same info as +## in the raw connection fields above. However, if a proxy is being used, +## it will refer to the final target. +## +## In some cases, the additional entry $info{'BODY'} exists as well. If +## the result-code indicates an error, the body of the message may be +## parsed for internal reasons (i.e. to support 'repeat'), and if so, it +## will be saved in $info{'BODY}. +## +## If the URL has moved, $info{'NewURL'} will exist and contain the new +## URL. This will be true even if the 'nofollow' option is specified. +## +##< +## +sub open_http_url +{ + local(*HTTP, $URL, @options) = @_; + return &open_http_connection(*HTTP, $URL, undef, undef, undef, @options); +} + + +## +##> +############################################################################## +## routine: read_http_header +## +## Given a filehandle to a just-opened HTTP socket connection (such as one +## created via &network'connect_to which has had the HTTP request sent), +## reads the HTTP header and and returns the parsed info. +## +## ($replycode, %info) = &read_http_header(*FILEHANDLE); +## +## $replycode will be the HTTP reply code as described below, or +## zero on header-read error. +## +## %info contains two types of fields: +## +## Upper-case fields are informational from the function. +## Lower-case fields are the header field/value pairs. +## +## Upper-case fields: +## +## $info{'STATUS'} will be the first line read (HTTP status line) +## +## $info{'CODE'} will be the numeric HTTP reply code from that line. +## This is also returned as $replycode. +## +## $info{'TYPE'} is the text from the status line that follows CODE. +## +## $info{'HEADER'} will be the raw text of the header (sans status line), +## newlines and all. +## +## $info{'UNKNOWN'}, if defined, will be any header lines not in the +## field/value format used to fill the lower-case fields of %info. +## +## Lower-case fields are reply-dependent, but in general are described +## in http://info.cern.ch/hypertext/WWW/Protocols/HTTP/Object_Headers.html +## +## A header line such as +## Content-type: Text/Plain +## will appear as $info{'content-type'} = 'Text/Plain'; +## +## (*) Note that while the field names are are lower-cased, the field +## values are left as-is. +## +## +## When $replycode is zero, there are two possibilities: +## $info{'TYPE'} is 'empty' +## No response was received from the filehandle before it was closed. +## No other %info fields present. +## $info{'TYPE'} is 'unknown' +## First line of the response doesn't seem to be proper HTTP. +## $info{'STATUS'} holds that line. No other %info fields present. +## +## The $replycode, when not zero, is as described at +## http://info.cern.ch/hypertext/WWW/Protocols/HTTP/HTRESP.html +## +## Some of the codes: +## +## success 2xx +## ok 200 +## created 201 +## accepted 202 +## partial information 203 +## no response 204 +## redirection 3xx +## moved 301 +## found 302 +## method 303 +## not modified 304 +## error 4xx, 5xx +## bad request 400 +## unauthorized 401 +## paymentrequired 402 +## forbidden 403 +## not found 404 +## internal error 500 +## not implemented 501 +## service temporarily overloaded 502 +## gateway timeout 503 +## +##< +## +sub read_http_header +{ + local(*HTTP) = @_; + local(%info, $_); + + ## + ## The first line of the response will be the status (OK, error, etc.) + ## + unless (defined($info{'STATUS'} = <HTTP>)) { + $info{'TYPE'} = "empty"; + return (0, %info); + } + chop $info{'STATUS'}; + + ## + ## Check the status line. If it doesn't match and we don't know the + ## format, we'll just let it pass and hope for the best. + ## + unless ($info{'STATUS'} =~ m/^HTTP\S+\s+(\d\d\d)\s+(.*\S)/i) { + $info{'TYPE'} = 'unknown'; + return (0, %info); + } + + $info{'CODE'} = $1; + $info{'TYPE'} = $2; + $info{'HEADER'} = ''; + + ## read the rest of the header. + while (<HTTP>) { + last if m/^\s*$/; + $info{'HEADER'} .= $_; ## save whole text of header. + + if (m/^([^\n:]+):[ \t]*(.*\S)/) { + local($field, $value) = ("\L$1", $2); + if (defined $info{$field}) { + $info{$field} .= "\n" . $value; + } else { + $info{$field} = $value; + } + } elsif (defined $info{'UNKNOWN'}) { + $info{'UNKNOWN'} .= $_; + } else { + $info{'UNKNOWN'} = $_; + } + } + + return ($info{'CODE'}, %info); +} + +## +##> +## +############################################################################## +## routine: grok_URL(URL, noproxy, defaultprotocol) +## +## Given a URL, returns access information. Deals with +## http, wais, gopher, ftp, and telnet +## URLs. +## +## Information returned is +## (PROTOCOL, HOST, PORT, PATH, TARGET, USER, PASSWORD) +## +## If noproxy is not given (or false) and there is a proxy defined +## for the given protocol (via the "*_proxy" environmental variable), +## the returned access information will be for the proxy and will +## reference the given URL. In this case, 'TARGET' will be the +## HOST:PORT of the original URL (PORT elided if it's the default port). +## +## Access information returned: +## PROTOCOL: "http", "ftp", etc. (guaranteed to be lowercase). +## HOST: hostname or address as given. +## PORT: port to access +## PATH: path of resource on HOST:PORT. +## TARGET: (see above) +## USER and PASSWORD: for 'ftp' and 'telnet' URLs, if supplied by the +## URL these will be defined, undefined otherwise. +## +## If no protocol is defined via the URL, the defaultprotocol will be used +## if given. Otherwise, the URL's address will be checked for a leading +## protocol name (as with a leading "www.") and if found will be used. +## Otherwise, the protocol defaults to http. +## +## Fills in the appropriate default port for the protocol if need be. +## +## A proxy is defined by a per-protocol environmental variable such +## as http_proxy. For example, you might have +## setenv http_proxy http://firewall:8080/ +## setenv ftp_proxy $http_proxy +## to set it up. +## +## A URL seems to be officially described at +## http://www.w3.org/hypertext/WWW/Addressing/URL/5_BNF.html +## although that document is a joke of errors. +## +##< +## +sub grok_URL +{ + local($_, $noproxy, $defaultprotocol) = @_; + $noproxy = defined($noproxy) && $noproxy; + + ## Items to be filled in and returned. + local($protocol, $address, $port, $path, $target, $user, $password); + + return undef unless m%^(([a-zA-Z]+)://|/*)([^/]+)(/.*)?$%; + + ## + ## Due to a bug in some versions of perl5, $2 might not be empty + ## even if $1 is. Therefore, we must check $1 for a : to see if the + ## protocol stuff matched or not. If not, the protocol is undefined. + ## + ($protocol, $address, $path) = ((index($1,":") >= 0 ? $2 : undef), $3, $4); + + if (!defined $protocol) + { + ## + ## Choose a default protocol if none given. If address begins with + ## a protocol name (one that we know via %name2protocol or + ## %default_port), choose it. Otherwise, choose http. + ## + if (defined $defaultprotocol) { + $protocol = $defaultprotocol; + } + else + { + $address =~ m/^[a-zA-Z]+/; + if (defined($name2protocol{"\L$&"})) { + $protocol = $name2protocol{"\L$&"}; + } else { + $protocol = defined($default_port{"\L$&"}) ? $& : 'http'; + } + } + } + $protocol =~ tr/A-Z/a-z/; ## ensure lower-case. + + ## + ## Http support here probably not kosher, but fits in nice for basic + ## authorization. + ## + if ($protocol eq 'ftp' || $protocol eq 'telnet' || $protocol eq 'http') + { + ## Glean a username and password from address, if there. + ## There if address starts with USER[:PASSWORD]@ + if ($address =~ s/^(([^\@:]+)(:([^@]+))?\@)//) { + ($user, $password) = ($2, $4); + } + } + + ## + ## address left is (HOSTNAME|HOSTNUM)[:PORTNUM] + ## + if ($address =~ s/:(\d+)$//) { + $port = $1; + } else { + $port = $default_port{$protocol}; + } + + ## default path is '/'; + $path = '/' if !defined $path; + + ## + ## If there's a proxy and we're to proxy this request, do so. + ## + local($proxy) = $ENV{$protocol."_proxy"}; + if (!$noproxy && defined($proxy) && !&no_proxy($protocol,$address)) + { + local($dummy); + local($old_pass, $old_user); + + ## + ## Since we're going through a proxy, we want to send the + ## proxy the entire URL that we want. However, when we're + ## doing Authenticated HTTP, we need to take out the user:password + ## that webget has encoded in the URL (this is a bit sleazy on + ## the part of webget, but the alternative is to have flags, and + ## having them part of the URL like with FTP, etc., seems a bit + ## cleaner to me in the context of how webget is used). + ## + ## So, if we're doing this slezy thing, we need to construct + ## the new URL from the compnents we have now (leaving out password + ## and user), decode the proxy URL, then return the info for + ## that host, a "filename" of the entire URL we really want, and + ## the user/password from the original URL. + ## + ## For all other things, we can just take the original URL, + ## ensure it has a protocol on it, and pass it as the "filename" + ## we want to the proxy host. The difference between reconstructing + ## the URL (as for HTTP Authentication) and just ensuring the + ## protocol is there is, except for the user/password stuff, + ## nothing. In theory, at least. + ## + if ($protocol eq 'http' && (defined($password) || defined($user))) + { + $path = "http://$address$path"; + $old_pass = $password; + $old_user = $user; + } else { + ## Re-get original URL and ensure protocol// actually there. + ## This will become our new path. + ($path = $_) =~ s,^($protocol:)?/*,$protocol://,i; + } + + ## note what the target will be + $target = ($port==$default_port{$protocol})?$address:"$address:$port"; + + ## get proxy info, discarding + ($protocol, $address, $port, $dummy, $dummy, $user, $password) + = &grok_URL($proxy, 1); + $password = $old_pass if defined $old_pass; + $user = $old_user if defined $old_user; + } + ($protocol, $address, $port, $path, $target, $user, $password); +} + + + +## +## &no_proxy($protocol, $host) +## +## Returns true if the specified host is identified in the no_proxy +## environmental variable, or identify the proxy server itself. +## +sub no_proxy +{ + local($protocol, $targethost) = @_; + local(@dests, $dest, $host, @hosts, $aliases); + local($proxy) = $ENV{$protocol."_proxy"}; + return 0 if !defined $proxy; + $targethost =~ tr/A-Z/a-z/; ## ensure all lowercase; + + @dests = ($proxy); + push(@dests,split(/\s*,\s*/,$ENV{'no_proxy'})) if defined $ENV{'no_proxy'}; + + foreach $dest (@dests) + { + ## just get the hostname + $host = (&grok_URL($dest, 1), 'http')[1]; + + if (!defined $host) { + warn "can't grok [$dest] from no_proxy env.var.\n"; + next; + } + @hosts = ($host); ## throw in original name just to make sure + ($host, $aliases) = (gethostbyname($host))[0, 1]; + + if (defined $aliases) { + push(@hosts, ($host, split(/\s+/, $aliases))); + } else { + push(@hosts, $host); + } + foreach $host (@hosts) { + next if !defined $host; + return 1 if "\L$host" eq $targethost; + } + } + return 0; +} + +sub ensure_proper_network_library +{ + require 'network.pl' if !defined $network'version; + warn "WARNING:\n". __FILE__ . + qq/ needs a newer version of "network.pl"\n/ if + !defined($network'version) || $network'version < "950311.5"; +} + + + +## +##> +############################################################################## +## open_http_connection(*FILEHANDLE, HOST, PORT, PATH, TARGET, OPTIONS...) +## +## Opens an HTTP connection to HOST:PORT and requests PATH. +## TARGET is used only for informational messages to the user. +## +## If PORT and PATH are undefined, HOST is taken as an http URL and TARGET +## is filled in as needed. +## +## Otherwise, it's the same as open_http_url (including return value, etc.). +##< +## +sub open_http_connection +{ + local(*HTTP, $host, $port, $path, $target, @options) = @_; + local($post_text, @error, %seen); + local(%info); + + &ensure_proper_network_library; + + ## options allowed: + local($post, $retry, $authorization, $nofollow, $noproxy, + $head, $debug, $ifmodifiedsince, $quiet, ) = (0) x 10; + ## parse options: + foreach $opt (@options) + { + next unless defined($opt) && $opt ne ''; + local($var, $val); + if ($opt =~ m/^(\w+)=(.*)/) { + ($var, $val) = ($1, $2); + } else { + $var = $opt; + $val = 1; + } + $var =~ tr/A-Z/a-z/; ## ensure variable is lowercase. + local(@error); + + eval "if (defined \$$var) { \$$var = \$val; } else { \@error = + ('error', 'bad open_http_connection option [$opt]'); }"; + return ('error', "open_http_connection eval: $@") if $@; + return @error if defined @error; + } + $quiet = 0 if $debug; ## debug overrides quiet + + local($protocol, $error, $code, $URL, %info, $tmp, $aite); + + ## + ## if both PORT and PATH are undefined, treat HOST as a URL. + ## + unless (defined($port) && defined($path)) + { + ($protocol,$host,$port,$path,$target)=&grok_URL($host,$noproxy,'http'); + if ($protocol ne "http") { + return ('error',"open_http_connection doesn't grok [$protocol]"); + } + unless (defined($host)) { + return ('error', "can't grok [$URL]"); + } + } + + return ('error', "no port in URL [$URL]") unless defined $port; + return ('error', "no path in URL [$URL]") unless defined $path; + + RETRY: while(1) + { + ## we'll want $URL around for error messages and such. + if ($port == $default_port{'http'}) { + $URL = "http://$host"; + } else { + $URL = "http://$host:$default_port{'http'}"; + } + $URL .= ord($path) eq ord('/') ? $path : "/$path"; + + $aite = defined($target) ? "$target via $host" : $host; + + &message($debug, "connecting to $aite ...") unless $quiet; + + ## + ## note some info that might be of use to the caller. + ## + local(%preinfo) = ( + 'PROTOCOL', 'http', + 'HOST', $host, + 'PORT', $port, + 'PATH', $path, + ); + if (defined $target) { + $preinfo{'TARGET'} = $target; + } elsif ($default_port{'http'} == $port) { + $preinfo{'TARGET'} = $host; + } else { + $preinfo{'TARGET'} = "$host:$port"; + } + + ## connect to the site + $error = &network'connect_to(*HTTP, $host, $port); + if (defined $error) { + return('error', "can't connect to $aite: $error", %preinfo); + } + + ## If we're asked to POST and it looks like a POST, note post text. + if ($post && $path =~ m/\?/) { + $post_text = $'; ## everything after the '?' + $path = $`; ## everything before the '?' + } + + ## send the POST or GET request + $tmp = $head ? 'HEAD' : (defined $post_text ? 'POST' : 'GET'); + + &message($debug, "sending request to $aite ...") if !$quiet; + print HTTP $tmp, " $path HTTP/1.0\n"; + + ## send the If-Modified-Since field if needed. + if ($ifmodifiedsince) { + print HTTP "If-Modified-Since: $ifmodifiedsince\n"; + } + + ## oh, let's sputter a few platitudes..... + print HTTP "Accept: */*\n"; + print HTTP "User-Agent: $useragent\n" if defined $useragent; + + ## If doing Authorization, do so now. + if ($authorization) { + print HTTP "Authorization: Basic ", + &htuu_encode($authorization), "\n"; + } + + ## If it's a post, send it. + if (defined $post_text) + { + print HTTP "Content-type: application/x-www-form-urlencoded\n"; + print HTTP "Content-length: ", length $post_text, "\n\n"; + print HTTP $post_text, "\n"; + } + print HTTP "\n"; + &message($debug, "waiting for data from $aite ...") unless $quiet; + + ## we can now read the response (header, then body) via HTTP. + binmode(HTTP); ## just in case. + + ($code, %info) = &read_http_header(*HTTP); + &message(1, "header returns code $code ($info{'TYPE'})") if $debug; + + ## fill in info from %preinfo + local($val, $key); + while (($val, $key) = each %preinfo) { + $info{$val} = $key; + } + + if ($code == 0) + { + return('error',"empty response for $URL") + if $info{'TYPE'} eq 'empty'; + return('error', "non-HTTP response for $URL", %info) + if $info{'TYPE'} eq 'unknown'; + return('error', "unknown zero-code for $URL", %info); + } + + if ($code == 302) ## 302 is magic for "Found" + { + if (!defined $info{'location'}) { + return('error', "No location info for Found URL $URL", %info); + } + local($newURL) = $info{'location'}; + + ## Remove :80 from hostname, if there. Looks ugly. + $newURL =~ s,^(http:/+[^/:]+):80/,$1/,i; + $info{"NewURL"} = $newURL; + + ## if we're not following links or if it's not to HTTP, return. + return('follow', $newURL, %info) if + $nofollow || $newURL!~m/^http:/i; + + ## note that we've seen this current URL. + $seen{$host, $port, $path} = 1; + + &message(1, qq/[note: now moved to "$newURL"]/) unless $quiet; + + + ## get the new one and return an error if it's been seen. + ($protocol, $host, $port, $path, $target) = + &www'grok_URL($newURL, $noproxy); + &message(1, "[$protocol][$host][$port][$path]") if $debug; + + if (defined $seen{$host, $port, $path}) + { + return('error', "circular reference among:\n ". + join("\n ", sort grep(/^http/i, keys %seen)), %seen); + } + next RETRY; + } + elsif ($code == 500) ## 500 is magic for "internal error" + { + ## + ## A proxy will often return this with text saying "can't find + ## host" when in reality it's just because the nslookup returned + ## null at the time. Such a thing should be retied again after a + ## few seconds. + ## + if ($retry) + { + local($_) = $info{'BODY'} = join('', <HTTP>); + if (/Can't locate remote host:\s*(\S+)/i) { + local($times) = ($retry == 1) ? + "once more" : "up to $retry more times"; + &message(0, "can't locate $1, will try $times ...") + unless $quiet; + sleep(5); + $retry--; + next RETRY; + } + } + } + + if ($code != 200) ## 200 is magic for "OK"; + { + ## I'll deal with these as I see them..... + &clear_message; + if ($info{'TYPE'} eq '') + { + if (defined $http_return_code{$code}) { + $info{'TYPE'} = $http_return_code{$code}; + } else { + $info{'TYPE'} = "(unknown status code $code)"; + } + } + return ('status', $info{'TYPE'}, %info); + } + + &clear_message; + return ('ok', 'ok', %info); + } +} + + +## +## Hyper Text UUencode. Somewhat different from regular uuencode. +## +## Logic taken from Mosaic for X code by Mark Riordan and Ari Luotonen. +## +sub htuu_encode +{ + local(@in) = unpack("C*", $_[0]); + local(@out); + + push(@in, 0, 0); ## in case we need to round off an odd byte or two + while (@in >= 3) { + ## + ## From the next three input bytes, + ## construct four encoded output bytes. + ## + push(@out, $in[0] >> 2); + push(@out, (($in[0] << 4) & 060) | (($in[1] >> 4) & 017)); + push(@out, (($in[1] << 2) & 074) | (($in[2] >> 6) & 003)); + push(@out, $in[2] & 077); + splice(@in, 0, 3); ## remove these three + } + + ## + ## @out elements are now indices to the string below. Convert to + ## the appropriate actual text. + ## + foreach $new (@out) { + $new = substr( + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", + $new, 1); + } + + if (@in == 2) { + ## the two left over are the two extra nulls, so we encoded the proper + ## amount as-is. + } elsif (@in == 1) { + ## We encoded one extra null too many. Undo it. + $out[$#out] = '='; + } else { + ## We must have encoded two nulls... Undo both. + $out[$#out ] = '='; + $out[$#out -1] = '='; + } + + join('', @out); +} + +## +## This message stuff really shouldn't be here, but in some seperate library. +## Sorry. +## +## Called as &message(SAVE, TEXT ....), it shoves the text to the screen. +## If SAVE is true, bumps the text out as a printed line. Otherwise, +## will shove out without a newline so that the next message overwrites it, +## or it is clearded via &clear_message(). +## +sub message +{ + local($nl) = shift; + die "oops $nl." unless $nl =~ m/^\d+$/; + local($text) = join('', @_); + local($NL) = $nl ? "\n" : "\r"; + $thislength = length($text); + if ($thislength >= $last_message_length) { + print STDERR $text, $NL; + } else { + print STDERR $text, ' 'x ($last_message_length-$thislength), $NL; + } + $last_message_length = $nl ? 0 : $thislength; +} + +sub clear_message +{ + if ($last_message_length) { + print STDERR ' ' x $last_message_length, "\r"; + $last_message_length = 0; + } +} + +1; +__END__ diff --git a/win32/config.h b/win32/config.h new file mode 100644 index 0000000000..92768eee09 --- /dev/null +++ b/win32/config.h @@ -0,0 +1,1601 @@ +/* This file (config_H) is a sample config.h file. If you are unable + to successfully run Configure, copy this file to config.h and + edit it to suit your system. +*/ +/* + * This file was produced by running the config_h.SH script, which + * gets its values from config.sh, which is generally produced by + * running Configure. + * + * Feel free to modify any of this as the need arises. Note, however, + * that running config_h.SH again will wipe out any changes you've made. + * For a more permanent change edit config.sh and rerun config_h.SH. + * + * $Id: Config_h.U,v 3.0.1.4 1995/09/25 09:10:49 ram Exp $ + */ + +/* Configuration time: Thu Feb 8 17:15:11 EST 1996 + * Configured by: doughera + * Target system: sunos fractal 5.4 generic_101946-29 i86pc i386 + */ + +#ifndef _config_h_ +#define _config_h_ + +/* MEM_ALIGNBYTES: + * This symbol contains the number of bytes required to align a + * double. Usual values are 2, 4 and 8. + */ +#define MEM_ALIGNBYTES 8 /**/ + +/* ARCHNAME: + * This symbol archtechure name, not used in win32 + */ +#define ARCHNAME "win32" + +/* BIN: + * This symbol holds the path of the bin directory where the package will + * be installed. Program must be prepared to deal with ~name substitution. + */ +#define BIN "/usr/local/bin" /**/ + +/* CAT2: + * This macro catenates 2 tokens together. + */ +#if 42 == 1 +#define CAT2(a,b)a/**/b +#define CAT3(a,b,c)a/**/b/**/c +#define CAT4(a,b,c,d)a/**/b/**/c/**/d +#define CAT5(a,b,c,d,e)a/**/b/**/c/**/d/**/e +#define STRINGIFY(a)"a" + /* If you can get stringification with catify, tell me how! */ +#endif +#if 42 == 42 +#define CAT2(a,b)a ## b +#define CAT3(a,b,c)a ## b ## c +#define CAT4(a,b,c,d)a ## b ## c ## d +#define CAT5(a,b,c,d,e)a ## b ## c ## d ## e +#define StGiFy(a)# a +#define STRINGIFY(a)StGiFy(a) +#define SCAT2(a,b)StGiFy(a) StGiFy(b) +#define SCAT3(a,b,c)StGiFy(a) StGiFy(b) StGiFy(c) +#define SCAT4(a,b,c,d)StGiFy(a) StGiFy(b) StGiFy(c) StGiFy(d) +#define SCAT5(a,b,c,d,e)StGiFy(a) StGiFy(b) StGiFy(c) StGiFy(d) StGiFy(e) +#endif +#ifndef CAT2 +#include "Bletch: How does this C preprocessor catenate tokens?" +#endif + +/* CPPSTDIN: + * This symbol contains the first part of the string which will invoke + * the C preprocessor on the standard input and produce to standard + * output. Typical value of "cc -E" or "/lib/cpp", but it can also + * call a wrapper. See CPPRUN. + */ +/* CPPMINUS: + * This symbol contains the second part of the string which will invoke + * the C preprocessor on the standard input and produce to standard + * output. This symbol will have the value "-" if CPPSTDIN needs a minus + * to specify standard input, otherwise the value is "". + */ +#define CPPSTDIN "cl -E" +#define CPPMINUS "" + +/* HAS_ALARM: + * This symbol, if defined, indicates that the alarm routine is + * available. + */ +#define HAS_ALARM /**/ + +/* HASATTRIBUTE: + * This symbol indicates the C compiler can check for function attributes, + * such as printf formats. This is normally only supported by GNU cc. + */ +/*#define HASATTRIBUTE /**/ +#ifndef HASATTRIBUTE +#define __attribute__(_arg_) +#endif + +/* HAS_BCMP: + * This symbol is defined if the bcmp() routine is available to + * compare blocks of memory. + */ +/*#define HAS_BCMP /**/ + +/* HAS_BCOPY: + * This symbol is defined if the bcopy() routine is available to + * copy blocks of memory. + */ +/*#define HAS_BCOPY /**/ + +/* HAS_BZERO: + * This symbol is defined if the bzero() routine is available to + * set a memory block to 0. + */ +/*#define HAS_BZERO /**/ + +/* CASTI32: + * This symbol is defined if the C compiler can cast negative + * or large floating point numbers to 32-bit ints. + */ +#define CASTI32 /**/ + +/* CASTNEGFLOAT: + * This symbol is defined if the C compiler can cast negative + * numbers to unsigned longs, ints and shorts. + */ +/* CASTFLAGS: + * This symbol contains flags that say what difficulties the compiler + * has casting odd floating values to unsigned long: + * 0 = ok + * 1 = couldn't cast < 0 + * 2 = couldn't cast >= 0x80000000 + * 4 = couldn't cast in argument expression list + */ +#define CASTNEGFLOAT /**/ +#define CASTFLAGS 0 /**/ + +/* HAS_CHOWN: + * This symbol, if defined, indicates that the chown routine is + * available. + */ +/* #define HAS_CHOWN /**/ + +/* HAS_CHROOT: + * This symbol, if defined, indicates that the chroot routine is + * available. + */ +/* #define HAS_CHROOT /**/ + +/* HAS_CHSIZE: + * This symbol, if defined, indicates that the chsize routine is available + * to truncate files. You might need a -lx to get this routine. + */ +#define HAS_CHSIZE /**/ + +/* VOID_CLOSEDIR: + * This symbol, if defined, indicates that the closedir() routine + * does not return a value. + */ +/*#define VOID_CLOSEDIR /**/ + +/* HASCONST: + * This symbol, if defined, indicates that this C compiler knows about + * the const type. There is no need to actually test for that symbol + * within your programs. The mere use of the "const" keyword will + * trigger the necessary tests. + */ +#define HASCONST /**/ +#ifndef HASCONST +#define const +#endif + +/* HAS_CRYPT: + * This symbol, if defined, indicates that the crypt routine is available + * to encrypt passwords and the like. + */ +/* #define HAS_CRYPT /**/ + +/* HAS_CUSERID: + * This symbol, if defined, indicates that the cuserid routine is + * available to get character login names. + */ +/* #define HAS_CUSERID /**/ + +/* HAS_DBL_DIG: + * This symbol, if defined, indicates that this system's <float.h> + * or <limits.h> defines the symbol DBL_DIG, which is the number + * of significant digits in a double precision number. If this + * symbol is not defined, a guess of 15 is usually pretty good. + */ +#define HAS_DBL_DIG /* */ + +/* HAS_DIFFTIME: + * This symbol, if defined, indicates that the difftime routine is + * available. + */ +#define HAS_DIFFTIME /**/ + +/* HAS_DLERROR: + * This symbol, if defined, indicates that the dlerror routine is + * available to return a string describing the last error that + * occurred from a call to dlopen(), dlclose() or dlsym(). + */ +#define HAS_DLERROR /**/ + +/* HAS_DUP2: + * This symbol, if defined, indicates that the dup2 routine is + * available to duplicate file descriptors. + */ +#define HAS_DUP2 /**/ + +/* HAS_FCHMOD: + * This symbol, if defined, indicates that the fchmod routine is available + * to change mode of opened files. If unavailable, use chmod(). + */ +/*#define HAS_FCHMOD /**/ + +/* HAS_FCHOWN: + * This symbol, if defined, indicates that the fchown routine is available + * to change ownership of opened files. If unavailable, use chown(). + */ +/*#define HAS_FCHOWN /**/ + +/* HAS_FCNTL: + * This symbol, if defined, indicates to the C program that + * the fcntl() function exists. + */ +/*#define HAS_FCNTL /**/ + +/* HAS_FGETPOS: + * This symbol, if defined, indicates that the fgetpos routine is + * available to get the file position indicator, similar to ftell(). + */ +#define HAS_FGETPOS /**/ + +/* FLEXFILENAMES: + * This symbol, if defined, indicates that the system supports filenames + * longer than 14 characters. + */ +#define FLEXFILENAMES /**/ + +/* HAS_FLOCK: + * This symbol, if defined, indicates that the flock routine is + * available to do file locking. + */ +/*#define HAS_FLOCK /**/ + +/* HAS_FORK: + * This symbol, if defined, indicates that the fork routine is + * available. + */ +/*#define HAS_FORK /**/ + +/* HAS_FSETPOS: + * This symbol, if defined, indicates that the fsetpos routine is + * available to set the file position indicator, similar to fseek(). + */ +#define HAS_FSETPOS /**/ + +/* HAS_GETGROUPS: + * This symbol, if defined, indicates that the getgroups() routine is + * available to get the list of process groups. If unavailable, multiple + * groups are probably not supported. + */ +/*#define HAS_GETGROUPS /**/ + +/* HAS_GETHOSTENT: + * This symbol, if defined, indicates that the gethostent routine is + * available to lookup host names in some data base or other. + */ +/*#define HAS_GETHOSTENT /**/ + +/* HAS_UNAME: + * This symbol, if defined, indicates that the C program may use the + * uname() routine to derive the host name. See also HAS_GETHOSTNAME + * and PHOSTNAME. + */ +/*#define HAS_UNAME /**/ + +/* HAS_GETLOGIN: + * This symbol, if defined, indicates that the getlogin routine is + * available to get the login name. + */ +/*#define HAS_GETLOGIN /**/ + +/* HAS_GETPGRP: + * This symbol, if defined, indicates that the getpgrp routine is + * available to get the current process group. + */ +/*#define HAS_GETPGRP /**/ + +/* HAS_GETPGRP2: + * This symbol, if defined, indicates that the getpgrp2() (as in DG/UX) + * routine is available to get the current process group. + */ +/*#define HAS_GETPGRP2 /**/ + +/* HAS_GETPPID: + * This symbol, if defined, indicates that the getppid routine is + * available to get the parent process ID. + */ +/*#define HAS_GETPPID /**/ + +/* HAS_GETPRIORITY: + * This symbol, if defined, indicates that the getpriority routine is + * available to get a process's priority. + */ +/*#define HAS_GETPRIORITY /**/ + +/* HAS_HTONL: + * This symbol, if defined, indicates that the htonl() routine (and + * friends htons() ntohl() ntohs()) are available to do network + * order byte swapping. + */ +/* HAS_HTONS: + * This symbol, if defined, indicates that the htons() routine (and + * friends htonl() ntohl() ntohs()) are available to do network + * order byte swapping. + */ +/* HAS_NTOHL: + * This symbol, if defined, indicates that the ntohl() routine (and + * friends htonl() htons() ntohs()) are available to do network + * order byte swapping. + */ +/* HAS_NTOHS: + * This symbol, if defined, indicates that the ntohs() routine (and + * friends htonl() htons() ntohl()) are available to do network + * order byte swapping. + */ +#define HAS_HTONL /**/ +#define HAS_HTONS /**/ +#define HAS_NTOHL /**/ +#define HAS_NTOHS /**/ + +/* HAS_ISASCII: + * This manifest constant lets the C program know that isascii + * is available. + */ +#define HAS_ISASCII /**/ + +/* HAS_KILLPG: + * This symbol, if defined, indicates that the killpg routine is available + * to kill process groups. If unavailable, you probably should use kill + * with a negative process number. + */ +/*#define HAS_KILLPG /**/ + +/* HAS_LINK: + * This symbol, if defined, indicates that the link routine is + * available to create hard links. + */ +/*#define HAS_LINK /**/ + +/* HAS_LOCALECONV: + * This symbol, if defined, indicates that the localeconv routine is + * available for numeric and monetary formatting conventions. + */ +#define HAS_LOCALECONV /**/ + +/* HAS_LOCKF: + * This symbol, if defined, indicates that the lockf routine is + * available to do file locking. + */ +/*#define HAS_LOCKF /**/ + +/* HAS_LSTAT: + * This symbol, if defined, indicates that the lstat routine is + * available to do file stats on symbolic links. + */ +/*#define HAS_LSTAT /**/ + +/* HAS_MBLEN: + * This symbol, if defined, indicates that the mblen routine is available + * to find the number of bytes in a multibye character. + */ +#define HAS_MBLEN /**/ + +/* HAS_MBSTOWCS: + * This symbol, if defined, indicates that the mbstowcs routine is + * available to covert a multibyte string into a wide character string. + */ +#define HAS_MBSTOWCS /**/ + +/* HAS_MBTOWC: + * This symbol, if defined, indicates that the mbtowc routine is available + * to covert a multibyte to a wide character. + */ +#define HAS_MBTOWC /**/ + +/* HAS_MEMCMP: + * This symbol, if defined, indicates that the memcmp routine is available + * to compare blocks of memory. + */ +#define HAS_MEMCMP /**/ + +/* HAS_MEMCPY: + * This symbol, if defined, indicates that the memcpy routine is available + * to copy blocks of memory. + */ +#define HAS_MEMCPY /**/ + +/* HAS_MEMMOVE: + * This symbol, if defined, indicates that the memmove routine is available + * to copy potentially overlapping blocks of memory. This should be used + * only when HAS_SAFE_BCOPY is not defined. If neither is there, roll your + * own version. + */ +#define HAS_MEMMOVE /**/ + +/* HAS_MEMSET: + * This symbol, if defined, indicates that the memset routine is available + * to set blocks of memory. + */ +#define HAS_MEMSET /**/ + +/* HAS_MKDIR: + * This symbol, if defined, indicates that the mkdir routine is available + * to create directories. Otherwise you should fork off a new process to + * exec /bin/mkdir. + */ +#define HAS_MKDIR /**/ + +/* HAS_MKFIFO: + * This symbol, if defined, indicates that the mkfifo routine is + * available to create FIFOs. Otherwise, mknod should be able to + * do it for you. However, if mkfifo is there, mknod might require + * super-user privileges which mkfifo will not. + */ +/*#define HAS_MKFIFO /**/ + +/* HAS_MKTIME: + * This symbol, if defined, indicates that the mktime routine is + * available. + */ +#define HAS_MKTIME /**/ + +/* HAS_MSG: + * This symbol, if defined, indicates that the entire msg*(2) library is + * supported (IPC mechanism based on message queues). + */ +/*#define HAS_MSG /**/ + +/* HAS_NICE: + * This symbol, if defined, indicates that the nice routine is + * available. + */ +/*#define HAS_NICE /**/ + +/* HAS_OPEN3: + * This manifest constant lets the C program know that the three + * argument form of open(2) is available. + */ +/*#define HAS_OPEN3 /**/ + +/* HAS_PATHCONF: + * This symbol, if defined, indicates that pathconf() is available + * to determine file-system related limits and options associated + * with a given filename. + */ +/* HAS_FPATHCONF: + * This symbol, if defined, indicates that pathconf() is available + * to determine file-system related limits and options associated + * with a given open file descriptor. + */ +/* #define HAS_PATHCONF /**/ +/* #define HAS_FPATHCONF /**/ + +/* HAS_PAUSE: + * This symbol, if defined, indicates that the pause routine is + * available to suspend a process until a signal is received. + */ +#define HAS_PAUSE /**/ + +/* HAS_PIPE: + * This symbol, if defined, indicates that the pipe routine is + * available to create an inter-process channel. + */ +#define HAS_PIPE /**/ + +/* HAS_POLL: + * This symbol, if defined, indicates that the poll routine is + * available to poll active file descriptors. + */ +/* #define HAS_POLL /**/ + +/* HAS_READDIR: + * This symbol, if defined, indicates that the readdir routine is + * available to read directory entries. You may have to include + * <dirent.h>. See I_DIRENT. + */ +#define HAS_READDIR /**/ + +/* HAS_SEEKDIR: + * This symbol, if defined, indicates that the seekdir routine is + * available. You may have to include <dirent.h>. See I_DIRENT. + */ +#define HAS_SEEKDIR /**/ + +/* HAS_TELLDIR: + * This symbol, if defined, indicates that the telldir routine is + * available. You may have to include <dirent.h>. See I_DIRENT. + */ +#define HAS_TELLDIR /**/ + +/* HAS_REWINDDIR: + * This symbol, if defined, indicates that the rewinddir routine is + * available. You may have to include <dirent.h>. See I_DIRENT. + */ +#define HAS_REWINDDIR /**/ + +/* HAS_READLINK: + * This symbol, if defined, indicates that the readlink routine is + * available to read the value of a symbolic link. + */ +/* #define HAS_READLINK /**/ + +/* HAS_RENAME: + * This symbol, if defined, indicates that the rename routine is available + * to rename files. Otherwise you should do the unlink(), link(), unlink() + * trick. + */ +#define HAS_RENAME /**/ + +/* HAS_RMDIR: + * This symbol, if defined, indicates that the rmdir routine is + * available to remove directories. Otherwise you should fork off a + * new process to exec /bin/rmdir. + */ +#define HAS_RMDIR /**/ + +/* HAS_SAFE_BCOPY: + * This symbol, if defined, indicates that the bcopy routine is available + * to copy potentially overlapping memory blocks. Otherwise you should + * probably use memmove() or memcpy(). If neither is defined, roll your + * own version. + */ +/*#define HAS_SAFE_BCOPY /**/ + +/* HAS_SAFE_MEMCPY: + * This symbol, if defined, indicates that the memcpy routine is available + * to copy potentially overlapping memory blocks. Otherwise you should + * probably use memmove() or memcpy(). If neither is defined, roll your + * own version. + */ +/*#define HAS_SAFE_MEMCPY /**/ + +/* HAS_SELECT: + * This symbol, if defined, indicates that the select routine is + * available to select active file descriptors. If the timeout field + * is used, <sys/time.h> may need to be included. + */ +#define HAS_SELECT /**/ + +/* HAS_SEM: + * This symbol, if defined, indicates that the entire sem*(2) library is + * supported. + */ +/* #define HAS_SEM /**/ + +/* HAS_SETEGID: + * This symbol, if defined, indicates that the setegid routine is available + * to change the effective gid of the current program. + */ +/* #define HAS_SETEGID /**/ + +/* HAS_SETEUID: + * This symbol, if defined, indicates that the seteuid routine is available + * to change the effective uid of the current program. + */ +/* #define HAS_SETEUID /**/ + +/* HAS_SETLINEBUF: + * This symbol, if defined, indicates that the setlinebuf routine is + * available to change stderr or stdout from block-buffered or unbuffered + * to a line-buffered mode. + */ +/*#define HAS_SETLINEBUF /**/ + +/* HAS_SETLOCALE: + * This symbol, if defined, indicates that the setlocale routine is + * available to handle locale-specific ctype implementations. + */ +#define HAS_SETLOCALE /**/ + +/* HAS_SETPGID: + * This symbol, if defined, indicates that the setpgid routine is + * available to set process group ID. + */ +/* #define HAS_SETPGID /**/ + +/* HAS_SETPGRP: + * This symbol, if defined, indicates that the setpgrp routine is + * available to set the current process group. + */ +/* USE_BSDPGRP: + * This symbol, if defined, indicates that the BSD notion of process + * group is to be used. For instance, you have to say setpgrp(pid, pgrp) + * instead of the USG setpgrp(). + */ +/* #define HAS_SETPGRP /**/ +/*#define USE_BSDPGRP /**/ + +/* HAS_SETPGRP2: + * This symbol, if defined, indicates that the setpgrp2() (as in DG/UX) + * routine is available to set the current process group. + */ +/*#define HAS_SETPGRP2 /**/ + +/* HAS_SETPRIORITY: + * This symbol, if defined, indicates that the setpriority routine is + * available to set a process's priority. + */ +/*#define HAS_SETPRIORITY /**/ + +/* HAS_SETREGID: + * This symbol, if defined, indicates that the setregid routine is + * available to change the real and effective gid of the current + * process. + */ +/* HAS_SETRESGID: + * This symbol, if defined, indicates that the setresgid routine is + * available to change the real, effective and saved gid of the current + * process. + */ +/*#define HAS_SETREGID /**/ +/*#define HAS_SETRESGID /**/ + +/* HAS_SETREUID: + * This symbol, if defined, indicates that the setreuid routine is + * available to change the real and effective uid of the current + * process. + */ +/* HAS_SETRESUID: + * This symbol, if defined, indicates that the setresuid routine is + * available to change the real, effective and saved uid of the current + * process. + */ +/*#define HAS_SETREUID /**/ +/*#define HAS_SETRESUID /**/ + +/* HAS_SETRGID: + * This symbol, if defined, indicates that the setrgid routine is available + * to change the real gid of the current program. + */ +/*#define HAS_SETRGID /**/ + +/* HAS_SETRUID: + * This symbol, if defined, indicates that the setruid routine is available + * to change the real uid of the current program. + */ +/*#define HAS_SETRUID /**/ + +/* HAS_SETSID: + * This symbol, if defined, indicates that the setsid routine is + * available to set the process group ID. + */ +/* #define HAS_SETSID /**/ + +/* HAS_SHM: + * This symbol, if defined, indicates that the entire shm*(2) library is + * supported. + */ +/* #define HAS_SHM /**/ + +/* Shmat_t: + * This symbol holds the return type of the shmat() system call. + * Usually set to 'void *' or 'char *'. + */ +/* HAS_SHMAT_PROTOTYPE: + * This symbol, if defined, indicates that the sys/shm.h includes + * a prototype for shmat(). Otherwise, it is up to the program to + * guess one. Shmat_t shmat _((int, Shmat_t, int)) is a good guess, + * but not always right so it should be emitted by the program only + * when HAS_SHMAT_PROTOTYPE is not defined to avoid conflicting defs. + */ +/* #define Shmat_t void * /**/ +/* #define HAS_SHMAT_PROTOTYPE /**/ + +/* HAS_SIGACTION: + * This symbol, if defined, indicates that Vr4's sigaction() routine + * is available. + */ +/* #define HAS_SIGACTION /**/ + +/* HAS_SOCKET: + * This symbol, if defined, indicates that the BSD socket interface is + * supported. + */ +/* HAS_SOCKETPAIR: + * This symbol, if defined, indicates that the BSD socketpair() call is + * supported. + */ +#define HAS_SOCKET /**/ +/* #define HAS_SOCKETPAIR /**/ + +/* USE_STAT_BLOCKS: + * This symbol is defined if this system has a stat structure declaring + * st_blksize and st_blocks. + */ +/* #define USE_STAT_BLOCKS /**/ + +/* USE_STDIO_PTR: + * This symbol is defined if the _ptr and _cnt fields (or similar) + * of the stdio FILE structure can be used to access the stdio buffer + * for a file handle. If this is defined, then the FILE_ptr(fp) + * and FILE_cnt(fp) macros will also be defined and should be used + * to access these fields. + */ +/* USE_STDIO_BASE: + * This symbol is defined if the _base field (or similar) of the + * stdio FILE structure can be used to access the stdio buffer for + * a file handle. If this is defined, then the FILE_base(fp) macro + * will also be defined and should be used to access this field. + * Also, the FILE_bufsiz(fp) macro will be defined and should be used + * to determine the number of bytes in the buffer. USE_STDIO_BASE + * will never be defined unless USE_STDIO_PTR is. + */ +#define USE_STDIO_PTR /**/ +#define USE_STDIO_BASE /**/ + +/* FILE_ptr: + * This macro is used to access the _ptr field (or equivalent) of the + * FILE structure pointed to by its argument. This macro will always be + * defined if USE_STDIO_PTR is defined. + */ +/* STDIO_PTR_LVALUE: + * This symbol is defined if the FILE_ptr macro can be used as an + * lvalue. + */ +/* FILE_cnt: + * This macro is used to access the _cnt field (or equivalent) of the + * FILE structure pointed to by its argument. This macro will always be + * defined if USE_STDIO_PTR is defined. + */ +/* STDIO_CNT_LVALUE: + * This symbol is defined if the FILE_cnt macro can be used as an + * lvalue. + */ +#ifdef USE_STDIO_PTR +#define FILE_ptr(fp) ((fp)->_ptr) +#define STDIO_PTR_LVALUE /**/ +#define FILE_cnt(fp) ((fp)->_cnt) +#define STDIO_CNT_LVALUE /**/ +#endif + +/* FILE_base: + * This macro is used to access the _base field (or equivalent) of the + * FILE structure pointed to by its argument. This macro will always be + * defined if USE_STDIO_BASE is defined. + */ +/* FILE_bufsiz: + * This macro is used to determine the number of bytes in the I/O + * buffer pointed to by _base field (or equivalent) of the FILE + * structure pointed to its argument. This macro will always be defined + * if USE_STDIO_BASE is defined. + */ +#ifdef USE_STDIO_BASE +#define FILE_base(fp) ((fp)->_base) +#define FILE_bufsiz(fp) ((fp)->_cnt + (fp)->_ptr - (fp)->_base) +#endif + +/* HAS_STRCHR: + * This symbol is defined to indicate that the strchr()/strrchr() + * functions are available for string searching. If not, try the + * index()/rindex() pair. + */ +/* HAS_INDEX: + * This symbol is defined to indicate that the index()/rindex() + * functions are available for string searching. + */ +#define HAS_STRCHR /**/ +/*#define HAS_INDEX /**/ + +/* HAS_STRCOLL: + * This symbol, if defined, indicates that the strcoll routine is + * available to compare strings using collating information. + */ +#define HAS_STRCOLL /**/ + +/* USE_STRUCT_COPY: + * This symbol, if defined, indicates that this C compiler knows how + * to copy structures. If undefined, you'll need to use a block copy + * routine of some sort instead. + */ +#define USE_STRUCT_COPY /**/ + +/* HAS_STRERROR: + * This symbol, if defined, indicates that the strerror routine is + * available to translate error numbers to strings. See the writeup + * of Strerror() in this file before you try to define your own. + */ +/* HAS_SYS_ERRLIST: + * This symbol, if defined, indicates that the sys_errlist array is + * available to translate error numbers to strings. The extern int + * sys_nerr gives the size of that table. + */ +/* Strerror: + * This preprocessor symbol is defined as a macro if strerror() is + * not available to translate error numbers to strings but sys_errlist[] + * array is there. + */ +#define HAS_STRERROR /**/ +#define HAS_SYS_ERRLIST /**/ +#define Strerror(e) strerror(e) + +/* HAS_STRXFRM: + * This symbol, if defined, indicates that the strxfrm() routine is + * available to transform strings. + */ +#define HAS_STRXFRM /**/ + +/* HAS_SYMLINK: + * This symbol, if defined, indicates that the symlink routine is available + * to create symbolic links. + */ +/* #define HAS_SYMLINK /**/ + +/* HAS_SYSCALL: + * This symbol, if defined, indicates that the syscall routine is + * available to call arbitrary system calls. If undefined, that's tough. + */ +/* #define HAS_SYSCALL /**/ + +/* HAS_SYSCONF: + * This symbol, if defined, indicates that sysconf() is available + * to determine system related limits and options. + */ +/* #define HAS_SYSCONF /**/ + +/* HAS_SYSTEM: + * This symbol, if defined, indicates that the system routine is + * available to issue a shell command. + */ +#define HAS_SYSTEM /**/ + +/* HAS_TCGETPGRP: + * This symbol, if defined, indicates that the tcgetpgrp routine is + * available to get foreground process group ID. + */ +/* #define HAS_TCGETPGRP /**/ + +/* HAS_TCSETPGRP: + * This symbol, if defined, indicates that the tcsetpgrp routine is + * available to set foreground process group ID. + */ +/* #define HAS_TCSETPGRP /**/ + +/* Time_t: + * This symbol holds the type returned by time(). It can be long, + * or time_t on BSD sites (in which case <sys/types.h> should be + * included). + */ +#define Time_t time_t /* Time type */ + +/* HAS_TIMES: + * This symbol, if defined, indicates that the times() routine exists. + * Note that this became obsolete on some systems (SUNOS), which now + * use getrusage(). It may be necessary to include <sys/times.h>. + */ +#define HAS_TIMES /**/ + +/* HAS_TRUNCATE: + * This symbol, if defined, indicates that the truncate routine is + * available to truncate files. + */ +/* #define HAS_TRUNCATE /**/ + +/* HAS_TZNAME: + * This symbol, if defined, indicates that the tzname[] array is + * available to access timezone names. + */ +#define HAS_TZNAME /**/ + +/* HAS_UMASK: + * This symbol, if defined, indicates that the umask routine is + * available to set and get the value of the file creation mask. + */ +#define HAS_UMASK /**/ + +/* HAS_VFORK: + * This symbol, if defined, indicates that vfork() exists. + */ +/*#define HAS_VFORK /**/ + +/* Signal_t: + * This symbol's value is either "void" or "int", corresponding to the + * appropriate return type of a signal handler. Thus, you can declare + * a signal handler using "Signal_t (*handler)()", and define the + * handler using "Signal_t handler(sig)". + */ +#define Signal_t void /* Signal handler's return type */ + +/* HASVOLATILE: + * This symbol, if defined, indicates that this C compiler knows about + * the volatile declaration. + */ +#define HASVOLATILE /**/ +#ifndef HASVOLATILE +#define volatile +#endif + +/* HAS_VPRINTF: + * This symbol, if defined, indicates that the vprintf routine is available + * to printf with a pointer to an argument list. If unavailable, you + * may need to write your own, probably in terms of _doprnt(). + */ +/* USE_CHAR_VSPRINTF: + * This symbol is defined if this system has vsprintf() returning type + * (char*). The trend seems to be to declare it as "int vsprintf()". It + * is up to the package author to declare vsprintf correctly based on the + * symbol. + */ +#define HAS_VPRINTF /**/ +/*#define USE_CHAR_VSPRINTF /**/ + +/* HAS_WAIT4: + * This symbol, if defined, indicates that wait4() exists. + */ +/*#define HAS_WAIT4 /**/ + +/* HAS_WAITPID: + * This symbol, if defined, indicates that the waitpid routine is + * available to wait for child process. + */ +/* #define HAS_WAITPID /**/ + +/* HAS_WCSTOMBS: + * This symbol, if defined, indicates that the wcstombs routine is + * available to convert wide character strings to multibyte strings. + */ +#define HAS_WCSTOMBS /**/ + +/* HAS_WCTOMB: + * This symbol, if defined, indicates that the wctomb routine is available + * to covert a wide character to a multibyte. + */ +#define HAS_WCTOMB /**/ + +/* Fpos_t: + * This symbol holds the type used to declare file positions in libc. + * It can be fpos_t, long, uint, etc... It may be necessary to include + * <sys/types.h> to get any typedef'ed information. + */ +#define Fpos_t fpos_t /* File position type */ + +/* Gid_t: + * This symbol holds the return type of getgid() and the type of + * argument to setrgid() and related functions. Typically, + * it is the type of group ids in the kernel. It can be int, ushort, + * uid_t, etc... It may be necessary to include <sys/types.h> to get + * any typedef'ed information. + */ +#define Gid_t gid_t /* Type for getgid(), etc... */ + +/* Groups_t: + * This symbol holds the type used for the second argument to + * getgroups(). Usually, this is the same of gidtype, but + * sometimes it isn't. It can be int, ushort, uid_t, etc... + * It may be necessary to include <sys/types.h> to get any + * typedef'ed information. This is only required if you have + * getgroups(). + */ +#ifdef HAS_GETGROUPS +#define Groups_t gid_t /* Type for 2nd arg to getgroups() */ +#endif + +/* DB_Prefix_t: + * This symbol contains the type of the prefix structure element + * in the <db.h> header file. In older versions of DB, it was + * int, while in newer ones it is u_int32_t. + */ +/* DB_Hash_t: + * This symbol contains the type of the prefix structure element + * in the <db.h> header file. In older versions of DB, it was + * int, while in newer ones it is size_t. + */ +#define DB_Hash_t int /**/ +#define DB_Prefix_t int /**/ + +/* I_DIRENT: + * This symbol, if defined, indicates to the C program that it should + * include <dirent.h>. Using this symbol also triggers the definition + * of the Direntry_t define which ends up being 'struct dirent' or + * 'struct direct' depending on the availability of <dirent.h>. + */ +/* DIRNAMLEN: + * This symbol, if defined, indicates to the C program that the length + * of directory entry names is provided by a d_namlen field. Otherwise + * you need to do strlen() on the d_name field. + */ +/* Direntry_t: + * This symbol is set to 'struct direct' or 'struct dirent' depending on + * whether dirent is available or not. You should use this pseudo type to + * portably declare your directory entries. + */ +#define I_DIRENT /**/ +#define DIRNAMLEN /**/ +#define Direntry_t struct direct + +/* I_DLFCN: + * This symbol, if defined, indicates that <dlfcn.h> exists and should + * be included. + */ +#define I_DLFCN /**/ + +/* I_FCNTL: + * This manifest constant tells the C program to include <fcntl.h>. + */ +#define I_FCNTL /**/ + +/* I_FLOAT: + * This symbol, if defined, indicates to the C program that it should + * include <float.h> to get definition of symbols like DBL_MAX or + * DBL_MIN, i.e. machine dependent floating point values. + */ +#define I_FLOAT /**/ + +/* I_GRP: + * This symbol, if defined, indicates to the C program that it should + * include <grp.h>. + */ +#define I_GRP /**/ + +/* I_LIMITS: + * This symbol, if defined, indicates to the C program that it should + * include <limits.h> to get definition of symbols like WORD_BIT or + * LONG_MAX, i.e. machine dependant limitations. + */ +#define I_LIMITS /**/ + +/* I_MATH: + * This symbol, if defined, indicates to the C program that it should + * include <math.h>. + */ +#define I_MATH /**/ + +/* I_MEMORY: + * This symbol, if defined, indicates to the C program that it should + * include <memory.h>. + */ +/*#define I_MEMORY /**/ + +/* I_NDBM: + * This symbol, if defined, indicates that <ndbm.h> exists and should + * be included. + */ +#define I_NDBM /**/ + +/* I_NET_ERRNO: + * This symbol, if defined, indicates that <net/errno.h> exists and + * should be included. + */ +/*#define I_NET_ERRNO /**/ + +/* I_NETINET_IN: + * This symbol, if defined, indicates to the C program that it should + * include <netinet/in.h>. Otherwise, you may try <sys/in.h>. + */ +/*#define I_NETINET_IN /**/ + +/* I_PWD: + * This symbol, if defined, indicates to the C program that it should + * include <pwd.h>. + */ +/* PWQUOTA: + * This symbol, if defined, indicates to the C program that struct passwd + * contains pw_quota. + */ +/* PWAGE: + * This symbol, if defined, indicates to the C program that struct passwd + * contains pw_age. + */ +/* PWCHANGE: + * This symbol, if defined, indicates to the C program that struct passwd + * contains pw_change. + */ +/* PWCLASS: + * This symbol, if defined, indicates to the C program that struct passwd + * contains pw_class. + */ +/* PWEXPIRE: + * This symbol, if defined, indicates to the C program that struct passwd + * contains pw_expire. + */ +/* PWCOMMENT: + * This symbol, if defined, indicates to the C program that struct passwd + * contains pw_comment. + */ +/*#define I_PWD /**/ +/*#define PWQUOTA /**/ +/*#define PWAGE /**/ +/*#define PWCHANGE /**/ +/*#define PWCLASS /**/ +/*#define PWEXPIRE /**/ +/*#define PWCOMMENT /**/ + +/* I_STDDEF: + * This symbol, if defined, indicates that <stddef.h> exists and should + * be included. + */ +#define I_STDDEF /**/ + +/* I_STDLIB: + * This symbol, if defined, indicates that <stdlib.h> exists and should + * be included. + */ +#define I_STDLIB /**/ + +/* I_STRING: + * This symbol, if defined, indicates to the C program that it should + * include <string.h> (USG systems) instead of <strings.h> (BSD systems). + */ +#define I_STRING /**/ + +/* I_SYS_DIR: + * This symbol, if defined, indicates to the C program that it should + * include <sys/dir.h>. + */ +/*#define I_SYS_DIR /**/ + +/* I_SYS_FILE: + * This symbol, if defined, indicates to the C program that it should + * include <sys/file.h> to get definition of R_OK and friends. + */ +/*#define I_SYS_FILE /**/ + +/* I_SYS_IOCTL: + * This symbol, if defined, indicates that <sys/ioctl.h> exists and should + * be included. Otherwise, include <sgtty.h> or <termio.h>. + */ +/*#define I_SYS_IOCTL /**/ + +/* I_SYS_NDIR: + * This symbol, if defined, indicates to the C program that it should + * include <sys/ndir.h>. + */ +/*#define I_SYS_NDIR /**/ + +/* I_SYS_PARAM: + * This symbol, if defined, indicates to the C program that it should + * include <sys/param.h>. + */ +/*#define I_SYS_PARAM /**/ + +/* I_SYS_SELECT: + * This symbol, if defined, indicates to the C program that it should + * include <sys/select.h> in order to get definition of struct timeval. + */ +/* #define I_SYS_SELECT /**/ + +/* I_SYS_TIMES: + * This symbol, if defined, indicates to the C program that it should + * include <sys/times.h>. + */ +/*#define I_SYS_TIMES /**/ + +/* I_SYS_TYPES: + * This symbol, if defined, indicates to the C program that it should + * include <sys/types.h>. + */ +#define I_SYS_TYPES /**/ + +/* I_SYS_UN: + * This symbol, if defined, indicates to the C program that it should + * include <sys/un.h> to get UNIX domain socket definitions. + */ +/*#define I_SYS_UN /**/ + +/* I_TERMIO: + * This symbol, if defined, indicates that the program should include + * <termio.h> rather than <sgtty.h>. There are also differences in + * the ioctl() calls that depend on the value of this symbol. + */ +/* I_TERMIOS: + * This symbol, if defined, indicates that the program should include + * the POSIX termios.h rather than sgtty.h or termio.h. + * There are also differences in the ioctl() calls that depend on the + * value of this symbol. + */ +/* I_SGTTY: + * This symbol, if defined, indicates that the program should include + * <sgtty.h> rather than <termio.h>. There are also differences in + * the ioctl() calls that depend on the value of this symbol. + */ +/*#define I_TERMIO /**/ +/*#define I_TERMIOS /**/ +/*#define I_SGTTY /**/ + +/* I_TIME: + * This symbol, if defined, indicates to the C program that it should + * include <time.h>. + */ +/* I_SYS_TIME: + * This symbol, if defined, indicates to the C program that it should + * include <sys/time.h>. + */ +/* I_SYS_TIME_KERNEL: + * This symbol, if defined, indicates to the C program that it should + * include <sys/time.h> with KERNEL defined. + */ +#define I_TIME /**/ +/*#define I_SYS_TIME /**/ +/*#define I_SYS_TIME_KERNEL /**/ + +/* I_UNISTD: + * This symbol, if defined, indicates to the C program that it should + * include <unistd.h>. + */ +/*#define I_UNISTD /**/ + +/* I_UTIME: + * This symbol, if defined, indicates to the C program that it should + * include <utime.h>. + */ +/*#define I_UTIME /**/ + +/* I_VFORK: + * This symbol, if defined, indicates to the C program that it should + * include vfork.h. + */ +/*#define I_VFORK /**/ + +/* Off_t: + * This symbol holds the type used to declare offsets in the kernel. + * It can be int, long, off_t, etc... It may be necessary to include + * <sys/types.h> to get any typedef'ed information. + */ +#define Off_t off_t /* <offset> type */ + +/* Mode_t: + * This symbol holds the type used to declare file modes + * for systems calls. It is usually mode_t, but may be + * int or unsigned short. It may be necessary to include <sys/types.h> + * to get any typedef'ed information. + */ +#define Mode_t mode_t /* file mode parameter for system calls */ + +/* CAN_PROTOTYPE: + * If defined, this macro indicates that the C compiler can handle + * function prototypes. + */ +/* _: + * This macro is used to declare function parameters for folks who want + * to make declarations with prototypes using a different style than + * the above macros. Use double parentheses. For example: + * + * int main _((int argc, char *argv[])); + */ +#define CAN_PROTOTYPE /**/ +#ifdef CAN_PROTOTYPE +#define _(args) args +#else +#define _(args) () +#endif + +/* RANDBITS: + * This symbol contains the number of bits of random number the rand() + * function produces. Usual values are 15, 16, and 31. + */ +#define RANDBITS 15 /**/ + +/* SCRIPTDIR: + * This symbol holds the name of the directory in which the user wants + * to put publicly executable scripts for the package in question. It + * is often a directory that is mounted across diverse architectures. + * Programs must be prepared to deal with ~name expansion. + */ +#define SCRIPTDIR "/usr/local/script" /**/ + +/* Select_fd_set_t: + * This symbol holds the type used for the 2nd, 3rd, and 4th + * arguments to select. Usually, this is 'fd_set *', if HAS_FD_SET + * is defined, and 'int *' otherwise. This is only useful if you + * have select(), of course. + */ +//#define Select_fd_set_t fd_set * /**/ +#define Select_fd_set_t int * /**/ + +/* Size_t: + * This symbol holds the type used to declare length parameters + * for string functions. It is usually size_t, but may be + * unsigned long, int, etc. It may be necessary to include + * <sys/types.h> to get any typedef'ed information. + */ +#define Size_t size_t /* length paramater for string functions */ + +/* SSize_t: + * This symbol holds the type used by functions that return + * a count of bytes or an error condition. It must be a signed type. + * It is usually ssize_t, but may be long or int, etc. + * It may be necessary to include <sys/types.h> or <unistd.h> + * to get any typedef'ed information. + * We will pick a type such that sizeof(SSize_t) == sizeof(Size_t). + */ +#define SSize_t int /* signed count of bytes */ + +/* STDCHAR: + * This symbol is defined to be the type of char used in stdio.h. + * It has the values "unsigned char" or "char". + */ +#define STDCHAR unsigned char /**/ + +/* Uid_t: + * This symbol holds the type used to declare user ids in the kernel. + * It can be int, ushort, uid_t, etc... It may be necessary to include + * <sys/types.h> to get any typedef'ed information. + */ +#define Uid_t uid_t /* UID type */ + +/* VMS: + * This symbol, if defined, indicates that the program is running under + * VMS. It is currently only set in conjunction with the EUNICE symbol. + */ +/*#define VMS /**/ + +/* LOC_SED: + * This symbol holds the complete pathname to the sed program. + */ +#define LOC_SED "/bin/sed" /**/ + +/* ARCHLIB_EXP: + * This symbol contains the ~name expanded version of ARCHLIB, to be used + * in programs that are not prepared to deal with ~ expansion at run-time. + */ +#define ARCHLIB_EXP "/usr/local/lib/perl5/i86pc-solaris/5.002" /**/ + +/* OSNAME + * This symbol defined the name of the OS. in our case WIN32 + * (we don't distinguish between NT or 95) + */ +#define OSNAME "MSWin32" + +/* BYTEORDER: + * This symbol hold the hexadecimal constant defined in byteorder, + * i.e. 0x1234 or 0x4321, etc... + */ +#define BYTEORDER 0x1234 /* large digits for MSB */ + +/* CSH: + * This symbol, if defined, indicates that the C-shell exists. + * If defined, contains the full pathname of csh. + */ +#define CSH "/bin/csh" /**/ + +/* DLSYM_NEEDS_UNDERSCORE: + * This symbol, if defined, indicates that we need to prepend an + * underscore to the symbol name before calling dlsym(). This only + * makes sense if you *have* dlsym, which we will presume is the + * case if you're using dl_dlopen.xs. + */ +/*#define DLSYM_NEEDS_UNDERSCORE /* */ + +/* SETUID_SCRIPTS_ARE_SECURE_NOW: + * This symbol, if defined, indicates that the bug that prevents + * setuid scripts from being secure is not present in this kernel. + */ +/* DOSUID: + * This symbol, if defined, indicates that the C program should + * check the script that it is executing for setuid/setgid bits, and + * attempt to emulate setuid/setgid on systems that have disabled + * setuid #! scripts because the kernel can't do it securely. + * It is up to the package designer to make sure that this emulation + * is done securely. Among other things, it should do an fstat on + * the script it just opened to make sure it really is a setuid/setgid + * script, it should make sure the arguments passed correspond exactly + * to the argument on the #! line, and it should not trust any + * subprocesses to which it must pass the filename rather than the + * file descriptor of the script to be executed. + */ +#define SETUID_SCRIPTS_ARE_SECURE_NOW /**/ +/*#define DOSUID /**/ + +/* Gconvert: + * This preprocessor macro is defined to convert a floating point + * number to a string without a trailing decimal point. This + * emulates the behavior of sprintf("%g"), but is sometimes much more + * efficient. If gconvert() is not available, but gcvt() drops the + * trailing decimal point, then gcvt() is used. If all else fails, + * a macro using sprintf("%g") is used. Arguments for the Gconvert + * macro are: value, number of digits, whether trailing zeros should + * be retained, and the output buffer. + * Possible values are: + * d_Gconvert='gconvert((x),(n),(t),(b))' + * d_Gconvert='gcvt((x),(n),(b))' + * d_Gconvert='sprintf((b),"%.*g",(n),(x))' + * The last two assume trailing zeros should not be kept. + */ +/* WIN32 ?? */ +#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x)) + +/* Sigjmp_buf: + * This is the buffer type to be used with Sigsetjmp and Siglongjmp. + */ +/* Sigsetjmp: + * This macro is used in the same way as sigsetjmp(), but will invoke + * traditional setjmp() if sigsetjmp isn't available. + */ +/* Siglongjmp: + * This macro is used in the same way as siglongjmp(), but will invoke + * traditional longjmp() if siglongjmp isn't available. + */ +/* #define HAS_SIGSETJMP /**/ + +#ifdef HAS_SIGSETJMP +#define Sigjmp_buf sigjmp_buf +#define Sigsetjmp(buf,save_mask) sigsetjmp(buf,save_mask) +#define Siglongjmp(buf,retval) siglongjmp(buf,retval) +#else +#define Sigjmp_buf jmp_buf +#define Sigsetjmp(buf,save_mask) setjmp(buf) +#define Siglongjmp(buf,retval) longjmp(buf,retval) +#endif + +/* USE_DYNAMIC_LOADING: + * This symbol, if defined, indicates that dynamic loading of + * some sort is available. + */ +#define USE_DYNAMIC_LOADING /**/ + +/* I_DBM: + * This symbol, if defined, indicates that <dbm.h> exists and should + * be included. + */ +/* I_RPCSVC_DBM: + * This symbol, if defined, indicates that <rpcsvc/dbm.h> exists and + * should be included. + */ +/*#define I_DBM /**/ +#define I_RPCSVC_DBM /**/ + +/* I_LOCALE: + * This symbol, if defined, indicates to the C program that it should + * include <locale.h>. + */ +#define I_LOCALE /**/ + +/* I_SYS_STAT: + * This symbol, if defined, indicates to the C program that it should + * include <sys/stat.h>. + */ +#define I_SYS_STAT /**/ + +/* I_STDARG: + * This symbol, if defined, indicates that <stdarg.h> exists and should + * be included. + */ +/* I_VARARGS: + * This symbol, if defined, indicates to the C program that it should + * include <varargs.h>. + */ +#define I_STDARG /**/ +/*#define I_VARARGS /**/ + +/* INTSIZE: + * This symbol contains the size of an int, so that the C preprocessor + * can make decisions based on it. + */ +#define INTSIZE 4 /**/ + +/* Free_t: + * This variable contains the return type of free(). It is usually + * void, but occasionally int. + */ +/* Malloc_t: + * This symbol is the type of pointer returned by malloc and realloc. + */ +#define Malloc_t void * /**/ +#define Free_t void /**/ + +/* MYMALLOC: + * This symbol, if defined, indicates that we're using our own malloc. + */ +/*#define MYMALLOC /**/ + +/* VAL_O_NONBLOCK: + * This symbol is to be used during open() or fcntl(F_SETFL) to turn on + * non-blocking I/O for the file descriptor. Note that there is no way + * back, i.e. you cannot turn it blocking again this way. If you wish to + * alternatively switch between blocking and non-blocking, use the + * ioctl(FIOSNBIO) call instead, but that is not supported by all devices. + */ +/* VAL_EAGAIN: + * This symbol holds the errno error code set by read() when no data was + * present on the non-blocking file descriptor. + */ +/* RD_NODATA: + * This symbol holds the return code from read() when no data is present + * on the non-blocking file descriptor. Be careful! If EOF_NONBLOCK is + * not defined, then you can't distinguish between no data and EOF by + * issuing a read(). You'll have to find another way to tell for sure! + */ +/* EOF_NONBLOCK: + * This symbol, if defined, indicates to the C program that a read() on + * a non-blocking file descriptor will return 0 on EOF, and not the value + * held in RD_NODATA (-1 usually, in that case!). + */ +#define VAL_O_NONBLOCK O_NONBLOCK +#define VAL_EAGAIN EAGAIN +#define RD_NODATA -1 +#define EOF_NONBLOCK + +/* OLDARCHLIB_EXP: + * This symbol contains the ~name expanded version of OLDARCHLIB, to be + * used in programs that are not prepared to deal with ~ expansion at + * run-time. + */ +/*#define OLDARCHLIB_EXP "" /**/ + +/* PRIVLIB_EXP: + * This symbol contains the ~name expanded version of PRIVLIB, to be used + * in programs that are not prepared to deal with ~ expansion at run-time. + */ +#define PRIVLIB_EXP (win32PerlLibPath()) /**/ + +/* SH_PATH: + * This symbol contains the full pathname to the shell used on this + * on this system to execute Bourne shell scripts. Usually, this will be + * /bin/sh, though it's possible that some systems will have /bin/ksh, + * /bin/pdksh, /bin/ash, /bin/bash, or even something such as D:/bin/sh. + */ +#define SH_PATH "/bin/sh" /**/ + +/* SIG_NAME: + * This symbol contains a list of signal names in order of + * signal number. This is intended + * to be used as a static array initialization, like this: + * char *sig_name[] = { SIG_NAME }; + * The signals in the list are separated with commas, and each signal + * is surrounded by double quotes. There is no leading SIG in the signal + * name, i.e. SIGQUIT is known as "QUIT". + * Gaps in the signal numbers (up to NSIG) are filled in with NUMnn, + * etc., where nn is the actual signal number (e.g. NUM37). + * The signal number for sig_name[i] is stored in sig_num[i]. + * The last element is 0 to terminate the list with a NULL. This + * corresponds to the 0 at the end of the sig_num list. + */ +/* SIG_NUM: + * This symbol contains a list of signal numbers, in the same order as the + * SIG_NAME list. It is suitable for static array initialization, as in: + * int sig_num[] = { SIG_NUM }; + * The signals in the list are separated with commas, and the indices + * within that list and the SIG_NAME list match, so it's easy to compute + * the signal name from a number or vice versa at the price of a small + * dynamic linear lookup. + * Duplicates are allowed, but are moved to the end of the list. + * The signal number corresponding to sig_name[i] is sig_number[i]. + * if (i < NSIG) then sig_number[i] == i. + * The last element is 0, corresponding to the 0 at the end of + * the sig_name list. + */ +#define SIG_NAME "ZERO","HUP","INT","QUIT","ILL","TRAP","ABRT","EMT","FPE","KILL","BUS","SEGV","SYS","PIPE","ALRM","TERM","USR1","USR2","CHLD","PWR","WINCH","URG","IO","STOP","TSTP","CONT","TTIN","TTOU","VTALRM","PROF","XCPU","XFSZ","WAITING","LWP","FREEZE","THAW","RTMIN","NUM37","NUM38","NUM39","NUM40","NUM41","NUM42","RTMAX","IOT","CLD","POLL",0 /**/ +#define SIG_NUM 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,6,18,22,0 /**/ + +/* SITEARCH_EXP: + * This symbol contains the ~name expanded version of SITEARCH, to be used + * in programs that are not prepared to deal with ~ expansion at run-time. + */ +#define SITEARCH_EXP "/usr/local/lib/perl5/site_perl/i86pc-solaris" /**/ + +/* SITELIB_EXP: + * This symbol contains the ~name expanded version of SITELIB, to be used + * in programs that are not prepared to deal with ~ expansion at run-time. + */ +#define SITELIB_EXP "/usr/local/lib/perl5/site_perl" /**/ + +/* STARTPERL: + * This variable contains the string to put in front of a perl + * script to make sure (one hopes) that it runs with perl and not + * some shell. + */ +#define STARTPERL "#!/usr/local/bin/perl" /**/ + +/* VOIDFLAGS: + * This symbol indicates how much support of the void type is given by this + * compiler. What various bits mean: + * + * 1 = supports declaration of void + * 2 = supports arrays of pointers to functions returning void + * 4 = supports comparisons between pointers to void functions and + * addresses of void functions + * 8 = suports declaration of generic void pointers + * + * The package designer should define VOIDUSED to indicate the requirements + * of the package. This can be done either by #defining VOIDUSED before + * including config.h, or by defining defvoidused in Myinit.U. If the + * latter approach is taken, only those flags will be tested. If the + * level of void support necessary is not present, defines void to int. + */ +#ifndef VOIDUSED +#define VOIDUSED 15 +#endif +#define VOIDFLAGS 15 +#if (VOIDFLAGS & VOIDUSED) != VOIDUSED +#define void int /* is void to be avoided? */ +#define M_VOID /* Xenix strikes again */ +#endif + +#include <win32.h> +#define DEBUGGING +#define MULTIPLCITY +#endif diff --git a/win32/config.w32 b/win32/config.w32 new file mode 100644 index 0000000000..953aba24c6 --- /dev/null +++ b/win32/config.w32 @@ -0,0 +1,479 @@ +# +## This file was hand coded and a lot of information is invalid +# +## Configured by: garyng +## Target system: WIN32 +# + +archlibexp='d:/temp/b/perl5.002/lib' +archname='MSWin32' +cc='cl' +ccflags='-Id:/msdev/include -Id:/temp' +cppflags='-I/usr/local/include' +dlsrc='dl_win32.xs' +dynamic_ext='Fcntl IO Opcode SDBM_File Socket' +extensions='Fcntl IO Opcode SDBM_File Socket' +installarchlib='/u1/garyng/tmp/lib/5.002' +installprivlib='/u1/garyng/tmp/lib/perl5' +libpth='/usr/local/lib /lib /usr/lib /usr/ucblib' +libs='-lgdbm -ldbm -ldl -lm -lc -lposix' +osname='MSWin32' +osvers='4.0' +prefix='~garyng/tmp' +privlibexp='/u1/garyng/tmp/lib/perl5' +sharpbang='#!' +shsharp='true' +sig_name='ZERO HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM URG STOP TSTP CONT CHLD TTIN TTOU IO XCPU XFSZ VTALRM PROF WINCH LOST USR1 USR2 IOT CLD POLL ' +so='dll' +startsh='#!/bin/sh' +static_ext=' ' +Author='' +CONFIG='true' +Date='$Date' +Header='' +Id='$Id' +Locker='' +Log='$Log' +Mcc='Mcc' +PATCHLEVEL='2' +POSIX_cflags='ccflags="$ccflags -DSTRUCT_TM_HASZONE"' +RCSfile='$RCSfile' +Revision='$Revision' +SUBVERSION='0' +Source='' +State='' +afs='false' +alignbytes='8' +aphostname='' +ar='ar' +archlib='~garyng/tmp/lib/perl5/sun4-sunos/5.002' +archobjs='' +awk='awk' +baserev='5.0' +bash='' +bin='~garyng/tmp/bin' +binexp='/u1/garyng/tmp/bin' +bison='' +byacc='byacc' +byteorder='1234' +c='' +castflags='0' +cat='cat' +cccdlflags='-pic' +ccdlflags=' ' +cf_by='garyng' +cf_email='71564.1743@compuserve.com' +cf_time='Thu Apr 11 06:20:49 PDT 1996' +chgrp='' +chmod='' +chown='' +clocktype='clock_t' +comm='comm' +compress='' +contains='grep' +cp='cp' +cpio='' +cpp='cpp' +cpp_stuff='1' +cpplast='' +cppminus='' +cpprun='/usr/lib/cpp' +cppstdin='cppstdin' +cryptlib='' +csh='csh' +d_Gconvert='gconvert((x),(n),(t),(b))' +d_access='define' +d_alarm='define' +d_archlib='define' +d_attribut='undef' +d_bcmp='define' +d_bcopy='define' +d_bsd='define' +d_bsdpgrp='define' +d_bzero='define' +d_casti32='define' +d_castneg='define' +d_charvspr='define' +d_chown='define' +d_chroot='define' +d_chsize='undef' +d_closedir='define' +d_const='undef' +d_crypt='define' +d_csh='define' +d_cuserid='define' +d_dbl_dig='undef' +d_difftime='undef' +d_dirnamlen='define' +d_dlerror='define' +d_dlopen='define' +d_dlsymun='undef' +d_dosuid='undef' +d_dup2='define' +d_eofnblk='define' +d_eunice='undef' +d_fchmod='define' +d_fchown='define' +d_fcntl='define' +d_fd_macros='define' +d_fd_set='define' +d_fds_bits='define' +d_fgetpos='undef' +d_flexfnam='define' +d_flock='define' +d_fork='define' +d_fpathconf='define' +d_fsetpos='undef' +d_getgrps='define' +d_gethent='undef' +d_gethname='undef' +d_getlogin='define' +d_getpgrp2='undef' +d_getpgrp='define' +d_getppid='define' +d_getprior='define' +d_htonl='define' +d_index='undef' +d_isascii='define' +d_killpg='define' +d_link='define' +d_locconv='define' +d_lockf='define' +d_lstat='define' +d_mblen='define' +d_mbstowcs='define' +d_mbtowc='define' +d_memcmp='define' +d_memcpy='define' +d_memmove='undef' +d_memset='define' +d_mkdir='define' +d_mkfifo='define' +d_mktime='define' +d_msg='define' +d_msgctl='define' +d_msgget='define' +d_msgrcv='define' +d_msgsnd='define' +d_mymalloc='define' +d_nice='define' +d_oldarchlib='undef' +d_oldsock='undef' +d_open3='define' +d_pathconf='define' +d_pause='define' +d_phostname='undef' +d_pipe='define' +d_poll='define' +d_portable='define' +d_pwage='define' +d_pwchange='undef' +d_pwclass='undef' +d_pwcomment='define' +d_pwexpire='undef' +d_pwquota='undef' +d_readdir='define' +d_readlink='define' +d_rename='define' +d_rewinddir='define' +d_rmdir='define' +d_safebcpy='define' +d_safemcpy='undef' +d_seekdir='define' +d_select='define' +d_sem='define' +d_semctl='define' +d_semget='define' +d_semop='define' +d_setegid='define' +d_seteuid='define' +d_setlinebuf='define' +d_setlocale='define' +d_setpgid='define' +d_setpgrp2='undef' +d_setpgrp='define' +d_setprior='define' +d_setregid='define' +d_setresgid='undef' +d_setresuid='undef' +d_setreuid='define' +d_setrgid='define' +d_setruid='define' +d_setsid='define' +d_shm='define' +d_shmat='define' +d_shmatprototype='undef' +d_shmctl='define' +d_shmdt='define' +d_shmget='define' +d_shrplib='undef' +d_sigaction='define' +d_sigintrp='' +d_sigsetjmp='define' +d_sigvec='define' +d_sigvectr='undef' +d_socket='define' +d_sockpair='define' +d_statblks='define' +d_stdio_cnt_lval='define' +d_stdio_ptr_lval='define' +d_stdiobase='define' +d_stdstdio='define' +d_strchr='define' +d_strcoll='define' +d_strctcpy='define' +d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])' +d_strerror='undef' +d_strxfrm='define' +d_suidsafe='undef' +d_symlink='define' +d_syscall='define' +d_sysconf='define' +d_sysernlst='' +d_syserrlst='define' +d_system='define' +d_tcgetpgrp='define' +d_tcsetpgrp='define' +d_telldir='define' +d_time='define' +d_times='define' +d_truncate='define' +d_tzname='undef' +d_umask='define' +d_uname='define' +d_vfork='define' +d_void_closedir='undef' +d_voidsig='define' +d_voidtty='' +d_volatile='undef' +d_vprintf='define' +d_wait4='define' +d_waitpid='define' +d_wcstombs='define' +d_wctomb='define' +d_xenix='undef' +date='date' +db_hashtype='int' +db_prefixtype='int' +defvoidused='15' +direntrytype='struct dirent' +dlext='so' +eagain='EAGAIN' +echo='echo' +egrep='egrep' +emacs='' +eunicefix=':' +exe_ext='' +expr='expr' +find='find' +firstmakefile='makefile' +flex='' +fpostype='long' +freetype='int' +full_csh='/usr/bin/csh' +full_sed='/usr/bin/sed' +gcc='' +gccversion='' +gidtype='gid_t' +glibpth='/usr/shlib /lib/pa1.1 /usr/lib/large /lib /usr/lib /usr/lib/386 /lib/386 /lib/large /usr/lib/small /lib/small /usr/ccs/lib /usr/ucblib /usr/shlib ' +grep='grep' +groupcat='' +groupstype='int' +h_fcntl='false' +h_sysfile='true' +hint='recommended' +hostcat='ypcat hosts' +huge='' +i_bsdioctl='' +i_db='undef' +i_dbm='define' +i_dirent='define' +i_dld='undef' +i_dlfcn='define' +i_fcntl='undef' +i_float='undef' +i_gdbm='define' +i_grp='define' +i_limits='define' +i_locale='define' +i_malloc='define' +i_math='define' +i_memory='define' +i_ndbm='define' +i_neterrno='undef' +i_niin='define' +i_pwd='define' +i_rpcsvcdbm='undef' +i_sgtty='undef' +i_stdarg='undef' +i_stddef='define' +i_stdlib='define' +i_string='define' +i_sysdir='define' +i_sysfile='define' +i_sysfilio='define' +i_sysin='undef' +i_sysioctl='define' +i_sysndir='undef' +i_sysparam='define' +i_sysselct='undef' +i_syssockio='' +i_sysstat='define' +i_systime='define' +i_systimek='undef' +i_systimes='define' +i_systypes='define' +i_sysun='define' +i_termio='undef' +i_termios='define' +i_time='undef' +i_unistd='define' +i_utime='define' +i_varargs='define' +i_varhdr='varargs.h' +i_vfork='define' +incpath='' +inews='' +installbin='/u1/garyng/tmp/bin' +installman1dir='/u1/garyng/tmp/man/man1' +installman3dir='/u1/garyng/tmp/lib/perl5/man/man3' +installscript='/u1/garyng/tmp/bin' +installsitearch='/u1/garyng/tmp/lib/perl5/site_perl/sun4-sunos' +installsitelib='/u1/garyng/tmp/lib/perl5/site_perl' +intsize='4' +known_extensions='DB_File Fcntl GDBM_File NDBM_File ODBM_File Opcode POSIX SDBM_File Socket' +ksh='' +large='' +ld='ld' +lddlflags='-assert nodefinitions -L/usr/local/lib' +ldflags=' -L/usr/local/lib' +less='less' +lib_ext='.a' +libc='/lib/libc.so.1.9.2' +libswanted='net socket inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun m c cposix posix ndir dir crypt ucb bsd BSD PW x' +line='line' +lint='' +lkflags='' +ln='ln' +lns='/usr/bin/ln -s' +locincpth='/usr/local/include /opt/local/include /usr/gnu/include /opt/gnu/include /usr/GNU/include /opt/GNU/include' +loclibpth='/usr/local/lib /opt/local/lib /usr/gnu/lib /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib' +lp='' +lpr='' +ls='ls' +lseektype='off_t' +mail='' +mailx='' +make='' +mallocobj='malloc.o' +mallocsrc='malloc.c' +malloctype='char *' +man1dir='~garyng/tmp/man/man1' +man1direxp='/u1/garyng/tmp/man/man1' +man1ext='1' +man3dir='~garyng/tmp/lib/perl5/man/man3' +man3direxp='/u1/garyng/tmp/lib/perl5/man/man3' +man3ext='3' +medium='' +mips='' +mips_type='' +mkdir='mkdir' +models='none' +modetype='mode_t' +more='more' +mv='' +myarchname='sun4-sunos' +mydomain='' +myhostname='' +myuname='' +n='-n' +nm_opt='' +nm_so_opt='' +nroff='nroff' +o_nonblock='O_NONBLOCK' +obj_ext='.obj' +oldarchlib='' +oldarchlibexp='' +optimize='-O' +orderlib='false' +package='perl5' +pager='/usr/local/bin/less' +passcat='' +patchlevel='2' +path_sep=':' +perl='perl' +perladmin='' +perlpath='/u1/garyng/tmp/bin/perl' +pg='pg' +phostname='hostname' +plibpth='' +pmake='' +pr='' +prefixexp='/u1/garyng/tmp' +privlib='~garyng/tmp/lib/perl5' +prototype='undef' +randbits='31' +ranlib='/usr/bin/ranlib' +rd_nodata='-1' +rm='rm' +rmail='' +runnm='true' +scriptdir='~garyng/tmp/bin' +scriptdirexp='/u1/garyng/tmp/bin' +sed='sed' +selecttype='fd_set *' +sendmail='blat' +sh='' +shar='' +shmattype='char *' +shrpdir='none' +sig_num='0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 6 20 23 ' +signal_t='void' +sitearch='~garyng/tmp/lib/perl5/site_perl/sun4-sunos' +sitearchexp='/u1/garyng/tmp/lib/perl5/site_perl/sun4-sunos' +sitelib='~garyng/tmp/lib/perl5/site_perl' +sitelibexp='/u1/garyng/tmp/lib/perl5/site_perl' +sizetype='size_t' +sleep='' +smail='' +small='' +sockethdr='' +socketlib='' +sort='sort' +spackage='Perl5' +spitshell='cat' +split='' +ssizetype='int' +startperl='#!/u1/garyng/tmp/bin/perl' +stdchar='unsigned char' +stdio_base='((fp)->_base)' +stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)' +stdio_cnt='((fp)->_cnt)' +stdio_ptr='((fp)->_ptr)' +strings='/usr/include/string.h' +submit='' +sysman='/usr/man/man1' +tail='' +tar='' +tbl='' +test='test' +timeincl='/usr/include/sys/time.h ' +timetype='time_t' +touch='touch' +tr='tr' +troff='' +uidtype='uid_t' +uname='uname' +uniq='uniq' +usedl='define' +usemymalloc='y' +usenm='true' +useposix='true' +usesafe='true' +usevfork='true' +usrinc='/usr/include' +uuname='' +vi='' +voidflags='15' +xlibpth='/usr/lib/386 /lib/386' +zcat='' diff --git a/win32/dl_win32.xs b/win32/dl_win32.xs new file mode 100644 index 0000000000..47d06c080e --- /dev/null +++ b/win32/dl_win32.xs @@ -0,0 +1,112 @@ +/* dl_win32.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!) + */ + +/* 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 +#include <windows.h> +#include <string.h> + +#include "EXTERN.h" +#include "perl.h" +#include "XSUB.h" + +#include "dlutils.c" /* SaveError() etc */ + +static void +dl_private_init() +{ + (void)dl_generic_private_init(); +} + +static int +dl_static_linked(char *filename) +{ + char **p; + for (p = staticlinkmodules; *p;p++) { + if (strstr(filename, *p)) return 1; + }; + return 0; +} + +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)); + if (dl_static_linked(filename) == 0) + RETVAL = (void*) LoadLibraryEx(filename, NULL, LOAD_WITH_ALTERED_SEARCH_PATH ) ; + else + RETVAL = (void*) GetModuleHandle(NULL); + DLDEBUG(2,fprintf(stderr," libref=%x\n", RETVAL)); + ST(0) = sv_newmortal() ; + if (RETVAL == NULL) + SaveError("%d",GetLastError()) ; + else + 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/win32/dosish.diff b/win32/dosish.diff new file mode 100644 index 0000000000..e0b6df9dcc --- /dev/null +++ b/win32/dosish.diff @@ -0,0 +1,4 @@ +3c3 +< #define BIT_BUCKET "NUL" +--- +> #define BIT_BUCKET "\dev\nul" diff --git a/win32/dosish.h b/win32/dosish.h new file mode 100644 index 0000000000..cca452b9f2 --- /dev/null +++ b/win32/dosish.h @@ -0,0 +1,89 @@ +#define ABORT() abort(); + +#define SH_PATH "/bin/sh" + +#ifdef DJGPP +#define BIT_BUCKET "nul" +#define OP_BINARY O_BINARY +void Perl_DJGPP_init(); +#define PERL_SYS_INIT(argcp, argvp) STMT_START { \ + Perl_DJGPP_init(); } STMT_END +#else +#define PERL_SYS_INIT(c,v) +#define BIT_BUCKET "nul" +#endif + +#define PERL_SYS_TERM() +#define dXSUB_SYS int dummy +#define TMPPATH "plXXXXXX" + +/* + * 5.003_07 and earlier keyed on #ifdef MSDOS for determining if we were + * running on DOS, *and* if we had to cope with 16 bit memory addressing + * constraints, *and* we need to have memory allocated as unsigned long. + * + * with the advent of *real* compilers for DOS, they are not locked together. + * MSDOS means "I am running on MSDOS". HAS_64K_LIMIT means "I have + * 16 bit memory addressing constraints". + * + * if you need the last, try #DEFINE MEM_SIZE unsigned long. + */ +#ifdef MSDOS + #ifndef DJGPP + #define HAS_64K_LIMIT + #endif +#endif + +/* USEMYBINMODE + * This symbol, if defined, indicates that the program should + * use the routine my_binmode(FILE *fp, char iotype) to insure + * that a file is in "binary" mode -- that is, that no translation + * of bytes occurs on read or write operations. + */ +#undef USEMYBINMODE + +/* USE_STAT_RDEV: + * This symbol is defined if this system has a stat structure declaring + * st_rdev + */ +#define USE_STAT_RDEV /**/ + +/* ACME_MESS: + * This symbol, if defined, indicates that error messages should be + * should be generated in a format that allows the use of the Acme + * GUI/editor's autofind feature. + */ +#undef ACME_MESS /**/ + +/* ALTERNATE_SHEBANG: + * This symbol, if defined, contains a "magic" string which may be used + * as the first line of a Perl program designed to be executed directly + * by name, instead of the standard Unix #!. If ALTERNATE_SHEBANG + * begins with a character other then #, then Perl will only treat + * it as a command line if if finds the string "perl" in the first + * word; otherwise it's treated as the first line of code in the script. + * (IOW, Perl won't hand off to another interpreter via an alternate + * shebang sequence that might be legal Perl code.) + */ +/* #define ALTERNATE_SHEBANG "#!" / **/ + +/* + * fwrite1() should be a routine with the same calling sequence as fwrite(), + * but which outputs all of the bytes requested as a single stream (unlike + * fwrite() itself, which on some systems outputs several distinct records + * if the number_of_items parameter is >1). + */ +#define fwrite1 fwrite + +#define Stat(fname,bufptr) win32_stat((fname),(bufptr)) +#define Fstat(fd,bufptr) fstat((fd),(bufptr)) +#define Fflush(fp) fflush(fp) + +#define my_getenv(var) getenv(var) +// +// the following are standard library calls (stdio in particular) +// that is being redirected to the perl DLL. This is needed for +// Dynaloading any modules that called stdio functions +// + +#include <win32iop.h> diff --git a/win32/genxsdef.pl b/win32/genxsdef.pl new file mode 100644 index 0000000000..b00a57e778 --- /dev/null +++ b/win32/genxsdef.pl @@ -0,0 +1,5 @@ +print "LIBRARY $ARGV[0]\n"; +print "CODE LOADONCALL\n"; +print "DATA LOADONCALL NONSHARED MULTIPLE\n"; +print "EXPORTS\n"; +print "\tboot_$ARGV[0]\n" diff --git a/win32/include/arpa/inet.h b/win32/include/arpa/inet.h new file mode 100644 index 0000000000..0303df0876 --- /dev/null +++ b/win32/include/arpa/inet.h @@ -0,0 +1,4 @@ +/* + * this is a dummy header file for Socket.xs + */ + diff --git a/win32/include/dirent.h b/win32/include/dirent.h new file mode 100644 index 0000000000..8cc7e11479 --- /dev/null +++ b/win32/include/dirent.h @@ -0,0 +1,49 @@ +// dirent.h + +// djl +// Provide UNIX compatibility + +#ifndef _INC_DIRENT +#define _INC_DIRENT + +// +// NT versions of readdir(), etc +// From the MSDOS implementation +// + +// Directory entry size +#ifdef DIRSIZ +#undef DIRSIZ +#endif +#define DIRSIZ(rp) (sizeof(struct direct)) + +// needed to compile directory stuff +#define DIRENT direct + +// structure of a directory entry +typedef struct direct +{ + long d_ino; // inode number (not used by MS-DOS) + int d_namlen; // Name length + char d_name[257]; // file name +} _DIRECT; + +// structure for dir operations +typedef struct _dir_struc +{ + char *start; // Starting position + char *curr; // Current position + long size; // Size of string table + long nfiles; // number if filenames in table + struct direct dirstr; // Directory structure to return +} DIR; + +DIR *opendir(char *filename); +struct direct *readdir(DIR *dirp); +long telldir(DIR *dirp); +void seekdir(DIR *dirp,long loc); +void rewinddir(DIR *dirp); +int closedir(DIR *dirp); + + +#endif //_INC_DIRENT diff --git a/win32/include/netdb.h b/win32/include/netdb.h new file mode 100644 index 0000000000..b0c5ea1949 --- /dev/null +++ b/win32/include/netdb.h @@ -0,0 +1,12 @@ +// netdb.h + +// djl +// Provide UNIX compatibility + + +#ifndef _INC_NETDB +#define _INC_NETDB + +#include <sys/socket.h> + +#endif //_INC_NETDB diff --git a/win32/include/sys/socket.h b/win32/include/sys/socket.h new file mode 100644 index 0000000000..7485195590 --- /dev/null +++ b/win32/include/sys/socket.h @@ -0,0 +1,146 @@ +// sys/socket.h + +// djl +// Provide UNIX compatibility + +#ifdef __cplusplus +extern "C" { +#endif +#ifndef _INC_SYS_SOCKET +#define _INC_SYS_SOCKET + + +#ifndef _WINDOWS_ +#define _WINDOWS_ + +#define FAR +#define PASCAL __stdcall +#define WINAPI __stdcall + +#undef WORD +typedef int BOOL; +typedef unsigned short WORD; +typedef void* HANDLE; +typedef void* HWND; +typedef int (FAR WINAPI *FARPROC)(); + +typedef unsigned long DWORD; +typedef void *PVOID; + +#define IN +#define OUT + +typedef struct _OVERLAPPED { + DWORD Internal; + DWORD InternalHigh; + DWORD Offset; + DWORD OffsetHigh; + HANDLE hEvent; +} OVERLAPPED, *LPOVERLAPPED; + +#endif //_WINDOWS_ +#include <winsock.h> + +#define ENOTSOCK WSAENOTSOCK +#undef HOST_NOT_FOUND + + +SOCKET win32_accept (SOCKET s, struct sockaddr *addr, int *addrlen); +int win32_bind (SOCKET s, const struct sockaddr *addr, int namelen); +int win32_closesocket (SOCKET s); +int win32_connect (SOCKET s, const struct sockaddr *name, int namelen); +int win32_ioctlsocket (SOCKET s, long cmd, u_long *argp); +int win32_getpeername (SOCKET s, struct sockaddr *name, int * namelen); +int win32_getsockname (SOCKET s, struct sockaddr *name, int * namelen); +int win32_getsockopt (SOCKET s, int level, int optname, char * optval, int *optlen); +u_long win32_htonl (u_long hostlong); +u_short win32_htons (u_short hostshort); +unsigned long win32_inet_addr (const char * cp); +char * win32_inet_ntoa (struct in_addr in); +int win32_listen (SOCKET s, int backlog); +u_long win32_ntohl (u_long netlong); +u_short win32_ntohs (u_short netshort); +int win32_recv (SOCKET s, char * buf, int len, int flags); +int win32_recvfrom (SOCKET s, char * buf, int len, int flags, + struct sockaddr *from, int * fromlen); +int win32_select (int nfds, int *readfds, int *writefds, int *exceptfds, const struct timeval *timeout); +int win32_send (SOCKET s, const char * buf, int len, int flags); +int win32_sendto (SOCKET s, const char * buf, int len, int flags, + const struct sockaddr *to, int tolen); +int win32_setsockopt (SOCKET s, int level, int optname, + const char * optval, int optlen); +SOCKET win32_socket (int af, int type, int protocol); +int win32_shutdown (SOCKET s, int how); + +/* Database function prototypes */ + +struct hostent * win32_gethostbyaddr(const char * addr, int len, int type); +struct hostent * win32_gethostbyname(const char * name); +int win32_gethostname (char * name, int namelen); +struct servent * win32_getservbyport(int port, const char * proto); +struct servent * win32_getservbyname(const char * name, const char * proto); +struct protoent * win32_getprotobynumber(int proto); +struct protoent * win32_getprotobyname(const char * name); +struct protoent *win32_getprotoent(void); +struct servent *win32_getservent(void); +void win32_sethostent(int stayopen); +void win32_setnetent(int stayopen); +void win32_setprotoent(int stayopen); +void win32_setservent(int stayopen); +void win32_endhostent(); +void win32_endnetent(); +void win32_endprotoent(); +void win32_endservent(); + +// +// direct to our version +// +#define htonl win32_htonl +#define htons win32_htons +#define ntohl win32_ntohl +#define ntohs win32_ntohs +#define inet_addr win32_inet_addr +#define inet_ntoa win32_inet_ntoa + +#define socket win32_socket +#define bind win32_bind +#define listen win32_listen +#define accept win32_accept +#define connect win32_connect +#define send win32_send +#define sendto win32_sendto +#define recv win32_recv +#define recvfrom win32_recvfrom +#define shutdown win32_shutdown +#define ioctlsocket win32_ioctlsocket +#define setsockopt win32_setsockopt +#define getsockopt win32_getsockopt +#define getpeername win32_getpeername +#define getsockname win32_getsockname +#define gethostname win32_gethostname +#define gethostbyname win32_gethostbyname +#define gethostbyaddr win32_gethostbyaddr +#define getprotobyname win32_getprotobyname +#define getprotobynumber win32_getprotobynumber +#define getservbyname win32_getservbyname +#define getservbyport win32_getservbyport +#define select win32_select +#define endhostent win32_endhostent +#define endnetent win32_endnetent +#define endprotoent win32_endprotoent +#define endservent win32_endservent +#define getnetent win32_getnetent +#define getnetbyname win32_getnetbyname +#define getnetbyaddr win32_getnetbyaddr +#define getprotoent win32_getprotoent +#define getservent win32_getservent +#define sethostent win32_sethostent +#define setnetent win32_setnetent +#define setprotoent win32_setprotoent +#define setservent win32_setservent + +#ifdef __cplusplus +} +#endif + +#endif // _INC_SYS_SOCKET diff --git a/win32/libperl.mak b/win32/libperl.mak new file mode 100644 index 0000000000..2298c1129e --- /dev/null +++ b/win32/libperl.mak @@ -0,0 +1,2217 @@ +# Microsoft Developer Studio Generated NMAKE File, Format Version 4.20 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Static Library" 0x0104 + +!IF "$(CFG)" == "" +CFG=libperl - Win32 Debug +!MESSAGE No configuration specified. Defaulting to libperl - Win32 Debug. +!ENDIF + +!IF "$(CFG)" != "libperl - Win32 Release" && "$(CFG)" !=\ + "libperl - Win32 Debug" +!MESSAGE Invalid configuration "$(CFG)" specified. +!MESSAGE You can specify a configuration when running NMAKE on this makefile +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "libperl.mak" CFG="libperl - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "libperl - Win32 Release" (based on "Win32 (x86) Static Library") +!MESSAGE "libperl - Win32 Debug" (based on "Win32 (x86) Static Library") +!MESSAGE +!ERROR An invalid configuration is specified. +!ENDIF + +!IF "$(OS)" == "Windows_NT" +NULL= +!ELSE +NULL=nul +!ENDIF +################################################################################ +# Begin Project +# PROP Target_Last_Scanned "libperl - Win32 Debug" +CPP=cl.exe + +!IF "$(CFG)" == "libperl - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "../" +# PROP Intermediate_Dir "Release" +# PROP Target_Dir "" +OUTDIR=.\.. +INTDIR=.\Release + +ALL : "$(OUTDIR)\libperl.lib" + +CLEAN : + -@erase "$(INTDIR)\av.obj" + -@erase "$(INTDIR)\deb.obj" + -@erase "$(INTDIR)\doio.obj" + -@erase "$(INTDIR)\doop.obj" + -@erase "$(INTDIR)\dump.obj" + -@erase "$(INTDIR)\globals.obj" + -@erase "$(INTDIR)\gv.obj" + -@erase "$(INTDIR)\hv.obj" + -@erase "$(INTDIR)\mg.obj" + -@erase "$(INTDIR)\op.obj" + -@erase "$(INTDIR)\perl.obj" + -@erase "$(INTDIR)\perlio.obj" + -@erase "$(INTDIR)\perly.obj" + -@erase "$(INTDIR)\pp.obj" + -@erase "$(INTDIR)\pp_ctl.obj" + -@erase "$(INTDIR)\pp_hot.obj" + -@erase "$(INTDIR)\pp_sys.obj" + -@erase "$(INTDIR)\regcomp.obj" + -@erase "$(INTDIR)\regexec.obj" + -@erase "$(INTDIR)\run.obj" + -@erase "$(INTDIR)\scope.obj" + -@erase "$(INTDIR)\sv.obj" + -@erase "$(INTDIR)\taint.obj" + -@erase "$(INTDIR)\toke.obj" + -@erase "$(INTDIR)\universal.obj" + -@erase "$(INTDIR)\util.obj" + -@erase "$(OUTDIR)\libperl.lib" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +"$(INTDIR)" : + if not exist "$(INTDIR)/$(NULL)" mkdir "$(INTDIR)" + +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c +# ADD CPP /nologo /MT /W3 /GX /Od /I ".\include" /I ".." /I "." /D "WIN32" /D "NDEBUG" /D "PERLDLL" /D "_WINDOWS" /YX /c +CPP_PROJ=/nologo /MT /W3 /GX /Od /I ".\include" /I ".." /I "." /D "WIN32" /D\ + "NDEBUG" /D "PERLDLL" /D "_WINDOWS" /Fp"$(INTDIR)/libperl.pch" /YX\ + /Fo"$(INTDIR)/" /c +CPP_OBJS=.\Release/ +CPP_SBRS=.\. +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +BSC32_FLAGS=/nologo /o"$(OUTDIR)/libperl.bsc" +BSC32_SBRS= \ + +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo +LIB32_FLAGS=/nologo /out:"$(OUTDIR)/libperl.lib" +LIB32_OBJS= \ + "$(INTDIR)\av.obj" \ + "$(INTDIR)\deb.obj" \ + "$(INTDIR)\doio.obj" \ + "$(INTDIR)\doop.obj" \ + "$(INTDIR)\dump.obj" \ + "$(INTDIR)\globals.obj" \ + "$(INTDIR)\gv.obj" \ + "$(INTDIR)\hv.obj" \ + "$(INTDIR)\mg.obj" \ + "$(INTDIR)\op.obj" \ + "$(INTDIR)\perl.obj" \ + "$(INTDIR)\perlio.obj" \ + "$(INTDIR)\perly.obj" \ + "$(INTDIR)\pp.obj" \ + "$(INTDIR)\pp_ctl.obj" \ + "$(INTDIR)\pp_hot.obj" \ + "$(INTDIR)\pp_sys.obj" \ + "$(INTDIR)\regcomp.obj" \ + "$(INTDIR)\regexec.obj" \ + "$(INTDIR)\run.obj" \ + "$(INTDIR)\scope.obj" \ + "$(INTDIR)\sv.obj" \ + "$(INTDIR)\taint.obj" \ + "$(INTDIR)\toke.obj" \ + "$(INTDIR)\universal.obj" \ + "$(INTDIR)\util.obj" + +"$(OUTDIR)\libperl.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS) + $(LIB32) @<< + $(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS) +<< + +!ELSEIF "$(CFG)" == "libperl - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir ".." +# PROP Intermediate_Dir "Debug" +# PROP Target_Dir "" +OUTDIR=.\.. +INTDIR=.\Debug + +ALL : "$(OUTDIR)\libperl.lib" + +CLEAN : + -@erase "$(INTDIR)\av.obj" + -@erase "$(INTDIR)\deb.obj" + -@erase "$(INTDIR)\doio.obj" + -@erase "$(INTDIR)\doop.obj" + -@erase "$(INTDIR)\dump.obj" + -@erase "$(INTDIR)\globals.obj" + -@erase "$(INTDIR)\gv.obj" + -@erase "$(INTDIR)\hv.obj" + -@erase "$(INTDIR)\mg.obj" + -@erase "$(INTDIR)\op.obj" + -@erase "$(INTDIR)\perl.obj" + -@erase "$(INTDIR)\perlio.obj" + -@erase "$(INTDIR)\perly.obj" + -@erase "$(INTDIR)\pp.obj" + -@erase "$(INTDIR)\pp_ctl.obj" + -@erase "$(INTDIR)\pp_hot.obj" + -@erase "$(INTDIR)\pp_sys.obj" + -@erase "$(INTDIR)\regcomp.obj" + -@erase "$(INTDIR)\regexec.obj" + -@erase "$(INTDIR)\run.obj" + -@erase "$(INTDIR)\scope.obj" + -@erase "$(INTDIR)\sv.obj" + -@erase "$(INTDIR)\taint.obj" + -@erase "$(INTDIR)\toke.obj" + -@erase "$(INTDIR)\universal.obj" + -@erase "$(INTDIR)\util.obj" + -@erase "$(OUTDIR)\libperl.lib" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +"$(INTDIR)" : + if not exist "$(INTDIR)/$(NULL)" mkdir "$(INTDIR)" + +# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c +# ADD CPP /nologo /MTd /W3 /GX /Z7 /Od /I ".\include" /I ".." /I "." /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c +CPP_PROJ=/nologo /MTd /W3 /GX /Z7 /Od /I ".\include" /I ".." /I "." /D "WIN32"\ + /D "_DEBUG" /D "_WINDOWS" /Fp"$(INTDIR)/libperl.pch" /YX /Fo"$(INTDIR)/" /c +CPP_OBJS=.\Debug/ +CPP_SBRS=.\. +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +BSC32_FLAGS=/nologo /o"$(OUTDIR)/libperl.bsc" +BSC32_SBRS= \ + +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo +LIB32_FLAGS=/nologo /out:"$(OUTDIR)/libperl.lib" +LIB32_OBJS= \ + "$(INTDIR)\av.obj" \ + "$(INTDIR)\deb.obj" \ + "$(INTDIR)\doio.obj" \ + "$(INTDIR)\doop.obj" \ + "$(INTDIR)\dump.obj" \ + "$(INTDIR)\globals.obj" \ + "$(INTDIR)\gv.obj" \ + "$(INTDIR)\hv.obj" \ + "$(INTDIR)\mg.obj" \ + "$(INTDIR)\op.obj" \ + "$(INTDIR)\perl.obj" \ + "$(INTDIR)\perlio.obj" \ + "$(INTDIR)\perly.obj" \ + "$(INTDIR)\pp.obj" \ + "$(INTDIR)\pp_ctl.obj" \ + "$(INTDIR)\pp_hot.obj" \ + "$(INTDIR)\pp_sys.obj" \ + "$(INTDIR)\regcomp.obj" \ + "$(INTDIR)\regexec.obj" \ + "$(INTDIR)\run.obj" \ + "$(INTDIR)\scope.obj" \ + "$(INTDIR)\sv.obj" \ + "$(INTDIR)\taint.obj" \ + "$(INTDIR)\toke.obj" \ + "$(INTDIR)\universal.obj" \ + "$(INTDIR)\util.obj" + +"$(OUTDIR)\libperl.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS) + $(LIB32) @<< + $(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS) +<< + +!ENDIF + +.c{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.cpp{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.cxx{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.c{$(CPP_SBRS)}.sbr: + $(CPP) $(CPP_PROJ) $< + +.cpp{$(CPP_SBRS)}.sbr: + $(CPP) $(CPP_PROJ) $< + +.cxx{$(CPP_SBRS)}.sbr: + $(CPP) $(CPP_PROJ) $< + +################################################################################ +# Begin Target + +# Name "libperl - Win32 Release" +# Name "libperl - Win32 Debug" + +!IF "$(CFG)" == "libperl - Win32 Release" + +!ELSEIF "$(CFG)" == "libperl - Win32 Debug" + +!ENDIF + +################################################################################ +# Begin Source File + +SOURCE=..\av.c + +!IF "$(CFG)" == "libperl - Win32 Release" + +DEP_CPP_AV_C0=\ + "..\EXTERN.h"\ + ".\..\perl.h"\ + ".\config.h"\ + ".\include\dirent.h"\ + ".\include\netdb.h"\ + ".\include\sys/socket.h"\ + ".\win32.h"\ + + +"$(INTDIR)\av.obj" : $(SOURCE) $(DEP_CPP_AV_C0) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "libperl - Win32 Debug" + +DEP_CPP_AV_C0=\ + "..\EXTERN.h"\ + ".\..\av.h"\ + ".\..\cop.h"\ + ".\..\cv.h"\ + ".\..\dosish.h"\ + ".\..\embed.h"\ + ".\..\form.h"\ + ".\..\gv.h"\ + ".\..\handy.h"\ + ".\..\hv.h"\ + ".\..\mg.h"\ + ".\..\nostdio.h"\ + ".\..\op.h"\ + ".\..\opcode.h"\ + ".\..\perl.h"\ + ".\..\perlio.h"\ + ".\..\perlsdio.h"\ + ".\..\perlsfio.h"\ + ".\..\perly.h"\ + ".\..\plan9\plan9ish.h"\ + ".\..\pp.h"\ + ".\..\proto.h"\ + ".\..\regexp.h"\ + ".\..\scope.h"\ + ".\..\sv.h"\ + ".\..\unixish.h"\ + ".\..\util.h"\ + ".\config.h"\ + ".\include\dirent.h"\ + ".\include\netdb.h"\ + ".\include\sys/socket.h"\ + ".\win32.h"\ + ".\win32io.h"\ + ".\win32iop.h"\ + {$(INCLUDE)}"\Sys\Stat.h"\ + {$(INCLUDE)}"\Sys\Types.h"\ + +NODEP_CPP_AV_C0=\ + ".\..\os2ish.h"\ + ".\..\vmsish.h"\ + + +"$(INTDIR)\av.obj" : $(SOURCE) $(DEP_CPP_AV_C0) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=..\deb.c + +!IF "$(CFG)" == "libperl - Win32 Release" + +DEP_CPP_DEB_C=\ + "..\EXTERN.h"\ + ".\..\perl.h"\ + ".\config.h"\ + ".\include\dirent.h"\ + ".\include\netdb.h"\ + ".\include\sys/socket.h"\ + ".\win32.h"\ + + +"$(INTDIR)\deb.obj" : $(SOURCE) $(DEP_CPP_DEB_C) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "libperl - Win32 Debug" + +DEP_CPP_DEB_C=\ + "..\EXTERN.h"\ + ".\..\av.h"\ + ".\..\cop.h"\ + ".\..\cv.h"\ + ".\..\dosish.h"\ + ".\..\embed.h"\ + ".\..\form.h"\ + ".\..\gv.h"\ + ".\..\handy.h"\ + ".\..\hv.h"\ + ".\..\mg.h"\ + ".\..\nostdio.h"\ + ".\..\op.h"\ + ".\..\opcode.h"\ + ".\..\perl.h"\ + ".\..\perlio.h"\ + ".\..\perlsdio.h"\ + ".\..\perlsfio.h"\ + ".\..\perly.h"\ + ".\..\plan9\plan9ish.h"\ + ".\..\pp.h"\ + ".\..\proto.h"\ + ".\..\regexp.h"\ + ".\..\scope.h"\ + ".\..\sv.h"\ + ".\..\unixish.h"\ + ".\..\util.h"\ + ".\config.h"\ + ".\include\dirent.h"\ + ".\include\netdb.h"\ + ".\include\sys/socket.h"\ + ".\win32.h"\ + ".\win32io.h"\ + ".\win32iop.h"\ + {$(INCLUDE)}"\Sys\Stat.h"\ + {$(INCLUDE)}"\Sys\Types.h"\ + +NODEP_CPP_DEB_C=\ + ".\..\os2ish.h"\ + ".\..\vmsish.h"\ + + +"$(INTDIR)\deb.obj" : $(SOURCE) $(DEP_CPP_DEB_C) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=..\doio.c + +!IF "$(CFG)" == "libperl - Win32 Release" + +DEP_CPP_DOIO_=\ + "..\EXTERN.h"\ + ".\..\perl.h"\ + ".\config.h"\ + ".\include\dirent.h"\ + ".\include\netdb.h"\ + ".\include\sys/socket.h"\ + ".\win32.h"\ + + +"$(INTDIR)\doio.obj" : $(SOURCE) $(DEP_CPP_DOIO_) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "libperl - Win32 Debug" + +DEP_CPP_DOIO_=\ + "..\EXTERN.h"\ + ".\..\av.h"\ + ".\..\cop.h"\ + ".\..\cv.h"\ + ".\..\dosish.h"\ + ".\..\embed.h"\ + ".\..\form.h"\ + ".\..\gv.h"\ + ".\..\handy.h"\ + ".\..\hv.h"\ + ".\..\mg.h"\ + ".\..\nostdio.h"\ + ".\..\op.h"\ + ".\..\opcode.h"\ + ".\..\perl.h"\ + ".\..\perlio.h"\ + ".\..\perlsdio.h"\ + ".\..\perlsfio.h"\ + ".\..\perly.h"\ + ".\..\plan9\plan9ish.h"\ + ".\..\pp.h"\ + ".\..\proto.h"\ + ".\..\regexp.h"\ + ".\..\scope.h"\ + ".\..\sv.h"\ + ".\..\unixish.h"\ + ".\..\util.h"\ + ".\config.h"\ + ".\include\dirent.h"\ + ".\include\netdb.h"\ + ".\include\sys/socket.h"\ + ".\win32.h"\ + ".\win32io.h"\ + ".\win32iop.h"\ + {$(INCLUDE)}"\Sys\Stat.h"\ + {$(INCLUDE)}"\Sys\Types.h"\ + +NODEP_CPP_DOIO_=\ + ".\..\os2ish.h"\ + ".\..\vmsish.h"\ + + +"$(INTDIR)\doio.obj" : $(SOURCE) $(DEP_CPP_DOIO_) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=..\doop.c + +!IF "$(CFG)" == "libperl - Win32 Release" + +DEP_CPP_DOOP_=\ + "..\EXTERN.h"\ + ".\..\perl.h"\ + ".\config.h"\ + ".\include\dirent.h"\ + ".\include\netdb.h"\ + ".\include\sys/socket.h"\ + ".\win32.h"\ + + +"$(INTDIR)\doop.obj" : $(SOURCE) $(DEP_CPP_DOOP_) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "libperl - Win32 Debug" + +DEP_CPP_DOOP_=\ + "..\EXTERN.h"\ + ".\..\av.h"\ + ".\..\cop.h"\ + ".\..\cv.h"\ + ".\..\dosish.h"\ + ".\..\embed.h"\ + ".\..\form.h"\ + ".\..\gv.h"\ + ".\..\handy.h"\ + ".\..\hv.h"\ + ".\..\mg.h"\ + ".\..\nostdio.h"\ + ".\..\op.h"\ + ".\..\opcode.h"\ + ".\..\perl.h"\ + ".\..\perlio.h"\ + ".\..\perlsdio.h"\ + ".\..\perlsfio.h"\ + ".\..\perly.h"\ + ".\..\plan9\plan9ish.h"\ + ".\..\pp.h"\ + ".\..\proto.h"\ + ".\..\regexp.h"\ + ".\..\scope.h"\ + ".\..\sv.h"\ + ".\..\unixish.h"\ + ".\..\util.h"\ + ".\config.h"\ + ".\include\dirent.h"\ + ".\include\netdb.h"\ + ".\include\sys/socket.h"\ + ".\win32.h"\ + ".\win32io.h"\ + ".\win32iop.h"\ + {$(INCLUDE)}"\Sys\Stat.h"\ + {$(INCLUDE)}"\Sys\Types.h"\ + +NODEP_CPP_DOOP_=\ + ".\..\os2ish.h"\ + ".\..\vmsish.h"\ + + +"$(INTDIR)\doop.obj" : $(SOURCE) $(DEP_CPP_DOOP_) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=..\dump.c + +!IF "$(CFG)" == "libperl - Win32 Release" + +DEP_CPP_DUMP_=\ + "..\EXTERN.h"\ + ".\..\perl.h"\ + ".\config.h"\ + ".\include\dirent.h"\ + ".\include\netdb.h"\ + ".\include\sys/socket.h"\ + ".\win32.h"\ + + +"$(INTDIR)\dump.obj" : $(SOURCE) $(DEP_CPP_DUMP_) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "libperl - Win32 Debug" + +DEP_CPP_DUMP_=\ + "..\EXTERN.h"\ + ".\..\av.h"\ + ".\..\cop.h"\ + ".\..\cv.h"\ + ".\..\dosish.h"\ + ".\..\embed.h"\ + ".\..\form.h"\ + ".\..\gv.h"\ + ".\..\handy.h"\ + ".\..\hv.h"\ + ".\..\mg.h"\ + ".\..\nostdio.h"\ + ".\..\op.h"\ + ".\..\opcode.h"\ + ".\..\perl.h"\ + ".\..\perlio.h"\ + ".\..\perlsdio.h"\ + ".\..\perlsfio.h"\ + ".\..\perly.h"\ + ".\..\plan9\plan9ish.h"\ + ".\..\pp.h"\ + ".\..\proto.h"\ + ".\..\regexp.h"\ + ".\..\scope.h"\ + ".\..\sv.h"\ + ".\..\unixish.h"\ + ".\..\util.h"\ + ".\config.h"\ + ".\include\dirent.h"\ + ".\include\netdb.h"\ + ".\include\sys/socket.h"\ + ".\win32.h"\ + ".\win32io.h"\ + ".\win32iop.h"\ + {$(INCLUDE)}"\Sys\Stat.h"\ + {$(INCLUDE)}"\Sys\Types.h"\ + +NODEP_CPP_DUMP_=\ + ".\..\os2ish.h"\ + ".\..\vmsish.h"\ + + +"$(INTDIR)\dump.obj" : $(SOURCE) $(DEP_CPP_DUMP_) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=..\globals.c + +!IF "$(CFG)" == "libperl - Win32 Release" + +DEP_CPP_GLOBA=\ + ".\..\av.h"\ + ".\..\cop.h"\ + ".\..\cv.h"\ + ".\..\dosish.h"\ + ".\..\embed.h"\ + ".\..\form.h"\ + ".\..\gv.h"\ + ".\..\handy.h"\ + ".\..\hv.h"\ + ".\..\INTERN.h"\ + ".\..\mg.h"\ + ".\..\nostdio.h"\ + ".\..\op.h"\ + ".\..\opcode.h"\ + ".\..\perl.h"\ + ".\..\perlio.h"\ + ".\..\perlsdio.h"\ + ".\..\perlsfio.h"\ + ".\..\perly.h"\ + ".\..\plan9\plan9ish.h"\ + ".\..\pp.h"\ + ".\..\proto.h"\ + ".\..\regexp.h"\ + ".\..\scope.h"\ + ".\..\sv.h"\ + ".\..\unixish.h"\ + ".\..\util.h"\ + ".\config.h"\ + ".\include\dirent.h"\ + ".\include\netdb.h"\ + ".\include\sys/socket.h"\ + ".\win32.h"\ + ".\win32io.h"\ + ".\win32iop.h"\ + {$(INCLUDE)}"\Sys\Stat.h"\ + {$(INCLUDE)}"\Sys\Types.h"\ + +NODEP_CPP_GLOBA=\ + ".\..\os2ish.h"\ + ".\..\vmsish.h"\ + + +"$(INTDIR)\globals.obj" : $(SOURCE) $(DEP_CPP_GLOBA) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "libperl - Win32 Debug" + +DEP_CPP_GLOBA=\ + ".\..\av.h"\ + ".\..\cop.h"\ + ".\..\cv.h"\ + ".\..\dosish.h"\ + ".\..\embed.h"\ + ".\..\form.h"\ + ".\..\gv.h"\ + ".\..\handy.h"\ + ".\..\hv.h"\ + ".\..\INTERN.h"\ + ".\..\mg.h"\ + ".\..\nostdio.h"\ + ".\..\op.h"\ + ".\..\opcode.h"\ + ".\..\perl.h"\ + ".\..\perlio.h"\ + ".\..\perlsdio.h"\ + ".\..\perlsfio.h"\ + ".\..\perly.h"\ + ".\..\plan9\plan9ish.h"\ + ".\..\pp.h"\ + ".\..\proto.h"\ + ".\..\regexp.h"\ + ".\..\scope.h"\ + ".\..\sv.h"\ + ".\..\unixish.h"\ + ".\..\util.h"\ + ".\config.h"\ + ".\include\dirent.h"\ + ".\include\netdb.h"\ + ".\include\sys/socket.h"\ + ".\win32.h"\ + ".\win32io.h"\ + ".\win32iop.h"\ + {$(INCLUDE)}"\Sys\Stat.h"\ + {$(INCLUDE)}"\Sys\Types.h"\ + +NODEP_CPP_GLOBA=\ + ".\..\os2ish.h"\ + ".\..\vmsish.h"\ + + +"$(INTDIR)\globals.obj" : $(SOURCE) $(DEP_CPP_GLOBA) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=..\gv.c + +!IF "$(CFG)" == "libperl - Win32 Release" + +DEP_CPP_GV_Cc=\ + "..\EXTERN.h"\ + ".\..\perl.h"\ + ".\config.h"\ + ".\include\dirent.h"\ + ".\include\netdb.h"\ + ".\include\sys/socket.h"\ + ".\win32.h"\ + + +"$(INTDIR)\gv.obj" : $(SOURCE) $(DEP_CPP_GV_Cc) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "libperl - Win32 Debug" + +DEP_CPP_GV_Cc=\ + "..\EXTERN.h"\ + ".\..\av.h"\ + ".\..\cop.h"\ + ".\..\cv.h"\ + ".\..\dosish.h"\ + ".\..\embed.h"\ + ".\..\form.h"\ + ".\..\gv.h"\ + ".\..\handy.h"\ + ".\..\hv.h"\ + ".\..\mg.h"\ + ".\..\nostdio.h"\ + ".\..\op.h"\ + ".\..\opcode.h"\ + ".\..\perl.h"\ + ".\..\perlio.h"\ + ".\..\perlsdio.h"\ + ".\..\perlsfio.h"\ + ".\..\perly.h"\ + ".\..\plan9\plan9ish.h"\ + ".\..\pp.h"\ + ".\..\proto.h"\ + ".\..\regexp.h"\ + ".\..\scope.h"\ + ".\..\sv.h"\ + ".\..\unixish.h"\ + ".\..\util.h"\ + ".\config.h"\ + ".\include\dirent.h"\ + ".\include\netdb.h"\ + ".\include\sys/socket.h"\ + ".\win32.h"\ + ".\win32io.h"\ + ".\win32iop.h"\ + {$(INCLUDE)}"\Sys\Stat.h"\ + {$(INCLUDE)}"\Sys\Types.h"\ + +NODEP_CPP_GV_Cc=\ + ".\..\os2ish.h"\ + ".\..\vmsish.h"\ + + +"$(INTDIR)\gv.obj" : $(SOURCE) $(DEP_CPP_GV_Cc) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=..\hv.c + +!IF "$(CFG)" == "libperl - Win32 Release" + +DEP_CPP_HV_Ce=\ + "..\EXTERN.h"\ + ".\..\perl.h"\ + ".\config.h"\ + ".\include\dirent.h"\ + ".\include\netdb.h"\ + ".\include\sys/socket.h"\ + ".\win32.h"\ + + +"$(INTDIR)\hv.obj" : $(SOURCE) $(DEP_CPP_HV_Ce) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "libperl - Win32 Debug" + +DEP_CPP_HV_Ce=\ + "..\EXTERN.h"\ + ".\..\av.h"\ + ".\..\cop.h"\ + ".\..\cv.h"\ + ".\..\dosish.h"\ + ".\..\embed.h"\ + ".\..\form.h"\ + ".\..\gv.h"\ + ".\..\handy.h"\ + ".\..\hv.h"\ + ".\..\mg.h"\ + ".\..\nostdio.h"\ + ".\..\op.h"\ + ".\..\opcode.h"\ + ".\..\perl.h"\ + ".\..\perlio.h"\ + ".\..\perlsdio.h"\ + ".\..\perlsfio.h"\ + ".\..\perly.h"\ + ".\..\plan9\plan9ish.h"\ + ".\..\pp.h"\ + ".\..\proto.h"\ + ".\..\regexp.h"\ + ".\..\scope.h"\ + ".\..\sv.h"\ + ".\..\unixish.h"\ + ".\..\util.h"\ + ".\config.h"\ + ".\include\dirent.h"\ + ".\include\netdb.h"\ + ".\include\sys/socket.h"\ + ".\win32.h"\ + ".\win32io.h"\ + ".\win32iop.h"\ + {$(INCLUDE)}"\Sys\Stat.h"\ + {$(INCLUDE)}"\Sys\Types.h"\ + +NODEP_CPP_HV_Ce=\ + ".\..\os2ish.h"\ + ".\..\vmsish.h"\ + + +"$(INTDIR)\hv.obj" : $(SOURCE) $(DEP_CPP_HV_Ce) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=..\mg.c + +!IF "$(CFG)" == "libperl - Win32 Release" + +DEP_CPP_MG_C10=\ + "..\EXTERN.h"\ + ".\..\perl.h"\ + ".\config.h"\ + ".\include\dirent.h"\ + ".\include\netdb.h"\ + ".\include\sys/socket.h"\ + ".\win32.h"\ + + +"$(INTDIR)\mg.obj" : $(SOURCE) $(DEP_CPP_MG_C10) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "libperl - Win32 Debug" + +DEP_CPP_MG_C10=\ + "..\EXTERN.h"\ + ".\..\av.h"\ + ".\..\cop.h"\ + ".\..\cv.h"\ + ".\..\dosish.h"\ + ".\..\embed.h"\ + ".\..\form.h"\ + ".\..\gv.h"\ + ".\..\handy.h"\ + ".\..\hv.h"\ + ".\..\mg.h"\ + ".\..\nostdio.h"\ + ".\..\op.h"\ + ".\..\opcode.h"\ + ".\..\perl.h"\ + ".\..\perlio.h"\ + ".\..\perlsdio.h"\ + ".\..\perlsfio.h"\ + ".\..\perly.h"\ + ".\..\plan9\plan9ish.h"\ + ".\..\pp.h"\ + ".\..\proto.h"\ + ".\..\regexp.h"\ + ".\..\scope.h"\ + ".\..\sv.h"\ + ".\..\unixish.h"\ + ".\..\util.h"\ + ".\config.h"\ + ".\include\dirent.h"\ + ".\include\netdb.h"\ + ".\include\sys/socket.h"\ + ".\win32.h"\ + ".\win32io.h"\ + ".\win32iop.h"\ + {$(INCLUDE)}"\Sys\Stat.h"\ + {$(INCLUDE)}"\Sys\Types.h"\ + +NODEP_CPP_MG_C10=\ + ".\..\os2ish.h"\ + ".\..\vmsish.h"\ + + +"$(INTDIR)\mg.obj" : $(SOURCE) $(DEP_CPP_MG_C10) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=..\op.c + +!IF "$(CFG)" == "libperl - Win32 Release" + +DEP_CPP_OP_C12=\ + "..\EXTERN.h"\ + ".\..\perl.h"\ + ".\config.h"\ + ".\include\dirent.h"\ + ".\include\netdb.h"\ + ".\include\sys/socket.h"\ + ".\win32.h"\ + + +"$(INTDIR)\op.obj" : $(SOURCE) $(DEP_CPP_OP_C12) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "libperl - Win32 Debug" + +DEP_CPP_OP_C12=\ + "..\EXTERN.h"\ + ".\..\av.h"\ + ".\..\cop.h"\ + ".\..\cv.h"\ + ".\..\dosish.h"\ + ".\..\embed.h"\ + ".\..\form.h"\ + ".\..\gv.h"\ + ".\..\handy.h"\ + ".\..\hv.h"\ + ".\..\mg.h"\ + ".\..\nostdio.h"\ + ".\..\op.h"\ + ".\..\opcode.h"\ + ".\..\perl.h"\ + ".\..\perlio.h"\ + ".\..\perlsdio.h"\ + ".\..\perlsfio.h"\ + ".\..\perly.h"\ + ".\..\plan9\plan9ish.h"\ + ".\..\pp.h"\ + ".\..\proto.h"\ + ".\..\regexp.h"\ + ".\..\scope.h"\ + ".\..\sv.h"\ + ".\..\unixish.h"\ + ".\..\util.h"\ + ".\config.h"\ + ".\include\dirent.h"\ + ".\include\netdb.h"\ + ".\include\sys/socket.h"\ + ".\win32.h"\ + ".\win32io.h"\ + ".\win32iop.h"\ + {$(INCLUDE)}"\Sys\Stat.h"\ + {$(INCLUDE)}"\Sys\Types.h"\ + +NODEP_CPP_OP_C12=\ + ".\..\os2ish.h"\ + ".\..\vmsish.h"\ + + +"$(INTDIR)\op.obj" : $(SOURCE) $(DEP_CPP_OP_C12) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=..\perl.c + +!IF "$(CFG)" == "libperl - Win32 Release" + +DEP_CPP_PERL_=\ + "..\EXTERN.h"\ + ".\..\patchlevel.h"\ + ".\..\perl.h"\ + ".\config.h"\ + ".\include\dirent.h"\ + ".\include\netdb.h"\ + ".\include\sys/socket.h"\ + ".\win32.h"\ + + +"$(INTDIR)\perl.obj" : $(SOURCE) $(DEP_CPP_PERL_) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "libperl - Win32 Debug" + +DEP_CPP_PERL_=\ + "..\EXTERN.h"\ + ".\..\av.h"\ + ".\..\cop.h"\ + ".\..\cv.h"\ + ".\..\dosish.h"\ + ".\..\embed.h"\ + ".\..\form.h"\ + ".\..\gv.h"\ + ".\..\handy.h"\ + ".\..\hv.h"\ + ".\..\mg.h"\ + ".\..\nostdio.h"\ + ".\..\op.h"\ + ".\..\opcode.h"\ + ".\..\patchlevel.h"\ + ".\..\perl.h"\ + ".\..\perlio.h"\ + ".\..\perlsdio.h"\ + ".\..\perlsfio.h"\ + ".\..\perly.h"\ + ".\..\plan9\plan9ish.h"\ + ".\..\pp.h"\ + ".\..\proto.h"\ + ".\..\regexp.h"\ + ".\..\scope.h"\ + ".\..\sv.h"\ + ".\..\unixish.h"\ + ".\..\util.h"\ + ".\config.h"\ + ".\include\dirent.h"\ + ".\include\netdb.h"\ + ".\include\sys/socket.h"\ + ".\win32.h"\ + ".\win32io.h"\ + ".\win32iop.h"\ + {$(INCLUDE)}"\Sys\Stat.h"\ + {$(INCLUDE)}"\Sys\Types.h"\ + +NODEP_CPP_PERL_=\ + ".\..\os2ish.h"\ + ".\..\vmsish.h"\ + + +"$(INTDIR)\perl.obj" : $(SOURCE) $(DEP_CPP_PERL_) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=..\perlio.c + +!IF "$(CFG)" == "libperl - Win32 Release" + +DEP_CPP_PERLI=\ + "..\EXTERN.h"\ + ".\..\perl.h"\ + ".\config.h"\ + ".\include\dirent.h"\ + ".\include\netdb.h"\ + ".\include\sys/socket.h"\ + ".\win32.h"\ + + +"$(INTDIR)\perlio.obj" : $(SOURCE) $(DEP_CPP_PERLI) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "libperl - Win32 Debug" + +DEP_CPP_PERLI=\ + "..\EXTERN.h"\ + ".\..\av.h"\ + ".\..\cop.h"\ + ".\..\cv.h"\ + ".\..\dosish.h"\ + ".\..\embed.h"\ + ".\..\form.h"\ + ".\..\gv.h"\ + ".\..\handy.h"\ + ".\..\hv.h"\ + ".\..\mg.h"\ + ".\..\nostdio.h"\ + ".\..\op.h"\ + ".\..\opcode.h"\ + ".\..\perl.h"\ + ".\..\perlio.h"\ + ".\..\perlsdio.h"\ + ".\..\perlsfio.h"\ + ".\..\perly.h"\ + ".\..\plan9\plan9ish.h"\ + ".\..\pp.h"\ + ".\..\proto.h"\ + ".\..\regexp.h"\ + ".\..\scope.h"\ + ".\..\sv.h"\ + ".\..\unixish.h"\ + ".\..\util.h"\ + ".\config.h"\ + ".\include\dirent.h"\ + ".\include\netdb.h"\ + ".\include\sys/socket.h"\ + ".\win32.h"\ + ".\win32io.h"\ + ".\win32iop.h"\ + {$(INCLUDE)}"\Sys\Stat.h"\ + {$(INCLUDE)}"\Sys\Types.h"\ + +NODEP_CPP_PERLI=\ + ".\..\os2ish.h"\ + ".\..\vmsish.h"\ + + +"$(INTDIR)\perlio.obj" : $(SOURCE) $(DEP_CPP_PERLI) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=..\perly.c + +!IF "$(CFG)" == "libperl - Win32 Release" + +DEP_CPP_PERLY=\ + "..\EXTERN.h"\ + ".\..\perl.h"\ + ".\config.h"\ + ".\include\dirent.h"\ + ".\include\netdb.h"\ + ".\include\sys/socket.h"\ + ".\win32.h"\ + + +"$(INTDIR)\perly.obj" : $(SOURCE) $(DEP_CPP_PERLY) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "libperl - Win32 Debug" + +DEP_CPP_PERLY=\ + "..\EXTERN.h"\ + ".\..\av.h"\ + ".\..\cop.h"\ + ".\..\cv.h"\ + ".\..\dosish.h"\ + ".\..\embed.h"\ + ".\..\form.h"\ + ".\..\gv.h"\ + ".\..\handy.h"\ + ".\..\hv.h"\ + ".\..\mg.h"\ + ".\..\nostdio.h"\ + ".\..\op.h"\ + ".\..\opcode.h"\ + ".\..\perl.h"\ + ".\..\perlio.h"\ + ".\..\perlsdio.h"\ + ".\..\perlsfio.h"\ + ".\..\perly.h"\ + ".\..\plan9\plan9ish.h"\ + ".\..\pp.h"\ + ".\..\proto.h"\ + ".\..\regexp.h"\ + ".\..\scope.h"\ + ".\..\sv.h"\ + ".\..\unixish.h"\ + ".\..\util.h"\ + ".\config.h"\ + ".\include\dirent.h"\ + ".\include\netdb.h"\ + ".\include\sys/socket.h"\ + ".\win32.h"\ + ".\win32io.h"\ + ".\win32iop.h"\ + {$(INCLUDE)}"\Sys\Stat.h"\ + {$(INCLUDE)}"\Sys\Types.h"\ + +NODEP_CPP_PERLY=\ + ".\..\os2ish.h"\ + ".\..\vmsish.h"\ + + +"$(INTDIR)\perly.obj" : $(SOURCE) $(DEP_CPP_PERLY) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=..\pp.c + +!IF "$(CFG)" == "libperl - Win32 Release" + +DEP_CPP_PP_C1a=\ + "..\EXTERN.h"\ + ".\..\perl.h"\ + ".\config.h"\ + ".\include\dirent.h"\ + ".\include\netdb.h"\ + ".\include\sys/socket.h"\ + ".\win32.h"\ + + +"$(INTDIR)\pp.obj" : $(SOURCE) $(DEP_CPP_PP_C1a) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "libperl - Win32 Debug" + +DEP_CPP_PP_C1a=\ + "..\EXTERN.h"\ + ".\..\av.h"\ + ".\..\cop.h"\ + ".\..\cv.h"\ + ".\..\dosish.h"\ + ".\..\embed.h"\ + ".\..\form.h"\ + ".\..\gv.h"\ + ".\..\handy.h"\ + ".\..\hv.h"\ + ".\..\mg.h"\ + ".\..\nostdio.h"\ + ".\..\op.h"\ + ".\..\opcode.h"\ + ".\..\perl.h"\ + ".\..\perlio.h"\ + ".\..\perlsdio.h"\ + ".\..\perlsfio.h"\ + ".\..\perly.h"\ + ".\..\plan9\plan9ish.h"\ + ".\..\pp.h"\ + ".\..\proto.h"\ + ".\..\regexp.h"\ + ".\..\scope.h"\ + ".\..\sv.h"\ + ".\..\unixish.h"\ + ".\..\util.h"\ + ".\config.h"\ + ".\include\dirent.h"\ + ".\include\netdb.h"\ + ".\include\sys/socket.h"\ + ".\win32.h"\ + ".\win32io.h"\ + ".\win32iop.h"\ + {$(INCLUDE)}"\Sys\Stat.h"\ + {$(INCLUDE)}"\Sys\Types.h"\ + +NODEP_CPP_PP_C1a=\ + ".\..\os2ish.h"\ + ".\..\vmsish.h"\ + + +"$(INTDIR)\pp.obj" : $(SOURCE) $(DEP_CPP_PP_C1a) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=..\pp_ctl.c + +!IF "$(CFG)" == "libperl - Win32 Release" + +DEP_CPP_PP_CT=\ + "..\EXTERN.h"\ + ".\..\perl.h"\ + ".\config.h"\ + ".\include\dirent.h"\ + ".\include\netdb.h"\ + ".\include\sys/socket.h"\ + ".\win32.h"\ + + +"$(INTDIR)\pp_ctl.obj" : $(SOURCE) $(DEP_CPP_PP_CT) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "libperl - Win32 Debug" + +DEP_CPP_PP_CT=\ + "..\EXTERN.h"\ + ".\..\av.h"\ + ".\..\cop.h"\ + ".\..\cv.h"\ + ".\..\dosish.h"\ + ".\..\embed.h"\ + ".\..\form.h"\ + ".\..\gv.h"\ + ".\..\handy.h"\ + ".\..\hv.h"\ + ".\..\mg.h"\ + ".\..\nostdio.h"\ + ".\..\op.h"\ + ".\..\opcode.h"\ + ".\..\perl.h"\ + ".\..\perlio.h"\ + ".\..\perlsdio.h"\ + ".\..\perlsfio.h"\ + ".\..\perly.h"\ + ".\..\plan9\plan9ish.h"\ + ".\..\pp.h"\ + ".\..\proto.h"\ + ".\..\regexp.h"\ + ".\..\scope.h"\ + ".\..\sv.h"\ + ".\..\unixish.h"\ + ".\..\util.h"\ + ".\config.h"\ + ".\include\dirent.h"\ + ".\include\netdb.h"\ + ".\include\sys/socket.h"\ + ".\win32.h"\ + ".\win32io.h"\ + ".\win32iop.h"\ + {$(INCLUDE)}"\Sys\Stat.h"\ + {$(INCLUDE)}"\Sys\Types.h"\ + +NODEP_CPP_PP_CT=\ + ".\..\os2ish.h"\ + ".\..\vmsish.h"\ + + +"$(INTDIR)\pp_ctl.obj" : $(SOURCE) $(DEP_CPP_PP_CT) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=..\pp_hot.c + +!IF "$(CFG)" == "libperl - Win32 Release" + +DEP_CPP_PP_HO=\ + "..\EXTERN.h"\ + ".\..\perl.h"\ + ".\config.h"\ + ".\include\dirent.h"\ + ".\include\netdb.h"\ + ".\include\sys/socket.h"\ + ".\win32.h"\ + + +"$(INTDIR)\pp_hot.obj" : $(SOURCE) $(DEP_CPP_PP_HO) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "libperl - Win32 Debug" + +DEP_CPP_PP_HO=\ + "..\EXTERN.h"\ + ".\..\av.h"\ + ".\..\cop.h"\ + ".\..\cv.h"\ + ".\..\dosish.h"\ + ".\..\embed.h"\ + ".\..\form.h"\ + ".\..\gv.h"\ + ".\..\handy.h"\ + ".\..\hv.h"\ + ".\..\mg.h"\ + ".\..\nostdio.h"\ + ".\..\op.h"\ + ".\..\opcode.h"\ + ".\..\perl.h"\ + ".\..\perlio.h"\ + ".\..\perlsdio.h"\ + ".\..\perlsfio.h"\ + ".\..\perly.h"\ + ".\..\plan9\plan9ish.h"\ + ".\..\pp.h"\ + ".\..\proto.h"\ + ".\..\regexp.h"\ + ".\..\scope.h"\ + ".\..\sv.h"\ + ".\..\unixish.h"\ + ".\..\util.h"\ + ".\config.h"\ + ".\include\dirent.h"\ + ".\include\netdb.h"\ + ".\include\sys/socket.h"\ + ".\win32.h"\ + ".\win32io.h"\ + ".\win32iop.h"\ + {$(INCLUDE)}"\Sys\Stat.h"\ + {$(INCLUDE)}"\Sys\Types.h"\ + +NODEP_CPP_PP_HO=\ + ".\..\os2ish.h"\ + ".\..\vmsish.h"\ + + +"$(INTDIR)\pp_hot.obj" : $(SOURCE) $(DEP_CPP_PP_HO) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=..\pp_sys.c + +!IF "$(CFG)" == "libperl - Win32 Release" + +DEP_CPP_PP_SY=\ + "..\EXTERN.h"\ + ".\..\perl.h"\ + ".\config.h"\ + ".\include\dirent.h"\ + ".\include\netdb.h"\ + ".\include\sys/socket.h"\ + ".\win32.h"\ + + +"$(INTDIR)\pp_sys.obj" : $(SOURCE) $(DEP_CPP_PP_SY) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "libperl - Win32 Debug" + +DEP_CPP_PP_SY=\ + "..\EXTERN.h"\ + ".\..\av.h"\ + ".\..\cop.h"\ + ".\..\cv.h"\ + ".\..\dosish.h"\ + ".\..\embed.h"\ + ".\..\form.h"\ + ".\..\gv.h"\ + ".\..\handy.h"\ + ".\..\hv.h"\ + ".\..\mg.h"\ + ".\..\nostdio.h"\ + ".\..\op.h"\ + ".\..\opcode.h"\ + ".\..\perl.h"\ + ".\..\perlio.h"\ + ".\..\perlsdio.h"\ + ".\..\perlsfio.h"\ + ".\..\perly.h"\ + ".\..\plan9\plan9ish.h"\ + ".\..\pp.h"\ + ".\..\proto.h"\ + ".\..\regexp.h"\ + ".\..\scope.h"\ + ".\..\sv.h"\ + ".\..\unixish.h"\ + ".\..\util.h"\ + ".\config.h"\ + ".\include\dirent.h"\ + ".\include\netdb.h"\ + ".\include\sys/socket.h"\ + ".\win32.h"\ + ".\win32io.h"\ + ".\win32iop.h"\ + {$(INCLUDE)}"\Sys\Stat.h"\ + {$(INCLUDE)}"\Sys\Types.h"\ + +NODEP_CPP_PP_SY=\ + ".\..\os2ish.h"\ + ".\..\vmsish.h"\ + + +"$(INTDIR)\pp_sys.obj" : $(SOURCE) $(DEP_CPP_PP_SY) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=..\regcomp.c + +!IF "$(CFG)" == "libperl - Win32 Release" + +DEP_CPP_REGCO=\ + "..\EXTERN.h"\ + ".\..\INTERN.h"\ + ".\..\perl.h"\ + ".\..\regcomp.h"\ + ".\config.h"\ + ".\include\dirent.h"\ + ".\include\netdb.h"\ + ".\include\sys/socket.h"\ + ".\win32.h"\ + + +"$(INTDIR)\regcomp.obj" : $(SOURCE) $(DEP_CPP_REGCO) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "libperl - Win32 Debug" + +DEP_CPP_REGCO=\ + "..\EXTERN.h"\ + ".\..\av.h"\ + ".\..\cop.h"\ + ".\..\cv.h"\ + ".\..\dosish.h"\ + ".\..\embed.h"\ + ".\..\form.h"\ + ".\..\gv.h"\ + ".\..\handy.h"\ + ".\..\hv.h"\ + ".\..\INTERN.h"\ + ".\..\mg.h"\ + ".\..\nostdio.h"\ + ".\..\op.h"\ + ".\..\opcode.h"\ + ".\..\perl.h"\ + ".\..\perlio.h"\ + ".\..\perlsdio.h"\ + ".\..\perlsfio.h"\ + ".\..\perly.h"\ + ".\..\plan9\plan9ish.h"\ + ".\..\pp.h"\ + ".\..\proto.h"\ + ".\..\regcomp.h"\ + ".\..\regexp.h"\ + ".\..\scope.h"\ + ".\..\sv.h"\ + ".\..\unixish.h"\ + ".\..\util.h"\ + ".\config.h"\ + ".\include\dirent.h"\ + ".\include\netdb.h"\ + ".\include\sys/socket.h"\ + ".\win32.h"\ + ".\win32io.h"\ + ".\win32iop.h"\ + {$(INCLUDE)}"\Sys\Stat.h"\ + {$(INCLUDE)}"\Sys\Types.h"\ + +NODEP_CPP_REGCO=\ + ".\..\os2ish.h"\ + ".\..\vmsish.h"\ + + +"$(INTDIR)\regcomp.obj" : $(SOURCE) $(DEP_CPP_REGCO) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=..\regexec.c + +!IF "$(CFG)" == "libperl - Win32 Release" + +DEP_CPP_REGEX=\ + "..\EXTERN.h"\ + ".\..\perl.h"\ + ".\..\regcomp.h"\ + ".\config.h"\ + ".\include\dirent.h"\ + ".\include\netdb.h"\ + ".\include\sys/socket.h"\ + ".\win32.h"\ + + +"$(INTDIR)\regexec.obj" : $(SOURCE) $(DEP_CPP_REGEX) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "libperl - Win32 Debug" + +DEP_CPP_REGEX=\ + "..\EXTERN.h"\ + ".\..\av.h"\ + ".\..\cop.h"\ + ".\..\cv.h"\ + ".\..\dosish.h"\ + ".\..\embed.h"\ + ".\..\form.h"\ + ".\..\gv.h"\ + ".\..\handy.h"\ + ".\..\hv.h"\ + ".\..\mg.h"\ + ".\..\nostdio.h"\ + ".\..\op.h"\ + ".\..\opcode.h"\ + ".\..\perl.h"\ + ".\..\perlio.h"\ + ".\..\perlsdio.h"\ + ".\..\perlsfio.h"\ + ".\..\perly.h"\ + ".\..\plan9\plan9ish.h"\ + ".\..\pp.h"\ + ".\..\proto.h"\ + ".\..\regcomp.h"\ + ".\..\regexp.h"\ + ".\..\scope.h"\ + ".\..\sv.h"\ + ".\..\unixish.h"\ + ".\..\util.h"\ + ".\config.h"\ + ".\include\dirent.h"\ + ".\include\netdb.h"\ + ".\include\sys/socket.h"\ + ".\win32.h"\ + ".\win32io.h"\ + ".\win32iop.h"\ + {$(INCLUDE)}"\Sys\Stat.h"\ + {$(INCLUDE)}"\Sys\Types.h"\ + +NODEP_CPP_REGEX=\ + ".\..\os2ish.h"\ + ".\..\vmsish.h"\ + + +"$(INTDIR)\regexec.obj" : $(SOURCE) $(DEP_CPP_REGEX) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=..\run.c + +!IF "$(CFG)" == "libperl - Win32 Release" + +DEP_CPP_RUN_C=\ + "..\EXTERN.h"\ + ".\..\perl.h"\ + ".\config.h"\ + ".\include\dirent.h"\ + ".\include\netdb.h"\ + ".\include\sys/socket.h"\ + ".\win32.h"\ + + +"$(INTDIR)\run.obj" : $(SOURCE) $(DEP_CPP_RUN_C) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "libperl - Win32 Debug" + +DEP_CPP_RUN_C=\ + "..\EXTERN.h"\ + ".\..\av.h"\ + ".\..\cop.h"\ + ".\..\cv.h"\ + ".\..\dosish.h"\ + ".\..\embed.h"\ + ".\..\form.h"\ + ".\..\gv.h"\ + ".\..\handy.h"\ + ".\..\hv.h"\ + ".\..\mg.h"\ + ".\..\nostdio.h"\ + ".\..\op.h"\ + ".\..\opcode.h"\ + ".\..\perl.h"\ + ".\..\perlio.h"\ + ".\..\perlsdio.h"\ + ".\..\perlsfio.h"\ + ".\..\perly.h"\ + ".\..\plan9\plan9ish.h"\ + ".\..\pp.h"\ + ".\..\proto.h"\ + ".\..\regexp.h"\ + ".\..\scope.h"\ + ".\..\sv.h"\ + ".\..\unixish.h"\ + ".\..\util.h"\ + ".\config.h"\ + ".\include\dirent.h"\ + ".\include\netdb.h"\ + ".\include\sys/socket.h"\ + ".\win32.h"\ + ".\win32io.h"\ + ".\win32iop.h"\ + {$(INCLUDE)}"\Sys\Stat.h"\ + {$(INCLUDE)}"\Sys\Types.h"\ + +NODEP_CPP_RUN_C=\ + ".\..\os2ish.h"\ + ".\..\vmsish.h"\ + + +"$(INTDIR)\run.obj" : $(SOURCE) $(DEP_CPP_RUN_C) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=..\scope.c + +!IF "$(CFG)" == "libperl - Win32 Release" + +DEP_CPP_SCOPE=\ + "..\EXTERN.h"\ + ".\..\perl.h"\ + ".\config.h"\ + ".\include\dirent.h"\ + ".\include\netdb.h"\ + ".\include\sys/socket.h"\ + ".\win32.h"\ + + +"$(INTDIR)\scope.obj" : $(SOURCE) $(DEP_CPP_SCOPE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "libperl - Win32 Debug" + +DEP_CPP_SCOPE=\ + "..\EXTERN.h"\ + ".\..\av.h"\ + ".\..\cop.h"\ + ".\..\cv.h"\ + ".\..\dosish.h"\ + ".\..\embed.h"\ + ".\..\form.h"\ + ".\..\gv.h"\ + ".\..\handy.h"\ + ".\..\hv.h"\ + ".\..\mg.h"\ + ".\..\nostdio.h"\ + ".\..\op.h"\ + ".\..\opcode.h"\ + ".\..\perl.h"\ + ".\..\perlio.h"\ + ".\..\perlsdio.h"\ + ".\..\perlsfio.h"\ + ".\..\perly.h"\ + ".\..\plan9\plan9ish.h"\ + ".\..\pp.h"\ + ".\..\proto.h"\ + ".\..\regexp.h"\ + ".\..\scope.h"\ + ".\..\sv.h"\ + ".\..\unixish.h"\ + ".\..\util.h"\ + ".\config.h"\ + ".\include\dirent.h"\ + ".\include\netdb.h"\ + ".\include\sys/socket.h"\ + ".\win32.h"\ + ".\win32io.h"\ + ".\win32iop.h"\ + {$(INCLUDE)}"\Sys\Stat.h"\ + {$(INCLUDE)}"\Sys\Types.h"\ + +NODEP_CPP_SCOPE=\ + ".\..\os2ish.h"\ + ".\..\vmsish.h"\ + + +"$(INTDIR)\scope.obj" : $(SOURCE) $(DEP_CPP_SCOPE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=..\sv.c + +!IF "$(CFG)" == "libperl - Win32 Release" + +DEP_CPP_SV_C2a=\ + "..\EXTERN.h"\ + ".\..\perl.h"\ + ".\config.h"\ + ".\include\dirent.h"\ + ".\include\netdb.h"\ + ".\include\sys/socket.h"\ + ".\win32.h"\ + + +"$(INTDIR)\sv.obj" : $(SOURCE) $(DEP_CPP_SV_C2a) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "libperl - Win32 Debug" + +DEP_CPP_SV_C2a=\ + "..\EXTERN.h"\ + ".\..\av.h"\ + ".\..\cop.h"\ + ".\..\cv.h"\ + ".\..\dosish.h"\ + ".\..\embed.h"\ + ".\..\form.h"\ + ".\..\gv.h"\ + ".\..\handy.h"\ + ".\..\hv.h"\ + ".\..\mg.h"\ + ".\..\nostdio.h"\ + ".\..\op.h"\ + ".\..\opcode.h"\ + ".\..\perl.h"\ + ".\..\perlio.h"\ + ".\..\perlsdio.h"\ + ".\..\perlsfio.h"\ + ".\..\perly.h"\ + ".\..\plan9\plan9ish.h"\ + ".\..\pp.h"\ + ".\..\proto.h"\ + ".\..\regexp.h"\ + ".\..\scope.h"\ + ".\..\sv.h"\ + ".\..\unixish.h"\ + ".\..\util.h"\ + ".\config.h"\ + ".\include\dirent.h"\ + ".\include\netdb.h"\ + ".\include\sys/socket.h"\ + ".\win32.h"\ + ".\win32io.h"\ + ".\win32iop.h"\ + {$(INCLUDE)}"\Sys\Stat.h"\ + {$(INCLUDE)}"\Sys\Types.h"\ + +NODEP_CPP_SV_C2a=\ + ".\..\os2ish.h"\ + ".\..\vmsish.h"\ + + +"$(INTDIR)\sv.obj" : $(SOURCE) $(DEP_CPP_SV_C2a) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=..\taint.c + +!IF "$(CFG)" == "libperl - Win32 Release" + +DEP_CPP_TAINT=\ + "..\EXTERN.h"\ + ".\..\perl.h"\ + ".\config.h"\ + ".\include\dirent.h"\ + ".\include\netdb.h"\ + ".\include\sys/socket.h"\ + ".\win32.h"\ + + +"$(INTDIR)\taint.obj" : $(SOURCE) $(DEP_CPP_TAINT) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "libperl - Win32 Debug" + +DEP_CPP_TAINT=\ + "..\EXTERN.h"\ + ".\..\av.h"\ + ".\..\cop.h"\ + ".\..\cv.h"\ + ".\..\dosish.h"\ + ".\..\embed.h"\ + ".\..\form.h"\ + ".\..\gv.h"\ + ".\..\handy.h"\ + ".\..\hv.h"\ + ".\..\mg.h"\ + ".\..\nostdio.h"\ + ".\..\op.h"\ + ".\..\opcode.h"\ + ".\..\perl.h"\ + ".\..\perlio.h"\ + ".\..\perlsdio.h"\ + ".\..\perlsfio.h"\ + ".\..\perly.h"\ + ".\..\plan9\plan9ish.h"\ + ".\..\pp.h"\ + ".\..\proto.h"\ + ".\..\regexp.h"\ + ".\..\scope.h"\ + ".\..\sv.h"\ + ".\..\unixish.h"\ + ".\..\util.h"\ + ".\config.h"\ + ".\include\dirent.h"\ + ".\include\netdb.h"\ + ".\include\sys/socket.h"\ + ".\win32.h"\ + ".\win32io.h"\ + ".\win32iop.h"\ + {$(INCLUDE)}"\Sys\Stat.h"\ + {$(INCLUDE)}"\Sys\Types.h"\ + +NODEP_CPP_TAINT=\ + ".\..\os2ish.h"\ + ".\..\vmsish.h"\ + + +"$(INTDIR)\taint.obj" : $(SOURCE) $(DEP_CPP_TAINT) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=..\toke.c + +!IF "$(CFG)" == "libperl - Win32 Release" + +DEP_CPP_TOKE_=\ + "..\EXTERN.h"\ + ".\..\keywords.h"\ + ".\..\perl.h"\ + ".\config.h"\ + ".\include\dirent.h"\ + ".\include\netdb.h"\ + ".\include\sys/socket.h"\ + ".\win32.h"\ + + +"$(INTDIR)\toke.obj" : $(SOURCE) $(DEP_CPP_TOKE_) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "libperl - Win32 Debug" + +DEP_CPP_TOKE_=\ + "..\EXTERN.h"\ + ".\..\av.h"\ + ".\..\cop.h"\ + ".\..\cv.h"\ + ".\..\dosish.h"\ + ".\..\embed.h"\ + ".\..\form.h"\ + ".\..\gv.h"\ + ".\..\handy.h"\ + ".\..\hv.h"\ + ".\..\keywords.h"\ + ".\..\mg.h"\ + ".\..\nostdio.h"\ + ".\..\op.h"\ + ".\..\opcode.h"\ + ".\..\perl.h"\ + ".\..\perlio.h"\ + ".\..\perlsdio.h"\ + ".\..\perlsfio.h"\ + ".\..\perly.h"\ + ".\..\plan9\plan9ish.h"\ + ".\..\pp.h"\ + ".\..\proto.h"\ + ".\..\regexp.h"\ + ".\..\scope.h"\ + ".\..\sv.h"\ + ".\..\unixish.h"\ + ".\..\util.h"\ + ".\config.h"\ + ".\include\dirent.h"\ + ".\include\netdb.h"\ + ".\include\sys/socket.h"\ + ".\win32.h"\ + ".\win32io.h"\ + ".\win32iop.h"\ + {$(INCLUDE)}"\Sys\Stat.h"\ + {$(INCLUDE)}"\Sys\Types.h"\ + +NODEP_CPP_TOKE_=\ + ".\..\os2ish.h"\ + ".\..\vmsish.h"\ + + +"$(INTDIR)\toke.obj" : $(SOURCE) $(DEP_CPP_TOKE_) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=..\universal.c + +!IF "$(CFG)" == "libperl - Win32 Release" + +DEP_CPP_UNIVE=\ + "..\EXTERN.h"\ + ".\..\perl.h"\ + ".\..\XSUB.h"\ + ".\config.h"\ + ".\include\dirent.h"\ + ".\include\netdb.h"\ + ".\include\sys/socket.h"\ + ".\win32.h"\ + + +"$(INTDIR)\universal.obj" : $(SOURCE) $(DEP_CPP_UNIVE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "libperl - Win32 Debug" + +DEP_CPP_UNIVE=\ + "..\EXTERN.h"\ + ".\..\av.h"\ + ".\..\cop.h"\ + ".\..\cv.h"\ + ".\..\dosish.h"\ + ".\..\embed.h"\ + ".\..\form.h"\ + ".\..\gv.h"\ + ".\..\handy.h"\ + ".\..\hv.h"\ + ".\..\mg.h"\ + ".\..\nostdio.h"\ + ".\..\op.h"\ + ".\..\opcode.h"\ + ".\..\perl.h"\ + ".\..\perlio.h"\ + ".\..\perlsdio.h"\ + ".\..\perlsfio.h"\ + ".\..\perly.h"\ + ".\..\plan9\plan9ish.h"\ + ".\..\pp.h"\ + ".\..\proto.h"\ + ".\..\regexp.h"\ + ".\..\scope.h"\ + ".\..\sv.h"\ + ".\..\unixish.h"\ + ".\..\util.h"\ + ".\..\XSUB.h"\ + ".\config.h"\ + ".\include\dirent.h"\ + ".\include\netdb.h"\ + ".\include\sys/socket.h"\ + ".\win32.h"\ + ".\win32io.h"\ + ".\win32iop.h"\ + {$(INCLUDE)}"\Sys\Stat.h"\ + {$(INCLUDE)}"\Sys\Types.h"\ + +NODEP_CPP_UNIVE=\ + ".\..\os2ish.h"\ + ".\..\vmsish.h"\ + + +"$(INTDIR)\universal.obj" : $(SOURCE) $(DEP_CPP_UNIVE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=..\util.c + +!IF "$(CFG)" == "libperl - Win32 Release" + +DEP_CPP_UTIL_=\ + "..\EXTERN.h"\ + ".\..\perl.h"\ + ".\config.h"\ + ".\include\dirent.h"\ + ".\include\netdb.h"\ + ".\include\sys/socket.h"\ + ".\win32.h"\ + + +"$(INTDIR)\util.obj" : $(SOURCE) $(DEP_CPP_UTIL_) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "libperl - Win32 Debug" + +DEP_CPP_UTIL_=\ + "..\EXTERN.h"\ + ".\..\av.h"\ + ".\..\cop.h"\ + ".\..\cv.h"\ + ".\..\dosish.h"\ + ".\..\embed.h"\ + ".\..\form.h"\ + ".\..\gv.h"\ + ".\..\handy.h"\ + ".\..\hv.h"\ + ".\..\mg.h"\ + ".\..\nostdio.h"\ + ".\..\op.h"\ + ".\..\opcode.h"\ + ".\..\perl.h"\ + ".\..\perlio.h"\ + ".\..\perlsdio.h"\ + ".\..\perlsfio.h"\ + ".\..\perly.h"\ + ".\..\plan9\plan9ish.h"\ + ".\..\pp.h"\ + ".\..\proto.h"\ + ".\..\regexp.h"\ + ".\..\scope.h"\ + ".\..\sv.h"\ + ".\..\unixish.h"\ + ".\..\util.h"\ + ".\config.h"\ + ".\include\dirent.h"\ + ".\include\netdb.h"\ + ".\include\sys/socket.h"\ + ".\win32.h"\ + ".\win32io.h"\ + ".\win32iop.h"\ + {$(INCLUDE)}"\Sys\Stat.h"\ + {$(INCLUDE)}"\Sys\Types.h"\ + +NODEP_CPP_UTIL_=\ + ".\..\os2ish.h"\ + ".\..\vmsish.h"\ + + +"$(INTDIR)\util.obj" : $(SOURCE) $(DEP_CPP_UTIL_) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +# End Source File +# End Target +# End Project +################################################################################ diff --git a/win32/makedef.pl b/win32/makedef.pl new file mode 100644 index 0000000000..1a555f53f3 --- /dev/null +++ b/win32/makedef.pl @@ -0,0 +1,212 @@ + +#!../miniperl + +# Written: 10 April 1996 Gary Ng (71564.1743@compuserve.com) + +# Create the export list for perl. +# Needed by WIN32 for creating perl.dll +# based on perl_exp.SH in the main perl distribution directory + +# This simple program relys on 'global.sym' being up to date +# with all of the global symbols that a dynamicly link library +# might want to access. + +# There is some symbol defined in global.sym and interp.sym +# that does not present in the WIN32 port but there is no easy +# way to find them so I just put a exeception list here + +$skip_sym=<<'!END!OF!SKIP!'; +Perl_SvIV +Perl_SvNV +Perl_SvTRUE +Perl_SvUV +Perl_block_type +Perl_sv_pvn +Perl_additem +Perl_cast_ulong +Perl_check_uni +Perl_checkcomma +Perl_chsize +Perl_ck_aelem +Perl_cryptseen +Perl_cx_dump +Perl_deb +Perl_deb_growlevel +Perl_debop +Perl_debprofdump +Perl_debstack +Perl_debstackptrs +Perl_do_ipcctl +Perl_do_ipcget +Perl_do_msgrcv +Perl_do_msgsnd +Perl_do_semop +Perl_do_shmio +Perl_doeval +Perl_dofindlabel +Perl_dopoptoeval +Perl_dump_eval +Perl_dump_fds +Perl_dump_form +Perl_dump_gv +Perl_dump_mstats +Perl_dump_op +Perl_dump_packsubs +Perl_dump_pm +Perl_dump_sub +Perl_expectterm +Perl_fetch_gv +Perl_fetch_io +Perl_force_ident +Perl_force_next +Perl_force_word +Perl_hv_stashpv +Perl_intuit_more +Perl_know_next +Perl_modkids +Perl_mstats +Perl_my_bzero +Perl_my_htonl +Perl_my_ntohl +Perl_my_swap +Perl_my_chsize +Perl_newXSUB +Perl_no_fh_allowed +Perl_no_op +Perl_nointrp +Perl_nomem +Perl_pp_cswitch +Perl_pp_entersubr +Perl_pp_evalonce +Perl_pp_interp +Perl_pp_map +Perl_pp_nswitch +Perl_q +Perl_reall_srchlen +Perl_regdump +Perl_regfold +Perl_regmyendp +Perl_regmyp_size +Perl_regmystartp +Perl_regnarrate +Perl_regprop +Perl_same_dirent +Perl_saw_return +Perl_scan_const +Perl_scan_formline +Perl_scan_heredoc +Perl_scan_ident +Perl_scan_inputsymbol +Perl_scan_pat +Perl_scan_prefix +Perl_scan_str +Perl_scan_subst +Perl_scan_trans +Perl_scan_word +Perl_skipspace +Perl_sublex_done +Perl_sublex_start +Perl_sv_peek +Perl_sv_ref +Perl_sv_setptrobj +Perl_timesbuf +Perl_too_few_arguments +Perl_too_many_arguments +Perl_unlnk +Perl_wait4pid +Perl_watch +Perl_yyname +Perl_yyrule +allgvs +curblock +curcop +curcopdb +curcsv +envgv +lastretstr +mystack_mark +perl_init_ext +perl_requirepv +siggv +stack +tainting +Perl_safexcalloc +Perl_safexmalloc +Perl_safexfree +Perl_safexrealloc +!END!OF!SKIP! + +# All symbols have a Perl_ prefix because that's what embed.h +# sticks in front of them. + + +print "LIBRARY Perl\n"; +print "DESCRIPTION 'Perl interpreter, export autogenerated'\n"; +print "CODE LOADONCALL\n"; +print "DATA LOADONCALL NONSHARED MULTIPLE\n"; +print "EXPORTS\n"; + +open (GLOBAL, "<../global.sym") || die "failed to open global.sym" . $!; +while (<GLOBAL>) { + my $symbol; + next if (!/^[A-Za-z]/); + next if (/_amg[ \t]*$/); + $symbol = "Perl_$_"; + next if ($skip_sym =~ m/$symbol/m); + print "\t$symbol"; + }; +close(GLOBAL); + +# also add symbols from interp.sym +# They are only needed if -DMULTIPLICITY is not set but it +# doesn't hurt to include them anyway. +# these don't have Perl prefix + +open (INTERP, "<../interp.sym") || die "failed to open interp.sym" . $!; +while (<INTERP>) { + my $symbol; + next if (!/^[A-Za-z]/); + next if (/_amg[ \t]*$/); + $symbol = $_; + next if ($skip_sym =~ m/$symbol/m); + #print "\t$symbol"; + print "\tPerl_$symbol"; + }; + +#close(INTERP); + +while (<DATA>) { + my $symbol; + next if (!/^[A-Za-z]/); + next if (/^#/); + $symbol = $_; + next if ($skip_sym =~ m/^$symbol/m); + print "\t$symbol"; + }; + +1; +__DATA__ +# extra globals not included above. +perl_init_i18nl10n +perl_init_ext +perl_alloc +perl_construct +perl_destruct +perl_free +perl_parse +perl_run +perl_get_sv +perl_get_av +perl_get_hv +perl_get_cv +perl_call_argv +perl_call_pv +perl_call_method +perl_call_sv +perl_requirepv +win32_inet_addr +win32_gethostbyname +win32_inet_ntoa +win32_htons +win32_ntohs +win32_htonl diff --git a/win32/makemain.pl b/win32/makemain.pl new file mode 100644 index 0000000000..740b6a212a --- /dev/null +++ b/win32/makemain.pl @@ -0,0 +1,45 @@ +open (MINIMAIN, "<../miniperlmain.c") || die "failed to open miniperlmain.c" . $!; + +while (<MINIMAIN>) { + if (/Do not delete this line--writemain depends on it/) { + last; + } + else { + print $_; + } + }; + +close(MINIMAIN); + +print "char *staticlinkmodules[]={\n"; +foreach (@ARGV) { + print "\t\"".$_."\",\n"; + } +print "\tNULL,\n"; +print "\t};\n"; +print "\n"; +foreach (@ARGV) { + print "EXTERN_C void boot_$_ _((CV* cv));\n" + } + +print <<EOP; + +static void +xs_init() +{ + dXSUB_SYS; + char *file = __FILE__; +EOP + +foreach (@ARGV) { + if (/DynaLoader/) { + print "\tnewXS(\"$_\:\:boot_$_\", boot_$_, file);\n"; + } + else { + print "\tnewXS(\"$_\:\:bootstrap\", boot_$_, file);\n"; + }; + } + +print <<EOP; +} +EOP diff --git a/win32/makeperldef.pl b/win32/makeperldef.pl new file mode 100644 index 0000000000..0ad09b8303 --- /dev/null +++ b/win32/makeperldef.pl @@ -0,0 +1,4 @@ +print "EXPORTS\n"; +foreach (@ARGV) { + print "\tboot_$_\n" + }; diff --git a/win32/miniperl.mak b/win32/miniperl.mak new file mode 100644 index 0000000000..da3daf986f --- /dev/null +++ b/win32/miniperl.mak @@ -0,0 +1,393 @@ +# Microsoft Developer Studio Generated NMAKE File, Format Version 4.20 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +!IF "$(CFG)" == "" +CFG=miniperl - Win32 Debug +!MESSAGE No configuration specified. Defaulting to miniperl - Win32 Debug. +!ENDIF + +!IF "$(CFG)" != "miniperl - Win32 Release" && "$(CFG)" !=\ + "miniperl - Win32 Debug" +!MESSAGE Invalid configuration "$(CFG)" specified. +!MESSAGE You can specify a configuration when running NMAKE on this makefile +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "miniperl.mak" CFG="miniperl - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "miniperl - Win32 Release" (based on\ + "Win32 (x86) Console Application") +!MESSAGE "miniperl - Win32 Debug" (based on "Win32 (x86) Console Application") +!MESSAGE +!ERROR An invalid configuration is specified. +!ENDIF + +!IF "$(OS)" == "Windows_NT" +NULL= +!ELSE +NULL=nul +!ENDIF +################################################################################ +# Begin Project +# PROP Target_Last_Scanned "miniperl - Win32 Debug" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "miniperl - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "miniperl" +# PROP BASE Intermediate_Dir "miniperl" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Target_Dir "" +OUTDIR=.\Release +INTDIR=.\Release + +ALL : "..\miniperl.exe" + +CLEAN : + -@erase "$(INTDIR)\miniperlmain.obj" + -@erase "$(INTDIR)\win32.obj" + -@erase "$(INTDIR)\win32aux.obj" + -@erase "$(INTDIR)\win32io.obj" + -@erase "$(INTDIR)\win32sck.obj" + -@erase "..\miniperl.exe" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c +# ADD CPP /nologo /MT /W3 /GX /Od /I "." /I ".\include" /I ".." /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "PERLDLL" /YX /c +CPP_PROJ=/nologo /MT /W3 /GX /Od /I "." /I ".\include" /I ".." /D "NDEBUG" /D\ + "WIN32" /D "_CONSOLE" /D "PERLDLL" /Fp"$(INTDIR)/miniperl.pch" /YX\ + /Fo"$(INTDIR)/" /c +CPP_OBJS=.\Release/ +CPP_SBRS=.\. +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +BSC32_FLAGS=/nologo /o"$(OUTDIR)/miniperl.bsc" +BSC32_SBRS= \ + +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:console /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:console /machine:I386 /out:"../miniperl.exe" +# SUBTRACT LINK32 /incremental:yes /debug +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ + advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo\ + /subsystem:console /incremental:no /pdb:"$(OUTDIR)/miniperl.pdb" /machine:I386\ + /out:"../miniperl.exe" +LINK32_OBJS= \ + "$(INTDIR)\miniperlmain.obj" \ + "$(INTDIR)\win32.obj" \ + "$(INTDIR)\win32aux.obj" \ + "$(INTDIR)\win32io.obj" \ + "$(INTDIR)\win32sck.obj" \ + "..\libperl.lib" + +"..\miniperl.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ELSEIF "$(CFG)" == "miniperl - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "miniper0" +# PROP BASE Intermediate_Dir "miniper0" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Target_Dir "" +OUTDIR=.\Debug +INTDIR=.\Debug + +ALL : "..\miniperl.exe" + +CLEAN : + -@erase "$(INTDIR)\miniperlmain.obj" + -@erase "$(INTDIR)\vc40.idb" + -@erase "$(INTDIR)\vc40.pdb" + -@erase "$(INTDIR)\win32.obj" + -@erase "$(INTDIR)\win32aux.obj" + -@erase "$(INTDIR)\win32io.obj" + -@erase "$(INTDIR)\win32sck.obj" + -@erase "$(OUTDIR)\miniperl.pdb" + -@erase "..\miniperl.exe" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /c +# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "." /I ".\include" /I ".." /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "PERLDLL" /YX /c +CPP_PROJ=/nologo /MTd /W3 /Gm /GX /Zi /Od /I "." /I ".\include" /I ".." /D\ + "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "PERLDLL" /Fp"$(INTDIR)/miniperl.pch" /YX\ + /Fo"$(INTDIR)/" /Fd"$(INTDIR)/" /c +CPP_OBJS=.\Debug/ +CPP_SBRS=.\. +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +BSC32_FLAGS=/nologo /o"$(OUTDIR)/miniperl.bsc" +BSC32_SBRS= \ + +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:console /debug /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:console /incremental:no /debug /machine:I386 /out:"../miniperl.exe" +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ + advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo\ + /subsystem:console /incremental:no /pdb:"$(OUTDIR)/miniperl.pdb" /debug\ + /machine:I386 /out:"../miniperl.exe" +LINK32_OBJS= \ + "$(INTDIR)\miniperlmain.obj" \ + "$(INTDIR)\win32.obj" \ + "$(INTDIR)\win32aux.obj" \ + "$(INTDIR)\win32io.obj" \ + "$(INTDIR)\win32sck.obj" \ + "..\libperl.lib" + +"..\miniperl.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ENDIF + +.c{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.cpp{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.cxx{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.c{$(CPP_SBRS)}.sbr: + $(CPP) $(CPP_PROJ) $< + +.cpp{$(CPP_SBRS)}.sbr: + $(CPP) $(CPP_PROJ) $< + +.cxx{$(CPP_SBRS)}.sbr: + $(CPP) $(CPP_PROJ) $< + +################################################################################ +# Begin Target + +# Name "miniperl - Win32 Release" +# Name "miniperl - Win32 Debug" + +!IF "$(CFG)" == "miniperl - Win32 Release" + +!ELSEIF "$(CFG)" == "miniperl - Win32 Debug" + +!ENDIF + +################################################################################ +# Begin Source File + +SOURCE=..\miniperlmain.c +DEP_CPP_MINIP=\ + "..\av.h"\ + "..\cop.h"\ + "..\hv.h"\ + "..\mg.h"\ + "..\op.h"\ + "..\opcode.h"\ + "..\perl.h"\ + "..\perly.h"\ + "..\pp.h"\ + "..\proto.h"\ + "..\scope.h"\ + ".\..\cv.h"\ + ".\..\dosish.h"\ + ".\..\embed.h"\ + ".\..\EXTERN.h"\ + ".\..\form.h"\ + ".\..\gv.h"\ + ".\..\handy.h"\ + ".\..\nostdio.h"\ + ".\..\perlio.h"\ + ".\..\perlsdio.h"\ + ".\..\perlsfio.h"\ + ".\..\plan9\plan9ish.h"\ + ".\..\regexp.h"\ + ".\..\sv.h"\ + ".\..\unixish.h"\ + ".\..\util.h"\ + ".\config.h"\ + ".\include\dirent.h"\ + ".\include\netdb.h"\ + ".\include\sys/socket.h"\ + ".\win32.h"\ + ".\win32io.h"\ + {$(INCLUDE)}"\Sys\Stat.h"\ + {$(INCLUDE)}"\Sys\Types.h"\ + +NODEP_CPP_MINIP=\ + ".\..\os2ish.h"\ + ".\..\vmsish.h"\ + + +"$(INTDIR)\miniperlmain.obj" : $(SOURCE) $(DEP_CPP_MINIP) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=..\libperl.lib + +!IF "$(CFG)" == "miniperl - Win32 Release" + +!ELSEIF "$(CFG)" == "miniperl - Win32 Debug" + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\win32.c +DEP_CPP_WIN32=\ + "..\av.h"\ + "..\cop.h"\ + "..\hv.h"\ + "..\mg.h"\ + "..\op.h"\ + "..\opcode.h"\ + "..\perl.h"\ + "..\perly.h"\ + "..\pp.h"\ + "..\proto.h"\ + "..\scope.h"\ + ".\..\cv.h"\ + ".\..\dosish.h"\ + ".\..\embed.h"\ + ".\..\form.h"\ + ".\..\gv.h"\ + ".\..\handy.h"\ + ".\..\nostdio.h"\ + ".\..\perlio.h"\ + ".\..\perlsdio.h"\ + ".\..\perlsfio.h"\ + ".\..\plan9\plan9ish.h"\ + ".\..\regexp.h"\ + ".\..\sv.h"\ + ".\..\unixish.h"\ + ".\..\util.h"\ + ".\config.h"\ + ".\EXTERN.h"\ + ".\include\dirent.h"\ + ".\include\netdb.h"\ + ".\include\sys/socket.h"\ + ".\win32.h"\ + ".\win32io.h"\ + {$(INCLUDE)}"\Sys\Stat.h"\ + {$(INCLUDE)}"\Sys\Types.h"\ + +NODEP_CPP_WIN32=\ + ".\..\os2ish.h"\ + ".\..\vmsish.h"\ + + +"$(INTDIR)\win32.obj" : $(SOURCE) $(DEP_CPP_WIN32) "$(INTDIR)" + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\win32sck.c +DEP_CPP_WIN32S=\ + "..\av.h"\ + "..\cop.h"\ + "..\hv.h"\ + "..\mg.h"\ + "..\op.h"\ + "..\opcode.h"\ + "..\perl.h"\ + "..\perly.h"\ + "..\pp.h"\ + "..\proto.h"\ + "..\scope.h"\ + ".\..\cv.h"\ + ".\..\dosish.h"\ + ".\..\embed.h"\ + ".\..\form.h"\ + ".\..\gv.h"\ + ".\..\handy.h"\ + ".\..\nostdio.h"\ + ".\..\perlio.h"\ + ".\..\perlsdio.h"\ + ".\..\perlsfio.h"\ + ".\..\plan9\plan9ish.h"\ + ".\..\regexp.h"\ + ".\..\sv.h"\ + ".\..\unixish.h"\ + ".\..\util.h"\ + ".\config.h"\ + ".\EXTERN.h"\ + ".\include\dirent.h"\ + ".\include\netdb.h"\ + ".\include\sys/socket.h"\ + ".\win32.h"\ + ".\win32io.h"\ + {$(INCLUDE)}"\Sys\Stat.h"\ + {$(INCLUDE)}"\Sys\Types.h"\ + +NODEP_CPP_WIN32S=\ + ".\..\os2ish.h"\ + ".\..\vmsish.h"\ + + +"$(INTDIR)\win32sck.obj" : $(SOURCE) $(DEP_CPP_WIN32S) "$(INTDIR)" + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\win32aux.cpp +DEP_CPP_WIN32A=\ + ".\include\sys/socket.h"\ + + +"$(INTDIR)\win32aux.obj" : $(SOURCE) $(DEP_CPP_WIN32A) "$(INTDIR)" + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\win32io.cpp +DEP_CPP_WIN32I=\ + ".\include\sys/socket.h"\ + ".\win32io.h"\ + {$(INCLUDE)}"\Sys\Stat.h"\ + {$(INCLUDE)}"\Sys\Types.h"\ + + +"$(INTDIR)\win32io.obj" : $(SOURCE) $(DEP_CPP_WIN32I) "$(INTDIR)" + + +# End Source File +# End Target +# End Project +################################################################################ diff --git a/win32/modules.mak b/win32/modules.mak new file mode 100644 index 0000000000..2a6505e959 --- /dev/null +++ b/win32/modules.mak @@ -0,0 +1,860 @@ +# Microsoft Developer Studio Generated NMAKE File, Format Version 4.20 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Static Library" 0x0104 + +!IF "$(CFG)" == "" +CFG=modules - Win32 Debug +!MESSAGE No configuration specified. Defaulting to modules - Win32 Debug. +!ENDIF + +!IF "$(CFG)" != "modules - Win32 Release" && "$(CFG)" !=\ + "modules - Win32 Debug" +!MESSAGE Invalid configuration "$(CFG)" specified. +!MESSAGE You can specify a configuration when running NMAKE on this makefile +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "modules.mak" CFG="modules - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "modules - Win32 Release" (based on "Win32 (x86) Static Library") +!MESSAGE "modules - Win32 Debug" (based on "Win32 (x86) Static Library") +!MESSAGE +!ERROR An invalid configuration is specified. +!ENDIF + +!IF "$(OS)" == "Windows_NT" +NULL= +!ELSE +NULL=nul +!ENDIF +################################################################################ +# Begin Project +# PROP Target_Last_Scanned "modules - Win32 Debug" +CPP=cl.exe + +!IF "$(CFG)" == "modules - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "modules_" +# PROP BASE Intermediate_Dir "modules_" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Target_Dir "" +OUTDIR=.\Release +INTDIR=.\Release + +ALL : ".\modules.lib" + +CLEAN : + -@erase "$(INTDIR)\Dynaloader.obj" + -@erase "$(INTDIR)\Fcntl.obj" + -@erase "$(INTDIR)\hash.obj" + -@erase "$(INTDIR)\IO.obj" + -@erase "$(INTDIR)\Opcode.obj" + -@erase "$(INTDIR)\pair.obj" + -@erase "$(INTDIR)\sdbm.obj" + -@erase "$(INTDIR)\SDBM_File.obj" + -@erase "$(INTDIR)\Socket.obj" + -@erase ".\modules.lib" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c +# ADD CPP /nologo /MT /W3 /GX /O2 /I ".\include" /I "." /I ".." /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "MSDOS" /YX /c +CPP_PROJ=/nologo /MT /W3 /GX /O2 /I ".\include" /I "." /I ".." /D "NDEBUG" /D\ + "WIN32" /D "_WINDOWS" /D "MSDOS" /Fp"$(INTDIR)/modules.pch" /YX /Fo"$(INTDIR)/"\ + /c +CPP_OBJS=.\Release/ +CPP_SBRS=.\. +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +BSC32_FLAGS=/nologo /o"$(OUTDIR)/modules.bsc" +BSC32_SBRS= \ + +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo /out:"modules.lib" +LIB32_FLAGS=/nologo /out:"modules.lib" +LIB32_OBJS= \ + "$(INTDIR)\Dynaloader.obj" \ + "$(INTDIR)\Fcntl.obj" \ + "$(INTDIR)\hash.obj" \ + "$(INTDIR)\IO.obj" \ + "$(INTDIR)\Opcode.obj" \ + "$(INTDIR)\pair.obj" \ + "$(INTDIR)\sdbm.obj" \ + "$(INTDIR)\SDBM_File.obj" \ + "$(INTDIR)\Socket.obj" + +".\modules.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS) + $(LIB32) @<< + $(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS) +<< + +!ELSEIF "$(CFG)" == "modules - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "modules0" +# PROP BASE Intermediate_Dir "modules0" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Target_Dir "" +OUTDIR=.\Debug +INTDIR=.\Debug + +ALL : ".\modules.lib" + +CLEAN : + -@erase "$(INTDIR)\Dynaloader.obj" + -@erase "$(INTDIR)\Fcntl.obj" + -@erase "$(INTDIR)\hash.obj" + -@erase "$(INTDIR)\IO.obj" + -@erase "$(INTDIR)\Opcode.obj" + -@erase "$(INTDIR)\pair.obj" + -@erase "$(INTDIR)\sdbm.obj" + -@erase "$(INTDIR)\SDBM_File.obj" + -@erase "$(INTDIR)\Socket.obj" + -@erase ".\modules.lib" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c +# ADD CPP /nologo /MTd /W3 /GX /Z7 /Od /I ".\include" /I "." /I ".." /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "MSDOS" /YX /c +CPP_PROJ=/nologo /MTd /W3 /GX /Z7 /Od /I ".\include" /I "." /I ".." /D "_DEBUG"\ + /D "WIN32" /D "_WINDOWS" /D "MSDOS" /Fp"$(INTDIR)/modules.pch" /YX\ + /Fo"$(INTDIR)/" /c +CPP_OBJS=.\Debug/ +CPP_SBRS=.\. +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +BSC32_FLAGS=/nologo /o"$(OUTDIR)/modules.bsc" +BSC32_SBRS= \ + +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo /out:"modules.lib" +LIB32_FLAGS=/nologo /out:"modules.lib" +LIB32_OBJS= \ + "$(INTDIR)\Dynaloader.obj" \ + "$(INTDIR)\Fcntl.obj" \ + "$(INTDIR)\hash.obj" \ + "$(INTDIR)\IO.obj" \ + "$(INTDIR)\Opcode.obj" \ + "$(INTDIR)\pair.obj" \ + "$(INTDIR)\sdbm.obj" \ + "$(INTDIR)\SDBM_File.obj" \ + "$(INTDIR)\Socket.obj" + +".\modules.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS) + $(LIB32) @<< + $(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS) +<< + +!ENDIF + +.c{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.cpp{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.cxx{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.c{$(CPP_SBRS)}.sbr: + $(CPP) $(CPP_PROJ) $< + +.cpp{$(CPP_SBRS)}.sbr: + $(CPP) $(CPP_PROJ) $< + +.cxx{$(CPP_SBRS)}.sbr: + $(CPP) $(CPP_PROJ) $< + +################################################################################ +# Begin Target + +# Name "modules - Win32 Release" +# Name "modules - Win32 Debug" + +!IF "$(CFG)" == "modules - Win32 Release" + +!ELSEIF "$(CFG)" == "modules - Win32 Debug" + +!ENDIF + +################################################################################ +# Begin Source File + +SOURCE=..\ext\DynaLoader\Dynaloader.c + +!IF "$(CFG)" == "modules - Win32 Release" + +DEP_CPP_DYNAL=\ + "..\av.h"\ + "..\cop.h"\ + "..\cv.h"\ + "..\dosish.h"\ + "..\embed.h"\ + "..\form.h"\ + "..\gv.h"\ + "..\handy.h"\ + "..\hv.h"\ + "..\mg.h"\ + "..\nostdio.h"\ + "..\op.h"\ + "..\opcode.h"\ + "..\perl.h"\ + "..\perlio.h"\ + "..\perlsdio.h"\ + "..\perlsfio.h"\ + "..\perly.h"\ + "..\plan9\plan9ish.h"\ + "..\pp.h"\ + "..\proto.h"\ + "..\regexp.h"\ + "..\scope.h"\ + "..\sv.h"\ + "..\unixish.h"\ + "..\util.h"\ + "..\XSUB.h"\ + ".\..\ext\DynaLoader\dlutils.c"\ + ".\config.h"\ + ".\EXTERN.h"\ + ".\include\dirent.h"\ + ".\include\netdb.h"\ + ".\include\sys/socket.h"\ + ".\win32.h"\ + {$(INCLUDE)}"\sys\Stat.h"\ + {$(INCLUDE)}"\sys\Types.h"\ + +NODEP_CPP_DYNAL=\ + "..\os2ish.h"\ + "..\vmsish.h"\ + + +"$(INTDIR)\Dynaloader.obj" : $(SOURCE) $(DEP_CPP_DYNAL) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "modules - Win32 Debug" + +DEP_CPP_DYNAL=\ + "..\av.h"\ + "..\cop.h"\ + "..\cv.h"\ + "..\dosish.h"\ + "..\embed.h"\ + "..\form.h"\ + "..\gv.h"\ + "..\handy.h"\ + "..\hv.h"\ + "..\mg.h"\ + "..\nostdio.h"\ + "..\op.h"\ + "..\opcode.h"\ + "..\perl.h"\ + "..\perlio.h"\ + "..\perlsdio.h"\ + "..\perlsfio.h"\ + "..\perly.h"\ + "..\plan9\plan9ish.h"\ + "..\pp.h"\ + "..\proto.h"\ + "..\regexp.h"\ + "..\scope.h"\ + "..\sv.h"\ + "..\unixish.h"\ + "..\util.h"\ + "..\XSUB.h"\ + ".\..\ext\DynaLoader\dlutils.c"\ + ".\config.h"\ + ".\EXTERN.h"\ + ".\include\dirent.h"\ + ".\include\netdb.h"\ + ".\include\sys/socket.h"\ + ".\win32.h"\ + ".\win32io.h"\ + ".\win32iop.h"\ + {$(INCLUDE)}"\sys\Stat.h"\ + {$(INCLUDE)}"\sys\Types.h"\ + +NODEP_CPP_DYNAL=\ + "..\os2ish.h"\ + "..\vmsish.h"\ + + +"$(INTDIR)\Dynaloader.obj" : $(SOURCE) $(DEP_CPP_DYNAL) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=..\ext\Fcntl\Fcntl.c + +!IF "$(CFG)" == "modules - Win32 Release" + +DEP_CPP_FCNTL=\ + "..\av.h"\ + "..\cop.h"\ + "..\cv.h"\ + "..\dosish.h"\ + "..\embed.h"\ + "..\form.h"\ + "..\gv.h"\ + "..\handy.h"\ + "..\hv.h"\ + "..\mg.h"\ + "..\nostdio.h"\ + "..\op.h"\ + "..\opcode.h"\ + "..\perl.h"\ + "..\perlio.h"\ + "..\perlsdio.h"\ + "..\perlsfio.h"\ + "..\perly.h"\ + "..\plan9\plan9ish.h"\ + "..\pp.h"\ + "..\proto.h"\ + "..\regexp.h"\ + "..\scope.h"\ + "..\sv.h"\ + "..\unixish.h"\ + "..\util.h"\ + "..\XSUB.h"\ + ".\config.h"\ + ".\EXTERN.h"\ + ".\include\dirent.h"\ + ".\include\netdb.h"\ + ".\include\sys/socket.h"\ + ".\win32.h"\ + {$(INCLUDE)}"\sys\Stat.h"\ + {$(INCLUDE)}"\sys\Types.h"\ + +NODEP_CPP_FCNTL=\ + "..\os2ish.h"\ + "..\vmsish.h"\ + + +"$(INTDIR)\Fcntl.obj" : $(SOURCE) $(DEP_CPP_FCNTL) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "modules - Win32 Debug" + +DEP_CPP_FCNTL=\ + "..\av.h"\ + "..\cop.h"\ + "..\cv.h"\ + "..\dosish.h"\ + "..\embed.h"\ + "..\form.h"\ + "..\gv.h"\ + "..\handy.h"\ + "..\hv.h"\ + "..\mg.h"\ + "..\nostdio.h"\ + "..\op.h"\ + "..\opcode.h"\ + "..\perl.h"\ + "..\perlio.h"\ + "..\perlsdio.h"\ + "..\perlsfio.h"\ + "..\perly.h"\ + "..\plan9\plan9ish.h"\ + "..\pp.h"\ + "..\proto.h"\ + "..\regexp.h"\ + "..\scope.h"\ + "..\sv.h"\ + "..\unixish.h"\ + "..\util.h"\ + "..\XSUB.h"\ + ".\config.h"\ + ".\EXTERN.h"\ + ".\include\dirent.h"\ + ".\include\netdb.h"\ + ".\include\sys/socket.h"\ + ".\win32.h"\ + ".\win32io.h"\ + ".\win32iop.h"\ + {$(INCLUDE)}"\sys\Stat.h"\ + {$(INCLUDE)}"\sys\Types.h"\ + +NODEP_CPP_FCNTL=\ + "..\os2ish.h"\ + "..\vmsish.h"\ + + +"$(INTDIR)\Fcntl.obj" : $(SOURCE) $(DEP_CPP_FCNTL) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=..\ext\Io\IO.c + +!IF "$(CFG)" == "modules - Win32 Release" + +DEP_CPP_IO_C4=\ + "..\av.h"\ + "..\cop.h"\ + "..\cv.h"\ + "..\dosish.h"\ + "..\embed.h"\ + "..\form.h"\ + "..\gv.h"\ + "..\handy.h"\ + "..\hv.h"\ + "..\mg.h"\ + "..\nostdio.h"\ + "..\op.h"\ + "..\opcode.h"\ + "..\perl.h"\ + "..\perlio.h"\ + "..\perlsdio.h"\ + "..\perlsfio.h"\ + "..\perly.h"\ + "..\plan9\plan9ish.h"\ + "..\pp.h"\ + "..\proto.h"\ + "..\regexp.h"\ + "..\scope.h"\ + "..\sv.h"\ + "..\unixish.h"\ + "..\util.h"\ + "..\XSUB.h"\ + ".\config.h"\ + ".\EXTERN.h"\ + ".\include\dirent.h"\ + ".\include\netdb.h"\ + ".\include\sys/socket.h"\ + ".\win32.h"\ + {$(INCLUDE)}"\sys\Stat.h"\ + {$(INCLUDE)}"\sys\Types.h"\ + +NODEP_CPP_IO_C4=\ + "..\os2ish.h"\ + "..\vmsish.h"\ + + +"$(INTDIR)\IO.obj" : $(SOURCE) $(DEP_CPP_IO_C4) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "modules - Win32 Debug" + +DEP_CPP_IO_C4=\ + "..\av.h"\ + "..\cop.h"\ + "..\cv.h"\ + "..\dosish.h"\ + "..\embed.h"\ + "..\form.h"\ + "..\gv.h"\ + "..\handy.h"\ + "..\hv.h"\ + "..\mg.h"\ + "..\nostdio.h"\ + "..\op.h"\ + "..\opcode.h"\ + "..\perl.h"\ + "..\perlio.h"\ + "..\perlsdio.h"\ + "..\perlsfio.h"\ + "..\perly.h"\ + "..\plan9\plan9ish.h"\ + "..\pp.h"\ + "..\proto.h"\ + "..\regexp.h"\ + "..\scope.h"\ + "..\sv.h"\ + "..\unixish.h"\ + "..\util.h"\ + "..\XSUB.h"\ + ".\config.h"\ + ".\EXTERN.h"\ + ".\include\dirent.h"\ + ".\include\netdb.h"\ + ".\include\sys/socket.h"\ + ".\win32.h"\ + ".\win32io.h"\ + ".\win32iop.h"\ + {$(INCLUDE)}"\sys\Stat.h"\ + {$(INCLUDE)}"\sys\Types.h"\ + +NODEP_CPP_IO_C4=\ + "..\os2ish.h"\ + "..\vmsish.h"\ + + +"$(INTDIR)\IO.obj" : $(SOURCE) $(DEP_CPP_IO_C4) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=..\ext\Opcode\Opcode.c + +!IF "$(CFG)" == "modules - Win32 Release" + +DEP_CPP_OPCOD=\ + "..\av.h"\ + "..\cop.h"\ + "..\cv.h"\ + "..\dosish.h"\ + "..\embed.h"\ + "..\form.h"\ + "..\gv.h"\ + "..\handy.h"\ + "..\hv.h"\ + "..\mg.h"\ + "..\nostdio.h"\ + "..\op.h"\ + "..\opcode.h"\ + "..\perl.h"\ + "..\perlio.h"\ + "..\perlsdio.h"\ + "..\perlsfio.h"\ + "..\perly.h"\ + "..\plan9\plan9ish.h"\ + "..\pp.h"\ + "..\proto.h"\ + "..\regexp.h"\ + "..\scope.h"\ + "..\sv.h"\ + "..\unixish.h"\ + "..\util.h"\ + "..\XSUB.h"\ + ".\config.h"\ + ".\EXTERN.h"\ + ".\include\dirent.h"\ + ".\include\netdb.h"\ + ".\include\sys/socket.h"\ + ".\win32.h"\ + {$(INCLUDE)}"\sys\Stat.h"\ + {$(INCLUDE)}"\sys\Types.h"\ + +NODEP_CPP_OPCOD=\ + "..\os2ish.h"\ + "..\vmsish.h"\ + + +"$(INTDIR)\Opcode.obj" : $(SOURCE) $(DEP_CPP_OPCOD) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "modules - Win32 Debug" + +DEP_CPP_OPCOD=\ + "..\av.h"\ + "..\cop.h"\ + "..\cv.h"\ + "..\dosish.h"\ + "..\embed.h"\ + "..\form.h"\ + "..\gv.h"\ + "..\handy.h"\ + "..\hv.h"\ + "..\mg.h"\ + "..\nostdio.h"\ + "..\op.h"\ + "..\opcode.h"\ + "..\perl.h"\ + "..\perlio.h"\ + "..\perlsdio.h"\ + "..\perlsfio.h"\ + "..\perly.h"\ + "..\plan9\plan9ish.h"\ + "..\pp.h"\ + "..\proto.h"\ + "..\regexp.h"\ + "..\scope.h"\ + "..\sv.h"\ + "..\unixish.h"\ + "..\util.h"\ + "..\XSUB.h"\ + ".\config.h"\ + ".\EXTERN.h"\ + ".\include\dirent.h"\ + ".\include\netdb.h"\ + ".\include\sys/socket.h"\ + ".\win32.h"\ + ".\win32io.h"\ + ".\win32iop.h"\ + {$(INCLUDE)}"\sys\Stat.h"\ + {$(INCLUDE)}"\sys\Types.h"\ + +NODEP_CPP_OPCOD=\ + "..\os2ish.h"\ + "..\vmsish.h"\ + + +"$(INTDIR)\Opcode.obj" : $(SOURCE) $(DEP_CPP_OPCOD) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=..\ext\SDBM_File\SDBM_File.c +DEP_CPP_SDBM_=\ + "..\av.h"\ + "..\cop.h"\ + "..\cv.h"\ + "..\dosish.h"\ + "..\embed.h"\ + "..\form.h"\ + "..\gv.h"\ + "..\handy.h"\ + "..\hv.h"\ + "..\mg.h"\ + "..\nostdio.h"\ + "..\op.h"\ + "..\opcode.h"\ + "..\perl.h"\ + "..\perlio.h"\ + "..\perlsdio.h"\ + "..\perlsfio.h"\ + "..\perly.h"\ + "..\plan9\plan9ish.h"\ + "..\pp.h"\ + "..\proto.h"\ + "..\regexp.h"\ + "..\scope.h"\ + "..\sv.h"\ + "..\unixish.h"\ + "..\util.h"\ + "..\XSUB.h"\ + ".\..\ext\SDBM_File\sdbm\sdbm.h"\ + ".\config.h"\ + ".\EXTERN.h"\ + ".\include\dirent.h"\ + ".\include\netdb.h"\ + ".\include\sys/socket.h"\ + ".\win32.h"\ + {$(INCLUDE)}"\sys\Stat.h"\ + {$(INCLUDE)}"\sys\Types.h"\ + +NODEP_CPP_SDBM_=\ + "..\os2ish.h"\ + "..\vmsish.h"\ + + +"$(INTDIR)\SDBM_File.obj" : $(SOURCE) $(DEP_CPP_SDBM_) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=..\ext\Socket\Socket.c +DEP_CPP_SOCKE=\ + "..\av.h"\ + "..\cop.h"\ + "..\cv.h"\ + "..\dosish.h"\ + "..\embed.h"\ + "..\form.h"\ + "..\gv.h"\ + "..\handy.h"\ + "..\hv.h"\ + "..\mg.h"\ + "..\nostdio.h"\ + "..\op.h"\ + "..\opcode.h"\ + "..\perl.h"\ + "..\perlio.h"\ + "..\perlsdio.h"\ + "..\perlsfio.h"\ + "..\perly.h"\ + "..\plan9\plan9ish.h"\ + "..\pp.h"\ + "..\proto.h"\ + "..\regexp.h"\ + "..\scope.h"\ + "..\sv.h"\ + "..\unixish.h"\ + "..\util.h"\ + "..\XSUB.h"\ + ".\config.h"\ + ".\EXTERN.h"\ + ".\include\arpa/inet.h"\ + ".\include\dirent.h"\ + ".\include\netdb.h"\ + ".\include\sys/socket.h"\ + ".\win32.h"\ + {$(INCLUDE)}"\sys\Stat.h"\ + {$(INCLUDE)}"\sys\Types.h"\ + +NODEP_CPP_SOCKE=\ + "..\os2ish.h"\ + "..\vmsish.h"\ + ".\..\ext\Socket\sockadapt.h"\ + + +"$(INTDIR)\Socket.obj" : $(SOURCE) $(DEP_CPP_SOCKE) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=..\ext\SDBM_File\sdbm\sdbm.c + +!IF "$(CFG)" == "modules - Win32 Release" + +DEP_CPP_SDBM_C=\ + "..\ext\SDBM_File\sdbm\pair.h"\ + ".\..\ext\SDBM_File\sdbm\sdbm.h"\ + ".\..\ext\SDBM_File\sdbm\tune.h"\ + ".\config.h"\ + ".\include\dirent.h"\ + ".\include\netdb.h"\ + ".\include\sys/socket.h"\ + ".\win32.h"\ + {$(INCLUDE)}"\sys\Stat.h"\ + {$(INCLUDE)}"\sys\Types.h"\ + + +"$(INTDIR)\sdbm.obj" : $(SOURCE) $(DEP_CPP_SDBM_C) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "modules - Win32 Debug" + +DEP_CPP_SDBM_C=\ + "..\ext\SDBM_File\sdbm\pair.h"\ + ".\..\ext\SDBM_File\sdbm\sdbm.h"\ + ".\..\ext\SDBM_File\sdbm\tune.h"\ + ".\config.h"\ + ".\include\dirent.h"\ + ".\include\netdb.h"\ + ".\include\sys/socket.h"\ + ".\win32.h"\ + + +"$(INTDIR)\sdbm.obj" : $(SOURCE) $(DEP_CPP_SDBM_C) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=..\ext\SDBM_File\sdbm\pair.c + +!IF "$(CFG)" == "modules - Win32 Release" + +DEP_CPP_PAIR_=\ + "..\ext\SDBM_File\sdbm\pair.h"\ + ".\..\ext\SDBM_File\sdbm\sdbm.h"\ + ".\..\ext\SDBM_File\sdbm\tune.h"\ + ".\config.h"\ + ".\include\dirent.h"\ + ".\include\netdb.h"\ + ".\include\sys/socket.h"\ + ".\win32.h"\ + {$(INCLUDE)}"\sys\Stat.h"\ + {$(INCLUDE)}"\sys\Types.h"\ + + +"$(INTDIR)\pair.obj" : $(SOURCE) $(DEP_CPP_PAIR_) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "modules - Win32 Debug" + +DEP_CPP_PAIR_=\ + "..\ext\SDBM_File\sdbm\pair.h"\ + ".\..\ext\SDBM_File\sdbm\sdbm.h"\ + ".\..\ext\SDBM_File\sdbm\tune.h"\ + ".\config.h"\ + ".\include\dirent.h"\ + ".\include\netdb.h"\ + ".\include\sys/socket.h"\ + ".\win32.h"\ + + +"$(INTDIR)\pair.obj" : $(SOURCE) $(DEP_CPP_PAIR_) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=..\ext\SDBM_File\sdbm\hash.c + +!IF "$(CFG)" == "modules - Win32 Release" + +DEP_CPP_HASH_=\ + ".\..\ext\SDBM_File\sdbm\sdbm.h"\ + ".\config.h"\ + ".\include\dirent.h"\ + ".\include\netdb.h"\ + ".\include\sys/socket.h"\ + ".\win32.h"\ + {$(INCLUDE)}"\sys\Stat.h"\ + {$(INCLUDE)}"\sys\Types.h"\ + + +"$(INTDIR)\hash.obj" : $(SOURCE) $(DEP_CPP_HASH_) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "modules - Win32 Debug" + +DEP_CPP_HASH_=\ + ".\..\ext\SDBM_File\sdbm\sdbm.h"\ + ".\config.h"\ + ".\include\dirent.h"\ + ".\include\netdb.h"\ + ".\include\sys/socket.h"\ + ".\win32.h"\ + + +"$(INTDIR)\hash.obj" : $(SOURCE) $(DEP_CPP_HASH_) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +# End Source File +# End Target +# End Project +################################################################################ diff --git a/win32/perl.mak b/win32/perl.mak new file mode 100644 index 0000000000..13a1e18866 --- /dev/null +++ b/win32/perl.mak @@ -0,0 +1,228 @@ +# Microsoft Developer Studio Generated NMAKE File, Format Version 4.20 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +!IF "$(CFG)" == "" +CFG=perl - Win32 Debug +!MESSAGE No configuration specified. Defaulting to perl - Win32 Debug. +!ENDIF + +!IF "$(CFG)" != "perl - Win32 Release" && "$(CFG)" != "perl - Win32 Debug" +!MESSAGE Invalid configuration "$(CFG)" specified. +!MESSAGE You can specify a configuration when running NMAKE on this makefile +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "perl.mak" CFG="perl - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "perl - Win32 Release" (based on "Win32 (x86) Console Application") +!MESSAGE "perl - Win32 Debug" (based on "Win32 (x86) Console Application") +!MESSAGE +!ERROR An invalid configuration is specified. +!ENDIF + +!IF "$(OS)" == "Windows_NT" +NULL= +!ELSE +NULL=nul +!ENDIF +################################################################################ +# Begin Project +# PROP Target_Last_Scanned "perl - Win32 Debug" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "perl - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "perl" +# PROP BASE Intermediate_Dir "perl" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Target_Dir "" +OUTDIR=.\Release +INTDIR=.\Release + +ALL : "..\_perl.exe" + +CLEAN : + -@erase "$(INTDIR)\perlmain.obj" + -@erase "$(INTDIR)\win32io.obj" + -@erase "..\_perl.exe" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c +# ADD CPP /nologo /MT /W3 /GX /O2 /I "." /I ".\include" /I ".." /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c +CPP_PROJ=/nologo /MT /W3 /GX /O2 /I "." /I ".\include" /I ".." /D "WIN32" /D\ + "NDEBUG" /D "_CONSOLE" /Fp"$(INTDIR)/perl.pch" /YX /Fo"$(INTDIR)/" /c +CPP_OBJS=.\Release/ +CPP_SBRS=.\. +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +BSC32_FLAGS=/nologo /o"$(OUTDIR)/perl.bsc" +BSC32_SBRS= \ + +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:console /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib setargv.obj /nologo /subsystem:console /machine:I386 /out:"../_perl.exe" +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ + advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib setargv.obj /nologo\ + /subsystem:console /incremental:no /pdb:"$(OUTDIR)/_perl.pdb" /machine:I386\ + /out:"../_perl.exe" +LINK32_OBJS= \ + "$(INTDIR)\perlmain.obj" \ + "$(INTDIR)\win32io.obj" \ + "..\perl.lib" + +"..\_perl.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ELSEIF "$(CFG)" == "perl - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "dynaper0" +# PROP BASE Intermediate_Dir "dynaper0" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Target_Dir "" +OUTDIR=.\Debug +INTDIR=.\Debug + +ALL : "..\_perl.exe" + +CLEAN : + -@erase "$(INTDIR)\perlmain.obj" + -@erase "$(INTDIR)\vc40.idb" + -@erase "$(INTDIR)\vc40.pdb" + -@erase "$(INTDIR)\win32io.obj" + -@erase "$(OUTDIR)\_perl.pdb" + -@erase "..\_perl.exe" + -@erase "..\_perl.ilk" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /c +# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "." /I ".\include" /I ".." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /c +CPP_PROJ=/nologo /MTd /W3 /Gm /GX /Zi /Od /I "." /I ".\include" /I ".." /D\ + "WIN32" /D "_DEBUG" /D "_CONSOLE" /Fp"$(INTDIR)/perl.pch" /YX /Fo"$(INTDIR)/"\ + /Fd"$(INTDIR)/" /c +CPP_OBJS=.\Debug/ +CPP_SBRS=.\. +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +BSC32_FLAGS=/nologo /o"$(OUTDIR)/perl.bsc" +BSC32_SBRS= \ + +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:console /debug /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib setargv.obj /nologo /subsystem:console /debug /machine:I386 /out:"../_perl.exe" +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ + advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib setargv.obj /nologo\ + /subsystem:console /incremental:yes /pdb:"$(OUTDIR)/_perl.pdb" /debug\ + /machine:I386 /out:"../_perl.exe" +LINK32_OBJS= \ + "$(INTDIR)\perlmain.obj" \ + "$(INTDIR)\win32io.obj" \ + "..\perl.lib" + +"..\_perl.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ENDIF + +.c{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.cpp{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.cxx{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.c{$(CPP_SBRS)}.sbr: + $(CPP) $(CPP_PROJ) $< + +.cpp{$(CPP_SBRS)}.sbr: + $(CPP) $(CPP_PROJ) $< + +.cxx{$(CPP_SBRS)}.sbr: + $(CPP) $(CPP_PROJ) $< + +################################################################################ +# Begin Target + +# Name "perl - Win32 Release" +# Name "perl - Win32 Debug" + +!IF "$(CFG)" == "perl - Win32 Release" + +!ELSEIF "$(CFG)" == "perl - Win32 Debug" + +!ENDIF + +################################################################################ +# Begin Source File + +SOURCE=.\perlmain.c +DEP_CPP_PERLM=\ + ".\win32io.h"\ + + +"$(INTDIR)\perlmain.obj" : $(SOURCE) $(DEP_CPP_PERLM) "$(INTDIR)" + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=..\perl.lib + +!IF "$(CFG)" == "perl - Win32 Release" + +!ELSEIF "$(CFG)" == "perl - Win32 Debug" + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\win32io.cpp +DEP_CPP_WIN32=\ + ".\include\sys/socket.h"\ + ".\win32io.h"\ + ".\win32iop.h"\ + {$(INCLUDE)}"\Sys\Stat.h"\ + {$(INCLUDE)}"\Sys\Types.h"\ + + +"$(INTDIR)\win32io.obj" : $(SOURCE) $(DEP_CPP_WIN32) "$(INTDIR)" + + +# End Source File +# End Target +# End Project +################################################################################ diff --git a/win32/perldll.mak b/win32/perldll.mak new file mode 100644 index 0000000000..01aea72150 --- /dev/null +++ b/win32/perldll.mak @@ -0,0 +1,436 @@ +# Microsoft Developer Studio Generated NMAKE File, Format Version 4.20 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +!IF "$(CFG)" == "" +CFG=perldll - Win32 Debug +!MESSAGE No configuration specified. Defaulting to perldll - Win32 Debug. +!ENDIF + +!IF "$(CFG)" != "perldll - Win32 Release" && "$(CFG)" !=\ + "perldll - Win32 Debug" +!MESSAGE Invalid configuration "$(CFG)" specified. +!MESSAGE You can specify a configuration when running NMAKE on this makefile +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "perldll.mak" CFG="perldll - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "perldll - Win32 Release" (based on\ + "Win32 (x86) Dynamic-Link Library") +!MESSAGE "perldll - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE +!ERROR An invalid configuration is specified. +!ENDIF + +!IF "$(OS)" == "Windows_NT" +NULL= +!ELSE +NULL=nul +!ENDIF +################################################################################ +# Begin Project +# PROP Target_Last_Scanned "perldll - Win32 Debug" +CPP=cl.exe +RSC=rc.exe +MTL=mktyplib.exe + +!IF "$(CFG)" == "perldll - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "perldll_" +# PROP BASE Intermediate_Dir "perldll_" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "../" +# PROP Intermediate_Dir "release" +# PROP Target_Dir "" +OUTDIR=.\.. +INTDIR=.\release + +ALL : "$(OUTDIR)\perl.dll" + +CLEAN : + -@erase "$(INTDIR)\perllib.obj" + -@erase "$(INTDIR)\win32.obj" + -@erase "$(INTDIR)\win32aux.obj" + -@erase "$(INTDIR)\win32io.obj" + -@erase "$(INTDIR)\win32sck.obj" + -@erase "$(OUTDIR)\perl.dll" + -@erase "$(OUTDIR)\perl.exp" + -@erase "$(OUTDIR)\perl.lib" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +"$(INTDIR)" : + if not exist "$(INTDIR)/$(NULL)" mkdir "$(INTDIR)" + +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c +# ADD CPP /nologo /MT /W3 /GX /O2 /I "." /I ".\include" /I ".." /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "PERLDLL" /YX /c +CPP_PROJ=/nologo /MT /W3 /GX /O2 /I "." /I ".\include" /I ".." /D "NDEBUG" /D\ + "WIN32" /D "_WINDOWS" /D "PERLDLL" /Fp"$(INTDIR)/perldll.pch" /YX\ + /Fo"$(INTDIR)/" /c +CPP_OBJS=.\release/ +CPP_SBRS=.\. +# ADD BASE MTL /nologo /D "NDEBUG" /win32 +# ADD MTL /nologo /D "NDEBUG" /win32 +MTL_PROJ=/nologo /D "NDEBUG" /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +BSC32_FLAGS=/nologo /o"$(OUTDIR)/perldll.bsc" +BSC32_SBRS= \ + +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /dll /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /dll /pdb:none /machine:I386 /out:"../perl.dll" +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ + advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo\ + /subsystem:windows /dll /pdb:none /machine:I386 /def:".\perldll.def"\ + /out:"$(OUTDIR)/perl.dll" /implib:"$(OUTDIR)/perl.lib" +DEF_FILE= \ + ".\perldll.def" +LINK32_OBJS= \ + "$(INTDIR)\perllib.obj" \ + "$(INTDIR)\win32.obj" \ + "$(INTDIR)\win32aux.obj" \ + "$(INTDIR)\win32io.obj" \ + "$(INTDIR)\win32sck.obj" \ + "..\libperl.lib" \ + ".\modules.lib" + +"$(OUTDIR)\perl.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ELSEIF "$(CFG)" == "perldll - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "perldll0" +# PROP BASE Intermediate_Dir "perldll0" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "debug" +# PROP Intermediate_Dir "debug" +# PROP Target_Dir "" +OUTDIR=.\debug +INTDIR=.\debug + +ALL : "..\perl.dll" + +CLEAN : + -@erase "$(INTDIR)\perllib.obj" + -@erase "$(INTDIR)\vc40.idb" + -@erase "$(INTDIR)\vc40.pdb" + -@erase "$(INTDIR)\win32.obj" + -@erase "$(INTDIR)\win32aux.obj" + -@erase "$(INTDIR)\win32io.obj" + -@erase "$(INTDIR)\win32sck.obj" + -@erase "$(OUTDIR)\perl.exp" + -@erase "$(OUTDIR)\perl.lib" + -@erase "$(OUTDIR)\perl.pdb" + -@erase "..\perl.dll" + -@erase "..\perl.ilk" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c +# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "." /I ".\include" /I ".." /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "PERLDLL" /YX /c +CPP_PROJ=/nologo /MTd /W3 /Gm /GX /Zi /Od /I "." /I ".\include" /I ".." /D\ + "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "PERLDLL" /Fp"$(INTDIR)/perldll.pch" /YX\ + /Fo"$(INTDIR)/" /Fd"$(INTDIR)/" /c +CPP_OBJS=.\debug/ +CPP_SBRS=.\. +# ADD BASE MTL /nologo /D "_DEBUG" /win32 +# ADD MTL /nologo /D "_DEBUG" /win32 +MTL_PROJ=/nologo /D "_DEBUG" /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +BSC32_FLAGS=/nologo /o"$(OUTDIR)/perldll.bsc" +BSC32_SBRS= \ + +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /dll /debug /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /dll /debug /machine:I386 /out:"../perl.dll" +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ + advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo\ + /subsystem:windows /dll /incremental:yes /pdb:"$(OUTDIR)/perl.pdb" /debug\ + /machine:I386 /def:".\perldll.def" /out:"../perl.dll"\ + /implib:"$(OUTDIR)/perl.lib" +DEF_FILE= \ + ".\perldll.def" +LINK32_OBJS= \ + "$(INTDIR)\perllib.obj" \ + "$(INTDIR)\win32.obj" \ + "$(INTDIR)\win32aux.obj" \ + "$(INTDIR)\win32io.obj" \ + "$(INTDIR)\win32sck.obj" \ + "..\libperl.lib" \ + ".\modules.lib" + +"..\perl.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ENDIF + +.c{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.cpp{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.cxx{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.c{$(CPP_SBRS)}.sbr: + $(CPP) $(CPP_PROJ) $< + +.cpp{$(CPP_SBRS)}.sbr: + $(CPP) $(CPP_PROJ) $< + +.cxx{$(CPP_SBRS)}.sbr: + $(CPP) $(CPP_PROJ) $< + +################################################################################ +# Begin Target + +# Name "perldll - Win32 Release" +# Name "perldll - Win32 Debug" + +!IF "$(CFG)" == "perldll - Win32 Release" + +!ELSEIF "$(CFG)" == "perldll - Win32 Debug" + +!ENDIF + +################################################################################ +# Begin Source File + +SOURCE=.\perllib.c +DEP_CPP_PERLL=\ + "..\av.h"\ + "..\cop.h"\ + "..\cv.h"\ + "..\dosish.h"\ + "..\embed.h"\ + "..\form.h"\ + "..\gv.h"\ + "..\handy.h"\ + "..\hv.h"\ + "..\mg.h"\ + "..\nostdio.h"\ + "..\op.h"\ + "..\opcode.h"\ + "..\perl.h"\ + "..\perlio.h"\ + "..\perlsdio.h"\ + "..\perlsfio.h"\ + "..\perly.h"\ + "..\plan9\plan9ish.h"\ + "..\pp.h"\ + "..\proto.h"\ + "..\regexp.h"\ + "..\scope.h"\ + "..\sv.h"\ + "..\unixish.h"\ + "..\util.h"\ + ".\config.h"\ + ".\EXTERN.h"\ + ".\include\dirent.h"\ + ".\include\netdb.h"\ + ".\include\sys/socket.h"\ + ".\win32.h"\ + ".\win32io.h"\ + ".\win32iop.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + +NODEP_CPP_PERLL=\ + "..\os2ish.h"\ + "..\vmsish.h"\ + + +"$(INTDIR)\perllib.obj" : $(SOURCE) $(DEP_CPP_PERLL) "$(INTDIR)" + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\perldll.def + +!IF "$(CFG)" == "perldll - Win32 Release" + +!ELSEIF "$(CFG)" == "perldll - Win32 Debug" + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=..\libperl.lib + +!IF "$(CFG)" == "perldll - Win32 Release" + +!ELSEIF "$(CFG)" == "perldll - Win32 Debug" + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\win32sck.c +DEP_CPP_WIN32=\ + "..\av.h"\ + "..\cop.h"\ + "..\cv.h"\ + "..\dosish.h"\ + "..\embed.h"\ + "..\form.h"\ + "..\gv.h"\ + "..\handy.h"\ + "..\hv.h"\ + "..\mg.h"\ + "..\nostdio.h"\ + "..\op.h"\ + "..\opcode.h"\ + "..\perl.h"\ + "..\perlio.h"\ + "..\perlsdio.h"\ + "..\perlsfio.h"\ + "..\perly.h"\ + "..\plan9\plan9ish.h"\ + "..\pp.h"\ + "..\proto.h"\ + "..\regexp.h"\ + "..\scope.h"\ + "..\sv.h"\ + "..\unixish.h"\ + "..\util.h"\ + ".\config.h"\ + ".\EXTERN.h"\ + ".\include\dirent.h"\ + ".\include\netdb.h"\ + ".\include\sys/socket.h"\ + ".\win32.h"\ + ".\win32io.h"\ + ".\win32iop.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + +NODEP_CPP_WIN32=\ + "..\os2ish.h"\ + "..\vmsish.h"\ + + +"$(INTDIR)\win32sck.obj" : $(SOURCE) $(DEP_CPP_WIN32) "$(INTDIR)" + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\win32.c + +!IF "$(CFG)" == "perldll - Win32 Release" + +DEP_CPP_WIN32_=\ + "..\embed.h"\ + "..\nostdio.h"\ + "..\perl.h"\ + "..\perlio.h"\ + "..\perlsdio.h"\ + "..\perlsfio.h"\ + ".\config.h"\ + ".\EXTERN.h"\ + ".\include\dirent.h"\ + ".\include\netdb.h"\ + ".\include\sys/socket.h"\ + ".\win32.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\win32.obj" : $(SOURCE) $(DEP_CPP_WIN32_) "$(INTDIR)" + + +!ELSEIF "$(CFG)" == "perldll - Win32 Debug" + +DEP_CPP_WIN32_=\ + "..\perl.h"\ + ".\EXTERN.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\win32.obj" : $(SOURCE) $(DEP_CPP_WIN32_) "$(INTDIR)" + + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\win32aux.cpp +DEP_CPP_WIN32A=\ + ".\include\sys/socket.h"\ + ".\win32io.h"\ + ".\win32iop.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\win32aux.obj" : $(SOURCE) $(DEP_CPP_WIN32A) "$(INTDIR)" + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\modules.lib + +!IF "$(CFG)" == "perldll - Win32 Release" + +!ELSEIF "$(CFG)" == "perldll - Win32 Debug" + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\win32io.cpp +DEP_CPP_WIN32I=\ + ".\include\sys/socket.h"\ + ".\win32io.h"\ + ".\win32iop.h"\ + {$(INCLUDE)}"\sys\stat.h"\ + {$(INCLUDE)}"\sys\types.h"\ + + +"$(INTDIR)\win32io.obj" : $(SOURCE) $(DEP_CPP_WIN32I) "$(INTDIR)" + + +# End Source File +# End Target +# End Project +################################################################################ diff --git a/win32/perlglob.c b/win32/perlglob.c new file mode 100644 index 0000000000..6413b37ddd --- /dev/null +++ b/win32/perlglob.c @@ -0,0 +1,43 @@ +/* + * Globbing for NT. Relies on the expansion done by the library + * startup code. + */ + +#include <stdio.h> +#include <io.h> +#include <fcntl.h> +#include <string.h> +#include <windows.h> + +int +main(int argc, char *argv[]) +{ + int i; + int len; + char root[MAX_PATH]; + char *dummy; + char volname[MAX_PATH]; + DWORD serial, maxname, flags; + BOOL downcase = TRUE; + + /* check out the file system characteristics */ + + if (GetFullPathName(".", MAX_PATH, root, &dummy)) { + if (dummy = strchr(root, '\\')) + *++dummy = '\0'; + if (GetVolumeInformation(root, volname, MAX_PATH, + &serial, &maxname, &flags, 0, 0)) { + downcase = !(flags & FS_CASE_IS_PRESERVED); + } + } + + _setmode(_fileno(stdout), _O_BINARY); + for (i = 1; i < argc; i++) { + len = strlen(argv[i]); + if (downcase) + strlwr(argv[i]); + if (i > 1) fwrite("\0", sizeof(char), 1, stdout); + fwrite(argv[i], sizeof(char), len, stdout); + } + return 0; +} diff --git a/win32/perlglob.mak b/win32/perlglob.mak new file mode 100644 index 0000000000..0a4c0bffcf --- /dev/null +++ b/win32/perlglob.mak @@ -0,0 +1,201 @@ +# Microsoft Developer Studio Generated NMAKE File, Format Version 4.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +!IF "$(CFG)" == "" +CFG=perlglob - Win32 Debug +!MESSAGE No configuration specified. Defaulting to perlglob - Win32 Debug. +!ENDIF + +!IF "$(CFG)" != "perlglob - Win32 Release" && "$(CFG)" !=\ + "perlglob - Win32 Debug" +!MESSAGE Invalid configuration "$(CFG)" specified. +!MESSAGE You can specify a configuration when running NMAKE on this makefile +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "perlglob.mak" CFG="perlglob - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "perlglob - Win32 Release" (based on\ + "Win32 (x86) Console Application") +!MESSAGE "perlglob - Win32 Debug" (based on "Win32 (x86) Console Application") +!MESSAGE +!ERROR An invalid configuration is specified. +!ENDIF + +!IF "$(OS)" == "Windows_NT" +NULL= +!ELSE +NULL=nul +!ENDIF +################################################################################ +# Begin Project +# PROP Target_Last_Scanned "perlglob - Win32 Debug" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "perlglob - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "perlglob" +# PROP BASE Intermediate_Dir "perlglob" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "release" +# PROP Intermediate_Dir "release" +# PROP Target_Dir "" +OUTDIR=.\release +INTDIR=.\release + +ALL : "$(OUTDIR)\perlglob.exe" + +CLEAN : + -@erase "..\perlglob.exe" + -@erase ".\release\perlglob.obj" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c +# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c +CPP_PROJ=/nologo /ML /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE"\ + /Fp"$(INTDIR)/perlglob.pch" /YX /Fo"$(INTDIR)/" /c +CPP_OBJS=.\release/ +CPP_SBRS= +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +BSC32_FLAGS=/nologo /o"$(OUTDIR)/perlglob.bsc" +BSC32_SBRS= +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:console /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib setargv.obj /nologo /subsystem:console /machine:I386 /out:"../perlglob.exe" +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ + advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib setargv.obj /nologo\ + /subsystem:console /incremental:no /pdb:"$(OUTDIR)/perlglob.pdb" /machine:I386\ + /out:"../perlglob.exe" +LINK32_OBJS= \ + "$(INTDIR)/perlglob.obj" + +"$(OUTDIR)\perlglob.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ELSEIF "$(CFG)" == "perlglob - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "perlglo0" +# PROP BASE Intermediate_Dir "perlglo0" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "debug" +# PROP Intermediate_Dir "debug" +# PROP Target_Dir "" +OUTDIR=.\debug +INTDIR=.\debug + +ALL : "$(OUTDIR)\perlglob.exe" + +CLEAN : + -@erase "..\perlglob.exe" + -@erase ".\debug\perlglob.obj" + -@erase "..\perlglob.ilk" + -@erase ".\debug\perlglob.pdb" + -@erase ".\debug\vc40.pdb" + -@erase ".\debug\vc40.idb" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /c +# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /c +CPP_PROJ=/nologo /MLd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE"\ + /Fp"$(INTDIR)/perlglob.pch" /YX /Fo"$(INTDIR)/" /Fd"$(INTDIR)/" /c +CPP_OBJS=.\debug/ +CPP_SBRS= +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +BSC32_FLAGS=/nologo /o"$(OUTDIR)/perlglob.bsc" +BSC32_SBRS= +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:console /debug /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib setargv.obj /nologo /subsystem:console /debug /machine:I386 /out:"..\perlglob.exe" +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ + advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib setargv.obj /nologo\ + /subsystem:console /incremental:yes /pdb:"$(OUTDIR)/perlglob.pdb" /debug\ + /machine:I386 /out:"..\perlglob.exe" +LINK32_OBJS= \ + "$(INTDIR)/perlglob.obj" + +"$(OUTDIR)\perlglob.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ENDIF + +.c{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.cpp{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.cxx{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.c{$(CPP_SBRS)}.sbr: + $(CPP) $(CPP_PROJ) $< + +.cpp{$(CPP_SBRS)}.sbr: + $(CPP) $(CPP_PROJ) $< + +.cxx{$(CPP_SBRS)}.sbr: + $(CPP) $(CPP_PROJ) $< + +################################################################################ +# Begin Target + +# Name "perlglob - Win32 Release" +# Name "perlglob - Win32 Debug" + +!IF "$(CFG)" == "perlglob - Win32 Release" + +!ELSEIF "$(CFG)" == "perlglob - Win32 Debug" + +!ENDIF + +################################################################################ +# Begin Source File + +SOURCE=.\perlglob.c + +!IF "$(CFG)" == "perlglob - Win32 Release" + + +"$(INTDIR)\perlglob.obj" : $(SOURCE) "$(INTDIR)" + + +!ELSEIF "$(CFG)" == "perlglob - Win32 Debug" + + +"$(INTDIR)\perlglob.obj" : $(SOURCE) "$(INTDIR)" + + +!ENDIF + +# End Source File +# End Target +# End Project +################################################################################ diff --git a/win32/perllib.c b/win32/perllib.c new file mode 100644 index 0000000000..f35d41c8bf --- /dev/null +++ b/win32/perllib.c @@ -0,0 +1,120 @@ +#ifdef ABC +#define WIN32_LEAN_AND_MEAN +#include <windows.h> +#include <stdio.h> +#include <stdlib.h> +#include <fcntl.h> +#include <io.h> +#endif + +/* + * "The Road goes ever on and on, down from the door where it began." + */ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "EXTERN.h" +#include "perl.h" + +#ifdef __cplusplus +} +# define EXTERN_C extern "C" +#else +# define EXTERN_C extern +#endif + +static void xs_init _((void)); + +__declspec(dllexport) int RunPerl(int argc, char **argv, char **env, void *iosubsystem) +{ + int exitstatus; + PerlInterpreter *my_perl; + void *pOldIOSubsystem; + + pOldIOSubsystem = SetIOSubSystem(iosubsystem); + + PERL_SYS_INIT(&argc,&argv); + + perl_init_i18nl10n(1); + + if (!(my_perl = perl_alloc())) return (1); + perl_construct( my_perl ); + perl_destruct_level = 0; + + + exitstatus = perl_parse( my_perl, xs_init, argc, argv, env); + if (!exitstatus) { + exitstatus = perl_run( my_perl ); + } + + + perl_destruct( my_perl ); + perl_free( my_perl ); + + PERL_SYS_TERM(); + + SetIOSubSystem(pOldIOSubsystem); + + return (exitstatus); +} + +/* Register any extra external extensions */ + +char *staticlinkmodules[]={ + "DynaLoader", + NULL, + }; + +EXTERN_C void boot_DynaLoader _((CV* cv)); + +static void +xs_init() +{ + dXSUB_SYS; + char *file = __FILE__; + newXS("DynaLoader::boot_DynaLoader", boot_DynaLoader, file); +} + +extern HANDLE PerlDllHandle; + +BOOL APIENTRY DllMain(HANDLE hModule, // DLL module handle + DWORD fdwReason, // reason called + LPVOID lpvReserved) // reserved +{ + switch (fdwReason) + { + // The DLL is attaching to a process due to process + // initialization or a call to LoadLibrary. + case DLL_PROCESS_ATTACH: +//#define DEFAULT_BINMODE +#ifdef DEFAULT_BINMODE + _setmode( _fileno( stdin ), _O_BINARY ); + _setmode( _fileno( stdout ), _O_BINARY ); + _setmode( _fileno( stderr ), _O_BINARY ); + _fmode = _O_BINARY; +#endif + + PerlDllHandle = hModule; + break; + + // The DLL is detaching from a process due to + // process termination or call to FreeLibrary. + case DLL_PROCESS_DETACH: + break; + + // The attached process creates a new thread. + case DLL_THREAD_ATTACH: + break; + + // The thread of the attached process terminates. + case DLL_THREAD_DETACH: + break; + + default: + break; + } + return TRUE; +} + diff --git a/win32/perlmain.c b/win32/perlmain.c new file mode 100644 index 0000000000..507b3831f5 --- /dev/null +++ b/win32/perlmain.c @@ -0,0 +1,10 @@ +#include <stdio.h> +#include <win32io.h> + +extern WIN32_IOSUBSYSTEM win32stdio; +extern int RunPerl(int argc, char **argv, char **env, void *iosubsystem); + +main(int argc, char **argv, char **env) +{ + return (RunPerl(argc, argv, env, &win32stdio)); +} diff --git a/win32/runperl.c b/win32/runperl.c new file mode 100644 index 0000000000..507b3831f5 --- /dev/null +++ b/win32/runperl.c @@ -0,0 +1,10 @@ +#include <stdio.h> +#include <win32io.h> + +extern WIN32_IOSUBSYSTEM win32stdio; +extern int RunPerl(int argc, char **argv, char **env, void *iosubsystem); + +main(int argc, char **argv, char **env) +{ + return (RunPerl(argc, argv, env, &win32stdio)); +} diff --git a/win32/splittree.pl b/win32/splittree.pl new file mode 100644 index 0000000000..9f7f929477 --- /dev/null +++ b/win32/splittree.pl @@ -0,0 +1,24 @@ +use DirHandle; +use AutoSplit; + +sub splitthis { +my ($top,$base,$dest) = @_; +my $d = new DirHandle $base; +if (defined $d) { + while (defined($_ = $d->read)) { + next if $_ eq "."; + next if $_ eq ".."; + my $entry = "$base/$_"; + my $entrywithouttop = $entry; + $entrywithouttop =~ s/^$top//; + if (-d $entry) {splitthis ($top,$entry,$dest);} + else { + next unless ($entry=~/pm$/i); + #print "Will run autosplit on $entry to $dest\n"; + autosplit($entry,$dest,0,1,1); + }; + }; + }; +} + +splitthis $ARGV[0],$ARGV[0],$ARGV[1]; diff --git a/win32/win32.c b/win32/win32.c new file mode 100644 index 0000000000..e9e5af2a5f --- /dev/null +++ b/win32/win32.c @@ -0,0 +1,984 @@ +// WIN32.C + +// (c) 1995 Microsoft Corporation. All rights reserved. +// Developed by hip communications inc., http://info.hip.com/info/ +// Portions (c) 1993 Intergraph Corporation. All rights reserved. + +// You may distribute under the terms of either the GNU General Public +// License or the Artistic License, as specified in the README file. + +#define WIN32_LEAN_AND_MEAN +#define WIN32IO_IS_STDIO +#include <tchar.h> +#include <windows.h> + +//#include "config.h" + +#define PERLIO_NOT_STDIO 0 +#if !defined(PERLIO_IS_STDIO) && !defined(USE_SFIO) +#define PerlIO FILE +#endif + +#include "EXTERN.h" +#include "perl.h" +#include <fcntl.h> +#include <sys/stat.h> +#include <assert.h> +#include <string.h> +#include <stdarg.h> + +#define CROAK croak +#define WARN warn + +extern WIN32_IOSUBSYSTEM win32stdio; +__declspec(thread) PWIN32_IOSUBSYSTEM pIOSubSystem = &win32stdio; +//__declspec(thread) PWIN32_IOSUBSYSTEM pIOSubSystem = NULL; + +BOOL ProbeEnv = FALSE; +DWORD Win32System; +char szShellPath[MAX_PATH+1]; +char szPerlLibRoot[MAX_PATH+1]; +HANDLE PerlDllHandle = INVALID_HANDLE_VALUE; + +#define IsWin95() (Win32System == VER_PLATFORM_WIN32_WINDOWS) +#define IsWinNT() (Win32System == VER_PLATFORM_WIN32_NT) + +void *SetIOSubSystem(void *p) +{ + if (p) { + PWIN32_IOSUBSYSTEM pio = (PWIN32_IOSUBSYSTEM)p; + + if (pio->signature_begin == 12345678L && pio->signature_end == 87654321L) { + PWIN32_IOSUBSYSTEM pold = pIOSubSystem; + pIOSubSystem = pio; + return pold; + } + } + else { + // re-assign our stuff +// pIOSubSystem = &win32stdio; + pIOSubSystem = NULL; + } + + return pIOSubSystem; +} + +char *win32PerlLibPath(void) +{ + + GetModuleFileName((PerlDllHandle == INVALID_HANDLE_VALUE) + ? GetModuleHandle(NULL) : PerlDllHandle, + szPerlLibRoot, + sizeof(szPerlLibRoot)); + + *(strrchr(szPerlLibRoot, '\\')) = '\0'; + strcat(szPerlLibRoot,"\\LIB"); + return (szPerlLibRoot); +} + +BOOL HasRedirection(char *ptr) +{ + int inquote = 0; + char quote = '\0'; + + // + // Scan string looking for redirection (< or >) or pipe + // characters (|) that are not in a quoted string + // + while(*ptr) + { + switch(*ptr) + { + case '\'': + case '\"': + if(inquote) + { + if(quote == *ptr) + { + inquote = 0; + quote = '\0'; + } + } + else + { + quote = *ptr; + inquote++; + } + break; + + case '>': + case '<': + case '|': + if(!inquote) + return TRUE; + + default: + break; + } + ++ptr; + } + return FALSE; +} + +// since the current process environment is being updated in util.c +// the library functions will get the correct environment +PerlIO *my_popen(char *cmd, char *mode) +{ +#ifdef FIXCMD +#define fixcmd(x) {\ + char *pspace = strchr((x),' ');\ + if (pspace) {\ + char *p = (x);\ + while (p < pspace) {\ + if (*p == '/') *p = '\\';\ + p++;\ + }\ + }\ + } +#else +#define fixcmd(x) +#endif +#ifndef PERLDLL + fixcmd(cmd); + return win32_popen(cmd, mode); +#else +/* + * There seems to be some problems for the _popen call in a DLL + * this trick at the moment seems to work but it is never test + * on NT yet + * + */ +# ifdef __cplusplus +#define EXT_C_FUNC extern "C" +# else +#define EXT_C_FUNC extern +# endif + +EXT_C_FUNC int __cdecl _set_osfhnd(int fh, long value); +EXT_C_FUNC void __cdecl _lock_fhandle(int); +EXT_C_FUNC void __cdecl _unlock_fhandle(int); + + BOOL fSuccess; + PerlIO *pf; // to store the _popen return value + int tm = 0; /* flag indicating tDllExport or binary mode */ + int fhNeeded, fhInherited, fhDup; + int ineeded, iinherited; + DWORD dwDup; + int phdls[2]; /* I/O handles for pipe */ + HANDLE hPIn, + hPOut, + hPErr, + hSaveStdin, + hSaveStdout, + hSaveStderr, + hPNeeded, hPInherited, hPDuped; + + /* first check for errors in the arguments + */ + + if ( (cmd == NULL) || (mode == NULL) || ((*mode != 'w') && + (*mode != _T('r'))) ) + goto error1; + + if ( *(mode + 1) == _T('t') ) + tm = _O_TEXT; + else if ( *(mode + 1) == _T('b') ) + tm = _O_BINARY; + else tm = (*mode == 'w' ? _O_BINARY : _O_TEXT); + + + fixcmd(cmd); + if (&win32stdio != pIOSubSystem) return win32_popen(cmd, mode); + +#ifdef EFG + if ( _pipe( phdls, 1024, tm ) == -1 ) +#else + if ( win32_pipe( phdls, 1024, tm ) == -1 ) +#endif + goto error1; + + + /* save the current situation */ + + hSaveStdin = GetStdHandle(STD_INPUT_HANDLE); + hSaveStdout = GetStdHandle(STD_OUTPUT_HANDLE); + hSaveStderr = GetStdHandle(STD_ERROR_HANDLE); + + if (*mode == _T('w')) { + ineeded = 1; + dwDup = STD_INPUT_HANDLE; + iinherited = 0; + } + else { + ineeded = 0; + dwDup = STD_OUTPUT_HANDLE; + iinherited = 1; + } + + + fhNeeded = phdls[ineeded]; + fhInherited = phdls[iinherited]; + + fSuccess = DuplicateHandle(GetCurrentProcess(), + (HANDLE) stolen_get_osfhandle(fhNeeded), + GetCurrentProcess(), + &hPNeeded, + 0, + FALSE, /* not inherited */ + DUPLICATE_SAME_ACCESS); + + if (!fSuccess) goto error2; + + fhDup = stolen_open_osfhandle((long) hPNeeded, tm); + win32_dup2(fhDup, fhNeeded); + win32_close(fhDup); + +#ifdef AAA + /* Close the Out pipe, child won't need it */ + hPDuped = (HANDLE) stolen_get_osfhandle(fhNeeded); + + _lock_fhandle(fhNeeded); + _set_osfhnd(fhNeeded, (long) hPNeeded); // put in ours duplicated one + _unlock_fhandle(fhNeeded); + + CloseHandle(hPDuped); // close the handle first +#endif + + if (!SetStdHandle(dwDup, (HANDLE) stolen_get_osfhandle(fhInherited))) goto error2; + + // + // make sure the child see the same stderr as the calling program + // + // + if (!SetStdHandle(STD_ERROR_HANDLE, (HANDLE) stolen_get_osfhandle(win32_fileno(win32_stderr())))) goto error2; + + pf = win32_popen(cmd, mode); // ask _popen to do the job + + /* restore to where we were */ + SetStdHandle(STD_INPUT_HANDLE, hSaveStdin); + SetStdHandle(STD_OUTPUT_HANDLE, hSaveStdout); + SetStdHandle(STD_ERROR_HANDLE, hSaveStderr); + + /* we don't need it any more, that's for the child */ + win32_close(fhInherited); + + if (NULL == pf) { + // something wrong + win32_close(fhNeeded); + goto error1; + } + else { + + /* + * here we steal the file handle in pf and stuff ours in + * + */ + win32_dup2(fhNeeded, win32_fileno(pf)); + win32_close(fhNeeded); + } + + return (pf); + +error2: + win32_close(fhNeeded); + win32_close(fhInherited); + +error1: + return (NULL); + +#endif +} + +long my_pclose(PerlIO *fp) +{ + return win32_pclose(fp); +} + +static void IdOS(void) +{ + OSVERSIONINFO osver; + + memset(&osver, 0, sizeof(OSVERSIONINFO)); + osver.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); + GetVersionEx(&osver); + Win32System = osver.dwPlatformId; + return; +} + +static char *GetShell(void) +{ + static char* szWin95ShellEntry = "Win95Shell"; + static char* szWin95DefaultShell = "Cmd32.exe"; + static char* szWinNTDefaultShell = "cmd.exe"; + + if (!ProbeEnv) { + IdOS(), ProbeEnv = TRUE; + if (IsWin95()) { + strcpy(szShellPath, szWin95DefaultShell); + } + else { + strcpy(szShellPath, szWinNTDefaultShell); + } + } + + return szShellPath; +} + +int do_aspawn(void* really, void** mark, void** arglast) +{ + char **argv; + char *strPtr; + char *cmd; + int status; + unsigned int length; + int index = 0; + SV *sv = (SV*)really; + SV** pSv = (SV**)mark; + + New(1110, argv, (arglast - mark) + 3, char*); + + if(sv != Nullsv) + { + cmd = SvPV(sv, length); + } + else + { + cmd = GetShell(); + argv[index++] = "/c"; + } + + while(pSv <= (SV**)arglast) + { + sv = *pSv++; + strPtr = SvPV(sv, length); + if(strPtr != NULL && *strPtr != '\0') + argv[index++] = strPtr; + } + argv[index++] = 0; + + status = win32_spawnvpe(P_WAIT, cmd, (const char* const*)argv, (const char* const*)environ); + + Safefree(argv); + + // set statusvalue the perl variable $? + return (statusvalue = status*256); +} + +int do_spawn(char *cmd) +{ + char **a; + char *s; + char **argv; + int status = -1; + BOOL needToTry = TRUE; + char *shell, *cmd2; + + /* save an extra exec if possible */ + shell = GetShell(); + + /* see if there are shell metacharacters in it */ + if(!HasRedirection(cmd)) + { + New(1102,argv, strlen(cmd) / 2 + 2, char*); + + New(1103,cmd2, strlen(cmd) + 1, char); + strcpy(cmd2, cmd); + a = argv; + for(s = cmd2; *s;) + { + while(*s && isspace(*s)) s++; + if(*s) + *(a++) = s; + while(*s && !isspace(*s)) s++; + if(*s) + *s++ = '\0'; + } + *a = Nullch; + if(argv[0]) + { + status = win32_spawnvpe(P_WAIT, argv[0], (const char* const*)argv, (const char* const*)environ); + if(status != -1 || errno == 0) + needToTry = FALSE; + } + Safefree(argv); + Safefree(cmd2); + } + if(needToTry) + { + status = win32_spawnle(P_WAIT, shell, shell, "/c", cmd, (char*)0, environ); + } + + // set statusvalue the perl variable $? + return (statusvalue = status*256); +} + + +#define PATHLEN 1024 + +// The idea here is to read all the directory names into a string table +// (separated by nulls) and when one of the other dir functions is called +// return the pointer to the current file name. +DIR *opendir(char *filename) +{ + DIR *p; + long len; + long idx; + char scannamespc[PATHLEN]; + char *scanname = scannamespc; + struct stat sbuf; + WIN32_FIND_DATA FindData; + HANDLE fh; +// char root[_MAX_PATH]; +// char volname[_MAX_PATH]; +// DWORD serial, maxname, flags; +// BOOL downcase; +// char *dummy; + + // check to see if filename is a directory + if(stat(filename, &sbuf) < 0 || sbuf.st_mode & _S_IFDIR == 0) + { + return NULL; + } + + // get the file system characteristics +// if(GetFullPathName(filename, MAX_PATH, root, &dummy)) +// { +// if(dummy = strchr(root, '\\')) +// *++dummy = '\0'; +// if(GetVolumeInformation(root, volname, MAX_PATH, &serial, &maxname, &flags, 0, 0)) +// { +// downcase = !(flags & FS_CASE_IS_PRESERVED); +// } +// } +// else +// { +// downcase = TRUE; +// } + + // Get us a DIR structure + Newz(1501, p, 1, DIR); + if(p == NULL) + return NULL; + + // Create the search pattern + strcpy(scanname, filename); + + if(index("/\\", *(scanname + strlen(scanname) - 1)) == NULL) + strcat(scanname, "/*"); + else + strcat(scanname, "*"); + + // do the FindFirstFile call + fh = FindFirstFile(scanname, &FindData); + if(fh == INVALID_HANDLE_VALUE) + { + return NULL; + } + + // now allocate the first part of the string table for the filenames that we find. + idx = strlen(FindData.cFileName)+1; + New(1502, p->start, idx, char); + if(p->start == NULL) + { + CROAK("opendir: malloc failed!\n"); + } + strcpy(p->start, FindData.cFileName); +// if(downcase) +// strlwr(p->start); + p->nfiles++; + + // loop finding all the files that match the wildcard + // (which should be all of them in this directory!). + // the variable idx should point one past the null terminator + // of the previous string found. + // + while(FindNextFile(fh, &FindData)) + { + len = strlen(FindData.cFileName); + // bump the string table size by enough for the + // new name and it's null terminator + Renew(p->start, idx+len+1, char); + if(p->start == NULL) + { + CROAK("opendir: malloc failed!\n"); + } + strcpy(&p->start[idx], FindData.cFileName); +// if(downcase) +// strlwr(&p->start[idx]); + p->nfiles++; + idx += len+1; + } + FindClose(fh); + p->size = idx; + p->curr = p->start; + return p; +} + + +// Readdir just returns the current string pointer and bumps the +// string pointer to the nDllExport entry. +struct direct *readdir(DIR *dirp) +{ + int len; + static int dummy = 0; + + if(dirp->curr) + { // first set up the structure to return + len = strlen(dirp->curr); + strcpy(dirp->dirstr.d_name, dirp->curr); + dirp->dirstr.d_namlen = len; + + // Fake an inode + dirp->dirstr.d_ino = dummy++; + + // Now set up for the nDllExport call to readdir + dirp->curr += len + 1; + if(dirp->curr >= (dirp->start + dirp->size)) + { + dirp->curr = NULL; + } + + return &(dirp->dirstr); + } + else + return NULL; +} + +// Telldir returns the current string pointer position +long telldir(DIR *dirp) +{ + return (long) dirp->curr; +} + + +// Seekdir moves the string pointer to a previously saved position (Saved by telldir). +void seekdir(DIR *dirp, long loc) +{ + dirp->curr = (char *)loc; +} + +// Rewinddir resets the string pointer to the start +void rewinddir(DIR *dirp) +{ + dirp->curr = dirp->start; +} + +// free the memory allocated by opendir +int closedir(DIR *dirp) +{ + Safefree(dirp->start); + Safefree(dirp); + return 1; +} + + +// +// various stubs +// + + +// Ownership +// +// Just pretend that everyone is a superuser. NT will let us know if +// we don\'t really have permission to do something. +// + +#define ROOT_UID ((uid_t)0) +#define ROOT_GID ((gid_t)0) + +uid_t getuid(void) +{ + return ROOT_UID; +} + +uid_t geteuid(void) +{ + return ROOT_UID; +} + +gid_t getgid(void) +{ + return ROOT_GID; +} + +gid_t getegid(void) +{ + return ROOT_GID; +} + +int setuid(uid_t uid) +{ + return (uid == ROOT_UID ? 0 : -1); +} + +int setgid(gid_t gid) +{ + return (gid == ROOT_GID ? 0 : -1); +} + +// +// pretended kill +// +int kill(int pid, int sig) +{ + HANDLE hProcess= OpenProcess(PROCESS_ALL_ACCESS, TRUE, pid); + + if (hProcess == NULL) { + CROAK("kill process failed!\n"); + } + else { + if (!TerminateProcess(hProcess, sig)) CROAK("kill process failed!\n"); + CloseHandle(hProcess); + } + return 0; +} + +// +// File system stuff +// + +int ioctl(int i, unsigned int u, char *data) +{ + CROAK("ioctl not implemented!\n"); + return -1; +} + +unsigned int sleep(unsigned int t) +{ + Sleep(t*1000); + return 0; +} + + +#undef rename + +int myrename(char *OldFileName, char *newname) +{ + if(_access(newname, 0) != -1) + { // file exists + _unlink(newname); + } + return rename(OldFileName, newname); +} + + +int win32_stat(const char *path, struct stat *buffer) +{ + char t[MAX_PATH]; + const char *p = path; + int l = strlen(path); + + if (l > 1) { + switch(path[l - 1]) { + case '\\': + case '/': + if (path[l - 2] != ':') { + strncpy(t, path, l - 1); + t[l - 1] = 0; + p = t; + }; + } + } + + return stat(p, buffer); +} + +#undef times +int mytimes(struct tms *timebuf) +{ + clock_t t = clock(); + timebuf->tms_utime = t; + timebuf->tms_stime = 0; + timebuf->tms_cutime = 0; + timebuf->tms_cstime = 0; + + return 0; +} + +#undef alarm +unsigned int myalarm(unsigned int sec) +{ + // we warn the usuage of alarm function + if (sec != 0) + WARN("dummy function alarm called, program might not function as expected\n"); + return 0; +} + +// +// redirected io subsystem for all XS modules +// +// + +DllExport int * win32_errno(void) +{ + return (pIOSubSystem->pfnerrno()); +} + +// the rest are the remapped stdio routines +DllExport FILE *win32_stderr(void) +{ + return (pIOSubSystem->pfnstderr()); +} + +DllExport FILE *win32_stdin(void) +{ + return (pIOSubSystem->pfnstdin()); +} + +DllExport FILE *win32_stdout() +{ + return (pIOSubSystem->pfnstdout()); +} + +DllExport int win32_ferror(FILE *fp) +{ + return (pIOSubSystem->pfnferror(fp)); +} + + +DllExport int win32_feof(FILE *fp) +{ + return (pIOSubSystem->pfnfeof(fp)); +} + +// +// Since the errors returned by the socket error function +// WSAGetLastError() are not known by the library routine strerror +// we have to roll our own. +// + +__declspec(thread) char strerror_buffer[512]; + +DllExport char *win32_strerror(int e) +{ + extern int sys_nerr; + DWORD source = 0; + + if(e < 0 || e > sys_nerr) + { + if(e < 0) + e = GetLastError(); + + if(FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, &source, e, 0, strerror_buffer, sizeof(strerror_buffer), NULL) == 0) + strcpy(strerror_buffer, "Unknown Error"); + + return strerror_buffer; + } + + return pIOSubSystem->pfnstrerror(e); +} + +DllExport int win32_fprintf(FILE *fp, const char *format, ...) +{ + va_list marker; + va_start(marker, format); /* Initialize variable arguments. */ + + return (pIOSubSystem->pfnvfprintf(fp, format, marker)); +} + +DllExport int win32_printf(const char *format, ...) +{ + va_list marker; + va_start(marker, format); /* Initialize variable arguments. */ + + return (pIOSubSystem->pfnvprintf(format, marker)); +} + +DllExport int win32_vfprintf(FILE *fp, const char *format, va_list args) +{ + return (pIOSubSystem->pfnvfprintf(fp, format, args)); +} + +DllExport size_t win32_fread(void *buf, size_t size, size_t count, FILE *fp) +{ + return pIOSubSystem->pfnfread(buf, size, count, fp); +} + +DllExport size_t win32_fwrite(const void *buf, size_t size, size_t count, FILE *fp) +{ + return pIOSubSystem->pfnfwrite(buf, size, count, fp); +} + +DllExport FILE *win32_fopen(const char *filename, const char *mode) +{ + if (stricmp(filename, "/dev/null")==0) return pIOSubSystem->pfnfopen("NUL", mode); + return pIOSubSystem->pfnfopen(filename, mode); +} + +DllExport FILE *win32_fdopen( int handle, const char *mode) +{ + return pIOSubSystem->pfnfdopen(handle, mode); +} + +DllExport FILE *win32_freopen( const char *path, const char *mode, FILE *stream) +{ + if (stricmp(path, "/dev/null")==0) return pIOSubSystem->pfnfreopen("NUL", mode, stream); + return pIOSubSystem->pfnfreopen(path, mode, stream); +} + +DllExport int win32_fclose(FILE *pf) +{ + return pIOSubSystem->pfnfclose(pf); +} + +DllExport int win32_fputs(const char *s,FILE *pf) +{ + return pIOSubSystem->pfnfputs(s, pf); +} + +DllExport int win32_fputc(int c,FILE *pf) +{ + return pIOSubSystem->pfnfputc(c,pf); +} + +DllExport int win32_ungetc(int c,FILE *pf) +{ + return pIOSubSystem->pfnungetc(c,pf); +} + +DllExport int win32_getc(FILE *pf) +{ + return pIOSubSystem->pfngetc(pf); +} + +DllExport int win32_fileno(FILE *pf) +{ + return pIOSubSystem->pfnfileno(pf); +} + +DllExport void win32_clearerr(FILE *pf) +{ + pIOSubSystem->pfnclearerr(pf); + return; +} + +DllExport int win32_fflush(FILE *pf) +{ + return pIOSubSystem->pfnfflush(pf); +} + +DllExport long win32_ftell(FILE *pf) +{ + return pIOSubSystem->pfnftell(pf); +} + +DllExport int win32_fseek(FILE *pf,long offset,int origin) +{ + return pIOSubSystem->pfnfseek(pf, offset, origin); +} + +DllExport int win32_fgetpos(FILE *pf,fpos_t *p) +{ + return pIOSubSystem->pfnfgetpos(pf, p); +} + +DllExport int win32_fsetpos(FILE *pf,const fpos_t *p) +{ + return pIOSubSystem->pfnfsetpos(pf, p); +} + +DllExport void win32_rewind(FILE *pf) +{ + pIOSubSystem->pfnrewind(pf); + return; +} + +DllExport FILE* win32_tmpfile(void) +{ + return pIOSubSystem->pfntmpfile(); +} + +DllExport void win32_abort(void) +{ + pIOSubSystem->pfnabort(); + return; +} + +DllExport int win32_fstat(int fd,struct stat *bufptr) +{ + return pIOSubSystem->pfnfstat(fd,bufptr); +} + +DllExport int win32_pipe(int *pfd, unsigned int size, int mode) +{ + return pIOSubSystem->pfnpipe(pfd, size, mode); +} + +DllExport FILE* win32_popen(const char *command, const char *mode) +{ + return pIOSubSystem->pfnpopen(command, mode); +} + +DllExport int win32_pclose(FILE *pf) +{ + return pIOSubSystem->pfnpclose(pf); +} + +DllExport int win32_setmode(int fd, int mode) +{ + return pIOSubSystem->pfnsetmode(fd, mode); +} + +DllExport int win32_open(const char *path, int flag, ...) +{ + va_list ap; + int pmode; + + va_start(ap, flag); + pmode = va_arg(ap, int); + va_end(ap); + + if (stricmp(path, "/dev/null")==0) return pIOSubSystem->pfnopen("NUL", flag, pmode); + return pIOSubSystem->pfnopen(path,flag,pmode); +} + +DllExport int win32_close(int fd) +{ + return pIOSubSystem->pfnclose(fd); +} + +DllExport int win32_dup(int fd) +{ + return pIOSubSystem->pfndup(fd); +} + +DllExport int win32_dup2(int fd1,int fd2) +{ + return pIOSubSystem->pfndup2(fd1,fd2); +} + +DllExport int win32_read(int fd, char *buf, unsigned int cnt) +{ + return pIOSubSystem->pfnread(fd, buf, cnt); +} + +DllExport int win32_write(int fd, const char *buf, unsigned int cnt) +{ + return pIOSubSystem->pfnwrite(fd, buf, cnt); +} + +DllExport int win32_spawnvpe(int mode, const char *cmdname, const char *const *argv, const char *const *envp) +{ + return pIOSubSystem->pfnspawnvpe(mode, cmdname, argv, envp); +} + +DllExport int win32_spawnle(int mode, const char *cmdname, const char *arglist,...) +{ + const char* const* envp; + const char* const* argp; + + argp = &arglist; + while (*argp++) ; + + return pIOSubSystem->pfnspawnvpe(mode, cmdname, &arglist, argp); +} + +int stolen_open_osfhandle(long handle, int flags) +{ + return pIOSubSystem->pfn_open_osfhandle(handle, flags); +} + +long stolen_get_osfhandle(int fd) +{ + return pIOSubSystem->pfn_get_osfhandle(fd); +} diff --git a/win32/win32.h b/win32/win32.h new file mode 100644 index 0000000000..a051bc7261 --- /dev/null +++ b/win32/win32.h @@ -0,0 +1,109 @@ +// WIN32.H + +// (c) 1995 Microsoft Corporation. All rights reserved. +// Developed by hip communications inc., http://info.hip.com/info/ + +// You may distribute under the terms of either the GNU General Public +// License or the Artistic License, as specified in the README file. + +#ifndef _INC_WIN32_PERL5 +#define _INC_WIN32_PERL5 + +#define WIN32_LEAN_AND_MEAN +#include <windows.h> + +#ifdef WIN32_LEAN_AND_MEAN // C file is NOT a Perl5 original. +#define CONTEXT PERL_CONTEXT // Avoid conflict of CONTEXT defs. +#define index strchr // Why 'index'? +#endif //WIN32_LEAN_AND_MEAN + +#include <dirent.h> +#include <io.h> +#include <process.h> +#include <stdio.h> +#include <direct.h> + +// For UNIX compatibility. + +typedef long uid_t; +typedef long gid_t; + +extern char *staticlinkmodules[]; + +extern uid_t getuid(void); +extern gid_t getgid(void); +extern uid_t geteuid(void); +extern gid_t getegid(void); + +extern int setuid(uid_t uid); +extern int setgid(gid_t gid); +extern int kill(int pid, int sig); + +#define USE_SOCKETS_AS_HANDLES +#ifndef USE_SOCKETS_AS_HANDLES +extern FILE *myfdopen(int, char *); + +#undef fdopen +#define fdopen myfdopen +#endif // USE_SOCKETS_AS_HANDLES + +#define STANDARD_C 1 // Perl5 likes standard C. +#define DOSISH 1 // Take advantage of DOSish code in Perl5. + +#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 + +#undef pause +#define pause() sleep((32767L << 16) + 32767) + + +#undef times +#define times mytimes + +#undef alarm +#define alarm myalarm + +struct tms { + long tms_utime; + long tms_stime; + long tms_cutime; + long tms_cstime; + }; + +unsigned int sleep(unsigned int); +char *win32PerlLibPath(); +int mytimes(struct tms *timebuf); +unsigned int myalarm(unsigned int sec); +int do_aspawn(void* really, void** mark, void** arglast); +int do_spawn(char *cmd); + +typedef char * caddr_t; // In malloc.c (core address). + +// +// Extension Library, only good for VC +// + +#define DllExport __declspec(dllexport) + + +// +// handle socket stuff, assuming socket is always available +// + +#include <sys/socket.h> +#include <netdb.h> + +#pragma warning(disable: 4018 4035 4101 4102 4244 4245 4761) + +#endif // _INC_NT_PERL5 diff --git a/win32/win32aux.cpp b/win32/win32aux.cpp new file mode 100644 index 0000000000..feafbeb451 --- /dev/null +++ b/win32/win32aux.cpp @@ -0,0 +1,251 @@ + +#ifdef __cplusplus +extern "C" { +#endif + +#define WIN32_LEAN_AND_MEAN +#define WIN32IO_IS_STDIO +#define EXT +#include <windows.h> +#include <stdio.h> +#include <stdlib.h> +#include <io.h> +#include <sys/stat.h> +#include <sys/socket.h> +#include <fcntl.h> +#include <assert.h> +#include <errno.h> + +#include "win32iop.h" + +struct servent* win32_savecopyservent(struct servent*d, struct servent*s, const char *proto) +{ + try { + d->s_name = s->s_name; + d->s_aliases = s->s_aliases; + d->s_port = s->s_port; + if (strlen(s->s_proto)) d->s_proto = s->s_proto; + else if (proto && strlen(proto)) d->s_proto = (char *)proto; + else d->s_proto = "tcp"; + } + catch (...) { + if (proto && strlen(proto)) d->s_proto = (char *)proto; + else d->s_proto = "tcp"; + } + + return d; +} +#ifdef GARY +// +// The following is just a basic wrapping of the stdio +// +// +// +// +// +// redirected io subsystem for all XS modules +// +// + +static int * dummy_errno() +{ + return (&(errno)); +} + +// the rest are the remapped stdio routines +static FILE *dummy_stderr() +{ + return stderr; +} + +static FILE *dummy_stdin() +{ + return stdin; +} + +static FILE *dummy_stdout() +{ + return stdout; +} + +static int dummy_globalmode(int mode) +{ + int o = _fmode; + _fmode = mode; + + return o; +} + + +#if defined(_WIN32) && !defined(WIN95_OSFHANDLE_FIXED) && defined(_M_IX86) + +# ifdef __cplusplus +#define EXT_C_FUNC extern "C" +# else +#define EXT_C_FUNC extern +# endif + +EXT_C_FUNC int __cdecl _alloc_osfhnd(void); +EXT_C_FUNC int __cdecl _set_osfhnd(int fh, long value); +EXT_C_FUNC void __cdecl _lock_fhandle(int); +EXT_C_FUNC void __cdecl _unlock_fhandle(int); +EXT_C_FUNC void __cdecl _unlock(int); + +#if (_MSC_VER >= 1000) + typedef struct + { + long osfhnd; /* underlying OS file HANDLE */ + char osfile; /* attributes of file (e.g., open in text mode?) */ + char pipech; /* one char buffer for handles opened on pipes */ +#if defined (_MT) && !defined (DLL_FOR_WIN32S) + int lockinitflag; + CRITICAL_SECTION lock; +#endif /* defined (_MT) && !defined (DLL_FOR_WIN32S) */ + } ioinfo; + + EXT_C_FUNC ioinfo * __pioinfo[]; + + #define IOINFO_L2E 5 + #define IOINFO_ARRAY_ELTS (1 << IOINFO_L2E) + #define _pioinfo(i) (__pioinfo[i >> IOINFO_L2E] + (i & (IOINFO_ARRAY_ELTS - 1))) + #define _osfile(i) (_pioinfo(i)->osfile) +#else + extern "C" extern char _osfile[]; +#endif // (_MSC_VER >= 1000) + +#define FOPEN 0x01 // file handle open +#define FAPPEND 0x20 // file handle opened O_APPEND +#define FDEV 0x40 // file handle refers to device +#define FTEXT 0x80 // file handle is in text mode + +#define _STREAM_LOCKS 26 // Table of stream locks +#define _LAST_STREAM_LOCK (_STREAM_LOCKS+_NSTREAM_-1) // Last stream lock +#define _FH_LOCKS (_LAST_STREAM_LOCK+1) // Table of fh locks + +/*** +*int _patch_open_osfhandle(long osfhandle, int flags) - open C Runtime file handle +* +*Purpose: +* This function allocates a free C Runtime file handle and associates +* it with the Win32 HANDLE specified by the first parameter. This is a +* temperary fix for WIN95's brain damage GetFileType() error on socket +* we just bypass that call for socket +* +*Entry: +* long osfhandle - Win32 HANDLE to associate with C Runtime file handle. +* int flags - flags to associate with C Runtime file handle. +* +*Exit: +* returns index of entry in fh, if successful +* return -1, if no free entry is found +* +*Exceptions: +* +*******************************************************************************/ + +int my_open_osfhandle(long osfhandle, int flags) +{ + int fh; + char fileflags; // _osfile flags + + // copy relevant flags from second parameter + fileflags = FDEV; + + if(flags & _O_APPEND) + fileflags |= FAPPEND; + + if(flags & _O_TEXT) + fileflags |= FTEXT; + + // attempt to allocate a C Runtime file handle + if((fh = _alloc_osfhnd()) == -1) + { + errno = EMFILE; // too many open files + _doserrno = 0L; // not an OS error + return -1; // return error to caller + } + + // the file is open. now, set the info in _osfhnd array + _set_osfhnd(fh, osfhandle); + + fileflags |= FOPEN; // mark as open + +#if (_MSC_VER >= 1000) + _osfile(fh) = fileflags; // set osfile entry + _unlock_fhandle(fh); +#else + _osfile[fh] = fileflags; // set osfile entry + _unlock(fh+_FH_LOCKS); // unlock handle +#endif + + + return fh; // return handle +} +#else +int __cdecl stolen_open_osfhandle(long osfhandle, int flags) +{ + return _open_osfhandle(osfhandle, flags); +} +#endif // _M_IX86 + +long my_get_osfhandle( int filehandle ) +{ + return _get_osfhandle(filehandle); +} + +WIN32_IOSUBSYSTEM win32stdio = { + 12345678L, // begin of structure; + dummy_errno, // (*pfunc_errno)(void); + dummy_stdin, // (*pfunc_stdin)(void); + dummy_stdout, // (*pfunc_stdout)(void); + dummy_stderr, // (*pfunc_stderr)(void); + ferror, // (*pfunc_ferror)(FILE *fp); + feof, // (*pfunc_feof)(FILE *fp); + strerror, // (*strerror)(int e); + vfprintf, // (*pfunc_vfprintf)(FILE *pf, const char *format, va_list arg); + vprintf, // (*pfunc_vprintf)(const char *format, va_list arg); + fread, // (*pfunc_fread)(void *buf, size_t size, size_t count, FILE *pf); + fwrite, // (*pfunc_fwrite)(void *buf, size_t size, size_t count, FILE *pf); + fopen, // (*pfunc_fopen)(const char *path, const char *mode); + fdopen, // (*pfunc_fdopen)(int fh, const char *mode); + freopen, // (*pfunc_freopen)(const char *path, const char *mode, FILE *pf); + fclose, // (*pfunc_fclose)(FILE *pf); + fputs, // (*pfunc_fputs)(const char *s,FILE *pf); + fputc, // (*pfunc_fputc)(int c,FILE *pf); + ungetc, // (*pfunc_ungetc)(int c,FILE *pf); + getc, // (*pfunc_getc)(FILE *pf); + fileno, // (*pfunc_fileno)(FILE *pf); + clearerr, // (*pfunc_clearerr)(FILE *pf); + fflush, // (*pfunc_fflush)(FILE *pf); + ftell, // (*pfunc_ftell)(FILE *pf); + fseek, // (*pfunc_fseek)(FILE *pf,long offset,int origin); + fgetpos, // (*pfunc_fgetpos)(FILE *pf,fpos_t *p); + fsetpos, // (*pfunc_fsetpos)(FILE *pf,fpos_t *p); + rewind, // (*pfunc_rewind)(FILE *pf); + tmpfile, // (*pfunc_tmpfile)(void); + abort, // (*pfunc_abort)(void); + fstat, // (*pfunc_fstat)(int fd,struct stat *bufptr); + stat, // (*pfunc_stat)(const char *name,struct stat *bufptr); + _pipe, // (*pfunc_pipe)( int *phandles, unsigned int psize, int textmode ); + _popen, // (*pfunc_popen)( const char *command, const char *mode ); + _pclose, // (*pfunc_pclose)( FILE *pf); + setmode, // (*pfunc_setmode)( int fd, int mode); + lseek, // (*pfunc_lseek)( int fd, long offset, int origin); + tell, // (*pfunc_tell)( int fd); + dup, // (*pfunc_dup)( int fd); + dup2, // (*pfunc_dup2)(int h1, int h2); + open, // (*pfunc_open)(const char *path, int oflag,...); + close, // (*pfunc_close)(int fd); + eof, // (*pfunc_eof)(int fd); + read, // (*pfunc_read)(int fd, void *buf, unsigned int cnt); + write, // (*pfunc_write)(int fd, const void *buf, unsigned int cnt); + dummy_globalmode,// (*pfunc_globalmode)(int mode) + my_open_osfhandle, + my_get_osfhandle, + 87654321L, // end of structure +}; +#endif + +#ifdef __cplusplus +} +#endif diff --git a/win32/win32io.cpp b/win32/win32io.cpp new file mode 100644 index 0000000000..db3eb292d9 --- /dev/null +++ b/win32/win32io.cpp @@ -0,0 +1,231 @@ + +#ifdef __cplusplus +extern "C" { +#endif + +#define WIN32_LEAN_AND_MEAN +#define WIN32IO_IS_STDIO +#define EXT +#include <windows.h> +#include <stdio.h> +#include <stdlib.h> +#include <io.h> +#include <sys/stat.h> +#include <sys/socket.h> +#include <fcntl.h> +#include <assert.h> +#include <errno.h> +#include <process.h> + +#include "win32iop.h" + +// +// The following is just a basic wrapping of the stdio +// +// +// redirected io subsystem for all XS modules +// +// + +static int * dummy_errno() +{ + return (&(errno)); +} + +static FILE *dummy_stderr() +{ + return stderr; +} + +static FILE *dummy_stdin() +{ + return stdin; +} + +static FILE *dummy_stdout() +{ + return stdout; +} + +static int dummy_globalmode(int mode) +{ + int o = _fmode; + _fmode = mode; + + return o; +} + + +#if defined(_WIN32) && !defined(WIN95_OSFHANDLE_FIXED) && defined(_M_IX86) + +# ifdef __cplusplus +#define EXT_C_FUNC extern "C" +# else +#define EXT_C_FUNC extern +# endif + +EXT_C_FUNC int __cdecl _alloc_osfhnd(void); +EXT_C_FUNC int __cdecl _set_osfhnd(int fh, long value); +EXT_C_FUNC void __cdecl _lock_fhandle(int); +EXT_C_FUNC void __cdecl _unlock_fhandle(int); +EXT_C_FUNC void __cdecl _unlock(int); + +#if (_MSC_VER >= 1000) + typedef struct + { + long osfhnd; /* underlying OS file HANDLE */ + char osfile; /* attributes of file (e.g., open in text mode?) */ + char pipech; /* one char buffer for handles opened on pipes */ +#if defined (_MT) && !defined (DLL_FOR_WIN32S) + int lockinitflag; + CRITICAL_SECTION lock; +#endif /* defined (_MT) && !defined (DLL_FOR_WIN32S) */ + } ioinfo; + + EXT_C_FUNC ioinfo * __pioinfo[]; + + #define IOINFO_L2E 5 + #define IOINFO_ARRAY_ELTS (1 << IOINFO_L2E) + #define _pioinfo(i) (__pioinfo[i >> IOINFO_L2E] + (i & (IOINFO_ARRAY_ELTS - 1))) + #define _osfile(i) (_pioinfo(i)->osfile) +#else + extern "C" extern char _osfile[]; +#endif // (_MSC_VER >= 1000) + +#define FOPEN 0x01 // file handle open +#define FAPPEND 0x20 // file handle opened O_APPEND +#define FDEV 0x40 // file handle refers to device +#define FTEXT 0x80 // file handle is in text mode + +#define _STREAM_LOCKS 26 // Table of stream locks +#define _LAST_STREAM_LOCK (_STREAM_LOCKS+_NSTREAM_-1) // Last stream lock +#define _FH_LOCKS (_LAST_STREAM_LOCK+1) // Table of fh locks + +/*** +*int _patch_open_osfhandle(long osfhandle, int flags) - open C Runtime file handle +* +*Purpose: +* This function allocates a free C Runtime file handle and associates +* it with the Win32 HANDLE specified by the first parameter. This is a +* temperary fix for WIN95's brain damage GetFileType() error on socket +* we just bypass that call for socket +* +*Entry: +* long osfhandle - Win32 HANDLE to associate with C Runtime file handle. +* int flags - flags to associate with C Runtime file handle. +* +*Exit: +* returns index of entry in fh, if successful +* return -1, if no free entry is found +* +*Exceptions: +* +*******************************************************************************/ + +int my_open_osfhandle(long osfhandle, int flags) +{ + int fh; + char fileflags; // _osfile flags + + // copy relevant flags from second parameter + fileflags = FDEV; + + if(flags & _O_APPEND) + fileflags |= FAPPEND; + + if(flags & _O_TEXT) + fileflags |= FTEXT; + + // attempt to allocate a C Runtime file handle + if((fh = _alloc_osfhnd()) == -1) + { + errno = EMFILE; // too many open files + _doserrno = 0L; // not an OS error + return -1; // return error to caller + } + + // the file is open. now, set the info in _osfhnd array + _set_osfhnd(fh, osfhandle); + + fileflags |= FOPEN; // mark as open + +#if (_MSC_VER >= 1000) + _osfile(fh) = fileflags; // set osfile entry + _unlock_fhandle(fh); +#else + _osfile[fh] = fileflags; // set osfile entry + _unlock(fh+_FH_LOCKS); // unlock handle +#endif + + + return fh; // return handle +} +#else +int __cdecl stolen_open_osfhandle(long osfhandle, int flags) +{ + return _open_osfhandle(osfhandle, flags); +} +#endif // _M_IX86 + +long my_get_osfhandle( int filehandle ) +{ + return _get_osfhandle(filehandle); +} + +WIN32_IOSUBSYSTEM win32stdio = { + 12345678L, // begin of structure; + dummy_errno, // (*pfunc_errno)(void); + dummy_stdin, // (*pfunc_stdin)(void); + dummy_stdout, // (*pfunc_stdout)(void); + dummy_stderr, // (*pfunc_stderr)(void); + ferror, // (*pfunc_ferror)(FILE *fp); + feof, // (*pfunc_feof)(FILE *fp); + strerror, // (*strerror)(int e); + vfprintf, // (*pfunc_vfprintf)(FILE *pf, const char *format, va_list arg); + vprintf, // (*pfunc_vprintf)(const char *format, va_list arg); + fread, // (*pfunc_fread)(void *buf, size_t size, size_t count, FILE *pf); + fwrite, // (*pfunc_fwrite)(void *buf, size_t size, size_t count, FILE *pf); + fopen, // (*pfunc_fopen)(const char *path, const char *mode); + fdopen, // (*pfunc_fdopen)(int fh, const char *mode); + freopen, // (*pfunc_freopen)(const char *path, const char *mode, FILE *pf); + fclose, // (*pfunc_fclose)(FILE *pf); + fputs, // (*pfunc_fputs)(const char *s,FILE *pf); + fputc, // (*pfunc_fputc)(int c,FILE *pf); + ungetc, // (*pfunc_ungetc)(int c,FILE *pf); + getc, // (*pfunc_getc)(FILE *pf); + fileno, // (*pfunc_fileno)(FILE *pf); + clearerr, // (*pfunc_clearerr)(FILE *pf); + fflush, // (*pfunc_fflush)(FILE *pf); + ftell, // (*pfunc_ftell)(FILE *pf); + fseek, // (*pfunc_fseek)(FILE *pf,long offset,int origin); + fgetpos, // (*pfunc_fgetpos)(FILE *pf,fpos_t *p); + fsetpos, // (*pfunc_fsetpos)(FILE *pf,fpos_t *p); + rewind, // (*pfunc_rewind)(FILE *pf); + tmpfile, // (*pfunc_tmpfile)(void); + abort, // (*pfunc_abort)(void); + fstat, // (*pfunc_fstat)(int fd,struct stat *bufptr); + stat, // (*pfunc_stat)(const char *name,struct stat *bufptr); + _pipe, // (*pfunc_pipe)( int *phandles, unsigned int psize, int textmode ); + _popen, // (*pfunc_popen)( const char *command, const char *mode ); + _pclose, // (*pfunc_pclose)( FILE *pf); + setmode, // (*pfunc_setmode)( int fd, int mode); + lseek, // (*pfunc_lseek)( int fd, long offset, int origin); + tell, // (*pfunc_tell)( int fd); + dup, // (*pfunc_dup)( int fd); + dup2, // (*pfunc_dup2)(int h1, int h2); + open, // (*pfunc_open)(const char *path, int oflag,...); + close, // (*pfunc_close)(int fd); + eof, // (*pfunc_eof)(int fd); + read, // (*pfunc_read)(int fd, void *buf, unsigned int cnt); + write, // (*pfunc_write)(int fd, const void *buf, unsigned int cnt); + dummy_globalmode,// (*pfunc_globalmode)(int mode) + my_open_osfhandle, + my_get_osfhandle, + spawnvpe, + 87654321L, // end of structure +}; + + +#ifdef __cplusplus +} +#endif diff --git a/win32/win32io.h b/win32/win32io.h new file mode 100644 index 0000000000..cb0c692da4 --- /dev/null +++ b/win32/win32io.h @@ -0,0 +1,59 @@ +#ifndef WIN32IO_H +#define WIN32IO_H + +typedef struct { +int signature_begin; +int * (*pfnerrno)(void); +FILE* (*pfnstdin)(void); +FILE* (*pfnstdout)(void); +FILE* (*pfnstderr)(void); +int (*pfnferror)(FILE *fp); +int (*pfnfeof)(FILE *fp); +char* (*pfnstrerror)(int e); +int (*pfnvfprintf)(FILE *pf, const char *format, va_list arg); +int (*pfnvprintf)(const char *format, va_list arg); +size_t (*pfnfread)(void *buf, size_t size, size_t count, FILE *pf); +size_t (*pfnfwrite)(const void *buf, size_t size, size_t count, FILE *pf); +FILE* (*pfnfopen)(const char *path, const char *mode); +FILE* (*pfnfdopen)(int fh, const char *mode); +FILE* (*pfnfreopen)(const char *path, const char *mode, FILE *pf); +int (*pfnfclose)(FILE *pf); +int (*pfnfputs)(const char *s,FILE *pf); +int (*pfnfputc)(int c,FILE *pf); +int (*pfnungetc)(int c,FILE *pf); +int (*pfngetc)(FILE *pf); +int (*pfnfileno)(FILE *pf); +void (*pfnclearerr)(FILE *pf); +int (*pfnfflush)(FILE *pf); +long (*pfnftell)(FILE *pf); +int (*pfnfseek)(FILE *pf,long offset,int origin); +int (*pfnfgetpos)(FILE *pf,fpos_t *p); +int (*pfnfsetpos)(FILE *pf,const fpos_t *p); +void (*pfnrewind)(FILE *pf); +FILE* (*pfntmpfile)(void); +void (*pfnabort)(void); +int (*pfnfstat)(int fd,struct stat *bufptr); +int (*pfnstat)(const char *name,struct stat *bufptr); +int (*pfnpipe)( int *phandles, unsigned int psize, int textmode ); +FILE* (*pfnpopen)( const char *command, const char *mode ); +int (*pfnpclose)( FILE *pf); +int (*pfnsetmode)( int fd, int mode); +long (*pfnlseek)( int fd, long offset, int origin); +long (*pfntell)( int fd); +int (*pfndup)( int fd); +int (*pfndup2)(int h1, int h2); +int (*pfnopen)(const char *path, int oflag,...); +int (*pfnclose)(int fd); +int (*pfneof)(int fd); +int (*pfnread)(int fd, void *buf, unsigned int cnt); +int (*pfnwrite)(int fd, const void *buf, unsigned int cnt); +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 signature_end; +} WIN32_IOSUBSYSTEM; + +typedef WIN32_IOSUBSYSTEM *PWIN32_IOSUBSYSTEM; + +#endif // WIN32IO_H diff --git a/win32/win32iop.h b/win32/win32iop.h new file mode 100644 index 0000000000..7b7a521fe3 --- /dev/null +++ b/win32/win32iop.h @@ -0,0 +1,132 @@ +#ifndef WIN32IOP_H +#define WIN32IOP_H + + +/* + * Make this as close to original stdio as possible. + */ +// +// function prototypes for our own win32io layer +// +EXT int * win32_errno(); +EXT FILE* win32_stdin(void); +EXT FILE* win32_stdout(void); +EXT FILE* win32_stderr(void); +EXT int win32_ferror(FILE *fp); +EXT int win32_feof(FILE *fp); +EXT char* win32_strerror(int e); + +EXT int win32_fprintf(FILE *pf, const char *format, ...); +EXT int win32_printf(const char *format, ...); +EXT int win32_vfprintf(FILE *pf, const char *format, va_list arg); +EXT size_t win32_fread(void *buf, size_t size, size_t count, FILE *pf); +EXT size_t win32_fwrite(const void *buf, size_t size, size_t count, FILE *pf); +EXT FILE* win32_fopen(const char *path, const char *mode); +EXT FILE* win32_fdopen(int fh, const char *mode); +EXT FILE* win32_freopen(const char *path, const char *mode, FILE *pf); +EXT int win32_fclose(FILE *pf); +EXT int win32_fputs(const char *s,FILE *pf); +EXT int win32_fputc(int c,FILE *pf); +EXT int win32_ungetc(int c,FILE *pf); +EXT int win32_getc(FILE *pf); +EXT int win32_fileno(FILE *pf); +EXT void win32_clearerr(FILE *pf); +EXT int win32_fflush(FILE *pf); +EXT long win32_ftell(FILE *pf); +EXT int win32_fseek(FILE *pf,long offset,int origin); +EXT int win32_fgetpos(FILE *pf,fpos_t *p); +EXT int win32_fsetpos(FILE *pf,const fpos_t *p); +EXT void win32_rewind(FILE *pf); +EXT FILE* win32_tmpfile(void); +EXT void win32_abort(void); +EXT int win32_fstat(int fd,struct stat *bufptr); +EXT int win32_stat(const char *name,struct stat *bufptr); +EXT int win32_pipe( int *phandles, unsigned int psize, int textmode ); +EXT FILE* win32_popen( const char *command, const char *mode ); +EXT int win32_pclose( FILE *pf); +EXT int win32_setmode( int fd, int mode); +EXT long win32_lseek( int fd, long offset, int origin); +EXT long win32_tell( int fd); +EXT int win32_dup( int fd); +EXT int win32_dup2(int h1, int h2); +EXT int win32_open(const char *path, int oflag,...); +EXT int win32_close(int fd); +EXT int win32_eof(int fd); +EXT int win32_read(int fd, void *buf, unsigned int cnt); +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 *,...); + +// +// these two are win32 specific but still io related +// +int stolen_open_osfhandle(long handle, int flags); +long stolen_get_osfhandle(int fd); + +#include <win32io.h> // pull in the io sub system structure + +void * SetIOSubSystem(void *piosubsystem); +// +// the following six(6) is #define in stdio.h +// +// +#ifndef WIN32IO_IS_STDIO +#undef errno +#undef stderr +#undef stdin +#undef stdout +#undef ferror +#undef feof + +#define stderr win32_stderr() +#define stdout win32_stdout() +#define stdin win32_stdin() +#define feof(f) win32_feof(f) +#define ferror(f) win32_ferror(f) +#define errno (*win32_errno()) +#define strerror win32_strerror + +// +// redirect to our own version +// +#define fprintf win32_fprintf +#define vfprintf win32_vfprintf +#define printf win32_printf +#define fread(buf,size,count,f) win32_fread(buf,size,count,f) +#define fwrite(buf,size,count,f) win32_fwrite(buf,size,count,f) +#define fopen win32_fopen +#define fdopen win32_fdopen +#define freopen win32_freopen +#define fclose(f) win32_fclose(f) +#define fputs(s,f) win32_fputs(s,f) +#define fputc(c,f) win32_fputc(c,f) +#define ungetc(c,f) win32_ungetc(c,f) +#define getc(f) win32_getc(f) +#define fileno(f) win32_fileno(f) +#define clearerr(f) win32_clearerr(f) +#define fflush(f) win32_fflush(f) +#define ftell(f) win32_ftell(f) +#define fseek(f,o,w) win32_fseek(f,o,w) +#define fgetpos(f,p) win32_fgetpos(f,p) +#define fsetpos(f,p) win32_fsetpos(f,p) +#define rewind(f) win32_rewind(f) +#define tmpfile() win32_tmpfile() +#define abort() win32_abort() +#define fstat(fd,bufptr) win32_fstat(fd,bufptr) +#define setmode(fd,mode) win32_setmode(fd,mode) +#define lseek(fd,offset,orig) win32_lseek(fd,offset,orig) +#define tell(fd) win32_tell(fd) +#define dup(fd) win32_dup(fd) +#define dup2(fd1,fd2) win32_dup2(fd1,fd2) +#define open win32_open +#define close(fd) win32_close(fd) +#define eof(fd) win32_eof(fd) +#define read(fd,b,s) win32_read(fd,b,s) +#define write(fd,b,s) win32_write(fd,b,s) +#define _open_osfhandle stolen_open_osfhandle +#define _get_osfhandle stolen_get_osfhandle +#define spawnvpe win32_spawnvpe +#define spawnle win32_spawnle +#endif //WIN32IO_IS_STDIO + +#endif // WIN32IOP_H diff --git a/win32/win32sck.c b/win32/win32sck.c new file mode 100644 index 0000000000..126ff1a246 --- /dev/null +++ b/win32/win32sck.c @@ -0,0 +1,761 @@ +// NTSock.C + +// (c) 1995 Microsoft Corporation. All rights reserved. +// Developed by hip communications inc., http://info.hip.com/info/ +// Portions (c) 1993 Intergraph Corporation. All rights reserved. + +// You may distribute under the terms of either the GNU General Public +// License or the Artistic License, as specified in the README file. + +#include <windows.h> +#define WIN32_LEAN_AND_MEAN +#include "EXTERN.h" +#include "perl.h" +#include <sys/socket.h> +#include <fcntl.h> +#include <sys/stat.h> +#include <assert.h> + +#define CROAK croak + +#ifdef USE_SOCKETS_AS_HANDLES +// thanks to Beverly Brown (beverly@datacube.com) + +# if defined(_WIN32) && !defined(WIN95_OSFHANDLE_FIXED) && defined(_M_IX86) +//# define OPEN_SOCKET(x) _patch_open_osfhandle(x, _O_RDWR | _O_BINARY) +# define OPEN_SOCKET(x) _open_osfhandle(x,_O_RDWR|_O_BINARY) +# else +# define OPEN_SOCKET(x) _open_osfhandle(x,_O_RDWR|_O_BINARY) +# endif +# define TO_SOCKET(x) _get_osfhandle(x) + +#else + +# define OPEN_SOCKET(x) (x) +# define TO_SOCKET(x) (x) + +#endif // USE_SOCKETS_AS_HANDLES + +// +// This is a clone of fdopen so that we can handle the version of sockets that NT gets to use. +// +// The problem is that sockets are not real file handles and +// cannot be fdopen'ed. This causes problems in the do_socket +// routine in doio.c, since it tries to create two file pointers +// for the socket just created. We'll fake out an fdopen and see +// if we can prevent perl from trying to do stdio on sockets. +// + +#if defined(_WIN32) && !defined(WIN95_OSFHANDLE_FIXED) && defined(_M_IX86) + +# ifdef __cplusplus +#define EXT_C_FUNC extern "C" +# else +#define EXT_C_FUNC extern +# endif + +EXT_C_FUNC int __cdecl _alloc_osfhnd(void); +EXT_C_FUNC int __cdecl _set_osfhnd(int fh, long value); +EXT_C_FUNC void __cdecl _lock_fhandle(int); +EXT_C_FUNC void __cdecl _unlock_fhandle(int); +EXT_C_FUNC void __cdecl _unlock(int); +EXT_C_FUNC struct servent* win32_savecopyservent(struct servent*d, struct servent*s, const char *proto); + +#if (_MSC_VER >= 1000) + typedef struct + { + long osfhnd; /* underlying OS file HANDLE */ + char osfile; /* attributes of file (e.g., open in text mode?) */ + char pipech; /* one char buffer for handles opened on pipes */ +#if defined (_MT) && !defined (DLL_FOR_WIN32S) + int lockinitflag; + CRITICAL_SECTION lock; +#endif /* defined (_MT) && !defined (DLL_FOR_WIN32S) */ + } ioinfo; + + EXT_C_FUNC ioinfo * __pioinfo[]; + + #define IOINFO_L2E 5 + #define IOINFO_ARRAY_ELTS (1 << IOINFO_L2E) + #define _pioinfo(i) (__pioinfo[i >> IOINFO_L2E] + (i & (IOINFO_ARRAY_ELTS - 1))) + #define _osfile(i) (_pioinfo(i)->osfile) +#else + extern "C" extern char _osfile[]; +#endif // (_MSC_VER >= 1000) + +#define FOPEN 0x01 // file handle open +#define FAPPEND 0x20 // file handle opened O_APPEND +#define FDEV 0x40 // file handle refers to device +#define FTEXT 0x80 // file handle is in text mode + +#define _STREAM_LOCKS 26 // Table of stream locks +#define _LAST_STREAM_LOCK (_STREAM_LOCKS+_NSTREAM_-1) // Last stream lock +#define _FH_LOCKS (_LAST_STREAM_LOCK+1) // Table of fh locks + +/*** +*int _patch_open_osfhandle(long osfhandle, int flags) - open C Runtime file handle +* +*Purpose: +* This function allocates a free C Runtime file handle and associates +* it with the Win32 HANDLE specified by the first parameter. This is a +* temperary fix for WIN95's brain damage GetFileType() error on socket +* we just bypass that call for socket +* +*Entry: +* long osfhandle - Win32 HANDLE to associate with C Runtime file handle. +* int flags - flags to associate with C Runtime file handle. +* +*Exit: +* returns index of entry in fh, if successful +* return -1, if no free entry is found +* +*Exceptions: +* +*******************************************************************************/ + +int __cdecl _patch_open_osfhandle(long osfhandle, int flags) +{ + int fh; + char fileflags; // _osfile flags + + // copy relevant flags from second parameter + fileflags = FDEV; + + if(flags & _O_APPEND) + fileflags |= FAPPEND; + + if(flags & _O_TEXT) + fileflags |= FTEXT; + + // attempt to allocate a C Runtime file handle + if((fh = _alloc_osfhnd()) == -1) + { + errno = EMFILE; // too many open files + _doserrno = 0L; // not an OS error + return -1; // return error to caller + } + + // the file is open. now, set the info in _osfhnd array + _set_osfhnd(fh, osfhandle); + + fileflags |= FOPEN; // mark as open + +#if (_MSC_VER >= 1000) + _osfile(fh) = fileflags; // set osfile entry + _unlock_fhandle(fh); +#else + _osfile[fh] = fileflags; // set osfile entry + _unlock(fh+_FH_LOCKS); // unlock handle +#endif + + + return fh; // return handle +} +#endif // _M_IX86 + +#define SOCKETAPI PASCAL + +typedef SOCKET (SOCKETAPI *LPSOCKACCEPT)(SOCKET, struct sockaddr *, int *); +typedef int (SOCKETAPI *LPSOCKBIND)(SOCKET, const struct sockaddr *, int); +typedef int (SOCKETAPI *LPSOCKCLOSESOCKET)(SOCKET); +typedef int (SOCKETAPI *LPSOCKCONNECT)(SOCKET, const struct sockaddr *, int); +typedef int (SOCKETAPI *LPSOCKIOCTLSOCKET)(SOCKET, long, u_long *); +typedef int (SOCKETAPI *LPSOCKGETPEERNAME)(SOCKET, struct sockaddr *, int *); +typedef int (SOCKETAPI *LPSOCKGETSOCKNAME)(SOCKET, struct sockaddr *, int *); +typedef int (SOCKETAPI *LPSOCKGETSOCKOPT)(SOCKET, int, int, char *, int *); +typedef u_long (SOCKETAPI *LPSOCKHTONL)(u_long); +typedef u_short (SOCKETAPI *LPSOCKHTONS)(u_short); +typedef int (SOCKETAPI *LPSOCKLISTEN)(SOCKET, int); +typedef u_long (SOCKETAPI *LPSOCKNTOHL)(u_long); +typedef u_short (SOCKETAPI *LPSOCKNTOHS)(u_short); +typedef int (SOCKETAPI *LPSOCKRECV)(SOCKET, char *, int, int); +typedef int (SOCKETAPI *LPSOCKRECVFROM)(SOCKET, char *, int, int, struct sockaddr *, int *); +typedef int (SOCKETAPI *LPSOCKSELECT)(int, fd_set *, fd_set *, fd_set *, const struct timeval *); +typedef int (SOCKETAPI *LPSOCKSEND)(SOCKET, const char *, int, int); +typedef int (SOCKETAPI *LPSOCKSENDTO)(SOCKET, const char *, int, int, const struct sockaddr *, int); +typedef int (SOCKETAPI *LPSOCKSETSOCKOPT)(SOCKET, int, int, const char *, int); +typedef int (SOCKETAPI *LPSOCKSHUTDOWN)(SOCKET, int); +typedef SOCKET (SOCKETAPI *LPSOCKSOCKET)(int, int, int); +typedef char FAR *(SOCKETAPI *LPSOCKINETNTOA)(struct in_addr in); +typedef unsigned long (SOCKETAPI *LPSOCKINETADDR)(const char FAR * cp); + + +/* Database function prototypes */ +typedef struct hostent *(SOCKETAPI *LPSOCKGETHOSTBYADDR)(const char *, int, int); +typedef struct hostent *(SOCKETAPI *LPSOCKGETHOSTBYNAME)(const char *); +typedef int (SOCKETAPI *LPSOCKGETHOSTNAME)(char *, int); +typedef struct servent *(SOCKETAPI *LPSOCKGETSERVBYPORT)(int, const char *); +typedef struct servent *(SOCKETAPI *LPSOCKGETSERVBYNAME)(const char *, const char *); +typedef struct protoent *(SOCKETAPI *LPSOCKGETPROTOBYNUMBER)(int); +typedef struct protoent *(SOCKETAPI *LPSOCKGETPROTOBYNAME)(const char *); + +/* Microsoft Windows Extension function prototypes */ +typedef int (SOCKETAPI *LPSOCKWSASTARTUP)(unsigned short, LPWSADATA); +typedef int (SOCKETAPI *LPSOCKWSACLEANUP)(void); +typedef int (SOCKETAPI *LPSOCKWSAGETLASTERROR)(void); +typedef int (SOCKETAPI *LPWSAFDIsSet)(SOCKET, fd_set *); + +static HINSTANCE hWinSockDll = 0; +// extern CRITICAL_SECTION csSock; + +static LPSOCKACCEPT paccept = 0; +static LPSOCKBIND pbind = 0; +static LPSOCKCLOSESOCKET pclosesocket = 0; +static LPSOCKCONNECT pconnect = 0; +static LPSOCKIOCTLSOCKET pioctlsocket = 0; +static LPSOCKGETPEERNAME pgetpeername = 0; +static LPSOCKGETSOCKNAME pgetsockname = 0; +static LPSOCKGETSOCKOPT pgetsockopt = 0; +static LPSOCKHTONL phtonl = 0; +static LPSOCKHTONS phtons = 0; +static LPSOCKLISTEN plisten = 0; +static LPSOCKNTOHL pntohl = 0; +static LPSOCKNTOHS pntohs = 0; +static LPSOCKRECV precv = 0; +static LPSOCKRECVFROM precvfrom = 0; +static LPSOCKSELECT pselect = 0; +static LPSOCKSEND psend = 0; +static LPSOCKSENDTO psendto = 0; +static LPSOCKSETSOCKOPT psetsockopt = 0; +static LPSOCKSHUTDOWN pshutdown = 0; +static LPSOCKSOCKET psocket = 0; +static LPSOCKGETHOSTBYADDR pgethostbyaddr = 0; +static LPSOCKGETHOSTBYNAME pgethostbyname = 0; +static LPSOCKGETHOSTNAME pgethostname = 0; +static LPSOCKGETSERVBYPORT pgetservbyport = 0; +static LPSOCKGETSERVBYNAME pgetservbyname = 0; +static LPSOCKGETPROTOBYNUMBER pgetprotobynumber = 0; +static LPSOCKGETPROTOBYNAME pgetprotobyname = 0; +static LPSOCKWSASTARTUP pWSAStartup = 0; +static LPSOCKWSACLEANUP pWSACleanup = 0; +static LPSOCKWSAGETLASTERROR pWSAGetLastError = 0; +static LPWSAFDIsSet pWSAFDIsSet = 0; +static LPSOCKINETNTOA pinet_ntoa = 0; +static LPSOCKINETADDR pinet_addr = 0; + +__declspec(thread) struct servent myservent; + + +void *GetAddress(HINSTANCE hInstance, char *lpFunctionName) +{ + char buffer[512]; + FARPROC proc = GetProcAddress(hInstance, lpFunctionName); + if(proc == 0) + { + sprintf(buffer, "Unable to get address of %s in WSock32.dll", lpFunctionName); + CROAK(buffer); + } + return proc; +} + +void LoadWinSock(void) +{ +// EnterCriticalSection(&csSock); + if(hWinSockDll == NULL) + { + HINSTANCE hLib = LoadLibrary("WSock32.DLL"); + if(hLib == NULL) + CROAK("Could not load WSock32.dll\n"); + + paccept = (LPSOCKACCEPT)GetAddress(hLib, "accept"); + pbind = (LPSOCKBIND)GetAddress(hLib, "bind"); + pclosesocket = (LPSOCKCLOSESOCKET)GetAddress(hLib, "closesocket"); + pconnect = (LPSOCKCONNECT)GetAddress(hLib, "connect"); + pioctlsocket = (LPSOCKIOCTLSOCKET)GetAddress(hLib, "ioctlsocket"); + pgetpeername = (LPSOCKGETPEERNAME)GetAddress(hLib, "getpeername"); + pgetsockname = (LPSOCKGETSOCKNAME)GetAddress(hLib, "getsockname"); + pgetsockopt = (LPSOCKGETSOCKOPT)GetAddress(hLib, "getsockopt"); + phtonl = (LPSOCKHTONL)GetAddress(hLib, "htonl"); + phtons = (LPSOCKHTONS)GetAddress(hLib, "htons"); + plisten = (LPSOCKLISTEN)GetAddress(hLib, "listen"); + pntohl = (LPSOCKNTOHL)GetAddress(hLib, "ntohl"); + pntohs = (LPSOCKNTOHS)GetAddress(hLib, "ntohs"); + precv = (LPSOCKRECV)GetAddress(hLib, "recv"); + precvfrom = (LPSOCKRECVFROM)GetAddress(hLib, "recvfrom"); + pselect = (LPSOCKSELECT)GetAddress(hLib, "select"); + psend = (LPSOCKSEND)GetAddress(hLib, "send"); + psendto = (LPSOCKSENDTO)GetAddress(hLib, "sendto"); + psetsockopt = (LPSOCKSETSOCKOPT)GetAddress(hLib, "setsockopt"); + pshutdown = (LPSOCKSHUTDOWN)GetAddress(hLib, "shutdown"); + psocket = (LPSOCKSOCKET)GetAddress(hLib, "socket"); + pgethostbyaddr = (LPSOCKGETHOSTBYADDR)GetAddress(hLib, "gethostbyaddr"); + pgethostbyname = (LPSOCKGETHOSTBYNAME)GetAddress(hLib, "gethostbyname"); + pgethostname = (LPSOCKGETHOSTNAME)GetAddress(hLib, "gethostname"); + pgetservbyport = (LPSOCKGETSERVBYPORT)GetAddress(hLib, "getservbyport"); + pgetservbyname = (LPSOCKGETSERVBYNAME)GetAddress(hLib, "getservbyname"); + pgetprotobynumber = (LPSOCKGETPROTOBYNUMBER)GetAddress(hLib, "getprotobynumber"); + pgetprotobyname = (LPSOCKGETPROTOBYNAME)GetAddress(hLib, "getprotobyname"); + pWSAStartup = (LPSOCKWSASTARTUP)GetAddress(hLib, "WSAStartup"); + pWSACleanup = (LPSOCKWSACLEANUP)GetAddress(hLib, "WSACleanup"); + pWSAGetLastError = (LPSOCKWSAGETLASTERROR)GetAddress(hLib, "WSAGetLastError"); + pWSAFDIsSet = (LPWSAFDIsSet)GetAddress(hLib, "__WSAFDIsSet"); + pinet_addr = (LPSOCKINETADDR)GetAddress(hLib,"inet_addr"); + pinet_ntoa = (LPSOCKINETNTOA)GetAddress(hLib,"inet_ntoa"); + + hWinSockDll = hLib; + } +// LeaveCriticalSection(&csSock); +} + +void EndSockets(void) +{ + if(hWinSockDll != NULL) + { + pWSACleanup(); + FreeLibrary(hWinSockDll); + } + hWinSockDll = NULL; +} + +void StartSockets(void) +{ + unsigned short version; + WSADATA retdata; + int ret; + int iSockOpt = SO_SYNCHRONOUS_NONALERT; + + LoadWinSock(); + // + // initalize the winsock interface and insure that it is + // cleaned up at exit. + // + version = 0x101; + if(ret = pWSAStartup(version, &retdata)) + CROAK("Unable to locate winsock library!\n"); + if(retdata.wVersion != version) + CROAK("Could not find version 1.1 of winsock dll\n"); + + // atexit((void (*)(void)) EndSockets); + +#ifdef USE_SOCKETS_AS_HANDLES + // + // Enable the use of sockets as filehandles + // + psetsockopt(INVALID_SOCKET, SOL_SOCKET, SO_OPENTYPE, (char *)&iSockOpt, sizeof(iSockOpt)); +#endif // USE_SOCKETS_AS_HANDLES +} + + +#ifndef USE_SOCKETS_AS_HANDLES +FILE *myfdopen(int fd, char *mode) +{ + FILE *fp; + char sockbuf[256]; + int optlen = sizeof(sockbuf); + int retval; + + + if(hWinSockDll == 0) + LoadWinSock(); + + retval = pgetsockopt((SOCKET)fd, SOL_SOCKET, SO_TYPE, sockbuf, &optlen); + if(retval == SOCKET_ERROR && pWSAGetLastError() == WSAENOTSOCK) + { + return(_fdopen(fd, mode)); + } + + // + // If we get here, then fd is actually a socket. + // + Newz(1601, fp, 1, FILE); + if(fp == NULL) + { + errno = ENOMEM; + return NULL; + } + + fp->_file = fd; + if(*mode == 'r') + fp->_flag = _IOREAD; + else + fp->_flag = _IOWRT; + + return fp; +} +#endif // USE_SOCKETS_AS_HANDLES + + +u_long win32_htonl(u_long hostlong) +{ + if(hWinSockDll == 0) + LoadWinSock(); + + return phtonl(hostlong); +} + +u_short win32_htons(u_short hostshort) +{ + if(hWinSockDll == 0) + LoadWinSock(); + + return phtons(hostshort); +} + +u_long win32_ntohl(u_long netlong) +{ + if(hWinSockDll == 0) + LoadWinSock(); + + return pntohl(netlong); +} + +u_short win32_ntohs(u_short netshort) +{ + if(hWinSockDll == 0) + LoadWinSock(); + + return pntohs(netshort); +} + + +#define SOCKET_TEST(x, y) if(hWinSockDll == 0) StartSockets();\ + if((x) == (y)) errno = pWSAGetLastError() + +#define SOCKET_TEST_ERROR(x) SOCKET_TEST(x, SOCKET_ERROR) + +SOCKET win32_accept(SOCKET s, struct sockaddr *addr, int *addrlen) +{ + SOCKET r; + + SOCKET_TEST((r = paccept(TO_SOCKET(s), addr, addrlen)), INVALID_SOCKET); + return OPEN_SOCKET(r); +} + +int win32_bind(SOCKET s, const struct sockaddr *addr, int addrlen) +{ + int r; + + SOCKET_TEST_ERROR(r = pbind(TO_SOCKET(s), addr, addrlen)); + return r; +} + +int win32_connect(SOCKET s, const struct sockaddr *addr, int addrlen) +{ + int r; + + SOCKET_TEST_ERROR(r = pconnect(TO_SOCKET(s), addr, addrlen)); + return r; +} + + +int win32_getpeername(SOCKET s, struct sockaddr *addr, int *addrlen) +{ + int r; + + SOCKET_TEST_ERROR(r = pgetpeername(TO_SOCKET(s), addr, addrlen)); + return r; +} + +int win32_getsockname(SOCKET s, struct sockaddr *addr, int *addrlen) +{ + int r; + + SOCKET_TEST_ERROR(r = pgetsockname(TO_SOCKET(s), addr, addrlen)); + return r; +} + +int win32_getsockopt(SOCKET s, int level, int optname, char *optval, int *optlen) +{ + int r; + + SOCKET_TEST_ERROR(r = pgetsockopt(TO_SOCKET(s), level, optname, optval, optlen)); + return r; +} + +int win32_ioctlsocket(SOCKET s, long cmd, u_long *argp) +{ + int r; + + SOCKET_TEST_ERROR(r = pioctlsocket(TO_SOCKET(s), cmd, argp)); + return r; +} + +int win32_listen(SOCKET s, int backlog) +{ + int r; + + SOCKET_TEST_ERROR(r = plisten(TO_SOCKET(s), backlog)); + return r; +} + +int win32_recv(SOCKET s, char *buf, int len, int flags) +{ + int r; + + SOCKET_TEST_ERROR(r = precv(TO_SOCKET(s), buf, len, flags)); + return r; +} + +int win32_recvfrom(SOCKET s, char *buf, int len, int flags, struct sockaddr *from, int *fromlen) +{ + int r; + + SOCKET_TEST_ERROR(r = precvfrom(TO_SOCKET(s), buf, len, flags, from, fromlen)); + return r; +} + +// select contributed by Vincent R. Slyngstad (vrs@ibeam.intel.com) +int win32_select(int nfds, int* rd, int* wr, int* ex, const struct timeval* timeout) +{ + long r; + int dummy = 0; + int i, fd, bit, offset; + FD_SET nrd, nwr, nex,*prd,*pwr,*pex; + + if (!rd) rd = &dummy, prd = NULL; + else prd = &nrd; + if (!wr) wr = &dummy, pwr = NULL; + else pwr = &nwr; + if (!ex) ex = &dummy, pex = NULL; + else pex = &nex; + + FD_ZERO(&nrd); + FD_ZERO(&nwr); + FD_ZERO(&nex); + for (i = 0; i < nfds; i++) + { + fd = TO_SOCKET(i); + bit = 1L<<(i % (sizeof(int)*8)); + offset = i / (sizeof(int)*8); + if (rd[offset] & bit) + FD_SET(fd, &nrd); + if (wr[offset] & bit) + FD_SET(fd, &nwr); + if (ex[offset] & bit) + FD_SET(fd, &nex); + } + + SOCKET_TEST_ERROR(r = pselect(nfds, prd, pwr, pex, timeout)); + + for (i = 0; i < nfds; i++) + { + fd = TO_SOCKET(i); + bit = 1L<<(i % (sizeof(int)*8)); + offset = i / (sizeof(int)*8); + if (rd[offset] & bit) + { + if (!pWSAFDIsSet(fd, &nrd)) + rd[offset] &= ~bit; + } + if (wr[offset] & bit) + { + if (!pWSAFDIsSet(fd, &nwr)) + wr[offset] &= ~bit; + } + if (ex[offset] & bit) + { + if (!pWSAFDIsSet(fd, &nex)) + ex[offset] &= ~bit; + } + } + return r; +} + +int win32_send(SOCKET s, const char *buf, int len, int flags) +{ + int r; + + SOCKET_TEST_ERROR(r = psend(TO_SOCKET(s), buf, len, flags)); + return r; +} + +int win32_sendto(SOCKET s, const char *buf, int len, int flags, const struct sockaddr *to, int tolen) +{ + int r; + + SOCKET_TEST_ERROR(r = psendto(TO_SOCKET(s), buf, len, flags, to, tolen)); + return r; +} + +int win32_setsockopt(SOCKET s, int level, int optname, const char *optval, int optlen) +{ + int r; + + SOCKET_TEST_ERROR(r = psetsockopt(TO_SOCKET(s), level, optname, optval, optlen)); + return r; +} + +int win32_shutdown(SOCKET s, int how) +{ + int r; + + SOCKET_TEST_ERROR(r = pshutdown(TO_SOCKET(s), how)); + return r; +} + +SOCKET win32_socket(int af, int type, int protocol) +{ + SOCKET s; + +#ifndef USE_SOCKETS_AS_HANDLES + SOCKET_TEST(s = psocket(af, type, protocol), INVALID_SOCKET); +#else + if(hWinSockDll == 0) + StartSockets(); + + if((s = psocket(af, type, protocol)) == INVALID_SOCKET) + errno = pWSAGetLastError(); + else + s = OPEN_SOCKET(s); +#endif // USE_SOCKETS_AS_HANDLES + + return s; +} + +struct hostent *win32_gethostbyaddr(const char *addr, int len, int type) +{ + struct hostent *r; + + SOCKET_TEST(r = pgethostbyaddr(addr, len, type), NULL); + return r; +} + +struct hostent *win32_gethostbyname(const char *name) +{ + struct hostent *r; + + SOCKET_TEST(r = pgethostbyname(name), NULL); + return r; +} + +int win32_gethostname(char *name, int len) +{ + int r; + + SOCKET_TEST_ERROR(r = pgethostname(name, len)); + return r; +} + +struct protoent *win32_getprotobyname(const char *name) +{ + struct protoent *r; + + SOCKET_TEST(r = pgetprotobyname(name), NULL); + return r; +} + +struct protoent *win32_getprotobynumber(int num) +{ + struct protoent *r; + + SOCKET_TEST(r = pgetprotobynumber(num), NULL); + return r; +} + +struct servent *win32_getservbyname(const char *name, const char *proto) +{ + struct servent *r; + + SOCKET_TEST(r = pgetservbyname(name, proto), NULL); + if (r) { + r = win32_savecopyservent(&myservent, r, proto); + } + return r; +} + +struct servent *win32_getservbyport(int port, const char *proto) +{ + struct servent *r; + + SOCKET_TEST(r = pgetservbyport(port, proto), NULL); + if (r) { + r = win32_savecopyservent(&myservent, r, proto); + } + return r; +} + +char FAR *win32_inet_ntoa(struct in_addr in) +{ + if(hWinSockDll == 0) LoadWinSock(); + + return pinet_ntoa(in); +} + +unsigned long win32_inet_addr(const char FAR *cp) +{ + if(hWinSockDll == 0) LoadWinSock(); + + return pinet_addr(cp); + +} +// +// Networking stubs +// +#undef CROAK +#define CROAK croak + +void win32_endhostent() +{ + CROAK("endhostent not implemented!\n"); +} + +void win32_endnetent() +{ + CROAK("endnetent not implemented!\n"); +} + +void win32_endprotoent() +{ + CROAK("endprotoent not implemented!\n"); +} + +void win32_endservent() +{ + CROAK("endservent not implemented!\n"); +} + + +struct netent *win32_getnetent(void) +{ + CROAK("getnetent not implemented!\n"); + return (struct netent *) NULL; +} + +struct netent *win32_getnetbyname(char *name) +{ + CROAK("getnetbyname not implemented!\n"); + return (struct netent *)NULL; +} + +struct netent *win32_getnetbyaddr(long net, int type) +{ + CROAK("getnetbyaddr not implemented!\n"); + return (struct netent *)NULL; +} + +struct protoent *win32_getprotoent(void) +{ + CROAK("getprotoent not implemented!\n"); + return (struct protoent *) NULL; +} + +struct servent *win32_getservent(void) +{ + CROAK("getservent not implemented!\n"); + return (struct servent *) NULL; +} + +void win32_sethostent(int stayopen) +{ + CROAK("sethostent not implemented!\n"); +} + + +void win32_setnetent(int stayopen) +{ + CROAK("setnetent not implemented!\n"); +} + + +void win32_setprotoent(int stayopen) +{ + CROAK("setprotoent not implemented!\n"); +} + + +void win32_setservent(int stayopen) +{ + CROAK("setservent not implemented!\n"); +} + + |