version 1.13, 2010/06/24 10:10:45
|
version 1.69, 2013/09/06 10:30:55
|
Line 1
|
Line 1
|
/* |
/* |
================================================================================ |
================================================================================ |
RPL/2 (R) version 4.0.17 |
RPL/2 (R) version 4.1.16 |
Copyright (C) 1989-2010 Dr. BERTRAND Joël |
Copyright (C) 1989-2013 Dr. BERTRAND Joël |
|
|
This file is part of RPL/2. |
This file is part of RPL/2. |
|
|
Line 20
|
Line 20
|
*/ |
*/ |
|
|
|
|
#include "rpl.conv.h" |
#include "rpl-conv.h" |
|
|
|
|
/* |
/* |
Line 147 instruction_sq(struct_processus *s_etat_
|
Line 147 instruction_sq(struct_processus *s_etat_
|
struct_objet *s_objet_argument; |
struct_objet *s_objet_argument; |
struct_objet *s_objet_resultat; |
struct_objet *s_objet_resultat; |
|
|
unsigned long i; |
integer8 i; |
unsigned long j; |
integer8 j; |
unsigned long k; |
integer8 k; |
|
|
void *accumulateur; |
void *accumulateur; |
|
|
Line 310 instruction_sq(struct_processus *s_etat_
|
Line 310 instruction_sq(struct_processus *s_etat_
|
.objet))).nombre_colonnes; |
.objet))).nombre_colonnes; |
|
|
if (((*((struct_matrice *) (*s_objet_resultat).objet)).tableau = |
if (((*((struct_matrice *) (*s_objet_resultat).objet)).tableau = |
malloc((*(((struct_matrice *) (*s_objet_resultat) |
malloc(((size_t) (*(((struct_matrice *) (*s_objet_resultat) |
.objet))).nombre_lignes * sizeof(integer8 *))) == NULL) |
.objet))).nombre_lignes) * sizeof(integer8 *))) == NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
return; |
return; |
Line 323 instruction_sq(struct_processus *s_etat_
|
Line 323 instruction_sq(struct_processus *s_etat_
|
.objet))).nombre_lignes; i++) |
.objet))).nombre_lignes; i++) |
{ |
{ |
if (((*((struct_matrice *) (*s_objet_resultat).objet)).tableau[i] = |
if (((*((struct_matrice *) (*s_objet_resultat).objet)).tableau[i] = |
malloc((*(((struct_matrice *) (*s_objet_resultat) |
malloc(((size_t) (*(((struct_matrice *) (*s_objet_resultat) |
.objet))).nombre_colonnes * sizeof(integer8))) == NULL) |
.objet))).nombre_colonnes) * sizeof(integer8))) == NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
return; |
return; |
Line 366 instruction_sq(struct_processus *s_etat_
|
Line 366 instruction_sq(struct_processus *s_etat_
|
(*s_objet_resultat).type = MRL; |
(*s_objet_resultat).type = MRL; |
(*((struct_matrice *) (*s_objet_resultat).objet)).type = 'R'; |
(*((struct_matrice *) (*s_objet_resultat).objet)).type = 'R'; |
|
|
if ((accumulateur = malloc((*(((struct_matrice *) |
if ((accumulateur = malloc(((size_t) (*(((struct_matrice *) |
(*s_objet_argument).objet))).nombre_colonnes * |
(*s_objet_argument).objet))).nombre_colonnes) * |
sizeof(real8))) == NULL) |
sizeof(real8))) == NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
Line 381 instruction_sq(struct_processus *s_etat_
|
Line 381 instruction_sq(struct_processus *s_etat_
|
(*s_objet_resultat).objet)).tableau)[i]); |
(*s_objet_resultat).objet)).tableau)[i]); |
|
|
if (((*((struct_matrice *) (*s_objet_resultat).objet)) |
if (((*((struct_matrice *) (*s_objet_resultat).objet)) |
.tableau[i] = malloc((*(((struct_matrice *) |
.tableau[i] = malloc(((size_t) (*(((struct_matrice *) |
(*s_objet_resultat).objet))).nombre_colonnes * |
(*s_objet_resultat).objet))).nombre_colonnes) * |
sizeof(real8))) == NULL) |
sizeof(real8))) == NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = |
(*s_etat_processus).erreur_systeme = |
Line 457 instruction_sq(struct_processus *s_etat_
|
Line 457 instruction_sq(struct_processus *s_etat_
|
.objet))).nombre_colonnes; |
.objet))).nombre_colonnes; |
|
|
if (((*((struct_matrice *) (*s_objet_resultat).objet)).tableau = |
if (((*((struct_matrice *) (*s_objet_resultat).objet)).tableau = |
malloc((*(((struct_matrice *) (*s_objet_resultat) |
malloc(((size_t) (*(((struct_matrice *) (*s_objet_resultat) |
.objet))).nombre_lignes * sizeof(real8 *))) == NULL) |
.objet))).nombre_lignes) * sizeof(real8 *))) == NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
return; |
return; |
} |
} |
|
|
if ((accumulateur = malloc((*(((struct_matrice *) |
if ((accumulateur = malloc(((size_t) (*(((struct_matrice *) |
(*s_objet_argument).objet))).nombre_colonnes * sizeof(real8))) |
(*s_objet_argument).objet))).nombre_colonnes) * sizeof(real8))) |
== NULL) |
== NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
Line 476 instruction_sq(struct_processus *s_etat_
|
Line 476 instruction_sq(struct_processus *s_etat_
|
.objet))).nombre_lignes; i++) |
.objet))).nombre_lignes; i++) |
{ |
{ |
if (((*((struct_matrice *) (*s_objet_resultat).objet)).tableau[i] = |
if (((*((struct_matrice *) (*s_objet_resultat).objet)).tableau[i] = |
malloc((*(((struct_matrice *) (*s_objet_resultat) |
malloc(((size_t) (*(((struct_matrice *) (*s_objet_resultat) |
.objet))).nombre_colonnes * sizeof(real8))) == NULL) |
.objet))).nombre_colonnes) * sizeof(real8))) == NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
return; |
return; |
Line 549 instruction_sq(struct_processus *s_etat_
|
Line 549 instruction_sq(struct_processus *s_etat_
|
.objet))).nombre_colonnes; |
.objet))).nombre_colonnes; |
|
|
if (((*((struct_matrice *) (*s_objet_resultat).objet)).tableau = |
if (((*((struct_matrice *) (*s_objet_resultat).objet)).tableau = |
malloc((*(((struct_matrice *) (*s_objet_resultat) |
malloc(((size_t) (*(((struct_matrice *) (*s_objet_resultat) |
.objet))).nombre_lignes * sizeof(struct_complexe16 *))) == NULL) |
.objet))).nombre_lignes) * sizeof(struct_complexe16 *))) |
|
== NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
return; |
return; |
} |
} |
|
|
if ((accumulateur = malloc((*(((struct_matrice *) |
if ((accumulateur = malloc(((size_t) (*(((struct_matrice *) |
(*s_objet_argument).objet))).nombre_colonnes * |
(*s_objet_argument).objet))).nombre_colonnes) * |
sizeof(complex16))) == NULL) |
sizeof(complex16))) == NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
Line 568 instruction_sq(struct_processus *s_etat_
|
Line 569 instruction_sq(struct_processus *s_etat_
|
.objet))).nombre_lignes; i++) |
.objet))).nombre_lignes; i++) |
{ |
{ |
if (((*((struct_matrice *) (*s_objet_resultat).objet)).tableau[i] = |
if (((*((struct_matrice *) (*s_objet_resultat).objet)).tableau[i] = |
malloc((*(((struct_matrice *) (*s_objet_resultat) |
malloc(((size_t) (*(((struct_matrice *) (*s_objet_resultat) |
.objet))).nombre_colonnes * sizeof(struct_complexe16))) |
.objet))).nombre_colonnes) * sizeof(struct_complexe16))) |
== NULL) |
== NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
Line 1216 instruction_same(struct_processus *s_eta
|
Line 1217 instruction_same(struct_processus *s_eta
|
|
|
logical1 difference; |
logical1 difference; |
|
|
unsigned long i; |
integer8 i; |
unsigned long j; |
integer8 j; |
unsigned long nombre_elements; |
integer8 nombre_elements; |
|
|
(*s_etat_processus).erreur_execution = d_ex; |
(*s_etat_processus).erreur_execution = d_ex; |
|
|
Line 2572 instruction_start(struct_processus *s_et
|
Line 2573 instruction_start(struct_processus *s_et
|
} |
} |
} |
} |
|
|
empilement_pile_systeme(s_etat_processus); |
|
(*(*s_etat_processus).l_base_pile_systeme).type_cloture = 'S'; |
|
|
|
if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile), |
if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile), |
&s_objet_1) == d_erreur) |
&s_objet_1) == d_erreur) |
{ |
{ |
Line 2608 instruction_start(struct_processus *s_et
|
Line 2606 instruction_start(struct_processus *s_et
|
return; |
return; |
} |
} |
|
|
|
empilement_pile_systeme(s_etat_processus); |
|
|
|
if ((*s_etat_processus).erreur_systeme != d_es) |
|
{ |
|
return; |
|
} |
|
|
|
(*(*s_etat_processus).l_base_pile_systeme).type_cloture = 'S'; |
|
|
(*(*s_etat_processus).l_base_pile_systeme).indice_boucle = s_objet_2; |
(*(*s_etat_processus).l_base_pile_systeme).indice_boucle = s_objet_2; |
(*(*s_etat_processus).l_base_pile_systeme).limite_indice_boucle = s_objet_1; |
(*(*s_etat_processus).l_base_pile_systeme).limite_indice_boucle = s_objet_1; |
|
|
Line 2767 instruction_step(struct_processus *s_eta
|
Line 2774 instruction_step(struct_processus *s_eta
|
return; |
return; |
} |
} |
|
|
if (((*s_etat_processus).s_liste_variables[(*s_etat_processus) |
if ((*(*s_etat_processus).pointeur_variable_courante) |
.position_variable_courante]).variable_verrouillee == d_vrai) |
.variable_verrouillee == d_vrai) |
{ |
{ |
liberation(s_etat_processus, s_objet); |
liberation(s_etat_processus, s_objet); |
|
|
Line 2776 instruction_step(struct_processus *s_eta
|
Line 2783 instruction_step(struct_processus *s_eta
|
return; |
return; |
} |
} |
|
|
if (((*s_etat_processus).s_liste_variables[(*s_etat_processus) |
if ((*(*s_etat_processus).pointeur_variable_courante).objet == NULL) |
.position_variable_courante]).objet == NULL) |
|
{ |
{ |
liberation(s_etat_processus, s_objet); |
liberation(s_etat_processus, s_objet); |
|
|
Line 2786 instruction_step(struct_processus *s_eta
|
Line 2792 instruction_step(struct_processus *s_eta
|
} |
} |
|
|
(*(*s_etat_processus).l_base_pile_systeme).indice_boucle = |
(*(*s_etat_processus).l_base_pile_systeme).indice_boucle = |
((*s_etat_processus).s_liste_variables[(*s_etat_processus) |
(*(*s_etat_processus).pointeur_variable_courante).objet; |
.position_variable_courante]).objet; |
|
} |
} |
|
|
/* |
/* |
Line 2828 instruction_step(struct_processus *s_eta
|
Line 2833 instruction_step(struct_processus *s_eta
|
*/ |
*/ |
|
|
(*(*s_etat_processus).l_base_pile_systeme).indice_boucle = NULL; |
(*(*s_etat_processus).l_base_pile_systeme).indice_boucle = NULL; |
((*s_etat_processus).s_liste_variables[(*s_etat_processus) |
(*(*s_etat_processus).pointeur_variable_courante).objet = s_objet; |
.position_variable_courante]).objet = s_objet; |
|
} |
} |
else |
else |
{ |
{ |
Line 2913 instruction_step(struct_processus *s_eta
|
Line 2917 instruction_step(struct_processus *s_eta
|
{ |
{ |
(*s_etat_processus).niveau_courant--; |
(*s_etat_processus).niveau_courant--; |
|
|
if (retrait_variable_par_niveau(s_etat_processus) == d_erreur) |
if (retrait_variables_par_niveau(s_etat_processus) == d_erreur) |
{ |
{ |
return; |
return; |
} |
} |
Line 3085 instruction_stof(struct_processus *s_eta
|
Line 3089 instruction_stof(struct_processus *s_eta
|
|
|
for(i = 1; i <= 64; i++) |
for(i = 1; i <= 64; i++) |
{ |
{ |
indice_drapeau = i - 1; |
indice_drapeau = (unsigned char) (i - 1); |
indice_bloc = indice_drapeau / taille_bloc; |
indice_bloc = indice_drapeau / taille_bloc; |
indice_bit = indice_drapeau % taille_bloc; |
indice_bit = indice_drapeau % taille_bloc; |
masque = ((t_8_bits) 1) << (taille_bloc - indice_bit - 1); |
masque = (t_8_bits) (((t_8_bits) 1) << |
|
(taille_bloc - indice_bit - 1)); |
|
|
if (((*((logical8 *) (*s_objet).objet)) & |
if (((*((logical8 *) (*s_objet).objet)) & |
((logical8) 1) << indice_drapeau) != 0) |
((logical8) 1) << indice_drapeau) != 0) |
Line 3204 instruction_sto(struct_processus *s_etat
|
Line 3209 instruction_sto(struct_processus *s_etat
|
* La variable est accessible. |
* La variable est accessible. |
*/ |
*/ |
|
|
if ((*s_etat_processus).s_liste_variables[(*s_etat_processus) |
if ((*(*s_etat_processus).pointeur_variable_courante) |
.position_variable_courante].variable_verrouillee == d_vrai) |
.variable_verrouillee == d_vrai) |
{ |
{ |
liberation(s_etat_processus, s_objet_1); |
liberation(s_etat_processus, s_objet_1); |
liberation(s_etat_processus, s_objet_2); |
liberation(s_etat_processus, s_objet_2); |
Line 3214 instruction_sto(struct_processus *s_etat
|
Line 3219 instruction_sto(struct_processus *s_etat
|
return; |
return; |
} |
} |
|
|
if ((*s_etat_processus).s_liste_variables[(*s_etat_processus) |
if ((*(*s_etat_processus).pointeur_variable_courante).objet == NULL) |
.position_variable_courante].objet == NULL) |
|
{ |
{ |
if (pthread_mutex_lock(&((*(*s_etat_processus) |
|
.s_liste_variables_partagees).mutex)) != 0) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
return; |
|
} |
|
|
|
if (recherche_variable_partagee(s_etat_processus, |
if (recherche_variable_partagee(s_etat_processus, |
(*s_etat_processus).s_liste_variables[(*s_etat_processus) |
(*(*s_etat_processus).pointeur_variable_courante).nom, |
.position_variable_courante].nom, |
(*(*s_etat_processus).pointeur_variable_courante) |
(*s_etat_processus).s_liste_variables[(*s_etat_processus) |
.variable_partagee, (*(*s_etat_processus) |
.position_variable_courante].variable_partagee, |
.pointeur_variable_courante).origine) == NULL) |
(*s_etat_processus).s_liste_variables[(*s_etat_processus) |
{ |
.position_variable_courante].origine) == d_faux) |
if (((*s_etat_processus).autorisation_nom_implicite == 'N') && |
{ |
((*((struct_nom *) (*s_objet_1).objet)).symbole |
if (pthread_mutex_unlock(&((*(*s_etat_processus) |
== d_faux)) |
.s_liste_variables_partagees).mutex)) != 0) |
|
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_processus; |
liberation(s_etat_processus, s_objet_1); |
|
liberation(s_etat_processus, s_objet_2); |
|
|
|
(*s_etat_processus).erreur_systeme = d_es; |
|
(*s_etat_processus).erreur_execution = |
|
d_ex_creation_variable_globale; |
return; |
return; |
} |
} |
|
|
Line 3271 instruction_sto(struct_processus *s_etat
|
Line 3272 instruction_sto(struct_processus *s_etat
|
else |
else |
{ |
{ |
liberation(s_etat_processus, (*(*s_etat_processus) |
liberation(s_etat_processus, (*(*s_etat_processus) |
.s_liste_variables_partagees).table |
.pointeur_variable_partagee_courante).objet); |
[(*(*s_etat_processus).s_liste_variables_partagees) |
(*(*s_etat_processus).pointeur_variable_partagee_courante) |
.position_variable].objet); |
.objet = s_objet_2; |
|
|
(*(*s_etat_processus).s_liste_variables_partagees).table |
|
[(*(*s_etat_processus).s_liste_variables_partagees) |
|
.position_variable].objet = s_objet_2; |
|
|
|
if (pthread_mutex_unlock(&((*(*s_etat_processus) |
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; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
return; |
return; |
Line 3289 instruction_sto(struct_processus *s_etat
|
Line 3286 instruction_sto(struct_processus *s_etat
|
} |
} |
else |
else |
{ |
{ |
liberation(s_etat_processus, |
if (((*s_etat_processus).autorisation_nom_implicite == 'N') && |
(*s_etat_processus).s_liste_variables[(*s_etat_processus) |
((*((struct_nom *) (*s_objet_1).objet)).symbole == d_faux)) |
.position_variable_courante].objet); |
{ |
|
if ((*(*s_etat_processus).pointeur_variable_courante) |
|
.niveau == 1) |
|
{ |
|
liberation(s_etat_processus, s_objet_1); |
|
liberation(s_etat_processus, s_objet_2); |
|
|
|
(*s_etat_processus).erreur_execution = |
|
d_ex_creation_variable_globale; |
|
return; |
|
} |
|
} |
|
|
(*s_etat_processus).s_liste_variables[(*s_etat_processus) |
liberation(s_etat_processus, |
.position_variable_courante].objet = s_objet_2; |
(*(*s_etat_processus).pointeur_variable_courante).objet); |
|
(*(*s_etat_processus).pointeur_variable_courante).objet = |
|
s_objet_2; |
} |
} |
} |
} |
else |
else |
Line 3304 instruction_sto(struct_processus *s_etat
|
Line 3314 instruction_sto(struct_processus *s_etat
|
* une variable globale. |
* une variable globale. |
*/ |
*/ |
|
|
|
if (((*s_etat_processus).autorisation_nom_implicite == 'N') && |
|
((*((struct_nom *) (*s_objet_1).objet)).symbole == d_faux)) |
|
{ |
|
liberation(s_etat_processus, s_objet_1); |
|
liberation(s_etat_processus, s_objet_2); |
|
|
|
(*s_etat_processus).erreur_systeme = d_es; |
|
(*s_etat_processus).erreur_execution = |
|
d_ex_creation_variable_globale; |
|
return; |
|
} |
|
|
if ((s_variable.nom = malloc((strlen((*((struct_nom *) |
if ((s_variable.nom = malloc((strlen((*((struct_nom *) |
(*s_objet_1).objet)).nom) + 1) * sizeof(unsigned char))) |
(*s_objet_1).objet)).nom) + 1) * sizeof(unsigned char))) |
== NULL) |
== NULL) |
Line 3361 instruction_syseval(struct_processus *s_
|
Line 3383 instruction_syseval(struct_processus *s_
|
int pipes_sortie[2]; |
int pipes_sortie[2]; |
int status; |
int status; |
|
|
|
integer8 longueur_ecriture; |
|
integer8 longueur_traitee; |
|
|
logical1 drapeau_fin; |
logical1 drapeau_fin; |
logical1 presence_stdin; |
logical1 presence_stdin; |
|
|
Line 3369 instruction_syseval(struct_processus *s_
|
Line 3394 instruction_syseval(struct_processus *s_
|
|
|
pid_t pid; |
pid_t pid; |
|
|
sigset_t oldset; |
|
sigset_t set; |
|
|
|
ssize_t longueur_ecriture; |
|
|
|
struct_liste_chainee *l_element_courant; |
struct_liste_chainee *l_element_courant; |
struct_liste_chainee *l_element_precedent; |
struct_liste_chainee *l_element_precedent; |
struct_liste_chainee *l_element_stdin; |
struct_liste_chainee *l_element_stdin; |
Line 3386 instruction_syseval(struct_processus *s_
|
Line 3406 instruction_syseval(struct_processus *s_
|
struct sigaction action_courante; |
struct sigaction action_courante; |
struct sigaction action_passee; |
struct sigaction action_passee; |
|
|
|
unsigned char *ligne; |
unsigned char *ptr; |
unsigned char *ptr; |
unsigned char *ptr2; |
unsigned char *ptr2; |
unsigned char registre_autorisation_empilement_programme; |
unsigned char registre_autorisation_empilement_programme; |
Line 3393 instruction_syseval(struct_processus *s_
|
Line 3414 instruction_syseval(struct_processus *s_
|
unsigned char *registre_programme; |
unsigned char *registre_programme; |
unsigned char *tampon; |
unsigned char *tampon; |
|
|
unsigned long longueur_lecture; |
integer8 longueur_lecture; |
unsigned long longueur_tampon; |
integer8 longueur_tampon; |
unsigned long nombre_iterations; |
integer8 nombre_iterations; |
unsigned long nombre_lignes; |
integer8 nombre_lignes; |
unsigned long pointeur; |
integer8 pointeur; |
unsigned long registre_position_courante; |
integer8 registre_position_courante; |
|
|
(*s_etat_processus).erreur_execution = d_ex; |
(*s_etat_processus).erreur_execution = d_ex; |
|
|
Line 3492 instruction_syseval(struct_processus *s_
|
Line 3513 instruction_syseval(struct_processus *s_
|
registre_programme = (*s_etat_processus).definitions_chainees; |
registre_programme = (*s_etat_processus).definitions_chainees; |
registre_position_courante = (*s_etat_processus).position_courante; |
registre_position_courante = (*s_etat_processus).position_courante; |
|
|
(*s_etat_processus).definitions_chainees = |
|
(unsigned char *) (*s_objet).objet; |
|
(*s_etat_processus).position_courante = 0; |
(*s_etat_processus).position_courante = 0; |
(*s_etat_processus).autorisation_empilement_programme = 'N'; |
(*s_etat_processus).autorisation_empilement_programme = 'N'; |
|
|
Line 3501 instruction_syseval(struct_processus *s_
|
Line 3520 instruction_syseval(struct_processus *s_
|
* Échappement des guillemets |
* Échappement des guillemets |
*/ |
*/ |
|
|
ptr = (*s_etat_processus).definitions_chainees; |
if (((*s_etat_processus).definitions_chainees = |
ptr2 = ptr; |
formateur_flux(s_etat_processus, (unsigned char *) |
i = 0; |
(*s_objet).objet, &longueur_traitee)) == NULL) |
|
|
while((*ptr) != d_code_fin_chaine) |
|
{ |
{ |
if ((*ptr) == '\\') |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
{ |
return; |
switch (*(ptr + 1)) |
|
{ |
|
case '"': |
|
case '\\': |
|
{ |
|
ptr++; |
|
break; |
|
} |
|
} |
|
} |
|
|
|
*ptr2++ = *ptr++; |
|
} |
} |
|
|
*ptr2 = d_code_fin_chaine; |
|
|
|
/* |
/* |
* Scission de la chaîne en différents arguments |
* Scission de la chaîne en différents arguments |
*/ |
*/ |
Line 3536 instruction_syseval(struct_processus *s_
|
Line 3539 instruction_syseval(struct_processus *s_
|
{ |
{ |
if (recherche_instruction_suivante(s_etat_processus) == d_erreur) |
if (recherche_instruction_suivante(s_etat_processus) == d_erreur) |
{ |
{ |
|
free((*s_etat_processus).definitions_chainees); |
|
|
(*s_etat_processus).autorisation_empilement_programme = |
(*s_etat_processus).autorisation_empilement_programme = |
registre_autorisation_empilement_programme; |
registre_autorisation_empilement_programme; |
(*s_etat_processus).instruction_courante = |
(*s_etat_processus).instruction_courante = |
Line 3553 instruction_syseval(struct_processus *s_
|
Line 3558 instruction_syseval(struct_processus *s_
|
if ((s_objet_temporaire = allocation(s_etat_processus, CHN)) |
if ((s_objet_temporaire = allocation(s_etat_processus, CHN)) |
== NULL) |
== NULL) |
{ |
{ |
|
free((*s_etat_processus).definitions_chainees); |
|
|
(*s_etat_processus).autorisation_empilement_programme = |
(*s_etat_processus).autorisation_empilement_programme = |
registre_autorisation_empilement_programme; |
registre_autorisation_empilement_programme; |
(*s_etat_processus).instruction_courante = |
(*s_etat_processus).instruction_courante = |
Line 3597 instruction_syseval(struct_processus *s_
|
Line 3604 instruction_syseval(struct_processus *s_
|
&((*s_etat_processus).l_base_pile), |
&((*s_etat_processus).l_base_pile), |
s_objet_temporaire) == d_erreur) |
s_objet_temporaire) == d_erreur) |
{ |
{ |
|
free((*s_etat_processus).definitions_chainees); |
|
|
|
(*s_etat_processus).autorisation_empilement_programme = |
|
registre_autorisation_empilement_programme; |
|
(*s_etat_processus).instruction_courante = |
|
registre_instruction_courante; |
|
(*s_etat_processus).definitions_chainees = |
|
registre_programme; |
|
(*s_etat_processus).position_courante = |
|
registre_position_courante; |
return; |
return; |
} |
} |
} |
} |
Line 3609 instruction_syseval(struct_processus *s_
|
Line 3626 instruction_syseval(struct_processus *s_
|
nombre_arguments++; |
nombre_arguments++; |
} while(drapeau_fin == d_faux); |
} while(drapeau_fin == d_faux); |
|
|
|
free((*s_etat_processus).definitions_chainees); |
|
|
(*s_etat_processus).autorisation_empilement_programme = |
(*s_etat_processus).autorisation_empilement_programme = |
registre_autorisation_empilement_programme; |
registre_autorisation_empilement_programme; |
(*s_etat_processus).instruction_courante = |
(*s_etat_processus).instruction_courante = |
Line 3616 instruction_syseval(struct_processus *s_
|
Line 3635 instruction_syseval(struct_processus *s_
|
(*s_etat_processus).definitions_chainees = registre_programme; |
(*s_etat_processus).definitions_chainees = registre_programme; |
(*s_etat_processus).position_courante = registre_position_courante; |
(*s_etat_processus).position_courante = registre_position_courante; |
|
|
if ((arguments = malloc(nombre_arguments * sizeof(char *))) == NULL) |
if ((arguments = malloc(((size_t) nombre_arguments) * sizeof(char *))) |
|
== NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
return; |
return; |
Line 3668 instruction_syseval(struct_processus *s_
|
Line 3688 instruction_syseval(struct_processus *s_
|
|
|
fflush(NULL); |
fflush(NULL); |
|
|
sigfillset(&set); |
|
pthread_sigmask(SIG_BLOCK, &set, &oldset); |
|
|
|
verrouillage_threads_concurrents(s_etat_processus); |
verrouillage_threads_concurrents(s_etat_processus); |
pid = fork(); |
pid = fork(); |
deverrouillage_threads_concurrents(s_etat_processus); |
deverrouillage_threads_concurrents(s_etat_processus); |
|
|
pthread_sigmask(SIG_SETMASK, &oldset, NULL); |
|
sigpending(&set); |
|
|
|
if (pid < 0) |
if (pid < 0) |
{ |
{ |
if (close(pipes_entree[0]) != 0) |
if (close(pipes_entree[0]) != 0) |
Line 3830 instruction_syseval(struct_processus *s_
|
Line 3844 instruction_syseval(struct_processus *s_
|
|
|
while(l_element_courant != NULL) |
while(l_element_courant != NULL) |
{ |
{ |
longueur_ecriture = strlen((unsigned char *) |
if ((ligne = formateur_flux(s_etat_processus, |
(*(*l_element_courant).donnee).objet); |
(unsigned char *) (*(*l_element_courant).donnee) |
|
.objet, &longueur_ecriture)) == NULL) |
|
{ |
|
(*s_etat_processus).erreur_systeme = |
|
d_es_allocation_memoire; |
|
return; |
|
} |
|
|
# ifndef SEMAPHORES_NOMMES |
# ifndef SEMAPHORES_NOMMES |
if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0) |
if (sem_post(&((*s_etat_processus).semaphore_fork)) |
|
!= 0) |
# else |
# else |
if (sem_post((*s_etat_processus).semaphore_fork) != 0) |
if (sem_post((*s_etat_processus).semaphore_fork) != 0) |
# endif |
# endif |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_processus; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
Line 3844 instruction_syseval(struct_processus *s_
|
Line 3865 instruction_syseval(struct_processus *s_
|
} |
} |
|
|
while(write_atomic(s_etat_processus, |
while(write_atomic(s_etat_processus, |
pipes_entree[1], (unsigned char *) |
pipes_entree[1], ligne, |
(*(*l_element_courant).donnee).objet, |
(size_t) longueur_ecriture) != longueur_ecriture) |
longueur_ecriture) != longueur_ecriture) |
|
{ |
{ |
# ifndef SEMAPHORES_NOMMES |
# ifndef SEMAPHORES_NOMMES |
while(sem_wait(&((*s_etat_processus) |
while(sem_wait(&((*s_etat_processus) |
.semaphore_fork)) == -1) |
.semaphore_fork)) != 0) |
# else |
# else |
while(sem_wait((*s_etat_processus) |
while(sem_wait((*s_etat_processus) |
.semaphore_fork) == -1) |
.semaphore_fork) != 0) |
# endif |
# endif |
{ |
{ |
if (errno != EINTR) |
(*s_etat_processus).erreur_systeme = |
{ |
d_es_processus; |
(*s_etat_processus).erreur_systeme = |
return; |
d_es_processus; |
|
return; |
|
} |
|
} |
} |
|
|
if (longueur_ecriture == -1) |
if (longueur_ecriture == -1) |
Line 3871 instruction_syseval(struct_processus *s_
|
Line 3888 instruction_syseval(struct_processus *s_
|
} |
} |
|
|
# ifndef SEMAPHORES_NOMMES |
# ifndef SEMAPHORES_NOMMES |
if (sem_post(&((*s_etat_processus) |
if (sem_post(&((*s_etat_processus) |
.semaphore_fork)) != 0) |
.semaphore_fork)) != 0) |
# else |
# else |
if (sem_post((*s_etat_processus) |
if (sem_post((*s_etat_processus) |
.semaphore_fork) != 0) |
.semaphore_fork) != 0) |
# endif |
# endif |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_processus; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
Line 3883 instruction_syseval(struct_processus *s_
|
Line 3900 instruction_syseval(struct_processus *s_
|
} |
} |
} |
} |
|
|
|
free(ligne); |
|
|
while(write_atomic(s_etat_processus, |
while(write_atomic(s_etat_processus, |
pipes_entree[1], "\n", 1) != 1) |
pipes_entree[1], "\n", 1) != 1) |
{ |
{ |
# ifndef SEMAPHORES_NOMMES |
# ifndef SEMAPHORES_NOMMES |
while(sem_wait(&((*s_etat_processus) |
while(sem_wait(&((*s_etat_processus) |
.semaphore_fork)) == -1) |
.semaphore_fork)) != 0) |
# else |
# else |
while(sem_wait((*s_etat_processus) |
while(sem_wait((*s_etat_processus) |
.semaphore_fork) == -1) |
.semaphore_fork) != 0) |
# endif |
# endif |
{ |
{ |
if (errno != EINTR) |
if (errno != EINTR) |
Line 3909 instruction_syseval(struct_processus *s_
|
Line 3928 instruction_syseval(struct_processus *s_
|
} |
} |
|
|
# ifndef SEMAPHORES_NOMMES |
# ifndef SEMAPHORES_NOMMES |
if (sem_post(&((*s_etat_processus) |
if (sem_post(&((*s_etat_processus) |
.semaphore_fork)) != 0) |
.semaphore_fork)) != 0) |
# else |
# else |
if (sem_post((*s_etat_processus) |
if (sem_post((*s_etat_processus) |
.semaphore_fork) != 0) |
.semaphore_fork) != 0) |
# endif |
# endif |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_processus; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
Line 3922 instruction_syseval(struct_processus *s_
|
Line 3941 instruction_syseval(struct_processus *s_
|
} |
} |
|
|
# ifndef SEMAPHORES_NOMMES |
# ifndef SEMAPHORES_NOMMES |
while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) |
while(sem_wait(&((*s_etat_processus).semaphore_fork)) |
|
!= 0) |
# else |
# else |
while(sem_wait((*s_etat_processus).semaphore_fork) == -1) |
while(sem_wait((*s_etat_processus).semaphore_fork) != 0) |
# endif |
# endif |
{ |
{ |
if (errno != EINTR) |
if (errno != EINTR) |
Line 3956 instruction_syseval(struct_processus *s_
|
Line 3976 instruction_syseval(struct_processus *s_
|
*/ |
*/ |
|
|
# ifndef SEMAPHORES_NOMMES |
# ifndef SEMAPHORES_NOMMES |
if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0) |
if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0) |
# else |
# else |
if (sem_post((*s_etat_processus).semaphore_fork) != 0) |
if (sem_post((*s_etat_processus).semaphore_fork) != 0) |
# endif |
# endif |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_processus; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
Line 3968 instruction_syseval(struct_processus *s_
|
Line 3988 instruction_syseval(struct_processus *s_
|
if (waitpid(pid, &status, 0) == -1) |
if (waitpid(pid, &status, 0) == -1) |
{ |
{ |
# ifndef SEMAPHORES_NOMMES |
# ifndef SEMAPHORES_NOMMES |
if (sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) |
if (sem_post(&((*s_etat_processus).semaphore_fork)) |
|
!= 0) |
# else |
# else |
if (sem_wait((*s_etat_processus).semaphore_fork) == -1) |
if (sem_post((*s_etat_processus).semaphore_fork) != 0) |
# endif |
# endif |
{ |
{ |
if (errno != EINTR) |
(*s_etat_processus).erreur_systeme = d_es_processus; |
{ |
return; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
return; |
|
} |
|
} |
} |
|
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
Line 3985 instruction_syseval(struct_processus *s_
|
Line 4003 instruction_syseval(struct_processus *s_
|
} |
} |
|
|
# ifndef SEMAPHORES_NOMMES |
# ifndef SEMAPHORES_NOMMES |
if (sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) |
while(sem_wait(&((*s_etat_processus).semaphore_fork)) != 0) |
# else |
# else |
if (sem_wait((*s_etat_processus).semaphore_fork) == -1) |
while(sem_wait((*s_etat_processus).semaphore_fork) != 0) |
# endif |
# endif |
{ |
{ |
if (errno != EINTR) |
if (errno != EINTR) |
Line 4002 instruction_syseval(struct_processus *s_
|
Line 4020 instruction_syseval(struct_processus *s_
|
pointeur = 0; |
pointeur = 0; |
nombre_iterations = 1; |
nombre_iterations = 1; |
|
|
if ((tampon = malloc((longueur_lecture + 1) * |
if ((tampon = malloc(((size_t) (longueur_lecture + 1)) * |
sizeof(unsigned char))) == NULL) |
sizeof(unsigned char))) == NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
return; |
return; |
} |
} |
|
|
|
tampon[0] = d_code_fin_chaine; |
|
|
# ifndef SEMAPHORES_NOMMES |
# ifndef SEMAPHORES_NOMMES |
if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0) |
if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0) |
{ |
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
return; |
|
} |
|
# else |
# else |
if (sem_post((*s_etat_processus).semaphore_fork) != 0) |
if (sem_post((*s_etat_processus).semaphore_fork) != 0) |
|
# endif |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_processus; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
return; |
return; |
} |
} |
# endif |
|
|
|
while((ios = read_atomic(s_etat_processus, |
while((ios = (int) read_atomic(s_etat_processus, |
pipes_sortie[0], &(tampon[pointeur]), |
pipes_sortie[0], &(tampon[pointeur]), |
longueur_lecture)) > 0) |
(size_t) longueur_lecture)) > 0) |
{ |
{ |
# ifndef SEMAPHORES_NOMMES |
# ifndef SEMAPHORES_NOMMES |
while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) |
while(sem_wait(&((*s_etat_processus).semaphore_fork)) != 0) |
# else |
# else |
while(sem_wait((*s_etat_processus).semaphore_fork) == -1) |
while(sem_wait((*s_etat_processus).semaphore_fork) != 0) |
# endif |
# endif |
{ |
{ |
if (errno != EINTR) |
(*s_etat_processus).erreur_systeme = d_es_processus; |
{ |
return; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
return; |
|
} |
|
} |
} |
|
|
tampon[pointeur + ios] = d_code_fin_chaine; |
tampon[pointeur + ios] = d_code_fin_chaine; |
Line 4045 instruction_syseval(struct_processus *s_
|
Line 4058 instruction_syseval(struct_processus *s_
|
nombre_iterations++; |
nombre_iterations++; |
|
|
if ((tampon = realloc(tampon, |
if ((tampon = realloc(tampon, |
((nombre_iterations * longueur_lecture) + 1) * |
((size_t) ((nombre_iterations * longueur_lecture) + 1)) |
sizeof(unsigned char))) == NULL) |
* sizeof(unsigned char))) == NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = |
(*s_etat_processus).erreur_systeme = |
d_es_allocation_memoire; |
d_es_allocation_memoire; |
Line 4054 instruction_syseval(struct_processus *s_
|
Line 4067 instruction_syseval(struct_processus *s_
|
} |
} |
|
|
# ifndef SEMAPHORES_NOMMES |
# ifndef SEMAPHORES_NOMMES |
if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0) |
if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0) |
# else |
# else |
if (sem_post((*s_etat_processus).semaphore_fork) != 0) |
if (sem_post((*s_etat_processus).semaphore_fork) != 0) |
# endif |
# endif |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_processus; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
Line 4065 instruction_syseval(struct_processus *s_
|
Line 4078 instruction_syseval(struct_processus *s_
|
} |
} |
|
|
# ifndef SEMAPHORES_NOMMES |
# ifndef SEMAPHORES_NOMMES |
while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) |
while(sem_wait(&((*s_etat_processus).semaphore_fork)) != 0) |
# else |
# else |
while(sem_wait((*s_etat_processus).semaphore_fork) == -1) |
while(sem_wait((*s_etat_processus).semaphore_fork) != 0) |
# endif |
# endif |
{ |
{ |
if (errno != EINTR) |
if (errno != EINTR) |
Line 4077 instruction_syseval(struct_processus *s_
|
Line 4090 instruction_syseval(struct_processus *s_
|
} |
} |
} |
} |
|
|
if ((tampon = realloc(tampon, (strlen(tampon) + 1) * |
|
sizeof(unsigned char))) == NULL) |
|
{ |
|
(*s_etat_processus).erreur_systeme = |
|
d_es_allocation_memoire; |
|
return; |
|
} |
|
|
|
if (ios == -1) |
if (ios == -1) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_processus; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
Line 4101 instruction_syseval(struct_processus *s_
|
Line 4106 instruction_syseval(struct_processus *s_
|
* Transformation de la chaîne en liste |
* Transformation de la chaîne en liste |
*/ |
*/ |
|
|
longueur_tampon = strlen(tampon); |
longueur_tampon = (integer8) strlen(tampon); |
|
|
for(i = 0, ptr = tampon, nombre_lignes = 0; |
for(i = 0, ptr = tampon, nombre_lignes = 0; |
i < (long) longueur_tampon; i++, ptr++) |
i < longueur_tampon; i++, ptr++) |
{ |
{ |
if ((*ptr) == d_code_retour_chariot) |
if ((*ptr) == d_code_retour_chariot) |
{ |
{ |
Line 4138 instruction_syseval(struct_processus *s_
|
Line 4143 instruction_syseval(struct_processus *s_
|
l_element_courant = (struct_liste_chainee *) |
l_element_courant = (struct_liste_chainee *) |
(*s_objet_resultat).objet; |
(*s_objet_resultat).objet; |
|
|
for(i = 0, ptr = tampon; i < (long) nombre_lignes; i++) |
for(i = 0, ptr = tampon; i < nombre_lignes; i++) |
{ |
{ |
if (((*l_element_courant).donnee = |
if (((*l_element_courant).donnee = |
allocation(s_etat_processus, CHN)) == NULL) |
allocation(s_etat_processus, CHN)) == NULL) |
Line 4149 instruction_syseval(struct_processus *s_
|
Line 4154 instruction_syseval(struct_processus *s_
|
} |
} |
|
|
if (((*(*l_element_courant).donnee).objet = |
if (((*(*l_element_courant).donnee).objet = |
malloc((strlen(ptr) + 1) * sizeof(unsigned char))) |
analyse_flux(s_etat_processus, ptr, |
== NULL) |
(integer8) strlen(ptr))) == NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = |
(*s_etat_processus).erreur_systeme = |
d_es_allocation_memoire; |
d_es_allocation_memoire; |
return; |
return; |
} |
} |
|
|
strcpy((*(*l_element_courant).donnee).objet, ptr); |
|
|
|
while((*ptr) != d_code_fin_chaine) |
while((*ptr) != d_code_fin_chaine) |
{ |
{ |
ptr++; |
ptr++; |
Line 4217 instruction_syseval(struct_processus *s_
|
Line 4220 instruction_syseval(struct_processus *s_
|
} |
} |
|
|
# ifndef SEMAPHORES_NOMMES |
# ifndef SEMAPHORES_NOMMES |
if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0) |
if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0) |
# else |
# else |
if (sem_post((*s_etat_processus).semaphore_fork) != 0) |
if (sem_post((*s_etat_processus).semaphore_fork) != 0) |
# endif |
# endif |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_processus; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
Line 4238 instruction_syseval(struct_processus *s_
|
Line 4241 instruction_syseval(struct_processus *s_
|
== d_erreur) |
== d_erreur) |
{ |
{ |
# ifndef SEMAPHORES_NOMMES |
# ifndef SEMAPHORES_NOMMES |
while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) |
while(sem_wait(&((*s_etat_processus).semaphore_fork)) != 0) |
# else |
# else |
while(sem_wait((*s_etat_processus).semaphore_fork) == -1) |
while(sem_wait((*s_etat_processus).semaphore_fork) != 0) |
# endif |
# endif |
{ |
{ |
if (errno != EINTR) |
if (errno != EINTR) |
Line 4261 instruction_syseval(struct_processus *s_
|
Line 4264 instruction_syseval(struct_processus *s_
|
} |
} |
|
|
# ifndef SEMAPHORES_NOMMES |
# ifndef SEMAPHORES_NOMMES |
while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) |
while(sem_wait(&((*s_etat_processus).semaphore_fork)) != 0) |
# else |
# else |
while(sem_wait((*s_etat_processus).semaphore_fork) == -1) |
while(sem_wait((*s_etat_processus).semaphore_fork) != 0) |
# endif |
# endif |
{ |
{ |
if (errno != EINTR) |
if (errno != EINTR) |
Line 4876 instruction_sci(struct_processus *s_etat
|
Line 4879 instruction_sci(struct_processus *s_etat
|
return; |
return; |
} |
} |
|
|
(*((logical8 *) (*s_objet).objet)) = |
(*((logical8 *) (*s_objet).objet)) = (logical8) |
(*((integer8 *) (*s_objet_argument).objet)); |
(*((integer8 *) (*s_objet_argument).objet)); |
|
|
i43 = test_cfsf(s_etat_processus, 43); |
i43 = test_cfsf(s_etat_processus, 43); |
Line 4914 instruction_sci(struct_processus *s_etat
|
Line 4917 instruction_sci(struct_processus *s_etat
|
{ |
{ |
if (valeur_binaire[i] == '0') |
if (valeur_binaire[i] == '0') |
{ |
{ |
cf(s_etat_processus, j++); |
cf(s_etat_processus, (unsigned char) j++); |
} |
} |
else |
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++)); |
|
|
cf(s_etat_processus, 49); |
cf(s_etat_processus, 49); |
sf(s_etat_processus, 50); |
sf(s_etat_processus, 50); |