Lines Matching refs:dp
53 static int read_tree(Namval_t* np, Sfio_t *iop, int n, Namfun_t *dp)
70 static Namval_t *create_tree(Namval_t *np,const char *name,int flag,Namfun_t *dp)
72 register Namfun_t *fp=dp;
79 dp->last = fp->last;
87 Namfun_t *dp;
90 dp = nv_clone_disc(fp,flags);
97 return(dp);
149 struct nvdir *save, *dp = new_of(struct nvdir,len+1);
152 if(!dp)
154 memset((void*)dp, 0, sizeof(*dp));
155 dp->data = (char*)(dp+1);
158 name = memcpy(dp->data,name,len);
159 dp->data[len] = 0;
160 dp->len = len;
161 dp->root = sh.last_root?sh.last_root:sh.var_tree;
165 dp->table = sh.last_table;
172 np = nv_open(name, dp->root, NV_NOFAIL);
176 dp->root = nv_dict(np);
180 dp->table = sh.last_table;
182 last = dp->data;
187 if(dp->hp = (Namval_t*)dtprev(dp->root,&fake))
189 char *cp = nv_name(dp->hp);
192 dp->hp = (Namval_t*)dtnext(dp->root,dp->hp);
195 np = dp->hp;
200 dp->hp = (Namval_t*)dtfirst(dp->root);
203 dp->hp = (Namval_t*)dtfirst(dp->root);
226 np = nv_search(last,dp->root,0);
230 if(np==dp->hp && !next)
231 dp->hp = (Namval_t*)dtnext(dp->root,dp->hp);
236 *save = *dp;
237 dp->prev = save;
239 dp->root = nv_dict(np);
241 dp->root = (Dt_t*)np;
244 dp->nextnode = nfp->disc->nextf;
245 dp->table = np;
246 dp->otable = sh.last_table;
247 dp->fun = nfp;
248 dp->hp = (*dp->nextnode)(np,(Dt_t*)0,nfp);
251 dp->nextnode = 0;
261 return((void*)dp);
265 static Namval_t *nextnode(struct nvdir *dp)
267 if(dp->nextnode)
268 return((*dp->nextnode)(dp->hp,dp->root,dp->fun));
269 if(dp->len && memcmp(dp->data, dp->hp->nvname, dp->len))
271 return((Namval_t*)dtnext(dp->root,dp->hp));
276 register struct nvdir *save, *dp = (struct nvdir*)dir;
283 while(np=dp->hp)
290 dp->hp = nextnode(dp);
295 if(dp->table && dp->otable && !nv_isattr(dp->table,NV_MINIMAL))
297 sptr = dp->table->nvenv;
298 dp->table->nvenv = (char*)dp->otable;
301 sh.last_table = dp->table;
304 if(dp->table && dp->otable && !nv_isattr(dp->table,NV_MINIMAL))
305 dp->table->nvenv = sptr;
307 if(dp->nextnode && !dp->hp && (nq = (Namval_t*)dp->table))
311 dp->hp = (*dp->nextnode)(np,(Dt_t*)0,dp->fun);
314 if(!dp->len || memcmp(cp,dp->data,dp->len)==0)
316 if((nfp=nextdisc(np)) && (nfp->disc->getval||nfp->disc->getnum) && nv_isvtree(np) && strcmp(cp,dp->data))
327 for(save=dp; save; save=save->prev)
337 *save = *dp;
338 dp->prev = save;
339 dp->root = root;
340 dp->len = len-1;
341 dp->data = (char*)(save+1);
342 memcpy(dp->data,cp,len+1);
350 dp->nextnode = nfp->disc->nextf;
351 dp->otable = dp->table;
352 dp->table = np;
353 dp->fun = nfp;
354 dp->hp = (*dp->nextnode)(np,(Dt_t*)0,nfp);
357 dp->nextnode = 0;
362 if(!(save=dp->prev))
364 *dp = *save;
372 struct nvdir *dp = (struct nvdir*)dir;
373 if(dp->prev)
374 nv_dirclose((void*)dp->prev);
1018 Dt_t *dp = shp->var_tree;
1031 shp->var_tree = dp;