Author: bernhard
Date: Tue Oct 25 14:41:16 2005
New Revision: 9571
Added:
trunk/examples/pir/local_label.pir
- copied, changed from r9569, trunk/examples/assembly/local_label.pasm
Removed:
trunk/examples/assembly/local_label.pasm
Modified:
trunk/MANIFEST
trunk/t/examples/pir.t
Log:
Move example 'assembly/local_label.pasm' to 'pir/local_label.pir',
make it work again, more verbosely, and add a test.
Modified: trunk/MANIFEST
==============================================================================
--- trunk/MANIFEST (original)
+++ trunk/MANIFEST Tue Oct 25 14:41:16 2005
@@ -447,7 +447,6 @@ encodings/utf8.h
examples/README [main]doc
examples/assembly/acorn.l [main]doc
examples/assembly/hello-dwim.imc [main]doc
-examples/assembly/local_label.pasm [main]doc
examples/assembly/mandel.pasm [main]doc
examples/assembly/mops.pasm [main]doc
examples/assembly/mops_p.pasm [main]doc
@@ -599,6 +598,7 @@ examples/pir/euclid.pir
examples/pir/hanoi.pir [main]doc
examples/pir/io.pir [main]doc
examples/pir/life.pir [main]doc
+examples/pir/local_label.pir [main]doc
examples/pir/mandel.pir [main]doc
examples/pir/sudoku.pir [main]doc
examples/pni/PQt.C [main]doc
Copied: trunk/examples/pir/local_label.pir (from r9569,
trunk/examples/assembly/local_label.pasm)
==============================================================================
--- trunk/examples/assembly/local_label.pasm (original)
+++ trunk/examples/pir/local_label.pir Tue Oct 25 14:41:16 2005
@@ -3,42 +3,43 @@
=head1 NAME
-examples/assembly/local_label.pasm - Local labels
+examples/pir/local_label.pir - Local labels
=head1 SYNOPSIS
- % ./parrot examples/assembly/local_label.pasm
+ % ./parrot examples/pir/local_label.pir
=head1 DESCRIPTION
Show the use of a C<.local> label.
-Note that this file contains IMC (PIR) not PASM.
-
=cut
-.macro MAIN ()
- print "test 1\n"
- branch .$ok
-.local $ng: print "ng 1\n"
- branch test2
-.local $ok: print "ok 1\n"
-
+.macro TEST1 ()
+ print "Branching to '$ok' in macro 'TEST1'\n"
+ branch .$ok
+ end
+.local $ok:
+ print "Branched to '$ok' in macro 'TEST1'\n"
.endm
.macro TEST2 ()
-test2:
- print "test 2\n"
- branch .$ok
-.local $ng: print "ng 2\n"
- branch done
-.local $ok: print "ok 2\n"
-
+test2: # not local
+ print "Branching to '$ok' in macro 'TEST2'\n"
+ branch .$ok
+ end
+.local $ok:
+ print "Branched to '$ok' in macro 'TEST2'\n"
+ branch not_local
.endm
- .MAIN ()
- .TEST2 ()
-
-done: end
-
+.sub "example" :main
+ .TEST1 ()
+ print "After .TEST1 ()\n"
+ .TEST2 ()
+ print "After .TEST2 ()\n"
+ end
+not_local:
+ print "Branched to 'non_local' in sub 'example'\n"
+.end
Modified: trunk/t/examples/pir.t
==============================================================================
--- trunk/t/examples/pir.t (original)
+++ trunk/t/examples/pir.t Tue Oct 25 14:41:16 2005
@@ -32,7 +32,7 @@ Bernhard Schmalhofer - <Bernhard.Schmalh
=cut
use strict;
-use Parrot::Test tests => 7;
+use Parrot::Test tests => 8;
use Test::More;
use Parrot::Config;
@@ -89,6 +89,15 @@ test2
test3
END_EXPECTED
+ 'local_label.pir' => << 'END_EXPECTED',
+Branching to '$ok' in macro 'TEST1'
+Branched to '$ok' in macro 'TEST1'
+After .TEST1 ()
+Branching to '$ok' in macro 'TEST2'
+Branched to '$ok' in macro 'TEST2'
+Branched to 'non_local' in sub 'example'
+END_EXPECTED
+
'mandel.pir' => << 'END_EXPECTED',
................::::::::::::::::::::::::::::::::::::::::::::...............
...........::::::::::::::::::::::::::::::::::::::::::::::::::::::..........