diff options
author | Adrian Thurston <thurston@complang.org> | 2011-10-29 22:18:52 +0000 |
---|---|---|
committer | Adrian Thurston <thurston@complang.org> | 2011-10-29 22:18:52 +0000 |
commit | 6a7333b73effa7a8d8fe96f21b84ea2e4a4d13b1 (patch) | |
tree | bf69df569d990ad875354e27df825dc235a41103 /colm/colm.h | |
parent | e1334e70ecae09bcd730e4d8795e4c9e95a8cff0 (diff) | |
download | colm-6a7333b73effa7a8d8fe96f21b84ea2e4a4d13b1.tar.gz |
The colm.h header now contains the bare minimum for the C++ interface. Put the
prefix Colm on the language elments in there. refs #328.
Diffstat (limited to 'colm/colm.h')
-rw-r--r-- | colm/colm.h | 61 |
1 files changed, 52 insertions, 9 deletions
diff --git a/colm/colm.h b/colm/colm.h index a1be95ac..c73f694e 100644 --- a/colm/colm.h +++ b/colm/colm.h @@ -1,11 +1,54 @@ -#ifndef _COLM_H -#define _COLM_H - -#include <colm/pdarun.h> -#include <colm/fsmrun.h> -#include <colm/bytecode.h> -#include <colm/defs.h> -#include <colm/input.h> -#include <colm/tree.h> +#ifndef __COLM_COLM_H +#define __COLM_COLM_H + +#ifdef __cplusplus +extern "C" { +#endif + +struct ColmTree; +struct ColmKid; +struct ColmProgram; +struct ColmRuntimeData; + +void colmInit( long debugRealm ); +struct ColmProgram *colmNewProgram( struct ColmRuntimeData *rtd, int argc, const char **argv ); +void colmRunProgram( struct ColmProgram *prg ); +void colmDeleteProgram( struct ColmProgram *prg ); + +struct ColmPrintArgs +{ + void *arg; + int comm; + int attr; + void (*out)( struct ColmPrintArgs *args, const char *data, int length ); + void (*openTree)( struct ColmPrintArgs *args, struct ColmTree **sp, + struct ColmProgram *prg, struct ColmKid *parent, struct ColmKid *kid ); + void (*printTerm)( struct ColmPrintArgs *args, struct ColmTree **sp, + struct ColmProgram *prg, struct ColmKid *kid ); + void (*closeTree)( struct ColmPrintArgs *args, struct ColmTree **sp, + struct ColmProgram *prg, struct ColmKid *parent, struct ColmKid *kid ); +}; + +void printNull( struct ColmPrintArgs *args, struct ColmTree **sp, + struct ColmProgram *prg, struct ColmKid *parent, struct ColmKid *kid ); +void printTermTree( struct ColmPrintArgs *printArgs, struct ColmTree **sp, + struct ColmProgram *prg, struct ColmKid *kid ); + +struct ColmTree **vm_root( struct ColmProgram *prg ); +struct ColmTree *returnVal( struct ColmProgram *prg ); +void printTreeArgs( struct ColmPrintArgs *printArgs, struct ColmTree **sp, + struct ColmProgram *prg, 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 *getRepeatNext( struct ColmTree *tree ); +struct ColmTree *getRepeatVal( struct ColmTree *tree ); + +#ifdef __cplusplus +} +#endif + #endif |