From 109bf0e24f4b44698e7641fa9b3348b8a642940f Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Wed, 9 Nov 2011 22:53:50 -0800 Subject: Task #11583 @(bind) in horizontal mode. * match.c (mf_from_ml, h_bind): New functions. (dir_tables_init): h_bind entered into table. --- ChangeLog | 9 +++++++++ match.c | 19 +++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/ChangeLog b/ChangeLog index a7453262..4b9fe3f6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2011-11-09 Kaz Kylheku + + Task #11583 + + @(bind) in horizontal mode. + + * match.c (mf_from_ml, h_bind): New functions. + (dir_tables_init): h_bind entered into table. + 2011-11-09 Kaz Kylheku * match.c (h_fun, v_fun): Slightly more informative tracing from failed diff --git a/match.c b/match.c index 3e8a4375..896380af 100644 --- a/match.c +++ b/match.c @@ -1550,6 +1550,12 @@ static match_files_ctx mf_file_data(match_files_ctx c, val file, return nc; } +static match_files_ctx mf_from_ml(match_line_ctx ml) +{ + return mf_all(cons(cons(ml.spec_lineno, ml.specline), nil), + nil, ml.bindings, nil, num(0)); +} + static val match_files(match_files_ctx a); typedef val (*v_match_func)(match_files_ctx *cout); @@ -2417,6 +2423,18 @@ static val v_bind(match_files_ctx *c) return next_spec_k; } +static val h_bind(match_line_ctx c, match_line_ctx *cout) +{ + val ret; + match_files_ctx mf = mf_from_ml(c); + ret = v_bind(&mf); + if (ret == next_spec_k) { + c.bindings = mf.bindings; + *cout = c; + } + return ret; +} + static val v_set(match_files_ctx *c) { spec_bind (specline, spec_linenum, first_spec, c->spec); @@ -3145,6 +3163,7 @@ static void dir_tables_init(void) sethash(h_directive_table, var_s, cptr((mem_t *) h_var)); sethash(h_directive_table, skip_s, cptr((mem_t *) h_skip)); sethash(h_directive_table, coll_s, cptr((mem_t *) h_coll)); + sethash(h_directive_table, bind_s, cptr((mem_t *) h_bind)); sethash(h_directive_table, some_s, cptr((mem_t *) h_parallel)); sethash(h_directive_table, all_s, cptr((mem_t *) h_parallel)); sethash(h_directive_table, none_s, cptr((mem_t *) h_parallel)); -- cgit v1.2.3