Diff for /rpl/src/gestion_variables.c between versions 1.71 and 1.76

version 1.71, 2013/03/22 15:31:19 version 1.76, 2013/04/02 11:56:33
Line 1 Line 1
 /*  /*
 ================================================================================  ================================================================================
   RPL/2 (R) version 4.1.13    RPL/2 (R) version 4.1.14
   Copyright (C) 1989-2013 Dr. BERTRAND Joël    Copyright (C) 1989-2013 Dr. BERTRAND Joël
   
   This file is part of RPL/2.    This file is part of RPL/2.
Line 1531  retrait_variables_par_niveau(struct_proc Line 1531  retrait_variables_par_niveau(struct_proc
                 break;                  break;
             }              }
   
               if (((*s_etat_processus).at_exit != NULL) &&
                       ((*s_etat_processus).niveau_courant == 0))
               {
                   // Il y a une routine ATEXIT enregistrée. On ne détruit pas
                   // les variables globales qui pourraient y être utilisées.
   
                   break;
               }
   
             while((*(*s_etat_processus).l_liste_variables_par_niveau).liste              while((*(*s_etat_processus).l_liste_variables_par_niveau).liste
                     != NULL)                      != NULL)
             {              {
Line 1697  liberation_arbre_variables(struct_proces Line 1706  liberation_arbre_variables(struct_proces
         do          do
         {          {
             l_element_suivant = (*l_element_courant).suivant;              l_element_suivant = (*l_element_courant).suivant;
               free((*(*l_element_courant).variable).nom);
               liberation(s_etat_processus, (*(*l_element_courant)
                       .variable).objet);
             liberation_feuille(s_etat_processus, l_element_courant);              liberation_feuille(s_etat_processus, l_element_courant);
             l_element_courant = l_element_suivant;              l_element_courant = l_element_suivant;
         } while(l_element_courant != (*arbre).feuille);          } while(l_element_courant != (*arbre).feuille);
Line 1863  nombre_variables_partagees(struct_proces Line 1875  nombre_variables_partagees(struct_proces
         return(0);          return(0);
     }      }
   
       // Mutex deverrouillé par liste_variables_partagees();
     if (pthread_mutex_lock(&((*l_element_courant).mutex_feuille)) != 0)      if (pthread_mutex_lock(&((*l_element_courant).mutex_feuille)) != 0)
     {      {
         (*s_etat_processus).erreur_systeme = d_es_processus;          (*s_etat_processus).erreur_systeme = d_es_processus;
Line 1953  liste_variables_locales(struct_processus Line 1966  liste_variables_locales(struct_processus
   
     if (l_element_courant == NULL)      if (l_element_courant == NULL)
     {      {
         return(0);          return(position);
     }      }
   
     if ((*l_element_courant).feuille != NULL)      if ((*l_element_courant).feuille != NULL)
Line 1973  liste_variables_locales(struct_processus Line 1986  liste_variables_locales(struct_processus
             tableau[position].variable_partagee =              tableau[position].variable_partagee =
                     (*(*l_variable).variable).variable_partagee;                      (*(*l_variable).variable).variable_partagee;
             tableau[position].variable_masquee = d_faux;              tableau[position].variable_masquee = d_faux;
               tableau[position].mutex = NULL;
   
             position++;              position++;
   
             l_variable = (*l_variable).suivant;              l_variable = (*l_variable).suivant;
         } while(l_variable != (*l_element_courant).feuille);          } while(l_variable != (*l_element_courant).feuille);
     }      }
Line 1991  liste_variables_locales(struct_processus Line 2006  liste_variables_locales(struct_processus
                 tableau[position].nom = (*(*l_variable_statique).variable).nom;                  tableau[position].nom = (*(*l_variable_statique).variable).nom;
                 tableau[position].niveau =                  tableau[position].niveau =
                         (*(*l_variable_statique).variable).niveau;                          (*(*l_variable_statique).variable).niveau;
                 tableau[position].objet =                  tableau[position].objet = (*(*l_variable_statique).variable)
                         (*(*l_variable_statique).variable).objet;                          .objet;
                 tableau[position].variable_verrouillee = d_faux;                  tableau[position].variable_verrouillee = d_faux;
                 tableau[position].variable_statique =                  tableau[position].variable_statique =
                         (*(*l_variable_statique).variable).variable_statique;                          (*(*l_variable_statique).variable).variable_statique;
Line 2030  liste_variables_partagees(struct_process Line 2045  liste_variables_partagees(struct_process
   
     if (l_element_courant == NULL)      if (l_element_courant == NULL)
     {      {
         return(0);          return(position);
     }      }
   
     // mutex_liste_variables_partagees  
     // et (*l_variable_courante).mutex_feuille  
     if ((*l_element_courant).feuille != NULL)      if ((*l_element_courant).feuille != NULL)
     {      {
         l_variable = (*l_element_courant).feuille;          l_variable = (*l_element_courant).feuille;
Line 2048  liste_variables_partagees(struct_process Line 2061  liste_variables_partagees(struct_process
             tableau[position].variable_verrouillee = d_faux;              tableau[position].variable_verrouillee = d_faux;
             tableau[position].variable_partagee =              tableau[position].variable_partagee =
                     (*(*l_variable).variable).variable_partagee;                      (*(*l_variable).variable).variable_partagee;
             tableau[position].variable_partagee.pointeur = NULL;              tableau[position].variable_statique.pointeur = NULL;
             tableau[position].variable_masquee = d_faux;              tableau[position].variable_masquee = d_faux;
               tableau[position].mutex = &((*(*l_variable).variable).mutex);
               pthread_mutex_lock(tableau[position].mutex);
   
             position++;              position++;
   
Line 2066  liste_variables_partagees(struct_process Line 2081  liste_variables_partagees(struct_process
         }          }
     }      }
   
       // Mutex verrouillé par nombre_variables_partagees();
       if (pthread_mutex_unlock(&((*l_element_courant).mutex_feuille)) != 0)
       {
           (*s_etat_processus).erreur_systeme = d_es_processus;
           return(0);
       }
   
     return(position);      return(position);
 }  }
   
Line 2102  liste_variables(struct_processus *s_etat Line 2124  liste_variables(struct_processus *s_etat
   
     nombre_elements = liste_variables_locales(s_etat_processus,      nombre_elements = liste_variables_locales(s_etat_processus,
             tableau, 0, (*s_etat_processus).s_arbre_variables);              tableau, 0, (*s_etat_processus).s_arbre_variables);
     nombre_elements += liste_variables_partagees(s_etat_processus,      nombre_elements = liste_variables_partagees(s_etat_processus,
             tableau, nombre_elements, (*(*s_etat_processus)              tableau, nombre_elements, (*(*s_etat_processus)
             .s_arbre_variables_partagees));              .s_arbre_variables_partagees));
   

Removed from v.1.71  
changed lines
  Added in v.1.76


CVSweb interface <joel.bertrand@systella.fr>