ncdf4a13/libsrc/putget.c File Reference

#include "nc.h"
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include "ncx.h"
#include "fbits.h"
#include "onstack.h"

Include dependency graph for putget.c:

Go to the source code of this file.

Defines

#define MIN(mm, nn)   (((mm) < (nn)) ? (mm) : (nn))
#define NFILL   16

Functions

int nctypelen (nc_type type)
static int NC_fill_schar (void **xpp, size_t nelems)
static int NC_fill_char (void **xpp, size_t nelems)
static int NC_fill_short (void **xpp, size_t nelems)
static int NC_fill_float (void **xpp, size_t nelems)
static int NC_fill_double (void **xpp, size_t nelems)
int fill_NC_var (NC *ncp, const NC_var *varp, size_t recno)
static int NCfillrecord (NC *ncp, const NC_var *const *varpp, size_t recno)
static int NCvnrecs (NC *ncp, size_t numrecs)
static int NCcoordck (NC *ncp, const NC_var *varp, const size_t *coord)
static int NCedgeck (const NC *ncp, const NC_var *varp, const size_t *start, const size_t *edges)
static off_t NC_varoffset (const NC *ncp, const NC_var *varp, const size_t *coord)
static int putNCvx_char_char (NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, const char *value)
static int putNCvx_schar_schar (NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, const schar *value)
static int putNCvx_schar_uchar (NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, const uchar *value)
static int putNCvx_schar_short (NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, const short *value)
static int putNCvx_schar_int (NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, const int *value)
static int putNCvx_schar_long (NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, const long *value)
static int putNCvx_schar_float (NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, const float *value)
static int putNCvx_schar_double (NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, const double *value)
static int putNCvx_short_schar (NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, const schar *value)
static int putNCvx_short_uchar (NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, const uchar *value)
static int putNCvx_short_short (NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, const short *value)
static int putNCvx_short_int (NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, const int *value)
static int putNCvx_short_long (NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, const long *value)
static int putNCvx_short_float (NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, const float *value)
static int putNCvx_short_double (NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, const double *value)
static int putNCvx_int_schar (NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, const schar *value)
static int putNCvx_int_uchar (NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, const uchar *value)
static int putNCvx_int_short (NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, const short *value)
static int putNCvx_int_int (NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, const int *value)
static int putNCvx_int_long (NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, const long *value)
static int putNCvx_int_float (NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, const float *value)
static int putNCvx_int_double (NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, const double *value)
static int putNCvx_float_schar (NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, const schar *value)
static int putNCvx_float_uchar (NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, const uchar *value)
static int putNCvx_float_short (NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, const short *value)
static int putNCvx_float_int (NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, const int *value)
static int putNCvx_float_long (NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, const long *value)
static int putNCvx_float_float (NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, const float *value)
static int putNCvx_float_double (NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, const double *value)
static int putNCvx_double_schar (NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, const schar *value)
static int putNCvx_double_uchar (NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, const uchar *value)
static int putNCvx_double_short (NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, const short *value)
static int putNCvx_double_int (NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, const int *value)
static int putNCvx_double_long (NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, const long *value)
static int putNCvx_double_float (NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, const float *value)
static int putNCvx_double_double (NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, const double *value)
static int putNCv_text (NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, const char *value)
static int putNCv_schar (NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, const schar *value)
static int putNCv_uchar (NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, const uchar *value)
static int putNCv_short (NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, const short *value)
static int putNCv_int (NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, const int *value)
static int putNCv_long (NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, const long *value)
static int putNCv_float (NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, const float *value)
static int putNCv_double (NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, const double *value)
static int getNCvx_char_char (const NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, char *value)
static int getNCvx_schar_schar (const NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, schar *value)
static int getNCvx_schar_uchar (const NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, uchar *value)
static int getNCvx_schar_short (const NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, short *value)
static int getNCvx_schar_int (const NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, int *value)
static int getNCvx_schar_long (const NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, long *value)
static int getNCvx_schar_float (const NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, float *value)
static int getNCvx_schar_double (const NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, double *value)
static int getNCvx_short_schar (const NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, schar *value)
static int getNCvx_short_uchar (const NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, uchar *value)
static int getNCvx_short_short (const NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, short *value)
static int getNCvx_short_int (const NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, int *value)
static int getNCvx_short_long (const NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, long *value)
static int getNCvx_short_float (const NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, float *value)
static int getNCvx_short_double (const NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, double *value)
static int getNCvx_int_schar (const NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, schar *value)
static int getNCvx_int_uchar (const NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, uchar *value)
static int getNCvx_int_short (const NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, short *value)
static int getNCvx_int_int (const NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, int *value)
static int getNCvx_int_long (const NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, long *value)
static int getNCvx_int_float (const NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, float *value)
static int getNCvx_int_double (const NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, double *value)
static int getNCvx_float_schar (const NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, schar *value)
static int getNCvx_float_uchar (const NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, uchar *value)
static int getNCvx_float_short (const NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, short *value)
static int getNCvx_float_int (const NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, int *value)
static int getNCvx_float_long (const NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, long *value)
static int getNCvx_float_float (const NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, float *value)
static int getNCvx_float_double (const NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, double *value)
static int getNCvx_double_schar (const NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, schar *value)
static int getNCvx_double_uchar (const NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, uchar *value)
static int getNCvx_double_short (const NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, short *value)
static int getNCvx_double_int (const NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, int *value)
static int getNCvx_double_long (const NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, long *value)
static int getNCvx_double_float (const NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, float *value)
static int getNCvx_double_double (const NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, double *value)
static int getNCv_schar (const NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, schar *value)
static int getNCv_uchar (const NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, uchar *value)
static int getNCv_short (const NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, short *value)
static int getNCv_int (const NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, int *value)
static int getNCv_long (const NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, long *value)
static int getNCv_float (const NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, float *value)
static int getNCv_double (const NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, double *value)
static int getNCv_text (const NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, char *value)
static int NCxvarcpy (NC *inncp, NC_var *invp, size_t *incoord, NC *outncp, NC_var *outvp, size_t *outcoord, size_t nbytes)
static int NCiocount (const NC *const ncp, const NC_var *const varp, const size_t *const edges, size_t *const iocountp)
static void set_upper (size_t *upp, const size_t *stp, const size_t *edp, const size_t *const end)
static void odo1 (const size_t *const start, const size_t *const upper, size_t *const coord, const size_t *upp, size_t *cdp)
int nc_put_var1_text (int ncid, int varid, const size_t *coord, const char *value)
int nc_put_var1_uchar (int ncid, int varid, const size_t *coord, const uchar *value)
int nc_put_var1_schar (int ncid, int varid, const size_t *coord, const schar *value)
int nc_put_var1_short (int ncid, int varid, const size_t *coord, const short *value)
int nc_put_var1_int (int ncid, int varid, const size_t *coord, const int *value)
int nc_put_var1_long (int ncid, int varid, const size_t *coord, const long *value)
int nc_put_var1_float (int ncid, int varid, const size_t *coord, const float *value)
int nc_put_var1_double (int ncid, int varid, const size_t *coord, const double *value)
int nc_get_var1_text (int ncid, int varid, const size_t *coord, char *value)
int nc_get_var1_uchar (int ncid, int varid, const size_t *coord, uchar *value)
int nc_get_var1_schar (int ncid, int varid, const size_t *coord, schar *value)
int nc_get_var1_short (int ncid, int varid, const size_t *coord, short *value)
int nc_get_var1_int (int ncid, int varid, const size_t *coord, int *value)
int nc_get_var1_long (int ncid, int varid, const size_t *coord, long *value)
int nc_get_var1_float (int ncid, int varid, const size_t *coord, float *value)
int nc_get_var1_double (int ncid, int varid, const size_t *coord, double *value)
int nc_put_vara_text (int ncid, int varid, const size_t *start, const size_t *edges, const char *value)
int nc_put_vara_uchar (int ncid, int varid, const size_t *start, const size_t *edges, const uchar *value)
int nc_put_vara_schar (int ncid, int varid, const size_t *start, const size_t *edges, const schar *value)
int nc_put_vara_short (int ncid, int varid, const size_t *start, const size_t *edges, const short *value)
int nc_put_vara_int (int ncid, int varid, const size_t *start, const size_t *edges, const int *value)
int nc_put_vara_long (int ncid, int varid, const size_t *start, const size_t *edges, const long *value)
int nc_put_vara_float (int ncid, int varid, const size_t *start, const size_t *edges, const float *value)
int nc_put_vara_double (int ncid, int varid, const size_t *start, const size_t *edges, const double *value)
int nc_get_vara_text (int ncid, int varid, const size_t *start, const size_t *edges, char *value)
int nc_get_vara_uchar (int ncid, int varid, const size_t *start, const size_t *edges, uchar *value)
int nc_get_vara_schar (int ncid, int varid, const size_t *start, const size_t *edges, schar *value)
int nc_get_vara_short (int ncid, int varid, const size_t *start, const size_t *edges, short *value)
int nc_get_vara_int (int ncid, int varid, const size_t *start, const size_t *edges, int *value)
int nc_get_vara_long (int ncid, int varid, const size_t *start, const size_t *edges, long *value)
int nc_get_vara_float (int ncid, int varid, const size_t *start, const size_t *edges, float *value)
int nc_get_vara_double (int ncid, int varid, const size_t *start, const size_t *edges, double *value)
int nc_put_var_text (int ncid, int varid, const char *value)
int nc_put_var_uchar (int ncid, int varid, const uchar *value)
int nc_put_var_schar (int ncid, int varid, const schar *value)
int nc_put_var_short (int ncid, int varid, const short *value)
int nc_put_var_int (int ncid, int varid, const int *value)
int nc_put_var_long (int ncid, int varid, const long *value)
int nc_put_var_float (int ncid, int varid, const float *value)
int nc_put_var_double (int ncid, int varid, const double *value)
int nc_get_var_text (int ncid, int varid, char *value)
int nc_get_var_uchar (int ncid, int varid, uchar *value)
int nc_get_var_schar (int ncid, int varid, schar *value)
int nc_get_var_short (int ncid, int varid, short *value)
int nc_get_var_int (int ncid, int varid, int *value)
int nc_get_var_long (int ncid, int varid, long *value)
int nc_get_var_float (int ncid, int varid, float *value)
int nc_get_var_double (int ncid, int varid, double *value)
int nc_get_vars_text (int ncid, int varid, const size_t *start, const size_t *edges, const ptrdiff_t *stride, char *value)
int nc_get_vars_uchar (int ncid, int varid, const size_t *start, const size_t *edges, const ptrdiff_t *stride, uchar *value)
int nc_get_vars_schar (int ncid, int varid, const size_t *start, const size_t *edges, const ptrdiff_t *stride, schar *value)
int nc_get_vars_short (int ncid, int varid, const size_t *start, const size_t *edges, const ptrdiff_t *stride, short *value)
int nc_get_vars_int (int ncid, int varid, const size_t *start, const size_t *edges, const ptrdiff_t *stride, int *value)
int nc_get_vars_long (int ncid, int varid, const size_t *start, const size_t *edges, const ptrdiff_t *stride, long *value)
int nc_get_vars_float (int ncid, int varid, const size_t *start, const size_t *edges, const ptrdiff_t *stride, float *value)
int nc_get_vars_double (int ncid, int varid, const size_t *start, const size_t *edges, const ptrdiff_t *stride, double *value)
int nc_put_vars_text (int ncid, int varid, const size_t *start, const size_t *edges, const ptrdiff_t *stride, const char *value)
int nc_put_vars_uchar (int ncid, int varid, const size_t *start, const size_t *edges, const ptrdiff_t *stride, const uchar *value)
int nc_put_vars_schar (int ncid, int varid, const size_t *start, const size_t *edges, const ptrdiff_t *stride, const schar *value)
int nc_put_vars_short (int ncid, int varid, const size_t *start, const size_t *edges, const ptrdiff_t *stride, const short *value)
int nc_put_vars_int (int ncid, int varid, const size_t *start, const size_t *edges, const ptrdiff_t *stride, const int *value)
int nc_put_vars_long (int ncid, int varid, const size_t *start, const size_t *edges, const ptrdiff_t *stride, const long *value)
int nc_put_vars_float (int ncid, int varid, const size_t *start, const size_t *edges, const ptrdiff_t *stride, const float *value)
int nc_put_vars_double (int ncid, int varid, const size_t *start, const size_t *edges, const ptrdiff_t *stride, const double *value)
int nc_get_varm_text (int ncid, int varid, const size_t *start, const size_t *edges, const ptrdiff_t *stride, const ptrdiff_t *map, char *value)
int nc_get_varm_uchar (int ncid, int varid, const size_t *start, const size_t *edges, const ptrdiff_t *stride, const ptrdiff_t *map, uchar *value)
int nc_get_varm_schar (int ncid, int varid, const size_t *start, const size_t *edges, const ptrdiff_t *stride, const ptrdiff_t *map, schar *value)
int nc_get_varm_short (int ncid, int varid, const size_t *start, const size_t *edges, const ptrdiff_t *stride, const ptrdiff_t *map, short *value)
int nc_get_varm_int (int ncid, int varid, const size_t *start, const size_t *edges, const ptrdiff_t *stride, const ptrdiff_t *map, int *value)
int nc_get_varm_long (int ncid, int varid, const size_t *start, const size_t *edges, const ptrdiff_t *stride, const ptrdiff_t *map, long *value)
int nc_get_varm_float (int ncid, int varid, const size_t *start, const size_t *edges, const ptrdiff_t *stride, const ptrdiff_t *map, float *value)
int nc_get_varm_double (int ncid, int varid, const size_t *start, const size_t *edges, const ptrdiff_t *stride, const ptrdiff_t *map, double *value)
int nc_put_varm_text (int ncid, int varid, const size_t *start, const size_t *edges, const ptrdiff_t *stride, const ptrdiff_t *map, const char *value)
int nc_put_varm_uchar (int ncid, int varid, const size_t *start, const size_t *edges, const ptrdiff_t *stride, const ptrdiff_t *map, const uchar *value)
int nc_put_varm_schar (int ncid, int varid, const size_t *start, const size_t *edges, const ptrdiff_t *stride, const ptrdiff_t *map, const schar *value)
int nc_put_varm_short (int ncid, int varid, const size_t *start, const size_t *edges, const ptrdiff_t *stride, const ptrdiff_t *map, const short *value)
int nc_put_varm_int (int ncid, int varid, const size_t *start, const size_t *edges, const ptrdiff_t *stride, const ptrdiff_t *map, const int *value)
int nc_put_varm_long (int ncid, int varid, const size_t *start, const size_t *edges, const ptrdiff_t *stride, const ptrdiff_t *map, const long *value)
int nc_put_varm_float (int ncid, int varid, const size_t *start, const size_t *edges, const ptrdiff_t *stride, const ptrdiff_t *map, const float *value)
int nc_put_varm_double (int ncid, int varid, const size_t *start, const size_t *edges, const ptrdiff_t *stride, const ptrdiff_t *map, const double *value)
int nc_copy_var (int ncid_in, int varid, int ncid_out)
int nc_get_att (int ncid, int varid, const char *name, void *value)
int nc_put_att (int ncid, int varid, const char *name, nc_type type, size_t nelems, const void *value)
int nc_get_var1 (int ncid, int varid, const size_t *coord, void *value)
int nc_put_var1 (int ncid, int varid, const size_t *coord, const void *value)
int nc_get_vara (int ncid, int varid, const size_t *start, const size_t *edges, void *value)
int nc_put_vara (int ncid, int varid, const size_t *start, const size_t *edges, const void *value)
int nc_get_varm (int ncid, int varid, const size_t *start, const size_t *edges, const ptrdiff_t *stride, const ptrdiff_t *map, void *value)
int nc_put_varm (int ncid, int varid, const size_t *start, const size_t *edges, const ptrdiff_t *stride, const ptrdiff_t *map, const void *value)
int nc_get_vars (int ncid, int varid, const size_t *start, const size_t *edges, const ptrdiff_t *stride, void *value)
int nc_put_vars (int ncid, int varid, const size_t *start, const size_t *edges, const ptrdiff_t *stride, const void *value)

Variables

static const size_t coord_zero [NC_MAX_VAR_DIMS]


Define Documentation

#define MIN mm,
nn   )     (((mm) < (nn)) ? (mm) : (nn))
 

Definition at line 23 of file putget.c.

#define NFILL   16
 

Definition at line 82 of file putget.c.

Referenced by fill_NC_var(), NC_fill_char(), NC_fill_double(), NC_fill_float(), NC_fill_schar(), and NC_fill_short().


Function Documentation

int fill_NC_var NC ncp,
const NC_var varp,
size_t  recno
 

Definition at line 250 of file putget.c.

