m4.1 (2010 09)
m
m4(1) m4(1)
NAME
m4 - macro processor
SYNOPSIS
m4 [options ][file ...]
DESCRIPTION
m4 is a macro processor intended as a front end for Ratfor, C, and other languages. Each of the argument
files is processed in order; if there are no files, or if a file name is
-, standard input is read. The pro-
cessed text is written to standard output.
Options
m4 recognizes the following options:
-e Operate interactively. Interrupts are ignored and the output is unbuffered. Using this
mode may be very difficult.
-s Enable line sync output for the C preprocessor (
#line ...)
-Bint Change the size of the push-back and argument collection buffers from the default of
4,096.
-Hint Change the size of the symbol table hash array from the default of 199. The size should
be prime.
-Sint Change the size of the call stack from the default of 100 slots. Macros take three slots,
and nonmacro arguments take one.
-Tint Change the size of the token buffer from the default of 512 bytes.
To be effective, the options listed above must appear before any file names and before any
-D or -U
options.
-Dname[=val ]
Define name as val or as null if val is omitted.
-Uname Undefine name .
Macro Calls
Macro calls have the form:
name(arg1, arg2, ... ,argn)
The left parenthesis (() must immediately follow the name of the macro. If the name of a defined macro
is not followed by a (, it is deemed to be a call of that macro with no arguments. Potential macro names
consist of alphabetic letters, digits, and underscore (_); the first character cannot be a digit.
Leading unquoted blanks, tabs, and newlines are ignored while collecting arguments. Left and right sin-
gle quotes (
‘ and ’) are used to quote strings. The value of a quoted string is the string stripped of the
quotes.
When a macro name is recognized, its arguments are collected by searching for a matching right
parenthesis. If fewer arguments are supplied than are in the macro definition, the trailing arguments are
taken to be null. Macro evaluation proceeds normally during the collection of the arguments, and any
commas or right parentheses which happen to turn up within the value of a nested call are as effective as
those in the original input text. After argument collection, the value of the macro is pushed back onto the
input stream and rescanned.
Built-In Macro Names
m4 makes available the following built-in macros. They can be redefined, but, once this is done, the origi-
nal meaning is lost. Their values are null unless otherwise stated.
changecom Change left and right comment markers from the default # and newline. With no
arguments, the comment mechanism is effectively disabled. With one argument, the
left marker becomes the argument and the right marker becomes newline. With two
arguments, both markers are affected. Comment markers may be up to five charac-
ters long.
changequote Change quote symbols to the first and second arguments. The symbols may be up to
five characters long. changequote without arguments restores the original values
HP-UX 11i Version 3: September 2010 − 1 − Hewlett-Packard Company 1