summaryrefslogtreecommitdiff
path: root/js/Misc
diff options
context:
space:
mode:
authorSunil Shetye2018-07-18 15:33:44 +0530
committerSunil Shetye2018-07-18 17:07:40 +0530
commit4d1e8bb193a7315a8fcfe1e09c33befdee660b7d (patch)
tree360c93b86402e468a69d22fe3187d0809b095587 /js/Misc
parentbfa780421678e897b17680f3e7c5db72d8ea8375 (diff)
downloadsci2js-4d1e8bb193a7315a8fcfe1e09c33befdee660b7d.tar.gz
sci2js-4d1e8bb193a7315a8fcfe1e09c33befdee660b7d.tar.bz2
sci2js-4d1e8bb193a7315a8fcfe1e09c33befdee660b7d.zip
add throw after message()
Diffstat (limited to 'js/Misc')
-rw-r--r--js/Misc/BOUNCE.js2
-rw-r--r--js/Misc/BOUNCEXY.js1
-rw-r--r--js/Misc/BPLATFORM.js1
-rw-r--r--js/Misc/CBLOCK.js1
-rw-r--r--js/Misc/CBLOCK4.js1
-rw-r--r--js/Misc/CONSTRAINT2_c.js1
-rw-r--r--js/Misc/CONSTRAINT_c.js1
-rw-r--r--js/Misc/DEADBAND.js1
-rw-r--r--js/Misc/DEBUG.js1
-rw-r--r--js/Misc/HYSTHERESIS.js1
-rw-r--r--js/Misc/LOGICAL_OP.js5
-rw-r--r--js/Misc/PENDULUM_ANIM.js1
-rw-r--r--js/Misc/RATELIMITER.js1
-rw-r--r--js/Misc/RELATIONALOP.js2
-rw-r--r--js/Misc/TEXT_f.js2
-rw-r--r--js/Misc/generic_block.js2
-rw-r--r--js/Misc/generic_block2.js2
-rw-r--r--js/Misc/generic_block3.js4
18 files changed, 30 insertions, 0 deletions
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);