References _FillValue, NC_var::attrs, NC_var::begin, NC::chunk, ncio::get, IS_RECVAR, NC_var::len, MIN, NC_BYTE, NC_CHAR, NC_DOUBLE, NC_EBADTYPE, NC_fill_char(), NC_fill_double(), NC_fill_float(), NC_fill_schar(), NC_fill_short(), NC_findattr(), NC_FLOAT, NC_INT, NC_NOERR, NC_SHORT, NC::nciop, NFILL, NC::recsize, ncio::rel, RGN_MODIFIED, RGN_WRITE, NC_var::type, X_ALIGN, X_SIZEOF_DOUBLE, and NC_var::xsz.

Referenced by fill_added(), fill_added_recs(), fillerup(), and NCfillrecord().

00251 {
00252         char xfillp[NFILL * X_SIZEOF_DOUBLE];
00253         const size_t step = varp->xsz;
00254         const size_t nelems = sizeof(xfillp)/step;
00255         const size_t xsz = varp->xsz * nelems;
00256         NC_attr **attrpp = NULL;
00257         off_t offset;
00258         size_t remaining = varp->len;
00259 
00260         void *xp;
00261         int status = NC_NOERR;
00262 
00263         /*
00264          * Set up fill value
00265          */
00266         attrpp = NC_findattr(&varp->attrs, _FillValue);
00267         if( attrpp != NULL )
00268         {
00269                 /* User defined fill value */
00270                 if( (*attrpp)->type != varp->type || (*attrpp)->nelems != 1 )
00271                 {
00272                         return NC_EBADTYPE;
00273                 }
00274                 else
00275                 {
00276                         /* Use the user defined value */
00277                         char *cp = xfillp;
00278                         const char *const end = &xfillp[sizeof(xfillp)];
00279 
00280                         assert(step <= (*attrpp)->xsz);
00281 
00282                         for( /*NADA*/; cp < end; cp += step)
00283                         {
00284                                 (void) memcpy(cp, (*attrpp)->xvalue, step);
00285                         }
00286                 }
00287         }
00288         else
00289         {
00290                 /* use the default */
00291                 
00292                 assert(xsz % X_ALIGN == 0);
00293                 assert(xsz <= sizeof(xfillp));
00294         
00295                 xp = xfillp;
00296         
00297                 switch(varp->type){
00298                 case NC_BYTE :
00299                         status = NC_fill_schar(&xp, nelems);
00300                         break;
00301                 case NC_CHAR :
00302                         status = NC_fill_char(&xp, nelems);
00303                         break;
00304                 case NC_SHORT :
00305                         status = NC_fill_short(&xp, nelems);
00306                         break;
00307                 case NC_INT :
00308                         status = NC_fill_int(&xp, nelems);
00309                         break;
00310                 case NC_FLOAT :
00311                         status = NC_fill_float(&xp, nelems);
00312                         break;
00313                 case NC_DOUBLE : 
00314                         status = NC_fill_double(&xp, nelems);
00315                         break;
00316                 default :
00317                         assert("fill_NC_var invalid type" == 0);
00318                         status = NC_EBADTYPE;
00319                         break;
00320                 }
00321                 if(status != NC_NOERR)
00322                         return status;
00323         
00324                 assert(xp == xfillp + xsz);
00325         }
00326 
00327         /*
00328          * copyout:
00329          * xfillp now contains 'nelems' elements of the fill value
00330          * in external representation.
00331          */
00332 
00333         /*
00334          * Copy it out.
00335          */
00336 
00337         offset = varp->begin;
00338         if(IS_RECVAR(varp))
00339         {
00340                 offset += (off_t)ncp->recsize * recno;
00341         }
00342 
00343         assert(remaining > 0);
00344         for(;;)
00345         {
00346                 const size_t chunksz = MIN(remaining, ncp->chunk);
00347                 size_t ii;
00348                 assert(chunksz % X_ALIGN == 0);
00349 
00350                 status = ncp->nciop->get(ncp->nciop, offset, chunksz,
00351                                  RGN_WRITE, &xp);       
00352                 if(status != NC_NOERR)
00353                 {
00354                         return status;
00355                 }
00356 
00357                 /*
00358                  * fill the chunksz buffer in units  of xsz
00359                  */
00360                 for(ii = 0; ii < chunksz/xsz; ii++)
00361                 {
00362                         (void) memcpy(xp, xfillp, xsz);
00363                         xp = (char *)xp + xsz;
00364                 }
00365                 /*
00366                  * Deal with any remainder
00367                  */
00368                 {
00369                         const size_t rem = chunksz % xsz;
00370                         if(rem != 0)
00371                         {
00372                                 (void) memcpy(xp, xfillp, rem);
00373                                 /* xp = (char *)xp + xsz; */
00374                         }
00375 
00376                 }
00377 
00378                 status = ncp->nciop->rel(ncp->nciop, offset, RGN_MODIFIED);
00379 
00380                 if(status != NC_NOERR)
00381                 {
00382                         break;
00383                 }
00384 
00385                 remaining -= chunksz;
00386                 if(remaining == 0)
00387                         break;  /* normal loop exit */
00388                 offset += chunksz;
00389 
00390         }
00391 
00392         return status;
00393 }

static int getNCv_double const NC ncp,
const NC_var varp,
const size_t *  start,
size_t  nelems,
double *  value
[static]
 

Definition at line 4128 of file putget.c.

References getNCvx_double_double(), getNCvx_float_double(), getNCvx_int_double(), getNCvx_schar_double(), getNCvx_short_double(), NC_BYTE, NC_CHAR, NC_DOUBLE, NC_EBADTYPE, NC_ECHAR, NC_FLOAT, NC_INT, NC_SHORT, and NC_var::type.

Referenced by nc_get_var1_double(), nc_get_var_double(), nc_get_vara_double(), and nc_get_varm_double().

04130 {
04131         switch(varp->type){
04132         case NC_CHAR:
04133                 return NC_ECHAR;
04134         case NC_BYTE:
04135                 return getNCvx_schar_double(ncp, varp, start, nelems,
04136                         value);
04137         case NC_SHORT:
04138                 return getNCvx_short_double(ncp, varp, start, nelems,
04139                         value);
04140         case NC_INT:
04141                 return getNCvx_int_double(ncp, varp, start, nelems,
04142                         value);
04143         case NC_FLOAT:
04144                 return getNCvx_float_double(ncp, varp, start, nelems,
04145                         value);
04146         case NC_DOUBLE: 
04147                 return getNCvx_double_double(ncp, varp, start, nelems,
04148                         value);
04149         }
04150         return NC_EBADTYPE;
04151 }

static int getNCv_float const NC ncp,
const NC_var varp,
const size_t *  start,
size_t  nelems,
float *  value
[static]
 

Definition at line 4102 of file putget.c.

References getNCvx_double_float(), getNCvx_float_float(), getNCvx_int_float(), getNCvx_schar_float(), getNCvx_short_float(), NC_BYTE, NC_CHAR, NC_DOUBLE, NC_EBADTYPE, NC_ECHAR, NC_FLOAT, NC_INT, NC_SHORT, and NC_var::type.

Referenced by nc_get_var1_float(), nc_get_var_float(), nc_get_vara_float(), and nc_get_varm_float().

04104 {
04105         switch(varp->type){
04106         case NC_CHAR:
04107                 return NC_ECHAR;
04108         case NC_BYTE:
04109                 return getNCvx_schar_float(ncp, varp, start, nelems,
04110                         value);
04111         case NC_SHORT:
04112                 return getNCvx_short_float(ncp, varp, start, nelems,
04113                         value);
04114         case NC_INT:
04115                 return getNCvx_int_float(ncp, varp, start, nelems,
04116                         value);
04117         case NC_FLOAT:
04118                 return getNCvx_float_float(ncp, varp, start, nelems,
04119                         value);
04120         case NC_DOUBLE: 
04121                 return getNCvx_double_float(ncp, varp, start, nelems,
04122                         value);
04123         }
04124         return NC_EBADTYPE;
04125 }

static int getNCv_int const NC ncp,
const NC_var varp,
const size_t *  start,
size_t  nelems,
int *  value
[static]
 

Definition at line 4050 of file putget.c.

References getNCvx_double_int(), getNCvx_float_int(), getNCvx_int_int(), getNCvx_schar_int(), getNCvx_short_int(), NC_BYTE, NC_CHAR, NC_DOUBLE, NC_EBADTYPE, NC_ECHAR, NC_FLOAT, NC_INT, NC_SHORT, and NC_var::type.

Referenced by nc_get_var1_int(), nc_get_var_int(), nc_get_vara_int(), and nc_get_varm_int().

04052 {
04053         switch(varp->type){
04054         case NC_CHAR:
04055                 return NC_ECHAR;
04056         case NC_BYTE:
04057                 return getNCvx_schar_int(ncp, varp, start, nelems,
04058                         value);
04059         case NC_SHORT:
04060                 return getNCvx_short_int(ncp, varp, start, nelems,
04061                         value);
04062         case NC_INT:
04063                 return getNCvx_int_int(ncp, varp, start, nelems,
04064                         value);
04065         case NC_FLOAT:
04066                 return getNCvx_float_int(ncp, varp, start, nelems,
04067                         value);
04068         case NC_DOUBLE: 
04069                 return getNCvx_double_int(ncp, varp, start, nelems,
04070                         value);
04071         }
04072         return NC_EBADTYPE;
04073 }

static int getNCv_long const NC ncp,
const NC_var varp,
const size_t *  start,
size_t  nelems,
long *  value
[static]
 

Definition at line 4076 of file putget.c.

References getNCvx_double_long(), getNCvx_float_long(), getNCvx_int_long(), getNCvx_schar_long(), getNCvx_short_long(), NC_BYTE, NC_CHAR, NC_DOUBLE, NC_EBADTYPE, NC_ECHAR, NC_FLOAT, NC_INT, NC_SHORT, and NC_var::type.

Referenced by nc_get_var1_long(), nc_get_var_long(), nc_get_vara_long(), and nc_get_varm_long().

04078 {
04079         switch(varp->type){
04080         case NC_CHAR:
04081                 return NC_ECHAR;
04082         case NC_BYTE:
04083                 return getNCvx_schar_long(ncp, varp, start, nelems,
04084                         value);
04085         case NC_SHORT:
04086                 return getNCvx_short_long(ncp, varp, start, nelems,
04087                         value);
04088         case NC_INT:
04089                 return getNCvx_int_long(ncp, varp, start, nelems,
04090                         value);
04091         case NC_FLOAT:
04092                 return getNCvx_float_long(ncp, varp, start, nelems,
04093                         value);
04094         case NC_DOUBLE: 
04095                 return getNCvx_double_long(ncp, varp, start, nelems,
04096                         value);
04097         }
04098         return NC_EBADTYPE;
04099 }

static int getNCv_schar const NC ncp,
const NC_var varp,
const size_t *  start,
size_t  nelems,
schar value
[static]
 

Definition at line 3972 of file putget.c.

References getNCvx_double_schar(), getNCvx_float_schar(), getNCvx_int_schar(), getNCvx_schar_schar(), getNCvx_short_schar(), NC_BYTE, NC_CHAR, NC_DOUBLE, NC_EBADTYPE, NC_ECHAR, NC_FLOAT, NC_INT, NC_SHORT, and NC_var::type.

Referenced by nc_get_var1_schar(), nc_get_var_schar(), nc_get_vara_schar(), and nc_get_varm_schar().

03974 {
03975         switch(varp->type){
03976         case NC_CHAR:
03977                 return NC_ECHAR;
03978         case NC_BYTE:
03979                 return getNCvx_schar_schar(ncp, varp, start, nelems,
03980                         value);
03981         case NC_SHORT:
03982                 return getNCvx_short_schar(ncp, varp, start, nelems,
03983                         value);
03984         case NC_INT:
03985                 return getNCvx_int_schar(ncp, varp, start, nelems,
03986                         value);
03987         case NC_FLOAT:
03988                 return getNCvx_float_schar(ncp, varp, start, nelems,
03989                         value);
03990         case NC_DOUBLE: 
03991                 return getNCvx_double_schar(ncp, varp, start, nelems,
03992                         value);
03993         }
03994         return NC_EBADTYPE;
03995 }

static int getNCv_short const NC ncp,
const NC_var varp,
const size_t *  start,
size_t  nelems,
short *  value
[static]
 

Definition at line 4024 of file putget.c.

References getNCvx_double_short(), getNCvx_float_short(), getNCvx_int_short(), getNCvx_schar_short(), getNCvx_short_short(), NC_BYTE, NC_CHAR, NC_DOUBLE, NC_EBADTYPE, NC_ECHAR, NC_FLOAT, NC_INT, NC_SHORT, and NC_var::type.

Referenced by nc_get_var1_short(), nc_get_var_short(), nc_get_vara_short(), and nc_get_varm_short().

04026 {
04027         switch(varp->type){
04028         case NC_CHAR:
04029                 return NC_ECHAR;
04030         case NC_BYTE:
04031                 return getNCvx_schar_short(ncp, varp, start, nelems,
04032                         value);
04033         case NC_SHORT:
04034                 return getNCvx_short_short(ncp, varp, start, nelems,
04035                         value);
04036         case NC_INT:
04037                 return getNCvx_int_short(ncp, varp, start, nelems,
04038                         value);
04039         case NC_FLOAT:
04040                 return getNCvx_float_short(ncp, varp, start, nelems,
04041                         value);
04042         case NC_DOUBLE: 
04043                 return getNCvx_double_short(ncp, varp, start, nelems,
04044                         value);
04045         }
04046         return NC_EBADTYPE;
04047 }

static int getNCv_text const NC ncp,
const NC_var varp,
const size_t *  start,
size_t  nelems,
char *  value
[static]
 

Definition at line 4156 of file putget.c.

References getNCvx_char_char(), NC_CHAR, NC_ECHAR, and NC_var::type.

Referenced by nc_get_var1_text(), nc_get_var_text(), nc_get_vara_text(), and nc_get_varm_text().

04158 {
04159         if(varp->type != NC_CHAR)
04160                 return NC_ECHAR;
04161         return getNCvx_char_char(ncp, varp, start, nelems, value);
04162 }

static int getNCv_uchar const NC ncp,
const NC_var varp,
const size_t *  start,
size_t  nelems,
uchar value
[static]
 

Definition at line 3998 of file putget.c.

References getNCvx_double_uchar(), getNCvx_float_uchar(), getNCvx_int_uchar(), getNCvx_schar_uchar(), getNCvx_short_uchar(), NC_BYTE, NC_CHAR, NC_DOUBLE, NC_EBADTYPE, NC_ECHAR, NC_FLOAT, NC_INT, NC_SHORT, and NC_var::type.

Referenced by nc_get_var1_uchar(), nc_get_var_uchar(), nc_get_vara_uchar(), and nc_get_varm_uchar().

04000 {
04001         switch(varp->type){
04002         case NC_CHAR:
04003                 return NC_ECHAR;
04004         case NC_BYTE:
04005                 return getNCvx_schar_uchar(ncp, varp, start, nelems,
04006                         value);
04007         case NC_SHORT:
04008                 return getNCvx_short_uchar(ncp, varp, start, nelems,
04009                         value);
04010         case NC_INT:
04011                 return getNCvx_int_uchar(ncp, varp, start, nelems,
04012                         value);
04013         case NC_FLOAT:
04014                 return getNCvx_float_uchar(ncp, varp, start, nelems,
04015                         value);
04016         case NC_DOUBLE: 
04017                 return getNCvx_double_uchar(ncp, varp, start, nelems,
04018                         value);
04019         }
04020         return NC_EBADTYPE;
04021 }

static int getNCvx_char_char const NC ncp,
const NC_var varp,
const size_t *  start,
size_t  nelems,
char *  value
[static]
 

Definition at line 2524 of file putget.c.

References NC::chunk, ncio::get, MIN, NC_NOERR, NC_varoffset(), NC::nciop, ncx_getn_char_char, ncx_howmany(), ncio::rel, NC_var::type, and NC_var::xsz.

Referenced by getNCv_text().

02526 {
02527         off_t offset = NC_varoffset(ncp, varp, start);
02528         size_t remaining = varp->xsz * nelems;
02529         int status = NC_NOERR;
02530         const void *xp;
02531 
02532         if(nelems == 0)
02533                 return NC_NOERR;
02534 
02535         assert(value != NULL);
02536 
02537         for(;;)
02538         {
02539                 size_t extent = MIN(remaining, ncp->chunk);
02540                 size_t nget = ncx_howmany(varp->type, extent);
02541 
02542                 int lstatus = ncp->nciop->get(ncp->nciop, offset, extent,
02543                                  0, (void **)&xp);      /* cast away const */
02544                 if(lstatus != NC_NOERR)
02545                         return lstatus;
02546                 
02547                 lstatus = ncx_getn_char_char(&xp, nget, value);
02548                 if(lstatus != NC_NOERR && status == NC_NOERR)
02549                         status = lstatus;
02550 
02551                 (void) ncp->nciop->rel(ncp->nciop, offset, 0);  
02552 
02553                 remaining -= extent;
02554                 if(remaining == 0)
02555                         break; /* normal loop exit */
02556                 offset += extent;
02557                 value += nget;
02558         }
02559 
02560         return status;
02561 }

