-
-
Save dmitriid/df15ecabcc897836ec2e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
A jtjgets(J jt,C*p){A y;B b;C*v;I j,k,m,n;UC*s; | |
*jt->adbreak=0; | |
if(b=1==*p)p=""; /* 1 means literal input */ | |
if(jt->dcs){ | |
++jt->dcs->dcn; j=jt->dcs->dci; | |
y=jt->dcs->dcy; n=AN(y); s=UAV(y); | |
RZ(j<n); | |
jt->dcs->dcj=k=j; | |
jt->dcs->dci=j=advl(j,n,s); | |
m=j-k; if(m&&32>s[k+m-1])--m; if(m&&32>s[k+m-1])--m; | |
jtwri(jt,MTYOLOG,p,m,k+s); | |
R inpl(b,m,k+s); | |
} | |
/* J calls for input in 3 cases: | |
debug suspension for normal input | |
n : 0 input lines up to terminating ) | |
1!:1[1 read from keyboard */ | |
showerr(); | |
if(jt->nfe) | |
v=nfeinput(jt,*p?"input_jfe_' '":"input_jfe_''"); | |
else{ | |
ASSERT(jt->sminput,EVBREAK); | |
v=((inputtype)(jt->sminput))(jt,p); | |
} | |
R inpl(b,(I)strlen(v),v); | |
} | |
DF1(jtwd){A z=0;C*p=0;D*pd;I e,*pi,t;V*sv; | |
F1RANK(1,jtwd,self); | |
RZ(w); | |
ASSERT(2>AR(w),EVRANK); | |
sv=VAV(self); | |
t=i0(sv->g); | |
if(t>=2000 && t<3000 && AN(w) && LIT!=AT(w) && C2T!=AT(w) && INT!=AT(w)) | |
{ | |
switch(AT(w)) | |
{ | |
case B01: | |
RZ(w=vi(w));break; | |
case FL: | |
pd=DAV(w); | |
GA(w,INT,AN(w),AR(w),0); | |
pi=AV(w); | |
DO(AN(w),*pi++=(I)(jfloor(0.5+*pd++));); | |
break; | |
default: | |
ASSERT(0,EVDOMAIN); | |
} | |
} | |
// t is 11!:t and w is wd argument | |
e=jt->smdowd ? ((dowdtype)(jt->smdowd))(jt, (int)t, w, &z) : EVDOMAIN; | |
if(!e) R mtm; // e==0 is MTM | |
if(e==-1) R z; // e---1 is zp | |
ASSERT(e<=0,e); // e>=0 is EVDOMAIN etc | |
RZ(z=df1(z,cut(ds(CBOX),num[-2]))); // e==-2 is lit pairs | |
R reshape(v2(AN(z)/2,2L),z); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment