HP-UX Reference (11i v1 05/09) - 1 User Commands A-M (vol 1)
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 processed
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 con-
sist 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 single
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 com-
mas 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 original
meaning is lost. Their values are null unless otherwise stated.
changecom Change left and right comment markers from the default # and newline. With no argu-
ments, the comment mechanism is effectively disabled. With one argument, the left
marker becomes the argument and the right marker becomes newline. With two argu-
ments, both markers are affected. Comment markers may be up to five characters 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
(i.e., ‘ and ’).
HP-UX 11i Version 1: September 2005 − 1 − Hewlett-Packard Company Section 1−−505