Blender  V2.59
imbuf.h
Go to the documentation of this file.
00001 /*
00002  * imbuf.h (mar-2001 nzc)
00003  *
00004  * This header might have to become external...
00005  *
00006  * $Id: imbuf.h 35239 2011-02-27 20:23:21Z jesterking $ 
00007  *
00008  * ***** BEGIN GPL LICENSE BLOCK *****
00009  *
00010  * This program is free software; you can redistribute it and/or
00011  * modify it under the terms of the GNU General Public License
00012  * as published by the Free Software Foundation; either version 2
00013  * of the License, or (at your option) any later version.
00014  *
00015  * This program is distributed in the hope that it will be useful,
00016  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  * GNU General Public License for more details.
00019  *
00020  * You should have received a copy of the GNU General Public License
00021  * along with this program; if not, write to the Free Software Foundation,
00022  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00023  *
00024  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
00025  * All rights reserved.
00026  *
00027  * The Original Code is: all of this file.
00028  *
00029  * Contributor(s): none yet.
00030  *
00031  * ***** END GPL LICENSE BLOCK *****
00032  */
00033 
00039 #ifndef IMBUF_H
00040 #define IMBUF_H
00041 
00042 #include <stdlib.h>
00043 #include <sys/types.h>
00044 #include <stdio.h> 
00045 
00046 #ifndef WIN32
00047 #include <unistd.h> 
00048 #endif
00049 
00050 #include <fcntl.h>
00051 #include <sys/stat.h>
00052 #include <string.h>
00053 #include <math.h>
00054 
00055 #ifndef WIN32
00056 #include <sys/mman.h>
00057 #endif
00058 
00059 #if !defined(WIN32)
00060 #define O_BINARY 0
00061 #endif
00062 
00063 #define SWAP_SHORT(x) (((x & 0xff) << 8) | ((x >> 8) & 0xff))
00064 #define SWAP_LONG(x) (((x) << 24) | (((x) & 0xff00) << 8) | (((x) >> 8) & 0xff00) | (((x) >> 24) & 0xff))
00065 
00066 #define ENDIAN_NOP(x) (x)
00067 
00068 #if defined(__sgi) || defined(__sparc) || defined(__sparc__) || defined (__PPC__) || defined (__hppa__) || (defined (__APPLE__) && !defined(__LITTLE_ENDIAN__))
00069 #define LITTLE_SHORT SWAP_SHORT
00070 #define LITTLE_LONG SWAP_LONG
00071 #define BIG_SHORT ENDIAN_NOP
00072 #define BIG_LONG ENDIAN_NOP
00073 #else
00074 #define LITTLE_SHORT ENDIAN_NOP
00075 #define LITTLE_LONG ENDIAN_NOP
00076 #define BIG_SHORT SWAP_SHORT
00077 #define BIG_LONG SWAP_LONG
00078 #endif
00079 
00080 typedef unsigned char uchar;
00081 
00082 #define TRUE 1
00083 #define FALSE 0
00084 
00085 #endif  /* IMBUF_H */
00086