📄 putget.c
字号:
return NC_NOERR; assert(value != NULL); for(;;) { size_t extent = MIN(remaining, ncp->chunk); size_t nput = ncx_howmany(varp->type, extent); int lstatus = ncp->nciop->get(ncp->nciop, offset, extent, RGN_WRITE, &xp); if(lstatus != NC_NOERR) return lstatus; lstatus = ncx_putn_float_int(&xp, nput, value); if(lstatus != NC_NOERR && status == NC_NOERR) { /* not fatal to the loop */ status = lstatus; } (void) ncp->nciop->rel(ncp->nciop, offset, RGN_MODIFIED); remaining -= extent; if(remaining == 0) break; /* normal loop exit */ offset += extent; value += nput; } return status;}static intputNCvx_float_long(NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, const long *value){ off_t offset = NC_varoffset(ncp, varp, start); size_t remaining = varp->xsz * nelems; int status = NC_NOERR; void *xp; if(nelems == 0) return NC_NOERR; assert(value != NULL); for(;;) { size_t extent = MIN(remaining, ncp->chunk); size_t nput = ncx_howmany(varp->type, extent); int lstatus = ncp->nciop->get(ncp->nciop, offset, extent, RGN_WRITE, &xp); if(lstatus != NC_NOERR) return lstatus; lstatus = ncx_putn_float_long(&xp, nput, value); if(lstatus != NC_NOERR && status == NC_NOERR) { /* not fatal to the loop */ status = lstatus; } (void) ncp->nciop->rel(ncp->nciop, offset, RGN_MODIFIED); remaining -= extent; if(remaining == 0) break; /* normal loop exit */ offset += extent; value += nput; } return status;}static intputNCvx_float_float(NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, const float *value){ off_t offset = NC_varoffset(ncp, varp, start); size_t remaining = varp->xsz * nelems; int status = NC_NOERR; void *xp; if(nelems == 0) return NC_NOERR; assert(value != NULL); for(;;) { size_t extent = MIN(remaining, ncp->chunk); size_t nput = ncx_howmany(varp->type, extent); int lstatus = ncp->nciop->get(ncp->nciop, offset, extent, RGN_WRITE, &xp); if(lstatus != NC_NOERR) return lstatus; lstatus = ncx_putn_float_float(&xp, nput, value); if(lstatus != NC_NOERR && status == NC_NOERR) { /* not fatal to the loop */ status = lstatus; } (void) ncp->nciop->rel(ncp->nciop, offset, RGN_MODIFIED); remaining -= extent; if(remaining == 0) break; /* normal loop exit */ offset += extent; value += nput; } return status;}static intputNCvx_float_double(NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, const double *value){ off_t offset = NC_varoffset(ncp, varp, start); size_t remaining = varp->xsz * nelems; int status = NC_NOERR; void *xp; if(nelems == 0) return NC_NOERR; assert(value != NULL); for(;;) { size_t extent = MIN(remaining, ncp->chunk); size_t nput = ncx_howmany(varp->type, extent); int lstatus = ncp->nciop->get(ncp->nciop, offset, extent, RGN_WRITE, &xp); if(lstatus != NC_NOERR) return lstatus; lstatus = ncx_putn_float_double(&xp, nput, value); if(lstatus != NC_NOERR && status == NC_NOERR) { /* not fatal to the loop */ status = lstatus; } (void) ncp->nciop->rel(ncp->nciop, offset, RGN_MODIFIED); remaining -= extent; if(remaining == 0) break; /* normal loop exit */ offset += extent; value += nput; } return status;}static intputNCvx_double_schar(NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, const schar *value){ off_t offset = NC_varoffset(ncp, varp, start); size_t remaining = varp->xsz * nelems; int status = NC_NOERR; void *xp; if(nelems == 0) return NC_NOERR; assert(value != NULL); for(;;) { size_t extent = MIN(remaining, ncp->chunk); size_t nput = ncx_howmany(varp->type, extent); int lstatus = ncp->nciop->get(ncp->nciop, offset, extent, RGN_WRITE, &xp); if(lstatus != NC_NOERR) return lstatus; lstatus = ncx_putn_double_schar(&xp, nput, value); if(lstatus != NC_NOERR && status == NC_NOERR) { /* not fatal to the loop */ status = lstatus; } (void) ncp->nciop->rel(ncp->nciop, offset, RGN_MODIFIED); remaining -= extent; if(remaining == 0) break; /* normal loop exit */ offset += extent; value += nput; } return status;}static intputNCvx_double_uchar(NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, const uchar *value){ off_t offset = NC_varoffset(ncp, varp, start); size_t remaining = varp->xsz * nelems; int status = NC_NOERR; void *xp; if(nelems == 0) return NC_NOERR; assert(value != NULL); for(;;) { size_t extent = MIN(remaining, ncp->chunk); size_t nput = ncx_howmany(varp->type, extent); int lstatus = ncp->nciop->get(ncp->nciop, offset, extent, RGN_WRITE, &xp); if(lstatus != NC_NOERR) return lstatus; lstatus = ncx_putn_double_uchar(&xp, nput, value); if(lstatus != NC_NOERR && status == NC_NOERR) { /* not fatal to the loop */ status = lstatus; } (void) ncp->nciop->rel(ncp->nciop, offset, RGN_MODIFIED); remaining -= extent; if(remaining == 0) break; /* normal loop exit */ offset += extent; value += nput; } return status;}static intputNCvx_double_short(NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, const short *value){ off_t offset = NC_varoffset(ncp, varp, start); size_t remaining = varp->xsz * nelems; int status = NC_NOERR; void *xp; if(nelems == 0) return NC_NOERR; assert(value != NULL); for(;;) { size_t extent = MIN(remaining, ncp->chunk); size_t nput = ncx_howmany(varp->type, extent); int lstatus = ncp->nciop->get(ncp->nciop, offset, extent, RGN_WRITE, &xp); if(lstatus != NC_NOERR) return lstatus; lstatus = ncx_putn_double_short(&xp, nput, value); if(lstatus != NC_NOERR && status == NC_NOERR) { /* not fatal to the loop */ status = lstatus; } (void) ncp->nciop->rel(ncp->nciop, offset, RGN_MODIFIED); remaining -= extent; if(remaining == 0) break; /* normal loop exit */ offset += extent; value += nput; } return status;}static intputNCvx_double_int(NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, const int *value){ off_t offset = NC_varoffset(ncp, varp, start); size_t remaining = varp->xsz * nelems; int status = NC_NOERR; void *xp; if(nelems == 0) return NC_NOERR; assert(value != NULL); for(;;) { size_t extent = MIN(remaining, ncp->chunk); size_t nput = ncx_howmany(varp->type, extent); int lstatus = ncp->nciop->get(ncp->nciop, offset, extent, RGN_WRITE, &xp); if(lstatus != NC_NOERR) return lstatus; lstatus = ncx_putn_double_int(&xp, nput, value); if(lstatus != NC_NOERR && status == NC_NOERR) { /* not fatal to the loop */ status = lstatus; } (void) ncp->nciop->rel(ncp->nciop, offset, RGN_MODIFIED); remaining -= extent; if(remaining == 0) break; /* normal loop exit */ offset += extent; value += nput; } return status;}static intputNCvx_double_long(NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, const long *value){ off_t offset = NC_varoffset(ncp, varp, start); size_t remaining = varp->xsz * nelems; int status = NC_NOERR; void *xp; if(nelems == 0) return NC_NOERR; assert(value != NULL); for(;;) { size_t extent = MIN(remaining, ncp->chunk); size_t nput = ncx_howmany(varp->type, extent); int lstatus = ncp->nciop->get(ncp->nciop, offset, extent, RGN_WRITE, &xp); if(lstatus != NC_NOERR) return lstatus; lstatus = ncx_putn_double_long(&xp, nput, value); if(lstatus != NC_NOERR && status == NC_NOERR) { /* not fatal to the loop */ status = lstatus; } (void) ncp->nciop->rel(ncp->nciop, offset, RGN_MODIFIED); remaining -= extent; if(remaining == 0) break; /* normal loop exit */ offset += extent; value += nput; } return status;}static intputNCvx_double_float(NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, const float *value){ off_t offset = NC_varoffset(ncp, varp, start); size_t remaining = varp->xsz * nelems; int status = NC_NOERR; void *xp; if(nelems == 0) return NC_NOERR; assert(value != NULL); for(;;) { size_t extent = MIN(remaining, ncp->chunk); size_t nput = ncx_howmany(varp->type, extent); int lstatus = ncp->nciop->get(ncp->nciop, offset, extent, RGN_WRITE, &xp); if(lstatus != NC_NOERR) return lstatus; lstatus = ncx_putn_double_float(&xp, nput, value); if(lstatus != NC_NOERR && status == NC_NOERR) { /* not fatal to the loop */ status = lstatus; } (void) ncp->nciop->rel(ncp->nciop, offset, RGN_MODIFIED); remaining -= extent; if(remaining == 0) break; /* normal loop exit */ offset += extent; value += nput; } return status;}static intputNCvx_double_double(NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, const double *value){ off_t offset = NC_varoffset(ncp, varp, start); size_t remaining = varp->xsz * nelems; int status = NC_NOERR; void *xp; if(nelems == 0) return NC_NOERR; assert(value != NULL); for(;;) { size_t extent = MIN(remaining, ncp->chunk); size_t nput = ncx_howmany(varp->type, extent); int lstatus = ncp->nciop->get(ncp->nciop, offset, extent, RGN_WRITE, &xp); if(lstatus != NC_NOERR) return lstatus; lstatus = ncx_putn_double_double(&xp, nput, value); if(lstatus != NC_NOERR && status == NC_NOERR) { /* not fatal to the loop */ status = lstatus; } (void) ncp->nciop->rel(ncp->nciop, offset, RGN_MODIFIED); remaining -= extent; if(remaining == 0) break; /* normal loop exit */ offset += extent; value += nput; } return status;}static intputNCv_text(NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, const char *value){ if(varp->type != NC_CHAR) return NC_ECHAR; return putNCvx_char_char(ncp, varp, start, nelems, value);}static intputNCv_schar(NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, const schar *value){ switch(varp->type){ case NC_CHAR: return NC_ECHAR; case NC_BYTE: return putNCvx_schar_schar(ncp, varp, start, nelems, value); case NC_SHORT: return putNCvx_short_schar(ncp, varp, start, nelems, value); case NC_INT: return putNCvx_int_schar(ncp, varp, start, nelems, value); case NC_FLOAT: return putNCvx_float_schar(ncp, varp, start, nelems, value); case NC_DOUBLE: return putNCvx_double_schar(ncp, varp, start, nelems, value); } return NC_EBADTYPE;}static intputNCv_uchar(NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, const uchar *value){ switch(varp->type){ case NC_CHAR: return NC_ECHAR; case NC_BYTE: return putNCvx_schar_uchar(ncp, varp, start, nelems, value); case NC_SHORT: return putNCvx_short_uchar(ncp, varp, start, nelems, value); case NC_INT: return putNCvx_int_uchar(ncp, varp, start, nelems, value); case NC_FLOAT: return putNCvx_float_uchar(ncp, varp, start, nelems, value); case NC_DOUBLE: return putNCvx_double_uchar(ncp, varp, start, nelems, value); } return NC_EBADTYPE;}static intputNCv_short(NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, const short *value){ switch(varp->type){ case NC_CHAR: return NC_ECHAR; case NC_BYTE: return putNCvx_schar_short(ncp, varp, start, nelems, value); case NC_SHORT: return putNCvx_short_short(ncp, varp, start, nelems, value); case NC_INT: return putNCvx_int_short(ncp, varp, start, nelems, value); case NC_FLOAT: return putNCvx_float_short(ncp, varp, start, nelems, value); case NC_DOUBLE: return putNCvx_double_short(ncp, varp, start, nelems, value); } return NC_EBADTYPE;}static intputNCv_int(NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, const int *value){ switch(varp->type){ case NC_CHAR: return NC_ECHAR; case NC_BYTE: return putNCvx_schar_int(ncp, varp, start, nelems, value); case NC_SHORT: return putNCvx_short_int(ncp, varp, start, nelems, value); case NC_INT: return putNCvx_int_int(ncp, varp, start, nelems, value); case NC_FLOAT: return putNCvx_float_int(ncp, varp, start, nelems, value); case NC_DOUBLE: return putNCvx_double_int(ncp, varp, start, nelems, value); } return NC_EBADTYPE;}static intputNCv_long(NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, const long *value){ switch(varp->type){ case NC_CHAR: return NC_ECHAR; case NC_BYTE: return putNCvx_schar_long(ncp, varp, start, nelems, value); case NC_SHORT: return putNCvx_short_long(ncp, varp, start, nelems, value); case NC_INT: return putNCvx_int_long(ncp, varp, start, nelems, value); case NC_FLOAT: return putNCvx_float_long(ncp, varp, start, nelems, value); case NC_DOUBLE: return putNCvx_double_long(ncp, varp, start, nelems, value); } return NC_EBADTYPE;}static intputNCv_float(NC *ncp, const NC_var *varp, const size_t *start, size_t nelems, const float *value){
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -