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.

566 lines
17 KiB

  1. /* file: cvt.h */
  2. /*
  3. **
  4. ** COPYRIGHT (c) 1989, 1990 BY
  5. ** DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASSACHUSETTS.
  6. ** ALL RIGHTS RESERVED.
  7. **
  8. ** THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND COPIED
  9. ** ONLY IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE AND WITH THE
  10. ** INCLUSION OF THE ABOVE COPYRIGHT NOTICE. THIS SOFTWARE OR ANY OTHER
  11. ** COPIES THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY
  12. ** OTHER PERSON. NO TITLE TO AND OWNERSHIP OF THE SOFTWARE IS HEREBY
  13. ** TRANSFERRED.
  14. **
  15. ** THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE
  16. ** AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT
  17. ** CORPORATION.
  18. **
  19. ** DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY OF ITS
  20. ** SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DIGITAL.
  21. **
  22. */
  23. /*
  24. **++
  25. ** Facility:
  26. **
  27. ** CVT Run-Time Library
  28. **
  29. ** Abstract:
  30. **
  31. ** This module contains the public include file for the cvt_* routines.
  32. ** This module contains rountine interfaces as well as necessary
  33. ** definitions.
  34. **
  35. ** Author:
  36. **
  37. ** Math RTL
  38. **
  39. ** Creation Date: December 5, 1989.
  40. **
  41. ** Modification History:
  42. **
  43. ** 1-001 Original created. MRTL 5-Dec-1989.
  44. ** 1-002 Add GEM FORTRAN stuff. TS 27-Mar-1990.
  45. **
  46. **--
  47. */
  48. #ifndef CVT
  49. #define CVT 1
  50. /*
  51. *
  52. * Type Definitions
  53. *
  54. */
  55. typedef unsigned char CVT_BYTE;
  56. typedef CVT_BYTE *CVT_BYTE_PTR;
  57. typedef CVT_BYTE CVT_VAX_F[4];
  58. typedef CVT_BYTE CVT_VAX_D[8];
  59. typedef CVT_BYTE CVT_VAX_G[8];
  60. typedef CVT_BYTE CVT_VAX_H[16];
  61. typedef CVT_BYTE CVT_IEEE_SINGLE[4];
  62. typedef CVT_BYTE CVT_IEEE_DOUBLE[8];
  63. typedef CVT_BYTE CVT_IBM_SHORT[4];
  64. typedef CVT_BYTE CVT_IBM_LONG[8];
  65. typedef CVT_BYTE CVT_CRAY[8];
  66. typedef float CVT_SINGLE;
  67. typedef double CVT_DOUBLE;
  68. typedef long CVT_SIGNED_INT;
  69. typedef unsigned long CVT_UNSIGNED_INT;
  70. typedef unsigned long CVT_STATUS;
  71. /*
  72. *
  73. * Constant Definitions
  74. *
  75. */
  76. #define CVT_C_ROUND_TO_NEAREST 1
  77. #define CVT_C_TRUNCATE 2
  78. #define CVT_C_ROUND_TO_POS 4
  79. #define CVT_C_ROUND_TO_NEG 8
  80. #define CVT_C_VAX_ROUNDING 16
  81. #define CVT_C_BIG_ENDIAN 32
  82. #define CVT_C_ERR_UNDERFLOW 64
  83. #define CVT_C_ZERO_BLANKS 128
  84. #define CVT_C_SKIP_BLANKS 256
  85. #define CVT_C_SKIP_UNDERSCORES 512
  86. #define CVT_C_SKIP_UNDERSCORE 512
  87. #define CVT_C_SKIP_TABS 1024
  88. #define CVT_C_ONLY_E 2048
  89. #define CVT_C_EXP_LETTER_REQUIRED 4096
  90. #define CVT_C_FORCE_SCALE 8192
  91. #define CVT_C_EXPONENTIAL_FORMAT 16384
  92. #define CVT_C_FORCE_PLUS 32768
  93. #define CVT_C_FORCE_EXPONENT_SIGN 65536
  94. #define CVT_C_SUPPRESS_TRAILING_ZEROES 131072
  95. #define CVT_C_FORCE_EXPONENTIAL_FORMAT 262144
  96. #define CVT_C_FORCE_FRACTIONAL_FORMAT 524288
  97. #define CVT_C_EXPONENT_D 1048576
  98. #define CVT_C_EXPONENT_E 2097152
  99. #define CVT_C_SEMANTICS_FORTRAN 4194304
  100. #define CVT_C_SEMANTICS_PASCAL 8388608
  101. #define cvt__normal 1
  102. #define cvt__invalid_character 2
  103. #define cvt__invalid_option 3
  104. #define cvt__invalid_radix 4
  105. #define cvt__invalid_size 5
  106. #define cvt__invalid_value 6
  107. #define cvt__neg_infinity 7
  108. #define cvt__output_conversion_error 8
  109. #define cvt__overflow 9
  110. #define cvt__pos_infinity 10
  111. #define cvt__underflow 11
  112. #define cvt__input_conversion_error 12
  113. #define cvt_s_normal cvt__normal
  114. #define cvt_s_invalid_character cvt__invalid_character
  115. #define cvt_s_invalid_option cvt__invalid_option
  116. #define cvt_s_invalid_radix cvt__invalid_radix
  117. #define cvt_s_invalid_size cvt__invalid_size
  118. #define cvt_s_invalid_value cvt__invalid_value
  119. #define cvt_s_neg_infinity cvt__neg_infinity
  120. #define cvt_s_input_conversion_error cvt__input_conversion_error
  121. #define cvt_s_output_conversion_error cvt__output_conversion_error
  122. #define cvt_s_overflow cvt__overflow
  123. #define cvt_s_pos_infinity cvt__pos_infinity
  124. #define cvt_s_underflow cvt__underflow
  125. #define CVT_C_BIN 2
  126. #define CVT_C_OCT 8
  127. #define CVT_C_DEC 10
  128. #define CVT_C_HEX 16
  129. /*
  130. *
  131. * Routine interfaces
  132. *
  133. */
  134. #ifndef PCC
  135. extern void cvt_cray_to_vax_f (
  136. CVT_CRAY input_value,
  137. CVT_SIGNED_INT options,
  138. CVT_VAX_F output_value
  139. );
  140. extern void cvt_cray_to_vax_d (
  141. CVT_CRAY input_value,
  142. CVT_SIGNED_INT options,
  143. CVT_VAX_D output_value
  144. );
  145. extern void cvt_cray_to_vax_g (
  146. CVT_CRAY input_value,
  147. CVT_SIGNED_INT options,
  148. CVT_VAX_G output_value
  149. );
  150. extern void cvt_cray_to_vax_h (
  151. CVT_CRAY input_value,
  152. CVT_SIGNED_INT options,
  153. CVT_VAX_H output_value
  154. );
  155. extern void cvt_cray_to_ieee_single (
  156. CVT_CRAY input_value,
  157. CVT_SIGNED_INT options,
  158. CVT_IEEE_SINGLE output_value
  159. );
  160. extern void cvt_cray_to_ieee_double (
  161. CVT_CRAY input_value,
  162. CVT_SIGNED_INT options,
  163. CVT_IEEE_DOUBLE output_value
  164. );
  165. extern void cvt_ibm_short_to_vax_f (
  166. CVT_IBM_SHORT input_value,
  167. CVT_SIGNED_INT options,
  168. CVT_VAX_F output_value
  169. );
  170. extern void cvt_ibm_short_to_ieee_single (
  171. CVT_IBM_SHORT input_value,
  172. CVT_SIGNED_INT options,
  173. CVT_IEEE_SINGLE output_value
  174. );
  175. extern void cvt_ibm_long_to_vax_d (
  176. CVT_IBM_LONG input_value,
  177. CVT_SIGNED_INT options,
  178. CVT_VAX_D output_value
  179. );
  180. extern void cvt_ibm_long_to_vax_g (
  181. CVT_IBM_LONG input_value,
  182. CVT_SIGNED_INT options,
  183. CVT_VAX_G output_value
  184. );
  185. extern void cvt_ibm_long_to_vax_h (
  186. CVT_IBM_LONG input_value,
  187. CVT_SIGNED_INT options,
  188. CVT_VAX_H output_value
  189. );
  190. extern void cvt_ibm_long_to_ieee_double (
  191. CVT_IBM_LONG input_value,
  192. CVT_SIGNED_INT options,
  193. CVT_IEEE_DOUBLE output_value
  194. );
  195. extern void cvt_ieee_single_endian (
  196. CVT_IEEE_SINGLE input_value,
  197. CVT_IEEE_SINGLE output_value
  198. );
  199. extern void cvt_ieee_single_to_cray (
  200. CVT_IEEE_SINGLE input_value,
  201. CVT_SIGNED_INT options,
  202. CVT_CRAY output_value
  203. );
  204. extern void cvt_ieee_single_to_ibm_short (
  205. CVT_IEEE_SINGLE input_value,
  206. CVT_SIGNED_INT options,
  207. CVT_IBM_SHORT output_value
  208. );
  209. extern void cvt_ieee_single_to_vax_f (
  210. CVT_IEEE_SINGLE input_value,
  211. CVT_SIGNED_INT options,
  212. CVT_VAX_F output_value
  213. );
  214. extern void cvt_ieee_double_endian (
  215. CVT_IEEE_DOUBLE input_value,
  216. CVT_IEEE_DOUBLE output_value
  217. );
  218. extern void cvt_ieee_double_to_cray (
  219. CVT_IEEE_DOUBLE input_value,
  220. CVT_SIGNED_INT options,
  221. CVT_CRAY output_value
  222. );
  223. extern void cvt_ieee_double_to_ibm_long (
  224. CVT_IEEE_DOUBLE input_value,
  225. CVT_SIGNED_INT options,
  226. CVT_IBM_LONG output_value
  227. );
  228. extern void cvt_ieee_double_to_vax_d (
  229. CVT_IEEE_DOUBLE input_value,
  230. CVT_SIGNED_INT options,
  231. CVT_VAX_D output_value
  232. );
  233. extern void cvt_ieee_double_to_vax_g (
  234. CVT_IEEE_DOUBLE input_value,
  235. CVT_SIGNED_INT options,
  236. CVT_VAX_G output_value
  237. );
  238. extern void cvt_ieee_double_to_vax_h (
  239. CVT_IEEE_DOUBLE input_value,
  240. CVT_SIGNED_INT options,
  241. CVT_VAX_H output_value
  242. );
  243. extern void cvt_vax_f_to_cray (
  244. CVT_VAX_F input_value,
  245. CVT_SIGNED_INT options,
  246. CVT_CRAY output_value
  247. );
  248. extern void cvt_vax_f_to_ibm_short (
  249. CVT_VAX_F input_value,
  250. CVT_SIGNED_INT options,
  251. CVT_IBM_SHORT output_value
  252. );
  253. extern void cvt_vax_f_to_ieee_single (
  254. CVT_VAX_F input_value,
  255. CVT_SIGNED_INT options,
  256. CVT_IEEE_SINGLE output_value
  257. );
  258. extern void cvt_vax_d_to_cray (
  259. CVT_VAX_D input_value,
  260. CVT_SIGNED_INT options,
  261. CVT_CRAY output_value
  262. );
  263. extern void cvt_vax_d_to_ibm_long (
  264. CVT_VAX_D input_value,
  265. CVT_SIGNED_INT options,
  266. CVT_IBM_LONG output_value
  267. );
  268. extern void cvt_vax_d_to_ieee_double (
  269. CVT_VAX_D input_value,
  270. CVT_SIGNED_INT options,
  271. CVT_IEEE_DOUBLE output_value
  272. );
  273. extern void cvt_vax_g_to_cray (
  274. CVT_VAX_G input_value,
  275. CVT_SIGNED_INT options,
  276. CVT_CRAY output_value
  277. );
  278. extern void cvt_vax_g_to_ibm_long (
  279. CVT_VAX_G input_value,
  280. CVT_SIGNED_INT options,
  281. CVT_IBM_LONG output_value
  282. );
  283. extern void cvt_vax_g_to_ieee_double (
  284. CVT_VAX_G input_value,
  285. CVT_SIGNED_INT options,
  286. CVT_IEEE_DOUBLE output_value
  287. );
  288. extern void cvt_vax_h_to_cray (
  289. CVT_VAX_H input_value,
  290. CVT_SIGNED_INT options,
  291. CVT_CRAY output_value
  292. );
  293. extern void cvt_vax_h_to_ibm_long (
  294. CVT_VAX_H input_value,
  295. CVT_SIGNED_INT options,
  296. CVT_IBM_LONG output_value
  297. );
  298. extern void cvt_vax_h_to_ieee_double (
  299. CVT_VAX_H input_value,
  300. CVT_SIGNED_INT options,
  301. CVT_VAX_H output_value
  302. );
  303. extern CVT_SINGLE cvt_integer_to_single(
  304. CVT_SIGNED_INT, /* input_value */
  305. CVT_SIGNED_INT /* options */
  306. );
  307. extern CVT_DOUBLE cvt_integer_to_double(
  308. CVT_SIGNED_INT /* input_value */
  309. );
  310. #ifdef VAX
  311. extern CVT_SIGNED_INT cvt_single_to_integer(
  312. CVT_DOUBLE, /* input_value */
  313. CVT_SIGNED_INT /* options */
  314. );
  315. #else
  316. extern CVT_SIGNED_INT cvt_single_to_integer(
  317. CVT_SINGLE, /* input_value */
  318. CVT_SIGNED_INT /* options */
  319. );
  320. #endif
  321. extern CVT_SIGNED_INT cvt_double_to_integer(
  322. CVT_DOUBLE, /* input_value */
  323. CVT_SIGNED_INT /* options */
  324. );
  325. #ifdef VAX
  326. extern CVT_DOUBLE cvt_single_to_double(
  327. CVT_DOUBLE /* input_value */
  328. );
  329. #else
  330. extern CVT_DOUBLE cvt_single_to_double(
  331. CVT_SINGLE /* input_value */
  332. );
  333. #endif
  334. extern CVT_SINGLE cvt_double_to_single(
  335. CVT_DOUBLE, /* input_value */
  336. CVT_SIGNED_INT /* options */
  337. );
  338. extern void cvt_integer_endian (
  339. CVT_UNSIGNED_INT, /* input_value */
  340. CVT_UNSIGNED_INT * /* output_value */
  341. );
  342. extern void cvt_data_endian (
  343. unsigned char *, /* input_value */
  344. CVT_SIGNED_INT, /* value_size */
  345. unsigned char * /* output_value */
  346. );
  347. extern CVT_STATUS cvt_text_to_integer(
  348. char *, /* input_string */
  349. CVT_SIGNED_INT, /* string_size */
  350. CVT_SIGNED_INT, /* options */
  351. CVT_SIGNED_INT * /* resultant value */
  352. );
  353. extern CVT_STATUS cvt_text_to_unsigned(
  354. char *, /* input_string */
  355. CVT_SIGNED_INT, /* string_size */
  356. CVT_SIGNED_INT, /* radix */
  357. CVT_SIGNED_INT, /* options */
  358. CVT_UNSIGNED_INT * /* resultant value */
  359. );
  360. extern CVT_STATUS cvt_integer_to_text(
  361. CVT_SIGNED_INT, /* input_value */
  362. CVT_SIGNED_INT, /* string_size */
  363. CVT_SIGNED_INT, /* number_of_digits */
  364. CVT_SIGNED_INT, /* options */
  365. char * /* resultant_string */
  366. );
  367. extern CVT_STATUS cvt_unsigned_to_text(
  368. CVT_UNSIGNED_INT, /* input_value */
  369. CVT_SIGNED_INT, /* string_size */
  370. CVT_SIGNED_INT, /* radix */
  371. CVT_SIGNED_INT, /* number_of_digits */
  372. char * /* resultant_string */
  373. );
  374. extern CVT_STATUS cvt_text_to_data(
  375. char *, /* input_string */
  376. CVT_SIGNED_INT, /* string_size */
  377. CVT_SIGNED_INT, /* value_size */
  378. CVT_SIGNED_INT, /* radix */
  379. CVT_SIGNED_INT, /* options */
  380. unsigned char *); /* resultant value */
  381. extern CVT_STATUS cvt_data_to_text(
  382. unsigned char *, /* input_value */
  383. CVT_SIGNED_INT, /* string_size */
  384. CVT_SIGNED_INT, /* value_size */
  385. CVT_SIGNED_INT, /* radix */
  386. CVT_SIGNED_INT, /* number_of_digits */
  387. char *); /* resultant_string */
  388. extern CVT_STATUS cvt_text_to_boolean (
  389. char *, /* input_string */
  390. CVT_SIGNED_INT, /* string_size */
  391. CVT_SIGNED_INT, /* options */
  392. CVT_SIGNED_INT *); /* resultant value */
  393. extern CVT_STATUS cvt_boolean_to_text (
  394. CVT_SIGNED_INT, /* input_value */
  395. CVT_SIGNED_INT, /* string_size */
  396. CVT_SIGNED_INT, /* options */
  397. char *); /* resultant_string */
  398. #else // PCC
  399. extern void cvt_cray_to_vax_f ();
  400. extern void cvt_cray_to_vax_d ();
  401. extern void cvt_cray_to_vax_g ();
  402. extern void cvt_cray_to_vax_h ();
  403. extern void cvt_cray_to_ieee_single ();
  404. extern void cvt_cray_to_ieee_double ();
  405. extern void cvt_ibm_short_to_vax_f ();
  406. extern void cvt_ibm_short_to_ieee_single ();
  407. extern void cvt_ibm_long_to_vax_d ();
  408. extern void cvt_ibm_long_to_vax_g ();
  409. extern void cvt_ibm_long_to_vax_h ();
  410. extern void cvt_ibm_long_to_ieee_double ();
  411. extern void cvt_ieee_single_endian ();
  412. extern void cvt_ieee_single_to_cray ();
  413. extern void cvt_ieee_single_to_ibm_short ();
  414. extern void cvt_ieee_single_to_vax_f ();
  415. extern void cvt_ieee_double_endian ();
  416. extern void cvt_ieee_double_to_cray ();
  417. extern void cvt_ieee_double_to_ibm_long ();
  418. extern void cvt_ieee_double_to_vax_d ();
  419. extern void cvt_ieee_double_to_vax_g ();
  420. extern void cvt_ieee_double_to_vax_h ();
  421. extern void cvt_vax_f_to_cray ();
  422. extern void cvt_vax_f_to_ibm_short ();
  423. extern void cvt_vax_f_to_ieee_single ();
  424. extern void cvt_vax_d_to_cray ();
  425. extern void cvt_vax_d_to_ibm_long ();
  426. extern void cvt_vax_d_to_ieee_double ();
  427. extern void cvt_vax_g_to_cray ();
  428. extern void cvt_vax_g_to_ibm_long ();
  429. extern void cvt_vax_g_to_ieee_double ();
  430. extern void cvt_vax_h_to_cray ();
  431. extern void cvt_vax_h_to_ibm_long ();
  432. extern void cvt_vax_h_to_ieee_double ();
  433. extern void cvt_integer_endian ();
  434. extern void cvt_data_endian ();
  435. extern CVT_SINGLE cvt_integer_to_single();
  436. extern CVT_DOUBLE cvt_integer_to_double();
  437. extern CVT_SIGNED_INT cvt_single_to_integer();
  438. extern CVT_SIGNED_INT cvt_double_to_integer();
  439. extern CVT_DOUBLE cvt_single_to_double();
  440. extern CVT_SINGLE cvt_double_to_single();
  441. extern CVT_STATUS cvt_text_to_integer();
  442. extern CVT_STATUS cvt_text_to_unsigned();
  443. extern CVT_STATUS cvt_integer_to_text();
  444. extern CVT_STATUS cvt_unsigned_to_text();
  445. extern CVT_STATUS cvt_text_to_boolean();
  446. extern CVT_STATUS cvt_text_to_data();
  447. extern CVT_STATUS cvt_boolean_to_text();
  448. extern CVT_STATUS cvt_data_to_text();
  449. #endif
  450. #endif /* end of CVT.H */