Mask output in pipe
This commit is contained in:
parent
34d2d828be
commit
b77f3dd03b
|
@ -17,6 +17,7 @@ typedef struct hbu_pipe_s {
|
|||
hbu_fstreamin_t input;
|
||||
void *output;
|
||||
hbu_pipe_writer_cb_t writer;
|
||||
int output_masked;
|
||||
|
||||
hbu_buffer_t buffer;
|
||||
|
||||
|
@ -116,8 +117,10 @@ static void _hbu_pipe_assert_not_eoi(hbu_pipe_t pipe, hb_eod_char_t c) {
|
|||
}
|
||||
|
||||
static void _hbu_pipe_write_to_output(hbu_pipe_t pipe, hb_char_t c) {
|
||||
if (!pipe->output_masked) {
|
||||
(*pipe->writer)(pipe->output, c);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
|
@ -130,6 +133,7 @@ hbu_pipe_t hbu_pipe_create(hbu_fstreamin_t input, void *output, hbu_pipe_writer_
|
|||
pipe->input = input;
|
||||
pipe->output = output;
|
||||
pipe->writer = writer;
|
||||
pipe->output_masked = 0;
|
||||
|
||||
pipe->buffer = hbu_buffer_create();
|
||||
|
||||
|
@ -146,6 +150,10 @@ void hbu_pipe_destroy(hbu_pipe_t pipe) {
|
|||
free(pipe);
|
||||
}
|
||||
|
||||
void hbu_pipe_toggle_output_mask(hbu_pipe_t pipe, int output_masked) {
|
||||
pipe->output_masked = output_masked;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
* BUILDER FUNCTIONS
|
||||
|
|
Loading…
Reference in New Issue