diff options
Diffstat (limited to 'js')
126 files changed, 207 insertions, 0 deletions
diff --git a/js/Branching/CLKGOTO.js b/js/Branching/CLKGOTO.js index 816491f2..e336116e 100644 --- a/js/Branching/CLKGOTO.js +++ b/js/Branching/CLKGOTO.js @@ -35,6 +35,7 @@ function CLKGOTO() { } if (((this.tagvis<1)||(this.tagvis>3))) { message("Tag Visibility must be between 1 and 3"); + throw "user error"; var ok = false; } this.tagvis = int(this.tagvis); diff --git a/js/Branching/DEMUX.js b/js/Branching/DEMUX.js index 0672f916..6d1b4fc7 100644 --- a/js/Branching/DEMUX.js +++ b/js/Branching/DEMUX.js @@ -35,6 +35,7 @@ function DEMUX() { if (size(this.out,"*")==1) { if (this.out<2||this.out>31) { message("Block must have at least 2 and at most 31 output ports"); + throw "user error"; var ok = false; } else { var tmpvar0 = check_io(this.model,this.graphics,0,-transpose([1:this.out]),[],[]); @@ -45,6 +46,7 @@ function DEMUX() { } else { if (size(this.out,"*")<2||or(this.out==0)||size(this.out,"*")>31) { message([["Block must have at least 2 and at most 31 output ports"],["size 0 is not allowed"]]); + throw "user error"; var ok = false; } else { if (min(this.out)<0) { diff --git a/js/Branching/DEMUX_f.js b/js/Branching/DEMUX_f.js index 235a3be9..4c63f26d 100644 --- a/js/Branching/DEMUX_f.js +++ b/js/Branching/DEMUX_f.js @@ -35,6 +35,7 @@ function DEMUX_f() { if (size(this.out,"*")==1) { if (this.out<2||this.out>8) { message("Block must have at least 2 and at most 8 output ports"); + throw "user error"; var ok = false; } else { var tmpvar0 = check_io(this.model,this.graphics,0,-transpose([1:this.out]),[],[]); @@ -45,6 +46,7 @@ function DEMUX_f() { } else { if (size(this.out,"*")<2||size(this.out,"*")>8||or(this.out==0)) { message([["Block must have at least 2 and at most 8 output ports"],["and size 0 is not allowed"]]); + throw "user error"; var ok = false; } else { if (min(this.out)<0) { diff --git a/js/Branching/ESELECT_f.js b/js/Branching/ESELECT_f.js index ce4f64f3..094fa043 100644 --- a/js/Branching/ESELECT_f.js +++ b/js/Branching/ESELECT_f.js @@ -57,6 +57,7 @@ function ESELECT_f() { this.out = int(this.out); if (this.out<2) { message("Block must have at least two output ports"); + throw "user error"; } else { var tmpvar0 = check_io(this.model,this.graphics,1,[],this.inh,[ones(this.out,1)]); this.model = tmpvar0[0]; diff --git a/js/Branching/GOTO.js b/js/Branching/GOTO.js index 2b3370a1..8d660d2f 100644 --- a/js/Branching/GOTO.js +++ b/js/Branching/GOTO.js @@ -41,6 +41,7 @@ function GOTO() { this.tagvis = int(this.tagvis); if (((this.tagvis<1)||(this.tagvis>3))) { message("Tag Visibility must be between 1 and 3"); + throw "user error"; var ok = false; } if (ok) { diff --git a/js/Branching/GOTOMO.js b/js/Branching/GOTOMO.js index 285109a1..349cc175 100644 --- a/js/Branching/GOTOMO.js +++ b/js/Branching/GOTOMO.js @@ -44,6 +44,7 @@ function GOTOMO() { this.tagvis = int(this.tagvis); if (((this.tagvis<1)||(this.tagvis>3))) { message("Tag Visibility must be between 1 and 3"); + throw "user error"; var ok = false; } if (ok) { diff --git a/js/Branching/ISELECT_f.js b/js/Branching/ISELECT_f.js index e98628c6..72914649 100644 --- a/js/Branching/ISELECT_f.js +++ b/js/Branching/ISELECT_f.js @@ -38,6 +38,7 @@ function ISELECT_f() { } if (this.z0>this.nout||this.z0<=0) { message("initial connected input is not a valid input port number"); + throw "user error"; } else { var tmpvar0 = check_io(this.model,this.graphics,-1,-ones(this.nout,1),ones(this.nout,1),[]); this.model = tmpvar0[0]; diff --git a/js/Branching/ISELECT_m.js b/js/Branching/ISELECT_m.js index 93d0da7b..db7bb056 100644 --- a/js/Branching/ISELECT_m.js +++ b/js/Branching/ISELECT_m.js @@ -48,8 +48,10 @@ function ISELECT_m() { } if (this.z0>this.nout||this.z0<=0) { message("initial connected input is not a valid input port number"); + throw "user error"; } else if (((this.typ<1)||(this.typ>8))) { message("Datatype is not supported"); + throw "user error"; var ok = false; } else { var it = this.typ; diff --git a/js/Branching/MUX.js b/js/Branching/MUX.js index 9b1fd5bd..4d221b68 100644 --- a/js/Branching/MUX.js +++ b/js/Branching/MUX.js @@ -31,6 +31,7 @@ function MUX() { if (size(this.in1,"*")==1) { if (this.in1<2||this.in1>31) { message("Block must have at least two input ports and at most 31"); + throw "user error"; var ok = false; } else { var tmpvar0 = check_io(this.model,this.graphics,-transpose([1:this.in1]),0,[],[]); @@ -41,6 +42,7 @@ function MUX() { } else { if (size(this.in1,"*")<2||or(this.in1==0)||size(this.in1,"*")>31) { message([["Block must have at least two input ports"],["and at most 31. Size 0 is not allowed. "]]); + throw "user error"; var ok = false; } else { if (min(this.in1)<0) { diff --git a/js/Branching/MUX_f.js b/js/Branching/MUX_f.js index c4348b93..88a93747 100644 --- a/js/Branching/MUX_f.js +++ b/js/Branching/MUX_f.js @@ -31,6 +31,7 @@ function MUX_f() { if (size(this.in1,"*")==1) { if (this.in1<2||this.in1>8) { message("Block must have at least two input ports and at most eight"); + throw "user error"; var ok = false; } else { var tmpvar0 = check_io(this.model,this.graphics,-transpose([1:this.in1]),0,[],[]); @@ -41,6 +42,7 @@ function MUX_f() { } else { if (size(this.in1,"*")<2||size(this.in1,"*")>8||or(this.in1==0)) { message([["Block must have at least two input ports"],["and at most eight, and size 0 is not allowed. "]]); + throw "user error"; var ok = false; } else { if (min(this.in1)<0) { diff --git a/js/Branching/M_SWITCH.js b/js/Branching/M_SWITCH.js index d314dc2e..c27ece64 100644 --- a/js/Branching/M_SWITCH.js +++ b/js/Branching/M_SWITCH.js @@ -41,10 +41,13 @@ function M_SWITCH() { this.base = int(this.base); if (this.nin<1) { message("Number of inputs must be >=1 "); + throw "user error"; } else if (!((this.base==1)||(this.base==0))) { message("base indexing must be 1 or 0"); + throw "user error"; } else if (!((this.rule==1)||(this.rule==0)||(this.rule==2)||(this.rule==3))) { message("incorrect rounding rule"); + throw "user error"; } else { if (this.nin==1) { var in1 = [[1,1],[-1,1]]; diff --git a/js/Branching/RELAY_f.js b/js/Branching/RELAY_f.js index 68a53a52..801316cf 100644 --- a/js/Branching/RELAY_f.js +++ b/js/Branching/RELAY_f.js @@ -40,6 +40,7 @@ function RELAY_f() { } if (this.z0>this.nin||this.z0<=0) { message("initial connected input is not a valid input port number"); + throw "user error"; } else { var tmpvar0 = check_io(this.model,this.graphics,-ones(this.nin,1),-1,ones(this.nin,1),[]); this.model = tmpvar0[0]; diff --git a/js/Branching/SCALAR2VECTOR.js b/js/Branching/SCALAR2VECTOR.js index ab89dbb4..d43edce8 100644 --- a/js/Branching/SCALAR2VECTOR.js +++ b/js/Branching/SCALAR2VECTOR.js @@ -33,6 +33,7 @@ function SCALAR2VECTOR() { this.nout = int(this.nout); if ((this.nout!=-1&&(this.nout<=0))) { message("size of output must be -1 or >0"); + throw "user error"; var ok = false; } if (ok) { diff --git a/js/Branching/SELECT_f.js b/js/Branching/SELECT_f.js index 56fcd596..e411d498 100644 --- a/js/Branching/SELECT_f.js +++ b/js/Branching/SELECT_f.js @@ -38,6 +38,7 @@ function SELECT_f() { } if (this.z0>this.nin||this.z0<=0) { message("initial connected input is not a valid input port number"); + throw "user error"; } else { var tmpvar0 = check_io(this.model,this.graphics,-ones(this.nin,1),-1,ones(this.nin,1),[]); this.model = tmpvar0[0]; diff --git a/js/Branching/SELECT_m.js b/js/Branching/SELECT_m.js index cc49688c..df649088 100644 --- a/js/Branching/SELECT_m.js +++ b/js/Branching/SELECT_m.js @@ -48,8 +48,10 @@ function SELECT_m() { } if (this.z0>this.nin||this.z0<=0) { message("initial connected input is not a valid input port number"); + throw "user error"; } else if (((this.typ<1)||(this.typ>8))&&(this.typ!=-1)) { message("Datatype is not supported"); + throw "user error"; var ok = false; } else { var it = this.typ*ones(1,this.nin); diff --git a/js/Branching/SWITCH2_m.js b/js/Branching/SWITCH2_m.js index c1d83765..cade952d 100644 --- a/js/Branching/SWITCH2_m.js +++ b/js/Branching/SWITCH2_m.js @@ -65,6 +65,7 @@ function SWITCH2_m() { } if (((this.ot<1)||(this.ot>8))&&(this.ot!=-1)) { message("Datatype is not supported"); + throw "user error"; var ok = false; } if (ok) { diff --git a/js/Branching/SWITCH_f.js b/js/Branching/SWITCH_f.js index 8ee57e8b..fd7a2526 100644 --- a/js/Branching/SWITCH_f.js +++ b/js/Branching/SWITCH_f.js @@ -39,6 +39,7 @@ function SWITCH_f() { } if (this.z0>this.nin||this.z0<=0) { message("initial connected input is not a valid input port number"); + throw "user error"; } else { var tmpvar0 = check_io(this.model,this.graphics,-ones(this.nin,1),-1,[],[]); this.model = tmpvar0[0]; diff --git a/js/Events/EVTDLY_c.js b/js/Events/EVTDLY_c.js index a0e25f2c..b3b35bda 100644 --- a/js/Events/EVTDLY_c.js +++ b/js/Events/EVTDLY_c.js @@ -37,6 +37,7 @@ function EVTDLY_c() { } if (this.dt<=0) { message("Delay must be positive"); + throw "user error"; var ok = false; } if (ok) { diff --git a/js/Events/EVTDLY_f.js b/js/Events/EVTDLY_f.js index b6d7a683..244d0e3f 100644 --- a/js/Events/EVTDLY_f.js +++ b/js/Events/EVTDLY_f.js @@ -37,6 +37,7 @@ function EVTDLY_f() { } if (this.dt<=0) { message("Delay must be positive"); + throw "user error"; var ok = false; } if (ok) { diff --git a/js/Events/M_freq.js b/js/Events/M_freq.js index e3fa2f25..c764176a 100644 --- a/js/Events/M_freq.js +++ b/js/Events/M_freq.js @@ -38,12 +38,15 @@ function M_freq() { this.frequ = this.frequ.slice(); if ((size(this.frequ,"*"))!=(size(this.offset,"*"))) { message("offset and frequency must have the same size"); + throw "user error"; var ok = false; } else if (or(this.frequ<0)) { message("Frequency must be a positif number"); + throw "user error"; var ok = false; } else if (or(abs(this.offset)>this.frequ)) { message("The |Offset| must be less than the Frequency"); + throw "user error"; var ok = false; } if (ok) { diff --git a/js/Linear/CLR.js b/js/Linear/CLR.js index 197cce0a..b8ae68c6 100644 --- a/js/Linear/CLR.js +++ b/js/Linear/CLR.js @@ -47,6 +47,7 @@ function CLR() { } if (degree(this.num)>degree(this.den)) { message("Transfer function must be proper or strictly proper."); + throw "user error"; var ok = false; } if (ok) { diff --git a/js/Linear/CLR_f.js b/js/Linear/CLR_f.js index 2f6a71a1..dc279d57 100644 --- a/js/Linear/CLR_f.js +++ b/js/Linear/CLR_f.js @@ -47,6 +47,7 @@ function CLR_f() { } if (degree(this.num)>degree(this.den)) { message("Transfer must be proper or strictly proper"); + throw "user error"; var ok = false; } if (ok) { diff --git a/js/Linear/CLSS.js b/js/Linear/CLSS.js index 2a1d1eab..531998b2 100644 --- a/js/Linear/CLSS.js +++ b/js/Linear/CLSS.js @@ -72,6 +72,7 @@ function CLSS() { } if (ms!=ns||!okD) { message("Matrix A is not square or D has wrong dimension"); + throw "user error"; } else { var tmpvar1 = check_io(this.model,this.graphics,in1,out,[],[]); this.model = tmpvar1[0]; diff --git a/js/Linear/CLSS_f.js b/js/Linear/CLSS_f.js index 4104c785..2e636fd0 100644 --- a/js/Linear/CLSS_f.js +++ b/js/Linear/CLSS_f.js @@ -62,6 +62,7 @@ function CLSS_f() { var ns = tmpvar0[1]; if (ms!=ns) { message("A matrix must be square"); + throw "user error"; } else { var tmpvar1 = check_io(this.model,this.graphics,in1,out,[],[]); this.model = tmpvar1[0]; diff --git a/js/Linear/DELAYV_f.js b/js/Linear/DELAYV_f.js index aad2037a..7ecd61f0 100644 --- a/js/Linear/DELAYV_f.js +++ b/js/Linear/DELAYV_f.js @@ -48,10 +48,12 @@ function DELAYV_f() { } if (size(this.zz0,"*")<2) { message("Register length must be at least 2"); + throw "user error"; var ok = false; } if (this.T<=0) { message("Delay must be positive"); + throw "user error"; var ok = false; } if (ok) { diff --git a/js/Linear/DELAY_f.js b/js/Linear/DELAY_f.js index 158a0073..383db3f2 100644 --- a/js/Linear/DELAY_f.js +++ b/js/Linear/DELAY_f.js @@ -111,6 +111,7 @@ function DELAY_f() { } if (!ok) { message(mess); + throw "user error"; } else { evtdly.graphics.exprs[1-1] = this.exprs[1-1]; if (evtdly.model.rpar!=this.dt) { diff --git a/js/Linear/DIFF_c.js b/js/Linear/DIFF_c.js index 83b75270..10c440bb 100644 --- a/js/Linear/DIFF_c.js +++ b/js/Linear/DIFF_c.js @@ -40,6 +40,7 @@ function DIFF_c() { var Nxd = size(this.xd0,"*"); if ((N!=Nxd)) { message("Incompatible sizes: states and their derivatives should have the same size "); + throw "user error"; var ask_again = true; } if ((N<=0&&!ask_again)) { diff --git a/js/Linear/DLR.js b/js/Linear/DLR.js index 8c9fc521..1c248b71 100644 --- a/js/Linear/DLR.js +++ b/js/Linear/DLR.js @@ -45,6 +45,7 @@ function DLR() { } if (degree(this.num)>degree(this.den)) { message("Transfer function must be proper"); + throw "user error"; var ok = false; } if (ok) { diff --git a/js/Linear/DLR_f.js b/js/Linear/DLR_f.js index d5be1fd8..32bc2559 100644 --- a/js/Linear/DLR_f.js +++ b/js/Linear/DLR_f.js @@ -45,6 +45,7 @@ function DLR_f() { } if (degree(this.num)>degree(this.den)) { message("Transfer must be proper"); + throw "user error"; var ok = false; } if (ok) { diff --git a/js/Linear/DLSS.js b/js/Linear/DLSS.js index c63a7a49..b48aafee 100644 --- a/js/Linear/DLSS.js +++ b/js/Linear/DLSS.js @@ -71,6 +71,7 @@ function DLSS() { } if (ms!=ns||!okD) { message("Matrix A is not square or D has wrong dimension"); + throw "user error"; } else { var tmpvar1 = check_io(this.model,this.graphics,in1,out,1,[]); this.model = tmpvar1[0]; diff --git a/js/Linear/DLSS_f.js b/js/Linear/DLSS_f.js index b70278c2..15da1aa5 100644 --- a/js/Linear/DLSS_f.js +++ b/js/Linear/DLSS_f.js @@ -61,6 +61,7 @@ function DLSS_f() { var ns = tmpvar0[1]; if (ms!=ns) { message("A matrix must be square"); + throw "user error"; } else { var tmpvar1 = check_io(this.model,this.graphics,in1,out,1,[]); this.model = tmpvar1[0]; diff --git a/js/Linear/DOLLAR.js b/js/Linear/DOLLAR.js index af2cc3f1..ef6ba02c 100644 --- a/js/Linear/DOLLAR.js +++ b/js/Linear/DOLLAR.js @@ -80,6 +80,7 @@ function DOLLAR() { var ot = 8; } else { message("type is not recognized"); + throw "user error"; var ok = false; } if (ok) { diff --git a/js/Linear/DOLLAR_m.js b/js/Linear/DOLLAR_m.js index d0b4f3ce..e2095ec3 100644 --- a/js/Linear/DOLLAR_m.js +++ b/js/Linear/DOLLAR_m.js @@ -80,6 +80,7 @@ function DOLLAR_m() { var ot = 8; } else { message("type is not recognized"); + throw "user error"; var ok = false; } if (ok) { diff --git a/js/Linear/GAINBLK.js b/js/Linear/GAINBLK.js index 1bc5e136..a70acaf0 100644 --- a/js/Linear/GAINBLK.js +++ b/js/Linear/GAINBLK.js @@ -44,6 +44,7 @@ function GAINBLK() { } if (this.gain==[]) { message("Gain must have at least one element"); + throw "user error"; } else { if (typeof(this.gain)=="constant") { if (isreal(this.gain)) { @@ -54,6 +55,7 @@ function GAINBLK() { this.model.opar = list(); } else { message("type is not supported"); + throw "user error"; var ok = false; } } else { @@ -78,6 +80,7 @@ function GAINBLK() { this.model.sim = list(new ScilabString(["gainblk_ui8n"]), new ScilabDouble([4])); } else { message("type is not supported."); + throw "user error"; var ok = false; } } else if ((this.over==1)) { @@ -101,6 +104,7 @@ function GAINBLK() { this.model.sim = list(new ScilabString(["gainblk_ui8s"]), new ScilabDouble([4])); } else { message("type is not supported."); + throw "user error"; var ok = false; } } else if ((this.over==2)) { @@ -124,10 +128,12 @@ function GAINBLK() { this.model.sim = list(new ScilabString(["gainblk_ui8e"]), new ScilabDouble([4])); } else { message("type is not an integer."); + throw "user error"; var ok = false; } } else { message("Do on Overflow must be 0,1,2"); + throw "user error"; var ok = false; } this.model.rpar = new ScilabDouble([]); diff --git a/js/Linear/GAINBLK_f.js b/js/Linear/GAINBLK_f.js index d7bc7731..5003f542 100644 --- a/js/Linear/GAINBLK_f.js +++ b/js/Linear/GAINBLK_f.js @@ -35,6 +35,7 @@ function GAINBLK_f() { } if (this.gain==[]) { message("Gain must have at least one element"); + throw "user error"; } else { var tmpvar0 = size(this.gain); var out = tmpvar0[0]; diff --git a/js/Linear/GAIN_f.js b/js/Linear/GAIN_f.js index 19919933..201a47a2 100644 --- a/js/Linear/GAIN_f.js +++ b/js/Linear/GAIN_f.js @@ -35,6 +35,7 @@ function GAIN_f() { } if (this.gain==[]) { message("Gain must have at least one element"); + throw "user error"; } else { var tmpvar0 = size(this.gain); var out = tmpvar0[0]; diff --git a/js/Linear/INTEGRAL.js b/js/Linear/INTEGRAL.js index 909472d8..e10e8c60 100644 --- a/js/Linear/INTEGRAL.js +++ b/js/Linear/INTEGRAL.js @@ -59,12 +59,15 @@ function INTEGRAL() { } if ((size(this.x0,1)!=size(this.maxp,1)||size(this.x0,1)!=size(this.lowp,1))) { message("x0 and Upper limit and Lower limit must have same size"); + throw "user error"; var ok = false; } else if (or(this.maxp<=this.lowp)) { message("Upper limits must be > Lower limits"); + throw "user error"; var ok = false; } else if (or(this.x0>this.maxp)||or(this.x0<this.lowp)) { message("Initial condition x0 should be inside the limits"); + throw "user error"; var ok = false; } else { var rpar = [[this.maxp],[this.lowp]]; diff --git a/js/Linear/INTEGRAL_m.js b/js/Linear/INTEGRAL_m.js index cfc40c2c..272db68a 100644 --- a/js/Linear/INTEGRAL_m.js +++ b/js/Linear/INTEGRAL_m.js @@ -63,12 +63,15 @@ function INTEGRAL_m() { } if ((size(this.x0)!=size(this.maxp)||size(this.x0)!=size(this.lowp))) { message("x0 and Upper limit and Lower limit must have same size"); + throw "user error"; var ok = false; } else if (or(this.maxp<=this.lowp)) { message("Upper limits must be > Lower limits"); + throw "user error"; var ok = false; } else if (or(this.x0>this.maxp)||or(this.x0<this.lowp)) { message("Initial condition x0 should be inside the limits"); + throw "user error"; var ok = false; } else { var rpar = [[real(this.maxp.slice())],[real(this.lowp.slice())]]; @@ -84,12 +87,15 @@ function INTEGRAL_m() { } if ((size(this.x0)!=size(this.maxp)||size(this.x0)!=size(this.lowp))) { message("x0 and Upper limit and Lower limit must have same size"); + throw "user error"; var ok = false; } else if (or(real(this.maxp)<=real(this.lowp))||or(imag(this.maxp)<=imag(this.lowp))) { message("Upper limits must be > Lower limits"); + throw "user error"; var ok = false; } else if (or(real(this.x0)>real(this.maxp))||or(real(this.x0)<real(this.lowp))||or(imag(this.x0)>imag(this.maxp))||or(imag(this.x0)<imag(this.lowp))) { message("Initial condition x0 should be inside the limits"); + throw "user error"; var ok = false; } else { var rpar = [[real(this.maxp.slice())],[real(this.lowp.slice())],[imag(this.maxp.slice())],[imag(this.lowp.slice())]]; @@ -116,6 +122,7 @@ function INTEGRAL_m() { var ot = 2; } else { message("Datatype is not supported"); + throw "user error"; var ok = false; } if (ok) { diff --git a/js/Linear/REGISTER.js b/js/Linear/REGISTER.js index b30d1bfa..a53a86a0 100644 --- a/js/Linear/REGISTER.js +++ b/js/Linear/REGISTER.js @@ -39,6 +39,7 @@ function REGISTER() { } if (prod(size(this.z0))<1) { message("Register length must be at least 1"); + throw "user error"; var ok = false; } if (this.it==1) { @@ -67,6 +68,7 @@ function REGISTER() { this.z0 = uint8(this.z0); } else { message("Datatype is not supported"); + throw "user error"; var ok = false; } this.model.odstate = list(new ScilabDouble([this.z0])); diff --git a/js/Linear/REGISTER_f.js b/js/Linear/REGISTER_f.js index 8c75a7c0..c3671a98 100644 --- a/js/Linear/REGISTER_f.js +++ b/js/Linear/REGISTER_f.js @@ -31,6 +31,7 @@ function REGISTER_f() { } if (prod(size(this.z0))<1) { message("Register length must be at least 1"); + throw "user error"; var ok = false; } if (ok) { diff --git a/js/Linear/SAMPHOLD_m.js b/js/Linear/SAMPHOLD_m.js index 773716d7..2fca4c97 100644 --- a/js/Linear/SAMPHOLD_m.js +++ b/js/Linear/SAMPHOLD_m.js @@ -37,6 +37,7 @@ function SAMPHOLD_m() { } if (((this.it<1)||(this.it>8))) { message("Datatype is not supported"); + throw "user error"; var ok = false; } if (ok) { diff --git a/js/Linear/SOM_f.js b/js/Linear/SOM_f.js index d7560f45..d6914626 100644 --- a/js/Linear/SOM_f.js +++ b/js/Linear/SOM_f.js @@ -36,6 +36,7 @@ function SOM_f() { var str = [["This sum block is obsolete","parameters cannot be modified. Please replace it with new sum block"],["and gain blocks in the linear palette"," ","Input ports are located at up, side and down positions.","Current gains are:"]]; var str = [[str],[(part(labs.slice(),1,7)+this.exprs.slice())]]; message(str); + throw "user error"; return new BasicBlock(this.x); } } diff --git a/js/Linear/SUMMATION.js b/js/Linear/SUMMATION.js index 6ad993ed..6ab823b6 100644 --- a/js/Linear/SUMMATION.js +++ b/js/Linear/SUMMATION.js @@ -45,11 +45,13 @@ function SUMMATION() { this.sgn = this.sgn.slice(); if ((this.satur!=0&&this.satur!=1&&this.satur!=2)) { message("Do on overflow must be 0,1,2"); + throw "user error"; var ok = false; } if (size(this.sgn,1)==1) { if (this.sgn<1) { message("Number of inputs must be > 0"); + throw "user error"; var ok = false; } else if (this.sgn==1) { var in1 = -1; @@ -67,6 +69,7 @@ function SUMMATION() { } else { if (!and(abs(this.sgn)==1)) { message("Signs can only be +1 or -1"); + throw "user error"; var ok = false; } else { var in1 = -ones(size(this.sgn,1),1); @@ -83,6 +86,7 @@ function SUMMATION() { this.model.sim = list(new ScilabString(["summation_z"]), new ScilabDouble([4])); } else if (((this.Datatype<1)||(this.Datatype>8))) { message("Datatype is not supported"); + throw "user error"; var ok = false; } else { if (this.satur==0) { diff --git a/js/Linear/TCLSS.js b/js/Linear/TCLSS.js index fddee335..391f5387 100644 --- a/js/Linear/TCLSS.js +++ b/js/Linear/TCLSS.js @@ -64,6 +64,7 @@ function TCLSS() { var ns = tmpvar0[1]; if (ms!=ns) { message("A matrix must be square"); + throw "user error"; } else { var tmpvar1 = check_io(this.model,this.graphics,[[in1],[ms]],out,1,[]); this.model = tmpvar1[0]; diff --git a/js/Linear/TCLSS_f.js b/js/Linear/TCLSS_f.js index 794ba1f8..c9f91609 100644 --- a/js/Linear/TCLSS_f.js +++ b/js/Linear/TCLSS_f.js @@ -64,6 +64,7 @@ function TCLSS_f() { var ns = tmpvar0[1]; if (ms!=ns) { message("A matrix must be square"); + throw "user error"; } else { var tmpvar1 = check_io(this.model,this.graphics,[[in1],[ms]],out,1,[]); this.model = tmpvar1[0]; diff --git a/js/Linear/TIME_DELAY.js b/js/Linear/TIME_DELAY.js index 7b0bc4f9..7abbe110 100644 --- a/js/Linear/TIME_DELAY.js +++ b/js/Linear/TIME_DELAY.js @@ -42,10 +42,12 @@ function TIME_DELAY() { } if (this.N<2) { message("Buffer must be larger than 2"); + throw "user error"; var ok = false; } if (this.T<=0) { message("Delay must be positive"); + throw "user error"; var ok = false; } if (ok) { diff --git a/js/Linear/VARIABLE_DELAY.js b/js/Linear/VARIABLE_DELAY.js index 1e0ad2e2..74cd98c6 100644 --- a/js/Linear/VARIABLE_DELAY.js +++ b/js/Linear/VARIABLE_DELAY.js @@ -42,10 +42,12 @@ function VARIABLE_DELAY() { } if (this.N<2) { message("Buffer must be larger than 2"); + throw "user error"; var ok = false; } if (this.T<=0) { message("Delay must be positive"); + throw "user error"; var ok = false; } if (ok) { diff --git a/js/MatrixOp/CUMSUM.js b/js/MatrixOp/CUMSUM.js index 5369128f..7a3d634a 100644 --- a/js/MatrixOp/CUMSUM.js +++ b/js/MatrixOp/CUMSUM.js @@ -61,6 +61,7 @@ function CUMSUM() { var out = [1,-2]; } else { message("decomposition type is not supported"); + throw "user error"; var ok = false; } var it = 1; @@ -74,12 +75,14 @@ function CUMSUM() { var function_name = "cumsumz_c"; } else { message("decomposition type is not supported"); + throw "user error"; var ok = false; } var it = 2; var ot = 2; } else { message("Datatype is not supported"); + throw "user error"; var ok = false; } var in1 = [this.model.in,this.model.in2]; diff --git a/js/MatrixOp/EXTRACT.js b/js/MatrixOp/EXTRACT.js index ba87b44f..31b97eff 100644 --- a/js/MatrixOp/EXTRACT.js +++ b/js/MatrixOp/EXTRACT.js @@ -61,23 +61,27 @@ function EXTRACT() { var it = 2; } else { message("Datatype is not supported"); + throw "user error"; var ok = false; } var ma = size(this.a,1); var mb = size(this.b,1); if ((ma==0||mb==0)) { message("empty field"); + throw "user error"; var ok = false; } for (i=1;i<=ma;i+=1) { if ((this.a[i-1]<=0)) { message("invalid index"); + throw "user error"; var ok = false; } } for (j=1;j<=mb;j+=1) { if ((this.b[j-1]<=0)) { message("invalid index"); + throw "user error"; var ok = false; } } diff --git a/js/MatrixOp/EXTTRI.js b/js/MatrixOp/EXTTRI.js index 51c3ebe0..d4d77d97 100644 --- a/js/MatrixOp/EXTTRI.js +++ b/js/MatrixOp/EXTTRI.js @@ -58,6 +58,7 @@ function EXTTRI() { var function_name = "extdiag"; } else { message("decomposition type is not supported"); + throw "user error"; var ok = false; } var it = 1; @@ -71,12 +72,14 @@ function EXTTRI() { var function_name = "extdiagz"; } else { message("decomposition type is not supported"); + throw "user error"; var ok = false; } var it = 2; var ot = 2; } else { message("Datatype is not supported"); + throw "user error"; var ok = false; } var in1 = [this.model.in,this.model.in2]; diff --git a/js/MatrixOp/MATBKSL.js b/js/MatrixOp/MATBKSL.js index b5039821..f1608eba 100644 --- a/js/MatrixOp/MATBKSL.js +++ b/js/MatrixOp/MATBKSL.js @@ -55,6 +55,7 @@ function MATBKSL() { var it = [2,2]; } else { message("Datatype is not supported"); + throw "user error"; var ok = false; } var in1 = [this.model.in,this.model.in2]; diff --git a/js/MatrixOp/MATDET.js b/js/MatrixOp/MATDET.js index f47804d4..f8959160 100644 --- a/js/MatrixOp/MATDET.js +++ b/js/MatrixOp/MATDET.js @@ -55,6 +55,7 @@ function MATDET() { var it = 2; } else { message("Datatype is not supported"); + throw "user error"; var ok = false; } var in1 = [this.model.in,this.model.in2]; diff --git a/js/MatrixOp/MATDIAG.js b/js/MatrixOp/MATDIAG.js index ad1885be..0b8f6b7b 100644 --- a/js/MatrixOp/MATDIAG.js +++ b/js/MatrixOp/MATDIAG.js @@ -55,6 +55,7 @@ function MATDIAG() { var it = 2; } else { message("Datatype is not supported"); + throw "user error"; var ok = false; } var in1 = [this.model.in,this.model.in2]; diff --git a/js/MatrixOp/MATDIV.js b/js/MatrixOp/MATDIV.js index d5d8d2f7..7148a63d 100644 --- a/js/MatrixOp/MATDIV.js +++ b/js/MatrixOp/MATDIV.js @@ -55,6 +55,7 @@ function MATDIV() { var it = [2,2]; } else { message("Datatype is not supported"); + throw "user error"; var ok = false; } var in1 = [this.model.in,this.model.in2]; diff --git a/js/MatrixOp/MATEIG.js b/js/MatrixOp/MATEIG.js index 8c5f72bc..de5ac8f8 100644 --- a/js/MatrixOp/MATEIG.js +++ b/js/MatrixOp/MATEIG.js @@ -60,6 +60,7 @@ function MATEIG() { var ot = [2,2]; } else { message("decomposition type is not supported"); + throw "user error"; var ok = false; } var it = 1; @@ -74,11 +75,13 @@ function MATEIG() { var ot = [2,2]; } else { message("decomposition type is not supported"); + throw "user error"; var ok = false; } var it = 2; } else { message("Datatype is not supported"); + throw "user error"; var ok = false; } var in1 = [-1,-1]; diff --git a/js/MatrixOp/MATEXPM.js b/js/MatrixOp/MATEXPM.js index 4a3523f6..b304bd0d 100644 --- a/js/MatrixOp/MATEXPM.js +++ b/js/MatrixOp/MATEXPM.js @@ -55,6 +55,7 @@ function MATEXPM() { var it = 2; } else { message("Datatype is not supported"); + throw "user error"; var ok = false; } var in1 = [this.model.in,this.model.in2]; diff --git a/js/MatrixOp/MATINV.js b/js/MatrixOp/MATINV.js index 1f4c3589..277f14ca 100644 --- a/js/MatrixOp/MATINV.js +++ b/js/MatrixOp/MATINV.js @@ -55,6 +55,7 @@ function MATINV() { var it = 2; } else { message("Datatype is not supported"); + throw "user error"; var ok = false; } var in1 = [this.model.in,this.model.in2]; diff --git a/js/MatrixOp/MATLU.js b/js/MatrixOp/MATLU.js index 535d5d9a..ee1fe41d 100644 --- a/js/MatrixOp/MATLU.js +++ b/js/MatrixOp/MATLU.js @@ -56,6 +56,7 @@ function MATLU() { var it = 2; } else { message("Datatype is not supported"); + throw "user error"; var ok = false; } if (ok) { diff --git a/js/MatrixOp/MATMAGPHI.js b/js/MatrixOp/MATMAGPHI.js index a99bd0f0..c3b97dee 100644 --- a/js/MatrixOp/MATMAGPHI.js +++ b/js/MatrixOp/MATMAGPHI.js @@ -61,6 +61,7 @@ function MATMAGPHI() { var ot = 2; } else { message("decomposition type is not supported"); + throw "user error"; var ok = false; } var funtyp = 4; diff --git a/js/MatrixOp/MATMUL.js b/js/MatrixOp/MATMUL.js index d055e649..e85ee09e 100644 --- a/js/MatrixOp/MATMUL.js +++ b/js/MatrixOp/MATMUL.js @@ -49,10 +49,12 @@ function MATMUL() { this.rule = int(this.rule); if ((this.dtype<1||this.dtype>8)) { message("type is not supported"); + throw "user error"; var ok = false; } if ((this.rule<1||this.rule>3)) { message("Multiplication rule must be only 1,2 or 3"); + throw "user error"; var ok = false; } if ((this.dtype==1||this.dtype==2)) { diff --git a/js/MatrixOp/MATPINV.js b/js/MatrixOp/MATPINV.js index f4318c43..9caab8a1 100644 --- a/js/MatrixOp/MATPINV.js +++ b/js/MatrixOp/MATPINV.js @@ -55,6 +55,7 @@ function MATPINV() { var it = 2; } else { message("Datatype is not supported"); + throw "user error"; var ok = false; } var in1 = [this.model.in,this.model.in2]; diff --git a/js/MatrixOp/MATRESH.js b/js/MatrixOp/MATRESH.js index ed92363f..9e43baf7 100644 --- a/js/MatrixOp/MATRESH.js +++ b/js/MatrixOp/MATRESH.js @@ -54,23 +54,28 @@ function MATRESH() { var nin = size(this.l1); if (nout==0) { message("output must have at least one element"); + throw "user error"; var ok = false; } if (nin==0) { message("input must have at least one element"); + throw "user error"; var ok = false; } if (ok) { if (((this.out[1-1]>(this.l1[1-1]*this.l1[2-1])))) { message("the first dimension of the output is too big"); + throw "user error"; var ok = false; } if (((this.out[2-1]>(this.l1[1-1]*this.l1[2-1])))) { message("the second dimension of the output is too big"); + throw "user error"; var ok = false; } if ((((this.out[2-1]*this.out[1-1])>(this.l1[1-1]*this.l1[2-1])))) { message("the dimensions of the output are too big"); + throw "user error"; var ok = false; } } @@ -84,6 +89,7 @@ function MATRESH() { var it = 2; } else { message("Datatype is not supported"); + throw "user error"; var ok = false; } if (ok) { diff --git a/js/MatrixOp/MATSING.js b/js/MatrixOp/MATSING.js index 37cb4d71..ca9e64c0 100644 --- a/js/MatrixOp/MATSING.js +++ b/js/MatrixOp/MATSING.js @@ -62,6 +62,7 @@ function MATSING() { var ot = [1,1,1]; } else { message("decomposition type is not supported"); + throw "user error"; var ok = false; } var it = 1; @@ -78,11 +79,13 @@ function MATSING() { var ot = [2,1,2]; } else { message("decomposition type is not supported"); + throw "user error"; var ok = false; } var it = 2; } else { message("Datatype is not supported"); + throw "user error"; var ok = false; } var funtyp = 4; diff --git a/js/MatrixOp/MATSUM.js b/js/MatrixOp/MATSUM.js index 897d1a1d..3af2e47d 100644 --- a/js/MatrixOp/MATSUM.js +++ b/js/MatrixOp/MATSUM.js @@ -61,6 +61,7 @@ function MATSUM() { var out = [1,-2]; } else { message("decomposition type is not supported"); + throw "user error"; var ok = false; } var it = 1; @@ -77,12 +78,14 @@ function MATSUM() { var out = [1,-2]; } else { message("decomposition type is not supported"); + throw "user error"; var ok = false; } var it = 2; var ot = 2; } else { message("Datatype is not supported"); + throw "user error"; var ok = false; } var in1 = [this.model.in,this.model.in2]; diff --git a/js/MatrixOp/MATTRAN.js b/js/MatrixOp/MATTRAN.js index 79d9115c..b9603d9c 100644 --- a/js/MatrixOp/MATTRAN.js +++ b/js/MatrixOp/MATTRAN.js @@ -49,6 +49,7 @@ function MATTRAN() { var it = 2; } else { message("Datatype is not supported"); + throw "user error"; var ok = false; } var in1 = [this.model.in,this.model.in2]; diff --git a/js/MatrixOp/MATZREIM.js b/js/MatrixOp/MATZREIM.js index f6319315..a96c36d8 100644 --- a/js/MatrixOp/MATZREIM.js +++ b/js/MatrixOp/MATZREIM.js @@ -61,6 +61,7 @@ function MATZREIM() { var ot = 2; } else { message("decomposition type is not supported"); + throw "user error"; var ok = false; } var funtyp = 4; diff --git a/js/MatrixOp/ROOTCOEF.js b/js/MatrixOp/ROOTCOEF.js index 1e31ce71..db5a7a8a 100644 --- a/js/MatrixOp/ROOTCOEF.js +++ b/js/MatrixOp/ROOTCOEF.js @@ -57,6 +57,7 @@ function ROOTCOEF() { var it = 2; } else { message("Datatype is not supported"); + throw "user error"; var ok = false; } var in1 = [this.inp,this.model.in2]; diff --git a/js/MatrixOp/SQRT.js b/js/MatrixOp/SQRT.js index bb183b78..dfe08a5b 100644 --- a/js/MatrixOp/SQRT.js +++ b/js/MatrixOp/SQRT.js @@ -38,6 +38,7 @@ function SQRT() { var function_name = "matz_sqrt"; } else { message("type is not supported"); + throw "user error"; var ok = false; } var it = this.typ; diff --git a/js/MatrixOp/SUBMAT.js b/js/MatrixOp/SUBMAT.js index 81385431..118c8b9f 100644 --- a/js/MatrixOp/SUBMAT.js +++ b/js/MatrixOp/SUBMAT.js @@ -65,26 +65,32 @@ function SUBMAT() { var it = 2; } else { message("Datatype is not supported"); + throw "user error"; var ok = false; } if ((this.a<=0)||(this.b<=0)||(this.c<=0)||(this.d<=0)) { message("invalid index"); + throw "user error"; var ok = false; } if (this.b<this.a) { message("ending row must be greater than starting row"); + throw "user error"; var ok = false; } if (this.d<this.c) { message("ending column must be greater than starting column"); + throw "user error"; var ok = false; } if (this.b>this.inp[1-1]) { message("index of ending row is out of range"); + throw "user error"; var ok = false; } if (this.d>this.inp[2-1]) { message("index of ending column is out of range"); + throw "user error"; var ok = false; } this.model.ipar = new ScilabDouble([this.a],[this.b],[this.c],[this.d]); diff --git a/js/Misc/BOUNCE.js b/js/Misc/BOUNCE.js index 4c38edd7..cc99a5ad 100644 --- a/js/Misc/BOUNCE.js +++ b/js/Misc/BOUNCE.js @@ -91,9 +91,11 @@ function BOUNCE() { } if (n!=size(this.y,"*")||n!=size(this.rpar1,"*")||n!=size(this.rpar2,"*")||n!=size(this.xd,"*")||n!=size(this.yd,"*")) { message("All vectors must have equal size"); + throw "user error"; var ok = false; } else if (!(min([[this.rpar1],[this.rpar2]])>0)) { message("Mass and radius must be >0"); + throw "user error"; var ok = false; } if (!ok) { diff --git a/js/Misc/BOUNCEXY.js b/js/Misc/BOUNCEXY.js index b9d8c740..8a7bd9f9 100644 --- a/js/Misc/BOUNCEXY.js +++ b/js/Misc/BOUNCEXY.js @@ -86,6 +86,7 @@ function BOUNCEXY() { } if (!ok) { message(mess); + throw "user error"; } else { var rpar = [[this.xmin],[this.xmax],[this.ymin],[this.ymax]]; var ipar = [[this.win],[this.imode],[this.clrs.slice()]]; diff --git a/js/Misc/BPLATFORM.js b/js/Misc/BPLATFORM.js index 0e4c663f..0c93f6a8 100644 --- a/js/Misc/BPLATFORM.js +++ b/js/Misc/BPLATFORM.js @@ -66,6 +66,7 @@ function BPLATFORM() { } if (!ok) { message(mess); + throw "user error"; } else { var rpar = [[this.plen],[this.csiz],[this.phi],[this.xmin],[this.xmax],[this.ymin],[this.ymax]]; this.model.rpar = new ScilabDouble(rpar); diff --git a/js/Misc/CBLOCK.js b/js/Misc/CBLOCK.js index 358b939f..91cec33f 100644 --- a/js/Misc/CBLOCK.js +++ b/js/Misc/CBLOCK.js @@ -99,6 +99,7 @@ function CBLOCK() { if ([[this.ci],[this.co]]!=[]) { if (max([[this.ci],[this.co]])>1) { message("vector event links not supported"); + throw "user error"; var ok = false; } } diff --git a/js/Misc/CBLOCK4.js b/js/Misc/CBLOCK4.js index 0172f4e3..247ef9b2 100644 --- a/js/Misc/CBLOCK4.js +++ b/js/Misc/CBLOCK4.js @@ -90,6 +90,7 @@ function CBLOCK4() { if ([[this.ci],[this.co]]!=[]) { if (max([[this.ci],[this.co]])>1) { message("vector event links not supported"); + throw "user error"; var ok = false; } } diff --git a/js/Misc/CONSTRAINT2_c.js b/js/Misc/CONSTRAINT2_c.js index d8254434..192d0ab0 100644 --- a/js/Misc/CONSTRAINT2_c.js +++ b/js/Misc/CONSTRAINT2_c.js @@ -47,6 +47,7 @@ function CONSTRAINT2_c() { var Nid = size(this.id,"*"); if ((N!=Nxd)||(N!=Nid)) { message("incompatible sizes, states, their derivatives, and ID should be the same size "); + throw "user error"; var ask_again = true; } if ((N<=0&&!ask_again)) { diff --git a/js/Misc/CONSTRAINT_c.js b/js/Misc/CONSTRAINT_c.js index 5ab6bdf0..616d04e7 100644 --- a/js/Misc/CONSTRAINT_c.js +++ b/js/Misc/CONSTRAINT_c.js @@ -33,6 +33,7 @@ function CONSTRAINT_c() { var N = size(this.x0,"*"); if (N<=0) { message("number of states (constraints) must be > 0 "); + throw "user error"; } else { var tmpvar0 = check_io(this.model,this.graphics,N,N,[],[]); this.model = tmpvar0[0]; diff --git a/js/Misc/DEADBAND.js b/js/Misc/DEADBAND.js index f2c942f0..dfc613c6 100644 --- a/js/Misc/DEADBAND.js +++ b/js/Misc/DEADBAND.js @@ -41,6 +41,7 @@ function DEADBAND() { } if (this.maxp<=this.minp) { message("Upper limit must be > Lower limit"); + throw "user error"; } else { var rpar = [[this.maxp],[this.minp]]; this.model.rpar = new ScilabDouble(rpar); diff --git a/js/Misc/DEBUG.js b/js/Misc/DEBUG.js index e24992a4..e16c4c3d 100644 --- a/js/Misc/DEBUG.js +++ b/js/Misc/DEBUG.js @@ -36,6 +36,7 @@ function DEBUG() { break; } else { message([["Error in the instructions"],[lasterror()]]); + throw "user error"; } } else { var ok = false; diff --git a/js/Misc/HYSTHERESIS.js b/js/Misc/HYSTHERESIS.js index 38a02f6d..e873a36d 100644 --- a/js/Misc/HYSTHERESIS.js +++ b/js/Misc/HYSTHERESIS.js @@ -46,6 +46,7 @@ function HYSTHERESIS() { } if (this.low_lim>this.high_lim) { message("switch on value must be larger than switch off value"); + throw "user error"; } else { this.graphics.exprs = new ScilabDouble([this.exprs]); this.model.rpar = new ScilabDouble(transpose([this.high_lim,this.low_lim,this.out_high,this.out_low])); diff --git a/js/Misc/LOGICAL_OP.js b/js/Misc/LOGICAL_OP.js index 5ea40721..ea535301 100644 --- a/js/Misc/LOGICAL_OP.js +++ b/js/Misc/LOGICAL_OP.js @@ -47,15 +47,19 @@ function LOGICAL_OP() { this.tp = int(this.tp); if (this.nin<1) { message("Number of inputs must be >=1 "); + throw "user error"; var ok = false; } else if ((this.rule<0)||(this.rule>5)) { message("Incorrect operator "+string(this.rule)+" ; must be 0 to 5."); + throw "user error"; var ok = false; } else if ((this.rule==5)&&(this.nin>1)) { message("Only one input allowed for NOT operation"); + throw "user error"; this.nin = 1; } else if (((this.Datatype==1)&&(this.tp!=0))) { message("Bitwise Rule is only activated when Data type is integer"); + throw "user error"; var ok = false; } if (ok) { @@ -80,6 +84,7 @@ function LOGICAL_OP() { this.model.sim = list(new ScilabString(["logicalop_ui8"]), new ScilabDouble([4])); } else { message("Datatype is not supported"); + throw "user error"; var ok = false; } this.model.ipar = new ScilabDouble([this.rule],[this.tp]); diff --git a/js/Misc/PENDULUM_ANIM.js b/js/Misc/PENDULUM_ANIM.js index 8ec0841a..b323351e 100644 --- a/js/Misc/PENDULUM_ANIM.js +++ b/js/Misc/PENDULUM_ANIM.js @@ -66,6 +66,7 @@ function PENDULUM_ANIM() { } if (!ok) { message(mess); + throw "user error"; } else { var rpar = [[this.plen],[this.csiz],[this.phi],[this.xmin],[this.xmax],[this.ymin],[this.ymax]]; this.model.rpar = new ScilabDouble(rpar); diff --git a/js/Misc/RATELIMITER.js b/js/Misc/RATELIMITER.js index 6a97b2a4..e3e40ef8 100644 --- a/js/Misc/RATELIMITER.js +++ b/js/Misc/RATELIMITER.js @@ -37,6 +37,7 @@ function RATELIMITER() { } if (this.maxp<=this.minp||this.maxp<=0||this.minp>=0) { message("We must have max_slope> 0 > min_slope."); + throw "user error"; } else { var rpar = [[this.maxp],[this.minp]]; this.model.rpar = new ScilabDouble(rpar); diff --git a/js/Misc/RELATIONALOP.js b/js/Misc/RELATIONALOP.js index 319ef943..8d83d58b 100644 --- a/js/Misc/RELATIONALOP.js +++ b/js/Misc/RELATIONALOP.js @@ -46,6 +46,7 @@ function RELATIONALOP() { } if ((this.rule<0)||(this.rule>5)) { message("Incorrect operator "+string(this.rule)+" ; must be 0 to 5."); + throw "user error"; var ok = false; } if ((this.Datatype==1)) { @@ -64,6 +65,7 @@ function RELATIONALOP() { this.model.sim = list(new ScilabString(["relational_op_ui8"]), new ScilabDouble([4])); } else { message("Datatype is not supported"); + throw "user error"; var ok = false; } if (ok) { diff --git a/js/Misc/TEXT_f.js b/js/Misc/TEXT_f.js index 506e95b3..2407ff93 100644 --- a/js/Misc/TEXT_f.js +++ b/js/Misc/TEXT_f.js @@ -42,10 +42,12 @@ function TEXT_f() { } if (this.font<=0||this.font>6) { message("Font number must be greater than 0 and less than 7"); + throw "user error"; var ok = false; } if (this.siz<0) { message("Font size must be positive"); + throw "user error"; var ok = false; } if (ok) { diff --git a/js/Misc/generic_block.js b/js/Misc/generic_block.js index bbda2bd2..cfe26859 100644 --- a/js/Misc/generic_block.js +++ b/js/Misc/generic_block.js @@ -79,11 +79,13 @@ function generic_block() { this.funtyp = int(this.funtyp); if (this.funtyp<0) { message("function type cannot be negative"); + throw "user error"; var ok = false; } if ([[this.ci],[this.co]]!=[]) { if (max([[this.ci],[this.co]])>1) { message("vector event links not supported"); + throw "user error"; var ok = false; } } diff --git a/js/Misc/generic_block2.js b/js/Misc/generic_block2.js index 963e475f..dd85d849 100644 --- a/js/Misc/generic_block2.js +++ b/js/Misc/generic_block2.js @@ -83,11 +83,13 @@ function generic_block2() { this.funtyp = int(this.funtyp); if (this.funtyp<0) { message("function type cannot be negative"); + throw "user error"; var ok = false; } if ([[this.ci],[this.co]]!=[]) { if (max([[this.ci],[this.co]])>1) { message("vector event links not supported"); + throw "user error"; var ok = false; } } diff --git a/js/Misc/generic_block3.js b/js/Misc/generic_block3.js index 7312b2ec..4c5814ec 100644 --- a/js/Misc/generic_block3.js +++ b/js/Misc/generic_block3.js @@ -85,20 +85,24 @@ function generic_block3() { this.funtyp = this.funtyp; if (this.funtyp<0) { message("function type cannot be negative"); + throw "user error"; var ok = false; } if ([[this.ci],[this.co]]!=[]) { if (max([[this.ci],[this.co]])>1) { message("vector event links not supported"); + throw "user error"; var ok = false; } } if (this.type[this.opar-1]!=15) { message("object parameter must be a list"); + throw "user error"; var ok = false; } if (this.type[this.oz-1]!=15) { message("discrete object state must be a list"); + throw "user error"; var ok = false; } this.depu = stripblanks(this.depu); diff --git a/js/NonLinear/DLRADAPT_f.js b/js/NonLinear/DLRADAPT_f.js index 34801a96..8b7d6542 100644 --- a/js/NonLinear/DLRADAPT_f.js +++ b/js/NonLinear/DLRADAPT_f.js @@ -56,8 +56,10 @@ function DLRADAPT_f() { var n = tmpvar0[1]; if (m>=n) { message("Transfer must be strictly proper"); + throw "user error"; } else if (size(this.rn,1)!=0&&size(this.rn,1)!=size(this.p,"*")) { message("Numerator roots matrix row size\'s is incorrect"); + throw "user error"; } else { var rpar = [[this.p.slice()],[real(this.rn.slice())],[imag(this.rn.slice())],[real(this.rd.slice())],[imag(this.rd.slice())],[this.g.slice()]]; var ipar = [[m],[n],[npt]]; diff --git a/js/NonLinear/EXPBLK_f.js b/js/NonLinear/EXPBLK_f.js index 1291451c..2b4cc440 100644 --- a/js/NonLinear/EXPBLK_f.js +++ b/js/NonLinear/EXPBLK_f.js @@ -34,6 +34,7 @@ function EXPBLK_f() { } if (or(this.a<=0)) { message("a^u : a must be positive"); + throw "user error"; } else { this.graphics.exprs = new ScilabDouble([this.exprs]); this.model.rpar = new ScilabDouble([this.a]); diff --git a/js/NonLinear/EXPBLK_m.js b/js/NonLinear/EXPBLK_m.js index 9db00e2c..3aa7f33e 100644 --- a/js/NonLinear/EXPBLK_m.js +++ b/js/NonLinear/EXPBLK_m.js @@ -38,6 +38,7 @@ function EXPBLK_m() { } if (or(this.a<=0)) { message("a^u : a must be positive"); + throw "user error"; } else { this.graphics.exprs = new ScilabDouble([this.exprs]); this.model.rpar = new ScilabDouble([this.a]); diff --git a/js/NonLinear/INTRP2BLK_f.js b/js/NonLinear/INTRP2BLK_f.js index 54bcb917..c192893c 100644 --- a/js/NonLinear/INTRP2BLK_f.js +++ b/js/NonLinear/INTRP2BLK_f.js @@ -40,8 +40,10 @@ function INTRP2BLK_f() { } if (size(this.a,"*")!=size(this.c,"c")||size(this.b,"*")!=size(this.c,"r")) { message("incompatible dimension"); + throw "user error"; } else if (min(this.a.slice(2-1,$)-this.a.slice(1-1,$-1))<=0||min(this.b.slice(2-1,$)-this.b.slice(1-1,$-1))<=0) { message("X and Y must be strictly increasing"); + throw "user error"; } else { if (ok) { this.graphics.exprs = new ScilabDouble([this.exprs]); diff --git a/js/NonLinear/INTRPLBLK_f.js b/js/NonLinear/INTRPLBLK_f.js index a1b9cb1d..287f2933 100644 --- a/js/NonLinear/INTRPLBLK_f.js +++ b/js/NonLinear/INTRPLBLK_f.js @@ -36,8 +36,10 @@ function INTRPLBLK_f() { } if (size(this.a,"*")!=size(this.b,"*")) { message("X and Y must have the same size"); + throw "user error"; } else if (min(this.a.slice(2-1,$)-this.a.slice(1-1,$-1))<=0) { message("X must be strictly increasing"); + throw "user error"; } else { if (ok) { this.graphics.exprs = new ScilabDouble([this.exprs]); diff --git a/js/NonLinear/LOGBLK_f.js b/js/NonLinear/LOGBLK_f.js index 28dfa9e8..59ee4067 100644 --- a/js/NonLinear/LOGBLK_f.js +++ b/js/NonLinear/LOGBLK_f.js @@ -34,6 +34,7 @@ function LOGBLK_f() { } if (this.a<=1) { message("Basis must be larger than 1"); + throw "user error"; } else { if (ok) { this.graphics.exprs = new ScilabDouble([this.exprs]); diff --git a/js/NonLinear/LOOKUP_f.js b/js/NonLinear/LOOKUP_f.js index 9a22b665..635a1fce 100644 --- a/js/NonLinear/LOOKUP_f.js +++ b/js/NonLinear/LOOKUP_f.js @@ -41,6 +41,7 @@ function LOOKUP_f() { var n = size(xx,"*"); if (or(xx.slice(2-1,n)-xx.slice(1-1,n-1)<=0)) { message("You have not defined a function"); + throw "user error"; var ok = false; } if (ok) { diff --git a/js/NonLinear/MAXMIN.js b/js/NonLinear/MAXMIN.js index 04c7abab..7de281da 100644 --- a/js/NonLinear/MAXMIN.js +++ b/js/NonLinear/MAXMIN.js @@ -43,6 +43,7 @@ function MAXMIN() { } if (this.nin!=1&&this.nin!=2) { message("Wrong number of inputs, only 1 and 2 allowed"); + throw "user error"; var ok = false; } if (ok) { diff --git a/js/NonLinear/PRODUCT.js b/js/NonLinear/PRODUCT.js index 77f9b79e..a4db3880 100644 --- a/js/NonLinear/PRODUCT.js +++ b/js/NonLinear/PRODUCT.js @@ -32,6 +32,7 @@ function PRODUCT() { if (size(this.sgn,1)==1) { if (this.sgn<1) { message("Number of inputs must be > 0"); + throw "user error"; var ok = false; } else if (this.sgn==1) { var in1 = -1; @@ -45,6 +46,7 @@ function PRODUCT() { } else { if (!and(abs(this.sgn)==1)) { message("Signs can only be +1 or -1"); + throw "user error"; var ok = false; } else { var in1 = -ones(size(this.sgn,1),1); diff --git a/js/NonLinear/QUANT_f.js b/js/NonLinear/QUANT_f.js index 80d91d0a..e619bf1c 100644 --- a/js/NonLinear/QUANT_f.js +++ b/js/NonLinear/QUANT_f.js @@ -37,6 +37,7 @@ function QUANT_f() { } if (this.meth<1||this.meth>4) { message("Quantization Type must be from 1 to 4"); + throw "user error"; } else { var rpar = this.pas; this.model.rpar = new ScilabDouble([rpar]); diff --git a/js/NonLinear/SATURATION.js b/js/NonLinear/SATURATION.js index 4f01ed4d..172e3235 100644 --- a/js/NonLinear/SATURATION.js +++ b/js/NonLinear/SATURATION.js @@ -41,6 +41,7 @@ function SATURATION() { } if (this.maxp<=this.minp) { message("Upper limit must be > Lower limit"); + throw "user error"; } else { var rpar = [[this.maxp],[this.minp]]; this.model.rpar = new ScilabDouble(rpar); diff --git a/js/NonLinear/SAT_f.js b/js/NonLinear/SAT_f.js index 6de131a1..40e3cf08 100644 --- a/js/NonLinear/SAT_f.js +++ b/js/NonLinear/SAT_f.js @@ -41,8 +41,10 @@ function SAT_f() { } if (this.maxp<=0) { message("Max must be strictly positive"); + throw "user error"; } else if (this.pente<=0) { message("Slope must be strictly positive"); + throw "user error"; } else { var rpar = [[this.minp/this.pente],[this.maxp/this.pente],[this.pente]]; this.model.rpar = new ScilabDouble(rpar); diff --git a/js/NonLinear/TrigFun.js b/js/NonLinear/TrigFun.js index ce183d81..97b73bf3 100644 --- a/js/NonLinear/TrigFun.js +++ b/js/NonLinear/TrigFun.js @@ -30,6 +30,7 @@ function TrigFun() { } if (find(PREVAR_FF==this.fun)==[]) { message("Sorry but "+this.fun+" is not in the list!"); + throw "user error"; } else { this.graphics.exprs = new ScilabDouble([this.exprs]); execstr("model.sim=list(\'"+this.fun+"_blk\',4)"); diff --git a/js/Sinks/AFFICH_m.js b/js/Sinks/AFFICH_m.js index 5a202dce..a71d6f4b 100644 --- a/js/Sinks/AFFICH_m.js +++ b/js/Sinks/AFFICH_m.js @@ -71,6 +71,7 @@ function AFFICH_m() { } if (!ok) { message([["Some specified values are inconsistent:"],[" "],[mess]]); + throw "user error"; } if (!or(this.herit==[0,1])) { var mess = [[mess],["Accept inherited values are 0 and 1"],[" "]]; @@ -78,6 +79,7 @@ function AFFICH_m() { } if (!ok) { message([["Some specified values are inconsistent:"],[" "],[mess]]); + throw "user error"; } if (ok) { var tmpvar0 = set_io(this.model,this.graphics,list(this.in1,1),list(),ones(1-this.herit,1),[]); diff --git a/js/Sinks/BARXY.js b/js/Sinks/BARXY.js index 5b38001c..286427e9 100644 --- a/js/Sinks/BARXY.js +++ b/js/Sinks/BARXY.js @@ -61,6 +61,7 @@ function BARXY() { } if (!ok) { message(mess); + throw "user error"; } else { this.model.rpar = new ScilabDouble([this.xmin],[this.xmax],[this.ymin],[this.ymax]); this.model.ipar = new ScilabDouble([this.thickness]); diff --git a/js/Sinks/CANIMXY.js b/js/Sinks/CANIMXY.js index a1b3725c..751536ff 100644 --- a/js/Sinks/CANIMXY.js +++ b/js/Sinks/CANIMXY.js @@ -100,6 +100,7 @@ function CANIMXY() { } if (!ok) { message(mess); + throw "user error"; } else { var in1 = this.nbr_curves*ones(2,1); var in2 = ones(2,1); diff --git a/js/Sinks/CANIMXY3D.js b/js/Sinks/CANIMXY3D.js index 5fece779..28eaf761 100644 --- a/js/Sinks/CANIMXY3D.js +++ b/js/Sinks/CANIMXY3D.js @@ -116,6 +116,7 @@ function CANIMXY3D() { } if (!ok) { message(mess); + throw "user error"; } else { var in1 = this.nbr_curves*ones(3,1); var in2 = ones(3,1); diff --git a/js/Sinks/CEVENTSCOPE.js b/js/Sinks/CEVENTSCOPE.js index 754e01c7..44261885 100644 --- a/js/Sinks/CEVENTSCOPE.js +++ b/js/Sinks/CEVENTSCOPE.js @@ -81,6 +81,7 @@ function CEVENTSCOPE() { var ok = tmpvar0[2]; } else { message([["Some specified values are inconsistent:"],[" "],[mess]]); + throw "user error"; } if (ok) { if (this.wpos==[]) { diff --git a/js/Sinks/CFSCOPE.js b/js/Sinks/CFSCOPE.js index 1fefd8a9..57294d55 100644 --- a/js/Sinks/CFSCOPE.js +++ b/js/Sinks/CFSCOPE.js @@ -85,6 +85,7 @@ function CFSCOPE() { } if (!ok) { message([["Some specified values are inconsistent:"],[" "],[mess]]); + throw "user error"; } if (ok) { if (this.wpos==[]) { diff --git a/js/Sinks/CLKOUT_f.js b/js/Sinks/CLKOUT_f.js index b34740b1..96212275 100644 --- a/js/Sinks/CLKOUT_f.js +++ b/js/Sinks/CLKOUT_f.js @@ -31,6 +31,7 @@ function CLKOUT_f() { this.prt = int(this.prt); if (this.prt<=0) { message("Port number must be a positive integer"); + throw "user error"; } else { this.model.ipar = new ScilabDouble([this.prt]); this.model.evtin = new ScilabDouble([1]); diff --git a/js/Sinks/CMAT3D.js b/js/Sinks/CMAT3D.js index 03a680fa..5656b99c 100644 --- a/js/Sinks/CMAT3D.js +++ b/js/Sinks/CMAT3D.js @@ -60,6 +60,7 @@ function CMAT3D() { } if (!ok) { message([["Some specified values are inconsistent:"],[" "],[mess]]); + throw "user error"; } if (ok) { var size_x = size(this.vec_x,"*"); diff --git a/js/Sinks/CMATVIEW.js b/js/Sinks/CMATVIEW.js index 0b59f5e7..d6abdde1 100644 --- a/js/Sinks/CMATVIEW.js +++ b/js/Sinks/CMATVIEW.js @@ -50,6 +50,7 @@ function CMATVIEW() { } if (!ok) { message([["Some specified values are inconsistent:"],[" "],[mess]]); + throw "user error"; } if (ok) { var size_c = size(this.colormap.slice(),1); diff --git a/js/Sinks/CMSCOPE.js b/js/Sinks/CMSCOPE.js index b5028549..97e72111 100644 --- a/js/Sinks/CMSCOPE.js +++ b/js/Sinks/CMSCOPE.js @@ -113,6 +113,7 @@ function CMSCOPE() { } if (!ok) { message([["Some specified values are inconsistent:"],[" "],[mess]]); + throw "user error"; } if (ok) { this.in1 = this.in1.slice(); diff --git a/js/Sinks/CSCOPE.js b/js/Sinks/CSCOPE.js index bcd9682f..2ffc3747 100644 --- a/js/Sinks/CSCOPE.js +++ b/js/Sinks/CSCOPE.js @@ -89,6 +89,7 @@ function CSCOPE() { } if (!ok) { message([["Some specified values are inconsistent:"],[" "],[mess]]); + throw "user error"; } if (ok) { var tmpvar0 = set_io(this.model,this.graphics,list([-1,1],1),list(),ones(1-this.heritance,1),[]); diff --git a/js/Sinks/CSCOPXY.js b/js/Sinks/CSCOPXY.js index bf831be0..ae81af95 100644 --- a/js/Sinks/CSCOPXY.js +++ b/js/Sinks/CSCOPXY.js @@ -99,6 +99,7 @@ function CSCOPXY() { } if (!ok) { message(mess); + throw "user error"; } else { var in1 = this.nbr_curves*ones(2,1); var in2 = ones(2,1); diff --git a/js/Sinks/CSCOPXY3D.js b/js/Sinks/CSCOPXY3D.js index 8bc5bbe2..a988d1aa 100644 --- a/js/Sinks/CSCOPXY3D.js +++ b/js/Sinks/CSCOPXY3D.js @@ -133,6 +133,7 @@ function CSCOPXY3D() { break; } else { message(mess); + throw "user error"; } } return new BasicBlock(this.x); diff --git a/js/Sinks/TOWS_c.js b/js/Sinks/TOWS_c.js index 614228ad..0f285c96 100644 --- a/js/Sinks/TOWS_c.js +++ b/js/Sinks/TOWS_c.js @@ -46,12 +46,14 @@ function TOWS_c() { } if ((this.nz<=0)) { message("Size of buffer must be positive"); + throw "user error"; var ok = false; } var r = false; var ierr = execstr("r = validvar(varnam)","errcatch"); if (!r||ierr!=0||length(this.varnam)>19) { message([["Invalid variable name."],["Please choose another variable name."]]); + throw "user error"; var ok = false; } execstr("if type("+this.varnam+") <> 17 | or(fieldnames("+this.varnam+") <> [\"values\"; \"time\"]) then"+" message([\"Protected variable name.\"; \"Please choose another variable name.\"]);"+" ok = %f;"+" end","errcatch"); diff --git a/js/Sources/CLKIN_f.js b/js/Sources/CLKIN_f.js index 9705db36..cb550389 100644 --- a/js/Sources/CLKIN_f.js +++ b/js/Sources/CLKIN_f.js @@ -31,6 +31,7 @@ function CLKIN_f() { } if (this.prt<=0) { message("Port number must be a positive integer"); + throw "user error"; } else { this.model.ipar = new ScilabDouble([this.prt]); this.model.evtout = new ScilabDouble([1]); diff --git a/js/Sources/CLOCK_f.js b/js/Sources/CLOCK_f.js index 3ebc7d0c..df9054ba 100644 --- a/js/Sources/CLOCK_f.js +++ b/js/Sources/CLOCK_f.js @@ -74,6 +74,7 @@ function CLOCK_f() { } if (this.dt<=0) { message("period must be positive"); + throw "user error"; var ok = false; } if (ok) { diff --git a/js/Sources/CONST.js b/js/Sources/CONST.js index 9676863b..a3a51cb3 100644 --- a/js/Sources/CONST.js +++ b/js/Sources/CONST.js @@ -32,8 +32,10 @@ function CONST() { var nout = size(this.C,"*"); if (nout==0) { message("C must have at least one element"); + throw "user error"; } else if (and(sz>1)) { message("C matrix is not supported, use CONST_m instead"); + throw "user error"; } else { this.model.rpar = new ScilabDouble(this.C.slice()); this.model.out = new ScilabDouble([nout]); diff --git a/js/Sources/CONST_f.js b/js/Sources/CONST_f.js index ece232ed..fcd527ac 100644 --- a/js/Sources/CONST_f.js +++ b/js/Sources/CONST_f.js @@ -31,6 +31,7 @@ function CONST_f() { var nout = size(this.C,"*"); if (nout==0) { message("C must have at least one element"); + throw "user error"; } else { this.model.rpar = new ScilabDouble(this.C.slice()); this.model.out = new ScilabDouble([nout]); diff --git a/js/Sources/CURV_f.js b/js/Sources/CURV_f.js index d8eb53ba..8939719f 100644 --- a/js/Sources/CURV_f.js +++ b/js/Sources/CURV_f.js @@ -49,6 +49,7 @@ function CURV_f() { var n = size(xx,"*"); if (or(xx.slice(2-1,n)-xx.slice(1-1,n-1)<0)) { message("You have not defined a function"); + throw "user error"; var ok = false; } if (ok) { diff --git a/js/Sources/FROMWS_c.js b/js/Sources/FROMWS_c.js index 1b3b8b09..5e1810ea 100644 --- a/js/Sources/FROMWS_c.js +++ b/js/Sources/FROMWS_c.js @@ -46,20 +46,24 @@ function FROMWS_c() { } if (!(this.Method==0||this.Method==1||this.Method==2||this.Method==3)) { message("Interpolation method should be chosen in [0,1,2,3]"); + throw "user error"; var ok = false; } if (!(this.ZC==0||this.ZC==1)) { message("Zero crossing should be either 0 or 1"); + throw "user error"; var ok = false; } if (!(this.OutEnd==0||this.OutEnd==1||this.OutEnd==2)) { message("Output at end option should be either 0 or 1"); + throw "user error"; var ok = false; } var r = false; var ierr = execstr("r=validvar(varnam)","errcatch"); if (!r) { message([["Invalid variable name."],["Please choose another variable name."]]); + throw "user error"; var ok = false; } if (ok) { diff --git a/js/Sources/GEN_SQR.js b/js/Sources/GEN_SQR.js index 47674794..3b9df67b 100644 --- a/js/Sources/GEN_SQR.js +++ b/js/Sources/GEN_SQR.js @@ -94,6 +94,7 @@ function GEN_SQR() { } } else { message(lasterror()); + throw "user error"; var ok = false; } } diff --git a/js/Sources/IN_f.js b/js/Sources/IN_f.js index 67fa7614..eddd05b6 100644 --- a/js/Sources/IN_f.js +++ b/js/Sources/IN_f.js @@ -42,10 +42,13 @@ function IN_f() { var prt = int(prt); if (prt<=0) { message("Port number must be a positive integer"); + throw "user error"; } else if (!isequal(size(otsz,"*"),2)) { message("Outport Size must be a 2 elements vector"); + throw "user error"; } else if (((ot<1||ot>9)&&(ot!=-1))) { message("Outport type must be a number between 1 and 9, or -1 for inheritance."); + throw "user error"; } else { if (this.model.ipar!=prt) { var needcompile = 4; diff --git a/js/Sources/RAND_f.js b/js/Sources/RAND_f.js index bdbfd09f..e67bbd98 100644 --- a/js/Sources/RAND_f.js +++ b/js/Sources/RAND_f.js @@ -51,6 +51,7 @@ function RAND_f() { } if (this.flag!=0&&this.flag!=1) { message("flag must be equal to 1 or 0"); + throw "user error"; } else { var nout = size(this.a,"*"); this.graphics.exprs = new ScilabDouble(this.exprs); diff --git a/js/Sources/RAND_m.js b/js/Sources/RAND_m.js index 50ec146c..0ac19999 100644 --- a/js/Sources/RAND_m.js +++ b/js/Sources/RAND_m.js @@ -59,6 +59,7 @@ function RAND_m() { } if (this.flag!=0&&this.flag!=1) { message("flag must be equal to 1 or 0"); + throw "user error"; } else { var out = size(this.a); if (this.typ==1) { @@ -73,6 +74,7 @@ function RAND_m() { this.model.dstate = new ScilabDouble([this.seed_c.slice()],[0*[[real(this.a.slice())],[imag(this.a.slice())]]]); } else { message("Datatype is not supported"); + throw "user error"; var ok = false; } if (ok) { diff --git a/js/Sources/SampleCLK.js b/js/Sources/SampleCLK.js index fe37b67a..b652d744 100644 --- a/js/Sources/SampleCLK.js +++ b/js/Sources/SampleCLK.js @@ -33,10 +33,12 @@ function SampleCLK() { } if (this.frequ<0) { message("Frequency must be a positif number"); + throw "user error"; var ok = false; } if (abs(this.offset)>this.frequ) { message("The |Offset| must be less than the Frequency"); + throw "user error"; var ok = false; } if (ok) { diff --git a/js/Threshold/ZCROSS_f.js b/js/Threshold/ZCROSS_f.js index 88668446..f822d0c1 100644 --- a/js/Threshold/ZCROSS_f.js +++ b/js/Threshold/ZCROSS_f.js @@ -34,6 +34,7 @@ function ZCROSS_f() { this.in1 = int(this.in1); if (this.in1<=0) { message("Block must have at least one input"); + throw "user error"; } else { var kk = 0; for (jj=1;jj<=this.in1;jj+=1) { |