diff options
author | Adrian Thurston <thurston@complang.org> | 2015-05-10 11:55:58 -0400 |
---|---|---|
committer | Adrian Thurston <thurston@complang.org> | 2015-05-10 11:55:58 -0400 |
commit | df14c3f2fdc9abee0c922f456446264460aefd06 (patch) | |
tree | 9ebeee2a4da98131f33e2facf458042860cbf412 /src/colm.h | |
parent | 97689b1dca307140d17e70bd56c51a302f994c8c (diff) | |
download | colm-df14c3f2fdc9abee0c922f456446264460aefd06.tar.gz |
code cleanup and some fixes for iter unwind since splitting unwind/destroy
Diffstat (limited to 'src/colm.h')
-rw-r--r-- | src/colm.h | 33 |
1 files changed, 26 insertions, 7 deletions
@@ -26,19 +26,16 @@ struct colm_tree struct colm_data *tokdata; /* FIXME: this needs to go somewhere else. Will do for now. */ - unsigned short prodNum; + unsigned short prod_num; }; -/* - * Interface - */ - struct colm_print_args { void *arg; int comm; int attr; int trim; + void (*out)( struct colm_print_args *args, const char *data, int length ); void (*open_tree)( struct colm_program *prg, struct colm_tree **sp, struct colm_print_args *args, struct colm_kid *parent, struct colm_kid *kid ); @@ -60,6 +57,7 @@ void colm_print_tree_args( struct colm_program *prg, struct colm_tree **sp, int colm_repeat_end( struct colm_tree *tree ); int colm_list_last( struct colm_tree *tree ); + struct colm_tree *colm_get_rhs_val( struct colm_program *prg, struct colm_tree *tree, int *a ); struct colm_tree *colm_get_attr( struct colm_tree *tree, long pos ); struct colm_tree *colm_get_global( struct colm_program *prg, long pos ); @@ -67,14 +65,35 @@ struct colm_tree *colm_get_repeat_next( struct colm_tree *tree ); struct colm_tree *colm_get_repeat_val( struct colm_tree *tree ); struct colm_location *colm_find_location( struct colm_program *prg, struct colm_tree *tree ); +/* Debug realms. To turn on, pass to colm_set_debug before invocation. */ +#define COLM_DBG_BYTECODE 0x00000001 +#define COLM_DBG_PARSE 0x00000002 +#define COLM_DBG_MATCH 0x00000004 +#define COLM_DBG_COMPILE 0x00000008 +#define COLM_DBG_POOL 0x00000010 +#define COLM_DBG_PRINT 0x00000020 +#define COLM_DBG_INPUT 0x00000040 +#define COLM_DBG_SCAN 0x00000080 + /* - * Primary interface. + * Primary Interface. */ +/* Allocate a program. Takes program static data as arg. Normally this is + * &colm_object. */ struct colm_program *colm_new_program( struct colm_sections *rtd ); + +/* Enable debug realms for a program. */ void colm_set_debug( struct colm_program *prg, long active_realm ); + +/* Run a top-level colm program. */ void colm_run_program( struct colm_program *prg, int argc, const char **argv ); -struct colm_tree *colm_run_func( struct colm_program *prg, int frame_id, const char **params, int param_count ); + +/* Run a single exported colm function. */ +struct colm_tree *colm_run_func( struct colm_program *prg, int frame_id, + const char **params, int param_count ); + +/* Delete a colm program. Clears all memory. */ int colm_delete_program( struct colm_program *prg ); #ifdef __cplusplus |