abort_mode

Syntax

int abort_mode

Description

The abort mode variable determines how the filter will terminate execution when the abort function is called.

Details

Set "abort_mode" to one of the following values during initial execution of your filter:
0 - abort() throws an exception which is caught and handled at the main execution level.
This was the original FM 1.0 implementation, and requires Structured Exception Handling (SEH) -- which is not yet available in FM64.
1 - abort() sets gResult = userCanceledErr, and returns 0; this is the workaround suggested by Harry.
This abort mode does not stop the filter immediately, but lets the filter run to the end and then discards the processing. The filter developer can use "abort(); return true;" to make it stop immediately.
2 - abort() displays a message box "Processing aborted...", then longjmp's back to the most recent setjmp.
3 - abort() silently longjmp's back to the most recent setjmp.
This is an attempt to simulate the original SEH implementation, but won't work in all cases.
-1 - abort() uses the default implementation for the current execution target (mode 0 for x32, mode 3 for x64; the latter will revert to mode 0 once x64 supports SEH).

Example

%fml-2.0

OnFilterStart: {

    // This will cause abort to act as a Cancel click in compiled plugins
    // and display an error message during filter development.

    abort_mode = 2;
    if (DESIGNTIME) abort_mode = 1;
    return true;
}

Also see

abort

Comments

abort_mode is only available in FM1.0 Beta 9g MT4 and newer.