From: Gurusamy Sarathy Date: Fri, 29 May 1998 05:01:54 +0000 (+0000) Subject: [win32] misc changes X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=17c3b45099488fbc22dc1d4e0e4600c17bc12645;p=p5sagit%2Fp5-mst-13.2.git [win32] misc changes - remove code that works around lack of I_STDARG (we're a happy ANSI family) - leave dump_foo() stubs when not -DDEBUGGING for consistent symbol exports p4raw-id: //depot/win32/perl@1053 --- diff --git a/deb.c b/deb.c index fb9dfef..af86540 100644 --- a/deb.c +++ b/deb.c @@ -15,50 +15,10 @@ #include "EXTERN.h" #include "perl.h" -#ifdef DEBUGGING -#if !defined(I_STDARG) && !defined(I_VARARGS) - -/* - * Fallback on the old hackers way of doing varargs - */ - -/*VARARGS1*/ -void -deb(pat,a1,a2,a3,a4,a5,a6,a7,a8) - char *pat; -{ - dTHR; - register I32 i; - GV* gv = curcop->cop_filegv; - -#ifdef USE_THREADS - PerlIO_printf(Perl_debug_log,"0x%lx (%s:%ld)\t", - (unsigned long) thr, - SvTYPE(gv) == SVt_PVGV ? SvPVX(GvSV(gv)) : "", - (long)curcop->cop_line); -#else - PerlIO_printf(Perl_debug_log, "(%s:%ld)\t", - SvTYPE(gv) == SVt_PVGV ? SvPVX(GvSV(gv)) : "", - (long)curcop->cop_line); -#endif /* USE_THREADS */ - for (i=0; i\n"); +#endif /* DEBUGGING */ } void dump_form(GV *gv) { +#ifdef DEBUGGING SV *sv = sv_newmortal(); gv_fullname3(sv, gv, Nullch); @@ -90,17 +86,21 @@ dump_form(GV *gv) dump_op(CvROOT(GvFORM(gv))); else dump("\n"); +#endif /* DEBUGGING */ } void dump_eval(void) { +#ifdef DEBUGGING dump_op(eval_root); +#endif /* DEBUGGING */ } void dump_op(OP *o) { +#ifdef DEBUGGING dump("{\n"); if (o->op_seq) PerlIO_printf(Perl_debug_log, "%-4d", o->op_seq); @@ -309,11 +309,13 @@ dump_op(OP *o) } dumplvl--; dump("}\n"); +#endif /* DEBUGGING */ } void dump_gv(GV *gv) { +#ifdef DEBUGGING SV *sv; if (!gv) { @@ -332,11 +334,13 @@ dump_gv(GV *gv) dump("\n"); dumplvl--; dump("}\n"); +#endif /* DEBUGGING */ } void dump_pm(PMOP *pm) { +#ifdef DEBUGGING char ch; if (!pm) { @@ -391,48 +395,21 @@ dump_pm(PMOP *pm) dumplvl--; dump("}\n"); +#endif /* DEBUGGING */ } -#if !defined(I_STDARG) && !defined(I_VARARGS) -/* VARARGS1 */ -static void dump(arg1,arg2,arg3,arg4,arg5) -char *arg1; -long arg2, arg3, arg4, arg5; -{ - I32 i; - - for (i = dumplvl*4; i; i--) - (void)PerlIO_putc(Perl_debug_log,' '); - PerlIO_printf(Perl_debug_log, arg1, arg2, arg3, arg4, arg5); -} - -#else - -#ifdef I_STDARG static void dump(char *pat,...) -#else -/*VARARGS0*/ -static void -dump(pat,va_alist) - char *pat; - va_dcl -#endif { +#ifdef DEBUGGING I32 i; va_list args; -#ifdef I_STDARG va_start(args, pat); -#else - va_start(args); -#endif for (i = dumplvl*4; i; i--) (void)PerlIO_putc(Perl_debug_log,' '); PerlIO_vprintf(Perl_debug_log,pat,args); va_end(args); +#endif /* DEBUGGING */ } -#endif - -#endif diff --git a/ext/DynaLoader/dlutils.c b/ext/DynaLoader/dlutils.c index 422b3d1..fb61e1d 100644 --- a/ext/DynaLoader/dlutils.c +++ b/ext/DynaLoader/dlutils.c @@ -53,11 +53,7 @@ SaveError(char* pat, ...) /* This code is based on croak/warn, see mess() in util.c */ -#ifdef I_STDARG va_start(args, pat); -#else - va_start(args); -#endif message = mess(pat, &args); va_end(args); diff --git a/ext/POSIX/POSIX.xs b/ext/POSIX/POSIX.xs index 661592e..239f979 100644 --- a/ext/POSIX/POSIX.xs +++ b/ext/POSIX/POSIX.xs @@ -23,9 +23,8 @@ #endif #include #include -#ifdef I_STDARG #include -#endif + #ifdef I_STDDEF #include #endif @@ -99,7 +98,7 @@ #if defined (WIN32) # undef mkfifo /* #defined in perl.h */ # define mkfifo(a,b) not_here("mkfifo") -# define ttyname(a) not_here("ttyname") +# define ttyname(a) (char*)not_here("ttyname") # define sigset_t long # define pid_t long # ifdef __BORLANDC__ diff --git a/perlio.c b/perlio.c index 2ddc3f1..c293f54 100644 --- a/perlio.c +++ b/perlio.c @@ -76,7 +76,7 @@ PerlIO_init() sfset(sfstdout,SF_SHARE,0); } -#else +#else /* USE_SFIO */ /* Implement all the PerlIO interface using stdio. - this should be only file to include @@ -445,22 +445,11 @@ PerlIO *f; #undef PerlIO_printf int -#ifdef I_STDARG PerlIO_printf(PerlIO *f,const char *fmt,...) -#else -PerlIO_printf(f,fmt,va_alist) -PerlIO *f; -const char *fmt; -va_dcl -#endif { va_list ap; int result; -#ifdef I_STDARG va_start(ap,fmt); -#else - va_start(ap); -#endif result = vfprintf(f,fmt,ap); va_end(ap); return result; @@ -468,21 +457,11 @@ va_dcl #undef PerlIO_stdoutf int -#ifdef I_STDARG PerlIO_stdoutf(const char *fmt,...) -#else -PerlIO_stdoutf(fmt, va_alist) -const char *fmt; -va_dcl -#endif { va_list ap; int result; -#ifdef I_STDARG va_start(ap,fmt); -#else - va_start(ap); -#endif result = PerlIO_vprintf(PerlIO_stdout(),fmt,ap); va_end(ap); return result; @@ -627,23 +606,11 @@ PerlIO_vsprintf(char *s, int n, const char *fmt, va_list ap) #ifndef PerlIO_sprintf int -#ifdef I_STDARG PerlIO_sprintf(char *s, int n, const char *fmt,...) -#else -PerlIO_sprintf(s, n, fmt, va_alist) -char *s; -int n; -const char *fmt; -va_dcl -#endif { va_list ap; int result; -#ifdef I_STDARG va_start(ap,fmt); -#else - va_start(ap); -#endif result = PerlIO_vsprintf(s, n, fmt, ap); va_end(ap); return result; diff --git a/proto.h b/proto.h index 526f8cb..b0c5f92 100644 --- a/proto.h +++ b/proto.h @@ -67,9 +67,7 @@ CV* cv_clone _((CV* proto)); SV* cv_const_sv _((CV* cv)); SV* op_const_sv _((OP* o, CV* cv)); void cv_undef _((CV* cv)); -#ifdef DEBUGGING void cx_dump _((PERL_CONTEXT* cs)); -#endif SV* filter_add _((filter_t funcp, SV* datasv)); void filter_del _((filter_t funcp)); I32 filter_read _((int idx, SV* buffer, int maxlen)); @@ -80,9 +78,7 @@ void deb _((const char* pat,...)) __attribute__((format(printf,1,2))); void deb_growlevel _((void)); I32 debop _((OP* o)); I32 debstackptrs _((void)); -#ifdef DEBUGGING void debprofdump _((void)); -#endif I32 debstack _((void)); char* delimcpy _((char* to, char* toend, char* from, char* fromend, int delim, I32* retlen)); diff --git a/regcomp.c b/regcomp.c index 38bf387..25e7856 100644 --- a/regcomp.c +++ b/regcomp.c @@ -2250,11 +2250,11 @@ regcurly(register char *s) return TRUE; } -#ifdef DEBUGGING static regnode * dumpuntil(regnode *start, regnode *node, regnode *last, SV* sv, I32 l) { +#ifdef DEBUGGING register char op = EXACT; /* Arbitrary non-END op. */ register regnode *next, *onode; @@ -2311,6 +2311,7 @@ dumpuntil(regnode *start, regnode *node, regnode *last, SV* sv, I32 l) else if (op == WHILEM) l--; } +#endif /* DEBUGGING */ return node; } @@ -2320,6 +2321,7 @@ dumpuntil(regnode *start, regnode *node, regnode *last, SV* sv, I32 l) void regdump(regexp *r) { +#ifdef DEBUGGING SV *sv = sv_newmortal(); (void)dumpuntil(r->program, r->program + 1, NULL, sv, 0); @@ -2372,6 +2374,7 @@ regdump(regexp *r) PerlIO_printf(Perl_debug_log, "implicit "); PerlIO_printf(Perl_debug_log, "minlen %ld ", (long) r->minlen); PerlIO_printf(Perl_debug_log, "\n"); +#endif /* DEBUGGING */ } /* @@ -2380,6 +2383,7 @@ regdump(regexp *r) void regprop(SV *sv, regnode *o) { +#ifdef DEBUGGING register char *p = 0; sv_setpv(sv, ":"); @@ -2577,8 +2581,8 @@ regprop(SV *sv, regnode *o) } if (p) sv_catpv(sv, p); +#endif /* DEBUGGING */ } -#endif /* DEBUGGING */ void pregfree(struct regexp *r) @@ -2648,17 +2652,8 @@ regnext(register regnode *p) #endif } -#ifdef I_STDARG static void re_croak2(const char* pat1,const char* pat2,...) -#else -/*VARARGS0*/ -static void -re_croak2(const char* pat1,const char* pat2, va_alist) - const char* pat1; - const char* pat2; - va_dcl -#endif { va_list args; STRLEN l1 = strlen(pat1); @@ -2674,11 +2669,7 @@ re_croak2(const char* pat1,const char* pat2, va_alist) Copy(pat2, buf + l1, l2 , char); buf[l1 + l2 + 1] = '\n'; buf[l1 + l2 + 2] = '\0'; -#ifdef I_STDARG va_start(args, pat2); -#else - va_start(args); -#endif message = mess(buf, &args); va_end(args); l1 = strlen(message); diff --git a/run.c b/run.c index 7922bfd..afb7c39 100644 --- a/run.c +++ b/run.c @@ -18,7 +18,8 @@ int -runops_standard(void) { +runops_standard(void) +{ dTHR; while ( op = (*op->op_ppaddr)(ARGS) ) ; @@ -34,8 +35,12 @@ dEXT char *watchok; static void debprof _((OP*o)); +#endif /* DEBUGGING */ + int -runops_debug(void) { +runops_debug(void) +{ +#ifdef DEBUGGING dTHR; if (!op) { warn("NULL OP IN RUN"); @@ -55,11 +60,15 @@ runops_debug(void) { TAINT_NOT; return 0; +#else + return runops_standard(); +#endif /* DEBUGGING */ } I32 debop(OP *o) { +#ifdef DEBUGGING SV *sv; deb("%s", op_name[o->op_type]); switch (o->op_type) { @@ -81,18 +90,22 @@ debop(OP *o) break; } PerlIO_printf(Perl_debug_log, "\n"); +#endif /* DEBUGGING */ return 0; } void watch(char **addr) { +#ifdef DEBUGGING watchaddr = addr; watchok = *addr; PerlIO_printf(Perl_debug_log, "WATCHING, %lx is currently %lx\n", (long)watchaddr, (long)watchok); +#endif /* DEBUGGING */ } +#ifdef DEBUGGING static void debprof(OP *o) { @@ -100,10 +113,12 @@ debprof(OP *o) New(000, profiledata, MAXO, U32); ++profiledata[o->op_type]; } +#endif /* DEBUGGING */ void debprofdump(void) { +#ifdef DEBUGGING unsigned i; if (!profiledata) return; @@ -112,7 +127,5 @@ debprofdump(void) PerlIO_printf(Perl_debug_log, "%u\t%lu\n", i, (unsigned long)profiledata[i]); } +#endif /* DEBUGGING */ } - -#endif /* DEBUGGING */ - diff --git a/scope.c b/scope.c index 8d6ee70..4732fbe 100644 --- a/scope.c +++ b/scope.c @@ -803,11 +803,10 @@ leave_scope(I32 base) } } -#ifdef DEBUGGING - void cx_dump(PERL_CONTEXT *cx) { +#ifdef DEBUGGING dTHR; PerlIO_printf(Perl_debug_log, "CX %ld = %s\n", (long)(cx - cxstack), block_type[cx->cx_type]); if (cx->cx_type != CXt_SUBST) { @@ -896,5 +895,5 @@ cx_dump(PERL_CONTEXT *cx) (long)cx->sb_rxres); break; } +#endif /* DEBUGGING */ } -#endif diff --git a/sv.c b/sv.c index 6e299ae..57414da 100644 --- a/sv.c +++ b/sv.c @@ -913,10 +913,10 @@ sv_upgrade(register SV *sv, U32 mt) return TRUE; } -#ifdef DEBUGGING char * sv_peek(SV *sv) { +#ifdef DEBUGGING SV *t = sv_newmortal(); STRLEN prevlen; int unref = 0; @@ -1058,8 +1058,10 @@ sv_peek(SV *sv) sv_catpv(t, ")"); } return SvPV(t, na); +#else /* DEBUGGING */ + return ""; +#endif /* DEBUGGING */ } -#endif int sv_backoff(register SV *sv) @@ -3586,16 +3588,8 @@ newSVpvn(char *s, STRLEN len) return sv; } -#ifdef I_STDARG SV * newSVpvf(const char* pat, ...) -#else -/*VARARGS0*/ -SV * -newSVpvf(pat, va_alist) -const char *pat; -va_dcl -#endif { register SV *sv; va_list args; @@ -3604,11 +3598,7 @@ va_dcl SvANY(sv) = 0; SvREFCNT(sv) = 1; SvFLAGS(sv) = 0; -#ifdef I_STDARG va_start(args, pat); -#else - va_start(args); -#endif sv_vsetpvfn(sv, pat, strlen(pat), &args, Null(SV**), 0, Null(bool*)); va_end(args); return sv; @@ -4225,92 +4215,40 @@ sv_setpviv_mg(SV *sv, IV iv) SvSETMAGIC(sv); } -#ifdef I_STDARG void sv_setpvf(SV *sv, const char* pat, ...) -#else -/*VARARGS0*/ -void -sv_setpvf(sv, pat, va_alist) - SV *sv; - const char *pat; - va_dcl -#endif { va_list args; -#ifdef I_STDARG va_start(args, pat); -#else - va_start(args); -#endif sv_vsetpvfn(sv, pat, strlen(pat), &args, Null(SV**), 0, Null(bool*)); va_end(args); } -#ifdef I_STDARG void sv_setpvf_mg(SV *sv, const char* pat, ...) -#else -/*VARARGS0*/ -void -sv_setpvf_mg(sv, pat, va_alist) - SV *sv; - const char *pat; - va_dcl -#endif { va_list args; -#ifdef I_STDARG va_start(args, pat); -#else - va_start(args); -#endif sv_vsetpvfn(sv, pat, strlen(pat), &args, Null(SV**), 0, Null(bool*)); va_end(args); SvSETMAGIC(sv); } -#ifdef I_STDARG void sv_catpvf(SV *sv, const char* pat, ...) -#else -/*VARARGS0*/ -void -sv_catpvf(sv, pat, va_alist) - SV *sv; - const char *pat; - va_dcl -#endif { va_list args; -#ifdef I_STDARG va_start(args, pat); -#else - va_start(args); -#endif sv_vcatpvfn(sv, pat, strlen(pat), &args, Null(SV**), 0, Null(bool*)); va_end(args); } -#ifdef I_STDARG void sv_catpvf_mg(SV *sv, const char* pat, ...) -#else -/*VARARGS0*/ -void -sv_catpvf_mg(sv, pat, va_alist) - SV *sv; - const char *pat; - va_dcl -#endif { va_list args; -#ifdef I_STDARG va_start(args, pat); -#else - va_start(args); -#endif sv_vcatpvfn(sv, pat, strlen(pat), &args, Null(SV**), 0, Null(bool*)); va_end(args); SvSETMAGIC(sv); @@ -4819,10 +4757,10 @@ sv_vcatpvfn(SV *sv, const char *pat, STRLEN patlen, va_list *args, SV **svargs, } } -#ifdef DEBUGGING void sv_dump(SV *sv) { +#ifdef DEBUGGING SV *d = sv_newmortal(); char *s; U32 flags; @@ -5086,14 +5024,5 @@ sv_dump(SV *sv) PerlIO_printf(Perl_debug_log, " FLAGS = 0x%lx\n", (long)IoFLAGS(sv)); break; } +#endif /* DEBUGGING */ } -#else -void -sv_dump(SV *sv) -{ -} -#endif - - - - diff --git a/util.c b/util.c index e4f408d..2e0cf74 100644 --- a/util.c +++ b/util.c @@ -1193,23 +1193,11 @@ mess_alloc(void) return sv; } -#ifdef I_STDARG char * form(const char* pat, ...) -#else -/*VARARGS0*/ -char * -form(pat, va_alist) - const char *pat; - va_dcl -#endif { va_list args; -#ifdef I_STDARG va_start(args, pat); -#else - va_start(args); -#endif if (!mess_sv) mess_sv = mess_alloc(); sv_vsetpvfn(mess_sv, pat, strlen(pat), &args, Null(SV**), 0, Null(bool*)); @@ -1249,16 +1237,8 @@ mess(const char *pat, va_list *args) return SvPVX(sv); } -#ifdef I_STDARG OP * die(const char* pat, ...) -#else -/*VARARGS0*/ -OP * -die(pat, va_alist) - const char *pat; - va_dcl -#endif { dTHR; va_list args; @@ -1274,11 +1254,7 @@ die(pat, va_alist) thr, curstack, mainstack)); #endif /* USE_THREADS */ -#ifdef I_STDARG va_start(args, pat); -#else - va_start(args); -#endif message = pat ? mess(pat, &args) : Nullch; va_end(args); @@ -1330,16 +1306,8 @@ die(pat, va_alist) return restartop; } -#ifdef I_STDARG void croak(const char* pat, ...) -#else -/*VARARGS0*/ -void -croak(pat, va_alist) - char *pat; - va_dcl -#endif { dTHR; va_list args; @@ -1348,11 +1316,7 @@ croak(pat, va_alist) GV *gv; CV *cv; -#ifdef I_STDARG va_start(args, pat); -#else - va_start(args); -#endif message = mess(pat, &args); va_end(args); #ifdef USE_THREADS @@ -1394,14 +1358,7 @@ croak(pat, va_alist) } void -#ifdef I_STDARG warn(const char* pat,...) -#else -/*VARARGS0*/ -warn(pat,va_alist) - const char *pat; - va_dcl -#endif { va_list args; char *message; @@ -1409,11 +1366,7 @@ warn(pat,va_alist) GV *gv; CV *cv; -#ifdef I_STDARG va_start(args, pat); -#else - va_start(args); -#endif message = mess(pat, &args); va_end(args); @@ -1672,7 +1625,6 @@ register I32 len; } #endif /* !HAS_MEMCMP || !HAS_SANE_MEMCMP */ -#if defined(I_STDARG) || defined(I_VARARGS) #ifndef HAS_VPRINTF #ifdef USE_CHAR_VSPRINTF @@ -1703,7 +1655,6 @@ char *args; } #endif /* HAS_VPRINTF */ -#endif /* I_VARARGS || I_STDARGS */ #ifdef MYSWAP #if BYTEORDER != 0x4321 @@ -1935,8 +1886,8 @@ char *mode; #endif /* !DOSISH */ #ifdef DUMP_FDS -dump_fds(s) -char *s; +void +dump_fds(char *s) { int fd; struct stat tmpstatbuf; @@ -1948,7 +1899,7 @@ char *s; } PerlIO_printf(PerlIO_stderr(),"\n"); } -#endif +#endif /* DUMP_FDS */ #ifndef HAS_DUP2 int diff --git a/x2p/util.c b/x2p/util.c index f8e342c..547899f 100644 --- a/x2p/util.c +++ b/x2p/util.c @@ -13,9 +13,7 @@ #include "INTERN.h" #include "util.h" -#ifdef I_STDARG -# include -#endif +#include #define FLUSH static char nomem[] = "Out of memory!\n"; @@ -176,16 +174,9 @@ growstr(char **strptr, int *curlen, int newlen) } void -#if defined(I_STDARG) && defined(HAS_VPRINTF) croak(char *pat,...) -#else /* I_STDARG */ -/*VARARGS1*/ -croak(pat,a1,a2,a3,a4) - char *pat; - int a1,a2,a3,a4; -#endif /* I_STDARG */ { -#if defined(I_STDARG) && defined(HAS_VPRINTF) +#if defined(HAS_VPRINTF) va_list args; va_start(args, pat); @@ -197,16 +188,9 @@ croak(pat,a1,a2,a3,a4) } void -#if defined(I_STDARG) && defined(HAS_VPRINTF) fatal(char *pat,...) -#else /* I_STDARG */ -/*VARARGS1*/ -fatal(pat,a1,a2,a3,a4) - char *pat; - int a1,a2,a3,a4; -#endif /* I_STDARG */ { -#if defined(I_STDARG) && defined(HAS_VPRINTF) +#if defined(HAS_VPRINTF) va_list args; va_start(args, pat); @@ -218,16 +202,9 @@ fatal(pat,a1,a2,a3,a4) } void -#if defined(I_STDARG) && defined(HAS_VPRINTF) warn(char *pat,...) -#else /* I_STDARG */ -/*VARARGS1*/ -warn(pat,a1,a2,a3,a4) - char *pat; - int a1,a2,a3,a4; -#endif /* I_STDARG */ { -#if defined(I_STDARG) && defined(HAS_VPRINTF) +#if defined(HAS_VPRINTF) va_list args; va_start(args, pat); diff --git a/x2p/util.h b/x2p/util.h index ff93e8a..aa31bea 100644 --- a/x2p/util.h +++ b/x2p/util.h @@ -28,15 +28,9 @@ void growstr _(( char **strptr, int *curlen, int newlen )); char * instr _(( char *big, char *little )); char * safecpy _(( char *to, char *from, int len )); char * savestr _(( char *str )); -#if defined(I_STDARG) && defined(HAS_VPRINTF) void croak _(( char *pat, ... )); void fatal _(( char *pat, ... )); void warn _(( char *pat, ... )); -#else /* defined(I_STDARG) && defined(HAS_VPRINTF) */ -void croak _(( char *pat, int a1, int a2, int a3, int a4 )); -void Myfatal (); -void warn (); -#endif /* defined(I_STDARG) && defined(HAS_VPRINTF) */ int prewalk _(( int numit, int level, int node, int *numericptr )); Malloc_t safemalloc _((MEM_SIZE nbytes));