diff options
author | Adrian Thurston <thurston@colm.net> | 2019-05-22 18:51:58 -0400 |
---|---|---|
committer | Adrian Thurston <thurston@colm.net> | 2019-05-22 18:51:58 -0400 |
commit | 11bcbbea88466f75990314f58dcc66cbf76ab75b (patch) | |
tree | dd74b0a9a1b8e2ab59a178983564f5032655fd4b /src/input.c | |
parent | eebed98e759b328f0f0e8ef2fd0afe8f2adf2720 (diff) | |
download | colm-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.c')
-rw-r--r-- | src/input.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/input.c b/src/input.c index a0b7a337..4a7d9124 100644 --- a/src/input.c +++ b/src/input.c @@ -196,11 +196,18 @@ static void input_stream_seq_prepend( struct input_impl_seq *is, struct seq_buf } } +static void input_auto_trim( struct colm_program *prg, struct input_impl_seq *ii, int auto_trim ) +{ + ii->auto_trim = auto_trim ? 1 : 0; +} + + void input_set_eof_mark( struct colm_program *prg, struct input_impl_seq *si, char eof_mark ) { si->eof_mark = eof_mark; } + static void input_destructor( program_t *prg, tree_t **sp, struct input_impl_seq *si ) { struct seq_buf *buf = si->queue.head; @@ -686,6 +693,9 @@ struct input_funcs_seq input_funcs = &input_append_stream, &input_undo_append_stream, + /* Trimming */ + &input_auto_trim, + /* EOF */ &input_set_eof_mark, |