--- rpl/src/instructions_f1.c 2012/10/04 15:21:26 1.43 +++ rpl/src/instructions_f1.c 2013/03/20 17:11:45 1.53 @@ -1,7 +1,7 @@ /* ================================================================================ - RPL/2 (R) version 4.1.11 - Copyright (C) 1989-2012 Dr. BERTRAND Joël + RPL/2 (R) version 4.1.13 + Copyright (C) 1989-2013 Dr. BERTRAND Joël This file is part of RPL/2. @@ -59,8 +59,8 @@ instruction_fleche(struct_processus *s_e unsigned char *tampon; unsigned char test_instruction; - unsigned long i; - unsigned long nombre_variables; + integer8 i; + integer8 nombre_variables; void (*fonction)(); @@ -549,8 +549,7 @@ instruction_fleche(struct_processus *s_e (*s_etat_processus).objet_courant; } - if (pthread_mutex_lock(&((*(*s_etat_processus) - .s_liste_variables_partagees).mutex)) != 0) + if (pthread_mutex_lock(&mutex_creation_variable_partagee) != 0) { (*s_etat_processus).erreur_systeme = d_es_processus; return; @@ -559,12 +558,19 @@ instruction_fleche(struct_processus *s_e if (recherche_variable_partagee(s_etat_processus, s_variable.nom, position_variable, ((*s_etat_processus).mode_execution_programme == 'Y') - ? 'P' : 'E') == d_vrai) + ? 'P' : 'E') != NULL) { // Variable partagée à utiliser + if (pthread_mutex_unlock(&mutex_creation_variable_partagee) + != 0) + { + (*s_etat_processus).erreur_systeme = d_es_processus; + return; + } + if (pthread_mutex_unlock(&((*(*s_etat_processus) - .s_liste_variables_partagees).mutex)) != 0) + .pointeur_variable_partagee_courante).mutex)) != 0) { (*s_etat_processus).erreur_systeme = d_es_processus; return; @@ -587,7 +593,6 @@ instruction_fleche(struct_processus *s_e } else { - // Variable partagée à utiliser // Variable partagee à créer (*s_etat_processus).erreur_systeme = d_es; @@ -596,7 +601,7 @@ instruction_fleche(struct_processus *s_e + 1) * sizeof(unsigned char))) == NULL) { if (pthread_mutex_unlock(&((*(*s_etat_processus) - .s_liste_variables_partagees).mutex)) != 0) + .pointeur_variable_partagee_courante).mutex)) != 0) { (*s_etat_processus).erreur_systeme = d_es_processus; return; @@ -648,24 +653,17 @@ instruction_fleche(struct_processus *s_e if (creation_variable_partagee(s_etat_processus, &s_variable_partagee) == d_erreur) { - if (pthread_mutex_unlock(&((*(*s_etat_processus) - .s_liste_variables_partagees).mutex)) != 0) - { - (*s_etat_processus).erreur_systeme = d_es_processus; - return; - } - return; } - if (pthread_mutex_unlock(&((*(*s_etat_processus) - .s_liste_variables_partagees).mutex)) != 0) + s_variable.objet = NULL; + + if (pthread_mutex_unlock(&mutex_creation_variable_partagee) + != 0) { (*s_etat_processus).erreur_systeme = d_es_processus; return; } - - s_variable.objet = NULL; } } else @@ -840,8 +838,7 @@ instruction_fleche_list(struct_processus return; } - if ((unsigned long) nombre_elements >= - (*s_etat_processus).hauteur_pile_operationnelle) + if (nombre_elements >= (*s_etat_processus).hauteur_pile_operationnelle) { (*s_etat_processus).erreur_execution = d_ex_manque_argument; return; @@ -1846,7 +1843,7 @@ instruction_fact(struct_processus *s_eta for (i = 1; i <= (*((integer8 *) (*s_objet_argument).objet)); i++) { - produit *= i; + produit *= (real8) i; } if ((s_objet_resultat = allocation(s_etat_processus, REL)) @@ -2170,7 +2167,7 @@ instruction_floor(struct_processus *s_et return; } - (*((integer8 *) (*s_objet_resultat).objet)) = + (*((integer8 *) (*s_objet_resultat).objet)) = (integer8) floor((*((real8 *) (*s_objet_argument).objet))); if (!((((*((integer8 *) (*s_objet_resultat).objet)) < @@ -2802,7 +2799,7 @@ instruction_fix(struct_processus *s_etat return; } - (*((logical8 *) (*s_objet).objet)) = + (*((logical8 *) (*s_objet).objet)) = (logical8) (*((integer8 *) (*s_objet_argument).objet)); i43 = test_cfsf(s_etat_processus, 43); @@ -2840,15 +2837,15 @@ instruction_fix(struct_processus *s_etat { if (valeur_binaire[i] == '0') { - cf(s_etat_processus, j++); + cf(s_etat_processus, (unsigned char) j++); } else { - sf(s_etat_processus, j++); + sf(s_etat_processus, (unsigned char) j++); } } - for(; j <= 56; cf(s_etat_processus, j++)); + for(; j <= 56; cf(s_etat_processus, (unsigned char) j++)); sf(s_etat_processus, 49); cf(s_etat_processus, 50);