#include "cobsetjmp.h" int cobsetjmp(struct cobjmp_buf *buf);
buf | A buffer in which the current execution environment is saved. |
None.
The following shows how to use the coblongjmp() and cobsetjmp() functions:
void some_c_func(void) { struct cobjmp_buf buf; if (cobsetjmp(&buf) != 0) { cobprintf("Returned from coblongjmp\n"); return; } /* Valid code here - for example can call COBOL */ coblongjmp(&cobjmp_buf); }
Comments:
The cobsetjmp() function saves the environment of the current COBOL program and C function in the buffer pointed to by buf. It calls the C library function setjmp(), which immediately returns a value of 0.
A subsequent call to coblongjmp() either from elsewhere in the C function that called cobsetjmp(), or from one of its C or COBOL subprograms, causes execution to be resumed at the point immediately after the call to cobsetjmp().
After calling coblongjmp(), cobsetjmp() returns a non-zero value, thus enabling the value to be tested after the cobsetjmp() call.
The following restrictions apply when using the coblongjmp() and cobsetjmp() functions: