os/graphics/graphicscomposition/openwfcompositionengine/common/include/owfdebug.h
First public contribution.
1 /* Copyright (c) 2009 The Khronos Group Inc.
2 * Portions copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies)
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and/or associated documentation files (the
6 * "Materials"), to deal in the Materials without restriction, including
7 * without limitation the rights to use, copy, modify, merge, publish,
8 * distribute, sublicense, and/or sell copies of the Materials, and to
9 * permit persons to whom the Materials are furnished to do so, subject to
10 * the following conditions:
12 * The above copyright notice and this permission notice shall be included
13 * in all copies or substantial portions of the Materials.
15 * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
19 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
20 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
21 * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
37 /* Enable platform specific library cleanup */
38 int xatexit(void (*func)(void));
45 #ifndef DEBUG_DONOT_LOG
54 #define OWF_ASSERT(c) assert(c);
56 #define OWF_ASSERT(c) ;
67 /* Defining DEBUG_LOG enables all log file output. Do this in the command-line, make or .MMP file
68 * The file output can be filtered by filename or by function name in the same way:
69 * Defining DEBUG_LOG_FUNCTION=fnname will filter for all functions STARTING with the name fnname
70 * Defining DEBUG_LOG_FILE=filename will filter for all functions ending with the name filename
71 * These filters utilise the predefined macros __FILE__ and __FUNCTION__ which are defined in current standards,
72 * but may contain platform-specific features such as path names, or linkage decoration,
73 * so the filter-string may require some platform-specific tuning.
74 * If the macros are not predefined in a useful way, or not defined at all, then you won't be able to filter, sorry.
76 #if defined(DEBUG_LOG_FILE)
77 #define DPRINT(x) if (OWF_Debug_DoLog(__FILE__,sizeof(__FILE__)-1)) OWF_Debug_Print x
78 #elif defined(DEBUG_LOG_FUNCTION)
79 #define DPRINT(x) if (OWF_Debug_DoLog(__FUNCTION__,sizeof(__FUNCTION__)-1)) OWF_Debug_Print x
81 #define DPRINT(x) OWF_Debug_Print x
84 #define NFPRINT(x) DPRINT(x)
85 #define ENTER(x) DPRINT(("%s:", #x))
87 #define TRACE(x) OWF_Debug_Trace x
88 #define INDENT OWF_Debug_TraceIndent()
89 #define UNDENT OWF_Debug_TraceUndent()
91 int OWF_Debug_DoLog(const char* symbol,int symlen);
92 void OWF_Debug_Print(const char* format, ...);
93 void OWF_Debug_Trace(const char* fmt, ...);
94 void OWF_Debug_TraceIndent();
95 void OWF_Debug_TraceUndent();
99 #define DPRINT(x) /* do nothing */
115 #endif /* OWFDEBUG_H_ */