diff options
Diffstat (limited to 'colm/colm.h')
-rw-r--r-- | colm/colm.h | 85 |
1 files changed, 47 insertions, 38 deletions
diff --git a/colm/colm.h b/colm/colm.h index f5183be2..b83cd7a1 100644 --- a/colm/colm.h +++ b/colm/colm.h @@ -5,51 +5,60 @@ extern "C" { #endif -struct ColmTree; -struct ColmKid; -struct ColmProgram; -struct ColmRuntimeData; -struct ColmTree; -struct ColmLocation; - -struct ColmProgram *colmNewProgram( struct ColmRuntimeData *rtd, long debugRealm ); -void colmRunProgram( struct ColmProgram *prg, int argc, const char **argv ); -struct ColmTree *colmRunFunc( struct ColmProgram *prg, int frameId, const char **params, int paramCount ); -int colmDeleteProgram( struct ColmProgram *prg ); - -struct ColmPrintArgs +struct colm_tree; +struct colm_kid; +struct colm_program; +struct colm_sections; +struct colm_tree; +struct colm_location; + +/* + * Interface + */ + +struct colm_print_args { void *arg; int comm; int attr; int trim; - void (*out)( struct ColmPrintArgs *args, const char *data, int length ); - void (*openTree)( struct ColmProgram *prg, struct ColmTree **sp, - struct ColmPrintArgs *args, struct ColmKid *parent, struct ColmKid *kid ); - void (*printTerm)( struct ColmProgram *prg, struct ColmTree **sp, - struct ColmPrintArgs *args, struct ColmKid *kid ); - void (*closeTree)( struct ColmProgram *prg, struct ColmTree **sp, - struct ColmPrintArgs *args, struct ColmKid *parent, struct ColmKid *kid ); + 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 ); + void (*print_term)( struct colm_program *prg, struct colm_tree **sp, + struct colm_print_args *args, struct colm_kid *kid ); + void (*close_tree)( struct colm_program *prg, struct colm_tree **sp, + struct colm_print_args *args, struct colm_kid *parent, struct colm_kid *kid ); }; -void printNull( struct ColmProgram *prg, struct ColmTree **sp, - struct ColmPrintArgs *args, struct ColmKid *parent, struct ColmKid *kid ); -void printTermTree( struct ColmProgram *prg, struct ColmTree **sp, - struct ColmPrintArgs *printArgs, struct ColmKid *kid ); - -struct ColmTree **vm_root( struct ColmProgram *prg ); -struct ColmTree *returnVal( struct ColmProgram *prg ); -void printTreeArgs( struct ColmProgram *prg, struct ColmTree **sp, - struct ColmPrintArgs *printArgs, struct ColmTree *tree ); - -int repeatEnd( struct ColmTree *tree ); -int listLast( struct ColmTree *tree ); -struct ColmTree *getRhsVal( struct ColmProgram *prg, struct ColmTree *tree, int *a ); -struct ColmTree *getAttr( struct ColmTree *tree, long pos ); -struct ColmTree *getGlobal( struct ColmProgram *prg, long pos ); -struct ColmTree *getRepeatNext( struct ColmTree *tree ); -struct ColmTree *getRepeatVal( struct ColmTree *tree ); -struct ColmLocation *findLocation( struct ColmProgram *prg, struct ColmTree *tree ); +void colm_print_null( struct colm_program *prg, struct colm_tree **sp, + struct colm_print_args *args, struct colm_kid *parent, struct colm_kid *kid ); +void colm_print_term_tree( struct colm_program *prg, struct colm_tree **sp, + struct colm_print_args *print_args, struct colm_kid *kid ); + +struct colm_tree **colm_vm_root( struct colm_program *prg ); +struct colm_tree *colm_return_val( struct colm_program *prg ); +void colm_print_tree_args( struct colm_program *prg, struct colm_tree **sp, + struct colm_print_args *print_args, struct colm_tree *tree ); + +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 ); +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 ); + +/* + * Primary interface. + */ + +struct colm_program *colm_new_program( struct colm_sections *rtd ); +void colm_set_debug( struct colm_program *prg, long active_realm ); +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 ); +int colm_delete_program( struct colm_program *prg ); #ifdef __cplusplus } |