{
    "mode": "info",
    "parameter": "m4",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/info/m4/json",
    "generated": "2026-11-11T09:41:41Z",
    "sections": {
        "File: m4.info,  Node: Top,  Next: Preliminaries,  Up: (dir)": {
            "content": "",
            "subsections": []
        },
        "GNU M4": {
            "content": "",
            "subsections": []
        },
        "This manual is for GNU M4 (version 1.4.19), a package containing an": {
            "content": "implementation of the m4 macro language.\n\nCopyright (C) 1989-1994, 2004-2014, 2016-2017, 2020-2021 Free Software\nFoundation, Inc.\n\nPermission is granted to copy, distribute and/or modify this\ndocument under the terms of the GNU Free Documentation License,\nVersion 1.3 or any later version published by the Free Software\nFoundation; with no Invariant Sections, no Front-Cover Texts, and\nno Back-Cover Texts.  A copy of the license is included in the\nsection entitled \"GNU Free Documentation License.\"\n\nGNU 'm4' is an implementation of the traditional UNIX macro\nprocessor.  It is mostly SVR4 compatible, although it has some\nextensions (for example, handling more than 9 positional parameters to\nmacros).  'm4' also has builtin functions for including files, running\nshell commands, doing arithmetic, etc.  Autoconf needs GNU 'm4' for\ngenerating 'configure' scripts, but not for running them.\n\nGNU 'm4' was originally written by Rene' Seindal, with subsequent\nchanges by Franc,ois Pinard and other volunteers on the Internet.  All\nnames and email addresses can be found in the files 'm4-1.4.19/AUTHORS'\nand 'm4-1.4.19/THANKS' from the GNU M4 distribution.\n\nThis is release 1.4.19.  It is now considered stable: future releases\nin the 1.4.x series are only meant to fix bugs, increase speed, or\nimprove documentation.  However...\n\nAn experimental feature, which would improve 'm4' usefulness, allows\nfor changing the syntax for what is a \"word\" in 'm4'.  You should use:\n./configure --enable-changeword\nif you want this feature compiled in.  The current implementation slows\ndown 'm4' considerably and is hardly acceptable.  In the future, 'm4'\n2.0 will come with a different set of new features that provide similar\ncapabilities, but without the inefficiencies, so changeword will go away\nand you should not count on it.\n\n* Menu:\n\n* Preliminaries::               Introduction and preliminaries\n* Invoking m4::                 Invoking 'm4'\n* Syntax::                      Lexical and syntactic conventions\n\n* Macros::                      How to invoke macros\n* Definitions::                 How to define new macros\n* Conditionals::                Conditionals, loops, and recursion\n\n* Debugging::                   How to debug macros and input\n\n* Input Control::               Input control\n* File Inclusion::              File inclusion\n* Diversions::                  Diverting and undiverting output\n\n* Text handling::               Macros for text handling\n* Arithmetic::                  Macros for doing arithmetic\n* Shell commands::              Macros for running shell commands\n* Miscellaneous::               Miscellaneous builtin macros\n* Frozen files::                Fast loading of frozen state\n\n* Compatibility::               Compatibility with other versions of 'm4'\n* Answers::                     Correct version of some examples\n\n* Copying This Package::        How to make copies of the overall M4 package\n* Copying This Manual::         How to make copies of this manual\n* Indices::                     Indices of concepts and macros\n\n-- The Detailed Node Listing --\n",
            "subsections": []
        },
        "Introduction and preliminaries": {
            "content": "* Intro::                       Introduction to 'm4'\n* History::                     Historical references\n* Bugs::                        Problems and bugs\n* Manual::                      Using this manual\n",
            "subsections": []
        },
        "Invoking 'm4'": {
            "content": "* Operation modes::             Command line options for operation modes\n* Preprocessor features::       Command line options for preprocessor features\n* Limits control::              Command line options for limits control\n* Frozen state::                Command line options for frozen state\n* Debugging options::           Command line options for debugging\n* Command line files::          Specifying input files on the command line\n",
            "subsections": []
        },
        "Lexical and syntactic conventions": {
            "content": "* Names::                       Macro names\n* Quoted strings::              Quoting input to 'm4'\n* Comments::                    Comments in 'm4' input\n* Other tokens::                Other kinds of input tokens\n* Input processing::            How 'm4' copies input to output\n",
            "subsections": []
        },
        "How to invoke macros": {
            "content": "* Invocation::                  Macro invocation\n* Inhibiting Invocation::       Preventing macro invocation\n* Macro Arguments::             Macro arguments\n* Quoting Arguments::           On Quoting Arguments to macros\n* Macro expansion::             Expanding macros\n",
            "subsections": []
        },
        "How to define new macros": {
            "content": "* Define::                      Defining a new macro\n* Arguments::                   Arguments to macros\n* Pseudo Arguments::            Special arguments to macros\n* Undefine::                    Deleting a macro\n* Defn::                        Renaming macros\n* Pushdef::                     Temporarily redefining macros\n\n* Indir::                       Indirect call of macros\n* Builtin::                     Indirect call of builtins\n",
            "subsections": []
        },
        "Conditionals, loops, and recursion": {
            "content": "* Ifdef::                       Testing if a macro is defined\n* Ifelse::                      If-else construct, or multibranch\n* Shift::                       Recursion in 'm4'\n* Forloop::                     Iteration by counting\n* Foreach::                     Iteration by list contents\n* Stacks::                      Working with definition stacks\n* Composition::                 Building macros with macros\n",
            "subsections": []
        },
        "How to debug macros and input": {
            "content": "* Dumpdef::                     Displaying macro definitions\n* Trace::                       Tracing macro calls\n* Debug Levels::                Controlling debugging output\n* Debug Output::                Saving debugging output\n",
            "subsections": []
        },
        "Input control": {
            "content": "* Dnl::                         Deleting whitespace in input\n* Changequote::                 Changing the quote characters\n* Changecom::                   Changing the comment delimiters\n* Changeword::                  Changing the lexical structure of words\n* M4wrap::                      Saving text until end of input\n",
            "subsections": []
        },
        "File inclusion": {
            "content": "* Include::                     Including named files\n* Search Path::                 Searching for include files\n",
            "subsections": []
        },
        "Diverting and undiverting output": {
            "content": "* Divert::                      Diverting output\n* Undivert::                    Undiverting output\n* Divnum::                      Diversion numbers\n* Cleardivert::                 Discarding diverted text\n",
            "subsections": []
        },
        "Macros for text handling": {
            "content": "* Len::                         Calculating length of strings\n* Index macro::                 Searching for substrings\n* Regexp::                      Searching for regular expressions\n* Substr::                      Extracting substrings\n* Translit::                    Translating characters\n* Patsubst::                    Substituting text by regular expression\n* Format::                      Formatting strings (printf-like)\n",
            "subsections": []
        },
        "Macros for doing arithmetic": {
            "content": "* Incr::                        Decrement and increment operators\n* Eval::                        Evaluating integer expressions\n",
            "subsections": []
        },
        "Macros for running shell commands": {
            "content": "* Platform macros::             Determining the platform\n* Syscmd::                      Executing simple commands\n* Esyscmd::                     Reading the output of commands\n* Sysval::                      Exit status\n* Mkstemp::                     Making temporary files\n",
            "subsections": []
        },
        "Miscellaneous builtin macros": {
            "content": "* Errprint::                    Printing error messages\n* Location::                    Printing current location\n* M4exit::                      Exiting from 'm4'\n",
            "subsections": []
        },
        "Fast loading of frozen state": {
            "content": "* Using frozen files::          Using frozen files\n* Frozen file format::          Frozen file format\n",
            "subsections": []
        },
        "Compatibility with other versions of 'm4'": {
            "content": "* Extensions::                  Extensions in GNU M4\n* Incompatibilities::           Facilities in System V m4 not in GNU M4\n* Other Incompatibilities::     Other incompatibilities\n",
            "subsections": []
        },
        "Correct version of some examples": {
            "content": "* Improved exch::               Solution for 'exch'\n* Improved forloop::            Solution for 'forloop'\n* Improved foreach::            Solution for 'foreach'\n* Improved copy::               Solution for 'copy'\n* Improved m4wrap::             Solution for 'm4wrap'\n* Improved cleardivert::        Solution for 'cleardivert'\n* Improved capitalize::         Solution for 'capitalize'\n* Improved fatalerror::        Solution for 'fatalerror'\n",
            "subsections": []
        },
        "How to make copies of the overall M4 package": {
            "content": "* GNU General Public License::  License for copying the M4 package\n",
            "subsections": []
        },
        "How to make copies of this manual": {
            "content": "* GNU Free Documentation License::  License for copying this manual\n",
            "subsections": []
        },
        "Indices of concepts and macros": {
            "content": "* Macro index::                 Index for all 'm4' macros\n* Concept index::               Index for many concepts\n\n",
            "subsections": []
        },
        "File: m4.info,  Node: Preliminaries,  Next: Invoking m4,  Prev: Top,  Up: Top": {
            "content": "",
            "subsections": []
        },
        "1 Introduction and preliminaries": {
            "content": "",
            "subsections": []
        },
        "This first chapter explains what GNU 'm4' is, where 'm4' comes from, how": {
            "content": "to read and use this documentation, how to call the 'm4' program, and\nhow to report bugs about it.  It concludes by giving tips for reading\nthe remainder of the manual.\n\nThe following chapters then detail all the features of the 'm4'\nlanguage.\n\n* Menu:\n\n* Intro::                       Introduction to 'm4'\n* History::                     Historical references\n* Bugs::                        Problems and bugs\n* Manual::                      Using this manual\n",
            "subsections": []
        },
        "File: m4.info,  Node: Intro,  Next: History,  Up: Preliminaries": {
            "content": "",
            "subsections": [
                {
                    "name": "1.1 Introduction to 'm4'",
                    "content": "'m4' is a macro processor, in the sense that it copies its input to the\noutput, expanding macros as it goes.  Macros are either builtin or\nuser-defined, and can take any number of arguments.  Besides just doing\nmacro expansion, 'm4' has builtin functions for including named files,\nrunning shell commands, doing integer arithmetic, manipulating text in\nvarious ways, performing recursion, etc.... 'm4' can be used either as a\nfront-end to a compiler, or as a macro processor in its own right.\n\nThe 'm4' macro processor is widely available on all UNIXes, and has\nbeen standardized by POSIX. Usually, only a small percentage of users\nare aware of its existence.  However, those who find it often become\ncommitted users.  The popularity of GNU Autoconf, which requires GNU\n'm4' for generating 'configure' scripts, is an incentive for many to\ninstall it, while these people will not themselves program in 'm4'.  GNU\n'm4' is mostly compatible with the System V, Release 4 version, except\nfor some minor differences.  *Note Compatibility::, for more details.\n\nSome people find 'm4' to be fairly addictive.  They first use 'm4'\nfor simple problems, then take bigger and bigger challenges, learning\nhow to write complex sets of 'm4' macros along the way.  Once really\naddicted, users pursue writing of sophisticated 'm4' applications even\nto solve simple problems, devoting more time debugging their 'm4'\nscripts than doing real work.  Beware that 'm4' may be dangerous for the\nhealth of compulsive programmers.\n"
                }
            ]
        },
        "File: m4.info,  Node: History,  Next: Bugs,  Prev: Intro,  Up: Preliminaries": {
            "content": "",
            "subsections": [
                {
                    "name": "1.2 Historical references",
                    "content": ""
                }
            ]
        },
        "Macro languages were invented early in the history of computing.  In the": {
            "content": "1950s Alan Perlis suggested that the macro language be independent of\nthe language being processed.  Techniques such as conditional and\nrecursive macros, and using macros to define other macros, were\ndescribed by Doug McIlroy of Bell Labs in \"Macro Instruction Extensions\nof Compiler Languages\", Communications of the ACM 3, 4 (1960), 214-20,\n<https://dl.acm.org/doi/10.1145/367177.367223>.\n\nAn important precursor of 'm4' was GPM; see C. Strachey, \"A general\npurpose macrogenerator\", Computer Journal 8, 3 (1965), 225-41,\n<https://academic.oup.com/comjnl/article/8/3/225/336044>.  GPM is also\nsuccinctly described in David Gries's book Compiler Construction for\nDigital Computers, Wiley (1971).  Strachey was a brilliant programmer:\nGPM fit into 250 machine instructions!\n\nInspired by GPM while visiting Strachey's Lab in 1968, McIlroy wrote\na model preprocessor in that fit into a page of Snobol 3 code, and",
            "subsections": []
        },
        "McIlroy and Robert Morris developed a series of further models at Bell": {
            "content": "",
            "subsections": []
        },
        "Labs.  Andrew D. Hall followed up with M6, a general purpose macro": {
            "content": "processor used to port the Fortran source code of the Altran computer\nalgebra system; see Hall's \"The M6 Macro Processor\", Computing Science\nTechnical Report #2, Bell Labs (1972),\n<http://cm.bell-labs.com/cm/cs/cstr/2.pdf>.  M6's source code consisted\nof about 600 Fortran statements.  Its name was the first of the 'm4'\nline.\n\nThe Brian Kernighan and P.J. Plauger book Software Tools,",
            "subsections": []
        },
        "Addison-Wesley (1976), describes and implements a Unix macro-processor": {
            "content": "language, which inspired Dennis Ritchie to write 'm3', a macro processor\nfor the AP-3 minicomputer.\n\nKernighan and Ritchie then joined forces to develop the original\n'm4', described in \"The M4 Macro Processor\", Bell Laboratories (1977),\n<https://wolfram.schneider.org/bsd/7thEdManVol2/m4/m4.pdf>.  It had only\n21 builtin macros.\n\nWhile 'GPM' was more pure, 'm4' is meant to deal with the true\nintricacies of real life: macros can be recognized without being\npre-announced, skipping whitespace or end-of-lines is easier, more\nconstructs are builtin instead of derived, etc.\n\nOriginally, the Kernighan and Plauger macro-processor, and then 'm3',\nformed the engine for the Rational FORTRAN preprocessor, that is, the\n'Ratfor' equivalent of 'cpp'.  Later, 'm4' was used as a front-end for\n'Ratfor', 'C' and 'Cobol'.\n\nRene' Seindal released his implementation of 'm4', GNU 'm4', in 1990,\nwith the aim of removing the artificial limitations in many of the\ntraditional 'm4' implementations, such as maximum line length, macro\nsize, or number of macros.\n\nThe late Professor A. Dain Samples described and implemented a\nfurther evolution in the form of 'M5': \"User's Guide to the M5 Macro\nLanguage: 2nd edition\", Electronic Announcement on comp.compilers\nnewsgroup (1992).\n\nFranc,ois Pinard took over maintenance of GNU 'm4' in 1992, until 1994\nwhen he released GNU 'm4' 1.4, which was the stable release for 10\nyears.  It was at this time that GNU Autoconf decided to require GNU\n'm4' as its underlying engine, since all other implementations of 'm4'\nhad too many limitations.\n\nMore recently, in 2004, Paul Eggert released 1.4.1 and 1.4.2 which\naddressed some long standing bugs in the venerable 1.4 release.  Then in\n2005, Gary V. Vaughan collected together the many patches to GNU 'm4'\n1.4 that were floating around the net and released 1.4.3 and 1.4.4.  And\nin 2006, Eric Blake joined the team and prepared patches for the release\nof 1.4.5, with subsequent releases through intervening years, as recent\nas 1.4.18 in 2016.\n\nMeanwhile, development has continued on new features for 'm4', such\nas dynamic module loading and additional builtins.  When complete, GNU\n'm4' 2.0 will start a new series of releases.\n",
            "subsections": []
        },
        "File: m4.info,  Node: Bugs,  Next: Manual,  Prev: History,  Up: Preliminaries": {
            "content": "",
            "subsections": [
                {
                    "name": "1.3 Problems and bugs",
                    "content": ""
                }
            ]
        },
        "If you have problems with GNU M4 or think you've found a bug, please": {
            "content": "report it.  Before reporting a bug, make sure you've actually found a\nreal bug.  Carefully reread the documentation and see if it really says\nyou can do what you're trying to do.  If it's not clear whether you\nshould be able to do something or not, report that too; it's a bug in\nthe documentation!\n\nBefore reporting a bug or trying to fix it yourself, try to isolate\nit to the smallest possible input file that reproduces the problem.",
            "subsections": []
        },
        "Then send us the input file and the exact results 'm4' gave you.  Also": {
            "content": "say what you expected to occur; this will help us decide whether the\nproblem was really in the documentation.\n\nOnce you've got a precise problem, send e-mail to <bug-m4@gnu.org>.",
            "subsections": []
        },
        "Please include the version number of 'm4' you are using.  You can get": {
            "content": "this information with the command 'm4 --version'.  Also provide details\nabout the platform you are executing on.\n\nNon-bug suggestions are always welcome as well.  If you have\nquestions about things that are unclear in the documentation or are just\nobscure features, please report them too.\n",
            "subsections": []
        },
        "File: m4.info,  Node: Manual,  Prev: Bugs,  Up: Preliminaries": {
            "content": "",
            "subsections": [
                {
                    "name": "1.4 Using this manual",
                    "content": ""
                }
            ]
        },
        "This manual contains a number of examples of 'm4' input and output, and": {
            "content": "a simple notation is used to distinguish input, output and error\nmessages from 'm4'.  Examples are set out from the normal text, and\nshown in a fixed width font, like this\n\nThis is an example of an example!\n\nTo distinguish input from output, all output from 'm4' is prefixed by\nthe string '=>', and all error messages by the string 'error->'.  When\nshowing how command line options affect matters, the command line is\nshown with a prompt '$ 'like this'', otherwise, you can assume that a\nsimple 'm4' invocation will work.  Thus:\n\n$ command line to invoke m4\nExample of input line\n=>Output line from m4\nerror->and an error message\n\nThe sequence '^D' in an example indicates the end of the input file.\nThe sequence '<NL>' refers to the newline character.  The majority of\nthese examples are self-contained, and you can run them with similar\nresults by invoking 'm4 -d'.  In fact, the testsuite that is bundled in\nthe GNU M4 package consists of the examples in this document!  Some of\nthe examples assume that your current directory is located where you\nunpacked the installation, so if you plan on following along, you may\nfind it helpful to do this now:\n\n$ cd m4-1.4.19\n\nAs each of the predefined macros in 'm4' is described, a prototype\ncall of the macro will be shown, giving descriptive names to the\narguments, e.g.,\n\n-- Composite: example (STRING, [COUNT = 1], [ARGUMENT]...)\nThis is a sample prototype.  There is not really a macro named\n'example', but this documents that if there were, it would be a\nComposite macro, rather than a Builtin.  It requires at least one\nargument, STRING.  Remember that in 'm4', there must not be a space\nbetween the macro name and the opening parenthesis, unless it was\nintended to call the macro without any arguments.  The brackets\naround COUNT and ARGUMENT show that these arguments are optional.\nIf COUNT is omitted, the macro behaves as if count were '1',\nwhereas if ARGUMENT is omitted, the macro behaves as if it were the\nempty string.  A blank argument is not the same as an omitted\nargument.  For example, 'example(`a')', 'example(`a',`1')', and\n'example(`a',`1',)' would behave identically with COUNT set to '1';\nwhile 'example(`a',)' and 'example(`a',`')' would explicitly pass\nthe empty string for COUNT.  The ellipses ('...') show that the\nmacro processes additional arguments after ARGUMENT, rather than\nignoring them.\n\nAll macro arguments in 'm4' are strings, but some are given special\ninterpretation, e.g., as numbers, file names, regular expressions, etc.",
            "subsections": []
        },
        "The documentation for each macro will state how the parameters are": {
            "content": "interpreted, and what happens if the argument cannot be parsed according\nto the desired interpretation.  Unless specified otherwise, a parameter\nspecified to be a number is parsed as a decimal, even if the argument\nhas leading zeros; and parsing the empty string as a number results in 0\nrather than an error, although a warning will be issued.\n\nThis document consistently writes and uses \"builtin\", without a\nhyphen, as if it were an English word.  This is how the 'builtin'\nprimitive is spelled within 'm4'.\n",
            "subsections": []
        },
        "File: m4.info,  Node: Invoking m4,  Next: Syntax,  Prev: Preliminaries,  Up: Top": {
            "content": "",
            "subsections": []
        },
        "2 Invoking 'm4'": {
            "content": "The format of the 'm4' command is:\n\nm4 [OPTION...] [FILE...]\n\nAll options begin with '-', or if long option names are used, with\n'--'.  A long option name need not be written completely, any\nunambiguous prefix is sufficient.  POSIX requires 'm4' to recognize\narguments intermixed with files, even when 'POSIXLYCORRECT' is set in\nthe environment.  Most options take effect at startup regardless of\ntheir position, but some are documented below as taking effect after any\nfiles that occurred earlier in the command line.  The argument '--' is a\nmarker to denote the end of options.\n\nWith short options, options that do not take arguments may be\ncombined into a single command line argument with subsequent options,\noptions with mandatory arguments may be provided either as a single\ncommand line argument or as two arguments, and options with optional\narguments must be provided as a single argument.  In other words, 'm4\n-QPDfoo -d a -df' is equivalent to 'm4 -Q -P -D foo -d -df -- ./a',\nalthough the latter form is considered canonical.\n\nWith long options, options with mandatory arguments may be provided\nwith an equal sign ('=') in a single argument, or as two arguments, and\noptions with optional arguments must be provided as a single argument.",
            "subsections": []
        },
        "In other words, 'm4 --def foo --debug a' is equivalent to 'm4": {
            "content": "--define=foo --debug= -- ./a', although the latter form is considered\ncanonical (not to mention more robust, in case a future version of 'm4'\nintroduces an option named '--default').\n\n'm4' understands the following options, grouped by functionality.\n\n* Menu:\n\n* Operation modes::             Command line options for operation modes\n* Preprocessor features::       Command line options for preprocessor features\n* Limits control::              Command line options for limits control\n* Frozen state::                Command line options for frozen state\n* Debugging options::           Command line options for debugging\n* Command line files::          Specifying input files on the command line\n",
            "subsections": []
        },
        "File: m4.info,  Node: Operation modes,  Next: Preprocessor features,  Up: Invoking m4": {
            "content": "",
            "subsections": [
                {
                    "name": "2.1 Command line options for operation modes",
                    "content": "Several options control the overall operation of 'm4':\n\n'--help'\nPrint a help summary on standard output, then immediately exit 'm4'\nwithout reading any input files or performing any other actions.\n\n'--version'\nPrint the version number of the program on standard output, then\nimmediately exit 'm4' without reading any input files or performing\nany other actions.\n\n'-E'\n'--fatal-warnings'\nControls the effect of warnings.  If unspecified, then execution\ncontinues and exit status is unaffected when a warning is printed.\nIf specified exactly once, warnings become fatal; when one is\nissued, execution continues, but the exit status will be non-zero.\nIf specified multiple times, then execution halts with non-zero\nstatus the first time a warning is issued.  The introduction of\nbehavior levels is new to M4 1.4.9; for behavior consistent with\nearlier versions, you should specify '-E' twice.\n\n'-i'\n'--interactive'\n'-e'\nMakes this invocation of 'm4' interactive.  This means that all\noutput will be unbuffered, and interrupts will be ignored.  The\nspelling '-e' exists for compatibility with other 'm4'\nimplementations, and issues a warning because it may be withdrawn\nin a future version of GNU M4.\n\n'-P'\n'--prefix-builtins'\nInternally modify all builtin macro names so they all start with\nthe prefix 'm4'.  For example, using this option, one should write\n'm4define' instead of 'define', and 'm4file' instead of\n'file'.  This option has no effect if '-R' is also specified.\n\n'-Q'\n'--quiet'\n'--silent'\nSuppress warnings, such as missing or superfluous arguments in\nmacro calls, or treating the empty string as zero.\n\n'--warn-macro-sequence[=REGEXP]'\nIssue a warning if the regular expression REGEXP has a non-empty\nmatch in any macro definition (either by 'define' or 'pushdef').\nEmpty matches are ignored; therefore, supplying the empty string as\nREGEXP disables any warning.  If the optional REGEXP is not\nsupplied, then the default regular expression is\n'\\$\\({[^}]*}\\|[0-9][0-9]+\\)' (a literal '$' followed by multiple\ndigits or by an open brace), since these sequences will change\nsemantics in the default operation of GNU M4 2.0 (due to a change\nin how more than 9 arguments in a macro definition will be handled,\n*note Arguments::).  Providing an alternate regular expression can\nprovide a useful reverse lookup feature of finding where a macro is\ndefined to have a given definition.\n\n'-W REGEXP'\n'--word-regexp=REGEXP'\nUse REGEXP as an alternative syntax for macro names.  This\nexperimental option will not be present in all GNU 'm4'\nimplementations (*note Changeword::).\n"
                }
            ]
        },
        "File: m4.info,  Node: Preprocessor features,  Next: Limits control,  Prev: Operation modes,  Up: Invoking m4": {
            "content": "",
            "subsections": [
                {
                    "name": "2.2 Command line options for preprocessor features",
                    "content": ""
                }
            ]
        },
        "Several options allow 'm4' to behave more like a preprocessor.  Macro": {
            "content": "definitions and deletions can be made on the command line, the search\npath can be altered, and the output file can track where the input came\nfrom.  These features occur with the following options:\n\n'-D NAME[=VALUE]'\n'--define=NAME[=VALUE]'\nThis enters NAME into the symbol table.  If '=VALUE' is missing,\nthe value is taken to be the empty string.  The VALUE can be any\nstring, and the macro can be defined to take arguments, just as if\nit was defined from within the input.  This option may be given\nmore than once; order with respect to file names is significant,\nand redefining the same NAME loses the previous value.\n\n'-I DIRECTORY'\n'--include=DIRECTORY'\nMake 'm4' search DIRECTORY for included files that are not found in\nthe current working directory.  *Note Search Path::, for more\ndetails.  This option may be given more than once.\n\n'-s'\n'--synclines'\nGenerate synchronization lines, for use by the C preprocessor or\nother similar tools.  Order is significant with respect to file\nnames.  This option is useful, for example, when 'm4' is used as a\nfront end to a compiler.  Source file name and line number\ninformation is conveyed by directives of the form '#line LINENUM\n\"FILE\"', which are inserted as needed into the middle of the\noutput.  Such directives mean that the following line originated or\nwas expanded from the contents of input file FILE at line LINENUM.\nThe '\"FILE\"' part is often omitted when the file name did not\nchange from the previous directive.\n\nSynchronization directives are always given on complete lines by\nthemselves.  When a synchronization discrepancy occurs in the\nmiddle of an output line, the associated synchronization directive\nis delayed until the next newline that does not occur in the middle\nof a quoted string or comment.\n\ndefine(`twoline', `1\n2')\n=>#line 2 \"stdin\"\n=>\nchangecom(`/*', `*/')\n=>\ndefine(`comment', `/*1\n2*/')\n=>#line 5\n=>\ndnl no line\nhello\n=>#line 7\n=>hello\ntwoline\n=>1\n=>#line 8\n=>2\ncomment\n=>/*1\n=>2*/\none comment `two\nthree'\n=>#line 10\n=>one /*1\n=>2*/ two\n=>three\ngoodbye\n=>#line 12\n=>goodbye\n\n'-U NAME'\n'--undefine=NAME'\nThis deletes any predefined meaning NAME might have.  Obviously,\nonly predefined macros can be deleted in this way.  This option may\nbe given more than once; undefining a NAME that does not have a\ndefinition is silently ignored.  Order is significant with respect\nto file names.\n",
            "subsections": []
        },
        "File: m4.info,  Node: Limits control,  Next: Frozen state,  Prev: Preprocessor features,  Up: Invoking m4": {
            "content": "",
            "subsections": [
                {
                    "name": "2.3 Command line options for limits control",
                    "content": ""
                }
            ]
        },
        "There are some limits within 'm4' that can be tuned.  For compatibility,": {
            "content": "'m4' also accepts some options that control limits in other\nimplementations, but which are automatically unbounded (limited only by\nyour hardware and operating system constraints) in GNU 'm4'.\n\n'-g'\n'--gnu'\nEnable all the extensions in this implementation.  In this release\nof M4, this option is always on by default; it is currently only\nuseful when overriding a prior use of '--traditional'.  However,\nhaving GNU behavior as default makes it impossible to write a\nstrictly POSIX-compliant client that avoids all incompatible GNU M4\nextensions, since such a client would have to use the non-POSIX\ncommand-line option to force full POSIX behavior.  Thus, a future\nversion of M4 will be changed to implicitly use the option\n'--traditional' if the environment variable 'POSIXLYCORRECT' is\nset.  Projects that intentionally use GNU extensions should\nconsider using '--gnu' to state their intentions, so that the\nproject will not mysteriously break if the user upgrades to a newer\nM4 and has 'POSIXLYCORRECT' set in their environment.\n\n'-G'\n'--traditional'\nSuppress all the extensions made in this implementation, compared\nto the System V version.  *Note Compatibility::, for a list of\nthese.\n\n'-H NUM'\n'--hashsize=NUM'\nMake the internal hash table for symbol lookup be NUM entries big.\nFor better performance, the number should be prime, but this is not\nchecked.  The default is 65537 entries.  It should not be necessary\nto increase this value, unless you define an excessive number of\nmacros.\n\n'-L NUM'\n'--nesting-limit=NUM'\nArtificially limit the nesting of macro calls to NUM levels,\nstopping program execution if this limit is ever exceeded.  When\nnot specified, nesting defaults to unlimited on platforms that can\ndetect stack overflow, and to 1024 levels otherwise.  A value of\nzero means unlimited; but then heavily nested code could\npotentially cause a stack overflow.\n\nThe precise effect of this option is more correctly associated with\ntextual nesting than dynamic recursion.  It has been useful when\nsome complex 'm4' input was generated by mechanical means, and also\nin diagnosing recursive algorithms that do not scale well.  Most\nusers never need to change this option from its default.\n\nThis option does not have the ability to break endless rescanning\nloops, since these do not necessarily consume much memory or stack\nspace.  Through clever usage of rescanning loops, one can request\ncomplex, time-consuming computations from 'm4' with useful results.\nPutting limitations in this area would break 'm4' power.  There are\nmany pathological cases: 'define(`a', `a')a' is only the simplest\nexample (but *note Compatibility::).  Expecting GNU 'm4' to detect\nthese would be a little like expecting a compiler system to detect\nand diagnose endless loops: it is a quite hard problem in\ngeneral, if not undecidable!\n\n'-B NUM'\n'-S NUM'\n'-T NUM'\nThese options are present for compatibility with System V 'm4', but\ndo nothing in this implementation.  They may disappear in future\nreleases, and issue a warning to that effect.\n\n'-N NUM'\n'--diversions=NUM'\nThese options are present only for compatibility with previous\nversions of GNU 'm4', and were controlling the number of possible\ndiversions which could be used at the same time.  They do nothing,\nbecause there is no fixed limit anymore.  They may disappear in\nfuture releases, and issue a warning to that effect.\n",
            "subsections": []
        },
        "File: m4.info,  Node: Frozen state,  Next: Debugging options,  Prev: Limits control,  Up: Invoking m4": {
            "content": "",
            "subsections": [
                {
                    "name": "2.4 Command line options for frozen state",
                    "content": "GNU 'm4' comes with a feature of freezing internal state (*note Frozen\nfiles::).  This can be used to speed up 'm4' execution when reusing a\ncommon initialization script.\n\n'-F FILE'\n'--freeze-state=FILE'\nOnce execution is finished, write out the frozen state on the\nspecified FILE.  It is conventional, but not required, for FILE to\nend in '.m4f'.\n\n'-R FILE'\n'--reload-state=FILE'\nBefore execution starts, recover the internal state from the\nspecified frozen FILE.  The options '-D', '-U', and '-t' take\neffect after state is reloaded, but before the input files are\nread.\n"
                }
            ]
        },
        "File: m4.info,  Node: Debugging options,  Next: Command line files,  Prev: Frozen state,  Up: Invoking m4": {
            "content": "",
            "subsections": [
                {
                    "name": "2.5 Command line options for debugging",
                    "content": "Finally, there are several options for aiding in debugging 'm4' scripts.\n\n'-d[FLAGS]'\n'--debug[=FLAGS]'\nSet the debug-level according to the flags FLAGS.  The debug-level\ncontrols the format and amount of information presented by the\ndebugging functions.  *Note Debug Levels::, for more details on the\nformat and meaning of FLAGS.  If omitted, FLAGS defaults to 'aeq'.\n\n'--debugfile[=FILE]'\n'-o FILE'\n'--error-output=FILE'\nRedirect 'dumpdef' output, debug messages, and trace output to the\nnamed FILE.  Warnings, error messages, and 'errprint' output are\nstill printed to standard error.  If these options are not used, or\nif FILE is unspecified (only possible for '--debugfile'), debug\noutput goes to standard error; if FILE is the empty string, debug\noutput is discarded.  *Note Debug Output::, for more details.  The\noption '--debugfile' may be given more than once, and order is\nsignificant with respect to file names.  The spellings '-o' and\n'--error-output' are misleading and inconsistent with other GNU\ntools; for now they are silently accepted as synonyms of\n'--debugfile' and only recognized once, but in a future version of\nM4, using them will cause a warning to be issued.\n\n'-l NUM'\n'--arglength=NUM'\nRestrict the size of the output generated by macro tracing to NUM\ncharacters per trace line.  If unspecified or zero, output is\nunlimited.  *Note Debug Levels::, for more details.\n\n'-t NAME'\n'--trace=NAME'\nThis enables tracing for the macro NAME, at any point where it is\ndefined.  NAME need not be defined when this option is given.  This\noption may be given more than once, and order is significant with\nrespect to file names.  *Note Trace::, for more details.\n"
                }
            ]
        },
        "File: m4.info,  Node: Command line files,  Prev: Debugging options,  Up: Invoking m4": {
            "content": "",
            "subsections": [
                {
                    "name": "2.6 Specifying input files on the command line",
                    "content": ""
                }
            ]
        },
        "The remaining arguments on the command line are taken to be input file": {
            "content": "names.  If no names are present, standard input is read.  A file name of\n'-' is taken to mean standard input.  It is conventional, but not\nrequired, for input files to end in '.m4'.\n\nThe input files are read in the sequence given.  Standard input can\nbe read more than once, so the file name '-' may appear multiple times\non the command line; this makes a difference when input is from a\nterminal or other special file type.  It is an error if an input file\nends in the middle of argument collection, a comment, or a quoted\nstring.\n\nThe options '--define' ('-D'), '--undefine' ('-U'), '--synclines'\n('-s'), and '--trace' ('-t') only take effect after processing input\nfrom any file names that occur earlier on the command line.  For\nexample, assume the file 'foo' contains:\n\n$ cat foo\nbar\n\nThe text 'bar' can then be redefined over multiple uses of 'foo':\n\n$ m4 -Dbar=hello foo -Dbar=world foo\n=>hello\n=>world\n\nIf none of the input files invoked 'm4exit' (*note M4exit::), the\nexit status of 'm4' will be 0 for success, 1 for general failure (such\nas problems with reading an input file), and 63 for version mismatch\n(*note Using frozen files::).\n\nIf you need to read a file whose name starts with a '-', you can\nspecify it as './-file', or use '--' to mark the end of options.\n",
            "subsections": []
        },
        "File: m4.info,  Node: Syntax,  Next: Macros,  Prev: Invoking m4,  Up: Top": {
            "content": "",
            "subsections": []
        },
        "3 Lexical and syntactic conventions": {
            "content": "As 'm4' reads its input, it separates it into \"tokens\".  A token is\neither a name, a quoted string, or any single character, that is not a\npart of either a name or a string.  Input to 'm4' can also contain\ncomments.  GNU 'm4' does not yet understand multibyte locales; all\noperations are byte-oriented rather than character-oriented (although if\nyour locale uses a single byte encoding, such as ISO-8859-1, you will\nnot notice a difference).  However, 'm4' is eight-bit clean, so you can\nuse non-ASCII characters in quoted strings (*note Changequote::),\ncomments (*note Changecom::), and macro names (*note Indir::), with the\nexception of the NUL character (the zero byte ''\\0'').\n\n* Menu:\n\n* Names::                       Macro names\n* Quoted strings::              Quoting input to 'm4'\n* Comments::                    Comments in 'm4' input\n* Other tokens::                Other kinds of input tokens\n* Input processing::            How 'm4' copies input to output\n",
            "subsections": []
        },
        "File: m4.info,  Node: Names,  Next: Quoted strings,  Up: Syntax": {
            "content": "",
            "subsections": [
                {
                    "name": "3.1 Macro names",
                    "content": "A name is any sequence of letters, digits, and the character ''\n(underscore), where the first character is not a digit.  'm4' will use\nthe longest such sequence found in the input.  If a name has a macro\ndefinition, it will be subject to macro expansion (*note Macros::).\nNames are case-sensitive.\n\nExamples of legal names are: 'foo', 'tmp', and 'name01'.\n"
                }
            ]
        },
        "File: m4.info,  Node: Quoted strings,  Next: Comments,  Prev: Names,  Up: Syntax": {
            "content": "",
            "subsections": [
                {
                    "name": "3.2 Quoting input to 'm4'",
                    "content": "A quoted string is a sequence of characters surrounded by quote strings,\ndefaulting to '`' and ''', where the nested begin and end quotes within\nthe string are balanced.  The value of a string token is the text, with\none level of quotes stripped off.  Thus\n\n`'\n=>\n\nis the empty string, and double-quoting turns into single-quoting.\n\n``quoted''\n=>`quoted'\n\nThe quote characters can be changed at any time, using the builtin\nmacro 'changequote'.  *Note Changequote::, for more information.\n"
                }
            ]
        },
        "File: m4.info,  Node: Comments,  Next: Other tokens,  Prev: Quoted strings,  Up: Syntax": {
            "content": "",
            "subsections": [
                {
                    "name": "3.3 Comments in 'm4' input",
                    "content": "Comments in 'm4' are normally delimited by the characters '#' and\nnewline.  All characters between the comment delimiters are ignored, but\nthe entire comment (including the delimiters) is passed through to the\noutput--comments are not discarded by 'm4'.\n\nComments cannot be nested, so the first newline after a '#' ends the\ncomment.  The commenting effect of the begin-comment string can be\ninhibited by quoting it.\n\n$ m4\n`quoted text' # `commented text'\n=>quoted text # `commented text'\n`quoting inhibits' `#' `comments'\n=>quoting inhibits # comments\n\nThe comment delimiters can be changed to any string at any time,\nusing the builtin macro 'changecom'.  *Note Changecom::, for more\ninformation.\n"
                }
            ]
        },
        "File: m4.info,  Node: Other tokens,  Next: Input processing,  Prev: Comments,  Up: Syntax": {
            "content": "",
            "subsections": [
                {
                    "name": "3.4 Other kinds of input tokens",
                    "content": ""
                }
            ]
        },
        "Any character, that is neither a part of a name, nor of a quoted string,": {
            "content": "nor a comment, is a token by itself.  When not in the context of macro\nexpansion, all of these tokens are just copied to output.  However,\nduring macro expansion, whitespace characters (space, tab, newline,\nformfeed, carriage return, vertical tab), parentheses ('(' and ')'),\ncomma (','), and dollar ('$') have additional roles, explained later.\n",
            "subsections": []
        },
        "File: m4.info,  Node: Input processing,  Prev: Other tokens,  Up: Syntax": {
            "content": "",
            "subsections": [
                {
                    "name": "3.5 How 'm4' copies input to output",
                    "content": ""
                }
            ]
        },
        "As 'm4' reads the input token by token, it will copy each token directly": {
            "content": "to the output immediately.\n\nThe exception is when it finds a word with a macro definition.  In\nthat case 'm4' will calculate the macro's expansion, possibly reading\nmore input to get the arguments.  It then inserts the expansion in front\nof the remaining input.  In other words, the resulting text from a macro\ncall will be read and parsed into tokens again.\n\n'm4' expands a macro as soon as possible.  If it finds a macro call\nwhen collecting the arguments to another, it will expand the second call\nfirst.  This process continues until there are no more macro calls to\nexpand and all the input has been consumed.\n\nFor a running example, examine how 'm4' handles this input:\n\nformat(`Result is %d', eval(`215'))\n",
            "subsections": []
        },
        "First, 'm4' sees that the token 'format' is a macro name, so it collects": {
            "content": "the tokens '(', '`Result is %d'', ',', and ' ', before encountering\nanother potential macro.  Sure enough, 'eval' is a macro name, so the\nnested argument collection picks up '(', '`215'', and ')', invoking\nthe eval macro with the lone argument of '215'.  The expansion of\n'eval(215)' is '32768', which is then rescanned as the five tokens\n'3', '2', '7', '6', and '8'; and combined with the next ')', the format\nmacro now has all its arguments, as if the user had typed:\n\nformat(`Result is %d', 32768)\n",
            "subsections": []
        },
        "The format macro expands to 'Result is 32768', and we have another round": {
            "content": "of scanning for the tokens 'Result', ' ', 'is', ' ', '3', '2', '7', '6',\nand '8'.  None of these are macros, so the final output is\n\n=>Result is 32768\n\nAs a more complicated example, we will contrast an actual code\nexample from the Gnulib project(1), showing both a buggy approach and\nthe desired results.  The user desires to output a shell assignment\nstatement that takes its argument and turns it into a shell variable by\nconverting it to uppercase and prepending a prefix.  The original\nattempt looks like this:\n\nchangequote([,])dnl\ndefine([glSTRINGMODULEINDICATOR],\n[\ndnl comment\nGNULIB]translit([$1],[a-z],[A-Z])[=1\n])dnl\nglSTRINGMODULEINDICATOR([strcase])\n=>\n=>        GNULIBstrcase=1\n=>\n\nOops - the argument did not get capitalized.  And although the manual\nis not able to easily show it, both lines that appear empty actually\ncontain two trailing spaces.  By stepping through the parse, it is easy\nto see what happened.  First, 'm4' sees the token 'changequote', which\nit recognizes as a macro, followed by '(', '[', ',', ']', and ')' to\nform the argument list.  The macro expands to the empty string, but\nchanges the quoting characters to something more useful for generating\nshell code (unbalanced '`' and ''' appear all the time in shell scripts,\nbut unbalanced '[]' tend to be rare).  Also in the first line, 'm4' sees\nthe token 'dnl', which it recognizes as a builtin macro that consumes\nthe rest of the line, resulting in no output for that line.\n\nThe second line starts a macro definition.  'm4' sees the token\n'define', which it recognizes as a macro, followed by a '(',\n'[glSTRINGMODULEINDICATOR]', and ','.  Because an unquoted comma was\nencountered, the first argument is known to be the expansion of the\nsingle-quoted string token, or 'glSTRINGMODULEINDICATOR'.  Next, 'm4'\nsees '<NL>', ' ', and ' ', but this whitespace is discarded as part of\nargument collection.  Then comes a rather lengthy single-quoted string\ntoken, '[<NL>    dnl comment<NL>    GNULIB]'.  This is followed by the\ntoken 'translit', which 'm4' recognizes as a macro name, so a nested\nmacro expansion has started.\n\nThe arguments to the 'translit' are found by the tokens '(', '[$1]',\n',', '[a-z]', ',', '[A-Z]', and finally ')'.  All three string arguments\nare expanded (or in other words, the quotes are stripped), and since\nneither '$' nor '1' need capitalization, the result of the macro is\n'$1'.  This expansion is rescanned, resulting in the two literal\ncharacters '$' and '1'.\n\nScanning of the outer macro resumes, and picks up with '[=1<NL>  ]',\nand finally ')'.  The collected pieces of expanded text are\nconcatenated, with the end result that the macro\n'glSTRINGMODULEINDICATOR' is now defined to be the sequence\n'<NL>    dnl comment<NL>    GNULIB$1=1<NL>  '.  Once again, 'dnl' is\nrecognized and avoids a newline in the output.\n\nThe final line is then parsed, beginning with ' ' and ' ' that are\noutput literally.  Then 'glSTRINGMODULEINDICATOR' is recognized as a\nmacro name, with an argument list of '(', '[strcase]', and ')'.  Since\nthe definition of the macro contains the sequence '$1', that sequence is\nreplaced with the argument 'strcase' prior to starting the rescan.  The\nrescan sees '<NL>' and four spaces, which are output literally, then\n'dnl', which discards the text ' comment<NL>'.  Next comes four more\nspaces, also output literally, and the token 'GNULIBstrcase', which\nresulted from the earlier parameter substitution.  Since that is not a\nmacro name, it is output literally, followed by the literal tokens '=',\n'1', '<NL>', and two more spaces.  Finally, the original '<NL>' seen\nafter the macro invocation is scanned and output literally.\n\nNow for a corrected approach.  This rearranges the use of newlines\nand whitespace so that less whitespace is output (which, although\nharmless to shell scripts, can be visually unappealing), and fixes the\nquoting issues so that the capitalization occurs when the macro\n'glSTRINGMODULEINDICATOR' is invoked, rather then when it is defined.",
            "subsections": []
        },
        "It also adds another layer of quoting to the first argument of": {
            "content": "'translit', to ensure that the output will be rescanned as a string\nrather than a potential uppercase macro name needing further expansion.\n\nchangequote([,])dnl\ndefine([glSTRINGMODULEINDICATOR],\n[dnl comment\nGNULIB[]translit([[$1]], [a-z], [A-Z])=1dnl\n])dnl\nglSTRINGMODULEINDICATOR([strcase])\n=>    GNULIBSTRCASE=1\n\nThe parsing of the first line is unchanged.  The second line sees the\nname of the macro to define, then sees the discarded '<NL>' and two\nspaces, as before.  But this time, the next token is '[dnl\ncomment<NL>  GNULIB[]translit([[$1]], [a-z], [A-Z])=1dnl<NL>]', which\nincludes nested quotes, followed by ')' to end the macro definition and\n'dnl' to skip the newline.  No early expansion of 'translit' occurs, so\nthe entire string becomes the definition of the macro.\n\nThe final line is then parsed, beginning with two spaces that are\noutput literally, and an invocation of 'glSTRINGMODULEINDICATOR' with\nthe argument 'strcase'.  Again, the '$1' in the macro definition is\nsubstituted prior to rescanning.  Rescanning first encounters 'dnl', and\ndiscards ' comment<NL>'.  Then two spaces are output literally.  Next\ncomes the token 'GNULIB', but that is not a macro, so it is output\nliterally.  The token '[]' is an empty string, so it does not affect\noutput.  Then the token 'translit' is encountered.\n\nThis time, the arguments to 'translit' are parsed as '(',\n'[[strcase]]', ',', ' ', '[a-z]', ',', ' ', '[A-Z]', and ')'.  The two\nspaces are discarded, and the translit results in the desired result\n'[STRCASE]'.  This is rescanned, but since it is a string, the quotes\nare stripped and the only output is a literal 'STRCASE'.  Then the\nscanner sees '=' and '1', which are output literally, followed by 'dnl'\nwhich discards the rest of the definition of\n'glSTRINGMODULEINDICATOR'.  The newline at the end of output is the\nliteral '<NL>' that appeared after the invocation of the macro.\n\nThe order in which 'm4' expands the macros can be further explored\nusing the trace facilities of GNU 'm4' (*note Trace::).\n\n---------- Footnotes ----------\n\n(1) Derived from a patch in\n<https://lists.gnu.org/archive/html/bug-gnulib/2007-01/msg00389.html>,\nand a followup patch in\n<https://lists.gnu.org/archive/html/bug-gnulib/2007-02/msg00000.html>\n",
            "subsections": []
        },
        "File: m4.info,  Node: Macros,  Next: Definitions,  Prev: Syntax,  Up: Top": {
            "content": "",
            "subsections": []
        },
        "4 How to invoke macros": {
            "content": "",
            "subsections": []
        },
        "This chapter covers macro invocation, macro arguments and how macro": {
            "content": "expansion is treated.\n\n* Menu:\n\n* Invocation::                  Macro invocation\n* Inhibiting Invocation::       Preventing macro invocation\n* Macro Arguments::             Macro arguments\n* Quoting Arguments::           On Quoting Arguments to macros\n* Macro expansion::             Expanding macros\n",
            "subsections": []
        },
        "File: m4.info,  Node: Invocation,  Next: Inhibiting Invocation,  Up: Macros": {
            "content": "",
            "subsections": [
                {
                    "name": "4.1 Macro invocation",
                    "content": ""
                }
            ]
        },
        "Macro invocations has one of the forms": {
            "content": "name\n\nwhich is a macro invocation without any arguments, or\n\nname(arg1, arg2, ..., argN)\n\nwhich is a macro invocation with N arguments.  Macros can have any\nnumber of arguments.  All arguments are strings, but different macros\nmight interpret the arguments in different ways.\n\nThe opening parenthesis must follow the NAME directly, with no\nspaces in between.  If it does not, the macro is called with no\narguments at all.\n\nFor a macro call to have no arguments, the parentheses must be left\nout.  The macro call\n\nname()\n\nis a macro call with one argument, which is the empty string, not a call\nwith no arguments.\n",
            "subsections": []
        },
        "File: m4.info,  Node: Inhibiting Invocation,  Next: Macro Arguments,  Prev: Invocation,  Up: Macros": {
            "content": "",
            "subsections": [
                {
                    "name": "4.2 Preventing macro invocation",
                    "content": ""
                }
            ]
        },
        "An innovation of the 'm4' language, compared to some of its predecessors": {
            "content": "(like Strachey's 'GPM', for example), is the ability to recognize macro\ncalls without resorting to any special, prefixed invocation character.",
            "subsections": []
        },
        "While generally useful, this feature might sometimes be the source of": {
            "content": "spurious, unwanted macro calls.  So, GNU 'm4' offers several mechanisms\nor techniques for inhibiting the recognition of names as macro calls.\n\nFirst of all, many builtin macros cannot meaningfully be called\nwithout arguments.  As a GNU extension, for any of these macros,\nwhenever an opening parenthesis does not immediately follow their name,\nthe builtin macro call is not triggered.  This solves the most usual\ncases, like for 'include' or 'eval'.  Later in this document, the\nsentence \"This macro is recognized only with parameters\" refers to this\nspecific provision of GNU M4, also known as a blind builtin macro.  For\nthe builtins defined by POSIX that bear this disclaimer, POSIX\nspecifically states that invoking those builtins without arguments is\nunspecified, because many other implementations simply invoke the\nbuiltin as though it were given one empty argument instead.\n\n$ m4\neval\n=>eval\neval(`1')\n=>1\n\nThere is also a command line option ('--prefix-builtins', or '-P',\n*note Invoking m4: Operation modes.) that renames all builtin macros\nwith a prefix of 'm4' at startup.  The option has no effect whatsoever\non user defined macros.  For example, with this option, one has to write\n'm4dnl' and even 'm4m4exit'.  It also has no effect on whether a macro\nrequires parameters.\n\n$ m4 -P\neval\n=>eval\neval(`1')\n=>eval(1)\nm4eval\n=>m4eval\nm4eval(`1')\n=>1\n\nAnother alternative is to redefine problematic macros to a name less\nlikely to cause conflicts, using *note Definitions::.\n\nIf your version of GNU 'm4' has the 'changeword' feature compiled in,\nit offers far more flexibility in specifying the syntax of macro names,\nboth builtin or user-defined.  *Note Changeword::, for more information\non this experimental feature.\n\nOf course, the simplest way to prevent a name from being interpreted\nas a call to an existing macro is to quote it.  The remainder of this\nsection studies a little more deeply how quoting affects macro\ninvocation, and how quoting can be used to inhibit macro invocation.\n\nEven if quoting is usually done over the whole macro name, it can\nalso be done over only a few characters of this name (provided, of\ncourse, that the unquoted portions are not also a macro).  It is also\npossible to quote the empty string, but this works only inside the\nname.  For example:\n\n`divert'\n=>divert\n`d'ivert\n=>divert\ndi`ver't\n=>divert\ndiv`'ert\n=>divert\n\nall yield the string 'divert'.  While in both:\n\n`'divert\n=>\ndivert`'\n=>\n\nthe 'divert' builtin macro will be called, which expands to the empty\nstring.\n\nThe output of macro evaluations is always rescanned.  In the\nfollowing example, the input 'x`'y' yields the string 'bCD', exactly as\nif 'm4' has been given 'substr(ab`'cde, `1', `3')' as input:\n\ndefine(`cde', `CDE')\n=>\ndefine(`x', `substr(ab')\n=>\ndefine(`y', `cde, `1', `3')')\n=>\nx`'y\n=>bCD\n\nUnquoted strings on either side of a quoted string are subject to\nbeing recognized as macro names.  In the following example, quoting the\nempty string allows for the second 'macro' to be recognized as such:\n\ndefine(`macro', `m')\n=>\nmacro(`m')macro\n=>mmacro\nmacro(`m')`'macro\n=>mm\n\nQuoting may prevent recognizing as a macro name the concatenation of\na macro expansion with the surrounding characters.  In this example:\n\ndefine(`macro', `di$1')\n=>\nmacro(`v')`ert'\n=>divert\nmacro(`v')ert\n=>\n\nthe input will produce the string 'divert'.  When the quotes were\nremoved, the 'divert' builtin was called instead.\n",
            "subsections": []
        },
        "File: m4.info,  Node: Macro Arguments,  Next: Quoting Arguments,  Prev: Inhibiting Invocation,  Up: Macros": {
            "content": "",
            "subsections": [
                {
                    "name": "4.3 Macro arguments",
                    "content": ""
                }
            ]
        },
        "When a name is seen, and it has a macro definition, it will be expanded": {
            "content": "as a macro.\n\nIf the name is followed by an opening parenthesis, the arguments will\nbe collected before the macro is called.  If too few arguments are\nsupplied, the missing arguments are taken to be the empty string.",
            "subsections": []
        },
        "However, some builtins are documented to behave differently for a": {
            "content": "missing optional argument than for an explicit empty string.  If there\nare too many arguments, the excess arguments are ignored.  Unquoted\nleading whitespace is stripped off all arguments, but whitespace\ngenerated by a macro expansion or occurring after a macro that expanded\nto an empty string remains intact.  Whitespace includes space, tab,\nnewline, carriage return, vertical tab, and formfeed.\n\ndefine(`macro', `$1')\n=>\nmacro( unquoted leading space lost)\n=>unquoted leading space lost\nmacro(` quoted leading space kept')\n=> quoted leading space kept\nmacro(\ndivert `unquoted space kept after expansion')\n=> unquoted space kept after expansion\nmacro(macro(`\n')`whitespace from expansion kept')\n=>\n=>whitespace from expansion kept\nmacro(`unquoted trailing whitespace kept'\n)\n=>unquoted trailing whitespace kept\n=>\n\nNormally 'm4' will issue warnings if a builtin macro is called with\nan inappropriate number of arguments, but it can be suppressed with the\n'--quiet' command line option (or '--silent', or '-Q', *note Invoking\nm4: Operation modes.).  For user defined macros, there is no check of\nthe number of arguments given.\n\n$ m4\nindex(`abc')\nerror->m4:stdin:1: Warning: too few arguments to builtin `index'\n=>0\nindex(`abc',)\n=>0\nindex(`abc', `b', `ignored')\nerror->m4:stdin:3: Warning: excess arguments to builtin `index' ignored\n=>1\n\n$ m4 -Q\nindex(`abc')\n=>0\nindex(`abc',)\n=>0\nindex(`abc', `b', `ignored')\n=>1\n\nMacros are expanded normally during argument collection, and whatever\ncommas, quotes and parentheses that might show up in the resulting\nexpanded text will serve to define the arguments as well.  Thus, if FOO\nexpands to ', b, c', the macro call\n\nbar(a foo, d)\n\nis a macro call with four arguments, which are 'a ', 'b', 'c' and 'd'.",
            "subsections": []
        },
        "To understand why the first argument contains whitespace, remember that": {
            "content": "unquoted leading whitespace is never part of an argument, but trailing\nwhitespace always is.\n\nIt is possible for a macro's definition to change during argument\ncollection, in which case the expansion uses the definition that was in\neffect at the time the opening '(' was seen.\n\ndefine(`f', `1')\n=>\nf(define(`f', `2'))\n=>1\nf\n=>2\n\nIt is an error if the end of file occurs while collecting arguments.\n\nhello world\n=>hello world\ndefine(\n^D\nerror->m4:stdin:2: ERROR: end of file in argument list\n",
            "subsections": []
        },
        "File: m4.info,  Node: Quoting Arguments,  Next: Macro expansion,  Prev: Macro Arguments,  Up: Macros": {
            "content": "",
            "subsections": [
                {
                    "name": "4.4 On Quoting Arguments to macros",
                    "content": ""
                }
            ]
        },
        "Each argument has unquoted leading whitespace removed.  Within each": {
            "content": "argument, all unquoted parentheses must match.  For example, if FOO is a\nmacro,\n\nfoo(() (`(') `(')\n\nis a macro call, with one argument, whose value is '() (() ('.  Commas\nseparate arguments, except when they occur inside quotes, comments, or\nunquoted parentheses.  *Note Pseudo Arguments::, for examples.\n\nIt is common practice to quote all arguments to macros, unless you\nare sure you want the arguments expanded.  Thus, in the above example\nwith the parentheses, the 'right' way to do it is like this:\n\nfoo(`() (() (')\n\nIt is, however, in certain cases necessary (because nested expansion\nmust occur to create the arguments for the outer macro) or convenient\n(because it uses fewer characters) to leave out quotes for some\narguments, and there is nothing wrong in doing it.  It just makes life a\nbit harder, if you are not careful to follow a consistent quoting style.",
            "subsections": []
        },
        "For consistency, this manual follows the rule of thumb that each layer": {
            "content": "of parentheses introduces another layer of single quoting, except when\nshowing the consequences of quoting rules.  This is done even when the\nquoted string cannot be a macro, such as with integers when you have not\nchanged the syntax via 'changeword' (*note Changeword::).\n\nThe quoting rule of thumb of one level of quoting per parentheses has\na nice property: when a macro name appears inside parentheses, you can\ndetermine when it will be expanded.  If it is not quoted, it will be\nexpanded prior to the outer macro, so that its expansion becomes the\nargument.  If it is single-quoted, it will be expanded after the outer\nmacro.  And if it is double-quoted, it will be used as literal text\ninstead of a macro name.\n\ndefine(`active', `ACT, IVE')\n=>\ndefine(`show', `$1 $1')\n=>\nshow(active)\n=>ACT ACT\nshow(`active')\n=>ACT, IVE ACT, IVE\nshow(``active'')\n=>active active\n",
            "subsections": []
        },
        "File: m4.info,  Node: Macro expansion,  Prev: Quoting Arguments,  Up: Macros": {
            "content": "",
            "subsections": [
                {
                    "name": "4.5 Macro expansion",
                    "content": ""
                }
            ]
        },
        "When the arguments, if any, to a macro call have been collected, the": {
            "content": "macro is expanded, and the expansion text is pushed back onto the input\n(unquoted), and reread.  The expansion text from one macro call might\ntherefore result in more macros being called, if the calls are included,\ncompletely or partially, in the first macro calls' expansion.\n\nTaking a very simple example, if FOO expands to 'bar', and BAR\nexpands to 'Hello', the input\n\n$ m4 -Dbar=Hello -Dfoo=bar\nfoo\n=>Hello\n\nwill expand first to 'bar', and when this is reread and expanded, into\n'Hello'.\n",
            "subsections": []
        },
        "File: m4.info,  Node: Definitions,  Next: Conditionals,  Prev: Macros,  Up: Top": {
            "content": "",
            "subsections": []
        },
        "5 How to define new macros": {
            "content": "Macros can be defined, redefined and deleted in several different ways.",
            "subsections": []
        },
        "Also, it is possible to redefine a macro without losing a previous": {
            "content": "value, and bring back the original value at a later time.\n\n* Menu:\n\n* Define::                      Defining a new macro\n* Arguments::                   Arguments to macros\n* Pseudo Arguments::            Special arguments to macros\n* Undefine::                    Deleting a macro\n* Defn::                        Renaming macros\n* Pushdef::                     Temporarily redefining macros\n\n* Indir::                       Indirect call of macros\n* Builtin::                     Indirect call of builtins\n",
            "subsections": []
        },
        "File: m4.info,  Node: Define,  Next: Arguments,  Up: Definitions": {
            "content": "",
            "subsections": [
                {
                    "name": "5.1 Defining a macro",
                    "content": ""
                }
            ]
        },
        "The normal way to define or redefine macros is to use the builtin": {
            "content": "'define':\n\n-- Builtin: define (NAME, [EXPANSION])\nDefines NAME to expand to EXPANSION.  If EXPANSION is not given, it\nis taken to be empty.\n\nThe expansion of 'define' is void.  The macro 'define' is\nrecognized only with parameters.\n\nThe following example defines the macro FOO to expand to the text\n'Hello World.'.\n\ndefine(`foo', `Hello world.')\n=>\nfoo\n=>Hello world.\n\nThe empty line in the output is there because the newline is not a\npart of the macro definition, and it is consequently copied to the\noutput.  This can be avoided by use of the macro 'dnl'.  *Note Dnl::,\nfor details.\n\nThe first argument to 'define' should be quoted; otherwise, if the\nmacro is already defined, you will be defining a different macro.  This\nexample shows the problems with underquoting, since we did not want to\nredefine 'one':\n\ndefine(foo, one)\n=>\ndefine(foo, two)\n=>\none\n=>two\n\nGNU 'm4' normally replaces only the topmost definition of a macro\nif it has several definitions from 'pushdef' (*note Pushdef::).  Some\nother implementations of 'm4' replace all definitions of a macro with\n'define'.  *Note Incompatibilities::, for more details.\n\nAs a GNU extension, the first argument to 'define' does not have to\nbe a simple word.  It can be any text string, even the empty string.  A\nmacro with a non-standard name cannot be invoked in the normal way, as\nthe name is not recognized.  It can only be referenced by the builtins\n'indir' (*note Indir::) and 'defn' (*note Defn::).\n\nArrays and associative arrays can be simulated by using non-standard\nmacro names.\n\n-- Composite: array (INDEX)\n-- Composite: arrayset (INDEX, [VALUE])\nProvide access to entries within an array.  'array' reads the entry\nat location INDEX, and 'arrayset' assigns VALUE to location INDEX.\n\ndefine(`array', `defn(format(``array[%d]'', `$1'))')\n=>\ndefine(`arrayset', `define(format(``array[%d]'', `$1'), `$2')')\n=>\narrayset(`4', `array element no. 4')\n=>\narrayset(`17', `array element no. 17')\n=>\narray(`4')\n=>array element no. 4\narray(eval(`10 + 7'))\n=>array element no. 17\n\nChange the '%d' to '%s' and it is an associative array.\n",
            "subsections": []
        },
        "File: m4.info,  Node: Arguments,  Next: Pseudo Arguments,  Prev: Define,  Up: Definitions": {
            "content": "",
            "subsections": [
                {
                    "name": "5.2 Arguments to macros",
                    "content": "Macros can have arguments.  The Nth argument is denoted by '$n' in the\nexpansion text, and is replaced by the Nth actual argument, when the\nmacro is expanded.  Replacement of arguments happens before rescanning,\nregardless of how many nesting levels of quoting appear in the\nexpansion.  Here is an example of a macro with two arguments.\n\n-- Composite: exch (ARG1, ARG2)\nExpands to ARG2 followed by ARG1, effectively exchanging their\norder.\n\ndefine(`exch', `$2, $1')\n=>\nexch(`arg1', `arg2')\n=>arg2, arg1\n\nThis can be used, for example, if you like the arguments to 'define'\nto be reversed.\n\ndefine(`exch', `$2, $1')\n=>\ndefine(exch(``expansion text'', ``macro''))\n=>\nmacro\n=>expansion text\n\n*Note Quoting Arguments::, for an explanation of the double quotes.\n(You should try and improve this example so that clients of 'exch' do\nnot have to double quote; or *note Answers: Improved exch.).\n\nAs a special case, the zeroth argument, '$0', is always the name of\nthe macro being expanded.\n\ndefine(`test', ``Macro name: $0'')\n=>\ntest\n=>Macro name: test\n\nIf you want quoted text to appear as part of the expansion text,\nremember that quotes can be nested in quoted strings.  Thus, in\n\ndefine(`foo', `This is macro `foo'.')\n=>\nfoo\n=>This is macro foo.\n"
                }
            ]
        },
        "The 'foo' in the expansion text is not expanded, since it is a quoted": {
            "content": "string, and not a name.\n\nGNU 'm4' allows the number following the '$' to consist of one or\nmore digits, allowing macros to have any number of arguments.  The\nextension of accepting multiple digits is incompatible with POSIX, and\nis different than traditional implementations of 'm4', which only\nrecognize one digit.  Therefore, future versions of GNU M4 will phase\nout this feature.  To portably access beyond the ninth argument, you can\nuse the 'argn' macro documented later (*note Shift::).\n\nPOSIX also states that '$' followed immediately by '{' in a macro\ndefinition is implementation-defined.  This version of M4 passes the\nliteral characters '${' through unchanged, but M4 2.0 will implement an\noptional feature similar to 'sh', where '${11}' expands to the eleventh\nargument, to replace the current recognition of '$11'.  Meanwhile, if\nyou want to guarantee that you will get a literal '${' in output when\nexpanding a macro, even when you upgrade to M4 2.0, you can use nested\nquoting to your advantage:\n\ndefine(`foo', `single quoted $`'{1} output')\n=>\ndefine(`bar', ``double quoted $'`{2} output'')\n=>\nfoo(`a', `b')\n=>single quoted ${1} output\nbar(`a', `b')\n=>double quoted ${2} output\n\nTo help you detect places in your M4 input files that might change in\nbehavior due to the changed behavior of M4 2.0, you can use the\n'--warn-macro-sequence' command-line option (*note Invoking m4:",
            "subsections": []
        },
        "Operation modes.) with the default regular expression.  This will add a": {
            "content": "warning any time a macro definition includes '$' followed by multiple\ndigits, or by '{'.  The warning is not enabled by default, because it\ntriggers a number of warnings in Autoconf 2.61 (and Autoconf uses '-E'\nto treat warnings as errors), and because it will still be possible to\nrestore older behavior in M4 2.0.\n\n$ m4 --warn-macro-sequence\ndefine(`foo', `$001 ${1} $1')\nerror->m4:stdin:1: Warning: definition of `foo' contains sequence `$001'\nerror->m4:stdin:1: Warning: definition of `foo' contains sequence `${1}'\n=>\nfoo(`bar')\n=>bar ${1} bar\n",
            "subsections": []
        },
        "File: m4.info,  Node: Pseudo Arguments,  Next: Undefine,  Prev: Arguments,  Up: Definitions": {
            "content": "",
            "subsections": [
                {
                    "name": "5.3 Special arguments to macros",
                    "content": ""
                }
            ]
        },
        "There is a special notation for the number of actual arguments supplied,": {
            "content": "and for all the actual arguments.\n\nThe number of actual arguments in a macro call is denoted by '$#' in\nthe expansion text.\n\n-- Composite: nargs (...)\nExpands to a count of the number of arguments supplied.\n\ndefine(`nargs', `$#')\n=>\nnargs\n=>0\nnargs()\n=>1\nnargs(`arg1', `arg2', `arg3')\n=>3\nnargs(`commas can be quoted, like this')\n=>1\nnargs(arg1#inside comments, commas do not separate arguments\nstill arg1)\n=>1\nnargs((unquoted parentheses, like this, group arguments))\n=>1\n\nRemember that '#' defaults to the comment character; if you forget\nquotes to inhibit the comment behavior, your macro definition may not\nend where you expected.\n\ndnl Attempt to define a macro to just `$#'\ndefine(underquoted, $#)\noops)\n=>\nunderquoted\n=>0)\n=>oops\n\nThe notation '$*' can be used in the expansion text to denote all the\nactual arguments, unquoted, with commas in between.  For example\n\ndefine(`echo', `$*')\n=>\necho(arg1,    arg2, arg3 , arg4)\n=>arg1,arg2,arg3 ,arg4\n\nOften each argument should be quoted, and the notation '$@' handles\nthat.  It is just like '$*', except that it quotes each argument.  A\nsimple example of that is:\n\ndefine(`echo', `$@')\n=>\necho(arg1,    arg2, arg3 , arg4)\n=>arg1,arg2,arg3 ,arg4\n\nWhere did the quotes go?  Of course, they were eaten, when the\nexpanded text were reread by 'm4'.  To show the difference, try\n\ndefine(`echo1', `$*')\n=>\ndefine(`echo2', `$@')\n=>\ndefine(`foo', `This is macro `foo'.')\n=>\necho1(foo)\n=>This is macro This is macro foo..\necho1(`foo')\n=>This is macro foo.\necho2(foo)\n=>This is macro foo.\necho2(`foo')\n=>foo\n\n*Note Trace::, if you do not understand this.  As another example of the\ndifference, remember that comments encountered in arguments are passed\nuntouched to the macro, and that quoting disables comments.\n\ndefine(`echo1', `$*')\n=>\ndefine(`echo2', `$@')\n=>\ndefine(`foo', `bar')\n=>\necho1(#foo'foo\nfoo)\n=>#foo'foo\n=>bar\necho2(#foo'foo\nfoo)\n=>#foobar\n=>bar'\n\nA '$' sign in the expansion text, that is not followed by anything\n'm4' understands, is simply copied to the macro expansion, as any other\ntext is.\n\ndefine(`foo', `$$$ hello $$$')\n=>\nfoo\n=>$$$ hello $$$\n\nIf you want a macro to expand to something like '$12', the judicious\nuse of nested quoting can put a safe character between the '$' and the\nnext character, relying on the rescanning to remove the nested quote.\nThis will prevent 'm4' from interpreting the '$' sign as a reference to\nan argument.\n\ndefine(`foo', `no nested quote: $1')\n=>\nfoo(`arg')\n=>no nested quote: arg\ndefine(`foo', `nested quote around $: `$'1')\n=>\nfoo(`arg')\n=>nested quote around $: $1\ndefine(`foo', `nested empty quote after $: $`'1')\n=>\nfoo(`arg')\n=>nested empty quote after $: $1\ndefine(`foo', `nested quote around next character: $`1'')\n=>\nfoo(`arg')\n=>nested quote around next character: $1\ndefine(`foo', `nested quote around both: `$1'')\n=>\nfoo(`arg')\n=>nested quote around both: arg\n",
            "subsections": []
        },
        "File: m4.info,  Node: Undefine,  Next: Defn,  Prev: Pseudo Arguments,  Up: Definitions": {
            "content": "",
            "subsections": [
                {
                    "name": "5.4 Deleting a macro",
                    "content": "A macro definition can be removed with 'undefine':\n\n-- Builtin: undefine (NAME...)\nFor each argument, remove the macro NAME.  The macro names must\nnecessarily be quoted, since they will be expanded otherwise.\n\nThe expansion of 'undefine' is void.  The macro 'undefine' is\nrecognized only with parameters.\n\nfoo bar blah\n=>foo bar blah\ndefine(`foo', `some')define(`bar', `other')define(`blah', `text')\n=>\nfoo bar blah\n=>some other text\nundefine(`foo')\n=>\nfoo bar blah\n=>foo other text\nundefine(`bar', `blah')\n=>\nfoo bar blah\n=>foo bar blah\n\nUndefining a macro inside that macro's expansion is safe; the macro\nstill expands to the definition that was in effect at the '('.\n\ndefine(`f', ``$0':$1')\n=>\nf(f(f(undefine(`f')`hello world')))\n=>f:f:f:hello world\nf(`bye')\n=>f(bye)\n\nIt is not an error for NAME to have no macro definition.  In that\ncase, 'undefine' does nothing.\n"
                }
            ]
        },
        "File: m4.info,  Node: Defn,  Next: Pushdef,  Prev: Undefine,  Up: Definitions": {
            "content": "",
            "subsections": [
                {
                    "name": "5.5 Renaming macros",
                    "content": ""
                }
            ]
        },
        "It is possible to rename an already defined macro.  To do this, you need": {
            "content": "the builtin 'defn':\n\n-- Builtin: defn (NAME...)\nExpands to the quoted definition of each NAME.  If an argument is\nnot a defined macro, the expansion for that argument is empty.\n\nIf NAME is a user-defined macro, the quoted definition is simply\nthe quoted expansion text.  If, instead, there is only one NAME and\nit is a builtin, the expansion is a special token, which points to\nthe builtin's internal definition.  This token is only meaningful\nas the second argument to 'define' (and 'pushdef'), and is silently\nconverted to an empty string in most other contexts.  Combining a\nbuiltin with anything else is not supported; a warning is issued\nand the builtin is omitted from the final expansion.\n\nThe macro 'defn' is recognized only with parameters.\n\nIts normal use is best understood through an example, which shows how\nto rename 'undefine' to 'zap':\n\ndefine(`zap', defn(`undefine'))\n=>\nzap(`undefine')\n=>\nundefine(`zap')\n=>undefine(zap)\n\nIn this way, 'defn' can be used to copy macro definitions, and also\ndefinitions of builtin macros.  Even if the original macro is removed,\nthe other name can still be used to access the definition.\n\nThe fact that macro definitions can be transferred also explains why\nyou should use '$0', rather than retyping a macro's name in its\ndefinition:\n\ndefine(`foo', `This is `$0'')\n=>\ndefine(`bar', defn(`foo'))\n=>\nbar\n=>This is bar\n\nMacros used as string variables should be referred through 'defn', to\navoid unwanted expansion of the text:\n\ndefine(`string', `The macro dnl is very useful\n')\n=>\nstring\n=>The macro\ndefn(`string')\n=>The macro dnl is very useful\n=>\n\nHowever, it is important to remember that 'm4' rescanning is purely\ntextual.  If an unbalanced end-quote string occurs in a macro\ndefinition, the rescan will see that embedded quote as the termination\nof the quoted string, and the remainder of the macro's definition will\nbe rescanned unquoted.  Thus it is a good idea to avoid unbalanced\nend-quotes in macro definitions or arguments to macros.\n\ndefine(`foo', a'a)\n=>\ndefine(`a', `A')\n=>\ndefine(`echo', `$@')\n=>\nfoo\n=>A'A\ndefn(`foo')\n=>aA'\necho(foo)\n=>AA'\n\nOn the other hand, it is possible to exploit the fact that 'defn' can\nconcatenate multiple macros prior to the rescanning phase, in order to\njoin the definitions of macros that, in isolation, have unbalanced\nquotes.  This is particularly useful when one has used several macros to\naccumulate text that M4 should rescan as a whole.  In the example below,\nnote how the use of 'defn' on 'l' in isolation opens a string, which is\nnot closed until the next line; but used on 'l' and 'r' together results\nin nested quoting.\n\ndefine(`l', `<[>')define(`r', `<]>')\n=>\nchangequote(`[', `]')\n=>\ndefn([l])defn([r])\n])\n=><[>]defn([r])\n=>)\ndefn([l], [r])\n=><[>][<]>\n\nUsing 'defn' to generate special tokens for builtin macros outside of\nexpected contexts can sometimes trigger warnings.  But most of the time,\nsuch tokens are silently converted to the empty string.\n\n$ m4 -d\ndefn(`defn')\n=>\ndefine(defn(`divnum'), `cannot redefine a builtin token')\nerror->m4:stdin:2: Warning: define: invalid macro name ignored\n=>\ndivnum\n=>0\nlen(defn(`divnum'))\n=>0\n\nAlso note that 'defn' with multiple arguments can only join text\nmacros, not builtins, although a future version of GNU M4 may lift this\nrestriction.\n\n$ m4 -d\ndefine(`a', `A')define(`AA', `b')\n=>\ntraceon(`defn', `define')\n=>\ndefn(`a', `divnum', `a')\nerror->m4:stdin:3: Warning: cannot concatenate builtin `divnum'\nerror->m4trace: -1- defn(`a', `divnum', `a') -> ``A'`A''\n=>AA\ndefine(`mydivnum', defn(`divnum', `divnum'))mydivnum\nerror->m4:stdin:4: Warning: cannot concatenate builtin `divnum'\nerror->m4:stdin:4: Warning: cannot concatenate builtin `divnum'\nerror->m4trace: -2- defn(`divnum', `divnum')\nerror->m4trace: -1- define(`mydivnum', `')\n=>\ntraceoff(`defn', `define')\n=>\n",
            "subsections": []
        },
        "File: m4.info,  Node: Pushdef,  Next: Indir,  Prev: Defn,  Up: Definitions": {
            "content": "",
            "subsections": [
                {
                    "name": "5.6 Temporarily redefining macros",
                    "content": ""
                }
            ]
        },
        "It is possible to redefine a macro temporarily, reverting to the": {
            "content": "previous definition at a later time.  This is done with the builtins\n'pushdef' and 'popdef':\n\n-- Builtin: pushdef (NAME, [EXPANSION])\n-- Builtin: popdef (NAME...)\nAnalogous to 'define' and 'undefine'.\n\nThese macros work in a stack-like fashion.  A macro is temporarily\nredefined with 'pushdef', which replaces an existing definition of\nNAME, while saving the previous definition, before the new one is\ninstalled.  If there is no previous definition, 'pushdef' behaves\nexactly like 'define'.\n\nIf a macro has several definitions (of which only one is\naccessible), the topmost definition can be removed with 'popdef'.\nIf there is no previous definition, 'popdef' behaves like\n'undefine'.\n\nThe expansion of both 'pushdef' and 'popdef' is void.  The macros\n'pushdef' and 'popdef' are recognized only with parameters.\n\ndefine(`foo', `Expansion one.')\n=>\nfoo\n=>Expansion one.\npushdef(`foo', `Expansion two.')\n=>\nfoo\n=>Expansion two.\npushdef(`foo', `Expansion three.')\n=>\npushdef(`foo', `Expansion four.')\n=>\npopdef(`foo')\n=>\nfoo\n=>Expansion three.\npopdef(`foo', `foo')\n=>\nfoo\n=>Expansion one.\npopdef(`foo')\n=>\nfoo\n=>foo\n\nIf a macro with several definitions is redefined with 'define', the\ntopmost definition is replaced with the new definition.  If it is\nremoved with 'undefine', all the definitions are removed, and not only\nthe topmost one.  However, POSIX allows other implementations that treat\n'define' as replacing an entire stack of definitions with a single new\ndefinition, so to be portable to other implementations, it may be worth\nexplicitly using 'popdef' and 'pushdef' rather than relying on the GNU\nbehavior of 'define'.\n\ndefine(`foo', `Expansion one.')\n=>\nfoo\n=>Expansion one.\npushdef(`foo', `Expansion two.')\n=>\nfoo\n=>Expansion two.\ndefine(`foo', `Second expansion two.')\n=>\nfoo\n=>Second expansion two.\nundefine(`foo')\n=>\nfoo\n=>foo\n\nLocal variables within macros are made with 'pushdef' and 'popdef'.",
            "subsections": []
        },
        "At the start of the macro a new definition is pushed, within the macro": {
            "content": "it is manipulated and at the end it is popped, revealing the former\ndefinition.\n\nIt is possible to temporarily redefine a builtin with 'pushdef' and\n'defn'.\n",
            "subsections": []
        },
        "File: m4.info,  Node: Indir,  Next: Builtin,  Prev: Pushdef,  Up: Definitions": {
            "content": "",
            "subsections": [
                {
                    "name": "5.7 Indirect call of macros",
                    "content": "Any macro can be called indirectly with 'indir':\n\n-- Builtin: indir (NAME, [ARGS...])\nResults in a call to the macro NAME, which is passed the rest of\nthe arguments ARGS.  If NAME is not defined, an error message is\nprinted, and the expansion is void.\n\nThe macro 'indir' is recognized only with parameters.\n\nThis can be used to call macros with computed or \"invalid\" names\n('define' allows such names to be defined):\n\ndefine(`$$internal$macro', `Internal macro (name `$0')')\n=>\n$$internal$macro\n=>$$internal$macro\nindir(`$$internal$macro')\n=>Internal macro (name $$internal$macro)\n\nThe point is, here, that larger macro packages can have private\nmacros defined, that will not be called by accident.  They can only be\ncalled through the builtin 'indir'.\n\nOne other point to observe is that argument collection occurs before\n'indir' invokes NAME, so if argument collection changes the value of\nNAME, that will be reflected in the final expansion.  This is different\nthan the behavior when invoking macros directly, where the definition\nthat was in effect before argument collection is used.\n\n$ m4 -d\ndefine(`f', `1')\n=>\nf(define(`f', `2'))\n=>1\nindir(`f', define(`f', `3'))\n=>3\nindir(`f', undefine(`f'))\nerror->m4:stdin:4: undefined macro `f'\n=>\n\nWhen handed the result of 'defn' (*note Defn::) as one of its\narguments, 'indir' defers to the invoked NAME for whether a token\nrepresenting a builtin is recognized or flattened to the empty string.\n\n$ m4 -d\nindir(defn(`defn'), `divnum')\nerror->m4:stdin:1: Warning: indir: invalid macro name ignored\n=>\nindir(`define', defn(`defn'), `divnum')\nerror->m4:stdin:2: Warning: define: invalid macro name ignored\n=>\nindir(`define', `foo', defn(`divnum'))\n=>\nfoo\n=>0\nindir(`divert', defn(`foo'))\nerror->m4:stdin:5: empty string treated as 0 in builtin `divert'\n=>\n"
                }
            ]
        },
        "File: m4.info,  Node: Builtin,  Prev: Indir,  Up: Definitions": {
            "content": "",
            "subsections": [
                {
                    "name": "5.8 Indirect call of builtins",
                    "content": "Builtin macros can be called indirectly with 'builtin':\n\n-- Builtin: builtin (NAME, [ARGS...])\nResults in a call to the builtin NAME, which is passed the rest of\nthe arguments ARGS.  If NAME does not name a builtin, an error\nmessage is printed, and the expansion is void.\n\nThe macro 'builtin' is recognized only with parameters.\n\nThis can be used even if NAME has been given another definition that\nhas covered the original, or been undefined so that no macro maps to the\nbuiltin.\n\npushdef(`define', `hidden')\n=>\nundefine(`undefine')\n=>\ndefine(`foo', `bar')\n=>hidden\nfoo\n=>foo\nbuiltin(`define', `foo', defn(`divnum'))\n=>\nfoo\n=>0\nbuiltin(`define', `foo', `BAR')\n=>\nfoo\n=>BAR\nundefine(`foo')\n=>undefine(foo)\nfoo\n=>BAR\nbuiltin(`undefine', `foo')\n=>\nfoo\n=>foo\n\nThe NAME argument only matches the original name of the builtin, even\nwhen the '--prefix-builtins' option (or '-P', *note Invoking m4:"
                }
            ]
        },
        "Operation modes.) is in effect.  This is different from 'indir', which": {
            "content": "only tracks current macro names.\n\n$ m4 -P\nm4builtin(`divnum')\n=>0\nm4builtin(`m4divnum')\nerror->m4:stdin:2: undefined builtin `m4divnum'\n=>\nm4indir(`divnum')\nerror->m4:stdin:3: undefined macro `divnum'\n=>\nm4indir(`m4divnum')\n=>0\n\nNote that 'indir' and 'builtin' can be used to invoke builtins\nwithout arguments, even when they normally require parameters to be\nrecognized; but it will provoke a warning, and result in a void\nexpansion.\n\nbuiltin\n=>builtin\nbuiltin()\nerror->m4:stdin:2: undefined builtin `'\n=>\nbuiltin(`builtin')\nerror->m4:stdin:3: Warning: too few arguments to builtin `builtin'\n=>\nbuiltin(`builtin',)\nerror->m4:stdin:4: undefined builtin `'\n=>\nbuiltin(`builtin', ``'\n')\nerror->m4:stdin:5: undefined builtin ``'\nerror->'\n=>\nindir(`index')\nerror->m4:stdin:7: Warning: too few arguments to builtin `index'\n=>\n",
            "subsections": []
        },
        "File: m4.info,  Node: Conditionals,  Next: Debugging,  Prev: Definitions,  Up: Top": {
            "content": "",
            "subsections": []
        },
        "6 Conditionals, loops, and recursion": {
            "content": "",
            "subsections": []
        },
        "Macros, expanding to plain text, perhaps with arguments, are not quite": {
            "content": "enough.  We would like to have macros expand to different things, based\non decisions taken at run-time.  For that, we need some kind of\nconditionals.  Also, we would like to have some kind of loop construct,\nso we could do something a number of times, or while some condition is\ntrue.\n\n* Menu:\n\n* Ifdef::                       Testing if a macro is defined\n* Ifelse::                      If-else construct, or multibranch\n* Shift::                       Recursion in 'm4'\n* Forloop::                     Iteration by counting\n* Foreach::                     Iteration by list contents\n* Stacks::                      Working with definition stacks\n* Composition::                 Building macros with macros\n",
            "subsections": []
        },
        "File: m4.info,  Node: Ifdef,  Next: Ifelse,  Up: Conditionals": {
            "content": "",
            "subsections": [
                {
                    "name": "6.1 Testing if a macro is defined",
                    "content": ""
                }
            ]
        },
        "There are two different builtin conditionals in 'm4'.  The first is": {
            "content": "'ifdef':\n\n-- Builtin: ifdef (NAME, STRING-1, [STRING-2])\nIf NAME is defined as a macro, 'ifdef' expands to STRING-1,\notherwise to STRING-2.  If STRING-2 is omitted, it is taken to be\nthe empty string (according to the normal rules).\n\nThe macro 'ifdef' is recognized only with parameters.\n\nifdef(`foo', ``foo' is defined', ``foo' is not defined')\n=>foo is not defined\ndefine(`foo', `')\n=>\nifdef(`foo', ``foo' is defined', ``foo' is not defined')\n=>foo is defined\nifdef(`nosuchmacro', `yes', `no', `extra argument')\nerror->m4:stdin:4: Warning: excess arguments to builtin `ifdef' ignored\n=>no\n",
            "subsections": []
        },
        "File: m4.info,  Node: Ifelse,  Next: Shift,  Prev: Ifdef,  Up: Conditionals": {
            "content": "",
            "subsections": [
                {
                    "name": "6.2 If-else construct, or multibranch",
                    "content": ""
                }
            ]
        },
        "The other conditional, 'ifelse', is much more powerful.  It can be used": {
            "content": "as a way to introduce a long comment, as an if-else construct, or as a\nmultibranch, depending on the number of arguments supplied:\n\n-- Builtin: ifelse (COMMENT)\n-- Builtin: ifelse (STRING-1, STRING-2, EQUAL, [NOT-EQUAL])\n-- Builtin: ifelse (STRING-1, STRING-2, EQUAL-1, STRING-3, STRING-4,\nEQUAL-2, ..., [NOT-EQUAL])\nUsed with only one argument, the 'ifelse' simply discards it and\nproduces no output.\n\nIf called with three or four arguments, 'ifelse' expands into\nEQUAL, if STRING-1 and STRING-2 are equal (character for\ncharacter), otherwise it expands to NOT-EQUAL.  A final fifth\nargument is ignored, after triggering a warning.\n\nIf called with six or more arguments, and STRING-1 and STRING-2 are\nequal, 'ifelse' expands into EQUAL-1, otherwise the first three\narguments are discarded and the processing starts again.\n\nThe macro 'ifelse' is recognized only with parameters.\n\nUsing only one argument is a common 'm4' idiom for introducing a\nblock comment, as an alternative to repeatedly using 'dnl'.  This\nspecial usage is recognized by GNU 'm4', so that in this case, the\nwarning about missing arguments is never triggered.\n\nifelse(`some comments')\n=>\nifelse(`foo', `bar')\nerror->m4:stdin:2: Warning: too few arguments to builtin `ifelse'\n=>\n\nUsing three or four arguments provides decision points.\n\nifelse(`foo', `bar', `true')\n=>\nifelse(`foo', `foo', `true')\n=>true\ndefine(`foo', `bar')\n=>\nifelse(foo, `bar', `true', `false')\n=>true\nifelse(foo, `foo', `true', `false')\n=>false\n\nNotice how the first argument was used unquoted; it is common to\ncompare the expansion of a macro with a string.  With this macro, you\ncan now reproduce the behavior of blind builtins, where the macro is\nrecognized only with arguments.\n\ndefine(`foo', `ifelse(`$#', `0', ``$0'', `arguments:$#')')\n=>\nfoo\n=>foo\nfoo()\n=>arguments:1\nfoo(`a', `b', `c')\n=>arguments:3\n\nFor an example of a way to make defining blind macros easier, see\n*note Composition::.\n\nThe macro 'ifelse' can take more than four arguments.  If given more\nthan four arguments, 'ifelse' works like a 'case' or 'switch' statement\nin traditional programming languages.  If STRING-1 and STRING-2 are\nequal, 'ifelse' expands into EQUAL-1, otherwise the procedure is\nrepeated with the first three arguments discarded.  This calls for an\nexample:\n\nifelse(`foo', `bar', `third', `gnu', `gnats')\nerror->m4:stdin:1: Warning: excess arguments to builtin `ifelse' ignored\n=>gnu\nifelse(`foo', `bar', `third', `gnu', `gnats', `sixth')\n=>\nifelse(`foo', `bar', `third', `gnu', `gnats', `sixth', `seventh')\n=>seventh\nifelse(`foo', `bar', `3', `gnu', `gnats', `6', `7', `8')\nerror->m4:stdin:4: Warning: excess arguments to builtin `ifelse' ignored\n=>7\n\nNaturally, the normal case will be slightly more advanced than these\nexamples.  A common use of 'ifelse' is in macros implementing loops of\nvarious kinds.\n",
            "subsections": []
        },
        "File: m4.info,  Node: Shift,  Next: Forloop,  Prev: Ifelse,  Up: Conditionals": {
            "content": "",
            "subsections": [
                {
                    "name": "6.3 Recursion in 'm4'",
                    "content": ""
                }
            ]
        },
        "There is no direct support for loops in 'm4', but macros can be": {
            "content": "recursive.  There is no limit on the number of recursion levels, other\nthan those enforced by your hardware and operating system.\n\nLoops can be programmed using recursion and the conditionals\ndescribed previously.\n\nThere is a builtin macro, 'shift', which can, among other things, be\nused for iterating through the actual arguments to a macro:\n\n-- Builtin: shift (ARG1, ...)\nTakes any number of arguments, and expands to all its arguments\nexcept ARG1, separated by commas, with each argument quoted.\n\nThe macro 'shift' is recognized only with parameters.\n\nshift\n=>shift\nshift(`bar')\n=>\nshift(`foo', `bar', `baz')\n=>bar,baz\n\nAn example of the use of 'shift' is this macro:\n\n-- Composite: reverse (...)\nTakes any number of arguments, and reverses their order.\n\nIt is implemented as:\n\ndefine(`reverse', `ifelse(`$#', `0', , `$#', `1', ``$1'',\n`reverse(shift($@)), `$1'')')\n=>\nreverse\n=>\nreverse(`foo')\n=>foo\nreverse(`foo', `bar', `gnats', `and gnus')\n=>and gnus, gnats, bar, foo\n\nWhile not a very interesting macro, it does show how simple loops can\nbe made with 'shift', 'ifelse' and recursion.  It also shows that\n'shift' is usually used with '$@'.  Another example of this is an\nimplementation of a short-circuiting conditional operator.\n\n-- Composite: cond (TEST-1, STRING-1, EQUAL-1, [TEST-2], [STRING-2],\n[EQUAL-2], ..., [NOT-EQUAL])\nSimilar to 'ifelse', where an equal comparison between the first\ntwo strings results in the third, otherwise the first three\narguments are discarded and the process repeats.  The difference is\nthat each TEST-<N> is expanded only when it is encountered.  This\nmeans that every third argument to 'cond' is normally given one\nmore level of quoting than the corresponding argument to 'ifelse'.\n\nHere is the implementation of 'cond', along with a demonstration of\nhow it can short-circuit the side effects in 'side'.  Notice how all the\nunquoted side effects happen regardless of how many comparisons are made\nwith 'ifelse', compared with only the relevant effects with 'cond'.\n\ndefine(`cond',\n`ifelse(`$#', `1', `$1',\n`ifelse($1, `$2', `$3',\n`$0(shift(shift(shift($@))))')')')dnl\ndefine(`side', `define(`counter', incr(counter))$1')dnl\ndefine(`example1',\n`define(`counter', `0')dnl\nifelse(side(`$1'), `yes', `one comparison: ',\nside(`$1'), `no', `two comparisons: ',\nside(`$1'), `maybe', `three comparisons: ',\n`side(`default answer: ')')counter')dnl\ndefine(`example2',\n`define(`counter', `0')dnl\ncond(`side(`$1')', `yes', `one comparison: ',\n`side(`$1')', `no', `two comparisons: ',\n`side(`$1')', `maybe', `three comparisons: ',\n`side(`default answer: ')')counter')dnl\nexample1(`yes')\n=>one comparison: 3\nexample1(`no')\n=>two comparisons: 3\nexample1(`maybe')\n=>three comparisons: 3\nexample1(`feeling rather indecisive today')\n=>default answer: 4\nexample2(`yes')\n=>one comparison: 1\nexample2(`no')\n=>two comparisons: 2\nexample2(`maybe')\n=>three comparisons: 3\nexample2(`feeling rather indecisive today')\n=>default answer: 4\n\nAnother common task that requires iteration is joining a list of\narguments into a single string.\n\n-- Composite: join ([SEPARATOR], [ARGS...])\n-- Composite: joinall ([SEPARATOR], [ARGS...])\nGenerate a single-quoted string, consisting of each ARG separated\nby SEPARATOR.  While 'joinall' always outputs a SEPARATOR between\narguments, 'join' avoids the SEPARATOR for an empty ARG.\n\nHere are some examples of its usage, based on the implementation\n'm4-1.4.19/examples/join.m4' distributed in this package:\n\n$ m4 -I examples\ninclude(`join.m4')\n=>\njoin,join(`-'),join(`-', `'),join(`-', `', `')\n=>,,,\njoinall,joinall(`-'),joinall(`-', `'),joinall(`-', `', `')\n=>,,,-\njoin(`-', `1')\n=>1\njoin(`-', `1', `2', `3')\n=>1-2-3\njoin(`', `1', `2', `3')\n=>123\njoin(`-', `', `1', `', `', `2', `')\n=>1-2\njoinall(`-', `', `1', `', `', `2', `')\n=>-1---2-\njoin(`,', `1', `2', `3')\n=>1,2,3\ndefine(`nargs', `$#')dnl\nnargs(join(`,', `1', `2', `3'))\n=>1\n\nExamining the implementation shows some interesting points about\nseveral m4 programming idioms.\n\n$ m4 -I examples\nundivert(`join.m4')dnl\n=>divert(`-1')\n=># join(sep, args) - join each non-empty ARG into a single\n=># string, with each element separated by SEP\n=>define(`join',\n=>`ifelse(`$#', `2', ``$2'',\n=>  `ifelse(`$2', `', `', ``$2'')$0(`$1', shift(shift($@)))')')\n=>define(`join',\n=>`ifelse(`$#$2', `2', `',\n=>  `ifelse(`$2', `', `', ``$1$2'')$0(`$1', shift(shift($@)))')')\n=># joinall(sep, args) - join each ARG, including empty ones,\n=># into a single string, with each element separated by SEP\n=>define(`joinall', ``$2'$0(`$1', shift($@))')\n=>define(`joinall',\n=>`ifelse(`$#', `2', `', ``$1$3'$0(`$1', shift(shift($@)))')')\n=>divert`'dnl\n\nFirst, notice that this implementation creates helper macros 'join'\nand 'joinall'.  This division of labor makes it easier to output the\ncorrect number of SEPARATOR instances: 'join' and 'joinall' are\nresponsible for the first argument, without a separator, while 'join'\nand 'joinall' are responsible for all remaining arguments, always\noutputting a separator when outputting an argument.\n\nNext, observe how 'join' decides to iterate to itself, because the\nfirst ARG was empty, or to output the argument and swap over to 'join'.",
            "subsections": []
        },
        "If the argument is non-empty, then the nested 'ifelse' results in an": {
            "content": "unquoted '', which is concatenated with the '$0' to form the next macro\nname to invoke.  The 'joinall' implementation is simpler since it does\nnot have to suppress empty ARG; it always executes once then defers to\n'joinall'.\n\nAnother important idiom is the idea that SEPARATOR is reused for each\niteration.  Each iteration has one less argument, but rather than\ndiscarding '$1' by iterating with '$0(shift($@))', the macro discards\n'$2' by using '$0(`$1', shift(shift($@)))'.\n\nNext, notice that it is possible to compare more than one condition\nin a single 'ifelse' test.  The test of '$#$2' against '2' allows\n'join' to iterate for two separate reasons--either there are still more\nthan two arguments, or there are exactly two arguments but the last\nargument is not empty.\n\nFinally, notice that these macros require exactly two arguments to\nterminate recursion, but that they still correctly result in empty\noutput when given no ARGS (i.e., zero or one macro argument).  On the\nfirst pass when there are too few arguments, the 'shift' results in no\noutput, but leaves an empty string to serve as the required second\nargument for the second pass.  Put another way, '`$1', shift($@)' is not\nthe same as '$@', since only the former guarantees at least two\narguments.\n\nSometimes, a recursive algorithm requires adding quotes to each\nelement, or treating multiple arguments as a single element:\n\n-- Composite: quote (...)\n-- Composite: dquote (...)\n-- Composite: dquoteelt (...)\nTakes any number of arguments, and adds quoting.  With 'quote',\nonly one level of quoting is added, effectively removing whitespace\nafter commas and turning multiple arguments into a single string.\nWith 'dquote', two levels of quoting are added, one around each\nelement, and one around the list.  And with 'dquoteelt', two\nlevels of quoting are added around each element.\n\nAn actual implementation of these three macros is distributed as\n'm4-1.4.19/examples/quote.m4' in this package.  First, let's examine\ntheir usage:\n\n$ m4 -I examples\ninclude(`quote.m4')\n=>",
            "subsections": [
                {
                    "name": "-quote-dquote-dquote_elt-",
                    "content": "=>----\n-quote()-dquote()-dquoteelt()-\n=>--`'-`'-\n-quote(`1')-dquote(`1')-dquoteelt(`1')-\n=>-1-`1'-`1'-\n-quote(`1', `2')-dquote(`1', `2')-dquoteelt(`1', `2')-\n=>-1,2-`1',`2'-`1',`2'-\ndefine(`n', `$#')dnl\n-n(quote(`1', `2'))-n(dquote(`1', `2'))-n(dquoteelt(`1', `2'))-\n=>-1-1-2-\ndquote(dquoteelt(`1', `2'))\n=>``1'',``2''\ndquoteelt(dquote(`1', `2'))\n=>``1',`2''\n\nThe last two lines show that when given two arguments, 'dquote'\nresults in one string, while 'dquoteelt' results in two.  Now, examine\nthe implementation.  Note that 'quote' and 'dquoteelt' make decisions\nbased on their number of arguments, so that when called without\narguments, they result in nothing instead of a quoted empty string; this\nis so that it is possible to distinguish between no arguments and an\nempty first argument.  'dquote', on the other hand, results in a string\nno matter what, since it is still possible to tell whether it was\ninvoked without arguments based on the resulting string.\n\n$ m4 -I examples\nundivert(`quote.m4')dnl\n=>divert(`-1')\n=># quote(args) - convert args to single-quoted string\n=>define(`quote', `ifelse(`$#', `0', `', ``$*'')')\n=># dquote(args) - convert args to quoted list of quoted strings\n=>define(`dquote', ``$@'')\n=># dquoteelt(args) - convert args to list of double-quoted strings\n=>define(`dquoteelt', `ifelse(`$#', `0', `', `$#', `1', ```$1''',\n=>                             ```$1'',$0(shift($@))')')\n=>divert`'dnl\n\nIt is worth pointing out that 'quote(ARGS)' is more efficient than\n'joinall(`,', ARGS)' for producing the same output.\n\nOne more useful macro based on 'shift' allows portably selecting an\narbitrary argument (usually greater than the ninth argument), without\nrelying on the GNU extension of multi-digit arguments (*note\nArguments::).\n\n-- Composite: argn (N, ...)\nExpands to argument N out of the remaining arguments.  N must be a\npositive number.  Usually invoked as 'argn(`N',$@)'.\n\nIt is implemented as:\n\ndefine(`argn', `ifelse(`$1', 1, ``$2'',\n`argn(decr(`$1'), shift(shift($@)))')')\n=>\nargn(`1', `a')\n=>a\ndefine(`foo', `argn(`11', $@)')\n=>\nfoo(`a', `b', `c', `d', `e', `f', `g', `h', `i', `j', `k', `l')\n=>k\n"
                }
            ]
        },
        "File: m4.info,  Node: Forloop,  Next: Foreach,  Prev: Shift,  Up: Conditionals": {
            "content": "",
            "subsections": [
                {
                    "name": "6.4 Iteration by counting",
                    "content": "Here is an example of a loop macro that implements a simple for loop.\n\n-- Composite: forloop (ITERATOR, START, END, TEXT)\nTakes the name in ITERATOR, which must be a valid macro name, and\nsuccessively assign it each integer value from START to END,\ninclusive.  For each assignment to ITERATOR, append TEXT to the\nexpansion of the 'forloop'.  TEXT may refer to ITERATOR.  Any\ndefinition of ITERATOR prior to this invocation is restored.\n\nIt can, for example, be used for simple counting:\n\n$ m4 -I examples\ninclude(`forloop.m4')\n=>\nforloop(`i', `1', `8', `i ')\n=>1 2 3 4 5 6 7 8\n\nFor-loops can be nested, like:\n\n$ m4 -I examples\ninclude(`forloop.m4')\n=>\nforloop(`i', `1', `4', `forloop(`j', `1', `8', ` (i, j)')\n')\n=> (1, 1) (1, 2) (1, 3) (1, 4) (1, 5) (1, 6) (1, 7) (1, 8)\n=> (2, 1) (2, 2) (2, 3) (2, 4) (2, 5) (2, 6) (2, 7) (2, 8)\n=> (3, 1) (3, 2) (3, 3) (3, 4) (3, 5) (3, 6) (3, 7) (3, 8)\n=> (4, 1) (4, 2) (4, 3) (4, 4) (4, 5) (4, 6) (4, 7) (4, 8)\n=>\n\nThe implementation of the 'forloop' macro is fairly straightforward."
                }
            ]
        },
        "The 'forloop' macro itself is simply a wrapper, which saves the previous": {
            "content": "definition of the first argument, calls the internal macro 'forloop',\nand re-establishes the saved definition of the first argument.\n\nThe macro 'forloop' expands the fourth argument once, and tests to\nsee if the iterator has reached the final value.  If it has not\nfinished, it increments the iterator (using the predefined macro 'incr',\n*note Incr::), and recurses.\n\nHere is an actual implementation of 'forloop', distributed as\n'm4-1.4.19/examples/forloop.m4' in this package:\n\n$ m4 -I examples\nundivert(`forloop.m4')dnl\n=>divert(`-1')\n=># forloop(var, from, to, stmt) - simple version\n=>define(`forloop', `pushdef(`$1', `$2')forloop($@)popdef(`$1')')\n=>define(`forloop',\n=>       `$4`'ifelse($1, `$3', `', `define(`$1', incr($1))$0($@)')')\n=>divert`'dnl\n\nNotice the careful use of quotes.  Certain macro arguments are left\nunquoted, each for its own reason.  Try to find out why these\narguments are left unquoted, and see what happens if they are quoted.\n(As presented, these two macros are useful but not very robust for\ngeneral use.  They lack even basic error handling for cases like START\nless than END, END not numeric, or ITERATOR not being a macro name.  See\nif you can improve these macros; or *note Answers: Improved forloop.).\n",
            "subsections": []
        },
        "File: m4.info,  Node: Foreach,  Next: Stacks,  Prev: Forloop,  Up: Conditionals": {
            "content": "",
            "subsections": [
                {
                    "name": "6.5 Iteration by list contents",
                    "content": "Here is an example of a loop macro that implements list iteration.\n\n-- Composite: foreach (ITERATOR, PAREN-LIST, TEXT)\n-- Composite: foreachq (ITERATOR, QUOTE-LIST, TEXT)\nTakes the name in ITERATOR, which must be a valid macro name, and\nsuccessively assign it each value from PAREN-LIST or QUOTE-LIST.\nIn 'foreach', PAREN-LIST is a comma-separated list of elements\ncontained in parentheses.  In 'foreachq', QUOTE-LIST is a\ncomma-separated list of elements contained in a quoted string.  For\neach assignment to ITERATOR, append TEXT to the overall expansion.\nTEXT may refer to ITERATOR.  Any definition of ITERATOR prior to\nthis invocation is restored.\n\nAs an example, this displays each word in a list inside of a\nsentence, using an implementation of 'foreach' distributed as\n'm4-1.4.19/examples/foreach.m4', and 'foreachq' in\n'm4-1.4.19/examples/foreachq.m4'.\n\n$ m4 -I examples\ninclude(`foreach.m4')\n=>\nforeach(`x', (foo, bar, foobar), `Word was: x\n')dnl\n=>Word was: foo\n=>Word was: bar\n=>Word was: foobar\ninclude(`foreachq.m4')\n=>\nforeachq(`x', `foo, bar, foobar', `Word was: x\n')dnl\n=>Word was: foo\n=>Word was: bar\n=>Word was: foobar\n\nIt is possible to be more complex; each element of the PAREN-LIST or\nQUOTE-LIST can itself be a list, to pass as further arguments to a\nhelper macro.  This example generates a shell case statement:\n\n$ m4 -I examples\ninclude(`foreach.m4')\n=>\ndefine(`case', `  $1)\n$2=\" $1\";;\n')dnl\ndefine(`cat', `$1$2')dnl\ncase $`'1 in\n=>case $1 in\nforeach(`x', `(`(`a', `vara')', `(`b', `varb')', `(`c', `varc')')',\n`cat(`case', x)')dnl\n=>  a)\n=>    vara=\" a\";;\n=>  b)\n=>    varb=\" b\";;\n=>  c)\n=>    varc=\" c\";;\nesac\n=>esac\n\nThe implementation of the 'foreach' macro is a bit more involved; it\nis a wrapper around two helper macros.  First, 'arg1' is needed to grab\nthe first element of a list.  Second, 'foreach' implements the\nrecursion, successively walking through the original list.  Here is a\nsimple implementation of 'foreach':\n\n$ m4 -I examples\nundivert(`foreach.m4')dnl\n=>divert(`-1')\n=># foreach(x, (item1, item2, ..., itemn), stmt)\n=>#   parenthesized list, simple version\n=>define(`foreach', `pushdef(`$1')foreach($@)popdef(`$1')')\n=>define(`arg1', `$1')\n=>define(`foreach', `ifelse(`$2', `()', `',\n=>  `define(`$1', arg1$2)$3`'$0(`$1', (shift$2), `$3')')')\n=>divert`'dnl\n\nUnfortunately, that implementation is not robust to macro names as\nlist elements.  Each iteration of 'foreach' is stripping another layer\nof quotes, leading to erratic results if list elements are not already\nfully expanded.  The first cut at implementing 'foreachq' takes this\ninto account.  Also, when using quoted elements in a PAREN-LIST, the\noverall list must be quoted.  A QUOTE-LIST has the nice property of\nrequiring fewer characters to create a list containing the same quoted\nelements.  To see the difference between the two macros, we attempt to\npass double-quoted macro names in a list, expecting the macro name on\noutput after one layer of quotes is removed during list iteration and\nthe final layer removed during the final rescan:\n\n$ m4 -I examples\ndefine(`a', `1')define(`b', `2')define(`c', `3')\n=>\ninclude(`foreach.m4')\n=>\ninclude(`foreachq.m4')\n=>\nforeach(`x', `(``a'', ``(b'', ``c)'')', `x\n')\n=>1\n=>(2)1\n=>\n=>, x\n=>)\nforeachq(`x', ```a'', ``(b'', ``c)''', `x\n')dnl\n=>a\n=>(b\n=>c)\n\nObviously, 'foreachq' did a better job; here is its implementation:\n\n$ m4 -I examples\nundivert(`foreachq.m4')dnl\n=>include(`quote.m4')dnl\n=>divert(`-1')\n=># foreachq(x, `item1, item2, ..., itemn', stmt)\n=>#   quoted list, simple version\n=>define(`foreachq', `pushdef(`$1')foreachq($@)popdef(`$1')')\n=>define(`arg1', `$1')\n=>define(`foreachq', `ifelse(quote($2), `', `',\n=>  `define(`$1', `arg1($2)')$3`'$0(`$1', `shift($2)', `$3')')')\n=>divert`'dnl\n\nNotice that 'foreachq' had to use the helper macro 'quote' defined\nearlier (*note Shift::), to ensure that the embedded 'ifelse' call does\nnot go haywire if a list element contains a comma.  Unfortunately, this\nimplementation of 'foreachq' has its own severe flaw.  Whereas the\n'foreach' implementation was linear, this macro is quadratic in the\nnumber of list elements, and is much more likely to trip up the limit\nset by the command line option '--nesting-limit' (or '-L', *note"
                }
            ]
        },
        "Invoking m4: Limits control.).  Additionally, this implementation does": {
            "content": "not expand 'defn(`ITERATOR')' very well, when compared with 'foreach'.\n\n$ m4 -I examples\ninclude(`foreach.m4')include(`foreachq.m4')\n=>\nforeach(`name', `(`a', `b')', ` defn(`name')')\n=> a b\nforeachq(`name', ``a', `b'', ` defn(`name')')\n=> arg1(`a', `b') arg1(shift(`a', `b'))\n\nIt is possible to have robust iteration with linear behavior and sane\nITERATOR contents for either list style.  See if you can learn from the\nbest elements of both of these implementations to create robust macros\n(or *note Answers: Improved foreach.).\n",
            "subsections": []
        },
        "File: m4.info,  Node: Stacks,  Next: Composition,  Prev: Foreach,  Up: Conditionals": {
            "content": "",
            "subsections": [
                {
                    "name": "6.6 Working with definition stacks",
                    "content": ""
                }
            ]
        },
        "Thanks to 'pushdef', manipulation of a stack is an intrinsic operation": {
            "content": "in 'm4'.  Normally, only the topmost definition in a stack is important,\nbut sometimes, it is desirable to manipulate the entire definition\nstack.\n\n-- Composite: stackforeach (MACRO, ACTION)\n-- Composite: stackforeachlifo (MACRO, ACTION)\nFor each of the 'pushdef' definitions associated with MACRO, invoke\nthe macro ACTION with a single argument of that definition.\n'stackforeach' visits the oldest definition first, while\n'stackforeachlifo' visits the current definition first.  ACTION\nshould not modify or dereference MACRO.  There are a few special\nmacros, such as 'defn', which cannot be used as the MACRO\nparameter.\n\nA sample implementation of these macros is distributed in the file\n'm4-1.4.19/examples/stack.m4'.\n\n$ m4 -I examples\ninclude(`stack.m4')\n=>\npushdef(`a', `1')pushdef(`a', `2')pushdef(`a', `3')\n=>\ndefine(`show', ``$1'\n')\n=>\nstackforeach(`a', `show')dnl\n=>1\n=>2\n=>3\nstackforeachlifo(`a', `show')dnl\n=>3\n=>2\n=>1\n\nNow for the implementation.  Note the definition of a helper macro,\n'stackreverse', which destructively swaps the contents of one stack of\ndefinitions into the reverse order in the temporary macro 'tmp-$1'.  By\ncalling the helper twice, the original order is restored back into the\nmacro '$1'; since the operation is destructive, this explains why '$1'\nmust not be modified or dereferenced during the traversal.  The caller\ncan then inject additional code to pass the definition currently being\nvisited to '$2'.  The choice of helper names is intentional; since '-'\nis not valid as part of a macro name, there is no risk of conflict with\na valid macro name, and the code is guaranteed to use 'defn' where\nnecessary.  Finally, note that any macro used in the traversal of a\n'pushdef' stack, such as 'pushdef' or 'defn', cannot be handled by\n'stackforeach', since the macro would temporarily be undefined during\nthe algorithm.\n\n$ m4 -I examples\nundivert(`stack.m4')dnl\n=>divert(`-1')\n=># stackforeach(macro, action)\n=># Invoke ACTION with a single argument of each definition\n=># from the definition stack of MACRO, starting with the oldest.\n=>define(`stackforeach',\n=>`stackreverse(`$1', `tmp-$1')'dnl\n=>`stackreverse(`tmp-$1', `$1', `$2(defn(`$1'))')')\n=># stackforeachlifo(macro, action)\n=># Invoke ACTION with a single argument of each definition\n=># from the definition stack of MACRO, starting with the newest.\n=>define(`stackforeachlifo',\n=>`stackreverse(`$1', `tmp-$1', `$2(defn(`$1'))')'dnl\n=>`stackreverse(`tmp-$1', `$1')')\n=>define(`stackreverse',\n=>`ifdef(`$1', `pushdef(`$2', defn(`$1'))$3`'popdef(`$1')$0($@)')')\n=>divert`'dnl\n",
            "subsections": []
        },
        "File: m4.info,  Node: Composition,  Prev: Stacks,  Up: Conditionals": {
            "content": "",
            "subsections": [
                {
                    "name": "6.7 Building macros with macros",
                    "content": ""
                }
            ]
        },
        "Since m4 is a macro language, it is possible to write macros that can": {
            "content": "build other macros.  First on the list is a way to automate the creation\nof blind macros.\n\n-- Composite: defineblind (NAME, [VALUE])\nDefines NAME as a blind macro, such that NAME will expand to VALUE\nonly when given explicit arguments.  VALUE should not be the result\nof 'defn' (*note Defn::).  This macro is only recognized with\nparameters, and results in an empty string.\n\nDefining a macro to define another macro can be a bit tricky.  We\nwant to use a literal '$#' in the argument to the nested 'define'.\nHowever, if '$' and '#' are adjacent in the definition of\n'defineblind', then it would be expanded as the number of arguments to\n'defineblind' rather than the intended number of arguments to NAME.",
            "subsections": []
        },
        "The solution is to pass the difficult characters through extra arguments": {
            "content": "to a helper macro 'defineblind'.  When composing macros, it is a\ncommon idiom to need a helper macro to concatenate text that forms\nparameters in the composed macro, rather than interpreting the text as a\nparameter of the composing macro.\n\nAs for the limitation against using 'defn', there are two reasons.",
            "subsections": []
        },
        "If a macro was previously defined with 'defineblind', then it can": {
            "content": "safely be renamed to a new blind macro using plain 'define'; using\n'defineblind' to rename it just adds another layer of 'ifelse',\noccupying memory and slowing down execution.  And if a macro is a\nbuiltin, then it would result in an attempt to define a macro consisting\nof both text and a builtin token; this is not supported, and the builtin\ntoken is flattened to an empty string.\n\nWith that explanation, here's the definition, and some sample usage.\nNotice that 'defineblind' is itself a blind macro.\n\n$ m4 -d\ndefine(`defineblind', `ifelse(`$#', `0', ``$0'',\n`$0(`$1', `$2', `$'`#', `$'`0')')')\n=>\ndefine(`defineblind', `define(`$1',\n`ifelse(`$3', `0', ``$4'', `$2')')')\n=>\ndefineblind\n=>defineblind\ndefineblind(`foo', `arguments were $*')\n=>\nfoo\n=>foo\nfoo(`bar')\n=>arguments were bar\ndefine(`blah', defn(`foo'))\n=>\nblah\n=>blah\nblah(`a', `b')\n=>arguments were a,b\ndefn(`blah')\n=>ifelse(`$#', `0', ``$0'', `arguments were $*')\n\nAnother interesting composition tactic is argument \"currying\", or\nfactoring a macro that takes multiple arguments for use in a context\nthat provides exactly one argument.\n\n-- Composite: curry (MACRO, ...)\nExpand to a macro call that takes exactly one argument, then\nappends that argument to the original arguments and invokes MACRO\nwith the resulting list of arguments.\n\nA demonstration of currying makes the intent of this macro a little\nmore obvious.  The macro 'stackforeach' mentioned earlier is an example\nof a context that provides exactly one argument to a macro name.  But\ncoupled with currying, we can invoke 'reverse' with two arguments for\neach definition of a macro stack.  This example uses the file\n'm4-1.4.19/examples/curry.m4' included in the distribution.\n\n$ m4 -I examples\ninclude(`curry.m4')include(`stack.m4')\n=>\ndefine(`reverse', `ifelse(`$#', `0', , `$#', `1', ``$1'',\n`reverse(shift($@)), `$1'')')\n=>\npushdef(`a', `1')pushdef(`a', `2')pushdef(`a', `3')\n=>\nstackforeach(`a', `:curry(`reverse', `4')')\n=>:1, 4:2, 4:3, 4\ncurry(`curry', `reverse', `1')(`2')(`3')\n=>3, 2, 1\n\nNow for the implementation.  Notice how 'curry' leaves off with a\nmacro name but no open parenthesis, while still in the middle of\ncollecting arguments for '$1'.  The macro 'curry' is the helper macro\nthat takes one argument, then adds it to the list and finally supplies\nthe closing parenthesis.  The use of a comma inside the 'shift' call\nallows currying to also work for a macro that takes one argument,\nalthough it often makes more sense to invoke that macro directly rather\nthan going through 'curry'.\n\n$ m4 -I examples\nundivert(`curry.m4')dnl\n=>divert(`-1')\n=># curry(macro, args)\n=># Expand to a macro call that takes one argument, then invoke\n=># macro(args, extra).\n=>define(`curry', `$1(shift($@,)$0')\n=>define(`curry', ``$1')')\n=>divert`'dnl\n\nUnfortunately, with M4 1.4.x, 'curry' is unable to handle builtin\ntokens, which are silently flattened to the empty string when passed\nthrough another text macro.  This limitation will be lifted in a future\nrelease of M4.\n\nPutting the last few concepts together, it is possible to copy or\nrename an entire stack of macro definitions.\n\n-- Composite: copy (SOURCE, DEST)\n-- Composite: rename (SOURCE, DEST)\nEnsure that DEST is undefined, then define it to the same stack of\ndefinitions currently in SOURCE.  'copy' leaves SOURCE unchanged,\nwhile 'rename' undefines SOURCE.  There are only a few macros, such\nas 'copy' or 'defn', which cannot be copied via this macro.\n\nThe implementation is relatively straightforward (although since it\nuses 'curry', it is unable to copy builtin macros, such as the second\ndefinition of 'a' as a synonym for 'divnum'.  See if you can design a\nversion that works around this limitation, or *note Answers: Improved\ncopy.).\n\n$ m4 -I examples\ninclude(`curry.m4')include(`stack.m4')\n=>\ndefine(`rename', `copy($@)undefine(`$1')')dnl\ndefine(`copy', `ifdef(`$2', `errprint(`$2 already defined\n')m4exit(`1')',\n`stackforeach(`$1', `curry(`pushdef', `$2')')')')dnl\npushdef(`a', `1')pushdef(`a', defn(`divnum'))pushdef(`a', `2')\n=>\ncopy(`a', `b')\n=>\nrename(`b', `c')\n=>\na b c\n=>2 b 2\npopdef(`a', `c')c a\n=> 0\npopdef(`a', `c')a c\n=>1 1\n",
            "subsections": []
        },
        "File: m4.info,  Node: Debugging,  Next: Input Control,  Prev: Conditionals,  Up: Top": {
            "content": "",
            "subsections": []
        },
        "7 How to debug macros and input": {
            "content": "",
            "subsections": []
        },
        "When writing macros for 'm4', they often do not work as intended on the": {
            "content": "first try (as is the case with most programming languages).\nFortunately, there is support for macro debugging in 'm4'.\n\n* Menu:\n\n* Dumpdef::                     Displaying macro definitions\n* Trace::                       Tracing macro calls\n* Debug Levels::                Controlling debugging output\n* Debug Output::                Saving debugging output\n",
            "subsections": []
        },
        "File: m4.info,  Node: Dumpdef,  Next: Trace,  Up: Debugging": {
            "content": "",
            "subsections": [
                {
                    "name": "7.1 Displaying macro definitions",
                    "content": ""
                }
            ]
        },
        "If you want to see what a name expands into, you can use the builtin": {
            "content": "'dumpdef':\n\n-- Builtin: dumpdef ([NAMES...])\nAccepts any number of arguments.  If called without any arguments,\nit displays the definitions of all known names, otherwise it\ndisplays the definitions of the NAMES given.  The output is printed\nto the current debug file (usually standard error), and is sorted\nby name.  If an unknown name is encountered, a warning is printed.\n\nThe expansion of 'dumpdef' is void.\n\n$ m4 -d\ndefine(`foo', `Hello world.')\n=>\ndumpdef(`foo')\nerror->foo: =>\ndumpdef(`define')\nerror->define: =>\n\nThe last example shows how builtin macros definitions are displayed.",
            "subsections": []
        },
        "The definition that is dumped corresponds to what would occur if the": {
            "content": "macro were to be called at that point, even if other definitions are\nstill live due to redefining a macro during argument collection.\n\n$ m4 -d\npushdef(`f', ``$0'1')pushdef(`f', ``$0'2')\n=>\nf(popdef(`f')dumpdef(`f'))\nerror->f: =>f2\nf(popdef(`f')dumpdef(`f'))\nerror->m4:stdin:3: undefined macro `f'\n=>f1\n\n*Note Debug Levels::, for information on controlling the details of\nthe display.\n",
            "subsections": []
        },
        "File: m4.info,  Node: Trace,  Next: Debug Levels,  Prev: Dumpdef,  Up: Debugging": {
            "content": "",
            "subsections": [
                {
                    "name": "7.2 Tracing macro calls",
                    "content": ""
                }
            ]
        },
        "It is possible to trace macro calls and expansions through the builtins": {
            "content": "'traceon' and 'traceoff':\n\n-- Builtin: traceon ([NAMES...])\n-- Builtin: traceoff ([NAMES...])\nWhen called without any arguments, 'traceon' and 'traceoff' will\nturn tracing on and off, respectively, for all currently defined\nmacros.\n\nWhen called with arguments, only the macros listed in NAMES are\naffected, whether or not they are currently defined.\n\nThe expansion of 'traceon' and 'traceoff' is void.\n\nWhenever a traced macro is called and the arguments have been\ncollected, the call is displayed.  If the expansion of the macro call is\nnot void, the expansion can be displayed after the call.  The output is\nprinted to the current debug file (defaulting to standard error, *note\nDebug Output::).\n\n$ m4 -d\ndefine(`foo', `Hello World.')\n=>\ndefine(`echo', `$@')\n=>\ntraceon(`foo', `echo')\n=>\nfoo\nerror->m4trace: -1- foo -> `Hello World.'\n=>Hello World.\necho(`gnus', `and gnats')\nerror->m4trace: -1- echo(`gnus', `and gnats') -> ``gnus',`and gnats''\n=>gnus,and gnats\n\nThe number between dashes is the depth of the expansion.  It is one\nmost of the time, signifying an expansion at the outermost level, but it\nincreases when macro arguments contain unquoted macro calls.  The\nmaximum number that will appear between dashes is controlled by the\noption '--nesting-limit' (or '-L', *note Invoking m4: Limits control.).",
            "subsections": []
        },
        "Additionally, the option '--trace' (or '-t') can be used to invoke": {
            "content": "'traceon(NAME)' before parsing input.\n\n$ m4 -L 3 -t ifelse\nifelse(`one level')\nerror->m4trace: -1- ifelse\n=>\nifelse(ifelse(ifelse(`three levels')))\nerror->m4trace: -3- ifelse\nerror->m4trace: -2- ifelse\nerror->m4trace: -1- ifelse\n=>\nifelse(ifelse(ifelse(ifelse(`four levels'))))\nerror->m4:stdin:3: recursion limit of 3 exceeded, use -L<N> to change it\n\nTracing by name is an attribute that is preserved whether the macro\nis defined or not.  This allows the selection of macros to trace before\nthose macros are defined.\n\n$ m4 -d\ntraceoff(`foo')\n=>\ntraceon(`foo')\n=>\nfoo\n=>foo\ndefn(`foo')\n=>\ndefine(`foo', `bar')\n=>\nfoo\nerror->m4trace: -1- foo -> `bar'\n=>bar\nundefine(`foo')\n=>\nifdef(`foo', `yes', `no')\n=>no\nindir(`foo')\nerror->m4:stdin:9: undefined macro `foo'\n=>\ndefine(`foo', `blah')\n=>\nfoo\nerror->m4trace: -1- foo -> `blah'\n=>blah\ntraceoff\n=>\nfoo\n=>blah\n\nTracing even works on builtins.  However, 'defn' (*note Defn::) does\nnot transfer tracing status.\n\n$ m4 -d\ntraceon(`traceon')\n=>\ntraceon(`traceoff')\nerror->m4trace: -1- traceon(`traceoff')\n=>\ntraceoff(`traceoff')\nerror->m4trace: -1- traceoff(`traceoff')\n=>\ntraceoff(`traceon')\n=>\ntraceon(`eval', `m4divnum')\n=>\ndefine(`m4eval', defn(`eval'))\n=>\ndefine(`m4divnum', defn(`divnum'))\n=>\neval(divnum)\nerror->m4trace: -1- eval(`0') -> `0'\n=>0\nm4eval(m4divnum)\nerror->m4trace: -2- m4divnum -> `0'\n=>0\n\n*Note Debug Levels::, for information on controlling the details of\nthe display.  The format of the trace output is not specified by POSIX,\nand varies between implementations of 'm4'.\n",
            "subsections": []
        },
        "File: m4.info,  Node: Debug Levels,  Next: Debug Output,  Prev: Trace,  Up: Debugging": {
            "content": "",
            "subsections": [
                {
                    "name": "7.3 Controlling debugging output",
                    "content": "The '-d' option to 'm4' (or '--debug', *note Invoking m4: Debugging\noptions.) controls the amount of details presented in three categories\nof output.  Trace output is requested by 'traceon' (*note Trace::), and\neach line is prefixed by 'm4trace:' in relation to a macro invocation."
                }
            ]
        },
        "Debug output tracks useful events not associated with a macro": {
            "content": "invocation, and each line is prefixed by 'm4debug:'.  Finally, 'dumpdef'\n(*note Dumpdef::) output is affected, with no prefix added to the output\nlines.\n\nThe FLAGS following the option can be one or more of the following:\n\n'a'\nIn trace output, show the actual arguments that were collected\nbefore invoking the macro.  This applies to all macro calls if the\n't' flag is used, otherwise only the macros covered by calls of\n'traceon'.  Arguments are subject to length truncation specified by\nthe command line option '--arglength' (or '-l').\n\n'c'\nIn trace output, show several trace lines for each macro call.  A\nline is shown when the macro is seen, but before the arguments are\ncollected; a second line when the arguments have been collected and\na third line after the call has completed.\n\n'e'\nIn trace output, show the expansion of each macro call, if it is\nnot void.  This applies to all macro calls if the 't' flag is used,\notherwise only the macros covered by calls of 'traceon'.  The\nexpansion is subject to length truncation specified by the command\nline option '--arglength' (or '-l').\n\n'f'\nIn debug and trace output, include the name of the current input\nfile in the output line.\n\n'i'\nIn debug output, print a message each time the current input file\nis changed.\n\n'l'\nIn debug and trace output, include the current input line number in\nthe output line.\n\n'p'\nIn debug output, print a message when a named file is found through\nthe path search mechanism (*note Search Path::), giving the actual\nfile name used.\n\n'q'\nIn trace and dumpdef output, quote actual arguments and macro\nexpansions in the display with the current quotes.  This is useful\nin connection with the 'a' and 'e' flags above.\n\n't'\nIn trace output, trace all macro calls made in this invocation of\n'm4', regardless of the settings of 'traceon'.\n\n'x'\nIn trace output, add a unique 'macro call id' to each line of the\ntrace output.  This is useful in connection with the 'c' flag\nabove.\n\n'V'\nA shorthand for all of the above flags.\n\nIf no flags are specified with the '-d' option, the default is 'aeq'.\nThe examples throughout this manual assume the default flags.\n\nThere is a builtin macro 'debugmode', which allows on-the-fly control\nof the debugging output format:\n\n-- Builtin: debugmode ([FLAGS])\nThe argument FLAGS should be a subset of the letters listed above.\nAs special cases, if the argument starts with a '+', the flags are\nadded to the current debug flags, and if it starts with a '-', they\nare removed.  If no argument is present, all debugging flags are\ncleared (as if no '-d' was given), and with an empty argument the\nflags are reset to the default of 'aeq'.\n\nThe expansion of 'debugmode' is void.\n\n$ m4\ndefine(`foo', `FOO')\n=>\ntraceon(`foo')\n=>\ndebugmode()\n=>\nfoo\nerror->m4trace: -1- foo -> `FOO'\n=>FOO\ndebugmode\n=>\nfoo\nerror->m4trace: -1- foo\n=>FOO\ndebugmode(`+l')\n=>\nfoo\nerror->m4trace:8: -1- foo\n=>FOO\n\nThe following example demonstrates the behavior of length truncation,\nwhen specified on the command line.  Note that each argument and the\nfinal result are individually truncated.  Also, the special tokens for\nbuiltin functions are not truncated.\n\n$ m4 -d -l 6\ndefine(`echo', `$@')debugmode(`+t')\n=>\necho(`1', `long string')\nerror->m4trace: -1- echo(`1', `long s...') -> ``1',`l...'\n=>1,long string\nindir(`echo', defn(`changequote'))\nerror->m4trace: -2- defn(`change...')\nerror->m4trace: -1- indir(`echo', <changequote>) -> ``''\n=>\n\nThis example shows the effects of the debug flags that are not\nrelated to macro tracing.\n\n$ m4 -dip -I examples\nerror->m4debug: input read from stdin\ninclude(`foo')dnl\nerror->m4debug: path search for `foo' found `examples/foo'\nerror->m4debug: input read from examples/foo\n=>bar\nerror->m4debug: input reverted to stdin, line 1\n^D\nerror->m4debug: input exhausted\n",
            "subsections": []
        },
        "File: m4.info,  Node: Debug Output,  Prev: Debug Levels,  Up: Debugging": {
            "content": "",
            "subsections": [
                {
                    "name": "7.4 Saving debugging output",
                    "content": ""
                }
            ]
        },
        "Debug and tracing output can be redirected to files using either the": {
            "content": "'--debugfile' option to 'm4' (*note Invoking m4: Debugging options.), or\nwith the builtin macro 'debugfile':\n\n-- Builtin: debugfile ([FILE])\nSends all further debug and trace output to FILE, opened in append\nmode.  If FILE is the empty string, debug and trace output are\ndiscarded.  If 'debugfile' is called without any arguments, debug\nand trace output are sent to standard error.  This does not affect\nwarnings, error messages, or 'errprint' output, which are always\nsent to standard error.  If FILE cannot be opened, the current\ndebug file is unchanged, and an error is issued.\n\nThe expansion of 'debugfile' is void.\n\n$ m4 -d\ntraceon(`divnum')\n=>\ndivnum(`extra')\nerror->m4:stdin:2: Warning: excess arguments to builtin `divnum' ignored\nerror->m4trace: -1- divnum(`extra') -> `0'\n=>0\ndebugfile()\n=>\ndivnum(`extra')\nerror->m4:stdin:4: Warning: excess arguments to builtin `divnum' ignored\n=>0\ndebugfile\n=>\ndivnum\nerror->m4trace: -1- divnum -> `0'\n=>0\n",
            "subsections": []
        },
        "File: m4.info,  Node: Input Control,  Next: File Inclusion,  Prev: Debugging,  Up: Top": {
            "content": "",
            "subsections": []
        },
        "8 Input control": {
            "content": "",
            "subsections": []
        },
        "This chapter describes various builtin macros for controlling the input": {
            "content": "to 'm4'.\n\n* Menu:\n\n* Dnl::                         Deleting whitespace in input\n* Changequote::                 Changing the quote characters\n* Changecom::                   Changing the comment delimiters\n* Changeword::                  Changing the lexical structure of words\n* M4wrap::                      Saving text until end of input\n",
            "subsections": []
        },
        "File: m4.info,  Node: Dnl,  Next: Changequote,  Up: Input Control": {
            "content": "",
            "subsections": [
                {
                    "name": "8.1 Deleting whitespace in input",
                    "content": "The builtin 'dnl' stands for \"Discard to Next Line\":\n\n-- Builtin: dnl\nAll characters, up to and including the next newline, are discarded\nwithout performing any macro expansion.  A warning is issued if the\nend of the file is encountered without a newline.\n\nThe expansion of 'dnl' is void.\n\nIt is often used in connection with 'define', to remove the newline\nthat follows the call to 'define'.  Thus\n\ndefine(`foo', `Macro `foo'.')dnl A very simple macro, indeed.\nfoo\n=>Macro foo.\n\nThe input up to and including the next newline is discarded, as\nopposed to the way comments are treated (*note Comments::).\n\nUsually, 'dnl' is immediately followed by an end of line or some\nother whitespace.  GNU 'm4' will produce a warning diagnostic if 'dnl'\nis followed by an open parenthesis.  In this case, 'dnl' will collect\nand process all arguments, looking for a matching close parenthesis."
                }
            ]
        },
        "All predictable side effects resulting from this collection will take": {
            "content": "place.  'dnl' will return no output.  The input following the matching\nclose parenthesis up to and including the next newline, on whatever line\ncontaining it, will still be discarded.\n\ndnl(`args are ignored, but side effects occur',\ndefine(`foo', `like this')) while this text is ignored: undefine(`foo')\nerror->m4:stdin:1: Warning: excess arguments to builtin `dnl' ignored\nSee how `foo' was defined, foo?\n=>See how foo was defined, like this?\n\nIf the end of file is encountered without a newline character, a\nwarning is issued and dnl stops consuming input.\n\nm4wrap(`m4wrap(`2 hi\n')0 hi dnl 1 hi')\n=>\ndefine(`hi', `HI')\n=>\n^D\nerror->m4:stdin:1: Warning: end of file treated as newline\n=>0 HI 2 HI\n",
            "subsections": []
        },
        "File: m4.info,  Node: Changequote,  Next: Changecom,  Prev: Dnl,  Up: Input Control": {
            "content": "",
            "subsections": [
                {
                    "name": "8.2 Changing the quote characters",
                    "content": ""
                }
            ]
        },
        "The default quote delimiters can be changed with the builtin": {
            "content": "'changequote':\n\n-- Builtin: changequote ([START = `], [END = '])\nThis sets START as the new begin-quote delimiter and END as the new\nend-quote delimiter.  If both arguments are missing, the default\nquotes ('`' and ''') are used.  If START is void, then quoting is\ndisabled.  Otherwise, if END is missing or void, the default\nend-quote delimiter (''') is used.  The quote delimiters can be of\nany length.\n\nThe expansion of 'changequote' is void.\n\nchangequote(`[', `]')\n=>\ndefine([foo], [Macro [foo].])\n=>\nfoo\n=>Macro foo.\n\nThe quotation strings can safely contain non-ASCII characters.\n\ndefine(`a', `b')\n=>\n??a>>\n=>??b>>\nchangequote(`??', `>>')\n=>\n??a>>\n=>a\n\nIf no single character is appropriate, START and END can be of any\nlength.  Other implementations cap the delimiter length to five\ncharacters, but GNU has no inherent limit.\n\nchangequote(`[[[', `]]]')\n=>\ndefine([[[foo]]], [[[Macro [[[[[foo]]]]].]]])\n=>\nfoo\n=>Macro [[foo]].\n\nCalling 'changequote' with START as the empty string will effectively\ndisable the quoting mechanism, leaving no way to quote text.  However,\nusing an empty string is not portable, as some other implementations of\n'm4' revert to the default quoting, while others preserve the prior\nnon-empty delimiter.  If START is not empty, then an empty END will use\nthe default end-quote delimiter of ''', as otherwise, it would be\nimpossible to end a quoted string.  Again, this is not portable, as some\nother 'm4' implementations reuse START as the end-quote delimiter, while\nothers preserve the previous non-empty value.  Omitting both arguments\nrestores the default begin-quote and end-quote delimiters; fortunately\nthis behavior is portable to all implementations of 'm4'.\n\ndefine(`foo', `Macro `FOO'.')\n=>\nchangequote(`', `')\n=>\nfoo\n=>Macro `FOO'.\n`foo'\n=>`Macro `FOO'.'\nchangequote(`,)\n=>\nfoo\n=>Macro FOO.\n\nThere is no way in 'm4' to quote a string containing an unmatched\nbegin-quote, except using 'changequote' to change the current quotes.\n\nIf the quotes should be changed from, say, '[' to '[[', temporary\nquote characters have to be defined.  To achieve this, two calls of\n'changequote' must be made, one for the temporary quotes and one for the\nnew quotes.\n\nMacros are recognized in preference to the begin-quote string, so if\na prefix of START can be recognized as part of a potential macro name,\nthe quoting mechanism is effectively disabled.  Unless you use\n'changeword' (*note Changeword::), this means that START should not\nbegin with a letter, digit, or '' (underscore).  However, even though\nquoted strings are not recognized, the quote characters can still be\ndiscerned in macro expansion and in trace output.\n\ndefine(`echo', `$@')\n=>\ndefine(`hi', `HI')\n=>\nchangequote(`q', `Q')\n=>\nq hi Q hi\n=>q HI Q HI\necho(hi)\n=>qHIQ\nchangequote\n=>\nchangequote(`-', `EOF')\n=>\n- hi EOF hi\n=> hi  HI\nchangequote\n=>\nchangequote(`1', `2')\n=>\nhi1hi2\n=>hi1hi2\nhi 1hi2\n=>HI hi\n\nQuotes are recognized in preference to argument collection.  In\nparticular, if START is a single '(', then argument collection is\neffectively disabled.  For portability with other implementations, it is\na good idea to avoid '(', ',', and ')' as the first character in START.\n\ndefine(`echo', `$#:$@:')\n=>\ndefine(`hi', `HI')\n=>\nchangequote(`(',`)')\n=>\necho(hi)\n=>0::hi\nchangequote\n=>\nchangequote(`((', `))')\n=>\necho(hi)\n=>1:HI:\necho((hi))\n=>0::hi\nchangequote\n=>\nchangequote(`,', `)')\n=>\necho(hi,hi)bye)\n=>1:HIhibye:\n\nHowever, if you are not worried about portability, using '(' and ')'\nas quoting characters has an interesting property--you can use it to\ncompute a quoted string containing the expansion of any quoted text, as\nlong as the expansion results in both balanced quotes and balanced\nparentheses.  The trick is realizing 'expand' uses '$1' unquoted, to\ntrigger its expansion using the normal quoting characters, but uses\nextra parentheses to group unquoted commas that occur in the expansion\nwithout consuming whitespace following those commas.  Then 'expand'\nuses 'changequote' to convert the extra parentheses back into quoting\ncharacters.  Note that it takes two more 'changequote' invocations to\nrestore the original quotes.  Contrast the behavior on whitespace when\nusing '$*', via 'quote', to attempt the same task.\n\nchangequote(`[', `]')dnl\ndefine([a], [1, (b)])dnl\ndefine([b], [2])dnl\ndefine([quote], [[$*]])dnl\ndefine([expand], [$0(($1))])dnl\ndefine([expand],\n[changequote([(], [)])$1changequote`'changequote(`[', `]')])dnl\nexpand([a, a, [a, a], [[a, a]]])\n=>1, (2), 1, (2), a, a, [a, a]\nquote(a, a, [a, a], [[a, a]])\n=>1,(2),1,(2),a, a,[a, a]\n\nIf END is a prefix of START, the end-quote will be recognized in\npreference to a nested begin-quote.  In particular, changing the quotes\nto have the same string for START and END disables nesting of quotes.",
            "subsections": []
        },
        "When quote nesting is disabled, it is impossible to double-quote strings": {
            "content": "across macro expansions, so using the same string is not done very\noften.\n\ndefine(`hi', `HI')\n=>\nchangequote(`\"\"', `\"')\n=>\n\"\"hi\"\"\"hi\"\n=>hihi\n\"\"hi\" \"\"hi\"\n=>hi hi\n\"\"hi\"\" \"hi\"\n=>hi\" \"HI\"\nchangequote\n=>\n`hi`hi'hi'\n=>hi`hi'hi\nchangequote(`\"', `\"')\n=>\n\"hi\"hi\"hi\"\n=>hiHIhi\n\nIt is an error if the end of file occurs within a quoted string.\n\n`hello world'\n=>hello world\n`dangling quote\n^D\nerror->m4:stdin:2: ERROR: end of file in string\n\nifelse(`dangling quote\n^D\nerror->m4:stdin:1: ERROR: end of file in string\n",
            "subsections": []
        },
        "File: m4.info,  Node: Changecom,  Next: Changeword,  Prev: Changequote,  Up: Input Control": {
            "content": "",
            "subsections": [
                {
                    "name": "8.3 Changing the comment delimiters",
                    "content": ""
                }
            ]
        },
        "The default comment delimiters can be changed with the builtin macro": {
            "content": "'changecom':\n\n-- Builtin: changecom ([START], [END = <NL>])\nThis sets START as the new begin-comment delimiter and END as the\nnew end-comment delimiter.  If both arguments are missing, or START\nis void, then comments are disabled.  Otherwise, if END is missing\nor void, the default end-comment delimiter of newline is used.  The\ncomment delimiters can be of any length.\n\nThe expansion of 'changecom' is void.\n\ndefine(`comment', `COMMENT')\n=>\n# A normal comment\n=># A normal comment\nchangecom(`/*', `*/')\n=>\n# Not a comment anymore\n=># Not a COMMENT anymore\nBut: /* this is a comment now */ while this is not a comment\n=>But: /* this is a comment now */ while this is not a COMMENT\n\nNote how comments are copied to the output, much as if they were\nquoted strings.  If you want the text inside a comment expanded, quote\nthe begin-comment delimiter.\n\nCalling 'changecom' without any arguments, or with START as the empty\nstring, will effectively disable the commenting mechanism.  To restore\nthe original comment start of '#', you must explicitly ask for it.  If\nSTART is not empty, then an empty END will use the default end-comment\ndelimiter of newline, as otherwise, it would be impossible to end a\ncomment.  However, this is not portable, as some other 'm4'\nimplementations preserve the previous non-empty delimiters instead.\n\ndefine(`comment', `COMMENT')\n=>\nchangecom\n=>\n# Not a comment anymore\n=># Not a COMMENT anymore\nchangecom(`#', `')\n=>\n# comment again\n=># comment again\n\nThe comment strings can safely contain non-ASCII characters.\n\ndefine(`a', `b')\n=>\n??a>>\n=>??b>>\nchangecom(`??', `>>')\n=>\n??a>>\n=>??a>>\n\nIf no single character is appropriate, START and END can be of any\nlength.  Other implementations cap the delimiter length to five\ncharacters, but GNU has no inherent limit.\n\nComments are recognized in preference to macros.  However, this is\nnot compatible with other implementations, where macros and even quoting\ntakes precedence over comments, so it may change in a future release.",
            "subsections": []
        },
        "For portability, this means that START should not begin with a letter,": {
            "content": "digit, or '' (underscore), and that neither the start-quote nor the\nstart-comment string should be a prefix of the other.\n\ndefine(`hi', `HI')\n=>\ndefine(`hi1hi2', `hello')\n=>\nchangecom(`q', `Q')\n=>\nq hi Q hi\n=>q hi Q HI\nchangecom(`1', `2')\n=>\nhi1hi2\n=>hello\nhi 1hi2\n=>HI 1hi2\n\nComments are recognized in preference to argument collection.  In\nparticular, if START is a single '(', then argument collection is\neffectively disabled.  For portability with other implementations, it is\na good idea to avoid '(', ',', and ')' as the first character in START.\n\ndefine(`echo', `$#:$*:$@:')\n=>\ndefine(`hi', `HI')\n=>\nchangecom(`(',`)')\n=>\necho(hi)\n=>0:::(hi)\nchangecom\n=>\nchangecom(`((', `))')\n=>\necho(hi)\n=>1:HI:HI:\necho((hi))\n=>0:::((hi))\nchangecom(`,', `)')\n=>\necho(hi,hi)bye)\n=>1:HI,hi)bye:HI,hi)bye:\nchangecom\n=>\necho(hi,`,`'hi',hi)\n=>3:HI,,HI,HI:HI,,`'hi,HI:\necho(hi,`,`'hi',hi`'changecom(`,,', `hi'))\n=>3:HI,,`'hi,HI:HI,,`'hi,HI:\n\nIt is an error if the end of file occurs within a comment.\n\nchangecom(`/*', `*/')\n=>\n/*dangling comment\n^D\nerror->m4:stdin:2: ERROR: end of file in comment\n",
            "subsections": []
        },
        "File: m4.info,  Node: Changeword,  Next: M4wrap,  Prev: Changecom,  Up: Input Control": {
            "content": "",
            "subsections": [
                {
                    "name": "8.4 Changing the lexical structure of words",
                    "content": "The macro 'changeword' and all associated functionality is\nexperimental.  It is only available if the '--enable-changeword'\noption was given to 'configure', at GNU 'm4' installation time.\nThe functionality will go away in the future, to be replaced by\nother new features that are more efficient at providing the same\ncapabilities.  Do not rely on it.  Please direct your comments\nabout it the same way you would do for bugs.\n\nA file being processed by 'm4' is split into quoted strings, words\n(potential macro names) and simple tokens (any other single character).\nInitially a word is defined by the following regular expression:\n\n[a-zA-Z][a-zA-Z0-9]*\n\nUsing 'changeword', you can change this regular expression:\n\n-- Optional builtin: changeword (REGEX)\nChanges the regular expression for recognizing macro names to be\nREGEX.  If REGEX is empty, use '[a-zA-Z][a-zA-Z0-9]*'.  REGEX\nmust obey the constraint that every prefix of the desired final\npattern is also accepted by the regular expression.  If REGEX\ncontains grouping parentheses, the macro invoked is the portion\nthat matched the first group, rather than the entire matching\nstring.\n\nThe expansion of 'changeword' is void.  The macro 'changeword' is\nrecognized only with parameters.\n\nRelaxing the lexical rules of 'm4' might be useful (for example) if\nyou wanted to apply translations to a file of numbers:\n\nifdef(`changeword', `', `errprint(` skipping: no changeword support\n')m4exit(`77')')dnl\nchangeword(`[a-zA-Z0-9]+')\n=>\ndefine(`1', `0')1\n=>0\n\nTightening the lexical rules is less useful, because it will\ngenerally make some of the builtins unavailable.  You could use it to\nprevent accidental call of builtins, for example:\n\nifdef(`changeword', `', `errprint(` skipping: no changeword support\n')m4exit(`77')')dnl\ndefine(`indir', defn(`indir'))\n=>\nchangeword(`[a-zA-Z0-9]*')\n=>\nesyscmd(`foo')\n=>esyscmd(foo)\nindir(`esyscmd', `echo hi')\n=>hi\n=>\n\nBecause 'm4' constructs its words a character at a time, there is a\nrestriction on the regular expressions that may be passed to\n'changeword'.  This is that if your regular expression accepts 'foo', it\nmust also accept 'f' and 'fo'.\n\nifdef(`changeword', `', `errprint(` skipping: no changeword support\n')m4exit(`77')')dnl\ndefine(`foo\n', `bar\n')\n=>\ndnl This example wants to recognize changeword, dnl, and `foo\\n'.\ndnl First, we check that our regexp will match.\nregexp(`changeword', `[cd][a-z]*\\|foo[\n]')\n=>0\nregexp(`foo\n', `[cd][a-z]*\\|foo[\n]')\n=>0\nregexp(`f', `[cd][a-z]*\\|foo[\n]')\n=>-1\nfoo\n=>foo\nchangeword(`[cd][a-z]*\\|foo[\n]')\n=>\ndnl Even though `foo\\n' matches, we forgot to allow `f'.\nfoo\n=>foo\nchangeword(`[cd][a-z]*\\|fo*[\n]?')\n=>\ndnl Now we can call `foo\\n'.\nfoo\n=>bar\n\n'changeword' has another function.  If the regular expression\nsupplied contains any grouped subexpressions, then text outside the\nfirst of these is discarded before symbol lookup.  So:\n\nifdef(`changeword', `', `errprint(` skipping: no changeword support\n')m4exit(`77')')dnl\nifdef(`unix', ,\n`errprint(` skipping: syscmd does not have unix semantics\n')m4exit(`77')')dnl\nchangecom(`/*', `*/')dnl\ndefine(`foo', `bar')dnl\nchangeword(`#\\([a-zA-Z0-9]*\\)')\n=>\n#esyscmd(`echo foo \\#foo')\n=>foo bar\n=>\n\n'm4' now requires a '#' mark at the beginning of every macro\ninvocation, so one can use 'm4' to preprocess plain text without losing\nvarious words like 'divert'.\n\nIn 'm4', macro substitution is based on text, while in TeX, it is\nbased on tokens.  'changeword' can throw this difference into relief."
                }
            ]
        },
        "For example, here is the same idea represented in TeX and 'm4'.  First,": {
            "content": "the TeX version:\n\n\\def\\a{\\message{Hello}}\n\\catcode`\\@=0\n\\catcode`\\\\=12\n@a\n@bye\n=>Hello\n\nThen, the 'm4' version:\n\nifdef(`changeword', `', `errprint(` skipping: no changeword support\n')m4exit(`77')')dnl\ndefine(`a', `errprint(`Hello')')dnl\nchangeword(`@\\([a-zA-Z0-9]*\\)')\n=>\n@a\n=>errprint(Hello)\n\nIn the TeX example, the first line defines a macro 'a' to print the\nmessage 'Hello'.  The second line defines <@> to be usable instead of\n<\\> as an escape character.  The third line defines <\\> to be a normal\nprinting character, not an escape.  The fourth line invokes the macro\n'a'.  So, when TeX is run on this file, it displays the message 'Hello'.\n\nWhen the 'm4' example is passed through 'm4', it outputs\n'errprint(Hello)'.  The reason for this is that TeX does lexical\nanalysis of macro definition when the macro is defined.  'm4' just\nstores the text, postponing the lexical analysis until the macro is\nused.\n\nYou should note that using 'changeword' will slow 'm4' down by a\nfactor of about seven, once it is changed to something other than the\ndefault regular expression.  You can invoke 'changeword' with the empty\nstring to restore the default word definition, and regain the parsing\nspeed.\n",
            "subsections": []
        },
        "File: m4.info,  Node: M4wrap,  Prev: Changeword,  Up: Input Control": {
            "content": "",
            "subsections": [
                {
                    "name": "8.5 Saving text until end of input",
                    "content": ""
                }
            ]
        },
        "It is possible to 'save' some text until the end of the normal input has": {
            "content": "been seen.  Text can be saved, to be read again by 'm4' when the normal\ninput has been exhausted.  This feature is normally used to initiate\ncleanup actions before normal exit, e.g., deleting temporary files.\n\nTo save input text, use the builtin 'm4wrap':\n\n-- Builtin: m4wrap (STRING, ...)\nStores STRING in a safe place, to be reread when end of input is\nreached.  As a GNU extension, additional arguments are concatenated\nwith a space to the STRING.\n\nThe expansion of 'm4wrap' is void.  The macro 'm4wrap' is\nrecognized only with parameters.\n\ndefine(`cleanup', `This is the `cleanup' action.\n')\n=>\nm4wrap(`cleanup')\n=>\nThis is the first and last normal input line.\n=>This is the first and last normal input line.\n^D\n=>This is the cleanup action.\n\nThe saved input is only reread when the end of normal input is seen,\nand not if 'm4exit' is used to exit 'm4'.\n\nIt is safe to call 'm4wrap' from saved text, but then the order in\nwhich the saved text is reread is undefined.  If 'm4wrap' is not used\nrecursively, the saved pieces of text are reread in the opposite order\nin which they were saved (LIFO--last in, first out).  However, this\nbehavior is likely to change in a future release, to match POSIX, so you\nshould not depend on this order.\n\nIt is possible to emulate POSIX behavior even with older versions of\nGNU M4 by including the file 'm4-1.4.19/examples/wrapfifo.m4' from the\ndistribution:\n\n$ m4 -I examples\nundivert(`wrapfifo.m4')dnl\n=>dnl Redefine m4wrap to have FIFO semantics.\n=>define(`m4wraplevel', `0')dnl\n=>define(`m4wrap',\n=>`ifdef(`m4wrap'm4wraplevel,\n=>       `define(`m4wrap'm4wraplevel,\n=>               defn(`m4wrap'm4wraplevel)`$1')',\n=>       `builtin(`m4wrap', `define(`m4wraplevel',\n=>                                  incr(m4wraplevel))dnl\n=>m4wrap'm4wraplevel)dnl\n=>define(`m4wrap'm4wraplevel, `$1')')')dnl\ninclude(`wrapfifo.m4')\n=>\nm4wrap(`a`'m4wrap(`c\n', `d')')m4wrap(`b')\n=>\n^D\n=>abc\n\nIt is likewise possible to emulate LIFO behavior without resorting to\nthe GNU M4 extension of 'builtin', by including the file\n'm4-1.4.19/examples/wraplifo.m4' from the distribution.  (Unfortunately,\nboth examples shown here share some subtle bugs.  See if you can find\nand correct them; or *note Answers: Improved m4wrap.).\n\n$ m4 -I examples\nundivert(`wraplifo.m4')dnl\n=>dnl Redefine m4wrap to have LIFO semantics.\n=>define(`m4wraplevel', `0')dnl\n=>define(`m4wrap', defn(`m4wrap'))dnl\n=>define(`m4wrap',\n=>`ifdef(`m4wrap'm4wraplevel,\n=>       `define(`m4wrap'm4wraplevel,\n=>               `$1'defn(`m4wrap'm4wraplevel))',\n=>       `m4wrap(`define(`m4wraplevel', incr(m4wraplevel))dnl\n=>m4wrap'm4wraplevel)dnl\n=>define(`m4wrap'm4wraplevel, `$1')')')dnl\ninclude(`wraplifo.m4')\n=>\nm4wrap(`a`'m4wrap(`c\n', `d')')m4wrap(`b')\n=>\n^D\n=>bac\n\nHere is an example of implementing a factorial function using\n'm4wrap':\n\ndefine(`f', `ifelse(`$1', `0', `Answer: 0!=1\n', eval(`$1>1'), `0', `Answer: $2$1=eval(`$2$1')\n', `m4wrap(`f(decr(`$1'), `$2$1*')')')')\n=>\nf(`10')\n=>\n^D\n=>Answer: 10*9*8*7*6*5*4*3*2*1=3628800\n\nInvocations of 'm4wrap' at the same recursion level are concatenated\nand rescanned as usual:\n\ndefine(`aa', `AA\n')\n=>\nm4wrap(`a')m4wrap(`a')\n=>\n^D\n=>AA\n\nhowever, the transition between recursion levels behaves like an end of\nfile condition between two input files.\n\nm4wrap(`m4wrap(`)')len(abc')\n=>\n^D\nerror->m4:stdin:1: ERROR: end of file in argument list\n",
            "subsections": []
        },
        "File: m4.info,  Node: File Inclusion,  Next: Diversions,  Prev: Input Control,  Up: Top": {
            "content": "",
            "subsections": []
        },
        "9 File inclusion": {
            "content": "'m4' allows you to include named files at any point in the input.\n\n* Menu:\n\n* Include::                     Including named files\n* Search Path::                 Searching for include files\n",
            "subsections": []
        },
        "File: m4.info,  Node: Include,  Next: Search Path,  Up: File Inclusion": {
            "content": "",
            "subsections": [
                {
                    "name": "9.1 Including named files",
                    "content": "There are two builtin macros in 'm4' for including files:\n\n-- Builtin: include (FILE)\n-- Builtin: sinclude (FILE)\nBoth macros cause the file named FILE to be read by 'm4'.  When the\nend of the file is reached, input is resumed from the previous\ninput file.\n\nThe expansion of 'include' and 'sinclude' is therefore the contents\nof FILE.\n\nIf FILE does not exist, is a directory, or cannot otherwise be\nread, the expansion is void, and 'include' will fail with an error\nwhile 'sinclude' is silent.  The empty string counts as a file that\ndoes not exist.\n\nThe macros 'include' and 'sinclude' are recognized only with\nparameters.\n\ninclude(`none')\nerror->m4:stdin:1: cannot open `none': No such file or directory\n=>\ninclude()\nerror->m4:stdin:2: cannot open `': No such file or directory\n=>\nsinclude(`none')\n=>\nsinclude()\n=>\n\nThe rest of this section assumes that 'm4' is invoked with the '-I'\noption (*note Invoking m4: Preprocessor features.) pointing to the\n'm4-1.4.19/examples' directory shipped as part of the GNU 'm4' package."
                }
            ]
        },
        "The file 'm4-1.4.19/examples/incl.m4' in the distribution contains the": {
            "content": "lines:\n\n$ cat examples/incl.m4\n=>Include file start\n=>foo\n=>Include file end\n\nNormally file inclusion is used to insert the contents of a file into\nthe input stream.  The contents of the file will be read by 'm4' and\nmacro calls in the file will be expanded:\n\n$ m4 -I examples\ndefine(`foo', `FOO')\n=>\ninclude(`incl.m4')\n=>Include file start\n=>FOO\n=>Include file end\n=>\n\nThe fact that 'include' and 'sinclude' expand to the contents of the\nfile can be used to define macros that operate on entire files.  Here is\nan example, which defines 'bar' to expand to the contents of 'incl.m4':\n\n$ m4 -I examples\ndefine(`bar', include(`incl.m4'))\n=>\nThis is `bar':  >>bar<<\n=>This is bar:  >>Include file start\n=>foo\n=>Include file end\n=><<\n\nThis use of 'include' is not trivial, though, as files can contain\nquotes, commas, and parentheses, which can interfere with the way the\n'm4' parser works.  GNU 'm4' seamlessly concatenates the file contents\nwith the next character, even if the included file ended in the middle\nof a comment, string, or macro call.  These conditions are only treated\nas end of file errors if specified as input files on the command line.\n\nIn GNU 'm4', an alternative method of reading files is using\n'undivert' (*note Undivert::) on a named file.\n",
            "subsections": []
        },
        "File: m4.info,  Node: Search Path,  Prev: Include,  Up: File Inclusion": {
            "content": "",
            "subsections": [
                {
                    "name": "9.2 Searching for include files",
                    "content": "GNU 'm4' allows included files to be found in other directories than the\ncurrent working directory.\n\nIf the '--prepend-include' or '-B' command-line option was provided\n(*note Invoking m4: Preprocessor features.), those directories are\nsearched first, in reverse order that those options were listed on the\ncommand line.  Then 'm4' looks in the current working directory.  Next\ncomes the directories specified with the '--include' or '-I' option, in\nthe order found on the command line.  Finally, if the 'M4PATH'\nenvironment variable is set, it is expected to contain a colon-separated\nlist of directories, which will be searched in order.\n\nIf the automatic search for include-files causes trouble, the 'p'\ndebug flag (*note Debug Levels::) can help isolate the problem.\n"
                }
            ]
        },
        "File: m4.info,  Node: Diversions,  Next: Text handling,  Prev: File Inclusion,  Up: Top": {
            "content": "",
            "subsections": []
        },
        "10 Diverting and undiverting output": {
            "content": "",
            "subsections": []
        },
        "Diversions are a way of temporarily saving output.  The output of 'm4'": {
            "content": "can at any time be diverted to a temporary file, and be reinserted into\nthe output stream, \"undiverted\", again at a later time.\n\nNumbered diversions are counted from 0 upwards, diversion number 0\nbeing the normal output stream.  GNU 'm4' tries to keep diversions in\nmemory.  However, there is a limit to the overall memory usable by all\ndiversions taken together (512K, currently).  When this maximum is about\nto be exceeded, a temporary file is opened to receive the contents of\nthe biggest diversion still in memory, freeing this memory for other\ndiversions.  When creating the temporary file, 'm4' honors the value of\nthe environment variable 'TMPDIR', and falls back to '/tmp'.  Thus, the\namount of available disk space provides the only real limit on the\nnumber and aggregate size of diversions.\n\nDiversions make it possible to generate output in a different order\nthan the input was read.  It is possible to implement topological\nsorting dependencies.  For example, GNU Autoconf makes use of diversions\nunder the hood to ensure that the expansion of a prerequisite macro\nappears in the output prior to the expansion of a dependent macro,\nregardless of which order the two macros were invoked in the user's\ninput file.\n\n* Menu:\n\n* Divert::                      Diverting output\n* Undivert::                    Undiverting output\n* Divnum::                      Diversion numbers\n* Cleardivert::                 Discarding diverted text\n",
            "subsections": []
        },
        "File: m4.info,  Node: Divert,  Next: Undivert,  Up: Diversions": {
            "content": "",
            "subsections": [
                {
                    "name": "10.1 Diverting output",
                    "content": "Output is diverted using 'divert':\n\n-- Builtin: divert ([NUMBER = 0])\nThe current diversion is changed to NUMBER.  If NUMBER is left out\nor empty, it is assumed to be zero.  If NUMBER cannot be parsed,\nthe diversion is unchanged.\n\nThe expansion of 'divert' is void.\n\nWhen all the 'm4' input will have been processed, all existing\ndiversions are automatically undiverted, in numerical order.\n\ndivert(`1')\nThis text is diverted.\ndivert\n=>\nThis text is not diverted.\n=>This text is not diverted.\n^D\n=>\n=>This text is diverted.\n\nSeveral calls of 'divert' with the same argument do not overwrite the\nprevious diverted text, but append to it.  Diversions are printed after\nany wrapped text is expanded.\n\ndefine(`text', `TEXT')\n=>\ndivert(`1')`diverted text.'\ndivert\n=>\nm4wrap(`Wrapped text precedes ')\n=>\n^D\n=>Wrapped TEXT precedes diverted text.\n\nIf output is diverted to a negative diversion, it is simply\ndiscarded.  This can be used to suppress unwanted output.  A common\nexample of unwanted output is the trailing newlines after macro\ndefinitions.  Here is a common programming idiom in 'm4' for avoiding\nthem.\n\ndivert(`-1')\ndefine(`foo', `Macro `foo'.')\ndefine(`bar', `Macro `bar'.')\ndivert\n=>\n\nTraditional implementations only supported ten diversions.  But as a\nGNU extension, diversion numbers can be as large as positive integers\nwill allow, rather than treating a multi-digit diversion number as a\nrequest to discard text.\n\ndivert(eval(`1<<28'))world\ndivert(`2')hello\n^D\n=>hello\n=>world\n\nNote that 'divert' is an English word, but also an active macro\nwithout arguments.  When processing plain text, the word might appear in\nnormal text and be unintentionally swallowed as a macro invocation.  One\nway to avoid this is to use the '-P' option to rename all builtins\n(*note Invoking m4: Operation modes.).  Another is to write a wrapper\nthat requires a parameter to be recognized.\n\nWe decided to divert the stream for irrigation.\n=>We decided to  the stream for irrigation.\ndefine(`divert', `ifelse(`$#', `0', ``$0'', `builtin(`$0', $@)')')\n=>\ndivert(`-1')\nIgnored text.\ndivert(`0')\n=>\nWe decided to divert the stream for irrigation.\n=>We decided to divert the stream for irrigation.\n"
                }
            ]
        },
        "File: m4.info,  Node: Undivert,  Next: Divnum,  Prev: Divert,  Up: Diversions": {
            "content": "",
            "subsections": [
                {
                    "name": "10.2 Undiverting output",
                    "content": "Diverted text can be undiverted explicitly using the builtin 'undivert':\n\n-- Builtin: undivert ([DIVERSIONS...])\nUndiverts the numeric DIVERSIONS given by the arguments, in the\norder given.  If no arguments are supplied, all diversions are\nundiverted, in numerical order.\n\nAs a GNU extension, DIVERSIONS may contain non-numeric strings,\nwhich are treated as the names of files to copy into the output\nwithout expansion.  A warning is issued if a file could not be\nopened.\n\nThe expansion of 'undivert' is void.\n\ndivert(`1')\nThis text is diverted.\ndivert\n=>\nThis text is not diverted.\n=>This text is not diverted.\nundivert(`1')\n=>\n=>This text is diverted.\n=>\n\nNotice the last two blank lines.  One of them comes from the newline\nfollowing 'undivert', the other from the newline that followed the\n'divert'!  A diversion often starts with a blank line like this.\n\nWhen diverted text is undiverted, it is not reread by 'm4', but\nrather copied directly to the current output, and it is therefore not an\nerror to undivert into a diversion.  Undiverting the empty string is the\nsame as specifying diversion 0; in either case nothing happens since the\noutput has already been flushed.\n\ndivert(`1')diverted text\ndivert\n=>\nundivert()\n=>\nundivert(`0')\n=>\nundivert\n=>diverted text\n=>\ndivert(`1')more\ndivert(`2')undivert(`1')diverted text`'divert\n=>\nundivert(`1')\n=>\nundivert(`2')\n=>more\n=>diverted text\n\nWhen a diversion has been undiverted, the diverted text is discarded,\nand it is not possible to bring back diverted text more than once.\n\ndivert(`1')\nThis text is diverted first.\ndivert(`0')undivert(`1')dnl\n=>\n=>This text is diverted first.\nundivert(`1')\n=>\ndivert(`1')\nThis text is also diverted but not appended.\ndivert(`0')undivert(`1')dnl\n=>\n=>This text is also diverted but not appended.\n\nAttempts to undivert the current diversion are silently ignored."
                }
            ]
        },
        "Thus, when the current diversion is not 0, the current diversion does": {
            "content": "not get rearranged among the other diversions.\n\ndivert(`1')one\ndivert(`2')two\ndivert(`3')three\ndivert(`2')undivert`'dnl\ndivert`'undivert`'dnl\n=>two\n=>one\n=>three\n\nGNU 'm4' allows named files to be undiverted.  Given a non-numeric\nargument, the contents of the file named will be copied, uninterpreted,\nto the current output.  This complements the builtin 'include' (*note",
            "subsections": []
        },
        "Include::).  To illustrate the difference, assume the file 'foo'": {
            "content": "contains:\n\n$ cat foo\nbar\n\nthen\n\ndefine(`bar', `BAR')\n=>\nundivert(`foo')\n=>bar\n=>\ninclude(`foo')\n=>BAR\n=>\n\nIf the file is not found (or cannot be read), an error message is\nissued, and the expansion is void.  It is possible to intermix files and\ndiversion numbers.\n\ndivert(`1')diversion one\ndivert(`2')undivert(`foo')dnl\ndivert(`3')diversion three\ndivert`'dnl\nundivert(`1', `2', `foo', `3')dnl\n=>diversion one\n=>bar\n=>bar\n=>diversion three\n",
            "subsections": []
        },
        "File: m4.info,  Node: Divnum,  Next: Cleardivert,  Prev: Undivert,  Up: Diversions": {
            "content": "",
            "subsections": [
                {
                    "name": "10.3 Diversion numbers",
                    "content": "The current diversion is tracked by the builtin 'divnum':\n\n-- Builtin: divnum\nExpands to the number of the current diversion.\n\nInitial divnum\n=>Initial 0\ndivert(`1')\nDiversion one: divnum\ndivert(`2')\nDiversion two: divnum\n^D\n=>\n=>Diversion one: 1\n=>\n=>Diversion two: 2\n"
                }
            ]
        },
        "File: m4.info,  Node: Cleardivert,  Prev: Divnum,  Up: Diversions": {
            "content": "",
            "subsections": [
                {
                    "name": "10.4 Discarding diverted text",
                    "content": ""
                }
            ]
        },
        "Often it is not known, when output is diverted, whether the diverted": {
            "content": "text is actually needed.  Since all non-empty diversion are brought back\non the main output stream when the end of input is seen, a method of\ndiscarding a diversion is needed.  If all diversions should be\ndiscarded, the easiest is to end the input to 'm4' with 'divert(`-1')'\nfollowed by an explicit 'undivert':\n\ndivert(`1')\nDiversion one: divnum\ndivert(`2')\nDiversion two: divnum\ndivert(`-1')\nundivert\n^D\n\nNo output is produced at all.\n\nClearing selected diversions can be done with the following macro:\n\n-- Composite: cleardivert ([DIVERSIONS...])\nDiscard the contents of each of the listed numeric DIVERSIONS.\n\ndefine(`cleardivert',\n`pushdef(`n', divnum)divert(`-1')undivert($@)divert(n)popdef(`n')')\n=>\n\nIt is called just like 'undivert', but the effect is to clear the\ndiversions, given by the arguments.  (This macro has a nasty bug!  You\nshould try to see if you can find it and correct it; or *note Answers:\nImproved cleardivert.).\n",
            "subsections": []
        },
        "File: m4.info,  Node: Text handling,  Next: Arithmetic,  Prev: Diversions,  Up: Top": {
            "content": "",
            "subsections": []
        },
        "11 Macros for text handling": {
            "content": "",
            "subsections": []
        },
        "There are a number of builtins in 'm4' for manipulating text in various": {
            "content": "ways, extracting substrings, searching, substituting, and so on.\n\n* Menu:\n\n* Len::                         Calculating length of strings\n* Index macro::                 Searching for substrings\n* Regexp::                      Searching for regular expressions\n* Substr::                      Extracting substrings\n* Translit::                    Translating characters\n* Patsubst::                    Substituting text by regular expression\n* Format::                      Formatting strings (printf-like)\n",
            "subsections": []
        },
        "File: m4.info,  Node: Len,  Next: Index macro,  Up: Text handling": {
            "content": "",
            "subsections": [
                {
                    "name": "11.1 Calculating length of strings",
                    "content": "The length of a string can be calculated by 'len':\n\n-- Builtin: len (STRING)\nExpands to the length of STRING, as a decimal number.\n\nThe macro 'len' is recognized only with parameters.\n\nlen()\n=>0\nlen(`abcdef')\n=>6\n"
                }
            ]
        },
        "File: m4.info,  Node: Index macro,  Next: Regexp,  Prev: Len,  Up: Text handling": {
            "content": "",
            "subsections": [
                {
                    "name": "11.2 Searching for substrings",
                    "content": "Searching for substrings is done with 'index':\n\n-- Builtin: index (STRING, SUBSTRING)\nExpands to the index of the first occurrence of SUBSTRING in\nSTRING.  The first character in STRING has index 0.  If SUBSTRING\ndoes not occur in STRING, 'index' expands to '-1'.\n\nThe macro 'index' is recognized only with parameters.\n\nindex(`gnus, gnats, and armadillos', `nat')\n=>7\nindex(`gnus, gnats, and armadillos', `dag')\n=>-1\n\nOmitting SUBSTRING evokes a warning, but still produces output;\ncontrast this with an empty SUBSTRING.\n\nindex(`abc')\nerror->m4:stdin:1: Warning: too few arguments to builtin `index'\n=>0\nindex(`abc', `')\n=>0\nindex(`abc', `b')\n=>1\n"
                }
            ]
        },
        "File: m4.info,  Node: Regexp,  Next: Substr,  Prev: Index macro,  Up: Text handling": {
            "content": "",
            "subsections": [
                {
                    "name": "11.3 Searching for regular expressions",
                    "content": "Searching for regular expressions is done with the builtin 'regexp':\n\n-- Builtin: regexp (STRING, REGEXP, [REPLACEMENT])\nSearches for REGEXP in STRING.  The syntax for regular expressions\nis the same as in GNU Emacs, which is similar to BRE, Basic Regular\nExpressions in POSIX. *Note Syntax of Regular Expressions:\n(emacs)Regexps.  Support for ERE, Extended Regular Expressions is\nnot available, but will be added in GNU M4 2.0.\n\nIf REPLACEMENT is omitted, 'regexp' expands to the index of the\nfirst match of REGEXP in STRING.  If REGEXP does not match anywhere\nin STRING, it expands to -1.\n\nIf REPLACEMENT is supplied, and there was a match, 'regexp' changes\nthe expansion to this argument, with '\\N' substituted by the text\nmatched by the Nth parenthesized sub-expression of REGEXP, up to\nnine sub-expressions.  The escape '\\&' is replaced by the text of\nthe entire regular expression matched.  For all other characters,\n'\\' treats the next character literally.  A warning is issued if\nthere were fewer sub-expressions than the '\\N' requested, or if\nthere is a trailing '\\'.  If there was no match, 'regexp' expands\nto the empty string.\n\nThe macro 'regexp' is recognized only with parameters.\n\nregexp(`GNUs not Unix', `\\<[a-z]\\w+')\n=>5\nregexp(`GNUs not Unix', `\\<Q\\w*')\n=>-1\nregexp(`GNUs not Unix', `\\w\\(\\w+\\)$', `* \\& * \\1 *')\n=>* Unix * nix *\nregexp(`GNUs not Unix', `\\<Q\\w*', `* \\& * \\1 *')\n=>\n\nHere are some more examples on the handling of backslash:\n\nregexp(`abc', `\\(b\\)', `\\\\\\10\\a')\n=>\\b0a\nregexp(`abc', `b', `\\1\\')\nerror->m4:stdin:2: Warning: sub-expression 1 not present\nerror->m4:stdin:2: Warning: trailing \\ ignored in replacement\n=>\nregexp(`abc', `\\(\\(d\\)?\\)\\(c\\)', `\\1\\2\\3\\4\\5\\6')\nerror->m4:stdin:3: Warning: sub-expression 4 not present\nerror->m4:stdin:3: Warning: sub-expression 5 not present\nerror->m4:stdin:3: Warning: sub-expression 6 not present\n=>c\n\nOmitting REGEXP evokes a warning, but still produces output; contrast\nthis with an empty REGEXP argument.\n\nregexp(`abc')\nerror->m4:stdin:1: Warning: too few arguments to builtin `regexp'\n=>0\nregexp(`abc', `')\n=>0\nregexp(`abc', `', `\\\\def')\n=>\\def\n"
                }
            ]
        },
        "File: m4.info,  Node: Substr,  Next: Translit,  Prev: Regexp,  Up: Text handling": {
            "content": "",
            "subsections": [
                {
                    "name": "11.4 Extracting substrings",
                    "content": "Substrings are extracted with 'substr':\n\n-- Builtin: substr (STRING, FROM, [LENGTH])\nExpands to the substring of STRING, which starts at index FROM, and\nextends for LENGTH characters, or to the end of STRING, if LENGTH\nis omitted.  The starting index of a string is always 0.  The\nexpansion is empty if there is an error parsing FROM or LENGTH, if\nFROM is beyond the end of STRING, or if LENGTH is negative.\n\nThe macro 'substr' is recognized only with parameters.\n\nsubstr(`gnus, gnats, and armadillos', `6')\n=>gnats, and armadillos\nsubstr(`gnus, gnats, and armadillos', `6', `5')\n=>gnats\n\nOmitting FROM evokes a warning, but still produces output.\n\nsubstr(`abc')\nerror->m4:stdin:1: Warning: too few arguments to builtin `substr'\n=>abc\nsubstr(`abc',)\nerror->m4:stdin:2: empty string treated as 0 in builtin `substr'\n=>abc\n"
                }
            ]
        },
        "File: m4.info,  Node: Translit,  Next: Patsubst,  Prev: Substr,  Up: Text handling": {
            "content": "",
            "subsections": [
                {
                    "name": "11.5 Translating characters",
                    "content": "Character translation is done with 'translit':\n\n-- Builtin: translit (STRING, CHARS, [REPLACEMENT])\nExpands to STRING, with each character that occurs in CHARS\ntranslated into the character from REPLACEMENT with the same index.\n\nIf REPLACEMENT is shorter than CHARS, the excess characters of\nCHARS are deleted from the expansion; if CHARS is shorter, the\nexcess characters in REPLACEMENT are silently ignored.  If\nREPLACEMENT is omitted, all characters in STRING that are present\nin CHARS are deleted from the expansion.  If a character appears\nmore than once in CHARS, only the first instance is used in making\nthe translation.  Only a single translation pass is made, even if\ncharacters in REPLACEMENT also appear in CHARS.\n\nAs a GNU extension, both CHARS and REPLACEMENT can contain\ncharacter-ranges, e.g., 'a-z' (meaning all lowercase letters) or\n'0-9' (meaning all digits).  To include a dash '-' in CHARS or\nREPLACEMENT, place it first or last in the entire string, or as the\nlast character of a range.  Back-to-back ranges can share a common\nendpoint.  It is not an error for the last character in the range\nto be 'larger' than the first.  In that case, the range runs\nbackwards, i.e., '9-0' means the string '9876543210'.  The\nexpansion of a range is dependent on the underlying encoding of\ncharacters, so using ranges is not always portable between\nmachines.\n\nThe macro 'translit' is recognized only with parameters.\n\ntranslit(`GNUs not Unix', `A-Z')\n=>s not nix\ntranslit(`GNUs not Unix', `a-z', `A-Z')\n=>GNUS NOT UNIX\ntranslit(`GNUs not Unix', `A-Z', `z-a')\n=>tmfs not fnix\ntranslit(`+,-12345', `+--1-5', `<;>a-c-a')\n=><;>abcba\ntranslit(`abcdef', `aabdef', `bcged')\n=>bgced\n\nIn the ASCII encoding, the first example deletes all uppercase\nletters, the second converts lowercase to uppercase, and the third\n'mirrors' all uppercase letters, while converting them to lowercase."
                }
            ]
        },
        "The two first cases are by far the most common, even though they are not": {
            "content": "portable to EBCDIC or other encodings.  The fourth example shows a range\nending in '-', as well as back-to-back ranges.  The final example shows\nthat 'a' is mapped to 'b', not 'c'; the resulting 'b' is not further\nremapped to 'g'; the 'd' and 'e' are swapped, and the 'f' is discarded.\n\nOmitting CHARS evokes a warning, but still produces output.\n\ntranslit(`abc')\nerror->m4:stdin:1: Warning: too few arguments to builtin `translit'\n=>abc\n",
            "subsections": []
        },
        "File: m4.info,  Node: Patsubst,  Next: Format,  Prev: Translit,  Up: Text handling": {
            "content": "",
            "subsections": [
                {
                    "name": "11.6 Substituting text by regular expression",
                    "content": "Global substitution in a string is done by 'patsubst':\n\n-- Builtin: patsubst (STRING, REGEXP, [REPLACEMENT])\nSearches STRING for matches of REGEXP, and substitutes REPLACEMENT\nfor each match.  The syntax for regular expressions is the same as\nin GNU Emacs (*note Regexp::).\n\nThe parts of STRING that are not covered by any match of REGEXP are\ncopied to the expansion.  Whenever a match is found, the search\nproceeds from the end of the match, so a character from STRING will\nnever be substituted twice.  If REGEXP matches a string of zero\nlength, the start position for the search is incremented, to avoid\ninfinite loops.\n\nWhen a replacement is to be made, REPLACEMENT is inserted into the\nexpansion, with '\\N' substituted by the text matched by the Nth\nparenthesized sub-expression of PATSUBST, for up to nine\nsub-expressions.  The escape '\\&' is replaced by the text of the\nentire regular expression matched.  For all other characters, '\\'\ntreats the next character literally.  A warning is issued if there\nwere fewer sub-expressions than the '\\N' requested, or if there is\na trailing '\\'.\n\nThe REPLACEMENT argument can be omitted, in which case the text\nmatched by REGEXP is deleted.\n\nThe macro 'patsubst' is recognized only with parameters.\n\npatsubst(`GNUs not Unix', `^', `OBS: ')\n=>OBS: GNUs not Unix\npatsubst(`GNUs not Unix', `\\<', `OBS: ')\n=>OBS: GNUs OBS: not OBS: Unix\npatsubst(`GNUs not Unix', `\\w*', `(\\&)')\n=>(GNUs)() (not)() (Unix)()\npatsubst(`GNUs not Unix', `\\w+', `(\\&)')\n=>(GNUs) (not) (Unix)\npatsubst(`GNUs not Unix', `[A-Z][a-z]+')\n=>GN not\npatsubst(`GNUs not Unix', `not', `NOT\\')\nerror->m4:stdin:6: Warning: trailing \\ ignored in replacement\n=>GNUs NOT Unix\n\nHere is a slightly more realistic example, which capitalizes\nindividual words or whole sentences, by substituting calls of the macros\n'upcase' and 'downcase' into the strings.\n\n-- Composite: upcase (TEXT)\n-- Composite: downcase (TEXT)\n-- Composite: capitalize (TEXT)\nExpand to TEXT, but with capitalization changed: 'upcase' changes\nall letters to upper case, 'downcase' changes all letters to lower\ncase, and 'capitalize' changes the first character of each word to\nupper case and the remaining characters to lower case.\n\nFirst, an example of their usage, using implementations distributed\nin 'm4-1.4.19/examples/capitalize.m4'.\n\n$ m4 -I examples\ninclude(`capitalize.m4')\n=>\nupcase(`GNUs not Unix')\n=>GNUS NOT UNIX\ndowncase(`GNUs not Unix')\n=>gnus not unix\ncapitalize(`GNUs not Unix')\n=>Gnus Not Unix\n\nNow for the implementation.  There is a helper macro 'capitalize'\nwhich puts only its first word in mixed case.  Then 'capitalize' merely\nparses out the words, and replaces them with an invocation of\n'capitalize'.  (As presented here, the 'capitalize' macro has some\nsubtle flaws.  You should try to see if you can find and correct them;\nor *note Answers: Improved capitalize.).\n\n$ m4 -I examples\nundivert(`capitalize.m4')dnl\n=>divert(`-1')\n=># upcase(text)\n=># downcase(text)\n=># capitalize(text)\n=>#   change case of text, simple version\n=>define(`upcase', `translit(`$*', `a-z', `A-Z')')\n=>define(`downcase', `translit(`$*', `A-Z', `a-z')')\n=>define(`capitalize',\n=>       `regexp(`$1', `^\\(\\w\\)\\(\\w*\\)',\n=>               `upcase(`\\1')`'downcase(`\\2')')')\n=>define(`capitalize', `patsubst(`$1', `\\w+', `$0(`\\&')')')\n=>divert`'dnl\n\nWhile 'regexp' replaces the whole input with the replacement as soon\nas there is a match, 'patsubst' replaces each occurrence of a match\nand preserves non-matching pieces:\n\ndefine(`patreg',\n`patsubst($@)\nregexp($@)')dnl\npatreg(`bar foo baz Foo', `foo\\|Foo', `FOO')\n=>bar FOO baz FOO\n=>FOO\npatreg(`aba abb 121', `\\(.\\)\\(.\\)\\1', `\\2\\1\\2')\n=>bab abb 212\n=>bab\n\nOmitting REGEXP evokes a warning, but still produces output; contrast\nthis with an empty REGEXP argument.\n\npatsubst(`abc')\nerror->m4:stdin:1: Warning: too few arguments to builtin `patsubst'\n=>abc\npatsubst(`abc', `')\n=>abc\npatsubst(`abc', `', `\\\\-')\n=>\\-a\\-b\\-c\\-\n"
                }
            ]
        },
        "File: m4.info,  Node: Format,  Prev: Patsubst,  Up: Text handling": {
            "content": "",
            "subsections": [
                {
                    "name": "11.7 Formatting strings (printf-like)",
                    "content": "Formatted output can be made with 'format':\n\n-- Builtin: format (FORMAT-STRING, ...)\nWorks much like the C function 'printf'.  The first argument\nFORMAT-STRING can contain '%' specifications which are satisfied by\nadditional arguments, and the expansion of 'format' is the\nformatted string.\n\nThe macro 'format' is recognized only with parameters.\n\nIts use is best described by a few examples:\n\ndefine(`foo', `The brown fox jumped over the lazy dog')\n=>\nformat(`The string \"%s\" uses %d characters', foo, len(foo))\n=>The string \"The brown fox jumped over the lazy dog\" uses 38 characters\nformat(`%*.*d', `-1', `-1', `1')\n=>1\nformat(`%.0f', `56789.9876')\n=>56790\nlen(format(`%-*X', `5000', `1'))\n=>5000\nifelse(format(`%010F', `infinity'), `       INF', `success',\nformat(`%010F', `infinity'), `  INFINITY', `success',\nformat(`%010F', `infinity'))\n=>success\nifelse(format(`%.1A', `1.999'), `0X1.0P+1', `success',\nformat(`%.1A', `1.999'), `0X2.0P+0', `success',\nformat(`%.1A', `1.999'))\n=>success\nformat(`%g', `0xa.P+1')\n=>20\n\nUsing the 'forloop' macro defined earlier (*note Forloop::), this\nexample shows how 'format' can be used to produce tabular output.\n\n$ m4 -I examples\ninclude(`forloop.m4')\n=>\nforloop(`i', `1', `10', `format(`%6d squared is %10d\n', i, eval(i2))')\n=>     1 squared is          1\n=>     2 squared is          4\n=>     3 squared is          9\n=>     4 squared is         16\n=>     5 squared is         25\n=>     6 squared is         36\n=>     7 squared is         49\n=>     8 squared is         64\n=>     9 squared is         81\n=>    10 squared is        100\n=>\n\nThe builtin 'format' is modeled after the ANSI C 'printf' function,\nand supports these '%' specifiers: 'c', 's', 'd', 'o', 'x', 'X', 'u',\n'a', 'A', 'e', 'E', 'f', 'F', 'g', 'G', and '%'; it supports field\nwidths and precisions, and the flags '+', '-', ' ', '0', '#', and '''."
                }
            ]
        },
        "For integer specifiers, the width modifiers 'hh', 'h', and 'l' are": {
            "content": "recognized, and for floating point specifiers, the width modifier 'l' is\nrecognized.  Items not yet supported include positional arguments, the\n'n', 'p', 'S', and 'C' specifiers, the 'z', 't', 'j', 'L' and 'll'\nmodifiers, and any platform extensions available in the native 'printf'.",
            "subsections": []
        },
        "For more details on the functioning of 'printf', see the C Library": {
            "content": "Manual, or the POSIX specification (for example, '%a' is supported even\non platforms that haven't yet implemented C99 hexadecimal floating point\noutput natively).\n\nUnrecognized specifiers result in a warning.  It is anticipated that\na future release of GNU 'm4' will support more specifiers, and give\nbetter warnings when various problems such as overflow are encountered.\nLikewise, escape sequences are not yet recognized.\n\nformat(`%p', `0')\nerror->m4:stdin:1: Warning: unrecognized specifier in `%p'\n=>\n",
            "subsections": []
        },
        "File: m4.info,  Node: Arithmetic,  Next: Shell commands,  Prev: Text handling,  Up: Top": {
            "content": "",
            "subsections": []
        },
        "12 Macros for doing arithmetic": {
            "content": "",
            "subsections": []
        },
        "Integer arithmetic is included in 'm4', with a C-like syntax.  As": {
            "content": "convenient shorthands, there are builtins for simple increment and\ndecrement operations.\n\n* Menu:\n\n* Incr::                        Decrement and increment operators\n* Eval::                        Evaluating integer expressions\n",
            "subsections": []
        },
        "File: m4.info,  Node: Incr,  Next: Eval,  Up: Arithmetic": {
            "content": "",
            "subsections": [
                {
                    "name": "12.1 Decrement and increment operators",
                    "content": ""
                }
            ]
        },
        "Increment and decrement of integers are supported using the builtins": {
            "content": "'incr' and 'decr':\n\n-- Builtin: incr (NUMBER)\n-- Builtin: decr (NUMBER)\nExpand to the numerical value of NUMBER, incremented or\ndecremented, respectively, by one.  Except for the empty string,\nthe expansion is empty if NUMBER could not be parsed.\n\nThe macros 'incr' and 'decr' are recognized only with parameters.\n\nincr(`4')\n=>5\ndecr(`7')\n=>6\nincr()\nerror->m4:stdin:3: empty string treated as 0 in builtin `incr'\n=>1\ndecr()\nerror->m4:stdin:4: empty string treated as 0 in builtin `decr'\n=>-1\n",
            "subsections": []
        },
        "File: m4.info,  Node: Eval,  Prev: Incr,  Up: Arithmetic": {
            "content": "",
            "subsections": [
                {
                    "name": "12.2 Evaluating integer expressions",
                    "content": "Integer expressions are evaluated with 'eval':\n\n-- Builtin: eval (EXPRESSION, [RADIX = 10], [WIDTH])\nExpands to the value of EXPRESSION.  The expansion is empty if a\nproblem is encountered while parsing the arguments.  If specified,\nRADIX and WIDTH control the format of the output.\n\nCalculations are done with 32-bit signed numbers.  Overflow\nsilently results in wraparound.  A warning is issued if division by\nzero is attempted, or if EXPRESSION could not be parsed.\n\nExpressions can contain the following operators, listed in order of\ndecreasing precedence.\n\n'()'\nParentheses\n'+ - ~ !'\nUnary plus and minus, and bitwise and logical negation\n''\nExponentiation\n'* / %'\nMultiplication, division, and modulo\n'+ -'\nAddition and subtraction\n'<< >>'\nShift left or right\n'> >= < <='\nRelational operators\n'== !='\nEquality operators\n'&'\nBitwise and\n'^'\nBitwise exclusive-or\n'|'\nBitwise or\n'&&'\nLogical and\n'||'\nLogical or\n\nThe macro 'eval' is recognized only with parameters.\n\nAll binary operators, except exponentiation, are left associative.  C\noperators that perform variable assignment, such as '+=' or '--', are\nnot implemented, since 'eval' only operates on constants, not variables."
                }
            ]
        },
        "Attempting to use them results in an error.  However, since traditional": {
            "content": "implementations treated '=' as an undocumented alias for '==' as opposed\nto an assignment operator, this usage is supported as a special case.",
            "subsections": []
        },
        "Be aware that a future version of GNU M4 may support assignment": {
            "content": "semantics as an extension when POSIX mode is not requested, and that\nusing '=' to check equality is not portable.\n\neval(`2 = 2')\nerror->m4:stdin:1: Warning: recommend ==, not =, for equality operator\n=>1\neval(`++0')\nerror->m4:stdin:2: invalid operator in eval: ++0\n=>\neval(`0 |= 1')\nerror->m4:stdin:3: invalid operator in eval: 0 |= 1\n=>\n\nNote that some older 'm4' implementations use '^' as an alternate\noperator for the exponentiation, although POSIX requires the C behavior\nof bitwise exclusive-or.  The precedence of the negation operators, '~'\nand '!', was traditionally lower than equality.  The unary operators\ncould not be used reliably more than once on the same term without\nintervening parentheses.  The traditional precedence of the equality\noperators '==' and '!=' was identical instead of lower than the\nrelational operators such as '<', even through GNU M4 1.4.8.  Starting\nwith version 1.4.9, GNU M4 correctly follows POSIX precedence rules.  M4\nscripts designed to be portable between releases must be aware that\nparentheses may be required to enforce C precedence rules.  Likewise,\ndivision by zero, even in the unused branch of a short-circuiting\noperator, is not always well-defined in other implementations.\n\nFollowing are some examples where the current version of M4 follows C\nprecedence rules, but where older versions and some other\nimplementations of 'm4' require explicit parentheses to get the correct\nresult:\n\neval(`1 == 2 > 0')\n=>1\neval(`(1 == 2) > 0')\n=>0\neval(`! 0 * 2')\n=>2\neval(`! (0 * 2)')\n=>1\neval(`1 | 1 ^ 1')\n=>1\neval(`(1 | 1) ^ 1')\n=>0\neval(`+ + - ~ ! ~ 0')\n=>1\neval(`2 || 1 / 0')\n=>1\neval(`0 || 1 / 0')\nerror->m4:stdin:9: divide by zero in eval: 0 || 1 / 0\n=>\neval(`0 && 1 % 0')\n=>0\neval(`2 && 1 % 0')\nerror->m4:stdin:11: modulo by zero in eval: 2 && 1 % 0\n=>\n\nAs a GNU extension, the operator '' performs integral\nexponentiation.  The operator is right-associative, and if evaluated,\nthe exponent must be non-negative, and at least one of the arguments\nmust be non-zero, or a warning is issued.\n\neval(`2  3  2')\n=>512\neval(`(2  3)  2')\n=>64\neval(`0  1')\n=>0\neval(`2  0')\n=>1\neval(`0  0')\n=>\nerror->m4:stdin:5: divide by zero in eval: 0  0\neval(`4  -2')\nerror->m4:stdin:6: negative exponent in eval: 4  -2\n=>\n\nWithin EXPRESSION, (but not RADIX or WIDTH), numbers without a\nspecial prefix are decimal.  A simple '0' prefix introduces an octal\nnumber.  '0x' introduces a hexadecimal number.  As GNU extensions, '0b'\nintroduces a binary number.  '0r' introduces a number expressed in any\nradix between 1 and 36: the prefix should be immediately followed by the\ndecimal expression of the radix, a colon, then the digits making the\nnumber.  For radix 1, leading zeros are ignored, and all remaining\ndigits must be '1'; for all other radices, the digits are '0', '1', '2',\n....  Beyond '9', the digits are 'a', 'b' ... up to 'z'.  Lower and\nupper case letters can be used interchangeably in numbers prefixes and\nas number digits.\n\nParentheses may be used to group subexpressions whenever needed.  For\nthe relational operators, a true relation returns '1', and a false\nrelation return '0'.\n\nHere are a few examples of use of 'eval'.\n\neval(`-3 * 5')\n=>-15\neval(`-99 / 10')\n=>-9\neval(`-99 % 10')\n=>-9\neval(`99 % -10')\n=>9\neval(index(`Hello world', `llo') >= 0)\n=>1\neval(`0r1:0111 + 0b100 + 0r3:12')\n=>12\ndefine(`square', `eval(`($1)  2')')\n=>\nsquare(`9')\n=>81\nsquare(square(`5')` + 1')\n=>676\ndefine(`foo', `666')\n=>\neval(`foo / 6')\nerror->m4:stdin:11: bad expression in eval: foo / 6\n=>\neval(foo / 6)\n=>111\n\nAs the last two lines show, 'eval' does not handle macro names, even\nif they expand to a valid expression (or part of a valid expression).\nTherefore all macros must be expanded before they are passed to 'eval'.\n\nSome calculations are not portable to other implementations, since\nthey have undefined semantics in C, but GNU 'm4' has well-defined\nbehavior on overflow.  When shifting, an out-of-range shift amount is\nimplicitly brought into the range of 32-bit signed integers using an\nimplicit bit-wise and with 0x1f).\n\ndefine(`maxint', eval(`0x7fffffff'))\n=>\ndefine(`minint', incr(maxint))\n=>\neval(minint` < 0')\n=>1\neval(maxint` > 0')\n=>1\nifelse(eval(minint` / -1'), minint, `overflow occurred')\n=>overflow occurred\nminint\n=>-2147483648\neval(`0x80000000 % -1')\n=>0\neval(`-4 >> 1')\n=>-2\neval(`-4 >> 33')\n=>-2\n\nIf RADIX is specified, it specifies the radix to be used in the\nexpansion.  The default radix is 10; this is also the case if RADIX is\nthe empty string.  A warning results if the radix is outside the range\nof 1 through 36, inclusive.  The result of 'eval' is always taken to be\nsigned.  No radix prefix is output, and for radices greater than 10, the\ndigits are lower case.  The WIDTH argument specifies the minimum output\nwidth, excluding any negative sign.  The result is zero-padded to extend\nthe expansion to the requested width.  A warning results if the width is\nnegative.  If RADIX or WIDTH is out of bounds, the expansion of 'eval'\nis empty.\n\neval(`666', `10')\n=>666\neval(`666', `11')\n=>556\neval(`666', `6')\n=>3030\neval(`666', `6', `10')\n=>0000003030\neval(`-666', `6', `10')\n=>-0000003030\neval(`10', `', `0')\n=>10\n`0r1:'eval(`10', `1', `11')\n=>0r1:01111111111\neval(`10', `16')\n=>a\neval(`1', `37')\nerror->m4:stdin:9: radix 37 in builtin `eval' out of range\n=>\neval(`1', , `-1')\nerror->m4:stdin:10: negative width to builtin `eval'\n=>\neval()\nerror->m4:stdin:11: empty string treated as 0 in builtin `eval'\n=>0\n",
            "subsections": []
        },
        "File: m4.info,  Node: Shell commands,  Next: Miscellaneous,  Prev: Arithmetic,  Up: Top": {
            "content": "",
            "subsections": []
        },
        "13 Macros for running shell commands": {
            "content": "",
            "subsections": []
        },
        "There are a few builtin macros in 'm4' that allow you to run shell": {
            "content": "commands from within 'm4'.\n\nNote that the definition of a valid shell command is system\ndependent.  On UNIX systems, this is the typical '/bin/sh'.  But on\nother systems, such as native Windows, the shell has a different syntax\nof commands that it understands.  Some examples in this chapter assume\n'/bin/sh', and also demonstrate how to quit early with a known exit\nvalue if this is not the case.\n\n* Menu:\n\n* Platform macros::             Determining the platform\n* Syscmd::                      Executing simple commands\n* Esyscmd::                     Reading the output of commands\n* Sysval::                      Exit status\n* Mkstemp::                     Making temporary files\n",
            "subsections": []
        },
        "File: m4.info,  Node: Platform macros,  Next: Syscmd,  Up: Shell commands": {
            "content": "",
            "subsections": [
                {
                    "name": "13.1 Determining the platform",
                    "content": ""
                }
            ]
        },
        "Sometimes it is desirable for an input file to know which platform 'm4'": {
            "content": "is running on.  GNU 'm4' provides several macros that are predefined to\nexpand to the empty string; checking for their existence will confirm\nplatform details.\n\n-- Optional builtin: gnu\n-- Optional builtin: os2\n-- Optional builtin: os2\n-- Optional builtin: unix\n-- Optional builtin: unix\n-- Optional builtin: windows\n-- Optional builtin: windows\nEach of these macros is conditionally defined as needed to describe\nthe environment of 'm4'.  If defined, each macro expands to the\nempty string.  For now, these macros silently ignore all arguments,\nbut in a future release of M4, they might warn if arguments are\npresent.\n\nWhen GNU extensions are in effect (that is, when you did not use the\n'-G' option, *note Invoking m4: Limits control.), GNU 'm4' will define\nthe macro 'gnu' to expand to the empty string.\n\n$ m4\ngnu\n=>\ngnu(`ignored')\n=>\nExtensions are ifdef(`gnu', `active', `inactive')\n=>Extensions are active\n\n$ m4 -G\ngnu\n=>gnu\ngnu(`ignored')\n=>gnu(ignored)\nExtensions are ifdef(`gnu', `active', `inactive')\n=>Extensions are inactive\n\nOn UNIX systems, GNU 'm4' will define 'unix' by default, or\n'unix' when the '-G' option is specified.\n\nOn native Windows systems, GNU 'm4' will define 'windows' by\ndefault, or 'windows' when the '-G' option is specified.\n\nOn OS/2 systems, GNU 'm4' will define 'os2' by default, or 'os2'\nwhen the '-G' option is specified.\n\nIf GNU 'm4' does not provide a platform macro for your system, please\nreport that as a bug.\n\ndefine(`provided', `0')\n=>\nifdef(`unix', `define(`provided', incr(provided))')\n=>\nifdef(`windows', `define(`provided', incr(provided))')\n=>\nifdef(`os2', `define(`provided', incr(provided))')\n=>\nprovided\n=>1\n",
            "subsections": []
        },
        "File: m4.info,  Node: Syscmd,  Next: Esyscmd,  Prev: Platform macros,  Up: Shell commands": {
            "content": "",
            "subsections": [
                {
                    "name": "13.2 Executing simple commands",
                    "content": "Any shell command can be executed, using 'syscmd':\n\n-- Builtin: syscmd (SHELL-COMMAND)\nExecutes SHELL-COMMAND as a shell command.\n\nThe expansion of 'syscmd' is void, not the output from\nSHELL-COMMAND!  Output or error messages from SHELL-COMMAND are not\nread by 'm4'.  *Note Esyscmd::, if you need to process the command\noutput.\n\nPrior to executing the command, 'm4' flushes its buffers.  The\ndefault standard input, output and error of SHELL-COMMAND are the\nsame as those of 'm4'.\n\nBy default, the SHELL-COMMAND will be used as the argument to the\n'-c' option of the '/bin/sh' shell (or the version of 'sh'\nspecified by 'command -p getconf PATH', if your system supports\nthat).  If you prefer a different shell, the 'configure' script can\nbe given the option '--with-syscmd-shell=LOCATION' to set the\nlocation of an alternative shell at GNU 'm4' installation; the\nalternative shell must still support '-c'.\n\nThe macro 'syscmd' is recognized only with parameters.\n\ndefine(`foo', `FOO')\n=>\nsyscmd(`echo foo')\n=>foo\n=>\n\nNote how the expansion of 'syscmd' keeps the trailing newline of the\ncommand, as well as using the newline that appeared after the macro.\n\nThe following is an example of SHELL-COMMAND using the same standard\ninput as 'm4':\n\n$ echo \"m4wrap(\\`syscmd(\\`cat')')\" | m4\n=>\n\nIt tells 'm4' to read all of its input before executing the wrapped\ntext, then hand a valid (albeit emptied) pipe as standard input for the\n'cat' subcommand.  Therefore, you should be careful when using standard\ninput (either by specifying no files, or by passing '-' as a file name\non the command line, *note Invoking m4: Command line files.), and also\ninvoking subcommands via 'syscmd' or 'esyscmd' that consume data from\nstandard input.  When standard input is a seekable file, the subprocess\nwill pick up with the next character not yet processed by 'm4'; when it\nis a pipe or other non-seekable file, there is no guarantee how much\ndata will already be buffered by 'm4' and thus unavailable to the child.\n"
                }
            ]
        },
        "File: m4.info,  Node: Esyscmd,  Next: Sysval,  Prev: Syscmd,  Up: Shell commands": {
            "content": "",
            "subsections": [
                {
                    "name": "13.3 Reading the output of commands",
                    "content": "If you want 'm4' to read the output of a shell command, use 'esyscmd':\n\n-- Builtin: esyscmd (SHELL-COMMAND)\nExpands to the standard output of the shell command SHELL-COMMAND.\n\nPrior to executing the command, 'm4' flushes its buffers.  The\ndefault standard input and standard error of SHELL-COMMAND are the\nsame as those of 'm4'.  The error output of SHELL-COMMAND is not a\npart of the expansion: it will appear along with the error output\nof 'm4'.\n\nBy default, the SHELL-COMMAND will be used as the argument to the\n'-c' option of the '/bin/sh' shell (or the version of 'sh'\nspecified by 'command -p getconf PATH', if your system supports\nthat).  If you prefer a different shell, the 'configure' script can\nbe given the option '--with-syscmd-shell=LOCATION' to set the\nlocation of an alternative shell at GNU 'm4' installation; the\nalternative shell must still support '-c'.\n\nThe macro 'esyscmd' is recognized only with parameters.\n\ndefine(`foo', `FOO')\n=>\nesyscmd(`echo foo')\n=>FOO\n=>\n\nNote how the expansion of 'esyscmd' keeps the trailing newline of the\ncommand, as well as using the newline that appeared after the macro.\n\nJust as with 'syscmd', care must be exercised when sharing standard\ninput between 'm4' and the child process of 'esyscmd'.\n"
                }
            ]
        },
        "File: m4.info,  Node: Sysval,  Next: Mkstemp,  Prev: Esyscmd,  Up: Shell commands": {
            "content": "",
            "subsections": [
                {
                    "name": "13.4 Exit status",
                    "content": "To see whether a shell command succeeded, use 'sysval':\n\n-- Builtin: sysval\nExpands to the exit status of the last shell command run with\n'syscmd' or 'esyscmd'.  Expands to 0 if no command has been run\nyet.\n\nsysval\n=>0\nsyscmd(`false')\n=>\nifelse(sysval, `0', `zero', `non-zero')\n=>non-zero\nsyscmd(`exit 2')\n=>\nsysval\n=>2\nsyscmd(`true')\n=>\nsysval\n=>0\nesyscmd(`false')\n=>\nifelse(sysval, `0', `zero', `non-zero')\n=>non-zero\nesyscmd(`echo dnl && exit 127')\n=>\nsysval\n=>127\nesyscmd(`true')\n=>\nsysval\n=>0\n\n'sysval' results in 127 if there was a problem executing the command,\nfor example, if the system-imposed argument length is exceeded, or if\nthere were not enough resources to fork.  It is not possible to\ndistinguish between failed execution and successful execution that had\nan exit status of 127, unless there was output from the child process.\n\nOn UNIX platforms, where it is possible to detect when command\nexecution is terminated by a signal, rather than a normal exit, the\nresult is the signal number shifted left by eight bits.\n\ndnl This test assumes kill is a shell builtin, and that signals are\ndnl recognizable.\nifdef(`unix', ,\n`errprint(` skipping: syscmd does not have unix semantics\n')m4exit(`77')')dnl\nchangequote(`[', `]')\n=>\nsyscmd([/bin/sh -c 'kill -9 $$'; st=$?; test $st = 137 || test $st = 265])\n=>\nifelse(sysval, [0], , [errprint([ skipping: shell does not send signal 9\n])m4exit([77])])dnl\nsyscmd([kill -9 $$])\n=>\nsysval\n=>2304\nsyscmd()\n=>\nsysval\n=>0\nesyscmd([kill -9 $$])\n=>\nsysval\n=>2304\n"
                }
            ]
        },
        "File: m4.info,  Node: Mkstemp,  Prev: Sysval,  Up: Shell commands": {
            "content": "",
            "subsections": [
                {
                    "name": "13.5 Making temporary files",
                    "content": ""
                }
            ]
        },
        "Commands specified to 'syscmd' or 'esyscmd' might need a temporary file,": {
            "content": "for output or for some other purpose.  There is a builtin macro,\n'mkstemp', for making a temporary file:\n\n-- Builtin: mkstemp (TEMPLATE)\n-- Builtin: maketemp (TEMPLATE)\nExpands to the quoted name of a new, empty file, made from the\nstring TEMPLATE, which should end with the string 'XXXXXX'.  The\nsix 'X' characters are then replaced with random characters\nmatching the regular expression '[a-zA-Z0-9.-]', in order to make\nthe file name unique.  If fewer than six 'X' characters are found\nat the end of 'template', the result will be longer than the\ntemplate.  The created file will have access permissions as if by\n'chmod =rw,go=', meaning that the current umask of the 'm4' process\nis taken into account, and at most only the current user can read\nand write the file.\n\nThe traditional behavior, standardized by POSIX, is that 'maketemp'\nmerely replaces the trailing 'X' with the process id, without\ncreating a file or quoting the expansion, and without ensuring that\nthe resulting string is a unique file name.  In part, this means\nthat using the same TEMPLATE twice in the same input file will\nresult in the same expansion.  This behavior is a security hole, as\nit is very easy for another process to guess the name that will be\ngenerated, and thus interfere with a subsequent use of 'syscmd'\ntrying to manipulate that file name.  Hence, POSIX has recommended\nthat all new implementations of 'm4' provide the secure 'mkstemp'\nbuiltin, and that users of 'm4' check for its existence.\n\nThe expansion is void and an error issued if a temporary file could\nnot be created.\n\nThe macros 'mkstemp' and 'maketemp' are recognized only with\nparameters.\n\nIf you try this next example, you will most likely get different\noutput for the two file names, since the replacement characters are\nrandomly chosen:\n\n$ m4\ndefine(`tmp', `oops')\n=>\nmaketemp(`/tmp/fooXXXXXX')\n=>/tmp/fooa07346\nifdef(`mkstemp', `define(`maketemp', defn(`mkstemp'))',\n`define(`mkstemp', defn(`maketemp'))dnl\nerrprint(`warning: potentially insecure maketemp implementation\n')')\n=>\nmkstemp(`doc')\n=>docQv83Uw\n\nUnless you use the '--traditional' command line option (or '-G',\n*note Invoking m4: Limits control.), the GNU version of 'maketemp' is\nsecure.  This means that using the same template to multiple calls will\ngenerate multiple files.  However, we recommend that you use the new\n'mkstemp' macro, introduced in GNU M4 1.4.8, which is secure even in\ntraditional mode.  Also, as of M4 1.4.11, the secure implementation\nquotes the resulting file name, so that you are guaranteed to know what\nfile was created even if the random file name happens to match an\nexisting macro.  Notice that this example is careful to use 'defn' to\navoid unintended expansion of 'foo'.\n\n$ m4\ndefine(`foo', `errprint(`oops')')\n=>\nsyscmd(`rm -f foo-??????')sysval\n=>0\ndefine(`file1', maketemp(`foo-XXXXXX'))dnl\nifelse(esyscmd(`echo \\` foo-?????? \\''), ` foo-?????? ',\n`no file', `created')\n=>created\ndefine(`file2', maketemp(`foo-XX'))dnl\ndefine(`file3', mkstemp(`foo-XXXXXX'))dnl\nifelse(len(defn(`file1')), len(defn(`file2')),\n`same length', `different')\n=>same length\nifelse(defn(`file1'), defn(`file2'), `same', `different file')\n=>different file\nifelse(defn(`file2'), defn(`file3'), `same', `different file')\n=>different file\nifelse(defn(`file1'), defn(`file3'), `same', `different file')\n=>different file\nsyscmd(`rm 'defn(`file1') defn(`file2') defn(`file3'))\n=>\nsysval\n=>0\n",
            "subsections": []
        },
        "File: m4.info,  Node: Miscellaneous,  Next: Frozen files,  Prev: Shell commands,  Up: Top": {
            "content": "",
            "subsections": []
        },
        "14 Miscellaneous builtin macros": {
            "content": "",
            "subsections": []
        },
        "This chapter describes various builtins, that do not really belong in": {
            "content": "any of the previous chapters.\n\n* Menu:\n\n* Errprint::                    Printing error messages\n* Location::                    Printing current location\n* M4exit::                      Exiting from 'm4'\n",
            "subsections": []
        },
        "File: m4.info,  Node: Errprint,  Next: Location,  Up: Miscellaneous": {
            "content": "",
            "subsections": [
                {
                    "name": "14.1 Printing error messages",
                    "content": "You can print error messages using 'errprint':\n\n-- Builtin: errprint (MESSAGE, ...)\nPrints MESSAGE and the rest of the arguments to standard error,\nseparated by spaces.  Standard error is used, regardless of the\n'--debugfile' option (*note Invoking m4: Debugging options.).\n\nThe expansion of 'errprint' is void.  The macro 'errprint' is\nrecognized only with parameters.\n\nerrprint(`Invalid arguments to forloop\n')\nerror->Invalid arguments to forloop\n=>\nerrprint(`1')errprint(`2',`3\n')\nerror->12 3\n=>\n\nA trailing newline is not printed automatically, so it should be\nsupplied as part of the argument, as in the example.  Unfortunately, the\nexact output of 'errprint' is not very portable to other 'm4'\nimplementations: POSIX requires that all arguments be printed, but some\nimplementations of 'm4' only print the first.  Furthermore, some BSD\nimplementations always append a newline for each 'errprint' call,\nregardless of whether the last argument already had one, and POSIX is\nsilent on whether this is acceptable.\n"
                }
            ]
        },
        "File: m4.info,  Node: Location,  Next: M4exit,  Prev: Errprint,  Up: Miscellaneous": {
            "content": "",
            "subsections": [
                {
                    "name": "14.2 Printing current location",
                    "content": ""
                }
            ]
        },
        "To make it possible to specify the location of an error, three utility": {
            "content": "builtins exist:\n\n-- Builtin: file\n-- Builtin: line\n-- Builtin: program\nExpand to the quoted name of the current input file, the current\ninput line number in that file, and the quoted name of the current\ninvocation of 'm4'.\n\nerrprint(program:file:line: `input error\n')\nerror->m4:stdin:1: input error\n=>\n\nLine numbers start at 1 for each file.  If the file was found due to\nthe '-I' option or 'M4PATH' environment variable, that is reflected in\nthe file name.  The syncline option ('-s', *note Invoking m4:\nPreprocessor features.), and the 'f' and 'l' flags of 'debugmode' (*note\nDebug Levels::), also use this notion of current file and line.",
            "subsections": []
        },
        "Redefining the three location macros has no effect on syncline, debug,": {
            "content": "warning, or error message output.\n\nThis example reuses the file 'incl.m4' mentioned earlier (*note\nInclude::):\n\n$ m4 -I examples\ndefine(`foo', ``$0' called at file:line')\n=>\nfoo\n=>foo called at stdin:2\ninclude(`incl.m4')\n=>Include file start\n=>foo called at examples/incl.m4:2\n=>Include file end\n=>\n\nThe location of macros invoked during the rescanning of macro\nexpansion text corresponds to the location in the file where the\nexpansion was triggered, regardless of how many newline characters the\nexpansion text contains.  As of GNU M4 1.4.8, the location of text\nwrapped with 'm4wrap' (*note M4wrap::) is the point at which the\n'm4wrap' was invoked.  Previous versions, however, behaved as though\nwrapped text came from line 0 of the file \"\".\n\ndefine(`echo', `$@')\n=>\ndefine(`foo', `echo(line\nline)')\n=>\necho(line\nline)\n=>4\n=>5\nm4wrap(`foo\n')\n=>\nfoo(errprint(line\nline\n))\nerror->8\nerror->9\n=>8\n=>8\nline\n=>11\nm4wrap(`line\n')\n=>\n^D\n=>12\n=>6\n=>6\n\nThe 'program' macro behaves like '$0' in shell terminology.  If\nyou invoke 'm4' through an absolute path or a link with a different\nspelling, rather than by relying on a 'PATH' search for plain 'm4', it\nwill affect how 'program' expands.  The intent is that you can use\nit to produce error messages with the same formatting that 'm4' produces\ninternally.  It can also be used within 'syscmd' (*note Syscmd::) to\npick the same version of 'm4' that is currently running, rather than\nwhatever version of 'm4' happens to be first in 'PATH'.  It was first\nintroduced in GNU M4 1.4.6.\n",
            "subsections": []
        },
        "File: m4.info,  Node: M4exit,  Prev: Location,  Up: Miscellaneous": {
            "content": "",
            "subsections": [
                {
                    "name": "14.3 Exiting from 'm4'",
                    "content": ""
                }
            ]
        },
        "If you need to exit from 'm4' before the entire input has been read, you": {
            "content": "can use 'm4exit':\n\n-- Builtin: m4exit ([CODE = 0])\nCauses 'm4' to exit, with exit status CODE.  If CODE is left out,\nthe exit status is zero.  If CODE cannot be parsed, or is outside\nthe range of 0 to 255, the exit status is one.  No further input is\nread, and all wrapped and diverted text is discarded.\n\nm4wrap(`This text is lost due to `m4exit'.')\n=>\ndivert(`1') So is this.\ndivert\n=>\nm4exit And this is never read.\n\nA common use of this is to abort processing:\n\n-- Composite: fatalerror (MESSAGE)\nAbort processing with an error message and non-zero status.  Prefix\nMESSAGE with details about where the error occurred, and print the\nresulting string to standard error.\n\ndefine(`fatalerror',\n`errprint(program:file:line`: fatal error: $*\n')m4exit(`1')')\n=>\nfatalerror(`this is a BAD one, buster')\nerror->m4:stdin:4: fatal error: this is a BAD one, buster\n\nAfter this macro call, 'm4' will exit with exit status 1.  This macro\nis only intended for error exits, since the normal exit procedures are\nnot followed, i.e., diverted text is not undiverted, and saved text\n(*note M4wrap::) is not reread.  (This macro could be made more robust\nto earlier versions of 'm4'.  You should try to see if you can find\nweaknesses and correct them; or *note Answers: Improved fatalerror.).\n\nNote that it is still possible for the exit status to be different\nthan what was requested by 'm4exit'.  If 'm4' detects some other error,\nsuch as a write error on standard output, the exit status will be\nnon-zero even if 'm4exit' requested zero.\n\nIf standard input is seekable, then the file will be positioned at\nthe next unread character.  If it is a pipe or other non-seekable file,\nthen there are no guarantees how much data 'm4' might have read into\nbuffers, and thus discarded.\n",
            "subsections": []
        },
        "File: m4.info,  Node: Frozen files,  Next: Compatibility,  Prev: Miscellaneous,  Up: Top": {
            "content": "",
            "subsections": []
        },
        "15 Fast loading of frozen state": {
            "content": "",
            "subsections": []
        },
        "Some bigger 'm4' applications may be built over a common base containing": {
            "content": "hundreds of definitions and other costly initializations.  Usually, the\ncommon base is kept in one or more declarative files, which files are\nlisted on each 'm4' invocation prior to the user's input file, or else\neach input file uses 'include'.\n\nReading the common base of a big application, over and over again,\nmay be time consuming.  GNU 'm4' offers some machinery to speed up the\nstart of an application using lengthy common bases.\n\n* Menu:\n\n* Using frozen files::          Using frozen files\n* Frozen file format::          Frozen file format\n",
            "subsections": []
        },
        "File: m4.info,  Node: Using frozen files,  Next: Frozen file format,  Up: Frozen files": {
            "content": "",
            "subsections": [
                {
                    "name": "15.1 Using frozen files",
                    "content": ""
                }
            ]
        },
        "Suppose a user has a library of 'm4' initializations in 'base.m4', which": {
            "content": "is then used with multiple input files:\n\n$ m4 base.m4 input1.m4\n$ m4 base.m4 input2.m4\n$ m4 base.m4 input3.m4\n\nRather than spending time parsing the fixed contents of 'base.m4'\nevery time, the user might rather execute:\n\n$ m4 -F base.m4f base.m4\n\nonce, and further execute, as often as needed:\n\n$ m4 -R base.m4f input1.m4\n$ m4 -R base.m4f input2.m4\n$ m4 -R base.m4f input3.m4\n\nwith the varying input.  The first call, containing the '-F' option,\nonly reads and executes file 'base.m4', defining various application\nmacros and computing other initializations.  Once the input file\n'base.m4' has been completely processed, GNU 'm4' produces in 'base.m4f'\na \"frozen\" file, that is, a file which contains a kind of snapshot of\nthe 'm4' internal state.\n\nLater calls, containing the '-R' option, are able to reload the\ninternal state of 'm4', from 'base.m4f', prior to reading any other\ninput files.  This means instead of starting with a virgin copy of 'm4',\ninput will be read after having effectively recovered the effect of a\nprior run.  In our example, the effect is the same as if file 'base.m4'\nhas been read anew.  However, this effect is achieved a lot faster.\n\nOnly one frozen file may be created or read in any one 'm4'\ninvocation.  It is not possible to recover two frozen files at once.",
            "subsections": []
        },
        "However, frozen files may be updated incrementally, through using '-R'": {
            "content": "and '-F' options simultaneously.  For example, if some care is taken,\nthe command:\n\n$ m4 file1.m4 file2.m4 file3.m4 file4.m4\n\ncould be broken down in the following sequence, accumulating the same\noutput:\n\n$ m4 -F file1.m4f file1.m4\n$ m4 -R file1.m4f -F file2.m4f file2.m4\n$ m4 -R file2.m4f -F file3.m4f file3.m4\n$ m4 -R file3.m4f file4.m4\n\nSome care is necessary because not every effort has been made for\nthis to work in all cases.  In particular, the trace attribute of macros\nis not handled, nor the current setting of 'changeword'.  Currently,\n'm4wrap' and 'sysval' also have problems.  Also, interactions for some\noptions of 'm4', being used in one call and not in the next, have not\nbeen fully analyzed yet.  On the other end, you may be confident that\nstacks of 'pushdef' definitions are handled correctly, as well as\nundefined or renamed builtins, and changed strings for quotes or\ncomments.  And future releases of GNU M4 will improve on the utility of\nfrozen files.\n\nWhen an 'm4' run is to be frozen, the automatic undiversion which\ntakes place at end of execution is inhibited.  Instead, all positively\nnumbered diversions are saved into the frozen file.  The active\ndiversion number is also transmitted.\n\nA frozen file to be reloaded need not reside in the current\ndirectory.  It is looked up the same way as an 'include' file (*note\nSearch Path::).\n\nIf the frozen file was generated with a newer version of 'm4', and\ncontains directives that an older 'm4' cannot parse, attempting to load\nthe frozen file with option '-R' will cause 'm4' to exit with status 63\nto indicate version mismatch.\n",
            "subsections": []
        },
        "File: m4.info,  Node: Frozen file format,  Prev: Using frozen files,  Up: Frozen files": {
            "content": "",
            "subsections": [
                {
                    "name": "15.2 Frozen file format",
                    "content": ""
                }
            ]
        },
        "Frozen files are sharable across architectures.  It is safe to write a": {
            "content": "frozen file on one machine and read it on another, given that the second\nmachine uses the same or newer version of GNU 'm4'.  It is conventional,\nbut not required, to give a frozen file the suffix of '.m4f'.\n\nThese are simple (editable) text files, made up of directives, each\nstarting with a capital letter and ending with a newline (<NL>).\nWherever a directive is expected, the character '#' introduces a comment\nline; empty lines are also ignored if they are not part of an embedded\nstring.  In the following descriptions, each LEN refers to the length of\nthe corresponding strings STR in the next line of input.  Numbers are\nalways expressed in decimal.  There are no escape characters.  The\ndirectives are:\n\n'C LEN1 , LEN2 <NL> STR1 STR2 <NL>'\nUses STR1 and STR2 as the begin-comment and end-comment strings.\nIf omitted, then '#' and <NL> are the comment delimiters.\n\n'D NUMBER, LEN <NL> STR <NL>'\nSelects diversion NUMBER, making it current, then copy STR in the\ncurrent diversion.  NUMBER may be a negative number for a\nnon-existing diversion.  To merely specify an active selection, use\nthis command with an empty STR.  With 0 as the diversion NUMBER,\nSTR will be issued on standard output at reload time.  GNU 'm4'\nwill not produce the 'D' directive with non-zero length for\ndiversion 0, but this can be done with manual edits.  This\ndirective may appear more than once for the same diversion, in\nwhich case the diversion is the concatenation of the various uses.\nIf omitted, then diversion 0 is current.\n\n'F LEN1 , LEN2 <NL> STR1 STR2 <NL>'\nDefines, through 'pushdef', a definition for STR1 expanding to the\nfunction whose builtin name is STR2.  If the builtin does not exist\n(for example, if the frozen file was produced by a copy of 'm4'\ncompiled with changeword support, but the version of 'm4' reloading\nwas compiled without it), the reload is silent, but any subsequent\nuse of the definition of STR1 will result in a warning.  This\ndirective may appear more than once for the same name, and its\norder, along with 'T', is important.  If omitted, you will have no\naccess to any builtins.\n\n'Q LEN1 , LEN2 <NL> STR1 STR2 <NL>'\nUses STR1 and STR2 as the begin-quote and end-quote strings.  If\nomitted, then '`' and ''' are the quote delimiters.\n\n'T LEN1 , LEN2 <NL> STR1 STR2 <NL>'\nDefines, though 'pushdef', a definition for STR1 expanding to the\ntext given by STR2.  This directive may appear more than once for\nthe same name, and its order, along with 'F', is important.\n\n'V NUMBER <NL>'\nConfirms the format of the file.  'm4' 1.4.19 only creates and\nunderstands frozen files where NUMBER is 1.  This directive must be\nthe first non-comment in the file, and may not appear more than\nonce.\n",
            "subsections": []
        },
        "File: m4.info,  Node: Compatibility,  Next: Answers,  Prev: Frozen files,  Up: Top": {
            "content": "",
            "subsections": []
        },
        "16 Compatibility with other versions of 'm4'": {
            "content": "",
            "subsections": []
        },
        "This chapter describes the many of the differences between this": {
            "content": "implementation of 'm4', and of other implementations found under UNIX,\nsuch as System V Release 4, Solaris, and BSD flavors.  In particular, it\nlists the known differences and extensions to POSIX. However, the list\nis not necessarily comprehensive.\n\nAt the time of this writing, POSIX 2001 (also known as IEEE Std\n1003.1-2001) is the latest standard, although a new version of POSIX is\nunder development and includes several proposals for modifying what 'm4'\nis required to do.  The requirements for 'm4' are shared between SUSv3\nand POSIX, and can be viewed at\n<https://www.opengroup.org/onlinepubs/000095399/utilities/m4.html>.\n\n* Menu:\n\n* Extensions::                  Extensions in GNU M4\n* Incompatibilities::           Facilities in System V m4 not in GNU M4\n* Other Incompatibilities::     Other incompatibilities\n",
            "subsections": []
        },
        "File: m4.info,  Node: Extensions,  Next: Incompatibilities,  Up: Compatibility": {
            "content": "",
            "subsections": [
                {
                    "name": "16.1 Extensions in GNU M4",
                    "content": ""
                }
            ]
        },
        "This version of 'm4' contains a few facilities that do not exist in": {
            "content": "",
            "subsections": []
        },
        "System V 'm4'.  These extra facilities are all suppressed by using the": {
            "content": "'-G' command line option (*note Invoking m4: Limits control.), unless\noverridden by other command line options.\n\n* In the '$N' notation for macro arguments, N can contain several\ndigits, while the System V 'm4' only accepts one digit.  This\nallows macros in GNU 'm4' to take any number of arguments, and not\nonly nine (*note Arguments::).\n\nThis means that 'define(`foo', `$11')' is ambiguous between\nimplementations.  To portably choose between grabbing the first\nparameter and appending 1 to the expansion, or grabbing the\neleventh parameter, you can do the following:\n\ndefine(`a1', `A1')\n=>\ndnl First argument, concatenated with 1\ndefine(`1', `$1')define(`first1', `1($@)1')\n=>\ndnl Eleventh argument, portable\ndefine(`9', `$9')define(`eleventh', `9(shift(shift($@)))')\n=>\ndnl Eleventh argument, GNU style\ndefine(`Eleventh', `$11')\n=>\nfirst1(`a', `b', `c', `d', `e', `f', `g', `h', `i', `j', `k')\n=>A1\neleventh(`a', `b', `c', `d', `e', `f', `g', `h', `i', `j', `k')\n=>k\nEleventh(`a', `b', `c', `d', `e', `f', `g', `h', `i', `j', `k')\n=>k\n\nAlso see the 'argn' macro (*note Shift::).\n\n* The 'divert' (*note Divert::) macro can manage more than 9\ndiversions.  GNU 'm4' treats all positive numbers as valid\ndiversions, rather than discarding diversions greater than 9.\n\n* Files included with 'include' and 'sinclude' are sought in a user\nspecified search path, if they are not found in the working\ndirectory.  The search path is specified by the '-I' option and the\n'M4PATH' environment variable (*note Search Path::).\n\n* Arguments to 'undivert' can be non-numeric, in which case the named\nfile will be included uninterpreted in the output (*note\nUndivert::).\n\n* Formatted output is supported through the 'format' builtin, which\nis modeled after the C library function 'printf' (*note Format::).\n\n* Searches and text substitution through basic regular expressions\nare supported by the 'regexp' (*note Regexp::) and 'patsubst'\n(*note Patsubst::) builtins.  Some BSD implementations use extended\nregular expressions instead.\n\n* The output of shell commands can be read into 'm4' with 'esyscmd'\n(*note Esyscmd::).\n\n* There is indirect access to any builtin macro with 'builtin' (*note\nBuiltin::).\n\n* Macros can be called indirectly through 'indir' (*note Indir::).\n\n* The name of the program, the current input file, and the current\ninput line number are accessible through the builtins\n'program', 'file', and 'line' (*note Location::).\n\n* The format of the output from 'dumpdef' and macro tracing can be\ncontrolled with 'debugmode' (*note Debug Levels::).\n\n* The destination of trace and debug output can be controlled with\n'debugfile' (*note Debug Output::).\n\n* The 'maketemp' (*note Mkstemp::) macro behaves like 'mkstemp',\ncreating a new file with a unique name on every invocation, rather\nthan following the insecure behavior of replacing the trailing 'X'\ncharacters with the 'm4' process id.\n\n* POSIX only requires support for the command line options '-s',\n'-D', and '-U', so all other options accepted by GNU M4 are\nextensions.  *Note Invoking m4::, for a description of these\noptions.\n\nThe debugging and tracing facilities in GNU 'm4' are much more\nextensive than in most other versions of 'm4'.\n",
            "subsections": []
        },
        "File: m4.info,  Node: Incompatibilities,  Next: Other Incompatibilities,  Prev: Extensions,  Up: Compatibility": {
            "content": "",
            "subsections": [
                {
                    "name": "16.2 Facilities in System V 'm4' not in GNU 'm4'",
                    "content": ""
                }
            ]
        },
        "The version of 'm4' from System V contains a few facilities that have": {
            "content": "not been implemented in GNU 'm4' yet.  Additionally, POSIX requires some\nbehaviors that GNU 'm4' has not implemented yet.  Relying on these\nbehaviors is non-portable, as a future release of GNU 'm4' may change.\n\n* POSIX requires support for multiple arguments to 'defn', without\nany clarification on how 'defn' behaves when one of the multiple\narguments names a builtin.  System V 'm4' and some other\nimplementations allow mixing builtins and text macros into a single\nmacro.  GNU 'm4' only supports joining multiple text arguments,\nalthough a future implementation may lift this restriction to\nbehave more like System V.  The only portable way to join text\nmacros with builtins is via helper macros and implicit\nconcatenation of macro results.\n\n* POSIX requires an application to exit with non-zero status if it\nwrote an error message to stderr.  This has not yet been\nconsistently implemented for the various builtins that are required\nto issue an error (such as 'eval' (*note Eval::) when an argument\ncannot be parsed).\n\n* Some traditional implementations only allow reading standard input\nonce, but GNU 'm4' correctly handles multiple instances of '-' on\nthe command line.\n\n* POSIX requires 'm4wrap' (*note M4wrap::) to act in FIFO (first-in,\nfirst-out) order, but GNU 'm4' currently uses LIFO order.\nFurthermore, POSIX states that only the first argument to 'm4wrap'\nis saved for later evaluation, but GNU 'm4' saves and processes all\narguments, with output separated by spaces.\n\n* POSIX states that builtins that require arguments, but are called\nwithout arguments, have undefined behavior.  Traditional\nimplementations simply behave as though empty strings had been\npassed.  For example, 'a`'define`'b' would expand to 'ab'.  But GNU\n'm4' ignores certain builtins if they have missing arguments,\ngiving 'adefineb' for the above example.\n\n* Traditional implementations handle 'define(`f',`1')' (*note\nDefine::) by undefining the entire stack of previous definitions,\nand if doing 'undefine(`f')' first.  GNU 'm4' replaces just the top\ndefinition on the stack, as if doing 'popdef(`f')' followed by\n'pushdef(`f',`1')'.  POSIX allows either behavior.\n\n* POSIX 2001 requires 'syscmd' (*note Syscmd::) to evaluate command\noutput for macro expansion, but this was a mistake that is\nanticipated to be corrected in the next version of POSIX. GNU 'm4'\nfollows traditional behavior in 'syscmd' where output is not\nrescanned, and provides the extension 'esyscmd' that does scan the\noutput.\n\n* At one point, POSIX required 'changequote(ARG)' (*note\nChangequote::) to use newline as the close quote, but this was a\nbug, and the next version of POSIX is anticipated to state that\nusing empty strings or just one argument is unspecified.\nMeanwhile, the GNU 'm4' behavior of treating an empty end-quote\ndelimiter as ''' is not portable, as Solaris treats it as repeating\nthe start-quote delimiter, and BSD treats it as leaving the\nprevious end-quote delimiter unchanged.  For predictable results,\nnever call changequote with just one argument, or with empty\nstrings for arguments.\n\n* At one point, POSIX required 'changecom(ARG,)' (*note Changecom::)\nto make it impossible to end a comment, but this is a bug, and the\nnext version of POSIX is anticipated to state that using empty\nstrings is unspecified.  Meanwhile, the GNU 'm4' behavior of\ntreating an empty end-comment delimiter as newline is not portable,\nas BSD treats it as leaving the previous end-comment delimiter\nunchanged.  It is also impossible in BSD implementations to disable\ncomments, even though that is required by POSIX. For predictable\nresults, never call changecom with empty strings for arguments.\n\n* Most implementations of 'm4' give macros a higher precedence than\ncomments when parsing, meaning that if the start delimiter given to\n'changecom' (*note Changecom::) starts with a macro name, comments\nare effectively disabled.  POSIX does not specify what the\nprecedence is, so this version of GNU 'm4' parser recognizes\ncomments, then macros, then quoted strings.\n\n* Traditional implementations allow argument collection, but not\nstring and comment processing, to span file boundaries.  Thus, if\n'a.m4' contains 'len(', and 'b.m4' contains 'abc)', 'm4 a.m4 b.m4'\noutputs '3' with traditional 'm4', but gives an error message that\nthe end of file was encountered inside a macro with GNU 'm4'.  On\nthe other hand, traditional implementations do end of file\nprocessing for files included with 'include' or 'sinclude' (*note\nInclude::), while GNU 'm4' seamlessly integrates the content of\nthose files.  Thus 'include(`a.m4')include(`b.m4')' will output '3'\ninstead of giving an error.\n\n* Traditional 'm4' treats 'traceon' (*note Trace::) without arguments\nas a global variable, independent of named macro tracing.  Also,\nonce a macro is undefined, named tracing of that macro is lost.  On\nthe other hand, when GNU 'm4' encounters 'traceon' without\narguments, it turns tracing on for all existing definitions at the\ntime, but does not trace future definitions; 'traceoff' without\narguments turns tracing off for all definitions regardless of\nwhether they were also traced by name; and tracing by name, such as\nwith '-tfoo' at the command line or 'traceon(`foo')' in the input,\nis an attribute that is preserved even if the macro is currently\nundefined.\n\nAdditionally, while POSIX requires trace output, it makes no\ndemands on the formatting of that output.  Parsing trace output is\nnot guaranteed to be reliable, even between different releases of\nGNU M4; however, the intent is that any future changes in trace\noutput will only occur under the direction of additional\n'debugmode' flags (*note Debug Levels::).\n\n* POSIX requires 'eval' (*note Eval::) to treat all operators with\nthe same precedence as C.  However, earlier versions of GNU 'm4'\nfollowed the traditional behavior of other 'm4' implementations,\nwhere bitwise and logical negation ('~' and '!') have lower\nprecedence than equality operators; and where equality operators\n('==' and '!=') had the same precedence as relational operators\n(such as '<').  Use explicit parentheses to ensure proper\nprecedence.  As extensions to POSIX, GNU 'm4' gives well-defined\nsemantics to operations that C leaves undefined, such as when\noverflow occurs, when shifting negative numbers, or when performing\ndivision by zero.  POSIX also requires '=' to cause an error, but\nmany traditional implementations allowed it as an alias for '=='.\n\n* POSIX 2001 requires 'translit' (*note Translit::) to treat each\ncharacter of the second and third arguments literally.  However, it\nis anticipated that the next version of POSIX will allow the GNU\n'm4' behavior of treating '-' as a range operator.\n\n* POSIX requires 'm4' to honor the locale environment variables of\n'LANG', 'LCALL', 'LCCTYPE', 'LCMESSAGES', and 'NLSPATH', but\nthis has not yet been implemented in GNU 'm4'.\n\n* POSIX states that only unquoted leading newlines and blanks (that\nis, space and tab) are ignored when collecting macro arguments.\nHowever, this appears to be a bug in POSIX, since most traditional\nimplementations also ignore all whitespace (formfeed, carriage\nreturn, and vertical tab).  GNU 'm4' follows tradition and ignores\nall leading unquoted whitespace.\n\n* A strictly-compliant POSIX client is not allowed to use\ncommand-line arguments not specified by POSIX. However, since this\nversion of M4 ignores 'POSIXLYCORRECT' and enables the option\n'--gnu' by default (*note Invoking m4: Limits control.), a client\ndesiring to be strictly compliant has no way to disable GNU\nextensions that conflict with POSIX when directly invoking the\ncompiled 'm4'.  A future version of 'GNU' M4 will honor the\nenvironment variable 'POSIXLYCORRECT', implicitly enabling\n'--traditional' if it is set, in order to allow a\nstrictly-compliant client.  In the meantime, a client needing\nstrict POSIX compliance can use the workaround of invoking a shell\nscript wrapper, where the wrapper then adds '--traditional' to the\narguments passed to the compiled 'm4'.\n",
            "subsections": []
        },
        "File: m4.info,  Node: Other Incompatibilities,  Prev: Incompatibilities,  Up: Compatibility": {
            "content": "",
            "subsections": [
                {
                    "name": "16.3 Other incompatibilities",
                    "content": ""
                }
            ]
        },
        "There are a few other incompatibilities between this implementation of": {
            "content": "'m4', and the System V version.\n\n* GNU 'm4' implements sync lines differently from System V 'm4', when\ntext is being diverted.  GNU 'm4' outputs the sync lines when the\ntext is being diverted, and System V 'm4' when the diverted text is\nbeing brought back.\n\nThe problem is which lines and file names should be attached to\ntext that is being, or has been, diverted.  System V 'm4' regards\nall the diverted text as being generated by the source line\ncontaining the 'undivert' call, whereas GNU 'm4' regards the\ndiverted text as being generated at the time it is diverted.\n\nThe sync line option is used mostly when using 'm4' as a front end\nto a compiler.  If a diverted line causes a compiler error, the\nerror messages should most probably refer to the place where the\ndiversion was made, and not where it was inserted again.\n\ndivert(2)2\ndivert(1)1\ndivert`'0\n=>#line 3 \"stdin\"\n=>0\n^D\n=>#line 2 \"stdin\"\n=>1\n=>#line 1 \"stdin\"\n=>2\n\nThe current 'm4' implementation has a limitation that the syncline\noutput at the start of each diversion occurs no matter what, even\nif the previous diversion did not end with a newline.  This goes\ncontrary to the claim that synclines appear on a line by\nthemselves, so this limitation may be corrected in a future version\nof 'm4'.  In the meantime, when using '-s', it is wisest to make\nsure all diversions end with newline.\n\n* GNU 'm4' makes no attempt at prohibiting self-referential\ndefinitions like:\n\ndefine(`x', `x')\n=>\ndefine(`x', `x ')\n=>\n\nThere is nothing inherently wrong with defining 'x' to return 'x'.\nThe wrong thing is to expand 'x' unquoted, because that would cause\nan infinite rescan loop.  In 'm4', one might use macros to hold\nstrings, as we do for variables in other programming languages,\nfurther checking them with:\n\nifelse(defn(`HOLDER'), `VALUE', ...)\n\nIn cases like this one, an interdiction for a macro to hold its own\nname would be a useless limitation.  Of course, this leaves more\nrope for the GNU 'm4' user to hang himself!  Rescanning hangs may\nbe avoided through careful programming, a little like for endless\nloops in traditional programming languages.\n",
            "subsections": []
        },
        "File: m4.info,  Node: Answers,  Next: Copying This Package,  Prev: Compatibility,  Up: Top": {
            "content": "",
            "subsections": []
        },
        "17 Correct version of some examples": {
            "content": "",
            "subsections": []
        },
        "Some of the examples in this manuals are buggy or not very robust, for": {
            "content": "demonstration purposes.  Improved versions of these composite macros are\npresented here.\n\n* Menu:\n\n* Improved exch::               Solution for 'exch'\n* Improved forloop::            Solution for 'forloop'\n* Improved foreach::            Solution for 'foreach'\n* Improved copy::               Solution for 'copy'\n* Improved m4wrap::             Solution for 'm4wrap'\n* Improved cleardivert::        Solution for 'cleardivert'\n* Improved capitalize::         Solution for 'capitalize'\n* Improved fatalerror::        Solution for 'fatalerror'\n",
            "subsections": []
        },
        "File: m4.info,  Node: Improved exch,  Next: Improved forloop,  Up: Answers": {
            "content": "",
            "subsections": [
                {
                    "name": "17.1 Solution for 'exch'",
                    "content": "The 'exch' macro (*note Arguments::) as presented requires clients to\ndouble quote their arguments.  A nicer definition, which lets clients\nfollow the rule of thumb of one level of quoting per level of\nparentheses, involves adding quotes in the definition of 'exch', as\nfollows:\n\ndefine(`exch', ``$2', `$1'')\n=>\ndefine(exch(`expansion text', `macro'))\n=>\nmacro\n=>expansion text\n"
                }
            ]
        },
        "File: m4.info,  Node: Improved forloop,  Next: Improved foreach,  Prev: Improved exch,  Up: Answers": {
            "content": "",
            "subsections": [
                {
                    "name": "17.2 Solution for 'forloop'",
                    "content": "The 'forloop' macro (*note Forloop::) as presented earlier can go into\nan infinite loop if given an iterator that is not parsed as a macro\nname.  It does not do any sanity checking on its numeric bounds, and\nonly permits decimal numbers for bounds.  Here is an improved version,\nshipped as 'm4-1.4.19/examples/forloop2.m4'; this version also optimizes\noverhead by calling four macros instead of six per iteration (excluding\nthose in TEXT), by not dereferencing the ITERATOR in the helper\n'forloop'.\n\n$ m4 -d -I examples\nundivert(`forloop2.m4')dnl\n=>divert(`-1')\n=># forloop(var, from, to, stmt) - improved version:\n=>#   works even if VAR is not a strict macro name\n=>#   performs sanity check that FROM is larger than TO\n=>#   allows complex numerical expressions in TO and FROM\n=>define(`forloop', `ifelse(eval(`($2) <= ($3)'), `1',\n=>  `pushdef(`$1')$0(`$1', eval(`$2'),\n=>    eval(`$3'), `$4')popdef(`$1')')')\n=>define(`forloop',\n=>  `define(`$1', `$2')$4`'ifelse(`$2', `$3', `',\n=>    `$0(`$1', incr(`$2'), `$3', `$4')')')\n=>divert`'dnl\ninclude(`forloop2.m4')\n=>\nforloop(`i', `2', `1', `no iteration occurs')\n=>\nforloop(`', `1', `2', ` odd iterator name')\n=> odd iterator name odd iterator name\nforloop(`i', `5 + 5', `0xc', ` 0x`'eval(i, `16')')\n=> 0xa 0xb 0xc\nforloop(`i', `a', `b', `non-numeric bounds')\nerror->m4:stdin:6: bad expression in eval (bad input): (a) <= (b)\n=>\n\nOne other change to notice is that the improved version used '$0'\nrather than 'foreach' to invoke the helper routine.  In general, this\nis a good practice to follow, because then the set of macros can be\nuniformly transformed.  The following example shows a transformation\nthat doubles the current quoting and appends a suffix '2' to each\ntransformed macro.  If 'foreach' refers to the literal 'foreach', then\n'foreach2' invokes 'foreach' instead of the intended 'foreach2', and\nthe mixing of quoting paradigms leads to an infinite recursion loop in\nthis example.\n\n$ m4 -d -L 9 -I examples\ndefine(`arg1', `$1')include(`forloop2.m4')include(`quote.m4')\n=>\ndefine(`double', `define(`$1'`2',\narg1(patsubst(dquote(defn(`$1')), `[`']', `\\&\\&')))')\n=>\ndouble(`forloop')double(`forloop')defn(`forloop2')\n=>ifelse(eval(``($2) <= ($3)''), ``1'',\n=>  ``pushdef(``$1'')$0(``$1'', eval(``$2''),\n=>    eval(``$3''), ``$4'')popdef(``$1'')'')\nforloop(i, 1, 5, `ifelse(')forloop(i, 1, 5, `)')\n=>\nchangequote(`[', `]')changequote([``], [''])\n=>\nforloop2(i, 1, 5, ``ifelse('')forloop2(i, 1, 5, ``)'')\n=>\nchangequote`'include(`forloop.m4')\n=>\ndouble(`forloop')double(`forloop')defn(`forloop2')\n=>pushdef(``$1'', ``$2'')forloop($@)popdef(``$1'')\nforloop(i, 1, 5, `ifelse(')forloop(i, 1, 5, `)')\n=>\nchangequote(`[', `]')changequote([``], [''])\n=>\nforloop2(i, 1, 5, ``ifelse('')forloop2(i, 1, 5, ``)'')\nerror->m4:stdin:12: recursion limit of 9 exceeded, use -L<N> to change it\n\nOne more optimization is still possible.  Instead of repeatedly\nassigning a variable then invoking or dereferencing it, it is possible\nto pass the current iterator value as a single argument.  Coupled with\n'curry' if other arguments are needed (*note Composition::), or with\nhelper macros if the argument is needed in more than one place in the\nexpansion, the output can be generated with three, rather than four,\nmacros of overhead per iteration.  Notice how the file\n'm4-1.4.19/examples/forloop3.m4' rearranges the arguments of the helper\n'forloop' to take two arguments that are placed around the current\nvalue.  By splitting a balanced set of parantheses across multiple\narguments, the helper macro can now be shared by 'forloop' and the new\n'forlooparg'.\n\n$ m4 -I examples\ninclude(`forloop3.m4')\n=>\nundivert(`forloop3.m4')dnl\n=>divert(`-1')\n=># forlooparg(from, to, macro) - invoke MACRO(value) for\n=>#   each value between FROM and TO, without define overhead\n=>define(`forlooparg', `ifelse(eval(`($1) <= ($2)'), `1',\n=>  `forloop(`$1', eval(`$2'), `$3(', `)')')')\n=># forloop(var, from, to, stmt) - refactored to share code\n=>define(`forloop', `ifelse(eval(`($2) <= ($3)'), `1',\n=>  `pushdef(`$1')forloop(eval(`$2'), eval(`$3'),\n=>    `define(`$1',', `)$4')popdef(`$1')')')\n=>define(`forloop',\n=>  `$3`$1'$4`'ifelse(`$1', `$2', `',\n=>    `$0(incr(`$1'), `$2', `$3', `$4')')')\n=>divert`'dnl\nforloop(`i', `1', `3', ` i')\n=> 1 2 3\ndefine(`echo', `$@')\n=>\nforlooparg(`1', `3', ` echo')\n=> 1 2 3\ninclude(`curry.m4')\n=>\nforlooparg(`1', `3', `curry(`pushdef', `a')')\n=>\na\n=>3\npopdef(`a')a\n=>2\npopdef(`a')a\n=>1\npopdef(`a')a\n=>a\n\nOf course, it is possible to make even more improvements, such as\nadding an optional step argument, or allowing iteration through\ndescending sequences.  GNU Autoconf provides some of these additional\nbells and whistles in its 'm4for' macro.\n"
                }
            ]
        },
        "File: m4.info,  Node: Improved foreach,  Next: Improved copy,  Prev: Improved forloop,  Up: Answers": {
            "content": "",
            "subsections": [
                {
                    "name": "17.3 Solution for 'foreach'",
                    "content": "The 'foreach' and 'foreachq' macros (*note Foreach::) as presented\nearlier each have flaws.  First, we will examine and fix the quadratic\nbehavior of 'foreachq':\n\n$ m4 -I examples\ninclude(`foreachq.m4')\n=>\ntraceon(`shift')debugmode(`aq')\n=>\nforeachq(`x', ``1', `2', `3', `4'', `x\n')dnl\n=>1\nerror->m4trace: -3- shift(`1', `2', `3', `4')\nerror->m4trace: -2- shift(`1', `2', `3', `4')\n=>2\nerror->m4trace: -4- shift(`1', `2', `3', `4')\nerror->m4trace: -3- shift(`2', `3', `4')\nerror->m4trace: -3- shift(`1', `2', `3', `4')\nerror->m4trace: -2- shift(`2', `3', `4')\n=>3\nerror->m4trace: -5- shift(`1', `2', `3', `4')\nerror->m4trace: -4- shift(`2', `3', `4')\nerror->m4trace: -3- shift(`3', `4')\nerror->m4trace: -4- shift(`1', `2', `3', `4')\nerror->m4trace: -3- shift(`2', `3', `4')\nerror->m4trace: -2- shift(`3', `4')\n=>4\nerror->m4trace: -6- shift(`1', `2', `3', `4')\nerror->m4trace: -5- shift(`2', `3', `4')\nerror->m4trace: -4- shift(`3', `4')\nerror->m4trace: -3- shift(`4')\n\nEach successive iteration was adding more quoted 'shift' invocations,\nand the entire list contents were passing through every iteration.  In\ngeneral, when recursing, it is a good idea to make the recursion use\nfewer arguments, rather than adding additional quoted uses of 'shift'."
                }
            ]
        },
        "By doing so, 'm4' uses less memory, invokes fewer macros, is less likely": {
            "content": "to run into machine limits, and most importantly, performs faster.  The\nfixed version of 'foreachq' can be found in\n'm4-1.4.19/examples/foreachq2.m4':\n\n$ m4 -I examples\ninclude(`foreachq2.m4')\n=>\nundivert(`foreachq2.m4')dnl\n=>include(`quote.m4')dnl\n=>divert(`-1')\n=># foreachq(x, `item1, item2, ..., itemn', stmt)\n=>#   quoted list, improved version\n=>define(`foreachq', `pushdef(`$1')$0($@)popdef(`$1')')\n=>define(`arg1q', ``$1'')\n=>define(`rest', `ifelse(`$#', `1', `', `dquote(shift($@))')')\n=>define(`foreachq', `ifelse(`$2', `', `',\n=>  `define(`$1', arg1q($2))$3`'$0(`$1', rest($2), `$3')')')\n=>divert`'dnl\ntraceon(`shift')debugmode(`aq')\n=>\nforeachq(`x', ``1', `2', `3', `4'', `x\n')dnl\n=>1\nerror->m4trace: -3- shift(`1', `2', `3', `4')\n=>2\nerror->m4trace: -3- shift(`2', `3', `4')\n=>3\nerror->m4trace: -3- shift(`3', `4')\n=>4\n\nNote that the fixed version calls unquoted helper macros in\n'foreachq' to trim elements immediately; those helper macros in turn\nmust re-supply the layer of quotes lost in the macro invocation.",
            "subsections": []
        },
        "Contrast the use of 'arg1q', which quotes the first list element, with": {
            "content": "'arg1' of the earlier implementation that returned the first list\nelement directly.  Additionally, by calling the helper method\nimmediately, the 'defn(`ITERATOR')' no longer contains unexpanded\nmacros.\n\nThe astute m4 programmer might notice that the solution above still\nuses more memory and macro invocations, and thus more time, than\nstrictly necessary.  Note that '$2', which contains an arbitrarily long\nquoted list, is expanded and rescanned three times per iteration of\n'foreachq'.  Furthermore, every iteration of the algorithm effectively\nunboxes then reboxes the list, which costs a couple of macro\ninvocations.  It is possible to rewrite the algorithm for a bit more\nspeed by swapping the order of the arguments to 'foreachq' in order to\noperate on an unboxed list in the first place, and by using the\nfixed-length '$#' instead of an arbitrary length list as the key to end\nrecursion.  The result is an overhead of six macro invocations per loop\n(excluding any macros in TEXT), instead of eight.  This alternative\napproach is available as 'm4-1.4.19/examples/foreach3.m4':\n\n$ m4 -I examples\ninclude(`foreachq3.m4')\n=>\nundivert(`foreachq3.m4')dnl\n=>divert(`-1')\n=># foreachq(x, `item1, item2, ..., itemn', stmt)\n=>#   quoted list, alternate improved version\n=>define(`foreachq', `ifelse(`$2', `', `',\n=>  `pushdef(`$1')$0(`$1', `$3', `', $2)popdef(`$1')')')\n=>define(`foreachq', `ifelse(`$#', `3', `',\n=>  `define(`$1', `$4')$2`'$0(`$1', `$2',\n=>    shift(shift(shift($@))))')')\n=>divert`'dnl\ntraceon(`shift')debugmode(`aq')\n=>\nforeachq(`x', ``1', `2', `3', `4'', `x\n')dnl\n=>1\nerror->m4trace: -4- shift(`x', `x\nerror->', `', `1', `2', `3', `4')\nerror->m4trace: -3- shift(`x\nerror->', `', `1', `2', `3', `4')\nerror->m4trace: -2- shift(`', `1', `2', `3', `4')\n=>2\nerror->m4trace: -4- shift(`x', `x\nerror->', `1', `2', `3', `4')\nerror->m4trace: -3- shift(`x\nerror->', `1', `2', `3', `4')\nerror->m4trace: -2- shift(`1', `2', `3', `4')\n=>3\nerror->m4trace: -4- shift(`x', `x\nerror->', `2', `3', `4')\nerror->m4trace: -3- shift(`x\nerror->', `2', `3', `4')\nerror->m4trace: -2- shift(`2', `3', `4')\n=>4\nerror->m4trace: -4- shift(`x', `x\nerror->', `3', `4')\nerror->m4trace: -3- shift(`x\nerror->', `3', `4')\nerror->m4trace: -2- shift(`3', `4')\n\nIn the current version of M4, every instance of '$@' is rescanned as\nit is encountered.  Thus, the 'foreachq3.m4' alternative uses much less\nmemory than 'foreachq2.m4', and executes as much as 10% faster, since\neach iteration encounters fewer '$@'.  However, the implementation of\nrescanning every byte in '$@' is quadratic in the number of bytes\nscanned (for example, making the broken version in 'foreachq.m4' cubic,\nrather than quadratic, in behavior).  A future release of M4 will\nimprove the underlying implementation by reusing results of previous\nscans, so that both styles of 'foreachq' can become linear in the number\nof bytes scanned.  Notice how the implementation injects an empty\nargument prior to expanding '$2' within 'foreachq'; the helper macro\n'foreachq' then ignores the third argument altogether, and ends\nrecursion when there are three arguments left because there was nothing\nleft to pass through 'shift'.  Thus, each iteration only needs one\n'ifelse', rather than the two conditionals used in the version from\n'foreachq2.m4'.\n\nSo far, all of the implementations of 'foreachq' presented have been\nquadratic with M4 1.4.x.  But 'forloop' is linear, because each\niteration parses a constant amount of arguments.  So, it is possible to\ndesign a variant that uses 'forloop' to do the iteration, then uses '$@'\nonly once at the end, giving a linear result even with older M4\nimplementations.  This implementation relies on the GNU extension that\n'$10' expands to the tenth argument rather than the first argument\nconcatenated with '0'.  The trick is to define an intermediate macro\nthat repeats the text 'm4define(`$1', `$N')$2`'', with 'n' set to\nsuccessive integers corresponding to each argument.  The helper macro\n'foreachq' is needed in order to generate the literal sequences such\nas '$1' into the intermediate macro, rather than expanding them as the\narguments of 'foreachq'.  With this approach, no 'shift' calls are even\nneeded!  Even though there are seven macros of overhead per iteration\ninstead of six in 'foreachq3.m4', the linear scaling is apparent at\nrelatively small list sizes.  However, this approach will need\nadjustment when a future version of M4 follows POSIX by no longer\ntreating '$10' as the tenth argument; the anticipation is that '${10}'\ncan be used instead, although that alternative syntax is not yet\nsupported.\n\n$ m4 -I examples\ninclude(`foreachq4.m4')\n=>\nundivert(`foreachq4.m4')dnl\n=>include(`forloop2.m4')dnl\n=>divert(`-1')\n=># foreachq(x, `item1, item2, ..., itemn', stmt)\n=>#   quoted list, version based on forloop\n=>define(`foreachq',\n=>`ifelse(`$2', `', `', `$0(`$1', `$3', $2)')')\n=>define(`foreachq',\n=>`pushdef(`$1', forloop(`$1', `3', `$#',\n=>  `$0(`1', `2', indir(`$1'))')`popdef(\n=>    `$1')')indir(`$1', $@)')\n=>define(`foreachq',\n=>``define(`$$1', `$$3')$$2`''')\n=>divert`'dnl\ntraceon(`shift')debugmode(`aq')\n=>\nforeachq(`x', ``1', `2', `3', `4'', `x\n')dnl\n=>1\n=>2\n=>3\n=>4\n\nFor yet another approach, the improved version of 'foreach',\navailable in 'm4-1.4.19/examples/foreach2.m4', simply overquotes the\narguments to 'foreach' to begin with, using 'dquoteelt'.  Then\n'foreach' can just use 'arg1' to remove the extra layer of quoting\nthat was added up front:\n\n$ m4 -I examples\ninclude(`foreach2.m4')\n=>\nundivert(`foreach2.m4')dnl\n=>include(`quote.m4')dnl\n=>divert(`-1')\n=># foreach(x, (item1, item2, ..., itemn), stmt)\n=>#   parenthesized list, improved version\n=>define(`foreach', `pushdef(`$1')$0(`$1',\n=>  (dquote(dquoteelt$2)), `$3')popdef(`$1')')\n=>define(`arg1', `$1')\n=>define(`foreach', `ifelse(`$2', `(`')', `',\n=>  `define(`$1', arg1$2)$3`'$0(`$1', (dquote(shift$2)), `$3')')')\n=>divert`'dnl\ntraceon(`shift')debugmode(`aq')\n=>\nforeach(`x', `(`1', `2', `3', `4')', `x\n')dnl\nerror->m4trace: -4- shift(`1', `2', `3', `4')\nerror->m4trace: -4- shift(`2', `3', `4')\nerror->m4trace: -4- shift(`3', `4')\n=>1\nerror->m4trace: -3- shift(``1'', ``2'', ``3'', ``4'')\n=>2\nerror->m4trace: -3- shift(``2'', ``3'', ``4'')\n=>3\nerror->m4trace: -3- shift(``3'', ``4'')\n=>4\nerror->m4trace: -3- shift(``4'')\n\nIt is likewise possible to write a variant of 'foreach' that performs\nin linear time on M4 1.4.x; the easiest method is probably writing a\nversion of 'foreach' that unboxes its list, then invokes 'foreachq' as\npreviously defined in 'foreachq4.m4'.\n\nIn summary, recursion over list elements is trickier than it appeared\nat first glance, but provides a powerful idiom within 'm4' processing.",
            "subsections": []
        },
        "As a final demonstration, both list styles are now able to handle": {
            "content": "several scenarios that would wreak havoc on one or both of the original\nimplementations.  This points out one other difference between the list\nstyles.  'foreach' evaluates unquoted list elements only once, in\npreparation for calling 'foreach', similary for 'foreachq' as provided\nby 'foreachq3.m4' or 'foreachq4.m4'.  But 'foreachq', as provided by\n'foreachq2.m4', evaluates unquoted list elements twice while visiting\nthe first list element, once in 'arg1q' and once in 'rest'.  When\ndeciding which list style to use, one must take into account whether\nrepeating the side effects of unquoted list elements will have any\ndetrimental effects.\n\n$ m4 -I examples\ninclude(`foreach2.m4')\n=>\ninclude(`foreachq2.m4')\n=>\ndnl 0-element list:\nforeach(`x', `', `<x>') / foreachq(`x', `', `<x>')\n=> /\ndnl 1-element list of empty element\nforeach(`x', `()', `<x>') / foreachq(`x', ``'', `<x>')\n=><> / <>\ndnl 2-element list of empty elements\nforeach(`x', `(`',`')', `<x>') / foreachq(`x', ``',`'', `<x>')\n=><><> / <><>\ndnl 1-element list of a comma\nforeach(`x', `(`,')', `<x>') / foreachq(`x', ``,'', `<x>')\n=><,> / <,>\ndnl 2-element list of unbalanced parentheses\nforeach(`x', `(`(', `)')', `<x>') / foreachq(`x', ``(', `)'', `<x>')\n=><(><)> / <(><)>\ndefine(`ab', `oops')dnl using defn(`iterator')\nforeach(`x', `(`a', `b')', `defn(`x')') /dnl\nforeachq(`x', ``a', `b'', `defn(`x')')\n=>ab / ab\ndefine(`active', `ACT, IVE')\n=>\ntraceon(`active')\n=>\ndnl list of unquoted macros; expansion occurs before recursion\nforeach(`x', `(active, active)', `<x>\n')dnl\nerror->m4trace: -4- active -> `ACT, IVE'\nerror->m4trace: -4- active -> `ACT, IVE'\n=><ACT>\n=><IVE>\n=><ACT>\n=><IVE>\nforeachq(`x', `active, active', `<x>\n')dnl\nerror->m4trace: -3- active -> `ACT, IVE'\nerror->m4trace: -3- active -> `ACT, IVE'\n=><ACT>\nerror->m4trace: -3- active -> `ACT, IVE'\nerror->m4trace: -3- active -> `ACT, IVE'\n=><IVE>\n=><ACT>\n=><IVE>\ndnl list of quoted macros; expansion occurs during recursion\nforeach(`x', `(`active', `active')', `<x>\n')dnl\nerror->m4trace: -1- active -> `ACT, IVE'\n=><ACT, IVE>\nerror->m4trace: -1- active -> `ACT, IVE'\n=><ACT, IVE>\nforeachq(`x', ``active', `active'', `<x>\n')dnl\nerror->m4trace: -1- active -> `ACT, IVE'\n=><ACT, IVE>\nerror->m4trace: -1- active -> `ACT, IVE'\n=><ACT, IVE>\ndnl list of double-quoted macro names; no expansion\nforeach(`x', `(``active'', ``active'')', `<x>\n')dnl\n=><active>\n=><active>\nforeachq(`x', ```active'', ``active''', `<x>\n')dnl\n=><active>\n=><active>\n",
            "subsections": []
        },
        "File: m4.info,  Node: Improved copy,  Next: Improved m4wrap,  Prev: Improved foreach,  Up: Answers": {
            "content": "",
            "subsections": [
                {
                    "name": "17.4 Solution for 'copy'",
                    "content": ""
                }
            ]
        },
        "The macro 'copy' presented above is unable to handle builtin tokens with": {
            "content": "M4 1.4.x, because it tries to pass the builtin token through the macro\n'curry', where it is silently flattened to an empty string (*note",
            "subsections": []
        },
        "Composition::).  Rather than using the problematic 'curry' to work": {
            "content": "around the limitation that 'stackforeach' expects to invoke a macro\nthat takes exactly one argument, we can write a new macro that lets us\nform the exact two-argument 'pushdef' call sequence needed, so that we\nare no longer passing a builtin token through a text macro.\n\n-- Composite: stackforeachsep (MACRO, PRE, POST, SEP)\n-- Composite: stackforeachseplifo (MACRO, PRE, POST, SEP)\nFor each of the 'pushdef' definitions associated with MACRO, expand\nthe sequence 'PRE`'definition`'POST'.  Additionally, expand SEP\nbetween definitions.  'stackforeachsep' visits the oldest\ndefinition first, while 'stackforeachseplifo' visits the current\ndefinition first.  The expansion may dereference MACRO, but should\nnot modify it.  There are a few special macros, such as 'defn',\nwhich cannot be used as the MACRO parameter.\n\nNote that 'stackforeach(`MACRO', `ACTION')' is equivalent to\n'stackforeachsep(`MACRO', `ACTION(', `)')'.  By supplying explicit\nparentheses, split among the PRE and POST arguments to\n'stackforeachsep', it is now possible to construct macro calls with\nmore than one argument, without passing builtin tokens through a macro\ncall.  It is likewise possible to directly reference the stack\ndefinitions without a macro call, by leaving PRE and POST empty.  Thus,\nin addition to fixing 'copy' on builtin tokens, it also executes with\nfewer macro invocations.\n\nThe new macro also adds a separator that is only output after the\nfirst iteration of the helper 'stackreversesep', implemented by\nprepending the original SEP to PRE and omitting a SEP argument in\nsubsequent iterations.  Note that the empty string that separates SEP\nfrom PRE is provided as part of the fourth argument when originally\ncalling 'stackreversesep', and not by writing '$4`'$3' as the third\nargument in the recursive call; while the other approach would give the\nsame output, it does so at the expense of increasing the argument size\non each iteration of 'stackreversesep', which results in quadratic\ninstead of linear execution time.  The improved stack walking macros are\navailable in 'm4-1.4.19/examples/stacksep.m4':\n\n$ m4 -I examples\ninclude(`stacksep.m4')\n=>\ndefine(`copy', `ifdef(`$2', `errprint(`$2 already defined\n')m4exit(`1')',\n`stackforeachsep(`$1', `pushdef(`$2',', `)')')')dnl\npushdef(`a', `1')pushdef(`a', defn(`divnum'))\n=>\ncopy(`a', `b')\n=>\nb\n=>0\npopdef(`b')\n=>\nb\n=>1\npushdef(`c', `1')pushdef(`c', `2')\n=>\nstackforeachseplifo(`c', `', `', `, ')\n=>2, 1\nundivert(`stacksep.m4')dnl\n=>divert(`-1')\n=># stackforeachsep(macro, pre, post, sep)\n=># Invoke PRE`'defn`'POST with a single argument of each definition\n=># from the definition stack of MACRO, starting with the oldest, and\n=># separated by SEP between definitions.\n=>define(`stackforeachsep',\n=>`stackreversesep(`$1', `tmp-$1')'dnl\n=>`stackreversesep(`tmp-$1', `$1', `$2`'defn(`$1')$3', `$4`'')')\n=># stackforeachseplifo(macro, pre, post, sep)\n=># Like stackforeachsep, but starting with the newest definition.\n=>define(`stackforeachseplifo',\n=>`stackreversesep(`$1', `tmp-$1', `$2`'defn(`$1')$3', `$4`'')'dnl\n=>`stackreversesep(`tmp-$1', `$1')')\n=>define(`stackreversesep',\n=>`ifdef(`$1', `pushdef(`$2', defn(`$1'))$3`'popdef(`$1')$0(\n=>  `$1', `$2', `$4$3')')')\n=>divert`'dnl\n",
            "subsections": []
        },
        "File: m4.info,  Node: Improved m4wrap,  Next: Improved cleardivert,  Prev: Improved copy,  Up: Answers": {
            "content": "",
            "subsections": [
                {
                    "name": "17.5 Solution for 'm4wrap'",
                    "content": ""
                }
            ]
        },
        "The replacement 'm4wrap' versions presented above, designed to guarantee": {
            "content": "FIFO or LIFO order regardless of the underlying M4 implementation, share\na bug when dealing with wrapped text that looks like parameter\nexpansion.  Note how the invocation of 'm4wrapN' interprets these\nparameters, while using the builtin preserves them for their intended\nuse.\n\n$ m4 -I examples\ninclude(`wraplifo.m4')\n=>\nm4wrap(`define(`foo', ``$0:'-$1-$*-$#-')foo(`a', `b')\n')\n=>\nbuiltin(`m4wrap', ``'define(`bar', ``$0:'-$1-$*-$#-')bar(`a', `b')\n')\n=>\n^D\n=>bar:-a-a,b-2-\n=>m4wrap0:---0-\n\nAdditionally, the computation of 'm4wraplevel' and creation of\nmultiple 'm4wrapN' placeholders in the original examples is more\nexpensive in time and memory than strictly necessary.  Notice how the\nimproved version grabs the wrapped text via 'defn' to avoid parameter\nexpansion, then undefines 'm4wraptext', before stripping a level of\nquotes with 'arg1' to expand the text.  That way, each level of\nwrapping reuses the single placeholder, which starts each nesting level\nin an undefined state.\n\nFinally, it is worth emulating the GNU M4 extension of saving all\narguments to 'm4wrap', separated by a space, rather than saving just the\nfirst argument.  This is done with the 'join' macro documented\npreviously (*note Shift::).  The improved LIFO example is shipped as\n'm4-1.4.19/examples/wraplifo2.m4', and can easily be converted to a FIFO\nsolution by swapping the adjacent invocations of 'joinall' and 'defn'.\n\n$ m4 -I examples\ninclude(`wraplifo2.m4')\n=>\nundivert(`wraplifo2.m4')dnl\n=>dnl Redefine m4wrap to have LIFO semantics, improved example.\n=>include(`join.m4')dnl\n=>define(`m4wrap', defn(`m4wrap'))dnl\n=>define(`arg1', `$1')dnl\n=>define(`m4wrap',\n=>`ifdef(`$0text',\n=>       `define(`$0text', joinall(` ', $@)defn(`$0text'))',\n=>       `$0(`arg1(defn(`$0text')undefine(`$0text'))')dnl\n=>define(`$0text', joinall(` ', $@))')')dnl\nm4wrap(`define(`foo', ``$0:'-$1-$*-$#-')foo(`a', `b')\n')\n=>\nm4wrap(`lifo text\nm4wrap(`nested', `', `$@\n')')\n=>\n^D\n=>lifo text\n=>foo:-a-a,b-2-\n=>nested  $@\n",
            "subsections": []
        },
        "File: m4.info,  Node: Improved cleardivert,  Next: Improved capitalize,  Prev: Improved m4wrap,  Up: Answers": {
            "content": "",
            "subsections": [
                {
                    "name": "17.6 Solution for 'cleardivert'",
                    "content": "The 'cleardivert' macro (*note Cleardivert::) cannot, as it stands, be\ncalled without arguments to clear all pending diversions.  That is\nbecause using undivert with an empty string for an argument is different\nthan using it with no arguments at all.  Compare the earlier definition\nwith one that takes the number of arguments into account:\n\ndefine(`cleardivert',\n`pushdef(`n', divnum)divert(`-1')undivert($@)divert(n)popdef(`n')')\n=>\ndivert(`1')one\ndivert\n=>\ncleardivert\n=>\nundivert\n=>one\n=>\ndefine(`cleardivert',\n`pushdef(`num', divnum)divert(`-1')ifelse(`$#', `0',\n`undivert`'', `undivert($@)')divert(num)popdef(`num')')\n=>\ndivert(`2')two\ndivert\n=>\ncleardivert\n=>\nundivert\n=>\n"
                }
            ]
        },
        "File: m4.info,  Node: Improved capitalize,  Next: Improved fatalerror,  Prev: Improved cleardivert,  Up: Answers": {
            "content": "",
            "subsections": [
                {
                    "name": "17.7 Solution for 'capitalize'",
                    "content": "The 'capitalize' macro (*note Patsubst::) as presented earlier does not\nallow clients to follow the quoting rule of thumb.  Consider the three\nmacros 'active', 'Active', and 'ACTIVE', and the difference between\ncalling 'capitalize' with the expansion of a macro, expanding the result\nof a case change, and changing the case of a double-quoted string:\n\n$ m4 -I examples\ninclude(`capitalize.m4')dnl\ndefine(`active', `act1, ive')dnl\ndefine(`Active', `Act2, Ive')dnl\ndefine(`ACTIVE', `ACT3, IVE')dnl\nupcase(active)\n=>ACT1,IVE\nupcase(`active')\n=>ACT3, IVE\nupcase(``active'')\n=>ACTIVE\ndowncase(ACTIVE)\n=>act3,ive\ndowncase(`ACTIVE')\n=>act1, ive\ndowncase(``ACTIVE'')\n=>active\ncapitalize(active)\n=>Act1\ncapitalize(`active')\n=>Active\ncapitalize(``active'')\n=>capitalize(`active')\ndefine(`A', `OOPS')\n=>\ncapitalize(active)\n=>OOPSct1\ncapitalize(`active')\n=>OOPSctive\n\nFirst, when 'capitalize' is called with more than one argument, it\nwas throwing away later arguments, whereas 'upcase' and 'downcase' used\n'$*' to collect them all.  The fix is simple: use '$*' consistently.\n\nNext, with single-quoting, 'capitalize' outputs a single character, a\nset of quotes, then the rest of the characters, making it impossible to\ninvoke 'Active' after the fact, and allowing the alternate macro 'A' to\ninterfere.  Here, the solution is to use additional quoting in the\nhelper macros, then pass the final over-quoted output string through\n'arg1' to remove the extra quoting and finally invoke the concatenated\nportions as a single string.\n\nFinally, when passed a double-quoted string, the nested macro\n'capitalize' is never invoked because it ended up nested inside quotes."
                }
            ]
        },
        "This one is the toughest to fix.  In short, we have no idea how many": {
            "content": "levels of quotes are in effect on the substring being altered by\n'patsubst'.  If the replacement string cannot be expressed entirely in\nterms of literal text and backslash substitutions, then we need a\nmechanism to guarantee that the helper macros are invoked outside of\nquotes.  In other words, this sounds like a job for 'changequote' (*note",
            "subsections": []
        },
        "Changequote::).  By changing the active quoting characters, we can": {
            "content": "guarantee that replacement text injected by 'patsubst' always occurs in\nthe middle of a string that has exactly one level of over-quoting using\nalternate quotes; so the replacement text closes the quoted string,\ninvokes the helper macros, then reopens the quoted string.  In turn,\nthat means the replacement text has unbalanced quotes, necessitating\nanother round of 'changequote'.\n\nIn the fixed version below, (also shipped as\n'm4-1.4.19/examples/capitalize2.m4'), 'capitalize' uses the alternate\nquotes of '<<[' and ']>>' (the longer strings are chosen so as to be\nless likely to appear in the text being converted).  The helpers\n'toalt' and 'fromalt' merely reduce the number of characters\nrequired to perform a 'changequote', since the definition changes twice.",
            "subsections": []
        },
        "The outermost pair means that 'patsubst' and 'capitalizealt' are": {
            "content": "invoked with alternate quoting; the innermost pair is used so that the\nthird argument to 'patsubst' can contain an unbalanced ']>>'/'<<[' pair.",
            "subsections": []
        },
        "Note that 'upcase' and 'downcase' must be redefined as 'upcasealt' and": {
            "content": "'downcasealt', since they contain nested quotes but are invoked with\nthe alternate quoting scheme in effect.\n\n$ m4 -I examples\ninclude(`capitalize2.m4')dnl\ndefine(`active', `act1, ive')dnl\ndefine(`Active', `Act2, Ive')dnl\ndefine(`ACTIVE', `ACT3, IVE')dnl\ndefine(`A', `OOPS')dnl\ncapitalize(active; `active'; ``active''; ```actIVE''')\n=>Act1,Ive; Act2, Ive; Active; `Active'\nundivert(`capitalize2.m4')dnl\n=>divert(`-1')\n=># upcase(text)\n=># downcase(text)\n=># capitalize(text)\n=>#   change case of text, improved version\n=>define(`upcase', `translit(`$*', `a-z', `A-Z')')\n=>define(`downcase', `translit(`$*', `A-Z', `a-z')')\n=>define(`arg1', `$1')\n=>define(`toalt', `changequote(`<<[', `]>>')')\n=>define(`fromalt', `changequote(<<[`]>>, <<[']>>)')\n=>define(`upcasealt', `translit(<<[$*]>>, <<[a-z]>>, <<[A-Z]>>)')\n=>define(`downcasealt', `translit(<<[$*]>>, <<[A-Z]>>, <<[a-z]>>)')\n=>define(`capitalizealt',\n=>  `regexp(<<[$1]>>, <<[^\\(\\w\\)\\(\\w*\\)]>>,\n=>    <<[upcasealt(<<[<<[\\1]>>]>>)downcasealt(<<[<<[\\2]>>]>>)]>>)')\n=>define(`capitalize',\n=>  `arg1(toalt()patsubst(<<[<<[$*]>>]>>, <<[\\w+]>>,\n=>    fromalt()`]>>$0alt(<<[\\&]>>)<<['toalt())fromalt())')\n=>divert`'dnl\n",
            "subsections": []
        },
        "File: m4.info,  Node: Improved fatalerror,  Prev: Improved capitalize,  Up: Answers": {
            "content": "",
            "subsections": [
                {
                    "name": "17.8 Solution for 'fatalerror'",
                    "content": "The 'fatalerror' macro (*note M4exit::) is not robust to versions of\nGNU M4 earlier than 1.4.8, where invoking 'file' (*note Location::)\ninside 'm4wrap' would result in an empty string, and 'line' resulted\nin '0' even though all files start at line 1.  Furthermore, versions\nearlier than 1.4.6 did not support the 'program' macro.  If you want\n'fatalerror' to work across the entire 1.4.x release series, a better\nimplementation would be:\n\ndefine(`fatalerror',\n`errprint(ifdef(`program', `program', ``m4'')'dnl\n`:ifelse(line, `0', `',\n`file:line:')` fatal error: $*\n')m4exit(`1')')\n=>\nm4wrap(`divnum(`demo of internal message')\nfatalerror(`inside wrapped text')')\n=>\n^D\nerror->m4:stdin:6: Warning: excess arguments to builtin `divnum' ignored\n=>0\nerror->m4:stdin:6: fatal error: inside wrapped text\n"
                }
            ]
        },
        "File: m4.info,  Node: Copying This Package,  Next: Copying This Manual,  Prev: Answers,  Up: Top": {
            "content": "",
            "subsections": []
        },
        "Appendix A How to make copies of the overall M4 package": {
            "content": "",
            "subsections": []
        },
        "This appendix covers the license for copying the source code of the": {
            "content": "overall M4 package.  This manual is under a different set of\nrestrictions, covered later (*note Copying This Manual::).\n\n* Menu:\n\n* GNU General Public License::  License for copying the M4 package\n",
            "subsections": []
        },
        "File: m4.info,  Node: GNU General Public License,  Up: Copying This Package": {
            "content": "",
            "subsections": [
                {
                    "name": "A.1 License for copying the M4 package",
                    "content": "Version 3, 29 June 2007\n\nCopyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>\n\nEveryone is permitted to copy and distribute verbatim copies of this\nlicense document, but changing it is not allowed.\n"
                },
                {
                    "name": "Preamble",
                    "content": ""
                }
            ]
        },
        "The GNU General Public License is a free, copyleft license for software": {
            "content": "and other kinds of works.\n\nThe licenses for most software and other practical works are designed\nto take away your freedom to share and change the works.  By contrast,\nthe GNU General Public License is intended to guarantee your freedom to\nshare and change all versions of a program--to make sure it remains free\nsoftware for all its users.  We, the Free Software Foundation, use the\nGNU General Public License for most of our software; it applies also to\nany other work released this way by its authors.  You can apply it to\nyour programs, too.\n\nWhen we speak of free software, we are referring to freedom, not\nprice.  Our General Public Licenses are designed to make sure that you\nhave the freedom to distribute copies of free software (and charge for\nthem if you wish), that you receive source code or can get it if you\nwant it, that you can change the software or use pieces of it in new\nfree programs, and that you know you can do these things.\n\nTo protect your rights, we need to prevent others from denying you\nthese rights or asking you to surrender the rights.  Therefore, you have\ncertain responsibilities if you distribute copies of the software, or if\nyou modify it: responsibilities to respect the freedom of others.\n\nFor example, if you distribute copies of such a program, whether\ngratis or for a fee, you must pass on to the recipients the same\nfreedoms that you received.  You must make sure that they, too, receive\nor can get the source code.  And you must show them these terms so they\nknow their rights.\n\nDevelopers that use the GNU GPL protect your rights with two steps:\n(1) assert copyright on the software, and (2) offer you this License\ngiving you legal permission to copy, distribute and/or modify it.\n\nFor the developers' and authors' protection, the GPL clearly explains\nthat there is no warranty for this free software.  For both users' and\nauthors' sake, the GPL requires that modified versions be marked as\nchanged, so that their problems will not be attributed erroneously to\nauthors of previous versions.\n\nSome devices are designed to deny users access to install or run\nmodified versions of the software inside them, although the manufacturer\ncan do so.  This is fundamentally incompatible with the aim of\nprotecting users' freedom to change the software.  The systematic\npattern of such abuse occurs in the area of products for individuals to\nuse, which is precisely where it is most unacceptable.  Therefore, we\nhave designed this version of the GPL to prohibit the practice for those\nproducts.  If such problems arise substantially in other domains, we\nstand ready to extend this provision to those domains in future versions\nof the GPL, as needed to protect the freedom of users.\n\nFinally, every program is threatened constantly by software patents.",
            "subsections": []
        },
        "States should not allow patents to restrict development and use of": {
            "content": "software on general-purpose computers, but in those that do, we wish to\navoid the special danger that patents applied to a free program could\nmake it effectively proprietary.  To prevent this, the GPL assures that\npatents cannot be used to render the program non-free.\n\nThe precise terms and conditions for copying, distribution and\nmodification follow.\n",
            "subsections": [
                {
                    "name": "TERMS AND CONDITIONS",
                    "content": "0. Definitions.\n\n\"This License\" refers to version 3 of the GNU General Public\nLicense.\n\n\"Copyright\" also means copyright-like laws that apply to other\nkinds of works, such as semiconductor masks.\n\n\"The Program\" refers to any copyrightable work licensed under this\nLicense.  Each licensee is addressed as \"you\".  \"Licensees\" and\n\"recipients\" may be individuals or organizations.\n\nTo \"modify\" a work means to copy from or adapt all or part of the\nwork in a fashion requiring copyright permission, other than the\nmaking of an exact copy.  The resulting work is called a \"modified\nversion\" of the earlier work or a work \"based on\" the earlier work.\n\nA \"covered work\" means either the unmodified Program or a work\nbased on the Program.\n\nTo \"propagate\" a work means to do anything with it that, without\npermission, would make you directly or secondarily liable for\ninfringement under applicable copyright law, except executing it on\na computer or modifying a private copy.  Propagation includes\ncopying, distribution (with or without modification), making\navailable to the public, and in some countries other activities as\nwell.\n\nTo \"convey\" a work means any kind of propagation that enables other\nparties to make or receive copies.  Mere interaction with a user\nthrough a computer network, with no transfer of a copy, is not\nconveying.\n\nAn interactive user interface displays \"Appropriate Legal Notices\"\nto the extent that it includes a convenient and prominently visible\nfeature that (1) displays an appropriate copyright notice, and (2)\ntells the user that there is no warranty for the work (except to\nthe extent that warranties are provided), that licensees may convey\nthe work under this License, and how to view a copy of this\nLicense.  If the interface presents a list of user commands or\noptions, such as a menu, a prominent item in the list meets this\ncriterion.\n\n1. Source Code.\n\nThe \"source code\" for a work means the preferred form of the work\nfor making modifications to it.  \"Object code\" means any non-source\nform of a work.\n\nA \"Standard Interface\" means an interface that either is an\nofficial standard defined by a recognized standards body, or, in\nthe case of interfaces specified for a particular programming\nlanguage, one that is widely used among developers working in that\nlanguage.\n\nThe \"System Libraries\" of an executable work include anything,\nother than the work as a whole, that (a) is included in the normal\nform of packaging a Major Component, but which is not part of that\nMajor Component, and (b) serves only to enable use of the work with\nthat Major Component, or to implement a Standard Interface for\nwhich an implementation is available to the public in source code\nform.  A \"Major Component\", in this context, means a major\nessential component (kernel, window system, and so on) of the\nspecific operating system (if any) on which the executable work\nruns, or a compiler used to produce the work, or an object code\ninterpreter used to run it.\n\nThe \"Corresponding Source\" for a work in object code form means all\nthe source code needed to generate, install, and (for an executable\nwork) run the object code and to modify the work, including scripts\nto control those activities.  However, it does not include the\nwork's System Libraries, or general-purpose tools or generally\navailable free programs which are used unmodified in performing\nthose activities but which are not part of the work.  For example,\nCorresponding Source includes interface definition files associated\nwith source files for the work, and the source code for shared\nlibraries and dynamically linked subprograms that the work is\nspecifically designed to require, such as by intimate data\ncommunication or control flow between those subprograms and other\nparts of the work.\n\nThe Corresponding Source need not include anything that users can\nregenerate automatically from other parts of the Corresponding\nSource.\n\nThe Corresponding Source for a work in source code form is that\nsame work.\n\n2. Basic Permissions.\n\nAll rights granted under this License are granted for the term of\ncopyright on the Program, and are irrevocable provided the stated\nconditions are met.  This License explicitly affirms your unlimited\npermission to run the unmodified Program.  The output from running\na covered work is covered by this License only if the output, given\nits content, constitutes a covered work.  This License acknowledges\nyour rights of fair use or other equivalent, as provided by\ncopyright law.\n\nYou may make, run and propagate covered works that you do not\nconvey, without conditions so long as your license otherwise\nremains in force.  You may convey covered works to others for the\nsole purpose of having them make modifications exclusively for you,\nor provide you with facilities for running those works, provided\nthat you comply with the terms of this License in conveying all\nmaterial for which you do not control copyright.  Those thus making\nor running the covered works for you must do so exclusively on your\nbehalf, under your direction and control, on terms that prohibit\nthem from making any copies of your copyrighted material outside\ntheir relationship with you.\n\nConveying under any other circumstances is permitted solely under\nthe conditions stated below.  Sublicensing is not allowed; section\n10 makes it unnecessary.\n\n3. Protecting Users' Legal Rights From Anti-Circumvention Law.\n\nNo covered work shall be deemed part of an effective technological\nmeasure under any applicable law fulfilling obligations under\narticle 11 of the WIPO copyright treaty adopted on 20 December\n1996, or similar laws prohibiting or restricting circumvention of\nsuch measures.\n\nWhen you convey a covered work, you waive any legal power to forbid\ncircumvention of technological measures to the extent such\ncircumvention is effected by exercising rights under this License\nwith respect to the covered work, and you disclaim any intention to\nlimit operation or modification of the work as a means of\nenforcing, against the work's users, your or third parties' legal\nrights to forbid circumvention of technological measures.\n\n4. Conveying Verbatim Copies.\n\nYou may convey verbatim copies of the Program's source code as you\nreceive it, in any medium, provided that you conspicuously and\nappropriately publish on each copy an appropriate copyright notice;\nkeep intact all notices stating that this License and any\nnon-permissive terms added in accord with section 7 apply to the\ncode; keep intact all notices of the absence of any warranty; and\ngive all recipients a copy of this License along with the Program.\n\nYou may charge any price or no price for each copy that you convey,\nand you may offer support or warranty protection for a fee.\n\n5. Conveying Modified Source Versions.\n\nYou may convey a work based on the Program, or the modifications to\nproduce it from the Program, in the form of source code under the\nterms of section 4, provided that you also meet all of these\nconditions:\n\na. The work must carry prominent notices stating that you\nmodified it, and giving a relevant date.\n\nb. The work must carry prominent notices stating that it is\nreleased under this License and any conditions added under\nsection 7.  This requirement modifies the requirement in\nsection 4 to \"keep intact all notices\".\n\nc. You must license the entire work, as a whole, under this\nLicense to anyone who comes into possession of a copy.  This\nLicense will therefore apply, along with any applicable\nsection 7 additional terms, to the whole of the work, and all\nits parts, regardless of how they are packaged.  This License\ngives no permission to license the work in any other way, but\nit does not invalidate such permission if you have separately\nreceived it.\n\nd. If the work has interactive user interfaces, each must display\nAppropriate Legal Notices; however, if the Program has\ninteractive interfaces that do not display Appropriate Legal\nNotices, your work need not make them do so.\n\nA compilation of a covered work with other separate and independent\nworks, which are not by their nature extensions of the covered\nwork, and which are not combined with it such as to form a larger\nprogram, in or on a volume of a storage or distribution medium, is\ncalled an \"aggregate\" if the compilation and its resulting\ncopyright are not used to limit the access or legal rights of the\ncompilation's users beyond what the individual works permit.\nInclusion of a covered work in an aggregate does not cause this\nLicense to apply to the other parts of the aggregate.\n\n6. Conveying Non-Source Forms.\n\nYou may convey a covered work in object code form under the terms\nof sections 4 and 5, provided that you also convey the\nmachine-readable Corresponding Source under the terms of this\nLicense, in one of these ways:\n\na. Convey the object code in, or embodied in, a physical product\n(including a physical distribution medium), accompanied by the\nCorresponding Source fixed on a durable physical medium\ncustomarily used for software interchange.\n\nb. Convey the object code in, or embodied in, a physical product\n(including a physical distribution medium), accompanied by a\nwritten offer, valid for at least three years and valid for as\nlong as you offer spare parts or customer support for that\nproduct model, to give anyone who possesses the object code\neither (1) a copy of the Corresponding Source for all the\nsoftware in the product that is covered by this License, on a\ndurable physical medium customarily used for software\ninterchange, for a price no more than your reasonable cost of\nphysically performing this conveying of source, or (2) access\nto copy the Corresponding Source from a network server at no\ncharge.\n\nc. Convey individual copies of the object code with a copy of the\nwritten offer to provide the Corresponding Source.  This\nalternative is allowed only occasionally and noncommercially,\nand only if you received the object code with such an offer,\nin accord with subsection 6b.\n\nd. Convey the object code by offering access from a designated\nplace (gratis or for a charge), and offer equivalent access to\nthe Corresponding Source in the same way through the same\nplace at no further charge.  You need not require recipients\nto copy the Corresponding Source along with the object code.\nIf the place to copy the object code is a network server, the\nCorresponding Source may be on a different server (operated by\nyou or a third party) that supports equivalent copying\nfacilities, provided you maintain clear directions next to the\nobject code saying where to find the Corresponding Source.\nRegardless of what server hosts the Corresponding Source, you\nremain obligated to ensure that it is available for as long as\nneeded to satisfy these requirements.\n\ne. Convey the object code using peer-to-peer transmission,\nprovided you inform other peers where the object code and\nCorresponding Source of the work are being offered to the\ngeneral public at no charge under subsection 6d.\n\nA separable portion of the object code, whose source code is\nexcluded from the Corresponding Source as a System Library, need\nnot be included in conveying the object code work.\n\nA \"User Product\" is either (1) a \"consumer product\", which means\nany tangible personal property which is normally used for personal,\nfamily, or household purposes, or (2) anything designed or sold for\nincorporation into a dwelling.  In determining whether a product is\na consumer product, doubtful cases shall be resolved in favor of\ncoverage.  For a particular product received by a particular user,\n\"normally used\" refers to a typical or common use of that class of\nproduct, regardless of the status of the particular user or of the\nway in which the particular user actually uses, or expects or is\nexpected to use, the product.  A product is a consumer product\nregardless of whether the product has substantial commercial,\nindustrial or non-consumer uses, unless such uses represent the\nonly significant mode of use of the product.\n\n\"Installation Information\" for a User Product means any methods,\nprocedures, authorization keys, or other information required to\ninstall and execute modified versions of a covered work in that\nUser Product from a modified version of its Corresponding Source.\nThe information must suffice to ensure that the continued\nfunctioning of the modified object code is in no case prevented or\ninterfered with solely because modification has been made.\n\nIf you convey an object code work under this section in, or with,\nor specifically for use in, a User Product, and the conveying\noccurs as part of a transaction in which the right of possession\nand use of the User Product is transferred to the recipient in\nperpetuity or for a fixed term (regardless of how the transaction\nis characterized), the Corresponding Source conveyed under this\nsection must be accompanied by the Installation Information.  But\nthis requirement does not apply if neither you nor any third party\nretains the ability to install modified object code on the User\nProduct (for example, the work has been installed in ROM).\n\nThe requirement to provide Installation Information does not\ninclude a requirement to continue to provide support service,\nwarranty, or updates for a work that has been modified or installed\nby the recipient, or for the User Product in which it has been\nmodified or installed.  Access to a network may be denied when the\nmodification itself materially and adversely affects the operation\nof the network or violates the rules and protocols for\ncommunication across the network.\n\nCorresponding Source conveyed, and Installation Information\nprovided, in accord with this section must be in a format that is\npublicly documented (and with an implementation available to the\npublic in source code form), and must require no special password\nor key for unpacking, reading or copying.\n\n7. Additional Terms.\n\n\"Additional permissions\" are terms that supplement the terms of\nthis License by making exceptions from one or more of its\nconditions.  Additional permissions that are applicable to the\nentire Program shall be treated as though they were included in\nthis License, to the extent that they are valid under applicable\nlaw.  If additional permissions apply only to part of the Program,\nthat part may be used separately under those permissions, but the\nentire Program remains governed by this License without regard to\nthe additional permissions.\n\nWhen you convey a copy of a covered work, you may at your option\nremove any additional permissions from that copy, or from any part\nof it.  (Additional permissions may be written to require their own\nremoval in certain cases when you modify the work.)  You may place\nadditional permissions on material, added by you to a covered work,\nfor which you have or can give appropriate copyright permission.\n\nNotwithstanding any other provision of this License, for material\nyou add to a covered work, you may (if authorized by the copyright\nholders of that material) supplement the terms of this License with\nterms:\n\na. Disclaiming warranty or limiting liability differently from\nthe terms of sections 15 and 16 of this License; or\n\nb. Requiring preservation of specified reasonable legal notices\nor author attributions in that material or in the Appropriate\nLegal Notices displayed by works containing it; or\n\nc. Prohibiting misrepresentation of the origin of that material,\nor requiring that modified versions of such material be marked\nin reasonable ways as different from the original version; or\n\nd. Limiting the use for publicity purposes of names of licensors\nor authors of the material; or\n\ne. Declining to grant rights under trademark law for use of some\ntrade names, trademarks, or service marks; or\n\nf. Requiring indemnification of licensors and authors of that\nmaterial by anyone who conveys the material (or modified\nversions of it) with contractual assumptions of liability to\nthe recipient, for any liability that these contractual\nassumptions directly impose on those licensors and authors.\n\nAll other non-permissive additional terms are considered \"further\nrestrictions\" within the meaning of section 10.  If the Program as\nyou received it, or any part of it, contains a notice stating that\nit is governed by this License along with a term that is a further\nrestriction, you may remove that term.  If a license document\ncontains a further restriction but permits relicensing or conveying\nunder this License, you may add to a covered work material governed\nby the terms of that license document, provided that the further\nrestriction does not survive such relicensing or conveying.\n\nIf you add terms to a covered work in accord with this section, you\nmust place, in the relevant source files, a statement of the\nadditional terms that apply to those files, or a notice indicating\nwhere to find the applicable terms.\n\nAdditional terms, permissive or non-permissive, may be stated in\nthe form of a separately written license, or stated as exceptions;\nthe above requirements apply either way.\n\n8. Termination.\n\nYou may not propagate or modify a covered work except as expressly\nprovided under this License.  Any attempt otherwise to propagate or\nmodify it is void, and will automatically terminate your rights\nunder this License (including any patent licenses granted under the\nthird paragraph of section 11).\n\nHowever, if you cease all violation of this License, then your\nlicense from a particular copyright holder is reinstated (a)\nprovisionally, unless and until the copyright holder explicitly and\nfinally terminates your license, and (b) permanently, if the\ncopyright holder fails to notify you of the violation by some\nreasonable means prior to 60 days after the cessation.\n\nMoreover, your license from a particular copyright holder is\nreinstated permanently if the copyright holder notifies you of the\nviolation by some reasonable means, this is the first time you have\nreceived notice of violation of this License (for any work) from\nthat copyright holder, and you cure the violation prior to 30 days\nafter your receipt of the notice.\n\nTermination of your rights under this section does not terminate\nthe licenses of parties who have received copies or rights from you\nunder this License.  If your rights have been terminated and not\npermanently reinstated, you do not qualify to receive new licenses\nfor the same material under section 10.\n\n9. Acceptance Not Required for Having Copies.\n\nYou are not required to accept this License in order to receive or\nrun a copy of the Program.  Ancillary propagation of a covered work\noccurring solely as a consequence of using peer-to-peer\ntransmission to receive a copy likewise does not require\nacceptance.  However, nothing other than this License grants you\npermission to propagate or modify any covered work.  These actions\ninfringe copyright if you do not accept this License.  Therefore,\nby modifying or propagating a covered work, you indicate your\nacceptance of this License to do so.\n\n10. Automatic Licensing of Downstream Recipients.\n\nEach time you convey a covered work, the recipient automatically\nreceives a license from the original licensors, to run, modify and\npropagate that work, subject to this License.  You are not\nresponsible for enforcing compliance by third parties with this\nLicense.\n\nAn \"entity transaction\" is a transaction transferring control of an\norganization, or substantially all assets of one, or subdividing an\norganization, or merging organizations.  If propagation of a\ncovered work results from an entity transaction, each party to that\ntransaction who receives a copy of the work also receives whatever\nlicenses to the work the party's predecessor in interest had or\ncould give under the previous paragraph, plus a right to possession\nof the Corresponding Source of the work from the predecessor in\ninterest, if the predecessor has it or can get it with reasonable\nefforts.\n\nYou may not impose any further restrictions on the exercise of the\nrights granted or affirmed under this License.  For example, you\nmay not impose a license fee, royalty, or other charge for exercise\nof rights granted under this License, and you may not initiate\nlitigation (including a cross-claim or counterclaim in a lawsuit)\nalleging that any patent claim is infringed by making, using,\nselling, offering for sale, or importing the Program or any portion\nof it.\n\n11. Patents.\n\nA \"contributor\" is a copyright holder who authorizes use under this\nLicense of the Program or a work on which the Program is based.\nThe work thus licensed is called the contributor's \"contributor\nversion\".\n\nA contributor's \"essential patent claims\" are all patent claims\nowned or controlled by the contributor, whether already acquired or\nhereafter acquired, that would be infringed by some manner,\npermitted by this License, of making, using, or selling its\ncontributor version, but do not include claims that would be\ninfringed only as a consequence of further modification of the\ncontributor version.  For purposes of this definition, \"control\"\nincludes the right to grant patent sublicenses in a manner\nconsistent with the requirements of this License.\n\nEach contributor grants you a non-exclusive, worldwide,\nroyalty-free patent license under the contributor's essential\npatent claims, to make, use, sell, offer for sale, import and\notherwise run, modify and propagate the contents of its contributor\nversion.\n\nIn the following three paragraphs, a \"patent license\" is any\nexpress agreement or commitment, however denominated, not to\nenforce a patent (such as an express permission to practice a\npatent or covenant not to sue for patent infringement).  To \"grant\"\nsuch a patent license to a party means to make such an agreement or\ncommitment not to enforce a patent against the party.\n\nIf you convey a covered work, knowingly relying on a patent\nlicense, and the Corresponding Source of the work is not available\nfor anyone to copy, free of charge and under the terms of this\nLicense, through a publicly available network server or other\nreadily accessible means, then you must either (1) cause the\nCorresponding Source to be so available, or (2) arrange to deprive\nyourself of the benefit of the patent license for this particular\nwork, or (3) arrange, in a manner consistent with the requirements\nof this License, to extend the patent license to downstream\nrecipients.  \"Knowingly relying\" means you have actual knowledge\nthat, but for the patent license, your conveying the covered work\nin a country, or your recipient's use of the covered work in a\ncountry, would infringe one or more identifiable patents in that\ncountry that you have reason to believe are valid.\n\nIf, pursuant to or in connection with a single transaction or\narrangement, you convey, or propagate by procuring conveyance of, a\ncovered work, and grant a patent license to some of the parties\nreceiving the covered work authorizing them to use, propagate,\nmodify or convey a specific copy of the covered work, then the\npatent license you grant is automatically extended to all\nrecipients of the covered work and works based on it.\n\nA patent license is \"discriminatory\" if it does not include within\nthe scope of its coverage, prohibits the exercise of, or is\nconditioned on the non-exercise of one or more of the rights that\nare specifically granted under this License.  You may not convey a\ncovered work if you are a party to an arrangement with a third\nparty that is in the business of distributing software, under which\nyou make payment to the third party based on the extent of your\nactivity of conveying the work, and under which the third party\ngrants, to any of the parties who would receive the covered work\nfrom you, a discriminatory patent license (a) in connection with\ncopies of the covered work conveyed by you (or copies made from\nthose copies), or (b) primarily for and in connection with specific\nproducts or compilations that contain the covered work, unless you\nentered into that arrangement, or that patent license was granted,\nprior to 28 March 2007.\n\nNothing in this License shall be construed as excluding or limiting\nany implied license or other defenses to infringement that may\notherwise be available to you under applicable patent law.\n\n12. No Surrender of Others' Freedom.\n\nIf conditions are imposed on you (whether by court order, agreement\nor otherwise) that contradict the conditions of this License, they\ndo not excuse you from the conditions of this License.  If you\ncannot convey a covered work so as to satisfy simultaneously your\nobligations under this License and any other pertinent obligations,\nthen as a consequence you may not convey it at all.  For example,\nif you agree to terms that obligate you to collect a royalty for\nfurther conveying from those to whom you convey the Program, the\nonly way you could satisfy both those terms and this License would\nbe to refrain entirely from conveying the Program.\n\n13. Use with the GNU Affero General Public License.\n\nNotwithstanding any other provision of this License, you have\npermission to link or combine any covered work with a work licensed\nunder version 3 of the GNU Affero General Public License into a\nsingle combined work, and to convey the resulting work.  The terms\nof this License will continue to apply to the part which is the\ncovered work, but the special requirements of the GNU Affero\nGeneral Public License, section 13, concerning interaction through\na network will apply to the combination as such.\n\n14. Revised Versions of this License.\n\nThe Free Software Foundation may publish revised and/or new\nversions of the GNU General Public License from time to time.  Such\nnew versions will be similar in spirit to the present version, but\nmay differ in detail to address new problems or concerns.\n\nEach version is given a distinguishing version number.  If the\nProgram specifies that a certain numbered version of the GNU\nGeneral Public License \"or any later version\" applies to it, you\nhave the option of following the terms and conditions either of\nthat numbered version or of any later version published by the Free\nSoftware Foundation.  If the Program does not specify a version\nnumber of the GNU General Public License, you may choose any\nversion ever published by the Free Software Foundation.\n\nIf the Program specifies that a proxy can decide which future\nversions of the GNU General Public License can be used, that\nproxy's public statement of acceptance of a version permanently\nauthorizes you to choose that version for the Program.\n\nLater license versions may give you additional or different\npermissions.  However, no additional obligations are imposed on any\nauthor or copyright holder as a result of your choosing to follow a\nlater version.\n\n15. Disclaimer of Warranty.\n\nTHERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY\nAPPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE\nCOPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM \"AS IS\"\nWITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,\nINCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\nMERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE\nRISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.\nSHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL\nNECESSARY SERVICING, REPAIR OR CORRECTION.\n\n16. Limitation of Liability.\n\nIN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN\nWRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES\nAND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR\nDAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR\nCONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE\nTHE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA\nBEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD\nPARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER\nPROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF\nTHE POSSIBILITY OF SUCH DAMAGES.\n\n17. Interpretation of Sections 15 and 16.\n\nIf the disclaimer of warranty and limitation of liability provided\nabove cannot be given local legal effect according to their terms,\nreviewing courts shall apply local law that most closely\napproximates an absolute waiver of all civil liability in\nconnection with the Program, unless a warranty or assumption of\nliability accompanies a copy of the Program in return for a fee.\n"
                },
                {
                    "name": "END OF TERMS AND CONDITIONS",
                    "content": ""
                },
                {
                    "name": "How to Apply These Terms to Your New Programs",
                    "content": ""
                }
            ]
        },
        "If you develop a new program, and you want it to be of the greatest": {
            "content": "possible use to the public, the best way to achieve this is to make it\nfree software which everyone can redistribute and change under these\nterms.\n\nTo do so, attach the following notices to the program.  It is safest\nto attach them to the start of each source file to most effectively\nstate the exclusion of warranty; and each file should have at least the\n\"copyright\" line and a pointer to where the full notice is found.\n\nONE LINE TO GIVE THE PROGRAM'S NAME AND A BRIEF IDEA OF WHAT IT DOES.\nCopyright (C) YEAR NAME OF AUTHOR\n\nThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or (at\nyour option) any later version.\n\nThis program is distributed in the hope that it will be useful, but\nWITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\nGeneral Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program.  If not, see <https://www.gnu.org/licenses/>.\n\nAlso add information on how to contact you by electronic and paper\nmail.\n\nIf the program does terminal interaction, make it output a short\nnotice like this when it starts in an interactive mode:\n\nPROGRAM Copyright (C) YEAR NAME OF AUTHOR\nThis program comes with ABSOLUTELY NO WARRANTY; for details type 'show w'.\nThis is free software, and you are welcome to redistribute it\nunder certain conditions; type 'show c' for details.\n\nThe hypothetical commands 'show w' and 'show c' should show the\nappropriate parts of the General Public License.  Of course, your\nprogram's commands might be different; for a GUI interface, you would\nuse an \"about box\".\n\nYou should also get your employer (if you work as a programmer) or\nschool, if any, to sign a \"copyright disclaimer\" for the program, if\nnecessary.  For more information on this, and how to apply and follow\nthe GNU GPL, see <https://www.gnu.org/licenses/>.\n\nThe GNU General Public License does not permit incorporating your\nprogram into proprietary programs.  If your program is a subroutine\nlibrary, you may consider it more useful to permit linking proprietary\napplications with the library.  If this is what you want to do, use the\nGNU Lesser General Public License instead of this License.  But first,\nplease read <https://www.gnu.org/licenses/why-not-lgpl.html>.\n",
            "subsections": []
        },
        "File: m4.info,  Node: Copying This Manual,  Next: Indices,  Prev: Copying This Package,  Up: Top": {
            "content": "",
            "subsections": []
        },
        "Appendix B How to make copies of this manual": {
            "content": "",
            "subsections": []
        },
        "This appendix covers the license for copying this manual.  Note that": {
            "content": "some of the longer examples in this manual are also distributed in the\ndirectory 'm4-1.4.19/examples/', where a more permissive license is in\neffect when copying just the examples.\n\n* Menu:\n\n* GNU Free Documentation License::  License for copying this manual\n",
            "subsections": []
        },
        "File: m4.info,  Node: GNU Free Documentation License,  Up: Copying This Manual": {
            "content": "",
            "subsections": [
                {
                    "name": "B.1 License for copying this manual",
                    "content": "Version 1.3, 3 November 2008\n\nCopyright (C) 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.\n<https://fsf.org/>\n\nEveryone is permitted to copy and distribute verbatim copies\nof this license document, but changing it is not allowed.\n\n0. PREAMBLE\n\nThe purpose of this License is to make a manual, textbook, or other\nfunctional and useful document \"free\" in the sense of freedom: to\nassure everyone the effective freedom to copy and redistribute it,\nwith or without modifying it, either commercially or\nnoncommercially.  Secondarily, this License preserves for the\nauthor and publisher a way to get credit for their work, while not\nbeing considered responsible for modifications made by others.\n\nThis License is a kind of \"copyleft\", which means that derivative\nworks of the document must themselves be free in the same sense.\nIt complements the GNU General Public License, which is a copyleft\nlicense designed for free software.\n\nWe have designed this License in order to use it for manuals for\nfree software, because free software needs free documentation: a\nfree program should come with manuals providing the same freedoms\nthat the software does.  But this License is not limited to\nsoftware manuals; it can be used for any textual work, regardless\nof subject matter or whether it is published as a printed book.  We\nrecommend this License principally for works whose purpose is\ninstruction or reference.\n\n1. APPLICABILITY AND DEFINITIONS\n\nThis License applies to any manual or other work, in any medium,\nthat contains a notice placed by the copyright holder saying it can\nbe distributed under the terms of this License.  Such a notice\ngrants a world-wide, royalty-free license, unlimited in duration,\nto use that work under the conditions stated herein.  The\n\"Document\", below, refers to any such manual or work.  Any member\nof the public is a licensee, and is addressed as \"you\".  You accept\nthe license if you copy, modify or distribute the work in a way\nrequiring permission under copyright law.\n\nA \"Modified Version\" of the Document means any work containing the\nDocument or a portion of it, either copied verbatim, or with\nmodifications and/or translated into another language.\n\nA \"Secondary Section\" is a named appendix or a front-matter section\nof the Document that deals exclusively with the relationship of the\npublishers or authors of the Document to the Document's overall\nsubject (or to related matters) and contains nothing that could\nfall directly within that overall subject.  (Thus, if the Document\nis in part a textbook of mathematics, a Secondary Section may not\nexplain any mathematics.)  The relationship could be a matter of\nhistorical connection with the subject or with related matters, or\nof legal, commercial, philosophical, ethical or political position\nregarding them.\n\nThe \"Invariant Sections\" are certain Secondary Sections whose\ntitles are designated, as being those of Invariant Sections, in the\nnotice that says that the Document is released under this License.\nIf a section does not fit the above definition of Secondary then it\nis not allowed to be designated as Invariant.  The Document may\ncontain zero Invariant Sections.  If the Document does not identify\nany Invariant Sections then there are none.\n\nThe \"Cover Texts\" are certain short passages of text that are\nlisted, as Front-Cover Texts or Back-Cover Texts, in the notice\nthat says that the Document is released under this License.  A\nFront-Cover Text may be at most 5 words, and a Back-Cover Text may\nbe at most 25 words.\n\nA \"Transparent\" copy of the Document means a machine-readable copy,\nrepresented in a format whose specification is available to the\ngeneral public, that is suitable for revising the document\nstraightforwardly with generic text editors or (for images composed\nof pixels) generic paint programs or (for drawings) some widely\navailable drawing editor, and that is suitable for input to text\nformatters or for automatic translation to a variety of formats\nsuitable for input to text formatters.  A copy made in an otherwise\nTransparent file format whose markup, or absence of markup, has\nbeen arranged to thwart or discourage subsequent modification by\nreaders is not Transparent.  An image format is not Transparent if\nused for any substantial amount of text.  A copy that is not\n\"Transparent\" is called \"Opaque\".\n\nExamples of suitable formats for Transparent copies include plain\nASCII without markup, Texinfo input format, LaTeX input format,\nSGML or XML using a publicly available DTD, and standard-conforming\nsimple HTML, PostScript or PDF designed for human modification.\nExamples of transparent image formats include PNG, XCF and JPG.\nOpaque formats include proprietary formats that can be read and\nedited only by proprietary word processors, SGML or XML for which\nthe DTD and/or processing tools are not generally available, and\nthe machine-generated HTML, PostScript or PDF produced by some word\nprocessors for output purposes only.\n\nThe \"Title Page\" means, for a printed book, the title page itself,\nplus such following pages as are needed to hold, legibly, the\nmaterial this License requires to appear in the title page.  For\nworks in formats which do not have any title page as such, \"Title\nPage\" means the text near the most prominent appearance of the\nwork's title, preceding the beginning of the body of the text.\n\nThe \"publisher\" means any person or entity that distributes copies\nof the Document to the public.\n\nA section \"Entitled XYZ\" means a named subunit of the Document\nwhose title either is precisely XYZ or contains XYZ in parentheses\nfollowing text that translates XYZ in another language.  (Here XYZ\nstands for a specific section name mentioned below, such as\n\"Acknowledgements\", \"Dedications\", \"Endorsements\", or \"History\".)\nTo \"Preserve the Title\" of such a section when you modify the\nDocument means that it remains a section \"Entitled XYZ\" according\nto this definition.\n\nThe Document may include Warranty Disclaimers next to the notice\nwhich states that this License applies to the Document.  These\nWarranty Disclaimers are considered to be included by reference in\nthis License, but only as regards disclaiming warranties: any other\nimplication that these Warranty Disclaimers may have is void and\nhas no effect on the meaning of this License.\n\n2. VERBATIM COPYING\n\nYou may copy and distribute the Document in any medium, either\ncommercially or noncommercially, provided that this License, the\ncopyright notices, and the license notice saying this License\napplies to the Document are reproduced in all copies, and that you\nadd no other conditions whatsoever to those of this License.  You\nmay not use technical measures to obstruct or control the reading\nor further copying of the copies you make or distribute.  However,\nyou may accept compensation in exchange for copies.  If you\ndistribute a large enough number of copies you must also follow the\nconditions in section 3.\n\nYou may also lend copies, under the same conditions stated above,\nand you may publicly display copies.\n\n3. COPYING IN QUANTITY\n\nIf you publish printed copies (or copies in media that commonly\nhave printed covers) of the Document, numbering more than 100, and\nthe Document's license notice requires Cover Texts, you must\nenclose the copies in covers that carry, clearly and legibly, all\nthese Cover Texts: Front-Cover Texts on the front cover, and\nBack-Cover Texts on the back cover.  Both covers must also clearly\nand legibly identify you as the publisher of these copies.  The\nfront cover must present the full title with all words of the title\nequally prominent and visible.  You may add other material on the\ncovers in addition.  Copying with changes limited to the covers, as\nlong as they preserve the title of the Document and satisfy these\nconditions, can be treated as verbatim copying in other respects.\n\nIf the required texts for either cover are too voluminous to fit\nlegibly, you should put the first ones listed (as many as fit\nreasonably) on the actual cover, and continue the rest onto\nadjacent pages.\n\nIf you publish or distribute Opaque copies of the Document\nnumbering more than 100, you must either include a machine-readable\nTransparent copy along with each Opaque copy, or state in or with\neach Opaque copy a computer-network location from which the general\nnetwork-using public has access to download using public-standard\nnetwork protocols a complete Transparent copy of the Document, free\nof added material.  If you use the latter option, you must take\nreasonably prudent steps, when you begin distribution of Opaque\ncopies in quantity, to ensure that this Transparent copy will\nremain thus accessible at the stated location until at least one\nyear after the last time you distribute an Opaque copy (directly or\nthrough your agents or retailers) of that edition to the public.\n\nIt is requested, but not required, that you contact the authors of\nthe Document well before redistributing any large number of copies,\nto give them a chance to provide you with an updated version of the\nDocument.\n\n4. MODIFICATIONS\n\nYou may copy and distribute a Modified Version of the Document\nunder the conditions of sections 2 and 3 above, provided that you\nrelease the Modified Version under precisely this License, with the\nModified Version filling the role of the Document, thus licensing\ndistribution and modification of the Modified Version to whoever\npossesses a copy of it.  In addition, you must do these things in\nthe Modified Version:\n\nA. Use in the Title Page (and on the covers, if any) a title\ndistinct from that of the Document, and from those of previous\nversions (which should, if there were any, be listed in the\nHistory section of the Document).  You may use the same title\nas a previous version if the original publisher of that\nversion gives permission.\n\nB. List on the Title Page, as authors, one or more persons or\nentities responsible for authorship of the modifications in\nthe Modified Version, together with at least five of the\nprincipal authors of the Document (all of its principal\nauthors, if it has fewer than five), unless they release you\nfrom this requirement.\n\nC. State on the Title page the name of the publisher of the\nModified Version, as the publisher.\n\nD. Preserve all the copyright notices of the Document.\n\nE. Add an appropriate copyright notice for your modifications\nadjacent to the other copyright notices.\n\nF. Include, immediately after the copyright notices, a license\nnotice giving the public permission to use the Modified\nVersion under the terms of this License, in the form shown in\nthe Addendum below.\n\nG. Preserve in that license notice the full lists of Invariant\nSections and required Cover Texts given in the Document's\nlicense notice.\n\nH. Include an unaltered copy of this License.\n\nI. Preserve the section Entitled \"History\", Preserve its Title,\nand add to it an item stating at least the title, year, new\nauthors, and publisher of the Modified Version as given on the\nTitle Page.  If there is no section Entitled \"History\" in the\nDocument, create one stating the title, year, authors, and\npublisher of the Document as given on its Title Page, then add\nan item describing the Modified Version as stated in the\nprevious sentence.\n\nJ. Preserve the network location, if any, given in the Document\nfor public access to a Transparent copy of the Document, and\nlikewise the network locations given in the Document for\nprevious versions it was based on.  These may be placed in the\n\"History\" section.  You may omit a network location for a work\nthat was published at least four years before the Document\nitself, or if the original publisher of the version it refers\nto gives permission.\n\nK. For any section Entitled \"Acknowledgements\" or \"Dedications\",\nPreserve the Title of the section, and preserve in the section\nall the substance and tone of each of the contributor\nacknowledgements and/or dedications given therein.\n\nL. Preserve all the Invariant Sections of the Document, unaltered\nin their text and in their titles.  Section numbers or the\nequivalent are not considered part of the section titles.\n\nM. Delete any section Entitled \"Endorsements\".  Such a section\nmay not be included in the Modified Version.\n\nN. Do not retitle any existing section to be Entitled\n\"Endorsements\" or to conflict in title with any Invariant\nSection.\n\nO. Preserve any Warranty Disclaimers.\n\nIf the Modified Version includes new front-matter sections or\nappendices that qualify as Secondary Sections and contain no\nmaterial copied from the Document, you may at your option designate\nsome or all of these sections as invariant.  To do this, add their\ntitles to the list of Invariant Sections in the Modified Version's\nlicense notice.  These titles must be distinct from any other\nsection titles.\n\nYou may add a section Entitled \"Endorsements\", provided it contains\nnothing but endorsements of your Modified Version by various\nparties--for example, statements of peer review or that the text\nhas been approved by an organization as the authoritative\ndefinition of a standard.\n\nYou may add a passage of up to five words as a Front-Cover Text,\nand a passage of up to 25 words as a Back-Cover Text, to the end of\nthe list of Cover Texts in the Modified Version.  Only one passage\nof Front-Cover Text and one of Back-Cover Text may be added by (or\nthrough arrangements made by) any one entity.  If the Document\nalready includes a cover text for the same cover, previously added\nby you or by arrangement made by the same entity you are acting on\nbehalf of, you may not add another; but you may replace the old\none, on explicit permission from the previous publisher that added\nthe old one.\n\nThe author(s) and publisher(s) of the Document do not by this\nLicense give permission to use their names for publicity for or to\nassert or imply endorsement of any Modified Version.\n\n5. COMBINING DOCUMENTS\n\nYou may combine the Document with other documents released under\nthis License, under the terms defined in section 4 above for\nmodified versions, provided that you include in the combination all\nof the Invariant Sections of all of the original documents,\nunmodified, and list them all as Invariant Sections of your\ncombined work in its license notice, and that you preserve all\ntheir Warranty Disclaimers.\n\nThe combined work need only contain one copy of this License, and\nmultiple identical Invariant Sections may be replaced with a single\ncopy.  If there are multiple Invariant Sections with the same name\nbut different contents, make the title of each such section unique\nby adding at the end of it, in parentheses, the name of the\noriginal author or publisher of that section if known, or else a\nunique number.  Make the same adjustment to the section titles in\nthe list of Invariant Sections in the license notice of the\ncombined work.\n\nIn the combination, you must combine any sections Entitled\n\"History\" in the various original documents, forming one section\nEntitled \"History\"; likewise combine any sections Entitled\n\"Acknowledgements\", and any sections Entitled \"Dedications\".  You\nmust delete all sections Entitled \"Endorsements.\"\n\n6. COLLECTIONS OF DOCUMENTS\n\nYou may make a collection consisting of the Document and other\ndocuments released under this License, and replace the individual\ncopies of this License in the various documents with a single copy\nthat is included in the collection, provided that you follow the\nrules of this License for verbatim copying of each of the documents\nin all other respects.\n\nYou may extract a single document from such a collection, and\ndistribute it individually under this License, provided you insert\na copy of this License into the extracted document, and follow this\nLicense in all other respects regarding verbatim copying of that\ndocument.\n\n7. AGGREGATION WITH INDEPENDENT WORKS\n\nA compilation of the Document or its derivatives with other\nseparate and independent documents or works, in or on a volume of a\nstorage or distribution medium, is called an \"aggregate\" if the\ncopyright resulting from the compilation is not used to limit the\nlegal rights of the compilation's users beyond what the individual\nworks permit.  When the Document is included in an aggregate, this\nLicense does not apply to the other works in the aggregate which\nare not themselves derivative works of the Document.\n\nIf the Cover Text requirement of section 3 is applicable to these\ncopies of the Document, then if the Document is less than one half\nof the entire aggregate, the Document's Cover Texts may be placed\non covers that bracket the Document within the aggregate, or the\nelectronic equivalent of covers if the Document is in electronic\nform.  Otherwise they must appear on printed covers that bracket\nthe whole aggregate.\n\n8. TRANSLATION\n\nTranslation is considered a kind of modification, so you may\ndistribute translations of the Document under the terms of section\n4.  Replacing Invariant Sections with translations requires special\npermission from their copyright holders, but you may include\ntranslations of some or all Invariant Sections in addition to the\noriginal versions of these Invariant Sections.  You may include a\ntranslation of this License, and all the license notices in the\nDocument, and any Warranty Disclaimers, provided that you also\ninclude the original English version of this License and the\noriginal versions of those notices and disclaimers.  In case of a\ndisagreement between the translation and the original version of\nthis License or a notice or disclaimer, the original version will\nprevail.\n\nIf a section in the Document is Entitled \"Acknowledgements\",\n\"Dedications\", or \"History\", the requirement (section 4) to\nPreserve its Title (section 1) will typically require changing the\nactual title.\n\n9. TERMINATION\n\nYou may not copy, modify, sublicense, or distribute the Document\nexcept as expressly provided under this License.  Any attempt\notherwise to copy, modify, sublicense, or distribute it is void,\nand will automatically terminate your rights under this License.\n\nHowever, if you cease all violation of this License, then your\nlicense from a particular copyright holder is reinstated (a)\nprovisionally, unless and until the copyright holder explicitly and\nfinally terminates your license, and (b) permanently, if the\ncopyright holder fails to notify you of the violation by some\nreasonable means prior to 60 days after the cessation.\n\nMoreover, your license from a particular copyright holder is\nreinstated permanently if the copyright holder notifies you of the\nviolation by some reasonable means, this is the first time you have\nreceived notice of violation of this License (for any work) from\nthat copyright holder, and you cure the violation prior to 30 days\nafter your receipt of the notice.\n\nTermination of your rights under this section does not terminate\nthe licenses of parties who have received copies or rights from you\nunder this License.  If your rights have been terminated and not\npermanently reinstated, receipt of a copy of some or all of the\nsame material does not give you any rights to use it.\n\n10. FUTURE REVISIONS OF THIS LICENSE\n\nThe Free Software Foundation may publish new, revised versions of\nthe GNU Free Documentation License from time to time.  Such new\nversions will be similar in spirit to the present version, but may\ndiffer in detail to address new problems or concerns.  See\n<https://www.gnu.org/licenses/>.\n\nEach version of the License is given a distinguishing version\nnumber.  If the Document specifies that a particular numbered\nversion of this License \"or any later version\" applies to it, you\nhave the option of following the terms and conditions either of\nthat specified version or of any later version that has been\npublished (not as a draft) by the Free Software Foundation.  If the\nDocument does not specify a version number of this License, you may\nchoose any version ever published (not as a draft) by the Free\nSoftware Foundation.  If the Document specifies that a proxy can\ndecide which future versions of this License can be used, that\nproxy's public statement of acceptance of a version permanently\nauthorizes you to choose that version for the Document.\n\n11. RELICENSING\n\n\"Massive Multiauthor Collaboration Site\" (or \"MMC Site\") means any\nWorld Wide Web server that publishes copyrightable works and also\nprovides prominent facilities for anybody to edit those works.  A\npublic wiki that anybody can edit is an example of such a server.\nA \"Massive Multiauthor Collaboration\" (or \"MMC\") contained in the\nsite means any set of copyrightable works thus published on the MMC\nsite.\n\n\"CC-BY-SA\" means the Creative Commons Attribution-Share Alike 3.0\nlicense published by Creative Commons Corporation, a not-for-profit\ncorporation with a principal place of business in San Francisco,\nCalifornia, as well as future copyleft versions of that license\npublished by that same organization.\n\n\"Incorporate\" means to publish or republish a Document, in whole or\nin part, as part of another Document.\n\nAn MMC is \"eligible for relicensing\" if it is licensed under this\nLicense, and if all works that were first published under this\nLicense somewhere other than this MMC, and subsequently\nincorporated in whole or in part into the MMC, (1) had no cover\ntexts or invariant sections, and (2) were thus incorporated prior\nto November 1, 2008.\n\nThe operator of an MMC Site may republish an MMC contained in the\nsite under CC-BY-SA on the same site at any time before August 1,\n2009, provided the MMC is eligible for relicensing.\n"
                },
                {
                    "name": "ADDENDUM: How to use this License for your documents",
                    "content": ""
                }
            ]
        },
        "To use this License in a document you have written, include a copy of": {
            "content": "the License in the document and put the following copyright and license\nnotices just after the title page:\n\nCopyright (C)  YEAR  YOUR NAME.\nPermission is granted to copy, distribute and/or modify this document\nunder the terms of the GNU Free Documentation License, Version 1.3\nor any later version published by the Free Software Foundation;\nwith no Invariant Sections, no Front-Cover Texts, and no Back-Cover\nTexts.  A copy of the license is included in the section entitled ``GNU\nFree Documentation License''.\n\nIf you have Invariant Sections, Front-Cover Texts and Back-Cover\nTexts, replace the \"with...Texts.\" line with this:\n\nwith the Invariant Sections being LIST THEIR TITLES, with\nthe Front-Cover Texts being LIST, and with the Back-Cover Texts\nbeing LIST.\n\nIf you have Invariant Sections without Cover Texts, or some other\ncombination of the three, merge those two alternatives to suit the\nsituation.\n\nIf your document contains nontrivial examples of program code, we\nrecommend releasing these examples in parallel under your choice of free\nsoftware license, such as the GNU General Public License, to permit\ntheir use in free software.\n",
            "subsections": []
        },
        "File: m4.info,  Node: Indices,  Prev: Copying This Manual,  Up: Top": {
            "content": "",
            "subsections": []
        },
        "Appendix C Indices of concepts and macros": {
            "content": "* Menu:\n\n* Macro index::                 Index for all 'm4' macros\n* Concept index::               Index for many concepts\n",
            "subsections": []
        },
        "File: m4.info,  Node: Macro index,  Next: Concept index,  Up: Indices": {
            "content": "",
            "subsections": [
                {
                    "name": "C.1 Index for all 'm4' macros",
                    "content": ""
                }
            ]
        },
        "This index covers all 'm4' builtins, as well as several useful composite": {
            "content": "macros.  References are exclusively to the places where a macro is\nintroduced the first time.\n\n\n* Menu:\n\n* file:                              Location.            (line   9)\n* gnu:                               Platform macros.     (line  11)\n* line:                              Location.            (line  10)\n* os2:                               Platform macros.     (line  12)\n* program:                           Location.            (line  11)\n* unix:                              Platform macros.     (line  14)\n* windows:                           Platform macros.     (line  16)\n* argn:                                  Shift.               (line 256)\n* array:                                 Define.              (line  55)\n* arrayset:                             Define.              (line  56)\n* builtin:                               Builtin.             (line   8)\n* capitalize:                            Patsubst.            (line  54)\n* changecom:                             Changecom.           (line   9)\n* changequote:                           Changequote.         (line   9)\n* changeword:                            Changeword.          (line  22)\n* cleardivert:                           Cleardivert.         (line  25)\n* cond:                                  Shift.               (line  51)\n* copy:                                  Composition.         (line 119)\n* curry:                                 Composition.         (line  67)\n* debugfile:                             Debug Output.        (line  10)\n* debugmode:                             Debug Levels.        (line  77)\n* decr:                                  Incr.                (line  10)\n* define:                                Define.              (line   9)\n* defineblind:                          Composition.         (line  10)\n* defn:                                  Defn.                (line   9)\n* divert:                                Divert.              (line   8)\n* divnum:                                Divnum.              (line   8)\n* dnl:                                   Dnl.                 (line   8)\n* downcase:                              Patsubst.            (line  53)\n* dquote:                                Shift.               (line 194)\n* dquoteelt:                            Shift.               (line 195)\n* dumpdef:                               Dumpdef.             (line   9)\n* errprint:                              Errprint.            (line   8)\n* esyscmd:                               Esyscmd.             (line   8)\n* eval:                                  Eval.                (line   8)\n* example:                               Manual.              (line  39)\n* exch:                                  Arguments.           (line  12)\n* fatalerror:                           M4exit.              (line  24)\n* foreach:                               Foreach.             (line   8)\n* foreachq:                              Foreach.             (line   9)\n* forloop:                               Forloop.             (line   8)\n* format:                                Format.              (line   8)\n* ifdef:                                 Ifdef.               (line   9)\n* ifelse:                                Ifelse.              (line  10)\n* ifelse <1>:                            Ifelse.              (line  11)\n* ifelse <2>:                            Ifelse.              (line  12)\n* include:                               Include.             (line   8)\n* incr:                                  Incr.                (line   9)\n* index:                                 Index macro.         (line   8)\n* indir:                                 Indir.               (line   8)\n* join:                                  Shift.               (line 102)\n* joinall:                               Shift.               (line 103)\n* len:                                   Len.                 (line   8)\n* m4exit:                                M4exit.              (line   9)\n* m4wrap:                                M4wrap.              (line  13)\n* maketemp:                              Mkstemp.             (line  11)\n* mkstemp:                               Mkstemp.             (line  10)\n* nargs:                                 Pseudo Arguments.    (line  12)\n* os2:                                   Platform macros.     (line  13)\n* patsubst:                              Patsubst.            (line   8)\n* popdef:                                Pushdef.             (line  11)\n* pushdef:                               Pushdef.             (line  10)\n* quote:                                 Shift.               (line 193)\n* regexp:                                Regexp.              (line   8)\n* rename:                                Composition.         (line 120)\n* reverse:                               Shift.               (line  31)\n* shift:                                 Shift.               (line  16)\n* sinclude:                              Include.             (line   9)\n* stackforeach:                         Stacks.              (line  11)\n* stackforeachlifo:                    Stacks.              (line  12)\n* stackforeachsep:                     Improved copy.       (line  15)\n* stackforeachseplifo:                Improved copy.       (line  16)\n* substr:                                Substr.              (line   8)\n* syscmd:                                Syscmd.              (line   8)\n* sysval:                                Sysval.              (line   8)\n* traceoff:                              Trace.               (line  10)\n* traceon:                               Trace.               (line   9)\n* translit:                              Translit.            (line   8)\n* undefine:                              Undefine.            (line   8)\n* undivert:                              Undivert.            (line   8)\n* unix:                                  Platform macros.     (line  15)\n* upcase:                                Patsubst.            (line  52)\n* windows:                               Platform macros.     (line  17)\n",
            "subsections": []
        },
        "File: m4.info,  Node: Concept index,  Prev: Macro index,  Up: Indices": {
            "content": "",
            "subsections": [
                {
                    "name": "C.2 Index for many concepts",
                    "content": "* Menu:\n\n* argument currying:                     Composition.         (line  63)\n* arguments to macros:                   Macro Arguments.     (line   6)\n* arguments to macros <1>:               Arguments.           (line   6)\n* arguments to macros, special:          Pseudo Arguments.    (line   6)\n* arguments, joining:                    Shift.               (line  99)\n* arguments, more than nine:             Arguments.           (line  54)\n* arguments, more than nine <1>:         Shift.               (line 251)\n* arguments, more than nine <2>:         Improved foreach.    (line 155)\n* arguments, quoted macro:               Quoting Arguments.   (line   6)\n* arguments, reversing:                  Shift.               (line  31)\n* arithmetic:                            Arithmetic.          (line   6)\n* arrays:                                Define.              (line  52)\n* avoiding quadratic behavior:           Improved foreach.    (line  38)\n* basic regular expressions:             Regexp.              (line   6)\n* basic regular expressions <1>:         Patsubst.            (line   6)\n* blind macro:                           Inhibiting Invocation.\n(line  13)\n* blind macro <1>:                       Ifelse.              (line  52)\n* blind macro <2>:                       Composition.         (line  10)\n* bug reports:                           Bugs.                (line   6)\n* builtins, indirect call of:            Builtin.             (line   6)\n* builtins, special tokens:              Defn.                (line 101)\n* call of builtins, indirect:            Builtin.             (line   6)\n* call of macros, indirect:              Indir.               (line   6)\n* case statement:                        Ifelse.              (line  69)\n* changing comment delimiters:           Changecom.           (line   6)\n* changing quote delimiters:             Changequote.         (line   6)\n* changing syntax:                       Changeword.          (line   6)\n* characters, translating:               Translit.            (line   6)\n* command line:                          Invoking m4.         (line   6)\n* command line, file names on the:       Command line files.  (line   6)\n* command line, macro definitions on the: Preprocessor features.\n(line   6)\n* command line, options:                 Invoking m4.         (line  10)\n* commands, exit status from shell:      Sysval.              (line   6)\n* commands, running shell:               Shell commands.      (line   6)\n* comment delimiters, changing:          Changecom.           (line   6)\n* comments:                              Comments.            (line   6)\n* comments, copied to output:            Changecom.           (line  29)\n* comparing strings:                     Ifelse.              (line   6)\n* compatibility:                         Compatibility.       (line   6)\n* composing macros:                      Composition.         (line   6)\n* concatenating arguments:               Shift.               (line  99)\n* conditional, short-circuiting:         Shift.               (line  51)\n* conditionals:                          Ifdef.               (line   6)\n* controlling debugging output:          Debug Levels.        (line   6)\n* copying macros:                        Composition.         (line 116)\n* counting loops:                        Forloop.             (line   6)\n* currying arguments:                    Composition.         (line  63)\n* debugging macros:                      Debugging.           (line   6)\n* debugging output, controlling:         Debug Levels.        (line   6)\n* debugging output, saving:              Debug Output.        (line   6)\n* decrement operator:                    Incr.                (line   6)\n* deferring expansion:                   M4wrap.              (line   6)\n* deferring output:                      Diversions.          (line   6)\n* defining new macros:                   Definitions.         (line   6)\n* definition stack:                      Pushdef.             (line   6)\n* definition stack <1>:                  Stacks.              (line   6)\n* definitions, displaying macro:         Defn.                (line   6)\n* definitions, displaying macro <1>:     Dumpdef.             (line   6)\n* deleting macros:                       Undefine.            (line   6)\n* deleting whitespace in input:          Dnl.                 (line   6)\n* delimiters, changing:                  Changequote.         (line   6)\n* delimiters, changing <1>:              Changecom.           (line   6)\n* discarding diverted text:              Cleardivert.         (line   6)\n* discarding input:                      Ifelse.              (line   6)\n* discarding input <1>:                  Dnl.                 (line   6)\n* discarding input <2>:                  Divert.              (line  42)\n* displaying macro definitions:          Dumpdef.             (line   6)\n* diversion numbers:                     Divnum.              (line   6)\n* diverted text, discarding:             Cleardivert.         (line   6)\n* diverting output to files:             Divert.              (line   6)\n* dumping into frozen file:              Using frozen files.  (line   6)\n* error messages, printing:              Errprint.            (line   6)\n* errors, fatal:                         Operation modes.     (line  19)\n* evaluation, of integer expressions:    Eval.                (line   6)\n* examples, understanding:               Manual.              (line   6)\n* executing shell commands:              Shell commands.      (line   6)\n* exit status from shell commands:       Sysval.              (line   6)\n* exiting from m4:                       M4exit.              (line   6)\n* expansion of macros:                   Macro expansion.     (line   6)\n* expansion, deferring:                  M4wrap.              (line   6)\n* expansion, tracing macro:              Trace.               (line   6)\n* expressions, evaluation of integer:    Eval.                (line   6)\n* expressions, regular:                  Regexp.              (line   6)\n* expressions, regular <1>:              Patsubst.            (line   6)\n* extracting substrings:                 Substr.              (line   6)\n* fast loading of frozen files:          Using frozen files.  (line   6)\n* fatal errors:                          Operation modes.     (line  19)\n* FDL, GNU Free Documentation License:   GNU Free Documentation License.\n(line   6)\n* file format, frozen file:              Frozen file format.  (line   6)\n* file inclusion:                        File Inclusion.      (line   6)\n* file inclusion <1>:                    Undivert.            (line  13)\n* file inclusion <2>:                    Undivert.            (line  89)\n* file names, on the command line:       Command line files.  (line   6)\n* files, diverting output to:            Divert.              (line   6)\n* files, names of temporary:             Mkstemp.             (line   6)\n* for each loops:                        Foreach.             (line   6)\n* for loops:                             Forloop.             (line   6)\n* formatted output:                      Format.              (line   6)\n* Free Documentation License (FDL), GNU: GNU Free Documentation License.\n(line   6)\n* frozen file format:                    Frozen file format.  (line   6)\n* frozen files for fast loading:         Using frozen files.  (line   6)\n* General Public License (GPL), GNU:     GNU General Public License.\n(line   6)\n* GNU extensions:                        Inhibiting Invocation.\n(line  13)\n* GNU extensions <1>:                    Define.              (line  41)\n* GNU extensions <2>:                    Arguments.           (line  54)\n* GNU extensions <3>:                    Indir.               (line   6)\n* GNU extensions <4>:                    Builtin.             (line   6)\n* GNU extensions <5>:                    Debug Levels.        (line  74)\n* GNU extensions <6>:                    Debug Output.        (line   6)\n* GNU extensions <7>:                    Search Path.         (line   6)\n* GNU extensions <8>:                    Divert.              (line  54)\n* GNU extensions <9>:                    Undivert.            (line  13)\n* GNU extensions <10>:                   Undivert.            (line  89)\n* GNU extensions <11>:                   Regexp.              (line   6)\n* GNU extensions <12>:                   Patsubst.            (line   6)\n* GNU extensions <13>:                   Format.              (line   6)\n* GNU extensions <14>:                   Eval.                (line 113)\n* GNU extensions <15>:                   Esyscmd.             (line   6)\n* GNU extensions <16>:                   Mkstemp.             (line  58)\n* GNU extensions <17>:                   Using frozen files.  (line   6)\n* GNU extensions <18>:                   Extensions.          (line   6)\n* GNU Free Documentation License:        GNU Free Documentation License.\n(line   6)\n* GNU General Public License:            GNU General Public License.\n(line   6)\n* GNU M4, history of:                    History.             (line   6)\n* GPL, GNU General Public License:       GNU General Public License.\n(line   6)\n* history of m4:                         History.             (line   6)\n* included files, search path for:       Search Path.         (line   6)\n* inclusion, of files:                   File Inclusion.      (line   6)\n* inclusion, of files <1>:               Undivert.            (line  13)\n* inclusion, of files <2>:               Undivert.            (line  89)\n* increment operator:                    Incr.                (line   6)\n* indirect call of builtins:             Builtin.             (line   6)\n* indirect call of macros:               Indir.               (line   6)\n* initialization, frozen state:          Using frozen files.  (line   6)\n* input location:                        Preprocessor features.\n(line  28)\n* input location <1>:                    Location.            (line   6)\n* input tokens:                          Syntax.              (line   6)\n* input, discarding:                     Ifelse.              (line   6)\n* input, discarding <1>:                 Dnl.                 (line   6)\n* input, discarding <2>:                 Divert.              (line  42)\n* input, saving:                         M4wrap.              (line   6)\n* integer arithmetic:                    Arithmetic.          (line   6)\n* integer expression evaluation:         Eval.                (line   6)\n* invoking m4:                           Invoking m4.         (line   6)\n* invoking macros:                       Invocation.          (line   6)\n* iterating over lists:                  Foreach.             (line   6)\n* joining arguments:                     Shift.               (line  99)\n* length of strings:                     Len.                 (line   6)\n* lexical structure of words:            Changeword.          (line   6)\n* License, code:                         Copying This Package.\n(line   6)\n* License, manual:                       Copying This Manual. (line   6)\n* limit, nesting:                        Limits control.      (line  43)\n* literal output:                        Pseudo Arguments.    (line 106)\n* local variables:                       Pushdef.             (line  79)\n* location, input:                       Preprocessor features.\n(line  28)\n* location, input <1>:                   Location.            (line   6)\n* loops:                                 Shift.               (line  10)\n* loops, counting:                       Forloop.             (line   6)\n* loops, list iteration:                 Foreach.             (line   6)\n* M4PATH:                                Search Path.         (line   9)\n* macro composition:                     Composition.         (line   6)\n* macro definitions, on the command line: Preprocessor features.\n(line   6)\n* macro expansion, tracing:              Trace.               (line   6)\n* macro invocation:                      Invocation.          (line   6)\n* macro, blind:                          Inhibiting Invocation.\n(line  13)\n* macro, blind <1>:                      Ifelse.              (line  52)\n* macro, blind <2>:                      Composition.         (line  10)\n* macros, arguments to:                  Macro Arguments.     (line   6)\n* macros, arguments to <1>:              Arguments.           (line   6)\n* macros, copying:                       Composition.         (line 116)\n* macros, debugging:                     Debugging.           (line   6)\n* macros, displaying definitions:        Defn.                (line   6)\n* macros, displaying definitions <1>:    Dumpdef.             (line   6)\n* macros, expansion of:                  Macro expansion.     (line   6)\n* macros, how to define new:             Definitions.         (line   6)\n* macros, how to delete:                 Undefine.            (line   6)\n* macros, how to rename:                 Defn.                (line   6)\n* macros, indirect call of:              Indir.               (line   6)\n* macros, quoted arguments to:           Quoting Arguments.   (line   6)\n* macros, recursive:                     Shift.               (line   6)\n* macros, special arguments to:          Pseudo Arguments.    (line   6)\n* macros, temporary redefinition of:     Pushdef.             (line   6)\n* manipulating quotes:                   Shift.               (line 190)\n* messages, printing error:              Errprint.            (line   6)\n* more than nine arguments:              Arguments.           (line  54)\n* more than nine arguments <1>:          Shift.               (line 251)\n* more than nine arguments <2>:          Improved foreach.    (line 155)\n* multibranches:                         Ifelse.              (line  69)\n* names:                                 Names.               (line   6)\n* nesting limit:                         Limits control.      (line  43)\n* nine arguments, more than:             Arguments.           (line  54)\n* nine arguments, more than <1>:         Shift.               (line 251)\n* nine arguments, more than <2>:         Improved foreach.    (line 155)\n* numbers:                               Manual.              (line  57)\n* options, command line:                 Invoking m4.         (line  10)\n* output, diverting to files:            Divert.              (line   6)\n* output, formatted:                     Format.              (line   6)\n* output, literal:                       Pseudo Arguments.    (line 106)\n* output, saving debugging:              Debug Output.        (line   6)\n* overview of m4:                        Intro.               (line   6)\n* pattern substitution:                  Patsubst.            (line   6)\n* platform macros:                       Platform macros.     (line   6)\n* positional parameters, more than nine: Arguments.           (line  54)\n* POSIX:                                 Extensions.          (line   6)\n* POSIXLYCORRECT:                       Invoking m4.         (line  10)\n* POSIXLYCORRECT <1>:                   Incompatibilities.   (line 144)\n* preprocessor features:                 Preprocessor features.\n(line   6)\n* printing error messages:               Errprint.            (line   6)\n* pushdef stack:                         Pushdef.             (line   6)\n* pushdef stack <1>:                     Stacks.              (line   6)\n* quadratic behavior, avoiding:          Improved foreach.    (line  38)\n* quote delimiters, changing:            Changequote.         (line   6)\n* quote manipulation:                    Shift.               (line 190)\n* quoted macro arguments:                Quoting Arguments.   (line   6)\n* quoted string:                         Quoted strings.      (line   6)\n* quoting rule of thumb:                 Quoting Arguments.   (line  22)\n* recursive macros:                      Shift.               (line   6)\n* redefinition of macros, temporary:     Pushdef.             (line   6)\n* regular expressions:                   Changeword.          (line   6)\n* regular expressions <1>:               Regexp.              (line   6)\n* regular expressions <2>:               Patsubst.            (line   6)\n* reloading a frozen file:               Using frozen files.  (line   6)\n* renaming macros:                       Defn.                (line   6)\n* renaming macros <1>:                   Composition.         (line 116)\n* reporting bugs:                        Bugs.                (line   6)\n* rescanning:                            Limits control.      (line  56)\n* rescanning <1>:                        Inhibiting Invocation.\n(line  86)\n* rescanning <2>:                        Pseudo Arguments.    (line 106)\n* rescanning <3>:                        Defn.                (line  61)\n* rescanning <4>:                        Other Incompatibilities.\n(line  52)\n* reversing arguments:                   Shift.               (line  31)\n* rule of thumb, quoting:                Quoting Arguments.   (line  22)\n* running shell commands:                Shell commands.      (line   6)\n* saving debugging output:               Debug Output.        (line   6)\n* saving input:                          M4wrap.              (line   6)\n* search path for included files:        Search Path.         (line   6)\n* shell commands, exit status from:      Sysval.              (line   6)\n* shell commands, running:               Shell commands.      (line   6)\n* short-circuiting conditional:          Shift.               (line  51)\n* special arguments to macros:           Pseudo Arguments.    (line   6)\n* stack, macro definition:               Pushdef.             (line   6)\n* stack, macro definition <1>:           Stacks.              (line   6)\n* standard error, output to:             Dumpdef.             (line   6)\n* standard error, output to <1>:         Trace.               (line   6)\n* standard error, output to <2>:         Errprint.            (line   6)\n* status of shell commands:              Sysval.              (line   6)\n* status, setting m4 exit:               M4exit.              (line   6)\n* string, quoted:                        Quoted strings.      (line   6)\n* strings, length of:                    Len.                 (line   6)\n* substitution by regular expression:    Patsubst.            (line   6)\n* substrings, extracting:                Substr.              (line   6)\n* substrings, locating:                  Index macro.         (line   6)\n* suggestions, reporting:                Bugs.                (line   6)\n* suppressing warnings:                  Macro Arguments.     (line  38)\n* switch statement:                      Ifelse.              (line  69)\n* synchronization lines:                 Preprocessor features.\n(line  28)\n* syntax, changing:                      Changeword.          (line   6)\n* temporary file names:                  Mkstemp.             (line   6)\n* temporary redefinition of macros:      Pushdef.             (line   6)\n* TMPDIR:                                Diversions.          (line  10)\n* tokens:                                Syntax.              (line   6)\n* tokens, builtin macro:                 Defn.                (line 101)\n* tokens, special:                       Other tokens.        (line   6)\n* tracing macro expansion:               Trace.               (line   6)\n* translating characters:                Translit.            (line   6)\n* undefining macros:                     Undefine.            (line   6)\n* UNIX commands, exit status from:       Sysval.              (line   6)\n* UNIX commands, running:                Shell commands.      (line   6)\n* variables, local:                      Pushdef.             (line  79)\n* warnings, suppressing:                 Macro Arguments.     (line  38)\n* words:                                 Names.               (line   6)\n* words, lexical structure of:           Changeword.          (line   6)\n"
                }
            ]
        }
    },
    "flags": [],
    "examples": [],
    "see_also": []
}