The included patch modifies Parrot::Assembler to open the Parrot::OpLib
directory and collect operations from the files in that directory,
instead of being hardwired to use only Parrot::OpLib::core.
Unfortunately relative paths can't be used because the assembler script
runs from different directories.

--
--Jeff
<[EMAIL PROTECTED]>

diff -ru parrot/Parrot/Assembler.pm parrot_orig/Parrot/Assembler.pm
--- parrot/Parrot/Assembler.pm  Sat Nov  3 19:04:08 2001
+++ parrot_orig/Parrot/Assembler.pm     Sat Nov  3 22:50:04 2001
@@ -33,7 +33,6 @@
 use Getopt::Long;
 
 use Parrot::Op;
-use Parrot::OpLib::core;
 
 #use Parrot::Opcode;
 
@@ -290,10 +289,25 @@
 
 my %opcodes;
 
-foreach my $op (@$Parrot::OpLib::core::ops) {
-  $opcodes{$op->full_name} = $op;
+use Cwd;
+cwd()=~m,^(.*)/parrot,;
+my $oplib_path = "$1/parrot/Parrot/OpLib";
+
+opendir DIR,$oplib_path or
+  die "Couldn't open $oplib_path";
+my @op_packages = grep { -f "$oplib_path/$_" and !/^\./ }
+                  readdir DIR;
+closedir DIR;
+s/\.pm// for @op_packages;
+
+{ no strict 'refs';
+  for(@op_packages) {
+    require "$oplib_path/$_.pm";
+    for(@${'Parrot::OpLib::'.$_.'::ops'}) {
+      $opcodes{$_->full_name}=$_;
+    }
+  }
 }
-
 

Reply via email to