diff options
-rw-r--r-- | ChangeLog | 21 | ||||
-rw-r--r-- | debug.c | 1 | ||||
-rw-r--r-- | eval.c | 2 | ||||
-rw-r--r-- | lib.c | 3 | ||||
-rw-r--r-- | lib.h | 4 | ||||
-rw-r--r-- | match.c | 4 | ||||
-rw-r--r-- | parser.y | 2 | ||||
-rw-r--r-- | stream.c | 1 |
8 files changed, 37 insertions, 1 deletions
@@ -1,5 +1,26 @@ 2011-11-30 Kaz Kylheku <kaz@kylheku.com> + * lib.h (or2): Restore macro version of or2, because we need + the sequencing! Making it an inline function broke the tests. + But we can't have multiple evaluation either, so it's going to use + a temporary lexical variable. + (uses_or2): Macro which declares the lexical variable needed by or2. + + * debug.c (debug): add uses_or2. + + * eval.c (eval_intrinsic, op_modplace): Likewise. + + * lib.c (lazy_str, lazy_str_force_upto, lazy_str_get_trailing_list): + Likewise. + + * match.c (h_parallel, v_freeform, v_parallel, v_output): Likewise. + + * parser.y (unquotes_occur): Likewise. + + * stream.c (format): Likewise. + +2011-11-30 Kaz Kylheku <kaz@kylheku.com> + Removing useless hash table. * parser.h (ln_to_forms_hash): Declaration removed. @@ -34,6 +34,7 @@ val debug(val form, val bindings, val data, val line, val chr) val print_data = t; for (;;) { + uses_or2; val input, command; if (print_form) { @@ -281,6 +281,7 @@ val interp_fun(val env, val fun, val args) static val eval_intrinsic(val form, val env) { + uses_or2; expand(form); return eval(form, or2(env, make_env(nil, nil, env)), form); } @@ -507,6 +508,7 @@ static val op_defun(val form, val env) static val op_modplace(val form, val env) { + uses_or2; val op = first(form); val place = second(form); val third_arg_p = rest(rest(form)); @@ -2300,6 +2300,7 @@ val lazy_stream_cons(val stream) val lazy_str(val lst, val term, val limit) { + uses_or2; val obj = make_obj(); obj->ls.type = LSTR; @@ -2344,6 +2345,7 @@ val lazy_str_force(val lstr) val lazy_str_force_upto(val lstr, val index) { + uses_or2; val lim; type_check(lstr, LSTR); lim = cdr(lstr->ls.opts); @@ -2460,6 +2462,7 @@ val lazy_str_get_trailing_list(val lstr, val index) lazy_str_force_upto(lstr, index); { + uses_or2; val split_suffix = split_str(sub_str(lstr->ls.prefix, index, nil), or2(car(lstr->ls.opts), string(L"\n"))); @@ -507,7 +507,9 @@ INLINE val eq(val a, val b) { return ((a) == (b) ? t : nil); } #define if3(a, b, c) ((a) ? (b) : (c)) -INLINE val or2(val a, val b) { return a ? a : b; } +#define uses_or2 val or2_temp + +#define or2(a, b) ((or2_temp = (a)) ? or2_temp : (b)) #define or3(a, b, c) or2(a, or2(b, c)) @@ -850,6 +850,7 @@ next_coll: static val h_parallel(match_line_ctx c, match_line_ctx *cout) { + uses_or2; elem_bind(elem, directive, c.specline); val specs = third(elem); val plist = fourth(elem); @@ -1806,6 +1807,7 @@ static val v_freeform(match_files_ctx *c) debuglf(specline, lit("freeform match failure: no data"), nao); return nil; } else { + uses_or2; val limit = or2(if2(nump(first(vals)), first(vals)), if2(nump(second(vals)), second(vals))); val term = or2(if2(stringp(first(vals)), first(vals)), @@ -2035,6 +2037,7 @@ static val v_parallel(match_files_ctx *c) if (second(first_spec) == t) { return decline_k; } else { + uses_or2; val sym = first(first_spec); val all_match = t; val some_match = nil; @@ -2641,6 +2644,7 @@ static val v_output(match_files_ctx *c) if (rest(dest_spec)) sem_error(specline, lit("material after :nothrow in output"), nao); } else if (!keywordp(first(dest_spec))) { + uses_or2; val form = first(dest_spec); val val = eval_form(specline, form, c->bindings); dest = or2(cdr(val), dest); @@ -887,6 +887,8 @@ static val optimize_text(val text_form) static val unquotes_occur(val quoted_form) { + uses_or2; + if (atom(quoted_form)) { return nil; } else { @@ -1018,6 +1018,7 @@ val vformat_to_string(val fmtstr, va_list vl) val format(val stream, val str, ...) { + uses_or2; val st = if3(stream == t, std_output, or2(stream, make_string_output_stream())); |