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)
 
#define n_assert2(exp, msg)
 
#define n_assert_msg(exp, msg)
 
#define n_assert_fmt(exp, msg, ...)
 
#define n_warn(exp)
 
#define n_warn2(exp, msg)
 
#define n_warn_fmt(exp, msg, ...)
 
#define n_crash(msg)
 
#define n_static_assert(exp)
 

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)
Value:
{ if (!(exp)) n_barf(#exp, __FILE__, __LINE__); }
void n_barf(const char *, const char *, int)
This function is called by n_assert() when the assertion fails.
Definition debug.cc:17

◆ n_assert2

#define n_assert2 ( exp,
msg )
Value:
{ if (!(exp)) n_barf2(#exp, msg, __FILE__, __LINE__); }
void n_barf2(const char *, const char *, const char *, int)
This function is called by n_assert2() when the assertion fails.
Definition debug.cc:36

◆ n_assert_fmt

#define n_assert_fmt ( exp,
msg,
... )
Value:
{ if (!(exp)) n_barf_fmt(#exp, msg, __FILE__, __LINE__, __VA_ARGS__); }
void n_barf_fmt(const char *, const char *, const char *, int,...)
Definition debug.cc:54

◆ n_assert_msg

#define n_assert_msg ( exp,
msg )
Value:
n_assert2(exp, msg)
#define n_assert2(exp, msg)
Definition debug.h:51

◆ n_crash

#define n_crash ( msg)
Value:
{ n_error("*** NEBULA CRASH ***\n%s(%d)\nmessage: %s\n", __FILE__, __LINE__, msg); }
void void n_error(const char *,...) __attribute__((format(printf

◆ n_message

#define n_message   n_confirm

◆ n_static_assert

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

◆ n_warn

#define n_warn ( exp)
Value:
{ if (!(exp)) n_cough(#exp, __FILE__, __LINE__); }
void n_cough(const char *, const char *, int)
This function is called by n_assert() when the assertion fails.
Definition debug.cc:77

◆ n_warn2

#define n_warn2 ( exp,
msg )
Value:
{ if (!(exp)) n_cough2(#exp, msg, __FILE__, __LINE__); }
void n_cough2(const char *, const char *, const char *, int)
This function is called by n_assert2() when the assertion fails.
Definition debug.cc:96

◆ n_warn_fmt

#define n_warn_fmt ( exp,
msg,
... )
Value:
{ if (!(exp)) n_cough_fmt(#exp, msg, __FILE__, __LINE__, __VA_ARGS__); }
void n_cough_fmt(const char *, const char *, const char *, int,...)
Definition debug.cc:114

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 * ,
... )