Annotation of Amaya/amaya/templateDeclarations.h, revision 1.2

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
        !             7: #define ELEMENT     2
        !             8: #define UNION       3
        !             9: 
        !            10: #define XTIGER_NUMBER  0
        !            11: #define XTIGER_STRING  1
        !            12: #define XTIGER_BOOLEAN 2
        !            13: #define XTIGER_CUSTOM  3
1.1       francesc   14: 
                     15: #define THOT_EXPORT extern
                     16: #include "amaya.h"
                     17: #include "document.h"
                     18: #include "mydictionary.h"
                     19: 
1.2     ! vatton     20: /* Structure of a template */
1.1       francesc   21: struct _XTigerTemplate;
                     22: typedef struct _XTigerTemplate *XTigerTemplate;
                     23: 
1.2     ! vatton     24: struct _XTigerTemplate
        !            25: {      
        !            26:   ThotBool        isLibrary;                    //Is this a library? (otherway it's a template)
        !            27:   DicDictionary   libraries;              //Imported libraries
        !            28:   DicDictionary   declaredTypes;        //All types declared in the document
        !            29:   int             documentUsingMe; //How many documents are using this template or library?
1.1       francesc   30: };
                     31: 
1.2     ! vatton     32: /* Structure of a Declaration */
        !            33: typedef int TypeNature;
        !            34: typedef int SimpleTypeType;
1.1       francesc   35: 
1.2     ! vatton     36: typedef struct _SimpleType
        !            37: {
1.1       francesc   38:        SimpleTypeType type;
                     39: } SimpleType;
                     40: 
1.2     ! vatton     41: typedef struct _Component
        !            42: {
        !            43:        Element        content;
1.1       francesc   44: } Component;
                     45: 
1.2     ! vatton     46: typedef struct _Union
        !            47: {
        !            48:        DicDictionary  include; //Dictionary<Declaration>
        !            49:        DicDictionary  exclude; //Dictionary<Declaration>
1.1       francesc   50: } Union;
                     51: 
1.2     ! vatton     52: typedef struct _Declaration
        !            53: {
        !            54:        char          *name;
        !            55:        TypeNature     nature;
1.1       francesc   56:        XTigerTemplate declaredIn;
1.2     ! vatton     57:        union
        !            58:   {
        !            59:                SimpleType   simpleType;
        !            60:                Component    componentType;
        !            61:                Union        unionType;
1.1       francesc   62:        };
                     63: } *Declaration;
                     64: 
1.2     ! vatton     65: THOT_EXPORT DicDictionary templates;
        !            66: 
        !            67: /*----------------------------------------------------------------------
        !            68:   Returns a library with the predefined types
        !            69:   ----------------------------------------------------------------------*/
        !            70: extern XTigerTemplate CreatePredefinedTypesLibrary ( void );
        !            71: 
1.1       francesc   72: /*----------------------------------------------------------------------
                     73:   Initializing the template environment
                     74:   ----------------------------------------------------------------------*/
1.2     ! vatton     75: extern DicDictionary InitializeTemplateEnvironment ( void );
1.1       francesc   76: 
1.2     ! vatton     77: /*----------------------------------------------------------------------
        !            78:   ----------------------------------------------------------------------*/
        !            79: extern Declaration NewSimpleType ( const XTigerTemplate t,
        !            80:                                    const char *name,
        !            81:                                    TypeNature xtype );
1.1       francesc   82: 
                     83: /*----------------------------------------------------------------------
                     84:   ----------------------------------------------------------------------*/
1.2     ! vatton     85: extern Declaration NewComponent ( const XTigerTemplate t,
        !            86:                                   const char *name,
        !            87:                                   const Element el );
1.1       francesc   88: 
1.2     ! vatton     89: /*----------------------------------------------------------------------
        !            90:   ----------------------------------------------------------------------*/
        !            91: extern Declaration NewUnion ( const XTigerTemplate t,
        !            92:                               const char *name,
        !            93:                               DicDictionary include,
        !            94:                               DicDictionary exclude );
1.1       francesc   95: 
1.2     ! vatton     96: /*----------------------------------------------------------------------
        !            97:   ----------------------------------------------------------------------*/
        !            98: extern void FreeDeclaration ( Declaration dec );
1.1       francesc   99: 
1.2     ! vatton    100: /*----------------------------------------------------------------------
        !           101:    Creates a new template with its dictionaries
        !           102:  ----------------------------------------------------------------------*/
        !           103: extern XTigerTemplate NewXTigerTemplate ( ThotBool addPredefined );
1.1       francesc  104: 
1.2     ! vatton    105: /*----------------------------------------------------------------------
        !           106:   Free all the space used by a template (also its dictionaries)
        !           107:   ----------------------------------------------------------------------*/
        !           108: extern void FreeXTigerTemplate ( XTigerTemplate t );
1.1       francesc  109: 
                    110: /*----------------------------------------------------------------------
1.2     ! vatton    111:   Imports all declarations in a library lib to a template t
1.1       francesc  112:   ----------------------------------------------------------------------*/
1.2     ! vatton    113: extern void AddLibraryDeclarations (XTigerTemplate t, XTigerTemplate lib);
1.1       francesc  114: 
1.2     ! vatton    115: #endif //TEMPLATE_DECLARATIONS

Webmaster