summaryrefslogtreecommitdiff
path: root/js/Sources/Counter.js
blob: 88f6a5930ac6cb3cf673f55d4805629f48fed7fc (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
/* autogenerated from "macros/Sources/Counter.sci" */
function Counter() {
    Counter.prototype.define = function Counter() {
        this.minim = 0;
        this.maxim = 2;
        this.rule = 1;
        model = scicos_model();
        model.sim = list("counter",4);
        model.evtin = 1;
        model.out = 1;
        model.out2 = 1;
        model.dstate = 0;
        model.ipar = [[this.rule],[this.maxim],[this.minim]];
        model.blocktype = "c";
        model.dep_ut = [false,false];
        exprs = [[string(this.minim)],[string(this.maxim)],[string(this.rule)]];
        gr_i = [];
        this.x = standard_define([3,2],model,exprs,gr_i);
        return new BasicBlock(this.x);
    }
    Counter.prototype.details = function Counter() {
        return this.x;
    }
    Counter.prototype.get = function Counter() {
    }
    Counter.prototype.set = function Counter() {
        this.x = arg1;
        graphics = arg1.graphics;
        exprs = graphics.exprs;
        model = arg1.model;
        while (true) {
            [ok,this.minim,this.maxim,this.rule,exprs] = scicos_getvalue([[msprintf(gettext("Set %s block parameters"),"Counter")],[" "],[gettext("Integer counter generator")],[" "]],[[gettext("Minimum")],[gettext("Maximum")],[gettext("Rule (1:Increment, 2:Decrement)")]],list("vec",1,"vec",1,"vec",1),exprs);
            if (!ok) {
                break;
            }
            this.maxim = int(this.maxim);
            this.minim = int(this.minim);
            if (this.maxim<this.minim) {
                block_parameter_error(msprintf(gettext("Wrong values for \'Maximum\' and \'Minimum\' parameters: %d &lt; %d"),this.minim,this.maxim),msprintf(gettext("\'Minimum\' must be less than \'Maximum\'.")));
            } else if ((this.rule!=1&&this.rule!=2)) {
                block_parameter_error(msprintf(gettext("Wrong value for \'Rule\' parameter: %d"),this.rule),msprintf(gettext("Must be in the interval %s."),"[1,2]"));
            } else {
                graphics.exprs = exprs;
                model.dstate = 0;
                model.ipar = [[this.rule],[this.maxim],[this.minim]];
                this.x.graphics = graphics;
                this.x.model = model;
                break;
            }
        }
        return new BasicBlock(this.x);
    }
}