/[m4]/m4/doc/m4.info
ViewVC logotype

Diff of /m4/doc/m4.info

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1.1.1.2.3 by gary, Thu Sep 9 21:10:27 2004 UTC revision 1.1.1.1.2.4 by gary, Thu Feb 3 15:21:06 2005 UTC
# Line 1  Line 1 
1  This is m4.info, produced by makeinfo version 4.7 from m4.texinfo.  This is m4.info, produced by makeinfo version 4.6 from m4.texinfo.
2    
3  START-INFO-DIR-ENTRY  START-INFO-DIR-ENTRY
4  * m4: (m4).                     A powerful macro processor.  * m4: (m4).                     A powerful macro processor.
# Line 48  documentation.  However... Line 48  documentation.  However...
48     An experimental feature, which would improve `m4' usefulness, allows     An experimental feature, which would improve `m4' usefulness, allows
49  for changing the syntax for what is a "word" in `m4'.  You should use:  for changing the syntax for what is a "word" in `m4'.  You should use:
50       ./configure --enable-changeword       ./configure --enable-changeword
51     if you want this feature compiled in.  The current implementation  
52  slows down `m4' considerably and is hardly acceptable.  So, it might go  if you want this feature compiled in.  The current implementation slows
53  away, do not count on it yet.  down `m4' considerably and is hardly acceptable.  So, it might go away,
54    do not count on it yet.
55    
56  * Menu:  * Menu:
57    
# Line 184  Compatibility with other versions of `m4 Line 185  Compatibility with other versions of `m4
185    
186  File: m4.info,  Node: Preliminaries,  Next: Syntax,  Prev: Top,  Up: Top  File: m4.info,  Node: Preliminaries,  Next: Syntax,  Prev: Top,  Up: Top
187    
188  1 Introduction and preliminaries  Introduction and preliminaries
189  ********************************  ******************************
190    
191  This first chapter explains what is GNU `m4', where `m4' comes from,  This first chapter explains what is GNU `m4', where `m4' comes from,
192  how to read and use this documentation, how to call the `m4' program  how to read and use this documentation, how to call the `m4' program
# Line 206  language. Line 207  language.
207    
208  File: m4.info,  Node: Intro,  Next: History,  Prev: Preliminaries,  Up: Preliminaries  File: m4.info,  Node: Intro,  Next: History,  Prev: Preliminaries,  Up: Preliminaries
209    
210  1.1 Introduction to `m4'  Introduction to `m4'
211  ========================  ====================
212    
213  `m4' is a macro processor, in the sense that it copies its input to the  `m4' is a macro processor, in the sense that it copies its input to the
214  output, expanding macros as it goes.  Macros are either builtin or  output, expanding macros as it goes.  Macros are either builtin or
# Line 237  the health of compulsive programmers. Line 238  the health of compulsive programmers.
238    
239  File: m4.info,  Node: History,  Next: Invoking m4,  Prev: Intro,  Up: Preliminaries  File: m4.info,  Node: History,  Next: Invoking m4,  Prev: Intro,  Up: Preliminaries
240    
241  1.2 Historical references  Historical references
242  =========================  =====================
243    
244  The historical notes included here are fairly incomplete, and not  The historical notes included here are fairly incomplete, and not
245  authoritative at all.  Please knowledgeable users help us to more  authoritative at all.  Please knowledgeable users help us to more
# Line 260  that is, the `ratfor' equivalent of `cpp Line 261  that is, the `ratfor' equivalent of `cpp
261    
262  File: m4.info,  Node: Invoking m4,  Next: Bugs,  Prev: History,  Up: Preliminaries  File: m4.info,  Node: Invoking m4,  Next: Bugs,  Prev: History,  Up: Preliminaries
263    
264  1.3 Invoking `m4'  Invoking `m4'
265  =================  =============
266    
267  The format of the `m4' command is:  The format of the `m4' command is:
268    
# Line 444  the command line. Line 445  the command line.
445    
446  File: m4.info,  Node: Bugs,  Next: Manual,  Prev: Invoking m4,  Up: Preliminaries  File: m4.info,  Node: Bugs,  Next: Manual,  Prev: Invoking m4,  Up: Preliminaries
447    
448  1.4 Problems and bugs  Problems and bugs
449  =====================  =================
450    
451  If you have problems with GNU `m4' or think you've found a bug, please  If you have problems with GNU `m4' or think you've found a bug, please
452  report it.  Before reporting a bug, make sure you've actually found a  report it.  Before reporting a bug, make sure you've actually found a
# Line 473  just obscure features, please report the Line 474  just obscure features, please report the
474    
475  File: m4.info,  Node: Manual,  Prev: Bugs,  Up: Preliminaries  File: m4.info,  Node: Manual,  Prev: Bugs,  Up: Preliminaries
476    
477  1.5 Using this manual  Using this manual
478  =====================  =================
479    
480  This manual contains a number of examples of `m4' input and output, and  This manual contains a number of examples of `m4' input and output, and
481  a simple notation is used to distinguish input, output and error  a simple notation is used to distinguish input, output and error
# Line 512  primitive is spelled within `m4'. Line 513  primitive is spelled within `m4'.
513    
514  File: m4.info,  Node: Syntax,  Next: Macros,  Prev: Preliminaries,  Up: Top  File: m4.info,  Node: Syntax,  Next: Macros,  Prev: Preliminaries,  Up: Top
515    
516  2 Lexical and syntactic conventions  Lexical and syntactic conventions
517  ***********************************  *********************************
518    
519  As `m4' reads its input, it separates it into "tokens".  A token is  As `m4' reads its input, it separates it into "tokens".  A token is
520  either a name, a quoted string, or any single character, that is not a  either a name, a quoted string, or any single character, that is not a
# Line 530  comments. Line 531  comments.
531    
532  File: m4.info,  Node: Names,  Next: Quoted strings,  Prev: Syntax,  Up: Syntax  File: m4.info,  Node: Names,  Next: Quoted strings,  Prev: Syntax,  Up: Syntax
533    
534  2.1 Names  Names
535  =========  =====
536    
537  A name is any sequence of letters, digits, and the character `_'  A name is any sequence of letters, digits, and the character `_'
538  (underscore), where the first character is not a digit.  If a name has  (underscore), where the first character is not a digit.  If a name has
# Line 543  Macros::). Line 544  Macros::).
544    
545  File: m4.info,  Node: Quoted strings,  Next: Other tokens,  Prev: Names,  Up: Syntax  File: m4.info,  Node: Quoted strings,  Next: Other tokens,  Prev: Names,  Up: Syntax
546    
547  2.2 Quoted strings  Quoted strings
548  ==================  ==============
549    
550  A quoted string is a sequence of characters surrounded by the quotes  A quoted string is a sequence of characters surrounded by the quotes
551  ``' and `'', where the number of start and end quotes within the string  ``' and `'', where the number of start and end quotes within the string
# Line 567  macro `changequote'.  *Note Changequote: Line 568  macro `changequote'.  *Note Changequote:
568    
569  File: m4.info,  Node: Other tokens,  Next: Comments,  Prev: Quoted strings,  Up: Syntax  File: m4.info,  Node: Other tokens,  Next: Comments,  Prev: Quoted strings,  Up: Syntax
570    
571  2.3 Other tokens  Other tokens
572  ================  ============
573    
574  Any character, that is neither a part of a name, nor of a quoted string,  Any character, that is neither a part of a name, nor of a quoted string,
575  is a token by itself.  is a token by itself.
# Line 576  is a token by itself. Line 577  is a token by itself.
577    
578  File: m4.info,  Node: Comments,  Prev: Other tokens,  Up: Syntax  File: m4.info,  Node: Comments,  Prev: Other tokens,  Up: Syntax
579    
580  2.4 Comments  Comments
581  ============  ========
582    
583  Comments in `m4' are normally delimited by the characters `#' and  Comments in `m4' are normally delimited by the characters `#' and
584  newline.  All characters between the comment delimiters are ignored,  newline.  All characters between the comment delimiters are ignored,
# Line 595  information. Line 596  information.
596    
597  File: m4.info,  Node: Macros,  Next: Definitions,  Prev: Syntax,  Up: Top  File: m4.info,  Node: Macros,  Next: Definitions,  Prev: Syntax,  Up: Top
598    
599  3 How to invoke macros  How to invoke macros
600  **********************  ********************
601    
602  This chapter covers macro invocation, macro arguments and how macro  This chapter covers macro invocation, macro arguments and how macro
603  expansion is treated.  expansion is treated.
# Line 612  expansion is treated. Line 613  expansion is treated.
613    
614  File: m4.info,  Node: Invocation,  Next: Inhibiting Invocation,  Prev: Macros,  Up: Macros  File: m4.info,  Node: Invocation,  Next: Inhibiting Invocation,  Prev: Macros,  Up: Macros
615    
616  3.1 Macro invocation  Macro invocation
617  ====================  ================
618    
619  Macro invocations has one of the forms  Macro invocations has one of the forms
620    
# Line 642  with no arguments. Line 643  with no arguments.
643    
644  File: m4.info,  Node: Inhibiting Invocation,  Next: Macro Arguments,  Prev: Invocation,  Up: Macros  File: m4.info,  Node: Inhibiting Invocation,  Next: Macro Arguments,  Prev: Invocation,  Up: Macros
645    
646  3.2 Preventing macro invocation  Preventing macro invocation
647  ===============================  ===========================
648    
649  An innovation of the `m4' language, compared to some of its  An innovation of the `m4' language, compared to some of its
650  predecessors (like Stratchey's `GPM', for example), is the ability to  predecessors (like Stratchey's `GPM', for example), is the ability to
# Line 724  the `divert' builtin would be called ins Line 725  the `divert' builtin would be called ins
725    
726  File: m4.info,  Node: Macro Arguments,  Next: Quoting Arguments,  Prev: Inhibiting Invocation,  Up: Macros  File: m4.info,  Node: Macro Arguments,  Next: Quoting Arguments,  Prev: Inhibiting Invocation,  Up: Macros
727    
728  3.3 Macro arguments  Macro arguments
729  ===================  ===============
730    
731  When a name is seen, and it has a macro definition, it will be expanded  When a name is seen, and it has a macro definition, it will be expanded
732  as a macro.  as a macro.
# Line 755  but trailing whitespace always is. Line 756  but trailing whitespace always is.
756    
757  File: m4.info,  Node: Quoting Arguments,  Next: Macro expansion,  Prev: Macro Arguments,  Up: Macros  File: m4.info,  Node: Quoting Arguments,  Next: Macro expansion,  Prev: Macro Arguments,  Up: Macros
758    
759  3.4 Quoting macro arguments  Quoting macro arguments
760  ===========================  =======================
761    
762  Each argument has leading unquoted whitespace removed.  Within each  Each argument has leading unquoted whitespace removed.  Within each
763  argument, all unquoted parentheses must match.  For example, if FOO is  argument, all unquoted parentheses must match.  For example, if FOO is
# Line 779  life a bit harder, if you are not carefu Line 780  life a bit harder, if you are not carefu
780    
781  File: m4.info,  Node: Macro expansion,  Prev: Quoting Arguments,  Up: Macros  File: m4.info,  Node: Macro expansion,  Prev: Quoting Arguments,  Up: Macros
782    
783  3.5 Macro expansion  Macro expansion
784  ===================  ===============
785    
786  When the arguments, if any, to a macro call have been collected, the  When the arguments, if any, to a macro call have been collected, the
787  macro is expanded, and the expansion text is pushed back onto the input  macro is expanded, and the expansion text is pushed back onto the input
# Line 799  will expand first to `bar', and when thi Line 800  will expand first to `bar', and when thi
800    
801  File: m4.info,  Node: Definitions,  Next: Conditionals,  Prev: Macros,  Up: Top  File: m4.info,  Node: Definitions,  Next: Conditionals,  Prev: Macros,  Up: Top
802    
803  4 How to define new macros  How to define new macros
804  **************************  ************************
805    
806  Macros can be defined, redefined and deleted in several different ways.  Macros can be defined, redefined and deleted in several different ways.
807  Also, it is possible to redefine a macro, without losing a previous  Also, it is possible to redefine a macro, without losing a previous
# Line 821  value, which can be brought back at a la Line 822  value, which can be brought back at a la
822    
823  File: m4.info,  Node: Define,  Next: Arguments,  Prev: Definitions,  Up: Definitions  File: m4.info,  Node: Define,  Next: Arguments,  Prev: Definitions,  Up: Definitions
824    
825  4.1 Defining a macro  Defining a macro
826  ====================  ================
827    
828  The normal way to define or redefine macros is to use the builtin  The normal way to define or redefine macros is to use the builtin
829  `define':  `define':
# Line 852  for details. Line 853  for details.
853    
854  File: m4.info,  Node: Arguments,  Next: Pseudo Arguments,  Prev: Define,  Up: Definitions  File: m4.info,  Node: Arguments,  Next: Pseudo Arguments,  Prev: Define,  Up: Definitions
855    
856  4.2 Arguments to macros  Arguments to macros
857  =======================  ===================
858    
859  Macros can have arguments.  The Nth argument is denoted by `$n' in the  Macros can have arguments.  The Nth argument is denoted by `$n' in the
860  expansion text, and is replaced by the Nth actual argument, when the  expansion text, and is replaced by the Nth actual argument, when the
# Line 903  string, and not a name. Line 904  string, and not a name.
904    
905  File: m4.info,  Node: Pseudo Arguments,  Next: Undefine,  Prev: Arguments,  Up: Definitions  File: m4.info,  Node: Pseudo Arguments,  Next: Undefine,  Prev: Arguments,  Up: Definitions
906    
907  4.3 Special arguments to macros  Special arguments to macros
908  ===============================  ===========================
909    
910  There is a special notation for the number of actual arguments supplied,  There is a special notation for the number of actual arguments supplied,
911  and for all the actual arguments.  and for all the actual arguments.
# Line 971  sign as a reference to an argument. Line 972  sign as a reference to an argument.
972    
973  File: m4.info,  Node: Undefine,  Next: Defn,  Prev: Pseudo Arguments,  Up: Definitions  File: m4.info,  Node: Undefine,  Next: Defn,  Prev: Pseudo Arguments,  Up: Definitions
974    
975  4.4 Deleting a macro  Deleting a macro
976  ====================  ================
977    
978  A macro definition can be removed with `undefine':  A macro definition can be removed with `undefine':
979    
# Line 1002  case, `undefine' does nothing. Line 1003  case, `undefine' does nothing.
1003    
1004  File: m4.info,  Node: Defn,  Next: Pushdef,  Prev: Undefine,  Up: Definitions  File: m4.info,  Node: Defn,  Next: Pushdef,  Prev: Undefine,  Up: Definitions
1005    
1006  4.5 Renaming macros  Renaming macros
1007  ===================  ===============
1008    
1009  It is possible to rename an already defined macro.  To do this, you need  It is possible to rename an already defined macro.  To do this, you need
1010  the builtin `defn':  the builtin `defn':
# Line 1038  the other name can still be used to acce Line 1039  the other name can still be used to acce
1039    
1040  File: m4.info,  Node: Pushdef,  Next: Indir,  Prev: Defn,  Up: Definitions  File: m4.info,  Node: Pushdef,  Next: Indir,  Prev: Defn,  Up: Definitions
1041    
1042  4.6 Temporarily redefining macros  Temporarily redefining macros
1043  =================================  =============================
1044    
1045  It is possible to redefine a macro temporarily, reverting to the  It is possible to redefine a macro temporarily, reverting to the
1046  previous definition at a later time.  This is done with the builtins  previous definition at a later time.  This is done with the builtins
# Line 1108  parameters. Line 1109  parameters.
1109    
1110  File: m4.info,  Node: Indir,  Next: Builtin,  Prev: Pushdef,  Up: Definitions  File: m4.info,  Node: Indir,  Next: Builtin,  Prev: Pushdef,  Up: Definitions
1111    
1112  4.7 Indirect call of macros  Indirect call of macros
1113  ===========================  =======================
1114    
1115  Any macro can be called indirectly with `indir':  Any macro can be called indirectly with `indir':
1116    
1117       indir(NAME, ...)       indir(NAME, ...)
1118     which results in a call to the macro NAME, which is passed the rest  
1119  of the arguments.  This can be used to call macros with "illegal" names  which results in a call to the macro NAME, which is passed the rest of
1120    the arguments.  This can be used to call macros with "illegal" names
1121  (`define' allows such names to be defined):  (`define' allows such names to be defined):
1122    
1123       define(`$$internal$macro', `Internal macro (name `$0')')       define(`$$internal$macro', `Internal macro (name `$0')')
# Line 1132  called through the builtin `indir'. Line 1134  called through the builtin `indir'.
1134    
1135  File: m4.info,  Node: Builtin,  Prev: Indir,  Up: Definitions  File: m4.info,  Node: Builtin,  Prev: Indir,  Up: Definitions
1136    
1137  4.8 Indirect call of builtins  Indirect call of builtins
1138  =============================  =========================
1139    
1140  Builtin macros can be called indirectly with `builtin':  Builtin macros can be called indirectly with `builtin':
1141    
1142       builtin(NAME, ...)       builtin(NAME, ...)
1143     which results in a call to the builtin NAME, which is passed the  
1144  rest of the arguments.  This can be used, if NAME has been given  which results in a call to the builtin NAME, which is passed the rest
1145  another definition that has covered the original.  of the arguments.  This can be used, if NAME has been given another
1146    definition that has covered the original.
1147    
1148     The macro `builtin' is recognized only with parameters.     The macro `builtin' is recognized only with parameters.
1149    
1150    
1151  File: m4.info,  Node: Conditionals,  Next: Debugging,  Prev: Definitions,  Up: Top  File: m4.info,  Node: Conditionals,  Next: Debugging,  Prev: Definitions,  Up: Top
1152    
1153  5 Conditionals, loops and recursion  Conditionals, loops and recursion
1154  ***********************************  *********************************
1155    
1156  Macros, expanding to plain text, perhaps with arguments, are not quite  Macros, expanding to plain text, perhaps with arguments, are not quite
1157  enough.  We would like to have macros expand to different things, based  enough.  We would like to have macros expand to different things, based
# Line 1166  true. Line 1169  true.
1169    
1170  File: m4.info,  Node: Ifdef,  Next: Ifelse,  Prev: Conditionals,  Up: Conditionals  File: m4.info,  Node: Ifdef,  Next: Ifelse,  Prev: Conditionals,  Up: Conditionals
1171    
1172  5.1 Testing macro definitions  Testing macro definitions
1173  =============================  =========================
1174    
1175  There are two different builtin conditionals in `m4'.  The first is  There are two different builtin conditionals in `m4'.  The first is
1176  `ifdef':  `ifdef':
# Line 1191  STRING-2.  If STRING-2 is omitted, it is Line 1194  STRING-2.  If STRING-2 is omitted, it is
1194    
1195  File: m4.info,  Node: Ifelse,  Next: Loops,  Prev: Ifdef,  Up: Conditionals  File: m4.info,  Node: Ifelse,  Next: Loops,  Prev: Ifdef,  Up: Conditionals
1196    
1197  5.2 Comparing strings  Comparing strings
1198  =====================  =================
1199    
1200  The other conditional, `ifelse', is much more powerful.  It can be used  The other conditional, `ifelse', is much more powerful.  It can be used
1201  as a way to introduce a long comment, as an if-else construct, or as a  as a way to introduce a long comment, as an if-else construct, or as a
# Line 1239  various kinds. Line 1242  various kinds.
1242    
1243  File: m4.info,  Node: Loops,  Prev: Ifelse,  Up: Conditionals  File: m4.info,  Node: Loops,  Prev: Ifelse,  Up: Conditionals
1244    
1245  5.3 Loops and recursion  Loops and recursion
1246  =======================  ===================
1247    
1248  There is no direct support for loops in `m4', but macros can be  There is no direct support for loops in `m4', but macros can be
1249  recursive.  There is no limit on the number of recursion levels, other  recursive.  There is no limit on the number of recursion levels, other
# Line 1331  the reader. Line 1334  the reader.
1334    
1335  File: m4.info,  Node: Debugging,  Next: Input Control,  Prev: Conditionals,  Up: Top  File: m4.info,  Node: Debugging,  Next: Input Control,  Prev: Conditionals,  Up: Top
1336    
1337  6 How to debug macros and input  How to debug macros and input
1338  *******************************  *****************************
1339    
1340  When writing macros for `m4', most of the time they woould not work as  When writing macros for `m4', most of the time they woould not work as
1341  intended (as is the case with most programming languages).  There is a  intended (as is the case with most programming languages).  There is a
# Line 1348  little support for macro debugging in `m Line 1351  little support for macro debugging in `m
1351    
1352  File: m4.info,  Node: Dumpdef,  Next: Trace,  Prev: Debugging,  Up: Debugging  File: m4.info,  Node: Dumpdef,  Next: Trace,  Prev: Debugging,  Up: Debugging
1353    
1354  6.1 Displaying macro definitions  Displaying macro definitions
1355  ================================  ============================
1356    
1357  If you want to see what a name expands into, you can use the builtin  If you want to see what a name expands into, you can use the builtin
1358  `dumpdef':  `dumpdef':
# Line 1380  the display. Line 1383  the display.
1383    
1384  File: m4.info,  Node: Trace,  Next: Debug Levels,  Prev: Dumpdef,  Up: Debugging  File: m4.info,  Node: Trace,  Next: Debug Levels,  Prev: Dumpdef,  Up: Debugging
1385    
1386  6.2 Tracing macro calls  Tracing macro calls
1387  =======================  ===================
1388    
1389  It is possible to trace macro calls and expansions through the builtins  It is possible to trace macro calls and expansions through the builtins
1390  `traceon' and `traceoff':  `traceon' and `traceoff':
# Line 1423  the display. Line 1426  the display.
1426    
1427  File: m4.info,  Node: Debug Levels,  Next: Debug Output,  Prev: Trace,  Up: Debugging  File: m4.info,  Node: Debug Levels,  Next: Debug Output,  Prev: Trace,  Up: Debugging
1428    
1429  6.3 Controlling debugging output  Controlling debugging output
1430  ================================  ============================
1431    
1432  The `-d' option to `m4' controls the amount of details presented, when  The `-d' option to `m4' controls the amount of details presented, when
1433  using the macros described in the preceding sections.  using the macros described in the preceding sections.
# Line 1483  flags. Line 1486  flags.
1486  control of the debugging output format:  control of the debugging output format:
1487    
1488       debugmode(opt FLAGS)       debugmode(opt FLAGS)
1489     The argument FLAGS should be a subset of the letters listed above.  
1490  As special cases, if the argument starts with a `+', the flags are  The argument FLAGS should be a subset of the letters listed above.  As
1491  added to the current debug flags, and if it starts with a `-', they are  special cases, if the argument starts with a `+', the flags are added
1492    to the current debug flags, and if it starts with a `-', they are
1493  removed.  If no argument is present, the debugging flags are set to  removed.  If no argument is present, the debugging flags are set to
1494  zero (as if no `-d' was given), and with an empty argument the flags  zero (as if no `-d' was given), and with an empty argument the flags
1495  are reset to the default.  are reset to the default.
# Line 1493  are reset to the default. Line 1497  are reset to the default.
1497    
1498  File: m4.info,  Node: Debug Output,  Prev: Debug Levels,  Up: Debugging  File: m4.info,  Node: Debug Output,  Prev: Debug Levels,  Up: Debugging
1499    
1500  6.4 Saving debugging output  Saving debugging output
1501  ===========================  =======================
1502    
1503  Debug and tracing output can be redirected to files using either the  Debug and tracing output can be redirected to files using either the
1504  `-o' option to `m4', or with the builtin macro `debugfile':  `-o' option to `m4', or with the builtin macro `debugfile':
1505    
1506       debugfile(opt FILENAME)       debugfile(opt FILENAME)
1507     will send all further debug and trace output to FILENAME.  If  
1508  FILENAME is empty, debug and trace output are discarded and if  will send all further debug and trace output to FILENAME.  If FILENAME
1509  `debugfile' is called without any arguments, debug and trace output are  is empty, debug and trace output are discarded and if `debugfile' is
1510  sent to the standard error output.  called without any arguments, debug and trace output are sent to the
1511    standard error output.
1512    
1513    
1514  File: m4.info,  Node: Input Control,  Next: File Inclusion,  Prev: Debugging,  Up: Top  File: m4.info,  Node: Input Control,  Next: File Inclusion,  Prev: Debugging,  Up: Top
1515    
1516  7 Input control  Input control
1517  ***************  *************
1518    
1519  This chapter describes various builtin macros for controlling the input  This chapter describes various builtin macros for controlling the input
1520  to `m4'.  to `m4'.
# Line 1525  to `m4'. Line 1530  to `m4'.
1530    
1531  File: m4.info,  Node: Dnl,  Next: Changequote,  Prev: Input Control,  Up: Input Control  File: m4.info,  Node: Dnl,  Next: Changequote,  Prev: Input Control,  Up: Input Control
1532    
1533  7.1 Deleting whitespace in input  Deleting whitespace in input
1534  ================================  ============================
1535    
1536  The builtin `dnl' reads and discards all characters, up to and  The builtin `dnl' reads and discards all characters, up to and
1537  including the first newline:  including the first newline:
1538    
1539       dnl       dnl
1540     and it is often used in connection with `define', to remove the  
1541  newline that follow the call to `define'.  Thus  and it is often used in connection with `define', to remove the newline
1542    that follow the call to `define'.  Thus
1543    
1544       define(`foo', `Macro `foo'.')dnl A very simple macro, indeed.       define(`foo', `Macro `foo'.')dnl A very simple macro, indeed.
1545       foo       foo
# Line 1554  line containing it, will still be discar Line 1560  line containing it, will still be discar
1560    
1561  File: m4.info,  Node: Changequote,  Next: Changecom,  Prev: Dnl,  Up: Input Control  File: m4.info,  Node: Changequote,  Next: Changecom,  Prev: Dnl,  Up: Input Control
1562    
1563  7.2 Changing the quote characters  Changing the quote characters
1564  =================================  =============================
1565    
1566  The default quote delimiters can be changed with the builtin  The default quote delimiters can be changed with the builtin
1567  `changequote':  `changequote':
1568    
1569       changequote(opt START, opt END)       changequote(opt START, opt END)
1570     where START is the new start-quote delimiter and END is the new  
1571    where START is the new start-quote delimiter and END is the new
1572  end-quote delimiter.  If any of the arguments are missing, the default  end-quote delimiter.  If any of the arguments are missing, the default
1573  quotes (``' and `'') are used instead of the void arguments.  quotes (``' and `'') are used instead of the void arguments.
1574    
# Line 1606  the quoting mechanism. Line 1613  the quoting mechanism.
1613    
1614  File: m4.info,  Node: Changecom,  Next: Changeword,  Prev: Changequote,  Up: Input Control  File: m4.info,  Node: Changecom,  Next: Changeword,  Prev: Changequote,  Up: Input Control
1615    
1616  7.3 Changing comment delimiters  Changing comment delimiters
1617  ===============================  ===========================
1618    
1619  The default comment delimiters can be changed with the builtin macro  The default comment delimiters can be changed with the builtin macro
1620  `changecom':  `changecom':
1621    
1622       changecom(opt START, opt END)       changecom(opt START, opt END)
1623     where START is the new start-comment delimiter and END is the new  
1624    where START is the new start-comment delimiter and END is the new
1625  end-comment delimiter.  If any of the arguments are void, the default  end-comment delimiter.  If any of the arguments are void, the default
1626  comment delimiters (`#' and newline) are used instead of the void  comment delimiters (`#' and newline) are used instead of the void
1627  arguments.  The comment delimiters can be of any length.  arguments.  The comment delimiters can be of any length.
# Line 1648  mechanism completely. Line 1656  mechanism completely.
1656    
1657  File: m4.info,  Node: Changeword,  Next: M4wrap,  Prev: Changecom,  Up: Input Control  File: m4.info,  Node: Changeword,  Next: M4wrap,  Prev: Changecom,  Up: Input Control
1658    
1659  7.4 Changing the lexical structure of words  Changing the lexical structure of words
1660  ===========================================  =======================================
1661    
1662       The macro `changeword' and all associated functionnality is       The macro `changeword' and all associated functionnality is
1663       experimental.  It is only available if the `--enable-changeword'       experimental.  It is only available if the `--enable-changeword'
# Line 1734  factor of about seven. Line 1742  factor of about seven.
1742    
1743  File: m4.info,  Node: M4wrap,  Prev: Changeword,  Up: Input Control  File: m4.info,  Node: M4wrap,  Prev: Changeword,  Up: Input Control
1744    
1745  7.5 Saving input  Saving input
1746  ================  ============
1747    
1748  It is possible to `save' some text until the end of the normal input has  It is possible to `save' some text until the end of the normal input has
1749  been seen.  Text can be saved, to be read again by `m4' when the normal  been seen.  Text can be saved, to be read again by `m4' when the normal
# Line 1745  cleanup actions before normal exit, e.g. Line 1753  cleanup actions before normal exit, e.g.
1753     To save input text, use the builtin `m4wrap':     To save input text, use the builtin `m4wrap':
1754    
1755       m4wrap(STRING, ...)       m4wrap(STRING, ...)
1756     which stores STRING and the rest of the arguments in a safe place,  
1757  to be reread when end of input is reached.  which stores STRING and the rest of the arguments in a safe place, to
1758    be reread when end of input is reached.
1759    
1760       define(`cleanup', `This is the `cleanup' actions.       define(`cleanup', `This is the `cleanup' actions.
1761       ')       ')
# Line 1769  in which they were saved (LIFO--last in, Line 1778  in which they were saved (LIFO--last in,
1778    
1779  File: m4.info,  Node: File Inclusion,  Next: Diversions,  Prev: Input Control,  Up: Top  File: m4.info,  Node: File Inclusion,  Next: Diversions,  Prev: Input Control,  Up: Top
1780    
1781  8 File inclusion  File inclusion
1782  ****************  **************
1783    
1784  `m4' allows you to include named files at any point in the input.  `m4' allows you to include named files at any point in the input.
1785    
# Line 1782  File: m4.info,  Node: File Inclusion,  N Line 1791  File: m4.info,  Node: File Inclusion,  N
1791    
1792  File: m4.info,  Node: Include,  Next: Search Path,  Prev: File Inclusion,  Up: File Inclusion  File: m4.info,  Node: Include,  Next: Search Path,  Prev: File Inclusion,  Up: File Inclusion
1793    
1794  8.1 Including named files  Including named files
1795  =========================  =====================
1796    
1797  There are two builtin macros in `m4' for including files:  There are two builtin macros in `m4' for including files:
1798    
# Line 1811  include a file, if it exists, expanding Line 1820  include a file, if it exists, expanding
1820       Include file start       Include file start
1821       foo       foo
1822       Include file end       Include file end
1823     Normally file inclusion is used to insert the contents of a file  
1824  into the input stream.  The contents of the file will be read by `m4'  Normally file inclusion is used to insert the contents of a file into
1825  and macro calls in the file will be expanded:  the input stream.  The contents of the file will be read by `m4' and
1826    macro calls in the file will be expanded:
1827    
1828       define(`foo', `FOO')       define(`foo', `FOO')
1829       =>       =>
# Line 1846  given arguments. Line 1856  given arguments.
1856    
1857  File: m4.info,  Node: Search Path,  Prev: Include,  Up: File Inclusion  File: m4.info,  Node: Search Path,  Prev: Include,  Up: File Inclusion
1858    
1859  8.2 Searching for include files  Searching for include files
1860  ===============================  ===========================
1861    
1862  GNU `m4' allows included files to be found in other directories than  GNU `m4' allows included files to be found in other directories than
1863  the current working directory.  the current working directory.
# Line 1865  debug flag (*note Debug Levels::) can he Line 1875  debug flag (*note Debug Levels::) can he
1875    
1876  File: m4.info,  Node: Diversions,  Next: Text handling,  Prev: File Inclusion,  Up: Top  File: m4.info,  Node: Diversions,  Next: Text handling,  Prev: File Inclusion,  Up: Top
1877    
1878  9 Diverting and undiverting output  Diverting and undiverting output
1879  **********************************  ********************************
1880    
1881  Diversions are a way of temporarily saving output.  The output of `m4'  Diversions are a way of temporarily saving output.  The output of `m4'
1882  can at any time be diverted to a temporary file, and be reinserted into  can at any time be diverted to a temporary file, and be reinserted into
# Line 1893  number of available file descriptors. Line 1903  number of available file descriptors.
1903    
1904  File: m4.info,  Node: Divert,  Next: Undivert,  Prev: Diversions,  Up: Diversions  File: m4.info,  Node: Divert,  Next: Undivert,  Prev: Diversions,  Up: Diversions
1905    
1906  9.1 Diverting output  Diverting output
1907  ====================  ================
1908    
1909  Output is diverted using `divert':  Output is diverted using `divert':
1910    
# Line 1937  definitions.  Here is how to avoid them. Line 1947  definitions.  Here is how to avoid them.
1947    
1948  File: m4.info,  Node: Undivert,  Next: Divnum,  Prev: Divert,  Up: Diversions  File: m4.info,  Node: Undivert,  Next: Divnum,  Prev: Divert,  Up: Diversions
1949    
1950  9.2 Undiverting output  Undiverting output
1951  ======================  ==================
1952    
1953  Diverted text can be undiverted explicitly using the builtin `undivert':  Diverted text can be undiverted explicitly using the builtin `undivert':
1954    
# Line 2005  contains the word `bar': Line 2015  contains the word `bar':
2015    
2016  File: m4.info,  Node: Divnum,  Next: Cleardiv,  Prev: Undivert,  Up: Diversions  File: m4.info,  Node: Divnum,  Next: Cleardiv,  Prev: Undivert,  Up: Diversions
2017    
2018  9.3 Diversion numbers  Diversion numbers
2019  =====================  =================
2020    
2021  The builtin `divnum':  The builtin `divnum':
2022    
# Line 2034  undiverted text would otherwise be diver Line 2044  undiverted text would otherwise be diver
2044    
2045  File: m4.info,  Node: Cleardiv,  Prev: Divnum,  Up: Diversions  File: m4.info,  Node: Cleardiv,  Prev: Divnum,  Up: Diversions
2046    
2047  9.4 Discarding diverted text  Discarding diverted text
2048  ============================  ========================
2049    
2050  Often it is not known, when output is diverted, whether the diverted  Often it is not known, when output is diverted, whether the diverted
2051  text is actually needed.  Since all non-empty diversion are brought back  text is actually needed.  Since all non-empty diversion are brought back
# Line 2067  should try to see if you can find it and Line 2077  should try to see if you can find it and
2077    
2078  File: m4.info,  Node: Text handling,  Next: Arithmetic,  Prev: Diversions,  Up: Top  File: m4.info,  Node: Text handling,  Next: Arithmetic,  Prev: Diversions,  Up: Top
2079    
2080  10 Macros for text handling  Macros for text handling
2081  ***************************  ************************
2082    
2083  There are a number of builtins in `m4' for manipulating text in various  There are a number of builtins in `m4' for manipulating text in various
2084  ways, extracting substrings, searching, substituting, and so on.  ways, extracting substrings, searching, substituting, and so on.
# Line 2086  ways, extracting substrings, searching, Line 2096  ways, extracting substrings, searching,
2096    
2097  File: m4.info,  Node: Len,  Next: Index,  Prev: Text handling,  Up: Text handling  File: m4.info,  Node: Len,  Next: Index,  Prev: Text handling,  Up: Text handling
2098    
2099  10.1 Calculating length of strings  Calculating length of strings
2100  ==================================  =============================
2101    
2102  The length of a string can be calculated by `len':  The length of a string can be calculated by `len':
2103    
# Line 2105  which expands to the length of STRING, a Line 2115  which expands to the length of STRING, a
2115    
2116  File: m4.info,  Node: Index,  Next: Regexp,  Prev: Len,  Up: Text handling  File: m4.info,  Node: Index,  Next: Regexp,  Prev: Len,  Up: Text handling
2117    
2118  10.2 Searching for substrings  Searching for substrings
2119  =============================  ========================
2120    
2121  Searching for substrings is done with `index':  Searching for substrings is done with `index':
2122    
# Line 2126  not occur in STRING, `index' expands to Line 2136  not occur in STRING, `index' expands to
2136    
2137  File: m4.info,  Node: Regexp,  Next: Substr,  Prev: Index,  Up: Text handling  File: m4.info,  Node: Regexp,  Next: Substr,  Prev: Index,  Up: Text handling
2138    
2139  10.3 Searching for regular expressions  Searching for regular expressions
2140  ======================================  =================================
2141    
2142  Searching for regular expressions is done with the builtin `regexp':  Searching for regular expressions is done with the builtin `regexp':
2143    
# Line 2159  regular expression matched. Line 2169  regular expression matched.
2169    
2170  File: m4.info,  Node: Substr,  Next: Translit,  Prev: Regexp,  Up: Text handling  File: m4.info,  Node: Substr,  Next: Translit,  Prev: Regexp,  Up: Text handling
2171    
2172  10.4 Extracting substrings  Extracting substrings
2173  ==========================  =====================
2174    
2175  Substrings are extracted with `substr':  Substrings are extracted with `substr':
2176    
# Line 2180  is omitted.  The starting index of a str Line 2190  is omitted.  The starting index of a str
2190    
2191  File: m4.info,  Node: Translit,  Next: Patsubst,  Prev: Substr,  Up: Text handling  File: m4.info,  Node: Translit,  Next: Patsubst,  Prev: Substr,  Up: Text handling
2192    
2193  10.5 Translating characters  Translating characters
2194  ===========================  ======================
2195    
2196  Character translation is done with `translit':  Character translation is done with `translit':
2197    
# Line 2219  most common. Line 2229  most common.
2229    
2230  File: m4.info,  Node: Patsubst,  Next: Format,  Prev: Translit,  Up: Text handling  File: m4.info,  Node: Patsubst,  Next: Format,  Prev: Translit,  Up: Text handling
2231    
2232  10.6 Substituting text by regular expression  Substituting text by regular expression
2233  ============================================  =======================================
2234    
2235  Global substitution in a string is done by `patsubst':  Global substitution in a string is done by `patsubst':
2236    
2237       patsubst(STRING, REGEXP, opt REPLACEMENT)       patsubst(STRING, REGEXP, opt REPLACEMENT)
2238     which searches STRING for matches of REGEXP, and substitutes  
2239    which searches STRING for matches of REGEXP, and substitutes
2240  REPLACEMENT for each match.  The syntax for regular expressions is the  REPLACEMENT for each match.  The syntax for regular expressions is the
2241  same as in GNU Emacs.  same as in GNU Emacs.
2242    
# Line 2273  individual word or whole sentences, by s Line 2284  individual word or whole sentences, by s
2284    
2285  File: m4.info,  Node: Format,  Prev: Patsubst,  Up: Text handling  File: m4.info,  Node: Format,  Prev: Patsubst,  Up: Text handling
2286    
2287  10.7 Formatted output  Formatted output
2288  =====================  ================
2289    
2290  Formatted output can be made with `format':  Formatted output can be made with `format':
2291    
# Line 2316  the functioning of `printf', see the C L Line 2327  the functioning of `printf', see the C L
2327    
2328  File: m4.info,  Node: Arithmetic,  Next: UNIX commands,  Prev: Text handling,  Up: Top  File: m4.info,  Node: Arithmetic,  Next: UNIX commands,  Prev: Text handling,  Up: Top
2329    
2330  11 Macros for doing arithmetic  Macros for doing arithmetic
2331  ******************************  ***************************
2332    
2333  Integer arithmetic is included in `m4', with a C-like syntax.  As  Integer arithmetic is included in `m4', with a C-like syntax.  As
2334  convenient shorthands, there are builtins for simple increment and  convenient shorthands, there are builtins for simple increment and
# Line 2331  decrement operations. Line 2342  decrement operations.
2342    
2343  File: m4.info,  Node: Incr,  Next: Eval,  Prev: Arithmetic,  Up: Arithmetic  File: m4.info,  Node: Incr,  Next: Eval,  Prev: Arithmetic,  Up: Arithmetic
2344    
2345  11.1 Decrement and increment operators  Decrement and increment operators
2346  ======================================  =================================
2347    
2348  Increment and decrement of integers are supported using the builtins  Increment and decrement of integers are supported using the builtins
2349  `incr' and `decr':  `incr' and `decr':
# Line 2354  arguments. Line 2365  arguments.
2365    
2366  File: m4.info,  Node: Eval,  Prev: Incr,  Up: Arithmetic  File: m4.info,  Node: Eval,  Prev: Incr,  Up: Arithmetic
2367    
2368  11.2 Evaluating integer expressions  Evaluating integer expressions
2369  ===================================  ==============================
2370    
2371  Integer expressions are evaluated with `eval':  Integer expressions are evaluated with `eval':
2372    
# Line 2475  requested width. Line 2486  requested width.
2486    
2487  File: m4.info,  Node: UNIX commands,  Next: Miscellaneous,  Prev: Arithmetic,  Up: Top  File: m4.info,  Node: UNIX commands,  Next: Miscellaneous,  Prev: Arithmetic,  Up: Top
2488    
2489  12 Running UNIX commands  Running UNIX commands
2490  ************************  *********************
2491    
2492  There are a few builtin macros in `m4' that allow you to run UNIX  There are a few builtin macros in `m4' that allow you to run UNIX
2493  commands from within `m4'.  commands from within `m4'.
# Line 2491  commands from within `m4'. Line 2502  commands from within `m4'.
2502    
2503  File: m4.info,  Node: Syscmd,  Next: Esyscmd,  Prev: UNIX commands,  Up: UNIX commands  File: m4.info,  Node: Syscmd,  Next: Esyscmd,  Prev: UNIX commands,  Up: UNIX commands
2504    
2505  12.1 Executing simple commands  Executing simple commands
2506  ==============================  =========================
2507    
2508  Any shell command can be executed, using `syscmd':  Any shell command can be executed, using `syscmd':
2509    
# Line 2514  same as those of `m4'. Line 2525  same as those of `m4'.
2525    
2526  File: m4.info,  Node: Esyscmd,  Next: Sysval,  Prev: Syscmd,  Up: UNIX commands  File: m4.info,  Node: Esyscmd,  Next: Sysval,  Prev: Syscmd,  Up: UNIX commands
2527    
2528  12.2 Reading the output of commands  Reading the output of commands
2529  ===================================  ==============================
2530    
2531  If you want `m4' to read the output of a UNIX command, use `esyscmd':  If you want `m4' to read the output of a UNIX command, use `esyscmd':
2532    
# Line 2544  distribution, then: Line 2555  distribution, then:
2555    
2556  File: m4.info,  Node: Sysval,  Next: Maketemp,  Prev: Esyscmd,  Up: UNIX commands  File: m4.info,  Node: Sysval,  Next: Maketemp,  Prev: Esyscmd,  Up: UNIX commands
2557    
2558  12.3 Exit codes  Exit codes
2559  ===============  ==========
2560    
2561  To see whether a shell command succeeded, use `sysval':  To see whether a shell command succeeded, use `sysval':
2562    
# Line 2566  which expands to the exit status of the Line 2577  which expands to the exit status of the
2577    
2578  File: m4.info,  Node: Maketemp,  Prev: Sysval,  Up: UNIX commands  File: m4.info,  Node: Maketemp,  Prev: Sysval,  Up: UNIX commands
2579    
2580  12.4 Making names for temporary files  Making names for temporary files
2581  =====================================  ================================
2582    
2583  Commands specified to `syscmd' or `esyscmd' might need a temporary  Commands specified to `syscmd' or `esyscmd' might need a temporary
2584  file, for output or for some other purpose.  There is a builtin macro,  file, for output or for some other purpose.  There is a builtin macro,
# Line 2588  the `m4' process, in order to make the f Line 2599  the `m4' process, in order to make the f
2599    
2600  File: m4.info,  Node: Miscellaneous,  Next: Frozen files,  Prev: UNIX commands,  Up: Top  File: m4.info,  Node: Miscellaneous,  Next: Frozen files,  Prev: UNIX commands,  Up: Top
2601    
2602  13 Miscellaneous builtin macros  Miscellaneous builtin macros
2603  *******************************  ****************************
2604    
2605  This chapter describes various builtins, that do not really belong in  This chapter describes various builtins, that do not really belong in
2606  any of the previous chapters.  any of the previous chapters.
# Line 2602  any of the previous chapters. Line 2613  any of the previous chapters.
2613    
2614  File: m4.info,  Node: Errprint,  Next: M4exit,  Prev: Miscellaneous,  Up: Miscellaneous  File: m4.info,  Node: Errprint,  Next: M4exit,  Prev: Miscellaneous,  Up: Miscellaneous
2615    
2616  13.1 Printing error messages  Printing error messages
2617  ============================  =======================
2618    
2619  You can print error messages using `errprint':  You can print error messages using `errprint':
2620    
2621       errprint(MESSAGE, ...)       errprint(MESSAGE, ...)
2622     which simply prints MESSAGE and the rest of the arguments on the  
2623    which simply prints MESSAGE and the rest of the arguments on the
2624  standard error output.  standard error output.
2625    
2626     The expansion of `errprint' is void.     The expansion of `errprint' is void.
# Line 2627  utility builtins exist: Line 2639  utility builtins exist:
2639    
2640       __file__       __file__
2641       __line__       __line__
2642     which expands to the quoted name of the current input file, and the  
2643    which expands to the quoted name of the current input file, and the
2644  current input line number in that file.  current input line number in that file.
2645    
2646       errprint(`m4:'__file__:__line__: `Input error       errprint(`m4:'__file__:__line__: `Input error
# Line 2638  current input line number in that file. Line 2651  current input line number in that file.
2651    
2652  File: m4.info,  Node: M4exit,  Prev: Errprint,  Up: Miscellaneous  File: m4.info,  Node: M4exit,  Prev: Errprint,  Up: Miscellaneous
2653    
2654  13.2 Exiting from `m4'  Exiting from `m4'
2655  ======================  =================
2656    
2657  If you need to exit from `m4' before the entire input has been read,  If you need to exit from `m4' before the entire input has been read,
2658  you can use `m4exit':  you can use `m4exit':
2659    
2660       m4exit(opt CODE)       m4exit(opt CODE)
2661     which causes `m4' to exit, with exit code CODE.  If CODE is left  
2662  out, the exit code is zero.  which causes `m4' to exit, with exit code CODE.  If CODE is left out,
2663    the exit code is zero.
2664    
2665       define(`fatal_error', `errprint(`m4: '__file__: __line__`: fatal error: $*       define(`fatal_error', `errprint(`m4: '__file__: __line__`: fatal error: $*
2666       ')m4exit(1)')       ')m4exit(1)')
# Line 2662  not followed, e.g., diverted text is not Line 2676  not followed, e.g., diverted text is not
2676    
2677  File: m4.info,  Node: Frozen files,  Next: Compatibility,  Prev: Miscellaneous,  Up: Top  File: m4.info,  Node: Frozen files,  Next: Compatibility,  Prev: Miscellaneous,  Up: Top
2678    
2679  14 Fast loading of frozen states  Fast loading of frozen states
2680  ********************************  *****************************
2681    
2682  Some bigger `m4' applications may be built over a common base  Some bigger `m4' applications may be built over a common base
2683  containing hundreds of definitions and other costly initializations.  containing hundreds of definitions and other costly initializations.
# Line 2777  decimal.  The directives are: Line 2791  decimal.  The directives are:
2791    
2792  File: m4.info,  Node: Compatibility,  Next: Concept index,  Prev: Frozen files,  Up: Top  File: m4.info,  Node: Compatibility,  Next: Concept index,  Prev: Frozen files,  Up: Top
2793    
2794  15 Compatibility with other versions of `m4'  Compatibility with other versions of `m4'
2795  ********************************************  *****************************************
2796    
2797  This chapter describes the differences between this implementation of  This chapter describes the differences between this implementation of
2798  `m4', and the implementation found under UNIX, notably System V,  `m4', and the implementation found under UNIX, notably System V,
# Line 2796  made to summarize these here. Line 2810  made to summarize these here.
2810    
2811  File: m4.info,  Node: Extensions,  Next: Incompatibilities,  Prev: Compatibility,  Up: Compatibility  File: m4.info,  Node: Extensions,  Next: Incompatibilities,  Prev: Compatibility,  Up: Compatibility
2812    
2813  15.1 Extensions in GNU `m4'  Extensions in GNU `m4'
2814  ===========================  ======================
2815    
2816  This version of `m4' contains a few facilities, that do not exist in  This version of `m4' contains a few facilities, that do not exist in
2817  System V `m4'.  These extra facilities are all suppressed by using the  System V `m4'.  These extra facilities are all suppressed by using the
# Line 2854  extensive than in most other versions of Line 2868  extensive than in most other versions of
2868    
2869  File: m4.info,  Node: Incompatibilities,  Next: Other Incompat,  Prev: Extensions,  Up: Compatibility  File: m4.info,  Node: Incompatibilities,  Next: Other Incompat,  Prev: Extensions,  Up: Compatibility
2870    
2871  15.2 Facilities in System V `m4' not in GNU `m4'  Facilities in System V `m4' not in GNU `m4'
2872  ================================================  ===========================================
2873    
2874  The version of `m4' from System V contains a few facilities that have  The version of `m4' from System V contains a few facilities that have
2875  not been implemented in GNU `m4' yet.  not been implemented in GNU `m4' yet.
# Line 2866  not been implemented in GNU `m4' yet. Line 2880  not been implemented in GNU `m4' yet.
2880    
2881  File: m4.info,  Node: Other Incompat,  Prev: Incompatibilities,  Up: Compatibility  File: m4.info,  Node: Other Incompat,  Prev: Incompatibilities,  Up: Compatibility
2882    
2883  15.3 Other incompatibilities  Other incompatibilities
2884  ============================  =======================
2885    
2886  There are a few other incompatibilities between this implementation of  There are a few other incompatibilities between this implementation of
2887  `m4', and the System V version.  `m4', and the System V version.
# Line 2920  File: m4.info,  Node: Concept index,  Ne Line 2934  File: m4.info,  Node: Concept index,  Ne
2934  Concept index  Concept index
2935  *************  *************
2936    
 [index]  
2937  * Menu:  * Menu:
2938    
2939  * arguments to macros:                   Macro Arguments.     (line   6)  * Arguments to macros:                   Arguments.
2940  * Arguments to macros:                   Arguments.           (line   6)  * arguments to macros:                   Macro Arguments.
2941  * arguments to macros, special:          Pseudo Arguments.    (line   6)  * arguments to macros, special:          Pseudo Arguments.
2942  * arguments, quoted macro:               Quoting Arguments.   (line   6)  * arguments, quoted macro:               Quoting Arguments.
2943  * arithmetic:                            Arithmetic.          (line   6)  * arithmetic:                            Arithmetic.
2944  * builtins, indirect call of:            Builtin.             (line   6)  * builtins, indirect call of:            Builtin.
2945  * call of builtins, indirect:            Builtin.             (line   6)  * call of builtins, indirect:            Builtin.
2946  * call of macros, indirect:              Indir.               (line   6)  * call of macros, indirect:              Indir.
2947  * changing comment delimiters:           Changecom.           (line   6)  * changing comment delimiters:           Changecom.
2948  * changing the quote delimiters:         Changequote.         (line   6)  * changing the quote delimiters:         Changequote.
2949  * characters, translating:               Translit.            (line   6)  * characters, translating:               Translit.
2950  * command line, filenames on the:        Invoking m4.         (line 176)  * command line, filenames on the:        Invoking m4.
2951  * command line, macro definitions on the: Invoking m4.        (line 143)  * command line, macro definitions on the: Invoking m4.
2952  * command line, options:                 Invoking m4.         (line  10)  * command line, options:                 Invoking m4.
2953  * commands, exit code from UNIX:         Sysval.              (line   6)  * commands, exit code from UNIX:         Sysval.
2954  * commands, running UNIX:                UNIX commands.       (line   6)  * commands, running UNIX:                UNIX commands.
2955  * comment delimiters, changing:          Changecom.           (line   6)  * comment delimiters, changing:          Changecom.
2956  * comments:                              Comments.            (line   6)  * comments:                              Comments.
2957  * comments, copied to output:            Changecom.           (line  28)  * comments, copied to output:            Changecom.
2958  * comparing strings:                     Ifelse.              (line   6)  * comparing strings:                     Ifelse.
2959  * compatibility:                         Compatibility.       (line   6)  * compatibility:                         Compatibility.
2960  * conditionals:                          Ifdef.               (line   6)  * conditionals:                          Ifdef.
2961  * controlling debugging output:          Debug Levels.        (line   6)  * controlling debugging output:          Debug Levels.
2962  * counting loops:                        Loops.               (line  42)  * counting loops:                        Loops.
2963  * debugging output, controlling:         Debug Levels.        (line   6)  * debugging output, controlling:         Debug Levels.
2964  * debugging output, saving:              Debug Output.        (line   6)  * debugging output, saving:              Debug Output.
2965  * decrement operator:                    Incr.                (line   6)  * decrement operator:                    Incr.
2966  * defining new macros:                   Definitions.         (line   6)  * defining new macros:                   Definitions.
2967  * definitions, displaying macro:         Dumpdef.             (line   6)  * definitions, displaying macro:         Dumpdef.
2968  * deleting macros:                       Undefine.            (line   6)  * deleting macros:                       Undefine.
2969  * deleting whitespace in input:          Dnl.                 (line   6)  * deleting whitespace in input:          Dnl.
2970  * discarding diverted text:              Cleardiv.            (line   6)  * discarding diverted text:              Cleardiv.
2971  * displaying macro definitions:          Dumpdef.             (line   6)  * displaying macro definitions:          Dumpdef.
2972  * diversion numbers:                     Divnum.              (line   6)  * diversion numbers:                     Divnum.
2973  * diverted text, discarding:             Cleardiv.            (line   6)  * diverted text, discarding:             Cleardiv.
2974  * diverting output to files:             Divert.              (line   6)  * diverting output to files:             Divert.
2975  * dumping into frozen file:              Frozen files.        (line   6)  * dumping into frozen file:              Frozen files.
2976  * error messages, printing:              Errprint.            (line   6)  * error messages, printing:              Errprint.
2977  * evaluation, of integer expressions:    Eval.                (line   6)  * evaluation, of integer expressions:    Eval.
2978  * executing UNIX commands:               UNIX commands.       (line   6)  * executing UNIX commands:               UNIX commands.
2979  * exit code from UNIX commands:          Sysval.              (line   6)  * exit code from UNIX commands:          Sysval.
2980  * exiting from m4:                       M4exit.              (line   6)  * exiting from m4:                       M4exit.
2981  * expansion of macros:                   Macro expansion.     (line   6)  * expansion of macros:                   Macro expansion.
2982  * expansion, tracing macro:              Trace.               (line   6)  * expansion, tracing macro:              Trace.
2983  * expressions, evaluation of integer:    Eval.                (line   6)  * expressions, evaluation of integer:    Eval.
2984  * extracting substrings:                 Substr.              (line   6)  * extracting substrings:                 Substr.
2985  * fast loading of frozen files:          Frozen files.        (line   6)  * fast loading of frozen files:          Frozen files.
2986  * file inclusion <1>:                    Undivert.            (line  53)  * file inclusion <1>:                    Undivert.
2987  * file inclusion:                        File Inclusion.      (line   6)  * file inclusion:                        File Inclusion.
2988  * filenames, on the command line:        Invoking m4.         (line 176)  * filenames, on the command line:        Invoking m4.
2989  * files, diverting output to:            Divert.              (line   6)  * files, diverting output to:            Divert.
2990  * files, names of temporary:             Maketemp.            (line   6)  * files, names of temporary:             Maketemp.
2991  * forloops:                              Loops.               (line  42)  * forloops:                              Loops.
2992  * formatted output:                      Format.              (line   6)  * formatted output:                      Format.
2993  * frozen files for fast loading:         Frozen files.        (line   6)  * frozen files for fast loading:         Frozen files.
2994  * GNU extensions <1>:                    Undivert.            (line  53)  * GNU extensions <1>:                    Extensions.
2995  * GNU extensions <2>:                    Patsubst.            (line   6)  * GNU extensions <2>:                    Frozen files.
2996  * GNU extensions <3>:                    Extensions.          (line   6)  * GNU extensions <3>:                    Esyscmd.
2997  * GNU extensions <4>:                    Search Path.         (line   6)  * GNU extensions <4>:                    Format.
2998  * GNU extensions <5>:                    Frozen files.        (line   6)  * GNU extensions <5>:                    Patsubst.
2999  * GNU extensions <6>:                    Indir.               (line   6)  * GNU extensions <6>:                    Regexp.
3000  * GNU extensions <7>:                    Regexp.              (line   6)  * GNU extensions <7>:                    Undivert.
3001  * GNU extensions <8>:                    Debug Output.        (line   6)  * GNU extensions <8>:                    Search Path.
3002  * GNU extensions <9>:                    Debug Levels.        (line  59)  * GNU extensions <9>:                    Debug Output.
3003  * GNU extensions <10>:                   Builtin.             (line   6)  * GNU extensions <10>:                   Debug Levels.
3004  * GNU extensions <11>:                   Format.              (line   6)  * GNU extensions <11>:                   Builtin.
3005  * GNU extensions <12>:                   Esyscmd.             (line   6)  * GNU extensions <12>:                   Indir.
3006  * GNU extensions:                        Arguments.           (line  28)  * GNU extensions:                        Arguments.
3007  * included files, search path for:       Search Path.         (line   6)  * included files, search path for:       Search Path.
3008  * inclusion, of files <1>:               File Inclusion.      (line   6)  * inclusion, of files <1>:               Undivert.
3009  * inclusion, of files:                   Undivert.            (line  53)  * inclusion, of files:                   File Inclusion.
3010  * increment operator:                    Incr.                (line   6)  * increment operator:                    Incr.
3011  * indirect call of builtins:             Builtin.             (line   6)  * indirect call of builtins:             Builtin.
3012  * indirect call of macros:               Indir.               (line   6)  * indirect call of macros:               Indir.
3013  * initialization, frozen states:         Frozen files.        (line   6)  * initialization, frozen states:         Frozen files.
3014  * input tokens:                          Syntax.              (line   6)  * input tokens:                          Syntax.
3015  * input, saving:                         M4wrap.              (line   6)  * input, saving:                         M4wrap.
3016  * integer arithmetic:                    Arithmetic.          (line   6)  * integer arithmetic:                    Arithmetic.
3017  * integer expression evaluation:         Eval.                (line   6)  * integer expression evaluation:         Eval.
3018  * length of strings:                     Len.                 (line   6)  * length of strings:                     Len.
3019  * lexical structure of words:            Changeword.          (line   6)  * lexical structure of words:            Changeword.
3020  * loops:                                 Loops.               (line  10)  * loops:                                 Loops.
3021  * loops, counting:                       Loops.               (line  42)  * loops, counting:                       Loops.
3022  * macro definitions, on the command line: Invoking m4.        (line 143)  * macro definitions, on the command line: Invoking m4.
3023  * macro expansion, tracing:              Trace.               (line   6)  * macro expansion, tracing:              Trace.
3024  * macro invocation:                      Invocation.          (line   6)  * macro invocation:                      Invocation.
3025  * macros, arguments to <1>:              Arguments.           (line   6)  * macros, arguments to <1>:              Arguments.
3026  * macros, arguments to:                  Macro Arguments.     (line   6)  * macros, arguments to:                  Macro Arguments.
3027  * macros, displaying definitions:        Dumpdef.             (line   6)  * macros, displaying definitions:        Dumpdef.
3028  * macros, expansion of:                  Macro expansion.     (line   6)  * macros, expansion of:                  Macro expansion.
3029  * macros, how to define new:             Definitions.         (line   6)  * macros, how to define new:             Definitions.
3030  * macros, how to delete:                 Undefine.            (line   6)  * macros, how to delete:                 Undefine.
3031  * macros, how to rename:                 Defn.                (line   6)  * macros, how to rename:                 Defn.
3032  * macros, indirect call of:              Indir.               (line   6)  * macros, indirect call of:              Indir.
3033  * macros, quoted arguments to:           Quoting Arguments.   (line   6)  * macros, quoted arguments to:           Quoting Arguments.
3034  * macros, recursive:                     Loops.               (line   6)  * macros, recursive:                     Loops.
3035  * macros, special arguments to:          Pseudo Arguments.    (line   6)  * macros, special arguments to:          Pseudo Arguments.
3036  * macros, temporary redefinition of:     Pushdef.             (line   6)  * macros, temporary redefinition of:     Pushdef.
3037  * messages, printing error:              Errprint.            (line   6)  * messages, printing error:              Errprint.
3038  * multibranches:                         Ifelse.              (line  33)  * multibranches:                         Ifelse.
3039  * names:                                 Names.               (line   6)  * names:                                 Names.
3040  * options, command line:                 Invoking m4.         (line  10)  * options, command line:                 Invoking m4.
3041  * output, diverting to files:            Divert.              (line   6)  * output, diverting to files:            Divert.
3042  * output, formatted:                     Format.              (line   6)  * output, formatted:                     Format.
3043  * output, saving debugging:              Debug Output.        (line   6)  * output, saving debugging:              Debug Output.
3044  * pattern substitution:                  Patsubst.            (line   6)  * pattern substitution:                  Patsubst.
3045  * printing error messages:               Errprint.            (line   6)  * printing error messages:               Errprint.
3046  * quote delimiters, changing the:        Changequote.         (line   6)  * quote delimiters, changing the:        Changequote.
3047  * quoted macro arguments:                Quoting Arguments.   (line   6)  * quoted macro arguments:                Quoting Arguments.
3048  * quoted string:                         Quoted strings.      (line   6)  * quoted string:                         Quoted strings.
3049  * recursive macros:                      Loops.               (line   6)  * recursive macros:                      Loops.
3050  * redefinition of macros, temporary:     Pushdef.             (line   6)  * redefinition of macros, temporary:     Pushdef.
3051  * regular expressions <1>:               Patsubst.            (line   6)  * regular expressions <1>:               Patsubst.
3052  * regular expressions:                   Regexp.              (line   6)  * regular expressions:                   Regexp.
3053  * reloading a frozen file:               Frozen files.        (line   6)  * reloading a frozen file:               Frozen files.
3054  * renaming macros:                       Defn.                (line   6)  * renaming macros:                       Defn.
3055  * running UNIX commands:                 UNIX commands.       (line   6)  * running UNIX commands:                 UNIX commands.
3056  * saving debugging output:               Debug Output.        (line   6)  * saving debugging output:               Debug Output.
3057  * saving input:                          M4wrap.              (line   6)  * saving input:                          M4wrap.
3058  * search path for included files:        Search Path.         (line   6)  * search path for included files:        Search Path.
3059  * special arguments to macros:           Pseudo Arguments.    (line   6)  * special arguments to macros:           Pseudo Arguments.
3060  * strings, length of:                    Len.                 (line   6)  * strings, length of:                    Len.
3061  * substitution by regular expression:    Patsubst.            (line   6)  * substitution by regular expression:    Patsubst.
3062  * substrings, extracting:                Substr.              (line   6)  * substrings, extracting:                Substr.
3063  * temporary filenames:                   Maketemp.            (line   6)  * temporary filenames:                   Maketemp.
3064  * temporary redefinition of macros:      Pushdef.             (line   6)  * temporary redefinition of macros:      Pushdef.
3065  * tokens:                                Syntax.              (line   6)  * tokens:                                Syntax.
3066  * tracing macro expansion:               Trace.               (line   6)  * tracing macro expansion:               Trace.
3067  * translating characters:                Translit.            (line   6)  * translating characters:                Translit.
3068  * undefining macros:                     Undefine.            (line   6)  * undefining macros:                     Undefine.
3069  * UNIX commands, exit code from:         Sysval.              (line   6)  * UNIX commands, exit code from:         Sysval.
3070  * UNIX commands, running:                UNIX commands.       (line   6)  * UNIX commands, running:                UNIX commands.
3071  * words, lexical structure of:           Changeword.          (line   6)  * words, lexical structure of:           Changeword.
3072    
3073    
3074  File: m4.info,  Node: Macro index,  Prev: Concept index,  Up: Top  File: m4.info,  Node: Macro index,  Prev: Concept index,  Up: Top
# Line 3067  References are exclusively to the places Line 3080  References are exclusively to the places
3080  the first time.  Names starting and ending with `__' have these  the first time.  Names starting and ending with `__' have these
3081  characters removed in the index.  characters removed in the index.
3082    
 [index]  
3083  * Menu:  * Menu:
3084    
3085  * builtin:                               Builtin.              (line  6)  * builtin:                               Builtin.
3086  * changecom:                             Changecom.            (line  6)  * changecom:                             Changecom.
3087  * changequote:                           Changequote.          (line  6)  * changequote:                           Changequote.
3088  * changeword:                            Changeword.           (line  6)  * changeword:                            Changeword.
3089  * debugfile:                             Debug Output.         (line  6)  * debugfile:                             Debug Output.
3090  * debugmode:                             Debug Levels.         (line 59)  * debugmode:                             Debug Levels.
3091  * decr:                                  Incr.                 (line  6)  * decr:                                  Incr.
3092  * define:                                Define.               (line  6)  * define:                                Define.
3093  * defn:                                  Defn.                 (line  6)  * defn:                                  Defn.
3094  * divert:                                Divert.               (line  6)  * divert:                                Divert.
3095  * divnum:                                Divnum.               (line  6)  * divnum:                                Divnum.
3096  * dnl:                                   Dnl.                  (line  6)  * dnl:                                   Dnl.
3097  * dumpdef:                               Dumpdef.              (line  6)  * dumpdef:                               Dumpdef.
3098  * errprint:                              Errprint.             (line  6)  * errprint:                              Errprint.
3099  * esyscmd:                               Esyscmd.              (line  6)  * esyscmd:                               Esyscmd.
3100  * eval:                                  Eval.                 (line  6)  * eval:                                  Eval.
3101  * file:                                  Errprint.             (line 26)  * file:                                  Errprint.
3102  * format:                                Format.               (line  6)  * format:                                Format.
3103  * gnu:                                   Other Incompat.       (line 44)  * gnu:                                   Other Incompat.
3104  * ifdef:                                 Ifdef.                (line  6)  * ifdef:                                 Ifdef.
3105  * ifelse:                                Ifelse.               (line  6)  * ifelse:                                Ifelse.
3106  * include:                               Include.              (line  6)  * include:                               Include.
3107  * incr:                                  Incr.                 (line  6)  * incr:                                  Incr.
3108  * index:                                 Index.                (line  6)  * index:                                 Index.
3109  * indir:                                 Indir.                (line  6)  * indir:                                 Indir.
3110  * len:                                   Len.                  (line  6)  * len:                                   Len.
3111  * line:                                  Errprint.             (line 26)  * line:                                  Errprint.
3112  * m4exit:                                M4exit.               (line  6)  * m4exit:                                M4exit.
3113  * m4wrap:                                M4wrap.               (line  6)  * m4wrap:                                M4wrap.
3114  * maketemp:                              Maketemp.             (line  6)  * maketemp:                              Maketemp.
3115  * patsubst:                              Patsubst.             (line  6)  * patsubst:                              Patsubst.
3116  * popdef:                                Pushdef.              (line  7)  * popdef:                                Pushdef.
3117  * pushdef:                               Pushdef.              (line  7)  * pushdef:                               Pushdef.
3118  * regexp:                                Regexp.               (line  6)  * regexp:                                Regexp.
3119  * shift:                                 Loops.                (line 13)  * shift:                                 Loops.
3120  * sinclude:                              Include.              (line  6)  * sinclude:                              Include.
3121  * substr:                                Substr.               (line  6)  * substr:                                Substr.
3122  * syscmd:                                Syscmd.               (line  6)  * syscmd:                                Syscmd.
3123  * sysval:                                Sysval.               (line  6)  * sysval:                                Sysval.
3124  * traceoff:                              Trace.                (line  6)  * traceoff:                              Trace.
3125  * traceon:                               Trace.                (line  6)  * traceon:                               Trace.
3126  * translit:                              Translit.             (line  6)  * translit:                              Translit.
3127  * undefine:                              Undefine.             (line  6)  * undefine:                              Undefine.
3128  * undivert:                              Undivert.             (line  6)  * undivert:                              Undivert.
3129  * unix:                                  Other Incompat.       (line 47)  * unix:                                  Other Incompat.
3130    
3131    
3132    
3133  Tag Table:  Tag Table:
3134  Node: Top947  Node: Top947
3135  Node: Preliminaries6950  Node: Preliminaries6948
3136  Node: Intro7676  Node: Intro7670
3137  Node: History9290  Node: History9276
3138  Node: Invoking m410216  Node: Invoking m410194
3139  Node: Bugs17017  Node: Bugs16987
3140  Node: Manual18290  Node: Manual18252
3141  Node: Syntax19661  Node: Syntax19615
3142  Node: Names20249  Node: Names20199
3143  Node: Quoted strings20627  Node: Quoted strings20569
3144  Node: Other tokens21217  Node: Other tokens21151
3145  Node: Comments21439  Node: Comments21365
3146  Node: Macros22107  Node: Macros22025
3147  Node: Invocation22601  Node: Invocation22515
3148  Node: Inhibiting Invocation23417  Node: Inhibiting Invocation23323
3149  Node: Macro Arguments26568  Node: Macro Arguments26466
3150  Node: Quoting Arguments27837  Node: Quoting Arguments27727
3151  Node: Macro expansion28647  Node: Macro expansion28529
3152  Node: Definitions29315  Node: Definitions29189
3153  Node: Define30092  Node: Define29962
3154  Node: Arguments30908  Node: Arguments30770
3155  Node: Pseudo Arguments32393  Node: Pseudo Arguments32247
3156  Node: Undefine34249  Node: Undefine34095
3157  Node: Defn34916  Node: Defn34754
3158  Node: Pushdef36078  Node: Pushdef35908
3159  Node: Indir37919  Node: Indir37741
3160  Node: Builtin38688  Node: Builtin38500
3161  Node: Conditionals39139  Node: Conditionals38941
3162  Node: Ifdef39847  Node: Ifdef39645
3163  Node: Ifelse40621  Node: Ifelse40411
3164  Node: Loops42392  Node: Loops42174
3165  Node: Debugging45669  Node: Debugging45443
3166  Node: Dumpdef46249  Node: Dumpdef46019
3167  Node: Trace47103  Node: Trace46865
3168  Node: Debug Levels48488  Node: Debug Levels48242
3169  Node: Debug Output50878  Node: Debug Output50623
3170  Node: Input Control51405  Node: Input Control51140
3171  Node: Dnl51943  Node: Dnl51674
3172  Node: Changequote53075  Node: Changequote52796
3173  Node: Changecom54446  Node: Changecom54157
3174  Node: Changeword55737  Node: Changeword55438
3175  Node: M4wrap58954  Node: M4wrap58647
3176  Node: File Inclusion60163  Node: File Inclusion59846
3177  Node: Include60480  Node: Include60159
3178  Node: Search Path62415  Node: Search Path62084
3179  Node: Diversions63206  Node: Diversions62867
3180  Node: Divert64444  Node: Divert64101
3181  Node: Undivert65581  Node: Undivert65230
3182  Node: Divnum67520  Node: Divnum67161
3183  Node: Cleardiv68070  Node: Cleardiv67703
3184  Node: Text handling69111  Node: Text handling68736
3185  Node: Len69834  Node: Len69453
3186  Node: Index70239  Node: Index69848
3187  Node: Regexp70831  Node: Regexp70430
3188  Node: Substr71929  Node: Substr71518
3189  Node: Translit72556  Node: Translit72135
3190  Node: Patsubst74006  Node: Patsubst73575
3191  Node: Format76106  Node: Format75663
3192  Node: Arithmetic77602  Node: Arithmetic77149
3193  Node: Incr78050  Node: Incr77591
3194  Node: Eval78561  Node: Eval78092
3195  Node: UNIX commands81567  Node: UNIX commands81088
3196  Node: Syscmd82041  Node: Syscmd81556
3197  Node: Esyscmd82762  Node: Esyscmd82267
3198  Node: Sysval83715  Node: Sysval83210
3199  Node: Maketemp84129  Node: Maketemp83614
3200  Node: Miscellaneous84879  Node: Miscellaneous84354
3201  Node: Errprint85251  Node: Errprint84720
3202  Node: M4exit86253  Node: M4exit85708
3203  Node: Frozen files87047  Node: Frozen files86490
3204  Node: Compatibility91970  Node: Compatibility91407
3205  Node: Extensions92591  Node: Extensions92022
3206  Node: Incompatibilities94954  Node: Incompatibilities94375
3207  Node: Other Incompat95403  Node: Other Incompat94814
3208  Node: Concept index97573  Node: Concept index96974
3209  Node: Macro index107424  Node: Macro index103979
3210    
3211  End Tag Table  End Tag Table

Legend:
Removed from v.1.1.1.1.2.3  
changed lines
  Added in v.1.1.1.1.2.4

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26