diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | match.c | 40 |
2 files changed, 25 insertions, 21 deletions
@@ -1,3 +1,9 @@ +2012-02-02 Kaz Kylheku <kaz@kylheku.com> + + * 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 <kaz@kylheku.com> * eval.c (lookup_sym_lisp1): New function. @@ -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); |