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
390 for $sym (sort(keys(%global),@staticfuncs)) {
391 print EM embedobj($sym);
396 #endif /* PERL_OBJECT */
403 open(EM, '> embedvar.h')
404 or die "Can't create embedvar.h: $!\n";
407 /* !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
408 This file is built by embed.pl from global.sym, pp.sym, intrpvar.h,
409 perlvars.h and thrdvar.h. Any changes made here will be lost!
412 /* (Doing namespace management portably in C is really gross.) */
414 /* Put interpreter-specific symbols into a struct? */
419 /* If we do not have threads then per-thread vars are per-interpreter */
423 for $sym (sort keys %thread) {
424 print EM multon($sym,'T','PL_curinterp->');
429 #endif /* !USE_THREADS */
431 /* These are always per-interpreter if there is more than one */
435 for $sym (sort keys %intrp) {
436 print EM multon($sym,'I','PL_curinterp->');
441 #else /* !MULTIPLICITY */
445 for $sym (sort keys %intrp) {
446 print EM multoff($sym,'I');
455 for $sym (sort keys %thread) {
456 print EM multoff($sym,'T');
461 #endif /* USE_THREADS */
463 /* Hide what would have been interpreter-specific symbols? */
467 for $sym (sort keys %intrp) {
468 print EM embedvar($sym);
477 for $sym (sort keys %thread) {
478 print EM embedvar($sym);
483 #endif /* USE_THREADS */
484 #endif /* MULTIPLICITY */
486 /* Now same trickey for per-thread variables */
492 for $sym (sort keys %thread) {
493 print EM multon($sym,'T','thr->');
498 #endif /* USE_THREADS */
500 #ifdef PERL_GLOBAL_STRUCT
504 for $sym (sort keys %globvar) {
505 print EM multon($sym,'G','PL_Vars.');
510 #else /* !PERL_GLOBAL_STRUCT */
514 for $sym (sort keys %globvar) {
515 print EM multoff($sym,'G');
522 for $sym (sort keys %globvar) {
523 print EM embedvar($sym);
528 #endif /* PERL_GLOBAL_STRUCT */
534 #ifdef PERL_POLLUTE /* unsupported in 5.006 */
538 for $sym (sort @extvars) {
539 print EM hide($sym,"PL_$sym");
544 #endif /* MIN_PERL_DEFINE */
551 open(OBX, '> objXSUB.h')
552 or die "Can't create objXSUB.h: $!\n";
555 /* !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
556 This file is built by embed.pl from global.sym, pp.sym, intrpvar.h,
557 perlvars.h and thrdvar.h. Any changes made here will be lost!
560 #ifndef __objXSUB_h__
561 #define __objXSUB_h__
567 foreach my $sym (sort(keys(%intrp),
572 print OBX objxsub_var($sym);
582 for $sym (sort(keys(%global),@staticfuncs)) {
583 print OBX objxsub_func($sym);
589 #endif /* __objXSUB_h__ */