Lines Matching refs:mp

316 static Namfun_t *clone_optindex(Namval_t* np, Namval_t *mp, int flags, Namfun_t *fp)
320 mp->nvalue.lp = np->nvalue.lp;
360 Namval_t *mp = dtsearch(shp->var_tree,np);
361 if(mp && (val=nv_getval(mp)))
362 nv_putval(mp,val,NV_RDONLY);
755 struct match *mp = (struct match*)(SH_MATCHNOD->nvfun->next);
757 if(mp->nmatch = nmatch)
759 memcpy(mp->match,match,nmatch*2*sizeof(match[0]));
762 if(mp->match[i]>=0 && (mp->match[i] -= n) > vsize)
763 vsize = mp->match[i];
766 if(vsize >= mp->vsize)
768 if(mp->vsize)
769 mp->val = (char*)realloc(mp->val,vsize+1);
771 mp->val = (char*)malloc(vsize+1);
772 mp->vsize = vsize;
774 memcpy(mp->val,v,vsize);
775 mp->val[vsize] = 0;
779 if(mp->match[2*i] < 0)
785 mp->lastsub = -1;
793 struct match *mp = (struct match*)fp;
797 if(sub>=mp->nmatch)
799 if(sub==mp->lastsub)
800 return(mp->rval);
801 if(mp->rval)
803 free((void*)mp->rval);
804 mp->rval = 0;
806 n = mp->match[2*sub+1]-mp->match[2*sub];
809 val = mp->val+mp->match[2*sub];
810 if(mp->val[mp->match[2*sub+1]]==0)
812 mp->rval = (char*)malloc(n+1);
813 mp->lastsub = sub;
814 memcpy(mp->rval,val,n);
815 mp->rval[n] = 0;
816 return(mp->rval);
945 Namval_t *mp,fake;
949 mp = (Namval_t*)dtprev(shp->fun_tree,&fake);
950 while(mp=(Namval_t*)dtnext(shp->fun_tree,mp))
952 if(memcmp(mp->nvname,".sh.math.",9))
956 sfputr(shp->strbuf,mp->nvname+9,-1);
966 Namval_t *mp,fake;
974 mp = (Namval_t*)dtprev(shp->fun_tree,&fake);
975 return((char*)dtnext(shp->fun_tree,mp));
984 mp = nv_search(name, shp->fun_tree, action?NV_ADD:0);
987 return(mp?(char*)dtnext(shp->fun_tree,mp):0);
989 action = mp;
1912 register Namval_t *np,*mp;
1932 if(mp = dtmatch(shp->var_base,cp))
1934 mp->nvenv = (char*)cp;
1946 mp = np++;
1947 mp->nvname = cp;
1950 nv_onattr(mp,NV_IMPORT);
1951 if(mp->nvfun || nv_isattr(mp,NV_INTEGER))
1952 nv_putval(mp,dp,0);
1955 mp->nvalue.cp = dp;
1956 nv_onattr(mp,NV_NOFREE);
1958 nv_onattr(mp,NV_EXPORT|NV_IMPORT);
2081 struct Mapchar *mp = (struct Mapchar*)fp;
2085 if(mp->lctype!=lctype)
2087 mp->lctype = lctype;
2088 mp->trans = wctrans(mp->name);
2090 if(!mp->trans || (flags&NV_INTEGER))
2094 c = towctrans(c,mp->trans);
2120 struct Mapchar *mp=0;
2123 mp = (struct Mapchar*)nv_hasdisc(np,&TRANS_disc);
2125 return(mp?(Namfun_t*)mp->name:0);
2132 if(mp)
2134 if(strcmp(name,mp->name)==0)
2135 return(&mp->hdr);
2136 nv_disc(np,&mp->hdr,NV_POP);
2137 if(!(mp->hdr.nofree&1))
2138 free((void*)mp);
2140 mp = newof(0,struct Mapchar,1,n);
2141 mp->trans = trans;
2142 mp->lctype = lctype;
2144 mp->name = e_tolower;
2146 mp->name = e_toupper;
2149 mp->name = (char*)(mp+1);
2150 strcpy((char*)mp->name,name);
2152 mp->hdr.disc = &TRANS_disc;
2153 return(&mp->hdr);