diff options
author | Gurusamy Sarathy <gsar@cpan.org> | 1999-08-20 15:24:08 +0000 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 1999-08-20 15:24:08 +0000 |
commit | 54aff467496406992ab0d6d70a050249feb5efbc (patch) | |
tree | 9d705efcb4450c1c8bd376e098de63972ea1fade /embed.pl | |
parent | a7c6d24429ab2b6db54575a3bdc62c7ed9f881cf (diff) | |
download | perl-54aff467496406992ab0d6d70a050249feb5efbc.tar.gz |
support USE_THREADS+MULTIPLICITY; source compat tweaks for
USE_THREADS and MULTIPLICITY; minor pod adjustments
p4raw-id: //depot/perl@4007
Diffstat (limited to 'embed.pl')
-rwxr-xr-x | embed.pl | 115 |
1 files changed, 45 insertions, 70 deletions
@@ -257,16 +257,11 @@ sub objxsub_var ($$) { undefine("PL_$sym") . hide("PL_$sym", "(*Perl_${pfx}${sym}_ptr($arg))"); } -sub embedvar ($) { - my ($sym) = @_; -# hide($sym, "Perl_$sym"); - return ''; -} - sub multon ($$$) { my ($sym,$pre,$ptr) = @_; hide("PL_$sym", "($ptr$pre$sym)"); } + sub multoff ($$) { my ($sym,$pre) = @_; return hide("PL_$pre$sym", "PL_$sym"); @@ -533,42 +528,45 @@ print EM <<'END'; /* (Doing namespace management portably in C is really gross.) */ -/* Put interpreter-specific symbols into a struct? */ - -#ifdef MULTIPLICITY - -#ifndef USE_THREADS -/* If we do not have threads then per-thread vars are per-interpreter */ - -#ifdef PERL_IMPLICIT_CONTEXT - -/* everything has an implicit context pointer */ - -END - -for $sym (sort keys %thread) { - print EM multon($sym,'T','my_perl->'); -} - -print EM <<'END'; +/* + The following combinations of MULTIPLICITY, USE_THREADS, PERL_OBJECT + and PERL_IMPLICIT_CONTEXT are supported: + 1) none + 2) MULTIPLICITY # supported for compatibility + 3) MULTIPLICITY && PERL_IMPLICIT_CONTEXT + 4) USE_THREADS && PERL_IMPLICIT_CONTEXT + 5) MULTIPLICITY && USE_THREADS && PERL_IMPLICIT_CONTEXT + 6) PERL_OBJECT && PERL_IMPLICIT_CONTEXT + + All other combinations of these flags are errors. + + #3, #4, #5, and #6 are supported directly, while #2 is a special + case of #3 (supported by redefining vTHX appropriately). +*/ -#else /* !PERL_IMPLICIT_CONTEXT */ +#if defined(MULTIPLICITY) +/* cases 2, 3 and 5 above */ -/* traditional MULTIPLICITY (intepreter is in a global) */ +# if defined(PERL_IMPLICIT_CONTEXT) +# define vTHX aTHX +# else +# define vTHX PERL_GET_INTERP +# endif END - for $sym (sort keys %thread) { - print EM multon($sym,'T','PERL_GET_INTERP->'); + print EM multon($sym,'T','vTHX->'); } print EM <<'END'; -#endif /* !PERL_IMPLICIT_CONTEXT */ -#endif /* !USE_THREADS */ +# if defined(PERL_OBJECT) +# include "error: PERL_OBJECT + MULTIPLICITY don't go together" +# endif -/* These are always per-interpreter if there is more than one */ +# if defined(USE_THREADS) +/* case 5 above */ END @@ -578,66 +576,56 @@ for $sym (sort keys %intrp) { print EM <<'END'; -#else /* !MULTIPLICITY */ +# else /* !USE_THREADS */ +/* cases 2 and 3 above */ END for $sym (sort keys %intrp) { - print EM multoff($sym,'I'); -} - -print EM <<'END'; - -#ifndef USE_THREADS - -END - -for $sym (sort keys %thread) { - print EM multoff($sym,'T'); + print EM multon($sym,'I','vTHX->'); } print EM <<'END'; -#endif /* USE_THREADS */ +# endif /* USE_THREADS */ -/* Hide what would have been interpreter-specific symbols? */ +#else /* !MULTIPLICITY */ +/* cases 1, 4 and 6 above */ END for $sym (sort keys %intrp) { - print EM embedvar($sym); + print EM multoff($sym,'I'); } print EM <<'END'; -#ifndef USE_THREADS +# if defined(USE_THREADS) +/* case 4 above */ END for $sym (sort keys %thread) { - print EM embedvar($sym); + print EM multon($sym,'T','aTHX->'); } print EM <<'END'; -#endif /* USE_THREADS */ -#endif /* MULTIPLICITY */ - -/* Now same trickey for per-thread variables */ - -#ifdef USE_THREADS +# else /* !USE_THREADS */ +/* cases 1 and 6 above */ END for $sym (sort keys %thread) { - print EM multon($sym,'T','thr->'); + print EM multoff($sym,'T'); } print EM <<'END'; -#endif /* USE_THREADS */ +# endif /* USE_THREADS */ +#endif /* MULTIPLICITY */ -#ifdef PERL_GLOBAL_STRUCT +#if defined(PERL_GLOBAL_STRUCT) END @@ -657,20 +645,8 @@ for $sym (sort keys %globvar) { print EM <<'END'; -END - -for $sym (sort keys %globvar) { - print EM embedvar($sym); -} - -print EM <<'END'; - #endif /* PERL_GLOBAL_STRUCT */ -END - -print EM <<'END'; - #ifdef PERL_POLLUTE /* disabled by default in 5.006 */ END @@ -684,7 +660,6 @@ print EM <<'END'; #endif /* PERL_POLLUTE */ END - close(EM); unlink 'objXSUB.h'; |