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