summaryrefslogtreecommitdiffstats
path: root/stream.h
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2016-03-07 21:37:09 -0800
committerKaz Kylheku <kaz@kylheku.com>2016-03-07 21:37:09 -0800
commitb88a274b42bc32b043a31c8e10cdbd47d4efab11 (patch)
tree50125515cd1b5a150e03e55fdc77f6fc92e3eb5b /stream.h
parent93ee756f0b8951d7f6a2972c6c8dc05e890917a7 (diff)
downloadtxr-b88a274b42bc32b043a31c8e10cdbd47d4efab11.tar.gz
txr-b88a274b42bc32b043a31c8e10cdbd47d4efab11.tar.bz2
txr-b88a274b42bc32b043a31c8e10cdbd47d4efab11.zip
Revamped naming for socket streams.
* socket.c (struct dgram_stream): New member, addr. (make_dgram_sock_stream): Initialize addr to nil. (dgram_print): Instead of printing the numeric fd, print the stream description, obtained from the name_k property. (dgram_mark): Mark the addr member. (dgram_get_prop): Calculate a descriptive string from the dgram stream state for the name_k property. (dgram_set_prop): New static function. (dgram_strm_ops): Name change to dgram-sock. Wire in dgram_set_prop function. (sock_bind): Set the addr_k property of the stream to the local address that was just bound. * stream.c (addr_k): New keyword symbol variable. (stdio_handle): New member, addr. (stdio_stream_print): Obtain descr by calling get_prop method rather than directly from h->descr, in case it is dynamically computed. Use ~a rather than ~s for incorporating string properties into printed form, to eliminate quotes. (stdio_stream_mark): Mark new addr member. (sock_get_prop, sock_set_prop): New static functions. (stdio_set_sock_peer): Invalidate h->descr by setting it to nil. (make_stdio_stream_common): Initialize h->addr to nil. (make_sock_stream): Specify description as nil rather than "socket". (stream_init): Intern the addr keyword, and initialize the addr_k variable. Set the name of stdio_sock_ops to "stream-sock" rather than leaving it inherited as "file-stream". Wire in the sock_get_prop and sock_set_prop functions into stdio_sock_ops. * stream.h (addr_k): Declared.
Diffstat (limited to 'stream.h')
-rw-r--r--stream.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/stream.h b/stream.h
index 011fcb38..b96a0ae6 100644
--- a/stream.h
+++ b/stream.h
@@ -102,7 +102,7 @@ struct stdio_mode {
loc lookup_var_l(val env, val sym);
extern val from_start_k, from_current_k, from_end_k;
-extern val real_time_k, name_k, fd_k;
+extern val real_time_k, name_k, addr_k, fd_k;
extern val format_s;
extern val stdio_stream_s;