summaryrefslogtreecommitdiff
path: root/js/Misc/EDGE_TRIGGER.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/Misc/EDGE_TRIGGER.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/Misc/EDGE_TRIGGER.js')
-rw-r--r--js/Misc/EDGE_TRIGGER.js133
1 files changed, 67 insertions, 66 deletions
diff --git a/js/Misc/EDGE_TRIGGER.js b/js/Misc/EDGE_TRIGGER.js
index 0f24996b..efd03837 100644
--- a/js/Misc/EDGE_TRIGGER.js
+++ b/js/Misc/EDGE_TRIGGER.js
@@ -70,87 +70,88 @@ function EDGE_TRIGGER() {
lnk.from = [2,1,0];
lnk.to = [4,1,1];
scs_m_1.objs[7-1] = lnk;
-blk={};
-lnk={};
+ blk={};
+ lnk={};
model = scicos_model();
model.sim = "csuper";
model.in1 = 1;
model.evtout = 1;
model.rpar = scs_m_1;
gr_i = [];
- x = standard_define([3,2],model,[],gr_i);
+ this.x = standard_define([3,2],model,[],gr_i);
}
EDGE_TRIGGER.prototype.details = function EDGE_TRIGGER() {
+ return this.x;
}
EDGE_TRIGGER.prototype.get = function EDGE_TRIGGER() {
}
EDGE_TRIGGER.prototype.set = function EDGE_TRIGGER() {
-for (i=1;i<=length(arg1.model.rpar.objs);i+=1) {
- o = arg1.model.rpar.objs[i-1];
- if (typeof(o)=="Block"&&o.gui=="EDGETRIGGER") {
- ppath = list(i);
-break;
-}
-}
+ for (i=1;i<=length(arg1.model.rpar.objs);i+=1) {
+ o = arg1.model.rpar.objs[i-1];
+ if (typeof(o)=="Block"&&o.gui=="EDGETRIGGER") {
+ ppath = list(i);
+ break;
+ }
+ }
newpar = list();
y = 0;
for (path in ppath) {
- np = size(path,"*");
- spath = list();
-for (k=1;k<=np;k+=1) {
- spath[$+1-1] = "model";
- spath[$+1-1] = "rpar";
- spath[$+1-1] = "objs";
- spath[$+1-1] = path[k-1];
-}
- xx = arg1[spath-1];
-execstr("xxn="+xx.gui+"(\'set\',xx)");
- if (diffobjs(this.xxn,xx)) {
- model = xx.model;
- model_n = this.xxn.model;
- if (!is_modelica_block(xx)) {
- modified = or(model.sim!=model_n.sim)||!isequal(model.state,model_n.state)||!isequal(model.dstate,model_n.dstate)||!isequal(model.rpar,model_n.rpar)||!isequal(model.ipar,model_n.ipar)||!isequal(model.label,model_n.label);
- if (or(model.in1!=model_n.in1)||or(model.out!=model_n.out)) {
- needcompile = 1;
-}
- if (or(model.firing!=model_n.firing)) {
- needcompile = 2;
-}
- if ((size(model.in1,"*")!=size(model_n.in1,"*"))||(size(model.out,"*")!=size(model_n.out,"*"))) {
- needcompile = 4;
-}
- if (model.sim=="input"||model.sim=="output") {
- if (model.ipar!=model_n.ipar) {
- needcompile = 4;
-}
-}
- if (or(model.blocktype!=model_n.blocktype)||or(model.dep_ut!=model_n.dep_ut)) {
- needcompile = 4;
-}
- if ((model.nzcross!=model_n.nzcross)||(model.nmode!=model_n.nmode)) {
- needcompile = 4;
-}
- if (prod(size(model_n.sim))>1) {
- if (model_n.sim[2-1]>1000) {
- if (model.sim[1-1]!=model_n.sim[1-1]) {
- needcompile = 4;
-}
-}
-}
- } else {
- modified = or(model_n!=model);
- eq = model.equations;
- eqn = model_n.equations;
- if (or(eq.model!=eqn.model)||or(eq.inputs!=eqn.inputs)||or(eq.outputs!=eqn.outputs)) {
- needcompile = 4;
-}
-}
- arg1[spath-1] = this.xxn;
- newpar[size(newpar)+1-1] = path;
- y = max(y,needcompile);
-}
-}
- x = arg1;
+ np = size(path,"*");
+ spath = list();
+ for (k=1;k<=np;k+=1) {
+ spath[$+1-1] = "model";
+ spath[$+1-1] = "rpar";
+ spath[$+1-1] = "objs";
+ spath[$+1-1] = path[k-1];
+ }
+ xx = arg1[spath-1];
+ execstr("xxn="+xx.gui+"(\'set\',xx)");
+ if (diffobjs(this.xxn,xx)) {
+ model = xx.model;
+ model_n = this.xxn.model;
+ if (!is_modelica_block(xx)) {
+ modified = or(model.sim!=model_n.sim)||!isequal(model.state,model_n.state)||!isequal(model.dstate,model_n.dstate)||!isequal(model.rpar,model_n.rpar)||!isequal(model.ipar,model_n.ipar)||!isequal(model.label,model_n.label);
+ if (or(model.in1!=model_n.in1)||or(model.out!=model_n.out)) {
+ needcompile = 1;
+ }
+ if (or(model.firing!=model_n.firing)) {
+ needcompile = 2;
+ }
+ if ((size(model.in1,"*")!=size(model_n.in1,"*"))||(size(model.out,"*")!=size(model_n.out,"*"))) {
+ needcompile = 4;
+ }
+ if (model.sim=="input"||model.sim=="output") {
+ if (model.ipar!=model_n.ipar) {
+ needcompile = 4;
+ }
+ }
+ if (or(model.blocktype!=model_n.blocktype)||or(model.dep_ut!=model_n.dep_ut)) {
+ needcompile = 4;
+ }
+ if ((model.nzcross!=model_n.nzcross)||(model.nmode!=model_n.nmode)) {
+ needcompile = 4;
+ }
+ if (prod(size(model_n.sim))>1) {
+ if (model_n.sim[2-1]>1000) {
+ if (model.sim[1-1]!=model_n.sim[1-1]) {
+ needcompile = 4;
+ }
+ }
+ }
+ } else {
+ modified = or(model_n!=model);
+ eq = model.equations;
+ eqn = model_n.equations;
+ if (or(eq.model!=eqn.model)||or(eq.inputs!=eqn.inputs)||or(eq.outputs!=eqn.outputs)) {
+ needcompile = 4;
+ }
+ }
+ arg1[spath-1] = this.xxn;
+ newpar[size(newpar)+1-1] = path;
+ y = max(y,needcompile);
+ }
+ }
+ this.x = arg1;
typ = newpar;
}
}