version 1.1.1.1, 2010/01/26 15:22:45
|
version 1.23, 2011/06/21 07:45:24
|
Line 1
|
Line 1
|
/* |
/* |
================================================================================ |
================================================================================ |
RPL/2 (R) version 4.0.9 |
RPL/2 (R) version 4.1.0.prerelease.1 |
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 721 void
|
Line 721 void
|
instruction_edit(struct_processus *s_etat_processus) |
instruction_edit(struct_processus *s_etat_processus) |
{ |
{ |
# ifdef VIM_SUPPORT |
# ifdef VIM_SUPPORT |
# include "vim.conv.h" |
# include "vim-conv.h" |
|
|
file *fichier; |
file *fichier; |
|
|
logical1 drapeau; |
|
logical1 drapeau49; |
logical1 drapeau49; |
logical1 drapeau50; |
logical1 drapeau50; |
|
|
Line 738 instruction_edit(struct_processus *s_eta
|
Line 737 instruction_edit(struct_processus *s_eta
|
unsigned char *chaine; |
unsigned char *chaine; |
unsigned char *commande; |
unsigned char *commande; |
unsigned char *nom_fichier; |
unsigned char *nom_fichier; |
|
unsigned char registre; |
|
|
(*s_etat_processus).erreur_execution = d_ex; |
(*s_etat_processus).erreur_execution = d_ex; |
|
|
Line 848 instruction_edit(struct_processus *s_eta
|
Line 848 instruction_edit(struct_processus *s_eta
|
return; |
return; |
} |
} |
|
|
|
registre = (*s_etat_processus).autorisation_conversion_chaine; |
|
(*s_etat_processus).autorisation_conversion_chaine = 'N'; |
|
|
if ((chaine = formateur(s_etat_processus, 0, s_objet)) == NULL) |
if ((chaine = formateur(s_etat_processus, 0, s_objet)) == NULL) |
{ |
{ |
|
(*s_etat_processus).autorisation_conversion_chaine = registre; |
|
|
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
return; |
return; |
} |
} |
|
|
|
(*s_etat_processus).autorisation_conversion_chaine = registre; |
|
|
if ((*s_objet).type == CHN) |
if ((*s_objet).type == CHN) |
{ |
{ |
if (fprintf(fichier, "\"%s\"\n", chaine) != (int) (strlen(chaine) + 3)) |
if (fprintf(fichier, "\"%s\"\n", chaine) != (int) (strlen(chaine) + 3)) |
Line 879 instruction_edit(struct_processus *s_eta
|
Line 886 instruction_edit(struct_processus *s_eta
|
return; |
return; |
} |
} |
|
|
do |
if ((commande = malloc((strlen(ds_vim_commande) + strlen(nom_fichier) |
|
- 1) * sizeof(unsigned char))) == NULL) |
{ |
{ |
if ((commande = malloc((strlen(ds_vim_commande) + strlen(nom_fichier) |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
- 1) * sizeof(unsigned char))) == NULL) |
return; |
{ |
} |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
|
return; |
|
} |
|
|
|
sprintf(commande, ds_vim_commande, nom_fichier); |
sprintf(commande, ds_vim_commande, nom_fichier); |
|
|
if (system(commande) != 0) |
if (system(commande) != 0) |
{ |
{ |
free(commande); |
free(commande); |
|
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
return; |
return; |
} |
} |
|
|
free(commande); |
free(commande); |
|
|
if ((s_objet_nom = allocation(s_etat_processus, CHN)) == NULL) |
if ((s_objet_nom = allocation(s_etat_processus, CHN)) == NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
return; |
return; |
} |
} |
|
|
if (((*s_objet_nom).objet = malloc((strlen(nom_fichier) + 1) |
if (((*s_objet_nom).objet = malloc((strlen(nom_fichier) + 1) |
* 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; |
return; |
return; |
} |
} |
|
|
strcpy((unsigned char *) (*s_objet_nom).objet, nom_fichier); |
strcpy((unsigned char *) (*s_objet_nom).objet, nom_fichier); |
|
|
if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile), |
if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile), |
s_objet_nom) == d_erreur) |
s_objet_nom) == d_erreur) |
{ |
{ |
return; |
return; |
} |
} |
|
|
registre_pile_last = (*s_etat_processus).l_base_pile_last; |
registre_pile_last = (*s_etat_processus).l_base_pile_last; |
(*s_etat_processus).l_base_pile_last = NULL; |
(*s_etat_processus).l_base_pile_last = NULL; |
|
|
instruction_recall(s_etat_processus); |
instruction_recall(s_etat_processus); |
|
|
// Destruction du fichier temporaire |
if (empilement_pile_last(s_etat_processus, 0) == d_erreur) |
|
{ |
|
return; |
|
} |
|
|
if (destruction_fichier(nom_fichier) == d_erreur) |
(*s_etat_processus).l_base_pile_last = registre_pile_last; |
{ |
|
(*s_etat_processus).erreur_systeme = d_es_erreur_fichier; |
|
return; |
|
} |
|
|
|
free(nom_fichier); |
// Destruction du fichier temporaire |
|
|
if (((*s_etat_processus).erreur_systeme != d_es) || |
if (destruction_fichier(nom_fichier) == d_erreur) |
((*s_etat_processus).erreur_execution != d_ex) || |
{ |
((*s_etat_processus).exception != d_ep)) |
(*s_etat_processus).erreur_systeme = d_es_erreur_fichier; |
{ |
return; |
if (empilement_pile_last(s_etat_processus, 0) == d_erreur) |
} |
{ |
|
return; |
|
} |
|
|
|
(*s_etat_processus).l_base_pile_last = registre_pile_last; |
free(nom_fichier); |
liberation(s_etat_processus, s_objet); |
|
|
|
return; |
if (((*s_etat_processus).erreur_systeme != d_es) || |
} |
((*s_etat_processus).erreur_execution != d_ex) || |
|
((*s_etat_processus).exception != d_ep)) |
|
{ |
|
liberation(s_etat_processus, s_objet); |
|
|
if ((*s_etat_processus).erreur_systeme != d_es) |
return; |
{ |
} |
return; |
|
} |
|
|
|
if ((*s_etat_processus).erreur_execution == d_ex_fichier_vide) |
if ((*s_etat_processus).erreur_systeme != d_es) |
{ |
{ |
if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile), |
return; |
s_objet) == d_erreur) |
} |
{ |
|
return; |
|
} |
|
|
|
(*s_etat_processus).erreur_execution = d_ex; |
if ((*s_etat_processus).erreur_execution == d_ex_fichier_vide) |
drapeau = d_faux; |
{ |
} |
if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile), |
else |
s_objet) == d_erreur) |
{ |
{ |
drapeau = d_vrai; |
return; |
} |
} |
} while((*s_etat_processus).erreur_execution != d_ex); |
|
|
|
if (drapeau == d_vrai) |
(*s_etat_processus).erreur_execution = d_ex; |
|
} |
|
else |
{ |
{ |
liberation(s_etat_processus, s_objet); |
liberation(s_etat_processus, s_objet); |
} |
} |
Line 1303 instruction_exit(struct_processus *s_eta
|
Line 1302 instruction_exit(struct_processus *s_eta
|
{ |
{ |
instruction_majuscule = conversion_majuscule(""); |
instruction_majuscule = conversion_majuscule(""); |
|
|
if ((*s_etat_processus).s_liste_variables |
if ((*(*s_etat_processus).pointeur_variable_courante) |
[(*s_etat_processus).position_variable_courante] |
|
.objet == NULL) |
.objet == NULL) |
{ |
{ |
if (pthread_mutex_lock(&((*(*s_etat_processus) |
if (pthread_mutex_lock(&((*(*s_etat_processus) |
Line 1316 instruction_exit(struct_processus *s_eta
|
Line 1314 instruction_exit(struct_processus *s_eta
|
} |
} |
|
|
if (recherche_variable_partagee(s_etat_processus, |
if (recherche_variable_partagee(s_etat_processus, |
(*s_etat_processus).s_liste_variables |
(*(*s_etat_processus) |
[(*s_etat_processus).position_variable_courante] |
.pointeur_variable_courante).nom, |
.nom, (*s_etat_processus).s_liste_variables |
(*(*s_etat_processus) |
[(*s_etat_processus).position_variable_courante] |
.pointeur_variable_courante).variable_partagee, |
.variable_partagee, |
(*(*s_etat_processus) |
(*s_etat_processus).s_liste_variables |
.pointeur_variable_courante).origine) == d_vrai) |
[(*s_etat_processus).position_variable_courante] |
|
.origine) == d_vrai) |
|
{ |
{ |
if ((*((*s_etat_processus).s_liste_variables |
if ((*(*(*s_etat_processus) |
[(*s_etat_processus) |
.pointeur_variable_courante).objet).type |
.position_variable_courante]).objet).type |
|
== ADR) |
== ADR) |
{ |
{ |
empilement_pile_systeme(s_etat_processus); |
empilement_pile_systeme(s_etat_processus); |
Line 1359 instruction_exit(struct_processus *s_eta
|
Line 1354 instruction_exit(struct_processus *s_eta
|
|
|
(*s_etat_processus).position_courante = |
(*s_etat_processus).position_courante = |
(*((unsigned long *) |
(*((unsigned long *) |
((*((*s_etat_processus) |
((*(*(*s_etat_processus) |
.s_liste_variables[(*s_etat_processus) |
.pointeur_variable_courante).objet) |
.position_variable_courante].objet)) |
|
.objet))); |
.objet))); |
|
|
(*s_etat_processus) |
(*s_etat_processus) |
Line 1384 instruction_exit(struct_processus *s_eta
|
Line 1378 instruction_exit(struct_processus *s_eta
|
} |
} |
else |
else |
{ |
{ |
if ((*((*s_etat_processus).s_liste_variables |
if ((*(*(*s_etat_processus).pointeur_variable_courante) |
[(*s_etat_processus) |
.objet).type == ADR) |
.position_variable_courante]).objet).type |
|
== ADR) |
|
{ |
{ |
empilement_pile_systeme(s_etat_processus); |
empilement_pile_systeme(s_etat_processus); |
|
|
Line 1407 instruction_exit(struct_processus *s_eta
|
Line 1399 instruction_exit(struct_processus *s_eta
|
(*s_etat_processus).niveau_courant; |
(*s_etat_processus).niveau_courant; |
|
|
(*s_etat_processus).position_courante = |
(*s_etat_processus).position_courante = |
(*((unsigned long *) ((*((*s_etat_processus) |
(*((unsigned long *) |
.s_liste_variables[(*s_etat_processus) |
((*(*(*s_etat_processus) |
.position_variable_courante].objet)) |
.pointeur_variable_courante).objet) |
.objet))); |
.objet))); |
|
|
(*s_etat_processus) |
(*s_etat_processus) |
Line 1531 instruction_exit(struct_processus *s_eta
|
Line 1523 instruction_exit(struct_processus *s_eta
|
{ |
{ |
instruction_majuscule = conversion_majuscule(""); |
instruction_majuscule = conversion_majuscule(""); |
|
|
if ((*s_etat_processus).s_liste_variables |
if ((*(*s_etat_processus).pointeur_variable_courante) |
[(*s_etat_processus).position_variable_courante] |
|
.objet == NULL) |
.objet == NULL) |
{ |
{ |
if (pthread_mutex_lock(&((*(*s_etat_processus) |
if (pthread_mutex_lock(&((*(*s_etat_processus) |
Line 1544 instruction_exit(struct_processus *s_eta
|
Line 1535 instruction_exit(struct_processus *s_eta
|
} |
} |
|
|
if (recherche_variable_partagee(s_etat_processus, |
if (recherche_variable_partagee(s_etat_processus, |
(*s_etat_processus).s_liste_variables |
(*(*s_etat_processus) |
[(*s_etat_processus).position_variable_courante] |
.pointeur_variable_courante).nom, |
.nom, (*s_etat_processus).s_liste_variables |
(*(*s_etat_processus) |
[(*s_etat_processus).position_variable_courante] |
.pointeur_variable_courante).variable_partagee, |
.variable_partagee, |
(*(*s_etat_processus) |
(*s_etat_processus).s_liste_variables |
.pointeur_variable_courante).origine) == d_vrai) |
[(*s_etat_processus).position_variable_courante] |
|
.origine) == d_vrai) |
|
{ |
{ |
if ((*((*s_etat_processus).s_liste_variables |
if ((*(*(*s_etat_processus) |
[(*s_etat_processus) |
.pointeur_variable_courante).objet).type |
.position_variable_courante]).objet).type |
|
== ADR) |
== ADR) |
{ |
{ |
empilement_pile_systeme(s_etat_processus); |
empilement_pile_systeme(s_etat_processus); |
Line 1587 instruction_exit(struct_processus *s_eta
|
Line 1575 instruction_exit(struct_processus *s_eta
|
|
|
(*s_etat_processus).position_courante = |
(*s_etat_processus).position_courante = |
(*((unsigned long *) |
(*((unsigned long *) |
((*((*s_etat_processus) |
((*(*(*s_etat_processus) |
.s_liste_variables[(*s_etat_processus) |
.pointeur_variable_courante).objet) |
.position_variable_courante].objet)) |
|
.objet))); |
.objet))); |
|
|
(*s_etat_processus) |
(*s_etat_processus) |
Line 1612 instruction_exit(struct_processus *s_eta
|
Line 1599 instruction_exit(struct_processus *s_eta
|
} |
} |
else |
else |
{ |
{ |
if ((*((*s_etat_processus).s_liste_variables |
if ((*(*(*s_etat_processus).pointeur_variable_courante) |
[(*s_etat_processus) |
.objet).type == ADR) |
.position_variable_courante]).objet).type |
|
== ADR) |
|
{ |
{ |
empilement_pile_systeme(s_etat_processus); |
empilement_pile_systeme(s_etat_processus); |
|
|
Line 1635 instruction_exit(struct_processus *s_eta
|
Line 1620 instruction_exit(struct_processus *s_eta
|
(*s_etat_processus).niveau_courant; |
(*s_etat_processus).niveau_courant; |
|
|
(*s_etat_processus).position_courante = |
(*s_etat_processus).position_courante = |
(*((unsigned long *) ((*((*s_etat_processus) |
(*((unsigned long *) |
.s_liste_variables[(*s_etat_processus) |
((*(*(*s_etat_processus) |
.position_variable_courante].objet)) |
.pointeur_variable_courante).objet) |
.objet))); |
.objet))); |
|
|
(*s_etat_processus) |
(*s_etat_processus) |