summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--match.c40
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 <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.
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);