summaryrefslogtreecommitdiffstats
path: root/stream.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2014-02-05 16:36:33 -0800
committerKaz Kylheku <kaz@kylheku.com>2014-02-05 16:36:33 -0800
commit227f0d19dc5313edbebbb56ba6b4966012a2370e (patch)
treee134458589904e1b9444d3cf59e6d5abc74d98e3 /stream.c
parent68c084269581f32f0a7b859446ae2efb6c6a26c0 (diff)
downloadtxr-227f0d19dc5313edbebbb56ba6b4966012a2370e.tar.gz
txr-227f0d19dc5313edbebbb56ba6b4966012a2370e.tar.bz2
txr-227f0d19dc5313edbebbb56ba6b4966012a2370e.zip
* arith.c (lognot): Conform to new scheme for defaulting optional args.
* eval.c (apply): Unconditionally use colon_k for missing optional args, for intrinsic functions. (eval_intrinsic, rangev, rangev_star, errno_wrap): Conform to new scheme for defaulting optional args. (reg_fun_mark): Function removed. (eval_init): Switch reduce_left and reduce_right back to reg_fun registration. * hash.c (gethash_n): Conform to new scheme for defaulting optional arguments. * lib.c (sub_list, replace_list, remove_if, keep_if, remove_if_lazy, keep_if_lazy, tree_find, count_if, some_satisfy, all_satisfy, none_satisfy, search_str, match_str, match_str_tree, sub_str, replace_str, cat_str, tok_str, intern, rehome_sym, sub_vec, replace_vec, lazy_str, sort, multi_sort, find, find_if, set_diff, obj_print, obj_pprint): Conform to new scheme for defaulting optional arguments. (func_f0, func_f1, func_f2, func_f3, func_f4, func_n0, func_n1, func_n2, func_n3, func_n4, func_n5, func_n6, func_n7, func_f0v, func_f1v, func_f2v, func_f3v, func_f4v, func_n0v, func_n1v, func_n2v, func_n3v, func_n4v, func_n5v, func_n6v, func_n7v): Remove references to removed mark_missing_args member of struct func. (func_set_mark_missing): Function removed. (generic_funcall): Unconditionally use colon_k for missing optional args, for intrinsic functions. * lib.h (struct func): mark_missing_args member removed. (func_set_mark_missing): Declaration removed. (default_arg, default_bool_arg): New inline functions. * rand.c (random): Left argument is not optional. (rnd): Conform to new scheme for defaulting optional arguments. * regex.c (search_regex, match_regex): Conform to new scheme for defaulting optional arguments. * stream.c (unget_char, unget_byte, put_string, put_char, put_byte, put_line): Conform to new scheme for defaulting optional arguments. * syslog.c (openlog_wrap): Conform to new scheme for defaulting optional arguments. * txr.1: Remove the specification that nil is a sentinel value in default arguments, where necessary. Use consistent syntax for specifying variable parts in argument lists. A few errors and omissions addressed.
Diffstat (limited to 'stream.c')
-rw-r--r--stream.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/stream.c b/stream.c
index be78229d..9dd0b742 100644
--- a/stream.c
+++ b/stream.c
@@ -1358,8 +1358,7 @@ val get_byte(val stream)
val unget_char(val ch, val stream)
{
- if (!stream)
- stream = std_input;
+ stream = default_arg(stream, std_input);
type_check (stream, COBJ);
type_assert (stream->co.cls == stream_s, (lit("~a is not a stream"),
@@ -1375,8 +1374,7 @@ val unget_byte(val byte, val stream)
{
cnum b = c_num(byte);
- if (!stream)
- stream = std_input;
+ stream = default_arg(stream, std_input);
type_check (stream, COBJ);
type_assert (stream->co.cls == stream_s, (lit("~a is not a stream"),
@@ -1919,8 +1917,7 @@ val formatv(val stream, val string, val args)
val put_string(val string, val stream)
{
- if (!stream)
- stream = std_output;
+ stream = default_arg(stream, std_output);
type_check (stream, COBJ);
type_assert (stream->co.cls == stream_s, (lit("~a is not a stream"),
@@ -1934,8 +1931,7 @@ val put_string(val string, val stream)
val put_char(val ch, val stream)
{
- if (!stream)
- stream = std_output;
+ stream = default_arg(stream, std_output);
type_check (stream, COBJ);
type_assert (stream->co.cls == stream_s, (lit("~a is not a stream"),
@@ -1951,8 +1947,7 @@ val put_byte(val byte, val stream)
{
cnum b = c_num(byte);
- if (!stream)
- stream = std_output;
+ stream = default_arg(stream, std_output);
type_check (stream, COBJ);
type_assert (stream->co.cls == stream_s, (lit("~a is not a stream"),
@@ -1968,7 +1963,6 @@ val put_byte(val byte, val stream)
}
}
-
val put_line(val string, val stream)
{
return (put_string(string, stream), put_char(chr('\n'), stream));
@@ -2118,7 +2112,10 @@ val open_process(val name, val mode_str, val args)
pid_t pid;
char **argv = 0, *utf8name = 0;
val iter;
- int i, nargs = c_num(length(args));
+ int i, nargs;
+
+ args = default_bool_arg(args);
+ nargs = c_num(length(args));
if (pipe(fd) == -1) {
uw_throwf(file_error_s, lit("opening pipe ~a, pipe syscall failed: ~a/~s"),