Diff for /Amaya/amaya/styleparser.c between versions 1.49 and 1.50

version 1.49, 2000/02/10 09:42:43 version 1.50, 2000/02/16 17:04:00
Line 19 Line 19
 #include "css.h"  #include "css.h"
 #include "undo.h"  #include "undo.h"
 #include "fetchHTMLname.h"  #include "fetchHTMLname.h"
   #include "uaccess.h"
   
 typedef struct _BackgroundImageCallbackBlock  typedef struct _BackgroundImageCallbackBlock
 {  {
Line 49  BackgroundImageCallbackBlock, *Backgroun Line 50  BackgroundImageCallbackBlock, *Backgroun
  * for a font attribute.   * for a font attribute.
  */   */
 #ifdef __STDC__  #ifdef __STDC__
 typedef char* (*PropertyParser) (Element element,  typedef CHAR_T* (*PropertyParser) (Element element,
                                     PSchema tsch,                                      PSchema tsch,
                                     PresentationContext context,                                      PresentationContext context,
                                     char* cssRule,                                      CHAR_T* cssRule,
                                     CSSInfoPtr css,                                      CSSInfoPtr css,
                                     ThotBool isHTML);                                      ThotBool isHTML);
 #else  #else
 typedef char* (*PropertyParser) ();  typedef CHAR_T* (*PropertyParser) ();
 #endif  #endif
   
 /* Description of the set of CSS properties supported */  /* Description of the set of CSS properties supported */
 typedef struct CSSProperty  typedef struct CSSProperty
   {    {
      char*                name;       CHAR_T*              name;
      PropertyParser       parsing_function;       PropertyParser       parsing_function;
   }    }
 CSSProperty;  CSSProperty;
Line 71  CSSProperty; Line 72  CSSProperty;
   
 struct unit_def  struct unit_def
 {  {
    char*               sign;     CHAR_T*             sign;
    unsigned int        unit;     unsigned int        unit;
 };  };
   
 static struct unit_def CSSUnitNames[] =  static struct unit_def CSSUnitNames[] =
 {  {
    {"pt", STYLE_UNIT_PT},     {TEXT("pt"), STYLE_UNIT_PT},
    {"pc", STYLE_UNIT_PC},     {TEXT("pc"), STYLE_UNIT_PC},
    {"in", STYLE_UNIT_IN},     {TEXT("in"), STYLE_UNIT_IN},
    {"cm", STYLE_UNIT_CM},     {TEXT("cm"), STYLE_UNIT_CM},
    {"mm", STYLE_UNIT_MM},     {TEXT("mm"), STYLE_UNIT_MM},
    {"em", STYLE_UNIT_EM},     {TEXT("em"), STYLE_UNIT_EM},
    {"px", STYLE_UNIT_PX},     {TEXT("px"), STYLE_UNIT_PX},
    {"ex", STYLE_UNIT_XHEIGHT},     {TEXT("ex"), STYLE_UNIT_XHEIGHT},
    {"%", STYLE_UNIT_PERCENT}     {TEXT("%"), STYLE_UNIT_PERCENT}
 };  };
   
 #define NB_UNITS (sizeof(CSSUnitNames) / sizeof(struct unit_def))  #define NB_UNITS (sizeof(CSSUnitNames) / sizeof(struct unit_def))
Line 93  static struct unit_def CSSUnitNames[] = Line 94  static struct unit_def CSSUnitNames[] =
 /*----------------------------------------------------------------------  /*----------------------------------------------------------------------
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 static unsigned int hexa_val (char c)  static unsigned int hexa_val (CHAR_T c)
 #else  #else
 static unsigned int hexa_val (c)  static unsigned int hexa_val (c)
 char                c;  CHAR_T              c;
 #endif  #endif
 {  {
    if (c >= '0' && c <= '9')     if (c >= TEXT('0') && c <= TEXT('9'))
       return (c - '0');        return (c - TEXT('0'));
    if (c >= 'a' && c <= 'f')     if (c >= TEXT('a') && c <= TEXT('f'))
       return (c - 'a' + 10);        return (c - TEXT('a') + 10);
    if (c >= 'A' && c <= 'F')     if (c >= TEXT('A') && c <= TEXT('F'))
       return (c - 'A' + 10);        return (c - TEXT('A') + 10);
    return (0);     return (0);
 }  }
   
Line 112  char                c; Line 113  char                c;
    SkipWord:                                                       SkipWord:                                                  
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 static char*       SkipWord (char* ptr)  static CHAR_T*     SkipWord (CHAR_T* ptr)
 #else  #else
 static char*       SkipWord (ptr)  static CHAR_T*     SkipWord (ptr)
 char*              ptr;  CHAR_T*            ptr;
 #endif  #endif
 {  {
   while (isalnum(*ptr) || *ptr == '-' || *ptr == '%')  # ifdef _WINDOWS
     ptr++;    /* iswalnum is supposed to be supported by the i18n veriosn of libc 
        use it when available */
     while (iswalnum (*ptr) || *ptr == TEXT('-') || *ptr == TEXT('%'))
   # else  /* !_WINDOWS */
     while (isalnum((int)*ptr) || *ptr == TEXT('-') || *ptr == TEXT('%'))
   # endif /* !_WINDOWS */
           ptr++;
   return (ptr);    return (ptr);
 }  }
   
