Diff for /Amaya/amaya/styleparser.c between versions 1.117 and 1.118

version 1.117, 2002/03/04 15:12:25 version 1.118, 2002/03/06 12:28:21
Line 3909  static char *ParseGenericSelector (char Line 3909  static char *ParseGenericSelector (char
   PSchema            tsch;    PSchema            tsch;
   /*AttributeType    attrType;*/    /*AttributeType    attrType;*/
   char               sel[MAX_ANCESTORS * 50];    char               sel[MAX_ANCESTORS * 50];
   char              *deb, *cur;    char              *deb, *cur, c;
   char              *structName;    char              *schemaName, *mappedName;
   char              *names[MAX_ANCESTORS];    char              *names[MAX_ANCESTORS];
   char              *ids[MAX_ANCESTORS];    char              *ids[MAX_ANCESTORS];
   char              *classes[MAX_ANCESTORS];    char              *classes[MAX_ANCESTORS];
Line 3920  static char *ParseGenericSelector (char Line 3920  static char *ParseGenericSelector (char
   char              *ptr;    char              *ptr;
   int                i, j, k, max;    int                i, j, k, max;
   int                att, maxAttr;    int                att, maxAttr;
   int                specificity;    int                specificity, xmlType;
   ThotBool           isHTML;    ThotBool           isHTML;
   ThotBool           level;    ThotBool           level;
   
Line 3956  static char *ParseGenericSelector (char Line 3956  static char *ParseGenericSelector (char
       /* put one word in the sel buffer */        /* put one word in the sel buffer */
       while (*selector != EOS && *selector != ',' &&        while (*selector != EOS && *selector != ',' &&
              *selector != '.' && *selector != ':' &&               *selector != '.' && *selector != ':' &&
              *selector != '#' && !TtaIsBlank (selector))               *selector != '#' && *selector != '[' &&
                !TtaIsBlank (selector))
             *cur++ = *selector++;              *cur++ = *selector++;
       *cur++ = EOS; /* close the first string  in sel[] */        *cur++ = EOS; /* close the first string  in sel[] */
       if (deb[0] != EOS)        if (deb[0] != EOS)
Line 3974  static char *ParseGenericSelector (char Line 3975  static char *ParseGenericSelector (char
   
       /* 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 == ':' || *selector == '.' ||
             *selector == '#' || *selector == '[')
         /* point to the following word in sel[] */          /* point to the following word in sel[] */
         deb = cur;          deb = cur;
   
Line 4031  static char *ParseGenericSelector (char Line 4033  static char *ParseGenericSelector (char
         {          {
           selector++;            selector++;
           while (*selector != EOS && *selector != ',' &&            while (*selector != EOS && *selector != ',' &&
              *selector != '.' && *selector != ':' &&                   *selector != '.' && *selector != ':' &&
              !TtaIsBlank (selector))                   !TtaIsBlank (selector))
             *cur++ = *selector++;              *cur++ = *selector++;
           /* close the word */            /* close the word */
           *cur++ = EOS;            *cur++ = EOS;
Line 4070  static char *ParseGenericSelector (char Line 4072  static char *ParseGenericSelector (char
           if (*selector == '=')            if (*selector == '=')
             {              {
               /* look for a value "xxxx" */                /* look for a value "xxxx" */
               while (*selector != EOS && *selector != ']' && *selector != '"')                selector++;
                 *cur++ = *selector++;                if (*selector != '"')
               /* there is a value */  
               if (*selector == EOS)  
                 {                  {
                   CSSParseError ("Invalid attribute value", deb);                    CSSParseError ("Invalid attribute value", deb);
                   DoApply = FALSE;                    DoApply = FALSE;
Line 4081  static char *ParseGenericSelector (char Line 4081  static char *ParseGenericSelector (char
               else                else
                 {                  {
                   /* we are now parsing the attribute value */                    /* we are now parsing the attribute value */
                   attrvals[0] = cur;  
                   selector++;                    selector++;
                   while (*selector != EOS && *selector != '"')                    deb = cur;
                     *cur++ = *selector++;                    while (*selector != '"')
                   if (*selector != EOS)                      {
                     selector++;                        if (*selector == EOS)
                           {
                             CSSParseError ("Invalid attribute value", deb);
                             DoApply = FALSE;
                           }
                         else
                           *cur++ = *selector++;
                       }
                     /* there is a value */
                     if (*selector == '"')
                       {
                         *selector++;
                         *cur++ = EOS;
                         attrvals[0] = deb;
                       }
                 }                  }
             }              }
           *cur++ = EOS;            /* end of the attribute */
             if (*selector != ']')
               {
                 CSSParseError ("Invalid attribute", attrs[0]);
                 DoApply = FALSE;
               }
             else
               selector++;
         }          }
   
       selector = SkipBlanksAndComments (selector);        selector = SkipBlanksAndComments (selector);
Line 4133  static char *ParseGenericSelector (char Line 4153  static char *ParseGenericSelector (char
     {      {
       if (names[i])        if (names[i])
         {          {
           /* get the new element type of this name */            /* get the element type of this name in the current document */
           GIType (names[i], &elType, doc);            elType.ElSSchema = TtaGetDocumentSSchema (doc);
             schemaName = TtaGetSSchemaName(elType.ElSSchema);
             if (!strcmp (schemaName, "HTML"))
               xmlType = XHTML_TYPE;
             else if (!strcmp (schemaName, "MathML"))
               xmlType = MATH_TYPE;
             else if (!strcmp (schemaName, "SVG"))
               xmlType = SVG_TYPE;
             else if (!strcmp (schemaName, "MathML"))
               xmlType = XLINK_TYPE;
             else
               xmlType = XML_TYPE;
             MapXMLElementType (xmlType, names[i], &elType, &mappedName, &c, &level, doc);
           if (i == 0)            if (i == 0)
             {              {
               /* Store the element type */  
 #ifdef XML_GENERIC  
               if (elType.ElSSchema == NULL)                if (elType.ElSSchema == NULL)
                 {                  {
                   /* Search in the list of loaded genereric schemas */                    /* Search in the list of loaded genereric schemas */
                   TtaGetXmlElementType (names[i], &elType, NULL, doc);                    TtaGetXmlElementType (names[i], &elType, NULL, doc);
                   if (elType.ElSSchema == NULL)  #ifdef XML_GENERIC
                     if (elType.ElSSchema == NULL &&
                         strcmp (schemaName, "HTML") &&
                         strcmp (schemaName, "MathML") &&
                         strcmp (schemaName, "SVG") &&
                         strcmp (schemaName, "XLink") &&
                         strcmp (schemaName, "Annot"))
                     {                      {
                       char *mappedName, *schemaName;  
                       /* Creation of a new element type in the main schema */                        /* Creation of a new element type in the main schema */
                       elType.ElSSchema = TtaGetDocumentSSchema (doc);                        elType.ElSSchema = TtaGetDocumentSSchema (doc);
                       schemaName = TtaGetSSchemaName(elType.ElSSchema);                        TtaAppendXmlElement (names[i], &elType, &mappedName, doc);
                       if (strcmp (schemaName, "HTML") &&  
                           strcmp (schemaName, "MathML") &&  
                           strcmp (schemaName, "SVG") &&  
                           strcmp (schemaName, "XLink") &&  
                           strcmp (schemaName, "Annot"))  
                         TtaAppendXmlElement (names[i], &elType,  
                                              &mappedName, doc);  
                     }                      }
                 }  
 #endif /* XML_GENERIC */  #endif /* XML_GENERIC */
               ctxt->type = elType.ElTypeNum;                  }
               ctxt->name[0] = elType.ElTypeNum;                if (elType.ElSSchema == NULL)
               ctxt->names_nb[0] = 0;                  /* cannot apply these CSS rules */
               ctxt->schema = elType.ElSSchema;                  DoApply = FALSE;
               ptr = TtaGetSSchemaName (elType.ElSSchema);                else
                   {
                     /* Store the element type */
                     ctxt->type = elType.ElTypeNum;
                     ctxt->name[0] = elType.ElTypeNum;
                     ctxt->names_nb[0] = 0;
                     ctxt->schema = elType.ElSSchema;
                     ptr = TtaGetSSchemaName (elType.ElSSchema);
                   }
             }              }
           else if (elType.ElTypeNum != 0)            else if (elType.ElTypeNum != 0)
             {              {
Line 4296  static char *ParseGenericSelector (char Line 4331  static char *ParseGenericSelector (char
   /* Get the schema name of the main element */    /* Get the schema name of the main element */
   if (ctxt->schema != NULL)    if (ctxt->schema != NULL)
     {      {
       isHTML = (strcmp (TtaGetSSchemaName (ctxt->schema), "HTML") == 0);        schemaName = TtaGetSSchemaName (ctxt->schema);
         isHTML = (strcmp (schemaName, "HTML") == 0);
       tsch = GetPExtension (doc, ctxt->schema, css);        tsch = GetPExtension (doc, ctxt->schema, css);
       structName = TtaGetSSchemaName (ctxt->schema);  
       if (tsch && cssRule)        if (tsch && cssRule)
         ParseCSSRule (NULL, tsch, (PresentationContext) ctxt, cssRule, css, isHTML);          ParseCSSRule (NULL, tsch, (PresentationContext) ctxt, cssRule, css, isHTML);
     }      }

Removed from v.1.117  
changed lines
  Added in v.1.118


Webmaster