version 1.55, 2013/03/15 11:37:25
|
version 1.57, 2013/03/18 15:53:48
|
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; |
Line 113 formateur_fichier(struct_processus *s_et
|
Line 114 formateur_fichier(struct_processus *s_et
|
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 132 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 141 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 990 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 1190 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 1200 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 1249 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 1291 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 1380 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 1422 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 1476 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 1571 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 1657 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 1744 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 1792 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 1824 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 1935 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 2003 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 2120 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 2268 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 2415 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 2562 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 2589 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 2631 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 2712 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 2792 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 2899 formateur_fichier(struct_processus *s_et
|
Line 3057 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 3109 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 3277 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 3307 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 3403 formateur_fichier(struct_processus *s_et
|
Line 3592 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 3738 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 = |