Ticket #836: ops_format_update.patch

File ops_format_update.patch, 6.1 KB (added by cotto, 13 years ago)
  • src/ops/cmp.ops

     
    33** cmp.ops 
    44*/ 
    55 
    6 VERSION = PARROT_VERSION; 
    7  
    86=head1 NAME 
    97 
    108cmp.ops - Comparison Opcodes 
  • src/ops/pmc.ops

     
    66 
    77*/ 
    88 
    9 VERSION = PARROT_VERSION; 
    10  
    119=head1 NAME 
    1210 
    1311pmc.ops - PMC Opcodes 
  • src/ops/debug.ops

     
    77** debug.ops 
    88*/ 
    99 
    10 VERSION = PARROT_VERSION; 
    11  
    1210=head1 NAME 
    1311 
    1412debug.ops - Debugging Opcodes 
  • src/ops/var.ops

     
    33** var.ops 
    44*/ 
    55 
    6 VERSION = PARROT_VERSION; 
    7  
    86=head1 NAME 
    97 
    108var.ops - Variable Opcodes 
  • src/ops/core.ops

     
    33** core.ops 
    44*/ 
    55 
     6BEGIN_OPS_PREAMBLE 
     7 
    68#include "parrot/dynext.h" 
    79#include "parrot/embed.h" 
    810#include "parrot/runcore_api.h" 
    911#include "../pmc/pmc_continuation.h" 
    1012#include "../pmc/pmc_parrotlibrary.h" 
    1113 
    12 VERSION = PARROT_VERSION; 
     14END_OPS_PREAMBLE 
    1315 
    1416=head1 NAME 
    1517 
  • src/ops/math.ops

     
    33** math.ops 
    44*/ 
    55 
    6 VERSION = PARROT_VERSION; 
    7  
    86=head1 NAME 
    97 
    108math.ops - Mathematical Opcodes 
  • src/ops/set.ops

     
    33** set.ops 
    44*/ 
    55 
    6 VERSION = PARROT_VERSION; 
    7  
    86=head1 NAME 
    97 
    108set.ops - Assignment Opcodes 
  • src/ops/experimental.ops

     
    33** experimental.ops 
    44*/ 
    55 
    6 VERSION = PARROT_VERSION; 
    7  
    86=head1 NAME 
    97 
    108experimental.ops - Experimental Opcodes 
  • src/ops/object.ops

     
    66 
    77*/ 
    88 
    9  
    10 VERSION = PARROT_VERSION; 
    11  
    129=head1 NAME 
    1310 
    1411object.ops - Class and Object Opcodes 
  • src/ops/string.ops

     
    33** string.ops 
    44*/ 
    55 
    6 VERSION = PARROT_VERSION; 
    7  
    86=head1 NAME 
    97 
    108string.ops - String Opcodes 
  • src/ops/io.ops

     
    44** io.ops 
    55*/ 
    66 
    7 VERSION = PARROT_VERSION; 
     7BEGIN_OPS_PREAMBLE 
    88#include "../io/io_private.h" 
     9END_OPS_PREAMBLE 
    910 
    1011 
    1112=head1 NAME 
  • src/ops/pic.ops

     
    33** pic.ops 
    44*/ 
    55 
     6BEGIN_OPS_PREAMBLE 
    67#include "parrot/oplib/ops.h" 
    78#include "../src/pmc/pmc_fixedintegerarray.h" 
    89 
    910typedef opcode_t* (*interface_f)(Interp*, INTVAL*, void **); 
     11END_OPS_PREAMBLE 
    1012 
    11 VERSION = PARROT_VERSION; 
    12  
    1313=head1 NAME 
    1414 
    1515pic.ops - PIC (Polymorphic Inline Cache) Opcodes [deprecated] 
  • src/ops/sys.ops

     
    33** sys.ops 
    44*/ 
    55 
    6 VERSION = PARROT_VERSION; 
    7  
    86=head1 NAME 
    97 
    108sys.ops - System Interaction Opcodes 
  • src/ops/bit.ops

     
    33** bit.ops 
    44*/ 
    55 
     6BEGIN_OPS_PREAMBLE 
    67 /* Signed shift operator that is compatible with PMC shifts.  This is 
    78  * guaranteed to produce the same result as bitwise_left_shift_internal modulo 
    89  * word size, ignoring the fact that Parrot integers are always signed.  This 
     
    1819     : (bits) > -8*INTVAL_SIZE   ? (number) >> -(bits)   \ 
    1920     : 0) 
    2021 
    21 VERSION = PARROT_VERSION; 
     22END_OPS_PREAMBLE 
    2223 
    2324=head1 NAME 
    2425 
  • lib/Parrot/OpsFile.pm

     
    239239 
    240240    open my $OPS, '<', $file or die "Can't open $file, $!/$^E"; 
    241241 
     242    $self->version( $PConfig{VERSION} ); 
     243 
    242244    if ( !( $file =~ s/\.ops$/.c/ ) ) { 
    243245        $file .= ".c"; 
    244246    } 
     
    257259    my @argdirs; 
    258260    my $seen_pod; 
    259261    my $seen_op; 
     262    my $in_preamble; 
    260263    my $line; 
    261264    my $flags; 
    262265    my @labels; 
    263266 
    264267    while (<$OPS>) { 
    265         $seen_pod = 1 if m|^=|; 
     268        $seen_pod    = 1 if m|^=|; 
     269        $in_preamble = 1 if s|^BEGIN_OPS_PREAMBLE||; 
    266270 
    267271        unless ( $seen_op or m|^(inline\s+)?op\s+| ) { 
    268             if (m/^\s*VERSION\s*=\s*"(\d+\.\d+\.\d+)"\s*;\s*$/) 
    269             { 
    270                 if ( exists $self->{VERSION} ) { 
    271272 
    272                     #die "VERSION MULTIPLY DEFINED!"; 
    273                 } 
    274  
    275                 $self->version($1); 
     273            if (m|^END_OPS_PREAMBLE|) { 
    276274                $_ = ''; 
     275                $in_preamble = 0; 
    277276            } 
    278             elsif (m/^\s*VERSION\s*=\s*PARROT_VERSION\s*;\s*$/) { 
    279                 if ( exists $self->{VERSION} ) { 
    280  
    281                     #die "VERSION MULTIPLY DEFINED!"; 
    282                 } 
    283  
    284                 $self->version( $PConfig{VERSION} ); 
    285                 $_ = ''; 
     277            elsif ($in_preamble) { 
     278                $self->{PREAMBLE} .= $_; 
    286279            } 
    287280 
    288             $self->{PREAMBLE} .= $_ 
    289                 unless $seen_pod or $count;    # Lines up to first op def. 
    290  
    291281            next; 
    292282        } 
    293283