[svn:parrot] r39650 - trunk/docs/book/pir
coke at svn.parrot.org
coke at svn.parrot.org
Thu Jun 18 12:53:10 UTC 2009
Author: coke
Date: Thu Jun 18 12:53:08 2009
New Revision: 39650
URL: https://trac.parrot.org/parrot/changeset/39650
Log:
un-TODO some passing PIR examples
Patch courtesy mikehh++
(plus minor update to one example to move code from a comment into PIR to
make sure it is also tested.)
Modified:
trunk/docs/book/pir/ch04_variables.pod
trunk/docs/book/pir/ch06_subroutines.pod
trunk/docs/book/pir/ch07_objects.pod
Modified: trunk/docs/book/pir/ch04_variables.pod
==============================================================================
--- trunk/docs/book/pir/ch04_variables.pod Thu Jun 18 10:03:17 2009 (r39649)
+++ trunk/docs/book/pir/ch04_variables.pod Thu Jun 18 12:53:08 2009 (r39650)
@@ -1687,12 +1687,12 @@
example sets and retrieves the variable C<bill> in the Dollar namespace, which
is directly under the root namespace:
-=begin PIR_FRAGMENT_INVALID
+=begin PIR_FRAGMENT
set_root_global ["Dollar"], "bill", $P0
$P1 = get_root_global ["Dollar"], "bill"
-=end PIR_FRAGMENT_INVALID
+=end PIR_FRAGMENT
To prevent further collisions, each high-level language running on Parrot
operates within its own virtual namespace root. The default virtual root is
Modified: trunk/docs/book/pir/ch06_subroutines.pod
==============================================================================
--- trunk/docs/book/pir/ch06_subroutines.pod Thu Jun 18 10:03:17 2009 (r39649)
+++ trunk/docs/book/pir/ch06_subroutines.pod Thu Jun 18 12:53:08 2009 (r39650)
@@ -948,11 +948,11 @@
To jump to the continuation's stored label and return the context to the state
it was in I<at the point of its creation>, invoke the continuation:
-=begin PIR_FRAGMENT_INVALID
+=begin PIR_FRAGMENT
$P0()
-=end PIR_FRAGMENT_INVALID
+=end PIR_FRAGMENT
Even though you can use the subroutine call notation C<$P0()> to invoke
the continuation, you cannot pass arguments or obtain return values.
Modified: trunk/docs/book/pir/ch07_objects.pod
==============================================================================
--- trunk/docs/book/pir/ch07_objects.pod Thu Jun 18 10:03:17 2009 (r39649)
+++ trunk/docs/book/pir/ch07_objects.pod Thu Jun 18 12:53:08 2009 (r39650)
@@ -157,11 +157,11 @@
Methods can have multiple arguments and multiple return values just like
subroutine:
-=begin PIR_FRAGMENT_INVALID
+=begin PIR_FRAGMENT
($P0, $S1) = $P2.'method'($I3, $P4)
-=end PIR_FRAGMENT_INVALID
+=end PIR_FRAGMENT
The C<can> opcode checks whether an object has a particular method. It
returns 0 (false) or 1 (true):
@@ -233,11 +233,11 @@
Calls to inherited methods are just like calls to methods defined in
the class:
-=begin PIR_FRAGMENT_INVALID
+=begin PIR_FRAGMENT
$P1.'increment'()
-=end PIR_FRAGMENT_INVALID
+=end PIR_FRAGMENT
The C<isa> opcode checks whether an object is an instance of or inherits
from a particular class. It returns 0 (false) or 1 (true):
@@ -299,16 +299,18 @@
The C<+> operator (or C<add> opcode) calls C<Foo>'s C<add> vtable function
when it adds two C<Foo> objects:
-=begin PIR_FRAGMENT_INVALID
+=begin PIR_FRAGMENT
$P3 = new 'Foo'
$P3 = 3
$P4 = new 'Foo'
$P4 = 1774
- $P5 = $P3 + $P4 # or: add $P5, $P3, $P4
+ $P5 = $P3 + $P4
+ # or:
+ add $P5, $P3, $P4
-=end PIR_FRAGMENT_INVALID
+=end PIR_FRAGMENT
The C<inc> opcode calls C<Foo>'s C<increment> vtable function when it
increments a C<Foo> object:
More information about the parrot-commits
mailing list