summaryrefslogtreecommitdiffstats
path: root/debug.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2015-11-13 20:54:48 -0800
committerKaz Kylheku <kaz@kylheku.com>2015-11-14 08:37:26 -0800
commitea8bf1c897290d2283033d8e3546a970cdd096f3 (patch)
tree45020f16bcceec996d9d5b5608f02143394ef4bc /debug.c
parent9f633256dea9a141bc5a4d96b2b9c47e3ecb4858 (diff)
downloadtxr-ea8bf1c897290d2283033d8e3546a970cdd096f3.tar.gz
txr-ea8bf1c897290d2283033d8e3546a970cdd096f3.tar.bz2
txr-ea8bf1c897290d2283033d8e3546a970cdd096f3.zip
Implementing *print-base* and ~d format directive.
* debug.c (show_bindings): Use ~d for level, so as not to be influenced by *print-base*. (debug): Use ~d for line numbers. * lib.c (gensym): Use ~d conversion specifier for formatting gensym counter into symbol name. * match.c (LOG_MISMATCH, LOG_MATCH): Use ~d for line number references. (h_skip, h_coll, h_fun, h_chr, match_line_completely, v_skip, v_fuzz, v_gather, v_collect, v_output, v_filter, v_fun, v_assert, v_load, v_line, h_assert, open_data_source): Use ~d for line refs, number of iterations, errno values. * parser.c (repl): Use ~d for prompt line numbers, numbered variables and the expr-<n> string in error messages. * parser.l (yyerrorf, source_loc_str): Use ~d for line numbers. * stream.c (print_base_s): New symbol variable. (formatv): Implement *print-base*. (stdio_maybe_read_error, stdio_maybe_error, stdio_close, pipe_close, open_directory, open_file, open_fileno, open_tail, open_process, run, remove_path): Use ~d for errno values. (stream_init): Initialize print_base_s and register *print-base* special variable. sysif.c (mkdir_wrap, ensure_dir, getcwd_wrap, mknod_wrap, chmod_wrap, symlink_wrap, link_wrap, readlink_wrap, excec_wrap, stat_impl, pipe_wrap, poll_wrap, getgroups_wrap, setuid_wrap, seteuid_wrap, setgid_wrap): Use ~d for errno values and system function results. * txr.1: Documented *print-base* and ~d conversion specifier.
Diffstat (limited to 'debug.c')
-rw-r--r--debug.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/debug.c b/debug.c
index 487ef2a9..f8673f89 100644
--- a/debug.c
+++ b/debug.c
@@ -81,10 +81,10 @@ static void show_bindings(val env, val stream)
if (nilp(env))
break;
else if (consp(env)) {
- format(stream, lit("~s: ~s\n"), level, env, nao);
+ format(stream, lit("~d: ~s\n"), level, env, nao);
break;
} else if (type(env) == ENV) {
- format(stream, lit("~s: ~s\n"), level, env->e.vbindings, nao);
+ format(stream, lit("~d: ~s\n"), level, env->e.vbindings, nao);
env = env->e.up_env;
} else {
format(stream, lit("invalid environment object: ~s\n"), env, nao);
@@ -116,7 +116,7 @@ val debug(val form, val bindings, val data, val line, val pos, val base)
val input, command;
if (print_form) {
- format(std_debug, lit("stopped at line ~a of ~a\n"),
+ format(std_debug, lit("stopped at line ~d of ~a\n"),
lineno, file, nao);
format(std_debug, lit("form: ~s\n"), form, nao);
format(std_debug, lit("depth: ~s\n"), num(debug_depth), nao);
@@ -139,14 +139,14 @@ val debug(val form, val bindings, val data, val line, val pos, val base)
suffix = sub_str(data, pos, plus(pos, half));
}
- format(std_debug, lit("data (~s:~s):\n~s . ~s\n"),
+ format(std_debug, lit("data (~d:~d):\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,
+ format(std_debug, lit("data (~d):\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);
+ format(std_debug, lit("data (~d):\n~s\n"), line, data, nao);
}
print_data = nil;
}