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

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

From:
jquelin
Date:
January 7, 2009 04:24
Subject:
[svn:parrot] r35117 - trunk/languages/befunge
Message ID:
20090107122437.AD909CB9F9@x12.develooper.com
Author: jquelin
Date: Wed Jan  7 04:24:37 2009
New Revision: 35117

Modified:
   trunk/languages/befunge/debug.pir

Log:
dumping stack on debug


Modified: trunk/languages/befunge/debug.pir
==============================================================================
--- trunk/languages/befunge/debug.pir	(original)
+++ trunk/languages/befunge/debug.pir	Wed Jan  7 04:24:37 2009
@@ -77,6 +77,24 @@
     print $S0
 .end
 
+.sub "_debug__print_stack"
+    .local int i, len
+
+    print "stack="
+
+    $P0 = get_global "stack"
+    len = $P0
+    i   = 0
+    if i >= len goto DEBUG_PRINT_STACK__END
+  DEBUG_PRINT_STACK__LOOP:
+    $I0 = $P0[i]
+    print $I0
+    inc i
+    if i >= len goto DEBUG_PRINT_STACK__END
+    print ","
+    goto DEBUG_PRINT_STACK__LOOP
+  DEBUG_PRINT_STACK__END:
+.end
 
 # Print the status of the instruction pointer:
 # coordinates, current char, direction, flags and stack.
@@ -88,28 +106,9 @@
     _debug__print_direction()
     print " "
     _debug__print_flags()
+    print " "
+    _debug__print_stack()
     print "\n"
-
-=pod
-
-        # Stack.
-        print " stack="
-        set I11, P2
-        set I10, 0
-        ge  I10, I11, DEBUG_PRINT_STATUS_STACK_END
-DEBUG_PRINT_STATUS_STACK_LOOP:
-        set I12, P2[I10]
-        print I12
-        inc I10
-        ge I10, I11, DEBUG_PRINT_STATUS_STACK_END
-        print ","
-        branch DEBUG_PRINT_STATUS_STACK_LOOP
-DEBUG_PRINT_STATUS_STACK_END:
-        print "\n"
-        ret
-
-=cut
-
 .end
 
 .sub "_debug__interact"



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