DSMCC  17.9.0
 All Data Structures Files Functions Typedefs
siq_debug.h
Go to the documentation of this file.
1 /*******************************************************************************
2  * Copyright © 2014 The DTVKit Open Software Foundation Ltd (www.dtvkit.org)
3  * Copyright © 2004 Ocean Blue Software Ltd
4  *
5  * This file is part of a DTVKit Software Component
6  * You are permitted to copy, modify or distribute this file subject to the terms
7  * of the DTVKit 1.0 Licence which can be found in licence.txt or at www.dtvkit.org
8  *
9  * THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
10  * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES
11  * OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
12  *
13  * If you or your organisation is not a member of DTVKit then you have access
14  * to this source code outside of the terms of the licence agreement
15  * and you are expected to delete this and any associated files immediately.
16  * Further information on DTVKit, membership and terms can be found at www.dtvkit.org
17  *******************************************************************************/
24 #ifndef SIQ_DEBUG_H
25 #define SIQ_DEBUG_H
26 
27 #ifndef NDEBUG
28 
29  #include <stdio.h>
30  #ifdef DEBUG_ASSERT
31  #include "stb_debug.h"
32  #define ASSERT(condition) if (!(condition)) STB_SPDebugAssertFail(__FILE__, __LINE__, # condition);
33  #else
34  #include <assert.h>
35  #define ASSERT(condition) assert(condition);
36  #endif
37 
38  #define ERRLOG(x, ...) if (siq->setup.errPrintf) \
39  siq->setup.errPrintf( "%s:%d " x "\n", __FUNCTION__, __LINE__, ##__VA_ARGS__);
40 
41  #define DBGLOG(t, x, ...) if (siq->setup.dbgPrintf && (siq->setup.dbgState & t)) \
42  siq->setup.dbgPrintf( "%s:%d " x "\n", __FUNCTION__, __LINE__, ##__VA_ARGS__);
43 
44 #else
45 
46  #define ASSERT(condition)
47 
48  #define ERRLOG(x, ...)
49  #define DBGLOG(t, x, ...)
50 
51 #endif
52 
53 #ifdef DEBUG_FUNCS
54  #define FUNCTION_START(x) DBGLOG(DS_FUNC, " start")
55  #define FUNCTION_FINISH(x) DBGLOG(DS_FUNC, " finish")
56 #else
57  #define FUNCTION_START(x)
58  #define FUNCTION_FINISH(x)
59 #endif
60 
61 #endif /*SIQ_DEBUG_H*/
Interface to platform debug functions.