summaryrefslogtreecommitdiff
path: root/embed_h.SH
blob: d78bffbd9def6bbef2875f7d081a00cdc242d898 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/sh

cat <<'END' >embed.h
/* This file is derived from global.var and interp.var */

/* (Doing namespace management portably in C is really gross.) */

#ifdef EMBED

/* globals we need to hide from the world */
END

sed <global.var >>embed.h						\
	-e 's/[ 	]*#.*//'					\
	-e '/^[ 	]*$/d'						\
	-e 's/\(.*\)/#define \1		PERL\1/'			\
	-e 's/\(................	\)	/\1/'

cat <<'END' >> embed.h

#endif /* EMBEDDED */

/* Put interpreter specific variables into a struct? */

#ifdef MULTIPLICITY

END


sed <interp.var >>embed.h						\
	-e 's/[ 	]*#.*//'					\
	-e '/^[ 	]*$/d'						\
	-e 's/\(.*\)/#define \1		(curinterp->I\1)/'		\
	-e 's/\(................	\)	/\1/'

cat <<'END' >> embed.h

#else	/* not multiple, so translate interpreter variables the other way... */

END

sed <interp.var >>embed.h						\
	-e 's/[ 	]*#.*//'					\
	-e '/^[ 	]*$/d'						\
	-e 's/\(.*\)/#define I\1		\1/'			\
	-e 's/\(................	\)	/\1/'

cat <<'END' >> embed.h

#endif /* MULTIPLE_INTERPRETERS */
END