218
K
A
DAK
AMX 86 Procedures
Example #include "AMX831CF.H"
void cdecl dowork(struct ajxjbuf *jbp);
static struct ajxjbuf jumpbuffer;
#define STACKSIZE 512 /* Stack size (longs) */
static long newstack[STACKSIZE];
/* Top of stack (grows down) */
#define STACKP (&newstack[STACKSIZE - 1])
void cdecl taskbody(void) {
if (ajcfjset(&jumpbuffer) == 0)
/* Switch to new stack and do work */
ajcfstkjmp(&jumpbuffer, STACKP,
(void (*)())dowork);
/* Never returns to here */
/* Do work using original stack */
dowork(NULL);
}
void cdecl dowork(struct ajxjbuf *jbp) {
/* Do work */
/* If jump buffer provided, then use long jump to */
/* restore the original stack and return */
if (jbp != NULL)
ajcfjlong(jbp, 1);
}
See Also ajcfstkjmp