--- rpl/src/instructions_i3.c 2011/06/20 17:54:17 1.20 +++ rpl/src/instructions_i3.c 2020/01/10 11:15:46 1.70 @@ -1,7 +1,7 @@ /* ================================================================================ - RPL/2 (R) version 4.1.0.prerelease.1 - Copyright (C) 1989-2011 Dr. BERTRAND Joël + RPL/2 (R) version 4.1.32 + Copyright (C) 1989-2020 Dr. BERTRAND Joël This file is part of RPL/2. @@ -96,6 +96,7 @@ instruction_inquire(struct_processus *s_ printf(" NAME : %s\n", d_CHN); printf(" FORMATTED : %s (true/false)\n", d_INT); printf(" KEY FIELD : %s\n", d_INT); + printf(" FORMAT : %s\n", d_LST); printf(" PROTECTION : %s (WRITEONLY/READONLY/READWRITE)\n\n", d_CHN); @@ -108,7 +109,6 @@ instruction_inquire(struct_processus *s_ printf(" Queries by name:\n\n"); } - printf(" FORMAT : %s\n", d_LST); printf(" EXISTENCE : %s (true/false)\n", d_INT); printf(" LOCK : %s (NONE/READ/WRITE)\n", d_CHN); @@ -153,7 +153,7 @@ instruction_inquire(struct_processus *s_ return; } - if ((requete = conversion_majuscule((unsigned char *) + if ((requete = conversion_majuscule(s_etat_processus, (unsigned char *) (*s_objet_argument_1).objet)) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; @@ -188,13 +188,9 @@ instruction_inquire(struct_processus *s_ return; } - /* - * La fin du fichier renvoyée ne correspond pas à la fin physique - * du fichier mais à un défaut d'enregistrement. - */ - if ((dfichier = descripteur_fichier(s_etat_processus, - (struct_fichier *) (*s_objet_argument_2).objet)) == NULL) + (struct_fichier *) (*s_objet_argument_2).objet)) == + NULL) { return; } @@ -206,36 +202,59 @@ instruction_inquire(struct_processus *s_ free(requete); - (*s_etat_processus).erreur_execution = d_ex_erreur_type_fichier; + (*s_etat_processus).erreur_execution = + d_ex_erreur_type_fichier; return; } - if ((position_courante = ftell((*dfichier).descripteur_c)) == -1) + if ((*((struct_fichier *) (*s_objet_argument_2).objet)).binaire + != 'F') { - (*s_etat_processus).erreur_systeme = d_es_erreur_fichier; - return; - } + /* + * La fin du fichier renvoyée ne correspond pas à la fin + * physique du fichier mais à un défaut d'enregistrement. + */ - fin_fichier = d_vrai; + if ((position_courante = ftell((*dfichier).descripteur_c)) + == -1) + { + (*s_etat_processus).erreur_systeme = d_es_erreur_fichier; + return; + } - while(feof((*dfichier).descripteur_c) == 0) - { - if (fread(&caractere, sizeof(unsigned char), (size_t) 1, - (*dfichier).descripteur_c) > 0) + fin_fichier = d_vrai; + + while(feof((*dfichier).descripteur_c) == 0) { - if (caractere == '{') + if (fread(&caractere, sizeof(unsigned char), (size_t) 1, + (*dfichier).descripteur_c) > 0) { - fin_fichier = d_faux; - break; + if (caractere == '{') + { + fin_fichier = d_faux; + break; + } } } - } - if (fseek((*dfichier).descripteur_c, position_courante, SEEK_SET) - != 0) + if (fseek((*dfichier).descripteur_c, position_courante, + SEEK_SET) != 0) + { + (*s_etat_processus).erreur_systeme = d_es_erreur_fichier; + return; + } + } + else { - (*s_etat_processus).erreur_systeme = d_es_erreur_fichier; - return; + // Fichier de type FLOW + if (feof((*dfichier).descripteur_c) == 0) + { + fin_fichier = d_faux; + } + else + { + fin_fichier = d_vrai; + } } if (fin_fichier == d_faux) @@ -770,7 +789,7 @@ instruction_idft(struct_processus *s_eta logical1 presence_longueur_dft; - long longueur_dft_signee; + integer8 longueur_dft_signee; struct_complexe16 *matrice_f77; @@ -778,10 +797,10 @@ instruction_idft(struct_processus *s_eta struct_objet *s_objet_longueur_dft; struct_objet *s_objet_resultat; - unsigned long i; - unsigned long j; - unsigned long k; - unsigned long longueur_dft; + integer8 i; + integer8 j; + integer8 k; + integer8 longueur_dft; (*s_etat_processus).erreur_execution = d_ex; @@ -899,7 +918,7 @@ instruction_idft(struct_processus *s_eta (*s_objet_argument).objet)).taille; } - if ((matrice_f77 = malloc(longueur_dft * + if ((matrice_f77 = malloc(((size_t) longueur_dft) * sizeof(struct_complexe16))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; @@ -949,7 +968,7 @@ instruction_idft(struct_processus *s_eta } nombre_lignes = 1; - nombre_colonnes = longueur_dft; + nombre_colonnes = (integer4) longueur_dft; inverse = -1; dft(matrice_f77, &nombre_lignes, &nombre_colonnes, &inverse, &erreur); @@ -989,9 +1008,9 @@ instruction_idft(struct_processus *s_eta (*s_objet_argument).objet)).nombre_colonnes; } - if ((matrice_f77 = malloc(longueur_dft * + if ((matrice_f77 = malloc(((size_t) longueur_dft) * ((size_t) (*((struct_matrice *) (*s_objet_argument).objet)) - .nombre_lignes * sizeof(struct_complexe16))) == NULL) + .nombre_lignes) * sizeof(struct_complexe16))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return; @@ -1067,9 +1086,9 @@ instruction_idft(struct_processus *s_eta } } - nombre_lignes = (*((struct_matrice *) (*s_objet_argument).objet)) - .nombre_lignes; - nombre_colonnes = longueur_dft; + nombre_lignes = (integer4) (*((struct_matrice *) (*s_objet_argument) + .objet)).nombre_lignes; + nombre_colonnes = (integer4) longueur_dft; inverse = -1; dft(matrice_f77, &nombre_lignes, &nombre_colonnes, &inverse, &erreur); @@ -1096,8 +1115,8 @@ instruction_idft(struct_processus *s_eta longueur_dft; if (((*((struct_matrice *) (*s_objet_resultat).objet)).tableau = - malloc((*((struct_matrice *) (*s_objet_resultat).objet)) - .nombre_lignes * sizeof(struct_complexe16 *))) == NULL) + malloc(((size_t) (*((struct_matrice *) (*s_objet_resultat) + .objet)).nombre_lignes) * sizeof(struct_complexe16 *))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return; @@ -1108,8 +1127,8 @@ instruction_idft(struct_processus *s_eta { if ((((struct_complexe16 **) (*((struct_matrice *) (*s_objet_resultat).objet)).tableau)[i] = - malloc((*((struct_matrice *) - (*s_objet_resultat).objet)).nombre_colonnes * + malloc(((size_t) (*((struct_matrice *) + (*s_objet_resultat).objet)).nombre_colonnes) * sizeof(struct_complexe16))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;