diff options
author | Sunil Shetye | 2018-06-25 12:08:56 +0530 |
---|---|---|
committer | Sunil Shetye | 2018-06-25 12:45:27 +0530 |
commit | 7c70459c10aed0d74ee03896abaf47fefdbf7c8f (patch) | |
tree | 6f6acc6a5087295c6e59f0f94bfda5025049d5fa /js/Sources | |
parent | 870479a2e4b932426a904b2ebae7e4ee72037326 (diff) | |
download | sci2js-7c70459c10aed0d74ee03896abaf47fefdbf7c8f.tar.gz sci2js-7c70459c10aed0d74ee03896abaf47fefdbf7c8f.tar.bz2 sci2js-7c70459c10aed0d74ee03896abaf47fefdbf7c8f.zip |
separate out code for getvalue
Diffstat (limited to 'js/Sources')
32 files changed, 1397 insertions, 1397 deletions
diff --git a/js/Sources/CLKINV_f.js b/js/Sources/CLKINV_f.js index c508c199..eef5c718 100644 --- a/js/Sources/CLKINV_f.js +++ b/js/Sources/CLKINV_f.js @@ -1,43 +1,43 @@ /* autogenerated from "macros/Sources/CLKINV_f.sci" */ function CLKINV_f() { CLKINV_f.prototype.define = function CLKINV_f() { -prt=1; -model=scicos_model(); -model.sim="input"; -model.evtout=1; -model.ipar=prt; -model.blocktype="d"; -model.firing=-1; -model.dep_ut=[false,false]; -exprs=string(prt); -gr_i=[]; -x=standard_define([1,1],model,exprs,gr_i); + prt = 1; + model = scicos_model(); + model.sim = "input"; + model.evtout = 1; + model.ipar = prt; + model.blocktype = "d"; + model.firing = -1; + model.dep_ut = [false,false]; + exprs = string(prt); + gr_i = []; + x = standard_define([1,1],model,exprs,gr_i); } CLKINV_f.prototype.details = function CLKINV_f() { } CLKINV_f.prototype.get = function CLKINV_f() { } CLKINV_f.prototype.set = function CLKINV_f() { -x=arg1; -graphics=arg1.graphics; -model=arg1.model; -exprs=graphics.exprs; -exprs=exprs[1-1]; -while (true) { -[ok,prt,exprs]=scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"CLKINV_f")],[" "],[gettext("Event input port")],[" "]],"Port Number",list("vec",1),exprs); -prt=int(prt); -if (!ok) { + x = arg1; + graphics = arg1.graphics; + model = arg1.model; + exprs = graphics.exprs; + exprs = exprs[1-1]; + while (true) { + [ok,prt,exprs] = scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"CLKINV_f")],[" "],[gettext("Event input port")],[" "]],"Port Number",list("vec",1),exprs); + prt = int(prt); + if (!ok) { break; } -if (prt<=0) { + if (prt<=0) { block_parameter_error(msprintf(gettext("Wrong values for \'Port Number\' parameter: %d."),prt),gettext("Strictly positive integer expected.")); -} else { -model.ipar=prt; -model.evtout=1; -model.firing=-1; -graphics.exprs=exprs; -x.graphics=graphics; -x.model=model; + } else { + model.ipar = prt; + model.evtout = 1; + model.firing = -1; + graphics.exprs = exprs; + x.graphics = graphics; + x.model = model; break; } } diff --git a/js/Sources/CLKIN_f.js b/js/Sources/CLKIN_f.js index 8ca204ea..727e5422 100644 --- a/js/Sources/CLKIN_f.js +++ b/js/Sources/CLKIN_f.js @@ -1,42 +1,42 @@ /* autogenerated from "macros/Sources/CLKIN_f.sci" */ function CLKIN_f() { CLKIN_f.prototype.define = function CLKIN_f() { -prt=1; -model=scicos_model(); -model.sim="input"; -model.evtout=1; -model.ipar=prt; -model.blocktype="d"; -model.firing=-1; -model.dep_ut=[false,false]; -exprs=string(prt); -x=standard_define([1,1],model,exprs," "); + prt = 1; + model = scicos_model(); + model.sim = "input"; + model.evtout = 1; + model.ipar = prt; + model.blocktype = "d"; + model.firing = -1; + model.dep_ut = [false,false]; + exprs = string(prt); + x = standard_define([1,1],model,exprs," "); } CLKIN_f.prototype.details = function CLKIN_f() { } CLKIN_f.prototype.get = function CLKIN_f() { } CLKIN_f.prototype.set = function CLKIN_f() { -x=arg1; -graphics=arg1.graphics; -model=arg1.model; -exprs=graphics.exprs; -exprs=exprs[1-1]; -while (true) { -[ok,prt,exprs]=scicos_getvalue("Set Event Input block parameters","Port number",list("vec",1),exprs); -prt=int(prt); -if (!ok) { + x = arg1; + graphics = arg1.graphics; + model = arg1.model; + exprs = graphics.exprs; + exprs = exprs[1-1]; + while (true) { + [ok,prt,exprs] = scicos_getvalue("Set Event Input block parameters","Port number",list("vec",1),exprs); + prt = int(prt); + if (!ok) { break; } -if (prt<=0) { + if (prt<=0) { message("Port number must be a positive integer"); -} else { -model.ipar=prt; -model.evtout=1; -model.firing=-1; -graphics.exprs=exprs; -x.graphics=graphics; -x.model=model; + } else { + model.ipar = prt; + model.evtout = 1; + model.firing = -1; + graphics.exprs = exprs; + x.graphics = graphics; + x.model = model; break; } } diff --git a/js/Sources/CLOCK_c.js b/js/Sources/CLOCK_c.js index c7e6c608..78b0f1e1 100644 --- a/js/Sources/CLOCK_c.js +++ b/js/Sources/CLOCK_c.js @@ -1,45 +1,45 @@ /* autogenerated from "macros/Sources/CLOCK_c.sci" */ function CLOCK_c() { CLOCK_c.prototype.define = function CLOCK_c() { -evtdly=this.EVTDLY_c["define"-1]; -evtdly.graphics.orig=[320,232]; -evtdly.graphics.sz=[40,40]; -evtdly.graphics.flip=true; -evtdly.graphics.exprs=[["0.1"],["0.1"]]; -evtdly.graphics.pein=6; -evtdly.graphics.peout=3; -evtdly.model.rpar=[[0.1],[0.1]]; -evtdly.model.firing=0.1; -output_port=CLKOUT_f("define"); -output_port.graphics.orig=[399,162]; -output_port.graphics.sz=[20,20]; -output_port.graphics.flip=true; -output_port.graphics.exprs="1"; -output_port.graphics.pein=5; -output_port.model.ipar=1; -split=CLKSPLIT_f("define"); -split.graphics.orig=[[380.71066],[172]]; -split.graphics.pein=3; -split.graphics.peout=[[5],[6]]; -gr_i=[]; -diagram=scicos_diagram(); -diagram.objs[1-1]=output_port; -diagram.objs[2-1]=evtdly; -diagram.objs[3-1]=scicos_link(xx=[[340],[340],[380.71]],yy=[[226.29],[172],[172]],ct=[5,-1],from=[2,1],to=[4,1]); -diagram.objs[4-1]=split; -diagram.objs[5-1]=scicos_link(xx=[[380.71],[399]],yy=[[172],[172]],ct=[5,-1],from=[4,1],to=[1,1]); -diagram.objs[6-1]=scicos_link(xx=[[380.71],[380.71],[340],[340]],yy=[[172],[302],[302],[277.71]],ct=[5,-1],from=[4,2],to=[2,1]); -x=scicos_block(); -x.gui="CLOCK_c"; -x.graphics.sz=[2,2]; -x.graphics.gr_i=gr_i; -x.graphics.peout=0; -x.model.sim="csuper"; -x.model.evtout=1; -x.model.blocktype="h"; -x.model.firing=false; -x.model.dep_ut=[false,false]; -x.model.rpar=diagram; + evtdly = this.EVTDLY_c["define"-1]; + evtdly.graphics.orig = [320,232]; + evtdly.graphics.sz = [40,40]; + evtdly.graphics.flip = true; + evtdly.graphics.exprs = [["0.1"],["0.1"]]; + evtdly.graphics.pein = 6; + evtdly.graphics.peout = 3; + evtdly.model.rpar = [[0.1],[0.1]]; + evtdly.model.firing = 0.1; + output_port = CLKOUT_f("define"); + output_port.graphics.orig = [399,162]; + output_port.graphics.sz = [20,20]; + output_port.graphics.flip = true; + output_port.graphics.exprs = "1"; + output_port.graphics.pein = 5; + output_port.model.ipar = 1; + split = CLKSPLIT_f("define"); + split.graphics.orig = [[380.71066],[172]]; + split.graphics.pein = 3; + split.graphics.peout = [[5],[6]]; + gr_i = []; + diagram = scicos_diagram(); + diagram.objs[1-1] = output_port; + diagram.objs[2-1] = evtdly; + diagram.objs[3-1] = scicos_link(xx=[[340],[340],[380.71]],yy=[[226.29],[172],[172]],ct=[5,-1],from=[2,1],to=[4,1]); + diagram.objs[4-1] = split; + diagram.objs[5-1] = scicos_link(xx=[[380.71],[399]],yy=[[172],[172]],ct=[5,-1],from=[4,1],to=[1,1]); + diagram.objs[6-1] = scicos_link(xx=[[380.71],[380.71],[340],[340]],yy=[[172],[302],[302],[277.71]],ct=[5,-1],from=[4,2],to=[2,1]); + x = scicos_block(); + x.gui = "CLOCK_c"; + x.graphics.sz = [2,2]; + x.graphics.gr_i = gr_i; + x.graphics.peout = 0; + x.model.sim = "csuper"; + x.model.evtout = 1; + x.model.blocktype = "h"; + x.model.firing = false; + x.model.dep_ut = [false,false]; + x.model.rpar = diagram; } CLOCK_c.prototype.details = function CLOCK_c() { } @@ -47,47 +47,47 @@ x.model.rpar=diagram; } CLOCK_c.prototype.set = function CLOCK_c() { for (i=1;i<=length(arg1.model.rpar.objs);i+=1) { -o=arg1.model.rpar.objs[i-1]; -if (typeof(o)=="Block"&&o.gui=="EVTDLY_c") { -path=i; + o = arg1.model.rpar.objs[i-1]; + if (typeof(o)=="Block"&&o.gui=="EVTDLY_c") { + path = i; break; } } -newpar=list(); -xx=arg1.model.rpar.objs[path-1]; -exprs=xx.graphics.exprs; -model=xx.model; -t0_old=model.firing; -dt_old=model.rpar[1-1]; -model_n=model; -while (true) { -[ok,dt,t0,exprs0]=scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"CLOCK_c")],[" "],[gettext("Event clock generator")],[" "],[gettext(" Do not start if \'Initialisation Time\' is negative")],[" "]],[[gettext("Period")],[gettext("Initialisation Time")]],list("vec",1,"vec",1),exprs); -if (!ok) { + newpar = list(); + xx = arg1.model.rpar.objs[path-1]; + exprs = xx.graphics.exprs; + model = xx.model; + t0_old = model.firing; + dt_old = model.rpar[1-1]; + model_n = model; + while (true) { + [ok,dt,t0,exprs0] = scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"CLOCK_c")],[" "],[gettext("Event clock generator")],[" "],[gettext(" Do not start if \'Initialisation Time\' is negative")],[" "]],[[gettext("Period")],[gettext("Initialisation Time")]],list("vec",1,"vec",1),exprs); + if (!ok) { break; } -if (dt<=0) { + if (dt<=0) { block_parameter_error(msprintf(gettext("Wrong values for \'%s\' parameter: %5.1e."),gettext("Period"),dt),gettext("Strictly positive number expected.")); -ok=false; + ok = false; } -if (ok) { -xx.graphics.exprs=exprs0; -model.rpar=[[dt],[t0]]; -model.firing=t0; -xx.model=model; -arg1.model.rpar.objs[path-1]=xx; + if (ok) { + xx.graphics.exprs = exprs0; + model.rpar = [[dt],[t0]]; + model.firing = t0; + xx.model = model; + arg1.model.rpar.objs[path-1] = xx; break; } } -if (!and([t0_old,dt_old]==[t0,dt])) { -newpar[size(newpar)+1-1]=path; + if (!and([t0_old,dt_old]==[t0,dt])) { + newpar[size(newpar)+1-1] = path; } -if (t0_old!=t0) { -needcompile=2; -} else { -needcompile=0; + if (t0_old!=t0) { + needcompile = 2; + } else { + needcompile = 0; } -x=arg1; -y=needcompile; -typ=newpar; + x = arg1; + y = needcompile; + typ = newpar; } } diff --git a/js/Sources/CLOCK_f.js b/js/Sources/CLOCK_f.js index 8afa8368..2ddee5fe 100644 --- a/js/Sources/CLOCK_f.js +++ b/js/Sources/CLOCK_f.js @@ -1,45 +1,45 @@ /* autogenerated from "macros/Sources/CLOCK_f.sci" */ function CLOCK_f() { CLOCK_f.prototype.define = function CLOCK_f() { -evtdly=EVTDLY_f("define"); -evtdly.graphics.orig=[320,232]; -evtdly.graphics.sz=[40,40]; -evtdly.graphics.flip=true; -evtdly.graphics.exprs=[["0.1"],["0.1"]]; -evtdly.graphics.pein=6; -evtdly.graphics.peout=3; -evtdly.model.rpar=0.1; -evtdly.model.firing=0.1; -output_port=CLKOUT_f("define"); -output_port.graphics.orig=[399,162]; -output_port.graphics.sz=[20,20]; -output_port.graphics.flip=true; -output_port.graphics.exprs="1"; -output_port.graphics.pein=5; -output_port.model.ipar=1; -split=CLKSPLIT_f("define"); -split.graphics.orig=[[380.71066],[172]]; -split.graphics.pein=3; -split.graphics.peout=[[5],[6]]; -gr_i=[]; -diagram=scicos_diagram(); -diagram.objs[1-1]=output_port; -diagram.objs[2-1]=evtdly; -diagram.objs[3-1]=scicos_link(xx=[[340],[340],[380.71]],yy=[[226.29],[172],[172]],ct=[5,-1],from=[2,1],to=[4,1]); -diagram.objs[4-1]=split; -diagram.objs[5-1]=scicos_link(xx=[[380.71],[399]],yy=[[172],[172]],ct=[5,-1],from=[4,1],to=[1,1]); -diagram.objs[6-1]=scicos_link(xx=[[380.71],[380.71],[340],[340]],yy=[[172],[302],[302],[277.71]],ct=[5,-1],from=[4,2],to=[2,1]); -x=scicos_block(); -x.gui="CLOCK_f"; -x.graphics.sz=[2,2]; -x.graphics.gr_i=gr_i; -x.graphics.peout=0; -x.model.sim="csuper"; -x.model.evtout=1; -x.model.blocktype="h"; -x.model.firing=false; -x.model.dep_ut=[false,false]; -x.model.rpar=diagram; + evtdly = EVTDLY_f("define"); + evtdly.graphics.orig = [320,232]; + evtdly.graphics.sz = [40,40]; + evtdly.graphics.flip = true; + evtdly.graphics.exprs = [["0.1"],["0.1"]]; + evtdly.graphics.pein = 6; + evtdly.graphics.peout = 3; + evtdly.model.rpar = 0.1; + evtdly.model.firing = 0.1; + output_port = CLKOUT_f("define"); + output_port.graphics.orig = [399,162]; + output_port.graphics.sz = [20,20]; + output_port.graphics.flip = true; + output_port.graphics.exprs = "1"; + output_port.graphics.pein = 5; + output_port.model.ipar = 1; + split = CLKSPLIT_f("define"); + split.graphics.orig = [[380.71066],[172]]; + split.graphics.pein = 3; + split.graphics.peout = [[5],[6]]; + gr_i = []; + diagram = scicos_diagram(); + diagram.objs[1-1] = output_port; + diagram.objs[2-1] = evtdly; + diagram.objs[3-1] = scicos_link(xx=[[340],[340],[380.71]],yy=[[226.29],[172],[172]],ct=[5,-1],from=[2,1],to=[4,1]); + diagram.objs[4-1] = split; + diagram.objs[5-1] = scicos_link(xx=[[380.71],[399]],yy=[[172],[172]],ct=[5,-1],from=[4,1],to=[1,1]); + diagram.objs[6-1] = scicos_link(xx=[[380.71],[380.71],[340],[340]],yy=[[172],[302],[302],[277.71]],ct=[5,-1],from=[4,2],to=[2,1]); + x = scicos_block(); + x.gui = "CLOCK_f"; + x.graphics.sz = [2,2]; + x.graphics.gr_i = gr_i; + x.graphics.peout = 0; + x.model.sim = "csuper"; + x.model.evtout = 1; + x.model.blocktype = "h"; + x.model.firing = false; + x.model.dep_ut = [false,false]; + x.model.rpar = diagram; } CLOCK_f.prototype.details = function CLOCK_f() { } @@ -47,47 +47,47 @@ x.model.rpar=diagram; } CLOCK_f.prototype.set = function CLOCK_f() { for (i=1;i<=length(arg1.model.rpar.objs);i+=1) { -o=arg1.model.rpar.objs[i-1]; -if (typeof(o)=="Block"&&o.gui=="EVTDLY_f") { -path=i; + o = arg1.model.rpar.objs[i-1]; + if (typeof(o)=="Block"&&o.gui=="EVTDLY_f") { + path = i; break; } } -newpar=list(); -xx=arg1.model.rpar.objs[path-1]; -exprs=xx.graphics.exprs; -model=xx.model; -t0_old=model.firing; -dt_old=model.rpar; -model_n=model; -while (true) { -[ok,dt,t0,exprs0]=scicos_getvalue("Set Clock block parameters",[["Period"],["Init time"]],list("vec",1,"vec",1),exprs); -if (!ok) { + newpar = list(); + xx = arg1.model.rpar.objs[path-1]; + exprs = xx.graphics.exprs; + model = xx.model; + t0_old = model.firing; + dt_old = model.rpar; + model_n = model; + while (true) { + [ok,dt,t0,exprs0] = scicos_getvalue("Set Clock block parameters",[["Period"],["Init time"]],list("vec",1,"vec",1),exprs); + if (!ok) { break; } -if (dt<=0) { + if (dt<=0) { message("period must be positive"); -ok=false; + ok = false; } -if (ok) { -xx.graphics.exprs=exprs0; -model.rpar=dt; -model.firing=t0; -xx.model=model; -arg1.model.rpar.objs[path-1]=xx; + if (ok) { + xx.graphics.exprs = exprs0; + model.rpar = dt; + model.firing = t0; + xx.model = model; + arg1.model.rpar.objs[path-1] = xx; break; } } -if (!and([t0_old,dt_old]==[t0,dt])||!and(exprs0==exprs)) { -newpar[size(newpar)+1-1]=path; + if (!and([t0_old,dt_old]==[t0,dt])||!and(exprs0==exprs)) { + newpar[size(newpar)+1-1] = path; } -if (t0_old!=t0) { -needcompile=2; -} else { -needcompile=0; + if (t0_old!=t0) { + needcompile = 2; + } else { + needcompile = 0; } -x=arg1; -y=needcompile; -typ=newpar; + x = arg1; + y = needcompile; + typ = newpar; } } diff --git a/js/Sources/CONST.js b/js/Sources/CONST.js index 7293695b..d96bad1c 100644 --- a/js/Sources/CONST.js +++ b/js/Sources/CONST.js @@ -1,44 +1,44 @@ /* autogenerated from "macros/Sources/CONST.sci" */ function CONST() { CONST.prototype.define = function CONST() { -C=1; -model=scicos_model(); -model.sim=list("cstblk4",4); -model.in1=[]; -model.out=1; -model.rpar=C; -model.blocktype="d"; -model.dep_ut=[false,false]; -exprs=strcat(sci2exp(C)); -gr_i=[]; -x=standard_define([2,2],model,exprs,gr_i); + C = 1; + model = scicos_model(); + model.sim = list("cstblk4",4); + model.in1 = []; + model.out = 1; + model.rpar = C; + model.blocktype = "d"; + model.dep_ut = [false,false]; + exprs = strcat(sci2exp(C)); + gr_i = []; + x = standard_define([2,2],model,exprs,gr_i); } CONST.prototype.details = function CONST() { } CONST.prototype.get = function CONST() { } CONST.prototype.set = function CONST() { -x=arg1; -graphics=arg1.graphics; -exprs=graphics.exprs; -model=arg1.model; -while (true) { -[ok,C,exprs]=scicos_getvalue(["Set Contant Block"],"Constant",list("vec",-1),exprs); -if (!ok) { + x = arg1; + graphics = arg1.graphics; + exprs = graphics.exprs; + model = arg1.model; + while (true) { + [ok,C,exprs] = scicos_getvalue(["Set Contant Block"],"Constant",list("vec",-1),exprs); + if (!ok) { break; } -sz=size(C); -nout=size(C,"*"); -if (nout==0) { + sz = size(C); + nout = size(C,"*"); + if (nout==0) { message("C must have at least one element"); -} else if (and(sz>1)) { + } else if (and(sz>1)) { message("C matrix is not supported, use CONST_m instead"); -} else { -model.rpar=C.slice(); -model.out=nout; -graphics.exprs=exprs; -x.graphics=graphics; -x.model=model; + } else { + model.rpar = C.slice(); + model.out = nout; + graphics.exprs = exprs; + x.graphics = graphics; + x.model = model; break; } } diff --git a/js/Sources/CONST_f.js b/js/Sources/CONST_f.js index e87172fb..ee7d7566 100644 --- a/js/Sources/CONST_f.js +++ b/js/Sources/CONST_f.js @@ -1,41 +1,41 @@ /* autogenerated from "macros/Sources/CONST_f.sci" */ function CONST_f() { CONST_f.prototype.define = function CONST_f() { -C=1; -model=scicos_model(); -model.sim=list("cstblk",1); -model.in1=[]; -model.out=1; -model.rpar=C; -model.blocktype="d"; -model.dep_ut=[false,false]; -exprs=strcat(sci2exp(C)); -gr_i=[]; -x=standard_define([2,2],model,exprs,gr_i); + C = 1; + model = scicos_model(); + model.sim = list("cstblk",1); + model.in1 = []; + model.out = 1; + model.rpar = C; + model.blocktype = "d"; + model.dep_ut = [false,false]; + exprs = strcat(sci2exp(C)); + gr_i = []; + x = standard_define([2,2],model,exprs,gr_i); } CONST_f.prototype.details = function CONST_f() { } CONST_f.prototype.get = function CONST_f() { } CONST_f.prototype.set = function CONST_f() { -x=arg1; -graphics=arg1.graphics; -exprs=graphics.exprs; -model=arg1.model; -while (true) { -[ok,C,exprs]=scicos_getvalue(["Set Contant Block"],"Constant",list("vec",-1),exprs); -if (!ok) { + x = arg1; + graphics = arg1.graphics; + exprs = graphics.exprs; + model = arg1.model; + while (true) { + [ok,C,exprs] = scicos_getvalue(["Set Contant Block"],"Constant",list("vec",-1),exprs); + if (!ok) { break; } -nout=size(C,"*"); -if (nout==0) { + nout = size(C,"*"); + if (nout==0) { message("C must have at least one element"); -} else { -model.rpar=C.slice(); -model.out=nout; -graphics.exprs=exprs; -x.graphics=graphics; -x.model=model; + } else { + model.rpar = C.slice(); + model.out = nout; + graphics.exprs = exprs; + x.graphics = graphics; + x.model = model; break; } } diff --git a/js/Sources/CONST_m.js b/js/Sources/CONST_m.js index 14c15e6c..471e09ff 100644 --- a/js/Sources/CONST_m.js +++ b/js/Sources/CONST_m.js @@ -1,69 +1,69 @@ /* autogenerated from "macros/Sources/CONST_m.sci" */ function CONST_m() { CONST_m.prototype.define = function CONST_m() { -C=[1]; -model=scicos_model(); -model.sim=list("cstblk4",4); -model.in1=[]; -model.out=size(C,1); -model.in2=[]; -model.out2=size(C,2); -model.rpar=C; -model.opar=list(); -model.blocktype="d"; -model.dep_ut=[false,false]; -exprs=sci2exp(C); -gr_i=[]; -x=standard_define([2,2],model,exprs,gr_i); + C = [1]; + model = scicos_model(); + model.sim = list("cstblk4",4); + model.in1 = []; + model.out = size(C,1); + model.in2 = []; + model.out2 = size(C,2); + model.rpar = C; + model.opar = list(); + model.blocktype = "d"; + model.dep_ut = [false,false]; + exprs = sci2exp(C); + gr_i = []; + x = standard_define([2,2],model,exprs,gr_i); } CONST_m.prototype.details = function CONST_m() { } CONST_m.prototype.get = function CONST_m() { } CONST_m.prototype.set = function CONST_m() { -x=arg1; -graphics=arg1.graphics; -exprs=graphics.exprs; -model=arg1.model; -while (true) { -[ok,C,exprs]=scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"CONST_m")],[" "],[gettext("Constant value generator")],[" "]],gettext("Constant Value"),list("vec",-1),exprs); -if (!ok) { + x = arg1; + graphics = arg1.graphics; + exprs = graphics.exprs; + model = arg1.model; + while (true) { + [ok,C,exprs] = scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"CONST_m")],[" "],[gettext("Constant value generator")],[" "]],gettext("Constant Value"),list("vec",-1),exprs); + if (!ok) { break; } -nout=size(C); -if (find(nout==0)!=[]) { + nout = size(C); + if (find(nout==0)!=[]) { block_parameter_error(msprintf(gettext("Wrong size for \'%s\' parameter"),gettext("Constant Value")),gettext("Constant value must have at least one element.")); -} else { -model.sim=list("cstblk4_m",4); -model.opar=list(C); -if ((this.type[C-1]==1)) { -if (isreal(C)) { -ot=1; -} else { -ot=2; + } else { + model.sim = list("cstblk4_m",4); + model.opar = list(C); + if ((this.type[C-1]==1)) { + if (isreal(C)) { + ot = 1; + } else { + ot = 2; } -} else if ((typeof(C)=="int32")) { -ot=3; -} else if ((typeof(C)=="int16")) { -ot=4; -} else if ((typeof(C)=="int8")) { -ot=5; -} else if ((typeof(C)=="uint32")) { -ot=6; -} else if ((typeof(C)=="uint16")) { -ot=7; -} else if ((typeof(C)=="uint8")) { -ot=8; -} else { + } else if ((typeof(C)=="int32")) { + ot = 3; + } else if ((typeof(C)=="int16")) { + ot = 4; + } else if ((typeof(C)=="int8")) { + ot = 5; + } else if ((typeof(C)=="uint32")) { + ot = 6; + } else if ((typeof(C)=="uint16")) { + ot = 7; + } else if ((typeof(C)=="uint8")) { + ot = 8; + } else { block_parameter_error(msprintf(gettext("Wrong type for \'%s\' parameter"),gettext("Constant Value")),gettext("Value type must be a numeric type (double, complex, int, int8, ...).")); -ok=false; + ok = false; } -if (ok) { -model.rpar=[]; -[model,graphics,ok]=set_io(model,graphics,list(),list(nout,ot),[],[]); -graphics.exprs=exprs; -x.graphics=graphics; -x.model=model; + if (ok) { + model.rpar = []; + [model,graphics,ok] = set_io(model,graphics,list(),list(nout,ot),[],[]); + graphics.exprs = exprs; + x.graphics = graphics; + x.model = model; break; } } diff --git a/js/Sources/CURV_f.js b/js/Sources/CURV_f.js index 05da6a1e..f9f00cb5 100644 --- a/js/Sources/CURV_f.js +++ b/js/Sources/CURV_f.js @@ -1,61 +1,61 @@ /* autogenerated from "macros/Sources/CURV_f.sci" */ function CURV_f() { CURV_f.prototype.define = function CURV_f() { -xx=[[0],[1],[2]]; -yy=[[-5],[5],[0]]; -rect=[0,-5,2,5]; -axisdata=[[2],[10],[2],[10]]; -ipar=[[size(xx,1)],[axisdata.slice()]]; -rpar=[[xx],[yy],[rect.slice()]]; -model=scicos_model(); -model.sim="intplt"; -model.in1=[]; -model.out=1; -model.rpar=[[xx],[yy],[rect.slice()]]; -model.ipar=[[size(xx,1)],[axisdata.slice()]]; -model.blocktype="c"; -model.dep_ut=[false,true]; -gr_i=[]; -x=standard_define([2,2],model,[],gr_i); + xx = [[0],[1],[2]]; + yy = [[-5],[5],[0]]; + rect = [0,-5,2,5]; + axisdata = [[2],[10],[2],[10]]; + ipar = [[size(xx,1)],[axisdata.slice()]]; + rpar = [[xx],[yy],[rect.slice()]]; + model = scicos_model(); + model.sim = "intplt"; + model.in1 = []; + model.out = 1; + model.rpar = [[xx],[yy],[rect.slice()]]; + model.ipar = [[size(xx,1)],[axisdata.slice()]]; + model.blocktype = "c"; + model.dep_ut = [false,true]; + gr_i = []; + x = standard_define([2,2],model,[],gr_i); } CURV_f.prototype.details = function CURV_f() { } CURV_f.prototype.get = function CURV_f() { } CURV_f.prototype.set = function CURV_f() { -x=arg1; -model=arg1.model; -graphics=arg1.graphics; -rpar=model.rpar; -ipar=model.ipar; -n=ipar[1-1]; -xx=rpar.slice(1-1,n); -yy=rpar.slice(n+1-1,2*n); -gc=list(rpar.slice(2*n+1-1,2*n+4),ipar.slice(2-1,5)); -while (true) { + x = arg1; + model = arg1.model; + graphics = arg1.graphics; + rpar = model.rpar; + ipar = model.ipar; + n = ipar[1-1]; + xx = rpar.slice(1-1,n); + yy = rpar.slice(n+1-1,2*n); + gc = list(rpar.slice(2*n+1-1,2*n+4),ipar.slice(2-1,5)); + while (true) { [ln,fun]=where() -if (!or(fun=="do_eval")) { -[xx,yy,ok,gc]=edit_curv(xx,yy,"axy",[" "," "," "],gc); -} else { -ok=true; + if (!or(fun=="do_eval")) { + [xx,yy,ok,gc] = edit_curv(xx,yy,"axy",[" "," "," "],gc); + } else { + ok = true; } -if (!ok) { + if (!ok) { break; } -n=size(xx,"*"); -if (or(xx.slice(2-1,n)-xx.slice(1-1,n-1)<0)) { + n = size(xx,"*"); + if (or(xx.slice(2-1,n)-xx.slice(1-1,n-1)<0)) { message("You have not defined a function"); -ok=false; + ok = false; } -if (ok) { -model.sim="intplt"; -model.firing=[]; -rect=gc[1-1]; -model.rpar=[[xx.slice()],[yy.slice()],[rect.slice()]]; -axisdata=gc[2-1]; -model.ipar=[[size(xx,"*")],[axisdata.slice()]]; -x.graphics=graphics; -x.model=model; + if (ok) { + model.sim = "intplt"; + model.firing = []; + rect = gc[1-1]; + model.rpar = [[xx.slice()],[yy.slice()],[rect.slice()]]; + axisdata = gc[2-1]; + model.ipar = [[size(xx,"*")],[axisdata.slice()]]; + x.graphics = graphics; + x.model = model; break; } } diff --git a/js/Sources/Counter.js b/js/Sources/Counter.js index 41a4f57a..cfd0dccd 100644 --- a/js/Sources/Counter.js +++ b/js/Sources/Counter.js @@ -1,48 +1,48 @@ /* autogenerated from "macros/Sources/Counter.sci" */ function Counter() { Counter.prototype.define = function Counter() { -minim=0; -maxim=2; -rule=1; -model=scicos_model(); -model.sim=list("counter",4); -model.evtin=1; -model.out=1; -model.out2=1; -model.dstate=0; -model.ipar=[[rule],[maxim],[minim]]; -model.blocktype="c"; -model.dep_ut=[false,false]; -exprs=[[string(minim)],[string(maxim)],[string(rule)]]; -gr_i=[]; -x=standard_define([3,2],model,exprs,gr_i); + minim = 0; + maxim = 2; + rule = 1; + model = scicos_model(); + model.sim = list("counter",4); + model.evtin = 1; + model.out = 1; + model.out2 = 1; + model.dstate = 0; + model.ipar = [[rule],[maxim],[minim]]; + model.blocktype = "c"; + model.dep_ut = [false,false]; + exprs = [[string(minim)],[string(maxim)],[string(rule)]]; + gr_i = []; + x = standard_define([3,2],model,exprs,gr_i); } Counter.prototype.details = function Counter() { } Counter.prototype.get = function Counter() { } Counter.prototype.set = function Counter() { -x=arg1; -graphics=arg1.graphics; -exprs=graphics.exprs; -model=arg1.model; -while (true) { -[ok,minim,maxim,rule,exprs]=scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"Counter")],[" "],[gettext("Integer counter generator")],[" "]],[[gettext("Minimum")],[gettext("Maximum")],[gettext("Rule (1:Increment, 2:Decrement)")]],list("vec",1,"vec",1,"vec",1),exprs); -if (!ok) { + x = arg1; + graphics = arg1.graphics; + exprs = graphics.exprs; + model = arg1.model; + while (true) { + [ok,minim,maxim,rule,exprs] = scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"Counter")],[" "],[gettext("Integer counter generator")],[" "]],[[gettext("Minimum")],[gettext("Maximum")],[gettext("Rule (1:Increment, 2:Decrement)")]],list("vec",1,"vec",1,"vec",1),exprs); + if (!ok) { break; } -maxim=int(maxim); -minim=int(minim); -if (maxim<minim) { + maxim = int(maxim); + minim = int(minim); + if (maxim<minim) { block_parameter_error(msprintf(gettext("Wrong values for \'Maximum\' and \'Minimum\' parameters: %d < %d"),minim,maxim),msprintf(gettext("\'Minimum\' must be less than \'Maximum\'."))); -} else if ((rule!=1&&rule!=2)) { + } else if ((rule!=1&&rule!=2)) { block_parameter_error(msprintf(gettext("Wrong value for \'Rule\' parameter: %d"),rule),msprintf(gettext("Must be in the interval %s."),"[1,2]")); -} else { -graphics.exprs=exprs; -model.dstate=0; -model.ipar=[[rule],[maxim],[minim]]; -x.graphics=graphics; -x.model=model; + } else { + graphics.exprs = exprs; + model.dstate = 0; + model.ipar = [[rule],[maxim],[minim]]; + x.graphics = graphics; + x.model = model; break; } } diff --git a/js/Sources/FROMWSB.js b/js/Sources/FROMWSB.js index 7cf0658f..9f716376 100644 --- a/js/Sources/FROMWSB.js +++ b/js/Sources/FROMWSB.js @@ -1,14 +1,14 @@ /* autogenerated from "macros/Sources/FROMWSB.sci" */ function FROMWSB() { FROMWSB.prototype.define = function FROMWSB() { -scs_m_1=scicos_diagram(version="scicos4.2",props=scicos_params(wpar=[-159.096,811.104,-121.216,617.984,1323,1008,331,284,630,480,1426,231,1.4],Title="FROMWSB",tol=[0.0001,0.000001,1.000e-10,100001,0,0],tf=100000,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="FROMWS_c",graphics=scicos_graphics(orig=[260.37067,261.584],sz=[70,40],flip=true,theta=0,exprs=[["V"],["1"],["1"],["0"]],pin=[],pout=4,pein=2,peout=2,gr_i=[],id="",in_implicit=[],out_implicit="E"),model=scicos_model(sim=list("fromws_c",4),in1=[],in2=[],intyp=1,out=-1,out2=-2,outtyp=-1,evtin=1,evtout=1,state=[],dstate=[],odstate=list(),rpar=[],ipar=[[1],[-31],[1],[1],[0]],opar=list(),blocktype="d",firing=0,dep_ut=[false,true],label="",nzcross=0,nmode=0,equations=list()),doc=list()); -scs_m_1.objs[2-1]=scicos_link(xx=[[295.37067],[295.37067],[233.23733],[233.23733],[295.37067],[295.37067]],yy=[[255.86971],[223.45067],[223.45067],[337.85067],[337.85067],[307.29829]],id="drawlink",thick=[0,0],ct=[5,-1],from=[1,1,0],to=[1,1,1]); -scs_m_1.objs[3-1]=scicos_block(gui="OUT_f",graphics=scicos_graphics(orig=[358.9421,271.584],sz=[20,20],flip=true,theta=0,exprs="1",pin=4,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[4-1]=scicos_link(xx=[[338.9421],[358.9421]],yy=[[281.584],[281.584]],id="drawlink",thick=[0,0],ct=[1,1],from=[1,1,0],to=[3,1,1]); -model=scicos_model(sim="csuper",in1=[],in2=[],intyp=1,out=-1,out2=-2,outtyp=1,evtin=[],evtout=[],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([5,2],model,[],gr_i); + scs_m_1 = scicos_diagram(version="scicos4.2",props=scicos_params(wpar=[-159.096,811.104,-121.216,617.984,1323,1008,331,284,630,480,1426,231,1.4],Title="FROMWSB",tol=[0.0001,0.000001,1.000e-10,100001,0,0],tf=100000,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="FROMWS_c",graphics=scicos_graphics(orig=[260.37067,261.584],sz=[70,40],flip=true,theta=0,exprs=[["V"],["1"],["1"],["0"]],pin=[],pout=4,pein=2,peout=2,gr_i=[],id="",in_implicit=[],out_implicit="E"),model=scicos_model(sim=list("fromws_c",4),in1=[],in2=[],intyp=1,out=-1,out2=-2,outtyp=-1,evtin=1,evtout=1,state=[],dstate=[],odstate=list(),rpar=[],ipar=[[1],[-31],[1],[1],[0]],opar=list(),blocktype="d",firing=0,dep_ut=[false,true],label="",nzcross=0,nmode=0,equations=list()),doc=list()); + scs_m_1.objs[2-1] = scicos_link(xx=[[295.37067],[295.37067],[233.23733],[233.23733],[295.37067],[295.37067]],yy=[[255.86971],[223.45067],[223.45067],[337.85067],[337.85067],[307.29829]],id="drawlink",thick=[0,0],ct=[5,-1],from=[1,1,0],to=[1,1,1]); + scs_m_1.objs[3-1] = scicos_block(gui="OUT_f",graphics=scicos_graphics(orig=[358.9421,271.584],sz=[20,20],flip=true,theta=0,exprs="1",pin=4,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[4-1] = scicos_link(xx=[[338.9421],[358.9421]],yy=[[281.584],[281.584]],id="drawlink",thick=[0,0],ct=[1,1],from=[1,1,0],to=[3,1,1]); + model = scicos_model(sim="csuper",in1=[],in2=[],intyp=1,out=-1,out2=-2,outtyp=1,evtin=[],evtout=[],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([5,2],model,[],gr_i); } FROMWSB.prototype.details = function FROMWSB() { } @@ -16,71 +16,71 @@ x=standard_define([5,2],model,[],gr_i); } FROMWSB.prototype.set = function FROMWSB() { for (i=1;i<=length(arg1.model.rpar.objs);i+=1) { -o=arg1.model.rpar.objs[i-1]; -if (typeof(o)=="Block"&&o.gui=="FROMWS_c") { -ppath=list(i); + o = arg1.model.rpar.objs[i-1]; + if (typeof(o)=="Block"&&o.gui=="FROMWS_c") { + ppath = list(i); break; } } -newpar=list(); -y=0; -for (path in ppath) { -np=size(path,"*"); -spath=list(); + 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]; + spath[$+1-1] = "model"; + spath[$+1-1] = "rpar"; + spath[$+1-1] = "objs"; + spath[$+1-1] = path[k-1]; } -xx=arg1[spath-1]; + xx = arg1[spath-1]; execstr("xxn="+xx.gui+"(\'set\',xx)"); -if (!this.isequalbitwise[this.xxn-1][xx-1]) { -model=xx.model; -model_n=this.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 (!this.isequalbitwise[this.xxn-1][xx-1]) { + model = xx.model; + model_n = this.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 (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 ((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 (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 (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 ((model.nzcross!=model_n.nzcross)||(model.nmode!=model_n.nmode)) { + needcompile = 4; } -if (prod(size(model_n.sim))>1) { -if (model_n.sim[2-1]>1000) { -if (model.sim[1-1]!=model_n.sim[1-1]) { -needcompile=4; + if (prod(size(model_n.sim))>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; + } 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]=this.xxn; -newpar[size(newpar)+1-1]=path; -y=max(y,needcompile); + arg1[spath-1] = this.xxn; + newpar[size(newpar)+1-1] = path; + y = max(y,needcompile); } } -x=arg1; -typ=newpar; + x = arg1; + typ = newpar; } } diff --git a/js/Sources/FROMWS_c.js b/js/Sources/FROMWS_c.js index df7373cf..88ce7821 100644 --- a/js/Sources/FROMWS_c.js +++ b/js/Sources/FROMWS_c.js @@ -1,64 +1,64 @@ /* autogenerated from "macros/Sources/FROMWS_c.sci" */ function FROMWS_c() { FROMWS_c.prototype.define = function FROMWS_c() { -varnam="V"; -Method=1; -ZC=1; -OutEnd=0; -model=scicos_model(); -model.sim=list("fromws_c",4); -model.out=-1; -model.out2=-2; -model.outtyp=-1; -model.ipar=[[length(varnam)],[this._str2code[varnam-1]],[Method],[ZC],[OutEnd]]; -model.evtin=[1]; -model.evtout=[1]; -model.firing=[0]; -model.blocktype="d"; -model.dep_ut=[false,true]; -gr_i=[]; -exprs=[[string(varnam)],[string(Method)],[string(ZC)],[string(OutEnd)]]; -x=standard_define([3.5,2],model,exprs,gr_i); + varnam = "V"; + Method = 1; + ZC = 1; + OutEnd = 0; + model = scicos_model(); + model.sim = list("fromws_c",4); + model.out = -1; + model.out2 = -2; + model.outtyp = -1; + model.ipar = [[length(varnam)],[this._str2code[varnam-1]],[Method],[ZC],[OutEnd]]; + model.evtin = [1]; + model.evtout = [1]; + model.firing = [0]; + model.blocktype = "d"; + model.dep_ut = [false,true]; + gr_i = []; + exprs = [[string(varnam)],[string(Method)],[string(ZC)],[string(OutEnd)]]; + x = standard_define([3.5,2],model,exprs,gr_i); } FROMWS_c.prototype.details = function FROMWS_c() { } FROMWS_c.prototype.get = function FROMWS_c() { } FROMWS_c.prototype.set = function FROMWS_c() { -x=arg1; -graphics=arg1.graphics; -exprs=graphics.exprs; -model=arg1.model; -while (true) { -[ok,varnam,Method,ZC,OutEnd,exprs]=scicos_getvalue("Set From_Workspace block parameters",[["Variable name"],["Interpolation Method"],["Enable zero crossing(0:No, 1:Yes)?"],["Output at end(0:Zero, 1:Hold, 2:Repeat)"]],list("str",1,"vec",1,"vec",1,"vec",1),exprs); -if (!ok) { + x = arg1; + graphics = arg1.graphics; + exprs = graphics.exprs; + model = arg1.model; + while (true) { + [ok,varnam,Method,ZC,OutEnd,exprs] = scicos_getvalue("Set From_Workspace block parameters",[["Variable name"],["Interpolation Method"],["Enable zero crossing(0:No, 1:Yes)?"],["Output at end(0:Zero, 1:Hold, 2:Repeat)"]],list("str",1,"vec",1,"vec",1,"vec",1),exprs); + if (!ok) { break; } -if (!(Method==0||Method==1||Method==2||Method==3)) { + if (!(Method==0||Method==1||Method==2||Method==3)) { message("Interpolation method should be chosen in [0,1,2,3]"); -ok=false; + ok = false; } -if (!(ZC==0||ZC==1)) { + if (!(ZC==0||ZC==1)) { message("Zero crossing should be either 0 or 1"); -ok=false; + ok = false; } -if (!(OutEnd==0||OutEnd==1||OutEnd==2)) { + if (!(OutEnd==0||OutEnd==1||OutEnd==2)) { message("Output at end option should be either 0 or 1"); -ok=false; + ok = false; } -r=false; -ierr=execstr("r=validvar(varnam)","errcatch"); -if (!r) { + r = false; + ierr = execstr("r=validvar(varnam)","errcatch"); + if (!r) { message([["Invalid variable name."],["Please choose another variable name."]]); -ok=false; + ok = false; } -if (ok) { -model.ipar=[[length(varnam)],[this._str2code[varnam-1]],[Method],[ZC],[OutEnd]]; -[model,graphics,ok]=set_io(model,graphics,list(),list([-1,-2],-1),1,1); -if (ok) { -graphics.exprs=exprs; -x.graphics=graphics; -x.model=model; + if (ok) { + model.ipar = [[length(varnam)],[this._str2code[varnam-1]],[Method],[ZC],[OutEnd]]; + [model,graphics,ok] = set_io(model,graphics,list(),list([-1,-2],-1),1,1); + if (ok) { + graphics.exprs = exprs; + x.graphics = graphics; + x.model = model; break; } } diff --git a/js/Sources/GENSIN_f.js b/js/Sources/GENSIN_f.js index a7c1378c..bab92c8c 100644 --- a/js/Sources/GENSIN_f.js +++ b/js/Sources/GENSIN_f.js @@ -1,46 +1,46 @@ /* autogenerated from "macros/Sources/GENSIN_f.sci" */ function GENSIN_f() { GENSIN_f.prototype.define = function GENSIN_f() { -rpar=[[1],[1],[0]]; -model=scicos_model(); -model.sim="gensin"; -model.in1=[]; -model.out=1; -model.out2=1; -model.outtyp=1; -model.rpar=[[1],[1],[0]]; -model.blocktype="c"; -model.dep_ut=[false,true]; -exprs=[[string(rpar[1-1])],[string(rpar[2-1])],[string(rpar[3-1])]]; -gr_i=[]; -x=standard_define([3,2],model,exprs,gr_i); + rpar = [[1],[1],[0]]; + model = scicos_model(); + model.sim = "gensin"; + model.in1 = []; + model.out = 1; + model.out2 = 1; + model.outtyp = 1; + model.rpar = [[1],[1],[0]]; + model.blocktype = "c"; + model.dep_ut = [false,true]; + exprs = [[string(rpar[1-1])],[string(rpar[2-1])],[string(rpar[3-1])]]; + gr_i = []; + x = standard_define([3,2],model,exprs,gr_i); } GENSIN_f.prototype.details = function GENSIN_f() { } GENSIN_f.prototype.get = function GENSIN_f() { } GENSIN_f.prototype.set = function GENSIN_f() { -x=arg1; -graphics=arg1.graphics; -exprs=graphics.exprs; -model=arg1.model; -while (true) { -[ok,M,F,P,exprs]=scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"GENSIN_f")],[" "],[gettext("Sine wave generator")],[" "]],[[gettext("Magnitude")],[gettext("Frequency (rad/s)")],[gettext("Phase (rad)")]],list("vec",1,"vec",1,"vec",1),exprs); -if (!ok) { + x = arg1; + graphics = arg1.graphics; + exprs = graphics.exprs; + model = arg1.model; + while (true) { + [ok,M,F,P,exprs] = scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"GENSIN_f")],[" "],[gettext("Sine wave generator")],[" "]],[[gettext("Magnitude")],[gettext("Frequency (rad/s)")],[gettext("Phase (rad)")]],list("vec",1,"vec",1,"vec",1),exprs); + if (!ok) { break; } -if (F<0) { + if (F<0) { block_parameter_error(msprintf(gettext("Wrong value for \'Frequency\' parameter: %e."),F),gettext("Strictly positive integer expected.")); -ok=false; + ok = false; } -if (ok) { -[model,graphics,ok]=check_io(model,graphics,[],1,[],[]); -model.rpar=[[M],[F],[P]]; -model.out2=1; -model.outtyp=1; -graphics.exprs=exprs; -x.graphics=graphics; -x.model=model; + if (ok) { + [model,graphics,ok] = check_io(model,graphics,[],1,[],[]); + model.rpar = [[M],[F],[P]]; + model.out2 = 1; + model.outtyp = 1; + graphics.exprs = exprs; + x.graphics = graphics; + x.model = model; break; } } diff --git a/js/Sources/GENSQR_f.js b/js/Sources/GENSQR_f.js index 2532c7dc..5d7dc200 100644 --- a/js/Sources/GENSQR_f.js +++ b/js/Sources/GENSQR_f.js @@ -1,43 +1,43 @@ /* autogenerated from "macros/Sources/GENSQR_f.sci" */ function GENSQR_f() { GENSQR_f.prototype.define = function GENSQR_f() { -Amplitude=1; -model=scicos_model(); -model.sim="gensqr"; -model.out=1; -model.out2=1; -model.outtyp=1; -model.evtin=1; -model.dstate=Amplitude; -model.blocktype="d"; -model.dep_ut=[false,false]; -exprs=string(Amplitude); -gr_i=[]; -x=standard_define([3,2],model,exprs,gr_i); + Amplitude = 1; + model = scicos_model(); + model.sim = "gensqr"; + model.out = 1; + model.out2 = 1; + model.outtyp = 1; + model.evtin = 1; + model.dstate = Amplitude; + model.blocktype = "d"; + model.dep_ut = [false,false]; + exprs = string(Amplitude); + gr_i = []; + x = standard_define([3,2],model,exprs,gr_i); } GENSQR_f.prototype.details = function GENSQR_f() { } GENSQR_f.prototype.get = function GENSQR_f() { } GENSQR_f.prototype.set = function GENSQR_f() { -x=arg1; -graphics=arg1.graphics; -exprs=graphics.exprs; -model=arg1.model; -if (size(exprs,"*")==2) { -exprs=exprs[2-1]; + x = arg1; + graphics = arg1.graphics; + exprs = graphics.exprs; + model = arg1.model; + if (size(exprs,"*")==2) { + exprs = exprs[2-1]; } -while (true) { -[ok,Amplitude,exprs]=scicos_getvalue(["Set Square generator block parameters"],["Amplitude"],list("vec",1),exprs); -if (!ok) { + while (true) { + [ok,Amplitude,exprs] = scicos_getvalue(["Set Square generator block parameters"],["Amplitude"],list("vec",1),exprs); + if (!ok) { break; } -graphics.exprs=exprs; -model.dstate=Amplitude; -model.out2=1; -model.outtyp=1; -x.graphics=graphics; -x.model=model; + graphics.exprs = exprs; + model.dstate = Amplitude; + model.out2 = 1; + model.outtyp = 1; + x.graphics = graphics; + x.model = model; break; } } diff --git a/js/Sources/GEN_SQR.js b/js/Sources/GEN_SQR.js index e9884602..212d5ab4 100644 --- a/js/Sources/GEN_SQR.js +++ b/js/Sources/GEN_SQR.js @@ -1,90 +1,90 @@ /* autogenerated from "macros/Sources/GEN_SQR.sci" */ function GEN_SQR() { GEN_SQR.prototype.define = function GEN_SQR() { -scs_m_1=scicos_diagram(version="scicos4.2",props=scicos_params(wpar=[-176.97473,421.18646,173.61587,524.41503,827,480,0,15,827,480,755,614,1.4],Title="SuperBlock",tol=[0.0001,0.000001,1.000e-10,100001,0,0],tf=100000,context=[["if typeof(Amin)<>typeof(Amax) then error(\'Minimum value and Maximum value must have the same type\');end"],["if and(rule<>[1;2]) then error(\'Initial Value must be 1 (for Min) or 2 (for Max)\');end"],["if Amin>Amax then error(\'Maximum value must be greater than the Minimum Value\');end"],["P=%pi/F"],[""]],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="Counter",graphics=scicos_graphics(orig=[18.229901,339.5057],sz=[60,40],flip=true,theta=0,exprs=[["1"],["2"],["rule"]],pin=[],pout=8,pein=16,peout=[],gr_i=[],id="",in_implicit=[],out_implicit="E"),model=scicos_model(sim=list("counter",4),in1=[],in2=[],intyp=1,out=1,out2=1,outtyp=1,evtin=1,evtout=[],state=[],dstate=0,odstate=list(),rpar=[],ipar=[[1],[2],[1]],opar=list(),blocktype="c",firing=[],dep_ut=[false,false],label="",nzcross=0,nmode=0,equations=list()),doc=list()); -scs_m_1.objs[2-1]=scicos_block(gui="CONST_m",graphics=scicos_graphics(orig=[38.096074,293.82198],sz=[40,40],flip=true,theta=0,exprs="Amin",pin=[],pout=5,pein=[],peout=[],gr_i=[],id="",in_implicit=[],out_implicit="E"),model=scicos_model(sim=list("cstblk4_m",4),in1=[],in2=[],intyp=1,out=1,out2=1,outtyp=1,evtin=[],evtout=[],state=[],dstate=[],odstate=list(),rpar=[],ipar=[],opar=list(-1),blocktype="d",firing=[],dep_ut=[false,false],label="",nzcross=0,nmode=0,equations=list()),doc=list()); -scs_m_1.objs[3-1]=scicos_block(gui="CONST_m",graphics=scicos_graphics(orig=[37.378886,245.02389],sz=[40,40],flip=true,theta=0,exprs="Amax",pin=[],pout=6,pein=[],peout=[],gr_i=[],id="",in_implicit=[],out_implicit="E"),model=scicos_model(sim=list("cstblk4_m",4),in1=[],in2=[],intyp=1,out=1,out2=1,outtyp=1,evtin=[],evtout=[],state=[],dstate=[],odstate=list(),rpar=[],ipar=[],opar=list(1),blocktype="d",firing=[],dep_ut=[false,false],label="",nzcross=0,nmode=0,equations=list()),doc=list()); -scs_m_1.objs[4-1]=scicos_block(gui="SELECT_m",graphics=scicos_graphics(orig=[116.26954,269.42294],sz=[40,40],flip=true,theta=0,exprs=[["-1"],["2"],["1"]],pin=[[5],[6]],pout=14,pein=[[9],[10]],peout=[],gr_i=[],id="",in_implicit=[["E"],["E"]],out_implicit="E"),model=scicos_model(sim=list("selector_m",4),in1=[[-1],[-1]],in2=[[-2],[-2]],intyp=[[-1],[-1]],out=-1,out2=-2,outtyp=-1,evtin=[[1],[1]],evtout=[],state=[],dstate=1,odstate=list(),rpar=[],ipar=[],opar=list(),blocktype="c",firing=[],dep_ut=[true,false],label="",nzcross=0,nmode=0,equations=list()),doc=list()); -scs_m_1.objs[5-1]=scicos_link(xx=[[86.667502],[107.69811],[107.69811]],yy=[[313.82198],[313.82198],[296.0896]],id="drawlink",thick=[0,0],ct=[1,1],from=[2,1,0],to=[4,1,1]); -scs_m_1.objs[6-1]=scicos_link(xx=[[85.950315],[107.69811],[107.69811]],yy=[[265.02389],[265.02389],[282.75627]],id="drawlink",thick=[0,0],ct=[1,1],from=[3,1,0],to=[4,2,1]); -scs_m_1.objs[7-1]=scicos_block(gui="ESELECT_f",graphics=scicos_graphics(orig=[106.9461,339.7496],sz=[60,40],flip=true,theta=0,exprs=[["2"],["0"],["0"]],pin=8,pout=[],pein=[],peout=[[9],[10]],gr_i=[],id="",in_implicit="E",out_implicit=[]),model=scicos_model(sim=list("eselect",-2),in1=1,in2=1,intyp=-1,out=[],out2=[],outtyp=1,evtin=[],evtout=[[1],[1]],state=[],dstate=[],odstate=list(),rpar=[],ipar=[],opar=list(),blocktype="l",firing=[[-1],[-1]],dep_ut=[true,false],label="",nzcross=0,nmode=0,equations=list()),doc=list()); -scs_m_1.objs[8-1]=scicos_link(xx=[[86.80133],[98.374671]],yy=[[359.5057],[359.7496]],id="drawlink",thick=[0,0],ct=[1,1],from=[1,1,0],to=[7,1,1]); -scs_m_1.objs[9-1]=scicos_link(xx=[[126.9461],[129.60287]],yy=[[334.03532],[315.13722]],id="drawlink",thick=[0,0],ct=[5,-1],from=[7,1,0],to=[4,1,1]); -scs_m_1.objs[10-1]=scicos_link(xx=[[146.9461],[142.93621]],yy=[[334.03532],[315.13722]],id="drawlink",thick=[0,0],ct=[5,-1],from=[7,2,0],to=[4,2,1]); -scs_m_1.objs[11-1]=mlist("Deleted"); -scs_m_1.objs[12-1]=mlist("Deleted"); -scs_m_1.objs[13-1]=scicos_block(gui="OUT_f",graphics=scicos_graphics(orig=[184.40238,278.75198],sz=[20,20],flip=true,theta=0,exprs="1",pin=14,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[14-1]=scicos_link(xx=[[164.84097],[184.40238]],yy=[[289.42294],[288.75198]],id="drawlink",thick=[0,0],ct=[1,1],from=[4,1,0],to=[13,1,1]); -scs_m_1.objs[15-1]=scicos_block(gui="SampleCLK",graphics=scicos_graphics(orig=[18.313686,403.57431],sz=[60,40],flip=true,theta=0,exprs=[["F/2"],["0"]],pin=[],pout=[],pein=[],peout=16,gr_i=[],id="",in_implicit=[],out_implicit=[]),model=scicos_model(sim="sampleclk",in1=[],in2=[],intyp=1,out=[],out2=[],outtyp=1,evtin=[],evtout=1,state=[],dstate=[],odstate=list(),rpar=[[1/2],[0]],ipar=[],opar=list(),blocktype="d",firing=-1,dep_ut=[false,false],label="",nzcross=0,nmode=0,equations=list()),doc=list()); -scs_m_1.objs[16-1]=scicos_link(xx=[[48.313686],[48.229901]],yy=[[403.57431],[385.21998]],id="drawlink",thick=[0,0],ct=[5,-1],from=[15,1,0],to=[1,1,1]); -model=scicos_model(); -model.sim="csuper"; -model.in1=[]; -model.in2=[]; -model.intyp=1; -model.out=-1; -model.out2=-2; -model.outtyp=-1; -model.evtin=[]; -model.evtout=[]; -model.state=[]; -model.dstate=[]; -model.odstate=list(); -model.rpar=scs_m_1; -model.ipar=1; -model.opar=list(); -model.blocktype="h"; -model.firing=[]; -model.dep_ut=[false,false]; -model.label=""; -model.nzcross=0; -model.nmode=0; -model.equations=list(); -Amin=-1; -Amax=1; -rule=1; -F=1; -exprs=[sci2exp(Amin),sci2exp(Amax),sci2exp(rule),sci2exp(F)]; -gr_i=[]; -x=standard_define([3,2],model,exprs,gr_i); + scs_m_1 = scicos_diagram(version="scicos4.2",props=scicos_params(wpar=[-176.97473,421.18646,173.61587,524.41503,827,480,0,15,827,480,755,614,1.4],Title="SuperBlock",tol=[0.0001,0.000001,1.000e-10,100001,0,0],tf=100000,context=[["if typeof(Amin)<>typeof(Amax) then error(\'Minimum value and Maximum value must have the same type\');end"],["if and(rule<>[1;2]) then error(\'Initial Value must be 1 (for Min) or 2 (for Max)\');end"],["if Amin>Amax then error(\'Maximum value must be greater than the Minimum Value\');end"],["P=%pi/F"],[""]],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="Counter",graphics=scicos_graphics(orig=[18.229901,339.5057],sz=[60,40],flip=true,theta=0,exprs=[["1"],["2"],["rule"]],pin=[],pout=8,pein=16,peout=[],gr_i=[],id="",in_implicit=[],out_implicit="E"),model=scicos_model(sim=list("counter",4),in1=[],in2=[],intyp=1,out=1,out2=1,outtyp=1,evtin=1,evtout=[],state=[],dstate=0,odstate=list(),rpar=[],ipar=[[1],[2],[1]],opar=list(),blocktype="c",firing=[],dep_ut=[false,false],label="",nzcross=0,nmode=0,equations=list()),doc=list()); + scs_m_1.objs[2-1] = scicos_block(gui="CONST_m",graphics=scicos_graphics(orig=[38.096074,293.82198],sz=[40,40],flip=true,theta=0,exprs="Amin",pin=[],pout=5,pein=[],peout=[],gr_i=[],id="",in_implicit=[],out_implicit="E"),model=scicos_model(sim=list("cstblk4_m",4),in1=[],in2=[],intyp=1,out=1,out2=1,outtyp=1,evtin=[],evtout=[],state=[],dstate=[],odstate=list(),rpar=[],ipar=[],opar=list(-1),blocktype="d",firing=[],dep_ut=[false,false],label="",nzcross=0,nmode=0,equations=list()),doc=list()); + scs_m_1.objs[3-1] = scicos_block(gui="CONST_m",graphics=scicos_graphics(orig=[37.378886,245.02389],sz=[40,40],flip=true,theta=0,exprs="Amax",pin=[],pout=6,pein=[],peout=[],gr_i=[],id="",in_implicit=[],out_implicit="E"),model=scicos_model(sim=list("cstblk4_m",4),in1=[],in2=[],intyp=1,out=1,out2=1,outtyp=1,evtin=[],evtout=[],state=[],dstate=[],odstate=list(),rpar=[],ipar=[],opar=list(1),blocktype="d",firing=[],dep_ut=[false,false],label="",nzcross=0,nmode=0,equations=list()),doc=list()); + scs_m_1.objs[4-1] = scicos_block(gui="SELECT_m",graphics=scicos_graphics(orig=[116.26954,269.42294],sz=[40,40],flip=true,theta=0,exprs=[["-1"],["2"],["1"]],pin=[[5],[6]],pout=14,pein=[[9],[10]],peout=[],gr_i=[],id="",in_implicit=[["E"],["E"]],out_implicit="E"),model=scicos_model(sim=list("selector_m",4),in1=[[-1],[-1]],in2=[[-2],[-2]],intyp=[[-1],[-1]],out=-1,out2=-2,outtyp=-1,evtin=[[1],[1]],evtout=[],state=[],dstate=1,odstate=list(),rpar=[],ipar=[],opar=list(),blocktype="c",firing=[],dep_ut=[true,false],label="",nzcross=0,nmode=0,equations=list()),doc=list()); + scs_m_1.objs[5-1] = scicos_link(xx=[[86.667502],[107.69811],[107.69811]],yy=[[313.82198],[313.82198],[296.0896]],id="drawlink",thick=[0,0],ct=[1,1],from=[2,1,0],to=[4,1,1]); + scs_m_1.objs[6-1] = scicos_link(xx=[[85.950315],[107.69811],[107.69811]],yy=[[265.02389],[265.02389],[282.75627]],id="drawlink",thick=[0,0],ct=[1,1],from=[3,1,0],to=[4,2,1]); + scs_m_1.objs[7-1] = scicos_block(gui="ESELECT_f",graphics=scicos_graphics(orig=[106.9461,339.7496],sz=[60,40],flip=true,theta=0,exprs=[["2"],["0"],["0"]],pin=8,pout=[],pein=[],peout=[[9],[10]],gr_i=[],id="",in_implicit="E",out_implicit=[]),model=scicos_model(sim=list("eselect",-2),in1=1,in2=1,intyp=-1,out=[],out2=[],outtyp=1,evtin=[],evtout=[[1],[1]],state=[],dstate=[],odstate=list(),rpar=[],ipar=[],opar=list(),blocktype="l",firing=[[-1],[-1]],dep_ut=[true,false],label="",nzcross=0,nmode=0,equations=list()),doc=list()); + scs_m_1.objs[8-1] = scicos_link(xx=[[86.80133],[98.374671]],yy=[[359.5057],[359.7496]],id="drawlink",thick=[0,0],ct=[1,1],from=[1,1,0],to=[7,1,1]); + scs_m_1.objs[9-1] = scicos_link(xx=[[126.9461],[129.60287]],yy=[[334.03532],[315.13722]],id="drawlink",thick=[0,0],ct=[5,-1],from=[7,1,0],to=[4,1,1]); + scs_m_1.objs[10-1] = scicos_link(xx=[[146.9461],[142.93621]],yy=[[334.03532],[315.13722]],id="drawlink",thick=[0,0],ct=[5,-1],from=[7,2,0],to=[4,2,1]); + scs_m_1.objs[11-1] = mlist("Deleted"); + scs_m_1.objs[12-1] = mlist("Deleted"); + scs_m_1.objs[13-1] = scicos_block(gui="OUT_f",graphics=scicos_graphics(orig=[184.40238,278.75198],sz=[20,20],flip=true,theta=0,exprs="1",pin=14,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[14-1] = scicos_link(xx=[[164.84097],[184.40238]],yy=[[289.42294],[288.75198]],id="drawlink",thick=[0,0],ct=[1,1],from=[4,1,0],to=[13,1,1]); + scs_m_1.objs[15-1] = scicos_block(gui="SampleCLK",graphics=scicos_graphics(orig=[18.313686,403.57431],sz=[60,40],flip=true,theta=0,exprs=[["F/2"],["0"]],pin=[],pout=[],pein=[],peout=16,gr_i=[],id="",in_implicit=[],out_implicit=[]),model=scicos_model(sim="sampleclk",in1=[],in2=[],intyp=1,out=[],out2=[],outtyp=1,evtin=[],evtout=1,state=[],dstate=[],odstate=list(),rpar=[[1/2],[0]],ipar=[],opar=list(),blocktype="d",firing=-1,dep_ut=[false,false],label="",nzcross=0,nmode=0,equations=list()),doc=list()); + scs_m_1.objs[16-1] = scicos_link(xx=[[48.313686],[48.229901]],yy=[[403.57431],[385.21998]],id="drawlink",thick=[0,0],ct=[5,-1],from=[15,1,0],to=[1,1,1]); + model = scicos_model(); + model.sim = "csuper"; + model.in1 = []; + model.in2 = []; + model.intyp = 1; + model.out = -1; + model.out2 = -2; + model.outtyp = -1; + model.evtin = []; + model.evtout = []; + model.state = []; + model.dstate = []; + model.odstate = list(); + model.rpar = scs_m_1; + model.ipar = 1; + model.opar = list(); + model.blocktype = "h"; + model.firing = []; + model.dep_ut = [false,false]; + model.label = ""; + model.nzcross = 0; + model.nmode = 0; + model.equations = list(); + Amin = -1; + Amax = 1; + rule = 1; + F = 1; + exprs = [sci2exp(Amin),sci2exp(Amax),sci2exp(rule),sci2exp(F)]; + gr_i = []; + x = standard_define([3,2],model,exprs,gr_i); } GEN_SQR.prototype.details = function GEN_SQR() { } GEN_SQR.prototype.get = function GEN_SQR() { } GEN_SQR.prototype.set = function GEN_SQR() { -y=this.needcompile; -arg1.model.ipar=1; -typ=list(); -graphics=arg1.graphics; -exprs=graphics.exprs; -Btitre="Set GEN_SQR parameters"; -Exprs0=[["Amin"],["Amax"],["rule"],["F"]]; -Bitems=[["Minimum Value"],["Maximum Value"],["Initial Value( 1= Minimum Value 2= Maximum Value)"],["Period (sec)"]]; -Ss=list("mat",[-1,-1],"mat",[-1,-1],"pol",-1,"pol",-1); -scicos_context=struct(); -x=arg1; -ok=false; -while (!ok) { -[ok,scicos_context.Amin,scicos_context.Amax,scicos_context.rule,scicos_context.F,exprs]=scicos_getvalue(Btitre,Bitems,Ss,exprs); -if (!ok) { + y = this.needcompile; + arg1.model.ipar = 1; + typ = list(); + graphics = arg1.graphics; + exprs = graphics.exprs; + Btitre = "Set GEN_SQR parameters"; + Exprs0 = [["Amin"],["Amax"],["rule"],["F"]]; + Bitems = [["Minimum Value"],["Maximum Value"],["Initial Value( 1= Minimum Value 2= Maximum Value)"],["Period (sec)"]]; + Ss = list("mat",[-1,-1],"mat",[-1,-1],"pol",-1,"pol",-1); + scicos_context = struct(); + x = arg1; + ok = false; + while (!ok) { + [ok,scicos_context.Amin,scicos_context.Amax,scicos_context.rule,scicos_context.F,exprs] = scicos_getvalue(Btitre,Bitems,Ss,exprs); + if (!ok) { return; } -PREVAR_scicos_context=scicos_context; -sblock=x.model.rpar; -[PREVAR_scicos_context,ierr]=script2var(sblock.props.context,PREVAR_scicos_context); -if (ierr==0) { -[sblock,%w,needcompile2,ok]=do_eval(sblock,list()); -if (ok) { -y=max(2,this.needcompile,needcompile2); -x.graphics.exprs=exprs; -x.model.rpar=sblock; + PREVAR_scicos_context = scicos_context; + sblock = x.model.rpar; + [PREVAR_scicos_context,ierr] = script2var(sblock.props.context,PREVAR_scicos_context); + if (ierr==0) { + [sblock,%w,needcompile2,ok] = do_eval(sblock,list()); + if (ok) { + y = max(2,this.needcompile,needcompile2); + x.graphics.exprs = exprs; + x.model.rpar = sblock; break; } -} else { + } else { message(lasterror()); -ok=false; + ok = false; } } } diff --git a/js/Sources/Ground_g.js b/js/Sources/Ground_g.js index 680db464..2a20d38d 100644 --- a/js/Sources/Ground_g.js +++ b/js/Sources/Ground_g.js @@ -1,27 +1,27 @@ /* autogenerated from "macros/Sources/Ground_g.sci" */ function Ground_g() { Ground_g.prototype.define = function Ground_g() { -C=[0]; -model=scicos_model(); -model.sim=list("cstblk4_m",4); -model.in1=[]; -model.out=1; -model.in2=[]; -model.out2=1; -model.outtyp=-1; -model.rpar=[]; -model.opar=list(C); -model.blocktype="d"; -model.dep_ut=[false,false]; -exprs=[]; -gr_i=[]; -x=standard_define([2,2],model,exprs,gr_i); + C = [0]; + model = scicos_model(); + model.sim = list("cstblk4_m",4); + model.in1 = []; + model.out = 1; + model.in2 = []; + model.out2 = 1; + model.outtyp = -1; + model.rpar = []; + model.opar = list(C); + model.blocktype = "d"; + model.dep_ut = [false,false]; + exprs = []; + gr_i = []; + x = standard_define([2,2],model,exprs,gr_i); } Ground_g.prototype.details = function Ground_g() { } Ground_g.prototype.get = function Ground_g() { } Ground_g.prototype.set = function Ground_g() { -x=arg1; + x = arg1; } } diff --git a/js/Sources/INIMPL_f.js b/js/Sources/INIMPL_f.js index bfa017a0..f2075b5c 100644 --- a/js/Sources/INIMPL_f.js +++ b/js/Sources/INIMPL_f.js @@ -1,52 +1,52 @@ /* autogenerated from "macros/Sources/INIMPL_f.sci" */ function INIMPL_f() { INIMPL_f.prototype.define = function INIMPL_f() { -model=scicos_model(); -model.sim="inimpl"; -model.out=[-1]; -model.out2=[1]; -model.ipar=[1]; -model.dep_ut=[false,false]; -model.blocktype="c"; -mo=modelica(); -mo.model="PORT"; -mo.outputs="n"; -model.equations=mo; -prt=1; -exprs="1"; -gr_i=[]; -x=standard_define([1,1],model,exprs,gr_i); -x.graphics.out_implicit=["I"]; + model = scicos_model(); + model.sim = "inimpl"; + model.out = [-1]; + model.out2 = [1]; + model.ipar = [1]; + model.dep_ut = [false,false]; + model.blocktype = "c"; + mo = modelica(); + mo.model = "PORT"; + mo.outputs = "n"; + model.equations = mo; + prt = 1; + exprs = "1"; + gr_i = []; + x = standard_define([1,1],model,exprs,gr_i); + x.graphics.out_implicit = ["I"]; } INIMPL_f.prototype.details = function INIMPL_f() { } INIMPL_f.prototype.get = function INIMPL_f() { } INIMPL_f.prototype.set = function INIMPL_f() { -x=arg1; -graphics=arg1.graphics; -exprs=graphics.exprs; -model=arg1.model; -if (size(exprs,"*")==2) { -exprs=exprs[1-1]; + x = arg1; + graphics = arg1.graphics; + exprs = graphics.exprs; + model = arg1.model; + if (size(exprs,"*")==2) { + exprs = exprs[1-1]; } -while (true) { -[ok,prt,exprs]=scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"INIMPL_f")],[" "],[gettext("Implicit input port")],[" "]],"Port Number",list("vec",1),exprs); -if (!ok) { + while (true) { + [ok,prt,exprs] = scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"INIMPL_f")],[" "],[gettext("Implicit input port")],[" "]],"Port Number",list("vec",1),exprs); + if (!ok) { break; } -prt=int(prt); -if (prt<=0) { + prt = int(prt); + if (prt<=0) { block_parameter_error(msprintf(gettext("Wrong value for \'Port Number\' parameter: %d."),prt),gettext("Strictly positive integer expected.")); -} else { -if (model.ipar!=prt) { -needcompile=4; -y=needcompile; + } else { + if (model.ipar!=prt) { + needcompile = 4; + y = needcompile; } -model.ipar=prt; -graphics.exprs=exprs; -x.graphics=graphics; -x.model=model; + model.ipar = prt; + graphics.exprs = exprs; + x.graphics = graphics; + x.model = model; break; } } diff --git a/js/Sources/IN_f.js b/js/Sources/IN_f.js index b81e3518..d5d41983 100644 --- a/js/Sources/IN_f.js +++ b/js/Sources/IN_f.js @@ -1,59 +1,59 @@ /* autogenerated from "macros/Sources/IN_f.sci" */ function IN_f() { IN_f.prototype.define = function IN_f() { -prt=1; -model=scicos_model(); -model.sim="input"; -model.out=-1; -model.out2=-2; -model.outtyp=-1; -model.ipar=prt; -model.blocktype="c"; -model.dep_ut=[false,false]; -exprs=sci2exp(prt); -gr_i=[]; -x=standard_define([1,1],model,exprs,gr_i); + prt = 1; + model = scicos_model(); + model.sim = "input"; + model.out = -1; + model.out2 = -2; + model.outtyp = -1; + model.ipar = prt; + model.blocktype = "c"; + model.dep_ut = [false,false]; + exprs = sci2exp(prt); + gr_i = []; + x = standard_define([1,1],model,exprs,gr_i); } IN_f.prototype.details = function IN_f() { } IN_f.prototype.get = function IN_f() { } IN_f.prototype.set = function IN_f() { -x=arg1; -graphics=arg1.graphics; -model=arg1.model; -exprs=graphics.exprs; -if (size(exprs,"*")==2) { -exprs=exprs[1-1]; + x = arg1; + graphics = arg1.graphics; + model = arg1.model; + exprs = graphics.exprs; + if (size(exprs,"*")==2) { + exprs = exprs[1-1]; } -if (size(exprs,"*")==1) { -exprs=[[exprs[1-1]],["[-1 -2]"],["-1"]]; + if (size(exprs,"*")==1) { + exprs = [[exprs[1-1]],["[-1 -2]"],["-1"]]; } -while (true) { -[ok,prt,otsz,ot,exprs]=getvalue(_("Set Input block parameters"),[[_("Port number")],[_("Outport size ([-1 -2] for inherit)")],[_("Outport Type (-1 for inherit)")]],list("vec",1,"vec",-1,"vec",1),exprs); -if (!ok) { + while (true) { + [ok,prt,otsz,ot,exprs] = getvalue(_("Set Input block parameters"),[[_("Port number")],[_("Outport size ([-1 -2] for inherit)")],[_("Outport Type (-1 for inherit)")]],list("vec",1,"vec",-1,"vec",1),exprs); + if (!ok) { break; } -prt=int(prt); -if (prt<=0) { + prt = int(prt); + if (prt<=0) { message(_("Port number must be a positive integer")); -} else if (!isequal(size(otsz,"*"),2)) { + } else if (!isequal(size(otsz,"*"),2)) { message(_("Outport Size must be a 2 elements vector")); -} else if (((ot<1||ot>9)&&(ot!=-1))) { + } else if (((ot<1||ot>9)&&(ot!=-1))) { message(_("Outport type must be a number between 1 and 9, or -1 for inheritance.")); -} else { -if (model.ipar!=prt) { -needcompile=4; -y=needcompile; + } else { + if (model.ipar!=prt) { + needcompile = 4; + y = needcompile; } -model.ipar=prt; -model.firing=[]; -model.out=otsz[1-1]; -model.out2=otsz[2-1]; -model.outtyp=ot; -graphics.exprs=exprs; -x.graphics=graphics; -x.model=model; + model.ipar = prt; + model.firing = []; + model.out = otsz[1-1]; + model.out2 = otsz[2-1]; + model.outtyp = ot; + graphics.exprs = exprs; + x.graphics = graphics; + x.model = model; break; } } diff --git a/js/Sources/Modulo_Count.js b/js/Sources/Modulo_Count.js index 06b77c73..03482970 100644 --- a/js/Sources/Modulo_Count.js +++ b/js/Sources/Modulo_Count.js @@ -1,46 +1,46 @@ /* autogenerated from "macros/Sources/Modulo_Count.sci" */ function Modulo_Count() { Modulo_Count.prototype.define = function Modulo_Count() { -ini_c=0; -base=3; -model=scicos_model(); -model.sim=list("modulo_count",4); -model.evtin=1; -model.out=1; -model.dstate=ini_c; -model.ipar=base; -model.blocktype="c"; -model.dep_ut=[false,false]; -exprs=[[string(ini_c)],[string(base)]]; -gr_i=[]; -x=standard_define([3,2],model,exprs,gr_i); + ini_c = 0; + base = 3; + model = scicos_model(); + model.sim = list("modulo_count",4); + model.evtin = 1; + model.out = 1; + model.dstate = ini_c; + model.ipar = base; + model.blocktype = "c"; + model.dep_ut = [false,false]; + exprs = [[string(ini_c)],[string(base)]]; + gr_i = []; + x = standard_define([3,2],model,exprs,gr_i); } Modulo_Count.prototype.details = function Modulo_Count() { } Modulo_Count.prototype.get = function Modulo_Count() { } Modulo_Count.prototype.set = function Modulo_Count() { -x=arg1; -graphics=arg1.graphics; -exprs=graphics.exprs; -model=arg1.model; -while (true) { -[ok,ini_c,base,exprs]=scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"Modulo_Count")],[" "],[gettext("Modulo counter (0 to N counter)")],[" "]],[[gettext("Initial State (zero or positive number)")],[gettext("Upper Limit (positive number)")]],list("vec",1,"vec",1),exprs); -ini_c=int(ini_c); -base=int(base); -if (!ok) { + x = arg1; + graphics = arg1.graphics; + exprs = graphics.exprs; + model = arg1.model; + while (true) { + [ok,ini_c,base,exprs] = scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"Modulo_Count")],[" "],[gettext("Modulo counter (0 to N counter)")],[" "]],[[gettext("Initial State (zero or positive number)")],[gettext("Upper Limit (positive number)")]],list("vec",1,"vec",1),exprs); + ini_c = int(ini_c); + base = int(base); + if (!ok) { break; } -if (ini_c<0) { + if (ini_c<0) { block_parameter_error(msprintf(gettext("Wrong value for \'Initial State\' parameter: %d."),ini_c),gettext("Null or positive integer expected.")); -} else if (base<=0) { + } else if (base<=0) { block_parameter_error(msprintf(gettext("Wrong values for \'Upper Limit\' parameter: %d."),base),gettext("Strictly positive integer expected.")); -} else { -graphics.exprs=exprs; -model.ipar=base; -model.dstate=ini_c; -x.graphics=graphics; -x.model=model; + } else { + graphics.exprs = exprs; + model.ipar = base; + model.dstate = ini_c; + x.graphics = graphics; + x.model = model; break; } } diff --git a/js/Sources/PULSE_SC.js b/js/Sources/PULSE_SC.js index 0f216f21..00dd65d2 100644 --- a/js/Sources/PULSE_SC.js +++ b/js/Sources/PULSE_SC.js @@ -1,87 +1,87 @@ /* autogenerated from "macros/Sources/PULSE_SC.sci" */ function PULSE_SC() { PULSE_SC.prototype.define = function PULSE_SC() { -scs_m_1=scicos_diagram(version="scicos4.2",props=scicos_params(wpar=[-162.7581,435.54369,67.607292,416.67644,827,479,0,15,827,480,715,167,1.4],Title=["SuperBlock","/home/fady/Scicos_examples/"],tol=[[0.0001],[0.000001],[1.000e-10],[100001],[0],[0],[0]],tf=10,context=[["E2=E+W/100*F"],["if (W<0 | W>100) then error(\'Width must be between 0 and 100\');end"],["if (E2 >= F) then error (\'Offset must be lower than (frequency*(1-Width/100))\'); end"]],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="CONST_m",graphics=scicos_graphics(orig=[30.801202,158.91733],sz=[40,40],flip=true,theta=0,exprs="A",pin=[],pout=5,pein=[],peout=[],gr_i=[],id="",in_implicit=[],out_implicit="E"),model=scicos_model(sim=list("cstblk4_m",4),in1=[],in2=[],intyp=1,out=1,out2=1,outtyp=1,evtin=[],evtout=[],state=[],dstate=[],odstate=list(),rpar=[],ipar=[],opar=list(1),blocktype="d",firing=[],dep_ut=[false,false],label="",nzcross=0,nmode=0,equations=list()),doc=list()); -scs_m_1.objs[2-1]=scicos_block(gui="Ground_g",graphics=scicos_graphics(orig=[31.534535,215.384],sz=[40,40],flip=true,theta=0,exprs=[],pin=[],pout=4,pein=[],peout=[],gr_i=[],id="",in_implicit=[],out_implicit="E"),model=scicos_model(sim=list("cstblk4_m",4),in1=[],in2=[],intyp=1,out=1,out2=1,outtyp=-1,evtin=[],evtout=[],state=[],dstate=[],odstate=list(),rpar=[],ipar=[],opar=list(0),blocktype="d",firing=[],dep_ut=[false,false],label="",nzcross=0,nmode=0,equations=list()),doc=list()); -scs_m_1.objs[3-1]=scicos_block(gui="SELECT_m",graphics=scicos_graphics(orig=[106.00652,186.09381],sz=[40,40],flip=true,theta=0,exprs=[["-1"],["2"],["1"]],pin=[[4],[5]],pout=11,pein=[[9],[8]],peout=[],gr_i=[],id="",in_implicit=[["E"],["E"]],out_implicit="E"),model=scicos_model(sim=list("selector_m",4),in1=[[-1],[-1]],in2=[[-2],[-2]],intyp=[[-1],[-1]],out=-1,out2=-2,outtyp=-1,evtin=[[1],[1]],evtout=[],state=[],dstate=1,odstate=list(),rpar=[],ipar=[],opar=list(),blocktype="c",firing=[],dep_ut=[true,false],label="",nzcross=0,nmode=0,equations=list()),doc=list()); -scs_m_1.objs[4-1]=scicos_link(xx=[[80.105964],[97.43509],[97.43509]],yy=[[235.384],[235.384],[212.76048]],id="drawlink",thick=[0,0],ct=[1,1],from=[2,1,0],to=[3,1,1]); -scs_m_1.objs[5-1]=scicos_link(xx=[[79.372631],[97.43509],[97.43509]],yy=[[178.91733],[178.91733],[199.42714]],id="drawlink",thick=[0,0],ct=[1,1],from=[1,1,0],to=[3,2,1]); -scs_m_1.objs[6-1]=scicos_block(gui="SampleCLK",graphics=scicos_graphics(orig=[82.349744,274.21741],sz=[60,40],flip=true,theta=0,exprs=[["F"],["E2"]],pin=[],pout=[],pein=[],peout=9,gr_i=[],id="",in_implicit=[],out_implicit=[]),model=scicos_model(sim="sampleclk",in1=[],in2=[],intyp=1,out=[],out2=[],outtyp=1,evtin=[],evtout=1,state=[],dstate=[],odstate=list(),rpar=[[1],[0.4]],ipar=[],opar=list(),blocktype="d",firing=-1,dep_ut=[false,false],label="",nzcross=0,nmode=0,equations=list()),doc=list()); -scs_m_1.objs[7-1]=scicos_block(gui="SampleCLK",graphics=scicos_graphics(orig=[160.48879,274.21741],sz=[60,40],flip=true,theta=0,exprs=[["F"],["E"]],pin=[],pout=[],pein=[],peout=8,gr_i=[],id="",in_implicit=[],out_implicit=[]),model=scicos_model(sim="sampleclk",in1=[],in2=[],intyp=1,out=[],out2=[],outtyp=1,evtin=[],evtout=1,state=[],dstate=[],odstate=list(),rpar=[[1],[0.1]],ipar=[],opar=list(),blocktype="d",firing=-1,dep_ut=[false,false],label="",nzcross=0,nmode=0,equations=list()),doc=list()); -scs_m_1.objs[8-1]=scicos_link(xx=[[190.48879],[190.48879],[132.67318],[132.67318]],yy=[[274.21741],[240.99048],[240.99048],[231.80809]],id="drawlink",thick=[0,0],ct=[5,-1],from=[7,1,0],to=[3,2,1]); -scs_m_1.objs[9-1]=scicos_link(xx=[[112.34974],[112.34974],[119.33985],[119.33985]],yy=[[274.21741],[248.21372],[248.21372],[231.80809]],id="drawlink",thick=[0,0],ct=[5,-1],from=[6,1,0],to=[3,1,1]); -scs_m_1.objs[10-1]=scicos_block(gui="OUT_f",graphics=scicos_graphics(orig=[174.57795,196.09381],sz=[20,20],flip=true,theta=0,exprs="1",pin=11,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[11-1]=scicos_link(xx=[[154.57795],[174.57795]],yy=[[206.09381],[206.09381]],id="drawlink",thick=[0,0],ct=[1,1],from=[3,1,0],to=[10,1,1]); -model=scicos_model(); -model.sim="csuper"; -model.in1=[]; -model.in2=[]; -model.intyp=1; -model.out=-1; -model.out2=-2; -model.outtyp=-1; -model.evtin=[]; -model.evtout=[]; -model.state=[]; -model.dstate=[]; -model.odstate=list(); -model.rpar=scs_m_1; -model.ipar=1; -model.opar=list(); -model.blocktype="h"; -model.firing=[]; -model.dep_ut=[false,false]; -model.label=""; -model.nzcross=0; -model.nmode=0; -model.equations=list(); -E=0.1; -W=30; -F=1; -A=1; -exprs=[sci2exp(E),sci2exp(W),sci2exp(F),sci2exp(A)]; -gr_i=[]; -x=standard_define([3,2],model,exprs,gr_i); + scs_m_1 = scicos_diagram(version="scicos4.2",props=scicos_params(wpar=[-162.7581,435.54369,67.607292,416.67644,827,479,0,15,827,480,715,167,1.4],Title=["SuperBlock","/home/fady/Scicos_examples/"],tol=[[0.0001],[0.000001],[1.000e-10],[100001],[0],[0],[0]],tf=10,context=[["E2=E+W/100*F"],["if (W<0 | W>100) then error(\'Width must be between 0 and 100\');end"],["if (E2 >= F) then error (\'Offset must be lower than (frequency*(1-Width/100))\'); end"]],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="CONST_m",graphics=scicos_graphics(orig=[30.801202,158.91733],sz=[40,40],flip=true,theta=0,exprs="A",pin=[],pout=5,pein=[],peout=[],gr_i=[],id="",in_implicit=[],out_implicit="E"),model=scicos_model(sim=list("cstblk4_m",4),in1=[],in2=[],intyp=1,out=1,out2=1,outtyp=1,evtin=[],evtout=[],state=[],dstate=[],odstate=list(),rpar=[],ipar=[],opar=list(1),blocktype="d",firing=[],dep_ut=[false,false],label="",nzcross=0,nmode=0,equations=list()),doc=list()); + scs_m_1.objs[2-1] = scicos_block(gui="Ground_g",graphics=scicos_graphics(orig=[31.534535,215.384],sz=[40,40],flip=true,theta=0,exprs=[],pin=[],pout=4,pein=[],peout=[],gr_i=[],id="",in_implicit=[],out_implicit="E"),model=scicos_model(sim=list("cstblk4_m",4),in1=[],in2=[],intyp=1,out=1,out2=1,outtyp=-1,evtin=[],evtout=[],state=[],dstate=[],odstate=list(),rpar=[],ipar=[],opar=list(0),blocktype="d",firing=[],dep_ut=[false,false],label="",nzcross=0,nmode=0,equations=list()),doc=list()); + scs_m_1.objs[3-1] = scicos_block(gui="SELECT_m",graphics=scicos_graphics(orig=[106.00652,186.09381],sz=[40,40],flip=true,theta=0,exprs=[["-1"],["2"],["1"]],pin=[[4],[5]],pout=11,pein=[[9],[8]],peout=[],gr_i=[],id="",in_implicit=[["E"],["E"]],out_implicit="E"),model=scicos_model(sim=list("selector_m",4),in1=[[-1],[-1]],in2=[[-2],[-2]],intyp=[[-1],[-1]],out=-1,out2=-2,outtyp=-1,evtin=[[1],[1]],evtout=[],state=[],dstate=1,odstate=list(),rpar=[],ipar=[],opar=list(),blocktype="c",firing=[],dep_ut=[true,false],label="",nzcross=0,nmode=0,equations=list()),doc=list()); + scs_m_1.objs[4-1] = scicos_link(xx=[[80.105964],[97.43509],[97.43509]],yy=[[235.384],[235.384],[212.76048]],id="drawlink",thick=[0,0],ct=[1,1],from=[2,1,0],to=[3,1,1]); + scs_m_1.objs[5-1] = scicos_link(xx=[[79.372631],[97.43509],[97.43509]],yy=[[178.91733],[178.91733],[199.42714]],id="drawlink",thick=[0,0],ct=[1,1],from=[1,1,0],to=[3,2,1]); + scs_m_1.objs[6-1] = scicos_block(gui="SampleCLK",graphics=scicos_graphics(orig=[82.349744,274.21741],sz=[60,40],flip=true,theta=0,exprs=[["F"],["E2"]],pin=[],pout=[],pein=[],peout=9,gr_i=[],id="",in_implicit=[],out_implicit=[]),model=scicos_model(sim="sampleclk",in1=[],in2=[],intyp=1,out=[],out2=[],outtyp=1,evtin=[],evtout=1,state=[],dstate=[],odstate=list(),rpar=[[1],[0.4]],ipar=[],opar=list(),blocktype="d",firing=-1,dep_ut=[false,false],label="",nzcross=0,nmode=0,equations=list()),doc=list()); + scs_m_1.objs[7-1] = scicos_block(gui="SampleCLK",graphics=scicos_graphics(orig=[160.48879,274.21741],sz=[60,40],flip=true,theta=0,exprs=[["F"],["E"]],pin=[],pout=[],pein=[],peout=8,gr_i=[],id="",in_implicit=[],out_implicit=[]),model=scicos_model(sim="sampleclk",in1=[],in2=[],intyp=1,out=[],out2=[],outtyp=1,evtin=[],evtout=1,state=[],dstate=[],odstate=list(),rpar=[[1],[0.1]],ipar=[],opar=list(),blocktype="d",firing=-1,dep_ut=[false,false],label="",nzcross=0,nmode=0,equations=list()),doc=list()); + scs_m_1.objs[8-1] = scicos_link(xx=[[190.48879],[190.48879],[132.67318],[132.67318]],yy=[[274.21741],[240.99048],[240.99048],[231.80809]],id="drawlink",thick=[0,0],ct=[5,-1],from=[7,1,0],to=[3,2,1]); + scs_m_1.objs[9-1] = scicos_link(xx=[[112.34974],[112.34974],[119.33985],[119.33985]],yy=[[274.21741],[248.21372],[248.21372],[231.80809]],id="drawlink",thick=[0,0],ct=[5,-1],from=[6,1,0],to=[3,1,1]); + scs_m_1.objs[10-1] = scicos_block(gui="OUT_f",graphics=scicos_graphics(orig=[174.57795,196.09381],sz=[20,20],flip=true,theta=0,exprs="1",pin=11,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[11-1] = scicos_link(xx=[[154.57795],[174.57795]],yy=[[206.09381],[206.09381]],id="drawlink",thick=[0,0],ct=[1,1],from=[3,1,0],to=[10,1,1]); + model = scicos_model(); + model.sim = "csuper"; + model.in1 = []; + model.in2 = []; + model.intyp = 1; + model.out = -1; + model.out2 = -2; + model.outtyp = -1; + model.evtin = []; + model.evtout = []; + model.state = []; + model.dstate = []; + model.odstate = list(); + model.rpar = scs_m_1; + model.ipar = 1; + model.opar = list(); + model.blocktype = "h"; + model.firing = []; + model.dep_ut = [false,false]; + model.label = ""; + model.nzcross = 0; + model.nmode = 0; + model.equations = list(); + E = 0.1; + W = 30; + F = 1; + A = 1; + exprs = [sci2exp(E),sci2exp(W),sci2exp(F),sci2exp(A)]; + gr_i = []; + x = standard_define([3,2],model,exprs,gr_i); } PULSE_SC.prototype.details = function PULSE_SC() { } PULSE_SC.prototype.get = function PULSE_SC() { } PULSE_SC.prototype.set = function PULSE_SC() { -y=this.needcompile; -arg1.model.ipar=1; -typ=list(); -graphics=arg1.graphics; -exprs=graphics.exprs; -Btitre="Set Pulse Generator parameters"; -Exprs0=[["E"],["W"],["F"],["A"]]; -Bitems=[["Phase delay (secs):"],["Pulse Width (% of period):"],["Period (secs):"],["Amplitude:"]]; -Ss=list("pol",-1,"pol",-1,"pol",-1,"mat",[-1,-1]); -scicos_context=struct(); -x=arg1; -ok=false; -while (!ok) { -[ok,scicos_context.E,scicos_context.W,scicos_context.F,scicos_context.A,exprs]=scicos_getvalue(Btitre,Bitems,Ss,exprs); -if (!ok) { + y = this.needcompile; + arg1.model.ipar = 1; + typ = list(); + graphics = arg1.graphics; + exprs = graphics.exprs; + Btitre = "Set Pulse Generator parameters"; + Exprs0 = [["E"],["W"],["F"],["A"]]; + Bitems = [["Phase delay (secs):"],["Pulse Width (% of period):"],["Period (secs):"],["Amplitude:"]]; + Ss = list("pol",-1,"pol",-1,"pol",-1,"mat",[-1,-1]); + scicos_context = struct(); + x = arg1; + ok = false; + while (!ok) { + [ok,scicos_context.E,scicos_context.W,scicos_context.F,scicos_context.A,exprs] = scicos_getvalue(Btitre,Bitems,Ss,exprs); + if (!ok) { return; } -PREVAR_scicos_context=scicos_context; -sblock=x.model.rpar; -[PREVAR_scicos_context,ierr]=script2var(sblock.props.context,PREVAR_scicos_context); -if (ierr==0) { -[sblock,%w,needcompile2,ok]=do_eval(sblock,list()); -if (ok) { -y=max(2,this.needcompile,needcompile2); -x.graphics.exprs=exprs; -x.model.rpar=sblock; + PREVAR_scicos_context = scicos_context; + sblock = x.model.rpar; + [PREVAR_scicos_context,ierr] = script2var(sblock.props.context,PREVAR_scicos_context); + if (ierr==0) { + [sblock,%w,needcompile2,ok] = do_eval(sblock,list()); + if (ok) { + y = max(2,this.needcompile,needcompile2); + x.graphics.exprs = exprs; + x.model.rpar = sblock; break; } -} else { -if ((lasterror()!=[])) { + } else { + if ((lasterror()!=[])) { messagebox(lasterror()); } -ok=false; + ok = false; } } } diff --git a/js/Sources/RAMP.js b/js/Sources/RAMP.js index 2868c2f9..add6822e 100644 --- a/js/Sources/RAMP.js +++ b/js/Sources/RAMP.js @@ -1,44 +1,44 @@ /* autogenerated from "macros/Sources/RAMP.sci" */ function RAMP() { RAMP.prototype.define = function RAMP() { -slope=0; -iout=0; -stt=0; -rpar=[[slope],[stt],[iout]]; -model=scicos_model(); -model.sim=list("ramp",4); -model.in1=[]; -model.out=1; -model.rpar=rpar; -model.blocktype="c"; -model.nmode=1; -model.nzcross=1; -model.dep_ut=[false,true]; -exprs=[string(rpar)]; -gr_i=[]; -x=standard_define([2,2],model,exprs,gr_i); + slope = 0; + iout = 0; + stt = 0; + rpar = [[slope],[stt],[iout]]; + model = scicos_model(); + model.sim = list("ramp",4); + model.in1 = []; + model.out = 1; + model.rpar = rpar; + model.blocktype = "c"; + model.nmode = 1; + model.nzcross = 1; + model.dep_ut = [false,true]; + exprs = [string(rpar)]; + gr_i = []; + x = standard_define([2,2],model,exprs,gr_i); } RAMP.prototype.details = function RAMP() { } RAMP.prototype.get = function RAMP() { } RAMP.prototype.set = function RAMP() { -x=arg1; -graphics=arg1.graphics; -exprs=graphics.exprs; -model=arg1.model; -while (true) { -[ok,slope,stt,iout,exprs]=scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"RAMP")],[" "],[gettext("Ramp function")],[" "]],[[gettext("Slope")],[gettext("Start Time")],[gettext("Initial Value")]],list("vec",1,"vec",1,"vec",1),exprs); -if (!ok) { + x = arg1; + graphics = arg1.graphics; + exprs = graphics.exprs; + model = arg1.model; + while (true) { + [ok,slope,stt,iout,exprs] = scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"RAMP")],[" "],[gettext("Ramp function")],[" "]],[[gettext("Slope")],[gettext("Start Time")],[gettext("Initial Value")]],list("vec",1,"vec",1,"vec",1),exprs); + if (!ok) { break; } -if (stt<0) { + if (stt<0) { block_parameter_error(msprintf(gettext("Wrong value for \'Start Time\' parameter: %e."),stt),gettext("Null or positive integer expected.")); -} else { -model.rpar=[[slope],[stt],[iout]]; -graphics.exprs=exprs; -x.graphics=graphics; -x.model=model; + } else { + model.rpar = [[slope],[stt],[iout]]; + graphics.exprs = exprs; + x.graphics = graphics; + x.model = model; break; } } diff --git a/js/Sources/RAND_f.js b/js/Sources/RAND_f.js index c3f8d63e..1302b020 100644 --- a/js/Sources/RAND_f.js +++ b/js/Sources/RAND_f.js @@ -1,55 +1,55 @@ /* autogenerated from "macros/Sources/RAND_f.sci" */ function RAND_f() { RAND_f.prototype.define = function RAND_f() { -a=0; -b=1; -dt=0; -out=1; -flag=0; -model=scicos_model(); -model.sim="rndblk"; -model.out=out; -model.evtin=1; -model.dstate=[[int(rand()*(10^7-1))],[0*a.slice()]]; -model.rpar=[[a.slice()],[b.slice()]]; -model.ipar=flag; -model.blocktype="d"; -model.dep_ut=[false,false]; -exprs=[[string(flag)],[sci2exp(a.slice())],[sci2exp(b.slice())],[string(model.dstate[1-1])]]; -gr_i=[]; -x=standard_define([3,2],model,exprs,gr_i); + a = 0; + b = 1; + dt = 0; + out = 1; + flag = 0; + model = scicos_model(); + model.sim = "rndblk"; + model.out = out; + model.evtin = 1; + model.dstate = [[int(rand()*(10^7-1))],[0*a.slice()]]; + model.rpar = [[a.slice()],[b.slice()]]; + model.ipar = flag; + model.blocktype = "d"; + model.dep_ut = [false,false]; + exprs = [[string(flag)],[sci2exp(a.slice())],[sci2exp(b.slice())],[string(model.dstate[1-1])]]; + gr_i = []; + x = standard_define([3,2],model,exprs,gr_i); } RAND_f.prototype.details = function RAND_f() { } RAND_f.prototype.get = function RAND_f() { } RAND_f.prototype.set = function RAND_f() { -x=arg1; -graphics=arg1.graphics; -exprs=graphics.exprs; -model=arg1.model; -if (size(exprs,"*")==5) { -exprs=exprs.slice(1-1,3); + x = arg1; + graphics = arg1.graphics; + exprs = graphics.exprs; + model = arg1.model; + if (size(exprs,"*")==5) { + exprs = exprs.slice(1-1,3); } -if (size(exprs,"*")==3) { -exprs=[[exprs],[string(model.dstate[1-1])]]; + if (size(exprs,"*")==3) { + exprs = [[exprs],[string(model.dstate[1-1])]]; } -while (true) { -[ok,flag,a,b,seed_c,exprs]=scicos_getvalue([["Set Random generator block parameters"],["flag = 0 : Uniform distribution A is min and A+B max"],["flag = 1 : Normal distribution A is mean and B deviation"],[" "],["A and B must be vector with equal sizes"],["seed is the seed of random number generator (integer<2**31)"]],[["flag"],["A"],["B"],["seed"]],list("vec",1,"vec",-1,"vec","size(%2,\'*\')","vec",1),exprs); -if (!ok) { + while (true) { + [ok,flag,a,b,seed_c,exprs] = scicos_getvalue([["Set Random generator block parameters"],["flag = 0 : Uniform distribution A is min and A+B max"],["flag = 1 : Normal distribution A is mean and B deviation"],[" "],["A and B must be vector with equal sizes"],["seed is the seed of random number generator (integer<2**31)"]],[["flag"],["A"],["B"],["seed"]],list("vec",1,"vec",-1,"vec","size(%2,\'*\')","vec",1),exprs); + if (!ok) { break; } -if (flag!=0&&flag!=1) { + if (flag!=0&&flag!=1) { message("flag must be equal to 1 or 0"); -} else { -nout=size(a,"*"); -graphics.exprs=exprs; -model.out=nout; -model.ipar=flag; -model.rpar=[[a.slice()],[b.slice()]]; -model.dstate=[[seed_c],[0*a.slice()]]; -x.graphics=graphics; -x.model=model; + } else { + nout = size(a,"*"); + graphics.exprs = exprs; + model.out = nout; + model.ipar = flag; + model.rpar = [[a.slice()],[b.slice()]]; + model.dstate = [[seed_c],[0*a.slice()]]; + x.graphics = graphics; + x.model = model; break; } } diff --git a/js/Sources/RAND_m.js b/js/Sources/RAND_m.js index 090093cb..ab7e919f 100644 --- a/js/Sources/RAND_m.js +++ b/js/Sources/RAND_m.js @@ -1,76 +1,76 @@ /* autogenerated from "macros/Sources/RAND_m.sci" */ function RAND_m() { RAND_m.prototype.define = function RAND_m() { -a=0; -b=1; -dt=0; -flag=0; -function_name="rndblk_m"; -funtyp=4; -model=scicos_model(); -model.sim=list(function_name,funtyp); -model.in1=[]; -model.in2=[]; -model.intyp=[]; -model.out=1; -model.out2=1; -model.outtyp=1; -model.evtin=1; -model.evtout=[]; -model.state=[]; -model.dstate=[[int(rand()*(10^7-1))],[0*a.slice()]]; -model.rpar=[a.slice(),b.slice()]; -model.ipar=flag; -model.blocktype="d"; -model.firing=[]; -model.dep_ut=[false,false]; -exprs=[[sci2exp(1)],[string(flag)],[sci2exp([a])],[sci2exp([b])],[sci2exp([model.dstate[1-1],int(rand()*(10^7-1))])]]; -gr_i=[]; -x=standard_define([3,2],model,exprs,gr_i); + a = 0; + b = 1; + dt = 0; + flag = 0; + function_name = "rndblk_m"; + funtyp = 4; + model = scicos_model(); + model.sim = list(function_name,funtyp); + model.in1 = []; + model.in2 = []; + model.intyp = []; + model.out = 1; + model.out2 = 1; + model.outtyp = 1; + model.evtin = 1; + model.evtout = []; + model.state = []; + model.dstate = [[int(rand()*(10^7-1))],[0*a.slice()]]; + model.rpar = [a.slice(),b.slice()]; + model.ipar = flag; + model.blocktype = "d"; + model.firing = []; + model.dep_ut = [false,false]; + exprs = [[sci2exp(1)],[string(flag)],[sci2exp([a])],[sci2exp([b])],[sci2exp([model.dstate[1-1],int(rand()*(10^7-1))])]]; + gr_i = []; + x = standard_define([3,2],model,exprs,gr_i); } RAND_m.prototype.details = function RAND_m() { } RAND_m.prototype.get = function RAND_m() { } RAND_m.prototype.set = function RAND_m() { -x=arg1; -graphics=arg1.graphics; -exprs=graphics.exprs; -model=arg1.model; -if (size(exprs,"*")==14) { -exprs[9-1]=[]; + x = arg1; + graphics = arg1.graphics; + exprs = graphics.exprs; + model = arg1.model; + if (size(exprs,"*")==14) { + exprs[9-1] = []; } -while (true) { -[ok,typ,flag,a,b,seed_c,exprs]=scicos_getvalue([["Set Random generator block parameters"],["flag = 0 : Uniform distribution A is min and A+B max"],["flag = 1 : Normal distribution A is mean and B deviation"],[" "],["A and B must be matrix with equal sizes"]],[["Datatype(1=real double 2=complex)"],["flag"],["A"],["B"],["SEED"]],list("vec",1,"vec",1,"mat",[-1,-2],"mat","[-1 -2]","mat",[1,2]),exprs); -if (!ok) { + while (true) { + [ok,typ,flag,a,b,seed_c,exprs] = scicos_getvalue([["Set Random generator block parameters"],["flag = 0 : Uniform distribution A is min and A+B max"],["flag = 1 : Normal distribution A is mean and B deviation"],[" "],["A and B must be matrix with equal sizes"]],[["Datatype(1=real double 2=complex)"],["flag"],["A"],["B"],["SEED"]],list("vec",1,"vec",1,"mat",[-1,-2],"mat","[-1 -2]","mat",[1,2]),exprs); + if (!ok) { break; } -if (flag!=0&&flag!=1) { + if (flag!=0&&flag!=1) { message("flag must be equal to 1 or 0"); -} else { -out=size(a); -if (typ==1) { -function_name="rndblk_m"; -model.rpar=[[real(a.slice())],[real(b.slice())]]; -model.dstate=[[seed_c[1-1]],[0*real(a.slice())]]; -ot=1; -} else if (typ==2) { -function_name="rndblkz_m"; -ot=2; -model.rpar=[[real(a.slice())],[imag(a.slice())],[real(b.slice())],[imag(b.slice())]]; -model.dstate=[[seed_c.slice()],[0*[[real(a.slice())],[imag(a.slice())]]]]; -} else { + } else { + out = size(a); + if (typ==1) { + function_name = "rndblk_m"; + model.rpar = [[real(a.slice())],[real(b.slice())]]; + model.dstate = [[seed_c[1-1]],[0*real(a.slice())]]; + ot = 1; + } else if (typ==2) { + function_name = "rndblkz_m"; + ot = 2; + model.rpar = [[real(a.slice())],[imag(a.slice())],[real(b.slice())],[imag(b.slice())]]; + model.dstate = [[seed_c.slice()],[0*[[real(a.slice())],[imag(a.slice())]]]]; + } else { message("Datatype is not supported"); -ok=false; + ok = false; } -if (ok) { -[model,graphics,ok]=set_io(model,graphics,list([],[]),list(out,ot),1,[]); -if (ok) { -model.sim=list(function_name,4); -graphics.exprs=exprs; -model.ipar=flag; -x.graphics=graphics; -x.model=model; + if (ok) { + [model,graphics,ok] = set_io(model,graphics,list([],[]),list(out,ot),1,[]); + if (ok) { + model.sim = list(function_name,4); + graphics.exprs = exprs; + model.ipar = flag; + x.graphics = graphics; + x.model = model; break; } } diff --git a/js/Sources/READAU_f.js b/js/Sources/READAU_f.js index 95ce25c3..5ff6df01 100644 --- a/js/Sources/READAU_f.js +++ b/js/Sources/READAU_f.js @@ -1,80 +1,80 @@ /* autogenerated from "macros/Sources/READAU_f.sci" */ function READAU_f() { READAU_f.prototype.define = function READAU_f() { -frmt="uc "; -fname="test.au"; -lunit=0; -N=20; -M=1; -tmask=[]; -swap=0; -offset=1; -outmask=1; -ievt=0; -nout=size(outmask,"*"); -model=scicos_model(); -model.sim=list("readau",2); -model.out=nout; -model.evtin=1; -model.dstate=[[1],[1],[lunit],[zeros(N*M,1)]]; -model.ipar=[[length(fname)],[this._str2code[frmt-1]],[ievt],[N],[M],[swap],[offset],[this._str2code[fname-1]],[tmask],[outmask]]; -model.blocktype="d"; -model.dep_ut=[false,false]; -exprs=[[fname],[string(N)],[string(swap)]]; -gr_i=[]; -x=standard_define([5,2],model,exprs,gr_i); + frmt = "uc "; + fname = "test.au"; + lunit = 0; + N = 20; + M = 1; + tmask = []; + swap = 0; + offset = 1; + outmask = 1; + ievt = 0; + nout = size(outmask,"*"); + model = scicos_model(); + model.sim = list("readau",2); + model.out = nout; + model.evtin = 1; + model.dstate = [[1],[1],[lunit],[zeros(N*M,1)]]; + model.ipar = [[length(fname)],[this._str2code[frmt-1]],[ievt],[N],[M],[swap],[offset],[this._str2code[fname-1]],[tmask],[outmask]]; + model.blocktype = "d"; + model.dep_ut = [false,false]; + exprs = [[fname],[string(N)],[string(swap)]]; + gr_i = []; + x = standard_define([5,2],model,exprs,gr_i); } READAU_f.prototype.details = function READAU_f() { } READAU_f.prototype.get = function READAU_f() { } READAU_f.prototype.set = function READAU_f() { -x=arg1; -graphics=arg1.graphics; -exprs=graphics.exprs; -model=arg1.model; -out=model.out; -dstate=model.dstate; -ipar=model.ipar; -imask=9+ipar[1-1]; -tmask=ipar[imask-1]; -lunit=dstate[3-1]; -fname=exprs[1-1]; -while (true) { -[ok,fname1,N,swap,exprs]=scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"READAU_f")],[" "],[gettext("(Read Audio File)")],[" "],[gettext("Read is done on a binary \'.au\' file")]],[[gettext("Input File Name")],[gettext("Buffer size")],[gettext("Swap Mode (0:No, 1:Yes)")]],list("str",1,"vec",1,"vec",1),exprs); -tmask1=[]; -outmask=1; -frmt1="uc"; -M=1; -offset=1; -if (!ok) { + x = arg1; + graphics = arg1.graphics; + exprs = graphics.exprs; + model = arg1.model; + out = model.out; + dstate = model.dstate; + ipar = model.ipar; + imask = 9+ipar[1-1]; + tmask = ipar[imask-1]; + lunit = dstate[3-1]; + fname = exprs[1-1]; + while (true) { + [ok,fname1,N,swap,exprs] = scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"READAU_f")],[" "],[gettext("(Read Audio File)")],[" "],[gettext("Read is done on a binary \'.au\' file")]],[[gettext("Input File Name")],[gettext("Buffer size")],[gettext("Swap Mode (0:No, 1:Yes)")]],list("str",1,"vec",1,"vec",1),exprs); + tmask1 = []; + outmask = 1; + frmt1 = "uc"; + M = 1; + offset = 1; + if (!ok) { break; } -fname1=stripblanks(fname1); -frmt1=stripblanks(frmt1); -if (this.alreadyran&&fname1!=fname) { + fname1 = stripblanks(fname1); + frmt1 = stripblanks(frmt1); + if (this.alreadyran&&fname1!=fname) { block_parameter_error(gettext("Simulation running !!! You cannot modify Input file name"),gettext("End current simulation first.")); -} else if (fname1=="") { + } else if (fname1=="") { block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter."),gettext("Input File Name")),gettext("You must provide a filename.")); -} else if (N<1) { + } else if (N<1) { block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Buffer size"),N),msprintf(gettext("Must be greater than %d."),1)); -} else if (this.alreadyran&&(N!=ipar[6-1])) { + } else if (this.alreadyran&&(N!=ipar[6-1])) { block_parameter_error(msprintf(gettext("You cannot modify \'%s\' when running."),gettext("Buffer Size")),gettext("End current simulation first.")); -} else if (swap!=0&&swap!=1) { + } else if (swap!=0&&swap!=1) { block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Swap Mode"),swap),msprintf(gettext("Must be in the interval %s."),"[0, 1]")); -} else { -[model,graphics,ok]=check_io(model,graphics,[],1,1,[]); -frmt1=part(frmt1,1,3); -if (ok) { -ipar=[[length(fname1)],[this._str2code[frmt1-1]],[0],[N],[M],[swap],[offset,this._str2code[fname1-1]],[tmask1,outmask.slice()]]; -if (prod(size(dstate))!=(N*M)+3) { -dstate=[[-1],[-1],[lunit],[zeros(N*M,1)]]; + } else { + [model,graphics,ok] = check_io(model,graphics,[],1,1,[]); + frmt1 = part(frmt1,1,3); + if (ok) { + ipar = [[length(fname1)],[this._str2code[frmt1-1]],[0],[N],[M],[swap],[offset,this._str2code[fname1-1]],[tmask1,outmask.slice()]]; + if (prod(size(dstate))!=(N*M)+3) { + dstate = [[-1],[-1],[lunit],[zeros(N*M,1)]]; } -model.dstate=dstate; -model.ipar=ipar; -graphics.exprs=exprs; -x.graphics=graphics; -x.model=model; + model.dstate = dstate; + model.ipar = ipar; + graphics.exprs = exprs; + x.graphics = graphics; + x.model = model; break; } } diff --git a/js/Sources/READC_f.js b/js/Sources/READC_f.js index 35f1168f..e97e0eb7 100644 --- a/js/Sources/READC_f.js +++ b/js/Sources/READC_f.js @@ -1,114 +1,114 @@ /* autogenerated from "macros/Sources/READC_f.sci" */ function READC_f() { READC_f.prototype.define = function READC_f() { -frmt="d "; -fname="foo"; -lunit=0; -N=20; -M=1; -rpar=[]; -tmask=0; -swap=0; -offset=1; -outmask=1; -ievt=0; -nout=size(outmask,"*"); -ipar=[[length(fname)],[this._str2code[frmt-1]],[ievt],[N],[M],[swap],[offset],[this._str2code[fname-1]],[tmask],[outmask]]; -model=scicos_model(); -model.sim=list("readc",2); -model.out=nout; -model.evtin=1; -model.evtout=[]; -model.dstate=[[1],[1],[lunit],[zeros(N*M,1)]]; -model.ipar=[[length(fname)],[this._str2code[frmt-1]],[ievt],[N],[M],[swap],[offset],[this._str2code[fname-1]],[tmask],[outmask]]; -model.blocktype="d"; -model.firing=-1; -model.dep_ut=[false,false]; -exprs=[["[]"],[sci2exp(outmask)],[fname],[frmt],[string(M)],[string(N)],[string(offset)],[string(swap)]]; -gr_i=[]; -x=standard_define([4,2],model,exprs,gr_i); + frmt = "d "; + fname = "foo"; + lunit = 0; + N = 20; + M = 1; + rpar = []; + tmask = 0; + swap = 0; + offset = 1; + outmask = 1; + ievt = 0; + nout = size(outmask,"*"); + ipar = [[length(fname)],[this._str2code[frmt-1]],[ievt],[N],[M],[swap],[offset],[this._str2code[fname-1]],[tmask],[outmask]]; + model = scicos_model(); + model.sim = list("readc",2); + model.out = nout; + model.evtin = 1; + model.evtout = []; + model.dstate = [[1],[1],[lunit],[zeros(N*M,1)]]; + model.ipar = [[length(fname)],[this._str2code[frmt-1]],[ievt],[N],[M],[swap],[offset],[this._str2code[fname-1]],[tmask],[outmask]]; + model.blocktype = "d"; + model.firing = -1; + model.dep_ut = [false,false]; + exprs = [["[]"],[sci2exp(outmask)],[fname],[frmt],[string(M)],[string(N)],[string(offset)],[string(swap)]]; + gr_i = []; + x = standard_define([4,2],model,exprs,gr_i); } READC_f.prototype.details = function READC_f() { } READC_f.prototype.get = function READC_f() { } READC_f.prototype.set = function READC_f() { -x=arg1; -model=x.model; -graphics=arg1.graphics; -exprs=graphics.exprs; -out=model.out; -dstate=model.dstate; -ipar=model.ipar; -imask=9+ipar[1-1]; -tmask=ipar[imask-1]; -lunit=dstate[3-1]; -fname=exprs[3-1]; -frmt=exprs[4-1]; -while (true) { -[ok,tmask1,outmask,fname1,frmt1,M,N,offset,swap,exprs]=scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"READC_f")],[" "],[gettext("Read from C binary file")]],[[gettext("Time Record Selection")],[gettext("Outputs Record Selection")],[gettext("Input File Name")],[gettext("Input Format")],[gettext("Record Size")],[gettext("Buffer Size")],[gettext("Initial Record Index")],[gettext("Swap Mode (0:No, 1:Yes)")]],list("vec",-1,"vec",-1,"str",1,"str",1,"vec",1,"vec",1,"vec",1,"vec",1),exprs); -if (!ok) { + x = arg1; + model = x.model; + graphics = arg1.graphics; + exprs = graphics.exprs; + out = model.out; + dstate = model.dstate; + ipar = model.ipar; + imask = 9+ipar[1-1]; + tmask = ipar[imask-1]; + lunit = dstate[3-1]; + fname = exprs[3-1]; + frmt = exprs[4-1]; + while (true) { + [ok,tmask1,outmask,fname1,frmt1,M,N,offset,swap,exprs] = scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"READC_f")],[" "],[gettext("Read from C binary file")]],[[gettext("Time Record Selection")],[gettext("Outputs Record Selection")],[gettext("Input File Name")],[gettext("Input Format")],[gettext("Record Size")],[gettext("Buffer Size")],[gettext("Initial Record Index")],[gettext("Swap Mode (0:No, 1:Yes)")]],list("vec",-1,"vec",-1,"str",1,"str",1,"vec",1,"vec",1,"vec",1,"vec",1),exprs); + if (!ok) { break; } -fname1=pathconvert(stripblanks(fname1),false,true); -frmt1=stripblanks(frmt1); -fmts=["s","l","d","f","c","us","ul","uc","ull","uls","ubl","ubs","dl","fl","ll","sl","db","fb","lb","sb"]; -nout=size(outmask,"*"); -if (prod(size(tmask1))>1) { + fname1 = pathconvert(stripblanks(fname1),false,true); + frmt1 = stripblanks(frmt1); + fmts = ["s","l","d","f","c","us","ul","uc","ull","uls","ubl","ubs","dl","fl","ll","sl","db","fb","lb","sb"]; + nout = size(outmask,"*"); + if (prod(size(tmask1))>1) { block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter."),gettext("Time Record Selection")),gettext("Must be a scalar or an empty matrix.")); -} else if (and(frmt1!=fmts)) { + } else if (and(frmt1!=fmts)) { block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %s."),gettext("Input Format"),frmt1),gettext("Valid formats are: "+strcat(fmts,", "))); -} else if (this.alreadyran&&fname1!=fname) { + } else if (this.alreadyran&&fname1!=fname) { block_parameter_error(msprintf(gettext("You cannot modify \'%s\' when running"),gettext("Input File Name")),gettext("End current simulation first.")); -} else if (N!=ipar[6-1]&&this.alreadyran) { + } else if (N!=ipar[6-1]&&this.alreadyran) { block_parameter_error(msprintf(gettext("You cannot modify \'%s\' when running."),gettext("Buffer Size")),gettext("End current simulation first")); -} else if (this.alreadyran&&size(tmask1)!=size(tmask)) { + } else if (this.alreadyran&&size(tmask1)!=size(tmask)) { block_parameter_error(msprintf(gettext("You cannot modify \'%s\' when running."),gettext("Time Record Selection")),gettext("End current simulation first.")); -} else if (fname1=="") { + } else if (fname1=="") { block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter."),gettext("Input File Name")),gettext("You must provide a file name.")); -} else if (M<1) { + } else if (M<1) { block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Record Size"),M),gettext("Strictly positive integer expected.")); -} else if (tmask1!=[]&&(tmask1<1||tmask1>M)) { + } else if (tmask1!=[]&&(tmask1<1||tmask1>M)) { block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Time Record Selection"),tmask1),msprintf(gettext("Must be in the interval %s."),gettext("[1, Record Size = ")+string(M)+"]")); -} else if (nout==0) { + } else if (nout==0) { block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Outputs Record Selection"),nout),gettext("Strictly positive integer expected.")); -} else if (nout>M) { + } else if (nout>M) { block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Outputs Record Selection"),nout),msprintf(gettext("Must be in the interval %s."),gettext("[1, Record Size = ")+string(M)+"]")); -} else if (max(outmask)>M||min(outmask)<1) { + } else if (max(outmask)>M||min(outmask)<1) { block_parameter_error(msprintf(gettext("Wrong value for indexes in \'%s\' parameter: %s."),gettext("Outputs Record Selection"),strcat(string(outmask.slice())," ")),msprintf(gettext("Must be in the interval %s."),gettext("[1, Record Size = ")+string(M)+"]")); -} else if (N<1) { + } else if (N<1) { block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Buffer Size"),N),gettext("Strictly positive integer expected.")); -} else if (swap!=0&&swap!=1) { + } else if (swap!=0&&swap!=1) { block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Swap Mode"),swap),msprintf(gettext("Must be in the interval %s."),"[0, 1]")); -} else if (offset<1) { + } else if (offset<1) { block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Initial Record Index"),offset),gettext("Strictly positive integer expected.")); -} else { -if (tmask1==[]) { -ievt=0; -tmask1=0; -outpt=[]; -} else { -ievt=1; -outpt=1; + } else { + if (tmask1==[]) { + ievt = 0; + tmask1 = 0; + outpt = []; + } else { + ievt = 1; + outpt = 1; } -out=size(outmask,"*"); -[model,graphics,ok]=check_io(model,graphics,[],out,1,outpt); -frmt1=part(frmt1,1,3); -if (ok) { -if (ievt==0) { -model.firing=-1; -} else { -model.firing=0; + out = size(outmask,"*"); + [model,graphics,ok] = check_io(model,graphics,[],out,1,outpt); + frmt1 = part(frmt1,1,3); + if (ok) { + if (ievt==0) { + model.firing = -1; + } else { + model.firing = 0; } -ipar=[[length(fname1)],[this._str2code[frmt1-1]],[ievt],[N],[M],[swap],[offset],[this._str2code[fname1-1]],[tmask1],[outmask.slice()]]; -if (prod(size(dstate))!=(N*M)+3) { -dstate=[[-1],[-1],[lunit],[zeros(N*M,1)]]; + ipar = [[length(fname1)],[this._str2code[frmt1-1]],[ievt],[N],[M],[swap],[offset],[this._str2code[fname1-1]],[tmask1],[outmask.slice()]]; + if (prod(size(dstate))!=(N*M)+3) { + dstate = [[-1],[-1],[lunit],[zeros(N*M,1)]]; } -model.dstate=dstate; -model.ipar=ipar; -graphics.exprs=exprs; -x.graphics=graphics; -x.model=model; + model.dstate = dstate; + model.ipar = ipar; + graphics.exprs = exprs; + x.graphics = graphics; + x.model = model; break; } } diff --git a/js/Sources/RFILE_f.js b/js/Sources/RFILE_f.js index b06b943e..7c4335b3 100644 --- a/js/Sources/RFILE_f.js +++ b/js/Sources/RFILE_f.js @@ -1,103 +1,103 @@ /* autogenerated from "macros/Sources/RFILE_f.sci" */ function RFILE_f() { RFILE_f.prototype.define = function RFILE_f() { -out=1; -nout=sum(out); -frmt="(7(e10.3,1x))"; -fname="foo"; -lunit=0; -N=2; -rpar=[]; -tmask=0; -outmask=1; -ipar=[[length(fname)],[length(frmt)],[0],[N],[this._str2code[fname-1]],[this._str2code[frmt-1]],[tmask],[outmask]]; -dstate=[[1],[1],[lunit],[zeros((nout)*N,1)]]; -model=scicos_model(); -model.sim="readf"; -model.out=nout; -model.evtin=1; -model.dstate=dstate; -model.ipar=[[length(fname)],[length(frmt)],[0],[N],[this._str2code[fname-1]],[this._str2code[frmt-1]],[tmask],[outmask]]; -model.blocktype="d"; -model.dep_ut=[false,false]; -exprs=[[sci2exp([])],[sci2exp(outmask)],[fname],[frmt],[string(N)],[sci2exp(out)]]; -gr_i=[]; -x=standard_define([3,2],model,exprs,gr_i); + out = 1; + nout = sum(out); + frmt = "(7(e10.3,1x))"; + fname = "foo"; + lunit = 0; + N = 2; + rpar = []; + tmask = 0; + outmask = 1; + ipar = [[length(fname)],[length(frmt)],[0],[N],[this._str2code[fname-1]],[this._str2code[frmt-1]],[tmask],[outmask]]; + dstate = [[1],[1],[lunit],[zeros((nout)*N,1)]]; + model = scicos_model(); + model.sim = "readf"; + model.out = nout; + model.evtin = 1; + model.dstate = dstate; + model.ipar = [[length(fname)],[length(frmt)],[0],[N],[this._str2code[fname-1]],[this._str2code[frmt-1]],[tmask],[outmask]]; + model.blocktype = "d"; + model.dep_ut = [false,false]; + exprs = [[sci2exp([])],[sci2exp(outmask)],[fname],[frmt],[string(N)],[sci2exp(out)]]; + gr_i = []; + x = standard_define([3,2],model,exprs,gr_i); } RFILE_f.prototype.details = function RFILE_f() { } RFILE_f.prototype.get = function RFILE_f() { } RFILE_f.prototype.set = function RFILE_f() { -x=arg1; -graphics=arg1.graphics; -exprs=graphics.exprs; -model=arg1.model; -dstate=model.dstate; -ipar=model.ipar; -ievt=ipar[3-1]; -N=ipar[4-1]; -imask=5+ipar[1-1]+ipar[2-1]; -tmask=ipar[imask-1]; -lunit=dstate[3-1]; -fname=exprs[3-1]; -frmt=exprs[4-1]; -if (size(exprs,"*")>5) { -exprs[6-1]=[]; + x = arg1; + graphics = arg1.graphics; + exprs = graphics.exprs; + model = arg1.model; + dstate = model.dstate; + ipar = model.ipar; + ievt = ipar[3-1]; + N = ipar[4-1]; + imask = 5+ipar[1-1]+ipar[2-1]; + tmask = ipar[imask-1]; + lunit = dstate[3-1]; + fname = exprs[3-1]; + frmt = exprs[4-1]; + if (size(exprs,"*")>5) { + exprs[6-1] = []; } -while (true) { -[ok,tmask1,outmask,fname1,frmt1,N,exprs]=scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"RFILE_f")],[" "],[gettext("Read from an input file")],[" "],[gettext("Read is done on:")],[gettext(" - A binary file if no format given")],[gettext(" - A formatted text file if a format (fortran type) is given")]],[[gettext("Time Record Selection")],[gettext("Outputs Record Selection")],[gettext("Input File Name")],[gettext("Input Format")],[gettext("Buffer Size")]],list("vec",-1,"vec",-1,"str",1,"str",1,"vec",1),exprs); -if (!ok) { + while (true) { + [ok,tmask1,outmask,fname1,frmt1,N,exprs] = scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"RFILE_f")],[" "],[gettext("Read from an input file")],[" "],[gettext("Read is done on:")],[gettext(" - A binary file if no format given")],[gettext(" - A formatted text file if a format (fortran type) is given")]],[[gettext("Time Record Selection")],[gettext("Outputs Record Selection")],[gettext("Input File Name")],[gettext("Input Format")],[gettext("Buffer Size")]],list("vec",-1,"vec",-1,"str",1,"str",1,"vec",1),exprs); + if (!ok) { break; } -fname1=pathconvert(stripblanks(fname1),false,true); -frmt1=stripblanks(frmt1); -nout=size(outmask,"*"); -if (prod(size(tmask1))>1) { + fname1 = pathconvert(stripblanks(fname1),false,true); + frmt1 = stripblanks(frmt1); + nout = size(outmask,"*"); + if (prod(size(tmask1))>1) { block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %s."),gettext("Time Record Selection"),strcat(string(tmask1.slice())," ")),gettext("Empty matrix or scalar expected.")); -} else if (tmask1!=[]&&tmask1<1) { + } else if (tmask1!=[]&&tmask1<1) { block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d"),gettext("Time Record Selection"),tmask1),gettext("Strictly positive integer expected.")); -} else if (lunit>0&&min(length(frmt),1)!=min(length(frmt1),1)) { + } else if (lunit>0&&min(length(frmt),1)!=min(length(frmt1),1)) { block_parameter_error([gettext("Simulation running !!! You cannot switch <br />between formatted and unformatted")],gettext("End current simulation first.")); -} else if (lunit>0&&fname1!=fname) { + } else if (lunit>0&&fname1!=fname) { block_parameter_error(gettext("Simulation running !!! You cannot modify \'Input File Name\'"),gettext("End current simulation first.")); -} else if (lunit>0&&size(tmask1)!=size(tmask)) { + } else if (lunit>0&&size(tmask1)!=size(tmask)) { block_parameter_error(gettext("Simulation running !!! You cannot modify \'Time Record Selection\'"),gettext("End current simulation first.")); -} else if (fname1=="") { + } else if (fname1=="") { block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %s"),gettext("Input File Name"),fname1),gettext("You must provide a filename.")); -} else if (frmt1!=""&&(part(frmt1,1)!="("||part(frmt1,length(frmt1))!=")")) { + } else if (frmt1!=""&&(part(frmt1,1)!="("||part(frmt1,length(frmt1))!=")")) { block_parameter_error(msprintf(gettext("Wrong format for \'%s\' parameter: %s."),gettext("Input Format"),frmt1),gettext("You must enclose the format\'s string between parentheses.")); -} else if (N<2) { + } else if (N<2) { block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Buffer Size"),N),gettext("Buffer size must be at least 2.")); -} else if (nout==0) { + } else if (nout==0) { block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Outputs Record Selection"),nout),gettext("You must read at least one field in record.")); -} else if (min(outmask)<1) { + } else if (min(outmask)<1) { block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %s"),gettext("Outputs Record Selection"),strcat(string(outmask.slice())," ")),gettext("Strictly positive indexes expected.")); -} else { -if (tmask1==[]) { -ievt=0; -cout=[]; -tmask1=0; -} else { -ievt=1; -cout=1; + } else { + if (tmask1==[]) { + ievt = 0; + cout = []; + tmask1 = 0; + } else { + ievt = 1; + cout = 1; } -[model,graphics,ok]=check_io(model,graphics,[],nout,1,cout); -if (ok) { -if (ievt==0) { -model.firing=[]; -} else { -model.firing=0; + [model,graphics,ok] = check_io(model,graphics,[],nout,1,cout); + if (ok) { + if (ievt==0) { + model.firing = []; + } else { + model.firing = 0; } -ipar=[[length(fname1)],[length(frmt1)],[ievt],[N],[this._str2code[fname1-1]],[this._str2code[frmt1-1]],[tmask1],[outmask.slice()]]; -if (prod(size(dstate))!=(nout+ievt)*N+3) { -dstate=[[-1],[-1],[lunit],[zeros((nout+ievt)*N,1)]]; + ipar = [[length(fname1)],[length(frmt1)],[ievt],[N],[this._str2code[fname1-1]],[this._str2code[frmt1-1]],[tmask1],[outmask.slice()]]; + if (prod(size(dstate))!=(nout+ievt)*N+3) { + dstate = [[-1],[-1],[lunit],[zeros((nout+ievt)*N,1)]]; } -model.dstate=dstate; -model.ipar=ipar; -graphics.exprs=exprs; -x.graphics=graphics; -x.model=model; + model.dstate = dstate; + model.ipar = ipar; + graphics.exprs = exprs; + x.graphics = graphics; + x.model = model; break; } } diff --git a/js/Sources/SAWTOOTH_f.js b/js/Sources/SAWTOOTH_f.js index 2494971a..27b5b214 100644 --- a/js/Sources/SAWTOOTH_f.js +++ b/js/Sources/SAWTOOTH_f.js @@ -1,22 +1,22 @@ /* autogenerated from "macros/Sources/SAWTOOTH_f.sci" */ function SAWTOOTH_f() { SAWTOOTH_f.prototype.define = function SAWTOOTH_f() { -model=scicos_model(); -model.sim="sawtth"; -model.out=1; -model.evtin=1; -model.dstate=0; -model.blocktype="c"; -model.dep_ut=[false,true]; -exprs=" "; -gr_i=[]; -x=standard_define([3,2],model,exprs,gr_i); + model = scicos_model(); + model.sim = "sawtth"; + model.out = 1; + model.evtin = 1; + model.dstate = 0; + model.blocktype = "c"; + model.dep_ut = [false,true]; + exprs = " "; + gr_i = []; + x = standard_define([3,2],model,exprs,gr_i); } SAWTOOTH_f.prototype.details = function SAWTOOTH_f() { } SAWTOOTH_f.prototype.get = function SAWTOOTH_f() { } SAWTOOTH_f.prototype.set = function SAWTOOTH_f() { -x=arg1; + x = arg1; } } diff --git a/js/Sources/STEP.js b/js/Sources/STEP.js index 009b7bda..14f1f03f 100644 --- a/js/Sources/STEP.js +++ b/js/Sources/STEP.js @@ -1,64 +1,64 @@ /* autogenerated from "macros/Sources/STEP.sci" */ function STEP() { STEP.prototype.define = function STEP() { -rpar=[[0],[1]]; -model=scicos_model(); -model.sim=list("step_func",4); -model.evtin=1; -model.evtout=1; -model.out=1; -model.out2=1; -model.outtyp=1; -model.firing=1; -model.rpar=rpar; -model.blocktype="c"; -model.dep_ut=[false,false]; -exprs=[[string(1)],[string(rpar)]]; -gr_i=[]; -x=standard_define([2,2],model,exprs,gr_i); + rpar = [[0],[1]]; + model = scicos_model(); + model.sim = list("step_func",4); + model.evtin = 1; + model.evtout = 1; + model.out = 1; + model.out2 = 1; + model.outtyp = 1; + model.firing = 1; + model.rpar = rpar; + model.blocktype = "c"; + model.dep_ut = [false,false]; + exprs = [[string(1)],[string(rpar)]]; + gr_i = []; + x = standard_define([2,2],model,exprs,gr_i); } STEP.prototype.details = function STEP() { } STEP.prototype.get = function STEP() { } STEP.prototype.set = function STEP() { -x=arg1; -graphics=arg1.graphics; -exprs=graphics.exprs; -model=arg1.model; -while (true) { -[ok,temps,in1,fi,exprs]=scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"STEP_FUNCTION")],[" "],[gettext("Step Function")],[" "]],[[gettext("Step Time")],[gettext("Initial Value")],[gettext("Final Value")]],list("vec",1,"vec",-1,"vec",-1),exprs); -if (!ok) { + x = arg1; + graphics = arg1.graphics; + exprs = graphics.exprs; + model = arg1.model; + while (true) { + [ok,temps,in1,fi,exprs] = scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"STEP_FUNCTION")],[" "],[gettext("Step Function")],[" "]],[[gettext("Step Time")],[gettext("Initial Value")],[gettext("Final Value")]],list("vec",1,"vec",-1,"vec",-1),exprs); + if (!ok) { break; } -in1=in1.slice(); -fi=fi.slice(); -if (size(in1,"*")!=size(fi,"*")) { -if (size(in1,"*")==1) { -in1=in1*ones(fi); -} else if (size(fi,"*")==1) { -fi=fi*ones(in1); -} else { + in1 = in1.slice(); + fi = fi.slice(); + if (size(in1,"*")!=size(fi,"*")) { + if (size(in1,"*")==1) { + in1 = in1*ones(fi); + } else if (size(fi,"*")==1) { + fi = fi*ones(in1); + } else { block_parameter_error(msprintf(gettext("\'Initial Value\' and \'Final Value\': incompatible sizes: %d and %d."),size(in1,"*"),size(fi,"*")),gettext("Same sizes expected.")); -ok=false; + ok = false; } } -if (ok) { -model.out2=1; -model.outtyp=1; -[model,graphics,ok]=check_io(model,graphics,[],size(fi,"*"),1,1); + if (ok) { + model.out2 = 1; + model.outtyp = 1; + [model,graphics,ok] = check_io(model,graphics,[],size(fi,"*"),1,1); } -if (ok) { -model.firing=temps; -if (temps==0) { -rpar=[[fi],[fi]]; -} else { -rpar=[[in1],[fi]]; + if (ok) { + model.firing = temps; + if (temps==0) { + rpar = [[fi],[fi]]; + } else { + rpar = [[in1],[fi]]; } -model.rpar=rpar; -graphics.exprs=exprs; -x.graphics=graphics; -x.model=model; + model.rpar = rpar; + graphics.exprs = exprs; + x.graphics = graphics; + x.model = model; break; } } diff --git a/js/Sources/STEP_FUNCTION.js b/js/Sources/STEP_FUNCTION.js index a417a68c..f1aee187 100644 --- a/js/Sources/STEP_FUNCTION.js +++ b/js/Sources/STEP_FUNCTION.js @@ -1,54 +1,54 @@ /* autogenerated from "macros/Sources/STEP_FUNCTION.sci" */ function STEP_FUNCTION() { STEP_FUNCTION.prototype.define = function STEP_FUNCTION() { -scs_m_1=scicos_diagram(); -scs_m_1.objs[1-1]=this.STEP["define"-1]; -scs_m_1.objs[2-1]=OUT_f("define"); -scs_m_1.objs[3-1]=scicos_link(); -scs_m_1.objs[4-1]=scicos_link(); -blk=scs_m_1.objs[1-1]; -graphics=blk.graphics; -model=blk.model; -graphics.orig=[0,0]; -graphics.sz=[40,40]; -graphics.pein=4; -graphics.peout=4; -graphics.pout=3; -blk.graphics=graphics; -blk.model=model; -scs_m_1.objs[1-1]=blk; -blk=scs_m_1.objs[2-1]; -graphics=blk.graphics; -model=blk.model; -graphics.orig=[80,10]; -graphics.sz=[20,20]; -graphics.exprs=["1"]; -model.ipar=1; -graphics.pin=3; -blk.graphics=graphics; -blk.model=model; -scs_m_1.objs[2-1]=blk; -lnk=scs_m_1.objs[3-1]; -lnk.from=[1,1,0]; -lnk.to=[2,1,1]; -scs_m_1.objs[3-1]=lnk; -lnk=scs_m_1.objs[4-1]; -lnk.xx=[0,20,-20,-20,20,1]; -lnk.yy=[0,-20,-20,60,60,1]; -lnk.ct=[5,-1]; -lnk.from=[1,1,0]; -lnk.to=[1,1,1]; -scs_m_1.objs[4-1]=lnk; + scs_m_1 = scicos_diagram(); + scs_m_1.objs[1-1] = this.STEP["define"-1]; + scs_m_1.objs[2-1] = OUT_f("define"); + scs_m_1.objs[3-1] = scicos_link(); + scs_m_1.objs[4-1] = scicos_link(); + blk = scs_m_1.objs[1-1]; + graphics = blk.graphics; + model = blk.model; + graphics.orig = [0,0]; + graphics.sz = [40,40]; + graphics.pein = 4; + graphics.peout = 4; + graphics.pout = 3; + blk.graphics = graphics; + blk.model = model; + scs_m_1.objs[1-1] = blk; + blk = scs_m_1.objs[2-1]; + graphics = blk.graphics; + model = blk.model; + graphics.orig = [80,10]; + graphics.sz = [20,20]; + graphics.exprs = ["1"]; + model.ipar = 1; + graphics.pin = 3; + blk.graphics = graphics; + blk.model = model; + scs_m_1.objs[2-1] = blk; + lnk = scs_m_1.objs[3-1]; + lnk.from = [1,1,0]; + lnk.to = [2,1,1]; + scs_m_1.objs[3-1] = lnk; + lnk = scs_m_1.objs[4-1]; + lnk.xx = [0,20,-20,-20,20,1]; + lnk.yy = [0,-20,-20,60,60,1]; + lnk.ct = [5,-1]; + lnk.from = [1,1,0]; + lnk.to = [1,1,1]; + scs_m_1.objs[4-1] = lnk; blk={}; lnk={}; -model=scicos_model(); -model.sim="csuper"; -model.out=1; -model.out2=1; -model.outtyp=1; -model.rpar=scs_m_1; -gr_i=[]; -x=standard_define([2,2],model,[],gr_i); + model = scicos_model(); + model.sim = "csuper"; + model.out = 1; + model.out2 = 1; + model.outtyp = 1; + model.rpar = scs_m_1; + gr_i = []; + x = standard_define([2,2],model,[],gr_i); } STEP_FUNCTION.prototype.details = function STEP_FUNCTION() { } @@ -56,67 +56,67 @@ x=standard_define([2,2],model,[],gr_i); } STEP_FUNCTION.prototype.set = function STEP_FUNCTION() { for (i=1;i<=length(arg1.model.rpar.objs);i+=1) { -o=arg1.model.rpar.objs[i-1]; -if (typeof(o)=="Block"&&o.gui=="STEP") { -ppath=list(i); + o = arg1.model.rpar.objs[i-1]; + if (typeof(o)=="Block"&&o.gui=="STEP") { + ppath = list(i); break; } } -newpar=list(); -for (path in ppath) { -np=size(path,"*"); -spath=list(); + newpar = list(); + 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]; + spath[$+1-1] = "model"; + spath[$+1-1] = "rpar"; + spath[$+1-1] = "objs"; + spath[$+1-1] = path[k-1]; } -xx=arg1[spath-1]; + xx = arg1[spath-1]; execstr("xxn="+xx.gui+"(\'set\',xx)"); -if (diffobjs(this.xxn,xx)) { -model=xx.model; -model_n=this.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.rpar,model_n.rpar)||!isequal(model.ipar,model_n.ipar)||!isequal(model.label,model_n.label); -if (or(model.in1!=model_n.in1)||or(model.out!=model_n.out)) { -needcompile=1; + if (diffobjs(this.xxn,xx)) { + model = xx.model; + model_n = this.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.rpar,model_n.rpar)||!isequal(model.ipar,model_n.ipar)||!isequal(model.label,model_n.label); + if (or(model.in1!=model_n.in1)||or(model.out!=model_n.out)) { + needcompile = 1; } -if (or(model.firing!=model_n.firing)) { -needcompile=2; + if (or(model.firing!=model_n.firing)) { + needcompile = 2; } -if (model.sim=="input"||model.sim=="output") { -if (model.ipar!=model_n.ipar) { -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 (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 ((model.nzcross!=model_n.nzcross)||(model.nmode!=model_n.nmode)) { + needcompile = 4; } -if (prod(size(model_n.sim))>1) { -if (model_n.sim[2-1]>1000) { -if (model.sim[1-1]!=model_n.sim[1-1]) { -needcompile=4; + if (prod(size(model_n.sim))>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; + } 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]=this.xxn; -newpar[size(newpar)+1-1]=path; + arg1[spath-1] = this.xxn; + newpar[size(newpar)+1-1] = path; } } -x=arg1; -y=needcompile; -typ=newpar; + x = arg1; + y = needcompile; + typ = newpar; } } diff --git a/js/Sources/SampleCLK.js b/js/Sources/SampleCLK.js index 3e7a81a7..9e372ede 100644 --- a/js/Sources/SampleCLK.js +++ b/js/Sources/SampleCLK.js @@ -1,49 +1,49 @@ /* autogenerated from "macros/Sources/SampleCLK.sci" */ function SampleCLK() { SampleCLK.prototype.define = function SampleCLK() { -model=scicos_model(); -model.sim="sampleclk"; -model.evtout=1; -model.rpar=[1,0]; -model.blocktype="d"; -model.firing=-1; -model.dep_ut=[false,false]; -exprs=[[sci2exp(1)],[sci2exp(0)]]; -x=standard_define([2,2],model,exprs," "); + model = scicos_model(); + model.sim = "sampleclk"; + model.evtout = 1; + model.rpar = [1,0]; + model.blocktype = "d"; + model.firing = -1; + model.dep_ut = [false,false]; + exprs = [[sci2exp(1)],[sci2exp(0)]]; + x = standard_define([2,2],model,exprs," "); } SampleCLK.prototype.details = function SampleCLK() { } SampleCLK.prototype.get = function SampleCLK() { } SampleCLK.prototype.set = function SampleCLK() { -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) { + 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; } -if (frequ<0) { + if (frequ<0) { message("Frequency must be a positif number"); -ok=false; + ok = false; } -if (abs(offset)>frequ) { + if (abs(offset)>frequ) { message("The |Offset| must be less than the Frequency"); -ok=false; + ok = false; } -if (ok) { -if (or(model.rpar.slice()!=[[frequ],[offset]])) { -needcompile=4; -y=needcompile; + if (ok) { + if (or(model.rpar.slice()!=[[frequ],[offset]])) { + needcompile = 4; + y = needcompile; } -model.rpar=[[frequ],[offset]]; -model.evtout=1; -model.firing=-1; -graphics.exprs=exprs; -x.graphics=graphics; -x.model=model; + model.rpar = [[frequ],[offset]]; + model.evtout = 1; + model.firing = -1; + graphics.exprs = exprs; + x.graphics = graphics; + x.model = model; break; } } diff --git a/js/Sources/Sigbuilder.js b/js/Sources/Sigbuilder.js index 47782cfb..910f1421 100644 --- a/js/Sources/Sigbuilder.js +++ b/js/Sources/Sigbuilder.js @@ -1,91 +1,91 @@ /* 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); + 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); + 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; + o = arg1.model.rpar.objs[i-1]; + if (typeof(o)=="Block"&&o.gui=="CURVE_c") { + ppath[1-1] = i; break; } } -newpar=list(); -this.y=0; -for (path in ppath) { -np=size(path,"*"); -spath=list(); + newpar = list(); + this.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]; + spath[$+1-1] = "model"; + spath[$+1-1] = "rpar"; + spath[$+1-1] = "objs"; + spath[$+1-1] = path[k-1]; } -xx=arg1[spath-1]; + xx = arg1[spath-1]; execstr("xxn="+xx.gui+"(\'set\',xx)"); -if (diffobjs(this.xxn,xx)) { -model=xx.model; -model_n=this.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 (diffobjs(this.xxn,xx)) { + model = xx.model; + model_n = this.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 (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 ((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 (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 (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 ((model.nzcross!=model_n.nzcross)||(model.nmode!=model_n.nmode)) { + needcompile = 4; } -if (prod(size(model_n.sim))>1) { -if (model_n.sim[2-1]>1000) { -if (model.sim[1-1]!=model_n.sim[1-1]) { -needcompile=4; + if (prod(size(model_n.sim))>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; + } 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]=this.xxn; -newpar[size(newpar)+1-1]=path; -this.y=max(this.y,needcompile); + arg1[spath-1] = this.xxn; + newpar[size(newpar)+1-1] = path; + this.y = max(this.y,needcompile); } } -x=arg1; -typ=newpar; + x = arg1; + typ = newpar; } } diff --git a/js/Sources/TIME_f.js b/js/Sources/TIME_f.js index e9dba55c..5c25b655 100644 --- a/js/Sources/TIME_f.js +++ b/js/Sources/TIME_f.js @@ -1,19 +1,19 @@ /* autogenerated from "macros/Sources/TIME_f.sci" */ function TIME_f() { TIME_f.prototype.define = function TIME_f() { -model=scicos_model(); -model.sim="timblk"; -model.out=1; -model.blocktype="c"; -model.dep_ut=[false,true]; -gr_i=[]; -x=standard_define([2,2],model,[],gr_i); + model = scicos_model(); + model.sim = "timblk"; + model.out = 1; + model.blocktype = "c"; + model.dep_ut = [false,true]; + gr_i = []; + x = standard_define([2,2],model,[],gr_i); } TIME_f.prototype.details = function TIME_f() { } TIME_f.prototype.get = function TIME_f() { } TIME_f.prototype.set = function TIME_f() { -x=arg1; + x = arg1; } } diff --git a/js/Sources/TKSCALE.js b/js/Sources/TKSCALE.js index 3a7f0070..82a2a369 100644 --- a/js/Sources/TKSCALE.js +++ b/js/Sources/TKSCALE.js @@ -1,35 +1,35 @@ /* autogenerated from "macros/Sources/TKSCALE.sci" */ function TKSCALE() { TKSCALE.prototype.define = function TKSCALE() { -a=-10; -b=10; -f=1; -model=scicos_model(); -model.sim=list("tkscaleblk",5); -model.out=1; -model.evtin=1; -model.rpar=[[a],[b],[f]]; -model.blocktype="d"; -model.dep_ut=[false,false]; -exprs=[[sci2exp(a)],[sci2exp(b)],[sci2exp(f)]]; -gr_i=[]; -x=standard_define([3,2],model,exprs,gr_i); + a = -10; + b = 10; + f = 1; + model = scicos_model(); + model.sim = list("tkscaleblk",5); + model.out = 1; + model.evtin = 1; + model.rpar = [[a],[b],[f]]; + model.blocktype = "d"; + model.dep_ut = [false,false]; + exprs = [[sci2exp(a)],[sci2exp(b)],[sci2exp(f)]]; + gr_i = []; + x = standard_define([3,2],model,exprs,gr_i); } TKSCALE.prototype.details = function TKSCALE() { } TKSCALE.prototype.get = function TKSCALE() { } TKSCALE.prototype.set = function TKSCALE() { -x=arg1; -graphics=arg1.graphics; -exprs=graphics.exprs; -model=arg1.model; -[ok,a,b,f,exprs]=scicos_getvalue("Set scale block parameters",[["Min value"],["Max value"],["Normalization"]],list("vec",1,"vec",1,"vec",1),exprs); -if (ok) { -graphics.exprs=exprs; -model.rpar=[[a],[b],[f]]; -x.graphics=graphics; -x.model=model; + x = arg1; + graphics = arg1.graphics; + exprs = graphics.exprs; + model = arg1.model; + [ok,a,b,f,exprs] = scicos_getvalue("Set scale block parameters",[["Min value"],["Max value"],["Normalization"]],list("vec",1,"vec",1,"vec",1),exprs); + if (ok) { + graphics.exprs = exprs; + model.rpar = [[a],[b],[f]]; + x.graphics = graphics; + x.model = model; } } } |