Annotation of Amaya/amaya/XPointer.h, revision 1.1
1.1 ! kahan 1: #ifndef AMAYA_XPOINTER_H
! 2:
! 3: /***************************************************
! 4: General definitions
! 5: **************************************************/
! 6:
! 7: /* the different types of nodes */
! 8: typedef enum _nodeType {
! 9: SINGLE_NODE, /* XPointer is a single node */
! 10: RANGE_TO, /* XPointer is a node set (two nodes */
! 11: STRING_RANGE /* XPointer node points to a string */
! 12: } nodeType;
! 13:
! 14: /***************************************************
! 15: Symbol table (move this back to XPointerparse.c)
! 16: ***************************************************/
! 17:
! 18: #define STRMAX 999 /* size of lexemes array */
! 19: #define SYMMAX 100 /* size of symtable */
! 20:
! 21: /* forms of symbol table entry */
! 22: struct entry {
! 23: char *lexptr;
! 24: int token;
! 25: };
! 26:
! 27: /* tokens */
! 28: typedef enum {
! 29: /* type identifiers */
! 30: NUM=256,
! 31: ID,
! 32: /* the xpointer functions */
! 33: FID,
! 34: FRANGE_TO,
! 35: FSTRING_RANGE,
! 36: FSTARTP,
! 37: FENDP,
! 38: /* non-operators */
! 39: DONE,
! 40: NONE
! 41: } tokEnum;
! 42:
! 43: /* the symbol table */
! 44: typedef struct _symTableCtx {
! 45: char lexemes[STRMAX]; /* lexemes table */
! 46: int lastchar; /* last used position in lexemes */
! 47: struct entry symtable[SYMMAX];
! 48: int lastentry; /* last entry in the symtable */
! 49: } symTableCtx;
! 50:
! 51: typedef symTableCtx *symTableCtxPtr;
! 52:
! 53: /***************************************************
! 54: The parser context
! 55: **************************************************/
! 56:
! 57: /* the node info that the parsing will return */
! 58: typedef struct _nodeInfo {
! 59: Element el;
! 60: char node[10];
! 61: nodeType type;
! 62: int startC;
! 63: int endC;
! 64: int index;
! 65: int processed;
! 66: } nodeInfo;
! 67:
! 68: typedef struct _parserContext {
! 69: Document doc; /* document where we are resolving the XPointer */
! 70: Element root; /* root element of the document */
! 71:
! 72: char *cur; /* the current char being parsed */
! 73: char *buffer; /* the input string */
! 74:
! 75: char *error; /* error code */
! 76:
! 77: int lookahead; /* the lookahead token */
! 78: tokEnum tok; /* token */
! 79: int tokval; /* token value */
! 80:
! 81: symTableCtxPtr symtable; /* the symbol table */
! 82:
! 83: nodeType type; /* 0, single node, 1 range-to */
! 84: nodeInfo *curNode;
! 85: nodeInfo nodeA;
! 86: nodeInfo nodeB;
! 87: } parserContext;
! 88:
! 89: typedef parserContext *parserContextPtr;
! 90:
! 91: #endif /* AMAYA_XPOINTER_H */
! 92:
! 93:
! 94:
! 95:
Webmaster