version 1.5, 2010/03/09 10:18:47
|
version 1.46, 2013/12/03 09:36:14
|
Line 1
|
Line 1
|
/* |
/* |
================================================================================ |
================================================================================ |
RPL/2 (R) version 4.0.13 |
RPL/2 (R) version 4.1.17 |
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 38
|
Line 38
|
void |
void |
instruction_mean(struct_processus *s_etat_processus) |
instruction_mean(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; |
|
|
unsigned long nombre_colonnes; |
integer8 nombre_colonnes; |
|
|
(*s_etat_processus).erreur_execution = d_ex; |
(*s_etat_processus).erreur_execution = d_ex; |
|
|
Line 85 instruction_mean(struct_processus *s_eta
|
Line 81 instruction_mean(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) |
|
{ |
|
(*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 255 instruction_mean(struct_processus *s_eta
|
Line 215 instruction_mean(struct_processus *s_eta
|
void |
void |
instruction_mins(struct_processus *s_etat_processus) |
instruction_mins(struct_processus *s_etat_processus) |
{ |
{ |
logical1 presence_variable; |
|
|
|
long i; |
long i; |
long j; |
long j; |
|
|
struct_objet *s_objet_statistique; |
struct_objet *s_objet_statistique; |
struct_objet *s_objet_resultat; |
struct_objet *s_objet_resultat; |
|
|
unsigned long nombre_colonnes; |
integer8 nombre_colonnes; |
|
|
(*s_etat_processus).erreur_execution = d_ex; |
(*s_etat_processus).erreur_execution = d_ex; |
|
|
Line 302 instruction_mins(struct_processus *s_eta
|
Line 260 instruction_mins(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; |
|
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 |
|
[(*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) |
nombre_colonnes = (*((struct_matrice *) (*(*(*s_etat_processus) |
.s_liste_variables[(*s_etat_processus) |
.pointeur_variable_courante).objet).objet)).nombre_colonnes; |
.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 (nombre_colonnes == 1) |
if (nombre_colonnes == 1) |
{ |
{ |
Line 386 instruction_mins(struct_processus *s_eta
|
Line 308 instruction_mins(struct_processus *s_eta
|
(*((struct_matrice *) (*s_objet_statistique).objet)) |
(*((struct_matrice *) (*s_objet_statistique).objet)) |
.tableau)[0][0]; |
.tableau)[0][0]; |
|
|
for(i = 1; i < (long) (*((struct_matrice *) (*s_objet_statistique) |
for(i = 1; i < (*((struct_matrice *) (*s_objet_statistique) |
.objet)).nombre_lignes; i++) |
.objet)).nombre_lignes; i++) |
{ |
{ |
if ((*((real8 *) (*s_objet_resultat).objet)) > ((real8 **) |
if ((*((real8 *) (*s_objet_resultat).objet)) > ((real8 **) |
Line 412 instruction_mins(struct_processus *s_eta
|
Line 334 instruction_mins(struct_processus *s_eta
|
(*((struct_matrice *) (*s_objet_statistique).objet)) |
(*((struct_matrice *) (*s_objet_statistique).objet)) |
.tableau)[0][0]; |
.tableau)[0][0]; |
|
|
for(i = 1; i < (long) (*((struct_matrice *) (*s_objet_statistique) |
for(i = 1; i < (*((struct_matrice *) (*s_objet_statistique) |
.objet)).nombre_lignes; i++) |
.objet)).nombre_lignes; i++) |
{ |
{ |
if ((*((integer8 *) (*s_objet_resultat).objet)) > ((integer8 **) |
if ((*((integer8 *) (*s_objet_resultat).objet)) > ((integer8 **) |
Line 441 instruction_mins(struct_processus *s_eta
|
Line 363 instruction_mins(struct_processus *s_eta
|
nombre_colonnes; |
nombre_colonnes; |
|
|
if (((*((struct_vecteur *) (*s_objet_resultat).objet)).tableau = |
if (((*((struct_vecteur *) (*s_objet_resultat).objet)).tableau = |
malloc(nombre_colonnes * sizeof(real8))) == NULL) |
malloc(((size_t) nombre_colonnes) * sizeof(real8))) == NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
return; |
return; |
} |
} |
|
|
for(j = 0; j < (long) nombre_colonnes; j++) |
for(j = 0; j < nombre_colonnes; j++) |
{ |
{ |
((real8 *) (*((struct_vecteur *) (*s_objet_resultat).objet)) |
((real8 *) (*((struct_vecteur *) (*s_objet_resultat).objet)) |
.tableau)[j] = ((real8 **) (*((struct_matrice *) |
.tableau)[j] = ((real8 **) (*((struct_matrice *) |
(*s_objet_statistique).objet)).tableau)[0][j]; |
(*s_objet_statistique).objet)).tableau)[0][j]; |
|
|
for(i = 1; i < (long) (*((struct_matrice *) |
for(i = 1; i < (*((struct_matrice *) |
(*s_objet_statistique).objet)).nombre_lignes; i++) |
(*s_objet_statistique).objet)).nombre_lignes; i++) |
{ |
{ |
if (((real8 *) (*((struct_vecteur *) (*s_objet_resultat) |
if (((real8 *) (*((struct_vecteur *) (*s_objet_resultat) |
Line 482 instruction_mins(struct_processus *s_eta
|
Line 404 instruction_mins(struct_processus *s_eta
|
nombre_colonnes; |
nombre_colonnes; |
|
|
if (((*((struct_vecteur *) (*s_objet_resultat).objet)).tableau = |
if (((*((struct_vecteur *) (*s_objet_resultat).objet)).tableau = |
malloc(nombre_colonnes * sizeof(integer8))) == NULL) |
malloc(((size_t) nombre_colonnes) * sizeof(integer8))) |
|
== NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
return; |
return; |
} |
} |
|
|
for(j = 0; j < (long) nombre_colonnes; j++) |
for(j = 0; j < nombre_colonnes; j++) |
{ |
{ |
((integer8 *) (*((struct_vecteur *) (*s_objet_resultat).objet)) |
((integer8 *) (*((struct_vecteur *) (*s_objet_resultat).objet)) |
.tableau)[j] = ((integer8 **) (*((struct_matrice *) |
.tableau)[j] = ((integer8 **) (*((struct_matrice *) |
(*s_objet_statistique).objet)).tableau)[0][j]; |
(*s_objet_statistique).objet)).tableau)[0][j]; |
|
|
for(i = 1; i < (long) (*((struct_matrice *) |
for(i = 1; i < (*((struct_matrice *) |
(*s_objet_statistique).objet)).nombre_lignes; i++) |
(*s_objet_statistique).objet)).nombre_lignes; i++) |
{ |
{ |
if (((integer8 *) (*((struct_vecteur *) (*s_objet_resultat) |
if (((integer8 *) (*((struct_vecteur *) (*s_objet_resultat) |
Line 537 instruction_mins(struct_processus *s_eta
|
Line 460 instruction_mins(struct_processus *s_eta
|
void |
void |
instruction_maxs(struct_processus *s_etat_processus) |
instruction_maxs(struct_processus *s_etat_processus) |
{ |
{ |
logical1 presence_variable; |
|
|
|
long i; |
long i; |
long j; |
long j; |
|
|
struct_objet *s_objet_statistique; |
struct_objet *s_objet_statistique; |
struct_objet *s_objet_resultat; |
struct_objet *s_objet_resultat; |
|
|
unsigned long nombre_colonnes; |
integer8 nombre_colonnes; |
|
|
(*s_etat_processus).erreur_execution = d_ex; |
(*s_etat_processus).erreur_execution = d_ex; |
|
|
Line 584 instruction_maxs(struct_processus *s_eta
|
Line 505 instruction_maxs(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) |
|
{ |
|
(*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 (nombre_colonnes == 1) |
if (nombre_colonnes == 1) |
{ |
{ |
Line 668 instruction_maxs(struct_processus *s_eta
|
Line 553 instruction_maxs(struct_processus *s_eta
|
(*((struct_matrice *) (*s_objet_statistique).objet)) |
(*((struct_matrice *) (*s_objet_statistique).objet)) |
.tableau)[0][0]; |
.tableau)[0][0]; |
|
|
for(i = 1; i < (long) (*((struct_matrice *) (*s_objet_statistique) |
for(i = 1; i < (*((struct_matrice *) (*s_objet_statistique) |
.objet)).nombre_lignes; i++) |
.objet)).nombre_lignes; i++) |
{ |
{ |
if ((*((real8 *) (*s_objet_resultat).objet)) < ((real8 **) |
if ((*((real8 *) (*s_objet_resultat).objet)) < ((real8 **) |
Line 694 instruction_maxs(struct_processus *s_eta
|
Line 579 instruction_maxs(struct_processus *s_eta
|
(*((struct_matrice *) (*s_objet_statistique).objet)) |
(*((struct_matrice *) (*s_objet_statistique).objet)) |
.tableau)[0][0]; |
.tableau)[0][0]; |
|
|
for(i = 1; i < (long) (*((struct_matrice *) (*s_objet_statistique) |
for(i = 1; i < (*((struct_matrice *) (*s_objet_statistique) |
.objet)).nombre_lignes; i++) |
.objet)).nombre_lignes; i++) |
{ |
{ |
if ((*((integer8 *) (*s_objet_resultat).objet)) < ((integer8 **) |
if ((*((integer8 *) (*s_objet_resultat).objet)) < ((integer8 **) |
Line 723 instruction_maxs(struct_processus *s_eta
|
Line 608 instruction_maxs(struct_processus *s_eta
|
nombre_colonnes; |
nombre_colonnes; |
|
|
if (((*((struct_vecteur *) (*s_objet_resultat).objet)).tableau = |
if (((*((struct_vecteur *) (*s_objet_resultat).objet)).tableau = |
malloc(nombre_colonnes * sizeof(real8))) == NULL) |
malloc(((size_t) nombre_colonnes) * sizeof(real8))) == NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
return; |
return; |
} |
} |
|
|
for(j = 0; j < (long) nombre_colonnes; j++) |
for(j = 0; j < nombre_colonnes; j++) |
{ |
{ |
((real8 *) (*((struct_vecteur *) (*s_objet_resultat).objet)) |
((real8 *) (*((struct_vecteur *) (*s_objet_resultat).objet)) |
.tableau)[j] = ((real8 **) (*((struct_matrice *) |
.tableau)[j] = ((real8 **) (*((struct_matrice *) |
(*s_objet_statistique).objet)).tableau)[0][j]; |
(*s_objet_statistique).objet)).tableau)[0][j]; |
|
|
for(i = 1; i < (long) (*((struct_matrice *) |
for(i = 1; i < (*((struct_matrice *) |
(*s_objet_statistique).objet)).nombre_lignes; i++) |
(*s_objet_statistique).objet)).nombre_lignes; i++) |
{ |
{ |
if (((real8 *) (*((struct_vecteur *) (*s_objet_resultat) |
if (((real8 *) (*((struct_vecteur *) (*s_objet_resultat) |
Line 764 instruction_maxs(struct_processus *s_eta
|
Line 649 instruction_maxs(struct_processus *s_eta
|
nombre_colonnes; |
nombre_colonnes; |
|
|
if (((*((struct_vecteur *) (*s_objet_resultat).objet)).tableau = |
if (((*((struct_vecteur *) (*s_objet_resultat).objet)).tableau = |
malloc(nombre_colonnes * sizeof(integer8))) == NULL) |
malloc(((size_t) nombre_colonnes) * sizeof(integer8))) |
|
== NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
return; |
return; |
} |
} |
|
|
for(j = 0; j < (long) nombre_colonnes; j++) |
for(j = 0; j < nombre_colonnes; j++) |
{ |
{ |
((integer8 *) (*((struct_vecteur *) (*s_objet_resultat).objet)) |
((integer8 *) (*((struct_vecteur *) (*s_objet_resultat).objet)) |
.tableau)[j] = ((integer8 **) (*((struct_matrice *) |
.tableau)[j] = ((integer8 **) (*((struct_matrice *) |
(*s_objet_statistique).objet)).tableau)[0][j]; |
(*s_objet_statistique).objet)).tableau)[0][j]; |
|
|
for(i = 1; i < (long) (*((struct_matrice *) |
for(i = 1; i < (*((struct_matrice *) |
(*s_objet_statistique).objet)).nombre_lignes; i++) |
(*s_objet_statistique).objet)).nombre_lignes; i++) |
{ |
{ |
if (((integer8 *) (*((struct_vecteur *) (*s_objet_resultat) |
if (((integer8 *) (*((struct_vecteur *) (*s_objet_resultat) |