summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2016-03-06 15:49:08 -0800
committerKaz Kylheku <kaz@kylheku.com>2016-03-06 15:59:03 -0800
commit1adb7248a1a1b7091f0a9faa10edd0d873afa525 (patch)
tree006c3a898d4348f21b16ab5e6c2b9af72e0cbe98
parentfbb8a014d14fc8887529f344b128900dfc581a4d (diff)
downloadtxr-1adb7248a1a1b7091f0a9faa10edd0d873afa525.tar.gz
txr-1adb7248a1a1b7091f0a9faa10edd0d873afa525.tar.bz2
txr-1adb7248a1a1b7091f0a9faa10edd0d873afa525.zip
Make stdio_mode type public.
* stream.c (struct stdio_mode, stdio_mode_init_trivial): Struct declaration and macro removed from here; moved into stream.h. (normalize_mode, set_mode_props): Static functions made external. * stream.h (struct stdio_mode, stdio_mode_init_trivial): Moved here. (normalize_mode, set_mode_props): Declared.
-rw-r--r--stream.c16
-rw-r--r--stream.h14
2 files changed, 16 insertions, 14 deletions
diff --git a/stream.c b/stream.c
index e1cc7c58..ead5dada 100644
--- a/stream.c
+++ b/stream.c
@@ -1064,18 +1064,6 @@ static struct strm_ops pipe_ops =
stdio_get_error_str,
stdio_clear_error);
-struct stdio_mode {
- int malformed;
- int read;
- int write;
- int create;
- int append;
- int binary;
- int interactive;
-};
-
-#define stdio_mode_init_trivial(read) { 0, read, 0, 0, 0, 0, 0 }
-
static struct stdio_mode parse_mode(val mode_str)
{
struct stdio_mode m = stdio_mode_init_trivial(0);
@@ -1153,7 +1141,7 @@ static val format_mode(const struct stdio_mode m)
return string(buf);
}
-static val normalize_mode(struct stdio_mode *m, val mode_str)
+val normalize_mode(struct stdio_mode *m, val mode_str)
{
struct stdio_mode blank = stdio_mode_init_trivial(1);
@@ -1173,7 +1161,7 @@ static val normalize_mode(struct stdio_mode *m, val mode_str)
}
}
-static val set_mode_props(const struct stdio_mode m, val stream)
+val set_mode_props(const struct stdio_mode m, val stream)
{
if (m.interactive)
stream_set_prop(stream, real_time_k, t);
diff --git a/stream.h b/stream.h
index ff5ee9f8..14517de8 100644
--- a/stream.h
+++ b/stream.h
@@ -81,6 +81,18 @@ struct strm_ops {
get_error, get_error_str, clear_error, 0, 0, 0, 0, \
}
+struct stdio_mode {
+ int malformed;
+ int read;
+ int write;
+ int create;
+ int append;
+ int binary;
+ int interactive;
+};
+
+#define stdio_mode_init_trivial(read) { 0, read, 0, 0, 0, 0, 0 }
+
#define std_input (deref(lookup_var_l(nil, stdin_s)))
#define std_output (deref(lookup_var_l(nil, stdout_s)))
#define std_debug (deref(lookup_var_l(nil, stddebug_s)))
@@ -110,6 +122,8 @@ void fill_stream_ops(struct strm_ops *ops);
void stream_print_op(val stream, val out, val pretty);
void stream_mark_op(val stream);
void stream_destroy_op(val stream);
+val normalize_mode(struct stdio_mode *m, val mode_str);
+val set_mode_props(const struct stdio_mode m, val stream);
val make_null_stream(void);
val make_stdio_stream(FILE *, val descr);
val make_tail_stream(FILE *, val descr);