diff options
author | Sunil Shetye | 2018-06-26 14:59:47 +0530 |
---|---|---|
committer | Sunil Shetye | 2018-06-26 14:59:47 +0530 |
commit | eb7c8e0cd42d4afe02be3adda2e94b6b0dfdaa00 (patch) | |
tree | 6378935263fe5cafd389b6893ac3b37a1dd4b1a7 /js/Sinks/TOWS_c.js | |
parent | afed64f1a0eab0b2d742088186d7bc340a2c895b (diff) | |
download | sci2js-eb7c8e0cd42d4afe02be3adda2e94b6b0dfdaa00.tar.gz sci2js-eb7c8e0cd42d4afe02be3adda2e94b6b0dfdaa00.tar.bz2 sci2js-eb7c8e0cd42d4afe02be3adda2e94b6b0dfdaa00.zip |
add return value from scicos_getvalue to global vars
Diffstat (limited to 'js/Sinks/TOWS_c.js')
-rw-r--r-- | js/Sinks/TOWS_c.js | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/js/Sinks/TOWS_c.js b/js/Sinks/TOWS_c.js index 790c2021..4e0ad0a6 100644 --- a/js/Sinks/TOWS_c.js +++ b/js/Sinks/TOWS_c.js @@ -2,9 +2,9 @@ function TOWS_c() { TOWS_c.prototype.define = function TOWS_c() { nu = -1; - nz = 128; - varnam = "A"; - herit = 0; + this.nz = 128; + this.varnam = "A"; + this.herit = 0; model = scicos_model(); model.sim = list("tows_c",4); model.in1 = [nu]; @@ -14,12 +14,12 @@ function TOWS_c() { model.evtin = [1]; model.evtout = []; model.rpar = []; - model.ipar = [[nz],[length(varnam)],[transpose(this.ascii[varnam-1])]]; + model.ipar = [[this.nz],[length(this.varnam)],[transpose(this.ascii[this.varnam-1])]]; model.blocktype = "d"; model.firing = []; model.dep_ut = [false,false]; gr_i = []; - exprs = [[string(nz)],[string(varnam)],[string(herit)]]; + exprs = [[string(this.nz)],[string(this.varnam)],[string(this.herit)]]; this.x = standard_define([4,2],model,exprs,gr_i); return new BasicBlock(this.x); } @@ -34,29 +34,29 @@ function TOWS_c() { 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); + [ok,this.nz,this.varnam,this.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)) { + if ((this.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) { + if (!r||ierr!=0||length(this.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"); + execstr("if type("+this.varnam+") <> 17 | or(fieldnames("+this.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,graphics,ok] = set_io(model,graphics,list([-1,-2],-1),list(),ones(1-this.herit,1),[]); + if (this.herit==1) { model.blocktype = "x"; } else { model.blocktype = "d"; } - model.ipar = [[nz],[length(varnam)],[transpose(this.ascii[varnam-1])]]; + model.ipar = [[this.nz],[length(this.varnam)],[transpose(this.ascii[this.varnam-1])]]; graphics.exprs = exprs; this.x.graphics = graphics; this.x.model = model; |