Diff for /rpl/src/simplification.c between versions 1.73 and 1.74

version 1.73, 2019/11/11 13:16:25 version 1.74, 2019/11/14 18:54:48
Line 141  transcription_arbre(struct_processus *s_ Line 141  transcription_arbre(struct_processus *s_
   
     // Ajout des fonctions      // Ajout des fonctions
   
       if ((*s_arbre).nombre_branches != 0)
       {
           free((*s_arbre).branches);
       }
   
     l_liste = (*s_arbre).feuille;      l_liste = (*s_arbre).feuille;
 uprintf("avant free %p\n", s_arbre->branches);  
     free((*s_arbre).branches);  
 uprintf("après free %p\n", s_arbre->branches);  
     free(s_arbre);      free(s_arbre);
   
     // Chaînage des arguments      // Chaînage des arguments
Line 225  ordonnancement_branches(const void *a1, Line 227  ordonnancement_branches(const void *a1,
 }  }
   
   
   static int
   ordonnancement_instructions_neg(const void *a1, const void *a2)
   {
       struct_arbre    **_a1;
   
       _a1 = (struct_arbre **) a1;
   
       if ((**_a1).feuille != NULL)
       {
           // On rejette NEG à la fin de l'arbre.
   
           if ((*(*(**_a1).feuille).donnee).type == FCT)
           {
               if (strcmp((*((struct_fonction *) (*(*(**_a1).feuille).donnee)
                       .objet)).nom_fonction, "NEG") == 0)
               {
                   return(1);
               }
               else
               {
                   return(-1);
               }
           }
           else
           {
               return(0);
           }
       }
   
       return(0);
   }
   
   
 static void  static void
 simplification_arbre(struct_processus *s_etat_processus,  simplification_arbre(struct_processus *s_etat_processus,
         struct_arbre *s_arbre)          struct_arbre *s_arbre)
Line 335  simplification_arbre(struct_processus *s Line 370  simplification_arbre(struct_processus *s
     if (strcmp((*((struct_fonction *) (*(*(*s_arbre).feuille).donnee).objet))      if (strcmp((*((struct_fonction *) (*(*(*s_arbre).feuille).donnee).objet))
             .nom_fonction, "+") == 0)              .nom_fonction, "+") == 0)
     {      {
           qsort((*s_arbre).branches, (size_t) (*s_arbre)
                   .nombre_branches, sizeof(struct_arbre *),
                   ordonnancement_instructions_neg);
   
         for(i = 0; i < (*s_arbre).nombre_branches; i++)          for(i = 0; i < (*s_arbre).nombre_branches; i++)
         {          {
             s_objet = (*((*((*s_arbre).branches[i])).feuille)).donnee;              s_objet = (*((*((*s_arbre).branches[i])).feuille)).donnee;

Removed from v.1.73  
changed lines
  Added in v.1.74


CVSweb interface <joel.bertrand@systella.fr>