From 3708c97e3c5c3c6adf025c3ac4ef51f3fcc6028d Mon Sep 17 00:00:00 2001 From: "rginda%netscape.com" Date: Fri, 28 Apr 2000 02:20:23 +0000 Subject: [PATCH] printarg stubbed out git-svn-id: svn://10.0.0.236/trunk@67454 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/js/js2/tools/gencode.pl | 23 +++++++++++++++++------ mozilla/js2/tools/gencode.pl | 23 +++++++++++++++++------ 2 files changed, 34 insertions(+), 12 deletions(-) diff --git a/mozilla/js/js2/tools/gencode.pl b/mozilla/js/js2/tools/gencode.pl index 7caad295bef..1ae0ba49ca8 100644 --- a/mozilla/js/js2/tools/gencode.pl +++ b/mozilla/js/js2/tools/gencode.pl @@ -61,7 +61,6 @@ $ops{"NOP"} = { super => "Instruction", rem => "do nothing and like it", - params => [ () ] }; $ops{"MOVE"} = { @@ -184,7 +183,6 @@ $ops{"ENDTRY"} = { super => "Instruction", rem => "mmm, there is no try, only do", - params => [ () ] }; $ops{"JSR"} = { @@ -196,7 +194,6 @@ $ops{"RTS"} = { super => "Instruction", rem => "Return to sender", - params => [ () ] }; # @@ -248,6 +245,8 @@ sub collect { my $rem = $c->{"rem"}; my ($dec_list, $call_list, $template_list) = &get_paramlists(@params); + my @types = split (", ", $template_list); + my $constr_params = $call_list ? $opname . ", " . $call_list : $opname; if ($super =~ /Instruction_\d/) { @@ -264,12 +263,12 @@ sub collect { "$init_tab$tab$tab($constr_params) " . "{};\n"); if (!$c->{"super_has_print"}) { - my $printbody = &get_printbody(split (", ", $template_list)); + my $print_body = &get_print_body(@types); $class_decs .= ($init_tab . $tab . "virtual Formatter& print (Formatter& f) {\n" . $init_tab . $tab . $tab . "f << opcodeNames[$opname]" . - $printbody . ";\n" . + $print_body . ";\n" . $init_tab . $tab . $tab . "return f;\n" . $init_tab . $tab . "}\n"); } else { @@ -277,6 +276,12 @@ sub collect { "/* print() inherited from $super */\n"; } + $class_decs .= ($init_tab . $tab . "virtual Formatter& print_args " . + "(Formatter &f, JSValues ®isters) {\n" . + $init_tab . $tab . $tab . &get_printargs_body(@types) . + "\n" . + $init_tab . $tab . "}\n"); + $class_decs .= $init_tab . "};\n\n"; } @@ -351,7 +356,7 @@ sub get_paramlists { return (join (", ", @dec), join (", ", @call), join (", ", @template)); } -sub get_printbody { +sub get_print_body { # generate the body of the print() function my (@types) = @_; my $type; @@ -380,3 +385,9 @@ sub get_printbody { } } + +sub get_printargs_body { + my (@type) = @_; + + return "return f;"; +} diff --git a/mozilla/js2/tools/gencode.pl b/mozilla/js2/tools/gencode.pl index 7caad295bef..1ae0ba49ca8 100644 --- a/mozilla/js2/tools/gencode.pl +++ b/mozilla/js2/tools/gencode.pl @@ -61,7 +61,6 @@ $ops{"NOP"} = { super => "Instruction", rem => "do nothing and like it", - params => [ () ] }; $ops{"MOVE"} = { @@ -184,7 +183,6 @@ $ops{"ENDTRY"} = { super => "Instruction", rem => "mmm, there is no try, only do", - params => [ () ] }; $ops{"JSR"} = { @@ -196,7 +194,6 @@ $ops{"RTS"} = { super => "Instruction", rem => "Return to sender", - params => [ () ] }; # @@ -248,6 +245,8 @@ sub collect { my $rem = $c->{"rem"}; my ($dec_list, $call_list, $template_list) = &get_paramlists(@params); + my @types = split (", ", $template_list); + my $constr_params = $call_list ? $opname . ", " . $call_list : $opname; if ($super =~ /Instruction_\d/) { @@ -264,12 +263,12 @@ sub collect { "$init_tab$tab$tab($constr_params) " . "{};\n"); if (!$c->{"super_has_print"}) { - my $printbody = &get_printbody(split (", ", $template_list)); + my $print_body = &get_print_body(@types); $class_decs .= ($init_tab . $tab . "virtual Formatter& print (Formatter& f) {\n" . $init_tab . $tab . $tab . "f << opcodeNames[$opname]" . - $printbody . ";\n" . + $print_body . ";\n" . $init_tab . $tab . $tab . "return f;\n" . $init_tab . $tab . "}\n"); } else { @@ -277,6 +276,12 @@ sub collect { "/* print() inherited from $super */\n"; } + $class_decs .= ($init_tab . $tab . "virtual Formatter& print_args " . + "(Formatter &f, JSValues ®isters) {\n" . + $init_tab . $tab . $tab . &get_printargs_body(@types) . + "\n" . + $init_tab . $tab . "}\n"); + $class_decs .= $init_tab . "};\n\n"; } @@ -351,7 +356,7 @@ sub get_paramlists { return (join (", ", @dec), join (", ", @call), join (", ", @template)); } -sub get_printbody { +sub get_print_body { # generate the body of the print() function my (@types) = @_; my $type; @@ -380,3 +385,9 @@ sub get_printbody { } } + +sub get_printargs_body { + my (@type) = @_; + + return "return f;"; +}