From 4d1e8bb193a7315a8fcfe1e09c33befdee660b7d Mon Sep 17 00:00:00 2001
From: Sunil Shetye
Date: Wed, 18 Jul 2018 15:33:44 +0530
Subject: add throw after message()

---
 js/Linear/CLR.js            | 1 +
 js/Linear/CLR_f.js          | 1 +
 js/Linear/CLSS.js           | 1 +
 js/Linear/CLSS_f.js         | 1 +
 js/Linear/DELAYV_f.js       | 2 ++
 js/Linear/DELAY_f.js        | 1 +
 js/Linear/DIFF_c.js         | 1 +
 js/Linear/DLR.js            | 1 +
 js/Linear/DLR_f.js          | 1 +
 js/Linear/DLSS.js           | 1 +
 js/Linear/DLSS_f.js         | 1 +
 js/Linear/DOLLAR.js         | 1 +
 js/Linear/DOLLAR_m.js       | 1 +
 js/Linear/GAINBLK.js        | 6 ++++++
 js/Linear/GAINBLK_f.js      | 1 +
 js/Linear/GAIN_f.js         | 1 +
 js/Linear/INTEGRAL.js       | 3 +++
 js/Linear/INTEGRAL_m.js     | 7 +++++++
 js/Linear/REGISTER.js       | 2 ++
 js/Linear/REGISTER_f.js     | 1 +
 js/Linear/SAMPHOLD_m.js     | 1 +
 js/Linear/SOM_f.js          | 1 +
 js/Linear/SUMMATION.js      | 4 ++++
 js/Linear/TCLSS.js          | 1 +
 js/Linear/TCLSS_f.js        | 1 +
 js/Linear/TIME_DELAY.js     | 2 ++
 js/Linear/VARIABLE_DELAY.js | 2 ++
 27 files changed, 47 insertions(+)

(limited to 'js/Linear')

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) {
-- 
cgit