//================================================================================================== // S t a n d a r d Interface // E n v i r o n m e n t // By Bruno Bachelet //================================================================================================== // Copyright (c) 1999-2016 // Bruno Bachelet - bruno@nawouak.net - http://www.nawouak.net // // This file is part of the B++ Library. This library is free software; you can redistribute it // and/or modify it under the terms of the GNU Library General Public License as published by the // Free Software Foundation; either version 2 of the License, or (at your option) any later // version. // // This library 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 Library General Public License for more details (http://www.gnu.org).
/*DESCRIPTION*/ /* This module provides facilities to access general information about the program and the library. It also provides facilities to display messages. */
// File Name //------------------------------------------------------------------------------------- #line __LINE__ "standard/environment.hpp"
// Guardian //-------------------------------------------------------------------------------------- #ifndef guEnvironment #define guEnvironment
// Headers //--------------------------------------------------------------------------------------- #include <ctime> /*INCLUDE*/ #include <fstream> /*INCLUDE*/ #include <map> /*INCLUDE*/ #include <bpp/display.hpp> /*INCLUDE*/ #include <bpp/standard/basic_string.hpp> /*INCLUDE*/
#ifdef USE_GETRUSAGE_FOR_CLOCK #include <sys/time.h> #include <sys/resource.h> #endif
namespace bpp {
// Importation/Exportation //----------------------------------------------------------------------- #ifdef STANDARD_DLL #define dll_export DLL_EXPORT #else #define dll_export DLL_IMPORT #endif
// Namespaces //------------------------------------------------------------------------------------ #define public_area environment #define private_area environment_private
namespace public_area { /*NAMESPACE*/ using namespace standardBasicString; } namespace private_area { using namespace public_area; }
// Initialization //-------------------------------------------------------------------------------- #define iniStandardEnvironment has_initializer;
// Macrocommands //--------------------------------------------------------------------------------- /*MACROCOMMAND*/ /* Declares the name of a module. */ #define extern_module_name \ namespace private_area { extern dll_export environment_private::tcString goModuleName; } \ namespace public_area { \ inline const environment_private::tcString moduleName(void) \ { return (private_area::goModuleName); } \ } \ class _extern_module_name_semicolon_eater_ \
/*MACROCOMMAND*/ /* Defines the name of a module. */ #define static_module_name(prName) \ namespace private_area { dll_export environment_private::tcString goModuleName = prName; } \ class _static_module_name_semicolon_eater_ \
// Types & Classes //------------------------------------------------------------------------------- namespace public_area { //-----------------------------------------------------------------------------------Variable Types /*TYPE*/ /* List of parameters with their value. */ typedef std_map(private_area::clString,private_area::clString) clParameterS;
/*TYPE*/ /* Program result (<CODE>success</CODE> or <CODE>failure</CODE>). */ enumeration { success, failure } tyProgramResult; //-----------------------------------------------------------------------------------Constant Types typedef const clParameterS ctParameterS; typedef tyProgramResult tcProgramResult; }
namespace private_area { typedef std::ifstream clInFile; typedef std::ofstream clOutFile; typedef std::ostream clOutStream;
typedef std::clock_t tyClock;
class clStreamBuffer; }
// Functions Interface //--------------------------------------------------------------------------- namespace public_area { inline ctString & dataLocation(void); inline ctString & temporaryLocation(void); inline private_area::ctString & parameter(private_area::ctString &);
testing_mode ( inline private_area::ctString & testingLocation(void); )
inline void nextLine(void); tyReturn quit(tyProgramResult);
template <class prObject> void out(const prObject &,private_area::tyBoolean=false, private_area::tyBoolean=false);
function void outContext(void); function void outContext(private_area::clOutStream & agStream); function void outFlags(void); function void outFlags(private_area::clOutStream & agStream); function void outInformation(void); function void outInformation(private_area::clOutStream &); function void outLicense(void); function void outLicense(private_area::clOutStream &);
inline void inform(private_area::tcString,private_area::tyBoolean=true); inline void informAutoTesting(private_area::tcString); inline void informInitialization(private_area::tcString); inline void informTermination(private_area::tcString); inline void informTesting(private_area::tcString);
inline void showProgression(private_area::tyCardinal,private_area::tyCardinal, private_area::tyCardinal=10);
inline void warn(private_area::tcString,private_area::tyBoolean=true); function void warnAutoTestingFailure(private_area::tcString,private_area::tcString);
inline tyInteger currentClock(void);
void terminate(void); }
namespace private_area {}
// Errors //---------------------------------------------------------------------------------------- namespace public_area {}
// Constants & Variables //------------------------------------------------------------------------- extern_module_name;
//--------------------------------------------------------------------------------------------Public /*CONSTANT*/ /* Copyright of the program. */ extern_static_constant(public,tcString,goCopyright,copyright); /*CONSTANT*/ /* Compiler used to make the program. */ extern_static_constant(public,tcString,goCompiler,compiler); /*CONSTANT*/ /* Last update of the program. */ extern_static_constant(public,tcString,goLastUpdate,lastUpdate); /*CONSTANT*/ /* Operating system the program is designed for. */ extern_static_constant(public,tcString,goOperatingSystem,operatingSystem); /*CONSTANT*/ /* Programmer's e-mail. */ extern_static_constant(public,tcString,goProgrammerEmail,programmerEmail); /*CONSTANT*/ /* Programmer's name. */ extern_static_constant(public,tcString,goProgrammerName,programmerName); /*CONSTANT*/ /* Programmer's URL. */ extern_static_constant(public,tcString,goProgrammerURL,programmerURL); /*CONSTANT*/ /* Name of the program. */ extern_static_constant(public,tcString,goProgramName,programName); /*CONSTANT*/ /* Parameters given to the program through the initialization file. */ extern_dynamic_constant(public,clParameterS,goParameterS,parameters); /*CONSTANT*/ /* Value of the computer clock at the start of the program. */ extern_static_constant(public,tyInteger,goStartingClock,startingClock); /*CONSTANT*/ /* Indicates if information messages can be displayed. */ extern_static_constant(public,tyBoolean,goInformationDisplayed,informationDisplayed);
extern_static_constant(private,tyCharacter,goRandomSeed[20],?); extern_static_constant(private,tyCharacter,goStartingDate[100],?);
namespace public_area { /*FUNCTION*/ /* Returns the seed of the default random number generator. */ inline const private_area::tyString randomSeed(void) { return (private_area::goRandomSeed); } /*FUNCTION*/ /* Returns the date of the start of the program. */ inline const private_area::tyString startingDate(void) { return (private_area::goStartingDate); } }
//-------------------------------------------------------------------------------------------Private extern_static_constant(private,tcString,goParameterFileName,?); extern_static_constant(private,tyInteger,goTicksPerSecond,?);
extern_static_constant(private,tyCharacter,goTerminationDate[100],?);
extern_dynamic_constant(private,display::clDisplay,goDisplay,?); extern_static_constant(private,clMutex,goMutex,?);
extern_static_constant(private,tyBoolean,goJavaActivated,?);
// S t r e a m B u f f e r Interface //------------------------------------------------------------ namespace private_area { class clStreamBuffer : virtual public std::streambuf { //------------------------------------------------------------------------------------------Public public_property int overflow(int); }; }
// Functions Inline //------------------------------------------------------------------------------ namespace public_area { //-------------------------------------------------------------------------------------DataLocation /*FUNCTION*/ /* Returns the location of the data files of the program. */ inline private_area::ctString & dataLocation(void) { return ((*(private_area::goParameterS))[clString("data_location")]); } //--------------------------------------------------------------------------------TemporaryLocation /*FUNCTION*/ /* Returns the location of the temporary folder used by the program. */ inline private_area::ctString & temporaryLocation(void) { return ((*(private_area::goParameterS))[clString("temporary_location")]); } //----------------------------------------------------------------------------------------Parameter /*FUNCTION*/ /* Returns the value of a given parameter of the initialization file. */ inline private_area::ctString & parameter(private_area::ctString & agVariable) { return ((*(private_area::goParameterS))[agVariable]); }
//----------------------------------------------------------------------------------TestingLocation testing_mode ( /*FUNCTION*/ /* Returns the location where the testing results are stored. This function exists only in the testing mode. */ inline private_area::ctString & testingLocation(void) { return ((*(private_area::goParameterS))[clString("testing_location")]); } )
//-----------------------------------------------------------------------------------------NextLine /*FUNCTION*/ /* Jumps to the next line in the display. */ inline void nextLine(void) { safe_yes ( private_area::goMutex.lock(); ) private_area::goDisplay->nextLine(); safe_yes ( private_area::goMutex.release(); ) }
//-------------------------------------------------------------------------------------------Inform /*FUNCTION*/ /* Displays a message as a main information. The second argument orders to jump to the next line (default = <CODE>true</CODE>). */ inline void inform(private_area::tcString agMessage,private_area::tyBoolean agNextLine) { out("[>] "); out(agMessage,agNextLine); } //--------------------------------------------------------------------------------InformAutoTesting /*FUNCTION*/ /* Informs that an auto-testing is processed. */ inline void informAutoTesting(private_area::tcString agModuleName) { inform(agModuleName,false); out(" Module Auto-Testing...",true,false); } //-----------------------------------------------------------------------------InformInitialization /*FUNCTION*/ /* Informs that a module is initialized. */ inline void informInitialization(private_area::tcString agModuleName) { if (private_area::goInformationDisplayed) { inform(agModuleName,false); out(" Module Initialization...",true,false); } } //--------------------------------------------------------------------------------InformTermination /*FUNCTION*/ /* Informs that a module is terminated. */ inline void informTermination(private_area::tcString agModuleName) { if (private_area::goInformationDisplayed) { inform(agModuleName,false); out(" Module Termination...",true,false); } } //------------------------------------------------------------------------------------InformTesting /*FUNCTION*/ /* Informs that a module is tested. */ inline void informTesting(private_area::tcString agModuleName) { inform(agModuleName,false); out(" Module Testing...",true,false); } //----------------------------------------------------------------------------------ShowProgression /*FUNCTION*/ /* Shows the progression of a process. */ inline void showProgression(private_area::tyCardinal agCurrent,private_area::tyCardinal agNumber, private_area::tyCardinal agStep) { if (agCurrent%(agNumber/agStep)==0) { out((agStep-agCurrent/(agNumber/agStep))*(100/agStep),false,true); out(" %",true); } } //---------------------------------------------------------------------------------------------Warn /*FUNCTION*/ /* Displays a message as a warning. */ inline void warn(private_area::tcString agMessage,private_area::tyBoolean agNextLine) { out("[!] "); out(agMessage,agNextLine); } //-------------------------------------------------------------------------------------CurrentClock /*FUNCTION*/ /* Returns the current value of the computer clock. */ inline tyInteger currentClock(void) { #ifdef USE_GETRUSAGE_FOR_CLOCK rusage lcUsage;
getrusage(RUSAGE_SELF,&lcUsage);
return (tyInteger((lcUsage.ru_utime.tv_sec+lcUsage.ru_stime.tv_sec)*100 +(lcUsage.ru_utime.tv_usec+lcUsage.ru_stime.tv_sec)/10000)); #else using namespace private_area;
unsigned long int lcClock = std::clock(); unsigned long int lcTicksPerSecond = goTicksPerSecond;
return (tyInteger((lcClock/lcTicksPerSecond)*100 + ((lcClock%lcTicksPerSecond)*100)/lcTicksPerSecond)); #endif } }
namespace private_area {}
//-------------------------------------------------------------------------------------Make_map_pair /*FUNCTION*/ /* For efficiency reasons, the <CODE>make_pair</CODE> of the STL is rewritten. This version is adapted to pairs for the STL map structure (where the first element's type is constant). Do not use this function directly, instead you should use the <CODE>std_make_pair</CODE> keyword. */ template <class prKey,class prElement> inline std::pair<const prKey,prElement> make_map_pair(const prKey & agKey,const prElement & agElement) { return (std::pair<const prKey,prElement>(agKey,agElement)); }
// X X X Inline //--------------------------------------------------------------------------------- namespace {}
// Functions Implementation //---------------------------------------------------------------------- namespace public_area { //----------------------------------------------------------------------------------------------Out /*FUNCTION*/ /* Displays an object. The second argument orders to jump to the next line (default = <CODE>false</CODE>). The third argument orders to place a tabulation at the beginning (default = <CODE>false</CODE>). */ template <class prObject> void out(const prObject & agObject,private_area::tyBoolean agNextLine, private_area::tyBoolean agTabulation) { safe_static private_area::clStreamBuffer lcBuffer; safe_static std::ostream lcStream(&lcBuffer);
safe_yes ( private_area::goMutex.lock(); ) if (agTabulation) lcStream << " "; lcStream << agObject; if (agNextLine) private_area::goDisplay->nextLine(); safe_yes ( private_area::goMutex.release(); ) } }
namespace private_area {}
// End //------------------------------------------------------------------------------------------- } #undef dll_export #undef public_area #undef private_area #endif |
//================================================================================================== // S t a n d a r d Implementation // E n v i r o n m e n t // By Bruno Bachelet //================================================================================================== // Copyright (c) 1999-2016 // Bruno Bachelet - bruno@nawouak.net - http://www.nawouak.net // // This file is part of the B++ Library. This library is free software; you can redistribute it // and/or modify it under the terms of the GNU Library General Public License as published by the // Free Software Foundation; either version 2 of the License, or (at your option) any later // version. // // This library 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 Library General Public License for more details (http://www.gnu.org).
// File Name //------------------------------------------------------------------------------------- #line __LINE__ "standard/environment.cpp"
// DLL Belonging //--------------------------------------------------------------------------------- #define STANDARD_DLL
// Headers //--------------------------------------------------------------------------------------- #include <bpp/license.hpp> /*NEED*/ #include <bpp/standard/environment.hpp> /*INTERFACE*/
namespace bpp {
// Namespaces //------------------------------------------------------------------------------------ #define public_area environment #define private_area environment_private #define dll_export DLL_EXPORT
namespace public_area {} namespace private_area {}
static_module_name("Standard/Environment");
// Initialization //-------------------------------------------------------------------------------- #undef iniStandardEnvironment static_constant(private_area::clInitializer,goInitializer);
// Errors //---------------------------------------------------------------------------------------- namespace public_area {}
// Constants & Variables //------------------------------------------------------------------------- namespace private_area { tcString goBppToolIntroduction[] = { BPP_TOOL_INTRODUCTION }; tcString goBppLibraryIntroduction[] = { BPP_LIBRARY_INTRODUCTION };
tcString goBppToolLicense[] = { BPP_TOOL_LICENSE }; tcString goBppLibraryLicense[] = { BPP_LIBRARY_LICENSE }; }
static_constant(tcString,goCopyright); static_constant(tcString,goCompiler); static_constant(tcString,goLastUpdate); static_constant(tcString,goOperatingSystem); static_constant(tcString,goProgrammerEmail); static_constant(tcString,goProgrammerName); static_constant(tcString,goProgrammerURL); static_constant(tcString,goProgramName);
dynamic_constant(clParameterS,goParameterS); static_constant(tyInteger,goStartingClock);
static_constant(tcString,goParameterFileName); static_constant(tyInteger,goTicksPerSecond);
static_constant(tyCharacter,goRandomSeed[20]); static_constant(tyCharacter,goStartingDate[100]); static_constant(tyCharacter,goTerminationDate[100]);
static_constant(tyBoolean,goInformationDisplayed);
dynamic_constant(display::clDisplay,goDisplay); static_constant(clMutex,goMutex);
static_constant(tyBoolean,goJavaActivated);
// Static Members //-------------------------------------------------------------------------------- namespace public_area {} namespace private_area {}
// Functions Implementation //---------------------------------------------------------------------- namespace public_area { //---------------------------------------------------------------------------------------------Quit /*FUNCTION*/ /* Quits the program. */ function tyReturn quit(tyProgramResult agResult) { tyReturn lcReturn;
safe_yes ( private_area::goMutex.lock(); ) lcReturn=private_area::goDisplay->quit(display::tyProgramResult(agResult)); safe_yes ( private_area::goMutex.release(); ) return (lcReturn); } //---------------------------------------------------------------------------------------OutContext /*FUNCTION*/ /* Displays the context of the library. */ function void outContext(void) { private_area::clStreamBuffer lcBuffer; std::ostream lcStream(&lcBuffer);
safe_yes ( private_area::goMutex.lock(); ) outContext(lcStream); safe_yes ( private_area::goMutex.release(); ) } //---------------------------------------------------------------------------------------OutContext /*FUNCTION*/ /* Writes the context of the library into a stream. */ function void outContext(private_area::clOutStream & agStream) { using namespace private_area;
agStream << "[>] -=-=- C O N T E X T -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-" << end_line; agStream << " Flags = "; outFlags(agStream); agStream << end_line; agStream << " Environment Variable = " << BPP_TOOLS_ENVIRONMENT_VARIABLE << end_line; agStream << " Random Seed = " << randomSeed() << end_line; agStream << " Starting Date = " << startingDate() << end_line; agStream << " Elapsed Hundredths = " << tyInteger(currentClock()-startingClock()) << end_line; agStream << " -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-" << end_line; } //-----------------------------------------------------------------------------------------OutFlags /*FUNCTION*/ /* Displays the compilation flags of the library. */ function void outFlags(void) { private_area::clStreamBuffer lcBuffer; std::ostream lcStream(&lcBuffer);
safe_yes ( private_area::goMutex.lock(); ) outFlags(lcStream); safe_yes ( private_area::goMutex.release(); ) } //-----------------------------------------------------------------------------------------OutFlags /*FUNCTION*/ /* Writes the compilation flags of the library into a stream. */ function void outFlags(private_area::clOutStream & agStream) { tcString lcFlagS[10]; clString lcString;
tyCardinal lcCounter = 0; clString lcIndent("");
#ifdef GLPK_YES lcFlagS[lcCounter++]="glpk-lib"; #endif
#ifdef CPLEX_LIBRARY_YES lcFlagS[lcCounter++]="cplex-lib"; #endif
#ifdef CPLEX_YES lcFlagS[lcCounter++]="cplex-prog"; #endif
#ifdef AMPL_YES lcFlagS[lcCounter++]="ampl-prog"; #endif
#ifdef JAVA_NATIVE_INTERFACE_YES lcFlagS[lcCounter++]="jni-lib"; #endif
#ifdef THREAD_SAFETY lcFlagS[lcCounter++]="thread-safety"; #endif
#ifdef TESTING_MODE lcFlagS[lcCounter++]="testing-mode"; #endif
#ifdef MEMORY_SPY_MODE lcFlagS[lcCounter++]="memory-spy-mode"; #endif
#ifdef EVENT_SPY_MODE lcFlagS[lcCounter++]="event-spy-mode"; #endif
if (lcCounter==0) agStream << "none"; else { while (lcCounter>0) { --lcCounter; lcString+=lcFlagS[lcCounter];
if (lcString.size()>=55) { agStream << lcIndent << lcString; lcIndent="\n "; lcString=""; } else lcString+=" "; }
if (lcString.size()>0) agStream << lcIndent << lcString; } } //-----------------------------------------------------------------------------------OutInformation /*FUNCTION*/ /* Displays general information about the program. */ function void outInformation(void) { private_area::clStreamBuffer lcBuffer; std::ostream lcStream(&lcBuffer);
safe_yes ( private_area::goMutex.lock(); ) outInformation(lcStream); safe_yes ( private_area::goMutex.release(); ) } //-----------------------------------------------------------------------------------OutInformation /*FUNCTION*/ /* Writes general information about the program into a stream. */ function void outInformation(private_area::clOutStream & agStream) { agStream << "[>] -=-=- G E N E R A L I N F O R M A T I O N -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-" << end_line; agStream << " " << programName() << end_line; agStream << " Last updated the " << lastUpdate() << end_line; agStream << end_line; agStream << " Compiled with " << compiler() << end_line; agStream << " For " << operatingSystem() << " operating system" << end_line; agStream << end_line; agStream << " Coded by " << programmerName() << end_line; agStream << " " << programmerEmail() << " - " << programmerURL() << end_line; agStream << " -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-" << end_line; } //---------------------------------------------------------------------------------------OutLicense /*FUNCTION*/ /* Displays the license of the library and the program. */ function void outLicense(void) { private_area::clStreamBuffer lcBuffer; std::ostream lcStream(&lcBuffer);
safe_yes ( private_area::goMutex.lock(); ) outLicense(lcStream); safe_yes ( private_area::goMutex.release(); ) } //---------------------------------------------------------------------------------------OutLicense /*FUNCTION*/ /* Writes the license of the library and the program into a stream. */ function void outLicense(private_area::clOutStream & agStream) { using namespace private_area;
tyCardinal lcCounter;
agStream << "[>] -=-=- L I C E N S E -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-" << end_line; agStream << end_line; lcCounter=0;
while (goBppToolIntroduction[lcCounter][0]!='~') { agStream << " " << goBppToolIntroduction[lcCounter] << end_line; lcCounter++; }
agStream << end_line; lcCounter=0;
while (goBppToolLicense[lcCounter][0]!='~') { agStream << " - " << goBppToolLicense[lcCounter] << end_line; lcCounter++; }
agStream << end_line; lcCounter=0;
while (goBppLibraryIntroduction[lcCounter][0]!='~') { agStream << " " << goBppLibraryIntroduction[lcCounter] << end_line; lcCounter++; }
agStream << end_line; lcCounter=0;
while (goBppLibraryLicense[lcCounter][0]!='~') { agStream << " - " << goBppLibraryLicense[lcCounter] << end_line; lcCounter++; }
agStream << end_line; agStream << " -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-" << end_line; } //---------------------------------------------------------------------------WarnAutoTestingFailure /*FUNCTION*/ /* Displays a warning of auto-testing failure. */ function void warnAutoTestingFailure(private_area::tcString agModuleName, private_area::tcString agBugFileName) { nextLine(); warn("The auto-testing of ",false); out(agModuleName); out(" has failed.",true); out("For more details, see the '",false,true); out(agBugFileName); out("' file.",true); nextLine(); } //----------------------------------------------------------------------------------------Terminate /*FUNCTION*/ /* Informs that the library terminates abnormally. */ function void terminate(void) { nextLine(); warn("Abnormal library termination."); nextLine(); out("An error occurred during the library's opening,",true,true); out("or several errors occurred simultaneously later.",true,true); out("Recovering from such situations is impossible.",true,true);
exit(EXIT_FAILURE); } }
namespace private_area {}
// O u t p u t S t r e a m Implementation //------------------------------------------------------- namespace private_area { //-----------------------------------------------------------------------------------------Overflow int clStreamBuffer::overflow(int lcCharacter) { tyString lcString = goDisplay->currentLine();
if (lcCharacter==10) goDisplay->nextLine(); else if (lcCharacter!=13) { while (*lcString!=0) ++lcString; lcString[0]=tyCharacter(lcCharacter); lcString[1]=0; }
return (0); } }
// I n i t i a l i z e r Implementation //--------------------------------------------------------- namespace private_area { //--------------------------------------------------------------------------------------------Start property void clInitializer::start(void) { if (atCounter++ == 0) { #include <bpp/modules.hpp> /*NEED*/ registerStop(this); goDisplay->open();
goParameterS = new clParameterS; goParameterFileName = goDisplay->parameterFileName();
{ clInFile lcFile; clString lcSeparator; clString lcValue; clString lcVariable;
lcFile.open(goParameterFileName,ios::in); lcFile >> lcVariable;
while (not lcFile.fail() and lcVariable!="<end>" and lcVariable!="") { lcFile >> lcSeparator >> lcValue; goParameterS->insert(std_make_pair(lcVariable,lcValue)); lcFile >> lcVariable; }
lcFile.close();
if (lcFile.fail()) { environment::nextLine(); environment::warn("Error: Can't read from the parameters file."); environment::terminate(); } }
if (parameters().count(clString("information_displayed"))==0) goInformationDisplayed=true; else if (parameter(clString("information_displayed"))=="no") goInformationDisplayed=false; else goInformationDisplayed=true;
informInitialization(goModuleName);
goCompiler = COMPILER; goCopyright = COPYRIGHT; goLastUpdate = LAST_UPDATE; goOperatingSystem = OPERATING_SYSTEM; goProgrammerEmail = PROGRAMMER_EMAIL; goProgrammerName = PROGRAMMER_NAME; goProgrammerURL = PROGRAMMER_URL; goProgramName = "B + + L i b r a r y";
goTicksPerSecond = tyInteger(TICKS_PER_SECOND); goStartingClock = currentClock();
goRandomSeed[0] = end_string; goStartingDate[0] = end_string; goTerminationDate[0] = end_string;
goJavaActivated = false; } } //---------------------------------------------------------------------------------------------Stop property void clInitializer::stop(void) { informTermination(goModuleName); delete goParameterS;
if (goInformationDisplayed) { environment::nextLine(); inform("Starting Date = ",false); out(goStartingDate,true); inform("Termination Date = ",false); out(goTerminationDate,true); inform("Elapsed Hundredths = ",false); out(tyInteger(currentClock()-startingClock()),true); environment::nextLine(); inform("Program Terminated."); }
goDisplay->close(); } }
// End //------------------------------------------------------------------------------------------- } |
|