ncx.h 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753
  1. /*
  2. * Copyright 1996, University Corporation for Atmospheric Research
  3. * See netcdf/COPYRIGHT file for copying and redistribution conditions.
  4. */
  5. /* "$Id: ncx.h,v 1.65 2010/05/26 18:11:08 dmh Exp $" */
  6. #ifndef _NCX_H_
  7. #define _NCX_H_
  8. #include "ncdispatch.h"
  9. #include "ncio.h"
  10. #include "fbits.h"
  11. /*
  12. * An external data representation interface.
  13. *
  14. * This started out as a general replacement for ONC XDR,
  15. * specifically, the xdrmem family of functions.
  16. *
  17. * We eventually realized that we could write more portable
  18. * code if we decoupled any association between the 'C' types
  19. * and the external types. (XDR has this association between the 'C'
  20. * types and the external representations, like xdr_int() takes
  21. * an int argument and goes to an external int representation.)
  22. * So, now there is a matrix of functions.
  23. *
  24. */
  25. #include <config.h> /* output of 'configure' */
  26. #include "rnd.h"
  27. #include <stddef.h> /* size_t */
  28. #include <errno.h>
  29. #include <sys/types.h> /* off_t */
  30. #include <ncdispatch.h>
  31. #define longlong long long
  32. #if defined(_CRAY) && !defined(_CRAYIEEE) && !defined(__crayx1)
  33. #define CRAYFLOAT 1 /* CRAY Floating point */
  34. #elif defined(_SX) && defined(_FLOAT2) /* NEC SUPER-UX in CRAY mode */
  35. #define CRAYFLOAT 1 /* CRAY Floating point */
  36. #endif
  37. /*
  38. * The integer return code for the conversion routines
  39. * is 0 (ENOERR) when no error occured, or NC_ERANGE as appropriate
  40. * for an overflow conversion.
  41. */
  42. #ifndef ENOERR
  43. #define ENOERR 0
  44. #endif
  45. #ifndef NC_ERANGE
  46. #define NC_ERANGE (-60) /* N.B. must match value in netcdf.h */
  47. #endif
  48. #ifndef NC_ENOMEM
  49. #define NC_ENOMEM (-61) /* N.B. must match value in netcdf.h */
  50. #endif
  51. /*
  52. * External sizes of the primitive elements.
  53. */
  54. #define X_SIZEOF_CHAR 1
  55. #define X_SIZEOF_SHORT 2
  56. #define X_SIZEOF_INT 4 /* xdr_int */
  57. #if 0
  58. #define X_SIZEOF_LONG 8 */ /* xdr_long_long */
  59. #endif
  60. #define X_SIZEOF_FLOAT 4
  61. #define X_SIZEOF_DOUBLE 8
  62. /*
  63. * For now, netcdf is limited to 32 bit sizes,
  64. * If compiled with support for "large files", then
  65. * netcdf will use a 64 bit off_t and it can then write a file
  66. * using 64 bit offsets.
  67. * see also X_SIZE_MAX, X_OFF_MAX below
  68. */
  69. #define X_SIZEOF_OFF_T (sizeof(off_t))
  70. #define X_SIZEOF_SIZE_T X_SIZEOF_INT
  71. /*
  72. * limits of the external representation
  73. */
  74. #define X_SCHAR_MIN (-128)
  75. #define X_SCHAR_MAX 127
  76. #define X_UCHAR_MAX 255U
  77. #define X_SHORT_MIN (-32768)
  78. #define X_SHRT_MIN X_SHORT_MIN /* alias compatible with limits.h */
  79. #define X_SHORT_MAX 32767
  80. #define X_SHRT_MAX X_SHORT_MAX /* alias compatible with limits.h */
  81. #define X_USHORT_MAX 65535U
  82. #define X_USHRT_MAX X_USHORT_MAX /* alias compatible with limits.h */
  83. #define X_INT_MIN (-2147483647-1)
  84. #define X_INT_MAX 2147483647
  85. #define X_UINT_MAX 4294967295U
  86. #define X_LONGLONG_MIN (-9223372036854775807LL-1LL)
  87. #define X_LONGLONG_MAX 9223372036854775807LL
  88. #define X_ULONGLONG_MAX 18446744073709551615ULL
  89. #define X_FLOAT_MAX 3.402823466e+38f
  90. #define X_FLOAT_MIN (-X_FLOAT_MAX)
  91. #define X_FLT_MAX X_FLOAT_MAX /* alias compatible with limits.h */
  92. #if CRAYFLOAT
  93. /* ldexp(1. - ldexp(.5 , -46), 1024) */
  94. #define X_DOUBLE_MAX 1.79769313486230e+308
  95. #else
  96. /* scalb(1. - scalb(.5 , -52), 1024) */
  97. #define X_DOUBLE_MAX 1.7976931348623157e+308
  98. #endif
  99. #define X_DOUBLE_MIN (-X_DOUBLE_MAX)
  100. #define X_DBL_MAX X_DOUBLE_MAX /* alias compatible with limits.h */
  101. #define X_SIZE_MAX X_UINT_MAX
  102. #define X_OFF_MAX X_INT_MAX
  103. /* Begin ncx_len */
  104. /*
  105. * ncx_len_xxx() interfaces are defined as macros below,
  106. * These give the length of an array of nelems of the type.
  107. * N.B. The 'char' and 'short' interfaces give the X_ALIGNED length.
  108. */
  109. #define X_ALIGN 4 /* a.k.a. BYTES_PER_XDR_UNIT */
  110. #define ncx_len_char(nelems) \
  111. _RNDUP((nelems), X_ALIGN)
  112. #define ncx_len_short(nelems) \
  113. (((nelems) + (nelems)%2) * X_SIZEOF_SHORT)
  114. #define ncx_len_int(nelems) \
  115. ((nelems) * X_SIZEOF_INT)
  116. #define ncx_len_long(nelems) \
  117. ((nelems) * X_SIZEOF_LONG)
  118. #define ncx_len_float(nelems) \
  119. ((nelems) * X_SIZEOF_FLOAT)
  120. #define ncx_len_double(nelems) \
  121. ((nelems) * X_SIZEOF_DOUBLE)
  122. /* End ncx_len */
  123. #if __CHAR_UNSIGNED__
  124. /* 'char' is unsigned, declare ncbyte as 'signed char' */
  125. typedef signed char schar;
  126. #else
  127. /* 'char' is signed */
  128. typedef signed char schar;
  129. #endif /* __CHAR_UNSIGNED__ */
  130. /*
  131. * Primitive numeric conversion functions.
  132. * The `put' functions convert from native internal
  133. * type to the external type, while the `get' functions
  134. * convert from the external to the internal.
  135. *
  136. * These take the form
  137. * int ncx_get_{external_type}_{internal_type}(
  138. * const void *xp,
  139. * internal_type *ip
  140. * );
  141. * int ncx_put_{external_type}_{internal_type}(
  142. * void *xp,
  143. * const internal_type *ip
  144. * );
  145. * where
  146. * `external_type' and `internal_type' chosen from
  147. schar
  148. uchar
  149. short
  150. ushort
  151. int
  152. uint
  153. long
  154. ulong
  155. float
  156. double
  157. *
  158. * Not all combinations make sense.
  159. * We may not implement all combinations that make sense.
  160. * The netcdf functions that use this ncx interface don't
  161. * use these primitive conversion functions. They use the
  162. * aggregate conversion functions declared below.
  163. *
  164. * Storage for a single element of external type is at the `void * xp'
  165. * argument.
  166. *
  167. * Storage for a single element of internal type is at `ip' argument.
  168. *
  169. * These functions return 0 (ENOERR) when no error occured,
  170. * or NC_ERANGE when the value being converted is too large.
  171. * When NC_ERANGE occurs, an undefined (implementation dependent)
  172. * conversion may have occured.
  173. *
  174. * Note that loss of precision may occur silently.
  175. *
  176. */
  177. #if 0
  178. extern int
  179. ncx_get_schar_schar(const void *xp, schar *ip);
  180. extern int
  181. ncx_get_schar_uchar(const void *xp, uchar *ip);
  182. extern int
  183. ncx_get_schar_short(const void *xp, short *ip);
  184. extern int
  185. ncx_get_schar_int(const void *xp, int *ip);
  186. extern int
  187. ncx_get_schar_long(const void *xp, long *ip);
  188. extern int
  189. ncx_get_schar_float(const void *xp, float *ip);
  190. extern int
  191. ncx_get_schar_double(const void *xp, double *ip);
  192. extern int
  193. ncx_put_schar_schar(void *xp, const schar *ip);
  194. extern int
  195. ncx_put_schar_uchar(void *xp, const uchar *ip);
  196. extern int
  197. ncx_put_schar_short(void *xp, const short *ip);
  198. extern int
  199. ncx_put_schar_int(void *xp, const int *ip);
  200. extern int
  201. ncx_put_schar_long(void *xp, const long *ip);
  202. extern int
  203. ncx_put_schar_float(void *xp, const float *ip);
  204. extern int
  205. ncx_put_schar_double(void *xp, const double *ip);
  206. #endif
  207. extern int
  208. ncx_get_short_schar(const void *xp, schar *ip);
  209. extern int
  210. ncx_get_short_uchar(const void *xp, uchar *ip);
  211. extern int
  212. ncx_get_short_short(const void *xp, short *ip);
  213. extern int
  214. ncx_get_short_int(const void *xp, int *ip);
  215. extern int
  216. ncx_get_short_long(const void *xp, long *ip);
  217. extern int
  218. ncx_get_short_float(const void *xp, float *ip);
  219. extern int
  220. ncx_get_short_double(const void *xp, double *ip);
  221. extern int
  222. ncx_put_short_schar(void *xp, const schar *ip);
  223. extern int
  224. ncx_put_short_uchar(void *xp, const uchar *ip);
  225. extern int
  226. ncx_put_short_short(void *xp, const short *ip);
  227. extern int
  228. ncx_put_short_int(void *xp, const int *ip);
  229. extern int
  230. ncx_put_short_long(void *xp, const long *ip);
  231. extern int
  232. ncx_put_short_float(void *xp, const float *ip);
  233. extern int
  234. ncx_put_short_double(void *xp, const double *ip);
  235. extern int
  236. ncx_get_int_schar(const void *xp, schar *ip);
  237. extern int
  238. ncx_get_int_uchar(const void *xp, uchar *ip);
  239. extern int
  240. ncx_get_int_short(const void *xp, short *ip);
  241. extern int
  242. ncx_get_int_int(const void *xp, int *ip);
  243. extern int
  244. ncx_get_int_long(const void *xp, long *ip);
  245. extern int
  246. ncx_get_int_float(const void *xp, float *ip);
  247. extern int
  248. ncx_get_int_double(const void *xp, double *ip);
  249. extern int
  250. ncx_put_int_schar(void *xp, const schar *ip);
  251. extern int
  252. ncx_put_int_uchar(void *xp, const uchar *ip);
  253. extern int
  254. ncx_put_int_short(void *xp, const short *ip);
  255. extern int
  256. ncx_put_int_int(void *xp, const int *ip);
  257. extern int
  258. ncx_put_int_long(void *xp, const long *ip);
  259. extern int
  260. ncx_put_int_float(void *xp, const float *ip);
  261. extern int
  262. ncx_put_int_double(void *xp, const double *ip);
  263. extern int
  264. ncx_get_float_schar(const void *xp, schar *ip);
  265. extern int
  266. ncx_get_float_uchar(const void *xp, uchar *ip);
  267. extern int
  268. ncx_get_float_short(const void *xp, short *ip);
  269. extern int
  270. ncx_get_float_int(const void *xp, int *ip);
  271. extern int
  272. ncx_get_float_long(const void *xp, long *ip);
  273. extern int
  274. ncx_get_float_float(const void *xp, float *ip);
  275. extern int
  276. ncx_get_float_double(const void *xp, double *ip);
  277. extern int
  278. ncx_put_float_schar(void *xp, const schar *ip);
  279. extern int
  280. ncx_put_float_uchar(void *xp, const uchar *ip);
  281. extern int
  282. ncx_put_float_short(void *xp, const short *ip);
  283. extern int
  284. ncx_put_float_int(void *xp, const int *ip);
  285. extern int
  286. ncx_put_float_long(void *xp, const long *ip);
  287. extern int
  288. ncx_put_float_float(void *xp, const float *ip);
  289. extern int
  290. ncx_put_float_double(void *xp, const double *ip);
  291. extern int
  292. ncx_get_double_schar(const void *xp, schar *ip);
  293. extern int
  294. ncx_get_double_uchar(const void *xp, uchar *ip);
  295. extern int
  296. ncx_get_double_short(const void *xp, short *ip);
  297. extern int
  298. ncx_get_double_int(const void *xp, int *ip);
  299. extern int
  300. ncx_get_double_long(const void *xp, long *ip);
  301. extern int
  302. ncx_get_double_float(const void *xp, float *ip);
  303. extern int
  304. ncx_get_double_double(const void *xp, double *ip);
  305. extern int
  306. ncx_put_double_schar(void *xp, const schar *ip);
  307. extern int
  308. ncx_put_double_uchar(void *xp, const uchar *ip);
  309. extern int
  310. ncx_put_double_short(void *xp, const short *ip);
  311. extern int
  312. ncx_put_double_int(void *xp, const int *ip);
  313. extern int
  314. ncx_put_double_long(void *xp, const long *ip);
  315. extern int
  316. ncx_put_double_float(void *xp, const float *ip);
  317. extern int
  318. ncx_put_double_double(void *xp, const double *ip);
  319. /*
  320. * Other primitive conversion functions
  321. * N.B. slightly different interface
  322. * Used by netcdf.
  323. */
  324. /* ncx_get_int_size_t */
  325. extern int
  326. ncx_get_size_t(const void **xpp, size_t *ulp);
  327. /* ncx_get_int_off_t */
  328. extern int
  329. ncx_get_off_t(const void **xpp, off_t *lp, size_t sizeof_off_t);
  330. /* ncx_put_int_size_t */
  331. extern int
  332. ncx_put_size_t(void **xpp, const size_t *ulp);
  333. /* ncx_put_int_off_t */
  334. extern int
  335. ncx_put_off_t(void **xpp, const off_t *lp, size_t sizeof_off_t);
  336. /*
  337. * Aggregate numeric conversion functions.
  338. * Convert an array. Replaces xdr_array(...).
  339. * These functions are used by netcdf. Unlike the xdr
  340. * interface, we optimize for aggregate conversions.
  341. * This functions should be implemented to take advantage
  342. * of multiple processor / parallel hardware where available.
  343. *
  344. * These take the form
  345. * int ncx_getn_{external_type}_{internal_type}(
  346. * const void *xpp,
  347. * size_t nelems,
  348. * internal_type *ip
  349. * );
  350. * int ncx_putn_{external_type}_{internal_type}(
  351. * void **xpp,
  352. * size_t nelems,
  353. * const internal_type *ip
  354. * );
  355. * Where the types are as in the primitive numeric conversion functions.
  356. *
  357. * The value of the pointer to pointer argument, *xpp, is
  358. * expected to reference storage for `nelems' of the external
  359. * type. On return, it modified to reference just past the last
  360. * converted external element.
  361. *
  362. * The types whose external size is less than X_ALIGN also have `pad'
  363. * interfaces. These round (and zero fill on put) *xpp up to X_ALIGN
  364. * boundaries. (This is the usual xdr behavior.)
  365. *
  366. * The `ip' argument should point to an array of `nelems' of
  367. * internal_type.
  368. *
  369. * Range errors (NC_ERANGE) for a individual values in the array
  370. * DO NOT terminate the array conversion. All elements are converted,
  371. * with some having undefined values.
  372. * If any range error occurs, the function returns NC_ERANGE.
  373. *
  374. */
  375. extern int
  376. ncx_getn_schar_schar(const void **xpp, size_t nelems, schar *ip);
  377. extern int
  378. ncx_getn_schar_uchar(const void **xpp, size_t nelems, uchar *ip);
  379. extern int
  380. ncx_getn_schar_short(const void **xpp, size_t nelems, short *ip);
  381. extern int
  382. ncx_getn_schar_int(const void **xpp, size_t nelems, int *ip);
  383. extern int
  384. ncx_getn_schar_long(const void **xpp, size_t nelems, long *ip);
  385. extern int
  386. ncx_getn_schar_float(const void **xpp, size_t nelems, float *ip);
  387. extern int
  388. ncx_getn_schar_double(const void **xpp, size_t nelems, double *ip);
  389. extern int
  390. ncx_getn_schar_uint(const void **xpp, size_t nelems, unsigned int *ip);
  391. extern int
  392. ncx_getn_schar_longlong(const void **xpp, size_t nelems, longlong *ip);
  393. extern int
  394. ncx_getn_schar_ulonglong(const void **xpp, size_t nelems, ulonglong *ip);
  395. extern int
  396. ncx_pad_getn_schar_schar(const void **xpp, size_t nelems, schar *ip);
  397. extern int
  398. ncx_pad_getn_schar_uchar(const void **xpp, size_t nelems, uchar *ip);
  399. extern int
  400. ncx_pad_getn_schar_short(const void **xpp, size_t nelems, short *ip);
  401. extern int
  402. ncx_pad_getn_schar_int(const void **xpp, size_t nelems, int *ip);
  403. extern int
  404. ncx_pad_getn_schar_long(const void **xpp, size_t nelems, long *ip);
  405. extern int
  406. ncx_pad_getn_schar_float(const void **xpp, size_t nelems, float *ip);
  407. extern int
  408. ncx_pad_getn_schar_double(const void **xpp, size_t nelems, double *ip);
  409. extern int
  410. ncx_pad_getn_schar_uint(const void **xpp, size_t nelems, unsigned int *ip);
  411. extern int
  412. ncx_pad_getn_schar_longlong(const void **xpp, size_t nelems, longlong *ip);
  413. extern int
  414. ncx_pad_getn_schar_ulonglong(const void **xpp, size_t nelems, ulonglong *ip);
  415. extern int
  416. ncx_putn_schar_schar(void **xpp, size_t nelems, const schar *ip);
  417. extern int
  418. ncx_putn_schar_uchar(void **xpp, size_t nelems, const uchar *ip);
  419. extern int
  420. ncx_putn_schar_short(void **xpp, size_t nelems, const short *ip);
  421. extern int
  422. ncx_putn_schar_int(void **xpp, size_t nelems, const int *ip);
  423. extern int
  424. ncx_putn_schar_long(void **xpp, size_t nelems, const long *ip);
  425. extern int
  426. ncx_putn_schar_float(void **xpp, size_t nelems, const float *ip);
  427. extern int
  428. ncx_putn_schar_double(void **xpp, size_t nelems, const double *ip);
  429. extern int
  430. ncx_putn_schar_uint(void **xpp, size_t nelems, const unsigned int *ip);
  431. extern int
  432. ncx_putn_schar_longlong(void **xpp, size_t nelems, const longlong *ip);
  433. extern int
  434. ncx_putn_schar_ulonglong(void **xpp, size_t nelems, const ulonglong *ip);
  435. extern int
  436. ncx_pad_putn_schar_schar(void **xpp, size_t nelems, const schar *ip);
  437. extern int
  438. ncx_pad_putn_schar_uchar(void **xpp, size_t nelems, const uchar *ip);
  439. extern int
  440. ncx_pad_putn_schar_short(void **xpp, size_t nelems, const short *ip);
  441. extern int
  442. ncx_pad_putn_schar_int(void **xpp, size_t nelems, const int *ip);
  443. extern int
  444. ncx_pad_putn_schar_long(void **xpp, size_t nelems, const long *ip);
  445. extern int
  446. ncx_pad_putn_schar_float(void **xpp, size_t nelems, const float *ip);
  447. extern int
  448. ncx_pad_putn_schar_double(void **xpp, size_t nelems, const double *ip);
  449. extern int
  450. ncx_pad_putn_schar_uint(void **xpp, size_t nelems, const unsigned int *ip);
  451. extern int
  452. ncx_pad_putn_schar_longlong(void **xpp, size_t nelems, const longlong *ip);
  453. extern int
  454. ncx_pad_putn_schar_ulonglong(void **xpp, size_t nelems, const ulonglong *ip);
  455. extern int
  456. ncx_getn_short_schar(const void **xpp, size_t nelems, schar *ip);
  457. extern int
  458. ncx_getn_short_uchar(const void **xpp, size_t nelems, uchar *ip);
  459. extern int
  460. ncx_getn_short_short(const void **xpp, size_t nelems, short *ip);
  461. extern int
  462. ncx_getn_short_int(const void **xpp, size_t nelems, int *ip);
  463. extern int
  464. ncx_getn_short_long(const void **xpp, size_t nelems, long *ip);
  465. extern int
  466. ncx_getn_short_float(const void **xpp, size_t nelems, float *ip);
  467. extern int
  468. ncx_getn_short_double(const void **xpp, size_t nelems, double *ip);
  469. extern int
  470. ncx_getn_short_uint(const void **xpp, size_t nelems, unsigned int *ip);
  471. extern int
  472. ncx_getn_short_longlong(const void **xpp, size_t nelems, longlong *ip);
  473. extern int
  474. ncx_getn_short_ulonglong(const void **xpp, size_t nelems, ulonglong *ip);
  475. extern int
  476. ncx_pad_getn_short_schar(const void **xpp, size_t nelems, schar *ip);
  477. extern int
  478. ncx_pad_getn_short_uchar(const void **xpp, size_t nelems, uchar *ip);
  479. extern int
  480. ncx_pad_getn_short_short(const void **xpp, size_t nelems, short *ip);
  481. extern int
  482. ncx_pad_getn_short_int(const void **xpp, size_t nelems, int *ip);
  483. extern int
  484. ncx_pad_getn_short_long(const void **xpp, size_t nelems, long *ip);
  485. extern int
  486. ncx_pad_getn_short_float(const void **xpp, size_t nelems, float *ip);
  487. extern int
  488. ncx_pad_getn_short_double(const void **xpp, size_t nelems, double *ip);
  489. extern int
  490. ncx_pad_getn_short_uint(const void **xpp, size_t nelems, unsigned int *ip);
  491. extern int
  492. ncx_pad_getn_short_longlong(const void **xpp, size_t nelems, longlong *ip);
  493. extern int
  494. ncx_pad_getn_short_ulonglong(const void **xpp, size_t nelems, ulonglong *ip);
  495. extern int
  496. ncx_putn_short_schar(void **xpp, size_t nelems, const schar *ip);
  497. extern int
  498. ncx_putn_short_uchar(void **xpp, size_t nelems, const uchar *ip);
  499. extern int
  500. ncx_putn_short_short(void **xpp, size_t nelems, const short *ip);
  501. extern int
  502. ncx_putn_short_int(void **xpp, size_t nelems, const int *ip);
  503. extern int
  504. ncx_putn_short_long(void **xpp, size_t nelems, const long *ip);
  505. extern int
  506. ncx_putn_short_float(void **xpp, size_t nelems, const float *ip);
  507. extern int
  508. ncx_putn_short_double(void **xpp, size_t nelems, const double *ip);
  509. extern int
  510. ncx_putn_short_uint(void **xpp, size_t nelems, const unsigned int *ip);
  511. extern int
  512. ncx_putn_short_longlong(void **xpp, size_t nelems, const longlong *ip);
  513. extern int
  514. ncx_putn_short_ulonglong(void **xpp, size_t nelems, const ulonglong *ip);
  515. extern int
  516. ncx_pad_putn_short_schar(void **xpp, size_t nelems, const schar *ip);
  517. extern int
  518. ncx_pad_putn_short_uchar(void **xpp, size_t nelems, const uchar *ip);
  519. extern int
  520. ncx_pad_putn_short_short(void **xpp, size_t nelems, const short *ip);
  521. extern int
  522. ncx_pad_putn_short_int(void **xpp, size_t nelems, const int *ip);
  523. extern int
  524. ncx_pad_putn_short_long(void **xpp, size_t nelems, const long *ip);
  525. extern int
  526. ncx_pad_putn_short_float(void **xpp, size_t nelems, const float *ip);
  527. extern int
  528. ncx_pad_putn_short_double(void **xpp, size_t nelems, const double *ip);
  529. extern int
  530. ncx_pad_putn_short_uint(void **xpp, size_t nelems, const unsigned int *ip);
  531. extern int
  532. ncx_pad_putn_short_longlong(void **xpp, size_t nelems, const longlong *ip);
  533. extern int
  534. ncx_pad_putn_short_ulonglong(void **xpp, size_t nelems, const ulonglong *ip);
  535. extern int
  536. ncx_getn_int_schar(const void **xpp, size_t nelems, schar *ip);
  537. extern int
  538. ncx_getn_int_uchar(const void **xpp, size_t nelems, uchar *ip);
  539. extern int
  540. ncx_getn_int_short(const void **xpp, size_t nelems, short *ip);
  541. extern int
  542. ncx_getn_int_int(const void **xpp, size_t nelems, int *ip);
  543. extern int
  544. ncx_getn_int_long(const void **xpp, size_t nelems, long *ip);
  545. extern int
  546. ncx_getn_int_float(const void **xpp, size_t nelems, float *ip);
  547. extern int
  548. ncx_getn_int_double(const void **xpp, size_t nelems, double *ip);
  549. extern int
  550. ncx_getn_int_uint(const void **xpp, size_t nelems, unsigned int *ip);
  551. extern int
  552. ncx_getn_int_longlong(const void **xpp, size_t nelems, longlong *ip);
  553. extern int
  554. ncx_getn_int_ulonglong(const void **xpp, size_t nelems, ulonglong *ip);
  555. extern int
  556. ncx_putn_int_schar(void **xpp, size_t nelems, const schar *ip);
  557. extern int
  558. ncx_putn_int_uchar(void **xpp, size_t nelems, const uchar *ip);
  559. extern int
  560. ncx_putn_int_short(void **xpp, size_t nelems, const short *ip);
  561. extern int
  562. ncx_putn_int_int(void **xpp, size_t nelems, const int *ip);
  563. extern int
  564. ncx_putn_int_long(void **xpp, size_t nelems, const long *ip);
  565. extern int
  566. ncx_putn_int_float(void **xpp, size_t nelems, const float *ip);
  567. extern int
  568. ncx_putn_int_double(void **xpp, size_t nelems, const double *ip);
  569. extern int
  570. ncx_putn_int_uint(void **xpp, size_t nelems, const unsigned int *ip);
  571. extern int
  572. ncx_putn_int_longlong(void **xpp, size_t nelems, const longlong *ip);
  573. extern int
  574. ncx_putn_int_ulonglong(void **xpp, size_t nelems, const ulonglong *ip);
  575. extern int
  576. ncx_getn_float_schar(const void **xpp, size_t nelems, schar *ip);
  577. extern int
  578. ncx_getn_float_uchar(const void **xpp, size_t nelems, uchar *ip);
  579. extern int
  580. ncx_getn_float_short(const void **xpp, size_t nelems, short *ip);
  581. extern int
  582. ncx_getn_float_int(const void **xpp, size_t nelems, int *ip);
  583. extern int
  584. ncx_getn_float_long(const void **xpp, size_t nelems, long *ip);
  585. extern int
  586. ncx_getn_float_float(const void **xpp, size_t nelems, float *ip);
  587. extern int
  588. ncx_getn_float_double(const void **xpp, size_t nelems, double *ip);
  589. extern int
  590. ncx_getn_float_uint(const void **xpp, size_t nelems, unsigned int *ip);
  591. extern int
  592. ncx_getn_float_longlong(const void **xpp, size_t nelems, longlong *ip);
  593. extern int
  594. ncx_getn_float_ulonglong(const void **xpp, size_t nelems, ulonglong *ip);
  595. extern int
  596. ncx_putn_float_schar(void **xpp, size_t nelems, const schar *ip);
  597. extern int
  598. ncx_putn_float_uchar(void **xpp, size_t nelems, const uchar *ip);
  599. extern int
  600. ncx_putn_float_short(void **xpp, size_t nelems, const short *ip);
  601. extern int
  602. ncx_putn_float_int(void **xpp, size_t nelems, const int *ip);
  603. extern int
  604. ncx_putn_float_long(void **xpp, size_t nelems, const long *ip);
  605. extern int
  606. ncx_putn_float_float(void **xpp, size_t nelems, const float *ip);
  607. extern int
  608. ncx_putn_float_double(void **xpp, size_t nelems, const double *ip);
  609. extern int
  610. ncx_putn_float_uint(void **xpp, size_t nelems, const unsigned int *ip);
  611. extern int
  612. ncx_putn_float_longlong(void **xpp, size_t nelems, const longlong *ip);
  613. extern int
  614. ncx_putn_float_ulonglong(void **xpp, size_t nelems, const ulonglong *ip);
  615. extern int
  616. ncx_getn_double_schar(const void **xpp, size_t nelems, schar *ip);
  617. extern int
  618. ncx_getn_double_uchar(const void **xpp, size_t nelems, uchar *ip);
  619. extern int
  620. ncx_getn_double_short(const void **xpp, size_t nelems, short *ip);
  621. extern int
  622. ncx_getn_double_int(const void **xpp, size_t nelems, int *ip);
  623. extern int
  624. ncx_getn_double_long(const void **xpp, size_t nelems, long *ip);
  625. extern int
  626. ncx_getn_double_float(const void **xpp, size_t nelems, float *ip);
  627. extern int
  628. ncx_getn_double_double(const void **xpp, size_t nelems, double *ip);
  629. extern int
  630. ncx_getn_double_uint(const void **xpp, size_t nelems, unsigned int *ip);
  631. extern int
  632. ncx_getn_double_longlong(const void **xpp, size_t nelems, longlong *ip);
  633. extern int
  634. ncx_getn_double_ulonglong(const void **xpp, size_t nelems, ulonglong *ip);
  635. extern int
  636. ncx_putn_double_schar(void **xpp, size_t nelems, const schar *ip);
  637. extern int
  638. ncx_putn_double_uchar(void **xpp, size_t nelems, const uchar *ip);
  639. extern int
  640. ncx_putn_double_short(void **xpp, size_t nelems, const short *ip);
  641. extern int
  642. ncx_putn_double_int(void **xpp, size_t nelems, const int *ip);
  643. extern int
  644. ncx_putn_double_long(void **xpp, size_t nelems, const long *ip);
  645. extern int
  646. ncx_putn_double_float(void **xpp, size_t nelems, const float *ip);
  647. extern int
  648. ncx_putn_double_double(void **xpp, size_t nelems, const double *ip);
  649. extern int
  650. ncx_putn_double_uint(void **xpp, size_t nelems, const unsigned int *ip);
  651. extern int
  652. ncx_putn_double_longlong(void **xpp, size_t nelems, const longlong *ip);
  653. extern int
  654. ncx_putn_double_ulonglong(void **xpp, size_t nelems, const ulonglong *ip);
  655. /*
  656. * Other aggregate conversion functions.
  657. */
  658. /* read ASCII characters */
  659. extern int
  660. ncx_getn_text(const void **xpp, size_t nchars, char *cp);
  661. extern int
  662. ncx_pad_getn_text(const void **xpp, size_t nchars, char *cp);
  663. /* write ASCII characters */
  664. extern int
  665. ncx_putn_text(void **xpp, size_t nchars, const char *cp);
  666. extern int
  667. ncx_pad_putn_text(void **xpp, size_t nchars, const char *cp);
  668. /* for symmetry */
  669. #define ncx_getn_char_char(xpp, nelems, fillp) ncx_getn_text(xpp, nelems, fillp)
  670. #define ncx_putn_char_char(xpp, nelems, fillp) ncx_putn_text(xpp, nelems, fillp)
  671. /* read opaque data */
  672. extern int
  673. ncx_getn_void(const void **xpp, size_t nchars, void *vp);
  674. extern int
  675. ncx_pad_getn_void(const void **xpp, size_t nchars, void *vp);
  676. /* write opaque data */
  677. extern int
  678. ncx_putn_void(void **xpp, size_t nchars, const void *vp);
  679. extern int
  680. ncx_pad_putn_void(void **xpp, size_t nchars, const void *vp);
  681. #endif /* _NCX_H_ */