/*
    ####             #    #     # #
    #   #            #    #       #          The FreeWare C library for 
    #   #  ##   ###  #  # #     # ###             RISC OS machines
    #   # #  # #     # #  #     # #  #   ___________________________________
    #   # ####  ###  ##   #     # #  #                                      
    #   # #        # # #  #     # #  #    Please refer to the accompanying
    ####   ### ####  #  # ##### # ###    documentation for conditions of use
    ________________________________________________________________________

    File:    WAssert.h
    Author:  Copyright  1993, 1994 Mark H. Wilkinson
    Version: 1.01 (19 Jul 1994)
    Purpose: Wimp version of ANSI assert() system, based on Desk_RISCOS_Lib
             version presented in Archive magazine 6.12.53 by Remo Biagioni.
*/

/*  NOTES
 *  Assertions are used for debugging programs. They should be placed liberally
 *  throughout your code to check that certain conditions are met during
 *  development, and then the program re-compiled without them for final
 *  release.
 *
 *  e.g. if you have a function that expects a parameter which must be positive
 *  then it should include a line like:
 *    assert(parameter >= 0);
 *
 *  If 'parameter' is not >= 0 then a wimp error box will report the fact,
 *  indicating where in your source the assertion failed.
 *
 *  To use assertions you must compile your code with _DEBUG defined
 *  (i.e. run the compiler with the extra switch -Desk_D_DEBUG)
 *
 *  To build a release version of your program without the assertions in it
 *  (which will reduce the size of the program and increase execution speed)
 *  simply compile it ensuring that _DEBUG is not defined.
 */

#ifdef __cplusplus
	extern "C" {
#endif

#ifndef __Desk_WAssert_h
#define __Desk_WAssert_h


extern void Desk_WAssert__wassert(char *);


#else
#  undef assert
#endif

#ifndef _DEBUG
#  define assert(ignore) ((void)0)
#else
#  define __SR(x) __VL(x)
#  define __VL(x) #x
#  define assert(e) ((e) ? (void)0 : Desk_WAssert__wassert("Assertion " #e " failed at line " __SR(__LINE__) " of file " __FILE__))

#ifdef __cplusplus
}
#endif


#endif

