Diff for /rpl/src/formateur_fichiers.c between versions 1.54 and 1.58

version 1.54, 2013/03/11 11:07:24 version 1.58, 2013/03/19 11:46:11
Line 62  formateur_fichier(struct_processus *s_et Line 62  formateur_fichier(struct_processus *s_et
      *   "binary*X(*)"       *   "binary*X(*)"
      *   "binary*X(Y)"  (X est la base : 2, 8, 10, 16)       *   "binary*X(Y)"  (X est la base : 2, 8, 10, 16)
      *   "character*(*)"       *   "character*(*)"
      *   "character*(Y)" }       *   "character*(Y)"
        *   "native*(*)" }
      *       *
      * Traitement du format des fichiers non formatés :       * Traitement du format des fichiers non formatés :
      *       *
Line 70  formateur_fichier(struct_processus *s_et Line 71  formateur_fichier(struct_processus *s_et
      *   "real*4", "real*8", ["real*16",]       *   "real*4", "real*8", ["real*16",]
      *   "complex*8", "complex*16", ["complex*32",]       *   "complex*8", "complex*16", ["complex*32",]
      *   "logical*1", "logical*2", "logical*4", logical*8",       *   "logical*1", "logical*2", "logical*4", logical*8",
      *   "character*n" "character*(*)" }       *   "character*n" "character*(*)" "native*(*)" }
      */       */
   
     logical1                    autorisation_parenthese;      logical1                    autorisation_parenthese;
     logical1                    format_degenere;      logical1                    format_degenere;
     logical1                    presence_signe;      logical1                    presence_signe;
   
     long                        longueur_chaine_traitee;      unsigned long int           longueur_chaine_traitee;
   
     struct_liste_chainee        *l_atome;      struct_liste_chainee        *l_atome;
     struct_liste_chainee        *l_element_courant;      struct_liste_chainee        *l_element_courant;
