[svn:parrot] r46910 - in branches/ops_pct: compilers/opsc/src/Ops include/parrot

cotto at svn.parrot.org cotto at svn.parrot.org
Sun May 23 07:15:59 UTC 2010


Author: cotto
Date: Sun May 23 07:15:59 2010
New Revision: 46910
URL: https://trac.parrot.org/parrot/changeset/46910

Log:
[opsc] use existing header guards, codas, etc and regenerate opsenum.h

Modified:
   branches/ops_pct/compilers/opsc/src/Ops/Emitter.pm
   branches/ops_pct/include/parrot/opsenum.h

Modified: branches/ops_pct/compilers/opsc/src/Ops/Emitter.pm
==============================================================================
--- branches/ops_pct/compilers/opsc/src/Ops/Emitter.pm	Sun May 23 06:34:29 2010	(r46909)
+++ branches/ops_pct/compilers/opsc/src/Ops/Emitter.pm	Sun May 23 07:15:59 2010	(r46910)
@@ -126,7 +126,7 @@
     $file := ~self<dir> ~ "include/parrot/opsenum.h";
     $fh := pir::open__pss($file, 'w')
         || die("Can't open $file for writing: " ~ ~pir::err__s());
-    self.emit_c_opsenum_header($fh);
+    self.emit_c_opsenum_header($fh, $file);
     $fh.close();
 }
 
@@ -152,22 +152,27 @@
 
 }
 
-method emit_c_opsenum_header($fh) {
+method emit_c_opsenum_header($fh, $file) {
 
     if !self.exists('max_fixed_op_num') {
         self._prepare_ops_num();
     }
 
-    self.emit_opsenum_h_preamble($fh);
+    self._emit_guard_prefix($fh, $file);
+
+    self._emit_preamble($fh);
 
     self.emit_opsenum_h_body($fh);
 
-    self.emit_opsenum_h_postamble($fh);
+    self._emit_guard_suffix($fh, $file);
 
+    self._emit_coda($fh);
 }
 
 method emit_opsenum_h_body($fh) {
 
+    $fh.print("enum OPS_ENUM \{\n");
+
     my $max_op_num := self<max_fixed_op_num> + 0;
     for self.ops_file.ops -> $op {
         if self<numbered_ops>.exists( $op.full_name ) {
@@ -179,6 +184,8 @@
             $fh.print($space ~ $max_op_num ~ ",\n");
         }
     }
+
+    $fh.print("};\n");
 }
 
 method _prepare_ops_num() {
@@ -214,39 +221,6 @@
     }
 }
 
-method emit_opsenum_h_preamble($fh) {
-    $fh.print(q|
-/* ex: set ro ft=c:
-* !!!!!!!   DO NOT EDIT THIS FILE   !!!!!!!
-*
-* This file is generated automatically from 'ops2c'.
-*
-* Any changes made here will be lost!
-*
-*/
-
-#ifndef OPSENUM_H_GUARD
-#define OPSENUM_H_GUARD
-
-enum OPS_ENUM {
-|);
-}
-
-method emit_opsenum_h_postamble($fh) {
-    $fh.print(q|};
-
-#endif /* OPSENUM_H_GUARD */
-
-/* GENERATED BY ops2c */
-/*
-* Local variables:
-*   c-file-style: "parrot"
-* End:
-* vim: expandtab shiftwidth=4:
-*/|);
-}
-
-
 method print_c_source_file() {
     # Build file in memeory
     my $fh := pir::new__Ps('StringHandle');

Modified: branches/ops_pct/include/parrot/opsenum.h
==============================================================================
--- branches/ops_pct/include/parrot/opsenum.h	Sun May 23 06:34:29 2010	(r46909)
+++ branches/ops_pct/include/parrot/opsenum.h	Sun May 23 07:15:59 2010	(r46910)
@@ -1,16 +1,19 @@
 
-/* ex: set ro ft=c:
-* !!!!!!!   DO NOT EDIT THIS FILE   !!!!!!!
-*
-* This file is generated automatically from 'ops2c'.
-*
-* Any changes made here will be lost!
-*
-*/
+/* $Id$ */
 
-#ifndef OPSENUM_H_GUARD
-#define OPSENUM_H_GUARD
+#ifndef PARROT_OPSENUM_H_GUARD
+#define PARROT_OPSENUM_H_GUARD
 
+
+/* ex: set ro:
+ * !!!!!!!   DO NOT EDIT THIS FILE   !!!!!!!
+ *
+ * This file is generated automatically from 'src/ops/core.ops' (and possibly other
+ * .ops files). by ops2c.nqp.
+ *
+ * Any changes made here will be lost!
+ *
+ */
 enum OPS_ENUM {
     enum_ops_load_bytecode_s               =    5,
     enum_ops_load_bytecode_sc              =    6,
@@ -1210,12 +1213,14 @@
     enum_ops_find_sub_not_null_p_sc        = 1200,
 };
 
-#endif /* OPSENUM_H_GUARD */
 
-/* GENERATED BY ops2c */
+#endif /* PARROT_OPSENUM_H_GUARD */
+
+
 /*
-* Local variables:
-*   c-file-style: "parrot"
-* End:
-* vim: expandtab shiftwidth=4:
-*/
\ No newline at end of file
+ * Local variables:
+ *   c-file-style: "parrot"
+ *   buffer-read-only: t
+ * End:
+ * vim: expandtab shiftwidth=4:
+ */


More information about the parrot-commits mailing list