version 1.12, 2010/06/24 10:10:45
|
version 1.30, 2011/06/22 13:27:02
|
Line 1
|
Line 1
|
/* |
/* |
================================================================================ |
================================================================================ |
RPL/2 (R) version 4.0.17 |
RPL/2 (R) version 4.1.0.prerelease.3 |
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 741 instruction_rnrm(struct_processus *s_eta
|
Line 741 instruction_rnrm(struct_processus *s_eta
|
void |
void |
instruction_rceq(struct_processus *s_etat_processus) |
instruction_rceq(struct_processus *s_etat_processus) |
{ |
{ |
logical1 presence_variable; |
|
|
|
long i; |
|
|
|
struct_objet *s_objet_variable; |
struct_objet *s_objet_variable; |
|
|
(*s_etat_processus).erreur_execution = d_ex; |
(*s_etat_processus).erreur_execution = d_ex; |
Line 787 instruction_rceq(struct_processus *s_eta
|
Line 783 instruction_rceq(struct_processus *s_eta
|
} |
} |
} |
} |
|
|
if (recherche_variable(s_etat_processus, "EQ") == d_vrai) |
if (recherche_variable_globale(s_etat_processus, "EQ") == d_faux) |
{ |
{ |
i = (*s_etat_processus).position_variable_courante; |
(*s_etat_processus).erreur_systeme = d_es; |
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_faux) |
if ((*s_etat_processus).erreur_execution == d_ex) |
{ |
{ |
(*s_etat_processus).erreur_execution = d_ex_variable_non_definie; |
(*s_etat_processus).erreur_execution = d_ex_variable_non_definie; |
return; |
|
} |
} |
|
|
if ((*s_etat_processus).s_liste_variables[i].objet == NULL) |
|
{ |
|
(*s_etat_processus).erreur_execution = d_ex_variable_partagee; |
|
return; |
|
} |
|
} |
|
else |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es; |
|
(*s_etat_processus).erreur_execution = d_ex_variable_non_definie; |
|
return; |
return; |
} |
} |
|
|
if ((s_objet_variable = copie_objet(s_etat_processus, |
if ((s_objet_variable = copie_objet(s_etat_processus, |
((*s_etat_processus).s_liste_variables) |
(*(*s_etat_processus).pointeur_variable_courante).objet, 'P')) |
[(*s_etat_processus).position_variable_courante].objet, 'P')) |
|
== NULL) |
== NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
Line 974 instruction_recall(struct_processus *s_e
|
Line 942 instruction_recall(struct_processus *s_e
|
unsigned char *chaine; |
unsigned char *chaine; |
unsigned char *commande; |
unsigned char *commande; |
unsigned char *executable_candidat; |
unsigned char *executable_candidat; |
|
|
|
# ifndef OS2 |
unsigned char *instructions = "%s/bin/rpliconv %s " |
unsigned char *instructions = "%s/bin/rpliconv %s " |
"`%s/bin/rplfile " |
"`%s/bin/rplfile " |
"-m %s/share/rplfiles -i %s | awk " |
"-m %s/share/rplfiles -i %s | " |
"'{ print $3; }' | awk -F= '{ if " |
"%s/bin/rplawk " |
|
"'{ print $3; }' | %s/bin/rplawk -F= '{ if " |
"($2 != \"\") printf(\"-f %%s\", $2); }'` " |
"($2 != \"\") printf(\"-f %%s\", $2); }'` " |
"-t `locale charmap` | %s/bin/%s -o %s"; |
"-t `locale charmap` | %s/bin/%s -o %s"; |
|
# else |
|
unsigned char *instructions = BOURNE_SHELL |
|
" -c \"%s/bin/rpliconv %s " |
|
"`%s/bin/rplfile " |
|
"-m %s/share/rplfiles -i %s | " |
|
"%s/bin/rplawk " |
|
"'{ print $3; }' | %s/bin/rplawk -F= '{ if " |
|
"($2 != \\\"\\\") printf(\\\"-f %%s\\\", " |
|
"$2); }'` -t `" d_locale |
|
"` | %s/bin/%s -o %s\""; |
|
# endif |
|
|
unsigned char *nom_fichier_temporaire; |
unsigned char *nom_fichier_temporaire; |
unsigned char *tampon_definitions_chainees; |
unsigned char *tampon_definitions_chainees; |
unsigned char *tampon_instruction_courante; |
unsigned char *tampon_instruction_courante; |
Line 1058 instruction_recall(struct_processus *s_e
|
Line 1041 instruction_recall(struct_processus *s_e
|
{ |
{ |
if ((commande = malloc((strlen(ds_preprocesseur) + |
if ((commande = malloc((strlen(ds_preprocesseur) + |
(2 * strlen((unsigned char *) (*s_objet).objet)) + |
(2 * strlen((unsigned char *) (*s_objet).objet)) + |
(4 * strlen(d_exec_path)) + |
(6 * strlen(d_exec_path)) + |
strlen(nom_fichier_temporaire) + strlen(instructions) - 11) |
strlen(nom_fichier_temporaire) + strlen(instructions) - 19) |
* 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; |
Line 1070 instruction_recall(struct_processus *s_e
|
Line 1053 instruction_recall(struct_processus *s_e
|
(unsigned char *) (*s_objet).objet, |
(unsigned char *) (*s_objet).objet, |
d_exec_path, d_exec_path, |
d_exec_path, d_exec_path, |
(unsigned char *) (*s_objet).objet, |
(unsigned char *) (*s_objet).objet, |
|
d_exec_path, d_exec_path, |
d_exec_path, ds_preprocesseur, nom_fichier_temporaire); |
d_exec_path, ds_preprocesseur, nom_fichier_temporaire); |
|
|
if (alsprintf(&executable_candidat, "%s/bin/rpliconv", |
if (alsprintf(&executable_candidat, "%s/bin/rpliconv", |
Line 1140 instruction_recall(struct_processus *s_e
|
Line 1124 instruction_recall(struct_processus *s_e
|
} |
} |
|
|
free(executable_candidat); |
free(executable_candidat); |
|
|
|
if (alsprintf(&executable_candidat, "%s/bin/rplawk", |
|
d_exec_path) < 0) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
|
return; |
|
} |
|
|
|
if (controle(s_etat_processus, executable_candidat, "md5", |
|
rplawk_md5) != d_vrai) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_somme_controle; |
|
return; |
|
} |
|
|
|
if (controle(s_etat_processus, executable_candidat, "sha1", |
|
rplawk_sha1) != d_vrai) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_somme_controle; |
|
return; |
|
} |
|
|
|
free(executable_candidat); |
} |
} |
else |
else |
{ |
{ |
if ((commande = malloc((strlen(ds_preprocesseur) + |
if ((commande = malloc((strlen(ds_preprocesseur) + |
(2 * strlen((unsigned char *) (*s_objet).objet)) + |
(2 * strlen((unsigned char *) (*s_objet).objet)) + |
(4 * strlen((*s_etat_processus).rpl_home)) + |
(6 * strlen((*s_etat_processus).rpl_home)) + |
strlen(nom_fichier_temporaire) + strlen(instructions) - 11) |
strlen(nom_fichier_temporaire) + strlen(instructions) - 19) |
* 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; |
Line 1157 instruction_recall(struct_processus *s_e
|
Line 1164 instruction_recall(struct_processus *s_e
|
(unsigned char *) (*s_objet).objet, |
(unsigned char *) (*s_objet).objet, |
(*s_etat_processus).rpl_home, (*s_etat_processus).rpl_home, |
(*s_etat_processus).rpl_home, (*s_etat_processus).rpl_home, |
(unsigned char *) (*s_objet).objet, |
(unsigned char *) (*s_objet).objet, |
|
(*s_etat_processus).rpl_home, (*s_etat_processus).rpl_home, |
(*s_etat_processus).rpl_home, ds_preprocesseur, |
(*s_etat_processus).rpl_home, ds_preprocesseur, |
nom_fichier_temporaire); |
nom_fichier_temporaire); |
|
|
Line 1228 instruction_recall(struct_processus *s_e
|
Line 1236 instruction_recall(struct_processus *s_e
|
} |
} |
|
|
free(executable_candidat); |
free(executable_candidat); |
|
|
|
if (alsprintf(&executable_candidat, "%s/bin/rplawk", |
|
d_exec_path) < 0) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
|
return; |
|
} |
|
|
|
if (controle(s_etat_processus, executable_candidat, "md5", |
|
rplawk_md5) != d_vrai) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_somme_controle; |
|
return; |
|
} |
|
|
|
if (controle(s_etat_processus, executable_candidat, "sha1", |
|
rplawk_sha1) != d_vrai) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_somme_controle; |
|
return; |
|
} |
|
|
|
free(executable_candidat); |
} |
} |
|
|
if ((pipe = popen(commande, "r")) == NULL) |
if ((pipe = popen(commande, "r")) == NULL) |
Line 1635 instruction_rcws(struct_processus *s_eta
|
Line 1666 instruction_rcws(struct_processus *s_eta
|
void |
void |
instruction_rcls(struct_processus *s_etat_processus) |
instruction_rcls(struct_processus *s_etat_processus) |
{ |
{ |
logical1 presence_variable; |
|
|
|
long i; |
|
|
|
struct_objet *s_objet_variable; |
struct_objet *s_objet_variable; |
|
|
(*s_etat_processus).erreur_execution = d_ex; |
(*s_etat_processus).erreur_execution = d_ex; |
Line 1679 instruction_rcls(struct_processus *s_eta
|
Line 1706 instruction_rcls(struct_processus *s_eta
|
} |
} |
} |
} |
|
|
if (recherche_variable(s_etat_processus, ds_sdat) == d_vrai) |
if (recherche_variable_globale(s_etat_processus, ds_sdat) == d_faux) |
{ |
{ |
i = (*s_etat_processus).position_variable_courante; |
(*s_etat_processus).erreur_systeme = d_es; |
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_faux) |
if ((*s_etat_processus).erreur_execution == d_ex) |
{ |
{ |
(*s_etat_processus).erreur_execution = d_ex_variable_non_definie; |
(*s_etat_processus).erreur_execution = d_ex_variable_non_definie; |
return; |
|
} |
} |
|
|
if ((*s_etat_processus).s_liste_variables[i].objet == NULL) |
|
{ |
|
(*s_etat_processus).erreur_execution = d_ex_variable_partagee; |
|
return; |
|
} |
|
} |
|
else |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es; |
|
(*s_etat_processus).erreur_execution = d_ex_variable_non_definie; |
|
return; |
return; |
} |
} |
|
|
if ((s_objet_variable = copie_objet(s_etat_processus, |
if ((s_objet_variable = copie_objet(s_etat_processus, |
((*s_etat_processus).s_liste_variables) |
(*(*s_etat_processus).pointeur_variable_courante).objet, 'O')) |
[(*s_etat_processus).position_variable_courante].objet, 'O')) |
|
== NULL) |
== NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |