No longer to use dlog.h.m4 43/58843/2
authorKichan Kwon <k_c.kwon@samsung.com>
Thu, 4 Feb 2016 02:37:43 +0000 (11:37 +0900)
committerKichan Kwon <k_c.kwon@samsung.com>
Mon, 22 Feb 2016 02:29:30 +0000 (11:29 +0900)
Divide existing dlog.h.m4 to below

 - dlog.h : public API

 - dlog-internal.h : macro

Change-Id: I2f310f02323dbd04244493e09ea02916ce4ab663
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
Makefile.am
configure.ac
include/dlog-internal.h [moved from include/dlog.h.m4 with 84% similarity]
include/dlog.h [new file with mode: 0755]
packaging/dlog.spec

index 9d2ddf8..1f4bdcc 100755 (executable)
@@ -11,7 +11,8 @@ AM_CFLAGS = -I$(srcdir)/include \
 dlog_includedir = $(includedir)/dlog
 
 dlog_include_HEADERS = \
-       include/dlog.h
+       include/dlog.h \
+       include/dlog-internal.h
 
 lib_LTLIBRARIES = libdlog.la
 
@@ -19,7 +20,7 @@ libdlog_la_SOURCES =  \
        src/libdlog/log.c \
        src/shared/logcommon.c \
        include/dlog.h \
-       include/logcommon.h \
+       include/dlog-internal.h \
        src/libdlog/logconfig.c \
        include/logconfig.h \
        src/libdlog/loglimiter.c \
@@ -98,9 +99,6 @@ dloginit_SOURCES = \
        include/logcommon.h \
        include/dlog.h
 
-include/%: include/%.m4
-       m4 -P $(M4_DEFINES) < $< > $@
-
 # conf file
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = dlog.pc
index 6bd3321..4a74157 100755 (executable)
@@ -17,9 +17,6 @@ AC_PROG_CC
 AC_PROG_GCC_TRADITIONAL
 AC_PROG_LIBTOOL
 
