print EM <<'END';
/* !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
- This file is derived from global.sym and interp.sym
+ This file is built by embed.pl from global.sym and interp.sym.
Any changes made here will be lost
*/
while(<GL>) {
s/[ \t]*#.*//; # Delete comments.
next unless /\S/;
- s/(.*)/#define $1\t\tPerl_$1/;
+ s/^\s*(\S+).*$/#define $1\t\tPerl_$1/;
+ $global{$1} = 1;
s/(................\t)\t/$1/;
print EM $_;
}
/* Undefine symbols that were defined by EMBED. Somewhat ugly */
-#undef curcop
-#undef envgv
-#undef siggv
-#undef stack
-#undef tainting
-
END
+
+open(INT, "<interp.sym") || die "Can't open interp.sym: $!\n";
+while (<INT>) {
+ s/[ \t]*#.*//; # Delete comments.
+ next unless /\S/;
+ s/^\s*(\S*).*$/#undef $1/;
+ print EM $_ if (exists $global{$1});
+}
+close(INT) || warn "Can't close interp.sym: $!\n";
+
+print EM "\n";
+
open(INT, "<interp.sym") || die "Can't open interp.sym: $!\n";
while (<INT>) {
s/[ \t]*#.*//; # Delete comments.
next unless /\S/;
- s/(.*)/#define $1\t\t(curinterp->I$1)/;
+ s/^\s*(\S+).*$/#define $1\t\t(curinterp->I$1)/;
s/(................\t)\t/$1/;
print EM $_;
}
while (<INT>) {
s/[ \t]*#.*//; # Delete comments.
next unless /\S/;
- s/(.*)/#define I$1\t\t$1/;
+ s/^\s*(\S+).*$/#define I$1\t\t$1/;
s/(................\t)\t/$1/;
print EM $_;
}