MSGCPP(1) | User Commands | MSGCPP(1) |
msgcpp - C language message catalog preprocessor
msgcpp [-ACEHMPVX] [-D name[=value]] [-I directory] [-U name]
[-T[length]] [-Y directory] [input [output] ]
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 last <error.h> and <option.h> functions. The msgcpp keyed output lines are:
cmd command
def name string
str string
var name
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. Included file behavior is not affected.
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.
The following options are supported:
-A
--assert=assertion
-C
--comments
Comments are omitted by default.
-D
--define=name[=value]
- turns the option on, + turns it off.
-D-C
pp:compatibility
-D-Dlevel
pp:debug level level
Specify level as a number greater than or equal to 0. Higher levels produce more output. Levels higher than 3 can only be enabled in the -g compiled versions.
-D-Fname
-D-H
pp:hosted
-D-I
pp:cdir
-D-K
pp:keyargs
-D-L[id]
pp:lineid [id]
-D-M
pp:nomultiple
-D-P
pp:passthrough
-D-Q
pp:dump
-D-R
pp:transition
-D-S
pp:strict
-D-Ttest
pp:test test
-D-W
pp:warn
-D-X[cc]
-D-Z
pp:pool
-D-d
-D-m
-D-+
pp:plusplus
-E
--preprocess
-H
--include-reference
-I
--include[=directory]
If directory is -:
-I-Cdirectory
pp:cdir directory
-I-D[file]
-I-Hdirectory
pp:hostdir directory
-I-Iheader
pp:ignore header
-I-Mfile
-I-Rfile
-I-Sdirectory
-I-Tfile
-M
--dependencies
The -M option can be followed by optional flags to change the dependency output styles.
The following optional flags are supported:
D
G
M
-P
--sync
Line sync is turned on by default. -P means --nosync.
-T[length]
-U
--undefine=name
-V
--version
-X
--argmode
-Y
--standard=directory
The following operands are supported:
input
output
0
>0
Example 1 Using msgcpp to Extract Localizable Strings
The following example uses msgcpp to extract localizable strings from the file hello.c, marked using the ERROR_dictionary(), and writes them to the file hello.mso:
example% cat hello.c #include <stdio.h> #include <stdlib.h> /*
* dummy macro to avoid including
* libast headers
*/ #define ERROR_dictionary(x) x int main(int ac, char *av[]) {
puts( ERROR_dictionary("hello world") );
puts( ERROR_dictionary("hello all") );
return( EXIT_SUCCESS );
} example% msgcpp -D__STDC__ -D__i386 hello.c hello.mso example% cat hello.mso str "hello world" str "hello all"
Glenn Fowler, gsf@research.att.com
See attributes(7) for descriptions of the following attributes:
ATTRIBUTE TYPE | ATTRIBUTE VALUE |
Interface Stability | Volatile |
cpp(1), gencat(1), msgcc(1), msgcvt(1), msggen(1), make(1S), attributes(7)
Kernighan, Brian W. and Ritchie, Dennis M., The C Programming Language, Prentice Hall, 1988.
October 9, 2007 | OmniOS |