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

Last change on this file since 1405 was 1249, checked in by ansari, 25 years ago

Gestion de l'architecture 64 bits de SGI - Reza 20/10/2000

File size: 4.2 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 \defgroup SysTools SysTools module
28 This module contains classes and functions which define the
29 general framework for \b Sophya package such as the simple
30 persistence, serialisation mechanism through \b PPersist,
31 \b POutPersist, \b PInPersist classes. It contains also
32 few utility classes such as the \b NDataBlock<T>, (template
33 numerical arrays with reference counting and sharing)
34 \b DataCards and \b PDynLinker (Dynamic link handler) classes.
35
36*/
37
38/*!
39 \class SOPHYA::SophyaInitiator
40 \ingroup SysTools
41 Each Sophya module may contain an initialiser class which should
42 be a sub-class of SophyaInitiator.
43*/
44
45SophyaInitiator::SophyaInitiator()
46{
47 FgInit++;
48 if (FgInit > 1) return;
49
50 InitFailNewHandler();
51
52 #ifdef xx__mac__
53 //InitToolBox();
54 //SIOUXSettings.initializeTB = FALSE;
55 SIOUXSettings.autocloseonquit = FALSE;
56 SIOUXSettings.asktosaveonclose = FALSE;
57 SIOUXSettings.showstatusline = TRUE;
58 #endif
59
60 PIOPersist::Initialize();
61 PPRegister(FIO_NDataBlock<uint_1>);
62 DObjRegister(FIO_NDataBlock<uint_1>, NDataBlock<uint_1>);
63 PPRegister(FIO_NDataBlock<uint_2>);
64 DObjRegister(FIO_NDataBlock<uint_2>, NDataBlock<uint_2>);
65 PPRegister(FIO_NDataBlock<int_2>);
66 DObjRegister(FIO_NDataBlock<int_2>, NDataBlock<int_2>);
67 PPRegister(FIO_NDataBlock<int_4>);
68 DObjRegister(FIO_NDataBlock<int_4>, NDataBlock<int_4>);
69 PPRegister(FIO_NDataBlock<int_8>);
70 DObjRegister(FIO_NDataBlock<int_8>, NDataBlock<int_8>);
71 PPRegister(FIO_NDataBlock<uint_4>);
72 DObjRegister(FIO_NDataBlock<uint_4>, NDataBlock<uint_4>);
73 PPRegister(FIO_NDataBlock<uint_8>);
74 DObjRegister(FIO_NDataBlock<uint_8>, NDataBlock<uint_8>);
75 PPRegister(FIO_NDataBlock<r_4>);
76 DObjRegister(FIO_NDataBlock<r_4>, NDataBlock<r_4>);
77 PPRegister(FIO_NDataBlock<r_8>);
78 DObjRegister(FIO_NDataBlock<r_8>, NDataBlock<r_8>);
79 PPRegister(FIO_NDataBlock< complex<r_4> >);
80 DObjRegister(FIO_NDataBlock< complex<r_4> >, NDataBlock< complex<r_4> >);
81 PPRegister(FIO_NDataBlock< complex<r_8> >);
82 DObjRegister(FIO_NDataBlock< complex<r_8> >, NDataBlock< complex<r_8> >);
83
84 PPRegister(ObjFileIO<DVList>);
85 DObjRegister(ObjFileIO<DVList>, DVList);
86
87
88#if (!defined(__GNUG__) && !defined(__MWERKS__) && !defined(HPUX))
89 // pas de bufferisation pour printf cmv 18/3/97 selon E.A.
90 // setvbuf(stdout,NULL,_IOLBF,0); setvbuf(stderr,NULL,_IOLBF,0);
91 setlinebuf(stdout);
92 setlinebuf(stderr);
93#endif
94
95 // si var env SOPHYA_NOPRTVER definie pas de print
96 if(!getenv("SOPHYA_NOPRTVER")) Version(true);
97
98 int pnice;
99 char* snice = getenv("SOPHYA_NICE");
100 if (!snice) pnice=8;
101 else pnice = atoi(snice);
102 nice(pnice);
103
104}
105
106SophyaInitiator::~SophyaInitiator()
107{
108 FgInit--;
109/*
110 if (FgInit == 0)
111 {
112 delete PPersistMgr::classList; PPersistMgr::classList = NULL;
113 delete PShPersist::objList; PShPersist::objList = NULL;
114 }
115 */
116}
117
118double SophyaInitiator::Version(bool fgprt)
119{
120if (fgprt) {
121 char* compiler = 0;
122 #ifdef __GNUG__
123 compiler = "gcc " __VERSION__;
124 #endif
125 #ifdef __DECCXX
126 compiler = "cxx " ;
127 #endif
128 #ifdef __aCC__
129 compiler = const_cast<char *>("HP-aCC ") ;
130 #endif
131 #ifdef __KCC__
132 compiler = const_cast<char *>("KCC ") ;
133 #endif
134 #ifdef __SGICC__
135 #ifdef SGI_ARCH64
136 compiler = const_cast<char *>("SGI-CC (-64) ") ;
137 #else
138 compiler = const_cast<char *>("SGI-CC ") ;
139 #endif
140 #endif
141 #ifdef __MWERKS__
142 compiler = const_cast<char *>("Codewarrior ");
143 #endif
144 fprintf(stderr,"SOPHYA Version %4.1f Revision %d (%s) -- %s %s %s\n",
145 SOPHYA_VERSION, SOPHYA_REVISION, SOPHYA_TAG,
146 __DATE__, __TIME__, compiler);
147}
148return(SOPHYA_VERSION + (SOPHYA_REVISION/1000.));
149}
150
151double SOPHYA::SophyaVersion()
152{
153return(SOPHYA_VERSION + (SOPHYA_REVISION/1000.));
154}
155
156// On met un objet initiator en statique, pour les loaders qui savent
157// appeler le constructeur des objets statiques Reza 08/98
158static SophyaInitiator psophyainit;
Note: See TracBrowser for help on using the repository browser.