Blender V2.61 - r43446

BKE_utildefines.h

Go to the documentation of this file.
00001 /* 
00002  *
00003  * ***** BEGIN GPL LICENSE BLOCK *****
00004  *
00005  * This program is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU General Public License
00007  * as published by the Free Software Foundation; either version 2
00008  * of the License, or (at your option) any later version.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software Foundation,
00017  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00018  *
00019  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
00020  * All rights reserved.
00021  *
00022  * The Original Code is: all of this file.
00023  *
00024  * Contributor(s): none yet.
00025  *
00026  * ***** END GPL LICENSE BLOCK *****
00027  */
00028 
00036 #ifndef BKE_UTILDEFINES_H
00037 #define BKE_UTILDEFINES_H
00038 
00039 #ifdef __cplusplus
00040 extern "C" {
00041 #endif
00042 
00043 /* these values need to be hardcoded in structs, dna does not recognize defines */
00044 /* also defined in DNA_space_types.h */
00045 #ifndef FILE_MAXDIR
00046 #define FILE_MAXDIR         160
00047 #define FILE_MAXFILE        80
00048 #define FILE_MAX            240
00049 #endif
00050 
00051 /* this weirdo pops up in two places ... */
00052 #if !defined(WIN32)
00053 #  ifndef O_BINARY
00054 #    define O_BINARY 0
00055 #  endif
00056 #endif
00057 
00058 /* INTEGER CODES */
00059 #ifdef __BIG_ENDIAN__
00060    /* Big Endian */
00061 #  define MAKE_ID(a,b,c,d) ( (int)(a)<<24 | (int)(b)<<16 | (c)<<8 | (d) )
00062 #else
00063    /* Little Endian */
00064 #  define MAKE_ID(a,b,c,d) ( (int)(d)<<24 | (int)(c)<<16 | (b)<<8 | (a) )
00065 #endif
00066 
00067 #define ID_NEW(a)       if( (a) && (a)->id.newid ) (a)= (void *)(a)->id.newid
00068 
00069 #define DATA MAKE_ID('D','A','T','A')
00070 #define GLOB MAKE_ID('G','L','O','B')
00071 
00072 #define DNA1 MAKE_ID('D','N','A','1')
00073 #define TEST MAKE_ID('T','E','S','T') /* used as preview between 'REND' and 'GLOB' */
00074 #define REND MAKE_ID('R','E','N','D')
00075 #define USER MAKE_ID('U','S','E','R')
00076 
00077 #define ENDB MAKE_ID('E','N','D','B')
00078 
00079 /* Bit operations */
00080 #define BTST(a,b)    ( ( (a) & 1<<(b) )!=0 )
00081 #define BNTST(a,b)   ( ( (a) & 1<<(b) )==0 )
00082 #define BTST2(a,b,c) ( BTST( (a), (b) ) || BTST( (a), (c) ) )
00083 #define BSET(a,b)    ( (a) | 1<<(b) )
00084 #define BCLR(a,b)    ( (a) & ~(1<<(b)) )
00085 /* bit-row */
00086 #define BROW(min, max)  (((max)>=31? 0xFFFFFFFF: (1<<(max+1))-1) - ((min)? ((1<<(min))-1):0) )
00087 
00088 #ifdef __cplusplus
00089 }
00090 #endif
00091 
00092 #endif // BKE_UTILDEFINES_H