summaryrefslogtreecommitdiff
path: root/js/Misc/fortran_block.js
blob: b403b16ea075a843ad8118beaddbc44cbdb84044 (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
/* autogenerated from "macros/Misc/fortran_block.sci" */
function fortran_block() {
    fortran_block.prototype.define = function fortran_block() {
        model = scicos_model();
        model.sim = list(" ",1001);
        model.in1 = 1;
        model.out = 1;
        model.evtin = [];
        model.evtout = [];
        model.state = [];
        model.dstate = [];
        model.rpar = [];
        model.ipar = 0;
        model.blocktype = "c";
        model.firing = [];
        model.dep_ut = [true,false];
        funam = "forty";
        label = list([[sci2exp(model.in1)],[sci2exp(model.out)],[strcat(sci2exp(model.rpar))],[funam]],list([]));
        gr_i = [];
        this.x = standard_define([4,2],model,label,gr_i);
    }
    fortran_block.prototype.details = function fortran_block() {
        return this.x;
    }
    fortran_block.prototype.get = function fortran_block() {
    }
    fortran_block.prototype.set = function fortran_block() {
        this.x = arg1;
        model = arg1.model;
        graphics = arg1.graphics;
        label = graphics.exprs;
        while (true) {
            [ok,i,o,rpar,funam,lab] = scicos_getvalue("Set fortran_block parameters",[["input ports sizes"],["output port sizes"],["System parameters vector"],["function name"]],list("vec",-1,"vec",-1,"vec",-1,"str",-1),label[1-1]);
            if (!ok) {
                break;
            }
            if (funam==" ") {
                break;
            }
            label[1-1] = lab;
            rpar = rpar.slice();
            i = int(i.slice());
            ni = size(i,1);
            o = int(o.slice());
            no = size(o,1);
            tt = label[2-1];
            if (model.sim[1-1]!=funam||size(model.in1,"*")!=size(i,"*")||size(model.out,"*")!=size(o,"*")) {
                tt = [];
            }
            [ok,tt] = FORTR(funam,tt,i,o);
            if (!ok) {
                break;
            }
            [model,graphics,ok] = check_io(model,graphics,i,o,[],[]);
            if (ok) {
                model.sim[1-1] = funam;
                model.rpar = rpar;
                label[2-1] = tt;
                this.x.model = model;
                graphics.exprs = label;
                this.x.graphics = graphics;
                break;
            }
        }
    }
}