-AC_SUBST(M4_DEFINES)
-M4_DEFINES=
-
 # check for libsystemd-journal
 AC_ARG_ENABLE(journal, AS_HELP_STRING([--enable-journal], [enable systemd journal]),
     [with_systemd_journal=yes],
@@ -47,7 +44,6 @@ AC_ARG_ENABLE([engineer_mode],
                engineer_mode=no)
 if test "x$engineer_mode" = "xyes" ; then
        DEBUG_CFLAGS+=" -DTIZEN_ENGINEER_MODE"
-       M4_DEFINES="$M4_DEFINES -DTIZEN_ENGINEER_MODE"
 fi
 AC_ARG_ENABLE([debug_enable],
        AS_HELP_STRING([--enable-debug_enable Turn on debug_enable]),
similarity index 84%
rename from include/dlog.h.m4
rename to include/dlog-internal.h
index 6407537..f0ff5b5 100755 (executable)
  */
 
 /**
- * @file       dlog.h
+ * @file       dlog-internal.h
  * @version    0.4
  * @brief      This file is the header file of interface of dlog.
  */
-#ifndef        _DLOG_H_
-#define        _DLOG_H_
+#ifndef        _DLOG_INTERNAL_H_
+#define        _DLOG_INTERNAL_H_
 
 #include <tizen_error.h>
 #include <stdarg.h>
@@ -45,52 +45,11 @@ extern "C" {
 #define __MODULE__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
 #endif
 
-m4_ifdef(`TIZEN_ENGINEER_MODE',
+#ifdef TIZEN_ENGINEER_MODE
+#ifndef DLOG_DEBUG_ENABLE
 #define DLOG_DEBUG_ENABLE
-
-)m4_dnl
-/**
- * @addtogroup CAPI_SYSTEM_DLOG
- * @{
- *
- */
-/**
- * @brief Enumeration for Dlog Error.
- * @since_tizen 2.3
- */
-typedef enum {
-       DLOG_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
-       DLOG_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
-       DLOG_ERROR_NOT_PERMITTED = TIZEN_ERROR_NOT_PERMITTED /**< Operation not permitted */
-} dlog_error_e;
-/**
- * @}
- */
-
-/**
- * @addtogroup CAPI_SYSTEM_DLOG
- * @{
- *
- */
-/**
- * @brief log priority values, in ascending priority order.
- * @since_tizen 2.3
- */
-typedef enum {
-       DLOG_UNKNOWN = 0, /**< Keep this always at the start */
-       DLOG_DEFAULT, /**< Default */
-       DLOG_VERBOSE, /**< Verbose */
-       DLOG_DEBUG, /**< Debug */
-       DLOG_INFO, /**< Info */
-       DLOG_WARN, /**< Warning */
-       DLOG_ERROR, /**< Error */
-       DLOG_FATAL, /**< Fatal */
-       DLOG_SILENT, /**< Silent */
-       DLOG_PRIO_MAX   /**< Keep this always at the end. */
-} log_priority;
-/**
- * @}
- */
+#endif
+#endif
 
 /**
  * @internal
@@ -426,79 +385,6 @@ static inline int __dlog_no_print(const char *fmt __attribute__((unused)), ...)
 #endif
 // ---------------------------------------------------------------------
 
-/**
- * @addtogroup CAPI_SYSTEM_DLOG
- * @{
- */
-/**
- * @brief     Send log with priority and tag.
- * @details   for application
- * @since_tizen 2.3
- * @param[in] prio log_priority
- * @param[in] tag tag
- * @param[in] fmt format string
- * @return On success, the function returns the number of bytes written.
- *         On error, a negative errno-style error code
- * @retval #DLOG_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #DLOG_ERROR_NOT_PERMITTED Operation not permitted
- * @pre       none
- * @post      none
- * @see       dlog_vprint
- * @code
-#include<dlog.h>
-int main(void)
-{
-    int integer = 21;
-    char string[] = "test dlog";
-
-       dlog_print(DLOG_INFO, "USR_TAG", "test dlog");
-       dlog_print(DLOG_INFO, "USR_TAG", "%s, %d", string, integer);
-    return 0;
-}
- * @endcode
- */
-int dlog_print(log_priority prio, const char *tag, const char *fmt, ...);
-
-/**
- * @brief     Send log with priority, tag and va_list.
- * @details   for application
- * @since_tizen 2.3
- * @param[in] prio log_priority
- * @param[in] tag tag
- * @param[in] fmt format string
- * @param[in] ap va_list
- * @return On success, the function returns the number of bytes written.
- *         On error, a negative errno-style error code
- * @retval #DLOG_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #DLOG_ERROR_NOT_PERMITTED Operation not permitted
- * @pre       none
- * @post      none
- * @see       dlog_print
- * @code
-#include<dlog.h>
-void my_debug_print(char *format, ...)
-{
-    va_list ap;
-
-    va_start(ap, format);
-    dlog_vprint(DLOG_INFO, "USR_TAG", format, ap);
-    va_end(ap);
-}
-
-int main(void)
-{
-    my_debug_print("%s", "test dlog");
-    my_debug_print("%s, %d", "test dlog", 21);
-    return 0;
-}
- * @endcode
- */
-int dlog_vprint(log_priority prio, const char *tag, const char *fmt, va_list ap);
-/**
- * @}
- */
-
-
 /*
  * The stuff in the rest of this file should not be used directly.
  */
@@ -520,7 +406,7 @@ int dlog_vprint(log_priority prio, const char *tag, const char *fmt, va_list ap)
  * @see       __dlog_print
  * @code
     #define LOG_TAG USR_TAG
-    #include<dlog.h>
+    #include<dlog-internal.h>
      __dlog_print(LOG_ID_MAIN, DLOG_INFO, USR_TAG, "you must not use this API directly");
  * @endcode
  */
@@ -545,7 +431,7 @@ int __dlog_print(log_id_t log_id, int prio, const char *tag, const char *fmt, ..
  * @see       __dlog_vprint
  * @code
     #define LOG_TAG USR_TAG
-    #include<dlog.h>
+    #include<dlog-internal.h>
      __dlog_vprint(LOG_ID_MAIN, DLOG_INFO, USR_TAG, "you must not use this API directly", ap);
  * @endcode
   */
@@ -553,4 +439,4 @@ int __dlog_vprint(log_id_t log_id, int prio, const char *tag, const char *fmt, v
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
-#endif /* _DLOG_H_*/
+#endif /* _DLOG_INTERNAL_H_*/
diff --git a/include/dlog.h b/include/dlog.h
new file mode 100755 (executable)
index 0000000..9fd134a
--- /dev/null
@@ -0,0 +1,164 @@
+/*
+ * DLOG
+ * Copyright (c) 2005-2008, The Android Open Source Project
+ * Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file       dlog.h
+ * @version    0.4
+ * @brief      This file is the header file of interface of dlog.
+ */
+#ifndef        _DLOG_H_
+#define        _DLOG_H_
+
+#include <tizen_error.h>
+#include <stdarg.h>
+#include <string.h>
+
+#include "dlog-internal.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/*
+ * This is the local tag used for the following simplified
+ * logging macros.  You can change this preprocessor definition
+ * before using the other macros to change the tag.
+ */
+#ifndef LOG_TAG
+#define LOG_TAG NULL
+#endif
+
+/**
+ * @addtogroup CAPI_SYSTEM_DLOG
+ * @{
+ *
+ */
+/**
+ * @brief Enumeration for Dlog Error.
+ * @since_tizen 2.3
+ */
+typedef enum {
+       DLOG_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
+       DLOG_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
+       DLOG_ERROR_NOT_PERMITTED = TIZEN_ERROR_NOT_PERMITTED /**< Operation not permitted */
+} dlog_error_e;
+/**
+ * @}
+ */
+
+/**
+ * @addtogroup CAPI_SYSTEM_DLOG
+ * @{
+ *
+ */
+/**
+ * @brief log priority values, in ascending priority order.
+ * @since_tizen 2.3
+ */
+typedef enum {
+       DLOG_UNKNOWN = 0, /**< Keep this always at the start */
+       DLOG_DEFAULT, /**< Default */
+       DLOG_VERBOSE, /**< Verbose */
+       DLOG_DEBUG, /**< Debug */
+       DLOG_INFO, /**< Info */
+       DLOG_WARN, /**< Warning */
+       DLOG_ERROR, /**< Error */
+       DLOG_FATAL, /**< Fatal */
+       DLOG_SILENT, /**< Silent */
+       DLOG_PRIO_MAX   /**< Keep this always at the end. */
+} log_priority;
+/**
+ * @}
+ */
+
+/**
+ * @addtogroup CAPI_SYSTEM_DLOG
+ * @{
+ */
+/**
+ * @brief     Send log with priority and tag.
+ * @details   for application
+ * @since_tizen 2.3
+ * @param[in] prio log_priority
+ * @param[in] tag tag
+ * @param[in] fmt format string
+ * @return On success, the function returns the number of bytes written.
+ *         On error, a negative errno-style error code
+ * @retval #DLOG_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #DLOG_ERROR_NOT_PERMITTED Operation not permitted
+ * @pre       none
+ * @post      none
+ * @see       dlog_vprint
+ * @code
+#include<dlog.h>
+int main(void)
+{
+    int integer = 21;
+    char string[] = "test dlog";
+
+       dlog_print(DLOG_INFO, "USR_TAG", "test dlog");
+       dlog_print(DLOG_INFO, "USR_TAG", "%s, %d", string, integer);
+    return 0;
+}
+ * @endcode
+ */
+int dlog_print(log_priority prio, const char *tag, const char *fmt, ...);
+
+/**
+ * @brief     Send log with priority, tag and va_list.
+ * @details   for application
+ * @since_tizen 2.3
+ * @param[in] prio log_priority
+ * @param[in] tag tag
+ * @param[in] fmt format string
+ * @param[in] ap va_list
+ * @return On success, the function returns the number of bytes written.
+ *         On error, a negative errno-style error code
+ * @retval #DLOG_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #DLOG_ERROR_NOT_PERMITTED Operation not permitted
+ * @pre       none
+ * @post      none
+ * @see       dlog_print
+ * @code
+#include<dlog.h>
+void my_debug_print(char *format, ...)
+{
+    va_list ap;
+
+    va_start(ap, format);
+    dlog_vprint(DLOG_INFO, "USR_TAG", format, ap);
+    va_end(ap);
+}
+
+int main(void)
+{
+    my_debug_print("%s", "test dlog");
+    my_debug_print("%s, %d", "test dlog", 21);
+    return 0;
+}
+ * @endcode
+ */
+int dlog_vprint(log_priority prio, const char *tag, const char *fmt, va_list ap);
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+#endif /* _DLOG_H_*/
index 657d277..5c26f4d 100755 (executable)
@@ -197,5 +197,6 @@ systemctl daemon-reload
 
 %files -n libdlog-devel
 %{_includedir}/dlog/dlog.h
+%{_includedir}/dlog/dlog-internal.h
 %{_libdir}/pkgconfig/dlog.pc
 %{_libdir}/libdlog.so