version 1.49, 2013/02/26 19:56:11
|
version 1.62, 2015/01/27 14:18:05
|
Line 1
|
Line 1
|
/* |
/* |
================================================================================ |
================================================================================ |
RPL/2 (R) version 4.1.12 |
RPL/2 (R) version 4.1.20 |
Copyright (C) 1989-2013 Dr. BERTRAND Joël |
Copyright (C) 1989-2015 Dr. BERTRAND Joël |
|
|
This file is part of RPL/2. |
This file is part of RPL/2. |
|
|
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 *, const char *); |
char **(*fonction)(struct_rpl_arguments *, |
|
integer8 *, const char *); |
char *message; |
char *message; |
|
|
long i; |
integer8 i; |
long nombre_symboles; |
integer8 nombre_symboles; |
|
|
struct_rpl_arguments rpl_arguments; |
struct_rpl_arguments rpl_arguments; |
|
|
Line 56 chargement_bibliotheque(struct_processus
|
Line 57 chargement_bibliotheque(struct_processus
|
unsigned char *tampon; |
unsigned char *tampon; |
|
|
void *descripteur_bibliotheque; |
void *descripteur_bibliotheque; |
void (*onloading)(struct_rpl_arguments *); |
int (*onloading)(struct_rpl_arguments *); |
|
|
/* |
/* |
* On vérifie que la bibliothèque n'est pas déjà chargée. |
* On vérifie que la bibliothèque n'est pas déjà chargée. |
Line 335 chargement_bibliotheque(struct_processus
|
Line 336 chargement_bibliotheque(struct_processus
|
* Ajout des symboles externes |
* Ajout des symboles externes |
*/ |
*/ |
|
|
if ((tableau = (unsigned char **) (*fonction)((&nombre_symboles), |
if ((tableau = (unsigned char **) (*fonction)(&rpl_arguments, |
d_version_rpl)) == NULL) |
(&nombre_symboles), d_version_rpl)) == NULL) |
{ |
{ |
/* |
/* |
* Nombre symboles : |
* Nombre symboles : |
Line 362 chargement_bibliotheque(struct_processus
|
Line 363 chargement_bibliotheque(struct_processus
|
} |
} |
|
|
if (((*s_etat_processus).s_instructions_externes = realloc( |
if (((*s_etat_processus).s_instructions_externes = realloc( |
(*s_etat_processus).s_instructions_externes, |
(*s_etat_processus).s_instructions_externes, ((size_t) |
((*s_etat_processus).nombre_instructions_externes + nombre_symboles) |
((*s_etat_processus).nombre_instructions_externes + |
* sizeof(struct_instruction_externe))) == NULL) |
nombre_symboles)) * sizeof(struct_instruction_externe))) == NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
return(NULL); |
return(NULL); |
Line 485 retrait_bibliotheque(struct_processus *s
|
Line 486 retrait_bibliotheque(struct_processus *s
|
|
|
unsigned char *tampon; |
unsigned char *tampon; |
|
|
unsigned long i; |
integer8 i; |
unsigned long j; |
integer8 j; |
unsigned long nombre_symboles_residuels; |
integer8 nombre_symboles_residuels; |
|
|
void (*onclosing)(struct_rpl_arguments *); |
int (*onclosing)(struct_rpl_arguments *); |
|
|
l_element_courant = (*s_etat_processus).s_bibliotheques; |
l_element_courant = (*s_etat_processus).s_bibliotheques; |
presence_bibliotheque = d_faux; |
presence_bibliotheque = d_faux; |
Line 786 retrait_bibliotheque(struct_processus *s
|
Line 787 retrait_bibliotheque(struct_processus *s
|
registre = (*s_etat_processus).s_instructions_externes; |
registre = (*s_etat_processus).s_instructions_externes; |
|
|
if (((*s_etat_processus).s_instructions_externes = |
if (((*s_etat_processus).s_instructions_externes = |
malloc(nombre_symboles_residuels * |
malloc(((size_t) nombre_symboles_residuels) * |
sizeof(struct_instruction_externe))) == NULL) |
sizeof(struct_instruction_externe))) == NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
Line 852 execution_fonction_de_bibliotheque(struc
|
Line 853 execution_fonction_de_bibliotheque(struc
|
logical1 presence_bibliotheque; |
logical1 presence_bibliotheque; |
logical1 unicite_symbole; |
logical1 unicite_symbole; |
|
|
long difference; |
int difference; |
long difference_inferieure; |
int difference_inferieure; |
long difference_superieure; |
int difference_superieure; |
long i; |
|
|
|
struct_liste_chainee *l_element_courant; |
struct_liste_chainee *l_element_courant; |
|
|
Line 864 execution_fonction_de_bibliotheque(struc
|
Line 864 execution_fonction_de_bibliotheque(struc
|
unsigned char *nom_fonction_externe; |
unsigned char *nom_fonction_externe; |
unsigned char *tampon; |
unsigned char *tampon; |
|
|
unsigned long borne_inferieure; |
integer8 borne_inferieure; |
unsigned long borne_superieure; |
integer8 borne_superieure; |
unsigned long moyenne; |
integer8 i; |
unsigned long nombre_iterations_maximal; |
integer8 moyenne; |
unsigned long ordre_iteration; |
integer8 nombre_iterations_maximal; |
|
integer8 ordre_iteration; |
|
|
void (*fonction)(struct_rpl_arguments *); |
int (*fonction)(struct_rpl_arguments *); |
|
|
/* |
/* |
* Recherche dichotomique de la définition externe |
* Recherche dichotomique de la définition externe |
Line 905 execution_fonction_de_bibliotheque(struc
|
Line 906 execution_fonction_de_bibliotheque(struc
|
} |
} |
|
|
ordre_iteration = 0; |
ordre_iteration = 0; |
nombre_iterations_maximal = ((unsigned long) |
nombre_iterations_maximal = ((integer8) |
(log((*s_etat_processus).nombre_instructions_externes) / log(2))) |
(log((real8) (*s_etat_processus).nombre_instructions_externes) / |
+ 2; |
log(2))) + 2; |
|
|
borne_inferieure = 0; |
borne_inferieure = 0; |
borne_superieure = (*s_etat_processus).nombre_instructions_externes - 1; |
borne_superieure = (*s_etat_processus).nombre_instructions_externes - 1; |
Line 917 execution_fonction_de_bibliotheque(struc
|
Line 918 execution_fonction_de_bibliotheque(struc
|
moyenne = (borne_inferieure + borne_superieure) / 2; |
moyenne = (borne_inferieure + borne_superieure) / 2; |
ordre_iteration++; |
ordre_iteration++; |
|
|
if ((2 * ((unsigned long) ((borne_inferieure + borne_superieure) / 2))) |
if ((2 * ((integer8) ((borne_inferieure + borne_superieure) / 2))) |
== (borne_inferieure + borne_superieure)) |
== (borne_inferieure + borne_superieure)) |
{ |
{ |
difference = strcmp(nom_fonction, (*s_etat_processus) |
difference = strcmp(nom_fonction, (*s_etat_processus) |
Line 1004 execution_fonction_de_bibliotheque(struc
|
Line 1005 execution_fonction_de_bibliotheque(struc
|
{ |
{ |
i = moyenne; |
i = moyenne; |
|
|
while((unsigned long) i < |
while(i < (*s_etat_processus).nombre_instructions_externes) |
(*s_etat_processus).nombre_instructions_externes) |
|
{ |
{ |
if (strcmp((*s_etat_processus).s_instructions_externes[i] |
if (strcmp((*s_etat_processus).s_instructions_externes[i] |
.nom, nom_fonction) != 0) |
.nom, nom_fonction) != 0) |
Line 1406 empilement_pile_operationnelle(struct_rp
|
Line 1406 empilement_pile_operationnelle(struct_rp
|
struct_liste_chainee *l_ancienne_base_liste; |
struct_liste_chainee *l_ancienne_base_liste; |
struct_liste_chainee *l_nouvelle_base_liste; |
struct_liste_chainee *l_nouvelle_base_liste; |
|
|
|
struct_processus *s_etat_processus; |
|
|
l_ancienne_base_liste = (*s_rpl_arguments).l_base_pile; |
l_ancienne_base_liste = (*s_rpl_arguments).l_base_pile; |
|
s_etat_processus = (*s_rpl_arguments).s_etat_processus; |
|
|
l_nouvelle_base_liste = (struct_liste_chainee *) malloc( |
l_nouvelle_base_liste = (struct_liste_chainee *) malloc( |
sizeof(struct_liste_chainee)); |
sizeof(struct_liste_chainee)); |
Line 1442 depilement_pile_operationnelle(struct_rp
|
Line 1445 depilement_pile_operationnelle(struct_rp
|
struct_liste_chainee *l_ancienne_base_liste; |
struct_liste_chainee *l_ancienne_base_liste; |
struct_liste_chainee *l_nouvelle_base_liste; |
struct_liste_chainee *l_nouvelle_base_liste; |
|
|
|
struct_processus *s_etat_processus; |
|
|
if ((*s_rpl_arguments).l_base_pile == NULL) |
if ((*s_rpl_arguments).l_base_pile == NULL) |
{ |
{ |
*s_objet = NULL; |
*s_objet = NULL; |
Line 1451 depilement_pile_operationnelle(struct_rp
|
Line 1456 depilement_pile_operationnelle(struct_rp
|
{ |
{ |
l_ancienne_base_liste = (*s_rpl_arguments).l_base_pile; |
l_ancienne_base_liste = (*s_rpl_arguments).l_base_pile; |
l_nouvelle_base_liste = (*l_ancienne_base_liste).suivant; |
l_nouvelle_base_liste = (*l_ancienne_base_liste).suivant; |
|
s_etat_processus = (*s_rpl_arguments).s_etat_processus; |
|
|
*s_objet = (*l_ancienne_base_liste).donnee; |
*s_objet = (*l_ancienne_base_liste).donnee; |
free(l_ancienne_base_liste); |
free(l_ancienne_base_liste); |
Line 1476 depilement_pile_operationnelle(struct_rp
|
Line 1482 depilement_pile_operationnelle(struct_rp
|
|
|
struct_liste_chainee * |
struct_liste_chainee * |
sauvegarde_arguments(struct_rpl_arguments *s_rpl_arguments, |
sauvegarde_arguments(struct_rpl_arguments *s_rpl_arguments, |
unsigned long nombre_arguments) |
integer8 nombre_arguments) |
{ |
{ |
struct_liste_chainee *l_ancienne_base_liste; |
struct_liste_chainee *l_ancienne_base_liste; |
struct_liste_chainee *l_element_courant; |
struct_liste_chainee *l_element_courant; |
Line 1494 sauvegarde_arguments(struct_rpl_argument
|
Line 1500 sauvegarde_arguments(struct_rpl_argument
|
unsigned char indice_drapeau; |
unsigned char indice_drapeau; |
unsigned char taille_bloc; |
unsigned char taille_bloc; |
|
|
unsigned long i; |
integer8 i; |
|
|
struct_processus *s_etat_processus; |
struct_processus *s_etat_processus; |
|
|
Line 1507 sauvegarde_arguments(struct_rpl_argument
|
Line 1513 sauvegarde_arguments(struct_rpl_argument
|
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) ((1 << (taille_bloc - indice_bit - 1)) & 0xFF); |
|
|
if (((*s_rpl_arguments).drapeaux_etat[indice_bloc] & masque) == 0) |
if (((*s_rpl_arguments).drapeaux_etat[indice_bloc] & masque) == 0) |
{ |
{ |
Line 1605 tri_base_symboles_externes(struct_proces
|
Line 1611 tri_base_symboles_externes(struct_proces
|
logical1 terminaison_boucle_2; |
logical1 terminaison_boucle_2; |
logical1 terminaison_boucle_3; |
logical1 terminaison_boucle_3; |
|
|
signed long indice_i; |
integer8 borne_inferieure; |
signed long indice_j; |
integer8 borne_superieure; |
signed long indice_k; |
integer8 ecartement; |
signed long indice_l; |
integer8 indice; |
|
integer8 indice_i; |
unsigned long borne_inferieure; |
integer8 indice_j; |
unsigned long borne_superieure; |
integer8 indice_k; |
unsigned long ecartement; |
integer8 indice_l; |
unsigned long indice; |
|
|
|
ecartement = (*s_etat_processus).nombre_instructions_externes; |
ecartement = (*s_etat_processus).nombre_instructions_externes; |
|
|
Line 1692 tri_base_symboles_externes(struct_proces
|
Line 1697 tri_base_symboles_externes(struct_proces
|
{ |
{ |
indice_j = indice_i; |
indice_j = indice_i; |
|
|
while(((unsigned long) (indice_i + 1) < (*s_etat_processus) |
while(((indice_i + 1) < (*s_etat_processus) |
.nombre_instructions_externes) && (strcmp(((*s_etat_processus) |
.nombre_instructions_externes) && (strcmp(((*s_etat_processus) |
.s_instructions_externes[indice_i]).nom, ((*s_etat_processus) |
.s_instructions_externes[indice_i]).nom, ((*s_etat_processus) |
.s_instructions_externes[indice_i + 1]).nom) == 0)) |
.s_instructions_externes[indice_i + 1]).nom) == 0)) |
Line 1726 tri_base_symboles_externes(struct_proces
|
Line 1731 tri_base_symboles_externes(struct_proces
|
} while(terminaison_boucle == d_faux); |
} while(terminaison_boucle == d_faux); |
|
|
indice_i++; |
indice_i++; |
} while((unsigned long) (indice_i + 1) < |
} while((indice_i + 1) < (*s_etat_processus).nombre_instructions_externes); |
(*s_etat_processus).nombre_instructions_externes); |
|
|
|
return; |
return; |
} |
} |