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

Last change on this file since 1607 was 1607, checked in by cmv, 24 years ago

after base restructuration cmv 31/7/01

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