diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2013-05-15 01:45:19 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2013-05-15 01:45:19 -0700 |
commit | 10bbad5126477bbf9e46a37d4c323f87f8273dbb (patch) | |
tree | 1487c42b25d726c48a61196ab73b3fc66f6ac5d7 /match.c | |
parent | b72c239bae5b34c66fcd5beb24c8c7b706420c34 (diff) | |
download | txr-10bbad5126477bbf9e46a37d4c323f87f8273dbb.tar.gz txr-10bbad5126477bbf9e46a37d4c323f87f8273dbb.tar.bz2 txr-10bbad5126477bbf9e46a37d4c323f87f8273dbb.zip |
* 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.
Diffstat (limited to 'match.c')
-rw-r--r-- | match.c | 19 |
1 files changed, 15 insertions, 4 deletions
@@ -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) |