summaryrefslogtreecommitdiff
path: root/opcode.pl
diff options
context:
space:
mode:
Diffstat (limited to 'opcode.pl')
-rwxr-xr-xopcode.pl23
1 files changed, 17 insertions, 6 deletions
diff --git a/opcode.pl b/opcode.pl
index 6e56a10142..f1127452b3 100755
--- a/opcode.pl
+++ b/opcode.pl
@@ -1,7 +1,8 @@
#!/usr/bin/perl
-unlink "opcode.h";
+unlink "opcode.h", "opnames.h";
open(OC, ">opcode.h") || die "Can't create opcode.h: $!\n";
+open(ON, ">opnames.h") || die "Can't create opnames.h: $!\n";
select OC;
# Read data.
@@ -39,14 +40,23 @@ print <<"END";
#define Perl_pp_i_postinc Perl_pp_postinc
#define Perl_pp_i_postdec Perl_pp_postdec
-typedef enum {
END
+
+print ON <<"END";
+/* !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
+ This file is built by opcode.pl from its data. Any changes made here
+ will be lost!
+*/
+
+typedef enum opcode {
+END
+
for (@ops) {
- print "\t", &tab(3,"OP_\U$_,"), "/* ", $i++, " */\n";
+ print ON "\t", &tab(3,"OP_\U$_,"), "/* ", $i++, " */\n";
}
-print "\t", &tab(3,"OP_max"), "\n";
-print "} opcode;\n";
-print "\n#define MAXO ", scalar @ops, "\n\n";
+print ON "\t", &tab(3,"OP_max"), "\n";
+print ON "} opcode;\n";
+print ON "\n#define MAXO ", scalar @ops, "\n\n";
# Emit op names and descriptions.
@@ -214,6 +224,7 @@ END_EXTERN_C
END
close OC or die "Error closing opcode.h: $!";
+close ON or die "Error closing opnames.h: $!";
unlink "pp_proto.h";
unlink "pp.sym";