version 1.68, 2013/04/01 15:29:34
|
version 1.81, 2015/01/05 15:32:14
|
Line 1
|
Line 1
|
/* |
/* |
================================================================================ |
================================================================================ |
RPL/2 (R) version 4.1.14 |
RPL/2 (R) version 4.1.20 |
Copyright (C) 1989-2013 Dr. BERTRAND Joël |
Copyright (C) 1989-2015 Dr. BERTRAND Joël |
|
|
This file is part of RPL/2. |
This file is part of RPL/2. |
|
|
Line 20
|
Line 20
|
*/ |
*/ |
|
|
|
|
#define DEBUG_ERREURS |
|
#include "rpl-conv.h" |
#include "rpl-conv.h" |
|
|
|
|
Line 86 formateur_fichier(struct_processus *s_et
|
Line 85 formateur_fichier(struct_processus *s_et
|
struct_liste_chainee *l_liste1; |
struct_liste_chainee *l_liste1; |
struct_liste_chainee *l_liste2; |
struct_liste_chainee *l_liste2; |
|
|
|
struct_objet *s_format_tmp; |
struct_objet *s_sous_objet; |
struct_objet *s_sous_objet; |
struct_objet *s_sous_objet_1; |
struct_objet *s_sous_objet_1; |
struct_objet *s_sous_objet_2; |
struct_objet *s_sous_objet_2; |
Line 234 formateur_fichier(struct_processus *s_et
|
Line 234 formateur_fichier(struct_processus *s_et
|
.instruction_courante[1] |
.instruction_courante[1] |
== '-')) ? d_vrai : d_faux; |
== '-')) ? d_vrai : d_faux; |
|
|
|
(*s_etat_processus).type_en_cours = NON; |
recherche_type(s_etat_processus); |
recherche_type(s_etat_processus); |
|
|
if ((*s_etat_processus).erreur_execution != d_ex) |
if ((*s_etat_processus).erreur_execution != d_ex) |
Line 293 formateur_fichier(struct_processus *s_et
|
Line 294 formateur_fichier(struct_processus *s_et
|
if ((strcmp(chaine_fonction, "AND") == 0) || |
if ((strcmp(chaine_fonction, "AND") == 0) || |
(strcmp(chaine_fonction, "XOR") == |
(strcmp(chaine_fonction, "XOR") == |
0) || (strcmp(chaine_fonction, "OR") |
0) || (strcmp(chaine_fonction, "OR") |
== 0)) |
== 0) || (strcmp(chaine_fonction, |
|
"EQV") == 0)) |
{ |
{ |
autorisation_parenthese = d_vrai; |
autorisation_parenthese = d_vrai; |
} |
} |
Line 320 formateur_fichier(struct_processus *s_et
|
Line 322 formateur_fichier(struct_processus *s_et
|
|| (strcmp(chaine_fonction, "AND") |
|| (strcmp(chaine_fonction, "AND") |
== 0) || (strcmp(chaine_fonction, |
== 0) || (strcmp(chaine_fonction, |
"XOR") == 0) || (strcmp( |
"XOR") == 0) || (strcmp( |
chaine_fonction, "OR") == 0)) |
chaine_fonction, "OR") == 0) || |
|
(strcmp(chaine_fonction, "EQV") |
|
== 0)) |
{ |
{ |
autorisation_parenthese = d_vrai; |
autorisation_parenthese = d_vrai; |
} |
} |
Line 401 formateur_fichier(struct_processus *s_et
|
Line 405 formateur_fichier(struct_processus *s_et
|
"'%s'", (unsigned char *) |
"'%s'", (unsigned char *) |
(*s_sous_objet_1).objet); |
(*s_sous_objet_1).objet); |
|
|
|
(*s_etat_processus).type_en_cours = NON; |
recherche_type(s_etat_processus); |
recherche_type(s_etat_processus); |
|
|
if ((*s_etat_processus).erreur_execution != d_ex) |
if ((*s_etat_processus).erreur_execution != d_ex) |
Line 458 formateur_fichier(struct_processus *s_et
|
Line 463 formateur_fichier(struct_processus *s_et
|
if ((strcmp(chaine_fonction, "AND") == 0) || |
if ((strcmp(chaine_fonction, "AND") == 0) || |
(strcmp(chaine_fonction, "XOR") == |
(strcmp(chaine_fonction, "XOR") == |
0) || (strcmp(chaine_fonction, "OR") |
0) || (strcmp(chaine_fonction, "OR") |
== 0)) |
== 0) || (strcmp(chaine_fonction, |
|
"EQV") == 0)) |
{ |
{ |
autorisation_parenthese = d_vrai; |
autorisation_parenthese = d_vrai; |
} |
} |
Line 475 formateur_fichier(struct_processus *s_et
|
Line 481 formateur_fichier(struct_processus *s_et
|
|| (strcmp(chaine_fonction, "AND") |
|| (strcmp(chaine_fonction, "AND") |
== 0) || (strcmp(chaine_fonction, |
== 0) || (strcmp(chaine_fonction, |
"XOR") == 0) || (strcmp( |
"XOR") == 0) || (strcmp( |
chaine_fonction, "OR") == 0)) |
chaine_fonction, "OR") == 0) || |
|
(strcmp(chaine_fonction, "EQV") |
|
== 0)) |
{ |
{ |
autorisation_parenthese = d_vrai; |
autorisation_parenthese = d_vrai; |
} |
} |
Line 716 formateur_fichier(struct_processus *s_et
|
Line 724 formateur_fichier(struct_processus *s_et
|
"XOR") == 0) || (strcmp((*((struct_fonction *) |
"XOR") == 0) || (strcmp((*((struct_fonction *) |
(*(*l_element_courant).donnee).objet)) |
(*(*l_element_courant).donnee).objet)) |
.nom_fonction, |
.nom_fonction, |
"AND") == 0)) |
"AND") == 0) || (strcmp((*((struct_fonction *) |
|
(*(*l_element_courant).donnee).objet)) |
|
.nom_fonction, "EQV") == 0)) |
{ |
{ |
if (depilement(s_etat_processus, |
if (depilement(s_etat_processus, |
&((*s_etat_processus) |
&((*s_etat_processus) |
Line 1001 formateur_fichier(struct_processus *s_et
|
Line 1011 formateur_fichier(struct_processus *s_et
|
|
|
if (format_sortie == 'N') |
if (format_sortie == 'N') |
{ |
{ |
sprintf(tampon, "%llX", (*((logical8 *) |
sprintf(tampon, "%llX", (unsigned long long) (*((logical8 *) |
((*s_objet).objet)))); |
((*s_objet).objet)))); |
strcpy(base, "h"); |
strcpy(base, "h"); |
} |
} |
Line 1011 formateur_fichier(struct_processus *s_et
|
Line 1021 formateur_fichier(struct_processus *s_et
|
{ |
{ |
case 2: |
case 2: |
{ |
{ |
sprintf(tampon, "%llX", (*((logical8 *) |
sprintf(tampon, "%llX", (unsigned long long) |
((*s_objet).objet)))); |
(*((logical8 *) ((*s_objet).objet)))); |
|
|
chaine = (unsigned char *) malloc((strlen(tampon) + 1) |
chaine = (unsigned char *) malloc((strlen(tampon) + 1) |
* sizeof(unsigned char)); |
* sizeof(unsigned char)); |
Line 1121 formateur_fichier(struct_processus *s_et
|
Line 1131 formateur_fichier(struct_processus *s_et
|
|
|
case 8: |
case 8: |
{ |
{ |
sprintf(tampon, "%llo", (*((logical8 *) |
sprintf(tampon, "%llo", (*((unsigned long long *) |
((*s_objet).objet)))); |
((*s_objet).objet)))); |
strcpy(base, "o"); |
strcpy(base, "o"); |
break; |
break; |
Line 1129 formateur_fichier(struct_processus *s_et
|
Line 1139 formateur_fichier(struct_processus *s_et
|
|
|
case 10: |
case 10: |
{ |
{ |
sprintf(tampon, "%llu", (*((logical8 *) |
sprintf(tampon, "%llu", (*((unsigned long long *) |
((*s_objet).objet)))); |
((*s_objet).objet)))); |
strcpy(base, "d"); |
strcpy(base, "d"); |
break; |
break; |
Line 1137 formateur_fichier(struct_processus *s_et
|
Line 1147 formateur_fichier(struct_processus *s_et
|
|
|
case 16: |
case 16: |
{ |
{ |
sprintf(tampon, "%llX", (*((logical8 *) |
sprintf(tampon, "%llX", (unsigned long long) |
((*s_objet).objet)))); |
(*((logical8 *) ((*s_objet).objet)))); |
strcpy(base, "h"); |
strcpy(base, "h"); |
break; |
break; |
} |
} |
Line 1674 formateur_fichier(struct_processus *s_et
|
Line 1684 formateur_fichier(struct_processus *s_et
|
|
|
chaine_sauvegarde = chaine; |
chaine_sauvegarde = chaine; |
|
|
|
// Si le format_sortie vaut 'N', on remplace le format par |
|
// { "native*(*)" }. L'intérêt est de pouvoir traiter une |
|
// liste par un format "native*(*)". |
|
|
|
if ((format_sortie == 'N') && ((*(*l_element_courant) |
|
.donnee).type == LST)) |
|
{ |
|
if ((s_format_tmp = allocation(s_etat_processus, LST)) |
|
== NULL) |
|
{ |
|
return(NULL); |
|
} |
|
|
|
if (((*s_format_tmp).objet = allocation_maillon( |
|
s_etat_processus)) == NULL) |
|
{ |
|
return(NULL); |
|
} |
|
|
|
(*((struct_liste_chainee *) (*s_format_tmp).objet)) |
|
.suivant = NULL; |
|
|
|
if (((*((struct_liste_chainee *) (*s_format_tmp).objet)) |
|
.donnee = allocation(s_etat_processus, CHN)) |
|
== NULL) |
|
{ |
|
return(NULL); |
|
} |
|
|
|
if (((*(*((struct_liste_chainee *) (*s_format_tmp) |
|
.objet)).donnee).objet = malloc(11 * |
|
sizeof(unsigned char))) == NULL) |
|
{ |
|
(*s_etat_processus).erreur_systeme = |
|
d_es_allocation_memoire; |
|
return(NULL); |
|
} |
|
|
|
strcpy((unsigned char *) (*(*((struct_liste_chainee *) |
|
(*s_format_tmp).objet)).donnee).objet, |
|
"native*(*)"); |
|
} |
|
else |
|
{ |
|
if ((s_format_tmp = copie_objet(s_etat_processus, |
|
s_format, 'P')) == NULL) |
|
{ |
|
return(NULL); |
|
} |
|
} |
|
|
if ((chaine_formatee = formateur_fichier(s_etat_processus, |
if ((chaine_formatee = formateur_fichier(s_etat_processus, |
(*l_element_courant).donnee, s_format, |
(*l_element_courant).donnee, s_format, |
longueur, longueur_champ, format_sortie, type, |
longueur, longueur_champ, format_sortie, type, |
longueur_effective, recursivite, export_fichier)) |
longueur_effective, recursivite, export_fichier)) |
== NULL) |
== NULL) |
{ |
{ |
|
liberation(s_etat_processus, s_format_tmp); |
free(chaine); |
free(chaine); |
return(NULL); |
return(NULL); |
} |
} |
|
|
|
liberation(s_etat_processus, s_format_tmp); |
|
|
if ((*(*l_element_courant).donnee).type == CHN) |
if ((*(*l_element_courant).donnee).type == CHN) |
{ |
{ |
chaine = (unsigned char *) |
chaine = (unsigned char *) |
Line 3786 formateur_fichier(struct_processus *s_et
|
Line 3850 formateur_fichier(struct_processus *s_et
|
} |
} |
|
|
free(format_chaine); |
free(format_chaine); |
|
|
|
// Si le format_sortie vaut 'N', on remplace le format par |
|
// { "native*(*)" }. L'intérêt est de pouvoir traiter une |
|
// liste par un format "native*(*)". |
|
|
|
if ((format_sortie == 'N') && ((*(*l_element_courant) |
|
.donnee).type == LST)) |
|
{ |
|
if ((s_format_tmp = allocation(s_etat_processus, LST)) |
|
== NULL) |
|
{ |
|
return(NULL); |
|
} |
|
|
|
if (((*s_format_tmp).objet = allocation_maillon( |
|
s_etat_processus)) == NULL) |
|
{ |
|
return(NULL); |
|
} |
|
|
|
(*((struct_liste_chainee *) (*s_format_tmp).objet)) |
|
.suivant = NULL; |
|
|
|
if (((*((struct_liste_chainee *) (*s_format_tmp).objet)) |
|
.donnee = allocation(s_etat_processus, CHN)) |
|
== NULL) |
|
{ |
|
return(NULL); |
|
} |
|
|
|
if (((*(*((struct_liste_chainee *) (*s_format_tmp) |
|
.objet)).donnee).objet = malloc(11 * |
|
sizeof(unsigned char))) == NULL) |
|
{ |
|
(*s_etat_processus).erreur_systeme = |
|
d_es_allocation_memoire; |
|
return(NULL); |
|
} |
|
|
|
strcpy((unsigned char *) (*(*((struct_liste_chainee *) |
|
(*s_format_tmp).objet)).donnee).objet, |
|
"native*(*)"); |
|
} |
|
else |
|
{ |
|
if ((s_format_tmp = copie_objet(s_etat_processus, |
|
s_format, 'P')) == NULL) |
|
{ |
|
return(NULL); |
|
} |
|
} |
|
|
if ((chaine_formatee = formateur_fichier(s_etat_processus, |
if ((chaine_formatee = formateur_fichier(s_etat_processus, |
(*l_element_courant).donnee, s_format, |
(*l_element_courant).donnee, s_format_tmp, |
longueur, longueur_champ, format_sortie, type, |
longueur, longueur_champ, format_sortie, type, |
longueur_effective, recursivite, export_fichier)) |
longueur_effective, recursivite, export_fichier)) |
== NULL) |
== NULL) |
{ |
{ |
|
liberation(s_etat_processus, s_format_tmp); |
free(chaine); |
free(chaine); |
return(NULL); |
return(NULL); |
} |
} |
|
|
|
liberation(s_etat_processus, s_format_tmp); |
|
|
if ((chaine = realloc(chaine, |
if ((chaine = realloc(chaine, |
((size_t) (longueur_totale + (*longueur_effective))) |
((size_t) (longueur_totale + (*longueur_effective))) |
* sizeof(unsigned char))) == NULL) |
* sizeof(unsigned char))) == NULL) |
Line 3812 formateur_fichier(struct_processus *s_et
|
Line 3930 formateur_fichier(struct_processus *s_et
|
free(chaine_formatee); |
free(chaine_formatee); |
} |
} |
|
|
nombre_elements++; |
|
l_element_courant = (*l_element_courant).suivant; |
|
|
|
if (format_sortie != 'N') |
if (format_sortie != 'N') |
{ |
{ |
l_element_courant_format = |
l_element_courant_format = |
(*l_element_courant_format).suivant; |
(*l_element_courant_format).suivant; |
} |
} |
|
|
|
nombre_elements++; |
|
l_element_courant = (*l_element_courant).suivant; |
} |
} |
|
|
if (format_sortie != 'N') |
if (format_sortie != 'N') |