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