From f224a4967f21b643b79bf79b61d4ca6853203f28 Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Tue, 5 Jan 2010 16:17:02 -0700 Subject: More whitespace cleanup. * HACKING: Nuke trailing whitespace. * examples/WWW/Makefile: Likewise. * examples/WWW/_footer.htm: Likewise. * examples/WWW/_header.htm: Likewise. * examples/WWW/m4lib/bugs.m4: Likewise. * examples/WWW/m4lib/html.m4: Likewise. * examples/WWW/m4lib/menu.m4: Likewise. * examples/WWW/m4lib/visions.m4: Likewise. * examples/esyscmd.m4: Likewise. * examples/fstab.m4: Avoid space-tab. * examples/patsubst.m4: Likewise. * NEWS: Prefer space over tab for alignment. * THANKS: Likewise. * TODO: Likewise. * bootstrap: Likewise. * configure.ac: Likewise. * ltdl/m4/stackovf.m4: 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/system_.h: Likewise. * modules/evalparse.c: Likewise. * modules/format.c: Likewise. * modules/gnu.c: Likewise. * modules/import.c: Likewise. * modules/load.c: Likewise. * modules/m4.c: Likewise. * modules/m4.h: Likewise. * modules/modtest.c: Likewise. * modules/mpeval.c: Likewise. * modules/perl.c: Likewise. * modules/shadow.c: Likewise. * modules/stdlib.c: Likewise. * modules/time.c: Likewise. * modules/traditional.c: Likewise. * src/freeze.c: Likewise. * src/main.c: Likewise. * src/stackovf.c: Likewise. * tests/stackovf.test: Likewise. * doc/STYLE: Mention the change. Signed-off-by: Eric Blake (cherry picked from commit b30b61aa1be7659c155272135fa17a8d7528f80e) --- ChangeLog | 54 +++++ HACKING | 2 +- NEWS | 2 +- THANKS | 298 ++++++++++++------------- TODO | 2 +- bootstrap | 16 +- configure.ac | 2 +- doc/STYLE | 4 + examples/WWW/Makefile | 2 +- examples/WWW/_footer.htm | 13 +- examples/WWW/_header.htm | 17 +- examples/WWW/m4lib/bugs.m4 | 6 +- examples/WWW/m4lib/html.m4 | 26 +-- examples/WWW/m4lib/menu.m4 | 103 +++++---- examples/WWW/m4lib/visions.m4 | 30 +-- examples/esyscmd.m4 | 2 +- examples/fstab.m4 | 3 +- examples/patsubst.m4 | 2 +- ltdl/m4/stackovf.m4 | 4 +- m4/hash.c | 112 +++++----- m4/hash.h | 40 ++-- m4/input.c | 152 ++++++------- m4/m4module.h | 482 +++++++++++++++++++-------------------- m4/m4private.h | 508 +++++++++++++++++++++--------------------- m4/macro.c | 42 ++-- m4/module.c | 48 ++-- m4/output.c | 26 +-- m4/path.c | 2 +- m4/resyntax.c | 52 ++--- m4/symtab.c | 34 +-- m4/syntax.c | 92 ++++---- m4/system_.h | 30 +-- modules/evalparse.c | 44 ++-- modules/format.c | 58 ++--- modules/gnu.c | 114 +++++----- modules/import.c | 14 +- modules/load.c | 24 +- modules/m4.c | 110 ++++----- modules/m4.h | 6 +- modules/modtest.c | 24 +- modules/mpeval.c | 56 ++--- modules/perl.c | 20 +- modules/shadow.c | 20 +- modules/stdlib.c | 40 ++-- modules/time.c | 24 +- modules/traditional.c | 14 +- src/freeze.c | 198 ++++++++-------- src/main.c | 52 ++--- src/stackovf.c | 10 +- tests/stackovf.test | 2 +- 50 files changed, 1543 insertions(+), 1495 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6c7c9b68..c3d91b7c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,57 @@ +2010-01-07 Eric Blake + + More whitespace cleanup. + * HACKING: Nuke trailing whitespace. + * examples/WWW/Makefile: Likewise. + * examples/WWW/_footer.htm: Likewise. + * examples/WWW/_header.htm: Likewise. + * examples/WWW/m4lib/bugs.m4: Likewise. + * examples/WWW/m4lib/html.m4: Likewise. + * examples/WWW/m4lib/menu.m4: Likewise. + * examples/WWW/m4lib/visions.m4: Likewise. + * examples/esyscmd.m4: Likewise. + * examples/fstab.m4: Avoid space-tab. + * examples/patsubst.m4: Likewise. + * NEWS: Prefer space over tab for alignment. + * THANKS: Likewise. + * TODO: Likewise. + * bootstrap: Likewise. + * configure.ac: Likewise. + * ltdl/m4/stackovf.m4: 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/system_.h: Likewise. + * modules/evalparse.c: Likewise. + * modules/format.c: Likewise. + * modules/gnu.c: Likewise. + * modules/import.c: Likewise. + * modules/load.c: Likewise. + * modules/m4.c: Likewise. + * modules/m4.h: Likewise. + * modules/modtest.c: Likewise. + * modules/mpeval.c: Likewise. + * modules/perl.c: Likewise. + * modules/shadow.c: Likewise. + * modules/stdlib.c: Likewise. + * modules/time.c: Likewise. + * modules/traditional.c: Likewise. + * src/freeze.c: Likewise. + * src/main.c: Likewise. + * src/stackovf.c: Likewise. + * tests/stackovf.test: Likewise. + * doc/STYLE: Mention the change. + 2010-01-05 Eric Blake Document new indentation policy. diff --git a/HACKING b/HACKING index bf23427a..e7604134 100644 --- a/HACKING +++ b/HACKING @@ -337,7 +337,7 @@ yyyy-mm-dd Name of Author (tiny change) and send an email to mentioning any content that needs to be updated. --- +----------- Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. diff --git a/NEWS b/NEWS index e3d3cd8a..1488d08f 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,4 @@ -GNU m4 NEWS - History of user-visible changes. -*- outline -*- +GNU m4 NEWS - History of user-visible changes. -*- outline -*- Copyright (C) 1992, 1993, 1994, 1998, 2000, 2001, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. diff --git a/THANKS b/THANKS index 543548e9..47233273 100644 --- a/THANKS +++ b/THANKS @@ -5,155 +5,155 @@ further contributed to GNU M4 by reporting problems, suggesting various improvements or submitting actual code. Here is a list of these people. Help me keep it complete and exempt of errors. -Akiko Matsushita matusita@sra.co.jp -Akim Demaille demaille@inf.enst.fr -Alan Magnuson awm@osc.edu -Albert Chin m4-discuss@mlists.thewrittenword.com -Alexander Lehmann alex@hal.rhein-main.de -Amos Shapira amoss@cs.huji.ac.il -Andreas Büning andreas.buening@nexgo.de -Andreas Gustafsson gson@niksula.hut.fi -Andreas Schultz aschultz@warp10.net -Andreas Schwab schwab@ls5.informatik.uni-dortmund.de -Andrew Athan athan@morgan.com -Andrew Bettison andrewb@zip.com.au -Assar Westerlund assar@nada.kth.se -Ben A. Mesander ben@piglet.cr.usgs.gov -Ben Elliston bje@cygnus.com -Bengt Mertensson bengt@mathematik.uni-bremen.de -Bernhard Daeubler daeb@physik.uni-ulm.de -Bill Bumgarner bbum@thoughtport.com -Bjorn R. Bjornsson brb@falcon.is -Bob Badour bob@badour.net -Bob Proulx bob@proulx.com -Brendan Kehoe brendan@cygnus.com -Brian J. Fox bfox@datawave.net -Brian D. Carlstrom bdc@clark.lcs.mit.edu -Bruno Haible bruno@clisp.org -Cesar Strauss cestrauss@gmail.com -Charles Wilson cygwin@cwilson.fastmail.fm -Chris McGuire chris@wso.net -Damian Menscher menscher@uiuc.edu -Dan Jacobson jidanni@jidanni.org -Daniel Richard G. skunk@iskunk.org -David J. MacKenzie djm@uunet.uu.net -David Perlin davep@nanosoft.com -Elbert Pol elbert.pol@gmail.com -Elias Benali elptr@users.sourceforge.net -Erez Zadok ezk@cs.columbia.edu -Eric Allman eric@cs.berkeley.edu -Eric Backus ericb@lsid.hp.com -Eric Blake ebb9@byu.net -Eric Fischer enf1@ellis.uchicago.edu -Erick Branderhorst Erick.Branderhorst@asml.nl -Fernando Carrijo fcarrijo1980@gmail.com -François Pinard pinard@iro.umontreal.ca -Frank Schwidom schwidom@impernet.de -Gary Affonso Gary_Affonso@iqinc.com -Gary V. Vaughan gary@gnu.org -Geoff Russell grussell@guest.adelaide.edu.au -Giovanni Toffetti toffettg@lu.unisi.ch -Greg A. Woods woods@web.apc.org -Greg McGary gkm@cstone.net -Hal Peterson hrp@pecan.cray.com -Hoang Uong hoang@ornews.intel.com -Hongjiu Lu hjl@nynexst.com -Ian Taylor ian@cygnus.com -Ilya N. Golubev gin@mo.msk.ru -Jan Djarv Jan.Djarv@sa.erisoft.se -Jason Merrill jason@jarthur.claremont.edu -Jay Krell jay.krell@cornell.edu -Jean-Charles Longuet jclonguet@free.fr -Jens Rehsack rehsack@googlemail.com -Jim Avera jima@netcom.com -Jim Kingdom kingdon@cygnus.com -Jim Meyering meyering@acm.org -Joel E. Denny jdenny@ces.clemson.edu -Joel Sherrill jsherril@uahcs2.cs.uah.edu -John Brzustowski jbrzusto@fastmail.fm -John David Anglin dave@hiauly1.hia.nrc.ca -John Gatewood Ham zappaman@buraphalinux.org -John Gerard Malecki johnm@artisan.com -Josef T. Burger bolo@bolo.com -Joseph E. Sacco jsacco@ssl.com -Joseph S. Myers jsm28@cam.ac.uk -Joshua R. Poulson jrp@plaza.ds.adp.com -Karl Berry karl@freefriends.org -Karl Nelson nelson85@llnl.gov -Karl Vogel vogelke@c-17igp.wpafb.af.mil -Kaveh R. Ghazi ghazi@noc.rutgers.edu -Keith Bostic bostic@abyssinian.sleepycat.com -Konrad Schwarz konrad.schwarz@siemens.com -Kristine Lund lund@lpnaxp.in2p3.fr -Krste Asanovic krste@icsi.berkeley.edu -Lawson Chan Lawson.Chan@tdsecurities.com -M. Levinson levinsm@users.sourceforge.net -Marcus Daniels marcus@ee.pdx.edu -Marion Hakanson hakanson@cse.ogi.edu -Mark Seiden mis@seiden.com -Martin Koeppe mkoeppe@gmx.de -Massimo Dal Zotto dz@cs.unitn.it -Matt Kraai kraai@debian.org -Matthew Woehlke mw_triad@users.sourceforge.net -Matthias Rabe rabe@mathematik.uni-bielefeld.de -Mehul Sanghvi mehul.sanghvi@gmail.com -Michael Fetterman mafetter@ichips.intel.com -Michael L. Welcome welcome@bigbird.llnl.gov -Mike Andrews kramer@fragile.termfrost.org -Mike Frysinger vapier@gentoo.org -Mike Howard mike@clove.com -Mike Lijewski lijewski@theory.tc.cornell.edu -Mike R. mroberge@aol.com -Mikhail Teterin Mikhail.Teterin@murex.com -Nelson H. F. Beebe beebe@math.utah.edu -Nick S. Kanakakorn skanan@otl.scu.edu -Nicolas Lichtmaier nick@technisys.com.ar -Nicolas Pioch pioch@inf.enst.fr -Noah Friedman friedman@gnu.org -Noah Misch noah@cs.caltech.edu -Paolo Bonzini bonzini@gnu.org -Paul Eggert eggert@cs.ucla.edu -Per Bothner per@bothner.com -Pete Chown pete.chown@dale.dircon.co.uk -Pierre Gaumond gaumondp@ere.umontreal.ca -Pierre Mathieu mathieu@geod.emr.ca -Rafael Corvalan rafael@club-internet.fr -Ralf Wildenhues Ralf.Wildenhues@gmx.de -René Seindal seindal@diku.dk -Richard A Nelson cowboy@vnet.ibm.com -Richard Ling richard@research.canon.oz.au -Richard Stallman rms@gnu.org -Robert Bernstein rocky@panix.com -Robert Bihlmeyer robbe@orcus.priv.at -Roderick Koehle Roderick.Koehle@infineon.com -Roland H. Pesch roland@wrs.com -Roland McGrath roland@gnu.org -Ronny Peine RonnyPeine@gmx.de -Sami Liedes sliedes@cc.hut.fi -Santiago Vila sanvila@debian.org -Scott Bartram deneb!scottb -Sergey Poznyakoff gray@gnu.org.ua -Simon Leinen simon@lia.di.epfl.ch -Skip Montanaro skip@automatrix.com -Stepan Kasal kasal@ucw.cz -Stephen Perkins perkins@cps.msu.edu -Steve Williamson willy@uinpla.npl.uiuc.edu -Steven Augart saugart@yahoo.com -Terry Jones terry@cliffs.ucsd.edu -Thomas Klausner tk@giga.or.at -Thomas Tanner tanner@ffii.org -Thorsten Ohl ohl@physics.harvard.edu -Tom G. Christensen tgc@jupiterrise.com -Tom McConnell tmcconne@sedona.intel.com -Tom Quinn trq@dionysos.thphys.ox.ac.uk -Tom Tromey tromey@cns.caltech.edu -Ulrich Drepper drepper@gnu.org -Vern Paxson vern@ee.lbl.gov -Vic Abell abe@cc.purdue.edu -Vincent Lonngren Vincent.lonngren.759@student.lu.se -Vivek P. Singhal singhal@cs.utexas.edu -Walter Wong wcw+@cmu.edu -Yuji Minejima ggb01164@nifty.ne.jp +Akiko Matsushita matusita@sra.co.jp +Akim Demaille demaille@inf.enst.fr +Alan Magnuson awm@osc.edu +Albert Chin m4-discuss@mlists.thewrittenword.com +Alexander Lehmann alex@hal.rhein-main.de +Amos Shapira amoss@cs.huji.ac.il +Andreas Büning andreas.buening@nexgo.de +Andreas Gustafsson gson@niksula.hut.fi +Andreas Schultz aschultz@warp10.net +Andreas Schwab schwab@ls5.informatik.uni-dortmund.de +Andrew Athan athan@morgan.com +Andrew Bettison andrewb@zip.com.au +Assar Westerlund assar@nada.kth.se +Ben A. Mesander ben@piglet.cr.usgs.gov +Ben Elliston bje@cygnus.com +Bengt Mertensson bengt@mathematik.uni-bremen.de +Bernhard Daeubler daeb@physik.uni-ulm.de +Bill Bumgarner bbum@thoughtport.com +Bjorn R. Bjornsson brb@falcon.is +Bob Badour bob@badour.net +Bob Proulx bob@proulx.com +Brendan Kehoe brendan@cygnus.com +Brian J. Fox bfox@datawave.net +Brian D. Carlstrom bdc@clark.lcs.mit.edu +Bruno Haible bruno@clisp.org +Cesar Strauss cestrauss@gmail.com +Charles Wilson cygwin@cwilson.fastmail.fm +Chris McGuire chris@wso.net +Damian Menscher menscher@uiuc.edu +Dan Jacobson jidanni@jidanni.org +Daniel Richard G. skunk@iskunk.org +David J. MacKenzie djm@uunet.uu.net +David Perlin davep@nanosoft.com +Elbert Pol elbert.pol@gmail.com +Elias Benali elptr@users.sourceforge.net +Erez Zadok ezk@cs.columbia.edu +Eric Allman eric@cs.berkeley.edu +Eric Backus ericb@lsid.hp.com +Eric Blake ebb9@byu.net +Eric Fischer enf1@ellis.uchicago.edu +Erick Branderhorst Erick.Branderhorst@asml.nl +Fernando Carrijo fcarrijo1980@gmail.com +François Pinard pinard@iro.umontreal.ca +Frank Schwidom schwidom@impernet.de +Gary Affonso Gary_Affonso@iqinc.com +Gary V. Vaughan gary@gnu.org +Geoff Russell grussell@guest.adelaide.edu.au +Giovanni Toffetti toffettg@lu.unisi.ch +Greg A. Woods woods@web.apc.org +Greg McGary gkm@cstone.net +Hal Peterson hrp@pecan.cray.com +Hoang Uong hoang@ornews.intel.com +Hongjiu Lu hjl@nynexst.com +Ian Taylor ian@cygnus.com +Ilya N. Golubev gin@mo.msk.ru +Jan Djarv Jan.Djarv@sa.erisoft.se +Jason Merrill jason@jarthur.claremont.edu +Jay Krell jay.krell@cornell.edu +Jean-Charles Longuet jclonguet@free.fr +Jens Rehsack rehsack@googlemail.com +Jim Avera jima@netcom.com +Jim Kingdom kingdon@cygnus.com +Jim Meyering meyering@acm.org +Joel E. Denny jdenny@ces.clemson.edu +Joel Sherrill jsherril@uahcs2.cs.uah.edu +John Brzustowski jbrzusto@fastmail.fm +John David Anglin dave@hiauly1.hia.nrc.ca +John Gatewood Ham zappaman@buraphalinux.org +John Gerard Malecki johnm@artisan.com +Josef T. Burger bolo@bolo.com +Joseph E. Sacco jsacco@ssl.com +Joseph S. Myers jsm28@cam.ac.uk +Joshua R. Poulson jrp@plaza.ds.adp.com +Karl Berry karl@freefriends.org +Karl Nelson nelson85@llnl.gov +Karl Vogel vogelke@c-17igp.wpafb.af.mil +Kaveh R. Ghazi ghazi@noc.rutgers.edu +Keith Bostic bostic@abyssinian.sleepycat.com +Konrad Schwarz konrad.schwarz@siemens.com +Kristine Lund lund@lpnaxp.in2p3.fr +Krste Asanovic krste@icsi.berkeley.edu +Lawson Chan Lawson.Chan@tdsecurities.com +M. Levinson levinsm@users.sourceforge.net +Marcus Daniels marcus@ee.pdx.edu +Marion Hakanson hakanson@cse.ogi.edu +Mark Seiden mis@seiden.com +Martin Koeppe mkoeppe@gmx.de +Massimo Dal Zotto dz@cs.unitn.it +Matt Kraai kraai@debian.org +Matthew Woehlke mw_triad@users.sourceforge.net +Matthias Rabe rabe@mathematik.uni-bielefeld.de +Mehul Sanghvi mehul.sanghvi@gmail.com +Michael Fetterman mafetter@ichips.intel.com +Michael L. Welcome welcome@bigbird.llnl.gov +Mike Andrews kramer@fragile.termfrost.org +Mike Frysinger vapier@gentoo.org +Mike Howard mike@clove.com +Mike Lijewski lijewski@theory.tc.cornell.edu +Mike R. mroberge@aol.com +Mikhail Teterin Mikhail.Teterin@murex.com +Nelson H. F. Beebe beebe@math.utah.edu +Nick S. Kanakakorn skanan@otl.scu.edu +Nicolas Lichtmaier nick@technisys.com.ar +Nicolas Pioch pioch@inf.enst.fr +Noah Friedman friedman@gnu.org +Noah Misch noah@cs.caltech.edu +Paolo Bonzini bonzini@gnu.org +Paul Eggert eggert@cs.ucla.edu +Per Bothner per@bothner.com +Pete Chown pete.chown@dale.dircon.co.uk +Pierre Gaumond gaumondp@ere.umontreal.ca +Pierre Mathieu mathieu@geod.emr.ca +Rafael Corvalan rafael@club-internet.fr +Ralf Wildenhues Ralf.Wildenhues@gmx.de +René Seindal seindal@diku.dk +Richard A Nelson cowboy@vnet.ibm.com +Richard Ling richard@research.canon.oz.au +Richard Stallman rms@gnu.org +Robert Bernstein rocky@panix.com +Robert Bihlmeyer robbe@orcus.priv.at +Roderick Koehle Roderick.Koehle@infineon.com +Roland H. Pesch roland@wrs.com +Roland McGrath roland@gnu.org +Ronny Peine RonnyPeine@gmx.de +Sami Liedes sliedes@cc.hut.fi +Santiago Vila sanvila@debian.org +Scott Bartram deneb!scottb +Sergey Poznyakoff gray@gnu.org.ua +Simon Leinen simon@lia.di.epfl.ch +Skip Montanaro skip@automatrix.com +Stepan Kasal kasal@ucw.cz +Stephen Perkins perkins@cps.msu.edu +Steve Williamson willy@uinpla.npl.uiuc.edu +Steven Augart saugart@yahoo.com +Terry Jones terry@cliffs.ucsd.edu +Thomas Klausner tk@giga.or.at +Thomas Tanner tanner@ffii.org +Thorsten Ohl ohl@physics.harvard.edu +Tom G. Christensen tgc@jupiterrise.com +Tom McConnell tmcconne@sedona.intel.com +Tom Quinn trq@dionysos.thphys.ox.ac.uk +Tom Tromey tromey@cns.caltech.edu +Ulrich Drepper drepper@gnu.org +Vern Paxson vern@ee.lbl.gov +Vic Abell abe@cc.purdue.edu +Vincent Lonngren Vincent.lonngren.759@student.lu.se +Vivek P. Singhal singhal@cs.utexas.edu +Walter Wong wcw+@cmu.edu +Yuji Minejima ggb01164@nifty.ne.jp ======================================================================== diff --git a/TODO b/TODO index 04b6b96d..d60dd209 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,4 @@ -GNU m4 TODO - Tasks that need implementing. -*- outline -*- +GNU m4 TODO - Tasks that need implementing. -*- outline -*- Copyright (C) 2000, 2001, 2006, 2007, 2008, 2010 Free Software Foundation, Inc. diff --git a/bootstrap b/bootstrap index 74273c05..ad123046 100755 --- a/bootstrap +++ b/bootstrap @@ -214,14 +214,14 @@ func_update () opt="$1" shift case $opt in - -f|--force) vcs_only_file= ;; - --skip-po) SKIP_PO=t ;; - -\?|-h) func_usage ;; - --help) func_help ;; - --version) func_version ;; - --) break ;; - -*) func_fatal_help "unrecognized option \`$opt'" ;; - *) set -- "$opt" ${1+"$@"}; break ;; + -f|--force) vcs_only_file= ;; + --skip-po) SKIP_PO=t ;; + -\?|-h) func_usage ;; + --help) func_help ;; + --version) func_version ;; + --) break ;; + -*) func_fatal_help "unrecognized option \`$opt'" ;; + *) set -- "$opt" ${1+"$@"}; break ;; esac done diff --git a/configure.ac b/configure.ac index df885eac..d778da27 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -# Configure template for GNU m4. -*-Autoconf-*- +# Configure template for GNU m4. -*-Autoconf-*- # Copyright (C) 1991, 1992, 1993, 1994, 2000, 2001, 2002, 2004, 2005, # 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. # diff --git a/doc/STYLE b/doc/STYLE index 60a30005..54aebbc7 100644 --- a/doc/STYLE +++ b/doc/STYLE @@ -4,6 +4,10 @@ Before all else this code follows the GNU coding standards and indentation style described in standards.info. Additionally the following restrictions on coding style apply: +* SPACING + + + Avoid TABs in .h and .c files. See HACKING for details. + * C STANDARD + All of this code is ANSI-C, GNU C extensions are conditional so that diff --git a/examples/WWW/Makefile b/examples/WWW/Makefile index 3bc98a16..c296ccf4 100644 --- a/examples/WWW/Makefile +++ b/examples/WWW/Makefile @@ -14,7 +14,7 @@ M4LIB = m4lib/bugs.m4 m4lib/changelog.m4 m4lib/download.m4 \ m4lib/modules.m4 m4lib/news.m4 m4lib/readme.m4 \ m4lib/setup.m4 m4lib/test.m4 m4lib/thanks.m4 \ m4lib/thissite.m4 m4lib/tmpl.m4 m4lib/todo.m4 m4lib/uses.m4 \ - m4lib/visions.m4 m4lib/whatis.m4 + m4lib/visions.m4 m4lib/whatis.m4 all: ./m4 $(HTM) diff --git a/examples/WWW/_footer.htm b/examples/WWW/_footer.htm index 8fbbce61..6bed8f2c 100644 --- a/examples/WWW/_footer.htm +++ b/examples/WWW/_footer.htm @@ -1,15 +1,10 @@ - - - - + - + - + - - - + diff --git a/examples/WWW/_header.htm b/examples/WWW/_header.htm index 850e308b..1aea7999 100644 --- a/examples/WWW/_header.htm +++ b/examples/WWW/_header.htm @@ -1,8 +1,8 @@ -GNU m4 - Development site - +GNU m4 - Development site + @@ -11,11 +11,11 @@

GNU m4

- +

Discussion Forum

