version 1.53, 2015/01/05 13:12:37
|
version 1.74, 2024/01/09 07:33:52
|
Line 1
|
Line 1
|
/* |
/* |
================================================================================ |
================================================================================ |
RPL/2 (R) version 4.1.19 |
RPL/2 (R) version 4.1.35 |
Copyright (C) 1989-2015 Dr. BERTRAND Joël |
Copyright (C) 1989-2024 Dr. BERTRAND Joël |
|
|
This file is part of RPL/2. |
This file is part of RPL/2. |
|
|
Line 374 instruction_p_vers_r(struct_processus *s
|
Line 374 instruction_p_vers_r(struct_processus *s
|
================================================================================ |
================================================================================ |
*/ |
*/ |
|
|
|
static int |
|
fonction_comparaison(const void *argument_1, const void *argument_2) |
|
{ |
|
return(strcmp((unsigned char *) argument_1, |
|
(unsigned char *) (**((struct_objet **) argument_2)).objet)); |
|
} |
|
|
|
|
void |
void |
instruction_put(struct_processus *s_etat_processus) |
instruction_put(struct_processus *s_etat_processus) |
{ |
{ |
Line 383 instruction_put(struct_processus *s_etat
|
Line 391 instruction_put(struct_processus *s_etat
|
|
|
struct_objet *s_copie_3; |
struct_objet *s_copie_3; |
struct_objet *s_copie_4; |
struct_objet *s_copie_4; |
|
struct_objet **s_enregistrement; |
struct_objet *s_objet_1; |
struct_objet *s_objet_1; |
struct_objet *s_objet_2; |
struct_objet *s_objet_2; |
struct_objet *s_objet_3; |
struct_objet *s_objet_3; |
Line 428 instruction_put(struct_processus *s_etat
|
Line 437 instruction_put(struct_processus *s_etat
|
" %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,\n" |
" %s, %s, %s, %s,\n" |
" %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, |
d_TAB, d_BIN, d_NOM, d_CHN, d_LST, d_ALG, d_RPN, d_FCH, d_SCK, |
d_TAB, d_BIN, d_NOM, d_CHN, d_LST, d_ALG, d_RPN, d_FCH, d_SCK, |
d_SQL, d_SLB, d_PRC, d_MTX); |
d_SQL, d_SLB, d_PRC, d_MTX, d_REC); |
printf("-> 1: %s\n\n", d_LST); |
printf("-> 1: %s\n\n", d_LST); |
|
|
printf(" 3: %s\n", d_TAB); |
printf(" 3: %s\n", d_TAB); |
Line 440 instruction_put(struct_processus *s_etat
|
Line 449 instruction_put(struct_processus *s_etat
|
" %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,\n" |
" %s, %s, %s, %s,\n" |
" %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, |
d_TAB, d_BIN, d_NOM, d_CHN, d_LST, d_ALG, d_RPN, d_FCH, d_SCK, |
d_TAB, d_BIN, d_NOM, d_CHN, d_LST, d_ALG, d_RPN, d_FCH, d_SCK, |
d_SQL, d_SLB, d_PRC, d_MTX); |
d_SQL, d_SLB, d_PRC, d_MTX, d_REC); |
printf("-> 1: %s\n\n", d_TAB); |
printf("-> 1: %s\n\n", d_TAB); |
|
|
|
printf(" 3: %s\n", d_REC); |
|
printf(" 2: %s\n", d_CHN); |
|
printf(" 1: %s, %s, %s, %s, %s, %s,\n" |
|
" %s, %s, %s, %s, %s,\n" |
|
" %s, %s, %s, %s, %s,\n" |
|
" %s, %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_TAB, d_BIN, d_NOM, d_CHN, d_LST, d_ALG, d_RPN, d_FCH, d_SCK, |
|
d_SQL, d_SLB, d_PRC, d_MTX, d_REC); |
|
printf("-> 1: %s\n\n", d_REC); |
|
|
printf(" 3: %s\n", d_NOM); |
printf(" 3: %s\n", d_NOM); |
printf(" 2: %s, %s\n", d_LST, d_INT); |
printf(" 2: %s, %s\n", d_LST, d_INT); |
printf(" 1: %s, %s, %s, %s, %s, %s,\n" |
printf(" 1: %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, %s, %s,\n" |
" %s, %s, %s, %s,\n" |
" %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, |
d_TAB, d_BIN, d_NOM, d_CHN, d_LST, d_ALG, d_RPN, d_FCH, d_SCK, |
d_TAB, d_BIN, d_NOM, d_CHN, d_LST, d_ALG, d_RPN, d_FCH, d_SCK, |
d_SQL, d_SLB, d_PRC, d_MTX); |
d_SQL, d_SLB, d_PRC, d_MTX, d_REC); |
|
|
return; |
return; |
} |
} |
Line 1417 instruction_put(struct_processus *s_etat
|
Line 1438 instruction_put(struct_processus *s_etat
|
|
|
/* |
/* |
-------------------------------------------------------------------------------- |
-------------------------------------------------------------------------------- |
|
Traitement des enregistrements |
|
-------------------------------------------------------------------------------- |
|
*/ |
|
|
|
else if ((*s_objet_3).type == REC) |
|
{ |
|
if ((*s_objet_2).type != CHN) |
|
{ |
|
liberation(s_etat_processus, s_objet_1); |
|
liberation(s_etat_processus, s_objet_2); |
|
liberation(s_etat_processus, s_objet_3); |
|
|
|
(*s_etat_processus).erreur_execution = d_ex_erreur_type_argument; |
|
return; |
|
} |
|
|
|
if ((*s_objet_3).nombre_occurrences > 1) |
|
{ |
|
if ((s_copie_3 = copie_objet(s_etat_processus, s_objet_3, 'N')) |
|
== NULL) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
|
return; |
|
} |
|
|
|
liberation(s_etat_processus, s_objet_3); |
|
s_objet_3 = s_copie_3; |
|
} |
|
|
|
if ((s_enregistrement = bsearch((unsigned char *) (*s_objet_2).objet, |
|
(*((struct_tableau *) (*(*((struct_record *) |
|
(*s_objet_3).objet)).noms).objet)).elements, |
|
(size_t) (*((struct_tableau *) (*(*((struct_record *) |
|
(*s_objet_3).objet)).noms).objet)).nombre_elements, |
|
sizeof(struct_objet *), fonction_comparaison)) == NULL) |
|
{ |
|
liberation(s_etat_processus, s_objet_1); |
|
liberation(s_etat_processus, s_objet_2); |
|
liberation(s_etat_processus, s_objet_3); |
|
|
|
(*s_etat_processus).erreur_execution = d_ex_element_inexistant; |
|
return; |
|
} |
|
|
|
indice_i = s_enregistrement - (*((struct_tableau *) |
|
(*(*((struct_record *) (*s_objet_3).objet)).noms).objet)) |
|
.elements; |
|
|
|
liberation(s_etat_processus, (*((struct_tableau *) |
|
(*(*((struct_record *) (*s_objet_3).objet)).donnees).objet)) |
|
.elements[indice_i]); |
|
(*((struct_tableau *) (*(*((struct_record *) (*s_objet_3).objet)) |
|
.donnees).objet)).elements[indice_i] = s_objet_1; |
|
|
|
liberation(s_etat_processus, s_objet_2); |
|
|
|
if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile), |
|
s_objet_3) == d_erreur) |
|
{ |
|
return; |
|
} |
|
} |
|
|
|
/* |
|
-------------------------------------------------------------------------------- |
Traitement des noms |
Traitement des noms |
-------------------------------------------------------------------------------- |
-------------------------------------------------------------------------------- |
*/ |
*/ |
Line 2838 instruction_put(struct_processus *s_etat
|
Line 2924 instruction_put(struct_processus *s_etat
|
|
|
liberation(s_etat_processus, s_objet_2); |
liberation(s_etat_processus, s_objet_2); |
} |
} |
|
else if ((*s_objet_4).type == REC) |
|
{ |
|
if ((*s_objet_2).type != CHN) |
|
{ |
|
if (variable_partagee == d_vrai) |
|
{ |
|
if (pthread_mutex_unlock(&((*(*s_etat_processus) |
|
.pointeur_variable_partagee_courante).mutex)) != 0) |
|
{ |
|
(*s_etat_processus).erreur_systeme = |
|
d_es_processus; |
|
return; |
|
} |
|
} |
|
|
|
liberation(s_etat_processus, s_objet_1); |
|
liberation(s_etat_processus, s_objet_2); |
|
liberation(s_etat_processus, s_objet_3); |
|
|
|
(*s_etat_processus).erreur_execution = |
|
d_ex_erreur_type_argument; |
|
return; |
|
} |
|
|
|
if ((*s_objet_4).nombre_occurrences > 1) |
|
{ |
|
if ((s_copie_4 = copie_objet(s_etat_processus, s_objet_3, 'N')) |
|
== NULL) |
|
{ |
|
if (variable_partagee == d_vrai) |
|
{ |
|
if (pthread_mutex_unlock(&((*(*s_etat_processus) |
|
.pointeur_variable_partagee_courante).mutex)) |
|
!= 0) |
|
{ |
|
(*s_etat_processus).erreur_systeme = |
|
d_es_processus; |
|
return; |
|
} |
|
} |
|
|
|
(*s_etat_processus).erreur_systeme = |
|
d_es_allocation_memoire; |
|
return; |
|
} |
|
|
|
liberation(s_etat_processus, s_objet_4); |
|
s_objet_4 = s_copie_4; |
|
} |
|
|
|
if ((s_enregistrement = bsearch( |
|
(unsigned char *) (*s_objet_2).objet, |
|
(*((struct_tableau *) (*(*((struct_record *) |
|
(*s_objet_4).objet)).noms).objet)).elements, |
|
(size_t) (*((struct_tableau *) (*(*((struct_record *) |
|
(*s_objet_4).objet)).noms).objet)).nombre_elements, |
|
sizeof(struct_objet *), fonction_comparaison)) == NULL) |
|
{ |
|
if (variable_partagee == d_vrai) |
|
{ |
|
if (pthread_mutex_unlock(&((*(*s_etat_processus) |
|
.pointeur_variable_partagee_courante).mutex)) |
|
!= 0) |
|
{ |
|
(*s_etat_processus).erreur_systeme = |
|
d_es_processus; |
|
return; |
|
} |
|
} |
|
|
|
liberation(s_etat_processus, s_objet_1); |
|
liberation(s_etat_processus, s_objet_2); |
|
liberation(s_etat_processus, s_objet_3); |
|
|
|
(*s_etat_processus).erreur_execution = d_ex_element_inexistant; |
|
return; |
|
} |
|
|
|
indice_i = s_enregistrement - (*((struct_tableau *) |
|
(*(*((struct_record *) (*s_objet_4).objet)).noms).objet)) |
|
.elements; |
|
|
|
liberation(s_etat_processus, (*((struct_tableau *) |
|
(*(*((struct_record *) (*s_objet_4).objet)).donnees).objet)) |
|
.elements[indice_i]); |
|
(*((struct_tableau *) (*(*((struct_record *) (*s_objet_4).objet)) |
|
.donnees).objet)).elements[indice_i] = s_objet_1; |
|
|
|
if (variable_partagee == d_faux) |
|
{ |
|
(*(*s_etat_processus).pointeur_variable_courante).objet = |
|
s_objet_4; |
|
} |
|
else |
|
{ |
|
(*(*s_etat_processus).pointeur_variable_courante).objet = NULL; |
|
(*(*s_etat_processus).pointeur_variable_partagee_courante) |
|
.objet = s_objet_4; |
|
|
|
if (pthread_mutex_unlock(&((*(*s_etat_processus) |
|
.pointeur_variable_partagee_courante).mutex)) != 0) |
|
{ |
|
(*s_etat_processus).erreur_systeme = |
|
d_es_processus; |
|
return; |
|
} |
|
} |
|
|
|
liberation(s_etat_processus, s_objet_2); |
|
} |
else |
else |
{ |
{ |
if (variable_partagee == d_vrai) |
if (variable_partagee == d_vrai) |
Line 2949 instruction_puti(struct_processus *s_eta
|
Line 3145 instruction_puti(struct_processus *s_eta
|
" %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,\n" |
" %s, %s, %s, %s,\n" |
" %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, |
d_TAB, d_BIN, d_NOM, d_CHN, d_LST, d_ALG, d_RPN, d_FCH, d_SCK, |
d_TAB, d_BIN, d_NOM, d_CHN, d_LST, d_ALG, d_RPN, d_FCH, d_SCK, |
d_SQL, d_SLB, d_PRC, d_MTX); |
d_SQL, d_SLB, d_PRC, d_MTX, d_REC); |
printf("-> 2: %s, %s\n", d_LST, d_NOM); |
printf("-> 2: %s, %s\n", d_LST, d_NOM); |
printf(" 1: %s\n", d_INT); |
printf(" 1: %s\n", d_INT); |
|
|