diff options
author | Sunil Shetye | 2018-06-25 12:08:56 +0530 |
---|---|---|
committer | Sunil Shetye | 2018-06-25 12:45:27 +0530 |
commit | 7c70459c10aed0d74ee03896abaf47fefdbf7c8f (patch) | |
tree | 6f6acc6a5087295c6e59f0f94bfda5025049d5fa /js/Linear/GAINBLK.js | |
parent | 870479a2e4b932426a904b2ebae7e4ee72037326 (diff) | |
download | sci2js-7c70459c10aed0d74ee03896abaf47fefdbf7c8f.tar.gz sci2js-7c70459c10aed0d74ee03896abaf47fefdbf7c8f.tar.bz2 sci2js-7c70459c10aed0d74ee03896abaf47fefdbf7c8f.zip |
separate out code for getvalue
Diffstat (limited to 'js/Linear/GAINBLK.js')
-rw-r--r-- | js/Linear/GAINBLK.js | 230 |
1 files changed, 115 insertions, 115 deletions
diff --git a/js/Linear/GAINBLK.js b/js/Linear/GAINBLK.js index 2f188149..b907fe60 100644 --- a/js/Linear/GAINBLK.js +++ b/js/Linear/GAINBLK.js @@ -1,144 +1,144 @@ /* autogenerated from "macros/Linear/GAINBLK.sci" */ function GAINBLK() { GAINBLK.prototype.define = function GAINBLK() { -gain=1; -in1=-1; -out=-1; -in2=-2; -out2=-2; -model=scicos_model(); -model.sim=list("gainblk",4); -model.in1=in1; -model.out=out; -model.in2=in2; -model.out2=out2; -model.rpar=gain; -model.blocktype="c"; -model.dep_ut=[true,false]; -exprs=[strcat(sci2exp(gain))]; -gr_i=[]; -x=standard_define([2,2],model,exprs,gr_i); + gain = 1; + in1 = -1; + out = -1; + in2 = -2; + out2 = -2; + model = scicos_model(); + model.sim = list("gainblk",4); + model.in1 = in1; + model.out = out; + model.in2 = in2; + model.out2 = out2; + model.rpar = gain; + model.blocktype = "c"; + model.dep_ut = [true,false]; + exprs = [strcat(sci2exp(gain))]; + gr_i = []; + x = standard_define([2,2],model,exprs,gr_i); } GAINBLK.prototype.details = function GAINBLK() { } GAINBLK.prototype.get = function GAINBLK() { } GAINBLK.prototype.set = function GAINBLK() { -x=arg1; -graphics=arg1.graphics; -exprs=graphics.exprs; -model=arg1.model; -if (size(exprs,"*")==1) { -exprs=[[exprs],[sci2exp(0)]]; + x = arg1; + graphics = arg1.graphics; + exprs = graphics.exprs; + model = arg1.model; + if (size(exprs,"*")==1) { + exprs = [[exprs],[sci2exp(0)]]; } -while (true) { -[ok,gain,over,exprs]=scicos_getvalue("Set gain block parameters",[["Gain"],["Do On Overflow(0=Nothing 1=Saturate 2=Error)"]],list("mat",[-1,-1],"vec",1),exprs); -if (!ok) { + while (true) { + [ok,gain,over,exprs] = scicos_getvalue("Set gain block parameters",[["Gain"],["Do On Overflow(0=Nothing 1=Saturate 2=Error)"]],list("mat",[-1,-1],"vec",1),exprs); + if (!ok) { break; } -if (gain==[]) { + if (gain==[]) { message("Gain must have at least one element"); -} else { -if (typeof(gain)=="constant") { -if (isreal(gain)) { -it=1; -ot=1; -model.sim=list("gainblk",4); -model.rpar=gain.slice(); -model.opar=list(); -} else { + } else { + if (typeof(gain)=="constant") { + if (isreal(gain)) { + it = 1; + ot = 1; + model.sim = list("gainblk",4); + model.rpar = gain.slice(); + model.opar = list(); + } else { message("type is not supported"); -ok=false; + ok = false; } -} else { -if ((over==0)) { -if ((typeof(gain)=="int32")) { -ot=3; -model.sim=list("gainblk_i32n",4); -} else if ((typeof(gain)=="int16")) { -ot=4; -model.sim=list("gainblk_i16n",4); -} else if ((typeof(gain)=="int8")) { -ot=5; -model.sim=list("gainblk_i8n",4); -} else if ((typeof(gain)=="uint32")) { -ot=6; -model.sim=list("gainblk_ui32n",4); -} else if ((typeof(gain)=="uint16")) { -ot=7; -model.sim=list("gainblk_ui16n",4); -} else if ((typeof(gain)=="uint8")) { -ot=8; -model.sim=list("gainblk_ui8n",4); -} else { + } else { + if ((over==0)) { + if ((typeof(gain)=="int32")) { + ot = 3; + model.sim = list("gainblk_i32n",4); + } else if ((typeof(gain)=="int16")) { + ot = 4; + model.sim = list("gainblk_i16n",4); + } else if ((typeof(gain)=="int8")) { + ot = 5; + model.sim = list("gainblk_i8n",4); + } else if ((typeof(gain)=="uint32")) { + ot = 6; + model.sim = list("gainblk_ui32n",4); + } else if ((typeof(gain)=="uint16")) { + ot = 7; + model.sim = list("gainblk_ui16n",4); + } else if ((typeof(gain)=="uint8")) { + ot = 8; + model.sim = list("gainblk_ui8n",4); + } else { message("type is not supported."); -ok=false; + ok = false; } -} else if ((over==1)) { -if ((typeof(gain)=="int32")) { -ot=3; -model.sim=list("gainblk_i32s",4); -} else if ((typeof(gain)=="int16")) { -ot=4; -model.sim=list("gainblk_i16s",4); -} else if ((typeof(gain)=="int8")) { -ot=5; -model.sim=list("gainblk_i8s",4); -} else if ((typeof(gain)=="uint32")) { -ot=6; -model.sim=list("gainblk_ui32s",4); -} else if ((typeof(gain)=="uint16")) { -ot=7; -model.sim=list("gainblk_ui16s",4); -} else if ((typeof(gain)=="uint8")) { -ot=8; -model.sim=list("gainblk_ui8s",4); -} else { + } else if ((over==1)) { + if ((typeof(gain)=="int32")) { + ot = 3; + model.sim = list("gainblk_i32s",4); + } else if ((typeof(gain)=="int16")) { + ot = 4; + model.sim = list("gainblk_i16s",4); + } else if ((typeof(gain)=="int8")) { + ot = 5; + model.sim = list("gainblk_i8s",4); + } else if ((typeof(gain)=="uint32")) { + ot = 6; + model.sim = list("gainblk_ui32s",4); + } else if ((typeof(gain)=="uint16")) { + ot = 7; + model.sim = list("gainblk_ui16s",4); + } else if ((typeof(gain)=="uint8")) { + ot = 8; + model.sim = list("gainblk_ui8s",4); + } else { message("type is not supported."); -ok=false; + ok = false; } -} else if ((over==2)) { -if ((typeof(gain)=="int32")) { -ot=3; -model.sim=list("gainblk_i32e",4); -} else if ((typeof(gain)=="int16")) { -ot=4; -model.sim=list("gainblk_i16e",4); -} else if ((typeof(gain)=="int8")) { -ot=5; -model.sim=list("gainblk_i8e",4); -} else if ((typeof(gain)=="uint32")) { -ot=6; -model.sim=list("gainblk_ui32e",4); -} else if ((typeof(gain)=="uint16")) { -ot=7; -model.sim=list("gainblk_ui16e",4); -} else if ((typeof(gain)=="uint8")) { -ot=8; -model.sim=list("gainblk_ui8e",4); -} else { + } else if ((over==2)) { + if ((typeof(gain)=="int32")) { + ot = 3; + model.sim = list("gainblk_i32e",4); + } else if ((typeof(gain)=="int16")) { + ot = 4; + model.sim = list("gainblk_i16e",4); + } else if ((typeof(gain)=="int8")) { + ot = 5; + model.sim = list("gainblk_i8e",4); + } else if ((typeof(gain)=="uint32")) { + ot = 6; + model.sim = list("gainblk_ui32e",4); + } else if ((typeof(gain)=="uint16")) { + ot = 7; + model.sim = list("gainblk_ui16e",4); + } else if ((typeof(gain)=="uint8")) { + ot = 8; + model.sim = list("gainblk_ui8e",4); + } else { message("type is not an integer."); -ok=false; + ok = false; } -} else { + } else { message("Do on Overflow must be 0,1,2"); -ok=false; + ok = false; } -model.rpar=[]; -model.opar=list(gain.slice()); + model.rpar = []; + model.opar = list(gain.slice()); } -if (ok) { -[out,in1]=size(gain); -if (out*in1!=1) { -[model,graphics,ok]=set_io(model,graphics,list([in1,-1],ot),list([out,-1],ot),[],[]); -} else { -[model,graphics,ok]=set_io(model,graphics,list([-1,-2],ot),list([-1,-2],ot),[],[]); + if (ok) { + [out,in1] = size(gain); + if (out*in1!=1) { + [model,graphics,ok] = set_io(model,graphics,list([in1,-1],ot),list([out,-1],ot),[],[]); + } else { + [model,graphics,ok] = set_io(model,graphics,list([-1,-2],ot),list([-1,-2],ot),[],[]); } } -if (ok) { -graphics.exprs=exprs; -x.graphics=graphics; -x.model=model; + if (ok) { + graphics.exprs = exprs; + x.graphics = graphics; + x.model = model; break; } } |