develooper Front page | perl.cvs.parrot | Postings from January 2009

[svn:parrot] r35159 - trunk/languages/befunge

From:
jquelin
Date:
January 7, 2009 10:20
Subject:
[svn:parrot] r35159 - trunk/languages/befunge
Message ID:
20090107182016.93067CB9F9@x12.develooper.com
Author: jquelin
Date: Wed Jan  7 10:20:15 2009
New Revision: 35159

Modified:
   trunk/languages/befunge/befunge.pir
   trunk/languages/befunge/flow.pir

Log:
instuction " implemented (toggle string mode)


Modified: trunk/languages/befunge/befunge.pir
==============================================================================
--- trunk/languages/befunge/befunge.pir	(original)
+++ trunk/languages/befunge/befunge.pir	Wed Jan  7 10:20:15 2009
@@ -133,6 +133,7 @@
 
 =cut
 
+    # flow instructions
   FLOW_GO_EAST:
     flow__go_east()
     goto MOVE_PC
@@ -145,7 +146,6 @@
   FLOW_GO_WEST:
     flow__go_west()
     goto MOVE_PC
-    
   FLOW_TOGGLE_STRING_MODE:
     flow__toggle_string_mode()
     goto MOVE_PC

Modified: trunk/languages/befunge/flow.pir
==============================================================================
--- trunk/languages/befunge/flow.pir	(original)
+++ trunk/languages/befunge/flow.pir	Wed Jan  7 10:20:15 2009
@@ -1,5 +1,7 @@
 # $Id$
 
+# ** direction changing
+
 #
 # go east.
 # befunge stack unchanged.
@@ -43,6 +45,28 @@
 .end
 
 
+# ** string mode
+
+#
+# toggle string mode.
+# befunge stack unchanged.
+#
+.sub "flow__toggle_string_mode"
+    $P0 = get_global "status"
+    $I0 = $P0["flag"]
+  
+    if $I0 == 1 goto FLOW__TOGGLE_STRING_MODE__OFF
+    $P0["flag"] = 1
+    goto FLOW__TOGGLE_STRING_MODE__DONE
+    
+  FLOW__TOGGLE_STRING_MODE__OFF:
+    $P0["flag"] = 0
+  
+  FLOW__TOGGLE_STRING_MODE__DONE:
+    set_global "status", $P0
+.end
+
+
 =pod
 
 FLOW_GO_AWAY:
@@ -102,15 +126,6 @@
     push P2, I12
     branch MOVE_PC
 
-# Toggle string mode.
-# Befunge stack unchanged.
-FLOW_TOGGLE_STRING_MODE:
-    eq I4, 1, FLOW_TOGGLE_STRING_MODE_OFF
-    set I4, 1
-    branch MOVE_PC
-FLOW_TOGGLE_STRING_MODE_OFF:
-    set I4, 0
-    branch MOVE_PC
 
 # Trampoline.
 # Befunge stack unchanged.



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About