[2615] | 1 | #include "sopnamsp.h"
|
---|
[754] | 2 | #include "machdefs.h"
|
---|
| 3 |
|
---|
| 4 | #include <unistd.h>
|
---|
| 5 | #include <stdlib.h>
|
---|
| 6 | #include <stdio.h>
|
---|
| 7 | #include <complex>
|
---|
| 8 |
|
---|
| 9 | #include "sophyainit.h"
|
---|
| 10 |
|
---|
| 11 | #include "pexceptions.h"
|
---|
| 12 |
|
---|
| 13 | #include "ppersist.h"
|
---|
[802] | 14 | #include "fiondblock.h"
|
---|
[754] | 15 | #include "dvlist.h"
|
---|
| 16 |
|
---|
| 17 | #include "sversion.h"
|
---|
| 18 |
|
---|
| 19 | // --- Classe d'initialisation de SOPHYA, (PPersistMgr en particulier)
|
---|
| 20 | int SophyaInitiator::FgInit = 0;
|
---|
| 21 |
|
---|
[913] | 22 | /*!
|
---|
| 23 | \namespace SOPHYA
|
---|
| 24 | \brief This is the namespace for the whole Sophya package
|
---|
| 25 | */
|
---|
| 26 |
|
---|
| 27 | /*!
|
---|
| 28 | \class SOPHYA::SophyaInitiator
|
---|
[1607] | 29 | \ingroup BaseTools
|
---|
[913] | 30 | Each Sophya module may contain an initialiser class which should
|
---|
| 31 | be a sub-class of SophyaInitiator.
|
---|
| 32 | */
|
---|
| 33 |
|
---|
[754] | 34 | SophyaInitiator::SophyaInitiator()
|
---|
| 35 | {
|
---|
[1900] | 36 | #if defined(Darwin)
|
---|
| 37 | // Il semble y avoir un probleme sous MacOSX ...
|
---|
| 38 | if (FgInit == 0)
|
---|
| 39 | cout << " SophyaInitiator::SophyaInitiator() BaseTools Init" << endl;
|
---|
| 40 | #endif
|
---|
[754] | 41 | FgInit++;
|
---|
| 42 | if (FgInit > 1) return;
|
---|
| 43 |
|
---|
| 44 | InitFailNewHandler();
|
---|
| 45 |
|
---|
| 46 | #ifdef xx__mac__
|
---|
| 47 | //InitToolBox();
|
---|
| 48 | //SIOUXSettings.initializeTB = FALSE;
|
---|
| 49 | SIOUXSettings.autocloseonquit = FALSE;
|
---|
| 50 | SIOUXSettings.asktosaveonclose = FALSE;
|
---|
| 51 | SIOUXSettings.showstatusline = TRUE;
|
---|
| 52 | #endif
|
---|
| 53 |
|
---|
| 54 | PIOPersist::Initialize();
|
---|
| 55 | PPRegister(FIO_NDataBlock<uint_1>);
|
---|
[802] | 56 | DObjRegister(FIO_NDataBlock<uint_1>, NDataBlock<uint_1>);
|
---|
[754] | 57 | PPRegister(FIO_NDataBlock<uint_2>);
|
---|
[802] | 58 | DObjRegister(FIO_NDataBlock<uint_2>, NDataBlock<uint_2>);
|
---|
[754] | 59 | PPRegister(FIO_NDataBlock<int_2>);
|
---|
[802] | 60 | DObjRegister(FIO_NDataBlock<int_2>, NDataBlock<int_2>);
|
---|
[754] | 61 | PPRegister(FIO_NDataBlock<int_4>);
|
---|
[802] | 62 | DObjRegister(FIO_NDataBlock<int_4>, NDataBlock<int_4>);
|
---|
[754] | 63 | PPRegister(FIO_NDataBlock<int_8>);
|
---|
[802] | 64 | DObjRegister(FIO_NDataBlock<int_8>, NDataBlock<int_8>);
|
---|
[754] | 65 | PPRegister(FIO_NDataBlock<uint_4>);
|
---|
[802] | 66 | DObjRegister(FIO_NDataBlock<uint_4>, NDataBlock<uint_4>);
|
---|
[754] | 67 | PPRegister(FIO_NDataBlock<uint_8>);
|
---|
[802] | 68 | DObjRegister(FIO_NDataBlock<uint_8>, NDataBlock<uint_8>);
|
---|
[754] | 69 | PPRegister(FIO_NDataBlock<r_4>);
|
---|
[802] | 70 | DObjRegister(FIO_NDataBlock<r_4>, NDataBlock<r_4>);
|
---|
[754] | 71 | PPRegister(FIO_NDataBlock<r_8>);
|
---|
[802] | 72 | DObjRegister(FIO_NDataBlock<r_8>, NDataBlock<r_8>);
|
---|
| 73 | PPRegister(FIO_NDataBlock< complex<r_4> >);
|
---|
| 74 | DObjRegister(FIO_NDataBlock< complex<r_4> >, NDataBlock< complex<r_4> >);
|
---|
| 75 | PPRegister(FIO_NDataBlock< complex<r_8> >);
|
---|
| 76 | DObjRegister(FIO_NDataBlock< complex<r_8> >, NDataBlock< complex<r_8> >);
|
---|
[754] | 77 |
|
---|
| 78 | PPRegister(ObjFileIO<DVList>);
|
---|
[802] | 79 | DObjRegister(ObjFileIO<DVList>, DVList);
|
---|
[754] | 80 |
|
---|
| 81 |
|
---|
| 82 | #if (!defined(__GNUG__) && !defined(__MWERKS__) && !defined(HPUX))
|
---|
| 83 | // pas de bufferisation pour printf cmv 18/3/97 selon E.A.
|
---|
| 84 | // setvbuf(stdout,NULL,_IOLBF,0); setvbuf(stderr,NULL,_IOLBF,0);
|
---|
| 85 | setlinebuf(stdout);
|
---|
| 86 | setlinebuf(stderr);
|
---|
| 87 | #endif
|
---|
| 88 |
|
---|
| 89 | // si var env SOPHYA_NOPRTVER definie pas de print
|
---|
| 90 | if(!getenv("SOPHYA_NOPRTVER")) Version(true);
|
---|
| 91 |
|
---|
| 92 | int pnice;
|
---|
| 93 | char* snice = getenv("SOPHYA_NICE");
|
---|
| 94 | if (!snice) pnice=8;
|
---|
| 95 | else pnice = atoi(snice);
|
---|
| 96 | nice(pnice);
|
---|
| 97 |
|
---|
| 98 | }
|
---|
| 99 |
|
---|
| 100 | SophyaInitiator::~SophyaInitiator()
|
---|
| 101 | {
|
---|
| 102 | FgInit--;
|
---|
| 103 | /*
|
---|
| 104 | if (FgInit == 0)
|
---|
| 105 | {
|
---|
| 106 | delete PPersistMgr::classList; PPersistMgr::classList = NULL;
|
---|
| 107 | delete PShPersist::objList; PShPersist::objList = NULL;
|
---|
| 108 | }
|
---|
| 109 | */
|
---|
| 110 | }
|
---|
| 111 |
|
---|
| 112 | double SophyaInitiator::Version(bool fgprt)
|
---|
| 113 | {
|
---|
| 114 | if (fgprt) {
|
---|
| 115 | char* compiler = 0;
|
---|
| 116 | #ifdef __GNUG__
|
---|
| 117 | compiler = "gcc " __VERSION__;
|
---|
| 118 | #endif
|
---|
| 119 | #ifdef __DECCXX
|
---|
| 120 | compiler = "cxx " ;
|
---|
| 121 | #endif
|
---|
| 122 | #ifdef __aCC__
|
---|
| 123 | compiler = const_cast<char *>("HP-aCC ") ;
|
---|
| 124 | #endif
|
---|
| 125 | #ifdef __KCC__
|
---|
| 126 | compiler = const_cast<char *>("KCC ") ;
|
---|
| 127 | #endif
|
---|
| 128 | #ifdef __SGICC__
|
---|
[1249] | 129 | #ifdef SGI_ARCH64
|
---|
| 130 | compiler = const_cast<char *>("SGI-CC (-64) ") ;
|
---|
| 131 | #else
|
---|
[754] | 132 | compiler = const_cast<char *>("SGI-CC ") ;
|
---|
| 133 | #endif
|
---|
[1249] | 134 | #endif
|
---|
[754] | 135 | #ifdef __MWERKS__
|
---|
| 136 | compiler = const_cast<char *>("Codewarrior ");
|
---|
| 137 | #endif
|
---|
| 138 | fprintf(stderr,"SOPHYA Version %4.1f Revision %d (%s) -- %s %s %s\n",
|
---|
| 139 | SOPHYA_VERSION, SOPHYA_REVISION, SOPHYA_TAG,
|
---|
| 140 | __DATE__, __TIME__, compiler);
|
---|
| 141 | }
|
---|
| 142 | return(SOPHYA_VERSION + (SOPHYA_REVISION/1000.));
|
---|
| 143 | }
|
---|
[1157] | 144 |
|
---|
| 145 | double SOPHYA::SophyaVersion()
|
---|
| 146 | {
|
---|
| 147 | return(SOPHYA_VERSION + (SOPHYA_REVISION/1000.));
|
---|
| 148 | }
|
---|
[754] | 149 |
|
---|
| 150 | // On met un objet initiator en statique, pour les loaders qui savent
|
---|
| 151 | // appeler le constructeur des objets statiques Reza 08/98
|
---|
[2430] | 152 | #if !defined(Darwin)
|
---|
| 153 | // La presence de l'objet statique psophyainit semble poserun probleme
|
---|
| 154 | // sur MacOSX 10.2 qui se plante a l'initialisation avec les shared-libs
|
---|
[754] | 155 | static SophyaInitiator psophyainit;
|
---|
[2430] | 156 | #endif
|
---|