m4-commit
[Top][All Lists]
Advanced

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

Changes to m4/m4/macro.c,v


From: Eric Blake
Subject: Changes to m4/m4/macro.c,v
Date: Wed, 09 Aug 2006 21:33:26 +0000

CVSROOT:        /sources/m4
Module name:    m4
Changes by:     Eric Blake <ericb>      06/08/09 21:33:24

Index: m4/macro.c
===================================================================
RCS file: /sources/m4/m4/m4/macro.c,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -b -r1.46 -r1.47
--- m4/macro.c  28 Jul 2006 14:06:11 -0000      1.46
+++ m4/macro.c  9 Aug 2006 21:33:24 -0000       1.47
@@ -119,8 +119,7 @@
       break;
 
     default:
-      M4ERROR ((m4_get_warning_status_opt (context), 0,
-               "INTERNAL ERROR: Bad token type in expand_token ()"));
+      assert (!"INTERNAL ERROR: bad token type in expand_token ()");
       abort ();
     }
 
@@ -142,8 +141,8 @@
   m4_symbol_value token;
   char *text;
   int paren_level = 0;
-  const char *current_file = m4_current_file;
-  int current_line = m4_current_line;
+  const char *current_file = m4_get_current_file (context);
+  int current_line = m4_get_current_line (context);
 
   argp->type = M4_SYMBOL_VOID;
 
@@ -200,8 +199,7 @@
          break;
 
        default:
-         M4ERROR ((m4_get_warning_status_opt (context), 0,
-                   "INTERNAL ERROR: Bad token type in expand_argument ()"));
+         assert (!"INTERNAL ERROR: bad token type in expand_argument ()");
          abort ();
        }
 
@@ -231,9 +229,9 @@
 
   expansion_level++;
   if (expansion_level > m4_get_nesting_limit_opt (context))
-    M4ERROR ((EXIT_FAILURE, 0, _("\
-ERROR: Recursion limit of %d exceeded, use -L<N> to change it"),
-             m4_get_nesting_limit_opt (context)));
+    m4_error (context, EXIT_FAILURE, 0, _("\
+recursion limit of %d exceeded, use -L<N> to change it"),
+             m4_get_nesting_limit_opt (context));
 
   macro_call_id++;
   my_call_id = macro_call_id;
@@ -331,14 +329,13 @@
     }
   else if (m4_is_symbol_placeholder (symbol))
     {
-      M4WARN ((m4_get_warning_status_opt (context), 0, _("\
+      m4_warn (context, 0, _("\
 Warning: %s: builtin `%s' requested by frozen file not found"),
-              M4ARG (0), m4_get_symbol_placeholder (symbol)));
+              M4ARG (0), m4_get_symbol_placeholder (symbol));
     }
   else
     {
-      M4ERROR ((m4_get_warning_status_opt (context), 0,
-               "INTERNAL ERROR: Bad symbol type in call_macro ()"));
+      assert (!"INTERNAL ERROR: bad symbol type in call_macro ()");
       abort ();
     }
 }
@@ -407,8 +404,14 @@
              const char * endp;
              const char * key;
 
-             for (endp = ++text; *endp && m4_has_syntax (M4SYNTAX, *endp, 
M4_SYNTAX_OTHER|M4_SYNTAX_ALPHA|M4_SYNTAX_NUM); ++endp)
+             for (endp = ++text;
+                  *endp && m4_has_syntax (M4SYNTAX, *endp,
+                                          (M4_SYNTAX_OTHER | M4_SYNTAX_ALPHA
+                                           | M4_SYNTAX_NUM));
+                  ++endp)
+               {
                ++len;
+               }
              key = xstrndup (text, len);
 
              if (*endp)
@@ -424,19 +427,20 @@
                      if (i < argc)
                        m4_shipout_string (context, obs, M4ARG (i), 0, false);
                      else
-                       M4ERROR ((EXIT_FAILURE, 0, "\
-INTERNAL ERROR: %s: out of range reference `%d' from argument %s",
-                             M4ARG (0), i, key));
+                       {
+                         assert (!"INTERNAL ERROR: out of range reference");
+                         abort ();
+                       }
                    }
                }
              else
                {
-                 M4ERROR ((m4_get_warning_status_opt (context), 0,
-                         _("Error: %s: unterminated parameter reference: %s"),
-                           M4ARG (0), key));
+                 m4_error (context, 0, 0,
+                           _("%s: unterminated parameter reference: %s"),
+                           M4ARG (0), key);
                }
 
-             text = *endp ? 1+ endp : endp;
+             text = *endp ? 1 + endp : endp;
 
              free ((char *) key);
              break;
@@ -531,10 +535,13 @@
 trace_header (m4 *context, int id)
 {
   trace_format (context, "m4trace:");
+  if (m4_get_current_line (context))
+    {
   if (m4_is_debug_bit (context, M4_DEBUG_TRACE_FILE))
-    trace_format (context, "%s:", m4_current_file);
+       trace_format (context, "%s:", m4_get_current_file (context));
   if (m4_is_debug_bit (context, M4_DEBUG_TRACE_LINE))
-    trace_format (context, "%d:", m4_current_line);
+       trace_format (context, "%d:", m4_get_current_line (context));
+    }
   trace_format (context, " -%d- ", expansion_level);
   if (m4_is_debug_bit (context, M4_DEBUG_TRACE_CALLID))
     trace_format (context, "id %d: ", id);
@@ -594,8 +601,7 @@
                                            m4_get_symbol_value_func(argv[i]));
              if (bp == NULL)
                {
-                 M4ERROR ((m4_get_warning_status_opt (context), 0, "\
-INTERNAL ERROR: Builtin not found in builtin table! (trace_pre ())"));
+                 assert (!"INTERNAL ERROR: builtin not found in table!");
                  abort ();
                }
              trace_format (context, "<%s>", bp->name);
@@ -607,8 +613,7 @@
            }
          else
            {
-             M4ERROR ((m4_get_warning_status_opt (context), 0,
-                       "INTERNAL ERROR: Bad token data type (trace_pre ())"));
+             assert (!"INTERNAL ERROR: bad token data type (trace_pre ())");
              abort ();
            }
        }




reply via email to

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