static int getNCvx_double_double const NC ncp,
const NC_var varp,
const size_t *  start,
size_t  nelems,
double *  value
[static]
 

Definition at line 3929 of file putget.c.

References NC::chunk, ncio::get, MIN, NC_NOERR, NC_varoffset(), NC::nciop, ncx_getn_double_double(), ncx_howmany(), ncio::rel, NC_var::type, and NC_var::xsz.

Referenced by getNCv_double().

03931 {
03932         off_t offset = NC_varoffset(ncp, varp, start);
03933         size_t remaining = varp->xsz * nelems;
03934         int status = NC_NOERR;
03935         const void *xp;
03936 
03937         if(nelems == 0)
03938                 return NC_NOERR;
03939 
03940         assert(value != NULL);
03941 
03942         for(;;)
03943         {
03944                 size_t extent = MIN(remaining, ncp->chunk);
03945                 size_t nget = ncx_howmany(varp->type, extent);
03946 
03947                 int lstatus = ncp->nciop->get(ncp->nciop, offset, extent,
03948                                  0, (void **)&xp);      /* cast away const */
03949                 if(lstatus != NC_NOERR)
03950                         return lstatus;
03951                 
03952                 lstatus = ncx_getn_double_double(&xp, nget, value);
03953                 if(lstatus != NC_NOERR && status == NC_NOERR)
03954                         status = lstatus;
03955 
03956                 (void) ncp->nciop->rel(ncp->nciop, offset, 0);  
03957 
03958                 remaining -= extent;
03959                 if(remaining == 0)
03960                         break; /* normal loop exit */
03961                 offset += extent;
03962                 value += nget;
03963         }
03964 
03965         return status;
03966 }

static int getNCvx_double_float const NC ncp,
const NC_var varp,
const size_t *  start,
size_t  nelems,
float *  value
[static]
 

Definition at line 3889 of file putget.c.

References NC::chunk, ncio::get, MIN, NC_NOERR, NC_varoffset(), NC::nciop, ncx_getn_double_float(), ncx_howmany(), ncio::rel, NC_var::type, and NC_var::xsz.

Referenced by getNCv_float().

03891 {
03892         off_t offset = NC_varoffset(ncp, varp, start);
03893         size_t remaining = varp->xsz * nelems;
03894         int status = NC_NOERR;
03895         const void *xp;
03896 
03897         if(nelems == 0)
03898                 return NC_NOERR;
03899 
03900         assert(value != NULL);
03901 
03902         for(;;)
03903         {
03904                 size_t extent = MIN(remaining, ncp->chunk);
03905                 size_t nget = ncx_howmany(varp->type, extent);
03906 
03907                 int lstatus = ncp->nciop->get(ncp->nciop, offset, extent,
03908                                  0, (void **)&xp);      /* cast away const */
03909                 if(lstatus != NC_NOERR)
03910                         return lstatus;
03911                 
03912                 lstatus = ncx_getn_double_float(&xp, nget, value);
03913                 if(lstatus != NC_NOERR && status == NC_NOERR)
03914                         status = lstatus;
03915 
03916                 (void) ncp->nciop->rel(ncp->nciop, offset, 0);  
03917 
03918                 remaining -= extent;
03919                 if(remaining == 0)
03920                         break; /* normal loop exit */
03921                 offset += extent;
03922                 value += nget;
03923         }
03924 
03925         return status;
03926 }

static int getNCvx_double_int const NC ncp,
const NC_var varp,
const size_t *  start,
size_t  nelems,
int *  value
[static]
 

Definition at line 3809 of file putget.c.

References NC::chunk, ncio::get, MIN, NC_NOERR, NC_varoffset(), NC::nciop, ncx_getn_double_int(), ncx_howmany(), ncio::rel, NC_var::type, and NC_var::xsz.

Referenced by getNCv_int().

03811 {
03812         off_t offset = NC_varoffset(ncp, varp, start);
03813         size_t remaining = varp->xsz * nelems;
03814         int status = NC_NOERR;
03815         const void *xp;
03816 
03817         if(nelems == 0)
03818                 return NC_NOERR;
03819 
03820         assert(value != NULL);
03821 
03822         for(;;)
03823         {
03824                 size_t extent = MIN(remaining, ncp->chunk);
03825                 size_t nget = ncx_howmany(varp->type, extent);
03826 
03827                 int lstatus = ncp->nciop->get(ncp->nciop, offset, extent,
03828                                  0, (void **)&xp);      /* cast away const */
03829                 if(lstatus != NC_NOERR)
03830                         return lstatus;
03831                 
03832                 lstatus = ncx_getn_double_int(&xp, nget, value);
03833                 if(lstatus != NC_NOERR && status == NC_NOERR)
03834                         status = lstatus;
03835 
03836                 (void) ncp->nciop->rel(ncp->nciop, offset, 0);  
03837 
03838                 remaining -= extent;
03839                 if(remaining == 0)
03840                         break; /* normal loop exit */
03841                 offset += extent;
03842                 value += nget;
03843         }
03844 
03845         return status;
03846 }

static int getNCvx_double_long const NC ncp,
const NC_var varp,
const size_t *  start,
size_t  nelems,
long *  value
[static]
 

Definition at line 3849 of file putget.c.

References NC::chunk, ncio::get, MIN, NC_NOERR, NC_varoffset(), NC::nciop, ncx_getn_double_long(), ncx_howmany(), ncio::rel, NC_var::type, and NC_var::xsz.

Referenced by getNCv_long().

03851 {
03852         off_t offset = NC_varoffset(ncp, varp, start);
03853         size_t remaining = varp->xsz * nelems;
03854         int status = NC_NOERR;
03855         const void *xp;
03856 
03857         if(nelems == 0)
03858                 return NC_NOERR;
03859 
03860         assert(value != NULL);
03861 
03862         for(;;)
03863         {
03864                 size_t extent = MIN(remaining, ncp->chunk);
03865                 size_t nget = ncx_howmany(varp->type, extent);
03866 
03867                 int lstatus = ncp->nciop->get(ncp->nciop, offset, extent,
03868                                  0, (void **)&xp);      /* cast away const */
03869                 if(lstatus != NC_NOERR)
03870                         return lstatus;
03871                 
03872                 lstatus = ncx_getn_double_long(&xp, nget, value);
03873                 if(lstatus != NC_NOERR && status == NC_NOERR)
03874                         status = lstatus;
03875 
03876                 (void) ncp->nciop->rel(ncp->nciop, offset, 0);  
03877 
03878                 remaining -= extent;
03879                 if(remaining == 0)
03880                         break; /* normal loop exit */
03881                 offset += extent;
03882                 value += nget;
03883         }
03884 
03885         return status;
03886 }

static int getNCvx_double_schar const NC ncp,
const NC_var varp,
const size_t *  start,
size_t  nelems,
schar value
[static]
 

Definition at line 3689 of file putget.c.

References NC::chunk, ncio::get, MIN, NC_NOERR, NC_varoffset(), NC::nciop, ncx_getn_double_schar(), ncx_howmany(), ncio::rel, NC_var::type, and NC_var::xsz.

Referenced by getNCv_schar().

03691 {
03692         off_t offset = NC_varoffset(ncp, varp, start);
03693         size_t remaining = varp->xsz * nelems;
03694         int status = NC_NOERR;
03695         const void *xp;
03696 
03697         if(nelems == 0)
03698                 return NC_NOERR;
03699 
03700         assert(value != NULL);
03701 
03702         for(;;)
03703         {
03704                 size_t extent = MIN(remaining, ncp->chunk);
03705                 size_t nget = ncx_howmany(varp->type, extent);
03706 
03707                 int lstatus = ncp->nciop->get(ncp->nciop, offset, extent,
03708                                  0, (void **)&xp);      /* cast away const */
03709                 if(lstatus != NC_NOERR)
03710                         return lstatus;
03711                 
03712                 lstatus = ncx_getn_double_schar(&xp, nget, value);
03713                 if(lstatus != NC_NOERR && status == NC_NOERR)
03714                         status = lstatus;
03715 
03716                 (void) ncp->nciop->rel(ncp->nciop, offset, 0);  
03717 
03718                 remaining -= extent;
03719                 if(remaining == 0)
03720                         break; /* normal loop exit */
03721                 offset += extent;
03722                 value += nget;
03723         }
03724 
03725         return status;
03726 }

static int getNCvx_double_short const NC ncp,
const NC_var varp,
const size_t *  start,
size_t  nelems,
short *  value
[static]
 

Definition at line 3769 of file putget.c.

References NC::chunk, ncio::get, MIN, NC_NOERR, NC_varoffset(), NC::nciop, ncx_getn_double_short(), ncx_howmany(), ncio::rel, NC_var::type, and NC_var::xsz.

Referenced by getNCv_short().

03771 {
03772         off_t offset = NC_varoffset(ncp, varp, start);
03773         size_t remaining = varp->xsz * nelems;
03774         int status = NC_NOERR;
03775         const void *xp;
03776 
03777         if(nelems == 0)
03778                 return NC_NOERR;
03779 
03780         assert(value != NULL);
03781 
03782         for(;;)
03783         {
03784                 size_t extent = MIN(remaining, ncp->chunk);
03785                 size_t nget = ncx_howmany(varp->type, extent);
03786 
03787                 int lstatus = ncp->nciop->get(ncp->nciop, offset, extent,
03788                                  0, (void **)&xp);      /* cast away const */
03789                 if(lstatus != NC_NOERR)
03790                         return lstatus;
03791                 
03792                 lstatus = ncx_getn_double_short(&xp, nget, value);
03793                 if(lstatus != NC_NOERR && status == NC_NOERR)
03794                         status = lstatus;
03795 
03796                 (void) ncp->nciop->rel(ncp->nciop, offset, 0);  
03797 
03798                 remaining -= extent;
03799                 if(remaining == 0)
03800                         break; /* normal loop exit */
03801                 offset += extent;
03802                 value += nget;
03803         }
03804 
03805         return status;
03806 }

static int getNCvx_double_uchar const NC ncp,
const NC_var varp,
const size_t *  start,
size_t  nelems,
uchar value
[static]
 

Definition at line 3729 of file putget.c.

References NC::chunk, ncio::get, MIN, NC_NOERR, NC_varoffset(), NC::nciop, ncx_getn_double_uchar(), ncx_howmany(), ncio::rel, NC_var::type, and NC_var::xsz.

Referenced by getNCv_uchar().

03731 {
03732         off_t offset = NC_varoffset(ncp, varp, start);
03733         size_t remaining = varp->xsz * nelems;
03734         int status = NC_NOERR;
03735         const void *xp;
03736 
03737         if(nelems == 0)
03738                 return NC_NOERR;
03739 
03740         assert(value != NULL);
03741 
03742         for(;;)
03743         {
03744                 size_t extent = MIN(remaining, ncp->chunk);
03745                 size_t nget = ncx_howmany(varp->type, extent);
03746 
03747                 int lstatus = ncp->nciop->get(ncp->nciop, offset, extent,
03748                                  0, (void **)&xp);      /* cast away const */
03749                 if(lstatus != NC_NOERR)
03750                         return lstatus;
03751                 
03752                 lstatus = ncx_getn_double_uchar(&xp, nget, value);
03753                 if(lstatus != NC_NOERR && status == NC_NOERR)
03754                         status = lstatus;
03755 
03756                 (void) ncp->nciop->rel(ncp->nciop, offset, 0);  
03757 
03758                 remaining -= extent;
03759                 if(remaining == 0)
03760                         break; /* normal loop exit */
03761                 offset += extent;
03762                 value += nget;
03763         }
03764 
03765         return status;
03766 }

static int getNCvx_float_double const NC ncp,
const NC_var varp,
const size_t *  start,
size_t  nelems,
double *  value
[static]
 

Definition at line 3648 of file putget.c.

References NC::chunk, ncio::get, MIN, NC_NOERR, NC_varoffset(), NC::nciop, ncx_getn_float_double(), ncx_howmany(), ncio::rel, NC_var::type, and NC_var::xsz.

Referenced by getNCv_double().

03650 {
03651         off_t offset = NC_varoffset(ncp, varp, start);
03652         size_t remaining = varp->xsz * nelems;
03653         int status = NC_NOERR;
03654         const void *xp;
03655 
03656         if(nelems == 0)
03657                 return NC_NOERR;
03658 
03659         assert(value != NULL);
03660 
03661         for(;;)
03662         {
03663                 size_t extent = MIN(remaining, ncp->chunk);
03664                 size_t nget = ncx_howmany(varp->type, extent);
03665 
03666                 int lstatus = ncp->nciop->get(ncp->nciop, offset, extent,
03667                                  0, (void **)&xp);      /* cast away const */
03668                 if(lstatus != NC_NOERR)
03669                         return lstatus;
03670                 
03671                 lstatus = ncx_getn_float_double(&xp, nget, value);
03672                 if(lstatus != NC_NOERR && status == NC_NOERR)
03673                         status = lstatus;
03674 
03675                 (void) ncp->nciop->rel(ncp->nciop, offset, 0);  
03676 
03677                 remaining -= extent;
03678                 if(remaining == 0)
03679                         break; /* normal loop exit */
03680                 offset += extent;
03681                 value += nget;
03682         }
03683 
03684         return status;
03685 }

static int getNCvx_float_float const NC ncp,
const NC_var varp,
const size_t *  start,
size_t  nelems,
float *  value
[static]
 

Definition at line 3608 of file putget.c.

References NC::chunk, ncio::get, MIN, NC_NOERR, NC_varoffset(), NC::nciop, ncx_getn_float_float(), ncx_howmany(), ncio::rel, NC_var::type, and NC_var::xsz.

Referenced by getNCv_float().

03610 {
03611         off_t offset = NC_varoffset(ncp, varp, start);
03612         size_t remaining = varp->xsz * nelems;
03613         int status = NC_NOERR;
03614         const void *xp;
03615 
03616         if(nelems == 0)
03617                 return NC_NOERR;
03618 
03619         assert(value != NULL);
03620 
03621         for(;;)
03622         {
03623                 size_t extent = MIN(remaining, ncp->chunk);
03624                 size_t nget = ncx_howmany(varp->type, extent);
03625 
03626                 int lstatus = ncp->nciop->get(ncp->nciop, offset, extent,
03627                                  0, (void **)&xp);      /* cast away const */
03628                 if(lstatus != NC_NOERR)
03629                         return lstatus;
03630                 
03631                 lstatus = ncx_getn_float_float(&xp, nget, value);
03632                 if(lstatus != NC_NOERR && status == NC_NOERR)
03633                         status = lstatus;
03634 
03635                 (void) ncp->nciop->rel(ncp->nciop, offset, 0);  
03636 
03637                 remaining -= extent;
03638                 if(remaining == 0)
03639                         break; /* normal loop exit */
03640                 offset += extent;
03641                 value += nget;
03642         }
03643 
03644         return status;
03645 }

static int getNCvx_float_int const NC ncp,
const NC_var varp,
const size_t *  start,
size_t  nelems,
int *  value
[static]
 

Definition at line 3528 of file putget.c.

References NC::chunk, ncio::get, MIN, NC_NOERR, NC_varoffset(), NC::nciop, ncx_getn_float_int(), ncx_howmany(), ncio::rel, NC_var::type, and NC_var::xsz.

Referenced by getNCv_int().

03530 {
03531         off_t offset = NC_varoffset(ncp, varp, start);
03532         size_t remaining = varp->xsz * nelems;
03533         int status = NC_NOERR;
03534         const void *xp;
03535 
03536         if(nelems == 0)
03537                 return NC_NOERR;
03538 
03539         assert(value != NULL);
03540 
03541         for(;;)
03542         {
03543                 size_t extent = MIN(remaining, ncp->chunk);
03544                 size_t nget = ncx_howmany(varp->type, extent);
03545 
03546                 int lstatus = ncp->nciop->get(ncp->nciop, offset, extent,
03547                                  0, (void **)&xp);      /* cast away const */
03548                 if(lstatus != NC_NOERR)
03549                         return lstatus;
03550                 
03551                 lstatus = ncx_getn_float_int(&xp, nget, value);
03552                 if(lstatus != NC_NOERR && status == NC_NOERR)
03553                         status = lstatus;
03554 
03555                 (void) ncp->nciop->rel(ncp->nciop, offset, 0);  
03556 
03557                 remaining -= extent;
03558                 if(remaining == 0)
03559                         break; /* normal loop exit */
03560                 offset += extent;
03561                 value += nget;
03562         }
03563 
03564         return status;
03565 }

static int getNCvx_float_long const NC ncp,
const NC_var varp,
const size_t *  start,
size_t  nelems,
long *  value
[static]
 

Definition at line 3568 of file putget.c.

