Diff for /rpl/src/analyse_notation_algebrique.c between versions 1.44 and 1.56

version 1.44, 2013/03/21 16:31:58 version 1.56, 2015/01/05 15:32:11
Line 1 Line 1
 /*  /*
 ================================================================================  ================================================================================
   RPL/2 (R) version 4.1.13    RPL/2 (R) version 4.1.20
   Copyright (C) 1989-2013 Dr. BERTRAND Joël    Copyright (C) 1989-2015 Dr. BERTRAND Joël
   
   This file is part of RPL/2.    This file is part of RPL/2.
   
Line 116  analyse_algebrique(struct_processus *s_e Line 116  analyse_algebrique(struct_processus *s_e
   
         if (chaine_algebrique[i] == '"')          if (chaine_algebrique[i] == '"')
         {          {
             presence_chaine = (presence_chaine == d_faux) ? d_vrai : d_faux;              if (chaine_algebrique[i - 1] != '\\')
               {
                   presence_chaine = (presence_chaine == d_faux) ? d_vrai : d_faux;
               }
         }          }
         else if (presence_chaine == d_faux)          else if (presence_chaine == d_faux)
         {          {
Line 177  analyse_algebrique(struct_processus *s_e Line 180  analyse_algebrique(struct_processus *s_e
     {      {
         if ((*ptr1) == '"')          if ((*ptr1) == '"')
         {          {
             if (presence_chaine == d_faux)              if (ptr1 != chaine_travail)
             {              { // Il existe un caractère précédent.
                 presence_chaine = d_vrai;                  if ((*(ptr1 - 1)) != '\\')
                   {
                       if (presence_chaine == d_faux)
                       {
                           presence_chaine = d_vrai;
                       }
                       else
                       {
                           presence_chaine = d_faux;
                       }
                   }
             }              }
             else              else
             {              { // Il n'existe pas de caractère précédent.
                 presence_chaine = d_faux;                  if (presence_chaine == d_faux)
                   {
                       presence_chaine = d_vrai;
                   }
                   else
                   {
                       presence_chaine = d_faux;
                   }
             }              }
         }          }
   
Line 221  analyse_algebrique(struct_processus *s_e Line 241  analyse_algebrique(struct_processus *s_e
                     for(i = 0; i < 4; (*(ptr2++)) = (*(ptr1++)), i++);                      for(i = 0; i < 4; (*(ptr2++)) = (*(ptr1++)), i++);
                     (*(ptr2++)) = (*ptr1);                      (*(ptr2++)) = (*ptr1);
                 }                  }
                 else if ((strncmp(instruction_majuscule, " OR ", 4) == 0) &&                  else if (strcmp(instruction_majuscule, " EQV ") == 0)
                         (strlen(instruction_majuscule) == 4))                  {
                       for(i = 0; i < 4; (*(ptr2++)) = (*(ptr1++)), i++);
                       (*(ptr2++)) = (*ptr1);
                   }
                   else if ((strcmp(instruction_majuscule, " OR ") == 0))
                 {                  {
                     for(i = 0; i < 3; (*(ptr2++)) = (*(ptr1++)), i++);                      for(i = 0; i < 3; (*(ptr2++)) = (*(ptr1++)), i++);
                     (*(ptr2++)) = (*ptr1);                      (*(ptr2++)) = (*ptr1);
Line 268  analyse_algebrique(struct_processus *s_e Line 292  analyse_algebrique(struct_processus *s_e
                 }                  }
                 else if (chaine_travail[i] == '"')                  else if (chaine_travail[i] == '"')
                 {                  {
                     presence_chaine = (presence_chaine == d_vrai)                      if (i > 0)
                             ? d_faux : d_vrai;                      {
                           if (chaine_travail[i - 1] != '\\')
                           {
                               presence_chaine = (presence_chaine == d_vrai)
                                       ? d_faux : d_vrai;
                           }
                       }
                       else
                       {
                           presence_chaine = (presence_chaine == d_vrai)
                                   ? d_faux : d_vrai;
                       }
                 }                  }
   
                 i++;                  i++;
Line 306  analyse_algebrique(struct_processus *s_e Line 341  analyse_algebrique(struct_processus *s_e
   
                 if (chaine_travail[j] == '"')                  if (chaine_travail[j] == '"')
                 {                  {
                     presence_chaine = (presence_chaine == d_vrai)                      if (j > 0)
                             ? d_faux : d_vrai;                      {
                           if (chaine_travail[j - 1] != '\\')
                           {
                               presence_chaine = (presence_chaine == d_vrai)
                                       ? d_faux : d_vrai;
                           }
                       }
                       else
                       {
                           presence_chaine = (presence_chaine == d_vrai)
                                   ? d_faux : d_vrai;
                       }
                 }                  }
   
                 j++;                  j++;
Line 358  analyse_algebrique(struct_processus *s_e Line 404  analyse_algebrique(struct_processus *s_e
                 {                  {
                     if (chaine_centrale[i] == '"')                      if (chaine_centrale[i] == '"')
                     {                      {
                         presence_chaine = (presence_chaine == d_faux)                          if (i > 0)
                                 ? d_vrai : d_faux;                          {
                               if (chaine_centrale[i - 1] != '\\')
                               {
                                   presence_chaine = (presence_chaine == d_faux)
                                           ? d_vrai : d_faux;
                               }
                           }
                           else
                           {
                               presence_chaine = (presence_chaine == d_faux)
                                       ? d_vrai : d_faux;
                           }
   
                         if (i == 1)                          if (i == 1)
                         {                          {
Line 976  analyse_algebrique(struct_processus *s_e Line 1033  analyse_algebrique(struct_processus *s_e
                                 drapeau_modification = d_vrai;                                  drapeau_modification = d_vrai;
                             }                              }
                             else if (((priorite == 1) && (t4 == ' ') &&                              else if (((priorite == 1) && (t4 == ' ') &&
                                     (t3 == 'X') && (t2 == 'O') && (t1 == 'R')                                      (((t3 == 'X') && (t2 == 'O') && (t1 == 'R'))
                                     && (t0 == ' ')) || ((priorite == 2) &&                                      || ((t3 == 'E') && (t2 == 'Q') &&
                                       (t1 == 'V'))) && (t0 == ' '))
                                       || ((priorite == 2) &&
                                     (t4 == ' ') && (t3 == 'A') && (t2 == 'N')                                      (t4 == ' ') && (t3 == 'A') && (t2 == 'N')
                                     && (t1 == 'D') && (t0 == ' ')))                                      && (t1 == 'D') && (t0 == ' ')))
                             {                              {
Line 1166  test_expression_rpn(unsigned char *chain Line 1225  test_expression_rpn(unsigned char *chain
         if (chaine[i - 1] == '"')          if (chaine[i - 1] == '"')
         {          {
             i++;              i++;
             while(chaine[i - 1] != '"')              while(!((chaine[i - 1] == '"') && (chaine[i - 2] != '\\')))
             {              {
                 i++;                  i++;
             }              }
Line 1220  test_expression_rpn(unsigned char *chain Line 1279  test_expression_rpn(unsigned char *chain
                 || ((t0 == ' ') && ((t1 == 'A') || (t1 == 'a')) &&                  || ((t0 == ' ') && ((t1 == 'A') || (t1 == 'a')) &&
                 ((t2 == 'N') || (t2 == 'n')) && ((t3 == 'D') || (t3 == 'd'))                  ((t2 == 'N') || (t2 == 'n')) && ((t3 == 'D') || (t3 == 'd'))
                 && (t4 == ' ')) ||                  && (t4 == ' ')) ||
                   ((t0 == ' ') && ((t1 == 'E') || (t1 == 'e')) &&
                   ((t2 == 'Q') || (t2 == 'q')) && ((t3 == 'V') || (t3 == 'v'))
                   && (t4 == ' ')) ||
                 ((t0 == ' ') && ((t1 == 'O') || (t1 == 'o')) &&                  ((t0 == ' ') && ((t1 == 'O') || (t1 == 'o')) &&
                 ((t2 == 'R') || (t2 == 'r')) && (t3 == ' ')) ||                  ((t2 == 'R') || (t2 == 'r')) && (t3 == ' ')) ||
                 ((t0 == ' ') && ((t1 == 'X') || (t1 == 'x')) &&                  ((t0 == ' ') && ((t1 == 'X') || (t1 == 'x')) &&
Line 1315  extraction_chaine(unsigned char *chaine, Line 1377  extraction_chaine(unsigned char *chaine,
     unsigned char           *sous_chaine;      unsigned char           *sous_chaine;
   
     if ((position_1 < 1) || (position_2 < position_1) ||      if ((position_1 < 1) || (position_2 < position_1) ||
             (position_1 > ((integer8) strlen(chaine))))              (position_2 > ((integer8) strlen(chaine))))
     {  
         if ((sous_chaine = (unsigned char *) malloc(sizeof(unsigned char)))  
                 == NULL)  
         {  
             return(NULL);  
         }  
   
         (*sous_chaine) = d_code_fin_chaine;  
         return(sous_chaine);  
     }  
   
     if (position_2 > ((integer8) strlen(chaine)))  
     {      {
         if ((sous_chaine = (unsigned char *) malloc(sizeof(unsigned char)))          if ((sous_chaine = (unsigned char *) malloc(sizeof(unsigned char)))
                 == NULL)                  == NULL)

Removed from v.1.44  
changed lines
  Added in v.1.56


CVSweb interface <joel.bertrand@systella.fr>