diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2017-03-17 20:34:47 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2017-03-17 20:34:47 -0700 |
commit | 3f4586d1ee813ecd23456956d5f2c7f4759a5922 (patch) | |
tree | 402e17e4fa35841409bf1ccb33ea112009b8dcfe | |
parent | fbb35f10c305128e865f7c16e21f61ea6e62083e (diff) | |
download | txr-3f4586d1ee813ecd23456956d5f2c7f4759a5922.tar.gz txr-3f4586d1ee813ecd23456956d5f2c7f4759a5922.tar.bz2 txr-3f4586d1ee813ecd23456956d5f2c7f4759a5922.zip |
Rename badly named default_bool_arg
* lib.h (default_bool_arg): Inline function renamed to
default_null_arg.
* eval.c (if_fun, pad, ginterate, giterate, range_star, range,
constantp, macroexpand_1, macro_form_p, expand_with_free_refs,
do_expand, eval_intrinsic, func_get_name, make_env_intrinsic):
Follow rename.
* arith.c (lognot): Likewise.
* gc.c (gc_finalize): Likewise.
* glob.c (glob_wrap): Likewise.
* hash.c (group_reduce, gethash_n): Likewise.
* lib.c (print, multi_sort, lazy_str, vector, iff, tok_str,
split_str_keep, search_str, remove_if, val): Likewise.
* match.c (match_fun): Likewise.
* parser.c (lisp_parse_impl, regex_parse): Likewise.
* rand.c (make_random_state): Likewise.
* regex.c (read_until_match, search_regex, regex_compile):
Likewise.
* socket.c (sock_accept, sock_connect): Likewise.
* stream.c (open_files_star, open_files, run, open_process,
open_tail, get_string, record_adapter): Likewise.
* struct.c (static_slot_ensure, static_slot_ens_rec,
clear_struct, make_struct_type): Likewise.
* sysif.c (exec_wrap, errno_wrap, cobj_ops_init): Likewise.
* unwind.c (uw_capture_cont, uw_find_frames_impl): Likewise.
-rw-r--r-- | arith.c | 2 | ||||
-rw-r--r-- | eval.c | 34 | ||||
-rw-r--r-- | gc.c | 2 | ||||
-rw-r--r-- | glob.c | 2 | ||||
-rw-r--r-- | hash.c | 4 | ||||
-rw-r--r-- | lib.c | 22 | ||||
-rw-r--r-- | lib.h | 2 | ||||
-rw-r--r-- | match.c | 4 | ||||
-rw-r--r-- | parser.c | 8 | ||||
-rw-r--r-- | rand.c | 4 | ||||
-rw-r--r-- | regex.c | 6 | ||||
-rw-r--r-- | socket.c | 4 | ||||
-rw-r--r-- | stream.c | 18 | ||||
-rw-r--r-- | struct.c | 8 | ||||
-rw-r--r-- | sysif.c | 4 | ||||
-rw-r--r-- | unwind.c | 6 |
16 files changed, 65 insertions, 65 deletions
@@ -2306,7 +2306,7 @@ val lognot(val a, val bits) { val b; - if (default_bool_arg(bits)) + if (default_null_arg(bits)) return comp_trunc(a, bits); switch (type(a)) { @@ -142,9 +142,9 @@ val copy_env(val oenv) */ static val make_env_intrinsic(val vbindings, val fbindings, val up_env) { - vbindings = default_bool_arg(vbindings); - fbindings = default_bool_arg(fbindings); - up_env = default_bool_arg(up_env); + vbindings = default_null_arg(vbindings); + fbindings = default_null_arg(fbindings); + up_env = default_null_arg(up_env); return make_env(vbindings, fbindings, up_env); } @@ -508,7 +508,7 @@ val lookup_fun(val env, val sym) val func_get_name(val fun, val env) { - env = default_bool_arg(env); + env = default_null_arg(env); if (env) { type_check(env, ENV); @@ -1332,7 +1332,7 @@ val eval_intrinsic(val form, val env) expand(form, nil)); val loading = cdr(lookup_var(dyn_env, load_recursive_s)); val ret = ((void) (loading || uw_release_deferred_warnings()), - eval(form_ex, default_bool_arg(env), form)); + eval(form_ex, default_null_arg(env), form)); last_form_expanded = lfx_save; last_form_evaled = lfe_save; return ret; @@ -3962,7 +3962,7 @@ static val do_expand(val form, val menv) { val macro = nil; - menv = default_bool_arg(menv); + menv = default_null_arg(menv); if (nilp(form)) { return nil; @@ -4373,8 +4373,8 @@ static val gather_free_refs_nw(val info_cons, val exc, static val expand_with_free_refs(val form, val menv_in, val upto_menv_in) { val ret; - val menv = default_bool_arg(menv_in); - val upto_menv = default_bool_arg(upto_menv_in); + val menv = default_null_arg(menv_in); + val upto_menv = default_null_arg(upto_menv_in); uw_frame_t uw_handler; val info_cons_free = cons(nil, nil); val info_cons_bound = cons(nil, nil); @@ -4393,7 +4393,7 @@ static val expand_with_free_refs(val form, val menv_in, val upto_menv_in) val macro_form_p(val form, val menv) { - menv = default_bool_arg(menv); + menv = default_null_arg(menv); if (bindable(form) && lookup_symac(menv, form)) return t; @@ -4406,7 +4406,7 @@ static val macroexpand_1(val form, val menv) { val macro; - menv = default_bool_arg(menv); + menv = default_null_arg(menv); if (consp(form) && (macro = lookup_mac(menv, car(form)))) { val mac_expand = expand_macro(form, macro, menv); @@ -4448,7 +4448,7 @@ static val constantp_noex(val form) static val constantp(val form, val env_in) { - val env = default_bool_arg(env_in); + val env = default_null_arg(env_in); if (consp(form)) { if (car(form) == quote_s) { @@ -4762,7 +4762,7 @@ static val range_func(val env, val lcons) static val range(val from_in, val to_in, val step_in) { val from = default_arg(from_in, zero); - val to = default_bool_arg(to_in); + val to = default_null_arg(to_in); val step = default_arg(step_in, if3(to && gt(from, to), negone, one)); val env = cons(from, cons(to, step)); @@ -4796,7 +4796,7 @@ static val range_star_func(val env, val lcons) static val range_star(val from_in, val to_in, val step_in) { val from = default_arg(from_in, zero); - val to = default_bool_arg(to_in); + val to = default_null_arg(to_in); if (eql(from, to)) { return nil; @@ -4850,7 +4850,7 @@ static val giterate_func(val env, val lcons) static val giterate(val while_pred, val gen_fun, val init_val) { - init_val = default_bool_arg(init_val); + init_val = default_null_arg(init_val); if (!funcall1(while_pred, init_val)) { return nil; @@ -4878,7 +4878,7 @@ static val ginterate_func(val env, val lcons) static val ginterate(val while_pred, val gen_fun, val init_val) { - init_val = default_bool_arg(init_val); + init_val = default_null_arg(init_val); if (!funcall1(while_pred, init_val)) { return cons(init_val, nil); @@ -5021,7 +5021,7 @@ static val pad_func(val env, val lcons) static val pad(val list, val item_in, val count) { - val item = default_bool_arg(item_in); + val item = default_null_arg(item_in); switch (type(list)) { case NIL: @@ -5158,7 +5158,7 @@ static void reg_symacro(val sym, val form) static val if_fun(val cond, val then, val alt) { - return if3(cond, then, default_bool_arg(alt)); + return if3(cond, then, default_null_arg(alt)); } static val or_fun(struct args *vals) @@ -846,7 +846,7 @@ val gc_finalize(val obj, val fun, val rev_order_p) { type_check(fun, FUN); - rev_order_p = default_bool_arg(rev_order_p); + rev_order_p = default_null_arg(rev_order_p); if (is_ptr(obj)) { struct fin_reg *f = coerce(struct fin_reg *, chk_malloc(sizeof *f)); @@ -77,7 +77,7 @@ val glob_wrap(val pattern, val flags, val errfunc) "its error callback function"), nao); } - s_errfunc = default_bool_arg(errfunc); + s_errfunc = default_null_arg(errfunc); (void) glob(pat_u8, c_flags, s_errfunc ? errfunc_thunk : 0, &gl); @@ -716,7 +716,7 @@ val gethash_f(val hash, val key, loc found) val gethash_n(val hash, val key, val notfound_val) { val existing = gethash_e(hash, key); - return if3(existing, cdr(existing), default_bool_arg(notfound_val)); + return if3(existing, cdr(existing), default_null_arg(notfound_val)); } val sethash(val hash, val key, val value) @@ -1085,7 +1085,7 @@ val group_by(val func, val seq, struct args *hashv_args) val group_reduce(val hash, val by_fun, val reduce_fun, val seq, val initval, val filter_fun) { - initval = default_bool_arg(initval); + initval = default_null_arg(initval); if (vectorp(seq)) { cnum i, len; @@ -143,7 +143,7 @@ val chr(wchar_t ch); val eq(val a, val b); val null(val v); int null_or_missing_p(val v); -val default_bool_arg(val arg); +val default_null_arg(val arg); #endif val identity(val obj) @@ -1523,7 +1523,7 @@ val rmember_if(val pred, val list, val key) static val rem_impl(val (*eqfun)(val, val), val name, val obj, val seq_in, val keyfun_in) { - val keyfun = default_bool_arg(keyfun_in); + val keyfun = default_null_arg(keyfun_in); switch (type(seq_in)) { case NIL: @@ -1591,7 +1591,7 @@ static val rem_impl(val (*eqfun)(val, val), val name, val remove_if(val pred, val seq_in, val keyfun_in) { - val keyfun = default_bool_arg(keyfun_in); + val keyfun = default_null_arg(keyfun_in); switch (type(seq_in)) { case NIL: @@ -3436,7 +3436,7 @@ const wchar_t *c_str(val obj) val search_str(val haystack, val needle, val start_num, val from_end) { - from_end = default_bool_arg(from_end); + from_end = default_null_arg(from_end); start_num = default_arg(start_num, zero); if (length_str_lt(haystack, start_num)) { @@ -3926,7 +3926,7 @@ val scat(val sep, ...) val split_str_keep(val str, val sep, val keep_sep) { - keep_sep = default_bool_arg(keep_sep); + keep_sep = default_null_arg(keep_sep); if (regexp(sep)) { list_collect_decl (out, iter); @@ -4047,7 +4047,7 @@ val tok_str(val str, val tok_regex, val keep_sep) val slen = length(str); int prev_empty = 1; - keep_sep = default_bool_arg(keep_sep); + keep_sep = default_null_arg(keep_sep); if (opt_compat && opt_compat <= 155) for (;;) { cons_bind (new_pos, len, search_regex(str, tok_regex, pos, nil)); @@ -6558,7 +6558,7 @@ static val do_iff(val env, struct args *args_in) val iff(val condfun, val thenfun, val elsefun) { thenfun = default_arg(thenfun, identity_f); - elsefun = default_bool_arg(elsefun); + elsefun = default_null_arg(elsefun); return func_f0v(cons(condfun, cons(thenfun, elsefun)), do_iff); } @@ -6591,7 +6591,7 @@ val vector(val length, val initval) length, nao)); val vec = make_obj(); vec->v.type = VEC; - initval = default_bool_arg(initval); + initval = default_null_arg(initval); #if HAVE_VALGRIND vec->v.vec_true_start = v; #endif @@ -7028,7 +7028,7 @@ val lazy_str(val lst, val term, val limit) chk_calloc(1, sizeof *obj->ls.props)); term = default_arg(term, lit("\n")); - limit = default_bool_arg(limit); + limit = default_null_arg(limit); if (nilp(lst)) { obj->ls.prefix = null_string; @@ -7960,7 +7960,7 @@ val multi_sort(val lists, val funcs, val key_funcs) { val tuples = mapcarl(list_f, nullify(lists)); - key_funcs = default_bool_arg(key_funcs); + key_funcs = default_null_arg(key_funcs); if (functionp(funcs)) funcs = cons(funcs, nil); @@ -10356,7 +10356,7 @@ val obj_print(val obj, val out, val pretty) val print(val obj, val stream, val pretty) { return obj_print(obj, default_arg(stream, std_output), - default_bool_arg(pretty)); + default_null_arg(pretty)); } val pprint(val obj, val stream) @@ -1078,7 +1078,7 @@ INLINE int null_or_missing_p(val v) { return (nilp(v) || missingp(v)); } #define default_arg(arg, dfl) if3(null_or_missing_p(arg), dfl, arg) -INLINE val default_bool_arg(val arg) +INLINE val default_null_arg(val arg) { return if3(missingp(arg), nil, arg); } @@ -4561,12 +4561,12 @@ val match_fun(val name, val args, val input_in, val files_in) { val call = cons(name, args); val spec = cons(cons(call, nil), nil); - val input = default_bool_arg(input_in); + val input = default_null_arg(input_in); val in_stream_p = streamp(input); val curfile = if3(in_stream_p, stream_get_prop(input, name_k), lit("list")); - val files = cons(curfile, default_bool_arg(files_in)); + val files = cons(curfile, default_null_arg(files_in)); val in_bindings = cdr(uw_get_match_context()); val data = if3(streamp(input), lazy_stream_cons(input), @@ -476,7 +476,7 @@ val regex_parse(val string, val error_stream) val stream = make_string_byte_input_stream(string); parser_t parser; - error_stream = default_bool_arg(error_stream); + error_stream = default_null_arg(error_stream); std_error = if3(error_stream == t, std_output, or2(error_stream, std_null)); parser_common_init(&parser); @@ -501,11 +501,11 @@ static val lisp_parse_impl(val interactive, val source_in, val error_stream, val error_return_val, val name_in, val lineno) { uses_or2; - val source = default_bool_arg(source_in); + val source = default_null_arg(source_in); val input_stream = if3(stringp(source), make_string_byte_input_stream(source), or2(source, std_input)); - val name = or2(default_bool_arg(name_in), + val name = or2(default_null_arg(name_in), if3(stringp(source), lit("string"), stream_get_prop(input_stream, name_k))); @@ -518,7 +518,7 @@ static val lisp_parse_impl(val interactive, val source_in, val error_stream, dyn_env = make_env(nil, nil, dyn_env); - error_stream = default_bool_arg(error_stream); + error_stream = default_null_arg(error_stream); error_stream = if3(error_stream == t, std_output, or2(error_stream, std_null)); class_check (error_stream, stream_s); @@ -117,8 +117,8 @@ val make_random_state(val seed, val warmup) struct rand_state *r = coerce(struct rand_state *, cobj_handle(rs, random_state_s)); - seed = default_bool_arg(seed); - warmup = default_bool_arg(warmup); + seed = default_null_arg(seed); + warmup = default_null_arg(warmup); if (bignump(seed)) { int dig, bit; @@ -2104,7 +2104,7 @@ val regex_compile(val regex_sexp, val error_stream) val regex_source; if (stringp(regex_sexp)) { - regex_sexp = regex_parse(regex_sexp, default_bool_arg(error_stream)); + regex_sexp = regex_parse(regex_sexp, default_null_arg(error_stream)); return if2(regex_sexp, regex_compile(regex_sexp, error_stream)); } @@ -2458,7 +2458,7 @@ val search_regex(val haystack, val needle_regex, val start, { val slen = nil; start = default_arg(start, zero); - from_end = default_bool_arg(from_end); + from_end = default_null_arg(from_end); if (minusp(start)) { slen = length_str(haystack); @@ -2965,7 +2965,7 @@ val read_until_match(val regex, val stream_in, val include_match_in) val stack = nil; val match = nil; val stream = default_arg(stream_in, std_input); - val include_match = default_bool_arg(include_match_in); + val include_match = default_null_arg(include_match_in); regex_machine_init(®m, regex); @@ -787,7 +787,7 @@ static val sock_connect(val sock, val sockaddr, val timeout) sockaddr_pack(sockaddr, family, &sa, &salen); if (to_connect(c_num(sfd), coerce(struct sockaddr *, &sa), salen, - sock, sockaddr, default_bool_arg(timeout)) != 0) + sock, sockaddr, default_null_arg(timeout)) != 0) uw_throwf(socket_error_s, lit("sock-connect ~s to addr ~s: ~d/~s"), sock, sockaddr, num(errno), string_utf8(strerror(errno)), nao); @@ -861,7 +861,7 @@ static val sock_accept(val sock, val mode_str, val timeout_in) struct sockaddr_storage sa; socklen_t salen = sizeof sa; val peer = nil; - val timeout = default_bool_arg(timeout_in); + val timeout = default_null_arg(timeout_in); if (!sfd) goto badfd; @@ -2584,7 +2584,7 @@ val record_adapter(val regex, val stream, val include_match) rec_adapter->co.handle); rb->regex = regex; - rb->include_match = default_bool_arg(include_match); + rb->include_match = default_null_arg(include_match); return rec_adapter; } @@ -3557,7 +3557,7 @@ val get_string(val stream_in, val nchars, val close_after_p) { val stream = default_arg(stream_in, std_input); val strstream = make_string_output_stream(); - nchars = default_bool_arg(nchars); + nchars = default_null_arg(nchars); val ch; if (nchars) { @@ -3633,7 +3633,7 @@ val open_tail(val path, val mode_str, val seek_end_p) val stream; unsigned long state = 0; - if (f && default_bool_arg(seek_end_p)) + if (f && default_null_arg(seek_end_p)) if (fseek(f, 0, SEEK_END) < 0) uw_throwf(file_error_s, lit("error seeking to end of ~a: ~d/~s"), path, num(errno), string_utf8(strerror(errno)), nao); @@ -3755,7 +3755,7 @@ val open_process(val name, val mode_str, val args) struct save_fds sfds; val ret = nil; - args = default_bool_arg(args); + args = default_null_arg(args); nargs = c_num(length(args)) + 1; fds_init(&sfds); @@ -3937,7 +3937,7 @@ static val win_make_cmdline(val args) val open_process(val name, val mode_str, val args) { - val win_cmdline = win_make_cmdline(cons(name, default_bool_arg(args))); + val win_cmdline = win_make_cmdline(cons(name, default_null_arg(args))); return open_command(win_cmdline, mode_str); } #endif @@ -3952,7 +3952,7 @@ static val run(val name, val args) struct save_fds sfds; val ret = nil; - args = default_bool_arg(args); + args = default_null_arg(args); nargs = c_num(length(args)) + 1; argv = coerce(char **, chk_malloc((nargs + 1) * sizeof *argv)); @@ -4023,7 +4023,7 @@ static val run(val command, val args) int i, nargs, status; struct save_fds sfds; - args = default_bool_arg(args); + args = default_null_arg(args); nargs = c_num(length(args)) + 1; fds_init(&sfds); @@ -4083,7 +4083,7 @@ val rename_path(val from, val to) static val open_files(val file_list, val substitute_stream) { - substitute_stream = default_bool_arg(substitute_stream); + substitute_stream = default_null_arg(substitute_stream); if (nilp(file_list) && substitute_stream) { return substitute_stream; @@ -4094,7 +4094,7 @@ static val open_files(val file_list, val substitute_stream) static val open_files_star(val file_list, val substitute_stream) { - substitute_stream = default_bool_arg(substitute_stream); + substitute_stream = default_null_arg(substitute_stream); if (nilp(file_list) && substitute_stream) { return substitute_stream; @@ -289,7 +289,7 @@ val make_struct_type(val name, val super, st->stinitfun = static_initfun; st->initfun = initfun; st->boactor = boactor; - st->postinitfun = default_bool_arg(postinitfun); + st->postinitfun = default_null_arg(postinitfun); st->dvtypes = nil; gc_finalize(stype, struct_type_finalize_f, nil); @@ -637,7 +637,7 @@ val clear_struct(val strct, val value) const val self = lit("clear-struct"); struct struct_inst *si = struct_handle(strct, self); struct struct_type *st = si->type; - val clear_val = default_bool_arg(value); + val clear_val = default_null_arg(value); cnum i; check_init_lazy_struct(strct, si); @@ -1046,7 +1046,7 @@ static val static_slot_ens_rec(val stype, val sym, val newval, uw_throwf(error_s, lit("~a: ~s isn't a valid slot name"), self, sym, nao); - no_error_p = default_bool_arg(no_error_p); + no_error_p = default_null_arg(no_error_p); if (st->eqmslot == coerce(struct stslot *, -1)) st->eqmslot = 0; @@ -1129,7 +1129,7 @@ val static_slot_ensure(val stype, val sym, val newval, val no_error_p) trace_check(name); } - no_error_p = default_bool_arg(no_error_p); + no_error_p = default_null_arg(no_error_p); return static_slot_ens_rec(stype, sym, newval, no_error_p, self, 0); } @@ -112,7 +112,7 @@ static val at_exit_list; static val errno_wrap(val newval) { val oldval = num(errno); - if (default_bool_arg(newval)) + if (default_null_arg(newval)) errno = c_num(newval); return oldval; } @@ -558,7 +558,7 @@ static val dup_wrap(val old, val neu) val exec_wrap(val file, val args_opt) { - val args = default_bool_arg(args_opt); + val args = default_null_arg(args_opt); int nargs = c_num(length(args)) + 1; char **argv = coerce(char **, chk_malloc((nargs + 1) * sizeof *argv)); val iter; @@ -344,7 +344,7 @@ static val uw_find_frames_impl(val extype, val frtype, val just_one) uw_frtype_t et; list_collect_decl (out, ptail); - extype = default_bool_arg(extype); + extype = default_null_arg(extype); frtype = default_arg_strict(frtype, catch_frame_type); if (symbolp(frtype)) { @@ -987,7 +987,7 @@ val uw_capture_cont(val tag, val fun, val ctx_form) break; case UW_GUARD: { - val sym = or2(car(default_bool_arg(ctx_form)), sys_capture_cont_s); + val sym = or2(car(default_null_arg(ctx_form)), sys_capture_cont_s); eval_error(ctx_form, lit("~s: cannot capture continuation " "spanning external library stack frames"), sym, nao); @@ -1000,7 +1000,7 @@ val uw_capture_cont(val tag, val fun, val ctx_form) } if (!fr) { - val sym = or2(car(default_bool_arg(ctx_form)), sys_capture_cont_s); + val sym = or2(car(default_null_arg(ctx_form)), sys_capture_cont_s); if (tag) eval_error(ctx_form, lit("~s: no block ~s is visible"), sym, tag, nao); |