References NC::chunk, ncio::get, MIN, NC_NOERR, NC_varoffset(), NC::nciop, ncx_getn_float_long(), ncx_howmany(), ncio::rel, NC_var::type, and NC_var::xsz.

Referenced by getNCv_long().

03570 {
03571         off_t offset = NC_varoffset(ncp, varp, start);
03572         size_t remaining = varp->xsz * nelems;
03573         int status = NC_NOERR;
03574         const void *xp;
03575 
03576         if(nelems == 0)
03577                 return NC_NOERR;
03578 
03579         assert(value != NULL);
03580 
03581         for(;;)
03582         {
03583                 size_t extent = MIN(remaining, ncp->chunk);
03584                 size_t nget = ncx_howmany(varp->type, extent);
03585 
03586                 int lstatus = ncp->nciop->get(ncp->nciop, offset, extent,
03587                                  0, (void **)&xp);      /* cast away const */
03588                 if(lstatus != NC_NOERR)
03589                         return lstatus;
03590                 
03591                 lstatus = ncx_getn_float_long(&xp, nget, value);
03592                 if(lstatus != NC_NOERR && status == NC_NOERR)
03593                         status = lstatus;
03594 
03595                 (void) ncp->nciop->rel(ncp->nciop, offset, 0);  
03596 
03597                 remaining -= extent;
03598                 if(remaining == 0)
03599                         break; /* normal loop exit */
03600                 offset += extent;
03601                 value += nget;
03602         }
03603 
03604         return status;
03605 }

static int getNCvx_float_schar const NC ncp,
const NC_var varp,
const size_t *  start,
size_t  nelems,
schar value
[static]
 

Definition at line 3408 of file putget.c.

References NC::chunk, ncio::get, MIN, NC_NOERR, NC_varoffset(), NC::nciop, ncx_getn_float_schar(), ncx_howmany(), ncio::rel, NC_var::type, and NC_var::xsz.

Referenced by getNCv_schar().

03410 {
03411         off_t offset = NC_varoffset(ncp, varp, start);
03412         size_t remaining = varp->xsz * nelems;
03413         int status = NC_NOERR;
03414         const void *xp;
03415 
03416         if(nelems == 0)
03417                 return NC_NOERR;
03418 
03419         assert(value != NULL);
03420 
03421         for(;;)
03422         {
03423                 size_t extent = MIN(remaining, ncp->chunk);
03424                 size_t nget = ncx_howmany(varp->type, extent);
03425 
03426                 int lstatus = ncp->nciop->get(ncp->nciop, offset, extent,
03427                                  0, (void **)&xp);      /* cast away const */
03428                 if(lstatus != NC_NOERR)
03429                         return lstatus;
03430                 
03431                 lstatus = ncx_getn_float_schar(&xp, nget, value);
03432                 if(lstatus != NC_NOERR && status == NC_NOERR)
03433                         status = lstatus;
03434 
03435                 (void) ncp->nciop->rel(ncp->nciop, offset, 0);  
03436 
03437                 remaining -= extent;
03438                 if(remaining == 0)
03439                         break; /* normal loop exit */
03440                 offset += extent;
03441                 value += nget;
03442         }
03443 
03444         return status;
03445 }

static int getNCvx_float_short const NC ncp,
const NC_var varp,
const size_t *  start,
size_t  nelems,
short *  value
[static]
 

Definition at line 3488 of file putget.c.

References NC::chunk, ncio::get, MIN, NC_NOERR, NC_varoffset(), NC::nciop, ncx_getn_float_short(), ncx_howmany(), ncio::rel, NC_var::type, and NC_var::xsz.

Referenced by getNCv_short().

03490 {
03491         off_t offset = NC_varoffset(ncp, varp, start);
03492         size_t remaining = varp->xsz * nelems;
03493         int status = NC_NOERR;
03494         const void *xp;
03495 
03496         if(nelems == 0)
03497                 return NC_NOERR;
03498 
03499         assert(value != NULL);
03500 
03501         for(;;)
03502         {
03503                 size_t extent = MIN(remaining, ncp->chunk);
03504                 size_t nget = ncx_howmany(varp->type, extent);
03505 
03506                 int lstatus = ncp->nciop->get(ncp->nciop, offset, extent,
03507                                  0, (void **)&xp);      /* cast away const */
03508                 if(lstatus != NC_NOERR)
03509                         return lstatus;
03510                 
03511                 lstatus = ncx_getn_float_short(&xp, nget, value);
03512                 if(lstatus != NC_NOERR && status == NC_NOERR)
03513                         status = lstatus;
03514 
03515                 (void) ncp->nciop->rel(ncp->nciop, offset, 0);  
03516 
03517                 remaining -= extent;
03518                 if(remaining == 0)
03519                         break; /* normal loop exit */
03520                 offset += extent;
03521                 value += nget;
03522         }
03523 
03524         return status;
03525 }

static int getNCvx_float_uchar const NC ncp,
const NC_var varp,
const size_t *  start,
size_t  nelems,
uchar value
[static]
 

Definition at line 3448 of file putget.c.

References NC::chunk, ncio::get, MIN, NC_NOERR, NC_varoffset(), NC::nciop, ncx_getn_float_uchar(), ncx_howmany(), ncio::rel, NC_var::type, and NC_var::xsz.

Referenced by getNCv_uchar().

03450 {
03451         off_t offset = NC_varoffset(ncp, varp, start);
03452         size_t remaining = varp->xsz * nelems;
03453         int status = NC_NOERR;
03454         const void *xp;
03455 
03456         if(nelems == 0)
03457                 return NC_NOERR;
03458 
03459         assert(value != NULL);
03460 
03461         for(;;)
03462         {
03463                 size_t extent = MIN(remaining, ncp->chunk);
03464                 size_t nget = ncx_howmany(varp->type, extent);
03465 
03466                 int lstatus = ncp->nciop->get(ncp->nciop, offset, extent,
03467                                  0, (void **)&xp);      /* cast away const */
03468                 if(lstatus != NC_NOERR)
03469                         return lstatus;
03470                 
03471                 lstatus = ncx_getn_float_uchar(&xp, nget, value);
03472                 if(lstatus != NC_NOERR && status == NC_NOERR)
03473                         status = lstatus;
03474 
03475                 (void) ncp->nciop->rel(ncp->nciop, offset, 0);  
03476 
03477                 remaining -= extent;
03478                 if(remaining == 0)
03479                         break; /* normal loop exit */
03480                 offset += extent;
03481                 value += nget;
03482         }
03483 
03484         return status;
03485 }

static int getNCvx_int_double const NC ncp,
const NC_var varp,
const size_t *  start,
size_t  nelems,
double *  value
[static]
 

Definition at line 3367 of file putget.c.

References NC::chunk, ncio::get, MIN, NC_NOERR, NC_varoffset(), NC::nciop, ncx_getn_int_double(), ncx_howmany(), ncio::rel, NC_var::type, and NC_var::xsz.

Referenced by getNCv_double().

03369 {
03370         off_t offset = NC_varoffset(ncp, varp, start);
03371         size_t remaining = varp->xsz * nelems;
03372         int status = NC_NOERR;
03373         const void *xp;
03374 
03375         if(nelems == 0)
03376                 return NC_NOERR;
03377 
03378         assert(value != NULL);
03379 
03380         for(;;)
03381         {
03382                 size_t extent = MIN(remaining, ncp->chunk);
03383                 size_t nget = ncx_howmany(varp->type, extent);
03384 
03385                 int lstatus = ncp->nciop->get(ncp->nciop, offset, extent,
03386                                  0, (void **)&xp);      /* cast away const */
03387                 if(lstatus != NC_NOERR)
03388                         return lstatus;
03389                 
03390                 lstatus = ncx_getn_int_double(&xp, nget, value);
03391                 if(lstatus != NC_NOERR && status == NC_NOERR)
03392                         status = lstatus;
03393 
03394                 (void) ncp->nciop->rel(ncp->nciop, offset, 0);  
03395 
03396                 remaining -= extent;
03397                 if(remaining == 0)
03398                         break; /* normal loop exit */
03399                 offset += extent;
03400                 value += nget;
03401         }
03402 
03403         return status;
03404 }

static int getNCvx_int_float const NC ncp,
const NC_var varp,
const size_t *  start,
size_t  nelems,
float *  value
[static]
 

Definition at line 3327 of file putget.c.

References NC::chunk, ncio::get, MIN, NC_NOERR, NC_varoffset(), NC::nciop, ncx_getn_int_float(), ncx_howmany(), ncio::rel, NC_var::type, and NC_var::xsz.

Referenced by getNCv_float().

03329 {
03330         off_t offset = NC_varoffset(ncp, varp, start);
03331         size_t remaining = varp->xsz * nelems;
03332         int status = NC_NOERR;
03333         const void *xp;
03334 
03335         if(nelems == 0)
03336                 return NC_NOERR;
03337 
03338         assert(value != NULL);
03339 
03340         for(;;)
03341         {
03342                 size_t extent = MIN(remaining, ncp->chunk);
03343                 size_t nget = ncx_howmany(varp->type, extent);
03344 
03345                 int lstatus = ncp->nciop->get(ncp->nciop, offset, extent,
03346                                  0, (void **)&xp);      /* cast away const */
03347                 if(lstatus != NC_NOERR)
03348                         return lstatus;
03349                 
03350                 lstatus = ncx_getn_int_float(&xp, nget, value);
03351                 if(lstatus != NC_NOERR && status == NC_NOERR)
03352                         status = lstatus;
03353 
03354                 (void) ncp->nciop->rel(ncp->nciop, offset, 0);  
03355 
03356                 remaining -= extent;
03357                 if(remaining == 0)
03358                         break; /* normal loop exit */
03359                 offset += extent;
03360                 value += nget;
03361         }
03362 
03363         return status;
03364 }

static int getNCvx_int_int const NC ncp,
const NC_var varp,
const size_t *  start,
size_t  nelems,
int *  value
[static]
 

Definition at line 3247 of file putget.c.

References NC::chunk, ncio::get, MIN, NC_NOERR, NC_varoffset(), NC::nciop, ncx_getn_int_int(), ncx_howmany(), ncio::rel, NC_var::type, and NC_var::xsz.

Referenced by getNCv_int().

03249 {
03250         off_t offset = NC_varoffset(ncp, varp, start);
03251         size_t remaining = varp->xsz * nelems;
03252         int status = NC_NOERR;
03253         const void *xp;
03254 
03255         if(nelems == 0)
03256                 return NC_NOERR;
03257 
03258         assert(value != NULL);
03259 
03260         for(;;)
03261         {
03262                 size_t extent = MIN(remaining, ncp->chunk);
03263                 size_t nget = ncx_howmany(varp->type, extent);
03264 
03265                 int lstatus = ncp->nciop->get(ncp->nciop, offset, extent,
03266                                  0, (void **)&xp);      /* cast away const */
03267                 if(lstatus != NC_NOERR)
03268                         return lstatus;
03269                 
03270                 lstatus = ncx_getn_int_int(&xp, nget, value);
03271                 if(lstatus != NC_NOERR && status == NC_NOERR)
03272                         status = lstatus;
03273 
03274                 (void) ncp->nciop->rel(ncp->nciop, offset, 0);  
03275 
03276                 remaining -= extent;
03277                 if(remaining == 0)
03278                         break; /* normal loop exit */
03279                 offset += extent;
03280                 value += nget;
03281         }
03282 
03283         return status;
03284 }

static int getNCvx_int_long const NC ncp,
const NC_var varp,
const size_t *  start,
size_t  nelems,
long *  value
[static]
 

Definition at line 3287 of file putget.c.

References NC::chunk, ncio::get, MIN, NC_NOERR, NC_varoffset(), NC::nciop, ncx_getn_int_long(), ncx_howmany(), ncio::rel, NC_var::type, and NC_var::xsz.

Referenced by getNCv_long().

03289 {
03290         off_t offset = NC_varoffset(ncp, varp, start);
03291         size_t remaining = varp->xsz * nelems;
03292         int status = NC_NOERR;
03293         const void *xp;
03294 
03295         if(nelems == 0)
03296                 return NC_NOERR;
03297 
03298         assert(value != NULL);
03299 
03300         for(;;)
03301         {
03302                 size_t extent = MIN(remaining, ncp->chunk);
03303                 size_t nget = ncx_howmany(varp->type, extent);
03304 
03305                 int lstatus = ncp->nciop->get(ncp->nciop, offset, extent,
03306                                  0, (void **)&xp);      /* cast away const */
03307                 if(lstatus != NC_NOERR)
03308                         return lstatus;
03309                 
03310                 lstatus = ncx_getn_int_long(&xp, nget, value);
03311                 if(lstatus != NC_NOERR && status == NC_NOERR)
03312                         status = lstatus;
03313 
03314                 (void) ncp->nciop->rel(ncp->nciop, offset, 0);  
03315 
03316                 remaining -= extent;
03317                 if(remaining == 0)
03318                         break; /* normal loop exit */
03319                 offset += extent;
03320                 value += nget;
03321         }
03322 
03323         return status;
03324 }

static int getNCvx_int_schar const NC ncp,
const NC_var varp,
const size_t *  start,
size_t  nelems,
schar value
[static]
 

Definition at line 3127 of file putget.c.

References NC::chunk, ncio::get, MIN, NC_NOERR, NC_varoffset(), NC::nciop, ncx_getn_int_schar(), ncx_howmany(), ncio::rel, NC_var::type, and NC_var::xsz.

Referenced by getNCv_schar().

03129 {
03130         off_t offset = NC_varoffset(ncp, varp, start);
03131         size_t remaining = varp->xsz * nelems;
03132         int status = NC_NOERR;
03133         const void *xp;
03134 
03135         if(nelems == 0)
03136                 return NC_NOERR;
03137 
03138         assert(value != NULL);
03139 
03140         for(;;)
03141         {
03142                 size_t extent = MIN(remaining, ncp->chunk);
03143                 size_t nget = ncx_howmany(varp->type, extent);
03144 
03145                 int lstatus = ncp->nciop->get(ncp->nciop, offset, extent,
03146                                  0, (void **)&xp);      /* cast away const */
03147                 if(lstatus != NC_NOERR)
03148                         return lstatus;
03149                 
03150                 lstatus = ncx_getn_int_schar(&xp, nget, value);
03151                 if(lstatus != NC_NOERR && status == NC_NOERR)
03152                         status = lstatus;
03153 
03154                 (void) ncp->nciop->rel(ncp->nciop, offset, 0);  
03155 
03156                 remaining -= extent;
03157                 if(remaining == 0)
03158                         break; /* normal loop exit */
03159                 offset += extent;
03160                 value += nget;
03161         }
03162 
03163         return status;
03164 }

static int getNCvx_int_short const NC ncp,
const NC_var varp,
const size_t *  start,
size_t  nelems,
short *  value
[static]
 

Definition at line 3207 of file putget.c.

References NC::chunk, ncio::get, MIN, NC_NOERR, NC_varoffset(), NC::nciop, ncx_getn_int_short(), ncx_howmany(), ncio::rel, NC_var::type, and NC_var::xsz.

Referenced by getNCv_short().

03209 {
03210         off_t offset = NC_varoffset(ncp, varp, start);
03211         size_t remaining = varp->xsz * nelems;
03212         int status = NC_NOERR;
03213         const void *xp;
03214 
03215         if(nelems == 0)
03216                 return NC_NOERR;
03217 
03218         assert(value != NULL);
03219 
03220         for(;;)
03221         {
03222                 size_t extent = MIN(remaining, ncp->chunk);
03223                 size_t nget = ncx_howmany(varp->type, extent);
03224 
03225                 int lstatus = ncp->nciop->get(ncp->nciop, offset, extent,
03226                                  0, (void **)&xp);      /* cast away const */
03227                 if(lstatus != NC_NOERR)
03228                         return lstatus;
03229                 
03230                 lstatus = ncx_getn_int_short(&xp, nget, value);
03231                 if(lstatus != NC_NOERR && status == NC_NOERR)
03232                         status = lstatus;
03233 
03234                 (void) ncp->nciop->rel(ncp->nciop, offset, 0);  
03235 
03236                 remaining -= extent;
03237                 if(remaining == 0)
03238                         break; /* normal loop exit */
03239                 offset += extent;
03240                 value += nget;
03241         }
03242 
03243         return status;
03244 }

static int getNCvx_int_uchar const NC ncp,
const NC_var varp,
const size_t *  start,
size_t  nelems,
uchar value
[static]
 

Definition at line 3167 of file putget.c.

References NC::chunk, ncio::get, MIN, NC_NOERR, NC_varoffset(), NC::nciop, ncx_getn_int_uchar(), ncx_howmany(), ncio::rel, NC_var::type, and NC_var::xsz.

Referenced by getNCv_uchar().

