--- rpl/src/instructions_c6.c 2011/07/22 07:38:36 1.27 +++ rpl/src/instructions_c6.c 2019/10/31 15:40:09 1.73 @@ -1,7 +1,7 @@ /* ================================================================================ - RPL/2 (R) version 4.1.1 - Copyright (C) 1989-2011 Dr. BERTRAND Joël + RPL/2 (R) version 4.1.32 + Copyright (C) 1989-2019 Dr. BERTRAND Joël This file is part of RPL/2. @@ -140,8 +140,8 @@ instruction_col_fleche(struct_processus struct_objet *s_objet; struct_objet *s_objet_elementaire; - unsigned long i; - unsigned long j; + integer8 i; + integer8 j; (*s_etat_processus).erreur_execution = d_ex; @@ -206,8 +206,8 @@ instruction_col_fleche(struct_processus .nombre_lignes; if (((*((struct_matrice *) (*s_objet_elementaire).objet)).tableau = - malloc((*((struct_matrice *) (*s_objet).objet)) - .nombre_lignes * sizeof(integer8 *))) == NULL) + malloc(((size_t) (*((struct_matrice *) (*s_objet).objet)) + .nombre_lignes) * sizeof(integer8 *))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return; @@ -257,8 +257,8 @@ instruction_col_fleche(struct_processus .nombre_lignes; if (((*((struct_matrice *) (*s_objet_elementaire).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; @@ -308,8 +308,8 @@ instruction_col_fleche(struct_processus .nombre_lignes; if (((*((struct_matrice *) (*s_objet_elementaire).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; @@ -590,7 +590,8 @@ instruction_continue(struct_processus *s if ((*s_objet).type == PRC) { - if (pthread_mutex_lock(&((*s_etat_processus).mutex)) != 0) + if (pthread_mutex_lock(&((*s_etat_processus).mutex_pile_processus)) + != 0) { (*s_etat_processus).erreur_systeme = d_es_processus; } @@ -608,8 +609,10 @@ instruction_continue(struct_processus *s .thread).pid == (*(*((struct_processus_fils *) (*(*l_element_courant).donnee).objet)).thread).pid) { - if (kill((*(*((struct_processus_fils *) - (*s_objet).objet)).thread).pid, SIGCONT) != 0) + if (envoi_signal_processus( + (*(*((struct_processus_fils *) + (*s_objet).objet)).thread).pid, rpl_sigcont, + d_faux) != 0) { // Le processus est peut-être dans l'état zombie. } @@ -639,8 +642,9 @@ instruction_continue(struct_processus *s (*(*l_element_courant).donnee).objet)).thread) .pid)) { - if (pthread_kill((*(*((struct_processus_fils *) - (*s_objet).objet)).thread).tid, SIGCONT) + if (envoi_signal_thread(s_etat_processus, + (*(*((struct_processus_fils *) + (*s_objet).objet)).thread).tid, rpl_sigcont) != 0) { // Le thread est peut-être dans l'état zombie. @@ -650,6 +654,8 @@ instruction_continue(struct_processus *s &((*(*((struct_processus_fils *) (*s_objet).objet)).thread).mutex)) != 0) { + pthread_mutex_unlock(&((*s_etat_processus) + .mutex_pile_processus)); (*s_etat_processus).erreur_systeme = d_es_processus; return; @@ -662,6 +668,8 @@ instruction_continue(struct_processus *s if (pthread_mutex_unlock(&((*(*((struct_processus_fils *) (*s_objet).objet)).thread).mutex)) != 0) { + pthread_mutex_unlock(&((*s_etat_processus) + .mutex_pile_processus)); (*s_etat_processus).erreur_systeme = d_es_processus; return; } @@ -670,7 +678,8 @@ instruction_continue(struct_processus *s l_element_courant = (*l_element_courant).suivant; } - if (pthread_mutex_unlock(&((*s_etat_processus).mutex)) != 0) + if (pthread_mutex_unlock(&((*s_etat_processus) + .mutex_pile_processus)) != 0) { (*s_etat_processus).erreur_systeme = d_es_processus; } @@ -833,66 +842,67 @@ instruction_clrfuse(struct_processus *s_ ================================================================================ */ -void -instruction_crtab(struct_processus *s_etat_processus) +static struct_objet * +creation_table(struct_processus *s_etat_processus, + struct_liste_chainee *dimensions) { - struct_liste_chainee *l_element_courant; + struct_objet *s_table; - struct_objet *s_objet_argument; - struct_objet *s_objet_resultat; + integer8 i; - struct_objet * - creation_table(struct_liste_chainee *dimensions) + if ((s_table = allocation(s_etat_processus, TBL)) == NULL) { - struct_objet *s_table; - - unsigned long i; - - if ((s_table = allocation(s_etat_processus, TBL)) == NULL) - { - return(NULL); - } + return(NULL); + } - (*((struct_tableau *) (*s_table).objet)).nombre_elements = - (unsigned long) (*((integer8 *) (*(*dimensions).donnee).objet)); + (*((struct_tableau *) (*s_table).objet)).nombre_elements = + (*((integer8 *) (*(*dimensions).donnee).objet)); - dimensions = (*dimensions).suivant; + dimensions = (*dimensions).suivant; - if (((*((struct_tableau *) (*s_table).objet)).elements = - malloc((*((struct_tableau *) (*s_table).objet)) - .nombre_elements * sizeof(struct_objet *))) == NULL) - { - return(NULL); - } + if (((*((struct_tableau *) (*s_table).objet)).elements = + malloc(((size_t) (*((struct_tableau *) (*s_table).objet)) + .nombre_elements) * sizeof(struct_objet *))) == NULL) + { + return(NULL); + } - if (dimensions == NULL) + if (dimensions == NULL) + { + for(i = 0; i < (*((struct_tableau *) (*s_table).objet)) + .nombre_elements; i++) { - for(i = 0; i < (*((struct_tableau *) (*s_table).objet)) - .nombre_elements; i++) + if (((*((struct_tableau *) (*s_table).objet)).elements[i] = + allocation(s_etat_processus, LST)) == NULL) { - if (((*((struct_tableau *) (*s_table).objet)).elements[i] = - allocation(s_etat_processus, LST)) == NULL) - { - return(NULL); - } + return(NULL); } } - else + } + else + { + for(i = 0; i < (*((struct_tableau *) (*s_table).objet)) + .nombre_elements; i++) { - for(i = 0; i < (*((struct_tableau *) (*s_table).objet)) - .nombre_elements; i++) + if (((*((struct_tableau *) (*s_table).objet)).elements[i] = + creation_table(s_etat_processus, dimensions)) == NULL) { - if (((*((struct_tableau *) (*s_table).objet)).elements[i] = - creation_table(dimensions)) == NULL) - { - return(NULL); - } + return(NULL); } } - - return(s_table); } + return(s_table); +} + +void +instruction_crtab(struct_processus *s_etat_processus) +{ + struct_liste_chainee *l_element_courant; + + struct_objet *s_objet_argument; + struct_objet *s_objet_resultat; + (*s_etat_processus).erreur_execution = d_ex; if ((*s_etat_processus).affichage_arguments == 'Y') @@ -961,8 +971,8 @@ instruction_crtab(struct_processus *s_et l_element_courant = (*l_element_courant).suivant; } - if ((s_objet_resultat = - creation_table((*s_objet_argument).objet)) == NULL) + if ((s_objet_resultat = creation_table(s_etat_processus, + (*s_objet_argument).objet)) == NULL) { (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return;