|
Blender
V2.59
|
00001 /* 00002 * $Id: MEM_sys_types.h 36360 2011-04-28 05:15:47Z campbellbarton $ 00003 * 00004 * ***** BEGIN GPL LICENSE BLOCK ***** 00005 * 00006 * This program is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU General Public License 00008 * as published by the Free Software Foundation; either version 2 00009 * of the License, or (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software Foundation, 00018 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00019 * 00020 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. 00021 * All rights reserved. 00022 * 00023 * The Original Code is: all of this file. 00024 * 00025 * Contributor(s): none yet. 00026 * 00027 * ***** END GPL LICENSE BLOCK ***** 00028 * A platform-independent definition of [u]intXX_t 00029 * Plus the accompanying header include for htonl/ntohl 00030 * 00031 * This file includes <sys/types.h> to define [u]intXX_t types, where 00032 * XX can be 8, 16, 32 or 64. Unfortunately, not all systems have this 00033 * file. 00034 * - Windows uses __intXX compiler-builtin types. These are signed, 00035 * so we have to flip the signs. 00036 * For these rogue platforms, we make the typedefs ourselves. 00037 * 00038 */ 00039 00040 /* 00041 // DG: original BLO_sys_types.h is in source/blender/blenkernel 00042 // but is not allowed be accessed here because of bad-level-call 00043 // jesterKing: I've renamed this to MEM_sys_types.h, because otherwise 00044 // doxygen would get a conflict 00045 */ 00046 00051 #ifndef MEM_SYS_TYPES_H 00052 #define MEM_SYS_TYPES_H 00053 00054 #ifdef __cplusplus 00055 extern "C" { 00056 #endif 00057 00058 #if defined(_WIN32) && !defined(FREE_WINDOWS) 00059 00060 /* The __intXX are built-in types of the visual complier! So we don't 00061 * need to include anything else here. */ 00062 00063 typedef signed __int8 int8_t; 00064 typedef signed __int16 int16_t; 00065 typedef signed __int32 int32_t; 00066 typedef signed __int64 int64_t; 00067 00068 typedef unsigned __int8 uint8_t; 00069 typedef unsigned __int16 uint16_t; 00070 typedef unsigned __int32 uint32_t; 00071 typedef unsigned __int64 uint64_t; 00072 00073 #ifndef _INTPTR_T_DEFINED 00074 #ifdef _WIN64 00075 typedef __int64 intptr_t; 00076 #else 00077 typedef long intptr_t; 00078 #endif 00079 #define _INTPTR_T_DEFINED 00080 #endif 00081 00082 #ifndef _UINTPTR_T_DEFINED 00083 #ifdef _WIN64 00084 typedef unsigned __int64 uintptr_t; 00085 #else 00086 typedef unsigned long uintptr_t; 00087 #endif 00088 #define _UINTPTR_T_DEFINED 00089 #endif 00090 00091 #elif defined(__linux__) || defined(__NetBSD__) 00092 00093 /* Linux-i386, Linux-Alpha, Linux-ppc */ 00094 #include <stdint.h> 00095 00096 #elif defined (__APPLE__) 00097 00098 #include <inttypes.h> 00099 00100 #elif defined(FREE_WINDOWS) 00101 00102 #include <stdint.h> 00103 00104 #else 00105 00106 /* FreeBSD, Irix, Solaris */ 00107 #include <sys/types.h> 00108 00109 #endif /* ifdef platform for types */ 00110 00111 #ifdef _WIN32 00112 #ifndef htonl 00113 #define htonl(x) correctByteOrder(x) 00114 #endif 00115 #ifndef ntohl 00116 #define ntohl(x) correctByteOrder(x) 00117 #endif 00118 #elif defined (__FreeBSD__) || defined (__OpenBSD__) 00119 #include <sys/param.h> 00120 #elif defined (__APPLE__) 00121 #include <sys/types.h> 00122 #else /* irix sun linux */ 00123 #include <netinet/in.h> 00124 #endif /* ifdef platform for htonl/ntohl */ 00125 00126 #ifdef __cplusplus 00127 } 00128 #endif 00129 00130 #endif /* MEM_SYS_TYPES_H */ 00131