03169 {
03170         off_t offset = NC_varoffset(ncp, varp, start);
03171         size_t remaining = varp->xsz * nelems;
03172         int status = NC_NOERR;
03173         const void *xp;
03174 
03175         if(nelems == 0)
03176                 return NC_NOERR;
03177 
03178         assert(value != NULL);
03179 
03180         for(;;)
03181         {
03182                 size_t extent = MIN(remaining, ncp->chunk);
03183                 size_t nget = ncx_howmany(varp->type, extent);
03184 
03185                 int lstatus = ncp->nciop->get(ncp->nciop, offset, extent,
03186                                  0, (void **)&xp);      /* cast away const */
03187                 if(lstatus != NC_NOERR)
03188                         return lstatus;
03189                 
03190                 lstatus = ncx_getn_int_uchar(&xp, nget, value);
03191                 if(lstatus != NC_NOERR && status == NC_NOERR)
03192                         status = lstatus;
03193 
03194                 (void) ncp->nciop->rel(ncp->nciop, offset, 0);  
03195 
03196                 remaining -= extent;
03197                 if(remaining == 0)
03198                         break; /* normal loop exit */
03199                 offset += extent;
03200                 value += nget;
03201         }
03202 
03203         return status;
03204 }

static int getNCvx_schar_double const NC ncp,
const NC_var varp,
const size_t *  start,
size_t  nelems,
double *  value
[static]
 

Definition at line 2805 of file putget.c.

References NC::chunk, ncio::get, MIN, NC_NOERR, NC_varoffset(), NC::nciop, ncx_getn_schar_double(), ncx_howmany(), ncio::rel, NC_var::type, and NC_var::xsz.

Referenced by getNCv_double().

02807 {
02808         off_t offset = NC_varoffset(ncp, varp, start);
02809         size_t remaining = varp->xsz * nelems;
02810         int status = NC_NOERR;
02811         const void *xp;
02812 
02813         if(nelems == 0)
02814                 return NC_NOERR;
02815 
02816         assert(value != NULL);
02817 
02818         for(;;)
02819         {
02820                 size_t extent = MIN(remaining, ncp->chunk);
02821                 size_t nget = ncx_howmany(varp->type, extent);
02822 
02823                 int lstatus = ncp->nciop->get(ncp->nciop, offset, extent,
02824                                  0, (void **)&xp);      /* cast away const */
02825                 if(lstatus != NC_NOERR)
02826                         return lstatus;
02827                 
02828                 lstatus = ncx_getn_schar_double(&xp, nget, value);
02829                 if(lstatus != NC_NOERR && status == NC_NOERR)
02830                         status = lstatus;
02831 
02832                 (void) ncp->nciop->rel(ncp->nciop, offset, 0);  
02833 
02834                 remaining -= extent;
02835                 if(remaining == 0)
02836                         break; /* normal loop exit */
02837                 offset += extent;
02838                 value += nget;
02839         }
02840 
02841         return status;
02842 }

static int getNCvx_schar_float const NC ncp,
const NC_var varp,
const size_t *  start,
size_t  nelems,
float *  value
[static]
 

Definition at line 2765 of file putget.c.

References NC::chunk, ncio::get, MIN, NC_NOERR, NC_varoffset(), NC::nciop, ncx_getn_schar_float(), ncx_howmany(), ncio::rel, NC_var::type, and NC_var::xsz.

Referenced by getNCv_float().

02767 {
02768         off_t offset = NC_varoffset(ncp, varp, start);
02769         size_t remaining = varp->xsz * nelems;
02770         int status = NC_NOERR;
02771         const void *xp;
02772 
02773         if(nelems == 0)
02774                 return NC_NOERR;
02775 
02776         assert(value != NULL);
02777 
02778         for(;;)
02779         {
02780                 size_t extent = MIN(remaining, ncp->chunk);
02781                 size_t nget = ncx_howmany(varp->type, extent);
02782 
02783                 int lstatus = ncp->nciop->get(ncp->nciop, offset, extent,
02784                                  0, (void **)&xp);      /* cast away const */
02785                 if(lstatus != NC_NOERR)
02786                         return lstatus;
02787                 
02788                 lstatus = ncx_getn_schar_float(&xp, nget, value);
02789                 if(lstatus != NC_NOERR && status == NC_NOERR)
02790                         status = lstatus;
02791 
02792                 (void) ncp->nciop->rel(ncp->nciop, offset, 0);  
02793 
02794                 remaining -= extent;
02795                 if(remaining == 0)
02796                         break; /* normal loop exit */
02797                 offset += extent;
02798                 value += nget;
02799         }
02800 
02801         return status;
02802 }

static int getNCvx_schar_int const NC ncp,
const NC_var varp,
const size_t *  start,
size_t  nelems,
int *  value
[static]
 

Definition at line 2685 of file putget.c.

References NC::chunk, ncio::get, MIN, NC_NOERR, NC_varoffset(), NC::nciop, ncx_getn_schar_int(), ncx_howmany(), ncio::rel, NC_var::type, and NC_var::xsz.

Referenced by getNCv_int().

02687 {
02688         off_t offset = NC_varoffset(ncp, varp, start);
02689         size_t remaining = varp->xsz * nelems;
02690         int status = NC_NOERR;
02691         const void *xp;
02692 
02693         if(nelems == 0)
02694                 return NC_NOERR;
02695 
02696         assert(value != NULL);
02697 
02698         for(;;)
02699         {
02700                 size_t extent = MIN(remaining, ncp->chunk);
02701                 size_t nget = ncx_howmany(varp->type, extent);
02702 
02703                 int lstatus = ncp->nciop->get(ncp->nciop, offset, extent,
02704                                  0, (void **)&xp);      /* cast away const */
02705                 if(lstatus != NC_NOERR)
02706                         return lstatus;
02707                 
02708                 lstatus = ncx_getn_schar_int(&xp, nget, value);
02709                 if(lstatus != NC_NOERR && status == NC_NOERR)
02710                         status = lstatus;
02711 
02712                 (void) ncp->nciop->rel(ncp->nciop, offset, 0);  
02713 
02714                 remaining -= extent;
02715                 if(remaining == 0)
02716                         break; /* normal loop exit */
02717                 offset += extent;
02718                 value += nget;
02719         }
02720 
02721         return status;
02722 }

static int getNCvx_schar_long const NC ncp,
const NC_var varp,
const size_t *  start,
size_t  nelems,
long *  value
[static]
 

Definition at line 2725 of file putget.c.

References NC::chunk, ncio::get, MIN, NC_NOERR, NC_varoffset(), NC::nciop, ncx_getn_schar_long(), ncx_howmany(), ncio::rel, NC_var::type, and NC_var::xsz.

Referenced by getNCv_long().

02727 {
02728         off_t offset = NC_varoffset(ncp, varp, start);
02729         size_t remaining = varp->xsz * nelems;
02730         int status = NC_NOERR;
02731         const void *xp;
02732 
02733         if(nelems == 0)
02734                 return NC_NOERR;
02735 
02736         assert(value != NULL);
02737 
02738         for(;;)
02739         {
02740                 size_t extent = MIN(remaining, ncp->chunk);
02741                 size_t nget = ncx_howmany(varp->type, extent);
02742 
02743                 int lstatus = ncp->nciop->get(ncp->nciop, offset, extent,
02744                                  0, (void **)&xp);      /* cast away const */
02745                 if(lstatus != NC_NOERR)
02746                         return lstatus;
02747                 
02748                 lstatus = ncx_getn_schar_long(&xp, nget, value);
02749                 if(lstatus != NC_NOERR && status == NC_NOERR)
02750                         status = lstatus;
02751 
02752                 (void) ncp->nciop->rel(ncp->nciop, offset, 0);  
02753 
02754                 remaining -= extent;
02755                 if(remaining == 0)
02756                         break; /* normal loop exit */
02757                 offset += extent;
02758                 value += nget;
02759         }
02760 
02761         return status;
02762 }

static int getNCvx_schar_schar const NC ncp,
const NC_var varp,
const size_t *  start,
size_t  nelems,
schar value
[static]
 

Definition at line 2565 of file putget.c.

References NC::chunk, ncio::get, MIN, NC_NOERR, NC_varoffset(), NC::nciop, ncx_getn_schar_schar(), ncx_howmany(), ncio::rel, NC_var::type, and NC_var::xsz.

Referenced by getNCv_schar().

02567 {
02568         off_t offset = NC_varoffset(ncp, varp, start);
02569         size_t remaining = varp->xsz * nelems;
02570         int status = NC_NOERR;
02571         const void *xp;
02572 
02573         if(nelems == 0)
02574                 return NC_NOERR;
02575 
02576         assert(value != NULL);
02577 
02578         for(;;)
02579         {
02580                 size_t extent = MIN(remaining, ncp->chunk);
02581                 size_t nget = ncx_howmany(varp->type, extent);
02582 
02583                 int lstatus = ncp->nciop->get(ncp->nciop, offset, extent,
02584                                  0, (void **)&xp);      /* cast away const */
02585                 if(lstatus != NC_NOERR)
02586                         return lstatus;
02587                 
02588                 lstatus = ncx_getn_schar_schar(&xp, nget, value);
02589                 if(lstatus != NC_NOERR && status == NC_NOERR)
02590                         status = lstatus;
02591 
02592                 (void) ncp->nciop->rel(ncp->nciop, offset, 0);  
02593 
02594                 remaining -= extent;
02595                 if(remaining == 0)
02596                         break; /* normal loop exit */
02597                 offset += extent;
02598                 value += nget;
02599         }
02600 
02601         return status;
02602 }

static int getNCvx_schar_short const NC ncp,
const NC_var varp,
const size_t *  start,
size_t  nelems,
short *  value
[static]
 

Definition at line 2645 of file putget.c.

References NC::chunk, ncio::get, MIN, NC_NOERR, NC_varoffset(), NC::nciop, ncx_getn_schar_short(), ncx_howmany(), ncio::rel, NC_var::type, and NC_var::xsz.

Referenced by getNCv_short().

02647 {
02648         off_t offset = NC_varoffset(ncp, varp, start);
02649         size_t remaining = varp->xsz * nelems;
02650         int status = NC_NOERR;
02651         const void *xp;
02652 
02653         if(nelems == 0)
02654                 return NC_NOERR;
02655 
02656         assert(value != NULL);
02657 
02658         for(;;)
02659         {
02660                 size_t extent = MIN(remaining, ncp->chunk);
02661                 size_t nget = ncx_howmany(varp->type, extent);
02662 
02663                 int lstatus = ncp->nciop->get(ncp->nciop, offset, extent,
02664                                  0, (void **)&xp);      /* cast away const */
02665                 if(lstatus != NC_NOERR)
02666                         return lstatus;
02667                 
02668                 lstatus = ncx_getn_schar_short(&xp, nget, value);
02669                 if(lstatus != NC_NOERR && status == NC_NOERR)
02670                         status = lstatus;
02671 
02672                 (void) ncp->nciop->rel(ncp->nciop, offset, 0);  
02673 
02674                 remaining -= extent;
02675                 if(remaining == 0)
02676                         break; /* normal loop exit */
02677                 offset += extent;
02678                 value += nget;
02679         }
02680 
02681         return status;
02682 }

static int getNCvx_schar_uchar const NC ncp,
const NC_var varp,
const size_t *  start,
size_t  nelems,
uchar value
[static]
 

Definition at line 2605 of file putget.c.

References NC::chunk, ncio::get, MIN, NC_NOERR, NC_varoffset(), NC::nciop, ncx_getn_schar_uchar(), ncx_howmany(), ncio::rel, NC_var::type, and NC_var::xsz.

Referenced by getNCv_uchar().

02607 {
02608         off_t offset = NC_varoffset(ncp, varp, start);
02609         size_t remaining = varp->xsz * nelems;
02610         int status = NC_NOERR;
02611         const void *xp;
02612 
02613         if(nelems == 0)
02614                 return NC_NOERR;
02615 
02616         assert(value != NULL);
02617 
02618         for(;;)
02619         {
02620                 size_t extent = MIN(remaining, ncp->chunk);
02621                 size_t nget = ncx_howmany(varp->type, extent);
02622 
02623                 int lstatus = ncp->nciop->get(ncp->nciop, offset, extent,
02624                                  0, (void **)&xp);      /* cast away const */
02625                 if(lstatus != NC_NOERR)
02626                         return lstatus;
02627                 
02628                 lstatus = ncx_getn_schar_uchar(&xp, nget, value);
02629                 if(lstatus != NC_NOERR && status == NC_NOERR)
02630                         status = lstatus;
02631 
02632                 (void) ncp->nciop->rel(ncp->nciop, offset, 0);  
02633 
02634                 remaining -= extent;
02635                 if(remaining == 0)
02636                         break; /* normal loop exit */
02637                 offset += extent;
02638                 value += nget;
02639         }
02640 
02641         return status;
02642 }

static int getNCvx_short_double const NC ncp,
const NC_var varp,
const size_t *  start,
size_t  nelems,
double *  value
[static]
 

Definition at line 3086 of file putget.c.

References NC::chunk, ncio::get, MIN, NC_NOERR, NC_varoffset(), NC::nciop, ncx_getn_short_double(), ncx_howmany(), ncio::rel, NC_var::type, and NC_var::xsz.

Referenced by getNCv_double().

03088 {
03089         off_t offset = NC_varoffset(ncp, varp, start);
03090         size_t remaining = varp->xsz * nelems;
03091         int status = NC_NOERR;
03092         const void *xp;
03093 
03094         if(nelems == 0)
03095                 return NC_NOERR;
03096 
03097         assert(value != NULL);
03098 
03099         for(;;)
03100         {
03101                 size_t extent = MIN(remaining, ncp->chunk);
03102                 size_t nget = ncx_howmany(varp->type, extent);
03103 
03104                 int lstatus = ncp->nciop->get(ncp->nciop, offset, extent,
03105                                  0, (void **)&xp);      /* cast away const */
03106                 if(lstatus != NC_NOERR)
03107                         return lstatus;
03108                 
03109                 lstatus = ncx_getn_short_double(&xp, nget, value);
03110                 if(lstatus != NC_NOERR && status == NC_NOERR)
03111                         status = lstatus;
03112 
03113                 (void) ncp->nciop->rel(ncp->nciop, offset, 0);  
03114 
03115                 remaining -= extent;
03116                 if(remaining == 0)
03117                         break; /* normal loop exit */
03118                 offset += extent;
03119                 value += nget;
03120         }
03121 
03122         return status;
03123 }

static int getNCvx_short_float const NC ncp,
const NC_var varp,
const size_t *  start,
size_t  nelems,
float *  value
[static]
 

Definition at line 3046 of file putget.c.

References NC::chunk, ncio::get, MIN, NC_NOERR, NC_varoffset(), NC::nciop, ncx_getn_short_float(), ncx_howmany(), ncio::rel, NC_var::type, and NC_var::xsz.

Referenced by getNCv_float().

03048 {
03049         off_t offset = NC_varoffset(ncp, varp, start);
03050         size_t remaining = varp->xsz * nelems;
03051         int status = NC_NOERR;
03052         const void *xp;
03053 
03054         if(nelems == 0)
03055                 return NC_NOERR;
03056 
03057         assert(value != NULL);
03058 
03059         for(;;)
03060         {
03061                 size_t extent = MIN(remaining, ncp->chunk);
03062                 size_t nget = ncx_howmany(varp->type, extent);
03063 
03064                 int lstatus = ncp->nciop->get(ncp->nciop, offset, extent,
03065                                  0, (void **)&xp);      /* cast away const */
03066                 if(lstatus != NC_NOERR)
03067                         return lstatus;
03068                 
03069                 lstatus = ncx_getn_short_float(&xp, nget, value);
03070                 if(lstatus != NC_NOERR && status == NC_NOERR)
03071                         status = lstatus;
03072 
03073                 (void) ncp->nciop->rel(ncp->nciop, offset, 0);  
03074 
03075                 remaining -= extent;
03076                 if(remaining == 0)
03077                         break; /* normal loop exit */
03078                 offset += extent;
03079                 value += nget;
03080         }
03081 
03082         return status;
03083 }

static int getNCvx_short_int const NC ncp,
const NC_var varp,
const size_t *  start,
size_t  nelems,
int *  value
[static]
 

Definition at line 2966 of file putget.c.

References NC::chunk, ncio::get, MIN, NC_NOERR, NC_varoffset(), NC::nciop, ncx_getn_short_int(), ncx_howmany(), ncio::rel, NC_var::type, and NC_var::xsz.

Referenced by getNCv_int().

