From a2b16d316cf9201fa27d35766f5f245c2c9a6b26 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Thu, 26 Jan 2012 14:15:53 -0800 Subject: * match.c (format_field): Removed useless use of cat_str (no longer needed because str is already a string). The purpose was to reduce character to strings. (subst_vars): Some of the new logic in format_field must be replicated in the case when format_field is not called because the variable has no modifiers. Lists must be converted to a space-separated string. Bugfix here: occurence of pat and modifiers is not mutually exclusive. --- ChangeLog | 10 ++++++++++ match.c | 17 ++++++++++++----- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index ee0d422e..fc73e42d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2012-01-26 Kaz Kylheku + + * match.c (format_field): Removed useless use of cat_str (no longer + needed because str is already a string). The purpose was to reduce + character to strings. + (subst_vars): Some of the new logic in format_field must be replicated + in the case when format_field is not called because the variable + has no modifiers. Lists must be converted to a space-separated string. + Bugfix here: occurence of pat and modifiers is not mutually exclusive. + 2012-01-26 Kaz Kylheku * eval.c (dwim_loc, dwim_op): Eliminated redundant re-evaluation diff --git a/match.c b/match.c index eb6e347e..c4ccfd8c 100644 --- a/match.c +++ b/match.c @@ -1273,8 +1273,7 @@ val format_field(val obj, val modifier, val filter, val eval_fun) } if (filter) - str = filter_string(filter, cat_str(list(str, nao), - nil)); + str = filter_string(filter, str); } { @@ -1321,13 +1320,21 @@ static val subst_vars(val spec, val bindings, val filter) str = format(nil, lit("~a"), str, nao); if (pat) - spec = cons(filter_string(filter, str), cons(pat, rest(spec))); - else if (modifiers) + spec = cons(pat, rest(spec)); + + if (modifiers) { spec = cons(format_field(str, modifiers, filter, curry_123_2(func_n3(txeval), spec, bindings)), rest(spec)); - else + } else { + if (listp(str)) + str = cat_str(mapcar(func_n1(tostringp), str), lit(" ")); + else + str = if3(stringp(str), str, tostringp(str)); + spec = cons(filter_string(filter, str), rest(spec)); + } + continue; } uw_throwf(query_error_s, lit("unbound variable ~a"), -- cgit v1.2.3