Annotation of Amaya/amaya/templates.h, revision 1.11
1.1 francesc 1: #ifndef TEMPLATE_TEMPLATES
2: #define TEMPLATE_TEMPLATES
3:
4: #define THOT_EXPORT extern
5: #include "amaya.h"
6: #include "document.h"
1.7 quint 7:
1.8 kia 8: #include "MENUconf.h"
9:
1.9 kia 10: #define TEMPLATE_SSHEMA_NAME "Template"
11:
1.7 quint 12: typedef void *DicElement;
13:
14: //A record contains an element and its key.
15: struct sRecord;
16: typedef struct sRecord *Record;
17: struct sRecord
18: {
19: char *key;
20: DicElement element;
21: Record next;
22: };
23:
24: //A dictionary contains a sequence of Records
25: struct sDictionary;
26: typedef struct sDictionary* DicDictionary;
27: struct sDictionary
28: {
29: Record first;
30: Record iter;
31: };
1.1 francesc 32:
1.5 quint 33: /* Structure of a template */
34: struct _XTigerTemplate;
35: typedef struct _XTigerTemplate *XTigerTemplate;
36:
37: //Private structure of a template
38: struct _XTigerTemplate
39: {
40: ThotBool isLibrary; //Is this a library? (otherway it's a template)
41: ThotBool isPredefined; //Is this the predefined library
42: DicDictionary libraries; //Imported libraries
43: DicDictionary simpleTypes; //All simple types declared in the document
44: DicDictionary elements; //All element types declared in the document
45: DicDictionary components; //All component types declared in the document
46: DicDictionary unions; //All union types declared in the document
47: Document doc; //Use to store component structures
48: int users; //Number of documents using this template
49: };
50:
1.6 quint 51: typedef enum _TypeNature {SimpleTypeNat, XmlElementNat, ComponentNat,
52: UnionNat} TypeNature;
53:
54: // XTiger simple type
55: typedef enum _SimpleTypeType {XTNumber, XTString, XTBoolean} SimpleTypeType;
56:
1.5 quint 57: /* Structure of a Declaration */
58:
59: typedef struct _XmlElement
60: {
61: char *name;
62: } XmlElement;
63:
64: typedef struct _SimpleType
65: {
66: SimpleTypeType type;
67: } SimpleType;
68:
69: typedef struct _Component
70: {
71: Element content;
1.10 vatton 72: } Component_;
1.5 quint 73:
74: typedef struct _Union
75: {
1.11 ! kia 76: DicDictionary include; //Dictionary<Declaration>
! 77: DicDictionary exclude; //Dictionary<Declaration>
! 78: DicDictionary expanded; //Dictionary<Declaration>
1.5 quint 79: } Union;
80:
1.6 quint 81: /* Structure of a declaration */
82: struct _Declaration;
83: typedef struct _Declaration *Declaration;
84:
1.5 quint 85: struct _Declaration
86: {
87: char *name;
88: TypeNature nature;
89: XTigerTemplate declaredIn;
90: union
91: {
92: SimpleType simpleType;
1.10 vatton 93: Component_ componentType;
1.5 quint 94: Union unionType;
95: XmlElement elementType;
96: };
97: };
98:
99: struct menuType
100: {
1.6 quint 101: char *label;
102: TypeNature type;
1.5 quint 103: };
1.2 francesc 104:
1.1 francesc 105: #endif /* TEMPLATE_TEMPLATES */
Webmaster