diff options
author | Dave Mitchell <davem@fdisolutions.com> | 2007-09-25 18:00:32 +0000 |
---|---|---|
committer | Dave Mitchell <davem@fdisolutions.com> | 2007-09-25 18:00:32 +0000 |
commit | cbec8ebe2f7855c619451e56c6921e1537d3eba5 (patch) | |
tree | b15c2a3f29a517dce5b080fa94e0beef050444dc | |
parent | 6f8d0260355f8c4ae7955768122638ad99f0ebab (diff) | |
download | perl-cbec8ebe2f7855c619451e56c6921e1537d3eba5.tar.gz |
make PERL_SYS_INIT/INIT3/TERM into functions
p4raw-id: //depot/perl@31970
-rw-r--r-- | dosish.h | 14 | ||||
-rw-r--r-- | embed.fnc | 4 | ||||
-rw-r--r-- | epoc/epocish.h | 8 | ||||
-rw-r--r-- | global.sym | 3 | ||||
-rw-r--r-- | mpeix/mpeixish.h | 8 | ||||
-rw-r--r-- | os2/os2ish.h | 14 | ||||
-rw-r--r-- | perl.c | 27 | ||||
-rw-r--r-- | perl.h | 8 | ||||
-rw-r--r-- | plan9/plan9ish.h | 4 | ||||
-rw-r--r-- | proto.h | 11 | ||||
-rw-r--r-- | symbian/symbianish.h | 7 | ||||
-rw-r--r-- | unixish.h | 8 | ||||
-rw-r--r-- | vms/vmsish.h | 4 |
13 files changed, 85 insertions, 35 deletions
@@ -16,7 +16,7 @@ #ifdef DJGPP # define BIT_BUCKET "nul" # define OP_BINARY O_BINARY -# define PERL_SYS_INIT(c,v) \ +# define PERL_SYS_INIT_BODY(c,v) \ MALLOC_CHECK_TAINT2(*c,*v) Perl_DJGPP_init(c,v); PERLIO_INIT # define init_os_extras Perl_init_os_extras # define HAS_UTIME @@ -29,25 +29,25 @@ # define PERL_FS_VER_FMT "%d_%d_%d" #else /* DJGPP */ # ifdef WIN32 -# define PERL_SYS_INIT(c,v) \ +# define PERL_SYS_INIT_BODY(c,v) \ MALLOC_CHECK_TAINT2(*c,*v) Perl_win32_init(c,v); PERLIO_INIT -# define PERL_SYS_TERM() Perl_win32_term() +# define PERL_SYS_TERM_BODY() Perl_win32_term() # define BIT_BUCKET "nul" # else # ifdef NETWARE -# define PERL_SYS_INIT(c,v) \ +# define PERL_SYS_INIT_BODY(c,v) \ MALLOC_CHECK_TAINT2(*c,*v) Perl_nw5_init(c,v); PERLIO_INIT # define BIT_BUCKET "nwnul" # else -# define PERL_SYS_INIT(c,v) \ +# define PERL_SYS_INIT_BODY(c,v) \ MALLOC_CHECK_TAINT2(*c,*v); PERLIO_INIT # define BIT_BUCKET "\\dev\\nul" /* "wanna be like, umm, Newlined, or somethin?" */ # endif /* NETWARE */ # endif #endif /* DJGPP */ -#ifndef PERL_SYS_TERM -# define PERL_SYS_TERM() HINTS_REFCNT_TERM; OP_REFCNT_TERM; PERLIO_TERM; MALLOC_TERM +#ifndef PERL_SYS_TERM_BODY +# define PERL_SYS_TERM_BODY() HINTS_REFCNT_TERM; OP_REFCNT_TERM; PERLIO_TERM; MALLOC_TERM #endif #define dXSUB_SYS @@ -1890,6 +1890,10 @@ sd |AV* |mro_get_linear_isa_dfs|NN HV* stash|I32 level pd |void |mro_isa_changed_in|NN HV* stash Apd |void |mro_method_changed_in |NN HV* stash p |void |boot_core_mro +Apon |void |sys_init |NN int* argc|NN char*** argv +Apon |void |sys_init3 |NN int* argc|NN char*** argv|NN char*** env +Apo |void |sys_term + END_EXTERN_C /* diff --git a/epoc/epocish.h b/epoc/epocish.h index 34121ef16f..bd364ec563 100644 --- a/epoc/epocish.h +++ b/epoc/epocish.h @@ -107,14 +107,14 @@ /* epocemx setenv bug workaround */ -#ifndef PERL_SYS_INIT -# define PERL_SYS_INIT(c,v) \ +#ifndef PERL_SYS_INIT_BODY +# define PERL_SYS_INIT_BODY(c,v) \ MALLOC_CHECK_TAINT2(*c,*v) putenv(".dummy=foo"); putenv(".dummy"); \ PERLIO_INIT; MALLOC_INIT #endif -#ifndef PERL_SYS_TERM -#define PERL_SYS_TERM() PERLIO_TERM; MALLOC_TERM +#ifndef PERL_SYS_TERM_BODY +#define PERL_SYS_TERM_BODY() PERLIO_TERM; MALLOC_TERM #endif #define BIT_BUCKET "/dev/null" diff --git a/global.sym b/global.sym index a260a86378..39cdaf293b 100644 --- a/global.sym +++ b/global.sym @@ -763,4 +763,7 @@ Perl_emulate_cop_io Perl_get_re_arg Perl_mro_get_linear_isa Perl_mro_method_changed_in +Perl_sys_init +Perl_sys_init3 +Perl_sys_term # ex: set ro: diff --git a/mpeix/mpeixish.h b/mpeix/mpeixish.h index 8364720589..f4ce38ebb3 100644 --- a/mpeix/mpeixish.h +++ b/mpeix/mpeixish.h @@ -110,12 +110,12 @@ #define Fflush(fp) fflush(fp) #define Mkdir(path,mode) mkdir((path),(mode)) -#ifndef PERL_SYS_INIT -# define PERL_SYS_INIT(c,v) PERL_FPU_INIT; PERLIO_INIT; MALLOC_INIT +#ifndef PERL_SYS_INIT_BODY +# define PERL_SYS_INIT_BODY(c,v) PERL_FPU_INIT; PERLIO_INIT; MALLOC_INIT #endif -#ifndef PERL_SYS_TERM -#define PERL_SYS_TERM() PERLIO_TERM; MALLOC_TERM +#ifndef PERL_SYS_TERM_BODY +#define PERL_SYS_TERM_BODY() PERLIO_TERM; MALLOC_TERM #endif #define BIT_BUCKET "/dev/null" diff --git a/os2/os2ish.h b/os2/os2ish.h index a4b972ff02..a1072a3da6 100644 --- a/os2/os2ish.h +++ b/os2/os2ish.h @@ -223,7 +223,7 @@ void Perl_OS2_term(void **excH, int exitstatus, int flags); /* These ones should be in the same block as PERL_SYS_TERM() */ #ifdef PERL_CORE -# define PERL_SYS_INIT3(argcp, argvp, envp) \ +# define PERL_SYS_INIT3_BODY(argcp, argvp, envp) \ { void *xreg[2]; \ MALLOC_CHECK_TAINT(*argcp, *argvp, *envp) \ _response(argcp, argvp); \ @@ -231,7 +231,7 @@ void Perl_OS2_term(void **excH, int exitstatus, int flags); Perl_OS2_init3(*envp, xreg, 0); \ PERLIO_INIT -# define PERL_SYS_INIT(argcp, argvp) { \ +# define PERL_SYS_INIT_BODY(argcp, argvp) { \ { void *xreg[2]; \ _response(argcp, argvp); \ _wildcard(argcp, argvp); \ @@ -240,11 +240,11 @@ void Perl_OS2_term(void **excH, int exitstatus, int flags); #else /* Compiling embedded Perl or Perl extension */ -# define PERL_SYS_INIT3(argcp, argvp, envp) \ +# define PERL_SYS_INIT3_BODY(argcp, argvp, envp) \ { void *xreg[2]; \ Perl_OS2_init3(*envp, xreg, 0); \ PERLIO_INIT -# define PERL_SYS_INIT(argcp, argvp) { \ +# define PERL_SYS_INIT_BODY(argcp, argvp) { \ { void *xreg[2]; \ Perl_OS2_init3(NULL, xreg, 0); \ PERLIO_INIT @@ -262,8 +262,8 @@ void Perl_OS2_term(void **excH, int exitstatus, int flags); #define PERL_SYS_TERM1(xreg) \ Perl_OS2_term(xreg, 0, FORCE_EMX_DEINIT_RUN_ATEXIT) -/* This one should come in pair with PERL_SYS_INIT() and in the same block */ -#define PERL_SYS_TERM() \ +/* This one should come in pair with PERL_SYS_INIT_BODY() and in the same block */ +#define PERL_SYS_TERM_BODY() \ PERL_SYS_TERM1(xreg); \ } @@ -271,7 +271,7 @@ void Perl_OS2_term(void **excH, int exitstatus, int flags); # define PERL_CALLCONV _System #endif -/* #define PERL_SYS_TERM() STMT_START { \ +/* #define PERL_SYS_TERM_BODY() STMT_START { \ if (Perl_HAB_set) WinTerminate(Perl_hab); } STMT_END */ #define dXSUB_SYS OS2_XS_init() @@ -181,6 +181,33 @@ S_init_tls_and_interp(PerlInterpreter *my_perl) } } + +/* these implement the PERL_SYS_INIT, PERL_SYS_INIT3, PERL_SYS_TERM macros */ + +void +Perl_sys_init(int* argc, char*** argv) +{ + PERL_UNUSED_ARG(argc); /* may not be used depending on _BODY macro */ + PERL_UNUSED_ARG(argv); + PERL_SYS_INIT_BODY(argc, argv); +} + +void +Perl_sys_init3(int* argc, char*** argv, char*** env) +{ + PERL_UNUSED_ARG(argc); /* may not be used depending on _BODY macro */ + PERL_UNUSED_ARG(argv); + PERL_UNUSED_ARG(env); + PERL_SYS_INIT3_BODY(argc, argv, env); +} + +void +Perl_sys_term(pTHX) +{ + PERL_SYS_TERM_BODY(); +} + + #ifdef PERL_IMPLICIT_SYS PerlInterpreter * perl_alloc_using(struct IPerlMem* ipM, struct IPerlMem* ipMS, @@ -2648,10 +2648,14 @@ typedef struct clone_params CLONE_PARAMS; # define PERL_FPU_POST_EXEC } #endif -#ifndef PERL_SYS_INIT3 -# define PERL_SYS_INIT3(argvp,argcp,envp) PERL_SYS_INIT(argvp,argcp) +#ifndef PERL_SYS_INIT3_BODY +# define PERL_SYS_INIT3_BODY(argvp,argcp,envp) PERL_SYS_INIT_BODY(argvp,argcp) #endif +#define PERL_SYS_INIT(argc, argv) Perl_sys_init(argc, argv) +#define PERL_SYS_INIT3(argc, argv, env) Perl_sys_init3(argc, argv, env) +#define PERL_SYS_TERM() Perl_sys_term(aTHX) + #ifndef PERL_WRITE_MSG_TO_CONSOLE # define PERL_WRITE_MSG_TO_CONSOLE(io, msg, len) PerlIO_write(io, msg, len) #endif diff --git a/plan9/plan9ish.h b/plan9/plan9ish.h index 20db6e9d7f..0fdce125be 100644 --- a/plan9/plan9ish.h +++ b/plan9/plan9ish.h @@ -104,10 +104,10 @@ #define ABORT() kill(PerlProc_getpid(),SIGABRT); #define BIT_BUCKET "/dev/null" -#define PERL_SYS_INIT(c,v) \ +#define PERL_SYS_INIT_BODY(c,v) \ MALLOC_CHECK_TAINT2(*c,*v) PERLIO_INIT; MALLOC_INIT #define dXSUB_SYS -#define PERL_SYS_TERM() PERLIO_TERM; MALLOC_TERM +#define PERL_SYS_TERM_BODY() PERLIO_TERM; MALLOC_TERM /* * fwrite1() should be a routine with the same calling sequence as fwrite(), @@ -4701,6 +4701,17 @@ PERL_CALLCONV void Perl_mro_method_changed_in(pTHX_ HV* stash) __attribute__nonnull__(pTHX_1); PERL_CALLCONV void Perl_boot_core_mro(pTHX); +PERL_CALLCONV void Perl_sys_init(int* argc, char*** argv) + __attribute__nonnull__(1) + __attribute__nonnull__(2); + +PERL_CALLCONV void Perl_sys_init3(int* argc, char*** argv, char*** env) + __attribute__nonnull__(1) + __attribute__nonnull__(2) + __attribute__nonnull__(3); + +PERL_CALLCONV void Perl_sys_term(pTHX); + END_EXTERN_C /* diff --git a/symbian/symbianish.h b/symbian/symbianish.h index b8e6940e07..a76a755587 100644 --- a/symbian/symbianish.h +++ b/symbian/symbianish.h @@ -119,8 +119,9 @@ #define Fflush(fp) fflush(fp) #define Mkdir(path,mode) mkdir((path),(mode)) -#ifndef PERL_SYS_TERM -#define PERL_SYS_TERM() HINTS_REFCNT_TERM; OP_REFCNT_TERM; PERLIO_TERM; MALLOC_TERM; CloseSTDLIB(); +#ifndef PERL_SYS_TERM_BODY +#define PERL_SYS_TERM_BODY() HINTS_REFCNT_TERM; OP_REFCNT_TERM; \ + PERLIO_TERM; MALLOC_TERM; CloseSTDLIB(); #endif #define BIT_BUCKET "NUL:" @@ -170,7 +171,7 @@ pid_t wait(int *status); #define times(b) symbian_times(b) #define usleep(u) symbian_usleep(u) -#define PERL_SYS_INIT(c, v) symbian_sys_init(c, v) +#define PERL_SYS_INIT_BODY(c, v) symbian_sys_init(c, v) #ifdef __SERIES60_1X__ # error "Unfortunately Perl does not work in S60 1.2 (see FAQ-0929)" @@ -126,13 +126,13 @@ #define Fflush(fp) fflush(fp) #define Mkdir(path,mode) mkdir((path),(mode)) -#ifndef PERL_SYS_INIT -# define PERL_SYS_INIT(c,v) \ +#ifndef PERL_SYS_INIT_BODY +# define PERL_SYS_INIT_BODY(c,v) \ MALLOC_CHECK_TAINT2(*c,*v) PERL_FPU_INIT; PERLIO_INIT; MALLOC_INIT #endif -#ifndef PERL_SYS_TERM -# define PERL_SYS_TERM() \ +#ifndef PERL_SYS_TERM_BODY +# define PERL_SYS_TERM_BODY() \ if (!PL_veto_cleanup) { \ HINTS_REFCNT_TERM; OP_REFCNT_TERM; PERLIO_TERM; MALLOC_TERM; \ } diff --git a/vms/vmsish.h b/vms/vmsish.h index a9452eb4f1..a0a52a3f86 100644 --- a/vms/vmsish.h +++ b/vms/vmsish.h @@ -402,8 +402,8 @@ struct interp_intern { #else #define BIT_BUCKET "/dev/null" #endif -#define PERL_SYS_INIT(c,v) MALLOC_CHECK_TAINT2(*c,*v) vms_image_init((c),(v)); PERLIO_INIT; MALLOC_INIT -#define PERL_SYS_TERM() HINTS_REFCNT_TERM; OP_REFCNT_TERM; PERLIO_TERM; MALLOC_TERM +#define PERL_SYS_INIT_BODY(c,v) MALLOC_CHECK_TAINT2(*c,*v) vms_image_init((c),(v)); PERLIO_INIT; MALLOC_INIT +#define PERL_SYS_TERM_BODY() HINTS_REFCNT_TERM; OP_REFCNT_TERM; PERLIO_TERM; MALLOC_TERM #define dXSUB_SYS #define HAS_KILL #define HAS_WAIT |