summaryrefslogtreecommitdiff
path: root/src/input.h
diff options
context:
space:
mode:
authorAdrian Thurston <thurston@colm.net>2019-05-22 18:51:58 -0400
committerAdrian Thurston <thurston@colm.net>2019-05-22 18:51:58 -0400
commit11bcbbea88466f75990314f58dcc66cbf76ab75b (patch)
treedd74b0a9a1b8e2ab59a178983564f5032655fd4b /src/input.h
parenteebed98e759b328f0f0e8ef2fd0afe8f2adf2720 (diff)
downloadcolm-11bcbbea88466f75990314f58dcc66cbf76ab75b.tar.gz
added and auto_trim flag to stream anad input
When set to true, all tree prints to the stream or sends to the input will result in a trim. Achieved by passing trim to the generic print.
Diffstat (limited to 'src/input.h')
-rw-r--r--src/input.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/input.h b/src/input.h
index 6e3b16b6..58f0e2ae 100644
--- a/src/input.h
+++ b/src/input.h
@@ -76,6 +76,7 @@ struct input_funcs \
struct colm_tree *(*undo_append_tree)( struct colm_program *prg, struct _input_impl *si ); \
void (*append_stream)( struct colm_program *prg, struct _input_impl *si, struct colm_stream *stream ); \
struct colm_tree *(*undo_append_stream)( struct colm_program *prg, struct _input_impl *si ); \
+ void (*auto_trim)( struct colm_program *prg, struct _input_impl *si, int auto_trim ); \
void (*set_eof_mark)( struct colm_program *prg, struct _input_impl *si, char eof_mark ); \
void (*transfer_loc)( struct colm_program *prg, struct colm_location *loc, struct _input_impl *si ); \
void (*destructor)( struct colm_program *prg, struct colm_tree **sp, struct _input_impl *si ); \
@@ -93,6 +94,7 @@ struct stream_funcs \
struct colm_str_collect *(*get_collect)( struct colm_program *prg, struct _stream_impl *si ); \
void (*flush_stream)( struct colm_program *prg, struct _stream_impl *si ); \
void (*close_stream)( struct colm_program *prg, struct _stream_impl *si ); \
+ void (*auto_trim)( struct colm_program *prg, struct _stream_impl *si, int auto_trim ); \
void (*print_tree)( struct colm_program *prg, struct colm_tree **sp, \
struct _stream_impl *impl, struct colm_tree *tree, int trim ); \
struct stream_impl *(*split_consumed)( struct colm_program *prg, struct _stream_impl *si ); \
@@ -149,6 +151,7 @@ struct input_impl_seq
struct seq_buf *stash;
int consumed;
+ int auto_trim;
};
struct run_buf
@@ -196,6 +199,8 @@ struct stream_impl_data
int *line_len;
int lines_alloc;
int lines_cur;
+
+ int auto_trim;
};
void stream_impl_push_line( struct stream_impl_data *ss, int ll );