Diff for /rpl/src/transliteration.c between versions 1.34 and 1.43

version 1.34, 2011/06/27 09:05:02 version 1.43, 2011/09/20 09:51:43
Line 1 Line 1
 /*  /*
 ================================================================================  ================================================================================
   RPL/2 (R) version 4.1.0    RPL/2 (R) version 4.1.3
   Copyright (C) 1989-2011 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 105  reencodage(struct_processus *s_etat_proc Line 105  reencodage(struct_processus *s_etat_proc
   
     chaine_sortie[0] = d_code_fin_chaine;      chaine_sortie[0] = d_code_fin_chaine;
   
     if ((buffer_sortie = malloc((d_LONGUEUR + 1) * sizeof(char))) == NULL)      if ((buffer_sortie = malloc((d_LONGUEUR + 1) * sizeof(unsigned char)))
               == NULL)
     {      {
         (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;          (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
         return(NULL);          return(NULL);
Line 131  reencodage(struct_processus *s_etat_proc Line 132  reencodage(struct_processus *s_etat_proc
             }              }
         }          }
   
         tampon = (unsigned char *) chaine_sortie;          tampon = chaine_sortie;
         (*pointeur) = d_code_fin_chaine;          (*pointeur) = d_code_fin_chaine;
   
         if ((chaine_sortie = malloc((strlen(tampon) + strlen(buffer_sortie) + 1)          if ((chaine_sortie = malloc((strlen(tampon) + strlen(buffer_sortie) + 1)
Line 175  localisation_courante(struct_processus * Line 176  localisation_courante(struct_processus *
     int                         pipes_sortie[2];      int                         pipes_sortie[2];
     int                         status;      int                         status;
   
     logical1                    drapeau_fin;  
   
     long                        i;      long                        i;
     long                        nombre_arguments;      long                        nombre_arguments;
   
     pid_t                       pid;      pid_t                       pid;
   
     sigset_t                    oldset;  
     sigset_t                    set;  
   
     struct sigaction            action_passee;      struct sigaction            action_passee;
   
     unsigned char               *tampon;      unsigned char               *tampon;
Line 216  localisation_courante(struct_processus * Line 212  localisation_courante(struct_processus *
     arguments[2] = NULL;      arguments[2] = NULL;
   
     nombre_arguments = 2;      nombre_arguments = 2;
     drapeau_fin = d_faux;  
   
     if (pipe(pipes_entree) != 0)      if (pipe(pipes_entree) != 0)
     {      {
Line 236  localisation_courante(struct_processus * Line 231  localisation_courante(struct_processus *
         return;          return;
     }      }
   
     sigfillset(&set);  
     pthread_sigmask(SIG_BLOCK, &set, &oldset);  
   
     verrouillage_threads_concurrents(s_etat_processus);      verrouillage_threads_concurrents(s_etat_processus);
     pid = fork();      pid = fork();
     deverrouillage_threads_concurrents(s_etat_processus);      deverrouillage_threads_concurrents(s_etat_processus);
   
     pthread_sigmask(SIG_SETMASK, &oldset, NULL);  
     sigpending(&set);  
   
     if (pid < 0)      if (pid < 0)
     {      {
         if (close(pipes_entree[0]) != 0)          if (close(pipes_entree[0]) != 0)
Line 407  localisation_courante(struct_processus * Line 396  localisation_courante(struct_processus *
              * Récupération de la valeur de retour du processus détaché               * Récupération de la valeur de retour du processus détaché
              */               */
   
 #           ifndef SEMAPHORES_NOMMES  
             if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0)              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;                  return;
Line 419  localisation_courante(struct_processus * Line 404  localisation_courante(struct_processus *
   
             if (waitpid(pid, &status, 0) == -1)              if (waitpid(pid, &status, 0) == -1)
             {              {
 #               ifndef SEMAPHORES_NOMMES                  while(sem_wait(&((*s_etat_processus).semaphore_fork)) != 0)
                 if (sem_wait(&((*s_etat_processus).semaphore_fork)) == -1)  
 #               else  
                 if (sem_wait((*s_etat_processus).semaphore_fork) == -1)  
 #               endif  
                 {                  {
                     if (errno != EINTR)                      if (errno != EINTR)
                     {                      {
Line 436  localisation_courante(struct_processus * Line 417  localisation_courante(struct_processus *
                 return;                  return;
             }              }
   
 #           ifndef SEMAPHORES_NOMMES              while(sem_wait(&((*s_etat_processus).semaphore_fork)) != 0)
             if (sem_wait(&((*s_etat_processus).semaphore_fork)) == -1)  
 #           else  
             if (sem_wait((*s_etat_processus).semaphore_fork) == -1)  
 #           endif  
             {              {
                 if (errno != EINTR)                  if (errno != EINTR)
                 {                  {
Line 463  localisation_courante(struct_processus * Line 440  localisation_courante(struct_processus *
   
         tampon[0] = d_code_fin_chaine;          tampon[0] = d_code_fin_chaine;
   
 #       ifndef SEMAPHORES_NOMMES  
         if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0)          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;              return;
Line 477  localisation_courante(struct_processus * Line 450  localisation_courante(struct_processus *
                 pipes_sortie[0], &(tampon[pointeur]),                  pipes_sortie[0], &(tampon[pointeur]),
                 longueur_lecture)) > 0)                  longueur_lecture)) > 0)
         {          {
 #           ifndef SEMAPHORES_NOMMES              while(sem_wait(&((*s_etat_processus).semaphore_fork)) != 0)
             while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1)  
 #           else  
             while(sem_wait((*s_etat_processus).semaphore_fork) == -1)  
 #           endif  
             {              {
                 if (errno != EINTR)                  if (errno != EINTR)
                 {                  {
Line 503  localisation_courante(struct_processus * Line 472  localisation_courante(struct_processus *
                 return;                  return;
             }              }
   
 #           ifndef SEMAPHORES_NOMMES  
             if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0)              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;                  return;
             }              }
         }          }
   
 #       ifndef SEMAPHORES_NOMMES          while(sem_wait(&((*s_etat_processus).semaphore_fork)) != 0)
         while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1)  
 #       else  
         while(sem_wait((*s_etat_processus).semaphore_fork) == -1)  
 #       endif  
         {          {
             if (errno != EINTR)              if (errno != EINTR)
             {              {
Line 584  localisation_courante(struct_processus * Line 545  localisation_courante(struct_processus *
   
         free(arguments);          free(arguments);
   
 #       ifndef SEMAPHORES_NOMMES  
         if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0)          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;              return;
Line 610  localisation_courante(struct_processus * Line 567  localisation_courante(struct_processus *
             strcpy((*s_etat_processus).localisation, d_locale);              strcpy((*s_etat_processus).localisation, d_locale);
         }          }
   
 #       ifndef SEMAPHORES_NOMMES          while(sem_wait(&((*s_etat_processus).semaphore_fork)) != 0)
         while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1)  
 #       else  
         while(sem_wait((*s_etat_processus).semaphore_fork) == -1)  
 #       endif  
         {          {
             if (errno != EINTR)              if (errno != EINTR)
             {              {

Removed from v.1.34  
changed lines
  Added in v.1.43


CVSweb interface <joel.bertrand@systella.fr>