diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2014-10-24 08:41:09 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2014-10-24 08:41:09 -0700 |
commit | 57276037c1357e54730a94fb1191362d4f694252 (patch) | |
tree | f933609cb8870c42478a71a2c3f3b416c93d57aa | |
parent | 43418aad5d8214c1b60b080dff2c36a2caf27391 (diff) | |
download | txr-57276037c1357e54730a94fb1191362d4f694252.tar.gz txr-57276037c1357e54730a94fb1191362d4f694252.tar.bz2 txr-57276037c1357e54730a94fb1191362d4f694252.zip |
* Makefile: Removing trailing spaces.
(GREP_CHECK): New macro.
(enforce): Rewritten using GREP_CHECK, with new checks.
* arith.c, combi.c, debug.c, eval.c, filter.c, gc.c, hash.c, lib.c,
* lib.h, match.c, parser.l, parser.y, rand.c, regex.c, signal.c,
* signal.h, stream.c, syslog.c, txr.c, unwind.c, utf8.c: Remove
trailing spaces.
-rw-r--r-- | ChangeLog | 11 | ||||
-rw-r--r-- | Makefile | 25 | ||||
-rw-r--r-- | arith.c | 22 | ||||
-rw-r--r-- | combi.c | 4 | ||||
-rw-r--r-- | debug.c | 4 | ||||
-rw-r--r-- | eval.c | 79 | ||||
-rw-r--r-- | filter.c | 4 | ||||
-rw-r--r-- | gc.c | 2 | ||||
-rw-r--r-- | hash.c | 10 | ||||
-rw-r--r-- | lib.c | 30 | ||||
-rw-r--r-- | lib.h | 2 | ||||
-rw-r--r-- | match.c | 82 | ||||
-rw-r--r-- | parser.l | 4 | ||||
-rw-r--r-- | parser.y | 46 | ||||
-rw-r--r-- | rand.c | 6 | ||||
-rw-r--r-- | regex.c | 32 | ||||
-rw-r--r-- | signal.c | 2 | ||||
-rw-r--r-- | signal.h | 2 | ||||
-rw-r--r-- | stream.c | 30 | ||||
-rw-r--r-- | syslog.c | 2 | ||||
-rw-r--r-- | txr.c | 2 | ||||
-rw-r--r-- | unwind.c | 1 | ||||
-rw-r--r-- | utf8.c | 2 |
23 files changed, 210 insertions, 194 deletions
@@ -1,3 +1,14 @@ +2014-10-24 Kaz Kylheku <kaz@kylheku.com> + + * Makefile: Removing trailing spaces. + (GREP_CHECK): New macro. + (enforce): Rewritten using GREP_CHECK, with new checks. + + * arith.c, combi.c, debug.c, eval.c, filter.c, gc.c, hash.c, lib.c, + * lib.h, match.c, parser.l, parser.y, rand.c, regex.c, signal.c, + * signal.h, stream.c, syslog.c, txr.c, unwind.c, utf8.c: Remove + trailing spaces. + 2014-10-22 Kaz Kylheku <kaz@kylheku.com> * eval.c (eval_init): Fix incorrect, registration of @@ -137,7 +137,7 @@ tests/010/reghash.ok: TXR_OPTS := -B tests/002/%: TXR_SCRIPT_ON_CMDLINE := y -tests/011/%: TXR_DBG_OPTS := +tests/011/%: TXR_DBG_OPTS := %.ok: %.txr mkdir -p $(dir $@) @@ -150,14 +150,21 @@ tests/011/%: TXR_DBG_OPTS := %.expected: %.txr ./$(PROG) $(TXR_OPTS) $^ $(TXR_ARGS) > $@ -.PHONY: enforce -enforce: - @if [ $$(grep -E '\<void[\t ]*\*' $(SRCS) | wc -l) -ne 1 ] ; then \ - echo "New 'void *' occurrences have been found:" ; \ - grep -n -E '\<void[\t ]*\*' $(SRCS) \ - | grep -v -F 'typedef void *yyscan_t' ; \ +define GREP_CHECK + @if [ $$(grep -E $(1) $(SRCS) | wc -l) -ne $(3) ] ; then \ + echo "New '$(2)' occurrences have been found:" ; \ + grep -n -E $(1) $(SRCS) \ + | sed -e 's/\(.*:.*:\).*/\1 $(2)/' \ + | grep $(4) ; \ exit 1 ; \ fi +endef + +.PHONY: enforce +enforce: + $(call GREP_CHECK,'\<void[ ]*\*',void *,1,-v 'typedef void \*yyscan_t') + $(call GREP_CHECK,' ',tabs,0,'.') + $(call GREP_CHECK,' $$',trailing spaces,0,'.') # # Installation macro. @@ -203,7 +210,7 @@ zip: install # # Install the tests as well as the script to run them -# +# install-tests: mkdir -p $(DESTDIR)$(datadir) (cd $(top_srcdir) ; \ @@ -218,7 +225,7 @@ install-tests: # # Generate web page from man page -# +# txr-manpage.html: txr.1 genman.txr man2html $< | ./$(PROG) genman.txr - > $@ @@ -287,7 +287,7 @@ val plus(val anum, val bnum) { tail: switch (TAG_PAIR(tag(anum), tag(bnum))) { - case TAG_PAIR(TAG_NUM, TAG_NUM): + case TAG_PAIR(TAG_NUM, TAG_NUM): { cnum a = c_num(anum); cnum b = c_num(bnum); @@ -296,7 +296,7 @@ tail: if (sum < NUM_MIN || sum > NUM_MAX) return bignum(sum); return num_fast(sum); - } + } case TAG_PAIR(TAG_NUM, TAG_PTR): switch (type(bnum)) { case BGNUM: @@ -403,7 +403,7 @@ tail: } uw_throwf(error_s, lit("+: invalid operands ~s ~s"), anum, bnum, nao); char_range: - uw_throwf(numeric_error_s, + uw_throwf(numeric_error_s, lit("+: sum of ~s and ~s is out of character range"), anum, bnum, nao); } @@ -412,8 +412,8 @@ val minus(val anum, val bnum) { tail: switch (TAG_PAIR(tag(anum), tag(bnum))) { - case TAG_PAIR(TAG_NUM, TAG_NUM): - case TAG_PAIR(TAG_CHR, TAG_CHR): + case TAG_PAIR(TAG_NUM, TAG_NUM): + case TAG_PAIR(TAG_CHR, TAG_CHR): { cnum a = c_num(anum); cnum b = c_num(bnum); @@ -422,7 +422,7 @@ tail: if (sum < NUM_MIN || sum > NUM_MAX) return bignum(sum); return num_fast(sum); - } + } case TAG_PAIR(TAG_NUM, TAG_PTR): switch (type(bnum)) { case BGNUM: @@ -514,7 +514,7 @@ tail: cnum sum = a - b; if (sum < 0 || sum > 0x10FFFF) - uw_throwf(numeric_error_s, + uw_throwf(numeric_error_s, lit("-: difference of ~s and ~s is out of character range"), anum, bnum, nao); return chr(sum); @@ -566,7 +566,7 @@ val mul(val anum, val bnum) { tail: switch (TAG_PAIR(tag(anum), tag(bnum))) { - case TAG_PAIR(TAG_NUM, TAG_NUM): + case TAG_PAIR(TAG_NUM, TAG_NUM): { cnum a = c_num(anum); cnum b = c_num(bnum); @@ -706,7 +706,7 @@ tail: double x = c_num(anum), y = c_flo(bnum); if (y == 0.0) goto divzero; - else + else return flo((x - fmod(x, y))/y); } default: @@ -745,7 +745,7 @@ tail: double x = c_flo(anum), y = c_num(bnum); if (y == 0.0) goto divzero; - else + else return flo((x - fmod(x, y))/y); } default: @@ -767,7 +767,7 @@ tail: double x = c_flo(anum), y = c_flo(bnum); if (y == 0.0) goto divzero; - else + else return flo((x - fmod(x, y))/y); } case TYPE_PAIR(BGNUM, FLNUM): @@ -42,7 +42,7 @@ static val perm_while_fun(val state) cnum k = c_num(vecref(state, one)); val c = vecref(state, two); cnum n = c_num(length(p)); - cnum i, j; + cnum i, j; for (i = k - 1, j = n - k + 1; i >= 0; i--, j++) { cnum ci = c_num(c->v.vec[i]) + 1; @@ -84,7 +84,7 @@ static void perm_gen_fun_common(val state, val out, val nn = length(p); val b = vector(nn, nil); cnum k = c_num(kk); - cnum i; + cnum i; for (i = 0; i < k; i++) { cnum ci = c_num(c->v.vec[i]); @@ -104,7 +104,7 @@ val debug(val form, val bindings, val data, val line, val pos, val base) else if (data == t) data = nil; - if (!step_mode && !memqual(rl, breakpoints) + if (!step_mode && !memqual(rl, breakpoints) && (debug_depth > next_depth)) { return nil; @@ -155,7 +155,7 @@ val debug(val form, val bindings, val data, val line, val pos, val base) flush_stream(std_debug); input = split_str_set(or2(get_line(std_input), lit("q")), lit("\t ")); - command = if3(equal(first(input), null_string), + command = if3(equal(first(input), null_string), or2(last_command, lit("")), first(input)); last_command = command; @@ -169,8 +169,8 @@ val lookup_var(val env, val sym) val binding = assoc(sym, env->e.vbindings); if (binding) return binding; - } - + } + return(gethash(top_vb, sym)); } @@ -194,7 +194,7 @@ static val lookup_sym_lisp1(val env, val sym) assoc(sym, env->e.fbindings)); if (binding) return binding; - } + } return or2(gethash(top_vb, sym), gethash(top_fb, sym)); } @@ -330,7 +330,7 @@ static val bind_args(val env, val params, val args, val ctx_form) eval_error(ctx_form, lit("~s: ~s is not a bindable symbol"), car(ctx_form), param, nao); - if (presentsym && !bindable(presentsym)) + if (presentsym && !bindable(presentsym)) eval_error(ctx_form, lit("~s: ~s is not a bindable symbol"), car(ctx_form), presentsym, nao); @@ -343,7 +343,7 @@ static val bind_args(val env, val params, val args, val ctx_form) if (initform) { initval = eval(initform, new_env, ctx_form); new_env = make_env(nil, nil, new_env); - } + } } else { initval = arg; present = t; @@ -385,7 +385,7 @@ static val bind_args(val env, val params, val args, val ctx_form) new_env = make_env(nil, nil, new_env); env_vbind_special(new_env, sym, initval, special_list, ctx_form); if (presentsym) { - if (!bindable(presentsym)) + if (!bindable(presentsym)) eval_error(ctx_form, lit("~s: ~s is not a bindable symbol"), car(ctx_form), presentsym, nao); env_vbind_special(new_env, presentsym, nil, special_list, ctx_form); @@ -437,7 +437,7 @@ static val expand_opt_params_rec(val params, val menv, val *pspecials) return rlcp(cons(form_ex, expand_opt_params_rec(rest(params), menv, pspecials)), cdr(params)); - } + } } } @@ -495,7 +495,7 @@ static val get_opt_param_syms(val params) } else { /* has initform */ val sym = car(form); return cons(sym, get_opt_param_syms(cdr(params))); - } + } } } @@ -742,15 +742,15 @@ static val bind_macro_params(val env, val menv, val params, val form, specials, ctx_form); params = cdr(next); continue; - } - + } + if (param == colon_k) { if (optargs) goto twocol; optargs = t; params = cdr(params); continue; - } + } if (consp(form)) { if (car(form) == colon_k) { @@ -1142,8 +1142,8 @@ static val op_each(val form, val env) for (;;) { val biter, liter; - - for (biter = new_bindings, liter = lists; biter; + + for (biter = new_bindings, liter = lists; biter; biter = cdr(biter), liter = cdr(liter)) { val binding = car(biter); @@ -1153,7 +1153,7 @@ static val op_each(val form, val env) rplacd(binding, car(list)); rplaca(liter, cdr(list)); } - + { val res = eval_progn(body, new_env, form); if (collect) @@ -1310,7 +1310,7 @@ static val op_defun(val form, val env) if (iter && !bindable(iter)) eval_error(form, lit("defun: dot parameter ~s is not a bindable symbol"), iter, nao); - + /* defun captures lexical environment, so env is passed */ sethash(top_fb, name, cons(name, func_interp(env, fun))); return name; @@ -1667,14 +1667,14 @@ static loc dwim_loc(val form, val env, val op, val newform, val *retval) if (op == set_s) { val newval = eval(newform, env, form); newlist = replace_list(obj, newval, from, to); - tempform = list(op, second(form), + tempform = list(op, second(form), cons(quote_s, cons(newlist, nil)), nao); op_modplace(tempform, env); *retval = newval; } else if (op == del_s) { *retval = sub_list(obj, from, to); newlist = replace_list(obj, nil, from, to); - tempform = list(op, second(form), + tempform = list(op, second(form), cons(quote_s, cons(newlist, nil)), nao); op_modplace(tempform, env); } else { @@ -2190,7 +2190,7 @@ static val expand_qquote(val qquoted_form, val menv, } else if (sym == qq) { return rlcp(expand_qquote(expand_qquote(second(qquoted_form), menv, qq, unq, spl), - menv, qq, unq, spl), + menv, qq, unq, spl), qquoted_form); } else if (sym == hash_lit_s) { val args = expand_qquote(second(qquoted_form), menv, qq, unq, spl); @@ -2248,7 +2248,6 @@ static val me_qquote(val form, val menv) sys_qquote_s, sys_unquote_s, sys_splice_s); return expand_qquote(second(form), menv, qquote_s, unquote_s, splice_s); - } static val expand_vars(val vars, val menv, val form, @@ -2385,7 +2384,7 @@ static val meta_meta_strip(val args) { uses_or2; val strip = cdr(args); - return if3(or2(integerp(car(strip)), eq(car(strip), rest_s)), + return if3(or2(integerp(car(strip)), eq(car(strip), rest_s)), cons(var_s, strip), cons(expr_s, strip)); } @@ -2404,7 +2403,7 @@ static val transform_op(val forms, val syms, val rg) /* This handles improper list forms like (a b c . @42) when the recursion hits the @42 part. */ if (fi == var_s && integerp(car(re))) { - cons_bind (outsyms, outforms, transform_op(cons(forms, nil), syms, rg)); + cons_bind (outsyms, outforms, transform_op(cons(forms, nil), syms, rg)); return cons(outsyms, rlcp(car(outforms), outforms)); } @@ -2418,17 +2417,17 @@ static val transform_op(val forms, val syms, val rg) val sym = cdr(if3(new_p, rplacd(cell, gensym(format_op_arg(vararg))), cell)); - cons_bind (outsyms, outforms, transform_op(re, newsyms, rg)); + cons_bind (outsyms, outforms, transform_op(re, newsyms, rg)); return cons(outsyms, rlcp(cons(sym, outforms), outforms)); } else if (vararg == rest_s) { - cons_bind (outsyms, outforms, transform_op(re, syms, rg)); + cons_bind (outsyms, outforms, transform_op(re, syms, rg)); return cons(outsyms, rlcp(cons(rg, outforms), outforms)); } } { - cons_bind (fisyms, fiform, transform_op(fi, syms, rg)); - cons_bind (resyms, reforms, transform_op(re, fisyms, rg)); + cons_bind (fisyms, fiform, transform_op(fi, syms, rg)); + cons_bind (resyms, reforms, transform_op(re, fisyms, rg)); return cons(resyms, rlcp(cons(fiform, reforms), fiform)); } } @@ -2487,8 +2486,8 @@ static val me_op(val form, val menv) { uses_or2; - val dwim_body = rlcp_tree(cons(dwim_s, - if3(or4(is_op, has_rest, ssyms, + val dwim_body = rlcp_tree(cons(dwim_s, + if3(or4(is_op, has_rest, ssyms, null(proper_listp(body_trans))), body_trans, append2(body_trans, rest_gensym))), @@ -2583,7 +2582,7 @@ static val me_case(val form, val menv) ptail = list_collect(ptail, cons(list(if3(atom(keys), eqfuncsym, memfuncsym), - tformsym, + tformsym, if3(atom(keys), keys, list(quote_s, keys, nao)), nao), forms)); @@ -2616,12 +2615,12 @@ static val expand_catch(val body, val menv) val catch_syms = mapcar(car_f, catch_clauses); val try_form_ex = expand(try_form, menv); val catch_clauses_ex = rlcp(mapcar(curry_12_1(func_n2(expand_catch_clause), - menv), + menv), catch_clauses), catch_clauses); - val expanded = cons(catch_s, - cons(catch_syms, + val expanded = cons(catch_s, + cons(catch_syms, cons(try_form_ex, catch_clauses_ex))); return rlcp(expanded, body); } @@ -2776,12 +2775,12 @@ tail: val incs_ex = expand_forms(incs, new_menv); val forms_ex = expand_forms(forms, new_menv); - if (vars == vars_ex && cond == cond_ex && + if (vars == vars_ex && cond == cond_ex && incs == incs_ex && forms == forms_ex && !specials_p) { return form; } else { - val basic_form = rlcp(cons(sym, - cons(vars_ex, + val basic_form = rlcp(cons(sym, + cons(vars_ex, cons(cond_ex, cons(incs_ex, forms_ex)))), form); return expand_save_specials(basic_form, specials_p); @@ -2796,12 +2795,12 @@ tail: val hashform_ex = expand(hashform, menv); val resform_ex = expand(resform, menv); val body_ex = expand_forms(body, menv); - + if (hashform == hashform_ex && resform == resform_ex && body == body_ex) return form; - return cons(sym, cons(cons(keysym, - cons(valsym, - cons(hashform_ex, + return cons(sym, cons(cons(keysym, + cons(valsym, + cons(hashform_ex, cons(resform_ex, nil)))), body_ex)); } else if (sym == quasi_s) { @@ -2829,7 +2828,7 @@ tail: goto tail; } else { /* funtion call - also handles: progn, prog1, call, if, and, or, + also handles: progn, prog1, call, if, and, or, unwind-protect, return, dwim, set, inc, dec, push, pop, flip, and with-saved-vars. */ val args = rest(form); @@ -2847,7 +2846,7 @@ static val macro_form_p(val form, val menv) { menv = default_bool_arg(menv); - if (bindable(form) && lookup_symac(menv, form)) + if (bindable(form) && lookup_symac(menv, form)) return t; if (consp(form) && lookup_mac(menv, car(form))) return t; @@ -72,7 +72,7 @@ static val trie_add(val trie, val key, val value) return node; } -/* +/* * Reduce the storage requirement for a the trie, by applying * these rules: * @@ -245,7 +245,7 @@ static val trie_filter_string(val filter, val str) val filter_string_tree(val filter, val obj) { switch (type(obj)) { - case NIL: + case NIL: return nil; case CONS: return mapcar(curry_12_2(func_n2(filter_string_tree), filter), obj); @@ -726,7 +726,7 @@ void dheap(heap_t *heap, int start, int end) * from caching the value across function calls. * This is needed for situations where * - a compiler caches a variable in a register, but not entirely (the variable - * has a backing memory location); and + * has a backing memory location); and * - that location contains a stale old value of the variable, which cannot be * garbage-collected as a result; and * - this causes a problem, like unbounded memory growth. @@ -269,7 +269,7 @@ static val hash_equal_op(val left, val right) * If it is found, and the associated datum is equal, then remove it from * the list. If it is found and the data is not equal, then we have found * a difference between the hash tables, and conclude they are different. - * If there is no match, then we insert the cell into the pending list. + * If there is no match, then we insert the cell into the pending list. */ found = l->assoc_fun(car(lcell), pending); @@ -986,14 +986,14 @@ val hash_uni(val hash1, val hash2, val join_func) val hout = make_similar_hash(hash1); val hiter, entry; - for (hiter = hash_begin(hash2), entry = hash_next(hiter); + for (hiter = hash_begin(hash2), entry = hash_next(hiter); entry; entry = hash_next(hiter)) { sethash(hout, car(entry), cdr(entry)); } - for (hiter = hash_begin(hash1), entry = hash_next(hiter); + for (hiter = hash_begin(hash1), entry = hash_next(hiter); entry; entry = hash_next(hiter)) { @@ -1021,7 +1021,7 @@ val hash_diff(val hash1, val hash2) val hout = copy_hash(hash1); val hiter, entry; - for (hiter = hash_begin(hash2), entry = hash_next(hiter); + for (hiter = hash_begin(hash2), entry = hash_next(hiter); entry; entry = hash_next(hiter)) { @@ -1044,7 +1044,7 @@ val hash_isec(val hash1, val hash2, val join_func) val hout = make_similar_hash(hash1); val hiter, entry; - for (hiter = hash_begin(hash1), entry = hash_next(hiter); + for (hiter = hash_begin(hash1), entry = hash_next(hiter); entry; entry = hash_next(hiter)) { @@ -210,7 +210,7 @@ val type_check3(val obj, int t1, int t2, int t3) val class_check(val cobj, val class_sym) { type_assert (is_ptr(cobj) && cobj->t.type == COBJ && - cobj->co.cls == class_sym, + cobj->co.cls == class_sym, (lit("~a is not of type ~a"), cobj, class_sym, nao)); return t; } @@ -1166,7 +1166,7 @@ val tree_find(val obj, val tree, val testfun) if (funcall2(default_arg(testfun, equal_f), obj, tree)) return t; else if (consp(tree)) - return some_satisfy(tree, curry_123_2(func_n3(tree_find), + return some_satisfy(tree, curry_123_2(func_n3(tree_find), obj, testfun), nil); return nil; } @@ -1299,7 +1299,7 @@ val flatten(val list) */ static val lazy_flatten_scan(val list, val *escape) { - for (;;) { + for (;;) { if (list) { val a = car(list); if (nilp(a)) { @@ -2308,8 +2308,8 @@ val string_extend(val str, val tail) val stringp(val str) { switch (type(str)) { - case LIT: - case STR: + case LIT: + case STR: case LSTR: return t; default: @@ -2532,7 +2532,7 @@ static val lazy_sub_str(val lstr, val from, val to) { val pfxsub = sub_str(lstr->ls.prefix, from, to); - + if (to != t) { return pfxsub; } else { @@ -2641,7 +2641,7 @@ val replace_str(val str_in, val items, val from, val to) cnum t = c_num(to); cnum l = c_num(len); - wmemmove(str_in->st.str + t - c_num(len_diff), + wmemmove(str_in->st.str + t - c_num(len_diff), str_in->st.str + t, (l - t) + 1); set(mkloc(str_in->st.len, str_in), minus(len, len_diff)); to = plus(from, len_it); @@ -2655,7 +2655,7 @@ val replace_str(val str_in, val items, val from, val to) str_in->st.str + t, (l - t) + 1); to = plus(from, len_it); } - + if (zerop(len_it)) return str_in; if (stringp(itseq)) { @@ -4717,7 +4717,7 @@ val size_vec(val vec) val vector_list(val list) { val vec = vector(zero, nil); - + if (!listp(list)) uw_throwf(error_s, lit("vector-list: list expected, not ~s"), list, nao); @@ -4850,7 +4850,7 @@ val replace_vec(val vec_in, val items, val from, val to) cnum t = c_num(to); cnum l = c_num(len); - memmove(vec_in->v.vec + t - c_num(len_diff), + memmove(vec_in->v.vec + t - c_num(len_diff), vec_in->v.vec + t, (l - t) * sizeof vec_in->v.vec); @@ -4863,16 +4863,16 @@ val replace_vec(val vec_in, val items, val from, val to) vec_set_length(vec_in, plus(len, len_diff)); - memmove(vec_in->v.vec + t + c_num(len_diff), + memmove(vec_in->v.vec + t + c_num(len_diff), vec_in->v.vec + t, (l - t) * sizeof vec_in->v.vec); to = plus(from, len_it); } - + if (zerop(len_it)) return vec_in; if (vectorp(it_seq)) { - memcpy(vec_in->v.vec + c_num(from), it_seq->v.vec, + memcpy(vec_in->v.vec + c_num(from), it_seq->v.vec, sizeof *vec_in->v.vec * c_num(len_it)); mut(vec_in); } else if (stringp(it_seq)) { @@ -6736,7 +6736,7 @@ val time_sec_usec(void) #if !HAVE_GMTIME_R /* - * Ugly hacks for MingW, which uses the Microsft C Run Time Library, + * Ugly hacks for MingW, which uses the Microsft C Run Time Library, * whic in turn is stuck in the Dark Ages * without _r functions. */ struct tm *gmtime_r(const time_t *timep, struct tm *result); @@ -6879,7 +6879,7 @@ setenv(const char *name, const char *value, int overwrite) (void) overwrite; sprintf(str, "%s=%s", name, value); putenv(str); -} +} static void unsetenv(const char *name) @@ -403,7 +403,7 @@ extern val prog_string; extern mem_t *(*oom_realloc)(mem_t *, size_t); -#if HAVE_ULONGLONG_T +#if HAVE_ULONGLONG_T typedef ulonglong_t alloc_bytes_t; #else typedef unsigned long alloc_bytes_t; @@ -255,13 +255,13 @@ static val dest_set(val spec, val bindings, val pattern, val value) set(cdr_l(existing), value); } else if (consp(pattern)) { if (first(pattern) == var_s) { - uw_throwf(query_error_s, + uw_throwf(query_error_s, lit("metavariable @~a syntax cannot be used here"), second(pattern), nao); } if (first(pattern) == expr_s) { - uw_throwf(query_error_s, + uw_throwf(query_error_s, lit("the @~s syntax cannot be used here"), rest(pattern), nao); } @@ -349,7 +349,7 @@ static val vars_to_bindings(val spec, val vars, val bindings) val iter; list_collect_decl (fixed_vars, ptail); - if (vars && !consp(vars)) + if (vars && !consp(vars)) sem_error(spec, lit("not a valid variable list: ~a"), vars, nao); for (iter = vars; iter; iter = cdr(iter)) { @@ -357,9 +357,9 @@ static val vars_to_bindings(val spec, val vars, val bindings) if (bindable(item)) { ptail = list_collect(ptail, cons(item, noval_s)); } else if (consp(item) && bindable(first(item))) { - ptail = list_collect(ptail, cons(first(item), + ptail = list_collect(ptail, cons(first(item), txeval(spec, second(item), bindings))); - } else { + } else { sem_error(spec, lit("not a variable spec: ~a"), item, nao); } } @@ -703,7 +703,7 @@ static val h_skip(match_line_ctx *c) val last_good_result = nil, last_good_pos = nil; if (!rest(c->specline)) { - debuglf(elem, + debuglf(elem, lit("skip to end of line ~a:~a"), c->file, c->data_lineno, nao); return cons(c->bindings, t); } @@ -780,9 +780,9 @@ static val h_coll(match_line_ctx *c) cnum cmax = fixnump(gap) ? c_num(gap) : (fixnump(max) ? c_num(max) : 0); cnum cmin = fixnump(gap) ? c_num(gap) : (fixnump(min) ? c_num(min) : 0); cnum mincounter = cmin, maxcounter = 0; - cnum ctimax = fixnump(times) ? c_num(times) + cnum ctimax = fixnump(times) ? c_num(times) : (fixnump(maxtimes) ? c_num(maxtimes) : 0); - cnum ctimin = fixnump(times) ? c_num(times) + cnum ctimin = fixnump(times) ? c_num(times) : (fixnump(mintimes) ? c_num(mintimes) : 0); cnum cchars = fixnump(chars) ? c_num(chars) : 0; cnum timescounter = 0, charscounter = 0; @@ -858,7 +858,7 @@ static val h_coll(match_line_ctx *c) if (!have_vars || vars_binding) { val existing = assoc(car(binding), bindings_coll); - bindings_coll = acons_new(car(binding), + bindings_coll = acons_new(car(binding), cons(cdr(binding), cdr(existing)), bindings_coll); } @@ -1028,7 +1028,7 @@ static val h_parallel(match_line_ctx *c) /* No check for maybe, since it always succeeds. */ - + if (resolve_bindings) c->bindings = nappend2(resolve_bindings, c->bindings); @@ -1121,7 +1121,7 @@ static val h_fun(match_line_ctx *c) if (symbolp(arg)) { val newbind = assoc(param, new_bindings); if (newbind) { - c->bindings = dest_bind(elem, c->bindings, + c->bindings = dest_bind(elem, c->bindings, arg, cdr(newbind), equal_f); if (c->bindings == t) { debuglf(elem, @@ -1544,7 +1544,7 @@ static val do_txeval(val spec, val form, val bindings, val allow_unbound) } uw_catch (exc_sym, exc) { - if (stringp(exc) && !equal(exc, lit("")) && + if (stringp(exc) && !equal(exc, lit("")) && chr_str(exc, zero) == chr('(')) { uw_throw (exc_sym, exc); @@ -1741,7 +1741,7 @@ static void do_output_line(val bindings, val specline, val filter, val out) func_n1(robust_length), nao)); - if (counter && !bindable(counter)) + if (counter && !bindable(counter)) sem_error(elem, lit(":counter requires a bindable symbol, not ~s"), counter, nao); @@ -1820,7 +1820,7 @@ static void do_output_line(val bindings, val specline, val filter, val out) } else if (directive == expr_s) { if (opt_compat && opt_compat < 100) { - format(out, lit("~a"), + format(out, lit("~a"), eval(rest(elem), make_env(bindings, nil, nil), elem), nao); } else { val str = cat_str(subst_vars(cons(elem, nil), @@ -1900,7 +1900,7 @@ static void do_output(val bindings, val specs, val filter, val out) if (i == 0 && first_clauses) { do_output(bind_a, first_clauses, filter, out); - } else if (i == c_num(max_depth) - 1 && + } else if (i == c_num(max_depth) - 1 && (last_clauses || modlast_clauses)) { if (modlast_clauses) { @@ -2108,7 +2108,7 @@ static val v_skip(match_files_ctx *c) if (result) return result; if (last_good_result) { - debuglf(skipspec, lit("greedy skip matched ~a:~a"), + debuglf(skipspec, lit("greedy skip matched ~a:~a"), c->curfile, last_good_line, nao); return last_good_result; } @@ -2141,7 +2141,7 @@ static val v_fuzz(match_files_ctx *c) { cnum reps, good; - + for (reps = 0, good = 0; reps < cn; reps++) { match_files_ctx fuzz_ctx = mf_spec(*c, cons(first(c->spec), nil)); val result = match_files(fuzz_ctx); @@ -2339,7 +2339,7 @@ static val v_accept_fail(match_files_ctx *c) static val v_next(match_files_ctx *c) { spec_bind (specline, first_spec, c->spec); - + if ((c->spec = rest(c->spec)) == nil) return cons(c->bindings, cons(c->data, c->data_lineno)); @@ -2374,7 +2374,7 @@ static val v_next(match_files_ctx *c) return nil; } } - + if (keywordp(first(args))) { source = nil; } else { @@ -2404,7 +2404,7 @@ static val v_next(match_files_ctx *c) if (from_var) { val existing = assoc(from_var, c->bindings); - if (!symbolp(from_var)) + if (!symbolp(from_var)) sem_error(specline, lit(":var requires a variable, not ~s"), from_var, nao); if (!existing) @@ -2529,7 +2529,7 @@ static val v_parallel(match_files_ctx *c) for (iter = specs; iter != nil; iter = rest(iter)) { val nested_spec = first(iter); - cons_bind (new_bindings, success, + cons_bind (new_bindings, success, match_files(mf_spec(*c, nested_spec))); if (success) { @@ -2650,7 +2650,7 @@ static val v_gather(match_files_ctx *c) for (iter = specs, next = cdr(iter); iter != nil; iter = next, next = cdr(iter)) { val nested_spec = first(iter); - cons_bind (new_bindings, success, + cons_bind (new_bindings, success, match_files(mf_spec(*c, nested_spec))); if (!success) { @@ -2761,9 +2761,9 @@ static val v_collect(match_files_ctx *c) cnum cmax = fixnump(gap) ? c_num(gap) : (fixnump(max) ? c_num(max) : 0); cnum cmin = fixnump(gap) ? c_num(gap) : (fixnump(min) ? c_num(min) : 0); cnum mincounter = cmin, maxcounter = 0; - cnum ctimax = fixnump(times) ? c_num(times) + cnum ctimax = fixnump(times) ? c_num(times) : (fixnump(maxtimes) ? c_num(maxtimes) : 0); - cnum ctimin = fixnump(times) ? c_num(times) + cnum ctimin = fixnump(times) ? c_num(times) : (fixnump(mintimes) ? c_num(mintimes) : 0); volatile cnum timescounter = 0, linescounter = 0; cnum ctimes = fixnump(times) ? c_num(times) : 0; @@ -2844,7 +2844,7 @@ static val v_collect(match_files_ctx *c) val exists = assoc(var, new_bindings); if (!exists) { - if (dfl == noval_s) + if (dfl == noval_s) ptail = list_collect(ptail, var); else strictly_new_bindings = acons(var, dfl, strictly_new_bindings); @@ -3050,7 +3050,7 @@ static val v_bind(match_files_ctx *c) testfun = curry_1234_34(func_n4(filter_equal), lfilt, rfilt); } - + uw_env_begin; uw_set_match_context(cons(c->spec, c->bindings)); @@ -3105,7 +3105,7 @@ static val v_rebind(match_files_ctx *c) val val = txeval(specline, form, c->bindings); c->bindings = alist_remove(c->bindings, args); - c->bindings = dest_bind(specline, c->bindings, + c->bindings = dest_bind(specline, c->bindings, pattern, val, equal_f); return next_spec_k; @@ -3191,7 +3191,7 @@ static val v_output(match_files_ctx *c) if (into_var) { val stream = make_strlist_output_stream(); - if (!symbolp(into_var)) + if (!symbolp(into_var)) sem_error(specline, lit(":into requires a variable, not ~s"), into_var, nao); if (named_var) @@ -3316,7 +3316,7 @@ static val v_try(match_files_ctx *c) val value = car(viter); if (value != noval_s) { - c->bindings = dest_bind(specline, c->bindings, + c->bindings = dest_bind(specline, c->bindings, param, value, equal_f); if (c->bindings == t) { @@ -3465,7 +3465,7 @@ static val v_throw(match_files_ctx *c) sem_error(specline, lit("throw: ~a is not a type symbol"), type, nao); { - val values = mapcar(curry_123_2(func_n3(txeval_allow_ub), + val values = mapcar(curry_123_2(func_n3(txeval_allow_ub), specline, c->bindings), args); uw_throw(type, values); } @@ -3484,17 +3484,17 @@ static val v_deffilter(match_files_ctx *c) { val table_evaled = txeval(specline, table, c->bindings); - if (!all_satisfy(table_evaled, andf(func_n1(listp), + if (!all_satisfy(table_evaled, andf(func_n1(listp), chain(func_n1(length_list), curry_12_1(func_n2(ge), two), nao), chain(func_n1(rest), - curry_123_1(func_n3(all_satisfy), - func_n1(stringp), + curry_123_1(func_n3(all_satisfy), + func_n1(stringp), nil), - nao), + nao), nao), nil)) - sem_error(specline, + sem_error(specline, lit("deffilter arguments must be lists of at least two strings"), nao); @@ -3524,7 +3524,7 @@ static val v_filter(match_files_ctx *c) val existing = assoc(var, c->bindings); if (!bindable(var)) - sem_error(specline, lit("filter: ~a is not a variable name"), + sem_error(specline, lit("filter: ~a is not a variable name"), var, nao); if (!existing) @@ -3609,7 +3609,7 @@ static val v_fun(match_files_ctx *c) if (symbolp(arg)) { val newbind = assoc(param, new_bindings); if (newbind) { - c->bindings = dest_bind(specline, c->bindings, + c->bindings = dest_bind(specline, c->bindings, arg, cdr(newbind), equal_f); if (c->bindings == t) { debuglf(specline, @@ -3687,7 +3687,7 @@ static val v_assert(match_files_ctx *c) if (result) { return result; } else if (type) { - val values = mapcar(curry_123_2(func_n3(txeval_allow_ub), + val values = mapcar(curry_123_2(func_n3(txeval_allow_ub), specline, c->bindings), args); uw_throw(type, values); } else { @@ -3826,7 +3826,7 @@ static val h_assert(match_line_ctx *c) if (result) { return result; } else if (type) { - val values = mapcar(curry_123_2(func_n3(txeval_allow_ub), + val values = mapcar(curry_123_2(func_n3(txeval_allow_ub), c->specline, c->bindings), elem); uw_throw(type, values); } else { @@ -3897,7 +3897,7 @@ static val match_files(match_files_ctx c) gc_hint(c.data); - for (; c.spec; c.spec = rest(c.spec), + for (; c.spec; c.spec = rest(c.spec), c.data = rest(c.data), c.data_lineno = plus(c.data_lineno, one)) repeat_spec_same_data: @@ -3977,7 +3977,7 @@ val match_filter(val name, val arg, val other_args) val in_arg_sym = make_sym(lit("in_arg")); val out_arg_sym = make_sym(lit("out_arg")); val bindings = cons(cons(in_arg_sym, arg), in_bindings); - val spec = cons(list(cons(name, + val spec = cons(list(cons(name, cons(in_arg_sym, cons(out_arg_sym, other_args))), nao), nil); match_files_ctx c = mf_all(spec, nil, bindings, nil, nil); @@ -197,7 +197,7 @@ U3 [\xe0-\xef] U4 [\xf0-\xf4] UANY {ASC}|{U2}{U}|{U3}{U}{U}|{U4}{U}{U}{U} -UANYN {ASCN}|{U2}{U}|{U3}{U}{U}|{U4}{U}{U}{U} +UANYN {ASCN}|{U2}{U}|{U3}{U}{U}|{U4}{U}{U}{U} UONLY {U2}{U}|{U3}{U}{U}|{U4}{U}{U}{U} %x SPECIAL BRACED NESTED REGEX STRLIT CHRLIT QSILIT QSPECIAL WLIT QWLIT @@ -832,7 +832,7 @@ UONLY {U2}{U}|{U3}{U}{U}|{U4}{U}{U}{U} <STRLIT,QSILIT,WLIT,QWLIT>{WS}[\\]\n{WS} { yyextra->lineno++; } - + <STRLIT,QSILIT,WLIT,QWLIT>[\\](x{HEX}+|{OCT}+);? { yylval->chr = num_esc(yyg, yytext+1); return LITCHAR; @@ -87,7 +87,7 @@ int yylex(union YYSTYPE *, yyscan_t scanner); %token <lexeme> SPACE TEXT SYMTOK %token <lineno> ALL SOME NONE MAYBE CASES BLOCK CHOOSE GATHER %token <lineno> AND OR END COLLECT -%token <lineno> UNTIL COLL OUTPUT REPEAT REP SINGLE FIRST LAST EMPTY +%token <lineno> UNTIL COLL OUTPUT REPEAT REP SINGLE FIRST LAST EMPTY %token <lineno> MOD MODLAST DEFINE TRY CATCH FINALLY %token <lineno> ERRTOK /* deliberately not used in grammar */ %token <lineno> HASH_BACKSLASH HASH_SLASH DOTDOT HASH_H @@ -126,7 +126,7 @@ int yylex(union YYSTYPE *, yyscan_t scanner); %nonassoc '[' ']' '(' ')' %left '-' ',' '\'' '^' SPLICE '@' %left '|' '/' -%left '&' +%left '&' %right '~' '*' '?' '+' '%' %right '.' REGCHAR REGTOKEN LITCHAR %right DOTDOT @@ -186,7 +186,7 @@ some_clause : SOME exprs_opt ')' newl clause_parts { $$ = list(some_s, $5, $2, nao); rl($$, num($1)); } | SOME exprs_opt ')' - newl error + newl error { $$ = nil; yybadtok(yychar, lit("some clause")); } | SOME exprs_opt ')' @@ -220,7 +220,7 @@ cases_clause : CASES newl clause_parts { $$ = list(cases_s, $3, nao); block_clause : BLOCK exprs_opt ')' newl clauses_opt - END newl { val name = first($2); + END newl { val name = first($2); if (gt(length($2), one)) yyerr("block: takes zero or no arguments"); if (name && !bindable(name)) @@ -247,20 +247,20 @@ choose_clause : CHOOSE exprs_opt ')' gather_clause : GATHER exprs_opt ')' newl gather_parts - END newl { $$ = list(gather_s, + END newl { $$ = list(gather_s, append2(mapcar(curry_12_1(func_n2(cons), nil), first($5)), rest($5)), - $2, nao); + $2, nao); rl($$, num($1)); } - | GATHER exprs_opt ')' + | GATHER exprs_opt ')' newl gather_parts - until_last newl + until_last newl clauses - END newl { $$ = list(gather_s, + END newl { $$ = list(gather_s, append2(mapcar(curry_12_1(func_n2(cons), nil), first($5)), rest($5)), - $2, cons(cdr($6), $8), nao); + $2, cons(cdr($6), $8), nao); rl($$, num($1)); } | GATHER exprs_opt ')' @@ -289,7 +289,7 @@ collect_clause : collect_repeat exprs_opt ')' newl newl clauses END newl { $$ = list(car($1), $5, cons(cdr($6), $8), $2, nao); - rl($$, cdr($1)); + rl($$, cdr($1)); rl($8, car($6)); } | collect_repeat exprs_opt ')' newl error { $$ = nil; @@ -306,7 +306,7 @@ collect_repeat : COLLECT { $$ = cons(collect_s, num($1)); } ; until_last : UNTIL { $$ = cons(num($1), until_s); } - | LAST { $$ = cons(num($1), last_s); } + | LAST { $$ = cons(num($1), last_s); } ; clause_parts : clauses additional_parts { $$ = cons($1, $2); } @@ -350,7 +350,7 @@ elems_opt : elems { $$ = $1; } | { $$ = nil; } ; -elems : elem { $$ = cons($1, nil); +elems : elem { $$ = cons($1, nil); rlcp($$, $1); } | elem elems { $$ = cons($1, $2); rlcp($$, $1); } @@ -361,7 +361,7 @@ elems : elem { $$ = cons($1, nil); text : TEXT { $$ = rl(string_own($1), num(parser->lineno)); } | SPACE { if ($1[0] == ' ' && $1[1] == 0) - { val spaces = list(oneplus_s, + { val spaces = list(oneplus_s, chr(' '), nao); $$ = regex_compile(spaces, nil); rl($$, num(parser->lineno)); @@ -392,7 +392,7 @@ elem : texts { $$ = rlcp(cons(text_s, $1), $1); | COLL exprs_opt ')' elems END { $$ = list(coll_s, $4, nil, $2, nao); rl($$, num($1)); } | COLL exprs_opt ')' elems - until_last elems END { $$ = list(coll_s, $4, cons(cdr($5), $6), + until_last elems END { $$ = list(coll_s, $4, cons(cdr($5), $6), $2, nao); rl($$, num($1)); rl($6, car($5)); } @@ -413,7 +413,7 @@ elem : texts { $$ = rlcp(cons(text_s, $1), $1); clause_parts_h { $$ = list(choose_s, t, $4, $2, nao); rl($$, num($1)); } | CHOOSE exprs_opt ')' END { yyerr("empty cases clause"); } - | DEFINE exprs ')' elems END + | DEFINE exprs ')' elems END { $$ = list(define_s, t, $4, $2, nao); rl($$, num($1)); } ; @@ -538,7 +538,7 @@ out_clause : repeat_clause { $$ = cons($1, nil); } repeat_clause : REPEAT exprs_opt ')' newl out_clauses_opt repeat_parts_opt - END newl { $$ = repeat_rep_helper(repeat_s, + END newl { $$ = repeat_rep_helper(repeat_s, $2, $5, $6); rl($$, num($1)); } | REPEAT newl @@ -565,7 +565,7 @@ repeat_parts_opt : SINGLE newl | MOD exprs_opt ')' newl out_clauses_opt - repeat_parts_opt { $$ = cons(cons(mod_s, + repeat_parts_opt { $$ = cons(cons(mod_s, cons($2, $5)), $6); rl($$, num($1)); } | MODLAST exprs_opt ')' @@ -626,12 +626,12 @@ rep_parts_opt : SINGLE o_elems_opt rl($$, num($1)); } | MOD exprs_opt ')' o_elems_opt - rep_parts_opt { $$ = cons(cons(mod_s, + rep_parts_opt { $$ = cons(cons(mod_s, cons($2, $4)), $5); rl($$, num($1)); } | MODLAST exprs_opt ')' o_elems_opt - rep_parts_opt { $$ = cons(cons(modlast_s, + rep_parts_opt { $$ = cons(cons(modlast_s, cons($2, $4)), $5); rl($$, num($1)); } | /* empty */ { $$ = nil; } @@ -810,17 +810,17 @@ regex : '/' regexpr '/' { $$ = regex_compile($2, nil); end_of_regex(scnr); } ; -lisp_regex : HASH_SLASH regexpr '/' +lisp_regex : HASH_SLASH regexpr '/' { $$ = regex_compile($2, nil); end_of_regex(scnr); rl($$, num(parser->lineno)); } - | HASH_SLASH error + | HASH_SLASH error { $$ = nil; yybadtok(yychar, lit("regex")); end_of_regex(scnr); } ; -regexpr : regbranch { $$ = if3(cdr($1), +regexpr : regbranch { $$ = if3(cdr($1), cons(compound_s, $1), car($1)); } | regexpr '|' regexpr { $$ = list(or_s, $1, $3, nao); } @@ -69,7 +69,7 @@ static struct cobj_ops random_state_ops = { cobj_print_op, cobj_destroy_free_op, cobj_mark_op, - cobj_hash_op + cobj_hash_op }; static val make_state(void) @@ -95,7 +95,7 @@ static rand32_t rand32(struct rand_state *r) rand32_t r2 = s9 ^ (s9 >> 11); rand32_t ns0 = RSTATE(r, 0) = r1 ^ r2; - rand32_t ns15 = s15 ^ (s15 << 2) ^ r1 ^ (r1 << 18) ^ r2 ^ (r2 << 28) ^ + rand32_t ns15 = s15 ^ (s15 << 2) ^ r1 ^ (r1 << 18) ^ r2 ^ (r2 << 28) ^ ((ns0 ^ (ns0 << 5)) & 0xda442d24ul); RSTATE(r, 15) = ns15; @@ -246,7 +246,7 @@ val random(val state, val modulus) continue; return num(out); } - } + } invalid: uw_throwf(numeric_error_s, lit("random: invalid modulus ~s"), modulus, nao); @@ -71,13 +71,13 @@ typedef struct regex { * Result from regex_machine_feed. * These values have two meanings, based on whether * the matching is still open (characters are being fed) - * or finalized. + * or finalized. * * When feeding characters: * REGM_INCOMPLETE: no match at this character, but matching can continue. * REGM_FAIL: no more state transitions are possible. * REGM_MATCH: match (accept state) for this character. - * + * * When the end of the input is encountered, or a REGM_FAIL, * then regex_machine_feed is called one more time with * the null character. It then reports: @@ -125,7 +125,7 @@ typedef unsigned int bitcell_t; #define CHAR_SET_L0_HI(CH) ((CH) | convert(wchar_t, 0xFF)) typedef enum { - CHSET_SMALL, CHSET_DISPLACED, CHSET_LARGE, + CHSET_SMALL, CHSET_DISPLACED, CHSET_LARGE, #ifdef FULL_UNICODE CHSET_XLARGE #endif @@ -1376,17 +1376,17 @@ static val dv_compile_regex(val exp) val any = list(zeroplus_s, wild_s, nao); val notempty = list(oneplus_s, wild_s, nao); - return list(compound_s, - list(and_s, + return list(compound_s, + list(and_s, zplus, - list(compl_s, - list(compound_s, - any, + list(compl_s, + list(compound_s, + any, if3(reg_nullable(xsecond), list(and_s, xsecond, notempty, nao), xsecond), - any, nao), - nao), + any, nao), + nao), nao), xsecond, nao); } @@ -1405,7 +1405,7 @@ static val dv_compile_regex(val exp) static val reg_nullable_list(val exp_list) { if (rest(exp_list)) { - return if2(reg_nullable(first(exp_list)) && + return if2(reg_nullable(first(exp_list)) && reg_nullable_list(rest(exp_list)), t); } else { @@ -1461,7 +1461,7 @@ static val unflatten_or(val exlist) { val f = first(exlist); val r = rest(exlist); - + if (r) { return cons(or_s, cons(f, cons(unflatten_or(r), nil))); } else { @@ -1473,7 +1473,7 @@ static val unique_first(val exlist) { val f = first(exlist); val r = rest(exlist); - + if (!memqual(f, r)) return cons(first(exlist), nil); return nil; @@ -1519,7 +1519,7 @@ static val reg_derivative_list(val exp_list, val ch) if (d_first == t) return d_rest; - return list(or_s, + return list(or_s, if3(d_first == nil, cons(compound_s, rest(exp_list)), cons(compound_s, cons(d_first, rest(exp_list)))), @@ -1533,7 +1533,7 @@ static val reg_derivative_list(val exp_list, val ch) else if (d_first == nil) return cons(compound_s, rest(exp_list)); else - return cons(compound_s, + return cons(compound_s, cons(d_first, rest(exp_list))); } } else { @@ -1654,7 +1654,7 @@ static val regex_requires_dv(val exp) } else if (sym == compl_s) { return t; } else if (sym == or_s) { - return if2(regex_requires_dv(first(args)) || + return if2(regex_requires_dv(first(args)) || regex_requires_dv(second(args)), t); } else if (sym == and_s || sym == nongreedy_s) { return t; @@ -110,7 +110,7 @@ void sig_init(void) for (i = 0; i < MAX_SIG; i++) { /* t means SIG_DFL, which is what signals * are before we manipulate them. */ - sig_lambda[i] = t; + sig_lambda[i] = t; prot1(&sig_lambda[i]); } @@ -56,7 +56,7 @@ if (sig_save) \ sig_check(); \ } while(0) - + typedef struct { jmp_buf jb; sig_atomic_t se; @@ -488,7 +488,7 @@ static void tail_strategy(val stream, unsigned long *state) for (;;) { FILE *newf; - /* Try to open the file. + /* Try to open the file. */ if (!(newf = w_fopen(c_str(h->descr), c_str(h->mode)))) { /* If already have the file open previously, and the name @@ -518,7 +518,7 @@ static void tail_strategy(val stream, unsigned long *state) } /* Obtain size of new file. If we can't, then let's just pretend we never - * opened it and bail out. + * opened it and bail out. */ if (fseek(newf, 0, SEEK_END) == -1 || (size = ftell(newf)) == -1) { fclose(newf); @@ -539,7 +539,7 @@ static void tail_strategy(val stream, unsigned long *state) } /* Newly opened file is not smaller. We take a gamble and say - * that it's the same object as h->f, since rotating files + * that it's the same object as h->f, since rotating files * are usually large and it is unlikely that it is a new file * which has grown larger than the original. Just in case, * though, we take the new file handle. But we do not reset @@ -676,7 +676,7 @@ static val pipe_close(val stream, val throw_on_error) uw_throwf(process_error_s, lit("closing pipe ~a failed"), stream, nao); #endif return status == 0 ? zero : nil; - } + } } return nil; } @@ -870,7 +870,7 @@ struct string_output { wchar_t *buf; size_t size; size_t fill; - utf8_decoder_t ud; + utf8_decoder_t ud; unsigned char byte_buf[4]; int head, tail; }; @@ -1424,13 +1424,13 @@ static void detect_format_string(void) } static val vformat_num(val stream, const char *str, - int width, int left, int zeropad, + int width, int left, int zeropad, int precision, int sign) { int sign_char = (str[0] == '-' || str[0] == '+') ? str[0] : 0; int digit_len = strlen(str) - (sign_char != 0); int padlen = precision > digit_len ? precision - digit_len : 0; - int total_len = digit_len + padlen + (sign_char || sign); + int total_len = digit_len + padlen + (sign_char || sign); int slack = (total_len < width) ? width - total_len : 0; int i; @@ -1659,7 +1659,7 @@ val vformat(val stream, val fmtstr, va_list vl) case 'o': obj = va_arg(vl, val); if (bignump(obj)) { - int nchars = mp_radix_size(mp(obj), 8); + int nchars = mp_radix_size(mp(obj), 8); if (nchars >= convert(int, sizeof (num_buf))) pnum = coerce(char *, chk_malloc(nchars + 1)); mp_toradix(mp(obj), coerce(unsigned char *, pnum), 8); @@ -1750,7 +1750,7 @@ val vformat(val stream, val fmtstr, va_list vl) goto output_num; case BGNUM: { - int nchars = mp_radix_size(mp(obj), 10); + int nchars = mp_radix_size(mp(obj), 10); if (nchars >= convert(int, sizeof (num_buf))) pnum = coerce(char *, chk_malloc(nchars + 1)); mp_toradix(mp(obj), coerce(unsigned char *, pnum), 10); @@ -1822,7 +1822,7 @@ val vformat(val stream, val fmtstr, va_list vl) } goto output_num; default: - uw_throwf(error_s, lit("unknown format directive character ~s\n"), + uw_throwf(error_s, lit("unknown format directive character ~s\n"), chr(ch), nao); output_num: { @@ -2033,7 +2033,7 @@ val seek_stream(val stream, val offset, val whence) else uw_throwf(file_error_s, lit("seek: ~a is not a valid whence argument"), whence, nao); - + return ops->seek(stream, off, w); } } @@ -2155,8 +2155,8 @@ val open_process(val name, val mode_str, val args) free(argv); uw_throwf(file_error_s, lit("opening pipe ~a, fork syscall failed: ~a/~s"), name, num(errno), string_utf8(strerror(errno)), nao); - } - + } + if (pid == 0) { if (input) { dup2(fd[1], STDOUT_FILENO); @@ -2313,8 +2313,8 @@ static val run(val name, val args) free(argv); uw_throwf(file_error_s, lit("opening process ~a, fork syscall failed: ~a/~s"), name, num(errno), string_utf8(strerror(errno)), nao); - } - + } + if (pid == 0) { execvp(utf8name, argv); _exit(errno); @@ -86,7 +86,7 @@ val openlog_wrap(val wident, val optmask, val facility) optmask = default_arg(optmask, zero); facility = default_arg(facility, num_fast(LOG_USER)); - + ident = utf8_dup_to(c_str(wident)); openlog(ident, c_num(optmask), c_num(facility)); free(old_ident); @@ -411,7 +411,7 @@ int txr_main(int argc, char **argv) bindings = cons(cons(intern(var, nil), deflist), bindings); else if (deflist) bindings = cons(cons(intern(var, nil), car(deflist)), bindings); - else + else bindings = cons(cons(intern(var, nil), t), bindings); continue; @@ -293,7 +293,6 @@ val uw_throw(val sym, val exception) format(std_error, s ? lit("~a: ~a\n") : lit("~a: ~s\n"), prog_string, exception, nao); - } if (uw_exception_subtype_p(sym, query_error_s) || uw_exception_subtype_p(sym, file_error_s)) { @@ -43,7 +43,7 @@ #ifndef FULL_UNICODE static void conversion_error(void) { - uw_throw(range_error_s, + uw_throw(range_error_s, lit("encountered utf-8 character that needs full unicode support")); } #endif |