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
377 for $sym (sort(keys(%global),@extras)) {
378 next if exists $skip{$sym};
379 print EM embedobj($sym);
384 #endif /* PERL_OBJECT */
391 open(EM, '> embedvar.h')
392 or die "Can't create embedvar.h: $!\n";
395 /* !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
396 This file is built by embed.pl from global.sym, pp.sym, intrpvar.h,
397 and thrdvar.h. Any changes made here will be lost!
400 /* (Doing namespace management portably in C is really gross.) */
402 /* Put interpreter-specific symbols into a struct? */
407 /* If we do not have threads then per-thread vars are per-interpreter */
411 for $sym (sort keys %thread) {
412 print EM multon($sym,'T','PL_curinterp->');
417 #endif /* !USE_THREADS */
419 /* These are always per-interpreter if there is more than one */
423 for $sym (sort keys %intrp) {
424 print EM multon($sym,'I','PL_curinterp->');
429 #else /* !MULTIPLICITY */
433 for $sym (sort keys %intrp) {
434 print EM multoff($sym,'I');
443 for $sym (sort keys %thread) {
444 print EM multoff($sym,'T');
449 #endif /* USE_THREADS */
451 /* Hide what would have been interpreter-specific symbols? */
455 for $sym (sort keys %intrp) {
456 print EM embedvar($sym);
465 for $sym (sort keys %thread) {
466 print EM embedvar($sym);
471 #endif /* USE_THREADS */
472 #endif /* MULTIPLICITY */
474 /* Now same trickey for per-thread variables */
480 for $sym (sort keys %thread) {
481 print EM multon($sym,'T','thr->');
486 #endif /* USE_THREADS */
488 #ifdef PERL_GLOBAL_STRUCT
492 for $sym (sort keys %globvar) {
493 print EM multon($sym,'G','PL_Vars.');
498 #else /* !PERL_GLOBAL_STRUCT */
502 for $sym (sort keys %globvar) {
503 print EM multoff($sym,'G');
510 for $sym (sort keys %globvar) {
511 print EM embedvar($sym);
516 #endif /* PERL_GLOBAL_STRUCT */
522 #if 0 /* ndef MIN_PERL_DEFINE */ /* unsupported in 5.006 */
526 for $sym (sort @extvars) {
527 print EM hide($sym,"PL_$sym");
532 #endif /* MIN_PERL_DEFINE */