| iMatix home page
| << | < | > | >>
SFL Logo SFL
Version 2.11

 

sys_assert

#include "prelude.h"
void
sys_assert (const char *File, unsigned Line)

Synopsis

Displays an 'assertion failed' message and aborts the program. This function is required by prelude.h if you compile with the DEBUG symbol.

Source Code - (sflsyst.c)

{
#if (defined (__WINDOWS__))
    char
        line_str [10],
        *buffer;                        /*  Formatted error message          */
    MSG
        msg;
    Bool
        quit;
    int
        rc;                             /*  MessageBox return code           */

    snprintf (line_str, sizeof (line_str), "%u", Line);
    buffer = xstrcpy (NULL, "Module ", File, ", line ", line_str, NULL);

    /*  If WM_QUIT is in the queue the message box won't show                */
    quit = PeekMessage (&msg, NULL, WM_QUIT, WM_QUIT, PM_REMOVE);
    rc   = MessageBox  (NULL, buffer, "Assertion failed!",
                        MB_TASKMODAL | MB_ICONHAND | MB_ABORTRETRYIGNORE);
    mem_free (buffer);
    if (quit)
        PostQuitMessage (msg.wParam);
    if (rc != IDABORT)
        return;
#else
    fflush  (stdout);
    fprintf (stderr, "\nAssertion failed: %s, line %u\n", File, Line);
    fflush  (stderr);
#endif
    abort   ();
}

| << | < | > | >> iMatix Copyright © 1996-2000 iMatix Corporation