version 1.7, 2010/04/07 13:45:08
|
version 1.62, 2018/05/30 09:27:37
|
Line 1
|
Line 1
|
/* |
/* |
================================================================================ |
================================================================================ |
RPL/2 (R) version 4.0.14 |
RPL/2 (R) version 4.1.29 |
Copyright (C) 1989-2010 Dr. BERTRAND Joël |
Copyright (C) 1989-2018 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_steq(struct_processus *s_etat_processus) |
instruction_steq(struct_processus *s_etat_processus) |
{ |
{ |
logical1 presence_variable; |
|
|
|
long i; |
|
|
|
struct_objet *s_objet; |
struct_objet *s_objet; |
|
|
struct_variable s_variable; |
struct_variable s_variable; |
Line 93 instruction_steq(struct_processus *s_eta
|
Line 89 instruction_steq(struct_processus *s_eta
|
return; |
return; |
} |
} |
|
|
if (recherche_variable(s_etat_processus, "EQ") == d_vrai) |
if (recherche_variable_globale(s_etat_processus, "EQ") == d_vrai) |
{ |
{ |
/* |
if ((*(*s_etat_processus).pointeur_variable_courante) |
* La variable préexiste. Il faut tester si celle-ci est globale |
.variable_verrouillee == d_vrai) |
* (de niveau 1). |
|
*/ |
|
|
|
i = (*s_etat_processus).position_variable_courante; |
|
presence_variable = d_faux; |
|
|
|
while(i >= 0) |
|
{ |
|
if ((strcmp((*s_etat_processus).s_liste_variables[i].nom, "EQ") |
|
== 0) && ((*s_etat_processus).s_liste_variables[i] |
|
.niveau == 1)) |
|
{ |
|
presence_variable = d_vrai; |
|
break; |
|
} |
|
i--; |
|
} |
|
|
|
(*s_etat_processus).position_variable_courante = i; |
|
|
|
if (presence_variable == d_vrai) |
|
{ |
{ |
if ((*s_etat_processus).s_liste_variables[(*s_etat_processus) |
liberation(s_etat_processus, s_objet); |
.position_variable_courante].variable_verrouillee == |
|
d_vrai) |
|
{ |
|
liberation(s_etat_processus, s_objet); |
|
|
|
(*s_etat_processus).erreur_execution = |
|
d_ex_variable_verrouillee; |
|
return; |
|
} |
|
|
|
if ((*s_etat_processus).s_liste_variables[i].objet == NULL) |
|
{ |
|
liberation(s_etat_processus, s_objet); |
|
|
|
(*s_etat_processus).erreur_execution = d_ex_variable_partagee; |
(*s_etat_processus).erreur_execution = |
return; |
d_ex_variable_verrouillee; |
} |
return; |
|
|
liberation(s_etat_processus, |
|
(*s_etat_processus).s_liste_variables[(*s_etat_processus) |
|
.position_variable_courante].objet); |
|
|
|
(*s_etat_processus).s_liste_variables[(*s_etat_processus) |
|
.position_variable_courante].objet = s_objet; |
|
} |
} |
else |
|
{ |
|
if ((s_variable.nom = malloc(3 * sizeof(unsigned char))) == NULL) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
|
return; |
|
} |
|
|
|
strcpy(s_variable.nom, "EQ"); |
|
s_variable.niveau = 1; |
|
|
|
/* |
|
* Le niveau 0 correspond aux définitions. Les variables |
|
* commencent à 1 car elles sont toujours incluses dans |
|
* une définition. |
|
*/ |
|
|
|
s_variable.objet = s_objet; |
liberation(s_etat_processus, |
|
(*(*s_etat_processus).pointeur_variable_courante).objet); |
if (creation_variable(s_etat_processus, &s_variable, 'V', 'P') |
(*(*s_etat_processus).pointeur_variable_courante).objet = s_objet; |
== d_erreur) |
|
{ |
|
return; |
|
} |
|
} |
|
} |
} |
else |
else |
{ |
{ |
Line 177 instruction_steq(struct_processus *s_eta
|
Line 111 instruction_steq(struct_processus *s_eta
|
* La variable n'existe pas et on crée une variable globale. |
* La variable n'existe pas et on crée une variable globale. |
*/ |
*/ |
|
|
|
(*s_etat_processus).erreur_systeme = d_es; |
|
(*s_etat_processus).erreur_execution = d_ex; |
|
|
if ((s_variable.nom = malloc(3 * sizeof(unsigned char))) == NULL) |
if ((s_variable.nom = malloc(3 * sizeof(unsigned char))) == NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
Line 199 instruction_steq(struct_processus *s_eta
|
Line 136 instruction_steq(struct_processus *s_eta
|
{ |
{ |
return; |
return; |
} |
} |
|
|
(*s_etat_processus).erreur_systeme = d_es; |
|
} |
} |
|
|
return; |
return; |
Line 912 instruction_stws(struct_processus *s_eta
|
Line 847 instruction_stws(struct_processus *s_eta
|
return; |
return; |
} |
} |
|
|
(*((logical8 *) (*s_objet_binaire).objet)) = (*((integer8 *) |
(*((logical8 *) (*s_objet_binaire).objet)) = (logical8) ((*((integer8 *) |
(*s_objet_argument).objet)) - 1; |
(*s_objet_argument).objet)) - 1); |
|
|
i43 = test_cfsf(s_etat_processus, 43); |
i43 = test_cfsf(s_etat_processus, 43); |
i44 = test_cfsf(s_etat_processus, 44); |
i44 = test_cfsf(s_etat_processus, 44); |
Line 947 instruction_stws(struct_processus *s_eta
|
Line 882 instruction_stws(struct_processus *s_eta
|
{ |
{ |
if (valeur_binaire[i] == '0') |
if (valeur_binaire[i] == '0') |
{ |
{ |
cf(s_etat_processus, j++); |
cf(s_etat_processus, (unsigned char) j++); |
} |
} |
else |
else |
{ |
{ |
sf(s_etat_processus, j++); |
sf(s_etat_processus, (unsigned char) j++); |
} |
} |
} |
} |
|
|
for(; j <= 42; cf(s_etat_processus, j++)); |
for(; j <= 42; cf(s_etat_processus, (unsigned char) j++)); |
|
|
free(valeur_binaire); |
free(valeur_binaire); |
} |
} |
Line 1584 instruction_star_s(struct_processus *s_e
|
Line 1519 instruction_star_s(struct_processus *s_e
|
void |
void |
instruction_stos(struct_processus *s_etat_processus) |
instruction_stos(struct_processus *s_etat_processus) |
{ |
{ |
logical1 presence_variable; |
|
|
|
long i; |
|
|
|
struct_objet *s_objet; |
struct_objet *s_objet; |
|
|
struct_variable s_variable; |
struct_variable s_variable; |
Line 1637 instruction_stos(struct_processus *s_eta
|
Line 1568 instruction_stos(struct_processus *s_eta
|
return; |
return; |
} |
} |
|
|
if (recherche_variable(s_etat_processus, ds_sdat) == d_vrai) |
if (recherche_variable_globale(s_etat_processus, ds_sdat) == d_vrai) |
{ |
{ |
/* |
if ((*(*s_etat_processus).pointeur_variable_courante) |
* La variable préexiste. Il faut tester si celle-ci est globale |
.variable_verrouillee == d_vrai) |
* (de niveau 1). |
|
*/ |
|
|
|
i = (*s_etat_processus).position_variable_courante; |
|
presence_variable = d_faux; |
|
|
|
while(i >= 0) |
|
{ |
|
if ((strcmp((*s_etat_processus).s_liste_variables[i].nom, ds_sdat) |
|
== 0) && ((*s_etat_processus).s_liste_variables[i] |
|
.niveau == 1)) |
|
{ |
|
presence_variable = d_vrai; |
|
break; |
|
} |
|
i--; |
|
} |
|
|
|
(*s_etat_processus).position_variable_courante = i; |
|
|
|
if (presence_variable == d_vrai) |
|
{ |
{ |
if ((*s_etat_processus).s_liste_variables[(*s_etat_processus) |
liberation(s_etat_processus, s_objet); |
.position_variable_courante].variable_verrouillee == |
|
d_vrai) |
|
{ |
|
liberation(s_etat_processus, s_objet); |
|
|
|
(*s_etat_processus).erreur_execution = |
|
d_ex_variable_verrouillee; |
|
return; |
|
} |
|
|
|
if ((*s_etat_processus).s_liste_variables[i].objet == NULL) |
|
{ |
|
liberation(s_etat_processus, s_objet); |
|
|
|
(*s_etat_processus).erreur_execution = d_ex_variable_partagee; |
(*s_etat_processus).erreur_execution = |
return; |
d_ex_variable_verrouillee; |
} |
return; |
|
|
liberation(s_etat_processus, |
|
(*s_etat_processus).s_liste_variables[(*s_etat_processus) |
|
.position_variable_courante].objet); |
|
|
|
(*s_etat_processus).s_liste_variables[(*s_etat_processus) |
|
.position_variable_courante].objet = s_objet; |
|
} |
} |
else |
|
{ |
|
if ((s_variable.nom = malloc(6 * sizeof(unsigned char))) == NULL) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
|
return; |
|
} |
|
|
|
strcpy(s_variable.nom, ds_sdat); |
|
s_variable.niveau = 1; |
|
|
|
/* |
|
* Le niveau 0 correspond aux définitions. Les variables |
|
* commencent à 1 car elles sont toujours incluses dans |
|
* une définition. |
|
*/ |
|
|
|
s_variable.objet = s_objet; |
liberation(s_etat_processus, |
|
(*(*s_etat_processus).pointeur_variable_courante).objet); |
if (creation_variable(s_etat_processus, &s_variable, 'V', 'P') |
(*(*s_etat_processus).pointeur_variable_courante).objet = s_objet; |
== d_erreur) |
|
{ |
|
return; |
|
} |
|
} |
|
} |
} |
else |
else |
{ |
{ |
Line 1721 instruction_stos(struct_processus *s_eta
|
Line 1590 instruction_stos(struct_processus *s_eta
|
* La variable n'existe pas et on crée une variable globale. |
* La variable n'existe pas et on crée une variable globale. |
*/ |
*/ |
|
|
|
(*s_etat_processus).erreur_systeme = d_es; |
|
(*s_etat_processus).erreur_execution = d_ex; |
|
|
if ((s_variable.nom = malloc(6 * sizeof(unsigned char))) == NULL) |
if ((s_variable.nom = malloc(6 * sizeof(unsigned char))) == NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
Line 1743 instruction_stos(struct_processus *s_eta
|
Line 1615 instruction_stos(struct_processus *s_eta
|
{ |
{ |
return; |
return; |
} |
} |
|
|
(*s_etat_processus).erreur_systeme = d_es; |
|
} |
} |
|
|
return; |
return; |