diff options
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | stream.c | 4 | ||||
-rw-r--r-- | txr.1 | 5 |
3 files changed, 13 insertions, 4 deletions
@@ -1,3 +1,11 @@ +2014-03-05 Kaz Kylheku <kaz@kylheku.com> + + * stream.c (put_line): Default string argument to empty string. + (stream_init): Change how put_line is registered to take advantage of + new optional parameter. + + * txr.1: Updated. + 2014-03-04 Kaz Kylheku <kaz@kylheku.com> * arith.c (logten): New function. @@ -1968,7 +1968,7 @@ val put_byte(val byte, val stream) val put_line(val string, val stream) { - return (put_string(string, stream), put_char(chr('\n'), stream)); + return (put_string(default_arg(string, null_string), stream), put_char(chr('\n'), stream)); } val flush_stream(val stream) @@ -2678,7 +2678,7 @@ void stream_init(void) reg_fun(intern(lit("get-char"), user_package), func_n1o(get_char, 0)); reg_fun(intern(lit("get-byte"), user_package), func_n1o(get_byte, 0)); reg_fun(intern(lit("put-string"), user_package), func_n2o(put_string, 1)); - reg_fun(intern(lit("put-line"), user_package), func_n2o(put_line, 1)); + reg_fun(intern(lit("put-line"), user_package), func_n2o(put_line, 0)); reg_fun(intern(lit("put-char"), user_package), func_n2o(put_char, 1)); reg_fun(intern(lit("put-byte"), user_package), func_n2o(put_byte, 1)); reg_fun(intern(lit("unget-char"), user_package), func_n2o(unget_char, 1)); @@ -11628,7 +11628,7 @@ indeterminate. .TP Syntax: - (put-line <string> [<stream>]) + (put-line [<string> [<stream>]]) (put-string <string> [<stream>]) (put-char <char> [<stream>]) (put-byte <byte> [<stream>]) @@ -11645,7 +11645,8 @@ stream is based on bytes, then the character is encoded into UTF-8 and multiple bytes are written. Streams which support put-char also support put-line, and put-string. The put-string function writes the characters of a string out to the stream as if by multiple calls to put-char. The put-line function is like -put-string, but also writes an additional newline character. +put-string, but also writes an additional newline character. The string +is optional in put-line, and defaults to the empty string. The put-byte function writes a raw byte given by the <byte> argument to <stream>, if <stream> supports a byte write operation. The byte |