Blender V2.61 - r43446

MEM_sys_types.h

Go to the documentation of this file.
00001 /*
00002  * ***** BEGIN GPL LICENSE BLOCK *****
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License
00006  * as published by the Free Software Foundation; either version 2
00007  * of the License, or (at your option) any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software Foundation,
00016  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00017  *
00018  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
00019  * All rights reserved.
00020  *
00021  * The Original Code is: all of this file.
00022  *
00023  * Contributor(s): none yet.
00024  *
00025  * ***** END GPL LICENSE BLOCK *****
00026  */
00027 
00043 /* 
00044 // DG: original BLO_sys_types.h is in source/blender/blenkernel 
00045 // but is not allowed be accessed here because of bad-level-call
00046 // jesterKing: I've renamed this to MEM_sys_types.h, because otherwise
00047 // doxygen would get a conflict
00048 */
00049 
00050 #ifndef MEM_SYS_TYPES_H
00051 #define MEM_SYS_TYPES_H
00052 
00053 #ifdef __cplusplus
00054 extern "C" {
00055 #endif
00056  
00057 #if defined(_WIN32) && !defined(FREE_WINDOWS)
00058 
00059 /* The __intXX are built-in types of the visual complier! So we don't
00060  * need to include anything else here. */
00061 
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__) || defined(__OpenBSD__)
00092 
00093     /* Linux-i386, Linux-Alpha, Linux-ppc */
00094 #include <stdint.h>
00095 
00096 /* XXX */
00097 
00098 #ifndef UINT64_MAX
00099 # define UINT64_MAX     18446744073709551615
00100 typedef uint8_t   u_int8_t;
00101 typedef uint16_t  u_int16_t;
00102 typedef uint32_t  u_int32_t;
00103 typedef uint64_t  u_int64_t;
00104 #endif
00105 
00106 #elif defined (__APPLE__)
00107 
00108 #include <inttypes.h>
00109 
00110 #elif defined(FREE_WINDOWS)
00111 /* define htoln here, there must be a syntax error in winsock2.h in MinGW */
00112 unsigned long __attribute__((__stdcall__)) htonl(unsigned long);
00113 #include <stdint.h>
00114 
00115 #else
00116 
00117     /* FreeBSD, Solaris */
00118 #include <sys/types.h>
00119 
00120 #endif /* ifdef platform for types */
00121 
00122 
00123 #ifdef _WIN32
00124 #ifndef FREE_WINDOWS
00125 #ifndef htonl
00126 #define htonl(x) correctByteOrder(x)
00127 #endif
00128 #ifndef ntohl
00129 #define ntohl(x) correctByteOrder(x)
00130 #endif
00131 #endif
00132 #elif defined (__FreeBSD__) || defined (__OpenBSD__) 
00133 #include <sys/param.h>
00134 #elif defined (__APPLE__)
00135 #include <sys/types.h>
00136 #else  /* sun linux */
00137 #include <netinet/in.h>
00138 #endif /* ifdef platform for htonl/ntohl */
00139 
00140 #ifdef __cplusplus 
00141 }
00142 #endif
00143 
00144 #endif /* MEM_SYS_TYPES_H */
00145