NAME

oadl::setjmp - establish the target for a subsequent non-local jump

SYNOPSIS

oadl::setjmp(buf)

DESCRIPTION

The setjmp() / longjmp() duo can perform a non-local jump. The argument buf must be a List of exactly oadl::JMP_SIZE elements, which will be overwritten. setjmp() returns false when it is first executed; otherwise, it returns the value given to the subsequent longjmp() call.

RETURN VALUE

Returns false when the contents of buf are established as a target for a subsequent longjmp(). Returns the value passed to longjmp() when a non-local jump is executed.

ERRORS

TypeCheck is thrown if buf is not a List containing exactly oadl::JMP_SIZE elements

EXAMPLE

    proc foo(buf)
    {
        oadl::longjmp(buf, true);
        "This statement is not reached.\n";
    }

    proc bar()
    {
        var buf = new List(oadl::JMP_SIZE);
        if (oadl::setjmp(buf)) {
            "Successfully jumped!\n";
        }
        else {
            foo(buf);
        }
    }

    bar()
Successfully jumped!

SEE ALSO

longjmp