diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2005-04-18 16:18:30 +0300 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2005-04-21 15:38:30 +0000 |
commit | 27da23d53ccce622bc51822f59df8def79b4df95 (patch) | |
tree | 1202440e0fbf7a2fc1bb54993d11cda7b245f1b4 /mg.c | |
parent | ec0624293b57ae07d6b2c32bae099d4f163e7e07 (diff) | |
download | perl-27da23d53ccce622bc51822f59df8def79b4df95.tar.gz |
Symbian port of Perl
Message-ID: <B356D8F434D20B40A8CEDAEC305A1F2453D653@esebe105.NOE.Nokia.com>
p4raw-id: //depot/perl@24271
Diffstat (limited to 'mg.c')
-rw-r--r-- | mg.c | 76 |
1 files changed, 34 insertions, 42 deletions
@@ -580,6 +580,7 @@ Perl_magic_len(pTHX_ SV *sv, MAGIC *mg) int Perl_magic_get(pTHX_ SV *sv, MAGIC *mg) { + dVAR; register I32 paren; register char *s = NULL; register I32 i; @@ -962,6 +963,7 @@ Perl_magic_getuvar(pTHX_ SV *sv, MAGIC *mg) int Perl_magic_setenv(pTHX_ SV *sv, MAGIC *mg) { + dVAR; register char *s; char *ptr; STRLEN len, klen; @@ -1047,7 +1049,7 @@ Perl_magic_clearenv(pTHX_ SV *sv, MAGIC *mg) int Perl_magic_set_all_env(pTHX_ SV *sv, MAGIC *mg) { -#if defined(VMS) +#if defined(VMS) || defined(EPOC) || defined(SYMBIAN) Perl_die(aTHX_ "Can't make list assignment to %%ENV on this system"); #else if (PL_localizing) { @@ -1068,8 +1070,9 @@ Perl_magic_set_all_env(pTHX_ SV *sv, MAGIC *mg) int Perl_magic_clear_all_env(pTHX_ SV *sv, MAGIC *mg) { + dVAR; #ifndef PERL_MICRO -#if defined(VMS) || defined(EPOC) +#if defined(VMS) || defined(EPOC) || defined(SYMBIAN) Perl_die(aTHX_ "Can't make list assignment to %%ENV on this system"); #else # if defined(PERL_IMPLICIT_SYS) || defined(WIN32) @@ -1104,16 +1107,6 @@ Perl_magic_clear_all_env(pTHX_ SV *sv, MAGIC *mg) return 0; } -#if defined(FAKE_PERSISTENT_SIGNAL_HANDLERS)||defined(FAKE_DEFAULT_SIGNAL_HANDLERS) -static int sig_handlers_initted = 0; -#endif -#ifdef FAKE_PERSISTENT_SIGNAL_HANDLERS -static int sig_ignoring[SIG_SIZE]; /* which signals we are ignoring */ -#endif -#ifdef FAKE_DEFAULT_SIGNAL_HANDLERS -static int sig_defaulting[SIG_SIZE]; -#endif - #ifndef PERL_MICRO #ifdef HAS_SIGPROCMASK static void @@ -1137,10 +1130,10 @@ Perl_magic_getsig(pTHX_ SV *sv, MAGIC *mg) Sighandler_t sigstate; sigstate = rsignal_state(i); #ifdef FAKE_PERSISTENT_SIGNAL_HANDLERS - if (sig_handlers_initted && sig_ignoring[i]) sigstate = SIG_IGN; + if (PL_sig_handlers_initted && PL_sig_ignoring[i]) sigstate = SIG_IGN; #endif #ifdef FAKE_DEFAULT_SIGNAL_HANDLERS - if (sig_handlers_initted && sig_defaulting[i]) sigstate = SIG_DFL; + if (PL_sig_handlers_initted && PL_sig_defaulting[i]) sigstate = SIG_DFL; #endif /* cache state so we don't fetch it again */ if(sigstate == SIG_IGN) @@ -1159,18 +1152,19 @@ Perl_magic_clearsig(pTHX_ SV *sv, MAGIC *mg) /* XXX Some of this code was copied from Perl_magic_setsig. A little * refactoring might be in order. */ + dVAR; STRLEN n_a; register const char *s = MgPV(mg,n_a); (void)sv; if (*s == '_') { - SV** svp; + SV** svp = 0; if (strEQ(s,"__DIE__")) svp = &PL_diehook; else if (strEQ(s,"__WARN__")) svp = &PL_warnhook; else Perl_croak(aTHX_ "No such hook: %s", s); - if (*svp) { + if (svp && *svp) { SV *to_dec = *svp; *svp = 0; SvREFCNT_dec(to_dec); @@ -1195,10 +1189,10 @@ Perl_magic_clearsig(pTHX_ SV *sv, MAGIC *mg) #endif PERL_ASYNC_CHECK(); #if defined(FAKE_PERSISTENT_SIGNAL_HANDLERS) || defined(FAKE_DEFAULT_SIGNAL_HANDLERS) - if (!sig_handlers_initted) Perl_csighandler_init(); + if (!PL_sig_handlers_initted) Perl_csighandler_init(); #endif #ifdef FAKE_DEFAULT_SIGNAL_HANDLERS - sig_defaulting[i] = 1; + PL_sig_defaulting[i] = 1; (void)rsignal(i, PL_csighandlerp); #else (void)rsignal(i, SIG_DFL); @@ -1239,10 +1233,10 @@ Perl_csighandler(int sig) #endif #ifdef FAKE_PERSISTENT_SIGNAL_HANDLERS (void) rsignal(sig, PL_csighandlerp); - if (sig_ignoring[sig]) return; + if (PL_sig_ignoring[sig]) return; #endif #ifdef FAKE_DEFAULT_SIGNAL_HANDLERS - if (sig_defaulting[sig]) + if (PL_sig_defaulting[sig]) #ifdef KILL_BY_SIGPRC exit((Perl_sig_to_vmscondition(sig)&STS$M_COND_ID)|STS$K_SEVERE|STS$M_INHIB_MSG); #else @@ -1262,19 +1256,19 @@ void Perl_csighandler_init(void) { int sig; - if (sig_handlers_initted) return; + if (PL_sig_handlers_initted) return; for (sig = 1; sig < SIG_SIZE; sig++) { #ifdef FAKE_DEFAULT_SIGNAL_HANDLERS dTHX; - sig_defaulting[sig] = 1; + PL_sig_defaulting[sig] = 1; (void) rsignal(sig, PL_csighandlerp); #endif #ifdef FAKE_PERSISTENT_SIGNAL_HANDLERS - sig_ignoring[sig] = 0; + PL_sig_ignoring[sig] = 0; #endif } - sig_handlers_initted = 1; + PL_sig_handlers_initted = 1; } #endif @@ -1297,6 +1291,7 @@ Perl_despatch_signals(pTHX) int Perl_magic_setsig(pTHX_ SV *sv, MAGIC *mg) { + dVAR; I32 i; SV** svp = 0; /* Need to be careful with SvREFCNT_dec(), because that can have side @@ -1343,13 +1338,13 @@ Perl_magic_setsig(pTHX_ SV *sv, MAGIC *mg) #endif PERL_ASYNC_CHECK(); #if defined(FAKE_PERSISTENT_SIGNAL_HANDLERS) || defined(FAKE_DEFAULT_SIGNAL_HANDLERS) - if (!sig_handlers_initted) Perl_csighandler_init(); + if (!PL_sig_handlers_initted) Perl_csighandler_init(); #endif #ifdef FAKE_PERSISTENT_SIGNAL_HANDLERS - sig_ignoring[i] = 0; + PL_sig_ignoring[i] = 0; #endif #ifdef FAKE_DEFAULT_SIGNAL_HANDLERS - sig_defaulting[i] = 0; + PL_sig_defaulting[i] = 0; #endif SvREFCNT_dec(PL_psig_name[i]); to_dec = PL_psig_ptr[i]; @@ -1375,7 +1370,7 @@ Perl_magic_setsig(pTHX_ SV *sv, MAGIC *mg) if (strEQ(s,"IGNORE")) { if (i) { #ifdef FAKE_PERSISTENT_SIGNAL_HANDLERS - sig_ignoring[i] = 1; + PL_sig_ignoring[i] = 1; (void)rsignal(i, PL_csighandlerp); #else (void)rsignal(i, SIG_IGN); @@ -1386,7 +1381,7 @@ Perl_magic_setsig(pTHX_ SV *sv, MAGIC *mg) if (i) #ifdef FAKE_DEFAULT_SIGNAL_HANDLERS { - sig_defaulting[i] = 1; + PL_sig_defaulting[i] = 1; (void)rsignal(i, PL_csighandlerp); } #else @@ -1498,7 +1493,7 @@ S_magic_methcall(pTHX_ SV *sv, const MAGIC *mg, const char *meth, I32 flags, int STATIC int S_magic_methpack(pTHX_ SV *sv, const MAGIC *mg, const char *meth) { - dSP; + dVAR; dSP; ENTER; SAVETMPS; @@ -1526,7 +1521,7 @@ Perl_magic_getpack(pTHX_ SV *sv, MAGIC *mg) int Perl_magic_setpack(pTHX_ SV *sv, MAGIC *mg) { - dSP; + dVAR; dSP; ENTER; PUSHSTACKi(PERLSI_MAGIC); magic_methcall(sv, mg, "STORE", G_SCALAR|G_DISCARD, 3, sv); @@ -1545,7 +1540,7 @@ Perl_magic_clearpack(pTHX_ SV *sv, MAGIC *mg) U32 Perl_magic_sizepack(pTHX_ SV *sv, MAGIC *mg) { - dSP; + dVAR; dSP; U32 retval = 0; ENTER; @@ -1564,7 +1559,7 @@ Perl_magic_sizepack(pTHX_ SV *sv, MAGIC *mg) int Perl_magic_wipepack(pTHX_ SV *sv, MAGIC *mg) { - dSP; + dVAR; dSP; ENTER; PUSHSTACKi(PERLSI_MAGIC); @@ -1581,7 +1576,7 @@ Perl_magic_wipepack(pTHX_ SV *sv, MAGIC *mg) int Perl_magic_nextpack(pTHX_ SV *sv, MAGIC *mg, SV *key) { - dSP; + dVAR; dSP; const char * const meth = SvOK(key) ? "NEXTKEY" : "FIRSTKEY"; ENTER; @@ -1612,7 +1607,7 @@ Perl_magic_existspack(pTHX_ SV *sv, MAGIC *mg) SV * Perl_magic_scalarpack(pTHX_ HV *hv, MAGIC *mg) { - dSP; + dVAR; dSP; SV *retval = &PL_sv_undef; SV *tied = SvTIED_obj((SV*)hv, mg); HV *pkg = SvSTASH((SV*)SvRV(tied)); @@ -2524,7 +2519,7 @@ Perl_magic_set(pTHX_ SV *sv, MAGIC *mg) I32 Perl_whichsig(pTHX_ const char *sig) { - register const char **sigv; + register const char * const *sigv; for (sigv = PL_sig_name; *sigv; sigv++) if (strEQ(sig,*sigv)) @@ -2540,10 +2535,6 @@ Perl_whichsig(pTHX_ const char *sig) return -1; } -#if !defined(PERL_IMPLICIT_CONTEXT) -static SV* sig_sv; -#endif - Signal_t Perl_sighandler(int sig) { @@ -2603,7 +2594,7 @@ Perl_sighandler(int sig) sv = SvREFCNT_inc(PL_psig_name[sig]); flags |= 64; #if !defined(PERL_IMPLICIT_CONTEXT) - sig_sv = sv; + PL_sig_sv = sv; #endif } else { sv = sv_newmortal(); @@ -2705,6 +2696,7 @@ restore_magic(pTHX_ const void *p) static void unwind_handler_stack(pTHX_ const void *p) { + dVAR; const U32 flags = *(const U32*)p; if (flags & 1) @@ -2712,7 +2704,7 @@ unwind_handler_stack(pTHX_ const void *p) /* cxstack_ix-- Not needed, die already unwound it. */ #if !defined(PERL_IMPLICIT_CONTEXT) if (flags & 64) - SvREFCNT_dec(sig_sv); + SvREFCNT_dec(PL_sig_sv); #endif } |