#ifndef TEMPLATE_TEMPLATES #define TEMPLATE_TEMPLATES #define THOT_EXPORT extern #include "amaya.h" #include "document.h" #include "containers.h" #include "MENUconf.h" #define Template_Current_Version "0.9" typedef enum _TemplateFlag { templNone = 0, templTemplate = 1 << 0, // Template templLibraryFlag = 1 << 1, // Library (implies template). templLibrary = templLibraryFlag+templTemplate, templInstance = 1 << 2, // Instance of template templloaded = 1 << 4, // Template is really loaded. templInternal = 1 << 8, // Internal only, no edited document. templPredefined = 1 << 9 // predefined library (base or html). }TemplateFlag; struct _XTigerTemplate; typedef struct _XTigerTemplate *XTigerTemplate; struct _XTigerTemplate { int state; // Union of TemplateFlag char* uri; // Template URI (formerly name). char* base_uri; // URI of template if this is an instance. char* version; // Version of XTiger language char* templateVersion;// Version of template HashMap libraries; // Imported libraries (StringHashMap) SearchSet simpleTypes; // All simple types declared in the document (SearchSet) SearchSet elements; // All element types declared in the document (SearchSet) SearchSet components; // All component types declared in the document (SearchSet) SearchSet unions; // All union types declared in the document (SearchSet) SearchSet unknowns; // All unknown declarations, used in template parsing (SearchSet) Document doc; // Use to store component structures int ref; // Reference counting SList errorList; // Error string list (DLList) }; // Notes : // All KeywordHashMap must embed their own copy of their keys // in order to prevent corruption. // XTiger declaration nature // Note : the order is very important for user presentation. typedef enum _TypeNature { SimpleTypeNat, UnionNat, ComponentNat, XmlElementNat, UnknownNat } TypeNature; // XTiger simple type typedef enum _SimpleTypeType {XTNumber, XTString, XTBoolean} SimpleTypeType; /* Structure of a Declaration */ typedef struct _XmlElement { char *name; } XmlElement; typedef struct _SimpleType { SimpleTypeType type; } SimpleType; typedef struct _Component { Element content; } Component_; typedef struct _Union { SearchSet include; // SearchSet SearchSet exclude; // SearchSet SearchSet expanded; // SearchSet char* includeStr; char* excludeStr; } Union; /* Structure of a declaration */ struct _Declaration; typedef struct _Declaration *Declaration; struct _Declaration { char *name; TypeNature nature; ThotBool blockLevel; // TRUE if the element is a block (not inline) XTigerTemplate declaredIn; // The template which declare the decl XTigerTemplate usedIn; // The template which embed the decl union { SimpleType simpleType; Component_ componentType; Union unionType; XmlElement elementType; }; }; struct menuType { char *label; TypeNature type; }; #endif /* TEMPLATE_TEMPLATES */