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);
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);
156 slp->slchild = shp->st.staklist;
157 t->funct.functargs = (struct comnod*)r_tree(shp);
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;
200 ap = sh_endword(shp,1);
203 ap = sh_endword(shp,0);
215 struct fornod *fp = (struct fornod*)getnode(shp->stk,fornod);
217 fp->fortre = r_tree(shp);
228 static struct ionod *r_redirect(Shell_t* shp)
234 iop = (struct ionod*)getnode(shp->stk,ionod);
240 iop->ioname = r_string(shp->stk);
241 if(iop->iodelim = r_string(shp->stk))
244 if(shp->heredocs)
245 iop->iooffset = sfseek(shp->heredocs,(off_t)0,SEEK_END);
248 shp->heredocs = sftmp(512);
251 sfmove(infile,shp->heredocs, iop->iosize, -1);
255 iop->iovname = r_string(shp->stk);
265 static void r_comarg(Shell_t *shp,struct comnod *com)
268 com->comio = r_redirect(shp);
269 com->comset = r_arg(shp);
273 com->comarg = r_arg(shp);
277 else if(com->comarg = (struct argnod*)r_comlist(shp))
284 com->comnamp = (void*)nv_search(cmdname,shp->fun_tree,0);
288 com->comnamp = (void*)nv_open(cmdname,shp->var_tree,NV_VARNAME|NV_NOADD|NV_NOARRAY);
296 static struct dolnod *r_comlist(Shell_t *shp)
303 dol = (struct dolnod*)stkalloc(shp->stk,sizeof(struct dolnod) + sizeof(char*)*(l+ARG_SPARE));
307 while(*argv++ = r_string(shp->stk));
312 static struct regnod *r_switch(Shell_t *shp)
318 reg = (struct regnod*)getnode(shp->stk,regnod);
324 reg->regptr = r_arg(shp);
325 reg->regcom = r_tree(shp);