Return to templates.h CVS log | Up to [Public] / Amaya / amaya |
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.15 kia 7: #include "containers.h" 1.8 kia 8: #include "MENUconf.h" 9: 1.1 francesc 10: 1.20 kia 11: #define Template_Current_Version "0.9" 12: 13: 1.26 ! vatton 14: #define templNone 0 ! 15: #define templTemplate 1 //#define template ! 16: #define templLibraryFlag 2 // Library (implies#define template). ! 17: #define templLibrary 3 ! 18: #define templInstance 4 // Instance of#define template ! 19: #define templloaded 8 //#define template is really loaded. ! 20: #define templInternal 16 // Internal only, no edited document. ! 21: #define templPredefined 32 // predefined library (base or html). 1.21 kia 22: 1.5 quint 23: struct _XTigerTemplate; 24: typedef struct _XTigerTemplate *XTigerTemplate; 25: struct _XTigerTemplate 1.21 kia 26: { 27: int state; // Union of TemplateFlag 28: char* uri; // Template URI (formerly name). 29: char* base_uri; // URI of template if this is an instance. 1.22 kia 30: char* version; // Version of XTiger language 31: char* templateVersion;// Version of template 1.21 kia 32: 1.22 kia 33: HashMap libraries; // Imported libraries (StringHashMap<XTigerTemplate>) 34: 35: SearchSet simpleTypes; // All simple types declared in the document (SearchSet<Declaration, char*>) 36: SearchSet elements; // All element types declared in the document (SearchSet<Declaration, char*>) 37: SearchSet components; // All component types declared in the document (SearchSet<Declaration, char*>) 38: SearchSet unions; // All union types declared in the document (SearchSet<Declaration, char*>) 39: SearchSet unknowns; // All unknown declarations, used in template parsing (SearchSet<Declaration, char*>) 40: 41: Document doc; // Use to store component structures 1.23 kia 42: int ref; // Reference counting 1.22 kia 43: SList errorList; // Error string list (DLList<char*>) 1.5 quint 44: }; 45: 1.21 kia 46: 1.15 kia 47: // Notes : 48: // All KeywordHashMap<Declaration> must embed their own copy of their keys 49: // in order to prevent corruption. 50: 1.18 kia 51: // XTiger declaration nature 52: // Note : the order is very important for user presentation. 53: typedef enum _TypeNature 54: { 55: SimpleTypeNat, 56: UnionNat, 57: ComponentNat, 1.19 kia 58: XmlElementNat, 59: UnknownNat 1.18 kia 60: } TypeNature; 1.6 quint 61: 62: // XTiger simple type 63: typedef enum _SimpleTypeType {XTNumber, XTString, XTBoolean} SimpleTypeType; 64: 1.5 quint 65: /* Structure of a Declaration */ 66: typedef struct _XmlElement 67: { 68: char *name; 69: } XmlElement; 70: 71: typedef struct _SimpleType 72: { 73: SimpleTypeType type; 74: } SimpleType; 75: 76: typedef struct _Component 77: { 78: Element content; 1.10 vatton 79: } Component_; 1.5 quint 80: 81: typedef struct _Union 82: { 1.22 kia 83: SearchSet include; // SearchSet<Declaration, char*> 84: SearchSet exclude; // SearchSet<Declaration, char*> 85: SearchSet expanded; // SearchSet<Declaration, char*> 86: char* includeStr; 87: char* excludeStr; 1.5 quint 88: } Union; 89: 1.6 quint 90: /* Structure of a declaration */ 91: struct _Declaration; 92: typedef struct _Declaration *Declaration; 93: 1.5 quint 94: struct _Declaration 95: { 96: char *name; 97: TypeNature nature; 1.25 vatton 98: // TODO Change blockLevel with a triplet (block,inline, both) to use with union 99: int blockLevel; // 0=unknown, 1=inline, 2=block, 3 = both 1.15 kia 100: XTigerTemplate declaredIn; // The template which declare the decl 101: XTigerTemplate usedIn; // The template which embed the decl 1.5 quint 102: union 103: { 104: SimpleType simpleType; 1.10 vatton 105: Component_ componentType; 1.5 quint 106: Union unionType; 107: XmlElement elementType; 108: }; 109: }; 110: 111: struct menuType 112: { 1.6 quint 113: char *label; 114: TypeNature type; 1.5 quint 115: }; 1.2 francesc 116: 1.1 francesc 117: #endif /* TEMPLATE_TEMPLATES */