version 1.1.1.1, 2010/01/26 15:22:45
|
version 1.52, 2013/09/06 10:30:53
|
Line 1
|
Line 1
|
/* |
/* |
================================================================================ |
================================================================================ |
RPL/2 (R) version 4.0.9 |
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 623 instruction_errm(struct_processus *s_eta
|
Line 623 instruction_errm(struct_processus *s_eta
|
{ |
{ |
struct_objet *s_objet_resultat; |
struct_objet *s_objet_resultat; |
|
|
unsigned int registre_erreur_execution; |
int registre_erreur_execution; |
unsigned int registre_erreur_systeme; |
int registre_erreur_systeme; |
unsigned int registre_exception; |
int registre_exception; |
|
|
(*s_etat_processus).erreur_execution = d_ex; |
(*s_etat_processus).erreur_execution = d_ex; |
|
|
Line 721 void
|
Line 721 void
|
instruction_edit(struct_processus *s_etat_processus) |
instruction_edit(struct_processus *s_etat_processus) |
{ |
{ |
# ifdef VIM_SUPPORT |
# ifdef VIM_SUPPORT |
# include "vim.conv.h" |
# include "vim-conv.h" |
|
|
file *fichier; |
file *fichier; |
|
|
logical1 drapeau; |
|
logical1 drapeau49; |
logical1 drapeau49; |
logical1 drapeau50; |
logical1 drapeau50; |
|
|
Line 738 instruction_edit(struct_processus *s_eta
|
Line 737 instruction_edit(struct_processus *s_eta
|
unsigned char *chaine; |
unsigned char *chaine; |
unsigned char *commande; |
unsigned char *commande; |
unsigned char *nom_fichier; |
unsigned char *nom_fichier; |
|
unsigned char registre; |
|
|
(*s_etat_processus).erreur_execution = d_ex; |
(*s_etat_processus).erreur_execution = d_ex; |
|
|
Line 848 instruction_edit(struct_processus *s_eta
|
Line 848 instruction_edit(struct_processus *s_eta
|
return; |
return; |
} |
} |
|
|
|
registre = (*s_etat_processus).autorisation_conversion_chaine; |
|
(*s_etat_processus).autorisation_conversion_chaine = 'N'; |
|
|
if ((chaine = formateur(s_etat_processus, 0, s_objet)) == NULL) |
if ((chaine = formateur(s_etat_processus, 0, s_objet)) == NULL) |
{ |
{ |
|
(*s_etat_processus).autorisation_conversion_chaine = registre; |
|
|
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
return; |
return; |
} |
} |
|
|
|
(*s_etat_processus).autorisation_conversion_chaine = registre; |
|
|
if ((*s_objet).type == CHN) |
if ((*s_objet).type == CHN) |
{ |
{ |
if (fprintf(fichier, "\"%s\"\n", chaine) != (int) (strlen(chaine) + 3)) |
if (fprintf(fichier, "\"%s\"\n", chaine) != (int) (strlen(chaine) + 3)) |
Line 879 instruction_edit(struct_processus *s_eta
|
Line 886 instruction_edit(struct_processus *s_eta
|
return; |
return; |
} |
} |
|
|
do |
if ((commande = malloc((strlen(ds_vim_commande) + strlen(nom_fichier) |
|
- 1) * sizeof(unsigned char))) == NULL) |
{ |
{ |
if ((commande = malloc((strlen(ds_vim_commande) + strlen(nom_fichier) |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
- 1) * sizeof(unsigned char))) == NULL) |
return; |
{ |
} |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
|
return; |
|
} |
|
|
|
sprintf(commande, ds_vim_commande, nom_fichier); |
sprintf(commande, ds_vim_commande, nom_fichier); |
|
|
if (system(commande) != 0) |
if (system(commande) != 0) |
{ |
{ |
free(commande); |
free(commande); |
|
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
return; |
return; |
} |
} |
|
|
free(commande); |
free(commande); |
|
|
if ((s_objet_nom = allocation(s_etat_processus, CHN)) == NULL) |
if ((s_objet_nom = allocation(s_etat_processus, CHN)) == NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
return; |
return; |
} |
} |
|
|
if (((*s_objet_nom).objet = malloc((strlen(nom_fichier) + 1) |
if (((*s_objet_nom).objet = malloc((strlen(nom_fichier) + 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; |
} |
} |
|
|
strcpy((unsigned char *) (*s_objet_nom).objet, nom_fichier); |
strcpy((unsigned char *) (*s_objet_nom).objet, nom_fichier); |
|
|
if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile), |
if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile), |
s_objet_nom) == d_erreur) |
s_objet_nom) == d_erreur) |
{ |
{ |
return; |
return; |
} |
} |
|
|
registre_pile_last = (*s_etat_processus).l_base_pile_last; |
registre_pile_last = (*s_etat_processus).l_base_pile_last; |
(*s_etat_processus).l_base_pile_last = NULL; |
(*s_etat_processus).l_base_pile_last = NULL; |
|
|
instruction_recall(s_etat_processus); |
instruction_recall(s_etat_processus); |
|
|
// Destruction du fichier temporaire |
if (empilement_pile_last(s_etat_processus, 0) == d_erreur) |
|
{ |
|
return; |
|
} |
|
|
if (destruction_fichier(nom_fichier) == d_erreur) |
(*s_etat_processus).l_base_pile_last = registre_pile_last; |
{ |
|
(*s_etat_processus).erreur_systeme = d_es_erreur_fichier; |
|
return; |
|
} |
|
|
|
free(nom_fichier); |
// Destruction du fichier temporaire |
|
|
if (((*s_etat_processus).erreur_systeme != d_es) || |
if (destruction_fichier(nom_fichier) == d_erreur) |
((*s_etat_processus).erreur_execution != d_ex) || |
{ |
((*s_etat_processus).exception != d_ep)) |
(*s_etat_processus).erreur_systeme = d_es_erreur_fichier; |
{ |
return; |
if (empilement_pile_last(s_etat_processus, 0) == d_erreur) |
} |
{ |
|
return; |
|
} |
|
|
|
(*s_etat_processus).l_base_pile_last = registre_pile_last; |
free(nom_fichier); |
liberation(s_etat_processus, s_objet); |
|
|
|
return; |
if (((*s_etat_processus).erreur_systeme != d_es) || |
} |
((*s_etat_processus).erreur_execution != d_ex) || |
|
((*s_etat_processus).exception != d_ep)) |
|
{ |
|
liberation(s_etat_processus, s_objet); |
|
|
if ((*s_etat_processus).erreur_systeme != d_es) |
return; |
{ |
} |
return; |
|
} |
|
|
|
if ((*s_etat_processus).erreur_execution == d_ex_fichier_vide) |
if ((*s_etat_processus).erreur_systeme != d_es) |
{ |
{ |
if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile), |
return; |
s_objet) == d_erreur) |
} |
{ |
|
return; |
|
} |
|
|
|
(*s_etat_processus).erreur_execution = d_ex; |
if ((*s_etat_processus).erreur_execution == d_ex_fichier_vide) |
drapeau = d_faux; |
{ |
} |
if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile), |
else |
s_objet) == d_erreur) |
{ |
{ |
drapeau = d_vrai; |
return; |
} |
} |
} while((*s_etat_processus).erreur_execution != d_ex); |
|
|
|
if (drapeau == d_vrai) |
(*s_etat_processus).erreur_execution = d_ex; |
|
} |
|
else |
{ |
{ |
liberation(s_etat_processus, s_objet); |
liberation(s_etat_processus, s_objet); |
} |
} |
Line 1019 instruction_externals(struct_processus *
|
Line 1018 instruction_externals(struct_processus *
|
{ |
{ |
logical1 ambiguite; |
logical1 ambiguite; |
|
|
unsigned long i; |
integer8 i; |
|
|
struct_liste_chainee *l_element_courant; |
struct_liste_chainee *l_element_courant; |
|
|
Line 1188 instruction_exit(struct_processus *s_eta
|
Line 1187 instruction_exit(struct_processus *s_eta
|
unsigned char *instruction_majuscule; |
unsigned char *instruction_majuscule; |
unsigned char *tampon; |
unsigned char *tampon; |
|
|
unsigned long niveau; |
integer8 niveau; |
|
|
void (*fonction)(); |
void (*fonction)(); |
|
|
Line 1215 instruction_exit(struct_processus *s_eta
|
Line 1214 instruction_exit(struct_processus *s_eta
|
printf(" (expression 2)\n"); |
printf(" (expression 2)\n"); |
printf(" NEXT/STEP\n\n"); |
printf(" NEXT/STEP\n\n"); |
|
|
|
printf(" FORALL\n"); |
|
printf(" (expression 1)\n"); |
|
printf(" EXIT\n"); |
|
printf(" (expression 2)\n"); |
|
printf(" NEXT\n\n"); |
|
|
printf(" DO\n"); |
printf(" DO\n"); |
printf(" (expression 1)\n"); |
printf(" (expression 1)\n"); |
printf(" EXIT\n"); |
printf(" EXIT\n"); |
Line 1254 instruction_exit(struct_processus *s_eta
|
Line 1259 instruction_exit(struct_processus *s_eta
|
while((l_element_pile_systeme != NULL) && (presence_boucle == d_faux)) |
while((l_element_pile_systeme != NULL) && (presence_boucle == d_faux)) |
{ |
{ |
if (((*l_element_pile_systeme).type_cloture == 'S') || |
if (((*l_element_pile_systeme).type_cloture == 'S') || |
((*l_element_pile_systeme).type_cloture == 'F')) |
((*l_element_pile_systeme).type_cloture == 'F') || |
|
((*l_element_pile_systeme).type_cloture == 'A')) |
{ |
{ |
presence_boucle = d_vrai; |
presence_boucle = d_vrai; |
drapeau_boucle_definie = d_vrai; |
drapeau_boucle_definie = d_vrai; |
Line 1298 instruction_exit(struct_processus *s_eta
|
Line 1304 instruction_exit(struct_processus *s_eta
|
return; |
return; |
} |
} |
|
|
if (recherche_variable(s_etat_processus, |
(*s_etat_processus).erreur_systeme = d_es; |
(*s_etat_processus).instruction_courante) == d_vrai) |
instruction_majuscule = conversion_majuscule( |
|
(*s_etat_processus).instruction_courante); |
|
|
|
if (instruction_majuscule == NULL) |
{ |
{ |
instruction_majuscule = conversion_majuscule(""); |
return; |
|
} |
|
|
if ((*s_etat_processus).s_liste_variables |
/* |
[(*s_etat_processus).position_variable_courante] |
* Traitement de la pile système par les |
.objet == NULL) |
* différentes instructions. |
|
*/ |
|
|
|
if ((strcmp(instruction_majuscule, "IF") == 0) || |
|
(strcmp(instruction_majuscule, "IFERR") == 0) || |
|
(strcmp(instruction_majuscule, "DO") == 0) || |
|
(strcmp(instruction_majuscule, "WHILE") == 0) || |
|
(strcmp(instruction_majuscule, "FOR") == 0) || |
|
(strcmp(instruction_majuscule, "FORALL") == 0) || |
|
(strcmp(instruction_majuscule, "START") == 0) || |
|
(strcmp(instruction_majuscule, "SELECT") == 0) |
|
|| (strcmp(instruction_majuscule, "CRITICAL") == 0) |
|
|| (strcmp(instruction_majuscule, "CASE") == 0) |
|
|| (strcmp(instruction_majuscule, "<<") == 0)) |
|
{ |
|
if (strcmp(instruction_majuscule, "<<") == 0) |
{ |
{ |
if (pthread_mutex_lock(&((*(*s_etat_processus) |
analyse(s_etat_processus, NULL); |
.s_liste_variables_partagees).mutex)) != 0) |
|
{ |
|
(*s_etat_processus).erreur_systeme = |
|
d_es_processus; |
|
return; |
|
} |
|
|
|
if (recherche_variable_partagee(s_etat_processus, |
|
(*s_etat_processus).s_liste_variables |
|
[(*s_etat_processus).position_variable_courante] |
|
.nom, (*s_etat_processus).s_liste_variables |
|
[(*s_etat_processus).position_variable_courante] |
|
.variable_partagee, |
|
(*s_etat_processus).s_liste_variables |
|
[(*s_etat_processus).position_variable_courante] |
|
.origine) == d_vrai) |
|
{ |
|
if ((*((*s_etat_processus).s_liste_variables |
|
[(*s_etat_processus) |
|
.position_variable_courante]).objet).type |
|
== ADR) |
|
{ |
|
empilement_pile_systeme(s_etat_processus); |
|
|
|
if ((*s_etat_processus).erreur_systeme != d_es) |
|
{ |
|
if (pthread_mutex_unlock( |
|
&((*(*s_etat_processus) |
|
.s_liste_variables_partagees) |
|
.mutex)) != 0) |
|
{ |
|
(*s_etat_processus).erreur_systeme = |
|
d_es_processus; |
|
return; |
|
} |
|
|
|
return; |
|
} |
|
|
|
(*(*s_etat_processus).l_base_pile_systeme) |
|
.adresse_retour = |
|
(*s_etat_processus).position_courante; |
|
|
|
(*(*s_etat_processus).l_base_pile_systeme) |
|
.retour_definition = 'Y'; |
|
(*(*s_etat_processus).l_base_pile_systeme) |
|
.niveau_courant = |
|
(*s_etat_processus).niveau_courant; |
|
|
|
(*s_etat_processus).position_courante = |
|
(*((unsigned long *) |
|
((*((*s_etat_processus) |
|
.s_liste_variables[(*s_etat_processus) |
|
.position_variable_courante].objet)) |
|
.objet))); |
|
|
|
(*s_etat_processus) |
|
.autorisation_empilement_programme |
|
= 'N'; |
|
} |
|
} |
|
else |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es; |
|
} |
|
|
|
if (pthread_mutex_unlock(&((*(*s_etat_processus) |
|
.s_liste_variables_partagees).mutex)) != 0) |
|
{ |
|
(*s_etat_processus).erreur_systeme = |
|
d_es_processus; |
|
return; |
|
} |
|
} |
} |
else |
else |
{ |
{ |
if ((*((*s_etat_processus).s_liste_variables |
if ((strcmp(instruction_majuscule, "FOR") == 0) || |
[(*s_etat_processus) |
(strcmp(instruction_majuscule, "FORALL") == 0) |
.position_variable_courante]).objet).type |
|| (strcmp(instruction_majuscule, "START") |
== ADR) |
== 0)) |
{ |
{ |
empilement_pile_systeme(s_etat_processus); |
niveau++; |
|
} |
|
|
if ((*s_etat_processus).erreur_systeme != d_es) |
empilement_pile_systeme(s_etat_processus); |
{ |
|
return; |
|
} |
|
|
|
(*(*s_etat_processus).l_base_pile_systeme) |
if ((*s_etat_processus).erreur_systeme != d_es) |
.adresse_retour = |
{ |
(*s_etat_processus).position_courante; |
return; |
|
|
(*(*s_etat_processus).l_base_pile_systeme) |
|
.retour_definition = 'Y'; |
|
(*(*s_etat_processus).l_base_pile_systeme) |
|
.niveau_courant = |
|
(*s_etat_processus).niveau_courant; |
|
|
|
(*s_etat_processus).position_courante = |
|
(*((unsigned long *) ((*((*s_etat_processus) |
|
.s_liste_variables[(*s_etat_processus) |
|
.position_variable_courante].objet)) |
|
.objet))); |
|
|
|
(*s_etat_processus) |
|
.autorisation_empilement_programme |
|
= 'N'; |
|
} |
} |
} |
} |
} |
} |
else |
else if ((strcmp(instruction_majuscule, "END") == 0) || |
|
(strcmp(instruction_majuscule, "NEXT") == 0) || |
|
(strcmp(instruction_majuscule, "STEP") == 0) || |
|
(strcmp(instruction_majuscule, ">>") == 0)) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es; |
if (strcmp(instruction_majuscule, ">>") == 0) |
instruction_majuscule = conversion_majuscule( |
|
(*s_etat_processus).instruction_courante); |
|
|
|
if (instruction_majuscule == NULL) |
|
{ |
{ |
return; |
analyse(s_etat_processus, NULL); |
} |
|
|
|
/* |
if ((*s_etat_processus).retour_routine_evaluation |
* Traitement de la pile système par les |
== 'Y') |
* différentes instructions. |
|
*/ |
|
|
|
if ((strcmp(instruction_majuscule, "IF") == 0) || |
|
(strcmp(instruction_majuscule, "IFERR") == 0) || |
|
(strcmp(instruction_majuscule, "DO") == 0) || |
|
(strcmp(instruction_majuscule, "WHILE") == 0) || |
|
(strcmp(instruction_majuscule, "FOR") == 0) || |
|
(strcmp(instruction_majuscule, "START") == 0) || |
|
(strcmp(instruction_majuscule, "SELECT") == 0) |
|
|| (strcmp(instruction_majuscule, "CASE") == 0) |
|
|| (strcmp(instruction_majuscule, "<<") == 0)) |
|
{ |
|
if (strcmp(instruction_majuscule, "<<") == 0) |
|
{ |
{ |
analyse(s_etat_processus, NULL); |
drapeau_presence_fin_boucle = d_faux; |
} |
free((*s_etat_processus).instruction_courante); |
else |
|
{ |
|
if ((strcmp(instruction_majuscule, "FOR") == 0) || |
|
(strcmp(instruction_majuscule, "START") |
|
== 0)) |
|
{ |
|
niveau++; |
|
} |
|
|
|
empilement_pile_systeme(s_etat_processus); |
|
|
|
if ((*s_etat_processus).erreur_systeme != d_es) |
break; |
{ |
|
return; |
|
} |
|
} |
} |
} |
} |
else if ((strcmp(instruction_majuscule, "END") == 0) || |
else |
(strcmp(instruction_majuscule, "NEXT") == 0) || |
|
(strcmp(instruction_majuscule, "STEP") == 0) || |
|
(strcmp(instruction_majuscule, ">>") == 0)) |
|
{ |
{ |
if (strcmp(instruction_majuscule, ">>") == 0) |
if ((strcmp(instruction_majuscule, "NEXT") == 0) || |
|
(strcmp(instruction_majuscule, "STEP") |
|
== 0)) |
{ |
{ |
analyse(s_etat_processus, NULL); |
niveau--; |
|
|
if ((*s_etat_processus).retour_routine_evaluation |
if (niveau != 0) |
== 'Y') |
|
{ |
{ |
drapeau_presence_fin_boucle = d_faux; |
depilement_pile_systeme(s_etat_processus); |
free((*s_etat_processus).instruction_courante); |
|
|
|
break; |
|
} |
} |
} |
} |
else |
else |
{ |
{ |
if ((strcmp(instruction_majuscule, "NEXT") == 0) || |
if ((*s_etat_processus).l_base_pile_systeme == NULL) |
(strcmp(instruction_majuscule, "STEP") |
|
== 0)) |
|
{ |
{ |
niveau--; |
(*s_etat_processus).erreur_systeme = |
|
d_es_processus; |
|
return; |
|
} |
|
|
if (niveau != 0) |
if ((*(*s_etat_processus).l_base_pile_systeme) |
|
.type_cloture == 'Q') |
|
{ |
|
if (pthread_mutex_unlock( |
|
&mutex_sections_critiques) != 0) |
{ |
{ |
depilement_pile_systeme(s_etat_processus); |
(*s_etat_processus).erreur_systeme = |
|
d_es_processus; |
|
return; |
} |
} |
} |
|
else |
|
{ |
|
depilement_pile_systeme(s_etat_processus); |
|
} |
|
|
|
if ((*s_etat_processus).erreur_systeme != d_es) |
(*s_etat_processus).sections_critiques--; |
{ |
|
return; |
|
} |
} |
|
|
|
depilement_pile_systeme(s_etat_processus); |
|
} |
|
|
|
if ((*s_etat_processus).erreur_systeme != d_es) |
|
{ |
|
return; |
} |
} |
} |
} |
} |
} |
Line 1526 instruction_exit(struct_processus *s_eta
|
Line 1433 instruction_exit(struct_processus *s_eta
|
return; |
return; |
} |
} |
|
|
if (recherche_variable(s_etat_processus, |
instruction_majuscule = conversion_majuscule( |
(*s_etat_processus).instruction_courante) == d_vrai) |
(*s_etat_processus).instruction_courante); |
|
|
|
if (instruction_majuscule == NULL) |
{ |
{ |
instruction_majuscule = conversion_majuscule(""); |
return; |
|
} |
|
|
if ((*s_etat_processus).s_liste_variables |
/* |
[(*s_etat_processus).position_variable_courante] |
* Traitement de la pile système par les |
.objet == NULL) |
* différentes instructions. |
|
*/ |
|
|
|
if ((strcmp(instruction_majuscule, "IF") == 0) || |
|
(strcmp(instruction_majuscule, "IFERR") == 0) || |
|
(strcmp(instruction_majuscule, "DO") == 0) || |
|
(strcmp(instruction_majuscule, "WHILE") == 0) || |
|
(strcmp(instruction_majuscule, "FOR") == 0) || |
|
(strcmp(instruction_majuscule, "FORALL") == 0) || |
|
(strcmp(instruction_majuscule, "START") == 0) || |
|
(strcmp(instruction_majuscule, "SELECT") == 0) |
|
|| (strcmp(instruction_majuscule, "CRITICAL") == 0) |
|
|| (strcmp(instruction_majuscule, "CASE") == 0) |
|
|| (strcmp(instruction_majuscule, "<<") == 0)) |
|
{ |
|
if (strcmp(instruction_majuscule, "<<") == 0) |
{ |
{ |
if (pthread_mutex_lock(&((*(*s_etat_processus) |
analyse(s_etat_processus, NULL); |
.s_liste_variables_partagees).mutex)) != 0) |
|
{ |
|
(*s_etat_processus).erreur_systeme = |
|
d_es_processus; |
|
return; |
|
} |
|
|
|
if (recherche_variable_partagee(s_etat_processus, |
|
(*s_etat_processus).s_liste_variables |
|
[(*s_etat_processus).position_variable_courante] |
|
.nom, (*s_etat_processus).s_liste_variables |
|
[(*s_etat_processus).position_variable_courante] |
|
.variable_partagee, |
|
(*s_etat_processus).s_liste_variables |
|
[(*s_etat_processus).position_variable_courante] |
|
.origine) == d_vrai) |
|
{ |
|
if ((*((*s_etat_processus).s_liste_variables |
|
[(*s_etat_processus) |
|
.position_variable_courante]).objet).type |
|
== ADR) |
|
{ |
|
empilement_pile_systeme(s_etat_processus); |
|
|
|
if ((*s_etat_processus).erreur_systeme != d_es) |
|
{ |
|
if (pthread_mutex_unlock( |
|
&((*(*s_etat_processus) |
|
.s_liste_variables_partagees) |
|
.mutex)) != 0) |
|
{ |
|
(*s_etat_processus).erreur_systeme = |
|
d_es_processus; |
|
return; |
|
} |
|
|
|
return; |
|
} |
|
|
|
(*(*s_etat_processus).l_base_pile_systeme) |
|
.adresse_retour = |
|
(*s_etat_processus).position_courante; |
|
|
|
(*(*s_etat_processus).l_base_pile_systeme) |
|
.retour_definition = 'Y'; |
|
(*(*s_etat_processus).l_base_pile_systeme) |
|
.niveau_courant = |
|
(*s_etat_processus).niveau_courant; |
|
|
|
(*s_etat_processus).position_courante = |
|
(*((unsigned long *) |
|
((*((*s_etat_processus) |
|
.s_liste_variables[(*s_etat_processus) |
|
.position_variable_courante].objet)) |
|
.objet))); |
|
|
|
(*s_etat_processus) |
|
.autorisation_empilement_programme |
|
= 'N'; |
|
} |
|
} |
|
else |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es; |
|
} |
|
|
|
if (pthread_mutex_unlock(&((*(*s_etat_processus) |
|
.s_liste_variables_partagees).mutex)) != 0) |
|
{ |
|
(*s_etat_processus).erreur_systeme = |
|
d_es_processus; |
|
return; |
|
} |
|
} |
} |
else |
else |
{ |
{ |
if ((*((*s_etat_processus).s_liste_variables |
if ((strcmp(instruction_majuscule, "DO") == 0) || |
[(*s_etat_processus) |
(strcmp(instruction_majuscule, "WHILE") |
.position_variable_courante]).objet).type |
== 0)) |
== ADR) |
|
{ |
{ |
empilement_pile_systeme(s_etat_processus); |
niveau++; |
|
} |
|
|
if ((*s_etat_processus).erreur_systeme != d_es) |
empilement_pile_systeme(s_etat_processus); |
{ |
|
return; |
|
} |
|
|
|
(*(*s_etat_processus).l_base_pile_systeme) |
if ((*s_etat_processus).erreur_systeme != d_es) |
.adresse_retour = |
{ |
(*s_etat_processus).position_courante; |
return; |
|
|
(*(*s_etat_processus).l_base_pile_systeme) |
|
.retour_definition = 'Y'; |
|
(*(*s_etat_processus).l_base_pile_systeme) |
|
.niveau_courant = |
|
(*s_etat_processus).niveau_courant; |
|
|
|
(*s_etat_processus).position_courante = |
|
(*((unsigned long *) ((*((*s_etat_processus) |
|
.s_liste_variables[(*s_etat_processus) |
|
.position_variable_courante].objet)) |
|
.objet))); |
|
|
|
(*s_etat_processus) |
|
.autorisation_empilement_programme |
|
= 'N'; |
|
} |
} |
} |
} |
} |
} |
else |
else if ((strcmp(instruction_majuscule, "END") == 0) || |
|
(strcmp(instruction_majuscule, "NEXT") == 0) || |
|
(strcmp(instruction_majuscule, "STEP") == 0) || |
|
(strcmp(instruction_majuscule, ">>") == 0)) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es; |
if (strcmp(instruction_majuscule, ">>") == 0) |
instruction_majuscule = conversion_majuscule( |
|
(*s_etat_processus).instruction_courante); |
|
|
|
if (instruction_majuscule == NULL) |
|
{ |
{ |
return; |
analyse(s_etat_processus, NULL); |
} |
|
|
|
/* |
if ((*s_etat_processus).retour_routine_evaluation |
* Traitement de la pile système par les |
== 'Y') |
* différentes instructions. |
|
*/ |
|
|
|
if ((strcmp(instruction_majuscule, "IF") == 0) || |
|
(strcmp(instruction_majuscule, "IFERR") == 0) || |
|
(strcmp(instruction_majuscule, "DO") == 0) || |
|
(strcmp(instruction_majuscule, "WHILE") == 0) || |
|
(strcmp(instruction_majuscule, "FOR") == 0) || |
|
(strcmp(instruction_majuscule, "START") == 0) || |
|
(strcmp(instruction_majuscule, "SELECT") == 0) |
|
|| (strcmp(instruction_majuscule, "CASE") == 0) |
|
|| (strcmp(instruction_majuscule, "<<") == 0)) |
|
{ |
|
if (strcmp(instruction_majuscule, "<<") == 0) |
|
{ |
{ |
analyse(s_etat_processus, NULL); |
drapeau_presence_fin_boucle = d_faux; |
} |
free((*s_etat_processus).instruction_courante); |
else |
|
{ |
|
if ((strcmp(instruction_majuscule, "DO") == 0) || |
|
(strcmp(instruction_majuscule, "WHILE") |
|
== 0)) |
|
{ |
|
niveau++; |
|
} |
|
|
|
empilement_pile_systeme(s_etat_processus); |
|
|
|
if ((*s_etat_processus).erreur_systeme != d_es) |
break; |
{ |
|
return; |
|
} |
|
} |
} |
} |
} |
else if ((strcmp(instruction_majuscule, "END") == 0) || |
else |
(strcmp(instruction_majuscule, "NEXT") == 0) || |
|
(strcmp(instruction_majuscule, "STEP") == 0) || |
|
(strcmp(instruction_majuscule, ">>") == 0)) |
|
{ |
{ |
if (strcmp(instruction_majuscule, ">>") == 0) |
if (strcmp(instruction_majuscule, "END") == 0) |
{ |
{ |
analyse(s_etat_processus, NULL); |
if (((*(*s_etat_processus).l_base_pile_systeme) |
|
.type_cloture == 'D') || |
if ((*s_etat_processus).retour_routine_evaluation |
((*(*s_etat_processus) |
== 'Y') |
.l_base_pile_systeme).type_cloture |
|
== 'W')) |
{ |
{ |
drapeau_presence_fin_boucle = d_faux; |
niveau--; |
free((*s_etat_processus).instruction_courante); |
|
|
|
break; |
|
} |
} |
|
|
|
depilement_pile_systeme(s_etat_processus); |
} |
} |
else |
else |
{ |
{ |
if (strcmp(instruction_majuscule, "END") == 0) |
if ((*s_etat_processus).l_base_pile_systeme == NULL) |
|
{ |
|
(*s_etat_processus).erreur_systeme = |
|
d_es_processus; |
|
return; |
|
} |
|
|
|
if ((*(*s_etat_processus).l_base_pile_systeme) |
|
.type_cloture == 'Q') |
{ |
{ |
if (((*(*s_etat_processus).l_base_pile_systeme) |
if (pthread_mutex_unlock( |
.type_cloture == 'D') || |
&mutex_sections_critiques) != 0) |
((*(*s_etat_processus) |
|
.l_base_pile_systeme).type_cloture |
|
== 'W')) |
|
{ |
{ |
niveau--; |
(*s_etat_processus).erreur_systeme = |
|
d_es_processus; |
|
return; |
} |
} |
|
|
depilement_pile_systeme(s_etat_processus); |
(*s_etat_processus).sections_critiques--; |
} |
|
else |
|
{ |
|
depilement_pile_systeme(s_etat_processus); |
|
} |
} |
|
|
if ((*s_etat_processus).erreur_systeme != d_es) |
depilement_pile_systeme(s_etat_processus); |
{ |
} |
return; |
|
} |
if ((*s_etat_processus).erreur_systeme != d_es) |
|
{ |
|
return; |
} |
} |
} |
} |
} |
} |
Line 1789 instruction_exit(struct_processus *s_eta
|
Line 1595 instruction_exit(struct_processus *s_eta
|
(fonction == instruction_do) || |
(fonction == instruction_do) || |
(fonction == instruction_while) || |
(fonction == instruction_while) || |
(fonction == instruction_for) || |
(fonction == instruction_for) || |
|
(fonction == instruction_forall) || |
(fonction == instruction_start) || |
(fonction == instruction_start) || |
(fonction == instruction_select) || |
(fonction == instruction_select) || |
(fonction == instruction_case) || |
(fonction == instruction_case) || |
|
(fonction == instruction_critical) || |
(fonction == instruction_vers_niveau_superieur)) |
(fonction == instruction_vers_niveau_superieur)) |
{ |
{ |
if (fonction == instruction_vers_niveau_superieur) |
if (fonction == instruction_vers_niveau_superieur) |
Line 1802 instruction_exit(struct_processus *s_eta
|
Line 1610 instruction_exit(struct_processus *s_eta
|
else |
else |
{ |
{ |
if ((fonction == instruction_for) || |
if ((fonction == instruction_for) || |
|
(fonction == instruction_forall) || |
(fonction == instruction_start)) |
(fonction == instruction_start)) |
{ |
{ |
niveau++; |
niveau++; |
Line 1850 instruction_exit(struct_processus *s_eta
|
Line 1659 instruction_exit(struct_processus *s_eta
|
} |
} |
else |
else |
{ |
{ |
|
if ((*s_etat_processus).l_base_pile_systeme == NULL) |
|
{ |
|
(*s_etat_processus).erreur_systeme = |
|
d_es_processus; |
|
return; |
|
} |
|
|
|
if ((*(*s_etat_processus).l_base_pile_systeme) |
|
.type_cloture == 'Q') |
|
{ |
|
if (pthread_mutex_unlock( |
|
&mutex_sections_critiques) != 0) |
|
{ |
|
(*s_etat_processus).erreur_systeme = |
|
d_es_processus; |
|
return; |
|
} |
|
|
|
(*s_etat_processus).sections_critiques--; |
|
} |
|
|
depilement_pile_systeme(s_etat_processus); |
depilement_pile_systeme(s_etat_processus); |
} |
} |
|
|
Line 1890 instruction_exit(struct_processus *s_eta
|
Line 1720 instruction_exit(struct_processus *s_eta
|
(fonction == instruction_do) || |
(fonction == instruction_do) || |
(fonction == instruction_while) || |
(fonction == instruction_while) || |
(fonction == instruction_for) || |
(fonction == instruction_for) || |
|
(fonction == instruction_forall) || |
(fonction == instruction_start) || |
(fonction == instruction_start) || |
(fonction == instruction_select) || |
(fonction == instruction_select) || |
|
(fonction == instruction_critical) || |
(fonction == instruction_case) || |
(fonction == instruction_case) || |
(fonction == instruction_vers_niveau_superieur)) |
(fonction == instruction_vers_niveau_superieur)) |
{ |
{ |
Line 1948 instruction_exit(struct_processus *s_eta
|
Line 1780 instruction_exit(struct_processus *s_eta
|
} |
} |
else |
else |
{ |
{ |
|
if ((*s_etat_processus).l_base_pile_systeme == NULL) |
|
{ |
|
(*s_etat_processus).erreur_systeme = |
|
d_es_processus; |
|
return; |
|
} |
|
|
|
if ((*(*s_etat_processus).l_base_pile_systeme) |
|
.type_cloture == 'Q') |
|
{ |
|
if (pthread_mutex_unlock( |
|
&mutex_sections_critiques) != 0) |
|
{ |
|
(*s_etat_processus).erreur_systeme = |
|
d_es_processus; |
|
return; |
|
} |
|
|
|
(*s_etat_processus).sections_critiques--; |
|
} |
|
|
depilement_pile_systeme(s_etat_processus); |
depilement_pile_systeme(s_etat_processus); |
} |
} |
|
|
Line 1976 instruction_exit(struct_processus *s_eta
|
Line 1829 instruction_exit(struct_processus *s_eta
|
if ((drapeau_boucle_definie == d_vrai) && |
if ((drapeau_boucle_definie == d_vrai) && |
(drapeau_presence_fin_boucle == d_vrai)) |
(drapeau_presence_fin_boucle == d_vrai)) |
{ |
{ |
presence_compteur = ((*(*s_etat_processus).l_base_pile_systeme) |
presence_compteur = (((*(*s_etat_processus).l_base_pile_systeme) |
.type_cloture == 'F') ? d_vrai : d_faux; |
.type_cloture == 'F') || ((*(*s_etat_processus) |
|
.l_base_pile_systeme).type_cloture == 'A')) ? d_vrai : d_faux; |
|
|
if (((*(*s_etat_processus).l_base_pile_systeme).type_cloture != 'S') |
if (((*(*s_etat_processus).l_base_pile_systeme).type_cloture != 'S') |
&& (presence_compteur == d_faux)) |
&& (presence_compteur == d_faux)) |
Line 1999 instruction_exit(struct_processus *s_eta
|
Line 1853 instruction_exit(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).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; |
} |
} |