| [658] | 1 | #include "machdefs.h"
 | 
|---|
 | 2 | #include <stdlib.h>
 | 
|---|
 | 3 | #include <stdio.h>
 | 
|---|
 | 4 | #include <complex>
 | 
|---|
 | 5 | #include "pexceptions.h"
 | 
|---|
 | 6 | #include "ppersist.h"
 | 
|---|
 | 7 | #include "peidainit.h"
 | 
|---|
 | 8 | #include "ndatablock.h"
 | 
|---|
 | 9 | #include "sversion.h"
 | 
|---|
 | 10 | 
 | 
|---|
 | 11 | // ---  Classe d'initialisation de PEIDA++, (PPersistMgr en particulier)
 | 
|---|
 | 12 | int PeidaInitiator::FgInit = 0;
 | 
|---|
 | 13 | 
 | 
|---|
 | 14 | PeidaInitiator::PeidaInitiator()
 | 
|---|
 | 15 | {
 | 
|---|
 | 16 |   FgInit++;
 | 
|---|
 | 17 |   if (FgInit > 1)  return;
 | 
|---|
 | 18 | 
 | 
|---|
 | 19 |   InitFailNewHandler();
 | 
|---|
 | 20 | 
 | 
|---|
 | 21 |   #ifdef xx__mac__
 | 
|---|
 | 22 |   //InitToolBox();
 | 
|---|
 | 23 |   //SIOUXSettings.initializeTB = FALSE;
 | 
|---|
 | 24 |   SIOUXSettings.autocloseonquit = FALSE;
 | 
|---|
 | 25 |   SIOUXSettings.asktosaveonclose = FALSE;
 | 
|---|
 | 26 |   SIOUXSettings.showstatusline = TRUE;
 | 
|---|
 | 27 |   #endif
 | 
|---|
 | 28 | 
 | 
|---|
 | 29 |   PIOPersist::Initialize();
 | 
|---|
 | 30 |   PPRegister(FIO_NDataBlock<uint_1>);
 | 
|---|
 | 31 |   PPRegister(FIO_NDataBlock<uint_2>);
 | 
|---|
 | 32 |   PPRegister(FIO_NDataBlock<int_2>);
 | 
|---|
 | 33 |   PPRegister(FIO_NDataBlock<int_4>);
 | 
|---|
 | 34 |   PPRegister(FIO_NDataBlock<int_8>);
 | 
|---|
 | 35 |   PPRegister(FIO_NDataBlock<uint_4>);
 | 
|---|
 | 36 |   PPRegister(FIO_NDataBlock<uint_8>);
 | 
|---|
 | 37 |   PPRegister(FIO_NDataBlock<r_4>);
 | 
|---|
 | 38 |   PPRegister(FIO_NDataBlock<r_8>);
 | 
|---|
 | 39 |   PPRegister(FIO_NDataBlock< complex<float> >);
 | 
|---|
 | 40 |   PPRegister(FIO_NDataBlock< complex<double> >);
 | 
|---|
 | 41 | 
 | 
|---|
 | 42 | //DEL  PPersistMgr::classList = new PPersistMgr::ClassList;
 | 
|---|
 | 43 | //DEL  PShPersist::objList    = new PShPersist::ObjList;
 | 
|---|
 | 44 |   
 | 
|---|
 | 45 | 
 | 
|---|
 | 46 | #if (!defined(__GNUG__) && !defined(__MWERKS__) && !defined(HPUX))
 | 
|---|
 | 47 |   // pas de bufferisation pour printf   cmv 18/3/97 selon E.A.
 | 
|---|
 | 48 |   // setvbuf(stdout,NULL,_IOLBF,0); setvbuf(stderr,NULL,_IOLBF,0);
 | 
|---|
 | 49 |   setlinebuf(stdout);
 | 
|---|
 | 50 |   setlinebuf(stderr);
 | 
|---|
 | 51 | #endif
 | 
|---|
 | 52 | 
 | 
|---|
 | 53 |   // si var env PEIDA_NOPRTVER definie pas de print
 | 
|---|
 | 54 |   if(!getenv("SOPHYA_NOPRTVER")) Version(true);
 | 
|---|
 | 55 | }
 | 
|---|
 | 56 | 
 | 
|---|
 | 57 | PeidaInitiator::~PeidaInitiator()
 | 
|---|
 | 58 | {
 | 
|---|
 | 59 |   FgInit--;
 | 
|---|
 | 60 | /*
 | 
|---|
 | 61 |   if (FgInit == 0)
 | 
|---|
 | 62 |     {
 | 
|---|
 | 63 |     delete PPersistMgr::classList; PPersistMgr::classList = NULL;
 | 
|---|
 | 64 |     delete PShPersist::objList;    PShPersist::objList = NULL;
 | 
|---|
 | 65 |     }
 | 
|---|
 | 66 |     */
 | 
|---|
 | 67 | }
 | 
|---|
 | 68 | 
 | 
|---|
 | 69 | double PeidaInitiator::Version(bool fgprt)
 | 
|---|
 | 70 | {
 | 
|---|
 | 71 | if (fgprt) {
 | 
|---|
 | 72 |   char* compiler;
 | 
|---|
 | 73 |   #ifdef __GNUG__
 | 
|---|
 | 74 |   compiler = "gcc " __VERSION__;
 | 
|---|
 | 75 |   #endif
 | 
|---|
 | 76 |   #ifdef __DECCXX
 | 
|---|
 | 77 |   compiler = "cxx " ;
 | 
|---|
 | 78 |   #endif
 | 
|---|
 | 79 |   #ifdef __aCC__
 | 
|---|
 | 80 |   compiler = const_cast<char *>("HP-aCC ") ;
 | 
|---|
 | 81 |   #endif
 | 
|---|
 | 82 |   #ifdef __KCC__
 | 
|---|
 | 83 |   compiler = const_cast<char *>("KCC ") ;
 | 
|---|
 | 84 |   #endif
 | 
|---|
 | 85 |   #ifdef __SGICC__
 | 
|---|
 | 86 |   compiler = const_cast<char *>("SGI-CC ") ;
 | 
|---|
 | 87 |   #endif
 | 
|---|
 | 88 |   fprintf(stderr,"SOPHYA Version %4.1f Revision %d (%s) -- %s %s %s\n",
 | 
|---|
 | 89 |           SOPHYA_VERSION, SOPHYA_REVISION, SOPHYA_TAG,
 | 
|---|
 | 90 |           __DATE__, __TIME__, compiler);
 | 
|---|
 | 91 | }
 | 
|---|
 | 92 | return(SOPHYA_VERSION + (SOPHYA_REVISION/1000.));
 | 
|---|
 | 93 | }
 | 
|---|
 | 94 |  
 | 
|---|
 | 95 | // On met un objet initiator en statique, pour les loaders qui savent 
 | 
|---|
 | 96 | // appeler le constructeur des objets statiques   Reza 08/98
 | 
|---|
 | 97 | static PeidaInitiator ppeidainit;
 | 
|---|