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
333 init_postdump_symbols
383 is_handle_constructor
406 for $sym (sort(keys(%global),@staticfuncs)) {
407 print EM embedobj($sym);
412 #endif /* PERL_OBJECT */
414 /* compatibility stubs */
416 #define sv_setptrobj(rv,ptr,name) sv_setref_iv(rv,name,(IV)ptr)
417 #define sv_setptrref(rv,ptr) sv_setref_iv(rv,Nullch,(IV)ptr)
424 open(EM, '> embedvar.h')
425 or die "Can't create embedvar.h: $!\n";
428 /* !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
429 This file is built by embed.pl from global.sym, pp.sym, intrpvar.h,
430 perlvars.h and thrdvar.h. Any changes made here will be lost!
433 /* (Doing namespace management portably in C is really gross.) */
435 /* Put interpreter-specific symbols into a struct? */
440 /* If we do not have threads then per-thread vars are per-interpreter */
444 for $sym (sort keys %thread) {
445 print EM multon($sym,'T','PL_curinterp->');
450 #endif /* !USE_THREADS */
452 /* These are always per-interpreter if there is more than one */
456 for $sym (sort keys %intrp) {
457 print EM multon($sym,'I','PL_curinterp->');
462 #else /* !MULTIPLICITY */
466 for $sym (sort keys %intrp) {
467 print EM multoff($sym,'I');
476 for $sym (sort keys %thread) {
477 print EM multoff($sym,'T');
482 #endif /* USE_THREADS */
484 /* Hide what would have been interpreter-specific symbols? */
488 for $sym (sort keys %intrp) {
489 print EM embedvar($sym);
498 for $sym (sort keys %thread) {
499 print EM embedvar($sym);
504 #endif /* USE_THREADS */
505 #endif /* MULTIPLICITY */
507 /* Now same trickey for per-thread variables */
513 for $sym (sort keys %thread) {
514 print EM multon($sym,'T','thr->');
519 #endif /* USE_THREADS */
521 #ifdef PERL_GLOBAL_STRUCT
525 for $sym (sort keys %globvar) {
526 print EM multon($sym,'G','PL_Vars.');
531 #else /* !PERL_GLOBAL_STRUCT */
535 for $sym (sort keys %globvar) {
536 print EM multoff($sym,'G');
543 for $sym (sort keys %globvar) {
544 print EM embedvar($sym);
549 #endif /* PERL_GLOBAL_STRUCT */
555 #ifdef PERL_POLLUTE /* disabled by default in 5.006 */
559 for $sym (sort @extvars) {
560 print EM hide($sym,"PL_$sym");
565 #endif /* PERL_POLLUTE */
572 open(OBX, '> objXSUB.h')
573 or die "Can't create objXSUB.h: $!\n";
576 /* !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
577 This file is built by embed.pl from global.sym, pp.sym, intrpvar.h,
578 perlvars.h and thrdvar.h. Any changes made here will be lost!
581 #ifndef __objXSUB_h__
582 #define __objXSUB_h__
588 foreach my $sym (sort(keys(%intrp),
593 print OBX objxsub_var($sym);
603 for $sym (sort(keys(%global),@staticfuncs)) {
604 print OBX objxsub_func($sym);
610 #endif /* __objXSUB_h__ */