#include <stdlib.h>
#include <stdio.h>
#include "../command.h"
Go to the source code of this file.
Functions | |
SETPROGRAMCOUNTER (PARAMETERNODE) | |
if (!pEo->ErrorResume) ERROR(COMMAND_ERROR_NO_RESUME) | |
SETPROGRAMCOUNTER (pEo->ErrorResume) | |
SETPROGRAMCOUNTER (CDR(pEo->ErrorResume)) | |
if (RESULT) | |
if (CAR(PARAMETERLIST)) | |
if (vErrCode==NULL) | |
if (lErrCode< 0||lErrCode >=MAX_ERROR_CODE) | |
memcpy (STRINGVALUE(RESULT), en_error_messages[lErrCode], STRLEN(RESULT)) | |
END | ERROR (pEo->LastError=LONGVALUE(CONVERT2LONG(EVALUATEEXPRESSION(PARAMETERNODE)))) |
Variables | |
pEo | LastError = 0 |
pEo | ErrorGoto = 0 |
pEo | fErrorGoto = 0 |
END pEo | ErrorGoto = PARAMETERNODE |
pEo | fErrorGoto = ONERROR_RESUME |
END pEo | ErrorGoto = 0 |
pEo | fErrorGoto = 0 |
END pEo | ErrorGoto = PARAMETERNODE |
pEo | fErrorGoto = ONERROR_GOTO |
END pEo | LastError = 0 |
END pEo | fErrorGoto = ONERROR_RESUMENEXT |
END pEo | LastError = 0 |
END pEo | fStop = fStopSTOP |
END pEo | fStop = fStopSTOP |
END | RESULT = NEWMORTALLONG |
END VARIABLE | vErrCode |
long | lErrCode |
USE_CALLER_MORTALS | |
vErrCode = NULL | |
else | lErrCode = GETLONGVALUE(vErrCode) |
RESULT = NEWMORTALSTRING(strlen(en_error_messages[lErrCode])) | |
ASSERTOKE |
|
|
|
|
|
Definition at line 242 of file goto.c. References pEo. |
|
Definition at line 238 of file goto.c. References ASSERTOKE. |
|
Definition at line 213 of file goto.c. References LONGVALUE(), pEo, and RESULT. |
|
|
|
|
|
|
|
|
|
GOTO =section misc =title GOTO label Go to a label and continue program execution at that label. Labels are local within functions and subroutines. You can not jump into a subroutine or jump out of it. Use of GOTO is usually discouraged and is against structural programming. Whenever you feel the need to use the T<GOTO> statement (except T<ON ERROR GOTO>) thin it twice whether there is a better solution without utilizing the statement T<GOTO>. Typical use of the T<GOTO> statement to jump out of some error condition to the error handling code or jumping out of some loop on some condition. Referenced by COMMAND_FUNCTIONARG(), if(), switch(), and while(). |
|
|
|
|
|
ONERRORGOTO =section error =title ON ERROR GOTO [ label | NULL ] =display ON ERROR GOTO Set the entry point of the error handling routine. If the argument is T<NULL> then the error handling is switched off. |
|
ONERRORRESUME =section error =title ON ERROR RESUME [ label | next ] =display ON ERROR RESUME Setting T<ON ERROR RESUME> will try to continue execution on the label or on the next statement when an error occurs without any error handling code. See also R<ONERRORGOTO>, R<RESUME> and R<ERROR>. |
|
|
|
|
|
|
|
|
|
|
|
|
|
END =section misc End of the program. Stops program execution. You should usually use this command to signal the end of a program. Although you can use R<STOP> and T<END> interchangeably this is the convention in BASIC programs to use the command T<END> to note the end of the program and T<STOP> to stop the program execution based on some extra condition inside the code. |
|
STOP =section misc error This command stops program execution. There is no possibility to restart program execution after this command was executed. See also R<END>. |
|
|
|
|
|
|
|
|
|
|
|
|
|
ERROR =section error =title ERROR() or ERROR n The keyword T<ERROR> can be used as a command as well as a built-in function. When used as a function it returns the error code that last happened. The error codes are defined in the header file T<error.bas> that can be included with the command T<import>. The error code is a vital value when an error happens and is captured by some code defined after the label referenced by the command T<ON ERROR GOTO>. This helps the programmer to ensure that the error was really the one that the error handling code can handle and not something else. If the keyword is used as a command then it has to be followed by some numeric value. The command does not ever return but generates an error of the code given by the argument. Take care when composing the expression following the keyword T<ERROR>. It may happen that the expression itself can not be evaluated due to some error conditions during the evaluation of the expression. The best practice is to use a constant expression using the symbolic constants defined in the include file T<error.bas>. Note that the codes defined in the include file are version dependant. If an error is not captured by any T<ON ERROR GOTO> specified error handler then the interpreter stops. The command line variation passes the error code to the executing environment as exit code. In other word you can exit from a BASIC program |
|
|
|
|
|
ERRORD =section errord =title ERROR$() or ERROR Returns the English sentence describing the last error if the argument is not defined or returns the English sentence describing the error for the error code T<n>. If the error code T<n> provided as argument is negative or is above all possible errors then the result of the function is T<undef>. |