freetype-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[freetype2] priyesh_LogLibrary 01ce8ff: Implemented a basic integration


From: Priyesh Kumar
Subject: [freetype2] priyesh_LogLibrary 01ce8ff: Implemented a basic integration of dlg with FreeType
Date: Mon, 29 Jun 2020 08:20:45 -0400 (EDT)

branch: priyesh_LogLibrary
commit 01ce8ff34087f33591cf6eafafe55673a793bf32
Author: Priyeshkkumar <priyeshkkumar@gmail.com>
Commit: Priyeshkkumar <priyeshkkumar@gmail.com>

    Implemented a basic integration of dlg with FreeType
---
 .gitmodules                         |  3 +++
 [priyesh]ChangeLog                  | 15 +++++++++++++++
 builds/unix/unix-cc.in              |  2 +-
 include/freetype/config/ftoption.h  | 14 ++++++++++++++
 include/freetype/internal/ftdebug.h | 38 ++++++++++++++++++++++++++++++++++---
 src/dlg                             |  1 +
 6 files changed, 69 insertions(+), 4 deletions(-)

diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000..967015f
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,3 @@
+[submodule "src/dlg"]
+       path = src/dlg
+       url = https://github.com/nyorain/dlg.git
diff --git a/[priyesh]ChangeLog b/[priyesh]ChangeLog
new file mode 100644
index 0000000..0f84213
--- /dev/null
+++ b/[priyesh]ChangeLog
@@ -0,0 +1,15 @@
+2020-06-29  Priyesh Kumar   <priyeshkkumar@gmail.com>
+
+    * Added submodule - dlg library (https://github.com/nyorain/dlg)
+      in src/dlg.
+      This library is used as a logger for FreeType.
+
+    * include/freetype/config/ftoption.h: Added macro `FT_LOGGING` 
+      to enable/disable logging in FreeType using dlg.
+  
+    * [builds] unix-cc-in: Added -std=c99, since dlg does not support 
+      C standards below c99. 
+
+    * include/freetype/internal/ftdebug.h: Created an environment for dlg 
+      support in FreeType.
+      
\ No newline at end of file
diff --git a/builds/unix/unix-cc.in b/builds/unix/unix-cc.in
index 30d097b..6dbf399 100644
--- a/builds/unix/unix-cc.in
+++ b/builds/unix/unix-cc.in
@@ -79,7 +79,7 @@ T := -o$(space)
 #   We use our own FreeType configuration files overriding defaults.
 #
 CPPFLAGS := @CPPFLAGS@
-CFLAGS   := -c @XX_CFLAGS@ @CFLAGS@ \
+CFLAGS   := -c -std=c99 @XX_CFLAGS@ @CFLAGS@ \
             $DFT_CONFIG_CONFIG_H="<ftconfig.h>" \
             $DFT_CONFIG_MODULES_H="<ftmodule.h>" \
             $DFT_CONFIG_OPTIONS_H="<ftoption.h>"
diff --git a/include/freetype/config/ftoption.h 
b/include/freetype/config/ftoption.h
index fd686d9..92aa89b 100644
--- a/include/freetype/config/ftoption.h
+++ b/include/freetype/config/ftoption.h
@@ -431,6 +431,20 @@ FT_BEGIN_HEADER
 /* #define FT_DEBUG_LEVEL_TRACE */
 
 
+  /*************************************************************************
+   * 
+   * Logging 
+   * 
+   *   Compiling FreeType in debug or trace mode will make FreeType to write
+   *   error and trace log messages to `stderr`. 
+   *   Enabling this macro will automatically force the `FT_DEBUG_LEVEL_ERROR` 
+   *   and `FT_DEBUG_LEVEL_TRACE` macros and will allow FreeType to write 
+   *   error and trace log messages to a file instead of `stderr`
+   * 
+   */ 
+/* #define FT_LOGGING */
+
+
   /**************************************************************************
    *
    * Autofitter debugging
diff --git a/include/freetype/internal/ftdebug.h 
b/include/freetype/internal/ftdebug.h
index e7eb29a..469220c 100644
--- a/include/freetype/internal/ftdebug.h
+++ b/include/freetype/internal/ftdebug.h
@@ -29,10 +29,25 @@
 #include FT_CONFIG_CONFIG_H
 #include <freetype/freetype.h>
 
+  /* Additional include files for supporting logging in FreeType using      */
+  /* external logging library ~ src/dlg                                     */
+  /*                                                                        */
+#include <../src/dlg/include/dlg/dlg.h>
+#include <../src/dlg/include/dlg/output.h>
+
 
 FT_BEGIN_HEADER
 
 
+  /* force the definition of FT_DEBUG_LEVEL_TRACE if FT_LOGGING is already*/
+  /* defined; therefore the following macros                              */
+  /*                                                                      */
+#ifdef FT_LOGGING
+#undef FT_DEBUG_LEVEL_TRACE
+#define FT_DEBUG_LEVEL_TRACE
+#endif /* FT_LOGGING */   
+
+
   /* force the definition of FT_DEBUG_LEVEL_ERROR if FT_DEBUG_LEVEL_TRACE */
   /* is already defined; this simplifies the following #ifdefs            */
   /*                                                                      */
@@ -74,14 +89,31 @@ FT_BEGIN_HEADER
   /**************************************************************************
    *
    * Define the FT_TRACE macro
-   *
+   * 
    * IMPORTANT!
    *
    * Each component must define the macro FT_COMPONENT to a valid FT_Trace
    * value before using any TRACE macro.
-   *
+   * 
+   * If FT_LOGGING is enabled, trace messages will be sent to 
+   * dlg's APIs and is FT_LOGGING is disabled trace messages will be sent to
+   * FT_Message(defined in ftdebug.c)
+   * Therefore the following macros:
+   *  
    */
 
+#ifdef FT_LOGGING
+
+#undef FT_Log
+#define FT_Log dlg_trace
+
+#else
+
+#undef FT_Log
+#define FT_Log FT_Message
+
+#endif /* FT_LOGGING */
+
 #ifdef FT_DEBUG_LEVEL_TRACE
 
   /* we need two macros here to make cpp expand `FT_COMPONENT' */
@@ -92,7 +124,7 @@ FT_BEGIN_HEADER
           do                                                               \
           {                                                                \
             if ( ft_trace_levels[FT_TRACE_COMP( FT_COMPONENT )] >= level ) \
-              FT_Message varformat;                                        \
+              FT_Log varformat;                                            \
           } while ( 0 )
 
 #else /* !FT_DEBUG_LEVEL_TRACE */
diff --git a/src/dlg b/src/dlg
new file mode 160000
index 0000000..407e385
--- /dev/null
+++ b/src/dlg
@@ -0,0 +1 @@
+Subproject commit 407e385d2e40e11a1f1643cdf698fd09d62561ca



reply via email to

[Prev in Thread] Current Thread [Next in Thread]