diff options
author | Sunil Shetye | 2018-06-25 12:08:56 +0530 |
---|---|---|
committer | Sunil Shetye | 2018-06-25 12:45:27 +0530 |
commit | 7c70459c10aed0d74ee03896abaf47fefdbf7c8f (patch) | |
tree | 6f6acc6a5087295c6e59f0f94bfda5025049d5fa /js/Sinks/CSCOPE.js | |
parent | 870479a2e4b932426a904b2ebae7e4ee72037326 (diff) | |
download | sci2js-7c70459c10aed0d74ee03896abaf47fefdbf7c8f.tar.gz sci2js-7c70459c10aed0d74ee03896abaf47fefdbf7c8f.tar.bz2 sci2js-7c70459c10aed0d74ee03896abaf47fefdbf7c8f.zip |
separate out code for getvalue
Diffstat (limited to 'js/Sinks/CSCOPE.js')
-rw-r--r-- | js/Sinks/CSCOPE.js | 134 |
1 files changed, 67 insertions, 67 deletions
diff --git a/js/Sinks/CSCOPE.js b/js/Sinks/CSCOPE.js index a1461183..7b82402f 100644 --- a/js/Sinks/CSCOPE.js +++ b/js/Sinks/CSCOPE.js @@ -1,93 +1,93 @@ /* autogenerated from "macros/Sinks/CSCOPE.sci" */ function CSCOPE() { CSCOPE.prototype.define = function CSCOPE() { -win=-1; -wdim=[[600],[400]]; -wpos=[[-1],[-1]]; -clrs=[[1],[3],[5],[7],[9],[11],[13],[15]]; -N=20; -ymin=-15; -ymax=+15; -per=30; -model=scicos_model(); -model.sim=list("cscope",4); -model.in1=-1; -model.in2=1; -model.evtin=1; -model.rpar=[[0],[ymin],[ymax],[per]]; -model.ipar=[[win],[1],[N],[clrs],[wpos],[wdim]]; -model.blocktype="c"; -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); + win = -1; + wdim = [[600],[400]]; + wpos = [[-1],[-1]]; + clrs = [[1],[3],[5],[7],[9],[11],[13],[15]]; + N = 20; + ymin = -15; + ymax = +15; + per = 30; + model = scicos_model(); + model.sim = list("cscope",4); + model.in1 = -1; + model.in2 = 1; + model.evtin = 1; + model.rpar = [[0],[ymin],[ymax],[per]]; + model.ipar = [[win],[1],[N],[clrs],[wpos],[wdim]]; + model.blocktype = "c"; + 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); } CSCOPE.prototype.details = function CSCOPE() { } CSCOPE.prototype.get = function CSCOPE() { } CSCOPE.prototype.set = function CSCOPE() { -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) { + 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; + 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(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 (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 (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 (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 (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 (!or(heritance==[0,1])) { + mess = [[mess],["Accept herited events must be 0 or 1"],[" "]]; + ok = false; } -if (!ok) { + 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) { + [model,graphics,ok] = set_io(model,graphics,list([-1,1],1),list(),ones(1-heritance,1),[]); } -if (ok) { -if (wpos==[]) { -wpos=[[-1],[-1]]; + if (ok) { + if (wpos==[]) { + wpos = [[-1],[-1]]; } -if (wdim==[]) { -wdim=[[-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; + 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; } } |