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

version 1.38, 2001/03/05 15:22:44 version 1.39, 2001/03/06 15:14:12
Line 31  XmlEntity        *pMathEntityTable = Mat Line 31  XmlEntity        *pMathEntityTable = Mat
   
 #include "fetchXMLname_f.h"  #include "fetchXMLname_f.h"
   
   /* Global variables used by the entity mapping */
   static int        XHTMLSup = 0;
   static int        MathSup = 0;
   
 /*----------------------------------------------------------------------  /*----------------------------------------------------------------------
    GetXHTMLSSchema returns the XHTML Thot schema for document doc.     GetXHTMLSSchema returns the XHTML Thot schema for document doc.
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
Line 415  ThotBool   MapXMLEntity (int XMLtype, ST Line 419  ThotBool   MapXMLEntity (int XMLtype, ST
   
   /* Select the right table */    /* Select the right table */
   if (XMLtype == XHTML_TYPE)    if (XMLtype == XHTML_TYPE)
     ptr = XhtmlEntityTable;      {
         ptr = XhtmlEntityTable;
         if (XHTMLSup == 0)
           for (XHTMLSup = 0; ptr[XHTMLSup].charCode > 0; XHTMLSup++);
         sup = XHTMLSup;
       }
   else if (XMLtype == MATH_TYPE)    else if (XMLtype == MATH_TYPE)
     ptr = MathEntityTable;      {
         ptr = MathEntityTable;
         if (MathSup == 0)
           for (MathSup = 0; ptr[MathSup].charCode > 0; MathSup++);
         sup = MathSup;
       }
   else    else
     ptr = NULL;      ptr = NULL;
       
Line 425  ThotBool   MapXMLEntity (int XMLtype, ST Line 439  ThotBool   MapXMLEntity (int XMLtype, ST
     return found;      return found;
   
   inf = 0;    inf = 0;
   for (sup = 0; ptr[sup].charCode > 0; sup++);  
   
   while (sup >= inf && !found)    while (sup >= inf && !found)
     /* Dichotomic research */      /* Dichotomic research */
     {      {
Line 448  ThotBool   MapXMLEntity (int XMLtype, ST Line 460  ThotBool   MapXMLEntity (int XMLtype, ST
     }      }
   return found;    return found;
  }   }
   
   /*----------------------------------------------------------------------
      MapEntityByCode
      Generic function which searchs in the Entity Mapping Table (table)
      the entry with code entityValue and give the corresponding name.
      Returns FALSE if entityValue is not found.
     ----------------------------------------------------------------------*/
   CHAR_T*   MapEntityByCode (int XMLtype, int entityValue)
   
   {
     XmlEntity  *ptr;
     ThotBool    found;
     int         i;
   
     /* Select the right table */
     if (XMLtype == XHTML_TYPE)
         ptr = XhtmlEntityTable;
     else if (XMLtype == MATH_TYPE)
         ptr = MathEntityTable;
     else
       ptr = NULL;
     
     if (ptr == NULL)
       return ptr;
   
     /* look for the first concerned entry in the table */
     found = FALSE;
     for (i = 0; ptr[i].charCode >= 0 && !found; i++)
       found = (ptr[i].charCode == entityValue);
     
     if (found)
       {
         /* entity value found */
          i--;
          return ptr[i].charName;
      }
     else
       return NULL;
   }

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


Webmaster