Front page | perl.cvs.parrot |
Postings from January 2009
[svn:parrot] r35059 - trunk/languages/befunge
From:
jquelin
Date:
January 6, 2009 10:13
Subject:
[svn:parrot] r35059 - trunk/languages/befunge
Message ID:
20090106181344.3CE62CB9F9@x12.develooper.com
Author: jquelin
Date: Tue Jan 6 10:13:42 2009
New Revision: 35059
Added:
trunk/languages/befunge/debug.pir
- copied, changed from r35056, /trunk/languages/befunge/debug.pasm
Removed:
trunk/languages/befunge/debug.pasm
Modified:
trunk/languages/befunge/befunge.pir
Log:
debug initialization ported to modern pir
Modified: trunk/languages/befunge/befunge.pir
==============================================================================
--- trunk/languages/befunge/befunge.pir (original)
+++ trunk/languages/befunge/befunge.pir Tue Jan 6 10:13:42 2009
@@ -1,10 +1,10 @@
# $Id$
+.include "debug.pir"
.include "load.pir"
=pod
-.include "debug.pasm"
.include "flow.pasm"
.include "io.pasm"
.include "maths.pasm"
@@ -35,12 +35,11 @@
char = substr arg, 0, 1
ne char, "-", ARGV_DONE
eq arg, "-d", ARGV_DEBUG
- branch ARGV_NEXT
+ goto ARGV_NEXT
ARGV_DEBUG:
- inc i
- #TODO bsr DEBUG_INITIALIZE # initialize P3
- branch ARGV_NEXT
+ debug_initialize()
+ goto ARGV_NEXT
ARGV_DONE:
file = argv[i]
Copied: trunk/languages/befunge/debug.pir (from r35056, /trunk/languages/befunge/debug.pasm)
==============================================================================
--- /trunk/languages/befunge/debug.pasm (original)
+++ trunk/languages/befunge/debug.pir Tue Jan 6 10:13:42 2009
@@ -1,19 +1,37 @@
# $Id$
-# Initialize the debug structure.
-# P3 = [ 1, { "<" => 1, "10,10" => 1, "r:6" => 1, "c:3" => 1, ... } ]
-# P3[0] = stop at each step
-# P3[1] = a Hash which keys are either the char to break upon
-# when reaching it, or a location "y,x", or a column "c:nn"
-# or a row "r:nn"
-DEBUG_INITIALIZE:
- new P3, 'ResizablePMCArray'
- set P3[0], 1 # Stop at first step.
- repeat S10, "0", 128 # No char to break on.
- new P4, 'Hash'
- set P3[1], P4 # The breakpoints.
- ret
+#
+# ** globals used for debug purposes:
+#
+# step: boolean telling whether to stop at each step
+#
+# breakpoints: hash listing the existing breakpoints. the keys are
+# either the char to break upon when reaching it, or a location "y,x",
+# or a column "c:nn", or a row "r:nn"
+# eg: { "<" => 1, "10,10" => 1, "r:6" => 1, "c:3" => 1, ... }
+#
+
+#
+# debug_initialize()
+#
+# declare & initialize global debug variables
+#
+.sub "debug_initialize"
+ .local pmc step, breakpoints
+
+ step = new 'Integer'
+ step = 1
+ breakpoints = new 'Hash'
+
+ set_global "step", step
+ set_global "breakpoints", breakpoints
+ #repeat S10, "0", 128 # No char to break on.
+
+ .return()
+.end
+
+=pod
# Check whether we should stop the interpreter at the current
# moment, allowing user to play with the debugger.
@@ -213,3 +231,4 @@
print S10
ret
+=cut
-
[svn:parrot] r35059 - trunk/languages/befunge
by jquelin