Nebula
Loading...
Searching...
No Matches
debug.h File Reference

Detailed Description

Nebula debug macros.

n_assert() - the vanilla assert() Macro n_verify() - like assert() except that the statement in parens is simply evaluated, unchecked, if __NEBULA_NO_ASSERT is set n_assert2() - an assert() plus a message from the programmer

#include "core/config.h"

Go to the source code of this file.

Macros

#define n_message   n_confirm
 
#define n_assert(exp)   { if (!(exp)) n_barf(#exp, __FILE__, __LINE__); }
 
#define n_assert2(exp, msg)   { if (!(exp)) n_barf2(#exp, msg, __FILE__, __LINE__); }
 
#define n_assert_msg(exp, msg)   n_assert2(exp, msg)
 
#define n_assert_fmt(exp, msg, ...)   { if (!(exp)) n_barf_fmt(#exp, msg, __FILE__, __LINE__, __VA_ARGS__); }
 
#define n_warn(exp)   { if (!(exp)) n_cough(#exp, __FILE__, __LINE__); }
 
#define n_warn2(exp, msg)   { if (!(exp)) n_cough2(#exp, msg, __FILE__, __LINE__); }
 
#define n_warn_fmt(exp, msg, ...)   { if (!(exp)) n_cough_fmt(#exp, msg, __FILE__, __LINE__, __VA_ARGS__); }
 
#define n_crash(msg)   { n_error("*** NEBULA CRASH ***\n%s(%d)\nmessage: %s\n", __FILE__, __LINE__, msg); }
 
#define n_static_assert(exp)   { int _x[ 2*((exp) != 0)-1 ]; (void)(_x[0]=0);}
 

Functions

void n_printf (const char *,...) __attribute__((format(printf
 
void void n_error (const char *,...) __attribute__((format(printf
 
void void void n_dbgout (const char *,...) __attribute__((format(printf
 
void void void void n_warning (const char *,...) __attribute__((format(printf
 
void void void void void n_confirm (const char *,...) __attribute__((format(printf
 
void void void void void void n_sleep (double)
 Put process to sleep.
 
void n_barf (const char *, const char *, int)
 This function is called by n_assert() when the assertion fails.
 
void n_barf2 (const char *, const char *, const char *, int)
 This function is called by n_assert2() when the assertion fails.
 
void n_barf_fmt (const char *, const char *, const char *, int,...)
 
void n_cough (const char *, const char *, int)
 This function is called by n_assert() when the assertion fails.
 
void n_cough2 (const char *, const char *, const char *, int)
 This function is called by n_assert2() when the assertion fails.
 
void n_cough_fmt (const char *, const char *, const char *, int,...)
 
void n_break ()
 

Macro Definition Documentation

◆ n_assert

#define n_assert ( exp)    { if (!(exp)) n_barf(#exp, __FILE__, __LINE__); }

◆ n_assert2

#define n_assert2 ( exp,
msg )   { if (!(exp)) n_barf2(#exp, msg, __FILE__, __LINE__); }

◆ n_assert_fmt

#define n_assert_fmt ( exp,
msg,
... )   { if (!(exp)) n_barf_fmt(#exp, msg, __FILE__, __LINE__, __VA_ARGS__); }

◆ n_assert_msg

#define n_assert_msg ( exp,
msg )   n_assert2(exp, msg)

◆ n_crash

#define n_crash ( msg)    { n_error("*** NEBULA CRASH ***\n%s(%d)\nmessage: %s\n", __FILE__, __LINE__, msg); }

◆ n_message

#define n_message   n_confirm

◆ n_static_assert

#define n_static_assert ( exp)    { int _x[ 2*((exp) != 0)-1 ]; (void)(_x[0]=0);}

◆ n_warn

#define n_warn ( exp)    { if (!(exp)) n_cough(#exp, __FILE__, __LINE__); }

◆ n_warn2

#define n_warn2 ( exp,
msg )   { if (!(exp)) n_cough2(#exp, msg, __FILE__, __LINE__); }

◆ n_warn_fmt

#define n_warn_fmt ( exp,
msg,
... )   { if (!(exp)) n_cough_fmt(#exp, msg, __FILE__, __LINE__, __VA_ARGS__); }

Function Documentation

◆ n_barf()

void n_barf ( const char * exp,
const char * file,
int line )

This function is called by n_assert() when the assertion fails.

◆ n_barf2()

void n_barf2 ( const char * exp,
const char * msg,
const char * file,
int line )

This function is called by n_assert2() when the assertion fails.

◆ n_barf_fmt()

void n_barf_fmt ( const char * exp,
const char * fmt,
const char * file,
int line,
... )

◆ n_break()

void n_break ( )

◆ n_confirm()

void void void void void n_confirm ( const char * ,
... )

◆ n_cough()

void n_cough ( const char * exp,
const char * file,
int line )

This function is called by n_assert() when the assertion fails.

◆ n_cough2()

void n_cough2 ( const char * exp,
const char * msg,
const char * file,
int line )

This function is called by n_assert2() when the assertion fails.

◆ n_cough_fmt()

void n_cough_fmt ( const char * exp,
const char * fmt,
const char * file,
int line,
... )

◆ n_dbgout()

void void void n_dbgout ( const char * ,
... )

◆ n_error()

void void n_error ( const char * ,
... )

◆ n_printf()

void n_printf ( const char * ,
... )

◆ n_sleep()

void void void void void void n_sleep ( double sec)

Put process to sleep.

  • 21-Dec-98 floh created

◆ n_warning()

void void void void n_warning ( const char * ,
... )