blocxx
|
00001 /******************************************************************************* 00002 * Copyright (C) 2005, Vintela, Inc. All rights reserved. 00003 * Copyright (C) 2006, Novell, Inc. All rights reserved. 00004 * 00005 * Redistribution and use in source and binary forms, with or without 00006 * modification, are permitted provided that the following conditions are met: 00007 * 00008 * * Redistributions of source code must retain the above copyright notice, 00009 * this list of conditions and the following disclaimer. 00010 * * Redistributions in binary form must reproduce the above copyright 00011 * notice, this list of conditions and the following disclaimer in the 00012 * documentation and/or other materials provided with the distribution. 00013 * * Neither the name of 00014 * Vintela, Inc., 00015 * nor Novell, Inc., 00016 * nor the names of its contributors or employees may be used to 00017 * endorse or promote products derived from this software without 00018 * specific prior written permission. 00019 * 00020 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00021 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00022 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00023 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 00024 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 00025 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 00026 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00027 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00028 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 00029 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00030 * POSSIBILITY OF SUCH DAMAGE. 00031 *******************************************************************************/ 00032 00033 00039 #ifndef BLOCXX_TYPES_HPP_INCLUDE_GUARD_ 00040 #define BLOCXX_TYPES_HPP_INCLUDE_GUARD_ 00041 #include "blocxx/BLOCXX_config.h" 00042 00043 #ifdef BLOCXX_WIN32 00044 00045 #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 00046 #include <wtypes.h> 00047 00048 #ifdef max 00049 #undef max 00050 #endif 00051 00052 #endif 00053 00054 #ifndef __cplusplus 00055 #error "BLOCXX_Types.hpp can only be included by c++ files" 00056 #endif 00057 00058 extern "C" 00059 { 00060 #include <sys/types.h> 00061 } 00062 00063 namespace BLOCXX_NAMESPACE 00064 { 00065 00066 typedef unsigned char UInt8; 00067 typedef signed char Int8; 00068 #if BLOCXX_SIZEOF_SHORT_INT == 2 00069 typedef unsigned short UInt16; 00070 typedef short Int16; 00071 #define BLOCXX_INT16_IS_SHORT 1 00072 #elif BLOCXX_SIZEOF_INT == 2 00073 typedef unsigned int UInt16; 00074 typedef int Int16; 00075 #define BLOCXX_INT16_IS_INT 1 00076 #endif 00077 #if BLOCXX_SIZEOF_INT == 4 00078 typedef unsigned int UInt32; 00079 typedef int Int32; 00080 #define BLOCXX_INT32_IS_INT 1 00081 #elif BLOCXX_SIZEOF_LONG_INT == 4 00082 typedef unsigned long UInt32; 00083 typedef long Int32; 00084 #define BLOCXX_INT32_IS_LONG 1 00085 #endif 00086 #if BLOCXX_SIZEOF_LONG_INT == 8 00087 typedef unsigned long UInt64; 00088 typedef long Int64; 00089 #define BLOCXX_INT64_IS_LONG 1 00090 #elif BLOCXX_SIZEOF_LONG_LONG_INT == 8 00091 typedef unsigned long long UInt64; 00092 typedef long long Int64; 00093 #define BLOCXX_INT64_IS_LONG_LONG 1 00094 #else 00095 #error "Compiler must support 64 bit long" 00096 #endif 00097 #if BLOCXX_SIZEOF_DOUBLE == 8 00098 typedef double Real64; 00099 #define BLOCXX_REAL64_IS_DOUBLE 1 00100 #elif BLOCXX_SIZEOF_LONG_DOUBLE == 8 00101 typedef long double Real64; 00102 #define BLOCXX_REAL64_IS_LONG_DOUBLE 1 00103 #endif 00104 #if BLOCXX_SIZEOF_FLOAT == 4 00105 typedef float Real32; 00106 #define BLOCXX_REAL32_IS_FLOAT 1 00107 #elif BLOCXX_SIZEOF_DOUBLE == 4 00108 typedef double Real32; 00109 #define BLOCXX_REAL32_IS_DOUBLE 1 00110 #endif 00111 00112 #ifdef BLOCXX_WIN32 00113 00114 typedef HANDLE FileHandle; 00115 typedef HANDLE Descriptor; 00116 #define BLOCXX_INVALID_HANDLE INVALID_HANDLE_VALUE 00117 #define BLOCXX_INVALID_FILEHANDLE INVALID_HANDLE_VALUE 00118 typedef PSID UserId; 00119 typedef PSID uid_t; 00120 typedef PSID gid_t; 00121 typedef int mode_t; 00122 typedef long ssize_t; 00123 typedef HANDLE pid_t; 00124 typedef HANDLE ProcId; 00125 typedef struct {} siginfo_t; 00126 00127 #define BLOCXX_SHAREDLIB_EXTENSION ".dll" 00128 #define BLOCXX_FILENAME_SEPARATOR "\\" 00129 #define BLOCXX_FILENAME_SEPARATOR_C '\\' 00130 #define BLOCXX_PATHNAME_SEPARATOR ";" 00131 00132 #else //ifdef BLOCXX_WIN32 00133 00134 typedef int FileHandle; 00135 typedef int Descriptor; 00136 #define BLOCXX_INVALID_HANDLE -1 00137 #define BLOCXX_INVALID_FILEHANDLE -1 00138 typedef uid_t UserId; 00139 typedef pid_t ProcId; 00140 00141 #if defined BLOCXX_DARWIN 00142 #define BLOCXX_SHAREDLIB_EXTENSION ".dylib.bundle" 00143 #elif defined BLOCXX_HPUX && !defined(BLOCXX_ARCH_IA64) 00144 #define BLOCXX_SHAREDLIB_EXTENSION ".sl" 00145 #elif defined BLOCXX_HPUX 00146 #define BLOCXX_SHAREDLIB_EXTENSION ".so" 00147 #elif defined BLOCXX_NETWARE 00148 #define BLOCXX_SHAREDLIB_EXTENSION ".nlm" 00149 #else 00150 #define BLOCXX_SHAREDLIB_EXTENSION ".so" 00151 #endif 00152 00153 #define BLOCXX_FILENAME_SEPARATOR "/" 00154 #define BLOCXX_FILENAME_SEPARATOR_C '/' 00155 #define BLOCXX_PATHNAME_SEPARATOR ":" 00156 #endif //ifdef BLOCXX_WIN32 00157 00158 } // end namespace BLOCXX_NAMESPACE 00159 00160 #endif