--- rpl/src/instructions_l5.c 2011/08/09 11:31:33 1.28 +++ rpl/src/instructions_l5.c 2018/05/30 09:27:35 1.64 @@ -1,7 +1,7 @@ /* ================================================================================ - RPL/2 (R) version 4.1.3 - Copyright (C) 1989-2011 Dr. BERTRAND Joël + RPL/2 (R) version 4.1.29 + Copyright (C) 1989-2018 Dr. BERTRAND Joël This file is part of RPL/2. @@ -265,7 +265,7 @@ instruction_label(struct_processus *s_et struct_objet *s_objet_argument; - unsigned long nombre_labels; + integer8 nombre_labels; (*s_etat_processus).erreur_execution = d_ex; @@ -446,8 +446,12 @@ instruction_label(struct_processus *s_et void instruction_logger(struct_processus *s_etat_processus) { + integer8 longueur; + struct_objet *s_objet_argument; + unsigned char *tampon; + (*s_etat_processus).erreur_execution = d_ex; if ((*s_etat_processus).affichage_arguments == 'Y') @@ -490,7 +494,15 @@ instruction_logger(struct_processus *s_e if ((*s_objet_argument).type == CHN) { - syslog(LOG_NOTICE, "%s", (unsigned char *) (*s_objet_argument).objet); + if ((tampon = formateur_flux(s_etat_processus, + (unsigned char *) (*s_objet_argument).objet, &longueur)) + == NULL) + { + return; + } + + syslog(LOG_NOTICE, "%s", tampon); + free(tampon); } else { @@ -772,10 +784,10 @@ instruction_lq(struct_processus *s_etat_ struct_objet *s_objet_argument; struct_objet *s_objet_resultat; - unsigned long i; - unsigned long j; - unsigned long k; - unsigned long nombre_reflecteurs_elementaires; + integer8 i; + integer8 j; + integer8 k; + integer8 nombre_reflecteurs_elementaires; void *tau; @@ -986,8 +998,8 @@ instruction_lq(struct_processus *s_etat_ (*((struct_matrice *) (*s_copie_argument).objet)) .nombre_colonnes; - if ((vecteur_reel = malloc((*((struct_matrice *) (*s_objet).objet)) - .nombre_lignes * sizeof(real8))) == NULL) + if ((vecteur_reel = malloc(((size_t) (*((struct_matrice *) + (*s_objet).objet)).nombre_lignes) * sizeof(real8))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return; @@ -1012,8 +1024,8 @@ instruction_lq(struct_processus *s_etat_ } if (((*((struct_matrice *) (*s_objet).objet)).tableau = - malloc((*((struct_matrice *) (*s_objet).objet)) - .nombre_lignes * sizeof(real8 *))) == NULL) + malloc(((size_t) (*((struct_matrice *) (*s_objet).objet)) + .nombre_lignes) * sizeof(real8 *))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return; @@ -1023,8 +1035,9 @@ instruction_lq(struct_processus *s_etat_ .nombre_lignes; j++) { if ((((real8 **) (*((struct_matrice *) (*s_objet).objet)) - .tableau)[j] = malloc((*((struct_matrice *) (*s_objet) - .objet)).nombre_lignes * sizeof(real8))) == NULL) + .tableau)[j] = malloc(((size_t) (*((struct_matrice *) + (*s_objet).objet)).nombre_lignes) * sizeof(real8))) + == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; @@ -1304,8 +1317,8 @@ instruction_lq(struct_processus *s_etat_ (*((struct_matrice *) (*s_copie_argument).objet)) .nombre_colonnes; - if ((vecteur_complexe = malloc((*((struct_matrice *) - (*s_objet).objet)).nombre_lignes * sizeof(complex16))) + if ((vecteur_complexe = malloc(((size_t) (*((struct_matrice *) + (*s_objet).objet)).nombre_lignes) * sizeof(complex16))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; @@ -1339,8 +1352,8 @@ instruction_lq(struct_processus *s_etat_ } if (((*((struct_matrice *) (*s_objet).objet)).tableau = - malloc((*((struct_matrice *) (*s_objet).objet)) - .nombre_lignes * sizeof(complex16 *))) == NULL) + malloc(((size_t) (*((struct_matrice *) (*s_objet).objet)) + .nombre_lignes) * sizeof(complex16 *))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return; @@ -1350,8 +1363,9 @@ instruction_lq(struct_processus *s_etat_ .nombre_lignes; j++) { if ((((complex16 **) (*((struct_matrice *) (*s_objet).objet)) - .tableau)[j] = malloc((*((struct_matrice *) (*s_objet) - .objet)).nombre_lignes * sizeof(complex16))) == NULL) + .tableau)[j] = malloc(((size_t) (*((struct_matrice *) + (*s_objet).objet)).nombre_lignes) * sizeof(complex16))) + == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; @@ -1609,9 +1623,6 @@ instruction_lcase(struct_processus *s_et struct_objet *s_objet_argument; struct_objet *s_objet_resultat; - unsigned char *ptr; - unsigned char registre; - (*s_etat_processus).erreur_execution = d_ex; if ((*s_etat_processus).affichage_arguments == 'Y') @@ -1620,7 +1631,7 @@ instruction_lcase(struct_processus *s_et if ((*s_etat_processus).langue == 'F') { - printf("(converison d'une chaîne de caractères en minuscules)\n\n"); + printf("(conversion d'une chaîne de caractères en minuscules)\n\n"); } else { @@ -1662,19 +1673,8 @@ instruction_lcase(struct_processus *s_et } liberation(s_etat_processus, s_objet_argument); - ptr = (unsigned char *) (*s_objet_resultat).objet; - - while((*ptr) != d_code_fin_chaine) - { - registre = tolower((*ptr)); - - if (toupper(registre) == (*ptr)) - { - (*ptr) = registre; - } - - ptr++; - } + conversion_chaine(s_etat_processus, (unsigned char *) + (*s_objet_resultat).objet, 'm'); if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile), s_objet_resultat) == d_erreur)