Annotation of Amaya/amaya/trans.h, revision 1.5
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 */
15: #define BUFFER_LEN 5000 /* 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.5 ! cvs 106: struct _RuleDesc *NextRule;
1.4 cvs 107: struct _RuleDesc *Next;
1.2 cvs 108: }
1.4 cvs 109: strRuleDesc;
1.1 cvs 110:
111: #ifndef PPSTANDALONE
112: typedef struct _ListElem
1.2 cvs 113: {
1.4 cvs 114: Element Elem;
115: int Id;
116: int Rank;
117: struct _ListElem *Next;
1.2 cvs 118: }
1.4 cvs 119: strListElem;
1.2 cvs 120:
1.1 cvs 121: #endif
122:
123: typedef struct _ListSymb
1.2 cvs 124: {
1.4 cvs 125: struct _SymbDesc *Symbol;
126: struct _ListSymb *Next;
1.2 cvs 127: }
1.4 cvs 128: strListSymb;
1.1 cvs 129:
1.4 cvs 130: /* pattern node (symbol) */
1.1 cvs 131: typedef struct _SymbDesc
1.2 cvs 132: {
1.4 cvs 133: char *SymbolName;
1.2 cvs 134: char *Tag;
1.4 cvs 135: strRuleDesc *Rule;
136: boolean IsOptional;
137: boolean IsActiveSymb;
138: boolean IsOptChild;
139: int Depth;
140: strAttrDesc *Attributes;
141: strListSymb *Children;
142: strListSymb *Followings;
143: struct _SymbDesc *Next;
1.2 cvs 144: }
1.4 cvs 145: strSymbDesc;
1.1 cvs 146:
1.4 cvs 147: /* transformation descriptor */
1.1 cvs 148: typedef struct _TransDesc
1.2 cvs 149: {
150: char *NameTrans;
1.4 cvs 151: int NbPatSymb;
152: int NbRules;
153: int PatDepth;
154: strListSymb *First;
155: strSymbDesc *RootDesc;
156: strSymbDesc *Symbols;
157: strRuleDesc *Rules;
158: boolean IsActiveTrans;
159: char *DestinationTag;
160: struct _TransDesc *Next;
1.2 cvs 161: }
1.4 cvs 162: strTransDesc;
1.1 cvs 163:
1.4 cvs 164: /* transformation environement */
165: struct _strMatchEnv
1.2 cvs 166: {
1.1 cvs 167: #ifndef PPSTANDALONE
1.4 cvs 168: StructureTree SourceTree;
169: strListElem *ListSubTrees;
1.1 cvs 170: #endif
1.4 cvs 171: /* number of transformations */
172: int NbTrans;
173: /* patterns max depth*/
174: int MaxDepth;
175: strTransDesc *Transformations;
1.2 cvs 176: }
1.4 cvs 177: strMatchEnv;
1.1 cvs 178:
179:
180:
181: #ifndef PPSTANDALONE
1.4 cvs 182: /* document to wich a transformation is to be applied */
1.2 cvs 183: Document TransDoc;
184:
1.4 cvs 185: /* dialog and messages */
1.2 cvs 186: int TransBaseDialog;
187: int TRANSDIAL;
188:
1.1 cvs 189: #define TR_TRANSFORM 0
190: #define TRANS_MSG_MAX 1
191: #define TransMenu 1
192: #define MAX_TRANS_DLG 2
193:
1.4 cvs 194: /*last modification date of transformation resource file */
1.2 cvs 195: time_t timeLastWrite;
196:
1.1 cvs 197: #endif
1.2 cvs 198: #endif /* _TRANS_H__ */
Webmaster