cvsuser 02/06/22 07:38:24
Modified: . assemble.pl
Log:
added .include directive and fixed documentation for swap macro
Revision Changes Path
1.76 +17 -12 parrot/assemble.pl
Index: assemble.pl
===================================================================
RCS file: /cvs/public/parrot/assemble.pl,v
retrieving revision 1.75
retrieving revision 1.76
diff -u -w -r1.75 -r1.76
--- assemble.pl 22 Jun 2002 05:10:06 -0000 1.75
+++ assemble.pl 22 Jun 2002 14:38:24 -0000 1.76
@@ -39,7 +39,7 @@
.macro swap (A,B,TEMP) # . marks the directive
set .TEMP,.A # . marks the special variable.
set .A,.B
- set .B,TEMP
+ set .B,.TEMP
.endm # And . marks the end of the macro.
Macros support labels that are local to a given macro expansion, and the syntax
@@ -231,7 +231,9 @@
my $reg_re = qr([INSP]\d+);
my $num_re = qr([-+]?\d+(\.\d+([eE][-+]?\d+)?)?);
- for(@{$self->{cur_contents}}) {
+ my @todo=@{$self->{cur_contents}};
+ while(scalar(@todo)) {
+ $_=shift(@todo);
$line++;
#
@@ -267,16 +269,19 @@
elsif(/^\.include \s+
"([^"]+)"
/x) { # .include "{file}"
-# if(-e $1) {
-# open FOO,"< $1";
-# while(<FOO>) {
-# chomp;
-# }
-# close FOO;
-# }
-# else {
-# print STDERR "Couldn't open '$1' for inclusion at line $line: $!.\n";
-# }
+ if(-e $1) {
+ open FOO,"< $1";
+ my @include;
+ while(<FOO>) {
+ chomp;
+ push(@include,$_);
+ }
+ unshift(@todo,@include);
+ close FOO;
+ }
+ else {
+ print STDERR "Couldn't open '$1' for inclusion at line $line: $!.\n";
+ }
}
elsif(/^\.macro \s+
($label_re) \s*