Lines Matching refs:shp

288 	Shell_t		*shp = &sh;
291 char *trap=shp->st.trap[SH_DEBUGTRAP];
292 char *prefix = shp->prefix;
303 shtp.previous = shp->mktype;
304 shp->mktype=(void*)&shtp;
314 if(shp->prefix)
321 shp->used_pos = 0;
324 shp->prefix = 0;
325 cp = sh_mactrim(shp,arg->argval,(flags&NV_NOREF)?-3:-1);
326 shp->prefix = prefix;
339 cp = sh_mactrim(shp,fp->fornam,-1);
342 error_info.line = fp->fortyp-shp->st.firstline;
345 if(shp->fn_depth && (Namval_t*)tp->com.comnamp==SYSTYPESET)
349 shp->prefix = 0;
350 np = nv_open(prefix,shp->var_tree,flag);
351 shp->prefix = prefix;
363 np = nv_open(cp,shp->var_tree,flag|NV_ASSIGN);
397 Dt_t *last_root = shp->last_root;
398 char **argv = sh_argbuild(shp,&argc,&tp->com,0);
399 shp->last_root = last_root;
401 if(shp->mktype && shp->dot_depth==0 && np==((struct sh_type*)shp->mktype)->nodes[0])
403 shp->mktype = 0;
420 sh_debug(shp,trap,name,(char*)0,argv,(arg->argflag&ARG_APPEND)|ARG_ASSIGN);
445 shp->prefix = cp;
454 shp->prefix = prefix;
467 np = nv_open(cp,shp->var_tree,flag);
497 shp->prefix = stakfreeze(1);
501 shp->prefix = stakcopy(nv_name(np));
503 shp->prefix = cp;
504 shp->last_table = 0;
505 if(shp->prefix)
507 if(*shp->prefix=='_' && shp->prefix[1]=='.' && nv_isref(L_ARGNOD))
509 sfprintf(stkstd,"%s%s",nv_name(L_ARGNOD->nvalue.nrp->np),shp->prefix+1);
510 shp->prefix = stkfreeze(stkstd,1);
516 nr.root = shp->last_root;
517 nr.table = shp->last_table;
523 if(shp->prefix)
530 shp->prefix = prefix;
555 np = nv_open(cp,shp->var_tree,flags);
558 if(shp->used_pos)
595 sh_debug(shp,trap,name,sub,av,append);
602 nv_open(shtp.nodes[0]->nvname,shp->var_tree,NV_ASSIGN|NV_VARNAME|NV_NOADD|NV_NOFAIL);
605 shp->mktype = shtp.previous;
607 shp->prefix = 0;
687 Shell_t *shp = &sh;
694 if(root==shp->var_tree)
722 if(root==shp->var_tree)
748 if((rp=shp->st.real_fun) && !rp->sdict && (flags&NV_STATIC))
750 Dt_t *dp = dtview(shp->var_tree,(Dt_t*)0);
752 dtview(rp->sdict,shp->var_base);
753 dtview(shp->var_tree,rp->sdict);
755 if(np = nv_search(name,shp->var_tree,0))
757 if(shp->var_tree->walk == shp->var_base)
763 root = shp->var_base;
773 root = shp->var_tree->walk;
781 if(np && shp->var_tree->walk==shp->var_tree)
784 nv_delete(np,shp->var_tree,0);
787 if(!np || shp->var_tree->walk!=root)
799 root = shp->var_base;
821 shp->argaddr = 0;
831 shp->last_root = root;
832 shp->last_table = nv_reftable(np);
863 shp->last_root = root;
1036 shp->last_table = 0;
1117 Shell_t *shp = &sh;
1133 shp->last_table = shp->namespace;
1135 root = shp->var_tree;
1136 shp->last_root = root;
1137 if(root==shp->fun_tree)
1141 if((np=shp->namespace) || strchr(name,'.'))
1149 root = shp->var_tree;
1162 shp->last_table = nv_reftable(np);
1168 else if(shp->prefix && (flags&NV_ASSIGN))
1170 name = cp = copystack(shp->prefix,name,(const char*)0);
1174 if(root==shp->alias_tree)
1179 if(shp->subshell && c=='=')
1194 if(root==shp->var_tree)
1195 root = shp->var_base;
1196 shp->last_table = 0;
1212 shp->last_table = xp->last_table;
1213 shp->last_root = xp->last_root;
1247 xp->last_table = shp->last_table;
1248 xp->last_root = shp->last_root;
1278 if(np && shp->mktype)
1292 char *sub=0, *prefix= shp->prefix;
1294 shp->prefix = 0;
1295 if((flags&NV_STATIC) && !shp->mktype)
1299 shp->prefix = prefix;
1317 if(nv_search((char*)np,shp->var_base,HASH_BUCKET))
1318 shp->last_root = shp->var_base;
1322 shp->prefix = prefix;
1958 Shell_t *shp = sh_getinterp();
1959 data.sh = shp;
1964 namec = nv_scan(shp->var_tree,nullscan,(void*)0,NV_EXPORT,NV_EXPORT);
1965 namec += shp->nenv;
1967 data.argnam = (er+=2) + shp->nenv;
1968 if(shp->nenv)
1969 memcpy((void*)er,environ,shp->nenv*sizeof(char*));
1970 nv_scan(shp->var_tree, pushnam,&data,NV_EXPORT, NV_EXPORT);
1973 nv_scan(shp->var_tree, attstore,&data,0,(NV_RDONLY|NV_UTOL|NV_LTOU|NV_RJUST|NV_LJUST|NV_ZFILL|NV_INTEGER));
2047 void sh_scope(Shell_t *shp, struct argnod *envlist, int fun)
2049 register Dt_t *newscope, *newroot=shp->var_base;
2054 dtview(newscope,(Dt_t*)shp->var_tree);
2055 shp->var_tree = newscope;
2059 shp->var_tree = dtview(newscope,0);
2061 if((rp=shp->st.real_fun) && rp->sdict)
2068 shp->var_tree = newscope;
2122 static void table_unset(Shell_t *shp, register Dt_t *root, int flags, Dt_t *oroot)
2137 int subshell = shp->subshell;
2138 shp->subshell = 0;
2144 else if(shp->test&4)
2148 shp->subshell = subshell;
2152 sh_envput(shp->env,nq);
2155 shp->last_root = root;
2156 shp->last_table = 0;
2185 Shell_t *shp = &sh;
2201 npv = nv_open(name,shp->var_tree,NV_NOARRAY|NV_VARNAME|NV_NOADD);
2206 if(rp->fname && shp->fpathdict && (rq = (struct Ufunction*)nv_search(rp->fname,shp->fpathdict,0)))
2212 dtdelete(shp->fpathdict,rq);
2215 while(rq = (struct Ufunction*)dtnext(shp->fpathdict,rq));
2234 if(shp->subshell && !nv_isnull(np))
2274 env_delete(shp->env,nv_name(np));
2290 Namval_t *sh_scoped(Shell_t *shp, register Namval_t *np)
2292 if(!dtvnext(shp->var_tree))
2294 return(dtsearch(shp->var_tree,np));
2414 void sh_optclear(Shell_t *shp, void *old)
2417 for(op=(struct optimize*)shp->optlist; op; op = opnext)
2428 shp->optlist = old;
2902 Shell_t *shp = &sh;
2906 Namval_t *last_table = shp->last_table;
2907 Dt_t *last_root = shp->last_root;
2909 char *prefix=shp->prefix,*nvenv = 0;
2910 if(nv_isattr(np,NV_PARAM) && shp->st.prevst)
2912 if(!(hp=(Dt_t*)shp->st.prevst->save_tree))
2913 hp = dtvnext(shp->var_tree);
2925 shp->prefix = 0;
2927 hp = shp->var_tree;
2929 hp = shp->var_base;
2930 else if(shp->last_root)
2931 hp = shp->last_root;
2934 shp->prefix = prefix;
2943 sfprintf(shp->strbuf,"%s[%d]%c",nv_name(np),index,0);
2945 if(mp = nv_open(sfstruse(shp->strbuf),shp->var_tree,NV_VARNAME|NV_ADD|NV_ARRAY))
2970 shp->prev_table = shp->last_table;
2971 shp->prev_root = shp->last_root;
2972 shp->last_table = last_table;
2973 shp->last_root = last_root;
2985 Shell_t *shp = &sh;
2988 Dt_t *root = shp->last_root;
3003 hp = shp->var_tree;
3005 hp = shp->last_root==shp->var_tree?shp->var_tree:shp->var_base;
3006 else if(shp->last_root)
3007 hp = shp->last_root;
3013 hp = shp->last_root;
3015 if(shp->last_root == shp->var_tree && root!=shp->var_tree)
3023 if(shp->namespace && nv_dict(shp->namespace)==hp)
3054 np->nvalue.nrp->table = shp->last_table;
3103 void sh_unscope(Shell_t *shp)
3105 register Dt_t *root = shp->var_tree;
3107 table_unset(shp,root,NV_RDONLY|NV_NOSCOPE,dp);
3108 if(shp->st.real_fun && dp==shp->st.real_fun->sdict)
3111 shp->st.real_fun->sdict->view = dp;
3113 shp->var_tree=dp;