Patch for embed.pl when !EMBED && !MULTIPLICITY
[p5sagit/p5-mst-13.2.git] / embed.pl
CommitLineData
e50aee73 1#!/usr/bin/perl
2
3open(EM, ">embed.h") || die "Can't create embed.h: $!\n";
4
5print EM <<'END';
76b72cf1 6/* !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
6f84cdf9 7 This file is built by embed.pl from global.sym and interp.sym.
76b72cf1 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 */
26END
27
28open(GL, "<global.sym") || die "Can't open global.sym: $!\n";
29
30while(<GL>) {
31 s/[ \t]*#.*//; # Delete comments.
32 next unless /\S/;
760ac839 33 s/^\s*(\S+).*$/#define $1\t\tPerl_$1/;
34 $global{$1} = 1;
e50aee73 35 s/(................\t)\t/$1/;
36 print EM $_;
37}
38
39close(GL) || warn "Can't close global.sym: $!\n";
40
41print EM <<'END';
42
43#endif /* EMBED */
44
45/* Put interpreter specific symbols into a struct? */
46
47#ifdef MULTIPLICITY
48
49END
50
760ac839 51open(INT, "<interp.sym") || die "Can't open interp.sym: $!\n";
52while (<INT>) {
53 s/[ \t]*#.*//; # Delete comments.
54 next unless /\S/;
55497cff 55 s/^\s*(\S+).*$/#define $1\t\t(curinterp->I$1)/;
56 s/(................\t)\t/$1/;
57 print EM $_;
760ac839 58}
59close(INT) || warn "Can't close interp.sym: $!\n";
60
55497cff 61print EM <<'END';
62
63#else /* not multiple, so translate interpreter symbols the other way... */
64
65END
760ac839 66
e50aee73 67open(INT, "<interp.sym") || die "Can't open interp.sym: $!\n";
68while (<INT>) {
69 s/[ \t]*#.*//; # Delete comments.
70 next unless /\S/;
55497cff 71 s/^\s*(\S+).*$/#define I$1\t\t$1/;
e50aee73 72 s/(................\t)\t/$1/;
73 print EM $_;
74}
75close(INT) || warn "Can't close interp.sym: $!\n";
76
56d28764 77print EM <<'END';
78
79#ifdef EMBED
80
81END
e50aee73 82
83open(INT, "<interp.sym") || die "Can't open interp.sym: $!\n";
84while (<INT>) {
85 s/[ \t]*#.*//; # Delete comments.
86 next unless /\S/;
55497cff 87 s/^\s*(\S+).*$/#define $1\t\tPerl_$1/;
e50aee73 88 s/(................\t)\t/$1/;
89 print EM $_;
90}
91close(INT) || warn "Can't close interp.sym: $!\n";
92
93print EM <<'END';
94
56d28764 95#endif /* EMBED */
96
e50aee73 97#endif /* MULTIPLICITY */
98END
99