diff options
Diffstat (limited to 'js/Sinks/TOWS_c.js')
-rw-r--r-- | js/Sinks/TOWS_c.js | 63 |
1 files changed, 32 insertions, 31 deletions
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; + } + } } } |