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

Last change on this file since 754 was 754, checked in by ansari, 26 years ago

Restruction de Sophya en modules plus petit (TArray , SkyMap, HiStats, ...)

Reza 2/3/2000

File size: 2.7 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 "ndatablock.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
21SophyaInitiator::SophyaInitiator()
22{
23 FgInit++;
24 if (FgInit > 1) return;
25
26 InitFailNewHandler();
27
28 #ifdef xx__mac__
29 //InitToolBox();
30 //SIOUXSettings.initializeTB = FALSE;
31 SIOUXSettings.autocloseonquit = FALSE;
32 SIOUXSettings.asktosaveonclose = FALSE;
33 SIOUXSettings.showstatusline = TRUE;
34 #endif
35
36 PIOPersist::Initialize();
37 PPRegister(FIO_NDataBlock<uint_1>);
38 PPRegister(FIO_NDataBlock<uint_2>);
39 PPRegister(FIO_NDataBlock<int_2>);
40 PPRegister(FIO_NDataBlock<int_4>);
41 PPRegister(FIO_NDataBlock<int_8>);
42 PPRegister(FIO_NDataBlock<uint_4>);
43 PPRegister(FIO_NDataBlock<uint_8>);
44 PPRegister(FIO_NDataBlock<r_4>);
45 PPRegister(FIO_NDataBlock<r_8>);
46 PPRegister(FIO_NDataBlock< complex<float> >);
47 PPRegister(FIO_NDataBlock< complex<double> >);
48
49 PPRegister(ObjFileIO<DVList>);
50
51
52#if (!defined(__GNUG__) && !defined(__MWERKS__) && !defined(HPUX))
53 // pas de bufferisation pour printf cmv 18/3/97 selon E.A.
54 // setvbuf(stdout,NULL,_IOLBF,0); setvbuf(stderr,NULL,_IOLBF,0);
55 setlinebuf(stdout);
56 setlinebuf(stderr);
57#endif
58
59 // si var env SOPHYA_NOPRTVER definie pas de print
60 if(!getenv("SOPHYA_NOPRTVER")) Version(true);
61
62 int pnice;
63 char* snice = getenv("SOPHYA_NICE");
64 if (!snice) pnice=8;
65 else pnice = atoi(snice);
66 nice(pnice);
67
68}
69
70SophyaInitiator::~SophyaInitiator()
71{
72 FgInit--;
73/*
74 if (FgInit == 0)
75 {
76 delete PPersistMgr::classList; PPersistMgr::classList = NULL;
77 delete PShPersist::objList; PShPersist::objList = NULL;
78 }
79 */
80}
81
82double SophyaInitiator::Version(bool fgprt)
83{
84if (fgprt) {
85 char* compiler = 0;
86 #ifdef __GNUG__
87 compiler = "gcc " __VERSION__;
88 #endif
89 #ifdef __DECCXX
90 compiler = "cxx " ;
91 #endif
92 #ifdef __aCC__
93 compiler = const_cast<char *>("HP-aCC ") ;
94 #endif
95 #ifdef __KCC__
96 compiler = const_cast<char *>("KCC ") ;
97 #endif
98 #ifdef __SGICC__
99 compiler = const_cast<char *>("SGI-CC ") ;
100 #endif
101 #ifdef __MWERKS__
102 compiler = const_cast<char *>("Codewarrior ");
103 #endif
104 fprintf(stderr,"SOPHYA Version %4.1f Revision %d (%s) -- %s %s %s\n",
105 SOPHYA_VERSION, SOPHYA_REVISION, SOPHYA_TAG,
106 __DATE__, __TIME__, compiler);
107}
108return(SOPHYA_VERSION + (SOPHYA_REVISION/1000.));
109}
110
111// On met un objet initiator en statique, pour les loaders qui savent
112// appeler le constructeur des objets statiques Reza 08/98
113static SophyaInitiator psophyainit;
Note: See TracBrowser for help on using the repository browser.