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");
90 my ($sym,$pre,$ptr) = @_;
91 hide($sym, "($ptr$pre$sym)");
95 hide("$pre$sym", $sym);
100 or die "Can't create embed.h: $!\n";
103 /* !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
104 This file is built by embed.pl from global.sym, intrpvar.h,
105 and thrdvar.h. Any changes made here will be lost!
108 /* (Doing namespace management portably in C is really gross.) */
110 /* EMBED has no run-time penalty, but helps keep the Perl namespace
111 from colliding with that used by other libraries pulled in
112 by extensions or by embedding perl. Allow a cc -DNO_EMBED
113 override, however, to keep binary compatability with previous
120 /* Hide global symbols? */
126 for $sym (sort keys %global) {
127 print EM embed($sym);
139 open(EM, '> embedvar.h')
140 or die "Can't create embedvar.h: $!\n";
143 /* !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
144 This file is built by embed.pl from global.sym, intrpvar.h,
145 and thrdvar.h. Any changes made here will be lost!
148 /* (Doing namespace management portably in C is really gross.) */
150 /* EMBED has no run-time penalty, but helps keep the Perl namespace
151 from colliding with that used by other libraries pulled in
152 by extensions or by embedding perl. Allow a cc -DNO_EMBED
153 override, however, to keep binary compatability with previous
158 /* Put interpreter-specific symbols into a struct? */
163 /* If we do not have threads then per-thread vars are per-interpreter */
167 for $sym (sort keys %thread) {
168 print EM multon($sym,'T','curinterp->');
173 #endif /* !USE_THREADS */
175 /* These are always per-interpreter if there is more than one */
179 for $sym (sort keys %intrp) {
180 print EM multon($sym,'I','curinterp->');
185 #else /* !MULTIPLICITY */
189 for $sym (sort keys %intrp) {
190 print EM multoff($sym,'I');
199 for $sym (sort keys %thread) {
200 print EM multoff($sym,'T');
205 #endif /* USE_THREADS */
207 /* Hide what would have been interpreter-specific symbols? */
213 for $sym (sort keys %intrp) {
214 print EM embed($sym);
223 for $sym (sort keys %thread) {
224 print EM embed($sym);
229 #endif /* USE_THREADS */
231 #endif /* MULTIPLICITY */
233 /* Now same trickey for per-thread variables */
239 for $sym (sort keys %thread) {
240 print EM multon($sym,'T','thr->');
245 #endif /* USE_THREADS */
247 #ifdef PERL_GLOBAL_STRUCT
251 for $sym (sort keys %globvar) {
252 print EM multon($sym,'G','Perl_Vars.');
257 #else /* !PERL_GLOBAL_STRUCT */
261 for $sym (sort keys %globvar) {
262 print EM multoff($sym,'G');
271 for $sym (sort keys %globvar) {
272 print EM embed($sym);
278 #endif /* PERL_GLOBAL_STRUCT */