| Skip Navigation Links | |
| Exit Print View | |
![]() | man pages section 1: User Commands Oracle Solaris 11 Information Library |
- C language message catalog preprocessor
msgcpp [-ACEHMPVX] [-Dname[=value]] [-Idirectory] [-Uname] [-T[length]] [-Ydirectory] [input [output] ]
msgcpp is a C language message catalog preprocessor. It acceptscpp(1) styleoptions and arguments.msgcpp preprocesses an input C source file and emits keyedlines to the output, usually for further processing bymsgcc(1).msgcc output isin thegencat(1) syntax. Candidate message text is determined by arguments tothe last<error.h> and<option.h> functions. Themsgcpp keyed output lines are:
command is a candidate for--??keys option string generation. This is triggered byb_command(int argc, in the input.
name is a candidate variable withstring value string.
string should be entered into the catalog.
Ifdefname occurs then its string value should be entered into the catalog.
The input source file is preprocessed with thepp:allpossible option on. Thisenables non-C semantics. All source should first be compiled error-free with areal compiler before runningmsgcpp. The following changes are enabled for thetop level files. Included file behavior is not affected.
All#if,#ifdef and#ifndef branches are enabled.
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.
Macro calls with an improper number of arguments are silently ignored.
#include on non-existent headers are silently ignored.
Invalid C source characters are silently ignored.
msgcat.h is included if it exists. This file may contain macro definitionsfor functions that translate string arguments. Iffoo is a function thattranslates its string arguments then include the line#define foo _TRANSLATE_ inmsgcat.h, orspecify the option-Dfoo=_TRANSLATE_. Ifbar is a function that translates stringarguments if the first argument isstderr, then use either#define bar _STDIO_ or-Dbar=_STDIO_.
The macro_BLD_msgcat is defined to be1. As an alternative tomsgcat.h,_TRANSLATE_ definitions could be placed inside#ifdef _BLD_msgcat ... #endif.
The following options are supported:
Enter the assertion using#assert for system V compatibility.
Pass comments to the output.
Comments are omitted by default.
Define the macroname to havevalue. This is the only portable way to pass options throughcc tocpp(1).
If=value is omitted,value is assumed to be1 .
Ifname begins with:, then it is interpreted as alibpp#pragma pp: statement.
Ifname begins with%, it is interpreted as alibpp# directive statement.
If name begins with a- or a+, it is interpreted as alibpp option.
- turns the option on,+ turns it off.
Most options have a#pragma counterpart that is listed with the option definition.
Preprocess for K&R C compatibility.
Set the debug trace level.
Specifylevel as a number greater than or equal to0. Higher levels produce more output. Levels higher than3 can only be enabled in the-g compiled versions.
Set the main input file name toname. This only affects the error messages and the line sync output.
All directories are hosted. Compatibility warning messages from the hosted directory headers are suppressed.
All directories contain C headers. This option is only used only with-D-+.
Enable the non-standardname=value macro argument mode.
Set the line sync directive id toid. Ifid is not specified, set to null.
Disable multiple include detection.
Enable the non-standard passthrough mode. This can be useful for processing non-C input.
Dump macro definitions to the output so that the output may be passed throughcpp again. This is used for generating precompiled headers.
Enable the transition preprocessing mode. This is used for compilers that cannot make up their semantics between K&R and ISO C.
Enable strict preprocessing semantics and warnings. This works with any mode (compatibility, transition, or the default ISO).
Enable implementation specific test code according totest.
Enable pedantic warnings in non-hosted files.
Preprocess for thecc compiler, which must be an executable path or an executable on$PATH.
Enable pool mode.
List canonicalized#define statements for non-predefined macros in the output.
List canonicalized#define statements for all macros. All other output is disabled.
Preprocess for the C++ dialect.
Ignored; for compatibility with very old compilers.
Emit#include file paths on the standard error, one per line, indented to show nesting.
Append directory to the list of directories searched for#include files.
If directory is-:
-I directories before-I- are searched only for"..." include files
-I directories after-I- are searched for"..." and<"..."> include files
the directory. is searched only if it is explicitly specified by an-I option
Markdirectory as a C header directory. This option is used withpp:plusplus.
Read the defaultprobe definitions fromfile, or ignore the default definitions iffile is omitted.
Mark directory as a hosted directory. Headers from hosted directories have compatibility warnings disabled.
Addheader to the list of ignored headers.
file contains a sequence of header[= "map" ] lines, where header is either<name> or"name", and"map" is an explicit binding for header. header is ignoredif = "map" is omitted.
Includefile but do not emit text or line syncs.
Adddirectory to the default standard include directory list.
Includefile and emit text to the output file. The option value can be omitted.
Generatemake(1S) dependencies. This option is not needed withnmake.
The-M option can be followed by optional flags to change the dependency output styles.
The following optional flags are supported:
Generate dependencies in a separate.d file. Preprocessed output is still written to output, or the standard output if output is omitted.
Also generate missing dependencies.
Only generate local header dependencies. Hosted headers are omitted. Hosted headers are determined by the-I-H option and the --pp:hosted andpp:hostdir pragmas. No special distinction is made between the"" and<> include styles.
Emit line syncs.
Line sync is turned on by default.-P means--nosync.
If notgcc, truncate identifiers tolength characters for compatibility with old AT&T compilers.
Remove the definition for the macroname.
Emit thelibpp version.
Enablename=value macro arguments foreasel compatibility.
Adddirectory to the list searched for#include <...> files.
The following operands are supported:
Specifies C source file to preprocess.
Specifies output file.
Successful completion.
An error occurred.
Example 1 Usingmsgcpp to Extract Localizable Strings
The following example usesmsgcpp to extract localizable strings from the filehello.c, marked using theERROR_dictionary(), and writes them to the filehello.mso:
example% cat hello.c#include <stdio.h>#include <stdlib.h>/* * dummy macro to avoid including * libast headers */#define ERROR_dictionary(x) xint 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.msoexample% cat hello.msostr "hello world"str "hello all"Glenn Fowler,gsf@research.att.com
Seeattributes(5) for descriptions of the following attributes:
|
cpp(1),gencat(1),msgcc(1),msgcvt(1),msggen(1),make(1S),attributes(5)
Kernighan, Brian W. and Ritchie, Dennis M.,The C Programming Language, Prentice Hall, 1988.
Copyright © 2011, Oracle and/or its affiliates. All rights reserved.Legal Notices | ![]() ![]() |