[svn:parrot] r40198 - in trunk: . lib/Parrot src/dynoplibs src/ops t/tools/dev/searchops t/tools/ops2pm tools/dev

cotto at svn.parrot.org cotto at svn.parrot.org
Tue Jul 21 20:49:42 UTC 2009


Author: cotto
Date: Tue Jul 21 20:49:40 2009
New Revision: 40198
URL: https://trac.parrot.org/parrot/changeset/40198

Log:
[ops2c] change ops file format to include explicit ops preamble (tt #836)

Modified:
   trunk/DEPRECATED.pod
   trunk/lib/Parrot/OpsFile.pm
   trunk/src/dynoplibs/obscure.ops
   trunk/src/ops/bit.ops
   trunk/src/ops/cmp.ops
   trunk/src/ops/core.ops
   trunk/src/ops/debug.ops
   trunk/src/ops/experimental.ops
   trunk/src/ops/io.ops
   trunk/src/ops/math.ops
   trunk/src/ops/object.ops
   trunk/src/ops/pic.ops
   trunk/src/ops/pmc.ops
   trunk/src/ops/set.ops
   trunk/src/ops/string.ops
   trunk/src/ops/sys.ops
   trunk/src/ops/var.ops
   trunk/t/tools/dev/searchops/samples.pm
   trunk/t/tools/ops2pm/08-sort_ops.t
   trunk/tools/dev/mk_language_shell.pl

Modified: trunk/DEPRECATED.pod
==============================================================================
--- trunk/DEPRECATED.pod	Tue Jul 21 16:47:49 2009	(r40197)
+++ trunk/DEPRECATED.pod	Tue Jul 21 20:49:40 2009	(r40198)
@@ -87,15 +87,6 @@
 
 =over 4
 
-=item ops file format [eligible in 1.5]
-
-The ops file format has some cruft in the form of the "VERSION =
-PARROT_VERSION;" line and is hard to parse when several ops files are
-concatenated together.   This item covers the removal of the VERSION line and
-an improved syntax for ops preambles.
-
-L<https://trac.parrot.org/parrot/ticket/836>
-
 =item moved to dynop [eligible in 1.1]
 
 Parts or all of: bit.ops, debug.ops, io.ops, math.ops, set.ops

Modified: trunk/lib/Parrot/OpsFile.pm
==============================================================================
--- trunk/lib/Parrot/OpsFile.pm	Tue Jul 21 16:47:49 2009	(r40197)
+++ trunk/lib/Parrot/OpsFile.pm	Tue Jul 21 20:49:40 2009	(r40198)
@@ -239,6 +239,8 @@
 
     open my $OPS, '<', $file or die "Can't open $file, $!/$^E";
 
+    $self->version( $PConfig{VERSION} );
+
     if ( !( $file =~ s/\.ops$/.c/ ) ) {
         $file .= ".c";
     }
@@ -257,37 +259,25 @@
     my @argdirs;
     my $seen_pod;
     my $seen_op;
+    my $in_preamble;
     my $line;
     my $flags;
     my @labels;
 
     while (<$OPS>) {
-        $seen_pod = 1 if m|^=|;
+        $seen_pod    = 1 if m|^=|;
+        $in_preamble = 1 if s|^BEGIN_OPS_PREAMBLE||;
 
         unless ( $seen_op or m|^(inline\s+)?op\s+| ) {
-            if (m/^\s*VERSION\s*=\s*"(\d+\.\d+\.\d+)"\s*;\s*$/)
-            {
-                if ( exists $self->{VERSION} ) {
 
-                    #die "VERSION MULTIPLY DEFINED!";
-                }
-
-                $self->version($1);
+            if (m|^END_OPS_PREAMBLE|) {
                 $_ = '';
+                $in_preamble = 0;
             }
-            elsif (m/^\s*VERSION\s*=\s*PARROT_VERSION\s*;\s*$/) {
-                if ( exists $self->{VERSION} ) {
-
-                    #die "VERSION MULTIPLY DEFINED!";
-                }
-
-                $self->version( $PConfig{VERSION} );
-                $_ = '';
+            elsif ($in_preamble) {
+                $self->{PREAMBLE} .= $_;
             }
 
-            $self->{PREAMBLE} .= $_
-                unless $seen_pod or $count;    # Lines up to first op def.
-
             next;
         }
 

Modified: trunk/src/dynoplibs/obscure.ops
==============================================================================
--- trunk/src/dynoplibs/obscure.ops	Tue Jul 21 16:47:49 2009	(r40197)
+++ trunk/src/dynoplibs/obscure.ops	Tue Jul 21 20:49:40 2009	(r40198)
@@ -3,9 +3,11 @@
 ** obscure.ops
 */
 
+BEGIN_OPS_PREAMBLE
+
 #include <math.h>
 
-VERSION = PARROT_VERSION;
+END_OPS_PREAMBLE
 
 =head1 NAME
 

Modified: trunk/src/ops/bit.ops
==============================================================================
--- trunk/src/ops/bit.ops	Tue Jul 21 16:47:49 2009	(r40197)
+++ trunk/src/ops/bit.ops	Tue Jul 21 20:49:40 2009	(r40198)
@@ -3,6 +3,7 @@
 ** bit.ops
 */
 
+BEGIN_OPS_PREAMBLE
  /* Signed shift operator that is compatible with PMC shifts.  This is
   * guaranteed to produce the same result as bitwise_left_shift_internal modulo
   * word size, ignoring the fact that Parrot integers are always signed.  This
@@ -18,7 +19,7 @@
      : (bits) > -8*INTVAL_SIZE   ? (number) >> -(bits)   \
      : 0)
 
-VERSION = PARROT_VERSION;
+END_OPS_PREAMBLE
 
 =head1 NAME
 

Modified: trunk/src/ops/cmp.ops
==============================================================================
--- trunk/src/ops/cmp.ops	Tue Jul 21 16:47:49 2009	(r40197)
+++ trunk/src/ops/cmp.ops	Tue Jul 21 20:49:40 2009	(r40198)
@@ -3,8 +3,6 @@
 ** cmp.ops
 */
 
-VERSION = PARROT_VERSION;
-
 =head1 NAME
 
 cmp.ops - Comparison Opcodes

Modified: trunk/src/ops/core.ops
==============================================================================
--- trunk/src/ops/core.ops	Tue Jul 21 16:47:49 2009	(r40197)
+++ trunk/src/ops/core.ops	Tue Jul 21 20:49:40 2009	(r40198)
@@ -3,13 +3,15 @@
 ** core.ops
 */
 
+BEGIN_OPS_PREAMBLE
+
 #include "parrot/dynext.h"
 #include "parrot/embed.h"
 #include "parrot/runcore_api.h"
 #include "../pmc/pmc_continuation.h"
 #include "../pmc/pmc_parrotlibrary.h"
 
-VERSION = PARROT_VERSION;
+END_OPS_PREAMBLE
 
 =head1 NAME
 

Modified: trunk/src/ops/debug.ops
==============================================================================
--- trunk/src/ops/debug.ops	Tue Jul 21 16:47:49 2009	(r40197)
+++ trunk/src/ops/debug.ops	Tue Jul 21 20:49:40 2009	(r40198)
@@ -7,8 +7,6 @@
 ** debug.ops
 */
 
-VERSION = PARROT_VERSION;
-
 =head1 NAME
 
 debug.ops - Debugging Opcodes

Modified: trunk/src/ops/experimental.ops
==============================================================================
--- trunk/src/ops/experimental.ops	Tue Jul 21 16:47:49 2009	(r40197)
+++ trunk/src/ops/experimental.ops	Tue Jul 21 20:49:40 2009	(r40198)
@@ -3,8 +3,6 @@
 ** experimental.ops
 */
 
-VERSION = PARROT_VERSION;
-
 =head1 NAME
 
 experimental.ops - Experimental Opcodes

Modified: trunk/src/ops/io.ops
==============================================================================
--- trunk/src/ops/io.ops	Tue Jul 21 16:47:49 2009	(r40197)
+++ trunk/src/ops/io.ops	Tue Jul 21 20:49:40 2009	(r40198)
@@ -4,8 +4,9 @@
 ** io.ops
 */
 
-VERSION = PARROT_VERSION;
+BEGIN_OPS_PREAMBLE
 #include "../io/io_private.h"
+END_OPS_PREAMBLE
 
 
 =head1 NAME

Modified: trunk/src/ops/math.ops
==============================================================================
--- trunk/src/ops/math.ops	Tue Jul 21 16:47:49 2009	(r40197)
+++ trunk/src/ops/math.ops	Tue Jul 21 20:49:40 2009	(r40198)
@@ -3,8 +3,6 @@
 ** math.ops
 */
 
-VERSION = PARROT_VERSION;
-
 =head1 NAME
 
 math.ops - Mathematical Opcodes

Modified: trunk/src/ops/object.ops
==============================================================================
--- trunk/src/ops/object.ops	Tue Jul 21 16:47:49 2009	(r40197)
+++ trunk/src/ops/object.ops	Tue Jul 21 20:49:40 2009	(r40198)
@@ -6,9 +6,6 @@
 
 */
 
-
-VERSION = PARROT_VERSION;
-
 =head1 NAME
 
 object.ops - Class and Object Opcodes

Modified: trunk/src/ops/pic.ops
==============================================================================
--- trunk/src/ops/pic.ops	Tue Jul 21 16:47:49 2009	(r40197)
+++ trunk/src/ops/pic.ops	Tue Jul 21 20:49:40 2009	(r40198)
@@ -3,12 +3,12 @@
 ** pic.ops
 */
 
+BEGIN_OPS_PREAMBLE
 #include "parrot/oplib/ops.h"
 #include "../src/pmc/pmc_fixedintegerarray.h"
 
 typedef opcode_t* (*interface_f)(Interp*, INTVAL*, void **);
-
-VERSION = PARROT_VERSION;
+END_OPS_PREAMBLE
 
 =head1 NAME
 

Modified: trunk/src/ops/pmc.ops
==============================================================================
--- trunk/src/ops/pmc.ops	Tue Jul 21 16:47:49 2009	(r40197)
+++ trunk/src/ops/pmc.ops	Tue Jul 21 20:49:40 2009	(r40198)
@@ -6,8 +6,6 @@
 
 */
 
-VERSION = PARROT_VERSION;
-
 =head1 NAME
 
 pmc.ops - PMC Opcodes

Modified: trunk/src/ops/set.ops
==============================================================================
--- trunk/src/ops/set.ops	Tue Jul 21 16:47:49 2009	(r40197)
+++ trunk/src/ops/set.ops	Tue Jul 21 20:49:40 2009	(r40198)
@@ -3,8 +3,6 @@
 ** set.ops
 */
 
-VERSION = PARROT_VERSION;
-
 =head1 NAME
 
 set.ops - Assignment Opcodes

Modified: trunk/src/ops/string.ops
==============================================================================
--- trunk/src/ops/string.ops	Tue Jul 21 16:47:49 2009	(r40197)
+++ trunk/src/ops/string.ops	Tue Jul 21 20:49:40 2009	(r40198)
@@ -3,8 +3,6 @@
 ** string.ops
 */
 
-VERSION = PARROT_VERSION;
-
 =head1 NAME
 
 string.ops - String Opcodes

Modified: trunk/src/ops/sys.ops
==============================================================================
--- trunk/src/ops/sys.ops	Tue Jul 21 16:47:49 2009	(r40197)
+++ trunk/src/ops/sys.ops	Tue Jul 21 20:49:40 2009	(r40198)
@@ -3,8 +3,6 @@
 ** sys.ops
 */
 
-VERSION = PARROT_VERSION;
-
 =head1 NAME
 
 sys.ops - System Interaction Opcodes

Modified: trunk/src/ops/var.ops
==============================================================================
--- trunk/src/ops/var.ops	Tue Jul 21 16:47:49 2009	(r40197)
+++ trunk/src/ops/var.ops	Tue Jul 21 20:49:40 2009	(r40198)
@@ -3,8 +3,6 @@
 ** var.ops
 */
 
-VERSION = PARROT_VERSION;
-
 =head1 NAME
 
 var.ops - Variable Opcodes

Modified: trunk/t/tools/dev/searchops/samples.pm
==============================================================================
--- trunk/t/tools/dev/searchops/samples.pm	Tue Jul 21 16:47:49 2009	(r40197)
+++ trunk/t/tools/dev/searchops/samples.pm	Tue Jul 21 20:49:40 2009	(r40198)
@@ -17,11 +17,13 @@
 ** pseudo-core.ops
 */
 
+BEGIN_OPS_PREAMBLE
+
 #include "parrot/dynext.h"
 #include "parrot/embed.h"
 #include "../interp/interp_guts.h"
 
-VERSION = PARROT_VERSION;
+END_OPS_PREAMBLE
 
 =head1 NAME
 
@@ -151,8 +153,6 @@
 ** pseudo-debug.ops
 */
 
-VERSION = PARROT_VERSION;
-
 =head1 NAME
 
 pseudo-debug.ops
@@ -270,8 +270,6 @@
 ** pseudo-string.ops
 */
 
-VERSION = PARROT_VERSION;
-
 =head1 NAME
 
 pseudo-string.ops - String Operations

Modified: trunk/t/tools/ops2pm/08-sort_ops.t
==============================================================================
--- trunk/t/tools/ops2pm/08-sort_ops.t	Tue Jul 21 16:47:49 2009	(r40197)
+++ trunk/t/tools/ops2pm/08-sort_ops.t	Tue Jul 21 20:49:40 2009	(r40198)
@@ -222,8 +222,6 @@
 ** dummy.ops
 */
 
-VERSION = PARROT_VERSION;
-
 inline op zzzzzz(inout INT, in INT) :base_core {
   goto NEXT();
 }

Modified: trunk/tools/dev/mk_language_shell.pl
==============================================================================
--- trunk/tools/dev/mk_language_shell.pl	Tue Jul 21 16:47:49 2009	(r40197)
+++ trunk/tools/dev/mk_language_shell.pl	Tue Jul 21 20:49:40 2009	(r40198)
@@ -1228,8 +1228,11 @@
  * Copyright (C) 20xx, Parrot Foundation.
  */
 
+BEGIN_OPS_PREAMBLE
+
 #include "parrot/dynext.h"
-VERSION = PARROT_VERSION;
+
+END_OPS_PREAMBLE
 
 /* Op to get the address of a PMC. */
 inline op @lclang at _pmc_addr(out INT, invar PMC) :base_core {


More information about the parrot-commits mailing list