diff options
author | Sunil Shetye | 2018-06-16 17:49:33 +0530 |
---|---|---|
committer | Sunil Shetye | 2018-06-16 17:49:33 +0530 |
commit | a208791a02511d50eed1663203ac26eabfdfaa6f (patch) | |
tree | 4dfefc8c0a984c07315d4e0a7c6025e0b511fa21 | |
parent | c7c01ce271610f7321a39a2b37cd29d308fb8dbb (diff) | |
download | sci2js-a208791a02511d50eed1663203ac26eabfdfaa6f.tar.gz sci2js-a208791a02511d50eed1663203ac26eabfdfaa6f.tar.bz2 sci2js-a208791a02511d50eed1663203ac26eabfdfaa6f.zip |
add spacing in for statement
-rw-r--r-- | combined.js | 66 | ||||
-rw-r--r-- | js/Electrical/CCS.js | 2 | ||||
-rw-r--r-- | js/Electrical/CVS.js | 2 | ||||
-rw-r--r-- | js/Electrical/Gyrator.js | 2 | ||||
-rw-r--r-- | js/Electrical/IdealTransformer.js | 2 | ||||
-rw-r--r-- | js/Electrical/NPN.js | 2 | ||||
-rw-r--r-- | js/Electrical/PNP.js | 2 | ||||
-rw-r--r-- | js/Events/MCLOCK_f.js | 2 | ||||
-rw-r--r-- | js/Hydraulics/Flowmeter.js | 2 | ||||
-rw-r--r-- | js/IntegerOp/JKFLIPFLOP.js | 2 | ||||
-rw-r--r-- | js/IntegerOp/SRFLIPFLOP.js | 2 | ||||
-rw-r--r-- | js/Linear/DELAY_f.js | 2 | ||||
-rw-r--r-- | js/Linear/PID.js | 2 | ||||
-rw-r--r-- | js/MatrixOp/EXTRACT.js | 4 | ||||
-rw-r--r-- | js/Misc/BOUNCE.js | 8 | ||||
-rw-r--r-- | js/Misc/BOUNCEXY.js | 4 | ||||
-rw-r--r-- | js/Misc/CONSTRAINT2_c.js | 2 | ||||
-rw-r--r-- | js/Misc/ENDBLK.js | 6 | ||||
-rw-r--r-- | js/Sinks/CANIMXY3D.js | 2 | ||||
-rw-r--r-- | js/Sinks/CMSCOPE.js | 2 | ||||
-rw-r--r-- | js/Sinks/CSCOPXY3D.js | 2 | ||||
-rw-r--r-- | js/Sources/CLOCK_c.js | 2 | ||||
-rw-r--r-- | js/Sources/CLOCK_f.js | 2 | ||||
-rw-r--r-- | js/Sources/FROMWSB.js | 6 | ||||
-rw-r--r-- | js/Threshold/ZCROSS_f.js | 2 | ||||
-rwxr-xr-x | sci2jsyacc.py | 49 |
26 files changed, 89 insertions, 92 deletions
diff --git a/combined.js b/combined.js index 05aa334b..b95eafb6 100644 --- a/combined.js +++ b/combined.js @@ -78,7 +78,7 @@ MI=[]; MO=[]; P=[50,105,-1,90,0,10,2,0,101,10,-2,0]; PortName=["Mesure","C1","C2"]; -for(i=1;i<=size(P,"r");i+=1) { +for (i=1;i<=size(P,"r");i+=1) { if (P(i,3)==1) { Typein=[Typein,"E"]; MI=[MI,PortName(i)]; @@ -653,7 +653,7 @@ function MCLOCK_f() { MCLOCK_f.prototype.get = function MCLOCK_f() { } MCLOCK_f.prototype.set = function MCLOCK_f() { -for(i=1;i<=length(arg1.model.rpar.objs);i+=1) { +for (i=1;i<=length(arg1.model.rpar.objs);i+=1) { o=arg1.model.rpar.objs(i); if (typeof(o)=="Block"&&o.gui=="MFCLCK_f") { path=i; @@ -1455,7 +1455,7 @@ DELAY_f.prototype.get = function DELAY_f() { } DELAY_f.prototype.set = function DELAY_f() { ppath=list(0,0); -for(i=1;i<=length(arg1.model.rpar.objs);i+=1) { +for (i=1;i<=length(arg1.model.rpar.objs);i+=1) { o=arg1.model.rpar.objs(i); if (typeof(o)=="Block"&&o.gui=="REGISTER_f") { ppath[1-1]=i; @@ -2967,7 +2967,7 @@ PID.prototype.get = function PID() { } PID.prototype.set = function PID() { ppath=list(0,0,0); -for(i=1;i<=length(arg1.model.rpar.objs);i+=1) { +for (i=1;i<=length(arg1.model.rpar.objs);i+=1) { o=arg1.model.rpar.objs(i); if (typeof(o)=="Link") { from=arg1.model.rpar.objs(o.from(1)); @@ -3468,7 +3468,7 @@ mess=[mess,"Buffer size must be at least 1"," "]; ok=None; } if (N<2) { -for(i=1;i<=nbr_curves;i+=1) { +for (i=1;i<=nbr_curves;i+=1) { if (clrs(i)>0) { mess=[mess,"Buffer size must be at least 2 or Change a color (must be <0)"," "]; ok=None; @@ -3647,7 +3647,7 @@ mess=[mess,"Buffer size must be at least 1"," "]; ok=None; } if (N<2) { -for(i=1;i<=size(clrs,"*");i+=1) { +for (i=1;i<=size(clrs,"*");i+=1) { if (clrs(i)>0) { mess=[mess,"Buffer size must be at least 2 or Change a color (must be >0)"," "]; ok=None; @@ -4211,7 +4211,7 @@ if (size(per,"*")!=size(ymin,"*")) { mess=[mess,"Size of Refresh Period must equal size of Ymin/Ymax vector"," "]; ok=None; } -for(i=1;i<=size(per,"*");i+=1) { +for (i=1;i<=size(per,"*");i+=1) { if ((per(i)<=0)) { mess=[mess,"Refresh Period must be positive"," "]; ok=None; @@ -6320,7 +6320,7 @@ function CLOCK_c() { CLOCK_c.prototype.get = function CLOCK_c() { } CLOCK_c.prototype.set = function CLOCK_c() { -for(i=1;i<=length(arg1.model.rpar.objs);i+=1) { +for (i=1;i<=length(arg1.model.rpar.objs);i+=1) { o=arg1.model.rpar.objs(i); if (typeof(o)=="Block"&&o.gui=="EVTDLY_c") { path=i; @@ -6994,7 +6994,7 @@ function CLOCK_f() { CLOCK_f.prototype.get = function CLOCK_f() { } CLOCK_f.prototype.set = function CLOCK_f() { -for(i=1;i<=length(arg1.model.rpar.objs);i+=1) { +for (i=1;i<=length(arg1.model.rpar.objs);i+=1) { o=arg1.model.rpar.objs(i); if (typeof(o)=="Block"&&o.gui=="EVTDLY_f") { path=i; @@ -7298,7 +7298,7 @@ function FROMWSB() { FROMWSB.prototype.get = function FROMWSB() { } FROMWSB.prototype.set = function FROMWSB() { -for(i=1;i<=length(arg1.model.rpar.objs);i+=1) { +for (i=1;i<=length(arg1.model.rpar.objs);i+=1) { o=arg1.model.rpar.objs(i); if (typeof(o)=="Block"&&o.gui=="FROMWS_c") { ppath=list(i); @@ -7307,10 +7307,10 @@ break } newpar=list(); y=0; -for(path in ppath) { +for (path in ppath) { np=size(path,"*"); spath=list(); -for(k=1;k<=np;k+=1) { +for (k=1;k<=np;k+=1) { spath[$+1-1]="model"; spath[$+1-1]="rpar"; spath[$+1-1]="objs"; @@ -8923,13 +8923,13 @@ if ((ma==0||mb==0)) { message("empty field"); ok=None; } -for(i=1;i<=ma;i+=1) { +for (i=1;i<=ma;i+=1) { if ((a(i)<=0)) { message("invalid index"); ok=None; } } -for(j=1;j<=mb;j+=1) { +for (j=1;j<=mb;j+=1) { if ((b(j)<=0)) { message("invalid index"); ok=None; @@ -9369,7 +9369,7 @@ if (in1<=0) { message("Block must have at least one input"); } else { kk=0; -for(jj=1;jj<=in1;jj+=1) { +for (jj=1;jj<=in1;jj+=1) { kk=kk+2^(in1+jj-1); } model.rpar=[-ones(kk,1),zeros(2^(2*in1)-kk,1)]; @@ -9527,7 +9527,7 @@ MI=[]; MO=[]; P=[2,50,1,0,70,98,2,0,70,2,-2,0]; PortName=["Iin","p","n"]; -for(i=1;i<=size(P,"r");i+=1) { +for (i=1;i<=size(P,"r");i+=1) { if (P(i,3)==1) { Typein=[Typein,"E"]; MI=[MI,PortName(i)]; @@ -9746,7 +9746,7 @@ MI=[]; MO=[]; P=[2.5,90,2,0,2.5,10,2,0,97.5,90,-2,0,97.5,10,-2,0]; PortName=["p1","n1","p2","n2"]; -for(i=1;i<=size(P,"r");i+=1) { +for (i=1;i<=size(P,"r");i+=1) { if (P(i,3)==1) { Typein=[Typein,"E"]; MI=[MI,PortName(i)]; @@ -9835,7 +9835,7 @@ MI=[]; MO=[]; P=[2,50,1,0,70,98,2,0,70,2,-2,0]; PortName=["vin","p","n"]; -for(i=1;i<=size(P,"r");i+=1) { +for (i=1;i<=size(P,"r");i+=1) { if (P(i,3)==1) { Typein=[Typein,"E"]; MI=[MI,PortName(i)]; @@ -9953,7 +9953,7 @@ MI=[]; MO=[]; P=[100,90,-2,0,0,50,2,0,100,10,-2,0]; PortName=["C","B","E"]; -for(i=1;i<=size(P,"r");i+=1) { +for (i=1;i<=size(P,"r");i+=1) { if (P(i,3)==1) { Typein=[Typein,"E"]; MI=[MI,PortName(i)]; @@ -10025,7 +10025,7 @@ MI=[]; MO=[]; P=[100,90,-2,0,0,50,2,0,100,10,-2,0]; PortName=["C","B","E"]; -for(i=1;i<=size(P,"r");i+=1) { +for (i=1;i<=size(P,"r");i+=1) { if (P(i,3)==1) { Typein=[Typein,"E"]; MI=[MI,PortName(i)]; @@ -10537,7 +10537,7 @@ MI=[]; MO=[]; P=[2.5,90,2,0,2.5,10,2,0,97.5,90,-2,0,97.5,10,-2,0]; PortName=["p1","n1","p2","n2"]; -for(i=1;i<=size(P,"r");i+=1) { +for (i=1;i<=size(P,"r");i+=1) { if (P(i,3)==1) { Typein=[Typein,"E"]; MI=[MI,PortName(i)]; @@ -10810,8 +10810,8 @@ break if (ok) { k=1; ipar=[]; -for(i=1;i<=n;i+=1) { -for(j=i+1;j<=n;j+=1) { +for (i=1;i<=n;i+=1) { +for (j=i+1;j<=n;j+=1) { ipar[k-1]=i; k=k+1; ipar[k-1]=j; @@ -10835,8 +10835,8 @@ BOUNCE.prototype.define = function BOUNCE() { n=2; k=1; ipar=[]; -for(i=1;i<=n;i+=1) { -for(j=i+1;j<=n;j+=1) { +for (i=1;i<=n;i+=1) { +for (j=i+1;j<=n;j+=1) { ipar[k-1]=i; k=k+1; ipar[k-1]=j; @@ -11069,7 +11069,7 @@ x_message("number of states (constraints) must be > 0 "); ask_again=true; } if ((!ask_again)) { -for(i=1;i<=N;i+=1) { +for (i=1;i<=N;i+=1) { if (!((id(i)==0)||(id(i)==1))) { ask_again=true; x_message(["Id(i) must be either","0 when x\'(i) is not present in the feedback","1: when x\'(i) is present in the feedback"]); @@ -11936,7 +11936,7 @@ message(mess); rpar=[xmin,xmax,ymin,ymax]; ipar=[win,imode,clrs.slice()]; z=[]; -for(i=1;i<=size(clrs,"*");i+=1) { +for (i=1;i<=size(clrs,"*");i+=1) { z[6*(i-1)+1-1]=0; z[6*(i-1)+2-1]=0; z[6*(i-1)+3-1]=2*siz(i); @@ -11970,7 +11970,7 @@ model.in2=[1,1]; model.intyp=[1,1]; model.evtin=1; z=[]; -for(i=1;i<=size(clrs,"*");i+=1) { +for (i=1;i<=size(clrs,"*");i+=1) { z[6*(i-1)+1-1]=0; z[6*(i-1)+2-1]=0; z[6*(i-1)+3-1]=2*siz(i); @@ -12388,7 +12388,7 @@ function ENDBLK() { ENDBLK.prototype.get = function ENDBLK() { } ENDBLK.prototype.set = function ENDBLK() { -for(i=1;i<=length(arg1.model.rpar.objs);i+=1) { +for (i=1;i<=length(arg1.model.rpar.objs);i+=1) { o=arg1.model.rpar.objs(i); if (typeof(o)=="Block"&&o.gui=="END_c") { ppath=list(i); @@ -12397,10 +12397,10 @@ break } newpar=list(); y=0; -for(path in ppath) { +for (path in ppath) { np=size(path,"*"); spath=list(); -for(k=1;k<=np;k+=1) { +for (k=1;k<=np;k+=1) { spath[$+1-1]="model"; spath[$+1-1]="rpar"; spath[$+1-1]="objs"; @@ -12948,7 +12948,7 @@ function SRFLIPFLOP() { SRFLIPFLOP.prototype.get = function SRFLIPFLOP() { } SRFLIPFLOP.prototype.set = function SRFLIPFLOP() { -for(i=1;i<=length(arg1.model.rpar.objs);i+=1) { +for (i=1;i<=length(arg1.model.rpar.objs);i+=1) { o=arg1.model.rpar.objs(i); if (typeof(o)=="Block"&&o.gui=="DOLLAR_m") { path=i; @@ -13110,7 +13110,7 @@ function JKFLIPFLOP() { JKFLIPFLOP.prototype.get = function JKFLIPFLOP() { } JKFLIPFLOP.prototype.set = function JKFLIPFLOP() { -for(i=1;i<=length(arg1.model.rpar.objs);i+=1) { +for (i=1;i<=length(arg1.model.rpar.objs);i+=1) { o=arg1.model.rpar.objs(i); if (typeof(o)=="Block"&&o.gui=="DOLLAR_m") { path=i; diff --git a/js/Electrical/CCS.js b/js/Electrical/CCS.js index 7b6c8f8a..05beb332 100644 --- a/js/Electrical/CCS.js +++ b/js/Electrical/CCS.js @@ -20,7 +20,7 @@ MI=[]; MO=[]; P=[2,50,1,0,70,98,2,0,70,2,-2,0]; PortName=["Iin","p","n"]; -for(i=1;i<=size(P,"r");i+=1) { +for (i=1;i<=size(P,"r");i+=1) { if (P(i,3)==1) { Typein=[Typein,"E"]; MI=[MI,PortName(i)]; diff --git a/js/Electrical/CVS.js b/js/Electrical/CVS.js index fafe0170..f775ee36 100644 --- a/js/Electrical/CVS.js +++ b/js/Electrical/CVS.js @@ -20,7 +20,7 @@ MI=[]; MO=[]; P=[2,50,1,0,70,98,2,0,70,2,-2,0]; PortName=["vin","p","n"]; -for(i=1;i<=size(P,"r");i+=1) { +for (i=1;i<=size(P,"r");i+=1) { if (P(i,3)==1) { Typein=[Typein,"E"]; MI=[MI,PortName(i)]; diff --git a/js/Electrical/Gyrator.js b/js/Electrical/Gyrator.js index bd401713..4b5c01c9 100644 --- a/js/Electrical/Gyrator.js +++ b/js/Electrical/Gyrator.js @@ -30,7 +30,7 @@ MI=[]; MO=[]; P=[2.5,90,2,0,2.5,10,2,0,97.5,90,-2,0,97.5,10,-2,0]; PortName=["p1","n1","p2","n2"]; -for(i=1;i<=size(P,"r");i+=1) { +for (i=1;i<=size(P,"r");i+=1) { if (P(i,3)==1) { Typein=[Typein,"E"]; MI=[MI,PortName(i)]; diff --git a/js/Electrical/IdealTransformer.js b/js/Electrical/IdealTransformer.js index 9f127ca9..52631f73 100644 --- a/js/Electrical/IdealTransformer.js +++ b/js/Electrical/IdealTransformer.js @@ -30,7 +30,7 @@ MI=[]; MO=[]; P=[2.5,90,2,0,2.5,10,2,0,97.5,90,-2,0,97.5,10,-2,0]; PortName=["p1","n1","p2","n2"]; -for(i=1;i<=size(P,"r");i+=1) { +for (i=1;i<=size(P,"r");i+=1) { if (P(i,3)==1) { Typein=[Typein,"E"]; MI=[MI,PortName(i)]; diff --git a/js/Electrical/NPN.js b/js/Electrical/NPN.js index 18dd01a7..af20e840 100644 --- a/js/Electrical/NPN.js +++ b/js/Electrical/NPN.js @@ -30,7 +30,7 @@ MI=[]; MO=[]; P=[100,90,-2,0,0,50,2,0,100,10,-2,0]; PortName=["C","B","E"]; -for(i=1;i<=size(P,"r");i+=1) { +for (i=1;i<=size(P,"r");i+=1) { if (P(i,3)==1) { Typein=[Typein,"E"]; MI=[MI,PortName(i)]; diff --git a/js/Electrical/PNP.js b/js/Electrical/PNP.js index a6201f02..9f5c916c 100644 --- a/js/Electrical/PNP.js +++ b/js/Electrical/PNP.js @@ -30,7 +30,7 @@ MI=[]; MO=[]; P=[100,90,-2,0,0,50,2,0,100,10,-2,0]; PortName=["C","B","E"]; -for(i=1;i<=size(P,"r");i+=1) { +for (i=1;i<=size(P,"r");i+=1) { if (P(i,3)==1) { Typein=[Typein,"E"]; MI=[MI,PortName(i)]; diff --git a/js/Events/MCLOCK_f.js b/js/Events/MCLOCK_f.js index 10706233..f28cd0bb 100644 --- a/js/Events/MCLOCK_f.js +++ b/js/Events/MCLOCK_f.js @@ -3,7 +3,7 @@ function MCLOCK_f() { MCLOCK_f.prototype.get = function MCLOCK_f() { } MCLOCK_f.prototype.set = function MCLOCK_f() { -for(i=1;i<=length(arg1.model.rpar.objs);i+=1) { +for (i=1;i<=length(arg1.model.rpar.objs);i+=1) { o=arg1.model.rpar.objs(i); if (typeof(o)=="Block"&&o.gui=="MFCLCK_f") { path=i; diff --git a/js/Hydraulics/Flowmeter.js b/js/Hydraulics/Flowmeter.js index 2481eab0..65143545 100644 --- a/js/Hydraulics/Flowmeter.js +++ b/js/Hydraulics/Flowmeter.js @@ -30,7 +30,7 @@ MI=[]; MO=[]; P=[50,105,-1,90,0,10,2,0,101,10,-2,0]; PortName=["Mesure","C1","C2"]; -for(i=1;i<=size(P,"r");i+=1) { +for (i=1;i<=size(P,"r");i+=1) { if (P(i,3)==1) { Typein=[Typein,"E"]; MI=[MI,PortName(i)]; diff --git a/js/IntegerOp/JKFLIPFLOP.js b/js/IntegerOp/JKFLIPFLOP.js index 250a4697..14641c09 100644 --- a/js/IntegerOp/JKFLIPFLOP.js +++ b/js/IntegerOp/JKFLIPFLOP.js @@ -3,7 +3,7 @@ function JKFLIPFLOP() { JKFLIPFLOP.prototype.get = function JKFLIPFLOP() { } JKFLIPFLOP.prototype.set = function JKFLIPFLOP() { -for(i=1;i<=length(arg1.model.rpar.objs);i+=1) { +for (i=1;i<=length(arg1.model.rpar.objs);i+=1) { o=arg1.model.rpar.objs(i); if (typeof(o)=="Block"&&o.gui=="DOLLAR_m") { path=i; diff --git a/js/IntegerOp/SRFLIPFLOP.js b/js/IntegerOp/SRFLIPFLOP.js index bf0a2ac0..33c1dcfa 100644 --- a/js/IntegerOp/SRFLIPFLOP.js +++ b/js/IntegerOp/SRFLIPFLOP.js @@ -3,7 +3,7 @@ function SRFLIPFLOP() { SRFLIPFLOP.prototype.get = function SRFLIPFLOP() { } SRFLIPFLOP.prototype.set = function SRFLIPFLOP() { -for(i=1;i<=length(arg1.model.rpar.objs);i+=1) { +for (i=1;i<=length(arg1.model.rpar.objs);i+=1) { o=arg1.model.rpar.objs(i); if (typeof(o)=="Block"&&o.gui=="DOLLAR_m") { path=i; diff --git a/js/Linear/DELAY_f.js b/js/Linear/DELAY_f.js index f4372065..5b3b20da 100644 --- a/js/Linear/DELAY_f.js +++ b/js/Linear/DELAY_f.js @@ -4,7 +4,7 @@ DELAY_f.prototype.get = function DELAY_f() { } DELAY_f.prototype.set = function DELAY_f() { ppath=list(0,0); -for(i=1;i<=length(arg1.model.rpar.objs);i+=1) { +for (i=1;i<=length(arg1.model.rpar.objs);i+=1) { o=arg1.model.rpar.objs(i); if (typeof(o)=="Block"&&o.gui=="REGISTER_f") { ppath[1-1]=i; diff --git a/js/Linear/PID.js b/js/Linear/PID.js index cf55e494..d54409e2 100644 --- a/js/Linear/PID.js +++ b/js/Linear/PID.js @@ -4,7 +4,7 @@ PID.prototype.get = function PID() { } PID.prototype.set = function PID() { ppath=list(0,0,0); -for(i=1;i<=length(arg1.model.rpar.objs);i+=1) { +for (i=1;i<=length(arg1.model.rpar.objs);i+=1) { o=arg1.model.rpar.objs(i); if (typeof(o)=="Link") { from=arg1.model.rpar.objs(o.from(1)); diff --git a/js/MatrixOp/EXTRACT.js b/js/MatrixOp/EXTRACT.js index 685ee370..6bd3ad1c 100644 --- a/js/MatrixOp/EXTRACT.js +++ b/js/MatrixOp/EXTRACT.js @@ -35,13 +35,13 @@ if ((ma==0||mb==0)) { message("empty field"); ok=None; } -for(i=1;i<=ma;i+=1) { +for (i=1;i<=ma;i+=1) { if ((a(i)<=0)) { message("invalid index"); ok=None; } } -for(j=1;j<=mb;j+=1) { +for (j=1;j<=mb;j+=1) { if ((b(j)<=0)) { message("invalid index"); ok=None; diff --git a/js/Misc/BOUNCE.js b/js/Misc/BOUNCE.js index 5328a819..8c3ba2b5 100644 --- a/js/Misc/BOUNCE.js +++ b/js/Misc/BOUNCE.js @@ -44,8 +44,8 @@ break if (ok) { k=1; ipar=[]; -for(i=1;i<=n;i+=1) { -for(j=i+1;j<=n;j+=1) { +for (i=1;i<=n;i+=1) { +for (j=i+1;j<=n;j+=1) { ipar[k-1]=i; k=k+1; ipar[k-1]=j; @@ -69,8 +69,8 @@ BOUNCE.prototype.define = function BOUNCE() { n=2; k=1; ipar=[]; -for(i=1;i<=n;i+=1) { -for(j=i+1;j<=n;j+=1) { +for (i=1;i<=n;i+=1) { +for (j=i+1;j<=n;j+=1) { ipar[k-1]=i; k=k+1; ipar[k-1]=j; diff --git a/js/Misc/BOUNCEXY.js b/js/Misc/BOUNCEXY.js index cee2800f..0fe9c488 100644 --- a/js/Misc/BOUNCEXY.js +++ b/js/Misc/BOUNCEXY.js @@ -36,7 +36,7 @@ message(mess); rpar=[xmin,xmax,ymin,ymax]; ipar=[win,imode,clrs.slice()]; z=[]; -for(i=1;i<=size(clrs,"*");i+=1) { +for (i=1;i<=size(clrs,"*");i+=1) { z[6*(i-1)+1-1]=0; z[6*(i-1)+2-1]=0; z[6*(i-1)+3-1]=2*siz(i); @@ -70,7 +70,7 @@ model.in2=[1,1]; model.intyp=[1,1]; model.evtin=1; z=[]; -for(i=1;i<=size(clrs,"*");i+=1) { +for (i=1;i<=size(clrs,"*");i+=1) { z[6*(i-1)+1-1]=0; z[6*(i-1)+2-1]=0; z[6*(i-1)+3-1]=2*siz(i); diff --git a/js/Misc/CONSTRAINT2_c.js b/js/Misc/CONSTRAINT2_c.js index 1fcf1056..e4c460ef 100644 --- a/js/Misc/CONSTRAINT2_c.js +++ b/js/Misc/CONSTRAINT2_c.js @@ -28,7 +28,7 @@ x_message("number of states (constraints) must be > 0 "); ask_again=true; } if ((!ask_again)) { -for(i=1;i<=N;i+=1) { +for (i=1;i<=N;i+=1) { if (!((id(i)==0)||(id(i)==1))) { ask_again=true; x_message(["Id(i) must be either","0 when x\'(i) is not present in the feedback","1: when x\'(i) is present in the feedback"]); diff --git a/js/Misc/ENDBLK.js b/js/Misc/ENDBLK.js index 91699d72..ecc38460 100644 --- a/js/Misc/ENDBLK.js +++ b/js/Misc/ENDBLK.js @@ -3,7 +3,7 @@ function ENDBLK() { ENDBLK.prototype.get = function ENDBLK() { } ENDBLK.prototype.set = function ENDBLK() { -for(i=1;i<=length(arg1.model.rpar.objs);i+=1) { +for (i=1;i<=length(arg1.model.rpar.objs);i+=1) { o=arg1.model.rpar.objs(i); if (typeof(o)=="Block"&&o.gui=="END_c") { ppath=list(i); @@ -12,10 +12,10 @@ break } newpar=list(); y=0; -for(path in ppath) { +for (path in ppath) { np=size(path,"*"); spath=list(); -for(k=1;k<=np;k+=1) { +for (k=1;k<=np;k+=1) { spath[$+1-1]="model"; spath[$+1-1]="rpar"; spath[$+1-1]="objs"; diff --git a/js/Sinks/CANIMXY3D.js b/js/Sinks/CANIMXY3D.js index 870ee544..4e31e07b 100644 --- a/js/Sinks/CANIMXY3D.js +++ b/js/Sinks/CANIMXY3D.js @@ -42,7 +42,7 @@ mess=[mess,"Buffer size must be at least 1"," "]; ok=None; } if (N<2) { -for(i=1;i<=nbr_curves;i+=1) { +for (i=1;i<=nbr_curves;i+=1) { if (clrs(i)>0) { mess=[mess,"Buffer size must be at least 2 or Change a color (must be <0)"," "]; ok=None; diff --git a/js/Sinks/CMSCOPE.js b/js/Sinks/CMSCOPE.js index 55f1405d..c2f36d23 100644 --- a/js/Sinks/CMSCOPE.js +++ b/js/Sinks/CMSCOPE.js @@ -41,7 +41,7 @@ if (size(per,"*")!=size(ymin,"*")) { mess=[mess,"Size of Refresh Period must equal size of Ymin/Ymax vector"," "]; ok=None; } -for(i=1;i<=size(per,"*");i+=1) { +for (i=1;i<=size(per,"*");i+=1) { if ((per(i)<=0)) { mess=[mess,"Refresh Period must be positive"," "]; ok=None; diff --git a/js/Sinks/CSCOPXY3D.js b/js/Sinks/CSCOPXY3D.js index 33c32b3b..f77ab34a 100644 --- a/js/Sinks/CSCOPXY3D.js +++ b/js/Sinks/CSCOPXY3D.js @@ -38,7 +38,7 @@ mess=[mess,"Buffer size must be at least 1"," "]; ok=None; } if (N<2) { -for(i=1;i<=size(clrs,"*");i+=1) { +for (i=1;i<=size(clrs,"*");i+=1) { if (clrs(i)>0) { mess=[mess,"Buffer size must be at least 2 or Change a color (must be >0)"," "]; ok=None; diff --git a/js/Sources/CLOCK_c.js b/js/Sources/CLOCK_c.js index 8cad99ab..876c27be 100644 --- a/js/Sources/CLOCK_c.js +++ b/js/Sources/CLOCK_c.js @@ -3,7 +3,7 @@ function CLOCK_c() { CLOCK_c.prototype.get = function CLOCK_c() { } CLOCK_c.prototype.set = function CLOCK_c() { -for(i=1;i<=length(arg1.model.rpar.objs);i+=1) { +for (i=1;i<=length(arg1.model.rpar.objs);i+=1) { o=arg1.model.rpar.objs(i); if (typeof(o)=="Block"&&o.gui=="EVTDLY_c") { path=i; diff --git a/js/Sources/CLOCK_f.js b/js/Sources/CLOCK_f.js index b539c077..cac1c8a5 100644 --- a/js/Sources/CLOCK_f.js +++ b/js/Sources/CLOCK_f.js @@ -3,7 +3,7 @@ function CLOCK_f() { CLOCK_f.prototype.get = function CLOCK_f() { } CLOCK_f.prototype.set = function CLOCK_f() { -for(i=1;i<=length(arg1.model.rpar.objs);i+=1) { +for (i=1;i<=length(arg1.model.rpar.objs);i+=1) { o=arg1.model.rpar.objs(i); if (typeof(o)=="Block"&&o.gui=="EVTDLY_f") { path=i; diff --git a/js/Sources/FROMWSB.js b/js/Sources/FROMWSB.js index e6db9281..f6858549 100644 --- a/js/Sources/FROMWSB.js +++ b/js/Sources/FROMWSB.js @@ -3,7 +3,7 @@ function FROMWSB() { FROMWSB.prototype.get = function FROMWSB() { } FROMWSB.prototype.set = function FROMWSB() { -for(i=1;i<=length(arg1.model.rpar.objs);i+=1) { +for (i=1;i<=length(arg1.model.rpar.objs);i+=1) { o=arg1.model.rpar.objs(i); if (typeof(o)=="Block"&&o.gui=="FROMWS_c") { ppath=list(i); @@ -12,10 +12,10 @@ break } newpar=list(); y=0; -for(path in ppath) { +for (path in ppath) { np=size(path,"*"); spath=list(); -for(k=1;k<=np;k+=1) { +for (k=1;k<=np;k+=1) { spath[$+1-1]="model"; spath[$+1-1]="rpar"; spath[$+1-1]="objs"; diff --git a/js/Threshold/ZCROSS_f.js b/js/Threshold/ZCROSS_f.js index f84335bf..acb978fe 100644 --- a/js/Threshold/ZCROSS_f.js +++ b/js/Threshold/ZCROSS_f.js @@ -17,7 +17,7 @@ if (in1<=0) { message("Block must have at least one input"); } else { kk=0; -for(jj=1;jj<=in1;jj+=1) { +for (jj=1;jj<=in1;jj+=1) { kk=kk+2^(in1+jj-1); } model.rpar=[-ones(kk,1),zeros(2^(2*in1)-kk,1)]; diff --git a/sci2jsyacc.py b/sci2jsyacc.py index d033b959..cc09a5b0 100755 --- a/sci2jsyacc.py +++ b/sci2jsyacc.py @@ -24,22 +24,21 @@ jobblocks = {} def p_functionblock_function_statementblock_endfunction(p): 'functionblock : emptystatementblock FUNCTION lterm ASSIGNMENT VAR OPENBRACKET JOB COMMA VAR COMMA VAR CLOSEBRACKET EOL statementblock ENDFUNCTION emptystatementblock' - global jobblocks f = str(p[5]) p[0] = ('function ' + f + '() {\n' + - f + '.prototype.get = function ' + f + '() {\n' + - (jobblocks['"get"'] if '"get"' in jobblocks else '') + - '}\n' + - f + '.prototype.set = function ' + f + '() {\n' + - (jobblocks['"set"'] if '"set"' in jobblocks else '') + - '}\n' + - f + '.prototype.define = function ' + f + '() {\n' + - (jobblocks['"define"'] if '"define"' in jobblocks else '') + - '}\n' + - f + '.prototype.details = function ' + f + '() {\n' + - (jobblocks['"details"'] if '"details"' in jobblocks else '') + - '}\n' + - '}') + f + '.prototype.get = function ' + f + '() {\n' + + (jobblocks['"get"'] if '"get"' in jobblocks else '') + + '}\n' + + f + '.prototype.set = function ' + f + '() {\n' + + (jobblocks['"set"'] if '"set"' in jobblocks else '') + + '}\n' + + f + '.prototype.define = function ' + f + '() {\n' + + (jobblocks['"define"'] if '"define"' in jobblocks else '') + + '}\n' + + f + '.prototype.details = function ' + f + '() {\n' + + (jobblocks['"details"'] if '"details"' in jobblocks else '') + + '}\n' + + '}') # end define functionblock @@ -139,13 +138,11 @@ def p_casestatementblock_casestatement(p): def p_casejobstatementblock_casejobstatementblock_casejobstatement(p): 'casejobstatementblock : casejobstatementblock casejobstatement statementblock' - global jobblocks jobblocks[p[2]] = p[3] p[0] = '' def p_casejobstatementblock_casejobstatement(p): 'casejobstatementblock : casejobstatement statementblock' - global jobblocks jobblocks[p[1]] = p[2] p[0] = '' @@ -186,7 +183,7 @@ def p_forstatement_for_start_step_end(p): else: endop = '>=' stepop = '-=' - p[0] = p[1] + '(' + var + p[3] + start + ';' + var + endop + end + ';' + var + stepop + str(step) + ') {\n' + p[0] = 'for (%s=%s;%s%s%s;%s%s%s) {\n' % (var, start, var, endop, end, var, stepop, step) def p_forstatement_for_start_end(p): '''forstatement : FOR VAR ASSIGNMENT expression COLON expression EOL @@ -197,13 +194,13 @@ def p_forstatement_for_start_end(p): end = p[6] endop = '<=' stepop = '+=' - p[0] = p[1] + '(' + var + p[3] + start + ';' + var + endop + end + ';' + var + stepop + str(step) + ') {\n' + p[0] = 'for (%s=%s;%s%s%s;%s%s%s) {\n' % (var, start, var, endop, end, var, stepop, step) def p_forstatement_for_list(p): '''forstatement : FOR VAR ASSIGNMENT VAR EOL | FOR VAR ASSIGNMENT VAR DO EOL''' var = p[2] - p[0] = p[1] + '(' + var + ' in ' + p[4] + ') {\n' + p[0] = 'for (%s in %s) {\n' % (var, p[4]) def p_selectstatement_select(p): 'selectstatement : SELECT expression emptystatementblock' @@ -215,14 +212,14 @@ def p_selectjobstatement_select(p): def p_casestatement_case(p): '''casestatement : CASE expression THEN EOL - | CASE expression EOL - | CASE expression THEN COMMA''' + | CASE expression EOL + | CASE expression THEN COMMA''' p[0] = 'case ' + p[2] + ':\n' def p_casejobstatement_case(p): '''casejobstatement : CASE expression THEN EOL - | CASE expression EOL - | CASE expression THEN COMMA''' + | CASE expression EOL + | CASE expression THEN COMMA''' p[0] = p[2] def p_whilestatement_while_do(p): @@ -363,16 +360,16 @@ def p_expression_expression_addition_expression(p): def p_expression_expression_comparison_expression(p): 'expression : expression COMPARISON expression' o = p[2] - if (o == '<>' or o == '~='): + if o == '<>' or o == '~=': o = '!=' p[0] = str(p[1]) + o + str(p[3]) def p_expression_expression_logical_expression(p): 'expression : expression LOGICAL expression' o = p[2] - if (o == '&'): + if o == '&': o = '&&' - elif (o == '|'): + elif o == '|': o = '||' p[0] = str(p[1]) + o + str(p[3]) |