diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2016-03-06 16:01:40 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2016-03-06 16:26:42 -0800 |
commit | 06691c2d75d27d6ac9d3bb1d3671f9626d41ee80 (patch) | |
tree | b6f5572920c420bb3a1aad8a3abf8640ec62c096 /stream.h | |
parent | 1adb7248a1a1b7091f0a9faa10edd0d873afa525 (diff) | |
download | txr-06691c2d75d27d6ac9d3bb1d3671f9626d41ee80.tar.gz txr-06691c2d75d27d6ac9d3bb1d3671f9626d41ee80.tar.bz2 txr-06691c2d75d27d6ac9d3bb1d3671f9626d41ee80.zip |
Access to file descriptor now via stream virtual.
* stream.c (unimpl_get_fd, null_get_fd): New static functions.
(fill_stream_ops): Set up get_fd function pointer in
strm_ops.
(null_ops): Add null_get_fd.
(stdio_get_fd): New static function.
(stdio_ops, tail_ops, pipe_ops): Specify stdio_get_fd as get_fd
function.
(stream_fd): Rewritten as call to get_fd operation.
(dir_ops, string_in_ops, byte_in_ops, string_out_ops,
strlist_out_ops, cat_stream_ops): Specify null as get_fd
function, to be defaulted by fill_stream_ops.
(delegate_get_fd): New static function.
(record_adapter_ops): Specify delegate_get_fd as get_fd
function.
(stream_init): Change fileno intrinsic registration to point
to stream_fd function.
* stream.h (struct strm_ops): New member, get_fd.
(strm_ops_init): New macro parameter, get_fd.
* syslog.c (syslog_strm_ops): Specify null as get_fd
function.
Diffstat (limited to 'stream.h')
-rw-r--r-- | stream.h | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -64,6 +64,7 @@ struct strm_ops { val (*get_error)(val); val (*get_error_str)(val); val (*clear_error)(val); + val (*get_fd)(val); val (*get_sock_family)(val); val (*get_sock_type)(val); val (*get_sock_peer)(val); @@ -73,12 +74,12 @@ struct strm_ops { #define strm_ops_init(cobj_init_macro, name, put_string, put_char, put_byte, \ get_line, get_char, get_byte, unget_char, unget_byte, \ close, flush, seek, truncate, get_prop, set_prop, \ - get_error, get_error_str, clear_error) \ + get_error, get_error_str, clear_error, get_fd) \ { \ cobj_init_macro, name, put_string, put_char, put_byte, get_line, \ get_char, get_byte, unget_char, unget_byte, \ close, flush, seek, truncate, get_prop, set_prop, \ - get_error, get_error_str, clear_error, 0, 0, 0, 0, \ + get_error, get_error_str, clear_error, get_fd, 0, 0, 0, 0 \ } struct stdio_mode { |