]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - share/doc/psd/17.m4/m4.ms
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / share / doc / psd / 17.m4 / m4.ms
1 .\" Copyright (C) Caldera International Inc. 2001-2002.  All rights reserved.
2 .\" 
3 .\" Redistribution and use in source and binary forms, with or without
4 .\" modification, are permitted provided that the following conditions are
5 .\" met:
6 .\" 
7 .\" Redistributions of source code and documentation must retain the above
8 .\" copyright notice, this list of conditions and the following
9 .\" disclaimer.
10 .\" 
11 .\" Redistributions in binary form must reproduce the above copyright
12 .\" notice, this list of conditions and the following disclaimer in the
13 .\" documentation and/or other materials provided with the distribution.
14 .\" 
15 .\" All advertising materials mentioning features or use of this software
16 .\" must display the following acknowledgement:
17 .\" 
18 .\" This product includes software developed or owned by Caldera
19 .\" International, Inc.  Neither the name of Caldera International, Inc.
20 .\" nor the names of other contributors may be used to endorse or promote
21 .\" products derived from this software without specific prior written
22 .\" permission.
23 .\" 
24 .\" USE OF THE SOFTWARE PROVIDED FOR UNDER THIS LICENSE BY CALDERA
25 .\" INTERNATIONAL, INC.  AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR
26 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
27 .\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
28 .\" DISCLAIMED.  IN NO EVENT SHALL CALDERA INTERNATIONAL, INC. BE LIABLE
29 .\" FOR ANY DIRECT, INDIRECT INCIDENTAL, SPECIAL, EXEMPLARY, OR
30 .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31 .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
32 .\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
33 .\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
34 .\" OR OTHERWISE) RISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
35 .\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 .\" 
37 .\"     @(#)m4.ms       6.3 (Berkeley) 6/5/93
38 .\"
39 .\" $FreeBSD$
40 .de MH
41 Bell Laboratories, Murray Hill, NJ 07974.
42 ..
43 .EH 'PSD:17-%''The M4 Macro Processor'
44 .OH 'The M4 Macro Processor''PSD:17-%'
45 .if n .ls 2
46 .tr _\(em
47 .tr *\(**
48 .de UC
49 \&\\$3\s-1\\$1\\s0\&\\$2
50 ..
51 .de IT
52 .if n .ul
53 \&\\$3\f2\\$1\fP\&\\$2
54 ..
55 .de UL
56 .if n .ul
57 \&\\$3\f3\\$1\fP\&\\$2
58 ..
59 .de P1
60 .DS I 3n
61 .if n .ls 2
62 .nf
63 .if n .ta 5 10 15 20 25 30 35 40 45 50 55 60
64 .if t .ta .4i .8i 1.2i 1.6i 2i 2.4i 2.8i 3.2i 3.6i 4i 4.4i 4.8i 5.2i 5.6i
65 .if t .tr -\(mi|\(bv'\(fm^\(no*\(**
66 .tr `\(ga'\(aa
67 .if t .tr _\(ul
68 .ft 3
69 .lg 0
70 ..
71 .de P2
72 .ps \\n(PS
73 .vs \\n(VSp
74 .ft R
75 .if n .ls 2
76 .tr --||''^^!!
77 .if t .tr _\(em
78 .fi
79 .lg
80 .DE
81 .if t .tr _\(em
82 ..
83 .hw semi-colon
84 .hw estab-lished
85 .hy 14
86 .               \"2=not last lines; 4= no -xx; 8=no xx-
87 .               \"special chars in programs
88 .       \" start of text
89 .\".RP
90 .\" .....TR 59
91 .\" .....TM 77-1273-6 39199 39199-11
92 .ND "July 1, 1977"
93 .TL
94 The M4 Macro Processor
95 .AU "MH 2C-518" 6021
96 Brian W. Kernighan
97 .AU "MH 2C-517" 3770
98 Dennis M. Ritchie
99 .AI
100 .MH
101 .AB
102 .PP
103 M4 is a macro processor available on
104 .UX
105 and
106 .UC GCOS .
107 Its primary use has been as a
108 front end for Ratfor for those
109 cases where parameterless macros 
110 are not adequately powerful.
111 It has also been used for languages as disparate as C and Cobol.
112 M4 is particularly suited for functional languages like Fortran, PL/I and C
113 since macros are specified in a functional notation.
114 .PP
115 M4 provides features seldom found even in much larger
116 macro processors, 
117 including
118 .IP "  \(bu"
119 arguments
120 .IP "  \(bu"
121 condition testing
122 .IP "  \(bu"
123 arithmetic capabilities
124 .IP "  \(bu"
125 string and substring functions
126 .IP "  \(bu"
127 file manipulation
128 .LP
129 .PP
130 This paper is a user's manual for M4.
131 .AE
132 .\" .CS 6 0 6 0 0 1
133 .if t .2C
134 .SH
135 Introduction
136 .PP
137 A macro processor is a useful way to enhance a programming language,
138 to make it more palatable
139 or more readable,
140 or to tailor it to a particular application.
141 The
142 .UL #define
143 statement in C
144 and the analogous
145 .UL define
146 in Ratfor
147 are examples of the basic facility provided by
148 any macro processor _
149 replacement of text by other text.
150 .PP
151 The M4 macro processor is an extension of a macro processor called M3
152 which was written by D. M. Ritchie
153 for the AP-3 minicomputer;
154 M3 was in turn based on a macro processor implemented for [1].
155 Readers unfamiliar with the basic ideas of macro processing
156 may wish to read some of the discussion there.
157 .PP
158 M4 is a suitable front end for Ratfor and C,
159 and has also been used successfully with Cobol.
160 Besides the straightforward replacement of one string of text by another,
161 it provides
162 macros with arguments,
163 conditional macro expansion,
164 arithmetic,
165 file manipulation,
166 and some specialized string processing functions.
167 .PP
168 The basic operation of M4
169 is to copy its input to its output.
170 As the input is read, however, each alphanumeric ``token''
171 (that is, string of letters and digits) is checked.
172 If it is the name of a macro,
173 then the name of the macro is replaced by its defining text,
174 and the resulting string is pushed back onto the
175 input to be rescanned.
176 Macros may be called with arguments, in which case the arguments are collected
177 and substituted into the right places in the defining text
178 before it is rescanned.
179 .PP
180 M4 provides a collection of about twenty built-in
181 macros
182 which perform various useful operations;
183 in addition, the user can define new macros.
184 Built-ins and user-defined macros work exactly the same way, except that
185 some of the built-in macros have side effects
186 on the state of the process.
187 .SH
188 Usage
189 .PP
190 On
191 .UC UNIX ,
192 use
193 .P1
194 m4 [files]
195 .P2
196 Each argument file is processed in order;
197 if there are no arguments, or if an argument
198 is `\-',
199 the standard input is read at that point.
200 The processed text is written on the standard output,
201 which may be captured for subsequent processing with
202 .P1
203 m4 [files] >outputfile
204 .P2
205 On
206 .UC GCOS ,
207 usage is identical, but the program is called
208 .UL \&./m4 .
209 .SH
210 Defining Macros
211 .PP
212 The primary built-in function of M4
213 is
214 .UL define ,
215 which is used to define new macros.
216 The input
217 .P1
218 define(name, stuff)
219 .P2
220 causes the string
221 .UL name
222 to be defined as
223 .UL stuff .
224 All subsequent occurrences of
225 .UL name
226 will be replaced by
227 .UL stuff .
228 .UL name
229 must be alphanumeric and must begin with a letter
230 (the underscore \(ul counts as a letter).
231 .UL stuff
232 is any text that contains balanced parentheses;
233 it may stretch over multiple lines.
234 .PP
235 Thus, as a typical example,
236 .P1
237 define(N, 100)
238  ...
239 if (i > N)
240 .P2
241 defines
242 .UL N
243 to be 100, and uses this ``symbolic constant'' in a later
244 .UL if
245 statement.
246 .PP
247 The left parenthesis must immediately follow the word
248 .UL define ,
249 to signal that
250 .UL define
251 has arguments.
252 If a macro or built-in name is not followed immediately by `(',
253 it is assumed to have no arguments.
254 This is the situation for
255 .UL N
256 above;
257 it is actually a macro with no arguments,
258 and thus when it is used there need be no (...) following it.
259 .PP
260 You should also notice that a macro name is only recognized as such
261 if it appears surrounded by non-alphanumerics.
262 For example, in
263 .P1
264 define(N, 100)
265  ...
266 if (NNN > 100)
267 .P2
268 the variable 
269 .UL NNN
270 is absolutely unrelated to the defined macro
271 .UL N ,
272 even though it contains a lot of
273 .UL N 's.
274 .PP
275 Things may be defined in terms of other things.
276 For example,
277 .P1
278 define(N, 100)
279 define(M, N)
280 .P2
281 defines both M and N to be 100.
282 .PP
283 What happens if
284 .UL N
285 is redefined?
286 Or, to say it another way, is
287 .UL M 
288 defined as
289 .UL N
290 or as 100?
291 In M4,
292 the latter is true _
293 .UL M
294 is 100, so even if
295 .UL N 
296 subsequently changes,
297 .UL M
298 does not.
299 .PP
300 This behavior arises because
301 M4 expands macro names into their defining text as soon as it possibly can.
302 Here, that means that when the string
303 .UL N
304 is seen as the arguments of
305 .UL define
306 are being collected, it is immediately replaced by 100;
307 it's just as if you had said
308 .P1
309 define(M, 100)
310 .P2
311 in the first place.
312 .PP
313 If this isn't what you really want, there are two ways out of it.
314 The first, which is specific to this situation,
315 is to interchange the order of the definitions:
316 .P1
317 define(M, N)
318 define(N, 100)
319 .P2
320 Now
321 .UL M
322 is defined to be the string
323 .UL N ,
324 so when you ask for 
325 .UL M
326 later, you'll always get the value of
327 .UL N 
328 at that time
329 (because the
330 .UL M
331 will be replaced by
332 .UL N
333 which will be replaced by 100).
334 .SH
335 Quoting
336 .PP
337 The more general solution is to delay the expansion of
338 the arguments of
339 .UL define 
340 by
341 .ul
342 quoting
343 them.
344 Any text surrounded by the single quotes \(ga and \(aa
345 is not expanded immediately, but has the quotes stripped off.
346 If you say
347 .P1
348 define(N, 100)
349 define(M, `N')
350 .P2
351 the quotes around the
352 .UL N
353 are stripped off as the argument is being collected,
354 but they have served their purpose, and 
355 .UL M
356 is defined as
357 the string
358 .UL N ,
359 not 100.
360 The general rule is that M4 always strips off
361 one level of single quotes whenever it evaluates
362 something.
363 This is true even outside of
364 macros.
365 If you want the word
366 .UL define
367 to appear in the output,
368 you have to quote it in the input,
369 as in
370 .P1
371         `define' = 1;
372 .P2
373 .PP
374 As another instance of the same thing, which is a bit more surprising,
375 consider redefining
376 .UL N :
377 .P1
378 define(N, 100)
379  ...
380 define(N, 200)
381 .P2
382 Perhaps regrettably, the
383 .UL N
384 in the second definition is
385 evaluated as soon as it's seen;
386 that is, it is
387 replaced by
388 100, so it's as if you had written
389 .P1
390 define(100, 200)
391 .P2
392 This statement is ignored by M4, since you can only define things that look
393 like names, but it obviously doesn't have the effect you wanted.
394 To really redefine 
395 .UL N ,
396 you must delay the evaluation by quoting:
397 .P1
398 define(N, 100)
399  ...
400 define(`N', 200)
401 .P2
402 In M4,
403 it is often wise to quote the first argument of a macro.
404 .PP
405 If \` and \' are not convenient for some reason,
406 the quote characters can be changed with the built-in
407 .UL changequote :
408 .P1
409 changequote([, ])
410 .P2
411 makes the new quote characters the left and right brackets.
412 You can restore the original characters with just
413 .P1
414 changequote
415 .P2
416 .PP
417 There are two additional built-ins related to
418 .UL define .
419 .UL undefine
420 removes the definition of some macro or built-in:
421 .P1
422 undefine(`N')
423 .P2
424 removes the definition of
425 .UL N .
426 (Why are the quotes absolutely necessary?)
427 Built-ins can be removed with 
428 .UL undefine ,
429 as in
430 .P1
431 undefine(`define')
432 .P2
433 but once you remove one, you can never get it back.
434 .PP
435 The built-in 
436 .UL ifdef
437 provides a way to determine if a macro is currently defined.
438 In particular, M4 has pre-defined the names
439 .UL unix
440 and
441 .UL gcos
442 on the corresponding systems, so you can
443 tell which one you're using:
444 .P1
445 ifdef(`unix', `define(wordsize,16)' )
446 ifdef(`gcos', `define(wordsize,36)' )
447 .P2
448 makes a definition appropriate for the particular machine.
449 Don't forget the quotes!
450 .PP
451 .UL ifdef
452 actually permits three arguments;
453 if the name is undefined, the value of
454 .UL ifdef
455 is then the third argument, as in
456 .P1
457 ifdef(`unix', on UNIX, not on UNIX)
458 .P2
459 .SH
460 Arguments
461 .PP
462 So far we have discussed the simplest form of macro processing _
463 replacing one string by another (fixed) string.
464 User-defined macros may also have arguments, so different invocations
465 can have different results.
466 Within the replacement text for a macro
467 (the second argument of its
468 .UL define )
469 any occurrence of
470 .UL $n
471 will be replaced by the 
472 .UL n th
473 argument when the macro
474 is actually used.
475 Thus, the macro
476 .UL bump ,
477 defined as
478 .P1
479 define(bump, $1 = $1 + 1)
480 .P2
481 generates code to increment its argument by 1:
482 .P1
483 bump(x)
484 .P2
485 is
486 .P1
487 x = x + 1
488 .P2
489 .PP
490 A macro can have as many arguments as you want,
491 but only the first nine are accessible,
492 through
493 .UL $1
494 to
495 .UL $9 .
496 (The macro name itself is
497 .UL $0 ,
498 although that is less commonly used.)
499 Arguments that are not supplied are replaced by null strings,
500 so
501 we can define a macro
502 .UL cat
503 which simply concatenates its arguments, like this:
504 .P1
505 define(cat, $1$2$3$4$5$6$7$8$9)
506 .P2
507 Thus
508 .P1
509 cat(x, y, z)
510 .P2
511 is equivalent to
512 .P1
513 xyz
514 .P2
515 .UL $4
516 through
517 .UL $9
518 are null, since no corresponding arguments were provided.
519 .PP
520 .PP
521 Leading unquoted blanks, tabs, or newlines that occur during argument collection
522 are discarded.
523 All other white space is retained.
524 Thus
525 .P1
526 define(a,   b   c)
527 .P2
528 defines
529 .UL a
530 to be
531 .UL b\ \ \ c .
532 .PP
533 Arguments are separated by commas, but parentheses are counted properly,
534 so a comma ``protected'' by parentheses does not terminate an argument.
535 That is, in
536 .P1
537 define(a, (b,c))
538 .P2
539 there are only two arguments;
540 the second is literally
541 .UL (b,c) .
542 And of course a bare comma or parenthesis can be inserted by quoting it.
543 .SH
544 Arithmetic Built-ins
545 .PP
546 M4 provides two built-in functions for doing arithmetic
547 on integers (only).
548 The simplest is
549 .UL incr ,
550 which increments its numeric argument by 1.
551 Thus to handle the common programming situation
552 where you want a variable to be defined as ``one more than N'',
553 write
554 .P1
555 define(N, 100)
556 define(N1, `incr(N)')
557 .P2
558 Then
559 .UL N1
560 is defined as one more than the current value of
561 .UL N .
562 .PP
563 The more general mechanism for arithmetic is a built-in
564 called
565 .UL eval ,
566 which is capable of arbitrary arithmetic on integers.
567 It provides the operators
568 (in decreasing order of precedence)
569 .DS
570 unary + and \(mi
571 ** or ^ (exponentiation)
572 *  /  % (modulus)
573 +  \(mi
574 ==  !=  <  <=  >  >=
575 !               (not)
576 & or && (logical and)
577 \(or or \(or\(or                (logical or)
578 .DE
579 Parentheses may be used to group operations where needed.
580 All the operands of
581 an expression given to
582 .UL eval
583 must ultimately be numeric.
584 The numeric value of a true relation
585 (like 1>0)
586 is 1, and false is 0.
587 The precision in
588 .UL eval
589 is
590 32 bits on
591 .UC UNIX
592 and 36 bits on
593 .UC GCOS .
594 .PP
595 As a simple example, suppose we want 
596 .UL M
597 to be 
598 .UL 2**N+1 .
599 Then
600 .P1
601 define(N, 3)    
602 define(M, `eval(2**N+1)')
603 .P2
604 As a matter of principle, it is advisable
605 to quote the defining text for a macro
606 unless it is very simple indeed
607 (say just a number);
608 it usually gives the result you want,
609 and is a good habit to get into.
610 .SH
611 File Manipulation
612 .PP
613 You can include a new file in the input at any time by
614 the built-in function
615 .UL include :
616 .P1
617 include(filename)
618 .P2
619 inserts the contents of
620 .UL filename
621 in place of the
622 .UL include
623 command.
624 The contents of the file is often a set of definitions.
625 The value
626 of
627 .UL include
628 (that is, its replacement text)
629 is the contents of the file;
630 this can be captured in definitions, etc.
631 .PP
632 It is a fatal error if the file named in
633 .UL include
634 cannot be accessed.
635 To get some control over this situation, the alternate form
636 .UL sinclude
637 can be used;
638 .UL sinclude 
639 (``silent include'')
640 says nothing and continues if it can't access the file.
641 .PP
642 It is also possible to divert the output of M4 to temporary files during processing,
643 and output the collected material upon command.
644 M4 maintains nine of these diversions, numbered 1 through 9.
645 If you say
646 .P1
647 divert(n)
648 .P2
649 all subsequent output is put onto the end of a temporary file
650 referred to as
651 .UL n .
652 Diverting to this file is stopped by another 
653 .UL divert 
654 command;
655 in particular,
656 .UL divert
657 or
658 .UL divert(0)
659 resumes the normal output process.
660 .PP
661 Diverted text is normally output all at once
662 at the end of processing,
663 with the diversions output in numeric order.
664 It is possible, however, to bring back diversions
665 at any time,
666 that is, to append them to the current diversion.
667 .P1
668 undivert
669 .P2
670 brings back all diversions in numeric order, and
671 .UL undivert
672 with arguments brings back the selected diversions
673 in the order given.
674 The act of undiverting discards the diverted stuff,
675 as does diverting into a diversion 
676 whose number is not between 0 and 9 inclusive.
677 .PP
678 The value of
679 .UL undivert
680 is
681 .ul
682 not
683 the diverted stuff.
684 Furthermore, the diverted material is
685 .ul
686 not
687 rescanned for macros.
688 .PP
689 The built-in
690 .UL divnum
691 returns the number of the currently active diversion.
692 This is zero during normal processing.
693 .SH
694 System Command
695 .PP
696 You can run any program in the local operating system
697 with the
698 .UL syscmd
699 built-in.
700 For example,
701 .P1
702 syscmd(date)
703 .P2
704 on
705 .UC UNIX
706 runs the
707 .UL date
708 command.
709 Normally
710 .UL syscmd
711 would be used to create a file
712 for a subsequent
713 .UL include .
714 .PP
715 To facilitate making unique file names, the built-in
716 .UL maketemp
717 is provided, with specifications identical to the system function
718 .ul
719 mktemp:
720 a string of XXXXX in the argument is replaced
721 by the process id of the current process.
722 .SH
723 Conditionals
724 .PP
725 There is a built-in called
726 .UL ifelse
727 which enables you to perform arbitrary conditional testing.
728 In the simplest form,
729 .P1
730 ifelse(a, b, c, d)
731 .P2
732 compares the two strings
733 .UL a
734 and
735 .UL b .
736 If these are identical, 
737 .UL ifelse
738 returns
739 the string
740 .UL c ;
741 otherwise it returns
742 .UL d .
743 Thus we might define a macro called
744 .UL compare
745 which compares two strings and returns ``yes'' or ``no''
746 if they are the same or different.
747 .P1
748 define(compare, `ifelse($1, $2, yes, no)')
749 .P2
750 Note the quotes,
751 which prevent too-early evaluation of
752 .UL ifelse .
753 .PP
754 If the fourth argument is missing, it is treated as empty.
755 .PP
756 .UL ifelse
757 can actually have any number of arguments,
758 and thus provides a limited form of multi-way decision capability.
759 In the input
760 .P1
761 ifelse(a, b, c, d, e, f, g)
762 .P2
763 if the string
764 .UL a
765 matches the string
766 .UL b ,
767 the result is
768 .UL c .
769 Otherwise, if
770 .UL d
771 is the same as
772 .UL e ,
773 the result is
774 .UL f .
775 Otherwise the result is
776 .UL g .
777 If the final argument
778 is omitted, the result is null,
779 so
780 .P1
781 ifelse(a, b, c)
782 .P2
783 is
784 .UL c
785 if 
786 .UL a
787 matches
788 .UL b ,
789 and null otherwise.
790 .SH
791 String Manipulation
792 .PP
793 The built-in
794 .UL len
795 returns the length of the string that makes up its argument.
796 Thus
797 .P1
798 len(abcdef)
799 .P2
800 is 6, and
801 .UL len((a,b))
802 is 5.
803 .PP
804 The built-in
805 .UL substr
806 can be used to produce substrings of strings.
807 .UL substr(s,\ i,\ n)
808 returns the substring of
809 .UL s
810 that starts at the
811 .UL i th
812 position
813 (origin zero),
814 and is
815 .UL n
816 characters long.
817 If 
818 .UL n
819 is omitted, the rest of the string is returned,
820 so
821 .P1
822 substr(`now is the time', 1)
823 .P2
824 is
825 .P1
826 ow is the time
827 .P2
828 If 
829 .UL i
830 or
831 .UL n
832 are out of range, various sensible things happen.
833 .PP
834 .UL index(s1,\ s2)
835 returns the index (position) in
836 .UL s1
837 where the string
838 .UL s2
839 occurs, or \-1
840 if it doesn't occur.
841 As with
842 .UL substr ,
843 the origin for strings is 0.
844 .PP
845 The built-in
846 .UL translit
847 performs character transliteration.
848 .P1
849 translit(s, f, t)
850 .P2
851 modifies
852 .UL s
853 by replacing any character found in
854 .UL f
855 by the corresponding character of
856 .UL t .
857 That is,
858 .P1
859 translit(s, aeiou, 12345)
860 .P2
861 replaces the vowels by the corresponding digits.
862 If
863 .UL t
864 is shorter than
865 .UL f ,
866 characters which don't have an entry in
867 .UL t
868 are deleted; as a limiting case,
869 if
870 .UL t
871 is not present at all,
872 characters from 
873 .UL f
874 are deleted from 
875 .UL s .
876 So
877 .P1
878 translit(s, aeiou)
879 .P2
880 deletes vowels from 
881 .UL s .
882 .PP
883 There is also a built-in called
884 .UL dnl
885 which deletes all characters that follow it up to
886 and including the next newline;
887 it is useful mainly for throwing away 
888 empty lines that otherwise tend to clutter up M4 output.
889 For example, if you say
890 .P1
891 define(N, 100)
892 define(M, 200)
893 define(L, 300)
894 .P2
895 the newline at the end of each line is not part of the definition,
896 so it is copied into the output, where it may not be wanted.
897 If you add
898 .UL dnl
899 to each of these lines, the newlines will disappear.
900 .PP
901 Another way to achieve this, due to J. E. Weythman,
902 is
903 .P1
904 divert(-1)
905         define(...)
906         ...
907 divert
908 .P2
909 .SH
910 Printing
911 .PP
912 The built-in
913 .UL errprint
914 writes its arguments out on the standard error file.
915 Thus you can say
916 .P1
917 errprint(`fatal error')
918 .P2
919 .PP
920 .UL dumpdef
921 is a debugging aid which
922 dumps the current definitions of defined terms.
923 If there are no arguments, you get everything;
924 otherwise you get the ones you name as arguments.
925 Don't forget to quote the names!
926 .SH
927 Summary of Built-ins
928 .PP
929 Each entry is preceded by the
930 page number where it is described.
931 .DS
932 .tr '\'`\`
933 .ta .25i
934 3       changequote(L, R)
935 1       define(name, replacement)
936 4       divert(number)
937 4       divnum
938 5       dnl
939 5       dumpdef(`name', `name', ...)
940 5       errprint(s, s, ...)
941 4       eval(numeric expression)
942 3       ifdef(`name', this if true, this if false)
943 5       ifelse(a, b, c, d)
944 4       include(file)
945 3       incr(number)
946 5       index(s1, s2)
947 5       len(string)
948 4       maketemp(...XXXXX...)
949 4       sinclude(file)
950 5       substr(string, position, number)
951 4       syscmd(s)
952 5       translit(str, from, to)
953 3       undefine(`name')
954 4       undivert(number,number,...)
955 .DE
956 .SH
957 Acknowledgements
958 .PP
959 We are indebted to Rick Becker, John Chambers,
960 Doug McIlroy,
961 and especially Jim Weythman,
962 whose pioneering use of M4 has led to several valuable improvements.
963 We are also deeply grateful to Weythman for several substantial contributions
964 to the code.
965 .\" .SG
966 .SH
967 References
968 .LP
969 .IP [1]
970 B. W. Kernighan and P. J. Plauger,
971 .ul
972 Software Tools,
973 Addison-Wesley, Inc., 1976.