Annotation of Amaya/amaya/XPointer.h, revision 1.5

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 { 
1.5     ! kia        27:   const char *lexptr;
1.1       kahan      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;
1.4       kahan      64:   char *node;      /* temporary buffer for storing a node's name */
                     65:   int  nodeSize;   /* size of the above temporary buffer */
1.1       kahan      66:   nodeType type;
                     67:   int  startC;
                     68:   int  endC;
                     69:   int  index;
                     70:   int  processed;
                     71: } nodeInfo;
                     72: 
1.3       kahan      73: typedef struct _XPointerContext {
1.1       kahan      74:   Document doc; /* document where we are resolving the XPointer */
                     75:   Element root; /* root element of the document */
                     76: 
                     77:   char *cur;    /* the current char being parsed */
                     78:   char *buffer; /* the input string */
                     79: 
                     80:   char *error;    /* error code */
                     81: 
                     82:   int   lookahead;  /* the lookahead token */
                     83:   tokEnum tok;      /* token */
                     84:   int tokval;       /* token value */
                     85: 
                     86:   symTableCtxPtr symtable; /* the symbol table */
                     87:   
                     88:   nodeType   type;        /* 0, single node, 1 range-to */
                     89:   nodeInfo  *curNode;
1.2       kahan      90:   nodeInfo   nodeStart;
                     91:   nodeInfo   nodeEnd;
1.3       kahan      92: } XPointerContext;
1.1       kahan      93: 
1.3       kahan      94: typedef XPointerContext *XPointerContextPtr;
1.1       kahan      95: 
                     96: #endif /* AMAYA_XPOINTER_H */
1.3       kahan      97: 
                     98: 
                     99: 

Webmaster