version 1.4, 2010/03/04 10:17:47
|
version 1.26, 2011/06/21 07:45:20
|
Line 1
|
Line 1
|
/* |
/* |
================================================================================ |
================================================================================ |
RPL/2 (R) version 4.0.12 |
RPL/2 (R) version 4.1.0.prerelease.1 |
Copyright (C) 1989-2010 Dr. BERTRAND Joël |
Copyright (C) 1989-2011 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" |
|
|
static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; |
static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; |
|
|
Line 41 void *
|
Line 41 void *
|
chargement_bibliotheque(struct_processus *s_etat_processus, |
chargement_bibliotheque(struct_processus *s_etat_processus, |
unsigned char *bibliotheque) |
unsigned char *bibliotheque) |
{ |
{ |
char **(*fonction)(unsigned long *); |
char **(*fonction)(unsigned long *, const char *); |
char *message; |
char *message; |
|
|
|
long i; |
|
long nombre_symboles; |
|
|
struct_rpl_arguments rpl_arguments; |
struct_rpl_arguments rpl_arguments; |
|
|
struct_liste_chainee *l_element_courant; |
struct_liste_chainee *l_element_courant; |
Line 52 chargement_bibliotheque(struct_processus
|
Line 55 chargement_bibliotheque(struct_processus
|
unsigned char **tableau; |
unsigned char **tableau; |
unsigned char *tampon; |
unsigned char *tampon; |
|
|
unsigned long nombre_symboles; |
|
unsigned long i; |
|
|
|
void *descripteur_bibliotheque; |
void *descripteur_bibliotheque; |
void (*onloading)(struct_rpl_arguments *); |
void (*onloading)(struct_rpl_arguments *); |
|
|
Line 161 chargement_bibliotheque(struct_processus
|
Line 161 chargement_bibliotheque(struct_processus
|
} |
} |
} |
} |
|
|
|
# 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(NULL); |
return(NULL); |
} |
} |
|
# else |
|
if (sem_post((*s_etat_processus).semaphore_fork) != 0) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
return(NULL); |
|
} |
|
# endif |
|
|
(*onloading)(&rpl_arguments); |
(*onloading)(&rpl_arguments); |
|
|
|
# ifndef SEMAPHORES_NOMMES |
while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) |
while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) |
{ |
{ |
if (errno != EINTR) |
if (errno != EINTR) |
Line 177 chargement_bibliotheque(struct_processus
|
Line 186 chargement_bibliotheque(struct_processus
|
return(NULL); |
return(NULL); |
} |
} |
} |
} |
|
# else |
|
while(sem_wait((*s_etat_processus).semaphore_fork) == -1) |
|
{ |
|
if (errno != EINTR) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
return(NULL); |
|
} |
|
} |
|
# endif |
|
|
if ((*s_etat_processus).profilage == d_vrai) |
if ((*s_etat_processus).profilage == d_vrai) |
{ |
{ |
Line 315 chargement_bibliotheque(struct_processus
|
Line 334 chargement_bibliotheque(struct_processus
|
} |
} |
} |
} |
|
|
|
dlerror(); |
|
|
if (pthread_mutex_unlock(&mutex) != 0) |
if (pthread_mutex_unlock(&mutex) != 0) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_processus; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
Line 325 chargement_bibliotheque(struct_processus
|
Line 346 chargement_bibliotheque(struct_processus
|
* Ajout des symboles externes |
* Ajout des symboles externes |
*/ |
*/ |
|
|
if ((tableau = (unsigned char **) (*fonction)(&nombre_symboles)) == NULL) |
if ((tableau = (unsigned char **) (*fonction)((&nombre_symboles), |
|
d_version_rpl)) == NULL) |
{ |
{ |
|
/* |
|
* Nombre symboles : |
|
* 0 : aucun symbole exporté |
|
* >0 : nombre de symboles exportés |
|
* -1 : version de bibliothèque incompatible |
|
*/ |
|
|
if (nombre_symboles == 0) |
if (nombre_symboles == 0) |
{ |
{ |
(*s_etat_processus).erreur_execution = d_ex_aucun_symbole; |
(*s_etat_processus).erreur_execution = d_ex_aucun_symbole; |
} |
} |
|
else if (nombre_symboles == -1) |
|
{ |
|
(*s_etat_processus).erreur_execution = d_ex_version_bibliotheque; |
|
} |
else |
else |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
Line 380 chargement_bibliotheque(struct_processus
|
Line 413 chargement_bibliotheque(struct_processus
|
strcpy((*s_etat_processus).s_instructions_externes[(*s_etat_processus) |
strcpy((*s_etat_processus).s_instructions_externes[(*s_etat_processus) |
.nombre_instructions_externes].nom_bibliotheque, tableau[i]); |
.nombre_instructions_externes].nom_bibliotheque, tableau[i]); |
(*s_etat_processus).nombre_instructions_externes++; |
(*s_etat_processus).nombre_instructions_externes++; |
|
|
free(tableau[i]); |
free(tableau[i]); |
} |
} |
|
|
Line 557 retrait_bibliotheque(struct_processus *s
|
Line 591 retrait_bibliotheque(struct_processus *s
|
} |
} |
} |
} |
|
|
|
# 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(d_erreur); |
return(d_erreur); |
} |
} |
|
# else |
|
if (sem_post((*s_etat_processus).semaphore_fork) != 0) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
return(d_erreur); |
|
} |
|
# endif |
|
|
(*onclosing)(&rpl_arguments); |
(*onclosing)(&rpl_arguments); |
|
|
|
# ifndef SEMAPHORES_NOMMES |
while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) |
while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) |
{ |
{ |
if (errno != EINTR) |
if (errno != EINTR) |
Line 573 retrait_bibliotheque(struct_processus *s
|
Line 616 retrait_bibliotheque(struct_processus *s
|
return(d_erreur); |
return(d_erreur); |
} |
} |
} |
} |
|
# else |
|
while(sem_wait((*s_etat_processus).semaphore_fork) == -1) |
|
{ |
|
if (errno != EINTR) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
return(d_erreur); |
|
} |
|
} |
|
# endif |
|
|
if ((*s_etat_processus).profilage == d_vrai) |
if ((*s_etat_processus).profilage == d_vrai) |
{ |
{ |
Line 1067 execution_fonction_de_bibliotheque(struc
|
Line 1120 execution_fonction_de_bibliotheque(struc
|
} |
} |
} |
} |
|
|
|
dlerror(); |
|
|
if (pthread_mutex_unlock(&mutex) != 0) |
if (pthread_mutex_unlock(&mutex) != 0) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_processus; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
Line 1122 execution_fonction_de_bibliotheque(struc
|
Line 1177 execution_fonction_de_bibliotheque(struc
|
} |
} |
} |
} |
|
|
|
# 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(d_faux); |
return(d_faux); |
} |
} |
|
# else |
|
if (sem_post((*s_etat_processus).semaphore_fork) != 0) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
return(d_faux); |
|
} |
|
# endif |
|
|
(*fonction)(&rpl_arguments); |
(*fonction)(&rpl_arguments); |
|
|
|
# ifndef SEMAPHORES_NOMMES |
while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) |
while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) |
{ |
{ |
if (errno != EINTR) |
if (errno != EINTR) |
Line 1138 execution_fonction_de_bibliotheque(struc
|
Line 1202 execution_fonction_de_bibliotheque(struc
|
return(d_faux); |
return(d_faux); |
} |
} |
} |
} |
|
# else |
|
while(sem_wait((*s_etat_processus).semaphore_fork) == -1) |
|
{ |
|
if (errno != EINTR) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
return(d_faux); |
|
} |
|
} |
|
# endif |
|
|
if ((*s_etat_processus).profilage == d_vrai) |
if ((*s_etat_processus).profilage == d_vrai) |
{ |
{ |
Line 1593 tri_base_symboles_externes(struct_proces
|
Line 1667 tri_base_symboles_externes(struct_proces
|
do |
do |
{ |
{ |
indice_i = indice_j; |
indice_i = indice_j; |
|
|
terminaison_boucle_3 = d_faux; |
terminaison_boucle_3 = d_faux; |
|
|
do |
do |
Line 1687 tri_base_symboles_externes(struct_proces
|
Line 1760 tri_base_symboles_externes(struct_proces
|
|
|
indice_i++; |
indice_i++; |
} while((unsigned long) (indice_i + 1) < |
} while((unsigned long) (indice_i + 1) < |
(*s_etat_processus).nombre_variables); |
(*s_etat_processus).nombre_instructions_externes); |
|
|
return; |
return; |
} |
} |