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
13 curstash DBsub DBsingle debstash
26 my ($syms, $file) = @_;
29 or die "embed.pl: Can't open $file: $!\n";
31 s/[ \t]*#.*//; # Delete comments.
32 if (/^\s*(\S+)\s*$/) {
34 warn "duplicate symbol $sym while processing $file\n"
35 if exists $$syms{$sym};
42 readsyms %global, 'global.sym';
43 readsyms %global, 'pp.sym';
46 my ($syms, $file,$pre,$keep_pre) = @_;
49 or die "embed.pl: Can't open $file: $!\n";
51 s/[ \t]*#.*//; # Delete comments.
52 if (/PERLVARI?C?\($pre(\w+)/) {
54 $sym = $pre . $sym if $keep_pre;
55 warn "duplicate symbol $sym while processing $file\n"
56 if exists $$syms{$sym};
66 readvars %intrp, 'intrpvar.h','I';
67 readvars %thread, 'thrdvar.h','T';
68 readvars %globvar, 'perlvars.h','G';
69 readvars %objvar, 'intrpvar.h','pi', 1;
71 foreach my $sym (sort keys %intrp)
73 if (exists $global{$sym})
76 warn "$sym in {global,pp}.sym as well as intrpvar.h\n";
80 foreach my $sym (sort keys %globvar)
82 if (exists $global{$sym})
85 warn "$sym in {global,pp}.sym as well as perlvars.h\n";
89 foreach my $sym (sort keys %thread)
91 warn "$sym in intrpvar.h as well as thrdvar.h\n" if exists $intrp{$sym};
92 if (exists $global{$sym})
95 warn "$sym in {global,pp}.sym as well as thrdvar.h\n";
105 my ($from, $to) = @_;
106 my $t = int(length($from) / 8);
107 "#define $from" . "\t" x ($t < 3 ? 3 - $t : 1) . "$to\n";
112 hide($sym, "Perl_$sym");
117 hide($sym, $sym =~ /^perl_/i ? "CPerlObj::$sym" : "CPerlObj::Perl_$sym");
120 sub objxsub_func ($) {
122 undefine($sym) . hide($sym, $sym =~ /^perl_/i
124 : "pPerl->Perl_$sym");
127 sub objxsub_var ($) {
129 undefine("PL_$sym") . hide("PL_$sym", "pPerl->PL_$sym");
134 # hide($sym, "Perl_$sym");
139 my ($sym,$pre,$ptr) = @_;
140 hide("PL_$sym", "($ptr$pre$sym)");
144 return hide("PL_$pre$sym", "PL_$sym");
148 open(EM, '> embed.h')
149 or die "Can't create embed.h: $!\n";
152 /* !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
153 This file is built by embed.pl from global.sym, pp.sym, intrpvar.h,
154 perlvars.h and thrdvar.h. Any changes made here will be lost!
157 /* (Doing namespace management portably in C is really gross.) */
159 /* NO_EMBED is no longer supported. i.e. EMBED is always active. */
161 /* Hide global symbols */
163 #if !defined(PERL_OBJECT)
167 for $sym (sort keys %global) {
168 print EM embed($sym);
173 #else /* PERL_OBJECT */
177 # XXX these should be in a *.sym file
178 my @staticfuncs = qw(
184 perl_set_numeric_local
185 perl_set_numeric_standard
328 init_postdump_symbols
379 is_handle_constructor
400 for $sym (sort(keys(%global),@staticfuncs)) {
401 print EM embedobj($sym);
406 #endif /* PERL_OBJECT */
413 open(EM, '> embedvar.h')
414 or die "Can't create embedvar.h: $!\n";
417 /* !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
418 This file is built by embed.pl from global.sym, pp.sym, intrpvar.h,
419 perlvars.h and thrdvar.h. Any changes made here will be lost!
422 /* (Doing namespace management portably in C is really gross.) */
424 /* Put interpreter-specific symbols into a struct? */
429 /* If we do not have threads then per-thread vars are per-interpreter */
433 for $sym (sort keys %thread) {
434 print EM multon($sym,'T','PL_curinterp->');
439 #endif /* !USE_THREADS */
441 /* These are always per-interpreter if there is more than one */
445 for $sym (sort keys %intrp) {
446 print EM multon($sym,'I','PL_curinterp->');
451 #else /* !MULTIPLICITY */
455 for $sym (sort keys %intrp) {
456 print EM multoff($sym,'I');
465 for $sym (sort keys %thread) {
466 print EM multoff($sym,'T');
471 #endif /* USE_THREADS */
473 /* Hide what would have been interpreter-specific symbols? */
477 for $sym (sort keys %intrp) {
478 print EM embedvar($sym);
487 for $sym (sort keys %thread) {
488 print EM embedvar($sym);
493 #endif /* USE_THREADS */
494 #endif /* MULTIPLICITY */
496 /* Now same trickey for per-thread variables */
502 for $sym (sort keys %thread) {
503 print EM multon($sym,'T','thr->');
508 #endif /* USE_THREADS */
510 #ifdef PERL_GLOBAL_STRUCT
514 for $sym (sort keys %globvar) {
515 print EM multon($sym,'G','PL_Vars.');
520 #else /* !PERL_GLOBAL_STRUCT */
524 for $sym (sort keys %globvar) {
525 print EM multoff($sym,'G');
532 for $sym (sort keys %globvar) {
533 print EM embedvar($sym);
538 #endif /* PERL_GLOBAL_STRUCT */
544 #ifdef PERL_POLLUTE /* unsupported in 5.006 */
548 for $sym (sort @extvars) {
549 print EM hide($sym,"PL_$sym");
554 #endif /* MIN_PERL_DEFINE */
561 open(OBX, '> objXSUB.h')
562 or die "Can't create objXSUB.h: $!\n";
565 /* !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
566 This file is built by embed.pl from global.sym, pp.sym, intrpvar.h,
567 perlvars.h and thrdvar.h. Any changes made here will be lost!
570 #ifndef __objXSUB_h__
571 #define __objXSUB_h__
577 foreach my $sym (sort(keys(%intrp),
582 print OBX objxsub_var($sym);
592 for $sym (sort(keys(%global),@staticfuncs)) {
593 print OBX objxsub_func($sym);
599 #endif /* __objXSUB_h__ */