polish: goto to handle error msg

This commit is contained in:
kuoi 2023-10-10 16:24:48 +08:00
parent 76c422d958
commit 957a4a9400

View file

@ -52,6 +52,8 @@ set doew 0; set doiw 0; set doeiw 0; set dowt 0; set wttype 0;
set kvalue 12; set kvalue 12;
set search 0; set search 0;
goto=%0;
/*handle weighting type*/ /*handle weighting type*/
if (argnumber>=3) if (argnumber>=3)
set wtstring $%3; set wtstring $%3;
@ -67,7 +69,7 @@ if (argnumber>=3)
set doeiw 1; set doeiw 1;
set wttype 3; set wttype 3;
else else
errmsg Weighting type must be ew, iw or eiw; goto wttypeerr;
end end end end end end
else else
set doeiw 1; set doeiw 1;
@ -82,7 +84,7 @@ end
if (argnumber>=4) if (argnumber>=4)
set kvalue %4; set kvalue %4;
if ( 'doew' && ('kvalue' != 0)) if ( 'doew' && ('kvalue' != 0))
errmsg Equal weighting (ew) must be followed with 0 instead of 'kvalue'; goto kvalueerr;
end end
end end
@ -116,7 +118,7 @@ else
end end
if ('rsmp' != 0) if ('rsmp' != 0)
errmsg Input %6 is illegal; errmsg Input 'rsmp' is illegal;
end end
if ('dobrs' || 'dorbrs') if ('dobrs' || 'dorbrs')
@ -131,12 +133,12 @@ if (argnumber>=6)
if (eqstring [ $contype str ]) if (eqstring [ $contype str ])
else else
if (eqstring [ $contype mjr ]) if (eqstring [ $contype mjr ])
errmsg Bremer support or any bremer support variations must use strict consensus; goto bremererr;
else else
if (eqstring [ $contype hlf ]) if (eqstring [ $contype hlf ])
errmsg Bremer support or any bremer support variations must use strict consensus; goto bremererr;
else else
errmsg Consensus type must be str mjr or hlf; goto contypeerr;
end end end end end end
else else
if (eqstring [ $contype str ]) if (eqstring [ $contype str ])
@ -148,19 +150,19 @@ if (argnumber>=6)
if (eqstring [ $contype hlf ]) if (eqstring [ $contype hlf ])
set dohlf 1; set dohlf 1;
else else
errmsg Consensus type must be str mjr or hlf; goto contypeerr;
end end end end end end
end end
else else
if (argnumber==5) if (argnumber==5)
set contype $%5; set contype $%5;
if ((eqstring [ $contype mjr ]) || (eqstring [ $contype hlf ])) if ((eqstring [ $contype mjr ]) || (eqstring [ $contype hlf ]))
errmsg Bremer support or any bremer support variations must use strict consensus; goto bremererr;
else else
if (eqstring [ $contype str ]) if (eqstring [ $contype str ])
set dostr 1; set dostr 1;
else else
errmsg Consensus type must be str mjr or hlf; goto contypeerr;
end end end end
else else
set dostr 1; set dostr 1;
@ -570,3 +572,23 @@ quote
/*Quit*/ /*Quit*/
zzz; zzz;
/*consensus type error*/
label contypeerr
errmsg Consensus type must be str mjr or hlf;
proc/;
/*weighting type error*/
label wttypeerr
errmsg Weighting type must be ew, iw or eiw;
proc/;
/*equal weighting k value error*/
label kvalueerr
errmsg Equal weighting (ew) must be followed with 0 instead of 'kvalue';
proc/;
/*bremer support not strict consensus error*/
label bremererr
errmsg Bremer support or any bremer support variations must use strict consensus;
proc/;