diff options
Diffstat (limited to 'Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibbasic2r.cs')
-rw-r--r-- | Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibbasic2r.cs | 1291 |
1 files changed, 973 insertions, 318 deletions
diff --git a/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibbasic2r.cs b/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibbasic2r.cs index c904a1d0fae..a9611b0f98d 100644 --- a/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibbasic2r.cs +++ b/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibbasic2r.cs @@ -14,7 +14,7 @@ // along with this program. If not, see <http://www.gnu.org/licenses/> // -println("ketcindybasic2(20181224) loaded"); +println("ketcindybasic2[20190203] loaded"); //help:start(); @@ -164,24 +164,24 @@ Rotatedata(nm,plist,angle,options):=( tmp1=append(tmp1,tmp); ); if(length(tmp1)==1,tmp1=tmp1_1); - tmp=name+"="+textformat(tmp1,5); + tmp=name+"="+Textformat(tmp1,5); parse(tmp); - tmp1=text(plist); + tmp1=text(plist); //no ketjs on tmp1=RSform(tmp1,1);// 180602 tmp=name+"=Rotatedata("+tmp1+"," - +textformat(angle,5)+","+RSform(textformat(Pt,5))+")"; //17.12.23 - GLIST=append(GLIST,tmp); + +Textformat(angle,5)+","+RSform(Textformat(Pt,5))+")"; //17.12.23 + GLIST=append(GLIST,tmp); //no ketjs off ); if(Noflg<2, if(isstring(Ltype), - if((Noflg==0)&(color!=KCOLOR), //180904 + if((Noflg==0)&(color!=KCOLOR), //180904 //no ketjs on Texcom("{");Com2nd("Setcolor("+color+")");//180722 - ); - Ltype=GetLinestyle(text(Noflg)+Ltype,name); - if((Noflg==0)&(color!=KCOLOR), //180904 + ); //no ketjs off + Ltype=GetLinestyle(text(Noflg)+Ltype,name); + if((Noflg==0)&(color!=KCOLOR), //180904 //no ketjs on Texcom("}");//180722 - ); - , + ); //no ketjs off + , if(Noflg==1,Ltype=0); ); GCLIST=append(GCLIST,[name,Ltype,opcindy]); @@ -234,23 +234,23 @@ Translatedata(nm,plist,mov,options):=( tmp1=append(tmp1,tmp); ); if(length(tmp1)==1,tmp1=tmp1_1); - tmp=name+"="+textformat(tmp1,5); + tmp=name+"="+Textformat(tmp1,5); parse(tmp); - tmp1=text(plist); + tmp1=text(plist); //no ketjs on tmp1=RSform(tmp1,1);// 180602 - tmp=name+"=Translatedata("+tmp1+","+RSform(textformat(mov,5))+")"; - GLIST=append(GLIST,tmp); + tmp=name+"=Translatedata("+tmp1+","+RSform(Textformat(mov,5))+")"; + GLIST=append(GLIST,tmp); //no ketjs off ); if(Noflg<2, if(isstring(Ltype), - if((Noflg==0)&(color!=KCOLOR), //180904 + if((Noflg==0)&(color!=KCOLOR), //180904 //no ketjs on Texcom("{");Com2nd("Setcolor("+color+")");//180722 - ); - Ltype=GetLinestyle(text(Noflg)+Ltype,name); - if((Noflg==0)&(color!=KCOLOR), //180904 + ); //no ketjs off + Ltype=GetLinestyle(text(Noflg)+Ltype,name); + if((Noflg==0)&(color!=KCOLOR), //180904 //no ketjs on Texcom("}");//180722 - ); - , + ); //no ketjs off + , if(Noflg==1,Ltype=0); ); GCLIST=append(GCLIST,[name,Ltype,opcindy]); @@ -272,10 +272,10 @@ Scaledata(nm,plist,Arg1,Arg2):=( //help:Scaledata("1",["crAB","pt1"],2,[[0,0]]); regional(tmp,options); if(islist(Arg2), - tmp=Arg1;//180603(2lines) + tmp=Arg1;//180603[2lines] if(!islist(tmp),tmp=[tmp,tmp]); tmp=Lcrd(tmp); - options=Arg2; + options=Arg2; Scaledata(nm,plist,tmp_1,tmp_2,options); , Scaledata(nm,plist,Arg1,Arg2,[]); @@ -326,24 +326,24 @@ Scaledata(nm,plist,rx,ry,options):=( tmp1=append(tmp1,tmp); ); if(length(tmp1)==1,tmp1=tmp1_1); - tmp=name+"="+textformat(tmp1,5); + tmp=name+"="+Textformat(tmp1,5); parse(tmp); - tmp1=text(plist); + tmp1=text(plist); //no ketjs on tmp1=RSform(tmp1,1); // 180602 tmp=name+"=Scaledata("+tmp1+"," - +textformat(rx,5)+","+textformat(ry,5)+","+RSform(textformat(Pt,5))+")"; - GLIST=append(GLIST,tmp); + +Textformat(rx,5)+","+Textformat(ry,5)+","+RSform(Textformat(Pt,5))+")"; + GLIST=append(GLIST,tmp); //no ketjs off ); if(Noflg<2, if(isstring(Ltype), - if((Noflg==0)&(color!=KCOLOR), //180904 + if((Noflg==0)&(color!=KCOLOR), //180904 //no ketjs on Texcom("{");Com2nd("Setcolor("+color+")");//180722 - ); - Ltype=GetLinestyle(text(Noflg)+Ltype,name); - if((Noflg==0)&(color!=KCOLOR), //180904 + ); //no ketjs off + Ltype=GetLinestyle(text(Noflg)+Ltype,name); + if((Noflg==0)&(color!=KCOLOR), //180904 //no ketjs on Texcom("}");//180722 - ); - , + ); //no ketjs off + , if(Noflg==1,Ltype=0); ); GCLIST=append(GCLIST,[name,Ltype,opcindy]); @@ -412,23 +412,23 @@ Reflectdata(nm,plist,symL,options):=( tmp1=append(tmp1,tmp); ); if(length(tmp1)==1,tmp1=tmp1_1); - tmp=name+"="+textformat(tmp1,5); + tmp=name+"="+Textformat(tmp1,5); parse(tmp); - tmp1=text(plist); + tmp1=text(plist); //no ketjs on tmp1=RSform(tmp1,1);// 180602 - tmp=name+"=Reflectdata("+tmp1+","+RSform(textformat(symL,5))+")";//17.12.23 - GLIST=append(GLIST,tmp); + tmp=name+"=Reflectdata("+tmp1+","+RSform(Textformat(symL,5))+")";//17.12.23 + GLIST=append(GLIST,tmp); //no ketjs off ); if(Noflg<2, if(isstring(Ltype), - if((Noflg==0)&(color!=KCOLOR), //180904 + if((Noflg==0)&(color!=KCOLOR), //180904 //no ketjs on Texcom("{");Com2nd("Setcolor("+color+")");//180722 - ); - Ltype=GetLinestyle(text(Noflg)+Ltype,name); - if((Noflg==0)&(color!=KCOLOR), //180904 + ); //no ketjs off + Ltype=GetLinestyle(text(Noflg)+Ltype,name); + if((Noflg==0)&(color!=KCOLOR), //180904 //no ketjs on Texcom("}");//180722 - ); - , + ); //no ketjs off + , if(Noflg==1,Ltype=0); ); GCLIST=append(GCLIST,[name,Ltype,opcindy]); @@ -490,7 +490,7 @@ MakeRarg(arglist):=( if(isstring(#), tmpstr=Dq+RSslash(#)+Dq; , - tmpstr=textformat(#,6); + tmpstr=Textformat(#,6); ); str=str+tmpstr+","; ); @@ -500,23 +500,24 @@ MakeRarg(arglist):=( ////%MakeRarg end//// ////%Htickmark start//// -Htickmark(arglist):=( +Htickmark(arglist):=Htickmark(arglist,[]); //190203 +Htickmark(arglist,options):=( //190203 //help:Htickmark([1,"1",2,"sw","2"]); regional(nn,tmp,tmp1,tmp2,mark); mark=MARKLEN/SCALEY; tmp1=select(1..(length(arglist)),!isstring(arglist_#)); //180710from forall(tmp1,nn, Listplot("ht"+text(nn), - [[arglist_nn,mark],[arglist_nn,-mark]],["Msg=n"]);//181017 + [[arglist_nn,mark],[arglist_nn,-mark]],["Msg=n"]);//181017 if(nn+2<=length(arglist), tmp=arglist_(nn+2); if(!isstring(tmp), - Expr([[arglist_nn,0],"s1",arglist_(nn+1)]); + Expr([[arglist_nn,0],"s1",arglist_(nn+1)],options); //190203 , - Expr([[arglist_nn,0],arglist_(nn+1),arglist_(nn+2)]); + Expr([[arglist_nn,0],arglist_(nn+1),arglist_(nn+2)],options); //190203 ); , - Expr([[arglist_nn,0],"s1",arglist_(nn+1)]); + Expr([[arglist_nn,0],"s1",arglist_(nn+1)],options); //190203 ); );//180710to // tmp=""; @@ -526,23 +527,24 @@ Htickmark(arglist):=( ////%Htickmark end//// ////%Vtickmark start//// -Vtickmark(arglist):=( +Vtickmark(arglist):=Vtickmark(arglist,[]); //190203 +Vtickmark(arglist,options):=( //190203 //help:Vtickmark([1,"1",2,"sw","2"]); regional(nn,tmp,tmp1,tmp2,mark); mark=MARKLEN/SCALEX; tmp1=select(1..(length(arglist)),!isstring(arglist_#)); //180710from forall(tmp1,nn, Listplot("vt"+text(nn), - [[mark,arglist_nn],[-mark,arglist_nn]],["Msg=n"]); //181021 + [[mark,arglist_nn],[-mark,arglist_nn]],["Msg=n"]); //181021 if(nn+2<=length(arglist), tmp=arglist_(nn+2); if(!isstring(tmp), - Expr([[0,arglist_nn],"w1",arglist_(nn+1)]); + Expr([[0,arglist_nn],"w1",arglist_(nn+1)],options); //190203 , - Expr([[0,arglist_nn],arglist_(nn+1),arglist_(nn+2)]); + Expr([[0,arglist_nn],arglist_(nn+1),arglist_(nn+2)],options); //190203 ); , - Expr([[0,arglist_nn],"w1",arglist_(nn+1)]); + Expr([[0,arglist_nn],"w1",arglist_(nn+1)],options); //190203 ); );//180710to// tmp=MakeRarg(arglist); // Com2nd("Vtickmark("+tmp+")"); @@ -581,7 +583,7 @@ Htick(px,lenorg,options):=( ////%Setax start//// Setax(arglist):=( -//help:Setax(["l","x","e","y","n","O","sw",]); +//help:Setax(["l","x","e","y","n","O","sw"]); //help:Setax([7,"nw"]); //help:Setax([8,linestyle,colorax,colorlabel]); regional(st,nn,tmp); //181215from @@ -601,19 +603,29 @@ Setax(arglist):=( ////%Setax end//// ////%Drwxy start//// -Drwxy():=Drwxy([]); -Drwxy(optionsorg):=( +Drwxy():=Drwxy(0,[]); //190103from +Drwxy(Arg):=( + if(islist(Arg),Drwxy(0,Arg); Drwxy(Arg,[])); +); +Drwxy(add):=Drwxy(add,[]); +Drwxy(add,optionsorg):=( //190103to //help:Drwxy(); -//help:Drwxy(options=["Origin=[0,0]","Xrng=","Yrng=","Ax=l,x,e,..."]); +//help:Drwxy(1[the last axis will be drawn],oprions); +//help:Drwxy(options); +//help:Drwxy(options=["Xrng=","Yrng=","Ax=l,x,e,..."]); regional(options,color,eqL,strL,org,xrng,yrng,ax,st,nn,size, linesty,colorax,colorla,tmp,tmp1,tmp2); options=optionsorg; tmp=Divoptions(options); color=tmp_(length(tmp)-2); eqL=tmp_5; - org=[0,0]; - xrng=[XMIN,XMAX]; - yrng=[YMIN,YMAX]; + org=GENTEN; + //tmp1=max([org_1+XMIN,XMIN]); + //tmp2=min([org_1+XMAX,XMAX]); + xrng=[XMIN,XMAX]; //190103 + //tmp1=max([org_2+YMIN,YMIN]); + //tmp2=min([org_2+YMAX,YMAX]); + yrng=[YMIN,YMAX]; //190103 ax=AXSTYLE; linesty=ax_8; if(isstring(ax_9),colorax=ax_9,colorax=text(ax_9)); @@ -631,10 +643,10 @@ Drwxy(optionsorg):=( forall(eqL, tmp=Strsplit(#,"="); tmp1=Toupper(substring(tmp_1,0,1)); - if(tmp1=="O", + if(tmp1=="O", //190103from org=parse(tmp_2); options=remove(options,[#]); - ); + ); //190103to if(tmp1=="X", xrng=parse(tmp_2); options=remove(options,[#]); @@ -663,7 +675,7 @@ Drwxy(optionsorg):=( strL=select(options,isstring(#)); //181216 tmp=select(strL,contains(["dr","da","do","id"],substring(#,0,2))); if(length(tmp)==0,options=append(options,YasenStyle)); - tmp=substring(ax_1,1,length(ax_1)); //181216(2lines) + tmp=substring(ax_1,1,length(ax_1)); //181216[2lines] if(length(tmp)>0,size=parse(tmp),size=YaSize); tmp1=concat(options,[size,YaAngle,YaPosition,YaCut,colorax]);//181216 tmp=[[xrng_1,org_2],[xrng_2,org_2]]; @@ -678,22 +690,28 @@ Drwxy(optionsorg):=( Listplot("axy"+text(AXCOUNT),tmp,tmp1); ); AXCOUNT=AXCOUNT+1; - Expr([[xrng_2,org_2],ax_3,ax_2],[colorla]);//181216(3lines) + Expr([[xrng_2,org_2],ax_3,ax_2],[colorla]);//181216[3lines] Expr([[org_1,yrng_2],ax_5,ax_4],[colorla]); Letter([org,ax_7,ax_6],[colorla]); - // Addax(0); // 16.01.21 + if(add==0, //190103 + Addax(0); + ); ); ////%Drwxy end//// ////%Drwpt start//// -Drwpt(pstr):=Drawpoint(pstr); +Drwpt(pstr):=Drwpt(pstr,1); //181231 Drwpt(ptlist,nn):=( // 16.03.05 from //help:Drwpt(A); -//help:Drwpt("[1,1],0"); -//help:Drwpt(A,0); //help:Drwpt([1,2],0); - Drawpoint(ptlist,nn); + if(!isreal(DrwPtCtr), //181231from + DrwPtCtr=1; + ); + Pointdata(text(DrwPtCtr),ptlist,["Inside="+text(nn)]); + DrwPtCtr=DrwPtCtr+1; //181231to ); +////%Drwpt end//// +////%Drawpoint start//// Drawpoint(pstr):=( if(isstring(pstr), println("Drwpt : "+pstr); @@ -718,12 +736,12 @@ Drawpoint(ptlistorg,nn):=( tmp1=max(TenSize/TenSizeInit,1)/8; Setpen(tmp1); // 16.04.09 until forall(ptlist, - tmp=textformat(#,5)+","+text(nn); + tmp=Textformat(#,5)+","+text(nn); Com2nd("Drwpt("+tmp+")"); // 16.04.09 ); Setpen(thick); // 16.04.09 );// 16.03.05 until -////%Drwpt end//// +////%Drawpoint end//// ////%Addax start//// Addax(param):=( @@ -770,7 +788,7 @@ Letter(list,options):=( aln="left"; forall(opL, tmp=indexof(#,"->"); - tmp1=removespace(substring(#,0,tmp-1)); + tmp1=Removespace(substring(#,0,tmp-1)); tmp2=substring(#,tmp+1,length(#)); if(tmp1=="size",sz=parse(tmp2)); if(tmp1=="color",clr=parse(tmp2)); @@ -781,7 +799,7 @@ Letter(list,options):=( Dmv=8; Nj=1; while(Nj+2<=length(list), -// Pos=textformat(list_Nj,5); +// Pos=Textformat(list_Nj,5); Pos=list_Nj; Dir=list_(Nj+1); tmp=indexof(Dir,"s")+indexof(Dir,"n");//16.10.19from @@ -799,15 +817,15 @@ Letter(list,options):=( Str=RSslash(Str); // 17.09.24 Str=replace(Str,"`","'");//180303 tmp=Dq+","+Dq+Str+Dq+")"; - if(Noflg==0, + if(Noflg==0, //no ketjs on if((Noflg==0)&(color!=KCOLOR), //180904 Texcom("{");Com2nd("Setcolor("+color+")");//180722 ); - Com2nd("Letter("+Lcrd(Pos)+","+Dq+Dir+tmp);//16.10.10 - if((Noflg==0)&(color!=KCOLOR), //180904 + Com2nd("Letter("+Lcrd(Pos)+","+Dq+Dir+tmp);//16.10.10 + if((Noflg==0)&(color!=KCOLOR), //180904 Texcom("}");//180722 ); - ); + ); //no ketjs off if(Noflg<2, Xmv=0;//16.10.13 Ymv=-4; @@ -936,11 +954,24 @@ Exprrot(pt,dir,tmov,nmov,str,options):=( ////%Exprrot end//// ////%Slider start//// -Putslider(ptstr,p1,p2):=Slider(ptstr,p1,p2); -Slider(ptstr,p1,p2):=( //17.04.11 +Slider(ptstr,p1,p2):=Slider(ptstr,p1,p2,[]); +Slider(ptstr,p1,p2,options):=(//190120 //help:Slider("A-C-B",[-3,0],[3,0]); - regional(pA,pB,pC,seg,sname,Alpha,tmp,tmp1); - tmp=indexall(ptstr,"-"); +//help:Slider(options=["Color=0.6*[0,0,1]","Size=2"]); + regional(pA,pB,pC,seg,sname,Alpha,color,size,tmp,tmp1); + color="Color=0.6*[0,0,1]"; //190120from + size="size->2"; + forall(options, + tmp=Toupper(substring(#,0,1)); + if(tmp=="C", + color=#; + ); + if(tmp=="S", + tmp=Strsplit(#,"="); + size="size->"+tmp_2; + ); + ); //190120to + tmp=Indexall(ptstr,"-"); pA=substring(ptstr,0,tmp_1-1); pC=substring(ptstr,tmp_1,tmp_2-1); pB=substring(ptstr,tmp_2,length(ptstr)); @@ -958,7 +989,7 @@ Slider(ptstr,p1,p2):=( //17.04.11 ); Putpoint(pA,p1); Putpoint(pB,p2); - Listplot([parse(pA),parse(pB)],["notex","color->[0,0.4,0.4]","size->2"]); + Listplot([parse(pA),parse(pB)],["Msg=n","notex",color,size]); // create([sname],"Segment",[parse(pA),parse(pB)]); // tmp2=Listplot("",[p1,p2],["nodata"]); Putonseg(pC,parse("sg"+pA+pB)); @@ -975,7 +1006,22 @@ Putpoint(name,Ptinit,Pt):=( if(!contains(ptstr,name), createpoint(name,Pcrd([Ptinit_1,Ptinit_2])); , - ptstr=name+".xy="+textformat(Pcrd(Pt),5); + ptstr=name+".xy="+Textformat(Pcrd(Pt),5); + parse(ptstr); + ); +); +////%Putpoint end//// + +////%Putpoint start//// +Putpoint(name,Pt):=Putpoint(name,Pt,Pt); +Putpoint(name,Ptinit,Pt):=( +//help:Putpoint("A",[1,2],[1,A.y]); + regional(ptstr); + ptstr=apply(allpoints(),#.name);//16.10.06 + if(!contains(ptstr,name), + createpoint(name,Pcrd([Ptinit_1,Ptinit_2])); + , + ptstr=name+".xy="+Textformat(Pcrd(Pt),5); parse(ptstr); ); ); @@ -1012,7 +1058,16 @@ Bezierpt(t,ptlist,ctrlist):=( ////%Bezier start//// Bezier(ptctrlist):=BezierCurve(ptctrlist_3,ptctrlist_1,ptctrlist_2,[]); -Bezier(ptctrlist,options):=BezierCurve(ptctrlist_3,ptctrlist_1,ptctrlist_2,options); +Bezier(Arg1,Arg2):=( //190202from + regional(nm,ptctrlist,options); + if(islist(Arg1), + ptctrlist=Arg1; options=Arg2; + BezierCurve(ptctrlist_3,ptctrlist_1,ptctrlist_2,options); + , + nm=Arg1; ptctrlist=Arg2; + BezierCurve(nm,ptctrlist_1,ptctrlist_2,[]); + ); +); //190202to Bezier(nm,ptlist,ctrlist):=BezierCurve(nm,ptlist,ctrlist,[]); Bezier(nm,ptlist,ctrlist,options):=BezierCurve(nm,ptlist,ctrlist,options); ////%Bezier end//// @@ -1042,9 +1097,9 @@ BezierCurve(nm,ptlistorg,ctrlistorg,options):=( ptlist=apply(ptlistorg,Lcrd(#)); // 16.08.16 ctrlist=[]; // 14.12.31 if(length(ctrlistorg)==length(ptlist)-1, - forall(ctrlistorg,tmp1, + forall(1..(length(ctrlistorg)),ii, //190202 + tmp1=apply(ctrlistorg_ii,Lcrd(#)); //190202 if(MeasureDepth(tmp1)==0,tmp=[tmp1],tmp=tmp1); - tmp=apply(tmp,Lcrd(#)); // 16.08.16 ctrlist=append(ctrlist,tmp); ); , @@ -1070,24 +1125,24 @@ BezierCurve(nm,ptlistorg,ctrlistorg,options):=( if(Noflg<3, println("generate Bezier "+name); out=apply(list,Pcrd(#)); - tmp=name+"="+textformat(out,5); + tmp=name+"="+Textformat(out,5); parse(tmp); - tmp1=textformat(ptlist,5); + tmp1=Textformat(ptlist,5); //no ketjs on tmp1=RSform(tmp1,2); //17.12.23 - tmp2=textformat(ctrlist,5); + tmp2=Textformat(ctrlist,5); tmp2=RSform(tmp2,3); //17.12.23 - GLIST=append(GLIST,name+"=Bezier("+tmp1+","+tmp2+opstr+")"); + GLIST=append(GLIST,name+"=Bezier("+tmp1+","+tmp2+opstr+")"); //no ketjs off ); if(Noflg<2, if(isstring(Ltype), - if((Noflg==0)&(color!=KCOLOR), //180904 + if((Noflg==0)&(color!=KCOLOR), //180904 //no ketjs on Texcom("{");Com2nd("Setcolor("+color+")");//180722 - ); - Ltype=GetLinestyle(text(Noflg)+Ltype,name); - if((Noflg==0)&(color!=KCOLOR), //180904 + ); //no ketjs off + Ltype=GetLinestyle(text(Noflg)+Ltype,name); + if((Noflg==0)&(color!=KCOLOR), //180904 //no ketjs on Texcom("}");//180722 - ); - , + ); //no ketjs off + , if(Noflg==1,Ltype=0); ); GCLIST=append(GCLIST,[name,Ltype,opcindy]); @@ -1188,14 +1243,14 @@ Putbezierdata(name,ptL,options):=( tmp1=name+"p"+text(#-1); Putpoint(tmp1,tmp,Lcrd(parse(tmp1))); // 16.08.16 inspect(parse(tmp1),"labeled",false); //15.01.22 - Letter([parse(tmp1),"ne",tmp1],["notex"]); //15.01.22 + Letter([parse(tmp1),"ne",tmp1],["notex"]); //15.01.22 inspect(parse(tmp1),"ptsize",psize); inspect(parse(tmp1),"color",3); tmp=(p1+2*p2)/3; tmp2=name+"q"+text(#-1); - Putpoint(tmp2,tmp,Lcrd(parse(tmp2))); // 16.08.16 + Putpoint(tmp2,tmp,Lcrd(parse(tmp2))); // 16.08.16 inspect(parse(tmp2),"labeled",false); //15.01.22 - Letter([parse(tmp2),"ne",tmp2],["notex"]); //15.01.22 + Letter([parse(tmp2),"ne",tmp2],["notex"]); //15.01.22 inspect(parse(tmp2),"ptsize",psize); inspect(parse(tmp2),"color",3); ctrs=append(ctrs,[parse(tmp1),parse(tmp2)]); @@ -1204,7 +1259,7 @@ Putbezierdata(name,ptL,options):=( tmp1=name+"p"+text(#-1); Putpoint(tmp1,tmp,Lcrd(parse(tmp1))); // 16.08.16 inspect(parse(tmp1),"labeled",false); //15.01.22 - Letter([parse(tmp1),"ne",tmp1],["notex"]); //15.01.22 + Letter([parse(tmp1),"ne",tmp1],["notex"]); //15.01.22 inspect(parse(tmp1),"ptsize",psize); inspect(parse(tmp1),"color",3); ctrs=append(ctrs,[parse(tmp1)]); @@ -1294,7 +1349,7 @@ Writebezier(head,seL):=( tmp1=bz_#; ); tmp1=replace(tmp1,"Bezier(","["); - tmp1=replace(tmp1,"list(","["); + tmp1=replace(tmp1,"list"+PaO(),"["); tmp1=replace(tmp1,")","]"); tmp1=replace(tmp1,",",".xy,"); tmp1=replace(tmp1,"]",".xy]"); @@ -1336,7 +1391,7 @@ Readbezier(file,optionorg):=( tmp1=parse(tmp+"k"); tmp2=parse(tmp+"c"); if(MeasureDepth(tmp2)==1,tmp2=[tmp2]); // 16.04.22from - if(geo==1, + if(geo==1, alpha="abcdefghijklmnopqrstuvwxyz"; forall(1..length(tmp1), tmp="k"+BezierNumber+"n"+text(nc)+substring(alpha,#-1,#); @@ -1507,7 +1562,7 @@ Bzspline(nm,ptLorg,options):=( pt1=parse("C"+text(#-1)+"q"); create([lstr],"Join",[pt1,pt]); tmp2="C"+text(#)+"p"; - tmp=Append((2*pt.xy-pt1.xy),1); + tmp=append((2*pt.xy-pt1.xy),1); create([tmp2],"PointOnLine",[parse(lstr),tmp]); ); ); @@ -1523,7 +1578,7 @@ Bzspline(nm,ptLorg,options):=( pt1=parse("C"+text(length(ptL)-1)+"q"); create([lstr],"Join",[pt1,pt]); tmp1="C1p"; - tmp=Append((2*pt.xy-pt1.xy),1); + tmp=append((2*pt.xy-pt1.xy),1); create([tmp1],"PointOnLine",[parse(lstr),tmp]); ); ctrlist=[]; @@ -1575,14 +1630,14 @@ Bzsspline(nm,ptLorg,options):=( if(cflg==0, pt=ptL_1; pt1=ptL_2; - Putpoint("C1p",(4*pt+pt1)/5,Lcrd(C1p)); // 16.08.16 + Putpoint("C1p",(4*pt+pt1)/5,Lcrd(C1p)); // 16.08.16 inspect(C1p,"ptsize",3); inspect(C1p,"color",3); ); if(cflg==1, pt=ptL_1; pt1=Lcrd(parse("C"+text(length(ptL)-1)+"q")); // 16.08.16 - tmp1="Putpoint("+Dq+"C1p"+Dq+",2*pt-pt1)"; // 16.08.16 + tmp1="Putpoint("+Dq+"C1p"+Dq+",2*pt-pt1)"; // 16.08.16 parse(tmp1); ); ctrlist=[]; @@ -1659,7 +1714,7 @@ MeetCurve(Crv,Xorg,Yorg):=( Ban=concat(tmp1,tmp2); Tate=select(Ban, abs(Cv_#_1-Cv_(#+1)_1)<= - 10^(-2)*abs(Cv_#_2-Cv_(#+1)_2) + 10^(-2)*abs(Cv_#_2-Cv_(#+1)_2) ); Ban=remove(Ban,Tate); Ylist=[]; @@ -1694,11 +1749,11 @@ MeetCurve(Crv,Xorg,Yorg):=( ); ////%MeetCurve end//// -////%PutonLine start//// -PutonLine(name,p1,p2):=PutonLine(name,p1,p2,[]); -PutonLine(name,p1org,p2org,options):=( -//help:PutonLine("C","sgAB"); -//help:PutonLine("C",pA,pB); +////%Putonline start//// +Putonline(name,p1,p2):=PutonLine(name,p1,p2,[]); +Putonline(name,p1org,p2org,options):=( +//help:Putonline("C","sgAB"); +//help:Putonline("C",pA,pB); regional(par,p1,p2,dx,dy,tmp,tmp1,tmp2); par=0.5; tmp=Divoptions(options); @@ -1725,19 +1780,20 @@ PutonLine(name,p1org,p2org,options):=( ); ); ); -////%PutonLine end//// +////%Putonline end//// -////%PutonSeg start//// -PutonSeg(name,sgstr):=( +////%Putonseg start//// +Putonseg(name,sgstr):=( regional(seg,p1,p2); if(isstring(sgstr),seg=parse(sgstr),seg=sgstr); - PutonSeg(name,LLcrd(seg_1),LLcrd(seg_2)); + Putonseg(name,LLcrd(seg_1),LLcrd(seg_2)); ); -PutonSeg(name,p1,p2):=PutonSeg(name,p1,p2,[]); -PutonSeg(name,p1org,p2org,options):=( -//help:PutonSeg("C","sgAB"); -//help:PutonSeg("C",pA,pB); - regional(par,dx,dy,p,tmp,tmp1,tmp2); +Putonseg(name,p1,p2):=Putonseg(name,p1,p2,[]); +Putonseg(name,p1org,p2org,options):=( +//help:Putonseg("C","sgAB"); +//help:Putonseg("C",pA,pB); + regional(Eps,par,dx,dy,p,tmp,tmp1,tmp2); + Eps=10^(-5); par=0.5; tmp=Divoptions(options); if(length(tmp_6)>0, @@ -1745,31 +1801,31 @@ PutonSeg(name,p1org,p2org,options):=( ); p1=Lcrd(p1org);//16.10.11from p2=Lcrd(p2org); - PutonLine(name,p1,p2,[par]); + Putonline(name,p1,p2,[par]); + p1=Pcrd(p1); p2=Pcrd(p2); //190120 dx=p2_1-p1_1; dy=p2_2-p1_2; p=parse(name+".xy"); - p=LLcrd(p); - if(abs(dx)>abs(dy) & (p_1-p1_1)*(p_1-p2_1)>0, - if(|p-p1|<|p-p2|, - parse(name+".xy=Pcrd(p1)"); - , - parse(name+".xy=Pcrd(p2)"); - ); - ); - if(abs(dx)<abs(dy) & (p_2-p1_2)*(p_2-p2_2)>0, - if(|p-p1|<|p-p2|, - parse(name+".xy=Pcrd(p1)"); - , - parse(name+".xy=Pcrd(p2)");//16.10.11until - ); - ); -); -////%PutonSeg end//// +// p=LLcrd(p); + if(abs(dx)>abs(dy), //190120from + if(p1_1>p2_1,tmp=p1;p1=p2;p2=tmp); + if(p_1<p1_1,parse(name+".xy="+Textformat(p1,5));p=p1); + if(p_1>p2_1,parse(name+".xy="+Textformat(p2,5));p=p2); + tmp=(p2_2-p1_2)/(p2_1-p1_1)*(p_1-p1_1)+p1_2; + parse(name+".y="+tmp); + , + if(p1_2>p2_2,tmp=p1;p1=p2;p2=tmp); + if(p_2<p1_2,parse(name+".xy="+Textformat(p1,5));p=p1); + if(p_2>p2_2,parse(name+".xy="+Textformat(p2,5));p=p2); + tmp=(p2_1-p1_1)/(p2_2-p1_2)*(p_2-p1_2)+p1_1; + parse(name+".x="+tmp); + ); //190120to +); +////%Putonseg end//// -////%PutonCurve start//// -PutonCurve(pn,crv):=PutonCurve(pn,crv,[]); -PutonCurve(pn,crv,options):=( +////%Putoncurve start//// +Putoncurve(pn,crv):=Putoncurve(pn,crv,[]); +Putoncurve(pn,crv,options):=( //help:Putoncurve("A","gr1"); //help:Putoncurve("A","gr1",[0,XMAX]); regional(Pmt,pstr,optionL,leftlim,rightlim,tmp,tmp1,Flg,Msg); @@ -1793,25 +1849,25 @@ PutonCurve(pn,crv,options):=( ); ); Pmt=MeetCurve(crv,leftlim,0); - pstr=apply(allpoints(),textformat(#,5)); // 15.04.07 + pstr=apply(allpoints(),Textformat(#,5)); // 15.04.07 if(!contains(pstr,pn), createpoint(pn,Pcrd(Pmt)); , tmp1=parse(pn+".x"); if(tmp1< leftlim % tmp1>rightlim, if(tmp1< leftlim,tmp= leftlim, tmp=rightlim); - Pmt=MeetCurve(crv,textformat(tmp,5),pn+".y"); + Pmt=MeetCurve(crv,Textformat(tmp,5),pn+".y"); , Pmt=MeetCurve(crv,pn+".x",pn+".y"); ); - ptstr=pn+".xy="+textformat(Pcrd(Pmt),5)+";"; + ptstr=pn+".xy="+Textformat(Pcrd(Pmt),5)+";"; parse(ptstr); ); if(Msg=="y", println("Put "+pn+" on Curve "+text(crv)); ); ); -////%PutonCurve end//// +////%Putoncurve end//// ////%CrossPoint start//// CrossPoint(name,Crv1,Crv2,range):=( @@ -1872,16 +1928,16 @@ Periodfun(defL,reporg,optionorg):=( // 16.11.24 forall(1..(length(defL)/3),nn, fun=defL_(3*nn-2); range=defL_(3*nn-1); - tmp1=if(isstring(range_1),parse(range_1),range_1); //17.06.11(2lines) + tmp1=if(isstring(range_1),parse(range_1),range_1); //17.06.11[2lines] tmp2=if(isstring(range_2),parse(range_2),range_2); minx=min(minx,tmp1); maxx=max(maxx,tmp2); num=defL_(3*nn); options=append(options,"Num="+text(num)); Plotdata("pe"+text(nn),fun, - "x="+textformat([tmp1,tmp2],5),options); + "x="+Textformat([tmp1,tmp2],5),options); pdata=append(pdata,"grpe"+text(nn)); - tmp1=range_1; //17.06.11(4lines) + tmp1=range_1; //17.06.11[4lines] if(isstring(tmp1),tmp1=replace(tmp1,"pi","%pi"),tmp1=format(tmp1,5)); tmp2=range_2; if(isstring(tmp2),tmp2=replace(tmp2,"pi","%pi"),tmp2=format(tmp2,5)); @@ -1900,7 +1956,7 @@ Periodfun(defL,reporg,optionorg):=( // 16.11.24 forall(1..(rep_2),nr, forall(1..(length(pdata)),np, Translatedata("p"+np+text(nr),pdata_np,[per*nr,0],options); - tmp2=concat(tmp2,["trp"+np+text(nr)]); + tmp2=concat(tmp2,["trp"+np+text(nr)]); ); );//180724to pdata=concat(tmp1,pdata); @@ -2125,9 +2181,9 @@ Tabledata(nm,xLst,yLst,rmvL,optionorg):=( Putpoint(tmp,Tgrid(tmp1)); , Putpoint(tmp,Tgrid(tmp1),[R0.x,parse(tmp+".y")]); - rlist_(#+1)=parse(tmp+".xy"); + rlist_(#+1)=parse(tmp+".xy"); //no ketjs ); - Putpoint(tmp,Tgrid(tmp1),[R0.x,parse(tmp+".y")]); + Putpoint(tmp,Tgrid(tmp1),[R0.x,parse(tmp+".y")]); inspect(parse(tmp),"ptsize",3); inspect(parse(tmp),"labeled",false); if(mod(#,tick)==0 % #==n, @@ -2358,7 +2414,7 @@ Findcell(Tbdata,pos1,pos2):=( regional(tmp1,tmp2,posnw,posse,ctr,dx,dy); if(isstring(pos1), posnw=Tgrid(pos1); // 15.05.20 - posse=Tgrid(pos2); + posse=Tgrid(pos2); //posnw=parse(pos1); //posse=parse(pos2); , @@ -2479,9 +2535,9 @@ RSform(str,listfrom):=( //help:RSform(string,listfrom); regional(posL,mxlv,rep1,rep2,rep3,prev,out, tmp,tmp1,tmp2); - rep1="c("; rep2="c("; rep3="list("; - if(listfrom<3,rep2="list("); - if(listfrom==1,rep1="list("); + rep1="c"+PaO(); rep2="c"+PaO(); rep3="list"+PaO(); + if(listfrom<3,rep2="list"+PaO()); + if(listfrom==1,rep1="list"+PaO()); posL=Bracket(str,"[]"); tmp=apply(posL,#_2); mxlv=max(tmp); @@ -2505,8 +2561,8 @@ RSform(str,listfrom):=( out=replace(out,".xy",""); out=replace(out,".x","[1]"); out=replace(out,".y","[2]"); - out=replace(out,"c(1)","[1]");//17.10.06(2lines) - out=replace(out,"c(2)","[2]"); + out=replace(out,"c"+PPa("1"),"[1]");//17.10.06[2lines] + out=replace(out,"c"+PPa("2"),"[2]"); out; ); ////%RSform end//// @@ -2524,8 +2580,8 @@ RSslash(str):=( //17.09.24 Rform(list):=( regional(plotlist,comp,pos,out,strL,tmp,tmp1,tmp2,tmp3,Nj); out=list; - out=replace(out,"[[[","list([["); - out=replace(out,"[","c("); + out=replace(out,"[[[","list"+PaO()+"[["); + out=replace(out,"[","c"+PaO()); out=replace(out,"]",")"); out=replace(out,".xy",""); out=replace(out,".x","[1]"); @@ -2587,7 +2643,7 @@ IftoR(strorg):=( //180802 regional(str,ifL,ppL,cpL,kk,sL,out, tmp,tmp1,tmp2,tmp3,tmp4); str=replace(strorg,LFmark,""); - ifL=Indexall(str,"if("); + ifL=Indexall(str,"if"+PaO()); ppL=Bracket(str,"()"); cpL=Indexall(str,","); tmp1=Bracket(str,"[]"); @@ -2633,7 +2689,7 @@ FortoR(strorg):=( if(forstr==0, out=str; , - pre=substring(str,0,forstr-1)+"for("; + pre=substring(str,0,forstr-1)+"for"+PaO(); ppL=Bracket(str,"()"); tmp1=forstr+6; tmp=select(ppL,#_1==tmp1); @@ -2669,7 +2725,7 @@ Deffun(name,bodylist):=( funstr=funstr+");"; parse(funstr); tmp=indexof(name,"("); - str=substring(name,0,tmp-1)+"<-function("; + str=substring(name,0,tmp-1)+"<-function"+PaO(); str=str+substring(name,tmp,length(name))+"{"; forall(1..(length(bodylist)-1),nbody, bdy=bodylist_nbody; @@ -2704,7 +2760,7 @@ Deffun(name,bodylist):=( str=str+bdy+";"; ); ); - str=str+"return("+bodylist_(length(bodylist))+")}"; + str=str+"return"+PaO()+bodylist_(length(bodylist))+")}"; FUNLIST=append(FUNLIST,str); ); ////%Deffun end//// @@ -2725,69 +2781,141 @@ Inwindow(point,xrng,yrng):=( ); ////%Inwindow end//// -////%Windispg start//// -Windispg():=( - regional(Nj,Nk,Dt,Vj,tmp,tmp1,tmp2,opcindy); - if(ADDAXES=="1", //181215from - Drwxy(); -// ADDAXES="0"; - ); //181215to - gsave(); - layer(KETPIClayer); - forall(GCLIST,Nj, - if(isstring(Nj_1),Dt=parse(Nj_1),Dt=Nj_1); // 11.17 - if(islist(Dt) & length(Dt)>0, // 12.19,12.22 - tmp=MeasureDepth(Dt); - if(tmp==1,Dt=[Dt]); - opcindy=Nj_3; - if(Nj_2<0,tmp1=0,tmp1=Nj_2); - if(tmp1<10, - forall(Dt,Nk, - tmp2=Nk; // 14.12.04 - if(length(Nk)>1, - tmp="connect("+textformat(tmp2,5)+ - ",dashtype->"+text(tmp1)+",linecolor->"+KCOLOR+opcindy+")"; - parse(tmp); - , - if(length(Nk)==1, - tmp="draw("+text(tmp2_1)+opcindy+")"; // 14.12.31 - parse(tmp); - ); +////%Dashlinedata start//// +Dashlinedata(dataorg,sen,gap,ptn):=( + regional(data,eps,dtall,len,lenlist,ii,lenall,kari, + naga,tobi,nsen,seglist,segunit,hajime,owari,jj, + flg,tt,ptL,out,tmp,tmp1,tmp2); + eps=10.0^(-6); + if(isstring(dataorg),data=parse(dataorg),data=dataorg); + dtall=length(data); + out=[]; + len=0; lenlist=[0]; + forall(2..dtall,ii, + len=len+|data_ii-data_(ii-1)|; + lenlist=append(lenlist,len); + ); + lenall=lenlist_dtall; + if(lenall>0, + kari=(sen+gap)*0.1;naga=sen*0.1;tobi=gap*0.1; + if(|data_1-data_dtall|<eps, + nsen=max([re(ceil(lenall/kari)),3]); + segunit=lenall/nsen; + naga=segunit*sen/(sen+gap); + tobi=segunit*gap/(sen+gap); + seglist=apply(0..(nsen-1),#*segunit); + , + if(ptn==0, + nsen=max([re(ceil((lenall+tobi)/kari)),3]); + segunit=lenall*(sen+gap)/(nsen*sen+(nsen-1)*gap); + naga=segunit*sen/(sen+gap); + tobi=segunit*gap/(sen+gap); + seglist=apply(0..(nsen-1),#*segunit); + , + nsen=max([re(ceil((lenall+naga)/kari)),3]); + segunit=lenall*(sen+gap)/((nsen-1)*sen+nsen*gap); + naga=segunit*sen/(sen+gap); + tobi=segunit*gap/(sen+gap); + seglist=apply(0..(nsen-2),tobi+#*segunit); + ); + ); + hajime=1;owari=1; + forall(1..(length(seglist)),ii, + len=seglist_ii; + flg=0; + forall(owari..dtall,jj, + if(flg==0, + if(len<lenlist_jj-eps, + flg=jj; + ); + ); + ); + if(flg>0,hajime=flg-1); + flg=0; + forall(hajime..dtall,jj, + if(flg==0, + if(len+naga<lenlist_jj-eps, + flg=jj; ); ); ); + if(flg>0,owari=flg-1); + tt=len-lenlist_hajime; + tt=tt/(lenlist_(hajime+1)-lenlist_hajime); + tmp=data_hajime+tt*(data_(hajime+1)-data_hajime); + ptL=[tmp]; + forall((hajime+1)..owari,jj, + ptL=append(ptL,data_jj); + ); + tt=(len+naga-lenlist_owari); + tt=tt/(lenlist_(owari+1)-lenlist_owari); + tmp=data_owari+tt*(data_(owari+1)-data_owari); + ptL=append(ptL,tmp); + out=append(out,ptL); ); ); - grestore(); - layer(0); + out; ); -Windispg(pltdata):=( - regional(pdata,Nj,Nk,Dt,tmp,tmp1,tmp2,opcindy); +////%Dashlinedata end//// + +////%Windispg start//// +Windispg():=( + if(ADDAXES=="1", //181215from + Drwxy(); + ADDAXES="0"; + ); //181215to + Windispg(GCLIST); //190125 +); +Windispg(gcLorg):=( //190125 + regional(gcL,Nj,Nk,Dt,Vj,tmp,tmp1,tmp2,tmp3,tmp4,opcindy); + gcL=gcLorg; //190125from + if(length(gcL)>0, + if(!islist(gcL_1),gcL=[gcL]); + ); //190125to gsave(); layer(KETPIClayer); - if(!islist(pltdata),tmp=[pltdata],tmp=pltdata); - pdata=select(GCLIST,contains(tmp,#_1)); - forall(pdata,Nj, + forall(gcL,Nj, if(isstring(Nj_1),Dt=parse(Nj_1),Dt=Nj_1); // 11.17 if(islist(Dt) & length(Dt)>0, // 12.19,12.22 tmp=MeasureDepth(Dt); if(tmp==1,Dt=[Dt]); opcindy=Nj_3; - if(Nj_2<0,tmp1=0,tmp1=Nj_2); + tmp=Nj_2; //190119from + if(!islist(tmp),tmp=[tmp,""]); //190123 + if(tmp_1<0,tmp1=0,tmp1=tmp_1); //190119from if(tmp1<10, forall(Dt,Nk, - tmp2=Nk; // 14.12.04 if(length(Nk)>1, - tmp="connect("+textformat(tmp2,5)+ // 15.05.11 - ",dashtype->"+text(tmp1)+ - ",linecolor->"+KCOLOR+opcindy+")"; - parse(tmp); - , - if(length(Nk)==1, - tmp="draw("+text(tmp2_1)+opcindy+")"; // 14.12.31 + tmp3=""; + if(indexof(opcindy,"color")==0, //190122from + tmp3=tmp3+",linecolor->"+KCOLOR; + ); + tmp3=tmp3+opcindy; + if(tmp1==0, //190126from + if((length(tmp_2)>0)&(indexof(opcindy,"size")==0), + tmp3=tmp3+",size->"+tmp_2; + ); //190124to + tmp="connect("+Textformat(Nk,5)+tmp3+");";//190125 parse(tmp); + , + if(tmp1==1, + tmp4=Dashlinedata(Nk,2.5,2.5,0); + forall(tmp4, + tmp="connect("+Textformat(#,5)+tmp3+");"; + parse(tmp); + ); + , + tmp3=",dashtype->"+text(tmp1)+tmp3; + forall(1..(length(Nk)-1), + tmp="draw("+Textformat([Nk_#,Nk_(#+1)],5)+tmp3+");"; + parse(tmp); + ); + ); ); - ); + , + tmp="draw("+text(Nk_1)+opcindy+");"; // 14.12.31 + parse(tmp); + ); //190126to ); ); ); @@ -2830,7 +2958,7 @@ WritetoRS(filename,shchoice):=( tmp1=format(re(tmp_1),6);// 15.02.05 tmp2=format(re(tmp_2),6); tmp=#.name+"="+"c("+tmp1+","+tmp2+");"; - tmp=tmp+"Assignadd('"+#.name+"',"+#.name+")"; + tmp=tmp+"Assignadd('"+#.name+"',"+#.name+")"; Plist=append(Plist,tmp); , println("Remove the abnormal poiint "+#.name); //181106 @@ -2850,26 +2978,26 @@ WritetoRS(filename,shchoice):=( println(SCEOUTPUT,""); ); if(iswindows(), - println(SCEOUTPUT,"options(encoding='UTF-8')"); //180513 + println(SCEOUTPUT,"options"+PaO()+"encoding='UTF-8')"); //190111 ); tmp1=replace(Dirwork,"\","/"); if((iswindows())&(indexof(tmp1,"Users")>0), tmp=Indexall(tmp1,"/"); tmp2=substring(tmp1,tmp_3-1,length(tmp1)); tmp1=substring(tmp1,0,tmp_3-1); - println(SCEOUTPUT,"Drv=shell('echo %HOMEDRIVE%',intern=TRUE)"); - println(SCEOUTPUT,"Drv=Drv[length(Drv)]"); - println(SCEOUTPUT,"Hpath=shell('echo %HOMEPATH%',intern=TRUE)"); - println(SCEOUTPUT,"Hpath=Hpath[length(Hpath)]"); + println(SCEOUTPUT,"Drv=shell"+PaO()+"'echo %HOMEDRIVE%',intern=TRUE)"); //190111 + println(SCEOUTPUT,"Drv=Drv[length"+PaO()+"Drv)]"); + println(SCEOUTPUT,"Hpath=shell"+PaO()+"'echo %HOMEPATH%',intern=TRUE)"); + println(SCEOUTPUT,"Hpath=Hpath[length"+PaO()+"Hpath)]"); println(SCEOUTPUT,"Rest="+Dqq(tmp2)); - println(SCEOUTPUT,"Path=paste(Drv,Hpath,Rest,sep='')"); - println(SCEOUTPUT,"Path=gsub('\\','/',Path,fixed=TRUE)"); //180610 - println(SCEOUTPUT,"setwd(Path)"); + println(SCEOUTPUT,"Path=paste"+PaO()+"Drv,Hpath,Rest,sep='')"); + println(SCEOUTPUT,"Path=gsub"+PaO()+"'\\','/',Path,fixed=TRUE)"); //180610 + println(SCEOUTPUT,"setwd"+PaO()+"Path)"); , - println(SCEOUTPUT,"setwd('"+tmp1+"')"); + println(SCEOUTPUT,"setwd"+PaO()+"'"+tmp1+"')"); );//180409to tmp=replace(Libname,"\","/"); //17.09.24from - println(SCEOUTPUT,"source('"+tmp+".r')"); //181213 + println(SCEOUTPUT,"source"+PaO()+"'"+tmp+".r')"); //181213 if((indexof(PathT,"pdflatex")>0)%(indexof(PathT,"lualatex")>0), if(GPACK=="tpic",GPACK="pict2e"); ); @@ -2879,20 +3007,20 @@ WritetoRS(filename,shchoice):=( ); if(GPACK=="tikz", //181213from tmp=replace(tmp+"_reptikz","\","/"); - println(SCEOUTPUT,"source('"+tmp+".r')"); + println(SCEOUTPUT,"source"+PaO()+"'"+tmp+".r')"); ); //181213to - println(SCEOUTPUT,"Ketinit()"); - println(SCEOUTPUT,"cat(ThisVersion,'\n')"); + println(SCEOUTPUT,"Ketinit"+PPa("")); + println(SCEOUTPUT,"cat"+PaO()+"ThisVersion,'\n')"); println(SCEOUTPUT,"Fnametex='"+Fnametex+"'"); println(SCEOUTPUT,"FnameR='"+FnameR+"'"); println(SCEOUTPUT,"Fnameout='"+Fnameout+"'"); println(SCEOUTPUT,"arccos=acos; arcsin=asin; arctan=atan"); - println(SCEOUTPUT,"Acos<- function(x){acos(max(-1,min(1,x)))}"); - println(SCEOUTPUT,"Asin<- function(x){asin(max(-1,min(1,x)))}"); + println(SCEOUTPUT,"Acos<- function"+PPa("x")+"{acos"+PaO()+"max"+PaO()+"-1,min"+PaO()+"1,x)))}"); + println(SCEOUTPUT,"Asin<- function"+PPa("x")+"{asin"+PaO()+"max"+PaO()+"-1,min"+PaO()+"1,x)))}"); println(SCEOUTPUT,"Atan=atan"); - println(SCEOUTPUT,"Sqr<- function(x){if(x>=0){sqrt(x)}else{0}}"); + println(SCEOUTPUT,"Sqr<- function"+PPa("x")+"{if"+PaO()+"x>=0){sqrt"+PaO()+"x)}else{0}}"); println(SCEOUTPUT,"Factorial=factorial"); - println(SCEOUTPUT,"Norm<- function(x){norm(matrix(x,nrow=1),"+Dqq("2")+")}"); + println(SCEOUTPUT,"Norm<- function"+PPa("x")+"{norm"+PaO()+"matrix"+PaO()+"x,nrow=1),"+Dqq("2")+")}"); println(SCEOUTPUT,""); forall(COM0thlist, if(indexof(#,"Texcom")==0, //17.09.22 @@ -2902,7 +3030,7 @@ WritetoRS(filename,shchoice):=( ); ); println(SCEOUTPUT, - "Setwindow(c("+XMIN+","+XMAX+"), c("+YMIN+","+YMAX+"))"); + "Setwindow(c"+PaO()+XMIN+","+XMAX+"), c"+PaO()+YMIN+","+YMAX+"))"); forall(Plist, println(SCEOUTPUT,#); ); @@ -2914,7 +3042,7 @@ WritetoRS(filename,shchoice):=( if(islist(tmp1), tmp2="["; forall(tmp1, - tmp2=tmp2+textformat(#,6)+","; + tmp2=tmp2+Textformat(#,6)+","; ); tmp1=substring(tmp2,0,length(tmp2)-1)+"]"; , @@ -2924,27 +3052,27 @@ WritetoRS(filename,shchoice):=( tmp1=RSform(tmp1); print(SCEOUTPUT,tmp+"="+tmp1+";"); //17.09.22 // tmp=substring(tmp,0,length(tmp)-1); - println(SCEOUTPUT,"Assignadd('"+tmp+"',"+tmp+")"); + println(SCEOUTPUT,"Assignadd"+PaO()+"'"+tmp+"',"+tmp+")"); ); forall(FUNLIST, println(SCEOUTPUT,#); ); - forall(GLIST, + forall(GLIST, //no ketjs on println(SCEOUTPUT,RSform(#)); - ); + ); //no ketjs off tmp=text(Pnamelist); - tmp=replace(tmp,"[","list("); + tmp=replace(tmp,"[","list"+PaO()); Pnamelist=replace(tmp,"]",")"); println(SCEOUTPUT,"PtL="+Pnamelist); tmp=select(GCLIST,#_2==-1); GrL=apply(tmp,#_1); tmp=text(GrL); - tmp=replace(tmp,"[","list("); + tmp=replace(tmp,"[","list"+PaO()); tmp=replace(tmp,"]",")"); println(SCEOUTPUT,"GrL="+tmp); tmp1=""; if(length(tmp1)>0, - tmp1="WriteOutData(Fnameout"+tmp1+");"; + tmp1="WriteOutData"+PaO()+"Fnameout"+tmp1+");"; println(SCEOUTPUT,tmp1); ); forall(COM1stlist, @@ -2955,13 +3083,13 @@ WritetoRS(filename,shchoice):=( ); ); println(SCEOUTPUT,""); - println(SCEOUTPUT,"# Windisp(GrL)"); + println(SCEOUTPUT,"# Windisp"+PPa("GrL")); println(SCEOUTPUT,""); - println(SCEOUTPUT,"if(1==1){"); + println(SCEOUTPUT,"if"+PaO()+"1==1){"); println(SCEOUTPUT,""); tmp1=replace(Dirwork,"\","/"); //180408to if((iswindows())&(indexof(tmp1,"Users")>0), - println(SCEOUTPUT,"Path=paste(Path,"+Dqq("/"+Fnametex)+",sep='')"); + println(SCEOUTPUT,"Path=paste"+PaO()+"Path,"+Dqq("/"+Fnametex)+",sep='')"); tmp="Openfile(Path,'"+ULEN+"'"; , tmp="Openfile('"+tmp1+"/"+Fnametex+"','"+ULEN+"'"; @@ -2999,18 +3127,18 @@ WritetoRS(filename,shchoice):=( ); //180721to ); if(length(GrL)>0, - println(SCEOUTPUT," Drwline(GrL)"); + println(SCEOUTPUT," Drwline"+PPa("GrL")); ); - // println(SCEOUTPUT,"Closefile('"+ADDAXES+"')"); //181224(2line) - println(SCEOUTPUT,"Closefile("+Dqq("0")+")"); + // println(SCEOUTPUT,"Closefile"+PaO()+"'"+ADDAXES+"')"); //181224(2line) + println(SCEOUTPUT,"Closefile"+PaO()+""+Dqq("0")+")"); println(SCEOUTPUT,""); println(SCEOUTPUT,"}"); if(shchoice=="sh", println(SCEOUTPUT,""); - println(SCEOUTPUT,"quit()"); + println(SCEOUTPUT,"quit"+PPa("")); , println(SCEOUTPUT,""); - println(SCEOUTPUT,"#quit()"); + println(SCEOUTPUT,"#quit"+PPa("")); ); closefile(SCEOUTPUT); if(iswindows(), //180513from @@ -3020,14 +3148,14 @@ WritetoRS(filename,shchoice):=( tmp=Indexall(tmp1,"/"); tmp2=substring(tmp1,tmp_3-1,length(tmp1)); tmp1=substring(tmp1,0,tmp_3-1); - println(SCEOUTPUT,"Drv=shell('echo %HOMEDRIVE%',intern=TRUE)"); - println(SCEOUTPUT,"Drv=Drv[length(Drv)]"); - println(SCEOUTPUT,"Hpath=shell('echo %HOMEPATH%',intern=TRUE)"); - println(SCEOUTPUT,"Hpath=Hpath[length(Hpath)]"); + println(SCEOUTPUT,"Drv=shell"+PaO()+"'echo %HOMEDRIVE%',intern=TRUE)"); + println(SCEOUTPUT,"Drv=Drv[length"+PaO()+"Drv)]"); + println(SCEOUTPUT,"Hpath=shell"+PaO()+"'echo %HOMEPATH%',intern=TRUE)"); + println(SCEOUTPUT,"Hpath=Hpath[length"+PaO()+"Hpath)]"); println(SCEOUTPUT,"Rest="+Dqq(tmp2)); - println(SCEOUTPUT,"Path=paste(Drv,Hpath,Rest,sep='')"); - println(SCEOUTPUT,"setwd(Path)"); - println(SCEOUTPUT,"source('"+filename+"',encoding='UTF-8')"); + println(SCEOUTPUT,"Path=paste"+PaO()+"Drv,Hpath,Rest,sep='')"); + println(SCEOUTPUT,"setwd"+PaO()+"Path)"); + println(SCEOUTPUT,"source"+PaO()+"'"+filename+"',encoding='UTF-8')"); ); closefile(SCEOUTPUT); ); //180513to @@ -3071,21 +3199,21 @@ Extractdata(number,name,options):=( if(Noflg<3, println("extract outdata "+name); tmp1=parse(name); - tmp3=[ //17.09.18 - "Tmpout=ReadOutData("+Dq+File+Dq+")" + tmp3=[ //17.09.18 //no ketjs on + "Tmpout=ReadOutData("+Dq+File+Dq+")" ]; - GLIST=concat(GLIST,tmp3); + GLIST=concat(GLIST,tmp3); //no ketjs off ); if(Noflg<2, if(isstring(Ltype), - if((Noflg==0)&(color!=KCOLOR), //180904 + if((Noflg==0)&(color!=KCOLOR), //180904 //no ketjs on Texcom("{");Com2nd("Setcolor("+color+")");//180722 - ); - Ltype=GetLinestyle(text(Noflg)+Ltype,name); - if((Noflg==0)&(color!=KCOLOR), //180904 + ); //no ketjs off + Ltype=GetLinestyle(text(Noflg)+Ltype,name); + if((Noflg==0)&(color!=KCOLOR), //180904 //no ketjs on Texcom("}");//180722 - ); - , + ); //no ketjs off + , if(Noflg==1,Ltype=0); ); GCLIST=append(GCLIST,[name,Ltype,opcindy]); @@ -3175,11 +3303,11 @@ ReadOutData(pathorg,filenameorg,optionsorg):=( if(length(ptL)>0, if(length(ptL)==1, ptL=ptL_1; - tmp=apply(ptL,textformat(#,6)); + tmp=apply(ptL,Textformat(#,6)); , tmp="["; forall(ptL,tmp1, - tmp=tmp+apply(tmp1,textformat(#,6))+","; + tmp=tmp+apply(tmp1,Textformat(#,6))+","; ); tmp=substring(tmp,0,length(tmp)-1)+"]"; ); @@ -3189,7 +3317,7 @@ ReadOutData(pathorg,filenameorg,optionsorg):=( parse(varname+"="+tmp); outdt=append(outdt,ptL); ptL=[]; - varname=cmd; + varname=cmd; varL=append(varL,varname); ); ); @@ -3197,11 +3325,11 @@ ReadOutData(pathorg,filenameorg,optionsorg):=( if(length(ptL)>0, if(length(ptL)==1, ptL=ptL_1; - tmp=apply(ptL,textformat(#,6)); + tmp=apply(ptL,Textformat(#,6)); , tmp="["; forall(ptL,tmp1, - tmp=tmp+apply(tmp1,textformat(#,6))+","; + tmp=tmp+apply(tmp1,Textformat(#,6))+","; ); tmp=substring(tmp,0,length(tmp)-1)+"]"; ); @@ -3344,7 +3472,7 @@ Makeshell(texmainfile,flow):=( ); ); ); - if(flg==0, // 17.10.13(Norbert) + if(flg==0, // 17.10.13[Norbert] tex=PathT; path=""; ); @@ -3511,7 +3639,7 @@ Makebat(texmainfile,flow):=( ); ); ); - if(flg==0, // 17.10.13(Norbert) + if(flg==0, // 17.10.13[Norbert] tex=PathT; path=""; ); @@ -3597,7 +3725,7 @@ Usegraphics(gpack):=( //180817 //help:Usegraphics("pict2e"); if(!contains(ADDPACK,gpack), if(gpack =="tikz", //181213from - Addpackage(["pgf","tikz"]); + Addpackage(["pgf","tikz"]); //190101 , Addpackage([gpack]); ); //181213to @@ -3615,11 +3743,15 @@ Viewtex():=( SCEOUTPUT=openfile(texfile+".tex"); tmp="\documentclass{article}"; // 16.06.09from if(indexof(PathT,"platex")>0, - tmp=replace(tmp,"article","jarticle"); - if(indexof(PathT,"uplatex")>0, //17.08.13from - tmp=replace(tmp,"jarticle","ujarticle"); - );//17.08.13until - ); // 16.06.09until + if(GPACK=="tikz", + tmp="\documentclass[dvipdfmx]{article}"; // 190101 + , + tmp=replace(tmp,"article","jarticle"); + if(indexof(PathT,"uplatex")>0, //17.08.13from + tmp=replace(tmp,"jarticle","ujarticle"); + );//17.08.13to + ); + ); // 16.06.09to println(SCEOUTPUT,tmp); if((indexof(PathT,"pdflatex")>0)%(indexof(PathT,"lualatex")>0), //181213from if(GPACK=="tpic", GPACK="pict2e"); @@ -3636,7 +3768,7 @@ Viewtex():=( ); ); if(GPACK=="tikz", - println(SCEOUTPUT,"\usepackage[pgf,tikz}");//16.11.24 +// println(SCEOUTPUT,"\usepackage{pgf,tikz}");//190101 println(SCEOUTPUT,"\usepackage{ketpic,ketlayer}"); if(indexof(PathT,"lualatex")>0, println(SCEOUTPUT,"\usepackage{luatexja}"); @@ -3930,7 +4062,7 @@ Makehelplist(libname):=( flg=0; forall(1..3, if(flg==0, - if(substring(cmdall_#,0,7)=="start()", + if(substring(cmdall_#,0,7)=="start"+PPa(""), cmdall=cmdall_((#+1)..length(cmdall)); flg=1; ); @@ -3940,7 +4072,7 @@ Makehelplist(libname):=( tmp=length(cmdall); forall(0..2, if(flg==0, - if(substring(cmdall_(tmp-#),0,5)=="end()", + if(substring(cmdall_(tmp-#),0,5)=="end"+PPa(""), cmdall=cmdall_(1..(tmp-#-1)); flg=1; ); @@ -4467,11 +4599,11 @@ Maketitle(name):=( println(SCEOUTPUT,"title::"+name+"//"); println(SCEOUTPUT,""); println(SCEOUTPUT,"%%%%%%%%%%%%%%%%//"); - println(SCEOUTPUT,"main::(title)//"); + println(SCEOUTPUT,"main::"+PaO()+"title)//"); println(SCEOUTPUT,"\slidepage[m]//"); println(SCEOUTPUT,""); println(SCEOUTPUT,"%%%%%%%%%%%%%%%%//"); - println(SCEOUTPUT,"new::(title)//"); + println(SCEOUTPUT,"new::"+PaO()+"title)//"); println(SCEOUTPUT,"%repeat=1,para//"); println(SCEOUTPUT,"\slidepage//"); println(SCEOUTPUT,""); @@ -4504,7 +4636,7 @@ Repeatsameslide(repeatflg,sestr,addedL):=( if(sestr=="", RepeatList_nn=append(RepeatList_nn,ss); ); - ); + ); if(sestr=="", seL=[1]; , @@ -4513,7 +4645,7 @@ Repeatsameslide(repeatflg,sestr,addedL):=( tmp1=replace(tmp1,"-,","1.."); tmp1="["+tmp1+"]"; //17.01.03 seL=flatten(parse(tmp1)); //17.01.03 - ); + ); if(contains(seL,1), if(substring(ss,0,1)!="%", //16.01.04 println(SCEOUTPUT,ss); @@ -4548,7 +4680,7 @@ Repeatsameslide(repeatflg,sestr,addedL):=( if(substring(str,0,1)!="%", if(NonThinFlg==0, if(!contains(["\begi","\end{"],substring(str,0,5)),//17.01.15 - if(MiniFlg==0, //180526from + if(MiniFlg==0, //180526from println(SCEOUTPUT,"{\color[cmyk]{\thin,\thin,\thin,\thin}%");//180701 println(SCEOUTPUT,str); println(SCEOUTPUT,"}%"); @@ -4598,7 +4730,7 @@ Repeatsameslide(repeatflg,sestr,addedL):=( tmp=seL_nn; if(NonThinFlg==0, if(!contains(["\begi","\end{"],substring(str,0,5)),//180526from - if(MiniFlg==0, + if(MiniFlg==0, tmp1="{\color[cmyk]{\thin,\thin,\thin,\thin}%";//180701 tmp1=[tmp1,str,"}%"]; , @@ -4671,9 +4803,9 @@ Presentation(texfile,txtfile):=( // tmp=load(tmp1); //181125from tmp=readfile2str(Dirwork,tmp1); tmp=replace(tmp,"////","||||"); - tmp=replace(tmp,"/LF/::","::"); - tmp=replace(tmp,"///LF/","/LF/"); - slideL=tokenize(tmp,"/LF/"); //181125to + tmp=replace(tmp,"/L"+"F/::","::"); + tmp=replace(tmp,"///L"+"F/","/L"+"F/"); + slideL=tokenize(tmp,"/L"+"F/"); //181125to slideorgL=slideL; // 16.07.11 slideL=apply(slideL,Removespace(#)); tmp=select(1..length(slideL),length(slideL_#)>0); // 16.07.11from @@ -4891,7 +5023,7 @@ Presentation(texfile,txtfile):=( tmp1=""; tmp2=""; tmp3=""; - sld=removespace(slideL_ns); // 16.06.28 + sld=Removespace(slideL_ns); // 16.06.28 sestr=""; if((substring(sld,0,1)=="%") & (substring(sld,0,2)!="%%"), // 17.06.23 Repeatsameslide(repeatflg,"",[slideL_ns]); @@ -5034,7 +5166,7 @@ Presentation(texfile,txtfile):=( +text(2.5*LinkSize)+"mm}{\scalebox{"+text(LinkSize) +"}{\scriptsize $\mathstrut \!\rhd\!\!|$}}}}}"); ); - tmp="{"+text(LinkPosV)+"}{\hyperlink{para"; //180529(2lines) + tmp="{"+text(LinkPosV)+"}{\hyperlink{para"; //180529[2lines] tmp=tmp+text(paractr+1)+"pg"+text(1); tmp3=append(tmp3, text(LinkPosH)+"}"+tmp+"}{\fbox{\Ctab{" // 17.01.19 @@ -5044,7 +5176,7 @@ Presentation(texfile,txtfile):=( tmp3=apply(tmp3,tmp,"\putnotew{"+tmp); tmp4=concat(tmp4,tmp3);// 17.01.12to tmp="\putnotee{"+text(LinkPosH+1)+"}{"+text(LinkPosV)+"}";//180524 - tmp=tmp+"{\scriptsize\color{blue} "+text(#)+"/"+text(nrep)+"}"; //180524(blue) + tmp=tmp+"{\scriptsize\color{blue} "+text(#)+"/"+text(nrep)+"}"; //180524[blue] tmp4=append(tmp4,tmp); tmp4=concat(tmp4,["\end{layer}",""]);//16.12.31until Repeatsameslide(repeatflg,text([#]),tmp4); @@ -5056,7 +5188,7 @@ Presentation(texfile,txtfile):=( flg=1; ); //17.06.23to if(flg==0, - if(indexof(sld,"\begin{verbatim}")==1, // 16.06.28from + if(indexof(sld,"\begin{verbatim}")==1, // 16.06.28from Repeatsameslide(repeatflg,sestr,[slideL_ns]); verbflg=1; flg=1; @@ -5245,7 +5377,7 @@ Presentation(texfile,txtfile):=( ); if(flg==0&tmp1=="end"&(length(flgL)>0), //180526 tmp=flgL_(length(flgL)); - if(tmp=="i", + if(tmp=="i", Repeatsameslide(repeatflg,sestr,["\end{itemize}"]); ); if(tmp=="e", @@ -5329,7 +5461,7 @@ Mkslides():=( Dirwork=replace(Dirwork,"/",pathsep()); parent=replace(Dirwork+Batparent,"/",pathsep());// 16.05.29 ); - tmp=replace(Dirwork,pathsep()+"fig","");//180604(2lines) + tmp=replace(Dirwork,pathsep()+"fig","");//180604[2lines] Changework(tmp); Setdirectory(Dirwork); if(!iswindows(), //180604from @@ -5411,32 +5543,32 @@ Mkslidesummary(inputfile,outputfile,options):=( fout=outputfile; if(indexof(fout,".")==0,fout=fout+".tex"); cmdL=[ - "Dt=readLines('"+fin+"',encoding='UTF-8')",[], - "num=grep('hypertarget',Dt,fixed=TRUE)",[], //180412 - "Dt=Dt[setdiff(1:length(Dt),num)]",[], - "Smain=c();Snew=c();Ssame=c()",[], - "for(J in 1:length(Dt)){",[], - " Tmp=length(grep('mainslide{',Dt[J],fixed=TRUE))",[], //180412 - " if(Tmp>0){Smain=c(Smain,1)}else{Smain=c(Smain,0)}",[], - " Tmp=length(grep('newslide{',Dt[J],fixed=TRUE))",[], //180412 - " if(Tmp>0){Snew=c(Snew,1)}else{Snew=c(Snew,0)}",[], - " Tmp=length(grep('sameslide',Dt[J],fixed=TRUE))",[], //180412 - " if(Tmp>0){Ssame=c(Ssame,1)}else{Ssame=c(Ssame,0)}",[], + "Dt=readLines"+PaO()+"'"+fin+"',encoding='UTF-8')",[], + "num=grep"+PaO()+"'hypertarget',Dt,fixed=TRUE)",[], //180412 + "Dt=Dt[setdiff"+PaO()+"1:length"+PaO()+"Dt),num)]",[], + "Smain=c"+PPa("")+";Snew=c"+PPa("")+";Ssame=c"+PPa(""),[], + "for"+PaO()+"J in 1:length"+PaO()+"Dt)){",[], + " Tmp=length"+PaO()+"grep"+PaO()+"'mainslide{',Dt[J],fixed=TRUE))",[], //180412 + " if"+PaO()+"Tmp>0){Smain=c"+PaO()+"Smain,1)}else{Smain=c"+PaO()+"Smain,0)}",[], + " Tmp=length"+PaO()+"grep"+PaO()+"'newslide{',Dt[J],fixed=TRUE))",[], //180412 + " if"+PaO()+"Tmp>0){Snew=c"+PaO()+"Snew,1)}else{Snew=c"+PaO()+"Snew,0)}",[], + " Tmp=length"+PaO()+"grep"+PaO()+"'sameslide',Dt[J],fixed=TRUE))",[], //180412 + " if"+PaO()+"Tmp>0){Ssame=c"+PaO()+"Ssame,1)}else{Ssame=c"+PaO()+"Ssame,0)}",[], "}",[], - "Nnew=c();Nsame=c()",[], - "for(J in 1:length(Dt)){",[], - " if((Snew[J]==1)|(Smain[J]==1)){Nnew=c(Nnew,J)}",[], - " if(Ssame[J]==1){Nsame=c(Nsame,J)}",[], + "Nnew=c"+PPa("")+";Nsame=c"+PPa(""),[], + "for"+PaO()+"J in 1:length"+PaO()+"Dt)){",[], + " if"+PaO(2)+"Snew[J]==1)|"+PaO()+"Smain[J]==1)){Nnew=c"+PaO()+"Nnew,J)}",[], + " if"+PaO()+"Ssame[J]==1){Nsame=c"+PaO()+"Nsame,J)}",[], "}",[], "Out=Dt[1:Nnew[1]]",[], - "for(J in Looprange(2,length(Nnew))){",[], - " Tmp=max(c(1,Nsame[Nsame<Nnew[J]]))",[], - " Tmp=max(c(Tmp,Nnew[J-1]))+1",[], - " Out=c(Out,Dt[Tmp:Nnew[J]])",[], + "for"+PaO()+"J in Looprange"+PaO()+"2,length"+PaO()+"Nnew))){",[], + " Tmp=max"+PaO()+"c"+PaO()+"1,Nsame[Nsame<Nnew[J]]))",[], + " Tmp=max"+PaO()+"c"+PaO()+"Tmp,Nnew[J-1]))+1",[], + " Out=c"+PaO()+"Out,Dt[Tmp:Nnew[J]])",[], "}",[], - "Tmp=max(c(Nsame[-1],Nnew[-1]))+1",[], - "Out=c(Out,Dt[Tmp:length(Dt)])",[], - "writeLines(Out,'"+fout+"',sep='\n')",[] //180412(2lines removed) + "Tmp=max"+PaO()+"c"+PaO()+"Nsame[-1],Nnew[-1]))+1",[], + "Out=c"+PaO()+"Out,Dt[Tmp:length"+PaO()+"Dt)])",[], + "writeLines"+PaO()+"Out,'"+fout+"',sep='\n')",[] //180412[2lines removed] ]; CalcbyR("",cmdL,append(options,"Cat=n"));//180412 wait(1000); @@ -5482,8 +5614,8 @@ Example(exorg,suborg):=( ////%Example end//// ////%BBdata start//// -BBdata():=Bbdata(BBTarget,0); -BBdata(fname):=Bbdata(fname,0); // 16.04.09 +BBdata():=BBdata(BBTarget,0); +BBdata(fname):=BBdata(fname,0); // 16.04.09 BBdata(fname,optionorg):=( //help:BBdata(filename); //help:BBdata(options=0(automatic),1(make),"w=","h="); @@ -5506,7 +5638,7 @@ BBdata(fname,optionorg):=( if(path=="",path=Dirwork);//16.10.05 if(indexof(file,".")==0,file=file+".pdf"); if(islist(optionorg),options=optionorg,options=[optionorg]); - tmp=divoptions(options); + tmp=Divoptions(options); eqL=tmp_5; reL=tmp_6; stL=tmp_7; @@ -5612,13 +5744,13 @@ BBdata(fname,optionorg):=( tmp=tmp_2; // tmp1=indexof(tmp,":"); tmp=substring(tmp,tmp1,length(tmp)); - tmp=removespace(tmp); + tmp=Removespace(tmp); tmp=tokenize(tmp," "); tmp1=""; forall(tmp, tmp1=tmp1+Sprintf(#,2)+" "; ); - tmp1=removespace(tmp1)+addop; + tmp1=Removespace(tmp1)+addop; tmp2="\includegraphics[bb="+tmp1+"]{"+file+"}"; println(tmp2); ); @@ -5628,5 +5760,528 @@ BBdata(fname,optionorg):=( ); ////%BBdata end//// +////%Findfun start//// +Findfun(name,lineorg):=( + regional(line,sep,pL,jj,kk,flg,rmv,out,tmp,tmp1,tmp2); + line=Removespace(lineorg); + rmv=[name,"regional","forall","if","text","curkernel","append","concat"]; + rmv=concat(rmv,["append","apply","allelements","indexof"]); + rmv=concat(rmv,["substring","select","isstring","length"]); + rmv=concat(rmv,["round","unicode","openfile","closefile","println","replace"]); + rmv=concat(rmv,["setdirectory","parse","tokenize","import","load","ispoint"]); + rmv=concat(rmv,["isreal","layer","autoclearlayer","drawpoly","allcircles"]); + rmv=concat(rmv,["floor","flatten","prepend","islist","print","mod","abs","sum"]); + rmv=concat(rmv,["cos","sin","tan","arccos","arcsin","arctan","sqrt","reverse","re"]); + rmv=concat(rmv,["sort","contains","max","min","allpoints","isselected","common"]); + rmv=concat(rmv,["inspect","iscircle","alllines","repeat","remove","format"]); + rmv=concat(rmv,["ceil","while","dist","det","exp","err","arctan2","fillpoly"]); + rmv=concat(rmv,["drawtext","mouse","allsegments","createpoint","create"]); + rmv=concat(rmv,["gsave","connect","draw","grestore","wait"]); + +// rmv=concat(rmv,["d","list","c","funN","funP","function","for","return"]); // in string (for R) +// rmv=concat(rmv,["gsub","cat"]); // in string (for R) +// rmv=concat(rmv,["options"]); // written for Windows +// rmv=concat(rmv,["isexists"]); // java functions + + sep=[""," ",",","=","(","+","-","*","/","^","_","[",".","!","&","%",Dq,";",">","<",unicode("0009")]; + out=[]; + if(substring(line,0,2)!="//", + pL=Indexall(line,"("); + forall(pL,jj, + flg=0; + if(contains(pL,jj-1), flg=1); + forall(reverse(1..(jj-1)), + if(flg==0, + if(#==1, + tmp=substring(line,0,1); + if(contains(sep,tmp), + tmp=substring(line,1,jj-1); + , + tmp=substring(line,0,jj-1); + ); + flg=1; + ); + ); + if(flg==0, + tmp=substring(line,#-1,#); + if(contains(sep,tmp), + tmp=substring(line,#,jj-1); + if(indexof(substring(line,0,#-1),"//")==0, + flg=1; + ); + ); + ); + ); + if((flg==1)&(length(tmp)>0), + out=append(out,tmp); + ); + ); + ); + out=remove(out,rmv); + tmp=out; + out=[]; + forall(tmp, + if(!contains(out,#),out=append(out,#)); + ); + out; +); +////%Findfun end//// + +////%Extractfun start//// +Extractfun(strL):=( + regional(nL,str,str2,start,sep,out,tmp,tmp1,tmp2); + out=[]; + forall(strL,str, + nL=Indexall(str,Dq); + str2=""; + start=0; + forall(1..(length(nL)/2), + tmp1=nL_(2*#-1); + str2=str2+substring(str,start,tmp1-1); + start=nL_(2*#); + ); + str2=str2+substring(str,start,length(str)); + fL=Findfun("csdraw",str2); + out=remove(out,fL); + out=concat(out,fL); + ); +); +////%Extractfun end//// + +//DL1=Readcsv(Dirhead+pathsep()+"ketcindyjs","basic1list.txt"); +//DL2=Readcsv(Dirhead+pathsep()+"ketcindyjs","basic2list.txt"); +//DL=concat(DL1,DL2); +//Out=[]; + +////%Extractall start//// +Extractall(name):=( + regional(fL,jj,tmp,tmp1,tmp2,tmp3); + fL=apply(Out,#_1); + tmp1=select(DL,#_1==name); + if(length(tmp1)>0, + tmp1=tmp1_1; + if(!contains(fL,tmp1), + Out=append(Out,tmp1); + fL=append(fL,tmp1_1); + if(length(tmp1)>=5, + forall(5..(length(tmp1)),jj, + tmp=tmp1_jj; + if(!contains(fL,tmp), + Extractall(tmp); + ); + ); + ); + ); + ); + tmp1=Out; + Out=[]; + forall(1..(length(tmp1)), + if(!contains(Out,tmp1_#), + Out=append(Out,tmp1_#); + ); + ); + Out; +); +////%Extractall end//// + +////%Copyketcindyjs start//// 190128 +Copyketcindyjs():=( + regional(tmp,tmp1,tmp2,drive,fname); + if(iswindows(), + drive="C:"; + fname=Dirhead; + tmp=indexof(fname,":"); + if(tmp>0, + drive=substring(Dirwork,0,tmp); + fname=substring(fname,tmp,length(fname)); + ); + kc():=( + println("kc : "+kc(Dirwork+Batparent,Dirlib,Fnametex)); // 16.06.04 + ); + SCEOUTPUT = openfile(Batparent); + println(SCEOUTPUT,drive); + println(SCEOUTPUT,"cd "+Dqq(fname)); + println(SCEOUTPUT,"set xcp="+Dqq("\Windows\System32\xcopy")); + tmp1=Dqq("%xcp%")+" /Y /Q /S /E /R "+Dqq("ketcindyjs\"); + tmp2=" "+Dqq(Dircdy+"ketcindyjs\"); + println(SCEOUTPUT,tmp1+"Cindy.js.map"+tmp2); + println(SCEOUTPUT,tmp1+"webfont.js"+tmp2); + println(SCEOUTPUT,tmp1+"katex-plugin.js"+tmp2); + println(SCEOUTPUT,tmp1+"Cindy.js"+tmp2); + println(SCEOUTPUT,tmp1+"CindyJS.css"+tmp2); + tmp1=Dqq("%xcp%")+" /Y /Q /S /E /R "+Dqq("ketcindyjs\katex\"); + tmp2=" "+Dqq(Dircdy+"ketcindyjs\katex\"); + println(SCEOUTPUT,tmp1+"katex.min.css"+tmp2); + println(SCEOUTPUT,tmp1+"katex.min.js"+tmp2); + tmp1=Dqq("%xcp%")+" /Y /Q /S /E /R "+Dqq("ketcindyjs\katex\fonts\"); + tmp2=" "+Dqq(Dircdy+"ketcindyjs\katex\fonts\"); + println(SCEOUTPUT,tmp1+"KaTeX_Main-Regular.ttf"+tmp2); + println(SCEOUTPUT,tmp1+"KaTeX_Main-Regular.woff"+tmp2); + println(SCEOUTPUT,tmp1+"KaTeX_Main-Regular.woff2"+tmp2); + println(SCEOUTPUT,tmp1+"KaTeX_Math-Italic.ttf"+tmp2); + println(SCEOUTPUT,tmp1+"KaTeX_Math-Italic.woff"+tmp2); + println(SCEOUTPUT,tmp1+"KaTeX_Math-Italic.woff2"+tmp2); + println(SCEOUTPUT,"exit 0"); + closefile(SCEOUTPUT); + , + kc():=( + println("kc : "+kc(Dirwork+Shellparent,Mackc+Dirlib,Fnametex)); + ); + SCEOUTPUT = openfile(Shellparent); + println(SCEOUTPUT,"#!/bin/sh"); + println(SCEOUTPUT,"cd "+Dqq(Dirhead)); + println(SCEOUTPUT,"cp -r -p ketcindyjs "+Dircdy+"/"); + println(SCEOUTPUT,"exit 0"); + closefile(SCEOUTPUT); + ); + kc(); +); +////%Coptketcindyjs end//// + +////%Ketjsoption start//// 190201 +Ketjsoption():=Setketcindyjs(); +Ketjsoption(list):=Setketcindyjs(list); +////%Ketjsoption end//// + +////%Setketcindyjs start//// 190201 +Setketcindyjs():=( + KETJSOP; +); +Setketcindyjs(list):=( +//help:Setketcindyjs(); +//help:Setketcindyjs(["Local=(n)","Scale=(1)","Nolabel=[]"]); + regional(eqL,color,tmp); + tmp=Divoptions(list); + eqL=tmp_5; + tmp=tmp_(length(tmp)); + tmp=substring(tmp,1,length(tmp)); + tmp=replace(tmp,"->","="); + parse(tmp); + tmp=round(255*color); + if(color!=[0,0,0],eqL=append(eqL,"Color="+text(tmp))); + KETJSOP=eqL; + KETJSOP; +); +////%Setketcindyjs end//// + +////%Mkketcindyjs start//// 190115 +Mkketcindyjs():=Mkketcindyjs(KETJSOP); //190129 +Mkketcindyjs(options):=( //17.11.18 +//help:Mkketcindyjs(); +//help:Mkketcindyjs(options=["Local=(n)","Scale=(1)","Nolabel=[]","Color=","Grid="]); +//help:Mkketcindyjs(optionsadd=["Web=(y)","Path=Dircdy"]); + regional(webflg,localflg,htm,htmorg,from,upto,flg,fL,fun,jj,tmp,tmp1,tmp2,tmp3, + lib1,lib2,jc,nn,name,partL,toppart,lastpart,path,ketflg,flg,cmdL,scale,nolabel, + color,grid,out,igL,DL,Out); + webflg="Y"; //190128 texflg removed + localflg="N"; //190128 + scale=1; //190129 + nolabel=["SW","NE"]; //190129 + color=""; + grid=""; + path=Dircdy; + forall(options, + tmp=Strsplit(#,"="); + tmp1=Toupper(substring(tmp_1,0,1)); + tmp2=tmp_2; + if(tmp1=="W", + webflg=Toupper(substring(tmp2,0,1)); + ); + if(tmp1=="L", + localflg=Toupper(substring(tmp2,0,1)); + ); + if(tmp1=="S", + scale=parse(tmp2); + ); + if(tmp1=="N", + tmp=tmp2; + if(indexof(tmp2,"[")>0, + tmp=substring(tmp2,1,length(tmp2)-1); + ); + tmp=tokenize(tmp,","); + nolabel=concat(nolabe,tmp); + ); + if(tmp1=="C", + color=tmp2; + if(substring(color,0,1)=="[", //190130from + color=substring(color,1,length(color)-1); + ); //190130to + ); + if(tmp1=="G", + grid=tmp2; + ); + if(tmp1=="P", + if(!tmp2="Dircdy", + path=tmp2; + ); + ); + ); + if((webflg=="N")&(localflg=="Y"), + if(!isexists(Dircdy,"ketcindyjs"), + Copyketcindyjs(); + println("ketcindyjs has been copied"); + ); + ); + if(!isexists(Dircdy,Fhead+".html"), + drawtext(mouse().xy-[0,1],"'Write/Rewrite to CindyJS' at first",size->24,color->[1,0,0]); + wait(3000); + , + htmorg=Readlines(Dircdy,Fhead+".html"); + tmp=select(1..(length(htmorg)),indexof(htmorg_#,"id="+Dqq("csdraw"))>0); + from=tmp_1+1; + flg=0; + forall(from..(length(htmorg)), + if(flg==0, + if(indexof(htmorg_#,"</script>")>0, + upto=#-1; + flg=1; + ); + ); + ); + fL=Extractfun(htmorg_(from..upto)); + DL=Readcsv(Dirhead+pathsep()+"ketcindyjs","basic1list.txt"); + tmp=Readcsv(Dirhead+pathsep()+"ketcindyjs","basic2list.txt"); + DL=concat(DL,tmp); //DL and Out arenecessary for Extractall + Out=[]; + forall(fL,fun, + Extractall(fun); + ); + tmp=Readlines(Dirhead+pathsep()+"ketcindyjs","ignoredfun.txt"); + tmp=apply(tmp,Removespace(#)); //190131 + igL=select(tmp,(length(#)>0)&(substring(#,0,2)!="//")); //190131 + tmp1=select(Out,contains(igL,#_1)); + Out=remove(Out,tmp1); USEDFUN=apply(Out,#_1); //190130 + tmp1=select(1..(length(htmorg)),indexof(htmorg_#,"script id=")>0); + partL=[]; + forall(tmp1,nn, + from=nn; + tmp2=htmorg_from; + tmp=Indexall(tmp2,Dq); + name=substring(tmp2,tmp_1,tmp_2-1); + tmp=select((from+1)..(length(htmorg)),indexof(htmorg_#,"</script>")>0); + upto=tmp_1; + partL=append(partL,[name,from,upto]); + ); + tmp=apply(partL,#_2); + tmp=min(tmp)-1; + toppart=[1,tmp]; + tmp=apply(partL,#_3); + tmp=max(tmp)+1; + lastpart=[tmp,length(htmorg)]; + if(webflg=="Y", + tmp1=Fhead+"json.html"; + , + tmp1=Fhead+"jsoff.html"; + ); + setdirectory(path); + SCEOUTPUT = openfile(tmp1); + tmp1=htmorg_((toppart_1)..(toppart_2)); + if(webflg=="N", + if(localflg=="N", //190128 + tmp3=replace(Dirhead+"/ketcindyjs/",pathsep(),"/"); + tmp= " <link rel="+Dqq("stylesheet")+" href="; + tmp=tmp+Dq+"file:///"+tmp3+"CindyJS.css"+Dq+">"; + tmp1_(length(tmp1)-2)=tmp; + tmp= " <script type="+Dqq("text/javascript")+" src="; + tmp=tmp+Dq+"file:///"+tmp3+"Cindy.js"+Dq+"></script>"; + tmp1_(length(tmp1)-1)=tmp; + tmp=" <script type="+Dqq("text/javascript")+" src="; //190117from + tmp1_(length(tmp1))=""; //190120 + , + tmp1_(length(tmp1)-2)= //190128from + " <link rel="+Dqq("stylesheet")+" href="+Dqq("ketcindyjs/CindyJS.css")+">"; //190203 + tmp1_(length(tmp1)-1)= + " <script type="+Dqq("text/javascript")+" src="+Dqq("ketcindyjs/Cindy.js")+"></script>"; //190203 + tmp1_(length(tmp1))=""; //190128to + ); + , + tmp1_(length(tmp1))=""; //190117to + ); + forall(tmp1, + println(SCEOUTPUT,#); + ); + tmp="<script id="+Dqq("csinit")+" type="; + tmp=tmp+Dqq("text/x-cindyscript")+">"; + println(SCEOUTPUT,tmp); + tmp=Readlines(Dirhead+pathsep()+"ketcindyjs","commonused.txt"); + forall(tmp, + println(SCEOUTPUT,#); + ); + lib1=Readlines(Dirhead+"/ketlib","ketcindylibbasic1r.cs"); + lib2=Readlines(Dirhead+"/ketlib","ketcindylibbasic2r.cs"); + forall(Out,fun, + libf=fun_2;from=fun_3;upto=fun_4; + if(indexof(libf,"basic1")>0, + tmp1=lib1_(from..upto); + , + tmp1=lib2_(from..upto); + ); + ketflg="off"; //190122from + forall(tmp1, + if(indexof(#,"no ketjs")>0, + if(indexof(#,"no ketjs on")>0, + ketflg="on"; + ); + if(indexof(#,"no ketjs off")>0, + ketflg="off"; + ); + , + if(ketflg=="off", + tmp=Removespace(#); + if(substring(tmp,0,2)!="//", + println(SCEOUTPUT,#); + ); + ); //190122to + ); + ); + ); + tmp=select(partL,#_1=="csinit"); + if(length(tmp)>0, + tmp=tmp_1; + from=tmp_2; + upto=tmp_3; + tmp1=htmorg_((from+1)..(upto-1)); //190119 + forall(tmp1, + if((indexof(#,"import(")==0)&(indexof(#,"use(")==0), + println(SCEOUTPUT,#); + ); + ); + ); + println(SCEOUTPUT,"</script>"); + tmp=select(partL,#_1=="csdraw"); + tmp=tmp_1; + from=tmp_2; + upto=tmp_3; + tmp1=htmorg_(from..upto); + ketflg="off"; //190202from + forall(tmp1, + if(indexof(#,"no ketjs")>0, + if(indexof(#,"no ketjs on")>0, + ketflg="on"; + ); + if(indexof(#,"no ketjs off")>0, + ketflg="off"; + ); + , + if(ketflg=="off", + tmp=Removespace(#); + if(substring(tmp,0,2)!="//", + println(SCEOUTPUT,#); + ); + ); + ); + ); + tmp1=htmorg_((lastpart_1)..(lastpart_2)); + tmp=select(1..(length(tmp1)),indexof(tmp1_#,Dqq("cs*"))>0); + tmp=tmp_1; + forall(1..tmp, //190117from + println(SCEOUTPUT,tmp1_#); + ); + from=tmp+1; //190117to + tmp=" use: ["+Dqq("katex")+"],"; + println(SCEOUTPUT,tmp); + out=[]; //190129 + forall(from..(length(tmp1)),jj, + flg=0; //190126from + tmp2=["Figure","Parent","ParaF","Anime","Flip","Title","Slide","Digest", + "KeTJS","KeTJSoff","Objview"]; + if(indexof(tmp1_jj,"type: "+Dqq("Button"))>0, + nn=indexof(tmp1_jj,"text: "); + tmp=substring(tmp1_jj,nn-1,length(tmp1_jj)); + nn=Indexall(tmp,Dq); + tmp=substring(tmp,nn_1,nn_2-1); + if(!contains(tmp2,tmp), + out=append(out,tmp1_jj); //190129 + ); + flg=1; + ); + if(flg==0, + tmp=indexof(tmp1_jj,"type: "+Dq+"Free")+indexof(tmp1_jj,"type: "+Dq+"Point"); + if(tmp>0, + tmp2=tmp1_jj; + tmp=Indexall(tmp2,Dq); //190129from + tmp=substring(tmp2,tmp_1,tmp_2-1); + if(contains(nolabel,tmp), + if(indexof(tmp2,"labeled: true")>0, + tmp2=replace(tmp2,"labeled: true","labeled: false"); + ); + ); + if(indexof(tmp2,"size:")==0, + tmp2=replace(tmp2,"}",", size: 3.0}"); + out=append(out,tmp2); //190129 + , + out=append(out,tmp2); //190129 + ); //190129to + flg=1; + ); + ); + if(flg==0, + out=append(out,tmp1_jj); //190129 + ); //190126to + ); + tmp=select(1..(length(out)),indexof(out_#," ],")>0); //190129from + tmp=tmp_1; + tmp1=out_(tmp-1); + if(substring(tmp1,length(tmp1)-1,length(tmp1))==",", //190201from + out_(tmp-1)=substring(tmp1,0,length(tmp1)-1); + ); //190201to + tmp=select(1..(length(out)),indexof(out_#,"width:")>0); + jj=tmp_1; + tmp1=out_jj; + flg=0; + forall(1..(length(tmp1)-1), + if(flg==0, + tmp=substring(tmp1,#-1,#); + if(tmp==":", + tmp2=substring(tmp1,#+1,length(tmp1)-1); + flg=1; + ); + ); + ); + tmp=round(scale*parse(tmp2)); + out_jj=" width: "+text(tmp)+","; + tmp=select(1..(length(out)),indexof(out_#,"height:")>0); + jj=tmp_1; + tmp1=out_jj; + flg=0; + forall(1..(length(tmp1)-1), + if(flg==0, + tmp=substring(tmp1,#-1,#); + if(tmp==":", + tmp2=substring(tmp1,#+1,length(tmp1)-1); + flg=1; + ); + ); + ); + tmp=round(scale*parse(tmp2)); + out_jj=" height: "+text(tmp)+","; + if(length(color)>0, + tmp=select(1..(length(out)),indexof(out_#,"background: ")>0); + jj=tmp_1; + tmp=indexof(out_jj,")"); //190130from + tmp=substring(out_jj,tmp-1,length(out_jj)); + out_jj=" background: "+Dq+"rgb("+color+tmp; //190130to + ); + if(length(grid)>0, + tmp=select(1..(length(out)),indexof(out_#,"grid:")>0); + jj=tmp_1; + tmp1=" grid: "+grid; + if(indexof(out_jj,",")>0, + tmp1=tmp1+","; + ); + out_jj=tmp1; + ); + forall(out, + println(SCEOUTPUT,#); + ); //190129to + closefile(SCEOUTPUT); + setdirectory(Dirwork); + if(webflg=="Y",tmp="json",tmp="jsoff"); + drawtext(mouse().xy-[0,1],tmp+"in "+path,size->20,color->[1,0,0]); + wait(1000); + ); +); +////%Mkketcindyjs end//// + //help:end(); |