4 * Copyright 2012 Samsung Electronics Co., Ltd
6 * Licensed under the Flora License, Version 1.1 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://floralicense.org/license/
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
20 #ifndef _PGEN_DEBUG_H_INCLUDED_
21 #define _PGEN_DEBUG_H_INCLUDED_
24 /* debugging macros definitions */
26 /*#define PREVIEWGEN_STANDALONE_DEBUG*/
27 #define PREVIEWGEN_DLOG_DEBUG
28 #if defined PREVIEWGEN_STANDALONE_DEBUG
29 /* standalone preview generation (e.g. for testing) */
33 #define PGEN_DEBUG(fmt, arg...) \
35 fprintf(stderr, "DEBUG:%s:%s(%d): " fmt "\n", \
36 __FILE__, __func__, __LINE__, ##arg); \
38 #define PGEN_TRACE_BEGIN fprintf(stderr, "TRACE:%s ENTER\n", __func__);
39 #define PGEN_TRACE_END fprintf(stderr, "TRACE:%s LEAVE\n", __func__);
41 #define PGEN_RET_IF(expr, fmt, args...) \
44 PGEN_DEBUG("[%s] Return, message "fmt, #expr, ##args );\
49 #define PGEN_RETV_IF(expr, val, fmt, args...) \
52 PGEN_DEBUG("[%s] Return value, message "fmt, #expr, ##args );\
57 #define PGEN_IF_FREE_MEM(mem) \
66 #elif defined PREVIEWGEN_DLOG_DEBUG
67 /* standalone debugging with dlog */
69 #define LOG_TAG "MOBILEPRINT_PREVIEWGEN"
72 #define PGEN_DEBUG LOGD
73 #define PGEN_INFO LOGI
74 #define PGEN_RET_IF(expr, fmt, args...) \
77 PGEN_DEBUG("[%s] Return, message "fmt, \
83 #define PGEN_RETV_IF(expr, val, fmt, args...) \
86 PGEN_DEBUG("[%s] Return value, message "fmt, \
92 #define PGEN_TRACE_BEGIN PGEN_INFO("ENTER FUNCTION: %s\n", __FUNCTION__);
93 #define PGEN_TRACE_END PGEN_INFO("EXIT FUNCTION: %s\n", __FUNCTION__);
95 #define PGEN_IF_FREE_MEM(mem) \
105 /* connection to mobileprint debugging */
107 #include <pts_debug.h>
109 #define PGEN_DEBUG(fmt, arg...) PTS_DEBUG(fmt, ##arg)
110 #define PGEN_TRACE_BEGIN PTS_TRACE_BEGIN
111 #define PGEN_TRACE_END PTS_TRACE_END
112 #define PGEN_RET_IF PTS_RET_IF
113 #define PGEN_RETV_IF PTS_RETV_IF
114 #define PGEN_IF_FREE_MEM PTS_IF_FREE_MEM
116 #endif /* PREVIEWGEN_DEBUG */
119 #endif /* _PGEN_DEBUG_H_INCLUDED_ */