Fix type mismatches in x2p's safe{alloc,realloc,free}.
[p5sagit/p5-mst-13.2.git] / old_embed.pl
CommitLineData
55497cff 1#!/usr/bin/perl
2#
3# FOR BACKWARDS COMPATIBILITY WITH OLD VERSIONS OF PERL
4#
5# This script uses an old method of creating "embed.h". Use it
6# if you need to maintain binary compatibility with older versions
7# Perl with the EMBED feature enabled.
8#
9
10open(EM, ">embed.h") || die "Can't create embed.h: $!\n";
11
12print EM <<'END';
13/* !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
14 This file is built by old_embed.pl from old_global.sym and interp.sym.
15 Any changes made here will be lost.
16 THIS FILE IS FOR BINARY COMPATIBILITY WITH OLD PERL VERSIONS.
17 Run "embed.pl" to get an up-to-date version.
18*/
19
20/* (Doing namespace management portably in C is really gross.) */
21
22/* EMBED has no run-time penalty, but helps keep the Perl namespace
23 from colliding with that used by other libraries pulled in
24 by extensions or by embedding perl. Allow a cc -DNO_EMBED
25 override, however, to keep binary compatability with previous
26 versions of perl.
27*/
28#ifndef NO_EMBED
29# define EMBED 1
30#endif
31
32#ifdef EMBED
33
34/* globals we need to hide from the world */
35END
36
37open(GL, "<old_global.sym") || die "Can't open old_global.sym: $!\n";
38
39while(<GL>) {
40 s/[ \t]*#.*//; # Delete comments.
41 next unless /\S/;
42 s/^\s*(\S+).*$/#define $1\t\tPerl_$1/;
43 $global{$1} = 1;
44 s/(................\t)\t/$1/;
45 print EM $_;
46}
47
48close(GL) || warn "Can't close old_global.sym: $!\n";
49
50print EM <<'END';
51
52#endif /* EMBED */
53
54/* Put interpreter specific symbols into a struct? */
55
56#ifdef MULTIPLICITY
57
58/* Undefine symbols that were defined by EMBED. Somewhat ugly */
59
60END
61
62
63open(INT, "<interp.sym") || die "Can't open interp.sym: $!\n";
64while (<INT>) {
65 s/[ \t]*#.*//; # Delete comments.
66 next unless /\S/;
67 s/^\s*(\S*).*$/#undef $1/;
68 print EM $_ if (exists $global{$1});
69}
70close(INT) || warn "Can't close interp.sym: $!\n";
71
72print EM "\n";
73
74open(INT, "<interp.sym") || die "Can't open interp.sym: $!\n";
75while (<INT>) {
76 s/[ \t]*#.*//; # Delete comments.
77 next unless /\S/;
78 s/^\s*(\S+).*$/#define $1\t\t(curinterp->I$1)/;
79 s/(................\t)\t/$1/;
80 print EM $_;
81}
82close(INT) || warn "Can't close interp.sym: $!\n";
83
84print EM <<'END';
85
86#else /* not multiple, so translate interpreter symbols the other way... */
87
88END
89
90open(INT, "<interp.sym") || die "Can't open interp.sym: $!\n";
91while (<INT>) {
92 s/[ \t]*#.*//; # Delete comments.
93 next unless /\S/;
94 s/^\s*(\S+).*$/#define I$1\t\t$1/;
95 s/(................\t)\t/$1/;
96 print EM $_;
97}
98close(INT) || warn "Can't close interp.sym: $!\n";
99
100print EM <<'END';
101
102#endif /* MULTIPLICITY */
103END
104