diff options
author | Gurusamy Sarathy <gsar@cpan.org> | 1999-06-27 14:28:49 +0000 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 1999-06-27 14:28:49 +0000 |
commit | 0cb9638729211ea71a75ae8756c03ba21553bd53 (patch) | |
tree | f00e767824d620a63a26a857b6a37fcb6945f89d /win32 | |
parent | 4f4e629e089f1120f8e94984281df06ac4f885c5 (diff) | |
download | perl-0cb9638729211ea71a75ae8756c03ba21553bd53.tar.gz |
somewhat untested PERL_OBJECT cleanups (C++isms mostly
gone from the public API); PERL_OBJECT builds again on
windows
TODO: namespace-clean the typedefs in iperlsys.h and
elsewhere; remove C++ remnants from public headers
p4raw-id: //depot/perl@3553
Diffstat (limited to 'win32')
-rw-r--r-- | win32/GenCAPI.pl | 165 | ||||
-rw-r--r-- | win32/Makefile | 55 | ||||
-rw-r--r-- | win32/config.bc | 20 | ||||
-rw-r--r-- | win32/config.gc | 20 | ||||
-rw-r--r-- | win32/config.vc | 20 | ||||
-rw-r--r-- | win32/dl_win32.xs | 29 | ||||
-rw-r--r-- | win32/makedef.pl | 10 | ||||
-rw-r--r-- | win32/makefile.mk | 16 | ||||
-rw-r--r-- | win32/perllib.c | 1486 | ||||
-rw-r--r-- | win32/runperl.c | 78 | ||||
-rw-r--r-- | win32/win32.c | 139 | ||||
-rw-r--r-- | win32/win32.h | 27 | ||||
-rw-r--r-- | win32/win32iop.h | 3 | ||||
-rw-r--r-- | win32/win32sck.c | 16 |
14 files changed, 1818 insertions, 266 deletions
diff --git a/win32/GenCAPI.pl b/win32/GenCAPI.pl index 63688af163..3cd581de72 100644 --- a/win32/GenCAPI.pl +++ b/win32/GenCAPI.pl @@ -23,7 +23,7 @@ sub readsyms(\%@) { s/[ \t]*#.*$//; # delete comments if (/^\s*(\S+)\s*$/) { my $sym = $1; - $$syms{$sym} = "Perl_$sym"; + $$syms{$sym} = $sym; } } close(FILE); @@ -40,41 +40,66 @@ sub skip_these { } skip_these [qw( -yylex -cando -cast_ulong -my_chsize -condpair_magic -deb -deb_growlevel -debprofdump -debop -debstack -debstackptrs -dump_fds -dump_mstats +Perl_yylex +Perl_cando +Perl_cast_ulong +Perl_my_chsize +Perl_condpair_magic +Perl_deb +Perl_deb_growlevel +Perl_debprofdump +Perl_debop +Perl_debstack +Perl_debstackptrs +Perl_dump_fds +Perl_dump_mstats fprintf -find_threadsv -magic_mutexfree -my_memcmp -my_memset -my_pclose -my_popen -my_swap -my_htonl -my_ntohl -new_struct_thread -same_dirent -unlnk -unlock_condpair -safexmalloc -safexcalloc -safexrealloc -safexfree +Perl_find_threadsv +Perl_magic_mutexfree +Perl_my_memcmp +Perl_my_memset +Perl_my_pclose +Perl_my_popen +Perl_my_swap +Perl_my_htonl +Perl_my_ntohl +Perl_new_struct_thread +Perl_same_dirent +Perl_unlnk +Perl_unlock_condpair +Perl_safexmalloc +Perl_safexcalloc +Perl_safexrealloc +Perl_safexfree Perl_GetVars -malloced_size -do_exec3 -getenv_len +Perl_malloced_size +Perl_do_exec3 +Perl_getenv_len +Perl_dump_indent +Perl_default_protect +Perl_croak_nocontext +Perl_die_nocontext +Perl_form_nocontext +Perl_warn_nocontext +Perl_newSVpvf_nocontext +Perl_sv_catpvf_nocontext +Perl_sv_catpvf_mg_nocontext +Perl_sv_setpvf_nocontext +Perl_sv_setpvf_mg_nocontext +Perl_do_ipcctl +Perl_do_ipcget +Perl_do_msgrcv +Perl_do_msgsnd +Perl_do_semop +Perl_do_shmio +Perl_my_bzero +perl_parse +perl_alloc +Perl_call_atexit +Perl_malloc +Perl_calloc +Perl_realloc +Perl_mfree )]; @@ -94,8 +119,15 @@ print OUTFILE <<ENDCODE; #include "perl.h" #include "XSUB.h" -#define DESTRUCTORFUNC (void (*)(void*)) - +/*#define DESTRUCTORFUNC (void (*)(void*))*/ + +#undef Perl_sv_2mortal +#undef Perl_newSVsv +#undef Perl_mess +#undef Perl_sv_2pv +#undef Perl_sv_vcatpvfn +#undef Perl_sv_vsetpvfn +#undef Perl_newSV ENDCODE print OUTFILE "#ifdef SetCPerlObj_defined\n" unless ($separateObj == 0); @@ -110,17 +142,18 @@ ENDCODE print OUTFILE "#endif\n" unless ($separateObj == 0); +my %done; + while () { last unless defined ($_ = <INFILE>); - if (/^VIRTUAL\s/) { + if (/^VIRTUAL\s+/) { while (!/;$/) { chomp; $_ .= <INFILE>; } $_ =~ s/^VIRTUAL\s*//; $_ =~ s/\s*__attribute__.*$/;/; - if ( /(.*)\s([A-z_]*[0-9A-z_]+\s)\((.*)\);/ || - /(.*)\*([A-z_]*[0-9A-z_]+\s)\((.*)\);/ ) { + if ( /^(.+)\t(\w+)\((.*)\);/ ) { $type = $1; $name = $2; $args = $3; @@ -128,10 +161,14 @@ while () { $name =~ s/\s*$//; $type =~ s/\s*$//; next if (defined $skip_list{$name}); + next if $name =~ /^S_/; + next if exists $done{$name}; - if($args eq "ARGSproto") { + $done{$name}++; + if($args eq "ARGSproto" or $args eq "pTHX") { $args = "void"; } + $args =~ s/^pTHX_ //; $return = ($type eq "void" or $type eq "Free_t") ? "\t" : "\treturn"; @@ -143,9 +180,7 @@ while () { @args = split(',', $args); if ($args[$#args] =~ /\s*\.\.\.\s*/) { - if(($name eq "croak") or ($name eq "deb") or ($name eq "die") - or ($name eq "form") or ($name eq "warn") - or ($name eq "warner")) { + if ($name =~ /^Perl_(croak|deb|die|warn|form|warner)$/) { print OUTFILE "\n#ifdef $name" . "_defined" unless ($separateObj == 0); for (@args) { $_ = $1 if /(\w+)\W*$/; } $arg = $args[$#args-1]; @@ -161,13 +196,13 @@ extern "C" $type $funcName ($args) va_list args; va_start(args, $arg); pmsg = pPerl->Perl_sv_2mortal(pPerl->Perl_newSVsv(pPerl->Perl_mess($arg, &args))); -$return pPerl->Perl_$name($start SvPV_nolen(pmsg)); +$return pPerl->$name($start SvPV_nolen(pmsg)); va_end(args); } ENDCODE print OUTFILE "#endif\n" unless ($separateObj == 0); } - elsif($name eq "newSVpvf") { + elsif($name =~ /^Perl_newSVpvf/) { print OUTFILE "\n#ifdef $name" . "_defined" unless ($separateObj == 0); $args[0] =~ /(\w+)\W*$/; $arg = $1; @@ -187,7 +222,7 @@ extern "C" $type $funcName ($args) ENDCODE print OUTFILE "#endif\n" unless ($separateObj == 0); } - elsif($name eq "sv_catpvf") { + elsif($name =~ /^Perl_sv_catpvf/) { print OUTFILE "\n#ifdef $name" . "_defined" unless ($separateObj == 0); $args[0] =~ /(\w+)\W*$/; $arg0 = $1; @@ -206,7 +241,7 @@ extern "C" $type $funcName ($args) ENDCODE print OUTFILE "#endif\n" unless ($separateObj == 0); } - elsif($name eq "sv_catpvf_mg") { + elsif($name =~ /^Perl_sv_catpvf_mg/) { print OUTFILE "\n#ifdef $name" . "_defined" unless ($separateObj == 0); $args[0] =~ /(\w+)\W*$/; $arg0 = $1; @@ -229,7 +264,7 @@ extern "C" $type $funcName ($args) ENDCODE print OUTFILE "#endif\n" unless ($separateObj == 0); } - elsif($name eq "sv_setpvf") { + elsif($name =~ /^Perl_sv_setpvf/) { print OUTFILE "\n#ifdef $name" . "_defined" unless ($separateObj == 0); $args[0] =~ /(\w+)\W*$/; $arg0 = $1; @@ -248,7 +283,7 @@ extern "C" $type $funcName ($args) ENDCODE print OUTFILE "#endif\n" unless ($separateObj == 0); } - elsif($name eq "sv_setpvf_mg") { + elsif($name =~ /^Perl_sv_setpvf_mg/) { print OUTFILE "\n#ifdef $name" . "_defined" unless ($separateObj == 0); $args[0] =~ /(\w+)\W*$/; $arg0 = $1; @@ -298,26 +333,26 @@ ENDCODE } # newXS special case - if ($name eq "newXS") { + if ($name eq "Perl_newXS") { next; } print OUTFILE "\n#ifdef $name" . "defined" unless ($separateObj == 0); # handle specical case for save_destructor - if ($name eq "save_destructor") { + if ($name eq "Perl_save_destructor") { next; } # handle specical case for sighandler - if ($name eq "sighandler") { + if ($name eq "Perl_sighandler") { next; } # handle special case for sv_grow - if ($name eq "sv_grow" and $args eq "SV* sv, unsigned long newlen") { + if ($name eq "Perl_sv_grow" and $args eq "SV* sv, unsigned long newlen") { next; } # handle special case for newSV - if ($name eq "newSV" and $args eq "I32 x, STRLEN len") { + if ($name eq "Perl_newSV" and $args eq "I32 x, STRLEN len") { next; } # handle special case for perl_parse @@ -334,13 +369,13 @@ ENDCODE next; } # handle special case for perl_atexit - if ($name eq "perl_atexit") { + if ($name eq "Perl_call_atexit") { print OUTFILE <<ENDCODE; #undef $name extern "C" $type $name ($args) { - pPerl->perl_atexit(fn, ptr); + pPerl->perl_call_atexit(fn, ptr); } ENDCODE print OUTFILE "#endif\n" unless ($separateObj == 0); @@ -348,7 +383,7 @@ ENDCODE } - if($name eq "byterun" and $args eq "struct bytestream bs") { + if($name eq "Perl_byterun" and $args eq "struct bytestream bs") { next; } @@ -607,7 +642,7 @@ void boot_CAPI_handler(CV *cv, void (*subaddr)(CV *c), void *pP) subaddr(cv); } -void xs_handler(CV* cv, CPerlObj* p) +void xs_handler(CPerlObj* p, CV* cv) { void(*func)(CV*); SV* sv; @@ -627,6 +662,7 @@ void xs_handler(CV* cv, CPerlObj* p) } } +#undef Perl_newXS CV* Perl_newXS(char* name, void (*subaddr)(CV* cv), char* filename) { CV* cv = pPerl->Perl_newXS(name, xs_handler, filename); @@ -634,7 +670,7 @@ CV* Perl_newXS(char* name, void (*subaddr)(CV* cv), char* filename) return cv; } - +#undef Perl_deb void Perl_deb(const char pat, ...) { } @@ -1003,6 +1039,11 @@ int _win32_uname(struct utsname *name) return pPerl->PL_piENV->Uname(name, ErrorNo()); } +unsigned long _win32_os_id(void) +{ + return pPerl->PL_piENV->OsID(); +} + char* _win32_getenv(const char *name) { return pPerl->PL_piENV->Getenv(name, ErrorNo()); @@ -1330,6 +1371,8 @@ U32 * _Perl_opargs (); #undef win32_stat #undef win32_ioctl #undef win32_utime +#undef win32_uname +#undef win32_os_id #undef win32_getenv #undef win32_htonl @@ -1447,6 +1490,8 @@ U32 * _Perl_opargs (); #define win32_stat _win32_stat #define win32_ioctl _win32_ioctl #define win32_utime _win32_utime +#define win32_uname _win32_uname +#define win32_os_id _win32_os_id #define win32_getenv _win32_getenv #define win32_open_osfhandle _win32_open_osfhandle #define win32_get_osfhandle _win32_get_osfhandle @@ -1566,6 +1611,8 @@ int _win32_times(struct tms *timebuf); int _win32_stat(const char *path, struct stat *buf); int _win32_ioctl(int i, unsigned int u, char *data); int _win32_utime(const char *f, struct utimbuf *t); +int _win32_uname(struct utsname *n); +unsigned long _win32_os_id(void); char* _win32_getenv(const char *name); int _win32_open_osfhandle(long handle, int flags); long _win32_get_osfhandle(int fd); diff --git a/win32/Makefile b/win32/Makefile index 42b8a9deee..51f80c1599 100644 --- a/win32/Makefile +++ b/win32/Makefile @@ -32,6 +32,17 @@ INST_TOP = $(INST_DRV)\perl INST_VER = \5.00557 # +# Comment this out if you DON'T want your perl installation to have +# architecture specific components. This means that architecture- +# specific files will be installed along with the architecture-neutral +# files. Leaving it enabled is safer and more flexible, in case you +# want to build multiple flavors of perl and install them together in +# the same location. Commenting it out gives you a simpler +# installation that is easier to understand for beginners. +# +#INST_ARCH = \$(ARCHNAME) + +# # uncomment to enable threads-capabilities # #USE_THREADS = define @@ -124,6 +135,7 @@ CCLIBDIR = $(CCHOME)\lib # instead of clinging to shortcuts like this one. # #BUILDOPT = -DPERL_POLLUTE +#BUILDOPT = -DPERL_IMPLICIT_CONTEXT # # specify semicolon-separated list of extra directories that modules will @@ -196,7 +208,6 @@ CFG = Optimize !ENDIF !ENDIF -ARCHDIR = ..\lib\$(ARCHNAME) COREDIR = ..\lib\CORE AUTODIR = ..\lib\auto @@ -299,7 +310,7 @@ $(o).dll: -out:$@ $(LINK_FLAGS) $(LIBFILES) $< $(LIBPERL) # -INST_BIN = $(INST_TOP)$(INST_VER)\bin\$(ARCHNAME) +INST_BIN = $(INST_TOP)$(INST_VER)\bin$(INST_ARCH) INST_SCRIPT = $(INST_TOP)$(INST_VER)\bin INST_LIB = $(INST_TOP)$(INST_VER)\lib INST_POD = $(INST_LIB)\pod @@ -314,7 +325,7 @@ EXTUTILSDIR = $(LIBDIR)\extutils !IF "$(OBJECT)" == "-DPERL_OBJECT" PERLIMPLIB = ..\perlcore.lib PERLDLL = ..\perlcore.dll -CAPILIB = $(COREDIR)\perlCAPI.lib +#CAPILIB = $(COREDIR)\perlCAPI.lib !ELSE PERLIMPLIB = ..\perl.lib PERLDLL = ..\perl.dll @@ -405,6 +416,8 @@ MICROCORE_SRC = \ ..\utf8.c \ ..\util.c +EXTRACORE_SRC = $(EXTRACORE_SRC) perllib.c + !IF "$(PERL_MALLOC)" == "define" EXTRACORE_SRC = $(EXTRACORE_SRC) ..\malloc.c !ENDIF @@ -437,9 +450,9 @@ PERL95_SRC = $(PERL95_SRC) .\$(CRYPT_SRC) DLL_SRC = $(DYNALOADER).c -!IF "$(OBJECT)" == "" -DLL_SRC = $(DLL_SRC) perllib.c -!ENDIF +#!IF "$(OBJECT)" == "" +#DLL_SRC = $(DLL_SRC) perllib.c +#!ENDIF X2P_SRC = \ ..\x2p\a2p.c \ @@ -504,12 +517,9 @@ X2P_OBJ = $(X2P_SRC:.c=.obj) PERLDLL_OBJ = $(CORE_OBJ) PERLEXE_OBJ = perlmain$(o) -!IF "$(OBJECT)" == "" PERLDLL_OBJ = $(PERLDLL_OBJ) $(WIN32_OBJ) $(DLL_OBJ) -!ELSE -PERLEXE_OBJ = $(PERLEXE_OBJ) $(WIN32_OBJ) $(DLL_OBJ) -PERL95_OBJ = $(PERL95_OBJ) DynaLoadmt$(o) -!ENDIF +#PERLEXE_OBJ = $(PERLEXE_OBJ) $(WIN32_OBJ) $(DLL_OBJ) +#PERL95_OBJ = $(PERL95_OBJ) DynaLoadmt$(o) !IF "$(USE_SETARGV)" != "" SETARGV_OBJ = setargv$(o) @@ -599,6 +609,7 @@ CFG_VARS = \ "INST_DRV=$(INST_DRV)" \ "INST_TOP=$(INST_TOP)" \ "INST_VER=$(INST_VER)" \ + "INST_ARCH=$(INST_ARCH)" \ "archname=$(ARCHNAME)" \ "cc=$(CC)" \ "ccflags=$(OPTIMIZE:"=\") $(DEFINES) $(OBJECT)" \ @@ -781,17 +792,17 @@ $(DYNALOADER).c: $(MINIPERL) $(EXTDIR)\DynaLoader\dl_win32.xs $(CONFIGPM) $(XSUBPP) dl_win32.xs > $(*B).c cd ..\..\win32 -!IF "$(OBJECT)" == "-DPERL_OBJECT" -perlCAPI.cpp : $(MINIPERL) - $(MINIPERL) GenCAPI.pl $(COREDIR) - -perlCAPI$(o) : perlCAPI.cpp - $(CC) $(CFLAGS_O) $(RUNTIME) -UPERLDLL -c \ - $(OBJOUT_FLAG)perlCAPI$(o) perlCAPI.cpp - -$(CAPILIB) : perlCAPI.cpp perlCAPI$(o) - lib /OUT:$(CAPILIB) perlCAPI$(o) -!ENDIF +#!IF "$(OBJECT)" == "-DPERL_OBJECT" +#perlCAPI.cpp : $(MINIPERL) +# $(MINIPERL) GenCAPI.pl $(COREDIR) +# +#perlCAPI$(o) : perlCAPI.cpp +# $(CC) $(CFLAGS_O) $(RUNTIME) -UPERLDLL -c \ +# $(OBJOUT_FLAG)perlCAPI$(o) perlCAPI.cpp +# +#$(CAPILIB) : perlCAPI.cpp perlCAPI$(o) +# lib /OUT:$(CAPILIB) perlCAPI$(o) +#!ENDIF $(EXTDIR)\DynaLoader\dl_win32.xs: dl_win32.xs copy dl_win32.xs $(EXTDIR)\DynaLoader\dl_win32.xs diff --git a/win32/config.bc b/win32/config.bc index 515501543c..e6197dd29e 100644 --- a/win32/config.bc +++ b/win32/config.bc @@ -25,16 +25,16 @@ ansi2knr='' aphostname='' apiversion='5.005' ar='tlib /P128' -archlib='~INST_TOP~~INST_VER~\lib\~archname~' -archlibexp='~INST_TOP~~INST_VER~\lib\~archname~' +archlib='~INST_TOP~~INST_VER~\lib~INST_ARCH~' +archlibexp='~INST_TOP~~INST_VER~\lib~INST_ARCH~' archname64='' archname='MSWin32' archobjs='' awk='awk' baserev='5.0' bash='' -bin='~INST_TOP~~INST_VER~\bin\~archname~' -binexp='~INST_TOP~~INST_VER~\bin\~archname~' +bin='~INST_TOP~~INST_VER~\bin~INST_ARCH~' +binexp='~INST_TOP~~INST_VER~\bin~INST_ARCH~' bison='' byacc='byacc' byteorder='1234' @@ -460,15 +460,15 @@ i_vfork='undef' ignore_versioned_solibs='' incpath='' inews='' -installarchlib='~INST_TOP~~INST_VER~\lib\~archname~' -installbin='~INST_TOP~~INST_VER~\bin\~archname~' +installarchlib='~INST_TOP~~INST_VER~\lib~INST_ARCH~' +installbin='~INST_TOP~~INST_VER~\bin~INST_ARCH~' installman1dir='~INST_TOP~~INST_VER~\man\man1' installman3dir='~INST_TOP~~INST_VER~\man\man3' installhtmldir='~INST_TOP~~INST_VER~\html' installhtmlhelpdir='~INST_TOP~~INST_VER~\htmlhelp' installprivlib='~INST_TOP~~INST_VER~\lib' installscript='~INST_TOP~~INST_VER~\bin' -installsitearch='~INST_TOP~\site~INST_VER~\lib\~archname~' +installsitearch='~INST_TOP~\site~INST_VER~\lib~INST_ARCH~' installsitelib='~INST_TOP~\site~INST_VER~\lib' installusrbinperl='undef' intsize='4' @@ -551,7 +551,7 @@ patchlevel='~PATCHLEVEL~' path_sep=';' perl='perl' perladmin='' -perlpath='~INST_TOP~~INST_VER~\bin\~archname~\perl.exe' +perlpath='~INST_TOP~~INST_VER~\bin~INST_ARCH~\perl.exe' pg='' phostname='hostname' pidtype='int' @@ -592,8 +592,8 @@ sig_name_init='"ZERO", "NUM01", "INT", "QUIT", "ILL", "NUM05", "NUM06", "NUM07", 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 18 0' sig_num_init='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, 18, 0' signal_t='void' -sitearch='~INST_TOP~\site~INST_VER~\lib\~archname~' -sitearchexp='~INST_TOP~\site~INST_VER~\lib\~archname~' +sitearch='~INST_TOP~\site~INST_VER~\lib~INST_ARCH~' +sitearchexp='~INST_TOP~\site~INST_VER~\lib~INST_ARCH~' sitelib='~INST_TOP~\site~INST_VER~\lib' sitelibexp='~INST_TOP~\site~INST_VER~\lib' sizetype='size_t' diff --git a/win32/config.gc b/win32/config.gc index 7d65b56612..b4495d7182 100644 --- a/win32/config.gc +++ b/win32/config.gc @@ -25,16 +25,16 @@ ansi2knr='' aphostname='' apiversion='5.005' ar='ar' -archlib='~INST_TOP~~INST_VER~\lib\~archname~' -archlibexp='~INST_TOP~~INST_VER~\lib\~archname~' +archlib='~INST_TOP~~INST_VER~\lib~INST_ARCH~' +archlibexp='~INST_TOP~~INST_VER~\lib~INST_ARCH~' archname64='' archname='MSWin32' archobjs='' awk='awk' baserev='5.0' bash='' -bin='~INST_TOP~~INST_VER~\bin\~archname~' -binexp='~INST_TOP~~INST_VER~\bin\~archname~' +bin='~INST_TOP~~INST_VER~\bin~INST_ARCH~' +binexp='~INST_TOP~~INST_VER~\bin~INST_ARCH~' bison='' byacc='byacc' byteorder='1234' @@ -460,15 +460,15 @@ i_vfork='undef' ignore_versioned_solibs='' incpath='' inews='' -installarchlib='~INST_TOP~~INST_VER~\lib\~archname~' -installbin='~INST_TOP~~INST_VER~\bin\~archname~' +installarchlib='~INST_TOP~~INST_VER~\lib~INST_ARCH~' +installbin='~INST_TOP~~INST_VER~\bin~INST_ARCH~' installman1dir='~INST_TOP~~INST_VER~\man\man1' installman3dir='~INST_TOP~~INST_VER~\man\man3' installhtmldir='~INST_TOP~~INST_VER~\html' installhtmlhelpdir='~INST_TOP~~INST_VER~\htmlhelp' installprivlib='~INST_TOP~~INST_VER~\lib' installscript='~INST_TOP~~INST_VER~\bin' -installsitearch='~INST_TOP~\site~INST_VER~\lib\~archname~' +installsitearch='~INST_TOP~\site~INST_VER~\lib~INST_ARCH~' installsitelib='~INST_TOP~\site~INST_VER~\lib' installusrbinperl='undef' intsize='4' @@ -551,7 +551,7 @@ patchlevel='~PATCHLEVEL~' path_sep=';' perl='perl' perladmin='' -perlpath='~INST_TOP~~INST_VER~\bin\~archname~\perl.exe' +perlpath='~INST_TOP~~INST_VER~\bin~INST_ARCH~\perl.exe' pg='' phostname='hostname' pidtype='int' @@ -592,8 +592,8 @@ sig_name_init='"ZERO", "NUM01", "INT", "QUIT", "ILL", "NUM05", "NUM06", "NUM07", 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 20 0' sig_num_init='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, 20, 0' signal_t='void' -sitearch='~INST_TOP~\site~INST_VER~\lib\~archname~' -sitearchexp='~INST_TOP~\site~INST_VER~\lib\~archname~' +sitearch='~INST_TOP~\site~INST_VER~\lib~INST_ARCH~' +sitearchexp='~INST_TOP~\site~INST_VER~\lib~INST_ARCH~' sitelib='~INST_TOP~\site~INST_VER~\lib' sitelibexp='~INST_TOP~\site~INST_VER~\lib' sizetype='size_t' diff --git a/win32/config.vc b/win32/config.vc index 1b44425797..73f1687911 100644 --- a/win32/config.vc +++ b/win32/config.vc @@ -25,16 +25,16 @@ ansi2knr='' aphostname='' apiversion='5.005' ar='lib' -archlib='~INST_TOP~~INST_VER~\lib\~archname~' -archlibexp='~INST_TOP~~INST_VER~\lib\~archname~' +archlib='~INST_TOP~~INST_VER~\lib~INST_ARCH~' +archlibexp='~INST_TOP~~INST_VER~\lib~INST_ARCH~' archname64='' archname='MSWin32' archobjs='' awk='awk' baserev='5.0' bash='' -bin='~INST_TOP~~INST_VER~\bin\~archname~' -binexp='~INST_TOP~~INST_VER~\bin\~archname~' +bin='~INST_TOP~~INST_VER~\bin~INST_ARCH~' +binexp='~INST_TOP~~INST_VER~\bin~INST_ARCH~' bison='' byacc='byacc' byteorder='1234' @@ -460,15 +460,15 @@ i_vfork='undef' ignore_versioned_solibs='' incpath='' inews='' -installarchlib='~INST_TOP~~INST_VER~\lib\~archname~' -installbin='~INST_TOP~~INST_VER~\bin\~archname~' +installarchlib='~INST_TOP~~INST_VER~\lib~INST_ARCH~' +installbin='~INST_TOP~~INST_VER~\bin~INST_ARCH~' installman1dir='~INST_TOP~~INST_VER~\man\man1' installman3dir='~INST_TOP~~INST_VER~\man\man3' installhtmldir='~INST_TOP~~INST_VER~\html' installhtmlhelpdir='~INST_TOP~~INST_VER~\htmlhelp' installprivlib='~INST_TOP~~INST_VER~\lib' installscript='~INST_TOP~~INST_VER~\bin' -installsitearch='~INST_TOP~\site~INST_VER~\lib\~archname~' +installsitearch='~INST_TOP~\site~INST_VER~\lib~INST_ARCH~' installsitelib='~INST_TOP~\site~INST_VER~\lib' installusrbinperl='undef' intsize='4' @@ -551,7 +551,7 @@ patchlevel='~PATCHLEVEL~' path_sep=';' perl='perl' perladmin='' -perlpath='~INST_TOP~~INST_VER~\bin\~archname~\perl.exe' +perlpath='~INST_TOP~~INST_VER~\bin~INST_ARCH~\perl.exe' pg='' phostname='hostname' pidtype='int' @@ -592,8 +592,8 @@ sig_name_init='"ZERO", "NUM01", "INT", "QUIT", "ILL", "NUM05", "NUM06", "NUM07", 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 20 0' sig_num_init='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, 20, 0' signal_t='void' -sitearch='~INST_TOP~\site~INST_VER~\lib\~archname~' -sitearchexp='~INST_TOP~\site~INST_VER~\lib\~archname~' +sitearch='~INST_TOP~\site~INST_VER~\lib~INST_ARCH~' +sitearchexp='~INST_TOP~\site~INST_VER~\lib~INST_ARCH~' sitelib='~INST_TOP~\site~INST_VER~\lib' sitelibexp='~INST_TOP~\site~INST_VER~\lib' sizetype='size_t' diff --git a/win32/dl_win32.xs b/win32/dl_win32.xs index 5c6f627437..3e7fdd4714 100644 --- a/win32/dl_win32.xs +++ b/win32/dl_win32.xs @@ -37,22 +37,22 @@ calls. static SV *error_sv; static char * -OS_Error_String(pTHX) +OS_Error_String(pTHXo) { DWORD err = GetLastError(); STRLEN len; if (!error_sv) error_sv = newSVpvn("",0); - win32_str_os_error(aTHX_ error_sv,err); + PerlProc_GetOSError(error_sv,err); return SvPV(error_sv,len); } #include "dlutils.c" /* SaveError() etc */ static void -dl_private_init(pTHX) +dl_private_init(pTHXo) { - (void)dl_generic_private_init(aTHX); + (void)dl_generic_private_init(aTHXo); } /* @@ -94,7 +94,7 @@ dl_static_linked(char *filename) MODULE = DynaLoader PACKAGE = DynaLoader BOOT: - (void)dl_private_init(aTHX); + (void)dl_private_init(aTHXo); void * dl_load_file(filename,flags=0) @@ -103,24 +103,17 @@ dl_load_file(filename,flags=0) PREINIT: CODE: { - WCHAR wfilename[MAX_PATH]; DLDEBUG(1,PerlIO_printf(PerlIO_stderr(),"dl_load_file(%s):\n", filename)); if (dl_static_linked(filename) == 0) { - if (USING_WIDE()) { - A2WHELPER(filename, wfilename, sizeof(wfilename), GETINTERPMODE()); - RETVAL = (void*) LoadLibraryExW(wfilename, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); - } - else { - RETVAL = (void*) LoadLibraryExA(filename, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); - } + RETVAL = PerlProc_DynaLoad(filename); } else RETVAL = (void*) GetModuleHandle(NULL); DLDEBUG(2,PerlIO_printf(PerlIO_stderr()," libref=%x\n", RETVAL)); ST(0) = sv_newmortal() ; if (RETVAL == NULL) - SaveError(aTHX_ "load_file:%s", - OS_Error_String(aTHX)) ; + SaveError(aTHXo_ "load_file:%s", + OS_Error_String(aTHXo)) ; else sv_setiv( ST(0), (IV)RETVAL); } @@ -136,8 +129,8 @@ dl_find_symbol(libhandle, symbolname) DLDEBUG(2,PerlIO_printf(PerlIO_stderr()," symbolref = %x\n", RETVAL)); ST(0) = sv_newmortal() ; if (RETVAL == NULL) - SaveError(aTHX_ "find_symbol:%s", - OS_Error_String(aTHX)) ; + SaveError(aTHXo_ "find_symbol:%s", + OS_Error_String(aTHXo)) ; else sv_setiv( ST(0), (IV)RETVAL); @@ -159,7 +152,7 @@ dl_install_xsub(perl_name, symref, filename="$Package") DLDEBUG(2,PerlIO_printf(PerlIO_stderr(),"dl_install_xsub(name=%s, symref=%x)\n", perl_name, symref)); ST(0) = sv_2mortal(newRV((SV*)newXS(perl_name, - (void(*)(pTHX_ CV *))symref, + (void(*)(pTHXo_ CV *))symref, filename))); diff --git a/win32/makedef.pl b/win32/makedef.pl index 2071220e20..f95d3747ed 100644 --- a/win32/makedef.pl +++ b/win32/makedef.pl @@ -29,6 +29,15 @@ if ($define{PERL_OBJECT}) { print "DESCRIPTION 'Perl interpreter'\n"; print "EXPORTS\n"; output_symbol("perl_alloc"); + output_symbol("perl_get_host_info"); + output_symbol("perl_alloc_using"); + output_symbol("perl_construct"); + output_symbol("perl_destruct"); + output_symbol("perl_free"); + output_symbol("perl_parse"); + output_symbol("perl_run"); + output_symbol("RunPerl"); + output_symbol("GetPerlInterpreter"); exit(0); } @@ -467,6 +476,7 @@ win32_seekdir win32_rewinddir win32_closedir win32_longpath +win32_os_id Perl_win32_init Perl_init_os_extras Perl_getTHR diff --git a/win32/makefile.mk b/win32/makefile.mk index 7a97dab387..22b1d0a2be 100644 --- a/win32/makefile.mk +++ b/win32/makefile.mk @@ -36,6 +36,17 @@ INST_TOP *= $(INST_DRV)\perl INST_VER *= \5.00557 # +# Comment this out if you DON'T want your perl installation to have +# architecture specific components. This means that architecture- +# specific files will be installed along with the architecture-neutral +# files. Leaving it enabled is safer and more flexible, in case you +# want to build multiple flavors of perl and install them together in +# the same location. Commenting it out gives you a simpler +# installation that is easier to understand for beginners. +# +INST_ARCH *= \$(ARCHNAME) + +# # uncomment to enable threads-capabilities # #USE_THREADS *= define @@ -139,6 +150,7 @@ CCLIBDIR *= $(CCHOME)\lib # instead of clinging to shortcuts like this one. # #BUILDOPT *= -DPERL_POLLUTE +#BUILDOPT *= -DPERL_IMPLICIT_CONTEXT # # specify semicolon-separated list of extra directories that modules will @@ -206,7 +218,6 @@ DELAYLOAD *= -DELAYLOAD:wsock32.dll delayimp.lib CFG *= Optimize .ENDIF -ARCHDIR = ..\lib\$(ARCHNAME) COREDIR = ..\lib\CORE AUTODIR = ..\lib\auto @@ -402,7 +413,7 @@ $(o).dll: .ENDIF # -INST_BIN = $(INST_TOP)$(INST_VER)\bin\$(ARCHNAME) +INST_BIN = $(INST_TOP)$(INST_VER)\bin$(INST_ARCH) INST_SCRIPT = $(INST_TOP)$(INST_VER)\bin INST_LIB = $(INST_TOP)$(INST_VER)\lib INST_POD = $(INST_LIB)\pod @@ -715,6 +726,7 @@ CFG_VARS = \ "INST_DRV=$(INST_DRV)" \ "INST_TOP=$(INST_TOP)" \ "INST_VER=$(INST_VER)" \ + "INST_ARCH=$(INST_ARCH)" \ "archname=$(ARCHNAME)" \ "cc=$(CC)" \ "ccflags=$(OPTIMIZE:s/"/\"/) $(DEFINES) $(OBJECT)" \ diff --git a/win32/perllib.c b/win32/perllib.c index 452fcdf11e..7cfe60da15 100644 --- a/win32/perllib.c +++ b/win32/perllib.c @@ -5,17 +5,1472 @@ #include "EXTERN.h" #include "perl.h" + +#ifdef PERL_OBJECT +#define NO_XSLOCKS +#endif + #include "XSUB.h" -static void xs_init (pTHX); +#ifdef PERL_OBJECT +#include "win32iop.h" +#include <fcntl.h> +#endif + + +/* Register any extra external extensions */ +char *staticlinkmodules[] = { + "DynaLoader", + NULL, +}; + +EXTERN_C void boot_DynaLoader (pTHXo_ CV* cv); + +static void +xs_init(pTHXo) +{ + char *file = __FILE__; + dXSUB_SYS; + newXS("DynaLoader::boot_DynaLoader", boot_DynaLoader, file); +} + +#ifdef PERL_OBJECT +// IPerlMem +void* +PerlMemMalloc(struct IPerlMem*, size_t size) +{ + return win32_malloc(size); +} +void* +PerlMemRealloc(struct IPerlMem*, void* ptr, size_t size) +{ + return win32_realloc(ptr, size); +} +void +PerlMemFree(struct IPerlMem*, void* ptr) +{ + win32_free(ptr); +} + +struct IPerlMem perlMem = +{ + PerlMemMalloc, + PerlMemRealloc, + PerlMemFree, +}; + + +// IPerlEnv +extern char * g_win32_get_privlib(char *pl); +extern char * g_win32_get_sitelib(char *pl); + + +char* +PerlEnvGetenv(struct IPerlEnv*, const char *varname) +{ + return win32_getenv(varname); +}; +int +PerlEnvPutenv(struct IPerlEnv*, const char *envstring) +{ + return win32_putenv(envstring); +}; + +char* +PerlEnvGetenv_len(struct IPerlEnv*, const char* varname, unsigned long* len) +{ + char *e = win32_getenv(varname); + if (e) + *len = strlen(e); + return e; +} + +int +PerlEnvUname(struct IPerlEnv*, struct utsname *name) +{ + return win32_uname(name); +} + +unsigned long +PerlEnvOsId(struct IPerlEnv*) +{ + return win32_os_id(); +} + +char* +PerlEnvLibPath(struct IPerlEnv*, char *pl) +{ + return g_win32_get_privlib(pl); +} + +char* +PerlEnvSiteLibPath(struct IPerlEnv*, char *pl) +{ + return g_win32_get_sitelib(pl); +} + +struct IPerlEnv perlEnv = +{ + PerlEnvGetenv, + PerlEnvPutenv, + PerlEnvGetenv_len, + PerlEnvUname, + NULL, + PerlEnvOsId, + PerlEnvLibPath, + PerlEnvSiteLibPath, +}; + + +// PerlStdIO +PerlIO* +PerlStdIOStdin(struct IPerlStdIO*) +{ + return (PerlIO*)win32_stdin(); +} + +PerlIO* +PerlStdIOStdout(struct IPerlStdIO*) +{ + return (PerlIO*)win32_stdout(); +} + +PerlIO* +PerlStdIOStderr(struct IPerlStdIO*) +{ + return (PerlIO*)win32_stderr(); +} + +PerlIO* +PerlStdIOOpen(struct IPerlStdIO*, const char *path, const char *mode) +{ + return (PerlIO*)win32_fopen(path, mode); +} + +int +PerlStdIOClose(struct IPerlStdIO*, PerlIO* pf) +{ + return win32_fclose(((FILE*)pf)); +} + +int +PerlStdIOEof(struct IPerlStdIO*, PerlIO* pf) +{ + return win32_feof((FILE*)pf); +} + +int +PerlStdIOError(struct IPerlStdIO*, PerlIO* pf) +{ + return win32_ferror((FILE*)pf); +} + +void +PerlStdIOClearerr(struct IPerlStdIO*, PerlIO* pf) +{ + win32_clearerr((FILE*)pf); +} + +int +PerlStdIOGetc(struct IPerlStdIO*, PerlIO* pf) +{ + return win32_getc((FILE*)pf); +} + +char* +PerlStdIOGetBase(struct IPerlStdIO*, PerlIO* pf) +{ +#ifdef FILE_base + FILE *f = (FILE*)pf; + return FILE_base(f); +#else + return Nullch; +#endif +} + +int +PerlStdIOGetBufsiz(struct IPerlStdIO*, PerlIO* pf) +{ +#ifdef FILE_bufsiz + FILE *f = (FILE*)pf; + return FILE_bufsiz(f); +#else + return (-1); +#endif +} + +int +PerlStdIOGetCnt(struct IPerlStdIO*, PerlIO* pf) +{ +#ifdef USE_STDIO_PTR + FILE *f = (FILE*)pf; + return FILE_cnt(f); +#else + return (-1); +#endif +} + +char* +PerlStdIOGetPtr(struct IPerlStdIO*, PerlIO* pf) +{ +#ifdef USE_STDIO_PTR + FILE *f = (FILE*)pf; + return FILE_ptr(f); +#else + return Nullch; +#endif +} + +char* +PerlStdIOGets(struct IPerlStdIO*, PerlIO* pf, char* s, int n) +{ + return win32_fgets(s, n, (FILE*)pf); +} + +int +PerlStdIOPutc(struct IPerlStdIO*, PerlIO* pf, int c) +{ + return win32_fputc(c, (FILE*)pf); +} + +int +PerlStdIOPuts(struct IPerlStdIO*, PerlIO* pf, const char *s) +{ + return win32_fputs(s, (FILE*)pf); +} + +int +PerlStdIOFlush(struct IPerlStdIO*, PerlIO* pf) +{ + return win32_fflush((FILE*)pf); +} + +int +PerlStdIOUngetc(struct IPerlStdIO*, PerlIO* pf,int c) +{ + return win32_ungetc(c, (FILE*)pf); +} + +int +PerlStdIOFileno(struct IPerlStdIO*, PerlIO* pf) +{ + return win32_fileno((FILE*)pf); +} + +PerlIO* +PerlStdIOFdopen(struct IPerlStdIO*, int fd, const char *mode) +{ + return (PerlIO*)win32_fdopen(fd, mode); +} + +PerlIO* +PerlStdIOReopen(struct IPerlStdIO*, const char*path, const char*mode, PerlIO* pf) +{ + return (PerlIO*)win32_freopen(path, mode, (FILE*)pf); +} + +SSize_t +PerlStdIORead(struct IPerlStdIO*, PerlIO* pf, void *buffer, Size_t size) +{ + return win32_fread(buffer, 1, size, (FILE*)pf); +} + +SSize_t +PerlStdIOWrite(struct IPerlStdIO*, PerlIO* pf, const void *buffer, Size_t size) +{ + return win32_fwrite(buffer, 1, size, (FILE*)pf); +} + +void +PerlStdIOSetBuf(struct IPerlStdIO*, PerlIO* pf, char* buffer) +{ + win32_setbuf((FILE*)pf, buffer); +} + +int +PerlStdIOSetVBuf(struct IPerlStdIO*, PerlIO* pf, char* buffer, int type, Size_t size) +{ + return win32_setvbuf((FILE*)pf, buffer, type, size); +} + +void +PerlStdIOSetCnt(struct IPerlStdIO*, PerlIO* pf, int n) +{ +#ifdef STDIO_CNT_LVALUE + FILE *f = (FILE*)pf; + FILE_cnt(f) = n; +#endif +} + +void +PerlStdIOSetPtrCnt(struct IPerlStdIO*, PerlIO* pf, char * ptr, int n) +{ +#ifdef STDIO_PTR_LVALUE + FILE *f = (FILE*)pf; + FILE_ptr(f) = ptr; + FILE_cnt(f) = n; +#endif +} + +void +PerlStdIOSetlinebuf(struct IPerlStdIO*, PerlIO* pf) +{ + win32_setvbuf((FILE*)pf, NULL, _IOLBF, 0); +} + +int +PerlStdIOPrintf(struct IPerlStdIO*, PerlIO* pf, const char *format,...) +{ + va_list(arglist); + va_start(arglist, format); + return win32_vfprintf((FILE*)pf, format, arglist); +} + +int +PerlStdIOVprintf(struct IPerlStdIO*, PerlIO* pf, const char *format, va_list arglist) +{ + return win32_vfprintf((FILE*)pf, format, arglist); +} + +long +PerlStdIOTell(struct IPerlStdIO*, PerlIO* pf) +{ + return win32_ftell((FILE*)pf); +} + +int +PerlStdIOSeek(struct IPerlStdIO*, PerlIO* pf, off_t offset, int origin) +{ + return win32_fseek((FILE*)pf, offset, origin); +} + +void +PerlStdIORewind(struct IPerlStdIO*, PerlIO* pf) +{ + win32_rewind((FILE*)pf); +} + +PerlIO* +PerlStdIOTmpfile(struct IPerlStdIO*) +{ + return (PerlIO*)win32_tmpfile(); +} + +int +PerlStdIOGetpos(struct IPerlStdIO*, PerlIO* pf, Fpos_t *p) +{ + return win32_fgetpos((FILE*)pf, p); +} + +int +PerlStdIOSetpos(struct IPerlStdIO*, PerlIO* pf, const Fpos_t *p) +{ + return win32_fsetpos((FILE*)pf, p); +} +void +PerlStdIOInit(struct IPerlStdIO*) +{ +} + +void +PerlStdIOInitOSExtras(struct IPerlStdIO*) +{ + Perl_init_os_extras(); +} + +int +PerlStdIOOpenOSfhandle(struct IPerlStdIO*, long osfhandle, int flags) +{ + return win32_open_osfhandle(osfhandle, flags); +} + +int +PerlStdIOGetOSfhandle(struct IPerlStdIO*, int filenum) +{ + return win32_get_osfhandle(filenum); +} + + +struct IPerlStdIO perlStdIO = +{ + PerlStdIOStdin, + PerlStdIOStdout, + PerlStdIOStderr, + PerlStdIOOpen, + PerlStdIOClose, + PerlStdIOEof, + PerlStdIOError, + PerlStdIOClearerr, + PerlStdIOGetc, + PerlStdIOGetBase, + PerlStdIOGetBufsiz, + PerlStdIOGetCnt, + PerlStdIOGetPtr, + PerlStdIOGets, + PerlStdIOPutc, + PerlStdIOPuts, + PerlStdIOFlush, + PerlStdIOUngetc, + PerlStdIOFileno, + PerlStdIOFdopen, + PerlStdIOReopen, + PerlStdIORead, + PerlStdIOWrite, + PerlStdIOSetBuf, + PerlStdIOSetVBuf, + PerlStdIOSetCnt, + PerlStdIOSetPtrCnt, + PerlStdIOSetlinebuf, + PerlStdIOPrintf, + PerlStdIOVprintf, + PerlStdIOTell, + PerlStdIOSeek, + PerlStdIORewind, + PerlStdIOTmpfile, + PerlStdIOGetpos, + PerlStdIOSetpos, + PerlStdIOInit, + PerlStdIOInitOSExtras, +}; + + +// IPerlLIO +int +PerlLIOAccess(struct IPerlLIO*, const char *path, int mode) +{ + return access(path, mode); +} + +int +PerlLIOChmod(struct IPerlLIO*, const char *filename, int pmode) +{ + return chmod(filename, pmode); +} + +int +PerlLIOChown(struct IPerlLIO*, const char *filename, uid_t owner, gid_t group) +{ + return chown(filename, owner, group); +} + +int +PerlLIOChsize(struct IPerlLIO*, int handle, long size) +{ + return chsize(handle, size); +} + +int +PerlLIOClose(struct IPerlLIO*, int handle) +{ + return win32_close(handle); +} + +int +PerlLIODup(struct IPerlLIO*, int handle) +{ + return win32_dup(handle); +} + +int +PerlLIODup2(struct IPerlLIO*, int handle1, int handle2) +{ + return win32_dup2(handle1, handle2); +} + +int +PerlLIOFlock(struct IPerlLIO*, int fd, int oper) +{ + return win32_flock(fd, oper); +} + +int +PerlLIOFileStat(struct IPerlLIO*, int handle, struct stat *buffer) +{ + return fstat(handle, buffer); +} + +int +PerlLIOIOCtl(struct IPerlLIO*, int i, unsigned int u, char *data) +{ + return win32_ioctlsocket((SOCKET)i, (long)u, (u_long*)data); +} + +int +PerlLIOIsatty(struct IPerlLIO*, int fd) +{ + return isatty(fd); +} + +long +PerlLIOLseek(struct IPerlLIO*, int handle, long offset, int origin) +{ + return win32_lseek(handle, offset, origin); +} + +int +PerlLIOLstat(struct IPerlLIO* p, const char *path, struct stat *buffer) +{ + return win32_stat(path, buffer); +} + +char* +PerlLIOMktemp(struct IPerlLIO*, char *Template) +{ + return mktemp(Template); +} + +int +PerlLIOOpen(struct IPerlLIO*, const char *filename, int oflag) +{ + return win32_open(filename, oflag); +} + +int +PerlLIOOpen3(struct IPerlLIO*, const char *filename, int oflag, int pmode) +{ + int ret; + if(stricmp(filename, "/dev/null") == 0) + ret = open("NUL", oflag, pmode); + else + ret = open(filename, oflag, pmode); + + return ret; +} + +int +PerlLIORead(struct IPerlLIO*, int handle, void *buffer, unsigned int count) +{ + return win32_read(handle, buffer, count); +} + +int +PerlLIORename(struct IPerlLIO*, const char *OldFileName, const char *newname) +{ + return win32_rename(OldFileName, newname); +} + +int +PerlLIOSetmode(struct IPerlLIO*, int handle, int mode) +{ + return win32_setmode(handle, mode); +} + +int +PerlLIONameStat(struct IPerlLIO*, const char *path, struct stat *buffer) +{ + return win32_stat(path, buffer); +} + +char* +PerlLIOTmpnam(struct IPerlLIO*, char *string) +{ + return tmpnam(string); +} + +int +PerlLIOUmask(struct IPerlLIO*, int pmode) +{ + return umask(pmode); +} + +int +PerlLIOUnlink(struct IPerlLIO*, const char *filename) +{ + chmod(filename, S_IREAD | S_IWRITE); + return unlink(filename); +} + +int +PerlLIOUtime(struct IPerlLIO*, char *filename, struct utimbuf *times) +{ + return win32_utime(filename, times); +} + +int +PerlLIOWrite(struct IPerlLIO*, int handle, const void *buffer, unsigned int count) +{ + return win32_write(handle, buffer, count); +} + +struct IPerlLIO perlLIO = +{ + PerlLIOAccess, + PerlLIOChmod, + PerlLIOChown, + PerlLIOChsize, + PerlLIOClose, + PerlLIODup, + PerlLIODup2, + PerlLIOFlock, + PerlLIOFileStat, + PerlLIOIOCtl, + PerlLIOIsatty, + PerlLIOLseek, + PerlLIOLstat, + PerlLIOMktemp, + PerlLIOOpen, + PerlLIOOpen3, + PerlLIORead, + PerlLIORename, + PerlLIOSetmode, + PerlLIONameStat, + PerlLIOTmpnam, + PerlLIOUmask, + PerlLIOUnlink, + PerlLIOUtime, + PerlLIOWrite, +}; + +// IPerlDIR +int +PerlDirMakedir(struct IPerlDir*, const char *dirname, int mode) +{ + return win32_mkdir(dirname, mode); +} + +int +PerlDirChdir(struct IPerlDir*, const char *dirname) +{ + return win32_chdir(dirname); +} + +int +PerlDirRmdir(struct IPerlDir*, const char *dirname) +{ + return win32_rmdir(dirname); +} + +int +PerlDirClose(struct IPerlDir*, DIR *dirp) +{ + return win32_closedir(dirp); +} + +DIR* +PerlDirOpen(struct IPerlDir*, char *filename) +{ + return win32_opendir(filename); +} + +struct direct * +PerlDirRead(struct IPerlDir*, DIR *dirp) +{ + return win32_readdir(dirp); +} + +void +PerlDirRewind(struct IPerlDir*, DIR *dirp) +{ + win32_rewinddir(dirp); +} + +void +PerlDirSeek(struct IPerlDir*, DIR *dirp, long loc) +{ + win32_seekdir(dirp, loc); +} + +long +PerlDirTell(struct IPerlDir*, DIR *dirp) +{ + return win32_telldir(dirp); +} + +struct IPerlDir perlDir = +{ + PerlDirMakedir, + PerlDirChdir, + PerlDirRmdir, + PerlDirClose, + PerlDirOpen, + PerlDirRead, + PerlDirRewind, + PerlDirSeek, + PerlDirTell, +}; + + +// IPerlSock +u_long +PerlSockHtonl(struct IPerlSock*, u_long hostlong) +{ + return win32_htonl(hostlong); +} + +u_short +PerlSockHtons(struct IPerlSock*, u_short hostshort) +{ + return win32_htons(hostshort); +} + +u_long +PerlSockNtohl(struct IPerlSock*, u_long netlong) +{ + return win32_ntohl(netlong); +} + +u_short +PerlSockNtohs(struct IPerlSock*, u_short netshort) +{ + return win32_ntohs(netshort); +} + +SOCKET PerlSockAccept(struct IPerlSock*, SOCKET s, struct sockaddr* addr, int* addrlen) +{ + return win32_accept(s, addr, addrlen); +} + +int +PerlSockBind(struct IPerlSock*, SOCKET s, const struct sockaddr* name, int namelen) +{ + return win32_bind(s, name, namelen); +} + +int +PerlSockConnect(struct IPerlSock*, SOCKET s, const struct sockaddr* name, int namelen) +{ + return win32_connect(s, name, namelen); +} + +void +PerlSockEndhostent(struct IPerlSock*) +{ + win32_endhostent(); +} + +void +PerlSockEndnetent(struct IPerlSock*) +{ + win32_endnetent(); +} + +void +PerlSockEndprotoent(struct IPerlSock*) +{ + win32_endprotoent(); +} + +void +PerlSockEndservent(struct IPerlSock*) +{ + win32_endservent(); +} + +struct hostent* +PerlSockGethostbyaddr(struct IPerlSock*, const char* addr, int len, int type) +{ + return win32_gethostbyaddr(addr, len, type); +} + +struct hostent* +PerlSockGethostbyname(struct IPerlSock*, const char* name) +{ + return win32_gethostbyname(name); +} + +struct hostent* +PerlSockGethostent(struct IPerlSock*) +{ + dPERLOBJ; + croak("gethostent not implemented!\n"); + return NULL; +} + +int +PerlSockGethostname(struct IPerlSock*, char* name, int namelen) +{ + return win32_gethostname(name, namelen); +} + +struct netent * +PerlSockGetnetbyaddr(struct IPerlSock*, long net, int type) +{ + return win32_getnetbyaddr(net, type); +} + +struct netent * +PerlSockGetnetbyname(struct IPerlSock*, const char *name) +{ + return win32_getnetbyname((char*)name); +} + +struct netent * +PerlSockGetnetent(struct IPerlSock*) +{ + return win32_getnetent(); +} + +int PerlSockGetpeername(struct IPerlSock*, SOCKET s, struct sockaddr* name, int* namelen) +{ + return win32_getpeername(s, name, namelen); +} + +struct protoent* +PerlSockGetprotobyname(struct IPerlSock*, const char* name) +{ + return win32_getprotobyname(name); +} + +struct protoent* +PerlSockGetprotobynumber(struct IPerlSock*, int number) +{ + return win32_getprotobynumber(number); +} + +struct protoent* +PerlSockGetprotoent(struct IPerlSock*) +{ + return win32_getprotoent(); +} + +struct servent* +PerlSockGetservbyname(struct IPerlSock*, const char* name, const char* proto) +{ + return win32_getservbyname(name, proto); +} + +struct servent* +PerlSockGetservbyport(struct IPerlSock*, int port, const char* proto) +{ + return win32_getservbyport(port, proto); +} + +struct servent* +PerlSockGetservent(struct IPerlSock*) +{ + return win32_getservent(); +} + +int +PerlSockGetsockname(struct IPerlSock*, SOCKET s, struct sockaddr* name, int* namelen) +{ + return win32_getsockname(s, name, namelen); +} + +int +PerlSockGetsockopt(struct IPerlSock*, SOCKET s, int level, int optname, char* optval, int* optlen) +{ + return win32_getsockopt(s, level, optname, optval, optlen); +} + +unsigned long +PerlSockInetAddr(struct IPerlSock*, const char* cp) +{ + return win32_inet_addr(cp); +} + +char* +PerlSockInetNtoa(struct IPerlSock*, struct in_addr in) +{ + return win32_inet_ntoa(in); +} + +int +PerlSockListen(struct IPerlSock*, SOCKET s, int backlog) +{ + return win32_listen(s, backlog); +} + +int +PerlSockRecv(struct IPerlSock*, SOCKET s, char* buffer, int len, int flags) +{ + return win32_recv(s, buffer, len, flags); +} + +int +PerlSockRecvfrom(struct IPerlSock*, SOCKET s, char* buffer, int len, int flags, struct sockaddr* from, int* fromlen) +{ + return win32_recvfrom(s, buffer, len, flags, from, fromlen); +} + +int +PerlSockSelect(struct IPerlSock*, int nfds, char* readfds, char* writefds, char* exceptfds, const struct timeval* timeout) +{ + return win32_select(nfds, (Perl_fd_set*)readfds, (Perl_fd_set*)writefds, (Perl_fd_set*)exceptfds, timeout); +} + +int +PerlSockSend(struct IPerlSock*, SOCKET s, const char* buffer, int len, int flags) +{ + return win32_send(s, buffer, len, flags); +} + +int +PerlSockSendto(struct IPerlSock*, SOCKET s, const char* buffer, int len, int flags, const struct sockaddr* to, int tolen) +{ + return win32_sendto(s, buffer, len, flags, to, tolen); +} + +void +PerlSockSethostent(struct IPerlSock*, int stayopen) +{ + win32_sethostent(stayopen); +} + +void +PerlSockSetnetent(struct IPerlSock*, int stayopen) +{ + win32_setnetent(stayopen); +} + +void +PerlSockSetprotoent(struct IPerlSock*, int stayopen) +{ + win32_setprotoent(stayopen); +} + +void +PerlSockSetservent(struct IPerlSock*, int stayopen) +{ + win32_setservent(stayopen); +} + +int +PerlSockSetsockopt(struct IPerlSock*, SOCKET s, int level, int optname, const char* optval, int optlen) +{ + return win32_setsockopt(s, level, optname, optval, optlen); +} + +int +PerlSockShutdown(struct IPerlSock*, SOCKET s, int how) +{ + return win32_shutdown(s, how); +} + +SOCKET +PerlSockSocket(struct IPerlSock*, int af, int type, int protocol) +{ + return win32_socket(af, type, protocol); +} + +int +PerlSockSocketpair(struct IPerlSock*, int domain, int type, int protocol, int* fds) +{ + dPERLOBJ; + croak("socketpair not implemented!\n"); + return 0; +} + +int +PerlSockClosesocket(struct IPerlSock*, SOCKET s) +{ + return win32_closesocket(s); +} + +int +PerlSockIoctlsocket(struct IPerlSock*, SOCKET s, long cmd, u_long *argp) +{ + return win32_ioctlsocket(s, cmd, argp); +} + +struct IPerlSock perlSock = +{ + PerlSockHtonl, + PerlSockHtons, + PerlSockNtohl, + PerlSockNtohs, + PerlSockAccept, + PerlSockBind, + PerlSockConnect, + PerlSockEndhostent, + PerlSockEndnetent, + PerlSockEndprotoent, + PerlSockEndservent, + PerlSockGethostname, + PerlSockGetpeername, + PerlSockGethostbyaddr, + PerlSockGethostbyname, + PerlSockGethostent, + PerlSockGetnetbyaddr, + PerlSockGetnetbyname, + PerlSockGetnetent, + PerlSockGetprotobyname, + PerlSockGetprotobynumber, + PerlSockGetprotoent, + PerlSockGetservbyname, + PerlSockGetservbyport, + PerlSockGetservent, + PerlSockGetsockname, + PerlSockGetsockopt, + PerlSockInetAddr, + PerlSockInetNtoa, + PerlSockListen, + PerlSockRecv, + PerlSockRecvfrom, + PerlSockSelect, + PerlSockSend, + PerlSockSendto, + PerlSockSethostent, + PerlSockSetnetent, + PerlSockSetprotoent, + PerlSockSetservent, + PerlSockSetsockopt, + PerlSockShutdown, + PerlSockSocket, + PerlSockSocketpair, + PerlSockClosesocket, +}; + + +// IPerlProc + +#define EXECF_EXEC 1 +#define EXECF_SPAWN 2 + +extern char * g_getlogin(void); +extern int do_spawn2(char *cmd, int exectype); +extern int g_do_aspawn(void *vreally, void **vmark, void **vsp); + +void +PerlProcAbort(struct IPerlProc*) +{ + win32_abort(); +} + +char * +PerlProcCrypt(struct IPerlProc*, const char* clear, const char* salt) +{ + return win32_crypt(clear, salt); +} + +void +PerlProcExit(struct IPerlProc*, int status) +{ + exit(status); +} + +void +PerlProc_Exit(struct IPerlProc*, int status) +{ + _exit(status); +} + +int +PerlProcExecl(struct IPerlProc*, const char *cmdname, const char *arg0, const char *arg1, const char *arg2, const char *arg3) +{ + return execl(cmdname, arg0, arg1, arg2, arg3); +} + +int +PerlProcExecv(struct IPerlProc*, const char *cmdname, const char *const *argv) +{ + return win32_execvp(cmdname, argv); +} + +int +PerlProcExecvp(struct IPerlProc*, const char *cmdname, const char *const *argv) +{ + return win32_execvp(cmdname, argv); +} + +uid_t +PerlProcGetuid(struct IPerlProc*) +{ + return getuid(); +} + +uid_t +PerlProcGeteuid(struct IPerlProc*) +{ + return geteuid(); +} + +gid_t +PerlProcGetgid(struct IPerlProc*) +{ + return getgid(); +} + +gid_t +PerlProcGetegid(struct IPerlProc*) +{ + return getegid(); +} + +char * +PerlProcGetlogin(struct IPerlProc*) +{ + return g_getlogin(); +} + +int +PerlProcKill(struct IPerlProc*, int pid, int sig) +{ + return win32_kill(pid, sig); +} + +int +PerlProcKillpg(struct IPerlProc*, int pid, int sig) +{ + dPERLOBJ; + croak("killpg not implemented!\n"); + return 0; +} + +int +PerlProcPauseProc(struct IPerlProc*) +{ + return win32_sleep((32767L << 16) + 32767); +} + +PerlIO* +PerlProcPopen(struct IPerlProc*, const char *command, const char *mode) +{ + win32_fflush(stdout); + win32_fflush(stderr); + return (PerlIO*)win32_popen(command, mode); +} + +int +PerlProcPclose(struct IPerlProc*, PerlIO *stream) +{ + return win32_pclose((FILE*)stream); +} + +int +PerlProcPipe(struct IPerlProc*, int *phandles) +{ + return win32_pipe(phandles, 512, O_BINARY); +} + +int +PerlProcSetuid(struct IPerlProc*, uid_t u) +{ + return setuid(u); +} + +int +PerlProcSetgid(struct IPerlProc*, gid_t g) +{ + return setgid(g); +} + +int +PerlProcSleep(struct IPerlProc*, unsigned int s) +{ + return win32_sleep(s); +} + +int +PerlProcTimes(struct IPerlProc*, struct tms *timebuf) +{ + return win32_times(timebuf); +} + +int +PerlProcWait(struct IPerlProc*, int *status) +{ + return win32_wait(status); +} + +int +PerlProcWaitpid(struct IPerlProc*, int pid, int *status, int flags) +{ + return win32_waitpid(pid, status, flags); +} + +Sighandler_t +PerlProcSignal(struct IPerlProc*, int sig, Sighandler_t subcode) +{ + return 0; +} + +void* +PerlProcDynaLoader(struct IPerlProc*, const char* filename) +{ + return win32_dynaload(filename); +} + +void +PerlProcGetOSError(struct IPerlProc*, SV* sv, DWORD dwErr) +{ + win32_str_os_error(aTHX_ sv, dwErr); +} + +BOOL +PerlProcDoCmd(struct IPerlProc*, char *cmd) +{ + do_spawn2(cmd, EXECF_EXEC); + return FALSE; +} + +int +PerlProcSpawn(struct IPerlProc*, char* cmds) +{ + return do_spawn2(cmds, EXECF_SPAWN); +} + +int +PerlProcSpawnvp(struct IPerlProc*, int mode, const char *cmdname, const char *const *argv) +{ + return win32_spawnvp(mode, cmdname, argv); +} + +int +PerlProcASpawn(struct IPerlProc*, void *vreally, void **vmark, void **vsp) +{ + return g_do_aspawn(vreally, vmark, vsp); +} + +struct IPerlProc perlProc = +{ + PerlProcAbort, + PerlProcCrypt, + PerlProcExit, + PerlProc_Exit, + PerlProcExecl, + PerlProcExecv, + PerlProcExecvp, + PerlProcGetuid, + PerlProcGeteuid, + PerlProcGetgid, + PerlProcGetegid, + PerlProcGetlogin, + PerlProcKill, + PerlProcKillpg, + PerlProcPauseProc, + PerlProcPopen, + PerlProcPclose, + PerlProcPipe, + PerlProcSetuid, + PerlProcSetgid, + PerlProcSleep, + PerlProcTimes, + PerlProcWait, + PerlProcWaitpid, + PerlProcSignal, + PerlProcDynaLoader, + PerlProcGetOSError, + PerlProcDoCmd, + PerlProcSpawn, + PerlProcSpawnvp, + PerlProcASpawn, +}; + +//#include "perlhost.h" + +static DWORD g_TlsAllocIndex; +BOOL SetPerlInterpreter(CPerlObj* pPerl) +{ + return TlsSetValue(g_TlsAllocIndex, pPerl); +} + +EXTERN_C CPerlObj* GetPerlInterpreter(PerlInterpreter* sv_interp) +{ + if(GetCurrentThreadId() == (DWORD)sv_interp) + return (CPerlObj*)TlsGetValue(g_TlsAllocIndex); + return NULL; +} + +CPerlObj* GetPerlInter(void) +{ + return (CPerlObj*)TlsGetValue(g_TlsAllocIndex); +} + + +EXTERN_C void perl_get_host_info(IPerlMemInfo* perlMemInfo, + IPerlEnvInfo* perlEnvInfo, IPerlStdIOInfo* perlStdIOInfo, + IPerlLIOInfo* perlLIOInfo, IPerlDirInfo* perlDirInfo, + IPerlSockInfo* perlSockInfo, IPerlProcInfo* perlProcInfo) +{ + if(perlMemInfo) { + Copy(&perlMem, &perlMemInfo->perlMemList, perlMemInfo->nCount, void*); + perlMemInfo->nCount = (sizeof(struct IPerlMem)/sizeof(void*)); + } + if(perlEnvInfo) { + Copy(&perlEnv, &perlEnvInfo->perlEnvList, perlEnvInfo->nCount, void*); + perlEnvInfo->nCount = (sizeof(struct IPerlEnv)/sizeof(void*)); + } + if(perlStdIOInfo) { + Copy(&perlStdIO, &perlStdIOInfo->perlStdIOList, perlStdIOInfo->nCount, void*); + perlStdIOInfo->nCount = (sizeof(struct IPerlStdIO)/sizeof(void*)); + } + if(perlLIOInfo) { + Copy(&perlLIO, &perlLIOInfo->perlLIOList, perlLIOInfo->nCount, void*); + perlLIOInfo->nCount = (sizeof(struct IPerlLIO)/sizeof(void*)); + } + if(perlDirInfo) { + Copy(&perlDir, &perlDirInfo->perlDirList, perlDirInfo->nCount, void*); + perlDirInfo->nCount = (sizeof(struct IPerlDir)/sizeof(void*)); + } + if(perlSockInfo) { + Copy(&perlSock, &perlSockInfo->perlSockList, perlSockInfo->nCount, void*); + perlSockInfo->nCount = (sizeof(struct IPerlSock)/sizeof(void*)); + } + if(perlProcInfo) { + Copy(&perlProc, &perlProcInfo->perlProcList, perlProcInfo->nCount, void*); + perlProcInfo->nCount = (sizeof(struct IPerlProc)/sizeof(void*)); + } +} + +EXTERN_C PerlInterpreter* perl_alloc_using(IPerlMem* pMem, + IPerlEnv* pEnv, IPerlStdIO* pStdIO, + IPerlLIO* pLIO, IPerlDir* pDir, + IPerlSock* pSock, IPerlProc* pProc) +{ + CPerlObj* pPerl = NULL; + try + { + pPerl = Perl_alloc(pMem, pEnv, pStdIO, pLIO, pDir, pSock, pProc); + } + catch(...) + { + win32_fprintf(stderr, "%s\n", "Error: Unable to allocate memory"); + pPerl = NULL; + } + if(pPerl) + { + SetPerlInterpreter(pPerl); + return (PerlInterpreter*)GetCurrentThreadId(); + } + SetPerlInterpreter(NULL); + return NULL; +} + +#undef perl_alloc +#undef perl_construct +#undef perl_destruct +#undef perl_free +#undef perl_run +#undef perl_parse +EXTERN_C PerlInterpreter* perl_alloc(void) +{ + CPerlObj* pPerl = NULL; + try + { + pPerl = Perl_alloc(&perlMem, &perlEnv, &perlStdIO, &perlLIO, + &perlDir, &perlSock, &perlProc); + } + catch(...) + { + win32_fprintf(stderr, "%s\n", "Error: Unable to allocate memory"); + pPerl = NULL; + } + if(pPerl) + { + SetPerlInterpreter(pPerl); + return (PerlInterpreter*)GetCurrentThreadId(); + } + SetPerlInterpreter(NULL); + return NULL; +} + +EXTERN_C void perl_construct(PerlInterpreter* sv_interp) +{ + CPerlObj* pPerl = GetPerlInterpreter(sv_interp); + try + { + pPerl->perl_construct(); + } + catch(...) + { + win32_fprintf(stderr, "%s\n", + "Error: Unable to construct data structures"); + pPerl->perl_free(); + SetPerlInterpreter(NULL); + } +} + +EXTERN_C void perl_destruct(PerlInterpreter* sv_interp) +{ + CPerlObj* pPerl = GetPerlInterpreter(sv_interp); + try + { + pPerl->perl_destruct(); + } + catch(...) + { + } +} + +EXTERN_C void perl_free(PerlInterpreter* sv_interp) +{ + CPerlObj* pPerl = GetPerlInterpreter(sv_interp); + try + { + pPerl->perl_free(); + } + catch(...) + { + } + SetPerlInterpreter(NULL); +} + +EXTERN_C int perl_run(PerlInterpreter* sv_interp) +{ + CPerlObj* pPerl = GetPerlInterpreter(sv_interp); + int retVal; + try + { + retVal = pPerl->perl_run(); + } +/* + catch(int x) + { + // this is where exit() should arrive + retVal = x; + } +*/ + catch(...) + { + win32_fprintf(stderr, "Error: Runtime exception\n"); + retVal = -1; + } + return retVal; +} + +EXTERN_C int perl_parse(PerlInterpreter* sv_interp, void (*xsinit)(CPerlObj*), int argc, char** argv, char** env) +{ + int retVal; + CPerlObj* pPerl = GetPerlInterpreter(sv_interp); + try + { + retVal = pPerl->perl_parse(xs_init, argc, argv, env); + } +/* + catch(int x) + { + // this is where exit() should arrive + retVal = x; + } +*/ + catch(...) + { + win32_fprintf(stderr, "Error: Parse exception\n"); + retVal = -1; + } + *win32_errno() = 0; + return retVal; +} + +#undef PL_perl_destruct_level +#define PL_perl_destruct_level int dummy +#undef w32_perldll_handle +#define w32_perldll_handle g_w32_perldll_handle +HANDLE g_w32_perldll_handle; +#else +extern HANDLE w32_perldll_handle; +#endif /* PERL_OBJECT */ DllExport int -RunPerl(int argc, char **argv, char **env, void *iosubsystem) +RunPerl(int argc, char **argv, char **env) { int exitstatus; PerlInterpreter *my_perl; struct perl_thread *thr; +#ifndef __BORLANDC__ + /* XXX this _may_ be a problem on some compilers (e.g. Borland) that + * want to free() argv after main() returns. As luck would have it, + * Borland's CRT does the right thing to argv[0] already. */ + char szModuleName[MAX_PATH]; + char *ptr; + + GetModuleFileName(NULL, szModuleName, sizeof(szModuleName)); + (void)win32_longpath(szModuleName); + argv[0] = szModuleName; +#endif + #ifdef PERL_GLOBAL_STRUCT #define PERLVAR(var,type) /**/ #define PERLVARI(var,type,init) PL_Vars.var = init; @@ -46,8 +1501,6 @@ RunPerl(int argc, char **argv, char **env, void *iosubsystem) return (exitstatus); } -extern HANDLE w32_perldll_handle; - BOOL APIENTRY DllMain(HANDLE hModule, /* DLL module handle */ DWORD fdwReason, /* reason called */ @@ -65,13 +1518,21 @@ DllMain(HANDLE hModule, /* DLL module handle */ setmode( fileno( stderr ), O_BINARY ); _fmode = O_BINARY; #endif +#ifdef PERL_OBJECT + g_TlsAllocIndex = TlsAlloc(); + DisableThreadLibraryCalls(hModule); +#else w32_perldll_handle = hModule; +#endif break; /* The DLL is detaching from a process due to * process termination or call to FreeLibrary. */ case DLL_PROCESS_DETACH: +#ifdef PERL_OBJECT + TlsFree(g_TlsAllocIndex); +#endif break; /* The attached process creates a new thread. */ @@ -88,20 +1549,3 @@ DllMain(HANDLE hModule, /* DLL module handle */ return TRUE; } -/* Register any extra external extensions */ - -char *staticlinkmodules[] = { - "DynaLoader", - NULL, -}; - -EXTERN_C void boot_DynaLoader (pTHX_ CV* cv); - -static void -xs_init(pTHX) -{ - char *file = __FILE__; - dXSUB_SYS; - newXS("DynaLoader::boot_DynaLoader", boot_DynaLoader, file); -} - diff --git a/win32/runperl.c b/win32/runperl.c index e9286702aa..ef4453138d 100644 --- a/win32/runperl.c +++ b/win32/runperl.c @@ -1,67 +1,6 @@ #include "EXTERN.h" #include "perl.h" -#ifdef PERL_OBJECT - -#define NO_XSLOCKS -#include "XSUB.H" -#include "win32iop.h" - -#include <fcntl.h> -#include "perlhost.h" - - -char *staticlinkmodules[] = { - "DynaLoader", - NULL, -}; - -EXTERN_C void boot_DynaLoader (CV* cv _CPERLarg); - -static void -xs_init(CPERLarg) -{ - char *file = __FILE__; - dXSUB_SYS; - newXS("DynaLoader::boot_DynaLoader", boot_DynaLoader, file); -} - -CPerlObj *pPerl; - -int -main(int argc, char **argv, char **env) -{ - CPerlHost host; - int exitstatus = 1; -#ifndef __BORLANDC__ - /* XXX this _may_ be a problem on some compilers (e.g. Borland) that - * want to free() argv after main() returns. As luck would have it, - * Borland's CRT does the right thing to argv[0] already. */ - char szModuleName[MAX_PATH]; - char *ptr; - - GetModuleFileName(NULL, szModuleName, sizeof(szModuleName)); - (void)win32_longpath(szModuleName); - argv[0] = szModuleName; -#endif - - PERL_SYS_INIT(&argc,&argv); - - if (!host.PerlCreate()) - exit(exitstatus); - - exitstatus = host.PerlParse(xs_init, argc, argv, NULL); - - if (!exitstatus) - exitstatus = host.PerlRun(); - - host.PerlDestroy(); - - return exitstatus; -} - -#else /* PERL_OBJECT */ - #ifdef __GNUC__ /* * GNU C does not do __declspec() @@ -78,23 +17,12 @@ int _CRT_glob = 0; #endif -__declspec(dllimport) int RunPerl(int argc, char **argv, char **env, void *ios); +__declspec(dllimport) int RunPerl(int argc, char **argv, char **env); int main(int argc, char **argv, char **env) { -#ifndef __BORLANDC__ - /* XXX this _may_ be a problem on some compilers (e.g. Borland) that - * want to free() argv after main() returns. As luck would have it, - * Borland's CRT does the right thing to argv[0] already. */ - char szModuleName[MAX_PATH]; - char *ptr; - - GetModuleFileName(NULL, szModuleName, sizeof(szModuleName)); - (void)win32_longpath(szModuleName); - argv[0] = szModuleName; -#endif - return RunPerl(argc, argv, env, (void*)0); + return RunPerl(argc, argv, env); } -#endif /* PERL_OBJECT */ + diff --git a/win32/win32.c b/win32/win32.c index 110da4fba2..2df9c7c880 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -40,9 +40,6 @@ #include "perl.h" #define NO_XSLOCKS -#ifdef PERL_OBJECT -extern CPerlObj* pPerl; -#endif #include "XSUB.h" #include "Win32iop.h" @@ -81,13 +78,12 @@ int _CRT_glob = 0; #define do_aspawn g_do_aspawn #undef do_spawn #define do_spawn g_do_spawn -#undef do_exec -#define do_exec g_do_exec +#undef Perl_do_exec +#define Perl_do_exec g_do_exec #undef getlogin #define getlogin g_getlogin #endif -static DWORD os_id(void); static void get_shell(void); static long tokenize(char *str, char **dest, char ***destv); int do_spawn2(pTHX_ char *cmd, int exectype); @@ -129,13 +125,13 @@ static char crypt_buffer[30]; int IsWin95(void) { - return (os_id() == VER_PLATFORM_WIN32_WINDOWS); + return (win32_os_id() == VER_PLATFORM_WIN32_WINDOWS); } int IsWinNT(void) { - return (os_id() == VER_PLATFORM_WIN32_NT); + return (win32_os_id() == VER_PLATFORM_WIN32_NT); } /* *ptr is expected to point to valid allocated space (can't be NULL) */ @@ -153,6 +149,7 @@ GetRegStrFromKey(HKEY hkey, const char *lpszValueName, char** ptr, DWORD* lpData if (retval == ERROR_SUCCESS) { retval = RegQueryValueEx(handle, lpszValueName, 0, &type, NULL, lpDataLen); if (retval == ERROR_SUCCESS && type == REG_SZ) { + dPERLOBJ; Renew(*ptr, *lpDataLen, char); retval = RegQueryValueEx(handle, lpszValueName, 0, NULL, (PBYTE)*ptr, lpDataLen); @@ -244,6 +241,7 @@ get_emd_part(char **prev_path, char *trailing_path, ...) /* only add directory if it exists */ if (GetFileAttributes(mod_name) != (DWORD) -1) { /* directory exists */ + dPERLOBJ; newsize = strlen(mod_name) + 1; oldsize = strlen(*prev_path) + 1; newsize += oldsize; /* includes plus 1 for ';' */ @@ -263,6 +261,7 @@ win32_get_privlib(pTHX_ char *pl) char buffer[MAX_PATH+1]; char **path; DWORD datalen; + dPERLOBJ; SV *sv = sv_2mortal(newSVpvn("",127)); /* $stdlib = $HKCU{"lib-$]"} || $HKLM{"lib-$]"} || $HKCU{"lib"} || $HKLM{"lib"} || ""; */ @@ -288,6 +287,7 @@ win32_get_sitelib(pTHX_ char *pl) char **path1, *str1 = Nullch; char **path2, *str2 = Nullch; int len, newsize; + dPERLOBJ; SV *sv1 = sv_2mortal(newSVpvn("",127)); SV *sv2 = sv_2mortal(newSVpvn("",127)); @@ -407,8 +407,8 @@ Perl_my_pclose(pTHX_ PerlIO *fp) } #endif -static DWORD -os_id(void) +DllExport unsigned long +win32_os_id(void) { static OSVERSIONINFO osver; @@ -418,7 +418,7 @@ os_id(void) GetVersionEx(&osver); w32_platform = osver.dwPlatformId; } - return (w32_platform); + return (unsigned long)w32_platform; } /* Tokenize a string. Words are null-separated, and the list @@ -434,6 +434,7 @@ tokenize(char *str, char **dest, char ***destv) char **retvstart = 0; int items = -1; if (str) { + dPERLOBJ; int slen = strlen(str); register char *ret; register char **retv; @@ -476,6 +477,7 @@ tokenize(char *str, char **dest, char ***destv) static void get_shell(void) { + dPERLOBJ; if (!w32_perlshell_tokens) { /* we don't use COMSPEC here for two reasons: * 1. the same reason perl on UNIX doesn't use SHELL--rampant and @@ -503,6 +505,7 @@ do_aspawn(pTHX_ void *vreally, void **vmark, void **vsp) int status; int flag = P_WAIT; int index = 0; + dPERLOBJ; if (sp <= mark) return -1; @@ -564,6 +567,7 @@ do_spawn2(pTHX_ char *cmd, int exectype) int status = -1; BOOL needToTry = TRUE; char *cmd2; + dPERLOBJ; /* Save an extra exec if possible. See if there are shell * metacharacters in it */ @@ -681,6 +685,7 @@ win32_opendir(char *filename) char buffer[MAX_PATH*2]; WCHAR wbuffer[MAX_PATH]; char* ptr; + dPERLOBJ; len = strlen(filename); if (len > MAX_PATH) @@ -711,7 +716,7 @@ win32_opendir(char *filename) /* do the FindFirstFile call */ if (USING_WIDE()) { - A2WHELPER(scanname, wbuffer, sizeof(wbuffer), GETINTERPMODE()); + A2WHELPER(scanname, wbuffer, sizeof(wbuffer)); fh = FindFirstFileW(wbuffer, &wFindData); } else { @@ -729,7 +734,7 @@ win32_opendir(char *filename) * the filenames that we find. */ if (USING_WIDE()) { - W2AHELPER(wFindData.cFileName, buffer, sizeof(buffer), GETINTERPMODE()); + W2AHELPER(wFindData.cFileName, buffer, sizeof(buffer)); ptr = buffer; } else { @@ -751,7 +756,7 @@ win32_opendir(char *filename) ? FindNextFileW(fh, &wFindData) : FindNextFileA(fh, &aFindData)) { if (USING_WIDE()) { - W2AHELPER(wFindData.cFileName, buffer, sizeof(buffer), GETINTERPMODE()); + W2AHELPER(wFindData.cFileName, buffer, sizeof(buffer)); } /* ptr is set above to the correct area */ len = strlen(ptr); @@ -830,6 +835,7 @@ win32_rewinddir(DIR *dirp) int win32_closedir(DIR *dirp) { + dPERLOBJ; Safefree(dirp->start); Safefree(dirp); return 1; @@ -908,6 +914,7 @@ static long find_pid(int pid) { long child; + dPERLOBJ; for (child = 0 ; child < w32_num_children ; ++child) { if (w32_child_pids[child] == pid) return child; @@ -919,6 +926,7 @@ static void remove_dead_process(long child) { if (child >= 0) { + dPERLOBJ; CloseHandle(w32_child_handles[child]); Copy(&w32_child_handles[child+1], &w32_child_handles[child], (w32_num_children-child-1), HANDLE); @@ -981,9 +989,10 @@ win32_stat(const char *path, struct stat *buffer) break; } } + dPERLOBJ; if (USING_WIDE()) { dTHX; - A2WHELPER(path, wbuffer, sizeof(wbuffer), GETINTERPMODE()); + A2WHELPER(path, wbuffer, sizeof(wbuffer)); res = _wstat(wbuffer, (struct _stat *)buffer); } else { @@ -1128,6 +1137,7 @@ DllExport char * win32_getenv(const char *name) { dTHX; + dPERLOBJ; static char *curitem = Nullch; /* XXX threadead */ static WCHAR *wCuritem = (WCHAR*)Nullch; /* XXX threadead */ static DWORD curlen = 0, wCurlen = 0;/* XXX threadead */ @@ -1146,7 +1156,7 @@ win32_getenv(const char *name) } if (USING_WIDE()) { - A2WHELPER(name, wBuffer, sizeof(wBuffer), GETINTERPMODE()); + A2WHELPER(name, wBuffer, sizeof(wBuffer)); needlen = GetEnvironmentVariableW(wBuffer,wCuritem,wCurlen); } else @@ -1162,7 +1172,7 @@ win32_getenv(const char *name) Renew(curitem,needlen,char); curlen = needlen; } - W2AHELPER(wCuritem, curitem, curlen, GETINTERPMODE()); + W2AHELPER(wCuritem, curitem, curlen); } else { while (needlen > curlen) { @@ -1201,12 +1211,13 @@ win32_putenv(const char *name) WCHAR* wCuritem; WCHAR* wVal; int length, relval = -1; + dPERLOBJ; if (name) { if (USING_WIDE()) { dTHX; length = strlen(name)+1; New(1309,wCuritem,length,WCHAR); - A2WHELPER(name, wCuritem, length*2, GETINTERPMODE()); + A2WHELPER(name, wCuritem, length*2); wVal = wcschr(wCuritem, '='); if(wVal) { *wVal++ = '\0'; @@ -1312,11 +1323,12 @@ win32_utime(const char *filename, struct utimbuf *times) FILETIME ftWrite; struct utimbuf TimeBuffer; WCHAR wbuffer[MAX_PATH]; + dPERLOBJ; int rc; if (USING_WIDE()) { dTHX; - A2WHELPER(filename, wbuffer, sizeof(wbuffer), GETINTERPMODE()); + A2WHELPER(filename, wbuffer, sizeof(wbuffer)); rc = _wutime(wbuffer, (struct _utimbuf*)times); } else { @@ -1455,6 +1467,7 @@ win32_uname(struct utsname *name) DllExport int win32_waitpid(int pid, int *status, int flags) { + dPERLOBJ; int retval = -1; if (pid == -1) return win32_wait(status); @@ -1494,6 +1507,7 @@ win32_wait(int *status) */ int i, retval; DWORD exitcode, waitcode; + dPERLOBJ; if (!w32_num_children) { errno = ECHILD; @@ -1528,9 +1542,10 @@ static UINT timerid = 0; static VOID CALLBACK TimerProc(HWND win, UINT msg, UINT id, DWORD time) { - KillTimer(NULL,timerid); - timerid=0; - sighandler(14); + dPERLOBJ; + KillTimer(NULL,timerid); + timerid=0; + sighandler(14); } DllExport unsigned int @@ -1545,6 +1560,7 @@ win32_alarm(unsigned int sec) * Snag is unless something is looking at the message queue * nothing happens :-( */ + dPERLOBJ; if (sec) { timerid = SetTimer(NULL,timerid,sec*1000,(TIMERPROC)TimerProc); @@ -1572,6 +1588,7 @@ win32_crypt(const char *txt, const char *salt) { #ifdef HAVE_DES_FCRYPT dTHR; + dPERLOBJ; return des_fcrypt(txt, salt, crypt_buffer); #else die("The crypt() function is unimplemented due to excessive paranoia."); @@ -1694,6 +1711,7 @@ win32_flock(int fd, int oper) HANDLE fh; if (!IsWinNT()) { + dPERLOBJ; Perl_croak_nocontext("flock() unimplemented on this platform"); return -1; } @@ -1829,6 +1847,7 @@ win32_str_os_error(pTHX_ void *sv, DWORD dwErr) dwErr, GetLastError()); } if (sMsg) { + dPERLOBJ; sv_setpvn((SV*)sv, sMsg, dwLen); LocalFree(sMsg); } @@ -1886,10 +1905,11 @@ win32_fopen(const char *filename, const char *mode) if (stricmp(filename, "/dev/null")==0) filename = "NUL"; + dPERLOBJ; if (USING_WIDE()) { dTHX; - A2WHELPER(mode, wMode, sizeof(wMode), GETINTERPMODE()); - A2WHELPER(filename, wBuffer, sizeof(wBuffer), GETINTERPMODE()); + A2WHELPER(mode, wMode, sizeof(wMode)); + A2WHELPER(filename, wBuffer, sizeof(wBuffer)); return _wfopen(wBuffer, wMode); } return fopen(filename, mode); @@ -1904,9 +1924,10 @@ DllExport FILE * win32_fdopen(int handle, const char *mode) { WCHAR wMode[MODE_SIZE]; + dPERLOBJ; if (USING_WIDE()) { dTHX; - A2WHELPER(mode, wMode, sizeof(wMode), GETINTERPMODE()); + A2WHELPER(mode, wMode, sizeof(wMode)); return _wfdopen(handle, wMode); } return fdopen(handle, (char *) mode); @@ -1916,13 +1937,14 @@ DllExport FILE * win32_freopen(const char *path, const char *mode, FILE *stream) { WCHAR wMode[MODE_SIZE], wBuffer[MAX_PATH]; + dPERLOBJ; if (stricmp(path, "/dev/null")==0) path = "NUL"; if (USING_WIDE()) { dTHX; - A2WHELPER(mode, wMode, sizeof(wMode), GETINTERPMODE()); - A2WHELPER(path, wBuffer, sizeof(wBuffer), GETINTERPMODE()); + A2WHELPER(mode, wMode, sizeof(wMode)); + A2WHELPER(path, wBuffer, sizeof(wBuffer)); return _wfreopen(wBuffer, wMode, stream); } return freopen(path, mode, stream); @@ -2092,6 +2114,7 @@ win32_popen(const char *command, const char *mode) /* start the child */ { dTHX; + dPERLOBJ; if ((childpid = do_spawn_nowait(aTHX_ (char*)command)) == -1) goto cleanup; @@ -2132,6 +2155,7 @@ win32_pclose(FILE *pf) return _pclose(pf); #else dTHX; + dPERLOBJ; int childpid, status; SV *sv; @@ -2167,10 +2191,11 @@ win32_rename(const char *oname, const char *newname) * it doesn't work under Windows95! */ if (IsWinNT()) { + dPERLOBJ; if (USING_WIDE()) { dTHX; - A2WHELPER(oname, wOldName, sizeof(wOldName), GETINTERPMODE()); - A2WHELPER(newname, wNewName, sizeof(wNewName), GETINTERPMODE()); + A2WHELPER(oname, wOldName, sizeof(wOldName)); + A2WHELPER(newname, wNewName, sizeof(wNewName)); bResult = MoveFileExW(wOldName,wNewName, MOVEFILE_COPY_ALLOWED|MOVEFILE_REPLACE_EXISTING); } @@ -2295,6 +2320,7 @@ win32_open(const char *path, int flag, ...) va_list ap; int pmode; WCHAR wBuffer[MAX_PATH]; + dPERLOBJ; va_start(ap, flag); pmode = va_arg(ap, int); @@ -2305,7 +2331,7 @@ win32_open(const char *path, int flag, ...) if (USING_WIDE()) { dTHX; - A2WHELPER(path, wBuffer, sizeof(wBuffer), GETINTERPMODE()); + A2WHELPER(path, wBuffer, sizeof(wBuffer)); return _wopen(wBuffer, flag, pmode); } return open(path,flag,pmode); @@ -2371,6 +2397,7 @@ create_command_line(const char* command, const char * const *args) int index; char *cmd, *ptr, *arg; STRLEN len = strlen(command) + 1; + dPERLOBJ; for (index = 0; (ptr = (char*)args[index]) != NULL; ++index) len += strlen(ptr) + 1; @@ -2395,6 +2422,7 @@ qualified_path(const char *cmd) char *fullcmd, *curfullcmd; STRLEN cmdlen = 0; int has_slash = 0; + dPERLOBJ; if (!cmd) return Nullch; @@ -2496,6 +2524,7 @@ win32_spawnvp(int mode, const char *cmdname, const char *const *argv) STARTUPINFO StartupInfo; PROCESS_INFORMATION ProcessInformation; DWORD create = 0; + dPERLOBJ; char *cmd = create_command_line(cmdname, strcmp(cmdname, argv[0]) == 0 ? &argv[1] : argv); @@ -2786,6 +2815,54 @@ win32_get_osfhandle(int fd) return _get_osfhandle(fd); } +DllExport void* +win32_dynaload(aTHX_ const char*filename) +{ + HMODULE hModule; + dPERLOBJ; + if (USING_WIDE()) { + WCHAR wfilename[MAX_PATH]; + A2WHELPER(filename, wfilename, sizeof(wfilename)); + hModule = LoadLibraryExW(wfilename, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); + } + else { + hModule = LoadLibraryExA(filename, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); + } + return hModule; +} + +DllExport int +win32_add_host(char *nameId, void *data) +{ + /* + * This must be called before the script is parsed, + * therefore no locking of threads is needed + */ + dTHX; + dPERLOBJ; + struct host_link *link; + New(1314, link, 1, struct host_link); + link->host_data = data; + link->nameId = nameId; + link->next = w32_host_link; + w32_host_link = link; + return 1; +} + +DllExport void * +win32_get_host_data(char *nameId) +{ + dTHX; + dPERLOBJ; + struct host_link *link = w32_host_link; + while(link) { + if(strEQ(link->nameId, nameId)) + return link->host_data; + link = link->next; + } + return Nullch; +} + /* * Extras. */ @@ -3171,6 +3248,7 @@ Perl_init_os_extras(pTHX) { char *file = __FILE__; dXSUB_SYS; + dPERLOBJ; w32_perlshell_tokens = Nullch; w32_perlshell_items = -1; @@ -3251,3 +3329,4 @@ win32_strip_return(SV *sv) } #endif + diff --git a/win32/win32.h b/win32/win32.h index c688ee9f16..ee25b5afce 100644 --- a/win32/win32.h +++ b/win32/win32.h @@ -188,7 +188,10 @@ typedef long gid_t; typedef unsigned short mode_t; #pragma warning(disable: 4018 4035 4101 4102 4244 4245 4761) -#ifndef PERL_OBJECT +#ifdef PERL_OBJECT +extern CPerlObj* GetPerlInter(void); +#define dPERLOBJ CPerlObj* pPerl = GetPerlInter() +#else /* PERL_OBJECT */ /* Visual C thinks that a pointer to a member variable is 16 bytes in size. */ #define STRUCT_MGVTBL_DEFINITION \ @@ -235,6 +238,8 @@ struct mgvtbl { \ char handle_VC_problem[16]; \ } + +#define dPERLOBJ #endif /* PERL_OBJECT */ #endif /* _MSC_VER */ @@ -345,6 +350,12 @@ typedef struct { DWORD pids[MAXIMUM_WAIT_OBJECTS]; } child_tab; +struct host_link { + char * nameId; + void * host_data; + struct host_link * next; +}; + struct interp_intern { char * perlshell_tokens; char ** perlshell_vec; @@ -352,6 +363,7 @@ struct interp_intern { struct av * fdpid; child_tab * children; HANDLE child_handles[MAXIMUM_WAIT_OBJECTS]; + struct host_link * hostlist; }; @@ -363,6 +375,7 @@ struct interp_intern { #define w32_num_children (w32_children->num) #define w32_child_pids (w32_children->pids) #define w32_child_handles (PL_sys_intern.child_handles) +#define w32_host_link (PL_sys_intern.hostlist) /* * Now Win32 specific per-thread data stuff @@ -395,15 +408,13 @@ struct thread_intern { /* Use CP_ACP when mode is ANSI */ /* Use CP_UTF8 when mode is UTF8 */ -#define A2WHELPER(lpa, lpw, nChars, acp)\ - lpw[0] = 0, MultiByteToWideChar(acp, 0, lpa, -1, lpw, nChars) +#define A2WHELPER(lpa, lpw, nChars)\ + lpw[0] = 0, MultiByteToWideChar((IN_UTF8) ? CP_UTF8 : CP_ACP, 0, lpa, -1, lpw, nChars) -#define W2AHELPER(lpw, lpa, nChars, acp)\ - lpa[0] = '\0', WideCharToMultiByte(acp, 0, lpw, -1, lpa, nChars, NULL, NULL) +#define W2AHELPER(lpw, lpa, nChars)\ + lpa[0] = '\0', WideCharToMultiByte((IN_UTF8) ? CP_UTF8 : CP_ACP, 0, lpw, -1, (LPSTR)lpa, nChars, NULL, NULL) -/* place holders for now */ -#define USING_WIDE() (IsWinNT()) -#define GETINTERPMODE() (IN_UTF8) +#define USING_WIDE() (PerlEnv_os_id() == VER_PLATFORM_WIN32_NT) /* * This provides a layer of functions and macros to ensure extensions will diff --git a/win32/win32iop.h b/win32/win32iop.h index bcdc304511..e294e73109 100644 --- a/win32/win32iop.h +++ b/win32/win32iop.h @@ -129,6 +129,8 @@ DllExport int win32_uname(struct utsname *n); DllExport int win32_wait(int *status); DllExport int win32_waitpid(int pid, int *status, int flags); DllExport int win32_kill(int pid, int sig); +DllExport unsigned long win32_os_id(void); +DllExport void* win32_dynaload(const char*filename); #if defined(HAVE_DES_FCRYPT) || defined(PERL_OBJECT) DllExport char * win32_crypt(const char *txt, const char *salt); @@ -276,6 +278,7 @@ END_EXTERN_C #define seekdir win32_seekdir #define rewinddir win32_rewinddir #define closedir win32_closedir +#define os_id win32_os_id #ifdef HAVE_DES_FCRYPT #undef crypt diff --git a/win32/win32sck.c b/win32/win32sck.c index 8bd6b6cfd5..abc6334d72 100644 --- a/win32/win32sck.c +++ b/win32/win32sck.c @@ -20,7 +20,6 @@ #if defined(PERL_OBJECT) #define NO_XSLOCKS -extern CPerlObj* pPerl; #include "XSUB.h" #endif @@ -96,6 +95,7 @@ start_sockets(void) unsigned short version; WSADATA retdata; int ret; + dPERLOBJ; /* * initalize the winsock interface and insure that it is @@ -523,6 +523,7 @@ win32_ioctl(int i, unsigned int u, char *data) { u_long argp = (u_long)data; int retval; + dPERLOBJ; if (!wsock_started) { Perl_croak_nocontext("ioctl implemented only on sockets"); @@ -561,24 +562,28 @@ win32_inet_addr(const char FAR *cp) void win32_endhostent() { + dPERLOBJ; Perl_croak_nocontext("endhostent not implemented!\n"); } void win32_endnetent() { + dPERLOBJ; Perl_croak_nocontext("endnetent not implemented!\n"); } void win32_endprotoent() { + dPERLOBJ; Perl_croak_nocontext("endprotoent not implemented!\n"); } void win32_endservent() { + dPERLOBJ; Perl_croak_nocontext("endservent not implemented!\n"); } @@ -586,6 +591,7 @@ win32_endservent() struct netent * win32_getnetent(void) { + dPERLOBJ; Perl_croak_nocontext("getnetent not implemented!\n"); return (struct netent *) NULL; } @@ -593,6 +599,7 @@ win32_getnetent(void) struct netent * win32_getnetbyname(char *name) { + dPERLOBJ; Perl_croak_nocontext("getnetbyname not implemented!\n"); return (struct netent *)NULL; } @@ -600,6 +607,7 @@ win32_getnetbyname(char *name) struct netent * win32_getnetbyaddr(long net, int type) { + dPERLOBJ; Perl_croak_nocontext("getnetbyaddr not implemented!\n"); return (struct netent *)NULL; } @@ -607,6 +615,7 @@ win32_getnetbyaddr(long net, int type) struct protoent * win32_getprotoent(void) { + dPERLOBJ; Perl_croak_nocontext("getprotoent not implemented!\n"); return (struct protoent *) NULL; } @@ -614,6 +623,7 @@ win32_getprotoent(void) struct servent * win32_getservent(void) { + dPERLOBJ; Perl_croak_nocontext("getservent not implemented!\n"); return (struct servent *) NULL; } @@ -621,6 +631,7 @@ win32_getservent(void) void win32_sethostent(int stayopen) { + dPERLOBJ; Perl_croak_nocontext("sethostent not implemented!\n"); } @@ -628,6 +639,7 @@ win32_sethostent(int stayopen) void win32_setnetent(int stayopen) { + dPERLOBJ; Perl_croak_nocontext("setnetent not implemented!\n"); } @@ -635,6 +647,7 @@ win32_setnetent(int stayopen) void win32_setprotoent(int stayopen) { + dPERLOBJ; Perl_croak_nocontext("setprotoent not implemented!\n"); } @@ -642,6 +655,7 @@ win32_setprotoent(int stayopen) void win32_setservent(int stayopen) { + dPERLOBJ; Perl_croak_nocontext("setservent not implemented!\n"); } |