02968 {
02969         off_t offset = NC_varoffset(ncp, varp, start);
02970         size_t remaining = varp->xsz * nelems;
02971         int status = NC_NOERR;
02972         const void *xp;
02973 
02974         if(nelems == 0)
02975                 return NC_NOERR;
02976 
02977         assert(value != NULL);
02978 
02979         for(;;)
02980         {
02981                 size_t extent = MIN(remaining, ncp->chunk);
02982                 size_t nget = ncx_howmany(varp->type, extent);
02983 
02984                 int lstatus = ncp->nciop->get(ncp->nciop, offset, extent,
02985                                  0, (void **)&xp);      /* cast away const */
02986                 if(lstatus != NC_NOERR)
02987                         return lstatus;
02988                 
02989                 lstatus = ncx_getn_short_int(&xp, nget, value);
02990                 if(lstatus != NC_NOERR && status == NC_NOERR)
02991                         status = lstatus;
02992 
02993                 (void) ncp->nciop->rel(ncp->nciop, offset, 0);  
02994 
02995                 remaining -= extent;
02996                 if(remaining == 0)
02997                         break; /* normal loop exit */
02998                 offset += extent;
02999                 value += nget;
03000         }
03001 
03002         return status;
03003 }

static int getNCvx_short_long const NC ncp,
const NC_var varp,
const size_t *  start,
size_t  nelems,
long *  value
[static]
 

Definition at line 3006 of file putget.c.

References NC::chunk, ncio::get, MIN, NC_NOERR, NC_varoffset(), NC::nciop, ncx_getn_short_long(), ncx_howmany(), ncio::rel, NC_var::type, and NC_var::xsz.

Referenced by getNCv_long().

03008 {
03009         off_t offset = NC_varoffset(ncp, varp, start);
03010         size_t remaining = varp->xsz * nelems;
03011         int status = NC_NOERR;
03012         const void *xp;
03013 
03014         if(nelems == 0)
03015                 return NC_NOERR;
03016 
03017         assert(value != NULL);
03018 
03019         for(;;)
03020         {
03021                 size_t extent = MIN(remaining, ncp->chunk);
03022                 size_t nget = ncx_howmany(varp->type, extent);
03023 
03024                 int lstatus = ncp->nciop->get(ncp->nciop, offset, extent,
03025                                  0, (void **)&xp);      /* cast away const */
03026                 if(lstatus != NC_NOERR)
03027                         return lstatus;
03028                 
03029                 lstatus = ncx_getn_short_long(&xp, nget, value);
03030                 if(lstatus != NC_NOERR && status == NC_NOERR)
03031                         status = lstatus;
03032 
03033                 (void) ncp->nciop->rel(ncp->nciop, offset, 0);  
03034 
03035                 remaining -= extent;
03036                 if(remaining == 0)
03037                         break; /* normal loop exit */
03038                 offset += extent;
03039                 value += nget;
03040         }
03041 
03042         return status;
03043 }

static int getNCvx_short_schar const NC ncp,
const NC_var varp,
const size_t *  start,
size_t  nelems,
schar value
[static]
 

Definition at line 2846 of file putget.c.

References NC::chunk, ncio::get, MIN, NC_NOERR, NC_varoffset(), NC::nciop, ncx_getn_short_schar(), ncx_howmany(), ncio::rel, NC_var::type, and NC_var::xsz.

Referenced by getNCv_schar().

02848 {
02849         off_t offset = NC_varoffset(ncp, varp, start);
02850         size_t remaining = varp->xsz * nelems;
02851         int status = NC_NOERR;
02852         const void *xp;
02853 
02854         if(nelems == 0)
02855                 return NC_NOERR;
02856 
02857         assert(value != NULL);
02858 
02859         for(;;)
02860         {
02861                 size_t extent = MIN(remaining, ncp->chunk);
02862                 size_t nget = ncx_howmany(varp->type, extent);
02863 
02864                 int lstatus = ncp->nciop->get(ncp->nciop, offset, extent,
02865                                  0, (void **)&xp);      /* cast away const */
02866                 if(lstatus != NC_NOERR)
02867                         return lstatus;
02868                 
02869                 lstatus = ncx_getn_short_schar(&xp, nget, value);
02870                 if(lstatus != NC_NOERR && status == NC_NOERR)
02871                         status = lstatus;
02872 
02873                 (void) ncp->nciop->rel(ncp->nciop, offset, 0);  
02874 
02875                 remaining -= extent;
02876                 if(remaining == 0)
02877                         break; /* normal loop exit */
02878                 offset += extent;
02879                 value += nget;
02880         }
02881 
02882         return status;
02883 }

static int getNCvx_short_short const NC ncp,
const NC_var varp,
const size_t *  start,
size_t  nelems,
short *  value
[static]
 

Definition at line 2926 of file putget.c.

References NC::chunk, ncio::get, MIN, NC_NOERR, NC_varoffset(), NC::nciop, ncx_getn_short_short(), ncx_howmany(), ncio::rel, NC_var::type, and NC_var::xsz.

Referenced by getNCv_short().

02928 {
02929         off_t offset = NC_varoffset(ncp, varp, start);
02930         size_t remaining = varp->xsz * nelems;
02931         int status = NC_NOERR;
02932         const void *xp;
02933 
02934         if(nelems == 0)
02935                 return NC_NOERR;
02936 
02937         assert(value != NULL);
02938 
02939         for(;;)
02940         {
02941                 size_t extent = MIN(remaining, ncp->chunk);
02942                 size_t nget = ncx_howmany(varp->type, extent);
02943 
02944                 int lstatus = ncp->nciop->get(ncp->nciop, offset, extent,
02945                                  0, (void **)&xp);      /* cast away const */
02946                 if(lstatus != NC_NOERR)
02947                         return lstatus;
02948                 
02949                 lstatus = ncx_getn_short_short(&xp, nget, value);
02950                 if(lstatus != NC_NOERR && status == NC_NOERR)
02951                         status = lstatus;
02952 
02953                 (void) ncp->nciop->rel(ncp->nciop, offset, 0);  
02954 
02955                 remaining -= extent;
02956                 if(remaining == 0)
02957                         break; /* normal loop exit */
02958                 offset += extent;
02959                 value += nget;
02960         }
02961 
02962         return status;
02963 }

static int getNCvx_short_uchar const NC ncp,
const NC_var varp,
const size_t *  start,
size_t  nelems,
uchar value
[static]
 

Definition at line 2886 of file putget.c.

References NC::chunk, ncio::get, MIN, NC_NOERR, NC_varoffset(), NC::nciop, ncx_getn_short_uchar(), ncx_howmany(), ncio::rel, NC_var::type, and NC_var::xsz.

Referenced by getNCv_uchar().

02888 {
02889         off_t offset = NC_varoffset(ncp, varp, start);
02890         size_t remaining = varp->xsz * nelems;
02891         int status = NC_NOERR;
02892         const void *xp;
02893 
02894         if(nelems == 0)
02895                 return NC_NOERR;
02896 
02897         assert(value != NULL);
02898 
02899         for(;;)
02900         {
02901                 size_t extent = MIN(remaining, ncp->chunk);
02902                 size_t nget = ncx_howmany(varp->type, extent);
02903 
02904                 int lstatus = ncp->nciop->get(ncp->nciop, offset, extent,
02905                                  0, (void **)&xp);      /* cast away const */
02906                 if(lstatus != NC_NOERR)
02907                         return lstatus;
02908                 
02909                 lstatus = ncx_getn_short_uchar(&xp, nget, value);
02910                 if(lstatus != NC_NOERR && status == NC_NOERR)
02911                         status = lstatus;
02912 
02913                 (void) ncp->nciop->rel(ncp->nciop, offset, 0);  
02914 
02915                 remaining -= extent;
02916                 if(remaining == 0)
02917                         break; /* normal loop exit */
02918                 offset += extent;
02919                 value += nget;
02920         }
02921 
02922         return status;
02923 }

int nc_copy_var int  ncid_in,
int  varid,
int  ncid_out
 

Definition at line 11005 of file putget.c.

11006 {
11007         int status = NC_NOERR;
11008         NC *inncp, *outncp;
11009         NC_var *invp, *outvp;
11010 
11011         status = NC_check_id(ncid_in, &inncp); 
11012         if(status != NC_NOERR)
11013                 return status;
11014 
11015 
11016         if(NC_indef(inncp))
11017         {
11018                 return NC_EINDEFINE;
11019         }
11020 
11021         status = NC_check_id(ncid_out, &outncp); 
11022         if(status != NC_NOERR)
11023                 return status;
11024 
11025         if(NC_readonly(outncp))
11026         {
11027                 /* output file isn't writable */
11028                 return NC_EPERM;
11029         }
11030 
11031         if(NC_indef(outncp))
11032         {
11033                 return NC_EINDEFINE;
11034         }
11035 
11036         /* find the variable in the input cdf */
11037         invp = NC_lookupvar(inncp, varid);
11038         if(invp == NULL)
11039         {
11040                 return NC_ENOTVAR;
11041         }
11042 
11043         /* find the variable in the output cdf */
11044         if(NC_findvar(&outncp->vars, invp->name->cp, &outvp) == -1)
11045         {
11046                 return NC_ENOTVAR;
11047         }
11048 
11049         /* can we even attempt to copy without conversion? */
11050         if(outvp->type != invp->type)
11051         {
11052                 return NC_EINVAL;
11053         }
11054 
11055         if(        (invp->ndims == 0 && outvp->ndims != 0)
11056                 || (invp->ndims != 0 && outvp->ndims == 0)
11057                 || (IS_RECVAR(invp) && !IS_RECVAR(outvp))
11058                 || (!IS_RECVAR(invp) && IS_RECVAR(outvp))
11059                 || (invp->len != outvp->len)
11060         )
11061         {
11062                 return NC_EINVAL;
11063         }
11064 
11065         /*
11066          * Check coordinates
11067          */
11068         {
11069         ALLOC_ONSTACK(coord, size_t, invp->ndims);
11070         const size_t nrecs = NC_get_numrecs(inncp);
11071         (void) memcpy(coord, invp->shape, invp->ndims * sizeof(size_t));
11072         if(IS_RECVAR(invp))
11073                 *coord = nrecs;
11074         
11075         {
11076         size_t ii = 0;
11077         for(; ii < invp->ndims; ii++)
11078                 coord[ii] --;
11079         }
11080         /* at this point, coord is the largest valid coord of invp */
11081 
11082         if(NCcoordck(outncp, outvp, coord) != NC_NOERR)
11083         {
11084                 return NC_EINVAL;
11085         }
11086         /* else */
11087 
11088         (void) memset(coord, 0, invp->ndims * sizeof(size_t));
11089         
11090         if(!IS_RECVAR(invp))
11091         {
11092                 status = NCxvarcpy(inncp, invp, coord,
11093                                 outncp, outvp, coord,
11094                                 invp->len);
11095                 goto done;
11096         }
11097         /* else */
11098 
11099         status = NCvnrecs(outncp, nrecs);
11100         if(status != NC_NOERR)
11101                 goto done;
11102 
11103         for( /*NADA*/; *coord < nrecs; (*coord)++)
11104         {
11105                 status = NCxvarcpy(inncp, invp, coord,
11106                                 outncp, outvp, coord,
11107                                 invp->len);
11108                 if(status != NC_NOERR)
11109                         break;
11110         }
11111 done:
11112         FREE_ONSTACK(coord);
11113         }
11114         return status;
11115 }

static int NC_fill_char void **  xpp,
size_t  nelems
[static]
 

Definition at line 114 of file putget.c.

References NC_FILL_CHAR, ncx_putn_char_char, NFILL, and X_SIZEOF_CHAR.

Referenced by fill_NC_var().

00117 {
00118         char fillp[NFILL * sizeof(double)/X_SIZEOF_CHAR];
00119 
00120         assert(nelems <= sizeof(fillp)/sizeof(fillp[0]));
00121 
00122         {
00123                 char *vp = fillp;       /* lower bound of area to be filled */
00124                 const char *const end = vp + nelems;
00125                 while(vp < end)
00126                 {
00127                         *vp++ = NC_FILL_CHAR;
00128                 }
00129         }
00130         return ncx_putn_char_char(xpp, nelems, fillp);
00131 }

static int NC_fill_double void **  xpp,
size_t  nelems
[static]
 

Definition at line 221 of file putget.c.

References NC_FILL_DOUBLE, ncx_putn_double_double(), NFILL, and X_SIZEOF_DOUBLE.

Referenced by fill_NC_var().

00224 {
00225         double fillp[NFILL * sizeof(double)/X_SIZEOF_DOUBLE];
00226 
00227         assert(nelems <= sizeof(fillp)/sizeof(fillp[0]));
00228 
00229         {
00230                 double *vp = fillp;     /* lower bound of area to be filled */
00231                 const double *const end = vp + nelems;
00232                 while(vp < end)
00233                 {
00234                         *vp++ = NC_FILL_DOUBLE;
00235                 }
00236         }
00237         return ncx_putn_double_double(xpp, nelems, fillp);
00238 }

static int NC_fill_float void **  xpp,
size_t  nelems
[static]
 

Definition at line 201 of file putget.c.

References NC_FILL_FLOAT, ncx_putn_float_float(), NFILL, and X_SIZEOF_FLOAT.

Referenced by fill_NC_var().

00204 {
00205         float fillp[NFILL * sizeof(double)/X_SIZEOF_FLOAT];
00206 
00207         assert(nelems <= sizeof(fillp)/sizeof(fillp[0]));
00208 
00209         {
00210                 float *vp = fillp;      /* lower bound of area to be filled */
00211                 const float *const end = vp + nelems;
00212                 while(vp < end)
00213                 {
00214                         *vp++ = NC_FILL_FLOAT;
00215                 }
00216         }
00217         return ncx_putn_float_float(xpp, nelems, fillp);
00218 }

static int NC_fill_schar void **  xpp,
size_t  nelems
[static]
 

Definition at line 94 of file putget.c.

References NC_FILL_BYTE, ncx_putn_schar_schar(), NFILL, and X_SIZEOF_CHAR.

Referenced by fill_NC_var().

00097 {
00098         schar fillp[NFILL * sizeof(double)/X_SIZEOF_CHAR];
00099 
00100         assert(nelems <= sizeof(fillp)/sizeof(fillp[0]));
00101 
00102         {
00103                 schar *vp = fillp;      /* lower bound of area to be filled */
00104                 const schar *const end = vp + nelems;
00105                 while(vp < end)
00106                 {
00107                         *vp++ = NC_FILL_BYTE;
00108                 }
00109         }
00110         return ncx_putn_schar_schar(xpp, nelems, fillp);
00111 }

static int NC_fill_short void **  xpp,
size_t  nelems
[static]
 

Definition at line 134 of file putget.c.

References NC_FILL_SHORT, ncx_putn_short_short(), NFILL, and X_SIZEOF_SHORT.

Referenced by fill_NC_var().

00137 {
00138         short fillp[NFILL * sizeof(double)/X_SIZEOF_SHORT];
00139 
00140         assert(nelems <= sizeof(fillp)/sizeof(fillp[0]));
00141 
00142         {
00143                 short *vp = fillp;      /* lower bound of area to be filled */
00144                 const short *const end = vp + nelems;
00145                 while(vp < end)
00146                 {
00147                         *vp++ = NC_FILL_SHORT;
00148                 }
00149         }
00150         return ncx_putn_short_short(xpp, nelems, fillp);
00151 }

int nc_get_att int  ncid,
int  varid,
const char *  name,
void *  value
 

Definition at line 11119 of file putget.c.

11120 {
11121         int status;
11122         nc_type atttype;
11123 
11124         status = nc_inq_atttype(ncid, varid, name, &atttype);
11125         if(status != NC_NOERR)
11126                 return status;
11127 
11128         switch (atttype) {
11129         case NC_BYTE:
11130                 return nc_get_att_schar(ncid, varid, name,
11131                         (schar *)value);
11132         case NC_CHAR:
11133                 return nc_get_att_text(ncid, varid, name,
11134                         (char *)value);
11135         case NC_SHORT:
11136                 return nc_get_att_short(ncid, varid, name,
11137                         (short *)value);
11138         case NC_INT:
11139 #if (SIZEOF_INT >= X_SIZEOF_INT)
11140                 return nc_get_att_int(ncid, varid, name,
11141                         (int *)value);
11142 #elif SIZEOF_LONG == X_SIZEOF_INT
11143                 return nc_get_att_long(ncid, varid, name,
11144                         (long *)value);
11145 #endif
11146         case NC_FLOAT:
11147                 return nc_get_att_float(ncid, varid, name,
11148                         (float *)value);
11149         case NC_DOUBLE:
11150                 return nc_get_att_double(ncid, varid, name,
11151                         (double *)value);
11152         }
11153         return NC_EBADTYPE;
11154 }

int nc_get_var1 int  ncid,
int  varid,
const size_t *  coord,
void *  value
 

Definition at line 11196 of file putget.c.

