warnings.pl Program to write warnings.h and lib/warnings.pm
win32/Makefile Win32 makefile for NMAKE (Visual C++ build)
win32/bin/exetype.pl Set executable type to CONSOLE or WINDOWS
+win32/bin/mdelete.bat multifile delete
win32/bin/perlglob.pl Win32 globbing
win32/bin/pl2bat.pl wrap perl scripts into batch files
win32/bin/runperl.pl run perl script via batch file namesake
use ExtUtils::MakeMaker;
+use Config;\r
# The existence of the ./sdbm/Makefile.PL file causes MakeMaker
# to automatically include Makefile code for the targets
sub MY::postamble {
if ($^O =~ /MSWin32/ && Win32::IsWin95()) {
- # XXX: dmake-specific, like rest of Win95 port
- return
- '
+ if ($Config{'make'} =~ /dmake/i) {\r
+ # dmake-specific\r
+ return <<EOT;\r
$(MYEXTLIB): sdbm/Makefile
@[
cd sdbm
$(MAKE) all
cd ..
]
-';
- }
- elsif ($^O ne 'VMS') {
+EOT\r
+ } elsif ($Config{'make'} =~ /nmake/i) {\r
+ #\r
+ return <<'EOT';\r
+$(MYEXTLIB): sdbm/Makefile\r
+ cd sdbm\r
+ $(MAKE) all\r
+ cd ..\r
+EOT\r
+ } \r
+ } elsif ($^O ne 'VMS') {\r
'
$(MYEXTLIB): sdbm/Makefile
cd sdbm && $(MAKE) all
my($self, $subdir) = @_;
my(@m);
if ($Is_Win32 && Win32::IsWin95()) {
- # XXX: dmake-specific, like rest of Win95 port
- return <<EOT;
+ if ($Config{'make'} =~ /dmake/i) {\r
+ # dmake-specific\r
+ return <<EOT;\r
subdirs ::
@[
cd $subdir
cd ..
]
EOT
- }
- else {
+ } elsif ($Config{'make'} =~ /nmake/i) {\r
+ # nmake-specific\r
+ return <<EOT;\r
+subdirs ::\r
+ cd $subdir\r
+ \$(MAKE) all \$(PASTHRU)\r
+ cd ..\r
+EOT\r
+ }\r
+ } else {\r
return <<EOT;
subdirs ::
}
elsif ($PLATFORM eq 'win32') {
$CCTYPE = "MSVC" unless defined $CCTYPE;
- foreach ($thrdvar_h, $intrpvar_h, $perlvars_h, $global_sym, $pp_sym, $globvar_sym) {
+ foreach ($thrdvar_h, $intrpvar_h, $perlvars_h, $global_sym,\r
+ $pp_sym, $globvar_sym, $perlio_sym) {\r
s!^!..\\!;
}
}
if ($PLATFORM eq 'win32') {
foreach my $symbol (qw(
+ setuid\r
+ setgid\r
boot_DynaLoader
Perl_init_os_extras
Perl_thread_create
RunPerl
win32_errno
win32_environ
- win32_stdin
- win32_stdout
- win32_stderr
- win32_ferror
- win32_feof
- win32_strerror
- win32_fprintf
- win32_printf
- win32_vfprintf
- win32_vprintf
- win32_fread
- win32_fwrite
- win32_fopen
- win32_fdopen
- win32_freopen
- win32_fclose
- win32_fputs
- win32_fputc
- win32_ungetc
- win32_getc
- win32_fileno
- win32_clearerr
- win32_fflush
- win32_ftell
- win32_fseek
- win32_fgetpos
- win32_fsetpos
- win32_rewind
- win32_tmpfile
win32_abort
win32_fstat
win32_stat
win32_getenv
win32_putenv
win32_perror
- win32_setbuf
- win32_setvbuf
- win32_flushall
- win32_fcloseall
- win32_fgets
- win32_gets
- win32_fgetc
- win32_putc
- win32_puts
- win32_getchar
- win32_putchar
win32_malloc
win32_calloc
win32_realloc
win32_getpid
win32_crypt
win32_dynaload
+\r
+ win32_stdin\r
+ win32_stdout\r
+ win32_stderr\r
+ win32_ferror\r
+ win32_feof\r
+ win32_strerror\r
+ win32_fprintf\r
+ win32_printf\r
+ win32_vfprintf\r
+ win32_vprintf\r
+ win32_fread\r
+ win32_fwrite\r
+ win32_fopen\r
+ win32_fdopen\r
+ win32_freopen\r
+ win32_fclose\r
+ win32_fputs\r
+ win32_fputc\r
+ win32_ungetc\r
+ win32_getc\r
+ win32_fileno\r
+ win32_clearerr\r
+ win32_fflush\r
+ win32_ftell\r
+ win32_fseek\r
+ win32_fgetpos\r
+ win32_fsetpos\r
+ win32_rewind\r
+ win32_tmpfile\r
+ win32_setbuf\r
+ win32_setvbuf\r
+ win32_flushall\r
+ win32_fcloseall\r
+ win32_fgets\r
+ win32_gets\r
+ win32_fgetc\r
+ win32_putc\r
+ win32_puts\r
+ win32_getchar\r
+ win32_putchar\r
))
{
try_symbol($symbol);
static int dbg = 0;
if (!dbg)
{
- char *s = getenv("PERLIO_DEBUG");
+ char *s = PerlEnv_getenv("PERLIO_DEBUG");\r
if (s && *s)
- dbg = open(s,O_WRONLY|O_CREAT|O_APPEND,0666);
+ dbg = PerlLIO_open3(s,O_WRONLY|O_CREAT|O_APPEND,0666);\r
else
dbg = -1;
}
Perl_sv_vcatpvf(aTHX_ sv, fmt, &ap);
s = SvPV(sv,len);
- write(dbg,s,len);
+ PerlLIO_write(dbg,s,len);\r
va_end(ap);
SvREFCNT_dec(sv);
}
int len;
if (!PerlIO_layer_hv)
{
- char *s = getenv("PERLIO");
+ char *s = PerlEnv_getenv("PERLIO");\r
newXS("perlio::import",XS_perlio_import,__FILE__);
newXS("perlio::unimport",XS_perlio_unimport,__FILE__);
PerlIO_layer_hv = get_hv("perlio::layers",GV_ADD|GV_ADDMULTI);
{
while (*s)
{
- while (*s && isspace((unsigned char)*s))
+ while (*s && isSPACE((unsigned char)*s))\r
s++;
if (*s)
{
char *e = s;
SV *layer;
- while (*e && !isspace((unsigned char)*e))
+ while (*e && !isSPACE((unsigned char)*e))\r
e++;
layer = PerlIO_find_layer(s,e-s);
if (layer)
int oflags = PerlIOUnix_oflags(mode);
if (oflags != -1)
{
- int fd = open(path,oflags,0666);
+ int fd = PerlLIO_open3(path,oflags,0666);\r
if (fd >= 0)
{
PerlIOUnix *s = PerlIOSelf(PerlIO_push(f = PerlIO_allocate(),self,mode),PerlIOUnix);
(*PerlIOBase(f)->tab->Close)(f);
if (oflags != -1)
{
- int fd = open(path,oflags,0666);
+ int fd = PerlLIO_open3(path,oflags,0666);\r
if (fd >= 0)
{
s->fd = fd;
return 0;
while (1)
{
- SSize_t len = read(fd,vbuf,count);
+ SSize_t len = PerlLIO_read(fd,vbuf,count);\r
if (len >= 0 || errno != EINTR)
{
if (len < 0)
int fd = PerlIOSelf(f,PerlIOUnix)->fd;
while (1)
{
- SSize_t len = write(fd,vbuf,count);
+ SSize_t len = PerlLIO_write(fd,vbuf,count);\r
if (len >= 0 || errno != EINTR)
{
if (len < 0)
IV
PerlIOUnix_seek(PerlIO *f, Off_t offset, int whence)
{
- Off_t new = lseek(PerlIOSelf(f,PerlIOUnix)->fd,offset,whence);
+ Off_t new = PerlLIO_lseek(PerlIOSelf(f,PerlIOUnix)->fd,offset,whence);\r
PerlIOBase(f)->flags &= ~PERLIO_F_EOF;
return (new == (Off_t) -1) ? -1 : 0;
}
Off_t
PerlIOUnix_tell(PerlIO *f)
{
- return lseek(PerlIOSelf(f,PerlIOUnix)->fd,0,SEEK_CUR);
+ return PerlLIO_lseek(PerlIOSelf(f,PerlIOUnix)->fd,0,SEEK_CUR);\r
}
IV
{
int fd = PerlIOSelf(f,PerlIOUnix)->fd;
int code = 0;
- while (close(fd) != 0)
+ while (PerlLIO_close(fd) != 0)\r
{
if (errno != EINTR)
{
{
PerlIOBase(f)->flags |= PERLIO_F_TEMP;
}
- unlink(SvPVX(sv));
+ PerlLIO_unlink(SvPVX(sv));\r
SvREFCNT_dec(sv);
}
return f;
#USE_IMP_SYS = define
#
+# uncomment to enable the experimental PerlIO I/O subsystem.\r
+# This is currently incompatible with USE_MULTI, USE_ITHREADS,\r
+# and USE_IMP_SYS\r
+#USE_PERLIO = define\r
+\r
+#\r
# WARNING! This option is deprecated and will eventually go away (enable
# USE_ITHREADS instead).
#
!IF "$(USE_MULTI)" == "define"
ARCHNAME = MSWin32-$(PROCESSOR_ARCHITECTURE)-multi
!ELSE
+!IF "$(USE_PERLIO)" == "define"\r
+ARCHNAME = MSWin32-$(PROCESSOR_ARCHITECTURE)-perlio\r
+!ELSE\r
ARCHNAME = MSWin32-$(PROCESSOR_ARCHITECTURE)
!ENDIF
!ENDIF
!ENDIF
+!ENDIF\r
+\r
+!IF "$(USE_PERLIO)" == "define"\r
+BUILDOPT = $(BUILDOPT) -DUSE_PERLIO\r
+!ENDIF\r
!IF "$(USE_ITHREADS)" == "define"
ARCHNAME = $(ARCHNAME)-thread
NOOP = @echo
NULL =
+DEL = bin\mdelete.bat\r
+\r
#
# filenames given to xsubpp must have forward slashes (since it puts
# full pathnames in #line strings)
"INST_ARCH=$(INST_ARCH)" \
"archname=$(ARCHNAME)" \
"cc=$(CC)" \
- "ccflags=$(OPTIMIZE:"=\") $(DEFINES) $(BUILDOPT)" \
- "cf_email=$(EMAIL)" \
+ "ccflags=-nologo -Gf -W3 $(OPTIMIZE:"=\") $(DEFINES) $(BUILDOPT)" \\r
+ "cf_email=$(EMAIL)" \\r
"d_crypt=$(D_CRYPT)" \
"d_mymalloc=$(PERL_MALLOC)" \
"libs=$(LIBFILES)" \
rename config.h $(CFGH_TMPL)
$(CONFIGPM) : $(MINIPERL) ..\config.sh config_h.PL ..\minimod.pl
- cd .. && miniperl configpm
+ cd .. \r
+ miniperl configpm\r
+ cd win32\r
if exist lib\* $(RCOPY) lib\*.* ..\lib\$(NULL)
$(XCOPY) ..\*.h $(COREDIR)\*.*
$(XCOPY) *.h $(COREDIR)\*.*
$(XCOPY) ..\ext\re\re.pm $(LIBDIR)\*.*
$(RCOPY) include $(COREDIR)\*.*
- $(MINIPERL) -I..\lib config_h.PL "INST_VER=$(INST_VER)" \
- || $(MAKE) /$(MAKEFLAGS) $(CONFIGPM)
+ -$(MINIPERL) -I..\lib config_h.PL "INST_VER=$(INST_VER)"\r
+ if errorlevel 1 $(MAKE) /$(MAKEFLAGS) $(CONFIGPM)\r
$(MINIPERL) : $(MINIDIR) $(MINI_OBJ)
$(LINK32) -subsystem:console -out:$@ @<<
$(XCOPY) $(PERLIMPLIB) $(COREDIR)
$(MINIMOD) : $(MINIPERL) ..\minimod.pl
- cd .. && miniperl minimod.pl > lib\ExtUtils\Miniperl.pm
+ cd .. \r
+ miniperl minimod.pl > lib\ExtUtils\Miniperl.pm\r
+ cd win32\r
..\x2p\a2p$(o) : ..\x2p\a2p.c
$(CC) -I..\x2p $(CFLAGS) $(OBJOUT_FLAG)$@ -c ..\x2p\a2p.c
-del /f $(LIBDIR)\Devel\Peek.pm $(LIBDIR)\Devel\DProf.pm
-del /f $(LIBDIR)\File\Glob.pm
-del /f $(LIBDIR)\Storable.pm
- -if exist $(LIBDIR)\IO rmdir /s /q $(LIBDIR)\IO || rmdir /s $(LIBDIR)\IO
- -if exist $(LIBDIR)\Thread rmdir /s /q $(LIBDIR)\Thread || rmdir /s $(LIBDIR)\Thread
- -if exist $(LIBDIR)\B rmdir /s /q $(LIBDIR)\B || rmdir /s $(LIBDIR)\B
- -if exist $(LIBDIR)\Data rmdir /s /q $(LIBDIR)\Data || rmdir /s $(LIBDIR)\Data
+ -if exist $(LIBDIR)\IO rmdir /s /q $(LIBDIR)\IO \r
+ -rmdir /s $(LIBDIR)\IO\r
+ -if exist $(LIBDIR)\Thread rmdir /s /q $(LIBDIR)\Thread \r
+ -rmdir /s $(LIBDIR)\Thread\r
+ -if exist $(LIBDIR)\B rmdir /s /q $(LIBDIR)\B\r
+ -rmdir /s $(LIBDIR)\B\r
+ -if exist $(LIBDIR)\Data rmdir /s /q $(LIBDIR)\Data \r
+ -rmdir /s $(LIBDIR)\Data\r
-del /f $(PODDIR)\*.html
-del /f $(PODDIR)\*.bat
cd ..\utils
cd $(EXTDIR)
-del /s *.lib *.def *.map *.pdb *.bs Makefile *$(o) pm_to_blib
cd ..\win32
- -if exist $(AUTODIR) rmdir /s /q $(AUTODIR) || rmdir /s $(AUTODIR)
- -if exist $(COREDIR) rmdir /s /q $(COREDIR) || rmdir /s $(COREDIR)
+ -if exist $(AUTODIR) rmdir /s /q $(AUTODIR) \r
+ -rmdir /s $(AUTODIR)\r
+ -if exist $(COREDIR) rmdir /s /q $(COREDIR) \r
+ -rmdir /s $(COREDIR)\r
install : all installbare installhtml
cd ..\win32
clean :
- -@erase miniperlmain$(o)
- -@erase $(MINIPERL)
- -@erase perlglob$(o)
- -@erase perlmain$(o)
- -@erase config.w32
- -@erase /f config.h
- -@erase $(GLOBEXE)
- -@erase $(PERLEXE)
- -@erase $(WPERLEXE)
- -@erase $(PERLDLL)
- -@erase $(CORE_OBJ)
- -if exist $(MINIDIR) rmdir /s /q $(MINIDIR) || rmdir /s $(MINIDIR)
- -@erase $(WIN32_OBJ)
- -@erase $(DLL_OBJ)
- -@erase $(X2P_OBJ)
- -@erase ..\*$(o) ..\*.lib ..\*.exp *$(o) *.lib *.exp *.res
- -@erase ..\t\*.exe ..\t\*.dll ..\t\*.bat
- -@erase ..\x2p\*.exe ..\x2p\*.bat
- -@erase *.ilk
- -@erase *.pdb
+ -@$(DEL) miniperlmain$(o)\r
+ -@$(DEL) $(MINIPERL)\r
+ -@$(DEL) perlglob$(o)\r
+ -@$(DEL) perlmain$(o)\r
+ -@$(DEL) config.w32\r
+ -@$(DEL) /f config.h\r
+ -@$(DEL) $(GLOBEXE)\r
+ -@$(DEL) $(PERLEXE)\r
+ -@$(DEL) $(WPERLEXE)\r
+ -@$(DEL) $(PERLDLL)\r
+ -@$(DEL) $(CORE_OBJ)\r
+ -if exist $(MINIDIR) deltree /y $(MINIDIR) \r
+ -@$(DEL) $(WIN32_OBJ)\r
+ -@$(DEL) $(DLL_OBJ)\r
+ -@$(DEL) $(X2P_OBJ)\r
+ -@$(DEL) ..\*$(o) ..\*.lib ..\*.exp *$(o) *.lib *.exp *.res\r
+ -@$(DEL) ..\t\*.exe ..\t\*.dll ..\t\*.bat\r
+ -@$(DEL) ..\x2p\*.exe ..\x2p\*.bat\r
+ -@$(DEL) *.ilk\r
+ -@$(DEL) *.pdb\r
# Handy way to run perlbug -ok without having to install and run the
# installed perlbug. We don't re-run the tests here - we trust the user.
--- /dev/null
+@echo off\r
+rem ! This is a batch file to delete all the files on its\r
+rem ! command line, to work around command.com's del command's\r
+rem ! braindeadness\r
+rem !\r
+rem ! -- BKS, 11-11-2000\r
+\r
+:nextfile\r
+set file=%1\r
+shift\r
+if "%file%"=="" goto end\r
+del %file%\r
+goto nextfile\r
+:end\r
+\r
+@echo off\r
+rem ! This is a batch file to delete all the files on its\r
+rem ! command line, to work around command.com's del command's\r
+rem ! braindeadness\r
+rem !\r
+rem ! -- BKS, 11-11-2000\r
+\r
+:nextfile\r
+set file=%1\r
+shift\r
+if "%file%"=="" goto end\r
+del %file%\r
+goto nextfile\r
+:end\r
+\r
d_stdio_cnt_lval='define'
d_stdio_ptr_lval='define'
d_stdio_ptr_lval_sets_cnt='undef'
-d_stdio_ptr_lval_nochange_cnt='undef'
+d_stdio_ptr_lval_nochange_cnt='define'\r
d_stdio_stream_array='undef'
d_stdiobase='define'
d_stdstdio='define'
d_stdio_cnt_lval='define'
d_stdio_ptr_lval='define'
d_stdio_ptr_lval_sets_cnt='undef'
-d_stdio_ptr_lval_nochange_cnt='undef'
+d_stdio_ptr_lval_nochange_cnt='define'\r
d_stdio_stream_array='undef'
d_stdiobase='define'
d_stdstdio='define'
return 0;
}
+/*\r
+ * XXX this needs strengthening (for PerlIO)\r
+ * -- BKS, 11-11-200\r
+*/\r
+int mkstemp(const char *path)\r
+{\r
+ dTHX;\r
+ char buf[MAX_PATH+1];\r
+ int i = 0, fd = -1;\r
+\r
+retry:\r
+ if (i++ > 10) { /* give up */\r
+ errno = ENOENT;\r
+ return -1;\r
+ }\r
+ if (!GetTempFileNameA((LPCSTR)path, "plr", 1, buf)) {\r
+ errno = ENOENT;\r
+ return -1;\r
+ }\r
+ fd = PerlLIO_open3(buf, O_CREAT|O_RDWR|O_EXCL, 0600);\r
+ if (fd == -1)\r
+ goto retry;\r
+ return fd;\r
+}\r
+\r
static long
find_pid(int pid)
{
}
}
-
DllExport int
win32_fprintf(FILE *fp, const char *format, ...)
{
/*
* a popen() clone that respects PERL5SHELL
+ *\r
+ * changed to return PerlIO* rather than FILE * by BKS, 11-11-2000\r
*/
-DllExport FILE*
+DllExport PerlIO*\r
win32_popen(const char *command, const char *mode)
{
#ifdef USE_RTL_POPEN
}
/* we have an fd, return a file stream */
- return (win32_fdopen(p[parent], (char *)mode));
+#ifdef USE_PERLIO\r
+ return (PerlIO_fdopen(p[parent], (char *)mode));\r
+#else\r
+ return (fdopen(p[parent], (char *)mode));\r
+#endif\r
cleanup:
/* we don't need to check for errors here */
*/
DllExport int
-win32_pclose(FILE *pf)
+win32_pclose(PerlIO *pf)\r
{
#ifdef USE_RTL_POPEN
return _pclose(pf);
SV *sv;
LOCK_FDPID_MUTEX;
- sv = *av_fetch(w32_fdpid, win32_fileno(pf), TRUE);
+ sv = *av_fetch(w32_fdpid, PerlIO_fileno(pf), TRUE);\r
if (SvIOK(sv))
childpid = SvIVX(sv);
return -1;
}
- win32_fclose(pf);
+#ifdef USE_PERLIO\r
+ PerlIO_close(pf);\r
+#else\r
+ fclose(pf);\r
+#endif\r
SvIVX(sv) = 0;
UNLOCK_FDPID_MUTEX;
return open(PerlDir_mapA(path), flag, pmode);
}
+/* close() that understands socket */\r
+extern int my_close(int); /* in win32sck.c */\r
+\r
DllExport int
win32_close(int fd)
{
- return close(fd);
+ return my_close(fd);\r
}
DllExport int
extern void *sbrk(int need);
extern char * getlogin(void);
extern int chown(const char *p, uid_t o, gid_t g);
+extern int mkstemp(const char *path);\r
#undef Stat
#define Stat win32_stat
return s;
}
+/*\r
+ * close RTL fd while respecting sockets\r
+ * added as temporary measure until PerlIO has real\r
+ * Win32 native layer\r
+ * -- BKS, 11-11-2000\r
+*/\r
+\r
+int my_close(int fd)\r
+{\r
+ int osf;\r
+ if (!wsock_started) /* No WinSock? */\r
+ return(close(fd)); /* Then not a socket. */\r
+ osf = TO_SOCKET(fd);/* Get it now before it's gone! */\r
+ if (osf != -1) {\r
+ int err;\r
+ err = closesocket(osf);\r
+ if (err == 0) {\r
+#if defined(USE_FIXED_OSFHANDLE) || defined(PERL_MSVCRT_READFIX)\r
+ _set_osfhnd(fd, INVALID_HANDLE_VALUE);\r
+#endif\r
+ (void)close(fd); /* handle already closed, ignore error */\r
+ return 0;\r
+ }\r
+ else if (err == SOCKET_ERROR) {\r
+ err = WSAGetLastError();\r
+ if (err != WSAENOTSOCK) {\r
+ (void)close(fd);\r
+ errno = err;\r
+ return EOF;\r
+ }\r
+ }\r
+ }\r
+ return close(fd);\r
+}\r
+\r
#undef fclose
int
my_fclose (FILE *pf)
int osf;
if (!wsock_started) /* No WinSock? */
return(fclose(pf)); /* Then not a socket. */
- osf = TO_SOCKET(fileno(pf));/* Get it now before it's gone! */
+ osf = TO_SOCKET(win32_fileno(pf));/* Get it now before it's gone! */\r
if (osf != -1) {
int err;
win32_fflush(pf);
err = closesocket(osf);
if (err == 0) {
#if defined(USE_FIXED_OSFHANDLE) || defined(PERL_MSVCRT_READFIX)
- _set_osfhnd(fileno(pf), INVALID_HANDLE_VALUE);
+ _set_osfhnd(win32_fileno(pf), INVALID_HANDLE_VALUE);\r
#endif
(void)fclose(pf); /* handle already closed, ignore error */
return 0;