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 /eval.c | |
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 'eval.c')
-rw-r--r-- | eval.c | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -2338,6 +2338,7 @@ void eval_init(void) 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("flush-stream"), user_package), func_n1(flush_stream)); + reg_fun(intern(lit("seek-stream"), user_package), func_n3(seek_stream)); reg_fun(intern(lit("stat"), user_package), func_n1(statf)); reg_var(intern(lit("s-ifmt"), user_package), &s_ifmt); |