11197 {
11198         int status;
11199         nc_type vartype;
11200 
11201         status = nc_inq_vartype(ncid, varid, &vartype); 
11202         if(status != NC_NOERR)
11203                 return status;
11204 
11205         switch(vartype){
11206         case NC_CHAR:
11207                 return nc_get_var1_text(ncid, varid, coord,
11208                         (char *) value);
11209         case NC_BYTE:
11210                 return nc_get_var1_schar(ncid, varid, coord,
11211                         (schar *) value);
11212         case NC_SHORT:
11213                 return nc_get_var1_short(ncid, varid, coord,
11214                         (short *) value);
11215         case NC_INT:
11216                 return nc_get_var1_int(ncid, varid, coord,
11217                         (int *) value);
11218         case NC_FLOAT:
11219                 return nc_get_var1_float(ncid, varid, coord,
11220                         (float *) value);
11221         case NC_DOUBLE: 
11222                 return nc_get_var1_double(ncid, varid, coord,
11223                         (double *) value);
11224         }
11225         return NC_EBADTYPE;
11226 }

int nc_get_var1_double int  ncid,
int  varid,
const size_t *  coord,
double *  value
 

Definition at line 4878 of file putget.c.

04879 {
04880         int status;
04881         NC *ncp;
04882         const NC_var *varp;
04883 
04884         status = NC_check_id(ncid, &ncp); 
04885         if(status != NC_NOERR)
04886                 return status;
04887 
04888         if(NC_indef(ncp))
04889                 return NC_EINDEFINE;
04890 
04891         varp = NC_lookupvar(ncp, varid);
04892         if(varp == NULL)
04893                 return NC_ENOTVAR; /* TODO: lost NC_EGLOBAL */
04894 
04895         if(varp->type == NC_CHAR)
04896                 return NC_ECHAR;
04897 
04898         status = NCcoordck(ncp, varp, coord);
04899         if(status != NC_NOERR)
04900                 return status;
04901 
04902         return getNCv_double(ncp, varp, coord, 1, value);
04903 }

int nc_get_var1_float int  ncid,
int  varid,
const size_t *  coord,
float *  value
 

Definition at line 4850 of file putget.c.

04851 {
04852         int status;
04853         NC *ncp;
04854         const NC_var *varp;
04855 
04856         status = NC_check_id(ncid, &ncp); 
04857         if(status != NC_NOERR)
04858                 return status;
04859 
04860         if(NC_indef(ncp))
04861                 return NC_EINDEFINE;
04862 
04863         varp = NC_lookupvar(ncp, varid);
04864         if(varp == NULL)
04865                 return NC_ENOTVAR; /* TODO: lost NC_EGLOBAL */
04866 
04867         if(varp->type == NC_CHAR)
04868                 return NC_ECHAR;
04869 
04870         status = NCcoordck(ncp, varp, coord);
04871         if(status != NC_NOERR)
04872                 return status;
04873 
04874         return getNCv_float(ncp, varp, coord, 1, value);
04875 }

int nc_get_var1_int int  ncid,
int  varid,
const size_t *  coord,
int *  value
 

Definition at line 4794 of file putget.c.

04795 {
04796         int status;
04797         NC *ncp;
04798         const NC_var *varp;
04799 
04800         status = NC_check_id(ncid, &ncp); 
04801         if(status != NC_NOERR)
04802                 return status;
04803 
04804         if(NC_indef(ncp))
04805                 return NC_EINDEFINE;
04806 
04807         varp = NC_lookupvar(ncp, varid);
04808         if(varp == NULL)
04809                 return NC_ENOTVAR; /* TODO: lost NC_EGLOBAL */
04810 
04811         if(varp->type == NC_CHAR)
04812                 return NC_ECHAR;
04813 
04814         status = NCcoordck(ncp, varp, coord);
04815         if(status != NC_NOERR)
04816                 return status;
04817 
04818         return getNCv_int(ncp, varp, coord, 1, value);
04819 }

int nc_get_var1_long int  ncid,
int  varid,
const size_t *  coord,
long *  value
 

Definition at line 4822 of file putget.c.

04823 {
04824         int status;
04825         NC *ncp;
04826         const NC_var *varp;
04827 
04828         status = NC_check_id(ncid, &ncp); 
04829         if(status != NC_NOERR)
04830                 return status;
04831 
04832         if(NC_indef(ncp))
04833                 return NC_EINDEFINE;
04834 
04835         varp = NC_lookupvar(ncp, varid);
04836         if(varp == NULL)
04837                 return NC_ENOTVAR; /* TODO: lost NC_EGLOBAL */
04838 
04839         if(varp->type == NC_CHAR)
04840                 return NC_ECHAR;
04841 
04842         status = NCcoordck(ncp, varp, coord);
04843         if(status != NC_NOERR)
04844                 return status;
04845 
04846         return getNCv_long(ncp, varp, coord, 1, value);
04847 }

int nc_get_var1_schar int  ncid,
int  varid,
const size_t *  coord,
schar value
 

Definition at line 4738 of file putget.c.

04739 {
04740         int status;
04741         NC *ncp;
04742         const NC_var *varp;
04743 
04744         status = NC_check_id(ncid, &ncp); 
04745         if(status != NC_NOERR)
04746                 return status;
04747 
04748         if(NC_indef(ncp))
04749                 return NC_EINDEFINE;
04750 
04751         varp = NC_lookupvar(ncp, varid);
04752         if(varp == NULL)
04753                 return NC_ENOTVAR; /* TODO: lost NC_EGLOBAL */
04754 
04755         if(varp->type == NC_CHAR)
04756                 return NC_ECHAR;
04757 
04758         status = NCcoordck(ncp, varp, coord);
04759         if(status != NC_NOERR)
04760                 return status;
04761 
04762         return getNCv_schar(ncp, varp, coord, 1, value);
04763 }

int nc_get_var1_short int  ncid,
int  varid,
const size_t *  coord,
short *  value
 

Definition at line 4766 of file putget.c.

04767 {
04768         int status;
04769         NC *ncp;
04770         const NC_var *varp;
04771 
04772         status = NC_check_id(ncid, &ncp); 
04773         if(status != NC_NOERR)
04774                 return status;
04775 
04776         if(NC_indef(ncp))
04777                 return NC_EINDEFINE;
04778 
04779         varp = NC_lookupvar(ncp, varid);
04780         if(varp == NULL)
04781                 return NC_ENOTVAR; /* TODO: lost NC_EGLOBAL */
04782 
04783         if(varp->type == NC_CHAR)
04784                 return NC_ECHAR;
04785 
04786         status = NCcoordck(ncp, varp, coord);
04787         if(status != NC_NOERR)
04788                 return status;
04789 
04790         return getNCv_short(ncp, varp, coord, 1, value);
04791 }

int nc_get_var1_text int  ncid,
int  varid,
const size_t *  coord,
char *  value
 

Definition at line 4681 of file putget.c.

04682 {
04683         int status;
04684         NC *ncp;
04685         const NC_var *varp;
04686 
04687         status = NC_check_id(ncid, &ncp); 
04688         if(status != NC_NOERR)
04689                 return status;
04690 
04691         if(NC_indef(ncp))
04692                 return NC_EINDEFINE;
04693 
04694         varp = NC_lookupvar(ncp, varid);
04695         if(varp == NULL)
04696                 return NC_ENOTVAR; /* TODO: lost NC_EGLOBAL */
04697 
04698         if(varp->type != NC_CHAR)
04699                 return NC_ECHAR;
04700 
04701         status = NCcoordck(ncp, varp, coord);
04702         if(status != NC_NOERR)
04703                 return status;
04704 
04705         return getNCv_text(ncp, varp, coord, 1, value);
04706 }

int nc_get_var1_uchar int  ncid,
int  varid,
const size_t *  coord,
uchar value
 

Definition at line 4710 of file putget.c.

04711 {
04712         int status;
04713         NC *ncp;
04714         const NC_var *varp;
04715 
04716         status = NC_check_id(ncid, &ncp); 
04717         if(status != NC_NOERR)
04718                 return status;
04719 
04720         if(NC_indef(ncp))
04721                 return NC_EINDEFINE;
04722 
04723         varp = NC_lookupvar(ncp, varid);
04724         if(varp == NULL)
04725                 return NC_ENOTVAR; /* TODO: lost NC_EGLOBAL */
04726 
04727         if(varp->type == NC_CHAR)
04728                 return NC_ECHAR;
04729 
04730         status = NCcoordck(ncp, varp, coord);
04731         if(status != NC_NOERR)
04732                 return status;
04733 
04734         return getNCv_uchar(ncp, varp, coord, 1, value);
04735 }

int nc_get_var_double int  ncid,
int  varid,
double *  value
 

Definition at line 7732 of file putget.c.

07733 {
07734         int status = NC_NOERR;
07735         NC *ncp;
07736         const NC_var *varp;
07737 
07738         status = NC_check_id(ncid, &ncp); 
07739         if(status != NC_NOERR)
07740                 return status;
07741 
07742         if(NC_indef(ncp))
07743                 return NC_EINDEFINE;
07744 
07745         varp = NC_lookupvar(ncp, varid);
07746         if(varp == NULL)
07747                 return NC_ENOTVAR; /* TODO: lost NC_EGLOBAL */
07748 
07749         if(varp->ndims == 0) /* scalar variable */
07750         {
07751                 const size_t zed = 0;
07752                 return( getNCv_double(ncp, varp, &zed, 1, value) );
07753         }
07754 
07755         if(varp->type == NC_CHAR)
07756                 return NC_ECHAR;
07757 
07758 
07759         if(!IS_RECVAR(varp))
07760         {
07761                 return(getNCv_double(ncp, varp, coord_zero, *varp->dsizes, value));
07762         }
07763         /* else */
07764 
07765         if(varp->ndims == 1
07766                         && ncp->recsize <= varp->len)
07767         {
07768                 /* one dimensional && the only record variable  */
07769                 return(getNCv_double(ncp, varp, coord_zero, NC_get_numrecs(ncp),
07770                         value));
07771         }
07772         /* else */
07773 
07774         {
07775         ALLOC_ONSTACK(coord, size_t, varp->ndims);
07776         size_t elemsPerRec = 1;
07777         const size_t nrecs = NC_get_numrecs(ncp);
07778         (void) memset(coord, 0, varp->ndims * sizeof(size_t));
07779         /* TODO: fix dsizes to avoid this nonsense */
07780         if(varp->ndims > 1)
07781                 elemsPerRec = varp->dsizes[1];
07782         while(*coord < nrecs)
07783         {
07784                 const int lstatus = getNCv_double(ncp, varp, coord, elemsPerRec,
07785                                 value);
07786                 if(lstatus != NC_NOERR)
07787                 {
07788                         if(lstatus != NC_ERANGE)
07789                         {
07790                                 status = lstatus;
07791                                 /* fatal for the loop */
07792                                 break;
07793                         }
07794                         /* else NC_ERANGE, not fatal for the loop */
07795                         if(status == NC_NOERR)
07796                                 status = lstatus;
07797                 }
07798                 value += elemsPerRec;
07799                 (*coord)++;
07800         }
07801         FREE_ONSTACK(coord);
07802         } /* elemsPerRec */
07803 
07804         return status;
07805 }

int nc_get_var_float int  ncid,
int  varid,
float *  value
 

Definition at line 7656 of file putget.c.

07657 {
07658         int status = NC_NOERR;
07659         NC *ncp;
07660         const NC_var *varp;
07661 
07662         status = NC_check_id(ncid, &ncp); 
07663         if(status != NC_NOERR)
07664                 return status;
07665 
07666         if(NC_indef(ncp))
07667                 return NC_EINDEFINE;
07668 
07669         varp = NC_lookupvar(ncp, varid);
07670         if(varp == NULL)
07671                 return NC_ENOTVAR; /* TODO: lost NC_EGLOBAL */
07672 
07673         if(varp->ndims == 0) /* scalar variable */
07674         {
07675                 const size_t zed = 0;
07676                 return( getNCv_float(ncp, varp, &zed, 1, value) );
07677         }
07678 
07679         if(varp->type == NC_CHAR)
07680                 return NC_ECHAR;
07681 
07682 
07683         if(!IS_RECVAR(varp))
07684         {
07685                 return(getNCv_float(ncp, varp, coord_zero, *varp->dsizes, value));
07686         }
07687         /* else */
07688 
07689         if(varp->ndims == 1
07690                         && ncp->recsize <= varp->len)
07691         {
07692                 /* one dimensional && the only record variable  */
07693                 return(getNCv_float(ncp, varp, coord_zero, NC_get_numrecs(ncp),
07694                         value));
07695         }
07696         /* else */
07697 
07698         {
07699         ALLOC_ONSTACK(coord, size_t, varp->ndims);
07700         size_t elemsPerRec = 1;
07701         const size_t nrecs = NC_get_numrecs(ncp);
07702         (void) memset(coord, 0, varp->ndims * sizeof(size_t));
07703         /* TODO: fix dsizes to avoid this nonsense */
07704         if(varp->ndims > 1)
07705                 elemsPerRec = varp->dsizes[1];
07706         while(*coord < nrecs)
07707         {
07708                 const int lstatus = getNCv_float(ncp, varp, coord, elemsPerRec,
07709                                 value);
07710                 if(lstatus != NC_NOERR)
07711                 {
07712                         if(lstatus != NC_ERANGE)
07713                         {
07714                                 status = lstatus;
07715                                 /* fatal for the loop */
07716                                 break;
07717                         }
07718                         /* else NC_ERANGE, not fatal for the loop */
07719                         if(status == NC_NOERR)
07720                                 status = lstatus;
07721                 }
07722                 value += elemsPerRec;
07723                 (*coord)++;
07724         }
07725         FREE_ONSTACK(coord);
07726         } /* elemsPerRec */
07727 
07728         return status;
07729 }

int nc_get_var_int int  ncid,
int  varid,
int *  value
 

Definition at line 7504 of file putget.c.

07505 {
07506         int status = NC_NOERR;
07507         NC *ncp;
07508         const NC_var *varp;
07509 
07510         status = NC_check_id(ncid, &ncp); 
07511         if(status != NC_NOERR)
07512                 return status;
07513 
07514         if(NC_indef(ncp))
07515                 return NC_EINDEFINE;
07516 
07517         varp = NC_lookupvar(ncp, varid);
07518         if(varp == NULL)
07519                 return NC_ENOTVAR; /* TODO: lost NC_EGLOBAL */
07520 
07521         if(varp->ndims == 0) /* scalar variable */
07522         {
07523                 const size_t zed = 0;
07524                 return( getNCv_int(ncp, varp, &zed, 1, value) );
07525         }
07526 
07527         if(varp->type == NC_CHAR)
07528                 return NC_ECHAR;
07529 
07530 
07531         if(!IS_RECVAR(varp))
07532         {
07533                 return(getNCv_int(ncp, varp, coord_zero, *varp->dsizes, value));
07534         }
07535         /* else */
07536 
07537         if(varp->ndims == 1
07538                         && ncp->recsize <= varp->len)
07539         {
07540                 /* one dimensional && the only record variable  */
07541                 return(getNCv_int(ncp, varp, coord_zero, NC_get_numrecs(ncp),
07542                         value));
07543         }
07544         /* else */
07545 
07546         {
07547         ALLOC_ONSTACK(coord, size_t, varp->ndims);
07548         size_t elemsPerRec = 1;
07549         const size_t nrecs = NC_get_numrecs(ncp);
07550         (void) memset(coord, 0, varp->ndims * sizeof(size_t));
07551         /* TODO: fix dsizes to avoid this nonsense */
07552         if(varp->ndims > 1)
07553                 elemsPerRec = varp->dsizes[1];
07554         while(*coord < nrecs)
07555         {
07556                 const int lstatus = getNCv_int(ncp, varp, coord, elemsPerRec,
07557                                 value);
07558                 if(lstatus != NC_NOERR)
07559                 {
07560                         if(lstatus != NC_ERANGE)
07561                         {
07562                                 status = lstatus;
07563                                 /* fatal for the loop */
07564                                 break;
07565                         }
07566                         /* else NC_ERANGE, not fatal for the loop */
07567                         if(status == NC_NOERR)
07568                                 status = lstatus;
07569                 }
07570                 value += elemsPerRec;
07571                 (*coord)++;
07572         }
07573         FREE_ONSTACK(coord);
07574         } /* elemsPerRec */
07575 
07576         return status;
07577 }

int nc_get_var_long int  ncid,
int  varid,
long *  value
 

Definition at line 7580 of file putget.c.

