version 1.3, 2010/02/10 10:14:24
|
version 1.14, 2010/06/24 10:10:45
|
Line 1
|
Line 1
|
/* |
/* |
================================================================================ |
================================================================================ |
RPL/2 (R) version 4.0.11 |
RPL/2 (R) version 4.0.17 |
Copyright (C) 1989-2010 Dr. BERTRAND Joël |
Copyright (C) 1989-2010 Dr. BERTRAND Joël |
|
|
This file is part of RPL/2. |
This file is part of RPL/2. |
Line 1019 instruction_sst(struct_processus *s_etat
|
Line 1019 instruction_sst(struct_processus *s_etat
|
void |
void |
instruction_str_fleche(struct_processus *s_etat_processus) |
instruction_str_fleche(struct_processus *s_etat_processus) |
{ |
{ |
|
logical1 drapeau45; |
|
logical1 presence_chaine; |
|
|
struct_objet *s_objet; |
struct_objet *s_objet; |
struct_objet *s_sous_objet; |
struct_objet *s_sous_objet; |
|
|
unsigned char *commande; |
unsigned char *commande; |
|
unsigned char *chaine_convertie; |
|
unsigned char *ptr_e; |
|
unsigned char *ptr_l; |
unsigned char *registre_definitions_chainees; |
unsigned char *registre_definitions_chainees; |
unsigned char *registre_instruction_courante; |
unsigned char *registre_instruction_courante; |
unsigned char registre_interruption; |
unsigned char registre_interruption; |
|
unsigned char *tampon; |
|
|
|
unsigned long nombre_caracteres_supplementaires; |
unsigned long position_courante; |
unsigned long position_courante; |
|
|
(*s_etat_processus).erreur_execution = d_ex; |
(*s_etat_processus).erreur_execution = d_ex; |
Line 1084 instruction_str_fleche(struct_processus
|
Line 1092 instruction_str_fleche(struct_processus
|
|
|
if ((*s_objet).type == CHN) |
if ((*s_objet).type == CHN) |
{ |
{ |
|
// Comptage des caractères à protéger. |
|
|
|
drapeau45 = test_cfsf(s_etat_processus, 45); |
|
cf(s_etat_processus, 45); |
|
|
|
tampon = formateur(s_etat_processus, 0, s_objet); |
|
|
|
if (drapeau45 == d_vrai) |
|
{ |
|
sf(s_etat_processus, 45); |
|
} |
|
else |
|
{ |
|
cf(s_etat_processus, 45); |
|
} |
|
|
|
ptr_l = tampon; |
|
presence_chaine = d_faux; |
|
nombre_caracteres_supplementaires = 0; |
|
|
|
while((*ptr_l) != d_code_fin_chaine) |
|
{ |
|
if ((*ptr_l) == '"') |
|
{ |
|
presence_chaine = (presence_chaine == d_faux) ? d_vrai : d_faux; |
|
} |
|
|
|
if (presence_chaine == d_vrai) |
|
{ |
|
switch(*ptr_l) |
|
{ |
|
case '\\': |
|
case '\t': |
|
case '\b': |
|
case '\n': |
|
{ |
|
nombre_caracteres_supplementaires++; |
|
break; |
|
} |
|
} |
|
} |
|
else |
|
{ |
|
switch(*ptr_l) |
|
{ |
|
case '\n': |
|
case '\b': |
|
case '\t': |
|
{ |
|
nombre_caracteres_supplementaires--; |
|
break; |
|
} |
|
} |
|
} |
|
|
|
ptr_l++; |
|
} |
|
|
|
// Échappement des caractères et remplacement dans les chaînes |
|
// de caractères incluses. Le seul caractère protégé est le '\' |
|
// qui est doublé. |
|
|
|
if ((chaine_convertie = malloc((strlen(tampon) + |
|
nombre_caracteres_supplementaires + 1) * sizeof(unsigned char))) |
|
== NULL) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
|
return; |
|
} |
|
|
|
ptr_l = tampon; |
|
ptr_e = chaine_convertie; |
|
presence_chaine = d_faux; |
|
|
|
while((*ptr_l) != d_code_fin_chaine) |
|
{ |
|
if ((*ptr_l) == '"') |
|
{ |
|
presence_chaine = (presence_chaine == d_faux) ? d_vrai : d_faux; |
|
} |
|
|
|
(*ptr_e) = (*ptr_l); |
|
|
|
if (presence_chaine == d_vrai) |
|
{ |
|
switch(*ptr_l) |
|
{ |
|
case '\\': |
|
{ |
|
(*(++ptr_e)) = '\\'; |
|
break; |
|
} |
|
|
|
case '\t': |
|
{ |
|
(*ptr_e) = '\\'; |
|
(*(++ptr_e)) = 't'; |
|
break; |
|
} |
|
|
|
case '\b': |
|
{ |
|
(*ptr_e) = '\\'; |
|
(*(++ptr_e)) = 'b'; |
|
break; |
|
} |
|
|
|
case '\n': |
|
{ |
|
(*ptr_e) = '\\'; |
|
(*(++ptr_e)) = 'n'; |
|
break; |
|
} |
|
} |
|
} |
|
else |
|
{ |
|
switch(*ptr_l) |
|
{ |
|
case '\n': |
|
case '\b': |
|
case '\t': |
|
{ |
|
ptr_e--; |
|
break; |
|
} |
|
} |
|
} |
|
|
|
ptr_l++; |
|
ptr_e++; |
|
} |
|
|
|
(*ptr_e) = d_code_fin_chaine; |
|
|
position_courante = (*s_etat_processus).position_courante; |
position_courante = (*s_etat_processus).position_courante; |
registre_definitions_chainees = (*s_etat_processus) |
registre_definitions_chainees = (*s_etat_processus) |
.definitions_chainees; |
.definitions_chainees; |
registre_instruction_courante = (*s_etat_processus) |
registre_instruction_courante = (*s_etat_processus) |
.instruction_courante; |
.instruction_courante; |
|
(*s_etat_processus).position_courante = 0; |
|
(*s_etat_processus).definitions_chainees = chaine_convertie; |
|
free(tampon); |
|
|
(*s_etat_processus).definitions_chainees = (unsigned char *) |
if ((*s_etat_processus).definitions_chainees == NULL) |
(*s_objet).objet; |
{ |
|
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
|
return; |
|
} |
|
|
if (analyse_syntaxique(s_etat_processus) == d_absence_erreur) |
if (analyse_syntaxique(s_etat_processus) == d_absence_erreur) |
{ |
{ |
Line 1102 instruction_str_fleche(struct_processus
|
Line 1251 instruction_str_fleche(struct_processus
|
return; |
return; |
} |
} |
|
|
sprintf(commande, "<< %s >>", (unsigned char *) (*s_objet).objet); |
sprintf(commande, "<< %s >>", (*s_etat_processus) |
|
.definitions_chainees); |
(*s_etat_processus).instruction_courante = commande; |
(*s_etat_processus).instruction_courante = commande; |
|
|
recherche_type(s_etat_processus); |
recherche_type(s_etat_processus); |
|
|
if ((*s_etat_processus).erreur_execution != d_ex) |
if (((*s_etat_processus).erreur_execution != d_ex) || |
|
((*s_etat_processus).erreur_systeme != d_es)) |
{ |
{ |
liberation(s_etat_processus, s_objet); |
liberation(s_etat_processus, s_objet); |
|
|
|
free((*s_etat_processus).definitions_chainees); |
|
free((*s_etat_processus).instruction_courante); |
|
|
(*s_etat_processus).definitions_chainees = |
(*s_etat_processus).definitions_chainees = |
registre_definitions_chainees; |
registre_definitions_chainees; |
(*s_etat_processus).instruction_courante = |
(*s_etat_processus).instruction_courante = |
Line 1125 instruction_str_fleche(struct_processus
|
Line 1279 instruction_str_fleche(struct_processus
|
.l_base_pile), &s_sous_objet) == d_erreur) |
.l_base_pile), &s_sous_objet) == d_erreur) |
{ |
{ |
liberation(s_etat_processus, s_objet); |
liberation(s_etat_processus, s_objet); |
|
free((*s_etat_processus).definitions_chainees); |
|
free((*s_etat_processus).instruction_courante); |
|
|
(*s_etat_processus).definitions_chainees = |
(*s_etat_processus).definitions_chainees = |
registre_definitions_chainees; |
registre_definitions_chainees; |
Line 1143 instruction_str_fleche(struct_processus
|
Line 1299 instruction_str_fleche(struct_processus
|
|
|
if (evaluation(s_etat_processus, s_sous_objet, 'I') == d_erreur) |
if (evaluation(s_etat_processus, s_sous_objet, 'I') == d_erreur) |
{ |
{ |
|
liberation(s_etat_processus, s_sous_objet); |
|
liberation(s_etat_processus, s_objet); |
|
|
|
free((*s_etat_processus).definitions_chainees); |
|
free((*s_etat_processus).instruction_courante); |
|
|
|
(*s_etat_processus).definitions_chainees = |
|
registre_definitions_chainees; |
|
(*s_etat_processus).instruction_courante = |
|
registre_instruction_courante; |
|
(*s_etat_processus).position_courante = |
|
position_courante; |
|
|
(*s_etat_processus).traitement_interruptible = |
(*s_etat_processus).traitement_interruptible = |
registre_interruption; |
registre_interruption; |
|
|
if ((*s_etat_processus).erreur_systeme == d_es) |
if ((*s_etat_processus).erreur_systeme == d_es) |
{ |
{ |
liberation(s_etat_processus, s_objet); |
|
|
|
(*s_etat_processus).definitions_chainees = |
|
registre_definitions_chainees; |
|
(*s_etat_processus).instruction_courante = |
|
registre_instruction_courante; |
|
(*s_etat_processus).position_courante = |
|
position_courante; |
|
|
|
(*s_etat_processus).erreur_execution = |
(*s_etat_processus).erreur_execution = |
d_ex_expression_invalide; |
d_ex_expression_invalide; |
return; |
|
} |
} |
else |
else |
{ |
{ |
liberation(s_etat_processus, s_objet); |
|
|
|
(*s_etat_processus).definitions_chainees = |
|
registre_definitions_chainees; |
|
(*s_etat_processus).instruction_courante = |
|
registre_instruction_courante; |
|
(*s_etat_processus).position_courante = |
|
position_courante; |
|
|
|
(*s_etat_processus).erreur_systeme = |
(*s_etat_processus).erreur_systeme = |
d_es_allocation_memoire; |
d_es_allocation_memoire; |
return; |
|
} |
} |
} |
|
|
|
(*s_etat_processus).traitement_interruptible = |
|
registre_interruption; |
|
|
|
liberation(s_etat_processus, s_sous_objet); |
return; |
free(commande); |
} |
} |
} |
else |
else |
{ |
{ |
|
liberation(s_etat_processus, s_objet); |
|
|
|
free((*s_etat_processus).definitions_chainees); |
|
free((*s_etat_processus).instruction_courante); |
|
|
(*s_etat_processus).definitions_chainees = |
(*s_etat_processus).definitions_chainees = |
registre_definitions_chainees; |
registre_definitions_chainees; |
(*s_etat_processus).instruction_courante = |
(*s_etat_processus).instruction_courante = |
Line 1198 instruction_str_fleche(struct_processus
|
Line 1348 instruction_str_fleche(struct_processus
|
return; |
return; |
} |
} |
|
|
|
|
|
(*s_etat_processus).traitement_interruptible = |
|
registre_interruption; |
|
|
|
liberation(s_etat_processus, s_sous_objet); |
|
|
|
free((*s_etat_processus).definitions_chainees); |
|
free((*s_etat_processus).instruction_courante); |
|
|
(*s_etat_processus).definitions_chainees = |
(*s_etat_processus).definitions_chainees = |
registre_definitions_chainees; |
registre_definitions_chainees; |
(*s_etat_processus).instruction_courante = |
(*s_etat_processus).instruction_courante = |