📄 ncx.c
字号:
#ifdef WORDS_BIGENDIAN (void) memcpy(*xpp, tp, nelems * X_SIZEOF_SHORT);# else swapn2b(*xpp, tp, nelems);# endif *xpp = (void *)((char *)(*xpp) + nelems * X_SIZEOF_SHORT); return ENOERR;}#elseintncx_putn_short_short(void **xpp, size_t nelems, const short *tp){ char *xp = (char *) *xpp; int status = ENOERR; for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++) { int lstatus = ncx_put_short_short(xp, tp); if(lstatus != ENOERR) status = lstatus; } *xpp = (void *)xp; return status;}#endifintncx_putn_short_int(void **xpp, size_t nelems, const int *tp){ char *xp = (char *) *xpp; int status = ENOERR; for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++) { int lstatus = ncx_put_short_int(xp, tp); if(lstatus != ENOERR) status = lstatus; } *xpp = (void *)xp; return status;}intncx_putn_short_long(void **xpp, size_t nelems, const long *tp){ char *xp = (char *) *xpp; int status = ENOERR; for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++) { int lstatus = ncx_put_short_long(xp, tp); if(lstatus != ENOERR) status = lstatus; } *xpp = (void *)xp; return status;}intncx_putn_short_float(void **xpp, size_t nelems, const float *tp){ char *xp = (char *) *xpp; int status = ENOERR; for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++) { int lstatus = ncx_put_short_float(xp, tp); if(lstatus != ENOERR) status = lstatus; } *xpp = (void *)xp; return status;}intncx_putn_short_double(void **xpp, size_t nelems, const double *tp){ char *xp = (char *) *xpp; int status = ENOERR; for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++) { int lstatus = ncx_put_short_double(xp, tp); if(lstatus != ENOERR) status = lstatus; } *xpp = (void *)xp; return status;}intncx_pad_putn_short_schar(void **xpp, size_t nelems, const schar *tp){ const size_t rndup = nelems % 2; char *xp = (char *) *xpp; int status = ENOERR; for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++) { int lstatus = ncx_put_short_schar(xp, tp); if(lstatus != ENOERR) status = lstatus; } if(rndup != 0) { (void) memcpy(xp, nada, X_SIZEOF_SHORT); xp += X_SIZEOF_SHORT; } *xpp = (void *)xp; return status;}intncx_pad_putn_short_uchar(void **xpp, size_t nelems, const uchar *tp){ const size_t rndup = nelems % 2; char *xp = (char *) *xpp; int status = ENOERR; for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++) { int lstatus = ncx_put_short_uchar(xp, tp); if(lstatus != ENOERR) status = lstatus; } if(rndup != 0) { (void) memcpy(xp, nada, X_SIZEOF_SHORT); xp += X_SIZEOF_SHORT; } *xpp = (void *)xp; return status;}intncx_pad_putn_short_short(void **xpp, size_t nelems, const short *tp){ const size_t rndup = nelems % 2; char *xp = (char *) *xpp; int status = ENOERR; for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++) { int lstatus = ncx_put_short_short(xp, tp); if(lstatus != ENOERR) status = lstatus; } if(rndup != 0) { (void) memcpy(xp, nada, X_SIZEOF_SHORT); xp += X_SIZEOF_SHORT; } *xpp = (void *)xp; return status;}intncx_pad_putn_short_int(void **xpp, size_t nelems, const int *tp){ const size_t rndup = nelems % 2; char *xp = (char *) *xpp; int status = ENOERR; for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++) { int lstatus = ncx_put_short_int(xp, tp); if(lstatus != ENOERR) status = lstatus; } if(rndup != 0) { (void) memcpy(xp, nada, X_SIZEOF_SHORT); xp += X_SIZEOF_SHORT; } *xpp = (void *)xp; return status;}intncx_pad_putn_short_long(void **xpp, size_t nelems, const long *tp){ const size_t rndup = nelems % 2; char *xp = (char *) *xpp; int status = ENOERR; for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++) { int lstatus = ncx_put_short_long(xp, tp); if(lstatus != ENOERR) status = lstatus; } if(rndup != 0) { (void) memcpy(xp, nada, X_SIZEOF_SHORT); xp += X_SIZEOF_SHORT; } *xpp = (void *)xp; return status;}intncx_pad_putn_short_float(void **xpp, size_t nelems, const float *tp){ const size_t rndup = nelems % 2; char *xp = (char *) *xpp; int status = ENOERR; for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++) { int lstatus = ncx_put_short_float(xp, tp); if(lstatus != ENOERR) status = lstatus; } if(rndup != 0) { (void) memcpy(xp, nada, X_SIZEOF_SHORT); xp += X_SIZEOF_SHORT; } *xpp = (void *)xp; return status;}intncx_pad_putn_short_double(void **xpp, size_t nelems, const double *tp){ const size_t rndup = nelems % 2; char *xp = (char *) *xpp; int status = ENOERR; for( ; nelems != 0; nelems--, xp += X_SIZEOF_SHORT, tp++) { int lstatus = ncx_put_short_double(xp, tp); if(lstatus != ENOERR) status = lstatus; } if(rndup != 0) { (void) memcpy(xp, nada, X_SIZEOF_SHORT); xp += X_SIZEOF_SHORT; } *xpp = (void *)xp; return status;}/* int */intncx_getn_int_schar(const void **xpp, size_t nelems, schar *tp){ const char *xp = (const char *) *xpp; int status = ENOERR; for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++) { const int lstatus = ncx_get_int_schar(xp, tp); if(lstatus != ENOERR) status = lstatus; } *xpp = (const void *)xp; return status;}intncx_getn_int_uchar(const void **xpp, size_t nelems, uchar *tp){ const char *xp = (const char *) *xpp; int status = ENOERR; for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++) { const int lstatus = ncx_get_int_uchar(xp, tp); if(lstatus != ENOERR) status = lstatus; } *xpp = (const void *)xp; return status;}intncx_getn_int_short(const void **xpp, size_t nelems, short *tp){ const char *xp = (const char *) *xpp; int status = ENOERR; for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++) { const int lstatus = ncx_get_int_short(xp, tp); if(lstatus != ENOERR) status = lstatus; } *xpp = (const void *)xp; return status;}#if X_SIZEOF_INT == SIZEOF_INT/* optimized version */intncx_getn_int_int(const void **xpp, size_t nelems, int *tp){#ifdef WORDS_BIGENDIAN (void) memcpy(tp, *xpp, nelems * sizeof(int));# else swapn4b(tp, *xpp, nelems);# endif *xpp = (const void *)((const char *)(*xpp) + nelems * X_SIZEOF_INT); return ENOERR;}#elseintncx_getn_int_int(const void **xpp, size_t nelems, int *tp){ const char *xp = (const char *) *xpp; int status = ENOERR; for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++) { const int lstatus = ncx_get_int_int(xp, tp); if(lstatus != ENOERR) status = lstatus; } *xpp = (const void *)xp; return status;}#endif#if X_SIZEOF_INT == SIZEOF_LONG/* optimized version */intncx_getn_int_long(const void **xpp, size_t nelems, long *tp){#ifdef WORDS_BIGENDIAN (void) memcpy(tp, *xpp, nelems * sizeof(long));# else swapn4b(tp, *xpp, nelems);# endif *xpp = (const void *)((const char *)(*xpp) + nelems * X_SIZEOF_INT); return ENOERR;}#elseintncx_getn_int_long(const void **xpp, size_t nelems, long *tp){ const char *xp = (const char *) *xpp; int status = ENOERR; for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++) { const int lstatus = ncx_get_int_long(xp, tp); if(lstatus != ENOERR) status = lstatus; } *xpp = (const void *)xp; return status;}#endifintncx_getn_int_float(const void **xpp, size_t nelems, float *tp){ const char *xp = (const char *) *xpp; int status = ENOERR; for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++) { const int lstatus = ncx_get_int_float(xp, tp); if(lstatus != ENOERR) status = lstatus; } *xpp = (const void *)xp; return status;}intncx_getn_int_double(const void **xpp, size_t nelems, double *tp){ const char *xp = (const char *) *xpp; int status = ENOERR; for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++) { const int lstatus = ncx_get_int_double(xp, tp); if(lstatus != ENOERR) status = lstatus; } *xpp = (const void *)xp; return status;}intncx_putn_int_schar(void **xpp, size_t nelems, const schar *tp){ char *xp = (char *) *xpp; int status = ENOERR; for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++) { int lstatus = ncx_put_int_schar(xp, tp); if(lstatus != ENOERR) status = lstatus; } *xpp = (void *)xp; return status;}intncx_putn_int_uchar(void **xpp, size_t nelems, const uchar *tp){ char *xp = (char *) *xpp; int status = ENOERR; for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++) { int lstatus = ncx_put_int_uchar(xp, tp); if(lstatus != ENOERR) status = lstatus; } *xpp = (void *)xp; return status;}intncx_putn_int_short(void **xpp, size_t nelems, const short *tp){ char *xp = (char *) *xpp; int status = ENOERR; for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++) { int lstatus = ncx_put_int_short(xp, tp); if(lstatus != ENOERR) status = lstatus; } *xpp = (void *)xp; return status;}#if X_SIZEOF_INT == SIZEOF_INT/* optimized version */intncx_putn_int_int(void **xpp, size_t nelems, const int *tp){#ifdef WORDS_BIGENDIAN (void) memcpy(*xpp, tp, nelems * X_SIZEOF_INT);# else swapn4b(*xpp, tp, nelems);# endif *xpp = (void *)((char *)(*xpp) + nelems * X_SIZEOF_INT); return ENOERR;}#elseintncx_putn_int_int(void **xpp, size_t nelems, const int *tp){ char *xp = (char *) *xpp; int status = ENOERR; for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++) { int lstatus = ncx_put_int_int(xp, tp); if(lstatus != ENOERR) status = lstatus; } *xpp = (void *)xp; return status;}#endif#if X_SIZEOF_INT == SIZEOF_LONG/* optimized version */intncx_putn_int_long(void **xpp, size_t nelems, const long *tp){#ifdef WORDS_BIGENDIAN (void) memcpy(*xpp, tp, nelems * X_SIZEOF_INT);# else swapn4b(*xpp, tp, nelems);# endif *xpp = (void *)((char *)(*xpp) + nelems * X_SIZEOF_INT); return ENOERR;}#elseintncx_putn_int_long(void **xpp, size_t nelems, const long *tp){ char *xp = (char *) *xpp; int status = ENOERR; for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++) { int lstatus = ncx_put_int_long(xp, tp); if(lstatus != ENOERR) status = lstatus; } *xpp = (void *)xp; return status;}#endifintncx_putn_int_float(void **xpp, size_t nelems, const float *tp){ char *xp = (char *) *xpp; int status = ENOERR; for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++) { int lstatus = ncx_put_int_float(xp, tp); if(lstatus != ENOERR) status = lstatus; } *xpp = (void *)xp; return status;}intncx_putn_int_double(void **xpp, size_t nelems, const double *tp){ char *xp = (char *) *xpp; int status = ENOERR; for( ; nelems != 0; nelems--, xp += X_SIZEOF_INT, tp++) { int lstatus = ncx_put_int_double(xp, tp); if(lstatus != ENOERR) status = lstatus; } *xpp = (void *)xp; return status;}/* float */intncx_getn_float_schar(const void **xpp, size_t nelems, schar *tp){ const char *xp = (const char *) *xpp; int status = ENOERR; for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++) { const int lstatus = ncx_get_float_schar(xp, tp); if(lstatus != ENOERR) status = lstatus; } *xpp = (const void *)xp; return status;}intncx_getn_float_uchar(const void **xpp, size_t nelems, uchar *tp){ const char *xp = (const char *) *xpp; int status = ENOERR; for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++) { const int lstatus = ncx_get_float_uchar(xp, tp); if(lstatus != ENOERR) status = lstatus; } *xpp = (const void *)xp; return status;}intncx_getn_float_short(const void **xpp, size_t nelems, short *tp){ const char *xp = (const char *) *xpp; int status = ENOERR; for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++) { const int lstatus = ncx_get_float_short(xp, tp); if(lstatus != ENOERR) status = lstatus; } *xpp = (const void *)xp; return status;}intncx_getn_float_int(const void **xpp, size_t nelems, int *tp){ const char *xp = (const char *) *xpp; int status = ENOERR; for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++) { const int lstatus = ncx_get_float_int(xp, tp); if(lstatus != ENOERR) status = lstatus; } *xpp = (const void *)xp; return status;}intncx_getn_float_long(const void **xpp, size_t nelems, long *tp){ const char *xp = (const char *) *xpp; int status = ENOERR; for( ; nelems != 0; nelems--, xp += X_SIZEOF_FLOAT, tp++) { const int lstatus = ncx_get_float_long(xp, tp); if(lstatus != ENOERR) status = lstatus; } *xpp = (const void *)xp; return status;}#if X_SIZEOF_FLOAT == SIZEOF_FLOAT && !defined(NO_IEEE_FLOAT)/* optimized version */intncx_getn_float_float(const void **xpp, size_t nelems, float *tp){#ifdef WORDS_BIGENDIAN (void) memcpy(tp, *xpp, nelems * sizeof(float));# else swapn4b(tp, *xpp, nelems);# endif *xpp = (const void *)((const char *)(*xpp) + nelems * X_SIZEOF_FLOAT); return ENOERR;}#elif vaxintncx_getn_float_float(const void **xpp, size_t nfloats, float *ip){ float *const end = ip + nfloats; while(ip < end) { struct vax_single *const vsp = (struct vax_single *) ip; const struct ieee_single *const isp = (const struct ieee_single *) (*xpp); unsigned exp = isp->exp_hi << 1 | isp->exp_lo; switch(exp) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -