Source code of Windows XP (NT5)
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.

438 lines
21 KiB

  1. #ifndef DESCRIP_H_DEFINED
  2. /*
  3. * DESCRIP.H - V3.0-003 - Argument Descriptor Formats
  4. * Copyright (c) 1993-1999 Microsoft Corporation
  5. * (Based on the VAX Procedure Calling and Condition Handling Standard, Revision 9.4 [13 March 1984];
  6. * see the "Introduction to VMS System Routines" manual for further information.)
  7. */
  8. /*
  9. * Descriptor Prototype - each class of descriptor consists of at least the following fields:
  10. */
  11. struct dsc_descriptor
  12. {
  13. unsigned short dsc_w_length; /* specific to descriptor class; typically a 16-bit (unsigned) length */
  14. unsigned char dsc_b_dtype; /* data type code */
  15. unsigned char dsc_b_class; /* descriptor class code */
  16. char *dsc_a_pointer; /* address of first byte of data element */
  17. };
  18. /*
  19. * Fixed-Length Descriptor:
  20. */
  21. struct dsc_descriptor_s
  22. {
  23. unsigned short dsc_w_length; /* length of data item in bytes,
  24. or if dsc_b_dtype is DSC_K_DTYPE_V, bits,
  25. or if dsc_b_dtype is DSC_K_DTYPE_P, digits (4 bits each) */
  26. unsigned char dsc_b_dtype; /* data type code */
  27. unsigned char dsc_b_class; /* descriptor class code = DSC_K_CLASS_S */
  28. char *dsc_a_pointer; /* address of first byte of data storage */
  29. };
  30. /*
  31. * Dynamic String Descriptor:
  32. */
  33. struct dsc_descriptor_d
  34. {
  35. unsigned short dsc_w_length; /* length of data item in bytes,
  36. or if dsc_b_dtype is DSC_K_DTYPE_V, bits,
  37. or if dsc_b_dtype is DSC_K_DTYPE_P, digits (4 bits each) */
  38. unsigned char dsc_b_dtype; /* data type code */
  39. unsigned char dsc_b_class; /* descriptor class code = DSC_K_CLASS_D */
  40. char *dsc_a_pointer; /* address of first byte of data storage */
  41. };
  42. /*
  43. * Array Descriptor:
  44. */
  45. struct dsc_descriptor_a
  46. {
  47. unsigned short dsc_w_length; /* length of an array element in bytes,
  48. or if dsc_b_dtype is DSC_K_DTYPE_V, bits,
  49. or if dsc_b_dtype is DSC_K_DTYPE_P, digits (4 bits each) */
  50. unsigned char dsc_b_dtype; /* data type code */
  51. unsigned char dsc_b_class; /* descriptor class code = DSC_K_CLASS_A */
  52. char *dsc_a_pointer; /* address of first actual byte of data storage */
  53. char dsc_b_scale; /* signed power-of-two or -ten multiplier, as specified by
  54. dsc_v_fl_binscale, to convert from internal to external form */
  55. unsigned char dsc_b_digits; /* if nonzero, number of decimal digits in internal representation */
  56. #ifdef vms
  57. struct
  58. {
  59. unsigned : 3; /* reserved; must be zero */
  60. unsigned dsc_v_fl_binscale : 1; /* if set, dsc_b_scale is a power-of-two, otherwise, -ten */
  61. unsigned dsc_v_fl_redim : 1; /* if set, indicates the array can be redimensioned */
  62. unsigned dsc_v_fl_column : 1; /* if set, indicates column-major order (FORTRAN) */
  63. unsigned dsc_v_fl_coeff : 1; /* if set, indicates the multipliers block is present */
  64. unsigned dsc_v_fl_bounds : 1; /* if set, indicates the bounds block is present */
  65. } dsc_b_aflags; /* array flag bits */
  66. #else
  67. unsigned char dsc_b_aflags;
  68. #endif
  69. unsigned char dsc_b_dimct; /* number of dimensions */
  70. unsigned long dsc_l_arsize; /* total size of array in bytes,
  71. or if dsc_b_dtype is DSC_K_DTYPE_P, digits (4 bits each) */
  72. /*
  73. * One or two optional blocks of information may follow contiguously at this point;
  74. * the first block contains information about the dimension multipliers (if present,
  75. * dsc_b_aflags.dsc_v_fl_coeff is set), the second block contains information about
  76. * the dimension bounds (if present, dsc_b_aflags.dsc_v_fl_bounds is set). If the
  77. * bounds information is present, the multipliers information must also be present.
  78. *
  79. * The multipliers block has the following format:
  80. * char *dsc_a_a0; Address of the element whose subscripts are all zero
  81. * long dsc_l_m [DIMCT]; Addressing coefficients (multipliers)
  82. *
  83. * The bounds block has the following format:
  84. * struct
  85. * {
  86. * long dsc_l_l; Lower bound
  87. * long dsc_l_u; Upper bound
  88. * } dsc_bounds [DIMCT];
  89. *
  90. * (DIMCT represents the value contained in dsc_b_dimct.)
  91. */
  92. };
  93. /*
  94. * Procedure Descriptor:
  95. */
  96. struct dsc_descriptor_p
  97. {
  98. unsigned short dsc_w_length; /* length associated with the function value */
  99. unsigned char dsc_b_dtype; /* function value data type code */
  100. unsigned char dsc_b_class; /* descriptor class code = DSC_K_CLASS_P */
  101. int (*dsc_a_pointer)(); /* address of function entry mask */
  102. };
  103. /*
  104. * Decimal String Descriptor:
  105. */
  106. struct dsc_descriptor_sd
  107. {
  108. unsigned short dsc_w_length; /* length of data item in bytes,
  109. or if dsc_b_dtype is DSC_K_DTYPE_V, bits,
  110. or if dsc_b_dtype is DSC_K_DTYPE_P, digits (4 bits each) */
  111. unsigned char dsc_b_dtype; /* data type code */
  112. unsigned char dsc_b_class; /* descriptor class code = DSC_K_CLASS_SD */
  113. char *dsc_a_pointer; /* address of first byte of data storage */
  114. char dsc_b_scale; /* signed power-of-two or -ten multiplier, as specified by
  115. dsc_v_fl_binscale, to convert from internal to external form */
  116. unsigned char dsc_b_digits; /* if nonzero, number of decimal digits in internal representation */
  117. struct
  118. {
  119. unsigned : 3; /* reserved; must be zero */
  120. unsigned dsc_v_fl_binscale : 1; /* if set, dsc_b_scale is a power-of-two, otherwise, -ten */
  121. unsigned : 4; /* reserved; must be zero */
  122. } dsc_b_sflags; /* scalar flag bits */
  123. unsigned : 8; /* reserved; must be zero */
  124. };
  125. /*
  126. * Noncontiguous Array Descriptor:
  127. */
  128. struct dsc_descriptor_nca
  129. {
  130. unsigned short dsc_w_length; /* length of an array element in bytes,
  131. or if dsc_b_dtype is DSC_K_DTYPE_V, bits,
  132. or if dsc_b_dtype is DSC_K_DTYPE_P, digits (4 bits each) */
  133. unsigned char dsc_b_dtype; /* data type code */
  134. unsigned char dsc_b_class; /* descriptor class code = DSC_K_CLASS_NCA */
  135. char *dsc_a_pointer; /* address of first actual byte of data storage */
  136. char dsc_b_scale; /* signed power-of-two or -ten multiplier, as specified by
  137. dsc_v_fl_binscale, to convert from internal to external form */
  138. unsigned char dsc_b_digits; /* if nonzero, number of decimal digits in internal representation */
  139. struct
  140. {
  141. unsigned : 3; /* reserved; must be zero */
  142. unsigned dsc_v_fl_binscale : 1; /* if set, dsc_b_scale is a power-of-two, otherwise, -ten */
  143. unsigned dsc_v_fl_redim : 1; /* must be zero */
  144. unsigned : 3; /* reserved; must be zero */
  145. } dsc_b_aflags; /* array flag bits */
  146. unsigned char dsc_b_dimct; /* number of dimensions */
  147. unsigned long dsc_l_arsize; /* if elements are actually contiguous, total size of array in bytes,
  148. or if dsc_b_dtype is DSC_K_DTYPE_P, digits (4 bits each) */
  149. /*
  150. * Two blocks of information must follow contiguously at this point; the first block
  151. * contains information about the difference between the addresses of two adjacent
  152. * elements in each dimension (the stride). The second block contains information
  153. * about the dimension bounds.
  154. *
  155. * The strides block has the following format:
  156. * char *dsc_a_a0; Address of the element whose subscripts are all zero
  157. * unsigned long dsc_l_s [DIMCT]; Strides
  158. *
  159. * The bounds block has the following format:
  160. * struct
  161. * {
  162. * long dsc_l_l; Lower bound
  163. * long dsc_l_u; Upper bound
  164. * } dsc_bounds [DIMCT];
  165. *
  166. * (DIMCT represents the value contained in dsc_b_dimct.)
  167. */
  168. };
  169. /*
  170. * The Varying String Descriptor and Varying String Array Descriptor are used with strings
  171. * of the following form:
  172. *
  173. * struct
  174. * {
  175. * unsigned short CURLEN; The current length of BODY in bytes
  176. * char BODY [MAXSTRLEN]; A fixed-length area containing the string
  177. * };
  178. *
  179. * where MAXSTRLEN is the value contained in the dsc_w_maxstrlen field in the descriptor.
  180. */
  181. /*
  182. * Varying String Descriptor:
  183. */
  184. struct dsc_descriptor_vs
  185. {
  186. unsigned short dsc_w_maxstrlen; /* maximum length of the BODY field of the varying string in bytes */
  187. unsigned char dsc_b_dtype; /* data type code = DSC_K_DTYPE_VT */
  188. unsigned char dsc_b_class; /* descriptor class code = DSC_K_CLASS_VS */
  189. char *dsc_a_pointer; /* address of the CURLEN field of the varying string */
  190. };
  191. /*
  192. * Varying String Array Descriptor:
  193. */
  194. struct dsc_descriptor_vsa
  195. {
  196. unsigned short dsc_w_maxstrlen; /* maximum length of the BODY field of an array element in bytes */
  197. unsigned char dsc_b_dtype; /* data type code = DSC_K_DTYPE_VT */
  198. unsigned char dsc_b_class; /* descriptor class code = DSC_K_CLASS_VSA */
  199. char *dsc_a_pointer; /* address of first actual byte of data storage */
  200. char dsc_b_scale; /* signed power-of-two or -ten multiplier, as specified by
  201. dsc_v_fl_binscale, to convert from internal to external form */
  202. unsigned char dsc_b_digits; /* if nonzero, number of decimal digits in internal representation */
  203. struct
  204. {
  205. unsigned : 3; /* reserved; must be zero */
  206. unsigned dsc_v_fl_binscale : 1; /* if set, dsc_b_scale is a power-of-two, otherwise, -ten */
  207. unsigned dsc_v_fl_redim : 1; /* must be zero */
  208. unsigned : 3; /* reserved; must be zero */
  209. } dsc_b_aflags; /* array flag bits */
  210. unsigned char dsc_b_dimct; /* number of dimensions */
  211. unsigned long dsc_l_arsize; /* if elements are actually contiguous, total size of array in bytes */
  212. /*
  213. * Two blocks of information must follow contiguously at this point; the first block
  214. * contains information about the difference between the addresses of two adjacent
  215. * elements in each dimension (the stride). The second block contains information
  216. * about the dimension bounds.
  217. *
  218. * The strides block has the following format:
  219. * char *dsc_a_a0; Address of the element whose subscripts are all zero
  220. * unsigned long dsc_l_s [DIMCT]; Strides
  221. *
  222. * The bounds block has the following format:
  223. * struct
  224. * {
  225. * long dsc_l_l; Lower bound
  226. * long dsc_l_u; Upper bound
  227. * } dsc_bounds [DIMCT];
  228. *
  229. * (DIMCT represents the value contained in dsc_b_dimct.)
  230. */
  231. };
  232. /*
  233. * Unaligned Bit String Descriptor:
  234. */
  235. struct dsc_descriptor_ubs
  236. {
  237. unsigned short dsc_w_length; /* length of data item in bits */
  238. unsigned char dsc_b_dtype; /* data type code = DSC_K_DTYPE_VU */
  239. unsigned char dsc_b_class; /* descriptor class code = DSC_K_CLASS_UBS */
  240. char *dsc_a_base; /* address to which dsc_l_pos is relative */
  241. long dsc_l_pos; /* bit position relative to dsc_a_base of first bit in string */
  242. };
  243. /*
  244. * Unaligned Bit Array Descriptor:
  245. */
  246. struct dsc_descriptor_uba
  247. {
  248. unsigned short dsc_w_length; /* length of data item in bits */
  249. unsigned char dsc_b_dtype; /* data type code = DSC_K_DTYPE_VU */
  250. unsigned char dsc_b_class; /* descriptor class code = DSC_K_CLASS_UBA */
  251. char *dsc_a_base; /* address to which effective bit offset is relative */
  252. char dsc_b_scale; /* reserved; must be zero */
  253. unsigned char dsc_b_digits; /* reserved; must be zero */
  254. struct
  255. {
  256. unsigned : 3; /* reserved; must be zero */
  257. unsigned dsc_v_fl_binscale : 1; /* must be zero */
  258. unsigned dsc_v_fl_redim : 1; /* must be zero */
  259. unsigned : 3; /* reserved; must be zero */
  260. } dsc_b_aflags; /* array flag bits */
  261. unsigned char dsc_b_dimct; /* number of dimensions */
  262. unsigned long dsc_l_arsize; /* total size of array in bits */
  263. /*
  264. * Three blocks of information must follow contiguously at this point; the first block
  265. * contains information about the difference between the bit addresses of two adjacent
  266. * elements in each dimension (the stride). The second block contains information
  267. * about the dimension bounds. The third block is the relative bit position with
  268. * respect to dsc_a_base of the first actual bit of the array.
  269. *
  270. * The strides block has the following format:
  271. * long dsc_l_v0; Bit offset of the element whose subscripts are all zero,
  272. * with respect to dsc_a_base
  273. * unsigned long dsc_l_s [DIMCT]; Strides
  274. *
  275. * The bounds block has the following format:
  276. * struct
  277. * {
  278. * long dsc_l_l; Lower bound
  279. * long dsc_l_u; Upper bound
  280. * } dsc_bounds [DIMCT];
  281. *
  282. * The last block has the following format:
  283. * long dsc_l_pos;
  284. *
  285. * (DIMCT represents the value contained in dsc_b_dimct.)
  286. */
  287. };
  288. /*
  289. * String with Bounds Descriptor:
  290. */
  291. struct dsc_descriptor_sb
  292. {
  293. unsigned short dsc_w_length; /* length of string in bytes */
  294. unsigned char dsc_b_dtype; /* data type code = DSC_K_DTYPE_T */
  295. unsigned char dsc_b_class; /* descriptor class code = DSC_K_CLASS_SB */
  296. char *dsc_a_pointer; /* address of first byte of data storage */
  297. long dsc_l_sb_l1; /* lower bound */
  298. long dsc_l_sb_u1; /* upper bound */
  299. };
  300. /*
  301. * Unaligned Bit String with Bounds Descriptor:
  302. */
  303. struct dsc_descriptor_ubsb
  304. {
  305. unsigned short dsc_w_length; /* length of data item in bits */
  306. unsigned char dsc_b_dtype; /* data type code = DSC_K_DTYPE_VU */
  307. unsigned char dsc_b_class; /* descriptor class code = DSC_K_CLASS_UBSB */
  308. char *dsc_a_base; /* address to which dsc_l_pos is relative */
  309. long dsc_l_pos; /* bit position relative to dsc_a_base of first bit in string */
  310. long dsc_l_ubsb_l1; /* lower bound */
  311. long dsc_l_ubsb_u1; /* upper bound */
  312. };
  313. /*
  314. * Codes for dsc_b_dtype:
  315. */
  316. /*
  317. * Atomic data types:
  318. */
  319. #define DSC_K_DTYPE_Z 0 /* unspecified */
  320. #define DSC_K_DTYPE_BU 2 /* byte (unsigned); 8-bit unsigned quantity */
  321. #define DSC_K_DTYPE_WU 3 /* word (unsigned); 16-bit unsigned quantity */
  322. #define DSC_K_DTYPE_LU 4 /* longword (unsigned); 32-bit unsigned quantity */
  323. #define DSC_K_DTYPE_QU 5 /* quadword (unsigned); 64-bit unsigned quantity */
  324. #define DSC_K_DTYPE_OU 25 /* octaword (unsigned); 128-bit unsigned quantity */
  325. #define DSC_K_DTYPE_B 6 /* byte integer (signed); 8-bit signed 2's-complement integer */
  326. #define DSC_K_DTYPE_W 7 /* word integer (signed); 16-bit signed 2's-complement integer */
  327. #define DSC_K_DTYPE_L 8 /* longword integer (signed); 32-bit signed 2's-complement integer */
  328. #define DSC_K_DTYPE_Q 9 /* quadword integer (signed); 64-bit signed 2's-complement integer */
  329. #define DSC_K_DTYPE_O 26 /* octaword integer (signed); 128-bit signed 2's-complement integer */
  330. #define DSC_K_DTYPE_F 10 /* F_floating; 32-bit single-precision floating point */
  331. #define DSC_K_DTYPE_D 11 /* D_floating; 64-bit double-precision floating point */
  332. #define DSC_K_DTYPE_G 27 /* G_floating; 64-bit double-precision floating point */
  333. #define DSC_K_DTYPE_H 28 /* H_floating; 128-bit quadruple-precision floating point */
  334. #define DSC_K_DTYPE_FC 12 /* F_floating complex */
  335. #define DSC_K_DTYPE_DC 13 /* D_floating complex */
  336. #define DSC_K_DTYPE_GC 29 /* G_floating complex */
  337. #define DSC_K_DTYPE_HC 30 /* H_floating complex */
  338. #define DSC_K_DTYPE_CIT 31 /* COBOL Intermediate Temporary */
  339. /*
  340. * String data types:
  341. */
  342. #define DSC_K_DTYPE_T 14 /* character string; a single 8-bit character or a sequence of characters */
  343. #define DSC_K_DTYPE_VT 37 /* varying character string; 16-bit count, followed by a string */
  344. #define DSC_K_DTYPE_NU 15 /* numeric string, unsigned */
  345. #define DSC_K_DTYPE_NL 16 /* numeric string, left separate sign */
  346. #define DSC_K_DTYPE_NLO 17 /* numeric string, left overpunched sign */
  347. #define DSC_K_DTYPE_NR 18 /* numeric string, right separate sign */
  348. #define DSC_K_DTYPE_NRO 19 /* numeric string, right overpunched sign */
  349. #define DSC_K_DTYPE_NZ 20 /* numeric string, zoned sign */
  350. #define DSC_K_DTYPE_P 21 /* packed decimal string */
  351. #define DSC_K_DTYPE_V 1 /* aligned bit string */
  352. #define DSC_K_DTYPE_VU 34 /* unaligned bit string */
  353. /*
  354. * Miscellaneous data types:
  355. */
  356. #define DSC_K_DTYPE_ZI 22 /* sequence of instructions */
  357. #define DSC_K_DTYPE_ZEM 23 /* procedure entry mask */
  358. #define DSC_K_DTYPE_DSC 24 /* descriptor */
  359. #define DSC_K_DTYPE_BPV 32 /* bound procedure value */
  360. #define DSC_K_DTYPE_BLV 33 /* bound label value */
  361. #define DSC_K_DTYPE_ADT 35 /* absolute date and time */
  362. /*
  363. * Reserved data type codes:
  364. * codes 38-191 are reserved to DIGITAL;
  365. * codes 160-191 are reserved to DIGITAL facilities for facility-specific purposes;
  366. * codes 192-255 are reserved for DIGITAL's Computer Special Systems Group
  367. * and for customers for their own use.
  368. */
  369. /*
  370. * Codes for dsc_b_class:
  371. */
  372. #define DSC_K_CLASS_S 1 /* fixed-length descriptor */
  373. #define DSC_K_CLASS_D 2 /* dynamic string descriptor */
  374. /* DSC_K_CLASS_V ** variable buffer descriptor; reserved for use by DIGITAL */
  375. #define DSC_K_CLASS_A 4 /* array descriptor */
  376. #define DSC_K_CLASS_P 5 /* procedure descriptor */
  377. /* DSC_K_CLASS_PI ** procedure incarnation descriptor; obsolete */
  378. /* DSC_K_CLASS_J ** label descriptor; reserved for use by the VMS Debugger */
  379. /* DSC_K_CLASS_JI ** label incarnation descriptor; obsolete */
  380. #define DSC_K_CLASS_SD 9 /* decimal string descriptor */
  381. #define DSC_K_CLASS_NCA 10 /* noncontiguous array descriptor */
  382. #define DSC_K_CLASS_VS 11 /* varying string descriptor */
  383. #define DSC_K_CLASS_VSA 12 /* varying string array descriptor */
  384. #define DSC_K_CLASS_UBS 13 /* unaligned bit string descriptor */
  385. #define DSC_K_CLASS_UBA 14 /* unaligned bit array descriptor */
  386. #define DSC_K_CLASS_SB 15 /* string with bounds descriptor */
  387. #define DSC_K_CLASS_UBSB 16 /* unaligned bit string with bounds descriptor */
  388. /*
  389. * Reserved descriptor class codes:
  390. * codes 15-191 are reserved to DIGITAL;
  391. * codes 160-191 are reserved to DIGITAL facilities for facility-specific purposes;
  392. * codes 192-255 are reserved for DIGITAL's Computer Special Systems Group
  393. * and for customers for their own use.
  394. */
  395. /*
  396. * A simple macro to construct a string descriptor:
  397. */
  398. #define DESCRIPTOR(name,string) struct dsc_descriptor_s name = { sizeof(string)-1, DSC_K_DTYPE_T, DSC_K_CLASS_S, string }
  399. #define DSC_DESCRIPTOR(name,string) struct dsc_descriptor_s name = { sizeof(string)-1, DSC_K_DTYPE_T, DSC_K_CLASS_S, string }
  400. #define DESCRIP_H_DEFINED
  401. #endif