summaryrefslogtreecommitdiff
path: root/src/input.h
diff options
context:
space:
mode:
authorAdrian Thurston <thurston@colm.net>2018-07-13 09:59:05 +0800
committerAdrian Thurston <thurston@colm.net>2018-07-13 09:59:05 +0800
commit62007044d100c310a5f293e96e9376957cb38588 (patch)
tree6eda1eb6a1087d6225bdba3e579512690da2ba05 /src/input.h
parent6cd5ad2ab54bfef99a8372c8de34a58ea5184754 (diff)
downloadcolm-62007044d100c310a5f293e96e9376957cb38588.tar.gz
delegate splitting to the stream_impl class
Diffstat (limited to 'src/input.h')
-rw-r--r--src/input.h73
1 files changed, 37 insertions, 36 deletions
diff --git a/src/input.h b/src/input.h
index e4cfbde4..13435b4e 100644
--- a/src/input.h
+++ b/src/input.h
@@ -82,49 +82,50 @@ struct run_buf
struct run_buf *new_run_buf( int sz );
-#define DEF_INPUT_FUNCS( input_funcs, input_impl ) \
+#define DEF_INPUT_FUNCS( input_funcs, _input_impl ) \
struct input_funcs \
{ \
- int (*get_parse_block)( struct colm_program *prg, struct input_impl *si, int *pskip, char **pdp, int *copied ); \
- int (*get_data)( struct colm_program *prg, struct input_impl *si, char *dest, int length ); \
- int (*consume_data)( struct colm_program *prg, struct input_impl *si, int length, struct colm_location *loc ); \
- int (*undo_consume_data)( struct colm_program *prg, struct input_impl *si, const char *data, int length ); \
- struct colm_tree *(*consume_tree)( struct colm_program *prg, struct input_impl *si ); \
- void (*undo_consume_tree)( struct colm_program *prg, struct input_impl *si, struct colm_tree *tree, int ignore ); \
- struct LangEl *(*consume_lang_el)( struct colm_program *prg, struct input_impl *si, long *bind_id, char **data, long *length ); \
- void (*undo_consume_lang_el)( struct colm_program *prg, struct input_impl *si ); \
- void (*prepend_data)( struct colm_program *prg, struct input_impl *si, const char *data, long len ); \
- int (*undo_prepend_data)( struct colm_program *prg, struct input_impl *si, int length ); \
- void (*prepend_tree)( struct colm_program *prg, struct input_impl *si, struct colm_tree *tree, int ignore ); \
- struct colm_tree *(*undo_prepend_tree)( struct colm_program *prg, struct input_impl *si ); \
- void (*prepend_stream)( struct colm_program *prg, struct input_impl *si, struct colm_stream *stream ); \
- struct colm_tree *(*undo_prepend_stream)( struct colm_program *prg, struct input_impl *si ); \
- void (*append_data)( struct colm_program *prg, struct input_impl *si, const char *data, long len ); \
- struct colm_tree *(*undo_append_data)( struct colm_program *prg, struct input_impl *si, int length ); \
- void (*append_tree)( struct colm_program *prg, struct input_impl *si, struct colm_tree *tree ); \
- 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 (*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 ); \
+ int (*get_parse_block)( struct colm_program *prg, struct _input_impl *si, int *pskip, char **pdp, int *copied ); \
+ int (*get_data)( struct colm_program *prg, struct _input_impl *si, char *dest, int length ); \
+ int (*consume_data)( struct colm_program *prg, struct _input_impl *si, int length, struct colm_location *loc ); \
+ int (*undo_consume_data)( struct colm_program *prg, struct _input_impl *si, const char *data, int length ); \
+ struct colm_tree *(*consume_tree)( struct colm_program *prg, struct _input_impl *si ); \
+ void (*undo_consume_tree)( struct colm_program *prg, struct _input_impl *si, struct colm_tree *tree, int ignore ); \
+ struct LangEl *(*consume_lang_el)( struct colm_program *prg, struct _input_impl *si, long *bind_id, char **data, long *length ); \
+ void (*undo_consume_lang_el)( struct colm_program *prg, struct _input_impl *si ); \
+ void (*prepend_data)( struct colm_program *prg, struct _input_impl *si, const char *data, long len ); \
+ int (*undo_prepend_data)( struct colm_program *prg, struct _input_impl *si, int length ); \
+ void (*prepend_tree)( struct colm_program *prg, struct _input_impl *si, struct colm_tree *tree, int ignore ); \
+ struct colm_tree *(*undo_prepend_tree)( struct colm_program *prg, struct _input_impl *si ); \
+ void (*prepend_stream)( struct colm_program *prg, struct _input_impl *si, struct colm_stream *stream ); \
+ struct colm_tree *(*undo_prepend_stream)( struct colm_program *prg, struct _input_impl *si ); \
+ void (*append_data)( struct colm_program *prg, struct _input_impl *si, const char *data, long len ); \
+ struct colm_tree *(*undo_append_data)( struct colm_program *prg, struct _input_impl *si, int length ); \
+ void (*append_tree)( struct colm_program *prg, struct _input_impl *si, struct colm_tree *tree ); \
+ 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 (*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 ); \
}
-#define DEF_STREAM_FUNCS( stream_funcs, stream_impl ) \
+#define DEF_STREAM_FUNCS( stream_funcs, _stream_impl ) \
struct stream_funcs \
{ \
- int (*get_parse_block)( struct colm_program *prg, struct stream_impl *si, int *pskip, char **pdp, int *copied ); \
- int (*get_data)( struct colm_program *prg, struct stream_impl *si, char *dest, int length ); \
- int (*get_data_source)( struct colm_program *prg, struct stream_impl *si, char *dest, int length ); \
- int (*consume_data)( struct colm_program *prg, struct stream_impl *si, int length, struct colm_location *loc ); \
- int (*undo_consume_data)( struct colm_program *prg, struct stream_impl *si, const char *data, int length ); \
- void (*transfer_loc)( struct colm_program *prg, struct colm_location *loc, struct stream_impl *si ); \
- 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 ); \
+ int (*get_parse_block)( struct colm_program *prg, struct _stream_impl *si, int *pskip, char **pdp, int *copied ); \
+ int (*get_data)( struct colm_program *prg, struct _stream_impl *si, char *dest, int length ); \
+ int (*get_data_source)( struct colm_program *prg, struct _stream_impl *si, char *dest, int length ); \
+ int (*consume_data)( struct colm_program *prg, struct _stream_impl *si, int length, struct colm_location *loc ); \
+ int (*undo_consume_data)( struct colm_program *prg, struct _stream_impl *si, const char *data, int length ); \
+ void (*transfer_loc)( struct colm_program *prg, struct colm_location *loc, struct _stream_impl *si ); \
+ 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 (*print_tree)( struct colm_program *prg, struct colm_tree **sp, \
- struct stream_impl *impl, struct colm_tree *tree, int trim ); \
- void (*destructor)( struct colm_program *prg, struct colm_tree **sp, struct stream_impl *si ); \
+ struct _stream_impl *impl, struct colm_tree *tree, int trim ); \
+ struct stream_impl *(*split_consumed)( struct colm_program *prg, struct _stream_impl *si ); \
+ void (*destructor)( struct colm_program *prg, struct colm_tree **sp, struct _stream_impl *si ); \
}
DEF_INPUT_FUNCS( input_funcs, input_impl );