m4-commit
[Top][All Lists]
Advanced

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

Changes to m4/modules/gnu.c,v


From: Eric Blake
Subject: Changes to m4/modules/gnu.c,v
Date: Mon, 21 Aug 2006 02:37:46 +0000

CVSROOT:        /sources/m4
Module name:    m4
Changes by:     Eric Blake <ericb>      06/08/21 02:37:45

Index: modules/gnu.c
===================================================================
RCS file: /sources/m4/m4/modules/gnu.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -b -r1.47 -r1.48
--- modules/gnu.c       21 Aug 2006 00:14:54 -0000      1.47
+++ modules/gnu.c       21 Aug 2006 02:37:45 -0000      1.48
@@ -33,6 +33,8 @@
 #  include "m4private.h"
 #endif
 
+#include "progname.h"
+
 /* Rename exported symbols for dlpreload()ing.  */
 #define m4_builtin_table       gnu_LTX_m4_builtin_table
 #define m4_macro_table         gnu_LTX_m4_macro_table
@@ -45,6 +47,7 @@
 #define builtin_functions                                      \
        BUILTIN(__file__,       false,  false,  1,      1  )    \
        BUILTIN(__line__,       false,  false,  1,      1  )    \
+       BUILTIN(__program__,    false,  false,  1,      1  )    \
        BUILTIN(builtin,        false,  true,   2,      -1 )    \
        BUILTIN(changeresyntax, false,  true,   1,      2  )    \
        BUILTIN(changesyntax,   false,  true,   1,      -1 )    \
@@ -289,6 +292,15 @@
 }
 
 
+/**
+ * __program__
+ **/
+M4BUILTIN_HANDLER (__program__)
+{
+  m4_shipout_string (context, obs, program_name, 0, true);
+}
+
+
 /* The builtin "builtin" allows calls to builtin macros, even if their
    definition has been overridden or shadowed.  It is thus possible to
    redefine builtins, and still access their original definition.  */
@@ -304,9 +316,10 @@
   bp = m4_builtin_find_by_name (NULL, name);
 
   if (bp == NULL)
-    m4_error (context, 0, 0, _("%s: undefined name `%s'"), M4ARG (0), name);
-  else
-    (*bp->func) (context, obs, argc - 1, argv + 1);
+    m4_error (context, 0, 0, _("%s: undefined builtin `%s'"), M4ARG (0), name);
+  else if (!m4_bad_argc (context, argc - 1, argv + 1,
+                        bp->min_args, bp->max_args))
+    bp->func (context, obs, argc - 1, argv + 1);
 }
 
 
@@ -356,9 +369,9 @@
       for (i = 1; i < argc; i++)
        {
          char key = *M4ARG (i);
-         if ((m4_set_syntax (M4SYNTAX, key,
-                             m4_expand_ranges (M4ARG (i)+1, obs)) < 0)
-             && (key != '\0'))
+         if (key != '\0'
+             && (m4_set_syntax (M4SYNTAX, key,
+                                m4_expand_ranges (M4ARG (i) + 1, obs)) < 0))
            {
              m4_error (context, 0, 0, _("%s: undefined syntax code: `%c'"),
                        M4ARG (0), key);
@@ -504,7 +517,7 @@
   m4_symbol *  symbol = m4_symbol_lookup (M4SYMTAB, name);
 
   if (symbol == NULL)
-    m4_error (context, 0, 0, _("%s: undefined name `%s'"), M4ARG (0), name);
+    m4_error (context, 0, 0, _("%s: undefined macro `%s'"), M4ARG (0), name);
   else
     m4_macro_call (context, symbol, obs, argc - 1, argv + 1);
 }




reply via email to

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