version 1.3, 2010/02/10 10:14:24
|
version 1.20, 2011/06/10 11:35:13
|
Line 1
|
Line 1
|
/* |
/* |
================================================================================ |
================================================================================ |
RPL/2 (R) version 4.0.11 |
RPL/2 (R) version 4.1.0.prerelease.0 |
Copyright (C) 1989-2010 Dr. BERTRAND Joël |
Copyright (C) 1989-2011 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") |
liberation(s_etat_processus, s_objet); |
== 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) |
|
.position_variable_courante].variable_verrouillee == |
|
d_vrai) |
|
{ |
|
liberation(s_etat_processus, s_objet); |
|
|
|
(*s_etat_processus).erreur_execution = |
(*s_etat_processus).erreur_execution = |
d_ex_variable_verrouillee; |
d_ex_variable_verrouillee; |
return; |
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; |
|
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; |
|
|
|
if (creation_variable(s_etat_processus, &s_variable, 'V', 'P') |
liberation(s_etat_processus, |
== d_erreur) |
(*(*s_etat_processus).pointeur_variable_courante).objet); |
{ |
(*(*s_etat_processus).pointeur_variable_courante).objet = s_objet; |
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 611 instruction_store(struct_processus *s_et
|
Line 546 instruction_store(struct_processus *s_et
|
file *fichier; |
file *fichier; |
|
|
logical1 i45; |
logical1 i45; |
|
logical1 i48; |
logical1 i49; |
logical1 i49; |
logical1 i50; |
logical1 i50; |
|
|
Line 618 instruction_store(struct_processus *s_et
|
Line 554 instruction_store(struct_processus *s_et
|
struct_objet *s_objet_argument_2; |
struct_objet *s_objet_argument_2; |
|
|
unsigned char *ligne; |
unsigned char *ligne; |
|
unsigned char *ligne_convertie; |
|
unsigned char registre; |
|
|
(*s_etat_processus).erreur_execution = d_ex; |
(*s_etat_processus).erreur_execution = d_ex; |
|
|
Line 710 instruction_store(struct_processus *s_et
|
Line 648 instruction_store(struct_processus *s_et
|
} |
} |
|
|
i45 = test_cfsf(s_etat_processus, 45); |
i45 = test_cfsf(s_etat_processus, 45); |
|
i48 = test_cfsf(s_etat_processus, 48); |
i49 = test_cfsf(s_etat_processus, 49); |
i49 = test_cfsf(s_etat_processus, 49); |
i50 = test_cfsf(s_etat_processus, 50); |
i50 = test_cfsf(s_etat_processus, 50); |
|
|
cf(s_etat_processus, 45); |
cf(s_etat_processus, 45); |
|
cf(s_etat_processus, 48); |
cf(s_etat_processus, 49); |
cf(s_etat_processus, 49); |
cf(s_etat_processus, 50); |
cf(s_etat_processus, 50); |
|
|
Line 723 instruction_store(struct_processus *s_et
|
Line 663 instruction_store(struct_processus *s_et
|
return; |
return; |
} |
} |
|
|
|
registre = (*s_etat_processus).autorisation_conversion_chaine; |
|
(*s_etat_processus).autorisation_conversion_chaine = 'N'; |
|
|
|
ligne = formateur(s_etat_processus, 0, s_objet_argument_2); |
|
|
|
if ((ligne_convertie = transliteration(s_etat_processus, |
|
ligne, d_locale, "UTF-8")) == NULL) |
|
{ |
|
free(ligne); |
|
|
|
liberation(s_etat_processus, s_objet_argument_1); |
|
liberation(s_etat_processus, s_objet_argument_2); |
|
return; |
|
} |
|
|
|
free(ligne); |
|
ligne = ligne_convertie; |
|
|
|
(*s_etat_processus).autorisation_conversion_chaine = registre; |
|
|
if ((*s_objet_argument_2).type == CHN) |
if ((*s_objet_argument_2).type == CHN) |
{ |
{ |
if (fprintf(fichier, "\"%s\"\n", ligne = formateur(s_etat_processus, |
if (fprintf(fichier, "\"%s\"\n", ligne) < 0) |
0, s_objet_argument_2)) < 0) |
|
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_erreur_fichier; |
(*s_etat_processus).erreur_systeme = d_es_erreur_fichier; |
return; |
return; |
} |
} |
|
|
|
(*s_etat_processus).autorisation_conversion_chaine = registre; |
} |
} |
else |
else |
{ |
{ |
if (fprintf(fichier, "%s\n", ligne = formateur(s_etat_processus, |
if (fprintf(fichier, "%s\n", ligne) < 0) |
0, s_objet_argument_2)) < 0) |
|
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_erreur_fichier; |
(*s_etat_processus).erreur_systeme = d_es_erreur_fichier; |
return; |
return; |
} |
} |
|
|
|
(*s_etat_processus).autorisation_conversion_chaine = registre; |
} |
} |
|
|
free(ligne); |
free(ligne); |
Line 759 instruction_store(struct_processus *s_et
|
Line 721 instruction_store(struct_processus *s_et
|
cf(s_etat_processus, 45); |
cf(s_etat_processus, 45); |
} |
} |
|
|
|
if (i48 == d_vrai) |
|
{ |
|
sf(s_etat_processus, 48); |
|
} |
|
else |
|
{ |
|
cf(s_etat_processus, 48); |
|
} |
|
|
if (i49 == d_vrai) |
if (i49 == d_vrai) |
{ |
{ |
sf(s_etat_processus, 49); |
sf(s_etat_processus, 49); |
Line 1548 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 1601 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 = |
(*s_etat_processus).erreur_execution = |
d_ex_variable_verrouillee; |
d_ex_variable_verrouillee; |
return; |
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; |
|
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 1685 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 1707 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; |