MotionBASIC
TM
Error Handler
Modifying Your Program
5.2 Resolving Conflicts
Appendices A1 and A2 provide a list of variables and program labels used by
ERRMENU.BAS. Review these lists and compare them with your program.
Resolve any conflicts by renaming the variable or changing the label in your
program.
NOTE......
We recommend changing the variable name or label in your program rather
than in the MBTools Module. The assumption is that you understand the
implication of making changes to your program in more detail than in the
MBTools Module. By only changing your program you will be less likely to
introduce problems than if you were to change the MBTools Module.
If you have not written your program, you simply need to keep the variables
and program labels used by MBTools in mind as you write it.
NOTE......
To make it easy to avoid program label conflicts, all labels used in MBTools
Modules begin with a prefix that identifies the module to which they belong.
For example, all labels used in ERRMENU.BAS begin with ERR.
5.3 Initializing The Module
Each Module has a number of subroutines that must be executed before the
module is first invoked. For ERRMENU.BAS, these subroutines set up the
screen color variables, set up logical names for testing keys pressed by the
operator, initialize the module and arm the error handler.
Your program should include the following statements as part of its power up
initialization:
GOSUB MISC.COLORS
GOSUB MISC.KEYS
GOSUB ERR.INIT
ON ERROR GOTO ERR.HDLR
If you are using other modules in addition to ERRMENU.BAS, they also will
have initialization subroutines that must be executed. It is a good idea to keep
all of these GOSUBs together in your program. Figure 5 provides additional
recommendations for the power up initialization sequence.
NOTE......
If more than one of the modules you are using requires that you execute a
particular initialization subroutine, MISC.COLORS for example, you only have to
execute it once. You do not need to execute it again for each module that
needs it.
The "ON ERROR GOTO ERR.HDLR" statement arms the error handler. Any
faults or errors that occur after this statement will cause the program to jump to
the ERR.HLDR program label. This statement should be placed after the other
initialization statements.
You can disarm the error handler by executing another "ON ERROR GOTO"
statement. For example:
page 14
GN3-ERRb
Summary of Contents for MotionBASIC
Page 3: ...ii...
Page 5: ...MotionBASICTM Error Handler Table of Contents A3 Complete Program Listings 31 iv...
Page 6: ...v...
Page 8: ...vii...
Page 10: ...MotionBASICTM Error Handler Welcome THIS PAGE INTENTIONALLY LEFT BLANK page 2 GN3 ERRb...
Page 37: ...MotionBASICTM Error Handler Appendix A1 GN3 ERRb page 29...
Page 38: ...MotionBASICTM Error Handler Appendix A1 THIS PAGE INTENTIONALLY LEFT BLANK page 30 GN3 ERRb...
Page 40: ...MotionBASICTM Error Handler Appendix A2 THIS PAGE INTENTIONALLY LEFT BLANK page 32 GN3 ERRb...