- + - + @@ -217,7 +217,7 @@ - + @@ -226,9 +226,6 @@ - + - - - diff --git a/examples/WWW/m4lib/bugs.m4 b/examples/WWW/m4lib/bugs.m4 index 82a12955..5d8e5f52 100644 --- a/examples/WWW/m4lib/bugs.m4 +++ b/examples/WWW/m4lib/bugs.m4 @@ -15,7 +15,7 @@ this myself.])]) \ul([ -\item([undivert], [undivert(0) might read from standard output], +\item([undivert], [undivert(0) might read from standard output], [\p([If calling \tt(undivert(0)) when diverting to a non-zero diversion will cause m4 to read from standard output in an attempt to bring back @@ -25,7 +25,7 @@ diversion 0, which is not possible.]) ]) -\item([sigaltstack], [failure if sigaltstack or sigstack returns ENOSYS], +\item([sigaltstack], [failure if sigaltstack or sigstack returns ENOSYS], [\p([If stack overflow detection is configured but the system doesn't support sigaltstack(2) or sigstack(2), m4 fails when the system call @@ -45,7 +45,7 @@ returns ENOSYS. It should silently revert to default behaviour.]) \divert(-1) -\item([], [], +\item([], [], [\p([]) diff --git a/examples/WWW/m4lib/html.m4 b/examples/WWW/m4lib/html.m4 index 6e076bd6..94ed69ed 100644 --- a/examples/WWW/m4lib/html.m4 +++ b/examples/WWW/m4lib/html.m4 @@ -2,30 +2,30 @@ ]) \define([concat], [\ifelse($#, 0, , - $#, 1, [$1], - [$1 \concat(\shift($@))])]) + $#, 1, [$1], + [$1 \concat(\shift($@))])]) \define([toupper], [\translit([$*], [a-z], [A-Z])]) -\define([container], +\define([container], [\pushdef([_tag], \toupper([$1]))\dnl \ifelse($#, 1, [<\_tag>], - $#, 2, [<\_tag>$2], - $#, 3, [<\_tag $2>$3], - [<\_tag $2>\concat(\shift(\shift($@)))])\dnl + $#, 2, [<\_tag>$2], + $#, 3, [<\_tag $2>$3], + [<\_tag $2>\concat(\shift(\shift($@)))])\dnl \popdef([_tag])\dnl ]) -\define([large_container], +\define([large_container], [\pushdef([_tag], \toupper([$1]))\dnl \ifelse($#, 1, [<\_tag>\n], - $#, 2, [<\_tag>\n[]$2\n\n], - $#, 3, [<\_tag $2>\n[]$3\n\n], - [<\_tag $2>\n\concat(\shift(\shift($@)))\n\n])\dnl + $#, 2, [<\_tag>\n[]$2\n\n], + $#, 3, [<\_tag $2>\n[]$3\n\n], + [<\_tag $2>\n\concat(\shift(\shift($@)))\n\n])\dnl \popdef([_tag])\dnl ]) -\define([large_simple_container], +\define([large_simple_container], [\pushdef([_tag], \toupper([$1]))\dnl <\_tag>\n\concat(\shift($@))\n\n\dnl \popdef([_tag])\dnl @@ -37,7 +37,7 @@ \popdef([_tag])\dnl ]) -\define([simple_tag], +\define([simple_tag], [\pushdef([_tag], \toupper([$1]))\dnl \ifelse([$2], [], [<\_tag>], [<\_tag $2>])\dnl \popdef([_tag])\dnl @@ -117,6 +117,6 @@ \define([set_body], [\define([_BODY], [$*])]) \set_body() -\define([meta_if_set], +\define([meta_if_set], [\ifelse(\defn([_$1]), [], [], \meta([$1], \defn([_$1])))]\dnl ) diff --git a/examples/WWW/m4lib/menu.m4 b/examples/WWW/m4lib/menu.m4 index 74315554..78c8edfd 100644 --- a/examples/WWW/m4lib/menu.m4 +++ b/examples/WWW/m4lib/menu.m4 @@ -1,72 +1,71 @@ - \pushdef([header], [\tr([\td([\C_BG3], [\p([\b([$1])])])])]) \pushdef([separator], [\tr([\td([height=5], [])])]) \pushdef([_row], [\link([$1], [$2])]) -\pushdef([_rows], +\pushdef([_rows], [\ifelse($#, 0, [], - $#, 1, [], - $#, 2, [\_row([$1], [$2])], - $#, 3, [\_row([$1], [$2])], - [\_row([$1], [$2])\br\n\_rows(\shift(\shift($@)))])]) + $#, 1, [], + $#, 2, [\_row([$1], [$2])], + $#, 3, [\_row([$1], [$2])], + [\_row([$1], [$2])\br\n\_rows(\shift(\shift($@)))])]) \pushdef([rows], [\tr([\td([\p([\font([size=-1], [\b([\_rows($@)])])])])])]) \table([], - [\header([General info])], - [\rows( - [whatis.htm], [What is m4], - [features.htm], [Features], - [uses.htm], [Uses of m4], - )], - [\separator], + [\header([General info])], + [\rows( + [whatis.htm], [What is m4], + [features.htm], [Features], + [uses.htm], [Uses of m4], + )], + [\separator], - [\header([Documentation])], - [\rows( - [man/m4_toc.html], [Manual], - )], - [\separator], + [\header([Documentation])], + [\rows( + [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], - )], - [\separator], + [\header([Source files])], + [\rows( + [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], - )], - [\separator], + [\header([The Future])], + [\rows( + [modules.htm], [Modules], + [visions.htm], [Visions], + )], + [\separator], - [\header([Feedback])], - [\rows( - [lists.htm], [Mailing-lists], - [feedback.htm], [Feedback], - [/forum/list.php3?num=2], [Discussion Forum], - )], - [\separator], + [\header([Feedback])], + [\rows( + [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], - )], - [\separator], + [\header([Development])], + [\rows( + [download.htm], [Download], + [bugs.htm], [Known bugs], + )], + [\separator], - [\header([Examples])], - [\rows( - [thissite.htm], [This site], - )], - ) + [\header([Examples])], + [\rows( + [thissite.htm], [This site], + )], +) \popdef([header]) \popdef([rows]) diff --git a/examples/WWW/m4lib/visions.m4 b/examples/WWW/m4lib/visions.m4 index 49033de4..ba238ca9 100644 --- a/examples/WWW/m4lib/visions.m4 +++ b/examples/WWW/m4lib/visions.m4 @@ -3,7 +3,7 @@ include(`setup.m4') \set_author([René Seindal]) \set_title([The Road Ahead]) -\define([originator], +\define([originator], [\p([Idea contributed by [$1]]\ifelse($#, 2, [ (\mailto([$2]))])[.])]) \define([noone], [\p([There is no-one working on this now. Do you want @@ -21,7 +21,7 @@ and small. The order here is fairly random.]) \ul([ -\item([guile], [Guile as an extension language], +\item([guile], [Guile as an extension language], [\p([\link([http://www.red-bean.com/guile/], [Guile]) can be used as an extension language so complicated macros can be written in Scheme while @@ -32,7 +32,7 @@ base code, as guile cannot be used from a module.]) ]) -\item([utf8], [UTF-8 or wide characters], +\item([utf8], [UTF-8 or wide characters], [\p([GNU m4 should be able to handle UTF-8 input or wide characters so it can be more usable for different environments.]) @@ -41,7 +41,7 @@ it can be more usable for different environments.]) ]) -\item([pquote], [Syntax: persistent quotes], +\item([pquote], [Syntax: persistent quotes], [\p([Persistent quotes is a way of getting text unharmed through m4's processing. While normal quotes are stripped when a quoted string is @@ -61,7 +61,7 @@ macro.c).]) -\item([comment2], [Syntax: removable comments], +\item([comment2], [Syntax: removable comments], [\p([With the syntax table a category for discardable comments can be defined, causing that type of comments to be discarded.]) @@ -72,17 +72,17 @@ defined, causing that type of comments to be discarded.]) -\item([comment1], [Option: remove comments], +\item([comment1], [Option: remove comments], [\p([There should be an option (--discard-comments) to get m4 to discard -comments instead of passing them to the output.]) +comments instead of passing them to the output.]) \done(n) ]) -\item([deps], [Option: show dependencies], +\item([deps], [Option: show dependencies], [\p([There should be an options to generate makefile dependencies for an M4 input file.]) @@ -99,7 +99,7 @@ generated on the fly.]) ]) -\item([safer], [Option: render GNU m4 safer], +\item([safer], [Option: render GNU m4 safer], [\p([There should be a --safer option that disables all functions, that could compromise system security if used by root. It will have to @@ -111,7 +111,7 @@ loading, ...]) -\item([import], [Option: import environment], +\item([import], [Option: import environment], [\p([An option to defined each environment variable as a macro on startup would be useful in many cases.]) @@ -121,7 +121,7 @@ startup would be useful in many cases.]) -\item([m4expand], [Builtin: quote expanded text], +\item([m4expand], [Builtin: quote expanded text], [\p([A builtin to quote expanded text would be useful. Now it is not possible to quote the expansion of a macro; the macro itself has to @@ -138,7 +138,7 @@ expands this argument fully and returns the quoted expansion.]) -\item([perl], [Module: embedded perl], +\item([perl], [Module: embedded perl], [\p([Perl could be embedded in m4, giving users a powerful programming language for writing macros. A single builtin "perleval" could do the @@ -162,7 +162,7 @@ would be minimal.]) -\item([output], [Module: better output control], +\item([output], [Module: better output control], [\p([It has been suggested a couple of times that it should be possible to divert to named files, in order to create several output files.]) @@ -191,7 +191,7 @@ different, as it cannot be undiverted.)]) -\item([require], [Module: require/provide functionality], +\item([require], [Module: require/provide functionality], [\p([Two new builtins \tt(require) and \tt(provide) could provide a handy interface to include. It has proven difficult to write these @@ -222,7 +222,7 @@ the search path.]) -\item([], [], +\item([], [], [\p([]) diff --git a/examples/esyscmd.m4 b/examples/esyscmd.m4 index d5276df4..3c856e02 100644 --- a/examples/esyscmd.m4 +++ b/examples/esyscmd.m4 @@ -1,6 +1,6 @@ # Cannot use real hostname program because test would fail define(`hostname', esyscmd(`echo www.gnu.org'))dnl `hostname = >>'hostname`<<' -define(`hostname', +define(`hostname', pushdef(`_tmp', `$1')_tmp(translit(esyscmd(`echo www.gnu.org'), `.', `,'))`'popdef(`_tmp'))dnl `hostname = >>'hostname`<<' diff --git a/examples/fstab.m4 b/examples/fstab.m4 index dbf538ae..8d10e176 100644 --- a/examples/fstab.m4 +++ b/examples/fstab.m4 @@ -1,7 +1,6 @@ -define(`concat', `translit(``$*'', ` ')') +define(`concat', `translit(``$*'', ` ')') define(`fsent', `format(`%-25s %-16s nfs %-16s 0 0', `$1:$2', `$3', concat$4)') fsent(freja, /home/gevn, /home/gevn, (rw, soft, bg, grpid)) fsent(freja, /home/freja, /home/freja, (rw, soft, grpid)) fsent(rimfaxe, /home/rimfaxe, /home/rimfaxe, (rw, soft, bg)) - diff --git a/examples/patsubst.m4 b/examples/patsubst.m4 index 37fe9de3..9b4c7591 100644 --- a/examples/patsubst.m4 +++ b/examples/patsubst.m4 @@ -5,4 +5,4 @@ patsubst(`GNUs not Unix.', `\<\w', `\0=') patsubst(`GNUs not Unix.', `\w*', `(\0)') patsubst(`GNUs not Unix.', `\w+', `(\0)') patsubst(`GNUs not Unix.', `\w+') -patsubst(`GNUs not Unix.', `[ ]+', ` ') +patsubst(`GNUs not '` Unix.', `[ ]+', ` ') diff --git a/ltdl/m4/stackovf.m4 b/ltdl/m4/stackovf.m4 index 57e4acce..8b9232ef 100644 --- a/ltdl/m4/stackovf.m4 +++ b/ltdl/m4/stackovf.m4 @@ -19,7 +19,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# serial 5 +# serial 6 # M4_SYS_STACKOVF # --------------- @@ -51,7 +51,7 @@ if test "$ac_cv_func_sigaction" = yes || test "$ac_cv_func_sigvec" = yes; then ]], [[struct rlimit r; getrlimit (RLIMIT_STACK, &r); #if (!defined(HAVE_SIGACTION) || !defined(SA_ONSTACK)) \ && (!defined(HAVE_SIGVEC) || !defined(SV_ONSTACK)) -choke me /* SA_ONSTACK and/or SV_ONSTACK are not defined */ +choke me /* SA_ONSTACK and/or SV_ONSTACK are not defined */ #endif ]])], [M4_cv_use_stackovf=yes]) fi diff --git a/m4/hash.c b/m4/hash.c index 94221457..9f00e7c3 100644 --- a/m4/hash.c +++ b/m4/hash.c @@ -36,13 +36,13 @@ typedef struct hash_node hash_node; struct m4_hash { - size_t size; /* number of buckets allocated */ - size_t length; /* number of elements inserted */ + size_t size; /* number of buckets allocated */ + size_t length; /* number of elements inserted */ m4_hash_hash_func *hash_func; m4_hash_cmp_func *cmp_func; hash_node **buckets; #ifndef NDEBUG - m4_hash_iterator *iter; /* current iterator */ + m4_hash_iterator *iter; /* current iterator */ #endif }; @@ -56,57 +56,57 @@ struct hash_node struct m4_hash_iterator { - const m4_hash *hash; /* contains the buckets */ - hash_node * place; /* the node we are about to return */ - hash_node * next; /* the next node, incase PLACE is removed */ - size_t next_bucket; /* the next bucket index following NEXT */ + const m4_hash *hash; /* contains the buckets */ + hash_node * place; /* the node we are about to return */ + hash_node * next; /* the next node, incase PLACE is removed */ + size_t next_bucket; /* the next bucket index following NEXT */ #ifndef NDEBUG - m4_hash_iterator *chain; /* multiple iterators visiting one hash */ + m4_hash_iterator *chain; /* multiple iterators visiting one hash */ #endif }; -#define HASH_SIZE(hash) ((hash)->size) -#define HASH_LENGTH(hash) ((hash)->length) -#define HASH_BUCKETS(hash) ((hash)->buckets) -#define HASH_HASH_FUNC(hash) ((hash)->hash_func) -#define HASH_CMP_FUNC(hash) ((hash)->cmp_func) +#define HASH_SIZE(hash) ((hash)->size) +#define HASH_LENGTH(hash) ((hash)->length) +#define HASH_BUCKETS(hash) ((hash)->buckets) +#define HASH_HASH_FUNC(hash) ((hash)->hash_func) +#define HASH_CMP_FUNC(hash) ((hash)->cmp_func) -#define NODE_NEXT(node) ((node)->next) -#define NODE_KEY(node) ((node)->key) -#define NODE_VALUE(node) ((node)->value) +#define NODE_NEXT(node) ((node)->next) +#define NODE_KEY(node) ((node)->key) +#define NODE_VALUE(node) ((node)->value) -#define ITERATOR_HASH(i) ((i)->hash) -#define ITERATOR_PLACE(i) ((i)->place) -#define ITERATOR_NEXT(i) ((i)->next) -#define ITERATOR_NEXT_BUCKET(i) ((i)->next_bucket) +#define ITERATOR_HASH(i) ((i)->hash) +#define ITERATOR_PLACE(i) ((i)->place) +#define ITERATOR_NEXT(i) ((i)->next) +#define ITERATOR_NEXT_BUCKET(i) ((i)->next_bucket) #define ITERATOR_NEXT_NEXT(i) NODE_NEXT (ITERATOR_PLACE (i)) /* Helper macros. */ -#define BUCKET_NTH(hash, n) (HASH_BUCKETS (hash)[n]) -#define BUCKET_COUNT(hash, key) \ +#define BUCKET_NTH(hash, n) (HASH_BUCKETS (hash)[n]) +#define BUCKET_COUNT(hash, key) \ ((*HASH_HASH_FUNC (hash))(key) % HASH_SIZE (hash)) -#define BUCKET_KEY(hash, key) \ +#define BUCKET_KEY(hash, key) \ (BUCKET_NTH ((hash), BUCKET_COUNT ((hash), (key)))) /* Debugging macros. */ #ifdef NDEBUG -# define HASH_ITER(hash) 0 -# define ITER_CHAIN(iter) 0 +# define HASH_ITER(hash) 0 +# define ITER_CHAIN(iter) 0 #else -# define HASH_ITER(hash) (((m4_hash *) hash)->iter) -# define ITER_CHAIN(iter) ((iter)->chain) +# define HASH_ITER(hash) (((m4_hash *) hash)->iter) +# define ITER_CHAIN(iter) ((iter)->chain) #endif -static void bucket_insert (m4_hash *hash, hash_node *bucket); -static void bucket_delete (m4_hash *hash, size_t i); -static hash_node * node_new (const void *key, void *value); -static void node_insert (m4_hash *hash, hash_node *node); -static hash_node * node_lookup (m4_hash *hash, const void *key); -static void node_delete (m4_hash *hash, hash_node *node); -static void maybe_grow (m4_hash *hash); +static void bucket_insert (m4_hash *hash, hash_node *bucket); +static void bucket_delete (m4_hash *hash, size_t i); +static hash_node * node_new (const void *key, void *value); +static void node_insert (m4_hash *hash, hash_node *node); +static hash_node * node_lookup (m4_hash *hash, const void *key); +static void node_delete (m4_hash *hash, hash_node *node); +static void maybe_grow (m4_hash *hash); @@ -129,15 +129,15 @@ m4_hash_new (size_t size, m4_hash_hash_func *hash_func, if (size == 0) size = M4_HASH_DEFAULT_SIZE; - hash = (m4_hash *) xmalloc (sizeof *hash); - HASH_SIZE (hash) = size; - HASH_LENGTH (hash) = 0; - HASH_BUCKETS (hash) = (hash_node **) xcalloc (size, + hash = (m4_hash *) xmalloc (sizeof *hash); + HASH_SIZE (hash) = size; + HASH_LENGTH (hash) = 0; + HASH_BUCKETS (hash) = (hash_node **) xcalloc (size, sizeof *HASH_BUCKETS (hash)); - HASH_HASH_FUNC (hash) = hash_func; - HASH_CMP_FUNC (hash) = cmp_func; + HASH_HASH_FUNC (hash) = hash_func; + HASH_CMP_FUNC (hash) = cmp_func; #ifndef NDEBUG - HASH_ITER (hash) = NULL; + HASH_ITER (hash) = NULL; #endif return hash; @@ -200,9 +200,9 @@ bucket_delete (m4_hash *hash, size_t i) assert (NODE_KEY (node) == NULL); --HASH_LENGTH (hash); - NODE_NEXT (node) = free_list; - free_list = BUCKET_NTH (hash, i); - BUCKET_NTH (hash, i) = NULL; + NODE_NEXT (node) = free_list; + free_list = BUCKET_NTH (hash, i); + BUCKET_NTH (hash, i) = NULL; } /* Create and initialise a new node with KEY and VALUE, by reusing a @@ -214,7 +214,7 @@ node_new (const void *key, void *value) if (free_list) { - node = free_list; + node = free_list; free_list = NODE_NEXT (free_list); } else @@ -222,9 +222,9 @@ node_new (const void *key, void *value) assert (node); - NODE_NEXT (node) = NULL; - NODE_KEY (node) = key; - NODE_VALUE (node) = value; + NODE_NEXT (node) = NULL; + NODE_KEY (node) = key; + NODE_VALUE (node) = value; return node; } @@ -236,8 +236,8 @@ node_delete (m4_hash *hash, hash_node *node) assert (node); assert (NODE_KEY (node) == NULL); - NODE_NEXT (node) = free_list; - free_list = node; + NODE_NEXT (node) = free_list; + free_list = node; --HASH_LENGTH (hash); } @@ -276,8 +276,8 @@ node_insert (m4_hash *hash, hash_node *node) assert (NODE_NEXT (node) == NULL); n = BUCKET_COUNT (hash, NODE_KEY (node)); - NODE_NEXT (node) = BUCKET_NTH (hash, n); - BUCKET_NTH (hash, n) = node; + NODE_NEXT (node) = BUCKET_NTH (hash, n); + BUCKET_NTH (hash, n) = node; ++HASH_LENGTH (hash); } @@ -396,10 +396,10 @@ m4_hash_resize (m4_hash *hash, size_t size) assert (hash); assert (!HASH_ITER (hash)); - original_size = HASH_SIZE (hash); - original_buckets = HASH_BUCKETS (hash); + original_size = HASH_SIZE (hash); + original_buckets = HASH_BUCKETS (hash); - HASH_SIZE (hash) = size; + HASH_SIZE (hash) = size; HASH_BUCKETS (hash) = (hash_node **) xcalloc (size, sizeof *HASH_BUCKETS (hash)); @@ -616,7 +616,7 @@ void * m4_hash_apply (m4_hash *hash, m4_hash_apply_func *func, void *userdata) { m4_hash_iterator *place = NULL; - void * result = NULL; + void * result = NULL; assert (hash); assert (func); diff --git a/m4/hash.h b/m4/hash.h index 385f0866..4dc9540a 100644 --- a/m4/hash.h +++ b/m4/hash.h @@ -25,53 +25,53 @@ /* Must be 1 less than a power of 2 for the resize algorithm to be efficient. */ -#define M4_HASH_DEFAULT_SIZE 511 +#define M4_HASH_DEFAULT_SIZE 511 /* When the average number of values per bucket breaks this value the table will be grown to reduce the density accordingly. */ -#define M4_HASH_MAXIMUM_DENSITY 3.0 +#define M4_HASH_MAXIMUM_DENSITY 3.0 BEGIN_C_DECLS 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, +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); -extern m4_hash *m4_hash_new (size_t size, m4_hash_hash_func *hash_func, +extern m4_hash *m4_hash_new (size_t size, m4_hash_hash_func *hash_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); +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); -extern size_t m4_get_hash_length (m4_hash *hash); +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, +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); -extern size_t m4_hash_string_hash (const void *key); -extern int m4_hash_string_cmp (const void *key, const void *try); +extern size_t m4_hash_string_hash (const void *key); +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, +typedef void * m4_hash_apply_func (m4_hash *hash, const void *key, void *value, void *userdata); -extern void * m4_hash_apply (m4_hash *hash, m4_hash_apply_func *func, +extern void * m4_hash_apply (m4_hash *hash, m4_hash_apply_func *func, 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 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); -extern void m4_free_hash_iterator (const m4_hash *hash, +extern void m4_free_hash_iterator (const m4_hash *hash, m4_hash_iterator *place); diff --git a/m4/input.c b/m4/input.c index c8e42cf2..3804b669 100644 --- a/m4/input.c +++ b/m4/input.c @@ -100,54 +100,54 @@ 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, +static int file_peek (m4_input_block *, m4 *, bool); +static int file_read (m4_input_block *, m4 *, 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 *, +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); -static const char * file_buffer (m4_input_block *, m4 *, size_t *, +static const char * file_buffer (m4_input_block *, m4 *, size_t *, 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, +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); -static void string_unget (m4_input_block *, int); -static void string_print (m4_input_block *, m4 *, m4_obstack *, +static void string_unget (m4_input_block *, int); +static void string_print (m4_input_block *, m4 *, m4_obstack *, int); -static const char * string_buffer (m4_input_block *, m4 *, size_t *, +static const char * string_buffer (m4_input_block *, m4 *, size_t *, 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, +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); -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 *, +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); -static const char * composite_buffer (m4_input_block *, m4 *, size_t *, +static const char * composite_buffer (m4_input_block *, m4 *, size_t *, 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, +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); -static void eof_unget (m4_input_block *, int); -static const char * eof_buffer (m4_input_block *, m4 *, size_t *, +static void eof_unget (m4_input_block *, int); +static const char * eof_buffer (m4_input_block *, m4 *, size_t *, bool); -static void init_builtin_token (m4 *, m4_obstack *, +static void init_builtin_token (m4 *, m4_obstack *, m4_symbol_value *); -static void append_quote_token (m4 *, m4_obstack *, +static void append_quote_token (m4 *, m4_obstack *, 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); -static bool pop_input (m4 *, bool); -static void unget_input (int); -static const char * next_buffer (m4 *, size_t *, bool); -static void consume_buffer (m4 *, size_t); -static bool consume_syntax (m4 *, m4_obstack *, unsigned int); +static bool match_input (m4 *, const char *, size_t, bool); +static int next_char (m4 *, bool, bool, bool); +static int peek_char (m4 *, bool); +static bool pop_input (m4 *, bool); +static void unget_input (int); +static const char * next_buffer (m4 *, size_t *, bool); +static void consume_buffer (m4 *, size_t); +static bool consume_syntax (m4 *, m4_obstack *, unsigned int); #ifdef DEBUG_INPUT # include "quotearg.h" @@ -162,28 +162,28 @@ struct input_funcs /* Peek at input, return an unsigned char, CHAR_BUILTIN if it is a builtin, or CHAR_RETRY if none available. If ALLOW_ARGV, then CHAR_ARGV may be returned. */ - int (*peek_func) (m4_input_block *, m4 *, bool); + int (*peek_func) (m4_input_block *, m4 *, bool); /* Read input, return an unsigned char, CHAR_BUILTIN if it is a builtin, or CHAR_RETRY if none available. If ALLOW_QUOTE, then CHAR_QUOTE may be returned. If ALLOW_ARGV, then CHAR_ARGV may be 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, + int (*read_func) (m4_input_block *, m4 *, bool allow_quote, bool allow_argv, bool allow_unget); /* Unread a single unsigned character or CHAR_BUILTIN, must be the same character previously read by read_func. */ - void (*unget_func) (m4_input_block *, int); + void (*unget_func) (m4_input_block *, int); /* Optional function to perform cleanup at end of input. If CLEANUP, it is safe to perform non-recoverable cleanup actions. Return true only if no cleanup remains to be done. */ - bool (*clean_func) (m4_input_block *, m4 *, bool cleanup); + bool (*clean_func) (m4_input_block *, m4 *, bool cleanup); /* Add a representation of the input block to the obstack, for use in trace expansion output. */ - void (*print_func) (m4_input_block *, m4 *, m4_obstack *, int); + void (*print_func) (m4_input_block *, m4 *, m4_obstack *, int); /* Return a pointer to the current readahead buffer, and set LEN to the length of the result. If ALLOW_QUOTE, do not return a buffer @@ -203,33 +203,33 @@ struct input_funcs /* A block of input to be scanned. */ struct m4_input_block { - m4_input_block *prev; /* Previous input_block on the input stack. */ - struct input_funcs *funcs; /* Virtual functions of this input_block. */ - const char *file; /* File where this input is from. */ - int line; /* Line where this input is from. */ + m4_input_block *prev; /* Previous input_block on the input stack. */ + struct input_funcs *funcs; /* Virtual functions of this input_block. */ + const char *file; /* File where this input is from. */ + int line; /* Line where this input is from. */ 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. */ + 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. */ + 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_c; /* See composite_funcs. */ } u; }; @@ -1240,7 +1240,7 @@ pop_input (m4 *context, bool cleanup) obstack_free (current_input, isp); m4__quote_uncache (M4SYNTAX); - next = NULL; /* might be set in m4_push_string_init () */ + next = NULL; /* might be set in m4_push_string_init () */ isp = tmp; input_change = true; @@ -1477,8 +1477,8 @@ peek_char (m4 *context, bool allow_argv) ch = block->funcs->peek_func (block, context, allow_argv); if (ch != CHAR_RETRY) { -/* if (IS_IGNORE (ch)) */ -/* return next_char (context, false, true, false); */ +/* if (IS_IGNORE (ch)) */ +/* return next_char (context, false, true, false); */ return ch; } @@ -1591,8 +1591,8 @@ m4_skip_line (m4 *context, const m4_call_info *caller) static bool match_input (m4 *context, const char *s, size_t len, bool consume) { - int n; /* number of characters matched */ - int ch; /* input character */ + int n; /* number of characters matched */ + int ch; /* input character */ const char *t; m4_obstack *st; bool result = false; @@ -1621,7 +1621,7 @@ match_input (m4 *context, const char *s, size_t len, bool consume) { if (consume) next_char (context, false, false, false); - return true; /* short match */ + return true; /* short match */ } next_char (context, false, false, false); @@ -1629,7 +1629,7 @@ 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 (--len == 1) /* long match */ { if (consume) return true; @@ -1657,9 +1657,9 @@ match_input (m4 *context, const char *s, size_t len, bool consume) successful match will discard the matched string. Otherwise, CH is the result of peek_char, and the input stream is effectively unchanged. */ -#define MATCH(C, ch, cat, s, len, consume) \ - (m4_has_syntax (m4_get_syntax_table (C), ch, cat) \ - || (to_uchar ((s)[0]) == (ch) \ +#define MATCH(C, ch, cat, s, len, consume) \ + (m4_has_syntax (m4_get_syntax_table (C), ch, cat) \ + || (to_uchar ((s)[0]) == (ch) \ && ((len) >> 1 ? match_input (C, s, len, consume) : (len)))) /* While the current input character has the given SYNTAX, append it @@ -1800,7 +1800,7 @@ m4__next_token (m4 *context, m4_symbol_value *token, int *line, *line = m4_get_current_line (context); file = m4_get_current_file (context); } - if (ch == CHAR_EOF) /* EOF */ + if (ch == CHAR_EOF) /* EOF */ { #ifdef DEBUG_INPUT xfprintf (stderr, "next_token -> EOF\n"); @@ -1808,7 +1808,7 @@ m4__next_token (m4 *context, m4_symbol_value *token, int *line, return M4_TOKEN_EOF; } - if (ch == CHAR_BUILTIN) /* BUILTIN TOKEN */ + if (ch == CHAR_BUILTIN) /* BUILTIN TOKEN */ { init_builtin_token (context, obs, token); #ifdef DEBUG_INPUT @@ -1826,7 +1826,7 @@ m4__next_token (m4 *context, m4_symbol_value *token, int *line, } if (m4_has_syntax (M4SYNTAX, ch, M4_SYNTAX_ESCAPE)) - { /* ESCAPED WORD */ + { /* ESCAPED WORD */ obstack_1grow (&token_stack, ch); if ((ch = next_char (context, false, false, false)) < CHAR_EOF) { @@ -1837,7 +1837,7 @@ m4__next_token (m4 *context, m4_symbol_value *token, int *line, type = M4_TOKEN_WORD; } else - type = M4_TOKEN_SIMPLE; /* escape before eof */ + type = M4_TOKEN_SIMPLE; /* escape before eof */ } else if (m4_has_syntax (M4SYNTAX, ch, M4_SYNTAX_ALPHA)) { @@ -1851,7 +1851,7 @@ m4__next_token (m4 *context, m4_symbol_value *token, int *line, else if (MATCH (context, ch, M4_SYNTAX_LQUOTE, context->syntax->quote.str1, context->syntax->quote.len1, true)) - { /* QUOTED STRING */ + { /* QUOTED STRING */ if (obs) obs_safe = obs; quote_level = 1; @@ -1961,7 +1961,7 @@ m4__next_token (m4 *context, m4_symbol_value *token, int *line, else if (MATCH (context, ch, M4_SYNTAX_BCOMM, context->syntax->comm.str1, context->syntax->comm.len1, true)) - { /* COMMENT */ + { /* COMMENT */ if (obs && !m4_get_discard_comments_opt (context)) obs_safe = obs; if (1 < context->syntax->comm.len1) @@ -2044,27 +2044,27 @@ m4__next_token (m4 *context, m4_symbol_value *token, int *line, ? M4_TOKEN_NONE : M4_TOKEN_COMMENT); } else if (m4_has_syntax (M4SYNTAX, ch, M4_SYNTAX_ACTIVE)) - { /* ACTIVE CHARACTER */ + { /* ACTIVE CHARACTER */ obstack_1grow (&token_stack, ch); type = M4_TOKEN_WORD; } else if (m4_has_syntax (M4SYNTAX, ch, M4_SYNTAX_OPEN)) - { /* OPEN PARENTHESIS */ + { /* OPEN PARENTHESIS */ obstack_1grow (&token_stack, ch); type = M4_TOKEN_OPEN; } else if (m4_has_syntax (M4SYNTAX, ch, M4_SYNTAX_COMMA)) - { /* COMMA */ + { /* COMMA */ obstack_1grow (&token_stack, ch); type = M4_TOKEN_COMMA; } else if (m4_has_syntax (M4SYNTAX, ch, M4_SYNTAX_CLOSE)) - { /* CLOSE PARENTHESIS */ + { /* CLOSE PARENTHESIS */ obstack_1grow (&token_stack, ch); type = M4_TOKEN_CLOSE; } else - { /* EVERYTHING ELSE */ + { /* EVERYTHING ELSE */ assert (ch < CHAR_EOF); obstack_1grow (&token_stack, ch); if (m4_has_syntax (M4SYNTAX, ch, M4_SYNTAX_OTHER | M4_SYNTAX_NUM)) @@ -2163,7 +2163,7 @@ m4_print_token (m4 *context, const char *s, m4__token_type type, s = "m4input"; xfprintf (stderr, "%s: ", s); switch (type) - { /* TOKSW */ + { /* TOKSW */ case M4_TOKEN_EOF: fputs ("eof", stderr); token = NULL; diff --git a/m4/m4module.h b/m4/m4module.h index d1bd4aec..fa245ece 100644 --- a/m4/m4module.h +++ b/m4/m4module.h @@ -31,17 +31,17 @@ BEGIN_C_DECLS /* --- MODULE AUTHOR DECLARATIONS --- */ -typedef struct m4 m4; -typedef struct m4_builtin m4_builtin; -typedef struct m4_call_info m4_call_info; -typedef struct m4_macro m4_macro; -typedef struct m4_macro_args m4_macro_args; -typedef struct m4_module m4_module; -typedef struct obstack m4_obstack; -typedef struct m4_string m4_string; -typedef struct m4_string_pair m4_string_pair; -typedef struct m4_symbol m4_symbol; -typedef struct m4_symbol_value m4_symbol_value; +typedef struct m4 m4; +typedef struct m4_builtin m4_builtin; +typedef struct m4_call_info m4_call_info; +typedef struct m4_macro m4_macro; +typedef struct m4_macro_args m4_macro_args; +typedef struct m4_module m4_module; +typedef struct obstack m4_obstack; +typedef struct m4_string m4_string; +typedef struct m4_string_pair m4_string_pair; +typedef struct m4_symbol m4_symbol; +typedef struct m4_symbol_value m4_symbol_value; typedef void m4_builtin_func (m4 *, m4_obstack *, size_t, m4_macro_args *); @@ -51,26 +51,26 @@ enum { tokens, to the empty string prior to invoking the builtin; if clear, non-text tokens must be transparently handled by the builtin. May only be set if max_args is nonzero. */ - M4_BUILTIN_FLATTEN_ARGS = (1 << 0), + M4_BUILTIN_FLATTEN_ARGS = (1 << 0), /* Set if macro should only be recognized with arguments; may only be set if min_args is nonzero. */ - M4_BUILTIN_BLIND = (1 << 1), + M4_BUILTIN_BLIND = (1 << 1), /* Set if macro has side effects even when there are too few arguments; may only be set if min_args is nonzero. */ - M4_BUILTIN_SIDE_EFFECT = (1 << 2), + M4_BUILTIN_SIDE_EFFECT = (1 << 2), /* Mask of valid flag bits. Any other bits must be set to 0. */ - M4_BUILTIN_FLAGS_MASK = (1 << 3) - 1 + M4_BUILTIN_FLAGS_MASK = (1 << 3) - 1 }; struct m4_builtin { - m4_builtin_func * func; /* implementation of the builtin */ - const char * name; /* name found by builtin, printed by dumpdef */ - int flags; /* bitwise OR of M4_BUILTIN_* bits */ - size_t min_args; /* 0-based minimum number of arguments */ + m4_builtin_func * func; /* implementation of the builtin */ + const char * name; /* name found by builtin, printed by dumpdef */ + int flags; /* bitwise OR of M4_BUILTIN_* bits */ + size_t min_args; /* 0-based minimum number of arguments */ /* max arguments, SIZE_MAX if unlimited; must be >= min_args */ - size_t max_args; + size_t max_args; }; struct m4_macro @@ -85,31 +85,31 @@ struct m4_macro /* Describe a single string, such as a macro name. */ struct m4_string { - char *str; /* Array of characters, possibly including NUL. */ - size_t len; /* Length of string. */ + char *str; /* Array of characters, possibly including NUL. */ + size_t len; /* Length of string. */ }; /* Describe a pair of strings, such as begin and end quotes. */ struct m4_string_pair { - char *str1; /* First string. */ - size_t len1; /* First length. */ - char *str2; /* Second string. */ - size_t len2; /* Second length. */ + char *str1; /* First string. */ + size_t len1; /* First length. */ + char *str2; /* Second string. */ + size_t len2; /* Second length. */ }; /* Declare a prototype for the function "builtin_". Note that the function name includes any macro expansion of NAME. */ -#define M4BUILTIN(name) \ - static void CONC (builtin_, name) \ +#define M4BUILTIN(name) \ + static void CONC (builtin_, name) \ (m4 *, m4_obstack *, size_t, m4_macro_args *); /* Begin the implementation of the function "builtin_", declaring parameter names that can be used by other helper macros in this file. Note that the function name includes any macro expansion of NAME. */ -#define M4BUILTIN_HANDLER(name) \ - static void CONC (builtin_, name) \ +#define M4BUILTIN_HANDLER(name) \ + static void CONC (builtin_, name) \ (m4 *context, m4_obstack *obs, size_t argc, m4_macro_args *argv) /* Declare a prototype, then begin the implementation of the function @@ -117,10 +117,10 @@ struct m4_string_pair as the initialization function for module NAME. Note that NAME is intentionally used literally, rather than subjected to macro expansion. */ -#define M4INIT_HANDLER(name) \ - void name ## _LTX_m4_init_module \ - (m4 *, m4_module *, m4_obstack *); \ - void name ## _LTX_m4_init_module \ +#define M4INIT_HANDLER(name) \ + void name ## _LTX_m4_init_module \ + (m4 *, m4_module *, m4_obstack *); \ + void name ## _LTX_m4_init_module \ (m4 *context, m4_module *module, m4_obstack *obs) /* Declare a prototype, then begin the implementation of the function @@ -128,17 +128,17 @@ struct m4_string_pair as the cleanup function for module NAME. Note that NAME is intentionally used literally, rather than subjected to macro expansion. */ -#define M4FINISH_HANDLER(name) \ - void name ## _LTX_m4_finish_module \ - (m4 *, m4_module *, m4_obstack *); \ - void name ## _LTX_m4_finish_module \ +#define M4FINISH_HANDLER(name) \ + void name ## _LTX_m4_finish_module \ + (m4 *, m4_module *, m4_obstack *); \ + void name ## _LTX_m4_finish_module \ (m4 *context, m4_module *module, m4_obstack *obs) /* Declare a variable S of type "_func" to be a pointer to the function named S imported from the module M, or NULL if the import fails. Note that M and S are intentionally used literally rather than subjected to macro expansion, in all but the variable name. */ -#define M4_MODULE_IMPORT(M, S) \ +#define M4_MODULE_IMPORT(M, S) \ S ## _func *S = (S ## _func *) m4_module_import (context, #M, #S, obs) /* Build an entry in a builtin table, for the builtin N implemented by @@ -149,13 +149,13 @@ struct m4_string_pair MAX arguments. Note that N is subject to macro expansion, and that NAME is generally used as #N to avoid clashes with builtins named after a standard function that is defined as a macro. */ -#define M4BUILTIN_ENTRY(N, NAME, M, B, S, MIN, MAX) \ - { \ - CONC (builtin_, N), NAME, \ - (((!(M) && (MAX)) ? M4_BUILTIN_FLATTEN_ARGS : 0) \ - | (((B) && (MIN)) ? M4_BUILTIN_BLIND : 0) \ - | (((S) && (MIN)) ? M4_BUILTIN_SIDE_EFFECT : 0)), \ - MIN, MAX \ +#define M4BUILTIN_ENTRY(N, NAME, M, B, S, MIN, MAX) \ + { \ + CONC (builtin_, N), NAME, \ + (((!(M) && (MAX)) ? M4_BUILTIN_FLATTEN_ARGS : 0) \ + | (((B) && (MIN)) ? M4_BUILTIN_BLIND : 0) \ + | (((S) && (MIN)) ? M4_BUILTIN_SIDE_EFFECT : 0)), \ + MIN, MAX \ }, /* Grab the text contents of argument I, or abort if the argument is @@ -168,14 +168,14 @@ struct m4_string_pair `m4_macro_args *argv' are in scope. */ #define M4ARGLEN(i) m4_arg_len (context, argv, i, false) -extern bool m4_bad_argc (m4 *, size_t, const m4_call_info *, size_t, +extern bool m4_bad_argc (m4 *, size_t, const m4_call_info *, size_t, size_t, bool); -extern bool m4_numeric_arg (m4 *, const m4_call_info *, const char *, +extern bool m4_numeric_arg (m4 *, const m4_call_info *, const char *, size_t, int *); -extern bool m4_parse_truth_arg (m4 *, const m4_call_info *, const char *, +extern bool m4_parse_truth_arg (m4 *, const m4_call_info *, const char *, 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 *); +extern const char *m4_info_name (const m4_call_info *); /* Error handling. */ extern void m4_error (m4 *, int, int, const m4_call_info *, const char *, ...) @@ -183,61 +183,61 @@ extern void m4_error (m4 *, int, int, const m4_call_info *, const char *, ...) extern void m4_warn (m4 *, int, const m4_call_info *, const char *, ...) M4_GNUC_PRINTF (4, 5); -extern const char * m4_get_program_name (void); -extern void m4_set_program_name (const char *); -extern void m4_set_exit_failure (int); +extern const char * m4_get_program_name (void); +extern void m4_set_program_name (const char *); +extern void m4_set_exit_failure (int); /* --- CONTEXT MANAGEMENT --- */ -typedef struct m4_syntax_table m4_syntax_table; -typedef struct m4_symbol_table m4_symbol_table; - -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) \ - - -#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) \ - - -#define M4FIELD(type, base, field) \ - extern type CONC (m4_get_, base) (m4 *context); \ +typedef struct m4_syntax_table m4_syntax_table; +typedef struct m4_symbol_table m4_symbol_table; + +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) \ + + +#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) \ + + +#define M4FIELD(type, base, field) \ + extern type CONC (m4_get_, base) (m4 *context); \ extern type CONC (m4_set_, base) (m4 *context, type value); m4_context_field_table #undef M4FIELD -#define M4OPT_BIT(bit, base) \ - extern bool CONC (m4_get_, base) (m4 *context); \ +#define M4OPT_BIT(bit, base) \ + extern bool CONC (m4_get_, base) (m4 *context); \ extern bool CONC (m4_set_, base) (m4 *context, bool value); m4_context_opt_bit_table #undef M4OPT_BIT -#define M4SYMTAB (m4_get_symbol_table (context)) -#define M4SYNTAX (m4_get_syntax_table (context)) +#define M4SYMTAB (m4_get_symbol_table (context)) +#define M4SYNTAX (m4_get_syntax_table (context)) @@ -248,13 +248,13 @@ typedef void m4_module_finish_func (m4 *, m4_module *, m4_obstack *); extern m4_module * m4_module_load (m4 *, const char *, m4_obstack *); 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 *, +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 *); extern const char * m4_get_module_name (const m4_module *); -extern void m4__module_exit (m4 *); +extern void m4__module_exit (m4 *); @@ -265,8 +265,8 @@ typedef void *m4_symtab_apply_func (m4_symbol_table *, const char *, size_t, 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, +extern void m4_symtab_delete (m4_symbol_table *); +extern void * m4_symtab_apply (m4_symbol_table *, bool, m4_symtab_apply_func *, void *); extern m4_symbol *m4_symbol_lookup (m4_symbol_table *, const char *, size_t); @@ -280,100 +280,100 @@ extern m4_symbol *m4_symbol_rename (m4_symbol_table *, const char *, size_t, extern void m4_symbol_delete (m4_symbol_table *, const char *, size_t); -#define m4_symbol_delete(symtab, name, len) M4_STMT_START \ - { \ - while (m4_symbol_lookup (symtab, name, len)) \ - m4_symbol_popdef (symtab, name, len); \ +#define m4_symbol_delete(symtab, name, len) M4_STMT_START \ + { \ + while (m4_symbol_lookup (symtab, name, len)) \ + m4_symbol_popdef (symtab, name, len); \ } M4_STMT_END -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 *, +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); -extern void m4_symbol_print (m4 *, m4_symbol *, m4_obstack *, +extern void m4_symbol_print (m4 *, m4_symbol *, m4_obstack *, const m4_string_pair *, bool, size_t, bool); -extern bool m4_symbol_value_flatten_args (m4_symbol_value *); +extern bool m4_symbol_value_flatten_args (m4_symbol_value *); -#define m4_is_symbol_void(symbol) \ +#define m4_is_symbol_void(symbol) \ (m4_is_symbol_value_void (m4_get_symbol_value (symbol))) -#define m4_is_symbol_text(symbol) \ +#define m4_is_symbol_text(symbol) \ (m4_is_symbol_value_text (m4_get_symbol_value (symbol))) -#define m4_is_symbol_func(symbol) \ +#define m4_is_symbol_func(symbol) \ (m4_is_symbol_value_func (m4_get_symbol_value (symbol))) -#define m4_is_symbol_placeholder(symbol) \ +#define m4_is_symbol_placeholder(symbol) \ (m4_is_symbol_value_placeholder (m4_get_symbol_value (symbol))) -#define m4_get_symbol_text(symbol) \ +#define m4_get_symbol_text(symbol) \ (m4_get_symbol_value_text (m4_get_symbol_value (symbol))) -#define m4_get_symbol_len(symbol) \ +#define m4_get_symbol_len(symbol) \ (m4_get_symbol_value_len (m4_get_symbol_value (symbol))) -#define m4_get_symbol_func(symbol) \ +#define m4_get_symbol_func(symbol) \ (m4_get_symbol_value_func (m4_get_symbol_value (symbol))) -#define m4_get_symbol_builtin(symbol) \ +#define m4_get_symbol_builtin(symbol) \ (m4_get_symbol_value_builtin (m4_get_symbol_value (symbol))) -#define m4_get_symbol_placeholder(symbol) \ +#define m4_get_symbol_placeholder(symbol) \ (m4_get_symbol_value_placeholder (m4_get_symbol_value (symbol))) -#define m4_symbol_flatten_args(symbol) \ +#define m4_symbol_flatten_args(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 *, +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 *); -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 *); -extern bool m4_is_symbol_value_void (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 *); +extern bool m4_is_symbol_value_void (m4_symbol_value *); -extern const char * m4_get_symbol_value_text (m4_symbol_value *); -extern size_t m4_get_symbol_value_len (m4_symbol_value *); -extern unsigned int m4_get_symbol_value_quote_age (m4_symbol_value *); +extern const char * m4_get_symbol_value_text (m4_symbol_value *); +extern size_t m4_get_symbol_value_len (m4_symbol_value *); +extern unsigned int m4_get_symbol_value_quote_age (m4_symbol_value *); extern m4_builtin_func *m4_get_symbol_value_func (m4_symbol_value *); -extern const m4_builtin *m4_get_symbol_value_builtin (m4_symbol_value *); -extern const char * m4_get_symbol_value_placeholder (m4_symbol_value *); +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 *, +extern void m4_set_symbol_value_text (m4_symbol_value *, const char *, size_t, unsigned int); -extern void m4_set_symbol_value_placeholder (m4_symbol_value *, +extern void m4_set_symbol_value_placeholder (m4_symbol_value *, const char *); /* --- BUILTIN MANAGEMENT --- */ -extern m4_symbol_value *m4_builtin_find_by_name (m4_module *, const char *); -extern m4_symbol_value *m4_builtin_find_by_func (m4_module *, +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 *); /* --- MACRO MANAGEMENT --- */ -extern void m4_macro_expand_input (m4 *); -extern void m4_macro_call (m4 *, m4_symbol_value *, m4_obstack *, +extern void m4_macro_expand_input (m4 *); +extern void m4_macro_call (m4 *, m4_symbol_value *, m4_obstack *, 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); -extern bool m4_is_arg_text (m4_macro_args *, size_t); -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, +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); +extern bool m4_is_arg_text (m4_macro_args *, size_t); +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); -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 *, +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); -extern void m4_push_arg (m4 *, m4_obstack *, m4_macro_args *, +extern void m4_push_arg (m4 *, m4_obstack *, m4_macro_args *, size_t); -extern void m4_push_args (m4 *, m4_obstack *, m4_macro_args *, +extern void m4_push_args (m4 *, m4_obstack *, m4_macro_args *, bool, bool); -extern void m4_wrap_args (m4 *, m4_macro_args *); +extern void m4_wrap_args (m4 *, m4_macro_args *); /* --- RUNTIME DEBUGGING --- */ @@ -381,187 +381,187 @@ extern void m4_wrap_args (m4 *, m4_macro_args *); /* The value of debug_level is a bitmask of the following: */ enum { /* a: show arglist in trace output */ - M4_DEBUG_TRACE_ARGS = (1 << 0), + M4_DEBUG_TRACE_ARGS = (1 << 0), /* e: show expansion in trace output */ - M4_DEBUG_TRACE_EXPANSION = (1 << 1), + M4_DEBUG_TRACE_EXPANSION = (1 << 1), /* q: quote args and expansion in trace output */ - M4_DEBUG_TRACE_QUOTE = (1 << 2), + M4_DEBUG_TRACE_QUOTE = (1 << 2), /* t: trace all macros -- overrides trace{on,off} */ - M4_DEBUG_TRACE_ALL = (1 << 3), + M4_DEBUG_TRACE_ALL = (1 << 3), /* l: add line numbers to trace output */ - M4_DEBUG_TRACE_LINE = (1 << 4), + M4_DEBUG_TRACE_LINE = (1 << 4), /* f: add file name to trace output */ - M4_DEBUG_TRACE_FILE = (1 << 5), + M4_DEBUG_TRACE_FILE = (1 << 5), /* p: trace path search of include files */ - M4_DEBUG_TRACE_PATH = (1 << 6), + M4_DEBUG_TRACE_PATH = (1 << 6), /* c: show macro call before args collection */ - M4_DEBUG_TRACE_CALL = (1 << 7), + M4_DEBUG_TRACE_CALL = (1 << 7), /* i: trace changes of input files */ - M4_DEBUG_TRACE_INPUT = (1 << 8), + M4_DEBUG_TRACE_INPUT = (1 << 8), /* x: add call id to trace output */ - M4_DEBUG_TRACE_CALLID = (1 << 9), + M4_DEBUG_TRACE_CALLID = (1 << 9), /* m: trace module actions */ - M4_DEBUG_TRACE_MODULE = (1 << 10), + M4_DEBUG_TRACE_MODULE = (1 << 10), /* s: trace pushdef stacks */ - M4_DEBUG_TRACE_STACK = (1 << 11), + M4_DEBUG_TRACE_STACK = (1 << 11), /* d: warn if dereferencing undefined macro */ - M4_DEBUG_TRACE_DEREF = (1 << 12), + M4_DEBUG_TRACE_DEREF = (1 << 12), /* o: output dumpdef to stderr, not debug file */ - M4_DEBUG_TRACE_OUTPUT_DUMPDEF = (1 << 13), + M4_DEBUG_TRACE_OUTPUT_DUMPDEF = (1 << 13), /* V: very verbose -- print everything */ - M4_DEBUG_TRACE_VERBOSE = ((1 << 14) - 1) + M4_DEBUG_TRACE_VERBOSE = ((1 << 14) - 1) }; /* initial flags, used if no -d or -E -- equiv: d */ #define M4_DEBUG_TRACE_INITIAL M4_DEBUG_TRACE_DEREF /* default flags, used by debugmode() -- equiv: +adeq */ -#define M4_DEBUG_TRACE_DEFAULT \ +#define M4_DEBUG_TRACE_DEFAULT \ (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) +#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 *, +extern int m4_debug_decode (m4 *, const char *, size_t); +extern bool m4_debug_set_output (m4 *, const m4_call_info *, const char *); -extern void m4_debug_message_prefix (m4 *); -extern void m4_debug_message (m4 *, int, 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 *, +extern void m4_trace_prepare (m4 *, const m4_call_info *, m4_symbol_value *); /* --- REGEXP SYNTAX --- */ -extern const char * m4_regexp_syntax_decode (int); -extern int m4_regexp_syntax_encode (const char *); +extern const char * m4_regexp_syntax_decode (int); +extern int m4_regexp_syntax_encode (const char *); /* --- SYNTAX TABLE DEFINITIONS --- */ -extern m4_syntax_table *m4_syntax_create (void); -extern void m4_syntax_delete (m4_syntax_table *syntax); -extern int m4_syntax_code (char ch); +extern m4_syntax_table *m4_syntax_create (void); +extern void m4_syntax_delete (m4_syntax_table *syntax); +extern int m4_syntax_code (char ch); -extern const char * m4_get_syntax_lquote (m4_syntax_table *syntax); -extern const char * m4_get_syntax_rquote (m4_syntax_table *syntax); -extern const char * m4_get_syntax_bcomm (m4_syntax_table *syntax); -extern const char * m4_get_syntax_ecomm (m4_syntax_table *syntax); -extern const m4_string_pair *m4_get_syntax_quotes (m4_syntax_table *); -extern const m4_string_pair *m4_get_syntax_comments (m4_syntax_table *); +extern const char * m4_get_syntax_lquote (m4_syntax_table *syntax); +extern const char * m4_get_syntax_rquote (m4_syntax_table *syntax); +extern const char * m4_get_syntax_bcomm (m4_syntax_table *syntax); +extern const char * m4_get_syntax_ecomm (m4_syntax_table *syntax); +extern const m4_string_pair *m4_get_syntax_quotes (m4_syntax_table *); +extern const m4_string_pair *m4_get_syntax_comments (m4_syntax_table *); -extern bool m4_is_syntax_single_quotes (m4_syntax_table *); -extern bool m4_is_syntax_single_comments (m4_syntax_table *); -extern bool m4_is_syntax_single_dollar (m4_syntax_table *); -extern bool m4_is_syntax_macro_escaped (m4_syntax_table *); +extern bool m4_is_syntax_single_quotes (m4_syntax_table *); +extern bool m4_is_syntax_single_comments (m4_syntax_table *); +extern bool m4_is_syntax_single_dollar (m4_syntax_table *); +extern bool m4_is_syntax_macro_escaped (m4_syntax_table *); /* These are values to be assigned to syntax table entries. Although they are bit masks for fast categorization in m4__next_token(), only one value per syntax table entry is allowed. The enumeration is currently sorted in order of parsing precedence. */ enum { - M4_SYNTAX_IGNORE = 0, - M4_SYNTAX_ESCAPE = 1 << 0, - M4_SYNTAX_ALPHA = 1 << 1, - M4_SYNTAX_LQUOTE = 1 << 2, - M4_SYNTAX_BCOMM = 1 << 3, - M4_SYNTAX_ACTIVE = 1 << 4, - M4_SYNTAX_NUM = 1 << 5, - M4_SYNTAX_SPACE = 1 << 6, - M4_SYNTAX_OPEN = 1 << 7, - M4_SYNTAX_CLOSE = 1 << 8, - M4_SYNTAX_COMMA = 1 << 9, - M4_SYNTAX_OTHER = 1 << 10, + M4_SYNTAX_IGNORE = 0, + M4_SYNTAX_ESCAPE = 1 << 0, + M4_SYNTAX_ALPHA = 1 << 1, + M4_SYNTAX_LQUOTE = 1 << 2, + M4_SYNTAX_BCOMM = 1 << 3, + M4_SYNTAX_ACTIVE = 1 << 4, + M4_SYNTAX_NUM = 1 << 5, + M4_SYNTAX_SPACE = 1 << 6, + M4_SYNTAX_OPEN = 1 << 7, + M4_SYNTAX_CLOSE = 1 << 8, + M4_SYNTAX_COMMA = 1 << 9, + M4_SYNTAX_OTHER = 1 << 10, /* These values are bit masks to OR with categories above, a syntax entry may have any number of these in addition to a maximum of one of the values above. */ - M4_SYNTAX_DOLLAR = 1 << 11, - M4_SYNTAX_LBRACE = 1 << 12, - M4_SYNTAX_RBRACE = 1 << 13, - M4_SYNTAX_RQUOTE = 1 << 14, - M4_SYNTAX_ECOMM = 1 << 15 + M4_SYNTAX_DOLLAR = 1 << 11, + M4_SYNTAX_LBRACE = 1 << 12, + M4_SYNTAX_RBRACE = 1 << 13, + M4_SYNTAX_RQUOTE = 1 << 14, + M4_SYNTAX_ECOMM = 1 << 15 }; /* Mask of attribute syntax categories. */ -#define M4_SYNTAX_MASKS (M4_SYNTAX_RQUOTE | M4_SYNTAX_ECOMM \ - | M4_SYNTAX_DOLLAR | M4_SYNTAX_LBRACE \ +#define M4_SYNTAX_MASKS (M4_SYNTAX_RQUOTE | M4_SYNTAX_ECOMM \ + | 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 \ +#define M4_SYNTAX_SUSPECT (M4_SYNTAX_LQUOTE | M4_SYNTAX_BCOMM \ | M4_SYNTAX_ESCAPE) -#define m4_syntab(S, C) ((S)->table[(C)]) +#define m4_syntab(S, C) ((S)->table[(C)]) /* Determine if character C matches any of the bitwise-or'd syntax categories T for the given syntax table S. C can be either an unsigned int (including special values such as CHAR_BUILTIN) or a char which will be interpreted as an unsigned char. */ -#define m4_has_syntax(S, C, T) \ +#define m4_has_syntax(S, C, T) \ ((m4_syntab ((S), sizeof (C) == 1 ? to_uchar (C) : (C)) & (T)) > 0) -extern void m4_set_quotes (m4_syntax_table *, const char *, size_t, +extern void m4_set_quotes (m4_syntax_table *, const char *, size_t, const char *, size_t); -extern void m4_set_comment (m4_syntax_table *, const char *, size_t, +extern void m4_set_comment (m4_syntax_table *, const char *, size_t, const char *, size_t); -extern int m4_set_syntax (m4_syntax_table *, char, char, const char *, +extern int m4_set_syntax (m4_syntax_table *, char, char, const char *, size_t); -extern void m4_reset_syntax (m4_syntax_table *); +extern void m4_reset_syntax (m4_syntax_table *); /* --- INPUT TOKENIZATION --- */ -extern void m4_input_init (m4 *context); -extern void m4_input_exit (void); -extern void m4_skip_line (m4 *context, const m4_call_info *); +extern void m4_input_init (m4 *context); +extern void m4_input_exit (void); +extern void m4_skip_line (m4 *context, const m4_call_info *); /* push back input */ -extern void m4_push_file (m4 *, FILE *, const char *, bool); -extern void m4_push_builtin (m4 *, m4_obstack *, m4_symbol_value *); -extern m4_obstack *m4_push_string_init (m4 *, const char *, int); -extern void m4_push_string_finish (void); -extern bool m4_pop_wrapup (m4 *); -extern void m4_input_print (m4 *, m4_obstack *, int); +extern void m4_push_file (m4 *, FILE *, const char *, bool); +extern void m4_push_builtin (m4 *, m4_obstack *, m4_symbol_value *); +extern m4_obstack *m4_push_string_init (m4 *, const char *, int); +extern void m4_push_string_finish (void); +extern bool m4_pop_wrapup (m4 *); +extern void m4_input_print (m4 *, m4_obstack *, int); /* --- OUTPUT MANAGEMENT --- */ -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 *, +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); -extern void m4_shipout_int (m4_obstack *, int); -extern void m4_shipout_string (m4 *, m4_obstack *, const char *, +extern void m4_shipout_int (m4_obstack *, int); +extern void m4_shipout_string (m4 *, m4_obstack *, const char *, size_t, bool); -extern bool m4_shipout_string_trunc (m4_obstack *, const char *, size_t, +extern bool m4_shipout_string_trunc (m4_obstack *, const char *, size_t, const m4_string_pair *, size_t *); -extern void m4_make_diversion (m4 *, int); -extern void m4_insert_diversion (m4 *, int); -extern void m4_insert_file (m4 *, FILE *); -extern void m4_freeze_diversions (m4 *, FILE *); -extern void m4_undivert_all (m4 *); +extern void m4_make_diversion (m4 *, int); +extern void m4_insert_diversion (m4 *, int); +extern void m4_insert_file (m4 *, FILE *); +extern void m4_freeze_diversions (m4 *, FILE *); +extern void m4_undivert_all (m4 *); /* --- PATH MANAGEMENT --- */ -extern void m4_include_env_init (m4 *); -extern void m4_add_include_directory (m4 *, const char *, bool); -extern FILE * m4_path_search (m4 *, const char *, char **); +extern void m4_include_env_init (m4 *); +extern void m4_add_include_directory (m4 *, const char *, bool); +extern FILE * m4_path_search (m4 *, const char *, char **); -#define obstack_chunk_alloc xmalloc -#define obstack_chunk_free free +#define obstack_chunk_alloc xmalloc +#define obstack_chunk_free free /* Convert a possibly-signed character to an unsigned character. This is diff --git a/m4/m4private.h b/m4/m4private.h index d1dc79a2..ab5c299b 100644 --- a/m4/m4private.h +++ b/m4/m4private.h @@ -33,16 +33,16 @@ typedef struct m4__macro_arg_stacks m4__macro_arg_stacks; typedef struct m4__symbol_chain m4__symbol_chain; typedef enum { - M4_SYMBOL_VOID, /* Traced but undefined, u is invalid. */ - M4_SYMBOL_TEXT, /* Plain text, u.u_t is valid. */ - M4_SYMBOL_FUNC, /* Builtin function, u.func is valid. */ - M4_SYMBOL_PLACEHOLDER, /* Placeholder for unknown builtin from -R. */ - M4_SYMBOL_COMP /* Composite symbol, u.u_c.c is valid. */ + M4_SYMBOL_VOID, /* Traced but undefined, u is invalid. */ + M4_SYMBOL_TEXT, /* Plain text, u.u_t is valid. */ + M4_SYMBOL_FUNC, /* Builtin function, u.func is valid. */ + M4_SYMBOL_PLACEHOLDER, /* Placeholder for unknown builtin from -R. */ + M4_SYMBOL_COMP /* Composite symbol, u.u_c.c is valid. */ } m4__symbol_type; -#define BIT_TEST(flags, bit) (((flags) & (bit)) == (bit)) -#define BIT_SET(flags, bit) ((flags) |= (bit)) -#define BIT_RESET(flags, bit) ((flags) &= ~(bit)) +#define BIT_TEST(flags, bit) (((flags) & (bit)) == (bit)) +#define BIT_SET(flags, bit) ((flags) |= (bit)) +#define BIT_RESET(flags, bit) ((flags) &= ~(bit)) /* Gnulib's stdbool doesn't work with bool bitfields. For nicer debugging, use bool when we know it works, but use the more @@ -57,89 +57,89 @@ typedef unsigned int bool_bitfield; /* --- CONTEXT MANAGEMENT --- */ struct m4 { - m4_symbol_table * symtab; - m4_syntax_table * syntax; + m4_symbol_table * symtab; + m4_syntax_table * syntax; - const char * current_file; /* Current input file. */ - int current_line; /* Current input line. */ - int output_line; /* Current output line. */ + const char * current_file; /* Current input file. */ + int current_line; /* Current input line. */ + int output_line; /* Current output line. */ - FILE * debug_file; /* File for debugging output. */ - m4_obstack trace_messages; - int exit_status; /* Cumulative exit status. */ - int current_diversion; /* Current output diversion. */ + FILE * debug_file; /* File for debugging output. */ + m4_obstack trace_messages; + int exit_status; /* Cumulative exit status. */ + int current_diversion; /* Current output diversion. */ /* Option flags (set in src/main.c). */ - size_t nesting_limit; /* -L */ - int debug_level; /* -d */ - size_t max_debug_arg_length; /* -l */ - int regexp_syntax; /* -r */ - int opt_flags; + size_t nesting_limit; /* -L */ + int debug_level; /* -d */ + size_t max_debug_arg_length; /* -l */ + int regexp_syntax; /* -r */ + int opt_flags; /* __PRIVATE__: */ - m4__search_path_info *search_path; /* The list of path directories. */ - m4__macro_arg_stacks *arg_stacks; /* Array of current argv refs. */ - size_t stacks_count; /* Size of arg_stacks. */ - size_t expansion_level;/* Macro call nesting level. */ + m4__search_path_info *search_path; /* The list of path directories. */ + m4__macro_arg_stacks *arg_stacks; /* Array of current argv refs. */ + size_t stacks_count; /* Size of arg_stacks. */ + size_t expansion_level;/* Macro call nesting level. */ }; -#define M4_OPT_PREFIX_BUILTINS_BIT (1 << 0) /* -P */ -#define M4_OPT_SUPPRESS_WARN_BIT (1 << 1) /* -Q */ -#define M4_OPT_DISCARD_COMMENTS_BIT (1 << 2) /* -c */ -#define M4_OPT_INTERACTIVE_BIT (1 << 3) /* -e */ -#define M4_OPT_SYNCOUTPUT_BIT (1 << 4) /* -s */ -#define M4_OPT_POSIXLY_CORRECT_BIT (1 << 5) /* -G/POSIXLY_CORRECT */ -#define M4_OPT_FATAL_WARN_BIT (1 << 6) /* -E once */ -#define M4_OPT_WARN_EXIT_BIT (1 << 7) /* -E twice */ -#define M4_OPT_SAFER_BIT (1 << 8) /* --safer */ +#define M4_OPT_PREFIX_BUILTINS_BIT (1 << 0) /* -P */ +#define M4_OPT_SUPPRESS_WARN_BIT (1 << 1) /* -Q */ +#define M4_OPT_DISCARD_COMMENTS_BIT (1 << 2) /* -c */ +#define M4_OPT_INTERACTIVE_BIT (1 << 3) /* -e */ +#define M4_OPT_SYNCOUTPUT_BIT (1 << 4) /* -s */ +#define M4_OPT_POSIXLY_CORRECT_BIT (1 << 5) /* -G/POSIXLY_CORRECT */ +#define M4_OPT_FATAL_WARN_BIT (1 << 6) /* -E once */ +#define M4_OPT_WARN_EXIT_BIT (1 << 7) /* -E twice */ +#define M4_OPT_SAFER_BIT (1 << 8) /* --safer */ /* Fast macro versions of accessor functions for public fields of m4, that also have an identically named function exported in m4module.h. */ #ifdef NDEBUG -# define m4_get_symbol_table(C) ((C)->symtab) -# define m4_set_symbol_table(C, V) ((C)->symtab = (V)) -# define m4_get_syntax_table(C) ((C)->syntax) -# define m4_set_syntax_table(C, V) ((C)->syntax = (V)) -# define m4_get_current_file(C) ((C)->current_file) -# define m4_set_current_file(C, V) ((C)->current_file = (V)) -# define m4_get_current_line(C) ((C)->current_line) -# define m4_set_current_line(C, V) ((C)->current_line = (V)) -# define m4_get_output_line(C) ((C)->output_line) -# define m4_set_output_line(C, V) ((C)->output_line = (V)) -# define m4_get_debug_file(C) ((C)->debug_file) -# define m4_set_debug_file(C, V) ((C)->debug_file = (V)) -# define m4_get_trace_messages(C) ((C)->trace_messages) -# define m4_set_trace_messages(C, V) ((C)->trace_messages = (V)) -# define m4_get_exit_status(C) ((C)->exit_status) -# define m4_set_exit_status(C, V) ((C)->exit_status = (V)) -# define m4_get_current_diversion(C) ((C)->current_diversion) -# define m4_set_current_diversion(C, V) ((C)->current_diversion = (V)) -# define m4_get_nesting_limit_opt(C) ((C)->nesting_limit) -# define m4_set_nesting_limit_opt(C, V) ((C)->nesting_limit = (V)) -# define m4_get_debug_level_opt(C) ((C)->debug_level) -# define m4_set_debug_level_opt(C, V) ((C)->debug_level = (V)) -# define m4_get_max_debug_arg_length_opt(C) ((C)->max_debug_arg_length) -# define m4_set_max_debug_arg_length_opt(C, V) ((C)->max_debug_arg_length=(V)) -# define m4_get_regexp_syntax_opt(C) ((C)->regexp_syntax) -# define m4_set_regexp_syntax_opt(C, V) ((C)->regexp_syntax = (V)) - -# define m4_get_prefix_builtins_opt(C) \ +# define m4_get_symbol_table(C) ((C)->symtab) +# define m4_set_symbol_table(C, V) ((C)->symtab = (V)) +# define m4_get_syntax_table(C) ((C)->syntax) +# define m4_set_syntax_table(C, V) ((C)->syntax = (V)) +# define m4_get_current_file(C) ((C)->current_file) +# define m4_set_current_file(C, V) ((C)->current_file = (V)) +# define m4_get_current_line(C) ((C)->current_line) +# define m4_set_current_line(C, V) ((C)->current_line = (V)) +# define m4_get_output_line(C) ((C)->output_line) +# define m4_set_output_line(C, V) ((C)->output_line = (V)) +# define m4_get_debug_file(C) ((C)->debug_file) +# define m4_set_debug_file(C, V) ((C)->debug_file = (V)) +# define m4_get_trace_messages(C) ((C)->trace_messages) +# define m4_set_trace_messages(C, V) ((C)->trace_messages = (V)) +# define m4_get_exit_status(C) ((C)->exit_status) +# define m4_set_exit_status(C, V) ((C)->exit_status = (V)) +# define m4_get_current_diversion(C) ((C)->current_diversion) +# define m4_set_current_diversion(C, V) ((C)->current_diversion = (V)) +# define m4_get_nesting_limit_opt(C) ((C)->nesting_limit) +# define m4_set_nesting_limit_opt(C, V) ((C)->nesting_limit = (V)) +# define m4_get_debug_level_opt(C) ((C)->debug_level) +# define m4_set_debug_level_opt(C, V) ((C)->debug_level = (V)) +# define m4_get_max_debug_arg_length_opt(C) ((C)->max_debug_arg_length) +# define m4_set_max_debug_arg_length_opt(C, V) ((C)->max_debug_arg_length=(V)) +# define m4_get_regexp_syntax_opt(C) ((C)->regexp_syntax) +# 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)) -# define m4_get_suppress_warnings_opt(C) \ +# define m4_get_suppress_warnings_opt(C) \ (BIT_TEST((C)->opt_flags, M4_OPT_SUPPRESS_WARN_BIT)) -# define m4_get_discard_comments_opt(C) \ +# define m4_get_discard_comments_opt(C) \ (BIT_TEST((C)->opt_flags, M4_OPT_DISCARD_COMMENTS_BIT)) -# define m4_get_interactive_opt(C) \ +# define m4_get_interactive_opt(C) \ (BIT_TEST((C)->opt_flags, M4_OPT_INTERACTIVE_BIT)) -# define m4_get_syncoutput_opt(C) \ +# define m4_get_syncoutput_opt(C) \ (BIT_TEST((C)->opt_flags, M4_OPT_SYNCOUTPUT_BIT)) -# define m4_get_posixly_correct_opt(C) \ +# define m4_get_posixly_correct_opt(C) \ (BIT_TEST((C)->opt_flags, M4_OPT_POSIXLY_CORRECT_BIT)) -# define m4_get_fatal_warnings_opt(C) \ +# define m4_get_fatal_warnings_opt(C) \ (BIT_TEST((C)->opt_flags, M4_OPT_FATAL_WARN_BIT)) -# define m4_get_warnings_exit_opt(C) \ +# define m4_get_warnings_exit_opt(C) \ (BIT_TEST((C)->opt_flags, M4_OPT_WARN_EXIT_BIT)) -# define m4_get_safer_opt(C) \ +# define m4_get_safer_opt(C) \ (BIT_TEST((C)->opt_flags, M4_OPT_SAFER_BIT)) /* No fast opt bit set macros, as they would need to evaluate their @@ -148,7 +148,7 @@ struct m4 { /* Accessors for private fields of m4, which have no function version exported in m4module.h. */ -#define m4__get_search_path(C) ((C)->search_path) +#define m4__get_search_path(C) ((C)->search_path) /* --- BUILTIN MANAGEMENT --- */ @@ -160,7 +160,7 @@ struct m4__builtin can be used for additional bits beyond what is allowed for modules. */ m4_builtin builtin; - m4_module *module; /* Module that owns this builtin. */ + m4_module *module; /* Module that owns this builtin. */ }; typedef struct m4__builtin m4__builtin; @@ -173,32 +173,32 @@ extern void m4__builtin_print (m4_obstack *, const m4__builtin *, bool, /* --- MODULE MANAGEMENT --- */ -#define USER_MODULE_PATH_ENV "M4MODPATH" -#define BUILTIN_SYMBOL "m4_builtin_table" -#define MACRO_SYMBOL "m4_macro_table" -#define INIT_SYMBOL "m4_init_module" -#define FINISH_SYMBOL "m4_finish_module" +#define USER_MODULE_PATH_ENV "M4MODPATH" +#define BUILTIN_SYMBOL "m4_builtin_table" +#define MACRO_SYMBOL "m4_macro_table" +#define INIT_SYMBOL "m4_init_module" +#define FINISH_SYMBOL "m4_finish_module" /* Representation of a loaded m4 module. */ struct m4_module { - lt_dlhandle handle; /* All ltdl module information. */ - int refcount; /* Count of loads not matched by unload. */ - m4__builtin *builtins; /* Sorted array of builtins. */ - size_t builtins_len; /* Number of builtins. */ + lt_dlhandle handle; /* All ltdl module information. */ + int refcount; /* Count of loads not matched by unload. */ + m4__builtin *builtins; /* Sorted array of builtins. */ + size_t builtins_len; /* Number of builtins. */ }; -extern void m4__module_init (m4 *context); +extern void m4__module_init (m4 *context); extern m4_module * m4__module_open (m4 *context, const char *name, m4_obstack *obs); -extern void m4__module_exit (m4 *context); +extern void m4__module_exit (m4 *context); extern m4_module * m4__module_next (m4_module *); extern m4_module * m4__module_find (const char *name); /* Fast macro versions of symbol table accessor functions, that also have an identically named function exported in m4module.h. */ #ifdef NDEBUG -# define m4_module_refcount(M) ((M)->refcount) +# define m4_module_refcount(M) ((M)->refcount) #endif @@ -206,49 +206,49 @@ extern m4_module * m4__module_find (const char *name); struct m4_symbol { - bool traced; /* True if this symbol is traced. */ - m4_symbol_value *value; /* Linked list of pushdef'd values. */ + bool traced; /* True if this symbol is traced. */ + m4_symbol_value *value; /* Linked list of pushdef'd values. */ }; /* Type of a link in a symbol chain. */ enum m4__symbol_chain_type { - M4__CHAIN_STR, /* Link contains a string, u.u_s is valid. */ - M4__CHAIN_FUNC, /* Link contains builtin token, u.builtin is valid. */ - M4__CHAIN_ARGV, /* Link contains a $@ reference, u.u_a is valid. */ - M4__CHAIN_LOC /* Link contains m4wrap location, u.u_l is valid. */ + M4__CHAIN_STR, /* Link contains a string, u.u_s is valid. */ + M4__CHAIN_FUNC, /* Link contains builtin token, u.builtin is valid. */ + M4__CHAIN_ARGV, /* Link contains a $@ reference, u.u_a is valid. */ + M4__CHAIN_LOC /* Link contains m4wrap location, u.u_l is valid. */ }; /* Composite symbols are built of a linked list of chain objects. */ struct m4__symbol_chain { - m4__symbol_chain *next; /* Pointer to next link of chain. */ - enum m4__symbol_chain_type type; /* Type of this link. */ - unsigned int quote_age; /* Quote_age of this link, or 0. */ + m4__symbol_chain *next; /* Pointer to next link of chain. */ + enum m4__symbol_chain_type type; /* Type of this link. */ + unsigned int quote_age; /* Quote_age of this link, or 0. */ union { struct { - const char *str; /* Pointer to text. */ - size_t len; /* Remaining length of str. */ - size_t level; /* Expansion level of content, or SIZE_MAX. */ - } u_s; /* M4__CHAIN_STR. */ - const m4__builtin *builtin; /* M4__CHAIN_FUNC. */ + const char *str; /* Pointer to text. */ + size_t len; /* Remaining length of str. */ + size_t level; /* Expansion level of content, or SIZE_MAX. */ + } u_s; /* M4__CHAIN_STR. */ + const m4__builtin *builtin; /* M4__CHAIN_FUNC. */ struct { - m4_macro_args *argv; /* Reference to earlier $@. */ - size_t index; /* Argument index within argv. */ - bool_bitfield flatten : 1; /* True to treat builtins as text. */ - bool_bitfield comma : 1; /* True when `,' is next input. */ - bool_bitfield skip_last : 1; /* True if last argument omitted. */ - bool_bitfield has_func : 1; /* True if argv includes func. */ - const m4_string_pair *quotes; /* NULL for $*, quotes for $@. */ - } u_a; /* M4__CHAIN_ARGV. */ + m4_macro_args *argv; /* Reference to earlier $@. */ + size_t index; /* Argument index within argv. */ + bool_bitfield flatten : 1; /* True to treat builtins as text. */ + bool_bitfield comma : 1; /* True when `,' is next input. */ + bool_bitfield skip_last : 1; /* True if last argument omitted. */ + bool_bitfield has_func : 1; /* True if argv includes func. */ + const m4_string_pair *quotes; /* NULL for $*, quotes for $@. */ + } u_a; /* M4__CHAIN_ARGV. */ struct { - const char *file; /* File where subsequent links originate. */ - int line; /* Line where subsequent links originate. */ - } u_l; /* M4__CHAIN_LOC. */ + const char *file; /* File where subsequent links originate. */ + int line; /* Line where subsequent links originate. */ + } u_l; /* M4__CHAIN_LOC. */ } u; }; @@ -256,34 +256,34 @@ struct m4__symbol_chain name, and for arguments to a macro invocation. */ struct m4_symbol_value { - m4_symbol_value * next; - m4_module * module; - unsigned int flags; + m4_symbol_value * next; + m4_module * module; + unsigned int flags; - m4_hash * arg_signature; - size_t min_args; - size_t max_args; - size_t pending_expansions; + m4_hash * arg_signature; + size_t min_args; + size_t max_args; + size_t pending_expansions; - m4__symbol_type type; + m4__symbol_type type; union { struct { - size_t len; /* Length of string. */ - const char * text; /* String contents. */ + 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. */ - unsigned int quote_age; - } u_t; /* Valid when type is TEXT, PLACEHOLDER. */ - const m4__builtin * builtin;/* Valid when type is FUNC. */ + unsigned int quote_age; + } u_t; /* Valid when type is TEXT, PLACEHOLDER. */ + const m4__builtin * builtin;/* Valid when type is FUNC. */ struct { - m4__symbol_chain *chain; /* First link of the chain. */ - m4__symbol_chain *end; /* Last link of the chain. */ - bool_bitfield wrapper : 1; /* True if this is a $@ ref. */ - bool_bitfield has_func : 1; /* True if chain includes func. */ - } u_c; /* Valid when type is COMP. */ + m4__symbol_chain *chain; /* First link of the chain. */ + m4__symbol_chain *end; /* Last link of the chain. */ + bool_bitfield wrapper : 1; /* True if this is a $@ ref. */ + bool_bitfield has_func : 1; /* True if chain includes func. */ + } u_c; /* Valid when type is COMP. */ } u; }; @@ -327,12 +327,12 @@ struct m4_macro_args macro.c for a much more detailed comment on usage. */ struct m4__macro_arg_stacks { - size_t refcount; /* Number of active $@ references at this level. */ - size_t argcount; /* Number of argv at this level. */ - m4_obstack *args; /* Content of arguments. */ - m4_obstack *argv; /* Argv pointers into args. */ - void *args_base; /* Location for clearing the args obstack. */ - void *argv_base; /* Location for clearing the argv obstack. */ + size_t refcount; /* Number of active $@ references at this level. */ + size_t argcount; /* Number of argv at this level. */ + m4_obstack *args; /* Content of arguments. */ + m4_obstack *argv; /* Argv pointers into args. */ + void *args_base; /* Location for clearing the args obstack. */ + void *argv_base; /* Location for clearing the argv obstack. */ }; /* Opaque structure for managing call context information. Contains @@ -341,74 +341,74 @@ struct m4__macro_arg_stacks changes global context in the meantime. */ struct m4_call_info { - const char *file; /* The file containing the macro invocation. */ - int line; /* The line the macro was called on. */ - size_t call_id; /* The unique sequence call id of the macro. */ - int trace : 1; /* True to trace this macro. */ - int debug_level : 31; /* The debug level for tracing the macro call. */ - const char *name; /* The macro name. */ - size_t name_len; /* The length of name. */ + const char *file; /* The file containing the macro invocation. */ + int line; /* The line the macro was called on. */ + size_t call_id; /* The unique sequence call id of the macro. */ + int trace : 1; /* True to trace this macro. */ + int debug_level : 31; /* The debug level for tracing the macro call. */ + const char *name; /* The macro name. */ + size_t name_len; /* The length of name. */ }; -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 *, +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 *); -extern bool m4__arg_print (m4 *, m4_obstack *, m4_macro_args *, +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); -#define VALUE_NEXT(T) ((T)->next) -#define VALUE_MODULE(T) ((T)->module) -#define VALUE_FLAGS(T) ((T)->flags) -#define VALUE_ARG_SIGNATURE(T) ((T)->arg_signature) -#define VALUE_MIN_ARGS(T) ((T)->min_args) -#define VALUE_MAX_ARGS(T) ((T)->max_args) -#define VALUE_PENDING(T) ((T)->pending_expansions) - -#define SYMBOL_NEXT(S) (VALUE_NEXT ((S)->value)) -#define SYMBOL_MODULE(S) (VALUE_MODULE ((S)->value)) -#define SYMBOL_FLAGS(S) (VALUE_FLAGS ((S)->value)) -#define SYMBOL_ARG_SIGNATURE(S) (VALUE_ARG_SIGNATURE ((S)->value)) -#define SYMBOL_MIN_ARGS(S) (VALUE_MIN_ARGS ((S)->value)) -#define SYMBOL_MAX_ARGS(S) (VALUE_MAX_ARGS ((S)->value)) -#define SYMBOL_PENDING(S) (VALUE_PENDING ((S)->value)) +#define VALUE_NEXT(T) ((T)->next) +#define VALUE_MODULE(T) ((T)->module) +#define VALUE_FLAGS(T) ((T)->flags) +#define VALUE_ARG_SIGNATURE(T) ((T)->arg_signature) +#define VALUE_MIN_ARGS(T) ((T)->min_args) +#define VALUE_MAX_ARGS(T) ((T)->max_args) +#define VALUE_PENDING(T) ((T)->pending_expansions) + +#define SYMBOL_NEXT(S) (VALUE_NEXT ((S)->value)) +#define SYMBOL_MODULE(S) (VALUE_MODULE ((S)->value)) +#define SYMBOL_FLAGS(S) (VALUE_FLAGS ((S)->value)) +#define SYMBOL_ARG_SIGNATURE(S) (VALUE_ARG_SIGNATURE ((S)->value)) +#define SYMBOL_MIN_ARGS(S) (VALUE_MIN_ARGS ((S)->value)) +#define SYMBOL_MAX_ARGS(S) (VALUE_MAX_ARGS ((S)->value)) +#define SYMBOL_PENDING(S) (VALUE_PENDING ((S)->value)) /* Fast macro versions of symbol table accessor functions, that also have an identically named function exported in m4module.h. */ #ifdef NDEBUG -# define m4_get_symbol_traced(S) ((S)->traced) -# define m4_get_symbol_value(S) ((S)->value) -# define m4_set_symbol_value(S, V) ((S)->value = (V)) +# define m4_get_symbol_traced(S) ((S)->traced) +# define m4_get_symbol_value(S) ((S)->value) +# define m4_set_symbol_value(S, V) ((S)->value = (V)) /* m4_symbol_value_{create,delete} are too complex for a simple macro. */ -# define m4_is_symbol_value_text(V) ((V)->type == M4_SYMBOL_TEXT) -# 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) \ +# define m4_is_symbol_value_text(V) ((V)->type == M4_SYMBOL_TEXT) +# 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) -# 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_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) \ +# define m4_get_symbol_value_placeholder(V) \ ((V)->u.u_t.text) -# define m4_symbol_value_flatten_args(V) \ +# define m4_symbol_value_flatten_args(V) \ (BIT_TEST ((V)->flags, VALUE_FLATTEN_ARGS_BIT)) -# define m4_set_symbol_value_text(V, T, L, A) \ - ((V)->type = M4_SYMBOL_TEXT, (V)->u.u_t.text = (T), \ +# define m4_set_symbol_value_text(V, T, L, A) \ + ((V)->type = M4_SYMBOL_TEXT, (V)->u.u_t.text = (T), \ (V)->u.u_t.len = (L), (V)->u.u_t.quote_age = (A)) -# define m4_set_symbol_value_placeholder(V, T) \ +# define m4_set_symbol_value_placeholder(V, T) \ ((V)->type = M4_SYMBOL_PLACEHOLDER, (V)->u.u_t.text = (T)) -# define m4__set_symbol_value_builtin(V, B) \ - ((V)->type = M4_SYMBOL_FUNC, (V)->u.builtin = (B), \ - VALUE_MODULE (V) = (B)->module, \ - VALUE_FLAGS (V) = (B)->builtin.flags, \ - VALUE_MIN_ARGS (V) = (B)->builtin.min_args, \ +# define m4__set_symbol_value_builtin(V, B) \ + ((V)->type = M4_SYMBOL_FUNC, (V)->u.builtin = (B), \ + VALUE_MODULE (V) = (B)->module, \ + VALUE_FLAGS (V) = (B)->builtin.flags, \ + VALUE_MIN_ARGS (V) = (B)->builtin.min_args, \ VALUE_MAX_ARGS (V) = (B)->builtin.max_args) #endif @@ -419,26 +419,26 @@ extern bool m4__arg_print (m4 *, m4_obstack *, m4_macro_args *, m4_builtin.flags to m4_symbol_arg.flags. We can use additional bits for private use. */ -#define VALUE_FLATTEN_ARGS_BIT (1 << 0) -#define VALUE_BLIND_ARGS_BIT (1 << 1) -#define VALUE_SIDE_EFFECT_ARGS_BIT (1 << 2) -#define VALUE_DELETED_BIT (1 << 3) +#define VALUE_FLATTEN_ARGS_BIT (1 << 0) +#define VALUE_BLIND_ARGS_BIT (1 << 1) +#define VALUE_SIDE_EFFECT_ARGS_BIT (1 << 2) +#define VALUE_DELETED_BIT (1 << 3) struct m4_symbol_arg { - int index; - int flags; - char * default_val; + int index; + int flags; + char * default_val; }; -#define SYMBOL_ARG_INDEX(A) ((A)->index) -#define SYMBOL_ARG_FLAGS(A) ((A)->flags) -#define SYMBOL_ARG_DEFAULT(A) ((A)->default_val) +#define SYMBOL_ARG_INDEX(A) ((A)->index) +#define SYMBOL_ARG_FLAGS(A) ((A)->flags) +#define SYMBOL_ARG_DEFAULT(A) ((A)->default_val) /* m4_symbol_arg.flags bit masks: */ -#define SYMBOL_ARG_REST_BIT (1 << 0) -#define SYMBOL_ARG_KEY_BIT (1 << 1) +#define SYMBOL_ARG_REST_BIT (1 << 0) +#define SYMBOL_ARG_KEY_BIT (1 << 1) extern void m4__symtab_remove_module_references (m4_symbol_table *, m4_module *); @@ -452,16 +452,16 @@ extern bool m4__symbol_value_print (m4 *, m4_symbol_value *, m4_obstack *, /* CHAR_RETRY must be last, because we size the syntax table to hold all other characters and sentinels. */ -#define CHAR_EOF (UCHAR_MAX + 1) /* Return on EOF. */ -#define CHAR_BUILTIN (UCHAR_MAX + 2) /* Return for BUILTIN token. */ -#define CHAR_QUOTE (UCHAR_MAX + 3) /* Return for quoted string. */ -#define CHAR_ARGV (UCHAR_MAX + 4) /* Return for $@ reference. */ -#define CHAR_RETRY (UCHAR_MAX + 5) /* Return for end of input block. */ +#define CHAR_EOF (UCHAR_MAX + 1) /* Return on EOF. */ +#define CHAR_BUILTIN (UCHAR_MAX + 2) /* Return for BUILTIN token. */ +#define CHAR_QUOTE (UCHAR_MAX + 3) /* Return for quoted string. */ +#define CHAR_ARGV (UCHAR_MAX + 4) /* Return for $@ reference. */ +#define CHAR_RETRY (UCHAR_MAX + 5) /* Return for end of input block. */ -#define DEF_LQUOTE "`" /* Default left quote delimiter. */ -#define DEF_RQUOTE "\'" /* Default right quote delimiter. */ -#define DEF_BCOMM "#" /* Default begin comment delimiter. */ -#define DEF_ECOMM "\n" /* Default end comment delimiter. */ +#define DEF_LQUOTE "`" /* Default left quote delimiter. */ +#define DEF_RQUOTE "\'" /* Default right quote delimiter. */ +#define DEF_BCOMM "#" /* Default begin comment delimiter. */ +#define DEF_ECOMM "\n" /* Default end comment delimiter. */ struct m4_syntax_table { /* Please read the comment at the top of input.c for details. table @@ -469,8 +469,8 @@ struct m4_syntax_table { unsigned short table[CHAR_RETRY]; unsigned short orig[CHAR_RETRY]; - m4_string_pair quote; /* Quote delimiters. */ - m4_string_pair comm; /* Comment delimiters. */ + m4_string_pair quote; /* Quote delimiters. */ + m4_string_pair comm; /* Comment delimiters. */ char dollar; /* Dollar character, if is_single_dollar. */ @@ -514,26 +514,26 @@ struct m4_syntax_table { /* Fast macro versions of syntax table accessor functions, that also have an identically named function exported in m4module.h. */ #ifdef NDEBUG -# define m4_get_syntax_lquote(S) ((S)->quote.str1) -# define m4_get_syntax_rquote(S) ((S)->quote.str2) -# define m4_get_syntax_bcomm(S) ((S)->comm.str1) -# define m4_get_syntax_ecomm(S) ((S)->comm.str2) -# define m4_get_syntax_quotes(S) (&(S)->quote) -# define m4_get_syntax_comments(S) (&(S)->comm) - -# define m4_is_syntax_single_quotes(S) ((S)->is_single_quotes) -# define m4_is_syntax_single_comments(S) ((S)->is_single_comments) -# define m4_is_syntax_single_dollar(S) ((S)->is_single_dollar) -# define m4_is_syntax_macro_escaped(S) ((S)->is_macro_escaped) +# define m4_get_syntax_lquote(S) ((S)->quote.str1) +# define m4_get_syntax_rquote(S) ((S)->quote.str2) +# define m4_get_syntax_bcomm(S) ((S)->comm.str1) +# define m4_get_syntax_ecomm(S) ((S)->comm.str2) +# define m4_get_syntax_quotes(S) (&(S)->quote) +# define m4_get_syntax_comments(S) (&(S)->comm) + +# define m4_is_syntax_single_quotes(S) ((S)->is_single_quotes) +# define m4_is_syntax_single_comments(S) ((S)->is_single_comments) +# define m4_is_syntax_single_dollar(S) ((S)->is_single_dollar) +# define m4_is_syntax_macro_escaped(S) ((S)->is_macro_escaped) #endif /* Return the current quote age. */ -#define m4__quote_age(S) ((S)->quote_age) +#define m4__quote_age(S) ((S)->quote_age) /* Return true if the current quote age guarantees that parsing the current token in the context of a quoted string of the same quote age will give the same parse. */ -#define m4__safe_quotes(S) (((S)->quote_age & 0xffff) != 0) +#define m4__safe_quotes(S) (((S)->quote_age & 0xffff) != 0) /* Set or refresh the cached quote. */ extern const m4_string_pair *m4__quote_cache (m4_syntax_table *, @@ -541,48 +541,48 @@ extern const m4_string_pair *m4__quote_cache (m4_syntax_table *, const m4_string_pair *); /* Clear the cached quote. */ -#define m4__quote_uncache(S) ((S)->cached_quote = NULL) +#define m4__quote_uncache(S) ((S)->cached_quote = NULL) /* --- MACRO MANAGEMENT --- */ /* Various different token types. */ typedef enum { - M4_TOKEN_EOF, /* End of file, M4_SYMBOL_VOID. */ - M4_TOKEN_NONE, /* Discardable token, M4_SYMBOL_VOID. */ - M4_TOKEN_STRING, /* Quoted string, M4_SYMBOL_TEXT or M4_SYMBOL_COMP. */ - M4_TOKEN_COMMENT, /* Comment, M4_SYMBOL_TEXT or M4_SYMBOL_COMP. */ - M4_TOKEN_SPACE, /* Whitespace, M4_SYMBOL_TEXT. */ - M4_TOKEN_WORD, /* An identifier, M4_SYMBOL_TEXT. */ - M4_TOKEN_OPEN, /* Argument list start, M4_SYMBOL_TEXT. */ - M4_TOKEN_COMMA, /* Argument separator, M4_SYMBOL_TEXT. */ - M4_TOKEN_CLOSE, /* Argument list end, M4_SYMBOL_TEXT. */ - M4_TOKEN_SIMPLE, /* Single character, M4_SYMBOL_TEXT. */ - M4_TOKEN_MACDEF, /* Builtin token, M4_SYMBOL_FUNC or M4_SYMBOL_COMP. */ - M4_TOKEN_ARGV /* A series of parameters, M4_SYMBOL_COMP. */ + M4_TOKEN_EOF, /* End of file, M4_SYMBOL_VOID. */ + M4_TOKEN_NONE, /* Discardable token, M4_SYMBOL_VOID. */ + M4_TOKEN_STRING, /* Quoted string, M4_SYMBOL_TEXT or M4_SYMBOL_COMP. */ + M4_TOKEN_COMMENT, /* Comment, M4_SYMBOL_TEXT or M4_SYMBOL_COMP. */ + M4_TOKEN_SPACE, /* Whitespace, M4_SYMBOL_TEXT. */ + M4_TOKEN_WORD, /* An identifier, M4_SYMBOL_TEXT. */ + M4_TOKEN_OPEN, /* Argument list start, M4_SYMBOL_TEXT. */ + M4_TOKEN_COMMA, /* Argument separator, M4_SYMBOL_TEXT. */ + M4_TOKEN_CLOSE, /* Argument list end, M4_SYMBOL_TEXT. */ + M4_TOKEN_SIMPLE, /* Single character, M4_SYMBOL_TEXT. */ + M4_TOKEN_MACDEF, /* Builtin token, M4_SYMBOL_FUNC or M4_SYMBOL_COMP. */ + M4_TOKEN_ARGV /* A series of parameters, M4_SYMBOL_COMP. */ } m4__token_type; -extern void m4__make_text_link (m4_obstack *, m4__symbol_chain **, +extern void m4__make_text_link (m4_obstack *, m4__symbol_chain **, m4__symbol_chain **); -extern void m4__append_builtin (m4_obstack *, const m4__builtin *, +extern void m4__append_builtin (m4_obstack *, const m4__builtin *, m4__symbol_chain **, m4__symbol_chain **); -extern bool m4__push_symbol (m4 *, m4_symbol_value *, size_t, +extern bool m4__push_symbol (m4 *, m4_symbol_value *, size_t, bool); -extern m4_obstack *m4__push_wrapup_init (m4 *, const m4_call_info *, +extern m4_obstack *m4__push_wrapup_init (m4 *, const m4_call_info *, m4__symbol_chain ***); -extern void m4__push_wrapup_finish (void); -extern m4__token_type m4__next_token (m4 *, m4_symbol_value *, int *, +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 *); -extern bool m4__next_token_is_open (m4 *); +extern bool m4__next_token_is_open (m4 *); /* Fast macro versions of macro argv accessor functions, that also have an identically named function exported in m4module.h. */ #ifdef NDEBUG -# define m4_arg_argc(A) (A)->argc -# define m4_arg_info(A) (A)->info -# define m4_arg_scratch(C) \ +# define m4_arg_argc(A) (A)->argc +# define m4_arg_info(A) (A)->info +# define m4_arg_scratch(C) \ ((C)->arg_stacks[(C)->expansion_level - 1].argv) #endif /* NDEBUG */ @@ -592,15 +592,15 @@ extern bool m4__next_token_is_open (m4 *); typedef struct m4__search_path m4__search_path; struct m4__search_path { - m4__search_path *next; /* next directory to search */ - const char *dir; /* directory */ + m4__search_path *next; /* next directory to search */ + const char *dir; /* directory */ int len; }; struct m4__search_path_info { - m4__search_path *list; /* the list of path directories */ - m4__search_path *list_end; /* the end of same */ - int max_length; /* length of longest directory name */ + m4__search_path *list; /* the list of path directories */ + m4__search_path *list_end; /* the end of same */ + int max_length; /* length of longest directory name */ }; extern void m4__include_init (m4 *); @@ -616,18 +616,18 @@ extern void m4__include_init (m4 *); /* Convenience macro to zero a variable after freeing it. */ -#define DELETE(Expr) ((Expr) = (free ((void *) Expr), (void *) 0)) +#define DELETE(Expr) ((Expr) = (free ((void *) Expr), (void *) 0)) #if DEBUG -# define DEBUG_INCL 1 -# define DEBUG_INPUT 1 -# define DEBUG_MACRO 1 -# define DEBUG_MODULES 1 -# define DEBUG_OUTPUT 1 -# define DEBUG_STKOVF 1 -# define DEBUG_SYM 1 -# define DEBUG_SYNTAX 1 +# define DEBUG_INCL 1 +# define DEBUG_INPUT 1 +# define DEBUG_MACRO 1 +# define DEBUG_MODULES 1 +# define DEBUG_OUTPUT 1 +# define DEBUG_STKOVF 1 +# define DEBUG_SYM 1 +# define DEBUG_SYNTAX 1 #endif #endif /* m4private.h */ diff --git a/m4/macro.c b/m4/macro.c index c4a82201..b88d5cbe 100644 --- a/m4/macro.c +++ b/m4/macro.c @@ -127,13 +127,13 @@ static bool expand_token (m4 *, m4_obstack *, m4__token_type, m4_symbol_value *, int, bool); static bool expand_argument (m4 *, m4_obstack *, m4_symbol_value *, const m4_call_info *); -static void process_macro (m4 *, m4_symbol_value *, m4_obstack *, int, +static void process_macro (m4 *, m4_symbol_value *, m4_obstack *, int, m4_macro_args *); -static unsigned int trace_pre (m4 *, m4_macro_args *); -static void trace_post (m4 *, unsigned int, const m4_call_info *); +static unsigned int trace_pre (m4 *, m4_macro_args *); +static void trace_post (m4 *, unsigned int, const m4_call_info *); static unsigned int trace_header (m4 *, const m4_call_info *); -static void trace_flush (m4 *, unsigned int); +static void trace_flush (m4 *, unsigned int); /* The number of the current call of expand_macro (). */ @@ -151,9 +151,9 @@ static int debug_macro_level; #else # define debug_macro_level 0 #endif /* !DEBUG_MACRO */ -#define PRINT_ARGCOUNT_CHANGES 1 /* Any change to argcount > 1. */ -#define PRINT_REFCOUNT_INCREASE 2 /* Any increase to refcount. */ -#define PRINT_REFCOUNT_DECREASE 4 /* Any decrease to refcount. */ +#define PRINT_ARGCOUNT_CHANGES 1 /* Any change to argcount > 1. */ +#define PRINT_REFCOUNT_INCREASE 2 /* Any increase to refcount. */ +#define PRINT_REFCOUNT_DECREASE 4 /* Any decrease to refcount. */ @@ -201,7 +201,7 @@ expand_token (m4 *context, m4_obstack *obs, m4__token_type type, ? m4_get_symbol_value_text (token) : NULL); switch (type) - { /* TOKSW */ + { /* TOKSW */ case M4_TOKEN_EOF: case M4_TOKEN_MACDEF: /* Always safe, since there is no text to rescan. */ @@ -330,7 +330,7 @@ expand_argument (m4 *context, m4_obstack *obs, m4_symbol_value *argp, if (VALUE_MAX_ARGS (&token) < VALUE_MAX_ARGS (argp)) VALUE_MAX_ARGS (argp) = VALUE_MAX_ARGS (&token); switch (type) - { /* TOKSW */ + { /* TOKSW */ case M4_TOKEN_COMMA: case M4_TOKEN_CLOSE: if (paren_level == 0) @@ -447,15 +447,15 @@ expand_argument (m4 *context, m4_obstack *obs, m4_symbol_value *argp, static void expand_macro (m4 *context, const char *name, size_t len, m4_symbol *symbol) { - void *args_base; /* Base of stack->args on entry. */ - void *args_scratch; /* Base of scratch space for m4_macro_call. */ - void *argv_base; /* Base of stack->argv on entry. */ - m4_macro_args *argv; /* Arguments to the called macro. */ - m4_obstack *expansion; /* Collects the macro's expansion. */ - m4_symbol_value *value; /* Original value of this macro. */ - size_t level; /* Expansion level of this macro. */ - m4__macro_arg_stacks *stack; /* Storage for this macro. */ - m4_call_info info; /* Context of this macro call. */ + void *args_base; /* Base of stack->args on entry. */ + void *args_scratch; /* Base of scratch space for m4_macro_call. */ + void *argv_base; /* Base of stack->argv on entry. */ + m4_macro_args *argv; /* Arguments to the called macro. */ + m4_obstack *expansion; /* Collects the macro's expansion. */ + m4_symbol_value *value; /* Original value of this macro. */ + size_t level; /* Expansion level of this macro. */ + m4__macro_arg_stacks *stack; /* Storage for this macro. */ + m4_call_info info; /* Context of this macro call. */ /* Obstack preparation. */ level = context->expansion_level; @@ -757,14 +757,14 @@ process_macro (m4 *context, m4_symbol_value *value, m4_obstack *obs, m4_push_arg (context, obs, argv, i); break; - case '#': /* number of arguments */ + case '#': /* number of arguments */ m4_shipout_int (obs, argc - 1); text++; len--; break; - case '*': /* all arguments */ - case '@': /* ... same, but quoted */ + case '*': /* all arguments */ + case '@': /* ... same, but quoted */ m4_push_args (context, obs, argv, false, *text == '@'); text++; len--; diff --git a/m4/module.c b/m4/module.c index 6f1a37ae..0b92cdeb 100644 --- a/m4/module.c +++ b/m4/module.c @@ -80,16 +80,16 @@ * have been made (nor will the symbol table be purged). **/ -#define MODULE_SELF_NAME "!myself!" +#define MODULE_SELF_NAME "!myself!" static const char* module_dlerror (void); -static int module_remove (m4 *context, m4_module *module, +static int module_remove (m4 *context, m4_module *module, m4_obstack *obs); -static void install_builtin_table (m4*, m4_module *); -static void install_macro_table (m4*, m4_module *); +static void install_builtin_table (m4*, m4_module *); +static void install_macro_table (m4*, m4_module *); -static int m4__module_interface (lt_dlhandle handle, +static int m4__module_interface (lt_dlhandle handle, const char *id_string); static lt_dlinterface_id iface_id = NULL; @@ -110,8 +110,8 @@ void * m4_module_import (m4 *context, const char *module_name, const char *symbol_name, m4_obstack *obs) { - m4_module * module = m4__module_find (module_name); - void * symbol_address = NULL; + m4_module * module = m4__module_find (module_name); + void * symbol_address = NULL; /* Try to load the module if it is not yet available (errors are diagnosed by m4_module_load). */ @@ -221,8 +221,8 @@ m4_module_makeresident (m4_module *module) void m4_module_unload (m4 *context, const char *name, m4_obstack *obs) { - m4_module * module = NULL; - int errors = 0; + m4_module * module = NULL; + int errors = 0; assert (context); @@ -390,12 +390,12 @@ compare_builtin_CB (const void *a, const void *b) m4_module * m4__module_open (m4 *context, const char *name, m4_obstack *obs) { - lt_dlhandle handle = lt_dlopenext (name); - m4_module * module = NULL; - m4_module_init_func * init_func = NULL; + lt_dlhandle handle = lt_dlopenext (name); + m4_module * module = NULL; + m4_module_init_func * init_func = NULL; assert (context); - assert (iface_id); /* need to have called m4__module_init */ + assert (iface_id); /* need to have called m4__module_init */ if (handle) { @@ -511,12 +511,12 @@ m4__module_open (m4 *context, const char *name, m4_obstack *obs) void m4__module_exit (m4 *context) { - m4_module * module = m4__module_next (NULL); - int errors = 0; + m4_module * module = m4__module_next (NULL); + int errors = 0; while (module && !errors) { - m4_module * pending = module; + 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. */ @@ -526,7 +526,7 @@ m4__module_exit (m4 *context) errors = module_remove (context, pending, NULL); } - assert (iface_id); /* need to have called m4__module_init */ + assert (iface_id); /* need to have called m4__module_init */ lt_dlinterface_free (iface_id); iface_id = NULL; @@ -561,13 +561,13 @@ module_dlerror (void) static int module_remove (m4 *context, m4_module *module, m4_obstack *obs) { - const lt_dlinfo * info; - int errors = 0; - const char * name; - lt_dlhandle handle; - bool last_reference = false; - bool resident = false; - m4_module_finish_func * finish_func; + const lt_dlinfo * info; + int errors = 0; + const char * name; + lt_dlhandle handle; + bool last_reference = false; + bool resident = false; + m4_module_finish_func * finish_func; assert (module && module->handle); diff --git a/m4/output.c b/m4/output.c index 092e330c..cbd37abe 100644 --- a/m4/output.c +++ b/m4/output.c @@ -66,13 +66,13 @@ 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. */ - size_t used; /* Used buffer length, or tmp file exists. */ + int divnum; /* Which diversion this represents. */ + size_t size; /* Usable size before reallocation. */ + size_t used; /* Used buffer length, or tmp file exists. */ }; /* Sorted set of diversions 1 through INT_MAX. */ @@ -539,12 +539,12 @@ make_room_for (m4 *context, size_t length) /* Output one character CHAR, when it is known that it goes to a diversion file or an in-memory diversion buffer. A variable m4 *context must be in scope. */ -#define OUTPUT_CHARACTER(Char) \ - if (output_file) \ - putc ((Char), output_file); \ - else if (output_unused == 0) \ - output_character_helper (context, (Char)); \ - else \ +#define OUTPUT_CHARACTER(Char) \ + if (output_file) \ + putc ((Char), output_file); \ + else if (output_unused == 0) \ + output_character_helper (context, (Char)); \ + else \ (output_unused--, *output_cursor++ = (Char)) static void @@ -1068,7 +1068,7 @@ m4_freeze_diversions (m4 *context, FILE *file) saved_number = m4_get_current_diversion (context); last_inserted = 0; m4_make_diversion (context, 0); - output_file = file; /* kludge in the frozen file */ + output_file = file; /* kludge in the frozen file */ iter = gl_oset_iterator (diversion_table); while (gl_oset_iterator_next (&iter, &elt)) diff --git a/m4/path.c b/m4/path.c index ba3469ae..8ba1caa3 100644 --- a/m4/path.c +++ b/m4/path.c @@ -158,7 +158,7 @@ m4_path_search (m4 *context, const char *file, char **expanded_name) { FILE *fp; m4__search_path *incl; - char *name; /* buffer for constructed name */ + char *name; /* buffer for constructed name */ int e = 0; if (expanded_name != NULL) diff --git a/m4/resyntax.c b/m4/resyntax.c index 23357038..5e7b9701 100644 --- a/m4/resyntax.c +++ b/m4/resyntax.c @@ -25,8 +25,8 @@ #include "m4private.h" typedef struct { - const char *spec; - const int code; + const char *spec; + const int code; } m4_resyntax; /* The syntaxes named in this table are saved into frozen files. Changing @@ -37,36 +37,36 @@ static m4_resyntax const m4_resyntax_map[] = { /* First, the canonical definitions for reverse lookups: */ - { "AWK", RE_SYNTAX_AWK }, - { "ED", RE_SYNTAX_ED }, - { "EGREP", RE_SYNTAX_EGREP }, - { "EMACS", RE_SYNTAX_EMACS }, - { "GNU_AWK", RE_SYNTAX_GNU_AWK }, - { "GREP", RE_SYNTAX_GREP }, - { "POSIX_AWK", RE_SYNTAX_POSIX_AWK }, - { "POSIX_BASIC", RE_SYNTAX_POSIX_BASIC }, - { "POSIX_EGREP", RE_SYNTAX_POSIX_EGREP }, - { "POSIX_EXTENDED", RE_SYNTAX_POSIX_EXTENDED }, - { "POSIX_MINIMAL_BASIC", RE_SYNTAX_POSIX_MINIMAL_BASIC }, - { "SED", RE_SYNTAX_SED }, + { "AWK", RE_SYNTAX_AWK }, + { "ED", RE_SYNTAX_ED }, + { "EGREP", RE_SYNTAX_EGREP }, + { "EMACS", RE_SYNTAX_EMACS }, + { "GNU_AWK", RE_SYNTAX_GNU_AWK }, + { "GREP", RE_SYNTAX_GREP }, + { "POSIX_AWK", RE_SYNTAX_POSIX_AWK }, + { "POSIX_BASIC", RE_SYNTAX_POSIX_BASIC }, + { "POSIX_EGREP", RE_SYNTAX_POSIX_EGREP }, + { "POSIX_EXTENDED", RE_SYNTAX_POSIX_EXTENDED }, + { "POSIX_MINIMAL_BASIC", RE_SYNTAX_POSIX_MINIMAL_BASIC }, + { "SED", RE_SYNTAX_SED }, /* The rest are aliases, for forward lookups only: */ - { "", RE_SYNTAX_EMACS }, - { "BASIC", RE_SYNTAX_POSIX_BASIC }, - { "BSD_M4", RE_SYNTAX_POSIX_EXTENDED }, - { "EXTENDED", RE_SYNTAX_POSIX_EXTENDED }, - { "GAWK", RE_SYNTAX_GNU_AWK }, - { "GNU_EGREP", RE_SYNTAX_EGREP }, - { "GNU_EMACS", RE_SYNTAX_EMACS }, - { "GNU_M4", RE_SYNTAX_EMACS }, - { "MINIMAL", RE_SYNTAX_POSIX_MINIMAL_BASIC }, - { "MINIMAL_BASIC", RE_SYNTAX_POSIX_MINIMAL_BASIC }, - { "POSIX_MINIMAL", RE_SYNTAX_POSIX_MINIMAL_BASIC }, + { "", RE_SYNTAX_EMACS }, + { "BASIC", RE_SYNTAX_POSIX_BASIC }, + { "BSD_M4", RE_SYNTAX_POSIX_EXTENDED }, + { "EXTENDED", RE_SYNTAX_POSIX_EXTENDED }, + { "GAWK", RE_SYNTAX_GNU_AWK }, + { "GNU_EGREP", RE_SYNTAX_EGREP }, + { "GNU_EMACS", RE_SYNTAX_EMACS }, + { "GNU_M4", RE_SYNTAX_EMACS }, + { "MINIMAL", RE_SYNTAX_POSIX_MINIMAL_BASIC }, + { "MINIMAL_BASIC", RE_SYNTAX_POSIX_MINIMAL_BASIC }, + { "POSIX_MINIMAL", RE_SYNTAX_POSIX_MINIMAL_BASIC }, /* End marker: */ - { NULL, -1 } + { NULL, -1 } }; diff --git a/m4/symtab.c b/m4/symtab.c index 2211a7cf..710d1b39 100644 --- a/m4/symtab.c +++ b/m4/symtab.c @@ -45,20 +45,20 @@ symbols (with empty value stacks) are invisible to the users of this module. */ -#define M4_SYMTAB_DEFAULT_SIZE 2047 +#define M4_SYMTAB_DEFAULT_SIZE 2047 struct m4_symbol_table { m4_hash *table; }; -static m4_symbol *symtab_fetch (m4_symbol_table*, const char *, +static m4_symbol *symtab_fetch (m4_symbol_table*, const char *, size_t); -static void symbol_popval (m4_symbol *); -static void * symbol_destroy_CB (m4_symbol_table *, const char *, +static void symbol_popval (m4_symbol *); +static void * symbol_destroy_CB (m4_symbol_table *, const char *, size_t, m4_symbol *, void *); -static void * arg_destroy_CB (m4_hash *, const void *, void *, +static void * arg_destroy_CB (m4_hash *, const void *, void *, void *); -static void * arg_copy_CB (m4_hash *, const void *, void *, +static void * arg_copy_CB (m4_hash *, const void *, void *, m4_hash *); @@ -98,7 +98,7 @@ m4_symtab_apply (m4_symbol_table *symtab, bool include_trace, m4_symtab_apply_func *func, void *userdata) { m4_hash_iterator *place = NULL; - void * result = NULL; + void * result = NULL; assert (symtab); assert (symtab->table); @@ -268,9 +268,9 @@ m4_symbol_pushdef (m4_symbol_table *symtab, const char *name, size_t len, assert (name); assert (value); - symbol = symtab_fetch (symtab, name, len); - VALUE_NEXT (value) = m4_get_symbol_value (symbol); - symbol->value = value; + symbol = symtab_fetch (symtab, name, len); + VALUE_NEXT (value) = m4_get_symbol_value (symbol); + symbol->value = value; assert (m4_get_symbol_value (symbol)); @@ -400,7 +400,7 @@ m4_symbol * m4_symbol_rename (m4_symbol_table *symtab, const char *name, size_t len1, const char *newname, size_t len2) { - m4_symbol *symbol = NULL; + m4_symbol *symbol = NULL; m4_symbol **psymbol; m4_string key; m4_string *pkey; @@ -928,7 +928,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, +static void *dump_symbol_CB (m4_symbol_table *symtab, const char *name, m4_symbol *symbol, void *userdata); static M4_GNUC_UNUSED void * symtab_dump (m4 *context, m4_symbol_table *symtab) @@ -940,11 +940,11 @@ static void * dump_symbol_CB (m4_symbol_table *symtab, const char *name, m4_symbol *symbol, void *ptr) { - m4 * context = (m4 *) ptr; - m4_symbol_value *value = m4_get_symbol_value (symbol); - int flags = value ? SYMBOL_FLAGS (symbol) : 0; - m4_module * module = value ? SYMBOL_MODULE (symbol) : NULL; - const char * module_name = module ? m4_get_module_name (module) : "NONE"; + m4 * context = (m4 *) ptr; + m4_symbol_value *value = m4_get_symbol_value (symbol); + int flags = value ? SYMBOL_FLAGS (symbol) : 0; + m4_module * module = value ? SYMBOL_MODULE (symbol) : NULL; + 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); diff --git a/m4/syntax.c b/m4/syntax.c index fa4cc003..9e8cf42e 100644 --- a/m4/syntax.c +++ b/m4/syntax.c @@ -32,27 +32,27 @@ are all in m4module.h, those marked with a * are not yet in use): Basic (all characters fall in one of these mutually exclusive bins) - M4_SYNTAX_IGNORE *Character to be deleted from input as if not present - M4_SYNTAX_OTHER Any character with no special meaning to m4 - M4_SYNTAX_SPACE Whitespace (ignored when leading macro arguments) - M4_SYNTAX_OPEN Open list of macro arguments - M4_SYNTAX_CLOSE Close list of macro arguments - M4_SYNTAX_COMMA Separates macro arguments - M4_SYNTAX_ACTIVE This character is a macro name by itself - M4_SYNTAX_ESCAPE Use this character to prefix all macro names + M4_SYNTAX_IGNORE *Character to be deleted from input as if not present + M4_SYNTAX_OTHER Any character with no special meaning to m4 + M4_SYNTAX_SPACE Whitespace (ignored when leading macro arguments) + M4_SYNTAX_OPEN Open list of macro arguments + M4_SYNTAX_CLOSE Close list of macro arguments + M4_SYNTAX_COMMA Separates macro arguments + M4_SYNTAX_ACTIVE This character is a macro name by itself + M4_SYNTAX_ESCAPE Use this character to prefix all macro names - M4_SYNTAX_ALPHA Alphabetic characters (can start macro names) - M4_SYNTAX_NUM Numeric characters (can form macro names) + M4_SYNTAX_ALPHA Alphabetic characters (can start macro names) + M4_SYNTAX_NUM Numeric characters (can form macro names) - M4_SYNTAX_LQUOTE A single character left quote - M4_SYNTAX_BCOMM A single character begin comment delimiter + M4_SYNTAX_LQUOTE A single character left quote + M4_SYNTAX_BCOMM A single character begin comment delimiter Attribute (these are context sensitive, and exist in addition to basic) - M4_SYNTAX_RQUOTE A single character right quote - M4_SYNTAX_ECOMM A single character end comment delimiter - M4_SYNTAX_DOLLAR Indicates macro argument in user macros - M4_SYNTAX_LBRACE *Indicates start of extended macro argument - M4_SYNTAX_RBRACE *Indicates end of extended macro argument + M4_SYNTAX_RQUOTE A single character right quote + M4_SYNTAX_ECOMM A single character end comment delimiter + M4_SYNTAX_DOLLAR Indicates macro argument in user macros + M4_SYNTAX_LBRACE *Indicates start of extended macro argument + M4_SYNTAX_RBRACE *Indicates end of extended macro argument Besides adding new facilities, the use of a syntax table will reduce the number of calls to next_token (). Now groups of OTHER, NUM and @@ -73,19 +73,19 @@ The precedence as implemented by next_token () is: - M4_SYNTAX_IGNORE *Filtered out below next_token () - M4_SYNTAX_ESCAPE Reads macro name iff set, else next character - M4_SYNTAX_ALPHA Reads M4_SYNTAX_ALPHA and M4_SYNTAX_NUM as macro name - M4_SYNTAX_LQUOTE Reads all until balanced M4_SYNTAX_RQUOTE - M4_SYNTAX_BCOMM Reads all until M4_SYNTAX_ECOMM + M4_SYNTAX_IGNORE *Filtered out below next_token () + M4_SYNTAX_ESCAPE Reads macro name iff set, else next character + M4_SYNTAX_ALPHA Reads M4_SYNTAX_ALPHA and M4_SYNTAX_NUM as macro name + M4_SYNTAX_LQUOTE Reads all until balanced M4_SYNTAX_RQUOTE + M4_SYNTAX_BCOMM Reads all until M4_SYNTAX_ECOMM - M4_SYNTAX_OTHER } Reads all M4_SYNTAX_OTHER, M4_SYNTAX_NUM + M4_SYNTAX_OTHER } Reads all M4_SYNTAX_OTHER, M4_SYNTAX_NUM M4_SYNTAX_NUM } - M4_SYNTAX_SPACE Reads all M4_SYNTAX_SPACE, depending on buffering - M4_SYNTAX_ACTIVE Returns a single char as a macro name + M4_SYNTAX_SPACE Reads all M4_SYNTAX_SPACE, depending on buffering + M4_SYNTAX_ACTIVE Returns a single char as a macro name - M4_SYNTAX_OPEN } Returned as a single char + M4_SYNTAX_OPEN } Returned as a single char M4_SYNTAX_CLOSE } M4_SYNTAX_COMMA } @@ -110,9 +110,9 @@ this is handled by m4__safe_quotes. Meanwhile, quotes and comments can be disabled if the leading delimiter is length 0. */ -static int add_syntax_attribute (m4_syntax_table *, char, int); -static int remove_syntax_attribute (m4_syntax_table *, char, int); -static void set_quote_age (m4_syntax_table *, bool, bool); +static int add_syntax_attribute (m4_syntax_table *, char, int); +static int remove_syntax_attribute (m4_syntax_table *, char, int); +static void set_quote_age (m4_syntax_table *, bool, bool); m4_syntax_table * m4_syntax_create (void) @@ -181,25 +181,25 @@ m4_syntax_code (char ch) { /* Sorted according to the order of M4_SYNTAX_* in m4module.h. */ /* FIXME - revisit the ignore syntax attribute. */ - case 'I': case 'i': code = M4_SYNTAX_IGNORE; break; + case 'I': case 'i': code = M4_SYNTAX_IGNORE; break; /* Basic categories. */ - case '@': code = M4_SYNTAX_ESCAPE; break; - case 'W': case 'w': code = M4_SYNTAX_ALPHA; break; - case 'L': case 'l': code = M4_SYNTAX_LQUOTE; break; - case 'B': case 'b': code = M4_SYNTAX_BCOMM; break; - case 'A': case 'a': code = M4_SYNTAX_ACTIVE; break; - case 'D': case 'd': code = M4_SYNTAX_NUM; break; - case 'S': case 's': code = M4_SYNTAX_SPACE; break; - case '(': code = M4_SYNTAX_OPEN; break; - case ')': code = M4_SYNTAX_CLOSE; break; - case ',': code = M4_SYNTAX_COMMA; break; - case 'O': case 'o': code = M4_SYNTAX_OTHER; break; + case '@': code = M4_SYNTAX_ESCAPE; break; + case 'W': case 'w': code = M4_SYNTAX_ALPHA; break; + case 'L': case 'l': code = M4_SYNTAX_LQUOTE; break; + case 'B': case 'b': code = M4_SYNTAX_BCOMM; break; + case 'A': case 'a': code = M4_SYNTAX_ACTIVE; break; + case 'D': case 'd': code = M4_SYNTAX_NUM; break; + case 'S': case 's': code = M4_SYNTAX_SPACE; break; + case '(': code = M4_SYNTAX_OPEN; break; + case ')': code = M4_SYNTAX_CLOSE; break; + case ',': code = M4_SYNTAX_COMMA; break; + case 'O': case 'o': code = M4_SYNTAX_OTHER; break; /* Context categories. */ - case '$': code = M4_SYNTAX_DOLLAR; break; - case '{': code = M4_SYNTAX_LBRACE; break; - case '}': code = M4_SYNTAX_RBRACE; break; - case 'R': case 'r': code = M4_SYNTAX_RQUOTE; break; - case 'E': case 'e': code = M4_SYNTAX_ECOMM; break; + case '$': code = M4_SYNTAX_DOLLAR; break; + case '{': code = M4_SYNTAX_LBRACE; break; + case '}': code = M4_SYNTAX_RBRACE; break; + case 'R': case 'r': code = M4_SYNTAX_RQUOTE; break; + case 'E': case 'e': code = M4_SYNTAX_ECOMM; break; default: code = -1; break; } diff --git a/m4/system_.h b/m4/system_.h index 85bd2b82..458c2ffb 100644 --- a/m4/system_.h +++ b/m4/system_.h @@ -77,11 +77,11 @@ #ifndef BEGIN_C_DECLS # ifdef __cplusplus -# define BEGIN_C_DECLS extern "C" { -# define END_C_DECLS } +# define BEGIN_C_DECLS extern "C" { +# define END_C_DECLS } # else /* !__cplusplus */ -# define BEGIN_C_DECLS /* empty */ -# define END_C_DECLS /* empty */ +# define BEGIN_C_DECLS /* empty */ +# define END_C_DECLS /* empty */ # endif /* __cplusplus */ #endif /* !BEGIN_C_DECLS */ @@ -132,23 +132,23 @@ BEGIN_C_DECLS /* Take advantage of GNU C compiler source level optimization hints, using portable macros. */ #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 6) -# define M4_GNUC_ATTRIBUTE(args) __attribute__ (args) +# define M4_GNUC_ATTRIBUTE(args) __attribute__ (args) #else # define M4_GNUC_ATTRIBUTE(args) #endif /* __GNUC__ */ -#define M4_GNUC_PRINTF(fmt, arg) \ +#define M4_GNUC_PRINTF(fmt, arg) \ M4_GNUC_ATTRIBUTE ((__format__ (__printf__, fmt, arg))) -#define M4_GNUC_SCANF(fmt, arg) \ +#define M4_GNUC_SCANF(fmt, arg) \ M4_GNUC_ATTRIBUTE ((__format__ (__scanf__, fmt, arg))) -#define M4_GNUC_NORETURN M4_GNUC_ATTRIBUTE ((__noreturn__)) -#define M4_GNUC_CONST M4_GNUC_ATTRIBUTE ((__const__)) -#define M4_GNUC_UNUSED M4_GNUC_ATTRIBUTE ((__unused__)) +#define M4_GNUC_NORETURN M4_GNUC_ATTRIBUTE ((__noreturn__)) +#define M4_GNUC_CONST M4_GNUC_ATTRIBUTE ((__const__)) +#define M4_GNUC_UNUSED M4_GNUC_ATTRIBUTE ((__unused__)) #if !defined __PRETTY_FUNCTION__ -# define __PRETTY_FUNCTION__ "" +# define __PRETTY_FUNCTION__ "" #endif @@ -158,13 +158,13 @@ BEGIN_C_DECLS if the arguments to STR() (or CONC()) are themselves macros, they will be expanded before being quoted. */ #ifndef STR -# define _STR(arg) #arg -# define STR(arg) _STR (arg) +# define _STR(arg) #arg +# define STR(arg) _STR (arg) #endif #ifndef CONC -# define _CONC(a, b) a##b -# define CONC(a, b) _CONC (a, b) +# define _CONC(a, b) a##b +# define CONC(a, b) _CONC (a, b) #endif END_C_DECLS diff --git a/modules/evalparse.c b/modules/evalparse.c index 2b0321b4..3ed29d74 100644 --- a/modules/evalparse.c +++ b/modules/evalparse.c @@ -71,22 +71,22 @@ typedef enum eval_error } eval_error; -static eval_error comma_term (m4 *, eval_token, number *); -static eval_error condition_term (m4 *, eval_token, number *); -static eval_error logical_or_term (m4 *, eval_token, number *); -static eval_error logical_and_term (m4 *, eval_token, number *); -static eval_error or_term (m4 *, eval_token, number *); -static eval_error xor_term (m4 *, eval_token, number *); -static eval_error and_term (m4 *, eval_token, number *); -static eval_error equality_term (m4 *, eval_token, number *); -static eval_error cmp_term (m4 *, eval_token, number *); -static eval_error shift_term (m4 *, eval_token, number *); -static eval_error add_term (m4 *, eval_token, number *); -static eval_error mult_term (m4 *, eval_token, number *); -static eval_error exp_term (m4 *, eval_token, number *); -static eval_error unary_term (m4 *, eval_token, number *); -static eval_error simple_term (m4 *, eval_token, number *); -static eval_error numb_pow (number *, number *); +static eval_error comma_term (m4 *, eval_token, number *); +static eval_error condition_term (m4 *, eval_token, number *); +static eval_error logical_or_term (m4 *, eval_token, number *); +static eval_error logical_and_term (m4 *, eval_token, number *); +static eval_error or_term (m4 *, eval_token, number *); +static eval_error xor_term (m4 *, eval_token, number *); +static eval_error and_term (m4 *, eval_token, number *); +static eval_error equality_term (m4 *, eval_token, number *); +static eval_error cmp_term (m4 *, eval_token, number *); +static eval_error shift_term (m4 *, eval_token, number *); +static eval_error add_term (m4 *, eval_token, number *); +static eval_error mult_term (m4 *, eval_token, number *); +static eval_error exp_term (m4 *, eval_token, number *); +static eval_error unary_term (m4 *, eval_token, number *); +static eval_error simple_term (m4 *, eval_token, number *); +static eval_error numb_pow (number *, number *); @@ -893,12 +893,12 @@ void m4_evaluate (m4 *context, m4_obstack *obs, size_t argc, m4_macro_args *argv) { const m4_call_info *me = m4_arg_info (argv); - const char * str = M4ARG (1); - int radix = 10; - int min = 1; - number val; - eval_token et; - eval_error err = NO_ERROR; + const char * str = M4ARG (1); + int radix = 10; + int min = 1; + number val; + eval_token et; + eval_error err = NO_ERROR; if (!m4_arg_empty (argv, 2) && !m4_numeric_arg (context, me, M4ARG (2), M4ARGLEN (2), &radix)) diff --git a/modules/format.c b/modules/format.c index 61338b9d..b772290a 100644 --- a/modules/format.c +++ b/modules/format.c @@ -120,16 +120,16 @@ arg_double (struct m4 *context, const m4_call_info *me, const char *str, return value; } -#define ARG_INT(i, argc, argv) \ +#define ARG_INT(i, argc, argv) \ ((argc <= ++i) ? 0 : arg_int (context, me, M4ARG (i), M4ARGLEN (i))) -#define ARG_LONG(i, argc, argv) \ +#define ARG_LONG(i, argc, argv) \ ((argc <= ++i) ? 0L : arg_long (context, me, M4ARG (i), M4ARGLEN (i))) -#define ARG_STR(i, argc, argv) \ +#define ARG_STR(i, argc, argv) \ ((argc <= ++i) ? "" : arg_string (context, me, M4ARG (i), M4ARGLEN (i))) -#define ARG_DOUBLE(i, argc, argv) \ +#define ARG_DOUBLE(i, argc, argv) \ ((argc <= ++i) ? 0.0 : arg_double (context, me, M4ARG (i), M4ARGLEN (i))) @@ -143,31 +143,31 @@ static void format (m4 *context, m4_obstack *obs, int argc, m4_macro_args *argv) { const m4_call_info *me = m4_arg_info (argv); - const char *f; /* Format control string. */ - size_t f_len; /* Length of f. */ - const char *fmt; /* Position within f. */ - char fstart[] = "%'+- 0#*.*hhd"; /* Current format spec. */ - char *p; /* Position within fstart. */ - unsigned char c; /* A simple character. */ - int i = 1; /* Index within argc used so far. */ - bool valid_format = true; /* True if entire format string ok. */ + const char *f; /* Format control string. */ + size_t f_len; /* Length of f. */ + const char *fmt; /* Position within f. */ + char fstart[] = "%'+- 0#*.*hhd"; /* Current format spec. */ + char *p; /* Position within fstart. */ + unsigned char c; /* A simple character. */ + int i = 1; /* Index within argc used so far. */ + bool valid_format = true; /* True if entire format string ok. */ /* Flags. */ - char flags; /* Flags to use in fstart. */ + char flags; /* Flags to use in fstart. */ enum { - THOUSANDS = 0x01, /* '\''. */ - PLUS = 0x02, /* '+'. */ - MINUS = 0x04, /* '-'. */ - SPACE = 0x08, /* ' '. */ - ZERO = 0x10, /* '0'. */ - ALT = 0x20, /* '#'. */ - DONE = 0x40 /* No more flags. */ + THOUSANDS = 0x01, /* '\''. */ + PLUS = 0x02, /* '+'. */ + MINUS = 0x04, /* '-'. */ + SPACE = 0x08, /* ' '. */ + ZERO = 0x10, /* '0'. */ + ALT = 0x20, /* '#'. */ + DONE = 0x40 /* No more flags. */ }; /* Precision specifiers. */ - int width; /* Minimum field width. */ - int prec; /* Precision. */ - char lflag; /* Long flag. */ + int width; /* Minimum field width. */ + int prec; /* Precision. */ + char lflag; /* Long flag. */ /* Specifiers we are willing to accept. ok['x'] implies %x is ok. Various modifiers reduce the set, in order to avoid undefined @@ -214,33 +214,33 @@ format (m4 *context, m4_obstack *obs, int argc, m4_macro_args *argv) { switch (*fmt) { - case '\'': /* thousands separator */ + 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 */ + 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 */ + 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 */ + case '0': /* zero padding */ ok['c'] = ok['s'] = 0; flags |= ZERO; break; - case '#': /* alternate output */ + case '#': /* alternate output */ ok['c'] = ok['d'] = ok['i'] = ok['s'] = ok['u'] = 0; flags |= ALT; break; - case '-': /* left justification */ + case '-': /* left justification */ flags |= MINUS; break; diff --git a/modules/gnu.c b/modules/gnu.c index 798cc5ec..5aa4e74a 100644 --- a/modules/gnu.c +++ b/modules/gnu.c @@ -34,33 +34,33 @@ #include "wait-process.h" /* Rename exported symbols for dlpreload()ing. */ -#define m4_builtin_table gnu_LTX_m4_builtin_table -#define m4_macro_table gnu_LTX_m4_macro_table +#define m4_builtin_table gnu_LTX_m4_builtin_table +#define m4_macro_table gnu_LTX_m4_macro_table /* 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 */ -#define builtin_functions \ - BUILTIN (__file__, false, false, false, 0, 0 ) \ - BUILTIN (__line__, false, false, false, 0, 0 ) \ - BUILTIN (__program__, false, false, false, 0, 0 ) \ - BUILTIN (builtin, true, true, false, 1, -1 ) \ - BUILTIN (changeresyntax,false,true, false, 1, 1 ) \ - BUILTIN (changesyntax,false, true, false, 1, -1 ) \ - BUILTIN (debugfile, false, false, false, 0, 1 ) \ - BUILTIN (debuglen, false, true, false, 1, 1 ) \ - BUILTIN (debugmode, false, false, false, 0, 1 ) \ - BUILTIN (esyscmd, false, true, true, 1, 1 ) \ - BUILTIN (format, false, true, false, 1, -1 ) \ - BUILTIN (indir, true, true, false, 1, -1 ) \ - BUILTIN (mkdtemp, false, true, false, 1, 1 ) \ - BUILTIN (patsubst, false, true, true, 2, 4 ) \ - BUILTIN (regexp, false, true, true, 2, 4 ) \ - BUILTIN (renamesyms, false, true, false, 2, 3 ) \ - BUILTIN (m4symbols, true, false, false, 0, -1 ) \ - BUILTIN (syncoutput, false, true, false, 1, 1 ) \ + function macros blind side minargs maxargs */ +#define builtin_functions \ + BUILTIN (__file__, false, false, false, 0, 0 ) \ + BUILTIN (__line__, false, false, false, 0, 0 ) \ + BUILTIN (__program__, false, false, false, 0, 0 ) \ + BUILTIN (builtin, true, true, false, 1, -1 ) \ + BUILTIN (changeresyntax,false,true, false, 1, 1 ) \ + BUILTIN (changesyntax,false, true, false, 1, -1 ) \ + BUILTIN (debugfile, false, false, false, 0, 1 ) \ + BUILTIN (debuglen, false, true, false, 1, 1 ) \ + BUILTIN (debugmode, false, false, false, 0, 1 ) \ + BUILTIN (esyscmd, false, true, true, 1, 1 ) \ + BUILTIN (format, false, true, false, 1, -1 ) \ + BUILTIN (indir, true, true, false, 1, -1 ) \ + BUILTIN (mkdtemp, false, true, false, 1, 1 ) \ + BUILTIN (patsubst, false, true, true, 2, 4 ) \ + BUILTIN (regexp, false, true, true, 2, 4 ) \ + BUILTIN (renamesyms, false, true, false, 2, 3 ) \ + BUILTIN (m4symbols, true, false, false, 0, -1 ) \ + BUILTIN (syncoutput, false, true, false, 1, 1 ) \ /* Generate prototypes for each builtin handler function. */ @@ -72,7 +72,7 @@ /* Generate a table for mapping m4 symbol names to handler functions. */ const m4_builtin m4_builtin_table[] = { -#define BUILTIN(handler, macros, blind, side, min, max) \ +#define BUILTIN(handler, macros, blind, side, min, max) \ M4BUILTIN_ENTRY (handler, #handler, macros, blind, side, min, max) builtin_functions @@ -85,20 +85,20 @@ const m4_builtin m4_builtin_table[] = /* A table for mapping m4 symbol names to simple expansion text. */ const m4_macro m4_macro_table[] = { - /* name text min max */ + /* name text min max */ #if UNIX - { "__unix__", "", 0, 0 }, + { "__unix__", "", 0, 0 }, #endif #if W32_NATIVE - { "__windows__", "", 0, 0 }, + { "__windows__", "", 0, 0 }, #endif #if OS2 - { "__os2__", "", 0, 0 }, + { "__os2__", "", 0, 0 }, #endif - { "__gnu__", "", 0, 0 }, - { "__m4_version__", VERSION,0, 0 }, + { "__gnu__", "", 0, 0 }, + { "__m4_version__", VERSION,0, 0 }, - { NULL, NULL, 0, 0 }, + { NULL, NULL, 0, 0 }, }; @@ -117,12 +117,12 @@ const m4_macro m4_macro_table[] = /* Structure for using a compiled regex, as well as making it easier to cache frequently used expressions. */ typedef struct { - unsigned count; /* usage counter */ - int resyntax; /* flavor of regex */ - size_t len; /* length of string */ - char *str; /* copy of compiled string */ - struct re_pattern_buffer *pat; /* compiled regex, allocated */ - struct re_registers regs; /* match registers, reused */ + unsigned count; /* usage counter */ + int resyntax; /* flavor of regex */ + size_t len; /* length of string */ + char *str; /* copy of compiled string */ + struct re_pattern_buffer *pat; /* compiled regex, allocated */ + struct re_registers regs; /* match registers, reused */ } m4_pattern_buffer; /* Storage for the cache of regular expressions. */ @@ -146,10 +146,10 @@ regexp_compile (m4 *context, const m4_call_info *caller, const char *regexp, use a static variable. To be reentrant, we would need a mutex in this method, and move the storage for regex_cache into context. */ - const char *msg; /* error message from re_compile_pattern */ - int i; /* iterator */ - m4_pattern_buffer *victim; /* cache slot to replace */ - unsigned victim_count; /* track which victim to replace */ + const char *msg; /* error message from re_compile_pattern */ + int i; /* iterator */ + m4_pattern_buffer *victim; /* cache slot to replace */ + unsigned victim_count; /* track which victim to replace */ struct re_pattern_buffer *pat;/* newly compiled regex */ /* First, check if REGEXP is already cached with the given RESYNTAX. @@ -300,9 +300,9 @@ regexp_substitute (m4 *context, m4_obstack *obs, const m4_call_info *caller, 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 */ - bool subst = !optimize; /* if a substitution has been made */ + regoff_t matchpos = 0; /* start position of match */ + size_t offset = 0; /* current match offset */ + bool subst = !optimize; /* if a substitution has been made */ while (offset <= len) { @@ -834,13 +834,13 @@ M4BUILTIN_HANDLER (mkdtemp) M4BUILTIN_HANDLER (patsubst) { const m4_call_info *me = m4_arg_info (argv); - const char *pattern; /* regular expression */ - const char *replace; /* replacement */ - m4_pattern_buffer *buf; /* compiled regular expression */ + const char *pattern; /* regular expression */ + const char *replace; /* replacement */ + m4_pattern_buffer *buf; /* compiled regular expression */ int resyntax; resyntax = m4_get_regexp_syntax_opt (context); - if (argc >= 5) /* additional args ignored */ + if (argc >= 5) /* additional args ignored */ { resyntax = m4_resyntax_encode_safe (context, me, M4ARG (4), M4ARGLEN (4)); @@ -881,12 +881,12 @@ M4BUILTIN_HANDLER (patsubst) M4BUILTIN_HANDLER (regexp) { const m4_call_info *me = m4_arg_info (argv); - const char *victim; /* string to search */ - const char *pattern; /* regular expression */ - const char *replace; /* optional replacement string */ - m4_pattern_buffer *buf; /* compiled regular expression */ - regoff_t startpos; /* start position of match */ - size_t len; /* length of first argument */ + const char *victim; /* string to search */ + const char *pattern; /* regular expression */ + const char *replace; /* optional replacement string */ + m4_pattern_buffer *buf; /* compiled regular expression */ + regoff_t startpos; /* start position of match */ + size_t len; /* length of first argument */ int resyntax; pattern = M4ARG (2); @@ -966,14 +966,14 @@ M4BUILTIN_HANDLER (renamesyms) if (m4_dump_symbols) { const m4_call_info *me = m4_arg_info (argv); - const char *regexp; /* regular expression string */ + const char *regexp; /* regular expression string */ size_t regexp_len; - const char *replace; /* replacement expression string */ + const char *replace; /* replacement expression string */ size_t replace_len; - m4_pattern_buffer *buf; /* compiled regular expression */ + m4_pattern_buffer *buf; /* compiled regular expression */ - m4_dump_symbol_data data; + m4_dump_symbol_data data; int resyntax; diff --git a/modules/import.c b/modules/import.c index bc90b803..1fdf8e1f 100644 --- a/modules/import.c +++ b/modules/import.c @@ -29,13 +29,13 @@ #endif /* Rename exported symbols for dlpreload()ing. */ -#define m4_builtin_table import_LTX_m4_builtin_table +#define m4_builtin_table import_LTX_m4_builtin_table -/* function macros blind side minargs maxargs */ -#define builtin_functions \ - BUILTIN (import, false, false, false, 0, 1) \ - BUILTIN (symbol_fail, false, false, false, 0, 1) \ - BUILTIN (module_fail, false, false, false, 0, 1) \ +/* function macros blind side minargs maxargs */ +#define builtin_functions \ + BUILTIN (import, false, false, false, 0, 1) \ + BUILTIN (symbol_fail, false, false, false, 0, 1) \ + BUILTIN (module_fail, false, false, false, 0, 1) \ #define BUILTIN(handler, macros, blind, side, min, max) M4BUILTIN (handler) builtin_functions @@ -43,7 +43,7 @@ const m4_builtin m4_builtin_table[] = { -#define BUILTIN(handler, macros, blind, side, min, max) \ +#define BUILTIN(handler, macros, blind, side, min, max) \ M4BUILTIN_ENTRY (handler, #handler, macros, blind, side, min, max) builtin_functions diff --git a/modules/load.c b/modules/load.c index 248ebf18..1a61037f 100644 --- a/modules/load.c +++ b/modules/load.c @@ -26,19 +26,19 @@ /* Rename exported symbols for dlpreload()ing. */ -#define m4_builtin_table load_LTX_m4_builtin_table -#define m4_macro_table load_LTX_m4_macro_table +#define m4_builtin_table load_LTX_m4_builtin_table +#define m4_macro_table load_LTX_m4_macro_table /* 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 */ -#define builtin_functions \ - BUILTIN (load, false, true, false, 1, 1 ) \ - BUILTIN (m4modules, false, false, false, 0, 0 ) \ - BUILTIN (refcount, false, true, false, 1, 1 ) \ - BUILTIN (unload, false, true, false, 1, 1 ) \ + function macros blind side minargs maxargs */ +#define builtin_functions \ + BUILTIN (load, false, true, false, 1, 1 ) \ + BUILTIN (m4modules, false, false, false, 0, 0 ) \ + BUILTIN (refcount, false, true, false, 1, 1 ) \ + BUILTIN (unload, false, true, false, 1, 1 ) \ /* Generate prototypes for each builtin handler function. */ @@ -50,7 +50,7 @@ /* Generate a table for mapping m4 symbol names to handler functions. */ const m4_builtin m4_builtin_table[] = { -#define BUILTIN(handler, macros, blind, side, min, max) \ +#define BUILTIN(handler, macros, blind, side, min, max) \ M4BUILTIN_ENTRY (handler, #handler, macros, blind, side, min, max) builtin_functions @@ -63,9 +63,9 @@ const m4_builtin m4_builtin_table[] = /* A table for mapping m4 symbol names to simple expansion text. */ const m4_macro m4_macro_table[] = { - /* name text min max */ - { "__load__", "", 0, 0 }, - { NULL, NULL, 0, 0 }, + /* name text min max */ + { "__load__", "", 0, 0 }, + { NULL, NULL, 0, 0 }, }; diff --git a/modules/m4.c b/modules/m4.c index a2e7423e..9091d815 100644 --- a/modules/m4.c +++ b/modules/m4.c @@ -39,13 +39,13 @@ #include /* Rename exported symbols for dlpreload()ing. */ -#define m4_builtin_table m4_LTX_m4_builtin_table +#define m4_builtin_table m4_LTX_m4_builtin_table -#define m4_set_sysval m4_LTX_m4_set_sysval -#define m4_sysval_flush m4_LTX_m4_sysval_flush -#define m4_dump_symbols m4_LTX_m4_dump_symbols -#define m4_expand_ranges m4_LTX_m4_expand_ranges -#define m4_make_temp m4_LTX_m4_make_temp +#define m4_set_sysval m4_LTX_m4_set_sysval +#define m4_sysval_flush m4_LTX_m4_sysval_flush +#define m4_dump_symbols m4_LTX_m4_dump_symbols +#define m4_expand_ranges m4_LTX_m4_expand_ranges +#define m4_make_temp m4_LTX_m4_make_temp extern void m4_set_sysval (int); extern void m4_sysval_flush (m4 *, bool); @@ -58,53 +58,53 @@ extern void m4_make_temp (m4 *, m4_obstack *, const m4_call_info *, /* 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 */ -#define builtin_functions \ - BUILTIN (changecom, false, false, false, 0, 2 ) \ - BUILTIN (changequote, false, false, false, 0, 2 ) \ - BUILTIN (decr, false, true, true, 1, 1 ) \ - BUILTIN (define, true, true, false, 1, 2 ) \ - BUILTIN (defn, true, true, false, 1, -1 ) \ - BUILTIN (divert, false, false, false, 0, 2 ) \ - BUILTIN (divnum, false, false, false, 0, 0 ) \ - BUILTIN (dnl, false, false, false, 0, 0 ) \ - BUILTIN (dumpdef, true, false, false, 0, -1 ) \ - BUILTIN (errprint, false, true, false, 1, -1 ) \ - BUILTIN (eval, false, true, true, 1, 3 ) \ - BUILTIN (ifdef, true, true, false, 2, 3 ) \ - BUILTIN (ifelse, true, true, false, 1, -1 ) \ - BUILTIN (include, false, true, false, 1, 1 ) \ - BUILTIN (incr, false, true, true, 1, 1 ) \ - BUILTIN (index, false, true, true, 2, 3 ) \ - BUILTIN (len, false, true, true, 1, 1 ) \ - BUILTIN (m4exit, false, false, false, 0, 1 ) \ - BUILTIN (m4wrap, true, true, false, 1, -1 ) \ - BUILTIN (maketemp, false, true, false, 1, 1 ) \ - BUILTIN (mkstemp, false, true, false, 1, 1 ) \ - BUILTIN (popdef, true, true, false, 1, -1 ) \ - BUILTIN (pushdef, true, true, false, 1, 2 ) \ - BUILTIN (shift, true, true, false, 1, -1 ) \ - BUILTIN (sinclude, false, true, false, 1, 1 ) \ - BUILTIN (substr, false, true, true, 2, 4 ) \ - BUILTIN (syscmd, false, true, true, 1, 1 ) \ - BUILTIN (sysval, false, false, false, 0, 0 ) \ - BUILTIN (traceoff, true, false, false, 0, -1 ) \ - BUILTIN (traceon, true, false, false, 0, -1 ) \ - BUILTIN (translit, false, true, true, 2, 3 ) \ - BUILTIN (undefine, true, true, false, 1, -1 ) \ - BUILTIN (undivert, false, false, false, 0, -1 ) \ + function macros blind side minargs maxargs */ +#define builtin_functions \ + BUILTIN (changecom, false, false, false, 0, 2 ) \ + BUILTIN (changequote, false, false, false, 0, 2 ) \ + BUILTIN (decr, false, true, true, 1, 1 ) \ + BUILTIN (define, true, true, false, 1, 2 ) \ + BUILTIN (defn, true, true, false, 1, -1 ) \ + BUILTIN (divert, false, false, false, 0, 2 ) \ + BUILTIN (divnum, false, false, false, 0, 0 ) \ + BUILTIN (dnl, false, false, false, 0, 0 ) \ + BUILTIN (dumpdef, true, false, false, 0, -1 ) \ + BUILTIN (errprint, false, true, false, 1, -1 ) \ + BUILTIN (eval, false, true, true, 1, 3 ) \ + BUILTIN (ifdef, true, true, false, 2, 3 ) \ + BUILTIN (ifelse, true, true, false, 1, -1 ) \ + BUILTIN (include, false, true, false, 1, 1 ) \ + BUILTIN (incr, false, true, true, 1, 1 ) \ + BUILTIN (index, false, true, true, 2, 3 ) \ + BUILTIN (len, false, true, true, 1, 1 ) \ + BUILTIN (m4exit, false, false, false, 0, 1 ) \ + BUILTIN (m4wrap, true, true, false, 1, -1 ) \ + BUILTIN (maketemp, false, true, false, 1, 1 ) \ + BUILTIN (mkstemp, false, true, false, 1, 1 ) \ + BUILTIN (popdef, true, true, false, 1, -1 ) \ + BUILTIN (pushdef, true, true, false, 1, 2 ) \ + BUILTIN (shift, true, true, false, 1, -1 ) \ + BUILTIN (sinclude, false, true, false, 1, 1 ) \ + BUILTIN (substr, false, true, true, 2, 4 ) \ + BUILTIN (syscmd, false, true, true, 1, 1 ) \ + BUILTIN (sysval, false, false, false, 0, 0 ) \ + BUILTIN (traceoff, true, false, false, 0, -1 ) \ + BUILTIN (traceon, true, false, false, 0, -1 ) \ + BUILTIN (translit, false, true, true, 2, 3 ) \ + BUILTIN (undefine, true, true, false, 1, -1 ) \ + BUILTIN (undivert, false, false, false, 0, -1 ) \ typedef intmax_t number; typedef uintmax_t unumber; -static void include (m4 *context, int argc, m4_macro_args *argv, +static void include (m4 *context, int argc, m4_macro_args *argv, 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, +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); -static const char *ntoa (number value, int radix); -static void numb_obstack (m4_obstack *obs, number value, +static const char *ntoa (number value, int radix); +static void numb_obstack (m4_obstack *obs, number value, int radix, int min); @@ -117,7 +117,7 @@ static void numb_obstack (m4_obstack *obs, number value, /* Generate a table for mapping m4 symbol names to handler functions. */ const m4_builtin m4_builtin_table[] = { -#define BUILTIN(handler, macros, blind, side, min, max) \ +#define BUILTIN(handler, macros, blind, side, min, max) \ M4BUILTIN_ENTRY (handler, #handler, macros, blind, side, min, max) builtin_functions @@ -1230,11 +1230,11 @@ M4BUILTIN_HANDLER (translit) #define numb_times(x, y) ((x) = ((x) * (y))) /* Be careful of x86 SIGFPE. */ -#define numb_ratio(x, y) \ +#define numb_ratio(x, y) \ (((y) == -1) ? (numb_negate (x)) : ((x) /= (y))) -#define numb_divide(x, y) \ +#define numb_divide(x, y) \ ((*(y) == -1) ? (numb_negate (*(y))) : (*(x) /= *(y))) -#define numb_modulo(c, x, y) \ +#define numb_modulo(c, x, y) \ ((*(y) == -1) ? (*(x) = numb_ZERO) : (*(x) %= *(y))) /* numb_invert is only used in the context of x**-y, which integral math does not support. */ @@ -1247,13 +1247,13 @@ M4BUILTIN_HANDLER (translit) implementation-defined overflow when casting unsigned to signed is a silent twos-complement wrap-around. */ #define shift_mask (sizeof (number) * CHAR_BIT - 1) -#define numb_lshift(c, x, y) \ +#define numb_lshift(c, x, y) \ (*(x) = (number) ((unumber) *(x) << (*(y) & shift_mask))) -#define numb_rshift(c, x, y) \ - (*(x) = (number) (*(x) < 0 \ +#define numb_rshift(c, x, y) \ + (*(x) = (number) (*(x) < 0 \ ? ~(~(unumber) *(x) >> (*(y) & shift_mask)) \ : (unumber) *(x) >> (*(y) & shift_mask))) -#define numb_urshift(c, x, y) \ +#define numb_urshift(c, x, y) \ (*(x) = (number) ((unumber) *(x) >> (*(y) & shift_mask))) @@ -1350,5 +1350,5 @@ numb_initialise (void) /* This macro defines the top level code for the "eval" builtin. The actual work is done in the function m4_evaluate (), which lives in evalparse.c. */ -#define m4_evaluate builtin_eval +#define m4_evaluate builtin_eval #include "evalparse.c" diff --git a/modules/m4.h b/modules/m4.h index a6d3c920..06361887 100644 --- a/modules/m4.h +++ b/modules/m4.h @@ -29,9 +29,9 @@ BEGIN_C_DECLS from call to call in m4_dump_symbols. */ typedef struct { - m4_obstack *obs; /* obstack for table */ - const m4_string *base; /* base of table */ - int size; /* size of table */ + m4_obstack *obs; /* obstack for table */ + const m4_string *base; /* base of table */ + int size; /* size of table */ } m4_dump_symbol_data; diff --git a/modules/modtest.c b/modules/modtest.c index effd7e3b..00430195 100644 --- a/modules/modtest.c +++ b/modules/modtest.c @@ -29,16 +29,16 @@ #endif /* Rename exported symbols for dlpreload()ing. */ -#define m4_builtin_table modtest_LTX_m4_builtin_table -#define m4_macro_table modtest_LTX_m4_macro_table +#define m4_builtin_table modtest_LTX_m4_builtin_table +#define m4_macro_table modtest_LTX_m4_macro_table -#define export_test modtest_LTX_export_test +#define export_test modtest_LTX_export_test extern bool export_test (const char *foo); -/* function macros blind side minargs maxargs */ -#define builtin_functions \ - BUILTIN (test, false, false, false, 0, 0) +/* function macros blind side minargs maxargs */ +#define builtin_functions \ + BUILTIN (test, false, false, false, 0, 0) #define BUILTIN(handler, macros, blind, side, min, max) M4BUILTIN (handler) builtin_functions @@ -46,7 +46,7 @@ extern bool export_test (const char *foo); const m4_builtin m4_builtin_table[] = { -#define BUILTIN(handler, macros, blind, side, min, max) \ +#define BUILTIN(handler, macros, blind, side, min, max) \ M4BUILTIN_ENTRY (handler, #handler, macros, blind, side, min, max) builtin_functions @@ -57,11 +57,11 @@ const m4_builtin m4_builtin_table[] = const m4_macro m4_macro_table[] = { - /* name text min max */ - { "__test__", "`modtest'", 0, 0 }, - { "onearg", "$1", 1, 1 }, - { "manyargs", "$@", 0, SIZE_MAX }, - { NULL, NULL, 0, 0 }, + /* name text min max */ + { "__test__", "`modtest'", 0, 0 }, + { "onearg", "$1", 1, 1 }, + { "manyargs", "$@", 0, SIZE_MAX }, + { NULL, NULL, 0, 0 }, }; diff --git a/modules/mpeval.c b/modules/mpeval.c index 76384431..44a0d3d0 100644 --- a/modules/mpeval.c +++ b/modules/mpeval.c @@ -35,16 +35,16 @@ #include "quotearg.h" /* Rename exported symbols for dlpreload()ing. */ -#define m4_builtin_table mpeval_LTX_m4_builtin_table -#define m4_macro_table mpeval_LTX_m4_macro_table +#define m4_builtin_table mpeval_LTX_m4_builtin_table +#define m4_macro_table mpeval_LTX_m4_macro_table /* 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 */ -#define builtin_functions \ - BUILTIN (mpeval, false, true, true, 1, 3 ) \ + function macros blind side minargs maxargs */ +#define builtin_functions \ + BUILTIN (mpeval, false, true, true, 1, 3 ) \ @@ -69,25 +69,25 @@ #define numb_lior(x, y) numb_set (x, numb_zerop (x) ? y : x) #define numb_land(x, y) numb_set (x, numb_zerop (x) ? numb_ZERO : y) -#define reduce1(f1, x) \ - do \ - { \ - number T; \ - mpq_init (T); \ - f1 (T, x); \ - mpq_set (x, T); \ - mpq_clear (T); \ - } \ +#define reduce1(f1, x) \ + do \ + { \ + number T; \ + mpq_init (T); \ + f1 (T, x); \ + mpq_set (x, T); \ + mpq_clear (T); \ + } \ while (0) -#define reduce2(f2,x,y) \ - do \ - { \ - number T; \ - mpq_init (T); \ - f2 (T, (x), (y)); \ - mpq_set ((x), T); \ - mpq_clear (T); \ - } \ +#define reduce2(f2,x,y) \ + do \ + { \ + number T; \ + mpq_init (T); \ + f2 (T, (x), (y)); \ + mpq_set ((x), T); \ + mpq_clear (T); \ + } \ while (0) #define numb_plus(x, y) reduce2 (mpq_add, x, y) @@ -110,7 +110,7 @@ /* Generate a table for mapping m4 symbol names to handler functions. */ const m4_builtin m4_builtin_table[] = { -#define BUILTIN(handler, macros, blind, side, min, max) \ +#define BUILTIN(handler, macros, blind, side, min, max) \ M4BUILTIN_ENTRY (handler, #handler, macros, blind, side, min, max) builtin_functions @@ -123,9 +123,9 @@ const m4_builtin m4_builtin_table[] = /* A table for mapping m4 symbol names to simple expansion text. */ const m4_macro m4_macro_table[] = { - /* name text min max */ - { "__mpeval__", "", 0, 0 }, - { NULL, NULL, 0, 0 }, + /* name text min max */ + { "__mpeval__", "", 0, 0 }, + { NULL, NULL, 0, 0 }, }; @@ -448,5 +448,5 @@ numb_rshift (m4 *context, number * x, number * y) mpz_clear (res); } -#define m4_evaluate builtin_mpeval +#define m4_evaluate builtin_mpeval #include "evalparse.c" diff --git a/modules/perl.c b/modules/perl.c index 58febce5..e823c8b4 100644 --- a/modules/perl.c +++ b/modules/perl.c @@ -29,17 +29,17 @@ #endif #undef PACKAGE -#include "perlxsi.c" /* Perl stuff */ +#include "perlxsi.c" /* Perl stuff */ #undef try #undef _ /* Rename exported symbols for dlpreload()ing. */ -#define m4_builtin_table perl_LTX_m4_builtin_table -#define m4_macro_table perl_LTX_m4_macro_table +#define m4_builtin_table perl_LTX_m4_builtin_table +#define m4_macro_table perl_LTX_m4_macro_table -/* function macros blind side minargs maxargs */ -#define builtin_functions \ - BUILTIN (perleval, false, false, false, 0, -1 ) \ +/* function macros blind side minargs maxargs */ +#define builtin_functions \ + BUILTIN (perleval, false, false, false, 0, -1 ) \ #define BUILTIN(handler, macros, blind, side, min, max) M4BUILTIN (handler) @@ -48,7 +48,7 @@ const m4_builtin m4_builtin_table[] = { -#define BUILTIN(handler, macros, blind, side, min, max) \ +#define BUILTIN(handler, macros, blind, side, min, max) \ M4BUILTIN_ENTRY (handler, #handler, macros, blind, side, min, max) builtin_functions @@ -60,9 +60,9 @@ const m4_builtin m4_builtin_table[] = /* A table for mapping m4 symbol names to simple expansion text. */ const m4_macro m4_macro_table[] = { - /* name text min max */ - { "__perleval__", "", 0, 0 }, - { NULL, NULL, 0, 0 }, + /* name text min max */ + { "__perleval__", "", 0, 0 }, + { NULL, NULL, 0, 0 }, }; diff --git a/modules/shadow.c b/modules/shadow.c index 7febf9ae..6f137b3a 100644 --- a/modules/shadow.c +++ b/modules/shadow.c @@ -29,13 +29,13 @@ #endif /* Rename exported symbols for dlpreload()ing. */ -#define m4_builtin_table shadow_LTX_m4_builtin_table -#define m4_macro_table shadow_LTX_m4_macro_table +#define m4_builtin_table shadow_LTX_m4_builtin_table +#define m4_macro_table shadow_LTX_m4_macro_table -/* function macros blind side minargs maxargs */ -#define builtin_functions \ - BUILTIN (shadow, false, false, false, 0, -1 ) \ - BUILTIN (test, false, false, false, 0, -1 ) \ +/* function macros blind side minargs maxargs */ +#define builtin_functions \ + BUILTIN (shadow, false, false, false, 0, -1 ) \ + BUILTIN (test, false, false, false, 0, -1 ) \ #define BUILTIN(handler, macros, blind, side, min, max) M4BUILTIN (handler) @@ -44,7 +44,7 @@ const m4_builtin m4_builtin_table[] = { -#define BUILTIN(handler, macros, blind, side, min, max) \ +#define BUILTIN(handler, macros, blind, side, min, max) \ M4BUILTIN_ENTRY (handler, #handler, macros, blind, side, min, max) builtin_functions @@ -55,9 +55,9 @@ const m4_builtin m4_builtin_table[] = const m4_macro m4_macro_table[] = { - /* name text min max */ - { "__test__", "`shadow'", 0, 0 }, - { NULL, NULL, 0, 0 }, + /* name text min max */ + { "__test__", "`shadow'", 0, 0 }, + { NULL, NULL, 0, 0 }, }; diff --git a/modules/stdlib.c b/modules/stdlib.c index 6b660bdd..f080e71e 100644 --- a/modules/stdlib.c +++ b/modules/stdlib.c @@ -37,24 +37,24 @@ #endif /* Rename exported symbols for dlpreload()ing. */ -#define m4_builtin_table stdlib_LTX_m4_builtin_table - -/* function macros blind side minargs maxargs */ -#define builtin_functions \ - BUILTIN (getcwd, false, false, false, 0, 0 ) \ - BUILTIN (getenv, false, true, false, 1, 1 ) \ - BUILTIN (getlogin, false, false, false, 0, 0 ) \ - BUILTIN (getpid, false, false, false, 0, 0 ) \ - BUILTIN (getppid, false, false, false, 0, 0 ) \ - BUILTIN (getuid, false, false, false, 0, 0 ) \ - BUILTIN (getpwnam, false, true, false, 1, 1 ) \ - BUILTIN (getpwuid, false, true, false, 1, 1 ) \ - BUILTIN (hostname, false, false, false, 0, 0 ) \ - BUILTIN (rand, false, false, false, 0, 0 ) \ - BUILTIN (srand, false, false, false, 0, 1 ) \ - BUILTIN (setenv, false, true, false, 2, 3 ) \ - BUILTIN (unsetenv, false, true, false, 1, 1 ) \ - BUILTIN (uname, false, false, false, 0, 0 ) \ +#define m4_builtin_table stdlib_LTX_m4_builtin_table + +/* function macros blind side minargs maxargs */ +#define builtin_functions \ + BUILTIN (getcwd, false, false, false, 0, 0 ) \ + BUILTIN (getenv, false, true, false, 1, 1 ) \ + BUILTIN (getlogin, false, false, false, 0, 0 ) \ + BUILTIN (getpid, false, false, false, 0, 0 ) \ + BUILTIN (getppid, false, false, false, 0, 0 ) \ + BUILTIN (getuid, false, false, false, 0, 0 ) \ + BUILTIN (getpwnam, false, true, false, 1, 1 ) \ + BUILTIN (getpwuid, false, true, false, 1, 1 ) \ + BUILTIN (hostname, false, false, false, 0, 0 ) \ + BUILTIN (rand, false, false, false, 0, 0 ) \ + BUILTIN (srand, false, false, false, 0, 1 ) \ + BUILTIN (setenv, false, true, false, 2, 3 ) \ + BUILTIN (unsetenv, false, true, false, 1, 1 ) \ + BUILTIN (uname, false, false, false, 0, 0 ) \ #define BUILTIN(handler, macros, blind, side, min, max) M4BUILTIN (handler); @@ -63,7 +63,7 @@ const m4_builtin m4_builtin_table[] = { -#define BUILTIN(handler, macros, blind, side, min, max) \ +#define BUILTIN(handler, macros, blind, side, min, max) \ M4BUILTIN_ENTRY (handler, #handler, macros, blind, side, min, max) builtin_functions @@ -83,7 +83,7 @@ M4BUILTIN_HANDLER (getcwd) bp = getcwd (buf, sizeof buf); - if (bp != NULL) /* in case of error return null string */ + if (bp != NULL) /* in case of error return null string */ m4_shipout_string (context, obs, buf, SIZE_MAX, false); } diff --git a/modules/time.c b/modules/time.c index 9d2e4846..3c8e5b51 100644 --- a/modules/time.c +++ b/modules/time.c @@ -35,20 +35,20 @@ #endif /* Rename exported symbols for dlpreload()ing. */ -#define m4_builtin_table time_LTX_m4_builtin_table +#define m4_builtin_table time_LTX_m4_builtin_table -/* function macros blind side minargs maxargs */ -#define builtin_functions \ - BUILTIN (currenttime, false, false, false, 0, 0 ) \ - BUILTIN (ctime, false, false, false, 0, 1 ) \ - BUILTIN (gmtime, false, true, false, 1, 1 ) \ - BUILTIN (localtime, false, true, false, 1, 1 ) \ +/* function macros blind side minargs maxargs */ +#define builtin_functions \ + BUILTIN (currenttime, false, false, false, 0, 0 ) \ + BUILTIN (ctime, false, false, false, 0, 1 ) \ + BUILTIN (gmtime, false, true, false, 1, 1 ) \ + BUILTIN (localtime, false, true, false, 1, 1 ) \ -#define mktime_functions \ - BUILTIN (mktime, false, true, false, 6, 7 ) \ +#define mktime_functions \ + BUILTIN (mktime, false, true, false, 6, 7 ) \ -#define strftime_functions \ - BUILTIN (strftime, false, true, false, 2, 2 ) \ +#define strftime_functions \ + BUILTIN (strftime, false, true, false, 2, 2 ) \ #define BUILTIN(handler, macros, blind, side, min, max) M4BUILTIN (handler) @@ -63,7 +63,7 @@ const m4_builtin m4_builtin_table[] = { -#define BUILTIN(handler, macros, blind, side, min, max) \ +#define BUILTIN(handler, macros, blind, side, min, max) \ M4BUILTIN_ENTRY (handler, #handler, macros, blind, side, min, max) builtin_functions diff --git a/modules/traditional.c b/modules/traditional.c index da3b3ce8..ab6ce5bc 100644 --- a/modules/traditional.c +++ b/modules/traditional.c @@ -29,21 +29,21 @@ #endif /* Rename exported symbols for dlpreload()ing. */ -#define m4_macro_table traditional_LTX_m4_macro_table +#define m4_macro_table traditional_LTX_m4_macro_table /* A table for mapping m4 symbol names to simple expansion text. */ const m4_macro m4_macro_table[] = { - /* name text min max */ + /* name text min max */ #if UNIX - { "unix", "", 0, 0 }, + { "unix", "", 0, 0 }, #elif W32_NATIVE - { "windows", "", 0, 0 }, + { "windows", "", 0, 0 }, #elif OS2 - { "os2", "", 0, 0 }, + { "os2", "", 0, 0 }, #else # warning Platform macro not provided #endif - { "__traditional__", "", 0, 0 }, - { NULL, NULL, 0, 0 }, + { "__traditional__", "", 0, 0 }, + { NULL, NULL, 0, 0 }, }; diff --git a/src/freeze.c b/src/freeze.c index 4ad22406..38fb67ae 100644 --- a/src/freeze.c +++ b/src/freeze.c @@ -30,15 +30,15 @@ #include "verify.h" #include "xmemdup0.h" -static void produce_mem_dump (FILE *, const char *, size_t); -static void produce_resyntax_dump (m4 *, FILE *); -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 *, +static void produce_mem_dump (FILE *, const char *, size_t); +static void produce_resyntax_dump (m4 *, FILE *); +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 *); -static void issue_expect_message (m4 *, int); -static int decode_char (m4 *, FILE *, bool *); +static void issue_expect_message (m4 *, int); +static int decode_char (m4 *, FILE *, bool *); /* Dump an ASCII-encoded representation of LEN bytes at MEM to FILE. @@ -459,110 +459,110 @@ reload_frozen_state (m4 *context, const char *name) int number[3] = {0}; bool advance_line = true; -#define GET_CHARACTER \ - do \ - { \ - if (advance_line) \ - { \ - m4_set_current_line (context, \ - m4_get_current_line (context) + 1); \ - advance_line = false; \ - } \ - character = getc (file); \ - if (character == '\n') \ - advance_line = true; \ - } \ +#define GET_CHARACTER \ + do \ + { \ + if (advance_line) \ + { \ + m4_set_current_line (context, \ + m4_get_current_line (context) + 1); \ + advance_line = false; \ + } \ + character = getc (file); \ + if (character == '\n') \ + advance_line = true; \ + } \ while (0) -#define GET_NUMBER(Number, AllowNeg) \ - do \ - { \ - unsigned int n = 0; \ - while (isdigit (character) && n <= INT_MAX / 10) \ - { \ - 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")); \ - (Number) = n; \ - } \ +#define GET_NUMBER(Number, AllowNeg) \ + do \ + { \ + unsigned int n = 0; \ + while (isdigit (character) && n <= INT_MAX / 10) \ + { \ + 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")); \ + (Number) = n; \ + } \ while (0) -#define GET_STRING(File, Buf, BufSize, StrLen, UseChar) \ - do \ - { \ - size_t len = (StrLen); \ - char *p; \ - int ch; \ - if (UseChar) \ - { \ - 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; \ - } \ - *p = '\0'; \ - GET_CHARACTER; \ - while (version > 1 && character == '\\') \ - { \ - GET_CHARACTER; \ - VALIDATE ('\n'); \ - GET_CHARACTER; \ - } \ - } \ +#define GET_STRING(File, Buf, BufSize, StrLen, UseChar) \ + do \ + { \ + size_t len = (StrLen); \ + char *p; \ + int ch; \ + if (UseChar) \ + { \ + 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; \ + } \ + *p = '\0'; \ + GET_CHARACTER; \ + while (version > 1 && character == '\\') \ + { \ + GET_CHARACTER; \ + VALIDATE ('\n'); \ + GET_CHARACTER; \ + } \ + } \ while (0) -#define VALIDATE(Expected) \ - do \ - { \ - if (character != (Expected)) \ - issue_expect_message (context, (Expected)); \ - } \ +#define VALIDATE(Expected) \ + do \ + { \ + if (character != (Expected)) \ + issue_expect_message (context, (Expected)); \ + } \ while (0) -#define CHECK_ALLOCATION(Where, Allocated, Needed) \ - do \ - { \ - if ((Needed) + 1 > (Allocated)) \ - { \ - free (Where); \ - (Allocated) = (Needed) + 1; \ - (Where) = xcharalloc (Allocated); \ - } \ - } \ +#define CHECK_ALLOCATION(Where, Allocated, Needed) \ + do \ + { \ + if ((Needed) + 1 > (Allocated)) \ + { \ + free (Where); \ + (Allocated) = (Needed) + 1; \ + (Where) = xcharalloc (Allocated); \ + } \ + } \ while (0) /* Skip comments (`#' at beginning of line) and blank lines, setting character to the next directive or to EOF. */ -#define GET_DIRECTIVE \ - do \ - { \ - GET_CHARACTER; \ - if (character == '#') \ - { \ - while (character != EOF && character != '\n') \ - GET_CHARACTER; \ - VALIDATE ('\n'); \ - } \ - } \ +#define GET_DIRECTIVE \ + do \ + { \ + GET_CHARACTER; \ + if (character == '#') \ + { \ + while (character != EOF && character != '\n') \ + GET_CHARACTER; \ + VALIDATE ('\n'); \ + } \ + } \ while (character == '\n') file = m4_path_search (context, name, (char **)NULL); diff --git a/src/main.c b/src/main.c index 98109ac2..1c7bfd84 100644 --- a/src/main.c +++ b/src/main.c @@ -35,15 +35,15 @@ #include "version-etc.h" #include "xstrtol.h" -#define AUTHORS \ - proper_name_utf8 ("Rene' Seindal", "Ren\xc3\xa9 Seindal"), \ - proper_name ("Gary V. Vaughan"), \ +#define AUTHORS \ + proper_name_utf8 ("Rene' Seindal", "Ren\xc3\xa9 Seindal"), \ + proper_name ("Gary V. Vaughan"), \ proper_name ("Eric Blake") typedef struct deferred { struct deferred *next; - int code; /* deferred optchar */ + int code; /* deferred optchar */ const char *value; } deferred; @@ -201,21 +201,21 @@ mismatch, or whatever value was passed to the m4exit macro.\n\ non-character as a pseudo short option, starting with CHAR_MAX + 1. */ enum { - ARGLENGTH_OPTION = CHAR_MAX + 1, /* not quite -l, because of message */ - DEBUGFILE_OPTION, /* no short opt */ - ERROR_OUTPUT_OPTION, /* not quite -o, because of message */ - HASHSIZE_OPTION, /* not quite -H, because of message */ - IMPORT_ENVIRONMENT_OPTION, /* no short opt */ - POPDEF_OPTION, /* no short opt */ - PREPEND_INCLUDE_OPTION, /* not quite -B, because of message */ - SAFER_OPTION, /* -S still has old no-op semantics */ - SYNCOUTPUT_OPTION, /* not quite -s, because of opt arg */ - TRACEOFF_OPTION, /* no short opt */ - UNLOAD_MODULE_OPTION, /* no short opt */ - WORD_REGEXP_OPTION, /* deprecated, used to be -W */ - - HELP_OPTION, /* no short opt */ - VERSION_OPTION /* no short opt */ + ARGLENGTH_OPTION = CHAR_MAX + 1, /* not quite -l, because of message */ + DEBUGFILE_OPTION, /* no short opt */ + ERROR_OUTPUT_OPTION, /* not quite -o, because of message */ + HASHSIZE_OPTION, /* not quite -H, because of message */ + IMPORT_ENVIRONMENT_OPTION, /* no short opt */ + POPDEF_OPTION, /* no short opt */ + PREPEND_INCLUDE_OPTION, /* not quite -B, because of message */ + SAFER_OPTION, /* -S still has old no-op semantics */ + SYNCOUTPUT_OPTION, /* not quite -s, because of opt arg */ + TRACEOFF_OPTION, /* no short opt */ + UNLOAD_MODULE_OPTION, /* no short opt */ + WORD_REGEXP_OPTION, /* deprecated, used to be -W */ + + HELP_OPTION, /* no short opt */ + VERSION_OPTION /* no short opt */ }; /* Decode options and launch execution. */ @@ -278,9 +278,9 @@ static const struct option long_options[] = /* For determining whether to be interactive. */ enum interactive_choice { - INTERACTIVE_UNKNOWN, /* Still processing arguments, no -b or -i yet */ - INTERACTIVE_YES, /* -i specified last */ - INTERACTIVE_NO /* -b specified last */ + INTERACTIVE_UNKNOWN, /* Still processing arguments, no -b or -i yet */ + INTERACTIVE_YES, /* -i specified last */ + INTERACTIVE_NO /* -b specified last */ }; /* Convert OPT to size_t, reporting an error using long option index @@ -327,10 +327,10 @@ process_file (m4 *context, const char *name) int main (int argc, char *const *argv, char *const *envp) { - deferred *head = NULL; /* head of deferred argument list */ + deferred *head = NULL; /* head of deferred argument list */ deferred *tail = NULL; deferred *defn; - size_t size; /* for parsing numeric option arguments */ + size_t size; /* for parsing numeric option arguments */ bool import_environment = false; /* true to import environment */ bool seen_file = false; @@ -532,7 +532,7 @@ main (int argc, char *const *argv, char *const *envp) 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. */ + have effect between files. */ if (seen_file || frozen_file_to_read) goto defer; if (m4_debug_decode (context, optarg, SIZE_MAX) < 0) @@ -578,7 +578,7 @@ main (int argc, char *const *argv, char *const *envp) -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. */ + 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. */ diff --git a/src/stackovf.c b/src/stackovf.c index bf383f0f..95a5c3a2 100644 --- a/src/stackovf.c +++ b/src/stackovf.c @@ -119,10 +119,10 @@ typedef void (*handler_t) (void); #if defined(__ultrix) && defined(__vax) -extern char *sbrk (int); -extern int getrlimit (int, struct rlimit *); -extern int sigstack (struct sigstack *, struct sigstack *); -extern int sigvec (int, struct sigvec *, struct sigvec *); +extern char *sbrk (int); +extern int getrlimit (int, struct rlimit *); +extern int sigstack (struct sigstack *, struct sigstack *); +extern int sigvec (int, struct sigvec *, struct sigvec *); #endif static void *stackbuf; @@ -204,7 +204,7 @@ process_sigsegv (int signo, const char *p) /* We have determined that this is indeed a stack overflow. */ - (*stackovf_handler) (); /* should call exit() */ + (*stackovf_handler) (); /* should call exit() */ } } if (p == NULL) diff --git a/tests/stackovf.test b/tests/stackovf.test index 794e194a..c26c3960 100755 --- a/tests/stackovf.test +++ b/tests/stackovf.test @@ -88,7 +88,7 @@ else *ut*of*emory*|*emory*xhausted) echo "*** Test is INCONCLUSIVE (ran out of heap before stack overflow)"; ;; - *) echo "*** Test FAILED. $M4 aborted unexpectedly. Output:"; + *) echo "*** Test FAILED. $M4 aborted unexpectedly. Output:"; ;; esac fi -- cgit v1.2.1