diff options
author | Sunil Shetye | 2018-06-25 18:20:39 +0530 |
---|---|---|
committer | Sunil Shetye | 2018-06-26 11:06:22 +0530 |
commit | 7465daea85285ba7f291b6bf6ddc45caa9e7ad65 (patch) | |
tree | e8e3e4dd60d469c290d55de15644ddbc1e013bc6 /js/Sources | |
parent | 7c70459c10aed0d74ee03896abaf47fefdbf7c8f (diff) | |
download | sci2js-7465daea85285ba7f291b6bf6ddc45caa9e7ad65.tar.gz sci2js-7465daea85285ba7f291b6bf6ddc45caa9e7ad65.tar.bz2 sci2js-7465daea85285ba7f291b6bf6ddc45caa9e7ad65.zip |
add spacing to end of block also
Diffstat (limited to 'js/Sources')
65 files changed, 1144 insertions, 1046 deletions
diff --git a/js/Sources/CLKINV_f.js b/js/Sources/CLKINV_f.js index eef5c718..9eb73a81 100644 --- a/js/Sources/CLKINV_f.js +++ b/js/Sources/CLKINV_f.js @@ -11,35 +11,36 @@ function CLKINV_f() { model.dep_ut = [false,false]; exprs = string(prt); gr_i = []; - x = standard_define([1,1],model,exprs,gr_i); + this.x = standard_define([1,1],model,exprs,gr_i); } CLKINV_f.prototype.details = function CLKINV_f() { + return this.x; } CLKINV_f.prototype.get = function CLKINV_f() { } CLKINV_f.prototype.set = function CLKINV_f() { - x = arg1; + this.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) { -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; -break; -} -} + [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) { + 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; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Sources/CLKINV_f.pickle b/js/Sources/CLKINV_f.pickle index 154645d8..0d1dde24 100644 --- a/js/Sources/CLKINV_f.pickle +++ b/js/Sources/CLKINV_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 .
\ No newline at end of file diff --git a/js/Sources/CLKIN_f.js b/js/Sources/CLKIN_f.js index 727e5422..f8cf6735 100644 --- a/js/Sources/CLKIN_f.js +++ b/js/Sources/CLKIN_f.js @@ -10,35 +10,36 @@ function CLKIN_f() { model.firing = -1; model.dep_ut = [false,false]; exprs = string(prt); - x = standard_define([1,1],model,exprs," "); + this.x = standard_define([1,1],model,exprs," "); } CLKIN_f.prototype.details = function CLKIN_f() { + return this.x; } CLKIN_f.prototype.get = function CLKIN_f() { } CLKIN_f.prototype.set = function CLKIN_f() { - x = arg1; + this.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) { -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; -break; -} -} + [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) { + message("Port number must be a positive integer"); + } else { + model.ipar = prt; + model.evtout = 1; + model.firing = -1; + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Sources/CLKIN_f.pickle b/js/Sources/CLKIN_f.pickle index 154645d8..0d1dde24 100644 --- a/js/Sources/CLKIN_f.pickle +++ b/js/Sources/CLKIN_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 .
\ No newline at end of file diff --git a/js/Sources/CLOCK_c.js b/js/Sources/CLOCK_c.js index 78b0f1e1..aac88f72 100644 --- a/js/Sources/CLOCK_c.js +++ b/js/Sources/CLOCK_c.js @@ -29,30 +29,31 @@ function CLOCK_c() { 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; + this.x = scicos_block(); + this.x.gui = "CLOCK_c"; + this.x.graphics.sz = [2,2]; + this.x.graphics.gr_i = gr_i; + this.x.graphics.peout = 0; + this.x.model.sim = "csuper"; + this.x.model.evtout = 1; + this.x.model.blocktype = "h"; + this.x.model.firing = false; + this.x.model.dep_ut = [false,false]; + this.x.model.rpar = diagram; } CLOCK_c.prototype.details = function CLOCK_c() { + return this.x; } CLOCK_c.prototype.get = function CLOCK_c() { } CLOCK_c.prototype.set = function CLOCK_c() { -for (i=1;i<=length(arg1.model.rpar.objs);i+=1) { - o = arg1.model.rpar.objs[i-1]; - if (typeof(o)=="Block"&&o.gui=="EVTDLY_c") { - path = i; -break; -} -} + 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; + break; + } + } newpar = list(); xx = arg1.model.rpar.objs[path-1]; exprs = xx.graphics.exprs; @@ -61,32 +62,32 @@ break; 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) { -block_parameter_error(msprintf(gettext("Wrong values for \'%s\' parameter: %5.1e."),gettext("Period"),dt),gettext("Strictly positive number expected.")); - 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; -break; -} -} + [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) { + block_parameter_error(msprintf(gettext("Wrong values for \'%s\' parameter: %5.1e."),gettext("Period"),dt),gettext("Strictly positive number expected.")); + 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; + break; + } + } if (!and([t0_old,dt_old]==[t0,dt])) { - newpar[size(newpar)+1-1] = path; -} + newpar[size(newpar)+1-1] = path; + } if (t0_old!=t0) { - needcompile = 2; + needcompile = 2; } else { - needcompile = 0; -} - x = arg1; + needcompile = 0; + } + this.x = arg1; y = needcompile; typ = newpar; } diff --git a/js/Sources/CLOCK_c.pickle b/js/Sources/CLOCK_c.pickle index 50891984..2287bb36 100644 --- a/js/Sources/CLOCK_c.pickle +++ b/js/Sources/CLOCK_c.pickle @@ -2,8 +2,10 @@ c__builtin__ set p0 ((lp1 -S'EVTDLY_c' +S'x' p2 -atp3 -Rp4 +aS'EVTDLY_c' +p3 +atp4 +Rp5 .
\ No newline at end of file diff --git a/js/Sources/CLOCK_f.js b/js/Sources/CLOCK_f.js index 2ddee5fe..ddfcd81b 100644 --- a/js/Sources/CLOCK_f.js +++ b/js/Sources/CLOCK_f.js @@ -29,30 +29,31 @@ function CLOCK_f() { 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; + this.x = scicos_block(); + this.x.gui = "CLOCK_f"; + this.x.graphics.sz = [2,2]; + this.x.graphics.gr_i = gr_i; + this.x.graphics.peout = 0; + this.x.model.sim = "csuper"; + this.x.model.evtout = 1; + this.x.model.blocktype = "h"; + this.x.model.firing = false; + this.x.model.dep_ut = [false,false]; + this.x.model.rpar = diagram; } CLOCK_f.prototype.details = function CLOCK_f() { + return this.x; } CLOCK_f.prototype.get = function CLOCK_f() { } CLOCK_f.prototype.set = function CLOCK_f() { -for (i=1;i<=length(arg1.model.rpar.objs);i+=1) { - o = arg1.model.rpar.objs[i-1]; - if (typeof(o)=="Block"&&o.gui=="EVTDLY_f") { - path = i; -break; -} -} + 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; + break; + } + } newpar = list(); xx = arg1.model.rpar.objs[path-1]; exprs = xx.graphics.exprs; @@ -61,32 +62,32 @@ break; 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) { -message("period must be positive"); - ok = false; -} - if (ok) { - xx.graphics.exprs = exprs0; - model.rpar = dt; - model.firing = t0; - xx.model = model; - arg1.model.rpar.objs[path-1] = xx; -break; -} -} + [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) { + message("period must be positive"); + ok = false; + } + 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; -} + newpar[size(newpar)+1-1] = path; + } if (t0_old!=t0) { - needcompile = 2; + needcompile = 2; } else { - needcompile = 0; -} - x = arg1; + needcompile = 0; + } + this.x = arg1; y = needcompile; typ = newpar; } diff --git a/js/Sources/CLOCK_f.pickle b/js/Sources/CLOCK_f.pickle index 154645d8..0d1dde24 100644 --- a/js/Sources/CLOCK_f.pickle +++ b/js/Sources/CLOCK_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 .
\ No newline at end of file diff --git a/js/Sources/CONST.js b/js/Sources/CONST.js index d96bad1c..509e6271 100644 --- a/js/Sources/CONST.js +++ b/js/Sources/CONST.js @@ -11,36 +11,37 @@ function CONST() { model.dep_ut = [false,false]; exprs = strcat(sci2exp(C)); gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } CONST.prototype.details = function CONST() { + return this.x; } CONST.prototype.get = function CONST() { } CONST.prototype.set = function CONST() { - x = arg1; + this.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) { -message("C must have at least one element"); - } 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; -break; -} -} + [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) { + message("C must have at least one element"); + } 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; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Sources/CONST.pickle b/js/Sources/CONST.pickle index 154645d8..0d1dde24 100644 --- a/js/Sources/CONST.pickle +++ b/js/Sources/CONST.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 .
\ No newline at end of file diff --git a/js/Sources/CONST_f.js b/js/Sources/CONST_f.js index ee7d7566..8753b046 100644 --- a/js/Sources/CONST_f.js +++ b/js/Sources/CONST_f.js @@ -11,33 +11,34 @@ function CONST_f() { model.dep_ut = [false,false]; exprs = strcat(sci2exp(C)); gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } CONST_f.prototype.details = function CONST_f() { + return this.x; } CONST_f.prototype.get = function CONST_f() { } CONST_f.prototype.set = function CONST_f() { - x = arg1; + this.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) { -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; -break; -} -} + [ok,C,exprs] = scicos_getvalue(["Set Contant Block"],"Constant",list("vec",-1),exprs); + if (!ok) { + break; + } + 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; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Sources/CONST_f.pickle b/js/Sources/CONST_f.pickle index 154645d8..0d1dde24 100644 --- a/js/Sources/CONST_f.pickle +++ b/js/Sources/CONST_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 .
\ No newline at end of file diff --git a/js/Sources/CONST_m.js b/js/Sources/CONST_m.js index 471e09ff..ac1e84ce 100644 --- a/js/Sources/CONST_m.js +++ b/js/Sources/CONST_m.js @@ -14,59 +14,60 @@ function CONST_m() { model.dep_ut = [false,false]; exprs = sci2exp(C); gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } CONST_m.prototype.details = function CONST_m() { + return this.x; } CONST_m.prototype.get = function CONST_m() { } CONST_m.prototype.set = function CONST_m() { - x = arg1; + this.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)!=[]) { -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 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; -} - 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; -} -} -} + [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)!=[]) { + 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 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; + } + if (ok) { + model.rpar = []; + [model,graphics,ok] = set_io(model,graphics,list(),list(nout,ot),[],[]); + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } + } } } diff --git a/js/Sources/CONST_m.pickle b/js/Sources/CONST_m.pickle index 0ac03d7f..54a16ece 100644 --- a/js/Sources/CONST_m.pickle +++ b/js/Sources/CONST_m.pickle @@ -2,8 +2,10 @@ c__builtin__ set p0 ((lp1 -S'type' +S'x' p2 -atp3 -Rp4 +aS'type' +p3 +atp4 +Rp5 .
\ No newline at end of file diff --git a/js/Sources/CURVE_c.pickle b/js/Sources/CURVE_c.pickle index 8cef5b52..b1c7cff9 100644 --- a/js/Sources/CURVE_c.pickle +++ b/js/Sources/CURVE_c.pickle @@ -12,8 +12,10 @@ aS'argn' p5 aS'xy' p6 -aS'curwin' +aS'x' p7 -atp8 -Rp9 +aS'curwin' +p8 +atp9 +Rp10 .
\ No newline at end of file diff --git a/js/Sources/CURV_f.js b/js/Sources/CURV_f.js index f9f00cb5..cd6199a9 100644 --- a/js/Sources/CURV_f.js +++ b/js/Sources/CURV_f.js @@ -16,14 +16,15 @@ function CURV_f() { model.blocktype = "c"; model.dep_ut = [false,true]; gr_i = []; - x = standard_define([2,2],model,[],gr_i); + this.x = standard_define([2,2],model,[],gr_i); } CURV_f.prototype.details = function CURV_f() { + return this.x; } CURV_f.prototype.get = function CURV_f() { } CURV_f.prototype.set = function CURV_f() { - x = arg1; + this.x = arg1; model = arg1.model; graphics = arg1.graphics; rpar = model.rpar; @@ -33,31 +34,31 @@ function CURV_f() { 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 (!ok) { -break; -} - 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; -} - 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; -} -} + [ln,fun]=where() + if (!or(fun=="do_eval")) { + [xx,yy,ok,gc] = edit_curv(xx,yy,"axy",[" "," "," "],gc); + } else { + ok = true; + } + if (!ok) { + break; + } + 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; + } + 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()]]; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Sources/CURV_f.pickle b/js/Sources/CURV_f.pickle index 154645d8..0d1dde24 100644 --- a/js/Sources/CURV_f.pickle +++ b/js/Sources/CURV_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 .
\ No newline at end of file diff --git a/js/Sources/Counter.js b/js/Sources/Counter.js index cfd0dccd..5e768e00 100644 --- a/js/Sources/Counter.js +++ b/js/Sources/Counter.js @@ -15,36 +15,37 @@ function Counter() { model.dep_ut = [false,false]; exprs = [[string(minim)],[string(maxim)],[string(rule)]]; gr_i = []; - x = standard_define([3,2],model,exprs,gr_i); + this.x = standard_define([3,2],model,exprs,gr_i); } Counter.prototype.details = function Counter() { + return this.x; } Counter.prototype.get = function Counter() { } Counter.prototype.set = function Counter() { - x = arg1; + this.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) { -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)) { -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; -break; -} -} + [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) { + 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)) { + 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]]; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Sources/Counter.pickle b/js/Sources/Counter.pickle index 154645d8..0d1dde24 100644 --- a/js/Sources/Counter.pickle +++ b/js/Sources/Counter.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 .
\ No newline at end of file diff --git a/js/Sources/FROMWSB.js b/js/Sources/FROMWSB.js index 9f716376..e47d854c 100644 --- a/js/Sources/FROMWSB.js +++ b/js/Sources/FROMWSB.js @@ -8,79 +8,80 @@ function FROMWSB() { 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); + this.x = standard_define([5,2],model,[],gr_i); } FROMWSB.prototype.details = function FROMWSB() { + return this.x; } FROMWSB.prototype.get = function FROMWSB() { } 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); -break; -} -} + 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); + break; + } + } newpar = list(); y = 0; for (path in ppath) { - np = size(path,"*"); - spath = list(); -for (k=1;k<=np;k+=1) { - spath[$+1-1] = "model"; - spath[$+1-1] = "rpar"; - spath[$+1-1] = "objs"; - spath[$+1-1] = path[k-1]; -} - xx = arg1[spath-1]; -execstr("xxn="+xx.gui+"(\'set\',xx)"); - if (!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 ((size(model.in1,"*")!=size(model_n.in1,"*"))||(size(model.out,"*")!=size(model_n.out,"*"))) { - needcompile = 4; -} - if (model.sim=="input"||model.sim=="output") { - if (model.ipar!=model_n.ipar) { - needcompile = 4; -} -} - if (or(model.blocktype!=model_n.blocktype)||or(model.dep_ut!=model_n.dep_ut)) { - needcompile = 4; -} - if ((model.nzcross!=model_n.nzcross)||(model.nmode!=model_n.nmode)) { - needcompile = 4; -} - if (prod(size(model_n.sim))>1) { - if (model_n.sim[2-1]>1000) { - if (model.sim[1-1]!=model_n.sim[1-1]) { - needcompile = 4; -} -} -} - } else { - modified = or(model_n!=model); - eq = model.equations; - eqn = model_n.equations; - if (or(eq.model!=eqn.model)||or(eq.inputs!=eqn.inputs)||or(eq.outputs!=eqn.outputs)) { - needcompile = 4; -} -} - arg1[spath-1] = this.xxn; - newpar[size(newpar)+1-1] = path; - y = max(y,needcompile); -} -} - x = arg1; + np = size(path,"*"); + spath = list(); + for (k=1;k<=np;k+=1) { + spath[$+1-1] = "model"; + spath[$+1-1] = "rpar"; + spath[$+1-1] = "objs"; + spath[$+1-1] = path[k-1]; + } + xx = arg1[spath-1]; + execstr("xxn="+xx.gui+"(\'set\',xx)"); + if (!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 ((size(model.in1,"*")!=size(model_n.in1,"*"))||(size(model.out,"*")!=size(model_n.out,"*"))) { + needcompile = 4; + } + if (model.sim=="input"||model.sim=="output") { + if (model.ipar!=model_n.ipar) { + needcompile = 4; + } + } + if (or(model.blocktype!=model_n.blocktype)||or(model.dep_ut!=model_n.dep_ut)) { + needcompile = 4; + } + if ((model.nzcross!=model_n.nzcross)||(model.nmode!=model_n.nmode)) { + needcompile = 4; + } + if (prod(size(model_n.sim))>1) { + if (model_n.sim[2-1]>1000) { + if (model.sim[1-1]!=model_n.sim[1-1]) { + needcompile = 4; + } + } + } + } else { + modified = or(model_n!=model); + eq = model.equations; + eqn = model_n.equations; + if (or(eq.model!=eqn.model)||or(eq.inputs!=eqn.inputs)||or(eq.outputs!=eqn.outputs)) { + needcompile = 4; + } + } + arg1[spath-1] = this.xxn; + newpar[size(newpar)+1-1] = path; + y = max(y,needcompile); + } + } + this.x = arg1; typ = newpar; } } diff --git a/js/Sources/FROMWSB.pickle b/js/Sources/FROMWSB.pickle index 794658bf..dd4ce05f 100644 --- a/js/Sources/FROMWSB.pickle +++ b/js/Sources/FROMWSB.pickle @@ -2,10 +2,12 @@ c__builtin__ set p0 ((lp1 -S'xxn' +S'x' p2 -aS'isequalbitwise' +aS'xxn' p3 -atp4 -Rp5 +aS'isequalbitwise' +p4 +atp5 +Rp6 .
\ No newline at end of file diff --git a/js/Sources/FROMWS_c.js b/js/Sources/FROMWS_c.js index 88ce7821..1b5fa3f0 100644 --- a/js/Sources/FROMWS_c.js +++ b/js/Sources/FROMWS_c.js @@ -18,50 +18,51 @@ function FROMWS_c() { 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); + this.x = standard_define([3.5,2],model,exprs,gr_i); } FROMWS_c.prototype.details = function FROMWS_c() { + return this.x; } FROMWS_c.prototype.get = function FROMWS_c() { } FROMWS_c.prototype.set = function FROMWS_c() { - x = arg1; + this.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)) { -message("Interpolation method should be chosen in [0,1,2,3]"); - ok = false; -} - if (!(ZC==0||ZC==1)) { -message("Zero crossing should be either 0 or 1"); - ok = false; -} - if (!(OutEnd==0||OutEnd==1||OutEnd==2)) { -message("Output at end option should be either 0 or 1"); - ok = false; -} - r = false; - ierr = execstr("r=validvar(varnam)","errcatch"); - if (!r) { -message([["Invalid variable name."],["Please choose another variable name."]]); - 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; -break; -} -} -} + [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)) { + message("Interpolation method should be chosen in [0,1,2,3]"); + ok = false; + } + if (!(ZC==0||ZC==1)) { + message("Zero crossing should be either 0 or 1"); + ok = false; + } + if (!(OutEnd==0||OutEnd==1||OutEnd==2)) { + message("Output at end option should be either 0 or 1"); + ok = false; + } + r = false; + ierr = execstr("r=validvar(varnam)","errcatch"); + if (!r) { + message([["Invalid variable name."],["Please choose another variable name."]]); + 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; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } + } } } diff --git a/js/Sources/FROMWS_c.pickle b/js/Sources/FROMWS_c.pickle index 3efc5bbe..bcacb8ca 100644 --- a/js/Sources/FROMWS_c.pickle +++ b/js/Sources/FROMWS_c.pickle @@ -4,6 +4,8 @@ p0 ((lp1 S'_str2code' p2 -atp3 -Rp4 +aS'x' +p3 +atp4 +Rp5 .
\ No newline at end of file diff --git a/js/Sources/GENSIN_f.js b/js/Sources/GENSIN_f.js index bab92c8c..801a5a30 100644 --- a/js/Sources/GENSIN_f.js +++ b/js/Sources/GENSIN_f.js @@ -13,36 +13,37 @@ function GENSIN_f() { 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); + this.x = standard_define([3,2],model,exprs,gr_i); } GENSIN_f.prototype.details = function GENSIN_f() { + return this.x; } GENSIN_f.prototype.get = function GENSIN_f() { } GENSIN_f.prototype.set = function GENSIN_f() { - x = arg1; + this.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) { -block_parameter_error(msprintf(gettext("Wrong value for \'Frequency\' parameter: %e."),F),gettext("Strictly positive integer expected.")); - 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; -break; -} -} + [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) { + block_parameter_error(msprintf(gettext("Wrong value for \'Frequency\' parameter: %e."),F),gettext("Strictly positive integer expected.")); + 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; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Sources/GENSIN_f.pickle b/js/Sources/GENSIN_f.pickle index 154645d8..0d1dde24 100644 --- a/js/Sources/GENSIN_f.pickle +++ b/js/Sources/GENSIN_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 .
\ No newline at end of file diff --git a/js/Sources/GENSQR_f.js b/js/Sources/GENSQR_f.js index 5d7dc200..c052eba7 100644 --- a/js/Sources/GENSQR_f.js +++ b/js/Sources/GENSQR_f.js @@ -13,32 +13,33 @@ function GENSQR_f() { model.dep_ut = [false,false]; exprs = string(Amplitude); gr_i = []; - x = standard_define([3,2],model,exprs,gr_i); + this.x = standard_define([3,2],model,exprs,gr_i); } GENSQR_f.prototype.details = function GENSQR_f() { + return this.x; } GENSQR_f.prototype.get = function GENSQR_f() { } GENSQR_f.prototype.set = function GENSQR_f() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; if (size(exprs,"*")==2) { - exprs = exprs[2-1]; -} + exprs = exprs[2-1]; + } 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; -break; -} + [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; + this.x.graphics = graphics; + this.x.model = model; + break; + } } } diff --git a/js/Sources/GENSQR_f.pickle b/js/Sources/GENSQR_f.pickle index 154645d8..0d1dde24 100644 --- a/js/Sources/GENSQR_f.pickle +++ b/js/Sources/GENSQR_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 .
\ No newline at end of file diff --git a/js/Sources/GEN_SQR.js b/js/Sources/GEN_SQR.js index 212d5ab4..4565cb48 100644 --- a/js/Sources/GEN_SQR.js +++ b/js/Sources/GEN_SQR.js @@ -47,9 +47,10 @@ function GEN_SQR() { F = 1; exprs = [sci2exp(Amin),sci2exp(Amax),sci2exp(rule),sci2exp(F)]; gr_i = []; - x = standard_define([3,2],model,exprs,gr_i); + this.x = standard_define([3,2],model,exprs,gr_i); } GEN_SQR.prototype.details = function GEN_SQR() { + return this.x; } GEN_SQR.prototype.get = function GEN_SQR() { } @@ -64,28 +65,28 @@ function GEN_SQR() { 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; + this.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; -break; -} - } else { -message(lasterror()); - ok = false; -} -} + [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 = this.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); + this.x.graphics.exprs = exprs; + this.x.model.rpar = sblock; + break; + } + } else { + message(lasterror()); + ok = false; + } + } } } diff --git a/js/Sources/GEN_SQR.pickle b/js/Sources/GEN_SQR.pickle index 1922e519..2a35c6de 100644 --- a/js/Sources/GEN_SQR.pickle +++ b/js/Sources/GEN_SQR.pickle @@ -4,6 +4,8 @@ p0 ((lp1 S'needcompile' p2 -atp3 -Rp4 +aS'x' +p3 +atp4 +Rp5 .
\ No newline at end of file diff --git a/js/Sources/Ground_g.js b/js/Sources/Ground_g.js index 2a20d38d..f70f4de8 100644 --- a/js/Sources/Ground_g.js +++ b/js/Sources/Ground_g.js @@ -15,13 +15,14 @@ function Ground_g() { model.dep_ut = [false,false]; exprs = []; gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } Ground_g.prototype.details = function Ground_g() { + return this.x; } Ground_g.prototype.get = function Ground_g() { } Ground_g.prototype.set = function Ground_g() { - x = arg1; + this.x = arg1; } } diff --git a/js/Sources/Ground_g.pickle b/js/Sources/Ground_g.pickle index 154645d8..0d1dde24 100644 --- a/js/Sources/Ground_g.pickle +++ b/js/Sources/Ground_g.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 .
\ No newline at end of file diff --git a/js/Sources/INIMPL_f.js b/js/Sources/INIMPL_f.js index f2075b5c..39a8fc91 100644 --- a/js/Sources/INIMPL_f.js +++ b/js/Sources/INIMPL_f.js @@ -15,40 +15,41 @@ function INIMPL_f() { prt = 1; exprs = "1"; gr_i = []; - x = standard_define([1,1],model,exprs,gr_i); - x.graphics.out_implicit = ["I"]; + this.x = standard_define([1,1],model,exprs,gr_i); + this.x.graphics.out_implicit = ["I"]; } INIMPL_f.prototype.details = function INIMPL_f() { + return this.x; } INIMPL_f.prototype.get = function INIMPL_f() { } INIMPL_f.prototype.set = function INIMPL_f() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; if (size(exprs,"*")==2) { - exprs = exprs[1-1]; -} + 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) { -break; -} - 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; -} - model.ipar = prt; - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} + [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) { + 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; + } + model.ipar = prt; + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Sources/INIMPL_f.pickle b/js/Sources/INIMPL_f.pickle index 154645d8..0d1dde24 100644 --- a/js/Sources/INIMPL_f.pickle +++ b/js/Sources/INIMPL_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 .
\ No newline at end of file diff --git a/js/Sources/IN_f.js b/js/Sources/IN_f.js index d5d41983..b5d4fc06 100644 --- a/js/Sources/IN_f.js +++ b/js/Sources/IN_f.js @@ -12,50 +12,51 @@ function IN_f() { model.dep_ut = [false,false]; exprs = sci2exp(prt); gr_i = []; - x = standard_define([1,1],model,exprs,gr_i); + this.x = standard_define([1,1],model,exprs,gr_i); } IN_f.prototype.details = function IN_f() { + return this.x; } IN_f.prototype.get = function IN_f() { } IN_f.prototype.set = function IN_f() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; model = arg1.model; exprs = graphics.exprs; if (size(exprs,"*")==2) { - exprs = exprs[1-1]; -} + exprs = exprs[1-1]; + } if (size(exprs,"*")==1) { - exprs = [[exprs[1-1]],["[-1 -2]"],["-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) { -break; -} - prt = int(prt); - if (prt<=0) { -message(_("Port number must be a positive integer")); - } else if (!isequal(size(otsz,"*"),2)) { -message(_("Outport Size must be a 2 elements vector")); - } 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; -} - 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; -} -} + [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) { + message(_("Port number must be a positive integer")); + } else if (!isequal(size(otsz,"*"),2)) { + message(_("Outport Size must be a 2 elements vector")); + } 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; + } + model.ipar = prt; + model.firing = []; + model.out = otsz[1-1]; + model.out2 = otsz[2-1]; + model.outtyp = ot; + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Sources/IN_f.pickle b/js/Sources/IN_f.pickle index 154645d8..0d1dde24 100644 --- a/js/Sources/IN_f.pickle +++ b/js/Sources/IN_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 .
\ No newline at end of file diff --git a/js/Sources/Modulo_Count.js b/js/Sources/Modulo_Count.js index 03482970..c10e7f51 100644 --- a/js/Sources/Modulo_Count.js +++ b/js/Sources/Modulo_Count.js @@ -13,36 +13,37 @@ function Modulo_Count() { model.dep_ut = [false,false]; exprs = [[string(ini_c)],[string(base)]]; gr_i = []; - x = standard_define([3,2],model,exprs,gr_i); + this.x = standard_define([3,2],model,exprs,gr_i); } Modulo_Count.prototype.details = function Modulo_Count() { + return this.x; } Modulo_Count.prototype.get = function Modulo_Count() { } Modulo_Count.prototype.set = function Modulo_Count() { - x = arg1; + this.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) { -block_parameter_error(msprintf(gettext("Wrong value for \'Initial State\' parameter: %d."),ini_c),gettext("Null or positive integer expected.")); - } 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; -break; -} -} + [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) { + block_parameter_error(msprintf(gettext("Wrong value for \'Initial State\' parameter: %d."),ini_c),gettext("Null or positive integer expected.")); + } 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; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Sources/Modulo_Count.pickle b/js/Sources/Modulo_Count.pickle index 154645d8..0d1dde24 100644 --- a/js/Sources/Modulo_Count.pickle +++ b/js/Sources/Modulo_Count.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 .
\ No newline at end of file diff --git a/js/Sources/PULSE_SC.js b/js/Sources/PULSE_SC.js index 00dd65d2..51ca49a5 100644 --- a/js/Sources/PULSE_SC.js +++ b/js/Sources/PULSE_SC.js @@ -42,9 +42,10 @@ function PULSE_SC() { A = 1; exprs = [sci2exp(E),sci2exp(W),sci2exp(F),sci2exp(A)]; gr_i = []; - x = standard_define([3,2],model,exprs,gr_i); + this.x = standard_define([3,2],model,exprs,gr_i); } PULSE_SC.prototype.details = function PULSE_SC() { + return this.x; } PULSE_SC.prototype.get = function PULSE_SC() { } @@ -59,30 +60,30 @@ function PULSE_SC() { 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; + this.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; -break; -} - } else { - if ((lasterror()!=[])) { -messagebox(lasterror()); -} - ok = false; -} -} + [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 = this.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); + this.x.graphics.exprs = exprs; + this.x.model.rpar = sblock; + break; + } + } else { + if ((lasterror()!=[])) { + messagebox(lasterror()); + } + ok = false; + } + } } } diff --git a/js/Sources/PULSE_SC.pickle b/js/Sources/PULSE_SC.pickle index 1922e519..2a35c6de 100644 --- a/js/Sources/PULSE_SC.pickle +++ b/js/Sources/PULSE_SC.pickle @@ -4,6 +4,8 @@ p0 ((lp1 S'needcompile' p2 -atp3 -Rp4 +aS'x' +p3 +atp4 +Rp5 .
\ No newline at end of file diff --git a/js/Sources/RAMP.js b/js/Sources/RAMP.js index add6822e..7453d2d0 100644 --- a/js/Sources/RAMP.js +++ b/js/Sources/RAMP.js @@ -16,31 +16,32 @@ function RAMP() { model.dep_ut = [false,true]; exprs = [string(rpar)]; gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } RAMP.prototype.details = function RAMP() { + return this.x; } RAMP.prototype.get = function RAMP() { } RAMP.prototype.set = function RAMP() { - x = arg1; + this.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) { -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; -break; -} -} + [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) { + 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; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Sources/RAMP.pickle b/js/Sources/RAMP.pickle index 154645d8..0d1dde24 100644 --- a/js/Sources/RAMP.pickle +++ b/js/Sources/RAMP.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 .
\ No newline at end of file diff --git a/js/Sources/RAND_f.js b/js/Sources/RAND_f.js index 1302b020..901c2e9d 100644 --- a/js/Sources/RAND_f.js +++ b/js/Sources/RAND_f.js @@ -17,41 +17,42 @@ function RAND_f() { 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); + this.x = standard_define([3,2],model,exprs,gr_i); } RAND_f.prototype.details = function RAND_f() { + return this.x; } RAND_f.prototype.get = function RAND_f() { } RAND_f.prototype.set = function RAND_f() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; if (size(exprs,"*")==5) { - exprs = exprs.slice(1-1,3); -} + exprs = exprs.slice(1-1,3); + } if (size(exprs,"*")==3) { - exprs = [[exprs],[string(model.dstate[1-1])]]; -} + 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) { -break; -} - 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; -break; -} -} + [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) { + 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()]]; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Sources/RAND_f.pickle b/js/Sources/RAND_f.pickle index 154645d8..0d1dde24 100644 --- a/js/Sources/RAND_f.pickle +++ b/js/Sources/RAND_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 .
\ No newline at end of file diff --git a/js/Sources/RAND_m.js b/js/Sources/RAND_m.js index ab7e919f..5c6a35fd 100644 --- a/js/Sources/RAND_m.js +++ b/js/Sources/RAND_m.js @@ -26,55 +26,56 @@ function RAND_m() { 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); + this.x = standard_define([3,2],model,exprs,gr_i); } RAND_m.prototype.details = function RAND_m() { + return this.x; } RAND_m.prototype.get = function RAND_m() { } RAND_m.prototype.set = function RAND_m() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; if (size(exprs,"*")==14) { - exprs[9-1] = []; -} + 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) { -break; -} - 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 { -message("Datatype is not supported"); - 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; -break; -} -} -} -} + [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) { + 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 { + message("Datatype is not supported"); + 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; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } + } + } } } diff --git a/js/Sources/RAND_m.pickle b/js/Sources/RAND_m.pickle index 154645d8..0d1dde24 100644 --- a/js/Sources/RAND_m.pickle +++ b/js/Sources/RAND_m.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 .
\ No newline at end of file diff --git a/js/Sources/READAU_f.js b/js/Sources/READAU_f.js index 5ff6df01..009a3b0e 100644 --- a/js/Sources/READAU_f.js +++ b/js/Sources/READAU_f.js @@ -22,14 +22,15 @@ function READAU_f() { model.dep_ut = [false,false]; exprs = [[fname],[string(N)],[string(swap)]]; gr_i = []; - x = standard_define([5,2],model,exprs,gr_i); + this.x = standard_define([5,2],model,exprs,gr_i); } READAU_f.prototype.details = function READAU_f() { + return this.x; } READAU_f.prototype.get = function READAU_f() { } READAU_f.prototype.set = function READAU_f() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; @@ -41,43 +42,43 @@ function READAU_f() { 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) { -block_parameter_error(gettext("Simulation running !!! You cannot modify Input file name"),gettext("End current simulation first.")); - } 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) { -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])) { -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) { -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)]]; -} - model.dstate = dstate; - model.ipar = ipar; - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} -} + [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) { + block_parameter_error(gettext("Simulation running !!! You cannot modify Input file name"),gettext("End current simulation first.")); + } 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) { + 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])) { + 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) { + 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)]]; + } + model.dstate = dstate; + model.ipar = ipar; + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } + } } } diff --git a/js/Sources/READAU_f.pickle b/js/Sources/READAU_f.pickle index 62a7fafc..8a32035f 100644 --- a/js/Sources/READAU_f.pickle +++ b/js/Sources/READAU_f.pickle @@ -4,8 +4,10 @@ p0 ((lp1 S'_str2code' p2 -aS'alreadyran' +aS'x' p3 -atp4 -Rp5 +aS'alreadyran' +p4 +atp5 +Rp6 .
\ No newline at end of file diff --git a/js/Sources/READC_f.js b/js/Sources/READC_f.js index e97e0eb7..7e6bc5e1 100644 --- a/js/Sources/READC_f.js +++ b/js/Sources/READC_f.js @@ -26,15 +26,16 @@ function READC_f() { 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); + this.x = standard_define([4,2],model,exprs,gr_i); } READC_f.prototype.details = function READC_f() { + return this.x; } READC_f.prototype.get = function READC_f() { } READC_f.prototype.set = function READC_f() { - x = arg1; - model = x.model; + this.x = arg1; + model = this.x.model; graphics = arg1.graphics; exprs = graphics.exprs; out = model.out; @@ -46,72 +47,72 @@ function READC_f() { 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) { -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)) { -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) { -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) { -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)) { -block_parameter_error(msprintf(gettext("You cannot modify \'%s\' when running."),gettext("Time Record Selection")),gettext("End current simulation first.")); - } 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) { -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)) { -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) { -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) { -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) { -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) { -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) { -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) { -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; -} - 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)]]; -} - model.dstate = dstate; - model.ipar = ipar; - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} -} + [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) { + 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)) { + 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) { + 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) { + 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)) { + block_parameter_error(msprintf(gettext("You cannot modify \'%s\' when running."),gettext("Time Record Selection")),gettext("End current simulation first.")); + } 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) { + 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)) { + 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) { + 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) { + 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) { + 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) { + 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) { + 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) { + 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; + } + 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)]]; + } + model.dstate = dstate; + model.ipar = ipar; + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } + } } } diff --git a/js/Sources/READC_f.pickle b/js/Sources/READC_f.pickle index 62a7fafc..8a32035f 100644 --- a/js/Sources/READC_f.pickle +++ b/js/Sources/READC_f.pickle @@ -4,8 +4,10 @@ p0 ((lp1 S'_str2code' p2 -aS'alreadyran' +aS'x' p3 -atp4 -Rp5 +aS'alreadyran' +p4 +atp5 +Rp6 .
\ No newline at end of file diff --git a/js/Sources/RFILE_f.js b/js/Sources/RFILE_f.js index 7c4335b3..3038948d 100644 --- a/js/Sources/RFILE_f.js +++ b/js/Sources/RFILE_f.js @@ -22,14 +22,15 @@ function RFILE_f() { 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); + this.x = standard_define([3,2],model,exprs,gr_i); } RFILE_f.prototype.details = function RFILE_f() { + return this.x; } RFILE_f.prototype.get = function RFILE_f() { } RFILE_f.prototype.set = function RFILE_f() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; @@ -43,64 +44,64 @@ function RFILE_f() { fname = exprs[3-1]; frmt = exprs[4-1]; if (size(exprs,"*")>5) { - exprs[6-1] = []; -} + 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) { -break; -} - 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) { -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)) { -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) { -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)) { -block_parameter_error(gettext("Simulation running !!! You cannot modify \'Time Record Selection\'"),gettext("End current simulation first.")); - } 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))!=")")) { -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) { -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) { -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) { -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; -} - [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)]]; -} - model.dstate = dstate; - model.ipar = ipar; - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} -} + [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) { + 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) { + 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)) { + 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) { + 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)) { + block_parameter_error(gettext("Simulation running !!! You cannot modify \'Time Record Selection\'"),gettext("End current simulation first.")); + } 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))!=")")) { + 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) { + 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) { + 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) { + 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; + } + [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)]]; + } + model.dstate = dstate; + model.ipar = ipar; + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } + } } } diff --git a/js/Sources/RFILE_f.pickle b/js/Sources/RFILE_f.pickle index 3efc5bbe..bcacb8ca 100644 --- a/js/Sources/RFILE_f.pickle +++ b/js/Sources/RFILE_f.pickle @@ -4,6 +4,8 @@ p0 ((lp1 S'_str2code' p2 -atp3 -Rp4 +aS'x' +p3 +atp4 +Rp5 .
\ No newline at end of file diff --git a/js/Sources/SAWTOOTH_f.js b/js/Sources/SAWTOOTH_f.js index 27b5b214..40ab391a 100644 --- a/js/Sources/SAWTOOTH_f.js +++ b/js/Sources/SAWTOOTH_f.js @@ -10,13 +10,14 @@ function SAWTOOTH_f() { model.dep_ut = [false,true]; exprs = " "; gr_i = []; - x = standard_define([3,2],model,exprs,gr_i); + this.x = standard_define([3,2],model,exprs,gr_i); } SAWTOOTH_f.prototype.details = function SAWTOOTH_f() { + return this.x; } SAWTOOTH_f.prototype.get = function SAWTOOTH_f() { } SAWTOOTH_f.prototype.set = function SAWTOOTH_f() { - x = arg1; + this.x = arg1; } } diff --git a/js/Sources/SAWTOOTH_f.pickle b/js/Sources/SAWTOOTH_f.pickle index 154645d8..0d1dde24 100644 --- a/js/Sources/SAWTOOTH_f.pickle +++ b/js/Sources/SAWTOOTH_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 .
\ No newline at end of file diff --git a/js/Sources/STEP.js b/js/Sources/STEP.js index 14f1f03f..e2f455e6 100644 --- a/js/Sources/STEP.js +++ b/js/Sources/STEP.js @@ -15,52 +15,53 @@ function STEP() { model.dep_ut = [false,false]; exprs = [[string(1)],[string(rpar)]]; gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } STEP.prototype.details = function STEP() { + return this.x; } STEP.prototype.get = function STEP() { } STEP.prototype.set = function STEP() { - x = arg1; + this.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 { -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; -} -} - 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]]; -} - model.rpar = rpar; - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} + [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 { + 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; + } + } + 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]]; + } + model.rpar = rpar; + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Sources/STEP.pickle b/js/Sources/STEP.pickle index 154645d8..0d1dde24 100644 --- a/js/Sources/STEP.pickle +++ b/js/Sources/STEP.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 .
\ No newline at end of file diff --git a/js/Sources/STEP_FUNCTION.js b/js/Sources/STEP_FUNCTION.js index f1aee187..9b2fe9f8 100644 --- a/js/Sources/STEP_FUNCTION.js +++ b/js/Sources/STEP_FUNCTION.js @@ -39,8 +39,8 @@ function STEP_FUNCTION() { lnk.from = [1,1,0]; lnk.to = [1,1,1]; scs_m_1.objs[4-1] = lnk; -blk={}; -lnk={}; + blk={}; + lnk={}; model = scicos_model(); model.sim = "csuper"; model.out = 1; @@ -48,74 +48,75 @@ lnk={}; model.outtyp = 1; model.rpar = scs_m_1; gr_i = []; - x = standard_define([2,2],model,[],gr_i); + this.x = standard_define([2,2],model,[],gr_i); } STEP_FUNCTION.prototype.details = function STEP_FUNCTION() { + return this.x; } STEP_FUNCTION.prototype.get = function STEP_FUNCTION() { } 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); -break; -} -} + 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); + break; + } + } 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]; -} - 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 (or(model.firing!=model_n.firing)) { - needcompile = 2; -} - if (model.sim=="input"||model.sim=="output") { - if (model.ipar!=model_n.ipar) { - needcompile = 4; -} -} - if (or(model.blocktype!=model_n.blocktype)||or(model.dep_ut!=model_n.dep_ut)) { - needcompile = 4; -} - if ((model.nzcross!=model_n.nzcross)||(model.nmode!=model_n.nmode)) { - needcompile = 4; -} - if (prod(size(model_n.sim))>1) { - if (model_n.sim[2-1]>1000) { - if (model.sim[1-1]!=model_n.sim[1-1]) { - needcompile = 4; -} -} -} - } else { - modified = or(model_n!=model); - eq = model.equations; - eqn = model_n.equations; - if (or(eq.model!=eqn.model)||or(eq.inputs!=eqn.inputs)||or(eq.outputs!=eqn.outputs)) { - needcompile = 4; -} -} - arg1[spath-1] = this.xxn; - newpar[size(newpar)+1-1] = path; -} -} - x = arg1; + np = size(path,"*"); + spath = list(); + for (k=1;k<=np;k+=1) { + spath[$+1-1] = "model"; + spath[$+1-1] = "rpar"; + spath[$+1-1] = "objs"; + spath[$+1-1] = path[k-1]; + } + xx = arg1[spath-1]; + execstr("xxn="+xx.gui+"(\'set\',xx)"); + if (diffobjs(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 (model.sim=="input"||model.sim=="output") { + if (model.ipar!=model_n.ipar) { + needcompile = 4; + } + } + if (or(model.blocktype!=model_n.blocktype)||or(model.dep_ut!=model_n.dep_ut)) { + needcompile = 4; + } + if ((model.nzcross!=model_n.nzcross)||(model.nmode!=model_n.nmode)) { + needcompile = 4; + } + if (prod(size(model_n.sim))>1) { + if (model_n.sim[2-1]>1000) { + if (model.sim[1-1]!=model_n.sim[1-1]) { + needcompile = 4; + } + } + } + } else { + modified = or(model_n!=model); + eq = model.equations; + eqn = model_n.equations; + if (or(eq.model!=eqn.model)||or(eq.inputs!=eqn.inputs)||or(eq.outputs!=eqn.outputs)) { + needcompile = 4; + } + } + arg1[spath-1] = this.xxn; + newpar[size(newpar)+1-1] = path; + } + } + this.x = arg1; y = needcompile; typ = newpar; } diff --git a/js/Sources/STEP_FUNCTION.pickle b/js/Sources/STEP_FUNCTION.pickle index 8ecebb29..85e1e424 100644 --- a/js/Sources/STEP_FUNCTION.pickle +++ b/js/Sources/STEP_FUNCTION.pickle @@ -2,10 +2,12 @@ c__builtin__ set p0 ((lp1 -S'STEP' +S'x' p2 -aS'xxn' +aS'STEP' p3 -atp4 -Rp5 +aS'xxn' +p4 +atp5 +Rp6 .
\ No newline at end of file diff --git a/js/Sources/SampleCLK.js b/js/Sources/SampleCLK.js index 9e372ede..72175267 100644 --- a/js/Sources/SampleCLK.js +++ b/js/Sources/SampleCLK.js @@ -9,44 +9,45 @@ function SampleCLK() { model.firing = -1; model.dep_ut = [false,false]; exprs = [[sci2exp(1)],[sci2exp(0)]]; - x = standard_define([2,2],model,exprs," "); + this.x = standard_define([2,2],model,exprs," "); } SampleCLK.prototype.details = function SampleCLK() { + return this.x; } SampleCLK.prototype.get = function SampleCLK() { } SampleCLK.prototype.set = function SampleCLK() { - x = arg1; + this.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) { -message("Frequency must be a positif number"); - ok = false; -} - if (abs(offset)>frequ) { -message("The |Offset| must be less than the Frequency"); - ok = false; -} - 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; -break; -} -} -needcompile=resume(needcompile) + [ok,frequ,offset,exprs] = scicos_getvalue("Set block parameters",[["Sample time"],["Offset"]],list("vec",1,"vec",1),exprs); + if (!ok) { + break; + } + if (frequ<0) { + message("Frequency must be a positif number"); + ok = false; + } + if (abs(offset)>frequ) { + message("The |Offset| must be less than the Frequency"); + ok = false; + } + 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; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } + needcompile=resume(needcompile) } } diff --git a/js/Sources/SampleCLK.pickle b/js/Sources/SampleCLK.pickle index 154645d8..0d1dde24 100644 --- a/js/Sources/SampleCLK.pickle +++ b/js/Sources/SampleCLK.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 .
\ No newline at end of file diff --git a/js/Sources/Sigbuilder.js b/js/Sources/Sigbuilder.js index 910f1421..f27189ff 100644 --- a/js/Sources/Sigbuilder.js +++ b/js/Sources/Sigbuilder.js @@ -12,80 +12,81 @@ function Sigbuilder() { 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); + this.x = standard_define([3,2],model,[],gr_i); } Sigbuilder.prototype.details = function Sigbuilder() { + return this.x; } Sigbuilder.prototype.get = function Sigbuilder() { } Sigbuilder.prototype.set = function Sigbuilder() { ppath = list(0); -for (i=1;i<=length(arg1.model.rpar.objs);i+=1) { - o = arg1.model.rpar.objs[i-1]; - if (typeof(o)=="Block"&&o.gui=="CURVE_c") { - ppath[1-1] = i; -break; -} -} + for (i=1;i<=length(arg1.model.rpar.objs);i+=1) { + o = arg1.model.rpar.objs[i-1]; + if (typeof(o)=="Block"&&o.gui=="CURVE_c") { + ppath[1-1] = i; + break; + } + } newpar = list(); 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]; -} - 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 (or(model.firing!=model_n.firing)) { - needcompile = 2; -} - if ((size(model.in1,"*")!=size(model_n.in1,"*"))||(size(model.out,"*")!=size(model_n.out,"*"))) { - needcompile = 4; -} - if (model.sim=="input"||model.sim=="output") { - if (model.ipar!=model_n.ipar) { - needcompile = 4; -} -} - if (or(model.blocktype!=model_n.blocktype)||or(model.dep_ut!=model_n.dep_ut)) { - needcompile = 4; -} - if ((model.nzcross!=model_n.nzcross)||(model.nmode!=model_n.nmode)) { - needcompile = 4; -} - if (prod(size(model_n.sim))>1) { - if (model_n.sim[2-1]>1000) { - if (model.sim[1-1]!=model_n.sim[1-1]) { - needcompile = 4; -} -} -} - } else { - modified = or(model_n!=model); - eq = model.equations; - eqn = model_n.equations; - if (or(eq.model!=eqn.model)||or(eq.inputs!=eqn.inputs)||or(eq.outputs!=eqn.outputs)) { - needcompile = 4; -} -} - arg1[spath-1] = this.xxn; - newpar[size(newpar)+1-1] = path; - this.y = max(this.y,needcompile); -} -} - x = arg1; + np = size(path,"*"); + spath = list(); + for (k=1;k<=np;k+=1) { + spath[$+1-1] = "model"; + spath[$+1-1] = "rpar"; + spath[$+1-1] = "objs"; + spath[$+1-1] = path[k-1]; + } + xx = arg1[spath-1]; + execstr("xxn="+xx.gui+"(\'set\',xx)"); + if (diffobjs(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 ((size(model.in1,"*")!=size(model_n.in1,"*"))||(size(model.out,"*")!=size(model_n.out,"*"))) { + needcompile = 4; + } + if (model.sim=="input"||model.sim=="output") { + if (model.ipar!=model_n.ipar) { + needcompile = 4; + } + } + if (or(model.blocktype!=model_n.blocktype)||or(model.dep_ut!=model_n.dep_ut)) { + needcompile = 4; + } + if ((model.nzcross!=model_n.nzcross)||(model.nmode!=model_n.nmode)) { + needcompile = 4; + } + if (prod(size(model_n.sim))>1) { + if (model_n.sim[2-1]>1000) { + if (model.sim[1-1]!=model_n.sim[1-1]) { + needcompile = 4; + } + } + } + } else { + modified = or(model_n!=model); + eq = model.equations; + eqn = model_n.equations; + if (or(eq.model!=eqn.model)||or(eq.inputs!=eqn.inputs)||or(eq.outputs!=eqn.outputs)) { + needcompile = 4; + } + } + arg1[spath-1] = this.xxn; + newpar[size(newpar)+1-1] = path; + this.y = max(this.y,needcompile); + } + } + this.x = arg1; typ = newpar; } } diff --git a/js/Sources/Sigbuilder.pickle b/js/Sources/Sigbuilder.pickle index 52400405..2fef70c1 100644 --- a/js/Sources/Sigbuilder.pickle +++ b/js/Sources/Sigbuilder.pickle @@ -2,16 +2,18 @@ c__builtin__ set p0 ((lp1 -S'y' +S'xxn' p2 -aS'order' +aS'y' p3 -aS'ORDER2' +aS'x' p4 -aS'xxn' -p5 aS'N' +p5 +aS'ORDER2' p6 -atp7 -Rp8 +aS'order' +p7 +atp8 +Rp9 .
\ No newline at end of file diff --git a/js/Sources/TIME_f.js b/js/Sources/TIME_f.js index 5c25b655..2c9f1ced 100644 --- a/js/Sources/TIME_f.js +++ b/js/Sources/TIME_f.js @@ -7,13 +7,14 @@ function TIME_f() { model.blocktype = "c"; model.dep_ut = [false,true]; gr_i = []; - x = standard_define([2,2],model,[],gr_i); + this.x = standard_define([2,2],model,[],gr_i); } TIME_f.prototype.details = function TIME_f() { + return this.x; } TIME_f.prototype.get = function TIME_f() { } TIME_f.prototype.set = function TIME_f() { - x = arg1; + this.x = arg1; } } diff --git a/js/Sources/TIME_f.pickle b/js/Sources/TIME_f.pickle index 154645d8..0d1dde24 100644 --- a/js/Sources/TIME_f.pickle +++ b/js/Sources/TIME_f.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 .
\ No newline at end of file diff --git a/js/Sources/TKSCALE.js b/js/Sources/TKSCALE.js index 82a2a369..6e4b9522 100644 --- a/js/Sources/TKSCALE.js +++ b/js/Sources/TKSCALE.js @@ -13,23 +13,24 @@ function TKSCALE() { model.dep_ut = [false,false]; exprs = [[sci2exp(a)],[sci2exp(b)],[sci2exp(f)]]; gr_i = []; - x = standard_define([3,2],model,exprs,gr_i); + this.x = standard_define([3,2],model,exprs,gr_i); } TKSCALE.prototype.details = function TKSCALE() { + return this.x; } TKSCALE.prototype.get = function TKSCALE() { } TKSCALE.prototype.set = function TKSCALE() { - x = arg1; + this.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; -} + graphics.exprs = exprs; + model.rpar = [[a],[b],[f]]; + this.x.graphics = graphics; + this.x.model = model; + } } } diff --git a/js/Sources/TKSCALE.pickle b/js/Sources/TKSCALE.pickle index 154645d8..0d1dde24 100644 --- a/js/Sources/TKSCALE.pickle +++ b/js/Sources/TKSCALE.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 .
\ No newline at end of file |