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,$keep_pre) = @_;
48 or die "embed.pl: Can't open $file: $!\n";
50 s/[ \t]*#.*//; # Delete comments.
51 if (/PERLVARI?C?\($pre(\w+)/) {
53 $sym = $pre . $sym if $keep_pre;
54 warn "duplicate symbol $sym while processing $file\n"
55 if exists $$syms{$sym};
65 readvars %intrp, 'intrpvar.h','I';
66 readvars %thread, 'thrdvar.h','T';
67 readvars %globvar, 'perlvars.h','G';
68 readvars %objvar, 'intrpvar.h','pi', 1;
70 foreach my $sym (sort keys %intrp)
72 if (exists $global{$sym})
75 warn "$sym in {global,pp}.sym as well as intrpvar.h\n";
79 foreach my $sym (sort keys %globvar)
81 if (exists $global{$sym})
84 warn "$sym in {global,pp}.sym as well as perlvars.h\n";
88 foreach my $sym (sort keys %thread)
90 warn "$sym in intrpvar.h as well as thrdvar.h\n" if exists $intrp{$sym};
91 if (exists $global{$sym})
94 warn "$sym in {global,pp}.sym as well as thrdvar.h\n";
104 my ($from, $to) = @_;
105 my $t = int(length($from) / 8);
106 "#define $from" . "\t" x ($t < 3 ? 3 - $t : 1) . "$to\n";
111 hide($sym, "Perl_$sym");
116 hide($sym, $sym =~ /^perl_/i ? "CPerlObj::$sym" : "CPerlObj::Perl_$sym");
119 sub objxsub_func ($) {
121 undefine($sym) . hide($sym, $sym =~ /^perl_/i
123 : "pPerl->Perl_$sym");
126 sub objxsub_var ($) {
128 undefine("PL_$sym") . hide("PL_$sym", "pPerl->PL_$sym");
133 # hide($sym, "Perl_$sym");
138 my ($sym,$pre,$ptr) = @_;
139 hide("PL_$sym", "($ptr$pre$sym)");
143 return hide("PL_$pre$sym", "PL_$sym");
147 open(EM, '> embed.h')
148 or die "Can't create embed.h: $!\n";
151 /* !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
152 This file is built by embed.pl from global.sym, pp.sym, intrpvar.h,
153 perlvars.h and thrdvar.h. Any changes made here will be lost!
156 /* (Doing namespace management portably in C is really gross.) */
158 /* NO_EMBED is no longer supported. i.e. EMBED is always active. */
160 /* Hide global symbols */
162 #if !defined(PERL_OBJECT)
166 for $sym (sort keys %global) {
167 print EM embed($sym);
172 #else /* PERL_OBJECT */
176 # XXX these should be in a *.sym file
177 my @staticfuncs = qw(
183 perl_set_numeric_local
184 perl_set_numeric_standard
323 init_postdump_symbols
391 for $sym (sort(keys(%global),@staticfuncs)) {
392 print EM embedobj($sym);
397 #endif /* PERL_OBJECT */
404 open(EM, '> embedvar.h')
405 or die "Can't create embedvar.h: $!\n";
408 /* !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
409 This file is built by embed.pl from global.sym, pp.sym, intrpvar.h,
410 perlvars.h and thrdvar.h. Any changes made here will be lost!
413 /* (Doing namespace management portably in C is really gross.) */
415 /* Put interpreter-specific symbols into a struct? */
420 /* If we do not have threads then per-thread vars are per-interpreter */
424 for $sym (sort keys %thread) {
425 print EM multon($sym,'T','PL_curinterp->');
430 #endif /* !USE_THREADS */
432 /* These are always per-interpreter if there is more than one */
436 for $sym (sort keys %intrp) {
437 print EM multon($sym,'I','PL_curinterp->');
442 #else /* !MULTIPLICITY */
446 for $sym (sort keys %intrp) {
447 print EM multoff($sym,'I');
456 for $sym (sort keys %thread) {
457 print EM multoff($sym,'T');
462 #endif /* USE_THREADS */
464 /* Hide what would have been interpreter-specific symbols? */
468 for $sym (sort keys %intrp) {
469 print EM embedvar($sym);
478 for $sym (sort keys %thread) {
479 print EM embedvar($sym);
484 #endif /* USE_THREADS */
485 #endif /* MULTIPLICITY */
487 /* Now same trickey for per-thread variables */
493 for $sym (sort keys %thread) {
494 print EM multon($sym,'T','thr->');
499 #endif /* USE_THREADS */
501 #ifdef PERL_GLOBAL_STRUCT
505 for $sym (sort keys %globvar) {
506 print EM multon($sym,'G','PL_Vars.');
511 #else /* !PERL_GLOBAL_STRUCT */
515 for $sym (sort keys %globvar) {
516 print EM multoff($sym,'G');
523 for $sym (sort keys %globvar) {
524 print EM embedvar($sym);
529 #endif /* PERL_GLOBAL_STRUCT */
535 #ifdef PERL_POLLUTE /* unsupported in 5.006 */
539 for $sym (sort @extvars) {
540 print EM hide($sym,"PL_$sym");
545 #endif /* MIN_PERL_DEFINE */
552 open(OBX, '> objXSUB.h')
553 or die "Can't create objXSUB.h: $!\n";
556 /* !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
557 This file is built by embed.pl from global.sym, pp.sym, intrpvar.h,
558 perlvars.h and thrdvar.h. Any changes made here will be lost!
561 #ifndef __objXSUB_h__
562 #define __objXSUB_h__
568 foreach my $sym (sort(keys(%intrp),
573 print OBX objxsub_var($sym);
583 for $sym (sort(keys(%global),@staticfuncs)) {
584 print OBX objxsub_func($sym);
590 #endif /* __objXSUB_h__ */