int pkg_dispack(void *net_struct,char *buf,T_PkgType *pkg_type,char delimit) { char *cp; register char *cp1; char dml[2]; T_PkgType *typ; *dml=delimit; dml[1]=0; cp=buf; if(!cp||!*cp) return 0; if(pkg_type->offset<0) set_offset(pkg_type); for(typ=pkg_type;typ->type>-1;typ++){ if(typ->bindtype&NOSELECT) continue; if(typ->type==CH_STRUCT) { cp+=pkg_dispack((char *)net_struct+typ->offset,cp,(T_PkgType *)typ->format,delimit); continue; } cp1=cp; cp=stptok(cp,0,0,dml); if(*cp==delimit) *cp++=0; put_str_one(net_struct,cp1,typ,delimit); if(!*cp) break; } return (cp-buf); }
int putitem_idx(void *buf,char *cp,T_PkgType *pkg_type,const char *key,const char *colidx,int colnum) { int k; if(pkg_type->offset<0) set_offset(pkg_type); k=index_col(colidx,colnum,key,pkg_type); if(k<0) return 0; k=put_str_one(buf,cp,pkg_type+k,0); return k; }
int putOne(char *buf,T_PkgType *tpl) { return put_str_one(dau.srm.rec,buf,tpl,0); }