diff --git a/src/kx.c b/src/kx.c index ab379bcd..da9fbdf4 100644 --- a/src/kx.c +++ b/src/kx.c @@ -638,7 +638,7 @@ K vf_ex(V q, K g) if(t) cd(kV(f)[CACHE_WD]); K fc = kclone(f); //clone the function to pass for _f cd(kV(fc)[CONJ]); kV(fc)[CONJ]=0; - kV(fc)[DEPTH]++; fw=wd_(kC(o),o->n,tree,fc); kV(f)[CACHE_WD]=fw; cd(fc); } + kV(fc)[DEPTH]++; fw=wd_(kC(o),o->n,&tree,fc); kV(f)[CACHE_WD]=fw; cd(fc); } #ifdef DEBUG if(stk1>5) {cd(g); kerr("stack"); R _n();} diff --git a/src/kx.h b/src/kx.h index 16e4a07b..77bcc779 100644 --- a/src/kx.h +++ b/src/kx.h @@ -13,7 +13,7 @@ K ex1(V *w,K k,I *i,I n,I f); K _n(); extern C errmsg[256]; I bk(V p); -K wd_(S s,int n,K dict,K func); +K wd_(S s,int n,K *dict,K func); K ex(K a); K DI(K d,I i); K kcloneI(K a,const char*f,int n); diff --git a/src/p.c b/src/p.c index c0666b77..69fe06a9 100644 --- a/src/p.c +++ b/src/p.c @@ -325,15 +325,15 @@ I mark(I*m,I k,I t){DO(k, m[i]=i?t:-t) R k;} // this rule doesn't apply to function argument lists, eg: f:{ [a] 1} is ok. however f: {\n\n [a;b;d] 1+1} not ok // so the check probably has to do with whether some useful symbol occurred on the line already //other errors: syntax error -K wd(S s, int n){lineA=s; fdc=0;R wd_(s,n,*denameD(&KTREE,d_,1),0);} -K wd_(S s, int n, K dict, K func) //parse: s input string, n length ; +K wd(S s, int n){lineA=s; fdc=0;R wd_(s,n,denameD(&KTREE,d_,1),0);} +K wd_(S s, int n, K*dict, K func) //parse: s input string, n length ; //assumes: s does not contain a }])([{ mismatch, s is a "complete" expression { if(!s) R 0; if(strstr(s,":\\t")) { show(kerr("\\t syntax")); R 0; } //I z=0; if((z=syntaxChk(s))) {O("%lld\n",z); R SYE;} if(syntaxChk(s)) R SYE; - if('\\'==s[0] && fbs){fbs=0; R backslash(s,n,&dict);} + if('\\'==s[0] && fbs){fbs=0; R backslash(s,n,dict);} PDA p=0; K km=newK(-1,1+n); U(km) I *m = kI(km);//marks @@ -461,7 +461,7 @@ K* inKtree(K*d, S t, I create) { } //TODO: capture - oom all -I capture(S s,I n,I k,I*m,V*w,I*d,K*locals,K dict,K func) +I capture(S s,I n,I k,I*m,V*w,I*d,K*locals,K*dict,K func) //IN string, string length, pos in string, markings; //OUT words, current #words; IN locals-storage, names-storage, charfunc/NULL { @@ -581,7 +581,7 @@ I capture(S s,I n,I k,I*m,V*w,I*d,K*locals,K dict,K func) if(state) //Bracketed parameters exist and are well-formed { S a=strchr(s+k+1,'['); S b=strchr(a,']'); - j=wd_(a+1,b-a-1,*zdict,z); //Grab only params. This must create entries in *zdict + j=wd_(a+1,b-a-1,zdict,z); //Grab only params. This must create entries in *zdict M(z,j) //not g cd(j); } @@ -589,7 +589,7 @@ I capture(S s,I n,I k,I*m,V*w,I*d,K*locals,K dict,K func) { K t=Kd(); M(z,t) - j=wd_(s+k+1,r-2,t,0); //Grab all local names + j=wd_(s+k+1,r-2,&t,0); //Grab all local names M(z,t,j); I n=0; DO(3, if(DE(t,IFP[2-i])){n=3-i;break;}) @@ -597,7 +597,7 @@ I capture(S s,I n,I k,I*m,V*w,I*d,K*locals,K dict,K func) cd(t); cd(j); } - j=wd_(s+k+1,r-2,*ydict,z); + j=wd_(s+k+1,r-2,ydict,z); M(z,j) cd(j); @@ -655,20 +655,20 @@ I capture(S s,I n,I k,I*m,V*w,I*d,K*locals,K dict,K func) else z=((K(*)())vn_[charpos(n_s,u[1])])(); else if(func) { - if(&dict==(K*)kV(func)+PARAMS) + if(dict==(K*)kV(func)+PARAMS) { V q=newEntry(u); U(q) - M(q,kap(&dict,&q)) + M(q,kap(dict,&q)) z=EV(q); cd(q); } - else if((q=DE(dict,u))) z=EVP(q); //If func has its local, use it + else if((q=DE(*dict,u))) z=EVP(q); //If func has its local, use it //else if(':'==s[k+r] && ':'==s[k+r+1] && -MARK_VERB==m[k+r+1]) // {m[k+r]=MARK_NAME; r++; z=denameS(kV(func)[CONTeXT],u);} //m[]= probably superfluous else if(-MARK_VERB==m[k+r] && ':'==s[k+r+1] && -MARK_VERB==m[k+r+1]) {if(':'==s[k+r])r++; z=denameS(kV(func)[CONTeXT],u,1);} - else if(dict==*((K*)kV(func)+LOCALS) && ':'==s[k+r] && -MARK_VERB==m[k+r]) z=denameD(&dict,u,1); + else if(dict==(K*)kV(func)+LOCALS && ':'==s[k+r] && -MARK_VERB==m[k+r]) z=denameD(dict,u,1); //K3.2: a+:1 format applies to context-globals not locals else z=denameS(kV(func)[CONTeXT],u,0);//Otherwise check the context (refactor with above?) } @@ -678,13 +678,13 @@ I capture(S s,I n,I k,I*m,V*w,I*d,K*locals,K dict,K func) I i;for(i=k;i