Return to trans.h CVS log | Up to [Public] / Amaya / amaya |
1.3 cvs 1: /* 2: * 1.20 vatton 3: * (c) COPYRIGHT INRIA and W3C, 1996-2004 1.3 cvs 4: * Please first read the full copyright statement in file COPYRIGHT. 5: * 6: */ 7: 1.2 cvs 8: #ifndef _TRANS_H__ 9: #define _TRANS_H__ 1.4 cvs 10: /*---------------------------------------------------------------------- 1.17 vatton 11: Definition of types and variables used in type transformation 12: (trans.c and transparse.c) 13: Stephane Bonhomme Apr 96 1.4 cvs 14: ----------------------------------------------------------------------*/ 15: #define MAX_STACK 100 /* size of html generation and pattern matching stacks */ 1.7 cvs 16: #define BUFFER_LEN 10000 /* size of html buffer */ 1.1 cvs 17: 18: #ifndef PPSTANDALONE 19: 1.4 cvs 20: /*---------------------------------------------------------------------- 1.17 vatton 21: Structure definitions 1.4 cvs 22: ----------------------------------------------------------------------*/ 1.17 vatton 23: /* relation between pattern nodes (also called Symbols) and source structure tree nodes */ 1.4 cvs 24: typedef struct _MatchChildren 25: { 26: struct _SymbDesc *MatchSymb; /* pattern symbol */ 27: struct _Node *MatchNode; /* source tree node */ 28: struct _MatchChildren *Next; 29: } 30: strMatchChildren; 31: 32: typedef struct _Match 33: { 34: struct _SymbDesc *MatchSymb; /* pattern symbol */ 35: struct _Node *MatchNode; /* source tree node */ 36: strMatchChildren *MatchChildren; /* relation between chidren in both pattern and source tree */ 37: struct _Match *Next; 38: } 39: strMatch; 40: 41: 42: /* Source structure tree nodes definition */ 43: typedef struct _Node 44: { 1.17 vatton 45: unsigned char *Tag; /* HTML or XML tag */ 1.4 cvs 46: Element Elem; /* element instance */ 47: struct _Node *Parent; 48: struct _Node *Child; 49: struct _Node *Next; 50: struct _Node *Previous; 51: int NodeDepth; 1.12 cvs 52: ThotBool IsTrans; 1.4 cvs 53: struct _SymbDesc *MatchSymb; /* symbol matched (transformation phase) */ 54: strMatch *Matches; /* Symbols Matched (pattern matching) */ 55: struct _ListSymb *Candidates; /* list of symbols potientally matched */ 56: } 57: strNode; 1.1 cvs 58: 1.4 cvs 59: typedef strNode *StructureTree; 1.1 cvs 60: 1.4 cvs 61: #endif 1.1 cvs 62: 1.4 cvs 63: /* internal reprensentation of transformation rules */ 1.1 cvs 64: 1.4 cvs 65: /* Attribute descriptor */ 1.1 cvs 66: typedef struct _AttrDesc 1.2 cvs 67: { 1.15 vatton 68: unsigned char *NameAttr; 1.2 cvs 69: int ThotAttr; 1.12 cvs 70: ThotBool IsInt; 71: ThotBool IsTransf; 1.2 cvs 72: union 73: { 1.15 vatton 74: unsigned char *_TextVal; 1.2 cvs 75: int _IntVal; 76: struct _s0 77: { 1.15 vatton 78: unsigned char *_Tag; 79: unsigned char *_Attr; 1.2 cvs 80: } 81: s0; 82: } 83: u; 1.4 cvs 84: struct _AttrDesc *Next; 1.2 cvs 85: } 1.4 cvs 86: strAttrDesc; 1.1 cvs 87: 88: #define TextVal u._TextVal 89: #define IntVal u._IntVal 90: #define AttrTag u.s0._Tag 91: #define AttrAttr u.s0._Attr 92: 1.4 cvs 93: /* node generated */ 1.1 cvs 94: typedef struct _NodeDesc 1.2 cvs 95: { 1.15 vatton 96: unsigned char *Tag; 1.5 cvs 97: strAttrDesc *Attributes; 1.4 cvs 98: struct _NodeDesc *Next; 1.2 cvs 99: } 1.4 cvs 100: strNodeDesc; 1.1 cvs 101: 102: typedef struct _RuleDesc 1.2 cvs 103: { 1.15 vatton 104: unsigned char *RuleName; 1.4 cvs 105: strNodeDesc *OptionNodes; 106: strNodeDesc *NewNodes; 1.17 vatton 107: ThotBool DeleteRule; 1.5 cvs 108: struct _RuleDesc *NextRule; 1.4 cvs 109: struct _RuleDesc *Next; 1.2 cvs 110: } 1.4 cvs 111: strRuleDesc; 1.1 cvs 112: 113: #ifndef PPSTANDALONE 114: typedef struct _ListElem 1.2 cvs 115: { 1.4 cvs 116: Element Elem; 117: int Id; 118: int Rank; 119: struct _ListElem *Next; 1.2 cvs 120: } 1.4 cvs 121: strListElem; 1.2 cvs 122: 1.1 cvs 123: #endif 124: 125: typedef struct _ListSymb 1.2 cvs 126: { 1.17 vatton 127: struct _SymbDesc *Symbol; 128: struct _ListSymb *Next; 1.2 cvs 129: } 1.4 cvs 130: strListSymb; 1.1 cvs 131: 1.4 cvs 132: /* pattern node (symbol) */ 1.1 cvs 133: typedef struct _SymbDesc 1.2 cvs 134: { 1.17 vatton 135: unsigned char *SymbolName; 136: unsigned char *Tag; 137: strRuleDesc *Rule; 138: ThotBool IsOptional; 139: ThotBool IsActiveSymb; 140: ThotBool IsOptChild; 141: int Depth; 142: strAttrDesc *Attributes; 143: strListSymb *Children; 144: strListSymb *Followings; 145: struct _SymbDesc *Next; 1.2 cvs 146: } 1.4 cvs 147: strSymbDesc; 1.1 cvs 148: 1.4 cvs 149: /* transformation descriptor */ 1.1 cvs 150: typedef struct _TransDesc 1.2 cvs 151: { 1.17 vatton 152: unsigned char *NameTrans; 153: int NbPatSymb; 154: int NbRules; 155: int PatDepth; 156: strListSymb *First; 157: strSymbDesc *RootDesc; 158: strSymbDesc *Symbols; 159: strRuleDesc *Rules; 160: ThotBool IsActiveTrans; 161: ThotBool IsAction; /* TRUE -> DestinationTag is an action */ 162: unsigned char *DestinationTag; 163: struct _TransDesc *Next; 1.2 cvs 164: } 1.4 cvs 165: strTransDesc; 1.1 cvs 166: 1.19 vatton 167: #define TRANSNAME 40 1.6 cvs 168: typedef struct _TransSet 169: { 170: /* name of the transformation set (eg, name of file without suffix .trans) */ 1.19 vatton 171: char TransFileName [TRANSNAME]; 1.9 cvs 172: #ifndef PPSTANDALONE 173: SSchema Schema; 174: #endif 1.6 cvs 175: time_t timeLastWrite; 176: /* number of transformations */ 177: int NbTrans; 178: /* patterns max depth */ 179: int MaxDepth; 180: /* transformation descriptor list */ 181: strTransDesc *Transformations; 182: /* next set */ 183: struct _TransSet *Next; 184: } 185: strTransSet; 186: 1.4 cvs 187: /* transformation environement */ 188: struct _strMatchEnv 1.6 cvs 189: { 1.1 cvs 190: #ifndef PPSTANDALONE 1.6 cvs 191: StructureTree SourceTree; 192: strListElem *ListSubTrees; 1.1 cvs 193: #endif 1.6 cvs 194: strTransSet *TransSets; 1.18 gully 195: }; 196: 197: THOT_EXPORT struct _strMatchEnv strMatchEnv; 1.1 cvs 198: 199: 200: 1.6 cvs 201: 1.1 cvs 202: #ifndef PPSTANDALONE 1.4 cvs 203: /* document to wich a transformation is to be applied */ 1.18 gully 204: THOT_EXPORT Document TransDoc; 1.2 cvs 205: 1.4 cvs 206: /* dialog and messages */ 1.18 gully 207: THOT_EXPORT int TransBaseDialog; 1.2 cvs 208: 1.22 ! vatton 209: #define TransMenu 0 /* GTK or Win32 menu */ ! 210: #define TransForm 1 /* WX form */ ! 211: #define TransSelect 2 /* Get the WX selected string */ ! 212: #define TransEntry 3 /* Get the WX selected entry */ 1.21 vatton 213: #define MAX_TRANS_DLG 4 1.2 cvs 214: 1.13 cvs 215: #endif /* PPSTANDALONE */ 1.2 cvs 216: #endif /* _TRANS_H__ */