Page 184 of 346 Start Back Next End ZBasic System Library 172 ZBasic Microcontrollers LongJmp Type Subroutine Invocation LongJmp(jmpbuf, val) Parameter Method Type Description jmpbuf ByRef Array of Byte A buffer holding the return context, see description below. val ByVal int16 The value to be returned to the original SetJmp() caller. Discussion This subroutine, in conjunction with SetJmp(), provides a way to circumvent the normal call-return structure and return directly to a distant caller. It is the equivalent of a non-local Goto function and can be used, among other purposes, to handle exceptions in your programs. The first parameter specifies a Byte array that has been previously initialized by a call to SetJmp(). The second parameter specifies a value that will be seen by the original SetJmp() caller as the return value. This value, which should be non-zero, can indicate the nature of the condition that led to the LongJmp() call. See the section on Exception Handling in the ZBasic Reference Manual for more details. Caution Passing a jump buffer that has not been prepared by a call to SetJmp(), one that has been modified after the SetJmp()call, or one that was prepared by a subroutine/function that is no longer active will have unpredictable and almost certainly undesirable effects. Compatibility This routine is not available in BasicX compatibility mode. Also, this routine should not be used in applications that use ZBasic objects because it bypasses the execution of destructors that are necessary for proper object management. See Also SetJmp