summaryrefslogtreecommitdiffstats
path: root/match.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2019-04-09 01:10:15 -0700
committerKaz Kylheku <kaz@kylheku.com>2019-04-09 01:10:15 -0700
commit3376e74aef0bd84a8dd3ef7c0c08a6a2d298dd7d (patch)
tree57050afdb62cf26ea305ab0d1055174bcd46c299 /match.c
parente2f97e2e063f7c9b93407d2af4e8b6f163bea2ac (diff)
downloadtxr-3376e74aef0bd84a8dd3ef7c0c08a6a2d298dd7d.tar.gz
txr-3376e74aef0bd84a8dd3ef7c0c08a6a2d298dd7d.tar.bz2
txr-3376e74aef0bd84a8dd3ef7c0c08a6a2d298dd7d.zip
debug support: crude debugger removed.
* debug.c (debug_depth, debug_quit_s): Variables removed. (step_mode, next_depth, breakpoints, last_command, cols): Static variables removed. (debug_check): C99 inline instantiation removed. (help, show_bindings): Static functions removed. (debug): Function removed. (debug_set_state): Now takes one int argument, returns int. It's anticipated that the new debug system will have a simple on-off switch; there won't be a debug_depth hack. (debug_restore_state): Function removed. (debug_init): Emptied. * debug.h (debug_depth, debug_state_t): Declarations removed. (debug_enter, debug_leave, debug_return): Macros removed. (debug_check): Inline function removed. (debug_set_state): Declaration updated. (debug_restore_state): Declaration removed. (debug_frame, debug_end): Macros removed. * eval.c (do_eval, me_interp_macro): Debugging support scrubbed. * lisplib.c (lisplib_try_load): Adapt to debug_set_state interface change. * match.c (h_fun, do_match_line, v_fun, match_files, match_fun): Debugging support scrubbed. * parser.y (parse_once): Adapt to debug_set_state interface change. * protsym.c: Regenerated. * signal.h (debug_depth): Declaration removed. (EJ_DBG_MEMB, EJ_DBG_SAVE, EJ_DBG_REST): Macros removed. (EJ_OPT_MEMB, EJ_OPT_SAVE, EJ_OPT_REST): Reduced to unconditionally empty definitions for future use. * unwind.c (uw_push_debug): Function removed. * unwind.h (uw_frtype_t): UW_DBG enum member removed. (struct uw_debug): struct declaration removed. (union uw_frame): db member removed. (uw_push_debug): Declaration removed. * txr.1: Debugger doc removed.
Diffstat (limited to 'match.c')
-rw-r--r--match.c52
1 files changed, 14 insertions, 38 deletions
diff --git a/match.c b/match.c
index b20366c5..26f26a01 100644
--- a/match.c
+++ b/match.c
@@ -1405,8 +1405,6 @@ static val h_fun(match_line_ctx *c)
args_decl_list(args, ARGS_MIN, bindings_cp);
uw_block_begin(nil, result);
uw_match_env_begin;
- debug_frame(sym, args, ub_p_a_pairs, c->bindings, c->dataline, c->data_lineno, c->pos);
-
uw_simple_catch_begin;
result = match_line(ml_bindings_specline(*c, bindings_cp, body));
@@ -1417,7 +1415,6 @@ static val h_fun(match_line_ctx *c)
uw_catch_end;
- debug_end;
uw_match_env_end;
uw_block_end;
@@ -1525,8 +1522,6 @@ static val do_match_line(match_line_ctx *c)
{
val lfe_save = set_last_form_evaled(nil);
- debug_enter;
-
while (c->specline) {
val elem = first(c->specline);
@@ -1537,9 +1532,6 @@ static val do_match_line(match_line_ctx *c)
consume_prefix(c);
- debug_check(c->specline, c->bindings, c->dataline, c->data_lineno,
- c->pos, c->base);
-
switch (type(elem)) {
case CONS: /* directive */
{
@@ -1551,7 +1543,7 @@ static val do_match_line(match_line_ctx *c)
if (!len) {
LOG_MISMATCH("string tree");
- debug_return (nil);
+ return nil;
}
newpos = plus(c->pos, len);
@@ -1568,7 +1560,7 @@ static val do_match_line(match_line_ctx *c)
} else if (result == repeat_spec_k) {
continue;
} else {
- debug_return (result);
+ return result;
}
} else {
val result = h_fun(c);
@@ -1597,10 +1589,10 @@ static val do_match_line(match_line_ctx *c)
sem_error(elem, lit("no such function or directive: ~a"),
directive, nao);
} else {
- debug_return (vresult);
+ return vresult;
}
} else {
- debug_return (result);
+ return result;
}
}
}
@@ -1613,7 +1605,7 @@ static val do_match_line(match_line_ctx *c)
val newpos;
if (!match_str(c->dataline, elem, c->pos)) {
LOG_MISMATCH("string");
- debug_return (nil);
+ return nil;
}
newpos = plus(c->pos, length_str(elem));
LOG_MATCH("string", newpos);
@@ -1625,7 +1617,7 @@ static val do_match_line(match_line_ctx *c)
val past = match_regex(c->dataline, elem, c->pos);
if (nilp(past)) {
LOG_MISMATCH("regex");
- debug_return (nil);
+ return nil;
}
LOG_MATCH("regex", past);
c->pos = past;
@@ -1639,8 +1631,7 @@ static val do_match_line(match_line_ctx *c)
c->specline = cdr(c->specline);
}
- debug_return (cons(c->bindings, plus(c->pos, c->base)));
- debug_leave;
+ return cons(c->bindings, plus(c->pos, c->base));
set_last_form_evaled(lfe_save);
}
@@ -4182,8 +4173,6 @@ static val v_fun(match_files_ctx *c)
args_decl_list(args, ARGS_MIN, bindings_cp);
uw_block_begin(nil, result);
uw_match_env_begin;
- debug_frame(sym, args, ub_p_a_pairs, c->bindings, if2(consp(c->data), car(c->data)),
- c->data_lineno, nil);
uw_simple_catch_begin;
@@ -4195,7 +4184,6 @@ static val v_fun(match_files_ctx *c)
uw_catch_end;
- debug_end;
uw_match_env_end;
uw_block_end;
@@ -4599,8 +4587,6 @@ static void open_data_source(match_files_ctx *c)
static val match_files(match_files_ctx c)
{
- debug_enter;
-
gc_hint(c.data);
for (; c.spec; c.spec = rest(c.spec),
@@ -4612,8 +4598,6 @@ repeat_spec_same_data:
open_data_source(&c);
- debug_check(specline, c.bindings, c.data, c.data_lineno, nil, nil);
-
/* Line with nothing but a single directive or call: vertical mode. */
if (consp(first_spec) && !rest(specline)) {
val lfe_save = set_last_form_evaled(first_spec);
@@ -4635,7 +4619,7 @@ repeat_spec_same_data:
} else if (result == decline_k) {
/* Vertical directive declined; go to horizontal processing */
} else {
- debug_return (result);
+ return result;
}
} else if (gethash(h_directive_table,sym)) {
/* Lone horizontal-only directive: go to horizontal processing */
@@ -4653,7 +4637,7 @@ repeat_spec_same_data:
since rest(specline) is nil, this is not horizontal fallback. */
sem_error(specline, lit("function ~s not found"), sym, nao);
} else {
- debug_return (result);
+ return result;
}
}
}
@@ -4670,20 +4654,18 @@ repeat_spec_same_data:
c.data, c.data_lineno, c.curfile)));
if (!success)
- debug_return (nil);
+ return nil;
c.bindings = new_bindings;
} else if (consp(c.data) || nilp(c.data)) {
debuglf(specline, lit("spec ran out of data"), nao);
- debug_return (nil);
+ return nil;
} else {
internal_error("bug in data stream opening logic");
}
}
- debug_return (cons(c.bindings, if3(c.data, cons(c.data, c.data_lineno), t)));
-
- debug_leave;
+ return cons(c.bindings, if3(c.data, cons(c.data, c.data_lineno), t));
}
val match_filter(val name, val arg, val other_args)
@@ -4737,21 +4719,15 @@ val match_fun(val name, val args, val input_in, val files_in)
match_files_ctx c = mf_all(spec, files, in_bindings, data, curfile);
val ret;
- debug_enter;
-
- debug_check(call, c.bindings, c.data, c.data_lineno, nil, nil);
-
ret = v_fun(&c);
if (ret == nil)
- debug_return (nil);
+ return nil;
if (ret == decline_k)
sem_error(nil, lit("match-fun: function ~s not found"), name, nao);
- debug_return (cons(c.bindings, if3(c.data, cons(c.data, c.data_lineno), t)));
-
- debug_leave;
+ return cons(c.bindings, if3(c.data, cons(c.data, c.data_lineno), t));
}
val include(val specline)