summaryrefslogtreecommitdiff
path: root/js/Linear/REGISTER.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/Linear/REGISTER.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/Linear/REGISTER.js')
-rw-r--r--js/Linear/REGISTER.js109
1 files changed, 55 insertions, 54 deletions
diff --git a/js/Linear/REGISTER.js b/js/Linear/REGISTER.js
index f99a4043..cc57e75d 100644
--- a/js/Linear/REGISTER.js
+++ b/js/Linear/REGISTER.js
@@ -12,70 +12,71 @@ function REGISTER() {
model.dep_ut = [false,false];
exprs = strcat(string(z0),";");
gr_i = [];
- x = standard_define([3,2],model,exprs,gr_i);
+ this.x = standard_define([3,2],model,exprs,gr_i);
}
REGISTER.prototype.details = function REGISTER() {
+ return this.x;
}
REGISTER.prototype.get = function REGISTER() {
}
REGISTER.prototype.set = function REGISTER() {
- x = arg1;
+ this.x = arg1;
graphics = arg1.graphics;
exprs = graphics.exprs;
model = arg1.model;
if (size(exprs,1)==1) {
- exprs = [[exprs],[sci2exp(1)]];
-}
+ exprs = [[exprs],[sci2exp(1)]];
+ }
while (true) {
- [ok,z0,it,exprs] = scicos_getvalue("Set delay parameters",[["Register initial condition"],["Datatype (1=double 3=int32 ...)"]],list("vec",-1,"vec",1),exprs);
- if (!ok) {
-break;
-}
- if (prod(size(z0))<1) {
-message("Register length must be at least 1");
- ok = false;
-}
- if (it==1) {
- model.sim = list("delay4",4);
- z0 = double(z0);
- model.dstate = z0;
- model.odstate = list();
- } else {
- if (it==3) {
- model.sim = list("delay4_i32",4);
- z0 = int32(z0);
- } else if (it==4) {
- model.sim = list("delay4_i16",4);
- z0 = int16(z0);
- } else if (it==5) {
- model.sim = list("delay4_i8",4);
- z0 = int8(z0);
- } else if (it==6) {
- model.sim = list("delay4_ui32",4);
- z0 = uint32(z0);
- } else if (it==7) {
- model.sim = list("delay4_ui16",4);
- z0 = uint16(z0);
- } else if (it==8) {
- model.sim = list("delay4_ui8",4);
- z0 = uint8(z0);
- } else {
-message("Datatype is not supported");
- ok = false;
-}
- model.odstate = list(z0);
- model.dstate = [];
-}
- if (ok) {
- in1 = [1,1];
- [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(in1,it),1,[]);
-}
- if (ok) {
- graphics.exprs = exprs;
- x.graphics = graphics;
- x.model = model;
-break;
-}
-}
+ [ok,z0,it,exprs] = scicos_getvalue("Set delay parameters",[["Register initial condition"],["Datatype (1=double 3=int32 ...)"]],list("vec",-1,"vec",1),exprs);
+ if (!ok) {
+ break;
+ }
+ if (prod(size(z0))<1) {
+ message("Register length must be at least 1");
+ ok = false;
+ }
+ if (it==1) {
+ model.sim = list("delay4",4);
+ z0 = double(z0);
+ model.dstate = z0;
+ model.odstate = list();
+ } else {
+ if (it==3) {
+ model.sim = list("delay4_i32",4);
+ z0 = int32(z0);
+ } else if (it==4) {
+ model.sim = list("delay4_i16",4);
+ z0 = int16(z0);
+ } else if (it==5) {
+ model.sim = list("delay4_i8",4);
+ z0 = int8(z0);
+ } else if (it==6) {
+ model.sim = list("delay4_ui32",4);
+ z0 = uint32(z0);
+ } else if (it==7) {
+ model.sim = list("delay4_ui16",4);
+ z0 = uint16(z0);
+ } else if (it==8) {
+ model.sim = list("delay4_ui8",4);
+ z0 = uint8(z0);
+ } else {
+ message("Datatype is not supported");
+ ok = false;
+ }
+ model.odstate = list(z0);
+ model.dstate = [];
+ }
+ if (ok) {
+ in1 = [1,1];
+ [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(in1,it),1,[]);
+ }
+ if (ok) {
+ graphics.exprs = exprs;
+ this.x.graphics = graphics;
+ this.x.model = model;
+ break;
+ }
+ }
}
}