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/Sources/RAND_m.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/Sources/RAND_m.js')
-rw-r--r-- | js/Sources/RAND_m.js | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/js/Sources/RAND_m.js b/js/Sources/RAND_m.js index d3c62d7e..cf5f934b 100644 --- a/js/Sources/RAND_m.js +++ b/js/Sources/RAND_m.js @@ -1,10 +1,10 @@ /* autogenerated from "macros/Sources/RAND_m.sci" */ function RAND_m() { RAND_m.prototype.define = function RAND_m() { - a = 0; - b = 1; + this.a = 0; + this.b = 1; dt = 0; - flag = 0; + this.flag = 0; function_name = "rndblk_m"; funtyp = 4; model = scicos_model(); @@ -18,13 +18,13 @@ function RAND_m() { model.evtin = 1; model.evtout = []; model.state = []; - model.dstate = [[int(rand()*(10^7-1))],[0*a.slice()]]; - model.rpar = [a.slice(),b.slice()]; - model.ipar = flag; + model.dstate = [[int(rand()*(10^7-1))],[0*this.a.slice()]]; + model.rpar = [this.a.slice(),this.b.slice()]; + model.ipar = this.flag; model.blocktype = "d"; model.firing = []; model.dep_ut = [false,false]; - exprs = [[sci2exp(1)],[string(flag)],[sci2exp([a])],[sci2exp([b])],[sci2exp([model.dstate[1-1],int(rand()*(10^7-1))])]]; + exprs = [[sci2exp(1)],[string(this.flag)],[sci2exp([this.a])],[sci2exp([this.b])],[sci2exp([model.dstate[1-1],int(rand()*(10^7-1))])]]; gr_i = []; this.x = standard_define([3,2],model,exprs,gr_i); return new BasicBlock(this.x); @@ -43,24 +43,24 @@ function RAND_m() { exprs[9-1] = []; } while (true) { - [ok,typ,flag,a,b,seed_c,exprs] = scicos_getvalue([["Set Random generator block parameters"],["flag = 0 : Uniform distribution A is min and A+B max"],["flag = 1 : Normal distribution A is mean and B deviation"],[" "],["A and B must be matrix with equal sizes"]],[["Datatype(1=real double 2=complex)"],["flag"],["A"],["B"],["SEED"]],list("vec",1,"vec",1,"mat",[-1,-2],"mat","[-1 -2]","mat",[1,2]),exprs); + [ok,this.typ,this.flag,this.a,this.b,this.seed_c,exprs] = scicos_getvalue([["Set Random generator block parameters"],["flag = 0 : Uniform distribution A is min and A+B max"],["flag = 1 : Normal distribution A is mean and B deviation"],[" "],["A and B must be matrix with equal sizes"]],[["Datatype(1=real double 2=complex)"],["flag"],["A"],["B"],["SEED"]],list("vec",1,"vec",1,"mat",[-1,-2],"mat","[-1 -2]","mat",[1,2]),exprs); if (!ok) { break; } - if (flag!=0&&flag!=1) { + if (this.flag!=0&&this.flag!=1) { message("flag must be equal to 1 or 0"); } else { - out = size(a); - if (typ==1) { + out = size(this.a); + if (this.typ==1) { function_name = "rndblk_m"; - model.rpar = [[real(a.slice())],[real(b.slice())]]; - model.dstate = [[seed_c[1-1]],[0*real(a.slice())]]; + model.rpar = [[real(this.a.slice())],[real(this.b.slice())]]; + model.dstate = [[this.seed_c[1-1]],[0*real(this.a.slice())]]; ot = 1; - } else if (typ==2) { + } else if (this.typ==2) { function_name = "rndblkz_m"; ot = 2; - model.rpar = [[real(a.slice())],[imag(a.slice())],[real(b.slice())],[imag(b.slice())]]; - model.dstate = [[seed_c.slice()],[0*[[real(a.slice())],[imag(a.slice())]]]]; + model.rpar = [[real(this.a.slice())],[imag(this.a.slice())],[real(this.b.slice())],[imag(this.b.slice())]]; + model.dstate = [[this.seed_c.slice()],[0*[[real(this.a.slice())],[imag(this.a.slice())]]]]; } else { message("Datatype is not supported"); ok = false; @@ -70,7 +70,7 @@ function RAND_m() { if (ok) { model.sim = list(function_name,4); graphics.exprs = exprs; - model.ipar = flag; + model.ipar = this.flag; this.x.graphics = graphics; this.x.model = model; break; |