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