This library provides you the opportunity to use nonlocal gotos as well as in C language. It is important to note that this one supports JIT-plugin.Documentation
In Pawn there is a goto operator which provides an unconditional jump from the 'goto' to a labeled statement in the same function. This operator can only jump within the same function, but the library provides a nonlocal unconditional jump between functions.Download
Functions
Example
Name Description setjmp Saves the current environment into the variable for later use by the function longjmp. Parameters:
- env[JmpBuf] - buffer for storing environments.
- &retval - the reference to a variable into which will be written the value from the function longjmp.
longjmp Restores the environment saved by the function setjmp. Parameters:
- env[JmpBuf] - buffer for storing environments.
- val - return value.
pawn Код:new jmp[JmpBuf];
main() {
new ret;
setjmp(jmp, ret); // save the current environment into the buffer.
print(!"main()"); // this code will be executed several times.
if (ret != 2) { // we need to use the condition to avoid an infinite loop.
somefunc(ret);
}
}
somefunc(ret)
{
print(!"somefunc()");
longjmp(jmp, ret+1); // global goto.
}
github
Author: VVWVV
Licensed under the zlib.
based on script, Good job.
i bet the most of people (me too ) here, don't know what is this. suggestion: you should add more informations. |