Lines Matching refs:shp

47 Shnode_t *sh_trestore(Shell_t *shp,Sfio_t *in)
51 t = r_tree(shp);
57 static Shnode_t *r_tree(Shell_t *shp)
69 t = getnode(shp->stk,parnod);
70 t->par.partre = r_tree(shp);
73 t = getnode(shp->stk,comnod);
75 r_comarg(shp,(struct comnod*)t);
79 t = getnode(shp->stk,forknod);
81 t->fork.forktre = r_tree(shp);
82 t->fork.forkio = r_redirect(shp);
85 t = getnode(shp->stk,ifnod);
86 t->if_.iftre = r_tree(shp);
87 t->if_.thtre = r_tree(shp);
88 t->if_.eltre = r_tree(shp);
91 t = getnode(shp->stk,whnod);
92 t->wh.whinc = (struct arithnod*)r_tree(shp);
93 t->wh.whtre = r_tree(shp);
94 t->wh.dotre = r_tree(shp);
100 t = getnode(shp->stk,lstnod);
101 t->lst.lstlef = r_tree(shp);
102 t->lst.lstrit = r_tree(shp);
105 t = getnode(shp->stk,arithnod);
107 t->ar.arexpr = r_arg(shp);
110 t->ar.arcomp = sh_arithcomp(shp,(t->ar.arexpr)->argval);
113 t = getnode(shp->stk,fornod);
117 t->for_.fortre = r_tree(shp);
118 t->for_.fornam = r_string(shp->stk);
119 t->for_.forlst = (struct comnod*)r_tree(shp);
122 t = getnode(shp->stk,swnod);
126 t->sw.swarg = r_arg(shp);
128 t->sw.swio = r_redirect(shp);
131 t->sw.swlst = r_switch(shp);
138 t = getnode(shp->stk,functnod);
141 t->funct.functnam = r_string(shp->stk);
144 slp = (struct slnod*)stkalloc(shp->stk,sizeof(struct slnod)+sizeof(struct functnod));
146 slp->slnext = shp->st.staklist;
147 shp->st.staklist = 0;
151 if(shp->st.filename)
152 fp->functnam = stkcopy(shp->stk,shp->st.filename);
153 t->funct.functtre = r_tree(shp);
155 t->funct.functargs = (struct comnod*)r_tree(shp);
157 slp->slchild = shp->st.staklist;
161 t = getnode(shp->stk,tstnod);
164 t->lst.lstlef = r_tree(shp);
167 t->lst.lstlef = (Shnode_t*)r_arg(shp);
169 t->lst.lstrit = (Shnode_t*)r_arg(shp);
177 static struct argnod *r_arg(Shell_t *shp)
181 Stk_t *stkp=shp->stk;
201 sh_endword(shp,1);
204 ap = sh_endword(shp,0);
217 struct fornod *fp = (struct fornod*)getnode(shp->stk,fornod);
219 fp->fortre = r_tree(shp);
230 static struct ionod *r_redirect(Shell_t* shp)
236 iop = (struct ionod*)getnode(shp->stk,ionod);
242 iop->ioname = r_string(shp->stk);
243 if(iop->iodelim = r_string(shp->stk))
246 if(shp->heredocs)
247 iop->iooffset = sfseek(shp->heredocs,(off_t)0,SEEK_END);
250 shp->heredocs = sftmp(512);
253 sfmove(infile,shp->heredocs, iop->iosize, -1);
257 iop->iovname = r_string(shp->stk);
267 static void r_comarg(Shell_t *shp,struct comnod *com)
270 com->comio = r_redirect(shp);
271 com->comset = r_arg(shp);
275 com->comarg = r_arg(shp);
279 else if(com->comarg = (struct argnod*)r_comlist(shp))
286 com->comnamp = (void*)nv_search(cmdname,shp->fun_tree,0);
290 com->comnamp = (void*)nv_open(cmdname,shp->var_tree,NV_VARNAME|NV_NOADD|NV_NOARRAY);
298 static struct dolnod *r_comlist(Shell_t *shp)
305 dol = (struct dolnod*)stkalloc(shp->stk,sizeof(struct dolnod) + sizeof(char*)*(l+ARG_SPARE));
309 while(*argv++ = r_string(shp->stk));
314 static struct regnod *r_switch(Shell_t *shp)
320 reg = (struct regnod*)getnode(shp->stk,regnod);
326 reg->regptr = r_arg(shp);
327 reg->regcom = r_tree(shp);