bDefines.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  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. // MISC defines, see BKE_global.h, BKE_utildefines.h
  22. #define SIZEOFBLENDERHEADER 12
  23. // ------------------------------------------------------------
  24. #if defined(__sgi) || defined(__sparc) || defined(__sparc__) || defined(__PPC__) || defined(__ppc__) || defined(__BIG_ENDIAN__)
  25. #define MAKE_ID(a, b, c, d) ((int)(a) << 24 | (int)(b) << 16 | (c) << 8 | (d))
  26. #else
  27. #define MAKE_ID(a, b, c, d) ((int)(d) << 24 | (int)(c) << 16 | (b) << 8 | (a))
  28. #endif
  29. // ------------------------------------------------------------
  30. #if defined(__sgi) || defined(__sparc) || defined(__sparc__) || defined(__PPC__) || defined(__ppc__) || defined(__BIG_ENDIAN__)
  31. #define MAKE_ID2(c, d) ((c) << 8 | (d))
  32. #define MOST_SIG_BYTE 0
  33. #define BBIG_ENDIAN
  34. #else
  35. #define MAKE_ID2(c, d) ((d) << 8 | (c))
  36. #define MOST_SIG_BYTE 1
  37. #define BLITTLE_ENDIAN
  38. #endif
  39. // ------------------------------------------------------------
  40. #define ID_SCE MAKE_ID2('S', 'C')
  41. #define ID_LI MAKE_ID2('L', 'I')
  42. #define ID_OB MAKE_ID2('O', 'B')
  43. #define ID_ME MAKE_ID2('M', 'E')
  44. #define ID_CU MAKE_ID2('C', 'U')
  45. #define ID_MB MAKE_ID2('M', 'B')
  46. #define ID_MA MAKE_ID2('M', 'A')
  47. #define ID_TE MAKE_ID2('T', 'E')
  48. #define ID_IM MAKE_ID2('I', 'M')
  49. #define ID_IK MAKE_ID2('I', 'K')
  50. #define ID_WV MAKE_ID2('W', 'V')
  51. #define ID_LT MAKE_ID2('L', 'T')
  52. #define ID_SE MAKE_ID2('S', 'E')
  53. #define ID_LF MAKE_ID2('L', 'F')
  54. #define ID_LA MAKE_ID2('L', 'A')
  55. #define ID_CA MAKE_ID2('C', 'A')
  56. #define ID_IP MAKE_ID2('I', 'P')
  57. #define ID_KE MAKE_ID2('K', 'E')
  58. #define ID_WO MAKE_ID2('W', 'O')
  59. #define ID_SCR MAKE_ID2('S', 'R')
  60. #define ID_VF MAKE_ID2('V', 'F')
  61. #define ID_TXT MAKE_ID2('T', 'X')
  62. #define ID_SO MAKE_ID2('S', 'O')
  63. #define ID_SAMPLE MAKE_ID2('S', 'A')
  64. #define ID_GR MAKE_ID2('G', 'R')
  65. #define ID_ID MAKE_ID2('I', 'D')
  66. #define ID_AR MAKE_ID2('A', 'R')
  67. #define ID_AC MAKE_ID2('A', 'C')
  68. #define ID_SCRIPT MAKE_ID2('P', 'Y')
  69. #define ID_FLUIDSIM MAKE_ID2('F', 'S')
  70. #define ID_NT MAKE_ID2('N', 'T')
  71. #define ID_BR MAKE_ID2('B', 'R')
  72. #define ID_SEQ MAKE_ID2('S', 'Q')
  73. #define ID_CO MAKE_ID2('C', 'O')
  74. #define ID_PO MAKE_ID2('A', 'C')
  75. #define ID_NLA MAKE_ID2('N', 'L')
  76. #define ID_VS MAKE_ID2('V', 'S')
  77. #define ID_VN MAKE_ID2('V', 'N')
  78. // ------------------------------------------------------------
  79. #define FORM MAKE_ID('F', 'O', 'R', 'M')
  80. #define DDG1 MAKE_ID('3', 'D', 'G', '1')
  81. #define DDG2 MAKE_ID('3', 'D', 'G', '2')
  82. #define DDG3 MAKE_ID('3', 'D', 'G', '3')
  83. #define DDG4 MAKE_ID('3', 'D', 'G', '4')
  84. #define GOUR MAKE_ID('G', 'O', 'U', 'R')
  85. #define BLEN MAKE_ID('B', 'L', 'E', 'N')
  86. #define DER_ MAKE_ID('D', 'E', 'R', '_')
  87. #define V100 MAKE_ID('V', '1', '0', '0')
  88. #define DATA MAKE_ID('D', 'A', 'T', 'A')
  89. #define GLOB MAKE_ID('G', 'L', 'O', 'B')
  90. #define IMAG MAKE_ID('I', 'M', 'A', 'G')
  91. #define USER MAKE_ID('U', 'S', 'E', 'R')
  92. // ------------------------------------------------------------
  93. #define DNA1 MAKE_ID('D', 'N', 'A', '1')
  94. #define REND MAKE_ID('R', 'E', 'N', 'D')
  95. #define ENDB MAKE_ID('E', 'N', 'D', 'B')
  96. #define NAME MAKE_ID('N', 'A', 'M', 'E')
  97. #define SDNA MAKE_ID('S', 'D', 'N', 'A')
  98. #define TYPE MAKE_ID('T', 'Y', 'P', 'E')
  99. #define TLEN MAKE_ID('T', 'L', 'E', 'N')
  100. #define STRC MAKE_ID('S', 'T', 'R', 'C')
  101. // ------------------------------------------------------------
  102. #define SWITCH_INT(a) \
  103. { \
  104. char s_i, *p_i; \
  105. p_i = (char *)&(a); \
  106. s_i = p_i[0]; \
  107. p_i[0] = p_i[3]; \
  108. p_i[3] = s_i; \
  109. s_i = p_i[1]; \
  110. p_i[1] = p_i[2]; \
  111. p_i[2] = s_i; \
  112. }
  113. // ------------------------------------------------------------
  114. #define SWITCH_SHORT(a) \
  115. { \
  116. char s_i, *p_i; \
  117. p_i = (char *)&(a); \
  118. s_i = p_i[0]; \
  119. p_i[0] = p_i[1]; \
  120. p_i[1] = s_i; \
  121. }
  122. // ------------------------------------------------------------
  123. #define SWITCH_LONGINT(a) \
  124. { \
  125. char s_i, *p_i; \
  126. p_i = (char *)&(a); \
  127. s_i = p_i[0]; \
  128. p_i[0] = p_i[7]; \
  129. p_i[7] = s_i; \
  130. s_i = p_i[1]; \
  131. p_i[1] = p_i[6]; \
  132. p_i[6] = s_i; \
  133. s_i = p_i[2]; \
  134. p_i[2] = p_i[5]; \
  135. p_i[5] = s_i; \
  136. s_i = p_i[3]; \
  137. p_i[3] = p_i[4]; \
  138. p_i[4] = s_i; \
  139. }
  140. #endif //__B_DEFINES_H__