1 #include "csf.h" 2 #include "csfimpl.h" 3 4 /* set a memory location to a missing value 5 * SetMV sets a memory location to a missing value 6 * (using the application cell representation). 7 * SetMV is quite slow but handy as in the example 8 * below. In general one should use assignment for 9 * integers (e.g. v = MV_UINT1) or the macro's 10 * SET_MV_REAL4 and SET_MV_REAL8 11 * 12 * EXAMPLE 13 * .so examples/border.tr 14 */ SetMV(const MAP * m,void * c)15void SetMV( 16 const MAP *m, /* map handle */ 17 void *c) /* write-only. location set to missing value */ 18 { 19 SetMVcellRepr(m->appCR, c); 20 } 21 22 /* set a memory location to a missing value 23 * SetMVcellRepr sets a memory location to a missing value 24 * (using the application cell representation). 25 * In general one should use assignment for 26 * integers (e.g. v = MV_UINT1) or the macro's 27 * SET_MV_REAL4 and SET_MV_REAL8 28 * 29 */ SetMVcellRepr(CSF_CR cellRepr,void * c)30void SetMVcellRepr( 31 CSF_CR cellRepr, /* cell representation, one of the CR_* constants */ 32 void *c) /* write-only. location set to missing value */ 33 { 34 switch (cellRepr) 35 { 36 case CR_INT1 : *((INT1 *)c) = MV_INT1; 37 break; 38 case CR_INT2 : *((INT2 *)c) = MV_INT2; 39 break; 40 case CR_INT4 : *((INT4 *)c) = MV_INT4; 41 break; 42 case CR_UINT1 : *((UINT1 *)c) = MV_UINT1; 43 break; 44 case CR_UINT2 : *((UINT2 *)c) = MV_UINT2; 45 break; 46 case CR_REAL8 : 47 ((UINT4 *)c)[1] = MV_UINT4; 48 *((UINT4 *)c) = MV_UINT4; 49 break; 50 default : POSTCOND( 51 cellRepr == CR_REAL4 || 52 cellRepr == CR_UINT4 ); 53 *((UINT4 *)c) = MV_UINT4; 54 } 55 } 56