From: Gurusamy Sarathy Date: Fri, 17 Apr 1998 02:13:58 +0000 (+0000) Subject: [win32] support POSIX, enable more locale tests X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=6dead956033b9cd9214b9fa427a6432180c1bcd5;p=p5sagit%2Fp5-mst-13.2.git [win32] support POSIX, enable more locale tests p4raw-id: //depot/win32/perl@889 --- diff --git a/ext/POSIX/Makefile.PL b/ext/POSIX/Makefile.PL index 3359d17..bc1dda9 100644 --- a/ext/POSIX/Makefile.PL +++ b/ext/POSIX/Makefile.PL @@ -1,7 +1,7 @@ use ExtUtils::MakeMaker; WriteMakefile( NAME => 'POSIX', - LIBS => ["-lm -lposix -lcposix"], + ($^O eq 'MSWin32' ? () : (LIBS => ["-lm -lposix -lcposix"])), MAN3PODS => ' ', # Pods will be built by installman. XSPROTOARG => '-noprototypes', # XXX remove later? VERSION_FROM => 'POSIX.pm', diff --git a/ext/POSIX/POSIX.pm b/ext/POSIX/POSIX.pm index 33dc73d..32010d6 100644 --- a/ext/POSIX/POSIX.pm +++ b/ext/POSIX/POSIX.pm @@ -827,7 +827,14 @@ sub fork { sub getcwd { usage "getcwd()" if @_ != 0; - chop($cwd = `pwd`); + if ($^O eq 'MSWin32') { + # this perhaps applies to everyone else also? + require Cwd; + $cwd = &Cwd::cwd; + } + else { + chop($cwd = `pwd`); + } $cwd; } diff --git a/ext/POSIX/POSIX.xs b/ext/POSIX/POSIX.xs index 922438d..e1d6833 100644 --- a/ext/POSIX/POSIX.xs +++ b/ext/POSIX/POSIX.xs @@ -1,3 +1,6 @@ +#ifdef WIN32 +#define _POSIX_ +#endif #include "EXTERN.h" #define PERLIO_NOT_STDIO 1 #include "perl.h" @@ -40,7 +43,9 @@ #include #include #include +#ifdef I_UNISTD #include /* see hints/sunos_4_1.sh */ +#endif #include #if defined(__VMS) && !defined(__POSIX_SOURCE) @@ -91,6 +96,28 @@ } # define times(t) vms_times(t) #else +#if defined (WIN32) +# undef mkfifo /* #defined in perl.h */ +# define mkfifo(a,b) not_here("mkfifo") +# define ttyname(a) not_here("ttyname") +# define sigset_t long +# define pid_t long +# ifdef __BORLANDC__ +# define tzname _tzname +# endif +# ifdef _MSC_VER +# define mode_t short +# endif +# define sigaction(a,b,c) not_here("sigaction") +# define sigpending(a) not_here("sigpending") +# define sigprocmask(a,b,c) not_here("sigprocmask") +# define sigsuspend(a) not_here("sigsuspend") +# define sigemptyset(a) not_here("sigemptyset") +# define sigaddset(a,b) not_here("sigaddset") +# define sigdelset(a,b) not_here("sigdelset") +# define sigfillset(a) not_here("sigfillset") +# define sigismember(a,b) not_here("sigismember") +#else # include # include # ifdef HAS_UNAME @@ -100,7 +127,8 @@ # ifdef I_UTIME # include # endif -#endif +#endif /* WIN32 */ +#endif /* __VMS */ typedef int SysRet; typedef long SysRetLong; @@ -227,11 +255,13 @@ unsigned long strtoul _((const char *, char **, int)); #define localeconv() not_here("localeconv") #endif +#ifndef WIN32 #ifdef HAS_TZNAME extern char *tzname[]; #else char *tzname[] = { "" , "" }; #endif +#endif /* XXX struct tm on some systems (SunOS4/BSD) contains extra (non POSIX) * fields for which we don't have Configure support yet: @@ -3102,7 +3132,9 @@ sigaction(sig, action, oldaction = 0) POSIX::SigAction action POSIX::SigAction oldaction CODE: - +#ifdef WIN32 + RETVAL = not_here("sigaction"); +#else # This code is really grody because we're trying to make the signal # interface look beautiful, which is hard. @@ -3181,6 +3213,7 @@ sigaction(sig, action, oldaction = 0) sv_setiv(*svp, oact.sa_flags); } } +#endif OUTPUT: RETVAL diff --git a/t/lib/posix.t b/t/lib/posix.t index d63e695..c071c3b 100755 --- a/t/lib/posix.t +++ b/t/lib/posix.t @@ -16,6 +16,8 @@ use strict subs; $| = 1; print "1..18\n"; +$Is_W32 = $^O eq 'MSWin32'; + $testfd = open("TEST", O_RDONLY, 0) and print "ok 1\n"; read($testfd, $buffer, 9) if $testfd > 2; print $buffer eq "#!./perl\n" ? "ok 2\n" : "not ok 2\n"; @@ -31,6 +33,12 @@ close $writer; print <$reader>; close $reader; +if ($Is_W32) { + for (6..11) { + print "ok $_ # skipped, no sigaction support on win32\n"; + } +} +else { $sigset = new POSIX::SigSet 1,3; delset $sigset 1; if (!ismember $sigset 1) { print "ok 6\n" } @@ -53,6 +61,7 @@ sub SigHUP { sub SigINT { print "ok 10\n"; } +} print &_POSIX_OPEN_MAX > $fds[1] ? "ok 12\n" : "not ok 12\n"; diff --git a/t/pragma/locale.t b/t/pragma/locale.t index 8875f7c..bd5267d 100755 --- a/t/pragma/locale.t +++ b/t/pragma/locale.t @@ -19,6 +19,9 @@ eval { $have_setlocale++; }; +# Visual C's CRT goes silly on strings of the form "en_US.ISO8859-1" +$have_setlocale = 0 if $^O eq 'MSWin32' && $Config{cc} =~ /^cl/i; + print "1..", ($have_setlocale ? 102 : 98), "\n"; use vars qw($a diff --git a/win32/Makefile b/win32/Makefile index 951c15a..c2c47c8 100644 --- a/win32/Makefile +++ b/win32/Makefile @@ -329,7 +329,7 @@ CORE_H = ..\av.h \ .\include\sys\socket.h \ .\win32.h -DYNAMIC_EXT=Socket IO Fcntl Opcode SDBM_File attrs Thread B +DYNAMIC_EXT=Socket IO Fcntl Opcode SDBM_File POSIX attrs Thread B STATIC_EXT=DynaLoader DYNALOADER=$(EXTDIR)\DynaLoader\DynaLoader @@ -338,6 +338,7 @@ FCNTL=$(EXTDIR)\Fcntl\Fcntl OPCODE=$(EXTDIR)\Opcode\Opcode SDBM_FILE=$(EXTDIR)\SDBM_File\SDBM_File IO=$(EXTDIR)\IO\IO +POSIX=$(EXTDIR)\POSIX\POSIX ATTRS=$(EXTDIR)\attrs\attrs THREAD=$(EXTDIR)\Thread\Thread B=$(EXTDIR)\B\B @@ -347,6 +348,7 @@ FCNTL_DLL=..\lib\auto\Fcntl\Fcntl.dll OPCODE_DLL=..\lib\auto\Opcode\Opcode.dll SDBM_FILE_DLL=..\lib\auto\SDBM_File\SDBM_File.dll IO_DLL=..\lib\auto\IO\IO.dll +POSIX_DLL=..\lib\auto\POSIX\POSIX.dll ATTRS_DLL=..\lib\auto\attrs\attrs.dll THREAD_DLL=..\lib\auto\Thread\Thread.dll B_DLL=..\lib\auto\B\B.dll @@ -358,6 +360,7 @@ DYNALOADMODULES= \ $(OPCODE_DLL) \ $(SDBM_FILE_DLL)\ $(IO_DLL) \ + $(POSIX_DLL) \ $(ATTRS_DLL) \ $(THREAD_DLL) \ $(B_DLL) @@ -515,6 +518,12 @@ $(ATTRS_DLL): $(PERLEXE) $(ATTRS).xs $(MAKE) cd ..\..\win32 +$(POSIX_DLL): $(PERLEXE) $(POSIX).xs + cd $(EXTDIR)\$(*B) + ..\..\miniperl -I..\..\lib Makefile.PL INSTALLDIRS=perl + $(MAKE) + cd ..\..\win32 + $(IO_DLL): $(PERLEXE) $(CONFIGPM) $(IO).xs cd $(EXTDIR)\$(*B) ..\..\miniperl -I..\..\lib Makefile.PL INSTALLDIRS=perl @@ -571,9 +580,9 @@ distclean: clean $(PERLIMPLIB) ..\miniperl.lib $(MINIMOD) -del /f *.def *.map -del /f $(SOCKET_DLL) $(IO_DLL) $(SDBM_FILE_DLL) $(FCNTL_DLL) \ - $(OPCODE_DLL) $(ATTRS_DLL) $(THREAD_DLL) $(B_DLL) + $(OPCODE_DLL) $(POSIX_DLL) $(ATTRS_DLL) $(THREAD_DLL) $(B_DLL) -del /f $(SOCKET).c $(IO).c $(SDBM_FILE).c $(FCNTL).c $(OPCODE).c \ - $(DYNALOADER).c $(ATTRS).c $(THREAD).c $(B).c + $(DYNALOADER).c $(POSIX).c $(ATTRS).c $(THREAD).c $(B).c -del /f $(PODDIR)\*.html -del /f $(PODDIR)\*.bat -del /f ..\config.sh ..\splittree.pl perlmain.c dlutils.c \ @@ -585,12 +594,18 @@ distclean: clean -del /s *.lib *.def *.map *.bs Makefile *$(o) pm_to_blib cd ..\win32 -install : all doc utils +install : all installbare installutils installhtml + +installbare : $(PERLEXE) ..\installperl $(XCOPY) $(PERL95EXE) $(INST_BIN)\*.* + +installutils : utils $(XCOPY) $(GLOBEXE) $(INST_BIN)\*.* $(XCOPY) bin\*.bat $(INST_BIN)\*.* $(XCOPY) ..\pod\*.bat $(INST_BIN)\*.* + +installhtml : doc $(RCOPY) html\*.* $(INST_HTML)\*.* inst_lib : $(CONFIGPM) diff --git a/win32/makedef.pl b/win32/makedef.pl index c6af1a0..4cd93b6 100644 --- a/win32/makedef.pl +++ b/win32/makedef.pl @@ -389,6 +389,11 @@ perl_call_sv perl_require_pv perl_eval_pv perl_eval_sv +perl_new_ctype +perl_new_collate +perl_new_numeric +perl_set_numeric_standard +perl_set_numeric_local boot_DynaLoader Perl_thread_create win32_errno diff --git a/win32/makefile.mk b/win32/makefile.mk index 6fc9005..e2c1e6f 100644 --- a/win32/makefile.mk +++ b/win32/makefile.mk @@ -440,7 +440,7 @@ CORE_H = ..\av.h \ .\include\sys\socket.h \ .\win32.h -DYNAMIC_EXT=Socket IO Fcntl Opcode SDBM_File attrs Thread B +DYNAMIC_EXT=Socket IO Fcntl Opcode SDBM_File POSIX attrs Thread B STATIC_EXT=DynaLoader DYNALOADER=$(EXTDIR)\DynaLoader\DynaLoader @@ -449,6 +449,7 @@ FCNTL=$(EXTDIR)\Fcntl\Fcntl OPCODE=$(EXTDIR)\Opcode\Opcode SDBM_FILE=$(EXTDIR)\SDBM_File\SDBM_File IO=$(EXTDIR)\IO\IO +POSIX=$(EXTDIR)\POSIX\POSIX ATTRS=$(EXTDIR)\attrs\attrs THREAD=$(EXTDIR)\Thread\Thread B=$(EXTDIR)\B\B @@ -458,6 +459,7 @@ FCNTL_DLL=..\lib\auto\Fcntl\Fcntl.dll OPCODE_DLL=..\lib\auto\Opcode\Opcode.dll SDBM_FILE_DLL=..\lib\auto\SDBM_File\SDBM_File.dll IO_DLL=..\lib\auto\IO\IO.dll +POSIX_DLL=..\lib\auto\POSIX\POSIX.dll ATTRS_DLL=..\lib\auto\attrs\attrs.dll THREAD_DLL=..\lib\auto\Thread\Thread.dll B_DLL=..\lib\auto\B\B.dll @@ -469,6 +471,7 @@ DYNALOADMODULES= \ $(OPCODE_DLL) \ $(SDBM_FILE_DLL)\ $(IO_DLL) \ + $(POSIX_DLL) \ $(ATTRS_DLL) \ $(THREAD_DLL) \ $(B_DLL) @@ -697,6 +700,11 @@ $(ATTRS_DLL): $(PERLEXE) $(ATTRS).xs ..\..\miniperl -I..\..\lib Makefile.PL INSTALLDIRS=perl cd $(EXTDIR)\$(*B) && $(MAKE) +$(POSIX_DLL): $(PERLEXE) $(POSIX).xs + cd $(EXTDIR)\$(*B) && \ + ..\..\miniperl -I..\..\lib Makefile.PL INSTALLDIRS=perl + cd $(EXTDIR)\$(*B) && $(MAKE) + $(IO_DLL): $(PERLEXE) $(IO).xs cd $(EXTDIR)\$(*B) && \ ..\..\miniperl -I..\..\lib Makefile.PL INSTALLDIRS=perl @@ -744,9 +752,9 @@ distclean: clean $(PERLIMPLIB) ..\miniperl.lib $(MINIMOD) -del /f *.def *.map -del /f $(SOCKET_DLL) $(IO_DLL) $(SDBM_FILE_DLL) $(FCNTL_DLL) \ - $(OPCODE_DLL) $(ATTRS_DLL) $(THREAD_DLL) $(B_DLL) + $(OPCODE_DLL) $(POSIX_DLL) $(ATTRS_DLL) $(THREAD_DLL) $(B_DLL) -del /f $(SOCKET).c $(IO).c $(SDBM_FILE).c $(FCNTL).c $(OPCODE).c \ - $(DYNALOADER).c $(ATTRS).c $(THREAD).c $(B).c + $(DYNALOADER).c $(POSIX).c $(ATTRS).c $(THREAD).c $(B).c -del /f $(PODDIR)\*.html -del /f $(PODDIR)\*.bat -del /f ..\config.sh ..\splittree.pl perlmain.c dlutils.c config.h.new @@ -758,14 +766,20 @@ distclean: clean -rmdir /s /q ..\lib\auto || rmdir /s ..\lib\auto -rmdir /s /q $(COREDIR) || rmdir /s $(COREDIR) -install : all doc utils +install : all installbare installutils installhtml + +installbare : $(PERLEXE) ..\installperl .IF "$(PERL95EXE)" != "" $(XCOPY) $(PERL95EXE) $(INST_BIN)\*.* .ENDIF + +installutils : utils $(XCOPY) $(GLOBEXE) $(INST_BIN)\*.* $(XCOPY) bin\*.bat $(INST_BIN)\*.* $(XCOPY) ..\pod\*.bat $(INST_BIN)\*.* + +installhtml : doc $(RCOPY) html\*.* $(INST_HTML)\*.* inst_lib : $(CONFIGPM)