Annotation of Amaya/amaya/trans.h, revision 1.18
1.3 cvs 1: /*
2: *
1.16 vatton 3: * (c) COPYRIGHT INRIA and W3C, 1996-2003
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.6 cvs 167: typedef struct _TransSet
168: {
169: /* name of the transformation set (eg, name of file without suffix .trans) */
1.14 cvs 170: char TransFileName [20];
1.9 cvs 171: #ifndef PPSTANDALONE
172: SSchema Schema;
173: #endif
1.6 cvs 174: time_t timeLastWrite;
175: /* number of transformations */
176: int NbTrans;
177: /* patterns max depth */
178: int MaxDepth;
179: /* transformation descriptor list */
180: strTransDesc *Transformations;
181: /* next set */
182: struct _TransSet *Next;
183: }
184: strTransSet;
185:
1.4 cvs 186: /* transformation environement */
187: struct _strMatchEnv
1.6 cvs 188: {
1.1 cvs 189: #ifndef PPSTANDALONE
1.6 cvs 190: StructureTree SourceTree;
191: strListElem *ListSubTrees;
1.1 cvs 192: #endif
1.6 cvs 193: strTransSet *TransSets;
1.18 ! gully 194: };
! 195:
! 196: THOT_EXPORT struct _strMatchEnv strMatchEnv;
1.1 cvs 197:
198:
199:
1.6 cvs 200:
1.1 cvs 201: #ifndef PPSTANDALONE
1.4 cvs 202: /* document to wich a transformation is to be applied */
1.18 ! gully 203: THOT_EXPORT Document TransDoc;
1.2 cvs 204:
1.4 cvs 205: /* dialog and messages */
1.18 ! gully 206: THOT_EXPORT int TransBaseDialog;
1.2 cvs 207:
1.1 cvs 208: #define TransMenu 1
209: #define MAX_TRANS_DLG 2
1.2 cvs 210:
1.13 cvs 211: #endif /* PPSTANDALONE */
1.2 cvs 212: #endif /* _TRANS_H__ */
Webmaster