From b88a274b42bc32b043a31c8e10cdbd47d4efab11 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Mon, 7 Mar 2016 21:37:09 -0800 Subject: 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. --- stream.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'stream.h') 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; -- cgit v1.2.3