[svn:parrot] r44824 - trunk/lib/Parrot
tewk at svn.parrot.org
tewk at svn.parrot.org
Tue Mar 9 22:15:05 UTC 2010
Author: tewk
Date: Tue Mar 9 22:15:05 2010
New Revision: 44824
URL: https://trac.parrot.org/parrot/changeset/44824
Log:
generate include/parrot/opsenum.h
Modified:
trunk/lib/Parrot/OpsRenumber.pm
Modified: trunk/lib/Parrot/OpsRenumber.pm
==============================================================================
--- trunk/lib/Parrot/OpsRenumber.pm Tue Mar 9 22:14:04 2010 (r44823)
+++ trunk/lib/Parrot/OpsRenumber.pm Tue Mar 9 22:15:05 2010 (r44824)
@@ -68,6 +68,33 @@
=cut
+
+my $OPSENUM_PREAMBLE =<<END;
+/* ex: set ro ft=c:
+ * !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
+ *
+ * This file is generated automatically from 'lib/Parrot/OpsRenumber.pm'.
+ *
+ * Any changes made here will be lost!
+ *
+ */
+#ifndef OPSENUM_H_GUARD
+#define OPSENUM_H_GUARD
+enum OPS_ENUM {
+END
+
+my $OPSENUM_POSTAMBLE =<<END;
+};
+#endif /* OPSENUM_H_GUARD */
+/* GENERATED BY lib/Parrot/OpsRenumber.pm */
+/*
+ * Local variables:
+ * c-file-style: "parrot"
+ * End:
+ * vim: expandtab shiftwidth=4:
+ */
+END
+
sub renum_op_map_file {
my $self = shift;
@@ -107,6 +134,9 @@
# 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 $OPSENUM_PREAMBLE;
open $OP, '>', $file
or die "Can't open $file, error $!";
print $OP @lines;
@@ -140,9 +170,12 @@
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 $OPSENUM_POSTAMBLE;
+ close $OPSENUM;
return 1;
}
More information about the parrot-commits
mailing list