 |
Index for Section 1 |
|
 |
Alphabetical listing for M |
|
 |
Bottom of page |
|
mkcatdefs(1)
NAME
mkcatdefs - Preprocesses a message source file
SYNOPSIS
mkcatdefs [-h] catname source_file...
OPTIONS
-h Suppresses the generation of a <_msg.h> file.
DESCRIPTION
The mkcatdefs utility preprocesses a message source file to change symbolic
identifiers into numeric constants. The utility produces two forms of
output. The standard output is a set of commands suitable for passing to
the gencat utility, which creates a new message catalog. In addition,
catname, produces a file named catname_msg.h containing definition
statements that equate your symbolic identifiers with set numbers and
message ID numbers assigned by mkcatdefs. The catname_msg.h file is
required in your application program if you use symbolic identifiers.
See gencat(1) for a description of input format for commands. The only
difference between gencat and mkcatdefs is that gencat requires a number to
identify each message, while mkcatdefs accepts either a number or a
symbolic name. The mkcatdefs program can send message source data, with
numbers instead of symbolic identifiers, to standard output. This output is
suitable as input to the gencat program. You can use the > (right angle
bracket) character to write the new message source to a file, and then use
the file as input to the gencat command.
A symbolic name is converted to a number in the mkcatdefs output. Each set
and message in a program must have a unique number or symbolic name.
Symbolic identifiers can contain letters, digits, and underscores. The
first character cannot be a digit or an underscore. You cannot use a
symbolic name for a set in the $delset command.
The mkcatdefs program is designed to create new message catalogs, not to
change existing ones incrementally. Thus, the program's first operation on
each set is to delete it, in case the catalog contains a set with that
number. The sets specified in source_file are assigned numbers in
ascending order, starting at 1. Within each set, messages are also
assigned numbers in ascending order, starting at 1. If you assign a
message to a number in your source_file, mkcatdefs continues its ascending
series with that number.
Note also that you can use the runcat command rather than the mkcatdefs
command. The runcat command automatically sends the message source file
through the mkcatdefs command and pipes the files to the gencat command.
NOTES
Symbolic references allow a convenient input source for both the message
catalog and the program's header file; however, symbolic references are an
extension to X/Open specifications may not be supported on all systems
conforming to XPG4.
EXAMPLES
1. The following example shows a message source file with symbolic
message identifiers and quoted messages:
$quote " Use a double quotation mark to delimit message text
$set MSFAC Message Facility - symbolic identifiers
SYM_FORM "Symbolic identifiers can contain only letters \
and digits and the _ (underscore character)\n"
5 "You can mix symbolic identifiers and numbers \n"
$quote
MSG_H Remember to include the "_msg.h" file in your program\n
In the preceding example, the $quote command sets the quote character
to " (double quote), then disables it before the last message, which
contains double quotes.
When you process the file with mkcatdefs, the modified source is
written to standard output. Standard output can either be redirected
to a file using the > (redirection symbol) or piped to gencat.
2. Assume that the preceding file is named symb.src. It can be processed
with mkcatdefs as follows:
$ mkcatdefs symb symb.src >symb.msg
The following source is created:
$quote " Use a double quotation mark to delimit message text
$delset 1
$set 1
1 "Symbolic identifiers can contain only letters \
and digits and the _ (underscore character)\n"
5 "You can mix symbolic identifiers and numbers \n"
$quote
6 Remember to include the "_msg.h" file in your program\n
Note that the assigned message numbers are noncontiguous because the
source contained a specific number. The mkcatdefs program always
assigns the previous number plus 1 to a symbolic identifier.
The generated <symb_msg.h> file is:
#ifndef _H_SYMB_MSG
#define _H_SYMB_MSG
#include <limits.h>
#include <nl_types.h>
#define MF_SYMB "symb.cat"
/* The following was generated from symb.src. */
/* definitions for set MSFAC */
#define MSFAC 1
#define SYM_FORM 1
#define MSG_H 6
#endif
Note that mkcatdefs also created a symbol MF_SYMB by adding MF_ to
the catname using uppercase letters. The mkcatdefs program assumes
that the name of the generated catalog should be catname.cat, and
generates this symbol for your use with catopen.
Because this file includes <limits.h> and <nl_types.h>, you do not
need to include them in your application program. (nl_types defines
special data types required by the message facility routines.)
SEE ALSO
Commands: dspcat(1), dspmsg(1), gencat(1), runcat(1)
Functions: catclose(3), catgets(3), catopen(3)
 |
Index for Section 1 |
|
 |
Alphabetical listing for M |
|
 |
Top of page |
|