diff options
Diffstat (limited to 'js/Sinks')
42 files changed, 1053 insertions, 990 deletions
diff --git a/js/Sinks/AFFICH_m.js b/js/Sinks/AFFICH_m.js index b55ea10a..ac794b2f 100644 --- a/js/Sinks/AFFICH_m.js +++ b/js/Sinks/AFFICH_m.js @@ -20,61 +20,62 @@ function AFFICH_m() { model.label = ""; exprs = [[sci2exp([model.in1,model.in2])],[string(font)],[string(fontsize)],[string(colr)],[string(nt)],[string(nd)],[string(0)]]; gr_i = []; - x = standard_define([3,2],model,exprs,gr_i); + this.x = standard_define([3,2],model,exprs,gr_i); } AFFICH_m.prototype.details = function AFFICH_m() { + return this.x; } AFFICH_m.prototype.get = function AFFICH_m() { } AFFICH_m.prototype.set = function AFFICH_m() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,in1,font,fontsize,colr,nt,nd,herit,exprs] = scicos_getvalue("Set parameters",[["Input Size","Font number"],["Font size"],["Color"],["Total number of digits"],["Number of rational part digits"],["Block inherits (1) or not (0)"]],list("mat",[1,2],"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1),exprs); - if (!ok) { -break; -} - mess = []; - if (font<=0) { - mess = [[mess],["Font number must be positive"],[" "]]; - ok = false; -} - if (fontsize<=0) { - mess = [[mess],["Font size must be positive"],[" "]]; - ok = false; -} - if (nt<=3) { - mess = [[mess],["Total number of digits must be greater than 3"],[" "]]; - ok = false; -} - if (nd<0) { - mess = [[mess],["Number of rational part digits must be ","greater or equal 0"],[" "]]; - ok = false; -} - if (!ok) { -message([["Some specified values are inconsistent:"],[" "],[mess]]); -} - if (!or(herit==[0,1])) { - mess = [[mess],["Accept inherited values are 0 and 1"],[" "]]; - ok = false; -} - if (!ok) { -message([["Some specified values are inconsistent:"],[" "],[mess]]); -} - if (ok) { - [model,graphics,ok] = set_io(model,graphics,list(in1,1),list(),ones(1-herit,1),[]); -} - if (ok) { - model.ipar = [[font],[fontsize],[colr],[nt],[nd],[in1[1-1][1-1]]]; - model.dstate = [[-1],[0],[0],[1],[1],[0],[zeros(in1[1-1][1-1]*in1[1-1][2-1],1)]]; - model.evtin = ones(1-herit,1); - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,in1,font,fontsize,colr,nt,nd,herit,exprs] = scicos_getvalue("Set parameters",[["Input Size","Font number"],["Font size"],["Color"],["Total number of digits"],["Number of rational part digits"],["Block inherits (1) or not (0)"]],list("mat",[1,2],"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1),exprs); + if (!ok) { + break; + } + mess = []; + if (font<=0) { + mess = [[mess],["Font number must be positive"],[" "]]; + ok = false; + } + if (fontsize<=0) { + mess = [[mess],["Font size must be positive"],[" "]]; + ok = false; + } + if (nt<=3) { + mess = [[mess],["Total number of digits must be greater than 3"],[" "]]; + ok = false; + } + if (nd<0) { + mess = [[mess],["Number of rational part digits must be ","greater or equal 0"],[" "]]; + ok = false; + } + if (!ok) { + message([["Some specified values are inconsistent:"],[" "],[mess]]); + } + if (!or(herit==[0,1])) { + mess = [[mess],["Accept inherited values are 0 and 1"],[" "]]; + ok = false; + } + if (!ok) { + message([["Some specified values are inconsistent:"],[" "],[mess]]); + } + if (ok) { + [model,graphics,ok] = set_io(model,graphics,list(in1,1),list(),ones(1-herit,1),[]); + } + if (ok) { + model.ipar = [[font],[fontsize],[colr],[nt],[nd],[in1[1-1][1-1]]]; + model.dstate = [[-1],[0],[0],[1],[1],[0],[zeros(in1[1-1][1-1]*in1[1-1][2-1],1)]]; + model.evtin = ones(1-herit,1); + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Sinks/AFFICH_m.pickle b/js/Sinks/AFFICH_m.pickle index 154645d8..0d1dde24 100644 --- a/js/Sinks/AFFICH_m.pickle +++ b/js/Sinks/AFFICH_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/Sinks/BARXY.js b/js/Sinks/BARXY.js index 3cdddd4d..e1845489 100644 --- a/js/Sinks/BARXY.js +++ b/js/Sinks/BARXY.js @@ -15,48 +15,49 @@ function BARXY() { model.evtin = [1]; model.rpar = [[xmin],[xmax],[ymin],[ymax]]; model.ipar = 1; - x = standard_define([2,2],model,[],[]); - x.graphics.in_implicit = ["E","E"]; - x.graphics.out_implicit = []; - x.graphics.exprs = [["-15"],["15"],["-15"],["15"],["1"]]; + this.x = standard_define([2,2],model,[],[]); + this.x.graphics.in_implicit = ["E","E"]; + this.x.graphics.out_implicit = []; + this.x.graphics.exprs = [["-15"],["15"],["-15"],["15"],["1"]]; } BARXY.prototype.details = function BARXY() { + return this.x; } BARXY.prototype.get = function BARXY() { } BARXY.prototype.set = function BARXY() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,xmin,xmax,ymin,ymax,thickness,exprs] = scicos_getvalue("Set Scope parameters",[["Xmin"],["Xmax"],["Ymin"],["Ymax"],["Segs Thickness"]],list("vec",1,"vec",1,"vec",1,"vec",1,"vec",1),exprs); - if (!ok) { -break; -} - mess = []; - if (ymin>=ymax) { - mess = [[mess],["Ymax must be greater than Ymin"],[" "]]; - ok = false; -} - if (xmin>=xmax) { - mess = [[mess],["Xmax must be greater than Xmin"],[" "]]; - ok = false; -} - if (thickness<=0) { - mess = [[mess],["Thickness must be strictly positive."]]; - ok = false; -} - if (!ok) { -message(mess); - } else { - model.rpar = [[xmin],[xmax],[ymin],[ymax]]; - model.ipar = thickness; - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,xmin,xmax,ymin,ymax,thickness,exprs] = scicos_getvalue("Set Scope parameters",[["Xmin"],["Xmax"],["Ymin"],["Ymax"],["Segs Thickness"]],list("vec",1,"vec",1,"vec",1,"vec",1,"vec",1),exprs); + if (!ok) { + break; + } + mess = []; + if (ymin>=ymax) { + mess = [[mess],["Ymax must be greater than Ymin"],[" "]]; + ok = false; + } + if (xmin>=xmax) { + mess = [[mess],["Xmax must be greater than Xmin"],[" "]]; + ok = false; + } + if (thickness<=0) { + mess = [[mess],["Thickness must be strictly positive."]]; + ok = false; + } + if (!ok) { + message(mess); + } else { + model.rpar = [[xmin],[xmax],[ymin],[ymax]]; + model.ipar = thickness; + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Sinks/BARXY.pickle b/js/Sinks/BARXY.pickle index 154645d8..0d1dde24 100644 --- a/js/Sinks/BARXY.pickle +++ b/js/Sinks/BARXY.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/Sinks/CANIMXY.js b/js/Sinks/CANIMXY.js index 4fe1aa55..7f58c8a9 100644 --- a/js/Sinks/CANIMXY.js +++ b/js/Sinks/CANIMXY.js @@ -25,76 +25,77 @@ function CANIMXY() { model.dep_ut = [false,false]; exprs = [[string(nbr_curves)],[string(clrs)],[string(siz)],[string(win)],["[]"],["[]"],[string(xmin)],[string(xmax)],[string(ymin)],[string(ymax)],[string(N)]]; gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } CANIMXY.prototype.details = function CANIMXY() { + return this.x; } CANIMXY.prototype.get = function CANIMXY() { } CANIMXY.prototype.set = function CANIMXY() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,nbr_curves,clrs,siz,win,wpos,wdim,xmin,xmax,ymin,ymax,N,exprs] = scicos_getvalue("Set Scope parameters",[["Number of Curves"],["color (>0) or mark (<0)"],["line or mark size"],["Output window number (-1 for automatic)"],["Output window position"],["Output window sizes"],["Xmin"],["Xmax"],["Ymin"],["Ymax"],["Buffer size"]],list("vec",1,"vec",1,"vec",1,"vec",1,"vec",-1,"vec",-1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1),exprs); - if (!ok) { -break; -} - mess = []; - if (size(wpos,"*")!=0&&size(wpos,"*")!=2) { - mess = [[mess],["Window position must be [] or a 2 vector"],[" "]]; - ok = false; -} - if (size(wdim,"*")!=0&&size(wdim,"*")!=2) { - mess = [[mess],["Window dim must be [] or a 2 vector"],[" "]]; - ok = false; -} - if (win<-1) { - mess = [[mess],["Window number cannot be inferior than -1"],[" "]]; - ok = false; -} - if (nbr_curves<=0) { - mess = [[mess],["Number of curves cannot be negative or null"],[" "]]; - ok = false; -} - if (N<1) { - mess = [[mess],["Buffer size must be at least 1"],[" "]]; - ok = false; -} - if (N==1&&clrs>0) { - mess = [[mess],["Buffer size must be at least 2"],[" "]]; - ok = false; -} - if (ymin>=ymax) { - mess = [[mess],["Ymax must be greater than Ymin"],[" "]]; - ok = false; -} - if (xmin>=xmax) { - mess = [[mess],["Xmax must be greater than Xmin"],[" "]]; - ok = false; -} - if (!ok) { -message(mess); - } else { - in1 = nbr_curves*ones(2,1); - in2 = ones(2,1); - [model,graphics,ok] = set_io(model,graphics,list([in1,in2],ones(2,1)),list(),ones(1,1),[]); - if (wpos==[]) { - wpos = [[-1],[-1]]; -} - if (wdim==[]) { - wdim = [[-1],[-1]]; -} - rpar = [[xmin],[xmax],[ymin],[ymax]]; - ipar = [[win],[1],[N],[clrs],[siz],[0],[wpos.slice()],[wdim.slice()],[nbr_curves]]; - model.rpar = rpar; - model.ipar = ipar; - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,nbr_curves,clrs,siz,win,wpos,wdim,xmin,xmax,ymin,ymax,N,exprs] = scicos_getvalue("Set Scope parameters",[["Number of Curves"],["color (>0) or mark (<0)"],["line or mark size"],["Output window number (-1 for automatic)"],["Output window position"],["Output window sizes"],["Xmin"],["Xmax"],["Ymin"],["Ymax"],["Buffer size"]],list("vec",1,"vec",1,"vec",1,"vec",1,"vec",-1,"vec",-1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1),exprs); + if (!ok) { + break; + } + mess = []; + if (size(wpos,"*")!=0&&size(wpos,"*")!=2) { + mess = [[mess],["Window position must be [] or a 2 vector"],[" "]]; + ok = false; + } + if (size(wdim,"*")!=0&&size(wdim,"*")!=2) { + mess = [[mess],["Window dim must be [] or a 2 vector"],[" "]]; + ok = false; + } + if (win<-1) { + mess = [[mess],["Window number cannot be inferior than -1"],[" "]]; + ok = false; + } + if (nbr_curves<=0) { + mess = [[mess],["Number of curves cannot be negative or null"],[" "]]; + ok = false; + } + if (N<1) { + mess = [[mess],["Buffer size must be at least 1"],[" "]]; + ok = false; + } + if (N==1&&clrs>0) { + mess = [[mess],["Buffer size must be at least 2"],[" "]]; + ok = false; + } + if (ymin>=ymax) { + mess = [[mess],["Ymax must be greater than Ymin"],[" "]]; + ok = false; + } + if (xmin>=xmax) { + mess = [[mess],["Xmax must be greater than Xmin"],[" "]]; + ok = false; + } + if (!ok) { + message(mess); + } else { + in1 = nbr_curves*ones(2,1); + in2 = ones(2,1); + [model,graphics,ok] = set_io(model,graphics,list([in1,in2],ones(2,1)),list(),ones(1,1),[]); + if (wpos==[]) { + wpos = [[-1],[-1]]; + } + if (wdim==[]) { + wdim = [[-1],[-1]]; + } + rpar = [[xmin],[xmax],[ymin],[ymax]]; + ipar = [[win],[1],[N],[clrs],[siz],[0],[wpos.slice()],[wdim.slice()],[nbr_curves]]; + model.rpar = rpar; + model.ipar = ipar; + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Sinks/CANIMXY.pickle b/js/Sinks/CANIMXY.pickle index 154645d8..0d1dde24 100644 --- a/js/Sinks/CANIMXY.pickle +++ b/js/Sinks/CANIMXY.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/Sinks/CANIMXY3D.js b/js/Sinks/CANIMXY3D.js index 8d86f3b9..7b70e142 100644 --- a/js/Sinks/CANIMXY3D.js +++ b/js/Sinks/CANIMXY3D.js @@ -25,93 +25,94 @@ function CANIMXY3D() { model.dep_ut = [false,false]; exprs = [[string(nbr_curves)],[strcat(string(clrs)," ")],[strcat(string(siz)," ")],[string(win)],["[]"],["[]"],[strcat(string(vec_x)," ")],[strcat(string(vec_y)," ")],[strcat(string(vec_z)," ")],[strcat(string(param3ds)," ")],[string(N)]]; gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } CANIMXY3D.prototype.details = function CANIMXY3D() { + return this.x; } CANIMXY3D.prototype.get = function CANIMXY3D() { } CANIMXY3D.prototype.set = function CANIMXY3D() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,nbr_curves,clrs,siz,win,wpos,wdim,vec_x,vec_y,vec_z,param3ds,N,exprs] = scicos_getvalue("Set Scope parameters",[["Number of curves"],["color (>0) or mark (<0)"],["line or mark size"],["Output window number (-1 for automatic)"],["Output window position"],["Output window sizes"],["Xmin and Xmax"],["Ymin and Ymax"],["Zmin and Zmax"],["Alpha and Theta"],["Buffer size"]],list("vec",1,"vec",-1,"vec",-1,"vec",1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",1),exprs); - if (!ok) { -break; -} - mess = []; - if (size(wpos,"*")!=0&&size(wpos,"*")!=2) { - mess = [[mess],["Window position must be [] or a 2 vector"],[" "]]; - ok = false; -} - if (size(wdim,"*")!=0&&size(wdim,"*")!=2) { - mess = [[mess],["Window dim must be [] or a 2 vector"],[" "]]; - ok = false; -} - if (win<-1) { - mess = [[mess],["Window number cannot be inferior than -1"],[" "]]; - ok = false; -} - if (size(clrs,"*")!=size(siz,"*")) { - mess = [[mess],["Colors and Size must have same size"],[" "]]; - ok = false; -} - if (nbr_curves<=0) { - mess = [[mess],["Number of curves cannot be negative or null"],[" "]]; - ok = false; -} - if (size(clrs,"*")<nbr_curves) { - mess = [[mess],["You must have at least same size for clrs and the number of curves"],[" "]]; - ok = false; -} - if (N<1) { - mess = [[mess],["Buffer size must be at least 1"],[" "]]; - ok = false; -} - if (N<2) { -for (i=1;i<=nbr_curves;i+=1) { - if (clrs[i-1]>0) { - mess = [[mess],["Buffer size must be at least 2 or Change a color (must be <0)"],[" "]]; - ok = false; -} -} -} - if (vec_y[1-1]>=vec_y[2-1]) { - mess = [[mess],["Ymax must be higher than Ymin"],[" "]]; - ok = false; -} - if (vec_x[1-1]>=vec_x[2-1]) { - mess = [[mess],["Xmax must be higher than Xmin"],[" "]]; - ok = false; -} - if (vec_z[1-1]>=vec_z[2-1]) { - mess = [[mess],["Zmax must be higher than Zmin"],[" "]]; - ok = false; -} - if (!ok) { -message(mess); - } else { - in1 = nbr_curves*ones(3,1); - in2 = ones(3,1); - [model,graphics,ok] = set_io(model,graphics,list([in1,in2],ones(3,1)),list(),ones(1,1),[]); - if (wpos==[]) { - wpos = [[-1],[-1]]; -} - if (wdim==[]) { - wdim = [[-1],[-1]]; -} - rpar = [[vec_x.slice()],[vec_y.slice()],[vec_z.slice()],[param3ds.slice()]]; - size_siz = size(siz,"*"); - ipar = [[win],[size_siz],[N],[clrs.slice()],[siz.slice()],[1],[wpos.slice()],[wdim.slice()],[nbr_curves]]; - model.rpar = rpar; - model.ipar = ipar; - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,nbr_curves,clrs,siz,win,wpos,wdim,vec_x,vec_y,vec_z,param3ds,N,exprs] = scicos_getvalue("Set Scope parameters",[["Number of curves"],["color (>0) or mark (<0)"],["line or mark size"],["Output window number (-1 for automatic)"],["Output window position"],["Output window sizes"],["Xmin and Xmax"],["Ymin and Ymax"],["Zmin and Zmax"],["Alpha and Theta"],["Buffer size"]],list("vec",1,"vec",-1,"vec",-1,"vec",1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",1),exprs); + if (!ok) { + break; + } + mess = []; + if (size(wpos,"*")!=0&&size(wpos,"*")!=2) { + mess = [[mess],["Window position must be [] or a 2 vector"],[" "]]; + ok = false; + } + if (size(wdim,"*")!=0&&size(wdim,"*")!=2) { + mess = [[mess],["Window dim must be [] or a 2 vector"],[" "]]; + ok = false; + } + if (win<-1) { + mess = [[mess],["Window number cannot be inferior than -1"],[" "]]; + ok = false; + } + if (size(clrs,"*")!=size(siz,"*")) { + mess = [[mess],["Colors and Size must have same size"],[" "]]; + ok = false; + } + if (nbr_curves<=0) { + mess = [[mess],["Number of curves cannot be negative or null"],[" "]]; + ok = false; + } + if (size(clrs,"*")<nbr_curves) { + mess = [[mess],["You must have at least same size for clrs and the number of curves"],[" "]]; + ok = false; + } + if (N<1) { + mess = [[mess],["Buffer size must be at least 1"],[" "]]; + ok = false; + } + if (N<2) { + for (i=1;i<=nbr_curves;i+=1) { + if (clrs[i-1]>0) { + mess = [[mess],["Buffer size must be at least 2 or Change a color (must be <0)"],[" "]]; + ok = false; + } + } + } + if (vec_y[1-1]>=vec_y[2-1]) { + mess = [[mess],["Ymax must be higher than Ymin"],[" "]]; + ok = false; + } + if (vec_x[1-1]>=vec_x[2-1]) { + mess = [[mess],["Xmax must be higher than Xmin"],[" "]]; + ok = false; + } + if (vec_z[1-1]>=vec_z[2-1]) { + mess = [[mess],["Zmax must be higher than Zmin"],[" "]]; + ok = false; + } + if (!ok) { + message(mess); + } else { + in1 = nbr_curves*ones(3,1); + in2 = ones(3,1); + [model,graphics,ok] = set_io(model,graphics,list([in1,in2],ones(3,1)),list(),ones(1,1),[]); + if (wpos==[]) { + wpos = [[-1],[-1]]; + } + if (wdim==[]) { + wdim = [[-1],[-1]]; + } + rpar = [[vec_x.slice()],[vec_y.slice()],[vec_z.slice()],[param3ds.slice()]]; + size_siz = size(siz,"*"); + ipar = [[win],[size_siz],[N],[clrs.slice()],[siz.slice()],[1],[wpos.slice()],[wdim.slice()],[nbr_curves]]; + model.rpar = rpar; + model.ipar = ipar; + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Sinks/CANIMXY3D.pickle b/js/Sinks/CANIMXY3D.pickle index 154645d8..0d1dde24 100644 --- a/js/Sinks/CANIMXY3D.pickle +++ b/js/Sinks/CANIMXY3D.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/Sinks/CEVENTSCOPE.js b/js/Sinks/CEVENTSCOPE.js index 23559306..712c76aa 100644 --- a/js/Sinks/CEVENTSCOPE.js +++ b/js/Sinks/CEVENTSCOPE.js @@ -16,71 +16,72 @@ function CEVENTSCOPE() { model.dep_ut = [false,false]; exprs = [[sci2exp(nclock)],[strcat(sci2exp(clrs[nclock-1])," ")],[string(win)],[sci2exp([])],[sci2exp(wdim)],[string(per)]]; gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } CEVENTSCOPE.prototype.details = function CEVENTSCOPE() { + return this.x; } CEVENTSCOPE.prototype.get = function CEVENTSCOPE() { } CEVENTSCOPE.prototype.set = function CEVENTSCOPE() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,nclock,clrs,win,wpos,wdim,per,exprs] = scicos_getvalue("Set Scope parameters",[["Number of event inputs"],["colors c (>0) or mark (<0)"],["Output window number (-1 for automatic)"],["Output window position"],["Output window sizes"],["Refresh period"]],list("vec",1,"vec",-1,"vec",1,"vec",-1,"vec",-1,"vec",1),exprs); - nclock = int(nclock); - clrs = int(clrs); - win = int(win); - if (!ok) { -break; -} - mess = []; - if (size(wpos,"*")!=0&&size(wpos,"*")!=2) { - mess = [[mess],["Window position must be [] or a 2 vector"],[" "]]; - ok = false; -} - if (size(wdim,"*")!=0&&size(wdim,"*")!=2) { - mess = [[mess],["Window dim must be [] or a 2 vector"],[" "]]; - ok = false; -} - if (nclock<=0) { - mess = [[mess],["Block must have at least one input event"],[" "]]; - ok = false; -} - if (size(clrs,"*")!=nclock) { - mess = [[mess],["Inputs color c size must be equal to Number of inputs"],[" "]]; - ok = false; -} - if (win<-1) { - mess = [[mess],["Window number cannot be inferior than -1"],[" "]]; - ok = false; -} - if (per<=0) { - mess = [[mess],["Refresh period must be positive"],[" "]]; - ok = false; -} - if (ok) { - [model,graphics,ok] = set_io(model,graphics,list(),list(),ones(nclock,1),[]); - } else { -message([["Some specified values are inconsistent:"],[" "],[mess]]); -} - if (ok) { - if (wpos==[]) { - wpos = [[-1],[-1]]; -} - if (wdim==[]) { - wdim = [[-1],[-1]]; -} - rpar = per; - ipar = [[win],[1],[clrs.slice()],[wpos.slice()],[wdim.slice()]]; - model.rpar = rpar; - model.ipar = ipar; - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,nclock,clrs,win,wpos,wdim,per,exprs] = scicos_getvalue("Set Scope parameters",[["Number of event inputs"],["colors c (>0) or mark (<0)"],["Output window number (-1 for automatic)"],["Output window position"],["Output window sizes"],["Refresh period"]],list("vec",1,"vec",-1,"vec",1,"vec",-1,"vec",-1,"vec",1),exprs); + nclock = int(nclock); + clrs = int(clrs); + win = int(win); + if (!ok) { + break; + } + mess = []; + if (size(wpos,"*")!=0&&size(wpos,"*")!=2) { + mess = [[mess],["Window position must be [] or a 2 vector"],[" "]]; + ok = false; + } + if (size(wdim,"*")!=0&&size(wdim,"*")!=2) { + mess = [[mess],["Window dim must be [] or a 2 vector"],[" "]]; + ok = false; + } + if (nclock<=0) { + mess = [[mess],["Block must have at least one input event"],[" "]]; + ok = false; + } + if (size(clrs,"*")!=nclock) { + mess = [[mess],["Inputs color c size must be equal to Number of inputs"],[" "]]; + ok = false; + } + if (win<-1) { + mess = [[mess],["Window number cannot be inferior than -1"],[" "]]; + ok = false; + } + if (per<=0) { + mess = [[mess],["Refresh period must be positive"],[" "]]; + ok = false; + } + if (ok) { + [model,graphics,ok] = set_io(model,graphics,list(),list(),ones(nclock,1),[]); + } else { + message([["Some specified values are inconsistent:"],[" "],[mess]]); + } + if (ok) { + if (wpos==[]) { + wpos = [[-1],[-1]]; + } + if (wdim==[]) { + wdim = [[-1],[-1]]; + } + rpar = per; + ipar = [[win],[1],[clrs.slice()],[wpos.slice()],[wdim.slice()]]; + model.rpar = rpar; + model.ipar = ipar; + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Sinks/CEVENTSCOPE.pickle b/js/Sinks/CEVENTSCOPE.pickle index 154645d8..0d1dde24 100644 --- a/js/Sinks/CEVENTSCOPE.pickle +++ b/js/Sinks/CEVENTSCOPE.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/Sinks/CFSCOPE.js b/js/Sinks/CFSCOPE.js index e2cf054d..4d000c69 100644 --- a/js/Sinks/CFSCOPE.js +++ b/js/Sinks/CFSCOPE.js @@ -18,78 +18,79 @@ function CFSCOPE() { model.dep_ut = [true,false]; exprs = [[strcat(string(clrs)," ")],[string(win)],[sci2exp([])],[sci2exp(wdim)],[string(ymin)],[string(ymax)],[string(per)],[string(N)],[string([1])]]; gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } CFSCOPE.prototype.details = function CFSCOPE() { + return this.x; } CFSCOPE.prototype.get = function CFSCOPE() { } CFSCOPE.prototype.set = function CFSCOPE() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,clrs,win,wpos,wdim,ymin,ymax,per,N,wu,exprs] = scicos_getvalue("Set Scope parameters",[["Color (>0) or mark (<0) vector (8 entries)"],["Output window number (-1 for automatic)"],["Output window position"],["Output window sizes"],["Ymin"],["Ymax"],["Refresh period"],["Buffer size","Links to view"]],list("vec",8,"vec",1,"vec",-1,"vec",-1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",-1),exprs); - if (!ok) { -break; -} - mess = []; - if (size(wpos,"*")!=0&&size(wpos,"*")!=2) { - mess = [[mess],["Window position must be [] or a 2 vector"],[" "]]; - ok = false; -} - if (size(wdim,"*")!=0&&size(wdim,"*")!=2) { - mess = [[mess],["Window dim must be [] or a 2 vector"],[" "]]; - ok = false; -} - if (win<-1) { - mess = [[mess],["Window number cannot be inferior than -1"],[" "]]; - ok = false; -} - if (per<=0) { - mess = [[mess],["Refresh period must be positive"],[" "]]; - ok = false; -} - if (N<2) { - mess = [[mess],["Buffer size must be at least 2"],[" "]]; - ok = false; -} - if (ymin>=ymax) { - mess = [[mess],["Ymax must be greater than Ymin"],[" "]]; - ok = false; -} - if (wu<0) { - mess = [[mess],["Link to view must be positive"],[" "]]; - ok = false; -} - if (!ok) { -message([["Some specified values are inconsistent:"],[" "],[mess]]); -} - if (ok) { - if (wpos==[]) { - wpos = [[-1],[-1]]; -} - if (wdim==[]) { - wdim = [[-1],[-1]]; -} - rpar = [[0],[ymin],[ymax],[per]]; - if (size(clrs,"*")>8) { - clrs = clrs.slice(1-1,8); -} - if (size(clrs,"*")<8) { - clrs[8-1] = 0; -} - ipar = [[win],[1],[N],[clrs.slice()],[wpos.slice()],[wdim.slice()],[size(wu,"*")],[wu.slice()]]; - model.rpar = rpar; - model.ipar = ipar; - model.firing = []; - model.dep_ut = [true,false]; - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,clrs,win,wpos,wdim,ymin,ymax,per,N,wu,exprs] = scicos_getvalue("Set Scope parameters",[["Color (>0) or mark (<0) vector (8 entries)"],["Output window number (-1 for automatic)"],["Output window position"],["Output window sizes"],["Ymin"],["Ymax"],["Refresh period"],["Buffer size","Links to view"]],list("vec",8,"vec",1,"vec",-1,"vec",-1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",-1),exprs); + if (!ok) { + break; + } + mess = []; + if (size(wpos,"*")!=0&&size(wpos,"*")!=2) { + mess = [[mess],["Window position must be [] or a 2 vector"],[" "]]; + ok = false; + } + if (size(wdim,"*")!=0&&size(wdim,"*")!=2) { + mess = [[mess],["Window dim must be [] or a 2 vector"],[" "]]; + ok = false; + } + if (win<-1) { + mess = [[mess],["Window number cannot be inferior than -1"],[" "]]; + ok = false; + } + if (per<=0) { + mess = [[mess],["Refresh period must be positive"],[" "]]; + ok = false; + } + if (N<2) { + mess = [[mess],["Buffer size must be at least 2"],[" "]]; + ok = false; + } + if (ymin>=ymax) { + mess = [[mess],["Ymax must be greater than Ymin"],[" "]]; + ok = false; + } + if (wu<0) { + mess = [[mess],["Link to view must be positive"],[" "]]; + ok = false; + } + if (!ok) { + message([["Some specified values are inconsistent:"],[" "],[mess]]); + } + if (ok) { + if (wpos==[]) { + wpos = [[-1],[-1]]; + } + if (wdim==[]) { + wdim = [[-1],[-1]]; + } + rpar = [[0],[ymin],[ymax],[per]]; + if (size(clrs,"*")>8) { + clrs = clrs.slice(1-1,8); + } + if (size(clrs,"*")<8) { + clrs[8-1] = 0; + } + ipar = [[win],[1],[N],[clrs.slice()],[wpos.slice()],[wdim.slice()],[size(wu,"*")],[wu.slice()]]; + model.rpar = rpar; + model.ipar = ipar; + model.firing = []; + model.dep_ut = [true,false]; + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Sinks/CFSCOPE.pickle b/js/Sinks/CFSCOPE.pickle index 154645d8..0d1dde24 100644 --- a/js/Sinks/CFSCOPE.pickle +++ b/js/Sinks/CFSCOPE.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/Sinks/CLKOUTV_f.js b/js/Sinks/CLKOUTV_f.js index 0c98a1b9..c53d274d 100644 --- a/js/Sinks/CLKOUTV_f.js +++ b/js/Sinks/CLKOUTV_f.js @@ -10,33 +10,34 @@ function CLKOUTV_f() { model.firing = []; model.dep_ut = [false,false]; exprs = string(prt); - x = standard_define([1,1],model,exprs," "); + this.x = standard_define([1,1],model,exprs," "); } CLKOUTV_f.prototype.details = function CLKOUTV_f() { + return this.x; } CLKOUTV_f.prototype.get = function CLKOUTV_f() { } CLKOUTV_f.prototype.set = function CLKOUTV_f() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; model = arg1.model; exprs = graphics.exprs; while (true) { - [ok,prt,exprs] = scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"CLKOUTV_f")],[" "],[gettext("Event output port")]],gettext("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 { - model.ipar = prt; - model.evtin = 1; - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,prt,exprs] = scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"CLKOUTV_f")],[" "],[gettext("Event output port")]],gettext("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 { + model.ipar = prt; + model.evtin = 1; + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Sinks/CLKOUTV_f.pickle b/js/Sinks/CLKOUTV_f.pickle index b563ade6..658c6188 100644 --- a/js/Sinks/CLKOUTV_f.pickle +++ b/js/Sinks/CLKOUTV_f.pickle @@ -2,16 +2,18 @@ c__builtin__ set p0 ((lp1 -S'diag' +S'standard_origin' p2 -aS'type' +aS'diag' p3 -aS'options' -p4 aS'default_color' +p4 +aS'x' p5 -aS'standard_origin' +aS'type' p6 -atp7 -Rp8 +aS'options' +p7 +atp8 +Rp9 .
\ No newline at end of file diff --git a/js/Sinks/CLKOUT_f.js b/js/Sinks/CLKOUT_f.js index d9f5d2a9..5ff1d994 100644 --- a/js/Sinks/CLKOUT_f.js +++ b/js/Sinks/CLKOUT_f.js @@ -10,35 +10,36 @@ function CLKOUT_f() { model.firing = []; model.dep_ut = [false,false]; exprs = string(prt); - x = standard_define([1,1],model,exprs," "); + this.x = standard_define([1,1],model,exprs," "); } CLKOUT_f.prototype.details = function CLKOUT_f() { + return this.x; } CLKOUT_f.prototype.get = function CLKOUT_f() { } CLKOUT_f.prototype.set = function CLKOUT_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 Output block parameters","Port number",list("vec",1),exprs); - if (!ok) { -break; -} - prt = int(prt); - if (prt<=0) { -message("Port number must be a positive integer"); - } else { - model.ipar = prt; - model.evtin = 1; - model.firing = []; - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,prt,exprs] = scicos_getvalue("Set Event Output block parameters","Port number",list("vec",1),exprs); + if (!ok) { + break; + } + prt = int(prt); + if (prt<=0) { + message("Port number must be a positive integer"); + } else { + model.ipar = prt; + model.evtin = 1; + model.firing = []; + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Sinks/CLKOUT_f.pickle b/js/Sinks/CLKOUT_f.pickle index 154645d8..0d1dde24 100644 --- a/js/Sinks/CLKOUT_f.pickle +++ b/js/Sinks/CLKOUT_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/Sinks/CMAT3D.js b/js/Sinks/CMAT3D.js index 44dcfcb4..a29a7e7a 100644 --- a/js/Sinks/CMAT3D.js +++ b/js/Sinks/CMAT3D.js @@ -5,7 +5,7 @@ function CMAT3D() { cmax = 100; colormap = this.jetcolormap[25-1]; size_c = 25; - x = -1; + this.x = -1; y = -1; size_x = 1; size_y = 1; @@ -16,51 +16,52 @@ function CMAT3D() { model.intyp = 1; model.evtin = 1; model.ipar = [[cmin],[cmax],[size_c],[size_x],[size_y]]; - model.rpar = [[colormap.slice()],[x],[y]]; + model.rpar = [[colormap.slice()],[this.x],[y]]; model.blocktype = "c"; model.dep_ut = [true,false]; - exprs = [[strcat(string(x)," ")],[strcat(string(y)," ")],[string("jetcolormap(25)")],[string(cmin)],[string(cmax)]]; + exprs = [[strcat(string(this.x)," ")],[strcat(string(y)," ")],[string("jetcolormap(25)")],[string(cmin)],[string(cmax)]]; gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } CMAT3D.prototype.details = function CMAT3D() { + return this.x; } CMAT3D.prototype.get = function CMAT3D() { } CMAT3D.prototype.set = function CMAT3D() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,vec_x,vec_y,colormap,cmin,cmax,exprs] = scicos_getvalue("Set Scope parameters",[["Bounds Vector X (-1 for standard)"],["Bounds Vector Y (-1 for standard)"],["ColorMap"],["Zmin"],["Zmax"]],list("vec",-1,"vec",-1,"vec",-1,"vec",1,"vec",1),exprs); - if (!ok) { -break; -} - mess = []; - if (size(vec_x,"*")!=size(vec_y,"*")) { - mess = [[mess],["Vector X and Vector Y must have the same size"],[" "]]; - ok = false; -} - if (cmax<=cmin) { - mess = [[mess],["Error with minimum and maximum value"],[" "]]; - ok = false; -} - if (!ok) { -message([["Some specified values are inconsistent:"],[" "],[mess]]); -} - if (ok) { - size_x = size(vec_x,"*"); - size_c = size(colormap.slice(),1); - ipar = [[cmin],[cmax],[size_c],[size_x]]; - rpar = [[colormap.slice()],[vec_x.slice()],[vec_y.slice()]]; - model.ipar = ipar; - model.rpar = rpar; - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,vec_x,vec_y,colormap,cmin,cmax,exprs] = scicos_getvalue("Set Scope parameters",[["Bounds Vector X (-1 for standard)"],["Bounds Vector Y (-1 for standard)"],["ColorMap"],["Zmin"],["Zmax"]],list("vec",-1,"vec",-1,"vec",-1,"vec",1,"vec",1),exprs); + if (!ok) { + break; + } + mess = []; + if (size(vec_x,"*")!=size(vec_y,"*")) { + mess = [[mess],["Vector X and Vector Y must have the same size"],[" "]]; + ok = false; + } + if (cmax<=cmin) { + mess = [[mess],["Error with minimum and maximum value"],[" "]]; + ok = false; + } + if (!ok) { + message([["Some specified values are inconsistent:"],[" "],[mess]]); + } + if (ok) { + size_x = size(vec_x,"*"); + size_c = size(colormap.slice(),1); + ipar = [[cmin],[cmax],[size_c],[size_x]]; + rpar = [[colormap.slice()],[vec_x.slice()],[vec_y.slice()]]; + model.ipar = ipar; + model.rpar = rpar; + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Sinks/CMAT3D.pickle b/js/Sinks/CMAT3D.pickle index 80ec981b..3467fd44 100644 --- a/js/Sinks/CMAT3D.pickle +++ b/js/Sinks/CMAT3D.pickle @@ -2,8 +2,10 @@ c__builtin__ set p0 ((lp1 -S'jetcolormap' +S'x' p2 -atp3 -Rp4 +aS'jetcolormap' +p3 +atp4 +Rp5 .
\ No newline at end of file diff --git a/js/Sinks/CMATVIEW.js b/js/Sinks/CMATVIEW.js index f92782e5..d472334e 100644 --- a/js/Sinks/CMATVIEW.js +++ b/js/Sinks/CMATVIEW.js @@ -19,44 +19,45 @@ function CMATVIEW() { model.dep_ut = [true,false]; exprs = [[string("jetcolormap(25)")],[string(cmin)],[string(cmax)]]; gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } CMATVIEW.prototype.details = function CMATVIEW() { + return this.x; } CMATVIEW.prototype.get = function CMATVIEW() { } CMATVIEW.prototype.set = function CMATVIEW() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,colormap,cmin,cmax,exprs] = scicos_getvalue("Set Scope parameters",[["ColorMap"],["Minimum level range"],["Maximum level range"]],list("vec",-1,"vec",1,"vec",1),exprs); - if (!ok) { -break; -} - mess = []; - if (cmax<=cmin) { - mess = [[mess],["Error with minimum and maximum value"],[" "]]; - ok = false; -} - if (!ok) { -message([["Some specified values are inconsistent:"],[" "],[mess]]); -} - if (ok) { - size_c = size(colormap.slice(),1); - sol = inv([[cmin,1],[cmax,1]])*[[1],[size_c/3]]; - alpha_c = sol[1-1]; - beta_c = sol[2-1]; - ipar = [[cmin],[cmax],[size_c]]; - rpar = [[alpha_c],[beta_c],[colormap.slice()]]; - model.ipar = ipar; - model.rpar = rpar; - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,colormap,cmin,cmax,exprs] = scicos_getvalue("Set Scope parameters",[["ColorMap"],["Minimum level range"],["Maximum level range"]],list("vec",-1,"vec",1,"vec",1),exprs); + if (!ok) { + break; + } + mess = []; + if (cmax<=cmin) { + mess = [[mess],["Error with minimum and maximum value"],[" "]]; + ok = false; + } + if (!ok) { + message([["Some specified values are inconsistent:"],[" "],[mess]]); + } + if (ok) { + size_c = size(colormap.slice(),1); + sol = inv([[cmin,1],[cmax,1]])*[[1],[size_c/3]]; + alpha_c = sol[1-1]; + beta_c = sol[2-1]; + ipar = [[cmin],[cmax],[size_c]]; + rpar = [[alpha_c],[beta_c],[colormap.slice()]]; + model.ipar = ipar; + model.rpar = rpar; + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Sinks/CMATVIEW.pickle b/js/Sinks/CMATVIEW.pickle index 80ec981b..3467fd44 100644 --- a/js/Sinks/CMATVIEW.pickle +++ b/js/Sinks/CMATVIEW.pickle @@ -2,8 +2,10 @@ c__builtin__ set p0 ((lp1 -S'jetcolormap' +S'x' p2 -atp3 -Rp4 +aS'jetcolormap' +p3 +atp4 +Rp5 .
\ No newline at end of file diff --git a/js/Sinks/CMSCOPE.js b/js/Sinks/CMSCOPE.js index cfef200f..f8b69469 100644 --- a/js/Sinks/CMSCOPE.js +++ b/js/Sinks/CMSCOPE.js @@ -24,103 +24,104 @@ function CMSCOPE() { model.dep_ut = [true,false]; exprs = [[strcat(string(in1)," ")],[strcat(string(clrs)," ")],[string(win)],[sci2exp([])],[sci2exp([])],[strcat(string(ymin)," ")],[strcat(string(ymax)," ")],[strcat(string(per)," ")],[string(N)],[string(0)],[emptystr()]]; gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } CMSCOPE.prototype.details = function CMSCOPE() { + return this.x; } CMSCOPE.prototype.get = function CMSCOPE() { } CMSCOPE.prototype.set = function CMSCOPE() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,in1,clrs,win,wpos,wdim,ymin,ymax,per,N,heritance,nom,exprs] = scicos_getvalue("Set Scope parameters",[["Input ports sizes"],["Drawing colors (>0) or mark (<0)"],["Output window number (-1 for automatic)"],["Output window position"],["Output window sizes"],["Ymin vector"],["Ymax vector"],["Refresh period"],["Buffer size"],["Accept herited events 0/1","Name of Scope (label&Id)"]],list("vec",-1,"vec",-1,"vec",1,"vec",-1,"vec",-1,"vec","size(%1,\'*\')","vec","size(%1,\'*\')","vec","size(%1,\'*\')","vec",1,"vec",1,"str",1),exprs); - if (!ok) { -break; -} - mess = []; - if (size(in1,"*")<=0) { - mess = [[mess],["Block must have at least one input port"],[" "]]; - ok = false; -} - if (min(in1)<=0) { - mess = [[mess],["Port sizes must be positive"],[" "]]; - ok = false; -} - if (size(clrs,"*")<sum(in1)) { - mess = [[mess],["Not enough colors defined (at least "+string(sum(in1))+")"],[" "]]; - ok = false; -} - if (size(wpos,"*")!=0&&size(wpos,"*")!=2) { - mess = [[mess],["Window position must be [] or a 2 vector"],[" "]]; - ok = false; -} - if (size(wdim,"*")!=0&&size(wdim,"*")!=2) { - mess = [[mess],["Window dim must be [] or a 2 vector"],[" "]]; - ok = false; -} - if (win<-1) { - mess = [[mess],["Window number can\'t be < -1"],[" "]]; - ok = false; -} - if (size(per,"*")!=size(ymin,"*")) { - mess = [[mess],["Size of Refresh Period must equal size of Ymin/Ymax vector"],[" "]]; - ok = false; -} -for (i=1;i<=size(per,"*");i+=1) { - if ((per[i-1]<=0)) { - mess = [[mess],["Refresh Period must be positive"],[" "]]; - ok = false; -} -} - if (N<2) { - mess = [[mess],["Buffer size must be at least 2"],[" "]]; - ok = false; -} - if (or(ymin>=ymax)) { - mess = [[mess],["Ymax must be greater than Ymin"],[" "]]; - ok = false; -} - if (!or(heritance==[0,1])) { - mess = [[mess],["Accept herited events must be 0 or 1"],[" "]]; - ok = false; -} - if (!ok) { -message([["Some specified values are inconsistent:"],[" "],[mess]]); -} - if (ok) { - in1 = in1.slice(); - a = size(in1,1); - in2 = ones(a,1); - [model,graphics,ok] = set_io(model,graphics,list([in1,in2],ones(a,1)),list(),ones(1-heritance,1),[]); -} - if (ok) { - if (wpos==[]) { - wpos = [[-1],[-1]]; -} - if (wdim==[]) { - wdim = [[-1],[-1]]; -} - if (ok) { - period = transpose(per.slice()); - yy = [[transpose(ymin.slice())],[transpose(ymax.slice())]]; - rpar = [[0],[period.slice()],[yy.slice()]]; - clrs = clrs.slice(1-1,sum(in1)); - ipar = [[win],[size(in1,"*")],[N],[wpos.slice()],[wdim.slice()],[in1.slice()],[clrs.slice()],[heritance]]; - model.evtin = ones(1-heritance,1); - model.dstate = []; - model.rpar = rpar; - model.ipar = ipar; - model.label = nom; - graphics.id = nom; - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} -} + [ok,in1,clrs,win,wpos,wdim,ymin,ymax,per,N,heritance,nom,exprs] = scicos_getvalue("Set Scope parameters",[["Input ports sizes"],["Drawing colors (>0) or mark (<0)"],["Output window number (-1 for automatic)"],["Output window position"],["Output window sizes"],["Ymin vector"],["Ymax vector"],["Refresh period"],["Buffer size"],["Accept herited events 0/1","Name of Scope (label&Id)"]],list("vec",-1,"vec",-1,"vec",1,"vec",-1,"vec",-1,"vec","size(%1,\'*\')","vec","size(%1,\'*\')","vec","size(%1,\'*\')","vec",1,"vec",1,"str",1),exprs); + if (!ok) { + break; + } + mess = []; + if (size(in1,"*")<=0) { + mess = [[mess],["Block must have at least one input port"],[" "]]; + ok = false; + } + if (min(in1)<=0) { + mess = [[mess],["Port sizes must be positive"],[" "]]; + ok = false; + } + if (size(clrs,"*")<sum(in1)) { + mess = [[mess],["Not enough colors defined (at least "+string(sum(in1))+")"],[" "]]; + ok = false; + } + if (size(wpos,"*")!=0&&size(wpos,"*")!=2) { + mess = [[mess],["Window position must be [] or a 2 vector"],[" "]]; + ok = false; + } + if (size(wdim,"*")!=0&&size(wdim,"*")!=2) { + mess = [[mess],["Window dim must be [] or a 2 vector"],[" "]]; + ok = false; + } + if (win<-1) { + mess = [[mess],["Window number can\'t be < -1"],[" "]]; + ok = false; + } + if (size(per,"*")!=size(ymin,"*")) { + mess = [[mess],["Size of Refresh Period must equal size of Ymin/Ymax vector"],[" "]]; + ok = false; + } + for (i=1;i<=size(per,"*");i+=1) { + if ((per[i-1]<=0)) { + mess = [[mess],["Refresh Period must be positive"],[" "]]; + ok = false; + } + } + if (N<2) { + mess = [[mess],["Buffer size must be at least 2"],[" "]]; + ok = false; + } + if (or(ymin>=ymax)) { + mess = [[mess],["Ymax must be greater than Ymin"],[" "]]; + ok = false; + } + if (!or(heritance==[0,1])) { + mess = [[mess],["Accept herited events must be 0 or 1"],[" "]]; + ok = false; + } + if (!ok) { + message([["Some specified values are inconsistent:"],[" "],[mess]]); + } + if (ok) { + in1 = in1.slice(); + a = size(in1,1); + in2 = ones(a,1); + [model,graphics,ok] = set_io(model,graphics,list([in1,in2],ones(a,1)),list(),ones(1-heritance,1),[]); + } + if (ok) { + if (wpos==[]) { + wpos = [[-1],[-1]]; + } + if (wdim==[]) { + wdim = [[-1],[-1]]; + } + if (ok) { + period = transpose(per.slice()); + yy = [[transpose(ymin.slice())],[transpose(ymax.slice())]]; + rpar = [[0],[period.slice()],[yy.slice()]]; + clrs = clrs.slice(1-1,sum(in1)); + ipar = [[win],[size(in1,"*")],[N],[wpos.slice()],[wdim.slice()],[in1.slice()],[clrs.slice()],[heritance]]; + model.evtin = ones(1-heritance,1); + model.dstate = []; + model.rpar = rpar; + model.ipar = ipar; + model.label = nom; + graphics.id = nom; + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } + } } } diff --git a/js/Sinks/CMSCOPE.pickle b/js/Sinks/CMSCOPE.pickle index 154645d8..0d1dde24 100644 --- a/js/Sinks/CMSCOPE.pickle +++ b/js/Sinks/CMSCOPE.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/Sinks/CSCOPE.js b/js/Sinks/CSCOPE.js index 7b82402f..666b07a6 100644 --- a/js/Sinks/CSCOPE.js +++ b/js/Sinks/CSCOPE.js @@ -20,76 +20,77 @@ function CSCOPE() { model.dep_ut = [true,false]; exprs = [[strcat(string(clrs)," ")],[string(win)],[sci2exp([])],[sci2exp(wdim)],[string(ymin)],[string(ymax)],[string(per)],[string(N)],[transpose(string(0))],[emptystr()]]; gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } CSCOPE.prototype.details = function CSCOPE() { + return this.x; } CSCOPE.prototype.get = function CSCOPE() { } CSCOPE.prototype.set = function CSCOPE() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,clrs,win,wpos,wdim,ymin,ymax,per,N,heritance,nom,exprs] = scicos_getvalue("Set Scope parameters",[["Color (>0) or mark (<0) vector (8 entries)"],["Output window number (-1 for automatic)"],["Output window position"],["Output window sizes"],["Ymin"],["Ymax"],["Refresh period"],["Buffer size","Accept herited events 0/1","Name of Scope (label&Id)"]],list("vec",8,"vec",1,"vec",-1,"vec",-1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"str",1),exprs); - if (!ok) { -break; -} - mess = []; - if (size(wpos,"*")!=0&&size(wpos,"*")!=2) { - mess = [[mess],["Window position must be [] or a 2 vector"],[" "]]; - ok = false; -} - if (size(wdim,"*")!=0&&size(wdim,"*")!=2) { - mess = [[mess],["Window dim must be [] or a 2 vector"],[" "]]; - ok = false; -} - if (win<-1) { - mess = [[mess],["Window number can\'t be < -1"],[" "]]; - ok = false; -} - if (per<=0) { - mess = [[mess],["Refresh period must be positive"],[" "]]; - ok = false; -} - if (N<2) { - mess = [[mess],["Buffer size must be at least 2"],[" "]]; - ok = false; -} - if (ymin>=ymax) { - mess = [[mess],["Ymax must be greater than Ymin"],[" "]]; - ok = false; -} - if (!or(heritance==[0,1])) { - mess = [[mess],["Accept herited events must be 0 or 1"],[" "]]; - ok = false; -} - if (!ok) { -message([["Some specified values are inconsistent:"],[" "],[mess]]); -} - if (ok) { - [model,graphics,ok] = set_io(model,graphics,list([-1,1],1),list(),ones(1-heritance,1),[]); -} - if (ok) { - if (wpos==[]) { - wpos = [[-1],[-1]]; -} - if (wdim==[]) { - wdim = [[-1],[-1]]; -} - rpar = [[0],[ymin],[ymax],[per]]; - ipar = [[win],[1],[N],[clrs.slice()],[wpos.slice()],[wdim.slice()]]; - model.rpar = rpar; - model.ipar = ipar; - model.evtin = ones(1-heritance,1); - model.label = nom; - graphics.id = nom; - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,clrs,win,wpos,wdim,ymin,ymax,per,N,heritance,nom,exprs] = scicos_getvalue("Set Scope parameters",[["Color (>0) or mark (<0) vector (8 entries)"],["Output window number (-1 for automatic)"],["Output window position"],["Output window sizes"],["Ymin"],["Ymax"],["Refresh period"],["Buffer size","Accept herited events 0/1","Name of Scope (label&Id)"]],list("vec",8,"vec",1,"vec",-1,"vec",-1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"str",1),exprs); + if (!ok) { + break; + } + mess = []; + if (size(wpos,"*")!=0&&size(wpos,"*")!=2) { + mess = [[mess],["Window position must be [] or a 2 vector"],[" "]]; + ok = false; + } + if (size(wdim,"*")!=0&&size(wdim,"*")!=2) { + mess = [[mess],["Window dim must be [] or a 2 vector"],[" "]]; + ok = false; + } + if (win<-1) { + mess = [[mess],["Window number can\'t be < -1"],[" "]]; + ok = false; + } + if (per<=0) { + mess = [[mess],["Refresh period must be positive"],[" "]]; + ok = false; + } + if (N<2) { + mess = [[mess],["Buffer size must be at least 2"],[" "]]; + ok = false; + } + if (ymin>=ymax) { + mess = [[mess],["Ymax must be greater than Ymin"],[" "]]; + ok = false; + } + if (!or(heritance==[0,1])) { + mess = [[mess],["Accept herited events must be 0 or 1"],[" "]]; + ok = false; + } + if (!ok) { + message([["Some specified values are inconsistent:"],[" "],[mess]]); + } + if (ok) { + [model,graphics,ok] = set_io(model,graphics,list([-1,1],1),list(),ones(1-heritance,1),[]); + } + if (ok) { + if (wpos==[]) { + wpos = [[-1],[-1]]; + } + if (wdim==[]) { + wdim = [[-1],[-1]]; + } + rpar = [[0],[ymin],[ymax],[per]]; + ipar = [[win],[1],[N],[clrs.slice()],[wpos.slice()],[wdim.slice()]]; + model.rpar = rpar; + model.ipar = ipar; + model.evtin = ones(1-heritance,1); + model.label = nom; + graphics.id = nom; + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Sinks/CSCOPE.pickle b/js/Sinks/CSCOPE.pickle index 154645d8..0d1dde24 100644 --- a/js/Sinks/CSCOPE.pickle +++ b/js/Sinks/CSCOPE.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/Sinks/CSCOPXY.js b/js/Sinks/CSCOPXY.js index 2802f5a4..f06a4980 100644 --- a/js/Sinks/CSCOPXY.js +++ b/js/Sinks/CSCOPXY.js @@ -24,76 +24,77 @@ function CSCOPXY() { model.dep_ut = [false,false]; exprs = [[string(nbr_curves)],[sci2exp(clrs)],[sci2exp(siz)],[string(win)],[sci2exp([])],[sci2exp(wdim)],[string(xmin)],[string(xmax)],[string(ymin)],[string(ymax)],[string(N)]]; gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } CSCOPXY.prototype.details = function CSCOPXY() { + return this.x; } CSCOPXY.prototype.get = function CSCOPXY() { } CSCOPXY.prototype.set = function CSCOPXY() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,nbr_curves,clrs,siz,win,wpos,wdim,xmin,xmax,ymin,ymax,N,exprs] = scicos_getvalue("Set Scope parameters",[["Number of Curves"],["color (>0) or mark (<0)"],["line or mark size"],["Output window number (-1 for automatic)"],["Output window position"],["Output window sizes"],["Xmin"],["Xmax"],["Ymin"],["Ymax"],["Buffer size"]],list("vec",1,"vec",1,"vec",1,"vec",1,"vec",-1,"vec",-1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1),exprs); - if (!ok) { -break; -} - mess = []; - if (size(wpos,"*")!=0&&size(wpos,"*")!=2) { - mess = [[mess],["Window position must be [] or a 2 vector"],[" "]]; - ok = false; -} - if (size(wdim,"*")!=0&&size(wdim,"*")!=2) { - mess = [[mess],["Window dim must be [] or a 2 vector"],[" "]]; - ok = false; -} - if (nbr_curves<=0) { - mess = [[mess],["Number of Curves cannot be negative or null"],[" "]]; - ok = false; -} - if (win<-1) { - mess = [[mess],["Window number cannot be inferior than -1"],[" "]]; - ok = false; -} - if (N<1) { - mess = [[mess],["Buffer size must be at least 1"],[" "]]; - ok = false; -} - if (N==1&&clrs>0) { - mess = [[mess],["Buffer size must be at least 2"],[" "]]; - ok = false; -} - if (ymin>=ymax) { - mess = [[mess],["Ymax must be greater than Ymin"],[" "]]; - ok = false; -} - if (xmin>=xmax) { - mess = [[mess],["Xmax must be greater than Xmin"],[" "]]; - ok = false; -} - if (!ok) { -message(mess); - } else { - in1 = nbr_curves*ones(2,1); - in2 = ones(2,1); - [model,graphics,ok] = set_io(model,graphics,list([in1,in2],ones(2,1)),list(),ones(1,1),[]); - if (wpos==[]) { - wpos = [[-1],[-1]]; -} - if (wdim==[]) { - wdim = [[-1],[-1]]; -} - rpar = [[xmin],[xmax],[ymin],[ymax]]; - ipar = [[win],[1],[N],[clrs],[siz],[1],[wpos.slice()],[wdim.slice()],[nbr_curves]]; - model.rpar = rpar; - model.ipar = ipar; - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,nbr_curves,clrs,siz,win,wpos,wdim,xmin,xmax,ymin,ymax,N,exprs] = scicos_getvalue("Set Scope parameters",[["Number of Curves"],["color (>0) or mark (<0)"],["line or mark size"],["Output window number (-1 for automatic)"],["Output window position"],["Output window sizes"],["Xmin"],["Xmax"],["Ymin"],["Ymax"],["Buffer size"]],list("vec",1,"vec",1,"vec",1,"vec",1,"vec",-1,"vec",-1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1),exprs); + if (!ok) { + break; + } + mess = []; + if (size(wpos,"*")!=0&&size(wpos,"*")!=2) { + mess = [[mess],["Window position must be [] or a 2 vector"],[" "]]; + ok = false; + } + if (size(wdim,"*")!=0&&size(wdim,"*")!=2) { + mess = [[mess],["Window dim must be [] or a 2 vector"],[" "]]; + ok = false; + } + if (nbr_curves<=0) { + mess = [[mess],["Number of Curves cannot be negative or null"],[" "]]; + ok = false; + } + if (win<-1) { + mess = [[mess],["Window number cannot be inferior than -1"],[" "]]; + ok = false; + } + if (N<1) { + mess = [[mess],["Buffer size must be at least 1"],[" "]]; + ok = false; + } + if (N==1&&clrs>0) { + mess = [[mess],["Buffer size must be at least 2"],[" "]]; + ok = false; + } + if (ymin>=ymax) { + mess = [[mess],["Ymax must be greater than Ymin"],[" "]]; + ok = false; + } + if (xmin>=xmax) { + mess = [[mess],["Xmax must be greater than Xmin"],[" "]]; + ok = false; + } + if (!ok) { + message(mess); + } else { + in1 = nbr_curves*ones(2,1); + in2 = ones(2,1); + [model,graphics,ok] = set_io(model,graphics,list([in1,in2],ones(2,1)),list(),ones(1,1),[]); + if (wpos==[]) { + wpos = [[-1],[-1]]; + } + if (wdim==[]) { + wdim = [[-1],[-1]]; + } + rpar = [[xmin],[xmax],[ymin],[ymax]]; + ipar = [[win],[1],[N],[clrs],[siz],[1],[wpos.slice()],[wdim.slice()],[nbr_curves]]; + model.rpar = rpar; + model.ipar = ipar; + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Sinks/CSCOPXY.pickle b/js/Sinks/CSCOPXY.pickle index 154645d8..0d1dde24 100644 --- a/js/Sinks/CSCOPXY.pickle +++ b/js/Sinks/CSCOPXY.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/Sinks/CSCOPXY3D.js b/js/Sinks/CSCOPXY3D.js index 79af931a..b2751f5c 100644 --- a/js/Sinks/CSCOPXY3D.js +++ b/js/Sinks/CSCOPXY3D.js @@ -24,89 +24,90 @@ function CSCOPXY3D() { model.dep_ut = [false,false]; exprs = [[string(nbr_curves)],[strcat(string(clrs)," ")],[strcat(string(siz)," ")],[string(win)],[sci2exp([])],[sci2exp(wdim)],[strcat(string(vec_x)," ")],[strcat(string(vec_y)," ")],[strcat(string(vec_z)," ")],[strcat(string(param3ds)," ")],[string(N)]]; gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); + this.x = standard_define([2,2],model,exprs,gr_i); } CSCOPXY3D.prototype.details = function CSCOPXY3D() { + return this.x; } CSCOPXY3D.prototype.get = function CSCOPXY3D() { } CSCOPXY3D.prototype.set = function CSCOPXY3D() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,nbr_curves,clrs,siz,win,wpos,wdim,vec_x,vec_y,vec_z,param3ds,N,exprs] = scicos_getvalue("Set Scope parameters",[["Number of curves"],["color (>0) or mark (<0)"],["Line or Mark Size"],["Output window number (-1 for automatic)"],["Output window position"],["Output window sizes"],["Xmin and Xmax"],["Ymin and Ymax"],["Zmin and Zmax"],["Alpha and Theta"],["Buffer size"]],list("vec",1,"vec",-1,"vec",-1,"vec",1,"vec",-1,"vec",-1,"vec",2,"vec",2,"vec",2,"vec",2,"vec",1),exprs); - if (!ok) { -break; -} - mess = []; - if (size(wpos,"*")!=0&&size(wpos,"*")!=2) { - mess = [[mess],["Window position must be [] or a 2 vector"],[" "]]; - ok = false; -} - if (size(wdim,"*")!=0&&size(wdim,"*")!=2) { - mess = [[mess],["Window dim must be [] or a 2 vector"],[" "]]; - ok = false; -} - if (size(clrs,"*")!=size(siz,"*")) { - mess = [[mess],["Colors and Size must have same size"],[" "]]; - ok = false; -} - if (nbr_curves<=0) { - mess = [[mess],["Number of curves cannot be negative or null"],[" "]]; - ok = false; -} - if (win<-1) { - mess = [[mess],["Window number cannot be inferior than -1"],[" "]]; - ok = false; -} - if (N<1) { - mess = [[mess],["Buffer size must be at least 1"],[" "]]; - ok = false; -} - if (N<2) { -for (i=1;i<=size(clrs,"*");i+=1) { - if (clrs[i-1]>0) { - mess = [[mess],["Buffer size must be at least 2 or Change a color (must be >0)"],[" "]]; - ok = false; -} -} -} - if (vec_y[1-1]>=vec_y[2-1]) { - mess = [[mess],["Ymax must be higher than Ymin"],[" "]]; - ok = false; -} - if (vec_x[1-1]>=vec_x[2-1]) { - mess = [[mess],["Xmax must be higher than Xmin"],[" "]]; - ok = false; -} - if (vec_z[1-1]>=vec_z[2-1]) { - mess = [[mess],["Zmax must be higher than Zmin"],[" "]]; - ok = false; -} - if (ok) { - in1 = nbr_curves*ones(3,1); - in2 = ones(3,1); - [model,graphics,ok] = set_io(model,graphics,list([in1,in2],ones(3,1)),list(),ones(1,1),[]); - if (wpos==[]) { - wpos = [[-1],[-1]]; -} - if (wdim==[]) { - wdim = [[-1],[-1]]; -} - rpar = [[vec_x.slice()],[vec_y.slice()],[vec_z.slice()],[param3ds.slice()]]; - size_siz = size(siz,"*"); - ipar = [[win],[size_siz],[N],[clrs.slice()],[siz.slice()],[1],[wpos.slice()],[wdim.slice()],[nbr_curves]]; - model.rpar = rpar; - model.ipar = ipar; - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; - } else { -message(mess); -} -} + [ok,nbr_curves,clrs,siz,win,wpos,wdim,vec_x,vec_y,vec_z,param3ds,N,exprs] = scicos_getvalue("Set Scope parameters",[["Number of curves"],["color (>0) or mark (<0)"],["Line or Mark Size"],["Output window number (-1 for automatic)"],["Output window position"],["Output window sizes"],["Xmin and Xmax"],["Ymin and Ymax"],["Zmin and Zmax"],["Alpha and Theta"],["Buffer size"]],list("vec",1,"vec",-1,"vec",-1,"vec",1,"vec",-1,"vec",-1,"vec",2,"vec",2,"vec",2,"vec",2,"vec",1),exprs); + if (!ok) { + break; + } + mess = []; + if (size(wpos,"*")!=0&&size(wpos,"*")!=2) { + mess = [[mess],["Window position must be [] or a 2 vector"],[" "]]; + ok = false; + } + if (size(wdim,"*")!=0&&size(wdim,"*")!=2) { + mess = [[mess],["Window dim must be [] or a 2 vector"],[" "]]; + ok = false; + } + if (size(clrs,"*")!=size(siz,"*")) { + mess = [[mess],["Colors and Size must have same size"],[" "]]; + ok = false; + } + if (nbr_curves<=0) { + mess = [[mess],["Number of curves cannot be negative or null"],[" "]]; + ok = false; + } + if (win<-1) { + mess = [[mess],["Window number cannot be inferior than -1"],[" "]]; + ok = false; + } + if (N<1) { + mess = [[mess],["Buffer size must be at least 1"],[" "]]; + ok = false; + } + if (N<2) { + for (i=1;i<=size(clrs,"*");i+=1) { + if (clrs[i-1]>0) { + mess = [[mess],["Buffer size must be at least 2 or Change a color (must be >0)"],[" "]]; + ok = false; + } + } + } + if (vec_y[1-1]>=vec_y[2-1]) { + mess = [[mess],["Ymax must be higher than Ymin"],[" "]]; + ok = false; + } + if (vec_x[1-1]>=vec_x[2-1]) { + mess = [[mess],["Xmax must be higher than Xmin"],[" "]]; + ok = false; + } + if (vec_z[1-1]>=vec_z[2-1]) { + mess = [[mess],["Zmax must be higher than Zmin"],[" "]]; + ok = false; + } + if (ok) { + in1 = nbr_curves*ones(3,1); + in2 = ones(3,1); + [model,graphics,ok] = set_io(model,graphics,list([in1,in2],ones(3,1)),list(),ones(1,1),[]); + if (wpos==[]) { + wpos = [[-1],[-1]]; + } + if (wdim==[]) { + wdim = [[-1],[-1]]; + } + rpar = [[vec_x.slice()],[vec_y.slice()],[vec_z.slice()],[param3ds.slice()]]; + size_siz = size(siz,"*"); + ipar = [[win],[size_siz],[N],[clrs.slice()],[siz.slice()],[1],[wpos.slice()],[wdim.slice()],[nbr_curves]]; + model.rpar = rpar; + model.ipar = ipar; + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } else { + message(mess); + } + } } } diff --git a/js/Sinks/CSCOPXY3D.pickle b/js/Sinks/CSCOPXY3D.pickle index 154645d8..0d1dde24 100644 --- a/js/Sinks/CSCOPXY3D.pickle +++ b/js/Sinks/CSCOPXY3D.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/Sinks/OUTIMPL_f.js b/js/Sinks/OUTIMPL_f.js index 7bc12dad..c77851b6 100644 --- a/js/Sinks/OUTIMPL_f.js +++ b/js/Sinks/OUTIMPL_f.js @@ -15,40 +15,41 @@ function OUTIMPL_f() { model.equations = mo; exprs = "1"; gr_i = []; - x = standard_define([1,1],model,exprs,gr_i); - x.graphics.in_implicit = ["I"]; + this.x = standard_define([1,1],model,exprs,gr_i); + this.x.graphics.in_implicit = ["I"]; } OUTIMPL_f.prototype.details = function OUTIMPL_f() { + return this.x; } OUTIMPL_f.prototype.get = function OUTIMPL_f() { } OUTIMPL_f.prototype.set = function OUTIMPL_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"),"OUTIMPL_f")],[" "],[gettext("Implicit output port")]],gettext("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"),"OUTIMPL_f")],[" "],[gettext("Implicit output port")]],gettext("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/Sinks/OUTIMPL_f.pickle b/js/Sinks/OUTIMPL_f.pickle index 154645d8..0d1dde24 100644 --- a/js/Sinks/OUTIMPL_f.pickle +++ b/js/Sinks/OUTIMPL_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/Sinks/OUT_f.js b/js/Sinks/OUT_f.js index b2ff10e3..e339d285 100644 --- a/js/Sinks/OUT_f.js +++ b/js/Sinks/OUT_f.js @@ -13,35 +13,36 @@ function OUT_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); } OUT_f.prototype.details = function OUT_f() { + return this.x; } OUT_f.prototype.get = function OUT_f() { } OUT_f.prototype.set = function OUT_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]; + } while (true) { - [ok,prt,exprs] = scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"OUT_f")],[" "],[gettext("Regular output port")]],gettext("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 { - model.ipar = prt; - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,prt,exprs] = scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"OUT_f")],[" "],[gettext("Regular output port")]],gettext("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 { + model.ipar = prt; + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Sinks/OUT_f.pickle b/js/Sinks/OUT_f.pickle index 154645d8..0d1dde24 100644 --- a/js/Sinks/OUT_f.pickle +++ b/js/Sinks/OUT_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/Sinks/TOWS_c.js b/js/Sinks/TOWS_c.js index d69b9110..feaf8354 100644 --- a/js/Sinks/TOWS_c.js +++ b/js/Sinks/TOWS_c.js @@ -20,46 +20,47 @@ function TOWS_c() { model.dep_ut = [false,false]; gr_i = []; exprs = [[string(nz)],[string(varnam)],[string(herit)]]; - x = standard_define([4,2],model,exprs,gr_i); + this.x = standard_define([4,2],model,exprs,gr_i); } TOWS_c.prototype.details = function TOWS_c() { + return this.x; } TOWS_c.prototype.get = function TOWS_c() { } TOWS_c.prototype.set = function TOWS_c() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; model = arg1.model; exprs = graphics.exprs; while (true) { - [ok,nz,varnam,herit,exprs] = scicos_getvalue("Set Xcos buffer block",[["Size of buffer"],["Scilab variable name"],["Inherit (no:0, yes:1)"]],list("vec",1,"str",1,"vec",1),exprs); - if (!ok) { -break; -} - if ((nz<=0)) { -message("Size of buffer must be positive"); - ok = false; -} - r = false; - ierr = execstr("r = validvar(varnam)","errcatch"); - if (!r||ierr!=0||length(varnam)>19) { -message([["Invalid variable name."],["Please choose another variable name."]]); - ok = false; -} -execstr("if type("+varnam+") <> 17 | or(fieldnames("+varnam+") <> [\"values\"; \"time\"]) then"+" message([\"Protected variable name.\"; \"Please choose another variable name.\"]);"+" ok = %f;"+" end","errcatch"); - if (ok) { - [model,graphics,ok] = set_io(model,graphics,list([-1,-2],-1),list(),ones(1-herit,1),[]); - if (herit==1) { - model.blocktype = "x"; - } else { - model.blocktype = "d"; -} - model.ipar = [[nz],[length(varnam)],[transpose(this.ascii[varnam-1])]]; - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,nz,varnam,herit,exprs] = scicos_getvalue("Set Xcos buffer block",[["Size of buffer"],["Scilab variable name"],["Inherit (no:0, yes:1)"]],list("vec",1,"str",1,"vec",1),exprs); + if (!ok) { + break; + } + if ((nz<=0)) { + message("Size of buffer must be positive"); + ok = false; + } + r = false; + ierr = execstr("r = validvar(varnam)","errcatch"); + if (!r||ierr!=0||length(varnam)>19) { + message([["Invalid variable name."],["Please choose another variable name."]]); + ok = false; + } + execstr("if type("+varnam+") <> 17 | or(fieldnames("+varnam+") <> [\"values\"; \"time\"]) then"+" message([\"Protected variable name.\"; \"Please choose another variable name.\"]);"+" ok = %f;"+" end","errcatch"); + if (ok) { + [model,graphics,ok] = set_io(model,graphics,list([-1,-2],-1),list(),ones(1-herit,1),[]); + if (herit==1) { + model.blocktype = "x"; + } else { + model.blocktype = "d"; + } + model.ipar = [[nz],[length(varnam)],[transpose(this.ascii[varnam-1])]]; + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Sinks/TOWS_c.pickle b/js/Sinks/TOWS_c.pickle index 78d6aa96..62d608a3 100644 --- a/js/Sinks/TOWS_c.pickle +++ b/js/Sinks/TOWS_c.pickle @@ -2,8 +2,10 @@ c__builtin__ set p0 ((lp1 -S'ascii' +S'x' p2 -atp3 -Rp4 +aS'ascii' +p3 +atp4 +Rp5 .
\ No newline at end of file diff --git a/js/Sinks/TRASH_f.js b/js/Sinks/TRASH_f.js index 691a96af..08d08d47 100644 --- a/js/Sinks/TRASH_f.js +++ b/js/Sinks/TRASH_f.js @@ -10,13 +10,14 @@ function TRASH_f() { 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); } TRASH_f.prototype.details = function TRASH_f() { + return this.x; } TRASH_f.prototype.get = function TRASH_f() { } TRASH_f.prototype.set = function TRASH_f() { - x = arg1; + this.x = arg1; } } diff --git a/js/Sinks/TRASH_f.pickle b/js/Sinks/TRASH_f.pickle index 154645d8..0d1dde24 100644 --- a/js/Sinks/TRASH_f.pickle +++ b/js/Sinks/TRASH_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/Sinks/WFILE_f.js b/js/Sinks/WFILE_f.js index 9acdb952..b1b5a5b9 100644 --- a/js/Sinks/WFILE_f.js +++ b/js/Sinks/WFILE_f.js @@ -17,19 +17,20 @@ function WFILE_f() { model.dep_ut = [true,false]; exprs = [[sci2exp(in1)],[fname],[frmt],[string(N)]]; gr_i = []; - x = standard_define([3,2],model,exprs,gr_i); + this.x = standard_define([3,2],model,exprs,gr_i); } WFILE_f.prototype.details = function WFILE_f() { + return this.x; } WFILE_f.prototype.get = function WFILE_f() { } WFILE_f.prototype.set = function WFILE_f() { -warnobsolete("WRITEC_f","6.0.0"); + warnobsolete("WRITEC_f","6.0.0"); warnMessage = msprintf(_("Feature %s is obsolete."),"WFILE_f"); warnAdvise = msprintf(_("Please use %s instead."),"WRITEC_f"); warnXcosMessage = msprintf("%s %s",warnMessage,warnAdvise); -warnBlockByUID(arg1.model.label,warnXcosMessage); - x = arg1; + warnBlockByUID(arg1.model.label,warnXcosMessage); + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; @@ -38,53 +39,53 @@ warnBlockByUID(arg1.model.label,warnXcosMessage); fname = exprs[2-1]; frmt = exprs[3-1]; while (true) { - [ok,in1,fname1,frmt1,N,exprs] = scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"WFILE_f")],[" "],[gettext("Write to output file")],[" "],[gettext("Write is done on:")],[gettext(" - A binary file if no format given")],[gettext(" - A formatted text file if a format (Fortran type) is given")]],[[gettext("Input Size")],[gettext("Output File Name")],[gettext("Output Format")],[gettext("Buffer Size")]],list("vec",1,"str",1,"str",1,"vec",1),exprs); - if (!ok) { -break; -} - in1 = int(in1); - nin = in1; - fname1 = pathconvert(stripblanks(fname1),false,true); - frmt1 = stripblanks(frmt1); - 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 when running"),gettext("End current simulation first.")); - ok = false; - } else if (lunit>0&&fname1!=fname) { -block_parameter_error(gettext("You cannot modify \'Output File Name\' when running."),gettext("End current simulation first.")); - ok = false; - } else if (fname1=="") { -block_parameter_error(gettext("Wrong value for \'Output File Name\' parameter"),gettext("You must provide a filename.")); - ok = false; - } else if (fileparts(fname1)!="") { - [pa,fn,ex] = fileparts(fname1); - if (!this.isdir[pa-1]) { -block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter."),gettext("Output File Name")),msprintf(gettext("Directory \'%s\' does not exist"),pa)); - ok = false; -} - } else if (frmt1!=""&&(part(frmt1,1)!="("||part(frmt1,length(frmt1))!=")")) { -block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %s."),gettext("Input Format"),frmt1),gettext("You must enclose the format\'s string between parentheses.")); - ok = false; - } else if (N<2) { -block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Buffer Size"),N),gettext("Must be greater than 1.")); - ok = false; - } else if (in1<=0) { -block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Input Size"),in1),gettext("Strictly positive integer expected.")); - ok = false; -} - if (ok) { - ipar = [[length(fname1)],[length(frmt1)],[0],[N],[this._str2code[fname1-1]],[this._str2code[frmt1-1]]]; - if (prod(size(dstate))!=(nin+1)*N+2) { - dstate = [[-1],[lunit],[zeros((nin+1)*N,1)]]; -} - model.in1 = nin; - model.dstate = dstate; - model.ipar = ipar; - model.dep_ut = [true,false]; - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,in1,fname1,frmt1,N,exprs] = scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"WFILE_f")],[" "],[gettext("Write to output file")],[" "],[gettext("Write is done on:")],[gettext(" - A binary file if no format given")],[gettext(" - A formatted text file if a format (Fortran type) is given")]],[[gettext("Input Size")],[gettext("Output File Name")],[gettext("Output Format")],[gettext("Buffer Size")]],list("vec",1,"str",1,"str",1,"vec",1),exprs); + if (!ok) { + break; + } + in1 = int(in1); + nin = in1; + fname1 = pathconvert(stripblanks(fname1),false,true); + frmt1 = stripblanks(frmt1); + 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 when running"),gettext("End current simulation first.")); + ok = false; + } else if (lunit>0&&fname1!=fname) { + block_parameter_error(gettext("You cannot modify \'Output File Name\' when running."),gettext("End current simulation first.")); + ok = false; + } else if (fname1=="") { + block_parameter_error(gettext("Wrong value for \'Output File Name\' parameter"),gettext("You must provide a filename.")); + ok = false; + } else if (fileparts(fname1)!="") { + [pa,fn,ex] = fileparts(fname1); + if (!this.isdir[pa-1]) { + block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter."),gettext("Output File Name")),msprintf(gettext("Directory \'%s\' does not exist"),pa)); + ok = false; + } + } else if (frmt1!=""&&(part(frmt1,1)!="("||part(frmt1,length(frmt1))!=")")) { + block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %s."),gettext("Input Format"),frmt1),gettext("You must enclose the format\'s string between parentheses.")); + ok = false; + } else if (N<2) { + block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Buffer Size"),N),gettext("Must be greater than 1.")); + ok = false; + } else if (in1<=0) { + block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Input Size"),in1),gettext("Strictly positive integer expected.")); + ok = false; + } + if (ok) { + ipar = [[length(fname1)],[length(frmt1)],[0],[N],[this._str2code[fname1-1]],[this._str2code[frmt1-1]]]; + if (prod(size(dstate))!=(nin+1)*N+2) { + dstate = [[-1],[lunit],[zeros((nin+1)*N,1)]]; + } + model.in1 = nin; + model.dstate = dstate; + model.ipar = ipar; + model.dep_ut = [true,false]; + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Sinks/WFILE_f.pickle b/js/Sinks/WFILE_f.pickle index c7024ed7..0cb2ae6e 100644 --- a/js/Sinks/WFILE_f.pickle +++ b/js/Sinks/WFILE_f.pickle @@ -4,8 +4,10 @@ p0 ((lp1 S'isdir' p2 -aS'_str2code' +aS'x' p3 -atp4 -Rp5 +aS'_str2code' +p4 +atp5 +Rp6 .
\ No newline at end of file diff --git a/js/Sinks/WRITEAU_f.js b/js/Sinks/WRITEAU_f.js index 847a2140..40833663 100644 --- a/js/Sinks/WRITEAU_f.js +++ b/js/Sinks/WRITEAU_f.js @@ -18,14 +18,15 @@ function WRITEAU_f() { model.dep_ut = [true,false]; exprs = [string(N),string(swap)]; gr_i = []; - x = standard_define([4,2],model,exprs,gr_i); + this.x = standard_define([4,2],model,exprs,gr_i); } WRITEAU_f.prototype.details = function WRITEAU_f() { + return this.x; } WRITEAU_f.prototype.get = function WRITEAU_f() { } WRITEAU_f.prototype.set = function WRITEAU_f() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; @@ -33,37 +34,37 @@ function WRITEAU_f() { dstate = model.dstate; lunit = dstate[2-1]; while (true) { - [ok,N,swap,exprs] = scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"WRITEAU_f")],[" "],[gettext("Write \'.au\' sound file on audio device")]],[[gettext("Buffer Size")],[gettext("Swap Mode (0:No, 1:Yes)")]],list("vec",1,"vec",1),exprs); - if (!ok) { -break; -} - nin = 1; - fname1 = "/dev/audio"; - frmt1 = "uc "; - if (this.alreadyran&&(N!=ipar[5-1])) { -block_parameter_error(msprintf(gettext("You cannot modify \'%s\' when running."),gettext("Buffer Size")),gettext("End current simulation first")); - ok = false; - } else if (N<1) { -block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Buffer Size"),N),gettext("Strictly positive integer expected.")); - ok = false; -} - 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]")); - ok = false; -} - if (ok) { - ipar = [[length(fname1)],[this._str2code[frmt1-1]],[N],[swap],[this._str2code[fname1-1]]]; - if (prod(size(dstate))!=(nin+1)*N+2) { - dstate = [[-1],[lunit],[zeros((nin+1)*N,1)]]; -} - model.in1 = 1; - model.dstate = dstate; - model.ipar = ipar; - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,N,swap,exprs] = scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"WRITEAU_f")],[" "],[gettext("Write \'.au\' sound file on audio device")]],[[gettext("Buffer Size")],[gettext("Swap Mode (0:No, 1:Yes)")]],list("vec",1,"vec",1),exprs); + if (!ok) { + break; + } + nin = 1; + fname1 = "/dev/audio"; + frmt1 = "uc "; + if (this.alreadyran&&(N!=ipar[5-1])) { + block_parameter_error(msprintf(gettext("You cannot modify \'%s\' when running."),gettext("Buffer Size")),gettext("End current simulation first")); + ok = false; + } else if (N<1) { + block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Buffer Size"),N),gettext("Strictly positive integer expected.")); + ok = false; + } + 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]")); + ok = false; + } + if (ok) { + ipar = [[length(fname1)],[this._str2code[frmt1-1]],[N],[swap],[this._str2code[fname1-1]]]; + if (prod(size(dstate))!=(nin+1)*N+2) { + dstate = [[-1],[lunit],[zeros((nin+1)*N,1)]]; + } + model.in1 = 1; + model.dstate = dstate; + model.ipar = ipar; + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Sinks/WRITEAU_f.pickle b/js/Sinks/WRITEAU_f.pickle index 62a7fafc..8a32035f 100644 --- a/js/Sinks/WRITEAU_f.pickle +++ b/js/Sinks/WRITEAU_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/Sinks/WRITEC_f.js b/js/Sinks/WRITEC_f.js index dfe9db07..20e8e20c 100644 --- a/js/Sinks/WRITEC_f.js +++ b/js/Sinks/WRITEC_f.js @@ -18,14 +18,15 @@ function WRITEC_f() { model.dep_ut = [true,false]; exprs = [[sci2exp(in1)],[fname],[frmt],[string(N),string(swap)]]; gr_i = []; - x = standard_define([4,2],model,exprs,gr_i); + this.x = standard_define([4,2],model,exprs,gr_i); } WRITEC_f.prototype.details = function WRITEC_f() { + return this.x; } WRITEC_f.prototype.get = function WRITEC_f() { } WRITEC_f.prototype.set = function WRITEC_f() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; @@ -35,56 +36,56 @@ function WRITEC_f() { fname = exprs[2-1]; frmt = exprs[3-1]; while (true) { - [ok,in1,fname1,frmt1,N,swap,exprs] = scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"WRITEC_f")],[" "],[gettext("Write to C binary file")]],[[gettext("Input Size")],[gettext("Output File Name")],[gettext("Output Format")],[gettext("Buffer Size")],[gettext("Swap Mode (0:No, 1:Yes)")]],list("vec",1,"str",1,"str",1,"vec",1,"vec",1),exprs); - if (!ok) { -break; -} - in1 = int(in1); - nin = in1; - 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"]; - 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,", "))); - ok = false; - } else if (this.alreadyran&&fname1!=fname) { -block_parameter_error(msprintf(gettext("You cannot modify \'%s\' when running"),gettext("Input Format")),gettext("End current simulation first.")); - ok = false; - } else if (this.alreadyran&&N!=ipar[5-1]) { -block_parameter_error(msprintf(gettext("You cannot modify \'Buffer Size\' when running."),gettext("Buffer Size")),gettext("End current simulation first")); - ok = false; - } else if (fname1=="") { -block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter."),gettext("Output File Name")),gettext("You must provide a filename.")); - } else if (fileparts(fname1)!="") { - [pa,fn,ex] = fileparts(fname1); - if (!this.isdir[pa-1]) { -block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter."),gettext("Output File Name")),msprintf(gettext("Directory \'%s\' does not exist"),pa)); - ok = false; -} - } else if (N<1) { -block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Buffer Size"),N),gettext("Strictly positive integer expected.")); - ok = false; - } else if (in1<=0) { -block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Input Size"),in1),gettext("Strictly positive integer expected.")); - ok = false; - } 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]")); - ok = false; -} - frmt1 = part(frmt1,1,3); - if (ok) { - ipar = [[length(fname1)],[this._str2code[frmt1-1]],[N],[swap],[this._str2code[fname1-1]]]; - if (prod(size(dstate))!=(nin+1)*N+2) { - dstate = [[-1],[lunit],[zeros((nin+1)*N,1)]]; -} - model.in1 = nin; - model.dstate = dstate; - model.ipar = ipar; - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} -} + [ok,in1,fname1,frmt1,N,swap,exprs] = scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"WRITEC_f")],[" "],[gettext("Write to C binary file")]],[[gettext("Input Size")],[gettext("Output File Name")],[gettext("Output Format")],[gettext("Buffer Size")],[gettext("Swap Mode (0:No, 1:Yes)")]],list("vec",1,"str",1,"str",1,"vec",1,"vec",1),exprs); + if (!ok) { + break; + } + in1 = int(in1); + nin = in1; + 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"]; + 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,", "))); + ok = false; + } else if (this.alreadyran&&fname1!=fname) { + block_parameter_error(msprintf(gettext("You cannot modify \'%s\' when running"),gettext("Input Format")),gettext("End current simulation first.")); + ok = false; + } else if (this.alreadyran&&N!=ipar[5-1]) { + block_parameter_error(msprintf(gettext("You cannot modify \'Buffer Size\' when running."),gettext("Buffer Size")),gettext("End current simulation first")); + ok = false; + } else if (fname1=="") { + block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter."),gettext("Output File Name")),gettext("You must provide a filename.")); + } else if (fileparts(fname1)!="") { + [pa,fn,ex] = fileparts(fname1); + if (!this.isdir[pa-1]) { + block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter."),gettext("Output File Name")),msprintf(gettext("Directory \'%s\' does not exist"),pa)); + ok = false; + } + } else if (N<1) { + block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Buffer Size"),N),gettext("Strictly positive integer expected.")); + ok = false; + } else if (in1<=0) { + block_parameter_error(msprintf(gettext("Wrong value for \'%s\' parameter: %d."),gettext("Input Size"),in1),gettext("Strictly positive integer expected.")); + ok = false; + } 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]")); + ok = false; + } + frmt1 = part(frmt1,1,3); + if (ok) { + ipar = [[length(fname1)],[this._str2code[frmt1-1]],[N],[swap],[this._str2code[fname1-1]]]; + if (prod(size(dstate))!=(nin+1)*N+2) { + dstate = [[-1],[lunit],[zeros((nin+1)*N,1)]]; + } + model.in1 = nin; + model.dstate = dstate; + model.ipar = ipar; + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } + } } } diff --git a/js/Sinks/WRITEC_f.pickle b/js/Sinks/WRITEC_f.pickle index 80ba7661..b0c10e53 100644 --- a/js/Sinks/WRITEC_f.pickle +++ b/js/Sinks/WRITEC_f.pickle @@ -4,10 +4,12 @@ p0 ((lp1 S'isdir' p2 -aS'_str2code' +aS'x' p3 -aS'alreadyran' +aS'_str2code' p4 -atp5 -Rp6 +aS'alreadyran' +p5 +atp6 +Rp7 .
\ No newline at end of file |