Annotation of Amaya/amaya/templateDeclarations.h, revision 1.3
1.1 francesc 1: #ifndef TEMPLATE_DECLARATIONS
2: #define TEMPLATE_DECLARATIONS
3:
4: #define PREDEFINED_LIB "-Predefined-"
1.2 vatton 5: #define COMPONENT 0
6: #define SIMPLE_TYPE 1
1.3 ! francesc 7: #define XMLELEMENT 2
1.2 vatton 8: #define UNION 3
9:
1.3 ! francesc 10: #define XTIGER_INTEGER 0
! 11: #define XTIGER_DECIMAL 1
! 12: #define XTIGER_STRING 2
! 13: #define XTIGER_BOOLEAN 3
! 14: #define XTIGER_CUSTOM 4
1.1 francesc 15:
16: #define THOT_EXPORT extern
17: #include "amaya.h"
18: #include "document.h"
19: #include "mydictionary.h"
20:
1.2 vatton 21: /* Structure of a template */
1.1 francesc 22: struct _XTigerTemplate;
23: typedef struct _XTigerTemplate *XTigerTemplate;
24:
1.2 vatton 25: struct _XTigerTemplate
26: {
1.3 ! francesc 27: ThotBool isLibrary; //Is this a library? (otherway it's a template)
! 28: // DicDictionary libraries; //Imported libraries
! 29: DicDictionary simpleTypes; //All simple types declared in the document
! 30: DicDictionary elements; //All element types declared in the document
! 31: DicDictionary components; //All component types declared in the document
! 32: DicDictionary unions; //All union types declared in the document
1.1 francesc 33: };
34:
1.2 vatton 35: /* Structure of a Declaration */
36: typedef int TypeNature;
37: typedef int SimpleTypeType;
1.1 francesc 38:
1.3 ! francesc 39: typedef struct _XmlElement
! 40: {
! 41: char *name;
! 42: } XmlElement;
! 43:
1.2 vatton 44: typedef struct _SimpleType
45: {
1.1 francesc 46: SimpleTypeType type;
47: } SimpleType;
48:
1.2 vatton 49: typedef struct _Component
50: {
51: Element content;
1.1 francesc 52: } Component;
53:
1.2 vatton 54: typedef struct _Union
55: {
56: DicDictionary include; //Dictionary<Declaration>
57: DicDictionary exclude; //Dictionary<Declaration>
1.1 francesc 58: } Union;
59:
1.2 vatton 60: typedef struct _Declaration
61: {
62: char *name;
63: TypeNature nature;
1.1 francesc 64: XTigerTemplate declaredIn;
1.2 vatton 65: union
1.3 ! francesc 66: {
1.2 vatton 67: SimpleType simpleType;
68: Component componentType;
69: Union unionType;
1.3 ! francesc 70: XmlElement elementType;
1.1 francesc 71: };
72: } *Declaration;
73:
1.2 vatton 74: THOT_EXPORT DicDictionary templates;
75:
76: /*----------------------------------------------------------------------
77: Returns a library with the predefined types
78: ----------------------------------------------------------------------*/
79: extern XTigerTemplate CreatePredefinedTypesLibrary ( void );
80:
1.1 francesc 81: /*----------------------------------------------------------------------
82: Initializing the template environment
83: ----------------------------------------------------------------------*/
1.2 vatton 84: extern DicDictionary InitializeTemplateEnvironment ( void );
1.1 francesc 85:
1.2 vatton 86: /*----------------------------------------------------------------------
87: ----------------------------------------------------------------------*/
88: extern Declaration NewSimpleType ( const XTigerTemplate t,
89: const char *name,
90: TypeNature xtype );
1.1 francesc 91:
92: /*----------------------------------------------------------------------
93: ----------------------------------------------------------------------*/
1.2 vatton 94: extern Declaration NewComponent ( const XTigerTemplate t,
95: const char *name,
96: const Element el );
1.1 francesc 97:
1.2 vatton 98: /*----------------------------------------------------------------------
99: ----------------------------------------------------------------------*/
100: extern Declaration NewUnion ( const XTigerTemplate t,
101: const char *name,
102: DicDictionary include,
103: DicDictionary exclude );
1.1 francesc 104:
1.2 vatton 105: /*----------------------------------------------------------------------
106: ----------------------------------------------------------------------*/
1.3 ! francesc 107: extern Declaration NewElement ( const XTigerTemplate t,
! 108: const char *name );
! 109:
! 110: /*----------------------------------------------------------------------
! 111: ----------------------------------------------------------------------*/
1.2 vatton 112: extern void FreeDeclaration ( Declaration dec );
1.1 francesc 113:
1.2 vatton 114: /*----------------------------------------------------------------------
1.3 ! francesc 115: ----------------------------------------------------------------------*/
! 116: extern Declaration GetDeclaration(const XTigerTemplate t, const char *name);
! 117:
! 118: /*----------------------------------------------------------------------
1.2 vatton 119: Creates a new template with its dictionaries
120: ----------------------------------------------------------------------*/
121: extern XTigerTemplate NewXTigerTemplate ( ThotBool addPredefined );
1.1 francesc 122:
1.2 vatton 123: /*----------------------------------------------------------------------
124: Free all the space used by a template (also its dictionaries)
125: ----------------------------------------------------------------------*/
126: extern void FreeXTigerTemplate ( XTigerTemplate t );
1.1 francesc 127:
128: /*----------------------------------------------------------------------
1.2 vatton 129: Imports all declarations in a library lib to a template t
1.1 francesc 130: ----------------------------------------------------------------------*/
1.2 vatton 131: extern void AddLibraryDeclarations (XTigerTemplate t, XTigerTemplate lib);
1.1 francesc 132:
1.2 vatton 133: #endif //TEMPLATE_DECLARATIONS
Webmaster