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?\($pre(\w+)/) {
41 readvars %intrp, 'intrpvar.h','I';
42 readvars %thread, 'thrdvar.h','T';
43 #readvars %global, 'perlvars.h','';
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 (keys %interp)
57 warn "extra $sym in interp.sym\n"
58 unless exists $intrp{$sym} || exists $thread{$sym};
61 foreach my $sym (sort keys %thread)
63 warn "$sym in intrpvar.h\n" if exists $intrp{$sym};
64 if (exists $global{$sym})
67 warn "$sym in global.sym as well as thread\n";
73 my $t = int(length($from) / 8);
74 "#define $from" . "\t" x ($t < 3 ? 3 - $t : 1) . "$to\n";
78 hide($sym, "Perl_$sym");
81 my ($sym,$pre,$ptr) = @_;
82 hide($sym, "($ptr->$pre$sym)");
86 hide("$pre$sym", $sym);
91 or die "Can't create embed.h: $!\n";
94 /* !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
95 This file is built by embed.pl from global.sym, intrpvar.h,
96 and thrdvar.h. Any changes made here will be lost!
99 /* (Doing namespace management portably in C is really gross.) */
101 /* EMBED has no run-time penalty, but helps keep the Perl namespace
102 from colliding with that used by other libraries pulled in
103 by extensions or by embedding perl. Allow a cc -DNO_EMBED
104 override, however, to keep binary compatability with previous
111 /* Hide global symbols? */
117 for $sym (sort keys %global) {
118 print EM embed($sym);
130 open(EM, '> embedvar.h')
131 or die "Can't create embedvar.h: $!\n";
134 /* !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
135 This file is built by embed.pl from global.sym, intrpvar.h,
136 and thrdvar.h. Any changes made here will be lost!
139 /* (Doing namespace management portably in C is really gross.) */
141 /* EMBED has no run-time penalty, but helps keep the Perl namespace
142 from colliding with that used by other libraries pulled in
143 by extensions or by embedding perl. Allow a cc -DNO_EMBED
144 override, however, to keep binary compatability with previous
149 /* Put interpreter-specific symbols into a struct? */
154 /* If we do not have threads then per-thread vars are per-interpreter */
158 for $sym (sort keys %thread) {
159 print EM multon($sym,'T','curinterp');
164 #endif /* !USE_THREADS */
166 /* These are always per-interpreter if there is more than one */
170 for $sym (sort keys %intrp) {
171 print EM multon($sym,'I','curinterp');
176 #else /* !MULTIPLICITY */
180 for $sym (sort keys %intrp) {
181 print EM multoff($sym,'I');
190 for $sym (sort keys %thread) {
191 print EM multoff($sym,'T');
196 #endif /* USE_THREADS */
198 /* Hide what would have been interpreter-specific symbols? */
204 for $sym (sort keys %intrp) {
205 print EM embed($sym);
214 for $sym (sort keys %thread) {
215 print EM embed($sym);
220 #endif /* USE_THREADS */
222 #endif /* MULTIPLICITY */
224 /* Now same trickey for per-thread variables */
230 for $sym (sort keys %thread) {
231 print EM multon($sym,'T','thr');
236 #endif /* USE_THREADS */