d78bffbd9def6bbef2875f7d081a00cdc242d898
[perl.git] / embed_h.SH
1 #!/bin/sh
2
3 cat <<'END' >embed.h
4 /* This file is derived from global.var and interp.var */
5
6 /* (Doing namespace management portably in C is really gross.) */
7
8 #ifdef EMBED
9
10 /* globals we need to hide from the world */
11 END
12
13 sed <global.var >>embed.h                                               \
14         -e 's/[         ]*#.*//'                                        \
15         -e '/^[         ]*$/d'                                          \
16         -e 's/\(.*\)/#define \1         PERL\1/'                        \
17         -e 's/\(................        \)      /\1/'
18
19 cat <<'END' >> embed.h
20
21 #endif /* EMBEDDED */
22
23 /* Put interpreter specific variables into a struct? */
24
25 #ifdef MULTIPLICITY
26
27 END
28
29
30 sed <interp.var >>embed.h                                               \
31         -e 's/[         ]*#.*//'                                        \
32         -e '/^[         ]*$/d'                                          \
33         -e 's/\(.*\)/#define \1         (curinterp->I\1)/'              \
34         -e 's/\(................        \)      /\1/'
35
36 cat <<'END' >> embed.h
37
38 #else   /* not multiple, so translate interpreter variables the other way... */
39
40 END
41
42 sed <interp.var >>embed.h                                               \
43         -e 's/[         ]*#.*//'                                        \
44         -e '/^[         ]*$/d'                                          \
45         -e 's/\(.*\)/#define I\1                \1/'                    \
46         -e 's/\(................        \)      /\1/'
47
48 cat <<'END' >> embed.h
49
50 #endif /* MULTIPLE_INTERPRETERS */
51 END
52