m4-commit
[Top][All Lists]
Advanced

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

Changes to m4/m4/debug.c,v


From: Eric Blake
Subject: Changes to m4/m4/debug.c,v
Date: Tue, 05 Sep 2006 23:16:41 +0000

CVSROOT:        /sources/m4
Module name:    m4
Changes by:     Eric Blake <ericb>      06/09/05 23:16:40

Index: m4/debug.c
===================================================================
RCS file: /sources/m4/m4/m4/debug.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -b -r1.23 -r1.24
--- m4/debug.c  23 Aug 2006 11:39:26 -0000      1.23
+++ m4/debug.c  5 Sep 2006 23:16:39 -0000       1.24
@@ -19,6 +19,7 @@
 
 #include <stdio.h>
 #include <sys/stat.h>
+#include <stdarg.h>
 
 #include "m4private.h"
 
@@ -84,6 +85,10 @@
              level |= M4_DEBUG_TRACE_CALLID;
              break;
 
+           case 'm':
+             level |= M4_DEBUG_TRACE_MODULE;
+             break;
+
            case 'V':
              level |= M4_DEBUG_TRACE_VERBOSE;
              break;
@@ -204,3 +209,26 @@
     }
   putc (' ', debug_file);
 }
+
+/* If the current debug mode includes MODE, and there is a current
+   debug file, then output a debug message described by FORMAT.  A
+   message header is supplied, as well as a trailing newline.  */
+void
+m4_debug_message (m4 *context, int mode, const char *format, ...)
+{
+  /* Check that mode has exactly one bit set.  */
+  assert ((mode & (mode - 1)) == 0);
+  assert (format);
+
+  if (m4_get_debug_file (context) != NULL
+      && m4_is_debug_bit (context, mode))
+    {
+      va_list args;
+
+      m4_debug_message_prefix (context);
+      va_start (args, format);
+      vfprintf (m4_get_debug_file (context), format, args);
+      va_end (args);
+      putc ('\n', m4_get_debug_file (context));
+    }
+}




reply via email to

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