5 # XXX others that may need adding
9 my @extvars = qw(sv_undef sv_yes sv_no na dowarn
11 tainting tainted stack_base stack_sp sv_arenaroot
12 curstash DBsub DBsingle debstash
25 my ($syms, $file) = @_;
29 or die "embed.pl: Can't open $file: $!\n";
31 s/[ \t]*#.*//; # Delete comments.
32 if (/^\s*(\S+)\s*$/) {
39 readsyms %global, 'global.sym';
40 readsyms %interp, 'interp.sym';
43 my ($syms, $file,$pre) = @_;
47 or die "embed.pl: Can't open $file: $!\n";
49 s/[ \t]*#.*//; # Delete comments.
50 if (/PERLVARI?C?\($pre(\w+)/) {
60 readvars %intrp, 'intrpvar.h','I';
61 readvars %thread, 'thrdvar.h','T';
62 readvars %globvar, 'perlvars.h','G';
64 foreach my $sym (sort keys %intrp)
66 warn "$sym not in interp.sym\n" unless exists $interp{$sym};
67 if (exists $global{$sym})
70 warn "$sym in global.sym as well as interp\n";
74 foreach my $sym (sort keys %globvar)
76 if (exists $global{$sym})
79 warn "$sym in global.sym as well as perlvars.h\n";
83 foreach my $sym (keys %interp)
85 warn "extra $sym in interp.sym\n"
86 unless exists $intrp{$sym} || exists $thread{$sym};
89 foreach my $sym (sort keys %thread)
91 warn "$sym in intrpvar.h\n" if exists $intrp{$sym};
92 if (exists $global{$sym})
95 warn "$sym in global.sym as well as thread\n";
100 my ($from, $to) = @_;
101 my $t = int(length($from) / 8);
102 "#define $from" . "\t" x ($t < 3 ? 3 - $t : 1) . "$to\n";
106 hide($sym, "Perl_$sym");
110 # hide($sym, "Perl_$sym");
115 my ($sym,$pre,$ptr) = @_;
116 hide("PL_$sym", "($ptr$pre$sym)");
120 return hide("PL_$pre$sym", "PL_$sym");
124 open(EM, '> embed.h')
125 or die "Can't create embed.h: $!\n";
128 /* !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
129 This file is built by embed.pl from global.sym, intrpvar.h,
130 and thrdvar.h. Any changes made here will be lost!
133 /* (Doing namespace management portably in C is really gross.) */
135 /* EMBED has no run-time penalty, but helps keep the Perl namespace
136 from colliding with that used by other libraries pulled in
137 by extensions or by embedding perl. Allow a cc -DNO_EMBED
138 override, however, to keep binary compatability with previous
145 /* Hide global symbols? */
151 for $sym (sort keys %global) {
152 print EM embed($sym);
164 open(EM, '> embedvar.h')
165 or die "Can't create embedvar.h: $!\n";
168 /* !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
169 This file is built by embed.pl from global.sym, intrpvar.h,
170 and thrdvar.h. Any changes made here will be lost!
173 /* (Doing namespace management portably in C is really gross.) */
175 /* EMBED has no run-time penalty, but helps keep the Perl namespace
176 from colliding with that used by other libraries pulled in
177 by extensions or by embedding perl. Allow a cc -DNO_EMBED
178 override, however, to keep binary compatability with previous
183 /* Put interpreter-specific symbols into a struct? */
188 /* If we do not have threads then per-thread vars are per-interpreter */
192 for $sym (sort keys %thread) {
193 print EM multon($sym,'T','PL_curinterp->');
198 #endif /* !USE_THREADS */
200 /* These are always per-interpreter if there is more than one */
204 for $sym (sort keys %intrp) {
205 print EM multon($sym,'I','PL_curinterp->');
210 #else /* !MULTIPLICITY */
214 for $sym (sort keys %intrp) {
215 print EM multoff($sym,'I');
224 for $sym (sort keys %thread) {
225 print EM multoff($sym,'T');
230 #endif /* USE_THREADS */
232 /* Hide what would have been interpreter-specific symbols? */
238 for $sym (sort keys %intrp) {
239 print EM embedvar($sym);
248 for $sym (sort keys %thread) {
249 print EM embedvar($sym);
254 #endif /* USE_THREADS */
256 #endif /* MULTIPLICITY */
258 /* Now same trickey for per-thread variables */
264 for $sym (sort keys %thread) {
265 print EM multon($sym,'T','thr->');
270 #endif /* USE_THREADS */
272 #ifdef PERL_GLOBAL_STRUCT
276 for $sym (sort keys %globvar) {
277 print EM multon($sym,'G','PL_Vars.');
282 #else /* !PERL_GLOBAL_STRUCT */
286 for $sym (sort keys %globvar) {
287 print EM multoff($sym,'G');
296 for $sym (sort keys %globvar) {
297 print EM embedvar($sym);
303 #endif /* PERL_GLOBAL_STRUCT */
309 #ifndef MIN_PERL_DEFINE
313 for $sym (sort @extvars) {
314 print EM hide($sym,"PL_$sym");
319 #endif /* MIN_PERL_DEFINE */