summaryrefslogtreecommitdiff
path: root/js/Sources/CONST_m.js
blob: 7cc3cd7fa42eac611a3f9befadd4eafa73edc2bf (plain)
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/* autogenerated from "macros/Sources/CONST_m.sci" */
function CONST_m() {
    CONST_m.prototype.define = function CONST_m() {
        this.C = [1];
        this.model = scicos_model();
        this.model.sim = list(new ScilabString(["cstblk4"]), new ScilabDouble([4]));
        this.model.in = new ScilabDouble([]);
        this.model.out = new ScilabDouble([size(this.C,1)]);
        this.model.in2 = new ScilabDouble([]);
        this.model.out2 = new ScilabDouble([size(this.C,2)]);
        this.model.rpar = new ScilabDouble(this.C);
        this.model.opar = list();
        this.model.blocktype = new ScilabString(["d"]);
        this.model.dep_ut = new ScilabBoolean([false,false]);
        this.exprs = sci2exp(this.C);
        this.gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"CONST_m\",sz(1),sz(2));"]);
        this.x = new standard_define(new ScilabDouble([2,2]),this.model,new ScilabString([this.exprs]),this.gr_i);
        return new BasicBlock(this.x);
    }
    CONST_m.prototype.details = function CONST_m() {
        return this.x;
    }
    CONST_m.prototype.get = function CONST_m() {
        alert("parameters cannot be modified");
    }
    CONST_m.prototype.set = function CONST_m() {
        this.exprs = this.graphics.exprs;
        while (true) {
            var ok = true;
            this.C = inverse(arguments[0]["C"]);
            if (!ok) {
                break;
            }
            var nout = size(this.C);
            if (find(nout==0).length!=0) {
                block_parameter_error(msprintf("Wrong size for \'%s\' parameter","Constant Value"),"Constant value must have at least one element.");
            } else {
                this.model.sim = list(new ScilabString(["cstblk4_m"]), new ScilabDouble([4]));
                this.model.opar = list(this.C);
                if ((this.type[this.C-1]==1)) {
                    if (isreal(this.C)) {
                        var ot = 1;
                    } else {
                        var ot = 2;
                    }
                } else if ((typeof(this.C)=="int32")) {
                    var ot = 3;
                } else if ((typeof(this.C)=="int16")) {
                    var ot = 4;
                } else if ((typeof(this.C)=="int8")) {
                    var ot = 5;
                } else if ((typeof(this.C)=="uint32")) {
                    var ot = 6;
                } else if ((typeof(this.C)=="uint16")) {
                    var ot = 7;
                } else if ((typeof(this.C)=="uint8")) {
                    var ot = 8;
                } else {
                    block_parameter_error(msprintf("Wrong type for \'%s\' parameter","Constant Value"),"Value type must be a numeric type (double, complex, int, int8, ...).");
                    var ok = false;
                }
                if (ok) {
                    this.model.rpar = new ScilabDouble([]);
                    var tmpvar0 = set_io(this.model,this.graphics,list(),list(nout,ot),[],[]);
                    this.model = tmpvar0[0];
                    this.graphics = tmpvar0[1];
                    var ok = tmpvar0[2];
                    this.graphics.exprs = new ScilabDouble([this.exprs]);
                    this.x.graphics = this.graphics;
                    this.x.model = this.model;
                    break;
                }
            }
        }
        return new BasicBlock(this.x);
    }
}