diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2013-11-26 22:45:42 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2013-11-26 22:45:42 -0800 |
commit | 6fedaccfe790e33bb7a71d8a5f776e4cfa7e6c62 (patch) | |
tree | b74c6fde22e41c0b15e0b51060bc979a19efc97c /stream.h | |
parent | a56501891dcf01d4f68ab560eb24fa3406afe0e1 (diff) | |
download | txr-6fedaccfe790e33bb7a71d8a5f776e4cfa7e6c62.tar.gz txr-6fedaccfe790e33bb7a71d8a5f776e4cfa7e6c62.tar.bz2 txr-6fedaccfe790e33bb7a71d8a5f776e4cfa7e6c62.zip |
Stream-seeking functionality.
Bugfix in stdio_flush: check FILE * handle for null.
Minor cleanups.
* eval.c (eval_init): Register seek_stream as intrinsic.
* stream.c (from_start_k, from_current_k, from_end_k): New symbol
variables.
(strm_whence): New enum.
(strm_ops): New member, seek.
(stdio_maybe_write_error): Renamed to stdio_maybe_error; takes
new string argument to describe action.
(stdio_put_string, stdio_put_char, stdio_put_byte): Updated call to
stdio_maybe_error.
(stdio_flush): Updated call to stdio_maybe_error. Check
handle for null.
(stdio_seek): New static function.
(stdio_ops): Added stdio_seek.
(pipe_ops, string_in_ops, byte_in_ops, string_out_ops,
strlist_out_ops, dir_ops): Added explicit zero entries and comments for
unimplemented functions.
(seek_stream): New function.
(stream_init): New keyword symbols interned.
* stream.h (from_start_k, from_current_k, from_end_k): New
variables declared.
(dev_k, ino_k, mode_k, nlink_k, uid_k, gid_k, rdev_k, size_k,
blksize_k, blocks_k, atime_k, mtime_k, ctime_k, s_ifmt, s_iflnk,
s_ifreg, s_ifblk, s_ifdir, s_ifchr, s_ififo, s_isuid, s_isgid, s_isvtx,
s_irwxu, s_irusr, s_iwusr, s_ixusr, s_irwxg, s_irgrp,
s_iwgrp): Existing extern variables declared.
(seek_stream): New function declared.
* txr.1: Documented seek-stream.
Diffstat (limited to 'stream.h')
-rw-r--r-- | stream.h | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -27,6 +27,11 @@ extern val std_input, std_output, std_debug, std_error; extern val output_produced; +extern val dev_k, ino_k, mode_k, nlink_k, uid_k; +extern val gid_k, rdev_k, size_k, blksize_k, blocks_k; +extern val atime_k, mtime_k, ctime_k; +extern val from_start_k, from_current_k, from_end_k; + extern val s_ifmt, s_iflnk, s_ifreg, s_ifblk, s_ifdir; extern val s_ifchr, s_ififo, s_isuid, s_isgid, s_isvtx, s_irwxu; extern val s_irusr, s_iwusr, s_ixusr, s_irwxg, s_irgrp, s_iwgrp; @@ -55,6 +60,7 @@ val put_line(val string, val stream); val put_char(val ch, val stream); val put_byte(val byte, val stream); val flush_stream(val stream); +val seek_stream(val stream, val offset, val whence); val statf(val path); val open_directory(val path); val open_file(val path, val mode_str); |