Annotation of Amaya/amaya/templateUtils.c, revision 1.3

1.3     ! quint       1: #include "templates.h"
1.1       francesc    2: 
                      3: /*----------------------------------------------------------------------
                      4: GetSchemaFromDocType: Returns the name of the schema corresponding to 
                      5: a doc type.
                      6: ----------------------------------------------------------------------*/
                      7: char *GetSchemaFromDocType (DocumentType docType)
                      8: {
                      9: #ifdef TEMPLATES
                     10:        switch (docType)
                     11:     {
                     12:     case docAnnot :
                     13:                return "Annot";
                     14:     case docBookmark :
                     15:                return "Topics";
                     16:     case docSVG :
                     17:                return "SVG";
                     18:     case docMath :
                     19:                return "MathML";
                     20:     case docXml :
                     21:                return "XML";
                     22:     default :
                     23:                return "HTML";
                     24:     }
                     25: #endif // TEMPLATES
                     26:        return "HTML";
                     27: }
                     28: 
                     29: 
                     30: /*----------------------------------------------------------------------
                     31: Returns the value of a string attribute 
                     32: ----------------------------------------------------------------------*/
                     33: char *GetAttributeStringValue (Element el, int att)
                     34: {
                     35: #ifdef TEMPLATES
                     36:        AttributeType attType;
                     37:        attType.AttrSSchema = TtaGetElementType(el).ElSSchema;
                     38:        attType.AttrTypeNum = att;
                     39:        
                     40:        Attribute attribute = TtaGetAttribute(el, attType);
                     41:        
                     42:        int size = TtaGetTextAttributeLength(attribute);
                     43:        char *aux = (char*) TtaGetMemory(size+1);
                     44:        TtaGiveTextAttributeValue (attribute, aux, &size);
                     45:        return aux;
                     46: #else
                     47:        return '\0';
                     48: #endif /* TEMPLATES */
                     49: }
1.2       francesc   50: 
                     51: /*----------------------------------------------------------------------
                     52: Returns the value of a string attribute 
                     53: ----------------------------------------------------------------------*/
                     54: char *GetAttributeStringValue (Element el, Attribute attribute)
                     55: {
                     56: #ifdef TEMPLATES
                     57:        int size = TtaGetTextAttributeLength(attribute);
                     58:        char *aux = (char*) TtaGetMemory(size+1);
                     59:        TtaGiveTextAttributeValue (attribute, aux, &size);
                     60:        return aux;
                     61: #else
                     62:        return '\0';
                     63: #endif /* TEMPLATES */
                     64: }

Webmaster