This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl 5.002gamma: config_h.SH
[perl5.git] / embed.pl
CommitLineData
e50aee73
AD
1#!/usr/bin/perl
2
3open(EM, ">embed.h") || die "Can't create embed.h: $!\n";
4
5print 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 */
13END
14
15open(GL, "<global.sym") || die "Can't open global.sym: $!\n";
16
17while(<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
25close(GL) || warn "Can't close global.sym: $!\n";
26
27print EM <<'END';
28
29#endif /* EMBED */
30
31/* Put interpreter specific symbols into a struct? */
32
33#ifdef MULTIPLICITY
34
35END
36
37open(INT, "<interp.sym") || die "Can't open interp.sym: $!\n";
38while (<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}
45close(INT) || warn "Can't close interp.sym: $!\n";
46
47print EM <<'END';
48
49#else /* not multiple, so translate interpreter symbols the other way... */
50
51END
52
53open(INT, "<interp.sym") || die "Can't open interp.sym: $!\n";
54while (<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}
61close(INT) || warn "Can't close interp.sym: $!\n";
62
63print EM <<'END';
64
65#endif /* MULTIPLICITY */
66END
67