1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
/* autogenerated from "macros/Branching/MUX_f.sci" */
function MUX_f() {
MUX_f.prototype.define = function MUX_f() {
in1 = 2;
model = scicos_model();
model.sim = list("mux",1);
model.in1 = -transpose([1:in1]);
model.out = 0;
model.ipar = in1;
model.blocktype = "c";
model.dep_ut = [true,false];
exprs = string(in1);
gr_i = [];
x = standard_define([0.5,2],model,exprs,gr_i);
}
MUX_f.prototype.details = function MUX_f() {
}
MUX_f.prototype.get = function MUX_f() {
}
MUX_f.prototype.set = function MUX_f() {
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;
}
}
}
}
|