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)
{
}
}
+foreach my $sym (sort keys %globvar)
+ {
+ if (exists $global{$sym})
+ {
+ delete $global{$sym};
+ warn "$sym in global.sym as well as perlvars.h\n";
+ }
+ }
+
foreach my $sym (keys %interp)
{
warn "extra $sym in interp.sym\n"
}
sub multon ($$$) {
my ($sym,$pre,$ptr) = @_;
- hide($sym, "($ptr->$pre$sym)");
+ hide($sym, "($ptr$pre$sym)");
}
sub multoff ($$) {
my ($sym,$pre) = @_;
END
for $sym (sort keys %thread) {
- print EM multon($sym,'T','curinterp');
+ print EM multon($sym,'T','curinterp->');
}
print EM <<'END';
END
for $sym (sort keys %intrp) {
- print EM multon($sym,'I','curinterp');
+ print EM multon($sym,'I','curinterp->');
}
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','Perl_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
-close(EM);
\ No newline at end of file
+for $sym (sort keys %globvar) {
+ print EM embed($sym);
+}
+
+print EM <<'END';
+
+#endif /* EMBED */
+#endif /* PERL_GLOBAL_STRUCT */
+
+END
+
+close(EM);