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

 

sys_assert

#include "sflsyst.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__) && !defined (_CONSOLE))
    static char
        buffer [LINE_MAX];              /*  Formatted error message          */
    MSG
        msg;
    Bool
        quit;
    int
        rc;                             /*  MessageBox return code           */

    sprintf (buffer, "Module %s, line %u", File, Line);
    /*  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);
    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-98 iMatix