07581 {
07582         int status = NC_NOERR;
07583         NC *ncp;
07584         const NC_var *varp;
07585 
07586         status = NC_check_id(ncid, &ncp); 
07587         if(status != NC_NOERR)
07588                 return status;
07589 
07590         if(NC_indef(ncp))
07591                 return NC_EINDEFINE;
07592 
07593         varp = NC_lookupvar(ncp, varid);
07594         if(varp == NULL)
07595                 return NC_ENOTVAR; /* TODO: lost NC_EGLOBAL */
07596 
07597         if(varp->ndims == 0) /* scalar variable */
07598         {
07599                 const size_t zed = 0;
07600                 return( getNCv_long(ncp, varp, &zed, 1, value) );
07601         }
07602 
07603         if(varp->type == NC_CHAR)
07604                 return NC_ECHAR;
07605 
07606 
07607         if(!IS_RECVAR(varp))
07608         {
07609                 return(getNCv_long(ncp, varp, coord_zero, *varp->dsizes, value));
07610         }
07611         /* else */
07612 
07613         if(varp->ndims == 1
07614                         && ncp->recsize <= varp->len)
07615         {
07616                 /* one dimensional && the only record variable  */
07617                 return(getNCv_long(ncp, varp, coord_zero, NC_get_numrecs(ncp),
07618                         value));
07619         }
07620         /* else */
07621 
07622         {
07623         ALLOC_ONSTACK(coord, size_t, varp->ndims);
07624         size_t elemsPerRec = 1;
07625         const size_t nrecs = NC_get_numrecs(ncp);
07626         (void) memset(coord, 0, varp->ndims * sizeof(size_t));
07627         /* TODO: fix dsizes to avoid this nonsense */
07628         if(varp->ndims > 1)
07629                 elemsPerRec = varp->dsizes[1];
07630         while(*coord < nrecs)
07631         {
07632                 const int lstatus = getNCv_long(ncp, varp, coord, elemsPerRec,
07633                                 value);
07634                 if(lstatus != NC_NOERR)
07635                 {
07636                         if(lstatus != NC_ERANGE)
07637                         {
07638                                 status = lstatus;
07639                                 /* fatal for the loop */
07640                                 break;
07641                         }
07642                         /* else NC_ERANGE, not fatal for the loop */
07643                         if(status == NC_NOERR)
07644                                 status = lstatus;
07645                 }
07646                 value += elemsPerRec;
07647                 (*coord)++;
07648         }
07649         FREE_ONSTACK(coord);
07650         } /* elemsPerRec */
07651 
07652         return status;
07653 }

int nc_get_var_schar int  ncid,
int  varid,
schar value
 

Definition at line 7352 of file putget.c.

07353 {
07354         int status = NC_NOERR;
07355         NC *ncp;
07356         const NC_var *varp;
07357 
07358         status = NC_check_id(ncid, &ncp); 
07359         if(status != NC_NOERR)
07360                 return status;
07361 
07362         if(NC_indef(ncp))
07363                 return NC_EINDEFINE;
07364 
07365         varp = NC_lookupvar(ncp, varid);
07366         if(varp == NULL)
07367                 return NC_ENOTVAR; /* TODO: lost NC_EGLOBAL */
07368 
07369         if(varp->ndims == 0) /* scalar variable */
07370         {
07371                 const size_t zed = 0;
07372                 return( getNCv_schar(ncp, varp, &zed, 1, value) );
07373         }
07374 
07375         if(varp->type == NC_CHAR)
07376                 return NC_ECHAR;
07377 
07378 
07379         if(!IS_RECVAR(varp))
07380         {
07381                 return(getNCv_schar(ncp, varp, coord_zero, *varp->dsizes, value));
07382         }
07383         /* else */
07384 
07385         if(varp->ndims == 1
07386                         && ncp->recsize <= varp->len)
07387         {
07388                 /* one dimensional && the only record variable  */
07389                 return(getNCv_schar(ncp, varp, coord_zero, NC_get_numrecs(ncp),
07390                         value));
07391         }
07392         /* else */
07393 
07394         {
07395         ALLOC_ONSTACK(coord, size_t, varp->ndims);
07396         size_t elemsPerRec = 1;
07397         const size_t nrecs = NC_get_numrecs(ncp);
07398         (void) memset(coord, 0, varp->ndims * sizeof(size_t));
07399         /* TODO: fix dsizes to avoid this nonsense */
07400         if(varp->ndims > 1)
07401                 elemsPerRec = varp->dsizes[1];
07402         while(*coord < nrecs)
07403         {
07404                 const int lstatus = getNCv_schar(ncp, varp, coord, elemsPerRec,
07405                                 value);
07406                 if(lstatus != NC_NOERR)
07407                 {
07408                         if(lstatus != NC_ERANGE)
07409                         {
07410                                 status = lstatus;
07411                                 /* fatal for the loop */
07412                                 break;
07413                         }
07414                         /* else NC_ERANGE, not fatal for the loop */
07415                         if(status == NC_NOERR)
07416                                 status = lstatus;
07417                 }
07418                 value += elemsPerRec;
07419                 (*coord)++;
07420         }
07421         FREE_ONSTACK(coord);
07422         } /* elemsPerRec */
07423 
07424         return status;
07425 }

int nc_get_var_short int  ncid,
int  varid,
short *  value
 

Definition at line 7428 of file putget.c.

07429 {
07430         int status = NC_NOERR;
07431         NC *ncp;
07432         const NC_var *varp;
07433 
07434         status = NC_check_id(ncid, &ncp); 
07435         if(status != NC_NOERR)
07436                 return status;
07437 
07438         if(NC_indef(ncp))
07439                 return NC_EINDEFINE;
07440 
07441         varp = NC_lookupvar(ncp, varid);
07442         if(varp == NULL)
07443                 return NC_ENOTVAR; /* TODO: lost NC_EGLOBAL */
07444 
07445         if(varp->ndims == 0) /* scalar variable */
07446         {
07447                 const size_t zed = 0;
07448                 return( getNCv_short(ncp, varp, &zed, 1, value) );
07449         }
07450 
07451         if(varp->type == NC_CHAR)
07452                 return NC_ECHAR;
07453 
07454 
07455         if(!IS_RECVAR(varp))
07456         {
07457                 return(getNCv_short(ncp, varp, coord_zero, *varp->dsizes, value));
07458         }
07459         /* else */
07460 
07461         if(varp->ndims == 1
07462                         && ncp->recsize <= varp->len)
07463         {
07464                 /* one dimensional && the only record variable  */
07465                 return(getNCv_short(ncp, varp, coord_zero, NC_get_numrecs(ncp),
07466                         value));
07467         }
07468         /* else */
07469 
07470         {
07471         ALLOC_ONSTACK(coord, size_t, varp->ndims);
07472         size_t elemsPerRec = 1;
07473         const size_t nrecs = NC_get_numrecs(ncp);
07474         (void) memset(coord, 0, varp->ndims * sizeof(size_t));
07475         /* TODO: fix dsizes to avoid this nonsense */
07476         if(varp->ndims > 1)
07477                 elemsPerRec = varp->dsizes[1];
07478         while(*coord < nrecs)
07479         {
07480                 const int lstatus = getNCv_short(ncp, varp, coord, elemsPerRec,
07481                                 value);
07482                 if(lstatus != NC_NOERR)
07483                 {
07484                         if(lstatus != NC_ERANGE)
07485                         {
07486                                 status = lstatus;
07487                                 /* fatal for the loop */
07488                                 break;
07489                         }
07490                         /* else NC_ERANGE, not fatal for the loop */
07491                         if(status == NC_NOERR)
07492                                 status = lstatus;
07493                 }
07494                 value += elemsPerRec;
07495                 (*coord)++;
07496         }
07497         FREE_ONSTACK(coord);
07498         } /* elemsPerRec */
07499 
07500         return status;
07501 }

int nc_get_var_text int  ncid,
int  varid,
char *  value
 

Definition at line 7199 of file putget.c.

07200 {
07201         int status = NC_NOERR;
07202         NC *ncp;
07203         const NC_var *varp;
07204 
07205         status = NC_check_id(ncid, &ncp); 
07206         if(status != NC_NOERR)
07207                 return status;
07208 
07209         if(NC_indef(ncp))
07210                 return NC_EINDEFINE;
07211 
07212         varp = NC_lookupvar(ncp, varid);
07213         if(varp == NULL)
07214                 return NC_ENOTVAR; /* TODO: lost NC_EGLOBAL */
07215 
07216         if(varp->ndims == 0) /* scalar variable */
07217         {
07218                 const size_t zed = 0;
07219                 return( getNCv_text(ncp, varp, &zed, 1, value) );
07220         }
07221 
07222         if(varp->type != NC_CHAR)
07223                 return NC_ECHAR;
07224 
07225 
07226         if(!IS_RECVAR(varp))
07227         {
07228                 return(getNCv_text(ncp, varp, coord_zero, *varp->dsizes, value));
07229         }
07230         /* else */
07231 
07232         if(varp->ndims == 1
07233                         && ncp->recsize <= varp->len)
07234         {
07235                 /* one dimensional && the only record variable  */
07236                 return(getNCv_text(ncp, varp, coord_zero, NC_get_numrecs(ncp),
07237                         value));
07238         }
07239         /* else */
07240 
07241         {
07242         ALLOC_ONSTACK(coord, size_t, varp->ndims);
07243         size_t elemsPerRec = 1;
07244         const size_t nrecs = NC_get_numrecs(ncp);
07245         (void) memset(coord, 0, varp->ndims * sizeof(size_t));
07246         /* TODO: fix dsizes to avoid this nonsense */
07247         if(varp->ndims > 1)
07248                 elemsPerRec = varp->dsizes[1];
07249         while(*coord < nrecs)
07250         {
07251                 const int lstatus = getNCv_text(ncp, varp, coord, elemsPerRec,
07252                                 value);
07253                 if(lstatus != NC_NOERR)
07254                 {
07255                         if(lstatus != NC_ERANGE)
07256                         {
07257                                 status = lstatus;
07258                                 /* fatal for the loop */
07259                                 break;
07260                         }
07261                         /* else NC_ERANGE, not fatal for the loop */
07262                         if(status == NC_NOERR)
07263                                 status = lstatus;
07264                 }
07265                 value += elemsPerRec;
07266                 (*coord)++;
07267         }
07268         FREE_ONSTACK(coord);
07269         } /* elemsPerRec */
07270 
07271         return status;
07272 }

int nc_get_var_uchar int  ncid,
int  varid,
uchar value
 

Definition at line 7276 of file putget.c.

07277 {
07278         int status = NC_NOERR;
07279         NC *ncp;
07280         const NC_var *varp;
07281 
07282         status = NC_check_id(ncid, &ncp); 
07283         if(status != NC_NOERR)
07284                 return status;
07285 
07286         if(NC_indef(ncp))
07287                 return NC_EINDEFINE;
07288 
07289         varp = NC_lookupvar(ncp, varid);
07290         if(varp == NULL)
07291                 return NC_ENOTVAR; /* TODO: lost NC_EGLOBAL */
07292 
07293         if(varp->ndims == 0) /* scalar variable */
07294         {
07295                 const size_t zed = 0;
07296                 return( getNCv_uchar(ncp, varp, &zed, 1, value) );
07297         }
07298 
07299         if(varp->type == NC_CHAR)
07300                 return NC_ECHAR;
07301 
07302 
07303         if(!IS_RECVAR(varp))
07304         {
07305                 return(getNCv_uchar(ncp, varp, coord_zero, *varp->dsizes, value));
07306         }
07307         /* else */
07308 
07309         if(varp->ndims == 1
07310                         && ncp->recsize <= varp->len)
07311         {
07312                 /* one dimensional && the only record variable  */
07313                 return(getNCv_uchar(ncp, varp, coord_zero, NC_get_numrecs(ncp),
07314                         value));
07315         }
07316         /* else */
07317 
07318         {
07319         ALLOC_ONSTACK(coord, size_t, varp->ndims);
07320         size_t elemsPerRec = 1;
07321         const size_t nrecs = NC_get_numrecs(ncp);
07322         (void) memset(coord, 0, varp->ndims * sizeof(size_t));
07323         /* TODO: fix dsizes to avoid this nonsense */
07324         if(varp->ndims > 1)
07325                 elemsPerRec = varp->dsizes[1];
07326         while(*coord < nrecs)
07327         {
07328                 const int lstatus = getNCv_uchar(ncp, varp, coord, elemsPerRec,
07329                                 value);
07330                 if(lstatus != NC_NOERR)
07331                 {
07332                         if(lstatus != NC_ERANGE)
07333                         {
07334                                 status = lstatus;
07335                                 /* fatal for the loop */
07336                                 break;
07337                         }
07338                         /* else NC_ERANGE, not fatal for the loop */
07339                         if(status == NC_NOERR)
07340                                 status = lstatus;
07341                 }
07342                 value += elemsPerRec;
07343                 (*coord)++;
07344         }
07345         FREE_ONSTACK(coord);
07346         } /* elemsPerRec */
07347 
07348         return status;
07349 }

int nc_get_vara int  ncid,
int  varid,
const size_t *  start,
const size_t *  edges,
void *  value
 

Definition at line 11264 of file putget.c.

11266 {
11267         int status;
11268         nc_type vartype;
11269 
11270         status = nc_inq_vartype(ncid, varid, &vartype); 
11271         if(status != NC_NOERR)
11272                 return status;
11273 
11274         switch(vartype){
11275         case NC_CHAR:
11276                 return nc_get_vara_text(ncid, varid, start, edges,
11277                         (char *) value);
11278         case NC_BYTE:
11279                 return nc_get_vara_schar(ncid, varid, start, edges,
11280                         (schar *) value);
11281         case NC_SHORT:
11282                 return nc_get_vara_short(ncid, varid, start, edges,
11283                         (short *) value);
11284         case NC_INT:
11285 #if (SIZEOF_INT >= X_SIZEOF_INT)
11286                 return nc_get_vara_int(ncid, varid, start, edges,
11287                         (int *) value);
11288 #elif SIZEOF_LONG == X_SIZEOF_INT
11289                 return nc_get_vara_long(ncid, varid, start, edges,
11290                         (long *) value);
11291 #else
11292 #error "nc_get_vara implementation"
11293 #endif
11294         case NC_FLOAT:
11295                 return nc_get_vara_float(ncid, varid, start, edges,
11296                         (float *) value);
11297         case NC_DOUBLE: 
11298                 return nc_get_vara_double(ncid, varid, start, edges,
11299                         (double *) value);
11300         }
11301         return NC_EBADTYPE;
11302 }

int nc_get_vara_double int  ncid,
int  varid,
const size_t *  start,
const size_t *  edges,
double *  value
 

Definition at line 6461 of file putget.c.

06463 {
06464         int status = NC_NOERR;
06465         NC *ncp;
06466         const NC_var *varp;
06467         int ii;
06468         size_t iocount;
06469 
06470         status = NC_check_id(ncid, &ncp); 
06471         if(status != NC_NOERR)
06472                 return status;
06473 
06474         if(NC_indef(ncp))
06475                 return NC_EINDEFINE;
06476 
06477         varp = NC_lookupvar(ncp, varid);
06478         if(varp == NULL)
06479                 return NC_ENOTVAR; /* TODO: lost NC_EGLOBAL */
06480 
06481         if(varp->type == NC_CHAR)
06482                 return NC_ECHAR;
06483 
06484         status = NCcoordck(ncp, varp, start);
06485         if(status != NC_NOERR)
06486                 return status;
06487         status = NCedgeck(ncp, varp, start, edges);
06488         if(status != NC_NOERR)
06489                 return status;
06490 
06491         if(varp->ndims == 0) /* scalar variable */
06492         {
06493                 return( getNCv_double(ncp, varp, start, 1, value) );
06494         }
06495 
06496         if(IS_RECVAR(varp))
06497         {
06498                 if(*start + *edges > NC_get_numrecs(ncp))
06499                         return NC_EEDGE;
06500                 if(varp->ndims == 1 && ncp->recsize <= varp->len)
06501                 {
06502                         /* one dimensional && the only record variable  */
06503                         return( getNCv_double(ncp, varp, start, *edges, value) );
06504                 }
06505         }
06506 
06507         /*
06508          * find max contiguous
06509          *   and accumulate max count for a single io operation
06510          */
06511         ii = NCiocount(ncp, varp, edges, &iocount);
06512 
06513         if(ii == -1)
06514         {
06515                 return( getNCv_double(ncp, varp, start, iocount, value) );
06516         }
06517 
06518         assert(ii >= 0);
06519 
06520 
06521         { /* inline */
06522         ALLOC_ONSTACK(coord, size_t, varp->ndims);
06523         ALLOC_ONSTACK(upper, size_t, varp->ndims);
06524         const size_t index = ii;
06525 
06526         /* copy in starting indices */
06527         (void) memcpy(coord, start, varp->ndims * sizeof(size_t));
06528 
06529         /* set up in maximum indices */
06530         set_upper(upper, start, edges, &upper[varp->ndims]);
06531 
06532         /* ripple counter */
06533         while(*coord < *upper)
06534         {
06535                 const int lstatus = getNCv_double(ncp, varp, coord, iocount,
06536                                 value);
06537                 if(lstatus != NC_NOERR)
06538                 {
06539                         if(lstatus != NC_ERANGE)
06540                         {
06541                                 status = lstatus;
06542                                 /* fatal for the loop */
06543                                 break;
06544                         }
06545                         /* else NC_ERANGE, not fatal for the loop */
06546                         if(status == NC_NOERR)
06547                                 status = lstatus;
06548                 }
06549                 value += iocount;
06550