summaryrefslogtreecommitdiff
path: root/js/Linear
diff options
context:
space:
mode:
authorSunil Shetye2018-06-15 23:43:09 +0530
committerSunil Shetye2018-06-15 23:43:09 +0530
commit073f4cb62b331bb437c894e0581126e5d1ef459f (patch)
tree84d6755d231feb9feb2d79a06e0bbe7f784d86fc /js/Linear
parenta8e5849586f23ffb1ecd2fe47a636b61c80c2e70 (diff)
downloadsci2js-073f4cb62b331bb437c894e0581126e5d1ef459f.tar.gz
sci2js-073f4cb62b331bb437c894e0581126e5d1ef459f.tar.bz2
sci2js-073f4cb62b331bb437c894e0581126e5d1ef459f.zip
handle space character also
required in lists
Diffstat (limited to 'js/Linear')
-rw-r--r--js/Linear/CLR.js1
-rw-r--r--js/Linear/CLR_f.js1
-rw-r--r--js/Linear/DELAYV_f.js63
-rw-r--r--js/Linear/DOLLAR.js91
-rw-r--r--js/Linear/DOLLAR_m.js91
-rw-r--r--js/Linear/INTEGRAL_m.js124
-rw-r--r--js/Linear/SUMMATION.js139
7 files changed, 497 insertions, 13 deletions
diff --git a/js/Linear/CLR.js b/js/Linear/CLR.js
index a7310ba0..a6b409f5 100644
--- a/js/Linear/CLR.js
+++ b/js/Linear/CLR.js
@@ -1,4 +1,3 @@
Syntax error in input LexToken(DOT,'.',1,1222)
-Syntax error in input LexToken(IF,'if',1,1493)
/* autogenerated from "macros/Linear/CLR.sci" */
None
diff --git a/js/Linear/CLR_f.js b/js/Linear/CLR_f.js
index 55cfa76c..3494cc96 100644
--- a/js/Linear/CLR_f.js
+++ b/js/Linear/CLR_f.js
@@ -1,4 +1,3 @@
Syntax error in input LexToken(DOT,'.',1,1251)
-Syntax error in input LexToken(IF,'if',1,1523)
/* autogenerated from "macros/Linear/CLR_f.sci" */
None
diff --git a/js/Linear/DELAYV_f.js b/js/Linear/DELAYV_f.js
index 80fd97be..636ab9a0 100644
--- a/js/Linear/DELAYV_f.js
+++ b/js/Linear/DELAYV_f.js
@@ -1,3 +1,62 @@
-Syntax error in input LexToken(CLOSESQBRACKET,']',1,2475)
/* autogenerated from "macros/Linear/DELAYV_f.sci" */
-None
+function DELAYV_f() {
+DELAYV_f.prototype.get = function DELAYV_f() {
+}
+DELAYV_f.prototype.set = function DELAYV_f() {
+x=arg1;
+graphics=arg1.graphics;
+exprs=graphics.exprs;
+model=arg1.model;
+nin=model.in(1);
+z0=model.dstate;
+zz0=z0.slice(1-1,$-1);
+told=z0($);
+while (true) {
+[ok,nin,zz0,T,exprs]=scicos_getvalue("Set delay parameters",["Number of inputs","Register initial condition","Max delay"],list("vec",1,"vec",-1,"vec",1),exprs);
+if (!ok) {
+break
+}
+if (size(zz0,"*")<2) {
+message("Register length must be at least 2");
+ok=None;
+}
+if (T<=0) {
+message("Delay must be positive");
+ok=None;
+}
+if (ok) {
+[model,graphics,ok]=check_io(model,graphics,[nin,1],nin,1,[1,1]);
+}
+if (ok) {
+graphics.exprs=exprs;
+model.dstate=[zz0.slice(),told];
+model.rpar=T/(size(zz0,"*"));
+x.graphics=graphics;
+x.model=model;
+break
+}
+}
+}
+DELAYV_f.prototype.define = function DELAYV_f() {
+nin=1;
+z0=zeros(11,1);
+zz0=z0.slice(1-1,$-1);
+T=1;
+model=scicos_model();
+model.sim=list("delayv",1);
+model.in=[nin,1];
+model.out=nin;
+model.evtin=1;
+model.evtout=[1,1];
+model.dstate=z0;
+model.rpar=T/(size(zz0,"*"));
+model.blocktype="d";
+model.firing=[0,-1];
+model.dep_ut=[true,None];
+exprs=[string(nin),strcat(string(z0.slice(1-1,$-1)),";"),string(T)];
+gr_i=[];
+x=standard_define([3,2],model,exprs,gr_i);
+}
+DELAYV_f.prototype.details = function DELAYV_f() {
+}
+}
diff --git a/js/Linear/DOLLAR.js b/js/Linear/DOLLAR.js
index 0b9c7139..8625f8e1 100644
--- a/js/Linear/DOLLAR.js
+++ b/js/Linear/DOLLAR.js
@@ -1,3 +1,90 @@
-Syntax error in input LexToken(CLOSESQBRACKET,']',1,1335)
/* autogenerated from "macros/Linear/DOLLAR.sci" */
-None
+function DOLLAR() {
+DOLLAR.prototype.get = function DOLLAR() {
+}
+DOLLAR.prototype.set = function DOLLAR() {
+x=arg1;
+graphics=arg1.graphics;
+exprs=graphics.exprs;
+model=arg1.model;
+if (size(exprs,"*")<2) {
+exprs[2-1]="0";
+}
+while (true) {
+[ok,a,inh,exprs]=scicos_getvalue("Set 1/z block parameters",["initial condition","Inherit (no:0, yes:1)"],list("mat",[-1,-2],"vec",-1),exprs);
+if (!ok) {
+break
+}
+out=[size(a,1),size(a,2)];
+if (out==0) {
+out=[];
+}
+in1=out;
+model.sim=list("dollar4_m",4);
+model.odstate=list(a);
+model.dstate=[];
+if (type((a)==1)) {
+if (isreal(a)) {
+it=1;
+ot=1;
+if ((size(a,1)==1||size(a,2)==1)) {
+model.sim=list("dollar4",4);
+model.dstate=a.slice();
+model.odstate=list();
+}
+} else {
+it=2;
+ot=2;
+}
+} else if ((typeof(a)=="int32")) {
+it=3;
+ot=3;
+} else if ((typeof(a)=="int16")) {
+it=4;
+ot=4;
+} else if ((typeof(a)=="int8")) {
+it=5;
+ot=5;
+} else if ((typeof(a)=="uint32")) {
+it=6;
+ot=6;
+} else if ((typeof(a)=="uint16")) {
+it=7;
+ot=7;
+} else if ((typeof(a)=="uint8")) {
+it=8;
+ot=8;
+} else {
+message("type is not recognized");
+ok=None;
+}
+if (ok) {
+[model,graphics,ok]=set_io(model,graphics,list(in1,it),list(out,ot),ones(1-inh,1),[]);
+}
+if (ok) {
+graphics.exprs=exprs;
+x.graphics=graphics;
+x.model=model;
+break
+}
+}
+}
+DOLLAR.prototype.define = function DOLLAR() {
+z=0;
+inh=0;
+in1=1;
+exprs=string([z,inh]);
+model=scicos_model();
+model.sim=list("dollar4",4);
+model.in=in1;
+model.out=in1;
+model.evtin=1-inh;
+model.dstate=z;
+model.blocktype="d";
+model.dep_ut=[None,None];
+gr_i=[];
+x=standard_define([2,2],model,exprs,gr_i);
+}
+DOLLAR.prototype.details = function DOLLAR() {
+}
+}
diff --git a/js/Linear/DOLLAR_m.js b/js/Linear/DOLLAR_m.js
index df3dace5..5f9397f6 100644
--- a/js/Linear/DOLLAR_m.js
+++ b/js/Linear/DOLLAR_m.js
@@ -1,3 +1,90 @@
-Syntax error in input LexToken(CLOSESQBRACKET,']',1,1337)
/* autogenerated from "macros/Linear/DOLLAR_m.sci" */
-None
+function DOLLAR_m() {
+DOLLAR_m.prototype.get = function DOLLAR_m() {
+}
+DOLLAR_m.prototype.set = function DOLLAR_m() {
+x=arg1;
+graphics=arg1.graphics;
+exprs=graphics.exprs;
+model=arg1.model;
+if (size(exprs,"*")<2) {
+exprs[2-1]="0";
+}
+while (true) {
+[ok,a,inh,exprs]=scicos_getvalue("Set 1/z block parameters",["initial condition","Inherit (no:0, yes:1)"],list("mat",[-1,-2],"vec",-1),exprs);
+if (!ok) {
+break
+}
+out=[size(a,1),size(a,2)];
+if (out==0) {
+out=[];
+}
+in1=out;
+model.sim=list("dollar4_m",4);
+model.odstate=list(a);
+model.dstate=[];
+if ((type(a)==1)) {
+if (isreal(a)) {
+it=1;
+ot=1;
+if ((size(a,1)==1||size(a,2)==1)) {
+model.sim=list("dollar4",4);
+model.dstate=a.slice();
+model.odstate=list();
+}
+} else {
+it=2;
+ot=2;
+}
+} else if ((typeof(a)=="int32")) {
+it=3;
+ot=3;
+} else if ((typeof(a)=="int16")) {
+it=4;
+ot=4;
+} else if ((typeof(a)=="int8")) {
+it=5;
+ot=5;
+} else if ((typeof(a)=="uint32")) {
+it=6;
+ot=6;
+} else if ((typeof(a)=="uint16")) {
+it=7;
+ot=7;
+} else if ((typeof(a)=="uint8")) {
+it=8;
+ot=8;
+} else {
+message("type is not recognized");
+ok=None;
+}
+if (ok) {
+[model,graphics,ok]=set_io(model,graphics,list(in1,it),list(out,ot),ones(1-inh,1),[]);
+}
+if (ok) {
+graphics.exprs=exprs;
+x.graphics=graphics;
+x.model=model;
+break
+}
+}
+}
+DOLLAR_m.prototype.define = function DOLLAR_m() {
+z=0;
+inh=0;
+in1=1;
+exprs=string([z,inh]);
+model=scicos_model();
+model.sim=list("dollar4",4);
+model.in=in1;
+model.out=in1;
+model.evtin=1-inh;
+model.dstate=z;
+model.blocktype="d";
+model.dep_ut=[None,None];
+gr_i=[];
+x=standard_define([2,2],model,exprs,gr_i);
+}
+DOLLAR_m.prototype.details = function DOLLAR_m() {
+}
+}
diff --git a/js/Linear/INTEGRAL_m.js b/js/Linear/INTEGRAL_m.js
index e40f7dc0..e2d2c6b1 100644
--- a/js/Linear/INTEGRAL_m.js
+++ b/js/Linear/INTEGRAL_m.js
@@ -1,3 +1,123 @@
-Syntax error in input LexToken(CLOSESQBRACKET,']',1,1360)
/* autogenerated from "macros/Linear/INTEGRAL_m.sci" */
-None
+function INTEGRAL_m() {
+INTEGRAL_m.prototype.get = function INTEGRAL_m() {
+}
+INTEGRAL_m.prototype.set = function INTEGRAL_m() {
+x=arg1;
+graphics=arg1.graphics;
+exprs=graphics.exprs;
+model=arg1.model;
+while (true) {
+[ok,x0,reinit,satur,maxp,lowp,exprs]=scicos_getvalue("Set Integral block parameters",["Initial Condition","With re-intialization (1:yes, 0:no)","With saturation (1:yes, 0:no)","Upper limit","Lower limit"],list("mat",[-1,-1],"vec",1,"vec",1,"mat",[-1,-1],"mat",[-1,-1]),exprs);
+if (!ok) {
+break
+}
+if (isreal(x0)) {
+Datatype=1;
+} else {
+Datatype=2;
+}
+if (reinit!=0) {
+reinit=1;
+}
+if (satur!=0) {
+satur=1;
+if (Datatype==1) {
+if (size(maxp,"*")==1) {
+maxp=maxp*ones(x0);
+}
+if (size(lowp,"*")==1) {
+lowp=lowp*ones(x0);
+}
+if ((size(x0)!=size(maxp)||size(x0)!=size(lowp))) {
+message("x0 and Upper limit and Lower limit must have same size");
+ok=None;
+} else if (or(maxp<=lowp)) {
+message("Upper limits must be > Lower limits");
+ok=None;
+} else if (or(x0>maxp)||or(x0<lowp)) {
+message("Initial condition x0 should be inside the limits");
+ok=None;
+} else {
+rpar=[real(maxp.slice()),real(lowp.slice())];
+model.nzcross=size(x0,"*");
+model.nmode=size(x0,"*");
+}
+} else if ((Datatype==2)) {
+if (size(maxp,"*")==1) {
+maxp=math.complex(maxp*ones(x0),(maxp*ones(x0)));
+}
+if (size(lowp,"*")==1) {
+lowp=math.complex(lowp*ones(x0),(lowp*ones(x0)));
+}
+if ((size(x0)!=size(maxp)||size(x0)!=size(lowp))) {
+message("x0 and Upper limit and Lower limit must have same size");
+ok=None;
+} else if (or(real(maxp)<=real(lowp))||or(imag(maxp)<=imag(lowp))) {
+message("Upper limits must be > Lower limits");
+ok=None;
+} else if (or(real(x0)>real(maxp))||or(real(x0)<real(lowp))||or(imag(x0)>imag(maxp))||or(imag(x0)<imag(lowp))) {
+message("Initial condition x0 should be inside the limits");
+ok=None;
+} else {
+rpar=[real(maxp.slice()),real(lowp.slice()),imag(maxp.slice()),imag(lowp.slice())];
+model.nzcross=2*size(x0,"*");
+model.nmode=2*size(x0,"*");
+}
+}
+} else {
+rpar=[];
+model.nzcross=0;
+model.nmode=0;
+}
+if (ok) {
+model.rpar=rpar;
+if ((Datatype==1)) {
+model.state=real(x0.slice());
+model.sim=list("integral_func",4);
+it=[1,ones(reinit,1)];
+ot=1;
+} else if ((Datatype==2)) {
+model.state=[real(x0.slice()),imag(x0.slice())];
+model.sim=list("integralz_func",4);
+it=[2,2*ones(reinit,1)];
+ot=2;
+} else {
+message("Datatype is not supported");
+ok=None;
+}
+if (ok) {
+in1=[size(x0,1)*[1,ones(reinit,1)],size(x0,2)*[1,ones(reinit,1)]];
+out=size(x0);
+[model,graphics,ok]=set_io(model,graphics,list(in1,it),list(out,ot),ones(reinit,1),[]);
+}
+}
+if (ok) {
+graphics.exprs=exprs;
+x.graphics=graphics;
+x.model=model;
+break
+}
+}
+}
+INTEGRAL_m.prototype.define = function INTEGRAL_m() {
+maxp=1;
+minp=-1;
+rpar=[];
+model=scicos_model();
+model.state=0;
+model.sim=list("integral_func",4);
+model.in=1;
+model.out=1;
+model.in2=1;
+model.out2=1;
+model.rpar=rpar;
+model.blocktype="c";
+model.dep_ut=[None,true];
+exprs=string([0,0,0,maxp,minp]);
+gr_i=[];
+x=standard_define([2,2],model,exprs,gr_i);
+}
+INTEGRAL_m.prototype.details = function INTEGRAL_m() {
+}
+}
diff --git a/js/Linear/SUMMATION.js b/js/Linear/SUMMATION.js
index 1c324d6d..0c15982e 100644
--- a/js/Linear/SUMMATION.js
+++ b/js/Linear/SUMMATION.js
@@ -1,4 +1,137 @@
-Syntax error in input LexToken(SEMICOLON,';',1,2902)
-Syntax error in input LexToken(VAR,'exprs',1,5706)
/* autogenerated from "macros/Linear/SUMMATION.sci" */
-None
+function SUMMATION() {
+SUMMATION.prototype.get = function SUMMATION() {
+}
+SUMMATION.prototype.set = function SUMMATION() {
+x=arg1;
+graphics=arg1.graphics;
+model=arg1.model;
+exprs=graphics.exprs;
+if (size(exprs,1)==1) {
+exprs=[sci2exp(1),exprs,sci2exp(0)];
+} else if (size(exprs,1)==2) {
+exprs=[exprs,sci2exp(0)];
+}
+while (true) {
+[ok,Datatype,sgn,satur,exprs]=scicos_getvalue("Set sum block parameters",["Datatype (1=real double 2=complex 3=int32 ...)","Number of inputs or sign vector (of +1, -1)","Do on Overflow(0=Nothing 1=Saturate 2=Error)"],list("vec",1,"vec",-1,"vec",1),exprs);
+if (!ok) {
+break
+}
+sgn=sgn.slice();
+if ((satur!=0&&satur!=1&&satur!=2)) {
+message("Do on overflow must be 0,1,2");
+ok=None;
+}
+if (size(sgn,1)==1) {
+if (sgn<1) {
+message("Number of inputs must be > 0");
+ok=None;
+} else if (sgn==1) {
+in1=-1;
+in2=-2;
+sgn=[];
+nout=1;
+nout2=1;
+} else {
+in1=-ones(sgn,1);
+in2=2*in1;
+sgn=ones(sgn,1);
+nout=-1;
+nout2=-2;
+}
+} else {
+if (!and(abs(sgn)==1)) {
+message("Signs can only be +1 or -1");
+ok=None;
+} else {
+in1=-ones(size(sgn,1),1);
+in2=2*in1;
+nout=-1;
+nout2=-2;
+}
+}
+it=Datatype*ones(1,size(in1,1));
+ot=Datatype;
+if (Datatype==1) {
+model.sim=list("summation",4);
+} else if (Datatype==2) {
+model.sim=list("summation_z",4);
+} else if (((Datatype<1)||(Datatype>8))) {
+message("Datatype is not supported");
+ok=None;
+} else {
+if (satur==0) {
+if (Datatype==3) {
+model.sim=list("summation_i32n",4);
+} else if (Datatype==4) {
+model.sim=list("summation_i16n",4);
+} else if (Datatype==5) {
+model.sim=list("summation_i8n",4);
+} else if (Datatype==6) {
+model.sim=list("summation_ui32n",4);
+} else if (Datatype==7) {
+model.sim=list("summation_ui16n",4);
+} else if (Datatype==8) {
+model.sim=list("summation_ui8n",4);
+}
+} else if (satur==1) {
+if (Datatype==3) {
+model.sim=list("summation_i32s",4);
+} else if (Datatype==4) {
+model.sim=list("summation_i16s",4);
+} else if (Datatype==5) {
+model.sim=list("summation_i8s",4);
+} else if (Datatype==6) {
+model.sim=list("summation_ui32s",4);
+} else if (Datatype==7) {
+model.sim=list("summation_ui16s",4);
+} else if (Datatype==8) {
+model.sim=list("summation_ui8s",4);
+}
+} else if (satur==2) {
+if (Datatype==3) {
+model.sim=list("summation_i32e",4);
+} else if (Datatype==4) {
+model.sim=list("summation_i16e",4);
+} else if (Datatype==5) {
+model.sim=list("summation_i8e",4);
+} else if (Datatype==6) {
+model.sim=list("summation_ui32e",4);
+} else if (Datatype==7) {
+model.sim=list("summation_ui16e",4);
+} else if (Datatype==8) {
+model.sim=list("summation_ui8e",4);
+}
+}
+}
+if (ok) {
+[model,graphics,ok]=set_io(model,graphics,list([in1,in2],it),list([nout,nout2],ot),[],[]);
+}
+if (ok) {
+model.rpar=satur;
+model.ipar=sgn;
+graphics.exprs=exprs;
+x.graphics=graphics;
+x.model=model;
+break
+}
+}
+}
+SUMMATION.prototype.define = function SUMMATION() {
+sgn=[1,-1];
+model=scicos_model();
+model.sim=list("summation",4);
+model.in=[-1,-1];
+model.out=-1;
+model.in2=[-2,-2];
+model.out2=-2;
+model.ipar=sgn;
+model.blocktype="c";
+model.dep_ut=[true,None];
+exprs=sci2exp(sgn);
+gr_i=[];
+x=standard_define([2,3],model,exprs,gr_i);
+}
+SUMMATION.prototype.details = function SUMMATION() {
+}
+}