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

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.7       quint       7: 
1.8       kia         8: #include "MENUconf.h"
                      9: 
1.9       kia        10: #define TEMPLATE_SSHEMA_NAME  "Template"
                     11: 
1.7       quint      12: typedef void  *DicElement;
                     13: 
                     14: //A record contains an element and its key.
                     15: struct sRecord;
                     16: typedef struct sRecord *Record;
                     17: struct sRecord
                     18: {
                     19:        char        *key;
                     20:   DicElement   element;
                     21:        Record       next;
                     22: };
                     23: 
                     24: //A dictionary contains a sequence of Records
                     25: struct sDictionary;
                     26: typedef struct sDictionary* DicDictionary;
                     27: struct sDictionary
                     28: {
                     29:        Record first;
                     30:        Record iter;
                     31: };
1.1       francesc   32: 
1.5       quint      33: /* Structure of a template */
                     34: struct _XTigerTemplate;
                     35: typedef struct _XTigerTemplate *XTigerTemplate;
                     36: 
                     37: //Private structure of a template
                     38: struct _XTigerTemplate
                     39: {      
1.13    ! kia        40:   char*           name;           //Template name
1.12      kia        41:   char*           version;        //Version of XTiger language
                     42:   char*           templateVersion;//Version of template
1.5       quint      43:   ThotBool        isLibrary;                   //Is this a library? (otherway it's a template)
                     44:   ThotBool        isPredefined;   //Is this the predefined library
                     45:   DicDictionary   libraries;                   //Imported libraries
                     46:   DicDictionary   simpleTypes;         //All simple types declared in the document
                     47:   DicDictionary   elements;                            //All element types declared in the document
                     48:   DicDictionary   components;                  //All component types declared in the document
                     49:   DicDictionary   unions;                                //All union types declared in the document
                     50:   Document        doc;            //Use to store component structures
                     51:   int             users;          //Number of documents using this template
                     52: };
                     53: 
1.6       quint      54: typedef enum _TypeNature {SimpleTypeNat, XmlElementNat, ComponentNat,
                     55:                           UnionNat} TypeNature;
                     56: 
                     57: // XTiger simple type
                     58: typedef enum _SimpleTypeType {XTNumber, XTString, XTBoolean} SimpleTypeType;
                     59: 
1.5       quint      60: /* Structure of a Declaration */
                     61: 
                     62: typedef struct _XmlElement
                     63: {
                     64:        char    *name;
                     65: } XmlElement;
                     66: 
                     67: typedef struct _SimpleType
                     68: {
                     69:        SimpleTypeType type;
                     70: } SimpleType;
                     71: 
                     72: typedef struct _Component
                     73: {
                     74:        Element        content;
1.10      vatton     75: } Component_;
1.5       quint      76: 
                     77: typedef struct _Union
                     78: {
1.11      kia        79:        DicDictionary  include;  //Dictionary<Declaration>
                     80:        DicDictionary  exclude;  //Dictionary<Declaration>
                     81:   DicDictionary  expanded; //Dictionary<Declaration>
1.5       quint      82: } Union;
                     83: 
1.6       quint      84: /* Structure of a declaration */
                     85: struct _Declaration;
                     86: typedef struct _Declaration *Declaration;
                     87: 
1.5       quint      88: struct _Declaration
                     89: {
                     90:        char          *name;
                     91:        TypeNature     nature;
                     92:        XTigerTemplate declaredIn;
                     93:        union
                     94:        {
                     95:                SimpleType   simpleType;
1.10      vatton     96:                Component_   componentType;
1.5       quint      97:                Union        unionType;
                     98:                XmlElement   elementType;
                     99:        };
                    100: };
                    101: 
                    102: struct menuType
                    103: {
1.6       quint     104:        char        *label;
                    105:        TypeNature   type;
1.5       quint     106: };
1.2       francesc  107: 
1.1       francesc  108: #endif /* TEMPLATE_TEMPLATES */

Webmaster