Windows NT 4.0 source code leak
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.

437 lines
21 KiB

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