Diff for /Amaya/amaya/fetchXMLname.c between versions 1.37 and 1.38

version 1.37, 2001/01/24 09:52:22 version 1.38, 2001/03/05 15:22:44
Line 1 Line 1
 /*  /*
  *   *
  *  (c) COPYRIGHT MIT and INRIA, 1996-2000   *  (c) COPYRIGHT MIT and INRIA, 1996-2001
  *  Please first read the full copyright statement in file COPYRIGHT.   *  Please first read the full copyright statement in file COPYRIGHT.
  *   *
  */   */
Line 34  XmlEntity        *pMathEntityTable = Mat Line 34  XmlEntity        *pMathEntityTable = Mat
 /*----------------------------------------------------------------------  /*----------------------------------------------------------------------
    GetXHTMLSSchema returns the XHTML Thot schema for document doc.     GetXHTMLSSchema returns the XHTML Thot schema for document doc.
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  
 SSchema            GetXHTMLSSchema (Document doc)  SSchema            GetXHTMLSSchema (Document doc)
 #else  
 SSchema            GetXHTMLSSchema (doc)  
 Document           doc;  
   
 #endif  
 {  {
   SSchema       XHTMLSSchema;    SSchema       XHTMLSSchema;
   
Line 54  Document    doc; Line 49  Document    doc;
 /*----------------------------------------------------------------------  /*----------------------------------------------------------------------
    GetMathMLSSchema returns the MathML Thot schema for document doc.     GetMathMLSSchema returns the MathML Thot schema for document doc.
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  
 SSchema            GetMathMLSSchema (Document doc)  SSchema            GetMathMLSSchema (Document doc)
 #else  
 SSchema            GetMathMLSSchema (doc)  
 Document           doc;  
   
 #endif  
 {  {
   SSchema       MathMLSSchema;    SSchema       MathMLSSchema;
   
Line 75  Document    doc; Line 65  Document    doc;
 /*----------------------------------------------------------------------  /*----------------------------------------------------------------------
    GetGraphMLSSchema returns the GraphML Thot schema for document doc.     GetGraphMLSSchema returns the GraphML Thot schema for document doc.
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  
 SSchema            GetGraphMLSSchema (Document doc)  SSchema            GetGraphMLSSchema (Document doc)
 #else  
 SSchema            GetGraphMLSSchema (doc)  
 Document           doc;  
   
 #endif  
 {  {
   SSchema       GraphMLSSchema;    SSchema       GraphMLSSchema;
   
Line 96  Document    doc; Line 81  Document    doc;
 /*----------------------------------------------------------------------  /*----------------------------------------------------------------------
    GetXLinkSSchema returns the XLink Thot schema for document doc.     GetXLinkSSchema returns the XLink Thot schema for document doc.
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  
 SSchema            GetXLinkSSchema (Document doc)  SSchema            GetXLinkSSchema (Document doc)
 #else  
 SSchema            GetXLinkSSchema (doc)  
 Document           doc;  
   
 #endif  
 {  {
   SSchema       XLinkSSchema;    SSchema       XLinkSSchema;
   
Line 116  Document    doc; Line 96  Document    doc;
 /*----------------------------------------------------------------------  /*----------------------------------------------------------------------
    GetXMLSSchema returns the XML Thot schema for document doc.     GetXMLSSchema returns the XML Thot schema for document doc.
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  
 SSchema            GetXMLSSchema (int XMLtype, Document doc)  SSchema            GetXMLSSchema (int XMLtype, Document doc)
 #else  
 SSchema            GetXMLSSchema (XMLtype, doc)  
 Document           doc;  
 int                XMLtype;  
 #endif  
 {  {
   if (XMLtype == XHTML_TYPE)    if (XMLtype == XHTML_TYPE)
     return GetXHTMLSSchema (doc);      return GetXHTMLSSchema (doc);
Line 146  int                XMLtype; Line 121  int                XMLtype;
     - ElTypeNum and ElSSchema into elType  ElTypeNum = 0 if not found.      - ElTypeNum and ElSSchema into elType  ElTypeNum = 0 if not found.
     - content       - content 
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  
 void         MapXMLElementType (int XMLtype,  void         MapXMLElementType (int XMLtype,
                                 STRING XMLname,                                  STRING XMLname,
                                 ElementType *elType,                                  ElementType *elType,
Line 154  void         MapXMLElementType (int XMLt Line 128  void         MapXMLElementType (int XMLt
                                 CHAR_T *content,                                  CHAR_T *content,
                                 ThotBool *highEnoughLevel,                                  ThotBool *highEnoughLevel,
                                 Document doc)                                  Document doc)
 #else  
 void         MapXMLElementType (XMLtype, XMLname, elType, mappedName,  
                                 content, highEnoughLevel, doc)  
 int            XMLtype;  
 STRING         XMLname;  
 ElementType   *elType;  
 STRING        *mappedName;  
 CHAR_T        *content;  
 ThotBool      *highEnoughLevel;  
 Document       doc;  
 #endif  
 {  {
    int                 i;     int                 i;
    ElemMapping        *ptr;     ElemMapping        *ptr;
Line 239  Document       doc; Line 202  Document       doc;
    Generic function which searchs in the mapping table the XML name for     Generic function which searchs in the mapping table the XML name for
    a given Thot type.     a given Thot type.
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  
 CHAR_T*           GetXMLElementName (ElementType elType, Document doc)  CHAR_T*           GetXMLElementName (ElementType elType, Document doc)
 #else  
 CHAR_T*           GetXMLElementName (elType, doc)  
 ElementType       elType;  
 Document          doc;  
 #endif  
 {  {
   ElemMapping        *ptr;    ElemMapping        *ptr;
   STRING              name;    STRING              name;
Line 293  Document          doc; Line 250  Document          doc;
    Generic function which searchs in the mapping table if a given     Generic function which searchs in the mapping table if a given
    Thot type is an inline character or not     Thot type is an inline character or not
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  
 ThotBool         IsXMLElementInline (ElementType elType)  ThotBool         IsXMLElementInline (ElementType elType)
 #else  
 ThotBool         IsXMLElementInline (elType)  
 ElementType      el;  
 #endif  
 {  {
   int            i;    int            i;
   ThotBool       ret = FALSE;    ThotBool       ret = FALSE;
Line 335  ElementType      el; Line 288  ElementType      el;
    the entry attrName associated to the element elementName.     the entry attrName associated to the element elementName.
    Returns the corresponding entry or -1.     Returns the corresponding entry or -1.
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  
 int       MapXMLAttribute (int XMLtype, CHAR_T *attrName,  int       MapXMLAttribute (int XMLtype, CHAR_T *attrName,
                            CHAR_T *elementName, ThotBool *highEnoughLevel,                             CHAR_T *elementName, ThotBool *highEnoughLevel,
                            Document doc, int *thotType)                             Document doc, int *thotType)
 #else  
 int       MapXMLAttribute (XMLtype, attrName, elementName,  
                            highEnoughLevel, doc, thotType)  
 int          XMLtype;  
 CHAR_T      *attrName;  
 CHAR_T      *elementName;  
 ThotBool    *highEnoughLevel;  
 Document     doc;  
 int         *thotType;  
 #endif  
 {  {
   int               i;    int               i;
   AttributeMapping *ptr;    AttributeMapping *ptr;
Line 404  int         *thotType; Line 346  int         *thotType;
    Generic function which searchs in the mapping table the XML name for     Generic function which searchs in the mapping table the XML name for
    a given Thot type.     a given Thot type.
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  CHAR_T*           GetXMLAttributeName (AttributeType attrType,
 CHAR_T*           GetXMLAttributeName (AttributeType attrType, ElementType elType, Document doc)                                         ElementType elType,
 #else                                         Document doc)
 CHAR_T*           GetXMLAttributeName (attrType, elType, doc)  
 AttributeType     attrType;  
 ElementType       elType;  
 Document          doc;  
 #endif  
 {  {
   AttributeMapping   *ptr;    AttributeMapping   *ptr;
   STRING              name, tag;    STRING              name, tag;
Line 466  Document          doc; Line 403  Document          doc;
    the entry entityName and give the corresponding decimal value.     the entry entityName and give the corresponding decimal value.
    Returns FALSE if entityName is not found.     Returns FALSE if entityName is not found.
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  
 ThotBool   MapXMLEntity (int XMLtype, STRING entityName, int *entityValue)  ThotBool   MapXMLEntity (int XMLtype, STRING entityName, int *entityValue)
 #else  
 ThotBool   MapXMLEntity (XMLtype, entityName, entityValue)  
 int        XMLtype;  
 STRING     entityName  
 int       *entityValue  
 #endif  
 {  {
   int         i;  
   XmlEntity  *ptr;    XmlEntity  *ptr;
   ThotBool    found;    ThotBool    found;
     int         inf, sup, med, rescomp;
   
   i = 1;    /* Initialization */
   found = FALSE;    found = FALSE;
   
   /* Select the right table */    /* Select the right table */
Line 491  int       *entityValue Line 422  int       *entityValue
     ptr = NULL;      ptr = NULL;
       
   if (ptr == NULL)    if (ptr == NULL)
     return FALSE;      return found;
   
   /* look for the first concerned entry in the table */    inf = 0;
   for (i = 0; ptr[i].charCode >= 0 && !found; i++)    for (sup = 0; ptr[sup].charCode > 0; sup++);
     found = !ustrcmp (ptr[i].charName, entityName);  
       while (sup >= inf && !found)
   if (found)      /* Dichotomic research */
     {      {
       /* entity found */        med = (sup + inf) / 2;
       i--;        rescomp = ustrcmp (ptr[med].charName, entityName);
       *entityValue = ptr[i].charCode;        if (rescomp == 0)
       return TRUE;          {
             /* entity found */
             *entityValue = ptr[med].charCode;
             found = TRUE;
           }
         else
           {
             if (rescomp > 0)
               sup = med - 1;
             else
               inf = med + 1;
           }
     }      }
   else    return found;
     return FALSE;   }
 }  

Removed from v.1.37  
changed lines
  Added in v.1.38


Webmaster