Patch below my sig:
-changes Parrot::OpLib::core's dependencies to reflect the new
selectable ops files
-allows some of the special forms of 'goto' inside the PREAMBLE of an
opcode file
--Brent Dax
[EMAIL PROTECTED]
Configure pumpking for Perl 6
"Nothing important happened today."
--George III of England's diary entry for 4-Jul-1776
--- ..\..\parrot-cvs\parrot\Makefile.in Sun Jan 6 12:28:04 2002
+++ Makefile.in Sun Jan 6 13:20:34 2002
@@ -211,8 +211,8 @@
Parrot/Jit.pm: Parrot/Jit/${jitarchname}.pm
$(PERL) -MFile::Copy=cp -e ${PQ}cp q|Parrot/Jit/${jitarchname}.pm|,
q|Parrot/Jit.pm|${PQ}
-Parrot/OpLib/core.pm: core.ops ops2pm.pl Parrot/OpsFile.pm Parrot/Op.pm
- $(PERL) ops2pm.pl core.ops vtable.ops
+Parrot/OpLib/core.pm: $(OPS_FILES) ops2pm.pl Parrot/OpsFile.pm
Parrot/Op.pm
+ $(PERL) ops2pm.pl $(OPS_FILES)
Parrot/PMC.pm: include/parrot/pmc.h pmc_pm.pl
--- ..\..\parrot-cvs\parrot\ops2c.pl Sun Jan 6 11:59:52 2002
+++ ops2c.pl Sun Jan 6 12:58:34 2002
@@ -112,7 +112,7 @@
END_C
-print SOURCE $ops->preamble;
+print SOURCE $ops->preamble($trans);
#
--- ..\..\parrot-cvs\parrot\Parrot\OpsFile.pm Sun Jan 6 11:59:52 2002
+++ Parrot\OpsFile.pm Sun Jan 6 12:58:34 2002
@@ -51,6 +51,8 @@
my $self = bless { PREAMBLE => '' }, $class;
$self->read_ops($_) for @files;
+
+ $self->{FILE}=~s/, $//;
$self->{FILE}=~s/, $//;
@@ -77,7 +79,7 @@
if (! ($file =~ s/\.ops$/.c/)) {
$file .= ".c";
}
-
+
#
# Read through the file, creating and storing Parrot::Op objects:
#
@@ -331,9 +333,25 @@
sub preamble
{
- my $self = shift;
+ my($self, $trans) = @_;
+
+ local $_=$self->{PREAMBLE};
+
+ if($trans) {
+ s/goto\s+OFFSET\((.*)\)/{{+=$1}}/mg;
+ #s/goto\s+NEXT\(\)/{{+=$op_size}}/mg; #not supported--dependent on
op size
+ s/goto\s+ADDRESS\((.*)\)/{{=$1}}/mg;
+ s/goto\s+POP\(\)/{{=*}}/mg;
+ s/HALT\(\)/{{=0}}/mg;
+
+ #borrowed from Parrot::Op
+ s/{{=\*}}/ $trans->goto_pop(); /mge;
+ s/{{=(.*?)}}/ $trans->goto_address($1); /mge;
+ s/{{\+=(.*?)}}/ $trans->goto_offset($1); /mge;
+ s/{{-=(.*?)}}/ $trans->goto_offset(-$1); /mge;
+ }
- return $self->{PREAMBLE};
+ return $_;
}