maassert.h File Reference


Detailed Description

Fatal error handling.

#include "ma.h"

Defines

#define ATTRIBUTE(a, func)   func __attribute__ ((a))
#define ALIGN(ament, func)   ATTRIBUTE(aligned(ament), func)
#define FREEZE   Freeze(0)
#define MAASSERT(a)   do{ if(!(a)) BIG_PHAT_ERROR; }while(0)
#define BIG_PHAT_ERROR   BIG_PHAT_ERROR_VAL(6)
#define BIG_PHAT_ERROR_VAL(value)   bfeHandler(value, FileNameFromPath(__FILE__), __LINE__)
#define PANIC_MESSAGE(msg)   panicFunction((msg), __FUNCTION__)
#define ASSERT_MSG(cond, msg)   do{ if(!(cond)) PANIC_MESSAGE(msg); }while(0)

Functions

const char * FileNameFromPath (const char *path)
void Freeze (int val) __attribute__((noreturn))
void bfeHandler (int val, const char *filename, int line) __attribute__((noreturn))
void panicFunction (const char *msg, const char *function) __attribute__((noreturn))


Define Documentation

#define ATTRIBUTE a,
func   )     func __attribute__ ((a))
 

#define ALIGN ament,
func   )     ATTRIBUTE(aligned(ament), func)
 

#define FREEZE   Freeze(0)
 

#define MAASSERT  )     do{ if(!(a)) BIG_PHAT_ERROR; }while(0)
 

#define BIG_PHAT_ERROR   BIG_PHAT_ERROR_VAL(6)
 

#define BIG_PHAT_ERROR_VAL value   )     bfeHandler(value, FileNameFromPath(__FILE__), __LINE__)
 

#define PANIC_MESSAGE msg   )     panicFunction((msg), __FUNCTION__)
 

Handles a fatal error by calling maPanic(). The message includes the name of the function where the error occurred.

See also:
Freeze

#define ASSERT_MSG cond,
msg   )     do{ if(!(cond)) PANIC_MESSAGE(msg); }while(0)
 


Function Documentation

const char* FileNameFromPath const char *  path  ) 
 

Returns a pointer to the filename in a full path.

void Freeze int  val  ) 
 

Freezes the program. Calls maExit() with val on Close Event or keypress MAK_0.

void bfeHandler int  val,
const char *  filename,
int  line
 

Handles a fatal error by printing a message to the console, then freezing. The message consists of filename and line number where the error occurred.

See also:
Freeze

void panicFunction const char *  msg,
const char *  function
 


Generated on Sat Feb 13 00:15:37 2010 for MoSync 2 beta 1 by  doxygen 1.4.6-NO