From 7465daea85285ba7f291b6bf6ddc45caa9e7ad65 Mon Sep 17 00:00:00 2001 From: Sunil Shetye Date: Mon, 25 Jun 2018 18:20:39 +0530 Subject: add spacing to end of block also --- js/Linear/REGISTER.js | 109 +++++++++++++++++++++++++------------------------- 1 file changed, 55 insertions(+), 54 deletions(-) (limited to 'js/Linear/REGISTER.js') 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; + } + } } } -- cgit