/*-------------------------------------------------------------- Make text into data type path. BUILD_PATH(string) BUILD_EVENT(string) WARNING: BUILD_PATH and BUILD_EVENT should be called MAKE_xxx. */ int Tdi1BuildPath(int opcode, int narg, struct descriptor *list[], struct descriptor_xd *out_ptr) { int status = 1; struct descriptor_xd sig[1], uni[1], dat[1]; struct TdiCatStruct cats[2]; int cmode = 0; status = TdiGetArgs(opcode, narg, list, sig, uni, dat, cats); cats[1].out_dtype = cats[1].in_dtype; cats[1].out_cat = cats[1].in_cat; if (status & 1) status = TdiCvtArgs(narg, dat, cats); /********************************* Change from text to path or event. *********************************/ if (status & 1) { dat[0].pointer->dtype = TdiRefFunction[opcode].o1; status = MdsCopyDxXd((struct descriptor *)&dat[0], out_ptr); } if (status & 1) status = TdiMasterData(narg, sig, uni, &cmode, out_ptr); if (sig[0].pointer) MdsFree1Dx(&sig[0], NULL); if (uni[0].pointer) MdsFree1Dx(&uni[0], NULL); if (dat[0].pointer) MdsFree1Dx(&dat[0], NULL); return status; }
STATIC_CONSTANT char *cvsrev = "@(#)$RCSfile: TdiTrim.c,v $ $Revision: 1.5 $ $Date: 2009/08/24 19:43:11 $"; extern int TdiGetLong(); extern int TdiGetArgs(); extern int TdiCvtArgs(); extern int TdiMasterData(); TdiRefStandard(Tdi1Trim) struct descriptor_xd sig[1], uni[1], dat[1]; struct TdiCatStruct cats[2]; struct TdiFunctionStruct *fun_ptr = (struct TdiFunctionStruct *)&TdiRefFunction[opcode]; int j, cmode = -1; uni[0] = EMPTY_XD; status = TdiGetArgs(opcode, narg, list, sig, uni, dat, cats); if (status & 1) status = TdiCvtArgs(narg, dat, cats); if (status & 1 && narg > 0) { N_ELEMENTS(dat[0].pointer, j); if (status & 1 && j != 1) status = TdiINVCLADSC; } /*********************** Go off and do something. ***********************/ if (status & 1) status = (*fun_ptr->f3)(dat[0].pointer, out_ptr); if (status & 1) status = TdiMasterData(narg, sig, uni, &cmode, out_ptr); if (narg > 0) { if (sig[0].pointer) MdsFree1Dx(&sig[0], NULL); if (uni[0].pointer) MdsFree1Dx(&uni[0], NULL); if (dat[0].pointer) MdsFree1Dx(&dat[0], NULL); }
int Tdi1Decompress(int opcode, int narg, struct descriptor *list[], struct descriptor_xd *out_ptr) { int status = 1; struct descriptor_xd sig[4], uni[4], dat[4]; struct TdiCatStruct cats[5]; int cmode = -1, j, (*symbol) (); int bit = 0; status = TdiGetArgs(opcode, narg, list, sig, uni, dat, cats); if (status & 1) status = Tdi2Vector(narg - 2, &uni[2], &dat[2], &cats[2]); if (status & 1) { struct descriptor_a *pa = (struct descriptor_a *)dat[2].pointer; int nitems; if (pa->length <= 0) { switch (pa->dtype) { case DTYPE_B: case DTYPE_BU: pa->length = 1; break; case DTYPE_W: case DTYPE_WU: pa->length = 2; break; case DTYPE_L: case DTYPE_LU: case DTYPE_F: case DTYPE_FS: pa->length = 4; break; case DTYPE_D: case DTYPE_G: case DTYPE_FT: case DTYPE_Q: case DTYPE_QU: pa->length = 8; break; case DTYPE_O: case DTYPE_OU: pa->length = 16; break; default: return TdiINVDTYDSC; } } nitems = (int)pa->arsize / (int)pa->length; if (cats[1].in_dtype == DTYPE_MISSING) symbol = MdsXpand; else status = TdiFindImageSymbol(dat[0].pointer, dat[1].pointer, &symbol); if (status & 1) status = MdsGet1DxA(pa, &pa->length, &pa->dtype, out_ptr); if (status & 1) { out_ptr->pointer->class = CLASS_A; status = (*symbol) (&nitems, dat[3].pointer, out_ptr->pointer, &bit); } }