• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* Copyright (C) 2006-2009 Charlie C & Erwin Coumans http://gamekit.googlecode.com
2 *
3 * This software is provided 'as-is', without any express or implied
4 * warranty.  In no event will the authors be held liable for any damages
5 * arising from the use of this software.
6 *
7 * Permission is granted to anyone to use this software for any purpose,
8 * including commercial applications, and to alter it and redistribute it
9 * freely, subject to the following restrictions:
10 *
11 * 1. The origin of this software must not be misrepresented; you must not
12 *    claim that you wrote the original software. If you use this software
13 *    in a product, an acknowledgment in the product documentation would be
14 *    appreciated but is not required.
15 * 2. Altered source versions must be plainly marked as such, and must not be
16 *    misrepresented as being the original software.
17 * 3. This notice may not be removed or altered from any source distribution.
18 */
19 #ifndef __B_DEFINES_H__
20 #define __B_DEFINES_H__
21 
22 
23 // MISC defines, see BKE_global.h, BKE_utildefines.h
24 #define SIZEOFBLENDERHEADER 12
25 
26 
27 // ------------------------------------------------------------
28 #if defined(__sgi) || defined (__sparc) || defined (__sparc__) || defined (__PPC__) || defined (__ppc__) || defined (__BIG_ENDIAN__)
29 #	define MAKE_ID(a,b,c,d) ( (int)(a)<<24 | (int)(b)<<16 | (c)<<8 | (d) )
30 #else
31 #	define MAKE_ID(a,b,c,d) ( (int)(d)<<24 | (int)(c)<<16 | (b)<<8 | (a) )
32 #endif
33 
34 
35 // ------------------------------------------------------------
36 #if defined(__sgi) || defined(__sparc) || defined(__sparc__) || defined (__PPC__) || defined (__ppc__) || defined (__BIG_ENDIAN__)
37 #	define MAKE_ID2(c, d) ( (c)<<8 | (d) )
38 #	define MOST_SIG_BYTE   0
39 #	define BBIG_ENDIAN
40 #else
41 #	define MAKE_ID2(c, d) ( (d)<<8 | (c) )
42 #	define MOST_SIG_BYTE  1
43 #	define BLITTLE_ENDIAN
44 #endif
45 
46 // ------------------------------------------------------------
47 #define ID_SCE		MAKE_ID2('S', 'C')
48 #define ID_LI		MAKE_ID2('L', 'I')
49 #define ID_OB		MAKE_ID2('O', 'B')
50 #define ID_ME		MAKE_ID2('M', 'E')
51 #define ID_CU		MAKE_ID2('C', 'U')
52 #define ID_MB		MAKE_ID2('M', 'B')
53 #define ID_MA		MAKE_ID2('M', 'A')
54 #define ID_TE		MAKE_ID2('T', 'E')
55 #define ID_IM		MAKE_ID2('I', 'M')
56 #define ID_IK		MAKE_ID2('I', 'K')
57 #define ID_WV		MAKE_ID2('W', 'V')
58 #define ID_LT		MAKE_ID2('L', 'T')
59 #define ID_SE		MAKE_ID2('S', 'E')
60 #define ID_LF		MAKE_ID2('L', 'F')
61 #define ID_LA		MAKE_ID2('L', 'A')
62 #define ID_CA		MAKE_ID2('C', 'A')
63 #define ID_IP		MAKE_ID2('I', 'P')
64 #define ID_KE		MAKE_ID2('K', 'E')
65 #define ID_WO		MAKE_ID2('W', 'O')
66 #define ID_SCR		MAKE_ID2('S', 'R')
67 #define ID_VF		MAKE_ID2('V', 'F')
68 #define ID_TXT		MAKE_ID2('T', 'X')
69 #define ID_SO		MAKE_ID2('S', 'O')
70 #define ID_SAMPLE	MAKE_ID2('S', 'A')
71 #define ID_GR		MAKE_ID2('G', 'R')
72 #define ID_ID		MAKE_ID2('I', 'D')
73 #define ID_AR		MAKE_ID2('A', 'R')
74 #define ID_AC		MAKE_ID2('A', 'C')
75 #define ID_SCRIPT	MAKE_ID2('P', 'Y')
76 #define ID_FLUIDSIM	MAKE_ID2('F', 'S')
77 #define ID_NT		MAKE_ID2('N', 'T')
78 #define ID_BR		MAKE_ID2('B', 'R')
79 
80 
81 #define ID_SEQ		MAKE_ID2('S', 'Q')
82 #define ID_CO		MAKE_ID2('C', 'O')
83 #define ID_PO		MAKE_ID2('A', 'C')
84 #define ID_NLA		MAKE_ID2('N', 'L')
85 
86 #define ID_VS		MAKE_ID2('V', 'S')
87 #define ID_VN		MAKE_ID2('V', 'N')
88 
89 
90 // ------------------------------------------------------------
91 #define FORM MAKE_ID('F','O','R','M')
92 #define DDG1 MAKE_ID('3','D','G','1')
93 #define DDG2 MAKE_ID('3','D','G','2')
94 #define DDG3 MAKE_ID('3','D','G','3')
95 #define DDG4 MAKE_ID('3','D','G','4')
96 #define GOUR MAKE_ID('G','O','U','R')
97 #define BLEN MAKE_ID('B','L','E','N')
98 #define DER_ MAKE_ID('D','E','R','_')
99 #define V100 MAKE_ID('V','1','0','0')
100 #define DATA MAKE_ID('D','A','T','A')
101 #define GLOB MAKE_ID('G','L','O','B')
102 #define IMAG MAKE_ID('I','M','A','G')
103 #define USER MAKE_ID('U','S','E','R')
104 
105 
106 // ------------------------------------------------------------
107 #define DNA1 MAKE_ID('D','N','A','1')
108 #define REND MAKE_ID('R','E','N','D')
109 #define ENDB MAKE_ID('E','N','D','B')
110 #define NAME MAKE_ID('N','A','M','E')
111 #define SDNA MAKE_ID('S','D','N','A')
112 #define TYPE MAKE_ID('T','Y','P','E')
113 #define TLEN MAKE_ID('T','L','E','N')
114 #define STRC MAKE_ID('S','T','R','C')
115 
116 
117 // ------------------------------------------------------------
118 #define SWITCH_INT(a) { \
119     char s_i, *p_i; \
120     p_i= (char *)&(a); \
121     s_i=p_i[0]; p_i[0]=p_i[3]; p_i[3]=s_i; \
122     s_i=p_i[1]; p_i[1]=p_i[2]; p_i[2]=s_i; }
123 
124 // ------------------------------------------------------------
125 #define SWITCH_SHORT(a)	{ \
126     char s_i, *p_i; \
127 	p_i= (char *)&(a); \
128 	s_i=p_i[0]; p_i[0]=p_i[1]; p_i[1]=s_i; }
129 
130 // ------------------------------------------------------------
131 #define SWITCH_LONGINT(a) { \
132     char s_i, *p_i; \
133     p_i= (char *)&(a);  \
134     s_i=p_i[0]; p_i[0]=p_i[7]; p_i[7]=s_i; \
135     s_i=p_i[1]; p_i[1]=p_i[6]; p_i[6]=s_i; \
136     s_i=p_i[2]; p_i[2]=p_i[5]; p_i[5]=s_i; \
137     s_i=p_i[3]; p_i[3]=p_i[4]; p_i[4]=s_i; }
138 
139 #endif//__B_DEFINES_H__
140