From e1fafaa14632ab96e2e0dc7b0fbbfa7f813855d7 Mon Sep 17 00:00:00 2001 From: anhe-odoo Date: Mon, 7 Feb 2022 08:37:54 +0100 Subject: [PATCH] [MSC] Add of error_codes as macro --- 0~MENU__.cbs | 59 ++++++++++++++++++++++++++++++++-------------- error_codes.def | 62 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 103 insertions(+), 18 deletions(-) create mode 100644 error_codes.def diff --git a/0~MENU__.cbs b/0~MENU__.cbs index 7628386..51dc36e 100644 --- a/0~MENU__.cbs +++ b/0~MENU__.cbs @@ -3,6 +3,9 @@ #define CONVERT 0 #define CHEMISTRY 0 #define CIRCUIT 0 + +#include "error_codes.def" + Local i,g AxesOff GridOff @@ -12,7 +15,7 @@ Lbl 1 Cls PlotOn 1,64: F-Line 1,61,3,63: -For 1->i To 28 Step 3 +For 1→i To 28 Step 3 F-Line i,58,5+i,63: F-Line i+94,58,99+i,63: Next @@ -21,7 +24,7 @@ PlotOn 34,58: F-Line 95,61,97,63: F-Line 122,58,127,63: F-Line 125,58,127,60: -For 2->i To 92 Step 30 +For 2→i To 92 Step 30 F-Line i,39,i+28,39: F-Line i+28,40,i+28,56: If i<3 @@ -38,7 +41,7 @@ Next F-Line 2,40,2,49: F-Line 4,40,4,49: F-Line 6,40,6,49: - For 8->i To 14 Step 2 + For 8→i To 14 Step 2 F-Line i,40,i,43: PlotOn i-1,41: PlotOn i-1,43: @@ -49,12 +52,12 @@ Next F-Line 18,40,18,47: F-Line 20,40,20,49: F-Line 22,40,22,49: - For 41->i To 49 Step 2 + For 41→i To 49 Step 2 PlotOn 3,i: PlotOn 5,i: PlotOn 21,i: Next - For 41->i To 47 Step 2 + For 41→i To 47 Step 2 PlotOn 5,i: PlotOn 17,i: PlotOn 19,i: @@ -332,32 +335,52 @@ Next LocateYX 0,38,"MAIN MENU" Lbl 2 -Prog "_WAITKEY"->g +Prog "_WAITKEY"→g Switch g: # if defined(PERIODIC) && (PERIODIC == 1) Case 72: - Prog "PER~MAIN" + Try : + Prog "PER~MAIN" + Except _GO_ERROR_: + PopUpWin(11,"ERREUR!","Programme introuvable") + TryEnd Goto 1 # endif # if defined(CONSTANT) && (CONSTANT == 1) Case 62: - Prog "CST~MAIN" + Try : + Prog "CST~MAIN" + Except _GO_ERROR_: + PopUpWin(11,"ERREUR!","Programme introuvable") + TryEnd Goto 1 # endif # if defined(CONVERT) && (CONVERT == 1) - Case 52: - Prog "CNV~MAIN" - Goto 1 -# endif + Case 52: + Try : + Prog "CNV~MAIN" + Except _GO_ERROR_: + PopUpWin(11,"ERREUR!","Programme introuvable") + TryEnd + Goto 1 +# endif # if defined(CHEMISTRY) && (CHEMISTRY == 1) - Case 73: - Prog "CHM~MAIN" - Goto 1 + Case 73: + Try : + Prog "CHM~MAIN" + Except _GO_ERROR_: + PopUpWin(11,"ERREUR!","Programme introuvable") + TryEnd + Goto 1 # endif # if defined(CIRCUIT) && (CIRCUIT == 1) - Case 63: - Prog "ELC~MAIN" - Goto 1 + Case 63: + Try : + Prog "ELC~MAIN" + Except _GO_ERROR_: + PopUpWin(11,"ERREUR!","Programme introuvable") + TryEnd + Goto 1 # endif Case 48: Return diff --git a/error_codes.def b/error_codes.def new file mode 100644 index 0000000..7818b48 --- /dev/null +++ b/error_codes.def @@ -0,0 +1,62 @@ +// DEFINITION OF ERROR CODES AS MACRO +// General Errors ================================================================= +#define _SYNTAX_ERROR_ 1 +#define _MA_ERROR_ 2 +#define _GO_ERROR_ 3 +#define _NESTING_ERROR_ 4 +#define _STACK_ERROR_ 5 +#define _MEMORY_ERROR_ 6 +#define _ARG_ERROR_ 7 +#define _DIM_ERROR_ 8 +#define _RANGE_ERROR_ 9 + +// Miscellaneous Errors =========================================================== +#define _NONREAL_ERROR_ 11 + +// Communication Errors =========================================================== +#define _COM_ERROR_ 20 +#define _TRANSMIST_ERROR_ 21 +#define _RECEIVE_ERROR_ 22 + +// Other Errors ================================================================== +/* +28: Too Much Data + +33: For without Next +34: Next without For +35: While w/o W.End +36: W.End w/o While +37: Do w/o LpWhile +38: LpWhile w/o Do +39: Not Loop ERROR +40: Division By Zero +41: Undefined Label +42: Not enough Memory +43: String Too Long +44: No Matrix array +45: Illegal Ary size +46: No Prog found +47: Too many SubProg +48: If without IfEnd +49: Then without If +50: Case w/o Switch +51: Default w/o Swtch +52: Switch w/o S.End +53: S.End w/o Switch +54: Can't find file +55: Illegal Element +56: Already Opened +57: Com Not Opened +58: Type Mismatched +59: Out of Domain +60: Undefined Var. +61: Undefined Func. +62: Not Supported +63: Exceed Var. limit +64: Duplicated Def. +65: Address Align ERR +66: Not met Accuracy +70: Try w/o Except +71: Except w/o Try +72: TryEnd w/o Try +*/