msgcpp is a C language message catalog preprocessor. It accepts
cpp(1)
style options and arguments.
msgcpp preprocesses an input C source file and emits keyed lines to the output, usually for
further processing by
msgcc(1). msgcc output is in the
gencat(1) syntax. Candidate message text is determined by arguments to the
ast
<error.h> and
<option.h> functions. The
msgcpp keyed output lines are:
- cmd command
command is a candidate for --??keys option string
generation. Triggered by b_command(int argc, in the input.
- def name string
name is a candidate variable with string value string
.
- str string
string should be entered into the catalog.
- var name
If def name occurs then its string value should be
entered into the catalog.
The input source file is preprocessed with the
pp:allpossible option on. This enables non-C semantics; all source should
first be compiled error-free with a real compiler before running
msgcpp. The following changes are enabled for the top level
files (i.e., included file behavior is not affected):
- (1)
- All #if, #ifdef and #ifndef branches are enabled.
- (2)
- The first definition for a macro is retained, even when subsequent #define statements would
normally redefine the macro. #undef must be used to redefine a macro.
- (3)
- Macro calls with an improper number of arguments are silently ignored.
- (4)
- #include on non-existent headers are silently ignored.
- (5)
- Invalid C source characters are silently ignored.
"msgcat.h" is included if it exists. This file may contain macro definitions for functions that translate string arguments.
If
foo is a function that translates its string arguments then include the line
#define foo _TRANSLATE_
in
msgcat.h or specify the option
-Dfoo=_TRANSLATE_. If
bar is a function that translates string
arguments if the first argument is
stderr then use either
#define bar _STDIO_ or
-Dbar=_STDIO_
.
The macro _BLD_msgcat is defined to be 1. As an alternative to msgcat.h, _TRANSLATE_ definitions could
be placed inside #ifdef _BLD_msgcat ... #endif.
cpp is the preprocessor for all C language dialects. It is a standalone version of the
libpp(3) preprocessor library. The C dialect implemented by
cpp is
determined by probing
cc(1) using
probe(1). The path of the emulated compiler can be changed by the
-D-X
command line option.
If output is omitted then the standard output is written; if input is also omitted then the standard input is read.
NOTE: this is an ancient, non-standard, non-intuitiive file operand syntax that is required by
cc(1); use shell file name expansion at your peril.
cpp specific options are set by the -D- and -I- options.