From 0d3fc60bfb0d85e4c79550caec0f65976a9692f4 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Thu, 2 Feb 2012 10:17:40 -0800 Subject: * match.c (format_field): Regression. Was not handling modifiers which are compound expression (e.g. computed field widths). This was broken by the first commit of 2012-01-26. --- ChangeLog | 6 ++++++ match.c | 40 +++++++++++++++++++--------------------- 2 files changed, 25 insertions(+), 21 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8077bd08..21fca013 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2012-02-02 Kaz Kylheku + + * match.c (format_field): Regression. Was not handling modifiers + which are compound expression (e.g. computed field widths). + This was broken by the first commit of 2012-01-26. + 2012-02-01 Kaz Kylheku * eval.c (lookup_sym_lisp1): New function. diff --git a/match.c b/match.c index c4ccfd8c..9e3aa488 100644 --- a/match.c +++ b/match.c @@ -1219,29 +1219,27 @@ val format_field(val obj, val modifier, val filter, val eval_fun) } else if (keywordp(item)) { plist = modifier; break; - } else if (consp(item)) { - if (car(item) == dwim_s) { - val arg_expr = second(item); + } else if (consp(item) && car(item) == dwim_s) { + val arg_expr = second(item); - if (consp(arg_expr) && car(arg_expr) == cons_s) { - val from = funcall1(eval_fun, second(arg_expr)); - val to = funcall1(eval_fun, third(arg_expr)); + if (consp(arg_expr) && car(arg_expr) == cons_s) { + val from = funcall1(eval_fun, second(arg_expr)); + val to = funcall1(eval_fun, third(arg_expr)); - obj = if3((vectorp(obj)), - sub_vec(obj, from, to), - sub_list(obj, from, to)); - } else { - val arg = funcall1(eval_fun, arg_expr); - if (bignump(arg) || fixnump(arg)) { - if (vectorp(obj)) - obj = vecref(obj, arg); - else - obj = listref(obj, arg); - } else { - uw_throwf(query_error_s, lit("format_field: bad index: ~s"), - arg, nao); - } - } + obj = if3((vectorp(obj)), + sub_vec(obj, from, to), + sub_list(obj, from, to)); + } else { + val arg = funcall1(eval_fun, arg_expr); + if (bignump(arg) || fixnump(arg)) { + if (vectorp(obj)) + obj = vecref(obj, arg); + else + obj = listref(obj, arg); + } else { + uw_throwf(query_error_s, lit("format_field: bad index: ~s"), + arg, nao); + } } } else { val v = funcall1(eval_fun, item); -- cgit v1.2.3