diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2012-02-12 00:25:41 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2012-02-12 00:25:41 -0800 |
commit | 658d2d955629d7619098ac9568f329da55d8176d (patch) | |
tree | 72f2be016cb7a1668bc609223fa9362eacb974d5 | |
parent | fce7c87fa0099e5414607676fc73c9dfa9d7649c (diff) | |
download | txr-658d2d955629d7619098ac9568f329da55d8176d.tar.gz txr-658d2d955629d7619098ac9568f329da55d8176d.tar.bz2 txr-658d2d955629d7619098ac9568f329da55d8176d.zip |
Task #11486: continuation. Take into account base position
in debug reporting.
* debug.c (debug): New argument, base.
* debug.h (debug_check): New argument, base.
(debug): Declaration updated.
* eval.c (do_eval): Pass new argument of debug_check as nil.
* match.c (LOG_MISMATCH, LOG_MATCH): Take into account base
when displaying character position.
(do_match_line): Pass base position to debug_check.
(match_files): Pass nil as base to debug_check.
-rw-r--r-- | ChangeLog | 17 | ||||
-rw-r--r-- | debug.c | 10 | ||||
-rw-r--r-- | debug.h | 7 | ||||
-rw-r--r-- | eval.c | 2 | ||||
-rw-r--r-- | match.c | 10 |
5 files changed, 33 insertions, 13 deletions
@@ -1,3 +1,20 @@ +2012-02-12 Kaz Kylheku <kaz@kylheku.com> + + Task #11486: continuation. Take into account base position + in debug reporting. + + * debug.c (debug): New argument, base. + + * debug.h (debug_check): New argument, base. + (debug): Declaration updated. + + * eval.c (do_eval): Pass new argument of debug_check as nil. + + * match.c (LOG_MISMATCH, LOG_MATCH): Take into account base + when displaying character position. + (do_match_line): Pass base position to debug_check. + (match_files): Pass nil as base to debug_check. + 2012-02-11 Kaz Kylheku <kaz@kylheku.com> Task #11486: continuation. Now able to @(skip) through @@ -56,7 +56,7 @@ static void show_bindings(val env, val stream) } } -val debug(val form, val bindings, val data, val line, val chr) +val debug(val form, val bindings, val data, val line, val val pos, val base) { uses_or2; val lineno = source_loc(form); @@ -80,12 +80,12 @@ val debug(val form, val bindings, val data, val line, val chr) } if (print_data) { - if (data && chr) { - val prefix = sub_str(data, zero, chr); - val suffix = sub_str(data, chr, nil); + if (data && pos) { + val prefix = sub_str(data, zero, pos); + val suffix = sub_str(data, pos, nil); format(std_output, lit("data (~s:~s):\n~s . ~s\n"), - line, chr, prefix, suffix, nao); + line, plus(pos, base), prefix, suffix, nao); } else { format(std_output, lit("data (~s):\n~s\n"), line, data, nao); } @@ -28,7 +28,7 @@ extern int opt_debugger; extern int debug_depth; extern val debug_block_s; -val debug(val form, val bindings, val data, val line, val chr); +val debug(val form, val bindings, val data, val line, val pos, val base); #if CONFIG_DEBUG_SUPPORT @@ -51,9 +51,10 @@ val debug(val form, val bindings, val data, val line, val chr); #define debug_return(VAL) \ uw_block_return(debug_block_s, VAL) -INLINE val debug_check(val form, val bindings, val data, val line, val chr) +INLINE val debug_check(val form, val bindings, val data, val line, + val pos, val base) { - return (opt_debugger) ? debug(form, bindings, data, line, chr) : nil; + return (opt_debugger) ? debug(form, bindings, data, line, pos, base) : nil; } void debug_init(void); @@ -361,7 +361,7 @@ static val do_eval(val form, val env, val ctx_form, debug_enter; type_check(env, ENV); - debug_check(consp(form) ? form : ctx_form, env, nil, nil, nil); + debug_check(consp(form) ? form : ctx_form, env, nil, nil, nil, nil); if (nullp(form)) { debug_return (nil); @@ -380,14 +380,14 @@ typedef val (*h_match_func)(match_line_ctx *c); #define LOG_MISMATCH(KIND) \ debuglf(elem, lit(KIND " mismatch, position ~a (~a:~a)"), \ - c->pos, c->file, c->data_lineno, nao); \ + plus(c->pos, c->base), c->file, c->data_lineno, nao); \ debuglf(elem, lit(" ~a"), c->dataline, nao); \ if (c_num(c->pos) < 77) \ debuglf(elem, lit(" ~*~a^"), c->pos, lit(""), nao) #define LOG_MATCH(KIND, EXTENT) \ debuglf(elem, lit(KIND " matched, position ~a-~a (~a:~a)"), \ - c->pos, EXTENT, c->file, c->data_lineno, nao); \ + plus(c->pos, c->base), EXTENT, c->file, c->data_lineno, nao); \ debuglf(elem, lit(" ~a"), c->dataline, nao); \ if (c_num(EXTENT) < 77) \ debuglf(elem, lit(" ~*~a~<*~a^"), c->pos, lit(""), \ @@ -1110,7 +1110,8 @@ static val do_match_line(match_line_ctx *c) elem = first(c->specline); - debug_check(elem, c->bindings, c->dataline, c->data_lineno, c->pos); + debug_check(elem, c->bindings, c->dataline, c->data_lineno, + c->pos, c->base); switch (elem ? type(elem) : 0) { case CONS: /* directive */ @@ -3437,7 +3438,8 @@ repeat_spec_same_data: { spec_bind (specline, first_spec, c.spec); - debug_check(first_spec, c.bindings, if2(consp(c.data), car(c.data)), c.data_lineno, nil); + debug_check(first_spec, c.bindings, if2(consp(c.data), car(c.data)), + c.data_lineno, nil, nil); if (consp(first_spec) && !rest(specline)) { val sym = first(first_spec); |