Diff for /rpl/src/bibliotheques_externes.c between versions 1.1.1.1 and 1.38

version 1.1.1.1, 2010/01/26 15:22:44 version 1.38, 2011/09/26 15:57:09
Line 1 Line 1
 /*  /*
 ================================================================================  ================================================================================
   RPL/2 (R) version 4.0.9    RPL/2 (R) version 4.1.4
   Copyright (C) 1989-2010 Dr. BERTRAND Joël    Copyright (C) 1989-2011 Dr. BERTRAND Joël
   
   This file is part of RPL/2.    This file is part of RPL/2.
   
Line 20 Line 20
 */  */
   
   
 #include "rpl.conv.h"  #include "rpl-conv.h"
   
 static pthread_mutex_t          mutex = PTHREAD_MUTEX_INITIALIZER;  static pthread_mutex_t          mutex = PTHREAD_MUTEX_INITIALIZER;
   
Line 41  void * Line 41  void *
 chargement_bibliotheque(struct_processus *s_etat_processus,  chargement_bibliotheque(struct_processus *s_etat_processus,
         unsigned char *bibliotheque)          unsigned char *bibliotheque)
 {  {
     char                    **(*fonction)(unsigned long *);      char                    **(*fonction)(unsigned long *, const char *);
     char                    *message;      char                    *message;
   
       long                    i;
       long                    nombre_symboles;
   
     struct_rpl_arguments    rpl_arguments;      struct_rpl_arguments    rpl_arguments;
   
     struct_liste_chainee    *l_element_courant;      struct_liste_chainee    *l_element_courant;
Line 52  chargement_bibliotheque(struct_processus Line 55  chargement_bibliotheque(struct_processus
     unsigned char           **tableau;      unsigned char           **tableau;
     unsigned char           *tampon;      unsigned char           *tampon;
   
     unsigned long           nombre_symboles;  
     unsigned long           i;  
   
     void                    *descripteur_bibliotheque;      void                    *descripteur_bibliotheque;
     void                    (*onloading)(struct_rpl_arguments *);      void                    (*onloading)(struct_rpl_arguments *);
   
Line 161  chargement_bibliotheque(struct_processus Line 161  chargement_bibliotheque(struct_processus
             }              }
         }          }
   
         if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0)  #       ifndef SEMAPHORES_NOMMES
               if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0)
   #       else
               if (sem_post((*s_etat_processus).semaphore_fork) != 0)
   #       endif
         {          {
             (*s_etat_processus).erreur_systeme = d_es_processus;              (*s_etat_processus).erreur_systeme = d_es_processus;
             return(NULL);              return(NULL);
Line 169  chargement_bibliotheque(struct_processus Line 173  chargement_bibliotheque(struct_processus
   
         (*onloading)(&rpl_arguments);          (*onloading)(&rpl_arguments);
   
         while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1)  #       ifndef SEMAPHORES_NOMMES
               while(sem_wait(&((*s_etat_processus).semaphore_fork)) != 0)
   #       else
               while(sem_wait((*s_etat_processus).semaphore_fork) != 0)
   #       endif
         {          {
             if (errno != EINTR)              if (errno != EINTR)
             {              {
Line 315  chargement_bibliotheque(struct_processus Line 323  chargement_bibliotheque(struct_processus
         }          }
     }      }
     
       dlerror();
   
     if (pthread_mutex_unlock(&mutex) != 0)      if (pthread_mutex_unlock(&mutex) != 0)
     {      {
         (*s_etat_processus).erreur_systeme = d_es_processus;          (*s_etat_processus).erreur_systeme = d_es_processus;
Line 325  chargement_bibliotheque(struct_processus Line 335  chargement_bibliotheque(struct_processus
      * Ajout des symboles externes       * Ajout des symboles externes
      */       */
   
     if ((tableau = (unsigned char **) (*fonction)(&nombre_symboles)) == NULL)      if ((tableau = (unsigned char **) (*fonction)((&nombre_symboles),
               d_version_rpl)) == NULL)
     {      {
           /*
            * Nombre symboles :
            * 0    : aucun symbole exporté
            * >0   : nombre de symboles exportés
            * -1   : version de bibliothèque incompatible
            */
   
         if (nombre_symboles == 0)          if (nombre_symboles == 0)
         {          {
             (*s_etat_processus).erreur_execution = d_ex_aucun_symbole;              (*s_etat_processus).erreur_execution = d_ex_aucun_symbole;
         }          }
           else if (nombre_symboles == -1)
           {
               (*s_etat_processus).erreur_execution = d_ex_version_bibliotheque;
           }
         else          else
         {          {
             (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;              (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
Line 380  chargement_bibliotheque(struct_processus Line 402  chargement_bibliotheque(struct_processus
         strcpy((*s_etat_processus).s_instructions_externes[(*s_etat_processus)          strcpy((*s_etat_processus).s_instructions_externes[(*s_etat_processus)
                 .nombre_instructions_externes].nom_bibliotheque, tableau[i]);                  .nombre_instructions_externes].nom_bibliotheque, tableau[i]);
         (*s_etat_processus).nombre_instructions_externes++;          (*s_etat_processus).nombre_instructions_externes++;
   
         free(tableau[i]);          free(tableau[i]);
     }      }
   
Line 557  retrait_bibliotheque(struct_processus *s Line 580  retrait_bibliotheque(struct_processus *s
                 }                  }
             }              }
   
             if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0)  #           ifndef SEMAPHORES_NOMMES
                   if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0)
   #           else
                   if (sem_post((*s_etat_processus).semaphore_fork) != 0)
   #           endif
             {              {
                 (*s_etat_processus).erreur_systeme = d_es_processus;                  (*s_etat_processus).erreur_systeme = d_es_processus;
                 return(d_erreur);                  return(d_erreur);
Line 565  retrait_bibliotheque(struct_processus *s Line 592  retrait_bibliotheque(struct_processus *s
   
             (*onclosing)(&rpl_arguments);              (*onclosing)(&rpl_arguments);
   
             while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1)  #           ifndef SEMAPHORES_NOMMES
                   while(sem_wait(&((*s_etat_processus).semaphore_fork)) != 0)
   #           else
                   while(sem_wait((*s_etat_processus).semaphore_fork) != 0)
   #           endif
             {              {
                 if (errno != EINTR)                  if (errno != EINTR)
                 {                  {
Line 1067  execution_fonction_de_bibliotheque(struc Line 1098  execution_fonction_de_bibliotheque(struc
         }          }
     }      }
   
       dlerror();
   
     if (pthread_mutex_unlock(&mutex) != 0)      if (pthread_mutex_unlock(&mutex) != 0)
     {      {
         (*s_etat_processus).erreur_systeme = d_es_processus;          (*s_etat_processus).erreur_systeme = d_es_processus;
Line 1122  execution_fonction_de_bibliotheque(struc Line 1155  execution_fonction_de_bibliotheque(struc
         }          }
     }      }
   
     if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0)  #   ifndef SEMAPHORES_NOMMES
           if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0)
   #   else
           if (sem_post((*s_etat_processus).semaphore_fork) != 0)
   #   endif
     {      {
         (*s_etat_processus).erreur_systeme = d_es_processus;          (*s_etat_processus).erreur_systeme = d_es_processus;
         return(d_faux);          return(d_faux);
Line 1130  execution_fonction_de_bibliotheque(struc Line 1167  execution_fonction_de_bibliotheque(struc
   
     (*fonction)(&rpl_arguments);      (*fonction)(&rpl_arguments);
   
     while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1)  #   ifndef SEMAPHORES_NOMMES
           while(sem_wait(&((*s_etat_processus).semaphore_fork)) != 0)
   #   else
           while(sem_wait((*s_etat_processus).semaphore_fork) != 0)
   #   endif
     {      {
         if (errno != EINTR)          if (errno != EINTR)
         {          {
Line 1593  tri_base_symboles_externes(struct_proces Line 1634  tri_base_symboles_externes(struct_proces
             do              do
             {              {
                 indice_i = indice_j;                  indice_i = indice_j;
   
                 terminaison_boucle_3 = d_faux;                  terminaison_boucle_3 = d_faux;
   
                 do                  do
Line 1687  tri_base_symboles_externes(struct_proces Line 1727  tri_base_symboles_externes(struct_proces
   
         indice_i++;          indice_i++;
     } while((unsigned long) (indice_i + 1) <      } while((unsigned long) (indice_i + 1) <
             (*s_etat_processus).nombre_variables);              (*s_etat_processus).nombre_instructions_externes);
   
     return;      return;
 }  }

Removed from v.1.1.1.1  
changed lines
  Added in v.1.38


CVSweb interface <joel.bertrand@systella.fr>