source: Sophya/trunk/SophyaLib/BaseTools/sophyainit.cc@ 2186

Last change on this file since 2186 was 1900, checked in by ansari, 24 years ago

Portage sous Mac OS X - Reza 15/02/2002

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