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/Misc/generic_block.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/Misc/generic_block.js')
-rw-r--r-- | js/Misc/generic_block.js | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/js/Misc/generic_block.js b/js/Misc/generic_block.js index 9ec5cd22..230ee9d1 100644 --- a/js/Misc/generic_block.js +++ b/js/Misc/generic_block.js @@ -2,9 +2,9 @@ function generic_block() { generic_block.prototype.define = function generic_block() { model = scicos_model(); - function_name = "sinblk"; - funtyp = 1; - model.sim = list(function_name,funtyp); + this.function_name = "sinblk"; + this.funtyp = 1; + model.sim = list(this.function_name,this.funtyp); model.in1 = 1; model.out = 1; model.evtin = []; @@ -16,7 +16,7 @@ function generic_block() { model.blocktype = "c"; model.firing = []; model.dep_ut = [true,false]; - label = [[function_name],[sci2exp(funtyp)],[sci2exp(model.in1)],[sci2exp(model.out)],[sci2exp(model.evtin)],[sci2exp(model.evtout)],[sci2exp(model.state)],[sci2exp(model.dstate)],[sci2exp(model.rpar)],[sci2exp(model.ipar)],[sci2exp(model.firing)],["y"],["n"]]; + label = [[this.function_name],[sci2exp(this.funtyp)],[sci2exp(model.in1)],[sci2exp(model.out)],[sci2exp(model.evtin)],[sci2exp(model.evtout)],[sci2exp(model.state)],[sci2exp(model.dstate)],[sci2exp(model.rpar)],[sci2exp(model.ipar)],[sci2exp(model.firing)],["y"],["n"]]; gr_i = []; this.x = standard_define([2,2],model,label,gr_i); return new BasicBlock(this.x); @@ -35,57 +35,57 @@ function generic_block() { label[9-1] = []; } while (true) { - [ok,function_name,funtyp,i,o,ci,co,xx,z,rpar,ipar,auto0,depu,dept,lab] = scicos_getvalue("Set GENERIC block parameters",[["simulation function"],["function type (0,1,2,..)"],["input ports sizes"],["output port sizes"],["input event ports sizes"],["output events ports sizes"],["initial continuous state"],["initial discrete state"],["Real parameters vector"],["Integer parameters vector"],["initial firing vector (<0 for no firing)"],["direct feedthrough (y or n)"],["time dependence (y or n)"]],list("str",1,"vec",1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec","sum(%6)","str",1,"str",1),label); + [ok,this.function_name,this.funtyp,this.i,this.o,this.ci,this.co,this.xx,this.z,this.rpar,this.ipar,this.auto0,this.depu,this.dept,this.lab] = scicos_getvalue("Set GENERIC block parameters",[["simulation function"],["function type (0,1,2,..)"],["input ports sizes"],["output port sizes"],["input event ports sizes"],["output events ports sizes"],["initial continuous state"],["initial discrete state"],["Real parameters vector"],["Integer parameters vector"],["initial firing vector (<0 for no firing)"],["direct feedthrough (y or n)"],["time dependence (y or n)"]],list("str",1,"vec",1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec","sum(%6)","str",1,"str",1),label); if (!ok) { break; } - label = lab; - function_name = stripblanks(function_name); - xx = xx.slice(); - z = z.slice(); - rpar = rpar.slice(); - ipar = int(ipar.slice()); - i = int(i.slice()); - o = int(o.slice()); - ci = int(ci.slice()); - co = int(co.slice()); - funtyp = int(funtyp); - if (funtyp<0) { + label = this.lab; + this.function_name = stripblanks(this.function_name); + this.xx = this.xx.slice(); + this.z = this.z.slice(); + this.rpar = this.rpar.slice(); + this.ipar = int(this.ipar.slice()); + this.i = int(this.i.slice()); + this.o = int(this.o.slice()); + this.ci = int(this.ci.slice()); + this.co = int(this.co.slice()); + this.funtyp = int(this.funtyp); + if (this.funtyp<0) { message("function type cannot be negative"); ok = false; } - if ([[ci],[co]]!=[]) { - if (max([[ci],[co]])>1) { + if ([[this.ci],[this.co]]!=[]) { + if (max([[this.ci],[this.co]])>1) { message("vector event links not supported"); ok = false; } } - depu = stripblanks(depu); - if (part(depu,1)=="y") { - depu = true; + this.depu = stripblanks(this.depu); + if (part(this.depu,1)=="y") { + this.depu = true; } else { - depu = false; + this.depu = false; } - dept = stripblanks(dept); - if (part(dept,1)=="y") { - dept = true; + this.dept = stripblanks(this.dept); + if (part(this.dept,1)=="y") { + this.dept = true; } else { - dept = false; + this.dept = false; } - dep_ut = [depu,dept]; + dep_ut = [this.depu,this.dept]; if (ok) { - [model,graphics,ok] = check_io(model,graphics,i,o,ci,co); + [model,graphics,ok] = check_io(model,graphics,this.i,this.o,this.ci,this.co); } if (ok) { - if (funtyp==3) { + if (this.funtyp==3) { needcompile = 4; } - model.sim = list(function_name,funtyp); - model.state = xx; - model.dstate = z; - model.rpar = rpar; - model.ipar = ipar; - model.firing = auto0; + model.sim = list(this.function_name,this.funtyp); + model.state = this.xx; + model.dstate = this.z; + model.rpar = this.rpar; + model.ipar = this.ipar; + model.firing = this.auto0; model.dep_ut = dep_ut; arg1.model = model; graphics.exprs = label; |