version 1.41, 2012/12/18 13:19:38
|
version 1.78, 2025/04/15 10:17:56
|
Line 1
|
Line 1
|
/* |
/* |
================================================================================ |
================================================================================ |
RPL/2 (R) version 4.1.12 |
RPL/2 (R) version 4.1.36 |
Copyright (C) 1989-2012 Dr. BERTRAND Joël |
Copyright (C) 1989-2025 Dr. BERTRAND Joël |
|
|
This file is part of RPL/2. |
This file is part of RPL/2. |
|
|
Line 38
|
Line 38
|
void |
void |
instruction_trnc(struct_processus *s_etat_processus) |
instruction_trnc(struct_processus *s_etat_processus) |
{ |
{ |
int parametre; |
integer8 parametre; |
|
|
logical1 i43; |
logical1 i43; |
logical1 i44; |
logical1 i44; |
logical1 i49; |
logical1 i49; |
logical1 i50; |
logical1 i50; |
logical1 i53; |
logical1 i53; |
logical1 i54; |
logical1 i54; |
logical1 i55; |
logical1 i55; |
logical1 i56; |
logical1 i56; |
|
|
struct_objet *s_objet_argument_1; |
struct_objet *s_objet_argument_1; |
struct_objet *s_objet_argument_2; |
struct_objet *s_objet_argument_2; |
struct_objet *s_objet_parametre; |
struct_objet *s_objet_parametre; |
|
|
unsigned char *instruction_courante; |
unsigned char *instruction_courante; |
unsigned char *valeur_binaire; |
unsigned char *valeur_binaire; |
|
|
unsigned long i; |
unsigned long i; |
unsigned long j; |
unsigned long j; |
|
|
(*s_etat_processus).erreur_execution = d_ex; |
(*s_etat_processus).erreur_execution = d_ex; |
|
|
if ((*s_etat_processus).affichage_arguments == 'Y') |
if ((*s_etat_processus).affichage_arguments == 'Y') |
{ |
{ |
printf("\n TRNC "); |
printf("\n TRNC "); |
|
|
if ((*s_etat_processus).langue == 'F') |
if ((*s_etat_processus).langue == 'F') |
{ |
{ |
printf("(troncature)\n\n"); |
printf("(troncature)\n\n"); |
} |
} |
else |
else |
{ |
{ |
printf("(truncation)\n\n"); |
printf("(truncation)\n\n"); |
} |
} |
|
|
printf(" 2: %s, %s, %s, %s, %s, %s,\n" |
printf(" 2: %s, %s, %s, %s, %s, %s,\n" |
" %s, %s, %s\n", |
" %s, %s, %s\n", |
d_INT, d_REL, d_CPL, d_VIN, d_VRL, d_VCX, d_MIN, d_MRL, d_MCX); |
d_INT, d_REL, d_CPL, d_VIN, d_VRL, d_VCX, d_MIN, d_MRL, d_MCX); |
printf(" 1: %s\n", d_INT); |
printf(" 1: %s\n", d_INT); |
printf("-> 1: %s, %s, %s, %s, %s, %s,\n" |
printf("-> 1: %s, %s, %s, %s, %s, %s,\n" |
" %s, %s, %s\n", |
" %s, %s, %s\n", |
d_INT, d_REL, d_CPL, d_VIN, d_VRL, d_VCX, d_MIN, d_MRL, d_MCX); |
d_INT, d_REL, d_CPL, d_VIN, d_VRL, d_VCX, d_MIN, d_MRL, d_MCX); |
|
|
return; |
return; |
} |
} |
else if ((*s_etat_processus).test_instruction == 'Y') |
else if ((*s_etat_processus).test_instruction == 'Y') |
{ |
{ |
(*s_etat_processus).nombre_arguments = -1; |
(*s_etat_processus).nombre_arguments = -1; |
return; |
return; |
} |
} |
|
|
if (test_cfsf(s_etat_processus, 31) == d_vrai) |
if (test_cfsf(s_etat_processus, 31) == d_vrai) |
{ |
{ |
if (empilement_pile_last(s_etat_processus, 2) == d_erreur) |
if (empilement_pile_last(s_etat_processus, 2) == d_erreur) |
{ |
{ |
return; |
return; |
} |
} |
} |
} |
|
|
if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile), |
if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile), |
&s_objet_argument_1) == d_erreur) |
&s_objet_argument_1) == d_erreur) |
{ |
{ |
(*s_etat_processus).erreur_execution = d_ex_manque_argument; |
(*s_etat_processus).erreur_execution = d_ex_manque_argument; |
return; |
return; |
} |
} |
|
|
if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile), |
if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile), |
&s_objet_argument_2) == d_erreur) |
&s_objet_argument_2) == d_erreur) |
{ |
{ |
liberation(s_etat_processus, s_objet_argument_1); |
liberation(s_etat_processus, s_objet_argument_1); |
|
|
(*s_etat_processus).erreur_execution = d_ex_manque_argument; |
(*s_etat_processus).erreur_execution = d_ex_manque_argument; |
return; |
return; |
} |
} |
|
|
if (((*s_objet_argument_1).type == INT) && |
if (((*s_objet_argument_1).type == INT) && |
(((*s_objet_argument_2).type == INT) || |
(((*s_objet_argument_2).type == INT) || |
((*s_objet_argument_2).type == REL) || |
((*s_objet_argument_2).type == REL) || |
((*s_objet_argument_2).type == CPL) || |
((*s_objet_argument_2).type == CPL) || |
((*s_objet_argument_2).type == VIN) || |
((*s_objet_argument_2).type == VIN) || |
((*s_objet_argument_2).type == VRL) || |
((*s_objet_argument_2).type == VRL) || |
((*s_objet_argument_2).type == VCX) || |
((*s_objet_argument_2).type == VCX) || |
((*s_objet_argument_2).type == MIN) || |
((*s_objet_argument_2).type == MIN) || |
((*s_objet_argument_2).type == MRL) || |
((*s_objet_argument_2).type == MRL) || |
((*s_objet_argument_2).type == MCX))) |
((*s_objet_argument_2).type == MCX))) |
{ |
{ |
parametre = (*((integer8 *) (*s_objet_argument_1).objet)); |
parametre = (*((integer8 *) (*s_objet_argument_1).objet)); |
|
|
if ((parametre >= -15) && (parametre <= 15)) |
if ((parametre >= -15) && (parametre <= 15)) |
{ |
{ |
if ((s_objet_parametre = allocation(s_etat_processus, BIN)) |
if ((s_objet_parametre = allocation(s_etat_processus, BIN)) |
== NULL) |
== NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
return; |
return; |
} |
} |
|
|
(*((integer8 *) (*s_objet_parametre).objet)) = |
(*((integer8 *) (*s_objet_parametre).objet)) = |
abs((*((integer8 *) (*s_objet_argument_1).objet))); |
abs((*((integer8 *) (*s_objet_argument_1).objet))); |
|
|
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); |
|
|
sf(s_etat_processus, 44); |
sf(s_etat_processus, 44); |
cf(s_etat_processus, 43); |
cf(s_etat_processus, 43); |
|
|
if ((valeur_binaire = formateur(s_etat_processus, 0, |
if ((valeur_binaire = formateur(s_etat_processus, 0, |
s_objet_parametre)) == NULL) |
s_objet_parametre)) == NULL) |
{ |
{ |
liberation(s_etat_processus, s_objet_parametre); |
liberation(s_etat_processus, s_objet_parametre); |
|
|
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
return; |
return; |
} |
} |
|
|
liberation(s_etat_processus, s_objet_parametre); |
liberation(s_etat_processus, s_objet_parametre); |
|
|
if (i43 == d_vrai) |
if (i43 == d_vrai) |
{ |
{ |
sf(s_etat_processus, 43); |
sf(s_etat_processus, 43); |
} |
} |
else |
else |
{ |
{ |
cf(s_etat_processus, 43); |
cf(s_etat_processus, 43); |
} |
} |
|
|
if (i44 == d_vrai) |
if (i44 == d_vrai) |
{ |
{ |
sf(s_etat_processus, 44); |
sf(s_etat_processus, 44); |
} |
} |
else |
else |
{ |
{ |
cf(s_etat_processus, 44); |
cf(s_etat_processus, 44); |
} |
} |
|
|
i53 = test_cfsf(s_etat_processus, 53); |
i53 = test_cfsf(s_etat_processus, 53); |
i54 = test_cfsf(s_etat_processus, 54); |
i54 = test_cfsf(s_etat_processus, 54); |
i55 = test_cfsf(s_etat_processus, 55); |
i55 = test_cfsf(s_etat_processus, 55); |
i56 = test_cfsf(s_etat_processus, 56); |
i56 = test_cfsf(s_etat_processus, 56); |
|
|
for(j = 53, i = strlen(valeur_binaire) - 2; i >= 2; i--) |
for(j = 53, i = strlen(valeur_binaire) - 2; i >= 2; i--) |
{ |
{ |
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 <= 56; cf(s_etat_processus, j++)); |
for(; j <= 56; cf(s_etat_processus, (unsigned char) j++)); |
|
|
free(valeur_binaire); |
free(valeur_binaire); |
|
|
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); |
|
|
if (parametre >= 0) |
if (parametre >= 0) |
{ |
{ |
// Troncature FIX |
// Troncature FIX |
sf(s_etat_processus, 49); |
sf(s_etat_processus, 49); |
cf(s_etat_processus, 50); |
cf(s_etat_processus, 50); |
} |
} |
else |
else |
{ |
{ |
// Troncature SCI |
// Troncature SCI |
cf(s_etat_processus, 49); |
cf(s_etat_processus, 49); |
sf(s_etat_processus, 50); |
sf(s_etat_processus, 50); |
} |
} |
|
|
instruction_courante = (*s_etat_processus).instruction_courante; |
instruction_courante = (*s_etat_processus).instruction_courante; |
|
|
if (((*s_etat_processus).instruction_courante = |
if (((*s_etat_processus).instruction_courante = |
formateur(s_etat_processus, 0, s_objet_argument_2)) == NULL) |
formateur(s_etat_processus, 0, s_objet_argument_2)) == NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).instruction_courante = instruction_courante; |
(*s_etat_processus).instruction_courante = instruction_courante; |
return; |
return; |
} |
} |
|
|
if (i49 == d_vrai) |
if (i49 == d_vrai) |
{ |
{ |
sf(s_etat_processus, 49); |
sf(s_etat_processus, 49); |
} |
} |
else |
else |
{ |
{ |
cf(s_etat_processus, 49); |
cf(s_etat_processus, 49); |
} |
} |
|
|
if (i50 == d_vrai) |
if (i50 == d_vrai) |
{ |
{ |
sf(s_etat_processus, 50); |
sf(s_etat_processus, 50); |
} |
} |
else |
else |
{ |
{ |
cf(s_etat_processus, 50); |
cf(s_etat_processus, 50); |
} |
} |
|
|
if (i53 == d_vrai) |
if (i53 == d_vrai) |
{ |
{ |
sf(s_etat_processus, 53); |
sf(s_etat_processus, 53); |
} |
} |
else |
else |
{ |
{ |
cf(s_etat_processus, 53); |
cf(s_etat_processus, 53); |
} |
} |
|
|
if (i54 == d_vrai) |
if (i54 == d_vrai) |
{ |
{ |
sf(s_etat_processus, 54); |
sf(s_etat_processus, 54); |
} |
} |
else |
else |
{ |
{ |
cf(s_etat_processus, 54); |
cf(s_etat_processus, 54); |
} |
} |
|
|
if (i55 == d_vrai) |
if (i55 == d_vrai) |
{ |
{ |
sf(s_etat_processus, 55); |
sf(s_etat_processus, 55); |
} |
} |
else |
else |
{ |
{ |
cf(s_etat_processus, 55); |
cf(s_etat_processus, 55); |
} |
} |
|
|
if (i56 == d_vrai) |
if (i56 == d_vrai) |
{ |
{ |
sf(s_etat_processus, 56); |
sf(s_etat_processus, 56); |
} |
} |
else |
else |
{ |
{ |
cf(s_etat_processus, 56); |
cf(s_etat_processus, 56); |
} |
} |
|
|
recherche_type(s_etat_processus); |
(*s_etat_processus).type_en_cours = NON; |
|
recherche_type(s_etat_processus); |
free((*s_etat_processus).instruction_courante); |
|
(*s_etat_processus).instruction_courante = instruction_courante; |
free((*s_etat_processus).instruction_courante); |
|
(*s_etat_processus).instruction_courante = instruction_courante; |
if ((*s_etat_processus).erreur_systeme != d_es) |
|
{ |
if ((*s_etat_processus).erreur_systeme != d_es) |
return; |
{ |
} |
return; |
|
} |
if ((*s_etat_processus).erreur_execution != d_ex) |
|
{ |
if ((*s_etat_processus).erreur_execution != d_ex) |
liberation(s_etat_processus, s_objet_argument_1); |
{ |
liberation(s_etat_processus, s_objet_argument_2); |
liberation(s_etat_processus, s_objet_argument_1); |
return; |
liberation(s_etat_processus, s_objet_argument_2); |
} |
return; |
} |
} |
else |
} |
{ |
else |
liberation(s_etat_processus, s_objet_argument_1); |
{ |
liberation(s_etat_processus, s_objet_argument_2); |
liberation(s_etat_processus, s_objet_argument_1); |
|
liberation(s_etat_processus, s_objet_argument_2); |
(*s_etat_processus).erreur_execution = d_ex_argument_invalide; |
|
return; |
(*s_etat_processus).erreur_execution = d_ex_argument_invalide; |
} |
return; |
} |
} |
|
} |
|
|
/* |
/* |
-------------------------------------------------------------------------------- |
-------------------------------------------------------------------------------- |
Line 308 instruction_trnc(struct_processus *s_eta
|
Line 309 instruction_trnc(struct_processus *s_eta
|
-------------------------------------------------------------------------------- |
-------------------------------------------------------------------------------- |
*/ |
*/ |
|
|
else |
else |
{ |
{ |
liberation(s_etat_processus, s_objet_argument_1); |
liberation(s_etat_processus, s_objet_argument_1); |
liberation(s_etat_processus, s_objet_argument_2); |
liberation(s_etat_processus, s_objet_argument_2); |
|
|
(*s_etat_processus).erreur_execution = d_ex_erreur_type_argument; |
|
return; |
|
} |
|
|
|
liberation(s_etat_processus, s_objet_argument_1); |
(*s_etat_processus).erreur_execution = d_ex_erreur_type_argument; |
liberation(s_etat_processus, s_objet_argument_2); |
return; |
|
} |
|
|
|
liberation(s_etat_processus, s_objet_argument_1); |
|
liberation(s_etat_processus, s_objet_argument_2); |
|
|
return; |
return; |
} |
} |
|
|
|
|
Line 342 instruction_table_fleche(struct_processu
|
Line 343 instruction_table_fleche(struct_processu
|
struct_objet *s_objet; |
struct_objet *s_objet; |
struct_objet *s_objet_resultat; |
struct_objet *s_objet_resultat; |
|
|
unsigned long i; |
unsigned char *registre_instruction_courante; |
|
unsigned char registre_instruction_valide; |
|
unsigned char registre_test; |
|
|
|
integer8 i; |
|
|
(*s_etat_processus).erreur_execution = d_ex; |
(*s_etat_processus).erreur_execution = d_ex; |
|
|
Line 361 instruction_table_fleche(struct_processu
|
Line 366 instruction_table_fleche(struct_processu
|
|
|
printf(" 1: %s\n", d_TAB); |
printf(" 1: %s\n", d_TAB); |
printf("-> n: %s, %s, %s, %s, %s, %s,\n" |
printf("-> n: %s, %s, %s, %s, %s, %s,\n" |
" %s, %s, %s, %s, %s,\n" |
" %s, %s, %s, %s, %s,\n" |
" %s, %s, %s, %s, %s,\n" |
" %s, %s, %s, %s, %s,\n" |
" %s, %s\n", |
" %s, %s\n", |
d_INT, d_REL, d_CPL, d_VIN, d_VRL, d_VCX, d_MIN, d_MRL, d_MCX, |
d_INT, d_REL, d_CPL, d_VIN, d_VRL, d_VCX, d_MIN, d_MRL, d_MCX, |
d_TAB, d_BIN, d_NOM, d_CHN, d_LST, d_ALG, d_RPN, d_FCH, d_SLB); |
d_TAB, d_BIN, d_NOM, d_CHN, d_LST, d_ALG, d_RPN, d_FCH, d_SLB); |
printf(" ...\n"); |
printf(" ...\n"); |
printf(" 2: %s, %s, %s, %s, %s, %s,\n" |
printf(" 2: %s, %s, %s, %s, %s, %s,\n" |
" %s, %s, %s, %s, %s,\n" |
" %s, %s, %s, %s, %s,\n" |
" %s, %s, %s, %s, %s,\n" |
" %s, %s, %s, %s, %s,\n" |
" %s, %s\n", |
" %s, %s\n", |
d_INT, d_REL, d_CPL, d_VIN, d_VRL, d_VCX, d_MIN, d_MRL, d_MCX, |
d_INT, d_REL, d_CPL, d_VIN, d_VRL, d_VCX, d_MIN, d_MRL, d_MCX, |
d_TAB, d_BIN, d_NOM, d_CHN, d_LST, d_ALG, d_RPN, d_FCH, d_SLB); |
d_TAB, d_BIN, d_NOM, d_CHN, d_LST, d_ALG, d_RPN, d_FCH, d_SLB); |
printf(" 1: %s\n", d_INT); |
printf(" 1: %s\n", d_INT); |
Line 416 instruction_table_fleche(struct_processu
|
Line 421 instruction_table_fleche(struct_processu
|
return; |
return; |
} |
} |
|
|
if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile), |
if ((*((*((struct_tableau *) (*s_objet).objet)).elements[i])).type |
(*((struct_tableau *) (*s_objet).objet)).elements[i]) |
!= FCT) |
== d_erreur) |
|
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile), |
return; |
(*((struct_tableau *) (*s_objet).objet)).elements[i]) |
|
== d_erreur) |
|
{ |
|
return; |
|
} |
|
} |
|
else |
|
{ |
|
registre_test = (*s_etat_processus).test_instruction; |
|
registre_instruction_courante = (*s_etat_processus) |
|
.instruction_courante; |
|
registre_instruction_valide = (*s_etat_processus) |
|
.instruction_valide; |
|
|
|
(*s_etat_processus).test_instruction = 'Y'; |
|
(*s_etat_processus).instruction_courante = |
|
(*((struct_fonction *) (*((struct_tableau *) |
|
(*s_objet).objet)).elements[i])).nom_fonction; |
|
|
|
analyse(s_etat_processus, NULL); |
|
|
|
(*s_etat_processus).test_instruction = registre_test; |
|
(*s_etat_processus).instruction_courante = |
|
registre_instruction_courante; |
|
|
|
if (((*s_etat_processus).instruction_valide == 'Y') && |
|
(*s_etat_processus).constante_symbolique == 'Y') |
|
{ |
|
if (evaluation(s_etat_processus, (*((struct_tableau *) |
|
(*s_objet).objet)).elements[i], 'E') == d_erreur) |
|
{ |
|
(*s_etat_processus).instruction_valide = |
|
registre_instruction_valide; |
|
return; |
|
} |
|
} |
|
else |
|
{ |
|
if (empilement(s_etat_processus, &((*s_etat_processus) |
|
.l_base_pile), (*((struct_tableau *) (*s_objet).objet)) |
|
.elements[i]) == d_erreur) |
|
{ |
|
(*s_etat_processus).instruction_valide = |
|
registre_instruction_valide; |
|
return; |
|
} |
|
} |
|
|
|
(*s_etat_processus).instruction_valide = |
|
registre_instruction_valide; |
} |
} |
} |
} |
|
|
Line 462 instruction_table_fleche(struct_processu
|
Line 515 instruction_table_fleche(struct_processu
|
void |
void |
instruction_trim(struct_processus *s_etat_processus) |
instruction_trim(struct_processus *s_etat_processus) |
{ |
{ |
struct_objet *s_objet_argument; |
struct_objet *s_objet_argument; |
struct_objet *s_objet_resultat; |
struct_objet *s_objet_resultat; |
|
|
unsigned char *debut; |
unsigned char *debut; |
unsigned char *fin; |
unsigned char *fin; |
|
|
(*s_etat_processus).erreur_execution = d_ex; |
(*s_etat_processus).erreur_execution = d_ex; |
|
|
|
if ((*s_etat_processus).affichage_arguments == 'Y') |
|
{ |
|
printf("\n TRIM "); |
|
|
if ((*s_etat_processus).affichage_arguments == 'Y') |
if ((*s_etat_processus).langue == 'F') |
{ |
{ |
printf("\n TRIM "); |
printf("(suppression des espaces initiaux et finaux d'une " |
|
|
if ((*s_etat_processus).langue == 'F') |
|
{ |
|
printf("(suppression des espaces initiaux et finaux d'une " |
|
"chaîne)\n\n"); |
"chaîne)\n\n"); |
} |
} |
else |
else |
{ |
{ |
printf("(delete initial and final spaces from string)\n\n"); |
printf("(delete initial and final spaces from string)\n\n"); |
} |
} |
|
|
printf(" 1: %s\n", d_CHN); |
printf(" 1: %s\n", d_CHN); |
printf("-> 1: %s\n", d_CHN); |
printf("-> 1: %s\n", d_CHN); |
|
|
return; |
return; |
} |
} |
else if ((*s_etat_processus).test_instruction == 'Y') |
else if ((*s_etat_processus).test_instruction == 'Y') |
{ |
{ |
(*s_etat_processus).nombre_arguments = -1; |
(*s_etat_processus).nombre_arguments = -1; |
return; |
return; |
} |
} |
|
|
if (test_cfsf(s_etat_processus, 31) == d_vrai) |
if (test_cfsf(s_etat_processus, 31) == d_vrai) |
{ |
{ |
if (empilement_pile_last(s_etat_processus, 1) == d_erreur) |
if (empilement_pile_last(s_etat_processus, 1) == d_erreur) |
{ |
{ |
return; |
return; |
} |
} |
} |
} |
|
|
if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile), |
|
&s_objet_argument) == d_erreur) |
|
{ |
|
(*s_etat_processus).erreur_execution = d_ex_manque_argument; |
|
return; |
|
} |
|
|
|
if ((*s_objet_argument).type == CHN) |
if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile), |
{ |
&s_objet_argument) == d_erreur) |
|
{ |
|
(*s_etat_processus).erreur_execution = d_ex_manque_argument; |
|
return; |
|
} |
|
|
|
if ((*s_objet_argument).type == CHN) |
|
{ |
debut = (unsigned char *) (*s_objet_argument).objet; |
debut = (unsigned char *) (*s_objet_argument).objet; |
|
|
while(((*debut) != d_code_fin_chaine) && |
while(((*debut) != d_code_fin_chaine) && |
Line 541 instruction_trim(struct_processus *s_eta
|
Line 594 instruction_trim(struct_processus *s_eta
|
return; |
return; |
} |
} |
|
|
if (((*s_objet_resultat).objet = malloc((1 + fin - debut) |
if (((*s_objet_resultat).objet = malloc(((size_t) (1 + fin - debut)) |
* 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 549 instruction_trim(struct_processus *s_eta
|
Line 602 instruction_trim(struct_processus *s_eta
|
} |
} |
|
|
strcpy((unsigned char *) (*s_objet_resultat).objet, debut); |
strcpy((unsigned char *) (*s_objet_resultat).objet, debut); |
} |
} |
|
|
/* |
/* |
-------------------------------------------------------------------------------- |
-------------------------------------------------------------------------------- |
Line 557 instruction_trim(struct_processus *s_eta
|
Line 610 instruction_trim(struct_processus *s_eta
|
-------------------------------------------------------------------------------- |
-------------------------------------------------------------------------------- |
*/ |
*/ |
|
|
else |
else |
{ |
{ |
liberation(s_etat_processus, s_objet_argument); |
liberation(s_etat_processus, s_objet_argument); |
|
|
(*s_etat_processus).erreur_execution = d_ex_erreur_type_argument; |
(*s_etat_processus).erreur_execution = d_ex_erreur_type_argument; |
return; |
return; |
} |
} |
|
|
if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile), |
if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile), |
s_objet_resultat) == d_erreur) |
s_objet_resultat) == d_erreur) |
Line 571 instruction_trim(struct_processus *s_eta
|
Line 624 instruction_trim(struct_processus *s_eta
|
return; |
return; |
} |
} |
|
|
liberation(s_etat_processus, s_objet_argument); |
liberation(s_etat_processus, s_objet_argument); |
|
|
return; |
return; |
} |
} |
|
|
|
|
Line 592 instruction_trim(struct_processus *s_eta
|
Line 645 instruction_trim(struct_processus *s_eta
|
void |
void |
instruction_tokenize(struct_processus *s_etat_processus) |
instruction_tokenize(struct_processus *s_etat_processus) |
{ |
{ |
struct_objet *s_objet_argument; |
struct_objet *s_objet_argument; |
struct_objet *s_objet_resultat; |
struct_objet *s_objet_resultat; |
|
|
struct_liste_chainee *l_element_courant; |
struct_liste_chainee *l_element_courant; |
|
|
Line 602 instruction_tokenize(struct_processus *s
|
Line 655 instruction_tokenize(struct_processus *s
|
unsigned char *registre_instruction_courante; |
unsigned char *registre_instruction_courante; |
unsigned char *registre_definitions_chainees; |
unsigned char *registre_definitions_chainees; |
unsigned char *tampon; |
unsigned char *tampon; |
|
unsigned char *tampon2; |
|
|
|
integer8 nombre_caracteres_echappement; |
|
integer8 registre_longueur_definitions_chainees; |
|
integer8 registre_position_courante; |
|
|
|
(*s_etat_processus).erreur_execution = d_ex; |
|
|
|
if ((*s_etat_processus).affichage_arguments == 'Y') |
|
{ |
|
printf("\n TOKENIZE "); |
|
|
|
if ((*s_etat_processus).langue == 'F') |
|
{ |
|
printf("(extraction d'objets en sous-chaînes)\n\n"); |
|
} |
|
else |
|
{ |
|
printf("(extract objects in substrings)\n\n"); |
|
} |
|
|
|
printf(" 1: %s\n", d_CHN); |
|
printf("-> 1: %s\n", d_LST); |
|
|
|
return; |
|
} |
|
else if ((*s_etat_processus).test_instruction == 'Y') |
|
{ |
|
(*s_etat_processus).nombre_arguments = -1; |
|
return; |
|
} |
|
|
unsigned long nombre_caracteres_echappement; |
if (test_cfsf(s_etat_processus, 31) == d_vrai) |
unsigned long registre_longueur_definitions_chainees; |
{ |
unsigned long registre_position_courante; |
if (empilement_pile_last(s_etat_processus, 1) == d_erreur) |
|
{ |
(*s_etat_processus).erreur_execution = d_ex; |
return; |
|
} |
if ((*s_etat_processus).affichage_arguments == 'Y') |
} |
{ |
|
printf("\n TOKENIZE "); |
if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile), |
|
&s_objet_argument) == d_erreur) |
if ((*s_etat_processus).langue == 'F') |
{ |
{ |
(*s_etat_processus).erreur_execution = d_ex_manque_argument; |
printf("(extraction d'objets en sous-chaînes)\n\n"); |
return; |
} |
} |
else |
|
{ |
|
printf("(extract objects in substrings)\n\n"); |
|
} |
|
|
|
printf(" 1: %s\n", d_CHN); |
|
printf("-> 1: %s\n", d_LST); |
|
|
|
return; |
|
} |
|
else if ((*s_etat_processus).test_instruction == 'Y') |
|
{ |
|
(*s_etat_processus).nombre_arguments = -1; |
|
return; |
|
} |
|
|
|
if (test_cfsf(s_etat_processus, 31) == d_vrai) |
|
{ |
|
if (empilement_pile_last(s_etat_processus, 1) == d_erreur) |
|
{ |
|
return; |
|
} |
|
} |
|
|
|
if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile), |
|
&s_objet_argument) == d_erreur) |
|
{ |
|
(*s_etat_processus).erreur_execution = d_ex_manque_argument; |
|
return; |
|
} |
|
|
|
if ((*s_objet_argument).type == CHN) |
if ((*s_objet_argument).type == CHN) |
{ |
{ |
// Conversion des caractères d'échappement |
// Conversion des caractères d'échappement |
|
|
ptr = (unsigned char *) (*s_objet_argument).objet; |
if ((tampon2 = malloc((strlen((*s_objet_argument).objet) + 1) * |
|
sizeof(unsigned char))) == NULL) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
|
return; |
|
} |
|
|
|
strcpy(tampon2, (*s_objet_argument).objet); |
|
ptr = tampon2; |
ptr2 = ptr; |
ptr2 = ptr; |
|
|
while((*ptr) != d_code_fin_chaine) |
while((*ptr) != d_code_fin_chaine) |
Line 706 instruction_tokenize(struct_processus *s
|
Line 768 instruction_tokenize(struct_processus *s
|
// Remplacement des éventuels retours à la ligne et tabulations par |
// Remplacement des éventuels retours à la ligne et tabulations par |
// des espaces. |
// des espaces. |
|
|
ptr = (unsigned char *) (*s_objet_argument).objet; |
ptr = tampon2; |
|
|
while((*ptr) != d_code_fin_chaine) |
while((*ptr) != d_code_fin_chaine) |
{ |
{ |
Line 733 instruction_tokenize(struct_processus *s
|
Line 795 instruction_tokenize(struct_processus *s
|
.longueur_definitions_chainees; |
.longueur_definitions_chainees; |
registre_position_courante = (*s_etat_processus).position_courante; |
registre_position_courante = (*s_etat_processus).position_courante; |
|
|
(*s_etat_processus).definitions_chainees = (unsigned char *) |
(*s_etat_processus).definitions_chainees = tampon2; |
(*s_objet_argument).objet; |
|
(*s_etat_processus).longueur_definitions_chainees = |
(*s_etat_processus).longueur_definitions_chainees = |
strlen((*s_etat_processus).definitions_chainees); |
(integer8) strlen((*s_etat_processus).definitions_chainees); |
(*s_etat_processus).position_courante = 0; |
(*s_etat_processus).position_courante = 0; |
|
|
l_element_courant = NULL; |
l_element_courant = NULL; |
Line 757 instruction_tokenize(struct_processus *s
|
Line 818 instruction_tokenize(struct_processus *s
|
(*s_etat_processus).position_courante = |
(*s_etat_processus).position_courante = |
registre_position_courante; |
registre_position_courante; |
|
|
|
free(tampon2); |
|
|
liberation(s_etat_processus, s_objet_argument); |
liberation(s_etat_processus, s_objet_argument); |
liberation(s_etat_processus, s_objet_resultat); |
liberation(s_etat_processus, s_objet_resultat); |
|
|
Line 826 instruction_tokenize(struct_processus *s
|
Line 889 instruction_tokenize(struct_processus *s
|
.donnee).objet; |
.donnee).objet; |
|
|
if (((*(*l_element_courant).donnee).objet = malloc( |
if (((*(*l_element_courant).donnee).objet = malloc( |
(strlen(tampon) + 1 + nombre_caracteres_echappement) |
(strlen(tampon) + 1 + |
|
((size_t) nombre_caracteres_echappement)) |
* sizeof(unsigned char))) == NULL) |
* sizeof(unsigned char))) == NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = |
(*s_etat_processus).erreur_systeme = |
Line 869 instruction_tokenize(struct_processus *s
|
Line 933 instruction_tokenize(struct_processus *s
|
(*s_etat_processus).longueur_definitions_chainees = |
(*s_etat_processus).longueur_definitions_chainees = |
registre_longueur_definitions_chainees; |
registre_longueur_definitions_chainees; |
(*s_etat_processus).position_courante = registre_position_courante; |
(*s_etat_processus).position_courante = registre_position_courante; |
} |
|
|
free(tampon2); |
|
} |
|
|
/* |
/* |
-------------------------------------------------------------------------------- |
-------------------------------------------------------------------------------- |
Line 877 instruction_tokenize(struct_processus *s
|
Line 943 instruction_tokenize(struct_processus *s
|
-------------------------------------------------------------------------------- |
-------------------------------------------------------------------------------- |
*/ |
*/ |
|
|
else |
else |
{ |
{ |
liberation(s_etat_processus, s_objet_argument); |
liberation(s_etat_processus, s_objet_argument); |
|
|
(*s_etat_processus).erreur_execution = d_ex_erreur_type_argument; |
(*s_etat_processus).erreur_execution = d_ex_erreur_type_argument; |
return; |
return; |
} |
} |
|
|
if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile), |
if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile), |
s_objet_resultat) == d_erreur) |
s_objet_resultat) == d_erreur) |
Line 891 instruction_tokenize(struct_processus *s
|
Line 957 instruction_tokenize(struct_processus *s
|
return; |
return; |
} |
} |
|
|
liberation(s_etat_processus, s_objet_argument); |
liberation(s_etat_processus, s_objet_argument); |
|
return; |
return; |
|
} |
} |
|
|
|
|