Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

405 lines
25 KiB

  1. /****************************************************************************/
  2. /* wdcgdata.h */
  3. /* */
  4. /* Common include file for all data.c modules (Windows specific) */
  5. /* */
  6. /* Copyright(c) Microsoft 1996-1997. */
  7. /* */
  8. /* The macros in this file allow all aspects of data declaration to be kept */
  9. /* together. The behaviour of this file is controlled by #defines that can */
  10. /* be set prior to inclusion of this. */
  11. /* */
  12. /* - DC_INIT_DATA Set in XX_Init routines to do inline initialisation if*/
  13. /* required. */
  14. /* - DC_INCLUDE_DATA Set where a header file is included in order to get */
  15. /* external declarations. */
  16. /* - DC_DEFINE_DATA Set where a header file is included in order to get */
  17. /* definition without initialisation. */
  18. /* - DC_CONSTANT_DATA Set to get global initialisation of const data items */
  19. /* - (default) Gets data definition with initialisation. */
  20. /* */
  21. /****************************************************************************/
  22. /* */
  23. /* In order to allow for the flexibility required in different environments */
  24. /* (be that different OSs, C vs C++, or whatever) the structure of the file */
  25. /* is as follows. */
  26. /* */
  27. /* First there is an environment-specific mapping from the macros used in */
  28. /* the code to internal macros. This mapping also takes the above #defines */
  29. /* into consideration in performing this expansion. */
  30. /* */
  31. /* Secondly, the low-level macros that actually perform the expansion are */
  32. /* defined. These should be platform-independent. */
  33. /* */
  34. /* The intention of this structure is to avoid the confusions caused by the */
  35. /* old version where, for example, code compiled with DC_INIT_DATA */
  36. /* explicitly did NOT initialise the data. */
  37. /* */
  38. /****************************************************************************/
  39. /* Changes: */
  40. /* */
  41. /* $Log: Y:/logs/h/dcl/wdcgdata.h_v $ */
  42. //
  43. // Rev 1.1 19 Jun 1997 14:36:04 ENH
  44. // Win16Port: Make compatible with 16 bit build
  45. /* */
  46. /****************************************************************************/
  47. /****************************************************************************/
  48. /* Clear any previous definitions of the macros. */
  49. /****************************************************************************/
  50. #undef DC_DATA
  51. #undef DC_DATA_NULL
  52. #undef DC_DATA_ARRAY
  53. #undef DC_DATA_ARRAY_NULL
  54. #undef DC_DATA_ARRAY_UNINIT
  55. #undef DC_DATA_ARRAY_SET
  56. #undef DC_DATA_2D_ARRAY
  57. #undef DC_CONST_DATA
  58. #undef DC_CONST_DATA_ARRAY
  59. #undef DC_CONST_DATA_2D_ARRAY
  60. #undef DCI_DATA
  61. #undef DCI_DATA_NULL
  62. #undef DCI_DATA_ARRAY
  63. #undef DCI_DATA_ARRAY_NULL
  64. #undef DCI_DATA_ARRAY_UNINIT
  65. #undef DCI_DATA_ARRAY_SET
  66. #undef DCI_DATA_2D_ARRAY
  67. #undef DCI_CONST_DATA
  68. #undef DCI_CONST_DATA_ARRAY
  69. #undef DCI_CONST_DATA_2D_ARRAY
  70. /****************************************************************************/
  71. /* Now define the main (external) macros. */
  72. /****************************************************************************/
  73. #define DC_DATA(A,B,C) DCI_DATA(A,B,C)
  74. #define DC_DATA_NULL(A,B,C) DCI_DATA_NULL(A,B,C)
  75. #define DC_DATA_ARRAY(A,B,C,D) DCI_DATA_ARRAY(A,B,C,D)
  76. #define DC_DATA_ARRAY_NULL(A,B,C,D) DCI_DATA_ARRAY_NULL(A,B,C,D)
  77. #define DC_DATA_ARRAY_UNINIT(A,B,C) DCI_DATA_ARRAY_UNINIT(A,B,C)
  78. #define DC_DATA_ARRAY_SET(A,B,C,D) DCI_DATA_ARRAY_SET(A,B,C,D)
  79. #define DC_DATA_2D_ARRAY(A,B,C,D,E) DCI_DATA_2D_ARRAY(A,B,C,D,E)
  80. #define DC_CONST_DATA(A,B,C) DCI_CONST_DATA(A,B,C)
  81. #define DC_CONST_DATA_ARRAY(A,B,C,D) DCI_CONST_DATA_ARRAY(A,B,C,D)
  82. #define DC_CONST_DATA_2D_ARRAY(A,B,C,D,E) DCI_CONST_DATA_2D_ARRAY(A,B,C,D,E)
  83. /****************************************************************************/
  84. /****************************************************************************/
  85. /* Now map to the target macros */
  86. /****************************************************************************/
  87. /****************************************************************************/
  88. #if defined(DC_INCLUDE_DATA)
  89. /****************************************************************************/
  90. /* External declarations */
  91. /****************************************************************************/
  92. #define DCI_DATA(TYPE, Name, VAL) \
  93. DCI_EXTERN_DATA(TYPE, Name, VAL)
  94. #define DCI_DATA_NULL(TYPE, Name, VAL) \
  95. DCI_EXTERN_DATA_NULL(TYPE, Name, VAL)
  96. #define DCI_DATA_ARRAY(TYPE, Name, Size, VAL) \
  97. DCI_EXTERN_DATA_ARRAY(TYPE, Name, Size, VAL)
  98. #define DCI_DATA_ARRAY_NULL(TYPE, Name, Size, VAL) \
  99. DCI_EXTERN_DATA_ARRAY(TYPE, Name, Size, VAL)
  100. #define DCI_DATA_ARRAY_UNINIT(TYPE, Name, Size) \
  101. DCI_EXTERN_DATA_ARRAY(TYPE, Name, Size, 0)
  102. #define DCI_DATA_ARRAY_SET(TYPE, Name, Size, VAL) \
  103. DCI_EXTERN_DATA_ARRAY(TYPE, Name, Size, VAL)
  104. #define DCI_DATA_2D_ARRAY(TYPE, Name, Size1, Size2, VAL) \
  105. DCI_EXTERN_DATA_2D_ARRAY(TYPE, Name, Size1, Size2, VAL)
  106. #define DCI_CONST_DATA(TYPE, Name, VAL) \
  107. DCI_EXTERN_CONST_DATA(TYPE, Name, VAL)
  108. #define DCI_CONST_DATA_ARRAY(TYPE, Name, Size, VAL) \
  109. DCI_EXTERN_CONST_DATA_ARRAY(TYPE, Name, Size, VAL)
  110. #define DCI_CONST_DATA_2D_ARRAY(TYPE, Name, Size1, Size2, VAL) \
  111. DCI_EXTERN_CONST_DATA_2D_ARRAY(TYPE, Name, Size1, Size2, VAL)
  112. #elif defined(DC_INIT_DATA)
  113. /****************************************************************************/
  114. /* Inline initialisation */
  115. /****************************************************************************/
  116. #if defined(VER_CPP) && defined(DC_IN_CLASS)
  117. #define DCI_DATA(TYPE, Name, VAL) \
  118. DCI_ASSIGN_DATA(TYPE, Name, VAL)
  119. #define DCI_DATA_NULL(TYPE, Name, VAL) \
  120. DCI_SET_DATA_NULL(TYPE, Name, VAL)
  121. #define DCI_DATA_ARRAY(TYPE, Name, Size, VAL) \
  122. DCI_ASSIGN_DATA_ARRAY(TYPE, Name, Size, VAL)
  123. #define DCI_DATA_ARRAY_NULL(TYPE, Name, Size, VAL) \
  124. DCI_SET_DATA_ARRAY_NULL(TYPE, Name, Size, VAL)
  125. #define DCI_DATA_ARRAY_UNINIT(TYPE, Name, Size) \
  126. DCI_SET_DATA_ARRAY_NULL(TYPE, Name, Size, 0)
  127. #define DCI_DATA_ARRAY_SET(TYPE, Name, Size, VAL) \
  128. DCI_SET_DATA_ARRAY_VAL(TYPE, Name, Size, VAL)
  129. #define DCI_DATA_2D_ARRAY(TYPE, Name, Size1, Size2, VAL) \
  130. DCI_ASSIGN_DATA_2D_ARRAY(TYPE, Name, Size1, Size2, VAL)
  131. #define DCI_CONST_DATA(TYPE, Name, VAL) \
  132. DCI_NO_DATA(TYPE, Name, VAL)
  133. #define DCI_CONST_DATA_ARRAY(TYPE, Name, Size, VAL) \
  134. DCI_NO_DATA_ARRAY(TYPE, Name, Size, VAL)
  135. #define DCI_CONST_DATA_2D_ARRAY(TYPE, Name, Size1, Size2, VAL) \
  136. DCI_NO_DATA_2D_ARRAY(TYPE, Name, Size1, Size2, VAL)
  137. #else
  138. #define DCI_DATA(TYPE, Name, VAL) \
  139. DCI_NO_DATA(TYPE, Name, VAL)
  140. #define DCI_DATA_NULL(TYPE, Name, VAL) \
  141. DCI_NO_DATA_NULL(TYPE, Name, VAL)
  142. #define DCI_DATA_ARRAY(TYPE, Name, Size, VAL) \
  143. DCI_NO_DATA_ARRAY(TYPE, Name, Size, VAL)
  144. #define DCI_DATA_ARRAY_NULL(TYPE, Name, Size, VAL) \
  145. DCI_NO_DATA_ARRAY(TYPE, Name, Size, VAL)
  146. #define DCI_DATA_ARRAY_UNINIT(TYPE, Name, Size) \
  147. DCI_NO_DATA_ARRAY(TYPE, Name, Size, 0)
  148. #define DCI_DATA_ARRAY_SET(TYPE, Name, Size, VAL) \
  149. DCI_NO_DATA_ARRAY(TYPE, Name, Size, VAL)
  150. #define DCI_DATA_2D_ARRAY(TYPE, Name, Size1, Size2, VAL) \
  151. DCI_NO_DATA_2D_ARRAY(TYPE, Name, Size1, Size2, VAL)
  152. #define DCI_CONST_DATA(TYPE, Name, VAL) \
  153. DCI_NO_DATA(TYPE, Name, VAL)
  154. #define DCI_CONST_DATA_ARRAY(TYPE, Name, Size, VAL) \
  155. DCI_NO_DATA_ARRAY(TYPE, Name, Size, VAL)
  156. #define DCI_CONST_DATA_2D_ARRAY(TYPE, Name, Size1, Size2, VAL) \
  157. DCI_NO_DATA_2D_ARRAY(TYPE, Name, Size1, Size2, VAL)
  158. #endif
  159. #elif defined(DC_DEFINE_DATA)
  160. /****************************************************************************/
  161. /* Definition but no initialisation */
  162. /****************************************************************************/
  163. #define DCI_DATA(TYPE, Name, VAL) \
  164. DCI_DEFINE_DATA(TYPE, Name, VAL)
  165. #define DCI_DATA_NULL(TYPE, Name, VAL) \
  166. DCI_DEFINE_DATA_NULL(TYPE, Name, VAL)
  167. #define DCI_DATA_ARRAY(TYPE, Name, Size, VAL) \
  168. DCI_DEFINE_DATA_ARRAY(TYPE, Name, Size, VAL)
  169. #define DCI_DATA_ARRAY_NULL(TYPE, Name, Size, VAL) \
  170. DCI_DEFINE_DATA_ARRAY(TYPE, Name, Size, VAL)
  171. #define DCI_DATA_ARRAY_UNINIT(TYPE, Name, Size) \
  172. DCI_DEFINE_DATA_ARRAY(TYPE, Name, Size, NULL)
  173. #define DCI_DATA_ARRAY_SET(TYPE, Name, Size, VAL) \
  174. DCI_DEFINE_DATA_ARRAY(TYPE, Name, Size, VAL)
  175. #define DCI_DATA_2D_ARRAY(TYPE, Name, Size1, Size2, VAL) \
  176. DCI_DEFINE_DATA_2D_ARRAY(TYPE, Name, Size1, Size2, VAL)
  177. #define DCI_CONST_DATA(TYPE, Name, VAL) \
  178. DCI_DEFINE_CONST_DATA(TYPE, Name, VAL)
  179. #define DCI_CONST_DATA_ARRAY(TYPE, Name, Size, VAL) \
  180. DCI_DEFINE_CONST_DATA_ARRAY(TYPE, Name, Size, VAL)
  181. #define DCI_CONST_DATA_2D_ARRAY(TYPE, Name, Size1, Size2, VAL) \
  182. DCI_DEFINE_CONST_DATA_2D_ARRAY(TYPE, Name, Size1, Size2, VAL)
  183. #elif defined(DC_CONSTANT_DATA)
  184. /****************************************************************************/
  185. /* Definition but no initialisation */
  186. /****************************************************************************/
  187. #define DCI_DATA(TYPE, Name, VAL) \
  188. DCI_NO_DATA(TYPE, Name, VAL)
  189. #define DCI_DATA_NULL(TYPE, Name, VAL) \
  190. DCI_NO_DATA_NULL(TYPE, Name, VAL)
  191. #define DCI_DATA_ARRAY(TYPE, Name, Size, VAL) \
  192. DCI_NO_DATA_ARRAY(TYPE, Name, Size, VAL)
  193. #define DCI_DATA_ARRAY_NULL(TYPE, Name, Size, VAL) \
  194. DCI_NO_DATA_ARRAY(TYPE, Name, Size, VAL)
  195. #define DCI_DATA_ARRAY_UNINIT(TYPE, Name, Size) \
  196. DCI_NO_DATA_ARRAY(TYPE, Name, Size, NULL)
  197. #define DCI_DATA_ARRAY_SET(TYPE, Name, Size, VAL) \
  198. DCI_NO_DATA_ARRAY(TYPE, Name, Size, VAL)
  199. #define DCI_DATA_2D_ARRAY(TYPE, Name, Size1, Size2, VAL) \
  200. DCI_NO_DATA_2D_ARRAY(TYPE, Name, Size1, Size2, VAL)
  201. #define DCI_CONST_DATA(TYPE, Name, VAL) \
  202. DCI_INIT_CONST_DATA(TYPE, Name, VAL)
  203. #define DCI_CONST_DATA_ARRAY(TYPE, Name, Size, VAL) \
  204. DCI_INIT_CONST_DATA_ARRAY(TYPE, Name, Size, VAL)
  205. #define DCI_CONST_DATA_2D_ARRAY(TYPE, Name, Size1, Size2, VAL) \
  206. DCI_INIT_CONST_DATA_2D_ARRAY(TYPE, Name, Size1, Size2, VAL)
  207. #else
  208. /****************************************************************************/
  209. /* Data definition and initialisation */
  210. /****************************************************************************/
  211. #define DCI_DATA(TYPE, Name, VAL) \
  212. DCI_INIT_DATA(TYPE, Name, VAL)
  213. #define DCI_DATA_NULL(TYPE, Name, VAL) \
  214. DCI_INIT_DATA_NULL(TYPE, Name, VAL)
  215. #define DCI_DATA_ARRAY(TYPE, Name, Size, VAL) \
  216. DCI_INIT_DATA_ARRAY(TYPE, Name, Size, VAL)
  217. #define DCI_DATA_ARRAY_NULL(TYPE, Name, Size, VAL) \
  218. DCI_INIT_DATA_ARRAY(TYPE, Name, Size, VAL)
  219. #define DCI_DATA_ARRAY_UNINIT(TYPE, Name, Size) \
  220. DCI_DEFINE_DATA_ARRAY(TYPE, Name, Size, NULL)
  221. #define DCI_DATA_ARRAY_SET(TYPE, Name, Size, VAL) \
  222. DCI_INIT_DATA_ARRAY(TYPE, Name, Size, VAL)
  223. #define DCI_DATA_2D_ARRAY(TYPE, Name, Size1, Size2, VAL) \
  224. DCI_INIT_DATA_2D_ARRAY(TYPE, Name, Size1, Size2, VAL)
  225. #define DCI_CONST_DATA(TYPE, Name, VAL) \
  226. DCI_INIT_CONST_DATA(TYPE, Name, VAL)
  227. #define DCI_CONST_DATA_ARRAY(TYPE, Name, Size, VAL) \
  228. DCI_INIT_CONST_DATA_ARRAY(TYPE, Name, Size, VAL)
  229. #define DCI_CONST_DATA_2D_ARRAY(TYPE, Name, Size1, Size2, VAL) \
  230. DCI_INIT_CONST_DATA_2D_ARRAY(TYPE, Name, Size1, Size2, VAL)
  231. #endif
  232. /****************************************************************************/
  233. /****************************************************************************/
  234. /* Finally, the low-level macros required to do the real work. */
  235. /* */
  236. /* Avoid multiple inclusion of these. */
  237. /****************************************************************************/
  238. /****************************************************************************/
  239. #ifndef _H_WDCGDATA
  240. #define _H_WDCGDATA
  241. /****************************************************************************/
  242. /* Some utilities... */
  243. /****************************************************************************/
  244. #define DC_STRUCT1(a) {a}
  245. #define DC_STRUCT2(a,b) {a,b}
  246. #define DC_STRUCT3(a,b,c) {a,b,c}
  247. #define DC_STRUCT4(a,b,c,d) {a,b,c,d}
  248. #define DC_STRUCT5(a,b,c,d,e) {a,b,c,d,e}
  249. #define DC_STRUCT6(a,b,c,d,e,f) {a,b,c,d,e,f}
  250. #define DC_STRUCT7(a,b,c,d,e,f,g) {a,b,c,d,e,f,g}
  251. #define DC_STRUCT8(a,b,c,d,e,f,g,h) {a,b,c,d,e,f,g,h}
  252. #define DC_STRUCT9(a,b,c,d,e,f,g,h,i) {a,b,c,d,e,f,g,h,i}
  253. #define DC_STRUCT10(a,b,c,d,e,f,g,h,i,j) {a,b,c,d,e,f,g,h,i,j}
  254. #define DC_STRUCT11(a,b,c,d,e,f,g,h,i,j,k) {a,b,c,d,e,f,g,h,i,j,k}
  255. #define DC_STRUCT12(a,b,c,d,e,f,g,h,i,j,k,l) {a,b,c,d,e,f,g,h,i,j,k,l}
  256. #define DC_STRUCT13(a,b,c,d,e,f,g,h,i,j,k,l,m) \
  257. {a,b,c,d,e,f,g,h,i,j,k,l,m}
  258. #define DC_STRUCT14(a,b,c,d,e,f,g,h,i,j,k,l,m,n) \
  259. {a,b,c,d,e,f,g,h,i,j,k,l,m,n}
  260. #define DC_STRUCT15(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o) \
  261. {a,b,c,d,e,f,g,h,i,j,k,l,m,n,o}
  262. #define DC_STRUCT16(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) \
  263. {a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p}
  264. #define DC_STRUCT17(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q) \
  265. {a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q}
  266. #define DC_STRUCT18(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r) \
  267. {a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r}
  268. #define DC_STRUCT19(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s) \
  269. {a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s}
  270. #define DC_STRUCT20(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t) \
  271. {a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t}
  272. #define DC_STRUCT21(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u) \
  273. {a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u}
  274. #define DC_STRUCT22(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v) \
  275. {a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v}
  276. #define DC_STRUCT23(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w) \
  277. {a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w}
  278. #define DC_STRUCT24(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x) \
  279. {a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x}
  280. #define DC_STRUCT27(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa) \
  281. {a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa}
  282. #define DC_STRUCT31(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z, \
  283. aa,bb,cc,dd,ee) \
  284. {a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z, \
  285. aa,bb,cc,dd,ee}
  286. #define DC_STRUCT35(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa, \
  287. bb,cc,dd,ee,ff,gg,hh,ii) \
  288. {a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z, \
  289. aa,bb,cc,dd,ee,ff,gg,hh,ii}
  290. #define DC_STRUCT64(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa, \
  291. bb,cc,dd,ee,ff,gg,hh,ii,jj,kk,ll,mm,nn,oo, \
  292. pp,qq,rr,ss,tt,uu,vv,ww,xx,yy,zz,ab,ac,ad,ae, \
  293. af,ag,ah,ai,aj,ak,al,am) \
  294. {a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z, \
  295. aa,bb,cc,dd,ee,ff,gg,hh,ii,jj,kk,ll,mm,nn,oo, \
  296. pp,qq,rr,ss,tt,uu,vv,ww,xx,yy,zz,ab,ac,ad,ae, \
  297. af,ag,ah,ai,aj,ak,al,am}
  298. /****************************************************************************/
  299. /* The extern declarations macros... */
  300. /****************************************************************************/
  301. #define DCI_EXTERN_DATA(TYPE, Name, VAL) extern TYPE Name
  302. #define DCI_EXTERN_DATA_NULL(TYPE, Name, VAL) extern TYPE Name
  303. #define DCI_EXTERN_DATA_ARRAY(TYPE, Name, Size, VAL) extern TYPE Name[Size]
  304. #define DCI_EXTERN_DATA_2D_ARRAY(TYPE, Name, Size1, Size2, VAL) \
  305. extern TYPE Name[Size1][Size2]
  306. #define DCI_EXTERN_CONST_DATA_ARRAY(TYPE, Name, Size, VAL) \
  307. extern const TYPE Name[Size]
  308. #define DCI_EXTERN_CONST_DATA(TYPE, Name, VAL) extern const TYPE Name
  309. #define DCI_EXTERN_CONST_DATA_2D_ARRAY(TYPE, Name, Size1, Size2, VAL) \
  310. extern const TYPE Name[Size1][Size2]
  311. /****************************************************************************/
  312. /* The no-op macros... */
  313. /****************************************************************************/
  314. #define DCI_NO_DATA(TYPE, Name, VAL)
  315. #define DCI_NO_DATA_NULL(TYPE, Name, VAL)
  316. #define DCI_NO_DATA_ARRAY(TYPE, Name, Size, VAL)
  317. #define DCI_NO_DATA_2D_ARRAY(TYPE, Name, Size1, Size2, VAL)
  318. /****************************************************************************/
  319. /* The declaration macros... */
  320. /****************************************************************************/
  321. #define DCI_DEFINE_DATA(TYPE, Name, VAL) TYPE Name
  322. #define DCI_DEFINE_DATA_NULL(TYPE, Name, VAL) TYPE Name
  323. #define DCI_DEFINE_DATA_ARRAY(TYPE, Name, Size, VAL) TYPE Name[Size]
  324. #define DCI_DEFINE_DATA_2D_ARRAY(TYPE, Name, Size1, Size2, VAL) \
  325. TYPE Name[Size1][Size2]
  326. #define DCI_DEFINE_CONST_DATA(TYPE, Name, VAL) static const TYPE Name
  327. #define DCI_DEFINE_CONST_DATA_ARRAY(TYPE, Name, Size, VAL) \
  328. static const TYPE Name[Size]
  329. #define DCI_DEFINE_CONST_DATA_2D_ARRAY(TYPE, Name, Size1, Size2, VAL) \
  330. static const TYPE Name[Size1][Size2]
  331. /****************************************************************************/
  332. /* The define-and-assign macros... */
  333. /****************************************************************************/
  334. #define DCI_INIT_DATA(TYPE, Name, VAL) TYPE Name = VAL
  335. #define DCI_INIT_DATA_NULL(TYPE, Name, VAL) TYPE Name = VAL
  336. #define DCI_INIT_DATA_ARRAY(TYPE, Name, Size, VAL) TYPE Name[Size] = { VAL }
  337. #define DCI_INIT_DATA_2D_ARRAY(TYPE, Name, Size1, Size2, VAL) \
  338. TYPE Name[Size1][Size2] = { VAL }
  339. #if defined(VER_CPP) && !defined(DC_IN_CLASS)
  340. /****************************************************************************/
  341. /* The version for App Serving files outside of the class. */
  342. /****************************************************************************/
  343. #define DCI_INIT_CONST_DATA(TYPE, Name, VAL) \
  344. extern const TYPE SHCLASS Name = VAL
  345. #define DCI_INIT_CONST_DATA_ARRAY(TYPE, Name, Size, VAL) \
  346. extern const TYPE SHCLASS Name[Size] = VAL
  347. #define DCI_INIT_CONST_DATA_2D_ARRAY(TYPE, Name, Size1, Size2, VAL) \
  348. extern const TYPE SHCLASS Name[Size1][Size2] = VAL
  349. #else /* ! VER_CPP */
  350. /****************************************************************************/
  351. /* The vanilla C version */
  352. /****************************************************************************/
  353. #define DCI_INIT_CONST_DATA(TYPE, Name, VAL) const TYPE SHCLASS Name = VAL
  354. #define DCI_INIT_CONST_DATA_ARRAY(TYPE, Name, Size, VAL) \
  355. const TYPE SHCLASS Name[Size] = VAL
  356. #define DCI_INIT_CONST_DATA_2D_ARRAY(TYPE, Name, Size1, Size2, VAL) \
  357. const TYPE SHCLASS Name[Size1][Size2] = VAL
  358. #endif /* VER_CPP */
  359. /****************************************************************************/
  360. /* The procedural code initialisation macros... */
  361. /****************************************************************************/
  362. #define DCI_ASSIGN_DATA(TYPE, Name, VAL) Name = VAL
  363. #define DCI_ASSIGN_DATA_NULL(TYPE, Name, VAL) Error!
  364. #define DCI_ASSIGN_DATA_ARRAY_NULL(TYPE, Name, Size, VAL) Error!
  365. #define DCI_ASSIGN_DATA_ARRAY(TYPE, Name, Size, VAL) Error!
  366. #define DCI_ASSIGN_DATA_2D_ARRAY(TYPE, Name, Size1, Size2, VAL) Error!
  367. /****************************************************************************/
  368. /* The memcpy and memset initialisation macros... */
  369. /****************************************************************************/
  370. #define DCI_SET_DATA_NULL(TYPE, Name, VAL) DC_MEMSET(&Name, 0, sizeof(TYPE))
  371. #define DCI_SET_DATA_ARRAY_NULL(TYPE, Name, Size, VAL) \
  372. DC_MEMSET(&Name, 0, Size*sizeof(TYPE))
  373. #define DCI_SET_DATA_ARRAY_VAL(TYPE, Name, Size, VAL) \
  374. DC_MEMSET(&Name, VAL, Size*sizeof(TYPE))
  375. #endif /*H_WDCGDATA*/