Diff for /rpl/src/instructions_v1.c between versions 1.45 and 1.84

version 1.45, 2012/12/17 21:22:44 version 1.84, 2024/01/17 16:57:17
Line 1 Line 1
 /*  /*
 ================================================================================  ================================================================================
   RPL/2 (R) version 4.1.11    RPL/2 (R) version 4.1.36
   Copyright (C) 1989-2012 Dr. BERTRAND Joël    Copyright (C) 1989-2024 Dr. BERTRAND Joël
   
   This file is part of RPL/2.    This file is part of RPL/2.
   
Line 42  instruction_var(struct_processus *s_etat Line 42  instruction_var(struct_processus *s_etat
     struct_objet                        *s_objet_resultat;      struct_objet                        *s_objet_resultat;
     struct_objet                        *s_objet_temporaire;      struct_objet                        *s_objet_temporaire;
   
     unsigned long                       nombre_colonnes;      integer8                            nombre_colonnes;
   
     (*s_etat_processus).erreur_execution = d_ex;      (*s_etat_processus).erreur_execution = d_ex;
   
Line 132  instruction_var(struct_processus *s_etat Line 132  instruction_var(struct_processus *s_etat
             return;              return;
         }          }
   
         if (((*s_objet_resultat).objet = variance_statistique((struct_matrice *)          if (((*s_objet_resultat).objet = variance_statistique(s_etat_processus,
                 (*s_objet_statistique).objet, 'E')) == NULL)                  (struct_matrice *) (*s_objet_statistique).objet, 'E')) == NULL)
         {          {
             (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;              (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
             return;              return;
Line 500  instruction_version(struct_processus *s_ Line 500  instruction_version(struct_processus *s_
         return;          return;
     }      }
   
     if (((*(*l_element_courant).donnee).objet = date_compilation()) == NULL)      if (((*(*l_element_courant).donnee).objet =
               date_compilation(s_etat_processus)) == NULL)
     {      {
         (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;          (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
         return;          return;
Line 933  instruction_version(struct_processus *s_ Line 934  instruction_version(struct_processus *s_
         return;          return;
     }      }
   
     if (((*(*l_element_courant).donnee).objet = conversion_majuscule(HOST))      if (((*(*l_element_courant).donnee).objet = conversion_majuscule(
             == NULL)              s_etat_processus, HOST)) == NULL)
     {      {
         (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;          (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
         return;          return;
Line 969  instruction_version(struct_processus *s_ Line 970  instruction_version(struct_processus *s_
 void  void
 instruction_vars(struct_processus *s_etat_processus)  instruction_vars(struct_processus *s_etat_processus)
 {  {
     int                                 i;      integer8                            i;
     int                                 nb_variables;      integer8                            nb_variables;
   
     logical1                            variable_partagee;      logical1                            variable_partagee;
   
Line 1025  instruction_vars(struct_processus *s_eta Line 1026  instruction_vars(struct_processus *s_eta
   
     nb_variables = nombre_variables(s_etat_processus);      nb_variables = nombre_variables(s_etat_processus);
   
     if ((tableau = malloc(nb_variables * sizeof(struct_tableau_variables)))      if ((tableau = malloc(((size_t) nb_variables) *
             == NULL)              sizeof(struct_tableau_variables))) == NULL)
     {      {
         liberation_mutexes_arbre_variables_partagees(s_etat_processus,          liberation_mutexes_arbre_variables_partagees(s_etat_processus,
                 (*(*s_etat_processus).s_arbre_variables_partagees));                  (*(*s_etat_processus).s_arbre_variables_partagees));
Line 1034  instruction_vars(struct_processus *s_eta Line 1035  instruction_vars(struct_processus *s_eta
         return;          return;
     }      }
   
     liste_variables(s_etat_processus, tableau);      nb_variables = liste_variables(s_etat_processus, tableau);
   
     for(i = 0; i < nb_variables; i++)      for(i = 0; i < nb_variables; i++)
     {      {
Line 1093  instruction_vars(struct_processus *s_eta Line 1094  instruction_vars(struct_processus *s_eta
                     tableau[i].origine) == NULL)                      tableau[i].origine) == NULL)
             {              {
                 // La variable partagée n'existe plus.                  // La variable partagée n'existe plus.
   
                 continue;                  continue;
             }              }
   
Line 1122  instruction_vars(struct_processus *s_eta Line 1122  instruction_vars(struct_processus *s_eta
                 }                  }
             }              }
   
               if (tableau[i].mutex != NULL)
               {
                   // La variable est une variable partagée. On libère le mutex.
                   pthread_mutex_unlock(tableau[i].mutex);
               }
   
             (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;              (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
             return;              return;
         }          }
Line 1145  instruction_vars(struct_processus *s_eta Line 1151  instruction_vars(struct_processus *s_eta
                 }                  }
             }              }
   
               if (tableau[i].mutex != NULL)
               {
                   // La variable est une variable partagée. On libère le mutex.
                   pthread_mutex_unlock(tableau[i].mutex);
               }
   
             (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;              (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
             return;              return;
         }          }
Line 1171  instruction_vars(struct_processus *s_eta Line 1183  instruction_vars(struct_processus *s_eta
                 }                  }
             }              }
   
               if (tableau[i].mutex != NULL)
               {
                   // La variable est une variable partagée. On libère le mutex.
                   pthread_mutex_unlock(tableau[i].mutex);
               }
   
             (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;              (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
             return;              return;
         }          }
Line 1189  instruction_vars(struct_processus *s_eta Line 1207  instruction_vars(struct_processus *s_eta
                 }                  }
             }              }
   
               if (tableau[i].mutex != NULL)
               {
                   // La variable est une variable partagée. On libère le mutex.
                   pthread_mutex_unlock(tableau[i].mutex);
               }
   
             (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;              (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
             return;              return;
         }          }
Line 1215  instruction_vars(struct_processus *s_eta Line 1239  instruction_vars(struct_processus *s_eta
                 }                  }
             }              }
   
               if (tableau[i].mutex != NULL)
               {
                   // La variable est une variable partagée. On libère le mutex.
                   pthread_mutex_unlock(tableau[i].mutex);
               }
   
             (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;              (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
             return;              return;
         }          }
Line 1236  instruction_vars(struct_processus *s_eta Line 1266  instruction_vars(struct_processus *s_eta
                     return;                      return;
                 }                  }
   
                   if (tableau[i].mutex != NULL)
                   {
                       // La variable est une variable partagée. On libère
                       // le mutex.
                       pthread_mutex_unlock(tableau[i].mutex);
                   }
   
                 (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;                  (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                 return;                  return;
             }              }
Line 1243  instruction_vars(struct_processus *s_eta Line 1280  instruction_vars(struct_processus *s_eta
             if (pthread_mutex_unlock(&((*(*s_etat_processus)              if (pthread_mutex_unlock(&((*(*s_etat_processus)
                     .pointeur_variable_partagee_courante).mutex)) != 0)                      .pointeur_variable_partagee_courante).mutex)) != 0)
             {              {
                   if (tableau[i].mutex != NULL)
                   {
                       // La variable est une variable partagée. On libère
                       // le mutex.
                       pthread_mutex_unlock(tableau[i].mutex);
                   }
   
                 (*s_etat_processus).erreur_systeme = d_es_processus;                  (*s_etat_processus).erreur_systeme = d_es_processus;
                 return;                  return;
             }              }
Line 1256  instruction_vars(struct_processus *s_eta Line 1300  instruction_vars(struct_processus *s_eta
                     .donnee = copie_objet(s_etat_processus, tableau[i].objet,                      .donnee = copie_objet(s_etat_processus, tableau[i].objet,
                     'P')) == NULL)                      'P')) == NULL)
             {              {
                   if (tableau[i].mutex != NULL)
                   {
                       // La variable est une variable partagée. On libère
                       // le mutex.
                       pthread_mutex_unlock(tableau[i].mutex);
                   }
   
                 (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;                  (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                 return;                  return;
             }              }
Line 1269  instruction_vars(struct_processus *s_eta Line 1320  instruction_vars(struct_processus *s_eta
                 (*l_element_courant).donnee)).objet)).suivant).suivant)                  (*l_element_courant).donnee)).objet)).suivant).suivant)
                 .suivant = allocation_maillon(s_etat_processus)) == NULL)                  .suivant = allocation_maillon(s_etat_processus)) == NULL)
         {          {
               if (tableau[i].mutex != NULL)
               {
                   // La variable est une variable partagée. On libère le mutex.
                   pthread_mutex_unlock(tableau[i].mutex);
               }
   
             (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;              (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
             return;              return;
         }          }
Line 1277  instruction_vars(struct_processus *s_eta Line 1334  instruction_vars(struct_processus *s_eta
                 (*l_element_courant).donnee)).objet)).suivant).suivant).suivant)                  (*l_element_courant).donnee)).objet)).suivant).suivant).suivant)
                 .donnee = allocation(s_etat_processus, CHN)) == NULL)                  .donnee = allocation(s_etat_processus, CHN)) == NULL)
         {          {
               if (tableau[i].mutex != NULL)
               {
                   // La variable est une variable partagée. On libère le mutex.
                   pthread_mutex_unlock(tableau[i].mutex);
               }
   
             (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;              (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
             return;              return;
         }          }
Line 1290  instruction_vars(struct_processus *s_eta Line 1353  instruction_vars(struct_processus *s_eta
                     .suivant).donnee).objet = malloc(7 *                      .suivant).donnee).objet = malloc(7 *
                     sizeof(unsigned char))) == NULL)                      sizeof(unsigned char))) == NULL)
             {              {
                   if (tableau[i].mutex != NULL)
                   {
                       // La variable est une variable partagée. On libère
                       // le mutex.
                       pthread_mutex_unlock(tableau[i].mutex);
                   }
   
                 (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;                  (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                 return;                  return;
             }              }
Line 1315  instruction_vars(struct_processus *s_eta Line 1385  instruction_vars(struct_processus *s_eta
                     (*l_element_courant).donnee)).objet)).suivant).suivant)                      (*l_element_courant).donnee)).objet)).suivant).suivant)
                     .suivant).donnee).objet = malloc(9 *                      .suivant).donnee).objet = malloc(9 *
                     sizeof(unsigned char))) == NULL)                      sizeof(unsigned char))) == NULL)
             {              { 
                   if (tableau[i].mutex != NULL)
                   {
                       // La variable est une variable partagée. On libère
                       // le mutex.
                       pthread_mutex_unlock(tableau[i].mutex);
                   }
   
                 (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;                  (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                 return;                  return;
             }              }
Line 1334  instruction_vars(struct_processus *s_eta Line 1411  instruction_vars(struct_processus *s_eta
                 .suivant).suivant = allocation_maillon(s_etat_processus))                  .suivant).suivant = allocation_maillon(s_etat_processus))
                 == NULL)                  == NULL)
         {          {
               if (tableau[i].mutex != NULL)
               {
                   // La variable est une variable partagée. On libère le mutex.
                   pthread_mutex_unlock(tableau[i].mutex);
               }
   
             (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;              (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
             return;              return;
         }          }
Line 1343  instruction_vars(struct_processus *s_eta Line 1426  instruction_vars(struct_processus *s_eta
                 .suivant).donnee = allocation(s_etat_processus, CHN))                  .suivant).donnee = allocation(s_etat_processus, CHN))
                 == NULL)                  == NULL)
         {          {
               if (tableau[i].mutex != NULL)
               {
                   // La variable est une variable partagée. On libère le mutex.
                   pthread_mutex_unlock(tableau[i].mutex);
               }
   
             (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;              (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
             return;              return;
         }          }
Line 1354  instruction_vars(struct_processus *s_eta Line 1443  instruction_vars(struct_processus *s_eta
                     .suivant).suivant).donnee).objet = malloc(7 *                      .suivant).suivant).donnee).objet = malloc(7 *
                     sizeof(unsigned char))) == NULL)                      sizeof(unsigned char))) == NULL)
             {              {
                   if (tableau[i].mutex != NULL)
                   {
                       // La variable est une variable partagée. On libère
                       // le mutex.
                       pthread_mutex_unlock(tableau[i].mutex);
                   }
   
                 (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;                  (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                 return;                  return;
             }              }
Line 1370  instruction_vars(struct_processus *s_eta Line 1466  instruction_vars(struct_processus *s_eta
                     .suivant).suivant).donnee).objet = malloc(9 *                      .suivant).suivant).donnee).objet = malloc(9 *
                     sizeof(unsigned char))) == NULL)                      sizeof(unsigned char))) == NULL)
             {              {
                   if (tableau[i].mutex != NULL)
                   {
                       // La variable est une variable partagée. On libère
                       // le mutex.
                       pthread_mutex_unlock(tableau[i].mutex);
                   }
   
                 (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;                  (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                 return;                  return;
             }              }
Line 1381  instruction_vars(struct_processus *s_eta Line 1484  instruction_vars(struct_processus *s_eta
         }          }
   
         /*          /*
          * Préparation du drapeau PRIVATE/SHARED           * Préparation du drapeau PRIVATE/SHARED/MAPPED
          */           */
   
         if (((*(*(*(*(*((struct_liste_chainee *) (*((struct_objet *)          if (((*(*(*(*(*((struct_liste_chainee *) (*((struct_objet *)
Line 1389  instruction_vars(struct_processus *s_eta Line 1492  instruction_vars(struct_processus *s_eta
                 .suivant).suivant).suivant =                  .suivant).suivant).suivant =
                 allocation_maillon(s_etat_processus)) == NULL)                  allocation_maillon(s_etat_processus)) == NULL)
         {          {
               if (tableau[i].mutex != NULL)
               {
                   // La variable est une variable partagée. On libère le mutex.
                   pthread_mutex_unlock(tableau[i].mutex);
               }
   
             (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;              (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
             return;              return;
         }          }
Line 1398  instruction_vars(struct_processus *s_eta Line 1507  instruction_vars(struct_processus *s_eta
                 .suivant).suivant).donnee = allocation(s_etat_processus,                  .suivant).suivant).donnee = allocation(s_etat_processus,
                 CHN)) == NULL)                  CHN)) == NULL)
         {          {
               if (tableau[i].mutex != NULL)
               {
                   // La variable est une variable partagée. On libère le mutex.
                   pthread_mutex_unlock(tableau[i].mutex);
               }
   
             (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;              (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
             return;              return;
         }          }
Line 1409  instruction_vars(struct_processus *s_eta Line 1524  instruction_vars(struct_processus *s_eta
                     .suivant).suivant).suivant).donnee).objet = malloc(7 *                      .suivant).suivant).suivant).donnee).objet = malloc(7 *
                     sizeof(unsigned char))) == NULL)                      sizeof(unsigned char))) == NULL)
             {              {
                   if (tableau[i].mutex != NULL)
                   {
                       // La variable est une variable partagée. On libère
                       // le mutex.
                       pthread_mutex_unlock(tableau[i].mutex);
                   }
   
                   (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   return;
               }
   
               strcpy((unsigned char *) (*(*(*(*(*(*(*((struct_liste_chainee *)
                       (*((struct_objet *) (*l_element_courant).donnee)).objet))
                       .suivant).suivant).suivant).suivant).suivant).donnee).objet,
                       "MAPPED");
           }
           else if (tableau[i].mutex != NULL)
           {
               if (((*(*(*(*(*(*(*((struct_liste_chainee *) (*((struct_objet *)
                       (*l_element_courant).donnee)).objet)).suivant).suivant)
                       .suivant).suivant).suivant).donnee).objet = malloc(7 *
                       sizeof(unsigned char))) == NULL)
               {
                   if (tableau[i].mutex != NULL)
                   {
                       // La variable est une variable partagée. On libère
                       // le mutex.
                       pthread_mutex_unlock(tableau[i].mutex);
                   }
   
                 (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;                  (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                 return;                  return;
             }              }
Line 1425  instruction_vars(struct_processus *s_eta Line 1570  instruction_vars(struct_processus *s_eta
                     .suivant).suivant).suivant).donnee).objet = malloc(8 *                      .suivant).suivant).suivant).donnee).objet = malloc(8 *
                     sizeof(unsigned char))) == NULL)                      sizeof(unsigned char))) == NULL)
             {              {
                   if (tableau[i].mutex != NULL)
                   {
                       // La variable est une variable partagée. On libère
                       // le mutex.
                       pthread_mutex_unlock(tableau[i].mutex);
                   }
   
                 (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;                  (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                 return;                  return;
             }              }
Line 1444  instruction_vars(struct_processus *s_eta Line 1596  instruction_vars(struct_processus *s_eta
                 .suivant).suivant).suivant).suivant = NULL;                  .suivant).suivant).suivant).suivant = NULL;
   
         l_element_precedent = l_element_courant;          l_element_precedent = l_element_courant;
   
           if (tableau[i].mutex != NULL)
           {
               // La variable est une variable partagée. On libère
               // le mutex.
               pthread_mutex_unlock(tableau[i].mutex);
           }
     }      }
   
     free(tableau);      free(tableau);
Line 1477  instruction_visit(struct_processus *s_et Line 1636  instruction_visit(struct_processus *s_et
   
     struct_objet                        *s_objet;      struct_objet                        *s_objet;
   
     unsigned long                       profondeur_initiale;      integer8                            profondeur_initiale;
   
     (*s_etat_processus).erreur_execution = d_ex;      (*s_etat_processus).erreur_execution = d_ex;
   

Removed from v.1.45  
changed lines
  Added in v.1.84


CVSweb interface <joel.bertrand@systella.fr>