Commit | Line | Data |
---|---|---|
e50aee73 AD |
1 | #!/usr/bin/perl |
2 | ||
3 | open(EM, ">embed.h") || die "Can't create embed.h: $!\n"; | |
4 | ||
5 | print EM <<'END'; | |
6 | /* This file is derived from global.sym and interp.sym */ | |
7 | ||
8 | /* (Doing namespace management portably in C is really gross.) */ | |
9 | ||
820c3be9 | 10 | /* EMBED has no run-time penalty, but helps keep the Perl namespace |
11 | from colliding with that used by other libraries pulled in | |
12 | by extensions or by embedding perl. Allow a cc -DNO_EMBED | |
13 | override, however, to keep binary compatability with previous | |
14 | versions of perl. | |
15 | */ | |
16 | #ifndef NO_EMBED | |
17 | # define EMBED 1 | |
18 | #endif | |
19 | ||
e50aee73 AD |
20 | #ifdef EMBED |
21 | ||
22 | /* globals we need to hide from the world */ | |
23 | END | |
24 | ||
25 | open(GL, "<global.sym") || die "Can't open global.sym: $!\n"; | |
26 | ||
27 | while(<GL>) { | |
28 | s/[ \t]*#.*//; # Delete comments. | |
29 | next unless /\S/; | |
30 | s/(.*)/#define $1\t\tPerl_$1/; | |
31 | s/(................\t)\t/$1/; | |
32 | print EM $_; | |
33 | } | |
34 | ||
35 | close(GL) || warn "Can't close global.sym: $!\n"; | |
36 | ||
37 | print EM <<'END'; | |
38 | ||
39 | #endif /* EMBED */ | |
40 | ||
41 | /* Put interpreter specific symbols into a struct? */ | |
42 | ||
43 | #ifdef MULTIPLICITY | |
44 | ||
45 | END | |
46 | ||
47 | open(INT, "<interp.sym") || die "Can't open interp.sym: $!\n"; | |
48 | while (<INT>) { | |
49 | s/[ \t]*#.*//; # Delete comments. | |
50 | next unless /\S/; | |
51 | s/(.*)/#define $1\t\t(curinterp->I$1)/; | |
52 | s/(................\t)\t/$1/; | |
53 | print EM $_; | |
54 | } | |
55 | close(INT) || warn "Can't close interp.sym: $!\n"; | |
56 | ||
57 | print EM <<'END'; | |
58 | ||
59 | #else /* not multiple, so translate interpreter symbols the other way... */ | |
60 | ||
61 | END | |
62 | ||
63 | open(INT, "<interp.sym") || die "Can't open interp.sym: $!\n"; | |
64 | while (<INT>) { | |
65 | s/[ \t]*#.*//; # Delete comments. | |
66 | next unless /\S/; | |
67 | s/(.*)/#define I$1\t\t$1/; | |
68 | s/(................\t)\t/$1/; | |
69 | print EM $_; | |
70 | } | |
71 | close(INT) || warn "Can't close interp.sym: $!\n"; | |
72 | ||
73 | print EM <<'END'; | |
74 | ||
75 | #endif /* MULTIPLICITY */ | |
76 | END | |
77 |