4 * Copyright (c) 2014 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Yongjin Kim <youth.kim@samsung.com>
7 * Jinhyeong Ahn <jinh.ahn@samsung.com>
8 * Jiwon Kim <jiwon177.kim@samsung.com>
10 * Licensed under the Apache License, Version 2.0 (the "License");
11 * you may not use this file except in compliance with the License.
12 * You may obtain a copy of the License at
14 * http://www.apache.org/licenses/LICENSE-2.0
16 * Unless required by applicable law or agreed to in writing, software
17 * distributed under the License is distributed on an "AS IS" BASIS,
18 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 * See the License for the specific language governing permissions and
20 * limitations under the License.
24 #ifndef __TIZEN_CONVERGENCE_SAL_INTERNAL_H__
25 #define __TIZEN_CONVERGENCE_SAL_INTERNAL_H__
34 #define API __attribute__ ((visibility("default")))
36 #define LOG_TAG "SERVICE-ADAPTOR"
38 #define DLOG(prio, fmt, arg...) \
39 do { SLOG(prio, LOG_TAG, fmt, ##arg); } while (0)
42 #if defined(_SERVICE_ADAPTOR_IPC_SERVER)
43 #define IPC_ROLE "[SERVER]"
44 #elif defined(_SERVICE_ADAPTOR_IPC_CLIENT)
45 #define IPC_ROLE "[CLIENT]"
47 #define IPC_ROLE "[LIB]"
53 #define FONT_COLOR_RESET "\033[0m"
54 #define FONT_COLOR_BLACK "\033[30m" /* Black */
55 #define FONT_COLOR_RED "\033[31m" /* Red */
56 #define FONT_COLOR_GREEN "\033[32m" /* Green */
57 #define FONT_COLOR_YELLOW "\033[33m" /* Yellow */
58 #define FONT_COLOR_BLUE "\033[34m" /* Blue */
59 #define FONT_COLOR_PURPLE "\033[35m" /* Purple */
60 #define FONT_COLOR_CYAN "\033[36m" /* Cyan */
61 #define FONT_COLOR_WHITE "\033[37m" /* White */
62 #define FONT_COLOR_BOLDBLACK "\033[1m\033[30m" /* Bold Black */
63 #define FONT_COLOR_BOLDRED "\033[1m\033[31m" /* Bold Red */
64 #define FONT_COLOR_BOLDGREEN "\033[1m\033[32m" /* Bold Green */
65 #define FONT_COLOR_BOLDYELLOW "\033[1m\033[33m" /* Bold Yellow */
66 #define FONT_COLOR_BOLDBLUE "\033[1m\033[34m" /* Bold Blue */
67 #define FONT_COLOR_BOLDPURPLE "\033[1m\033[35m" /* Bold Purple */
68 #define FONT_COLOR_BOLDCYAN "\033[1m\033[36m" /* Bold Cyan */
69 #define FONT_COLOR_BOLDWHITE "\033[1m\033[37m" /* Bold White */
71 #define INFO(fmt, arg...) SLOGI(FONT_COLOR_YELLOW""IPC_ROLE" "fmt""FONT_COLOR_RESET, ##arg)
72 #define ERR(fmt, arg...) SLOGE(FONT_COLOR_RED""IPC_ROLE" "fmt""FONT_COLOR_RESET, ##arg)
73 #define DBG(fmt, arg...) SLOGD(IPC_ROLE" "fmt, ##arg)
74 #define WARN(fmt, arg...) SLOGD(IPC_ROLE" "fmt, ##arg)
75 #define VERBOSE(fmt, arg...) SLOGV(IPC_ROLE" "fmt, ##arg)
77 #ifdef SERVICE_ADAPTOR_DEBUGGING
79 #define SAL_FN_CALL DBG(">>>>>>>> called")
80 #define SAL_FN_END DBG("<<<<<<<< ended")
81 // #define SAL_FN_CALL INFO(">>>>>>>> called")
82 // #define SAL_FN_END INFO("<<<<<<<< ended")
84 #define SAL_DBG(fmt, arg...) DBG(fmt, ##arg)
85 #define SAL_WARN(fmt, arg...) WARN(fmt, ##arg)
86 #define SAL_ERR(fmt, arg...) ERR(fmt, ##arg)
87 #define SAL_INFO(fmt, arg...) INFO(fmt, ##arg)
88 #define SAL_VERBOSE(fmt, arg...) VERBOSE(fmt, ##arg)
90 #else /* SERVICE_ADAPTOR_DEBUGGING */
94 #define SAL_DBG(fmt, arg...)
95 #define SAL_WARN(fmt, arg...)
96 #define SAL_ERR(fmt, arg...) ERR(fmt, ##arg)
97 #define SAL_INFO(fmt, arg...)
98 #define SAL_VERBOSE(fmt, arg...)
100 #endif /* SERVICE_ADAPTOR_DEBUGGING */
102 #define WARN_IF(expr, fmt, arg...) do { \
104 SAL_WARN(fmt, ##arg); \
107 #define RET_IF(expr) do { \
109 SAL_ERR("(%s)", #expr); \
113 #define RETV_IF(expr, val) do { \
115 SAL_ERR("(%s)", #expr); \
119 #define RETM_IF(expr, fmt, arg...) do { \
121 SAL_ERR(fmt, ##arg); \
125 #define RETVM_IF(expr, val, fmt, arg...) do { \
127 SAL_ERR(fmt, ##arg); \
131 #define TRY_IF(expr, fmt, arg...) do { \
133 SAL_INFO(fmt, ##arg); \
137 #define TRYM_IF(expr, fmt, arg...) do { \
139 SAL_ERR(fmt, ##arg); \
143 #define TRYVM_IF(expr, val, fmt, arg...) do { \
145 SAL_ERR(fmt, ##arg); \
151 #define SAL_STRDUP(dst, ptr) do { \
157 #define SAL_FREE(ptr) do { \
163 #endif /* __TIZEN_CONVERGENCE_SAL_INTERNAL_H__ */