21#define MERROR_OK       0x0000 
   29#define MERROR_USR      0x0001 
   31#define MERROR_OVERFLOW 0x0002 
   33#define MERROR_FILE     0x0004 
   35#define MERROR_ALLOC    0x0008 
   37#define MERROR_PARSE    0x0010 
   39#define MERROR_GUI      0x0020 
   41#define MERROR_SND      MERROR_GUI 
   43#define MERROR_WAIT     0x0040 
   45#define MERROR_EXEC     MERROR_WAIT 
   47#define MERROR_TIMEOUT  0x0080 
   58#define MERROR_PREEMPT  (MERROR_EXEC | MERROR_TIMEOUT) 
   64#define MERROR_RESET (MERROR_EXEC | MERROR_PARSE) 
   70#define merror_sz_to_retval( sz ) ((sz) * -1) 
   72#define merror_retval_to_sz( retval ) ((retval) * -1) 
   74#define maug_cleanup_if_null_msg( type, ptr, err, msg ) \ 
   75   if( (type)NULL == ptr ) { \ 
   76      error_printf( msg ); \ 
   81#define maug_cleanup_if_not_null( type, ptr, err ) \ 
   82   if( (type)NULL == ptr ) { \ 
   83      error_printf( #ptr " is not NULL!" ); \
 
   88#define maug_cleanup_if_null( type, ptr, err ) \ 
   89   maug_cleanup_if_null_msg( type, ptr, err, "failed to allocate " #ptr "!" )
 
   91#define maug_cleanup_if_null_alloc( type, ptr ) \ 
   92   maug_cleanup_if_null_msg( type, ptr, MERROR_ALLOC, "failed to allocate " #ptr "!" )
 
   94#define maug_cleanup_if_null_lock( type, ptr ) \ 
   95   maug_cleanup_if_null_msg( type, ptr, MERROR_ALLOC, "failed to lock " #ptr "!" )
 
   97#define maug_cleanup_if_null_file( ptr ) \ 
   98   maug_cleanup_if_null_msg( FILE*, ptr, MERROR_FILE, "failed to open FILE!" )
 
  100#define maug_cleanup_if_not_ok() \ 
  101   if( MERROR_OK != retval ) { \ 
  105#define maug_cleanup_if_not_ok_msg( msg ) \ 
  106   if( MERROR_OK != retval ) { \ 
  107      error_printf( msg ); \ 
  111#define maug_cleanup_if_lt( a, b, fmt, err ) \ 
  113      error_printf( fmt " is less than " fmt "!", a, b ); \
 
  118#define maug_cleanup_if_lt_overflow( a, b ) \ 
  119   maug_cleanup_if_lt( a, b, SIZE_T_FMT, MERROR_OVERFLOW ) 
  121#define maug_cleanup_if_ge( a, b, fmt, err ) \ 
  123      error_printf( fmt " is greater or equal to " fmt "!", a, b ); \
 
  128#define maug_cleanup_if_ge_overflow( a, b ) \ 
  129   maug_cleanup_if_ge( a, (size_t)(b), SIZE_T_FMT, MERROR_OVERFLOW ) 
  131#define maug_cleanup_if_eq( a, b, fmt, err ) \ 
  133      error_printf( #a " " fmt " is equal to " #b " " fmt "!", a, b ); \
 
  138#define maug_cleanup_if_ne( a, b, fmt, err ) \ 
  140      error_printf( #a " " fmt " is NOT equal to " #b " " fmt "!", a, b ); \
 
uint16_t MERROR_RETVAL
Return type indicating function returns a value from this list.
Definition: merror.h:19