require 5.003;
+# XXX others that may need adding
+# warnhook
+# hints
+# copline
+my @extvars = qw(sv_undef sv_yes sv_no na dowarn
+ curcop compiling
+ tainting tainted stack_base stack_sp sv_arenaroot
+ curstash DBsub DBsingle debstash
+ rsfp
+ stdingv
+ defgv
+ errgv
+ rsfp_filters
+ perldb
+ diehook
+ dirty
+ perl_destruct_level
+ );
+
sub readsyms (\%$) {
my ($syms, $file) = @_;
%$syms = ();
}
readsyms %global, 'global.sym';
-readsyms %interp, 'interp.sym';
sub readvars(\%$$) {
my ($syms, $file,$pre) = @_;
or die "embed.pl: Can't open $file: $!\n";
while (<FILE>) {
s/[ \t]*#.*//; # Delete comments.
- if (/PERLVARI?\($pre(\w+)/) {
- $$syms{$1} = $pre;
+ if (/PERLVARI?C?\($pre(\w+)/) {
+ $$syms{$1} = 1;
}
}
close(FILE);
readvars %intrp, 'intrpvar.h','I';
readvars %thread, 'thrdvar.h','T';
-#readvars %global, 'perlvars.h','';
+readvars %globvar, 'perlvars.h','G';
foreach my $sym (sort keys %intrp)
{
- warn "$sym not in interp.sym\n" unless exists $interp{$sym};
if (exists $global{$sym})
{
delete $global{$sym};
- warn "$sym in global.sym as well as interp\n";
+ warn "$sym in global.sym as well as intrpvar.h\n";
}
}
-foreach my $sym (keys %interp)
+foreach my $sym (sort keys %globvar)
{
- warn "extra $sym in interp.sym\n"
- unless exists $intrp{$sym} || exists $thread{$sym};
+ if (exists $global{$sym})
+ {
+ delete $global{$sym};
+ warn "$sym in global.sym as well as perlvars.h\n";
+ }
}
foreach my $sym (sort keys %thread)
{
- warn "$sym in intrpvar.h\n" if exists $intrp{$sym};
+ warn "$sym in intrpvar.h as well as thrdvar.h\n" if exists $intrp{$sym};
if (exists $global{$sym})
{
delete $global{$sym};
- warn "$sym in global.sym as well as thread\n";
+ warn "$sym in global.sym as well as thrdvar.h\n";
}
}
my ($sym) = @_;
hide($sym, "Perl_$sym");
}
+sub embedvar ($) {
+ my ($sym) = @_;
+# hide($sym, "Perl_$sym");
+ return '';
+}
+
sub multon ($$$) {
my ($sym,$pre,$ptr) = @_;
- hide($sym, "($ptr->$pre$sym)");
+ hide("PL_$sym", "($ptr$pre$sym)");
}
sub multoff ($$) {
my ($sym,$pre) = @_;
- hide("$pre$sym", $sym);
+ return hide("PL_$pre$sym", "PL_$sym");
}
unlink 'embed.h';
END
for $sym (sort keys %thread) {
- print EM multon($sym,'T','curinterp');
+ print EM multon($sym,'T','PL_curinterp->');
}
print EM <<'END';
END
for $sym (sort keys %intrp) {
- print EM multon($sym,'I','curinterp');
+ print EM multon($sym,'I','PL_curinterp->');
}
print EM <<'END';
END
for $sym (sort keys %intrp) {
- print EM embed($sym);
+ print EM embedvar($sym);
}
print EM <<'END';
END
for $sym (sort keys %thread) {
- print EM embed($sym);
+ print EM embedvar($sym);
}
print EM <<'END';
END
for $sym (sort keys %thread) {
- print EM multon($sym,'T','thr');
+ print EM multon($sym,'T','thr->');
}
print EM <<'END';
#endif /* USE_THREADS */
+#ifdef PERL_GLOBAL_STRUCT
+
+END
+
+for $sym (sort keys %globvar) {
+ print EM multon($sym,'G','PL_Vars.');
+}
+
+print EM <<'END';
+
+#else /* !PERL_GLOBAL_STRUCT */
+
+END
+
+for $sym (sort keys %globvar) {
+ print EM multoff($sym,'G');
+}
+
+print EM <<'END';
+
+#ifdef EMBED
+
+END
+
+for $sym (sort keys %globvar) {
+ print EM embedvar($sym);
+}
+
+print EM <<'END';
+
+#endif /* EMBED */
+#endif /* PERL_GLOBAL_STRUCT */
+
+END
+
+print EM <<'END';
+
+#if 0 /* ndef MIN_PERL_DEFINE */ /* unsupported in 5.006 */
+
+END
+
+for $sym (sort @extvars) {
+ print EM hide($sym,"PL_$sym");
+}
+
+print EM <<'END';
+
+#endif /* MIN_PERL_DEFINE */
END
-close(EM);
\ No newline at end of file
+
+close(EM);