diff options
author | Eric Blake <ebb9@byu.net> | 2010-01-05 10:03:04 -0700 |
---|---|---|
committer | Eric Blake <ebb9@byu.net> | 2010-01-05 20:41:58 -0700 |
commit | 26291e22e0a2c6ffaf65b0c182ec6d6f6fb61cd5 (patch) | |
tree | 1347a71ad56321613d2e3298d49eb026fd0ca6f0 | |
parent | 36c382bdf8c55629d2cf9c9e5d44f80c6e886e7c (diff) | |
download | m4-26291e22e0a2c6ffaf65b0c182ec6d6f6fb61cd5.tar.gz |
Remove more TAB characters.
* THANKS: Use space for alignment.
* bootstrap: Likewise.
* checks/stackovf.test: Likewise.
* configure.ac: Likewise.
* src/builtin.c: Likewise. Also update some stale comments.
* src/debug.c: Likewise.
* src/eval.c: Likewise.
* src/format.c: Likewise.
* src/freeze.c: Likewise.
* src/input.c: Likewise.
* src/m4.c: Likewise.
* src/m4.h: Likewise.
* src/macro.c: Likewise.
* src/output.c: Likewise.
* src/path.c: Likewise.
* src/symtab.c: Likewise.
Signed-off-by: Eric Blake <ebb9@byu.net>
-rw-r--r-- | ChangeLog | 18 | ||||
-rw-r--r-- | THANKS | 234 | ||||
-rwxr-xr-x | bootstrap | 14 | ||||
-rwxr-xr-x | checks/stackovf.test | 2 | ||||
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | src/builtin.c | 515 | ||||
-rw-r--r-- | src/debug.c | 51 | ||||
-rw-r--r-- | src/eval.c | 2 | ||||
-rw-r--r-- | src/format.c | 52 | ||||
-rw-r--r-- | src/freeze.c | 134 | ||||
-rw-r--r-- | src/input.c | 138 | ||||
-rw-r--r-- | src/m4.c | 16 | ||||
-rw-r--r-- | src/m4.h | 152 | ||||
-rw-r--r-- | src/macro.c | 87 | ||||
-rw-r--r-- | src/output.c | 88 | ||||
-rw-r--r-- | src/path.c | 12 | ||||
-rw-r--r-- | src/symtab.c | 28 |
17 files changed, 787 insertions, 758 deletions
@@ -1,5 +1,23 @@ 2010-01-05 Eric Blake <ebb9@byu.net> + Remove more TAB characters. + * THANKS: Use space for alignment. + * bootstrap: Likewise. + * checks/stackovf.test: Likewise. + * configure.ac: Likewise. + * src/builtin.c: Likewise. Also update some stale comments. + * src/debug.c: Likewise. + * src/eval.c: Likewise. + * src/format.c: Likewise. + * src/freeze.c: Likewise. + * src/input.c: Likewise. + * src/m4.c: Likewise. + * src/m4.h: Likewise. + * src/macro.c: Likewise. + * src/output.c: Likewise. + * src/path.c: Likewise. + * src/symtab.c: Likewise. + Clarify minimum bootstrap requirements. * bootstrap: Avoid out-of-date duplicated data. @@ -5,123 +5,123 @@ 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 -Assar Westerlund assar@nada.kth.se -Ben A. Mesander ben@piglet.cr.usgs.gov -Bengt Mertensson bengt@mathematik.uni-bremen.de -Bernhard Daeubler daeb@physik.uni-ulm.de -Bjorn R. Bjornsson brb@falcon.is -Bob Badour bob@badour.net -Bob Proulx bob@proulx.com -Brendan Kehoe brendan@cygnus.com -Bruno Haible bruno@clisp.org -Cesar Strauss cestrauss@gmail.com -Chris McGuire chris@wso.net -Damian Menscher menscher@uiuc.edu -Dan Jacobson jidanni@jidanni.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 -Fernando Carrijo fcarrijo1980@gmail.com -François Pinard pinard@iro.umontreal.ca -Frank Schwidom schwidom@impernet.de -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 -Hal Peterson hrp@pecan.cray.com -Hoang Uong hoang@ornews.intel.com -Ian Taylor ian@cygnus.com -Ilya N. Golubev gin@mo.msk.ru -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 -Josef T. Burger bolo@bolo.com -Joseph E. Sacco jsacco@ssl.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 -Konrad Schwarz konrad.schwarz@siemens.com -Kristine Lund lund@lpnaxp.in2p3.fr -Krste Asanovic krste@icsi.berkeley.edu -Lawson Chan Lawson.Chan@tdsecurities.com -Marion Hakanson hakanson@cse.ogi.edu -Mark Seiden mis@seiden.com -Martin Koeppe mkoeppe@gmx.de -Matt Kraai kraai@debian.org -Matthew Woehlke mw_triad@users.sourceforge.net -Matthias Rabe rabe@mathematik.uni-bielefeld.de -Michael Fetterman mafetter@ichips.intel.com -Michael L. Welcome welcome@bigbird.llnl.gov -Mike Frysinger vapier@gentoo.org -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 -Pete Chown pete.chown@dale.dircon.co.uk -Pierre Gaumond gaumondp@ere.umontreal.ca -Pierre Mathieu mathieu@geod.emr.ca -Ralf Wildenhues Ralf.Wildenhues@gmx.de -René Seindal seindal@diku.dk -Richard A Nelson cowboy@vnet.ibm.com -Richard Stallman rms@gnu.org -Robert Bernstein rocky@panix.com -Robert Bihlmeyer robbe@orcus.priv.at -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 -Thomas Klausner tk@giga.or.at -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 -Vincent Lonngren Vincent.lonngren.759@student.lu.se -Vivek P. Singhal singhal@cs.utexas.edu -Walter Wong wcw+@cmu.edu +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 +Assar Westerlund assar@nada.kth.se +Ben A. Mesander ben@piglet.cr.usgs.gov +Bengt Mertensson bengt@mathematik.uni-bremen.de +Bernhard Daeubler daeb@physik.uni-ulm.de +Bjorn R. Bjornsson brb@falcon.is +Bob Badour bob@badour.net +Bob Proulx bob@proulx.com +Brendan Kehoe brendan@cygnus.com +Bruno Haible bruno@clisp.org +Cesar Strauss cestrauss@gmail.com +Chris McGuire chris@wso.net +Damian Menscher menscher@uiuc.edu +Dan Jacobson jidanni@jidanni.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 +Fernando Carrijo fcarrijo1980@gmail.com +François Pinard pinard@iro.umontreal.ca +Frank Schwidom schwidom@impernet.de +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 +Hal Peterson hrp@pecan.cray.com +Hoang Uong hoang@ornews.intel.com +Ian Taylor ian@cygnus.com +Ilya N. Golubev gin@mo.msk.ru +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 +Josef T. Burger bolo@bolo.com +Joseph E. Sacco jsacco@ssl.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 +Konrad Schwarz konrad.schwarz@siemens.com +Kristine Lund lund@lpnaxp.in2p3.fr +Krste Asanovic krste@icsi.berkeley.edu +Lawson Chan Lawson.Chan@tdsecurities.com +Marion Hakanson hakanson@cse.ogi.edu +Mark Seiden mis@seiden.com +Martin Koeppe mkoeppe@gmx.de +Matt Kraai kraai@debian.org +Matthew Woehlke mw_triad@users.sourceforge.net +Matthias Rabe rabe@mathematik.uni-bielefeld.de +Michael Fetterman mafetter@ichips.intel.com +Michael L. Welcome welcome@bigbird.llnl.gov +Mike Frysinger vapier@gentoo.org +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 +Pete Chown pete.chown@dale.dircon.co.uk +Pierre Gaumond gaumondp@ere.umontreal.ca +Pierre Mathieu mathieu@geod.emr.ca +Ralf Wildenhues Ralf.Wildenhues@gmx.de +René Seindal seindal@diku.dk +Richard A Nelson cowboy@vnet.ibm.com +Richard Stallman rms@gnu.org +Robert Bernstein rocky@panix.com +Robert Bihlmeyer robbe@orcus.priv.at +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 +Thomas Klausner tk@giga.or.at +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 +Vincent Lonngren Vincent.lonngren.759@student.lu.se +Vivek P. Singhal singhal@cs.utexas.edu +Walter Wong wcw+@cmu.edu ======================================================================== @@ -189,13 +189,13 @@ func_update () shift case $opt in # Separate optargs to short options: - -f|--force) vcs_only_file= ;; - -\?|-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= ;; + -\?|-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/checks/stackovf.test b/checks/stackovf.test index da8756a5..673692d4 100755 --- a/checks/stackovf.test +++ b/checks/stackovf.test @@ -89,7 +89,7 @@ else *) echo "Failure - $m4 created unexpected core dump" ls -l "$tmpdir" ;; esac ;; - *) echo "Failure - $m4 aborted unexpectedly"; + *) echo "Failure - $m4 aborted unexpectedly"; ;; esac fi diff --git a/configure.ac b/configure.ac index 63e3ae0c..a4efbf40 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, 1993, 1994, 2004, 2005, 2006, 2007, 2008, 2009, # 2010 Free Software Foundation, Inc. # diff --git a/src/builtin.c b/src/builtin.c index d84edb51..6efa9017 100644 --- a/src/builtin.c +++ b/src/builtin.c @@ -30,7 +30,7 @@ #include "regex.h" #include "wait-process.h" -#define ARG(i) (argc > (i) ? TOKEN_DATA_TEXT (argv[i]) : "") +#define ARG(i) (argc > (i) ? TOKEN_DATA_TEXT (argv[i]) : "") /* Initialization of builtin and predefined macros. The table "builtin_tab" is both used for initialization, and by the "builtin" @@ -92,81 +92,81 @@ DECLARE (m4_undivert); static builtin const builtin_tab[] = { - /* name GNUext macros blind function */ + /* name GNUext macros blind function */ - { "__file__", true, false, false, m4___file__ }, - { "__line__", true, false, false, m4___line__ }, - { "__program__", true, false, false, m4___program__ }, - { "builtin", true, true, true, m4_builtin }, - { "changecom", false, false, false, m4_changecom }, - { "changequote", false, false, false, m4_changequote }, + { "__file__", true, false, false, m4___file__ }, + { "__line__", true, false, false, m4___line__ }, + { "__program__", true, false, false, m4___program__ }, + { "builtin", true, true, true, m4_builtin }, + { "changecom", false, false, false, m4_changecom }, + { "changequote", false, false, false, m4_changequote }, #ifdef ENABLE_CHANGEWORD - { "changeword", true, false, true, m4_changeword }, + { "changeword", true, false, true, m4_changeword }, #endif - { "debugmode", true, false, false, m4_debugmode }, - { "debugfile", true, false, false, m4_debugfile }, - { "decr", false, false, true, m4_decr }, - { "define", false, true, true, m4_define }, - { "defn", false, false, true, m4_defn }, - { "divert", false, false, false, m4_divert }, - { "divnum", false, false, false, m4_divnum }, - { "dnl", false, false, false, m4_dnl }, - { "dumpdef", false, false, false, m4_dumpdef }, - { "errprint", false, false, true, m4_errprint }, - { "esyscmd", true, false, true, m4_esyscmd }, - { "eval", false, false, true, m4_eval }, - { "format", true, false, true, m4_format }, - { "ifdef", false, false, true, m4_ifdef }, - { "ifelse", false, false, true, m4_ifelse }, - { "include", false, false, true, m4_include }, - { "incr", false, false, true, m4_incr }, - { "index", false, false, true, m4_index }, - { "indir", true, true, true, m4_indir }, - { "len", false, false, true, m4_len }, - { "m4exit", false, false, false, m4_m4exit }, - { "m4wrap", false, false, true, m4_m4wrap }, - { "maketemp", false, false, true, m4_maketemp }, - { "mkstemp", false, false, true, m4_mkstemp }, - { "patsubst", true, false, true, m4_patsubst }, - { "popdef", false, false, true, m4_popdef }, - { "pushdef", false, true, true, m4_pushdef }, - { "regexp", true, false, true, m4_regexp }, - { "shift", false, false, true, m4_shift }, - { "sinclude", false, false, true, m4_sinclude }, - { "substr", false, false, true, m4_substr }, - { "syscmd", false, false, true, m4_syscmd }, - { "sysval", false, false, false, m4_sysval }, - { "traceoff", false, false, false, m4_traceoff }, - { "traceon", false, false, false, m4_traceon }, - { "translit", false, false, true, m4_translit }, - { "undefine", false, false, true, m4_undefine }, - { "undivert", false, false, false, m4_undivert }, - - { 0, false, false, false, 0 }, + { "debugmode", true, false, false, m4_debugmode }, + { "debugfile", true, false, false, m4_debugfile }, + { "decr", false, false, true, m4_decr }, + { "define", false, true, true, m4_define }, + { "defn", false, false, true, m4_defn }, + { "divert", false, false, false, m4_divert }, + { "divnum", false, false, false, m4_divnum }, + { "dnl", false, false, false, m4_dnl }, + { "dumpdef", false, false, false, m4_dumpdef }, + { "errprint", false, false, true, m4_errprint }, + { "esyscmd", true, false, true, m4_esyscmd }, + { "eval", false, false, true, m4_eval }, + { "format", true, false, true, m4_format }, + { "ifdef", false, false, true, m4_ifdef }, + { "ifelse", false, false, true, m4_ifelse }, + { "include", false, false, true, m4_include }, + { "incr", false, false, true, m4_incr }, + { "index", false, false, true, m4_index }, + { "indir", true, true, true, m4_indir }, + { "len", false, false, true, m4_len }, + { "m4exit", false, false, false, m4_m4exit }, + { "m4wrap", false, false, true, m4_m4wrap }, + { "maketemp", false, false, true, m4_maketemp }, + { "mkstemp", false, false, true, m4_mkstemp }, + { "patsubst", true, false, true, m4_patsubst }, + { "popdef", false, false, true, m4_popdef }, + { "pushdef", false, true, true, m4_pushdef }, + { "regexp", true, false, true, m4_regexp }, + { "shift", false, false, true, m4_shift }, + { "sinclude", false, false, true, m4_sinclude }, + { "substr", false, false, true, m4_substr }, + { "syscmd", false, false, true, m4_syscmd }, + { "sysval", false, false, false, m4_sysval }, + { "traceoff", false, false, false, m4_traceoff }, + { "traceon", false, false, false, m4_traceon }, + { "translit", false, false, true, m4_translit }, + { "undefine", false, false, true, m4_undefine }, + { "undivert", false, false, false, m4_undivert }, + + { 0, false, false, false, 0 }, /* placeholder is intentionally stuck after the table end delimiter, so that we can easily find it, while not treating it as a real builtin. */ - { "placeholder", true, false, false, m4_placeholder }, + { "placeholder", true, false, false, m4_placeholder }, }; static predefined const predefined_tab[] = { #if UNIX - { "unix", "__unix__", "" }, + { "unix", "__unix__", "" }, #endif #if W32_NATIVE - { "windows", "__windows__", "" }, + { "windows", "__windows__", "" }, #endif #if OS2 - { "os2", "__os2__", "" }, + { "os2", "__os2__", "" }, #endif #if !UNIX && !W32_NATIVE && !OS2 # warning Platform macro not provided #endif - { NULL, "__gnu__", "" }, + { NULL, "__gnu__", "" }, - { NULL, NULL, NULL }, + { NULL, NULL, NULL }, }; /*----------------------------------------. @@ -202,11 +202,10 @@ find_builtin_by_name (const char *name) return bp + 1; } -/*-------------------------------------------------------------------------. -| Install a builtin macro with name NAME, bound to the C function given in | -| BP. MODE is SYMBOL_INSERT or SYMBOL_PUSHDEF. TRACED defines whether | -| NAME is to be traced. | -`-------------------------------------------------------------------------*/ +/*----------------------------------------------------------------. +| Install a builtin macro with name NAME, bound to the C function | +| given in BP. MODE is SYMBOL_INSERT or SYMBOL_PUSHDEF. | +`----------------------------------------------------------------*/ void define_builtin (const char *name, const builtin *bp, symbol_lookup mode) @@ -272,21 +271,21 @@ set_macro_sequence (const char *regexp) macro_sequence_inuse = true; } -/*------------------------------------------------------------. -| Free dynamic memory utilized by the define sequence regular | -| expression. | -`------------------------------------------------------------*/ +/*-----------------------------------------------------------. +| Free dynamic memory utilized by the macro sequence regular | +| expression during the define builtin. | +`-----------------------------------------------------------*/ void free_macro_sequence (void) { free_pattern_buffer (¯o_sequence_buf, ¯o_sequence_regs); } -/*-------------------------------------------------------------------------. -| Define a predefined or user-defined macro, with name NAME, and expansion | -| TEXT. MODE destinguishes between the "define" and the "pushdef" case. | -| It is also used from main (). | -`-------------------------------------------------------------------------*/ +/*-----------------------------------------------------------------. +| Define a predefined or user-defined macro, with name NAME, and | +| expansion TEXT. MODE destinguishes between the "define" and the | +| "pushdef" case. It is also used from main (). | +`-----------------------------------------------------------------*/ void define_user_macro (const char *name, const char *text, symbol_lookup mode) @@ -333,7 +332,7 @@ define_user_macro (const char *name, const char *text, symbol_lookup mode) } /*-----------------------------------------------. -| Initialize all builtin and predefined macros. | +| Initialize all builtin and predefined macros. | `-----------------------------------------------*/ void @@ -371,13 +370,13 @@ builtin_init (void) } } -/*------------------------------------------------------------------------. -| Give friendly warnings if a builtin macro is passed an inappropriate | -| number of arguments. NAME is macro name for messages, ARGC is actual | -| number of arguments, MIN is the minimum number of acceptable arguments, | -| negative if not applicable, MAX is the maximum number, negative if not | -| applicable. | -`------------------------------------------------------------------------*/ +/*-------------------------------------------------------------------. +| Give friendly warnings if a builtin macro is passed an | +| inappropriate number of arguments. NAME is the macro name for | +| messages, ARGC is actual number of arguments, MIN is the minimum | +| number of acceptable arguments, negative if not applicable, MAX is | +| the maximum number, negative if not applicable. | +`-------------------------------------------------------------------*/ static bool bad_argc (token_data *name, int argc, int min, int max) @@ -400,11 +399,11 @@ bad_argc (token_data *name, int argc, int min, int max) return isbad; } -/*--------------------------------------------------------------------------. -| The function numeric_arg () converts ARG to an int pointed to by VALUEP. | -| If the conversion fails, print error message for macro MACRO. Return | -| true iff conversion succeeds. | -`--------------------------------------------------------------------------*/ +/*-----------------------------------------------------------------. +| The function numeric_arg () converts ARG to an int pointed to by | +| VALUEP. If the conversion fails, print error message for macro | +| MACRO. Return true iff conversion succeeds. | +`-----------------------------------------------------------------*/ static bool numeric_arg (token_data *macro, const char *arg, int *valuep) @@ -441,10 +440,10 @@ numeric_arg (token_data *macro, const char *arg, int *valuep) return true; } -/*------------------------------------------------------------------------. -| The function ntoa () converts VALUE to a signed ASCII representation in | -| radix RADIX. | -`------------------------------------------------------------------------*/ +/*------------------------------------------------------. +| The function ntoa () converts VALUE to a signed ASCII | +| representation in radix RADIX. | +`------------------------------------------------------*/ /* Digits for number to ASCII conversions. */ static char const digits[] = "0123456789abcdefghijklmnopqrstuvwxyz"; @@ -482,10 +481,10 @@ ntoa (int32_t value, int radix) return s; } -/*----------------------------------------------------------------------. -| Format an int VAL, and stuff it into an obstack OBS. Used for macros | -| expanding to numbers. | -`----------------------------------------------------------------------*/ +/*---------------------------------------------------------------. +| Format an int VAL, and stuff it into an obstack OBS. Used for | +| macros expanding to numbers. | +`---------------------------------------------------------------*/ static void shipout_int (struct obstack *obs, int val) @@ -496,10 +495,10 @@ shipout_int (struct obstack *obs, int val) obstack_grow (obs, s, strlen (s)); } -/*----------------------------------------------------------------------. -| Print ARGC arguments from the table ARGV to obstack OBS, separated by | -| SEP, and quoted by the current quotes, if QUOTED is true. | -`----------------------------------------------------------------------*/ +/*-------------------------------------------------------------------. +| Print ARGC arguments from the table ARGV to obstack OBS, separated | +| by SEP, and quoted by the current quotes if QUOTED is true. | +`-------------------------------------------------------------------*/ static void dump_args (struct obstack *obs, int argc, token_data **argv, @@ -534,12 +533,12 @@ dump_args (struct obstack *obs, int argc, token_data **argv, /* The first section are macros for definining, undefining, examining, changing, ... other macros. */ -/*-------------------------------------------------------------------------. -| The function define_macro is common for the builtins "define", | -| "undefine", "pushdef" and "popdef". ARGC and ARGV is as for the caller, | -| and MODE argument determines how the macro name is entered into the | -| symbol table. | -`-------------------------------------------------------------------------*/ +/*-------------------------------------------------------------------. +| The function define_macro is common for the builtins "define", | +| "undefine", "pushdef" and "popdef". ARGC and ARGV is as for the | +| caller, and MODE argument determines how the macro name is entered | +| into the symbol table. | +`-------------------------------------------------------------------*/ static void define_macro (int argc, token_data **argv, symbol_lookup mode) @@ -684,19 +683,19 @@ m4_ifelse (struct obstack *obs, int argc, token_data **argv) obstack_grow (obs, result, strlen (result)); } -/*---------------------------------------------------------------------. -| The function dump_symbol () is for use by "dumpdef". It builds up a | -| table of all defined, un-shadowed, symbols. | -`---------------------------------------------------------------------*/ +/*-------------------------------------------------------------------. +| The function dump_symbol () is for use by "dumpdef". It builds up | +| a table of all defined, un-shadowed, symbols. | +`-------------------------------------------------------------------*/ /* The structure dump_symbol_data is used to pass the information needed from call to call to dump_symbol. */ struct dump_symbol_data { - struct obstack *obs; /* obstack for table */ - symbol **base; /* base of table */ - int size; /* size of table */ + struct obstack *obs; /* obstack for table */ + symbol **base; /* base of table */ + int size; /* size of table */ }; static void @@ -722,10 +721,10 @@ dumpdef_cmp (const void *s1, const void *s2) SYMBOL_NAME (* (symbol *const *) s2)); } -/*-------------------------------------------------------------------------. -| Implementation of "dumpdef" itself. It builds up a table of pointers to | -| symbols, sorts it and prints the sorted table. | -`-------------------------------------------------------------------------*/ +/*-------------------------------------------------------------. +| Implementation of "dumpdef" itself. It builds up a table of | +| pointers to symbols, sorts it and prints the sorted table. | +`-------------------------------------------------------------*/ static void m4_dumpdef (struct obstack *obs, int argc, token_data **argv) @@ -797,12 +796,12 @@ INTERNAL ERROR: builtin not found in builtin table")); } } -/*---------------------------------------------------------------------. -| The builtin "builtin" allows calls to builtin macros, even if their | -| definition has been overridden or shadowed. It is thus possible to | -| redefine builtins, and still access their original definition. This | -| macro is not available in compatibility mode. | -`---------------------------------------------------------------------*/ +/*-----------------------------------------------------------------. +| The builtin "builtin" allows calls to builtin macros, even if | +| their definition has been overridden or shadowed. It is thus | +| possible to redefine builtins, and still access their original | +| definition. This macro is not available in compatibility mode. | +`-----------------------------------------------------------------*/ static void m4_builtin (struct obstack *obs, int argc, token_data **argv) @@ -838,12 +837,12 @@ m4_builtin (struct obstack *obs, int argc, token_data **argv) } } -/*------------------------------------------------------------------------. -| The builtin "indir" allows indirect calls to macros, even if their name | -| is not a proper macro name. It is thus possible to define macros with | -| ill-formed names for internal use in larger macro packages. This macro | -| is not available in compatibility mode. | -`------------------------------------------------------------------------*/ +/*-------------------------------------------------------------------. +| The builtin "indir" allows indirect calls to macros, even if their | +| name is not a proper macro name. It is thus possible to define | +| macros with ill-formed names for internal use in larger macro | +| packages. This macro is not available in compatibility mode. | +`-------------------------------------------------------------------*/ static void m4_indir (struct obstack *obs, int argc, token_data **argv) @@ -879,11 +878,11 @@ m4_indir (struct obstack *obs, int argc, token_data **argv) } } -/*-------------------------------------------------------------------------. -| The macro "defn" returns the quoted definition of the macro named by the | -| first argument. If the macro is builtin, it will push a special | -| macro-definition token on the input stack. | -`-------------------------------------------------------------------------*/ +/*------------------------------------------------------------------. +| The macro "defn" returns the quoted definition of the macro named | +| by the first argument. If the macro is builtin, it will push a | +| special macro-definition token on the input stack. | +`------------------------------------------------------------------*/ static void m4_defn (struct obstack *obs, int argc, token_data **argv) @@ -934,10 +933,10 @@ builtin `%s' requested by frozen file is not supported", ARG (i))); } } -/*------------------------------------------------------------------------. -| This section contains macros to handle the builtins "syscmd", "esyscmd" | -| and "sysval". "esyscmd" is GNU specific. | -`------------------------------------------------------------------------*/ +/*--------------------------------------------------------------. +| This section contains macros to handle the builtins "syscmd", | +| "esyscmd" and "sysval". "esyscmd" is GNU specific. | +`--------------------------------------------------------------*/ /* Exit code from last "syscmd" command. */ static int sysval; @@ -1067,10 +1066,11 @@ m4_sysval (struct obstack *obs, int argc M4_GNUC_UNUSED, shipout_int (obs, sysval); } -/*-------------------------------------------------------------------------. -| This section contains the top level code for the "eval" builtin. The | -| actual work is done in the function evaluate (), which lives in eval.c. | -`-------------------------------------------------------------------------*/ +/*------------------------------------------------------------------. +| This section contains the top level code for the "eval" builtin. | +| The actual work is done in the function evaluate (), which lives | +| in eval.c. | +`------------------------------------------------------------------*/ static void m4_eval (struct obstack *obs, int argc, token_data **argv) @@ -1169,10 +1169,10 @@ m4_decr (struct obstack *obs, int argc, token_data **argv) /* This section contains the macros "divert", "undivert" and "divnum" for handling diversion. The utility functions used lives in output.c. */ -/*-----------------------------------------------------------------------. -| Divert further output to the diversion given by ARGV[1]. Out of range | -| means discard further output. | -`-----------------------------------------------------------------------*/ +/*-----------------------------------------------------------------. +| Divert further output to the diversion given by ARGV[1]. Out of | +| range means discard further output. | +`-----------------------------------------------------------------*/ static void m4_divert (struct obstack *obs M4_GNUC_UNUSED, int argc, token_data **argv) @@ -1200,12 +1200,12 @@ m4_divnum (struct obstack *obs, int argc, token_data **argv) shipout_int (obs, current_diversion); } -/*-----------------------------------------------------------------------. -| Bring back the diversion given by the argument list. If none is | -| specified, bring back all diversions. GNU specific is the option of | -| undiverting named files, by passing a non-numeric argument to undivert | -| (). | -`-----------------------------------------------------------------------*/ +/*------------------------------------------------------------------. +| Bring back the diversion given by the argument list. If none is | +| specified, bring back all diversions. GNU specific is the option | +| of undiverting named files, by passing a non-numeric argument to | +| undivert (). | +`------------------------------------------------------------------*/ static void m4_undivert (struct obstack *obs M4_GNUC_UNUSED, int argc, token_data **argv) @@ -1246,10 +1246,10 @@ m4_undivert (struct obstack *obs M4_GNUC_UNUSED, int argc, token_data **argv) specific group. These are "dnl", "shift", "changequote", "changecom" and "changeword". */ -/*------------------------------------------------------------------------. -| Delete all subsequent whitespace from input. The function skip_line () | -| lives in input.c. | -`------------------------------------------------------------------------*/ +/*-----------------------------------------------------------. +| Delete all subsequent whitespace from input. The function | +| skip_line () lives in input.c. | +`-----------------------------------------------------------*/ static void m4_dnl (struct obstack *obs M4_GNUC_UNUSED, int argc, token_data **argv) @@ -1260,10 +1260,10 @@ m4_dnl (struct obstack *obs M4_GNUC_UNUSED, int argc, token_data **argv) skip_line (); } -/*-------------------------------------------------------------------------. -| Shift all argument one to the left, discarding the first argument. Each | -| output argument is quoted with the current quotes. | -`-------------------------------------------------------------------------*/ +/*--------------------------------------------------------------------. +| Shift all arguments one to the left, discarding the first | +| argument. Each output argument is quoted with the current quotes. | +`--------------------------------------------------------------------*/ static void m4_shift (struct obstack *obs, int argc, token_data **argv) @@ -1289,10 +1289,10 @@ m4_changequote (struct obstack *obs M4_GNUC_UNUSED, int argc, (argc >= 3) ? TOKEN_DATA_TEXT (argv[2]) : NULL); } -/*--------------------------------------------------------------------. -| Change the current comment delimiters. The function set_comment () | -| lives in input.c. | -`--------------------------------------------------------------------*/ +/*-----------------------------------------------------------------. +| Change the current comment delimiters. The function set_comment | +| () lives in input.c. | +`-----------------------------------------------------------------*/ static void m4_changecom (struct obstack *obs M4_GNUC_UNUSED, int argc, token_data **argv) @@ -1307,10 +1307,10 @@ m4_changecom (struct obstack *obs M4_GNUC_UNUSED, int argc, token_data **argv) #ifdef ENABLE_CHANGEWORD -/*-----------------------------------------------------------------------. -| Change the regular expression used for breaking the input into words. | -| The function set_word_regexp () lives in input.c. | -`-----------------------------------------------------------------------*/ +/*---------------------------------------------------------------. +| Change the regular expression used for breaking the input into | +| words. The function set_word_regexp () lives in input.c. | +`---------------------------------------------------------------*/ static void m4_changeword (struct obstack *obs M4_GNUC_UNUSED, int argc, token_data **argv) @@ -1327,10 +1327,11 @@ m4_changeword (struct obstack *obs M4_GNUC_UNUSED, int argc, token_data **argv) and "sinclude". This differs from bringing back diversions, in that the input is scanned before being copied to the output. */ -/*-------------------------------------------------------------------------. -| Generic include function. Include the file given by the first argument, | -| if it exists. Complain about inaccessible files iff SILENT is false. | -`-------------------------------------------------------------------------*/ +/*---------------------------------------------------------------. +| Generic include function. Include the file given by the first | +| argument, if it exists. Complain about inaccessible files iff | +| SILENT is false. | +`---------------------------------------------------------------*/ static void include (int argc, token_data **argv, bool silent) @@ -1520,10 +1521,10 @@ m4___program__ (struct obstack *obs, int argc, token_data **argv) EOF is seen, and tracing macro calls. That is: "m4exit", "m4wrap", "traceon" and "traceoff". */ -/*-------------------------------------------------------------------------. -| Exit immediately, with exitcode specified by the first argument, 0 if no | -| arguments are present. | -`-------------------------------------------------------------------------*/ +/*----------------------------------------------------------. +| Exit immediately, with exit status specified by the first | +| argument, or 0 if no arguments are present. | +`----------------------------------------------------------*/ static void M4_GNUC_NORETURN m4_m4exit (struct obstack *obs M4_GNUC_UNUSED, int argc, token_data **argv) @@ -1552,11 +1553,11 @@ m4_m4exit (struct obstack *obs M4_GNUC_UNUSED, int argc, token_data **argv) exit (exit_code); } -/*-------------------------------------------------------------------------. -| Save the argument text until EOF has been seen, allowing for user | -| specified cleanup action. GNU version saves all arguments, the standard | -| version only the first. | -`-------------------------------------------------------------------------*/ +/*------------------------------------------------------------------. +| Save the argument text until EOF has been seen, allowing for user | +| specified cleanup action. GNU version saves all arguments, the | +| standard version only the first. | +`------------------------------------------------------------------*/ static void m4_m4wrap (struct obstack *obs, int argc, token_data **argv) @@ -1575,11 +1576,11 @@ m4_m4wrap (struct obstack *obs, int argc, token_data **argv) Tracing is disabled by default, when a macro is defined. This can be overridden by the "t" debug flag. */ -/*-----------------------------------------------------------------------. -| Set_trace () is used by "traceon" and "traceoff" to enable and disable | -| tracing of a macro. It disables tracing if DATA is NULL, otherwise it | -| enable tracing. | -`-----------------------------------------------------------------------*/ +/*------------------------------------------------------------------. +| Set_trace () is used by "traceon" and "traceoff" to enable and | +| disable tracing of a macro. It disables tracing if DATA is NULL, | +| otherwise it enables tracing. | +`------------------------------------------------------------------*/ static void set_trace (symbol *sym, void *data) @@ -1629,11 +1630,11 @@ m4_traceoff (struct obstack *obs M4_GNUC_UNUSED, int argc, token_data **argv) } } -/*----------------------------------------------------------------------. -| On-the-fly control of the format of the tracing output. It takes one | -| argument, which is a character string like given to the -d option, or | -| none in which case the debug_level is zeroed. | -`----------------------------------------------------------------------*/ +/*------------------------------------------------------------------. +| On-the-fly control of the format of the tracing output. It takes | +| one argument, which is a character string like given to the -d | +| option, or none in which case the debug_level is zeroed. | +`------------------------------------------------------------------*/ static void m4_debugmode (struct obstack *obs M4_GNUC_UNUSED, int argc, token_data **argv) @@ -1721,10 +1722,10 @@ m4_len (struct obstack *obs, int argc, token_data **argv) shipout_int (obs, strlen (ARG (1))); } -/*-------------------------------------------------------------------------. -| The macro expands to the first index of the second argument in the first | -| argument. | -`-------------------------------------------------------------------------*/ +/*-------------------------------------------------------------------. +| The macro expands to the first index of the second argument in the | +| first argument. | +`-------------------------------------------------------------------*/ static void m4_index (struct obstack *obs, int argc, token_data **argv) @@ -1748,12 +1749,13 @@ m4_index (struct obstack *obs, int argc, token_data **argv) shipout_int (obs, retval); } -/*-------------------------------------------------------------------------. -| The macro "substr" extracts substrings from the first argument, starting | -| from the index given by the second argument, extending for a length | -| given by the third argument. If the third argument is missing, the | -| substring extends to the end of the first argument. | -`-------------------------------------------------------------------------*/ +/*-----------------------------------------------------------------. +| The macro "substr" extracts substrings from the first argument, | +| starting from the index given by the second argument, extending | +| for a length given by the third argument. If the third argument | +| is missing, the substring extends to the end of the first | +| argument. | +`-----------------------------------------------------------------*/ static void m4_substr (struct obstack *obs, int argc, token_data **argv) @@ -1784,15 +1786,16 @@ m4_substr (struct obstack *obs, int argc, token_data **argv) obstack_grow (obs, ARG (1) + start, length); } -/*------------------------------------------------------------------------. -| For "translit", ranges are allowed in the second and third argument. | -| They are expanded in the following function, and the expanded strings, | -| without any ranges left, are used to translate the characters of the | -| first argument. A single - (dash) can be included in the strings by | -| being the first or the last character in the string. If the first | -| character in a range is after the first in the character set, the range | -| is made backwards, thus 9-0 is the string 9876543210. | -`------------------------------------------------------------------------*/ +/*------------------------------------------------------------------. +| For "translit", ranges are allowed in the second and third | +| argument. They are expanded in the following function, and the | +| expanded strings, without any ranges left, are used to translate | +| the characters of the first argument. A single - (dash) can be | +| included in the strings by being the first or the last character | +| in the string. If the first character in a range is after the | +| first in the character set, the range is made backwards, thus 9-0 | +| is the string 9876543210. | +`------------------------------------------------------------------*/ static const char * expand_ranges (const char *s, struct obstack *obs) @@ -1829,13 +1832,13 @@ expand_ranges (const char *s, struct obstack *obs) return (char *) obstack_finish (obs); } -/*----------------------------------------------------------------------. -| The macro "translit" translates all characters in the first argument, | -| which are present in the second argument, into the corresponding | -| character from the third argument. If the third argument is shorter | -| than the second, the extra characters in the second argument, are | -| deleted from the first (pueh). | -`----------------------------------------------------------------------*/ +/*-----------------------------------------------------------------. +| The macro "translit" translates all characters in the first | +| argument, which are present in the second argument, into the | +| corresponding character from the third argument. If the third | +| argument is shorter than the second, the extra characters in the | +| second argument are deleted from the first. | +`-----------------------------------------------------------------*/ static void m4_translit (struct obstack *obs, int argc, token_data **argv) @@ -1920,10 +1923,10 @@ m4_translit (struct obstack *obs, int argc, token_data **argv) } } -/*----------------------------------------------------------------------. -| Frontend for printf like formatting. The function format () lives in | -| the file format.c. | -`----------------------------------------------------------------------*/ +/*-------------------------------------------------------------------. +| Frontend for printf like formatting. The function format () lives | +| in the file format.c. | +`-------------------------------------------------------------------*/ static void m4_format (struct obstack *obs, int argc, token_data **argv) @@ -1933,14 +1936,14 @@ m4_format (struct obstack *obs, int argc, token_data **argv) expand_format (obs, argc - 1, argv + 1); } -/*-------------------------------------------------------------------------. -| Function to perform substitution by regular expressions. Used by the | -| builtins regexp and patsubst. The changed text is placed on the | -| obstack. The substitution is REPL, with \& substituted by this part of | -| VICTIM matched by the last whole regular expression, taken from REGS[0], | -| and \N substituted by the text matched by the Nth parenthesized | -| sub-expression, taken from REGS[N]. | -`-------------------------------------------------------------------------*/ +/*------------------------------------------------------------------. +| Function to perform substitution by regular expressions. Used by | +| the builtins regexp and patsubst. The changed text is placed on | +| the obstack. The substitution is REPL, with \& substituted by | +| this part of VICTIM matched by the last whole regular expression, | +| taken from REGS[0], and \N substituted by the text matched by the | +| Nth parenthesized sub-expression, taken from REGS[N]. | +`------------------------------------------------------------------*/ static int substitute_warned = 0; @@ -2021,25 +2024,25 @@ init_pattern_buffer (struct re_pattern_buffer *buf, struct re_registers *regs) } } -/*--------------------------------------------------------------------------. -| Regular expression version of index. Given two arguments, expand to the | -| index of the first match of the second argument (a regexp) in the first. | -| Expand to -1 if here is no match. Given a third argument, is changes | -| the expansion to this argument. | -`--------------------------------------------------------------------------*/ +/*------------------------------------------------------------------. +| Regular expression version of index. Given two arguments, expand | +| to the index of the first match of the second argument (a regexp) | +| in the first. Expand to -1 if here is no match. Given a third | +| argument, it changes the expansion to this argument. | +`------------------------------------------------------------------*/ static void m4_regexp (struct obstack *obs, int argc, token_data **argv) { - const char *victim; /* first argument */ - const char *regexp; /* regular expression */ - const char *repl; /* replacement string */ + const char *victim; /* first argument */ + const char *regexp; /* regular expression */ + const char *repl; /* replacement string */ - struct re_pattern_buffer buf; /* compiled regular expression */ - struct re_registers regs; /* for subexpression matches */ - const char *msg; /* error message from re_compile_pattern */ - int startpos; /* start position of match */ - int length; /* length of first argument */ + struct re_pattern_buffer buf; /* compiled regular expression */ + struct re_registers regs; /* for subexpression matches */ + const char *msg; /* error message from re_compile_pattern */ + int startpos; /* start position of match */ + int length; /* length of first argument */ if (bad_argc (argv[0], argc, 3, 4)) { @@ -2085,22 +2088,22 @@ m4_regexp (struct obstack *obs, int argc, token_data **argv) /*--------------------------------------------------------------------------. | Substitute all matches of a regexp occuring in a string. Each match of | | the second argument (a regexp) in the first argument is changed to the | -| third argument, with \& substituted by the matched text, and \N | +| third argument, with \& substituted by the matched text, and \N | | substituted by the text matched by the Nth parenthesized sub-expression. | `--------------------------------------------------------------------------*/ static void m4_patsubst (struct obstack *obs, int argc, token_data **argv) { - const char *victim; /* first argument */ - const char *regexp; /* regular expression */ + const char *victim; /* first argument */ + const char *regexp; /* regular expression */ - struct re_pattern_buffer buf; /* compiled regular expression */ - struct re_registers regs; /* for subexpression matches */ - const char *msg; /* error message from re_compile_pattern */ - int matchpos; /* start position of match */ - int offset; /* current match offset */ - int length; /* length of first argument */ + struct re_pattern_buffer buf; /* compiled regular expression */ + struct re_registers regs; /* for subexpression matches */ + const char *msg; /* error message from re_compile_pattern */ + int matchpos; /* start position of match */ + int offset; /* current match offset */ + int length; /* length of first argument */ if (bad_argc (argv[0], argc, 3, 4)) { @@ -2192,13 +2195,13 @@ m4_placeholder (struct obstack *obs M4_GNUC_UNUSED, int argc, builtin `%s' requested by frozen file is not supported", ARG (0))); } -/*-------------------------------------------------------------------------. -| This function handles all expansion of user defined and predefined | -| macros. It is called with an obstack OBS, where the macros expansion | -| will be placed, as an unfinished object. SYM points to the macro | -| definition, giving the expansion text. ARGC and ARGV are the arguments, | -| as usual. | -`-------------------------------------------------------------------------*/ +/*-------------------------------------------------------------------. +| This function handles all expansion of user defined and predefined | +| macros. It is called with an obstack OBS, where the macros | +| expansion will be placed, as an unfinished object. SYM points to | +| the macro definition, giving the expansion text. ARGC and ARGV | +| are the arguments, as usual. | +`-------------------------------------------------------------------*/ void expand_user_macro (struct obstack *obs, symbol *sym, @@ -2234,13 +2237,13 @@ expand_user_macro (struct obstack *obs, symbol *sym, strlen (TOKEN_DATA_TEXT (argv[i]))); break; - case '#': /* number of arguments */ + case '#': /* number of arguments */ shipout_int (obs, argc - 1); text++; break; - case '*': /* all arguments */ - case '@': /* ... same, but quoted */ + case '*': /* all arguments */ + case '@': /* ... same, but quoted */ dump_args (obs, argc, argv, ",", *text == '@'); text++; break; diff --git a/src/debug.c b/src/debug.c index 54402f3e..c142d132 100644 --- a/src/debug.c +++ b/src/debug.c @@ -47,7 +47,7 @@ debug_init (void) /*-----------------------------------------------------------------. | Function to decode the debugging flags OPTS. Used by main while | -| processing option -d, and by the builtin debugmode (). | +| processing option -d, and by the builtin debugmode (). | `-----------------------------------------------------------------*/ int @@ -121,11 +121,11 @@ debug_decode (const char *opts) return level; } -/*------------------------------------------------------------------------. -| Change the debug output stream to FP. If the underlying file is the | -| same as stdout, use stdout instead so that debug messages appear in the | -| correct relative position. | -`------------------------------------------------------------------------*/ +/*-----------------------------------------------------------------. +| Change the debug output stream to FP. If the underlying file is | +| the same as stdout, use stdout instead so that debug messages | +| appear in the correct relative position. | +`-----------------------------------------------------------------*/ static void debug_set_file (FILE *fp) @@ -195,11 +195,11 @@ debug_flush_files (void) } } -/*-------------------------------------------------------------------------. -| Change the debug output to file NAME. If NAME is NULL, debug output is | -| reverted to stderr, and if empty debug output is discarded. Return true | -| iff the output stream was changed. | -`-------------------------------------------------------------------------*/ +/*--------------------------------------------------------------. +| Change the debug output to file NAME. If NAME is NULL, debug | +| output is reverted to stderr, and if empty, debug output is | +| discarded. Return true iff the output stream was changed. | +`--------------------------------------------------------------*/ bool debug_set_output (const char *name) @@ -224,9 +224,10 @@ debug_set_output (const char *name) return true; } -/*-----------------------------------------------------------------------. -| Print the header of a one-line debug message, starting by "m4 debug". | -`-----------------------------------------------------------------------*/ +/*--------------------------------------------------------------. +| Print the header of a one-line debug message, starting by "m4 | +| debug". | +`--------------------------------------------------------------*/ void debug_message_prefix (void) @@ -248,11 +249,11 @@ debug_message_prefix (void) output from interfering with other debug messages generated by the various builtins. */ -/*---------------------------------------------------------------------. -| Tracing output is formatted here, by a simplified printf-to-obstack | -| function trace_format (). Understands only %S, %s, %d, %l (optional | -| left quote) and %r (optional right quote). | -`---------------------------------------------------------------------*/ +/*------------------------------------------------------------------. +| Tracing output is formatted here, by a simplified | +| printf-to-obstack function trace_format (). Understands only %S, | +| %s, %d, %l (optional left quote) and %r (optional right quote). | +`------------------------------------------------------------------*/ static void trace_format (const char *fmt, ...) @@ -354,7 +355,7 @@ trace_flush (void) /*-------------------------------------------------------------. | Do pre-argument-collction tracing for macro NAME. Used from | -| expand_macro (). | +| expand_macro (). | `-------------------------------------------------------------*/ void @@ -365,10 +366,10 @@ trace_prepre (const char *name, int id) trace_flush (); } -/*-----------------------------------------------------------------------. -| Format the parts of a trace line, that can be made before the macro is | -| actually expanded. Used from expand_macro (). | -`-----------------------------------------------------------------------*/ +/*--------------------------------------------------------------. +| Format the parts of a trace line, that can be made before the | +| macro is actually expanded. Used from expand_macro (). | +`--------------------------------------------------------------*/ void trace_pre (const char *name, int id, int argc, token_data **argv) @@ -425,7 +426,7 @@ INTERNAL ERROR: builtin not found in builtin table! (trace_pre ())")); /*-------------------------------------------------------------------. | Format the final part of a trace line and print it all. Used from | -| expand_macro (). | +| expand_macro (). | `-------------------------------------------------------------------*/ void @@ -283,7 +283,7 @@ eval_lex (int32_t *val) } /*---------------------------------------. -| Main entry point, called from "eval". | +| Main entry point, called from "eval". | `---------------------------------------*/ bool diff --git a/src/format.c b/src/format.c index 7faa7934..9cf282a7 100644 --- a/src/format.c +++ b/src/format.c @@ -119,36 +119,36 @@ arg_double (const char *str) /*------------------------------------------------------------------. | The main formatting function. Output is placed on the obstack | | OBS, the first argument in ARGV is the formatting string, and the | -| rest is arguments for the string. Warn rather than invoke | -| unspecified behavior in the underlying printf when we do not | -| recognize a format. | +| rest is arguments for the string. Warn rather than invoke | +| unspecified behavior in the underlying printf when we do not | +| recognize a format. | `------------------------------------------------------------------*/ void expand_format (struct obstack *obs, int argc, token_data **argv) { - const char *f; /* format control string */ - const char *fmt; /* position within f */ - char fstart[] = "%'+- 0#*.*hhd"; /* current format spec */ - char *p; /* position within fstart */ - unsigned char c; /* a simple character */ + const char *f; /* format control string */ + const char *fmt; /* position within f */ + char fstart[] = "%'+- 0#*.*hhd"; /* current format spec */ + char *p; /* position within fstart */ + unsigned char c; /* a simple character */ /* 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 @@ -156,7 +156,7 @@ expand_format (struct obstack *obs, int argc, token_data **argv) char ok[128]; /* Buffer and stuff. */ - char *str; /* malloc'd buffer of formatted text */ + char *str; /* malloc'd buffer of formatted text */ enum {CHAR, INT, LONG, DOUBLE, STR} datatype; f = fmt = ARG_STR (argc, argv); @@ -191,33 +191,33 @@ expand_format (struct obstack *obs, int argc, token_data **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/src/freeze.c b/src/freeze.c index be46361e..39351a2f 100644 --- a/src/freeze.c +++ b/src/freeze.c @@ -189,84 +189,84 @@ reload_frozen_state (const char *name) const builtin *bp; bool advance_line = true; -#define GET_CHARACTER \ - do \ - { \ - if (advance_line) \ - { \ - current_line++; \ - advance_line = false; \ - } \ - (character = getc (file)); \ - if (character == '\n') \ - advance_line = true; \ - } \ +#define GET_CHARACTER \ + do \ + { \ + if (advance_line) \ + { \ + current_line++; \ + 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 / 10U) \ - { \ - n = 10 * n + character - '0'; \ - GET_CHARACTER; \ - } \ - if (((AllowNeg) ? INT_MIN : INT_MAX) + 0U < n \ - || isdigit (character)) \ - m4_error (EXIT_FAILURE, 0, \ - _("integer overflow in frozen file")); \ - (Number) = n; \ - } \ +#define GET_NUMBER(Number, AllowNeg) \ + do \ + { \ + unsigned int n = 0; \ + while (isdigit (character) && n <= INT_MAX / 10U) \ + { \ + n = 10 * n + character - '0'; \ + GET_CHARACTER; \ + } \ + if (((AllowNeg) ? INT_MIN : INT_MAX) + 0U < n \ + || isdigit (character)) \ + m4_error (EXIT_FAILURE, 0, \ + _("integer overflow in frozen file")); \ + (Number) = n; \ + } \ while (0) -#define VALIDATE(Expected) \ - do \ - { \ - if (character != (Expected)) \ - issue_expect_message (Expected); \ - } \ +#define VALIDATE(Expected) \ + do \ + { \ + if (character != (Expected)) \ + issue_expect_message (Expected); \ + } \ 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') -#define GET_STRING(i) \ - do \ - { \ - void *tmp; \ - char *p; \ - if (number[(i)] + 1 > allocated[(i)]) \ - { \ - free (string[(i)]); \ - allocated[(i)] = number[(i)] + 1; \ - string[(i)] = xcharalloc ((size_t) allocated[(i)]); \ - } \ - if (number[(i)] > 0 \ - && !fread (string[(i)], (size_t) number[(i)], 1, file)) \ - m4_error (EXIT_FAILURE, 0, \ - _("premature end of frozen file")); \ - string[(i)][number[(i)]] = '\0'; \ - p = string[(i)]; \ - while ((tmp = memchr(p, '\n', number[(i)] - (p - string[(i)])))) \ - { \ - current_line++; \ - p = (char *) tmp + 1; \ - } \ - } \ +#define GET_STRING(i) \ + do \ + { \ + void *tmp; \ + char *p; \ + if (number[(i)] + 1 > allocated[(i)]) \ + { \ + free (string[(i)]); \ + allocated[(i)] = number[(i)] + 1; \ + string[(i)] = xcharalloc ((size_t) allocated[(i)]); \ + } \ + if (number[(i)] > 0 \ + && !fread (string[(i)], (size_t) number[(i)], 1, file)) \ + m4_error (EXIT_FAILURE, 0, \ + _("premature end of frozen file")); \ + string[(i)][number[(i)]] = '\0'; \ + p = string[(i)]; \ + while ((tmp = memchr(p, '\n', number[(i)] - (p - string[(i)])))) \ + { \ + current_line++; \ + p = (char *) tmp + 1; \ + } \ + } \ while (0) file = m4_path_search (name, NULL); diff --git a/src/input.c b/src/input.c index abf2ed17..6d8eee1d 100644 --- a/src/input.c +++ b/src/input.c @@ -66,36 +66,36 @@ enum input_type { - INPUT_STRING, /* String resulting from macro expansion. */ - INPUT_FILE, /* File from command line or include. */ - INPUT_MACRO /* Builtin resulting from defn. */ + INPUT_STRING, /* String resulting from macro expansion. */ + INPUT_FILE, /* File from command line or include. */ + INPUT_MACRO /* Builtin resulting from defn. */ }; typedef enum input_type input_type; struct input_block { - struct input_block *prev; /* previous input_block on the input stack */ - input_type type; /* see enum values */ - const char *file; /* file where this input is from */ - int line; /* line where this input is from */ + struct input_block *prev; /* previous input_block on the input stack */ + input_type type; /* see enum values */ + const char *file; /* file where this input is from */ + int line; /* line where this input is from */ union { struct { - char *string; /* remaining string value */ - char *end; /* terminating NUL of string */ + char *string; /* remaining string value */ + char *end; /* terminating NUL of string */ } - u_s; /* INPUT_STRING */ + u_s; /* INPUT_STRING */ struct { - FILE *fp; /* input file handle */ + FILE *fp; /* input file handle */ bool_bitfield end : 1; /* true if peek has seen EOF */ bool_bitfield close : 1; /* true if we should close file on pop */ bool_bitfield advance : 1; /* track previous start_of_input_line */ } - u_f; /* INPUT_FILE */ - builtin_func *func; /* pointer to macro's function */ + u_f; /* INPUT_FILE */ + builtin_func *func; /* pointer to macro's function */ } u; }; @@ -139,8 +139,8 @@ static bool start_of_input_line; /* Flag for next_char () to recognize change in input block. */ static bool input_change; -#define CHAR_EOF 256 /* character return on EOF */ -#define CHAR_MACRO 257 /* character return for MACRO token */ +#define CHAR_EOF 256 /* character return on EOF */ +#define CHAR_MACRO 257 /* character return for MACRO token */ /* Quote chars. */ STRING rquote; @@ -237,7 +237,7 @@ push_macro (builtin_func *func) /*------------------------------------------------------------------. | First half of push_string (). The pointer next points to the new | -| input_block. | +| input_block. | `------------------------------------------------------------------*/ struct obstack * @@ -259,14 +259,15 @@ push_string_init (void) return current_input; } -/*------------------------------------------------------------------------. -| Last half of push_string (). If next is now NULL, a call to push_file | -| () has invalidated the previous call to push_string_init (), so we just | -| give up. If the new object is void, we do not push it. The function | -| push_string_finish () returns a pointer to the finished object. This | -| pointer is only for temporary use, since reading the next token might | -| release the memory used for the object. | -`------------------------------------------------------------------------*/ +/*-------------------------------------------------------------------. +| Last half of push_string (). If next is now NULL, a call to | +| push_file () has invalidated the previous call to push_string_init | +| (), so we just give up. If the new object is void, we do not push | +| it. The function push_string_finish () returns a pointer to the | +| finished object. This pointer is only for temporary use, since | +| reading the next token might release the memory used for the | +| object. | +`-------------------------------------------------------------------*/ const char * push_string_finish (void) @@ -284,7 +285,7 @@ push_string_finish (void) next->u.u_s.end = next->u.u_s.string + len; next->prev = isp; isp = next; - ret = isp->u.u_s.string; /* for immediate use only */ + ret = isp->u.u_s.string; /* for immediate use only */ input_change = true; } else @@ -319,11 +320,12 @@ push_wrapup (const char *s) } -/*-------------------------------------------------------------------------. -| The function pop_input () pops one level of input sources. If the | -| popped input_block is a file, current_file and current_line are reset to | -| the saved values before the memory for the input_block are released. | -`-------------------------------------------------------------------------*/ +/*-------------------------------------------------------------------. +| The function pop_input () pops one level of input sources. If the | +| popped input_block is a file, current_file and current_line are | +| reset to the saved values before the memory for the input_block is | +| released. | +`-------------------------------------------------------------------*/ static void pop_input (void) @@ -368,17 +370,18 @@ pop_input (void) abort (); } obstack_free (current_input, isp); - next = NULL; /* might be set in push_string_init () */ + next = NULL; /* might be set in push_string_init () */ isp = tmp; input_change = true; } -/*------------------------------------------------------------------------. -| To switch input over to the wrapup stack, main () calls pop_wrapup (). | -| Since wrapup text can install new wrapup text, pop_wrapup () returns | -| false when there is no wrapup text on the stack, and true otherwise. | -`------------------------------------------------------------------------*/ +/*-------------------------------------------------------------------. +| To switch input over to the wrapup stack, main () calls pop_wrapup | +| (). Since wrapup text can install new wrapup text, pop_wrapup () | +| returns false when there is no wrapup text on the stack, and true | +| otherwise. | +`-------------------------------------------------------------------*/ bool pop_wrapup (void) @@ -432,12 +435,12 @@ init_macro_token (token_data *td) } -/*------------------------------------------------------------------------. -| Low level input is done a character at a time. The function peek_input | -| () is used to look at the next character in the input stream. At any | -| given time, it reads from the input_block on the top of the current | -| input stack. | -`------------------------------------------------------------------------*/ +/*-----------------------------------------------------------------. +| Low level input is done a character at a time. The function | +| peek_input () is used to look at the next character in the input | +| stream. At any given time, it reads from the input_block on the | +| top of the current input stack. | +`-----------------------------------------------------------------*/ static int peek_input (void) @@ -480,20 +483,20 @@ peek_input (void) } } -/*-------------------------------------------------------------------------. -| The function next_char () is used to read and advance the input to the | -| next character. It also manages line numbers for error messages, so | -| they do not get wrong, due to lookahead. The token consisting of a | -| newline alone is taken as belonging to the line it ends, and the current | -| line number is not incremented until the next character is read. | -| 99.9% of all calls will read from a string, so factor that out into a | -| macro for speed. | -`-------------------------------------------------------------------------*/ +/*-------------------------------------------------------------------. +| The function next_char () is used to read and advance the input to | +| the next character. It also manages line numbers for error | +| messages, so they do not get wrong, due to lookahead. The token | +| consisting of a newline alone is taken as belonging to the line it | +| ends, and the current line number is not incremented until the | +| next character is read. 99.9% of all calls will read from a | +| string, so factor that out into a macro for speed. | +`-------------------------------------------------------------------*/ #define next_char() \ - (isp && isp->type == INPUT_STRING && isp->u.u_s.string[0] \ - && !input_change \ - ? to_uchar (*isp->u.u_s.string++) \ + (isp && isp->type == INPUT_STRING && isp->u.u_s.string[0] \ + && !input_change \ + ? to_uchar (*isp->u.u_s.string++) \ : next_char_1 ()) static int @@ -545,8 +548,7 @@ next_char_1 (void) break; case INPUT_MACRO: - pop_input (); /* INPUT_MACRO input sources has only one - token */ + pop_input (); /* INPUT_MACRO input sources has only one token */ return CHAR_MACRO; default: @@ -560,10 +562,10 @@ next_char_1 (void) } } -/*------------------------------------------------------------------------. -| skip_line () simply discards all immediately following characters, upto | -| the first newline. It is only used from m4_dnl (). | -`------------------------------------------------------------------------*/ +/*-------------------------------------------------------------------. +| skip_line () simply discards all immediately following characters, | +| upto the first newline. It is only used from m4_dnl (). | +`-------------------------------------------------------------------*/ void skip_line (void) @@ -600,20 +602,20 @@ skip_line (void) static bool match_input (const char *s, 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; bool result = false; ch = peek_input (); if (ch != to_uchar (*s)) - return false; /* fail */ + return false; /* fail */ if (s[1] == '\0') { if (consume) (void) next_char (); - return true; /* short match */ + return true; /* short match */ } (void) next_char (); @@ -621,7 +623,7 @@ match_input (const char *s, bool consume) { (void) next_char (); n++; - if (*s == '\0') /* long match */ + if (*s == '\0') /* long match */ { if (consume) return true; @@ -703,7 +705,7 @@ input_init (void) /*------------------------------------------------------------------. -| Functions for setting quotes and comment delimiters. Used by | +| Functions for setting quotes and comment delimiters. Used by | | m4_changecom () and m4_changequote (). Pass NULL if the argument | | was not present, to distinguish from an explicit empty string. | `------------------------------------------------------------------*/ @@ -1089,7 +1091,7 @@ static const char * token_type_string (token_type t) { switch (t) - { /* TOKSW */ + { /* TOKSW */ case TOKEN_EOF: return "EOF"; case TOKEN_STRING: @@ -1116,7 +1118,7 @@ print_token (const char *s, token_type t, token_data *td) { xfprintf (stderr, "%s: ", s); switch (t) - { /* TOKSW */ + { /* TOKSW */ case TOKEN_OPEN: case TOKEN_COMMA: case TOKEN_CLOSE: @@ -80,7 +80,7 @@ int retcode; struct macro_definition { struct macro_definition *next; - int code; /* D, U, s, t, '\1', or DEBUGFILE_OPTION. */ + int code; /* D, U, s, t, '\1', or DEBUGFILE_OPTION. */ const char *arg; }; typedef struct macro_definition macro_definition; @@ -277,12 +277,12 @@ mismatch, or whatever value was passed to the m4exit macro.\n\ non-character as a pseudo short option, starting with CHAR_MAX + 1. */ enum { - DEBUGFILE_OPTION = CHAR_MAX + 1, /* no short opt */ - DIVERSIONS_OPTION, /* not quite -N, because of message */ - WARN_MACRO_SEQUENCE_OPTION, /* no short opt */ + DEBUGFILE_OPTION = CHAR_MAX + 1, /* no short opt */ + DIVERSIONS_OPTION, /* not quite -N, because of message */ + WARN_MACRO_SEQUENCE_OPTION, /* no short opt */ - HELP_OPTION, /* no short opt */ - VERSION_OPTION /* no short opt */ + HELP_OPTION, /* no short opt */ + VERSION_OPTION /* no short opt */ }; static const struct option long_options[] = @@ -364,10 +364,10 @@ int main (int argc, char *const *argv) { struct sigaction act; - macro_definition *head; /* head of deferred argument list */ + macro_definition *head; /* head of deferred argument list */ macro_definition *tail; macro_definition *defn; - int optchar; /* option character */ + int optchar; /* option character */ macro_definition *defines; bool interactive = false; @@ -84,14 +84,14 @@ struct string { - char *string; /* characters of the string */ - size_t length; /* length of the string */ + char *string; /* characters of the string */ + size_t length; /* length of the string */ }; typedef struct string STRING; /* Memory allocation. */ -#define obstack_chunk_alloc xmalloc -#define obstack_chunk_free free +#define obstack_chunk_alloc xmalloc +#define obstack_chunk_free free /* Those must come first. */ typedef struct token_data token_data; @@ -109,30 +109,30 @@ typedef unsigned int bool_bitfield; /* 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_UNUSED M4_GNUC_ATTRIBUTE ((__unused__)) -#define M4_GNUC_PRINTF(fmt, arg) \ +#define M4_GNUC_UNUSED M4_GNUC_ATTRIBUTE ((__unused__)) +#define M4_GNUC_PRINTF(fmt, arg) \ M4_GNUC_ATTRIBUTE ((__format__ (__printf__, fmt, arg))) -#define M4_GNUC_NORETURN M4_GNUC_ATTRIBUTE ((__noreturn__)) +#define M4_GNUC_NORETURN M4_GNUC_ATTRIBUTE ((__noreturn__)) /* File: m4.c --- global definitions. */ /* Option flags. */ -extern int sync_output; /* -s */ -extern int debug_level; /* -d */ -extern size_t hash_table_size; /* -H */ -extern int no_gnu_extensions; /* -G */ -extern int prefix_all_builtins; /* -P */ -extern int max_debug_argument_length; /* -l */ -extern int suppress_warnings; /* -Q */ -extern int warning_status; /* -E */ -extern int nesting_limit; /* -L */ +extern int sync_output; /* -s */ +extern int debug_level; /* -d */ +extern size_t hash_table_size; /* -H */ +extern int no_gnu_extensions; /* -G */ +extern int prefix_all_builtins; /* -P */ +extern int max_debug_argument_length; /* -l */ +extern int suppress_warnings; /* -Q */ +extern int warning_status; /* -E */ +extern int nesting_limit; /* -L */ #ifdef ENABLE_CHANGEWORD -extern const char *user_word_regexp; /* -W */ +extern const char *user_word_regexp; /* -W */ #endif /* Error handling. */ @@ -180,55 +180,55 @@ extern FILE *debug; #define DEBUG_TRACE_DEFAULT 7 #define DEBUG_PRINT1(Fmt, Arg1) \ - do \ - { \ - if (debug != NULL) \ - xfprintf (debug, Fmt, Arg1); \ - } \ + do \ + { \ + if (debug != NULL) \ + xfprintf (debug, Fmt, Arg1); \ + } \ while (0) #define DEBUG_PRINT3(Fmt, Arg1, Arg2, Arg3) \ - do \ - { \ - if (debug != NULL) \ + do \ + { \ + if (debug != NULL) \ xfprintf (debug, Fmt, Arg1, Arg2, Arg3); \ - } \ + } \ while (0) #define DEBUG_MESSAGE(Fmt) \ - do \ - { \ - if (debug != NULL) \ - { \ - debug_message_prefix (); \ + do \ + { \ + if (debug != NULL) \ + { \ + debug_message_prefix (); \ xfprintf (debug, Fmt); \ - putc ('\n', debug); \ - } \ - } \ + putc ('\n', debug); \ + } \ + } \ while (0) #define DEBUG_MESSAGE1(Fmt, Arg1) \ - do \ - { \ - if (debug != NULL) \ - { \ - debug_message_prefix (); \ - xfprintf (debug, Fmt, Arg1); \ - putc ('\n', debug); \ - } \ - } \ + do \ + { \ + if (debug != NULL) \ + { \ + debug_message_prefix (); \ + xfprintf (debug, Fmt, Arg1); \ + putc ('\n', debug); \ + } \ + } \ while (0) #define DEBUG_MESSAGE2(Fmt, Arg1, Arg2) \ - do \ - { \ - if (debug != NULL) \ - { \ - debug_message_prefix (); \ - xfprintf (debug, Fmt, Arg1, Arg2); \ - putc ('\n', debug); \ - } \ - } \ + do \ + { \ + if (debug != NULL) \ + { \ + debug_message_prefix (); \ + xfprintf (debug, Fmt, Arg1, Arg2); \ + putc ('\n', debug); \ + } \ + } \ while (0) void debug_init (void); @@ -246,14 +246,14 @@ void trace_post (const char *, int, int, const char *); /* Various different token types. */ enum token_type { - TOKEN_EOF, /* end of file */ - TOKEN_STRING, /* a quoted string or comment */ - TOKEN_WORD, /* an identifier */ - TOKEN_OPEN, /* ( */ - TOKEN_COMMA, /* , */ - TOKEN_CLOSE, /* ) */ - TOKEN_SIMPLE, /* any other single character */ - TOKEN_MACDEF /* a macro's definition (see "defn") */ + TOKEN_EOF, /* end of file */ + TOKEN_STRING, /* a quoted string or comment */ + TOKEN_WORD, /* an identifier */ + TOKEN_OPEN, /* ( */ + TOKEN_COMMA, /* , */ + TOKEN_CLOSE, /* ) */ + TOKEN_SIMPLE, /* any other single character */ + TOKEN_MACDEF /* a macro's definition (see "defn") */ }; /* The data for a token, a macro argument, and a macro definition. */ @@ -282,12 +282,12 @@ struct token_data u; }; -#define TOKEN_DATA_TYPE(Td) ((Td)->type) -#define TOKEN_DATA_TEXT(Td) ((Td)->u.u_t.text) +#define TOKEN_DATA_TYPE(Td) ((Td)->type) +#define TOKEN_DATA_TEXT(Td) ((Td)->u.u_t.text) #ifdef ENABLE_CHANGEWORD -# define TOKEN_DATA_ORIG_TEXT(Td) ((Td)->u.u_t.original_text) +# define TOKEN_DATA_ORIG_TEXT(Td) ((Td)->u.u_t.original_text) #endif -#define TOKEN_DATA_FUNC(Td) ((Td)->u.func) +#define TOKEN_DATA_FUNC(Td) ((Td)->u.func) typedef enum token_type token_type; typedef enum token_data_type token_data_type; @@ -364,23 +364,23 @@ struct symbol token_data data; }; -#define SYMBOL_NEXT(S) ((S)->next) -#define SYMBOL_TRACED(S) ((S)->traced) -#define SYMBOL_SHADOWED(S) ((S)->shadowed) -#define SYMBOL_MACRO_ARGS(S) ((S)->macro_args) -#define SYMBOL_BLIND_NO_ARGS(S) ((S)->blind_no_args) -#define SYMBOL_DELETED(S) ((S)->deleted) +#define SYMBOL_NEXT(S) ((S)->next) +#define SYMBOL_TRACED(S) ((S)->traced) +#define SYMBOL_SHADOWED(S) ((S)->shadowed) +#define SYMBOL_MACRO_ARGS(S) ((S)->macro_args) +#define SYMBOL_BLIND_NO_ARGS(S) ((S)->blind_no_args) +#define SYMBOL_DELETED(S) ((S)->deleted) #define SYMBOL_PENDING_EXPANSIONS(S) ((S)->pending_expansions) -#define SYMBOL_NAME(S) ((S)->name) -#define SYMBOL_TYPE(S) (TOKEN_DATA_TYPE (&(S)->data)) -#define SYMBOL_TEXT(S) (TOKEN_DATA_TEXT (&(S)->data)) -#define SYMBOL_FUNC(S) (TOKEN_DATA_FUNC (&(S)->data)) +#define SYMBOL_NAME(S) ((S)->name) +#define SYMBOL_TYPE(S) (TOKEN_DATA_TYPE (&(S)->data)) +#define SYMBOL_TEXT(S) (TOKEN_DATA_TEXT (&(S)->data)) +#define SYMBOL_FUNC(S) (TOKEN_DATA_FUNC (&(S)->data)) typedef enum symbol_lookup symbol_lookup; typedef struct symbol symbol; typedef void hack_symbol (symbol *, void *); -#define HASHMAX 509 /* default, overridden by -Hsize */ +#define HASHMAX 509 /* default, overridden by -Hsize */ extern symbol **symtab; diff --git a/src/macro.c b/src/macro.c index 7def8b0f..8244b0e9 100644 --- a/src/macro.c +++ b/src/macro.c @@ -72,12 +72,12 @@ expand_input (void) } -/*------------------------------------------------------------------------. -| Expand one token, according to its type. Potential macro names | -| (TOKEN_WORD) are looked up in the symbol table, to see if they have a | -| macro definition. If they have, they are expanded as macros, otherwise | -| the text are just copied to the output. | -`------------------------------------------------------------------------*/ +/*----------------------------------------------------------------. +| Expand one token, according to its type. Potential macro names | +| (TOKEN_WORD) are looked up in the symbol table, to see if they | +| have a macro definition. If they have, they are expanded as | +| macros, otherwise the text is just copied to the output. | +`----------------------------------------------------------------*/ static void expand_token (struct obstack *obs, token_type t, token_data *td, int line) @@ -85,7 +85,7 @@ expand_token (struct obstack *obs, token_type t, token_data *td, int line) symbol *sym; switch (t) - { /* TOKSW */ + { /* TOKSW */ case TOKEN_EOF: case TOKEN_MACDEF: break; @@ -126,15 +126,15 @@ expand_token (struct obstack *obs, token_type t, token_data *td, int line) } -/*-------------------------------------------------------------------------. -| This function parses one argument to a macro call. It expects the first | -| left parenthesis, or the separating comma to have been read by the | -| caller. It skips leading whitespace, and reads and expands tokens, | -| until it finds a comma or an right parenthesis at the same level of | -| parentheses. It returns a flag indicating whether the argument read are | -| the last for the active macro call. The argument are build on the | -| obstack OBS, indirectly through expand_token (). | -`-------------------------------------------------------------------------*/ +/*-------------------------------------------------------------------. +| This function parses one argument to a macro call. It expects the | +| first left parenthesis, or the separating comma, to have been read | +| by the caller. It skips leading whitespace, and reads and expands | +| tokens, until it finds a comma or an right parenthesis at the same | +| level of parentheses. It returns a flag indicating whether the | +| argument read is the last for the active macro call. The argument | +| is built on the obstack OBS, indirectly through expand_token (). | +`-------------------------------------------------------------------*/ static bool expand_argument (struct obstack *obs, token_data *argp) @@ -161,7 +161,7 @@ expand_argument (struct obstack *obs, token_data *argp) { switch (t) - { /* TOKSW */ + { /* TOKSW */ case TOKEN_COMMA: case TOKEN_CLOSE: if (paren_level == 0) @@ -219,11 +219,11 @@ expand_argument (struct obstack *obs, token_data *argp) } } -/*-------------------------------------------------------------------------. -| Collect all the arguments to a call of the macro SYM. The arguments are | -| stored on the obstack ARGUMENTS and a table of pointers to the arguments | -| on the obstack ARGPTR. | -`-------------------------------------------------------------------------*/ +/*-------------------------------------------------------------. +| Collect all the arguments to a call of the macro SYM. The | +| arguments are stored on the obstack ARGUMENTS and a table of | +| pointers to the arguments on the obstack ARGPTR. | +`-------------------------------------------------------------*/ static void collect_arguments (symbol *sym, struct obstack *argptr, @@ -259,14 +259,15 @@ collect_arguments (symbol *sym, struct obstack *argptr, } -/*------------------------------------------------------------------------. -| The actual call of a macro is handled by call_macro (). call_macro () | -| is passed a symbol SYM, whose type is used to call either a builtin | -| function, or the user macro expansion function expand_user_macro () | -| (lives in builtin.c). There are ARGC arguments to the call, stored in | -| the ARGV table. The expansion is left on the obstack EXPANSION. Macro | -| tracing is also handled here. | -`------------------------------------------------------------------------*/ +/*-------------------------------------------------------------------. +| The actual call of a macro is handled by call_macro (). | +| call_macro () is passed a symbol SYM, whose type is used to call | +| either a builtin function, or the user macro expansion function | +| expand_user_macro () (lives in builtin.c). There are ARGC | +| arguments to the call, stored in the ARGV table. The expansion is | +| left on the obstack EXPANSION. Macro tracing is also handled | +| here. | +`-------------------------------------------------------------------*/ void call_macro (symbol *sym, int argc, token_data **argv, @@ -290,22 +291,24 @@ call_macro (symbol *sym, int argc, token_data **argv, } } -/*-------------------------------------------------------------------------. -| The macro expansion is handled by expand_macro (). It parses the | -| arguments, using collect_arguments (), and builds a table of pointers to | -| the arguments. The arguments themselves are stored on a local obstack. | -| Expand_macro () uses call_macro () to do the call of the macro. | -| | -| Expand_macro () is potentially recursive, since it calls expand_argument | -| (), which might call expand_token (), which might call expand_macro (). | -`-------------------------------------------------------------------------*/ +/*-------------------------------------------------------------------. +| The macro expansion is handled by expand_macro (). It parses the | +| arguments, using collect_arguments (), and builds a table of | +| pointers to the arguments. The arguments themselves are stored on | +| a local obstack. Expand_macro () uses call_macro () to do the | +| call of the macro. | +| | +| Expand_macro () is potentially recursive, since it calls | +| expand_argument (), which might call expand_token (), which might | +| call expand_macro (). | +`-------------------------------------------------------------------*/ static void expand_macro (symbol *sym) { - struct obstack arguments; /* Alternate obstack if argc_stack is busy. */ - unsigned argv_base; /* Size of argv_stack on entry. */ - bool use_argc_stack = true; /* Whether argc_stack is safe. */ + struct obstack arguments; /* Alternate obstack if argc_stack is busy. */ + unsigned argv_base; /* Size of argv_stack on entry. */ + bool use_argc_stack = true; /* Whether argc_stack is safe. */ token_data **argv; int argc; struct obstack *expansion; diff --git a/src/output.c b/src/output.c index 9e5957e1..75c88767 100644 --- a/src/output.c +++ b/src/output.c @@ -59,13 +59,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. */ - int size; /* Usable size before reallocation. */ - int used; /* Used buffer length, or tmp file exists. */ + int divnum; /* Which diversion this represents. */ + int size; /* Usable size before reallocation. */ + int used; /* Used buffer length, or tmp file exists. */ }; /* Table of diversions 1 through INT_MAX. */ @@ -408,14 +408,15 @@ output_exit (void) obstack_free (&diversion_storage, NULL); } -/*-----------------------------------------------------------------------. -| Reorganize in-memory diversion buffers so the current diversion can | -| accomodate LENGTH more characters without further reorganization. The | -| current diversion buffer is made bigger if possible. But to make room | -| for a bigger buffer, one of the in-memory diversion buffers might have | -| to be flushed to a newly created temporary file. This flushed buffer | -| might well be the current one. | -`-----------------------------------------------------------------------*/ +/*----------------------------------------------------------------. +| Reorganize in-memory diversion buffers so the current diversion | +| can accomodate LENGTH more characters without further | +| reorganization. The current diversion buffer is made bigger if | +| possible. But to make room for a bigger buffer, one of the | +| in-memory diversion buffers might have to be flushed to a newly | +| created temporary file. This flushed buffer might well be the | +| current one. | +`----------------------------------------------------------------*/ static void make_room_for (int length) @@ -531,17 +532,17 @@ make_room_for (int length) } } -/*------------------------------------------------------------------------. -| Output one character CHAR, when it is known that it goes to a diversion | -| file or an in-memory diversion buffer. | -`------------------------------------------------------------------------*/ +/*--------------------------------------------------------------. +| Output one character CHAR, when it is known that it goes to a | +| diversion file or an in-memory diversion buffer. | +`--------------------------------------------------------------*/ #define OUTPUT_CHARACTER(Char) \ - if (output_file) \ - putc ((Char), output_file); \ - else if (output_unused == 0) \ - output_character_helper ((Char)); \ - else \ + if (output_file) \ + putc ((Char), output_file); \ + else if (output_unused == 0) \ + output_character_helper ((Char)); \ + else \ (output_unused--, *output_cursor++ = (Char)) static void @@ -558,10 +559,10 @@ output_character_helper (int character) } } -/*------------------------------------------------------------------------. -| Output one TEXT having LENGTH characters, when it is known that it goes | -| to a diversion file or an in-memory diversion buffer. | -`------------------------------------------------------------------------*/ +/*-------------------------------------------------------------------. +| Output one TEXT having LENGTH characters, when it is known that it | +| goes to a diversion file or an in-memory diversion buffer. | +`-------------------------------------------------------------------*/ void output_text (const char *text, int length) @@ -709,10 +710,10 @@ shipout_text (struct obstack *obs, const char *text, int length, int line) /* Functions for use by diversions. */ -/*--------------------------------------------------------------------------. -| Make a file for diversion DIVNUM, and install it in the diversion table. | -| Grow the size of the diversion table as needed. | -`--------------------------------------------------------------------------*/ +/*------------------------------------------------------------------. +| Make a file for diversion DIVNUM, and install it in the diversion | +| table. Grow the size of the diversion table as needed. | +`------------------------------------------------------------------*/ /* The number of possible diversions is limited only by memory and available file descriptors (each overflowing diversion uses one). */ @@ -808,7 +809,7 @@ make_diversion (int divnum) /*-------------------------------------------------------------------. | Insert a FILE into the current output file, in the same manner | | diversions are handled. This allows files to be included, without | -| having them rescanned by m4. | +| having them rescanned by m4. | `-------------------------------------------------------------------*/ void @@ -837,7 +838,7 @@ insert_file (FILE *file) | Insert DIVERSION (but not div0) into the current output file. The | | diversion is NOT placed on the expansion obstack, because it must | | not be rescanned. When the file is closed, it is deleted by the | -| system. | +| system. | `-------------------------------------------------------------------*/ static void @@ -919,11 +920,12 @@ insert_diversion_helper (m4_diversion *diversion) free_list = diversion; } -/*-------------------------------------------------------------------------. -| Insert diversion number DIVNUM into the current output file. The | -| diversion is NOT placed on the expansion obstack, because it must not be | -| rescanned. When the file is closed, it is deleted by the system. | -`-------------------------------------------------------------------------*/ +/*------------------------------------------------------------------. +| Insert diversion number DIVNUM into the current output file. The | +| diversion is NOT placed on the expansion obstack, because it must | +| not be rescanned. When the file is closed, it is deleted by the | +| system. | +`------------------------------------------------------------------*/ void insert_diversion (int divnum) @@ -943,10 +945,10 @@ insert_diversion (int divnum) } } -/*-------------------------------------------------------------------------. -| Get back all diversions. This is done just before exiting from main (), | -| and from m4_undivert (), if called without arguments. | -`-------------------------------------------------------------------------*/ +/*----------------------------------------------------------------. +| Get back all diversions. This is done just before exiting from | +| main (), and from m4_undivert (), if called without arguments. | +`----------------------------------------------------------------*/ void undivert_all (void) @@ -977,7 +979,7 @@ freeze_diversions (FILE *file) saved_number = current_diversion; last_inserted = 0; make_diversion (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)) @@ -26,16 +26,16 @@ struct includes { - struct includes *next; /* next directory to search */ - const char *dir; /* directory */ + struct includes *next; /* next directory to search */ + const char *dir; /* directory */ int len; }; typedef struct includes includes; -static includes *dir_list; /* the list of path directories */ -static includes *dir_list_end; /* the end of same */ -static int dir_max_length; /* length of longest directory name */ +static includes *dir_list; /* the list of path directories */ +static includes *dir_list_end; /* the end of same */ +static int dir_max_length; /* length of longest directory name */ void @@ -138,7 +138,7 @@ m4_path_search (const char *file, char **result) { FILE *fp; includes *incl; - char *name; /* buffer for constructed name */ + char *name; /* buffer for constructed name */ int e; if (result) diff --git a/src/symtab.c b/src/symtab.c index 46e7d229..7012cbe5 100644 --- a/src/symtab.c +++ b/src/symtab.c @@ -87,10 +87,10 @@ profile_strcmp (const char *s1, const char *s2) #endif /* DEBUG_SYM */ -/*----------------------------------------------------------------------. -| Initialise the symbol table, by allocating the necessary storage, and | -| zeroing all the entries. | -`----------------------------------------------------------------------*/ +/*------------------------------------------------------------------. +| Initialise the symbol table, by allocating the necessary storage, | +| and zeroing all the entries. | +`------------------------------------------------------------------*/ /* Pointer to symbol table. */ symbol **symtab; @@ -153,15 +153,15 @@ free_symbol (symbol *sym) /*-------------------------------------------------------------------. | Search in, and manipulation of the symbol table, are all done by | -| lookup_symbol (). It basically hashes NAME to a list in the | +| lookup_symbol (). It basically hashes NAME to a list in the | | symbol table, and searches this list for the first occurrence of a | -| symbol with the name. | -| | +| symbol with the name. | +| | | The MODE parameter determines what lookup_symbol () will do. It | -| can either just do a lookup, do a lookup and insert if not | +| can either just do a lookup, do a lookup and insert if not | | present, do an insertion even if the name is already in the list, | | delete the first occurrence of the name on the list, or delete all | -| occurrences of the name on the list. | +| occurrences of the name on the list. | `-------------------------------------------------------------------*/ symbol * @@ -317,12 +317,12 @@ lookup_symbol (const char *name, symbol_lookup mode) /*-----------------------------------------------------------------. | The following function is used for the cases where we want to do | | something to each and every symbol in the table. The function | -| hack_all_symbols () traverses the symbol table, and calls a | +| hack_all_symbols () traverses the symbol table, and calls a | | specified function FUNC for each symbol in the table. FUNC is | -| called with a pointer to the symbol, and the DATA argument. | -| | -| FUNC may safely call lookup_symbol with mode SYMBOL_POPDEF or | -| SYMBOL_LOOKUP, but any other mode can break the iteration. | +| called with a pointer to the symbol, and the DATA argument. | +| | +| FUNC may safely call lookup_symbol with mode SYMBOL_POPDEF or | +| SYMBOL_LOOKUP, but any other mode can break the iteration. | `-----------------------------------------------------------------*/ void |