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) = @_;
28 or die "embed.pl: Can't open $file: $!\n";
30 s/[ \t]*#.*//; # Delete comments.
31 if (/^\s*(\S+)\s*$/) {
33 warn "duplicate symbol $sym while processing $file\n"
34 if exists $$syms{$sym};
41 readsyms %global, 'global.sym';
42 readsyms %global, 'pp.sym';
45 my ($syms, $file,$pre) = @_;
48 or die "embed.pl: Can't open $file: $!\n";
50 s/[ \t]*#.*//; # Delete comments.
51 if (/PERLVARI?C?\($pre(\w+)/) {
53 warn "duplicate symbol $sym while processing $file\n"
54 if exists $$syms{$sym};
64 readvars %intrp, 'intrpvar.h','I';
65 readvars %thread, 'thrdvar.h','T';
66 readvars %globvar, 'perlvars.h','G';
68 foreach my $sym (sort keys %intrp)
70 if (exists $global{$sym})
73 warn "$sym in {global,pp}.sym as well as intrpvar.h\n";
77 foreach my $sym (sort keys %globvar)
79 if (exists $global{$sym})
82 warn "$sym in {global,pp}.sym as well as perlvars.h\n";
86 foreach my $sym (sort keys %thread)
88 warn "$sym in intrpvar.h as well as thrdvar.h\n" if exists $intrp{$sym};
89 if (exists $global{$sym})
92 warn "$sym in {global,pp}.sym as well as thrdvar.h\n";
98 my $t = int(length($from) / 8);
99 "#define $from" . "\t" x ($t < 3 ? 3 - $t : 1) . "$to\n";
103 hide($sym, "Perl_$sym");
107 hide($sym, $sym =~ /^perl_/i ? "CPerlObj::$sym" : "CPerlObj::Perl_$sym");
111 # hide($sym, "Perl_$sym");
116 my ($sym,$pre,$ptr) = @_;
117 hide("PL_$sym", "($ptr$pre$sym)");
121 return hide("PL_$pre$sym", "PL_$sym");
125 open(EM, '> embed.h')
126 or die "Can't create embed.h: $!\n";
129 /* !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
130 This file is built by embed.pl from global.sym, pp.sym, intrpvar.h,
131 and thrdvar.h. Any changes made here will be lost!
134 /* (Doing namespace management portably in C is really gross.) */
136 /* NO_EMBED is no longer supported. i.e. EMBED is always active. */
138 /* Hide global symbols */
140 #if !defined(PERL_OBJECT)
144 for $sym (sort keys %global) {
145 print EM embed($sym);
150 #else /* PERL_OBJECT */
154 # XXX these should be in a *.sym file
161 perl_set_numeric_local
162 perl_set_numeric_standard
301 init_postdump_symbols
368 for $sym (sort(keys(%global),@extras)) {
369 print EM embedobj($sym);
374 #endif /* PERL_OBJECT */
381 open(EM, '> embedvar.h')
382 or die "Can't create embedvar.h: $!\n";
385 /* !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
386 This file is built by embed.pl from global.sym, pp.sym, intrpvar.h,
387 and thrdvar.h. Any changes made here will be lost!
390 /* (Doing namespace management portably in C is really gross.) */
392 /* Put interpreter-specific symbols into a struct? */
397 /* If we do not have threads then per-thread vars are per-interpreter */
401 for $sym (sort keys %thread) {
402 print EM multon($sym,'T','PL_curinterp->');
407 #endif /* !USE_THREADS */
409 /* These are always per-interpreter if there is more than one */
413 for $sym (sort keys %intrp) {
414 print EM multon($sym,'I','PL_curinterp->');
419 #else /* !MULTIPLICITY */
423 for $sym (sort keys %intrp) {
424 print EM multoff($sym,'I');
433 for $sym (sort keys %thread) {
434 print EM multoff($sym,'T');
439 #endif /* USE_THREADS */
441 /* Hide what would have been interpreter-specific symbols? */
445 for $sym (sort keys %intrp) {
446 print EM embedvar($sym);
455 for $sym (sort keys %thread) {
456 print EM embedvar($sym);
461 #endif /* USE_THREADS */
462 #endif /* MULTIPLICITY */
464 /* Now same trickey for per-thread variables */
470 for $sym (sort keys %thread) {
471 print EM multon($sym,'T','thr->');
476 #endif /* USE_THREADS */
478 #ifdef PERL_GLOBAL_STRUCT
482 for $sym (sort keys %globvar) {
483 print EM multon($sym,'G','PL_Vars.');
488 #else /* !PERL_GLOBAL_STRUCT */
492 for $sym (sort keys %globvar) {
493 print EM multoff($sym,'G');
500 for $sym (sort keys %globvar) {
501 print EM embedvar($sym);
506 #endif /* PERL_GLOBAL_STRUCT */
512 #ifdef PERL_POLLUTE /* unsupported in 5.006 */
516 for $sym (sort @extvars) {
517 print EM hide($sym,"PL_$sym");
522 #endif /* MIN_PERL_DEFINE */