6 my ($syms, $file) = @_;
10 or die "embed.pl: Can't open $file: $!\n";
12 s/[ \t]*#.*//; # Delete comments.
13 if (/^\s*(\S+)\s*$/) {
20 readsyms %global, 'global.sym';
21 readsyms %interp, 'interp.sym';
24 my ($syms, $file,$pre) = @_;
28 or die "embed.pl: Can't open $file: $!\n";
30 s/[ \t]*#.*//; # Delete comments.
31 if (/PERLVARI?C?\($pre(\w+)/) {
41 readvars %intrp, 'intrpvar.h','I';
42 readvars %thread, 'thrdvar.h','T';
43 readvars %globvar, 'perlvars.h','G';
45 foreach my $sym (sort keys %intrp)
47 warn "$sym not in interp.sym\n" unless exists $interp{$sym};
48 if (exists $global{$sym})
51 warn "$sym in global.sym as well as interp\n";
55 foreach my $sym (sort keys %globvar)
57 if (exists $global{$sym})
60 warn "$sym in global.sym as well as perlvars.h\n";
64 foreach my $sym (keys %interp)
66 warn "extra $sym in interp.sym\n"
67 unless exists $intrp{$sym} || exists $thread{$sym};
70 foreach my $sym (sort keys %thread)
72 warn "$sym in intrpvar.h\n" if exists $intrp{$sym};
73 if (exists $global{$sym})
76 warn "$sym in global.sym as well as thread\n";
82 my $t = int(length($from) / 8);
83 "#define $from" . "\t" x ($t < 3 ? 3 - $t : 1) . "$to\n";
87 hide($sym, "Perl_$sym");
91 # hide($sym, "Perl_$sym");
96 my ($sym,$pre,$ptr) = @_;
97 hide("PL_$sym", "($ptr$pre$sym)");
101 return hide("PL_$pre$sym", "PL_$sym");
105 open(EM, '> embed.h')
106 or die "Can't create embed.h: $!\n";
109 /* !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
110 This file is built by embed.pl from global.sym, intrpvar.h,
111 and thrdvar.h. Any changes made here will be lost!
114 /* (Doing namespace management portably in C is really gross.) */
116 /* EMBED has no run-time penalty, but helps keep the Perl namespace
117 from colliding with that used by other libraries pulled in
118 by extensions or by embedding perl. Allow a cc -DNO_EMBED
119 override, however, to keep binary compatability with previous
126 /* Hide global symbols? */
132 for $sym (sort keys %global) {
133 print EM embed($sym);
145 open(EM, '> embedvar.h')
146 or die "Can't create embedvar.h: $!\n";
149 /* !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
150 This file is built by embed.pl from global.sym, intrpvar.h,
151 and thrdvar.h. Any changes made here will be lost!
154 /* (Doing namespace management portably in C is really gross.) */
156 /* EMBED has no run-time penalty, but helps keep the Perl namespace
157 from colliding with that used by other libraries pulled in
158 by extensions or by embedding perl. Allow a cc -DNO_EMBED
159 override, however, to keep binary compatability with previous
164 /* Put interpreter-specific symbols into a struct? */
169 /* If we do not have threads then per-thread vars are per-interpreter */
173 for $sym (sort keys %thread) {
174 print EM multon($sym,'T','PL_curinterp->');
179 #endif /* !USE_THREADS */
181 /* These are always per-interpreter if there is more than one */
185 for $sym (sort keys %intrp) {
186 print EM multon($sym,'I','PL_curinterp->');
191 #else /* !MULTIPLICITY */
195 for $sym (sort keys %intrp) {
196 print EM multoff($sym,'I');
205 for $sym (sort keys %thread) {
206 print EM multoff($sym,'T');
211 #endif /* USE_THREADS */
213 /* Hide what would have been interpreter-specific symbols? */
219 for $sym (sort keys %intrp) {
220 print EM embedvar($sym);
229 for $sym (sort keys %thread) {
230 print EM embedvar($sym);
235 #endif /* USE_THREADS */
237 #endif /* MULTIPLICITY */
239 /* Now same trickey for per-thread variables */
245 for $sym (sort keys %thread) {
246 print EM multon($sym,'T','thr->');
251 #endif /* USE_THREADS */
253 #ifdef PERL_GLOBAL_STRUCT
257 for $sym (sort keys %globvar) {
258 print EM multon($sym,'G','PL_Vars.');
263 #else /* !PERL_GLOBAL_STRUCT */
267 for $sym (sort keys %globvar) {
268 print EM multoff($sym,'G');
277 for $sym (sort keys %globvar) {
278 print EM embedvar($sym);
284 #endif /* PERL_GLOBAL_STRUCT */