DSMCC  15.3.1
source/dsmain/src/dm_debug.h
Go to the documentation of this file.
00001 /*******************************************************************************
00002  * Copyright © 2014 The DTVKit Open Software Foundation Ltd (www.dtvkit.org)
00003  * Copyright © 2004 Ocean Blue Software Ltd
00004  *
00005  * This file is part of a DTVKit Software Component
00006  * You are permitted to copy, modify or distribute this file subject to the terms
00007  * of the DTVKit 1.0 Licence which can be found in licence.txt or at www.dtvkit.org
00008  *
00009  * THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
00010  * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES
00011  * OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
00012  *
00013  * If you or your organisation is not a member of DTVKit then you have access
00014  * to this source code outside of the terms of the licence agreement
00015  * and you are expected to delete this and any associated files immediately.
00016  * Further information on DTVKit, membership and terms can be found at www.dtvkit.org
00017  *******************************************************************************/
00024 #ifndef _DM_DEBUG_H
00025 #define _DM_DEBUG_H
00026 
00027 
00028 #ifndef NDEBUG
00029 
00030  #include <stdio.h>
00031  #include <assert.h>
00032  #include "stb_debug.h"
00033  #include "dsm_debug.h"
00034 
00035  #ifdef DEBUG_ASSERT
00036    #define ASSERT(condition)    if (!(condition)) STB_SPDebugAssertFail(__FILE__, __LINE__,#condition);
00037  #else
00038    #include <assert.h>
00039    #define ASSERT(condition)  assert(condition);
00040  #endif
00041 
00042  #if DSM_DP_LEVEL >= 1
00043   #define DBG_ErrorPrintf (F_Printf)STB_SPDebugNoCnWrite
00044  #else
00045   #define DBG_ErrorPrintf (F_Printf)NULL
00046  #endif
00047  #if DSM_DP_LEVEL >= 2
00048   #define DBG_WarnPrintf  (F_Printf)STB_SPDebugNoCnWrite
00049  #else
00050   #define DBG_WarnPrintf  (F_Printf)NULL
00051  #endif
00052  #if DSM_DP_LEVEL >= 3
00053   #define DBG_DebugPrintf (F_Printf)STB_SPDebugNoCnWrite
00054  #else
00055   #define DBG_DebugPrintf (F_Printf)NULL
00056  #endif
00057  #if DSM_DP_LEVEL >= 4
00058   #define DBG_InfoPrintf  (F_Printf)STB_SPDebugNoCnWrite
00059  #else
00060   #define DBG_InfoPrintf (F_Printf)NULL
00061  #endif
00062 
00063  #define ERRPRINT(x, ...) STB_SPDebugWrite( "%s:%d " x, __FUNCTION__, __LINE__, ##__VA_ARGS__);
00064  #define DBGPRINT(t,x, ...)   if ( gDebugState & t ) \
00065    STB_SPDebugWrite( "%s:%d " x, __FUNCTION__, __LINE__, ##__VA_ARGS__);
00066 
00067  extern unsigned int gDebugState;
00068 
00069 #else
00070 
00071  #define ASSERT(condition)
00072  #define ERRPRINT(...)
00073  #define DBGPRINT(...)
00074 
00075  #define DBG_ErrorPrintf NULL
00076  #define DBG_DebugPrintf NULL
00077 
00078 #endif
00079 
00080  #define FUNCTION_START(x)
00081  #define FUNCTION_FINISH(x)
00082 
00083 
00084 #endif /*_DM_DEBUG_H*/
 All Data Structures Files Functions Typedefs