Annotation of Amaya/amaya/trans.h, revision 1.8
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: {
44: char *Tag; /* HTML tag */
45: Element Elem; /* element instance */
46: struct _Node *Parent;
47: struct _Node *Child;
48: struct _Node *Next;
49: struct _Node *Previous;
50: int NodeDepth;
51: boolean IsTrans;
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: {
67: char *NameAttr;
68: int ThotAttr;
69: boolean IsInt;
70: boolean IsTransf;
71: union
72: {
73: char *_TextVal;
74: int _IntVal;
75: struct _s0
76: {
77: char *_Tag;
78: char *_Attr;
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: {
95: char *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.4 cvs 103: char *RuleName;
104: strNodeDesc *OptionNodes;
105: strNodeDesc *NewNodes;
1.8 ! cvs 106: boolean 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.4 cvs 134: char *SymbolName;
1.2 cvs 135: char *Tag;
1.4 cvs 136: strRuleDesc *Rule;
137: boolean IsOptional;
138: boolean IsActiveSymb;
139: boolean IsOptChild;
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: {
151: char *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;
159: boolean IsActiveTrans;
160: char *DestinationTag;
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) */
168: char TransFileName [20];
169: time_t timeLastWrite;
170: /* number of transformations */
171: int NbTrans;
172: /* patterns max depth */
173: int MaxDepth;
174: /* transformation descriptor list */
175: strTransDesc *Transformations;
176: /* next set */
177: struct _TransSet *Next;
178: }
179: strTransSet;
180:
1.4 cvs 181: /* transformation environement */
182: struct _strMatchEnv
1.6 cvs 183: {
1.1 cvs 184: #ifndef PPSTANDALONE
1.6 cvs 185: StructureTree SourceTree;
186: strListElem *ListSubTrees;
1.1 cvs 187: #endif
1.6 cvs 188: strTransSet *TransSets;
189: }
1.4 cvs 190: strMatchEnv;
1.1 cvs 191:
192:
193:
1.6 cvs 194:
1.1 cvs 195: #ifndef PPSTANDALONE
1.4 cvs 196: /* document to wich a transformation is to be applied */
1.2 cvs 197: Document TransDoc;
198:
1.4 cvs 199: /* dialog and messages */
1.2 cvs 200: int TransBaseDialog;
201: int TRANSDIAL;
202:
1.1 cvs 203: #define TR_TRANSFORM 0
204: #define TRANS_MSG_MAX 1
205: #define TransMenu 1
206: #define MAX_TRANS_DLG 2
1.2 cvs 207:
1.1 cvs 208: #endif
1.2 cvs 209: #endif /* _TRANS_H__ */
Webmaster