Lines Matching defs: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);
216 ap->argchn.ap = (struct argnod*)r_tree(shp);
219 struct fornod *fp = (struct fornod*)getnode(shp->stk,fornod);
221 fp->fortre = r_tree(shp);
232 static struct ionod *r_redirect(Shell_t* shp)
238 iop = (struct ionod*)getnode(shp->stk,ionod);
244 iop->ioname = r_string(shp->stk);
245 if(iop->iodelim = r_string(shp->stk))
248 if(shp->heredocs)
249 iop->iooffset = sfseek(shp->heredocs,(off_t)0,SEEK_END);
252 shp->heredocs = sftmp(512);
255 sfmove(infile,shp->heredocs, iop->iosize, -1);
259 iop->iovname = r_string(shp->stk);
269 static void r_comarg(Shell_t *shp,struct comnod *com)
272 com->comio = r_redirect(shp);
273 com->comset = r_arg(shp);
277 com->comarg = r_arg(shp);
281 else if(com->comarg = (struct argnod*)r_comlist(shp))
288 com->comnamp = (void*)nv_search(cmdname,shp->fun_tree,0);
292 com->comnamp = (void*)nv_open(cmdname,shp->var_tree,NV_VARNAME|NV_NOADD|NV_NOARRAY);
300 static struct dolnod *r_comlist(Shell_t *shp)
307 dol = (struct dolnod*)stkalloc(shp->stk,sizeof(struct dolnod) + sizeof(char*)*(l+ARG_SPARE));
311 while(*argv++ = r_string(shp->stk));
316 static struct regnod *r_switch(Shell_t *shp)
322 reg = (struct regnod*)getnode(shp->stk,regnod);
328 reg->regptr = r_arg(shp);
329 reg->regcom = r_tree(shp);