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

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

From:
jquelin
Date:
January 7, 2009 10:05
Subject:
[svn:parrot] r35152 - trunk/languages/befunge
Message ID:
20090107180455.52BADCB9F9@x12.develooper.com
Author: jquelin
Date: Wed Jan  7 10:04:54 2009
New Revision: 35152

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

Log:
go west implemented


Modified: trunk/languages/befunge/befunge.pir
==============================================================================
--- trunk/languages/befunge/befunge.pir	(original)
+++ trunk/languages/befunge/befunge.pir	Wed Jan  7 10:04:54 2009
@@ -72,6 +72,11 @@
   TICK_NODEBUG:
     if char == '"' goto FLOW_TOGGLE_STRING_MODE
     
+    # sole number
+    
+    # direction changing
+    if char == '<' goto FLOW_GO_WEST
+    
     # unknown instruction
     goto MOVE_PC
     
@@ -125,6 +130,10 @@
 
 =cut
 
+  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:04:54 2009
@@ -1,5 +1,17 @@
 # $Id$
 
+#
+# go west.
+# befunge stack unchanged.
+# delta <- (-1,0)
+#
+.sub "flow__go_west"
+    $P0 = get_global "status"
+    $P0["dir"] = 3
+    set_global "status", $P0
+.end
+
+
 =pod
 
 # Go north.
@@ -23,12 +35,6 @@
     set I2, 2
     branch MOVE_PC
 
-# Go west.
-# Befunge stack unchanged.
-# delta <- (-1,0)
-FLOW_GO_WEST:
-    set I2, 3
-    branch MOVE_PC
 
 FLOW_GO_AWAY:
     save 4



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