From 7a512866fde146213c0b175960040445fc5961f9 Mon Sep 17 00:00:00 2001 From: "beard%netscape.com" Date: Thu, 29 Jun 2000 04:21:00 +0000 Subject: [PATCH] now uses conditional compilation #if defined(OPCODE_NAMES), so that a simple "icode.h" can be included by vmtypes.h and vmtypes.cpp. --- js/js2/tools/gencode.pl | 20 +++++++++++++++----- js2/tools/gencode.pl | 20 +++++++++++++++----- 2 files changed, 30 insertions(+), 10 deletions(-) diff --git a/js/js2/tools/gencode.pl b/js/js2/tools/gencode.pl index d8f3df5578b3..435383ec4779 100644 --- a/js/js2/tools/gencode.pl +++ b/js/js2/tools/gencode.pl @@ -276,8 +276,8 @@ $ops{"CALL"} = $ops{"STATIC_CALL"} = { super => "Instruction_4", - rem => "result, target class, name, args", - params => [ ("TypedRegister" , "JSClass*", "const StringAtom*", "RegisterList") ] + rem => "result, target class, index, args", + params => [ ("TypedRegister" , "JSClass*", "uint32", "RegisterList") ] }; $ops{"METHOD_CALL"} = { @@ -426,9 +426,18 @@ sub collect { sub spew { # print the info in $enum_decs, @name_aray, and $class_decs to stdout. my $opname; + + print "// THIS FILE IS MACHINE GENERATED! DO NOT EDIT BY HAND!\n\n"; + + print "#if !defined(OPCODE_NAMES)\n\n"; - print $tab . "enum ICodeOp {\n$enum_decs$tab};\n\n"; - print $tab . "static char *opcodeNames[] = {\n"; + print $tab . "enum {\n$enum_decs$tab};\n\n"; + + print $class_decs; + + print "#else\n\n"; + + print $tab . "char *opcodeNames[] = {\n"; for $opname (@name_array) { print "$tab$tab\"$opname"; @@ -438,7 +447,8 @@ sub spew { print "\",\n" } print "$tab};\n\n"; - print $class_decs; + + print "#endif\n\n" } sub get_classname { diff --git a/js2/tools/gencode.pl b/js2/tools/gencode.pl index d8f3df5578b3..435383ec4779 100644 --- a/js2/tools/gencode.pl +++ b/js2/tools/gencode.pl @@ -276,8 +276,8 @@ $ops{"CALL"} = $ops{"STATIC_CALL"} = { super => "Instruction_4", - rem => "result, target class, name, args", - params => [ ("TypedRegister" , "JSClass*", "const StringAtom*", "RegisterList") ] + rem => "result, target class, index, args", + params => [ ("TypedRegister" , "JSClass*", "uint32", "RegisterList") ] }; $ops{"METHOD_CALL"} = { @@ -426,9 +426,18 @@ sub collect { sub spew { # print the info in $enum_decs, @name_aray, and $class_decs to stdout. my $opname; + + print "// THIS FILE IS MACHINE GENERATED! DO NOT EDIT BY HAND!\n\n"; + + print "#if !defined(OPCODE_NAMES)\n\n"; - print $tab . "enum ICodeOp {\n$enum_decs$tab};\n\n"; - print $tab . "static char *opcodeNames[] = {\n"; + print $tab . "enum {\n$enum_decs$tab};\n\n"; + + print $class_decs; + + print "#else\n\n"; + + print $tab . "char *opcodeNames[] = {\n"; for $opname (@name_array) { print "$tab$tab\"$opname"; @@ -438,7 +447,8 @@ sub spew { print "\",\n" } print "$tab};\n\n"; - print $class_decs; + + print "#endif\n\n" } sub get_classname {