From 10bbad5126477bbf9e46a37d4c323f87f8273dbb Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Wed, 15 May 2013 01:45:19 -0700 Subject: * match.c (match_fun): Support debug stop on the function prior to the call. The first data line number is 1, not zero, if there is data. * txr.1: Added usage example for match-fun. --- match.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'match.c') diff --git a/match.c b/match.c index e1d74399..410bd05a 100644 --- a/match.c +++ b/match.c @@ -3698,14 +3698,23 @@ val match_filter(val name, val arg, val other_args) val match_fun(val name, val args, val input, val files) { - val spec = cons(cons(cons(name, args), nil), nil); + val call = cons(name, args); + val spec = cons(cons(call, nil), nil); val in_bindings = cdr(uw_get_match_context()); val data = if3(streamp(input), lazy_stream_cons(input), input); /* TODO: pass through source location context */ - match_files_ctx c = mf_all(spec, files, in_bindings, data, num(0)); - val ret = v_fun(&c); + match_files_ctx c = mf_all(spec, files, in_bindings, data, + if3(data, one, zero)); + val ret; + + debug_enter; + + debug_check(call, c.bindings, if2(consp(c.data), car(c.data)), + c.data_lineno, nil, nil); + + ret = v_fun(&c); if (ret == nil) return nil; @@ -3713,7 +3722,9 @@ val match_fun(val name, val args, val input, val files) if (ret == decline_k) sem_error(nil, lit("match_fun: function ~s not found"), name, nao); - return cons(c.bindings, cons(c.data, c.data_lineno)); + debug_return (cons(c.bindings, if3(c.data, cons(c.data, c.data_lineno), t))); + + debug_leave; } int extract(val spec, val files, val predefined_bindings) -- cgit v1.2.3