Herezh_dev/herezh_pp/Util/Sortie.cc

97 lines
3.7 KiB
C++
Executable file

// This file is part of the Herezh++ application.
//
// The finite element software Herezh++ is dedicated to the field
// of mechanics for large transformations of solid structures.
// It is developed by Gérard Rio (APP: IDDN.FR.010.0106078.000.R.P.2006.035.20600)
// INSTITUT DE RECHERCHE DUPUY DE LÔME (IRDL) <https://www.irdl.fr/>.
//
// Herezh++ is distributed under GPL 3 license ou ultérieure.
//
// Copyright (C) 1997-2021 Université Bretagne Sud (France)
// AUTHOR : Gérard Rio
// E-MAIL : gerardrio56@free.fr
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License,
// or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
//
// For more information, please consult: <https://herezh.irdl.fr/>.
//#include "Debug.h"
//#include "Tableau_T.h"
//#include "UtilLecture.h"
#include "ParaGlob.h"
# include "Sortie.h"
// on définit une variable globale pour éviter une boucle
// infinit en sortie:
int nombre_de_fois_ou_on_appel_sortie = 0;
void Sortie(int n)
{ bool fr = ParaGlob::Francais(); // pour simplifier
// dans le cas de la mise au point
// #ifdef MISE_AU_POINT
if (nombre_de_fois_ou_on_appel_sortie == 0)
{if (fr){cout << "\n passage dans la methode Sortie \n ";}
else {cout << "\n call to the method Sortie \n ";}
};
// #endif
// si n est positif on génère une interruption qui peut être intercepté
nombre_de_fois_ou_on_appel_sortie++; // pour éviter une boucle infini
// cout << "\n nombre_de_fois_ou_on_appel_sortie " << nombre_de_fois_ou_on_appel_sortie;
// string toto;
// cout << "\n entree un nombre";
// cin >> toto;
if ((n>0) && (nombre_de_fois_ou_on_appel_sortie <= 1))
// #ifdef ENLINUX_STREAM
{ ErrSortie toto;
throw (toto);
}
// #else
// throw (ErrSortie());
// #endif
// ensuite on continue
if (n > 0)
{if (fr)
{ cout << "\n *************************************************************** "
<< "\n ** arret apres une erreur ** "
<< "\n ***************************************************************\n ";
}
else
{ cout << "\n *************************************************************** "
<< "\n ** stop after an error ** "
<< "\n ***************************************************************\n ";
};
ErrSortieFinale titi;
throw (titi);
}
else
{if (fr)
{ cout << "\n *************************************************************** "
<< "\n ** fin du programme demande ** "
<< "\n ***************************************************************\n\n ";
}
else
{ cout << "\n *************************************************************** "
<< "\n ** stop after a call to stop ** "
<< "\n ***************************************************************\n\n ";
};
ErrSortieFinale titi;
throw (titi);
};
exit (n); // normalement ne sert à rien
}