From c31fac668b253062b943c71d3452e678b6f02609 Mon Sep 17 00:00:00 2001 From: Gurusamy Sarathy Date: Wed, 26 Nov 1997 00:27:57 +0000 Subject: [PATCH] [win32] Various changes to make it build cleanly and pass all tests: - needed to run `perl embed.pl` - use PERL_CORE instead of PERLDLL in places that do mean PERL_CORE - fix prototypes for a few declarations (Borland is finally quiet) - move declaration of Mymalloc etc to perl.h (since win32 and other ports may #define malloc themselves, to let extensions bind to the version that perl used) - move struct reg_data into a public header file, since it is referenced in a public datatype - win32 makefile fixes - fix remaining s/thread/perl_thread/ p4raw-id: //depot/win32/perl@304 --- EXTERN.h | 2 +- embed.h | 3 ++- ext/DynaLoader/dlutils.c | 10 +--------- ext/SDBM_File/sdbm/sdbm.h | 2 +- hv.c | 9 +++------ perl.h | 12 ++++++++++-- proto.h | 7 ------- regcomp.h | 6 ------ regexp.h | 6 ++++++ win32/Makefile | 2 +- win32/dl_win32.xs | 2 +- win32/makefile.mk | 6 +++--- win32/win32.h | 2 +- win32/win32iop.h | 2 +- win32/win32thread.c | 6 +++--- 15 files changed, 34 insertions(+), 43 deletions(-) diff --git a/EXTERN.h b/EXTERN.h index 228ed52..1c10f64 100644 --- a/EXTERN.h +++ b/EXTERN.h @@ -24,7 +24,7 @@ # define dEXTCONST globaldef {"$GLOBAL_RO_VARS"} readonly #else # if (defined(_MSC_VER) && defined(_WIN32)) || (defined(__BORLANDC__) && defined(__WIN32__)) -# ifdef PERLDLL +# ifdef PERL_CORE # define EXT extern __declspec(dllexport) # define dEXT # define EXTCONST extern __declspec(dllexport) const diff --git a/embed.h b/embed.h index b577200..541fcf7 100644 --- a/embed.h +++ b/embed.h @@ -254,7 +254,6 @@ #define he_root Perl_he_root #define hexdigit Perl_hexdigit #define hints Perl_hints -#define hoistmust Perl_hoistmust #define hv_clear Perl_hv_clear #define hv_delayfree_ent Perl_hv_delayfree_ent #define hv_delete Perl_hv_delete @@ -911,6 +910,8 @@ #define rsignal_save Perl_rsignal_save #define rsignal_state Perl_rsignal_state #define runops Perl_runops +#define runops_debug Perl_runops_debug +#define runops_standard Perl_runops_standard #define rxres_free Perl_rxres_free #define rxres_restore Perl_rxres_restore #define rxres_save Perl_rxres_save diff --git a/ext/DynaLoader/dlutils.c b/ext/DynaLoader/dlutils.c index 5800678..422b3d1 100644 --- a/ext/DynaLoader/dlutils.c +++ b/ext/DynaLoader/dlutils.c @@ -26,7 +26,7 @@ static int dl_debug = 0; /* value copied from $DynaLoader::dl_error */ static void -dl_generic_private_init() /* called by dl_*.xs dl_private_init() */ +dl_generic_private_init(void) /* called by dl_*.xs dl_private_init() */ { char *perl_dl_nonlazy; #ifdef DEBUGGING @@ -44,16 +44,8 @@ dl_generic_private_init() /* called by dl_*.xs dl_private_init() */ /* SaveError() takes printf style args and saves the result in LastError */ -#ifdef STANDARD_C static void SaveError(char* pat, ...) -#else -/*VARARGS0*/ -static void -SaveError(pat, va_alist) - char *pat; - va_dcl -#endif { va_list args; char *message; diff --git a/ext/SDBM_File/sdbm/sdbm.h b/ext/SDBM_File/sdbm/sdbm.h index 5bc629f..ac2dc36 100644 --- a/ext/SDBM_File/sdbm/sdbm.h +++ b/ext/SDBM_File/sdbm/sdbm.h @@ -49,7 +49,7 @@ typedef struct { extern datum nullitem; -#if defined(__STDC__) || defined(__cplusplus) +#if defined(__STDC__) || defined(__cplusplus) || defined(CAN_PROTOTYPE) #define proto(p) p #else #define proto(p) () diff --git a/hv.c b/hv.c index e495e91..12c1748 100644 --- a/hv.c +++ b/hv.c @@ -16,8 +16,8 @@ static void hsplit _((HV *hv)); static void hfreeentries _((HV *hv)); - -static HE* more_he(void); +static void hv_magic_check _((HV *hv, bool *needs_copy, bool *needs_store)); +static HE* more_he _((void)); static HE* new_he(void) @@ -217,10 +217,7 @@ hv_fetch_ent(HV *hv, SV *keysv, I32 lval, register U32 hash) } static void -hv_magic_check (hv, needs_copy, needs_store) -HV *hv; -bool *needs_copy; -bool *needs_store; +hv_magic_check (HV *hv, bool *needs_copy, bool *needs_store) { MAGIC *mg = SvMAGIC(hv); *needs_copy = FALSE; diff --git a/perl.h b/perl.h index 0ffb04c..e68ecf6 100644 --- a/perl.h +++ b/perl.h @@ -254,6 +254,8 @@ register struct op *op asm(stringify(OP_IN_REGISTER)); # include #endif +#define MEM_SIZE Size_t + /* This comes after so we don't try to change the standard * library prototypes; we'll use our own in proto.h instead. */ @@ -264,12 +266,20 @@ register struct op *op asm(stringify(OP_IN_REGISTER)); # define calloc Mycalloc # define realloc Myremalloc # define free Myfree +Malloc_t Mymalloc _((MEM_SIZE nbytes)); +Malloc_t Mycalloc _((MEM_SIZE elements, MEM_SIZE size)); +Malloc_t Myrealloc _((Malloc_t where, MEM_SIZE nbytes)); +Free_t Myfree _((Malloc_t where)); # endif # ifdef EMBEDMYMALLOC # define malloc Perl_malloc # define calloc Perl_calloc # define realloc Perl_realloc # define free Perl_free +Malloc_t Perl_malloc _((MEM_SIZE nbytes)); +Malloc_t Perl_calloc _((MEM_SIZE elements, MEM_SIZE size)); +Malloc_t Perl_realloc _((Malloc_t where, MEM_SIZE nbytes)); +Free_t Perl_free _((Malloc_t where)); # endif # undef safemalloc @@ -283,8 +293,6 @@ register struct op *op asm(stringify(OP_IN_REGISTER)); #endif /* MYMALLOC */ -#define MEM_SIZE Size_t - #if defined(STANDARD_C) && defined(I_STDDEF) # include # define STRUCT_OFFSET(s,m) offsetof(s,m) diff --git a/proto.h b/proto.h index 202331b..7b47a93 100644 --- a/proto.h +++ b/proto.h @@ -568,13 +568,6 @@ int yylex _((void)); int yyparse _((void)); int yywarn _((char* s)); -#if defined(MYMALLOC) || !defined(STANDARD_C) -Malloc_t malloc _((MEM_SIZE nbytes)); -Malloc_t calloc _((MEM_SIZE elements, MEM_SIZE size)); -Malloc_t realloc _((Malloc_t where, MEM_SIZE nbytes)); -Free_t free _((Malloc_t where)); -#endif - #ifndef MYMALLOC Malloc_t safemalloc _((MEM_SIZE nbytes)); Malloc_t safecalloc _((MEM_SIZE elements, MEM_SIZE size)); diff --git a/regcomp.h b/regcomp.h index 2a00d40..fe29b2d 100644 --- a/regcomp.h +++ b/regcomp.h @@ -440,12 +440,6 @@ const static char reg_off_by_arg[] = { }; #endif -struct reg_data { - U32 count; - U8 *what; - void* data[1]; -}; - #define REG_SEEN_ZERO_LEN 1 #define REG_SEEN_LOOKBEHIND 2 #define REG_SEEN_GPOS 4 diff --git a/regexp.h b/regexp.h index 2f7aa02..7137ffc 100644 --- a/regexp.h +++ b/regexp.h @@ -17,6 +17,12 @@ struct regnode { typedef struct regnode regnode; +struct reg_data { + U32 count; + U8 *what; + void* data[1]; +}; + typedef struct regexp { I32 refcnt; char **startp; diff --git a/win32/Makefile b/win32/Makefile index 91a417d..e2d3d44 100644 --- a/win32/Makefile +++ b/win32/Makefile @@ -52,7 +52,7 @@ RUNTIME = -MD INCLUDES = -I.\include -I. -I.. #PCHFLAGS = -Fp"$(INTDIR)/modules.pch" -YX DEFINES = -DWIN32 -D_CONSOLE $(BUILDOPT) -LOCDEFS = -DPERLDLL $(CORECCOPT) +LOCDEFS = -DPERLDLL -DPERL_CORE $(CORECCOPT) SUBSYS = console !IF "$(RUNTIME)" == "-MD" diff --git a/win32/dl_win32.xs b/win32/dl_win32.xs index 7b227e2..cf6797e 100644 --- a/win32/dl_win32.xs +++ b/win32/dl_win32.xs @@ -28,7 +28,7 @@ calls. #include "dlutils.c" /* SaveError() etc */ static void -dl_private_init() +dl_private_init(void) { (void)dl_generic_private_init(); } diff --git a/win32/makefile.mk b/win32/makefile.mk index 03788c7..7bbf0bb 100644 --- a/win32/makefile.mk +++ b/win32/makefile.mk @@ -55,7 +55,7 @@ CCLIBDIR = $(CCHOME)\lib CC = bcc32 LINK32 = tlink32 LIB32 = tlib -IMPLIB = implib +IMPLIB = implib -c # # Options @@ -64,7 +64,7 @@ RUNTIME = -D_RTLDLL INCLUDES = -I.\include -I. -I.. -I$(CCINCDIR) #PCHFLAGS = -H -H$(INTDIR)\bcmoduls.pch DEFINES = -DWIN32 $(BUILDOPT) -LOCDEFS = -DPERLDLL +LOCDEFS = -DPERLDLL -DPERL_CORE SUBSYS = console LIBC = cw32mti.lib LIBFILES = import32.lib $(LIBC) odbc32.lib odbccp32.lib @@ -97,7 +97,7 @@ RUNTIME = -MD INCLUDES = -I.\include -I. -I.. #PCHFLAGS = -Fp$(INTDIR)\vcmoduls.pch -YX DEFINES = -DWIN32 -D_CONSOLE $(BUILDOPT) -LOCDEFS = -DPERLDLL +LOCDEFS = -DPERLDLL -DPERL_CORE SUBSYS = console .IF "$(RUNTIME)" == "-MD" diff --git a/win32/win32.h b/win32/win32.h index 2e31d0e..d0dde7e 100644 --- a/win32/win32.h +++ b/win32/win32.h @@ -151,7 +151,7 @@ typedef char * caddr_t; /* In malloc.c (core address). */ /* #define PERL_SBRK_VIA_MALLOC /**/ #endif -#ifdef PERLDLL +#if defined(PERLDLL) && !defined(PERL_CORE) #define PERL_CORE #endif diff --git a/win32/win32iop.h b/win32/win32iop.h index bd70def..533370e 100644 --- a/win32/win32iop.h +++ b/win32/win32iop.h @@ -220,7 +220,7 @@ END_EXTERN_C #define getchar win32_getchar #define putchar win32_putchar -#if !defined(MYMALLOC) || !defined(PERLDLL) +#if !defined(MYMALLOC) || !defined(PERL_CORE) #undef malloc #undef calloc #undef realloc diff --git a/win32/win32thread.c b/win32/win32thread.c index 3e63327..039f8b4 100644 --- a/win32/win32thread.c +++ b/win32/win32thread.c @@ -1,15 +1,15 @@ #include "EXTERN.h" #include "perl.h" -__declspec(thread) struct thread *Perl_current_thread = NULL; +__declspec(thread) struct perl_thread *Perl_current_thread = NULL; void -Perl_setTHR(struct thread *t) +Perl_setTHR(struct perl_thread *t) { Perl_current_thread = t; } -struct thread * +struct perl_thread * Perl_getTHR(void) { return Perl_current_thread; -- 1.8.3.1