summaryrefslogtreecommitdiff
path: root/js/Branching/MUX_f.js
diff options
context:
space:
mode:
authorSunil Shetye2018-06-25 18:20:39 +0530
committerSunil Shetye2018-06-26 11:06:22 +0530
commit7465daea85285ba7f291b6bf6ddc45caa9e7ad65 (patch)
treee8e3e4dd60d469c290d55de15644ddbc1e013bc6 /js/Branching/MUX_f.js
parent7c70459c10aed0d74ee03896abaf47fefdbf7c8f (diff)
downloadsci2js-7465daea85285ba7f291b6bf6ddc45caa9e7ad65.tar.gz
sci2js-7465daea85285ba7f291b6bf6ddc45caa9e7ad65.tar.bz2
sci2js-7465daea85285ba7f291b6bf6ddc45caa9e7ad65.zip
add spacing to end of block also
Diffstat (limited to 'js/Branching/MUX_f.js')
-rw-r--r--js/Branching/MUX_f.js75
1 files changed, 38 insertions, 37 deletions
diff --git a/js/Branching/MUX_f.js b/js/Branching/MUX_f.js
index 0bc7f2f7..13cf8462 100644
--- a/js/Branching/MUX_f.js
+++ b/js/Branching/MUX_f.js
@@ -11,52 +11,53 @@ function MUX_f() {
model.dep_ut = [true,false];
exprs = string(in1);
gr_i = [];
- x = standard_define([0.5,2],model,exprs,gr_i);
+ this.x = standard_define([0.5,2],model,exprs,gr_i);
}
MUX_f.prototype.details = function MUX_f() {
+ return this.x;
}
MUX_f.prototype.get = function MUX_f() {
}
MUX_f.prototype.set = function MUX_f() {
- x = arg1;
+ this.x = arg1;
graphics = arg1.graphics;
exprs = graphics.exprs;
model = arg1.model;
while (true) {
- [ok,in1,exprs] = scicos_getvalue("Set MUX block parameters","number of input ports or vector of sizes",list("vec",-1),exprs);
- if (!ok) {
-break;
-}
- if (size(in1,"*")==1) {
- if (in1<2||in1>8) {
-message("Block must have at least two input ports and at most eight");
- ok = false;
- } else {
- [model,graphics,ok] = check_io(model,graphics,-transpose([1:in1]),0,[],[]);
-}
- } else {
- if (size(in1,"*")<2||size(in1,"*")>8||or(in1==0)) {
-message([["Block must have at least two input ports"],["and at most eight, and size 0 is not allowed. "]]);
- ok = false;
- } else {
- if (min(in1)<0) {
- nout = 0;
- } else {
- nout = sum(in1);
-}
- [model,graphics,ok] = check_io(model,graphics,in1.slice(),nout,[],[]);
- if (ok) {
- in1 = size(in1,"*");
-}
-}
-}
- if (ok) {
- graphics.exprs = exprs;
- model.ipar = in1;
- x.graphics = graphics;
- x.model = model;
-break;
-}
-}
+ [ok,in1,exprs] = scicos_getvalue("Set MUX block parameters","number of input ports or vector of sizes",list("vec",-1),exprs);
+ if (!ok) {
+ break;
+ }
+ if (size(in1,"*")==1) {
+ if (in1<2||in1>8) {
+ message("Block must have at least two input ports and at most eight");
+ ok = false;
+ } else {
+ [model,graphics,ok] = check_io(model,graphics,-transpose([1:in1]),0,[],[]);
+ }
+ } else {
+ if (size(in1,"*")<2||size(in1,"*")>8||or(in1==0)) {
+ message([["Block must have at least two input ports"],["and at most eight, and size 0 is not allowed. "]]);
+ ok = false;
+ } else {
+ if (min(in1)<0) {
+ nout = 0;
+ } else {
+ nout = sum(in1);
+ }
+ [model,graphics,ok] = check_io(model,graphics,in1.slice(),nout,[],[]);
+ if (ok) {
+ in1 = size(in1,"*");
+ }
+ }
+ }
+ if (ok) {
+ graphics.exprs = exprs;
+ model.ipar = in1;
+ this.x.graphics = graphics;
+ this.x.model = model;
+ break;
+ }
+ }
}
}