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
327 init_postdump_symbols
378 is_handle_constructor
399 for $sym (sort(keys(%global),@staticfuncs)) {
400 print EM embedobj($sym);
405 #endif /* PERL_OBJECT */
407 /* compatibility stubs */
409 #define sv_setptrobj(rv,ptr,name) sv_setref_iv(rv,name,(IV)ptr)
410 #define sv_setptrref(rv,ptr) sv_setref_iv(rv,Nullch,(IV)ptr)
417 open(EM, '> embedvar.h')
418 or die "Can't create embedvar.h: $!\n";
421 /* !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
422 This file is built by embed.pl from global.sym, pp.sym, intrpvar.h,
423 perlvars.h and thrdvar.h. Any changes made here will be lost!
426 /* (Doing namespace management portably in C is really gross.) */
428 /* Put interpreter-specific symbols into a struct? */
433 /* If we do not have threads then per-thread vars are per-interpreter */
437 for $sym (sort keys %thread) {
438 print EM multon($sym,'T','PL_curinterp->');
443 #endif /* !USE_THREADS */
445 /* These are always per-interpreter if there is more than one */
449 for $sym (sort keys %intrp) {
450 print EM multon($sym,'I','PL_curinterp->');
455 #else /* !MULTIPLICITY */
459 for $sym (sort keys %intrp) {
460 print EM multoff($sym,'I');
469 for $sym (sort keys %thread) {
470 print EM multoff($sym,'T');
475 #endif /* USE_THREADS */
477 /* Hide what would have been interpreter-specific symbols? */
481 for $sym (sort keys %intrp) {
482 print EM embedvar($sym);
491 for $sym (sort keys %thread) {
492 print EM embedvar($sym);
497 #endif /* USE_THREADS */
498 #endif /* MULTIPLICITY */
500 /* Now same trickey for per-thread variables */
506 for $sym (sort keys %thread) {
507 print EM multon($sym,'T','thr->');
512 #endif /* USE_THREADS */
514 #ifdef PERL_GLOBAL_STRUCT
518 for $sym (sort keys %globvar) {
519 print EM multon($sym,'G','PL_Vars.');
524 #else /* !PERL_GLOBAL_STRUCT */
528 for $sym (sort keys %globvar) {
529 print EM multoff($sym,'G');
536 for $sym (sort keys %globvar) {
537 print EM embedvar($sym);
542 #endif /* PERL_GLOBAL_STRUCT */
548 #ifdef PERL_POLLUTE /* disabled by default in 5.006 */
552 for $sym (sort @extvars) {
553 print EM hide($sym,"PL_$sym");
558 #endif /* PERL_POLLUTE */
565 open(OBX, '> objXSUB.h')
566 or die "Can't create objXSUB.h: $!\n";
569 /* !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
570 This file is built by embed.pl from global.sym, pp.sym, intrpvar.h,
571 perlvars.h and thrdvar.h. Any changes made here will be lost!
574 #ifndef __objXSUB_h__
575 #define __objXSUB_h__
581 foreach my $sym (sort(keys(%intrp),
586 print OBX objxsub_var($sym);
596 for $sym (sort(keys(%global),@staticfuncs)) {
597 print OBX objxsub_func($sym);
603 #endif /* __objXSUB_h__ */