bbtkSystem.h

Go to the documentation of this file.
00001 /*=========================================================================                                                                               
00002   Program:   bbtk
00003   Module:    $RCSfile: bbtkSystem.h,v $
00004   Language:  C++
00005   Date:      $Date: 2008/10/17 08:18:14 $
00006   Version:   $Revision: 1.9 $
00007 =========================================================================*/
00008 
00009 /* ---------------------------------------------------------------------
00010 
00011 * Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale)
00012 * Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux
00013 *
00014 *  This software is governed by the CeCILL-B license under French law and 
00015 *  abiding by the rules of distribution of free software. You can  use, 
00016 *  modify and/ or redistribute the software under the terms of the CeCILL-B 
00017 *  license as circulated by CEA, CNRS and INRIA at the following URL 
00018 *  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 
00019 *  or in the file LICENSE.txt.
00020 *
00021 *  As a counterpart to the access to the source code and  rights to copy,
00022 *  modify and redistribute granted by the license, users are provided only
00023 *  with a limited warranty  and the software's author,  the holder of the
00024 *  economic rights,  and the successive licensors  have only  limited
00025 *  liability. 
00026 *
00027 *  The fact that you are presently reading this means that you have had
00028 *  knowledge of the CeCILL-B license and that you accept its terms.
00029 * ------------------------------------------------------------------------ */                                                                         
00030 
00031 
00036 #ifndef __bbtkSystem_h__
00037 #define __bbtkSystem_h__
00038 
00039 #include "bbtkConfigure.h"
00040 
00041 // We try for Visual 6..????
00042 //#pragma warning( disable : 4786)
00043 
00044 
00045 
00046 //-----------------------------------------------------------------------------
00047 //This is needed when compiling in debug mode
00048 #ifdef _MSC_VER
00049 // 'identifier' : class 'type' needs to have dll-interface to be used by
00050 // clients of class 'type2'
00051 #pragma warning ( disable : 4251 )
00052 // non dll-interface class 'type' used as base for dll-interface class 'type2'
00053 #pragma warning ( disable : 4275 )
00054 // 'identifier' : identifier was truncated to 'number' characters in the
00055 // debug information
00056 #pragma warning ( disable : 4786 )
00057 //'identifier' : decorated name length exceeded, name was truncated
00058 #pragma warning ( disable : 4503 )
00059 // C++ exception specification ignored except to indicate a 
00060 // function is not __declspec(nothrow)
00061 #pragma warning ( disable : 4290 )
00062 // signed/unsigned mismatch
00063 #pragma warning ( disable : 4018 )
00064 // return type for 'identifier' is '' (ie; not a UDT or reference to UDT. Will
00065 // produce errors if applied using infix notation
00066 #pragma warning ( disable : 4284 )
00067 // 'type' : forcing value to bool 'true' or 'false' (performance warning)
00068 // //#pragma warning ( disable : 4800 )
00069 #endif //_MSC_VER
00070 
00071 
00072 #include <stdio.h>  // for printf, ...
00073 #include <iostream> // for cout, endl, ...
00074 
00075 #ifdef _MSC_VER
00076 // Micro$oft related stuff
00077 #pragma once
00078 #include <conio.h>
00079 #include <tchar.h>
00080 #else
00081 //#include  <curses.h> // for getch
00082 #endif //_MSC_VER
00083 
00084 //-----------------------------------------------------------------------------
00085 // Micro$oft shared library related stuff
00086 //
00087 // all the classes that must be visible outside the bbtk library 
00088 // should be defined as :
00089 // class BBTK_EXPORT ClassName 
00090 // instead of :
00091 // class ClassName
00092 
00093 
00094 
00095 
00096 #if defined(_WIN32) 
00097 //&& defined(BUILD_SHARED_LIBS)
00098 //#include "WWW.h"
00099   #ifdef BBTK_EXPORT_SYMBOLS
00100     #define BBTK_EXPORT __declspec( dllexport )
00101 #else
00102     #define BBTK_EXPORT __declspec( dllimport )
00103   #endif
00104   #define BBTK_CDECL __cdecl
00105 #else
00106   #define BBTK_EXPORT
00107   #define BBTK_CDECL
00108 #endif // defined(_WIN32) && defined(BUILD_SHARED_LIBS)
00109 
00110 
00111 
00112 #ifdef __BORLANDC__
00113 #include <mem.h>
00114 #endif //__BORLANDC__
00115 
00116 
00117 
00118 
00119 
00120 //-----------------------------------------------------------------------------
00121 // Version
00122 #include <string.h>
00123 
00124 namespace bbtk
00125 {
00126 #define BBTK_STRINGIFY(A) #A
00127 #define BBTK_STRINGIFY_SYMBOL(A) BBTK_STRINGIFY(A)
00128 
00129   extern "C" 
00130   {
00131     BBTK_EXPORT inline const std::string& BBTK_CDECL GetVersion() 
00132     {
00133       static const std::string v(BBTK_STRINGIFY_SYMBOL(BBTK_VERSION));
00134       return v;
00135     }
00136   }
00137 
00138 }
00139 //-----------------------------------------------------------------------------
00140 
00141 
00142 
00143 
00144 //-----------------------------------------------------------------------------
00145 /*
00146 #ifdef _WIN32
00147 typedef  signed char         int8_t;
00148 typedef  signed short        int16_t;
00149 typedef  signed int          int32_t;
00150 typedef  unsigned char       uint8_t;
00151 typedef  unsigned short      uint16_t;
00152 typedef  unsigned int        uint32_t;
00153 #else 
00154 #include <stdint.h>
00155 #include <inttypes.h> 
00156 #endif
00157 */
00158 
00159 #ifdef CMAKE_HAVE_STDINT_H
00160    #include <stdint.h>
00161 #else
00162 #ifdef CMAKE_HAVE_INTTYPES_H
00163    // Old system only have this
00164    #include <inttypes.h>   // For uint8_t uint16_t and uint32_t
00165 #else
00166    //#include "XXX.h"
00167 // Broken plateforms do not respect C99 and do not provide those typedef
00168 // Special case for recent Borland compiler, comes with stdint.h
00169 #if defined(_MSC_VER) || defined(__BORLANDC__) && (__BORLANDC__ < 0x0560)  \
00170                       || defined(__MINGW32__)
00171 typedef  signed char         int8_t;
00172 typedef  signed short        int16_t;
00173 typedef  signed int          int32_t;
00174 typedef  unsigned char       uint8_t;
00175 typedef  unsigned short      uint16_t;
00176 typedef  unsigned int        uint32_t;
00177 
00179 
00180 #else
00181 #error "Sorry your plateform is not supported"
00182 #endif // defined(_MSC_VER) || defined(__BORLANDC__) && (__BORLANDC__ < 0x0560)  || defined(__MINGW32__)
00183 #endif // CMAKE_HAVE_INTTYPES_H
00184 #endif // CMAKE_HAVE_STDINT_H
00185 
00186 // Basically for VS6 and bcc 5.5.1:
00187 #ifndef UINT32_MAX
00188 #define UINT32_MAX    (4294967295U)
00189 #endif
00190 
00191 
00192 
00193 //-----------------------------------------------------------------------------
00194 
00195 
00196 //-----------------------------------------------------------------------------
00197 namespace bbtk
00198 {
00199  
00201   struct System
00202   {
00204     static int HasTTY(); 
00205   };
00206 
00207 } // namespace bbtk
00208 //-----------------------------------------------------------------------------
00209 
00210     // file separator
00211 #if defined(_WIN32)
00212 #define VALID_FILE_SEPARATOR "\\"
00213 #define INVALID_FILE_SEPARATOR "/"
00214 #else
00215 #define INVALID_FILE_SEPARATOR "\\"
00216 #define VALID_FILE_SEPARATOR "/"
00217 #endif
00218 
00219 #endif

Generated on Wed Nov 12 11:37:08 2008 for BBTK by  doxygen 1.5.6