summaryrefslogtreecommitdiffstats
path: root/stream.h
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2016-03-19 06:43:59 -0700
committerKaz Kylheku <kaz@kylheku.com>2016-03-19 06:43:59 -0700
commitd23a45711a9c6864f7c4adf962499fe3d1a4adb5 (patch)
tree5a8e0fe23cf069149181b52a772038333bf280ec /stream.h
parent54ab368d20df1796106e2dae222a3b926c331dd9 (diff)
downloadtxr-d23a45711a9c6864f7c4adf962499fe3d1a4adb5.tar.gz
txr-d23a45711a9c6864f7c4adf962499fe3d1a4adb5.tar.bz2
txr-d23a45711a9c6864f7c4adf962499fe3d1a4adb5.zip
Buffer size digit in file open mode string.
* streamn.c (struct stdio_handle): New member, buf. (stdio_stream_destroy): Free the stdio_handle's buf. (parse_mode): Handle digit character, converting it to integer value stored in m.buforder. (set_mode_props): Allocate a buffer and install into FILE * stream if the mode specifies a buforder. (make_stdio_stream_common): Initialize buffer to null. * stream.h (struct stdio_mode): New signed bitfield member, buforder. (stdio_mode_init_trivial): Initialize buforder member to -1. * txr.1: Documented size order digit.
Diffstat (limited to 'stream.h')
-rw-r--r--stream.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/stream.h b/stream.h
index 2474ce13..f0c6433a 100644
--- a/stream.h
+++ b/stream.h
@@ -92,9 +92,10 @@ struct stdio_mode {
unsigned interactive : 1;
unsigned unbuf : 1;
unsigned linebuf : 1;
+ int buforder : 5;
};
-#define stdio_mode_init_trivial(read) { 0, read, 0, 0, 0, 0, 0, 0, 0 }
+#define stdio_mode_init_trivial(read) { 0, read, 0, 0, 0, 0, 0, 0, 0, -1 }
#define std_input (deref(lookup_var_l(nil, stdin_s)))
#define std_output (deref(lookup_var_l(nil, stdout_s)))