#ifndef __ASSERT_H #define __ASSERT_H /***************************************************************************** * CONFIG ASSERT THINGS *****************************************************************************/ /* enable to enable asserts */ #define ASSERT_ON /* exit way */ #define __EXIT_ABBORT #ifdef __EXIT_ABBORT #define __EXIT_WAY exit(1); #else #define __EXIT_WAY ; #endif #ifdef ASSERT_ON #define __STR(S) #S #define AS_NULL(X) if ((X)==NULL)\ {\ printf("\033[1;34m%s:%d GOTCHA NULL\033[0m\n",__FILE__,__LINE__);\ __EXIT_WAY;\ } #define AS_RANGE(X,A,B) #define AS_EXPR(X) if ((X))\ {\ printf("\033[1;34m%s:%d assert:%s\033[0m\n",__FILE__,__LINE__,__STR(X));\ __EXIT_WAY;\ } #else #define AS_NULL(X) #define AS_RANGE(X,A,B) #define AS_EXPR(X) #endif #endif