diff options
author | Nicholas Clark <nick@ccl4.org> | 2011-08-07 21:09:03 +0200 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2011-08-11 11:38:46 +0200 |
commit | 115ff745268490ae5fb5ecaee00be54172e302e0 (patch) | |
tree | 18788de5ba03a4598d0cdd3b776e2dd257df050f /regen | |
parent | e469e61f2b416389b7fb67acaf0d21735066e6ee (diff) | |
download | perl-115ff745268490ae5fb5ecaee00be54172e302e0.tar.gz |
Simplify embedvar.h, removing a level of macro indirection for PL_* variables.
For the default (non-multiplicity) configuration, PERLVAR*() macros now
directly expand their arguments to tokens such as C<PL_defgv>, instead of
expanding to C<PL_Idefgv>. This removes over 350 lines from F<embedvar.h>,
which defined macros to map from C<PL_Idefgv> to C<PL_defgv> and so forth.
Diffstat (limited to 'regen')
-rwxr-xr-x | regen/embed.pl | 63 |
1 files changed, 15 insertions, 48 deletions
diff --git a/regen/embed.pl b/regen/embed.pl index 232af368c2..71422bbaa8 100755 --- a/regen/embed.pl +++ b/regen/embed.pl @@ -368,7 +368,7 @@ sub readvars { or die "embed.pl: Can't open $file: $!\n"; while (<FILE>) { s/[ \t]*#.*//; # Delete comments. - if (/PERLVARA?I?C?\($pre(\w+)/) { + if (/PERLVARA?I?C?\($pre,\s*(\w+)/) { warn "duplicate symbol $1 while processing $file line $.\n" if $seen{$1}++; } @@ -392,11 +392,6 @@ sub multon ($$$) { hide("PL_$sym", "($ptr$pre$sym)"); } -sub multoff ($$) { - my ($sym,$pre) = @_; - return hide("PL_$pre$sym", "PL_$sym"); -} - my $em = open_print_header('embed.h'); print $em <<'END'; @@ -593,22 +588,6 @@ for $sym (@intrp) { print $em <<'END'; -#else /* !MULTIPLICITY */ - -/* case 1 above */ - -END - -for $sym (@intrp) { - print $em multoff($sym,'I'); -} - -print $em <<'END'; - -END - -print $em <<'END'; - #endif /* MULTIPLICITY */ #if defined(PERL_GLOBAL_STRUCT) @@ -624,18 +603,6 @@ for $sym (@globvar) { print $em <<'END'; -#else /* !PERL_GLOBAL_STRUCT */ - -END - -for $sym (@globvar) { - print $em "#ifdef OS2\n" if $sym eq 'sh_path'; - print $em multoff($sym,'G'); - print $em "#endif\n" if $sym eq 'sh_path'; -} - -print $em <<'END'; - #endif /* PERL_GLOBAL_STRUCT */ END @@ -656,11 +623,11 @@ START_EXTERN_C #undef PERLVARA #undef PERLVARI #undef PERLVARIC -#define PERLVAR(v,t) EXTERN_C t* Perl_##v##_ptr(pTHX); -#define PERLVARA(v,n,t) typedef t PL_##v##_t[n]; \ - EXTERN_C PL_##v##_t* Perl_##v##_ptr(pTHX); -#define PERLVARI(v,t,i) PERLVAR(v,t) -#define PERLVARIC(v,t,i) PERLVAR(v, const t) +#define PERLVAR(p,v,t) EXTERN_C t* Perl_##p##v##_ptr(pTHX); +#define PERLVARA(p,v,n,t) typedef t PL_##v##_t[n]; \ + EXTERN_C PL_##v##_t* Perl_##p##v##_ptr(pTHX); +#define PERLVARI(p,v,t,i) PERLVAR(p,v,t) +#define PERLVARIC(p,v,t,i) PERLVAR(p,v, const t) #include "perlvars.h" @@ -690,10 +657,10 @@ EXTCONST void * const PL_force_link_funcs[] = { #undef PERLVARA #undef PERLVARI #undef PERLVARIC -#define PERLVAR(v,t) (void*)Perl_##v##_ptr, -#define PERLVARA(v,n,t) PERLVAR(v,t) -#define PERLVARI(v,t,i) PERLVAR(v,t) -#define PERLVARIC(v,t,i) PERLVAR(v,t) +#define PERLVAR(p,v,t) (void*)Perl_##p##v##_ptr, +#define PERLVARA(p,v,n,t) PERLVAR(p,v,t) +#define PERLVARI(p,v,t,i) PERLVAR(p,v,t) +#define PERLVARIC(p,v,t,i) PERLVAR(p,v,t) /* In Tru64 (__DEC && __osf__) the cc option -std1 causes that one * cannot cast between void pointers and function pointers without @@ -767,17 +734,17 @@ print $capi <<'EOT'; START_EXTERN_C #undef PERLVARI -#define PERLVARI(v,t,i) PERLVAR(v,t) +#define PERLVARI(p,v,t,i) PERLVAR(p,v,t) #undef PERLVAR #undef PERLVARA -#define PERLVAR(v,t) t* Perl_##v##_ptr(pTHX) \ +#define PERLVAR(p,v,t) t* Perl_##p##v##_ptr(pTHX) \ { dVAR; PERL_UNUSED_CONTEXT; return &(PL_##v); } -#define PERLVARA(v,n,t) PL_##v##_t* Perl_##v##_ptr(pTHX) \ +#define PERLVARA(p,v,n,t) PL_##v##_t* Perl_##p##v##_ptr(pTHX) \ { dVAR; PERL_UNUSED_CONTEXT; return &(PL_##v); } #undef PERLVARIC -#define PERLVARIC(v,t,i) \ - const t* Perl_##v##_ptr(pTHX) \ +#define PERLVARIC(p,v,t,i) \ + const t* Perl_##p##v##_ptr(pTHX) \ { PERL_UNUSED_CONTEXT; return (const t *)&(PL_##v); } #include "perlvars.h" |