- -h
Print a short help message.
- -o outfile
Specify a file to which all output should be sent (by default, everything
is sent to standard output).
- -I /include/path
Specify a path where the #include meta-macro will look for include
files if they are not present in the current directory. The default is
/usr/include if no -I option is specified. Multiple -I options may be
specified to look in several directories.
- -D name=val
Define the user macro name as equal to val. This is strictly
equivalent to using the #define meta-macro, but makes it possible
to define macros from the command-line. If val makes references to
arguments or other macros, it should conform to the syntax of the mode
specified on the command-line. Note that macro argument naming is not
allowed on the command-line.
- +z
Set text mode to Unix mode (LF terminator). Any CR character in the
input is systematically discarded. This is the default under Unix systems.
- -z
Set text mode to DOS mode (CR-LF terminator). In this mode all CR characters
are removed from the input, and all output LF characters are converted to
CR-LF. This is the default if gpp is compiled with the WIN_NT option.
- -x
Enable the use of the #exec meta-macro. Since #exec includes
the output of an arbitrary shell command line, it may cause a potential
security threat, and is thus disabled unless this option is specified.
- -m
Enable automatic mode switching to the cpp compatibility mode if the name
of an included file ends in '.h' or '.c'. This makes it possible to
include C header files with only minor modifications.
- -n
Prevent newline or whitespace characters from being removed from the input
when they occur as the end of a macro call or of a comment. By default,
when a newline or whitespace character forms the end of a macro or a comment
it is parsed as part of the macro call or comment and therefore removed from
output. Use the -n option to keep the last character in the input stream
if it was whitespace or a newline.
- -U arg1 ... arg9
User-defined mode. The nine following command-line arguments are taken to
be respectively the macro start sequence, the macro end sequence for a call
without arguments, the argument start sequence, the argument separator,
the argument end sequence, the list of characters to stack for argument
balancing, the list of characters to unstack, the string to be used for
referring to an argument by number, and finally the quote character (if
there is none an empty string should be provided).
These settings apply both to user macros and to meta-macros, unless the -M
option is used to define other settings for meta-macros. See the section
on syntax specification for more details.
- -M arg1 ... arg7
User-defined mode specifications for meta-macros. This option can only be
used together with -M. The seven following command-line arguments are
taken to be respectively the macro start sequence, the macro end sequence
for a call without arguments, the argument start sequence, the argument
separator, the argument end sequence, the list of characters to stack for
argument balancing, and the list of characters to unstack. See below for
more details.
- (default mode)
The default mode is a vaguely cpp-like mode, but it does not handle
comments, and presents various incompatibilities with cpp.
Typical meta-macros and user macros look like this:
#define x y
macro(arg,...)
This mode is equivalent to
-U "" "" "(" "," ")" "(" ")" "#" "\\"
-M "#" "\n" " " " " "\n" "(" ")"
- -C
cpp compatibility mode. This is the mode where gpp's behavior is the
closest to that of cpp. Unlike in the default mode, meta-macro expansion
occurs only at the beginning of lines, and C comments and strings are
understood. This mode is equivalent to
-n -U "" "" "(" "," ")" "(" ")" "#" ""
-M "\n#\w" "\n" " " " " "\n" "" ""
+c "/*" "*/" +c "//" "\n" +c "\\\n" ""
+s "\"" "\"" "\\" +s "'" "'" "\\"
- -T
TeX-like mode. In this mode, typical meta-macros and user macros look like
this:
\define{x}{y}
\macro{arg}{...}
No comments are understood. This mode is equivalent to
-U "\\" "" "{" "}{" "}" "{" "}" "#" "@"
- -H
HTML-like mode. In this mode, typical meta-macros and user macros look like
this:
<#define x|y>
<#macro arg|...>
No comments are understood. This mode is equivalent to
-U "<#" ">" "\B" "|" ">" "<" ">" "#" "\\"
- -P
Prolog-compatible cpp-like mode. This mode differs from the cpp
compatibility mode by its handling of comments, and is equivalent to
-n -U "" "" "(" "," ")" "(" ")" "#" ""
-M "\n#\w" "\n" " " " " "\n" "" ""
+ccss "\!o/*" "*/" +ccss "%" "\n" +ccii "\\\n" ""
+s "\"" "\"" "" +s "\!#'" "'" ""
- +c <n> str1 str2
Specify comments. Any unquoted occurrence of str1 will be
interpreted as the beginning of a comment. All input up to the first
following occurrence of str2 will be discarded. This
option may be used multiple times to specify different types of comment
delimiters. The optional parameter <n> can be specified to
alter the behavior of the comment and e.g. turn it into a string or make it
ignored under certain circumstances, see below.
- -c str1
Un-specify comments or strings. The comment/string specification whose
start sequence is str1 is removed. This is useful to alter the
built-in comment specifications of a standard mode, e.g. the cpp
compatibility mode.
- +s <n> str1 str2 c
Specify strings. Any unquoted occurrence of str1 will be
interpreted as the beginning of a string. All input up to the first
following occurrence of str2 will be output as is without any
evaluation. The delimiters themselves are output. If c is non-empty,
its first character is used as a string-quote character, i.e. a
character whose presence immediately before an occurrence of str2
prevents it from terminating the string.
The optional parameter <n> can be specified to
alter the behavior of the string and e.g. turn it into a comment, enable
macro evaluation inside the string, or make the string specification
ignored under certain circumstances, see below.
- -s str1
Un-specify comments or strings. Identical to -c.
- infile
Specify an input file from which gpp reads its input. If no input
file is specified, input is read from standard input.