2 # ---------------------------------------------------------------------
4 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
6 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
7 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
8 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
10 # This software is governed by the CeCILL-B license under French law and
11 # abiding by the rules of distribution of free software. You can use,
12 # modify and/ or redistribute the software under the terms of the CeCILL-B
13 # license as circulated by CEA, CNRS and INRIA at the following URL
14 # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
15 # or in the file LICENSE.txt.
17 # As a counterpart to the access to the source code and rights to copy,
18 # modify and redistribute granted by the license, users are provided only
19 # with a limited warranty and the software's author, the holder of the
20 # economic rights, and the successive licensors have only limited
23 # The fact that you are presently reading this means that you have had
24 # knowledge of the CeCILL-B license and that you accept its terms.
25 # ------------------------------------------------------------------------
28 /*=========================================================================
31 Module: $RCSfile: creaSystem.h,v $
33 Date: $Date: 2012/11/15 10:43:26 $
34 Version: $Revision: 1.16 $
35 =========================================================================*/
39 *\brief contains all the OS depending stuff
41 #ifndef __creaSystem_h__
42 #define __creaSystem_h__
44 #include "creaConfigure.h"
46 // We try for Visual 6..????
47 //#pragma warning( disable : 4786)
49 //-----------------------------------------------------------------------------
50 //This is needed when compiling in debug mode
52 // 'identifier' : class 'type' needs to have dll-interface to be used by
53 // clients of class 'type2'
54 #pragma warning ( disable : 4251 )
55 // non dll-interface class 'type' used as base for dll-interface class 'type2'
56 #pragma warning ( disable : 4275 )
57 // 'identifier' : identifier was truncated to 'number' characters in the
59 #pragma warning ( disable : 4786 )
60 //'identifier' : decorated name length exceeded, name was truncated
61 #pragma warning ( disable : 4503 )
62 // C++ exception specification ignored except to indicate a
63 // function is not __declspec(nothrow)
64 #pragma warning ( disable : 4290 )
65 // signed/unsigned mismatch
66 #pragma warning ( disable : 4018 )
67 // return type for 'identifier' is '' (ie; not a UDT or reference to UDT. Will
68 // produce errors if applied using infix notation
69 #pragma warning ( disable : 4284 )
70 // 'type' : forcing value to bool 'true' or 'false' (performance warning)
71 // //#pragma warning ( disable : 4800 )
75 #include <stdio.h> // for printf, ...
76 #include <iostream> // for cout, endl, ...
79 // Micro$oft related stuff
84 //#include <curses.h> // for getch
87 //-----------------------------------------------------------------------------
88 // Micro$oft shared library related stuff
90 // all the classes that must be visible outside the crea library
91 // should be defined as :
92 // class CREA_EXPORT ClassName
100 //&& defined(BUILD_SHARED_LIBS)
102 #define CREA_EXPORT2 export
108 #endif // defined(_WIN32) && defined(BUILD_SHARED_LIBS)
113 #if defined(_WIN32) && defined(CREA_BUILD_SHARED)
114 #ifdef CREA_EXPORT_SYMBOLS
115 #define CREA_EXPORT __declspec( dllexport )
117 #define CREA_EXPORT __declspec( dllimport )
119 #define CREA_CDECL __cdecl
123 #endif // defined(_WIN32) && defined(CREA_BUILD_SHARED)
128 #endif //__BORLANDC__
132 // ----------------------------------------------------------------------------
134 // ----------------------------------------------------------------------------
135 //#include "creaWx.h"
138 #ifdef _USE_WXWIDGETS_
139 #include "wx/wxprec.h"
140 #include <wx/datetime.h>
151 #endif //_USE_WXWIDGETS_
153 //-----------------------------------------------------------------------------
155 //-----------------------------------------------------------------------------
160 #include <windows.h> /* GetModuleFileName */
166 #define CREA_STRINGIFY(A) #A
167 #define CREA_STRINGIFY_SYMBOL(A) CREA_STRINGIFY(A)
171 CREA_EXPORT inline const std::string& CREA_CDECL GetVersionCREA()
173 static const std::string v(CREA_STRINGIFY_SYMBOL(CREA_VERSION));
179 //-----------------------------------------------------------------------------
181 //-----------------------------------------------------------------------------
184 typedef signed char int8_t;
185 typedef signed short int16_t;
186 typedef signed int int32_t;
187 typedef unsigned char uint8_t;
188 typedef unsigned short uint16_t;
189 typedef unsigned int uint32_t;
192 #include <inttypes.h>
196 #ifdef CMAKE_HAVE_STDINT_H
199 #ifdef CMAKE_HAVE_INTTYPES_H
200 // Old system only have this
201 #include <inttypes.h> // For uint8_t uint16_t and uint32_t
204 // Broken plateforms do not respect C99 and do not provide those typedef
205 // Special case for recent Borland compiler, comes with stdint.h
206 #if defined(_MSC_VER) || defined(__BORLANDC__) && (__BORLANDC__ < 0x0560) \
207 || defined(__MINGW32__)
208 typedef signed char int8_t;
209 typedef signed short int16_t;
210 typedef signed int int32_t;
211 typedef unsigned char uint8_t;
212 typedef unsigned short uint16_t;
213 typedef unsigned int uint32_t;
215 /// \todo Find a clever way to deal with int64_t, uint64_t
218 #error "Sorry your plateform is not supported"
219 #endif // defined(_MSC_VER) || defined(__BORLANDC__) && (__BORLANDC__ < 0x0560) || defined(__MINGW32__)
220 #endif // CMAKE_HAVE_INTTYPES_H
221 #endif // CMAKE_HAVE_STDINT_H
223 // Basically for VS6 and bcc 5.5.1:
225 #define UINT32_MAX (4294967295U)
228 //-----------------------------------------------------------------------------
231 //-----------------------------------------------------------------------------
235 /// System related stuff
238 /// returns true iff the program has a tty
241 CREA_EXPORT static void wtoc(const WCHAR* Source,CHAR* Dest);
243 CREA_EXPORT static int GetAppPath(char *pname, size_t pathsize);
244 CREA_EXPORT static std::string GetDllAppPath(std::string &nomdll);
245 CREA_EXPORT static std::string GetDllAppPath(const char *nomdll);
246 CREA_EXPORT static std::string GetExecutablePath();
247 CREA_EXPORT static void createDirectory(const char* directorypath);
251 //-----------------------------------------------------------------------------
255 #define VALID_FILE_SEPARATOR "\\"
256 #define INVALID_FILE_SEPARATOR "/"
258 #define INVALID_FILE_SEPARATOR "\\"
259 #define VALID_FILE_SEPARATOR "/"