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