Skip to content

Commit a7774a7

Browse files
committed
Purge obsolete code; unfinished business
1 parent 9973a6e commit a7774a7

File tree

27 files changed

+33
-328
lines changed

27 files changed

+33
-328
lines changed

jsrc/ao.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,6 @@ static F1(jtkeytallysp){PROLOG(0015);A b,e,q,x,y,z;I c,d,j,k,*u,*v;P*p;
691691
e=SPA(p,e); k=i0(e); // k is the sparse element in the rep of i.~ w
692692
j=0; DO(c, if(k<=u[i])break; if(u[i]==v[i])++j;); // j = # unique values in w before the first fill element
693693
RZ(b=ne(e,x)); // b = mask of values in x that are different from the sparse element
694-
// obsolete RZ(x=repeat(b,x)); RZ(x=keytally(x,x,mark)); u=AV(x); d=AN(x); // u now -> #/.~ of the non-sparse items, d=count thereof
695694
RZ(x=repeat(b,x)); RZ(x=keytally(x,x)); u=AV(x); d=AN(x); // u now -> #/.~ of the non-sparse items, d=count thereof
696695
I nfills=SETIC(w,k)-bsum(c,BAV(b)); // number of cells of fill
697696
GATV0(z,INT,d+(nfills!=0),1); v=AV(z); // allocate result: one for each unique non-fill, plus one for the fills if any

jsrc/ca.c

Lines changed: 14 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,20 @@
55

66
#include "j.h"
77

8+
// [><].@[:]* monad inner loop
9+
static DF1(jtonf1cell){PROLOG(0021);DECLFG;
10+
PREF1(jtonf1cell);
11+
if(RAT&AT(w))RZ(w=pcvt(XNUM,w));
12+
A z=CALL1(f1,CALL1(g1,w,gs),fs);
13+
EPILOG(z);
14+
}
15+
816
// [><].@[:]* monad
9-
static DF1(jtonf1){PROLOG(0021);DECLFG;A z;I flag=sv->flag,m=jt->xmode;
10-
PREF1(jtonf1);
11-
if(primitive(gs))if(flag&VFLR)jt->xmode=XMFLR; else if(flag&VCEIL)jt->xmode=XMCEIL; // scaf avoid repeated primitive calls inside rank
12-
if(RAT&AT(w))RZSUFF(w=pcvt(XNUM,w), z=0; goto restore;);
13-
z=CALL1(f1,CALL1(g1,w,gs),fs); // no RZ...
14-
restore:;
17+
static DF1(jtonf1){PROLOG(0021);DECLFG;I flag=sv->flag,m=jt->xmode;
18+
if(primitive(gs))if(flag&VFLR)jt->xmode=XMFLR; else if(flag&VCEIL)jt->xmode=XMCEIL;
19+
A z=jtonf1cell(jt,w,self);
1520
jt->xmode=m; // ...we must restore xmode...
16-
EPILOG(z); // ...and EPILOG will do nothing
21+
RETF(z);
1722
}
1823

1924
// <.@ >.@ and the like, dyad
@@ -22,7 +27,7 @@ static DF2(jtuponf2){PROLOG(0022);DECLFG;A z;I flag=sv->flag,m=jt->xmode;
2227
if(primitive(gs))if(flag&VFLR)jt->xmode=XMFLR; else if(flag&VCEIL)jt->xmode=XMCEIL;
2328
if(RAT&AT(a))RZSUFF(a=pcvt(XNUM,a), z=0; goto restore;);
2429
if(RAT&AT(w))RZSUFF(w=pcvt(XNUM,w), z=0; goto restore;);
25-
z=INT&AT(a)&AT(w)&&FAV(gs)->id==CDIV?intdiv(a,w):CALL1(f1,CALL2(g2,a,w,gs),fs); // no RZ, see above
30+
z=INT&AT(a)&AT(w)&&FAV(gs)->id==CDIV?intdiv(a,w):CALL1(f1,CALL2(g2,a,w,gs),fs); // no RZ
2631
restore:;
2732
jt->xmode=m;
2833
EPILOG(z);
@@ -426,7 +431,6 @@ F2(jtamp){F2PREFIP;A h=0;AF f1,f2;B b;C c;I flag,flag2=0,linktype=0,mode=-1,p,r;
426431
ARGCHK2(a,w);
427432
D cct; // cct that was used for this comparison compound, if any
428433
A z; fdefallo(z)
429-
#if 1
430434
if(AT(a)&AT(w)&VERB){
431435
// u&v
432436
f1=on1; f2=on2;
@@ -444,7 +448,7 @@ F2(jtamp){F2PREFIP;A h=0;AF f1,f2;B b;C c;I flag,flag2=0,linktype=0,mode=-1,p,r;
444448
#define SPECAND (IDBIT(CCOMMA)|IDBIT(CBOX)|IDBIT(CGRADE)|IDBIT(CSLASH)|IDBIT(CPOUND)|IDBIT(CCEIL)|IDBIT(CFLOOR)|IDBIT(CRAZE)) // mask for all special cases
445449
if(unlikely((I)(SPECAND>>(c&0x3f))&BETWEENC(c,CCOMMA,CPOUND))){
446450
if(unlikely(BOTHEQ8(FAV(a)->id,c,CCOMMA,CBOX))){f2=jtjlink; linktype=ACINPLACE;} // x ,&< y supports IP
447-
else switch(FAV(a)->id&0x3f){
451+
else switch(FAV(a)->id&0x3f){ // **** DO NOT add to this switch without updating SPECAND above ****
448452
case CBOX&0x3f: flag |= VF2BOXATOP1; break; // <&u mark this as <@f for the monad
449453
case CGRADE&0x3f: if(c==CGRADE){f1=jtranking; flag+=VIRS1; flag&=~VJTFLGOK1;} break; // /:&/: y
450454
case CSLASH&0x3f: if(c==CCOMMA){f1=jtredravel; } break; // f/&, y
@@ -496,105 +500,10 @@ F2(jtamp){F2PREFIP;A h=0;AF f1,f2;B b;C c;I flag,flag2=0,linktype=0,mode=-1,p,r;
496500
mode=((II0EPS-1+((p&VFCOMPCOMP)>>3))&0xf)+1; // e.-compound&n including e. -. ([ -. -.) or any i.&1@:e. - LESS/INTER not in 32-bit
497501
if(mode==IINTER){cct=FAV(va)->localuse.lu1.cct; b=cct!=0;} // ([-.-.) always has cct, but it might be 0 indicating default
498502
{PUSHCCTIF(FAV(va)->localuse.lu1.cct,b) h=indexofsub(mode,w,mark); cct=jt->cct; POPCCT f1=ixfixedright; flag&=~VJTFLGOK1; RZ(h)} // m&i[.:][!.f], and remember cct when we created the table
499-
// obsolete }else if(unlikely((c^visa)==CWORDS)){RZ(a=fsmvfya(a)); f1=jtfsmfx; flag&=~VJTFLGOK1; // m&;:
500503
}else if(unlikely(FAV(w)->valencefns[0]==jtwords)){RZ(a=fsmvfya(a)); f1=jtfsmfx; flag&=~VJTFLGOK1; // m&;:
501-
// obsolete }else if(unlikely((c^visa)==CIBEAM)){if(FAV(w)->localuse.lu1.foreignmn[0]==128&&FAV(w)->localuse.lu1.foreignmn[1]==3){RZ(h=crccompile(a)); f1=jtcrcfixedleft; flag&=~VJTFLGOK1; } // m&128!:3
502504
}else if(unlikely(FAV(w)->valencefns[0]==jtcrc1)){RZ(h=crccompile(a)); f1=jtcrcfixedleft; flag&=~VJTFLGOK1; // m&128!:3
503505
}
504506
}
505507
fdeffillall(z,0,CAMP,VERB, f1,with2, a,w,h, flag, RMAX,RMAX,RMAX,fffv->localuse.lu0.cachedloc=0,FAV(z)->localuse.lu1.cct=cct);
506508
R z;
507-
#else // obsolete
508-
509-
switch(CONJCASE(a,w)){
510-
case NV:
511-
f1=withl; v=FAV(w); c=v->id;
512-
// set flag according to ASGSAFE of verb, and INPLACE and IRS from the dyad of the verb
513-
flag=((v->flag&(VJTFLGOK2|VIRS2))>>1)+(v->flag&VASGSAFE);
514-
// a will be INCORPed by fdef
515-
516-
if((-AN(a)&-AR(a))<0){ // a is not atomic and not empty
517-
// c holds the pseudochar for the v op. If v is u!.0, replace c with the pseudochar for n
518-
// Also set b on any u!.n
519-
if(unlikely(b=c==CFIT))c=FAV(v->fgh[0])->id;
520-
if((c&~2)==CIOTA){if(b)cct=v->localuse.lu1.cct; mode=c==CIOTA?IIDOT:IICO;}
521-
}
522-
if(unlikely(0<=mode)){
523-
{PUSHCCTIF(cct,b) h=indexofsub(mode,a,mark); cct=jt->cct; POPCCT f1=ixfixedleft; flag&=~VJTFLGOK1; RZ(h)} // m&i[.:][!.f], and remember cct when we created the table
524-
}else switch(c){
525-
case CWORDS: RZ(a=fsmvfya(a)); f1=jtfsmfx; flag&=~VJTFLGOK1; break;
526-
case CIBEAM: if(FAV(w)->localuse.lu1.foreignmn[0]==128&&FAV(w)->localuse.lu1.foreignmn[1]==3){RZ(h=crccompile(a)); f1=jtcrcfixedleft; flag&=~VJTFLGOK1;} break;
527-
}
528-
fdeffillall(z,0,CAMP,VERB, f1,with2, a,w,h, flag, RMAX,RMAX,RMAX,fffv->localuse.lu0.cachedloc=0,FAV(z)->localuse.lu1.cct=cct);
529-
R z;
530-
case VN:
531-
f1=withr; v=FAV(a);
532-
// set flag according to ASGSAFE of verb, and INPLACE and IRS from the dyad of the verb
533-
// kludge mark it not ASGSAFE in case it is a name that is being reassigned. We could use nvr stack to check for that.
534-
flag=((v->flag&(VJTFLGOK2|VIRS2))>>1)+(v->flag&VASGSAFE);
535-
// w will be INCORPed by fdef
536-
if((-AN(w)&-AR(w))<0){
537-
//
538-
// c holds the pseudochar for the v op. If v is u!.n, replace c with the pseudochar for n
539-
// Also set b if the fit is !.n
540-
c=v->id;p=v->flag;if(unlikely(b=c==CFIT)){cct=v->localuse.lu1.cct; p=FAV(v->fgh[0])->flag;}
541-
if(unlikely(7==(p&7))){
542-
mode=((II0EPS-1+((p&VFCOMPCOMP)>>3))&0xf)+1; // e.-compound&n including e. -. ([ -. -.) or any i.&1@:e. - LESS/INTER not in 32-bit
543-
if(mode==IINTER){cct=v->localuse.lu1.cct; b=cct!=0;} // ([-.-.) always has cct, but it might be 0 indicating default
544-
{PUSHCCTIF(cct,b) h=indexofsub(mode,w,mark); cct=jt->cct; POPCCT f1=ixfixedright; flag&=~VJTFLGOK1; RZ(h)} // m&i[.:][!.f], and remember cct when we created the table
545-
}
546-
}
547-
fdeffillall(z,0,CAMP,VERB, f1,with2, a,w,h, flag, RMAX,RMAX,RMAX,fffv->localuse.lu0.cachedloc=0,FAV(z)->localuse.lu1.cct=cct);
548-
R z;
549-
case VV:
550-
// u&v
551-
f1=on1; f2=on2;
552-
v=FAV(w); c=v->id; r=v->mr; // c=pseudochar for v
553-
// Set flag with ASGSAFE status from f/g; keep INPLACE? in sync with f1,f2. To save tests later, inplace only if monad v can handle it
554-
flag = ((FAV(a)->flag&v->flag)&VASGSAFE)+((v->flag&VJTFLGOK1)*((VJTFLGOK2+VJTFLGOK1)/VJTFLGOK1));
555-
if(unlikely((c&~4)==CFORK)){C d=CLEFT; // u&(FORK/&)
556-
if(c==CFORK)d=ID(v->fgh[2]); // d is CLEFT if &, 0 if capped fork, otherwise from h of fork
557-
if(CIOTA==FAV(v->fgh[1])->id&&(d&~1)==CLEFT&&equ(ds(CALP),v->fgh[0])){ // (FORK/&) is a.&i. or (a. i. ][)
558-
d=FAV(a)->id;
559-
if(BETWEENC(d,CEQ,CGT)){f2=jtcharfn2; flag&=~VJTFLGOK2;} // any comparison - comp&(a.&i. or (a. i. ][))
560-
}
561-
}
562-
switch(FAV(a)->id){
563-
case CBOX: flag |= VF2BOXATOP1; break; // mark this as <@f for the monad
564-
case CGRADE: if(c==CGRADE){f1=jtranking; flag+=VIRS1; flag&=~VJTFLGOK1;} break; // /:&/: y
565-
case CSLASH: if(c==CCOMMA){f1=jtredravel; } break; // f/&, y
566-
case CCOMMA: if(c==CBOX){f2=jtjlink; linktype=ACINPLACE;} break; // x ,&< y supports IP
567-
case CPOUND: f1=c==COPE?jttallyatopopen:f1; break; // #&>
568-
case CCEIL: f1=jtonf1; flag+=VCEIL; flag&=~VJTFLGOK1; break; // >.&g
569-
case CFLOOR: f1=jtonf1; flag+=VFLR; flag&=~VJTFLGOK1; break; // <.&g
570-
case CRAZE: // detect ;@(<@(f/\));.
571-
if(c==CCUT&&boxatop(w)){ // w is <@g;.k
572-
if((((I)1)<<(v->localuse.lu1.gercut.cutn+3))&0x36) { // fetch k (cut type); bits are 3 2 1 0 _1 _2 _3; is 1/2-cut?
573-
A wf=v->fgh[0]; V *wfv=FAV(wf); A g=wfv->fgh[1]; V *gv=FAV(g); // w is <@g;.k find g
574-
if((gv->id&~(CBSLASH^CBSDOT))==CBSLASH) { // g is gf\ or gf\.
575-
A gf=gv->fgh[0]; V *gfv=FAV(gf); // find gf
576-
if(gfv->id==CSLASH){ // gf is gff/ . We will analyze gff later
577-
f1=jtrazecut1; flag&=~(VJTFLGOK1);
578-
}
579-
}
580-
}
581-
}
582-
break;
583-
}
584-
if(c==COPE)flag2|=flag2&VF2BOXATOP1?VF2ATOPOPEN2A|VF2ATOPOPEN2W:VF2ATOPOPEN1|VF2ATOPOPEN2A|VF2ATOPOPEN2W; // &>, but not <&> which would be confused with &.>
585-
586-
// Copy the monad open/raze status from v into u&v
587-
flag2 |= v->flag2&(VF2WILLOPEN1|VF2USESITEMCOUNT1);
588-
589-
// Install the flags to indicate that this function starts out with a rank loop, and thus can be subsumed into a higher rank loop
590-
// If the compound has rank 0, switch to the loop for that; if infinite rank, avoid the loop
591-
// Even though we don't test for infinite, allow this node to be flagged as rankloop so it can combine with others
592-
if(f1==on1){flag2|=VF2RANKATOP1; f1=r==RMAX?on1cell:f1; f1=r==0?jton10:f1;}
593-
if(f2==on2){flag2|=VF2RANKATOP2; f2=r==RMAX?on2cell:f2; f2=r==0?on20:f2;}
594-
fdeffillall(z,flag2,CAMP,VERB, f1,f2, a,w,0L, flag, r,r,r,fffv->localuse.lu0.cachedloc=0,FAV(z)->localuse.lu1.linkvb=linktype);
595-
R z;
596-
default: ASSERTSYS(0,"amp");
597-
case NN: ASSERT(0,EVDOMAIN);
598-
}
599-
#endif
600509
}

jsrc/cf.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ A jtfolk(J jt,A f,A g,A h){F2PREFIP;A p,q,x,y;AF f1=0,f2=0;B b;C c,fi,gi,hi;I fl
5959
// f will be INCORPed by fdef
6060
flag=(hv->flag&(VJTFLGOK1|VJTFLGOK2))+((gv->flag&hv->flag)&VASGSAFE); // We accumulate the flags for the derived verb. Start with ASGSAFE if all descendants are.
6161
fline=5; // set left argtype
62-
// obsolete if(((AT(f)^B01)|AR(f)|BAV0(f)[0])==0&&BOTHEQ8(gi,hi,CEPS,CDOLLAR))f1=jtisempty; // 0 e. $, accepting only boolean 0
6362
if(f==num(0)&&BOTHEQ8(gi,hi,CEPS,CDOLLAR))f1=jtisempty; // 0 e. $, accepting only SDT boolean 0
6463
if(LIT&AT(f)&&1==AR(f)&&BOTHEQ8(gi,hi,CTILDE,CFORK)&&CFROM==ID(gv->fgh[0])){
6564
x=hv->fgh[0];

jsrc/cg.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,6 @@ A protw = (A)(intptr_t)((I)w+((I)jtinplace&JTINPLACEW)); A prota = (A)(intptr_t)
454454
RZ(ffm);
455455
RZ(df1(ff,ffm,ds(sv->id))); // now ff represents (x v1 y)} . Alas, ffm can no longer be virtual
456456
// Protect any input that was returned by v1 (must be ][)
457-
// scaf we should free up unused results which might allow for inplacing the amend
458457
if(a==ffm)jtinplace = (J)(intptr_t)((I)jtinplace&~JTINPLACEA); if(w==ffm)jtinplace = (J)(intptr_t)((I)jtinplace&~JTINPLACEW);
459458
PUSHZOMB
460459
// execute the gerunds that will give the arguments to ff. But if they are nouns, leave as is

jsrc/ch.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,6 @@ static DF2(jthgeom2){PROLOG(0036);A h,*hv,t,z;B b;I an,*av,j,n;V*sv=FAV(self);
6565
static DF1(jthgeom1){R hgeom2(sc(IMAX),w,self);}
6666

6767
static F2(jtcancel){A c,d,f,x,y;
68-
// obsolete f=eval("#/.~"); // scaf could call keytally
69-
// obsolete a=ravel(a); x=nub(a); df1(c,a,f);
70-
// obsolete w=ravel(w); y=nub(w); df1(d,w,f);
7168
a=ravel(a); x=nub(a); c=keytally(a,a); // nub of a, & # times values appear
7269
w=ravel(w); y=nub(w); d=keytally(w,w); // same for w
7370
a=repeat(maximum(num(0),minus(c,from(indexof(y,x),over(d,zeroionei(0))))),x);

0 commit comments

Comments
 (0)