6 my ($syms, $file) = @_;
10 or die "embed.pl: Can't open $file: $!\n";
12 s/[ \t]*#.*//; # Delete comments.
13 if (/^\s*(\S+)\s*$/) {
20 readsyms %global, 'global.sym';
21 readsyms %interp, 'interp.sym';
22 readsyms %compat3, 'compat3.sym';
26 my $t = int(length($from) / 8);
27 "#define $from" . "\t" x ($t < 3 ? 3 - $t : 1) . "$to\n";
31 hide($sym, "Perl_$sym");
35 hide($sym, "(curinterp->I$sym)");
44 or die "Can't create embed.h: $!\n";
47 /* !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
48 This file is built by embed.pl from global.sym, interp.sym,
49 and compat3.sym. Any changes made here will be lost!
52 /* (Doing namespace management portably in C is really gross.) */
54 /* EMBED has no run-time penalty, but helps keep the Perl namespace
55 from colliding with that used by other libraries pulled in
56 by extensions or by embedding perl. Allow a cc -DNO_EMBED
57 override, however, to keep binary compatability with previous
64 /* Hide global symbols? */
70 for $sym (sort keys %global) {
71 print EM embed($sym) unless $compat3{$sym};
76 /* Hide global symbols that 5.003 revealed? */
82 for $sym (sort keys %global) {
83 print EM embed($sym) if $compat3{$sym};
88 #endif /* !BINCOMPAT3 */
92 /* Put interpreter-specific symbols into a struct? */
98 for $sym (sort keys %interp) {
99 print EM multon($sym);
104 #else /* !MULTIPLICITY */
108 for $sym (sort keys %interp) {
109 print EM multoff($sym);
114 /* Hide interpreter-specific symbols? */
120 for $sym (sort keys %interp) {
121 print EM embed($sym) if $compat3{$sym};
126 /* Hide interpreter symbols that 5.003 revealed? */
132 for $sym (sort keys %interp) {
133 print EM embed($sym) unless $compat3{$sym};
138 #endif /* !BINCOMPAT3 */
142 #endif /* MULTIPLICITY */