Annotation of Amaya/amaya/templates.h, revision 1.22

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

Webmaster