summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSunil Shetye2018-06-21 18:52:51 +0530
committerSunil Shetye2018-06-22 10:51:31 +0530
commitca5b9d74c606ee8e9cabadada1e7f7f29c1f3b47 (patch)
tree9460cd0fc69f62fd4fec44eecbcaeeab5fd0f33e
parent8cf65fe92b28b8809abcb0eb59f951d26f30792f (diff)
downloadsci2js-ca5b9d74c606ee8e9cabadada1e7f7f29c1f3b47.tar.gz
sci2js-ca5b9d74c606ee8e9cabadada1e7f7f29c1f3b47.tar.bz2
sci2js-ca5b9d74c606ee8e9cabadada1e7f7f29c1f3b47.zip
ignore remaining function blocks
-rw-r--r--combined.js254
-rw-r--r--js/Events/M_freq.js64
-rw-r--r--js/Misc/EXPRESSION.js4
-rw-r--r--js/NonLinear/LOOKUP2D.js100
-rw-r--r--js/NonLinear/LOOKUP_c.js19
-rw-r--r--js/Sources/CURVE_c.js19
-rw-r--r--js/Sources/Sigbuilder.js94
-rwxr-xr-xsci2jslex.py25
-rwxr-xr-xsci2jsyacc.py44
9 files changed, 578 insertions, 45 deletions
diff --git a/combined.js b/combined.js
index 93cd3606..cd1f9165 100644
--- a/combined.js
+++ b/combined.js
@@ -526,6 +526,69 @@ break;
}
}
}
+/* autogenerated from "macros/Events/M_freq.sci" */
+function M_freq() {
+ M_freq.prototype.define = function M_freq() {
+model=scicos_model();
+model.sim=list("m_frequ",4);
+model.evtout=[[1],[1],[1]];
+model.evtin=1;
+model.rpar=[];
+model.opar=list([[1,1,0],[1,1,1],[1,3,2]],1,0,0);
+model.blocktype="d";
+model.firing=[0,-1,-1];
+model.dep_ut=[false,false];
+exprs=[[sci2exp([[1],[2]])],[sci2exp([[0],[0]])]];
+gr_i=[];
+x=standard_define([3,2],model,exprs,gr_i);
+ }
+ M_freq.prototype.details = function M_freq() {
+ }
+ M_freq.prototype.get = function M_freq() {
+ }
+ M_freq.prototype.set = function M_freq() {
+x=arg1;
+graphics=arg1.graphics;
+model=arg1.model;
+exprs=graphics.exprs;
+while (true) {
+[ok,frequ,offset,exprs]=scicos_getvalue("Set block parameters",[["Sample time"],["Offset"]],list("vec",-1,"vec",-1),exprs);
+if (!ok) {
+break;
+}
+offset=offset.slice();
+frequ=frequ.slice();
+if ((size(frequ,"*"))!=(size(offset,"*"))) {
+message("offset and frequency must have the same size");
+ok=false;
+} else if (or(frequ<0)) {
+message("Frequency must be a positif number");
+ok=false;
+} else if (or(abs(offset)>frequ)) {
+message("The |Offset| must be less than the Frequency");
+ok=false;
+}
+if (ok) {
+[m,den,off,count,m1,fir,frequ,offset,ok]=mfrequ_clk[frequ-1][offset-1];
+}
+if (ok) {
+model.opar=list(m,double[den-1],off,count);
+mn=(2^size(m1,"*"))-1;
+[model,graphics,ok]=set_io(model,graphics,list(),list(),1,ones(mn,1));
+if (mn>3) {
+graphics.sz=[40+(mn-3)*10,40];
+} else {
+graphics.sz=[50,40];
+}
+model.firing=fir;
+graphics.exprs=exprs;
+x.graphics=graphics;
+x.model=model;
+break;
+}
+}
+ }
+}
/* autogenerated from "macros/Events/IFTHEL_f.sci" */
function IFTHEL_f() {
IFTHEL_f.prototype.define = function IFTHEL_f() {
@@ -8341,6 +8404,97 @@ break;
}
}
}
+/* autogenerated from "macros/Sources/Sigbuilder.sci" */
+function Sigbuilder() {
+ Sigbuilder.prototype.define = function Sigbuilder() {
+scs_m_1=scicos_diagram(version="scicos4.2",props=scicos_params(wpar=[600,450,0,0,600,450],Title=["Sigbuilder","./"],tol=[[0.0001],[0.000001],[1.000e-10],[100001],[0],[0],[0]],tf=100,context=" ",void1=[],options=tlist(["scsopt","3D","Background","Link","ID","Cmap"],list(true,33),[8,1],[1,5],list([5,1],[4,1]),[0.8,0.8,0.8]),void2=[],void3=[],doc=list()));
+scs_m_1.objs[1-1]=scicos_block(gui="CURVE_c",graphics=scicos_graphics(orig=[329.63473,606.18517],sz=[40,40],flip=true,theta=0,exprs=[["3"],["[0,1,2]"],["[10,20,-30]"],["y"],["n"]],pin=[],pout=6,pein=4,peout=2,gr_i=[],id="",in_implicit=[],out_implicit="E"),model=scicos_model(sim=list("curve_c",4),in1=[],in2=[],intyp=1,out=1,out2=[],outtyp=1,evtin=1,evtout=1,state=[],dstate=[],odstate=list(),rpar=[[0],[1],[2],[10],[20],[-30]],ipar=[[3],[3],[1]],opar=list(),blocktype="c",firing=0,dep_ut=[false,true],label="",nzcross=0,nmode=0,equations=list()),doc=list());
+scs_m_1.objs[2-1]=scicos_link(xx=[[349.63473],[349.49528]],yy=[[600.47089],[565.10704]],id="drawlink",thick=[0,0],ct=[5,-1],from=[1,1,0],to=[3,1,1]);
+scs_m_1.objs[3-1]=scicos_block(gui="CLKSPLIT_f",graphics=scicos_graphics(orig=[[349.49528],[565.10704]],sz=[0.3333333,0.3333333],flip=true,theta=0,exprs=[],pin=[],pout=[],pein=2,peout=[[8],[4]],gr_i=[],id="",in_implicit=[],out_implicit=[]),model=scicos_model(sim="split",in1=[],in2=[],intyp=1,out=[],out2=[],outtyp=1,evtin=1,evtout=[[1],[1]],state=[],dstate=[],odstate=list(),rpar=[],ipar=[],opar=list(),blocktype="d",firing=[false,false,false],dep_ut=[false,false],label="",nzcross=0,nmode=0,equations=list()),doc=list());
+scs_m_1.objs[4-1]=scicos_link(xx=[[349.49528],[266.69602],[266.69602],[270.35525],[342.80795],[342.80795],[349.63473]],yy=[[565.10704],[565.10704],[680.99483],[680.99483],[680.99483],[651.89946],[651.89946]],id="drawlink",thick=[0,0],ct=[5,-1],from=[3,2,0],to=[1,1,1]);
+scs_m_1.objs[5-1]=scicos_block(gui="OUT_f",graphics=scicos_graphics(orig=[398.20616,616.18517],sz=[20,20],flip=true,theta=0,exprs="1",pin=6,pout=[],pein=[],peout=[],gr_i=[],id="",in_implicit="E",out_implicit=[]),model=scicos_model(sim="output",in1=-1,in2=-2,intyp=-1,out=[],out2=[],outtyp=1,evtin=[],evtout=[],state=[],dstate=[],odstate=list(),rpar=[],ipar=1,opar=list(),blocktype="c",firing=[],dep_ut=[false,false],label="",nzcross=0,nmode=0,equations=list()),doc=list());
+scs_m_1.objs[6-1]=scicos_link(xx=[[378.20616],[398.20616]],yy=[[626.18517],[626.18517]],id="drawlink",thick=[0,0],ct=[1,1],from=[1,1,0],to=[5,1,1]);
+scs_m_1.objs[7-1]=scicos_block(gui="CLKOUTV_f",graphics=scicos_graphics(orig=[339.49528,505.10704],sz=[20,30],flip=true,theta=0,exprs="1",pin=[],pout=[],pein=8,peout=[],gr_i=[],id="",in_implicit=[],out_implicit=[]),model=scicos_model(sim="output",in1=[],in2=[],intyp=1,out=[],out2=[],outtyp=1,evtin=1,evtout=[],state=[],dstate=[],odstate=list(),rpar=[],ipar=1,opar=list(),blocktype="d",firing=[],dep_ut=[false,false],label="",nzcross=0,nmode=0,equations=list()),doc=list());
+scs_m_1.objs[8-1]=scicos_link(xx=[[349.49528],[349.49528]],yy=[[565.10704],[535.10704]],id="drawlink",thick=[0,0],ct=[5,-1],from=[3,1,0],to=[7,1,1]);
+model=scicos_model(sim="csuper",in1=[],in2=[],intyp=1,out=-1,out2=[],outtyp=1,evtin=[],evtout=1,state=[],dstate=[],odstate=list(),rpar=scs_m_1,ipar=[],opar=list(),blocktype="h",firing=[],dep_ut=[false,false],label="",nzcross=0,nmode=0,equations=list());
+gr_i=[];
+x=standard_define([3,2],model,[],gr_i);
+ }
+ Sigbuilder.prototype.details = function Sigbuilder() {
+ }
+ Sigbuilder.prototype.get = function Sigbuilder() {
+ }
+ Sigbuilder.prototype.set = function Sigbuilder() {
+ppath=list(0);
+for (i=1;i<=length(arg1.model.rpar.objs);i+=1) {
+o=arg1.model.rpar.objs[i-1];
+if (typeof(o)=="Block"&&o.gui=="CURVE_c") {
+ppath[1-1]=i;
+break;
+}
+}
+newpar=list();
+y=0;
+for (path in ppath) {
+np=size(path,"*");
+spath=list();
+for (k=1;k<=np;k+=1) {
+spath[$+1-1]="model";
+spath[$+1-1]="rpar";
+spath[$+1-1]="objs";
+spath[$+1-1]=path[k-1];
+}
+xx=arg1[spath-1];
+execstr("xxn="+xx.gui+"(\'set\',xx)");
+if (diffobjs(xxn,xx)) {
+model=xx.model;
+model_n=xxn.model;
+if (!is_modelica_block(xx)) {
+modified=or(model.sim!=model_n.sim)||!isequal(model.state,model_n.state)||!isequal(model.dstate,model_n.dstate)||!isequal(model.odstate,model_n.odstate)||!isequal(model.rpar,model_n.rpar)||!isequal(model.ipar,model_n.ipar)||!isequal(model.opar,model_n.opar)||!isequal(model.label,model_n.label);
+if (or(model.in1!=model_n.in1)||or(model.out!=model_n.out)||or(model.in2!=model_n.in2)||or(model.out2!=model_n.out2)||or(model.outtyp!=model_n.outtyp)||or(model.intyp!=model_n.intyp)) {
+needcompile=1;
+}
+if (or(model.firing!=model_n.firing)) {
+needcompile=2;
+}
+if ((size(model.in1,"*")!=size(model_n.in1,"*"))||(size(model.out,"*")!=size(model_n.out,"*"))) {
+needcompile=4;
+}
+if (model.sim=="input"||model.sim=="output") {
+if (model.ipar!=model_n.ipar) {
+needcompile=4;
+}
+}
+if (or(model.blocktype!=model_n.blocktype)||or(model.dep_ut!=model_n.dep_ut)) {
+needcompile=4;
+}
+if ((model.nzcross!=model_n.nzcross)||(model.nmode!=model_n.nmode)) {
+needcompile=4;
+}
+if (prod[size(model_n.sim)-1]>1) {
+if (model_n.sim[2-1]>1000) {
+if (model.sim[1-1]!=model_n.sim[1-1]) {
+needcompile=4;
+}
+}
+}
+} else {
+modified=or(model_n!=model);
+eq=model.equations;
+eqn=model_n.equations;
+if (or(eq.model!=eqn.model)||or(eq.inputs!=eqn.inputs)||or(eq.outputs!=eqn.outputs)) {
+needcompile=4;
+}
+}
+arg1[spath-1]=xxn;
+newpar[size(newpar)+1-1]=path;
+y=max(y,needcompile);
+}
+}
+x=arg1;
+typ=newpar;
+ }
+}
/* autogenerated from "macros/Sources/Modulo_Count.sci" */
function Modulo_Count() {
Modulo_Count.prototype.define = function Modulo_Count() {
@@ -17670,5 +17824,103 @@ x=standard_define([2,2],model,exprs,gr_i);
x=arg1;
}
}
+/* autogenerated from "macros/NonLinear/LOOKUP2D.sci" */
+function LOOKUP2D() {
+ LOOKUP2D.prototype.define = function LOOKUP2D() {
+model=scicos_model();
+xx=[1:4];
+yy=[1:3];
+zz=[[4,5,6],[16,19,20],[10,18,23],[6,3,-1]];
+Method=1;
+Graf="n";
+Nx=length(xx);
+Ny=length(yy);
+model.sim=list("lookup2d",4);
+model.in1=[[1],[1]];
+model.out=1;
+model.rpar=[[xx.slice()],[yy.slice()],[zz.slice()]];
+model.ipar=[[Nx],[Ny],[Method]];
+model.blocktype="c";
+model.dep_ut=[true,false];
+exprs=list(strcat(sci2exp(xx)),strcat(sci2exp(yy)),strcat(sci2exp(zz)),sci2exp(Method),Graf);
+gr_i=[];
+x=standard_define([2.5,2],model,exprs,gr_i);
+ }
+ LOOKUP2D.prototype.details = function LOOKUP2D() {
+ }
+ LOOKUP2D.prototype.get = function LOOKUP2D() {
+ }
+ LOOKUP2D.prototype.set = function LOOKUP2D() {
+x=arg1;
+model=arg1.model;
+graphics=arg1.graphics;
+exprs=graphics.exprs;
+ok=false;
+SaveExit=false;
+while (true) {
+Ask_again=false;
+[ok,xx,yy,zz,Method,graf,exprs]=scicos_getvalue("2D Lookup table parameters",[["Row index input values"],["Column index input values"],["Table data"],["Lookup method(1..5)"],["Launch graphic window(y/n)?"]],list("vec",-1,"vec",-1,"mat",[-1,-1],"vec",1,"str",1),exprs);
+if (!ok) {
+break;
+}
+mtd=int(Method);
+if (mtd<1) {
+mtd=1;
+}
+if (mtd>6) {
+mtd=6;
+}
+if (graf!="y"&&graf!="Y") {
+graf="n";
+}
+exprs[5-1]="n";
+exprs[4-1]=sci2exp(mtd);
+METHOD=getmethod(mtd);
+if (!Ask_again) {
+xx=xx.slice();
+yy=yy.slice();
+[nx,mx]=size(xx);
+[ny,my]=size(yy);
+[nz,mz]=size(zz);
+if (((nx<=1)||(ny<=1))) {
+x_message("input row/column data size should be greater than one");
+Ask_again=true;
+}
+if (!((nx==nz)&&(ny==mz))) {
+x_message("incompatible size of x and y");
+Ask_again=true;
+}
+[ok]=test_increasing[xx-1];
+if ((!ok)) {
+x_message("Row input values must be monotonically increasing");
+Ask_again=true;
+}
+[ok]=test_increasing[yy-1];
+if ((!ok)) {
+x_message("Column input values must be monotonically increasing");
+Ask_again=true;
+}
+}
+if (!Ask_again) {
+if ((graf=="Y"||graf=="y")) {
+gh=gcf();
+curwin=gh.figure_id;
+save_curwin=curwin;
+gh2=scf();
+curwin=max(winsid())+1;
+plot3d(xx,yy,zz,35,45,"X@Y@Z",[5,2,4]);
+curwin=save_curwin;
+gh.figure_id=curwin;
+}
+model.rpar=[[xx.slice()],[yy.slice()],[zz.slice()]];
+model.ipar=[[nx],[ny],[mtd]];
+graphics.exprs=exprs;
+x.model=model;
+x.graphics=graphics;
+break;
+}
+}
+ }
+}
-/* made from 267/274 files */
+/* made from 270/274 files */
diff --git a/js/Events/M_freq.js b/js/Events/M_freq.js
index 473f9072..3e0299cb 100644
--- a/js/Events/M_freq.js
+++ b/js/Events/M_freq.js
@@ -1,3 +1,63 @@
-Syntax error in input LexToken(FUNCTION,'function',1,2890)
/* autogenerated from "macros/Events/M_freq.sci" */
-None
+function M_freq() {
+ M_freq.prototype.define = function M_freq() {
+model=scicos_model();
+model.sim=list("m_frequ",4);
+model.evtout=[[1],[1],[1]];
+model.evtin=1;
+model.rpar=[];
+model.opar=list([[1,1,0],[1,1,1],[1,3,2]],1,0,0);
+model.blocktype="d";
+model.firing=[0,-1,-1];
+model.dep_ut=[false,false];
+exprs=[[sci2exp([[1],[2]])],[sci2exp([[0],[0]])]];
+gr_i=[];
+x=standard_define([3,2],model,exprs,gr_i);
+ }
+ M_freq.prototype.details = function M_freq() {
+ }
+ M_freq.prototype.get = function M_freq() {
+ }
+ M_freq.prototype.set = function M_freq() {
+x=arg1;
+graphics=arg1.graphics;
+model=arg1.model;
+exprs=graphics.exprs;
+while (true) {
+[ok,frequ,offset,exprs]=scicos_getvalue("Set block parameters",[["Sample time"],["Offset"]],list("vec",-1,"vec",-1),exprs);
+if (!ok) {
+break;
+}
+offset=offset.slice();
+frequ=frequ.slice();
+if ((size(frequ,"*"))!=(size(offset,"*"))) {
+message("offset and frequency must have the same size");
+ok=false;
+} else if (or(frequ<0)) {
+message("Frequency must be a positif number");
+ok=false;
+} else if (or(abs(offset)>frequ)) {
+message("The |Offset| must be less than the Frequency");
+ok=false;
+}
+if (ok) {
+[m,den,off,count,m1,fir,frequ,offset,ok]=mfrequ_clk[frequ-1][offset-1];
+}
+if (ok) {
+model.opar=list(m,double[den-1],off,count);
+mn=(2^size(m1,"*"))-1;
+[model,graphics,ok]=set_io(model,graphics,list(),list(),1,ones(mn,1));
+if (mn>3) {
+graphics.sz=[40+(mn-3)*10,40];
+} else {
+graphics.sz=[50,40];
+}
+model.firing=fir;
+graphics.exprs=exprs;
+x.graphics=graphics;
+x.model=model;
+break;
+}
+}
+ }
+}
diff --git a/js/Misc/EXPRESSION.js b/js/Misc/EXPRESSION.js
index 2495ad49..8d531352 100644
--- a/js/Misc/EXPRESSION.js
+++ b/js/Misc/EXPRESSION.js
@@ -1,4 +1,4 @@
-Syntax error in input LexToken(FUNCTION,'function',1,4122)
-Syntax error in input LexToken(VAR,'PREVAR_foo',1,4610)
+Syntax error in input LexToken(PREVAR,'%mi',1,4312)
+Syntax error in input LexToken(OPENBRACKET,'(',1,4686)
/* autogenerated from "macros/Misc/EXPRESSION.sci" */
None
diff --git a/js/NonLinear/LOOKUP2D.js b/js/NonLinear/LOOKUP2D.js
index 58423f3c..1bd80e3d 100644
--- a/js/NonLinear/LOOKUP2D.js
+++ b/js/NonLinear/LOOKUP2D.js
@@ -1,4 +1,98 @@
-Syntax error in input LexToken(FUNCTION,'function',1,4479)
-Syntax error in input LexToken(VAR,'order',1,4893)
/* autogenerated from "macros/NonLinear/LOOKUP2D.sci" */
-None
+function LOOKUP2D() {
+ LOOKUP2D.prototype.define = function LOOKUP2D() {
+model=scicos_model();
+xx=[1:4];
+yy=[1:3];
+zz=[[4,5,6],[16,19,20],[10,18,23],[6,3,-1]];
+Method=1;
+Graf="n";
+Nx=length(xx);
+Ny=length(yy);
+model.sim=list("lookup2d",4);
+model.in1=[[1],[1]];
+model.out=1;
+model.rpar=[[xx.slice()],[yy.slice()],[zz.slice()]];
+model.ipar=[[Nx],[Ny],[Method]];
+model.blocktype="c";
+model.dep_ut=[true,false];
+exprs=list(strcat(sci2exp(xx)),strcat(sci2exp(yy)),strcat(sci2exp(zz)),sci2exp(Method),Graf);
+gr_i=[];
+x=standard_define([2.5,2],model,exprs,gr_i);
+ }
+ LOOKUP2D.prototype.details = function LOOKUP2D() {
+ }
+ LOOKUP2D.prototype.get = function LOOKUP2D() {
+ }
+ LOOKUP2D.prototype.set = function LOOKUP2D() {
+x=arg1;
+model=arg1.model;
+graphics=arg1.graphics;
+exprs=graphics.exprs;
+ok=false;
+SaveExit=false;
+while (true) {
+Ask_again=false;
+[ok,xx,yy,zz,Method,graf,exprs]=scicos_getvalue("2D Lookup table parameters",[["Row index input values"],["Column index input values"],["Table data"],["Lookup method(1..5)"],["Launch graphic window(y/n)?"]],list("vec",-1,"vec",-1,"mat",[-1,-1],"vec",1,"str",1),exprs);
+if (!ok) {
+break;
+}
+mtd=int(Method);
+if (mtd<1) {
+mtd=1;
+}
+if (mtd>6) {
+mtd=6;
+}
+if (graf!="y"&&graf!="Y") {
+graf="n";
+}
+exprs[5-1]="n";
+exprs[4-1]=sci2exp(mtd);
+METHOD=getmethod(mtd);
+if (!Ask_again) {
+xx=xx.slice();
+yy=yy.slice();
+[nx,mx]=size(xx);
+[ny,my]=size(yy);
+[nz,mz]=size(zz);
+if (((nx<=1)||(ny<=1))) {
+x_message("input row/column data size should be greater than one");
+Ask_again=true;
+}
+if (!((nx==nz)&&(ny==mz))) {
+x_message("incompatible size of x and y");
+Ask_again=true;
+}
+[ok]=test_increasing[xx-1];
+if ((!ok)) {
+x_message("Row input values must be monotonically increasing");
+Ask_again=true;
+}
+[ok]=test_increasing[yy-1];
+if ((!ok)) {
+x_message("Column input values must be monotonically increasing");
+Ask_again=true;
+}
+}
+if (!Ask_again) {
+if ((graf=="Y"||graf=="y")) {
+gh=gcf();
+curwin=gh.figure_id;
+save_curwin=curwin;
+gh2=scf();
+curwin=max(winsid())+1;
+plot3d(xx,yy,zz,35,45,"X@Y@Z",[5,2,4]);
+curwin=save_curwin;
+gh.figure_id=curwin;
+}
+model.rpar=[[xx.slice()],[yy.slice()],[zz.slice()]];
+model.ipar=[[nx],[ny],[mtd]];
+graphics.exprs=exprs;
+x.model=model;
+x.graphics=graphics;
+break;
+}
+}
+ }
+}
diff --git a/js/NonLinear/LOOKUP_c.js b/js/NonLinear/LOOKUP_c.js
index 85bcfaa6..b94e586d 100644
--- a/js/NonLinear/LOOKUP_c.js
+++ b/js/NonLinear/LOOKUP_c.js
@@ -1,14 +1,11 @@
-Syntax error in input LexToken(FUNCTION,'function',1,6870)
-Syntax error in input LexToken(VAR,'a',1,25832)
-Syntax error in input LexToken(VAR,'a',1,27066)
-Syntax error in input LexToken(VAR,'a',1,27777)
+Syntax error in input LexToken(DOT,'.',1,12001)
+Syntax error in input LexToken(DOT,'.',1,25941)
+Syntax error in input LexToken(DOT,'.',1,27143)
+Syntax error in input LexToken(DOT,'.',1,27805)
Syntax error in input LexToken(CLOSEBRACKET,')',1,28535)
-Syntax error in input LexToken(VAR,'xye',1,32671)
-Syntax error in input LexToken(VAR,'a',1,33307)
-Syntax error in input LexToken(VAR,'order',1,33666)
+Syntax error in input LexToken(COLON,':',1,32814)
+Syntax error in input LexToken(DOT,'.',1,33402)
Syntax error in input LexToken(CLOSEBRACKET,')',1,34234)
-Syntax error in input LexToken(VAR,'xye',1,35442)
-Syntax error in input LexToken(VAR,'N',1,36302)
-Syntax error in input LexToken(VAR,'x',1,40233)
+Syntax error in input LexToken(COMMA,',',1,36019)
/* autogenerated from "macros/NonLinear/LOOKUP_c.sci" */
-None
+
diff --git a/js/Sources/CURVE_c.js b/js/Sources/CURVE_c.js
index f22a2fcf..badf6e90 100644
--- a/js/Sources/CURVE_c.js
+++ b/js/Sources/CURVE_c.js
@@ -1,14 +1,11 @@
-Syntax error in input LexToken(FUNCTION,'function',1,6574)
-Syntax error in input LexToken(VAR,'a',1,25132)
-Syntax error in input LexToken(VAR,'a',1,26313)
-Syntax error in input LexToken(VAR,'a',1,27400)
+Syntax error in input LexToken(DOT,'.',1,11244)
+Syntax error in input LexToken(DOT,'.',1,25241)
+Syntax error in input LexToken(DOT,'.',1,26390)
+Syntax error in input LexToken(DOT,'.',1,27428)
Syntax error in input LexToken(CLOSEBRACKET,')',1,28162)
-Syntax error in input LexToken(VAR,'xye',1,32329)
-Syntax error in input LexToken(VAR,'a',1,33109)
-Syntax error in input LexToken(VAR,'order',1,33486)
+Syntax error in input LexToken(COLON,':',1,32472)
+Syntax error in input LexToken(DOT,'.',1,33210)
Syntax error in input LexToken(CLOSEBRACKET,')',1,33946)
-Syntax error in input LexToken(VAR,'xye',1,35193)
-Syntax error in input LexToken(VAR,'N',1,36068)
-Syntax error in input LexToken(VAR,'x',1,38964)
+Syntax error in input LexToken(COMMA,',',1,35785)
/* autogenerated from "macros/Sources/CURVE_c.sci" */
-None
+
diff --git a/js/Sources/Sigbuilder.js b/js/Sources/Sigbuilder.js
index 45b958a0..b2c05ea8 100644
--- a/js/Sources/Sigbuilder.js
+++ b/js/Sources/Sigbuilder.js
@@ -1,5 +1,91 @@
-Syntax error in input LexToken(FUNCTION,'function',1,10255)
-Syntax error in input LexToken(VAR,'order',1,12980)
-Syntax error in input LexToken(VAR,'x',1,13322)
/* autogenerated from "macros/Sources/Sigbuilder.sci" */
-None
+function Sigbuilder() {
+ Sigbuilder.prototype.define = function Sigbuilder() {
+scs_m_1=scicos_diagram(version="scicos4.2",props=scicos_params(wpar=[600,450,0,0,600,450],Title=["Sigbuilder","./"],tol=[[0.0001],[0.000001],[1.000e-10],[100001],[0],[0],[0]],tf=100,context=" ",void1=[],options=tlist(["scsopt","3D","Background","Link","ID","Cmap"],list(true,33),[8,1],[1,5],list([5,1],[4,1]),[0.8,0.8,0.8]),void2=[],void3=[],doc=list()));
+scs_m_1.objs[1-1]=scicos_block(gui="CURVE_c",graphics=scicos_graphics(orig=[329.63473,606.18517],sz=[40,40],flip=true,theta=0,exprs=[["3"],["[0,1,2]"],["[10,20,-30]"],["y"],["n"]],pin=[],pout=6,pein=4,peout=2,gr_i=[],id="",in_implicit=[],out_implicit="E"),model=scicos_model(sim=list("curve_c",4),in1=[],in2=[],intyp=1,out=1,out2=[],outtyp=1,evtin=1,evtout=1,state=[],dstate=[],odstate=list(),rpar=[[0],[1],[2],[10],[20],[-30]],ipar=[[3],[3],[1]],opar=list(),blocktype="c",firing=0,dep_ut=[false,true],label="",nzcross=0,nmode=0,equations=list()),doc=list());
+scs_m_1.objs[2-1]=scicos_link(xx=[[349.63473],[349.49528]],yy=[[600.47089],[565.10704]],id="drawlink",thick=[0,0],ct=[5,-1],from=[1,1,0],to=[3,1,1]);
+scs_m_1.objs[3-1]=scicos_block(gui="CLKSPLIT_f",graphics=scicos_graphics(orig=[[349.49528],[565.10704]],sz=[0.3333333,0.3333333],flip=true,theta=0,exprs=[],pin=[],pout=[],pein=2,peout=[[8],[4]],gr_i=[],id="",in_implicit=[],out_implicit=[]),model=scicos_model(sim="split",in1=[],in2=[],intyp=1,out=[],out2=[],outtyp=1,evtin=1,evtout=[[1],[1]],state=[],dstate=[],odstate=list(),rpar=[],ipar=[],opar=list(),blocktype="d",firing=[false,false,false],dep_ut=[false,false],label="",nzcross=0,nmode=0,equations=list()),doc=list());
+scs_m_1.objs[4-1]=scicos_link(xx=[[349.49528],[266.69602],[266.69602],[270.35525],[342.80795],[342.80795],[349.63473]],yy=[[565.10704],[565.10704],[680.99483],[680.99483],[680.99483],[651.89946],[651.89946]],id="drawlink",thick=[0,0],ct=[5,-1],from=[3,2,0],to=[1,1,1]);
+scs_m_1.objs[5-1]=scicos_block(gui="OUT_f",graphics=scicos_graphics(orig=[398.20616,616.18517],sz=[20,20],flip=true,theta=0,exprs="1",pin=6,pout=[],pein=[],peout=[],gr_i=[],id="",in_implicit="E",out_implicit=[]),model=scicos_model(sim="output",in1=-1,in2=-2,intyp=-1,out=[],out2=[],outtyp=1,evtin=[],evtout=[],state=[],dstate=[],odstate=list(),rpar=[],ipar=1,opar=list(),blocktype="c",firing=[],dep_ut=[false,false],label="",nzcross=0,nmode=0,equations=list()),doc=list());
+scs_m_1.objs[6-1]=scicos_link(xx=[[378.20616],[398.20616]],yy=[[626.18517],[626.18517]],id="drawlink",thick=[0,0],ct=[1,1],from=[1,1,0],to=[5,1,1]);
+scs_m_1.objs[7-1]=scicos_block(gui="CLKOUTV_f",graphics=scicos_graphics(orig=[339.49528,505.10704],sz=[20,30],flip=true,theta=0,exprs="1",pin=[],pout=[],pein=8,peout=[],gr_i=[],id="",in_implicit=[],out_implicit=[]),model=scicos_model(sim="output",in1=[],in2=[],intyp=1,out=[],out2=[],outtyp=1,evtin=1,evtout=[],state=[],dstate=[],odstate=list(),rpar=[],ipar=1,opar=list(),blocktype="d",firing=[],dep_ut=[false,false],label="",nzcross=0,nmode=0,equations=list()),doc=list());
+scs_m_1.objs[8-1]=scicos_link(xx=[[349.49528],[349.49528]],yy=[[565.10704],[535.10704]],id="drawlink",thick=[0,0],ct=[5,-1],from=[3,1,0],to=[7,1,1]);
+model=scicos_model(sim="csuper",in1=[],in2=[],intyp=1,out=-1,out2=[],outtyp=1,evtin=[],evtout=1,state=[],dstate=[],odstate=list(),rpar=scs_m_1,ipar=[],opar=list(),blocktype="h",firing=[],dep_ut=[false,false],label="",nzcross=0,nmode=0,equations=list());
+gr_i=[];
+x=standard_define([3,2],model,[],gr_i);
+ }
+ Sigbuilder.prototype.details = function Sigbuilder() {
+ }
+ Sigbuilder.prototype.get = function Sigbuilder() {
+ }
+ Sigbuilder.prototype.set = function Sigbuilder() {
+ppath=list(0);
+for (i=1;i<=length(arg1.model.rpar.objs);i+=1) {
+o=arg1.model.rpar.objs[i-1];
+if (typeof(o)=="Block"&&o.gui=="CURVE_c") {
+ppath[1-1]=i;
+break;
+}
+}
+newpar=list();
+y=0;
+for (path in ppath) {
+np=size(path,"*");
+spath=list();
+for (k=1;k<=np;k+=1) {
+spath[$+1-1]="model";
+spath[$+1-1]="rpar";
+spath[$+1-1]="objs";
+spath[$+1-1]=path[k-1];
+}
+xx=arg1[spath-1];
+execstr("xxn="+xx.gui+"(\'set\',xx)");
+if (diffobjs(xxn,xx)) {
+model=xx.model;
+model_n=xxn.model;
+if (!is_modelica_block(xx)) {
+modified=or(model.sim!=model_n.sim)||!isequal(model.state,model_n.state)||!isequal(model.dstate,model_n.dstate)||!isequal(model.odstate,model_n.odstate)||!isequal(model.rpar,model_n.rpar)||!isequal(model.ipar,model_n.ipar)||!isequal(model.opar,model_n.opar)||!isequal(model.label,model_n.label);
+if (or(model.in1!=model_n.in1)||or(model.out!=model_n.out)||or(model.in2!=model_n.in2)||or(model.out2!=model_n.out2)||or(model.outtyp!=model_n.outtyp)||or(model.intyp!=model_n.intyp)) {
+needcompile=1;
+}
+if (or(model.firing!=model_n.firing)) {
+needcompile=2;
+}
+if ((size(model.in1,"*")!=size(model_n.in1,"*"))||(size(model.out,"*")!=size(model_n.out,"*"))) {
+needcompile=4;
+}
+if (model.sim=="input"||model.sim=="output") {
+if (model.ipar!=model_n.ipar) {
+needcompile=4;
+}
+}
+if (or(model.blocktype!=model_n.blocktype)||or(model.dep_ut!=model_n.dep_ut)) {
+needcompile=4;
+}
+if ((model.nzcross!=model_n.nzcross)||(model.nmode!=model_n.nmode)) {
+needcompile=4;
+}
+if (prod[size(model_n.sim)-1]>1) {
+if (model_n.sim[2-1]>1000) {
+if (model.sim[1-1]!=model_n.sim[1-1]) {
+needcompile=4;
+}
+}
+}
+} else {
+modified=or(model_n!=model);
+eq=model.equations;
+eqn=model_n.equations;
+if (or(eq.model!=eqn.model)||or(eq.inputs!=eqn.inputs)||or(eq.outputs!=eqn.outputs)) {
+needcompile=4;
+}
+}
+arg1[spath-1]=xxn;
+newpar[size(newpar)+1-1]=path;
+y=max(y,needcompile);
+}
+}
+x=arg1;
+typ=newpar;
+ }
+}
diff --git a/sci2jslex.py b/sci2jslex.py
index 5c8cdb3b..db76abe9 100755
--- a/sci2jslex.py
+++ b/sci2jslex.py
@@ -59,6 +59,7 @@ PREDEFINED_VARIABLES = {
FUNCTION_CALLS = {
'ANDLOG_f',
+ 'AutoScale',
'CFORTR',
'CLKIN_f',
'CLKINV_f',
@@ -78,18 +79,26 @@ FUNCTION_CALLS = {
'Modulo_Count',
'OUT_f',
'REGISTER_f',
+ 'ReadExcel',
+ 'ReadFromFile',
'SWITCH_f',
+ 'SaveToFile',
'abs',
+ 'addmenu',
'and',
+ 'atan',
'block_parameter_error',
'check_io',
'cleandata',
'compile_expr',
'compiler_expression',
'deff',
+ 'delmenu',
'diffobjs',
'do_eval',
'drawSplin',
+ 'drawlater',
+ 'drawnow',
'edit_curv',
'emptystr',
'eval',
@@ -98,20 +107,28 @@ FUNCTION_CALLS = {
'fileinfo',
'fileparts',
'find',
+ 'findrect',
'gca',
'gcf',
'genfunc1',
'genfunc2',
+ 'get_click',
'getmethod',
+ 'getos',
'gettext',
'getvalue',
+ 'gsort',
+ 'hidetoolbar',
'ieee',
'imag',
'int',
+ 'interp',
'is_modelica_block',
'isequal',
'lasterror',
'length',
+ 'lines',
+ 'linspace',
'list',
'matrix',
'max',
@@ -148,7 +165,10 @@ FUNCTION_CALLS = {
'script2var',
'set_io',
'setvalue_IHM_EDP',
+ 'sin',
'size',
+ 'splin',
+ 'sqrt',
'standard_define',
'strcat',
'strindex',
@@ -156,6 +176,7 @@ FUNCTION_CALLS = {
'strsubst',
'struct',
'sum',
+ 'tan',
'tlist',
'translate',
'typeof',
@@ -171,9 +192,11 @@ FUNCTION_CALLS = {
'xget',
'xinfo',
'xpoly',
+ 'xpolys',
'xset',
'xstringb',
'xstringl',
+ 'xtitle',
'zeros',
}
@@ -290,7 +313,7 @@ def t_LASTINDEX(t):
return t
def t_EOL(t):
- r'[ \t]*\n([ \t]*(//.*)?\n?)*'
+ r'[ \t]*(//.*)?\n([ \t]*(//.*)?\n?)*'
lastbracket = BRACKET_STACK[-1]
if lastbracket == ' ':
t.lexer.afterarray = False
diff --git a/sci2jsyacc.py b/sci2jsyacc.py
index df806737..df4634b1 100755
--- a/sci2jsyacc.py
+++ b/sci2jsyacc.py
@@ -17,25 +17,39 @@ import ply.yacc as yacc
from sci2jslex import tokens
precedence = (
+ ('left', 'COLON'),
('left', 'LOGICAL'),
- ('left', 'COMPARISON'),
+ ('nonassoc', 'COMPARISON'),
('left', 'ADDITION'),
('left', 'MULTIPLICATION'),
('right', 'NOT'),
('right', 'UNARYADDITION'),
('right', 'TRANSPOSE'),
+ ('left', 'DOT'),
)
-start = 'functionblock'
+start = 'functionblocks'
JOB_BLOCKS = {}
+# define functionblocks
+
+def p_functionblocks_functionblocks_functionblock(p):
+ 'functionblocks : functionblocks functionblock'
+ p[0] = '%s%s' % (p[1], p[2])
+
+def p_functionblocks_functionblock(p):
+ 'functionblocks : EOL functionblock'
+ p[0] = '%s' % (p[2])
+
+# end functionblocks
+
# define functionblock
-def p_functionblock_function_statementblock_endfunction(p):
- '''functionblock : EOL FUNCTION lterm ASSIGNMENT VAR OPENBRACKET JOB COMMA VAR COMMA VAR CLOSEBRACKET EOL statementblock ENDFUNCTION EOL
- | EOL FUNCTION lterm ASSIGNMENT FUNCTIONCALL OPENBRACKET JOB COMMA VAR COMMA VAR CLOSEBRACKET EOL statementblock ENDFUNCTION EOL'''
- fname = str(p[5])
+def p_functionblock_function_job_statementblock_endfunction(p):
+ '''functionblock : FUNCTION lterm ASSIGNMENT VAR OPENBRACKET JOB COMMA VAR COMMA VAR CLOSEBRACKET EOL statementblock ENDFUNCTION EOL
+ | FUNCTION lterm ASSIGNMENT FUNCTIONCALL OPENBRACKET JOB COMMA VAR COMMA VAR CLOSEBRACKET EOL statementblock ENDFUNCTION EOL'''
+ fname = p[4]
indent = ' '
p[0] = ('function %s() {\n' +
'%s%s.prototype.define = function %s() {\n%s%s}\n' +
@@ -49,6 +63,11 @@ def p_functionblock_function_statementblock_endfunction(p):
indent, fname, fname, (JOB_BLOCKS['"set"'] if '"set"' in JOB_BLOCKS else ''), indent,
)
+def p_functionblock_function_statementblock_endfunction(p):
+ '''functionblock : FUNCTION lterm ASSIGNMENT VAR OPENBRACKET list CLOSEBRACKET EOL statementblock ENDFUNCTION EOL
+ | FUNCTION lterm ASSIGNMENT FUNCTIONCALL OPENBRACKET list CLOSEBRACKET EOL statementblock ENDFUNCTION EOL'''
+ p[0] = ''
+
# end define functionblock
# define statementblock
@@ -551,6 +570,11 @@ def p_term_range(p):
'term : OPENBRACKET expression COLON expression CLOSEBRACKET'
p[0] = '[%s:%s]' % (p[2], p[4])
+# 1:10:50
+def p_term_range_step(p):
+ 'term : expression COLON expression COLON expression'
+ p[0] = '[%s:%s:%s]' % (p[1], p[3], p[5])
+
# B($-2)
# C('function parameter')
def p_term_termvar_parameter(p):
@@ -630,18 +654,18 @@ def p_term_prevar_boolean(p):
def p_term_prevar_complex1(p):
'expression : expression ADDITION expression MULTIPLICATION PREVAR_COMPLEX'
if p[2] == '-':
- imag = str(p[2]) + str(p[3])
+ imag = '%s%s' % (p[2], p[3])
else:
- imag = str(p[3])
+ imag = '%s' % (p[3])
p[0] = 'math.complex(%s,%s)' % (p[1], imag)
# 1+2*%i
def p_term_prevar_complex2(p):
'expression : expression ADDITION PREVAR_COMPLEX MULTIPLICATION expression'
if p[2] == '-':
- imag = str(p[2]) + str(p[5])
+ imag = '%s%s' % (p[2], p[5])
else:
- imag = str(p[5])
+ imag = '%s' % (p[5])
p[0] = 'math.complex(%s,%s)' % (p[1], imag)
# %e %pi