#include "machdefs.h" #include #include #include #include #include "sophyainit.h" #include "pexceptions.h" #include "ppersist.h" #include "fiondblock.h" #include "dvlist.h" #include "sversion.h" // --- Classe d'initialisation de SOPHYA, (PPersistMgr en particulier) int SophyaInitiator::FgInit = 0; /*! \namespace SOPHYA \brief This is the namespace for the whole Sophya package */ /*! \defgroup SysTools SysTools module This module contains classes and functions which define the general framework for \b Sophya package such as the simple persistence, serialisation mechanism through \b PPersist, \b POutPersist, \b PInPersist classes. It contains also few utility classes such as the \b NDataBlock, (template numerical arrays with reference counting and sharing) \b DataCards and \b PDynLinker (Dynamic link handler) classes. */ /*! \class SOPHYA::SophyaInitiator \ingroup SysTools Each Sophya module may contain an initialiser class which should be a sub-class of SophyaInitiator. */ SophyaInitiator::SophyaInitiator() { FgInit++; if (FgInit > 1) return; InitFailNewHandler(); #ifdef xx__mac__ //InitToolBox(); //SIOUXSettings.initializeTB = FALSE; SIOUXSettings.autocloseonquit = FALSE; SIOUXSettings.asktosaveonclose = FALSE; SIOUXSettings.showstatusline = TRUE; #endif PIOPersist::Initialize(); PPRegister(FIO_NDataBlock); DObjRegister(FIO_NDataBlock, NDataBlock); PPRegister(FIO_NDataBlock); DObjRegister(FIO_NDataBlock, NDataBlock); PPRegister(FIO_NDataBlock); DObjRegister(FIO_NDataBlock, NDataBlock); PPRegister(FIO_NDataBlock); DObjRegister(FIO_NDataBlock, NDataBlock); PPRegister(FIO_NDataBlock); DObjRegister(FIO_NDataBlock, NDataBlock); PPRegister(FIO_NDataBlock); DObjRegister(FIO_NDataBlock, NDataBlock); PPRegister(FIO_NDataBlock); DObjRegister(FIO_NDataBlock, NDataBlock); PPRegister(FIO_NDataBlock); DObjRegister(FIO_NDataBlock, NDataBlock); PPRegister(FIO_NDataBlock); DObjRegister(FIO_NDataBlock, NDataBlock); PPRegister(FIO_NDataBlock< complex >); DObjRegister(FIO_NDataBlock< complex >, NDataBlock< complex >); PPRegister(FIO_NDataBlock< complex >); DObjRegister(FIO_NDataBlock< complex >, NDataBlock< complex >); PPRegister(ObjFileIO); DObjRegister(ObjFileIO, DVList); #if (!defined(__GNUG__) && !defined(__MWERKS__) && !defined(HPUX)) // pas de bufferisation pour printf cmv 18/3/97 selon E.A. // setvbuf(stdout,NULL,_IOLBF,0); setvbuf(stderr,NULL,_IOLBF,0); setlinebuf(stdout); setlinebuf(stderr); #endif // si var env SOPHYA_NOPRTVER definie pas de print if(!getenv("SOPHYA_NOPRTVER")) Version(true); int pnice; char* snice = getenv("SOPHYA_NICE"); if (!snice) pnice=8; else pnice = atoi(snice); nice(pnice); } SophyaInitiator::~SophyaInitiator() { FgInit--; /* if (FgInit == 0) { delete PPersistMgr::classList; PPersistMgr::classList = NULL; delete PShPersist::objList; PShPersist::objList = NULL; } */ } double SophyaInitiator::Version(bool fgprt) { if (fgprt) { char* compiler = 0; #ifdef __GNUG__ compiler = "gcc " __VERSION__; #endif #ifdef __DECCXX compiler = "cxx " ; #endif #ifdef __aCC__ compiler = const_cast("HP-aCC ") ; #endif #ifdef __KCC__ compiler = const_cast("KCC ") ; #endif #ifdef __SGICC__ #ifdef SGI_ARCH64 compiler = const_cast("SGI-CC (-64) ") ; #else compiler = const_cast("SGI-CC ") ; #endif #endif #ifdef __MWERKS__ compiler = const_cast("Codewarrior "); #endif fprintf(stderr,"SOPHYA Version %4.1f Revision %d (%s) -- %s %s %s\n", SOPHYA_VERSION, SOPHYA_REVISION, SOPHYA_TAG, __DATE__, __TIME__, compiler); } return(SOPHYA_VERSION + (SOPHYA_REVISION/1000.)); } double SOPHYA::SophyaVersion() { return(SOPHYA_VERSION + (SOPHYA_REVISION/1000.)); } // On met un objet initiator en statique, pour les loaders qui savent // appeler le constructeur des objets statiques Reza 08/98 static SophyaInitiator psophyainit;