summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Blake <ebb9@byu.net>2009-12-14 13:52:15 -0700
committerEric Blake <ebb9@byu.net>2010-01-05 22:03:49 -0700
commitcdff6b56f2f9e848722f93e45803be19609641b5 (patch)
tree5db3706f72910fbd1ef87ff031a6e08f92c9f533
parent1270f0e114d5b7f442362a4952f185920886045e (diff)
downloadm4-cdff6b56f2f9e848722f93e45803be19609641b5.tar.gz
Switch to indentation by space, not tab.
Now that gnulib has converted and git has better support for ignoring whitespace differences across this commit, we might as well be consistent with other GNU projects. Done with: t=$'\t' git ls-files \ | grep -vE '(^|/)(.*akefile|ChangeLog|HACKING|.*-aux/.*)|\.(am|mk)$' \ | xargs grep -lE "^ *$t" \ | xargs perl -MText::Tabs -ni -le \ '$m=/^( *\t[ \t]*)(.*)/; print $m ? expand($1) . $2 : $_' followed by tweaks to pass 'make check' again. * .gitmodules: Convert leading tabs to spaces. * TODO: Likewise. * bootstrap: Likewise. * configure.ac: Likewise. * examples/WWW/m4lib/html.m4: Likewise. * examples/WWW/m4lib/layout.m4: Likewise. * examples/WWW/m4lib/menu.m4: Likewise. * ltdl/m4/debug.m4: Likewise. * ltdl/m4/gmp.m4: Likewise. * ltdl/m4/m4-obstack.m4: Likewise. * ltdl/m4/stackovf.m4: Likewise. * m4/builtin.c: Likewise. * m4/debug.c: Likewise. * m4/hash.c: Likewise. * m4/hash.h: Likewise. * m4/input.c: Likewise. * m4/m4.c: Likewise. * m4/m4module.h: Likewise. * m4/m4private.h: Likewise. * m4/macro.c: Likewise. * m4/module.c: Likewise. * m4/output.c: Likewise. * m4/path.c: Likewise. * m4/resyntax.c: Likewise. * m4/symtab.c: Likewise. * m4/syntax.c: Likewise. * m4/utility.c: Likewise. * modules/evalparse.c: Likewise. * modules/format.c: Likewise. * modules/gnu.c: Likewise. * modules/load.c: Likewise. * modules/m4.c: Likewise. * modules/m4.h: Likewise. * modules/mpeval.c: Likewise. * modules/perl.c: Likewise. * modules/stdlib.c: Likewise. * modules/time.c: Likewise. * src/freeze.c: Likewise. * src/m4.h: Likewise. * src/main.c: Likewise. * src/stackovf.c: Likewise. * tests/builtins.at: Likewise. * tests/freeze.at: Likewise. * tests/generate.awk: Likewise. * tests/modules.at: Likewise. * tests/others.at: Likewise. * tests/stackovf.test: Likewise. * tests/testsuite.at: Likewise. Signed-off-by: Eric Blake <ebb9@byu.net> (cherry picked from commit 180b7d19bf95d2abb21bca587a0684eca69679ad)
-rw-r--r--.gitmodules4
-rw-r--r--ChangeLog50
-rw-r--r--TODO8
-rwxr-xr-xbootstrap46
-rw-r--r--configure.ac36
-rw-r--r--examples/WWW/m4lib/html.m416
-rw-r--r--examples/WWW/m4lib/layout.m448
-rw-r--r--examples/WWW/m4lib/menu.m450
-rw-r--r--ltdl/m4/debug.m440
-rw-r--r--ltdl/m4/gmp.m42
-rw-r--r--ltdl/m4/m4-obstack.m42
-rw-r--r--ltdl/m4/stackovf.m46
-rw-r--r--m4/builtin.c38
-rw-r--r--m4/debug.c174
-rw-r--r--m4/hash.c90
-rw-r--r--m4/hash.h14
-rw-r--r--m4/input.c1366
-rw-r--r--m4/m4.c74
-rw-r--r--m4/m4module.h138
-rw-r--r--m4/m4private.h64
-rw-r--r--m4/macro.c1228
-rw-r--r--m4/module.c282
-rw-r--r--m4/output.c562
-rw-r--r--m4/path.c62
-rw-r--r--m4/resyntax.c8
-rw-r--r--m4/symtab.c360
-rw-r--r--m4/syntax.c476
-rw-r--r--m4/utility.c68
-rw-r--r--modules/evalparse.c500
-rw-r--r--modules/format.c372
-rw-r--r--modules/gnu.c564
-rw-r--r--modules/load.c12
-rw-r--r--modules/m4.c406
-rw-r--r--modules/m4.h10
-rw-r--r--modules/mpeval.c14
-rw-r--r--modules/perl.c2
-rw-r--r--modules/stdlib.c8
-rw-r--r--modules/time.c10
-rw-r--r--src/freeze.c1026
-rw-r--r--src/m4.h2
-rw-r--r--src/main.c664
-rw-r--r--src/stackovf.c130
-rw-r--r--tests/builtins.at2
-rw-r--r--tests/freeze.at6
-rwxr-xr-xtests/generate.awk38
-rw-r--r--tests/modules.at26
-rw-r--r--tests/others.at2
-rwxr-xr-xtests/stackovf.test48
-rw-r--r--tests/testsuite.at10
49 files changed, 4607 insertions, 4557 deletions
diff --git a/.gitmodules b/.gitmodules
index acb26693..bb9e1baf 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,3 +1,3 @@
[submodule "gnulib"]
- path = gnulib
- url = git://git.sv.gnu.org/gnulib.git
+ path = gnulib
+ url = git://git.sv.gnu.org/gnulib.git
diff --git a/ChangeLog b/ChangeLog
index 768f6de3..f9fc18e8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,55 @@
2010-01-05 Eric Blake <ebb9@byu.net>
+ Switch to indentation by space, not tab.
+ * .gitmodules: Convert leading tabs to spaces.
+ * TODO: Likewise.
+ * bootstrap: Likewise.
+ * configure.ac: Likewise.
+ * examples/WWW/m4lib/html.m4: Likewise.
+ * examples/WWW/m4lib/layout.m4: Likewise.
+ * examples/WWW/m4lib/menu.m4: Likewise.
+ * ltdl/m4/debug.m4: Likewise.
+ * ltdl/m4/gmp.m4: Likewise.
+ * ltdl/m4/m4-obstack.m4: Likewise.
+ * ltdl/m4/stackovf.m4: Likewise.
+ * m4/builtin.c: Likewise.
+ * m4/debug.c: Likewise.
+ * m4/hash.c: Likewise.
+ * m4/hash.h: Likewise.
+ * m4/input.c: Likewise.
+ * m4/m4.c: Likewise.
+ * m4/m4module.h: Likewise.
+ * m4/m4private.h: Likewise.
+ * m4/macro.c: Likewise.
+ * m4/module.c: Likewise.
+ * m4/output.c: Likewise.
+ * m4/path.c: Likewise.
+ * m4/resyntax.c: Likewise.
+ * m4/symtab.c: Likewise.
+ * m4/syntax.c: Likewise.
+ * m4/utility.c: Likewise.
+ * modules/evalparse.c: Likewise.
+ * modules/format.c: Likewise.
+ * modules/gnu.c: Likewise.
+ * modules/load.c: Likewise.
+ * modules/m4.c: Likewise.
+ * modules/m4.h: Likewise.
+ * modules/mpeval.c: Likewise.
+ * modules/perl.c: Likewise.
+ * modules/stdlib.c: Likewise.
+ * modules/time.c: Likewise.
+ * src/freeze.c: Likewise.
+ * src/m4.h: Likewise.
+ * src/main.c: Likewise.
+ * src/stackovf.c: Likewise.
+ * tests/builtins.at: Likewise.
+ * tests/freeze.at: Likewise.
+ * tests/generate.awk: Likewise.
+ * tests/modules.at: Likewise.
+ * tests/others.at: Likewise.
+ * tests/stackovf.test: Likewise.
+ * tests/testsuite.at: Likewise.
+
Update copyright year.
All files impacted, via 'make update-copyright'. Additionally:
* .gitignore: Ignore backup files.
diff --git a/TODO b/TODO
index 1a53c199..04b6b96d 100644
--- a/TODO
+++ b/TODO
@@ -82,9 +82,9 @@ for any of these ideas or if you have others to add.
* OPTIMIZATION AND CLEAN UP
+ Have NULs go really undisturbed through GNU m4
- GNU m4 is lousy regarding NULs in streams (this would require
- maintaining the string lengths, and avoiding strlen, strcpy,
- etc.). (Almost there, once argv_ref is ported).
+ GNU m4 is lousy regarding NULs in streams (this would require
+ maintaining the string lengths, and avoiding strlen, strcpy,
+ etc.). (Almost there, once argv_ref is ported).
+ The argument count limits are handled for all tokens passed around by
the internals: we should enable attaching these values to text macros
@@ -116,7 +116,7 @@ for any of these ideas or if you have others to add.
+ Setting of the module search path within m4 scripts:
- append(__modulepath__, `/some/modules/live/here')
+ append(__modulepath__, `/some/modules/live/here')
+ Module autoloader. This would allow an m4 core with no builtins except
for loadmodule(). A default startup script would mark the recognised
diff --git a/bootstrap b/bootstrap
index f0071109..74273c05 100755
--- a/bootstrap
+++ b/bootstrap
@@ -155,9 +155,9 @@ func_missing_arg ()
func_usage ()
{
$SED '/^# Usage:/,/# -h/ {
- s/^# //; s/^# *$//;
- s/\$progname/'$progname'/;
- p;
+ s/^# //; s/^# *$//;
+ s/\$progname/'$progname'/;
+ p;
}; d' < "$progpath"
echo
echo "run \`$progname --help | more' for full usage"
@@ -169,9 +169,9 @@ func_usage ()
func_help ()
{
$SED '/^# Usage:/,/# Report bugs to/ {
- s/^# //; s/^# *$//;
- s/\$progname/'$progname'/;
- p;
+ s/^# //; s/^# *$//;
+ s/\$progname/'$progname'/;
+ p;
}; d' < "$progpath"
exit $EXIT_SUCCESS
}
@@ -181,9 +181,9 @@ func_help ()
func_version ()
{
$SED '/^# '$PROGRAM' (GNU /,/# Written by / {
- s/^# //;
- s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/;
- p;
+ s/^# //;
+ s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/;
+ p;
}; d' < "$progpath"
exit $EXIT_SUCCESS
}
@@ -286,8 +286,8 @@ func_update_po ()
new_po="$ref_po_dir/$po.po"
cksum_file="$ref_po_dir/$po.s1"
if ! test -f "$cksum_file" ||
- ! test -f "$po_dir/$po.po" ||
- ! sha1sum -c --status "$cksum_file" < "$new_po" > /dev/null; then
+ ! test -f "$po_dir/$po.po" ||
+ ! sha1sum -c --status "$cksum_file" < "$new_po" > /dev/null; then
echo "updated $po_dir/$po.po..."
cp "$new_po" "$po_dir/$po.po" && sha1sum < "$new_po" > "$cksum_file"
fi
@@ -339,11 +339,11 @@ if test -d .git && (git --version) >/dev/null 2>/dev/null ; then
if test -d "$GNULIB_SRCDIR" ; then
rmdir gnulib 2>/dev/null
git clone --reference "$GNULIB_SRCDIR" git://git.sv.gnu.org/gnulib.git \
- && git submodule init && git submodule update \
- || func_fatal_error "Unable to update gnulib"
+ && git submodule init && git submodule update \
+ || func_fatal_error "Unable to update gnulib"
else
git submodule update --init \
- || func_fatal_error "Unable to update gnulib"
+ || func_fatal_error "Unable to update gnulib"
fi
fi
else
@@ -392,20 +392,20 @@ do
dest=`echo $file | $SED "$basename"`
case $file in
- lib/*) dest=src/$dest ;;
- m4/*) dest=$config_macro_dir/$dest ;;
- *) func_echo "Unknown file: $file"
- exit 1
- ;;
+ lib/*) dest=src/$dest ;;
+ m4/*) dest=$config_macro_dir/$dest ;;
+ *) func_echo "Unknown file: $file"
+ exit 1
+ ;;
esac
# Be sure to show all copying errors before bailing out
if test -f gnulib/$file; then
- func_echo "copying file \`$dest'"
- cp gnulib/$file $dest
+ func_echo "copying file \`$dest'"
+ cp gnulib/$file $dest
else
- func_error "gnulib/$file does not exist"
- bailout_cb="exit 1"
+ func_error "gnulib/$file does not exist"
+ bailout_cb="exit 1"
fi
done
$bailout_cb
diff --git a/configure.ac b/configure.ac
index afd85d8a..df885eac 100644
--- a/configure.ac
+++ b/configure.ac
@@ -24,9 +24,9 @@ AC_PREREQ([2.62])
## Autoconf initialization. ##
## ------------------------ ##
m4_define([M4_VERSION],
- m4_esyscmd([build-aux/git-version-gen .tarball-version]))
+ m4_esyscmd([build-aux/git-version-gen .tarball-version]))
m4_bmatch(m4_defn([M4_VERSION]), [^[0-9]], [],
- [m4_define([M4_VERSION], [1.9a])])
+ [m4_define([M4_VERSION], [1.9a])])
AC_INIT([GNU M4], m4_defn([M4_VERSION]), [bug-m4@gnu.org])
AC_CONFIG_SRCDIR([src/m4.h])
@@ -86,7 +86,7 @@ if test "x$with_included_ltdl" != "xyes"; then
CFLAGS="$CFLAGS $LTDLINCL"
LDFLAGS="$LDFLAGS $LIBLTDL"
AC_CHECK_LIB([ltdl], [lt_dlhandle_iterate],
- [],
+ [],
[AC_MSG_ERROR([installed libltdl is too old])])
LDFLAGS="$save_LDFLAGS"
CFLAGS="$save_CFLAGS"
@@ -96,11 +96,11 @@ fi
# Use gcc's -pipe option if available: for faster compilation.
case "$CFLAGS" in
*-pipe* ) ;;
- * ) _LT_COMPILER_OPTION([if $compiler supports -pipe],
- [M4_cv_prog_compiler_pipe],
- [-pipe -c conftest.$ac_ext], [],
- [CFLAGS="$CFLAGS -pipe"])
- ;;
+ * ) _LT_COMPILER_OPTION([if $compiler supports -pipe],
+ [M4_cv_prog_compiler_pipe],
+ [-pipe -c conftest.$ac_ext], [],
+ [CFLAGS="$CFLAGS -pipe"])
+ ;;
esac
## ------------------------------- ##
@@ -115,7 +115,7 @@ AC_MSG_CHECKING([for modules to preload])
AC_ARG_WITH([modules],
[AS_HELP_STRING([--with-modules=MODULES],
- [preload MODULES @<:@default: ]M4_DEFAULT_PRELOAD[@:>@])],
+ [preload MODULES @<:@default: ]M4_DEFAULT_PRELOAD[@:>@])],
[use_modules="$withval"],
[use_modules="$M4_default_preload"])
@@ -126,15 +126,15 @@ AC_MSG_CHECKING([for modules to preload])
else
if test "$use_modules" != yes; then
for module in $use_modules; do
- case $module in
- no|none) break ;;
- m4|traditional|gnu|load|mpeval) dir=modules ;;
- import|modtest|shadow|stdlib|time) dir=tests ;;
- *) AC_MSG_ERROR([Unrecognized module `$module' in --with-modules])
- ;;
- esac
- DLPREOPEN="$DLPREOPEN -dlpreopen $dir/$module.la"
- PREOPEN_DEPENDENCIES="$PREOPEN_DEPENDENCIES $dir/$module.la"
+ case $module in
+ no|none) break ;;
+ m4|traditional|gnu|load|mpeval) dir=modules ;;
+ import|modtest|shadow|stdlib|time) dir=tests ;;
+ *) AC_MSG_ERROR([Unrecognized module `$module' in --with-modules])
+ ;;
+ esac
+ DLPREOPEN="$DLPREOPEN -dlpreopen $dir/$module.la"
+ PREOPEN_DEPENDENCIES="$PREOPEN_DEPENDENCIES $dir/$module.la"
done
fi
fi
diff --git a/examples/WWW/m4lib/html.m4 b/examples/WWW/m4lib/html.m4
index e2d35427..6e076bd6 100644
--- a/examples/WWW/m4lib/html.m4
+++ b/examples/WWW/m4lib/html.m4
@@ -2,26 +2,26 @@
])
\define([concat], [\ifelse($#, 0, ,
- $#, 1, [$1],
- [$1 \concat(\shift($@))])])
+ $#, 1, [$1],
+ [$1 \concat(\shift($@))])])
\define([toupper], [\translit([$*], [a-z], [A-Z])])
\define([container],
[\pushdef([_tag], \toupper([$1]))\dnl
\ifelse($#, 1, [<\_tag></[\_tag]>],
- $#, 2, [<\_tag>$2</\_tag>],
- $#, 3, [<\_tag $2>$3</\_tag>],
- [<\_tag $2>\concat(\shift(\shift($@)))</\_tag>])\dnl
+ $#, 2, [<\_tag>$2</\_tag>],
+ $#, 3, [<\_tag $2>$3</\_tag>],
+ [<\_tag $2>\concat(\shift(\shift($@)))</\_tag>])\dnl
\popdef([_tag])\dnl
])
\define([large_container],
[\pushdef([_tag], \toupper([$1]))\dnl
\ifelse($#, 1, [<\_tag></\_tag>\n],
- $#, 2, [<\_tag>\n[]$2\n</\_tag>\n],
- $#, 3, [<\_tag $2>\n[]$3\n</\_tag>\n],
- [<\_tag $2>\n\concat(\shift(\shift($@)))\n</\_tag>\n])\dnl
+ $#, 2, [<\_tag>\n[]$2\n</\_tag>\n],
+ $#, 3, [<\_tag $2>\n[]$3\n</\_tag>\n],
+ [<\_tag $2>\n\concat(\shift(\shift($@)))\n</\_tag>\n])\dnl
\popdef([_tag])\dnl
])
diff --git a/examples/WWW/m4lib/layout.m4 b/examples/WWW/m4lib/layout.m4
index ef6d6449..e54002db 100644
--- a/examples/WWW/m4lib/layout.m4
+++ b/examples/WWW/m4lib/layout.m4
@@ -10,35 +10,35 @@ The semicolons are just to get GNU Emacs C mode to indent properly.
\define([C_BG3], [bgcolor="#CC6600"]);
\define([DO_HEADER],
- [\head([\title([GNU m4 - \defn([_TITLE])])],
- [\meta_if_set([AUTHOR])],
- [\meta_if_set([GENERATOR])],
- [\meta_if_set([KEYWORDS])],
- )]);
+ [\head([\title([GNU m4 - \defn([_TITLE])])],
+ [\meta_if_set([AUTHOR])],
+ [\meta_if_set([GENERATOR])],
+ [\meta_if_set([KEYWORDS])],
+ )]);
\define([DO_BODY],
- [\body([\C_TEXT \C_BG1 \C_LINK \C_VLINK \C_ALINK],
- [\table([cellpadding=5 width="100%"],
- [\tr([align=left valign=bottom],
- [\td([align=center valign=middle colspan="3" width="100%" \C_BG2],
- [\h1([GNU m4])],
- [\h2(\defn([_TITLE]))],
- )],
- )],
- [\tr([],
- [\td([align=left valign=top width="15%" \C_BG2],
- [\include([menu.m4])],
- )],
- [\td([align=left valign=top width="90%"],
- [$*],
- )],
- )],
- )],
- )]
+ [\body([\C_TEXT \C_BG1 \C_LINK \C_VLINK \C_ALINK],
+ [\table([cellpadding=5 width="100%"],
+ [\tr([align=left valign=bottom],
+ [\td([align=center valign=middle colspan="3" width="100%" \C_BG2],
+ [\h1([GNU m4])],
+ [\h2(\defn([_TITLE]))],
+ )],
+ )],
+ [\tr([],
+ [\td([align=left valign=top width="15%" \C_BG2],
+ [\include([menu.m4])],
+ )],
+ [\td([align=left valign=top width="90%"],
+ [$*],
+ )],
+ )],
+ )],
+ )]
);
\define([DO_LAYOUT],
- [\doctype([html public "-//w3c//dtd html 4.0 transitional//en"])
+ [\doctype([html public "-//w3c//dtd html 4.0 transitional//en"])
\html([\DO_HEADER], [\DO_BODY([$*])])]
);
diff --git a/examples/WWW/m4lib/menu.m4 b/examples/WWW/m4lib/menu.m4
index 3be1b548..74315554 100644
--- a/examples/WWW/m4lib/menu.m4
+++ b/examples/WWW/m4lib/menu.m4
@@ -17,55 +17,55 @@
\table([],
[\header([General info])],
[\rows(
- [whatis.htm], [What is m4],
- [features.htm], [Features],
- [uses.htm], [Uses of m4],
- )],
+ [whatis.htm], [What is m4],
+ [features.htm], [Features],
+ [uses.htm], [Uses of m4],
+ )],
[\separator],
[\header([Documentation])],
[\rows(
- [man/m4_toc.html], [Manual],
- )],
+ [man/m4_toc.html], [Manual],
+ )],
[\separator],
[\header([Source files])],
[\rows(
- [readme.htm], [README],
- [todo.htm], [TODO],
- [news.htm], [NEWS],
- [changelog.htm], [ChangeLog],
- [thanks.htm], [Contributors],
- [m4/], [Browse it],
- )],
+ [readme.htm], [README],
+ [todo.htm], [TODO],
+ [news.htm], [NEWS],
+ [changelog.htm], [ChangeLog],
+ [thanks.htm], [Contributors],
+ [m4/], [Browse it],
+ )],
[\separator],
[\header([The Future])],
[\rows(
- [modules.htm], [Modules],
- [visions.htm], [Visions],
- )],
+ [modules.htm], [Modules],
+ [visions.htm], [Visions],
+ )],
[\separator],
[\header([Feedback])],
[\rows(
- [lists.htm], [Mailing-lists],
- [feedback.htm], [Feedback],
- [/forum/list.php3?num=2], [Discussion Forum],
- )],
+ [lists.htm], [Mailing-lists],
+ [feedback.htm], [Feedback],
+ [/forum/list.php3?num=2], [Discussion Forum],
+ )],
[\separator],
[\header([Development])],
[\rows(
- [download.htm], [Download],
- [bugs.htm], [Known bugs],
- )],
+ [download.htm], [Download],
+ [bugs.htm], [Known bugs],
+ )],
[\separator],
[\header([Examples])],
[\rows(
- [thissite.htm], [This site],
- )],
+ [thissite.htm], [This site],
+ )],
)
\popdef([header])
diff --git a/ltdl/m4/debug.m4 b/ltdl/m4/debug.m4
index 111e5982..0f388dc4 100644
--- a/ltdl/m4/debug.m4
+++ b/ltdl/m4/debug.m4
@@ -30,7 +30,7 @@
AC_DEFUN([M4_CHECK_DEBUGGING],
[AC_REQUIRE([AC_PROG_CC])
AC_ARG_ENABLE([debug], [AS_HELP_STRING([--enable-debug],
- [build for debugging [default=no]])])
+ [build for debugging [default=no]])])
AC_MSG_CHECKING([for compilation debug mode])
AC_MSG_RESULT([${enable_debug-no}])
@@ -52,43 +52,43 @@ import modtest mpeval shadow stdlib time"
*-O* ) CFLAGS=`echo $CFLAGS | $SED 's/-O[[^ ]]* / /;s/-O[[^ ]]*$//'` ;;
esac
case "$CFLAGS" in
- *-g* ) ;;
- * ) AC_LIBTOOL_COMPILER_OPTION([if $compiler accepts -ggdb3],
- [M4_cv_prog_compiler_ggdb3],
- [-ggdb3 -c conftest.$ac_ext], [],
- [CFLAGS="$CFLAGS -ggdb3"],
- [CFLAGS="$CFLAGS -g"])
- ;;
+ *-g* ) ;;
+ * ) AC_LIBTOOL_COMPILER_OPTION([if $compiler accepts -ggdb3],
+ [M4_cv_prog_compiler_ggdb3],
+ [-ggdb3 -c conftest.$ac_ext], [],
+ [CFLAGS="$CFLAGS -ggdb3"],
+ [CFLAGS="$CFLAGS -g"])
+ ;;
esac
CFLAGS="$CFLAGS -Wall"
WMORE="-Wshadow -Wpointer-arith -Wcast-align -Wnested-externs"
WMORE="$WMORE -Wmissing-prototypes -Wmissing-declarations -Winline"
AC_LIBTOOL_COMPILER_OPTION([if $compiler accepts $WMORE],
- [M4_cv_prog_compiler_warning_flags],
- [$WMORE -c conftest.$ac_ext], [],
- [CFLAGS="$CFLAGS $WMORE"])
+ [M4_cv_prog_compiler_warning_flags],
+ [$WMORE -c conftest.$ac_ext], [],
+ [CFLAGS="$CFLAGS $WMORE"])
AC_LIBTOOL_COMPILER_OPTION([if $compiler accepts -Wno-long-long],
- [M4_cv_prog_compiler_wnolonglong],
- [-Wno-long-long -c conftest.$ac_ext], [],
- [CFLAGS="$CFLAGS -Wno-long-long"])
+ [M4_cv_prog_compiler_wnolonglong],
+ [-Wno-long-long -c conftest.$ac_ext], [],
+ [CFLAGS="$CFLAGS -Wno-long-long"])
else
case "$CFLAGS" in
- *-g* ) ;;
- * ) CFLAGS="$CFLAGS -g" ;;
+ *-g* ) ;;
+ * ) CFLAGS="$CFLAGS -g" ;;
esac
fi
else
AC_ENABLE_SHARED
case "$CFLAGS" in
*-g* ) CFLAGS=`echo "$CFLAGS" |\
- $SED -e 's/ -g / /g;s/ -g$//;s/^-g //g;s/^-g$//'`
- ;;
+ $SED -e 's/ -g / /g;s/ -g$//;s/^-g //g;s/^-g$//'`
+ ;;
esac
case "$CXXFLAGS" in
*-g* ) CXXFLAGS=`echo "$CXXFLAGS" |\
- $SED -e 's/ -g / /g;s/ -g$//;s/^-g //g;s/^-g$//'`
- ;;
+ $SED -e 's/ -g / /g;s/ -g$//;s/^-g //g;s/^-g$//'`
+ ;;
esac
fi
])# M4_CHECK_DEBUGGING
diff --git a/ltdl/m4/gmp.m4 b/ltdl/m4/gmp.m4
index 6df17a06..4f703042 100644
--- a/ltdl/m4/gmp.m4
+++ b/ltdl/m4/gmp.m4
@@ -31,7 +31,7 @@ case $use_gmp:$LIBADD_GMP:$ac_cv_header_gmp_h in
;;
*::yes)
AC_MSG_WARN([gmp library not found or does not appear to work
- but `gmp.h' is present])
+ but `gmp.h' is present])
M4_cv_using_lib_gmp=no
;;
*:-lgmp:no)
diff --git a/ltdl/m4/m4-obstack.m4 b/ltdl/m4/m4-obstack.m4
index d9d72bac..23464ccc 100644
--- a/ltdl/m4/m4-obstack.m4
+++ b/ltdl/m4/m4-obstack.m4
@@ -30,7 +30,7 @@ AC_DEFUN([M4_OBSTACK],
AC_BEFORE([gl_OBSTACK], [M4_OBSTACK])
AC_ARG_WITH([included-obstack],
[AS_HELP_STRING([--with-included-obstack],
- [use the obstack implementation included here])])
+ [use the obstack implementation included here])])
AC_CHECK_HEADERS([obstack.h], [], [], [AC_INCLUDES_DEFAULT])
diff --git a/ltdl/m4/stackovf.m4 b/ltdl/m4/stackovf.m4
index 8b22fcf1..57e4acce 100644
--- a/ltdl/m4/stackovf.m4
+++ b/ltdl/m4/stackovf.m4
@@ -84,8 +84,8 @@ if test "$M4_cv_use_stackovf" = yes; then
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <signal.h>
]],
- [[struct sigaltstack x; x.ss_base = 0;]])],
- [AC_DEFINE([ss_sp], [ss_base],
- [Define to ss_base if stack_t has ss_base instead of ss_sp.])])
+ [[struct sigaltstack x; x.ss_base = 0;]])],
+ [AC_DEFINE([ss_sp], [ss_base],
+ [Define to ss_base if stack_t has ss_base instead of ss_sp.])])
fi
])# M4_SYS_STACKOVF
diff --git a/m4/builtin.c b/m4/builtin.c
index 0266a697..cac30627 100644
--- a/m4/builtin.c
+++ b/m4/builtin.c
@@ -47,13 +47,13 @@ m4_builtin_find_by_name (m4_module *module, const char *name)
do
{
bp = (m4__builtin *) bsearch (name, cur->builtins, cur->builtins_len,
- sizeof *bp, compare_builtin_name_CB);
+ sizeof *bp, compare_builtin_name_CB);
if (bp)
- {
- m4_symbol_value *token = (m4_symbol_value *) xzalloc (sizeof *token);
- m4__set_symbol_value_builtin (token, bp);
- return token;
- }
+ {
+ m4_symbol_value *token = (m4_symbol_value *) xzalloc (sizeof *token);
+ m4__set_symbol_value_builtin (token, bp);
+ return token;
+ }
}
while (!module && (cur = m4__module_next (cur)));
@@ -73,13 +73,13 @@ m4_builtin_find_by_func (m4_module *module, m4_builtin_func *func)
do
{
for (i = 0; i < cur->builtins_len; i++)
- if (cur->builtins[i].builtin.func == func)
- {
- m4_symbol_value *token =
- (m4_symbol_value *) xzalloc (sizeof *token);
- m4__set_symbol_value_builtin (token, &cur->builtins[i]);
- return token;
- }
+ if (cur->builtins[i].builtin.func == func)
+ {
+ m4_symbol_value *token =
+ (m4_symbol_value *) xzalloc (sizeof *token);
+ m4__set_symbol_value_builtin (token, &cur->builtins[i]);
+ return token;
+ }
}
while (!module && (cur = m4__module_next (cur)));
@@ -92,17 +92,17 @@ m4_builtin_find_by_func (m4_module *module, m4_builtin_func *func)
the name of FUNC. */
void
m4__builtin_print (m4_obstack *obs, const m4__builtin *func, bool flatten,
- m4__symbol_chain **chain, const m4_string_pair *quotes,
- bool module)
+ m4__symbol_chain **chain, const m4_string_pair *quotes,
+ bool module)
{
assert (func);
if (flatten)
{
if (quotes)
- {
- obstack_grow (obs, quotes->str1, quotes->len1);
- obstack_grow (obs, quotes->str2, quotes->len2);
- }
+ {
+ obstack_grow (obs, quotes->str1, quotes->len1);
+ obstack_grow (obs, quotes->str2, quotes->len2);
+ }
module = false;
}
else if (chain)
diff --git a/m4/debug.c b/m4/debug.c
index 02a69465..db950327 100644
--- a/m4/debug.c
+++ b/m4/debug.c
@@ -50,78 +50,78 @@ m4_debug_decode (m4 *context, const char *opts, size_t len)
else
{
if (*opts == '-' || *opts == '+')
- {
- len--;
- mode = *opts++;
- }
+ {
+ len--;
+ mode = *opts++;
+ }
for (level = 0; len--; opts++)
- {
- switch (*opts)
- {
- case 'a':
- level |= M4_DEBUG_TRACE_ARGS;
- break;
-
- case 'e':
- level |= M4_DEBUG_TRACE_EXPANSION;
- break;
-
- case 'q':
- level |= M4_DEBUG_TRACE_QUOTE;
- break;
-
- case 't':
- level |= M4_DEBUG_TRACE_ALL;
- break;
-
- case 'l':
- level |= M4_DEBUG_TRACE_LINE;
- break;
-
- case 'f':
- level |= M4_DEBUG_TRACE_FILE;
- break;
-
- case 'p':
- level |= M4_DEBUG_TRACE_PATH;
- break;
-
- case 'c':
- level |= M4_DEBUG_TRACE_CALL;
- break;
-
- case 'i':
- level |= M4_DEBUG_TRACE_INPUT;
- break;
-
- case 'x':
- level |= M4_DEBUG_TRACE_CALLID;
- break;
-
- case 'm':
- level |= M4_DEBUG_TRACE_MODULE;
- break;
-
- case 's':
- level |= M4_DEBUG_TRACE_STACK;
- break;
-
- case 'd':
- level |= M4_DEBUG_TRACE_DEREF;
- break;
-
- case 'o':
- level |= M4_DEBUG_TRACE_OUTPUT_DUMPDEF;
- break;
-
- case 'V':
- level |= M4_DEBUG_TRACE_VERBOSE;
- break;
-
- default:
- return -1;
- }
- }
+ {
+ switch (*opts)
+ {
+ case 'a':
+ level |= M4_DEBUG_TRACE_ARGS;
+ break;
+
+ case 'e':
+ level |= M4_DEBUG_TRACE_EXPANSION;
+ break;
+
+ case 'q':
+ level |= M4_DEBUG_TRACE_QUOTE;
+ break;
+
+ case 't':
+ level |= M4_DEBUG_TRACE_ALL;
+ break;
+
+ case 'l':
+ level |= M4_DEBUG_TRACE_LINE;
+ break;
+
+ case 'f':
+ level |= M4_DEBUG_TRACE_FILE;
+ break;
+
+ case 'p':
+ level |= M4_DEBUG_TRACE_PATH;
+ break;
+
+ case 'c':
+ level |= M4_DEBUG_TRACE_CALL;
+ break;
+
+ case 'i':
+ level |= M4_DEBUG_TRACE_INPUT;
+ break;
+
+ case 'x':
+ level |= M4_DEBUG_TRACE_CALLID;
+ break;
+
+ case 'm':
+ level |= M4_DEBUG_TRACE_MODULE;
+ break;
+
+ case 's':
+ level |= M4_DEBUG_TRACE_STACK;
+ break;
+
+ case 'd':
+ level |= M4_DEBUG_TRACE_DEREF;
+ break;
+
+ case 'o':
+ level |= M4_DEBUG_TRACE_OUTPUT_DUMPDEF;
+ break;
+
+ case 'V':
+ level |= M4_DEBUG_TRACE_VERBOSE;
+ break;
+
+ default:
+ return -1;
+ }
+ }
}
switch (mode)
@@ -169,21 +169,21 @@ set_debug_file (m4 *context, const m4_call_info *caller, FILE *fp)
if (debug_file != NULL && debug_file != stdout)
{
if (fstat (fileno (stdout), &stdout_stat) < 0)
- return;
+ return;
if (fstat (fileno (debug_file), &debug_stat) < 0)
- return;
+ return;
/* mingw has a bug where fstat on a regular file reports st_ino
- of 0. On normal system, st_ino should never be 0. */
+ of 0. On normal system, st_ino should never be 0. */
if (stdout_stat.st_ino == debug_stat.st_ino
- && stdout_stat.st_dev == debug_stat.st_dev
- && stdout_stat.st_ino != 0)
- {
- if (debug_file != stderr && close_stream (debug_file) != 0)
- m4_error (context, 0, errno, caller,
- _("error writing to debug stream"));
- m4_set_debug_file (context, stdout);
- }
+ && stdout_stat.st_dev == debug_stat.st_dev
+ && stdout_stat.st_ino != 0)
+ {
+ if (debug_file != stderr && close_stream (debug_file) != 0)
+ m4_error (context, 0, errno, caller,
+ _("error writing to debug stream"));
+ m4_set_debug_file (context, stdout);
+ }
}
}
@@ -206,11 +206,11 @@ m4_debug_set_output (m4 *context, const m4_call_info *caller, const char *name)
{
fp = fopen (name, "a");
if (fp == NULL)
- return false;
+ return false;
if (set_cloexec_flag (fileno (fp), true) != 0)
- m4_warn (context, errno, caller,
- _("cannot protect debug file across forks"));
+ m4_warn (context, errno, caller,
+ _("cannot protect debug file across forks"));
set_debug_file (context, caller, fp);
}
return true;
@@ -229,9 +229,9 @@ m4_debug_message_prefix (m4 *context)
if (m4_get_current_line (context))
{
if (m4_is_debug_bit (context, M4_DEBUG_TRACE_FILE))
- xfprintf (debug_file, "%s:", m4_get_current_file (context));
+ xfprintf (debug_file, "%s:", m4_get_current_file (context));
if (m4_is_debug_bit (context, M4_DEBUG_TRACE_LINE))
- xfprintf (debug_file, "%d:", m4_get_current_line (context));
+ xfprintf (debug_file, "%d:", m4_get_current_line (context));
}
putc (' ', debug_file);
}
diff --git a/m4/hash.c b/m4/hash.c
index b48490a8..94221457 100644
--- a/m4/hash.c
+++ b/m4/hash.c
@@ -86,9 +86,9 @@ struct m4_hash_iterator
/* Helper macros. */
#define BUCKET_NTH(hash, n) (HASH_BUCKETS (hash)[n])
#define BUCKET_COUNT(hash, key) \
- ((*HASH_HASH_FUNC (hash))(key) % HASH_SIZE (hash))
+ ((*HASH_HASH_FUNC (hash))(key) % HASH_SIZE (hash))
#define BUCKET_KEY(hash, key) \
- (BUCKET_NTH ((hash), BUCKET_COUNT ((hash), (key))))
+ (BUCKET_NTH ((hash), BUCKET_COUNT ((hash), (key))))
/* Debugging macros. */
#ifdef NDEBUG
@@ -119,7 +119,7 @@ static hash_node *free_list = NULL;
and CMP_FUNC will be called to compare keys. */
m4_hash *
m4_hash_new (size_t size, m4_hash_hash_func *hash_func,
- m4_hash_cmp_func *cmp_func)
+ m4_hash_cmp_func *cmp_func)
{
m4_hash *hash;
@@ -133,7 +133,7 @@ m4_hash_new (size_t size, m4_hash_hash_func *hash_func,
HASH_SIZE (hash) = size;
HASH_LENGTH (hash) = 0;
HASH_BUCKETS (hash) = (hash_node **) xcalloc (size,
- sizeof *HASH_BUCKETS (hash));
+ sizeof *HASH_BUCKETS (hash));
HASH_HASH_FUNC (hash) = hash_func;
HASH_CMP_FUNC (hash) = cmp_func;
#ifndef NDEBUG
@@ -152,7 +152,7 @@ m4_hash_dup (m4_hash *src, m4_hash_copy_func *copy)
assert (copy);
dest = m4_hash_new (HASH_SIZE (src), HASH_HASH_FUNC (src),
- HASH_CMP_FUNC (src));
+ HASH_CMP_FUNC (src));
m4_hash_apply (src, (m4_hash_apply_func *) copy, dest);
@@ -311,21 +311,21 @@ m4_hash_remove (m4_hash *hash, const void *key)
hash_node *next = node ? NODE_NEXT (node) : BUCKET_NTH (hash, n);
if (next && ((*HASH_CMP_FUNC (hash)) (NODE_KEY (next), key) == 0))
- {
- if (node)
- NODE_NEXT (node) = NODE_NEXT (next);
- else
- BUCKET_NTH (hash, n) = NODE_NEXT (next);
+ {
+ if (node)
+ NODE_NEXT (node) = NODE_NEXT (next);
+ else
+ BUCKET_NTH (hash, n) = NODE_NEXT (next);
- key = NODE_KEY (next);
+ key = NODE_KEY (next);
#ifndef NDEBUG
- if (iter)
- assert (ITERATOR_PLACE (iter) == next);
- NODE_KEY (next) = NULL;
+ if (iter)
+ assert (ITERATOR_PLACE (iter) == next);
+ NODE_KEY (next) = NULL;
#endif
- node_delete (hash, next);
- return (void *) key; /* Cast away const. */
- }
+ node_delete (hash, next);
+ return (void *) key; /* Cast away const. */
+ }
node = next;
}
while (node);
@@ -401,13 +401,13 @@ m4_hash_resize (m4_hash *hash, size_t size)
HASH_SIZE (hash) = size;
HASH_BUCKETS (hash) = (hash_node **) xcalloc (size,
- sizeof *HASH_BUCKETS (hash));
+ sizeof *HASH_BUCKETS (hash));
{
size_t i;
for (i = 0; i < original_size; ++i)
if (original_buckets[i])
- bucket_insert (hash, original_buckets[i]);
+ bucket_insert (hash, original_buckets[i]);
}
free (original_buckets);
@@ -433,13 +433,13 @@ maybe_grow (m4_hash *hash)
/* HASH sizes are always 1 less than a power of 2. */
HASH_SIZE (hash) = (2 * (1 + original_size)) -1;
HASH_BUCKETS (hash) =
- (hash_node **) xcalloc (HASH_SIZE (hash), sizeof *HASH_BUCKETS (hash));
+ (hash_node **) xcalloc (HASH_SIZE (hash), sizeof *HASH_BUCKETS (hash));
{
- size_t i;
- for (i = 0; i < original_size; ++i)
- if (original_buckets[i])
- bucket_insert (hash, original_buckets[i]);
+ size_t i;
+ for (i = 0; i < original_size; ++i)
+ if (original_buckets[i])
+ bucket_insert (hash, original_buckets[i]);
}
free (original_buckets);
@@ -521,19 +521,19 @@ m4_get_hash_iterator_next (const m4_hash *hash, m4_hash_iterator *place)
{
/* Find the next non-empty bucket. */
while ((ITERATOR_NEXT_BUCKET (place) < HASH_SIZE (hash))
- && (BUCKET_NTH (hash, ITERATOR_NEXT_BUCKET (place)) == NULL))
- {
- ++ITERATOR_NEXT_BUCKET (place);
- }
+ && (BUCKET_NTH (hash, ITERATOR_NEXT_BUCKET (place)) == NULL))
+ {
+ ++ITERATOR_NEXT_BUCKET (place);
+ }
/* Select the first node in the new bucket. */
if (ITERATOR_NEXT_BUCKET (place) < HASH_SIZE (hash))
- {
- ITERATOR_NEXT (place)
- = BUCKET_NTH (hash, ITERATOR_NEXT_BUCKET (place));
- }
+ {
+ ITERATOR_NEXT (place)
+ = BUCKET_NTH (hash, ITERATOR_NEXT_BUCKET (place));
+ }
else
- ITERATOR_NEXT (place) = NULL;
+ ITERATOR_NEXT (place) = NULL;
/* Advance the `next' reference. */
++ITERATOR_NEXT_BUCKET (place);
@@ -572,13 +572,13 @@ m4_free_hash_iterator (const m4_hash *hash, m4_hash_iterator *place)
{
next = iter ? ITER_CHAIN (iter) : HASH_ITER (hash);
if (place == next)
- {
- if (iter)
- ITER_CHAIN (iter) = ITER_CHAIN (next);
- else
- HASH_ITER (hash) = ITER_CHAIN (next);
- break;
- }
+ {
+ if (iter)
+ ITER_CHAIN (iter) = ITER_CHAIN (next);
+ else
+ HASH_ITER (hash) = ITER_CHAIN (next);
+ break;
+ }
iter = next;
}
while (iter);
@@ -624,13 +624,13 @@ m4_hash_apply (m4_hash *hash, m4_hash_apply_func *func, void *userdata)
while ((place = m4_get_hash_iterator_next (hash, place)))
{
result = (*func) (hash, m4_get_hash_iterator_key (place),
- m4_get_hash_iterator_value (place), userdata);
+ m4_get_hash_iterator_value (place), userdata);
if (result != NULL)
- {
- m4_free_hash_iterator (hash, place);
- break;
- }
+ {
+ m4_free_hash_iterator (hash, place);
+ break;
+ }
}
return result;
diff --git a/m4/hash.h b/m4/hash.h
index 9f3631ec..385f0866 100644
--- a/m4/hash.h
+++ b/m4/hash.h
@@ -38,10 +38,10 @@ typedef struct m4_hash m4_hash;
typedef size_t m4_hash_hash_func (const void *key);
typedef int m4_hash_cmp_func (const void *key, const void *try);
typedef void * m4_hash_copy_func (m4_hash *src, const void *key, void *value,
- m4_hash *dest);
+ m4_hash *dest);
extern m4_hash *m4_hash_new (size_t size, m4_hash_hash_func *hash_func,
- m4_hash_cmp_func *cmp_func);
+ m4_hash_cmp_func *cmp_func);
extern m4_hash *m4_hash_dup (m4_hash *hash, m4_hash_copy_func *copy);
extern void m4_hash_delete (m4_hash *hash);
extern void m4_hash_exit (void);
@@ -51,7 +51,7 @@ extern size_t m4_get_hash_length (m4_hash *hash);
extern void ** m4_hash_lookup (m4_hash *hash, const void *key);
extern void * m4_hash_remove (m4_hash *hash, const void *key);
extern const void * m4_hash_insert (m4_hash *hash, const void *key,
- void *value);
+ void *value);
@@ -62,17 +62,17 @@ extern int m4_hash_string_cmp (const void *key, const void *try);
typedef struct m4_hash_iterator m4_hash_iterator;
typedef void * m4_hash_apply_func (m4_hash *hash, const void *key,
- void *value, void *userdata);
+ void *value, void *userdata);
extern void * m4_hash_apply (m4_hash *hash, m4_hash_apply_func *func,
- void *userdata);
+ void *userdata);
extern const void * m4_get_hash_iterator_key (m4_hash_iterator *place);
extern void * m4_get_hash_iterator_value (m4_hash_iterator *place);
extern m4_hash_iterator *m4_get_hash_iterator_next (const m4_hash *hash,
- m4_hash_iterator *place);
+ m4_hash_iterator *place);
extern void m4_free_hash_iterator (const m4_hash *hash,
- m4_hash_iterator *place);
+ m4_hash_iterator *place);
END_C_DECLS
diff --git a/m4/input.c b/m4/input.c
index ffd54cfd..c8e42cf2 100644
--- a/m4/input.c
+++ b/m4/input.c
@@ -102,44 +102,44 @@ typedef struct m4_input_block m4_input_block;
static int file_peek (m4_input_block *, m4 *, bool);
static int file_read (m4_input_block *, m4 *, bool, bool,
- bool);
+ bool);
static void file_unget (m4_input_block *, int);
static bool file_clean (m4_input_block *, m4 *, bool);
static void file_print (m4_input_block *, m4 *, m4_obstack *,
- int);
+ int);
static const char * file_buffer (m4_input_block *, m4 *, size_t *,
- bool);
+ bool);
static void file_consume (m4_input_block *, m4 *, size_t);
static int string_peek (m4_input_block *, m4 *, bool);
static int string_read (m4_input_block *, m4 *, bool, bool,
- bool);
+ bool);
static void string_unget (m4_input_block *, int);
static void string_print (m4_input_block *, m4 *, m4_obstack *,
- int);
+ int);
static const char * string_buffer (m4_input_block *, m4 *, size_t *,
- bool);
+ bool);
static void string_consume (m4_input_block *, m4 *, size_t);
static int composite_peek (m4_input_block *, m4 *, bool);
static int composite_read (m4_input_block *, m4 *, bool, bool,
- bool);
+ bool);
static void composite_unget (m4_input_block *, int);
static bool composite_clean (m4_input_block *, m4 *, bool);
static void composite_print (m4_input_block *, m4 *, m4_obstack *,
- int);
+ int);
static const char * composite_buffer (m4_input_block *, m4 *, size_t *,
- bool);
+ bool);
static void composite_consume (m4_input_block *, m4 *, size_t);
static int eof_peek (m4_input_block *, m4 *, bool);
static int eof_read (m4_input_block *, m4 *, bool, bool,
- bool);
+ bool);
static void eof_unget (m4_input_block *, int);
static const char * eof_buffer (m4_input_block *, m4 *, size_t *,
- bool);
+ bool);
static void init_builtin_token (m4 *, m4_obstack *,
- m4_symbol_value *);
+ m4_symbol_value *);
static void append_quote_token (m4 *, m4_obstack *,
- m4_symbol_value *);
+ m4_symbol_value *);
static bool match_input (m4 *, const char *, size_t, bool);
static int next_char (m4 *, bool, bool, bool);
static int peek_char (m4 *, bool);
@@ -153,7 +153,7 @@ static bool consume_syntax (m4 *, m4_obstack *, unsigned int);
# include "quotearg.h"
static int m4_print_token (m4 *, const char *, m4__token_type,
- m4_symbol_value *);
+ m4_symbol_value *);
#endif
/* Vtable of callbacks for each input method. */
@@ -170,7 +170,7 @@ struct input_funcs
returned. If ALLOW_UNGET, then ensure that the next unget_func
will work with the returned character. */
int (*read_func) (m4_input_block *, m4 *, bool allow_quote,
- bool allow_argv, bool allow_unget);
+ bool allow_argv, bool allow_unget);
/* Unread a single unsigned character or CHAR_BUILTIN, must be the
same character previously read by read_func. */
@@ -211,24 +211,24 @@ struct m4_input_block
union
{
struct
- {
- char *str; /* String value. */
- size_t len; /* Remaining length. */
- }
+ {
+ char *str; /* String value. */
+ size_t len; /* Remaining length. */
+ }
u_s; /* See string_funcs. */
struct
- {
- FILE *fp; /* Input file handle. */
- bool_bitfield end : 1; /* True iff peek returned EOF. */
- bool_bitfield close : 1; /* True to close file on pop. */
- bool_bitfield line_start : 1; /* Saved start_of_input_line state. */
- }
+ {
+ FILE *fp; /* Input file handle. */
+ bool_bitfield end : 1; /* True iff peek returned EOF. */
+ bool_bitfield close : 1; /* True to close file on pop. */
+ bool_bitfield line_start : 1; /* Saved start_of_input_line state. */
+ }
u_f; /* See file_funcs. */
struct
- {
- m4__symbol_chain *chain; /* Current link in chain. */
- m4__symbol_chain *end; /* Last link in chain. */
- }
+ {
+ m4__symbol_chain *chain; /* Current link in chain. */
+ m4__symbol_chain *end; /* Last link in chain. */
+ }
u_c; /* See composite_funcs. */
}
u;
@@ -299,7 +299,7 @@ static const char buffer_retry[1];
/* Input files, from command line or [s]include. */
static int
file_peek (m4_input_block *me, m4 *context M4_GNUC_UNUSED,
- bool allow_argv M4_GNUC_UNUSED)
+ bool allow_argv M4_GNUC_UNUSED)
{
int ch;
@@ -316,7 +316,7 @@ file_peek (m4_input_block *me, m4 *context M4_GNUC_UNUSED,
static int
file_read (m4_input_block *me, m4 *context, bool allow_quote M4_GNUC_UNUSED,
- bool allow_argv M4_GNUC_UNUSED, bool allow_unget M4_GNUC_UNUSED)
+ bool allow_argv M4_GNUC_UNUSED, bool allow_unget M4_GNUC_UNUSED)
{
int ch;
@@ -361,21 +361,21 @@ file_clean (m4_input_block *me, m4 *context, bool cleanup)
return false;
if (me->prev != &input_eof)
m4_debug_message (context, M4_DEBUG_TRACE_INPUT,
- _("input reverted to %s, line %d"),
- me->prev->file, me->prev->line);
+ _("input reverted to %s, line %d"),
+ me->prev->file, me->prev->line);
else
m4_debug_message (context, M4_DEBUG_TRACE_INPUT, _("input exhausted"));
if (ferror (me->u.u_f.fp))
{
m4_error (context, 0, 0, NULL, _("error reading %s"),
- quotearg_style (locale_quoting_style, me->file));
+ quotearg_style (locale_quoting_style, me->file));
if (me->u.u_f.close)
- fclose (me->u.u_f.fp);
+ fclose (me->u.u_f.fp);
}
else if (me->u.u_f.close && fclose (me->u.u_f.fp) == EOF)
m4_error (context, 0, errno, NULL, _("error reading %s"),
- quotearg_style (locale_quoting_style, me->file));
+ quotearg_style (locale_quoting_style, me->file));
start_of_input_line = me->u.u_f.line_start;
m4_set_output_line (context, -1);
return true;
@@ -383,7 +383,7 @@ file_clean (m4_input_block *me, m4 *context, bool cleanup)
static void
file_print (m4_input_block *me, m4 *context M4_GNUC_UNUSED, m4_obstack *obs,
- int debug_level M4_GNUC_UNUSED)
+ int debug_level M4_GNUC_UNUSED)
{
const char *text = me->file;
assert (obstack_object_size (current_input) == 0);
@@ -394,7 +394,7 @@ file_print (m4_input_block *me, m4 *context M4_GNUC_UNUSED, m4_obstack *obs,
static const char *
file_buffer (m4_input_block *me, m4 *context M4_GNUC_UNUSED, size_t *len,
- bool allow_quote M4_GNUC_UNUSED)
+ bool allow_quote M4_GNUC_UNUSED)
{
if (start_of_input_line)
{
@@ -419,9 +419,9 @@ file_consume (m4_input_block *me, m4 *context, size_t len)
while ((p = (char *) memchr (buf + buf_len, '\n', len - buf_len)))
{
if (p == buf + len - 1)
- start_of_input_line = true;
+ start_of_input_line = true;
else
- m4_set_current_line (context, ++me->line);
+ m4_set_current_line (context, ++me->line);
buf_len = p - buf + 1;
}
if (freadseek (isp->u.u_f.fp, len) != 0)
@@ -450,7 +450,7 @@ m4_push_file (m4 *context, FILE *fp, const char *title, bool close_file)
}
m4_debug_message (context, M4_DEBUG_TRACE_INPUT, _("input read from %s"),
- quotearg_style (locale_quoting_style, title));
+ quotearg_style (locale_quoting_style, title));
i = (m4_input_block *) obstack_alloc (current_input, sizeof *i);
i->funcs = &file_funcs;
@@ -475,15 +475,15 @@ m4_push_file (m4 *context, FILE *fp, const char *title, bool close_file)
/* Handle string expansion text. */
static int
string_peek (m4_input_block *me, m4 *context M4_GNUC_UNUSED,
- bool allow_argv M4_GNUC_UNUSED)
+ bool allow_argv M4_GNUC_UNUSED)
{
return me->u.u_s.len ? to_uchar (*me->u.u_s.str) : CHAR_RETRY;
}
static int
string_read (m4_input_block *me, m4 *context M4_GNUC_UNUSED,
- bool allow_quote M4_GNUC_UNUSED, bool allow_argv M4_GNUC_UNUSED,
- bool allow_unget M4_GNUC_UNUSED)
+ bool allow_quote M4_GNUC_UNUSED, bool allow_argv M4_GNUC_UNUSED,
+ bool allow_unget M4_GNUC_UNUSED)
{
if (!me->u.u_s.len)
return CHAR_RETRY;
@@ -501,21 +501,21 @@ string_unget (m4_input_block *me, int ch)
static void
string_print (m4_input_block *me, m4 *context, m4_obstack *obs,
- int debug_level)
+ int debug_level)
{
bool quote = (debug_level & M4_DEBUG_TRACE_QUOTE) != 0;
size_t arg_length = m4_get_max_debug_arg_length_opt (context);
assert (!me->u.u_s.len);
m4_shipout_string_trunc (obs, (char *) obstack_base (current_input),
- obstack_object_size (current_input),
- quote ? m4_get_syntax_quotes (M4SYNTAX) : NULL,
- &arg_length);
+ obstack_object_size (current_input),
+ quote ? m4_get_syntax_quotes (M4SYNTAX) : NULL,
+ &arg_length);
}
static const char *
string_buffer (m4_input_block *me, m4 *context M4_GNUC_UNUSED, size_t *len,
- bool allow_quote M4_GNUC_UNUSED)
+ bool allow_quote M4_GNUC_UNUSED)
{
if (!me->u.u_s.len)
return buffer_retry;
@@ -591,44 +591,44 @@ m4__push_symbol (m4 *context, m4_symbol_value *value, size_t level, bool inuse)
{
assert (level < SIZE_MAX);
if (m4_get_symbol_value_len (value) <= INPUT_INLINE_THRESHOLD)
- {
- obstack_grow (current_input, m4_get_symbol_value_text (value),
- m4_get_symbol_value_len (value));
- return false;
- }
+ {
+ obstack_grow (current_input, m4_get_symbol_value_text (value),
+ m4_get_symbol_value_len (value));
+ return false;
+ }
}
else if (m4_is_symbol_value_func (value))
{
if (next->funcs == &string_funcs)
- {
- next->funcs = &composite_funcs;
- next->u.u_c.chain = next->u.u_c.end = NULL;
- }
+ {
+ next->funcs = &composite_funcs;
+ next->u.u_c.chain = next->u.u_c.end = NULL;
+ }
m4__append_builtin (current_input, value->u.builtin, &next->u.u_c.chain,
- &next->u.u_c.end);
+ &next->u.u_c.end);
return false;
}
else
{
/* For composite values, if argv is already in use, creating
- additional references for long text segments is more
- efficient in time. But if argv is not yet in use, and we
- have a composite value, then the value must already contain a
- back-reference, and memory usage is more efficient if we can
- avoid using the current expand_macro, even if it means larger
- copies. */
+ additional references for long text segments is more
+ efficient in time. But if argv is not yet in use, and we
+ have a composite value, then the value must already contain a
+ back-reference, and memory usage is more efficient if we can
+ avoid using the current expand_macro, even if it means larger
+ copies. */
assert (value->type == M4_SYMBOL_COMP);
src_chain = value->u.u_c.chain;
while (level < SIZE_MAX && src_chain && src_chain->type == M4__CHAIN_STR
- && (src_chain->u.u_s.len <= INPUT_INLINE_THRESHOLD
- || (!inuse && src_chain->u.u_s.level == SIZE_MAX)))
- {
- obstack_grow (current_input, src_chain->u.u_s.str,
- src_chain->u.u_s.len);
- src_chain = src_chain->next;
- }
+ && (src_chain->u.u_s.len <= INPUT_INLINE_THRESHOLD
+ || (!inuse && src_chain->u.u_s.level == SIZE_MAX)))
+ {
+ obstack_grow (current_input, src_chain->u.u_s.str,
+ src_chain->u.u_s.len);
+ src_chain = src_chain->next;
+ }
if (!src_chain)
- return false;
+ return false;
}
if (next->funcs == &string_funcs)
@@ -640,11 +640,11 @@ m4__push_symbol (m4 *context, m4_symbol_value *value, size_t level, bool inuse)
if (m4_is_symbol_value_text (value))
{
chain = (m4__symbol_chain *) obstack_alloc (current_input,
- sizeof *chain);
+ sizeof *chain);
if (next->u.u_c.end)
- next->u.u_c.end->next = chain;
+ next->u.u_c.end->next = chain;
else
- next->u.u_c.chain = chain;
+ next->u.u_c.chain = chain;
next->u.u_c.end = chain;
chain->next = NULL;
chain->type = M4__CHAIN_STR;
@@ -658,60 +658,60 @@ m4__push_symbol (m4 *context, m4_symbol_value *value, size_t level, bool inuse)
while (src_chain)
{
if (src_chain->type == M4__CHAIN_FUNC)
- {
- m4__append_builtin (current_input, src_chain->u.builtin,
- &next->u.u_c.chain, &next->u.u_c.end);
- src_chain = src_chain->next;
- continue;
- }
+ {
+ m4__append_builtin (current_input, src_chain->u.builtin,
+ &next->u.u_c.chain, &next->u.u_c.end);
+ src_chain = src_chain->next;
+ continue;
+ }
if (level == SIZE_MAX)
- {
- /* Nothing to copy, since link already lives on obstack. */
- assert (src_chain->type != M4__CHAIN_STR
- || src_chain->u.u_s.level == SIZE_MAX);
- chain = src_chain;
- }
+ {
+ /* Nothing to copy, since link already lives on obstack. */
+ assert (src_chain->type != M4__CHAIN_STR
+ || src_chain->u.u_s.level == SIZE_MAX);
+ chain = src_chain;
+ }
else
- {
- /* Allow inlining the final link with subsequent text. */
- if (!src_chain->next && src_chain->type == M4__CHAIN_STR
- && (src_chain->u.u_s.len <= INPUT_INLINE_THRESHOLD
- || (!inuse && src_chain->u.u_s.level == SIZE_MAX)))
- {
- obstack_grow (current_input, src_chain->u.u_s.str,
- src_chain->u.u_s.len);
- break;
- }
- /* We must clone each link in the chain, since next_char
- destructively modifies the chain it is parsing. */
- chain = (m4__symbol_chain *) obstack_copy (current_input, src_chain,
- sizeof *chain);
- chain->next = NULL;
- if (chain->type == M4__CHAIN_STR && chain->u.u_s.level == SIZE_MAX)
- {
- if (chain->u.u_s.len <= INPUT_INLINE_THRESHOLD || !inuse)
- chain->u.u_s.str = (char *) obstack_copy (current_input,
- chain->u.u_s.str,
- chain->u.u_s.len);
- else
- {
- chain->u.u_s.level = level;
- inuse = true;
- }
- }
- }
+ {
+ /* Allow inlining the final link with subsequent text. */
+ if (!src_chain->next && src_chain->type == M4__CHAIN_STR
+ && (src_chain->u.u_s.len <= INPUT_INLINE_THRESHOLD
+ || (!inuse && src_chain->u.u_s.level == SIZE_MAX)))
+ {
+ obstack_grow (current_input, src_chain->u.u_s.str,
+ src_chain->u.u_s.len);
+ break;
+ }
+ /* We must clone each link in the chain, since next_char
+ destructively modifies the chain it is parsing. */
+ chain = (m4__symbol_chain *) obstack_copy (current_input, src_chain,
+ sizeof *chain);
+ chain->next = NULL;
+ if (chain->type == M4__CHAIN_STR && chain->u.u_s.level == SIZE_MAX)
+ {
+ if (chain->u.u_s.len <= INPUT_INLINE_THRESHOLD || !inuse)
+ chain->u.u_s.str = (char *) obstack_copy (current_input,
+ chain->u.u_s.str,
+ chain->u.u_s.len);
+ else
+ {
+ chain->u.u_s.level = level;
+ inuse = true;
+ }
+ }
+ }
if (next->u.u_c.end)
- next->u.u_c.end->next = chain;
+ next->u.u_c.end->next = chain;
else
- next->u.u_c.chain = chain;
+ next->u.u_c.chain = chain;
next->u.u_c.end = chain;
if (chain->type == M4__CHAIN_ARGV)
- {
- assert (!chain->u.u_a.comma && !chain->u.u_a.skip_last);
- inuse |= m4__arg_adjust_refcount (context, chain->u.u_a.argv, true);
- }
+ {
+ assert (!chain->u.u_a.comma && !chain->u.u_a.skip_last);
+ inuse |= m4__arg_adjust_refcount (context, chain->u.u_a.argv, true);
+ }
else if (chain->type == M4__CHAIN_STR && chain->u.u_s.level < SIZE_MAX)
- m4__adjust_refcount (context, chain->u.u_s.level, true);
+ m4__adjust_refcount (context, chain->u.u_s.level, true);
src_chain = src_chain->next;
}
return inuse;
@@ -736,13 +736,13 @@ m4_push_string_finish (void)
if (len || next->funcs == &composite_funcs)
{
if (next->funcs == &string_funcs)
- {
- next->u.u_s.str = (char *) obstack_finish (current_input);
- next->u.u_s.len = len;
- }
+ {
+ next->u.u_s.str = (char *) obstack_finish (current_input);
+ next->u.u_s.len = len;
+ }
else
- m4__make_text_link (current_input, &next->u.u_c.chain,
- &next->u.u_c.end);
+ m4__make_text_link (current_input, &next->u.u_c.chain,
+ &next->u.u_c.end);
next->prev = isp;
isp = next;
input_change = true;
@@ -765,45 +765,45 @@ composite_peek (m4_input_block *me, m4 *context, bool allow_argv)
while (chain)
{
switch (chain->type)
- {
- case M4__CHAIN_STR:
- if (chain->u.u_s.len)
- return to_uchar (chain->u.u_s.str[0]);
- break;
- case M4__CHAIN_FUNC:
- if (chain->u.builtin)
- return CHAR_BUILTIN;
- break;
- case M4__CHAIN_ARGV:
- argc = m4_arg_argc (chain->u.u_a.argv);
- if (chain->u.u_a.index == argc)
- break;
- if (chain->u.u_a.comma)
- return ','; /* FIXME - support M4_SYNTAX_COMMA. */
- /* Only return a reference in the quoting is correct and the
- reference has more than one argument left. */
- if (allow_argv && chain->quote_age == m4__quote_age (M4SYNTAX)
- && chain->u.u_a.quotes && chain->u.u_a.index + 1 < argc)
- return CHAR_ARGV;
- /* Rather than directly parse argv here, we push another
- input block containing the next unparsed argument from
- argv. */
- m4_push_string_init (context, me->file, me->line);
- m4__push_arg_quote (context, current_input, chain->u.u_a.argv,
- chain->u.u_a.index,
- m4__quote_cache (M4SYNTAX, NULL,
- chain->quote_age,
- chain->u.u_a.quotes));
- chain->u.u_a.index++;
- chain->u.u_a.comma = true;
- m4_push_string_finish ();
- return peek_char (context, allow_argv);
- case M4__CHAIN_LOC:
- break;
- default:
- assert (!"composite_peek");
- abort ();
- }
+ {
+ case M4__CHAIN_STR:
+ if (chain->u.u_s.len)
+ return to_uchar (chain->u.u_s.str[0]);
+ break;
+ case M4__CHAIN_FUNC:
+ if (chain->u.builtin)
+ return CHAR_BUILTIN;
+ break;
+ case M4__CHAIN_ARGV:
+ argc = m4_arg_argc (chain->u.u_a.argv);
+ if (chain->u.u_a.index == argc)
+ break;
+ if (chain->u.u_a.comma)
+ return ','; /* FIXME - support M4_SYNTAX_COMMA. */
+ /* Only return a reference in the quoting is correct and the
+ reference has more than one argument left. */
+ if (allow_argv && chain->quote_age == m4__quote_age (M4SYNTAX)
+ && chain->u.u_a.quotes && chain->u.u_a.index + 1 < argc)
+ return CHAR_ARGV;
+ /* Rather than directly parse argv here, we push another
+ input block containing the next unparsed argument from
+ argv. */
+ m4_push_string_init (context, me->file, me->line);
+ m4__push_arg_quote (context, current_input, chain->u.u_a.argv,
+ chain->u.u_a.index,
+ m4__quote_cache (M4SYNTAX, NULL,
+ chain->quote_age,
+ chain->u.u_a.quotes));
+ chain->u.u_a.index++;
+ chain->u.u_a.comma = true;
+ m4_push_string_finish ();
+ return peek_char (context, allow_argv);
+ case M4__CHAIN_LOC:
+ break;
+ default:
+ assert (!"composite_peek");
+ abort ();
+ }
chain = chain->next;
}
return CHAR_RETRY;
@@ -811,71 +811,71 @@ composite_peek (m4_input_block *me, m4 *context, bool allow_argv)
static int
composite_read (m4_input_block *me, m4 *context, bool allow_quote,
- bool allow_argv, bool allow_unget)
+ bool allow_argv, bool allow_unget)
{
m4__symbol_chain *chain = me->u.u_c.chain;
size_t argc;
while (chain)
{
if (allow_quote && chain->quote_age == m4__quote_age (M4SYNTAX))
- return CHAR_QUOTE;
+ return CHAR_QUOTE;
switch (chain->type)
- {
- case M4__CHAIN_STR:
- if (chain->u.u_s.len)
- {
- /* Partial consumption invalidates quote age. */
- chain->quote_age = 0;
- chain->u.u_s.len--;
- return to_uchar (*chain->u.u_s.str++);
- }
- if (chain->u.u_s.level < SIZE_MAX)
- m4__adjust_refcount (context, chain->u.u_s.level, false);
- break;
- case M4__CHAIN_FUNC:
- if (chain->u.builtin)
- return CHAR_BUILTIN;
- break;
- case M4__CHAIN_ARGV:
- argc = m4_arg_argc (chain->u.u_a.argv);
- if (chain->u.u_a.index == argc)
- {
- m4__arg_adjust_refcount (context, chain->u.u_a.argv, false);
- break;
- }
- if (chain->u.u_a.comma)
- {
- chain->u.u_a.comma = false;
- return ','; /* FIXME - support M4_SYNTAX_COMMA. */
- }
- /* Only return a reference in the quoting is correct and the
- reference has more than one argument left. */
- if (allow_argv && chain->quote_age == m4__quote_age (M4SYNTAX)
- && chain->u.u_a.quotes && chain->u.u_a.index + 1 < argc)
- return CHAR_ARGV;
- /* Rather than directly parse argv here, we push another
- input block containing the next unparsed argument from
- argv. */
- m4_push_string_init (context, me->file, me->line);
- m4__push_arg_quote (context, current_input, chain->u.u_a.argv,
- chain->u.u_a.index,
- m4__quote_cache (M4SYNTAX, NULL,
- chain->quote_age,
- chain->u.u_a.quotes));
- chain->u.u_a.index++;
- chain->u.u_a.comma = true;
- m4_push_string_finish ();
- return next_char (context, allow_quote, allow_argv, allow_unget);
- case M4__CHAIN_LOC:
- me->file = chain->u.u_l.file;
- me->line = chain->u.u_l.line;
- input_change = true;
- me->u.u_c.chain = chain->next;
- return next_char (context, allow_quote, allow_argv, allow_unget);
- default:
- assert (!"composite_read");
- abort ();
- }
+ {
+ case M4__CHAIN_STR:
+ if (chain->u.u_s.len)
+ {
+ /* Partial consumption invalidates quote age. */
+ chain->quote_age = 0;
+ chain->u.u_s.len--;
+ return to_uchar (*chain->u.u_s.str++);
+ }
+ if (chain->u.u_s.level < SIZE_MAX)
+ m4__adjust_refcount (context, chain->u.u_s.level, false);
+ break;
+ case M4__CHAIN_FUNC:
+ if (chain->u.builtin)
+ return CHAR_BUILTIN;
+ break;
+ case M4__CHAIN_ARGV:
+ argc = m4_arg_argc (chain->u.u_a.argv);
+ if (chain->u.u_a.index == argc)
+ {
+ m4__arg_adjust_refcount (context, chain->u.u_a.argv, false);
+ break;
+ }
+ if (chain->u.u_a.comma)
+ {
+ chain->u.u_a.comma = false;
+ return ','; /* FIXME - support M4_SYNTAX_COMMA. */
+ }
+ /* Only return a reference in the quoting is correct and the
+ reference has more than one argument left. */
+ if (allow_argv && chain->quote_age == m4__quote_age (M4SYNTAX)
+ && chain->u.u_a.quotes && chain->u.u_a.index + 1 < argc)
+ return CHAR_ARGV;
+ /* Rather than directly parse argv here, we push another
+ input block containing the next unparsed argument from
+ argv. */
+ m4_push_string_init (context, me->file, me->line);
+ m4__push_arg_quote (context, current_input, chain->u.u_a.argv,
+ chain->u.u_a.index,
+ m4__quote_cache (M4SYNTAX, NULL,
+ chain->quote_age,
+ chain->u.u_a.quotes));
+ chain->u.u_a.index++;
+ chain->u.u_a.comma = true;
+ m4_push_string_finish ();
+ return next_char (context, allow_quote, allow_argv, allow_unget);
+ case M4__CHAIN_LOC:
+ me->file = chain->u.u_l.file;
+ me->line = chain->u.u_l.line;
+ input_change = true;
+ me->u.u_c.chain = chain->next;
+ return next_char (context, allow_quote, allow_argv, allow_unget);
+ default:
+ assert (!"composite_read");
+ abort ();
+ }
me->u.u_c.chain = chain = chain->next;
}
return CHAR_RETRY;
@@ -914,34 +914,34 @@ composite_clean (m4_input_block *me, m4 *context, bool cleanup)
while (chain)
{
switch (chain->type)
- {
- case M4__CHAIN_STR:
- if (chain->u.u_s.len)
- {
- assert (!cleanup);
- return false;
- }
- if (chain->u.u_s.level < SIZE_MAX)
- m4__adjust_refcount (context, chain->u.u_s.level, false);
- break;
- case M4__CHAIN_FUNC:
- if (chain->u.builtin)
- return false;
- break;
- case M4__CHAIN_ARGV:
- if (chain->u.u_a.index < m4_arg_argc (chain->u.u_a.argv))
- {
- assert (!cleanup);
- return false;
- }
- m4__arg_adjust_refcount (context, chain->u.u_a.argv, false);
- break;
- case M4__CHAIN_LOC:
- return false;
- default:
- assert (!"composite_clean");
- abort ();
- }
+ {
+ case M4__CHAIN_STR:
+ if (chain->u.u_s.len)
+ {
+ assert (!cleanup);
+ return false;
+ }
+ if (chain->u.u_s.level < SIZE_MAX)
+ m4__adjust_refcount (context, chain->u.u_s.level, false);
+ break;
+ case M4__CHAIN_FUNC:
+ if (chain->u.builtin)
+ return false;
+ break;
+ case M4__CHAIN_ARGV:
+ if (chain->u.u_a.index < m4_arg_argc (chain->u.u_a.argv))
+ {
+ assert (!cleanup);
+ return false;
+ }
+ m4__arg_adjust_refcount (context, chain->u.u_a.argv, false);
+ break;
+ case M4__CHAIN_LOC:
+ return false;
+ default:
+ assert (!"composite_clean");
+ abort ();
+ }
me->u.u_c.chain = chain = chain->next;
}
return true;
@@ -949,7 +949,7 @@ composite_clean (m4_input_block *me, m4 *context, bool cleanup)
static void
composite_print (m4_input_block *me, m4 *context, m4_obstack *obs,
- int debug_level)
+ int debug_level)
{
bool quote = (debug_level & M4_DEBUG_TRACE_QUOTE) != 0;
size_t maxlen = m4_get_max_debug_arg_length_opt (context);
@@ -964,79 +964,79 @@ composite_print (m4_input_block *me, m4 *context, m4_obstack *obs,
while (chain && !done)
{
switch (chain->type)
- {
- case M4__CHAIN_STR:
- if (m4_shipout_string_trunc (obs, chain->u.u_s.str,
- chain->u.u_s.len, NULL, &maxlen))
- done = true;
- break;
- case M4__CHAIN_FUNC:
- m4__builtin_print (obs, chain->u.builtin, false, NULL, NULL, module);
- break;
- case M4__CHAIN_ARGV:
- assert (!chain->u.u_a.comma);
- if (m4__arg_print (context, obs, chain->u.u_a.argv,
- chain->u.u_a.index,
- m4__quote_cache (M4SYNTAX, NULL, chain->quote_age,
- chain->u.u_a.quotes),
- chain->u.u_a.flatten, NULL, NULL, &maxlen, false,
- module))
- done = true;
- break;
- default:
- assert (!"composite_print");
- abort ();
- }
+ {
+ case M4__CHAIN_STR:
+ if (m4_shipout_string_trunc (obs, chain->u.u_s.str,
+ chain->u.u_s.len, NULL, &maxlen))
+ done = true;
+ break;
+ case M4__CHAIN_FUNC:
+ m4__builtin_print (obs, chain->u.builtin, false, NULL, NULL, module);
+ break;
+ case M4__CHAIN_ARGV:
+ assert (!chain->u.u_a.comma);
+ if (m4__arg_print (context, obs, chain->u.u_a.argv,
+ chain->u.u_a.index,
+ m4__quote_cache (M4SYNTAX, NULL, chain->quote_age,
+ chain->u.u_a.quotes),
+ chain->u.u_a.flatten, NULL, NULL, &maxlen, false,
+ module))
+ done = true;
+ break;
+ default:
+ assert (!"composite_print");
+ abort ();
+ }
chain = chain->next;
}
if (len)
m4_shipout_string_trunc (obs, (char *) obstack_base (current_input), len,
- NULL, &maxlen);
+ NULL, &maxlen);
if (quote)
m4_shipout_string (context, obs, quotes->str2, quotes->len2, false);
}
static const char *
composite_buffer (m4_input_block *me, m4 *context, size_t *len,
- bool allow_quote)
+ bool allow_quote)
{
m4__symbol_chain *chain = me->u.u_c.chain;
while (chain)
{
if (allow_quote && chain->quote_age == m4__quote_age (M4SYNTAX))
- return NULL; /* CHAR_QUOTE doesn't fit in buffer. */
+ return NULL; /* CHAR_QUOTE doesn't fit in buffer. */
switch (chain->type)
- {
- case M4__CHAIN_STR:
- if (chain->u.u_s.len)
- {
- *len = chain->u.u_s.len;
- return chain->u.u_s.str;
- }
- if (chain->u.u_s.level < SIZE_MAX)
- m4__adjust_refcount (context, chain->u.u_s.level, false);
- break;
- case M4__CHAIN_FUNC:
- if (chain->u.builtin)
- return NULL; /* CHAR_BUILTIN doesn't fit in buffer. */
- break;
- case M4__CHAIN_ARGV:
- if (chain->u.u_a.index == m4_arg_argc (chain->u.u_a.argv))
- {
- m4__arg_adjust_refcount (context, chain->u.u_a.argv, false);
- break;
- }
- return NULL; /* No buffer to provide. */
- case M4__CHAIN_LOC:
- me->file = chain->u.u_l.file;
- me->line = chain->u.u_l.line;
- input_change = true;
- me->u.u_c.chain = chain->next;
- return next_buffer (context, len, allow_quote);
- default:
- assert (!"composite_buffer");
- abort ();
- }
+ {
+ case M4__CHAIN_STR:
+ if (chain->u.u_s.len)
+ {
+ *len = chain->u.u_s.len;
+ return chain->u.u_s.str;
+ }
+ if (chain->u.u_s.level < SIZE_MAX)
+ m4__adjust_refcount (context, chain->u.u_s.level, false);
+ break;
+ case M4__CHAIN_FUNC:
+ if (chain->u.builtin)
+ return NULL; /* CHAR_BUILTIN doesn't fit in buffer. */
+ break;
+ case M4__CHAIN_ARGV:
+ if (chain->u.u_a.index == m4_arg_argc (chain->u.u_a.argv))
+ {
+ m4__arg_adjust_refcount (context, chain->u.u_a.argv, false);
+ break;
+ }
+ return NULL; /* No buffer to provide. */
+ case M4__CHAIN_LOC:
+ me->file = chain->u.u_l.file;
+ me->line = chain->u.u_l.line;
+ input_change = true;
+ me->u.u_c.chain = chain->next;
+ return next_buffer (context, len, allow_quote);
+ default:
+ assert (!"composite_buffer");
+ abort ();
+ }
me->u.u_c.chain = chain = chain->next;
}
return buffer_retry;
@@ -1058,7 +1058,7 @@ composite_consume (m4_input_block *me, m4 *context M4_GNUC_UNUSED, size_t len)
*END is non-NULL. */
void
m4__make_text_link (m4_obstack *obs, m4__symbol_chain **start,
- m4__symbol_chain **end)
+ m4__symbol_chain **end)
{
m4__symbol_chain *chain;
size_t len = obstack_object_size (obs);
@@ -1069,9 +1069,9 @@ m4__make_text_link (m4_obstack *obs, m4__symbol_chain **start,
char *str = (char *) obstack_finish (obs);
chain = (m4__symbol_chain *) obstack_alloc (obs, sizeof *chain);
if (*end)
- (*end)->next = chain;
+ (*end)->next = chain;
else
- *start = chain;
+ *start = chain;
*end = chain;
chain->next = NULL;
chain->type = M4__CHAIN_STR;
@@ -1088,7 +1088,7 @@ m4__make_text_link (m4_obstack *obs, m4__symbol_chain **start,
non-NULL. */
void
m4__append_builtin (m4_obstack *obs, const m4__builtin *func,
- m4__symbol_chain **start, m4__symbol_chain **end)
+ m4__symbol_chain **start, m4__symbol_chain **end)
{
m4__symbol_chain *chain;
@@ -1129,7 +1129,7 @@ m4_push_builtin (m4 *context, m4_obstack *obs, m4_symbol_value *token)
thus make fewer execution branches. */
static int
eof_peek (m4_input_block *me, m4 *context M4_GNUC_UNUSED,
- bool allow_argv M4_GNUC_UNUSED)
+ bool allow_argv M4_GNUC_UNUSED)
{
assert (me == &input_eof);
return CHAR_EOF;
@@ -1137,8 +1137,8 @@ eof_peek (m4_input_block *me, m4 *context M4_GNUC_UNUSED,
static int
eof_read (m4_input_block *me, m4 *context M4_GNUC_UNUSED,
- bool allow_quote M4_GNUC_UNUSED, bool allow_argv M4_GNUC_UNUSED,
- bool allow_unget M4_GNUC_UNUSED)
+ bool allow_quote M4_GNUC_UNUSED, bool allow_argv M4_GNUC_UNUSED,
+ bool allow_unget M4_GNUC_UNUSED)
{
assert (me == &input_eof);
return CHAR_EOF;
@@ -1152,7 +1152,7 @@ eof_unget (m4_input_block *me M4_GNUC_UNUSED, int ch)
static const char *
eof_buffer (m4_input_block *me M4_GNUC_UNUSED, m4 *context M4_GNUC_UNUSED,
- size_t *len M4_GNUC_UNUSED, bool allow_unget M4_GNUC_UNUSED)
+ size_t *len M4_GNUC_UNUSED, bool allow_unget M4_GNUC_UNUSED)
{
return NULL;
}
@@ -1177,7 +1177,7 @@ m4_input_print (m4 *context, m4_obstack *obs, int debug_level)
text. This should be followed by m4__push_wrapup_finish (). */
m4_obstack *
m4__push_wrapup_init (m4 *context, const m4_call_info *caller,
- m4__symbol_chain ***end)
+ m4__symbol_chain ***end)
{
m4_input_block *i;
m4__symbol_chain *chain;
@@ -1187,7 +1187,7 @@ m4__push_wrapup_init (m4 *context, const m4_call_info *caller,
{
i = wsp;
assert (i->funcs == &composite_funcs && i->u.u_c.end
- && i->u.u_c.end->type != M4__CHAIN_LOC);
+ && i->u.u_c.end->type != M4__CHAIN_LOC);
}
else
{
@@ -1265,14 +1265,14 @@ m4_pop_wrapup (m4 *context)
m4_set_current_file (context, NULL);
m4_set_current_line (context, 0);
m4_debug_message (context, M4_DEBUG_TRACE_INPUT,
- _("input from m4wrap exhausted"));
+ _("input from m4wrap exhausted"));
current_input = NULL;
DELETE (wrapup_stack);
return false;
}
m4_debug_message (context, M4_DEBUG_TRACE_INPUT,
- _("input from m4wrap recursion level %zu"), ++level);
+ _("input from m4wrap recursion level %zu"), ++level);
current_input = wrapup_stack;
wrapup_stack = (m4_obstack *) xmalloc (sizeof *wrapup_stack);
@@ -1296,20 +1296,20 @@ init_builtin_token (m4 *context, m4_obstack *obs, m4_symbol_value *token)
assert (isp->funcs == &composite_funcs);
chain = isp->u.u_c.chain;
assert (!chain->quote_age && chain->type == M4__CHAIN_FUNC
- && chain->u.builtin);
+ && chain->u.builtin);
if (obs)
{
assert (token);
if (token->type == M4_SYMBOL_VOID)
- {
- token->type = M4_SYMBOL_COMP;
- token->u.u_c.chain = token->u.u_c.end = NULL;
- token->u.u_c.wrapper = false;
- token->u.u_c.has_func = false;
- }
+ {
+ token->type = M4_SYMBOL_COMP;
+ token->u.u_c.chain = token->u.u_c.end = NULL;
+ token->u.u_c.wrapper = false;
+ token->u.u_c.has_func = false;
+ }
assert (token->type == M4_SYMBOL_COMP);
m4__append_builtin (obs, chain->u.builtin, &token->u.u_c.chain,
- &token->u.u_c.end);
+ &token->u.u_c.end);
}
else if (token)
{
@@ -1374,8 +1374,8 @@ init_argv_symbol (m4 *context, m4_obstack *obs, m4_symbol_value *value)
const m4_string_pair *comments = m4_get_syntax_comments (M4SYNTAX);
assert (value->type == M4_SYMBOL_VOID && isp->funcs == &composite_funcs
- && isp->u.u_c.chain->type == M4__CHAIN_ARGV
- && obs && obstack_object_size (obs) == 0);
+ && isp->u.u_c.chain->type == M4__CHAIN_ARGV
+ && obs && obstack_object_size (obs) == 0);
src_chain = isp->u.u_c.chain;
isp->u.u_c.chain = src_chain->next;
@@ -1408,9 +1408,9 @@ init_argv_symbol (m4 *context, m4_obstack *obs, m4_symbol_value *value)
refcount here, to compensate for the fact that it will be
decreased once the final element is parsed. */
assert (!comments->len1
- || (!m4_has_syntax (M4SYNTAX, *comments->str1,
- M4_SYNTAX_COMMA | M4_SYNTAX_CLOSE)
- && *comments->str1 != *src_chain->u.u_a.quotes->str1));
+ || (!m4_has_syntax (M4SYNTAX, *comments->str1,
+ M4_SYNTAX_COMMA | M4_SYNTAX_CLOSE)
+ && *comments->str1 != *src_chain->u.u_a.quotes->str1));
ch = peek_char (context, true);
if (!m4_has_syntax (M4SYNTAX, ch, M4_SYNTAX_COMMA | M4_SYNTAX_CLOSE))
{
@@ -1440,21 +1440,21 @@ next_char (m4 *context, bool allow_quote, bool allow_argv, bool allow_unget)
while (1)
{
if (input_change)
- {
- m4_set_current_file (context, isp->file);
- m4_set_current_line (context, isp->line);
- input_change = false;
- }
+ {
+ m4_set_current_file (context, isp->file);
+ m4_set_current_line (context, isp->line);
+ input_change = false;
+ }
assert (isp->funcs->read_func);
while (((ch = isp->funcs->read_func (isp, context, allow_quote,
- allow_argv, allow_unget))
- != CHAR_RETRY)
- || allow_unget)
- {
- /* if (!IS_IGNORE (ch)) */
- return ch;
- }
+ allow_argv, allow_unget))
+ != CHAR_RETRY)
+ || allow_unget)
+ {
+ /* if (!IS_IGNORE (ch)) */
+ return ch;
+ }
/* End of input source --- pop one level. */
pop_input (context, true);
@@ -1476,11 +1476,11 @@ peek_char (m4 *context, bool allow_argv)
assert (block->funcs->peek_func);
ch = block->funcs->peek_func (block, context, allow_argv);
if (ch != CHAR_RETRY)
- {
+ {
/* if (IS_IGNORE (ch)) */
/* return next_char (context, false, true, false); */
- return ch;
- }
+ return ch;
+ }
block = block->prev;
}
@@ -1511,16 +1511,16 @@ next_buffer (m4 *context, size_t *len, bool allow_quote)
{
assert (isp);
if (input_change)
- {
- m4_set_current_file (context, isp->file);
- m4_set_current_line (context, isp->line);
- input_change = false;
- }
+ {
+ m4_set_current_file (context, isp->file);
+ m4_set_current_line (context, isp->line);
+ input_change = false;
+ }
assert (isp->funcs->buffer_func);
buf = isp->funcs->buffer_func (isp, context, len, allow_quote);
if (buf != buffer_retry)
- return buf;
+ return buf;
/* End of input source --- pop one level. */
pop_input (context, true);
}
@@ -1553,22 +1553,22 @@ m4_skip_line (m4 *context, const m4_call_info *caller)
size_t len;
const char *buffer = next_buffer (context, &len, false);
if (buffer)
- {
- const char *p = (char *) memchr (buffer, '\n', len);
- if (p)
- {
- consume_buffer (context, p - buffer + 1);
- ch = '\n';
- break;
- }
- consume_buffer (context, len);
- }
+ {
+ const char *p = (char *) memchr (buffer, '\n', len);
+ if (p)
+ {
+ consume_buffer (context, p - buffer + 1);
+ ch = '\n';
+ break;
+ }
+ consume_buffer (context, len);
+ }
else
- {
- ch = next_char (context, false, false, false);
- if (ch == CHAR_EOF || ch == '\n')
- break;
- }
+ {
+ ch = next_char (context, false, false, false);
+ if (ch == CHAR_EOF || ch == '\n')
+ break;
+ }
}
if (ch == CHAR_EOF)
m4_warn (context, 0, caller, _("end of file treated as newline"));
@@ -1609,7 +1609,7 @@ match_input (m4 *context, const char *s, size_t len, bool consume)
if (t && len <= buf_len && memcmp (s, t, len) == 0)
{
if (consume)
- consume_buffer (context, len);
+ consume_buffer (context, len);
return true;
}
/* Fall back on byte matching. */
@@ -1620,7 +1620,7 @@ match_input (m4 *context, const char *s, size_t len, bool consume)
if (len == 1)
{
if (consume)
- next_char (context, false, false, false);
+ next_char (context, false, false, false);
return true; /* short match */
}
@@ -1630,17 +1630,17 @@ match_input (m4 *context, const char *s, size_t len, bool consume)
next_char (context, false, false, false);
n++;
if (--len == 1) /* long match */
- {
- if (consume)
- return true;
- result = true;
- break;
- }
+ {
+ if (consume)
+ return true;
+ result = true;
+ break;
+ }
}
/* Failed or shouldn't consume, push back input. */
st = m4_push_string_init (context, m4_get_current_file (context),
- m4_get_current_line (context));
+ m4_get_current_line (context));
obstack_grow (st, t, n);
m4_push_string_finish ();
return result;
@@ -1678,42 +1678,42 @@ consume_syntax (m4 *context, m4_obstack *obs, unsigned int syntax)
size_t len;
const char *buffer = next_buffer (context, &len, allow);
if (buffer)
- {
- const char *p = buffer;
- while (len && m4_has_syntax (M4SYNTAX, *p, syntax))
- {
- len--;
- p++;
- }
- obstack_grow (obs, buffer, p - buffer);
- consume_buffer (context, p - buffer);
- if (len)
- return false;
- }
+ {
+ const char *p = buffer;
+ while (len && m4_has_syntax (M4SYNTAX, *p, syntax))
+ {
+ len--;
+ p++;
+ }
+ obstack_grow (obs, buffer, p - buffer);
+ consume_buffer (context, p - buffer);
+ if (len)
+ return false;
+ }
/* Fall back to byte-wise search. It is safe to call next_char
- without first checking peek_char, except at input source
- boundaries, which we detect by CHAR_RETRY. */
+ without first checking peek_char, except at input source
+ boundaries, which we detect by CHAR_RETRY. */
ch = next_char (context, allow, allow, true);
if (ch < CHAR_EOF && m4_has_syntax (M4SYNTAX, ch, syntax))
- {
- obstack_1grow (obs, ch);
- continue;
- }
+ {
+ obstack_1grow (obs, ch);
+ continue;
+ }
if (ch == CHAR_RETRY || ch == CHAR_QUOTE || ch == CHAR_ARGV)
- {
- ch = peek_char (context, false);
- /* We exploit the fact that CHAR_EOF, CHAR_BUILTIN,
- CHAR_QUOTE, and CHAR_ARGV do not satisfy any syntax
- categories. */
- if (m4_has_syntax (M4SYNTAX, ch, syntax))
- {
- assert (ch < CHAR_EOF);
- obstack_1grow (obs, ch);
- next_char (context, false, false, false);
- continue;
- }
- return ch == CHAR_EOF;
- }
+ {
+ ch = peek_char (context, false);
+ /* We exploit the fact that CHAR_EOF, CHAR_BUILTIN,
+ CHAR_QUOTE, and CHAR_ARGV do not satisfy any syntax
+ categories. */
+ if (m4_has_syntax (M4SYNTAX, ch, syntax))
+ {
+ assert (ch < CHAR_EOF);
+ obstack_1grow (obs, ch);
+ next_char (context, false, false, false);
+ continue;
+ }
+ return ch == CHAR_EOF;
+ }
unget_input (ch);
return false;
}
@@ -1774,7 +1774,7 @@ m4_input_exit (void)
m4__next_token () is called. */
m4__token_type
m4__next_token (m4 *context, m4_symbol_value *token, int *line,
- m4_obstack *obs, bool allow_argv, const m4_call_info *caller)
+ m4_obstack *obs, bool allow_argv, const m4_call_info *caller)
{
int ch;
int quote_level;
@@ -1794,322 +1794,322 @@ m4__next_token (m4 *context, m4_symbol_value *token, int *line,
/* Must consume an input character. */
ch = next_char (context, false, allow_argv && m4__quote_age (M4SYNTAX),
- false);
+ false);
if (line)
{
- *line = m4_get_current_line (context);
- file = m4_get_current_file (context);
+ *line = m4_get_current_line (context);
+ file = m4_get_current_file (context);
}
if (ch == CHAR_EOF) /* EOF */
{
#ifdef DEBUG_INPUT
- xfprintf (stderr, "next_token -> EOF\n");
+ xfprintf (stderr, "next_token -> EOF\n");
#endif
- return M4_TOKEN_EOF;
+ return M4_TOKEN_EOF;
}
if (ch == CHAR_BUILTIN) /* BUILTIN TOKEN */
{
- init_builtin_token (context, obs, token);
+ init_builtin_token (context, obs, token);
#ifdef DEBUG_INPUT
- m4_print_token (context, "next_token", M4_TOKEN_MACDEF, token);
+ m4_print_token (context, "next_token", M4_TOKEN_MACDEF, token);
#endif
- return M4_TOKEN_MACDEF;
+ return M4_TOKEN_MACDEF;
}
if (ch == CHAR_ARGV)
{
- init_argv_symbol (context, obs, token);
+ init_argv_symbol (context, obs, token);
#ifdef DEBUG_INPUT
- m4_print_token (context, "next_token", M4_TOKEN_ARGV, token);
+ m4_print_token (context, "next_token", M4_TOKEN_ARGV, token);
#endif
- return M4_TOKEN_ARGV;
+ return M4_TOKEN_ARGV;
}
if (m4_has_syntax (M4SYNTAX, ch, M4_SYNTAX_ESCAPE))
{ /* ESCAPED WORD */
- obstack_1grow (&token_stack, ch);
- if ((ch = next_char (context, false, false, false)) < CHAR_EOF)
- {
- obstack_1grow (&token_stack, ch);
- if (m4_has_syntax (M4SYNTAX, ch, M4_SYNTAX_ALPHA))
- consume_syntax (context, &token_stack,
- M4_SYNTAX_ALPHA | M4_SYNTAX_NUM);
- type = M4_TOKEN_WORD;
- }
- else
- type = M4_TOKEN_SIMPLE; /* escape before eof */
+ obstack_1grow (&token_stack, ch);
+ if ((ch = next_char (context, false, false, false)) < CHAR_EOF)
+ {
+ obstack_1grow (&token_stack, ch);
+ if (m4_has_syntax (M4SYNTAX, ch, M4_SYNTAX_ALPHA))
+ consume_syntax (context, &token_stack,
+ M4_SYNTAX_ALPHA | M4_SYNTAX_NUM);
+ type = M4_TOKEN_WORD;
+ }
+ else
+ type = M4_TOKEN_SIMPLE; /* escape before eof */
}
else if (m4_has_syntax (M4SYNTAX, ch, M4_SYNTAX_ALPHA))
{
- type = (m4_is_syntax_macro_escaped (M4SYNTAX)
- ? M4_TOKEN_STRING : M4_TOKEN_WORD);
- if (type == M4_TOKEN_STRING && obs)
- obs_safe = obs;
- obstack_1grow (obs_safe, ch);
- consume_syntax (context, obs_safe, M4_SYNTAX_ALPHA | M4_SYNTAX_NUM);
+ type = (m4_is_syntax_macro_escaped (M4SYNTAX)
+ ? M4_TOKEN_STRING : M4_TOKEN_WORD);
+ if (type == M4_TOKEN_STRING && obs)
+ obs_safe = obs;
+ obstack_1grow (obs_safe, ch);
+ consume_syntax (context, obs_safe, M4_SYNTAX_ALPHA | M4_SYNTAX_NUM);
}
else if (MATCH (context, ch, M4_SYNTAX_LQUOTE,
- context->syntax->quote.str1,
- context->syntax->quote.len1, true))
+ context->syntax->quote.str1,
+ context->syntax->quote.len1, true))
{ /* QUOTED STRING */
- if (obs)
- obs_safe = obs;
- quote_level = 1;
- type = M4_TOKEN_STRING;
- while (1)
- {
- /* Start with buffer search for either potential delimiter. */
- size_t len;
- const char *buffer = next_buffer (context, &len,
- obs && m4__quote_age (M4SYNTAX));
- if (buffer)
- {
- const char *p = buffer;
- if (m4_is_syntax_single_quotes (M4SYNTAX))
- do
- {
- p = (char *) memchr2 (p, *context->syntax->quote.str1,
- *context->syntax->quote.str2,
- buffer + len - p);
- }
- while (p && m4__quote_age (M4SYNTAX)
- && (*p++ == *context->syntax->quote.str2
- ? --quote_level : ++quote_level));
- else
- {
- size_t remaining = len;
- assert (context->syntax->quote.len1 == 1
- && context->syntax->quote.len2 == 1);
- while (remaining && !m4_has_syntax (M4SYNTAX, *p,
- (M4_SYNTAX_LQUOTE
- | M4_SYNTAX_RQUOTE)))
- {
- p++;
- remaining--;
- }
- if (!remaining)
- p = NULL;
- }
- if (p)
- {
- if (m4__quote_age (M4SYNTAX))
- {
- assert (!quote_level
- && context->syntax->quote.len1 == 1
- && context->syntax->quote.len2 == 1);
- obstack_grow (obs_safe, buffer, p - buffer - 1);
- consume_buffer (context, p - buffer);
- break;
- }
- obstack_grow (obs_safe, buffer, p - buffer);
- ch = to_uchar (*p);
- consume_buffer (context, p - buffer + 1);
- }
- else
- {
- obstack_grow (obs_safe, buffer, len);
- consume_buffer (context, len);
- continue;
- }
- }
- /* Fall back to byte-wise search. */
- else
- ch = next_char (context, obs && m4__quote_age (M4SYNTAX), false,
- false);
- if (ch == CHAR_EOF)
- {
- if (!caller)
- {
- assert (line);
- m4_set_current_file (context, file);
- m4_set_current_line (context, *line);
- }
- m4_error (context, EXIT_FAILURE, 0, caller,
- _("end of file in string"));
- }
- if (ch == CHAR_BUILTIN)
- init_builtin_token (context, obs, obs ? token : NULL);
- else if (ch == CHAR_QUOTE)
- append_quote_token (context, obs, token);
- else if (MATCH (context, ch, M4_SYNTAX_RQUOTE,
- context->syntax->quote.str2,
- context->syntax->quote.len2, true))
- {
- if (--quote_level == 0)
- break;
- if (1 < context->syntax->quote.len2)
- obstack_grow (obs_safe, context->syntax->quote.str2,
- context->syntax->quote.len2);
- else
- obstack_1grow (obs_safe, ch);
- }
- else if (MATCH (context, ch, M4_SYNTAX_LQUOTE,
- context->syntax->quote.str1,
- context->syntax->quote.len1, true))
- {
- quote_level++;
- if (1 < context->syntax->quote.len1)
- obstack_grow (obs_safe, context->syntax->quote.str1,
- context->syntax->quote.len1);
- else
- obstack_1grow (obs_safe, ch);
- }
- else
- obstack_1grow (obs_safe, ch);
- }
+ if (obs)
+ obs_safe = obs;
+ quote_level = 1;
+ type = M4_TOKEN_STRING;
+ while (1)
+ {
+ /* Start with buffer search for either potential delimiter. */
+ size_t len;
+ const char *buffer = next_buffer (context, &len,
+ obs && m4__quote_age (M4SYNTAX));
+ if (buffer)
+ {
+ const char *p = buffer;
+ if (m4_is_syntax_single_quotes (M4SYNTAX))
+ do
+ {
+ p = (char *) memchr2 (p, *context->syntax->quote.str1,
+ *context->syntax->quote.str2,
+ buffer + len - p);
+ }
+ while (p && m4__quote_age (M4SYNTAX)
+ && (*p++ == *context->syntax->quote.str2
+ ? --quote_level : ++quote_level));
+ else
+ {
+ size_t remaining = len;
+ assert (context->syntax->quote.len1 == 1
+ && context->syntax->quote.len2 == 1);
+ while (remaining && !m4_has_syntax (M4SYNTAX, *p,
+ (M4_SYNTAX_LQUOTE
+ | M4_SYNTAX_RQUOTE)))
+ {
+ p++;
+ remaining--;
+ }
+ if (!remaining)
+ p = NULL;
+ }
+ if (p)
+ {
+ if (m4__quote_age (M4SYNTAX))
+ {
+ assert (!quote_level
+ && context->syntax->quote.len1 == 1
+ && context->syntax->quote.len2 == 1);
+ obstack_grow (obs_safe, buffer, p - buffer - 1);
+ consume_buffer (context, p - buffer);
+ break;
+ }
+ obstack_grow (obs_safe, buffer, p - buffer);
+ ch = to_uchar (*p);
+ consume_buffer (context, p - buffer + 1);
+ }
+ else
+ {
+ obstack_grow (obs_safe, buffer, len);
+ consume_buffer (context, len);
+ continue;
+ }
+ }
+ /* Fall back to byte-wise search. */
+ else
+ ch = next_char (context, obs && m4__quote_age (M4SYNTAX), false,
+ false);
+ if (ch == CHAR_EOF)
+ {
+ if (!caller)
+ {
+ assert (line);
+ m4_set_current_file (context, file);
+ m4_set_current_line (context, *line);
+ }
+ m4_error (context, EXIT_FAILURE, 0, caller,
+ _("end of file in string"));
+ }
+ if (ch == CHAR_BUILTIN)
+ init_builtin_token (context, obs, obs ? token : NULL);
+ else if (ch == CHAR_QUOTE)
+ append_quote_token (context, obs, token);
+ else if (MATCH (context, ch, M4_SYNTAX_RQUOTE,
+ context->syntax->quote.str2,
+ context->syntax->quote.len2, true))
+ {
+ if (--quote_level == 0)
+ break;
+ if (1 < context->syntax->quote.len2)
+ obstack_grow (obs_safe, context->syntax->quote.str2,
+ context->syntax->quote.len2);
+ else
+ obstack_1grow (obs_safe, ch);
+ }
+ else if (MATCH (context, ch, M4_SYNTAX_LQUOTE,
+ context->syntax->quote.str1,
+ context->syntax->quote.len1, true))
+ {
+ quote_level++;
+ if (1 < context->syntax->quote.len1)
+ obstack_grow (obs_safe, context->syntax->quote.str1,
+ context->syntax->quote.len1);
+ else
+ obstack_1grow (obs_safe, ch);
+ }
+ else
+ obstack_1grow (obs_safe, ch);
+ }
}
else if (MATCH (context, ch, M4_SYNTAX_BCOMM,
- context->syntax->comm.str1,
- context->syntax->comm.len1, true))
+ context->syntax->comm.str1,
+ context->syntax->comm.len1, true))
{ /* COMMENT */
- if (obs && !m4_get_discard_comments_opt (context))
- obs_safe = obs;
- if (1 < context->syntax->comm.len1)
- obstack_grow (obs_safe, context->syntax->comm.str1,
- context->syntax->comm.len1);
- else
- obstack_1grow (obs_safe, ch);
- while (1)
- {
- /* Start with buffer search for potential end delimiter. */
- size_t len;
- const char *buffer = next_buffer (context, &len, false);
- if (buffer)
- {
- const char *p;
- if (m4_is_syntax_single_comments (M4SYNTAX))
- p = (char *) memchr (buffer, *context->syntax->comm.str2,
- len);
- else
- {
- size_t remaining = len;
- assert (context->syntax->comm.len2 == 1);
- p = buffer;
- while (remaining
- && !m4_has_syntax (M4SYNTAX, *p, M4_SYNTAX_ECOMM))
- {
- p++;
- remaining--;
- }
- if (!remaining)
- p = NULL;
- }
- if (p)
- {
- obstack_grow (obs_safe, buffer, p - buffer);
- ch = to_uchar (*p);
- consume_buffer (context, p - buffer + 1);
- }
- else
- {
- obstack_grow (obs_safe, buffer, len);
- consume_buffer (context, len);
- continue;
- }
- }
- /* Fall back to byte-wise search. */
- else
- ch = next_char (context, false, false, false);
- if (ch == CHAR_EOF)
- {
- if (!caller)
- {
- assert (line);
- m4_set_current_file (context, file);
- m4_set_current_line (context, *line);
- }
- m4_error (context, EXIT_FAILURE, 0, caller,
- _("end of file in comment"));
- }
- if (ch == CHAR_BUILTIN)
- {
- init_builtin_token (context, NULL, NULL);
- continue;
- }
- if (MATCH (context, ch, M4_SYNTAX_ECOMM,
- context->syntax->comm.str2,
- context->syntax->comm.len2, true))
- {
- if (1 < context->syntax->comm.len2)
- obstack_grow (obs_safe, context->syntax->comm.str2,
- context->syntax->comm.len2);
- else
- obstack_1grow (obs_safe, ch);
- break;
- }
- assert (ch < CHAR_EOF);
- obstack_1grow (obs_safe, ch);
- }
- type = (m4_get_discard_comments_opt (context)
- ? M4_TOKEN_NONE : M4_TOKEN_COMMENT);
+ if (obs && !m4_get_discard_comments_opt (context))
+ obs_safe = obs;
+ if (1 < context->syntax->comm.len1)
+ obstack_grow (obs_safe, context->syntax->comm.str1,
+ context->syntax->comm.len1);
+ else
+ obstack_1grow (obs_safe, ch);
+ while (1)
+ {
+ /* Start with buffer search for potential end delimiter. */
+ size_t len;
+ const char *buffer = next_buffer (context, &len, false);
+ if (buffer)
+ {
+ const char *p;
+ if (m4_is_syntax_single_comments (M4SYNTAX))
+ p = (char *) memchr (buffer, *context->syntax->comm.str2,
+ len);
+ else
+ {
+ size_t remaining = len;
+ assert (context->syntax->comm.len2 == 1);
+ p = buffer;
+ while (remaining
+ && !m4_has_syntax (M4SYNTAX, *p, M4_SYNTAX_ECOMM))
+ {
+ p++;
+ remaining--;
+ }
+ if (!remaining)
+ p = NULL;
+ }
+ if (p)
+ {
+ obstack_grow (obs_safe, buffer, p - buffer);
+ ch = to_uchar (*p);
+ consume_buffer (context, p - buffer + 1);
+ }
+ else
+ {
+ obstack_grow (obs_safe, buffer, len);
+ consume_buffer (context, len);
+ continue;
+ }
+ }
+ /* Fall back to byte-wise search. */
+ else
+ ch = next_char (context, false, false, false);
+ if (ch == CHAR_EOF)
+ {
+ if (!caller)
+ {
+ assert (line);
+ m4_set_current_file (context, file);
+ m4_set_current_line (context, *line);
+ }
+ m4_error (context, EXIT_FAILURE, 0, caller,
+ _("end of file in comment"));
+ }
+ if (ch == CHAR_BUILTIN)
+ {
+ init_builtin_token (context, NULL, NULL);
+ continue;
+ }
+ if (MATCH (context, ch, M4_SYNTAX_ECOMM,
+ context->syntax->comm.str2,
+ context->syntax->comm.len2, true))
+ {
+ if (1 < context->syntax->comm.len2)
+ obstack_grow (obs_safe, context->syntax->comm.str2,
+ context->syntax->comm.len2);
+ else
+ obstack_1grow (obs_safe, ch);
+ break;
+ }
+ assert (ch < CHAR_EOF);
+ obstack_1grow (obs_safe, ch);
+ }
+ type = (m4_get_discard_comments_opt (context)
+ ? M4_TOKEN_NONE : M4_TOKEN_COMMENT);
}
else if (m4_has_syntax (M4SYNTAX, ch, M4_SYNTAX_ACTIVE))
{ /* ACTIVE CHARACTER */
- obstack_1grow (&token_stack, ch);
- type = M4_TOKEN_WORD;
+ obstack_1grow (&token_stack, ch);
+ type = M4_TOKEN_WORD;
}
else if (m4_has_syntax (M4SYNTAX, ch, M4_SYNTAX_OPEN))
{ /* OPEN PARENTHESIS */
- obstack_1grow (&token_stack, ch);
- type = M4_TOKEN_OPEN;
+ obstack_1grow (&token_stack, ch);
+ type = M4_TOKEN_OPEN;
}
else if (m4_has_syntax (M4SYNTAX, ch, M4_SYNTAX_COMMA))
{ /* COMMA */
- obstack_1grow (&token_stack, ch);
- type = M4_TOKEN_COMMA;
+ obstack_1grow (&token_stack, ch);
+ type = M4_TOKEN_COMMA;
}
else if (m4_has_syntax (M4SYNTAX, ch, M4_SYNTAX_CLOSE))
{ /* CLOSE PARENTHESIS */
- obstack_1grow (&token_stack, ch);
- type = M4_TOKEN_CLOSE;
+ obstack_1grow (&token_stack, ch);
+ type = M4_TOKEN_CLOSE;
}
else
{ /* EVERYTHING ELSE */
- assert (ch < CHAR_EOF);
- obstack_1grow (&token_stack, ch);
- if (m4_has_syntax (M4SYNTAX, ch, M4_SYNTAX_OTHER | M4_SYNTAX_NUM))
- {
- if (obs)
- {
- obs_safe = obs;
- obstack_1grow (obs, ch);
- }
- if (m4__safe_quotes (M4SYNTAX))
- consume_syntax (context, obs_safe,
- M4_SYNTAX_OTHER | M4_SYNTAX_NUM);
- type = M4_TOKEN_STRING;
- }
- else if (m4_has_syntax (M4SYNTAX, ch, M4_SYNTAX_SPACE))
- {
- /* Coalescing newlines when interactive or when synclines
- are enabled is wrong. */
- if (!m4_get_interactive_opt (context)
- && !m4_get_syncoutput_opt (context)
- && m4__safe_quotes (M4SYNTAX))
- consume_syntax (context, &token_stack, M4_SYNTAX_SPACE);
- type = M4_TOKEN_SPACE;
- }
- else
- type = M4_TOKEN_SIMPLE;
+ assert (ch < CHAR_EOF);
+ obstack_1grow (&token_stack, ch);
+ if (m4_has_syntax (M4SYNTAX, ch, M4_SYNTAX_OTHER | M4_SYNTAX_NUM))
+ {
+ if (obs)
+ {
+ obs_safe = obs;
+ obstack_1grow (obs, ch);
+ }
+ if (m4__safe_quotes (M4SYNTAX))
+ consume_syntax (context, obs_safe,
+ M4_SYNTAX_OTHER | M4_SYNTAX_NUM);
+ type = M4_TOKEN_STRING;
+ }
+ else if (m4_has_syntax (M4SYNTAX, ch, M4_SYNTAX_SPACE))
+ {
+ /* Coalescing newlines when interactive or when synclines
+ are enabled is wrong. */
+ if (!m4_get_interactive_opt (context)
+ && !m4_get_syncoutput_opt (context)
+ && m4__safe_quotes (M4SYNTAX))
+ consume_syntax (context, &token_stack, M4_SYNTAX_SPACE);
+ type = M4_TOKEN_SPACE;
+ }
+ else
+ type = M4_TOKEN_SIMPLE;
}
} while (type == M4_TOKEN_NONE);
if (token->type == M4_SYMBOL_VOID)
{
if (obs_safe != obs)
- {
- len = obstack_object_size (&token_stack);
- obstack_1grow (&token_stack, '\0');
+ {
+ len = obstack_object_size (&token_stack);
+ obstack_1grow (&token_stack, '\0');
- m4_set_symbol_value_text (token, obstack_finish (&token_stack), len,
- m4__quote_age (M4SYNTAX));
- }
+ m4_set_symbol_value_text (token, obstack_finish (&token_stack), len,
+ m4__quote_age (M4SYNTAX));
+ }
else
- assert (type == M4_TOKEN_STRING || type == M4_TOKEN_COMMENT);
+ assert (type == M4_TOKEN_STRING || type == M4_TOKEN_COMMENT);
}
else
assert (token->type == M4_SYMBOL_COMP
- && (type == M4_TOKEN_STRING || type == M4_TOKEN_COMMENT));
+ && (type == M4_TOKEN_STRING || type == M4_TOKEN_COMMENT));
VALUE_MAX_ARGS (token) = -1;
#ifdef DEBUG_INPUT
@@ -2119,7 +2119,7 @@ m4__next_token (m4 *context, m4_symbol_value *token, int *line,
obstack_1grow (&token_stack, '\0');
m4_set_symbol_value_text (token, obstack_finish (&token_stack), len,
- m4__quote_age (M4SYNTAX));
+ m4__quote_age (M4SYNTAX));
}
m4_print_token (context, "next_token", type, token);
@@ -2139,12 +2139,12 @@ m4__next_token_is_open (m4 *context)
if (ch == CHAR_EOF || ch == CHAR_BUILTIN
|| m4_has_syntax (M4SYNTAX, ch, (M4_SYNTAX_BCOMM | M4_SYNTAX_ESCAPE
- | M4_SYNTAX_ALPHA | M4_SYNTAX_LQUOTE
- | M4_SYNTAX_ACTIVE))
+ | M4_SYNTAX_ALPHA | M4_SYNTAX_LQUOTE
+ | M4_SYNTAX_ACTIVE))
|| (MATCH (context, ch, M4_SYNTAX_BCOMM, context->syntax->comm.str1,
- context->syntax->comm.len1, false))
+ context->syntax->comm.len1, false))
|| (MATCH (context, ch, M4_SYNTAX_LQUOTE, context->syntax->quote.str1,
- context->syntax->quote.len1, false)))
+ context->syntax->quote.len1, false)))
return false;
return m4_has_syntax (M4SYNTAX, ch, M4_SYNTAX_OPEN);
}
@@ -2154,7 +2154,7 @@ m4__next_token_is_open (m4 *context)
int
m4_print_token (m4 *context, const char *s, m4__token_type type,
- m4_symbol_value *token)
+ m4_symbol_value *token)
{
m4_obstack obs;
size_t len;
@@ -2209,11 +2209,11 @@ m4_print_token (m4 *context, const char *s, m4__token_type type,
{
obstack_init (&obs);
m4__symbol_value_print (context, token, &obs, NULL, false, NULL, NULL,
- true);
+ true);
len = obstack_object_size (&obs);
xfprintf (stderr, "%s\n", quotearg_style_mem (c_maybe_quoting_style,
- obstack_finish (&obs),
- len));
+ obstack_finish (&obs),
+ len));
obstack_free (&obs, NULL);
}
else
diff --git a/m4/m4.c b/m4/m4.c
index 61ebe07f..49604e07 100644
--- a/m4/m4.c
+++ b/m4/m4.c
@@ -70,27 +70,27 @@ m4_delete (m4 *context)
m4__search_path *path = context->search_path->list;
while (path)
- {
- m4__search_path *stale = path;
- path = path->next;
+ {
+ m4__search_path *stale = path;
+ path = path->next;
- free ((void*) stale->dir);
- free (stale);
- }
+ free ((void*) stale->dir);
+ free (stale);
+ }
free (context->search_path);
}
for (i = 0; i < context->stacks_count; i++)
{
assert (context->arg_stacks[i].refcount == 0
- && context->arg_stacks[i].argcount == 0);
+ && context->arg_stacks[i].argcount == 0);
if (context->arg_stacks[i].args)
- {
- obstack_free (context->arg_stacks[i].args, NULL);
- free (context->arg_stacks[i].args);
- obstack_free (context->arg_stacks[i].argv, NULL);
- free (context->arg_stacks[i].argv);
- }
+ {
+ obstack_free (context->arg_stacks[i].args, NULL);
+ free (context->arg_stacks[i].args);
+ obstack_free (context->arg_stacks[i].argv, NULL);
+ free (context->arg_stacks[i].argv);
+ }
}
free (context->arg_stacks);
@@ -104,41 +104,41 @@ m4_delete (m4 *context)
name to protect against macro expansion from the fast macros used to
replace these functions when NDEBUG is defined. */
#define M4FIELD(type, base, field) \
- type (CONC(m4_get_, base)) (m4 *context) \
- { \
- assert (context); \
- return context->field; \
- }
+ type (CONC(m4_get_, base)) (m4 *context) \
+ { \
+ assert (context); \
+ return context->field; \
+ }
m4_context_field_table
#undef M4FIELD
#define M4FIELD(type, base, field) \
- type (CONC(m4_set_, base)) (m4 *context, type value) \
- { \
- assert (context); \
- return context->field = value; \
- }
+ type (CONC(m4_set_, base)) (m4 *context, type value) \
+ { \
+ assert (context); \
+ return context->field = value; \
+ }
m4_context_field_table
#undef M4FIELD
#define M4OPT_BIT(bit, base) \
- bool (CONC(m4_get_, base)) (m4 *context) \
- { \
- assert (context); \
- return BIT_TEST (context->opt_flags, (bit)); \
- }
+ bool (CONC(m4_get_, base)) (m4 *context) \
+ { \
+ assert (context); \
+ return BIT_TEST (context->opt_flags, (bit)); \
+ }
m4_context_opt_bit_table
#undef M4OPT_BIT
#define M4OPT_BIT(bit, base) \
- bool (CONC(m4_set_, base)) (m4 *context, bool value) \
- { \
- assert (context); \
- if (value) \
- BIT_SET (context->opt_flags, (bit)); \
- else \
- BIT_RESET (context->opt_flags, (bit)); \
- return value; \
- }
+ bool (CONC(m4_set_, base)) (m4 *context, bool value) \
+ { \
+ assert (context); \
+ if (value) \
+ BIT_SET (context->opt_flags, (bit)); \
+ else \
+ BIT_RESET (context->opt_flags, (bit)); \
+ return value; \
+ }
m4_context_opt_bit_table
#undef M4OPT_BIT
diff --git a/m4/m4module.h b/m4/m4module.h
index d06ce79d..d1bd4aec 100644
--- a/m4/m4module.h
+++ b/m4/m4module.h
@@ -169,11 +169,11 @@ struct m4_string_pair
#define M4ARGLEN(i) m4_arg_len (context, argv, i, false)
extern bool m4_bad_argc (m4 *, size_t, const m4_call_info *, size_t,
- size_t, bool);
+ size_t, bool);
extern bool m4_numeric_arg (m4 *, const m4_call_info *, const char *,
- size_t, int *);
+ size_t, int *);
extern bool m4_parse_truth_arg (m4 *, const m4_call_info *, const char *,
- size_t, bool);
+ size_t, bool);
extern m4_symbol *m4_symbol_value_lookup (m4 *, m4_macro_args *, size_t, bool);
extern const char *m4_info_name (const m4_call_info *);
@@ -197,36 +197,36 @@ extern m4 * m4_create (void);
extern void m4_delete (m4 *);
#define m4_context_field_table \
- M4FIELD(m4_symbol_table *, symbol_table, symtab) \
- M4FIELD(m4_syntax_table *, syntax_table, syntax) \
- M4FIELD(const char *, current_file, current_file) \
- M4FIELD(int, current_line, current_line) \
- M4FIELD(int, output_line, output_line) \
- M4FIELD(FILE *, debug_file, debug_file) \
- M4FIELD(m4_obstack, trace_messages, trace_messages) \
- M4FIELD(int, exit_status, exit_status) \
- M4FIELD(int, current_diversion, current_diversion) \
- M4FIELD(size_t, nesting_limit_opt, nesting_limit) \
- M4FIELD(int, debug_level_opt, debug_level) \
- M4FIELD(size_t, max_debug_arg_length_opt, max_debug_arg_length)\
- M4FIELD(int, regexp_syntax_opt, regexp_syntax) \
+ M4FIELD(m4_symbol_table *, symbol_table, symtab) \
+ M4FIELD(m4_syntax_table *, syntax_table, syntax) \
+ M4FIELD(const char *, current_file, current_file) \
+ M4FIELD(int, current_line, current_line) \
+ M4FIELD(int, output_line, output_line) \
+ M4FIELD(FILE *, debug_file, debug_file) \
+ M4FIELD(m4_obstack, trace_messages, trace_messages) \
+ M4FIELD(int, exit_status, exit_status) \
+ M4FIELD(int, current_diversion, current_diversion) \
+ M4FIELD(size_t, nesting_limit_opt, nesting_limit) \
+ M4FIELD(int, debug_level_opt, debug_level) \
+ M4FIELD(size_t, max_debug_arg_length_opt, max_debug_arg_length)\
+ M4FIELD(int, regexp_syntax_opt, regexp_syntax) \
#define m4_context_opt_bit_table \
- M4OPT_BIT(M4_OPT_PREFIX_BUILTINS_BIT, prefix_builtins_opt) \
- M4OPT_BIT(M4_OPT_SUPPRESS_WARN_BIT, suppress_warnings_opt) \
- M4OPT_BIT(M4_OPT_DISCARD_COMMENTS_BIT, discard_comments_opt) \
- M4OPT_BIT(M4_OPT_INTERACTIVE_BIT, interactive_opt) \
- M4OPT_BIT(M4_OPT_SYNCOUTPUT_BIT, syncoutput_opt) \
- M4OPT_BIT(M4_OPT_POSIXLY_CORRECT_BIT, posixly_correct_opt) \
- M4OPT_BIT(M4_OPT_FATAL_WARN_BIT, fatal_warnings_opt) \
- M4OPT_BIT(M4_OPT_WARN_EXIT_BIT, warnings_exit_opt) \
- M4OPT_BIT(M4_OPT_SAFER_BIT, safer_opt) \
+ M4OPT_BIT(M4_OPT_PREFIX_BUILTINS_BIT, prefix_builtins_opt) \
+ M4OPT_BIT(M4_OPT_SUPPRESS_WARN_BIT, suppress_warnings_opt) \
+ M4OPT_BIT(M4_OPT_DISCARD_COMMENTS_BIT, discard_comments_opt) \
+ M4OPT_BIT(M4_OPT_INTERACTIVE_BIT, interactive_opt) \
+ M4OPT_BIT(M4_OPT_SYNCOUTPUT_BIT, syncoutput_opt) \
+ M4OPT_BIT(M4_OPT_POSIXLY_CORRECT_BIT, posixly_correct_opt) \
+ M4OPT_BIT(M4_OPT_FATAL_WARN_BIT, fatal_warnings_opt) \
+ M4OPT_BIT(M4_OPT_WARN_EXIT_BIT, warnings_exit_opt) \
+ M4OPT_BIT(M4_OPT_SAFER_BIT, safer_opt) \
#define M4FIELD(type, base, field) \
- extern type CONC (m4_get_, base) (m4 *context); \
- extern type CONC (m4_set_, base) (m4 *context, type value);
+ extern type CONC (m4_get_, base) (m4 *context); \
+ extern type CONC (m4_set_, base) (m4 *context, type value);
m4_context_field_table
#undef M4FIELD
@@ -251,7 +251,7 @@ extern const char * m4_module_makeresident (m4_module *);
extern int m4_module_refcount (const m4_module *);
extern void m4_module_unload (m4 *, const char *, m4_obstack *);
extern void * m4_module_import (m4 *, const char *, const char *,
- m4_obstack *);
+ m4_obstack *);
extern const char * m4_get_module_name (const m4_module *);
extern void m4__module_exit (m4 *);
@@ -262,21 +262,21 @@ extern void m4__module_exit (m4 *);
typedef void *m4_symtab_apply_func (m4_symbol_table *, const char *, size_t,
- m4_symbol *, void *);
+ m4_symbol *, void *);
extern m4_symbol_table *m4_symtab_create (size_t);
extern void m4_symtab_delete (m4_symbol_table *);
extern void * m4_symtab_apply (m4_symbol_table *, bool,
- m4_symtab_apply_func *, void *);
+ m4_symtab_apply_func *, void *);
extern m4_symbol *m4_symbol_lookup (m4_symbol_table *, const char *, size_t);
extern m4_symbol *m4_symbol_pushdef (m4_symbol_table *, const char *, size_t,
- m4_symbol_value *);
+ m4_symbol_value *);
extern m4_symbol *m4_symbol_define (m4_symbol_table *, const char *, size_t,
- m4_symbol_value *);
+ m4_symbol_value *);
extern void m4_symbol_popdef (m4_symbol_table *, const char *, size_t);
extern m4_symbol *m4_symbol_rename (m4_symbol_table *, const char *, size_t,
- const char *, size_t);
+ const char *, size_t);
extern void m4_symbol_delete (m4_symbol_table *, const char *, size_t);
@@ -289,37 +289,37 @@ extern void m4_symbol_delete (m4_symbol_table *, const char *, size_t);
extern m4_symbol_value *m4_get_symbol_value (m4_symbol *);
extern bool m4_get_symbol_traced (m4_symbol *);
extern bool m4_set_symbol_name_traced (m4_symbol_table *,
- const char *, size_t, bool);
+ const char *, size_t, bool);
extern void m4_symbol_print (m4 *, m4_symbol *, m4_obstack *,
- const m4_string_pair *, bool, size_t,
- bool);
+ const m4_string_pair *, bool, size_t,
+ bool);
extern bool m4_symbol_value_flatten_args (m4_symbol_value *);
#define m4_is_symbol_void(symbol) \
- (m4_is_symbol_value_void (m4_get_symbol_value (symbol)))
+ (m4_is_symbol_value_void (m4_get_symbol_value (symbol)))
#define m4_is_symbol_text(symbol) \
- (m4_is_symbol_value_text (m4_get_symbol_value (symbol)))
+ (m4_is_symbol_value_text (m4_get_symbol_value (symbol)))
#define m4_is_symbol_func(symbol) \
- (m4_is_symbol_value_func (m4_get_symbol_value (symbol)))
+ (m4_is_symbol_value_func (m4_get_symbol_value (symbol)))
#define m4_is_symbol_placeholder(symbol) \
- (m4_is_symbol_value_placeholder (m4_get_symbol_value (symbol)))
+ (m4_is_symbol_value_placeholder (m4_get_symbol_value (symbol)))
#define m4_get_symbol_text(symbol) \
- (m4_get_symbol_value_text (m4_get_symbol_value (symbol)))
+ (m4_get_symbol_value_text (m4_get_symbol_value (symbol)))
#define m4_get_symbol_len(symbol) \
- (m4_get_symbol_value_len (m4_get_symbol_value (symbol)))
+ (m4_get_symbol_value_len (m4_get_symbol_value (symbol)))
#define m4_get_symbol_func(symbol) \
- (m4_get_symbol_value_func (m4_get_symbol_value (symbol)))
+ (m4_get_symbol_value_func (m4_get_symbol_value (symbol)))
#define m4_get_symbol_builtin(symbol) \
- (m4_get_symbol_value_builtin (m4_get_symbol_value (symbol)))
+ (m4_get_symbol_value_builtin (m4_get_symbol_value (symbol)))
#define m4_get_symbol_placeholder(symbol) \
- (m4_get_symbol_value_placeholder (m4_get_symbol_value (symbol)))
+ (m4_get_symbol_value_placeholder (m4_get_symbol_value (symbol)))
#define m4_symbol_flatten_args(symbol) \
- (m4_symbol_value_flatten_args (m4_get_symbol_value (symbol)))
+ (m4_symbol_value_flatten_args (m4_get_symbol_value (symbol)))
extern m4_symbol_value *m4_symbol_value_create (void);
extern void m4_symbol_value_delete (m4_symbol_value *);
extern bool m4_symbol_value_copy (m4 *, m4_symbol_value *,
- m4_symbol_value *);
+ m4_symbol_value *);
extern bool m4_is_symbol_value_text (m4_symbol_value *);
extern bool m4_is_symbol_value_func (m4_symbol_value *);
extern bool m4_is_symbol_value_placeholder (m4_symbol_value *);
@@ -334,10 +334,10 @@ extern const m4_builtin *m4_get_symbol_value_builtin (m4_symbol_value *);
extern const char * m4_get_symbol_value_placeholder (m4_symbol_value *);
extern void m4_set_symbol_value_text (m4_symbol_value *,
- const char *, size_t,
- unsigned int);
+ const char *, size_t,
+ unsigned int);
extern void m4_set_symbol_value_placeholder (m4_symbol_value *,
- const char *);
+ const char *);
@@ -345,7 +345,7 @@ extern void m4_set_symbol_value_placeholder (m4_symbol_value *,
extern m4_symbol_value *m4_builtin_find_by_name (m4_module *, const char *);
extern m4_symbol_value *m4_builtin_find_by_func (m4_module *,
- m4_builtin_func *);
+ m4_builtin_func *);
@@ -353,7 +353,7 @@ extern m4_symbol_value *m4_builtin_find_by_func (m4_module *,
extern void m4_macro_expand_input (m4 *);
extern void m4_macro_call (m4 *, m4_symbol_value *, m4_obstack *,
- m4_macro_args *);
+ m4_macro_args *);
extern size_t m4_arg_argc (m4_macro_args *);
extern const m4_call_info *m4_arg_info (m4_macro_args *);
extern m4_symbol_value *m4_arg_symbol (m4_macro_args *, size_t);
@@ -362,17 +362,17 @@ extern bool m4_is_arg_func (m4_macro_args *, size_t);
extern bool m4_is_arg_composite (m4_macro_args *, size_t);
extern const char *m4_arg_text (m4 *, m4_macro_args *, size_t, bool);
extern bool m4_arg_equal (m4 *, m4_macro_args *, size_t,
- size_t);
+ size_t);
extern bool m4_arg_empty (m4_macro_args *, size_t);
extern size_t m4_arg_len (m4 *, m4_macro_args *, size_t, bool);
extern m4_builtin_func *m4_arg_func (m4_macro_args *, size_t);
extern m4_obstack *m4_arg_scratch (m4 *);
extern m4_macro_args *m4_make_argv_ref (m4 *, m4_macro_args *, const char *,
- size_t, bool, bool);
+ size_t, bool, bool);
extern void m4_push_arg (m4 *, m4_obstack *, m4_macro_args *,
- size_t);
+ size_t);
extern void m4_push_args (m4 *, m4_obstack *, m4_macro_args *,
- bool, bool);
+ bool, bool);
extern void m4_wrap_args (m4 *, m4_macro_args *);
@@ -418,20 +418,20 @@ enum {
/* default flags, used by debugmode() -- equiv: +adeq */
#define M4_DEBUG_TRACE_DEFAULT \
- (M4_DEBUG_TRACE_ARGS | M4_DEBUG_TRACE_EXPANSION \
- | M4_DEBUG_TRACE_QUOTE | M4_DEBUG_TRACE_DEREF)
+ (M4_DEBUG_TRACE_ARGS | M4_DEBUG_TRACE_EXPANSION \
+ | M4_DEBUG_TRACE_QUOTE | M4_DEBUG_TRACE_DEREF)
#define m4_is_debug_bit(C,B) ((m4_get_debug_level_opt (C) & (B)) != 0)
extern int m4_debug_decode (m4 *, const char *, size_t);
extern bool m4_debug_set_output (m4 *, const m4_call_info *,
- const char *);
+ const char *);
extern void m4_debug_message_prefix (m4 *);
extern void m4_debug_message (m4 *, int, const char *, ...)
M4_GNUC_PRINTF (3, 4);
extern void m4_trace_prepare (m4 *, const m4_call_info *,
- m4_symbol_value *);
+ m4_symbol_value *);
/* --- REGEXP SYNTAX --- */
@@ -489,12 +489,12 @@ enum {
/* Mask of attribute syntax categories. */
#define M4_SYNTAX_MASKS (M4_SYNTAX_RQUOTE | M4_SYNTAX_ECOMM \
- | M4_SYNTAX_DOLLAR | M4_SYNTAX_LBRACE \
- | M4_SYNTAX_RBRACE)
+ | M4_SYNTAX_DOLLAR | M4_SYNTAX_LBRACE \
+ | M4_SYNTAX_RBRACE)
/* Mask of basic syntax categories where any change requires a
recomputation of the overall syntax characteristics. */
#define M4_SYNTAX_SUSPECT (M4_SYNTAX_LQUOTE | M4_SYNTAX_BCOMM \
- | M4_SYNTAX_ESCAPE)
+ | M4_SYNTAX_ESCAPE)
#define m4_syntab(S, C) ((S)->table[(C)])
/* Determine if character C matches any of the bitwise-or'd syntax
@@ -505,11 +505,11 @@ enum {
((m4_syntab ((S), sizeof (C) == 1 ? to_uchar (C) : (C)) & (T)) > 0)
extern void m4_set_quotes (m4_syntax_table *, const char *, size_t,
- const char *, size_t);
+ const char *, size_t);
extern void m4_set_comment (m4_syntax_table *, const char *, size_t,
- const char *, size_t);
+ const char *, size_t);
extern int m4_set_syntax (m4_syntax_table *, char, char, const char *,
- size_t);
+ size_t);
extern void m4_reset_syntax (m4_syntax_table *);
@@ -537,12 +537,12 @@ extern void m4_output_init (m4 *);
extern void m4_output_exit (void);
extern void m4_output_text (m4 *, const char *, size_t);
extern void m4_divert_text (m4 *, m4_obstack *, const char *,
- size_t, int);
+ size_t, int);
extern void m4_shipout_int (m4_obstack *, int);
extern void m4_shipout_string (m4 *, m4_obstack *, const char *,
- size_t, bool);
+ size_t, bool);
extern bool m4_shipout_string_trunc (m4_obstack *, const char *, size_t,
- const m4_string_pair *, size_t *);
+ const m4_string_pair *, size_t *);
extern void m4_make_diversion (m4 *, int);
extern void m4_insert_diversion (m4 *, int);
diff --git a/m4/m4private.h b/m4/m4private.h
index 36404bdf..d1dc79a2 100644
--- a/m4/m4private.h
+++ b/m4/m4private.h
@@ -124,23 +124,23 @@ struct m4 {
# define m4_set_regexp_syntax_opt(C, V) ((C)->regexp_syntax = (V))
# define m4_get_prefix_builtins_opt(C) \
- (BIT_TEST((C)->opt_flags, M4_OPT_PREFIX_BUILTINS_BIT))
+ (BIT_TEST((C)->opt_flags, M4_OPT_PREFIX_BUILTINS_BIT))
# define m4_get_suppress_warnings_opt(C) \
- (BIT_TEST((C)->opt_flags, M4_OPT_SUPPRESS_WARN_BIT))
+ (BIT_TEST((C)->opt_flags, M4_OPT_SUPPRESS_WARN_BIT))
# define m4_get_discard_comments_opt(C) \
- (BIT_TEST((C)->opt_flags, M4_OPT_DISCARD_COMMENTS_BIT))
+ (BIT_TEST((C)->opt_flags, M4_OPT_DISCARD_COMMENTS_BIT))
# define m4_get_interactive_opt(C) \
- (BIT_TEST((C)->opt_flags, M4_OPT_INTERACTIVE_BIT))
+ (BIT_TEST((C)->opt_flags, M4_OPT_INTERACTIVE_BIT))
# define m4_get_syncoutput_opt(C) \
- (BIT_TEST((C)->opt_flags, M4_OPT_SYNCOUTPUT_BIT))
+ (BIT_TEST((C)->opt_flags, M4_OPT_SYNCOUTPUT_BIT))
# define m4_get_posixly_correct_opt(C) \
- (BIT_TEST((C)->opt_flags, M4_OPT_POSIXLY_CORRECT_BIT))
+ (BIT_TEST((C)->opt_flags, M4_OPT_POSIXLY_CORRECT_BIT))
# define m4_get_fatal_warnings_opt(C) \
- (BIT_TEST((C)->opt_flags, M4_OPT_FATAL_WARN_BIT))
+ (BIT_TEST((C)->opt_flags, M4_OPT_FATAL_WARN_BIT))
# define m4_get_warnings_exit_opt(C) \
- (BIT_TEST((C)->opt_flags, M4_OPT_WARN_EXIT_BIT))
+ (BIT_TEST((C)->opt_flags, M4_OPT_WARN_EXIT_BIT))
# define m4_get_safer_opt(C) \
- (BIT_TEST((C)->opt_flags, M4_OPT_SAFER_BIT))
+ (BIT_TEST((C)->opt_flags, M4_OPT_SAFER_BIT))
/* No fast opt bit set macros, as they would need to evaluate their
arguments more than once, which would subtly change their semantics. */
@@ -165,10 +165,10 @@ struct m4__builtin
typedef struct m4__builtin m4__builtin;
extern void m4__set_symbol_value_builtin (m4_symbol_value *,
- const m4__builtin *);
+ const m4__builtin *);
extern void m4__builtin_print (m4_obstack *, const m4__builtin *, bool,
- m4__symbol_chain **, const m4_string_pair *,
- bool);
+ m4__symbol_chain **, const m4_string_pair *,
+ bool);
/* --- MODULE MANAGEMENT --- */
@@ -190,7 +190,7 @@ struct m4_module
extern void m4__module_init (m4 *context);
extern m4_module * m4__module_open (m4 *context, const char *name,
- m4_obstack *obs);
+ m4_obstack *obs);
extern void m4__module_exit (m4 *context);
extern m4_module * m4__module_next (m4_module *);
extern m4_module * m4__module_find (const char *name);
@@ -273,7 +273,7 @@ struct m4_symbol_value
size_t len; /* Length of string. */
const char * text; /* String contents. */
/* Quote age when this string was built, or zero to force a
- rescan of the string. Ignored for 0 len. */
+ rescan of the string. Ignored for 0 len. */
unsigned int quote_age;
} u_t; /* Valid when type is TEXT, PLACEHOLDER. */
const m4__builtin * builtin;/* Valid when type is FUNC. */
@@ -353,11 +353,11 @@ struct m4_call_info
extern size_t m4__adjust_refcount (m4 *, size_t, bool);
extern bool m4__arg_adjust_refcount (m4 *, m4_macro_args *, bool);
extern void m4__push_arg_quote (m4 *, m4_obstack *, m4_macro_args *,
- size_t, const m4_string_pair *);
+ size_t, const m4_string_pair *);
extern bool m4__arg_print (m4 *, m4_obstack *, m4_macro_args *,
- size_t, const m4_string_pair *, bool,
- m4__symbol_chain **, const char *,
- size_t *, bool, bool);
+ size_t, const m4_string_pair *, bool,
+ m4__symbol_chain **, const char *,
+ size_t *, bool, bool);
#define VALUE_NEXT(T) ((T)->next)
#define VALUE_MODULE(T) ((T)->module)
@@ -388,14 +388,14 @@ extern bool m4__arg_print (m4 *, m4_obstack *, m4_macro_args *,
# define m4_is_symbol_value_func(V) ((V)->type == M4_SYMBOL_FUNC)
# define m4_is_symbol_value_void(V) ((V)->type == M4_SYMBOL_VOID)
# define m4_is_symbol_value_placeholder(V) \
- ((V)->type == M4_SYMBOL_PLACEHOLDER)
+ ((V)->type == M4_SYMBOL_PLACEHOLDER)
# define m4_get_symbol_value_text(V) ((V)->u.u_t.text)
# define m4_get_symbol_value_len(V) ((V)->u.u_t.len)
# define m4_get_symbol_value_quote_age(V) ((V)->u.u_t.quote_age)
# define m4_get_symbol_value_func(V) ((V)->u.builtin->builtin.func)
# define m4_get_symbol_value_builtin(V) (&(V)->u.builtin->builtin)
# define m4_get_symbol_value_placeholder(V) \
- ((V)->u.u_t.text)
+ ((V)->u.u_t.text)
# define m4_symbol_value_flatten_args(V) \
(BIT_TEST ((V)->flags, VALUE_FLATTEN_ARGS_BIT))
@@ -441,10 +441,10 @@ struct m4_symbol_arg {
#define SYMBOL_ARG_KEY_BIT (1 << 1)
extern void m4__symtab_remove_module_references (m4_symbol_table *,
- m4_module *);
+ m4_module *);
extern bool m4__symbol_value_print (m4 *, m4_symbol_value *, m4_obstack *,
- const m4_string_pair *, bool,
- m4__symbol_chain **, size_t *, bool);
+ const m4_string_pair *, bool,
+ m4__symbol_chain **, size_t *, bool);
@@ -537,8 +537,8 @@ struct m4_syntax_table {
/* Set or refresh the cached quote. */
extern const m4_string_pair *m4__quote_cache (m4_syntax_table *,
- m4_obstack *obs, unsigned int,
- const m4_string_pair *);
+ m4_obstack *obs, unsigned int,
+ const m4_string_pair *);
/* Clear the cached quote. */
#define m4__quote_uncache(S) ((S)->cached_quote = NULL)
@@ -563,18 +563,18 @@ typedef enum {
} m4__token_type;
extern void m4__make_text_link (m4_obstack *, m4__symbol_chain **,
- m4__symbol_chain **);
+ m4__symbol_chain **);
extern void m4__append_builtin (m4_obstack *, const m4__builtin *,
- m4__symbol_chain **,
- m4__symbol_chain **);
+ m4__symbol_chain **,
+ m4__symbol_chain **);
extern bool m4__push_symbol (m4 *, m4_symbol_value *, size_t,
- bool);
+ bool);
extern m4_obstack *m4__push_wrapup_init (m4 *, const m4_call_info *,
- m4__symbol_chain ***);
+ m4__symbol_chain ***);
extern void m4__push_wrapup_finish (void);
extern m4__token_type m4__next_token (m4 *, m4_symbol_value *, int *,
- m4_obstack *, bool,
- const m4_call_info *);
+ m4_obstack *, bool,
+ const m4_call_info *);
extern bool m4__next_token_is_open (m4 *);
/* Fast macro versions of macro argv accessor functions,
diff --git a/m4/macro.c b/m4/macro.c
index 08eaf11b..c4a82201 100644
--- a/m4/macro.c
+++ b/m4/macro.c
@@ -64,7 +64,7 @@
thresholds of the input engine, the interesting sequence of events
is as follows:
- stacks[0] refs stacks[1] refs
+ stacks[0] refs stacks[1] refs
after second dnl ends: `' 0 `' 0
expand_macro for x, level 0: `' 1 `' 0
expand_macro for a, level 1: `' 1 `' 1
@@ -121,14 +121,14 @@
*/
static m4_macro_args *collect_arguments (m4 *, m4_call_info *, m4_symbol *,
- m4_obstack *, m4_obstack *);
+ m4_obstack *, m4_obstack *);
static void expand_macro (m4 *, const char *, size_t, m4_symbol *);
static bool expand_token (m4 *, m4_obstack *, m4__token_type,
- m4_symbol_value *, int, bool);
+ m4_symbol_value *, int, bool);
static bool expand_argument (m4 *, m4_obstack *, m4_symbol_value *,
- const m4_call_info *);
+ const m4_call_info *);
static void process_macro (m4 *, m4_symbol_value *, m4_obstack *, int,
- m4_macro_args *);
+ m4_macro_args *);
static unsigned int trace_pre (m4 *, m4_macro_args *);
static void trace_post (m4 *, unsigned int, const m4_call_info *);
@@ -175,7 +175,7 @@ m4_macro_expand_input (m4 *context)
VALUE_MAX_ARGS (&empty_symbol) = -1;
while ((type = m4__next_token (context, &token, &line, NULL, false, NULL))
- != M4_TOKEN_EOF)
+ != M4_TOKEN_EOF)
expand_token (context, NULL, type, &token, line, true);
}
@@ -193,12 +193,12 @@ m4_macro_expand_input (m4 *context)
slower performance. */
static bool
expand_token (m4 *context, m4_obstack *obs, m4__token_type type,
- m4_symbol_value *token, int line, bool first)
+ m4_symbol_value *token, int line, bool first)
{
m4_symbol *symbol;
bool result = false;
const char *text = (m4_is_symbol_value_text (token)
- ? m4_get_symbol_value_text (token) : NULL);
+ ? m4_get_symbol_value_text (token) : NULL);
switch (type)
{ /* TOKSW */
@@ -209,22 +209,22 @@ expand_token (m4 *context, m4_obstack *obs, m4__token_type type,
case M4_TOKEN_STRING:
/* Strings are safe in isolation (since quote_age detects any
- change in delimiters), or when safe_quotes is true. This is
- also returned for sequences of benign characters, such as
- digits. When safe_quotes is false, we could technically
- return true if we can prove that the concatenation of this
- string to prior text does not form a multi-byte quote
- delimiter, but that is a lot of overhead, so we give the
- conservative answer of false. */
+ change in delimiters), or when safe_quotes is true. This is
+ also returned for sequences of benign characters, such as
+ digits. When safe_quotes is false, we could technically
+ return true if we can prove that the concatenation of this
+ string to prior text does not form a multi-byte quote
+ delimiter, but that is a lot of overhead, so we give the
+ conservative answer of false. */
result = first || m4__safe_quotes (M4SYNTAX);
/* fallthru */
case M4_TOKEN_COMMENT:
/* Comments can contain unbalanced quote delimiters. Rather
- than search for one, we return the conservative answer of
- false. If obstack is provided, the string or comment was
- already expanded into it during next_token. */
+ than search for one, we return the conservative answer of
+ false. If obstack is provided, the string or comment was
+ already expanded into it during next_token. */
if (obs)
- return result;
+ return result;
break;
case M4_TOKEN_OPEN:
@@ -232,56 +232,56 @@ expand_token (m4 *context, m4_obstack *obs, m4__token_type type,
case M4_TOKEN_CLOSE:
case M4_TOKEN_SPACE:
/* If safe_quotes is true, then these do not form a quote
- delimiter. If it is false, we give the conservative answer
- of false rather than taking time to prove that no multi-byte
- quote delimiter is formed. */
+ delimiter. If it is false, we give the conservative answer
+ of false rather than taking time to prove that no multi-byte
+ quote delimiter is formed. */
result = m4__safe_quotes (M4SYNTAX);
break;
case M4_TOKEN_SIMPLE:
/* If safe_quotes is true, then all but the single-byte end
- quote delimiter is safe in a quoted context; a single-byte
- start delimiter will trigger M4_TOKEN_STRING instead. If
- safe_quotes is false, we give the conservative answer of
- false rather than taking time to prove that no multi-byte
- quote delimiter is formed. */
+ quote delimiter is safe in a quoted context; a single-byte
+ start delimiter will trigger M4_TOKEN_STRING instead. If
+ safe_quotes is false, we give the conservative answer of
+ false rather than taking time to prove that no multi-byte
+ quote delimiter is formed. */
result = (!m4_has_syntax (M4SYNTAX, *text, M4_SYNTAX_RQUOTE)
- && m4__safe_quotes (M4SYNTAX));
+ && m4__safe_quotes (M4SYNTAX));
if (result)
- assert (!m4_has_syntax (M4SYNTAX, *text, M4_SYNTAX_LQUOTE));
+ assert (!m4_has_syntax (M4SYNTAX, *text, M4_SYNTAX_LQUOTE));
break;
case M4_TOKEN_WORD:
{
- const char *textp = text;
- size_t len = m4_get_symbol_value_len (token);
- size_t len2 = len;
-
- if (m4_has_syntax (M4SYNTAX, *textp, M4_SYNTAX_ESCAPE))
- {
- textp++;
- len2--;
- }
-
- symbol = m4_symbol_lookup (M4SYMTAB, textp, len2);
- assert (!symbol || !m4_is_symbol_void (symbol));
- if (symbol == NULL
- || (symbol->value->type == M4_SYMBOL_FUNC
- && BIT_TEST (SYMBOL_FLAGS (symbol), VALUE_BLIND_ARGS_BIT)
- && !m4__next_token_is_open (context)))
- {
- m4_divert_text (context, obs, text, len, line);
- /* If safe_quotes is true, then words do not overlap with
- quote delimiters. If it is false, we give the
- conservative answer of false rather than prove that no
- multi-byte delimiters are formed. */
- return m4__safe_quotes (M4SYNTAX);
- }
- expand_macro (context, textp, len2, symbol);
- /* Expanding a macro may create new tokens to scan, and those
- tokens may generate unsafe text, but we did not append any
- text now. */
- return true;
+ const char *textp = text;
+ size_t len = m4_get_symbol_value_len (token);
+ size_t len2 = len;
+
+ if (m4_has_syntax (M4SYNTAX, *textp, M4_SYNTAX_ESCAPE))
+ {
+ textp++;
+ len2--;
+ }
+
+ symbol = m4_symbol_lookup (M4SYMTAB, textp, len2);
+ assert (!symbol || !m4_is_symbol_void (symbol));
+ if (symbol == NULL
+ || (symbol->value->type == M4_SYMBOL_FUNC
+ && BIT_TEST (SYMBOL_FLAGS (symbol), VALUE_BLIND_ARGS_BIT)
+ && !m4__next_token_is_open (context)))
+ {
+ m4_divert_text (context, obs, text, len, line);
+ /* If safe_quotes is true, then words do not overlap with
+ quote delimiters. If it is false, we give the
+ conservative answer of false rather than prove that no
+ multi-byte delimiters are formed. */
+ return m4__safe_quotes (M4SYNTAX);
+ }
+ expand_macro (context, textp, len2, symbol);
+ /* Expanding a macro may create new tokens to scan, and those
+ tokens may generate unsafe text, but we did not append any
+ text now. */
+ return true;
}
default:
@@ -303,7 +303,7 @@ expand_token (m4 *context, m4_obstack *obs, m4__token_type type,
Report errors on behalf of CALLER. */
static bool
expand_argument (m4 *context, m4_obstack *obs, m4_symbol_value *argp,
- const m4_call_info *caller)
+ const m4_call_info *caller)
{
m4__token_type type;
m4_symbol_value token;
@@ -326,108 +326,108 @@ expand_argument (m4 *context, m4_obstack *obs, m4_symbol_value *argp,
while (1)
{
if (VALUE_MIN_ARGS (argp) < VALUE_MIN_ARGS (&token))
- VALUE_MIN_ARGS (argp) = VALUE_MIN_ARGS (&token);
+ VALUE_MIN_ARGS (argp) = VALUE_MIN_ARGS (&token);
if (VALUE_MAX_ARGS (&token) < VALUE_MAX_ARGS (argp))
- VALUE_MAX_ARGS (argp) = VALUE_MAX_ARGS (&token);
+ VALUE_MAX_ARGS (argp) = VALUE_MAX_ARGS (&token);
switch (type)
- { /* TOKSW */
- case M4_TOKEN_COMMA:
- case M4_TOKEN_CLOSE:
- if (paren_level == 0)
- {
- assert (argp->type != M4_SYMBOL_FUNC);
- if (argp->type != M4_SYMBOL_COMP)
- {
- len = obstack_object_size (obs);
- VALUE_MODULE (argp) = NULL;
- if (len)
- {
- obstack_1grow (obs, '\0');
- m4_set_symbol_value_text (argp, obstack_finish (obs),
- len, age);
- }
- else
- m4_set_symbol_value_text (argp, "", len, 0);
- }
- else
- {
- m4__make_text_link (obs, NULL, &argp->u.u_c.end);
- if (argp->u.u_c.chain == argp->u.u_c.end
- && argp->u.u_c.chain->type == M4__CHAIN_FUNC)
- {
- const m4__builtin *func = argp->u.u_c.chain->u.builtin;
- argp->type = M4_SYMBOL_FUNC;
- argp->u.builtin = func;
- }
- }
- return type == M4_TOKEN_COMMA;
- }
- /* fallthru */
- case M4_TOKEN_OPEN:
- case M4_TOKEN_SIMPLE:
- if (type == M4_TOKEN_OPEN)
- paren_level++;
- else if (type == M4_TOKEN_CLOSE)
- paren_level--;
- if (!expand_token (context, obs, type, &token, line, first))
- age = 0;
- break;
-
- case M4_TOKEN_EOF:
- m4_error (context, EXIT_FAILURE, 0, caller,
- _("end of file in argument list"));
- break;
-
- case M4_TOKEN_WORD:
- case M4_TOKEN_SPACE:
- case M4_TOKEN_STRING:
- case M4_TOKEN_COMMENT:
- case M4_TOKEN_MACDEF:
- if (!expand_token (context, obs, type, &token, line, first))
- age = 0;
- if (token.type == M4_SYMBOL_COMP)
- {
- if (argp->type != M4_SYMBOL_COMP)
- {
- argp->type = M4_SYMBOL_COMP;
- argp->u.u_c.chain = token.u.u_c.chain;
- argp->u.u_c.wrapper = argp->u.u_c.has_func = false;
- }
- else
- {
- assert (argp->u.u_c.end);
- argp->u.u_c.end->next = token.u.u_c.chain;
- }
- argp->u.u_c.end = token.u.u_c.end;
- if (token.u.u_c.has_func)
- argp->u.u_c.has_func = true;
- }
- break;
-
- case M4_TOKEN_ARGV:
- assert (paren_level == 0 && argp->type == M4_SYMBOL_VOID
- && obstack_object_size (obs) == 0
- && token.u.u_c.chain == token.u.u_c.end
- && token.u.u_c.chain->quote_age == age
- && token.u.u_c.chain->type == M4__CHAIN_ARGV);
- argp->type = M4_SYMBOL_COMP;
- argp->u.u_c.chain = argp->u.u_c.end = token.u.u_c.chain;
- argp->u.u_c.wrapper = true;
- argp->u.u_c.has_func = token.u.u_c.has_func;
- type = m4__next_token (context, &token, NULL, NULL, false, caller);
- if (argp->u.u_c.chain->u.u_a.skip_last)
- assert (type == M4_TOKEN_COMMA);
- else
- assert (type == M4_TOKEN_COMMA || type == M4_TOKEN_CLOSE);
- return type == M4_TOKEN_COMMA;
-
- default:
- assert (!"expand_argument");
- abort ();
- }
+ { /* TOKSW */
+ case M4_TOKEN_COMMA:
+ case M4_TOKEN_CLOSE:
+ if (paren_level == 0)
+ {
+ assert (argp->type != M4_SYMBOL_FUNC);
+ if (argp->type != M4_SYMBOL_COMP)
+ {
+ len = obstack_object_size (obs);
+ VALUE_MODULE (argp) = NULL;
+ if (len)
+ {
+ obstack_1grow (obs, '\0');
+ m4_set_symbol_value_text (argp, obstack_finish (obs),
+ len, age);
+ }
+ else
+ m4_set_symbol_value_text (argp, "", len, 0);
+ }
+ else
+ {
+ m4__make_text_link (obs, NULL, &argp->u.u_c.end);
+ if (argp->u.u_c.chain == argp->u.u_c.end
+ && argp->u.u_c.chain->type == M4__CHAIN_FUNC)
+ {
+ const m4__builtin *func = argp->u.u_c.chain->u.builtin;
+ argp->type = M4_SYMBOL_FUNC;
+ argp->u.builtin = func;
+ }
+ }
+ return type == M4_TOKEN_COMMA;
+ }
+ /* fallthru */
+ case M4_TOKEN_OPEN:
+ case M4_TOKEN_SIMPLE:
+ if (type == M4_TOKEN_OPEN)
+ paren_level++;
+ else if (type == M4_TOKEN_CLOSE)
+ paren_level--;
+ if (!expand_token (context, obs, type, &token, line, first))
+ age = 0;
+ break;
+
+ case M4_TOKEN_EOF:
+ m4_error (context, EXIT_FAILURE, 0, caller,
+ _("end of file in argument list"));
+ break;
+
+ case M4_TOKEN_WORD:
+ case M4_TOKEN_SPACE:
+ case M4_TOKEN_STRING:
+ case M4_TOKEN_COMMENT:
+ case M4_TOKEN_MACDEF:
+ if (!expand_token (context, obs, type, &token, line, first))
+ age = 0;
+ if (token.type == M4_SYMBOL_COMP)
+ {
+ if (argp->type != M4_SYMBOL_COMP)
+ {
+ argp->type = M4_SYMBOL_COMP;
+ argp->u.u_c.chain = token.u.u_c.chain;
+ argp->u.u_c.wrapper = argp->u.u_c.has_func = false;
+ }
+ else
+ {
+ assert (argp->u.u_c.end);
+ argp->u.u_c.end->next = token.u.u_c.chain;
+ }
+ argp->u.u_c.end = token.u.u_c.end;
+ if (token.u.u_c.has_func)
+ argp->u.u_c.has_func = true;
+ }
+ break;
+
+ case M4_TOKEN_ARGV:
+ assert (paren_level == 0 && argp->type == M4_SYMBOL_VOID
+ && obstack_object_size (obs) == 0
+ && token.u.u_c.chain == token.u.u_c.end
+ && token.u.u_c.chain->quote_age == age
+ && token.u.u_c.chain->type == M4__CHAIN_ARGV);
+ argp->type = M4_SYMBOL_COMP;
+ argp->u.u_c.chain = argp->u.u_c.end = token.u.u_c.chain;
+ argp->u.u_c.wrapper = true;
+ argp->u.u_c.has_func = token.u.u_c.has_func;
+ type = m4__next_token (context, &token, NULL, NULL, false, caller);
+ if (argp->u.u_c.chain->u.u_a.skip_last)
+ assert (type == M4_TOKEN_COMMA);
+ else
+ assert (type == M4_TOKEN_COMMA || type == M4_TOKEN_CLOSE);
+ return type == M4_TOKEN_COMMA;
+
+ default:
+ assert (!"expand_argument");
+ abort ();
+ }
if (argp->type != M4_SYMBOL_VOID || obstack_object_size (obs))
- first = false;
+ first = false;
type = m4__next_token (context, &token, NULL, obs, first, caller);
}
}
@@ -463,11 +463,11 @@ expand_macro (m4 *context, const char *name, size_t len, m4_symbol *symbol)
{
size_t count = context->stacks_count;
context->arg_stacks
- = (m4__macro_arg_stacks *) x2nrealloc (context->arg_stacks,
- &context->stacks_count,
- sizeof *context->arg_stacks);
+ = (m4__macro_arg_stacks *) x2nrealloc (context->arg_stacks,
+ &context->stacks_count,
+ sizeof *context->arg_stacks);
memset (&context->arg_stacks[count], 0,
- sizeof *context->arg_stacks * (context->stacks_count - count));
+ sizeof *context->arg_stacks * (context->stacks_count - count));
}
stack = &context->arg_stacks[level];
if (!stack->args)
@@ -481,7 +481,7 @@ expand_macro (m4 *context, const char *name, size_t len, m4_symbol *symbol)
stack->argv_base = obstack_finish (stack->argv);
}
assert (obstack_object_size (stack->args) == 0
- && obstack_object_size (stack->argv) == 0);
+ && obstack_object_size (stack->argv) == 0);
args_base = obstack_finish (stack->args);
argv_base = obstack_finish (stack->argv);
m4__adjust_refcount (context, level, true);
@@ -495,7 +495,7 @@ expand_macro (m4 *context, const char *name, size_t len, m4_symbol *symbol)
info.line = m4_get_current_line (context);
info.call_id = ++macro_call_id;
info.trace = (m4_is_debug_bit (context, M4_DEBUG_TRACE_ALL)
- || m4_get_symbol_traced (symbol));
+ || m4_get_symbol_traced (symbol));
info.debug_level = m4_get_debug_level_opt (context);
info.name = name;
info.name_len = len;
@@ -505,7 +505,7 @@ expand_macro (m4 *context, const char *name, size_t len, m4_symbol *symbol)
if (m4_get_nesting_limit_opt (context) < ++context->expansion_level)
m4_error (context, EXIT_FAILURE, 0, NULL, _("\
recursion limit of %zu exceeded, use -L<N> to change it"),
- m4_get_nesting_limit_opt (context));
+ m4_get_nesting_limit_opt (context));
m4_trace_prepare (context, &info, value);
argv = collect_arguments (context, &info, symbol, stack->args, stack->argv);
@@ -537,20 +537,20 @@ recursion limit of %zu exceeded, use -L<N> to change it"),
if (stack->refcount)
{
if (argv->inuse)
- {
- obstack_free (stack->args, args_scratch);
- if (debug_macro_level & PRINT_ARGCOUNT_CHANGES)
- xfprintf (stderr, "m4debug: -%zu- `%s' in use, level=%zu, "
- "refcount=%zu, argcount=%zu\n", info.call_id,
- argv->info->name, level, stack->refcount,
- stack->argcount);
- }
+ {
+ obstack_free (stack->args, args_scratch);
+ if (debug_macro_level & PRINT_ARGCOUNT_CHANGES)
+ xfprintf (stderr, "m4debug: -%zu- `%s' in use, level=%zu, "
+ "refcount=%zu, argcount=%zu\n", info.call_id,
+ argv->info->name, level, stack->refcount,
+ stack->argcount);
+ }
else
- {
- obstack_free (stack->args, args_base);
- obstack_free (stack->argv, argv_base);
- stack->argcount--;
- }
+ {
+ obstack_free (stack->args, args_base);
+ obstack_free (stack->argv, argv_base);
+ stack->argcount--;
+ }
}
}
@@ -560,7 +560,7 @@ recursion limit of %zu exceeded, use -L<N> to change it"),
object describing all of the macro arguments. */
static m4_macro_args *
collect_arguments (m4 *context, m4_call_info *info, m4_symbol *symbol,
- m4_obstack *arguments, m4_obstack *argv_stack)
+ m4_obstack *arguments, m4_obstack *argv_stack)
{
m4_symbol_value token;
m4_symbol_value *tokenp;
@@ -588,53 +588,53 @@ collect_arguments (m4 *context, m4_call_info *info, m4_symbol *symbol,
/* Gobble parenthesis, then collect arguments. */
m4__next_token (context, &token, NULL, NULL, false, info);
do
- {
- tokenp = (m4_symbol_value *) obstack_alloc (arguments,
- sizeof *tokenp);
- more_args = expand_argument (context, arguments, tokenp, info);
-
- if ((m4_is_symbol_value_text (tokenp)
- && !m4_get_symbol_value_len (tokenp))
- || (args.flatten && m4_is_symbol_value_func (tokenp)))
- {
- obstack_free (arguments, tokenp);
- tokenp = &empty_symbol;
- }
- obstack_ptr_grow (argv_stack, tokenp);
- args.arraylen++;
- args.argc++;
- switch (tokenp->type)
- {
- case M4_SYMBOL_TEXT:
- /* Be conservative - any change in quoting while
- collecting arguments, or any unsafe argument, will
- require a rescan if $@ is reused. */
- if (m4_get_symbol_value_len (tokenp)
- && m4_get_symbol_value_quote_age (tokenp) != args.quote_age)
- args.quote_age = 0;
- break;
- case M4_SYMBOL_FUNC:
- args.has_func = true;
- break;
- case M4_SYMBOL_COMP:
- args.has_ref = true;
- if (tokenp->u.u_c.wrapper)
- {
- assert (tokenp->u.u_c.chain->type == M4__CHAIN_ARGV
- && !tokenp->u.u_c.chain->next);
- args.argc += (tokenp->u.u_c.chain->u.u_a.argv->argc
- - tokenp->u.u_c.chain->u.u_a.index
- - tokenp->u.u_c.chain->u.u_a.skip_last - 1);
- args.wrapper = true;
- }
- if (tokenp->u.u_c.has_func)
- args.has_func = true;
- break;
- default:
- assert (!"expand_argument");
- abort ();
- }
- }
+ {
+ tokenp = (m4_symbol_value *) obstack_alloc (arguments,
+ sizeof *tokenp);
+ more_args = expand_argument (context, arguments, tokenp, info);
+
+ if ((m4_is_symbol_value_text (tokenp)
+ && !m4_get_symbol_value_len (tokenp))
+ || (args.flatten && m4_is_symbol_value_func (tokenp)))
+ {
+ obstack_free (arguments, tokenp);
+ tokenp = &empty_symbol;
+ }
+ obstack_ptr_grow (argv_stack, tokenp);
+ args.arraylen++;
+ args.argc++;
+ switch (tokenp->type)
+ {
+ case M4_SYMBOL_TEXT:
+ /* Be conservative - any change in quoting while
+ collecting arguments, or any unsafe argument, will
+ require a rescan if $@ is reused. */
+ if (m4_get_symbol_value_len (tokenp)
+ && m4_get_symbol_value_quote_age (tokenp) != args.quote_age)
+ args.quote_age = 0;
+ break;
+ case M4_SYMBOL_FUNC:
+ args.has_func = true;
+ break;
+ case M4_SYMBOL_COMP:
+ args.has_ref = true;
+ if (tokenp->u.u_c.wrapper)
+ {
+ assert (tokenp->u.u_c.chain->type == M4__CHAIN_ARGV
+ && !tokenp->u.u_c.chain->next);
+ args.argc += (tokenp->u.u_c.chain->u.u_a.argv->argc
+ - tokenp->u.u_c.chain->u.u_a.index
+ - tokenp->u.u_c.chain->u.u_a.skip_last - 1);
+ args.wrapper = true;
+ }
+ if (tokenp->u.u_c.has_func)
+ args.has_func = true;
+ break;
+ default:
+ assert (!"expand_argument");
+ abort ();
+ }
+ }
while (more_args);
}
argv = (m4_macro_args *) obstack_finish (argv_stack);
@@ -657,32 +657,32 @@ collect_arguments (m4 *context, m4_call_info *info, m4_symbol *symbol,
tracing is also handled here. */
void
m4_macro_call (m4 *context, m4_symbol_value *value, m4_obstack *expansion,
- m4_macro_args *argv)
+ m4_macro_args *argv)
{
unsigned int trace_start = 0;
if (argv->info->trace)
trace_start = trace_pre (context, argv);
if (!m4_bad_argc (context, argv->argc, argv->info,
- VALUE_MIN_ARGS (value), VALUE_MAX_ARGS (value),
- BIT_TEST (VALUE_FLAGS (value),
- VALUE_SIDE_EFFECT_ARGS_BIT)))
+ VALUE_MIN_ARGS (value), VALUE_MAX_ARGS (value),
+ BIT_TEST (VALUE_FLAGS (value),
+ VALUE_SIDE_EFFECT_ARGS_BIT)))
{
if (m4_is_symbol_value_text (value))
- process_macro (context, value, expansion, argv->argc, argv);
+ process_macro (context, value, expansion, argv->argc, argv);
else if (m4_is_symbol_value_func (value))
- m4_get_symbol_value_func (value) (context, expansion, argv->argc,
- argv);
+ m4_get_symbol_value_func (value) (context, expansion, argv->argc,
+ argv);
else if (m4_is_symbol_value_placeholder (value))
- m4_warn (context, 0, argv->info,
- _("builtin %s requested by frozen file not found"),
- quotearg_style (locale_quoting_style,
- m4_get_symbol_value_placeholder (value)));
+ m4_warn (context, 0, argv->info,
+ _("builtin %s requested by frozen file not found"),
+ quotearg_style (locale_quoting_style,
+ m4_get_symbol_value_placeholder (value)));
else
- {
- assert (!"m4_macro_call");
- abort ();
- }
+ {
+ assert (!"m4_macro_call");
+ abort ();
+ }
}
if (argv->info->trace)
trace_post (context, trace_start, argv->info);
@@ -695,7 +695,7 @@ m4_macro_call (m4 *context, m4_symbol_value *value, m4_obstack *expansion,
as usual. */
static void
process_macro (m4 *context, m4_symbol_value *value, m4_obstack *obs,
- int argc, m4_macro_args *argv)
+ int argc, m4_macro_args *argv)
{
const char *text = m4_get_symbol_value_text (value);
size_t len = m4_get_symbol_value_len (value);
@@ -705,121 +705,121 @@ process_macro (m4 *context, m4_symbol_value *value, m4_obstack *obs,
{
const char *dollar;
if (m4_is_syntax_single_dollar (M4SYNTAX))
- dollar = (char *) memchr (text, M4SYNTAX->dollar, len);
+ dollar = (char *) memchr (text, M4SYNTAX->dollar, len);
else
- {
- dollar = text;
- while (dollar != end)
- {
- if (m4_has_syntax (M4SYNTAX, *dollar, M4_SYNTAX_DOLLAR))
- break;
- dollar++;
- }
- if (dollar == end)
- dollar = NULL;
- }
+ {
+ dollar = text;
+ while (dollar != end)
+ {
+ if (m4_has_syntax (M4SYNTAX, *dollar, M4_SYNTAX_DOLLAR))
+ break;
+ dollar++;
+ }
+ if (dollar == end)
+ dollar = NULL;
+ }
if (!dollar)
- {
- obstack_grow (obs, text, len);
- return;
- }
+ {
+ obstack_grow (obs, text, len);
+ return;
+ }
obstack_grow (obs, text, dollar - text);
len -= dollar - text;
text = dollar;
if (len == 1)
- {
- obstack_1grow (obs, *dollar);
- return;
- }
+ {
+ obstack_1grow (obs, *dollar);
+ return;
+ }
len--;
switch (*++text)
- {
- case '0': case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
- /* FIXME - multidigit arguments should convert over to ${10}
- syntax instead of $10; see
- http://lists.gnu.org/archive/html/m4-discuss/2006-08/msg00028.html
- for more discussion. */
- if (m4_get_posixly_correct_opt (context)
- || !isdigit (to_uchar (text[1])))
- {
- i = *text++ - '0';
- len--;
- }
- else
- {
- char *endp;
- i = (int) strtol (text, &endp, 10);
- len -= endp - text;
- text = endp;
- }
- if (i < argc)
- m4_push_arg (context, obs, argv, i);
- break;
-
- case '#': /* number of arguments */
- m4_shipout_int (obs, argc - 1);
- text++;
- len--;
- break;
-
- case '*': /* all arguments */
- case '@': /* ... same, but quoted */
- m4_push_args (context, obs, argv, false, *text == '@');
- text++;
- len--;
- break;
-
- default:
- if (m4_get_posixly_correct_opt (context)
- || !VALUE_ARG_SIGNATURE (value))
- {
- obstack_1grow (obs, *dollar);
- }
- else
- {
- size_t len1 = 0;
- const char *endp;
- char *key;
-
- for (endp = ++text;
- len1 < len && m4_has_syntax (M4SYNTAX, *endp,
- (M4_SYNTAX_OTHER
- | M4_SYNTAX_ALPHA
- | M4_SYNTAX_NUM));
- ++endp)
- {
- ++len1;
- }
- key = xstrndup (text, len1);
-
- if (*endp)
- {
- struct m4_symbol_arg **arg
- = (struct m4_symbol_arg **)
- m4_hash_lookup (VALUE_ARG_SIGNATURE (value), key);
-
- if (arg)
- {
- i = SYMBOL_ARG_INDEX (*arg);
- assert (i < argc);
- m4_shipout_string (context, obs, M4ARG (i), M4ARGLEN (i),
- false);
- }
- }
- else
- {
- m4_error (context, 0, 0, argv->info,
- _("unterminated parameter reference: %s"), key);
- }
-
- len -= endp - text;
- text = endp;
-
- free (key);
- }
- break;
- }
+ {
+ case '0': case '1': case '2': case '3': case '4':
+ case '5': case '6': case '7': case '8': case '9':
+ /* FIXME - multidigit arguments should convert over to ${10}
+ syntax instead of $10; see
+ http://lists.gnu.org/archive/html/m4-discuss/2006-08/msg00028.html
+ for more discussion. */
+ if (m4_get_posixly_correct_opt (context)
+ || !isdigit (to_uchar (text[1])))
+ {
+ i = *text++ - '0';
+ len--;
+ }
+ else
+ {
+ char *endp;
+ i = (int) strtol (text, &endp, 10);
+ len -= endp - text;
+ text = endp;
+ }
+ if (i < argc)
+ m4_push_arg (context, obs, argv, i);
+ break;
+
+ case '#': /* number of arguments */
+ m4_shipout_int (obs, argc - 1);
+ text++;
+ len--;
+ break;
+
+ case '*': /* all arguments */
+ case '@': /* ... same, but quoted */
+ m4_push_args (context, obs, argv, false, *text == '@');
+ text++;
+ len--;
+ break;
+
+ default:
+ if (m4_get_posixly_correct_opt (context)
+ || !VALUE_ARG_SIGNATURE (value))
+ {
+ obstack_1grow (obs, *dollar);
+ }
+ else
+ {
+ size_t len1 = 0;
+ const char *endp;
+ char *key;
+
+ for (endp = ++text;
+ len1 < len && m4_has_syntax (M4SYNTAX, *endp,
+ (M4_SYNTAX_OTHER
+ | M4_SYNTAX_ALPHA
+ | M4_SYNTAX_NUM));
+ ++endp)
+ {
+ ++len1;
+ }
+ key = xstrndup (text, len1);
+
+ if (*endp)
+ {
+ struct m4_symbol_arg **arg
+ = (struct m4_symbol_arg **)
+ m4_hash_lookup (VALUE_ARG_SIGNATURE (value), key);
+
+ if (arg)
+ {
+ i = SYMBOL_ARG_INDEX (*arg);
+ assert (i < argc);
+ m4_shipout_string (context, obs, M4ARG (i), M4ARGLEN (i),
+ false);
+ }
+ }
+ else
+ {
+ m4_error (context, 0, 0, argv->info,
+ _("unterminated parameter reference: %s"), key);
+ }
+
+ len -= endp - text;
+ text = endp;
+
+ free (key);
+ }
+ break;
+ }
}
}
@@ -873,7 +873,7 @@ trace_flush (m4 *context, unsigned int start)
Should be called prior to m4_macro_call(). */
void
m4_trace_prepare (m4 *context, const m4_call_info *info,
- m4_symbol_value *value)
+ m4_symbol_value *value)
{
const m4_string_pair *quotes = NULL;
size_t arg_length = m4_get_max_debug_arg_length_opt (context);
@@ -887,7 +887,7 @@ m4_trace_prepare (m4 *context, const m4_call_info *info,
obstack_grow (&context->trace_messages, info->name, info->name_len);
obstack_grow (&context->trace_messages, " ... = ", 7);
m4__symbol_value_print (context, value, &context->trace_messages, quotes,
- false, NULL, &arg_length, module);
+ false, NULL, &arg_length, module);
trace_flush (context, start);
}
}
@@ -913,10 +913,10 @@ trace_pre (m4 *context, m4_macro_args *argv)
bool module = (trace_level & M4_DEBUG_TRACE_MODULE) != 0;
if (trace_level & M4_DEBUG_TRACE_QUOTE)
- quotes = m4_get_syntax_quotes (M4SYNTAX);
+ quotes = m4_get_syntax_quotes (M4SYNTAX);
obstack_1grow (trace, '(');
m4__arg_print (context, trace, argv, 1, quotes, false, NULL, ", ",
- &arg_length, true, module);
+ &arg_length, true, module);
obstack_1grow (trace, ')');
}
return start;
@@ -949,7 +949,7 @@ m4__adjust_refcount (m4 *context, size_t level, bool increase)
{
m4__macro_arg_stacks *stack = &context->arg_stacks[level];
assert (level < context->stacks_count && stack->args
- && (increase || stack->refcount));
+ && (increase || stack->refcount));
if (increase)
stack->refcount++;
else if (--stack->refcount == 0)
@@ -957,14 +957,14 @@ m4__adjust_refcount (m4 *context, size_t level, bool increase)
obstack_free (stack->args, stack->args_base);
obstack_free (stack->argv, stack->argv_base);
if ((debug_macro_level & PRINT_ARGCOUNT_CHANGES) && 1 < stack->argcount)
- xfprintf (stderr, "m4debug: -%zu- freeing %zu args, level=%zu\n",
- macro_call_id, stack->argcount, level);
+ xfprintf (stderr, "m4debug: -%zu- freeing %zu args, level=%zu\n",
+ macro_call_id, stack->argcount, level);
stack->argcount = 0;
}
if (debug_macro_level
& (increase ? PRINT_REFCOUNT_INCREASE : PRINT_REFCOUNT_DECREASE))
xfprintf (stderr, "m4debug: level %zu refcount=%zu\n", level,
- stack->refcount);
+ stack->refcount);
return stack->refcount;
}
@@ -981,31 +981,31 @@ m4__arg_adjust_refcount (m4 *context, m4_macro_args *argv, bool increase)
if (argv->has_ref)
for (i = 0; i < argv->arraylen; i++)
if (argv->array[i]->type == M4_SYMBOL_COMP)
- {
- chain = argv->array[i]->u.u_c.chain;
- while (chain)
- {
- switch (chain->type)
- {
- case M4__CHAIN_STR:
- if (chain->u.u_s.level < SIZE_MAX)
- m4__adjust_refcount (context, chain->u.u_s.level,
- increase);
- break;
- case M4__CHAIN_FUNC:
- break;
- case M4__CHAIN_ARGV:
- assert (chain->u.u_a.argv->inuse);
- m4__arg_adjust_refcount (context, chain->u.u_a.argv,
- increase);
- break;
- default:
- assert (!"m4__arg_adjust_refcount");
- abort ();
- }
- chain = chain->next;
- }
- }
+ {
+ chain = argv->array[i]->u.u_c.chain;
+ while (chain)
+ {
+ switch (chain->type)
+ {
+ case M4__CHAIN_STR:
+ if (chain->u.u_s.level < SIZE_MAX)
+ m4__adjust_refcount (context, chain->u.u_s.level,
+ increase);
+ break;
+ case M4__CHAIN_FUNC:
+ break;
+ case M4__CHAIN_ARGV:
+ assert (chain->u.u_a.argv->inuse);
+ m4__arg_adjust_refcount (context, chain->u.u_a.argv,
+ increase);
+ break;
+ default:
+ assert (!"m4__arg_adjust_refcount");
+ abort ();
+ }
+ chain = chain->next;
+ }
+ }
m4__adjust_refcount (context, argv->level, increase);
return result;
}
@@ -1024,14 +1024,14 @@ arg_mark (m4_macro_args *argv)
if (argv->wrapper)
{
for (i = 0; i < argv->arraylen; i++)
- if (argv->array[i]->type == M4_SYMBOL_COMP
- && argv->array[i]->u.u_c.wrapper)
- {
- chain = argv->array[i]->u.u_c.chain;
- assert (!chain->next && chain->type == M4__CHAIN_ARGV);
- if (!chain->u.u_a.argv->inuse)
- arg_mark (chain->u.u_a.argv);
- }
+ if (argv->array[i]->type == M4_SYMBOL_COMP
+ && argv->array[i]->u.u_c.wrapper)
+ {
+ chain = argv->array[i]->u.u_c.chain;
+ assert (!chain->next && chain->type == M4__CHAIN_ARGV);
+ if (!chain->u.u_a.argv->inuse)
+ arg_mark (chain->u.u_a.argv);
+ }
}
}
@@ -1043,8 +1043,8 @@ arg_mark (m4_macro_args *argv)
empty. */
static m4_symbol_value *
make_argv_ref (m4 *context, m4_symbol_value *value, m4_obstack *obs,
- size_t level, m4_macro_args *argv, size_t arg, bool flatten,
- const m4_string_pair *quotes)
+ size_t level, m4_macro_args *argv, size_t arg, bool flatten,
+ const m4_string_pair *quotes)
{
m4__symbol_chain *chain;
@@ -1060,36 +1060,36 @@ make_argv_ref (m4 *context, m4_symbol_value *value, m4_obstack *obs,
{
size_t i;
for (i = 0; i < argv->arraylen; i++)
- {
- if ((argv->array[i]->type == M4_SYMBOL_COMP
- && argv->array[i]->u.u_c.wrapper)
- || level < SIZE_MAX)
- break;
- if (arg == 1)
- {
- m4__push_arg_quote (context, obs, argv, i + 1, quotes);
- /* TODO support M4_SYNTAX_COMMA. */
- obstack_1grow (obs, ',');
- }
- else
- arg--;
- }
+ {
+ if ((argv->array[i]->type == M4_SYMBOL_COMP
+ && argv->array[i]->u.u_c.wrapper)
+ || level < SIZE_MAX)
+ break;
+ if (arg == 1)
+ {
+ m4__push_arg_quote (context, obs, argv, i + 1, quotes);
+ /* TODO support M4_SYNTAX_COMMA. */
+ obstack_1grow (obs, ',');
+ }
+ else
+ arg--;
+ }
assert (i < argv->arraylen);
if (i + 1 == argv->arraylen)
- {
- assert (argv->array[i]->type == M4_SYMBOL_COMP
- && argv->array[i]->u.u_c.wrapper);
- chain = argv->array[i]->u.u_c.chain;
- assert (!chain->next && chain->type == M4__CHAIN_ARGV
- && !chain->u.u_a.skip_last);
- argv = chain->u.u_a.argv;
- arg += chain->u.u_a.index - 1;
- }
+ {
+ assert (argv->array[i]->type == M4_SYMBOL_COMP
+ && argv->array[i]->u.u_c.wrapper);
+ chain = argv->array[i]->u.u_c.chain;
+ assert (!chain->next && chain->type == M4__CHAIN_ARGV
+ && !chain->u.u_a.skip_last);
+ argv = chain->u.u_a.argv;
+ arg += chain->u.u_a.index - 1;
+ }
else
- {
- arg += i;
- break;
- }
+ {
+ arg += i;
+ break;
+ }
}
m4__make_text_link (obs, &value->u.u_c.chain, &value->u.u_c.end);
@@ -1111,7 +1111,7 @@ make_argv_ref (m4 *context, m4_symbol_value *value, m4_obstack *obs,
chain->u.u_a.comma = false;
chain->u.u_a.skip_last = false;
chain->u.u_a.quotes = m4__quote_cache (M4SYNTAX, obs, chain->quote_age,
- quotes);
+ quotes);
return value;
}
@@ -1135,7 +1135,7 @@ arg_symbol (m4_macro_args *argv, size_t arg, size_t *level, bool flatten)
{
value = argv->array[arg - 1];
if (flatten && m4_is_symbol_value_func (value))
- value = &empty_symbol;
+ value = &empty_symbol;
return value;
}
@@ -1145,22 +1145,22 @@ arg_symbol (m4_macro_args *argv, size_t arg, size_t *level, bool flatten)
{
value = argv->array[i];
if (value->type == M4_SYMBOL_COMP && value->u.u_c.wrapper)
- {
- m4__symbol_chain *chain = value->u.u_c.chain;
- assert (!chain->next && chain->type == M4__CHAIN_ARGV);
- if (arg <= (chain->u.u_a.argv->argc - chain->u.u_a.index
- - chain->u.u_a.skip_last))
- {
- value = arg_symbol (chain->u.u_a.argv,
- chain->u.u_a.index - 1 + arg, level,
- flatten || chain->u.u_a.flatten);
- break;
- }
- arg -= (chain->u.u_a.argv->argc - chain->u.u_a.index
- - chain->u.u_a.skip_last);
- }
+ {
+ m4__symbol_chain *chain = value->u.u_c.chain;
+ assert (!chain->next && chain->type == M4__CHAIN_ARGV);
+ if (arg <= (chain->u.u_a.argv->argc - chain->u.u_a.index
+ - chain->u.u_a.skip_last))
+ {
+ value = arg_symbol (chain->u.u_a.argv,
+ chain->u.u_a.index - 1 + arg, level,
+ flatten || chain->u.u_a.flatten);
+ break;
+ }
+ arg -= (chain->u.u_a.argv->argc - chain->u.u_a.index
+ - chain->u.u_a.skip_last);
+ }
else if (--arg == 0)
- break;
+ break;
}
return value;
}
@@ -1242,27 +1242,27 @@ m4_arg_text (m4 *context, m4_macro_args *argv, size_t arg, bool flatten)
while (chain)
{
switch (chain->type)
- {
- case M4__CHAIN_STR:
- obstack_grow (obs, chain->u.u_s.str, chain->u.u_s.len);
- break;
- case M4__CHAIN_FUNC:
- if (flatten)
- break;
- assert (!"m4_arg_text");
- abort ();
- case M4__CHAIN_ARGV:
- assert (!chain->u.u_a.has_func || flatten || argv->flatten);
- m4__arg_print (context, obs, chain->u.u_a.argv, chain->u.u_a.index,
- m4__quote_cache (M4SYNTAX, NULL, chain->quote_age,
- chain->u.u_a.quotes),
- flatten || argv->flatten || chain->u.u_a.flatten,
- NULL, NULL, NULL, false, false);
- break;
- default:
- assert (!"m4_arg_text");
- abort ();
- }
+ {
+ case M4__CHAIN_STR:
+ obstack_grow (obs, chain->u.u_s.str, chain->u.u_s.len);
+ break;
+ case M4__CHAIN_FUNC:
+ if (flatten)
+ break;
+ assert (!"m4_arg_text");
+ abort ();
+ case M4__CHAIN_ARGV:
+ assert (!chain->u.u_a.has_func || flatten || argv->flatten);
+ m4__arg_print (context, obs, chain->u.u_a.argv, chain->u.u_a.index,
+ m4__quote_cache (M4SYNTAX, NULL, chain->quote_age,
+ chain->u.u_a.quotes),
+ flatten || argv->flatten || chain->u.u_a.flatten,
+ NULL, NULL, NULL, false, false);
+ break;
+ default:
+ assert (!"m4_arg_text");
+ abort ();
+ }
chain = chain->next;
}
obstack_1grow (obs, '\0');
@@ -1273,7 +1273,7 @@ m4_arg_text (m4 *context, m4_macro_args *argv, size_t arg, bool flatten)
Both indices must be non-zero. Return true if the arguments
contain the same contents; often more efficient than
!strcmp (m4_arg_text (context, argv, indexa),
- m4_arg_text (context, argv, indexb)). */
+ m4_arg_text (context, argv, indexb)). */
bool
m4_arg_equal (m4 *context, m4_macro_args *argv, size_t indexa, size_t indexb)
{
@@ -1291,9 +1291,9 @@ m4_arg_equal (m4 *context, m4_macro_args *argv, size_t indexa, size_t indexb)
return sa == sb;
if (m4_is_symbol_value_text (sa) && m4_is_symbol_value_text (sb))
return (m4_get_symbol_value_len (sa) == m4_get_symbol_value_len (sb)
- && memcmp (m4_get_symbol_value_text (sa),
- m4_get_symbol_value_text (sb),
- m4_get_symbol_value_len (sa)) == 0);
+ && memcmp (m4_get_symbol_value_text (sa),
+ m4_get_symbol_value_text (sb),
+ m4_get_symbol_value_len (sa)) == 0);
/* Convert both arguments to chains, if not one already. */
switch (sa->type)
@@ -1341,76 +1341,76 @@ m4_arg_equal (m4 *context, m4_macro_args *argv, size_t indexa, size_t indexb)
while (ca && cb)
{
if (ca->type == M4__CHAIN_ARGV)
- {
- tmpa.next = NULL;
- tmpa.type = M4__CHAIN_STR;
- tmpa.u.u_s.str = NULL;
- tmpa.u.u_s.len = 0;
- chain = &tmpa;
- m4__arg_print (context, obs, ca->u.u_a.argv, ca->u.u_a.index,
- m4__quote_cache (M4SYNTAX, NULL, ca->quote_age,
- ca->u.u_a.quotes),
- argv->flatten || ca->u.u_a.flatten, &chain, NULL,
- NULL, false, false);
- assert (obstack_object_size (obs) == 0 && chain != &tmpa);
- chain->next = ca->next;
- ca = tmpa.next;
- continue;
- }
+ {
+ tmpa.next = NULL;
+ tmpa.type = M4__CHAIN_STR;
+ tmpa.u.u_s.str = NULL;
+ tmpa.u.u_s.len = 0;
+ chain = &tmpa;
+ m4__arg_print (context, obs, ca->u.u_a.argv, ca->u.u_a.index,
+ m4__quote_cache (M4SYNTAX, NULL, ca->quote_age,
+ ca->u.u_a.quotes),
+ argv->flatten || ca->u.u_a.flatten, &chain, NULL,
+ NULL, false, false);
+ assert (obstack_object_size (obs) == 0 && chain != &tmpa);
+ chain->next = ca->next;
+ ca = tmpa.next;
+ continue;
+ }
if (cb->type == M4__CHAIN_ARGV)
- {
- tmpb.next = NULL;
- tmpb.type = M4__CHAIN_STR;
- tmpb.u.u_s.str = NULL;
- tmpb.u.u_s.len = 0;
- chain = &tmpb;
- m4__arg_print (context, obs, cb->u.u_a.argv, cb->u.u_a.index,
- m4__quote_cache (M4SYNTAX, NULL, cb->quote_age,
- cb->u.u_a.quotes),
- argv->flatten || cb->u.u_a.flatten, &chain, NULL,
- NULL, false, false);
- assert (obstack_object_size (obs) == 0 && chain != &tmpb);
- chain->next = cb->next;
- cb = tmpb.next;
- continue;
- }
+ {
+ tmpb.next = NULL;
+ tmpb.type = M4__CHAIN_STR;
+ tmpb.u.u_s.str = NULL;
+ tmpb.u.u_s.len = 0;
+ chain = &tmpb;
+ m4__arg_print (context, obs, cb->u.u_a.argv, cb->u.u_a.index,
+ m4__quote_cache (M4SYNTAX, NULL, cb->quote_age,
+ cb->u.u_a.quotes),
+ argv->flatten || cb->u.u_a.flatten, &chain, NULL,
+ NULL, false, false);
+ assert (obstack_object_size (obs) == 0 && chain != &tmpb);
+ chain->next = cb->next;
+ cb = tmpb.next;
+ continue;
+ }
if (ca->type == M4__CHAIN_FUNC)
- {
- if (cb->type != M4__CHAIN_FUNC || ca->u.builtin != cb->u.builtin)
- return false;
- ca = ca->next;
- cb = cb->next;
- continue;
- }
+ {
+ if (cb->type != M4__CHAIN_FUNC || ca->u.builtin != cb->u.builtin)
+ return false;
+ ca = ca->next;
+ cb = cb->next;
+ continue;
+ }
assert (ca->type == M4__CHAIN_STR && cb->type == M4__CHAIN_STR);
if (ca->u.u_s.len == cb->u.u_s.len)
- {
- if (memcmp (ca->u.u_s.str, cb->u.u_s.str, ca->u.u_s.len) != 0)
- return false;
- ca = ca->next;
- cb = cb->next;
- }
+ {
+ if (memcmp (ca->u.u_s.str, cb->u.u_s.str, ca->u.u_s.len) != 0)
+ return false;
+ ca = ca->next;
+ cb = cb->next;
+ }
else if (ca->u.u_s.len < cb->u.u_s.len)
- {
- if (memcmp (ca->u.u_s.str, cb->u.u_s.str, ca->u.u_s.len) != 0)
- return false;
- tmpb.next = cb->next;
- tmpb.u.u_s.str = cb->u.u_s.str + ca->u.u_s.len;
- tmpb.u.u_s.len = cb->u.u_s.len - ca->u.u_s.len;
- ca = ca->next;
- cb = &tmpb;
- }
+ {
+ if (memcmp (ca->u.u_s.str, cb->u.u_s.str, ca->u.u_s.len) != 0)
+ return false;
+ tmpb.next = cb->next;
+ tmpb.u.u_s.str = cb->u.u_s.str + ca->u.u_s.len;
+ tmpb.u.u_s.len = cb->u.u_s.len - ca->u.u_s.len;
+ ca = ca->next;
+ cb = &tmpb;
+ }
else
- {
- assert (cb->u.u_s.len < ca->u.u_s.len);
- if (memcmp (ca->u.u_s.str, cb->u.u_s.str, cb->u.u_s.len) != 0)
- return false;
- tmpa.next = ca->next;
- tmpa.u.u_s.str = ca->u.u_s.str + cb->u.u_s.len;
- tmpa.u.u_s.len = ca->u.u_s.len - cb->u.u_s.len;
- ca = &tmpa;
- cb = cb->next;
- }
+ {
+ assert (cb->u.u_s.len < ca->u.u_s.len);
+ if (memcmp (ca->u.u_s.str, cb->u.u_s.str, cb->u.u_s.len) != 0)
+ return false;
+ tmpa.next = ca->next;
+ tmpa.u.u_s.str = ca->u.u_s.str + cb->u.u_s.len;
+ tmpa.u.u_s.len = ca->u.u_s.len - cb->u.u_s.len;
+ ca = &tmpa;
+ cb = cb->next;
+ }
}
/* If we get this far, the two arguments are equal only if both
@@ -1462,30 +1462,30 @@ m4_arg_len (m4 *context, m4_macro_args *argv, size_t arg, bool flatten)
size_t limit;
const m4_string_pair *quotes;
switch (chain->type)
- {
- case M4__CHAIN_STR:
- len += chain->u.u_s.len;
- break;
- case M4__CHAIN_FUNC:
- assert (flatten);
- break;
- case M4__CHAIN_ARGV:
- i = chain->u.u_a.index;
- limit = chain->u.u_a.argv->argc - i - chain->u.u_a.skip_last;
- quotes = m4__quote_cache (M4SYNTAX, NULL, chain->quote_age,
- chain->u.u_a.quotes);
- assert (limit);
- if (quotes)
- len += (quotes->len1 + quotes->len2) * limit;
- len += limit - 1;
- while (limit--)
- len += m4_arg_len (context, chain->u.u_a.argv, i++,
- flatten || chain->u.u_a.flatten);
- break;
- default:
- assert (!"m4_arg_len");
- abort ();
- }
+ {
+ case M4__CHAIN_STR:
+ len += chain->u.u_s.len;
+ break;
+ case M4__CHAIN_FUNC:
+ assert (flatten);
+ break;
+ case M4__CHAIN_ARGV:
+ i = chain->u.u_a.index;
+ limit = chain->u.u_a.argv->argc - i - chain->u.u_a.skip_last;
+ quotes = m4__quote_cache (M4SYNTAX, NULL, chain->quote_age,
+ chain->u.u_a.quotes);
+ assert (limit);
+ if (quotes)
+ len += (quotes->len1 + quotes->len2) * limit;
+ len += limit - 1;
+ while (limit--)
+ len += m4_arg_len (context, chain->u.u_a.argv, i++,
+ flatten || chain->u.u_a.flatten);
+ break;
+ default:
+ assert (!"m4_arg_len");
+ abort ();
+ }
chain = chain->next;
}
assert (len || flatten);
@@ -1516,9 +1516,9 @@ m4_arg_func (m4_macro_args *argv, size_t arg)
length. MAX_LEN and CHAINP may not both be specified. */
bool
m4__arg_print (m4 *context, m4_obstack *obs, m4_macro_args *argv, size_t arg,
- const m4_string_pair *quotes, bool flatten,
- m4__symbol_chain **chainp, const char *sep, size_t *max_len,
- bool quote_each, bool module)
+ const m4_string_pair *quotes, bool flatten,
+ m4__symbol_chain **chainp, const char *sep, size_t *max_len,
+ bool quote_each, bool module)
{
size_t len = max_len ? *max_len : SIZE_MAX;
size_t i;
@@ -1535,22 +1535,22 @@ m4__arg_print (m4 *context, m4_obstack *obs, m4_macro_args *argv, size_t arg,
for (i = arg; i < argv->argc; i++)
{
if (quote_each && max_len)
- len = *max_len;
+ len = *max_len;
if (use_sep && m4_shipout_string_trunc (obs, sep, sep_len, NULL, plen))
- return true;
+ return true;
use_sep = true;
if (quotes && !quote_each
- && m4_shipout_string_trunc (obs, quotes->str1, quotes->len1, NULL,
- plen))
- return true;
+ && m4_shipout_string_trunc (obs, quotes->str1, quotes->len1, NULL,
+ plen))
+ return true;
if (m4__symbol_value_print (context, arg_symbol (argv, i, NULL, flatten),
- obs, quote_each ? quotes : NULL, flatten,
- chainp, &len, module))
- return true;
+ obs, quote_each ? quotes : NULL, flatten,
+ chainp, &len, module))
+ return true;
if (quotes && !quote_each
- && m4_shipout_string_trunc (obs, quotes->str2, quotes->len2, NULL,
- plen))
- return true;
+ && m4_shipout_string_trunc (obs, quotes->str2, quotes->len2, NULL,
+ plen))
+ return true;
}
if (max_len)
*max_len = len;
@@ -1568,7 +1568,7 @@ m4__arg_print (m4 *context, m4_obstack *obs, m4_macro_args *argv, size_t arg,
regardless of global trace state. */
m4_macro_args *
m4_make_argv_ref (m4 *context, m4_macro_args *argv, const char *argv0,
- size_t argv0_len, bool flatten, bool trace)
+ size_t argv0_len, bool flatten, bool trace)
{
m4_macro_args *new_argv;
m4_symbol_value *value;
@@ -1579,12 +1579,12 @@ m4_make_argv_ref (m4 *context, m4_macro_args *argv, const char *argv0,
info = (m4_call_info *) obstack_copy (obs, argv->info, sizeof *info);
new_value = (m4_symbol_value *) obstack_alloc (obs, sizeof *value);
value = make_argv_ref (context, new_value, obs, context->expansion_level - 1,
- argv, 2, flatten, NULL);
+ argv, 2, flatten, NULL);
if (!value)
{
obstack_free (obs, new_value);
new_argv = (m4_macro_args *) obstack_alloc (obs, offsetof (m4_macro_args,
- array));
+ array));
new_argv->arraylen = 0;
new_argv->wrapper = false;
new_argv->has_ref = false;
@@ -1594,8 +1594,8 @@ m4_make_argv_ref (m4 *context, m4_macro_args *argv, const char *argv0,
else
{
new_argv = (m4_macro_args *) obstack_alloc (obs, (offsetof (m4_macro_args,
- array)
- + sizeof value));
+ array)
+ + sizeof value));
new_argv->arraylen = 1;
new_argv->array[0] = value;
new_argv->wrapper = true;
@@ -1625,10 +1625,10 @@ m4_push_arg (m4 *context, m4_obstack *obs, m4_macro_args *argv, size_t arg)
{
assert (argv->info);
m4_set_symbol_value_text (&value, argv->info->name, argv->info->name_len,
- 0);
+ 0);
if (m4__push_symbol (context, &value, context->expansion_level - 1,
- argv->inuse))
- arg_mark (argv);
+ argv->inuse))
+ arg_mark (argv);
}
else
m4__push_arg_quote (context, obs, argv, arg, NULL);
@@ -1639,7 +1639,7 @@ m4_push_arg (m4 *context, m4_obstack *obs, m4_macro_args *argv, size_t arg)
delimiters that were in effect when the reference was created. */
void
m4__push_arg_quote (m4 *context, m4_obstack *obs, m4_macro_args *argv,
- size_t arg, const m4_string_pair *quotes)
+ size_t arg, const m4_string_pair *quotes)
{
size_t level;
m4_symbol_value *value = arg_symbol (argv, arg, &level, false);
@@ -1658,7 +1658,7 @@ m4__push_arg_quote (m4 *context, m4_obstack *obs, m4_macro_args *argv,
first argument. If QUOTE, also push quoting around each arg. */
void
m4_push_args (m4 *context, m4_obstack *obs, m4_macro_args *argv, bool skip,
- bool quote)
+ bool quote)
{
m4_symbol_value tmp;
m4_symbol_value *value;
@@ -1675,7 +1675,7 @@ m4_push_args (m4 *context, m4_obstack *obs, m4_macro_args *argv, bool skip,
}
value = make_argv_ref (context, &tmp, obs, -1, argv, i, argv->flatten,
- quote ? quotes : NULL);
+ quote ? quotes : NULL);
assert (value == &tmp);
if (m4__push_symbol (context, value, -1, argv->inuse))
arg_mark (argv);
@@ -1701,49 +1701,49 @@ m4_wrap_args (m4 *context, m4_macro_args *argv)
for (i = 1; i < limit; i++)
{
if (i != 1)
- obstack_1grow (obs, ' ');
+ obstack_1grow (obs, ' ');
value = m4_arg_symbol (argv, i);
switch (value->type)
- {
- case M4_SYMBOL_TEXT:
- obstack_grow (obs, m4_get_symbol_value_text (value),
- m4_get_symbol_value_len (value));
- break;
- case M4_SYMBOL_FUNC:
- m4__append_builtin (obs, value->u.builtin, NULL, end);
- break;
- case M4_SYMBOL_COMP:
- chain = value->u.u_c.chain;
- while (chain)
- {
- switch (chain->type)
- {
- case M4__CHAIN_STR:
- obstack_grow (obs, chain->u.u_s.str, chain->u.u_s.len);
- break;
- case M4__CHAIN_FUNC:
- m4__append_builtin (obs, chain->u.builtin, NULL, end);
- break;
- case M4__CHAIN_ARGV:
- m4__arg_print (context, obs, chain->u.u_a.argv,
- chain->u.u_a.index,
- m4__quote_cache (M4SYNTAX, NULL,
- chain->quote_age,
- chain->u.u_a.quotes),
- chain->u.u_a.flatten, end, NULL, NULL, false,
- false);
- break;
- default:
- assert (!"m4_wrap_args");
- abort ();
- }
- chain = chain->next;
- }
- break;
- default:
- assert (!"m4_wrap_args");
- abort ();
- }
+ {
+ case M4_SYMBOL_TEXT:
+ obstack_grow (obs, m4_get_symbol_value_text (value),
+ m4_get_symbol_value_len (value));
+ break;
+ case M4_SYMBOL_FUNC:
+ m4__append_builtin (obs, value->u.builtin, NULL, end);
+ break;
+ case M4_SYMBOL_COMP:
+ chain = value->u.u_c.chain;
+ while (chain)
+ {
+ switch (chain->type)
+ {
+ case M4__CHAIN_STR:
+ obstack_grow (obs, chain->u.u_s.str, chain->u.u_s.len);
+ break;
+ case M4__CHAIN_FUNC:
+ m4__append_builtin (obs, chain->u.builtin, NULL, end);
+ break;
+ case M4__CHAIN_ARGV:
+ m4__arg_print (context, obs, chain->u.u_a.argv,
+ chain->u.u_a.index,
+ m4__quote_cache (M4SYNTAX, NULL,
+ chain->quote_age,
+ chain->u.u_a.quotes),
+ chain->u.u_a.flatten, end, NULL, NULL, false,
+ false);
+ break;
+ default:
+ assert (!"m4_wrap_args");
+ abort ();
+ }
+ chain = chain->next;
+ }
+ break;
+ default:
+ assert (!"m4_wrap_args");
+ abort ();
+ }
}
m4__push_wrapup_finish ();
}
diff --git a/m4/module.c b/m4/module.c
index 67d1b4a1..6f1a37ae 100644
--- a/m4/module.c
+++ b/m4/module.c
@@ -84,13 +84,13 @@
static const char* module_dlerror (void);
static int module_remove (m4 *context, m4_module *module,
- m4_obstack *obs);
+ m4_obstack *obs);
static void install_builtin_table (m4*, m4_module *);
static void install_macro_table (m4*, m4_module *);
static int m4__module_interface (lt_dlhandle handle,
- const char *id_string);
+ const char *id_string);
static lt_dlinterface_id iface_id = NULL;
@@ -108,7 +108,7 @@ m4_get_module_name (const m4_module *module)
void *
m4_module_import (m4 *context, const char *module_name,
- const char *symbol_name, m4_obstack *obs)
+ const char *symbol_name, m4_obstack *obs)
{
m4_module * module = m4__module_find (module_name);
void * symbol_address = NULL;
@@ -125,9 +125,9 @@ m4_module_import (m4 *context, const char *module_name,
symbol_address = lt_dlsym (module->handle, symbol_name);
if (!symbol_address)
- m4_error (context, 0, 0, NULL,
- _("cannot load symbol `%s' from module `%s'"),
- symbol_name, module_name);
+ m4_error (context, 0, 0, NULL,
+ _("cannot load symbol `%s' from module `%s'"),
+ symbol_name, module_name);
}
return symbol_address;
@@ -147,17 +147,17 @@ install_builtin_table (m4 *context, m4_module *module)
m4__set_symbol_value_builtin (value, &module->builtins[i]);
if (m4_get_prefix_builtins_opt (context))
- name = xasprintf ("m4_%s", name);
+ name = xasprintf ("m4_%s", name);
m4_symbol_pushdef (M4SYMTAB, name, strlen (name), value);
if (m4_get_prefix_builtins_opt (context))
- free ((char *) name);
+ free ((char *) name);
}
if (i)
m4_debug_message (context, M4_DEBUG_TRACE_MODULE,
- _("module %s: builtins loaded"),
- m4_get_module_name (module));
+ _("module %s: builtins loaded"),
+ m4_get_module_name (module));
}
static void
@@ -173,24 +173,24 @@ install_macro_table (m4 *context, m4_module *module)
if (mp)
{
for (; mp->name != NULL; mp++)
- {
- m4_symbol_value *value = m4_symbol_value_create ();
- size_t len = strlen (mp->value);
+ {
+ m4_symbol_value *value = m4_symbol_value_create ();
+ size_t len = strlen (mp->value);
- /* Sanity check that builtins meet the required interface. */
- assert (mp->min_args <= mp->max_args);
+ /* Sanity check that builtins meet the required interface. */
+ assert (mp->min_args <= mp->max_args);
- m4_set_symbol_value_text (value, xmemdup0 (mp->value, len), len, 0);
- VALUE_MODULE (value) = module;
- VALUE_MIN_ARGS (value) = mp->min_args;
- VALUE_MAX_ARGS (value) = mp->max_args;
+ m4_set_symbol_value_text (value, xmemdup0 (mp->value, len), len, 0);
+ VALUE_MODULE (value) = module;
+ VALUE_MIN_ARGS (value) = mp->min_args;
+ VALUE_MAX_ARGS (value) = mp->max_args;
- m4_symbol_pushdef (M4SYMTAB, mp->name, strlen (mp->name), value);
- }
+ m4_symbol_pushdef (M4SYMTAB, mp->name, strlen (mp->name), value);
+ }
m4_debug_message (context, M4_DEBUG_TRACE_MODULE,
- _("module %s: macros loaded"),
- m4_get_module_name (module));
+ _("module %s: macros loaded"),
+ m4_get_module_name (module));
}
}
@@ -242,8 +242,8 @@ m4_module_unload (m4 *context, const char *name, m4_obstack *obs)
if (errors)
{
m4_error (context, EXIT_FAILURE, 0, NULL,
- _("cannot unload module `%s': %s"),
- name ? name : MODULE_SELF_NAME, module_dlerror ());
+ _("cannot unload module `%s': %s"),
+ name ? name : MODULE_SELF_NAME, module_dlerror ());
}
}
@@ -261,9 +261,9 @@ m4__module_interface (lt_dlhandle handle, const char *id_string)
/* A valid m4 module must provide at least one of these symbols. */
return !(lt_dlsym (handle, INIT_SYMBOL)
- || lt_dlsym (handle, FINISH_SYMBOL)
- || lt_dlsym (handle, BUILTIN_SYMBOL)
- || lt_dlsym (handle, MACRO_SYMBOL));
+ || lt_dlsym (handle, FINISH_SYMBOL)
+ || lt_dlsym (handle, BUILTIN_SYMBOL)
+ || lt_dlsym (handle, MACRO_SYMBOL));
}
@@ -281,7 +281,7 @@ m4__module_next (m4_module *module)
{
handle = lt_dlhandle_iterate (iface_id, handle);
if (!handle)
- return NULL;
+ return NULL;
module = (m4_module *) lt_dlcaller_get_data (iface_id, handle);
}
while (!module);
@@ -322,7 +322,7 @@ m4__module_init (m4 *context)
if (iface_id)
{
m4_error (context, 0, 0, NULL,
- _("multiple module loader initializations"));
+ _("multiple module loader initializations"));
return;
}
@@ -335,16 +335,16 @@ m4__module_init (m4 *context)
iface_id = lt_dlinterface_register ("m4 libm4", m4__module_interface);
if (!iface_id)
- {
- const char *error_msg = _("libltdl client registration failed");
+ {
+ const char *error_msg = _("libltdl client registration failed");
- lt_dlseterror (lt_dladderror (error_msg));
+ lt_dlseterror (lt_dladderror (error_msg));
- /* No need to check error statuses from the calls above -- If
- either fails for some reason, a diagnostic will be set for
- lt_dlerror() anyway. */
- ++errors;
- }
+ /* No need to check error statuses from the calls above -- If
+ either fails for some reason, a diagnostic will be set for
+ lt_dlerror() anyway. */
+ ++errors;
+ }
}
if (!errors)
@@ -357,13 +357,13 @@ m4__module_init (m4 *context)
char *path = getenv (USER_MODULE_PATH_ENV);
if (path)
- errors = lt_dlinsertsearchdir (lt_dlgetsearchpath (), path);
+ errors = lt_dlinsertsearchdir (lt_dlgetsearchpath (), path);
}
/* Couldn't initialize the module system; diagnose and exit. */
if (errors)
m4_error (context, EXIT_FAILURE, 0, NULL,
- _("failed to initialize module loader: %s"), module_dlerror ());
+ _("failed to initialize module loader: %s"), module_dlerror ());
#ifdef DEBUG_MODULES
fputs ("Module loader initialized.\n", stderr);
@@ -406,103 +406,103 @@ m4__module_open (m4 *context, const char *name, m4_obstack *obs)
#ifdef DEBUG_MODULES
if (info->ref_count > 1)
- {
- xfprintf (stderr, "module %s: now has %d libtool references.",
- name, info->ref_count);
- }
+ {
+ xfprintf (stderr, "module %s: now has %d libtool references.",
+ name, info->ref_count);
+ }
#endif /* DEBUG_MODULES */
m4_debug_message (context, M4_DEBUG_TRACE_MODULE,
- _("module %s: opening file %s"),
- name ? name : MODULE_SELF_NAME,
- quotearg_style (locale_quoting_style, info->filename));
+ _("module %s: opening file %s"),
+ name ? name : MODULE_SELF_NAME,
+ quotearg_style (locale_quoting_style, info->filename));
/* Provide the m4_module corresponding to the lt_dlhandle, if
- not yet created. */
+ not yet created. */
module = (m4_module *) lt_dlcaller_get_data (iface_id, handle);
if (!module)
- {
- void *old;
- const char *err;
- const m4_builtin *bp;
-
- module = (m4_module *) xzalloc (sizeof *module);
- module->handle = handle;
-
- /* TODO - change module interface to return function pointer
- that supplies both table and length of table, rather than
- returning data pointer that must have a sentinel
- entry? */
- bp = (m4_builtin *) lt_dlsym (module->handle, BUILTIN_SYMBOL);
- if (bp)
- {
- const m4_builtin *tmp;
- m4__builtin *builtin;
- for (tmp = bp; tmp->name; tmp++)
- module->builtins_len++;
- module->builtins =
- (m4__builtin *) xnmalloc (module->builtins_len,
- sizeof *module->builtins);
- for (builtin = module->builtins; bp->name != NULL;
- bp++, builtin++)
- {
- /* Sanity check that builtins meet the required
- interface. */
- assert (bp->min_args <= bp->max_args);
- assert (bp->min_args > 0
- || (bp->flags & (M4_BUILTIN_BLIND
- | M4_BUILTIN_SIDE_EFFECT)) == 0);
- assert (bp->max_args
- || (bp->flags & M4_BUILTIN_FLATTEN_ARGS) == 0);
- assert ((bp->flags & ~M4_BUILTIN_FLAGS_MASK) == 0);
-
- memcpy (&builtin->builtin, bp, sizeof *bp);
- builtin->builtin.name = xstrdup (bp->name);
- builtin->module = module;
- }
- }
- qsort (module->builtins, module->builtins_len,
- sizeof *module->builtins, compare_builtin_CB);
-
- /* clear out any stale errors, since we have to use
- lt_dlerror to distinguish between success and
- failure. */
- lt_dlerror ();
- old = lt_dlcaller_set_data (iface_id, handle, module);
- assert (!old);
- err = lt_dlerror ();
- if (err)
- m4_error (context, EXIT_FAILURE, 0, NULL,
- _("unable to load module `%s': %s"), name, err);
- }
+ {
+ void *old;
+ const char *err;
+ const m4_builtin *bp;
+
+ module = (m4_module *) xzalloc (sizeof *module);
+ module->handle = handle;
+
+ /* TODO - change module interface to return function pointer
+ that supplies both table and length of table, rather than
+ returning data pointer that must have a sentinel
+ entry? */
+ bp = (m4_builtin *) lt_dlsym (module->handle, BUILTIN_SYMBOL);
+ if (bp)
+ {
+ const m4_builtin *tmp;
+ m4__builtin *builtin;
+ for (tmp = bp; tmp->name; tmp++)
+ module->builtins_len++;
+ module->builtins =
+ (m4__builtin *) xnmalloc (module->builtins_len,
+ sizeof *module->builtins);
+ for (builtin = module->builtins; bp->name != NULL;
+ bp++, builtin++)
+ {
+ /* Sanity check that builtins meet the required
+ interface. */
+ assert (bp->min_args <= bp->max_args);
+ assert (bp->min_args > 0
+ || (bp->flags & (M4_BUILTIN_BLIND
+ | M4_BUILTIN_SIDE_EFFECT)) == 0);
+ assert (bp->max_args
+ || (bp->flags & M4_BUILTIN_FLATTEN_ARGS) == 0);
+ assert ((bp->flags & ~M4_BUILTIN_FLAGS_MASK) == 0);
+
+ memcpy (&builtin->builtin, bp, sizeof *bp);
+ builtin->builtin.name = xstrdup (bp->name);
+ builtin->module = module;
+ }
+ }
+ qsort (module->builtins, module->builtins_len,
+ sizeof *module->builtins, compare_builtin_CB);
+
+ /* clear out any stale errors, since we have to use
+ lt_dlerror to distinguish between success and
+ failure. */
+ lt_dlerror ();
+ old = lt_dlcaller_set_data (iface_id, handle, module);
+ assert (!old);
+ err = lt_dlerror ();
+ if (err)
+ m4_error (context, EXIT_FAILURE, 0, NULL,
+ _("unable to load module `%s': %s"), name, err);
+ }
/* Find and run any initializing function in the opened module,
- each time the module is opened. */
+ each time the module is opened. */
module->refcount++;
init_func = (m4_module_init_func *) lt_dlsym (handle, INIT_SYMBOL);
if (init_func)
- {
- init_func (context, module, obs);
+ {
+ init_func (context, module, obs);
- m4_debug_message (context, M4_DEBUG_TRACE_MODULE,
- _("module %s: init hook called"), name);
- }
+ m4_debug_message (context, M4_DEBUG_TRACE_MODULE,
+ _("module %s: init hook called"), name);
+ }
else if (!lt_dlsym (handle, FINISH_SYMBOL)
- && !lt_dlsym (handle, BUILTIN_SYMBOL)
- && !lt_dlsym (handle, MACRO_SYMBOL))
- {
- m4_error (context, EXIT_FAILURE, 0, NULL,
- _("module `%s' has no entry points"), name);
- }
+ && !lt_dlsym (handle, BUILTIN_SYMBOL)
+ && !lt_dlsym (handle, MACRO_SYMBOL))
+ {
+ m4_error (context, EXIT_FAILURE, 0, NULL,
+ _("module `%s' has no entry points"), name);
+ }
m4_debug_message (context, M4_DEBUG_TRACE_MODULE,
- _("module %s: opened"), name);
+ _("module %s: opened"), name);
}
else
{
/* Couldn't open the module; diagnose and exit. */
m4_error (context, EXIT_FAILURE, 0, NULL,
- _("cannot open module `%s': %s"), name, module_dlerror ());
+ _("cannot open module `%s': %s"), name, module_dlerror ());
}
return module;
@@ -519,9 +519,9 @@ m4__module_exit (m4 *context)
m4_module * pending = module;
/* If we are about to unload the final reference, move on to the
- next module before we unload the current one. */
+ next module before we unload the current one. */
if (pending->refcount <= 1)
- module = m4__module_next (module);
+ module = m4__module_next (module);
errors = module_remove (context, pending, NULL);
}
@@ -536,7 +536,7 @@ m4__module_exit (m4 *context)
if (errors)
{
m4_error (context, EXIT_FAILURE, 0, NULL,
- _("cannot unload all modules: %s"), module_dlerror ());
+ _("cannot unload all modules: %s"), module_dlerror ());
}
}
@@ -585,20 +585,20 @@ module_remove (m4 *context, m4_module *module, m4_obstack *obs)
if (info->ref_count > 1)
{
xfprintf (stderr, "module %s: now has %d libtool references.",
- name, info->ref_count - 1);
+ name, info->ref_count - 1);
}
#endif /* DEBUG_MODULES */
if (module->refcount-- == 1)
{
/* Remove the table references only when ref_count is *exactly*
- equal to 1. If module_close is called again on a
- resident module after the references have already been
- removed, we needn't try to remove them again! */
+ equal to 1. If module_close is called again on a
+ resident module after the references have already been
+ removed, we needn't try to remove them again! */
m4__symtab_remove_module_references (M4SYMTAB, module);
m4_debug_message (context, M4_DEBUG_TRACE_MODULE,
- _("module %s: symbols unloaded"), name);
+ _("module %s: symbols unloaded"), name);
last_reference = true;
}
@@ -608,48 +608,48 @@ module_remove (m4 *context, m4_module *module, m4_obstack *obs)
finish_func (context, module, obs);
m4_debug_message (context, M4_DEBUG_TRACE_MODULE,
- _("module %s: finish hook called"), name);
+ _("module %s: finish hook called"), name);
}
if (last_reference && resident)
{
/* Special case when closing last reference to resident module -
- we need to remove the association of the m4_module wrapper
- with the dlhandle, because we are about to free the wrapper,
- but the module will still show up in lt_dlhandle_iterate.
- Still call lt_dlclose to reduce the ref count, but ignore the
- failure about not closing a resident module. */
+ we need to remove the association of the m4_module wrapper
+ with the dlhandle, because we are about to free the wrapper,
+ but the module will still show up in lt_dlhandle_iterate.
+ Still call lt_dlclose to reduce the ref count, but ignore the
+ failure about not closing a resident module. */
void *old = lt_dlcaller_set_data (iface_id, handle, NULL);
if (!old)
- m4_error (context, EXIT_FAILURE, 0, NULL,
- _("unable to close module `%s': %s"), name,
- module_dlerror());
+ m4_error (context, EXIT_FAILURE, 0, NULL,
+ _("unable to close module `%s': %s"), name,
+ module_dlerror());
assert (old == module);
lt_dlclose (handle);
m4_debug_message (context, M4_DEBUG_TRACE_MODULE,
- _("module %s: resident module not closed"), name);
+ _("module %s: resident module not closed"), name);
}
else
{
errors = lt_dlclose (handle);
/* Ignore the error expected if the module was resident. */
if (resident)
- errors = 0;
+ errors = 0;
if (!errors)
- {
- m4_debug_message (context, M4_DEBUG_TRACE_MODULE,
- _("module %s: closed"), name);
- }
+ {
+ m4_debug_message (context, M4_DEBUG_TRACE_MODULE,
+ _("module %s: closed"), name);
+ }
}
if (errors)
m4_error (context, EXIT_FAILURE, 0, NULL,
- _("cannot close module `%s': %s"), name, module_dlerror ());
+ _("cannot close module `%s': %s"), name, module_dlerror ());
if (last_reference)
{
size_t i;
for (i = 0; i < module->builtins_len; i++)
- free ((char *) module->builtins[i].builtin.name);
+ free ((char *) module->builtins[i].builtin.name);
free (module->builtins);
free (module);
}
diff --git a/m4/output.c b/m4/output.c
index 0535d93a..092e330c 100644
--- a/m4/output.c
+++ b/m4/output.c
@@ -66,9 +66,9 @@ struct m4_diversion
{
union
{
- FILE *file; /* Diversion file on disk. */
- char *buffer; /* Malloc'd diversion buffer. */
- m4_diversion *next; /* Free-list pointer */
+ FILE *file; /* Diversion file on disk. */
+ char *buffer; /* Malloc'd diversion buffer. */
+ m4_diversion *next; /* Free-list pointer */
} u;
int divnum; /* Which diversion this represents. */
size_t size; /* Usable size before reallocation. */
@@ -163,16 +163,16 @@ cleanup_tmpfile (void)
const void *elt;
gl_oset_iterator_t iter = gl_oset_iterator (diversion_table);
while (gl_oset_iterator_next (&iter, &elt))
- {
- m4_diversion *diversion = (m4_diversion *) elt;
- if (!diversion->size && diversion->u.file
- && close_stream_temp (diversion->u.file) != 0)
- {
- error (0, errno,
- _("cannot clean temporary file for diversion"));
- fail = true;
- }
- }
+ {
+ m4_diversion *diversion = (m4_diversion *) elt;
+ if (!diversion->size && diversion->u.file
+ && close_stream_temp (diversion->u.file) != 0)
+ {
+ error (0, errno,
+ _("cannot clean temporary file for diversion"));
+ fail = true;
+ }
+ }
gl_oset_iterator_free (&iter);
}
@@ -194,7 +194,7 @@ m4_tmpname (int divnum)
obstack_printf (&diversion_storage, "%s/m4-", output_temp_dir->dir_name);
offset = obstack_object_size (&diversion_storage);
buffer = (char *) obstack_alloc (&diversion_storage,
- INT_BUFSIZE_BOUND (divnum));
+ INT_BUFSIZE_BOUND (divnum));
}
assert (0 < divnum);
if (snprintf (&buffer[offset], INT_BUFSIZE_BOUND (divnum), "%d", divnum) < 0)
@@ -219,8 +219,8 @@ m4_tmpfile (m4 *context, int divnum)
{
output_temp_dir = create_temp_dir ("m4-", NULL, true);
if (output_temp_dir == NULL)
- m4_error (context, EXIT_FAILURE, errno, NULL,
- _("cannot create temporary file for diversion"));
+ m4_error (context, EXIT_FAILURE, errno, NULL,
+ _("cannot create temporary file for diversion"));
atexit (cleanup_tmpfile);
}
name = m4_tmpname (divnum);
@@ -230,7 +230,7 @@ m4_tmpfile (m4 *context, int divnum)
{
unregister_temp_file (output_temp_dir, name);
m4_error (context, EXIT_FAILURE, errno, NULL,
- _("cannot create temporary file for diversion"));
+ _("cannot create temporary file for diversion"));
}
else if (set_cloexec_flag (fileno (file), true) != 0)
m4_warn (context, errno, NULL, _("cannot protect diversion across forks"));
@@ -251,16 +251,16 @@ m4_tmpopen (m4 *context, int divnum, bool reread)
if (tmp_file1_owner == divnum)
{
if (reread && fseeko (tmp_file1, 0, SEEK_SET) != 0)
- m4_error (context, EXIT_FAILURE, errno, NULL,
- _("cannot seek within diversion"));
+ m4_error (context, EXIT_FAILURE, errno, NULL,
+ _("cannot seek within diversion"));
tmp_file2_recent = false;
return tmp_file1;
}
else if (tmp_file2_owner == divnum)
{
if (reread && fseeko (tmp_file2, 0, SEEK_SET) != 0)
- m4_error (context, EXIT_FAILURE, errno, NULL,
- _("cannot seek to beginning of diversion"));
+ m4_error (context, EXIT_FAILURE, errno, NULL,
+ _("cannot seek to beginning of diversion"));
tmp_file2_recent = true;
return tmp_file2;
}
@@ -269,14 +269,14 @@ m4_tmpopen (m4 *context, int divnum, bool reread)
file = fopen_temp (name, O_BINARY ? "rb+" : "r+");
if (file == NULL)
m4_error (context, EXIT_FAILURE, errno, NULL,
- _("cannot create temporary file for diversion"));
+ _("cannot create temporary file for diversion"));
else if (set_cloexec_flag (fileno (file), true) != 0)
m4_warn (context, errno, NULL, _("cannot protect diversion across forks"));
/* Update mode starts at the beginning of the stream, but sometimes
we want the end. */
else if (!reread && fseeko (file, 0, SEEK_END) != 0)
m4_error (context, EXIT_FAILURE, errno, NULL,
- _("cannot seek within diversion"));
+ _("cannot seek within diversion"));
return file;
}
@@ -292,19 +292,19 @@ m4_tmpclose (FILE *file, int divnum)
if (divnum != tmp_file1_owner && divnum != tmp_file2_owner)
{
if (tmp_file2_recent)
- {
- if (tmp_file1_owner)
- result = close_stream_temp (tmp_file1);
- tmp_file1 = file;
- tmp_file1_owner = divnum;
- }
+ {
+ if (tmp_file1_owner)
+ result = close_stream_temp (tmp_file1);
+ tmp_file1 = file;
+ tmp_file1_owner = divnum;
+ }
else
- {
- if (tmp_file2_owner)
- result = close_stream_temp (tmp_file2);
- tmp_file2 = file;
- tmp_file2_owner = divnum;
- }
+ {
+ if (tmp_file2_owner)
+ result = close_stream_temp (tmp_file2);
+ tmp_file2 = file;
+ tmp_file2_owner = divnum;
+ }
}
return result;
}
@@ -317,14 +317,14 @@ m4_tmpremove (int divnum)
{
int result = close_stream_temp (tmp_file1);
if (result)
- return result;
+ return result;
tmp_file1_owner = 0;
}
else if (divnum == tmp_file2_owner)
{
int result = close_stream_temp (tmp_file2);
if (result)
- return result;
+ return result;
tmp_file2_owner = 0;
}
return cleanup_temp_file (output_temp_dir, m4_tmpname (divnum));
@@ -344,33 +344,33 @@ m4_tmprename (m4 *context, int oldnum, int newnum)
{
/* Be careful of mingw, which can't rename an open file. */
if (RENAME_OPEN_FILE_WORKS)
- tmp_file1_owner = newnum;
+ tmp_file1_owner = newnum;
else
- {
- if (close_stream_temp (tmp_file1))
- m4_error (context, EXIT_FAILURE, errno, NULL,
- _("cannot close temporary file for diversion"));
- tmp_file1_owner = 0;
- }
+ {
+ if (close_stream_temp (tmp_file1))
+ m4_error (context, EXIT_FAILURE, errno, NULL,
+ _("cannot close temporary file for diversion"));
+ tmp_file1_owner = 0;
+ }
}
else if (oldnum == tmp_file2_owner)
{
/* Be careful of mingw, which can't rename an open file. */
if (RENAME_OPEN_FILE_WORKS)
- tmp_file2_owner = newnum;
+ tmp_file2_owner = newnum;
else
- {
- if (close_stream_temp (tmp_file2))
- m4_error (context, EXIT_FAILURE, errno, NULL,
- _("cannot close temporary file for diversion"));
- tmp_file2_owner = 0;
- }
+ {
+ if (close_stream_temp (tmp_file2))
+ m4_error (context, EXIT_FAILURE, errno, NULL,
+ _("cannot close temporary file for diversion"));
+ tmp_file2_owner = 0;
+ }
}
/* Either it is safe to rename an open file, or no one should have
oldname open at this point. */
if (rename (oldname, newname))
m4_error (context, EXIT_FAILURE, errno, NULL,
- _("cannot create temporary file for diversion"));
+ _("cannot create temporary file for diversion"));
unregister_temp_file (output_temp_dir, oldname);
free (oldname);
return m4_tmpopen (context, newnum, false);
@@ -384,7 +384,7 @@ void
m4_output_init (m4 *context)
{
diversion_table = gl_oset_create_empty (GL_AVLTREE_OSET, cmp_diversion_CB,
- NULL);
+ NULL);
div0.u.file = stdout;
m4_set_current_diversion (context, 0);
output_diversion = &div0;
@@ -433,7 +433,7 @@ make_room_for (m4 *context, size_t length)
for (wanted_size = output_diversion->size;
wanted_size <= MAXIMUM_TOTAL_SIZE
- && wanted_size - output_diversion->used < length;
+ && wanted_size - output_diversion->used < length;
wanted_size = wanted_size == 0 ? INITIAL_BUFFER_SIZE : wanted_size * 2)
;
@@ -450,46 +450,46 @@ make_room_for (m4 *context, size_t length)
const void *elt;
/* Find out the buffer having most data, in view of flushing it to
- disk. Fake the current buffer as having already received the
- projected data, while making the selection. So, if it is
- selected indeed, we will flush it smaller, before it grows. */
+ disk. Fake the current buffer as having already received the
+ projected data, while making the selection. So, if it is
+ selected indeed, we will flush it smaller, before it grows. */
selected_diversion = output_diversion;
selected_used = output_diversion->used + length;
iter = gl_oset_iterator (diversion_table);
while (gl_oset_iterator_next (&iter, &elt))
- {
- diversion = (m4_diversion *) elt;
- if (diversion->used > selected_used)
- {
- selected_diversion = diversion;
- selected_used = diversion->used;
- }
- }
+ {
+ diversion = (m4_diversion *) elt;
+ if (diversion->used > selected_used)
+ {
+ selected_diversion = diversion;
+ selected_used = diversion->used;
+ }
+ }
gl_oset_iterator_free (&iter);
/* Create a temporary file, write the in-memory buffer of the
- diversion to this file, then release the buffer. Zero the
- diversion before doing anything that can exit () (including
- m4_tmpfile), so that the atexit handler doesn't try to close
- a garbage pointer as a file. */
+ diversion to this file, then release the buffer. Zero the
+ diversion before doing anything that can exit () (including
+ m4_tmpfile), so that the atexit handler doesn't try to close
+ a garbage pointer as a file. */
selected_buffer = selected_diversion->u.buffer;
total_buffer_size -= selected_diversion->size;
selected_diversion->size = 0;
selected_diversion->u.file = NULL;
selected_diversion->u.file = m4_tmpfile (context,
- selected_diversion->divnum);
+ selected_diversion->divnum);
if (selected_diversion->used > 0)
- {
- count = fwrite (selected_buffer, selected_diversion->used, 1,
- selected_diversion->u.file);
- if (count != 1)
- m4_error (context, EXIT_FAILURE, errno, NULL,
- _("cannot flush diversion to temporary file"));
- }
+ {
+ count = fwrite (selected_buffer, selected_diversion->used, 1,
+ selected_diversion->u.file);
+ if (count != 1)
+ m4_error (context, EXIT_FAILURE, errno, NULL,
+ _("cannot flush diversion to temporary file"));
+ }
/* Reclaim the buffer space for other diversions. */
@@ -511,21 +511,21 @@ make_room_for (m4 *context, size_t length)
{
/* Close any selected file since it is not the current diversion. */
if (selected_diversion)
- {
- FILE *file = selected_diversion->u.file;
- selected_diversion->u.file = NULL;
- if (m4_tmpclose (file, selected_diversion->divnum) != 0)
- m4_error (context, 0, errno, NULL,
- _("cannot close temporary file for diversion"));
- }
+ {
+ FILE *file = selected_diversion->u.file;
+ selected_diversion->u.file = NULL;
+ if (m4_tmpclose (file, selected_diversion->divnum) != 0)
+ m4_error (context, 0, errno, NULL,
+ _("cannot close temporary file for diversion"));
+ }
/* The current buffer may be safely reallocated. */
assert (wanted_size >= length);
{
- char *buffer = output_diversion->u.buffer;
- output_diversion->u.buffer = xcharalloc ((size_t) wanted_size);
- memcpy (output_diversion->u.buffer, buffer, output_diversion->used);
- free (buffer);
+ char *buffer = output_diversion->u.buffer;
+ output_diversion->u.buffer = xcharalloc ((size_t) wanted_size);
+ memcpy (output_diversion->u.buffer, buffer, output_diversion->used);
+ free (buffer);
}
total_buffer_size += wanted_size - output_diversion->size;
@@ -578,8 +578,8 @@ m4_output_text (m4 *context, const char *text, size_t length)
{
count = fwrite (text, length, 1, output_file);
if (count != 1)
- m4_error (context, EXIT_FAILURE, errno, NULL,
- _("copying inserted file"));
+ m4_error (context, EXIT_FAILURE, errno, NULL,
+ _("copying inserted file"));
}
else
{
@@ -603,7 +603,7 @@ m4_output_text (m4 *context, const char *text, size_t length)
generate any output. */
void
m4_divert_text (m4 *context, m4_obstack *obs, const char *text, size_t length,
- int line)
+ int line)
{
static bool start_of_output_line = true;
@@ -626,7 +626,7 @@ m4_divert_text (m4 *context, m4_obstack *obs, const char *text, size_t length,
switch (length)
{
- /* In-line short texts. */
+ /* In-line short texts. */
case 8: OUTPUT_CHARACTER (*text); text++;
case 7: OUTPUT_CHARACTER (*text); text++;
@@ -637,72 +637,72 @@ m4_divert_text (m4 *context, m4_obstack *obs, const char *text, size_t length,
case 2: OUTPUT_CHARACTER (*text); text++;
case 1: OUTPUT_CHARACTER (*text);
case 0:
- return;
+ return;
- /* Optimize longer texts. */
+ /* Optimize longer texts. */
default:
- m4_output_text (context, text, length);
+ m4_output_text (context, text, length);
}
else
{
/* Check for syncline only at the start of a token. Multiline
- tokens, and tokens that are out of sync but in the middle of
- the line, must wait until the next raw newline triggers a
- syncline. */
+ tokens, and tokens that are out of sync but in the middle of
+ the line, must wait until the next raw newline triggers a
+ syncline. */
if (start_of_output_line)
- {
- start_of_output_line = false;
- m4_set_output_line (context, m4_get_output_line (context) + 1);
+ {
+ start_of_output_line = false;
+ m4_set_output_line (context, m4_get_output_line (context) + 1);
#ifdef DEBUG_OUTPUT
- xfprintf (stderr, "DEBUG: line %d, cur %lu, cur out %lu\n", line,
- (unsigned long int) m4_get_current_line (context),
- (unsigned long int) m4_get_output_line (context));
+ xfprintf (stderr, "DEBUG: line %d, cur %lu, cur out %lu\n", line,
+ (unsigned long int) m4_get_current_line (context),
+ (unsigned long int) m4_get_output_line (context));
#endif
- /* Output a `#line NUM' synchronization directive if needed.
- If output_line was previously given a negative
- value (invalidated), then output `#line NUM "FILE"'. */
-
- if (m4_get_output_line (context) != line)
- {
- char linebuf[sizeof "#line " + INT_BUFSIZE_BOUND (line)];
- sprintf (linebuf, "#line %lu",
- (unsigned long int) m4_get_current_line (context));
- m4_output_text (context, linebuf, strlen (linebuf));
- if (m4_get_output_line (context) < 1
- && m4_get_current_file (context)[0] != '\0')
- {
- const char *file = m4_get_current_file (context);
- OUTPUT_CHARACTER (' ');
- OUTPUT_CHARACTER ('"');
- m4_output_text (context, file, strlen (file));
- OUTPUT_CHARACTER ('"');
- }
- OUTPUT_CHARACTER ('\n');
- m4_set_output_line (context, line);
- }
- }
+ /* Output a `#line NUM' synchronization directive if needed.
+ If output_line was previously given a negative
+ value (invalidated), then output `#line NUM "FILE"'. */
+
+ if (m4_get_output_line (context) != line)
+ {
+ char linebuf[sizeof "#line " + INT_BUFSIZE_BOUND (line)];
+ sprintf (linebuf, "#line %lu",
+ (unsigned long int) m4_get_current_line (context));
+ m4_output_text (context, linebuf, strlen (linebuf));
+ if (m4_get_output_line (context) < 1
+ && m4_get_current_file (context)[0] != '\0')
+ {
+ const char *file = m4_get_current_file (context);
+ OUTPUT_CHARACTER (' ');
+ OUTPUT_CHARACTER ('"');
+ m4_output_text (context, file, strlen (file));
+ OUTPUT_CHARACTER ('"');
+ }
+ OUTPUT_CHARACTER ('\n');
+ m4_set_output_line (context, line);
+ }
+ }
/* Output the token, and track embedded newlines. */
for (; length-- > 0; text++)
- {
- if (start_of_output_line)
- {
- start_of_output_line = false;
- m4_set_output_line (context, m4_get_output_line (context) + 1);
+ {
+ if (start_of_output_line)
+ {
+ start_of_output_line = false;
+ m4_set_output_line (context, m4_get_output_line (context) + 1);
#ifdef DEBUG_OUTPUT
- xfprintf (stderr, "DEBUG: line %d, cur %lu, cur out %lu\n", line,
- (unsigned long int) m4_get_current_line (context),
- (unsigned long int) m4_get_output_line (context));
+ xfprintf (stderr, "DEBUG: line %d, cur %lu, cur out %lu\n", line,
+ (unsigned long int) m4_get_current_line (context),
+ (unsigned long int) m4_get_output_line (context));
#endif
- }
- OUTPUT_CHARACTER (*text);
- if (*text == '\n')
- start_of_output_line = true;
- }
+ }
+ OUTPUT_CHARACTER (*text);
+ if (*text == '\n')
+ start_of_output_line = true;
+ }
}
}
@@ -736,11 +736,11 @@ m4_shipout_int (m4_obstack *obs, int val)
string length of S instead. */
void
m4_shipout_string (m4 *context, m4_obstack *obs, const char *s, size_t len,
- bool quoted)
+ bool quoted)
{
m4_shipout_string_trunc (obs, s, len,
- quoted ? m4_get_syntax_quotes (M4SYNTAX) : NULL,
- NULL);
+ quoted ? m4_get_syntax_quotes (M4SYNTAX) : NULL,
+ NULL);
}
/* Output the text S, of length LEN, to OBS. If QUOTES, also output
@@ -750,7 +750,7 @@ m4_shipout_string (m4 *context, m4_obstack *obs, const char *s, size_t len,
otherwise return false. Quotes do not count against MAX_LEN. */
bool
m4_shipout_string_trunc (m4_obstack *obs, const char *s, size_t len,
- const m4_string_pair *quotes, size_t *max_len)
+ const m4_string_pair *quotes, size_t *max_len)
{
size_t max = max_len ? *max_len : SIZE_MAX;
@@ -800,24 +800,24 @@ m4_make_diversion (m4 *context, int divnum)
assert (!output_file || output_diversion->u.file == output_file);
assert (output_diversion->divnum != divnum);
if (!output_diversion->size && !output_diversion->u.file)
- {
- assert (!output_diversion->used);
- if (!gl_oset_remove (diversion_table, output_diversion))
- assert (false);
- output_diversion->u.next = free_list;
- free_list = output_diversion;
- }
+ {
+ assert (!output_diversion->used);
+ if (!gl_oset_remove (diversion_table, output_diversion))
+ assert (false);
+ output_diversion->u.next = free_list;
+ free_list = output_diversion;
+ }
else if (output_diversion->size)
- output_diversion->used = output_diversion->size - output_unused;
+ output_diversion->used = output_diversion->size - output_unused;
else if (output_diversion->used)
- {
- assert (output_diversion->divnum != 0);
- FILE *file = output_diversion->u.file;
- output_diversion->u.file = NULL;
- if (m4_tmpclose (file, output_diversion->divnum) != 0)
- m4_error (context, 0, errno, NULL,
- _("cannot close temporary file for diversion"));
- }
+ {
+ assert (output_diversion->divnum != 0);
+ FILE *file = output_diversion->u.file;
+ output_diversion->u.file = NULL;
+ if (m4_tmpclose (file, output_diversion->divnum) != 0)
+ m4_error (context, 0, errno, NULL,
+ _("cannot close temporary file for diversion"));
+ }
output_diversion = NULL;
output_file = NULL;
output_cursor = NULL;
@@ -835,33 +835,33 @@ m4_make_diversion (m4 *context, int divnum)
{
const void *elt;
if (gl_oset_search_atleast (diversion_table, threshold_diversion_CB,
- &divnum, &elt))
- {
- m4_diversion *temp = (m4_diversion *) elt;
- if (temp->divnum == divnum)
- diversion = temp;
- }
+ &divnum, &elt))
+ {
+ m4_diversion *temp = (m4_diversion *) elt;
+ if (temp->divnum == divnum)
+ diversion = temp;
+ }
}
if (diversion == NULL)
{
/* First time visiting this diversion. */
if (free_list)
- {
- diversion = free_list;
- free_list = diversion->u.next;
- assert (!diversion->size && !diversion->used);
- }
+ {
+ diversion = free_list;
+ free_list = diversion->u.next;
+ assert (!diversion->size && !diversion->used);
+ }
else
- {
- diversion = (m4_diversion *) obstack_alloc (&diversion_storage,
- sizeof *diversion);
- diversion->size = 0;
- diversion->used = 0;
- }
+ {
+ diversion = (m4_diversion *) obstack_alloc (&diversion_storage,
+ sizeof *diversion);
+ diversion->size = 0;
+ diversion->used = 0;
+ }
diversion->u.file = NULL;
diversion->divnum = divnum;
if (!gl_oset_add (diversion_table, diversion))
- assert (false);
+ assert (false);
}
output_diversion = diversion;
@@ -873,9 +873,9 @@ m4_make_diversion (m4 *context, int divnum)
else
{
if (!output_diversion->u.file && output_diversion->used)
- output_diversion->u.file = m4_tmpopen (context,
- output_diversion->divnum,
- false);
+ output_diversion->u.file = m4_tmpopen (context,
+ output_diversion->divnum,
+ false);
output_file = output_diversion->u.file;
}
@@ -899,18 +899,18 @@ insert_file (m4 *context, FILE *file, bool escaped)
{
length = fread (buffer, 1, sizeof buffer, file);
if (ferror (file))
- m4_error (context, EXIT_FAILURE, errno, NULL,
- _("reading inserted file"));
+ m4_error (context, EXIT_FAILURE, errno, NULL,
+ _("reading inserted file"));
if (length == 0)
- break;
+ break;
if (escaped)
- {
- if (first)
- first = false;
- else
- m4_output_text (context, "\\\n", 2);
- str = quotearg_style_mem (escape_quoting_style, buffer, length);
- }
+ {
+ if (first)
+ first = false;
+ else
+ m4_output_text (context, "\\\n", 2);
+ str = quotearg_style_mem (escape_quoting_style, buffer, length);
+ }
m4_output_text (context, str, escaped ? strlen (str) : length);
}
}
@@ -934,57 +934,57 @@ static void
insert_diversion_helper (m4 *context, m4_diversion *diversion, bool escaped)
{
assert (diversion->divnum > 0
- && diversion->divnum != m4_get_current_diversion (context));
+ && diversion->divnum != m4_get_current_diversion (context));
/* Effectively undivert only if an output stream is active. */
if (output_diversion)
{
if (diversion->size)
- {
- if (!output_diversion->u.file)
- {
- /* Transferring diversion metadata is faster than
- copying contents. */
- assert (!output_diversion->used && output_diversion != &div0
- && !output_file);
- output_diversion->u.buffer = diversion->u.buffer;
- output_diversion->size = diversion->size;
- output_cursor = diversion->u.buffer + diversion->used;
- output_unused = diversion->size - diversion->used;
- diversion->u.buffer = NULL;
- }
- else
- {
- char *str = diversion->u.buffer;
- size_t len = diversion->used;
- /* Avoid double-charging the total in-memory size when
- transferring from one in-memory diversion to
- another. */
- total_buffer_size -= diversion->size;
- if (escaped)
- str = quotearg_style_mem (escape_quoting_style, str, len);
- m4_output_text (context, str, escaped ? strlen (str) : len);
- }
- }
+ {
+ if (!output_diversion->u.file)
+ {
+ /* Transferring diversion metadata is faster than
+ copying contents. */
+ assert (!output_diversion->used && output_diversion != &div0
+ && !output_file);
+ output_diversion->u.buffer = diversion->u.buffer;
+ output_diversion->size = diversion->size;
+ output_cursor = diversion->u.buffer + diversion->used;
+ output_unused = diversion->size - diversion->used;
+ diversion->u.buffer = NULL;
+ }
+ else
+ {
+ char *str = diversion->u.buffer;
+ size_t len = diversion->used;
+ /* Avoid double-charging the total in-memory size when
+ transferring from one in-memory diversion to
+ another. */
+ total_buffer_size -= diversion->size;
+ if (escaped)
+ str = quotearg_style_mem (escape_quoting_style, str, len);
+ m4_output_text (context, str, escaped ? strlen (str) : len);
+ }
+ }
else if (!output_diversion->u.file)
- {
- /* Transferring diversion metadata is faster than copying
- contents. */
- assert (!output_diversion->used && output_diversion != &div0
- && !output_file);
- output_diversion->u.file = m4_tmprename (context, diversion->divnum,
- output_diversion->divnum);
- output_diversion->used = 1;
- output_file = output_diversion->u.file;
- diversion->u.file = NULL;
- diversion->size = 1;
- }
+ {
+ /* Transferring diversion metadata is faster than copying
+ contents. */
+ assert (!output_diversion->used && output_diversion != &div0
+ && !output_file);
+ output_diversion->u.file = m4_tmprename (context, diversion->divnum,
+ output_diversion->divnum);
+ output_diversion->used = 1;
+ output_file = output_diversion->u.file;
+ diversion->u.file = NULL;
+ diversion->size = 1;
+ }
else
- {
- assert (diversion->used);
- if (!diversion->u.file)
- diversion->u.file = m4_tmpopen (context, diversion->divnum, true);
- insert_file (context, diversion->u.file, escaped);
- }
+ {
+ assert (diversion->used);
+ if (!diversion->u.file)
+ diversion->u.file = m4_tmpopen (context, diversion->divnum, true);
+ insert_file (context, diversion->u.file, escaped);
+ }
m4_set_output_line (context, -1);
}
@@ -993,23 +993,23 @@ insert_diversion_helper (m4 *context, m4_diversion *diversion, bool escaped)
if (diversion->size)
{
if (!output_diversion)
- total_buffer_size -= diversion->size;
+ total_buffer_size -= diversion->size;
free (diversion->u.buffer);
diversion->size = 0;
}
else
{
if (diversion->u.file)
- {
- FILE *file = diversion->u.file;
- diversion->u.file = NULL;
- if (m4_tmpclose (file, diversion->divnum) != 0)
- m4_error (context, 0, errno, NULL,
- _("cannot clean temporary file for diversion"));
- }
+ {
+ FILE *file = diversion->u.file;
+ diversion->u.file = NULL;
+ if (m4_tmpclose (file, diversion->divnum) != 0)
+ m4_error (context, 0, errno, NULL,
+ _("cannot clean temporary file for diversion"));
+ }
if (m4_tmpremove (diversion->divnum) != 0)
- m4_error (context, 0, errno, NULL,
- _("cannot clean temporary file for diversion"));
+ m4_error (context, 0, errno, NULL,
+ _("cannot clean temporary file for diversion"));
}
diversion->used = 0;
if (!gl_oset_remove (diversion_table, diversion))
@@ -1031,11 +1031,11 @@ m4_insert_diversion (m4 *context, int divnum)
if (divnum <= 0 || m4_get_current_diversion (context) == divnum)
return;
if (gl_oset_search_atleast (diversion_table, threshold_diversion_CB,
- &divnum, &elt))
+ &divnum, &elt))
{
m4_diversion *diversion = (m4_diversion *) elt;
if (diversion->divnum == divnum)
- insert_diversion_helper (context, diversion, false);
+ insert_diversion_helper (context, diversion, false);
}
}
@@ -1051,7 +1051,7 @@ m4_undivert_all (m4 *context)
{
m4_diversion *diversion = (m4_diversion *) elt;
if (diversion->divnum != divnum)
- insert_diversion_helper (context, diversion, false);
+ insert_diversion_helper (context, diversion, false);
}
gl_oset_iterator_free (&iter);
}
@@ -1075,38 +1075,38 @@ m4_freeze_diversions (m4 *context, FILE *file)
{
m4_diversion *diversion = (m4_diversion *) elt;
if (diversion->size || diversion->used)
- {
- if (diversion->size)
- {
- assert (diversion->used == (int) diversion->used);
- xfprintf (file, "D%d,%d\n", diversion->divnum,
- (int) diversion->used);
- }
- else
- {
- struct stat file_stat;
- assert (!diversion->u.file);
- diversion->u.file = m4_tmpopen (context, diversion->divnum,
- true);
- if (fstat (fileno (diversion->u.file), &file_stat) < 0)
- m4_error (context, EXIT_FAILURE, errno, NULL,
- _("cannot stat diversion"));
- /* FIXME - support 64-bit off_t with 32-bit long, and
- fix frozen file format to support 64-bit integers.
- This implies fixing m4_divert_text to take off_t. */
- if (file_stat.st_size < 0
- || file_stat.st_size != (unsigned long int) file_stat.st_size)
- m4_error (context, EXIT_FAILURE, errno, NULL,
- _("diversion too large"));
- xfprintf (file, "D%d,%lu\n", diversion->divnum,
- (unsigned long int) file_stat.st_size);
- }
-
- insert_diversion_helper (context, diversion, true);
- putc ('\n', file);
-
- last_inserted = diversion->divnum;
- }
+ {
+ if (diversion->size)
+ {
+ assert (diversion->used == (int) diversion->used);
+ xfprintf (file, "D%d,%d\n", diversion->divnum,
+ (int) diversion->used);
+ }
+ else
+ {
+ struct stat file_stat;
+ assert (!diversion->u.file);
+ diversion->u.file = m4_tmpopen (context, diversion->divnum,
+ true);
+ if (fstat (fileno (diversion->u.file), &file_stat) < 0)
+ m4_error (context, EXIT_FAILURE, errno, NULL,
+ _("cannot stat diversion"));
+ /* FIXME - support 64-bit off_t with 32-bit long, and
+ fix frozen file format to support 64-bit integers.
+ This implies fixing m4_divert_text to take off_t. */
+ if (file_stat.st_size < 0
+ || file_stat.st_size != (unsigned long int) file_stat.st_size)
+ m4_error (context, EXIT_FAILURE, errno, NULL,
+ _("diversion too large"));
+ xfprintf (file, "D%d,%lu\n", diversion->divnum,
+ (unsigned long int) file_stat.st_size);
+ }
+
+ insert_diversion_helper (context, diversion, true);
+ putc ('\n', file);
+
+ last_inserted = diversion->divnum;
+ }
}
gl_oset_iterator_free (&iter);
diff --git a/m4/path.c b/m4/path.c
index 52391f37..ba3469ae 100644
--- a/m4/path.c
+++ b/m4/path.c
@@ -57,16 +57,16 @@ search_path_add (m4__search_path_info *info, const char *dir, bool prepend)
path->next = info->list;
info->list = path;
if (info->list_end == NULL)
- info->list_end = path;
+ info->list_end = path;
}
else
{
path->next = NULL;
if (info->list_end == NULL)
- info->list = path;
+ info->list = path;
else
- info->list_end->next = path;
+ info->list_end->next = path;
info->list_end = path;
}
}
@@ -83,9 +83,9 @@ search_path_env_init (m4__search_path_info *info, char *path, bool isabs)
{
path_end = strchr (path, ':');
if (path_end)
- *path_end = '\0';
+ *path_end = '\0';
if (!isabs || *path == '/')
- search_path_add (info, path, false);
+ search_path_add (info, path, false);
path = path_end + 1;
}
while (path_end);
@@ -119,7 +119,7 @@ m4_add_include_directory (m4 *context, const char *dir, bool prepend)
#ifdef DEBUG_INCL
xfprintf (stderr, "add_include_directory (%s) %s;\n", dir,
- prepend ? "prepend" : "append");
+ prepend ? "prepend" : "append");
#endif
}
@@ -134,14 +134,14 @@ m4_fopen (m4 *context, const char *file, const char *mode)
struct stat st;
int fd = fileno (fp);
if (fstat (fd, &st) == 0 && S_ISDIR (st.st_mode))
- {
- fclose (fp);
- errno = EISDIR;
- return NULL;
- }
+ {
+ fclose (fp);
+ errno = EISDIR;
+ return NULL;
+ }
if (set_cloexec_flag (fileno (fp), true) != 0)
- m4_error (context, 0, errno, NULL,
- _("cannot protect input file across forks"));
+ m4_error (context, 0, errno, NULL,
+ _("cannot protect input file across forks"));
}
return fp;
}
@@ -177,11 +177,11 @@ m4_path_search (m4 *context, const char *file, char **expanded_name)
{
fp = m4_fopen (context, file, "r");
if (fp != NULL)
- {
- if (expanded_name != NULL)
- *expanded_name = xstrdup (file);
- return fp;
- }
+ {
+ if (expanded_name != NULL)
+ *expanded_name = xstrdup (file);
+ return fp;
+ }
return NULL;
}
@@ -196,20 +196,20 @@ m4_path_search (m4 *context, const char *file, char **expanded_name)
fp = m4_fopen (context, name, "r");
if (fp != NULL)
- {
- m4_debug_message (context, M4_DEBUG_TRACE_PATH,
- _("path search for %s found %s"),
- quotearg_style (locale_quoting_style, file),
- quotearg_n_style (1, locale_quoting_style, name));
- if (expanded_name != NULL)
- *expanded_name = name;
- else
- free (name);
- return fp;
- }
+ {
+ m4_debug_message (context, M4_DEBUG_TRACE_PATH,
+ _("path search for %s found %s"),
+ quotearg_style (locale_quoting_style, file),
+ quotearg_n_style (1, locale_quoting_style, name));
+ if (expanded_name != NULL)
+ *expanded_name = name;
+ else
+ free (name);
+ return fp;
+ }
else if (!incl->len)
- /* Capture errno only when searching `.'. */
- e = errno;
+ /* Capture errno only when searching `.'. */
+ e = errno;
free (name);
}
diff --git a/m4/resyntax.c b/m4/resyntax.c
index d56a1b47..23357038 100644
--- a/m4/resyntax.c
+++ b/m4/resyntax.c
@@ -92,15 +92,15 @@ m4_regexp_syntax_encode (const char *spec)
for (p = canonical; *p != '\0'; ++p)
{
if ((*p == ' ') || (*p == '-'))
- *p = '_';
+ *p = '_';
else if (islower (to_uchar (*p)))
- *p = toupper (to_uchar (*p));
+ *p = toupper (to_uchar (*p));
}
for (resyntax = m4_resyntax_map; resyntax->spec != NULL; ++resyntax)
{
if (!strcmp (resyntax->spec, canonical))
- break;
+ break;
}
free (canonical);
@@ -119,7 +119,7 @@ m4_regexp_syntax_decode (int code)
for (resyntax = m4_resyntax_map; resyntax->spec != NULL; ++resyntax)
{
if (resyntax->code == code)
- break;
+ break;
}
return resyntax->spec;
diff --git a/m4/symtab.c b/m4/symtab.c
index 5714d3b2..2211a7cf 100644
--- a/m4/symtab.c
+++ b/m4/symtab.c
@@ -52,14 +52,14 @@ struct m4_symbol_table {
};
static m4_symbol *symtab_fetch (m4_symbol_table*, const char *,
- size_t);
+ size_t);
static void symbol_popval (m4_symbol *);
static void * symbol_destroy_CB (m4_symbol_table *, const char *,
- size_t, m4_symbol *, void *);
+ size_t, m4_symbol *, void *);
static void * arg_destroy_CB (m4_hash *, const void *, void *,
- void *);
+ void *);
static void * arg_copy_CB (m4_hash *, const void *, void *,
- m4_hash *);
+ m4_hash *);
/* -- SYMBOL TABLE MANAGEMENT --
@@ -72,7 +72,7 @@ m4_symtab_create (size_t size)
m4_symbol_table *symtab = (m4_symbol_table *) xmalloc (sizeof *symtab);
symtab->table = m4_hash_new (size ? size : M4_SYMTAB_DEFAULT_SIZE,
- m4_hash_string_hash, m4_hash_string_cmp);
+ m4_hash_string_hash, m4_hash_string_cmp);
return symtab;
}
@@ -95,7 +95,7 @@ m4_symtab_delete (m4_symbol_table *symtab)
NULL when iteration completes. */
void *
m4_symtab_apply (m4_symbol_table *symtab, bool include_trace,
- m4_symtab_apply_func *func, void *userdata)
+ m4_symtab_apply_func *func, void *userdata)
{
m4_hash_iterator *place = NULL;
void * result = NULL;
@@ -108,16 +108,16 @@ m4_symtab_apply (m4_symbol_table *symtab, bool include_trace,
{
m4_symbol *symbol = m4_get_hash_iterator_value (place);
if (symbol->value || include_trace)
- {
- const m4_string *key
- = (const m4_string *) m4_get_hash_iterator_key (place);
- result = func (symtab, key->str, key->len, symbol, userdata);
- }
+ {
+ const m4_string *key
+ = (const m4_string *) m4_get_hash_iterator_key (place);
+ result = func (symtab, key->str, key->len, symbol, userdata);
+ }
if (result != NULL)
- {
- m4_free_hash_iterator (symtab->table, place);
- break;
- }
+ {
+ m4_free_hash_iterator (symtab->table, place);
+ break;
+ }
}
return result;
@@ -147,7 +147,7 @@ symtab_fetch (m4_symbol_table *symtab, const char *name, size_t len)
else
{
/* Use xmemdup0 rather than memdup so that debugging the symbol
- table is easier. */
+ table is easier. */
m4_string *new_key = (m4_string *) xmalloc (sizeof *new_key);
new_key->str = xmemdup0 (name, len);
new_key->len = len;
@@ -162,7 +162,7 @@ symtab_fetch (m4_symbol_table *symtab, const char *name, size_t len)
the symbol table. */
void
m4__symtab_remove_module_references (m4_symbol_table *symtab,
- m4_module *module)
+ m4_module *module)
{
m4_hash_iterator *place = 0;
@@ -176,31 +176,31 @@ m4__symtab_remove_module_references (m4_symbol_table *symtab,
/* For symbols that have token data... */
if (data)
- {
- /* Purge any shadowed references. */
- while (VALUE_NEXT (data))
- {
- m4_symbol_value *next = VALUE_NEXT (data);
-
- if (VALUE_MODULE (next) == module)
- {
- VALUE_NEXT (data) = VALUE_NEXT (next);
-
- assert (next->type != M4_SYMBOL_PLACEHOLDER);
- m4_symbol_value_delete (next);
- }
- else
- data = next;
- }
-
- /* Purge the live reference if necessary. */
- if (SYMBOL_MODULE (symbol) == module)
- {
- const m4_string *key
- = (const m4_string *) m4_get_hash_iterator_key (place);
- m4_symbol_popdef (symtab, key->str, key->len);
- }
- }
+ {
+ /* Purge any shadowed references. */
+ while (VALUE_NEXT (data))
+ {
+ m4_symbol_value *next = VALUE_NEXT (data);
+
+ if (VALUE_MODULE (next) == module)
+ {
+ VALUE_NEXT (data) = VALUE_NEXT (next);
+
+ assert (next->type != M4_SYMBOL_PLACEHOLDER);
+ m4_symbol_value_delete (next);
+ }
+ else
+ data = next;
+ }
+
+ /* Purge the live reference if necessary. */
+ if (SYMBOL_MODULE (symbol) == module)
+ {
+ const m4_string *key
+ = (const m4_string *) m4_get_hash_iterator_key (place);
+ m4_symbol_popdef (symtab, key->str, key->len);
+ }
+ }
}
}
@@ -211,7 +211,7 @@ m4__symtab_remove_module_references (m4_symbol_table *symtab,
the table entry. */
static void *
symbol_destroy_CB (m4_symbol_table *symtab, const char *name, size_t len,
- m4_symbol *symbol, void *ignored M4_GNUC_UNUSED)
+ m4_symbol *symbol, void *ignored M4_GNUC_UNUSED)
{
m4_string key;
key.str = xmemdup0 (name, len);
@@ -260,7 +260,7 @@ m4_symbol_lookup (m4_symbol_table *symtab, const char *name, size_t len)
association. */
m4_symbol *
m4_symbol_pushdef (m4_symbol_table *symtab, const char *name, size_t len,
- m4_symbol_value *value)
+ m4_symbol_value *value)
{
m4_symbol *symbol;
@@ -282,7 +282,7 @@ m4_symbol_pushdef (m4_symbol_table *symtab, const char *name, size_t len,
symbol's VALUE. */
m4_symbol *
m4_symbol_define (m4_symbol_table *symtab, const char *name, size_t len,
- m4_symbol_value *value)
+ m4_symbol_value *value)
{
m4_symbol *symbol;
@@ -371,25 +371,25 @@ m4_symbol_value_delete (m4_symbol_value *value)
else
{
if (VALUE_ARG_SIGNATURE (value))
- {
- m4_hash_apply (VALUE_ARG_SIGNATURE (value), arg_destroy_CB, NULL);
- m4_hash_delete (VALUE_ARG_SIGNATURE (value));
- }
+ {
+ m4_hash_apply (VALUE_ARG_SIGNATURE (value), arg_destroy_CB, NULL);
+ m4_hash_delete (VALUE_ARG_SIGNATURE (value));
+ }
switch (value->type)
- {
- case M4_SYMBOL_TEXT:
- free ((char *) m4_get_symbol_value_text (value));
- break;
- case M4_SYMBOL_PLACEHOLDER:
- free ((char *) m4_get_symbol_value_placeholder (value));
- break;
- case M4_SYMBOL_VOID:
- case M4_SYMBOL_FUNC:
- break;
- default:
- assert (!"m4_symbol_value_delete");
- abort ();
- }
+ {
+ case M4_SYMBOL_TEXT:
+ free ((char *) m4_get_symbol_value_text (value));
+ break;
+ case M4_SYMBOL_PLACEHOLDER:
+ free ((char *) m4_get_symbol_value_placeholder (value));
+ break;
+ case M4_SYMBOL_VOID:
+ case M4_SYMBOL_FUNC:
+ break;
+ default:
+ assert (!"m4_symbol_value_delete");
+ abort ();
+ }
free (value);
}
}
@@ -398,7 +398,7 @@ m4_symbol_value_delete (m4_symbol_value *value)
NEWNAME and LEN2. */
m4_symbol *
m4_symbol_rename (m4_symbol_table *symtab, const char *name, size_t len1,
- const char *newname, size_t len2)
+ const char *newname, size_t len2)
{
m4_symbol *symbol = NULL;
m4_symbol **psymbol;
@@ -500,11 +500,11 @@ m4_symbol_value_copy (m4 *context, m4_symbol_value *dest, m4_symbol_value *src)
{
case M4_SYMBOL_TEXT:
{
- size_t len = m4_get_symbol_value_len (src);
- unsigned int age = m4_get_symbol_value_quote_age (src);
- m4_set_symbol_value_text (dest,
- xmemdup0 (m4_get_symbol_value_text (src),
- len), len, age);
+ size_t len = m4_get_symbol_value_len (src);
+ unsigned int age = m4_get_symbol_value_quote_age (src);
+ m4_set_symbol_value_text (dest,
+ xmemdup0 (m4_get_symbol_value_text (src),
+ len), len, age);
}
break;
case M4_SYMBOL_FUNC:
@@ -512,46 +512,46 @@ m4_symbol_value_copy (m4 *context, m4_symbol_value *dest, m4_symbol_value *src)
break;
case M4_SYMBOL_PLACEHOLDER:
m4_set_symbol_value_placeholder (dest,
- xstrdup (m4_get_symbol_value_placeholder
- (src)));
+ xstrdup (m4_get_symbol_value_placeholder
+ (src)));
break;
case M4_SYMBOL_COMP:
{
- m4__symbol_chain *chain = src->u.u_c.chain;
- size_t len;
- char *str;
- const m4_string_pair *quotes;
- m4_obstack *obs = m4_arg_scratch (context);
- while (chain)
- {
- switch (chain->type)
- {
- case M4__CHAIN_STR:
- obstack_grow (obs, chain->u.u_s.str, chain->u.u_s.len);
- break;
- case M4__CHAIN_FUNC:
- result = true;
- break;
- case M4__CHAIN_ARGV:
- quotes = m4__quote_cache (M4SYNTAX, NULL, chain->quote_age,
- chain->u.u_a.quotes);
- if (chain->u.u_a.has_func && !chain->u.u_a.flatten)
- result = true;
- m4__arg_print (context, obs, chain->u.u_a.argv,
- chain->u.u_a.index, quotes, true, NULL, NULL,
- NULL, false, false);
- break;
- default:
- assert (!"m4_symbol_value_copy");
- abort ();
- }
- chain = chain->next;
- }
- obstack_1grow (obs, '\0');
- len = obstack_object_size (obs);
- str = xcharalloc (len);
- memcpy (str, obstack_finish (obs), len);
- m4_set_symbol_value_text (dest, str, len - 1, 0);
+ m4__symbol_chain *chain = src->u.u_c.chain;
+ size_t len;
+ char *str;
+ const m4_string_pair *quotes;
+ m4_obstack *obs = m4_arg_scratch (context);
+ while (chain)
+ {
+ switch (chain->type)
+ {
+ case M4__CHAIN_STR:
+ obstack_grow (obs, chain->u.u_s.str, chain->u.u_s.len);
+ break;
+ case M4__CHAIN_FUNC:
+ result = true;
+ break;
+ case M4__CHAIN_ARGV:
+ quotes = m4__quote_cache (M4SYNTAX, NULL, chain->quote_age,
+ chain->u.u_a.quotes);
+ if (chain->u.u_a.has_func && !chain->u.u_a.flatten)
+ result = true;
+ m4__arg_print (context, obs, chain->u.u_a.argv,
+ chain->u.u_a.index, quotes, true, NULL, NULL,
+ NULL, false, false);
+ break;
+ default:
+ assert (!"m4_symbol_value_copy");
+ abort ();
+ }
+ chain = chain->next;
+ }
+ obstack_1grow (obs, '\0');
+ len = obstack_object_size (obs);
+ str = xcharalloc (len);
+ memcpy (str, obstack_finish (obs), len);
+ m4_set_symbol_value_text (dest, str, len - 1, 0);
}
break;
default:
@@ -560,7 +560,7 @@ m4_symbol_value_copy (m4 *context, m4_symbol_value *dest, m4_symbol_value *src)
}
if (VALUE_ARG_SIGNATURE (src))
VALUE_ARG_SIGNATURE (dest) = m4_hash_dup (VALUE_ARG_SIGNATURE (src),
- arg_copy_CB);
+ arg_copy_CB);
return result;
}
@@ -578,7 +578,7 @@ arg_copy_CB (m4_hash *src, const void *name, void *arg, m4_hash *dest)
previously traced. */
bool
m4_set_symbol_name_traced (m4_symbol_table *symtab, const char *name,
- size_t len, bool traced)
+ size_t len, bool traced)
{
m4_symbol *symbol;
bool result;
@@ -594,12 +594,12 @@ m4_set_symbol_name_traced (m4_symbol_table *symtab, const char *name,
m4_symbol **psymbol;
/* Safe to cast away const, since m4_hash_lookup doesn't modify
- key. */
+ key. */
key.str = (char *) name;
key.len = len;
psymbol = (m4_symbol **) m4_hash_lookup (symtab->table, &key);
if (!psymbol)
- return false;
+ return false;
symbol = *psymbol;
}
@@ -614,7 +614,7 @@ m4_set_symbol_name_traced (m4_symbol_table *symtab, const char *name,
free (symbol);
/* Safe to cast away const, since m4_hash_lookup doesn't modify
- key. */
+ key. */
key.str = (char *) name;
key.len = len;
old_key = (m4_string *) m4_hash_remove (symtab->table, &key);
@@ -635,8 +635,8 @@ m4_set_symbol_name_traced (m4_symbol_table *symtab, const char *name,
QUOTES and MODULE do not count against the truncation length. */
bool
m4__symbol_value_print (m4 *context, m4_symbol_value *value, m4_obstack *obs,
- const m4_string_pair *quotes, bool flatten,
- m4__symbol_chain **chainp, size_t *maxlen, bool module)
+ const m4_string_pair *quotes, bool flatten,
+ m4__symbol_chain **chainp, size_t *maxlen, bool module)
{
const char *text;
m4__symbol_chain *chain;
@@ -647,71 +647,71 @@ m4__symbol_value_print (m4 *context, m4_symbol_value *value, m4_obstack *obs,
{
case M4_SYMBOL_TEXT:
if (m4_shipout_string_trunc (obs, m4_get_symbol_value_text (value),
- m4_get_symbol_value_len (value), quotes,
- &len))
- result = true;
+ m4_get_symbol_value_len (value), quotes,
+ &len))
+ result = true;
break;
case M4_SYMBOL_FUNC:
m4__builtin_print (obs, value->u.builtin, flatten, chainp, quotes,
- module);
+ module);
module = false;
break;
case M4_SYMBOL_PLACEHOLDER:
if (flatten)
- {
- if (quotes)
- {
- obstack_grow (obs, quotes->str1, quotes->len1);
- obstack_grow (obs, quotes->str2, quotes->len2);
- }
- module = false;
- }
+ {
+ if (quotes)
+ {
+ obstack_grow (obs, quotes->str1, quotes->len1);
+ obstack_grow (obs, quotes->str2, quotes->len2);
+ }
+ module = false;
+ }
else
- {
- text = m4_get_symbol_value_placeholder (value);
- obstack_1grow (obs, '<');
- obstack_1grow (obs, '<');
- obstack_grow (obs, text, strlen (text));
- obstack_1grow (obs, '>');
- obstack_1grow (obs, '>');
- }
+ {
+ text = m4_get_symbol_value_placeholder (value);
+ obstack_1grow (obs, '<');
+ obstack_1grow (obs, '<');
+ obstack_grow (obs, text, strlen (text));
+ obstack_1grow (obs, '>');
+ obstack_1grow (obs, '>');
+ }
break;
case M4_SYMBOL_COMP:
chain = value->u.u_c.chain;
assert (!module);
if (quotes)
- obstack_grow (obs, quotes->str1, quotes->len1);
+ obstack_grow (obs, quotes->str1, quotes->len1);
while (chain && !result)
- {
- switch (chain->type)
- {
- case M4__CHAIN_STR:
- if (m4_shipout_string_trunc (obs, chain->u.u_s.str,
- chain->u.u_s.len, NULL, &len))
- result = true;
- break;
- case M4__CHAIN_FUNC:
- m4__builtin_print (obs, chain->u.builtin, flatten, chainp,
- quotes, module);
- break;
- case M4__CHAIN_ARGV:
- if (m4__arg_print (context, obs, chain->u.u_a.argv,
- chain->u.u_a.index,
- m4__quote_cache (M4SYNTAX, NULL,
- chain->quote_age,
- chain->u.u_a.quotes),
- chain->u.u_a.flatten, chainp, NULL, &len,
- false, module))
- result = true;
- break;
- default:
- assert (!"m4__symbol_value_print");
- abort ();
- }
- chain = chain->next;
- }
+ {
+ switch (chain->type)
+ {
+ case M4__CHAIN_STR:
+ if (m4_shipout_string_trunc (obs, chain->u.u_s.str,
+ chain->u.u_s.len, NULL, &len))
+ result = true;
+ break;
+ case M4__CHAIN_FUNC:
+ m4__builtin_print (obs, chain->u.builtin, flatten, chainp,
+ quotes, module);
+ break;
+ case M4__CHAIN_ARGV:
+ if (m4__arg_print (context, obs, chain->u.u_a.argv,
+ chain->u.u_a.index,
+ m4__quote_cache (M4SYNTAX, NULL,
+ chain->quote_age,
+ chain->u.u_a.quotes),
+ chain->u.u_a.flatten, chainp, NULL, &len,
+ false, module))
+ result = true;
+ break;
+ default:
+ assert (!"m4__symbol_value_print");
+ abort ();
+ }
+ chain = chain->next;
+ }
if (quotes)
- obstack_grow (obs, quotes->str2, quotes->len2);
+ obstack_grow (obs, quotes->str2, quotes->len2);
break;
default:
assert (!"m4__symbol_value_print");
@@ -738,8 +738,8 @@ m4__symbol_value_print (m4 *context, m4_symbol_value *value, m4_obstack *obs,
MODULE do not count toward truncation. */
void
m4_symbol_print (m4 *context, m4_symbol *symbol, m4_obstack *obs,
- const m4_string_pair *quotes, bool stack, size_t arg_length,
- bool module)
+ const m4_string_pair *quotes, bool stack, size_t arg_length,
+ bool module)
{
m4_symbol_value *value;
size_t len = arg_length;
@@ -749,19 +749,19 @@ m4_symbol_print (m4 *context, m4_symbol *symbol, m4_obstack *obs,
value = m4_get_symbol_value (symbol);
m4__symbol_value_print (context, value, obs, quotes, false, NULL, &len,
- module);
+ module);
if (stack)
{
value = VALUE_NEXT (value);
while (value)
- {
- obstack_1grow (obs, ',');
- obstack_1grow (obs, ' ');
- len = arg_length;
- m4__symbol_value_print (context, value, obs, quotes, false, NULL,
- &len, module);
- value = VALUE_NEXT (value);
- }
+ {
+ obstack_1grow (obs, ',');
+ obstack_1grow (obs, ' ');
+ len = arg_length;
+ m4__symbol_value_print (context, value, obs, quotes, false, NULL,
+ &len, module);
+ value = VALUE_NEXT (value);
+ }
}
}
@@ -885,7 +885,7 @@ m4_get_symbol_value_placeholder (m4_symbol_value *value)
#undef m4_set_symbol_value_text
void
m4_set_symbol_value_text (m4_symbol_value *value, const char *text, size_t len,
- unsigned int quote_age)
+ unsigned int quote_age)
{
assert (value && text);
/* In practice, it is easier to debug when we guarantee a
@@ -901,7 +901,7 @@ m4_set_symbol_value_text (m4_symbol_value *value, const char *text, size_t len,
#undef m4__set_symbol_value_builtin
void
m4__set_symbol_value_builtin (m4_symbol_value *value,
- const m4__builtin *builtin)
+ const m4__builtin *builtin)
{
assert (value && builtin);
@@ -929,7 +929,7 @@ m4_set_symbol_value_placeholder (m4_symbol_value *value, const char *text)
#ifdef DEBUG_SYM
static void *dump_symbol_CB (m4_symbol_table *symtab, const char *name,
- m4_symbol *symbol, void *userdata);
+ m4_symbol *symbol, void *userdata);
static M4_GNUC_UNUSED void *
symtab_dump (m4 *context, m4_symbol_table *symtab)
{
@@ -938,7 +938,7 @@ symtab_dump (m4 *context, m4_symbol_table *symtab)
static void *
dump_symbol_CB (m4_symbol_table *symtab, const char *name,
- m4_symbol *symbol, void *ptr)
+ m4_symbol *symbol, void *ptr)
{
m4 * context = (m4 *) ptr;
m4_symbol_value *value = m4_get_symbol_value (symbol);
@@ -947,7 +947,7 @@ dump_symbol_CB (m4_symbol_table *symtab, const char *name,
const char * module_name = module ? m4_get_module_name (module) : "NONE";
xfprintf (stderr, "%10s: (%d%s) %s=", module_name, flags,
- m4_get_symbol_traced (symbol) ? "!" : "", name);
+ m4_get_symbol_traced (symbol) ? "!" : "", name);
if (!value)
fputs ("<!UNDEFINED!>", stderr);
@@ -958,7 +958,7 @@ dump_symbol_CB (m4_symbol_table *symtab, const char *name,
m4_obstack obs;
obstack_init (&obs);
m4__symbol_value_print (context, value, &obs, NULL, false, NULL, NULL,
- true);
+ true);
xfprintf (stderr, "%s", (char *) obstack_finish (&obs));
obstack_free (&obs, NULL);
}
diff --git a/m4/syntax.c b/m4/syntax.c
index 0ff47398..fa4cc003 100644
--- a/m4/syntax.c
+++ b/m4/syntax.c
@@ -126,29 +126,29 @@ m4_syntax_create (void)
switch (ch)
{
case '(':
- syntax->orig[ch] = M4_SYNTAX_OPEN;
- break;
+ syntax->orig[ch] = M4_SYNTAX_OPEN;
+ break;
case ')':
- syntax->orig[ch] = M4_SYNTAX_CLOSE;
- break;
+ syntax->orig[ch] = M4_SYNTAX_CLOSE;
+ break;
case ',':
- syntax->orig[ch] = M4_SYNTAX_COMMA;
- break;
+ syntax->orig[ch] = M4_SYNTAX_COMMA;
+ break;
case '`':
- syntax->orig[ch] = M4_SYNTAX_LQUOTE;
- break;
+ syntax->orig[ch] = M4_SYNTAX_LQUOTE;
+ break;
case '#':
- syntax->orig[ch] = M4_SYNTAX_BCOMM;
- break;
+ syntax->orig[ch] = M4_SYNTAX_BCOMM;
+ break;
default:
- if (isspace (ch))
- syntax->orig[ch] = M4_SYNTAX_SPACE;
- else if (isalpha (ch) || ch == '_')
- syntax->orig[ch] = M4_SYNTAX_ALPHA;
- else if (isdigit (ch))
- syntax->orig[ch] = M4_SYNTAX_NUM;
- else
- syntax->orig[ch] = M4_SYNTAX_OTHER;
+ if (isspace (ch))
+ syntax->orig[ch] = M4_SYNTAX_SPACE;
+ else if (isalpha (ch) || ch == '_')
+ syntax->orig[ch] = M4_SYNTAX_ALPHA;
+ else if (isdigit (ch))
+ syntax->orig[ch] = M4_SYNTAX_NUM;
+ else
+ syntax->orig[ch] = M4_SYNTAX_OTHER;
}
/* Set up current table to match default. */
@@ -222,14 +222,14 @@ add_syntax_attribute (m4_syntax_table *syntax, char ch, int code)
else
{
if ((code & (M4_SYNTAX_SUSPECT)) != 0
- || m4_has_syntax (syntax, c, M4_SYNTAX_SUSPECT))
- syntax->suspect = true;
+ || m4_has_syntax (syntax, c, M4_SYNTAX_SUSPECT))
+ syntax->suspect = true;
syntax->table[c] = ((syntax->table[c] & M4_SYNTAX_MASKS) | code);
}
#ifdef DEBUG_SYNTAX
xfprintf(stderr, "Set syntax %o %c = %04X\n", c, isprint(c) ? c : '-',
- syntax->table[c]);
+ syntax->table[c]);
#endif
return syntax->table[c];
@@ -245,7 +245,7 @@ remove_syntax_attribute (m4_syntax_table *syntax, char ch, int code)
#ifdef DEBUG_SYNTAX
xfprintf(stderr, "Unset syntax %o %c = %04X\n", c, isprint(c) ? c : '-',
- syntax->table[c]);
+ syntax->table[c]);
#endif
return syntax->table[c];
@@ -255,7 +255,7 @@ remove_syntax_attribute (m4_syntax_table *syntax, char ch, int code)
them from whatever category they used to be in. */
static void
add_syntax_set (m4_syntax_table *syntax, const char *chars, size_t len,
- int code)
+ int code)
{
while (len--)
add_syntax_attribute (syntax, *chars++, code);
@@ -265,15 +265,15 @@ add_syntax_set (m4_syntax_table *syntax, const char *chars, size_t len,
adding them to category M4_SYNTAX_OTHER instead. */
static void
subtract_syntax_set (m4_syntax_table *syntax, const char *chars, size_t len,
- int code)
+ int code)
{
while (len--)
{
char ch = *chars++;
if ((code & M4_SYNTAX_MASKS) != 0)
- remove_syntax_attribute (syntax, ch, code);
+ remove_syntax_attribute (syntax, ch, code);
else if (m4_has_syntax (syntax, ch, code))
- add_syntax_attribute (syntax, ch, M4_SYNTAX_OTHER);
+ add_syntax_attribute (syntax, ch, M4_SYNTAX_OTHER);
}
}
@@ -283,7 +283,7 @@ subtract_syntax_set (m4_syntax_table *syntax, const char *chars, size_t len,
instead. */
static void
set_syntax_set (m4_syntax_table *syntax, const char *chars, size_t len,
- int code)
+ int code)
{
int ch;
/* Explicit set of characters to install with this category; all
@@ -292,9 +292,9 @@ set_syntax_set (m4_syntax_table *syntax, const char *chars, size_t len,
for (ch = UCHAR_MAX + 1; --ch >= 0; )
{
if ((code & M4_SYNTAX_MASKS) != 0)
- remove_syntax_attribute (syntax, ch, code);
+ remove_syntax_attribute (syntax, ch, code);
else if (m4_has_syntax (syntax, ch, code))
- add_syntax_attribute (syntax, ch, M4_SYNTAX_OTHER);
+ add_syntax_attribute (syntax, ch, M4_SYNTAX_OTHER);
}
while (len--)
{
@@ -312,45 +312,45 @@ reset_syntax_set (m4_syntax_table *syntax, int code)
for (ch = UCHAR_MAX + 1; --ch >= 0; )
{
/* Reset the category back to its default state. All other
- characters that used to have this category get reset to
- their default state as well. */
+ characters that used to have this category get reset to
+ their default state as well. */
if (code == M4_SYNTAX_RQUOTE)
- {
- if (ch == '\'')
- add_syntax_attribute (syntax, ch, code);
- else
- remove_syntax_attribute (syntax, ch, code);
- }
+ {
+ if (ch == '\'')
+ add_syntax_attribute (syntax, ch, code);
+ else
+ remove_syntax_attribute (syntax, ch, code);
+ }
else if (code == M4_SYNTAX_ECOMM)
- {
- if (ch == '\n')
- add_syntax_attribute (syntax, ch, code);
- else
- remove_syntax_attribute (syntax, ch, code);
- }
+ {
+ if (ch == '\n')
+ add_syntax_attribute (syntax, ch, code);
+ else
+ remove_syntax_attribute (syntax, ch, code);
+ }
else if (code == M4_SYNTAX_DOLLAR)
- {
- if (ch == '$')
- add_syntax_attribute (syntax, ch, code);
- else
- remove_syntax_attribute (syntax, ch, code);
- }
+ {
+ if (ch == '$')
+ add_syntax_attribute (syntax, ch, code);
+ else
+ remove_syntax_attribute (syntax, ch, code);
+ }
else if (code == M4_SYNTAX_LBRACE)
- {
- if (ch == '{')
- add_syntax_attribute (syntax, ch, code);
- else
- remove_syntax_attribute (syntax, ch, code);
- }
+ {
+ if (ch == '{')
+ add_syntax_attribute (syntax, ch, code);
+ else
+ remove_syntax_attribute (syntax, ch, code);
+ }
else if (code == M4_SYNTAX_RBRACE)
- {
- if (ch == '}')
- add_syntax_attribute (syntax, ch, code);
- else
- remove_syntax_attribute (syntax, ch, code);
- }
+ {
+ if (ch == '}')
+ add_syntax_attribute (syntax, ch, code);
+ else
+ remove_syntax_attribute (syntax, ch, code);
+ }
else if (syntax->orig[ch] == code || m4_has_syntax (syntax, ch, code))
- add_syntax_attribute (syntax, ch, syntax->orig[ch]);
+ add_syntax_attribute (syntax, ch, syntax->orig[ch]);
}
}
@@ -398,7 +398,7 @@ m4_reset_syntax (m4_syntax_table *syntax)
syntax category matching KEY. */
int
m4_set_syntax (m4_syntax_table *syntax, char key, char action,
- const char *chars, size_t len)
+ const char *chars, size_t len)
{
int code;
@@ -440,162 +440,162 @@ m4_set_syntax (m4_syntax_table *syntax, char key, char action,
bool single_comm_possible = true;
int dollar = -1;
if (m4_has_syntax (syntax, syntax->quote.str1[0], M4_SYNTAX_LQUOTE))
- {
- assert (syntax->quote.len1 == 1);
- lquote = to_uchar (syntax->quote.str1[0]);
- }
+ {
+ assert (syntax->quote.len1 == 1);
+ lquote = to_uchar (syntax->quote.str1[0]);
+ }
if (m4_has_syntax (syntax, syntax->quote.str2[0], M4_SYNTAX_RQUOTE))
- {
- assert (syntax->quote.len2 == 1);
- rquote = to_uchar (syntax->quote.str2[0]);
- }
+ {
+ assert (syntax->quote.len2 == 1);
+ rquote = to_uchar (syntax->quote.str2[0]);
+ }
if (m4_has_syntax (syntax, syntax->comm.str1[0], M4_SYNTAX_BCOMM))
- {
- assert (syntax->comm.len1 == 1);
- bcomm = to_uchar (syntax->comm.str1[0]);
- }
+ {
+ assert (syntax->comm.len1 == 1);
+ bcomm = to_uchar (syntax->comm.str1[0]);
+ }
if (m4_has_syntax (syntax, syntax->comm.str2[0], M4_SYNTAX_ECOMM))
- {
- assert (syntax->comm.len2 == 1);
- ecomm = to_uchar (syntax->comm.str2[0]);
- }
+ {
+ assert (syntax->comm.len2 == 1);
+ ecomm = to_uchar (syntax->comm.str2[0]);
+ }
syntax->is_single_dollar = false;
syntax->is_macro_escaped = false;
/* Find candidates for each category. */
for (ch = UCHAR_MAX + 1; --ch >= 0; )
- {
- if (m4_has_syntax (syntax, ch, M4_SYNTAX_LQUOTE))
- {
- if (lquote == -1)
- lquote = ch;
- else if (lquote != ch)
- single_quote_possible = false;
- }
- if (m4_has_syntax (syntax, ch, M4_SYNTAX_RQUOTE))
- {
- if (rquote == -1)
- rquote = ch;
- else if (rquote != ch)
- single_quote_possible = false;
- }
- if (m4_has_syntax (syntax, ch, M4_SYNTAX_BCOMM))
- {
- if (bcomm == -1)
- bcomm = ch;
- else if (bcomm != ch)
- single_comm_possible = false;
- }
- if (m4_has_syntax (syntax, ch, M4_SYNTAX_ECOMM))
- {
- if (ecomm == -1)
- ecomm = ch;
- else if (ecomm != ch)
- single_comm_possible = false;
- }
- if (m4_has_syntax (syntax, ch, M4_SYNTAX_DOLLAR))
- {
- if (dollar == -1)
- {
- syntax->dollar = dollar = ch;
- syntax->is_single_dollar = true;
- }
- else
- syntax->is_single_dollar = false;
- }
- if (m4_has_syntax (syntax, ch, M4_SYNTAX_ESCAPE))
- syntax->is_macro_escaped = true;
- }
+ {
+ if (m4_has_syntax (syntax, ch, M4_SYNTAX_LQUOTE))
+ {
+ if (lquote == -1)
+ lquote = ch;
+ else if (lquote != ch)
+ single_quote_possible = false;
+ }
+ if (m4_has_syntax (syntax, ch, M4_SYNTAX_RQUOTE))
+ {
+ if (rquote == -1)
+ rquote = ch;
+ else if (rquote != ch)
+ single_quote_possible = false;
+ }
+ if (m4_has_syntax (syntax, ch, M4_SYNTAX_BCOMM))
+ {
+ if (bcomm == -1)
+ bcomm = ch;
+ else if (bcomm != ch)
+ single_comm_possible = false;
+ }
+ if (m4_has_syntax (syntax, ch, M4_SYNTAX_ECOMM))
+ {
+ if (ecomm == -1)
+ ecomm = ch;
+ else if (ecomm != ch)
+ single_comm_possible = false;
+ }
+ if (m4_has_syntax (syntax, ch, M4_SYNTAX_DOLLAR))
+ {
+ if (dollar == -1)
+ {
+ syntax->dollar = dollar = ch;
+ syntax->is_single_dollar = true;
+ }
+ else
+ syntax->is_single_dollar = false;
+ }
+ if (m4_has_syntax (syntax, ch, M4_SYNTAX_ESCAPE))
+ syntax->is_macro_escaped = true;
+ }
/* Disable multi-character delimiters if we discovered
- delimiters. */
+ delimiters. */
if (!single_quote_possible)
- syntax->is_single_quotes = false;
+ syntax->is_single_quotes = false;
if (!single_comm_possible)
- syntax->is_single_comments = false;
+ syntax->is_single_comments = false;
if ((1 < syntax->quote.len1 || 1 < syntax->quote.len2)
- && (!syntax->is_single_quotes || lquote != -1 || rquote != -1))
- {
- if (syntax->quote.len1)
- {
- syntax->quote.len1 = lquote == to_uchar (syntax->quote.str1[0]);
- syntax->quote.str1[syntax->quote.len1] = '\0';
- }
- if (syntax->quote.len2)
- {
- syntax->quote.len2 = rquote == to_uchar (syntax->quote.str2[0]);
- syntax->quote.str2[syntax->quote.len2] = '\0';
- }
- }
+ && (!syntax->is_single_quotes || lquote != -1 || rquote != -1))
+ {
+ if (syntax->quote.len1)
+ {
+ syntax->quote.len1 = lquote == to_uchar (syntax->quote.str1[0]);
+ syntax->quote.str1[syntax->quote.len1] = '\0';
+ }
+ if (syntax->quote.len2)
+ {
+ syntax->quote.len2 = rquote == to_uchar (syntax->quote.str2[0]);
+ syntax->quote.str2[syntax->quote.len2] = '\0';
+ }
+ }
if ((1 < syntax->comm.len1 || 1 < syntax->comm.len2)
- && (!syntax->is_single_comments || bcomm != -1 || ecomm != -1))
- {
- if (syntax->comm.len1)
- {
- syntax->comm.len1 = bcomm == to_uchar (syntax->comm.str1[0]);
- syntax->comm.str1[syntax->comm.len1] = '\0';
- }
- if (syntax->comm.len2)
- {
- syntax->comm.len2 = ecomm == to_uchar (syntax->comm.str2[0]);
- syntax->comm.str2[syntax->comm.len2] = '\0';
- }
- }
+ && (!syntax->is_single_comments || bcomm != -1 || ecomm != -1))
+ {
+ if (syntax->comm.len1)
+ {
+ syntax->comm.len1 = bcomm == to_uchar (syntax->comm.str1[0]);
+ syntax->comm.str1[syntax->comm.len1] = '\0';
+ }
+ if (syntax->comm.len2)
+ {
+ syntax->comm.len2 = ecomm == to_uchar (syntax->comm.str2[0]);
+ syntax->comm.str2[syntax->comm.len2] = '\0';
+ }
+ }
/* Update the strings. */
if (lquote != -1)
- {
- if (single_quote_possible)
- syntax->is_single_quotes = true;
- if (syntax->quote.len1)
- assert (syntax->quote.len1 == 1);
- else
- {
- free (syntax->quote.str1);
- syntax->quote.str1 = xcharalloc (2);
- syntax->quote.str1[1] = '\0';
- syntax->quote.len1 = 1;
- }
- syntax->quote.str1[0] = lquote;
- if (rquote == -1)
- {
- rquote = '\'';
- add_syntax_attribute (syntax, rquote, M4_SYNTAX_RQUOTE);
- }
- if (!syntax->quote.len2)
- {
- free (syntax->quote.str2);
- syntax->quote.str2 = xcharalloc (2);
- }
- syntax->quote.str2[0] = rquote;
- syntax->quote.str2[1] = '\0';
- syntax->quote.len2 = 1;
- }
+ {
+ if (single_quote_possible)
+ syntax->is_single_quotes = true;
+ if (syntax->quote.len1)
+ assert (syntax->quote.len1 == 1);
+ else
+ {
+ free (syntax->quote.str1);
+ syntax->quote.str1 = xcharalloc (2);
+ syntax->quote.str1[1] = '\0';
+ syntax->quote.len1 = 1;
+ }
+ syntax->quote.str1[0] = lquote;
+ if (rquote == -1)
+ {
+ rquote = '\'';
+ add_syntax_attribute (syntax, rquote, M4_SYNTAX_RQUOTE);
+ }
+ if (!syntax->quote.len2)
+ {
+ free (syntax->quote.str2);
+ syntax->quote.str2 = xcharalloc (2);
+ }
+ syntax->quote.str2[0] = rquote;
+ syntax->quote.str2[1] = '\0';
+ syntax->quote.len2 = 1;
+ }
if (bcomm != -1)
- {
- if (single_comm_possible)
- syntax->is_single_comments = true;
- if (syntax->comm.len1)
- assert (syntax->comm.len1 == 1);
- else
- {
- free (syntax->comm.str1);
- syntax->comm.str1 = xcharalloc (2);
- syntax->comm.str1[1] = '\0';
- syntax->comm.len1 = 1;
- }
- syntax->comm.str1[0] = bcomm;
- if (ecomm == -1)
- {
- ecomm = '\n';
- add_syntax_attribute (syntax, ecomm, M4_SYNTAX_ECOMM);
- }
- if (!syntax->comm.len2)
- {
- free (syntax->comm.str2);
- syntax->comm.str2 = xcharalloc (2);
- }
- syntax->comm.str2[0] = ecomm;
- syntax->comm.str2[1] = '\0';
- syntax->comm.len2 = 1;
- }
+ {
+ if (single_comm_possible)
+ syntax->is_single_comments = true;
+ if (syntax->comm.len1)
+ assert (syntax->comm.len1 == 1);
+ else
+ {
+ free (syntax->comm.str1);
+ syntax->comm.str1 = xcharalloc (2);
+ syntax->comm.str1[1] = '\0';
+ syntax->comm.len1 = 1;
+ }
+ syntax->comm.str1[0] = bcomm;
+ if (ecomm == -1)
+ {
+ ecomm = '\n';
+ add_syntax_attribute (syntax, ecomm, M4_SYNTAX_ECOMM);
+ }
+ if (!syntax->comm.len2)
+ {
+ free (syntax->comm.str2);
+ syntax->comm.str2 = xcharalloc (2);
+ }
+ syntax->comm.str2[0] = ecomm;
+ syntax->comm.str2[1] = '\0';
+ syntax->comm.len2 = 1;
+ }
}
set_quote_age (syntax, false, true);
m4__quote_uncache (syntax);
@@ -612,7 +612,7 @@ m4_set_syntax (m4_syntax_table *syntax, char key, char action,
distinguish from an explicit empty string. */
void
m4_set_quotes (m4_syntax_table *syntax, const char *lq, size_t lq_len,
- const char *rq, size_t rq_len)
+ const char *rq, size_t rq_len)
{
int ch;
@@ -658,21 +658,21 @@ m4_set_quotes (m4_syntax_table *syntax, const char *lq, size_t lq_len,
for (ch = UCHAR_MAX + 1; --ch >= 0; )
{
if (m4_has_syntax (syntax, ch, M4_SYNTAX_LQUOTE))
- add_syntax_attribute (syntax, ch,
- (syntax->orig[ch] == M4_SYNTAX_LQUOTE
- ? M4_SYNTAX_OTHER : syntax->orig[ch]));
+ add_syntax_attribute (syntax, ch,
+ (syntax->orig[ch] == M4_SYNTAX_LQUOTE
+ ? M4_SYNTAX_OTHER : syntax->orig[ch]));
if (m4_has_syntax (syntax, ch, M4_SYNTAX_RQUOTE))
- remove_syntax_attribute (syntax, ch, M4_SYNTAX_RQUOTE);
+ remove_syntax_attribute (syntax, ch, M4_SYNTAX_RQUOTE);
}
if (!m4_has_syntax (syntax, *syntax->quote.str1,
- (M4_SYNTAX_IGNORE | M4_SYNTAX_ESCAPE | M4_SYNTAX_ALPHA
- | M4_SYNTAX_NUM)))
+ (M4_SYNTAX_IGNORE | M4_SYNTAX_ESCAPE | M4_SYNTAX_ALPHA
+ | M4_SYNTAX_NUM)))
{
if (syntax->quote.len1 == 1)
- add_syntax_attribute (syntax, syntax->quote.str1[0], M4_SYNTAX_LQUOTE);
+ add_syntax_attribute (syntax, syntax->quote.str1[0], M4_SYNTAX_LQUOTE);
if (syntax->quote.len2 == 1)
- add_syntax_attribute (syntax, syntax->quote.str2[0], M4_SYNTAX_RQUOTE);
+ add_syntax_attribute (syntax, syntax->quote.str2[0], M4_SYNTAX_RQUOTE);
}
set_quote_age (syntax, false, false);
}
@@ -682,7 +682,7 @@ m4_set_quotes (m4_syntax_table *syntax, const char *lq, size_t lq_len,
distinguish from an explicit empty string. */
void
m4_set_comment (m4_syntax_table *syntax, const char *bc, size_t bc_len,
- const char *ec, size_t ec_len)
+ const char *ec, size_t ec_len)
{
int ch;
@@ -726,20 +726,20 @@ m4_set_comment (m4_syntax_table *syntax, const char *bc, size_t bc_len,
for (ch = UCHAR_MAX + 1; --ch >= 0; )
{
if (m4_has_syntax (syntax, ch, M4_SYNTAX_BCOMM))
- add_syntax_attribute (syntax, ch,
- (syntax->orig[ch] == M4_SYNTAX_BCOMM
- ? M4_SYNTAX_OTHER : syntax->orig[ch]));
+ add_syntax_attribute (syntax, ch,
+ (syntax->orig[ch] == M4_SYNTAX_BCOMM
+ ? M4_SYNTAX_OTHER : syntax->orig[ch]));
if (m4_has_syntax (syntax, ch, M4_SYNTAX_ECOMM))
- remove_syntax_attribute (syntax, ch, M4_SYNTAX_ECOMM);
+ remove_syntax_attribute (syntax, ch, M4_SYNTAX_ECOMM);
}
if (!m4_has_syntax (syntax, *syntax->comm.str1,
- (M4_SYNTAX_IGNORE | M4_SYNTAX_ESCAPE | M4_SYNTAX_ALPHA
- | M4_SYNTAX_NUM | M4_SYNTAX_LQUOTE)))
+ (M4_SYNTAX_IGNORE | M4_SYNTAX_ESCAPE | M4_SYNTAX_ALPHA
+ | M4_SYNTAX_NUM | M4_SYNTAX_LQUOTE)))
{
if (syntax->comm.len1 == 1)
- add_syntax_attribute (syntax, syntax->comm.str1[0], M4_SYNTAX_BCOMM);
+ add_syntax_attribute (syntax, syntax->comm.str1[0], M4_SYNTAX_BCOMM);
if (syntax->comm.len2 == 1)
- add_syntax_attribute (syntax, syntax->comm.str2[0], M4_SYNTAX_ECOMM);
+ add_syntax_attribute (syntax, syntax->comm.str2[0], M4_SYNTAX_ECOMM);
}
set_quote_age (syntax, false, false);
}
@@ -803,24 +803,24 @@ set_quote_age (m4_syntax_table *syntax, bool reset, bool change)
if (local_syntax_age < 0xffff && syntax->is_single_quotes
&& syntax->quote.len1 == 1 && syntax->quote.len2 == 1
&& !m4_has_syntax (syntax, *syntax->quote.str1,
- (M4_SYNTAX_ALPHA | M4_SYNTAX_NUM | M4_SYNTAX_OPEN
- | M4_SYNTAX_COMMA | M4_SYNTAX_CLOSE
- | M4_SYNTAX_SPACE))
+ (M4_SYNTAX_ALPHA | M4_SYNTAX_NUM | M4_SYNTAX_OPEN
+ | M4_SYNTAX_COMMA | M4_SYNTAX_CLOSE
+ | M4_SYNTAX_SPACE))
&& !m4_has_syntax (syntax, *syntax->quote.str2,
- (M4_SYNTAX_ALPHA | M4_SYNTAX_NUM | M4_SYNTAX_OPEN
- | M4_SYNTAX_COMMA | M4_SYNTAX_CLOSE
- | M4_SYNTAX_SPACE))
+ (M4_SYNTAX_ALPHA | M4_SYNTAX_NUM | M4_SYNTAX_OPEN
+ | M4_SYNTAX_COMMA | M4_SYNTAX_CLOSE
+ | M4_SYNTAX_SPACE))
&& *syntax->quote.str1 != *syntax->quote.str2
&& (!syntax->comm.len1
- || (*syntax->comm.str1 != *syntax->quote.str2
- && !m4_has_syntax (syntax, *syntax->comm.str1,
- (M4_SYNTAX_OPEN | M4_SYNTAX_COMMA
- | M4_SYNTAX_CLOSE))))
+ || (*syntax->comm.str1 != *syntax->quote.str2
+ && !m4_has_syntax (syntax, *syntax->comm.str1,
+ (M4_SYNTAX_OPEN | M4_SYNTAX_COMMA
+ | M4_SYNTAX_CLOSE))))
&& m4_has_syntax (syntax, ',', M4_SYNTAX_COMMA))
{
syntax->quote_age = ((local_syntax_age << 16)
- | ((*syntax->quote.str1 & 0xff) << 8)
- | (*syntax->quote.str2 & 0xff));
+ | ((*syntax->quote.str1 & 0xff) << 8)
+ | (*syntax->quote.str2 & 0xff));
}
else
syntax->quote_age = 0;
@@ -839,7 +839,7 @@ set_quote_age (m4_syntax_table *syntax, bool reset, bool change)
used to refresh the contents of the result. */
const m4_string_pair *
m4__quote_cache (m4_syntax_table *syntax, m4_obstack *obs, unsigned int age,
- const m4_string_pair *quotes)
+ const m4_string_pair *quotes)
{
/* Implementation - if AGE is non-zero, then the implementation of
set_quote_age guarantees that we can recreate the return value on
@@ -861,11 +861,11 @@ m4__quote_cache (m4_syntax_table *syntax, m4_obstack *obs, unsigned int age,
{
assert (obstack_object_size (obs) == 0);
syntax->cached_quote = (m4_string_pair *) obstack_copy (obs, quotes,
- sizeof *quotes);
+ sizeof *quotes);
syntax->cached_quote->str1 = (char *) obstack_copy0 (obs, quotes->str1,
- quotes->len1);
+ quotes->len1);
syntax->cached_quote->str2 = (char *) obstack_copy0 (obs, quotes->str2,
- quotes->len2);
+ quotes->len2);
}
return syntax->cached_quote;
}
diff --git a/m4/utility.c b/m4/utility.c
index 993d83d1..337b8bb2 100644
--- a/m4/utility.c
+++ b/m4/utility.c
@@ -42,19 +42,19 @@ static const char *skip_space (m4 *, const char *);
string, false otherwise. */
bool
m4_bad_argc (m4 *context, size_t argc, const m4_call_info *caller, size_t min,
- size_t max, bool side_effect)
+ size_t max, bool side_effect)
{
if (argc - 1 < min)
{
m4_warn (context, 0, caller, _("too few arguments: %zu < %zu"),
- argc - 1, min);
+ argc - 1, min);
return !side_effect;
}
if (argc - 1 > max)
{
m4_warn (context, 0, caller, _("extra arguments ignored: %zu > %zu"),
- argc - 1, max);
+ argc - 1, max);
}
return false;
@@ -75,7 +75,7 @@ skip_space (m4 *context, const char *arg)
Otherwise, we are arbitrarily limiting integer values. */
bool
m4_numeric_arg (m4 *context, const m4_call_info *caller, const char *arg,
- size_t len, int *valuep)
+ size_t len, int *valuep)
{
char *endp;
@@ -89,15 +89,15 @@ m4_numeric_arg (m4 *context, const m4_call_info *caller, const char *arg,
const char *str = skip_space (context, arg);
*valuep = strtol (str, &endp, 10);
if (endp - arg != len)
- {
- m4_warn (context, 0, caller, _("non-numeric argument %s"),
- quotearg_style_mem (locale_quoting_style, arg, len));
- return false;
- }
+ {
+ m4_warn (context, 0, caller, _("non-numeric argument %s"),
+ quotearg_style_mem (locale_quoting_style, arg, len));
+ return false;
+ }
if (str != arg)
- m4_warn (context, 0, caller, _("leading whitespace ignored"));
+ m4_warn (context, 0, caller, _("leading whitespace ignored"));
else if (errno == ERANGE)
- m4_warn (context, 0, caller, _("numeric overflow detected"));
+ m4_warn (context, 0, caller, _("numeric overflow detected"));
}
return true;
}
@@ -109,23 +109,23 @@ m4_numeric_arg (m4 *context, const m4_call_info *caller, const char *arg,
return PREVIOUS; otherwise return the parsed value. */
bool
m4_parse_truth_arg (m4 *context, const m4_call_info *caller, const char *arg,
- size_t len, bool previous)
+ size_t len, bool previous)
{
/* 0, no, off, blank... */
if (!arg || len == 0
|| arg[0] == '0'
|| arg[0] == 'n' || arg[0] == 'N'
|| ((arg[0] == 'o' || arg[0] == 'O')
- && (arg[1] == 'f' || arg[1] == 'F')))
+ && (arg[1] == 'f' || arg[1] == 'F')))
return false;
/* 1, yes, on... */
if (arg[0] == '1'
|| arg[0] == 'y' || arg[0] == 'Y'
|| ((arg[0] == 'o' || arg[0] == 'O')
- && (arg[1] == 'n' || arg[1] == 'N')))
+ && (arg[1] == 'n' || arg[1] == 'N')))
return true;
m4_warn (context, 0, caller, _("unknown directive %s"),
- quotearg_style_mem (locale_quoting_style, arg, len));
+ quotearg_style_mem (locale_quoting_style, arg, len));
return previous;
}
@@ -135,7 +135,7 @@ m4_parse_truth_arg (m4 *context, const m4_call_info *caller, const char *arg,
result of the lookup, or NULL. */
m4_symbol *
m4_symbol_value_lookup (m4 *context, m4_macro_args *argv, size_t i,
- bool must_exist)
+ bool must_exist)
{
m4_symbol *result = NULL;
if (m4_is_arg_text (argv, i))
@@ -144,9 +144,9 @@ m4_symbol_value_lookup (m4 *context, m4_macro_args *argv, size_t i,
size_t len = M4ARGLEN (i);
result = m4_symbol_lookup (M4SYMTAB, name, len);
if (must_exist && !result
- && m4_is_debug_bit (context, M4_DEBUG_TRACE_DEREF))
- m4_warn (context, 0, argv->info, _("undefined macro %s"),
- quotearg_style_mem (locale_quoting_style, name, len));
+ && m4_is_debug_bit (context, M4_DEBUG_TRACE_DEREF))
+ m4_warn (context, 0, argv->info, _("undefined macro %s"),
+ quotearg_style_mem (locale_quoting_style, name, len));
}
else
m4_warn (context, 0, argv->info, _("invalid macro name ignored"));
@@ -160,7 +160,7 @@ m4_symbol_value_lookup (m4 *context, m4_macro_args *argv, size_t i,
const char *m4_info_name (const m4_call_info *caller)
{
return quotearg_style_mem (locale_quoting_style, caller->name,
- caller->name_len);
+ caller->name_len);
}
/* Helper for all error reporting. Report message based on FORMAT and
@@ -170,8 +170,8 @@ const char *m4_info_name (const m4_call_info *caller)
WARN, prepend 'Warning: '. */
static void
m4_verror_at_line (m4 *context, bool warn, int status, int errnum,
- const m4_call_info *caller, const char *format,
- va_list args)
+ const m4_call_info *caller, const char *format,
+ va_list args)
{
char *full = NULL;
char *safe_macro = NULL;
@@ -189,14 +189,14 @@ m4_verror_at_line (m4 *context, bool warn, int status, int errnum,
char *p = safe_macro = xcharalloc (2 * len);
const char *end = macro + len;
while (macro != end)
- {
- if (*macro == '%')
- {
- *p++ = '%';
- len++;
- }
- *p++ = *macro++;
- }
+ {
+ if (*macro == '%')
+ {
+ *p++ = '%';
+ len++;
+ }
+ *p++ = *macro++;
+ }
}
if (macro)
/* Use slot 1, so that the rest of the code can use the simpler
@@ -212,7 +212,7 @@ m4_verror_at_line (m4 *context, bool warn, int status, int errnum,
else if (macro)
full = xasprintf (_("%s: %s"), macro, format);
verror_at_line (status, errnum, line ? file : NULL, line,
- full ? full : format, args);
+ full ? full : format, args);
free (full);
free (safe_macro);
if ((!warn || m4_get_fatal_warnings_opt (context))
@@ -230,7 +230,7 @@ m4_verror_at_line (m4 *context, bool warn, int status, int errnum,
cannot exit with success later on.*/
void
m4_error (m4 *context, int status, int errnum, const m4_call_info *caller,
- const char *format, ...)
+ const char *format, ...)
{
va_list args;
va_start (args, format);
@@ -250,7 +250,7 @@ m4_error (m4 *context, int status, int errnum, const m4_call_info *caller,
unchanged. */
void
m4_warn (m4 *context, int errnum, const m4_call_info *caller,
- const char *format, ...)
+ const char *format, ...)
{
if (!m4_get_suppress_warnings_opt (context))
{
@@ -258,7 +258,7 @@ m4_warn (m4 *context, int errnum, const m4_call_info *caller,
int status = EXIT_SUCCESS;
va_start (args, format);
if (m4_get_warnings_exit_opt (context))
- status = EXIT_FAILURE;
+ status = EXIT_FAILURE;
m4_verror_at_line (context, true, status, errnum, caller, format, args);
va_end (args);
}
diff --git a/modules/evalparse.c b/modules/evalparse.c
index e849f731..2b0321b4 100644
--- a/modules/evalparse.c
+++ b/modules/evalparse.c
@@ -137,80 +137,80 @@ eval_lex (number *val)
int base, digit;
if (*eval_text == '0')
- {
- eval_text++;
- switch (*eval_text)
- {
- case 'x':
- case 'X':
- base = 16;
- eval_text++;
- break;
-
- case 'b':
- case 'B':
- base = 2;
- eval_text++;
- break;
-
- case 'r':
- case 'R':
- base = 0;
- eval_text++;
- while (isdigit (to_uchar (*eval_text)) && base <= 36)
- base = 10 * base + *eval_text++ - '0';
- if (base == 0 || base > 36 || *eval_text != ':')
- return ERROR;
- eval_text++;
- break;
-
- default:
- base = 8;
- }
- }
+ {
+ eval_text++;
+ switch (*eval_text)
+ {
+ case 'x':
+ case 'X':
+ base = 16;
+ eval_text++;
+ break;
+
+ case 'b':
+ case 'B':
+ base = 2;
+ eval_text++;
+ break;
+
+ case 'r':
+ case 'R':
+ base = 0;
+ eval_text++;
+ while (isdigit (to_uchar (*eval_text)) && base <= 36)
+ base = 10 * base + *eval_text++ - '0';
+ if (base == 0 || base > 36 || *eval_text != ':')
+ return ERROR;
+ eval_text++;
+ break;
+
+ default:
+ base = 8;
+ }
+ }
else
- base = 10;
+ base = 10;
numb_set_si (val, 0);
for (; *eval_text; eval_text++)
- {
- if (isdigit (to_uchar (*eval_text)))
- digit = *eval_text - '0';
- else if (islower (to_uchar (*eval_text)))
- digit = *eval_text - 'a' + 10;
- else if (isupper (to_uchar (*eval_text)))
- digit = *eval_text - 'A' + 10;
- else
- break;
-
- if (base == 1)
- {
- if (digit == 1)
- numb_incr (*val);
- else if (digit == 0 && numb_zerop (*val))
- continue;
- else
- break;
- }
- else if (digit >= base)
- break;
- else
- {
- number xbase;
- number xdigit;
-
- /* (*val) = (*val) * base; */
- numb_init (xbase);
- numb_set_si (&xbase, base);
- numb_times (*val, xbase);
- numb_fini (xbase);
- /* (*val) = (*val) + digit; */
- numb_init (xdigit);
- numb_set_si (&xdigit, digit);
- numb_plus (*val, xdigit);
- numb_fini (xdigit);
- }
- }
+ {
+ if (isdigit (to_uchar (*eval_text)))
+ digit = *eval_text - '0';
+ else if (islower (to_uchar (*eval_text)))
+ digit = *eval_text - 'a' + 10;
+ else if (isupper (to_uchar (*eval_text)))
+ digit = *eval_text - 'A' + 10;
+ else
+ break;
+
+ if (base == 1)
+ {
+ if (digit == 1)
+ numb_incr (*val);
+ else if (digit == 0 && numb_zerop (*val))
+ continue;
+ else
+ break;
+ }
+ else if (digit >= base)
+ break;
+ else
+ {
+ number xbase;
+ number xdigit;
+
+ /* (*val) = (*val) * base; */
+ numb_init (xbase);
+ numb_set_si (&xbase, base);
+ numb_times (*val, xbase);
+ numb_fini (xbase);
+ /* (*val) = (*val) + digit; */
+ numb_init (xdigit);
+ numb_set_si (&xdigit, digit);
+ numb_plus (*val, xdigit);
+ numb_fini (xdigit);
+ }
+ }
return NUMBER;
}
@@ -218,102 +218,102 @@ eval_lex (number *val)
{
case '+':
if (*eval_text == '+' || *eval_text == '=')
- return BADOP;
+ return BADOP;
return PLUS;
case '-':
if (*eval_text == '-' || *eval_text == '=')
- return BADOP;
+ return BADOP;
return MINUS;
case '*':
if (*eval_text == '*')
- {
- eval_text++;
- return EXPONENT;
- }
+ {
+ eval_text++;
+ return EXPONENT;
+ }
else if (*eval_text == '=')
- return BADOP;
+ return BADOP;
return TIMES;
case '/':
if (*eval_text == '=')
- return BADOP;
+ return BADOP;
return DIVIDE;
case '%':
if (*eval_text == '=')
- return BADOP;
+ return BADOP;
return MODULO;
case '\\':
return RATIO;
case '=':
if (*eval_text == '=')
- {
- eval_text++;
- return EQ;
- }
+ {
+ eval_text++;
+ return EQ;
+ }
return BADOP;
case '!':
if (*eval_text == '=')
- {
- eval_text++;
- return NOTEQ;
- }
+ {
+ eval_text++;
+ return NOTEQ;
+ }
return LNOT;
case '>':
if (*eval_text == '=')
- {
- eval_text++;
- return GTEQ;
- }
+ {
+ eval_text++;
+ return GTEQ;
+ }
else if (*eval_text == '>')
- {
- eval_text++;
- if (*eval_text == '=')
- return BADOP;
- else if (*eval_text == '>')
- {
- eval_text++;
- return URSHIFT;
- }
- return RSHIFT;
- }
+ {
+ eval_text++;
+ if (*eval_text == '=')
+ return BADOP;
+ else if (*eval_text == '>')
+ {
+ eval_text++;
+ return URSHIFT;
+ }
+ return RSHIFT;
+ }
else
- return GT;
+ return GT;
case '<':
if (*eval_text == '=')
- {
- eval_text++;
- return LSEQ;
- }
+ {
+ eval_text++;
+ return LSEQ;
+ }
else if (*eval_text == '<')
- {
- if (*++eval_text == '=')
- return BADOP;
- return LSHIFT;
- }
+ {
+ if (*++eval_text == '=')
+ return BADOP;
+ return LSHIFT;
+ }
else
- return LS;
+ return LS;
case '^':
if (*eval_text == '=')
- return BADOP;
+ return BADOP;
return XOR;
case '~':
return NOT;
case '&':
if (*eval_text == '&')
- {
- eval_text++;
- return LAND;
- }
+ {
+ eval_text++;
+ return LAND;
+ }
else if (*eval_text == '=')
- return BADOP;
+ return BADOP;
return AND;
case '|':
if (*eval_text == '|')
- {
- eval_text++;
- return LOR;
- }
+ {
+ eval_text++;
+ return LOR;
+ }
else if (*eval_text == '=')
- return BADOP;
+ return BADOP;
return OR;
case '(':
return LEFTP;
@@ -345,10 +345,10 @@ comma_term (m4 *context, eval_token et, number *v1)
{
et = eval_lex (&v2);
if (et == ERROR)
- return UNKNOWN_INPUT;
+ return UNKNOWN_INPUT;
if ((er = condition_term (context, et, &v2)) != NO_ERROR)
- return er;
+ return er;
numb_set (*v1, v2);
}
numb_fini (v2);
@@ -375,28 +375,28 @@ condition_term (m4 *context, eval_token et, number *v1)
{
et = eval_lex (&v2);
if (et == ERROR)
- return UNKNOWN_INPUT;
+ return UNKNOWN_INPUT;
/* Implement short-circuiting of valid syntax. */
er = comma_term (context, et, &v2);
if (er != NO_ERROR
- && !(numb_zerop (*v1) && er < SYNTAX_ERROR))
- return er;
+ && !(numb_zerop (*v1) && er < SYNTAX_ERROR))
+ return er;
et = eval_lex (&v3);
if (et == ERROR)
- return UNKNOWN_INPUT;
+ return UNKNOWN_INPUT;
if (et != COLON)
- return MISSING_COLON;
+ return MISSING_COLON;
et = eval_lex (&v3);
if (et == ERROR)
- return UNKNOWN_INPUT;
+ return UNKNOWN_INPUT;
er = condition_term (context, et, &v3);
if (er != NO_ERROR
- && !(! numb_zerop (*v1) && er < SYNTAX_ERROR))
- return er;
+ && !(! numb_zerop (*v1) && er < SYNTAX_ERROR))
+ return er;
numb_set (*v1, ! numb_zerop (*v1) ? v2 : v3);
}
@@ -423,16 +423,16 @@ logical_or_term (m4 *context, eval_token et, number *v1)
{
et = eval_lex (&v2);
if (et == ERROR)
- return UNKNOWN_INPUT;
+ return UNKNOWN_INPUT;
/* Implement short-circuiting of valid syntax. */
er = logical_and_term (context, et, &v2);
if (er == NO_ERROR)
- numb_lior (*v1, v2);
+ numb_lior (*v1, v2);
else if (! numb_zerop (*v1) && er < SYNTAX_ERROR)
- numb_set (*v1, numb_ONE);
+ numb_set (*v1, numb_ONE);
else
- return er;
+ return er;
}
numb_fini (v2);
if (et == ERROR)
@@ -456,16 +456,16 @@ logical_and_term (m4 *context, eval_token et, number *v1)
{
et = eval_lex (&v2);
if (et == ERROR)
- return UNKNOWN_INPUT;
+ return UNKNOWN_INPUT;
/* Implement short-circuiting of valid syntax. */
er = or_term (context, et, &v2);
if (er == NO_ERROR)
- numb_land (*v1, v2);
+ numb_land (*v1, v2);
else if (numb_zerop (*v1) && er < SYNTAX_ERROR)
- numb_set (*v1, numb_ZERO);
+ numb_set (*v1, numb_ZERO);
else
- return er;
+ return er;
}
numb_fini (v2);
if (et == ERROR)
@@ -489,10 +489,10 @@ or_term (m4 *context, eval_token et, number *v1)
{
et = eval_lex (&v2);
if (et == ERROR)
- return UNKNOWN_INPUT;
+ return UNKNOWN_INPUT;
if ((er = xor_term (context, et, &v2)) != NO_ERROR)
- return er;
+ return er;
numb_ior (context, v1, &v2);
}
@@ -518,10 +518,10 @@ xor_term (m4 *context, eval_token et, number *v1)
{
et = eval_lex (&v2);
if (et == ERROR)
- return UNKNOWN_INPUT;
+ return UNKNOWN_INPUT;
if ((er = and_term (context, et, &v2)) != NO_ERROR)
- return er;
+ return er;
numb_eor (context, v1, &v2);
}
@@ -547,10 +547,10 @@ and_term (m4 *context, eval_token et, number *v1)
{
et = eval_lex (&v2);
if (et == ERROR)
- return UNKNOWN_INPUT;
+ return UNKNOWN_INPUT;
if ((er = equality_term (context, et, &v2)) != NO_ERROR)
- return er;
+ return er;
numb_and (context, v1, &v2);
}
@@ -577,15 +577,15 @@ equality_term (m4 *context, eval_token et, number *v1)
{
et = eval_lex (&v2);
if (et == ERROR)
- return UNKNOWN_INPUT;
+ return UNKNOWN_INPUT;
if ((er = cmp_term (context, et, &v2)) != NO_ERROR)
- return er;
+ return er;
if (op == EQ)
- numb_eq (*v1, v2);
+ numb_eq (*v1, v2);
else
- numb_ne (*v1, v2);
+ numb_ne (*v1, v2);
}
numb_fini (v2);
if (op == ERROR)
@@ -607,38 +607,38 @@ cmp_term (m4 *context, eval_token et, number *v1)
numb_init (v2);
while ((op = eval_lex (&v2)) == GT || op == GTEQ
- || op == LS || op == LSEQ)
+ || op == LS || op == LSEQ)
{
et = eval_lex (&v2);
if (et == ERROR)
- return UNKNOWN_INPUT;
+ return UNKNOWN_INPUT;
if ((er = shift_term (context, et, &v2)) != NO_ERROR)
- return er;
+ return er;
switch (op)
- {
- case GT:
- numb_gt (*v1, v2);
- break;
-
- case GTEQ:
- numb_ge (*v1, v2);
- break;
-
- case LS:
- numb_lt (*v1, v2);
- break;
-
- case LSEQ:
- numb_le (*v1, v2);
- break;
-
- default:
- assert (!"INTERNAL ERROR: bad comparison operator in cmp_term ()");
- abort ();
- }
+ {
+ case GT:
+ numb_gt (*v1, v2);
+ break;
+
+ case GTEQ:
+ numb_ge (*v1, v2);
+ break;
+
+ case LS:
+ numb_lt (*v1, v2);
+ break;
+
+ case LSEQ:
+ numb_le (*v1, v2);
+ break;
+
+ default:
+ assert (!"INTERNAL ERROR: bad comparison operator in cmp_term ()");
+ abort ();
+ }
}
numb_fini (v2);
if (op == ERROR)
@@ -664,29 +664,29 @@ shift_term (m4 *context, eval_token et, number *v1)
et = eval_lex (&v2);
if (et == ERROR)
- return UNKNOWN_INPUT;
+ return UNKNOWN_INPUT;
if ((er = add_term (context, et, &v2)) != NO_ERROR)
- return er;
+ return er;
switch (op)
- {
- case LSHIFT:
- numb_lshift (context, v1, &v2);
- break;
-
- case RSHIFT:
- numb_rshift (context, v1, &v2);
- break;
-
- case URSHIFT:
- numb_urshift (context, v1, &v2);
- break;
-
- default:
- assert (!"INTERNAL ERROR: bad shift operator in shift_term ()");
- abort ();
- }
+ {
+ case LSHIFT:
+ numb_lshift (context, v1, &v2);
+ break;
+
+ case RSHIFT:
+ numb_rshift (context, v1, &v2);
+ break;
+
+ case URSHIFT:
+ numb_urshift (context, v1, &v2);
+ break;
+
+ default:
+ assert (!"INTERNAL ERROR: bad shift operator in shift_term ()");
+ abort ();
+ }
}
numb_fini (v2);
if (op == ERROR)
@@ -711,15 +711,15 @@ add_term (m4 *context, eval_token et, number *v1)
{
et = eval_lex (&v2);
if (et == ERROR)
- return UNKNOWN_INPUT;
+ return UNKNOWN_INPUT;
if ((er = mult_term (context, et, &v2)) != NO_ERROR)
- return er;
+ return er;
if (op == PLUS)
- numb_plus (*v1, v2);
+ numb_plus (*v1, v2);
else
- numb_minus (*v1, v2);
+ numb_minus (*v1, v2);
}
numb_fini (v2);
if (op == ERROR)
@@ -741,49 +741,49 @@ mult_term (m4 *context, eval_token et, number *v1)
numb_init (v2);
while (op = eval_lex (&v2),
- op == TIMES
- || op == DIVIDE
- || op == MODULO
- || op == RATIO)
+ op == TIMES
+ || op == DIVIDE
+ || op == MODULO
+ || op == RATIO)
{
et = eval_lex (&v2);
if (et == ERROR)
- return UNKNOWN_INPUT;
+ return UNKNOWN_INPUT;
if ((er = exp_term (context, et, &v2)) != NO_ERROR)
- return er;
+ return er;
switch (op)
- {
- case TIMES:
- numb_times (*v1, v2);
- break;
-
- case DIVIDE:
- if (numb_zerop (v2))
- return DIVIDE_ZERO;
- else
- numb_divide(v1, &v2);
- break;
-
- case RATIO:
- if (numb_zerop (v2))
- return DIVIDE_ZERO;
- else
- numb_ratio (*v1, v2);
- break;
-
- case MODULO:
- if (numb_zerop (v2))
- return MODULO_ZERO;
- else
- numb_modulo (context, v1, &v2);
- break;
-
- default:
- assert (!"INTERNAL ERROR: bad operator in mult_term ()");
- abort ();
- }
+ {
+ case TIMES:
+ numb_times (*v1, v2);
+ break;
+
+ case DIVIDE:
+ if (numb_zerop (v2))
+ return DIVIDE_ZERO;
+ else
+ numb_divide(v1, &v2);
+ break;
+
+ case RATIO:
+ if (numb_zerop (v2))
+ return DIVIDE_ZERO;
+ else
+ numb_ratio (*v1, v2);
+ break;
+
+ case MODULO:
+ if (numb_zerop (v2))
+ return MODULO_ZERO;
+ else
+ numb_modulo (context, v1, &v2);
+ break;
+
+ default:
+ assert (!"INTERNAL ERROR: bad operator in mult_term ()");
+ abort ();
+ }
}
numb_fini (v2);
if (op == ERROR)
@@ -807,13 +807,13 @@ exp_term (m4 *context, eval_token et, number *v1)
{
et = eval_lex (&v2);
if (et == ERROR)
- return UNKNOWN_INPUT;
+ return UNKNOWN_INPUT;
if ((er = exp_term (context, et, &v2)) != NO_ERROR)
- return er;
+ return er;
if ((er = numb_pow (v1, &v2)) != NO_ERROR)
- return er;
+ return er;
}
numb_fini (v2);
if (et == ERROR)
@@ -833,17 +833,17 @@ unary_term (m4 *context, eval_token et, number *v1)
{
et2 = eval_lex (v1);
if (et2 == ERROR)
- return UNKNOWN_INPUT;
+ return UNKNOWN_INPUT;
if ((er = unary_term (context, et2, v1)) != NO_ERROR)
- return er;
+ return er;
if (et == MINUS)
- numb_negate(*v1);
+ numb_negate(*v1);
else if (et == NOT)
- numb_not (context, v1);
+ numb_not (context, v1);
else if (et == LNOT)
- numb_lnot (*v1);
+ numb_lnot (*v1);
}
else if ((er = simple_term (context, et, v1)) != NO_ERROR)
return er;
@@ -862,17 +862,17 @@ simple_term (m4 *context, eval_token et, number *v1)
case LEFTP:
et = eval_lex (v1);
if (et == ERROR)
- return UNKNOWN_INPUT;
+ return UNKNOWN_INPUT;
if ((er = comma_term (context, et, v1)) != NO_ERROR)
- return er;
+ return er;
et = eval_lex (&v2);
if (et == ERROR)
- return UNKNOWN_INPUT;
+ return UNKNOWN_INPUT;
if (et != RIGHTP)
- return MISSING_RIGHT;
+ return MISSING_RIGHT;
break;
@@ -911,7 +911,7 @@ m4_evaluate (m4 *context, m4_obstack *obs, size_t argc, m4_macro_args *argv)
}
if (argc >= 4 && !m4_numeric_arg (context, me, M4ARG (3), M4ARGLEN (3),
- &min))
+ &min))
return;
if (min < 0)
@@ -936,9 +936,9 @@ m4_evaluate (m4 *context, m4_obstack *obs, size_t argc, m4_macro_args *argv)
if (err == NO_ERROR && *eval_text != '\0')
{
if (eval_lex (&val) == BADOP)
- err = INVALID_OPERATOR;
+ err = INVALID_OPERATOR;
else
- err = EXCESS_INPUT;
+ err = EXCESS_INPUT;
}
if (err != NO_ERROR)
diff --git a/modules/format.c b/modules/format.c
index 97be02f3..61338b9d 100644
--- a/modules/format.c
+++ b/modules/format.c
@@ -30,7 +30,7 @@
of ME. */
static int
arg_int (struct m4 *context, const m4_call_info *me, const char *str,
- size_t len)
+ size_t len)
{
char *endp;
long value;
@@ -46,7 +46,7 @@ arg_int (struct m4 *context, const m4_call_info *me, const char *str,
value = strtol (str, &endp, 10);
if (endp - str != len)
m4_warn (context, 0, me, _("non-numeric argument %s"),
- quotearg_style_mem (locale_quoting_style, str, len));
+ quotearg_style_mem (locale_quoting_style, str, len));
else if (isspace (to_uchar (*str)))
m4_warn (context, 0, me, _("leading whitespace ignored"));
else if (errno == ERANGE || (int) value != value)
@@ -58,7 +58,7 @@ arg_int (struct m4 *context, const m4_call_info *me, const char *str,
ME. */
static long
arg_long (struct m4 *context, const m4_call_info *me, const char *str,
- size_t len)
+ size_t len)
{
char *endp;
long value;
@@ -74,7 +74,7 @@ arg_long (struct m4 *context, const m4_call_info *me, const char *str,
value = strtol (str, &endp, 10);
if (endp - str != len)
m4_warn (context, 0, me, _("non-numeric argument %s"),
- quotearg_style_mem (locale_quoting_style, str, len));
+ quotearg_style_mem (locale_quoting_style, str, len));
else if (isspace (to_uchar (*str)))
m4_warn (context, 0, me, _("leading whitespace ignored"));
else if (errno == ERANGE)
@@ -86,11 +86,11 @@ arg_long (struct m4 *context, const m4_call_info *me, const char *str,
behalf of ME. */
static const char *
arg_string (struct m4 *context, const m4_call_info *me, const char *str,
- size_t len)
+ size_t len)
{
if (strlen (str) < len)
m4_warn (context, 0, me, _("argument %s truncated"),
- quotearg_style_mem (locale_quoting_style, str, len));
+ quotearg_style_mem (locale_quoting_style, str, len));
return str;
}
@@ -98,7 +98,7 @@ arg_string (struct m4 *context, const m4_call_info *me, const char *str,
of ME. */
static double
arg_double (struct m4 *context, const m4_call_info *me, const char *str,
- size_t len)
+ size_t len)
{
char *endp;
double value;
@@ -112,7 +112,7 @@ arg_double (struct m4 *context, const m4_call_info *me, const char *str,
value = strtod (str, &endp);
if (endp - str != len)
m4_warn (context, 0, me, _("non-numeric argument %s"),
- quotearg_style_mem (locale_quoting_style, str, len));
+ quotearg_style_mem (locale_quoting_style, str, len));
else if (isspace (to_uchar (*str)))
m4_warn (context, 0, me, _("leading whitespace ignored"));
else if (errno == ERANGE)
@@ -186,233 +186,233 @@ format (m4 *context, m4_obstack *obs, int argc, m4_macro_args *argv)
{
const char *percent = (char *) memchr (fmt, '%', f_len);
if (!percent)
- {
- obstack_grow (obs, fmt, f_len);
- break;
- }
+ {
+ obstack_grow (obs, fmt, f_len);
+ break;
+ }
obstack_grow (obs, fmt, percent - fmt);
f_len -= percent - fmt + 1;
fmt = percent + 1;
if (*fmt == '%')
- {
- obstack_1grow (obs, '%');
- fmt++;
- f_len--;
- continue;
- }
+ {
+ obstack_1grow (obs, '%');
+ fmt++;
+ f_len--;
+ continue;
+ }
p = fstart + 1; /* % */
lflag = 0;
ok['a'] = ok['A'] = ok['c'] = ok['d'] = ok['e'] = ok['E']
- = ok['f'] = ok['F'] = ok['g'] = ok['G'] = ok['i'] = ok['o']
- = ok['s'] = ok['u'] = ok['x'] = ok['X'] = 1;
+ = ok['f'] = ok['F'] = ok['g'] = ok['G'] = ok['i'] = ok['o']
+ = ok['s'] = ok['u'] = ok['x'] = ok['X'] = 1;
/* Parse flags. */
flags = 0;
do
- {
- switch (*fmt)
- {
- case '\'': /* thousands separator */
- ok['a'] = ok['A'] = ok['c'] = ok['e'] = ok['E']
- = ok['o'] = ok['s'] = ok['x'] = ok['X'] = 0;
- flags |= THOUSANDS;
- break;
-
- case '+': /* mandatory sign */
- ok['c'] = ok['o'] = ok['s'] = ok['u'] = ok['x'] = ok['X'] = 0;
- flags |= PLUS;
- break;
-
- case ' ': /* space instead of positive sign */
- ok['c'] = ok['o'] = ok['s'] = ok['u'] = ok['x'] = ok['X'] = 0;
- flags |= SPACE;
- break;
-
- case '0': /* zero padding */
- ok['c'] = ok['s'] = 0;
- flags |= ZERO;
- break;
-
- case '#': /* alternate output */
- ok['c'] = ok['d'] = ok['i'] = ok['s'] = ok['u'] = 0;
- flags |= ALT;
- break;
-
- case '-': /* left justification */
- flags |= MINUS;
- break;
-
- default:
- flags |= DONE;
- break;
- }
- }
+ {
+ switch (*fmt)
+ {
+ case '\'': /* thousands separator */
+ ok['a'] = ok['A'] = ok['c'] = ok['e'] = ok['E']
+ = ok['o'] = ok['s'] = ok['x'] = ok['X'] = 0;
+ flags |= THOUSANDS;
+ break;
+
+ case '+': /* mandatory sign */
+ ok['c'] = ok['o'] = ok['s'] = ok['u'] = ok['x'] = ok['X'] = 0;
+ flags |= PLUS;
+ break;
+
+ case ' ': /* space instead of positive sign */
+ ok['c'] = ok['o'] = ok['s'] = ok['u'] = ok['x'] = ok['X'] = 0;
+ flags |= SPACE;
+ break;
+
+ case '0': /* zero padding */
+ ok['c'] = ok['s'] = 0;
+ flags |= ZERO;
+ break;
+
+ case '#': /* alternate output */
+ ok['c'] = ok['d'] = ok['i'] = ok['s'] = ok['u'] = 0;
+ flags |= ALT;
+ break;
+
+ case '-': /* left justification */
+ flags |= MINUS;
+ break;
+
+ default:
+ flags |= DONE;
+ break;
+ }
+ }
while (!(flags & DONE) && (f_len--, fmt++));
if (flags & THOUSANDS)
- *p++ = '\'';
+ *p++ = '\'';
if (flags & PLUS)
- *p++ = '+';
+ *p++ = '+';
if (flags & MINUS)
- *p++ = '-';
+ *p++ = '-';
if (flags & SPACE)
- *p++ = ' ';
+ *p++ = ' ';
if (flags & ZERO)
- *p++ = '0';
+ *p++ = '0';
if (flags & ALT)
- *p++ = '#';
+ *p++ = '#';
/* Minimum field width; an explicit 0 is the same as not giving
- the width. */
+ the width. */
width = 0;
*p++ = '*';
if (*fmt == '*')
- {
- width = ARG_INT (i, argc, argv);
- fmt++;
- f_len--;
- }
+ {
+ width = ARG_INT (i, argc, argv);
+ fmt++;
+ f_len--;
+ }
else
- while (isdigit ((unsigned char) *fmt))
- {
- width = 10 * width + *fmt - '0';
- fmt++;
- f_len--;
- }
+ while (isdigit ((unsigned char) *fmt))
+ {
+ width = 10 * width + *fmt - '0';
+ fmt++;
+ f_len--;
+ }
/* Maximum precision; an explicit negative precision is the same
- as not giving the precision. A lone '.' is a precision of 0. */
+ as not giving the precision. A lone '.' is a precision of 0. */
prec = -1;
*p++ = '.';
*p++ = '*';
if (*fmt == '.')
- {
- ok['c'] = 0;
- f_len--;
- if (*(++fmt) == '*')
- {
- prec = ARG_INT (i, argc, argv);
- ++fmt;
- f_len--;
- }
- else
- {
- prec = 0;
- while (isdigit ((unsigned char) *fmt))
- {
- prec = 10 * prec + *fmt - '0';
- fmt++;
- f_len--;
- }
- }
- }
+ {
+ ok['c'] = 0;
+ f_len--;
+ if (*(++fmt) == '*')
+ {
+ prec = ARG_INT (i, argc, argv);
+ ++fmt;
+ f_len--;
+ }
+ else
+ {
+ prec = 0;
+ while (isdigit ((unsigned char) *fmt))
+ {
+ prec = 10 * prec + *fmt - '0';
+ fmt++;
+ f_len--;
+ }
+ }
+ }
/* Length modifiers. We don't yet recognize ll, j, t, or z. */
if (*fmt == 'l')
- {
- *p++ = 'l';
- lflag = 1;
- fmt++;
- f_len--;
- ok['c'] = ok['s'] = 0;
- }
+ {
+ *p++ = 'l';
+ lflag = 1;
+ fmt++;
+ f_len--;
+ ok['c'] = ok['s'] = 0;
+ }
else if (*fmt == 'h')
- {
- *p++ = 'h';
- fmt++;
- f_len--;
- if (*fmt == 'h')
- {
- *p++ = 'h';
- fmt++;
- f_len--;
- }
- ok['a'] = ok['A'] = ok['c'] = ok['e'] = ok['E'] = ok['f'] = ok['F']
- = ok['g'] = ok['G'] = ok['s'] = 0;
- }
+ {
+ *p++ = 'h';
+ fmt++;
+ f_len--;
+ if (*fmt == 'h')
+ {
+ *p++ = 'h';
+ fmt++;
+ f_len--;
+ }
+ ok['a'] = ok['A'] = ok['c'] = ok['e'] = ok['E'] = ok['f'] = ok['F']
+ = ok['g'] = ok['G'] = ok['s'] = 0;
+ }
c = *fmt;
if (c > sizeof ok || !ok[c] || !f_len)
- {
- m4_warn (context, 0, me, _("unrecognized specifier in %s"),
- quotearg_style_mem (locale_quoting_style, f, M4ARGLEN (1)));
- valid_format = false;
- continue;
- }
+ {
+ m4_warn (context, 0, me, _("unrecognized specifier in %s"),
+ quotearg_style_mem (locale_quoting_style, f, M4ARGLEN (1)));
+ valid_format = false;
+ continue;
+ }
fmt++;
f_len--;
/* Specifiers. We don't yet recognize C, S, n, or p. */
switch (c)
- {
- case 'c':
- datatype = CHAR;
- p -= 2; /* %.*c is undefined, so undo the '.*'. */
- break;
-
- case 's':
- datatype = STR;
- break;
-
- case 'd':
- case 'i':
- case 'o':
- case 'x':
- case 'X':
- case 'u':
- datatype = lflag ? LONG : INT;
- break;
-
- case 'a':
- case 'A':
- case 'e':
- case 'E':
- case 'f':
- case 'F':
- case 'g':
- case 'G':
- datatype = DOUBLE;
- break;
-
- default:
- abort ();
- }
+ {
+ case 'c':
+ datatype = CHAR;
+ p -= 2; /* %.*c is undefined, so undo the '.*'. */
+ break;
+
+ case 's':
+ datatype = STR;
+ break;
+
+ case 'd':
+ case 'i':
+ case 'o':
+ case 'x':
+ case 'X':
+ case 'u':
+ datatype = lflag ? LONG : INT;
+ break;
+
+ case 'a':
+ case 'A':
+ case 'e':
+ case 'E':
+ case 'f':
+ case 'F':
+ case 'g':
+ case 'G':
+ datatype = DOUBLE;
+ break;
+
+ default:
+ abort ();
+ }
*p++ = c;
*p = '\0';
switch (datatype)
- {
- case CHAR:
- result = obstack_printf (obs, fstart, width,
- ARG_INT (i, argc, argv));
- break;
-
- case INT:
- result = obstack_printf (obs, fstart, width, prec,
- ARG_INT (i, argc, argv));
- break;
-
- case LONG:
- result = obstack_printf (obs, fstart, width, prec,
- ARG_LONG (i, argc, argv));
- break;
-
- case DOUBLE:
- result = obstack_printf (obs, fstart, width, prec,
- ARG_DOUBLE (i, argc, argv));
- break;
-
- case STR:
- result = obstack_printf (obs, fstart, width, prec,
- ARG_STR (i, argc, argv));
- break;
-
- default:
- abort ();
- }
+ {
+ case CHAR:
+ result = obstack_printf (obs, fstart, width,
+ ARG_INT (i, argc, argv));
+ break;
+
+ case INT:
+ result = obstack_printf (obs, fstart, width, prec,
+ ARG_INT (i, argc, argv));
+ break;
+
+ case LONG:
+ result = obstack_printf (obs, fstart, width, prec,
+ ARG_LONG (i, argc, argv));
+ break;
+
+ case DOUBLE:
+ result = obstack_printf (obs, fstart, width, prec,
+ ARG_DOUBLE (i, argc, argv));
+ break;
+
+ case STR:
+ result = obstack_printf (obs, fstart, width, prec,
+ ARG_STR (i, argc, argv));
+ break;
+
+ default:
+ abort ();
+ }
/* Since obstack_printf can only fail with EILSEQ or EINVAL, but
- we constructed fstart, the result should not be negative. */
+ we constructed fstart, the result should not be negative. */
assert (0 <= result);
}
if (valid_format)
diff --git a/modules/gnu.c b/modules/gnu.c
index 6d66755e..798cc5ec 100644
--- a/modules/gnu.c
+++ b/modules/gnu.c
@@ -41,7 +41,7 @@
/* Maintain each of the builtins implemented in this modules along
with their details in a single table for easy maintenance.
- function macros blind side minargs maxargs */
+ function macros blind side minargs maxargs */
#define builtin_functions \
BUILTIN (__file__, false, false, false, 0, 0 ) \
BUILTIN (__line__, false, false, false, 0, 0 ) \
@@ -134,7 +134,7 @@ static m4_pattern_buffer regex_cache[REGEX_CACHE_SIZE];
static m4_pattern_buffer *
regexp_compile (m4 *context, const m4_call_info *caller, const char *regexp,
- size_t len, int resyntax)
+ size_t len, int resyntax)
{
/* regex_cache is guaranteed to start life 0-initialized, which
works in the algorithm below.
@@ -156,10 +156,10 @@ regexp_compile (m4 *context, const m4_call_info *caller, const char *regexp,
If so, increase its use count and return it. */
for (i = 0; i < REGEX_CACHE_SIZE; i++)
if (len == regex_cache[i].len && resyntax == regex_cache[i].resyntax
- && regex_cache[i].str && memcmp (regexp, regex_cache[i].str, len) == 0)
+ && regex_cache[i].str && memcmp (regexp, regex_cache[i].str, len) == 0)
{
- regex_cache[i].count++;
- return &regex_cache[i];
+ regex_cache[i].count++;
+ return &regex_cache[i];
}
/* Next, check if REGEXP can be compiled. */
@@ -170,7 +170,7 @@ regexp_compile (m4 *context, const m4_call_info *caller, const char *regexp,
if (msg != NULL)
{
m4_warn (context, 0, caller, _("bad regular expression %s: %s"),
- quotearg_style_mem (locale_quoting_style, regexp, len), msg);
+ quotearg_style_mem (locale_quoting_style, regexp, len), msg);
regfree (pat);
free (pat);
return NULL;
@@ -189,12 +189,12 @@ regexp_compile (m4 *context, const m4_call_info *caller, const char *regexp,
for (i = 1; i < REGEX_CACHE_SIZE; i++)
{
if (regex_cache[i].count < victim_count)
- {
- victim_count = regex_cache[i].count;
- victim = &regex_cache[i];
- }
+ {
+ victim_count = regex_cache[i].count;
+ victim = &regex_cache[i];
+ }
if (regex_cache[i].count)
- regex_cache[i].count--;
+ regex_cache[i].count--;
}
victim->count = REGEX_CACHE_SIZE;
victim->resyntax = resyntax;
@@ -208,7 +208,7 @@ regexp_compile (m4 *context, const m4_call_info *caller, const char *regexp,
victim->str = xstrdup (regexp);
victim->pat = pat;
re_set_registers (pat, &victim->regs, victim->regs.num_regs,
- victim->regs.start, victim->regs.end);
+ victim->regs.start, victim->regs.end);
return victim;
}
@@ -218,10 +218,10 @@ regexp_compile (m4 *context, const m4_call_info *caller, const char *regexp,
static regoff_t
regexp_search (m4_pattern_buffer *buf, const char *string, const int size,
- const int start, const int range, bool no_sub)
+ const int start, const int range, bool no_sub)
{
return re_search (buf->pat, string, size, start, range,
- no_sub ? NULL : &buf->regs);
+ no_sub ? NULL : &buf->regs);
}
@@ -236,52 +236,52 @@ regexp_search (m4_pattern_buffer *buf, const char *string, const int size,
static void
substitute (m4 *context, m4_obstack *obs, const m4_call_info *caller,
- const char *victim, const char *repl, size_t repl_len,
- m4_pattern_buffer *buf)
+ const char *victim, const char *repl, size_t repl_len,
+ m4_pattern_buffer *buf)
{
int ch;
while (1)
{
const char *backslash = (char *) memchr (repl, '\\', repl_len);
if (!backslash)
- {
- obstack_grow (obs, repl, repl_len);
- return;
- }
+ {
+ obstack_grow (obs, repl, repl_len);
+ return;
+ }
obstack_grow (obs, repl, backslash - repl);
repl_len -= backslash - repl + 1;
if (!repl_len)
- {
- m4_warn (context, 0, caller,
- _("trailing \\ ignored in replacement"));
- return;
- }
+ {
+ m4_warn (context, 0, caller,
+ _("trailing \\ ignored in replacement"));
+ return;
+ }
repl = backslash + 1;
ch = *repl++;
repl_len--;
switch (ch)
- {
- case '&':
- if (buf)
- obstack_grow (obs, victim + buf->regs.start[0],
- buf->regs.end[0] - buf->regs.start[0]);
- break;
-
- case '1': case '2': case '3': case '4': case '5': case '6':
- case '7': case '8': case '9':
- ch -= '0';
- if (!buf || buf->pat->re_nsub < ch)
- m4_warn (context, 0, caller, _("sub-expression %d not present"),
- ch);
- else if (buf->regs.end[ch] > 0)
- obstack_grow (obs, victim + buf->regs.start[ch],
- buf->regs.end[ch] - buf->regs.start[ch]);
- break;
-
- default:
- obstack_1grow (obs, ch);
- break;
- }
+ {
+ case '&':
+ if (buf)
+ obstack_grow (obs, victim + buf->regs.start[0],
+ buf->regs.end[0] - buf->regs.start[0]);
+ break;
+
+ case '1': case '2': case '3': case '4': case '5': case '6':
+ case '7': case '8': case '9':
+ ch -= '0';
+ if (!buf || buf->pat->re_nsub < ch)
+ m4_warn (context, 0, caller, _("sub-expression %d not present"),
+ ch);
+ else if (buf->regs.end[ch] > 0)
+ obstack_grow (obs, victim + buf->regs.start[ch],
+ buf->regs.end[ch] - buf->regs.start[ch]);
+ break;
+
+ default:
+ obstack_1grow (obs, ch);
+ break;
+ }
}
}
@@ -296,9 +296,9 @@ substitute (m4 *context, m4_obstack *obs, const m4_call_info *caller,
static bool
regexp_substitute (m4 *context, m4_obstack *obs, const m4_call_info *caller,
- const char *victim, size_t len, const char *regexp,
- size_t regexp_len, m4_pattern_buffer *buf,
- const char *replace, size_t repl_len, bool optimize)
+ const char *victim, size_t len, const char *regexp,
+ size_t regexp_len, m4_pattern_buffer *buf,
+ const char *replace, size_t repl_len, bool optimize)
{
regoff_t matchpos = 0; /* start position of match */
size_t offset = 0; /* current match offset */
@@ -307,29 +307,29 @@ regexp_substitute (m4 *context, m4_obstack *obs, const m4_call_info *caller,
while (offset <= len)
{
matchpos = regexp_search (buf, victim, len, offset, len - offset,
- false);
+ false);
if (matchpos < 0)
- {
-
- /* Match failed -- either error or there is no match in the
- rest of the string, in which case the rest of the string is
- copied verbatim. */
-
- if (matchpos == -2)
- m4_error (context, 0, 0, caller,
- _("problem matching regular expression %s"),
- quotearg_style_mem (locale_quoting_style, regexp,
- regexp_len));
- else if (offset < len && subst)
- obstack_grow (obs, victim + offset, len - offset);
- break;
- }
+ {
+
+ /* Match failed -- either error or there is no match in the
+ rest of the string, in which case the rest of the string is
+ copied verbatim. */
+
+ if (matchpos == -2)
+ m4_error (context, 0, 0, caller,
+ _("problem matching regular expression %s"),
+ quotearg_style_mem (locale_quoting_style, regexp,
+ regexp_len));
+ else if (offset < len && subst)
+ obstack_grow (obs, victim + offset, len - offset);
+ break;
+ }
/* Copy the part of the string that was skipped by re_search (). */
if (matchpos > offset)
- obstack_grow (obs, victim + offset, matchpos - offset);
+ obstack_grow (obs, victim + offset, matchpos - offset);
/* Handle the part of the string that was covered by the match. */
@@ -337,16 +337,16 @@ regexp_substitute (m4 *context, m4_obstack *obs, const m4_call_info *caller,
subst = true;
/* Update the offset to the end of the match. If the regexp
- matched a null string, advance offset one more, to avoid
- infinite loops. */
+ matched a null string, advance offset one more, to avoid
+ infinite loops. */
offset = buf->regs.end[0];
if (buf->regs.start[0] == buf->regs.end[0])
- {
- if (offset < len)
- obstack_1grow (obs, victim[offset]);
- offset++;
- }
+ {
+ if (offset < len)
+ obstack_1grow (obs, victim[offset]);
+ offset++;
+ }
}
return subst;
@@ -360,11 +360,11 @@ M4FINISH_HANDLER(gnu)
for (i = 0; i < REGEX_CACHE_SIZE; i++)
if (regex_cache[i].str)
{
- free (regex_cache[i].str);
- regfree (regex_cache[i].pat);
- free (regex_cache[i].pat);
- free (regex_cache[i].regs.start);
- free (regex_cache[i].regs.end);
+ free (regex_cache[i].str);
+ regfree (regex_cache[i].pat);
+ free (regex_cache[i].pat);
+ free (regex_cache[i].regs.start);
+ free (regex_cache[i].regs.end);
}
/* If this module was preloaded, then we need to explicitly reset
the memory in case it gets reloaded. */
@@ -379,7 +379,7 @@ M4FINISH_HANDLER(gnu)
M4BUILTIN_HANDLER (__file__)
{
m4_shipout_string (context, obs, m4_get_current_file (context), SIZE_MAX,
- true);
+ true);
}
@@ -423,55 +423,55 @@ M4BUILTIN_HANDLER (builtin)
{
assert (m4_is_arg_func (argv, 1));
if (m4_arg_func (argv, 1) == builtin_builtin)
- {
- if (m4_bad_argc (context, argc, me, 2, 2, false))
- return;
- if (!m4_is_arg_text (argv, 2))
- {
- m4_warn (context, 0, me, _("invalid macro name ignored"));
- return;
- }
- name = M4ARG (2);
- len = M4ARGLEN (2);
- if (len == strlen (name))
- value = m4_builtin_find_by_name (NULL, name);
- if (value)
- {
- m4_push_builtin (context, obs, value);
- free (value);
- }
- else if (m4_is_debug_bit (context, M4_DEBUG_TRACE_DEREF))
- m4_warn (context, 0, me, _("undefined builtin %s"),
- quotearg_style_mem (locale_quoting_style, name, len));
- }
+ {
+ if (m4_bad_argc (context, argc, me, 2, 2, false))
+ return;
+ if (!m4_is_arg_text (argv, 2))
+ {
+ m4_warn (context, 0, me, _("invalid macro name ignored"));
+ return;
+ }
+ name = M4ARG (2);
+ len = M4ARGLEN (2);
+ if (len == strlen (name))
+ value = m4_builtin_find_by_name (NULL, name);
+ if (value)
+ {
+ m4_push_builtin (context, obs, value);
+ free (value);
+ }
+ else if (m4_is_debug_bit (context, M4_DEBUG_TRACE_DEREF))
+ m4_warn (context, 0, me, _("undefined builtin %s"),
+ quotearg_style_mem (locale_quoting_style, name, len));
+ }
else
- m4_warn (context, 0, me, _("invalid macro name ignored"));
+ m4_warn (context, 0, me, _("invalid macro name ignored"));
}
else
{
name = M4ARG (1);
len = M4ARGLEN (1);
if (len == strlen (name))
- value = m4_builtin_find_by_name (NULL, name);
+ value = m4_builtin_find_by_name (NULL, name);
if (value == NULL)
- {
- if (m4_is_debug_bit (context, M4_DEBUG_TRACE_DEREF))
- m4_warn (context, 0, me, _("undefined builtin %s"),
- quotearg_style_mem (locale_quoting_style, name, len));
- }
+ {
+ if (m4_is_debug_bit (context, M4_DEBUG_TRACE_DEREF))
+ m4_warn (context, 0, me, _("undefined builtin %s"),
+ quotearg_style_mem (locale_quoting_style, name, len));
+ }
else
- {
- const m4_builtin *bp = m4_get_symbol_value_builtin (value);
- m4_macro_args *new_argv;
- bool flatten = (bp->flags & M4_BUILTIN_FLATTEN_ARGS) != 0;
- new_argv = m4_make_argv_ref (context, argv, name, len, flatten,
- false);
- if (!m4_bad_argc (context, argc - 1, m4_arg_info (new_argv),
- bp->min_args, bp->max_args,
- (bp->flags & M4_BUILTIN_SIDE_EFFECT) != 0))
- bp->func (context, obs, argc - 1, new_argv);
- free (value);
- }
+ {
+ const m4_builtin *bp = m4_get_symbol_value_builtin (value);
+ m4_macro_args *new_argv;
+ bool flatten = (bp->flags & M4_BUILTIN_FLATTEN_ARGS) != 0;
+ new_argv = m4_make_argv_ref (context, argv, name, len, flatten,
+ false);
+ if (!m4_bad_argc (context, argc - 1, m4_arg_info (new_argv),
+ bp->min_args, bp->max_args,
+ (bp->flags & M4_BUILTIN_SIDE_EFFECT) != 0))
+ bp->func (context, obs, argc - 1, new_argv);
+ free (value);
+ }
}
}
@@ -482,7 +482,7 @@ M4BUILTIN_HANDLER (builtin)
static int
m4_resyntax_encode_safe (m4 *context, const m4_call_info *caller,
- const char *spec, size_t len)
+ const char *spec, size_t len)
{
int resyntax;
@@ -493,7 +493,7 @@ m4_resyntax_encode_safe (m4 *context, const m4_call_info *caller,
if (resyntax < 0)
m4_warn (context, 0, caller, _("bad syntax-spec: %s"),
- quotearg_style_mem (locale_quoting_style, spec, len));
+ quotearg_style_mem (locale_quoting_style, spec, len));
return resyntax;
}
@@ -505,7 +505,7 @@ m4_resyntax_encode_safe (m4 *context, const m4_call_info *caller,
M4BUILTIN_HANDLER (changeresyntax)
{
int resyntax = m4_resyntax_encode_safe (context, m4_arg_info (argv),
- M4ARG (1), M4ARGLEN (1));
+ M4ARG (1), M4ARGLEN (1));
if (resyntax >= 0)
m4_set_regexp_syntax_opt (context, resyntax);
@@ -529,43 +529,43 @@ M4BUILTIN_HANDLER (changesyntax)
{
size_t i;
for (i = 1; i < argc; i++)
- {
- size_t len = M4ARGLEN (i);
- const char *spec;
- char key;
- char action;
-
- if (!len)
- {
- m4_reset_syntax (M4SYNTAX);
- continue;
- }
- spec = M4ARG (i);
- key = *spec++;
- len--;
- action = len ? *spec : '\0';
- switch (action)
- {
- case '-':
- case '+':
- case '=':
- spec++;
- len--;
- break;
- case '\0':
- if (!len)
- break;
- /* fall through */
- default:
- action = '=';
- break;
- }
- if (len)
- spec = m4_expand_ranges (spec, &len, m4_arg_scratch (context));
- if (m4_set_syntax (M4SYNTAX, key, action, spec, len) < 0)
- m4_warn (context, 0, me, _("undefined syntax code: %s"),
- quotearg_style_mem (locale_quoting_style, &key, 1));
- }
+ {
+ size_t len = M4ARGLEN (i);
+ const char *spec;
+ char key;
+ char action;
+
+ if (!len)
+ {
+ m4_reset_syntax (M4SYNTAX);
+ continue;
+ }
+ spec = M4ARG (i);
+ key = *spec++;
+ len--;
+ action = len ? *spec : '\0';
+ switch (action)
+ {
+ case '-':
+ case '+':
+ case '=':
+ spec++;
+ len--;
+ break;
+ case '\0':
+ if (!len)
+ break;
+ /* fall through */
+ default:
+ action = '=';
+ break;
+ }
+ if (len)
+ spec = m4_expand_ranges (spec, &len, m4_arg_scratch (context));
+ if (m4_set_syntax (M4SYNTAX, key, action, spec, len) < 0)
+ m4_warn (context, 0, me, _("undefined syntax code: %s"),
+ quotearg_style_mem (locale_quoting_style, &key, 1));
+ }
}
else
assert (!"Unable to import from m4 module");
@@ -591,11 +591,11 @@ M4BUILTIN_HANDLER (debugfile)
const char *str = M4ARG (1);
size_t len = M4ARGLEN (1);
if (strlen (str) < len)
- m4_warn (context, 0, me, _("argument %s truncated"),
- quotearg_style_mem (locale_quoting_style, str, len));
+ m4_warn (context, 0, me, _("argument %s truncated"),
+ quotearg_style_mem (locale_quoting_style, str, len));
if (!m4_debug_set_output (context, me, str))
- m4_warn (context, errno, me, _("cannot set debug file %s"),
- quotearg_style (locale_quoting_style, str));
+ m4_warn (context, errno, me, _("cannot set debug file %s"),
+ quotearg_style (locale_quoting_style, str));
}
}
@@ -611,7 +611,7 @@ M4BUILTIN_HANDLER (debuglen)
int i;
size_t s;
if (!m4_numeric_arg (context, m4_arg_info (argv), M4ARG (1), M4ARGLEN (1),
- &i))
+ &i))
return;
/* FIXME - make m4_numeric_arg more powerful - we want to accept
suffixes, and limit the result to size_t. */
@@ -634,8 +634,8 @@ M4BUILTIN_HANDLER (debugmode)
m4_set_debug_level_opt (context, 0);
else if (m4_debug_decode (context, mode, len) < 0)
m4_warn (context, 0, m4_arg_info (argv),
- _("bad debug flags: %s"),
- quotearg_style_mem (locale_quoting_style, mode, len));
+ _("bad debug flags: %s"),
+ quotearg_style_mem (locale_quoting_style, mode, len));
}
@@ -665,87 +665,87 @@ M4BUILTIN_HANDLER (esyscmd)
const char *caller;
if (m4_get_safer_opt (context))
- {
- m4_error (context, 0, 0, me, _("disabled by --safer"));
- return;
- }
+ {
+ m4_error (context, 0, 0, me, _("disabled by --safer"));
+ return;
+ }
if (strlen (cmd) != len)
- m4_warn (context, 0, me, _("argument %s truncated"),
- quotearg_style_mem (locale_quoting_style, cmd, len));
+ m4_warn (context, 0, me, _("argument %s truncated"),
+ quotearg_style_mem (locale_quoting_style, cmd, len));
/* Optimize the empty command. */
if (!*cmd)
- {
- m4_set_sysval (0);
- return;
- }
+ {
+ m4_set_sysval (0);
+ return;
+ }
m4_sysval_flush (context, false);
#if W32_NATIVE
if (strstr (M4_SYSCMD_SHELL, "cmd"))
- {
- prog_args[0] = "cmd";
- prog_args[1] = "/c";
- }
+ {
+ prog_args[0] = "cmd";
+ prog_args[1] = "/c";
+ }
#endif
prog_args[2] = cmd;
caller = m4_info_name (me);
errno = 0;
child = create_pipe_in (caller, M4_SYSCMD_SHELL, (char **) prog_args,
- NULL, false, true, false, &fd);
+ NULL, false, true, false, &fd);
if (child == -1)
- {
- m4_error (context, 0, errno, me, _("cannot run command %s"),
- quotearg_style (locale_quoting_style, cmd));
- m4_set_sysval (127);
- return;
- }
+ {
+ m4_error (context, 0, errno, me, _("cannot run command %s"),
+ quotearg_style (locale_quoting_style, cmd));
+ m4_set_sysval (127);
+ return;
+ }
pin = fdopen (fd, "r");
if (!pin)
- {
- m4_error (context, 0, errno, me, _("cannot run command %s"),
- quotearg_style (locale_quoting_style, cmd));
- m4_set_sysval (127);
- close (fd);
- return;
- }
+ {
+ m4_error (context, 0, errno, me, _("cannot run command %s"),
+ quotearg_style (locale_quoting_style, cmd));
+ m4_set_sysval (127);
+ close (fd);
+ return;
+ }
while (1)
- {
- size_t avail = obstack_room (obs);
- if (!avail)
- {
- int ch = getc (pin);
- if (ch == EOF)
- break;
- obstack_1grow (obs, ch);
- }
- else
- {
- size_t len = fread (obstack_next_free (obs), 1, avail, pin);
- if (len <= 0)
- break;
- obstack_blank_fast (obs, len);
- }
- }
+ {
+ size_t avail = obstack_room (obs);
+ if (!avail)
+ {
+ int ch = getc (pin);
+ if (ch == EOF)
+ break;
+ obstack_1grow (obs, ch);
+ }
+ else
+ {
+ size_t len = fread (obstack_next_free (obs), 1, avail, pin);
+ if (len <= 0)
+ break;
+ obstack_blank_fast (obs, len);
+ }
+ }
if (ferror (pin) || fclose (pin))
- m4_error (context, EXIT_FAILURE, errno, me,
- _("cannot read pipe to command %s"),
- quotearg_style (locale_quoting_style, cmd));
+ m4_error (context, EXIT_FAILURE, errno, me,
+ _("cannot read pipe to command %s"),
+ quotearg_style (locale_quoting_style, cmd));
errno = 0;
status = wait_subprocess (child, caller, false, true, true, false,
- &sig_status);
+ &sig_status);
if (sig_status)
- {
- assert (status == 127);
- m4_set_sysval (sig_status << 8);
- }
+ {
+ assert (status == 127);
+ m4_set_sysval (sig_status << 8);
+ }
else
- {
- if (status == 127 && errno)
- m4_error (context, 0, errno, me, _("cannot run command %s"),
- quotearg_style (locale_quoting_style, cmd));
- m4_set_sysval (status);
- }
+ {
+ if (status == 127 && errno)
+ m4_error (context, 0, errno, me, _("cannot run command %s"),
+ quotearg_style (locale_quoting_style, cmd));
+ m4_set_sysval (status);
+ }
}
else
assert (!"Unable to import from m4 module");
@@ -785,21 +785,21 @@ M4BUILTIN_HANDLER (indir)
m4_symbol *symbol = m4_symbol_lookup (M4SYMTAB, name, len);
if (symbol == NULL)
- {
- if (m4_is_debug_bit (context, M4_DEBUG_TRACE_DEREF))
- m4_warn (context, 0, me, _("undefined macro %s"),
- quotearg_style_mem (locale_quoting_style, name, len));
- }
+ {
+ if (m4_is_debug_bit (context, M4_DEBUG_TRACE_DEREF))
+ m4_warn (context, 0, me, _("undefined macro %s"),
+ quotearg_style_mem (locale_quoting_style, name, len));
+ }
else
- {
- m4_macro_args *new_argv;
- m4_symbol_value *value = m4_get_symbol_value (symbol);
- new_argv = m4_make_argv_ref (context, argv, name, len,
- m4_symbol_flatten_args (symbol),
- m4_get_symbol_traced (symbol));
- m4_trace_prepare (context, m4_arg_info (new_argv), value);
- m4_macro_call (context, value, obs, new_argv);
- }
+ {
+ m4_macro_args *new_argv;
+ m4_symbol_value *value = m4_get_symbol_value (symbol);
+ new_argv = m4_make_argv_ref (context, argv, name, len,
+ m4_symbol_flatten_args (symbol),
+ m4_get_symbol_traced (symbol));
+ m4_trace_prepare (context, m4_arg_info (new_argv), value);
+ m4_macro_call (context, value, obs, new_argv);
+ }
}
}
@@ -815,7 +815,7 @@ M4BUILTIN_HANDLER (mkdtemp)
if (m4_make_temp)
m4_make_temp (context, obs, m4_arg_info (argv), M4ARG (1), M4ARGLEN (1),
- true);
+ true);
else
assert (!"Unable to import from m4 module");
}
@@ -843,9 +843,9 @@ M4BUILTIN_HANDLER (patsubst)
if (argc >= 5) /* additional args ignored */
{
resyntax = m4_resyntax_encode_safe (context, me, M4ARG (4),
- M4ARGLEN (4));
+ M4ARGLEN (4));
if (resyntax < 0)
- return;
+ return;
}
/* The empty regex matches everywhere, but if there is no
@@ -864,7 +864,7 @@ M4BUILTIN_HANDLER (patsubst)
return;
regexp_substitute (context, obs, me, M4ARG (1), M4ARGLEN (1), pattern,
- M4ARGLEN (2), buf, replace, M4ARGLEN (3), false);
+ M4ARGLEN (2), buf, replace, M4ARGLEN (3), false);
}
@@ -898,23 +898,23 @@ M4BUILTIN_HANDLER (regexp)
resyntax = m4_regexp_syntax_encode (replace);
/* The first case is the most difficult, because the empty string
- is a valid RESYNTAX, yet we want `regexp(aab, a*, )' to return
- an empty string as per M4 1.4.x. */
+ is a valid RESYNTAX, yet we want `regexp(aab, a*, )' to return
+ an empty string as per M4 1.4.x. */
if (m4_arg_empty (argv, 3) || (resyntax < 0))
- /* regexp(VICTIM, REGEXP, REPLACEMENT) */
- resyntax = m4_get_regexp_syntax_opt (context);
+ /* regexp(VICTIM, REGEXP, REPLACEMENT) */
+ resyntax = m4_get_regexp_syntax_opt (context);
else
- /* regexp(VICTIM, REGEXP, RESYNTAX) */
- replace = NULL;
+ /* regexp(VICTIM, REGEXP, RESYNTAX) */
+ replace = NULL;
}
else if (argc >= 5)
{
/* regexp(VICTIM, REGEXP, REPLACEMENT, RESYNTAX) */
resyntax = m4_resyntax_encode_safe (context, me, M4ARG (4),
- M4ARGLEN (4));
+ M4ARGLEN (4));
if (resyntax < 0)
- return;
+ return;
}
else
/* regexp(VICTIM, REGEXP) */
@@ -924,9 +924,9 @@ M4BUILTIN_HANDLER (regexp)
{
/* The empty regex matches everything. */
if (replace)
- substitute (context, obs, me, M4ARG (1), replace, M4ARGLEN (3), NULL);
+ substitute (context, obs, me, M4ARG (1), replace, M4ARGLEN (3), NULL);
else
- m4_shipout_int (obs, 0);
+ m4_shipout_int (obs, 0);
return;
}
@@ -941,8 +941,8 @@ M4BUILTIN_HANDLER (regexp)
if (startpos == -2)
{
m4_error (context, 0, 0, me, _("problem matching regular expression %s"),
- quotearg_style_mem (locale_quoting_style, pattern,
- M4ARGLEN (2)));
+ quotearg_style_mem (locale_quoting_style, pattern,
+ M4ARGLEN (2)));
return;
}
@@ -984,33 +984,33 @@ M4BUILTIN_HANDLER (renamesyms)
resyntax = m4_get_regexp_syntax_opt (context);
if (argc >= 4)
- {
- resyntax = m4_resyntax_encode_safe (context, me, M4ARG (3),
- M4ARGLEN (3));
- if (resyntax < 0)
- return;
- }
+ {
+ resyntax = m4_resyntax_encode_safe (context, me, M4ARG (3),
+ M4ARGLEN (3));
+ if (resyntax < 0)
+ return;
+ }
buf = regexp_compile (context, me, regexp, regexp_len, resyntax);
if (!buf)
- return;
+ return;
data.obs = m4_arg_scratch (context);
m4_dump_symbols (context, &data, 1, argv, false);
for (; data.size > 0; --data.size, data.base++)
- {
- const m4_string *key = &data.base[0];
-
- if (regexp_substitute (context, data.obs, me, key->str, key->len,
- regexp, regexp_len, buf, replace, replace_len,
- true))
- {
- size_t newlen = obstack_object_size (data.obs);
- m4_symbol_rename (M4SYMTAB, key->str, key->len,
- (char *) obstack_finish (data.obs), newlen);
- }
- }
+ {
+ const m4_string *key = &data.base[0];
+
+ if (regexp_substitute (context, data.obs, me, key->str, key->len,
+ regexp, regexp_len, buf, replace, replace_len,
+ true))
+ {
+ size_t newlen = obstack_object_size (data.obs);
+ m4_symbol_rename (M4SYMTAB, key->str, key->len,
+ (char *) obstack_finish (data.obs), newlen);
+ }
+ }
}
else
assert (!"Unable to import from m4 module");
@@ -1035,12 +1035,12 @@ M4BUILTIN_HANDLER (m4symbols)
m4_dump_symbols (context, &data, argc, argv, false);
for (; data.size > 0; --data.size, data.base++)
- {
- m4_shipout_string (context, obs, data.base->str, data.base->len,
- true);
- if (data.size > 1)
- obstack_1grow (obs, ',');
- }
+ {
+ m4_shipout_string (context, obs, data.base->str, data.base->len,
+ true);
+ if (data.size > 1)
+ obstack_1grow (obs, ',');
+ }
}
else
assert (!"Unable to import from m4 module");
@@ -1059,6 +1059,6 @@ M4BUILTIN_HANDLER (syncoutput)
{
bool value = m4_get_syncoutput_opt (context);
value = m4_parse_truth_arg (context, m4_arg_info (argv), M4ARG (1),
- M4ARGLEN (1), value);
+ M4ARGLEN (1), value);
m4_set_syncoutput_opt (context, value);
}
diff --git a/modules/load.c b/modules/load.c
index ccd6548c..248ebf18 100644
--- a/modules/load.c
+++ b/modules/load.c
@@ -33,7 +33,7 @@
/* Maintain each of the builtins implemented in this modules along
with their details in a single table for easy maintenance.
- function macros blind side minargs maxargs */
+ function macros blind side minargs maxargs */
#define builtin_functions \
BUILTIN (load, false, true, false, 1, 1 ) \
BUILTIN (m4modules, false, false, false, 0, 0 ) \
@@ -77,7 +77,7 @@ M4INIT_HANDLER (load)
const char *err = m4_module_makeresident (module);
if (err)
m4_error (context, 0, 0, NULL, _("cannot make module `%s' resident: %s"),
- m4_get_module_name (module), err);
+ m4_get_module_name (module), err);
}
@@ -98,11 +98,11 @@ M4BUILTIN_HANDLER (m4modules)
if (module)
do
{
- m4_shipout_string (context, obs, m4_get_module_name (module), SIZE_MAX,
- true);
+ m4_shipout_string (context, obs, m4_get_module_name (module), SIZE_MAX,
+ true);
- if ((module = m4__module_next (module)))
- obstack_1grow (obs, ',');
+ if ((module = m4__module_next (module)))
+ obstack_1grow (obs, ',');
}
while (module);
}
diff --git a/modules/m4.c b/modules/m4.c
index 60d7b6e3..a2e7423e 100644
--- a/modules/m4.c
+++ b/modules/m4.c
@@ -50,15 +50,15 @@
extern void m4_set_sysval (int);
extern void m4_sysval_flush (m4 *, bool);
extern void m4_dump_symbols (m4 *, m4_dump_symbol_data *, size_t,
- m4_macro_args *, bool);
+ m4_macro_args *, bool);
extern const char *m4_expand_ranges (const char *, size_t *, m4_obstack *);
extern void m4_make_temp (m4 *, m4_obstack *, const m4_call_info *,
- const char *, size_t, bool);
+ const char *, size_t, bool);
/* Maintain each of the builtins implemented in this modules along
with their details in a single table for easy maintenance.
- function macros blind side minargs maxargs */
+ function macros blind side minargs maxargs */
#define builtin_functions \
BUILTIN (changecom, false, false, false, 0, 2 ) \
BUILTIN (changequote, false, false, false, 0, 2 ) \
@@ -99,13 +99,13 @@ typedef intmax_t number;
typedef uintmax_t unumber;
static void include (m4 *context, int argc, m4_macro_args *argv,
- bool silent);
+ bool silent);
static int dumpdef_cmp_CB (const void *s1, const void *s2);
static void * dump_symbol_CB (m4_symbol_table *, const char *, size_t,
- m4_symbol *symbol, void *userdata);
+ m4_symbol *symbol, void *userdata);
static const char *ntoa (number value, int radix);
static void numb_obstack (m4_obstack *obs, number value,
- int radix, int min);
+ int radix, int min);
/* Generate prototypes for each builtin handler function. */
@@ -136,7 +136,7 @@ M4INIT_HANDLER (m4)
const char *err = m4_module_makeresident (module);
if (err)
m4_error (context, 0, 0, NULL, _("cannot make module `%s' resident: %s"),
- m4_get_module_name (module), err);
+ m4_get_module_name (module), err);
}
@@ -144,7 +144,7 @@ M4INIT_HANDLER (m4)
/* The rest of this file is code for builtins and expansion of user
defined macros. All the functions for builtins have a prototype as:
- void builtin_MACRONAME (m4_obstack *obs, int argc, char *argv[]);
+ void builtin_MACRONAME (m4_obstack *obs, int argc, char *argv[]);
The function are expected to leave their expansion on the obstack OBS,
as an unfinished object. ARGV is a table of ARGC pointers to the
@@ -160,7 +160,7 @@ M4BUILTIN_HANDLER (define)
m4_symbol_value *value = m4_symbol_value_create ();
if (m4_symbol_value_copy (context, value, m4_arg_symbol (argv, 2)))
- m4_warn (context, 0, me, _("cannot concatenate builtins"));
+ m4_warn (context, 0, me, _("cannot concatenate builtins"));
m4_symbol_define (M4SYMTAB, M4ARG (1), M4ARGLEN (1), value);
}
else
@@ -184,7 +184,7 @@ M4BUILTIN_HANDLER (pushdef)
m4_symbol_value *value = m4_symbol_value_create ();
if (m4_symbol_value_copy (context, value, m4_arg_symbol (argv, 2)))
- m4_warn (context, 0, me, _("cannot concatenate builtins"));
+ m4_warn (context, 0, me, _("cannot concatenate builtins"));
m4_symbol_pushdef (M4SYMTAB, M4ARG (1), M4ARGLEN (1), value);
}
else
@@ -207,7 +207,7 @@ M4BUILTIN_HANDLER (popdef)
M4BUILTIN_HANDLER (ifdef)
{
m4_push_arg (context, obs, argv,
- m4_symbol_value_lookup (context, argv, 1, false) ? 2 : 3);
+ m4_symbol_value_lookup (context, argv, 1, false) ? 2 : 3);
}
M4BUILTIN_HANDLER (ifelse)
@@ -229,24 +229,24 @@ M4BUILTIN_HANDLER (ifelse)
while (true)
{
if (m4_arg_equal (context, argv, i, i + 1))
- {
- m4_push_arg (context, obs, argv, i + 2);
- return;
- }
+ {
+ m4_push_arg (context, obs, argv, i + 2);
+ return;
+ }
switch (argc)
- {
- case 3:
- return;
-
- case 4:
- case 5:
- m4_push_arg (context, obs, argv, i + 3);
- return;
-
- default:
- argc -= 3;
- i += 3;
- }
+ {
+ case 3:
+ return;
+
+ case 4:
+ case 5:
+ m4_push_arg (context, obs, argv, i + 3);
+ return;
+
+ default:
+ argc -= 3;
+ i += 3;
+ }
}
}
@@ -264,7 +264,7 @@ dumpdef_cmp_CB (const void *s1, const void *s2)
table of all defined symbol names. */
static void *
dump_symbol_CB (m4_symbol_table *ignored M4_GNUC_UNUSED, const char *name,
- size_t len, m4_symbol *symbol, void *userdata)
+ size_t len, m4_symbol *symbol, void *userdata)
{
m4_dump_symbol_data *symbol_data = (m4_dump_symbol_data *) userdata;
m4_string *key;
@@ -279,7 +279,7 @@ dump_symbol_CB (m4_symbol_table *ignored M4_GNUC_UNUSED, const char *name,
size_t offset = obstack_object_size (symbol_data->obs);
obstack_blank (symbol_data->obs, sizeof *symbol_data->base);
symbol_data->size = (obstack_room (symbol_data->obs)
- / sizeof *symbol_data->base);
+ / sizeof *symbol_data->base);
base = (char *) obstack_base (symbol_data->obs) + offset;
symbol_data->base = (m4_string *) base;
}
@@ -300,7 +300,7 @@ dump_symbol_CB (m4_symbol_table *ignored M4_GNUC_UNUSED, const char *name,
symbols, otherwise, only the specified symbols. */
void
m4_dump_symbols (m4 *context, m4_dump_symbol_data *data, size_t argc,
- m4_macro_args *argv, bool complain)
+ m4_macro_args *argv, bool complain)
{
assert (obstack_object_size (data->obs) == 0);
data->size = obstack_room (data->obs) / sizeof *data->base;
@@ -314,18 +314,18 @@ m4_dump_symbols (m4 *context, m4_dump_symbol_data *data, size_t argc,
m4_symbol *symbol;
for (i = 1; i < argc; i++)
- {
- symbol = m4_symbol_value_lookup (context, argv, i, complain);
- if (symbol)
- dump_symbol_CB (NULL, M4ARG (i), M4ARGLEN (i), symbol, data);
- }
+ {
+ symbol = m4_symbol_value_lookup (context, argv, i, complain);
+ if (symbol)
+ dump_symbol_CB (NULL, M4ARG (i), M4ARGLEN (i), symbol, data);
+ }
}
data->size = obstack_object_size (data->obs) / sizeof *data->base;
data->base = (m4_string *) obstack_finish (data->obs);
/* Safe to cast away const, since we don't modify entries. */
qsort ((m4_string *) data->base, data->size, sizeof *data->base,
- dumpdef_cmp_CB);
+ dumpdef_cmp_CB);
}
@@ -339,7 +339,7 @@ M4BUILTIN_HANDLER (dumpdef)
size_t arg_length = m4_get_max_debug_arg_length_opt (context);
bool module = m4_is_debug_bit (context, M4_DEBUG_TRACE_MODULE);
FILE *output = (m4_is_debug_bit (context, M4_DEBUG_TRACE_OUTPUT_DUMPDEF)
- ? stderr : m4_get_debug_file (context));
+ ? stderr : m4_get_debug_file (context));
if (!output)
return;
@@ -352,7 +352,7 @@ M4BUILTIN_HANDLER (dumpdef)
for (; data.size > 0; --data.size, data.base++)
{
m4_symbol *symbol = m4_symbol_lookup (M4SYMTAB, data.base->str,
- data.base->len);
+ data.base->len);
char *value;
size_t len;
assert (symbol);
@@ -362,7 +362,7 @@ M4BUILTIN_HANDLER (dumpdef)
obstack_1grow (obs, ':');
obstack_1grow (obs, '\t');
m4_symbol_print (context, symbol, obs, quotes, stack, arg_length,
- module);
+ module);
obstack_1grow (obs, '\n');
len = obstack_object_size (obs);
value = (char *) obstack_finish (obs);
@@ -384,23 +384,23 @@ M4BUILTIN_HANDLER (defn)
m4_symbol *symbol = m4_symbol_value_lookup (context, argv, i, true);
if (!symbol)
- ;
+ ;
else if (m4_is_symbol_text (symbol))
- m4_shipout_string (context, obs, m4_get_symbol_text (symbol),
- m4_get_symbol_len (symbol), true);
+ m4_shipout_string (context, obs, m4_get_symbol_text (symbol),
+ m4_get_symbol_len (symbol), true);
else if (m4_is_symbol_func (symbol))
- m4_push_builtin (context, obs, m4_get_symbol_value (symbol));
+ m4_push_builtin (context, obs, m4_get_symbol_value (symbol));
else if (m4_is_symbol_placeholder (symbol))
- m4_warn (context, 0, me,
- _("%s: builtin %s requested by frozen file not found"),
- quotearg_n_mem (2, M4ARG (i), M4ARGLEN (i)),
- quotearg_style (locale_quoting_style,
- m4_get_symbol_placeholder (symbol)));
+ m4_warn (context, 0, me,
+ _("%s: builtin %s requested by frozen file not found"),
+ quotearg_n_mem (2, M4ARG (i), M4ARGLEN (i)),
+ quotearg_style (locale_quoting_style,
+ m4_get_symbol_placeholder (symbol)));
else
- {
- assert (!"Bad token data type in m4_defn");
- abort ();
- }
+ {
+ assert (!"Bad token data type in m4_defn");
+ abort ();
+ }
}
}
@@ -487,7 +487,7 @@ M4BUILTIN_HANDLER (syscmd)
}
if (strlen (cmd) != len)
m4_warn (context, 0, me, _("argument %s truncated"),
- quotearg_style_mem (locale_quoting_style, cmd, len));
+ quotearg_style_mem (locale_quoting_style, cmd, len));
/* Optimize the empty command. */
if (!*cmd)
@@ -506,7 +506,7 @@ M4BUILTIN_HANDLER (syscmd)
prog_args[2] = cmd;
errno = 0;
status = execute (m4_info_name (me), M4_SYSCMD_SHELL, (char **) prog_args,
- false, false, false, false, true, false, &sig_status);
+ false, false, false, false, true, false, &sig_status);
if (sig_status)
{
assert (status == 127);
@@ -515,8 +515,8 @@ M4BUILTIN_HANDLER (syscmd)
else
{
if (status == 127 && errno)
- m4_warn (context, errno, me, _("cannot run command %s"),
- quotearg_style (locale_quoting_style, cmd));
+ m4_warn (context, errno, me, _("cannot run command %s"),
+ quotearg_style (locale_quoting_style, cmd));
m4_sysval = status;
}
}
@@ -533,7 +533,7 @@ M4BUILTIN_HANDLER (incr)
int value;
if (!m4_numeric_arg (context, m4_arg_info (argv), M4ARG (1), M4ARGLEN (1),
- &value))
+ &value))
return;
m4_shipout_int (obs, value + 1);
@@ -544,7 +544,7 @@ M4BUILTIN_HANDLER (decr)
int value;
if (!m4_numeric_arg (context, m4_arg_info (argv), M4ARG (1), M4ARGLEN (1),
- &value))
+ &value))
return;
m4_shipout_int (obs, value - 1);
@@ -561,11 +561,11 @@ M4BUILTIN_HANDLER (divert)
int i = 0;
if (argc >= 2 && !m4_numeric_arg (context, m4_arg_info (argv), M4ARG (1),
- M4ARGLEN (1), &i))
+ M4ARGLEN (1), &i))
return;
m4_make_diversion (context, i);
m4_divert_text (context, NULL, M4ARG (2), M4ARGLEN (2),
- m4_get_current_line (context));
+ m4_get_current_line (context));
}
/* Expand to the current diversion number. */
@@ -589,32 +589,32 @@ M4BUILTIN_HANDLER (undivert)
else
for (i = 1; i < argc; i++)
{
- const char *str = M4ARG (i);
- size_t len = M4ARGLEN (i);
- char *endp;
- int diversion = strtol (str, &endp, 10);
- if (endp - str == len && !isspace ((unsigned char) *str))
- m4_insert_diversion (context, diversion);
- else if (m4_get_posixly_correct_opt (context))
- m4_warn (context, 0, me, _("non-numeric argument %s"),
- quotearg_style_mem (locale_quoting_style, str, len));
- else if (strlen (str) != len)
- m4_warn (context, 0, me, _("invalid file name %s"),
- quotearg_style_mem (locale_quoting_style, str, len));
- else
- {
- FILE *fp = m4_path_search (context, str, NULL);
- if (fp != NULL)
- {
- m4_insert_file (context, fp);
- if (fclose (fp) == EOF)
- m4_error (context, 0, errno, me, _("error undiverting %s"),
- quotearg_style (locale_quoting_style, str));
- }
- else
- m4_error (context, 0, errno, me, _("cannot undivert %s"),
- quotearg_style (locale_quoting_style, str));
- }
+ const char *str = M4ARG (i);
+ size_t len = M4ARGLEN (i);
+ char *endp;
+ int diversion = strtol (str, &endp, 10);
+ if (endp - str == len && !isspace ((unsigned char) *str))
+ m4_insert_diversion (context, diversion);
+ else if (m4_get_posixly_correct_opt (context))
+ m4_warn (context, 0, me, _("non-numeric argument %s"),
+ quotearg_style_mem (locale_quoting_style, str, len));
+ else if (strlen (str) != len)
+ m4_warn (context, 0, me, _("invalid file name %s"),
+ quotearg_style_mem (locale_quoting_style, str, len));
+ else
+ {
+ FILE *fp = m4_path_search (context, str, NULL);
+ if (fp != NULL)
+ {
+ m4_insert_file (context, fp);
+ if (fclose (fp) == EOF)
+ m4_error (context, 0, errno, me, _("error undiverting %s"),
+ quotearg_style (locale_quoting_style, str));
+ }
+ else
+ m4_error (context, 0, errno, me, _("cannot undivert %s"),
+ quotearg_style (locale_quoting_style, str));
+ }
}
}
@@ -642,8 +642,8 @@ M4BUILTIN_HANDLER (shift)
M4BUILTIN_HANDLER (changequote)
{
m4_set_quotes (M4SYNTAX,
- (argc >= 2) ? M4ARG (1) : NULL, M4ARGLEN (1),
- (argc >= 3) ? M4ARG (2) : NULL, M4ARGLEN (2));
+ (argc >= 2) ? M4ARG (1) : NULL, M4ARGLEN (1),
+ (argc >= 3) ? M4ARG (2) : NULL, M4ARGLEN (2));
}
/* Change the current comment delimiters. The function set_comment ()
@@ -651,8 +651,8 @@ M4BUILTIN_HANDLER (changequote)
M4BUILTIN_HANDLER (changecom)
{
m4_set_comment (M4SYNTAX,
- (argc >= 2) ? M4ARG (1) : NULL, M4ARGLEN (1),
- (argc >= 3) ? M4ARG (2) : NULL, M4ARGLEN (2));
+ (argc >= 2) ? M4ARG (1) : NULL, M4ARGLEN (1),
+ (argc >= 3) ? M4ARG (2) : NULL, M4ARGLEN (2));
}
@@ -674,13 +674,13 @@ include (m4 *context, int argc, m4_macro_args *argv, bool silent)
if (strlen (arg) != len)
m4_warn (context, 0, me, _("argument %s truncated"),
- quotearg_style_mem (locale_quoting_style, arg, len));
+ quotearg_style_mem (locale_quoting_style, arg, len));
fp = m4_path_search (context, arg, &name);
if (fp == NULL)
{
if (!silent)
- m4_error (context, 0, errno, m4_arg_info (argv), _("cannot open %s"),
- quotearg_style (locale_quoting_style, arg));
+ m4_error (context, 0, errno, m4_arg_info (argv), _("cannot open %s"),
+ quotearg_style (locale_quoting_style, arg));
return;
}
@@ -709,7 +709,7 @@ M4BUILTIN_HANDLER (sinclude)
successful, output the quoted resulting name on OBS. */
void
m4_make_temp (m4 *context, m4_obstack *obs, const m4_call_info *caller,
- const char *pattern, size_t len, bool dir)
+ const char *pattern, size_t len, bool dir)
{
int fd;
int i;
@@ -730,7 +730,7 @@ m4_make_temp (m4 *context, m4_obstack *obs, const m4_call_info *caller,
if (strlen (pattern) < len)
{
m4_warn (context, 0, caller, _("argument %s truncated"),
- quotearg_style_mem (locale_quoting_style, pattern, len));
+ quotearg_style_mem (locale_quoting_style, pattern, len));
len = strlen (pattern);
}
obstack_grow (obs, pattern, len);
@@ -746,18 +746,18 @@ m4_make_temp (m4 *context, m4_obstack *obs, const m4_call_info *caller,
if (fd < 0)
{
/* This use of _() will need to change if xgettext ever changes
- its undocumented behavior of parsing both string options. */
+ its undocumented behavior of parsing both string options. */
m4_warn (context, errno, caller,
- _(dir ? "cannot create directory from template %s"
- : "cannot create file from template %s"),
- quotearg_style (locale_quoting_style, pattern));
+ _(dir ? "cannot create directory from template %s"
+ : "cannot create file from template %s"),
+ quotearg_style (locale_quoting_style, pattern));
obstack_free (obs, obstack_finish (obs));
}
else
{
if (!dir)
- close (fd);
+ close (fd);
/* Remove NUL, then finish quote. */
obstack_blank (obs, -1);
obstack_grow (obs, quotes->str2, quotes->len2);
@@ -772,31 +772,31 @@ M4BUILTIN_HANDLER (maketemp)
if (m4_get_posixly_correct_opt (context))
{
/* POSIX states "any trailing 'X' characters [are] replaced with
- the current process ID as a string", without referencing the
- file system. Horribly insecure, but we have to do it.
-
- For reference, Solaris m4 does:
- maketemp() -> `'
- maketemp(X) -> `X'
- maketemp(XX) -> `Xn', where n is last digit of pid
- maketemp(XXXXXXXX) -> `X00nnnnn', where nnnnn is 16-bit pid
+ the current process ID as a string", without referencing the
+ file system. Horribly insecure, but we have to do it.
+
+ For reference, Solaris m4 does:
+ maketemp() -> `'
+ maketemp(X) -> `X'
+ maketemp(XX) -> `Xn', where n is last digit of pid
+ maketemp(XXXXXXXX) -> `X00nnnnn', where nnnnn is 16-bit pid
*/
const char *str = M4ARG (1);
size_t len = M4ARGLEN (1);
size_t i;
m4_obstack *scratch = m4_arg_scratch (context);
size_t pid_len = obstack_printf (scratch, "%lu",
- (unsigned long) getpid ());
+ (unsigned long) getpid ());
char *pid = (char *) obstack_copy0 (scratch, "", 0);
for (i = len; i > 1; i--)
- if (str[i - 1] != 'X')
- break;
+ if (str[i - 1] != 'X')
+ break;
obstack_grow (obs, str, i);
if (len - i < pid_len)
- obstack_grow (obs, pid + pid_len - (len - i), len - i);
+ obstack_grow (obs, pid + pid_len - (len - i), len - i);
else
- obstack_printf (obs, "%.*d%s", len - i - pid_len, 0, pid);
+ obstack_printf (obs, "%.*d%s", len - i - pid_len, 0, pid);
}
else
m4_make_temp (context, obs, me, M4ARG (1), M4ARGLEN (1), false);
@@ -806,7 +806,7 @@ M4BUILTIN_HANDLER (maketemp)
M4BUILTIN_HANDLER (mkstemp)
{
m4_make_temp (context, obs, m4_arg_info (argv), M4ARG (1), M4ARGLEN (1),
- false);
+ false);
}
/* Print all arguments on standard error. */
@@ -840,7 +840,7 @@ M4BUILTIN_HANDLER (m4exit)
/* Warn on bad arguments, but still exit. */
if (argc >= 2 && !m4_numeric_arg (context, me, M4ARG (1), M4ARGLEN (1),
- &exit_code))
+ &exit_code))
exit_code = EXIT_FAILURE;
if (exit_code < 0 || exit_code > 255)
{
@@ -885,13 +885,13 @@ M4BUILTIN_HANDLER (traceon)
if (argc == 1)
m4_set_debug_level_opt (context, (m4_get_debug_level_opt (context)
- | M4_DEBUG_TRACE_ALL));
+ | M4_DEBUG_TRACE_ALL));
else
for (i = 1; i < argc; i++)
if (m4_is_arg_text (argv, i))
- m4_set_symbol_name_traced (M4SYMTAB, M4ARG (i), M4ARGLEN (i), true);
+ m4_set_symbol_name_traced (M4SYMTAB, M4ARG (i), M4ARGLEN (i), true);
else
- m4_warn (context, 0, me, _("invalid macro name ignored"));
+ m4_warn (context, 0, me, _("invalid macro name ignored"));
}
/* Disable tracing of all specified macros, or all, if none is specified. */
@@ -902,13 +902,13 @@ M4BUILTIN_HANDLER (traceoff)
if (argc == 1)
m4_set_debug_level_opt (context, (m4_get_debug_level_opt (context)
- & ~M4_DEBUG_TRACE_ALL));
+ & ~M4_DEBUG_TRACE_ALL));
else
for (i = 1; i < argc; i++)
if (m4_is_arg_text (argv, i))
- m4_set_symbol_name_traced (M4SYMTAB, M4ARG (i), M4ARGLEN (i), false);
+ m4_set_symbol_name_traced (M4SYMTAB, M4ARG (i), M4ARGLEN (i), false);
else
- m4_warn (context, 0, me, _("invalid macro name ignored"));
+ m4_warn (context, 0, me, _("invalid macro name ignored"));
}
@@ -935,14 +935,14 @@ M4BUILTIN_HANDLER (index)
int retval = -1;
if (!m4_arg_empty (argv, 3) && !m4_numeric_arg (context, m4_arg_info (argv),
- M4ARG (3), M4ARGLEN (3),
- &offset))
+ M4ARG (3), M4ARGLEN (3),
+ &offset))
return;
if (offset < 0)
{
offset += haystack_len;
if (offset < 0)
- offset = 0;
+ offset = 0;
}
else if (haystack_len < offset)
{
@@ -953,7 +953,7 @@ M4BUILTIN_HANDLER (index)
/* Rely on the optimizations guaranteed by gnulib's memmem
module. */
result = (char *) memmem (haystack + offset, haystack_len - offset, needle,
- M4ARGLEN (2));
+ M4ARGLEN (2));
if (result)
retval = result - haystack;
@@ -994,27 +994,27 @@ M4BUILTIN_HANDLER (substr)
else
{
if (!m4_numeric_arg (context, me, M4ARG (3), M4ARGLEN (3), &end))
- return;
+ return;
if (end < 0)
- end += length;
+ end += length;
else
- end += start;
+ end += start;
}
if (5 <= argc)
{
/* Replacement text provided. */
if (end < start)
- end = start;
+ end = start;
if (end < 0 || length < start)
- {
- m4_warn (context, 0, me, _("substring out of range"));
- return;
- }
+ {
+ m4_warn (context, 0, me, _("substring out of range"));
+ return;
+ }
if (start < 0)
- start = 0;
+ start = 0;
if (length < end)
- end = length;
+ end = length;
obstack_grow (obs, str, start);
m4_push_arg (context, obs, argv, 4);
obstack_grow (obs, str + end, length - end);
@@ -1053,27 +1053,27 @@ m4_expand_ranges (const char *s, size_t *len, m4_obstack *obs)
for ( ; s != end; from = *s++)
{
if (*s == '-')
- {
- if (++s == end)
- {
- /* trailing dash */
- obstack_1grow (obs, '-');
- break;
- }
- to = *s;
- if (from <= to)
- {
- while (from++ < to)
- obstack_1grow (obs, from);
- }
- else
- {
- while (--from >= to)
- obstack_1grow (obs, from);
- }
- }
+ {
+ if (++s == end)
+ {
+ /* trailing dash */
+ obstack_1grow (obs, '-');
+ break;
+ }
+ to = *s;
+ if (from <= to)
+ {
+ while (from++ < to)
+ obstack_1grow (obs, from);
+ }
+ else
+ {
+ while (--from >= to)
+ obstack_1grow (obs, from);
+ }
+ }
else
- obstack_1grow (obs, *s);
+ obstack_1grow (obs, *s);
}
*len = obstack_object_size (obs);
return (char *) obstack_finish (obs);
@@ -1121,15 +1121,15 @@ M4BUILTIN_HANDLER (translit)
int second = from[from_len / 2];
data = M4ARG (1);
while ((p = (char *) memchr2 (data, from[0], second, len)))
- {
- obstack_grow (obs, data, p - data);
- len -= p - data + 1;
- data = p + 1;
- if (*p == from[0] && to_len)
- obstack_1grow (obs, to[0]);
- else if (*p == second && 1 < to_len)
- obstack_1grow (obs, to[1]);
- }
+ {
+ obstack_grow (obs, data, p - data);
+ len -= p - data + 1;
+ data = p + 1;
+ if (*p == from[0] && to_len)
+ obstack_1grow (obs, to[0]);
+ else if (*p == second && 1 < to_len)
+ obstack_1grow (obs, to[1]);
+ }
obstack_grow (obs, data, len);
return;
}
@@ -1149,20 +1149,20 @@ M4BUILTIN_HANDLER (translit)
{
ch = *from++;
if (found[ch] == ASIS)
- {
- if (to_len)
- {
- found[ch] = REPLACE;
- map[ch] = *to;
- }
- else
- found[ch] = DELETE;
- }
+ {
+ if (to_len)
+ {
+ found[ch] = REPLACE;
+ map[ch] = *to;
+ }
+ else
+ found[ch] = DELETE;
+ }
if (to_len)
- {
- to++;
- to_len--;
- }
+ {
+ to++;
+ to_len--;
+ }
}
data = M4ARG (1);
@@ -1171,19 +1171,19 @@ M4BUILTIN_HANDLER (translit)
{
ch = *data++;
switch (found[ch])
- {
- case ASIS:
- obstack_1grow (obs, ch);
- break;
- case REPLACE:
- obstack_1grow (obs, map[ch]);
- break;
- case DELETE:
- break;
- default:
- assert (!"translit");
- abort ();
- }
+ {
+ case ASIS:
+ obstack_1grow (obs, ch);
+ break;
+ case REPLACE:
+ obstack_1grow (obs, map[ch]);
+ break;
+ case DELETE:
+ break;
+ default:
+ assert (!"translit");
+ abort ();
+ }
}
}
@@ -1251,8 +1251,8 @@ M4BUILTIN_HANDLER (translit)
(*(x) = (number) ((unumber) *(x) << (*(y) & shift_mask)))
#define numb_rshift(c, x, y) \
(*(x) = (number) (*(x) < 0 \
- ? ~(~(unumber) *(x) >> (*(y) & shift_mask)) \
- : (unumber) *(x) >> (*(y) & shift_mask)))
+ ? ~(~(unumber) *(x) >> (*(y) & shift_mask)) \
+ : (unumber) *(x) >> (*(y) & shift_mask)))
#define numb_urshift(c, x, y) \
(*(x) = (number) ((unumber) *(x) >> (*(y) & shift_mask)))
@@ -1306,18 +1306,18 @@ numb_obstack (m4_obstack *obs, number value, int radix, int min)
if (radix == 1)
{
if (value < 0)
- {
- obstack_1grow (obs, '-');
- uvalue = -value;
- }
+ {
+ obstack_1grow (obs, '-');
+ uvalue = -value;
+ }
else
- uvalue = value;
+ uvalue = value;
if (uvalue < min)
- {
- obstack_blank (obs, min - uvalue);
- memset ((char *) obstack_next_free (obs) - (min - uvalue), '0',
- min - uvalue);
- }
+ {
+ obstack_blank (obs, min - uvalue);
+ memset ((char *) obstack_next_free (obs) - (min - uvalue), '0',
+ min - uvalue);
+ }
obstack_blank (obs, uvalue);
memset ((char *) obstack_next_free (obs) - uvalue, '1', uvalue);
return;
diff --git a/modules/m4.h b/modules/m4.h
index a41123ab..a6d3c920 100644
--- a/modules/m4.h
+++ b/modules/m4.h
@@ -40,13 +40,13 @@ typedef struct
typedef void m4_sysval_flush_func (m4 *context, bool report);
typedef void m4_set_sysval_func (int value);
typedef void m4_dump_symbols_func (m4 *context, m4_dump_symbol_data *data,
- size_t argc, m4_macro_args *argv,
- bool complain);
+ size_t argc, m4_macro_args *argv,
+ bool complain);
typedef const char *m4_expand_ranges_func (const char *s, size_t *len,
- m4_obstack *obs);
+ m4_obstack *obs);
typedef void m4_make_temp_func (m4 *context, m4_obstack *obs,
- const m4_call_info *macro, const char *name,
- size_t len, bool dir);
+ const m4_call_info *macro, const char *name,
+ size_t len, bool dir);
END_C_DECLS
diff --git a/modules/mpeval.c b/modules/mpeval.c
index c08277d0..76384431 100644
--- a/modules/mpeval.c
+++ b/modules/mpeval.c
@@ -42,7 +42,7 @@
/* Maintain each of the builtins implemented in this modules along
with their details in a single table for easy maintenance.
- function macros blind side minargs maxargs */
+ function macros blind side minargs maxargs */
#define builtin_functions \
BUILTIN (mpeval, false, true, true, 1, 3 ) \
@@ -135,7 +135,7 @@ typedef mpq_t number;
static void numb_initialise (void);
static void numb_obstack (m4_obstack *obs, const number value,
- const int radix, int min);
+ const int radix, int min);
static void mpq2mpz (m4 *context, mpz_t z, const number q, const char *noisily);
static void mpz2mpq (number q, const mpz_t z);
static void numb_divide (number *x, number *y);
@@ -171,7 +171,7 @@ numb_initialise (void)
static void
numb_obstack (m4_obstack *obs, const number value, const int radix,
- int min)
+ int min)
{
const char *s;
size_t len;
@@ -398,11 +398,11 @@ numb_lshift (m4 *context, number * x, number * y)
long int exp = mpz_get_si (yy);
if (exp >= 0)
{
- mpz_mul_2exp (res, xx, (unsigned) exp);
+ mpz_mul_2exp (res, xx, (unsigned) exp);
}
else
{
- mpz_div_2exp (res, xx, (unsigned) -exp);
+ mpz_div_2exp (res, xx, (unsigned) -exp);
}
}
@@ -433,11 +433,11 @@ numb_rshift (m4 *context, number * x, number * y)
long int exp = mpz_get_si (yy);
if (exp >= 0)
{
- mpz_div_2exp (res, xx, (unsigned) exp);
+ mpz_div_2exp (res, xx, (unsigned) exp);
}
else
{
- mpz_mul_2exp (res, xx, (unsigned) -exp);
+ mpz_mul_2exp (res, xx, (unsigned) -exp);
}
}
diff --git a/modules/perl.c b/modules/perl.c
index 97d1d965..58febce5 100644
--- a/modules/perl.c
+++ b/modules/perl.c
@@ -116,7 +116,7 @@ M4BUILTIN_HANDLER (perleval)
for (i = 1; i < argc; i++)
{
if (i > 1)
- obstack_1grow (obs, ',');
+ obstack_1grow (obs, ',');
val = perl_eval_pv (M4ARG (i), true);
diff --git a/modules/stdlib.c b/modules/stdlib.c
index 29b4d47f..6b660bdd 100644
--- a/modules/stdlib.c
+++ b/modules/stdlib.c
@@ -109,7 +109,7 @@ M4BUILTIN_HANDLER (setenv)
if (argc >= 4)
if (!m4_numeric_arg (context, m4_arg_info (argv), M4ARG (3), M4ARGLEN (3),
- &overwrite))
+ &overwrite))
return;
/* TODO - error checking. */
@@ -190,7 +190,7 @@ M4BUILTIN_HANDLER (getpwuid)
int uid;
if (!m4_numeric_arg (context, m4_arg_info (argv), M4ARG (1), M4ARGLEN (1),
- &uid))
+ &uid))
return;
pw = getpwuid (uid);
@@ -246,8 +246,8 @@ M4BUILTIN_HANDLER (srand)
else
{
if (!m4_numeric_arg (context, m4_arg_info (argv), M4ARG (1),
- M4ARGLEN (1), &seed))
- return;
+ M4ARGLEN (1), &seed))
+ return;
}
srand (seed);
diff --git a/modules/time.c b/modules/time.c
index d20da8a0..9d2e4846 100644
--- a/modules/time.c
+++ b/modules/time.c
@@ -105,7 +105,7 @@ M4BUILTIN_HANDLER (ctime)
if (argc == 2)
{
m4_numeric_arg (context, m4_arg_info (argv), M4ARG (1), M4ARGLEN (1),
- &i);
+ &i);
t = i;
}
else
@@ -154,7 +154,7 @@ M4BUILTIN_HANDLER (gmtime)
int i;
if (!m4_numeric_arg (context, m4_arg_info (argv), M4ARG (1), M4ARGLEN (1),
- &i))
+ &i))
return;
t = i;
@@ -170,7 +170,7 @@ M4BUILTIN_HANDLER (localtime)
int i;
if (!m4_numeric_arg (context, m4_arg_info (argv), M4ARG (1), M4ARGLEN (1),
- &i))
+ &i))
return;
t = i;
@@ -200,7 +200,7 @@ M4BUILTIN_HANDLER (mktime)
if (!m4_numeric_arg (context, me, M4ARG (6), M4ARGLEN (6), &tm.tm_year))
return;
if (M4ARG (7) && !m4_numeric_arg (context, me, M4ARG (7), M4ARGLEN (7),
- &tm.tm_isdst))
+ &tm.tm_isdst))
return;
t = mktime (&tm);
@@ -221,7 +221,7 @@ M4BUILTIN_HANDLER (strftime)
int l;
if (!m4_numeric_arg (context, m4_arg_info (argv), M4ARG (2), M4ARGLEN (2),
- &l))
+ &l))
return;
t = l;
diff --git a/src/freeze.c b/src/freeze.c
index 51936316..4ad22406 100644
--- a/src/freeze.c
+++ b/src/freeze.c
@@ -36,7 +36,7 @@ static void produce_syntax_dump (FILE *, m4_syntax_table *, char);
static void produce_module_dump (FILE *, m4_module *);
static void produce_symbol_dump (m4 *, FILE *, m4_symbol_table *);
static void *dump_symbol_CB (m4_symbol_table *, const char *,
- size_t, m4_symbol *, void *);
+ size_t, m4_symbol *, void *);
static void issue_expect_message (m4 *, int);
static int decode_char (m4 *, FILE *, bool *);
@@ -70,11 +70,11 @@ produce_resyntax_dump (m4 *context, FILE *file)
const char *resyntax = m4_regexp_syntax_decode (code);
if (!resyntax)
- m4_error (context, EXIT_FAILURE, 0, NULL,
- _("invalid regexp syntax code `%d'"), code);
+ m4_error (context, EXIT_FAILURE, 0, NULL,
+ _("invalid regexp syntax code `%d'"), code);
/* No need to use produce_mem_dump, since we know all resyntax
- names are already ASCII-encoded. */
+ names are already ASCII-encoded. */
xfprintf (file, "R%zu\n%s\n", strlen (resyntax), resyntax);
}
}
@@ -95,7 +95,7 @@ produce_syntax_dump (FILE *file, m4_syntax_table *syntax, char ch)
specially, since it will not be found in syntax->orig. */
if (count == 1
&& ((code == M4_SYNTAX_RQUOTE && *buf == *DEF_RQUOTE)
- || (code == M4_SYNTAX_ECOMM && *buf == *DEF_ECOMM)))
+ || (code == M4_SYNTAX_ECOMM && *buf == *DEF_ECOMM)))
return;
if (count || (code & M4_SYNTAX_MASKS))
@@ -200,7 +200,7 @@ reverse_symbol_value_stack (m4_symbol_value *value)
FILE* to dump to. */
static void *
dump_symbol_CB (m4_symbol_table *symtab, const char *symbol_name, size_t len,
- m4_symbol *symbol, void *userdata)
+ m4_symbol *symbol, void *userdata)
{
FILE *file = (FILE *) userdata;
m4_symbol_value *value;
@@ -214,51 +214,51 @@ dump_symbol_CB (m4_symbol_table *symtab, const char *symbol_name, size_t len,
size_t module_len = module_name ? strlen (module_name) : 0;
if (m4_is_symbol_value_text (value))
- {
- const char *text = m4_get_symbol_value_text (value);
- size_t text_len = m4_get_symbol_value_len (value);
- xfprintf (file, "T%zu,%zu", len, text_len);
- if (module)
- xfprintf (file, ",%zu", module_len);
- fputc ('\n', file);
-
- produce_mem_dump (file, symbol_name, len);
- fputc ('\n', file);
- produce_mem_dump (file, text, text_len);
- fputc ('\n', file);
- if (module)
- {
- produce_mem_dump (file, module_name, module_len);
- fputc ('\n', file);
- }
- }
+ {
+ const char *text = m4_get_symbol_value_text (value);
+ size_t text_len = m4_get_symbol_value_len (value);
+ xfprintf (file, "T%zu,%zu", len, text_len);
+ if (module)
+ xfprintf (file, ",%zu", module_len);
+ fputc ('\n', file);
+
+ produce_mem_dump (file, symbol_name, len);
+ fputc ('\n', file);
+ produce_mem_dump (file, text, text_len);
+ fputc ('\n', file);
+ if (module)
+ {
+ produce_mem_dump (file, module_name, module_len);
+ fputc ('\n', file);
+ }
+ }
else if (m4_is_symbol_value_func (value))
- {
- const m4_builtin *bp = m4_get_symbol_value_builtin (value);
- size_t bp_len;
- if (bp == NULL)
- assert (!"INTERNAL ERROR: builtin not found in builtin table!");
- bp_len = strlen (bp->name);
-
- xfprintf (file, "F%zu,%zu", len, bp_len);
- if (module)
- xfprintf (file, ",%zu", module_len);
- fputc ('\n', file);
-
- produce_mem_dump (file, symbol_name, len);
- fputc ('\n', file);
- produce_mem_dump (file, bp->name, bp_len);
- fputc ('\n', file);
- if (module)
- {
- produce_mem_dump (file, module_name, module_len);
- fputc ('\n', file);
- }
- }
+ {
+ const m4_builtin *bp = m4_get_symbol_value_builtin (value);
+ size_t bp_len;
+ if (bp == NULL)
+ assert (!"INTERNAL ERROR: builtin not found in builtin table!");
+ bp_len = strlen (bp->name);
+
+ xfprintf (file, "F%zu,%zu", len, bp_len);
+ if (module)
+ xfprintf (file, ",%zu", module_len);
+ fputc ('\n', file);
+
+ produce_mem_dump (file, symbol_name, len);
+ fputc ('\n', file);
+ produce_mem_dump (file, bp->name, bp_len);
+ fputc ('\n', file);
+ if (module)
+ {
+ produce_mem_dump (file, module_name, module_len);
+ fputc ('\n', file);
+ }
+ }
else if (m4_is_symbol_value_placeholder (value))
- ; /* Nothing to do for a builtin we couldn't reload earlier. */
+ ; /* Nothing to do for a builtin we couldn't reload earlier. */
else
- assert (!"dump_symbol_CB");
+ assert (!"dump_symbol_CB");
value = VALUE_NEXT (value);
}
reverse_symbol_value_stack (last);
@@ -278,14 +278,14 @@ produce_frozen_state (m4 *context, const char *name)
if (!file)
{
m4_error (context, 0, errno, NULL, _("cannot open %s"),
- quotearg_style (locale_quoting_style, name));
+ quotearg_style (locale_quoting_style, name));
return;
}
/* Write a recognizable header. */
xfprintf (file, "# This is a frozen state file generated by GNU %s %s\n",
- PACKAGE, VERSION);
+ PACKAGE, VERSION);
fputs ("V2\n", file);
/* Dump quote delimiters. */
@@ -336,7 +336,7 @@ produce_frozen_state (m4 *context, const char *name)
fputs ("# End of frozen state file\n", file);
if (close_stream (file) != 0)
m4_error (context, EXIT_FAILURE, errno, NULL,
- _("unable to create frozen state"));
+ _("unable to create frozen state"));
}
/* Issue a message saying that some character is an EXPECTED character. */
@@ -345,10 +345,10 @@ issue_expect_message (m4 *context, int expected)
{
if (expected == '\n')
m4_error (context, EXIT_FAILURE, 0, NULL,
- _("expecting line feed in frozen file"));
+ _("expecting line feed in frozen file"));
else
m4_error (context, EXIT_FAILURE, 0, NULL,
- _("expecting character `%c' in frozen file"), expected);
+ _("expecting character `%c' in frozen file"), expected);
}
@@ -376,65 +376,65 @@ decode_char (m4 *context, FILE *in, bool *advance_line)
{
ch = getc (in);
switch (ch)
- {
- case 'a': return '\a';
- case 'b': return '\b';
- case 'f': return '\f';
- case 'n': return '\n';
- case 'r': return '\r';
- case 't': return '\t';
- case 'v': return '\v';
- case '\\': return '\\';
-
- case '\n':
- ch = getc (in);
- m4_set_current_line (context, m4_get_current_line (context) + 1);
- continue;
-
- case 'x': case 'X':
- next = getc (in);
- if (next >= '0' && next <= '9')
- ch = (next - '0') * 16;
- else if (next >= 'a' && next <= 'f')
- ch = (next - 'a' + 10) * 16;
- else if (next >= 'A' && next <= 'F')
- ch = (next - 'A' + 10) * 16;
- else
- return EOF;
- next = getc (in);
- if (next >= '0' && next <= '9')
- ch += next - '0';
- else if (next >= 'a' && next <= 'f')
- ch += next - 'a' + 10;
- else if (next >= 'A' && next <= 'F')
- ch += next - 'A' + 10;
- else
- return EOF;
- return ch;
- case '0': case '1': case '2': case '3':
- value = ch - '0';
- ch = getc (in);
- /* fall through */
- case '4': case '5': case '6': case '7':
- if (ch >= '0' && ch <= '7')
- {
- value = value * 8 + ch - '0';
- ch = getc (in);
- }
- else
- {
- ungetc (ch, in);
- return value;
- }
- if (ch >= '0' && ch <= '7')
- value = value * 8 + ch - '0';
- else
- ungetc (ch, in);
- return value;
-
- default:
- return EOF;
- }
+ {
+ case 'a': return '\a';
+ case 'b': return '\b';
+ case 'f': return '\f';
+ case 'n': return '\n';
+ case 'r': return '\r';
+ case 't': return '\t';
+ case 'v': return '\v';
+ case '\\': return '\\';
+
+ case '\n':
+ ch = getc (in);
+ m4_set_current_line (context, m4_get_current_line (context) + 1);
+ continue;
+
+ case 'x': case 'X':
+ next = getc (in);
+ if (next >= '0' && next <= '9')
+ ch = (next - '0') * 16;
+ else if (next >= 'a' && next <= 'f')
+ ch = (next - 'a' + 10) * 16;
+ else if (next >= 'A' && next <= 'F')
+ ch = (next - 'A' + 10) * 16;
+ else
+ return EOF;
+ next = getc (in);
+ if (next >= '0' && next <= '9')
+ ch += next - '0';
+ else if (next >= 'a' && next <= 'f')
+ ch += next - 'a' + 10;
+ else if (next >= 'A' && next <= 'F')
+ ch += next - 'A' + 10;
+ else
+ return EOF;
+ return ch;
+ case '0': case '1': case '2': case '3':
+ value = ch - '0';
+ ch = getc (in);
+ /* fall through */
+ case '4': case '5': case '6': case '7':
+ if (ch >= '0' && ch <= '7')
+ {
+ value = value * 8 + ch - '0';
+ ch = getc (in);
+ }
+ else
+ {
+ ungetc (ch, in);
+ return value;
+ }
+ if (ch >= '0' && ch <= '7')
+ value = value * 8 + ch - '0';
+ else
+ ungetc (ch, in);
+ return value;
+
+ default:
+ return EOF;
+ }
}
if (ch == '\n')
@@ -463,14 +463,14 @@ reload_frozen_state (m4 *context, const char *name)
do \
{ \
if (advance_line) \
- { \
- m4_set_current_line (context, \
- m4_get_current_line (context) + 1); \
- advance_line = false; \
- } \
+ { \
+ m4_set_current_line (context, \
+ m4_get_current_line (context) + 1); \
+ advance_line = false; \
+ } \
character = getc (file); \
if (character == '\n') \
- advance_line = true; \
+ advance_line = true; \
} \
while (0)
@@ -479,14 +479,14 @@ reload_frozen_state (m4 *context, const char *name)
{ \
unsigned int n = 0; \
while (isdigit (character) && n <= INT_MAX / 10) \
- { \
- n = 10 * n + character - '0'; \
- GET_CHARACTER; \
- } \
+ { \
+ n = 10 * n + character - '0'; \
+ GET_CHARACTER; \
+ } \
if (((AllowNeg) ? INT_MIN: INT_MAX) < n \
- || isdigit (character)) \
- m4_error (context, EXIT_FAILURE, 0, NULL, \
- _("integer overflow in frozen file")); \
+ || isdigit (character)) \
+ m4_error (context, EXIT_FAILURE, 0, NULL, \
+ _("integer overflow in frozen file")); \
(Number) = n; \
} \
while (0)
@@ -498,34 +498,34 @@ reload_frozen_state (m4 *context, const char *name)
char *p; \
int ch; \
if (UseChar) \
- { \
- ungetc (character, File); \
- if (advance_line) \
- { \
- assert (character == '\n'); \
- advance_line = false; \
- } \
- } \
+ { \
+ ungetc (character, File); \
+ if (advance_line) \
+ { \
+ assert (character == '\n'); \
+ advance_line = false; \
+ } \
+ } \
CHECK_ALLOCATION ((Buf), (BufSize), len); \
p = (Buf); \
while (len-- > 0) \
- { \
- ch = (version > 1 \
- ? decode_char (context, File, &advance_line) \
- : getc (File)); \
- if (ch == EOF) \
- m4_error (context, EXIT_FAILURE, 0, NULL, \
- _("premature end of frozen file")); \
- *p++ = ch; \
- } \
+ { \
+ ch = (version > 1 \
+ ? decode_char (context, File, &advance_line) \
+ : getc (File)); \
+ if (ch == EOF) \
+ m4_error (context, EXIT_FAILURE, 0, NULL, \
+ _("premature end of frozen file")); \
+ *p++ = ch; \
+ } \
*p = '\0'; \
GET_CHARACTER; \
while (version > 1 && character == '\\') \
- { \
- GET_CHARACTER; \
- VALIDATE ('\n'); \
- GET_CHARACTER; \
- } \
+ { \
+ GET_CHARACTER; \
+ VALIDATE ('\n'); \
+ GET_CHARACTER; \
+ } \
} \
while (0)
@@ -533,7 +533,7 @@ reload_frozen_state (m4 *context, const char *name)
do \
{ \
if (character != (Expected)) \
- issue_expect_message (context, (Expected)); \
+ issue_expect_message (context, (Expected)); \
} \
while (0)
@@ -541,11 +541,11 @@ reload_frozen_state (m4 *context, const char *name)
do \
{ \
if ((Needed) + 1 > (Allocated)) \
- { \
- free (Where); \
- (Allocated) = (Needed) + 1; \
- (Where) = xcharalloc (Allocated); \
- } \
+ { \
+ free (Where); \
+ (Allocated) = (Needed) + 1; \
+ (Where) = xcharalloc (Allocated); \
+ } \
} \
while (0)
@@ -557,18 +557,18 @@ reload_frozen_state (m4 *context, const char *name)
{ \
GET_CHARACTER; \
if (character == '#') \
- { \
- while (character != EOF && character != '\n') \
- GET_CHARACTER; \
- VALIDATE ('\n'); \
- } \
+ { \
+ while (character != EOF && character != '\n') \
+ GET_CHARACTER; \
+ VALIDATE ('\n'); \
+ } \
} \
while (character == '\n')
file = m4_path_search (context, name, (char **)NULL);
if (file == NULL)
m4_error (context, EXIT_FAILURE, errno, NULL, _("cannot open %s"),
- quotearg_style (locale_quoting_style, name));
+ quotearg_style (locale_quoting_style, name));
m4_set_current_file (context, name);
allocated[0] = 100;
@@ -591,21 +591,21 @@ reload_frozen_state (m4 *context, const char *name)
case 1:
m4__module_open (context, "m4", NULL);
if (m4_get_posixly_correct_opt (context))
- m4__module_open (context, "traditional", NULL);
+ m4__module_open (context, "traditional", NULL);
else
- m4__module_open (context, "gnu", NULL);
+ m4__module_open (context, "gnu", NULL);
/* Disable { and } categories, since ${11} was not supported in
- 1.4.x. */
+ 1.4.x. */
m4_set_syntax (M4SYNTAX, 'O', '+', "{}", 2);
break;
default:
if (version > 2)
- m4_error (context, EXIT_MISMATCH, 0, NULL,
- _("frozen file version %d greater than max supported of 2"),
- version);
+ m4_error (context, EXIT_MISMATCH, 0, NULL,
+ _("frozen file version %d greater than max supported of 2"),
+ version);
else
- m4_error (context, EXIT_FAILURE, 0, NULL,
- _("ill-formed frozen file, version directive expected"));
+ m4_error (context, EXIT_FAILURE, 0, NULL,
+ _("ill-formed frozen file, version directive expected"));
}
VALIDATE ('\n');
@@ -613,370 +613,370 @@ reload_frozen_state (m4 *context, const char *name)
while (character != EOF)
{
switch (character)
- {
- default:
- m4_error (context, EXIT_FAILURE, 0, NULL,
- _("ill-formed frozen file, unknown directive %c"),
- character);
-
- case 'd':
- /* Set debugmode flags. */
- if (version < 2)
- {
- /* 'd' operator is not supported in format version 1. */
- m4_error (context, EXIT_FAILURE, 0, NULL, _("\
+ {
+ default:
+ m4_error (context, EXIT_FAILURE, 0, NULL,
+ _("ill-formed frozen file, unknown directive %c"),
+ character);
+
+ case 'd':
+ /* Set debugmode flags. */
+ if (version < 2)
+ {
+ /* 'd' operator is not supported in format version 1. */
+ m4_error (context, EXIT_FAILURE, 0, NULL, _("\
ill-formed frozen file, version 2 directive `%c' encountered"), 'd');
- }
-
- GET_CHARACTER;
- GET_NUMBER (number[0], false);
- VALIDATE ('\n');
- GET_STRING (file, string[0], allocated[0], number[0], false);
- VALIDATE ('\n');
-
- if (m4_debug_decode (context, string[0], number[0]) < 0)
- m4_error (context, EXIT_FAILURE, 0, NULL,
- _("unknown debug mode %s"),
- quotearg_style_mem (locale_quoting_style, string[0],
- number[0]));
- break;
-
- case 'F':
- GET_CHARACTER;
-
- /* Get string lengths. */
-
- GET_NUMBER (number[0], false);
- VALIDATE (',');
- GET_CHARACTER;
- GET_NUMBER (number[1], false);
-
- if (character == ',')
- {
- if (version > 1)
- {
- /* 'F' operator accepts an optional third argument for
- format versions 2 or later. */
- GET_CHARACTER;
- GET_NUMBER (number[2], false);
- }
- else
- /* 3 argument 'F' operations are invalid for format
- version 1. */
- m4_error (context, EXIT_FAILURE, 0, NULL, _("\
+ }
+
+ GET_CHARACTER;
+ GET_NUMBER (number[0], false);
+ VALIDATE ('\n');
+ GET_STRING (file, string[0], allocated[0], number[0], false);
+ VALIDATE ('\n');
+
+ if (m4_debug_decode (context, string[0], number[0]) < 0)
+ m4_error (context, EXIT_FAILURE, 0, NULL,
+ _("unknown debug mode %s"),
+ quotearg_style_mem (locale_quoting_style, string[0],
+ number[0]));
+ break;
+
+ case 'F':
+ GET_CHARACTER;
+
+ /* Get string lengths. */
+
+ GET_NUMBER (number[0], false);
+ VALIDATE (',');
+ GET_CHARACTER;
+ GET_NUMBER (number[1], false);
+
+ if (character == ',')
+ {
+ if (version > 1)
+ {
+ /* 'F' operator accepts an optional third argument for
+ format versions 2 or later. */
+ GET_CHARACTER;
+ GET_NUMBER (number[2], false);
+ }
+ else
+ /* 3 argument 'F' operations are invalid for format
+ version 1. */
+ m4_error (context, EXIT_FAILURE, 0, NULL, _("\
ill-formed frozen file, version 2 directive `%c' encountered"), 'F');
- }
- else
- {
- number[2] = 0;
- }
-
- VALIDATE ('\n');
-
-
- /* Get string contents. */
-
- GET_STRING (file, string[0], allocated[0], number[0], false);
- if (version > 1)
- {
- VALIDATE ('\n');
- GET_CHARACTER;
- }
- GET_STRING (file, string[1], allocated[1], number[1], true);
- if (version > 1 && number[2])
- {
- VALIDATE ('\n');
- GET_CHARACTER;
- }
- GET_STRING (file, string[2], allocated[2], number[2], true);
- VALIDATE ('\n');
-
- /* Enter a macro having a builtin function as a definition. */
- {
- m4_module *module = NULL;
- m4_symbol_value *token;
-
- // Builtins cannot contain a NUL byte.
- if (strlen (string[1]) < number[1])
- m4_error (context, EXIT_FAILURE, 0, NULL, _("\
+ }
+ else
+ {
+ number[2] = 0;
+ }
+
+ VALIDATE ('\n');
+
+
+ /* Get string contents. */
+
+ GET_STRING (file, string[0], allocated[0], number[0], false);
+ if (version > 1)
+ {
+ VALIDATE ('\n');
+ GET_CHARACTER;
+ }
+ GET_STRING (file, string[1], allocated[1], number[1], true);
+ if (version > 1 && number[2])
+ {
+ VALIDATE ('\n');
+ GET_CHARACTER;
+ }
+ GET_STRING (file, string[2], allocated[2], number[2], true);
+ VALIDATE ('\n');
+
+ /* Enter a macro having a builtin function as a definition. */
+ {
+ m4_module *module = NULL;
+ m4_symbol_value *token;
+
+ // Builtins cannot contain a NUL byte.
+ if (strlen (string[1]) < number[1])
+ m4_error (context, EXIT_FAILURE, 0, NULL, _("\
ill-formed frozen file, invalid builtin %s encountered"),
- quotearg_style_mem (locale_quoting_style, string[1],
- number[1]));
- if (number[2] > 0)
- {
- if (strlen (string[2]) < number[2])
- m4_error (context, EXIT_FAILURE, 0, NULL, _("\
+ quotearg_style_mem (locale_quoting_style, string[1],
+ number[1]));
+ if (number[2] > 0)
+ {
+ if (strlen (string[2]) < number[2])
+ m4_error (context, EXIT_FAILURE, 0, NULL, _("\
ill-formed frozen file, invalid module %s encountered"),
- quotearg_style_mem (locale_quoting_style,
- string[2], number[2]));
- module = m4__module_find (string[2]);
- }
- token = m4_builtin_find_by_name (module, string[1]);
-
- if (token == NULL)
- {
- token = (m4_symbol_value *) xzalloc (sizeof *token);
- m4_set_symbol_value_placeholder (token, xstrdup (string[1]));
- VALUE_MODULE (token) = module;
- VALUE_MIN_ARGS (token) = 0;
- VALUE_MAX_ARGS (token) = -1;
- }
- m4_symbol_pushdef (M4SYMTAB, string[0], number[0], token);
- }
- break;
-
- case 'M':
-
- /* Load a module, but *without* perturbing the symbol table.
- Note that any expansion from loading the module which would
- have been seen when loading it originally is discarded
- when loading it from a frozen file. */
-
- if (version < 2)
- {
- /* 'M' operator is not supported in format version 1. */
- m4_error (context, EXIT_FAILURE, 0, NULL, _("\
+ quotearg_style_mem (locale_quoting_style,
+ string[2], number[2]));
+ module = m4__module_find (string[2]);
+ }
+ token = m4_builtin_find_by_name (module, string[1]);
+
+ if (token == NULL)
+ {
+ token = (m4_symbol_value *) xzalloc (sizeof *token);
+ m4_set_symbol_value_placeholder (token, xstrdup (string[1]));
+ VALUE_MODULE (token) = module;
+ VALUE_MIN_ARGS (token) = 0;
+ VALUE_MAX_ARGS (token) = -1;
+ }
+ m4_symbol_pushdef (M4SYMTAB, string[0], number[0], token);
+ }
+ break;
+
+ case 'M':
+
+ /* Load a module, but *without* perturbing the symbol table.
+ Note that any expansion from loading the module which would
+ have been seen when loading it originally is discarded
+ when loading it from a frozen file. */
+
+ if (version < 2)
+ {
+ /* 'M' operator is not supported in format version 1. */
+ m4_error (context, EXIT_FAILURE, 0, NULL, _("\
ill-formed frozen file, version 2 directive `%c' encountered"), 'M');
- }
+ }
- GET_CHARACTER;
- GET_NUMBER (number[0], false);
- VALIDATE ('\n');
- GET_STRING (file, string[0], allocated[0], number[0], false);
- VALIDATE ('\n');
+ GET_CHARACTER;
+ GET_NUMBER (number[0], false);
+ VALIDATE ('\n');
+ GET_STRING (file, string[0], allocated[0], number[0], false);
+ VALIDATE ('\n');
- if (strlen (string[0]) < number[0])
- m4_error (context, EXIT_FAILURE, 0, NULL, _("\
+ if (strlen (string[0]) < number[0])
+ m4_error (context, EXIT_FAILURE, 0, NULL, _("\
ill-formed frozen file, invalid module %s encountered"),
- quotearg_style_mem (locale_quoting_style,
- string[0], number[0]));
- m4__module_open (context, string[0], NULL);
+ quotearg_style_mem (locale_quoting_style,
+ string[0], number[0]));
+ m4__module_open (context, string[0], NULL);
- break;
+ break;
- case 'R':
+ case 'R':
- if (version < 2)
- {
- /* 'R' operator is not supported in format version 1. */
- m4_error (context, EXIT_FAILURE, 0, NULL, _("\
+ if (version < 2)
+ {
+ /* 'R' operator is not supported in format version 1. */
+ m4_error (context, EXIT_FAILURE, 0, NULL, _("\
ill-formed frozen file, version 2 directive `%c' encountered"), 'R');
- }
-
- GET_CHARACTER;
- GET_NUMBER (number[0], false);
- VALIDATE ('\n');
- GET_STRING (file, string[0], allocated[0], number[0], false);
- VALIDATE ('\n');
-
- m4_set_regexp_syntax_opt (context,
- m4_regexp_syntax_encode (string[0]));
- if (m4_get_regexp_syntax_opt (context) < 0
- || strlen (string[0]) < number[0])
- {
- m4_error (context, EXIT_FAILURE, 0, NULL,
- _("bad syntax-spec %s"),
- quotearg_style_mem (locale_quoting_style, string[0],
- number[0]));
- }
-
- break;
-
- case 'S':
-
- if (version < 2)
- {
- /* 'S' operator is not supported in format version 1. */
- m4_error (context, EXIT_FAILURE, 0, NULL, _("\
+ }
+
+ GET_CHARACTER;
+ GET_NUMBER (number[0], false);
+ VALIDATE ('\n');
+ GET_STRING (file, string[0], allocated[0], number[0], false);
+ VALIDATE ('\n');
+
+ m4_set_regexp_syntax_opt (context,
+ m4_regexp_syntax_encode (string[0]));
+ if (m4_get_regexp_syntax_opt (context) < 0
+ || strlen (string[0]) < number[0])
+ {
+ m4_error (context, EXIT_FAILURE, 0, NULL,
+ _("bad syntax-spec %s"),
+ quotearg_style_mem (locale_quoting_style, string[0],
+ number[0]));
+ }
+
+ break;
+
+ case 'S':
+
+ if (version < 2)
+ {
+ /* 'S' operator is not supported in format version 1. */
+ m4_error (context, EXIT_FAILURE, 0, NULL, _("\
ill-formed frozen file, version 2 directive `%c' encountered"), 'S');
- }
-
- GET_CHARACTER;
- syntax = character;
- GET_CHARACTER;
- GET_NUMBER (number[0], false);
- VALIDATE ('\n');
- GET_STRING (file, string[0], allocated[0], number[0], false);
-
- /* Syntax under M4_SYNTAX_MASKS is handled specially; all
- other characters are additive. */
- if ((m4_set_syntax (M4SYNTAX, syntax,
- (m4_syntax_code (syntax) & M4_SYNTAX_MASKS
- ? '=' : '+'), string[0], number[0]) < 0)
- && (syntax != '\0'))
- {
- m4_error (context, 0, 0, NULL,
- _("undefined syntax code %c"), syntax);
- }
- break;
-
- case 't':
- /* Trace a macro name. */
- if (version < 2)
- {
- /* 't' operator is not supported in format version 1. */
- m4_error (context, EXIT_FAILURE, 0, NULL, _("\
+ }
+
+ GET_CHARACTER;
+ syntax = character;
+ GET_CHARACTER;
+ GET_NUMBER (number[0], false);
+ VALIDATE ('\n');
+ GET_STRING (file, string[0], allocated[0], number[0], false);
+
+ /* Syntax under M4_SYNTAX_MASKS is handled specially; all
+ other characters are additive. */
+ if ((m4_set_syntax (M4SYNTAX, syntax,
+ (m4_syntax_code (syntax) & M4_SYNTAX_MASKS
+ ? '=' : '+'), string[0], number[0]) < 0)
+ && (syntax != '\0'))
+ {
+ m4_error (context, 0, 0, NULL,
+ _("undefined syntax code %c"), syntax);
+ }
+ break;
+
+ case 't':
+ /* Trace a macro name. */
+ if (version < 2)
+ {
+ /* 't' operator is not supported in format version 1. */
+ m4_error (context, EXIT_FAILURE, 0, NULL, _("\
ill-formed frozen file, version 2 directive `%c' encountered"), 't');
- }
-
- GET_CHARACTER;
- GET_NUMBER (number[0], false);
- VALIDATE ('\n');
- GET_STRING (file, string[0], allocated[0], number[0], false);
- VALIDATE ('\n');
-
- m4_set_symbol_name_traced (M4SYMTAB, string[0], number[0], true);
-
- break;
-
- case 'C':
- case 'D':
- case 'Q':
- operation = character;
- GET_CHARACTER;
-
- /* Get string lengths. */
-
- if (operation == 'D' && character == '-')
- {
- /* Accept a negative diversion number. */
- GET_CHARACTER;
- GET_NUMBER (number[0], true);
- number[0] = -number[0];
- }
- else
- GET_NUMBER (number[0], false);
- VALIDATE (',');
- GET_CHARACTER;
- GET_NUMBER (number[1], false);
- VALIDATE ('\n');
-
- /* Get string contents. */
- if (operation != 'D')
- {
- GET_STRING (file, string[0], allocated[0], number[0], false);
- if (version > 1)
- {
- VALIDATE ('\n');
- GET_CHARACTER;
- }
- }
- else
- GET_CHARACTER;
- GET_STRING (file, string[1], allocated[1], number[1], true);
- VALIDATE ('\n');
-
- /* Act according to operation letter. */
-
- switch (operation)
- {
- case 'C':
-
- /* Change comment strings. */
-
- m4_set_comment (M4SYNTAX, string[0], number[0], string[1],
- number[1]);
- break;
-
- case 'D':
-
- /* Select a diversion and add a string to it. */
-
- m4_make_diversion (context, number[0]);
- if (number[1] > 0)
- m4_output_text (context, string[1], number[1]);
- break;
-
- case 'Q':
-
- /* Change quote strings. */
-
- m4_set_quotes (M4SYNTAX, string[0], number[0], string[1],
- number[1]);
- break;
-
- default:
-
- /* Cannot happen. */
-
- break;
- }
- break;
-
- case 'T':
- GET_CHARACTER;
-
- /* Get string lengths. */
-
- GET_NUMBER (number[0], false);
- VALIDATE (',');
- GET_CHARACTER;
- GET_NUMBER (number[1], false);
-
- if (character == ',')
- {
- if (version > 1)
- {
- /* 'T' operator accepts an optional third argument for
- format versions 2 or later. */
- GET_CHARACTER;
- GET_NUMBER (number[2], false);
- }
- else
- {
- /* 3 argument 'T' operations are invalid for format
- version 1. */
- m4_error (context, EXIT_FAILURE, 0, NULL, _("\
+ }
+
+ GET_CHARACTER;
+ GET_NUMBER (number[0], false);
+ VALIDATE ('\n');
+ GET_STRING (file, string[0], allocated[0], number[0], false);
+ VALIDATE ('\n');
+
+ m4_set_symbol_name_traced (M4SYMTAB, string[0], number[0], true);
+
+ break;
+
+ case 'C':
+ case 'D':
+ case 'Q':
+ operation = character;
+ GET_CHARACTER;
+
+ /* Get string lengths. */
+
+ if (operation == 'D' && character == '-')
+ {
+ /* Accept a negative diversion number. */
+ GET_CHARACTER;
+ GET_NUMBER (number[0], true);
+ number[0] = -number[0];
+ }
+ else
+ GET_NUMBER (number[0], false);
+ VALIDATE (',');
+ GET_CHARACTER;
+ GET_NUMBER (number[1], false);
+ VALIDATE ('\n');
+
+ /* Get string contents. */
+ if (operation != 'D')
+ {
+ GET_STRING (file, string[0], allocated[0], number[0], false);
+ if (version > 1)
+ {
+ VALIDATE ('\n');
+ GET_CHARACTER;
+ }
+ }
+ else
+ GET_CHARACTER;
+ GET_STRING (file, string[1], allocated[1], number[1], true);
+ VALIDATE ('\n');
+
+ /* Act according to operation letter. */
+
+ switch (operation)
+ {
+ case 'C':
+
+ /* Change comment strings. */
+
+ m4_set_comment (M4SYNTAX, string[0], number[0], string[1],
+ number[1]);
+ break;
+
+ case 'D':
+
+ /* Select a diversion and add a string to it. */
+
+ m4_make_diversion (context, number[0]);
+ if (number[1] > 0)
+ m4_output_text (context, string[1], number[1]);
+ break;
+
+ case 'Q':
+
+ /* Change quote strings. */
+
+ m4_set_quotes (M4SYNTAX, string[0], number[0], string[1],
+ number[1]);
+ break;
+
+ default:
+
+ /* Cannot happen. */
+
+ break;
+ }
+ break;
+
+ case 'T':
+ GET_CHARACTER;
+
+ /* Get string lengths. */
+
+ GET_NUMBER (number[0], false);
+ VALIDATE (',');
+ GET_CHARACTER;
+ GET_NUMBER (number[1], false);
+
+ if (character == ',')
+ {
+ if (version > 1)
+ {
+ /* 'T' operator accepts an optional third argument for
+ format versions 2 or later. */
+ GET_CHARACTER;
+ GET_NUMBER (number[2], false);
+ }
+ else
+ {
+ /* 3 argument 'T' operations are invalid for format
+ version 1. */
+ m4_error (context, EXIT_FAILURE, 0, NULL, _("\
ill-formed frozen file, version 2 directive `%c' encountered"), 'T');
- }
- }
- else
- number[2] = 0;
-
- VALIDATE ('\n');
-
- /* Get string contents. */
- GET_STRING (file, string[0], allocated[0], number[0], false);
- if (version > 1)
- {
- VALIDATE ('\n');
- GET_CHARACTER;
- }
- GET_STRING (file, string[1], allocated[1], number[1], true);
- if (version > 1 && number[2])
- {
- VALIDATE ('\n');
- GET_CHARACTER;
- }
- GET_STRING (file, string[2], allocated[2], number[2], true);
- VALIDATE ('\n');
-
- /* Enter a macro having an expansion text as a definition. */
- {
- m4_symbol_value *token;
- m4_module *module = NULL;
-
- token = (m4_symbol_value *) xzalloc (sizeof *token);
- if (number[2] > 0)
- {
- if (strlen (string[2]) < number[2])
- m4_error (context, EXIT_FAILURE, 0, NULL, _("\
+ }
+ }
+ else
+ number[2] = 0;
+
+ VALIDATE ('\n');
+
+ /* Get string contents. */
+ GET_STRING (file, string[0], allocated[0], number[0], false);
+ if (version > 1)
+ {
+ VALIDATE ('\n');
+ GET_CHARACTER;
+ }
+ GET_STRING (file, string[1], allocated[1], number[1], true);
+ if (version > 1 && number[2])
+ {
+ VALIDATE ('\n');
+ GET_CHARACTER;
+ }
+ GET_STRING (file, string[2], allocated[2], number[2], true);
+ VALIDATE ('\n');
+
+ /* Enter a macro having an expansion text as a definition. */
+ {
+ m4_symbol_value *token;
+ m4_module *module = NULL;
+
+ token = (m4_symbol_value *) xzalloc (sizeof *token);
+ if (number[2] > 0)
+ {
+ if (strlen (string[2]) < number[2])
+ m4_error (context, EXIT_FAILURE, 0, NULL, _("\
ill-formed frozen file, invalid module %s encountered"),
- quotearg_style_mem (locale_quoting_style,
- string[2], number[2]));
- module = m4__module_find (string[2]);
- }
+ quotearg_style_mem (locale_quoting_style,
+ string[2], number[2]));
+ module = m4__module_find (string[2]);
+ }
- m4_set_symbol_value_text (token, xmemdup0 (string[1], number[1]),
- number[1], 0);
- VALUE_MODULE (token) = module;
- VALUE_MAX_ARGS (token) = -1;
+ m4_set_symbol_value_text (token, xmemdup0 (string[1], number[1]),
+ number[1], 0);
+ VALUE_MODULE (token) = module;
+ VALUE_MAX_ARGS (token) = -1;
- m4_symbol_pushdef (M4SYMTAB, string[0], number[0], token);
- }
- break;
+ m4_symbol_pushdef (M4SYMTAB, string[0], number[0], token);
+ }
+ break;
- }
+ }
GET_DIRECTIVE;
}
@@ -985,7 +985,7 @@ ill-formed frozen file, invalid module %s encountered"),
free (string[2]);
if (close_stream (file) != 0)
m4_error (context, EXIT_FAILURE, errno, NULL,
- _("unable to read frozen state"));
+ _("unable to read frozen state"));
m4_set_current_file (context, NULL);
m4_set_current_line (context, 0);
diff --git a/src/m4.h b/src/m4.h
index 2a842be4..674d639e 100644
--- a/src/m4.h
+++ b/src/m4.h
@@ -30,7 +30,7 @@
/* Error handling. */
#ifdef USE_STACKOVF
void setup_stackovf_trap (char *const *, char *const *,
- void (*handler) (void));
+ void (*handler) (void));
void stackovf_exit (void);
#endif
diff --git a/src/main.c b/src/main.c
index cfa6a6ab..98109ac2 100644
--- a/src/main.c
+++ b/src/main.c
@@ -73,7 +73,7 @@ usage (int status)
{
if (status != EXIT_SUCCESS)
xfprintf (stderr, _("Try `%s --help' for more information.\n"),
- m4_get_program_name ());
+ m4_get_program_name ());
else
{
xprintf (_("Usage: %s [OPTION]... [FILE]...\n"), m4_get_program_name ());
@@ -311,11 +311,11 @@ process_file (m4 *context, const char *name)
char *full_name;
FILE *fp = m4_path_search (context, name, &full_name);
if (fp == NULL)
- {
- m4_error (context, 0, errno, NULL, _("cannot open %s"),
- quotearg_style (locale_quoting_style, name));
- return;
- }
+ {
+ m4_error (context, 0, errno, NULL, _("cannot open %s"),
+ quotearg_style (locale_quoting_style, name));
+ return;
+ }
m4_push_file (context, fp, full_name, true);
free (full_name);
}
@@ -377,231 +377,231 @@ main (int argc, char *const *argv, char *const *envp)
{
int oi = -1;
int optchar = getopt_long (argc, (char **) argv, OPTSTRING,
- long_options, &oi);
+ long_options, &oi);
if (optchar == -1)
- break;
+ break;
switch (optchar)
- {
- default:
- usage (EXIT_FAILURE);
-
- case 'H':
- case HASHSIZE_OPTION:
- /* -H was supported in 1.4.x, but is a no-op now. FIXME -
- remove support for -H after 2.0. */
- error (0, 0, _("Warning: `%s' is deprecated"),
- optchar == 'H' ? "-H" : "--hashsize");
- break;
-
- case 'S':
- case 'T':
- /* Compatibility junk: options that other implementations
- support, but which we ignore as no-ops and don't list in
- --help. */
- error (0, 0, _("Warning: `-%c' is deprecated"),
- optchar);
- break;
-
- case WORD_REGEXP_OPTION:
- /* Supported in 1.4.x as -W, but no longer present. */
- error (0, 0, _("Warning: `%s' is deprecated"), "--word-regexp");
- break;
-
- case 's':
- optchar = SYNCOUTPUT_OPTION;
- optarg = "1";
- /* fall through */
- case 'D':
- case 'U':
- case 'm':
- case 'p':
- case 'r':
- case 't':
- case POPDEF_OPTION:
- case SYNCOUTPUT_OPTION:
- case TRACEOFF_OPTION:
- case UNLOAD_MODULE_OPTION:
- defer:
- /* Arguments that cannot be handled until later are accumulated. */
-
- defn = (deferred *) xmalloc (sizeof *defn);
- defn->code = optchar;
- defn->value = optarg;
- defn->next = NULL;
-
- if (head == NULL)
- head = defn;
- else
- tail->next = defn;
- tail = defn;
- break;
-
- case '\1':
- seen_file = true;
- goto defer;
-
- case 'B':
- /* In 1.4.x, -B<num> was a no-op option for compatibility with
- Solaris m4. Warn if optarg is all numeric. FIXME -
- silence this warning after 2.0. */
- if (isdigit (to_uchar (*optarg)))
- {
- char *end;
- errno = 0;
- strtol (optarg, &end, 10);
- if (*end == '\0' && errno == 0)
- error (0, 0, _("Warning: recommend using `-B ./%s' instead"),
- optarg);
- }
- /* fall through */
- case PREPEND_INCLUDE_OPTION:
- m4_add_include_directory (context, optarg, true);
- break;
-
- case 'E':
- m4_debug_decode (context, "-d", SIZE_MAX);
- if (m4_get_fatal_warnings_opt (context))
- m4_set_warnings_exit_opt (context, true);
- else
- m4_set_fatal_warnings_opt (context, true);
- break;
-
- case 'F':
- frozen_file_to_write = optarg;
- break;
-
- case 'G':
- m4_set_posixly_correct_opt (context, true);
- break;
-
- case 'I':
- m4_add_include_directory (context, optarg, false);
- break;
-
- case 'L':
- size = size_opt (optarg, oi, optchar);
- if (!size)
- size = SIZE_MAX;
- m4_set_nesting_limit_opt (context, size);
- break;
-
- case 'M':
- if (lt_dlinsertsearchdir (lt_dlgetsearchpath (), optarg) != 0)
- {
- const char *dlerr = lt_dlerror ();
- if (dlerr == NULL)
- m4_error (context, EXIT_FAILURE, 0, NULL,
- _("failed to add search directory %s"),
- quotearg_style (locale_quoting_style, optarg));
- else
- m4_error (context, EXIT_FAILURE, 0, NULL,
- _("failed to add search directory %s: %s"),
- quotearg_style (locale_quoting_style, optarg),
- dlerr);
- }
- break;
-
- case 'P':
- m4_set_prefix_builtins_opt (context, true);
- break;
-
- case 'Q':
- m4_set_suppress_warnings_opt (context, true);
- break;
-
- case 'R':
- frozen_file_to_read = optarg;
- break;
-
- case 'W':
- /* FIXME - should W take an optional argument, to allow -Wall,
- -Wnone, -Werror, -Wcategory, -Wno-category? If so, then have
- -W == -Wall. */
- m4_set_suppress_warnings_opt (context, false);
- break;
-
- case 'b':
- interactive = INTERACTIVE_NO;
- break;
-
- case 'c':
- m4_set_discard_comments_opt (context, true);
- break;
-
- case 'd':
- /* Staggered handling of 'd', since -dm is useful prior to
- first file and prior to reloading, but other -d must also
- have effect between files. */
- if (seen_file || frozen_file_to_read)
- goto defer;
- if (m4_debug_decode (context, optarg, SIZE_MAX) < 0)
- error (0, 0, _("bad debug flags: %s"),
- quotearg_style (locale_quoting_style, optarg));
- break;
-
- case 'e':
- error (0, 0, _("Warning: `%s' is deprecated, use `%s' instead"),
- "-e", "-i");
- /* fall through */
- case 'i':
- interactive = INTERACTIVE_YES;
- break;
-
- case 'g':
- m4_set_posixly_correct_opt (context, false);
- break;
-
- case ARGLENGTH_OPTION:
- error (0, 0, _("Warning: `%s' is deprecated, use `%s' instead"),
- "--arglength", "--debuglen");
- /* fall through */
- case 'l':
- size = size_opt (optarg, oi, optchar);
- if (!size)
- size = SIZE_MAX;
- m4_set_max_debug_arg_length_opt (context, size);
- break;
-
- case DEBUGFILE_OPTION:
- /* Staggered handling of '--debugfile', since it is useful
- prior to first file and prior to reloading, but other
- uses must also have effect between files. */
- if (seen_file || frozen_file_to_read)
- goto defer;
- debugfile = optarg;
- break;
-
- case 'o':
- case ERROR_OUTPUT_OPTION:
- /* FIXME: -o is inconsistent with other tools' use of
- -o/--output for creating an output file instead of using
- stdout, and --error-output is misnamed since it does not
- affect error messages to stderr. Change the meaning of -o
- after 2.1. */
- error (0, 0, _("Warning: `%s' is deprecated, use `%s' instead"),
- optchar == 'o' ? "-o" : "--error-output", "--debugfile");
- /* Don't call m4_debug_set_output here, as it has side effects. */
- debugfile = optarg;
- break;
-
- case IMPORT_ENVIRONMENT_OPTION:
- import_environment = true;
- break;
-
- case SAFER_OPTION:
- m4_set_safer_opt (context, true);
- break;
-
- case VERSION_OPTION:
- version_etc (stdout, PACKAGE, PACKAGE_NAME, VERSION, AUTHORS, NULL);
- exit (EXIT_SUCCESS);
- break;
-
- case HELP_OPTION:
- usage (EXIT_SUCCESS);
- break;
- }
+ {
+ default:
+ usage (EXIT_FAILURE);
+
+ case 'H':
+ case HASHSIZE_OPTION:
+ /* -H was supported in 1.4.x, but is a no-op now. FIXME -
+ remove support for -H after 2.0. */
+ error (0, 0, _("Warning: `%s' is deprecated"),
+ optchar == 'H' ? "-H" : "--hashsize");
+ break;
+
+ case 'S':
+ case 'T':
+ /* Compatibility junk: options that other implementations
+ support, but which we ignore as no-ops and don't list in
+ --help. */
+ error (0, 0, _("Warning: `-%c' is deprecated"),
+ optchar);
+ break;
+
+ case WORD_REGEXP_OPTION:
+ /* Supported in 1.4.x as -W, but no longer present. */
+ error (0, 0, _("Warning: `%s' is deprecated"), "--word-regexp");
+ break;
+
+ case 's':
+ optchar = SYNCOUTPUT_OPTION;
+ optarg = "1";
+ /* fall through */
+ case 'D':
+ case 'U':
+ case 'm':
+ case 'p':
+ case 'r':
+ case 't':
+ case POPDEF_OPTION:
+ case SYNCOUTPUT_OPTION:
+ case TRACEOFF_OPTION:
+ case UNLOAD_MODULE_OPTION:
+ defer:
+ /* Arguments that cannot be handled until later are accumulated. */
+
+ defn = (deferred *) xmalloc (sizeof *defn);
+ defn->code = optchar;
+ defn->value = optarg;
+ defn->next = NULL;
+
+ if (head == NULL)
+ head = defn;
+ else
+ tail->next = defn;
+ tail = defn;
+ break;
+
+ case '\1':
+ seen_file = true;
+ goto defer;
+
+ case 'B':
+ /* In 1.4.x, -B<num> was a no-op option for compatibility with
+ Solaris m4. Warn if optarg is all numeric. FIXME -
+ silence this warning after 2.0. */
+ if (isdigit (to_uchar (*optarg)))
+ {
+ char *end;
+ errno = 0;
+ strtol (optarg, &end, 10);
+ if (*end == '\0' && errno == 0)
+ error (0, 0, _("Warning: recommend using `-B ./%s' instead"),
+ optarg);
+ }
+ /* fall through */
+ case PREPEND_INCLUDE_OPTION:
+ m4_add_include_directory (context, optarg, true);
+ break;
+
+ case 'E':
+ m4_debug_decode (context, "-d", SIZE_MAX);
+ if (m4_get_fatal_warnings_opt (context))
+ m4_set_warnings_exit_opt (context, true);
+ else
+ m4_set_fatal_warnings_opt (context, true);
+ break;
+
+ case 'F':
+ frozen_file_to_write = optarg;
+ break;
+
+ case 'G':
+ m4_set_posixly_correct_opt (context, true);
+ break;
+
+ case 'I':
+ m4_add_include_directory (context, optarg, false);
+ break;
+
+ case 'L':
+ size = size_opt (optarg, oi, optchar);
+ if (!size)
+ size = SIZE_MAX;
+ m4_set_nesting_limit_opt (context, size);
+ break;
+
+ case 'M':
+ if (lt_dlinsertsearchdir (lt_dlgetsearchpath (), optarg) != 0)
+ {
+ const char *dlerr = lt_dlerror ();
+ if (dlerr == NULL)
+ m4_error (context, EXIT_FAILURE, 0, NULL,
+ _("failed to add search directory %s"),
+ quotearg_style (locale_quoting_style, optarg));
+ else
+ m4_error (context, EXIT_FAILURE, 0, NULL,
+ _("failed to add search directory %s: %s"),
+ quotearg_style (locale_quoting_style, optarg),
+ dlerr);
+ }
+ break;
+
+ case 'P':
+ m4_set_prefix_builtins_opt (context, true);
+ break;
+
+ case 'Q':
+ m4_set_suppress_warnings_opt (context, true);
+ break;
+
+ case 'R':
+ frozen_file_to_read = optarg;
+ break;
+
+ case 'W':
+ /* FIXME - should W take an optional argument, to allow -Wall,
+ -Wnone, -Werror, -Wcategory, -Wno-category? If so, then have
+ -W == -Wall. */
+ m4_set_suppress_warnings_opt (context, false);
+ break;
+
+ case 'b':
+ interactive = INTERACTIVE_NO;
+ break;
+
+ case 'c':
+ m4_set_discard_comments_opt (context, true);
+ break;
+
+ case 'd':
+ /* Staggered handling of 'd', since -dm is useful prior to
+ first file and prior to reloading, but other -d must also
+ have effect between files. */
+ if (seen_file || frozen_file_to_read)
+ goto defer;
+ if (m4_debug_decode (context, optarg, SIZE_MAX) < 0)
+ error (0, 0, _("bad debug flags: %s"),
+ quotearg_style (locale_quoting_style, optarg));
+ break;
+
+ case 'e':
+ error (0, 0, _("Warning: `%s' is deprecated, use `%s' instead"),
+ "-e", "-i");
+ /* fall through */
+ case 'i':
+ interactive = INTERACTIVE_YES;
+ break;
+
+ case 'g':
+ m4_set_posixly_correct_opt (context, false);
+ break;
+
+ case ARGLENGTH_OPTION:
+ error (0, 0, _("Warning: `%s' is deprecated, use `%s' instead"),
+ "--arglength", "--debuglen");
+ /* fall through */
+ case 'l':
+ size = size_opt (optarg, oi, optchar);
+ if (!size)
+ size = SIZE_MAX;
+ m4_set_max_debug_arg_length_opt (context, size);
+ break;
+
+ case DEBUGFILE_OPTION:
+ /* Staggered handling of '--debugfile', since it is useful
+ prior to first file and prior to reloading, but other
+ uses must also have effect between files. */
+ if (seen_file || frozen_file_to_read)
+ goto defer;
+ debugfile = optarg;
+ break;
+
+ case 'o':
+ case ERROR_OUTPUT_OPTION:
+ /* FIXME: -o is inconsistent with other tools' use of
+ -o/--output for creating an output file instead of using
+ stdout, and --error-output is misnamed since it does not
+ affect error messages to stderr. Change the meaning of -o
+ after 2.1. */
+ error (0, 0, _("Warning: `%s' is deprecated, use `%s' instead"),
+ optchar == 'o' ? "-o" : "--error-output", "--debugfile");
+ /* Don't call m4_debug_set_output here, as it has side effects. */
+ debugfile = optarg;
+ break;
+
+ case IMPORT_ENVIRONMENT_OPTION:
+ import_environment = true;
+ break;
+
+ case SAFER_OPTION:
+ m4_set_safer_opt (context, true);
+ break;
+
+ case VERSION_OPTION:
+ version_etc (stdout, PACKAGE, PACKAGE_NAME, VERSION, AUTHORS, NULL);
+ exit (EXIT_SUCCESS);
+ break;
+
+ case HELP_OPTION:
+ usage (EXIT_SUCCESS);
+ break;
+ }
}
/* Interactive if specified, or if no input files and stdin and
@@ -609,10 +609,10 @@ main (int argc, char *const *argv, char *const *envp)
means unbuffered output, and interrupts ignored. */
m4_set_interactive_opt (context, (interactive == INTERACTIVE_YES
- || (interactive == INTERACTIVE_UNKNOWN
- && optind == argc && !seen_file
- && isatty (STDIN_FILENO)
- && isatty (STDERR_FILENO))));
+ || (interactive == INTERACTIVE_UNKNOWN
+ && optind == argc && !seen_file
+ && isatty (STDIN_FILENO)
+ && isatty (STDERR_FILENO))));
if (m4_get_interactive_opt (context))
{
signal (SIGINT, SIG_IGN);
@@ -625,7 +625,7 @@ main (int argc, char *const *argv, char *const *envp)
/* Do the basic initializations. */
if (debugfile && !m4_debug_set_output (context, NULL, debugfile))
m4_error (context, 0, errno, NULL, _("cannot set debug file %s"),
- quotearg_style (locale_quoting_style, debugfile));
+ quotearg_style (locale_quoting_style, debugfile));
m4_input_init (context);
m4_output_init (context);
m4_include_env_init (context);
@@ -636,9 +636,9 @@ main (int argc, char *const *argv, char *const *envp)
{
m4_module_load (context, "m4", NULL);
if (m4_get_posixly_correct_opt (context))
- m4_module_load (context, "traditional", NULL);
+ m4_module_load (context, "traditional", NULL);
else
- m4_module_load (context, "gnu", NULL);
+ m4_module_load (context, "gnu", NULL);
}
/* Import environment variables as macros. The definition are
@@ -650,13 +650,13 @@ main (int argc, char *const *argv, char *const *envp)
char *const *env;
for (env = envp; *env != NULL; env++)
- {
- defn = (deferred *) xmalloc (sizeof *defn);
- defn->code = 'D';
- defn->value = *env;
- defn->next = head;
- head = defn;
- }
+ {
+ defn = (deferred *) xmalloc (sizeof *defn);
+ defn->code = 'D';
+ defn->value = *env;
+ defn->next = head;
+ head = defn;
+ }
}
/* Handle deferred command line macro definitions. Must come after
@@ -668,96 +668,96 @@ main (int argc, char *const *argv, char *const *envp)
const char *arg = defn->value;
switch (defn->code)
- {
- case 'D':
- case 'p':
- {
- m4_symbol_value *value = m4_symbol_value_create ();
-
- const char *str = strchr (arg, '=');
- size_t len = str ? str - arg : strlen (arg);
-
- m4_set_symbol_value_text (value, xstrdup (str ? str + 1 : ""),
- str ? strlen (str + 1) : 0, 0);
-
- if (defn->code == 'D')
- m4_symbol_define (M4SYMTAB, arg, len, value);
- else
- m4_symbol_pushdef (M4SYMTAB, arg, len, value);
- }
- break;
-
- case 'U':
- m4_symbol_delete (M4SYMTAB, arg, strlen (arg));
- break;
-
- case 'd':
- if (m4_debug_decode (context, arg, SIZE_MAX) < 0)
- error (0, 0, _("bad debug flags: %s"),
- quotearg_style (locale_quoting_style, arg));
- break;
-
- case 'm':
- /* FIXME - should loading a module result in output? */
- m4_module_load (context, arg, NULL);
- break;
-
- case 'r':
- m4_set_regexp_syntax_opt (context, m4_regexp_syntax_encode (arg));
- if (m4_get_regexp_syntax_opt (context) < 0)
- m4_error (context, EXIT_FAILURE, 0, NULL,
- _("bad syntax-spec: %s"),
- quotearg_style (locale_quoting_style, arg));
- break;
-
- case 't':
- m4_set_symbol_name_traced (M4SYMTAB, arg, strlen (arg), true);
- break;
-
- case '\1':
- process_file (context, arg);
- break;
-
- case DEBUGFILE_OPTION:
- if (!m4_debug_set_output (context, NULL, arg))
- m4_error (context, 0, errno, NULL, _("cannot set debug file %s"),
- quotearg_style (locale_quoting_style,
- arg ? arg : _("stderr")));
- break;
-
- case POPDEF_OPTION:
- {
- size_t len = strlen (arg);
- if (m4_symbol_lookup (M4SYMTAB, arg, len))
- m4_symbol_popdef (M4SYMTAB, arg, len);
- }
- break;
-
- case SYNCOUTPUT_OPTION:
- {
- bool previous = m4_get_syncoutput_opt (context);
- m4_call_info info = {0};
- info.name = "--syncoutput";
- info.name_len = strlen (info.name);
- m4_set_syncoutput_opt (context,
- m4_parse_truth_arg (context, &info, arg,
- SIZE_MAX, previous));
- }
- break;
-
- case TRACEOFF_OPTION:
- m4_set_symbol_name_traced (M4SYMTAB, arg, strlen (arg), false);
- break;
-
- case UNLOAD_MODULE_OPTION:
- /* FIXME - should unloading a module result in output? */
- m4_module_unload (context, arg, NULL);
- break;
-
- default:
- assert (!"INTERNAL ERROR: bad code in deferred arguments");
- abort ();
- }
+ {
+ case 'D':
+ case 'p':
+ {
+ m4_symbol_value *value = m4_symbol_value_create ();
+
+ const char *str = strchr (arg, '=');
+ size_t len = str ? str - arg : strlen (arg);
+
+ m4_set_symbol_value_text (value, xstrdup (str ? str + 1 : ""),
+ str ? strlen (str + 1) : 0, 0);
+
+ if (defn->code == 'D')
+ m4_symbol_define (M4SYMTAB, arg, len, value);
+ else
+ m4_symbol_pushdef (M4SYMTAB, arg, len, value);
+ }
+ break;
+
+ case 'U':
+ m4_symbol_delete (M4SYMTAB, arg, strlen (arg));
+ break;
+
+ case 'd':
+ if (m4_debug_decode (context, arg, SIZE_MAX) < 0)
+ error (0, 0, _("bad debug flags: %s"),
+ quotearg_style (locale_quoting_style, arg));
+ break;
+
+ case 'm':
+ /* FIXME - should loading a module result in output? */
+ m4_module_load (context, arg, NULL);
+ break;
+
+ case 'r':
+ m4_set_regexp_syntax_opt (context, m4_regexp_syntax_encode (arg));
+ if (m4_get_regexp_syntax_opt (context) < 0)
+ m4_error (context, EXIT_FAILURE, 0, NULL,
+ _("bad syntax-spec: %s"),
+ quotearg_style (locale_quoting_style, arg));
+ break;
+
+ case 't':
+ m4_set_symbol_name_traced (M4SYMTAB, arg, strlen (arg), true);
+ break;
+
+ case '\1':
+ process_file (context, arg);
+ break;
+
+ case DEBUGFILE_OPTION:
+ if (!m4_debug_set_output (context, NULL, arg))
+ m4_error (context, 0, errno, NULL, _("cannot set debug file %s"),
+ quotearg_style (locale_quoting_style,
+ arg ? arg : _("stderr")));
+ break;
+
+ case POPDEF_OPTION:
+ {
+ size_t len = strlen (arg);
+ if (m4_symbol_lookup (M4SYMTAB, arg, len))
+ m4_symbol_popdef (M4SYMTAB, arg, len);
+ }
+ break;
+
+ case SYNCOUTPUT_OPTION:
+ {
+ bool previous = m4_get_syncoutput_opt (context);
+ m4_call_info info = {0};
+ info.name = "--syncoutput";
+ info.name_len = strlen (info.name);
+ m4_set_syncoutput_opt (context,
+ m4_parse_truth_arg (context, &info, arg,
+ SIZE_MAX, previous));
+ }
+ break;
+
+ case TRACEOFF_OPTION:
+ m4_set_symbol_name_traced (M4SYMTAB, arg, strlen (arg), false);
+ break;
+
+ case UNLOAD_MODULE_OPTION:
+ /* FIXME - should unloading a module result in output? */
+ m4_module_unload (context, arg, NULL);
+ break;
+
+ default:
+ assert (!"INTERNAL ERROR: bad code in deferred arguments");
+ abort ();
+ }
next = defn->next;
free (defn);
diff --git a/src/stackovf.c b/src/stackovf.c
index 168f01ef..bf383f0f 100644
--- a/src/stackovf.c
+++ b/src/stackovf.c
@@ -36,7 +36,7 @@
1. The siginfo parameter (with siginfo.h, i.e., SVR4).
2. 4th "addr" parameter (assumed if struct sigcontext is defined,
- i.e., SunOS 4.x/BSD).
+ i.e., SunOS 4.x/BSD).
3. None (if no method is available). This case just prints a
message before aborting with a core dump. That way the user at
@@ -168,8 +168,8 @@ process_sigsegv (int signo, const char *p)
char buf[200];
sprintf (buf,
- "process_sigsegv: p=%p stackend=%p diff=%" PRIdPTR "bot=%p\n",
- p, stackend, diff, stackbot);
+ "process_sigsegv: p=%p stackend=%p diff=%" PRIdPTR "bot=%p\n",
+ p, stackend, diff, stackbot);
write (2, buf, strlen (buf));
}
#endif
@@ -177,42 +177,42 @@ process_sigsegv (int signo, const char *p)
if (p != PARAM_NOSTACKOVF)
{
if ((long) sbrk (8192) == (long) -1)
- {
- const char *cp;
-
- /* sbrk failed. Assume the RLIMIT_VMEM prevents expansion even
- if the stack limit has not been reached. */
-
- /* FIXME - calling gettext inside a signal handler is
- dangerous, since it can call malloc, which is not signal
- safe. We can sort of justify it by the fact that this
- handler is designed to exit() the program, but it could
- really use a better fix. */
- cp = _("VMEM limit exceeded?\n");
- write (2, cp, strlen (cp));
- p = PARAM_STACKOVF;
- }
+ {
+ const char *cp;
+
+ /* sbrk failed. Assume the RLIMIT_VMEM prevents expansion even
+ if the stack limit has not been reached. */
+
+ /* FIXME - calling gettext inside a signal handler is
+ dangerous, since it can call malloc, which is not signal
+ safe. We can sort of justify it by the fact that this
+ handler is designed to exit() the program, but it could
+ really use a better fix. */
+ cp = _("VMEM limit exceeded?\n");
+ write (2, cp, strlen (cp));
+ p = PARAM_STACKOVF;
+ }
if (diff >= -STACKOVF_DETECT && diff <= STACKOVF_DETECT)
- {
+ {
- /* The fault address is "sufficiently close" to the stack lim. */
+ /* The fault address is "sufficiently close" to the stack lim. */
- p = PARAM_STACKOVF;
- }
+ p = PARAM_STACKOVF;
+ }
if (p == PARAM_STACKOVF)
- {
+ {
- /* We have determined that this is indeed a stack overflow. */
+ /* We have determined that this is indeed a stack overflow. */
- (*stackovf_handler) (); /* should call exit() */
- }
+ (*stackovf_handler) (); /* should call exit() */
+ }
}
if (p == NULL)
{
const char *cp;
/* FIXME - calling gettext inside a signal handler is dangerous,
- since it can call malloc, which is not signal safe. */
+ since it can call malloc, which is not signal safe. */
cp = _("\
Memory bounds violation detected (SIGSEGV). Either a stack overflow\n\
occurred, or there is a bug in ");
@@ -237,7 +237,7 @@ sigsegv_handler (int signo, siginfo_t *ip, void *context)
{
process_sigsegv
(signo, (ip != NULL
- && ip->si_signo == SIGSEGV ? (char *) ip->si_addr : NULL));
+ && ip->si_signo == SIGSEGV ? (char *) ip->si_addr : NULL));
}
#elif HAVE_SIGINFO_T
@@ -249,7 +249,7 @@ sigsegv_handler (int signo, siginfo_t *ip)
{
process_sigsegv
(signo, (ip != NULL
- && ip->si_signo == SIGSEGV ? (char *) ip->si_addr : NULL));
+ && ip->si_signo == SIGSEGV ? (char *) ip->si_addr : NULL));
}
#elif HAVE_SIGCONTEXT
@@ -323,17 +323,17 @@ Error - Do not know how to set up stack-ovf trap handler...
/* Grows toward increasing addresses. */
for (v = argv; (p = (char *) *v) != NULL; v++)
- {
- if (p < stackbot)
- stackbot = p;
- }
+ {
+ if (p < stackbot)
+ stackbot = p;
+ }
if ((char *) envp < stackbot)
- stackbot = (char *) envp;
+ stackbot = (char *) envp;
for (v = envp; (p = (char *) *v) != NULL; v++)
- {
- if (p < stackbot)
- stackbot = p;
- }
+ {
+ if (p < stackbot)
+ stackbot = p;
+ }
stackend = stackbot + stack_len;
}
else
@@ -342,17 +342,17 @@ Error - Do not know how to set up stack-ovf trap handler...
/* The stack grows "downward" (toward decreasing addresses). */
for (v = argv; (p = (char *) *v) != NULL; v++)
- {
- if (p > stackbot)
- stackbot = p;
- }
+ {
+ if (p > stackbot)
+ stackbot = p;
+ }
if ((char *) envp > stackbot)
- stackbot = (char *) envp;
+ stackbot = (char *) envp;
for (v = envp; (p = (char *) *v) != NULL; v++)
- {
- if (p > stackbot)
- stackbot = p;
- }
+ {
+ if (p > stackbot)
+ stackbot = p;
+ }
stackend = stackbot - stack_len;
}
@@ -378,15 +378,15 @@ Error - Do not know how to set up stack-ovf trap handler...
ss.ss_flags = 0;
if (sigaltstack (&ss, NULL) < 0)
{
- /* Oops - sigstack exists but doesn't work. We can't install
- the overflow detector, but should gracefully treat it as
- though sigstack doesn't exist. For example, this happens
- when compiled with Linux 2.1 headers but run against Linux
- 2.0 kernel. */
- free (stackbuf);
- if (errno == ENOSYS)
- return;
- error (EXIT_FAILURE, errno, "sigaltstack");
+ /* Oops - sigstack exists but doesn't work. We can't install
+ the overflow detector, but should gracefully treat it as
+ though sigstack doesn't exist. For example, this happens
+ when compiled with Linux 2.1 headers but run against Linux
+ 2.0 kernel. */
+ free (stackbuf);
+ if (errno == ENOSYS)
+ return;
+ error (EXIT_FAILURE, errno, "sigaltstack");
}
}
@@ -400,15 +400,15 @@ Error - Do not know how to set up stack-ovf trap handler...
ss.ss_onstack = 0;
if (sigstack (&ss, NULL) < 0)
{
- /* Oops - sigstack exists but doesn't work. We can't install
- the overflow detector, but should gracefully treat it as
- though sigstack doesn't exist. For example, this happens
- when compiled with Linux 2.1 headers but run against Linux
- 2.0 kernel. */
- free (stackbuf);
- if (errno == ENOSYS)
- return;
- error (EXIT_FAILURE, errno, "sigstack");
+ /* Oops - sigstack exists but doesn't work. We can't install
+ the overflow detector, but should gracefully treat it as
+ though sigstack doesn't exist. For example, this happens
+ when compiled with Linux 2.1 headers but run against Linux
+ 2.0 kernel. */
+ free (stackbuf);
+ if (errno == ENOSYS)
+ return;
+ error (EXIT_FAILURE, errno, "sigstack");
}
}
diff --git a/tests/builtins.at b/tests/builtins.at
index c35c996d..1993e6f4 100644
--- a/tests/builtins.at
+++ b/tests/builtins.at
@@ -816,7 +816,7 @@ AT_DATA([[in]],
define(`forloop', `pushdef(`$1', `$2')_forloop(`$1', `$2', `$3', `$4')popdef(`$1')')
define(`_forloop',
`$4`'ifelse($1, `$3', ,
- `define(`$1', incr($1))_forloop(`$1', `$2', `$3', `$4')')')
+ `define(`$1', incr($1))_forloop(`$1', `$2', `$3', `$4')')')
divert
forloop(`x', 1, 100, `2**x = mpeval(2**x)
')
diff --git a/tests/freeze.at b/tests/freeze.at
index 5772e770..18d1c100 100644
--- a/tests/freeze.at
+++ b/tests/freeze.at
@@ -223,9 +223,9 @@ b
D,
# Testing escape sequences
-T4,5
+T4,6
blah
-\t\477\040\X5C
+-\t\477\040\X5C
# Long macro definition. Catches a regression introduced on 2007-01-20
# and patched 2007-02-25.
T4,122
@@ -246,7 +246,7 @@ AT_CHECK_M4([-R frozen.m4f input.m4], [0],
[[< comment: builtin()
bar
- '7 \
+- '7 \
a
b]])
diff --git a/tests/generate.awk b/tests/generate.awk
index b95b6c57..a0256c82 100755
--- a/tests/generate.awk
+++ b/tests/generate.awk
@@ -80,7 +80,7 @@ BEGIN {
if ($0 ~ /^@example$/)
{
if (seq == 0)
- new_group(node);
+ new_group(node);
seq++;
printf ("echo \"$at_srcdir/%s:%d:\"\n", FILENAME, NR)
next;
@@ -89,20 +89,20 @@ BEGIN {
if ($0 ~ /^@end example$/)
{
if (file != "")
- {
- if (output || error)
- {
- fatal("while getting file " file \
- " found output = " output "," \
- " found error = " error);
- }
- input = normalize(input);
- printf ("AT_DATA([[%s]],\n[[%s]])\n\n", file, input);
- }
+ {
+ if (output || error)
+ {
+ fatal("while getting file " file \
+ " found output = " output "," \
+ " found error = " error);
+ }
+ input = normalize(input);
+ printf ("AT_DATA([[%s]],\n[[%s]])\n\n", file, input);
+ }
else
- {
- new_test(input, status, output, error, options, xfail, examples);
- }
+ {
+ new_test(input, status, output, error, options, xfail, examples);
+ }
status = xfail = examples = 0;
file = input = output = error = options = "";
next;
@@ -183,11 +183,11 @@ function new_test(input, status, output, error, options, xfail, examples) {
printf ("$SED -e \"s|examples|$abs_top_srcdir/examples|g\" \\\n");
printf (" < expout1 > expout\n\n");
if (error)
- {
- printf ("AT_DATA([experr1],\n[[%s]])\n", error);
- printf ("$SED \"s|examples|$abs_top_srcdir/examples|g\" \\\n");
- printf (" < experr1 > experr\n\n");
- }
+ {
+ printf ("AT_DATA([experr1],\n[[%s]])\n", error);
+ printf ("$SED \"s|examples|$abs_top_srcdir/examples|g\" \\\n");
+ printf (" < experr1 > experr\n\n");
+ }
options = options " -I\"$abs_top_srcdir/examples\"";
}
diff --git a/tests/modules.at b/tests/modules.at
index 976ef174..1e9b2d95 100644
--- a/tests/modules.at
+++ b/tests/modules.at
@@ -52,18 +52,18 @@ test3
# First generate the `expout' ouput by running over the sources before
# freezing.
AT_CHECK_M4([-M "$abs_builddir" -m load frozen.m4 unfrozen.m4],
- [0], [stdout], [stderr])
+ [0], [stdout], [stderr])
mv stdout expout
mv stderr experr
# Now freeze the first source file.
AT_CHECK_M4([-M "$abs_builddir" -m load -F frozen.m4f frozen.m4],
- [0], [], [ignore])
+ [0], [], [ignore])
# Now rerun the original sequence, but using the frozen file.
AT_CHECK_M4([-M "$abs_builddir" -R frozen.m4f unfrozen.m4],
- [0], [expout], [experr])
+ [0], [expout], [experr])
AT_CLEANUP([frozen.m4f])
@@ -142,22 +142,22 @@ AT_CLEANUP
AT_CHECK_M4_MODTEST([--module-directory: absolute path],
- [], [-M "$abs_builddir"])
+ [], [-M "$abs_builddir"])
AT_CHECK_M4_MODTEST([--module-directory: relative path],
- [], [-M "$top_build_prefix/tests"])
+ [], [-M "$top_build_prefix/tests"])
AT_CHECK_M4_MODTEST([M4MODPATH: absolute path],
- [M4MODPATH="$abs_builddir"], [])
+ [M4MODPATH="$abs_builddir"], [])
AT_CHECK_M4_MODTEST([M4MODPATH: relative path],
- [M4MODPATH="$top_build_prefix/tests"], [])
+ [M4MODPATH="$top_build_prefix/tests"], [])
AT_CHECK_M4_MODTEST([LTDL_LIBRARY_PATH: absolute path],
- [LTDL_LIBRARY_PATH="$abs_builddir"], [])
+ [LTDL_LIBRARY_PATH="$abs_builddir"], [])
AT_CHECK_M4_MODTEST([LTDL_LIBRARY_PATH: relative path],
- [LTDL_LIBRARY_PATH="$top_build_prefix/tests"], [])
+ [LTDL_LIBRARY_PATH="$top_build_prefix/tests"], [])
@@ -297,7 +297,7 @@ shadow: <shadow>
]])
AT_CHECK_M4([-M "$abs_builddir" -m load input.m4], [0],
- [expout], [experr])
+ [expout], [experr])
AT_CLEANUP
@@ -365,7 +365,7 @@ Test module unloaded.
AT_CHECK_M4([-M "$abs_builddir" -m load input.m4],
- [0], [expout], [experr])
+ [0], [expout], [experr])
AT_CLEANUP
@@ -417,7 +417,7 @@ m4:input.m4:7: cannot open module `no_such'
]])
AT_CHECK_M4([-M "$abs_builddir" -m load input.m4],
- [1], [expout], [experr])
+ [1], [expout], [experr])
AT_CLEANUP
@@ -502,7 +502,7 @@ m4trace: -1- test -> `Shadow::`test' called.'
AT_CHECK_M4([-M "$abs_builddir" -m load -t test input.m4],
- [0], [expout], [experr])
+ [0], [expout], [experr])
AT_CLEANUP
diff --git a/tests/others.at b/tests/others.at
index a44feca4..a5d05e16 100644
--- a/tests/others.at
+++ b/tests/others.at
@@ -248,7 +248,7 @@ AT_DATA([[forloop.m4]],
define(`forloop', `pushdef(`$1', `$2')_forloop(`$1', `$2', `$3', `$4')popdef(`$1')')
define(`_forloop',
`$4`'ifelse($1, `$3', ,
- `define(`$1', incr($1))_forloop(`$1', `$2', `$3', `$4')')')
+ `define(`$1', incr($1))_forloop(`$1', `$2', `$3', `$4')')')
divert
forloop(`x', 1, 10, `2**x = eval(2**x)
')
diff --git a/tests/stackovf.test b/tests/stackovf.test
index ba41e7ad..794e194a 100755
--- a/tests/stackovf.test
+++ b/tests/stackovf.test
@@ -26,13 +26,13 @@ exit 77
# On some systems the ulimit command is available in ksh or bash but not sh
(exec 2>/dev/null; ulimit -HSs 300) || {
for altshell in bash bsh ksh ; do
- if (exec >/dev/null 2>&1; $altshell -c 'ulimit -HSs 300') &&
- test -z "$1"
- then
- echo "Using $altshell because it supports ulimit"
- exec $altshell $0 running-with-$altshell
- exit 9
- fi
+ if (exec >/dev/null 2>&1; $altshell -c 'ulimit -HSs 300') &&
+ test -z "$1"
+ then
+ echo "Using $altshell because it supports ulimit"
+ exec $altshell $0 running-with-$altshell
+ exit 9
+ fi
done
}
@@ -48,26 +48,26 @@ perl -e '
# Generate nested define sequence
$max=1000000;
for ($i=0; $i<$max; $i++) {
- print "define(X$i,\n";
+ print "define(X$i,\n";
}
for ($i=$max-1; $i>=0; $i--) {
- print "body with substance no. $i)dnl\n"
+ print "body with substance no. $i)dnl\n"
}
' | \
(
# Limit the stack size if the shell we are running permits it
if (exec 2>/dev/null; ulimit -HSs 50)
then
- (exec >/dev/null 2>&1; ulimit -v) && ulimitdashv=ok
- ulimit -HSs 50
- #ulimit -HSd 8000
- #test -n "$ulimitdashv" && ulimit -HSv 8000
- echo "Stack limit is `ulimit -s`K";
- echo "Heap limit is `ulimit -d`K";
- test -n "$ulimitdashv" &&
- echo "VMem limit is `ulimit -v`K";
+ (exec >/dev/null 2>&1; ulimit -v) && ulimitdashv=ok
+ ulimit -HSs 50
+ #ulimit -HSd 8000
+ #test -n "$ulimitdashv" && ulimit -HSv 8000
+ echo "Stack limit is `ulimit -s`K";
+ echo "Heap limit is `ulimit -d`K";
+ test -n "$ulimitdashv" &&
+ echo "VMem limit is `ulimit -v`K";
else
- echo "Can't reset stack limit - this may take a while..."
+ echo "Can't reset stack limit - this may take a while..."
fi
#strace -o /tmp/aaa $M4 -L999999999 > $tmpfile 2>&1
$M4 -L999999999 > $tmpfile 2>&1
@@ -82,14 +82,14 @@ else
# See if stack overflow was diagnosed
case "`cat $tmpfile`" in
*overflow*)
- echo "Test succeeded.";
- exitcode=0
- ;;
+ echo "Test succeeded.";
+ exitcode=0
+ ;;
*ut*of*emory*|*emory*xhausted)
- echo "*** Test is INCONCLUSIVE (ran out of heap before stack overflow)";
- ;;
+ echo "*** Test is INCONCLUSIVE (ran out of heap before stack overflow)";
+ ;;
*) echo "*** Test FAILED. $M4 aborted unexpectedly. Output:";
- ;;
+ ;;
esac
fi
diff --git a/tests/testsuite.at b/tests/testsuite.at
index 857d9f06..0d650427 100644
--- a/tests/testsuite.at
+++ b/tests/testsuite.at
@@ -82,14 +82,14 @@ fi]])
# to m4: bad option
m4_define([AT_CHECK_M4],
[AT_CHECK([$M4 m4_ifval([$6], [], [-d ])$1 ]m4_if([$5], [-], [<&-],
- [< m4_default([$5], [/dev/null])]),
+ [< m4_default([$5], [/dev/null])]),
[$2], [$3], m4_case([$4], [], [], [ignore], [ignore], [stderr]))
m4_case([$4], [], [], [ignore], [],
[AT_CHECK([[$SED 's/^[^:]*[lt-]*m4[.ex]*:/m4:/
- /^m4debug: module/s/opening file.*/opening file/
- s/\(cannot open module [^:]*\):.*/\1/
- s/Bad file number/Bad file descriptor/
- s/^m4:.* option .*/m4: bad option/
+ /^m4debug: module/s/opening file.*/opening file/
+ s/\(cannot open module [^:]*\):.*/\1/
+ s/Bad file number/Bad file descriptor/
+ s/^m4:.* option .*/m4: bad option/
' stderr >&2]], [0], [], [$4])])
])