please see attached process_switch.pl
notes inside.

Very rough draft, but I think it does write a correct
define ( but I might be clueless ).

On the note of the enum for the case foo:

Made it work, Gibbs has seen patch, but we wanted to 
defer to Dan/Simon because op.h has the knack of
redefining every op as Parrot_op_foo. :-(

so I suggested the enum fields and case be made
something like add_i_op_idx. But certainly other
things are possible.

Heck, I'll attach the diff.

Gibbs and I thought that the build_interp_starter
and process_opfuncs perl files ought to be able
to share more code, particularly since this submission
is practically a copy of process_opfuncs, and the
enum is trivially done inside build_interp_starter.
However, we have not come to any decision on _where_
the shared code should go. Suggestions solicited.


One bug: I can't quite deal gracefully
with the #includes, I just nuke 'em and write them back,
but the multi-line C-comment block at the top of
basic_opcodes.ops is a pain. Eliminating it clobbers
everything with a STRING *....

Better regexen solicited...

Let me know what you think.

Cheers.

Michael
-- 
Michael Fischer                         7.5 million years to run
[EMAIL PROTECTED]                        printf "%d", 0x2a;
                                                -- deep thought 

process_switch.pl

--- build_interp_starter.pl.bak Wed Sep 19 20:57:19 2001
+++ build_interp_starter.pl     Wed Sep 19 21:42:35 2001
@@ -4,6 +4,7 @@
 
 open INTERP, "> include/parrot/interp_guts.h" or die "Can't open 
include/parrot/interp_guts.h, $!/$^E";
 
+
 print INTERP <<CONST;
 /*
  *
@@ -27,6 +28,30 @@
 
 
 #
+# Write the enum of opcodes in order
+#
+
+#
+# this is failing when interpreter.c compiles, 
+#`Parrot_op_set_i_ic' redeclared as different kind of symbol
+#
+
+print INTERP "\n\n";
+print INTERP "enum {\n";
+
+my $names =
+  join ",\n",
+  map { "\t$_" }
+  sort {$opcodes{$a}{CODE} <=> $opcodes{$b}{CODE}}
+  keys %opcodes;
+
+print INTERP $names, "\n";
+
+print INTERP "};\n\n";
+
+
+
+#
 # BUILD_NAME_TABLE macro:
 #
 
@@ -54,12 +79,14 @@
 print INTERP "} while (0);\n";
 
 
+
+
+
 #
 # Spit out the DO_OP function
 #
 
 print INTERP <<EOI;
-
 #define DO_OP(w,x,y,z) do { \\
     x = (void *)z->opcode_funcs; \\
     y = (opcode_t* (*)())x[*w]; \\

Reply via email to