From d0fb65120c75b0d264b6300da3295875f0225a2e Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Thu, 4 Jul 2019 07:14:25 -0700 Subject: Expose make-byte-input-stream. * stream.c (stream_init): Register make-byte-input-stream intrinsic. * txr.1: Documented. --- stream.c | 1 + txr.1 | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/stream.c b/stream.c index 027c1c94..ec9a7f66 100644 --- a/stream.c +++ b/stream.c @@ -4690,6 +4690,7 @@ void stream_init(void) reg_fun(intern(lit("get-string-from-stream"), user_package), func_n1(get_string_from_stream)); reg_fun(intern(lit("make-strlist-output-stream"), user_package), func_n0(make_strlist_output_stream)); reg_fun(intern(lit("get-list-from-stream"), user_package), func_n1(get_list_from_stream)); + reg_fun(intern(lit("make-byte-input-stream"), user_package), func_n1(make_byte_input_stream)); reg_fun(intern(lit("close-stream"), user_package), func_n2o(close_stream, 1)); reg_fun(get_error_s, func_n1(get_error)); reg_fun(get_error_str_s, func_n1(get_error_str)); diff --git a/txr.1 b/txr.1 index 3989c5ca..5bc1622c 100644 --- a/txr.1 +++ b/txr.1 @@ -47306,6 +47306,37 @@ from the string output stream, as if by the function, and returned as the result value of the form. +.coNP Function @ make-byte-input-stream +.synb +.mets (make-byte-input-stream << obj ) +.syne +.desc +The +.code make-byte-input-stream +creates a stream which supports the +.code get-byte +operation for traversing a byte-wise representation of +.metn obj . + +The function serves as a generic interface for calling one of +several other stream constructing functions based on the +type of the +.meta obj +argument. + +The +.meta obj +argument must be either a buffer, in which case +.code make-byte-input-stream +behaves like +.codn make-buf-stream , +or else a string, in which case the function behaves like +.codn make-string-byte-input-stream . + +Note: the repertoire of types handled by +.code make-byte-input-stream +may expand in future language versions. + .coNP Function @ close-stream .synb .mets (close-stream < stream <> [ throw-on-error-p ]) -- cgit v1.2.3