Line 110  formateur_fichier(struct_processus *s_et Line 111  formateur_fichier(struct_processus *s_et
     unsigned long               nombre_elements;      unsigned long               nombre_elements;
     unsigned long               nombre_lignes;      unsigned long               nombre_lignes;
   
       integer8                    longueur_fonction;
     integer8                    longueur_liste;      integer8                    longueur_liste;
     integer8                    longueur_reelle_chaine;      integer8                    longueur_reelle_chaine;
     integer8                    longueur_totale;      integer8                    longueur_totale;
     integer8                    masque_binaire;  
     integer8                    position_1;      integer8                    position_1;
     integer8                    position_2;      integer8                    position_2;
     integer8                    position_3;      integer8                    position_3;
Line 132  formateur_fichier(struct_processus *s_et Line 133  formateur_fichier(struct_processus *s_et
   
         strcpy(base, " ");          strcpy(base, " ");
   
         masque_binaire = 0;  
   
         if ((*s_objet).type == ALG)          if ((*s_objet).type == ALG)
         {          {
   
Line 143  formateur_fichier(struct_processus *s_et Line 142  formateur_fichier(struct_processus *s_et
 --------------------------------------------------------------------------------  --------------------------------------------------------------------------------
 */  */
   
               if (format_sortie != 'N')
               {
                   (*s_etat_processus).erreur_execution =
                           d_ex_erreur_format_fichier;
                   return(NULL);
               }
   
             l_element_courant = (struct_liste_chainee *) (*s_objet).objet;              l_element_courant = (struct_liste_chainee *) (*s_objet).objet;
   
             while(l_element_courant != NULL)              while(l_element_courant != NULL)
Line 985  formateur_fichier(struct_processus *s_et Line 991  formateur_fichier(struct_processus *s_et
 --------------------------------------------------------------------------------  --------------------------------------------------------------------------------
 */  */
   
             if (format_sortie != 'B')              if ((format_sortie != 'B') && (format_sortie != 'N'))
             {              {
                 (*s_etat_processus).erreur_execution =                  (*s_etat_processus).erreur_execution =
                         d_ex_erreur_format_fichier;                          d_ex_erreur_format_fichier;
                 return(NULL);                  return(NULL);
             }              }
   
             masque_binaire = masque_entiers_binaires(s_etat_processus);              if (format_sortie == 'N')
   
             if ((test_cfsf(s_etat_processus, 43) == d_faux) &&  
                     (test_cfsf(s_etat_processus, 44) == d_faux))  
             {              {
                   sprintf(tampon, "%llX", (*((logical8 *)
 /*                          ((*s_objet).objet))));
 -- Base décimale ---------------------------------------------------------------                  strcpy(base, "h");
 */  
   
                 sprintf(tampon, "%llu", (*((logical8 *)  
                         ((*s_objet).objet))) & masque_binaire);  
                 strcpy(base, "d");  
             }              }
             else if ((test_cfsf(s_etat_processus, 43) == d_vrai) &&              else
                     (test_cfsf(s_etat_processus, 44) == d_faux))  
             {              {
                   switch(longueur)
                   {
                       case 2:
                       {
                           sprintf(tampon, "%llX", (*((logical8 *)
                                   ((*s_objet).objet))));
   
 /*                          chaine = (unsigned char *) malloc((strlen(tampon) + 1)
 -- Base octale -----------------------------------------------------------------                                  * sizeof(unsigned char));
 */  
   
                 sprintf(tampon, "%llo", (*((logical8 *)                          if (chaine == NULL)
                         ((*s_objet).objet))) & masque_binaire);                          {
                 strcpy(base, "o");                              (*s_etat_processus).erreur_systeme =
             }                                      d_es_allocation_memoire;
             else if (test_cfsf(s_etat_processus, 44) == d_vrai)                              return(NULL);
             {                          }
   
 /*                          strcpy(chaine, tampon);
 -- Bases hexadécimale et binaire -----------------------------------------------                          tampon[0] = 0;
 */  
   
                 sprintf(tampon, "%llX", (*((logical8 *)                          for(i = 0; i < strlen(chaine); i++)
                         ((*s_objet).objet))) & masque_binaire);                          {
                               switch(chaine[i])
                               {
                                   case '0' :
                                   {
                                       strcat(tampon, (i != 0) ? "0000" : "0");
                                       break;
                                   }
                                   case '1' :
                                   {
                                       strcat(tampon, (i != 0) ? "0001" : "1");
                                       break;
                                   }
                                   case '2' :
                                   {
                                       strcat(tampon, (i != 0) ? "0010" : "10");
                                       break;
                                   }
                                   case '3' :
                                   {
                                       strcat(tampon, (i != 0) ? "0011" : "11");
                                   break;
                                   }
                                   case '4' :
                                   {
                                       strcat(tampon, (i != 0) ? "0100" : "100");
                                       break;
                                   }
                                   case '5' :
                                   {
                                       strcat(tampon, (i != 0) ? "0101" : "101");
                                       break;
                                   }
                                   case '6' :
                                   {
                                       strcat(tampon, (i != 0) ? "0110" : "110");
                                       break;
                                   }
                                   case '7' :
                                   {
                                       strcat(tampon, (i != 0) ? "0111" : "111");
                                       break;
                                   }
                                   case '8' :
                                   {
                                       strcat(tampon, "1000");
                                       break;
                                   }
                                   case '9' :
                                   {
                                       strcat(tampon, "1001");
                                       break;
                                   }
                                   case 'A' :
                                   {
                                       strcat(tampon, "1010");
                                       break;
                                   }
                                   case 'B' :
                                   {
                                       strcat(tampon, "1011");
                                       break;
                                   }
                                   case 'C' :
                                   {
                                       strcat(tampon, "1100");
                                       break;
                                   }
                                   case 'D' :
                                   {
                                       strcat(tampon, "1101");
                                       break;
                                   }
                                   case 'E' :
                                   {
                                       strcat(tampon, "1110");
                                       break;
                                   }
                                   case 'F' :
                                   {
                                       strcat(tampon, "1111");
                                       break;
                                   }
                               }
                           }
   
                 if (test_cfsf(s_etat_processus, 43) == d_vrai)                          free(chaine);
                 {                          strcpy(base, "b");
                     strcpy(base, "h");                          break;
                 }                      }
                 else  
                 {  
                     chaine = (unsigned char *) malloc((strlen(tampon) + 1)  
                             * sizeof(unsigned char));  
   
                     if (chaine == NULL)                      case 8:
                     {                      {
                         (*s_etat_processus).erreur_systeme =                          sprintf(tampon, "%llo", (*((logical8 *)
                                 d_es_allocation_memoire;                                  ((*s_objet).objet))));
                         return(NULL);                          strcpy(base, "o");
                           break;
                     }                      }
   
                     strcpy(chaine, tampon);                      case 10:
                     tampon[0] = 0;                      {
                           sprintf(tampon, "%llu", (*((logical8 *)
                                   ((*s_objet).objet))));
                           strcpy(base, "d");
                           break;
                       }
   
                     for(i = 0; i < strlen(chaine); i++)                      case 16:
                     {                      {
                         switch(chaine[i])                          sprintf(tampon, "%llX", (*((logical8 *)
                         {                                  ((*s_objet).objet))));
                             case '0' :                          strcpy(base, "h");
                             {                          break;
                                 strcat(tampon, (i != 0) ? "0000" : "0");  
                                 break;  
                             }  
                             case '1' :  
                             {  
                                     strcat(tampon, (i != 0) ? "0001" : "1");  
                                 break;  
                             }  
                             case '2' :  
                             {  
                                 strcat(tampon, (i != 0) ? "0010" : "10");  
                                 break;  
                             }  
                             case '3' :  
                             {  
                                 strcat(tampon, (i != 0) ? "0011" : "11");  
                                 break;  
                             }  
                             case '4' :  
                             {  
                                 strcat(tampon, (i != 0) ? "0100" : "100");  
                                 break;  
                             }  
                             case '5' :  
                             {  
                                 strcat(tampon, (i != 0) ? "0101" : "101");  
                                 break;  
                             }  
                             case '6' :  
                             {  
                                 strcat(tampon, (i != 0) ? "0110" : "110");  
                                 break;  
                             }  
                             case '7' :  
                             {  
                                 strcat(tampon, (i != 0) ? "0111" : "111");  
                                 break;  
                             }  
                             case '8' :  
                             {  
                                 strcat(tampon, "1000");  
                                 break;  
                             }  
                             case '9' :  
                             {  
                                 strcat(tampon, "1001");  
                                 break;  
                             }  
                             case 'A' :  
                             {  
                                 strcat(tampon, "1010");  
                                 break;  
                             }  
                             case 'B' :  
                             {  
                                 strcat(tampon, "1011");  
                                 break;  
                             }  
                             case 'C' :  
                             {  
                                 strcat(tampon, "1100");  
                                 break;  
                             }  
                             case 'D' :  
                             {  
                                 strcat(tampon, "1101");  
                                 break;  
                             }  
                             case 'E' :  
                             {  
                                 strcat(tampon, "1110");  
                                 break;  
                             }  
                             case 'F' :  
                             {  
                                 strcat(tampon, "1111");  
                                 break;  
                             }  
                         }  
                     }                      }
   
                     free(chaine);                      default:
                     strcpy(base, "b");                      {
                           (*s_etat_processus).erreur_execution =
                                   d_ex_erreur_format_fichier;
                           return(NULL);
                       }
                   }
               }
   
               if (format_sortie == 'B')
               {
                   if ((longueur_champ > 0) && (longueur_champ
                           < (signed) strlen(tampon)))
                   {
                       ptrl = &(tampon[strlen(tampon) - longueur_champ]);
                       ptre = tampon;
   
                       do
                       {
                           *ptre++ = *ptrl++;
                       } while((*ptrl) != d_code_fin_chaine);
   
                       (*ptre) = d_code_fin_chaine;
                 }                  }
             }              }
   
Line 1162  formateur_fichier(struct_processus *s_et Line 1191  formateur_fichier(struct_processus *s_et
 --------------------------------------------------------------------------------  --------------------------------------------------------------------------------
 */  */
   
             if (format_sortie != 'C')              if ((format_sortie != 'C') && (format_sortie != 'N'))
             {              {
                 (*s_etat_processus).erreur_execution =                  (*s_etat_processus).erreur_execution =
                         d_ex_erreur_format_fichier;                          d_ex_erreur_format_fichier;
Line 1172  formateur_fichier(struct_processus *s_et Line 1201  formateur_fichier(struct_processus *s_et
             longueur_reelle_chaine = longueur_chaine(s_etat_processus,              longueur_reelle_chaine = longueur_chaine(s_etat_processus,
                     (unsigned char *) (*s_objet).objet);                      (unsigned char *) (*s_objet).objet);
   
               if (format_sortie == 'N')
               {
                   longueur_champ = -1;
               }
   
             if ((longueur_champ == -1) || (longueur_reelle_chaine <              if ((longueur_champ == -1) || (longueur_reelle_chaine <
                     longueur_champ))                      longueur_champ))
             {              {
Line 1216  formateur_fichier(struct_processus *s_et Line 1250  formateur_fichier(struct_processus *s_et
 --------------------------------------------------------------------------------  --------------------------------------------------------------------------------
 */  */
   
               if (format_sortie == 'N')
               {
                   format_sortie = 'S';
               }
   
             if ((format_sortie != 'S') && (format_sortie != 'F') &&              if ((format_sortie != 'S') && (format_sortie != 'F') &&
                     (format_sortie != 'I') && (format_sortie != 'E'))                      (format_sortie != 'I') && (format_sortie != 'E'))
             {              {
Line 1253  formateur_fichier(struct_processus *s_et Line 1292  formateur_fichier(struct_processus *s_et
 --------------------------------------------------------------------------------  --------------------------------------------------------------------------------
 */  */
   
               if (format_sortie != 'N')
               {
                   (*s_etat_processus).erreur_execution =
                           d_ex_erreur_format_fichier;
                   return(NULL);
               }
   
             l_element_courant = (struct_liste_chainee *) ((*s_objet).objet);              l_element_courant = (struct_liste_chainee *) ((*s_objet).objet);
             chaine_sauvegarde = chaine;              chaine_sauvegarde = chaine;
   
Line 1335  formateur_fichier(struct_processus *s_et Line 1381  formateur_fichier(struct_processus *s_et
 --------------------------------------------------------------------------------  --------------------------------------------------------------------------------
 */  */
   
               if (format_sortie == 'N')
               {
                   format_sortie = 'S';
               }
   
             if ((format_sortie != 'S') && (format_sortie != 'F') &&              if ((format_sortie != 'S') && (format_sortie != 'F') &&
                     (format_sortie != 'I') && (format_sortie != 'E'))                      (format_sortie != 'I') && (format_sortie != 'E'))
             {              {
Line 1372  formateur_fichier(struct_processus *s_et Line 1423  formateur_fichier(struct_processus *s_et
 --------------------------------------------------------------------------------  --------------------------------------------------------------------------------
 */  */
   
               if (format_sortie != 'N')
               {
                   (*s_etat_processus).erreur_execution =
                           d_ex_erreur_format_fichier;
                   return(NULL);
               }
   
             chaine = (unsigned char *) malloc((strlen((*((struct_fonction *)              chaine = (unsigned char *) malloc((strlen((*((struct_fonction *)
                     ((*s_objet).objet))).nom_fonction) + 1) *                      ((*s_objet).objet))).nom_fonction) + 1) *
                     sizeof(unsigned char));                      sizeof(unsigned char));
Line 1419  formateur_fichier(struct_processus *s_et Line 1477  formateur_fichier(struct_processus *s_et
                 {                  {
                     chaine_sauvegarde = chaine;                      chaine_sauvegarde = chaine;
   
                     if ((chaine_formatee = formateur_fichier(s_etat_processus,                      if (format_sortie != 'N')
                             (*l_element_courant).donnee,  
                             (*l_element_courant_format).donnee,  
                             0, 0, ' ', 'F', longueur_effective, recursivite,  
                             export_fichier)) == NULL)  
                     {                      {
                         return(NULL);                          if ((chaine_formatee =
                                   formateur_fichier(s_etat_processus,
                                   (*l_element_courant).donnee,
                                   (*l_element_courant_format).donnee,
                                   0, 0, ' ', 'F', longueur_effective, recursivite,
                                   export_fichier)) == NULL)
                           {
                               return(NULL);
                           }
                       }
                       else
                       {
                           if ((chaine_formatee =
                                   formateur_fichier(s_etat_processus,
                                   (*l_element_courant).donnee,
                                   (*l_element_courant_format).donnee,
                                   0, 0, 'N', 'F', longueur_effective, recursivite,
                                   export_fichier)) == NULL)
                           {
                               return(NULL);
                           }
                     }                      }
   
                     chaine = (unsigned char *) malloc((strlen(chaine_formatee)                      chaine = (unsigned char *) malloc((strlen(chaine_formatee)
Line 1498  formateur_fichier(struct_processus *s_et Line 1572  formateur_fichier(struct_processus *s_et
                         position_1 = 10;                          position_1 = 10;
                         format_degenere = d_vrai;                          format_degenere = d_vrai;
                     }                      }
                       else if (strcmp("NATIVE*(*)", format_chaine) == 0)
                       {
                           format_sortie = 'N';
                           position_1 = 7;
                           format_degenere = d_vrai;
                       }
                     else                      else
                     {                      {
                         free(chaine);                          free(chaine);
Line 1578  formateur_fichier(struct_processus *s_et Line 1658  formateur_fichier(struct_processus *s_et
                     }                      }
   
                     if ((longueur >= 0) && (longueur_champ >= 0) && (longueur >                      if ((longueur >= 0) && (longueur_champ >= 0) && (longueur >
                             longueur_champ))                              longueur_champ) && (format_sortie != 'B'))
                     {                      {
                         free(chaine);                          free(chaine);
                         free(format_chaine);                          free(format_chaine);
Line 1665  formateur_fichier(struct_processus *s_et Line 1745  formateur_fichier(struct_processus *s_et
   
                 nombre_elements++;                  nombre_elements++;
                 l_element_courant = (*l_element_courant).suivant;                  l_element_courant = (*l_element_courant).suivant;
                 l_element_courant_format = (*l_element_courant_format).suivant;  
                   if (format_sortie != 'N')
                   {
                       l_element_courant_format =
                               (*l_element_courant_format).suivant;
                   }
             }              }
   
             if ((l_element_courant != NULL) ||              // Dans le cas où le format de sortie n'est pas du type
                     (l_element_courant_format != NULL))              // NATIVE*(*), on vérifie que tous les éléments du format et
               // de la liste d'arguments ont été consommés.
   
               if (format_sortie != 'N')
             {              {
                 free(chaine);                  if ((l_element_courant != NULL) ||
                           (l_element_courant_format != NULL))
                   {
                       free(chaine);
   
                 (*s_etat_processus).erreur_execution =                      (*s_etat_processus).erreur_execution =
                         d_ex_erreur_format_fichier;                              d_ex_erreur_format_fichier;
                 return(NULL);                      return(NULL);
                   }
             }              }
   
             chaine_sauvegarde = chaine;              chaine_sauvegarde = chaine;
Line 1701  formateur_fichier(struct_processus *s_et Line 1793  formateur_fichier(struct_processus *s_et
 --------------------------------------------------------------------------------  --------------------------------------------------------------------------------
 */  */
   
             if ((*s_format).type != TBL)              if (((*s_format).type != TBL) && (format_sortie != 'N'))
             {              {
                 (*s_etat_processus).erreur_execution =                  (*s_etat_processus).erreur_execution =
                         d_ex_erreur_format_fichier;                          d_ex_erreur_format_fichier;
                 return(NULL);                  return(NULL);
             }              }
   
             l_element_courant = (struct_liste_chainee *) (*s_objet).objet;              if (format_sortie != 'N')
             l_element_courant_format = (struct_liste_chainee *)  
                     (*s_format).objet;  
   
             if ((*((struct_tableau *) (*s_objet).objet)).nombre_elements !=  
                     (*((struct_tableau *) (*s_format).objet)).nombre_elements)  
             {              {
                 (*s_etat_processus).erreur_execution =                  if ((*((struct_tableau *) (*s_objet).objet)).nombre_elements !=
                         d_ex_erreur_format_fichier;                          (*((struct_tableau *) (*s_format).objet))
                 return(NULL);                          .nombre_elements)
                   {
                       (*s_etat_processus).erreur_execution =
                               d_ex_erreur_format_fichier;
                       return(NULL);
                   }
             }              }
   
             chaine = (unsigned char *) malloc(3 * sizeof(unsigned char));              chaine = (unsigned char *) malloc(3 * sizeof(unsigned char));
Line 1733  formateur_fichier(struct_processus *s_et Line 1825  formateur_fichier(struct_processus *s_et
             for(i = 0; i < (*((struct_tableau *) (*s_objet).objet))              for(i = 0; i < (*((struct_tableau *) (*s_objet).objet))
                     .nombre_elements; i++)                      .nombre_elements; i++)
             {              {
                 if ((((*(*((struct_tableau *) (*s_format).objet))                  if (format_sortie != 'N')
                         .elements[i]).type == LST) &&  
                         ((*(*((struct_tableau *) (*s_objet).objet)).elements[i])  
                         .type == LST)) ||  
                         (((*(*((struct_tableau *) (*s_format).objet))  
                         .elements[i]).type == TBL) &&  
                         ((*(*((struct_tableau *) (*s_objet).objet)).elements[i])  
                         .type == TBL)))  
                 {                  {
                     chaine_sauvegarde = chaine;                      if ((((*(*((struct_tableau *) (*s_format).objet))
                               .elements[i]).type == LST) &&
                     if ((chaine_formatee = formateur_fichier(s_etat_processus,                              ((*(*((struct_tableau *) (*s_objet).objet))
                             (*l_element_courant).donnee,                              .elements[i]).type == LST)) ||
                             (*l_element_courant_format).donnee,                              (((*(*((struct_tableau *) (*s_format).objet))
                             0, 0, ' ', 'F', longueur_effective, recursivite,                              .elements[i]).type == TBL) &&
                             export_fichier)) == NULL)                              ((*(*((struct_tableau *) (*s_objet).objet))
                               .elements[i]).type == TBL)))
                     {                      {
                         return(NULL);                          chaine_sauvegarde = chaine;
                     }  
   
                     chaine = (unsigned char *) malloc((strlen(chaine_formatee)  
                             + strlen(chaine_sauvegarde) + 2)  
                             * sizeof(unsigned char));  
   
                     if (chaine == NULL)  
                     {  
                         (*s_etat_processus).erreur_systeme =  
                                 d_es_allocation_memoire;  
                         return(NULL);  
                     }  
   
                     strcpy(chaine, chaine_sauvegarde);  
                     free(chaine_sauvegarde);  
                     strcat(chaine, " ");  
                     strcat(chaine, chaine_formatee);  
                     free(chaine_formatee);  
                 }  
                 else if ((*(*((struct_tableau *) (*s_format).objet))  
                         .elements[i]).type != CHN)  
                 {  
                     free(chaine);  
   
                     (*s_etat_processus).erreur_execution =                          if ((chaine_formatee = formateur_fichier(
                             d_ex_erreur_format_fichier;                                  s_etat_processus,
                     return(NULL);                                  (*(*((struct_tableau *) (*s_objet).objet))
                 }                                  .elements[i]).objet,
                 else                                  (*(*((struct_tableau *) (*s_format).objet))
                 {                                  .elements[i]).objet,
                     if ((format_chaine = conversion_majuscule((unsigned char *)                                  0, 0, ' ', 'F', longueur_effective, recursivite,
                             (*(*((struct_tableau *) (*s_format).objet))                                  export_fichier)) == NULL)
                             .elements[i]).objet)) == NULL)                          {
                     {                              return(NULL);
                         (*s_etat_processus).erreur_systeme =                          }
                                 d_es_allocation_memoire;  
                         return(NULL);  
                     }  
   
                     format_degenere = d_faux;                          if ((chaine = (unsigned char *) malloc((strlen(
                                   chaine_formatee) + strlen(chaine_sauvegarde)
                                   + 2) * sizeof(unsigned char))) == NULL)
                           {
                               (*s_etat_processus).erreur_systeme =
                                       d_es_allocation_memoire;
                               return(NULL);
                           }
   
                     if (strncmp("STANDARD*", format_chaine, 9) == 0)                          strcpy(chaine, chaine_sauvegarde);
                     {                          free(chaine_sauvegarde);
                         format_sortie = 'S';                          strcat(chaine, " ");
                         position_1 = 9;                          strcat(chaine, chaine_formatee);
                         format_degenere = d_vrai;                          free(chaine_formatee);
                     }  
                     else if (strncmp("BINARY*", format_chaine, 7) == 0)  
                     {  
                         format_sortie = 'B';  
                         position_1 = 7;  
                     }  
                     else if (strncmp("FIXED*", format_chaine, 6) == 0)  
                     {  
                         format_sortie = 'F';  
                         position_1 = 6;  
                     }  
                     else if (strncmp("SCIENTIFIC*", format_chaine, 11) == 0)  
                     {  
                         format_sortie = 'I';  
                         position_1 = 11;  
                     }  
                     else if (strncmp("ENGINEER*", format_chaine, 9) == 0)  
                     {  
                         format_sortie = 'E';  
                         position_1 = 9;  
                     }  
                     else if (strncmp("CHARACTER*", format_chaine, 10) == 0)  
                     {  
                         format_sortie = 'C';  
                         position_1 = 10;  
                         format_degenere = d_vrai;  
                     }                      }
                     else                      else if ((*(*((struct_tableau *) (*s_format).objet))
                               .elements[i]).type != CHN)
                     {                      {
                         free(chaine);                          free(chaine);
                         free(format_chaine);  
   
                         (*s_etat_processus).erreur_execution =                          (*s_etat_processus).erreur_execution =
                                 d_ex_erreur_format_fichier;                                  d_ex_erreur_format_fichier;
                         return(NULL);                          return(NULL);
                     }                      }
                       else
                       {
                           if ((format_chaine = conversion_majuscule(
                                   (unsigned char *) (*(*((struct_tableau *)
                                   (*s_format).objet)).elements[i]).objet))
                                   == NULL)
                           {
                               (*s_etat_processus).erreur_systeme =
                                       d_es_allocation_memoire;
                               return(NULL);
                           }
   
                     position_3 = strlen(format_chaine);                          format_degenere = d_faux;
                     format_chaine[--position_3] = d_code_fin_chaine;  
   
                     position_2 = position_1;  
   
                     while(format_chaine[position_2] != '(')                          if (strncmp("STANDARD*", format_chaine, 9) == 0)
                     {                          {
                         if (format_chaine[position_2] == d_code_fin_chaine)                              format_sortie = 'S';
                               position_1 = 9;
                               format_degenere = d_vrai;
                           }
                           else if (strncmp("BINARY*", format_chaine, 7) == 0)
                           {
                               format_sortie = 'B';
                               position_1 = 7;
                           }
                           else if (strncmp("FIXED*", format_chaine, 6) == 0)
                           {
                               format_sortie = 'F';
                               position_1 = 6;
                           }
                           else if (strncmp("SCIENTIFIC*", format_chaine, 11) == 0)
                           {
                               format_sortie = 'I';
                               position_1 = 11;
                           }
                           else if (strncmp("ENGINEER*", format_chaine, 9) == 0)
                           {
                               format_sortie = 'E';
                               position_1 = 9;
                           }
                           else if (strncmp("CHARACTER*", format_chaine, 10) == 0)
                           {
                               format_sortie = 'C';
                               position_1 = 10;
                               format_degenere = d_vrai;
                           }
                           else if (strcmp("NATIVE*(*)", format_chaine) == 0)
                           {
                               format_sortie = 'N';
                               position_1 = 7;
                               format_degenere = d_vrai;
                           }
                           else
                         {                          {
                             free(chaine);                              free(chaine);
                             free(format_chaine);                              free(format_chaine);
Line 1851  formateur_fichier(struct_processus *s_et Line 1936  formateur_fichier(struct_processus *s_et
                             return(NULL);                              return(NULL);
                         }                          }
   
                         position_2++;                          position_3 = strlen(format_chaine);
                     }                          format_chaine[--position_3] = d_code_fin_chaine;
   
                     format_chaine[position_2++] = d_code_fin_chaine;                          position_2 = position_1;
   
                     if (format_degenere == d_faux)                          while(format_chaine[position_2] != '(')
                     {  
                         if (sscanf(&(format_chaine[position_1]), "%ld",  
                                 &longueur) != 1)  
                         {                          {
                             free(chaine);                              if (format_chaine[position_2] == d_code_fin_chaine)
                             free(format_chaine);                              {
                                   free(chaine);
                                   free(format_chaine);
   
                             (*s_etat_processus).erreur_execution =                                  (*s_etat_processus).erreur_execution =
                                     d_ex_erreur_format_fichier;                                          d_ex_erreur_format_fichier;
                             return(NULL);                                  return(NULL);
                               }
   
                               position_2++;
                         }                          }
                     }  
                     else  
                     {  
                         longueur = -1;  
                     }  
   
                     if (strcmp(&(format_chaine[position_2]), "*") != 0)                          format_chaine[position_2++] = d_code_fin_chaine;
                     {  
                         if (sscanf(&(format_chaine[position_2]), "%ld",                          if (format_degenere == d_faux)
                                 &longueur_champ) != 1)                          {
                               if (sscanf(&(format_chaine[position_1]), "%ld",
                                       &longueur) != 1)
                               {
                                   free(chaine);
                                   free(format_chaine);
   
                                   (*s_etat_processus).erreur_execution =
                                           d_ex_erreur_format_fichier;
                                   return(NULL);
                               }
                           }
                           else
                           {
                               longueur = -1;
                           }
   
                           if (strcmp(&(format_chaine[position_2]), "*") != 0)
                           {
                               if (sscanf(&(format_chaine[position_2]), "%ld",
                                       &longueur_champ) != 1)
                               {
                                   free(chaine);
                                   free(format_chaine);
   
                                   (*s_etat_processus).erreur_execution =
                                           d_ex_erreur_format_fichier;
                                   return(NULL);
                               }
                           }
                           else
                           {
                               longueur_champ = -1;
                           }
   
                           if ((longueur >= 0) && (longueur_champ >= 0) &&
                                   (longueur > longueur_champ))
                         {                          {
                             free(chaine);                              free(chaine);
                             free(format_chaine);                              free(format_chaine);
Line 1886  formateur_fichier(struct_processus *s_et Line 2004  formateur_fichier(struct_processus *s_et
                                     d_ex_erreur_format_fichier;                                      d_ex_erreur_format_fichier;
                             return(NULL);                              return(NULL);
                         }                          }
                     }  
                     else  
                     {  
                         longueur_champ = -1;  
                     }  
   
                     if ((longueur >= 0) && (longueur_champ >= 0) && (longueur >  
                             longueur_champ))  
                     {  
                         free(chaine);  
                         free(format_chaine);                          free(format_chaine);
                       
                           chaine_sauvegarde = chaine;
   
                         (*s_etat_processus).erreur_execution =                          if ((chaine_formatee = formateur_fichier(
                                 d_ex_erreur_format_fichier;                                  s_etat_processus, (*((struct_tableau *)
                         return(NULL);                                  (*s_objet).objet)).elements[i], s_format,
                                   longueur, longueur_champ, format_sortie, type,
                                   longueur_effective, recursivite,
                                   export_fichier)) == NULL)
                           {
                               return(NULL);
                           }
                     }                      }
                   }
                     free(format_chaine);                  else // NATIVE*(*)
                                   {
                     chaine_sauvegarde = chaine;                      chaine_sauvegarde = chaine;
   
                     if ((chaine_formatee = formateur_fichier(s_etat_processus,                      if ((chaine_formatee = formateur_fichier(
                             (*((struct_tableau *) (*s_objet).objet))                              s_etat_processus, (*((struct_tableau *)
                             .elements[i], s_format,                              (*s_objet).objet)).elements[i], s_format,
                             longueur, longueur_champ, format_sortie, type,                              longueur, longueur_champ, format_sortie, type,
                             longueur_effective, recursivite, export_fichier))                              longueur_effective, recursivite,
                             == NULL)                              export_fichier)) == NULL)
                     {                      {
                         return(NULL);                          return(NULL);
                     }                      }
                   }
   
                     if ((*(*((struct_tableau *) (*s_objet).objet))                  if ((*(*((struct_tableau *) (*s_objet).objet))
                             .elements[i]).type == CHN)                          .elements[i]).type == CHN)
                     {                  {
                         chaine = (unsigned char *)                      chaine = (unsigned char *)
                                 malloc((strlen(chaine_formatee)                              malloc((strlen(chaine_formatee)
                                 + strlen(chaine_sauvegarde) + 4)                              + strlen(chaine_sauvegarde) + 4)
                                 * sizeof(unsigned char));                              * sizeof(unsigned char));
   
                         if (chaine == NULL)  
                         {  
                             (*s_etat_processus).erreur_systeme =  
                                     d_es_allocation_memoire;  
                             return(NULL);  
                         }  
   
                         strcpy(chaine, chaine_sauvegarde);                      if (chaine == NULL)
                         free(chaine_sauvegarde);  
                         strcat(chaine, " \"");  
                         strcat(chaine, chaine_formatee);  
                         free(chaine_formatee);  
                         strcat(chaine, "\"");  
                     }  
                     else if ((*(*((struct_tableau *) (*s_objet).objet))  
                             .elements[i]).type == NOM)  
                     {                      {
                         chaine = (unsigned char *)                          (*s_etat_processus).erreur_systeme =
                                 malloc((strlen(chaine_formatee)                                  d_es_allocation_memoire;
                                 + strlen(chaine_sauvegarde) + 2)                          return(NULL);
                                 * sizeof(unsigned char));                      }
   
                         if (chaine == NULL)                      strcpy(chaine, chaine_sauvegarde);
                         {                      free(chaine_sauvegarde);
                             (*s_etat_processus).erreur_systeme =                      strcat(chaine, " \"");
                                     d_es_allocation_memoire;                      strcat(chaine, chaine_formatee);
                             return(NULL);                      free(chaine_formatee);
                         }                      strcat(chaine, "\"");
                   }
                   else if ((*(*((struct_tableau *) (*s_objet).objet))
                           .elements[i]).type == NOM)
                   {
                       chaine = (unsigned char *)
                               malloc((strlen(chaine_formatee)
                               + strlen(chaine_sauvegarde) + 2)
                               * sizeof(unsigned char));
   
                         sprintf(chaine, "%s %s", chaine_sauvegarde,                      if (chaine == NULL)
                                 chaine_formatee);  
                         free(chaine_formatee);  
                     }  
                     else  
                     {                      {
                         chaine = (unsigned char *)                          (*s_etat_processus).erreur_systeme =
                                 malloc((strlen(chaine_formatee)                                  d_es_allocation_memoire;
                                 + strlen(chaine_sauvegarde) + 2)                          return(NULL);
                                 * sizeof(unsigned char));                      }
   
                         if (chaine == NULL)                      sprintf(chaine, "%s %s", chaine_sauvegarde,
                         {                              chaine_formatee);
                             (*s_etat_processus).erreur_systeme =                      free(chaine_formatee);
                                     d_es_allocation_memoire;                  }
                             return(NULL);                  else
                         }                  {
                       chaine = (unsigned char *)
                               malloc((strlen(chaine_formatee)
                               + strlen(chaine_sauvegarde) + 2)
                               * sizeof(unsigned char));
   
                         strcpy(chaine, chaine_sauvegarde);                      if (chaine == NULL)
                         free(chaine_sauvegarde);                      {
                         strcat(chaine, " ");                          (*s_etat_processus).erreur_systeme =
                         strcat(chaine, chaine_formatee);                                  d_es_allocation_memoire;
                         free(chaine_formatee);                          return(NULL);
                     }                      }
   
                       strcpy(chaine, chaine_sauvegarde);
                       free(chaine_sauvegarde);
                       strcat(chaine, " ");
                       strcat(chaine, chaine_formatee);
                       free(chaine_formatee);
                 }                  }
             }              }
   
Line 2004  formateur_fichier(struct_processus *s_et Line 2121  formateur_fichier(struct_processus *s_et
 --------------------------------------------------------------------------------  --------------------------------------------------------------------------------
 */  */
   
               if (format_sortie == 'N')
               {
                   format_sortie = 'S';
               }
   
             if ((format_sortie != 'S') && (format_sortie != 'F') &&              if ((format_sortie != 'S') && (format_sortie != 'F') &&
                     (format_sortie != 'I') && (format_sortie != 'E'))                      (format_sortie != 'I') && (format_sortie != 'E'))
             {              {
Line 2147  formateur_fichier(struct_processus *s_et Line 2269  formateur_fichier(struct_processus *s_et
 --------------------------------------------------------------------------------  --------------------------------------------------------------------------------
 */  */
   
               if (format_sortie == 'N')
               {
                   format_sortie = 'S';
               }
   
             if ((format_sortie != 'S') && (format_sortie != 'F') &&              if ((format_sortie != 'S') && (format_sortie != 'F') &&
                     (format_sortie != 'I') && (format_sortie != 'E'))                      (format_sortie != 'I') && (format_sortie != 'E'))
             {              {
Line 2289  formateur_fichier(struct_processus *s_et Line 2416  formateur_fichier(struct_processus *s_et
 --------------------------------------------------------------------------------  --------------------------------------------------------------------------------
 */  */
   
               if (format_sortie == 'N')
               {
                   format_sortie = 'S';
               }
   
             if ((format_sortie != 'S') && (format_sortie != 'F') &&              if ((format_sortie != 'S') && (format_sortie != 'F') &&
                     (format_sortie != 'I') && (format_sortie != 'E'))                      (format_sortie != 'I') && (format_sortie != 'E'))
             {              {
Line 2431  formateur_fichier(struct_processus *s_et Line 2563  formateur_fichier(struct_processus *s_et
 --------------------------------------------------------------------------------  --------------------------------------------------------------------------------
 */  */
   
               if (format_sortie != 'N')
               {
                   (*s_etat_processus).erreur_execution =
                           d_ex_erreur_format_fichier;
                   return(NULL);
               }
   
             chaine = (unsigned char *) malloc((strlen((*((struct_nom *)              chaine = (unsigned char *) malloc((strlen((*((struct_nom *)
                     (*s_objet).objet)).nom) + 3) * sizeof(unsigned char));                      (*s_objet).objet)).nom) + 3) * sizeof(unsigned char));
   
Line 2451  formateur_fichier(struct_processus *s_et Line 2590  formateur_fichier(struct_processus *s_et
 --------------------------------------------------------------------------------  --------------------------------------------------------------------------------
 */  */
   
               if (format_sortie == 'N')
               {
                   format_sortie = 'S';
               }
   
             if ((format_sortie != 'S') && (format_sortie != 'F') &&              if ((format_sortie != 'S') && (format_sortie != 'F') &&
                     (format_sortie != 'I') && (format_sortie != 'E'))                      (format_sortie != 'I') && (format_sortie != 'E'))
             {              {
Line 2488  formateur_fichier(struct_processus *s_et Line 2632  formateur_fichier(struct_processus *s_et
 --------------------------------------------------------------------------------  --------------------------------------------------------------------------------
 */  */
   
               if (format_sortie == 'N')
               {
                   format_sortie = 'S';
               }
   
             if ((format_sortie != 'S') && (format_sortie != 'F') &&              if ((format_sortie != 'S') && (format_sortie != 'F') &&
                     (format_sortie != 'I') && (format_sortie != 'E'))                      (format_sortie != 'I') && (format_sortie != 'E'))
             {              {
Line 2564  formateur_fichier(struct_processus *s_et Line 2713  formateur_fichier(struct_processus *s_et
 --------------------------------------------------------------------------------  --------------------------------------------------------------------------------
 */  */
   
               if (format_sortie == 'N')
               {
                   format_sortie = 'S';
               }
   
             if ((format_sortie != 'S') && (format_sortie != 'F') &&              if ((format_sortie != 'S') && (format_sortie != 'F') &&
                     (format_sortie != 'I') && (format_sortie != 'E'))                      (format_sortie != 'I') && (format_sortie != 'E'))
             {              {
Line 2639  formateur_fichier(struct_processus *s_et Line 2793  formateur_fichier(struct_processus *s_et
 --------------------------------------------------------------------------------  --------------------------------------------------------------------------------
 */  */
   
               if (format_sortie == 'N')
               {
                   format_sortie = 'S';
               }
   
             if ((format_sortie != 'S') && (format_sortie != 'F') &&              if ((format_sortie != 'S') && (format_sortie != 'F') &&
                     (format_sortie != 'I') && (format_sortie != 'E'))                      (format_sortie != 'I') && (format_sortie != 'E'))
             {              {
Line 2873  formateur_fichier(struct_processus *s_et Line 3032  formateur_fichier(struct_processus *s_et
          * 1101 10 11               matrice complex*16 (dimensions integer*4)           * 1101 10 11               matrice complex*16 (dimensions integer*4)
          * 1101 11 11               matrice complex*16 (dimensions integer*8)           * 1101 11 11               matrice complex*16 (dimensions integer*8)
          *           *
            * 1110 0 XXX               fonction de longueur XXX
            * 1110 10 LL               fonction de longueur integer*LL
            *
          * Les longueurs indiquées par le champ LL suivent l'en-tête :           * Les longueurs indiquées par le champ LL suivent l'en-tête :
          *      00 : integer*1           *      00 : integer*1
          *      01 : integer*2           *      01 : integer*2
Line 2899  formateur_fichier(struct_processus *s_et Line 3061  formateur_fichier(struct_processus *s_et
 --------------------------------------------------------------------------------  --------------------------------------------------------------------------------
 */  */
   
               if (format_sortie == 'N')
               {
                   format_sortie = 'L';
                   longueur_champ = 8;
               }
   
             if (format_sortie != 'L')              if (format_sortie != 'L')
             {              {
                 (*s_etat_processus).erreur_execution =                  (*s_etat_processus).erreur_execution =
Line 2945  formateur_fichier(struct_processus *s_et Line 3113  formateur_fichier(struct_processus *s_et
 --------------------------------------------------------------------------------  --------------------------------------------------------------------------------
 */  */
   
               if (format_sortie == 'N')
               {
                   format_sortie = 'S';
                   longueur_champ = -1;
               }
   
               if (format_sortie != 'S')
               {
                   (*s_etat_processus).erreur_execution =
                           d_ex_erreur_format_fichier;
                   return(NULL);
               }
   
             longueur_reelle_chaine = longueur_chaine(s_etat_processus,              longueur_reelle_chaine = longueur_chaine(s_etat_processus,
                     (unsigned char *) (*s_objet).objet);                      (unsigned char *) (*s_objet).objet);
   
Line 3100  formateur_fichier(struct_processus *s_et Line 3281  formateur_fichier(struct_processus *s_et
 --------------------------------------------------------------------------------  --------------------------------------------------------------------------------
 */  */
   
               if (format_sortie == 'N')
               {
                   format_sortie = 'C';
                   longueur = 8;
               }
   
             if (format_sortie != 'C')              if (format_sortie != 'C')
             {              {
                 (*s_etat_processus).erreur_execution =                  (*s_etat_processus).erreur_execution =
Line 3124  formateur_fichier(struct_processus *s_et Line 3311  formateur_fichier(struct_processus *s_et
 --------------------------------------------------------------------------------  --------------------------------------------------------------------------------
 */  */
   
               if (format_sortie == 'N')
               {
                   format_sortie = 'I';
                   longueur = 8;
               }
   
             if ((format_sortie != 'I') && (format_sortie != 'R')              if ((format_sortie != 'I') && (format_sortie != 'R')
                     && (format_sortie != 'C'))                      && (format_sortie != 'C'))
             {              {
Line 3145  formateur_fichier(struct_processus *s_et Line 3338  formateur_fichier(struct_processus *s_et
 /*  /*
 --------------------------------------------------------------------------------  --------------------------------------------------------------------------------
   Fonction    Fonction
     Poids fort 1110
 --------------------------------------------------------------------------------  --------------------------------------------------------------------------------
 */  */
   
               if (format_sortie != 'N')
               {
                   (*s_etat_processus).erreur_execution =
                           d_ex_erreur_format_fichier;
                   return(NULL);
               }
   
               longueur_fonction = strlen((*((struct_fonction *) (*s_objet).objet))
                       .nom_fonction);
   
               if (longueur_fonction < (1LL << 3))
               {
                   if ((chaine = malloc((1 + longueur_fonction + 8)
                           * sizeof(unsigned char)))== NULL)
                   {
                       (*s_etat_processus).erreur_systeme =
                               d_es_allocation_memoire;
                       return(NULL);
                   }
   
                   chaine[0] = 0xE0 | (longueur_fonction & 0x7);
   
                   strcpy(chaine + 1, (*((struct_fonction *) (*s_objet).objet))
                           .nom_fonction);
               }
               else if (longueur_fonction < (1LL << 8))
               {
                   if ((chaine = malloc((2 + longueur_fonction + 8)
                           * sizeof(unsigned char)))== NULL)
                   {
                       (*s_etat_processus).erreur_systeme =
                               d_es_allocation_memoire;
                       return(NULL);
                   }
   
                   chaine[0] = 0xE0 | 0x08;
                   chaine[1] = (unsigned char) (longueur_fonction & 0xFF);
   
                   strcpy(chaine + 2, (*((struct_fonction *) (*s_objet).objet))
                           .nom_fonction);
               }
               else if (longueur_fonction < (1LL << 16))
               {
                   if ((chaine = malloc((3 + longueur_fonction + 8)
                           * sizeof(unsigned char)))== NULL)
                   {
                       (*s_etat_processus).erreur_systeme =
                               d_es_allocation_memoire;
                       return(NULL);
                   }
   
                   chaine[0] = 0xE0 | 0x09;
                   chaine[1] = (unsigned char) ((longueur_fonction >> 8) & 0xFF);
                   chaine[2] = (unsigned char) (longueur_fonction & 0xFF);
   
                   strcpy(chaine + 3, (*((struct_fonction *) (*s_objet).objet))
                           .nom_fonction);
               }
               else if (longueur_fonction < (1LL << 32))
               {
                   if ((chaine = malloc((5 + longueur_fonction + 8)
                           * sizeof(unsigned char)))== NULL)
                   {
                       (*s_etat_processus).erreur_systeme =
                               d_es_allocation_memoire;
                       return(NULL);
                   }
   
                   chaine[0] = 0xE0 | 0x0A;
                   chaine[1] = (unsigned char) ((longueur_fonction >> 24) & 0xFF);
                   chaine[2] = (unsigned char) ((longueur_fonction >> 16) & 0xFF);
                   chaine[3] = (unsigned char) ((longueur_fonction >> 8) & 0xFF);
                   chaine[4] = (unsigned char) (longueur_fonction & 0xFF);
   
                   strcpy(chaine + 5, (*((struct_fonction *) (*s_objet).objet))
                           .nom_fonction);
               }
               else
               {
                   if ((chaine = malloc((9 + longueur_fonction + 8)
                           * sizeof(unsigned char)))== NULL)
                   {
                       (*s_etat_processus).erreur_systeme =
                               d_es_allocation_memoire;
                       return(NULL);
                   }
   
                   chaine[0] = 0xE0 | 0x0B;
                   chaine[1] = (unsigned char) ((longueur_fonction >> 56) & 0xFF);
                   chaine[2] = (unsigned char) ((longueur_fonction >> 48) & 0xFF);
                   chaine[3] = (unsigned char) ((longueur_fonction >> 40) & 0xFF);
                   chaine[4] = (unsigned char) ((longueur_fonction >> 32) & 0xFF);
                   chaine[5] = (unsigned char) ((longueur_fonction >> 24) & 0xFF);
                   chaine[6] = (unsigned char) ((longueur_fonction >> 16) & 0xFF);
                   chaine[7] = (unsigned char) ((longueur_fonction >> 8) & 0xFF);
                   chaine[8] = (unsigned char) (longueur_fonction & 0xFF);
   
                   strcpy(chaine + 9, (*((struct_fonction *) (*s_objet).objet))
                           .nom_fonction);
               }
   
               for(i = 1; i <= 8; i++)
               {
                   chaine[longueur_fonction + i] = (unsigned char)
                           (((*((struct_fonction *) (*s_objet).objet))
                           .nombre_arguments >> ((8 - i) * 8)) & 0xFF);
               }
   
               (*longueur_effective) = longueur_fonction + 9;
         }          }
         else if (((*s_objet).type == LST) || ((*s_objet).type == ALG)          else if (((*s_objet).type == LST) || ((*s_objet).type == ALG)
                 || ((*s_objet).type == RPN))                  || ((*s_objet).type == RPN))
Line 3403  formateur_fichier(struct_processus *s_et Line 3706  formateur_fichier(struct_processus *s_et
                         position_1 = 10;                          position_1 = 10;
                         format_degenere = d_vrai;                          format_degenere = d_vrai;
                     }                      }
                       else if (strcmp("NATIVE*(*)", format_chaine) == 0)
                       {
                           format_sortie = 'N';
                           position_1 = 7;
                           format_degenere = d_vrai;
                       }
                     else                      else
                     {                      {
                         free(chaine);                          free(chaine);
Line 3543  formateur_fichier(struct_processus *s_et Line 3852  formateur_fichier(struct_processus *s_et
 --------------------------------------------------------------------------------  --------------------------------------------------------------------------------
 */  */
   
               if (format_sortie == 'N')
               {
                   format_sortie = 'R';
                   longueur = 8;
               }
   
             if ((format_sortie != 'R') && (format_sortie != 'C'))              if ((format_sortie != 'R') && (format_sortie != 'C'))
             {              {
                 (*s_etat_processus).erreur_execution =                  (*s_etat_processus).erreur_execution =
Line 4131  formateur_fichier_binaire_nombre(struct_ Line 4446  formateur_fichier_binaire_nombre(struct_
                 case 4:                  case 4:
                 {                  {
                     if ((*((integer8 *) valeur_numerique)) !=                      if ((*((integer8 *) valeur_numerique)) !=
                             ((integer2) (*((integer8 *) valeur_numerique))))                              ((integer4) (*((integer8 *) valeur_numerique))))
                     {                      {
                         (*s_etat_processus).erreur_execution =                          (*s_etat_processus).erreur_execution =
                                 d_ex_representation;                                  d_ex_representation;
Line 4588  lecture_fichier_non_formate(struct_proce Line 4903  lecture_fichier_non_formate(struct_proce
     }      }
     else      else
     {      {
         buffer = argument;          buffer = (*((unsigned char **) argument));
         ptr = buffer;          ptr = buffer;
         fichier = NULL;          fichier = NULL;
     }      }
Line 5542  lecture_fichier_non_formate(struct_proce Line 5857  lecture_fichier_non_formate(struct_proce
             break;              break;
         }          }
   
           case 0xE0:  // Fonction
           {
               if ((octets[0] & 0x08) == 0)    // Longueur sur 6 bits
               {
                   longueur = (octets[0] & 0x07);
               }
               else
               {
                   switch(octets[0] & 0x07)
                   {
                       case 0x00:          // Longueur sur 8 bits
                       {
                           if (longueur_buffer < 0)
                           {
                               if (fread(octets, (size_t) sizeof(unsigned char),
                                       1, fichier) != 1)
                               {
                                   if (feof(fichier))
                                   {
                                       (*s_etat_processus).erreur_execution =
                                               d_ex_syntaxe;
                                   }
                                   else
                                   {
                                       (*s_etat_processus).erreur_systeme =
                                               d_es_erreur_fichier;
                                   }
   
                                   return(NULL);
                               }
                           }
                           else
                           {
                               if ((longueur_buffer - (ptr - buffer)) >= 1)
                               {
                                   octets[0] = *ptr++;
                               }
                               else
                               {
                                   (*s_etat_processus).erreur_execution =
                                           d_ex_syntaxe;
                                   return(NULL);
                               }
                           }
   
                           longueur = octets[0];
                           break;
                       }
   
                       case 0x01:          // Longueur sur 16 bits
                       {
                           if (longueur_buffer < 0)
                           {
                               if (fread(octets, (size_t) sizeof(unsigned char),
                                       2, fichier) != 2)
                               {
                                   if (feof(fichier))
                                   {
                                       (*s_etat_processus).erreur_execution =
                                               d_ex_syntaxe;
                                   }
                                   else
                                   {
                                       (*s_etat_processus).erreur_systeme =
                                               d_es_erreur_fichier;
                                   }
   
                                   return(NULL);
                               }
                           }
                           else
                           {
                               if ((longueur_buffer - (ptr - buffer)) >= 2)
                               {
                                   for(j = 0; j < 2; octets[j++] = *ptr++);
                               }
                               else
                               {
                                   (*s_etat_processus).erreur_execution =
                                           d_ex_syntaxe;
                                   return(NULL);
                               }
                           }
   
                           longueur = (((integer8) (octets[0])) << 8)
                                   | ((integer8) (octets[1]));
                           break;
                       }
   
                       case 0x02:          // Longueur sur 32 bits
                       {
                           if (longueur_buffer < 0)
                           {
                               if (fread(octets, (size_t) sizeof(unsigned char),
                                       4, fichier) != 4)
                               {
                                   if (feof(fichier))
                                   {
                                       (*s_etat_processus).erreur_execution =
                                               d_ex_syntaxe;
                                   }
                                   else
                                   {
                                       (*s_etat_processus).erreur_systeme =
                                               d_es_erreur_fichier;
                                   }
   
                                   return(NULL);
                               }
                           }
                           else
                           {
                               if ((longueur_buffer - (ptr - buffer)) >= 4)
                               {
                                   for(j = 0; j < 4; octets[j++] = *ptr++);
                               }
                               else
                               {
                                   (*s_etat_processus).erreur_execution =
                                           d_ex_syntaxe;
                                   return(NULL);
                               }
                           }
   
                           longueur = (((integer8) (octets[0])) << 24)
                                   | (((integer8) (octets[1])) << 16)
                                   | (((integer8) (octets[2])) << 8)
                                   | ((integer8) (octets[3]));
                           break;
                       }
   
                       case 0x03:          // Longueur sur 64 bits
                       {
                           if (longueur_buffer < 0)
                           {
                               if (fread(octets, (size_t) sizeof(unsigned char),
                                       8, fichier) != 8)
                               {
                                   if (feof(fichier))
                                   {
                                       (*s_etat_processus).erreur_execution =
                                               d_ex_syntaxe;
                                   }
                                   else
                                   {
                                       (*s_etat_processus).erreur_systeme =
                                               d_es_erreur_fichier;
                                   }
   
                                   return(NULL);
                               }
                           }
                           else
                           {
                               if ((longueur_buffer - (ptr - buffer)) >= 8)
                               {
                                   for(j = 0; j < 8; octets[j++] = *ptr++);
                               }
                               else
                               {
                                   (*s_etat_processus).erreur_execution =
                                           d_ex_syntaxe;
                                   return(NULL);
                               }
                           }
   
                           longueur = (((integer8) (octets[0])) << 56)
                                   | (((integer8) (octets[1])) << 48)
                                   | (((integer8) (octets[2])) << 40)
                                   | (((integer8) (octets[3])) << 32)
                                   | (((integer8) (octets[4])) << 24)
                                   | (((integer8) (octets[5])) << 16)
                                   | (((integer8) (octets[6])) << 8)
                                   | ((integer8) (octets[7]));
                           break;
                       }
   
                       default:
                       {
                           (*s_etat_processus).erreur_execution = d_ex_syntaxe;
                           return(NULL);
                       }
                   }
               }
   
               if ((s_objet = allocation(s_etat_processus, FCT)) == NULL)
               {
                   (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   return(NULL);
               }
   
               if (((*((struct_fonction *) (*s_objet).objet)).nom_fonction =
                       malloc((longueur + 1) * sizeof(unsigned char))) == NULL)
               {
                   (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   return(NULL);
               }
   
               if (longueur_buffer < 0)
               {
                   if (fread((unsigned char *) (*((struct_fonction *) (*s_objet)
                           .objet)).nom_fonction, (size_t) sizeof(unsigned char),
                           longueur, fichier) != (unsigned) longueur)
                   {
                       if (feof(fichier))
                       {
                           (*s_etat_processus).erreur_execution =
                                   d_ex_syntaxe;
                       }
                       else
                       {
                           (*s_etat_processus).erreur_systeme =
                                   d_es_erreur_fichier;
                       }
   
                       liberation(s_etat_processus, s_objet);
                       return(NULL);
                   }
   
                   if (fread(octets, (size_t) sizeof(unsigned char),
                           8, fichier) != 8)
                   {
                       if (feof(fichier))
                       {
                           (*s_etat_processus).erreur_execution =
                                   d_ex_syntaxe;
                       }
                       else
                       {
                           (*s_etat_processus).erreur_systeme =
                                   d_es_erreur_fichier;
                       }
   
                       liberation(s_etat_processus, s_objet);
                       return(NULL);
                   }
               }
               else
               {
                   if ((longueur_buffer - (ptr - buffer)) >= (longueur + 8))
                   {
                       for(j = 0; j < longueur; (*((struct_fonction *)
                               (*s_objet).objet)).nom_fonction[j] = *ptr++);
                       for(j = 0; j < 8; octets[j++] = *ptr++);
                   }
                   else
                   {
                       liberation(s_etat_processus, s_objet);
                       (*s_etat_processus).erreur_execution = d_ex_syntaxe;
                       return(NULL);
                   }
               }
   
               (*((struct_fonction *) (*s_objet).objet)).nom_fonction[longueur] =
                       d_code_fin_chaine;
               (*((struct_fonction *) (*s_objet).objet)).nombre_arguments =
                       (((integer8) (octets[0])) << 56)
                       | (((integer8) (octets[1])) << 48)
                       | (((integer8) (octets[2])) << 40)
                       | (((integer8) (octets[3])) << 32)
                       | (((integer8) (octets[4])) << 24)
                       | (((integer8) (octets[5])) << 16)
                       | (((integer8) (octets[6])) << 8)
                       | ((integer8) (octets[7]));
               break;
           }
   
         default:          default:
         {          {
             (*s_etat_processus).erreur_execution = d_ex_syntaxe;              (*s_etat_processus).erreur_execution = d_ex_syntaxe;
Line 5593  lecture_fichier_non_formate(struct_proce Line 6175  lecture_fichier_non_formate(struct_proce
         }          }
     }      }
   
       if (longueur_buffer >= 0)
       {
           (*((unsigned char **) argument)) = ptr;
       }
   
     return(s_objet);      return(s_objet);
 }  }
   

Removed from v.1.54  
changed lines
  Added in v.1.58


CVSweb interface <joel.bertrand@systella.fr>