16#include <Interprete_bloc.h>
17#include <Type_Verifie.h>
43 return interprete_courant_.
valeur();
46Interprete_bloc::Interprete_bloc()
50 if (interprete_courant_) pere_ = interprete_courant_;
52 interprete_courant_ = *
this;
55Interprete_bloc::~Interprete_bloc()
58 interprete_courant_ = pere_;
87 Journal(jlevel) <<
"Interprete_bloc::interpreter_bloc bloc_type=" << (int) bloc_type << finl;
99 Journal(jlevel) <<
"Interprete_bloc: end of file => end of bloc" << finl;
104 Cerr <<
"Error in Interprete_bloc: unexpected end of file\n" <<
"check for missig \"}\" or missing FIN keyword" << finl;
109 if (motlu ==
"}" || motlu ==
"FIN|END")
111 if ((motlu ==
"}" && bloc_type ==
ACCOLADE) || (motlu ==
"FIN|END" && bloc_type ==
FIN))
113 Journal(jlevel) <<
"Interprete_bloc: reading " << motlu <<
" => end of bloc" << finl;
119 Cerr <<
"Error in Interprete_bloc: extra \"}\" in data file" << finl;
121 Cerr <<
"Error in Interprete_bloc: unexpected FIN, check for missing \"}\"" << finl;
129 Nom commentaire(
"# ");
137 if ((countleft--) > 0)
139 commentaire += nom_lu;
143 while (nom_lu !=
"#");
146 Cerr <<
"Error in Interprete_bloc: end of file while reading a comment :\n" << commentaire <<
"..." << finl;
151 else if (motlu ==
"{")
153 Journal(jlevel) <<
"Interprete_bloc: reading { => creating new Interprete_bloc" << finl;
161 if (verifie_sans_interpreter)
169 Journal(jlevel) <<
"Interprete_bloc: just checking {} => ignore keyword " << motlu << finl;
176 int export_object = 0;
177 if (motlu ==
"export")
179 Journal(jlevel) <<
"Exporting object, reading object type..." << finl;
184 Journal(jlevel) <<
"Interprete_bloc: reading " << motlu <<
" => trying to instanciate object" << finl;
191 Journal(jlevel) <<
" Calling object.interpreter()" << finl;
198 Journal(jlevel) <<
" Reading object name" << finl;
201 Journal(jlevel) <<
" Storing object " << nom_objet <<
" of type " << motlu << finl;
202 if (!export_object || !pere_)
205 pere_->ajouter(nom_objet, objet);
223 Cerr <<
"Internal error in Interprete::objet_local() : object '" << nom <<
"' does not exist" << finl;
245 Journal(3) <<
"Interprete::ajouter(" << nom <<
") de type " << ob->
que_suis_je() << finl;
248 Cerr <<
"Error in Interprete::ajouter: object " << nom <<
" already exists." << finl;
276 Cerr <<
"Error in Interprete::objet: object " << nom <<
" does not exist." << finl;
Class defining operators and methods for all reading operation in an input flow (file,...
virtual void set_error_action(Error_Action)
Change le comportement en cas d'erreur de l'entree, voir error_handle_() et get_error_action().
Interprete un bloc d'instructions dans le jeu de donnees.
OBS_PTR(Interprete_bloc) pere_
Objet_U & ajouter(const Nom &nom, DerObjU &object_to_add)
Ajoute l'objet ob a la liste des objets de l'interprete, et nomme l'objet avec nom.
Entree & interpreter_bloc(Entree &is, Bloc_Type bloc_type, int verifier_sans_interpreter)
Interpretation d'un bloc d'instructions prises dans l'entree is.
static int objet_global_existant(const Nom &nom)
renvoie un drapeau indiquant si un objet de ce nom existe dans inteprete_courant() ou l'un de ses par...
Objet_U & objet_local(const Nom &nom)
Renvoie l'Objet_U correspondant a nom contenu dans cet interprete_bloc Si l'objet n'existe pas,...
static Interprete_bloc & interprete_courant()
renvoie l'interprete_bloc en train d'etre lu dans le jeu de donnees.
int objet_local_existant(const Nom &nom)
renvoie un drapeau indiquant si un objet de ce nom est enregistre dans cet inteprete (ne teste pas le...
static Objet_U & objet_global(const Nom &nom)
cherche l'objet demande dans l'Interprete_bloc courant (Interprete_bloc::interprete_courant()) et dan...
Classe de base des objets "interprete".
virtual Entree & interpreter(Entree &)=0
La classe Liste_bloc et Liste_bloc_curseur represente une liste de Deriv<Objet_U> et un curseur assoc...
Objet_U & operator[](int)
Operateur d'acces au ieme element de la liste.
Objet_U & add_deplace(DerObjU &)
Ajout d'un Objet_U a la liste to_add est libere en sortie.
Une chaine de caractere (Nom) en majuscules.
class Nom Une chaine de caractere pour nommer les objets de TRUST
Objet_U * typer(const char *nom_type)
Essaie de creer une instance du type "type".
virtual void nommer(const Nom &)
Donne un nom a l'Objet_U Methode virtuelle a surcharger.
const Nom & que_suis_je() const
renvoie la chaine identifiant la classe.
virtual Entree & readOn(Entree &)
Lecture d'un Objet_U sur un flot d'entree Methode a surcharger.
Objet_U()
Constructeur par defaut : attribue un numero d'identifiant unique a l'objet (object_id_),...
virtual Sortie & printOn(Sortie &) const
Ecriture de l'objet sur un flot de sortie Methode a surcharger.
static Sortie & Journal(int message_level=0)
Renvoie un objet statique de type Sortie qui sert de journal d'evenements.
static void exit(int exit_code=-1)
Routine de sortie de TRUST dans une region Kokkos.
Classe de base des flux de sortie.
const Objet_U & valeur() const