summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibmvr.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibmvr.cs')
-rwxr-xr-x[-rw-r--r--]Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibmvr.cs362
1 files changed, 218 insertions, 144 deletions
diff --git a/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibmvr.cs b/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibmvr.cs
index e9978e7b653..a538afd1330 100644..100755
--- a/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibmvr.cs
+++ b/Master/texmf-dist/scripts/ketcindy/ketlib/ketcindylibmvr.cs
@@ -14,12 +14,12 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>
//
-println("ketcindymv(20171124) loaded");
+println("ketcindymv(20180614) loaded");
//help:start();
-Setpara(path,fstr,sL):=Setpara(path,fstr,sL,[],[]); // 16.12.27added
-Setpara(pathorg,fstr,sL,options):= //17.11.25(3lines)
+Setpara(path,fstr,sL):=Setpara(path,fstr,sL,[],[]);
+Setpara(pathorg,fstr,sL,options):=
Setpara(pathorg,fstr,sL,options,[]);
Setpara(pathorg,fstr,sL,options,optionsanim):=(
//help:Setpara("folder name","funstr","range",options,optionsanim);
@@ -29,13 +29,31 @@ Setpara(pathorg,fstr,sL,options,optionsanim):=(
//help:Setpara(options2anim2=["OpA=[loop,controls,buttonsize=3mm]"]);
//help:Setpara(options2anim3=["OpA=+step"]);
//help:Setpara(options2anim4=["Mag=1600","Title=folder"]);
- regional(path);//17.04.10
+ regional(path,tmp,tmp1,tmp2,tmp3,eqL,ndiv,gtmp,ctmp,nn,flg);
if(length(pathorg)==0, path=Slidename,path=pathorg);//17.04.10
ParaPath=path;
ParaFstr=fstr;
ParaSL=sL;
+ if(isstring(sL),
+ ndiv=25;
+ tmp=Divoptions(options);
+ eqL=tmp_5;
+ forall(eqL,
+ tmp=Strsplit(#,"=");
+ tmp1=Toupper(tmp_1);
+ if(substring(tmp1,0,1)=="D",
+ ndiv=parse(tmp_2);
+ );
+ );
+ tmp=Strsplit(sL,"=");
+ tmp1=parse(tmp_2);
+ ParaSL=apply(0..ndiv,tmp1_1+#*(tmp1_2-tmp1_1)/ndiv);
+ );
ParaOp=options;
- ParaOpAnim=optionsanim; //17.11.25
+ if((!contains(Paraop,"r"))&(!contains(ParaOp,"m")),
+ ParaOp=append(ParaOp,"m");//180604
+ );
+ ParaOpAnim=optionsanim;
GLISTback=GLIST;
GCLISTback=GCLIST;
GOUTLISTback=GOUTLIST;
@@ -46,167 +64,207 @@ Setpara(pathorg,fstr,sL,options,optionsanim):=(
COM0thlistback=COM0thlist;
COM1stlistback=COM1stlist;
COM2ndlistback=COM2ndlist;
+ Dirworkbkup=Dirwork; //0611from
+ Dirworksubbkup=Dirwork+pathsep()+ParaPath;
+ Changework(Dirworksubbkup);
+ Changework(Dirworkbkup);
+ Fheadbkup=Fhead; //0611to
+ gtmp=GLISTback;
+ tmp1=select(1..(length(gtmp)),indexof(gtmp_#,"ReadOutData")>0); //180614from
+ tmp2=[];tmp3=[];
+ forall(tmp1,nn,
+ tmp2=append(tmp2,nn);
+ flg=0;
+ tmp=min([nn+40,length(gtmp)]);
+ forall((nn+1)..tmp,
+ if(flg==0,
+ if(indexof(gtmp_#,"Projpara")>0,
+ tmp2=append(tmp2,#);
+ tmp=indexof(gtmp_#,"=");
+ tmp=substring(gtmp_#,0,tmp-1);
+ tmp3=append(tmp3,tmp);
+ ,
+ flg=1;
+ );
+ );
+ );
+ );
+ tmp1=remove(1..(length(gtmp)),tmp2);
+ GLISTback=apply(tmp1,GLIST_#); //180614to
+ ctmp=COM2ndlistback; //180614
+ forall(tmp3,tmp2,
+ tmp=select(ctmp,indexof(#,tmp2)>0);
+ ctmp=remove(ctmp,tmp);
+ );
+ COM2ndlistback=ctmp;
);
-Parafolder():=Parafolder(ParaPath,ParaFstr,ParaSL,ParaOp);
-Parafolder(path,fstr,sL):=Parafolder(path,fstr,sL,[]);
-Parafolder(path,fstr,sLorg,optionorg):=(
+Parafolder():=Parafolder(ParaFstr,ParaSL,ParaOp);
+Parafolder(fstr,sL):=Parafolder(fstr,sL,[]);
+Parafolder(fstr,sL,optionorg):=(
//help:Parafolder(foldername,1..4);
//help:Parafolder(foldername,"s=[0,1]");
//help:Parafolder("mf(s)",foldername,"s=[0,1]");
-//help:Parafolder(options=["m/r","Div=25","Wait=20"]);
+//help:Parafolder(options=["m/r","Div=25","Wait=20"]);
+//help:Parafolder(optionsadd=[""Outfile=n",Pause=10(ms)"]);
//help:Paraslide(para=folder:layery:pos:input,scale);
//help:Paraslide(para=folder:layery:pos:include:[width=100]);
- regional(nn,sL,tmp,tmp1,tmp2,strL,eqL,waiting,
- mkr,mktex,ndiv,options,sfL);
- if(!isstring(ParaPath),
- println("Setpara not executed");
- ,
- sL=sLorg;//16.12.24from
- if(!isstring(sL),
- tmp=indexof(fstr,"(");
- tmp1=substring(fstr,tmp,length(fstr));
- tmp=indexof(tmp1,")");
- tmp1=substring(tmp1,0,tmp-1);
- ,
- tmp=indexof(sL,"=");//16.12.21from
- if(length(tmp)>0,
- tmp1=substring(sL,0,tmp-1);
- );
+ regional(nn,tmp,tmp1,tmp2,strL,eqL,waiting,outflg,pause,
+ mkr,mktex,options,sfL,dirbkup,fbkup,pfile,ctr,flg,varL);
+ Changework(Dirworkbkup);
+ Setfiles(Fheadbkup);
+ tmp=indexof(fstr,"(");
+ tmp1=substring(fstr,tmp,length(fstr));
+ tmp=indexof(tmp1,")");
+ tmp1=substring(tmp1,0,tmp-1);
+ parse("Movieframe("+tmp1+"):="+fstr);
+ options=optionorg;
+ tmp=Divoptions(options);
+ eqL=tmp_5;
+ strL=tmp_7;
+ if(length(strL)==0,options=append(options,"m"));
+ mkr="A";
+ mktex="A";
+ waiting=20;
+ outflg=0;
+ pause=10;
+ forall(eqL,
+ tmp=Strsplit(#,"=");
+ tmp1=Toupper(substring(tmp_1,0,1));
+ if(tmp1=="W",
+ waiting=parse(tmp_2);
+ options=remove(options,[#]);
);
- parse("Movieframe("+tmp1+"):="+fstr);
- options=optionorg;
- tmp=Divoptions(options);
- eqL=tmp_5;
- strL=tmp_7;
- if(length(strL)==0,options=append(options,"m"));//16.12.18
- mkr="A";
- mktex="A";
- ndiv=25;
- waiting=20;
- forall(eqL,
- tmp=Indexof(#,"=");
- tmp1=Toupper(substring(#,0,1));
- tmp2=substring(#,tmp,length(#));
- if(tmp1=="D",
- ndiv=parse(tmp2);
- options=remove(options,[#]);
- );
- if(tmp1=="W",
- waiting=parse(tmp2);
- options=remove(options,[#]);
- );
+ if((tmp1=="O")%(tmp1=="R"), //180606from
+ tmp=Toupper(substring(tmp_2,0,1));
+ if(tmp=="Y", outflg=1);
+ options=remove(options,[#]);
);
- forall(strL,
- tmp1=Toupper(substring(#,0,1));
- if(tmp1=="M",
- mkr="Y"; mktex="Y";
- );
+ if(tmp1=="P", //180610from
+ pause=parse(tmp_2);
+ options=remove(options,[#]);
+ ); // //180610to
+ );
+ forall(strL,
+ tmp1=Toupper(substring(#,0,1));
+ if(tmp1=="M",
+ mkr="Y"; mktex="Y";
);
- sL=sLorg;
- if(isstring(sL),
- tmp=indexof(sL,"=");
- tmp1=parse(substring(sL,tmp,length(sL)));
- sL=apply(0..ndiv,tmp1_1+#*(tmp1_2-tmp1_1)/ndiv);
+ );
+ Changework(Dirworksubbkup);
+ SCEOUTPUT = openfile("all.r");
+ println(SCEOUTPUT,"");
+ closefile(SCEOUTPUT);//180608to
+ if(outflg==1, //180606from
+ CommonMake=1;//180609
+ ctr=1;
+ forall(sL,
+ tmp="000000"+text(ctr);
+ pfile="p"+substring(tmp,length(tmp)-3,length(tmp));
+ Setfiles(pfile);
+ Changework(Dirworksubbkup);
+ Movieframe(#);
+ Changework(Dirworksubbkup);//180608
+ ctr=ctr+1;
);
- if(!isexists(Dirwork,path),
- if(ErrFlag!=-1,
- makedir(Dirwork,path)
- ,
- println(" ==> Changework may not work properly");
- sL=[];
- );
+ CommonMake=-1;//180609
+ Setfiles(fbkup);
+ ); //180606to
+ wait(pause); //180610
+// Changework(Dirworkbkup);
+ sfL=[];
+ ctr=1;
+ forall(1..(length(sL)),nn,
+ Changework(Dirworkbkup);//180611(2lines)
+ Setfiles(Fheadbkup);
+ GLIST=GLISTback;
+ GCLIST=GCLISTback;
+ GOUTLIST=GOUTLISTback;
+ POUTLIST=POUTLISTback;
+ VLIST=VLISTback;
+ FUNLIST=FUNLISTback;
+ LETTERlist=LETTERlistback;
+ COM0thlist=COM0thlistback;
+ COM1stlist=COM1stlistback;
+ COM2ndlist=COM2ndlistback;
+ tmp="000000"+text(nn);
+ pfile="p"+substring(tmp,length(tmp)-3,length(tmp));
+ Setfiles(pfile);
+ Changework(Dirworksubbkup);
+ sfL=append(sfL,FnameR);
+ if(outflg==1,
+ Changework(Dirworksubbkup);//180606
+ Setfiles(pfile); //180610(2lines)
+ wait(pause);
+ Movieframe(sL_nn);
+ Changework(Dirworksubbkup);//180606
+ ctr=ctr+1;
,
- tmp=fileslist(Dirwork+pathsep()+path); //17.12.09(3lines);
- tmp=length(tmp);
- if((mkr=="Y") & (tmp>0),
- tmp1=replace(Dirwork,"\","/");//17.10.13
- cmdL=[
- "setwd",[Dq+tmp1+"/"+path+Dq],
- "fL=as.matrix(list.files())",[],
- "apply",["fL",2,"file.remove"],
- "setwd",[Dq+tmp1+Dq],
- ];
- CalcbyR("rvf",cmdL,["Cat=n","m"]);
- tmp=Dirwork+pathsep()+path;
- repeat(1..30,
- if(length(fileslist(tmp))>0,wait(10));
- );
- );//17.02.20until
- );
- sfL=[];
- forall(1..(length(sL)),nn,
- GLIST=GLISTback;
- GCLIST=GCLISTback;
- GOUTLIST=GOUTLISTback;
- POUTLIST=POUTLISTback;
- VLIST=VLISTback;
- FUNLIST=FUNLISTback;
- LETTERlist=LETTERlistback;
- COM0thlist=COM0thlistback;
- COM1stlist=COM1stlistback;
- COM2ndlist=COM2ndlistback;
- tmp1=Sprintf(nn/1000,3);
- tmp=indexof(tmp1,".");
- tmp1=substring(tmp1,tmp,length(tmp1));
- FnameR=path+"/p"+tmp1+".r";
- sfL=append(sfL,FnameR);
- Fnametex=replace(FnameR,".r",".tex");
- Movieframe(sL_nn); //17.10.13
- if(!isexists(Dirwork,FnameR) % mkr=="Y",
- if(ErrFlag!=-1,
- WritetoRS(2); //17.12.09
- );
+ Movieframe(sL_nn);
+ );
+ CommonMake=0;//180609
+ Setfiles(pfile); //180608
+ if(!isexists(Dirworksubbkup,FnameR) % mkr=="Y",
+ if(ErrFlag!=-1,
+ WritetoRS(2);
);
- );
- tmp1=replace(Dirwork,"\","/"); //17.10.13
- cmdL=[
- "setwd",[Dq+tmp1+"/"+path+Dq],
- "Mkallfile=function(fname){",[],
- " Ctr<<- Ctr+1",[],
- " tmp=readLines(fname)",[],
- " first=1",[],
- " if(Ctr>1){",[],
- " first=7",[],
- " cat('Ketinit()\n',file='all.r',append=TRUE)",[],
+ );
+ );
+ wait(pause); //180610
+ Setfiles(fkbkup);
+ Changework(Dirworksubbkup);
+ GLIST=select(GLIST,indexof(#,"Projpara")==0);
+ tmp1=replace(Dirworksubbkup,"\\","/"); //180611
+ tmp1=replace(tmp1,"\","/");
+ cmdL=[
+ "setwd("+Dqq(tmp1)+")",[],
+ "size="+text(length(sL)),[],
+ "cat('',file='all.r',sep='',append=FALSE)",[], //180614
+ "for(n in Looprange(1,size)){",[],
+ " tmp=as.character(n)",[],
+ " tmp=paste('0000',tmp,sep='')",[],
+ " tmp=substring(tmp,nchar(tmp)-2,nchar(tmp))",[],
+ " fname=paste('p',tmp,'.r',sep='')",[],
+ " lines=readLines(fname)",[],
+ " if(n>1){",[], //180614from
+ " for(j in 1:length(lines)){",[],
+ " tmp=grep('source',lines[j],fixed=TRUE)",[],
+ " if(length(tmp)>0){",[],
+ " lines[j]=paste('#',lines[j],sep='')",[],
+ " lines[j+2]=paste('#',lines[j+2],sep='')",[],
+ " break",[],
+ " }",[],
+ " }",[],
" }",[],
- " for(J in first:(length(tmp)-1)){",[],
- " cat(paste(tmp[J],'\n',sep=''),file='all.r',append=TRUE)",[],
+ " lines=lines[1:(length(lines)-1)]",[], //180614to
+ " tmp=paste('print(',as.character(n),')',sep='')",[],
+ " lines=c(tmp,lines)",[],
+ " for(j in Looprange(1,length(lines))){",[],
+ " cat(lines[j],file='all.r',sep='\n',append=TRUE)",[],
" }",[],
- " cat('print(',Ctr,')\n',file='all.r',append=TRUE)",[],
- " Tmp=proc.time()-Tm",[],
- " cat('print(',Tmp[3],')\n',file='all.r',append=TRUE)",[],
- "}",[],
- "if(file.exists('all.r')){file.remove('all.r')}",[], //17.10.24
- "fL=list.files()",[],
- "Ctr=0",[],
- "Tm<-invisible(proc.time())",[],
- "for(fname in fL){",[],
- " if(length(grep('.r',fname))>0){Mkallfile(fname)}",[], // 17.11.24
"}",[],
- "source('all.r')",[],
- "setwd",[Dq+tmp1+Dq]
- ];
- if(ErrFlag!=-1,
- if(!isexists(Dirwork,Fnametex) % mktex=="Y",
- CalcbyR("all",cmdL,["Cat=n","m","Wait="+text(waiting)]);
- ,
- println("Parafolder "+path+" finished");//16.12.20
- );
- if(length(after)>0, // 16.12.27
- parse(after);
- );
- FnameR=Fhead+".r";
- Fnametex=Fhead+".tex";
+ "source('all.r')",[]
+ ];
+ if(ErrFlag!=-1,
+ waiting=min([waiting,8])*length(ParaSL); //180610
+ if(!isexists(Dirworksubbkup,Fnametex) % mktex=="Y",
+ CalcbyR("",cmdL,["Cat=n","m","Wait="+text(waiting)]);
+ ,
+ println("Parafolder finished");
+ );
+ if(length(after)>0,
+ parse(after);
);
);
+ Changework(Dirworkbkup);
+ Setfiles(Fheadbkup);
);
Animatefile():=Animatefile(Dirwork,ParaPath);
Animatefile(path,folder):=(
//help:Animatefile();
//help:Animatefile(Dirwork,ParaPath);
- regional(FRate, Scale, OpA, pa,fname,eqL,tmp,tmp1,tmp2);
+ regional(FRate, Scale, OpA, pa,fname,eqL,tmp,tmp1,tmp2,texfiles);
tmp=divoptions(ParaOpAnim); //17.11.24
eqL=tmp_5;
FRate="10";
@@ -244,11 +302,19 @@ Animatefile(path,folder):=(
tmp1=fileslist(tmp);
tmp1=tokenize(tmp1,",");
tmp1=select(tmp1,indexof(#,".tex")>0);
+ texfiles=[];//180609from
+ forall(tmp1,
+ tmp=indexof(#,".");
+ tmp=parse(substring(#,1,tmp-1));
+ if(tmp<=length(ParaSL),
+ texfiles=append(texfiles,#);
+ );
+ );//180609to
SCEOUTPUT= openfile(fname);
println(SCEOUTPUT,"\def\parapath{"+pa+"}%"); //17.06.22
println(SCEOUTPUT,"\def\figsize{"+Scale+"}%"); //17.12.07
println(SCEOUTPUT,"\begin{animateinline}"+OpA+"{"+FRate+"}%");
- forall(1..(length(tmp1)),
+ forall(1..(length(texfiles)), //180609
if(Scale==1, // 17.08.30from
tmp="\input{\parapath/";
tmp=tmp+folder+"/"+tmp1_#+"}%";
@@ -511,7 +577,15 @@ Mkflipanime(path,folder):=(
println(SCEOUTPUT,"");
tmp=fileslist(Dirwork+pathsep()+folder);
tmp=tokenize(tmp,",");
- texfiles=select(tmp,indexof(#,".tex")>0);
+ tmp1=select(tmp,indexof(#,".tex")>0); //180609from
+ texfiles=[];
+ forall(tmp1,
+ tmp=indexof(#,".");
+ tmp=parse(substring(#,1,tmp-1));
+ if(tmp<=length(ParaSL),
+ texfiles=append(texfiles,#);
+ );
+ );//180609to
forall(texfiles,
println(SCEOUTPUT,"\vspace*{25mm}");
println(SCEOUTPUT,"");