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";
113 hide($def, $sym) if $def =~ s/^Perl_//;
118 hide($sym, $sym =~ /^perl_/i ? "CPerlObj::$sym" : "CPerlObj::Perl_$sym");
121 sub objxsub_func ($) {
123 undefine($sym) . hide($sym, $sym =~ /^perl_/i
125 : "pPerl->Perl_$sym");
128 sub objxsub_var ($) {
130 undefine("PL_$sym") . hide("PL_$sym", "pPerl->PL_$sym");
135 # hide($sym, "Perl_$sym");
140 my ($sym,$pre,$ptr) = @_;
141 hide("PL_$sym", "($ptr$pre$sym)");
145 return hide("PL_$pre$sym", "PL_$sym");
149 open(EM, '> embed.h')
150 or die "Can't create embed.h: $!\n";
153 /* !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
154 This file is built by embed.pl from global.sym, pp.sym, intrpvar.h,
155 perlvars.h and thrdvar.h. Any changes made here will be lost!
158 /* (Doing namespace management portably in C is really gross.) */
160 /* NO_EMBED is no longer supported. i.e. EMBED is always active. */
162 /* Hide global symbols */
164 #if !defined(PERL_OBJECT)
168 for $sym (sort keys %global) {
169 next if $sym =~ /^Perl_(malloc|calloc|realloc|mfree)$/;
170 print EM embed($sym);
175 #else /* PERL_OBJECT */
179 # XXX these should be in a *.sym file
180 my @staticfuncs = qw(
186 perl_set_numeric_local
187 perl_set_numeric_standard
335 init_postdump_symbols
385 is_handle_constructor
406 for $sym (sort(keys(%global),@staticfuncs)) {
407 next if $sym =~ /^Perl_(malloc|calloc|realloc|mfree)$/;
408 print EM embedobj($sym);
413 #endif /* PERL_OBJECT */
415 /* compatibility stubs */
417 #define sv_setptrobj(rv,ptr,name) sv_setref_iv(rv,name,(IV)ptr)
418 #define sv_setptrref(rv,ptr) sv_setref_iv(rv,Nullch,(IV)ptr)
419 #define perl_atexit call_atexit
420 #define perl_call_argv call_argv
421 #define perl_call_pv call_pv
422 #define perl_call_method call_method
423 #define perl_call_sv call_sv
424 #define perl_eval_sv eval_sv
425 #define perl_eval_pv eval_pv
426 #define perl_require_pv require_pv
427 #define perl_get_sv get_sv
428 #define perl_get_av get_av
429 #define perl_get_hv get_hv
430 #define perl_get_cv get_cv
431 #define perl_init_i18nl10n init_i18nl10n
432 #define perl_init_i18nl14n init_i18nl14n
433 #define perl_new_ctype new_ctype
434 #define perl_new_collate new_collate
435 #define perl_new_numeric new_numeric
442 open(EM, '> embedvar.h')
443 or die "Can't create embedvar.h: $!\n";
446 /* !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
447 This file is built by embed.pl from global.sym, pp.sym, intrpvar.h,
448 perlvars.h and thrdvar.h. Any changes made here will be lost!
451 /* (Doing namespace management portably in C is really gross.) */
453 /* Put interpreter-specific symbols into a struct? */
458 /* If we do not have threads then per-thread vars are per-interpreter */
462 for $sym (sort keys %thread) {
463 print EM multon($sym,'T','PL_curinterp->');
468 #endif /* !USE_THREADS */
470 /* These are always per-interpreter if there is more than one */
474 for $sym (sort keys %intrp) {
475 print EM multon($sym,'I','PL_curinterp->');
480 #else /* !MULTIPLICITY */
484 for $sym (sort keys %intrp) {
485 print EM multoff($sym,'I');
494 for $sym (sort keys %thread) {
495 print EM multoff($sym,'T');
500 #endif /* USE_THREADS */
502 /* Hide what would have been interpreter-specific symbols? */
506 for $sym (sort keys %intrp) {
507 print EM embedvar($sym);
516 for $sym (sort keys %thread) {
517 print EM embedvar($sym);
522 #endif /* USE_THREADS */
523 #endif /* MULTIPLICITY */
525 /* Now same trickey for per-thread variables */
531 for $sym (sort keys %thread) {
532 print EM multon($sym,'T','thr->');
537 #endif /* USE_THREADS */
539 #ifdef PERL_GLOBAL_STRUCT
543 for $sym (sort keys %globvar) {
544 print EM multon($sym,'G','PL_Vars.');
549 #else /* !PERL_GLOBAL_STRUCT */
553 for $sym (sort keys %globvar) {
554 print EM multoff($sym,'G');
561 for $sym (sort keys %globvar) {
562 print EM embedvar($sym);
567 #endif /* PERL_GLOBAL_STRUCT */
573 #ifdef PERL_POLLUTE /* disabled by default in 5.006 */
577 for $sym (sort @extvars) {
578 print EM hide($sym,"PL_$sym");
583 #endif /* PERL_POLLUTE */
590 open(OBX, '> objXSUB.h')
591 or die "Can't create objXSUB.h: $!\n";
594 /* !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
595 This file is built by embed.pl from global.sym, pp.sym, intrpvar.h,
596 perlvars.h and thrdvar.h. Any changes made here will be lost!
599 #ifndef __objXSUB_h__
600 #define __objXSUB_h__
606 foreach my $sym (sort(keys(%intrp),
611 print OBX objxsub_var($sym);
621 for $sym (sort(keys(%global),@staticfuncs)) {
622 print OBX objxsub_func($sym);
628 #endif /* __objXSUB_h__ */