The attached patch generates include/parrot/opsenum.h

I used the enumsto create a custom runloop for futures.

I'm guessing that this may be useful to others who want to write restricted runloops.

I'm willing to take a small amount of naming/formating suggestions and check it in, if people are interested.

Keivn
diff --git a/lib/Parrot/OpsRenumber.pm b/lib/Parrot/OpsRenumber.pm
index 0a94af3..f2c250b 100644
--- a/lib/Parrot/OpsRenumber.pm
+++ b/lib/Parrot/OpsRenumber.pm
@@ -107,6 +107,14 @@ sub renum_op_map_file {
     # above the DYNAMIC line.  For the purpose of renumbering, we create
     # an index $n.
 
+    my $opsenumfn = "include/parrot/opsenum.h";
+    open my $OPSENUM, '>', $opsenumfn or die "Can't open $opsenumfn, error $!";
+    print $OPSENUM <<END;
+/* GENERATED BY lib/Parrot/OpsRenumber.pm */
+#ifndef ENUMOPS_H_GUARD
+#define ENUMOPS_H_GUARD
+enum ENUM_OPS {
+END
     open $OP, '>', $file
         or die "Can't open $file, error $!";
     print $OP @lines;
@@ -140,9 +148,16 @@ sub renum_op_map_file {
 
         elsif ( $seen{ $_->full_name } ) {
             printf $OP "%-31s%4d\n", $_->full_name, ++$n;
+            printf $OPSENUM "ENUM_OPS_%-31s=%4d,\n", $_->full_name, $n;
         }
     }
     close $OP;
+    print $OPSENUM <<END;
+}
+#endif /* ENUMOPS_H_GUARD */
+/* GENERATED BY lib/Parrot/OpsRenumber.pm */
+END
+    close $OPSENUM;
 
     return 1;
 }
_______________________________________________
http://lists.parrot.org/mailman/listinfo/parrot-dev

Reply via email to