#define taint_env Perl_taint_env
#define taint_proper Perl_taint_proper
#define thisexpr Perl_thisexpr
+#define thr_key Perl_thr_key
#define timesbuf Perl_timesbuf
#define tokenbuf Perl_tokenbuf
#define too_few_arguments Perl_too_few_arguments
#define multiline (curinterp->Imultiline)
#define mystrk (curinterp->Imystrk)
#define nrs (curinterp->Inrs)
+#define nthreads (curinterp->Inthreads)
+#define nthreads_cond (curinterp->Inthreads_cond)
#define ofmt (curinterp->Iofmt)
#define ofs (curinterp->Iofs)
#define ofslen (curinterp->Iofslen)
#define sv_root (curinterp->Isv_root)
#define tainted (curinterp->Itainted)
#define tainting (curinterp->Itainting)
+#define threads_mutex (curinterp->Ithreads_mutex)
#define tmps_floor (curinterp->Itmps_floor)
#define tmps_ix (curinterp->Itmps_ix)
#define tmps_max (curinterp->Itmps_max)
#define Imultiline multiline
#define Imystrk mystrk
#define Inrs nrs
+#define Inthreads nthreads
+#define Inthreads_cond nthreads_cond
#define Iofmt ofmt
#define Iofs ofs
#define Iofslen ofslen
#define Isv_root sv_root
#define Itainted tainted
#define Itainting tainting
+#define Ithreads_mutex threads_mutex
#define Itmps_floor tmps_floor
#define Itmps_ix tmps_ix
#define Itmps_max tmps_max
#define multiline Perl_multiline
#define mystrk Perl_mystrk
#define nrs Perl_nrs
+#define nthreads Perl_nthreads
+#define nthreads_cond Perl_nthreads_cond
#define ofmt Perl_ofmt
#define ofs Perl_ofs
#define ofslen Perl_ofslen
#define sv_objcount Perl_sv_objcount
#define sv_root Perl_sv_root
#define tainted Perl_tainted
+#define threads_mutex Perl_threads_mutex
#define tmps_floor Perl_tmps_floor
#define tmps_ix Perl_tmps_ix
#define tmps_max Perl_tmps_max
sv_undef
sv_yes
thisexpr
+thr_key
timesbuf
tokenbuf
uid
multiline
mystrk
nrs
+nthreads_cond
+nthreads
ofmt
ofs
ofslen
sv_arenaroot
tainted
tainting
+threads_mutex
tmps_floor
tmps_ix
tmps_max
if (!linestr) {
#ifdef USE_THREADS
INIT_THREADS;
- New(53, thr, 1, struct thread);
+ Newz(53, thr, 1, struct thread);
MUTEX_INIT(&malloc_mutex);
MUTEX_INIT(&sv_mutex);
MUTEX_INIT(&eval_mutex);
thr->private = 0;
thr->tid = 0;
#else
+#ifdef WIN32
+ DuplicateHandle(GetCurrentProcess(),
+ GetCurrentThread(),
+ GetCurrentProcess(),
+ &self,
+ 0,
+ FALSE,
+ DUPLICATE_SAME_ACCESS);
+ /* XXX TlsAlloc() should probably be done in the DLL entry
+ * point also.
+ */
+ if ((thr_key = TlsAlloc()) == TLS_OUT_OF_INDEXES)
+ croak("panic: pthread_key_create");
+ if (TlsSetValue(thr_key, (LPVOID) thr) != TRUE)
+ croak("panic: pthread_setspecific");
+#else
self = pthread_self();
if (pthread_key_create(&thr_key, 0))
croak("panic: pthread_key_create");
if (pthread_setspecific(thr_key, (void *) thr))
croak("panic: pthread_setspecific");
+#endif /* WIN32 */
#endif /* FAKE_THREADS */
#endif /* USE_THREADS */
#ifdef FAKE_THREADS
#include "fakethr.h"
#else
+#ifdef WIN32
+/*typedef CRITICAL_SECTION perl_mutex;*/
+typedef HANDLE perl_mutex;
+typedef HANDLE perl_cond;
+typedef DWORD perl_key;
+#else
#include <pthread.h>
typedef pthread_mutex_t perl_mutex;
typedef pthread_cond_t perl_cond;
typedef pthread_key_t perl_key;
+#endif /* WIN32 */
#endif /* FAKE_THREADS */
#endif /* USE_THREADS */
} STMT_END
#define COND_DESTROY(c)
#else
+
+#ifdef WIN32
+
+typedef HANDLE perl_thread;
+
+/* XXX Critical Sections used instead of mutexes: lightweight,
+ * but can't be communicated to child processes, and can't get
+ * HANDLE to it for use elsewhere
+ */
+/*
+#define MUTEX_INIT(m) InitializeCriticalSection(m)
+#define MUTEX_LOCK(m) EnterCriticalSection(m)
+#define MUTEX_UNLOCK(m) LeaveCriticalSection(m)
+#define MUTEX_DESTROY(m) DeleteCriticalSection(m)
+*/
+
+#define MUTEX_INIT(m) \
+ STMT_START { \
+ if ((*(m) = CreateMutex(NULL,FALSE,NULL)) == NULL) \
+ croak("panic: MUTEX_INIT"); \
+ } STMT_END
+#define MUTEX_LOCK(m) \
+ STMT_START { \
+ if (WaitForSingleObject(*(m),INFINITE) == WAIT_FAILED) \
+ croak("panic: MUTEX_LOCK"); \
+ } STMT_END
+#define MUTEX_UNLOCK(m) \
+ STMT_START { \
+ if (ReleaseMutex(*(m)) == 0) \
+ croak("panic: MUTEX_UNLOCK"); \
+ } STMT_END
+#define MUTEX_DESTROY(m) \
+ STMT_START { \
+ if (CloseHandle(*(m)) == 0) \
+ croak("panic: MUTEX_DESTROY"); \
+ } STMT_END
+
+#define COND_INIT(c) \
+ STMT_START { \
+ if ((*(c) = CreateEvent(NULL,TRUE,FALSE,NULL)) == NULL) \
+ croak("panic: COND_INIT"); \
+ } STMT_END
+#define COND_SIGNAL(c) \
+ STMT_START { \
+ if (PulseEvent(*(c)) == 0) \
+ croak("panic: COND_SIGNAL (%ld)",GetLastError()); \
+ } STMT_END
+#define COND_BROADCAST(c) \
+ STMT_START { \
+ if (PulseEvent(*(c)) == 0) \
+ croak("panic: COND_BROADCAST"); \
+ } STMT_END
+/* #define COND_WAIT(c, m) \
+ STMT_START { \
+ if (WaitForSingleObject(*(c),INFINITE) == WAIT_FAILED) \
+ croak("panic: COND_WAIT"); \
+ } STMT_END
+*/
+#define COND_WAIT(c, m) \
+ STMT_START { \
+ if (SignalObjectAndWait(*(m),*(c),INFINITE,FALSE) == WAIT_FAILED)\
+ croak("panic: COND_WAIT"); \
+ else \
+ MUTEX_LOCK(m); \
+ } STMT_END
+#define COND_DESTROY(c) \
+ STMT_START { \
+ if (CloseHandle(*(c)) == 0) \
+ croak("panic: COND_DESTROY"); \
+ } STMT_END
+
+#define DETACH(t) \
+ STMT_START { \
+ if (CloseHandle((t)->Tself) == 0) \
+ croak("panic: DETACH"); \
+ } STMT_END
+
+#define THR ((struct thread *) TlsGetValue(thr_key))
+#define pthread_getspecific(k) TlsGetValue(k)
+#define pthread_setspecific(k,v) (TlsSetValue(k,v) == 0)
+
+#else /* !WIN32 */
+
/* POSIXish threads */
typedef pthread_t perl_thread;
#ifdef OLD_PTHREADS_API
#else
#define THR ((struct thread *) pthread_getspecific(thr_key))
#endif /* OLD_PTHREADS_API */
+#endif /* WIN32 */
#define dTHR struct thread *thr = THR
#endif /* FAKE_THREADS */
!ENDIF
INCLUDES = -I.\include -I. -I..
#PCHFLAGS = -Fp"$(INTDIR)/modules.pch" -YX
-DEFINES = -DWIN32 -D_CONSOLE -DPERLDLL
+DEFINES = -DWIN32 -D_CONSOLE -DUSE_THREADS -D_WIN32_WINNT=0x400
+LOCDEFS = -DPERLDLL
SUBSYS = console
!IF "$(RUNTIME)" == "-MD"
oleaut32.lib netapi32.lib uuid.lib wsock32.lib mpr.lib winmm.lib \
version.lib odbc32.lib odbccp32.lib
-CFLAGS = -nologo -W3 $(INCLUDES) $(DEFINES) $(PCHFLAGS) $(OPTIMIZE)
+CFLAGS = -nologo -W3 $(INCLUDES) $(DEFINES) $(LOCDEFS) $(PCHFLAGS) $(OPTIMIZE)
LINK_FLAGS = -nologo $(LIBFILES) $(LINK_DBG) -machine:I386
OBJOUT_FLAG = -Fo
..\regexp.h \
..\scope.h \
..\sv.h \
+ ..\thread.h \
..\unixish.h \
..\util.h \
..\XSUB.h \
.\include\sys\socket.h \
.\win32.h
-EXTENSIONS=DynaLoader Socket IO Fcntl Opcode SDBM_File
+EXTENSIONS=DynaLoader Socket IO Fcntl Opcode SDBM_File attrs
DYNALOADER=$(EXTDIR)\DynaLoader\DynaLoader
SOCKET=$(EXTDIR)\Socket\Socket
OPCODE=$(EXTDIR)\Opcode\Opcode
SDBM_FILE=$(EXTDIR)\SDBM_File\SDBM_File
IO=$(EXTDIR)\IO\IO
+ATTRS=$(EXTDIR)\attrs\attrs
SOCKET_DLL=..\lib\auto\Socket\Socket.dll
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
+ATTRS_DLL=..\lib\auto\attrs\attrs.dll
STATICLINKMODULES=DynaLoader
DYNALOADMODULES= \
$(FCNTL_DLL) \
$(OPCODE_DLL) \
$(SDBM_FILE_DLL)\
- $(IO_DLL)
+ $(IO_DLL) \
+ $(ATTRS_DLL)
POD2HTML=$(PODDIR)\pod2html
POD2MAN=$(PODDIR)\pod2man
..\config.sh : config.w32 $(MINIPERL) config_sh.PL
$(MINIPERL) -I..\lib config_sh.PL "INST_DRV=$(INST_DRV)" \
- "INST_TOP=$(INST_TOP)" "cc=$(CC)" "ccflags=$(RUNTIME) -DWIN32" \
+ "INST_TOP=$(INST_TOP)" "cc=$(CC)" "ccflags=$(OPTIMIZE) $(DEFINES)" \
"cf_email=$(EMAIL)" "libs=$(LIBFILES)" "incpath=$(CCINCDIR)" \
"libpth=$(CCLIBDIR)" "libc=$(LIBC)" \
config.w32 > ..\config.sh
$(EXTDIR)\DynaLoader\dl_win32.xs: dl_win32.xs
copy dl_win32.xs $(EXTDIR)\DynaLoader\dl_win32.xs
-$(IO_DLL): $(PERLEXE) $(CONFIGPM) $(IO).xs
+$(ATTRS_DLL): $(PERLEXE) $(ATTRS).xs
+ cd $(EXTDIR)\$(*B)
+ ..\..\miniperl -I..\..\lib Makefile.PL INSTALLDIRS=perl
+ $(MAKE)
+ cd ..\..\win32
+
+$(IO_DLL): $(PERLEXE) $(IO).xs
cd $(EXTDIR)\$(*B)
..\..\miniperl -I..\..\lib Makefile.PL INSTALLDIRS=perl
$(MAKE)
$(MAKE)
cd ..\..\win32
-$(SOCKET_DLL): $(SOCKET).xs $(PERLEXE)
+$(SOCKET_DLL): $(PERLEXE) $(SOCKET).xs
cd $(EXTDIR)\$(*B)
..\..\miniperl -I..\..\lib Makefile.PL INSTALLDIRS=perl
$(MAKE)
$(PERLIMPLIB) ..\miniperl.lib $(MINIMOD)
-del /f *.def *.map
-del /f $(SOCKET_DLL) $(IO_DLL) $(SDBM_FILE_DLL) $(FCNTL_DLL) \
- $(OPCODE_DLL)
+ $(OPCODE_DLL) $(ATTRS_DLL)
-del /f $(SOCKET).c $(IO).c $(SDBM_FILE).c $(FCNTL).c $(OPCODE).c \
- $(DYNALOADER).c
+ $(DYNALOADER).c $(ATTRS).c
-del /f $(PODDIR)\*.html
-del /f $(PODDIR)\*.bat
-del /f ..\config.sh ..\splittree.pl perlmain.c dlutils.c \
Perl_skipspace
Perl_sublex_done
Perl_sublex_start
-Perl_sv_peek
Perl_sv_ref
Perl_sv_setptrobj
Perl_timesbuf
Perl_my_memset
Perl_cshlen
Perl_cshname
-Perl_condpair_magic
-Perl_magic_mutexfree
Perl_opsave
-Perl_unlock_condpair
-Perl_vtbl_mutex
!END!OF!SKIP!
# All symbols have a Perl_ prefix because that's what embed.h
RUNTIME = -D_RTLDLL
INCLUDES = -I.\include -I. -I.. -I$(CCINCDIR)
#PCHFLAGS = -H -H$(INTDIR)\bcmoduls.pch
-DEFINES = -DWIN32 -DPERLDLL
+DEFINES = -DWIN32 -DUSE_THREADS -D_WIN32_WINNT=0x0400
+LOCDEFS = -DPERLDLL
SUBSYS = console
LIBC = cw32mti.lib
LIBFILES = import32.lib $(LIBC) odbc32.lib odbccp32.lib
LINK_DBG =
.ENDIF
-CFLAGS = -w -tWM -tWD $(INCLUDES) $(DEFINES) $(PCHFLAGS) $(OPTIMIZE)
+CFLAGS = -w -tWM -tWD $(INCLUDES) $(DEFINES) $(LOCDEFS) $(PCHFLAGS) $(OPTIMIZE)
LINK_FLAGS = $(LINK_DBG) -L$(CCLIBDIR)
OBJOUT_FLAG = -o
.ENDIF
INCLUDES = -I.\include -I. -I..
#PCHFLAGS = -Fp$(INTDIR)\vcmoduls.pch -YX
-DEFINES = -DWIN32 -D_CONSOLE -DPERLDLL
+DEFINES = -DWIN32 -D_CONSOLE -DUSE_THREADS -D_WIN32_WINNT=0x0400
+LOCDEFS = -DPERLDLL
SUBSYS = console
.IF "$(RUNTIME)" == "-MD"
oleaut32.lib netapi32.lib uuid.lib wsock32.lib mpr.lib winmm.lib \
version.lib odbc32.lib odbccp32.lib
-CFLAGS = -nologo -W3 $(INCLUDES) $(DEFINES) $(PCHFLAGS) $(OPTIMIZE)
+CFLAGS = -nologo -W3 $(INCLUDES) $(DEFINES) $(LOCDEFS) $(PCHFLAGS) $(OPTIMIZE)
LINK_FLAGS = -nologo $(LIBFILES) $(LINK_DBG) -machine:I386
OBJOUT_FLAG = -Fo
CONFIGPM=..\lib\Config.pm
MINIMOD=..\lib\ExtUtils\Miniperl.pm
-PL2BAT=bin\PL2BAT.BAT
+PL2BAT=bin\pl2bat.pl
GLOBBAT = perlglob.bat
.IF "$(CCTYPE)" == "BORLAND"
..\regexp.h \
..\scope.h \
..\sv.h \
+ ..\thread.h \
..\unixish.h \
..\util.h \
..\XSUB.h \
.\win32.h
-EXTENSIONS=DynaLoader Socket IO Fcntl Opcode SDBM_File
+EXTENSIONS=DynaLoader Socket IO Fcntl Opcode SDBM_File attrs
DYNALOADER=$(EXTDIR)\DynaLoader\DynaLoader
SOCKET=$(EXTDIR)\Socket\Socket
OPCODE=$(EXTDIR)\Opcode\Opcode
SDBM_FILE=$(EXTDIR)\SDBM_File\SDBM_File
IO=$(EXTDIR)\IO\IO
+ATTRS=$(EXTDIR)\attrs\attrs
SOCKET_DLL=..\lib\auto\Socket\Socket.dll
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
+ATTRS_DLL=..\lib\auto\attrs\attrs.dll
STATICLINKMODULES=DynaLoader
DYNALOADMODULES= \
$(FCNTL_DLL) \
$(OPCODE_DLL) \
$(SDBM_FILE_DLL)\
- $(IO_DLL)
+ $(IO_DLL) \
+ $(ATTRS_DLL)
POD2HTML=$(PODDIR)\pod2html
POD2MAN=$(PODDIR)\pod2man
..\config.sh : config.w32 $(MINIPERL) config_sh.PL
$(MINIPERL) -I..\lib config_sh.PL "INST_DRV=$(INST_DRV)" \
- "INST_TOP=$(INST_TOP)" "cc=$(CC)" "ccflags=$(RUNTIME) -DWIN32" \
+ "INST_TOP=$(INST_TOP)" "cc=$(CC)" "ccflags=$(OPTIMIZE) $(DEFINES)" \
"cf_email=$(EMAIL)" "libs=$(LIBFILES:f)" \
"libpth=$(strip $(CCLIBDIR) $(LIBFILES:d))" "libc=$(LIBC)" \
config.w32 > ..\config.sh
$(EXTDIR)\DynaLoader\dl_win32.xs: dl_win32.xs
copy dl_win32.xs $(EXTDIR)\DynaLoader\dl_win32.xs
-$(IO_DLL): $(PERLEXE) $(CONFIGPM) $(IO).xs
+$(ATTRS_DLL): $(PERLEXE) $(ATTRS).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
cd $(EXTDIR)\$(*B) && $(MAKE)
..\..\miniperl -I..\..\lib Makefile.PL INSTALLDIRS=perl
cd $(EXTDIR)\$(*B) && $(MAKE)
-$(SOCKET_DLL): $(SOCKET).xs $(PERLEXE)
+$(SOCKET_DLL): $(PERLEXE) $(SOCKET).xs
cd $(EXTDIR)\$(*B) && \
..\..\miniperl -I..\..\lib Makefile.PL INSTALLDIRS=perl
cd $(EXTDIR)\$(*B) && $(MAKE)
$(PERLIMPLIB) ..\miniperl.lib $(MINIMOD)
-del /f *.def *.map
-del /f $(SOCKET_DLL) $(IO_DLL) $(SDBM_FILE_DLL) $(FCNTL_DLL) \
- $(OPCODE_DLL)
+ $(OPCODE_DLL) $(ATTRS_DLL)
-del /f $(SOCKET).c $(IO).c $(SDBM_FILE).c $(FCNTL).c $(OPCODE).c \
- $(DYNALOADER).c
+ $(DYNALOADER).c $(ATTRS).c
-del /f $(PODDIR)\*.html
-del /f $(PODDIR)\*.bat
-cd $(EXTDIR) && del /s *.lib *.def *.map *.bs Makefile *.obj pm_to_blib
all: $(CONVERTERS) html
PERL = ..\miniperl.exe
-PL2BAT = ..\win32\bin\pl2bat.bat
+PL2BAT = ..\win32\bin\pl2bat.pl
POD = \
perl.pod \