summaryrefslogtreecommitdiffstats
path: root/debug.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2012-02-28 21:46:05 -0800
committerKaz Kylheku <kaz@kylheku.com>2012-02-28 21:46:05 -0800
commitc71cdf1461646ecaf56969d18bcc629039d7148d (patch)
tree0d340ab7ff9f621a71aa86a58f648e6010775374 /debug.c
parent8513e2e828aaefb9a5d0b7a5426ec433c2f69293 (diff)
downloadtxr-c71cdf1461646ecaf56969d18bcc629039d7148d.tar.gz
txr-c71cdf1461646ecaf56969d18bcc629039d7148d.tar.bz2
txr-c71cdf1461646ecaf56969d18bcc629039d7148d.zip
* debug.c: Missing d command implemented.
Condense the output to 8 times the screen width, for more context. Condense the output in vertical mode (when the entire input line is shown) not only character mode. * lib.c (remq, remql, remqual): New functions. * lib.h (remq, remql, remqual): Declared.
Diffstat (limited to 'debug.c')
-rw-r--r--debug.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/debug.c b/debug.c
index 16076a94..808e60af 100644
--- a/debug.c
+++ b/debug.c
@@ -109,9 +109,11 @@ val debug(val form, val bindings, val data, val line, val pos, val base)
}
if (print_data) {
+ int lim = cols * 8;
+
if (data && pos) {
- val half = num((cols - 8) / 2);
- val full = num((cols - 8));
+ val half = num((lim - 8) / 2);
+ val full = num((lim - 8));
val prefix, suffix;
if (lt(pos, half)) {
@@ -124,6 +126,10 @@ val debug(val form, val bindings, val data, val line, val pos, val base)
format(std_debug, lit("data (~s:~s):\n~s . ~s\n"),
line, plus(pos, base), prefix, suffix, nao);
+ } else if (data && length_str_ge(data, num(lim - 2))) {
+ format(std_debug, lit("data (~s):\n~s...~s\n"), line,
+ sub_str(data, zero, num(lim/2 - 4)),
+ sub_str(data, num(-(lim/2 - 3)), t), nao);
} else {
format(std_debug, lit("data (~s):\n~s\n"), line, data, nao);
}
@@ -166,12 +172,14 @@ val debug(val form, val bindings, val data, val line, val pos, val base)
print_data = t;
} else if (equal(command, lit("b")) || equal(command, lit("d"))) {
if (!rest(input)) {
- format(std_debug, lit("b needs argument\n"), nao);
+ format(std_debug, lit("~s needs argument\n"), command, nao);
continue;
} else {
long n = wcstol(c_str(second(input)), NULL, 10);
if (equal(command, lit("b")))
push(num(n), &breakpoints);
+ else
+ breakpoints = remql(num(n), breakpoints);
}
} else if (equal(command, lit("l"))) {
format(std_debug, lit("breakpoints: ~s\n"), breakpoints, nao);