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';
42 my ($syms, $file,$pre) = @_;
46 or die "embed.pl: Can't open $file: $!\n";
48 s/[ \t]*#.*//; # Delete comments.
49 if (/PERLVARI?C?\($pre(\w+)/) {
59 readvars %intrp, 'intrpvar.h','I';
60 readvars %thread, 'thrdvar.h','T';
61 readvars %globvar, 'perlvars.h','G';
63 foreach my $sym (sort keys %intrp)
65 if (exists $global{$sym})
68 warn "$sym in global.sym as well as intrpvar.h\n";
72 foreach my $sym (sort keys %globvar)
74 if (exists $global{$sym})
77 warn "$sym in global.sym as well as perlvars.h\n";
81 foreach my $sym (sort keys %thread)
83 warn "$sym in intrpvar.h as well as thrdvar.h\n" if exists $intrp{$sym};
84 if (exists $global{$sym})
87 warn "$sym in global.sym as well as thrdvar.h\n";
93 my $t = int(length($from) / 8);
94 "#define $from" . "\t" x ($t < 3 ? 3 - $t : 1) . "$to\n";
98 hide($sym, "Perl_$sym");
102 # hide($sym, "Perl_$sym");
107 my ($sym,$pre,$ptr) = @_;
108 hide("PL_$sym", "($ptr$pre$sym)");
112 return hide("PL_$pre$sym", "PL_$sym");
116 open(EM, '> embed.h')
117 or die "Can't create embed.h: $!\n";
120 /* !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
121 This file is built by embed.pl from global.sym, intrpvar.h,
122 and thrdvar.h. Any changes made here will be lost!
125 /* (Doing namespace management portably in C is really gross.) */
127 /* EMBED has no run-time penalty, but helps keep the Perl namespace
128 from colliding with that used by other libraries pulled in
129 by extensions or by embedding perl. Allow a cc -DNO_EMBED
130 override, however, to keep binary compatability with previous
137 /* Hide global symbols? */
143 for $sym (sort keys %global) {
144 print EM embed($sym);
156 open(EM, '> embedvar.h')
157 or die "Can't create embedvar.h: $!\n";
160 /* !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
161 This file is built by embed.pl from global.sym, intrpvar.h,
162 and thrdvar.h. Any changes made here will be lost!
165 /* (Doing namespace management portably in C is really gross.) */
167 /* EMBED has no run-time penalty, but helps keep the Perl namespace
168 from colliding with that used by other libraries pulled in
169 by extensions or by embedding perl. Allow a cc -DNO_EMBED
170 override, however, to keep binary compatability with previous
175 /* Put interpreter-specific symbols into a struct? */
180 /* If we do not have threads then per-thread vars are per-interpreter */
184 for $sym (sort keys %thread) {
185 print EM multon($sym,'T','PL_curinterp->');
190 #endif /* !USE_THREADS */
192 /* These are always per-interpreter if there is more than one */
196 for $sym (sort keys %intrp) {
197 print EM multon($sym,'I','PL_curinterp->');
202 #else /* !MULTIPLICITY */
206 for $sym (sort keys %intrp) {
207 print EM multoff($sym,'I');
216 for $sym (sort keys %thread) {
217 print EM multoff($sym,'T');
222 #endif /* USE_THREADS */
224 /* Hide what would have been interpreter-specific symbols? */
230 for $sym (sort keys %intrp) {
231 print EM embedvar($sym);
240 for $sym (sort keys %thread) {
241 print EM embedvar($sym);
246 #endif /* USE_THREADS */
248 #endif /* MULTIPLICITY */
250 /* Now same trickey for per-thread variables */
256 for $sym (sort keys %thread) {
257 print EM multon($sym,'T','thr->');
262 #endif /* USE_THREADS */
264 #ifdef PERL_GLOBAL_STRUCT
268 for $sym (sort keys %globvar) {
269 print EM multon($sym,'G','PL_Vars.');
274 #else /* !PERL_GLOBAL_STRUCT */
278 for $sym (sort keys %globvar) {
279 print EM multoff($sym,'G');
288 for $sym (sort keys %globvar) {
289 print EM embedvar($sym);
295 #endif /* PERL_GLOBAL_STRUCT */
301 #if 0 /* ndef MIN_PERL_DEFINE */ /* unsupported in 5.006 */
305 for $sym (sort @extvars) {
306 print EM hide($sym,"PL_$sym");
311 #endif /* MIN_PERL_DEFINE */