Skip to content

Commit

Permalink
: scan rewritten
Browse files Browse the repository at this point in the history
  • Loading branch information
HenryHRich committed Oct 18, 2024
1 parent e6b03a3 commit 2bc0668
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion jsrc/cv.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// 9!:22 read current fill, or i. 0 0 if none. Clear fill after reading it
F1(jtqfill){PROLOG(976); ASSERTMTV(w); A z=jt->fill; z=z?z:mtm; jt->fill=0; EPILOG(z);}

// here to set jt->fill over the execution of u scaf make bivalent
// here to set jt->fill over the execution of u
// obsolete static DF1(jtfitfill1){A fs=FAV(self)->fgh[0]; AF f1=FAV(fs)->valencefns[0]; F1PREFIP;A z; jt->fill=FAV(self)->fgh[1]; z=CALL1IP(f1,w,fs); jt->fill=0; RETF(z);} // gs cannot be virtual
// obsolete static DF2(jtfitfill2){A fs=FAV(self)->fgh[0]; AF f2=FAV(fs)->valencefns[1]; F2PREFIP;A z; jt->fill=FAV(self)->fgh[1]; z=CALL2IP(f2,a,w,fs); jt->fill=0; RETF(z);}
static DF2(jtfitfill12){w=AT(w)&VERB?0:w; A fs=FAV(self)->fgh[0]; AF f12=FAV(fs)->valencefns[!!w]; F2PREFIP;A z; jt->fill=FAV(self)->fgh[1]; z=CALL12IP(w,f12,a,w,fs); jt->fill=0; RETF(z);}
Expand Down
13 changes: 9 additions & 4 deletions jsrc/cx.c
Original file line number Diff line number Diff line change
Expand Up @@ -1245,12 +1245,17 @@ F2(jtcolon){F2PREFIP;A h,*hv;C*s;I flag=VFLAGNONE,m,p;
// Noun DD was converted to a string, possibly containing LF, and doesn't come through here
}
}
// find the location of the ':' divider line, if any. But don't recognize : on the last line, since it could
// find the location of the ':' divider line, if any. Only spaces are allowed besides the ':' But don't recognize : on the last line, since it could
// conceivably be the return value from a modifier
A *wv=AAV(w); // pointer to lines
DO(AN(w)-1, I st=0; A wvc=C(*wv);
DO(AN(wvc), I c=CAV(wvc)[i]; if(c!=':'&&c!=' '){st=0; break;} if(c!=' ')if(st==1){s=0; break;}else st=1;)
if(st==1){splitloc=wv-AAV(w); break;} ++wv;)
// obsolete DO(AN(w)-1, I st=0; A wvc=C(*wv);
// obsolete DO(AN(wvc), I c=CAV(wvc)[i]; if(c!=':'&&c!=' '){st=0; break;} if(c!=' ')if(st==1){s=0; break;}else st=1;)
// obsolete if(st==1){splitloc=wv-AAV(w); break;} ++wv;)
DO(AN(w)-1, A wva=C(wv[i]); I j; C *wvac=CAV(wva); I wvan=AN(wva); // init line pointers & len
for(j=0;j<wvan&&wvac[j]==' ';++j); if(j==wvan||wvac[j]!=':')continue; // skip spaces; if no next char or next char is not :, advance to next line
while(++j<wvan&&wvac[j]==' '); // scan trailing characters, stop if nonspace found
if(j==wvan){splitloc=i; break;} // if all chars scanned, that is the split line
)
// split the definition into monad and dyad.
I mn=splitloc<0?AN(w):splitloc; I nn=splitloc<0?0:AN(w)-splitloc-1;
if(splitloc<0){v1=w; v2=mtv;}else{RZ(v1=take(sc(splitloc),w)); RZ(v2=drop(sc(splitloc+1),w));}
Expand Down

0 comments on commit 2bc0668

Please sign in to comment.