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: Wed, 23 Aug 2006 11:39:28 +0000

CVSROOT:        /sources/m4
Module name:    m4
Changes by:     Eric Blake <ericb>      06/08/23 11:39:26

Index: m4/debug.c
===================================================================
RCS file: /sources/m4/m4/m4/debug.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -b -r1.22 -r1.23
--- m4/debug.c  22 Aug 2006 22:36:28 -0000      1.22
+++ m4/debug.c  23 Aug 2006 11:39:26 -0000      1.23
@@ -29,14 +29,17 @@
 /* Function to decode the debugging flags OPTS.  Used by main while
    processing option -d, and by the builtin debugmode ().  */
 int
-m4_debug_decode (m4 *context, const char *opts)
+m4_debug_decode (m4 *context, int previous, const char *opts)
 {
   int level;
+  char mode = '\0';
 
   if (opts == NULL || *opts == '\0')
     level = M4_DEBUG_TRACE_DEFAULT;
   else
     {
+      if (*opts == '-' || *opts == '+')
+       mode = *opts++;
       for (level = 0; *opts; opts++)
        {
          switch (*opts)
@@ -97,6 +100,26 @@
   obstack_free (&context->trace_messages,
                obstack_finish (&context->trace_messages));
 
+  switch (mode)
+    {
+    case '\0':
+      /* Replace old level.  */
+      break;
+
+    case '-':
+      /* Subtract flags.  */
+      level = previous & ~level;
+      break;
+
+    case '+':
+      /* Add flags.  */
+      level |= previous;
+      break;
+
+    default:
+      assert (!"INTERNAL ERROR: impossible mode from flags");
+    }
+
   return level;
 }
 
@@ -179,4 +202,5 @@
       if (m4_is_debug_bit (context, M4_DEBUG_TRACE_LINE))
        fprintf (debug_file, "%d:", m4_get_current_line (context));
     }
+  putc (' ', debug_file);
 }




reply via email to

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