Annotation of Amaya/amaya/templateDeclarations.h, revision 1.1
1.1 ! francesc 1: #ifndef TEMPLATE_DECLARATIONS
! 2: #define TEMPLATE_DECLARATIONS
! 3:
! 4: #define PREDEFINED_LIB "-Predefined-"
! 5:
! 6: #define THOT_EXPORT extern
! 7: #include "amaya.h"
! 8: #include "document.h"
! 9: #include "mydictionary.h"
! 10:
! 11: /*----------------------------------------------------------------------
! 12: Structure of a template
! 13: ----------------------------------------------------------------------*/
! 14: struct _XTigerTemplate;
! 15: typedef struct _XTigerTemplate *XTigerTemplate;
! 16:
! 17: struct _XTigerTemplate {
! 18: bool isLibrary; //Is this a library? (otherway it's a template)
! 19: DicDictionary libraries; //Imported libraries
! 20: DicDictionary declaredTypes; //All types declared in the document
! 21: int documentUsingMe; //How many documents are using this template or library?
! 22: };
! 23:
! 24: /*----------------------------------------------------------------------
! 25: Structure of a Declaration
! 26: ----------------------------------------------------------------------*/
! 27: typedef enum TypeNatureEnum { SIMPLE_TYPE, COMPONENT, UNION } TypeNature;
! 28: typedef enum SimpleTypeEnum { XTIGER_INTEGER, XTIGER_STRING, XTIGER_BOOLEAN, XTIGER_CUSTOM } SimpleTypeType;
! 29:
! 30: typedef struct _SimpleType {
! 31: SimpleTypeType type;
! 32: } SimpleType;
! 33:
! 34: typedef struct _Component {
! 35: Element content;
! 36: } Component;
! 37:
! 38: typedef struct _Union {
! 39: DicDictionary include; //Dictionary<Declaration>
! 40: DicDictionary exclude; //Dictionary<Declaration>
! 41: } Union;
! 42:
! 43: typedef struct _Declaration {
! 44: char *name;
! 45: TypeNature nature;
! 46: XTigerTemplate declaredIn;
! 47: union {
! 48: SimpleType simpleType;
! 49: Component componentType;
! 50: Union unionType;
! 51: };
! 52: } *Declaration;
! 53:
! 54: /*----------------------------------------------------------------------
! 55: Initializing the template environment
! 56: ----------------------------------------------------------------------*/
! 57:
! 58: DicDictionary InitializeTemplateEnvironment();
! 59:
! 60: /*----------------------------------------------------------------------
! 61: Creation and freeing of declarations
! 62: ----------------------------------------------------------------------*/
! 63: Declaration NewDeclaration(const XTigerTemplate t, const char *name, TypeNature type);
! 64:
! 65: Declaration NewSimpleType(const XTigerTemplate t, const char *name, SimpleTypeType type);
! 66:
! 67: Declaration NewComponent(const XTigerTemplate t, const char *name, const Element el);
! 68:
! 69: Declaration NewUnion(const XTigerTemplate t, const char *name, DicDictionary include, DicDictionary exclude);
! 70:
! 71: void FreeDeclaration(Declaration dec);
! 72:
! 73: /*----------------------------------------------------------------------
! 74: Creates a new template with its dictionaries
! 75: ----------------------------------------------------------------------*/
! 76: XTigerTemplate NewXTigerTemplate(bool addPredefined = true);
! 77:
! 78: void FreeXTigerTemplate(XTigerTemplate t);
! 79:
! 80: #endif //TEMPLATE_DECLARATIONS
Webmaster