version 1.7, 2010/04/07 13:45:08
|
version 1.18, 2010/08/13 21:00:37
|
Line 1
|
Line 1
|
/* |
/* |
================================================================================ |
================================================================================ |
RPL/2 (R) version 4.0.14 |
RPL/2 (R) version 4.0.18 |
Copyright (C) 1989-2010 Dr. BERTRAND Joël |
Copyright (C) 1989-2010 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 1275 instruction_same(struct_processus *s_eta
|
Line 1275 instruction_same(struct_processus *s_eta
|
printf(" 1: %s\n", d_RPN); |
printf(" 1: %s\n", d_RPN); |
printf("-> 1: %s\n", d_RPN); |
printf("-> 1: %s\n", d_RPN); |
|
|
|
printf(" 2: %s\n", d_PRC); |
|
printf(" 1: %s\n", d_PRC); |
|
printf("-> 1: %s\n", d_INT); |
|
|
return; |
return; |
} |
} |
else if ((*s_etat_processus).test_instruction == 'Y') |
else if ((*s_etat_processus).test_instruction == 'Y') |
Line 2569 instruction_start(struct_processus *s_et
|
Line 2573 instruction_start(struct_processus *s_et
|
} |
} |
|
|
empilement_pile_systeme(s_etat_processus); |
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).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), |
Line 2578 instruction_start(struct_processus *s_et
|
Line 2588 instruction_start(struct_processus *s_et
|
return; |
return; |
} |
} |
|
|
if (((*s_objet_1).type != INT) && |
if (((*s_objet_1).type != INT) && ((*s_objet_1).type != REL)) |
((*s_objet_1).type != REL)) |
|
{ |
{ |
liberation(s_etat_processus, s_objet_1); |
liberation(s_etat_processus, s_objet_1); |
|
|
Line 2596 instruction_start(struct_processus *s_et
|
Line 2605 instruction_start(struct_processus *s_et
|
return; |
return; |
} |
} |
|
|
if (((*s_objet_2).type != INT) && |
if (((*s_objet_2).type != INT) && ((*s_objet_2).type != REL)) |
((*s_objet_2).type != REL)) |
|
{ |
{ |
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 3671 instruction_syseval(struct_processus *s_
|
Line 3679 instruction_syseval(struct_processus *s_
|
|
|
verrouillage_threads_concurrents(s_etat_processus); |
verrouillage_threads_concurrents(s_etat_processus); |
pid = fork(); |
pid = fork(); |
|
|
|
# ifdef OS2 |
|
if (pid == 0) |
|
{ |
|
sem_init(&semaphore_liste_threads, 0, 1); |
|
sem_init(&semaphore_gestionnaires_signaux, 0, 0); |
|
sem_init(&semaphore_gestionnaires_signaux_atomique, 0, 1); |
|
sem_init(&((*s_etat_processus).semaphore_fork), 0, 0); |
|
} |
|
# endif |
|
|
deverrouillage_threads_concurrents(s_etat_processus); |
deverrouillage_threads_concurrents(s_etat_processus); |
|
|
pthread_sigmask(SIG_SETMASK, &oldset, NULL); |
pthread_sigmask(SIG_SETMASK, &oldset, NULL); |
Line 3831 instruction_syseval(struct_processus *s_
|
Line 3850 instruction_syseval(struct_processus *s_
|
longueur_ecriture = strlen((unsigned char *) |
longueur_ecriture = strlen((unsigned char *) |
(*(*l_element_courant).donnee).objet); |
(*(*l_element_courant).donnee).objet); |
|
|
|
# ifndef SEMAPHORES_NOMMES |
if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0) |
if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0) |
|
# else |
|
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; |
Line 3842 instruction_syseval(struct_processus *s_
|
Line 3865 instruction_syseval(struct_processus *s_
|
(*(*l_element_courant).donnee).objet, |
(*(*l_element_courant).donnee).objet, |
longueur_ecriture) != longueur_ecriture) |
longueur_ecriture) != longueur_ecriture) |
{ |
{ |
|
# ifndef SEMAPHORES_NOMMES |
while(sem_wait(&((*s_etat_processus) |
while(sem_wait(&((*s_etat_processus) |
.semaphore_fork)) == -1) |
.semaphore_fork)) == -1) |
|
# else |
|
while(sem_wait((*s_etat_processus) |
|
.semaphore_fork) == -1) |
|
# endif |
{ |
{ |
if (errno != EINTR) |
if (errno != EINTR) |
{ |
{ |
Line 3859 instruction_syseval(struct_processus *s_
|
Line 3887 instruction_syseval(struct_processus *s_
|
return; |
return; |
} |
} |
|
|
|
# ifndef SEMAPHORES_NOMMES |
if (sem_post(&((*s_etat_processus) |
if (sem_post(&((*s_etat_processus) |
.semaphore_fork)) != 0) |
.semaphore_fork)) != 0) |
|
# else |
|
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; |
Line 3870 instruction_syseval(struct_processus *s_
|
Line 3903 instruction_syseval(struct_processus *s_
|
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 |
while(sem_wait(&((*s_etat_processus) |
while(sem_wait(&((*s_etat_processus) |
.semaphore_fork)) == -1) |
.semaphore_fork)) == -1) |
|
# else |
|
while(sem_wait((*s_etat_processus) |
|
.semaphore_fork) == -1) |
|
# endif |
{ |
{ |
if (errno != EINTR) |
if (errno != EINTR) |
{ |
{ |
Line 3887 instruction_syseval(struct_processus *s_
|
Line 3925 instruction_syseval(struct_processus *s_
|
return; |
return; |
} |
} |
|
|
|
# ifndef SEMAPHORES_NOMMES |
if (sem_post(&((*s_etat_processus) |
if (sem_post(&((*s_etat_processus) |
.semaphore_fork)) != 0) |
.semaphore_fork)) != 0) |
|
# else |
|
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; |
} |
} |
} |
} |
|
|
while(sem_wait(&((*s_etat_processus).semaphore_fork)) |
# ifndef SEMAPHORES_NOMMES |
== -1) |
while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) |
|
# else |
|
while(sem_wait((*s_etat_processus).semaphore_fork) == -1) |
|
# endif |
{ |
{ |
if (errno != EINTR) |
if (errno != EINTR) |
{ |
{ |
Line 3926 instruction_syseval(struct_processus *s_
|
Line 3972 instruction_syseval(struct_processus *s_
|
* Récupération de la valeur de retour du processus détaché |
* Récupération de la valeur de retour du processus détaché |
*/ |
*/ |
|
|
if (sem_post(&((*s_etat_processus).semaphore_fork)) |
# ifndef SEMAPHORES_NOMMES |
!= 0) |
if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0) |
|
# else |
|
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; |
Line 3935 instruction_syseval(struct_processus *s_
|
Line 3984 instruction_syseval(struct_processus *s_
|
|
|
if (waitpid(pid, &status, 0) == -1) |
if (waitpid(pid, &status, 0) == -1) |
{ |
{ |
|
# ifndef SEMAPHORES_NOMMES |
if (sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) |
if (sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) |
|
# else |
|
if (sem_wait((*s_etat_processus).semaphore_fork) == -1) |
|
# endif |
{ |
{ |
if (errno != EINTR) |
if (errno != EINTR) |
{ |
{ |
Line 3948 instruction_syseval(struct_processus *s_
|
Line 4001 instruction_syseval(struct_processus *s_
|
return; |
return; |
} |
} |
|
|
|
# ifndef SEMAPHORES_NOMMES |
if (sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) |
if (sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) |
|
# else |
|
if (sem_wait((*s_etat_processus).semaphore_fork) == -1) |
|
# endif |
{ |
{ |
if (errno != EINTR) |
if (errno != EINTR) |
{ |
{ |
Line 3969 instruction_syseval(struct_processus *s_
|
Line 4026 instruction_syseval(struct_processus *s_
|
return; |
return; |
} |
} |
|
|
|
# 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; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
return; |
return; |
} |
} |
|
# else |
|
if (sem_post((*s_etat_processus).semaphore_fork) != 0) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
return; |
|
} |
|
# endif |
|
|
while((ios = read_atomic(s_etat_processus, |
while((ios = read_atomic(s_etat_processus, |
pipes_sortie[0], &(tampon[pointeur]), |
pipes_sortie[0], &(tampon[pointeur]), |
longueur_lecture)) > 0) |
longueur_lecture)) > 0) |
{ |
{ |
|
# ifndef SEMAPHORES_NOMMES |
while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) |
while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) |
|
# else |
|
while(sem_wait((*s_etat_processus).semaphore_fork) == -1) |
|
# endif |
{ |
{ |
if (errno != EINTR) |
if (errno != EINTR) |
{ |
{ |
Line 4001 instruction_syseval(struct_processus *s_
|
Line 4070 instruction_syseval(struct_processus *s_
|
return; |
return; |
} |
} |
|
|
|
# ifndef SEMAPHORES_NOMMES |
if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0) |
if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0) |
|
# else |
|
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; |
} |
} |
} |
} |
|
|
|
# ifndef SEMAPHORES_NOMMES |
while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) |
while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) |
|
# else |
|
while(sem_wait((*s_etat_processus).semaphore_fork) == -1) |
|
# endif |
{ |
{ |
if (errno != EINTR) |
if (errno != EINTR) |
{ |
{ |
Line 4156 instruction_syseval(struct_processus *s_
|
Line 4233 instruction_syseval(struct_processus *s_
|
return; |
return; |
} |
} |
|
|
|
# ifndef SEMAPHORES_NOMMES |
if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0) |
if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0) |
|
# else |
|
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; |
Line 4173 instruction_syseval(struct_processus *s_
|
Line 4254 instruction_syseval(struct_processus *s_
|
&((*s_etat_processus).l_base_pile), s_objet_resultat) |
&((*s_etat_processus).l_base_pile), s_objet_resultat) |
== d_erreur) |
== d_erreur) |
{ |
{ |
|
# ifndef SEMAPHORES_NOMMES |
while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) |
while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) |
|
# else |
|
while(sem_wait((*s_etat_processus).semaphore_fork) == -1) |
|
# endif |
{ |
{ |
if (errno != EINTR) |
if (errno != EINTR) |
{ |
{ |
Line 4192 instruction_syseval(struct_processus *s_
|
Line 4277 instruction_syseval(struct_processus *s_
|
return; |
return; |
} |
} |
|
|
|
# ifndef SEMAPHORES_NOMMES |
while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) |
while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) |
|
# else |
|
while(sem_wait((*s_etat_processus).semaphore_fork) == -1) |
|
# endif |
{ |
{ |
if (errno != EINTR) |
if (errno != EINTR) |
{ |
{ |