[Bug] change SUPPORT_LCD_TIMEOUT_KEEPING 1 --> 0 .
[apps/core/preloaded/settings.git] / include / setting-debug.h
1 /*
2  * setting
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd.
5  *
6  * Contact: MyoungJune Park <mj2004.park@samsung.com>
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20  */
21 /**
22  * @defgroup setting-debug
23  * setting debug utility
24  */
25
26 #ifndef _SETTING_DEBUG_H_
27 #define _SETTING_DEBUG_H_
28 #include <stdio.h>
29
30 /*#define MTRACE_ENABLED*/
31
32 #define DISABLED_CODE 0
33
34 //#define DEBUG_CODE
35
36 #define SETTING_USING_PLATFORM_DBG
37 #ifdef SETTING_USING_PLATFORM_DBG
38 #include <dlog.h>
39 #ifdef LOG_TAG
40 #undef LOG_TAG
41 #endif
42
43
44 #define LOG_TAG "SETTING"
45 #endif
46
47
48 #if !defined(LOCALEDIR)
49 #define LOCALEDIR "/opt/apps/org.tizen.setting/res/locale"
50 #endif
51
52 #if !defined(EDJDIR)
53 #define EDJDIR "/opt/apps/org.tizen.setting/res/edje"
54 #endif
55
56 #define SUPPORT_BOTTOM_BTNS 1
57 #define REMOVE_BACK_BUTTON_MAIN 0
58 #define SUPPORT_GL_ENGINE 1
59
60
61 /*macros to control program flow*/
62 #define SUPPORT_MORE_ITEM_FUNCTION 1
63
64 // #define SUPPORT_MDM
65
66 /*##menu options##*/
67 #define SUPPORT_AllShare_Memory                 0
68 #define SUPPORT_FMradio                         1
69 #define SUPPORT_FONT                            1
70 #define SUPPORT_MENUSCREEN                      1
71 #define SUPPORT_WALLPAPER                       1
72 #define SUPPOR_SEPARATE_BRIGHTNESS              1
73
74 #define SUPPORT_RCS_FOR_DEMO                    0
75 #define SUPPORT_ACCESSIBILITY                   1
76 #define SUPPORT_CERTIFICATES            0
77 #define SUPPORT_MOTIONS                         1
78 #define SUPPORT_POWERSAVING                     1
79 #define SUPPORT_RUN_SYSTEM_COMMAND              0
80 #define SUPPORT_STORAGE                         1
81 #define SUPPORT_WIFI_DIRECT                     1
82 #define SUPPORT_DATA_USAGE                      0
83 #define SUPPORT_SECURITY                        0
84
85 /*#endif*/
86
87 #define SUPPORT_APP_ROATION                     0
88 #define SUPPORT_LCD_TIMEOUT_KEEPING             0
89 #define USE_DEVICE_SET_DISPLAY_BRT              1
90
91 #define  LOW_BATTERY_DO_NOTHING                 1       /**< 1 : turn the low batter handlding off */
92
93 #define APPLIED_BACK_KEY_UG                     0
94
95 #define APPLIED_DATATIME_FIRSTDAY_WEEK          1
96 #define SUPPORT_DATEFIELD_DATE_FORMAT_AUTOSET   0
97
98 #define SUPPORT_FDN 0
99 #define SUPPORT_PARENTAL_MODE 0
100
101 #define SETTING_ENABLE_TRACE
102
103 #ifdef SETTING_ENABLE_TRACE
104         #ifdef SETTING_USING_PLATFORM_DBG
105                 #define SETTING_TRACE_DEBUG(fmt, arg...) \
106                         do {\
107                                 LOGD("\n\033[0;32mDEBUG: " fmt "\033[0m\t%s:%d\n", \
108                                 ##arg, (char*)(strrchr(__FILE__, '/')+1), __LINE__);\
109                         }while(0);
110
111                 #define SETTING_TRACE(fmt, arg...) \
112                         do {\
113                                 LOGI("\n\033[0;36m" fmt "\033[0m\t%s:%d\n", \
114                                                 ##arg, (char*)(strrchr(__FILE__, '/')+1), __LINE__);\
115                         }while(0);
116
117                 #define SETTING_TRACE_WARNING(fmt, arg...) \
118                         do {\
119                                 LOGW("\033[0;33mWARRING: " fmt "\033[0m\t%s:%d\n", ##arg, (char*)(strrchr(__FILE__, '/')+1), __LINE__);\
120                         }while(0);
121
122                 #define SETTING_TRACE_ERROR(fmt, arg...) \
123                         do {\
124                                 LOGE("\033[0;31mERROR: " fmt "\033[0m\t%s:%d\n", ##arg, (char*)(strrchr(__FILE__, '/')+1), __LINE__);\
125                         }while(0);
126                 #define SETTING_TRACE_BEGIN do {\
127                                 {\
128                                         LOGD("\n\033[0;35mENTER FUNCTION: %s. \033[0m\t%s:%d\n", \
129                                         __FUNCTION__, (char*)(strrchr(__FILE__, '/')+1), __LINE__);\
130                                 }\
131                         }while(0);
132
133                 #define SETTING_TRACE_END  do {\
134                                 {\
135                                         LOGD("\n\033[0;35mEXIT FUNCTION: %s. \033[0m\t%s:%d\n", \
136                                         __FUNCTION__, (char*)(strrchr(__FILE__, '/')+1), __LINE__);\
137                                 }\
138                         }while(0);
139         #else
140                 #define SETTING_TRACE(fmt, arg...) \
141                         do {\
142                                 printf("\n[SETTING]\033[0;36m" fmt "\033[0m\t%s:%d\n", \
143                                                 ##arg, (char*)(strrchr(__FILE__, '/')+1), __LINE__);\
144                         }while(0);
145
146
147                 #define SETTING_TRACE_DEBUG(fmt, arg...) \
148                         do {\
149                                 printf("\n[SETTING]\033[0;32mDEBUG: " fmt "\033[0m\t%s:%d\n", \
150                                                 ##arg, (char*)(strrchr(__FILE__, '/')+1), __LINE__);\
151                         }while(0);
152
153                 #define SETTING_TRACE_WARNING(fmt, arg...) \
154                         do {\
155                         {\
156                                 printf("[SETTING]\033[0;33mWARRING: " fmt "\033[0m\t%s:%d\n", ##arg, (char*)(strrchr(__FILE__, '/')+1), __LINE__);}\
157                         }while(0);
158
159                 #define SETTING_TRACE_ERROR(fmt, arg...) \
160                         do {\
161                                 {fprintf(stderr, "[SETTING]\033[0;31mERROR: " fmt "\033[0m\t%s:%d\n", ##arg, (char*)(strrchr(__FILE__, '/')+1), __LINE__);}\
162                         }while(0);
163
164                 #define SETTING_TRACE_BEGIN do {\
165                                 {\
166                                         printf("\n[SETTING]\033[0;35mENTER FUNCTION: %s. \033[0m\t%s:%d\n", \
167                                         __FUNCTION__, (char*)(strrchr(__FILE__, '/')+1), __LINE__);\
168                                 }\
169                         }while(0);
170
171                 #define SETTING_TRACE_END  do {\
172                                 {\
173                                         printf("\n[SETTING]\033[0;35mEXIT FUNCTION: %s. \033[0m\t%s:%d\n", \
174                                         __FUNCTION__, (char*)(strrchr(__FILE__, '/')+1), __LINE__);\
175                                 }\
176                         }while(0);
177         #endif
178 #else
179         #define SETTING_TRACE(fmt, arg...)
180         #define SETTING_TRACE_DEBUG(fmt, arg...)
181         #define SETTING_TRACE_WARNING(fmt, arg...)
182         #define SETTING_TRACE_ERROR(fmt, arg...)
183         #define SETTING_TRACE_BEGIN
184         #define SETTING_TRACE_END
185 #endif
186
187 #define setting_retvm_if(expr, val, fmt, arg...) do { \
188                 if(expr) { \
189                         SETTING_TRACE_ERROR(fmt, ##arg); \
190                         return (val); \
191                 } \
192         } while (0);
193
194 #define setting_retm_if(expr, fmt, arg...) do { \
195                 if(expr) { \
196                         SETTING_TRACE_ERROR(fmt, ##arg); \
197                         return; \
198                 } \
199         } while (0);
200
201 #ifndef retm_if
202 #define retm_if setting_retm_if
203 #endif
204 #ifndef retvm_if
205 #define retvm_if setting_retvm_if
206 #endif
207
208 #ifndef retv_if
209 #define retv_if(expr, val) do { \
210    if(expr) { \
211       return (val); \
212    } \
213 } while (0)
214 #endif
215 #ifndef ret_if
216 #define ret_if(expr) do { \
217    if(expr) { \
218       return ; \
219    } \
220 } while (0)
221 #endif
222
223 #define __FREE(del, arg) do { \
224                 if(arg) { \
225                         del((void *)(arg)); /*cast any argument to (void*) to avoid build warring*/\
226                         arg = NULL; \
227                 } \
228         } while (0);
229 #define FREE(arg) __FREE(free, arg)
230 #define G_FREE(arg) __FREE(g_free, arg)
231
232
233 //////
234 //a trick:To manager back pointer. eg,
235 //For using genlist, whenever Setting side and Genlist side both keep pointers
236 //to a same block memory(here is genlis item data via calloc), must use __BACK_POINTER_SET to
237 //bind the Setting side point into the Genlist side pointer
238 #define __BACK_POINTER_SET(pData) do { \
239                         if (pData)\
240                         {\
241                                 pData->pBack = (void **)(&(pData));\
242                         }\
243                 } while (0);
244
245 #define __BACK_POINTER_UNSET(pData) do { \
246                         if (pData && pData->pBack)/*release Setting side poniter handlers*/\
247                         {\
248                                 *(pData->pBack) = NULL;\
249                         }\
250                 } while (0);
251
252
253 #endif /* _SETTING_DEBUG_H_ */
254