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 | ||
10 | #ifdef EMBED | |
11 | ||
12 | /* globals we need to hide from the world */ | |
13 | END | |
14 | ||
15 | open(GL, "<global.sym") || die "Can't open global.sym: $!\n"; | |
16 | ||
17 | while(<GL>) { | |
18 | s/[ \t]*#.*//; # Delete comments. | |
19 | next unless /\S/; | |
20 | s/(.*)/#define $1\t\tPerl_$1/; | |
21 | s/(................\t)\t/$1/; | |
22 | print EM $_; | |
23 | } | |
24 | ||
25 | close(GL) || warn "Can't close global.sym: $!\n"; | |
26 | ||
27 | print EM <<'END'; | |
28 | ||
29 | #endif /* EMBED */ | |
30 | ||
31 | /* Put interpreter specific symbols into a struct? */ | |
32 | ||
33 | #ifdef MULTIPLICITY | |
34 | ||
35 | END | |
36 | ||
37 | open(INT, "<interp.sym") || die "Can't open interp.sym: $!\n"; | |
38 | while (<INT>) { | |
39 | s/[ \t]*#.*//; # Delete comments. | |
40 | next unless /\S/; | |
41 | s/(.*)/#define $1\t\t(curinterp->I$1)/; | |
42 | s/(................\t)\t/$1/; | |
43 | print EM $_; | |
44 | } | |
45 | close(INT) || warn "Can't close interp.sym: $!\n"; | |
46 | ||
47 | print EM <<'END'; | |
48 | ||
49 | #else /* not multiple, so translate interpreter symbols the other way... */ | |
50 | ||
51 | END | |
52 | ||
53 | open(INT, "<interp.sym") || die "Can't open interp.sym: $!\n"; | |
54 | while (<INT>) { | |
55 | s/[ \t]*#.*//; # Delete comments. | |
56 | next unless /\S/; | |
57 | s/(.*)/#define I$1\t\t$1/; | |
58 | s/(................\t)\t/$1/; | |
59 | print EM $_; | |
60 | } | |
61 | close(INT) || warn "Can't close interp.sym: $!\n"; | |
62 | ||
63 | print EM <<'END'; | |
64 | ||
65 | #endif /* MULTIPLICITY */ | |
66 | END | |
67 |