Line 175  CHAR_T*        ptr; Line 182  CHAR_T*        ptr;
    SkipQuotedString:                                                       SkipQuotedString:                                                  
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 static char*        SkipQuotedString (char* ptr, char quote)  static CHAR_T*        SkipQuotedString (CHAR_T* ptr, CHAR_T quote)
 #else  #else
 static char*        SkipQuotedString (ptr, quote)  static CHAR_T*        SkipQuotedString (ptr, quote)
 char*               ptr;  CHAR_T*               ptr;
 char                quote;  CHAR_T                quote;
 #endif  #endif
 {  {
   ThotBool      stop;    ThotBool      stop;
Line 192  char                quote; Line 199  char                quote;
        ptr++;         ptr++;
        stop = TRUE;         stop = TRUE;
        }         }
     else if (*ptr == EOS)      else if (*ptr == WC_EOS)
        stop = TRUE;         stop = TRUE;
     else if (*ptr == '\\')      else if (*ptr == TEXT('\\'))
        /* escape character */         /* escape character */
        {         {
        ptr++;         ptr++;
        if ((*ptr >= '0' && *ptr <= '9') || (*ptr >= 'A' && *ptr <= 'F') ||         if ((*ptr >= TEXT('0') && *ptr <= TEXT('9')) || (*ptr >= TEXT('A') && *ptr <= TEXT('F')) ||
            (*ptr >= 'a' && *ptr <= 'f'))             (*ptr >= TEXT('a') && *ptr <= TEXT('f')))
           {            {
           ptr++;            ptr++;
           if ((*ptr >= '0' && *ptr <= '9') || (*ptr >= 'A' && *ptr <= 'F') ||            if ((*ptr >= TEXT('0') && *ptr <= TEXT('9')) || (*ptr >= TEXT('A') && *ptr <= TEXT('F')) ||
               (*ptr >= 'a' && *ptr <= 'f'))                (*ptr >= TEXT('a') && *ptr <= TEXT('f')))
              ptr++;               ptr++;
           }            }
        else         else
Line 219  char                quote; Line 226  char                quote;
    SkipProperty:                                                       SkipProperty:                                                  
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 char*       SkipProperty (char* ptr)  CHAR_T*     SkipProperty (CHAR_T* ptr)
 #else  #else
 char*       SkipProperty (ptr)  CHAR_T*     SkipProperty (ptr)
 char*       ptr;  CHAR_T*     ptr;
 #endif  #endif
 {  {
   while (*ptr != EOS && *ptr != ';' && *ptr != '}')    while (*ptr != WC_EOS && *ptr != TEXT(';') && *ptr != TEXT('}'))
     ptr++;      ptr++;
   return (ptr);    return (ptr);
 }  }
Line 236  char*       ptr; Line 243  char*       ptr;
    value and its unit.                                                value and its unit.                                           
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 static char*       ParseCSSUnit (char* cssRule, PresentationValue *pval)  static CHAR_T*       ParseCSSUnit (CHAR_T* cssRule, PresentationValue *pval)
 #else  #else
 static char*       ParseCSSUnit (cssRule, pval)  static CHAR_T*       ParseCSSUnit (cssRule, pval)
 char*              cssRule;  CHAR_T*              cssRule;
 PresentationValue  *pval;  PresentationValue  *pval;
 #endif  #endif
 {  {
Line 252  PresentationValue  *pval; Line 259  PresentationValue  *pval;
   
   pval->typed_data.unit = STYLE_UNIT_REL;    pval->typed_data.unit = STYLE_UNIT_REL;
   pval->typed_data.real = FALSE;    pval->typed_data.real = FALSE;
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipWCBlanksAndComments (cssRule);
   if (*cssRule == '-')    if (*cssRule == TEXT('-'))
     {      {
       minus = 1;        minus = 1;
       cssRule++;        cssRule++;
       cssRule = SkipBlanksAndComments (cssRule);        cssRule = SkipWCBlanksAndComments (cssRule);
     }      }
   
   if (*cssRule == '+')    if (*cssRule == TEXT('+'))
     {      {
       cssRule++;        cssRule++;
       cssRule = SkipBlanksAndComments (cssRule);        cssRule = SkipWCBlanksAndComments (cssRule);
     }      }
   
   while ((*cssRule >= '0') && (*cssRule <= '9'))    while ((*cssRule >= TEXT('0')) && (*cssRule <= TEXT('9')))
     {      {
       val *= 10;        val *= 10;
       val += *cssRule - '0';        val += *cssRule - TEXT('0');
       cssRule++;        cssRule++;
       valid = 1;        valid = 1;
     }      }
   
   if (*cssRule == '.')    if (*cssRule == TEXT('.'))
     {      {
       real = TRUE;        real = TRUE;
       f = val;        f = val;
       val = 0;        val = 0;
       cssRule++;        cssRule++;
       /* keep only 3 digits */        /* keep only 3 digits */
       if (*cssRule >= '0' && *cssRule <= '9')        if (*cssRule >= TEXT('0') && *cssRule <= TEXT('9'))
         {          {
           val = (*cssRule - '0') * 100;            val = (*cssRule - TEXT('0')) * 100;
           cssRule++;            cssRule++;
           if (*cssRule >= '0' && *cssRule <= '9')            if (*cssRule >= TEXT('0') && *cssRule <= TEXT('9'))
             {              {
               val += (*cssRule - '0') * 10;                val += (*cssRule - TEXT('0')) * 10;
               cssRule++;                cssRule++;
               if ((*cssRule >= '0') && (*cssRule <= '9'))                if ((*cssRule >= TEXT('0')) && (*cssRule <= TEXT('9')))
                 {                  {
                   val += *cssRule - '0';                    val += *cssRule - TEXT('0');
                   cssRule++;                    cssRule++;
                 }                  }
             }              }
   
           while (*cssRule >= '0' && *cssRule <= '9')            while (*cssRule >= TEXT('0') && *cssRule <= TEXT('9'))
             cssRule++;              cssRule++;
           valid = 1;            valid = 1;
         }          }
Line 310  PresentationValue  *pval; Line 317  PresentationValue  *pval;
     }      }
   else    else
     {      {
       cssRule = SkipBlanksAndComments (cssRule);        cssRule = SkipWCBlanksAndComments (cssRule);
       for (uni = 0; uni < NB_UNITS; uni++)        for (uni = 0; uni < NB_UNITS; uni++)
         {          {
           if (!strncasecmp (CSSUnitNames[uni].sign, cssRule, strlen (CSSUnitNames[uni].sign)))            if (!ustrncasecmp (CSSUnitNames[uni].sign, cssRule, ustrlen (CSSUnitNames[uni].sign)))
             {              {
               pval->typed_data.unit = CSSUnitNames[uni].unit;                pval->typed_data.unit = CSSUnitNames[uni].unit;
               pval->typed_data.real = real;                pval->typed_data.real = real;
Line 331  PresentationValue  *pval; Line 338  PresentationValue  *pval;
                   else                    else
                     pval->typed_data.value = val;                      pval->typed_data.value = val;
                 }                  }
               return (cssRule + strlen (CSSUnitNames[uni].sign));                return (cssRule + ustrlen (CSSUnitNames[uni].sign));
             }              }
         }          }
   
Line 360  PresentationValue  *pval; Line 367  PresentationValue  *pval;
    ParseBorderValue                                            ParseBorderValue                                       
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 static char*      ParseBorderValue (char* cssRule, PresentationValue *border)  static CHAR_T*      ParseBorderValue (CHAR_T* cssRule, PresentationValue *border)
 #else  #else
 static char*      ParseBorderValue (cssRule, border)  static CHAR_T*      ParseBorderValue (cssRule, border)
 char*             cssRule;  CHAR_T*             cssRule;
 PresentationValue *border  PresentationValue *border
 #endif  #endif
 {  {
Line 371  PresentationValue *border Line 378  PresentationValue *border
    border->typed_data.value = 0;     border->typed_data.value = 0;
    border->typed_data.unit = STYLE_UNIT_INVALID;     border->typed_data.unit = STYLE_UNIT_INVALID;
    border->typed_data.real = FALSE;     border->typed_data.real = FALSE;
    if (!strncasecmp (cssRule, "thin", 4))     if (!ustrncasecmp (cssRule, TEXT("thin"), 4))
      {       {
        border->typed_data.unit = STYLE_UNIT_PX;         border->typed_data.unit = STYLE_UNIT_PX;
        border->typed_data.value = 1;         border->typed_data.value = 1;
        cssRule = SkipWord (cssRule);         cssRule = SkipWord (cssRule);
      }       }
    else if (!strncasecmp (cssRule, "medium", 6))     else if (!ustrncasecmp (cssRule, TEXT("medium"), 6))
      {       {
        border->typed_data.unit = STYLE_UNIT_PX;         border->typed_data.unit = STYLE_UNIT_PX;
        border->typed_data.value = 3;         border->typed_data.value = 3;
        cssRule = SkipWord (cssRule);         cssRule = SkipWord (cssRule);
      }       }
    else if (!strncasecmp (cssRule, "thick", 5))     else if (!ustrncasecmp (cssRule, TEXT("thick"), 5))
      {       {
        border->typed_data.unit = STYLE_UNIT_PX;         border->typed_data.unit = STYLE_UNIT_PX;
        border->typed_data.value = 5;         border->typed_data.value = 5;
        cssRule = SkipWord (cssRule);         cssRule = SkipWord (cssRule);
      }       }
    else if (isdigit (*cssRule))     else if (TtaIsDigit (*cssRule))
      cssRule = ParseCSSUnit (cssRule, border);       cssRule = ParseCSSUnit (cssRule, border);
    return (cssRule);     return (cssRule);
 }  }
Line 398  PresentationValue *border Line 405  PresentationValue *border
    ParseBorderStyle                                           ParseBorderStyle                                      
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 static char*      ParseBorderStyle (char* cssRule, PresentationValue *border)  static CHAR_T*      ParseBorderStyle (CHAR_T* cssRule, PresentationValue *border)
 #else  #else
 static char*      ParseBorderStyle (cssRule, border)  static CHAR_T*      ParseBorderStyle (cssRule, border)
 char*             cssRule;  CHAR_T*             cssRule;
 PresentationValue *border  PresentationValue *border
 #endif  #endif
 {  {
Line 409  PresentationValue *border Line 416  PresentationValue *border
    border->typed_data.value = 0;     border->typed_data.value = 0;
    border->typed_data.unit = STYLE_UNIT_PX;     border->typed_data.unit = STYLE_UNIT_PX;
    border->typed_data.real = FALSE;     border->typed_data.real = FALSE;
    if (!strncasecmp (cssRule, "none", 4))     if (!ustrncasecmp (cssRule, TEXT("none"), 4))
      border->typed_data.value = STYLE_BORDERNONE;       border->typed_data.value = STYLE_BORDERNONE;
    else if (!strncasecmp (cssRule, "hidden", 6))     else if (!ustrncasecmp (cssRule, TEXT("hidden"), 6))
      border->typed_data.value = STYLE_BORDERHIDDEN;       border->typed_data.value = STYLE_BORDERHIDDEN;
    else if (!strncasecmp (cssRule, "dotted", 6))     else if (!ustrncasecmp (cssRule, TEXT("dotted"), 6))
      border->typed_data.value = STYLE_BORDERDOTTED;       border->typed_data.value = STYLE_BORDERDOTTED;
    else if (!strncasecmp (cssRule, "dashed", 6))     else if (!ustrncasecmp (cssRule, TEXT("dashed"), 6))
      border->typed_data.value = STYLE_BORDERDASHED;       border->typed_data.value = STYLE_BORDERDASHED;
    else if (!strncasecmp (cssRule, "solid", 5))     else if (!ustrncasecmp (cssRule, TEXT("solid"), 5))
      border->typed_data.value = STYLE_BORDERSOLID;       border->typed_data.value = STYLE_BORDERSOLID;
    else if (!strncasecmp (cssRule, "double", 6))     else if (!ustrncasecmp (cssRule, TEXT("double"), 6))
      border->typed_data.value = STYLE_BORDERDOUBLE;       border->typed_data.value = STYLE_BORDERDOUBLE;
    else if (!strncasecmp (cssRule, "groove", 6))     else if (!ustrncasecmp (cssRule, TEXT("groove"), 6))
      border->typed_data.value = STYLE_BORDERGROOVE;       border->typed_data.value = STYLE_BORDERGROOVE;
    else if (!strncasecmp (cssRule, "ridge", 5))     else if (!ustrncasecmp (cssRule, TEXT("ridge"), 5))
      border->typed_data.value = STYLE_BORDERRIDGE;       border->typed_data.value = STYLE_BORDERRIDGE;
    else if (!strncasecmp (cssRule, "inset", 5))     else if (!ustrncasecmp (cssRule, TEXT("inset"), 5))
      border->typed_data.value = STYLE_BORDERINSET;       border->typed_data.value = STYLE_BORDERINSET;
    else if (!strncasecmp (cssRule, "outset", 6))     else if (!ustrncasecmp (cssRule, TEXT("outset"), 6))
      border->typed_data.value = STYLE_BORDEROUTSET;       border->typed_data.value = STYLE_BORDEROUTSET;
    else     else
      {       {
Line 448  PresentationValue *border Line 455  PresentationValue *border
    table                                                              table                                                         
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 static char*       ParseCSSColor (char* cssRule, PresentationValue * val)  static CHAR_T*       ParseCSSColor (CHAR_T* cssRule, PresentationValue * val)
 #else  #else
 static char*       ParseCSSColor (cssRule, val)  static CHAR_T*       ParseCSSColor (cssRule, val)
 char*              cssRule;  CHAR_T*              cssRule;
 PresentationValue  *val;  PresentationValue    *val;
 #endif  #endif
 {  {
   char                colname[100];    CHAR_T              colname[100];
   char*               ptr;    CHAR_T*             ptr;
   unsigned short      redval = (unsigned short) -1;    unsigned short      redval = (unsigned short) -1;
   unsigned short      greenval = 0;     /* composant of each RGB       */    unsigned short      greenval = 0;     /* composant of each RGB       */
   unsigned short      blueval = 0;      /* default to red if unknown ! */    unsigned short      blueval = 0;      /* default to red if unknown ! */
Line 465  PresentationValue  *val; Line 472  PresentationValue  *val;
   int                 best = 0; /* best color in list found */    int                 best = 0; /* best color in list found */
   ThotBool            failed;    ThotBool            failed;
   
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipWCBlanksAndComments (cssRule);
   val->typed_data.unit = STYLE_UNIT_INVALID;    val->typed_data.unit = STYLE_UNIT_INVALID;
   val->typed_data.real = FALSE;    val->typed_data.real = FALSE;
   val->typed_data.value = 0;    val->typed_data.value = 0;
Line 476  PresentationValue  *val; Line 483  PresentationValue  *val;
    *        cause  we try first to lokup color name from digits     *        cause  we try first to lokup color name from digits
    *        [0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f]     *        [0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f]
    */     */
   if ((*cssRule == '#') ||    if ((*cssRule == TEXT('#')) ||
       (isxdigit (cssRule[0]) && isxdigit (cssRule[1]) &&        (isxdigit (cssRule[0]) && isxdigit (cssRule[1]) && isxdigit (cssRule[2])))
        isxdigit (cssRule[2])))  
     {      {
       if (*cssRule == '#')        if (*cssRule == TEXT('#'))
         cssRule++;          cssRule++;
       failed = FALSE;        failed = FALSE;
       /* we expect an hexa encoding like F00 or FF0000 */        /* we expect an hexa encoding like F00 or FF0000 */
       if ((!isxdigit (cssRule[0])) || (!isxdigit (cssRule[1])) ||        if ((!isxdigit (cssRule[0])) || (!isxdigit (cssRule[1])) || (!isxdigit (cssRule[2])))
           (!isxdigit (cssRule[2])))  
         {          {
           fprintf (stderr, "Invalid color encoding %s\n", cssRule - 1);            fprintf (stderr, "Invalid color encoding %s\n", cssRule - 1);
           failed = TRUE;            failed = TRUE;
Line 509  PresentationValue  *val; Line 514  PresentationValue  *val;
           cssRule = &cssRule[6];            cssRule = &cssRule[6];
         }          }
     }      }
   else if (!strncasecmp (cssRule, "rgb", 3))    else if (!ustrncasecmp (cssRule, TEXT("rgb"), 3))
     {      {
       cssRule = &cssRule[3];        cssRule = &cssRule[3];
       cssRule = SkipBlanksAndComments (cssRule);        cssRule = SkipWCBlanksAndComments (cssRule);
       if (*cssRule == '(')        if (*cssRule == TEXT('('))
         {          {
           cssRule++;            cssRule++;
           cssRule = SkipBlanksAndComments (cssRule);            cssRule = SkipWCBlanksAndComments (cssRule);
           failed = FALSE;            failed = FALSE;
           if (*cssRule == '%')            if (*cssRule == TEXT('%'))
             {              {
               /* encoded as rgb(%red,%green,&blue) */                /* encoded as rgb(%red,%green,&blue) */
               sscanf (cssRule, "%%%d", &r);                usscanf (cssRule, TEXT("%%%d"), &r);
               while (*cssRule != EOS && *cssRule != TEXT(','))                while (*cssRule != WC_EOS && *cssRule != TEXT(','))
                 cssRule++;                  cssRule++;
               cssRule++;                cssRule++;
               sscanf (cssRule, "%%%d", &g);                usscanf (cssRule, TEXT("%%%d"), &g);
               while (*cssRule != EOS && *cssRule != TEXT(','))                while (*cssRule != WC_EOS && *cssRule != TEXT(','))
                 cssRule++;                  cssRule++;
               cssRule++;                cssRule++;
               sscanf (cssRule, "%%%d", &b);                usscanf (cssRule, TEXT("%%%d"), &b);
               redval = (unsigned short)(r * 255 / 100);                redval = (unsigned short)(r * 255 / 100);
               greenval = (unsigned short)(g * 255 / 100);                greenval = (unsigned short)(g * 255 / 100);
               blueval = (unsigned short)(b * 255 / 100);                blueval = (unsigned short)(b * 255 / 100);
Line 537  PresentationValue  *val; Line 542  PresentationValue  *val;
           else            else
             {              {
               /* encoded as rgb(red,green,blue) */                /* encoded as rgb(red,green,blue) */
               sscanf (cssRule, "%d", &r);                usscanf (cssRule, TEXT("%d"), &r);
               while (*cssRule != EOS && *cssRule != ',')                while (*cssRule != WC_EOS && *cssRule != TEXT(','))
                 cssRule++;                  cssRule++;
               cssRule++;                cssRule++;
               sscanf (cssRule, "%d", &g);                usscanf (cssRule, TEXT("%d"), &g);
               while (*cssRule != EOS && *cssRule != ',')                while (*cssRule != WC_EOS && *cssRule != TEXT(','))
                 cssRule++;                  cssRule++;
               cssRule++;                cssRule++;
               sscanf (cssRule, "%d", &b);                usscanf (cssRule, TEXT("%d"), &b);
               redval = (unsigned short)r;                redval = (unsigned short)r;
               greenval = (unsigned short)g;                greenval = (unsigned short)g;
               blueval = (unsigned short)b;                blueval = (unsigned short)b;
             }              }
           /* search the rgb end */            /* search the rgb end */
           while (*cssRule != EOS && *cssRule != ')')            while (*cssRule != WC_EOS && *cssRule != TEXT(')'))
             cssRule++;              cssRule++;
           cssRule++;            cssRule++;
         }          }
       else        else
         cssRule = SkipProperty (cssRule);          cssRule = SkipProperty (cssRule);
     }      }
   else if (isalpha (*cssRule))    else if (TtaIsAlpha (*cssRule))
     {      {
       /* we expect a color name like "red", store it in colname */        /* we expect a color name like "red", store it in colname */
       ptr = cssRule;        ptr = cssRule;
       len = sizeof (colname) - 1;        len = (sizeof (colname) / sizeof (CHAR_T)) - 1;
       for (i = 0; i < len && ptr[i] != EOS; i++)        for (i = 0; i < len && ptr[i] != WC_EOS; i++)
         {          {
           if (!isalnum (ptr[i]) && ptr[i] != EOS)            if (!TtaIsAlnum (ptr[i]) && ptr[i] != WC_EOS)
             {              {
               ptr += i;                ptr += i;
               break;                break;
             }              }
           colname[i] = ptr[i];            colname[i] = ptr[i];
         }          }
       colname[i] = EOS;        colname[i] = WC_EOS;
               
       /* Lookup the color name in our own color name database */        /* Lookup the color name in our own color name database */
       for (i = 0; i < NBCOLORNAME; i++)        for (i = 0; i < NBCOLORNAME; i++)
         if (!strcasecmp (ColornameTable[i].name, colname))          if (!ustrcasecmp (ColornameTable[i].name, colname))
           {            {
             redval = ColornameTable[i].red;              redval = ColornameTable[i].red;
             greenval = ColornameTable[i].green;              greenval = ColornameTable[i].green;
Line 607  PresentationValue  *val; Line 612  PresentationValue  *val;
    attribute string.                                               attribute string.                                          
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 static char*        ParseCSSBorderTopWidth (Element element, PSchema tsch,  static CHAR_T*        ParseCSSBorderTopWidth (Element element, PSchema tsch,
                     PresentationContext context, char* cssRule, CSSInfoPtr css, ThotBool isHTML)                      PresentationContext context, CHAR_T* cssRule, CSSInfoPtr css, ThotBool isHTML)
 #else  #else
 static char*        ParseCSSBorderTopWidth (element, tsch, context, cssRule, css, isHTML)  static CHAR_T*        ParseCSSBorderTopWidth (element, tsch, context, cssRule, css, isHTML)
 Element             element;  Element             element;
 PSchema             tsch;  PSchema             tsch;
 PresentationContext context;  PresentationContext context;
 char*               cssRule;  CHAR_T*               cssRule;
 CSSInfoPtr          css;  CSSInfoPtr          css;
 ThotBool            isHTML;  ThotBool            isHTML;
 #endif  #endif
 {  {
   PresentationValue   border;    PresentationValue   border;
       
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipWCBlanksAndComments (cssRule);
   cssRule = ParseBorderValue (cssRule, &border);    cssRule = ParseBorderValue (cssRule, &border);
   if (border.typed_data.unit != STYLE_UNIT_INVALID)    if (border.typed_data.unit != STYLE_UNIT_INVALID)
     {      {
Line 637  ThotBool            isHTML; Line 642  ThotBool            isHTML;
    attribute string.                                               attribute string.                                          
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 static char*        ParseCSSBorderBottomWidth (Element element, PSchema tsch,  static CHAR_T*        ParseCSSBorderBottomWidth (Element element, PSchema tsch,
                     PresentationContext context, char* cssRule, CSSInfoPtr css, ThotBool isHTML)                      PresentationContext context, CHAR_T* cssRule, CSSInfoPtr css, ThotBool isHTML)
 #else  #else
 static char*        ParseCSSBorderBottomWidth (element, tsch, context, cssRule, css, isHTML)  static CHAR_T*        ParseCSSBorderBottomWidth (element, tsch, context, cssRule, css, isHTML)
 Element             element;  Element             element;
 PSchema             tsch;  PSchema             tsch;
 PresentationContext context;  PresentationContext context;
 char*               cssRule;  CHAR_T*               cssRule;
 CSSInfoPtr          css;  CSSInfoPtr          css;
 ThotBool            isHTML;  ThotBool            isHTML;
 #endif  #endif
 {  {
   PresentationValue   border;    PresentationValue   border;
       
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipWCBlanksAndComments (cssRule);
   /* first parse the attribute string */    /* first parse the attribute string */
   cssRule = ParseBorderValue (cssRule, &border);    cssRule = ParseBorderValue (cssRule, &border);
   if (border.typed_data.unit != STYLE_UNIT_INVALID)    if (border.typed_data.unit != STYLE_UNIT_INVALID)
Line 668  ThotBool            isHTML; Line 673  ThotBool            isHTML;
    attribute string.                                               attribute string.                                          
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 static char*        ParseCSSBorderLeftWidth (Element element, PSchema tsch,  static CHAR_T*        ParseCSSBorderLeftWidth (Element element, PSchema tsch,
                     PresentationContext context, char* cssRule, CSSInfoPtr css, ThotBool isHTML)                      PresentationContext context, CHAR_T* cssRule, CSSInfoPtr css, ThotBool isHTML)
 #else  #else
 static char*        ParseCSSBorderLeftWidth (element, tsch, context, cssRule, css, isHTML)  static CHAR_T*        ParseCSSBorderLeftWidth (element, tsch, context, cssRule, css, isHTML)
 Element             element;  Element             element;
 PSchema             tsch;  PSchema             tsch;
 PresentationContext context;  PresentationContext context;
 char*               cssRule;  CHAR_T*               cssRule;
 CSSInfoPtr          css;  CSSInfoPtr          css;
 ThotBool            isHTML;  ThotBool            isHTML;
 #endif  #endif
 {  {
   PresentationValue   border;    PresentationValue   border;
       
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipWCBlanksAndComments (cssRule);
   /* first parse the attribute string */    /* first parse the attribute string */
   cssRule = ParseBorderValue (cssRule, &border);    cssRule = ParseBorderValue (cssRule, &border);
   if (border.typed_data.unit != STYLE_UNIT_INVALID)    if (border.typed_data.unit != STYLE_UNIT_INVALID)
Line 699  ThotBool            isHTML; Line 704  ThotBool            isHTML;
    attribute string.                                               attribute string.                                          
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 static char*        ParseCSSBorderRightWidth (Element element, PSchema tsch,  static CHAR_T*        ParseCSSBorderRightWidth (Element element, PSchema tsch,
                     PresentationContext context, char* cssRule, CSSInfoPtr css, ThotBool isHTML)                      PresentationContext context, CHAR_T* cssRule, CSSInfoPtr css, ThotBool isHTML)
 #else  #else
 static char*        ParseCSSBorderRightWidth (element, tsch, context, cssRule, css, isHTML)  static CHAR_T*        ParseCSSBorderRightWidth (element, tsch, context, cssRule, css, isHTML)
 Element             element;  Element             element;
 PSchema             tsch;  PSchema             tsch;
 PresentationContext context;  PresentationContext context;
 char*               cssRule;  CHAR_T*               cssRule;
 CSSInfoPtr          css;  CSSInfoPtr          css;
 ThotBool            isHTML;  ThotBool            isHTML;
 #endif  #endif
 {  {
   PresentationValue   border;    PresentationValue   border;
       
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipWCBlanksAndComments (cssRule);
   /* first parse the attribute string */    /* first parse the attribute string */
   cssRule = ParseBorderValue (cssRule, &border);    cssRule = ParseBorderValue (cssRule, &border);
   if (border.typed_data.unit != STYLE_UNIT_INVALID)    if (border.typed_data.unit != STYLE_UNIT_INVALID)
Line 730  ThotBool            isHTML; Line 735  ThotBool            isHTML;
    attribute string.                                               attribute string.                                          
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 static char*        ParseCSSBorderWidth (Element element, PSchema tsch,  static CHAR_T*        ParseCSSBorderWidth (Element element, PSchema tsch,
                     PresentationContext context, char* cssRule, CSSInfoPtr css, ThotBool isHTML)                      PresentationContext context, CHAR_T* cssRule, CSSInfoPtr css, ThotBool isHTML)
 #else  #else
 static char*        ParseCSSBorderWidth (element, tsch, context, cssRule, css, isHTML)  static CHAR_T*        ParseCSSBorderWidth (element, tsch, context, cssRule, css, isHTML)
 Element             element;  Element             element;
 PSchema             tsch;  PSchema             tsch;
 PresentationContext context;  PresentationContext context;
 char*               cssRule;  CHAR_T*               cssRule;
 CSSInfoPtr          css;  CSSInfoPtr          css;
 ThotBool            isHTML;  ThotBool            isHTML;
 #endif  #endif
 {  {
   char *ptrT, *ptrR, *ptrB, *ptrL;    CHAR_T *ptrT, *ptrR, *ptrB, *ptrL;
   
   ptrT = SkipBlanksAndComments (cssRule);    ptrT = SkipWCBlanksAndComments (cssRule);
   /* First parse Border-Top */    /* First parse Border-Top */
   ptrR = ParseCSSBorderTopWidth (element, tsch, context, ptrT, css, isHTML);    ptrR = ParseCSSBorderTopWidth (element, tsch, context, ptrT, css, isHTML);
   ptrR = SkipBlanksAndComments (ptrR);    ptrR = SkipWCBlanksAndComments (ptrR);
   if (*ptrR == ';' || *ptrR == EOS || *ptrR == ',')    if (*ptrR == TEXT(';') || *ptrR == WC_EOS || *ptrR == TEXT(','))
     {      {
       cssRule = ptrR;        cssRule = ptrR;
       /* apply the Border-Top to all */        /* apply the Border-Top to all */
Line 760  ThotBool            isHTML; Line 765  ThotBool            isHTML;
     {      {
       /* parse Border-Right */        /* parse Border-Right */
       ptrB = ParseCSSBorderRightWidth (element, tsch, context, ptrR, css, isHTML);        ptrB = ParseCSSBorderRightWidth (element, tsch, context, ptrR, css, isHTML);
       ptrB = SkipBlanksAndComments (ptrB);        ptrB = SkipWCBlanksAndComments (ptrB);
       if (*ptrB == ';' || *ptrB == EOS || *ptrB == ',')        if (*ptrB == TEXT(';') || *ptrB == WC_EOS || *ptrB == TEXT(','))
         {          {
           cssRule = ptrB;            cssRule = ptrB;
           /* apply the Border-Top to Border-Bottom */            /* apply the Border-Top to Border-Bottom */
Line 773  ThotBool            isHTML; Line 778  ThotBool            isHTML;
         {          {
           /* parse Border-Bottom */            /* parse Border-Bottom */
           ptrL = ParseCSSBorderBottomWidth (element, tsch, context, ptrB, css, isHTML);            ptrL = ParseCSSBorderBottomWidth (element, tsch, context, ptrB, css, isHTML);
           ptrL = SkipBlanksAndComments (ptrL);            ptrL = SkipWCBlanksAndComments (ptrL);
           if (*ptrL == ';' || *ptrL == EOS || *ptrL == ',')            if (*ptrL == TEXT(';') || *ptrL == WC_EOS || *ptrL == TEXT(','))
             {              {
               cssRule = ptrL;                cssRule = ptrL;
               /* apply the Border-Right to Border-Left */                /* apply the Border-Right to Border-Left */
Line 783  ThotBool            isHTML; Line 788  ThotBool            isHTML;
           else            else
             /* parse Border-Left */              /* parse Border-Left */
             cssRule = ParseCSSBorderLeftWidth (element, tsch, context, ptrL, css, isHTML);              cssRule = ParseCSSBorderLeftWidth (element, tsch, context, ptrL, css, isHTML);
           cssRule = SkipBlanksAndComments (cssRule);            cssRule = SkipWCBlanksAndComments (cssRule);
         }          }
     }      }
   return (cssRule);    return (cssRule);
Line 794  ThotBool            isHTML; Line 799  ThotBool            isHTML;
    attribute string.                                               attribute string.                                          
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 static char*        ParseCSSBorderColorTop (Element element, PSchema tsch,  static CHAR_T*      ParseCSSBorderColorTop (Element element, PSchema tsch,
                                  PresentationContext context, char* cssRule, CSSInfoPtr css, ThotBool isHTML)                                   PresentationContext context, CHAR_T* cssRule, CSSInfoPtr css, ThotBool isHTML)
 #else  #else
 static char*        ParseCSSBorderColorTop (element, tsch, context, cssRule, css, isHTML)  static CHAR_T*      ParseCSSBorderColorTop (element, tsch, context, cssRule, css, isHTML)
 Element             element;  Element             element;
 PSchema             tsch;  PSchema             tsch;
 PresentationContext context;  PresentationContext context;
 char*               cssRule;  CHAR_T*             cssRule;
 CSSInfoPtr          css;  CSSInfoPtr          css;
 ThotBool            isHTML;  ThotBool            isHTML;
 #endif  #endif
Line 820  ThotBool            isHTML; Line 825  ThotBool            isHTML;
    attribute string.                                               attribute string.                                          
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 static char*        ParseCSSBorderColorLeft (Element element, PSchema tsch,  static CHAR_T*      ParseCSSBorderColorLeft (Element element, PSchema tsch,
                                  PresentationContext context, char* cssRule, CSSInfoPtr css, ThotBool isHTML)                                   PresentationContext context, CHAR_T* cssRule, CSSInfoPtr css, ThotBool isHTML)
 #else  #else
 static char*        ParseCSSBorderColorLeft (element, tsch, context, cssRule, css, isHTML)  static CHAR_T*      ParseCSSBorderColorLeft (element, tsch, context, cssRule, css, isHTML)
 Element             element;  Element             element;
 PSchema             tsch;  PSchema             tsch;
 PresentationContext context;  PresentationContext context;
 STRING              cssRule;  CHAR_T*             cssRule;
 CSSInfoPtr          css;  CSSInfoPtr          css;
 ThotBool            isHTML;  ThotBool            isHTML;
 #endif  #endif
Line 846  ThotBool            isHTML; Line 851  ThotBool            isHTML;
    attribute string.                                               attribute string.                                          
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 static char*        ParseCSSBorderColorBottom (Element element, PSchema tsch,  static CHAR_T*      ParseCSSBorderColorBottom (Element element, PSchema tsch,
                                  PresentationContext context, char* cssRule, CSSInfoPtr css, ThotBool isHTML)                                   PresentationContext context, CHAR_T* cssRule, CSSInfoPtr css, ThotBool isHTML)
 #else  #else
 static char*        ParseCSSBorderColorBottom (element, tsch, context, cssRule, css, isHTML)  static CHAR_T*        ParseCSSBorderColorBottom (element, tsch, context, cssRule, css, isHTML)
 Element             element;  Element             element;
 PSchema             tsch;  PSchema             tsch;
 PresentationContext context;  PresentationContext context;
 STRING              cssRule;  CHAR_T*             cssRule;
 CSSInfoPtr          css;  CSSInfoPtr          css;
 ThotBool            isHTML;  ThotBool            isHTML;
 #endif  #endif
Line 872  ThotBool            isHTML; Line 877  ThotBool            isHTML;
    attribute string.                                               attribute string.                                          
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 static char*        ParseCSSBorderColorRight (Element element, PSchema tsch,  static CHAR_T*      ParseCSSBorderColorRight (Element element, PSchema tsch,
                                  PresentationContext context, char* cssRule, CSSInfoPtr css, ThotBool isHTML)                                   PresentationContext context, CHAR_T* cssRule, CSSInfoPtr css, ThotBool isHTML)
 #else  #else
 static char*        ParseCSSBorderColorRight (element, tsch, context, cssRule, css, isHTML)  static CHAR_T*        ParseCSSBorderColorRight (element, tsch, context, cssRule, css, isHTML)
 Element             element;  Element             element;
 PSchema             tsch;  PSchema             tsch;
 PresentationContext context;  PresentationContext context;
 STRING              cssRule;  CHAR_T*             cssRule;
 CSSInfoPtr          css;  CSSInfoPtr          css;
 ThotBool            isHTML;  ThotBool            isHTML;
 #endif  #endif
Line 898  ThotBool            isHTML; Line 903  ThotBool            isHTML;
    attribute string.                                               attribute string.                                          
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 static char*        ParseCSSBorderColor (Element element, PSchema tsch,  static CHAR_T*        ParseCSSBorderColor (Element element, PSchema tsch,
                     PresentationContext context, char* cssRule, CSSInfoPtr css, ThotBool isHTML)                      PresentationContext context, CHAR_T* cssRule, CSSInfoPtr css, ThotBool isHTML)
 #else  #else
 static char*        ParseCSSBorderColor (element, tsch, context, cssRule, css, isHTML)  static CHAR_T*        ParseCSSBorderColor (element, tsch, context, cssRule, css, isHTML)
 Element             element;  Element             element;
 PSchema             tsch;  PSchema             tsch;
 PresentationContext context;  PresentationContext context;
 char*               cssRule;  CHAR_T*               cssRule;
 CSSInfoPtr          css;  CSSInfoPtr          css;
 ThotBool            isHTML;  ThotBool            isHTML;
 #endif  #endif
 {  {
   char *ptrT, *ptrR, *ptrB, *ptrL;    CHAR_T *ptrT, *ptrR, *ptrB, *ptrL;
   
   ptrT = SkipBlanksAndComments (cssRule);    ptrT = SkipWCBlanksAndComments (cssRule);
   /* First parse Border-Top */    /* First parse Border-Top */
   ptrR = ParseCSSBorderColorTop (element, tsch, context, ptrT, css, isHTML);    ptrR = ParseCSSBorderColorTop (element, tsch, context, ptrT, css, isHTML);
   ptrR = SkipBlanksAndComments (ptrR);    ptrR = SkipWCBlanksAndComments (ptrR);
   if (*ptrR == ';' || *ptrR == EOS || *ptrR == ',')    if (*ptrR == TEXT(';') || *ptrR == WC_EOS || *ptrR == TEXT(','))
     {      {
       cssRule = ptrR;        cssRule = ptrR;
       /* apply the Border-Top to all */        /* apply the Border-Top to all */
Line 928  ThotBool            isHTML; Line 933  ThotBool            isHTML;
     {      {
       /* parse Border-Right */        /* parse Border-Right */
       ptrB = ParseCSSBorderColorRight (element, tsch, context, ptrR, css, isHTML);        ptrB = ParseCSSBorderColorRight (element, tsch, context, ptrR, css, isHTML);
       ptrB = SkipBlanksAndComments (ptrB);        ptrB = SkipWCBlanksAndComments (ptrB);
       if (*ptrB == ';' || *ptrB == EOS || *ptrB == ',')        if (*ptrB == TEXT(';') || *ptrB == WC_EOS || *ptrB == TEXT(','))
         {          {
           cssRule = ptrB;            cssRule = ptrB;
           /* apply the Border-Top to Border-Bottom */            /* apply the Border-Top to Border-Bottom */
Line 941  ThotBool            isHTML; Line 946  ThotBool            isHTML;
         {          {
           /* parse Border-Bottom */            /* parse Border-Bottom */
           ptrL = ParseCSSBorderColorBottom (element, tsch, context, ptrB, css, isHTML);            ptrL = ParseCSSBorderColorBottom (element, tsch, context, ptrB, css, isHTML);
           ptrL = SkipBlanksAndComments (ptrL);            ptrL = SkipWCBlanksAndComments (ptrL);
           if (*ptrL == ';' || *ptrL == EOS || *ptrL == ',')            if (*ptrL == TEXT(';') || *ptrL == WC_EOS || *ptrL == TEXT(','))
             {              {
               cssRule = ptrL;                cssRule = ptrL;
               /* apply the Border-Right to Border-Left */                /* apply the Border-Right to Border-Left */
Line 951  ThotBool            isHTML; Line 956  ThotBool            isHTML;
           else            else
             /* parse Border-Left */              /* parse Border-Left */
             cssRule = ParseCSSBorderColorLeft (element, tsch, context, ptrL, css, isHTML);              cssRule = ParseCSSBorderColorLeft (element, tsch, context, ptrL, css, isHTML);
           cssRule = SkipBlanksAndComments (cssRule);            cssRule = SkipWCBlanksAndComments (cssRule);
         }          }
     }      }
   return (cssRule);    return (cssRule);
Line 962  ThotBool            isHTML; Line 967  ThotBool            isHTML;
    attribute string.                                               attribute string.                                          
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 static char*        ParseCSSBorderStyleTop (Element element, PSchema tsch,  static CHAR_T*        ParseCSSBorderStyleTop (Element element, PSchema tsch,
                     PresentationContext context, char* cssRule, CSSInfoPtr css, ThotBool isHTML)                      PresentationContext context, CHAR_T* cssRule, CSSInfoPtr css, ThotBool isHTML)
 #else  #else
 static char*        ParseCSSBorderStyleTop (element, tsch, context, cssRule, css, isHTML)  static CHAR_T*        ParseCSSBorderStyleTop (element, tsch, context, cssRule, css, isHTML)
 Element             element;  Element             element;
 PSchema             tsch;  PSchema             tsch;
 PresentationContext context;  PresentationContext context;
 char*               cssRule;  CHAR_T*               cssRule;
 CSSInfoPtr          css;  CSSInfoPtr          css;
 ThotBool            isHTML;  ThotBool            isHTML;
 #endif  #endif
 {  {
   PresentationValue   border;    PresentationValue   border;
       
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipWCBlanksAndComments (cssRule);
   cssRule = ParseBorderStyle (cssRule, &border);    cssRule = ParseBorderStyle (cssRule, &border);
   if (border.typed_data.unit != STYLE_UNIT_INVALID)    if (border.typed_data.unit != STYLE_UNIT_INVALID)
     TtaSetStylePresentation (PRBorderTopStyle, element, tsch, context, border);      TtaSetStylePresentation (PRBorderTopStyle, element, tsch, context, border);
Line 988  ThotBool            isHTML; Line 993  ThotBool            isHTML;
    attribute string.                                               attribute string.                                          
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 static char*        ParseCSSBorderStyleLeft (Element element, PSchema tsch,  static CHAR_T*        ParseCSSBorderStyleLeft (Element element, PSchema tsch,
                     PresentationContext context, char* cssRule, CSSInfoPtr css, ThotBool isHTML)                      PresentationContext context, CHAR_T* cssRule, CSSInfoPtr css, ThotBool isHTML)
 #else  #else
 static char*        ParseCSSBorderStyleLeft (element, tsch, context, cssRule, css, isHTML)  static CHAR_T*        ParseCSSBorderStyleLeft (element, tsch, context, cssRule, css, isHTML)
 Element             element;  Element             element;
 PSchema             tsch;  PSchema             tsch;
 PresentationContext context;  PresentationContext context;
 char*               cssRule;  CHAR_T*               cssRule;
 CSSInfoPtr          css;  CSSInfoPtr          css;
 ThotBool            isHTML;  ThotBool            isHTML;
 #endif  #endif
 {  {
   PresentationValue   border;    PresentationValue   border;
       
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipWCBlanksAndComments (cssRule);
   cssRule = ParseBorderStyle (cssRule, &border);    cssRule = ParseBorderStyle (cssRule, &border);
   if (border.typed_data.unit != STYLE_UNIT_INVALID)    if (border.typed_data.unit != STYLE_UNIT_INVALID)
     TtaSetStylePresentation (PRBorderLeftStyle, element, tsch, context, border);      TtaSetStylePresentation (PRBorderLeftStyle, element, tsch, context, border);
Line 1014  ThotBool            isHTML; Line 1019  ThotBool            isHTML;
    attribute string.                                               attribute string.                                          
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 static char*        ParseCSSBorderStyleBottom (Element element, PSchema tsch,  static CHAR_T*        ParseCSSBorderStyleBottom (Element element, PSchema tsch,
                     PresentationContext context, char* cssRule, CSSInfoPtr css, ThotBool isHTML)                      PresentationContext context, CHAR_T* cssRule, CSSInfoPtr css, ThotBool isHTML)
 #else  #else
 static char*        ParseCSSBorderStyleBottom (element, tsch, context, cssRule, css, isHTML)  static CHAR_T*        ParseCSSBorderStyleBottom (element, tsch, context, cssRule, css, isHTML)
 Element             element;  Element             element;
 PSchema             tsch;  PSchema             tsch;
 PresentationContext context;  PresentationContext context;
 char*               cssRule;  CHAR_T*               cssRule;
 CSSInfoPtr          css;  CSSInfoPtr          css;
 ThotBool            isHTML;  ThotBool            isHTML;
 #endif  #endif
 {  {
   PresentationValue   border;    PresentationValue   border;
       
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipWCBlanksAndComments (cssRule);
   cssRule = ParseBorderStyle (cssRule, &border);    cssRule = ParseBorderStyle (cssRule, &border);
   if (border.typed_data.unit != STYLE_UNIT_INVALID)    if (border.typed_data.unit != STYLE_UNIT_INVALID)
     TtaSetStylePresentation (PRBorderBottomStyle, element, tsch, context, border);      TtaSetStylePresentation (PRBorderBottomStyle, element, tsch, context, border);
Line 1040  ThotBool            isHTML; Line 1045  ThotBool            isHTML;
    attribute string.                                               attribute string.                                          
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 static char*        ParseCSSBorderStyleRight (Element element, PSchema tsch,  static CHAR_T*        ParseCSSBorderStyleRight (Element element, PSchema tsch,
                     PresentationContext context, char* cssRule, CSSInfoPtr css, ThotBool isHTML)                      PresentationContext context, CHAR_T* cssRule, CSSInfoPtr css, ThotBool isHTML)
 #else  #else
 static char*        ParseCSSBorderStyleRight (element, tsch, context, cssRule, css, isHTML)  static CHAR_T*        ParseCSSBorderStyleRight (element, tsch, context, cssRule, css, isHTML)
 Element             element;  Element             element;
 PSchema             tsch;  PSchema             tsch;
 PresentationContext context;  PresentationContext context;
 char*               cssRule;  CHAR_T*               cssRule;
 CSSInfoPtr          css;  CSSInfoPtr          css;
 ThotBool            isHTML;  ThotBool            isHTML;
 #endif  #endif
 {  {
   PresentationValue   border;    PresentationValue   border;
       
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipWCBlanksAndComments (cssRule);
   cssRule = ParseBorderStyle (cssRule, &border);    cssRule = ParseBorderStyle (cssRule, &border);
   if (border.typed_data.unit != STYLE_UNIT_INVALID)    if (border.typed_data.unit != STYLE_UNIT_INVALID)
     TtaSetStylePresentation (PRBorderRightStyle, element, tsch, context, border);      TtaSetStylePresentation (PRBorderRightStyle, element, tsch, context, border);
Line 1066  ThotBool            isHTML; Line 1071  ThotBool            isHTML;
    attribute string.                                               attribute string.                                          
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 static char*        ParseCSSBorderStyle (Element element, PSchema tsch,  static CHAR_T*        ParseCSSBorderStyle (Element element, PSchema tsch,
                                  PresentationContext context, char* cssRule, CSSInfoPtr css, ThotBool isHTML)                                   PresentationContext context, CHAR_T* cssRule, CSSInfoPtr css, ThotBool isHTML)
 #else  #else
 static char*        ParseCSSBorderStyle (element, tsch, context, cssRule, css, isHTML)  static CHAR_T*        ParseCSSBorderStyle (element, tsch, context, cssRule, css, isHTML)
 Element             element;  Element             element;
 PSchema             tsch;  PSchema             tsch;
 PresentationContext context;  PresentationContext context;
 char*               cssRule;  CHAR_T*               cssRule;
 CSSInfoPtr          css;  CSSInfoPtr          css;
 ThotBool            isHTML;  ThotBool            isHTML;
 #endif  #endif
 {  {
   char *ptrT, *ptrR, *ptrB, *ptrL;    CHAR_T *ptrT, *ptrR, *ptrB, *ptrL;
   
   ptrT = SkipBlanksAndComments (cssRule);    ptrT = SkipWCBlanksAndComments (cssRule);
   /* First parse Border-Top */    /* First parse Border-Top */
   ptrR = ParseCSSBorderStyleTop (element, tsch, context, ptrT, css, isHTML);    ptrR = ParseCSSBorderStyleTop (element, tsch, context, ptrT, css, isHTML);
   ptrR = SkipBlanksAndComments (ptrR);    ptrR = SkipWCBlanksAndComments (ptrR);
   if (*ptrR == ';' || *ptrR == EOS || *ptrR == ',')    if (*ptrR == TEXT(';') || *ptrR == WC_EOS || *ptrR == TEXT(','))
     {      {
       cssRule = ptrR;        cssRule = ptrR;
       /* apply the Border-Top to all */        /* apply the Border-Top to all */
Line 1096  ThotBool            isHTML; Line 1101  ThotBool            isHTML;
     {      {
       /* parse Border-Right */        /* parse Border-Right */
       ptrB = ParseCSSBorderStyleRight (element, tsch, context, ptrR, css, isHTML);        ptrB = ParseCSSBorderStyleRight (element, tsch, context, ptrR, css, isHTML);
       ptrB = SkipBlanksAndComments (ptrB);        ptrB = SkipWCBlanksAndComments (ptrB);
       if (*ptrB == ';' || *ptrB == EOS || *ptrB == ',')        if (*ptrB == TEXT(';') || *ptrB == WC_EOS || *ptrB == TEXT(','))
         {          {
           cssRule = ptrB;            cssRule = ptrB;
           /* apply the Border-Top to Border-Bottom */            /* apply the Border-Top to Border-Bottom */
Line 1109  ThotBool            isHTML; Line 1114  ThotBool            isHTML;
         {          {
           /* parse Border-Bottom */            /* parse Border-Bottom */
           ptrL = ParseCSSBorderStyleBottom (element, tsch, context, ptrB, css, isHTML);            ptrL = ParseCSSBorderStyleBottom (element, tsch, context, ptrB, css, isHTML);
           ptrL = SkipBlanksAndComments (ptrL);            ptrL = SkipWCBlanksAndComments (ptrL);
           if (*ptrL == ';' || *ptrL == EOS || *ptrL == ',')            if (*ptrL == TEXT(';') || *ptrL == WC_EOS || *ptrL == TEXT(','))
             {              {
               cssRule = ptrL;                cssRule = ptrL;
               /* apply the Border-Right to Border-Left */                /* apply the Border-Right to Border-Left */
Line 1119  ThotBool            isHTML; Line 1124  ThotBool            isHTML;
           else            else
             /* parse Border-Left */              /* parse Border-Left */
             cssRule = ParseCSSBorderStyleLeft (element, tsch, context, ptrL, css, isHTML);              cssRule = ParseCSSBorderStyleLeft (element, tsch, context, ptrL, css, isHTML);
           cssRule = SkipBlanksAndComments (cssRule);            cssRule = SkipWCBlanksAndComments (cssRule);
         }          }
     }      }
   return (cssRule);    return (cssRule);
Line 1130  ThotBool            isHTML; Line 1135  ThotBool            isHTML;
    attribute string.                                               attribute string.                                          
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 static char*        ParseCSSBorderTop (Element element, PSchema tsch,  static CHAR_T*      ParseCSSBorderTop (Element element, PSchema tsch,
                                  PresentationContext context, char* cssRule, CSSInfoPtr css, ThotBool isHTML)                                   PresentationContext context, CHAR_T* cssRule, CSSInfoPtr css, ThotBool isHTML)
 #else  #else
 static char*        ParseCSSBorderTop (element, tsch, context, cssRule, css, isHTML)  static CHAR_T*      ParseCSSBorderTop (element, tsch, context, cssRule, css, isHTML)
 Element             element;  Element             element;
 PSchema             tsch;  PSchema             tsch;
 PresentationContext context;  PresentationContext context;
 char*               cssRule;  CHAR_T*             cssRule;
 CSSInfoPtr          css;  CSSInfoPtr          css;
 ThotBool            isHTML;  ThotBool            isHTML;
 #endif  #endif
 {  {
   char*            ptr;    CHAR_T*           ptr;
   
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipWCBlanksAndComments (cssRule);
   while (*cssRule != ';' && *cssRule != EOS && *cssRule != ',')    while (*cssRule != TEXT(';') && *cssRule != WC_EOS && *cssRule != TEXT(','))
     {      {
       ptr = cssRule;        ptr = cssRule;
       cssRule = ParseCSSBorderStyleTop (element, tsch, context, cssRule, css, isHTML);        cssRule = ParseCSSBorderStyleTop (element, tsch, context, cssRule, css, isHTML);
Line 1156  ThotBool            isHTML; Line 1161  ThotBool            isHTML;
       if (ptr == cssRule)        if (ptr == cssRule)
         /* rule not found */          /* rule not found */
         cssRule = SkipProperty (cssRule);          cssRule = SkipProperty (cssRule);
       cssRule = SkipBlanksAndComments (cssRule);        cssRule = SkipWCBlanksAndComments (cssRule);
     }      }
   return (cssRule);    return (cssRule);
 }  }
Line 1166  ThotBool            isHTML; Line 1171  ThotBool            isHTML;
    attribute string.                                               attribute string.                                          
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 static char*        ParseCSSBorderLeft (Element element, PSchema tsch,  static CHAR_T*      ParseCSSBorderLeft (Element element, PSchema tsch,
                                  PresentationContext context, char* cssRule, CSSInfoPtr css, ThotBool isHTML)                                   PresentationContext context, CHAR_T* cssRule, CSSInfoPtr css, ThotBool isHTML)
 #else  #else
 static char*        ParseCSSBorderLeft (element, tsch, context, cssRule, css, isHTML)  static CHAR_T*      ParseCSSBorderLeft (element, tsch, context, cssRule, css, isHTML)
 Element             element;  Element             element;
 PSchema             tsch;  PSchema             tsch;
 PresentationContext context;  PresentationContext context;
 char*               cssRule;  CHAR_T*             cssRule;
 CSSInfoPtr          css;  CSSInfoPtr          css;
 ThotBool            isHTML;  ThotBool            isHTML;
 #endif  #endif
 {  {
   char* ptr;    CHAR_T*           ptr;
   
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipWCBlanksAndComments (cssRule);
   while (*cssRule != ';' && *cssRule != EOS && *cssRule != ',')    while (*cssRule != TEXT(';') && *cssRule != WC_EOS && *cssRule != TEXT(','))
     {      {
       ptr = cssRule;        ptr = cssRule;
       cssRule = ParseCSSBorderStyleLeft (element, tsch, context, cssRule, css, isHTML);        cssRule = ParseCSSBorderStyleLeft (element, tsch, context, cssRule, css, isHTML);
Line 1192  ThotBool            isHTML; Line 1197  ThotBool            isHTML;
       if (ptr == cssRule)        if (ptr == cssRule)
         /* rule not found */          /* rule not found */
         cssRule = SkipProperty (cssRule);          cssRule = SkipProperty (cssRule);
       cssRule = SkipBlanksAndComments (cssRule);        cssRule = SkipWCBlanksAndComments (cssRule);
     }      }
   return (cssRule);    return (cssRule);
 }  }
Line 1202  ThotBool            isHTML; Line 1207  ThotBool            isHTML;
    attribute string.                                               attribute string.                                          
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 static char*        ParseCSSBorderBottom (Element element, PSchema tsch,  static CHAR_T*      ParseCSSBorderBottom (Element element, PSchema tsch,
                                  PresentationContext context, char* cssRule, CSSInfoPtr css, ThotBool isHTML)                                   PresentationContext context, CHAR_T* cssRule, CSSInfoPtr css, ThotBool isHTML)
 #else  #else
 static char*        ParseCSSBorderBottom (element, tsch, context, cssRule, css, isHTML)  static CHAR_T*      ParseCSSBorderBottom (element, tsch, context, cssRule, css, isHTML)
 Element             element;  Element             element;
 PSchema             tsch;  PSchema             tsch;
 PresentationContext context;  PresentationContext context;
 char*               cssRule;  CHAR_T*             cssRule;
 CSSInfoPtr          css;  CSSInfoPtr          css;
 ThotBool            isHTML;  ThotBool            isHTML;
 #endif  #endif
 {  {
   char*             ptr;    CHAR_T*           ptr;
   
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipWCBlanksAndComments (cssRule);
   while (*cssRule != ';' && *cssRule != EOS && *cssRule != ',')    while (*cssRule != TEXT(';') && *cssRule != WC_EOS && *cssRule != TEXT(','))
     {      {
       ptr = cssRule;        ptr = cssRule;
       cssRule = ParseCSSBorderStyleBottom (element, tsch, context, cssRule, css, isHTML);        cssRule = ParseCSSBorderStyleBottom (element, tsch, context, cssRule, css, isHTML);
Line 1228  ThotBool            isHTML; Line 1233  ThotBool            isHTML;
       if (ptr == cssRule)        if (ptr == cssRule)
         /* rule not found */          /* rule not found */
         cssRule = SkipProperty (cssRule);          cssRule = SkipProperty (cssRule);
       cssRule = SkipBlanksAndComments (cssRule);        cssRule = SkipWCBlanksAndComments (cssRule);
     }      }
   return (cssRule);    return (cssRule);
 }  }
Line 1238  ThotBool            isHTML; Line 1243  ThotBool            isHTML;
    attribute string.                                               attribute string.                                          
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 static char*        ParseCSSBorderRight (Element element, PSchema tsch,  static CHAR_T*        ParseCSSBorderRight (Element element, PSchema tsch,
                                  PresentationContext context, char* cssRule, CSSInfoPtr css, ThotBool isHTML)                                   PresentationContext context, CHAR_T* cssRule, CSSInfoPtr css, ThotBool isHTML)
 #else  #else
 static char*        ParseCSSBorderRight (element, tsch, context, cssRule, css, isHTML)  static CHAR_T*        ParseCSSBorderRight (element, tsch, context, cssRule, css, isHTML)
 Element             element;  Element             element;
 PSchema             tsch;  PSchema             tsch;
 PresentationContext context;  PresentationContext context;
 char*               cssRule;  CHAR_T*               cssRule;
 CSSInfoPtr          css;  CSSInfoPtr          css;
 ThotBool            isHTML;  ThotBool            isHTML;
 #endif  #endif
 {  {
   char*            ptr;    CHAR_T*            ptr;
   
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipWCBlanksAndComments (cssRule);
   while (*cssRule != ';' && *cssRule != EOS && *cssRule != ',')    while (*cssRule != TEXT(';') && *cssRule != WC_EOS && *cssRule != TEXT(','))
     {      {
       ptr = cssRule;        ptr = cssRule;
       cssRule = ParseCSSBorderStyleRight (element, tsch, context, cssRule, css, isHTML);        cssRule = ParseCSSBorderStyleRight (element, tsch, context, cssRule, css, isHTML);
Line 1264  ThotBool            isHTML; Line 1269  ThotBool            isHTML;
       if (ptr == cssRule)        if (ptr == cssRule)
         /* rule not found */          /* rule not found */
         cssRule = SkipProperty (cssRule);          cssRule = SkipProperty (cssRule);
       cssRule = SkipBlanksAndComments (cssRule);        cssRule = SkipWCBlanksAndComments (cssRule);
     }      }
   return (cssRule);    return (cssRule);
 }  }
Line 1274  ThotBool            isHTML; Line 1279  ThotBool            isHTML;
    attribute string.                                               attribute string.                                          
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 static char*        ParseCSSBorder (Element element, PSchema tsch,  static CHAR_T*        ParseCSSBorder (Element element, PSchema tsch,
                                  PresentationContext context, char* cssRule, CSSInfoPtr css, ThotBool isHTML)                                   PresentationContext context, CHAR_T* cssRule, CSSInfoPtr css, ThotBool isHTML)
 #else  #else
 static char*        ParseCSSBorder (element, tsch, context, cssRule, css, isHTML)  static CHAR_T*        ParseCSSBorder (element, tsch, context, cssRule, css, isHTML)
 Element             element;  Element             element;
 PSchema             tsch;  PSchema             tsch;
 PresentationContext context;  PresentationContext context;
 char*               cssRule;  CHAR_T*               cssRule;
 CSSInfoPtr          css;  CSSInfoPtr          css;
 ThotBool            isHTML;  ThotBool            isHTML;
 #endif  #endif
 {  {
   char *ptrT, *ptrR;    CHAR_T *ptrT, *ptrR;
   
   ptrT = SkipBlanksAndComments (cssRule);    ptrT = SkipWCBlanksAndComments (cssRule);
   /* First parse Border-Top */    /* First parse Border-Top */
   ptrR = ParseCSSBorderTop (element, tsch, context, ptrT, css, isHTML);    ptrR = ParseCSSBorderTop (element, tsch, context, ptrT, css, isHTML);
   ptrR = SkipBlanksAndComments (ptrR);    ptrR = SkipWCBlanksAndComments (ptrR);
   if (*ptrR == ';' || *ptrR == EOS || *ptrR == ',')    if (*ptrR == TEXT(';') || *ptrR == WC_EOS || *ptrR == TEXT(','))
     {      {
       cssRule = ptrR;        cssRule = ptrR;
       /* apply the Border-Top to all */        /* apply the Border-Top to all */
Line 1307  ThotBool            isHTML; Line 1312  ThotBool            isHTML;
    ParseCSSClear : parse a CSS clear attribute string         ParseCSSClear : parse a CSS clear attribute string    
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 static char*        ParseCSSClear (Element element, PSchema tsch,  static CHAR_T*        ParseCSSClear (Element element, PSchema tsch,
                                  PresentationContext context, char* cssRule, CSSInfoPtr css, ThotBool isHTML)                                   PresentationContext context, CHAR_T* cssRule, CSSInfoPtr css, ThotBool isHTML)
 #else  #else
 static char*        ParseCSSClear (element, tsch, context, cssRule, css, isHTML)  static CHAR_T*        ParseCSSClear (element, tsch, context, cssRule, css, isHTML)
 Element             element;  Element             element;
 PSchema             tsch;  PSchema             tsch;
 PresentationContext context;  PresentationContext context;
 char*               cssRule;  CHAR_T*               cssRule;
 CSSInfoPtr          css;  CSSInfoPtr          css;
 ThotBool            isHTML;  ThotBool            isHTML;
 #endif  #endif
Line 1327  ThotBool            isHTML; Line 1332  ThotBool            isHTML;
    ParseCSSDisplay : parse a CSS display attribute string             ParseCSSDisplay : parse a CSS display attribute string        
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 static char*        ParseCSSDisplay (Element element, PSchema tsch,  static CHAR_T*        ParseCSSDisplay (Element element, PSchema tsch,
                                  PresentationContext context, char* cssRule, CSSInfoPtr css, ThotBool isHTML)                                   PresentationContext context, CHAR_T* cssRule, CSSInfoPtr css, ThotBool isHTML)
 #else  #else
 static char*        ParseCSSDisplay (element, tsch, context, cssRule, css, isHTML)  static CHAR_T*        ParseCSSDisplay (element, tsch, context, cssRule, css, isHTML)
 Element             element;  Element             element;
 PSchema             tsch;  PSchema             tsch;
 PresentationContext context;  PresentationContext context;
 char*               cssRule;  CHAR_T*               cssRule;
 CSSInfoPtr          css;  CSSInfoPtr          css;
 ThotBool            isHTML;  ThotBool            isHTML;
 #endif  #endif
Line 1343  ThotBool            isHTML; Line 1348  ThotBool            isHTML;
   
    pval.typed_data.unit = STYLE_UNIT_REL;     pval.typed_data.unit = STYLE_UNIT_REL;
    pval.typed_data.real = FALSE;     pval.typed_data.real = FALSE;
    cssRule = SkipBlanksAndComments (cssRule);     cssRule = SkipWCBlanksAndComments (cssRule);
    if (!strncasecmp (cssRule, "block", 5))     if (!ustrncasecmp (cssRule, TEXT("block"), 5))
      {       {
         pval.typed_data.value = STYLE_NOTINLINE;          pval.typed_data.value = STYLE_NOTINLINE;
         TtaSetStylePresentation (PRLine, element, tsch, context, pval);          TtaSetStylePresentation (PRLine, element, tsch, context, pval);
         cssRule = SkipWord (cssRule);          cssRule = SkipWord (cssRule);
      }       }
    else if (!strncasecmp (cssRule, "inline", 6))     else if (!ustrncasecmp (cssRule, TEXT("inline"), 6))
      {       {
         pval.typed_data.value = STYLE_INLINE;          pval.typed_data.value = STYLE_INLINE;
         TtaSetStylePresentation (PRLine, element, tsch, context, pval);          TtaSetStylePresentation (PRLine, element, tsch, context, pval);
         cssRule = SkipWord (cssRule);          cssRule = SkipWord (cssRule);
      }       }
    else if (!strncasecmp (cssRule, "none", 4))     else if (!ustrncasecmp (cssRule, TEXT("none"), 4))
      {       {
         pval.typed_data.value = STYLE_HIDE;          pval.typed_data.value = STYLE_HIDE;
         TtaSetStylePresentation (PRVisibility, element, tsch, context, pval);          TtaSetStylePresentation (PRVisibility, element, tsch, context, pval);
         cssRule = SkipWord (cssRule);          cssRule = SkipWord (cssRule);
      }       }
    else if (!strncasecmp (cssRule, "list-item", 9))     else if (!ustrncasecmp (cssRule, TEXT("list-item"), 9))
      cssRule = SkipProperty (cssRule);       cssRule = SkipProperty (cssRule);
    else     else
      fprintf (stderr, "invalid display value %s\n", cssRule);       fprintf (stderr, "invalid display value %s\n", cssRule);
Line 1374  ThotBool            isHTML; Line 1379  ThotBool            isHTML;
    ParseCSSFloat : parse a CSS float attribute string         ParseCSSFloat : parse a CSS float attribute string    
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 static char*        ParseCSSFloat (Element element, PSchema tsch,  static CHAR_T*        ParseCSSFloat (Element element, PSchema tsch,
                                  PresentationContext context, char* cssRule, CSSInfoPtr css, ThotBool isHTML)                                   PresentationContext context, CHAR_T* cssRule, CSSInfoPtr css, ThotBool isHTML)
 #else  #else
 static char*        ParseCSSFloat (element, tsch, context, cssRule, css, isHTML)  static CHAR_T*        ParseCSSFloat (element, tsch, context, cssRule, css, isHTML)
 Element             element;  Element             element;
 PSchema             tsch;  PSchema             tsch;
 PresentationContext context;  PresentationContext context;
 char*               cssRule;  CHAR_T*               cssRule;
 CSSInfoPtr          css;  CSSInfoPtr          css;
 ThotBool            isHTML;  ThotBool            isHTML;
 #endif  #endif
Line 1395  ThotBool            isHTML; Line 1400  ThotBool            isHTML;
    attribute string.                                               attribute string.                                          
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 static char*        ParseCSSLetterSpacing (Element element, PSchema tsch,  static CHAR_T*        ParseCSSLetterSpacing (Element element, PSchema tsch,
                                  PresentationContext context, char* cssRule, CSSInfoPtr css, ThotBool isHTML)                                   PresentationContext context, CHAR_T* cssRule, CSSInfoPtr css, ThotBool isHTML)
 #else  #else
 static char*        ParseCSSLetterSpacing (element, tsch, context, cssRule, css, isHTML)  static CHAR_T*        ParseCSSLetterSpacing (element, tsch, context, cssRule, css, isHTML)
 Element             element;  Element             element;
 PSchema             tsch;  PSchema             tsch;
 PresentationContext context;  PresentationContext context;
 char*               cssRule;  CHAR_T*               cssRule;
 CSSInfoPtr          css;  CSSInfoPtr          css;
 ThotBool            isHTML;  ThotBool            isHTML;
 #endif  #endif
Line 1416  ThotBool            isHTML; Line 1421  ThotBool            isHTML;
    attribute string.                                               attribute string.                                          
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 static char*        ParseCSSListStyleType (Element element, PSchema tsch,  static CHAR_T*        ParseCSSListStyleType (Element element, PSchema tsch,
                                  PresentationContext context, char* cssRule, CSSInfoPtr css, ThotBool isHTML)                                   PresentationContext context, CHAR_T* cssRule, CSSInfoPtr css, ThotBool isHTML)
 #else  #else
 static char*        ParseCSSListStyleType (element, tsch, context, cssRule, css, isHTML)  static CHAR_T*        ParseCSSListStyleType (element, tsch, context, cssRule, css, isHTML)
 Element             element;  Element             element;
 PSchema             tsch;  PSchema             tsch;
 PresentationContext context;  PresentationContext context;
 char*               cssRule;  CHAR_T*               cssRule;
 CSSInfoPtr          css;  CSSInfoPtr          css;
 ThotBool            isHTML;  ThotBool            isHTML;
 #endif  #endif
Line 1437  ThotBool            isHTML; Line 1442  ThotBool            isHTML;
    attribute string.                                               attribute string.                                          
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 static char*        ParseCSSListStyleImage (Element element, PSchema tsch,  static CHAR_T*        ParseCSSListStyleImage (Element element, PSchema tsch,
                                  PresentationContext context, char* cssRule, CSSInfoPtr css, ThotBool isHTML)                                   PresentationContext context, CHAR_T* cssRule, CSSInfoPtr css, ThotBool isHTML)
 #else  #else
 static char*        ParseCSSListStyleImage (element, tsch, context, cssRule, css, isHTML)  static CHAR_T*        ParseCSSListStyleImage (element, tsch, context, cssRule, css, isHTML)
 Element             element;  Element             element;
 PSchema             tsch;  PSchema             tsch;
 PresentationContext context;  PresentationContext context;
 char*               cssRule;  CHAR_T*               cssRule;
 CSSInfoPtr          css;  CSSInfoPtr          css;
 ThotBool            isHTML;  ThotBool            isHTML;
 #endif  #endif
Line 1458  ThotBool            isHTML; Line 1463  ThotBool            isHTML;
    attribute string.                                               attribute string.                                          
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 static char*        ParseCSSListStylePosition (Element element, PSchema tsch,  static CHAR_T*        ParseCSSListStylePosition (Element element, PSchema tsch,
                                  PresentationContext context, char* cssRule, CSSInfoPtr css, ThotBool isHTML)                                   PresentationContext context, CHAR_T* cssRule, CSSInfoPtr css, ThotBool isHTML)
 #else  #else
 static char*        ParseCSSListStylePosition (element, tsch, context, cssRule, css, isHTML)  static CHAR_T*        ParseCSSListStylePosition (element, tsch, context, cssRule, css, isHTML)
 Element             element;  Element             element;
 PSchema             tsch;  PSchema             tsch;
 PresentationContext context;  PresentationContext context;
 char*               cssRule;  CHAR_T*               cssRule;
 CSSInfoPtr          css;  CSSInfoPtr          css;
 ThotBool            isHTML;  ThotBool            isHTML;
 #endif  #endif
Line 1479  ThotBool            isHTML; Line 1484  ThotBool            isHTML;
    attribute string.                                               attribute string.                                          
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 static char*        ParseCSSListStyle (Element element, PSchema tsch,  static CHAR_T*        ParseCSSListStyle (Element element, PSchema tsch,
                                  PresentationContext context, char* cssRule, CSSInfoPtr css, ThotBool isHTML)                                   PresentationContext context, CHAR_T* cssRule, CSSInfoPtr css, ThotBool isHTML)
 #else  #else
 static char*        ParseCSSListStyle (element, tsch, context, cssRule, css, isHTML)  static CHAR_T*        ParseCSSListStyle (element, tsch, context, cssRule, css, isHTML)
 Element             element;  Element             element;
 PSchema             tsch;  PSchema             tsch;
 PresentationContext context;  PresentationContext context;
 char*               cssRule;  CHAR_T*               cssRule;
 CSSInfoPtr          css;  CSSInfoPtr          css;
 ThotBool            isHTML;  ThotBool            isHTML;
 #endif  #endif
Line 1500  ThotBool            isHTML; Line 1505  ThotBool            isHTML;
    attribute string.                                               attribute string.                                          
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 static char*        ParseCSSTextAlign (Element element, PSchema tsch,  static CHAR_T*        ParseCSSTextAlign (Element element, PSchema tsch,
                                  PresentationContext context, char* cssRule, CSSInfoPtr css, ThotBool isHTML)                                   PresentationContext context, CHAR_T* cssRule, CSSInfoPtr css, ThotBool isHTML)
 #else  #else
 static char*        ParseCSSTextAlign (element, tsch, context, cssRule, css, isHTML)  static CHAR_T*        ParseCSSTextAlign (element, tsch, context, cssRule, css, isHTML)
 Element             element;  Element             element;
 PSchema             tsch;  PSchema             tsch;
 PresentationContext context;  PresentationContext context;
 char*               cssRule;  CHAR_T*               cssRule;
 CSSInfoPtr          css;  CSSInfoPtr          css;
 ThotBool            isHTML;  ThotBool            isHTML;
 #endif  #endif
Line 1522  ThotBool            isHTML; Line 1527  ThotBool            isHTML;
    justify.typed_data.unit = STYLE_UNIT_REL;     justify.typed_data.unit = STYLE_UNIT_REL;
    justify.typed_data.real = FALSE;     justify.typed_data.real = FALSE;
   
    cssRule = SkipBlanksAndComments (cssRule);     cssRule = SkipWCBlanksAndComments (cssRule);
    if (!strncasecmp (cssRule, "left", 4))     if (!ustrncasecmp (cssRule, TEXT("left"), 4))
      {       {
         align.typed_data.value = AdjustLeft;          align.typed_data.value = AdjustLeft;
         cssRule = SkipWord (cssRule);          cssRule = SkipWord (cssRule);
      }       }
    else if (!strncasecmp (cssRule, "right", 5))     else if (!ustrncasecmp (cssRule, TEXT("right"), 5))
      {       {
         align.typed_data.value = AdjustRight;          align.typed_data.value = AdjustRight;
         cssRule = SkipWord (cssRule);          cssRule = SkipWord (cssRule);
      }       }
    else if (!strncasecmp (cssRule, "center", 6))     else if (!ustrncasecmp (cssRule, TEXT("center"), 6))
      {       {
         align.typed_data.value = Centered;          align.typed_data.value = Centered;
         cssRule = SkipWord (cssRule);          cssRule = SkipWord (cssRule);
      }       }
    else if (!strncasecmp (cssRule, "justify", 7))     else if (!ustrncasecmp (cssRule, TEXT("justify"), 7))
      {       {
         justify.typed_data.value = Justified;          justify.typed_data.value = Justified;
         cssRule = SkipWord (cssRule);          cssRule = SkipWord (cssRule);
Line 1569  ThotBool            isHTML; Line 1574  ThotBool            isHTML;
    attribute string.                                               attribute string.                                          
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 static char*        ParseCSSTextIndent (Element element, PSchema tsch,  static CHAR_T*        ParseCSSTextIndent (Element element, PSchema tsch,
                                  PresentationContext context, char* cssRule, CSSInfoPtr css, ThotBool isHTML)                                   PresentationContext context, CHAR_T* cssRule, CSSInfoPtr css, ThotBool isHTML)
 #else  #else
 static char*        ParseCSSTextIndent (element, tsch, context, cssRule, css, isHTML)  static CHAR_T*        ParseCSSTextIndent (element, tsch, context, cssRule, css, isHTML)
 Element             element;  Element             element;
 PSchema             tsch;  PSchema             tsch;
 PresentationContext context;  PresentationContext context;
 char*               cssRule;  CHAR_T*               cssRule;
 CSSInfoPtr          css;  CSSInfoPtr          css;
 ThotBool            isHTML;  ThotBool            isHTML;
 #endif  #endif
 {  {
    PresentationValue   pval;     PresentationValue   pval;
   
    cssRule = SkipBlanksAndComments (cssRule);     cssRule = SkipWCBlanksAndComments (cssRule);
    cssRule = ParseCSSUnit (cssRule, &pval);     cssRule = ParseCSSUnit (cssRule, &pval);
    if (pval.typed_data.unit == STYLE_UNIT_INVALID)     if (pval.typed_data.unit == STYLE_UNIT_INVALID)
      return (cssRule);       return (cssRule);
Line 1597  ThotBool            isHTML; Line 1602  ThotBool            isHTML;
    attribute string.                                               attribute string.                                          
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 static char*        ParseCSSTextTransform (Element element, PSchema tsch,  static CHAR_T*        ParseCSSTextTransform (Element element, PSchema tsch,
                                  PresentationContext context, char* cssRule, CSSInfoPtr css, ThotBool isHTML)                                   PresentationContext context, CHAR_T* cssRule, CSSInfoPtr css, ThotBool isHTML)
 #else  #else
 static char*        ParseCSSTextTransform (element, tsch, context, cssRule, css, isHTML)  static CHAR_T*        ParseCSSTextTransform (element, tsch, context, cssRule, css, isHTML)
 Element             element;  Element             element;
 PSchema             tsch;  PSchema             tsch;
 PresentationContext context;  PresentationContext context;
 char*               cssRule;  CHAR_T*               cssRule;
 CSSInfoPtr          css;  CSSInfoPtr          css;
 ThotBool            isHTML;  ThotBool            isHTML;
 #endif  #endif
Line 1618  ThotBool            isHTML; Line 1623  ThotBool            isHTML;
    attribute string.                                               attribute string.                                          
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 static char*        ParseCSSVerticalAlign (Element element, PSchema tsch,  static CHAR_T*        ParseCSSVerticalAlign (Element element, PSchema tsch,
                                  PresentationContext context, char* cssRule, CSSInfoPtr css, ThotBool isHTML)                                   PresentationContext context, CHAR_T* cssRule, CSSInfoPtr css, ThotBool isHTML)
 #else  #else
 static char*        ParseCSSVerticalAlign (element, tsch, context, cssRule, css, isHTML)  static CHAR_T*        ParseCSSVerticalAlign (element, tsch, context, cssRule, css, isHTML)
 Element             element;  Element             element;
 PSchema             tsch;  PSchema             tsch;
 PresentationContext context;  PresentationContext context;
Line 1639  ThotBool            isHTML; Line 1644  ThotBool            isHTML;
    attribute string.                                               attribute string.                                          
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 static char*        ParseCSSWhiteSpace (Element element, PSchema tsch,  static CHAR_T*        ParseCSSWhiteSpace (Element element, PSchema tsch,
                                  PresentationContext context, char* cssRule, CSSInfoPtr css, ThotBool isHTML)                                   PresentationContext context, CHAR_T* cssRule, CSSInfoPtr css, ThotBool isHTML)
 #else  #else
 static char*        ParseCSSWhiteSpace (element, tsch, context, cssRule, css, isHTML)  static CHAR_T*        ParseCSSWhiteSpace (element, tsch, context, cssRule, css, isHTML)
 Element             element;  Element             element;
 PSchema             tsch;  PSchema             tsch;
 PresentationContext context;  PresentationContext context;
Line 1651  CSSInfoPtr          css; Line 1656  CSSInfoPtr          css;
 ThotBool            isHTML;  ThotBool            isHTML;
 #endif  #endif
 {  {
    cssRule = SkipBlanksAndComments (cssRule);     cssRule = SkipWCBlanksAndComments (cssRule);
    if (!strncasecmp (cssRule, "normal", 6))     if (!ustrncasecmp (cssRule, TEXT("normal"), 6))
      cssRule = SkipWord (cssRule);       cssRule = SkipWord (cssRule);
    else if (!strncasecmp (cssRule, "pre", 3))     else if (!ustrncasecmp (cssRule, TEXT("pre"), 3))
      cssRule = SkipWord (cssRule);       cssRule = SkipWord (cssRule);
    else     else
      return (cssRule);       return (cssRule);
Line 1666  ThotBool            isHTML; Line 1671  ThotBool            isHTML;
    attribute string.                                               attribute string.                                          
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 static char*        ParseCSSWordSpacing (Element element, PSchema tsch,  static CHAR_T*        ParseCSSWordSpacing (Element element, PSchema tsch,
                                  PresentationContext context, char* cssRule, CSSInfoPtr css, ThotBool isHTML)                                   PresentationContext context, CHAR_T* cssRule, CSSInfoPtr css, ThotBool isHTML)
 #else  #else
 static char*        ParseCSSWordSpacing (element, tsch, context, cssRule, css, isHTML)  static CHAR_T*        ParseCSSWordSpacing (element, tsch, context, cssRule, css, isHTML)
 Element             element;  Element             element;
 PSchema             tsch;  PSchema             tsch;
 PresentationContext context;  PresentationContext context;
Line 1688  ThotBool            isHTML; Line 1693  ThotBool            isHTML;
    value% or value                                                    value% or value                                               
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 static char*        ParseCSSLineSpacing (Element element, PSchema tsch,  static CHAR_T*        ParseCSSLineSpacing (Element element, PSchema tsch,
                                  PresentationContext context, char* cssRule, CSSInfoPtr css, ThotBool isHTML)                                   PresentationContext context, CHAR_T* cssRule, CSSInfoPtr css, ThotBool isHTML)
 #else  #else
 static char*        ParseCSSLineSpacing (element, tsch, context, cssRule, css, isHTML)  static CHAR_T*        ParseCSSLineSpacing (element, tsch, context, cssRule, css, isHTML)
 Element             element;  Element             element;
 PSchema             tsch;  PSchema             tsch;
 PresentationContext context;  PresentationContext context;
Line 1720  ThotBool            isHTML; Line 1725  ThotBool            isHTML;
    or an absolute size, or an imcrement relative to the parent          or an absolute size, or an imcrement relative to the parent     
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 static char*        ParseCSSFontSize (Element element, PSchema tsch,  static CHAR_T*        ParseCSSFontSize (Element element, PSchema tsch,
                                  PresentationContext context, char* cssRule, CSSInfoPtr css, ThotBool isHTML)                                   PresentationContext context, CHAR_T* cssRule, CSSInfoPtr css, ThotBool isHTML)
 #else  #else
 static char*        ParseCSSFontSize (element, tsch, context, cssRule, css, isHTML)  static CHAR_T*        ParseCSSFontSize (element, tsch, context, cssRule, css, isHTML)
 Element             element;  Element             element;
 PSchema             tsch;  PSchema             tsch;
 PresentationContext context;  PresentationContext context;
Line 1733  ThotBool            isHTML; Line 1738  ThotBool            isHTML;
 #endif  #endif
 {  {
    PresentationValue   pval;     PresentationValue   pval;
    char*               ptr = NULL;     CHAR_T*             ptr = NULL;
    ThotBool            real;     ThotBool            real;
   
    pval.typed_data.real = FALSE;     pval.typed_data.real = FALSE;
    cssRule = SkipBlanksAndComments (cssRule);     cssRule = SkipWCBlanksAndComments (cssRule);
    if (!strncasecmp (cssRule, "larger", 6))     if (!ustrncasecmp (cssRule, TEXT("larger"), 6))
      {       {
         pval.typed_data.unit = STYLE_UNIT_PERCENT;          pval.typed_data.unit = STYLE_UNIT_PERCENT;
         pval.typed_data.value = 130;          pval.typed_data.value = 130;
         cssRule = SkipWord (cssRule);          cssRule = SkipWord (cssRule);
      }       }
    else if (!strncasecmp (cssRule, "smaller", 7))     else if (!ustrncasecmp (cssRule, TEXT("smaller"), 7))
      {       {
         pval.typed_data.unit = STYLE_UNIT_PERCENT;          pval.typed_data.unit = STYLE_UNIT_PERCENT;
         pval.typed_data.value = 80;          pval.typed_data.value = 80;
         cssRule = SkipWord (cssRule);          cssRule = SkipWord (cssRule);
      }       }
    else if (!strncasecmp (cssRule, "xx-small", 8))     else if (!ustrncasecmp (cssRule, TEXT("xx-small"), 8))
      {       {
         pval.typed_data.unit = STYLE_UNIT_REL;          pval.typed_data.unit = STYLE_UNIT_REL;
         pval.typed_data.value = 1;          pval.typed_data.value = 1;
         cssRule = SkipWord (cssRule);          cssRule = SkipWord (cssRule);
      }       }
    else if (!strncasecmp (cssRule, "x-small", 7))     else if (!ustrncasecmp (cssRule, TEXT("x-small"), 7))
      {       {
         pval.typed_data.unit = STYLE_UNIT_REL;          pval.typed_data.unit = STYLE_UNIT_REL;
         pval.typed_data.value = 2;          pval.typed_data.value = 2;
         cssRule = SkipWord (cssRule);          cssRule = SkipWord (cssRule);
      }       }
    else if (!strncasecmp (cssRule, "small", 5))     else if (!ustrncasecmp (cssRule, TEXT("small"), 5))
      {       {
         pval.typed_data.unit = STYLE_UNIT_REL;          pval.typed_data.unit = STYLE_UNIT_REL;
         pval.typed_data.value = 3;          pval.typed_data.value = 3;
         cssRule = SkipWord (cssRule);          cssRule = SkipWord (cssRule);
      }       }
    else if (!strncasecmp (cssRule, "medium", 6))     else if (!ustrncasecmp (cssRule, TEXT("medium"), 6))
      {       {
         pval.typed_data.unit = STYLE_UNIT_REL;          pval.typed_data.unit = STYLE_UNIT_REL;
         pval.typed_data.value = 4;          pval.typed_data.value = 4;
         cssRule = SkipWord (cssRule);          cssRule = SkipWord (cssRule);
      }       }
    else if (!strncasecmp (cssRule, "large", 5))     else if (!ustrncasecmp (cssRule, TEXT("large"), 5))
      {       {
         pval.typed_data.unit = STYLE_UNIT_REL;          pval.typed_data.unit = STYLE_UNIT_REL;
         pval.typed_data.value = 5;          pval.typed_data.value = 5;
         cssRule = SkipWord (cssRule);          cssRule = SkipWord (cssRule);
      }       }
    else if (!strncasecmp (cssRule, "x-large", 7))     else if (!ustrncasecmp (cssRule, TEXT("x-large"), 7))
      {       {
         pval.typed_data.unit = STYLE_UNIT_REL;          pval.typed_data.unit = STYLE_UNIT_REL;
         pval.typed_data.value = 6;          pval.typed_data.value = 6;
         cssRule = SkipWord (cssRule);          cssRule = SkipWord (cssRule);
      }       }
    else if (!strncasecmp (cssRule, "xx-large", 8))     else if (!ustrncasecmp (cssRule, TEXT("xx-large"), 8))
      {       {
         pval.typed_data.unit = STYLE_UNIT_REL;          pval.typed_data.unit = STYLE_UNIT_REL;
         pval.typed_data.value = 7;          pval.typed_data.value = 7;
Line 1795  ThotBool            isHTML; Line 1800  ThotBool            isHTML;
    else     else
      {       {
        /* look for a '/' within the current cssRule */         /* look for a '/' within the current cssRule */
        ptr = strchr (cssRule, '/');         ptr = ustrchr (cssRule, TEXT('/'));
        if (ptr != NULL)         if (ptr != NULL)
          {           {
            /* keep the line spacing rule */             /* keep the line spacing rule */
            ptr[0] = EOS;             ptr[0] = WC_EOS;
            ptr = &ptr[1];             ptr = &ptr[1];
          }           }
        cssRule = ParseCSSUnit (cssRule, &pval);         cssRule = ParseCSSUnit (cssRule, &pval);
Line 1842  ThotBool            isHTML; Line 1847  ThotBool            isHTML;
    a common generic font style name                                     a common generic font style name                                
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 static char*        ParseCSSFontFamily (Element element, PSchema tsch,  static CHAR_T*        ParseCSSFontFamily (Element element, PSchema tsch,
                                  PresentationContext context, char* cssRule, CSSInfoPtr css, ThotBool isHTML)                                   PresentationContext context, CHAR_T* cssRule, CSSInfoPtr css, ThotBool isHTML)
 #else  #else
 static char*        ParseCSSFontFamily (element, tsch, context, cssRule, css, isHTML)  static CHAR_T*        ParseCSSFontFamily (element, tsch, context, cssRule, css, isHTML)
 Element             element;  Element             element;
 PSchema             tsch;  PSchema             tsch;
 PresentationContext context;  PresentationContext context;
Line 1855  ThotBool            isHTML; Line 1860  ThotBool            isHTML;
 #endif  #endif
 {  {
   PresentationValue   font;    PresentationValue   font;
   char                quoteChar;    CHAR_T              quoteChar;
   
   font.typed_data.value = 0;    font.typed_data.value = 0;
   font.typed_data.unit = STYLE_UNIT_REL;    font.typed_data.unit = STYLE_UNIT_REL;
   font.typed_data.real = FALSE;    font.typed_data.real = FALSE;
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipWCBlanksAndComments (cssRule);
   if (*cssRule == '"' || *cssRule == '\'')    if (*cssRule == TEXT('"') || *cssRule == TEXT('\''))
      {       {
      quoteChar = *cssRule;       quoteChar = *cssRule;
      cssRule++;       cssRule++;
      }       }
   else    else
      quoteChar = '\0';       quoteChar = WC_EOS;
   
   if (!strncasecmp (cssRule, "times", 5))    if (!ustrncasecmp (cssRule, TEXT("times"), 5))
       font.typed_data.value = STYLE_FONT_TIMES;        font.typed_data.value = STYLE_FONT_TIMES;
   else if (!strncasecmp (cssRule, "serif", 5))    else if (!ustrncasecmp (cssRule, TEXT("serif"), 5))
       font.typed_data.value = STYLE_FONT_TIMES;        font.typed_data.value = STYLE_FONT_TIMES;
   else if (!strncasecmp (cssRule, "helvetica", 9) ||    else if (!ustrncasecmp (cssRule, TEXT("helvetica"), 9) ||
            !strncasecmp (cssRule, "verdana", 7))             !ustrncasecmp (cssRule, TEXT("verdana"), 7))
       font.typed_data.value = STYLE_FONT_HELVETICA;        font.typed_data.value = STYLE_FONT_HELVETICA;
   else if (!strncasecmp (cssRule, "sans-serif", 10))    else if (!ustrncasecmp (cssRule, TEXT("sans-serif"), 10))
       font.typed_data.value = STYLE_FONT_HELVETICA;        font.typed_data.value = STYLE_FONT_HELVETICA;
   else if (!strncasecmp (cssRule, "courier", 7))    else if (!ustrncasecmp (cssRule, TEXT("courier"), 7))
       font.typed_data.value = STYLE_FONT_COURIER;        font.typed_data.value = STYLE_FONT_COURIER;
   else if (!strncasecmp (cssRule, "monospace", 9))    else if (!ustrncasecmp (cssRule, TEXT("monospace"), 9))
       font.typed_data.value = STYLE_FONT_COURIER;        font.typed_data.value = STYLE_FONT_COURIER;
   else    else
     /* unknown font name.  Skip it */      /* unknown font name.  Skip it */
Line 1889  ThotBool            isHTML; Line 1894  ThotBool            isHTML;
          cssRule = SkipQuotedString (cssRule, quoteChar);           cssRule = SkipQuotedString (cssRule, quoteChar);
       else        else
          cssRule = SkipWord (cssRule);           cssRule = SkipWord (cssRule);
       cssRule = SkipBlanksAndComments (cssRule);        cssRule = SkipWCBlanksAndComments (cssRule);
       if (*cssRule == ',')        if (*cssRule == TEXT(','))
         {          {
         cssRule++;          cssRule++;
         cssRule = ParseCSSFontFamily (element, tsch, context, cssRule, css, isHTML);          cssRule = ParseCSSFontFamily (element, tsch, context, cssRule, css, isHTML);
Line 1913  ThotBool            isHTML; Line 1918  ThotBool            isHTML;
    normal, bold, bolder, lighter, 100, 200, 300, ... 900, inherit.     normal, bold, bolder, lighter, 100, 200, 300, ... 900, inherit.
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 static char*        ParseCSSFontWeight (Element element, PSchema tsch,  static CHAR_T*        ParseCSSFontWeight (Element element, PSchema tsch,
                                  PresentationContext context, char* cssRule, CSSInfoPtr css, ThotBool isHTML)                                   PresentationContext context, CHAR_T* cssRule, CSSInfoPtr css, ThotBool isHTML)
 #else  #else
 static char*        ParseCSSFontWeight (element, tsch, context, cssRule, css, isHTML)  static CHAR_T*        ParseCSSFontWeight (element, tsch, context, cssRule, css, isHTML)
 Element             element;  Element             element;
 PSchema             tsch;  PSchema             tsch;
 PresentationContext context;  PresentationContext context;
Line 1930  ThotBool            isHTML; Line 1935  ThotBool            isHTML;
    weight.typed_data.value = 0;     weight.typed_data.value = 0;
    weight.typed_data.unit = STYLE_UNIT_REL;     weight.typed_data.unit = STYLE_UNIT_REL;
    weight.typed_data.real = FALSE;     weight.typed_data.real = FALSE;
    cssRule = SkipBlanksAndComments (cssRule);     cssRule = SkipWCBlanksAndComments (cssRule);
    if (!strncasecmp (cssRule, "100", 3) && !isalpha (cssRule[3]))     if (!ustrncasecmp (cssRule, TEXT("100"), 3) && !TtaIsAlpha (cssRule[3]))
      {       {
         weight.typed_data.value = -3;          weight.typed_data.value = -3;
         cssRule = SkipWord (cssRule);          cssRule = SkipWord (cssRule);
      }       }
    else if (!strncasecmp (cssRule, "200", 3) && !isalpha (cssRule[3]))     else if (!ustrncasecmp (cssRule, TEXT("200"), 3) && !TtaIsAlpha (cssRule[3]))
      {       {
         weight.typed_data.value = -2;          weight.typed_data.value = -2;
         cssRule = SkipWord (cssRule);          cssRule = SkipWord (cssRule);
      }       }
    else if (!strncasecmp (cssRule, "300", 3) && !isalpha (cssRule[3]))     else if (!ustrncasecmp (cssRule, TEXT("300"), 3) && !TtaIsAlpha (cssRule[3]))
      {       {
         weight.typed_data.value = -1;          weight.typed_data.value = -1;
         cssRule = SkipWord (cssRule);          cssRule = SkipWord (cssRule);
      }       }
    else if (!strncasecmp (cssRule, "normal", 6) ||     else if (!ustrncasecmp (cssRule, TEXT("normal"), 6) || (!ustrncasecmp (cssRule, TEXT("400"), 3) && !TtaIsAlpha (cssRule[3])))
             (!strncasecmp (cssRule, "400", 3) && !isalpha (cssRule[3])))  
      {       {
         weight.typed_data.value = 0;          weight.typed_data.value = 0;
         cssRule = SkipWord (cssRule);          cssRule = SkipWord (cssRule);
      }       }
    else if (!strncasecmp (cssRule, "500", 3) && !isalpha (cssRule[3]))     else if (!ustrncasecmp (cssRule, TEXT("500"), 3) && !TtaIsAlpha (cssRule[3]))
      {       {
         weight.typed_data.value = +1;          weight.typed_data.value = +1;
         cssRule = SkipWord (cssRule);          cssRule = SkipWord (cssRule);
      }       }
    else if (!strncasecmp (cssRule, "600", 3) && !isalpha (cssRule[3]))     else if (!ustrncasecmp (cssRule, TEXT("600"), 3) && !TtaIsAlpha (cssRule[3]))
      {       {
         weight.typed_data.value = +2;          weight.typed_data.value = +2;
         cssRule = SkipWord (cssRule);          cssRule = SkipWord (cssRule);
      }       }
    else if (!strncasecmp (cssRule, "bold", 4) ||     else if (!ustrncasecmp (cssRule, TEXT("bold"), 4) || (!ustrncasecmp (cssRule, TEXT("700"), 3) && !TtaIsAlpha (cssRule[3])))
             (!strncasecmp (cssRule, "700", 3) && !isalpha (cssRule[3])))  
      {       {
         weight.typed_data.value = +3;          weight.typed_data.value = +3;
         cssRule = SkipWord (cssRule);          cssRule = SkipWord (cssRule);
      }       }
    else if (!strncasecmp (cssRule, "800", 3) && !isalpha (cssRule[3]))     else if (!ustrncasecmp (cssRule, TEXT("800"), 3) && !TtaIsAlpha (cssRule[3]))
      {       {
         weight.typed_data.value = +4;          weight.typed_data.value = +4;
         cssRule = SkipWord (cssRule);          cssRule = SkipWord (cssRule);
      }       }
    else if (!strncasecmp (cssRule, "900", 3) && !isalpha (cssRule[3]))     else if (!ustrncasecmp (cssRule, TEXT("900"), 3) && !TtaIsAlpha (cssRule[3]))
      {       {
         weight.typed_data.value = +5;          weight.typed_data.value = +5;
         cssRule = SkipWord (cssRule);          cssRule = SkipWord (cssRule);
      }       }
    else if (!strncasecmp (cssRule, "inherit", 7) ||     else if (!ustrncasecmp (cssRule, TEXT("inherit"), 7) || !ustrncasecmp (cssRule, TEXT("bolder"), 6) || !ustrncasecmp (cssRule, TEXT("lighter"), 7))
             !strncasecmp (cssRule, "bolder", 6) ||  
             !strncasecmp (cssRule, "lighter", 7))  
      {       {
      /* not implemented */       /* not implemented */
      cssRule = SkipWord (cssRule);       cssRule = SkipWord (cssRule);
Line 2009  ThotBool            isHTML; Line 2010  ThotBool            isHTML;
    normal or small-caps     normal or small-caps
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 static char*        ParseCSSFontVariant (Element element, PSchema tsch,  static CHAR_T*        ParseCSSFontVariant (Element element, PSchema tsch,
                                  PresentationContext context, char* cssRule, CSSInfoPtr css, ThotBool isHTML)                                   PresentationContext context, CHAR_T* cssRule, CSSInfoPtr css, ThotBool isHTML)
 #else  #else
 static char*        ParseCSSFontVariant (element, tsch, context, cssRule, css, isHTML)  static CHAR_T*        ParseCSSFontVariant (element, tsch, context, cssRule, css, isHTML)
 Element             element;  Element             element;
 PSchema             tsch;  PSchema             tsch;
 PresentationContext context;  PresentationContext context;
Line 2026  ThotBool            isHTML; Line 2027  ThotBool            isHTML;
    style.typed_data.value = 0;     style.typed_data.value = 0;
    style.typed_data.unit = STYLE_UNIT_REL;     style.typed_data.unit = STYLE_UNIT_REL;
    style.typed_data.real = FALSE;     style.typed_data.real = FALSE;
    cssRule = SkipBlanksAndComments (cssRule);     cssRule = SkipWCBlanksAndComments (cssRule);
    if (!strncasecmp (cssRule, "small-caps", 10))     if (!ustrncasecmp (cssRule, TEXT("small-caps"), 10))
      {       {
        /* Not supported yet */         /* Not supported yet */
        cssRule = SkipWord (cssRule);         cssRule = SkipWord (cssRule);
      }       }
    else if (!strncasecmp (cssRule, "normal", 6))     else if (!ustrncasecmp (cssRule, TEXT("normal"), 6))
      {       {
        /* Not supported yet */         /* Not supported yet */
        cssRule = SkipWord (cssRule);         cssRule = SkipWord (cssRule);
      }       }
    else if (!strncasecmp (cssRule, "inherit", 7))     else if (!ustrncasecmp (cssRule, TEXT("inherit"), 7))
      {       {
        /* Not supported yet */         /* Not supported yet */
        cssRule = SkipWord (cssRule);         cssRule = SkipWord (cssRule);
Line 2055  ThotBool            isHTML; Line 2056  ThotBool            isHTML;
    italic, oblique or normal                              italic, oblique or normal                         
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 static char*        ParseCSSFontStyle (Element element, PSchema tsch,  static CHAR_T*        ParseCSSFontStyle (Element element, PSchema tsch,
                                  PresentationContext context, char* cssRule, CSSInfoPtr css, ThotBool isHTML)                                   PresentationContext context, CHAR_T* cssRule, CSSInfoPtr css, ThotBool isHTML)
 #else  #else
 static char*        ParseCSSFontStyle (element, tsch, context, cssRule, css, isHTML)  static CHAR_T*        ParseCSSFontStyle (element, tsch, context, cssRule, css, isHTML)
 Element             element;  Element             element;
 PSchema             tsch;  PSchema             tsch;
 PresentationContext context;  PresentationContext context;
Line 2076  ThotBool            isHTML; Line 2077  ThotBool            isHTML;
    size.typed_data.value = 0;     size.typed_data.value = 0;
    size.typed_data.unit = STYLE_UNIT_REL;     size.typed_data.unit = STYLE_UNIT_REL;
    size.typed_data.real = FALSE;     size.typed_data.real = FALSE;
    cssRule = SkipBlanksAndComments (cssRule);     cssRule = SkipWCBlanksAndComments (cssRule);
    if (!strncasecmp (cssRule, "italic", 6))     if (!ustrncasecmp (cssRule, TEXT("italic"), 6))
      {       {
         style.typed_data.value = STYLE_FONT_ITALICS;          style.typed_data.value = STYLE_FONT_ITALICS;
         cssRule = SkipWord (cssRule);          cssRule = SkipWord (cssRule);
      }       }
    else if (!strncasecmp (cssRule, "oblique", 7))     else if (!ustrncasecmp (cssRule, TEXT("oblique"), 7))
      {       {
         style.typed_data.value = STYLE_FONT_OBLIQUE;          style.typed_data.value = STYLE_FONT_OBLIQUE;
         cssRule = SkipWord (cssRule);          cssRule = SkipWord (cssRule);
      }       }
    else if (!strncasecmp (cssRule, "normal", 6))     else if (!ustrncasecmp (cssRule, TEXT("normal"), 6))
      {       {
         style.typed_data.value = STYLE_FONT_ROMAN;          style.typed_data.value = STYLE_FONT_ROMAN;
         cssRule = SkipWord (cssRule);          cssRule = SkipWord (cssRule);
Line 2128  ThotBool            isHTML; Line 2129  ThotBool            isHTML;
    !!!!!!                                                       !!!!!!                                                  
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 static char*        ParseCSSFont (Element element, PSchema tsch,  static CHAR_T*        ParseCSSFont (Element element, PSchema tsch,
                                  PresentationContext context, char* cssRule, CSSInfoPtr css, ThotBool isHTML)                                   PresentationContext context, CHAR_T* cssRule, CSSInfoPtr css, ThotBool isHTML)
 #else  #else
 static char*        ParseCSSFont (element, tsch, context, cssRule, css, isHTML)  static CHAR_T*        ParseCSSFont (element, tsch, context, cssRule, css, isHTML)
 Element             element;  Element             element;
 PSchema             tsch;  PSchema             tsch;
 PresentationContext context;  PresentationContext context;
Line 2140  CSSInfoPtr          css; Line 2141  CSSInfoPtr          css;
 ThotBool            isHTML;  ThotBool            isHTML;
 #endif  #endif
 {  {
   char*             ptr;    CHAR_T*           ptr;
   
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipWCBlanksAndComments (cssRule);
   if (!strncasecmp (cssRule, "caption", 7))    if (!ustrncasecmp (cssRule, TEXT("caption"), 7))
     ;      ;
   else if (!strncasecmp (cssRule, "icon", 4))    else if (!ustrncasecmp (cssRule, TEXT("icon"), 4))
     ;      ;
   else if (!strncasecmp (cssRule, "menu", 4))    else if (!ustrncasecmp (cssRule, TEXT("menu"), 4))
     ;      ;
   else if (!strncasecmp (cssRule, "message-box", 11))    else if (!ustrncasecmp (cssRule, TEXT("message-box"), 11))
     ;      ;
   else if (!strncasecmp (cssRule, "small-caption", 13))    else if (!ustrncasecmp (cssRule, TEXT("small-caption"), 13))
     ;      ;
   else if (!strncasecmp (cssRule, "status-bar", 10))    else if (!ustrncasecmp (cssRule, TEXT("status-bar"), 10))
     ;      ;
   else    else
     {      {
Line 2164  ThotBool            isHTML; Line 2165  ThotBool            isHTML;
       if (ptr == cssRule)        if (ptr == cssRule)
         cssRule = ParseCSSFontWeight (element, tsch, context, cssRule, css, isHTML);          cssRule = ParseCSSFontWeight (element, tsch, context, cssRule, css, isHTML);
       cssRule = ParseCSSFontSize (element, tsch, context, cssRule, css, isHTML);        cssRule = ParseCSSFontSize (element, tsch, context, cssRule, css, isHTML);
       if (*cssRule == '/')        if (*cssRule == TEXT('/'))
         {          {
           cssRule++;            cssRule++;
           SkipBlanksAndComments (cssRule);            SkipWCBlanksAndComments (cssRule);
           cssRule = SkipWord (cssRule);            cssRule = SkipWord (cssRule);
         }          }
       cssRule = ParseCSSFontFamily (element, tsch, context, cssRule, css, isHTML);        cssRule = ParseCSSFontFamily (element, tsch, context, cssRule, css, isHTML);
       cssRule = SkipBlanksAndComments (cssRule);        cssRule = SkipWCBlanksAndComments (cssRule);
       while (*cssRule != ';' && *cssRule != EOS)        while (*cssRule != TEXT(';') && *cssRule != WC_EOS)
         {          {
           /* now skip remainding info */            /* now skip remainding info */
           cssRule++;            cssRule++;
Line 2188  ThotBool            isHTML; Line 2189  ThotBool            isHTML;
    cartouche, blink or none                                             cartouche, blink or none                                        
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 static char*        ParseCSSTextDecoration (Element element, PSchema tsch,  static CHAR_T*        ParseCSSTextDecoration (Element element, PSchema tsch,
                                  PresentationContext context, char* cssRule, CSSInfoPtr css, ThotBool isHTML)                                   PresentationContext context, CHAR_T* cssRule, CSSInfoPtr css, ThotBool isHTML)
 #else  #else
 static char*        ParseCSSTextDecoration (element, tsch, context, cssRule, css, isHTML)  static CHAR_T*        ParseCSSTextDecoration (element, tsch, context, cssRule, css, isHTML)
 Element             element;  Element             element;
 PSchema             tsch;  PSchema             tsch;
 PresentationContext context;  PresentationContext context;
Line 2205  ThotBool            isHTML; Line 2206  ThotBool            isHTML;
    decor.typed_data.value = 0;     decor.typed_data.value = 0;
    decor.typed_data.unit = STYLE_UNIT_REL;     decor.typed_data.unit = STYLE_UNIT_REL;
    decor.typed_data.real = FALSE;     decor.typed_data.real = FALSE;
    cssRule = SkipBlanksAndComments (cssRule);     cssRule = SkipWCBlanksAndComments (cssRule);
    if (!strncasecmp (cssRule, "underline", strlen ("underline")))     if (!ustrncasecmp (cssRule, TEXT("underline"), strlen ("underline")))
      {       {
         decor.typed_data.value = Underline;          decor.typed_data.value = Underline;
         cssRule = SkipWord (cssRule);          cssRule = SkipWord (cssRule);
      }       }
    else if (!strncasecmp (cssRule, "overline", strlen ("overline")))     else if (!ustrncasecmp (cssRule, TEXT("overline"), strlen ("overline")))
      {       {
         decor.typed_data.value = Overline;          decor.typed_data.value = Overline;
         cssRule = SkipWord (cssRule);          cssRule = SkipWord (cssRule);
      }       }
    else if (!strncasecmp (cssRule, "line-through", strlen ("line-through")))     else if (!ustrncasecmp (cssRule, TEXT("line-through"), strlen ("line-through")))
      {       {
         decor.typed_data.value = CrossOut;          decor.typed_data.value = CrossOut;
         cssRule = SkipWord (cssRule);          cssRule = SkipWord (cssRule);
      }       }
    else if (!strncasecmp (cssRule, "box", strlen ("box")))     else if (!ustrncasecmp (cssRule, TEXT("box"), strlen ("box")))
      {       {
        /* the box text-decoration attribute is not yet supported */         /* the box text-decoration attribute is not yet supported */
         cssRule = SkipWord (cssRule);          cssRule = SkipWord (cssRule);
      }       }
    else if (!strncasecmp (cssRule, "boxshadow", strlen ("boxshadow")))     else if (!ustrncasecmp (cssRule, TEXT("boxshadow"), strlen ("boxshadow")))
      {       {
        /* the boxshadow text-decoration attribute is not yet supported */         /* the boxshadow text-decoration attribute is not yet supported */
         cssRule = SkipWord (cssRule);          cssRule = SkipWord (cssRule);
      }       }
    else if (!strncasecmp (cssRule, "box3d", strlen ("box3d")))     else if (!ustrncasecmp (cssRule, TEXT("box3d"), strlen ("box3d")))
      {       {
        /* the box3d text-decoration attribute is not yet supported */         /* the box3d text-decoration attribute is not yet supported */
         cssRule = SkipWord (cssRule);          cssRule = SkipWord (cssRule);
      }       }
    else if (!strncasecmp (cssRule, "cartouche", strlen ("cartouche")))     else if (!ustrncasecmp (cssRule, TEXT("cartouche"), strlen ("cartouche")))
      {       {
         /*the cartouche text-decoration attribute is not yet supported */          /*the cartouche text-decoration attribute is not yet supported */
         cssRule = SkipWord (cssRule);          cssRule = SkipWord (cssRule);
      }       }
    else if (!strncasecmp (cssRule, "blink", strlen ("blink")))     else if (!ustrncasecmp (cssRule, TEXT("blink"), strlen ("blink")))
      {       {
         /*the blink text-decoration attribute will not be supported */          /*the blink text-decoration attribute will not be supported */
         cssRule = SkipWord (cssRule);          cssRule = SkipWord (cssRule);
      }       }
    else if (!strncasecmp (cssRule, "none", strlen ("none")))     else if (!ustrncasecmp (cssRule, TEXT("none"), strlen ("none")))
      {       {
         decor.typed_data.value = NoUnderline;          decor.typed_data.value = NoUnderline;
         cssRule = SkipWord (cssRule);          cssRule = SkipWord (cssRule);
Line 2271  ThotBool            isHTML; Line 2272  ThotBool            isHTML;
    ParseCSSHeight : parse a CSS height attribute                      ParseCSSHeight : parse a CSS height attribute                 
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 static char*        ParseCSSHeight (Element element, PSchema tsch,  static CHAR_T*        ParseCSSHeight (Element element, PSchema tsch,
                                  PresentationContext context, char* cssRule, CSSInfoPtr css, ThotBool isHTML)                                   PresentationContext context, CHAR_T* cssRule, CSSInfoPtr css, ThotBool isHTML)
 #else  #else
 static char*        ParseCSSHeight (element, tsch, context, cssRule, css, isHTML)  static CHAR_T*        ParseCSSHeight (element, tsch, context, cssRule, css, isHTML)
 Element             element;  Element             element;
 PSchema             tsch;  PSchema             tsch;
 PresentationContext context;  PresentationContext context;
Line 2283  CSSInfoPtr          css; Line 2284  CSSInfoPtr          css;
 ThotBool            isHTML;  ThotBool            isHTML;
 #endif  #endif
 {  {
    cssRule = SkipBlanksAndComments (cssRule);     cssRule = SkipWCBlanksAndComments (cssRule);
   
    /* first parse the attribute string */     /* first parse the attribute string */
    if (!strcasecmp (cssRule, "auto"))     if (!ustrcasecmp (cssRule, TEXT("auto")))
      {       {
         cssRule = SkipWord (cssRule);          cssRule = SkipWord (cssRule);
         /* ParseCSSHeight : auto */          /* ParseCSSHeight : auto */
Line 2301  ThotBool            isHTML; Line 2302  ThotBool            isHTML;
    ParseCSSWidth : parse a CSS width attribute                ParseCSSWidth : parse a CSS width attribute           
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 static char*        ParseCSSWidth (Element element, PSchema tsch,  static CHAR_T*        ParseCSSWidth (Element element, PSchema tsch,
                                  PresentationContext context, char* cssRule, CSSInfoPtr css, ThotBool isHTML)                                   PresentationContext context, CHAR_T* cssRule, CSSInfoPtr css, ThotBool isHTML)
 #else  #else
 static char*        ParseCSSWidth (element, tsch, context, cssRule, css, isHTML)  static CHAR_T*        ParseCSSWidth (element, tsch, context, cssRule, css, isHTML)
 Element             element;  Element             element;
 PSchema             tsch;  PSchema             tsch;
 PresentationContext context;  PresentationContext context;
Line 2313  CSSInfoPtr          css; Line 2314  CSSInfoPtr          css;
 ThotBool            isHTML;  ThotBool            isHTML;
 #endif  #endif
 {  {
    cssRule = SkipBlanksAndComments (cssRule);     cssRule = SkipWCBlanksAndComments (cssRule);
   
    /* first parse the attribute string */     /* first parse the attribute string */
    if (!strcasecmp (cssRule, "auto"))     if (!ustrcasecmp (cssRule, TEXT("auto")))
      {       {
         cssRule = SkipWord (cssRule);          cssRule = SkipWord (cssRule);
         return (cssRule);          return (cssRule);
Line 2330  ThotBool            isHTML; Line 2331  ThotBool            isHTML;
    ParseCSSMarginTop : parse a CSS margin-top attribute       ParseCSSMarginTop : parse a CSS margin-top attribute  
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 static char*        ParseCSSMarginTop (Element element, PSchema tsch,  static CHAR_T*        ParseCSSMarginTop (Element element, PSchema tsch,
                                  PresentationContext context, char* cssRule, CSSInfoPtr css, ThotBool isHTML)                                   PresentationContext context, CHAR_T* cssRule, CSSInfoPtr css, ThotBool isHTML)
 #else  #else
 static char*        ParseCSSMarginTop (element, tsch, context, cssRule, css, isHTML)  static CHAR_T*        ParseCSSMarginTop (element, tsch, context, cssRule, css, isHTML)
 Element             element;  Element             element;
 PSchema             tsch;  PSchema             tsch;
 PresentationContext context;  PresentationContext context;
Line 2344  ThotBool            isHTML; Line 2345  ThotBool            isHTML;
 {  {
   PresentationValue   margin;    PresentationValue   margin;
       
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipWCBlanksAndComments (cssRule);
   /* first parse the attribute string */    /* first parse the attribute string */
   cssRule = ParseCSSUnit (cssRule, &margin);    cssRule = ParseCSSUnit (cssRule, &margin);
   if (margin.typed_data.unit != STYLE_UNIT_INVALID)    if (margin.typed_data.unit != STYLE_UNIT_INVALID)
Line 2361  ThotBool            isHTML; Line 2362  ThotBool            isHTML;
    attribute                                                      attribute                                                 
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 static char*        ParseCSSMarginBottom (Element element, PSchema tsch,  static CHAR_T*        ParseCSSMarginBottom (Element element, PSchema tsch,
                                  PresentationContext context, char* cssRule, CSSInfoPtr css, ThotBool isHTML)                                   PresentationContext context, CHAR_T* cssRule, CSSInfoPtr css, ThotBool isHTML)
 #else  #else
 static char*        ParseCSSMarginBottom (element, tsch, context, cssRule, css, isHTML)  static CHAR_T*        ParseCSSMarginBottom (element, tsch, context, cssRule, css, isHTML)
 Element             element;  Element             element;
 PSchema             tsch;  PSchema             tsch;
 PresentationContext context;  PresentationContext context;
Line 2375  ThotBool            isHTML; Line 2376  ThotBool            isHTML;
 {  {
   PresentationValue   margin;    PresentationValue   margin;
       
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipWCBlanksAndComments (cssRule);
   /* first parse the attribute string */    /* first parse the attribute string */
   cssRule = ParseCSSUnit (cssRule, &margin);    cssRule = ParseCSSUnit (cssRule, &margin);
   if (margin.typed_data.unit != STYLE_UNIT_INVALID)    if (margin.typed_data.unit != STYLE_UNIT_INVALID)
Line 2388  ThotBool            isHTML; Line 2389  ThotBool            isHTML;
    attribute string.                                               attribute string.                                          
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 static char*        ParseCSSMarginLeft (Element element, PSchema tsch,  static CHAR_T*        ParseCSSMarginLeft (Element element, PSchema tsch,
                                  PresentationContext context, char* cssRule, CSSInfoPtr css, ThotBool isHTML)                                   PresentationContext context, CHAR_T* cssRule, CSSInfoPtr css, ThotBool isHTML)
 #else  #else
 static char*        ParseCSSMarginLeft (element, tsch, context, cssRule, css, isHTML)  static CHAR_T*        ParseCSSMarginLeft (element, tsch, context, cssRule, css, isHTML)
 Element             element;  Element             element;
 PSchema             tsch;  PSchema             tsch;
 PresentationContext context;  PresentationContext context;
Line 2402  ThotBool            isHTML; Line 2403  ThotBool            isHTML;
 {  {
   PresentationValue   margin;    PresentationValue   margin;
       
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipWCBlanksAndComments (cssRule);
   /* first parse the attribute string */    /* first parse the attribute string */
   cssRule = ParseCSSUnit (cssRule, &margin);    cssRule = ParseCSSUnit (cssRule, &margin);
   if (margin.typed_data.unit != STYLE_UNIT_INVALID)    if (margin.typed_data.unit != STYLE_UNIT_INVALID)
Line 2419  ThotBool            isHTML; Line 2420  ThotBool            isHTML;
    attribute string.                                               attribute string.                                          
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 static char*        ParseCSSMarginRight (Element element, PSchema tsch,  static CHAR_T*        ParseCSSMarginRight (Element element, PSchema tsch,
                                  PresentationContext context, char* cssRule, CSSInfoPtr css, ThotBool isHTML)                                   PresentationContext context, CHAR_T* cssRule, CSSInfoPtr css, ThotBool isHTML)
 #else  #else
 static char*        ParseCSSMarginRight (element, tsch, context, cssRule, css, isHTML)  static CHAR_T*        ParseCSSMarginRight (element, tsch, context, cssRule, css, isHTML)
 Element             element;  Element             element;
 PSchema             tsch;  PSchema             tsch;
 PresentationContext context;  PresentationContext context;
Line 2433  ThotBool            isHTML; Line 2434  ThotBool            isHTML;
 {  {
   PresentationValue   margin;    PresentationValue   margin;
       
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipWCBlanksAndComments (cssRule);
   /* first parse the attribute string */    /* first parse the attribute string */
   cssRule = ParseCSSUnit (cssRule, &margin);    cssRule = ParseCSSUnit (cssRule, &margin);
   if (margin.typed_data.unit != STYLE_UNIT_INVALID)    if (margin.typed_data.unit != STYLE_UNIT_INVALID)
Line 2445  ThotBool            isHTML; Line 2446  ThotBool            isHTML;
    ParseCSSMargin : parse a CSS margin attribute string.      ParseCSSMargin : parse a CSS margin attribute string. 
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 static char*        ParseCSSMargin (Element element, PSchema tsch,  static CHAR_T*        ParseCSSMargin (Element element, PSchema tsch,
                                  PresentationContext context, char* cssRule, CSSInfoPtr css, ThotBool isHTML)                                   PresentationContext context, CHAR_T* cssRule, CSSInfoPtr css, ThotBool isHTML)
 #else  #else
 static char*        ParseCSSMargin (element, tsch, context, cssRule, css, isHTML)  static CHAR_T*        ParseCSSMargin (element, tsch, context, cssRule, css, isHTML)
 Element             element;  Element             element;
 PSchema             tsch;  PSchema             tsch;
 PresentationContext context;  PresentationContext context;
Line 2457  CSSInfoPtr          css; Line 2458  CSSInfoPtr          css;
 ThotBool            isHTML;  ThotBool            isHTML;
 #endif  #endif
 {  {
   char *ptrT, *ptrR, *ptrB, *ptrL;    CHAR_T *ptrT, *ptrR, *ptrB, *ptrL;
   
   ptrT = SkipBlanksAndComments (cssRule);    ptrT = SkipWCBlanksAndComments (cssRule);
   /* First parse Margin-Top */    /* First parse Margin-Top */
   ptrR = ParseCSSMarginTop (element, tsch, context, ptrT, css, isHTML);    ptrR = ParseCSSMarginTop (element, tsch, context, ptrT, css, isHTML);
   ptrR = SkipBlanksAndComments (ptrR);    ptrR = SkipWCBlanksAndComments (ptrR);
   if (*ptrR == ';' || *ptrR == EOS || *ptrR == ',')    if (*ptrR == TEXT(';') || *ptrR == WC_EOS || *ptrR == TEXT(','))
     {      {
       cssRule = ptrR;        cssRule = ptrR;
       /* apply the Margin-Top to all */        /* apply the Margin-Top to all */
Line 2475  ThotBool            isHTML; Line 2476  ThotBool            isHTML;
     {      {
       /* parse Margin-Right */        /* parse Margin-Right */
       ptrB = ParseCSSMarginRight (element, tsch, context, ptrR, css, isHTML);        ptrB = ParseCSSMarginRight (element, tsch, context, ptrR, css, isHTML);
       ptrB = SkipBlanksAndComments (ptrB);        ptrB = SkipWCBlanksAndComments (ptrB);
       if (*ptrB == ';' || *ptrB == EOS || *ptrB == ',')        if (*ptrB == TEXT(';') || *ptrB == WC_EOS || *ptrB == TEXT(','))
         {          {
           cssRule = ptrB;            cssRule = ptrB;
           /* apply the Margin-Top to Margin-Bottom */            /* apply the Margin-Top to Margin-Bottom */
Line 2488  ThotBool            isHTML; Line 2489  ThotBool            isHTML;
         {          {
           /* parse Margin-Bottom */            /* parse Margin-Bottom */
           ptrL = ParseCSSMarginBottom (element, tsch, context, ptrB, css, isHTML);            ptrL = ParseCSSMarginBottom (element, tsch, context, ptrB, css, isHTML);
           ptrL = SkipBlanksAndComments (ptrL);            ptrL = SkipWCBlanksAndComments (ptrL);
           if (*ptrL == ';' || *ptrL == EOS || *ptrL == ',')            if (*ptrL == TEXT(';') || *ptrL == WC_EOS || *ptrL == TEXT(','))
             {              {
               cssRule = ptrL;                cssRule = ptrL;
               /* apply the Margin-Right to Margin-Left */                /* apply the Margin-Right to Margin-Left */
Line 2498  ThotBool            isHTML; Line 2499  ThotBool            isHTML;
           else            else
             /* parse Margin-Left */              /* parse Margin-Left */
             cssRule = ParseCSSMarginLeft (element, tsch, context, ptrL, css, isHTML);              cssRule = ParseCSSMarginLeft (element, tsch, context, ptrL, css, isHTML);
           cssRule = SkipBlanksAndComments (cssRule);            cssRule = SkipWCBlanksAndComments (cssRule);
         }          }
     }      }
   return (cssRule);    return (cssRule);
Line 2509  ThotBool            isHTML; Line 2510  ThotBool            isHTML;
    attribute string.                                               attribute string.                                          
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 static char*        ParseCSSPaddingTop (Element element, PSchema tsch,  static CHAR_T*        ParseCSSPaddingTop (Element element, PSchema tsch,
                                  PresentationContext context, char* cssRule, CSSInfoPtr css, ThotBool isHTML)                                   PresentationContext context, CHAR_T* cssRule, CSSInfoPtr css, ThotBool isHTML)
 #else  #else
 static char*        ParseCSSPaddingTop (element, tsch, context, cssRule, css, isHTML)  static CHAR_T*        ParseCSSPaddingTop (element, tsch, context, cssRule, css, isHTML)
 Element             element;  Element             element;
 PSchema             tsch;  PSchema             tsch;
 PresentationContext context;  PresentationContext context;
Line 2523  ThotBool            isHTML; Line 2524  ThotBool            isHTML;
 {  {
   PresentationValue   padding;    PresentationValue   padding;
       
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipWCBlanksAndComments (cssRule);
   /* first parse the attribute string */    /* first parse the attribute string */
   cssRule = ParseCSSUnit (cssRule, &padding);    cssRule = ParseCSSUnit (cssRule, &padding);
   if (padding.typed_data.unit != STYLE_UNIT_INVALID)    if (padding.typed_data.unit != STYLE_UNIT_INVALID)
Line 2536  ThotBool            isHTML; Line 2537  ThotBool            isHTML;
    attribute string.                                               attribute string.                                          
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 static char*        ParseCSSPaddingBottom (Element element, PSchema tsch,  static CHAR_T*        ParseCSSPaddingBottom (Element element, PSchema tsch,
                                  PresentationContext context, char* cssRule, CSSInfoPtr css, ThotBool isHTML)                                   PresentationContext context, CHAR_T* cssRule, CSSInfoPtr css, ThotBool isHTML)
 #else  #else
 static char*        ParseCSSPaddingBottom (element, tsch, context, cssRule, css, isHTML)  static CHAR_T*        ParseCSSPaddingBottom (element, tsch, context, cssRule, css, isHTML)
 Element             element;  Element             element;
 PSchema             tsch;  PSchema             tsch;
 PresentationContext context;  PresentationContext context;
Line 2550  ThotBool            isHTML; Line 2551  ThotBool            isHTML;
 {  {
   PresentationValue   padding;    PresentationValue   padding;
       
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipWCBlanksAndComments (cssRule);
   /* first parse the attribute string */    /* first parse the attribute string */
   cssRule = ParseCSSUnit (cssRule, &padding);    cssRule = ParseCSSUnit (cssRule, &padding);
   if (padding.typed_data.unit != STYLE_UNIT_INVALID)    if (padding.typed_data.unit != STYLE_UNIT_INVALID)
Line 2563  ThotBool            isHTML; Line 2564  ThotBool            isHTML;
    attribute string.                                               attribute string.                                          
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 static char*        ParseCSSPaddingLeft (Element element, PSchema tsch,  static CHAR_T*        ParseCSSPaddingLeft (Element element, PSchema tsch,
                                  PresentationContext context, char* cssRule, CSSInfoPtr css, ThotBool isHTML)                                   PresentationContext context, CHAR_T* cssRule, CSSInfoPtr css, ThotBool isHTML)
 #else  #else
 static char*        ParseCSSPaddingLeft (element, tsch, context, cssRule, css, isHTML)  static CHAR_T*        ParseCSSPaddingLeft (element, tsch, context, cssRule, css, isHTML)
 Element             element;  Element             element;
 PSchema             tsch;  PSchema             tsch;
 PresentationContext context;  PresentationContext context;
Line 2577  ThotBool            isHTML; Line 2578  ThotBool            isHTML;
 {  {
   PresentationValue   padding;    PresentationValue   padding;
       
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipWCBlanksAndComments (cssRule);
   /* first parse the attribute string */    /* first parse the attribute string */
   cssRule = ParseCSSUnit (cssRule, &padding);    cssRule = ParseCSSUnit (cssRule, &padding);
   if (padding.typed_data.unit != STYLE_UNIT_INVALID)    if (padding.typed_data.unit != STYLE_UNIT_INVALID)
Line 2590  ThotBool            isHTML; Line 2591  ThotBool            isHTML;
    attribute string.                                               attribute string.                                          
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 static char*        ParseCSSPaddingRight (Element element, PSchema tsch,  static CHAR_T*        ParseCSSPaddingRight (Element element, PSchema tsch,
                                  PresentationContext context, char* cssRule, CSSInfoPtr css, ThotBool isHTML)                                   PresentationContext context, CHAR_T* cssRule, CSSInfoPtr css, ThotBool isHTML)
 #else  #else
 static char*        ParseCSSPaddingRight (element, tsch, context, cssRule, css, isHTML)  static CHAR_T*        ParseCSSPaddingRight (element, tsch, context, cssRule, css, isHTML)
 Element             element;  Element             element;
 PSchema             tsch;  PSchema             tsch;
 PresentationContext context;  PresentationContext context;
Line 2604  ThotBool            isHTML; Line 2605  ThotBool            isHTML;
 {  {
   PresentationValue   padding;    PresentationValue   padding;
       
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipWCBlanksAndComments (cssRule);
   /* first parse the attribute string */    /* first parse the attribute string */
   cssRule = ParseCSSUnit (cssRule, &padding);    cssRule = ParseCSSUnit (cssRule, &padding);
   if (padding.typed_data.unit != STYLE_UNIT_INVALID)    if (padding.typed_data.unit != STYLE_UNIT_INVALID)
Line 2616  ThotBool            isHTML; Line 2617  ThotBool            isHTML;
    ParseCSSPadding : parse a CSS padding attribute string.      ParseCSSPadding : parse a CSS padding attribute string. 
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 static char*        ParseCSSPadding (Element element, PSchema tsch,  static CHAR_T*        ParseCSSPadding (Element element, PSchema tsch,
                                  PresentationContext context, char* cssRule, CSSInfoPtr css, ThotBool isHTML)                                   PresentationContext context, CHAR_T* cssRule, CSSInfoPtr css, ThotBool isHTML)
 #else  #else
 static char*        ParseCSSPadding (element, tsch, context, cssRule, css, isHTML)  static CHAR_T*        ParseCSSPadding (element, tsch, context, cssRule, css, isHTML)
 Element             element;  Element             element;
 PSchema             tsch;  PSchema             tsch;
 PresentationContext context;  PresentationContext context;
Line 2628  CSSInfoPtr          css; Line 2629  CSSInfoPtr          css;
 ThotBool            isHTML;  ThotBool            isHTML;
 #endif  #endif
 {  {
   char *ptrT, *ptrR, *ptrB, *ptrL;    CHAR_T *ptrT, *ptrR, *ptrB, *ptrL;
   
   ptrT = SkipBlanksAndComments (cssRule);    ptrT = SkipWCBlanksAndComments (cssRule);
   /* First parse Padding-Top */    /* First parse Padding-Top */
   ptrR = ParseCSSPaddingTop (element, tsch, context, ptrT, css, isHTML);    ptrR = ParseCSSPaddingTop (element, tsch, context, ptrT, css, isHTML);
   ptrR = SkipBlanksAndComments (ptrR);    ptrR = SkipWCBlanksAndComments (ptrR);
   if (*ptrR == ';' || *ptrR == EOS || *ptrR == ',')    if (*ptrR == TEXT(';') || *ptrR == WC_EOS || *ptrR == TEXT(','))
     {      {
       cssRule = ptrR;        cssRule = ptrR;
       /* apply the Padding-Top to all */        /* apply the Padding-Top to all */
Line 2646  ThotBool            isHTML; Line 2647  ThotBool            isHTML;
     {      {
       /* parse Padding-Right */        /* parse Padding-Right */
       ptrB = ParseCSSPaddingRight (element, tsch, context, ptrR, css, isHTML);        ptrB = ParseCSSPaddingRight (element, tsch, context, ptrR, css, isHTML);
       ptrB = SkipBlanksAndComments (ptrB);        ptrB = SkipWCBlanksAndComments (ptrB);
       if (*ptrB == ';' || *ptrB == EOS || *ptrB == ',')        if (*ptrB == TEXT(';') || *ptrB == WC_EOS || *ptrB == TEXT(','))
         {          {
           cssRule = ptrB;            cssRule = ptrB;
           /* apply the Padding-Top to Padding-Bottom */            /* apply the Padding-Top to Padding-Bottom */
Line 2659  ThotBool            isHTML; Line 2660  ThotBool            isHTML;
         {          {
           /* parse Padding-Bottom */            /* parse Padding-Bottom */
           ptrL = ParseCSSPaddingBottom (element, tsch, context, ptrB, css, isHTML);            ptrL = ParseCSSPaddingBottom (element, tsch, context, ptrB, css, isHTML);
           ptrL = SkipBlanksAndComments (ptrL);            ptrL = SkipWCBlanksAndComments (ptrL);
           if (*ptrL == ';' || *ptrL == EOS || *ptrL == ',')            if (*ptrL == TEXT(';') || *ptrL == WC_EOS || *ptrL == TEXT(','))
             {              {
               cssRule = ptrL;                cssRule = ptrL;
               /* apply the Padding-Right to Padding-Left */                /* apply the Padding-Right to Padding-Left */
Line 2669  ThotBool            isHTML; Line 2670  ThotBool            isHTML;
           else            else
             /* parse Padding-Left */              /* parse Padding-Left */
             cssRule = ParseCSSPaddingLeft (element, tsch, context, ptrL, css, isHTML);              cssRule = ParseCSSPaddingLeft (element, tsch, context, ptrL, css, isHTML);
           cssRule = SkipBlanksAndComments (cssRule);            cssRule = SkipWCBlanksAndComments (cssRule);
         }          }
     }      }
   return (cssRule);    return (cssRule);
Line 2679  ThotBool            isHTML; Line 2680  ThotBool            isHTML;
    ParseCSSForeground : parse a CSS foreground attribute      ParseCSSForeground : parse a CSS foreground attribute 
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 static char*        ParseCSSForeground (Element element, PSchema tsch,  static CHAR_T*        ParseCSSForeground (Element element, PSchema tsch,
                                  PresentationContext context, char* cssRule, CSSInfoPtr css, ThotBool isHTML)                                   PresentationContext context, CHAR_T* cssRule, CSSInfoPtr css, ThotBool isHTML)
 #else  #else
 static char*        ParseCSSForeground (element, tsch, context, cssRule, css, isHTML)  static CHAR_T*        ParseCSSForeground (element, tsch, context, cssRule, css, isHTML)
 Element             element;  Element             element;
 PSchema             tsch;  PSchema             tsch;
 PresentationContext context;  PresentationContext context;
Line 2704  ThotBool            isHTML; Line 2705  ThotBool            isHTML;
    ParseCSSBackgroundColor : parse a CSS background color attribute      ParseCSSBackgroundColor : parse a CSS background color attribute 
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 static char*        ParseCSSBackgroundColor (Element element, PSchema tsch,  static CHAR_T*      ParseCSSBackgroundColor (Element element, PSchema tsch,
                     PresentationContext context, char* cssRule, CSSInfoPtr css, ThotBool isHTML)                      PresentationContext context, CHAR_T* cssRule, CSSInfoPtr css, ThotBool isHTML)
 #else  #else
 static char*        ParseCSSBackgroundColor (element, tsch, context, cssRule, css, isHTML)  static CHAR_T*      ParseCSSBackgroundColor (element, tsch, context, cssRule, css, isHTML)
 Element             element;  Element             element;
 PSchema             tsch;  PSchema             tsch;
 PresentationContext context;  PresentationContext context;
 char*               cssRule;  CHAR_T*             cssRule;
 CSSInfoPtr          css;  CSSInfoPtr          css;
 ThotBool            isHTML;  ThotBool            isHTML;
 #endif  #endif
Line 2735  ThotBool            isHTML; Line 2736  ThotBool            isHTML;
   
   best.typed_data.unit = STYLE_UNIT_INVALID;    best.typed_data.unit = STYLE_UNIT_INVALID;
   best.typed_data.real = FALSE;    best.typed_data.real = FALSE;
   if (!strncasecmp (cssRule, "transparent", strlen ("transparent")))    if (!ustrncasecmp (cssRule, TEXT("transparent"), strlen ("transparent")))
     {      {
       best.typed_data.value = STYLE_PATTERN_NONE;        best.typed_data.value = STYLE_PATTERN_NONE;
       best.typed_data.unit = STYLE_UNIT_REL;        best.typed_data.unit = STYLE_UNIT_REL;
Line 2770  ThotBool            isHTML; Line 2771  ThotBool            isHTML;
    FetchImage when a background image has been fetched.     FetchImage when a background image has been fetched.
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 void ParseCSSBackgroundImageCallback (Document doc, Element element, STRING file,  void ParseCSSBackgroundImageCallback (Document doc, Element element, STRING file, void *extra)
                                       void *extra)  
 #else  #else
 void ParseCSSBackgroundImageCallback (doc, element, file, extra)  void ParseCSSBackgroundImageCallback (doc, element, file, extra)
 Document doc;  Document doc;
Line 2833  void    *extra; Line 2833  void    *extra;
    Returns NULL or a new allocated url string.     Returns NULL or a new allocated url string.
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 char*               GetCSSBackgroundURL (char* styleString)  CHAR_T*             GetCSSBackgroundURL (CHAR_T* styleString)
 #else  #else
 char*               GetCSSBackgroundURL (styleString)  CHAR_T*             GetCSSBackgroundURL (styleString)
 char*               styleString;  CHAR_T*             styleString;
 #endif  #endif
 {  {
   char *b, *e, *ptr;    CHAR_T *b, *e, *ptr;
   int                 len;    int                 len;
   
   ptr = NULL;    ptr = NULL;
   b = strstr (styleString, "url");    b = ustrstr (styleString, TEXT("url"));
   if (b != NULL)    if (b != NULL)
     {      {
       b += 3;        b += 3;
       b = SkipBlanksAndComments (b);        b = SkipWCBlanksAndComments (b);
       if (*b == '(')        if (*b == TEXT('('))
         {          {
           b++;            b++;
           b = SkipBlanksAndComments (b);            b = SkipWCBlanksAndComments (b);
           /*** Caution: Strings can either be written with double quotes or            /*** Caution: Strings can either be written with double quotes or
                with single quotes. Only double quotes are handled here.                 with single quotes. Only double quotes are handled here.
                Escaped quotes are not handled. See function SkipQuotedString */                 Escaped quotes are not handled. See function SkipQuotedString */
           if (*b == '"')            if (*b == TEXT('"'))
             {              {
               b++;                b++;
               /* search the url end */                /* search the url end */
               e = b;                e = b;
               while (*e != EOS && *e != '"')                while (*e != WC_EOS && *e != TEXT('"'))
                 e++;                  e++;
             }              }
           else            else
             {              {
               /* search the url end */                /* search the url end */
               e = b;                e = b;
               while (*e != EOS && *e != ')')                while (*e != WC_EOS && *e != TEXT(')'))
                 e++;                  e++;
             }              }
           if (*e != EOS)            if (*e != WC_EOS)
             {              {
               len = (int)(e - b);                len = (int)(e - b);
               ptr = (char*) TtaGetMemory (len+1);                ptr = (CHAR_T*) TtaAllocString (len+1);
               strncpy (ptr, b, len);                ustrncpy (ptr, b, len);
               ptr[len] = EOS;                ptr[len] = WC_EOS;
             }              }
         }          }
     }      }
Line 3032  ThotBool            isHTML; Line 3032  ThotBool            isHTML;
    attribute string.                                               attribute string.                                          
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 static char*        ParseCSSBackgroundRepeat (Element element, PSchema tsch,  static CHAR_T*        ParseCSSBackgroundRepeat (Element element, PSchema tsch,
                                  PresentationContext context, char* cssRule, CSSInfoPtr css, ThotBool isHTML)                                   PresentationContext context, CHAR_T* cssRule, CSSInfoPtr css, ThotBool isHTML)
 #else  #else
 static char*        ParseCSSBackgroundRepeat (element, tsch, context, cssRule, css, isHTML)  static CHAR_T*        ParseCSSBackgroundRepeat (element, tsch, context, cssRule, css, isHTML)
 Element             element;  Element             element;
 PSchema             tsch;  PSchema             tsch;
 PresentationContext context;  PresentationContext context;
 STRING              cssRule;  CHAR_T*             cssRule;
 CSSInfoPtr          css;  CSSInfoPtr          css;
 ThotBool            isHTML;  ThotBool            isHTML;
 #endif  #endif
Line 3064  ThotBool            isHTML; Line 3064  ThotBool            isHTML;
   repeat.typed_data.value = STYLE_REALSIZE;    repeat.typed_data.value = STYLE_REALSIZE;
   repeat.typed_data.unit = STYLE_UNIT_REL;    repeat.typed_data.unit = STYLE_UNIT_REL;
   repeat.typed_data.real = FALSE;    repeat.typed_data.real = FALSE;
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipWCBlanksAndComments (cssRule);
   if (!strncasecmp (cssRule, "no-repeat", 9))    if (!ustrncasecmp (cssRule, TEXT("no-repeat"), 9))
     repeat.typed_data.value = STYLE_REALSIZE;      repeat.typed_data.value = STYLE_REALSIZE;
   else if (!strncasecmp (cssRule, "repeat-y", 8))    else if (!ustrncasecmp (cssRule, TEXT("repeat-y"), 8))
     repeat.typed_data.value = STYLE_VREPEAT;      repeat.typed_data.value = STYLE_VREPEAT;
   else if (!strncasecmp (cssRule, "repeat-x", 8))    else if (!ustrncasecmp (cssRule, TEXT("repeat-x"), 8))
     repeat.typed_data.value = STYLE_HREPEAT;      repeat.typed_data.value = STYLE_HREPEAT;
   else if (!strncasecmp (cssRule, "repeat", 6))    else if (!ustrncasecmp (cssRule, TEXT("repeat"), 6))
     repeat.typed_data.value = STYLE_REPEAT;      repeat.typed_data.value = STYLE_REPEAT;
   else    else
     return (cssRule);      return (cssRule);
Line 3091  ThotBool            isHTML; Line 3091  ThotBool            isHTML;
    attribute string.                                               attribute string.                                          
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 static char*        ParseCSSBackgroundAttachment (Element element, PSchema tsch,  static CHAR_T*        ParseCSSBackgroundAttachment (Element element, PSchema tsch,
                                  PresentationContext context, char* cssRule, CSSInfoPtr css, ThotBool isHTML)                                   PresentationContext context, CHAR_T* cssRule, CSSInfoPtr css, ThotBool isHTML)
 #else  #else
 static char*        ParseCSSBackgroundAttachment (element, tsch, context, cssRule, css, isHTML)  static CHAR_T*        ParseCSSBackgroundAttachment (element, tsch, context, cssRule, css, isHTML)
 Element             element;  Element             element;
 PSchema             tsch;  PSchema             tsch;
 PresentationContext context;  PresentationContext context;
 STRING              cssRule;  CHAR_T*             cssRule;
 CSSInfoPtr          css;  CSSInfoPtr          css;
 ThotBool            isHTML;  ThotBool            isHTML;
 #endif  #endif
Line 3119  ThotBool            isHTML; Line 3119  ThotBool            isHTML;
         }          }
     }      }
   
    cssRule = SkipBlanksAndComments (cssRule);     cssRule = SkipWCBlanksAndComments (cssRule);
    if (!strncasecmp (cssRule, "scroll", 6))     if (!ustrncasecmp (cssRule, TEXT("scroll"), 6))
      cssRule = SkipWord (cssRule);       cssRule = SkipWord (cssRule);
    else if (!strncasecmp (cssRule, "fixed", 5))     else if (!ustrncasecmp (cssRule, TEXT("fixed"), 5))
      cssRule = SkipWord (cssRule);       cssRule = SkipWord (cssRule);
   
   /* restore the refered element */    /* restore the refered element */
Line 3136  ThotBool            isHTML; Line 3136  ThotBool            isHTML;
    attribute string.                                               attribute string.                                          
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 static char*        ParseCSSBackgroundPosition (Element element, PSchema tsch,  static CHAR_T*        ParseCSSBackgroundPosition (Element element, PSchema tsch,
                                  PresentationContext context, char* cssRule, CSSInfoPtr css, ThotBool isHTML)                                   PresentationContext context, CHAR_T* cssRule, CSSInfoPtr css, ThotBool isHTML)
 #else  #else
 static char*        ParseCSSBackgroundPosition (element, tsch, context, cssRule, css, isHTML)  static CHAR_T*        ParseCSSBackgroundPosition (element, tsch, context, cssRule, css, isHTML)
 Element             element;  Element             element;
 PSchema             tsch;  PSchema             tsch;
 PresentationContext context;  PresentationContext context;
 STRING              cssRule;  CHAR_T*             cssRule;
 CSSInfoPtr          css;  CSSInfoPtr          css;
 ThotBool            isHTML;  ThotBool            isHTML;
 #endif  #endif
Line 3166  ThotBool            isHTML; Line 3166  ThotBool            isHTML;
         }          }
     }      }
   
    cssRule = SkipBlanksAndComments (cssRule);     cssRule = SkipWCBlanksAndComments (cssRule);
    ok = TRUE;     ok = TRUE;
    if (!strncasecmp (cssRule, "left", 4))     if (!ustrncasecmp (cssRule, TEXT("left"), 4))
      cssRule = SkipWord (cssRule);       cssRule = SkipWord (cssRule);
    else if (!strncasecmp (cssRule, "right", 5))     else if (!ustrncasecmp (cssRule, TEXT("right"), 5))
      cssRule = SkipWord (cssRule);       cssRule = SkipWord (cssRule);
    else if (!strncasecmp (cssRule, "center", 6))     else if (!ustrncasecmp (cssRule, TEXT("center"), 6))
      cssRule = SkipWord (cssRule);       cssRule = SkipWord (cssRule);
    else if (!strncasecmp (cssRule, "top", 3))     else if (!ustrncasecmp (cssRule, TEXT("top"), 3))
      cssRule = SkipWord (cssRule);       cssRule = SkipWord (cssRule);
    else if (!strncasecmp (cssRule, "bottom", 6))     else if (!ustrncasecmp (cssRule, TEXT("bottom"), 6))
      cssRule = SkipWord (cssRule);       cssRule = SkipWord (cssRule);
    else if (isdigit (*cssRule))     else if (TtaIsDigit (*cssRule))
      cssRule = SkipWord (cssRule);       cssRule = SkipWord (cssRule);
    else     else
      ok = FALSE;       ok = FALSE;
Line 3202  ThotBool            isHTML; Line 3202  ThotBool            isHTML;
    ParseCSSBackground : parse a CSS background attribute      ParseCSSBackground : parse a CSS background attribute 
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 static char*        ParseCSSBackground (Element element, PSchema tsch,  static CHAR_T*      ParseCSSBackground (Element element, PSchema tsch,
                                  PresentationContext context, char* cssRule, CSSInfoPtr css, ThotBool isHTML)                                      PresentationContext context, CHAR_T* cssRule, CSSInfoPtr css, ThotBool isHTML)
 #else  #else
 static char*        ParseCSSBackground (element, tsch, context, cssRule, css, isHTML)  static CHAR_T*      ParseCSSBackground (element, tsch, context, cssRule, css, isHTML)
 Element             element;  Element             element;
 PSchema             tsch;  PSchema             tsch;
 PresentationContext context;  PresentationContext context;
 STRING              cssRule;  CHAR_T*             cssRule;
 CSSInfoPtr          css;  CSSInfoPtr          css;
 ThotBool            isHTML;  ThotBool            isHTML;
 #endif  #endif
 {  {
   char*            ptr;    CHAR_T*           ptr;
   
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipWCBlanksAndComments (cssRule);
   while (*cssRule != ';' && *cssRule != EOS && *cssRule != ',')    while (*cssRule != TEXT(';') && *cssRule != WC_EOS && *cssRule != TEXT(','))
     {      {
       /* perhaps a Backgroud Image */        /* perhaps a Backgroud Image */
       if (!strncasecmp (cssRule, "url", 3))        if (!ustrncasecmp (cssRule, TEXT("url"), 3))
         cssRule = ParseCSSBackgroundImage (element, tsch, context, cssRule, css, isHTML);           cssRule = ParseCSSBackgroundImage (element, tsch, context, cssRule, css, isHTML);
       /* perhaps a Background Attachment */        /* perhaps a Background Attachment */
       else if (!strncasecmp (cssRule, "scroll", 6) ||        else if (!ustrncasecmp (cssRule, TEXT("scroll"), 6) ||
                !strncasecmp (cssRule, "fixed", 5))                 !ustrncasecmp (cssRule, TEXT("fixed"), 5))
         cssRule = ParseCSSBackgroundAttachment (element, tsch, context, cssRule, css, isHTML);             cssRule = ParseCSSBackgroundAttachment (element, tsch, context, cssRule, css, isHTML);
       /* perhaps a Background Repeat */        /* perhaps a Background Repeat */
       else if (!strncasecmp (cssRule, "no-repeat", 9) ||        else if (!ustrncasecmp (cssRule, TEXT("no-repeat"), 9) ||
                !strncasecmp (cssRule, "repeat-y", 8) ||                 !ustrncasecmp (cssRule, TEXT("repeat-y"), 8)  ||
                !strncasecmp (cssRule, "repeat-x", 8) ||                 !ustrncasecmp (cssRule, TEXT("repeat-x"), 8)  ||
                !strncasecmp (cssRule, "repeat", 6))                 !ustrncasecmp (cssRule, TEXT("repeat"), 6))
         cssRule = ParseCSSBackgroundRepeat (element, tsch, context, cssRule, css, isHTML);          cssRule = ParseCSSBackgroundRepeat (element, tsch, context, cssRule, css, isHTML);
       /* perhaps a Background Position */        /* perhaps a Background Position */
       else if (!strncasecmp (cssRule, "left", 4) ||        else if (!ustrncasecmp (cssRule, TEXT("left"), 4)   ||
                !strncasecmp (cssRule, "right", 5) ||                 !ustrncasecmp (cssRule, TEXT("right"), 5)  ||
                !strncasecmp (cssRule, "center", 6) ||                 !ustrncasecmp (cssRule, TEXT("center"), 6) ||
                !strncasecmp (cssRule, "top", 3) ||                 !ustrncasecmp (cssRule, TEXT("top"), 3)    ||
                !strncasecmp (cssRule, "bottom", 6) ||                 !ustrncasecmp (cssRule, TEXT("bottom"), 6) ||
                isdigit (*cssRule))                 TtaIsDigit (*cssRule))
         cssRule = ParseCSSBackgroundPosition (element, tsch, context, cssRule, css, isHTML);             cssRule = ParseCSSBackgroundPosition (element, tsch, context, cssRule, css, isHTML);
       /* perhaps a Background Color */        /* perhaps a Background Color */
       else        else
         {          {
Line 3250  ThotBool            isHTML; Line 3250  ThotBool            isHTML;
             /* rule not found */              /* rule not found */
             cssRule = SkipProperty (cssRule);              cssRule = SkipProperty (cssRule);
         }          }
       cssRule = SkipBlanksAndComments (cssRule);        cssRule = SkipWCBlanksAndComments (cssRule);
     }      }
    return (cssRule);     return (cssRule);
 }  }
Line 3268  ThotBool            isHTML; Line 3268  ThotBool            isHTML;
  */   */
 static CSSProperty CSSProperties[] =  static CSSProperty CSSProperties[] =
 {  {
    {"font-family", ParseCSSFontFamily},     {TEXT("font-family"), ParseCSSFontFamily},
    {"font-style", ParseCSSFontStyle},     {TEXT("font-style"), ParseCSSFontStyle},
    {"font-variant", ParseCSSFontVariant},     {TEXT("font-variant"), ParseCSSFontVariant},
    {"font-weight", ParseCSSFontWeight},     {TEXT("font-weight"), ParseCSSFontWeight},
    {"font-size", ParseCSSFontSize},     {TEXT("font-size"), ParseCSSFontSize},
    {"font", ParseCSSFont},     {TEXT("font"), ParseCSSFont},
   
    {"color", ParseCSSForeground},     {TEXT("color"), ParseCSSForeground},
    {"background-color", ParseCSSBackgroundColor},     {TEXT("background-color"), ParseCSSBackgroundColor},
    {"background-image", ParseCSSBackgroundImage},     {TEXT("background-image"), ParseCSSBackgroundImage},
    {"background-repeat", ParseCSSBackgroundRepeat},     {TEXT("background-repeat"), ParseCSSBackgroundRepeat},
    {"background-attachment", ParseCSSBackgroundAttachment},     {TEXT("background-attachment"), ParseCSSBackgroundAttachment},
    {"background-position", ParseCSSBackgroundPosition},     {TEXT("background-position"), ParseCSSBackgroundPosition},
    {"background", ParseCSSBackground},     {TEXT("background"), ParseCSSBackground},
   
    {"word-spacing", ParseCSSWordSpacing},     {TEXT("word-spacing"), ParseCSSWordSpacing},
    {"letter-spacing", ParseCSSLetterSpacing},     {TEXT("letter-spacing"), ParseCSSLetterSpacing},
    {"text-decoration", ParseCSSTextDecoration},     {TEXT("text-decoration"), ParseCSSTextDecoration},
    {"vertical-align", ParseCSSVerticalAlign},     {TEXT("vertical-align"), ParseCSSVerticalAlign},
    {"text-transform", ParseCSSTextTransform},     {TEXT("text-transform"), ParseCSSTextTransform},
    {"text-align", ParseCSSTextAlign},     {TEXT("text-align"), ParseCSSTextAlign},
    {"text-indent", ParseCSSTextIndent},     {TEXT("text-indent"), ParseCSSTextIndent},
    {"line-height", ParseCSSLineSpacing},     {TEXT("line-height"), ParseCSSLineSpacing},
   
    {"margin-top", ParseCSSMarginTop},     {TEXT("margin-top"), ParseCSSMarginTop},
    {"margin-right", ParseCSSMarginRight},     {TEXT("margin-right"), ParseCSSMarginRight},
    {"margin-bottom", ParseCSSMarginBottom},     {TEXT("margin-bottom"), ParseCSSMarginBottom},
    {"margin-left", ParseCSSMarginLeft},     {TEXT("margin-left"), ParseCSSMarginLeft},
    {"margin", ParseCSSMargin},     {TEXT("margin"), ParseCSSMargin},
   
    {"padding-top", ParseCSSPaddingTop},     {TEXT("padding-top"), ParseCSSPaddingTop},
    {"padding-right", ParseCSSPaddingRight},     {TEXT("padding-right"), ParseCSSPaddingRight},
    {"padding-bottom", ParseCSSPaddingBottom},     {TEXT("padding-bottom"), ParseCSSPaddingBottom},
    {"padding-left", ParseCSSPaddingLeft},     {TEXT("padding-left"), ParseCSSPaddingLeft},
    {"padding", ParseCSSPadding},     {TEXT("padding"), ParseCSSPadding},
   
    {"border-top-width", ParseCSSBorderTopWidth},     {TEXT("border-top-width"), ParseCSSBorderTopWidth},
    {"border-right-width", ParseCSSBorderRightWidth},     {TEXT("border-right-width"), ParseCSSBorderRightWidth},
    {"border-bottom-width", ParseCSSBorderBottomWidth},     {TEXT("border-bottom-width"), ParseCSSBorderBottomWidth},
    {"border-left-width", ParseCSSBorderLeftWidth},     {TEXT("border-left-width"), ParseCSSBorderLeftWidth},
    {"border-width", ParseCSSBorderWidth},     {TEXT("border-width"), ParseCSSBorderWidth},
    {"border-top-color", ParseCSSBorderColorTop},     {TEXT("border-top-color"), ParseCSSBorderColorTop},
    {"border-right-color", ParseCSSBorderColorRight},     {TEXT("border-right-color"), ParseCSSBorderColorRight},
    {"border-bottom-color", ParseCSSBorderColorBottom},     {TEXT("border-bottom-color"), ParseCSSBorderColorBottom},
    {"border-left-color", ParseCSSBorderColorLeft},     {TEXT("border-left-color"), ParseCSSBorderColorLeft},
    {"border-color", ParseCSSBorderColor},     {TEXT("border-color"), ParseCSSBorderColor},
    {"border-top-style", ParseCSSBorderStyleTop},     {TEXT("border-top-style"), ParseCSSBorderStyleTop},
    {"border-right-style", ParseCSSBorderStyleRight},     {TEXT("border-right-style"), ParseCSSBorderStyleRight},
    {"border-bottom-style", ParseCSSBorderStyleBottom},     {TEXT("border-bottom-style"), ParseCSSBorderStyleBottom},
    {"border-left-style", ParseCSSBorderStyleLeft},     {TEXT("border-left-style"), ParseCSSBorderStyleLeft},
    {"border-style", ParseCSSBorderStyle},     {TEXT("border-style"), ParseCSSBorderStyle},
    {"border-top", ParseCSSBorderTop},     {TEXT("border-top"), ParseCSSBorderTop},
    {"border-right", ParseCSSBorderRight},     {TEXT("border-right"), ParseCSSBorderRight},
    {"border-bottom", ParseCSSBorderBottom},     {TEXT("border-bottom"), ParseCSSBorderBottom},
    {"border-left", ParseCSSBorderLeft},     {TEXT("border-left"), ParseCSSBorderLeft},
    {"border", ParseCSSBorder},     {TEXT("border"), ParseCSSBorder},
   
    {"width", ParseCSSWidth},     {TEXT("width"), ParseCSSWidth},
    {"height", ParseCSSHeight},     {TEXT("height"), ParseCSSHeight},
    {"float", ParseCSSFloat},     {TEXT("float"), ParseCSSFloat},
    {"clear", ParseCSSClear},     {TEXT("clear"), ParseCSSClear},
   
    {"display", ParseCSSDisplay},     {TEXT("display"), ParseCSSDisplay},
    {"white-space", ParseCSSWhiteSpace},     {TEXT("white-space"), ParseCSSWhiteSpace},
   
    {"list-style-type", ParseCSSListStyleType},     {TEXT("list-style-type"), ParseCSSListStyleType},
    {"list-style-image", ParseCSSListStyleImage},     {TEXT("list-style-image"), ParseCSSListStyleImage},
    {"list-style-position", ParseCSSListStylePosition},     {TEXT("list-style-position"), ParseCSSListStylePosition},
    {"list-style", ParseCSSListStyle}     {TEXT("list-style"), ParseCSSListStyle}
 };  };
 #define NB_CSSSTYLEATTRIBUTE (sizeof(CSSProperties) / sizeof(CSSProperty))  #define NB_CSSSTYLEATTRIBUTE (sizeof(CSSProperties) / sizeof(CSSProperty))
   
Line 3347  static CSSProperty CSSProperties[] = Line 3347  static CSSProperty CSSProperties[] =
    but tolerate incorrect or incomplete input                         but tolerate incorrect or incomplete input                    
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 static void         ParseCSSRule (Element element, PSchema tsch, PresentationContext context, char* cssRule, CSSInfoPtr css, ThotBool isHTML)  static void         ParseCSSRule (Element element, PSchema tsch, PresentationContext context, CHAR_T* cssRule, CSSInfoPtr css, ThotBool isHTML)
 #else  #else
 static void         ParseCSSRule (element, tsch, context, cssRule, css, isHTML)  static void         ParseCSSRule (element, tsch, context, cssRule, css, isHTML)
 Element             element;  Element             element;
 PSchema             tsch;  PSchema             tsch;
 PresentationContext context;  PresentationContext context;
 char*               cssRule;  CHAR_T*               cssRule;
 CSSInfoPtr          css;  CSSInfoPtr          css;
 ThotBool            isHTML;  ThotBool            isHTML;
 #endif  #endif
 {  {
   DisplayMode         dispMode;    DisplayMode         dispMode;
   char*               p = NULL;    CHAR_T*             p = NULL;
   int                 lg;    int                 lg;
   unsigned int        i;    unsigned int        i;
   ThotBool            found;    ThotBool            found;
Line 3369  ThotBool            isHTML; Line 3369  ThotBool            isHTML;
   if (dispMode == DisplayImmediately)    if (dispMode == DisplayImmediately)
     TtaSetDisplayMode (context->doc, DeferredDisplay);      TtaSetDisplayMode (context->doc, DeferredDisplay);
   
   while (*cssRule != EOS)    while (*cssRule != WC_EOS)
     {      {
       cssRule = SkipBlanksAndComments (cssRule);        cssRule = SkipWCBlanksAndComments (cssRule);
               
       found = FALSE;        found = FALSE;
       /* look for the type of property */        /* look for the type of property */
       for (i = 0; i < NB_CSSSTYLEATTRIBUTE && !found; i++)        for (i = 0; i < NB_CSSSTYLEATTRIBUTE && !found; i++)
         {          {
           lg = strlen (CSSProperties[i].name);            lg = ustrlen (CSSProperties[i].name);
           if (!strncasecmp (cssRule, CSSProperties[i].name, lg))            if (!ustrncasecmp (cssRule, CSSProperties[i].name, lg))
             {              {
               cssRule += lg;                cssRule += lg;
               found = TRUE;                found = TRUE;
Line 3391  ThotBool            isHTML; Line 3391  ThotBool            isHTML;
       else        else
         {          {
           /* update index and skip the ":" indicator if present */            /* update index and skip the ":" indicator if present */
           cssRule = SkipBlanksAndComments (cssRule);            cssRule = SkipWCBlanksAndComments (cssRule);
           if (*cssRule == ':')            if (*cssRule == TEXT(':'))
             {              {
               cssRule++;                cssRule++;
               cssRule = SkipBlanksAndComments (cssRule);                cssRule = SkipWCBlanksAndComments (cssRule);
             }              }
           /* try to parse the attribute associated to this attribute */            /* try to parse the attribute associated to this attribute */
           if (CSSProperties[i].parsing_function != NULL)            if (CSSProperties[i].parsing_function != NULL)
Line 3406  ThotBool            isHTML; Line 3406  ThotBool            isHTML;
             }              }
         }          }
       /* next property */        /* next property */
       cssRule = SkipBlanksAndComments (cssRule);        cssRule = SkipWCBlanksAndComments (cssRule);
       if (*cssRule == ',' || *cssRule == ';')        if (*cssRule == TEXT(',') || *cssRule == TEXT(';'))
         {          {
           cssRule++;            cssRule++;
           cssRule = SkipBlanksAndComments (cssRule);            cssRule = SkipWCBlanksAndComments (cssRule);
         }          }
     }      }
   
Line 3430  ThotBool            isHTML; Line 3430  ThotBool            isHTML;
   described in thotlib/include/presentation.h    described in thotlib/include/presentation.h
  -----------------------------------------------------------------------*/   -----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 void                 PToCss (PresentationSetting settings, char* buffer, int len)  void                 PToCss (PresentationSetting settings, CHAR_T* buffer, int len)
 #else  #else
 void                 PToCss (settings, buffer, len)  void                 PToCss (settings, buffer, len)
 PresentationSetting  settings;  PresentationSetting  settings;
 char*                param;  CHAR_T*                param;
 int                  len  int                  len
 #endif  #endif
 {  {
Line 3444  int                  len Line 3444  int                  len
   unsigned int        unit, i;    unsigned int        unit, i;
   ThotBool            real = FALSE;    ThotBool            real = FALSE;
   
   buffer[0] = EOS;    buffer[0] = WC_EOS;
   if (len < 40)    if (len < 40)
     return;      return;
   
Line 3464  int                  len Line 3464  int                  len
       switch (settings->value.typed_data.value)        switch (settings->value.typed_data.value)
         {          {
         case STYLE_FONT_HELVETICA:          case STYLE_FONT_HELVETICA:
           strcpy (buffer, "font-family: helvetica");            ustrcpy (buffer, TEXT("font-family: helvetica"));
           break;            break;
         case STYLE_FONT_TIMES:          case STYLE_FONT_TIMES:
           strcpy (buffer, "font-family: times");            ustrcpy (buffer, TEXT("font-family: times"));
           break;            break;
         case STYLE_FONT_COURIER:          case STYLE_FONT_COURIER:
           strcpy (buffer, "font-family: courier");            ustrcpy (buffer, TEXT("font-family: courier"));
           break;            break;
         }          }
       break;        break;
Line 3478  int                  len Line 3478  int                  len
       switch (settings->value.typed_data.value)        switch (settings->value.typed_data.value)
         {          {
         case STYLE_FONT_ROMAN:          case STYLE_FONT_ROMAN:
           strcpy (buffer, "font-style: normal");            ustrcpy (buffer, TEXT("font-style: normal"));
           break;            break;
         case STYLE_FONT_ITALICS:          case STYLE_FONT_ITALICS:
           strcpy (buffer, "font-style: italic");            ustrcpy (buffer, TEXT("font-style: italic"));
           break;            break;
         case STYLE_FONT_OBLIQUE:          case STYLE_FONT_OBLIQUE:
           strcpy (buffer, "font-style: oblique");            ustrcpy (buffer, TEXT("font-style: oblique"));
           break;            break;
         }          }
       break;        break;
Line 3492  int                  len Line 3492  int                  len
       switch (settings->value.typed_data.value)        switch (settings->value.typed_data.value)
         {          {
         case STYLE_WEIGHT_BOLD:          case STYLE_WEIGHT_BOLD:
           strcpy (buffer, "font-weight: bold");            ustrcpy (buffer, TEXT("font-weight: bold"));
           break;            break;
         case STYLE_WEIGHT_NORMAL:          case STYLE_WEIGHT_NORMAL:
           strcpy (buffer, "font-weight: normal");            ustrcpy (buffer, TEXT("font-weight: normal"));
           break;            break;
         }          }
       break;        break;
Line 3504  int                  len Line 3504  int                  len
         {          {
           if (real)            if (real)
             {              {
               sprintf (buffer, "font-size: %g", fval);                usprintf (buffer, TEXT("font-size: %g"), fval);
               add_unit = 1;                add_unit = 1;
             }              }
           else            else
             switch (settings->value.typed_data.value)              switch (settings->value.typed_data.value)
               {                {
               case 1:                case 1:
                 strcpy (buffer, "font-size: xx-small");                  ustrcpy (buffer, TEXT("font-size: xx-small"));
                 break;                  break;
               case 2:                case 2:
                 strcpy (buffer, "font-size: x-small");                  ustrcpy (buffer, TEXT("font-size: x-small"));
                 break;                  break;
               case 3:                case 3:
                 strcpy (buffer, "font-size: small");                  ustrcpy (buffer, TEXT("font-size: small"));
                 break;                  break;
               case 4:                case 4:
                 strcpy (buffer, "font-size: medium");                  ustrcpy (buffer, TEXT("font-size: medium"));
                 break;                  break;
               case 5:                case 5:
                 strcpy (buffer, "font-size: large");                  ustrcpy (buffer, TEXT("font-size: large"));
                 break;                  break;
               case 6:                case 6:
                 strcpy (buffer, "font-size: x-large");                  ustrcpy (buffer, TEXT("font-size: x-large"));
                 break;                  break;
               case 7:                case 7:
               case 8:                case 8:
Line 3534  int                  len Line 3534  int                  len
               case 10:                case 10:
               case 11:                case 11:
               case 12:                case 12:
                 strcpy (buffer, "font-size: xx-large");                  ustrcpy (buffer, TEXT("font-size: xx-large"));
                 break;                  break;
               }                }
         }          }
       else        else
         {          {
           if (real)            if (real)
             sprintf (buffer, "font-size: %g", fval);              usprintf (buffer, TEXT("font-size: %g"), fval);
           else            else
             sprintf (buffer, "font-size: %d", settings->value.typed_data.value);              usprintf (buffer, TEXT("font-size: %d"), settings->value.typed_data.value);
           add_unit = 1;            add_unit = 1;
         }          }
       break;        break;
Line 3551  int                  len Line 3551  int                  len
       switch (settings->value.typed_data.value)        switch (settings->value.typed_data.value)
         {          {
         case STYLE_UNDERLINE:          case STYLE_UNDERLINE:
           strcpy (buffer, "text-decoration: underline");            ustrcpy (buffer, TEXT("text-decoration: underline"));
           break;            break;
         case STYLE_OVERLINE:          case STYLE_OVERLINE:
           strcpy (buffer, "text-decoration: overline");            ustrcpy (buffer, TEXT("text-decoration: overline"));
           break;            break;
         case STYLE_CROSSOUT:          case STYLE_CROSSOUT:
           strcpy (buffer, "text-decoration: line-through");            ustrcpy (buffer, TEXT("text-decoration: line-through"));
           break;            break;
         }          }
       break;        break;
     case PRIndent:      case PRIndent:
       if (real)        if (real)
         sprintf (buffer, "text-indent: %g", fval);          usprintf (buffer, TEXT("text-indent: %g"), fval);
       else        else
         sprintf (buffer, "text-indent: %d", settings->value.typed_data.value);          usprintf (buffer, TEXT("text-indent: %d"), settings->value.typed_data.value);
       add_unit = 1;        add_unit = 1;
       break;        break;
     case PRLineSpacing:      case PRLineSpacing:
       if (real)        if (real)
         sprintf (buffer, "line-height: %g", fval);          usprintf (buffer, TEXT("line-height: %g"), fval);
       else        else
         sprintf (buffer, "line-height: %d", settings->value.typed_data.value);          usprintf (buffer, TEXT("line-height: %d"), settings->value.typed_data.value);
       add_unit = 1;        add_unit = 1;
       break;        break;
     case PRJustify:      case PRJustify:
       if (settings->value.typed_data.value == STYLE_JUSTIFIED)        if (settings->value.typed_data.value == STYLE_JUSTIFIED)
         sprintf (buffer, "text-align: justify");          usprintf (buffer, TEXT("text-align: justify"));
       break;        break;
     case PRAdjust:      case PRAdjust:
       switch (settings->value.typed_data.value)        switch (settings->value.typed_data.value)
         {          {
         case STYLE_ADJUSTLEFT:          case STYLE_ADJUSTLEFT:
           strcpy (buffer, "text-align: left");            ustrcpy (buffer, TEXT("text-align: left"));
           break;            break;
         case STYLE_ADJUSTRIGHT:          case STYLE_ADJUSTRIGHT:
           strcpy (buffer, "text-align: right");            ustrcpy (buffer, TEXT("text-align: right"));
           break;            break;
         case STYLE_ADJUSTCENTERED:          case STYLE_ADJUSTCENTERED:
           strcpy (buffer, "text-align: center");            ustrcpy (buffer, TEXT("text-align: center"));
           break;            break;
         case STYLE_ADJUSTLEFTWITHDOTS:          case STYLE_ADJUSTLEFTWITHDOTS:
           strcpy (buffer, "text-align: left");            ustrcpy (buffer, TEXT("text-align: left"));
           break;            break;
         }          }
       break;        break;
Line 3602  int                  len Line 3602  int                  len
       break;        break;
     case PRBackground:      case PRBackground:
       TtaGiveThotRGB (settings->value.typed_data.value, &red, &green, &blue);        TtaGiveThotRGB (settings->value.typed_data.value, &red, &green, &blue);
       sprintf (buffer, "background-color: #%02X%02X%02X", red, green, blue);        usprintf (buffer, TEXT("background-color: #%02X%02X%02X"), red, green, blue);
       break;        break;
     case PRForeground:      case PRForeground:
       TtaGiveThotRGB (settings->value.typed_data.value, &red, &green, &blue);        TtaGiveThotRGB (settings->value.typed_data.value, &red, &green, &blue);
       sprintf (buffer, "color: #%02X%02X%02X", red, green, blue);        usprintf (buffer, TEXT("color: #%02X%02X%02X"), red, green, blue);
       break;        break;
     case PRMarginTop:      case PRMarginTop:
       if (real)        if (real)
         sprintf (buffer, "marging-top: %g", fval);          usprintf (buffer, TEXT("marging-top: %g"), fval);
       else        else
         sprintf (buffer, "marging-top: %d", settings->value.typed_data.value);          usprintf (buffer, TEXT("marging-top: %d"), settings->value.typed_data.value);
       add_unit = 1;        add_unit = 1;
       break;        break;
     case PRMarginLeft:      case PRMarginLeft:
       if (real)        if (real)
         sprintf (buffer, "margin-left: %g", fval);          usprintf (buffer, TEXT("margin-left: %g"), fval);
       else        else
         sprintf (buffer, "margin-left: %d", settings->value.typed_data.value);          usprintf (buffer, TEXT("margin-left: %d"), settings->value.typed_data.value);
       add_unit = 1;        add_unit = 1;
       break;        break;
     case PRHeight:      case PRHeight:
       if (real)        if (real)
         sprintf (buffer, "height: %g", fval);          usprintf (buffer, TEXT("height: %g"), fval);
       else        else
         sprintf (buffer, "height: %d", settings->value.typed_data.value);          usprintf (buffer, TEXT("height: %d"), settings->value.typed_data.value);
       add_unit = 1;        add_unit = 1;
       break;        break;
     case PRWidth:      case PRWidth:
       if (real)        if (real)
         sprintf (buffer, "width: %g", fval);          usprintf (buffer, TEXT("width: %g"), fval);
       else        else
         sprintf (buffer, "width: %d", settings->value.typed_data.value);          usprintf (buffer, TEXT("width: %d"), settings->value.typed_data.value);
       add_unit = 1;        add_unit = 1;
       break;        break;
     case PRLine:      case PRLine:
       if (settings->value.typed_data.value == STYLE_INLINE)        if (settings->value.typed_data.value == STYLE_INLINE)
         strcpy (buffer, "display: inline");          ustrcpy (buffer, TEXT("display: inline"));
       else if (settings->value.typed_data.value == STYLE_NOTINLINE)        else if (settings->value.typed_data.value == STYLE_NOTINLINE)
         strcpy (buffer, "display: block");          ustrcpy (buffer, TEXT("display: block"));
       break;        break;
     case PRBackgroundPicture:      case PRBackgroundPicture:
       if (settings->value.pointer != NULL)        if (settings->value.pointer != NULL)
         sprintf (buffer, "background-image: url(%s)", (char*)(settings->value.pointer));          usprintf (buffer, TEXT("background-image: url(%s)"), (char*)(settings->value.pointer));
       else        else
         sprintf (buffer, "background-image: none");          usprintf (buffer, TEXT("background-image: none"));
       break;        break;
     case PRPictureMode:      case PRPictureMode:
       switch (settings->value.typed_data.value)        switch (settings->value.typed_data.value)
         {          {
         case STYLE_REALSIZE:          case STYLE_REALSIZE:
           sprintf (buffer, "background-repeat: no-repeat");            usprintf (buffer, TEXT("background-repeat: no-repeat"));
           break;            break;
         case STYLE_REPEAT:          case STYLE_REPEAT:
           sprintf (buffer, "background-repeat: repeat");            usprintf (buffer, TEXT("background-repeat: repeat"));
           break;            break;
         case STYLE_VREPEAT:          case STYLE_VREPEAT:
           sprintf (buffer, "background-repeat: repeat-y");            usprintf (buffer, TEXT("background-repeat: repeat-y"));
           break;            break;
         case STYLE_HREPEAT:          case STYLE_HREPEAT:
           sprintf (buffer, "background-repeat: repeat-x");            usprintf (buffer, TEXT("background-repeat: repeat-x"));
           break;            break;
         }          }
       break;        break;
Line 3676  int                  len Line 3676  int                  len
         {          {
           if (CSSUnitNames[i].unit == unit)            if (CSSUnitNames[i].unit == unit)
             {              {
               strcat (buffer, CSSUnitNames[i].sign);                ustrcat (buffer, CSSUnitNames[i].sign);
               break;                break;
             }              }
         }          }
Line 3689  int                  len Line 3689  int                  len
    element.     element.
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 void                ParseHTMLSpecificStyle (Element el, char* cssRule, Document doc, ThotBool destroy)  void                ParseHTMLSpecificStyle (Element el, CHAR_T* cssRule, Document doc, ThotBool destroy)
 #else  #else
 void                ParseHTMLSpecificStyle (el, cssRule, doc, destroy)  void                ParseHTMLSpecificStyle (el, cssRule, doc, destroy)
 Element             elem;  Element             elem;
 char*               cssRule;  CHAR_T*             cssRule;
 Document            doc;  Document            doc;
 ThotBool            destroy;  ThotBool            destroy;
 #endif  #endif
Line 3724  ThotBool            destroy; Line 3724  ThotBool            destroy;
    return the end of the selector string to be handled or NULL      return the end of the selector string to be handled or NULL 
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 static char*   ParseGenericSelector (char* selector, char* cssRule,  static CHAR_T*   ParseGenericSelector (CHAR_T* selector, CHAR_T* cssRule,
                            GenericContext ctxt, Document doc, CSSInfoPtr css)                             GenericContext ctxt, Document doc, CSSInfoPtr css)
 #else  #else
 static char*   ParseGenericSelector (selector, cssRule, ctxt, doc, css)  static CHAR_T*   ParseGenericSelector (selector, cssRule, ctxt, doc, css)
 char*          selector;  CHAR_T*          selector;
 char*          cssRule;  CHAR_T*          cssRule;
 GenericContext  ctxt;  GenericContext  ctxt;
 Document        doc;  Document        doc;
 CSSInfoPtr      css;  CSSInfoPtr      css;
Line 3750  CSSInfoPtr      css; Line 3750  CSSInfoPtr      css;
   int                 i, j, k, max, maxAttr;    int                 i, j, k, max, maxAttr;
   ThotBool            isHTML;    ThotBool            isHTML;
   
   sel[0] = EOS;    sel[0] = WC_EOS;
   for (i = 0; i < MAX_ANCESTORS; i++)    for (i = 0; i < MAX_ANCESTORS; i++)
     {      {
       names[i] = NULL;        names[i] = NULL;
Line 3768  CSSInfoPtr      css; Line 3768  CSSInfoPtr      css;
   ctxt->box = 0;    ctxt->box = 0;
   ctxt->type = 0;    ctxt->type = 0;
       
   selector = SkipBlanksAndComments (selector);    selector = SkipWCBlanksAndComments (selector);
   cur = &sel[0];    cur = &sel[0];
   max = 0; /* number of loops */    max = 0; /* number of loops */
   while (1)    while (1)
Line 3776  CSSInfoPtr      css; Line 3776  CSSInfoPtr      css;
       deb = cur;        deb = cur;
       /* copy an item of the selector into sel[] */        /* copy an item of the selector into sel[] */
       /* put one word in the sel buffer */        /* put one word in the sel buffer */
       while (*selector != EOS && *selector != ',' &&        while (*selector != WC_EOS && *selector != TEXT(',') &&
              *selector != '.' && *selector != ':' &&               *selector != TEXT('.') && *selector != TEXT(':') &&
              *selector != '#' && !TtaIsBlank (selector))               *selector != TEXT('#') && !TtaIsWCBlank (selector))
         *cur++ = *selector++;              *cur++ = *selector++;
       *cur++ = EOS; /* close the first string  in sel[] */        *cur++ = WC_EOS; /* close the first string  in sel[] */
       if (deb[0] != EOS)        if (deb[0] != WC_EOS)
         names[0] = deb;          names[0] = deb;
       else        else
         names[0] = NULL;          names[0] = NULL;
Line 3793  CSSInfoPtr      css; Line 3793  CSSInfoPtr      css;
   
       /* now names[0] points to the beginning of the parsed item        /* now names[0] points to the beginning of the parsed item
          and cur to the next chain to be parsed */           and cur to the next chain to be parsed */
       if (*selector == ':' || *selector == '.' || *selector == '#')        if (*selector == TEXT(':') || *selector == TEXT('.') || *selector == TEXT('#'))
         /* keep the element name which precedes the id or          /* keep the element name which precedes the id or
          pseudo class or the class */           pseudo class or the class */
         deb = cur;          deb = cur;
   
       if (*selector == '.')        if (*selector == TEXT('.'))
         {          {
           /* copy into sel[] the class */            /* copy into sel[] the class */
           classes[0] = cur;            classes[0] = cur;
           selector++;            selector++;
           while (*selector != EOS && *selector != ',' &&            while (*selector != WC_EOS && *selector != TEXT(',') &&
                  *selector != '.' && *selector != ':' &&                   *selector != TEXT('.') && *selector != TEXT(':') &&
                  !TtaIsBlank (selector))                   !TtaIsWCBlank (selector))
             *cur++ = *selector++;              *cur++ = *selector++;
           *cur++ = EOS;            *cur++ = WC_EOS;
         }          }
       else if (*selector == ':')        else if (*selector == TEXT(':'))
         {          {
           /* copy into sel[] the pseudoclass */            /* copy into sel[] the pseudoclass */
           pseudoclasses[0]= cur;            pseudoclasses[0]= cur;
           selector++;            selector++;
           while (*selector != EOS && *selector != ',' &&            while (*selector != WC_EOS && *selector != TEXT(',') &&
                  *selector != '.' && *selector != ':' &&               *selector != TEXT('.') && *selector != TEXT(':') &&
                  !TtaIsBlank (selector))               !TtaIsWCBlank (selector))
             *cur++ = *selector++;              *cur++ = *selector++;
           *cur++ = EOS;            *cur++ = WC_EOS;
         }          }
       else if (*selector == '#')        else if (*selector == TEXT('#'))
         {          {
           /* copy into sel[] the attribute */            /* copy into sel[] the attribute */
           ids[0] = cur;            ids[0] = cur;
           selector++;            selector++;
           while (*selector != EOS && *selector != ',' &&            while (*selector != WC_EOS && *selector != TEXT(',') &&
                  *selector != '.' && *selector != ':' &&               *selector != TEXT('.') && *selector != TEXT(':') &&
                  !TtaIsBlank (selector))               !TtaIsWCBlank (selector))
             *cur++ = *selector++;              *cur++ = *selector++;
           *cur++ = EOS;            *cur++ = WC_EOS;
         }          }
       else if (*selector == '[')        else if (*selector == TEXT('['))
         {          {
           /* copy into sel[] the attribute */            /* copy into sel[] the attribute */
           attrs[0] = cur;            attrs[0] = cur;
           selector++;            selector++;
           while (*selector != EOS && *selector != ']' && *selector != '=')            while (*selector != WC_EOS && *selector != TEXT(']') && *selector != TEXT('='))
             *cur++ = *selector++;              *cur++ = *selector++;
           if (*cur == '=')            if (*cur == TEXT('='))
             {              {
               /* there is a value "xxxx" */                /* there is a value "xxxx" */
               *cur++ = EOS;                *cur++ = WC_EOS;
               while (*selector != EOS && *selector != ']' && *selector != '"')                while (*selector != WC_EOS && *selector != TEXT(']') && *selector != TEXT('"'))
                 selector++;                  selector++;
               if (*selector != EOS)                if (*selector != WC_EOS)
                 {                  {
                   /* we are now parsing the attribute value */                    /* we are now parsing the attribute value */
                   attrvals[0] = cur;                    attrvals[0] = cur;
                   selector++;                    selector++;
                   while (*selector != EOS && *selector != '"')                    while (*selector != WC_EOS && *selector != TEXT('"'))
                     *cur++ = *selector++;                      *cur++ = *selector++;
                   if (*selector != EOS)                    if (*selector != WC_EOS)
                     selector++;                      selector++;
                 }                  }
             }              }
           *cur++ = EOS;            *cur++ = WC_EOS;
         }          }
   
       selector = SkipBlanksAndComments (selector);        selector = SkipWCBlanksAndComments (selector);
   
       /* is it a multi-level selector? */        /* is it a multi-level selector? */
       if (*selector == EOS)        if (*selector == WC_EOS)
         /* end of the selector */          /* end of the selector */
         break;          break;
       else if (*selector == ',')        else if (*selector == TEXT(','))
         {          {
           /* end of the current selector */            /* end of the current selector */
           selector++;            selector++;
Line 4017  CSSInfoPtr      css; Line 4017  CSSInfoPtr      css;
    e.g: pinky, awful { color: pink, font-family: helvetica }             e.g: pinky, awful { color: pink, font-family: helvetica }        
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 static void         ParseStyleDeclaration (Element el, char* cssRule, Document doc, CSSInfoPtr css, ThotBool destroy)  static void         ParseStyleDeclaration (Element el, CHAR_T* cssRule, Document doc, CSSInfoPtr css, ThotBool destroy)
 #else  #else
 static void         ParseStyleDeclaration (el, cssRule, doc, css, destroy)  static void         ParseStyleDeclaration (el, cssRule, doc, css, destroy)
 Element             el;  Element             el;
Line 4027  CSSInfoPtr          css; Line 4027  CSSInfoPtr          css;
 ThotBool            destroy;  ThotBool            destroy;
 #endif  #endif
 {  {
   GenericContext      ctxt;    GenericContext        ctxt;
   char*               decl_end;    CHAR_T*               decl_end;
   char*               sel_end;    CHAR_T*               sel_end;
   char*               selector;    CHAR_T*               selector;
   char                saved1;    CHAR_T                saved1;
   char                saved2;    CHAR_T                saved2;
   
   /* separate the selectors string */    /* separate the selectors string */
   cssRule = SkipBlanksAndComments (cssRule);    cssRule = SkipWCBlanksAndComments (cssRule);
   decl_end = cssRule;    decl_end = cssRule;
   while ((*decl_end != EOS) && (*decl_end != '{'))    while ((*decl_end != WC_EOS) && (*decl_end != TEXT('{')))
     decl_end++;      decl_end++;
   if (*decl_end == EOS)    if (*decl_end == WC_EOS)
     return;      return;
   /* verify and clean the selector string */    /* verify and clean the selector string */
   sel_end = decl_end - 1;    sel_end = decl_end - 1;
   while (*sel_end == SPACE || *sel_end == BSPACE ||    while (*sel_end == WC_SPACE || *sel_end == WC_BSPACE ||
          *sel_end == EOL || *sel_end == __CR__)           *sel_end == WC_EOL || *sel_end == WC_CR)
     sel_end--;      sel_end--;
   sel_end++;    sel_end++;
   saved1 = *sel_end;    saved1 = *sel_end;
   *sel_end = EOS;    *sel_end = WC_EOS;
   selector = cssRule;    selector = cssRule;
   
   /* now, deal with the content ... */    /* now, deal with the content ... */
   decl_end++;    decl_end++;
   cssRule = decl_end;    cssRule = decl_end;
   while (*decl_end != EOS && *decl_end != '}')    while (*decl_end != WC_EOS && *decl_end != TEXT('}'))
     decl_end++;      decl_end++;
   if (*decl_end == EOS)    if (*decl_end == WC_EOS)
     {      {
       fprintf (stderr, "Invalid STYLE declaration : %s\n", cssRule);        fprintf (stderr, "Invalid STYLE declaration : %s\n", cssRule);
       return;        return;
     }      }
   saved2 = *decl_end;    saved2 = *decl_end;
   *decl_end = EOS;    *decl_end = WC_EOS;
   
   /*    /*
    * parse the style attribute string and install the corresponding     * parse the style attribute string and install the corresponding
Line 4073  ThotBool            destroy; Line 4073  ThotBool            destroy;
     return;      return;
   ctxt->destroy = destroy;    ctxt->destroy = destroy;
   
   while ((selector != NULL) && (*selector != EOS))    while ((selector != NULL) && (*selector != WC_EOS))
     selector = ParseGenericSelector (selector, cssRule, ctxt, doc, css);      selector = ParseGenericSelector (selector, cssRule, ctxt, doc, css);
   TtaFreeMemory (ctxt);    TtaFreeMemory (ctxt);
   
Line 4094  ThotBool            destroy; Line 4094  ThotBool            destroy;
    or an HTML context name.                                           or an HTML context name.                                      
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 int                 IsImplicitClassName (char* class, Document doc)  int                 IsImplicitClassName (CHAR_T* class, Document doc)
 #else  #else
 int                 IsImplicitClassName (class, doc)  int                 IsImplicitClassName (class, doc)
 char*               class;  CHAR_T*             class;
 Document            doc;  Document            doc;
 #endif  #endif
 {  {
    char             name[200];     CHAR_T           name[200];
    char*            cur = name;     CHAR_T*          cur = name;
    char*            first;      CHAR_T*          first; 
    char             save;     CHAR_T           save;
    SSchema          schema;     SSchema          schema;
   
    /* make a local copy */     /* make a local copy */
    strncpy (name, class, 199);     ustrncpy (name, class, 199);
    name[199] = 0;     name[199] = 0;
   
    /* loop looking if each word is a GI */     /* loop looking if each word is a GI */
Line 4124  Document            doc; Line 4124  Document            doc;
              return (0);               return (0);
           }            }
         *cur = save;          *cur = save;
         cur = SkipBlanksAndComments (cur);          cur = SkipWCBlanksAndComments (cur);
      }       }
    return (1);     return (1);
 }  }
Line 4139  Document            doc; Line 4139  Document            doc;
    HTMLSetBackgroundColor :     HTMLSetBackgroundColor :
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 void                HTMLSetBackgroundColor (Document doc, Element el, char* color)  void                HTMLSetBackgroundColor (Document doc, Element el, CHAR_T* color)
 #else  #else
 void                HTMLSetBackgroundColor (doc, el, color)  void                HTMLSetBackgroundColor (doc, el, color)
 Document            doc;  Document            doc;
 Element             el;  Element             el;
 char*               color;  CHAR_T*             color;
 #endif  #endif
 {  {
    char             css_command[100];     CHAR_T             css_command[100];
   
    sprintf (css_command, "background-color: %s", color);     usprintf (css_command, TEXT("background-color: %s"), color);
    ParseHTMLSpecificStyle (el, css_command, doc, FALSE);     ParseHTMLSpecificStyle (el, css_command, doc, FALSE);
 }  }
   
Line 4159  char*               color; Line 4159  char*               color;
    image = url of background image     image = url of background image
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 void                HTMLSetBackgroundImage (Document doc, Element el, int repeat, char* image)  void                HTMLSetBackgroundImage (Document doc, Element el, int repeat, CHAR_T* image)
 #else  #else
 void                HTMLSetBackgroundImage (doc, el, repeat, image)  void                HTMLSetBackgroundImage (doc, el, repeat, image)
 Document            doc;  Document            doc;
 Element             el;  Element             el;
 int                 repeat;  int                 repeat;
 char*               image;  CHAR_T*             image;
 #endif  #endif
 {  {
    char             css_command[400];     CHAR_T           css_command[400];
   
    /******* check buffer overflow ********/     /******* check buffer overflow ********/
    sprintf (css_command, "background-image: url(%s); background-repeat: ", image);     usprintf (css_command, TEXT("background-image: url(%s); background-repeat: "), image);
    if (repeat == STYLE_REPEAT)     if (repeat == STYLE_REPEAT)
      strcat (css_command, "repeat");       ustrcat (css_command, TEXT("repeat"));
    else if (repeat == STYLE_HREPEAT)     else if (repeat == STYLE_HREPEAT)
      strcat (css_command, "repeat-x");       ustrcat (css_command, TEXT("repeat-x"));
    else if (repeat == STYLE_VREPEAT)     else if (repeat == STYLE_VREPEAT)
      strcat (css_command, "repeat-y");       ustrcat (css_command, TEXT("repeat-y"));
    else     else
      strcat (css_command, "no-repeat");       ustrcat (css_command, TEXT("no-repeat"));
    ParseHTMLSpecificStyle (el, css_command, doc, FALSE);     ParseHTMLSpecificStyle (el, css_command, doc, FALSE);
 }  }
   
Line 4187  char*               image; Line 4187  char*               image;
    HTMLSetForegroundColor :                                             HTMLSetForegroundColor :                                        
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 void                HTMLSetForegroundColor (Document doc, Element el, char* color)  void                HTMLSetForegroundColor (Document doc, Element el, CHAR_T* color)
 #else  #else
 void                HTMLSetForegroundColor (doc, el, color)  void                HTMLSetForegroundColor (doc, el, color)
 Document            doc;  Document            doc;
 Element             el;  Element             el;
 char*               color;  CHAR_T*             color;
 #endif  #endif
 {  {
    char             css_command[100];     CHAR_T           css_command[100];
   
    sprintf (css_command, "color: %s", color);     usprintf (css_command, TEXT("color: %s"), color);
    ParseHTMLSpecificStyle (el, css_command, doc, FALSE);     ParseHTMLSpecificStyle (el, css_command, doc, FALSE);
 }  }
   
Line 4212  Document            doc; Line 4212  Document            doc;
 Element             el;  Element             el;
 #endif  #endif
 {  {
    char             css_command[100];     CHAR_T           css_command[100];
   
    sprintf (css_command, "background: red");     usprintf (css_command, TEXT("background: red"));
    ParseHTMLSpecificStyle (el, css_command, doc, TRUE);     ParseHTMLSpecificStyle (el, css_command, doc, TRUE);
 }  }
   
Line 4229  Document            doc; Line 4229  Document            doc;
 Element             el;  Element             el;
 #endif  #endif
 {  {
    char             css_command[1000];     CHAR_T           css_command[1000];
   
    sprintf (css_command, "background-image: url(xx); background-repeat: repeat");     usprintf (css_command, TEXT("background-image: url(xx); background-repeat: repeat"));
    ParseHTMLSpecificStyle (el, css_command, doc, TRUE);     ParseHTMLSpecificStyle (el, css_command, doc, TRUE);
 }  }
   
Line 4246  Document            doc; Line 4246  Document            doc;
 Element             el;  Element             el;
 #endif  #endif
 {  {
    char             css_command[100];     CHAR_T           css_command[100];
   
    /* it's not necessary to well know the current color but it must be valid */     /* it's not necessary to well know the current color but it must be valid */
    sprintf (css_command, "color: red");     usprintf (css_command, TEXT("color: red"));
    ParseHTMLSpecificStyle (el, css_command, doc, TRUE);     ParseHTMLSpecificStyle (el, css_command, doc, TRUE);
 }  }
   
Line 4257  Element             el; Line 4257  Element             el;
    HTMLSetAlinkColor :                                                  HTMLSetAlinkColor :                                             
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 void                HTMLSetAlinkColor (Document doc, char* color)  void                HTMLSetAlinkColor (Document doc, CHAR_T* color)
 #else  #else
 void                HTMLSetAlinkColor (doc, color)  void                HTMLSetAlinkColor (doc, color)
 Document            doc;  Document            doc;
 char*               color;  CHAR_T*             color;
 #endif  #endif
 {  {
    char             css_command[100];     CHAR_T           css_command[100];
   
    sprintf (css_command, "a:link { color : %s }", color);     usprintf (css_command, TEXT("a:link { color : %s }"), color);
    ApplyCSSRules (NULL, css_command, doc, FALSE);     ApplyCSSRules (NULL, css_command, doc, FALSE);
 }  }
   
Line 4274  char*               color; Line 4274  char*               color;
    HTMLSetAactiveColor :                                                HTMLSetAactiveColor :                                           
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 void                HTMLSetAactiveColor (Document doc, char* color)  void                HTMLSetAactiveColor (Document doc, CHAR_T* color)
 #else  #else
 void                HTMLSetAactiveColor (doc, color)  void                HTMLSetAactiveColor (doc, color)
 Document            doc;  Document            doc;
 char*               color;  CHAR_T*             color;
 #endif  #endif
 {  {
    char             css_command[100];     CHAR_T           css_command[100];
   
    sprintf (css_command, "a:active { color : %s }", color);     usprintf (css_command, TEXT("a:active { color : %s }"), color);
    ApplyCSSRules (NULL, css_command, doc, FALSE);     ApplyCSSRules (NULL, css_command, doc, FALSE);
 }  }
   
Line 4291  char*               color; Line 4291  char*               color;
    HTMLSetAvisitedColor :                                               HTMLSetAvisitedColor :                                          
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 void                HTMLSetAvisitedColor (Document doc, char* color)  void                HTMLSetAvisitedColor (Document doc, CHAR_T* color)
 #else  #else
 void                HTMLSetAvisitedColor (doc, color)  void                HTMLSetAvisitedColor (doc, color)
 Document            doc;  Document            doc;
 char*               color;  CHAR_T*             color;
 #endif  #endif
 {  {
    char             css_command[100];     CHAR_T           css_command[100];
   
    sprintf (css_command, "a:visited { color : %s }", color);     usprintf (css_command, TEXT("a:visited { color : %s }"), color);
    ApplyCSSRules (NULL, css_command, doc, FALSE);     ApplyCSSRules (NULL, css_command, doc, FALSE);
 }  }
   
Line 4314  void                HTMLResetAlinkColor Line 4314  void                HTMLResetAlinkColor
 Document            doc;  Document            doc;
 #endif  #endif
 {  {
    char             css_command[100];     CHAR_T           css_command[100];
   
    sprintf (css_command, "a:link { color : red }");     usprintf (css_command, TEXT("a:link { color : red }"));
    ApplyCSSRules (NULL, css_command, doc, TRUE);     ApplyCSSRules (NULL, css_command, doc, TRUE);
 }  }
   
Line 4330  void                HTMLResetAactiveColo Line 4330  void                HTMLResetAactiveColo
 Document            doc;  Document            doc;
 #endif  #endif
 {  {
    char             css_command[100];     CHAR_T           css_command[100];
   
    sprintf (css_command, "a:active { color : red }");     usprintf (css_command, TEXT("a:active { color : red }"));
    ApplyCSSRules (NULL, css_command, doc, TRUE);     ApplyCSSRules (NULL, css_command, doc, TRUE);
 }  }
   
Line 4346  void                HTMLResetAvisitedCol Line 4346  void                HTMLResetAvisitedCol
 Document            doc;  Document            doc;
 #endif  #endif
 {  {
    char             css_command[100];     CHAR_T           css_command[100];
   
    sprintf (css_command, "a:visited { color : red }");     usprintf (css_command, TEXT("a:visited { color : red }"));
    ApplyCSSRules (NULL, css_command, doc, TRUE);     ApplyCSSRules (NULL, css_command, doc, TRUE);
 }  }
   
Line 4357  Document            doc; Line 4357  Document            doc;
   header of a HTML document.    header of a HTML document.
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 void                ApplyCSSRules (Element el, char* cssRule, Document doc, ThotBool destroy)  void                ApplyCSSRules (Element el, CHAR_T* cssRule, Document doc, ThotBool destroy)
 #else  #else
 void                ApplyCSSRules (el, cssRule, doc, destroy)  void                ApplyCSSRules (el, cssRule, doc, destroy)
 Element             el;  Element             el;
 char*               cssRule;  CHAR_T*             cssRule;
 Document            doc;  Document            doc;
 ThotBool            destroy;  ThotBool            destroy;
 #endif  #endif
Line 4395  ThotBool            destroy; Line 4395  ThotBool            destroy;
    structure and content have to be registered in the Undo queue or not     structure and content have to be registered in the Undo queue or not
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 char                ReadCSSRules (Document docRef, CSSInfoPtr css, char* buffer, ThotBool withUndo)  CHAR_T              ReadCSSRules (Document docRef, CSSInfoPtr css, CHAR_T* buffer, ThotBool withUndo)
 #else  #else
 char                ReadCSSRules (docRef, css, buffer, withUndo)  CHAR_T              ReadCSSRules (docRef, css, buffer, withUndo)
 Document            docRef;  Document            docRef;
 CSSInfoPtr          css;  CSSInfoPtr          css;
 char*               buffer;  CHAR_T*             buffer;
 ThotBool            withUndo;  ThotBool            withUndo;
 #endif  #endif
 {  {
   char                c;    CHAR_T              c;
   char                *cssRule, *base;    CHAR_T              *cssRule, *base;
   DisplayMode         dispMode;    DisplayMode         dispMode;
   int                 index;    int                 index;
   int                 CSSindex;    int                 CSSindex;
Line 4427  ThotBool            withUndo; Line 4427  ThotBool            withUndo;
   import = MAX_CSS_LENGTH;    import = MAX_CSS_LENGTH;
   eof = FALSE;    eof = FALSE;
   openRule = 0;    openRule = 0;
   c = SPACE;    c = WC_SPACE;
   index = 0;    index = 0;
   /* avoid too many redisplay */    /* avoid too many redisplay */
   dispMode = TtaGetDisplayMode (docRef);    dispMode = TtaGetDisplayMode (docRef);
Line 4440  ThotBool            withUndo; Line 4440  ThotBool            withUndo;
   if (css == NULL)    if (css == NULL)
     css = AddCSS (docRef, docRef, CSS_DOCUMENT_STYLE, NULL, NULL);      css = AddCSS (docRef, docRef, CSS_DOCUMENT_STYLE, NULL, NULL);
   
   while (CSSindex < MAX_CSS_LENGTH && c != EOS && !eof)    while (CSSindex < MAX_CSS_LENGTH && c != EOS && !eof) {
     {          c = buffer[index++];
       c = buffer[index++];          eof = (c == WC_EOS);
       eof = (c == EOS);          CSSbuffer[CSSindex] = c;
       CSSbuffer[CSSindex] = c;          if (CSScomment == MAX_CSS_LENGTH || c == TEXT('*') || c == TEXT('/') || c == TEXT('<')) {
       if (CSScomment == MAX_CSS_LENGTH || c == '*' || c == '/' || c == '<')             /* we're not within a comment or we're parsing * or / */
         {             switch (c) {
           /* we're not within a comment or we're parsing * or / */                    case TEXT('@'): /* perhaps an import primitive */
           switch (c)                         import = CSSindex;
             {                         break;
             case '@':                    case TEXT(';'):
               /* perhaps an import primitive */                         if (import != MAX_CSS_LENGTH && !media) { 
               import = CSSindex;                            if (ustrncasecmp (&CSSbuffer[import+1], TEXT("import"), 6))
               break;                               /* it's not an import */
             case ';':                               import = MAX_CSS_LENGTH;
               if (import != MAX_CSS_LENGTH && !media)                           /* save the text */
                 {                           noRule = TRUE;
                   if (strncasecmp (&CSSbuffer[import+1], "import", 6))                         }
                     /* it's not an import */                         break;
                     import = MAX_CSS_LENGTH;                    case TEXT('*'):
                   /* save the text */                         if (CSScomment == MAX_CSS_LENGTH && CSSindex > 0 && CSSbuffer[CSSindex - 1] == TEXT('/'))
                   noRule = TRUE;                            /* start a comment */
                 }                            CSScomment = CSSindex - 1;
               break;                         break;
             case '*':                    case TEXT('/'):
               if (CSScomment == MAX_CSS_LENGTH &&                         if (CSSindex > 1 && CSScomment != MAX_CSS_LENGTH && CSSbuffer[CSSindex - 1] == TEXT('*')) {
                   CSSindex > 0 && CSSbuffer[CSSindex - 1] == '/')                            /* close a comment:and ignore its contents */
                 /* start a comment */                            CSSindex = CSScomment - 1; /* will be incremented later */
                 CSScomment = CSSindex - 1;                            CSScomment = MAX_CSS_LENGTH;
               break;                         } else if (CSScomment == MAX_CSS_LENGTH && CSSindex > 0 && CSSbuffer[CSSindex - 1] ==  TEXT('<')) {
             case '/':                                /* this is the closing tag ! */
               if (CSSindex > 1 &&                                CSSindex -= 2; /* remove </ from the CSS string */
                   CSScomment != MAX_CSS_LENGTH &&                                noRule = TRUE;
                   CSSbuffer[CSSindex - 1] == '*')                         } 
                 {                         break;
                   /* close a comment:and ignore its contents */                    case TEXT('<'):
                   CSSindex = CSScomment - 1; /* will be incremented later */                         if (CSScomment == MAX_CSS_LENGTH) {
                   CSScomment = MAX_CSS_LENGTH;                            /* only if we're not parsing a comment */
                 }                            c = buffer[index++];
               else if (CSScomment == MAX_CSS_LENGTH &&                            eof = (c == WC_EOS);
                        CSSindex > 0 &&                            if (c == TEXT('!')) {
                        CSSbuffer[CSSindex - 1] ==  '<')                               /* CSS within an HTML comment */
                 {                               HTMLcomment = TRUE;
                   /* this is the closing tag ! */                               CSSindex++;
                   CSSindex -= 2; /* remove </ from the CSS string */                               CSSbuffer[CSSindex] = c;
                   noRule = TRUE;                            } else if (c == WC_EOS)
                 }                                   CSSindex++;
               break;                         }
             case '<':                         break;
               if (CSScomment == MAX_CSS_LENGTH)                    case TEXT('-'):
                 {                         if (CSSindex > 0 && CSSbuffer[CSSindex - 1] == TEXT('-') && HTMLcomment)
                   /* only if we're not parsing a comment */                            /* CSS within an HTML comment */
                   c = buffer[index++];                            noRule = TRUE;
                   eof = (c == EOS);                         break;
                   if (c == '!')                    case TEXT('>'):
                     {                         if (HTMLcomment)
                       /* CSS within an HTML comment */                            noRule = TRUE;
                       HTMLcomment = TRUE;                         break;
                       CSSindex++;                    case TEXT(' '):
                       CSSbuffer[CSSindex] = c;                         if (import != MAX_CSS_LENGTH && openRule == 0)
                     }                            media = !ustrncmp (&CSSbuffer[import+1], TEXT("media"), 5);
                   else if (c == EOS)                         break;
                     CSSindex++;                    case TEXT('{'):
                 }                         openRule++;
               break;                         if (import != MAX_CSS_LENGTH && openRule == 1 && media) {
             case '-':                            /* is it the screen concerned? */
               if (CSSindex > 0 && CSSbuffer[CSSindex - 1] == '-' && HTMLcomment)                            CSSbuffer[CSSindex+1] = WC_EOS;
                 /* CSS within an HTML comment */                            if (TtaIsPrinting ())
                 noRule = TRUE;                               base = ustrstr (&CSSbuffer[import], TEXT("print"));
               break;                            else
             case '>':                                 base = ustrstr (&CSSbuffer[import], TEXT("screen"));
               if (HTMLcomment)                            if (base == NULL)
                 noRule = TRUE;                               ignoreMedia = TRUE;
               break;                            noRule = TRUE;
             case ' ':                         }
               if (import != MAX_CSS_LENGTH && openRule == 0)                         break;
                 media = !strncmp (&CSSbuffer[import+1], "media", 5);                    case TEXT('}'):
               break;                         openRule--;
             case '{':                         if (import != MAX_CSS_LENGTH && openRule == 0) {
               openRule++;                            import = MAX_CSS_LENGTH;
               if (import != MAX_CSS_LENGTH && openRule == 1 && media)                            noRule = TRUE;
                 {                            ignoreMedia = FALSE;
                   /* is it the screen concerned? */                            media = FALSE;
                   CSSbuffer[CSSindex+1] = EOS;                         } else
                   if (TtaIsPrinting ())                                toParse = TRUE;
                     base = strstr (&CSSbuffer[import], "print");                         break;
                   else                    default:
                     base = strstr (&CSSbuffer[import], "screen");                         break;
                   if (base == NULL)             }
                     ignoreMedia = TRUE;          }    
                   noRule = TRUE;          if (c != WC_CR)
                 }             CSSindex++;
               break;  
             case '}':          if (CSSindex >= MAX_CSS_LENGTH && CSScomment < MAX_CSS_LENGTH)
               openRule--;             /* we're still parsing a comment: remove the text comment */
               if (import != MAX_CSS_LENGTH && openRule == 0)             CSSindex = CSScomment;
                 {  
                   import = MAX_CSS_LENGTH;          if (CSSindex >= MAX_CSS_LENGTH || toParse || noRule) {
                   noRule = TRUE;             CSSbuffer[CSSindex] = WC_EOS;
                   ignoreMedia = FALSE;             /* parse a not empty string */
                   media = FALSE;             if (CSSindex > 0) {
                 }                /* apply CSS rule if it's not just a saving of text */
               else                if (!noRule && !ignoreMedia)
                 toParse = TRUE;                   ParseStyleDeclaration (NULL, CSSbuffer, docRef, css, FALSE);
               break;                else if (import != MAX_CSS_LENGTH && !ustrncasecmp (&CSSbuffer[import+1], TEXT("import"), 6)) {
             default:                     /* import section */
               break;                     cssRule = &CSSbuffer[import+7];
             }                     cssRule = TtaSkipWCBlanks (cssRule);
         }                     if (!ustrncasecmp (cssRule, TEXT("url"), 3)) {
       if (c != __CR__)                        cssRule = &cssRule[3];
         CSSindex++;                        cssRule = TtaSkipWCBlanks (cssRule);
                         if (*cssRule == TEXT('(')) {
       if (CSSindex >= MAX_CSS_LENGTH && CSScomment < MAX_CSS_LENGTH)                           cssRule++;
         /* we're still parsing a comment: remove the text comment */                           cssRule = TtaSkipWCBlanks (cssRule);
         CSSindex = CSScomment;                           base = cssRule;
                            while (*cssRule != WC_EOS && *cssRule != TEXT(')'))
       if  (CSSindex >= MAX_CSS_LENGTH || toParse || noRule)                                  cssRule++;
         {                           *cssRule = WC_EOS;
           CSSbuffer[CSSindex] = EOS;                           LoadStyleSheet (base, docRef, NULL, css, css->media[docRef]);
           /* parse a not empty string */                        }
           if (CSSindex > 0)                     }
             {                     /*** Caution: Strings can either be written with double quotes or
               /* apply CSS rule if it's not just a saving of text */                          with single quotes. Only double quotes are handled here.
               if (!noRule && !ignoreMedia)                          Escaped quotes are not handled. See function SkipQuotedString */
                 ParseStyleDeclaration (NULL, CSSbuffer, docRef, css, FALSE);                     else if (*cssRule == TEXT('"')) {
               else if (import != MAX_CSS_LENGTH &&                          cssRule++;
                        !strncasecmp (&CSSbuffer[import+1], "import", 6))                          base = cssRule;
                 {                          while (*cssRule != WC_EOS && *cssRule != TEXT('"'))
                   /* import section */                                cssRule++;
                   cssRule = &CSSbuffer[import+7];                          *cssRule = WC_EOS;
                   cssRule = TtaSkipBlanks (cssRule);                          LoadStyleSheet (base, docRef, NULL, css, css->media[docRef]);
                   if (!strncasecmp (cssRule, "url", 3))                     }
                     {                     import = MAX_CSS_LENGTH;
                       cssRule = &cssRule[3];                }
                       cssRule = TtaSkipBlanks (cssRule);             }
                       if (*cssRule == '(')             toParse = FALSE;
                         {             noRule = FALSE;
                           cssRule++;             CSSindex = 0;
                           cssRule = TtaSkipBlanks (cssRule);          }
                           base = cssRule;    }
                           while (*cssRule != EOS && *cssRule != ')')  
                             cssRule++;  
                           *cssRule = EOS;  
                           LoadStyleSheet (base, docRef, NULL, css, css->media[docRef]);  
                         }  
                     }  
                   /*** Caution: Strings can either be written with double quotes or  
                        with single quotes. Only double quotes are handled here.  
                        Escaped quotes are not handled. See function SkipQuotedString */  
                   else if (*cssRule == '"')  
                     {  
                       cssRule++;  
                       base = cssRule;  
                       while (*cssRule != EOS && *cssRule != '"')  
                         cssRule++;  
                       *cssRule = EOS;  
                       LoadStyleSheet (base, docRef, NULL, css, css->media[docRef]);  
                     }  
                   import = MAX_CSS_LENGTH;  
                 }  
             }  
           toParse = FALSE;  
           noRule = FALSE;  
           CSSindex = 0;  
         }  
     }  
   /* restore the display mode */    /* restore the display mode */
   if (dispMode == DisplayImmediately)    if (dispMode == DisplayImmediately)
     TtaSetDisplayMode (docRef, dispMode);       TtaSetDisplayMode (docRef, dispMode);
   return (c);    return (c);
 }  }

Removed from v.1.49  
changed lines
  Added in v.1.50


Webmaster