Author: jkeenan
Date: Sat Aug 16 12:25:27 2008
New Revision: 30271
Modified:
branches/opsrenum/lib/Parrot/Ops2pm/Base.pm
branches/opsrenum/lib/Parrot/OpsRenumber.pm
branches/opsrenum/tools/dev/opsrenumber.pl
Log:
Clarifications in POD and inline comments.
Modified: branches/opsrenum/lib/Parrot/Ops2pm/Base.pm
==============================================================================
--- branches/opsrenum/lib/Parrot/Ops2pm/Base.pm (original)
+++ branches/opsrenum/lib/Parrot/Ops2pm/Base.pm Sat Aug 16 12:25:27 2008
@@ -63,7 +63,8 @@
inc_f : name of output C-header file
(generally, ops.h)
script : name of the script to be executed by 'make'
- (generally, tools/build/ops2pm.pl)
+ (generally, either tools/build/ops2pm.pl
+ or tools/dev/opsrenumber.pl)
=item * Return Value
Modified: branches/opsrenum/lib/Parrot/OpsRenumber.pm
==============================================================================
--- branches/opsrenum/lib/Parrot/OpsRenumber.pm (original)
+++ branches/opsrenum/lib/Parrot/OpsRenumber.pm Sat Aug 16 12:25:27 2008
@@ -82,8 +82,9 @@
# We open up the currently existing ops.num and file and read it
# line-by-line. That file is basically divided into two halves
- # separated by the ###DYNAMIC### line. Above that line are found (a)
- # inline comments and (b) the first 7, never-to-be-altered opcodes.
+ # separated by the ###DYNAMIC### line. Above that line are found
+ # (a) # inline comments and
+ # (b) the first 7, never-to-be-altered opcodes.
# Below that line are all the remaining opcodes. All opcode lines
# match the pattern /^(\w+)\s+(\d+)$/. Everything above the line gets
# pushed into @lines and, if it's an opcode line, get's split and
@@ -116,17 +117,17 @@
or die "Can't open $file, error $!";
print $OP @lines;
my ($n);
-
+
# We can't use all autogenerated ops from oplib/core
# there are unwanted permutations like 'add_i_ic_ic
# which aren't opcodes but calculated at compile-time.
-
+
# The ops element is set by prepare_ops(), which is inherited from
# Parrot::Ops2pm::Base. prepare_ops(), in turn, works off
# Parrot::OpsFile.
-
+
# So whether a particular opcode will appear in the *new* ops.num
- # depends entirely on whether or not it's found in
+ # depends entirely on whether or not it's found in
# @{ $self->{ops}->{OPS} }. If a particular opcode has been deleted or
# gone missing from that array, then it won't appear in the new
# ops.num. That's acceptable pre-version 1.0, but not afterwards (per
@@ -134,7 +135,7 @@
# 1.0, the opcodes in ops.num will be non-deletable. New opcodes may
# be added to the end of the list and numbered accordingly, but no
# opcodes may be deleted.
-
+
for ( @{ $self->{ops}->{OPS} } ) {
# To account for the number of opcodes above the line, we'll
@@ -154,6 +155,7 @@
close $OP;
}
else {
+ # Parrot 1.0 and beyond case
my ( $name, $number, @lines, %fixed );
open my $OP, '<', $file
or die "Can't open $file, error $!";
@@ -169,16 +171,19 @@
}
close $OP;
- # Now we re-open the very same file we just read -- this time for
- # writing. We directly print all the lines in @lines, i.e., those
- # above the DYNAMIC line. For the purpose of renumbering, we create
+ # We re-open the very same file we just read -- this time for
+ # writing. We directly print all the lines in @lines -- but post-1.0
+ # that means re-printing the whole file (not just entries
+ # above the DYNAMIC line). For the purpose of renumbering, we create
# an index $n and initialize it at the highest opcode number yet seen.
open $OP, '>', $file
or die "Can't open $file, error $!";
print $OP @lines;
my $n = (scalar keys %fixed) - 1;
-
+
+ # We now add any opcodes detected by Parrot::OpsFile but not seen
+ # heretofore in src/ops/ops.num.
for my $op ( @{ $self->{ops}->{OPS} } ) {
my $fn = $op->full_name;
if (! defined $fixed{$fn} ) {
Modified: branches/opsrenum/tools/dev/opsrenumber.pl
==============================================================================
--- branches/opsrenum/tools/dev/opsrenumber.pl (original)
+++ branches/opsrenum/tools/dev/opsrenumber.pl Sat Aug 16 12:25:27 2008
@@ -58,31 +58,10 @@
=head1 AUTHOR
-Over the years, the code now found in F<tools/dev/opsrenumber.pl> has been
-worked on by the following Parrot hackers:
+This code was refactored out of F<tools/build/ops2pm.pl>. That file contains
+a list of the contributors to this code over the years.
- bernhard
- brentdax
- chip
- chromatic
- coke
- dan
- gregor
- jkeenan
- leo
- mikescott
- particle
- paultcochrane
- petdance
- robert
- simon
- tewk
-
-Others who provided code cited in the version control logs include:
-
- Andy Dougherty
- Jeff Gof
- Steve Fink
+The refactoring of this file was done by James E Keenan.
=cut