version 1.2, 2010/01/27 22:22:15
|
version 1.35, 2012/03/01 10:14:07
|
Line 1
|
Line 1
|
/* |
/* |
================================================================================ |
================================================================================ |
RPL/2 (R) version 4.0.10 |
RPL/2 (R) version 4.1.7 |
Copyright (C) 1989-2010 Dr. BERTRAND Joël |
Copyright (C) 1989-2012 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 254 instruction_prst(struct_processus *s_eta
|
Line 254 instruction_prst(struct_processus *s_eta
|
} |
} |
} |
} |
|
|
|
routine_recursive = 2; |
impression_pile(s_etat_processus, (*s_etat_processus).l_base_pile, |
impression_pile(s_etat_processus, (*s_etat_processus).l_base_pile, |
'E', 1); |
'E', 1); |
|
routine_recursive = 0; |
return; |
return; |
} |
} |
|
|
Line 333 instruction_prstc(struct_processus *s_et
|
Line 335 instruction_prstc(struct_processus *s_et
|
} |
} |
} |
} |
|
|
|
routine_recursive = 2; |
impression_pile(s_etat_processus, (*s_etat_processus).l_base_pile, |
impression_pile(s_etat_processus, (*s_etat_processus).l_base_pile, |
'C', 1); |
'C', 1); |
|
routine_recursive = 0; |
return; |
return; |
} |
} |
|
|
Line 414 instruction_prvar(struct_processus *s_et
|
Line 418 instruction_prvar(struct_processus *s_et
|
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) |
|
{ |
{ |
formateur_tex(s_etat_processus, (*s_etat_processus).s_liste_variables |
formateur_tex(s_etat_processus, (*(*s_etat_processus) |
[(*s_etat_processus).position_variable_courante].objet, 'N'); |
.pointeur_variable_courante).objet, 'N'); |
} |
} |
else |
else |
{ |
{ |
Line 430 instruction_prvar(struct_processus *s_et
|
Line 433 instruction_prvar(struct_processus *s_et
|
} |
} |
|
|
if (recherche_variable_partagee(s_etat_processus, |
if (recherche_variable_partagee(s_etat_processus, |
(*s_etat_processus).s_liste_variables |
(*(*s_etat_processus).pointeur_variable_courante).nom, |
[(*s_etat_processus).position_variable_courante].nom, |
(*(*s_etat_processus).pointeur_variable_courante) |
(*s_etat_processus).s_liste_variables |
.variable_partagee, (*(*s_etat_processus) |
[(*s_etat_processus).position_variable_courante] |
.pointeur_variable_courante).origine) == d_faux) |
.variable_partagee, (*s_etat_processus).s_liste_variables |
|
[(*s_etat_processus).position_variable_courante].origine) |
|
== d_faux) |
|
{ |
{ |
if (pthread_mutex_unlock(&((*(*s_etat_processus) |
if (pthread_mutex_unlock(&((*(*s_etat_processus) |
.s_liste_variables_partagees).mutex)) != 0) |
.s_liste_variables_partagees).mutex)) != 0) |
Line 486 instruction_prvar(struct_processus *s_et
|
Line 486 instruction_prvar(struct_processus *s_et
|
void |
void |
instruction_prusr(struct_processus *s_etat_processus) |
instruction_prusr(struct_processus *s_etat_processus) |
{ |
{ |
|
int i; |
|
int nb_variables; |
|
|
struct_objet s_objet; |
struct_objet s_objet; |
|
|
unsigned long i; |
struct_tableau_variables *tableau; |
|
|
(*s_etat_processus).erreur_execution = d_ex; |
(*s_etat_processus).erreur_execution = d_ex; |
|
|
Line 523 instruction_prusr(struct_processus *s_et
|
Line 526 instruction_prusr(struct_processus *s_et
|
} |
} |
} |
} |
|
|
|
nb_variables = nombre_variables(s_etat_processus, |
|
(*s_etat_processus).s_arbre_variables); |
|
|
|
if ((tableau = malloc(nb_variables * sizeof(struct_tableau_variables))) |
|
== NULL) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
|
return; |
|
} |
|
|
|
liste_variables(s_etat_processus, tableau, 0, |
|
(*s_etat_processus).s_arbre_variables); |
|
|
s_objet.type = CHN; |
s_objet.type = CHN; |
|
|
for(i = 0; i < (*s_etat_processus).nombre_variables; i++) |
for(i = 0; i < nb_variables; i++) |
{ |
{ |
if ((s_objet.objet = malloc((strlen((*s_etat_processus) |
if ((s_objet.objet = malloc((strlen(tableau[i].nom) + 64) |
.s_liste_variables[i].nom) + 64) * sizeof(unsigned char))) |
* sizeof(unsigned char))) == NULL) |
== NULL) |
|
{ |
{ |
|
free(tableau); |
|
|
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
return; |
return; |
} |
} |
|
|
sprintf((unsigned char *) s_objet.objet, "\\noindent %s [%lu]\n", |
sprintf((unsigned char *) s_objet.objet, "\\\\noindent %s [%lu]\n", |
(*s_etat_processus).s_liste_variables[i].nom, |
tableau[i].nom, tableau[i].niveau); |
(*s_etat_processus).s_liste_variables[i].niveau); |
|
|
|
formateur_tex(s_etat_processus, &s_objet, 'N'); |
formateur_tex(s_etat_processus, &s_objet, 'N'); |
free(s_objet.objet); |
free(s_objet.objet); |
} |
} |
|
|
|
free(tableau); |
return; |
return; |
} |
} |
|
|
Line 1337 instruction_perm(struct_processus *s_eta
|
Line 1354 instruction_perm(struct_processus *s_eta
|
void |
void |
instruction_psdev(struct_processus *s_etat_processus) |
instruction_psdev(struct_processus *s_etat_processus) |
{ |
{ |
logical1 presence_variable; |
|
|
|
long i; |
|
|
|
struct_objet *s_objet_statistique; |
struct_objet *s_objet_statistique; |
struct_objet *s_objet_resultat; |
struct_objet *s_objet_resultat; |
struct_objet *s_objet_temporaire; |
struct_objet *s_objet_temporaire; |
Line 1384 instruction_psdev(struct_processus *s_et
|
Line 1397 instruction_psdev(struct_processus *s_et
|
* Recherche d'une variable globale référencée par SIGMA |
* Recherche d'une variable globale référencée par SIGMA |
*/ |
*/ |
|
|
if (recherche_variable(s_etat_processus, ds_sdat) == d_faux) |
if (recherche_variable_globale(s_etat_processus, ds_sdat) == d_faux) |
{ |
{ |
/* |
/* |
* Aucune variable SIGMA |
* Aucune variable SIGMA |
*/ |
*/ |
|
|
(*s_etat_processus).erreur_systeme = d_es; |
(*s_etat_processus).erreur_systeme = d_es; |
(*s_etat_processus).erreur_execution = d_ex_absence_observations; |
|
return; |
|
} |
|
else |
|
{ |
|
/* |
|
* Il existe une variable locale SIGMA. Reste à vérifier l'existence |
|
* d'une variable SIGMA globale... |
|
*/ |
|
|
|
i = (*s_etat_processus).position_variable_courante; |
|
presence_variable = d_faux; |
|
|
|
while(i >= 0) |
if ((*s_etat_processus).erreur_execution == d_ex) |
{ |
{ |
if ((strcmp((*s_etat_processus).s_liste_variables[i].nom, |
(*s_etat_processus).erreur_execution = d_ex_absence_observations; |
ds_sdat) == 0) && ((*s_etat_processus) |
|
.s_liste_variables[i].niveau == 1)) |
|
{ |
|
presence_variable = d_vrai; |
|
break; |
|
} |
|
|
|
i--; |
|
} |
} |
|
|
if (presence_variable == d_faux) |
return; |
|
} |
|
else |
|
{ |
|
if (((*(*(*s_etat_processus).pointeur_variable_courante).objet) |
|
.type != MIN) && ((*(*(*s_etat_processus) |
|
.pointeur_variable_courante).objet).type != MRL)) |
{ |
{ |
(*s_etat_processus).erreur_execution = d_ex_absence_observations; |
(*s_etat_processus).erreur_execution = |
|
d_ex_matrice_statistique_invalide; |
return; |
return; |
} |
} |
else |
|
{ |
|
(*s_etat_processus).position_variable_courante = i; |
|
|
|
if (((*s_etat_processus).s_liste_variables[i]).objet == NULL) |
|
{ |
|
(*s_etat_processus).erreur_execution = |
|
d_ex_variable_partagee; |
|
return; |
|
} |
|
|
|
if (((*((*s_etat_processus).s_liste_variables |
nombre_colonnes = (*((struct_matrice *) (*(*(*s_etat_processus) |
[(*s_etat_processus).position_variable_courante].objet)) |
.pointeur_variable_courante).objet).objet)).nombre_colonnes; |
.type != MIN) && ((*((*s_etat_processus) |
|
.s_liste_variables[(*s_etat_processus) |
|
.position_variable_courante].objet)).type != MRL)) |
|
{ |
|
(*s_etat_processus).erreur_execution = |
|
d_ex_matrice_statistique_invalide; |
|
return; |
|
} |
|
|
|
nombre_colonnes = (*((struct_matrice *) (*((*s_etat_processus) |
|
.s_liste_variables[(*s_etat_processus) |
|
.position_variable_courante].objet)).objet)) |
|
.nombre_colonnes; |
|
} |
|
} |
} |
|
|
s_objet_statistique = ((*s_etat_processus).s_liste_variables |
s_objet_statistique = (*(*s_etat_processus).pointeur_variable_courante) |
[(*s_etat_processus).position_variable_courante]).objet; |
.objet; |
|
|
if (((*s_objet_statistique).type == MIN) || |
if (((*s_objet_statistique).type == MIN) || |
((*s_objet_statistique).type == MRL)) |
((*s_objet_statistique).type == MRL)) |
Line 1555 instruction_psdev(struct_processus *s_et
|
Line 1531 instruction_psdev(struct_processus *s_et
|
void |
void |
instruction_pvar(struct_processus *s_etat_processus) |
instruction_pvar(struct_processus *s_etat_processus) |
{ |
{ |
logical1 presence_variable; |
|
|
|
long i; |
|
|
|
struct_objet *s_objet_statistique; |
struct_objet *s_objet_statistique; |
struct_objet *s_objet_resultat; |
struct_objet *s_objet_resultat; |
struct_objet *s_objet_temporaire; |
struct_objet *s_objet_temporaire; |
Line 1602 instruction_pvar(struct_processus *s_eta
|
Line 1574 instruction_pvar(struct_processus *s_eta
|
* Recherche d'une variable globale référencée par SIGMA |
* Recherche d'une variable globale référencée par SIGMA |
*/ |
*/ |
|
|
if (recherche_variable(s_etat_processus, ds_sdat) == d_faux) |
if (recherche_variable_globale(s_etat_processus, ds_sdat) == d_faux) |
{ |
{ |
/* |
/* |
* Aucune variable SIGMA |
* Aucune variable SIGMA |
*/ |
*/ |
|
|
(*s_etat_processus).erreur_systeme = d_es; |
(*s_etat_processus).erreur_systeme = d_es; |
(*s_etat_processus).erreur_execution = d_ex_absence_observations; |
|
return; |
|
} |
|
else |
|
{ |
|
/* |
|
* Il existe une variable locale SIGMA. Reste à vérifier l'existence |
|
* d'une variable SIGMA globale... |
|
*/ |
|
|
|
i = (*s_etat_processus).position_variable_courante; |
if ((*s_etat_processus).erreur_execution == d_ex) |
presence_variable = d_faux; |
|
|
|
while(i >= 0) |
|
{ |
{ |
if ((strcmp((*s_etat_processus).s_liste_variables[i].nom, |
(*s_etat_processus).erreur_execution = d_ex_absence_observations; |
ds_sdat) == 0) && ((*s_etat_processus) |
|
.s_liste_variables[i].niveau == 1)) |
|
{ |
|
presence_variable = d_vrai; |
|
break; |
|
} |
|
|
|
i--; |
|
} |
} |
|
|
if (presence_variable == d_faux) |
return; |
|
} |
|
else |
|
{ |
|
if (((*(*(*s_etat_processus).pointeur_variable_courante).objet) |
|
.type != MIN) && ((*(*(*s_etat_processus) |
|
.pointeur_variable_courante).objet).type != MRL)) |
{ |
{ |
(*s_etat_processus).erreur_execution = d_ex_absence_observations; |
(*s_etat_processus).erreur_execution = |
|
d_ex_matrice_statistique_invalide; |
return; |
return; |
} |
} |
else |
|
{ |
|
(*s_etat_processus).position_variable_courante = i; |
|
|
|
if (((*s_etat_processus).s_liste_variables[i]).objet == NULL) |
nombre_colonnes = (*((struct_matrice *) (*(*(*s_etat_processus) |
{ |
.pointeur_variable_courante).objet).objet)).nombre_colonnes; |
(*s_etat_processus).erreur_execution = |
|
d_ex_variable_partagee; |
|
return; |
|
} |
|
|
|
if (((*((*s_etat_processus).s_liste_variables |
|
[(*s_etat_processus).position_variable_courante].objet)) |
|
.type != MIN) && ((*((*s_etat_processus) |
|
.s_liste_variables[(*s_etat_processus) |
|
.position_variable_courante].objet)).type != MRL)) |
|
{ |
|
(*s_etat_processus).erreur_execution = |
|
d_ex_matrice_statistique_invalide; |
|
return; |
|
} |
|
|
|
nombre_colonnes = (*((struct_matrice *) (*((*s_etat_processus) |
|
.s_liste_variables[(*s_etat_processus) |
|
.position_variable_courante].objet)).objet)) |
|
.nombre_colonnes; |
|
} |
|
} |
} |
|
|
s_objet_statistique = ((*s_etat_processus).s_liste_variables |
s_objet_statistique = (*(*s_etat_processus).pointeur_variable_courante) |
[(*s_etat_processus).position_variable_courante]).objet; |
.objet; |
|
|
if (((*s_objet_statistique).type == MIN) || |
if (((*s_objet_statistique).type == MIN) || |
((*s_objet_statistique).type == MRL)) |
((*s_objet_statistique).type == MRL)) |