summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/perl/embed.pl
diff options
context:
space:
mode:
authorJason Downs <downsj@cvs.openbsd.org>1996-08-19 10:13:38 +0000
committerJason Downs <downsj@cvs.openbsd.org>1996-08-19 10:13:38 +0000
commit14856225739aa48b6c9cf4c17925362b2d95cea3 (patch)
treedfd38f1b654fb5bbdfc38887c1a829b658e71530 /gnu/usr.bin/perl/embed.pl
parent77469082517e44fe6ca347d9e8dc7dffd1583637 (diff)
Import of Perl 5.003 into the tree. Makefile.bsd-wrapper and
config.sh.OpenBSD are the only local changes.
Diffstat (limited to 'gnu/usr.bin/perl/embed.pl')
-rw-r--r--gnu/usr.bin/perl/embed.pl77
1 files changed, 77 insertions, 0 deletions
diff --git a/gnu/usr.bin/perl/embed.pl b/gnu/usr.bin/perl/embed.pl
new file mode 100644
index 00000000000..e5423dde3cc
--- /dev/null
+++ b/gnu/usr.bin/perl/embed.pl
@@ -0,0 +1,77 @@
+#!/usr/bin/perl
+
+open(EM, ">embed.h") || die "Can't create embed.h: $!\n";
+
+print EM <<'END';
+/* This file is derived from global.sym and interp.sym */
+
+/* (Doing namespace management portably in C is really gross.) */
+
+/* EMBED has no run-time penalty, but helps keep the Perl namespace
+ from colliding with that used by other libraries pulled in
+ by extensions or by embedding perl. Allow a cc -DNO_EMBED
+ override, however, to keep binary compatability with previous
+ versions of perl.
+*/
+#ifndef NO_EMBED
+# define EMBED 1
+#endif
+
+#ifdef EMBED
+
+/* globals we need to hide from the world */
+END
+
+open(GL, "<global.sym") || die "Can't open global.sym: $!\n";
+
+while(<GL>) {
+ s/[ \t]*#.*//; # Delete comments.
+ next unless /\S/;
+ s/(.*)/#define $1\t\tPerl_$1/;
+ s/(................\t)\t/$1/;
+ print EM $_;
+}
+
+close(GL) || warn "Can't close global.sym: $!\n";
+
+print EM <<'END';
+
+#endif /* EMBED */
+
+/* Put interpreter specific symbols into a struct? */
+
+#ifdef MULTIPLICITY
+
+END
+
+open(INT, "<interp.sym") || die "Can't open interp.sym: $!\n";
+while (<INT>) {
+ s/[ \t]*#.*//; # Delete comments.
+ next unless /\S/;
+ s/(.*)/#define $1\t\t(curinterp->I$1)/;
+ s/(................\t)\t/$1/;
+ print EM $_;
+}
+close(INT) || warn "Can't close interp.sym: $!\n";
+
+print EM <<'END';
+
+#else /* not multiple, so translate interpreter symbols the other way... */
+
+END
+
+open(INT, "<interp.sym") || die "Can't open interp.sym: $!\n";
+while (<INT>) {
+ s/[ \t]*#.*//; # Delete comments.
+ next unless /\S/;
+ s/(.*)/#define I$1\t\t$1/;
+ s/(................\t)\t/$1/;
+ print EM $_;
+}
+close(INT) || warn "Can't close interp.sym: $!\n";
+
+print EM <<'END';
+
+#endif /* MULTIPLICITY */
+END
+