summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorEric Blake <ebb9@byu.net>2008-02-11 07:14:20 -0700
committerEric Blake <ebb9@byu.net>2008-02-11 13:33:08 -0700
commit4af40c4d6f65e3d311ef4643b6b3bdb9729a9db6 (patch)
treedf8c65019d968f7175a1d837819cc8beb74c8f7a /modules
parent7a7a1413755c74b416295b13fe90eef3bffa7345 (diff)
downloadm4-4af40c4d6f65e3d311ef4643b6b3bdb9729a9db6.tar.gz
Allow builtin text macros to specify number of arguments.
* m4/m4module.h (struct m4_macro): Add argument limits to builtin text macros. * m4/module.c (install_macro_table): Allow text macros to warn on extra arguments. * modules/gnu.c (m4_macro_table): Update all clients. * modules/load.c (m4_macro_table): Likewise. * modules/mpeval.c (m4_macro_table): Likewise. * modules/perl.c (m4_macro_table): Likewise. * modules/shadow.c (m4_macro_table): Likewise. * modules/traditional.c (m4_macro_table): Likewise. * modules/modtest.c (m4_macro_table): Likewise. Also add text macros, for testing this. * doc/m4.texinfo (Standard Modules): Update text, and enhance test. * tests/modules.at (modules: text): New test. Signed-off-by: Eric Blake <ebb9@byu.net>
Diffstat (limited to 'modules')
-rw-r--r--modules/gnu.c14
-rw-r--r--modules/load.c9
-rw-r--r--modules/modtest.c12
-rw-r--r--modules/mpeval.c9
-rw-r--r--modules/perl.c6
-rw-r--r--modules/shadow.c9
-rw-r--r--modules/traditional.c14
7 files changed, 39 insertions, 34 deletions
diff --git a/modules/gnu.c b/modules/gnu.c
index 1f6bf299..10fb0acb 100644
--- a/modules/gnu.c
+++ b/modules/gnu.c
@@ -85,20 +85,20 @@ m4_builtin m4_builtin_table[] =
/* A table for mapping m4 symbol names to simple expansion text. */
m4_macro m4_macro_table[] =
{
- /* name text */
+ /* name text min max */
#if UNIX
- { "__unix__", "" },
+ { "__unix__", "", 0, 0 },
#elif W32_NATIVE
- { "__windows__", "" },
+ { "__windows__", "", 0, 0 },
#elif OS2
- { "__os2__", "" },
+ { "__os2__", "", 0, 0 },
#else
# warning Platform macro not provided
#endif
- { "__gnu__", "" },
- { "__m4_version__", VERSION/**/TIMESTAMP },
+ { "__gnu__", "", 0, 0 },
+ { "__m4_version__", VERSION/**/TIMESTAMP, 0, 0 },
- { NULL, NULL },
+ { NULL, NULL, 0, 0 },
};
diff --git a/modules/load.c b/modules/load.c
index 4ee1cc62..5ea72424 100644
--- a/modules/load.c
+++ b/modules/load.c
@@ -1,5 +1,6 @@
/* GNU m4 -- A simple macro processor
- Copyright (C) 2000, 2005, 2006, 2007 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2005, 2006, 2007, 2008 Free Software
+ Foundation, Inc.
This file is part of GNU M4.
@@ -65,9 +66,9 @@ m4_builtin m4_builtin_table[] =
/* A table for mapping m4 symbol names to simple expansion text. */
m4_macro m4_macro_table[] =
{
- /* name text */
- { "__load__", "" },
- { NULL, NULL },
+ /* name text min max */
+ { "__load__", "", 0, 0 },
+ { NULL, NULL, 0, 0 },
};
diff --git a/modules/modtest.c b/modules/modtest.c
index 022a2efa..f2d39eac 100644
--- a/modules/modtest.c
+++ b/modules/modtest.c
@@ -1,6 +1,6 @@
/* GNU m4 -- A simple macro processor
- Copyright (C) 1999, 2000, 2001, 2003, 2004, 2006, 2007 Free Software
- Foundation, Inc.
+ Copyright (C) 1999, 2000, 2001, 2003, 2004, 2006, 2007, 2008 Free
+ Software Foundation, Inc.
This file is part of GNU M4.
@@ -61,9 +61,11 @@ m4_builtin m4_builtin_table[] =
m4_macro m4_macro_table[] =
{
- /* name text */
- { "__test__", "`modtest'" },
- { NULL, NULL },
+ /* name text min max */
+ { "__test__", "`modtest'", 0, 0 },
+ { "onearg", "$1", 1, 1 },
+ { "manyargs", "$@", 0, SIZE_MAX },
+ { NULL, NULL, 0, 0 },
};
diff --git a/modules/mpeval.c b/modules/mpeval.c
index e70eb091..ab9a040f 100644
--- a/modules/mpeval.c
+++ b/modules/mpeval.c
@@ -1,5 +1,6 @@
/* GNU m4 -- A simple macro processor
- Copyright (C) 2000, 2001, 2006, 2007 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2001, 2006, 2007, 2008 Free Software
+ Foundation, Inc.
This file is part of GNU M4.
@@ -123,9 +124,9 @@ m4_builtin m4_builtin_table[] =
/* A table for mapping m4 symbol names to simple expansion text. */
m4_macro m4_macro_table[] =
{
- /* name text */
- { "__mpeval__", "" },
- { NULL, NULL },
+ /* name text min max */
+ { "__mpeval__", "", 0, 0 },
+ { NULL, NULL, 0, 0 },
};
diff --git a/modules/perl.c b/modules/perl.c
index 46cf2cde..61db8032 100644
--- a/modules/perl.c
+++ b/modules/perl.c
@@ -64,9 +64,9 @@ m4_builtin m4_builtin_table[] =
/* A table for mapping m4 symbol names to simple expansion text. */
m4_macro m4_macro_table[] =
{
- /* name text */
- { "__perleval__", "" },
- { NULL, NULL },
+ /* name text min max */
+ { "__perleval__", "", 0, 0 },
+ { NULL, NULL, 0, 0 },
};
diff --git a/modules/shadow.c b/modules/shadow.c
index 3698b4f0..1a15798f 100644
--- a/modules/shadow.c
+++ b/modules/shadow.c
@@ -1,5 +1,6 @@
/* GNU m4 -- A simple macro processor
- Copyright (C) 1999, 2000, 2006, 2007 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2006, 2007, 2008 Free Software
+ Foundation, Inc.
This file is part of GNU M4.
@@ -58,9 +59,9 @@ m4_builtin m4_builtin_table[] =
m4_macro m4_macro_table[] =
{
- /* name text */
- { "__test__", "`shadow'" },
- { NULL, NULL },
+ /* name text min max */
+ { "__test__", "`shadow'", 0, 0 },
+ { NULL, NULL, 0, 0 },
};
diff --git a/modules/traditional.c b/modules/traditional.c
index 9fc2e818..13a112d2 100644
--- a/modules/traditional.c
+++ b/modules/traditional.c
@@ -1,5 +1,5 @@
/* GNU m4 -- A simple macro processor
- Copyright (C) 2000, 2006, 2007 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2006, 2007, 2008 Free Software Foundation, Inc.
This file is part of GNU M4.
@@ -33,16 +33,16 @@
/* A table for mapping m4 symbol names to simple expansion text. */
m4_macro m4_macro_table[] =
{
- /* name text */
+ /* name text min max */
#if UNIX
- { "unix", "" },
+ { "unix", "", 0, 0 },
#elif W32_NATIVE
- { "windows", "" },
+ { "windows", "", 0, 0 },
#elif OS2
- { "os2", "" },
+ { "os2", "", 0, 0 },
#else
# warning Platform macro not provided
#endif
- { "__traditional__", "" },
- { NULL, NULL },
+ { "__traditional__", "", 0, 0 },
+ { NULL, NULL, 0, 0 },
};