5 my @extvars = qw(sv_undef sv_yes sv_no na dowarn
7 tainting tainted stack_base stack_sp sv_arenaroot
8 curstash DBsub DBsingle debstash
18 my ($syms, $file) = @_;
22 or die "embed.pl: Can't open $file: $!\n";
24 s/[ \t]*#.*//; # Delete comments.
25 if (/^\s*(\S+)\s*$/) {
32 readsyms %global, 'global.sym';
33 readsyms %interp, 'interp.sym';
36 my ($syms, $file,$pre) = @_;
40 or die "embed.pl: Can't open $file: $!\n";
42 s/[ \t]*#.*//; # Delete comments.
43 if (/PERLVARI?C?\($pre(\w+)/) {
53 readvars %intrp, 'intrpvar.h','I';
54 readvars %thread, 'thrdvar.h','T';
55 readvars %globvar, 'perlvars.h','G';
57 foreach my $sym (sort keys %intrp)
59 warn "$sym not in interp.sym\n" unless exists $interp{$sym};
60 if (exists $global{$sym})
63 warn "$sym in global.sym as well as interp\n";
67 foreach my $sym (sort keys %globvar)
69 if (exists $global{$sym})
72 warn "$sym in global.sym as well as perlvars.h\n";
76 foreach my $sym (keys %interp)
78 warn "extra $sym in interp.sym\n"
79 unless exists $intrp{$sym} || exists $thread{$sym};
82 foreach my $sym (sort keys %thread)
84 warn "$sym in intrpvar.h\n" if exists $intrp{$sym};
85 if (exists $global{$sym})
88 warn "$sym in global.sym as well as thread\n";
94 my $t = int(length($from) / 8);
95 "#define $from" . "\t" x ($t < 3 ? 3 - $t : 1) . "$to\n";
99 hide($sym, "Perl_$sym");
103 # hide($sym, "Perl_$sym");
108 my ($sym,$pre,$ptr) = @_;
109 hide("PL_$sym", "($ptr$pre$sym)");
113 return hide("PL_$pre$sym", "PL_$sym");
117 open(EM, '> embed.h')
118 or die "Can't create embed.h: $!\n";
121 /* !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
122 This file is built by embed.pl from global.sym, intrpvar.h,
123 and thrdvar.h. Any changes made here will be lost!
126 /* (Doing namespace management portably in C is really gross.) */
128 /* EMBED has no run-time penalty, but helps keep the Perl namespace
129 from colliding with that used by other libraries pulled in
130 by extensions or by embedding perl. Allow a cc -DNO_EMBED
131 override, however, to keep binary compatability with previous
138 /* Hide global symbols? */
144 for $sym (sort keys %global) {
145 print EM embed($sym);
157 open(EM, '> embedvar.h')
158 or die "Can't create embedvar.h: $!\n";
161 /* !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
162 This file is built by embed.pl from global.sym, intrpvar.h,
163 and thrdvar.h. Any changes made here will be lost!
166 /* (Doing namespace management portably in C is really gross.) */
168 /* EMBED has no run-time penalty, but helps keep the Perl namespace
169 from colliding with that used by other libraries pulled in
170 by extensions or by embedding perl. Allow a cc -DNO_EMBED
171 override, however, to keep binary compatability with previous
176 /* Put interpreter-specific symbols into a struct? */
181 /* If we do not have threads then per-thread vars are per-interpreter */
185 for $sym (sort keys %thread) {
186 print EM multon($sym,'T','PL_curinterp->');
191 #endif /* !USE_THREADS */
193 /* These are always per-interpreter if there is more than one */
197 for $sym (sort keys %intrp) {
198 print EM multon($sym,'I','PL_curinterp->');
203 #else /* !MULTIPLICITY */
207 for $sym (sort keys %intrp) {
208 print EM multoff($sym,'I');
217 for $sym (sort keys %thread) {
218 print EM multoff($sym,'T');
223 #endif /* USE_THREADS */
225 /* Hide what would have been interpreter-specific symbols? */
231 for $sym (sort keys %intrp) {
232 print EM embedvar($sym);
241 for $sym (sort keys %thread) {
242 print EM embedvar($sym);
247 #endif /* USE_THREADS */
249 #endif /* MULTIPLICITY */
251 /* Now same trickey for per-thread variables */
257 for $sym (sort keys %thread) {
258 print EM multon($sym,'T','thr->');
263 #endif /* USE_THREADS */
265 #ifdef PERL_GLOBAL_STRUCT
269 for $sym (sort keys %globvar) {
270 print EM multon($sym,'G','PL_Vars.');
275 #else /* !PERL_GLOBAL_STRUCT */
279 for $sym (sort keys %globvar) {
280 print EM multoff($sym,'G');
289 for $sym (sort keys %globvar) {
290 print EM embedvar($sym);
296 #endif /* PERL_GLOBAL_STRUCT */
302 #ifndef MIN_PERL_DEFINE
306 for $sym (sort @extvars) {
307 print EM hide($sym,"PL_$sym");
312 #endif /* MIN_PERL_DEFINE */