mkcatdefs - Preprocess a message source file

Format

mkcatdefs [-h] MsgFile [SourceFile ... ]

Description

mkcatdefs preprocesses a message source file for input to the gencat utility.

SourceFile is a message file (usually with a .msf extension) containing symbolic identifiers. If you do not specify a SourceFile, mkcatdefs reads from the standard input (stdin). mkcatdefs produces two outputs:
  • MsgFile.h, which contains statements that equate your symbolic identifiers with set numbers and message numbers that mkcatdefs assigns. You must include this header file in your application in order to refer to the messages.
  • Message source data, with numbers instead of symbolic identifiers, is sent to standard output. This output is suitable as input to the gencat utility. You should either save standard output to a file using redirection, or pipe the output of mkcatdefs to the gencat utility.

Options

-h
Suppresses the generation of a MsgFile.h file. This flag must be the first argument to mkcatdefs.

Extended description

The format of SourceFile is defined as follows: The fields of a message source line must begin in column 1 and are separated by a single blank character. Any other blank characters are considered as part of the subsequent field.
$quote
See gencat.
$set symbolic_name
The symbolic_name denotes the set identifier that will be used in an application program to reference this set of messages. This name can be up to 255 characters long and can contain any alphanumeric character and the underscore character, but must begin with a non-numeric character. Any string following the set identifier is treated as a comment.
$ comment
See gencat.
Symbolic_Name message_text
The Symbolic_Name denotes a message identifier that will be used in an application program to reference this message. This name can be up to 255 characters long and can contain any alphanumeric character and the underscore character, but must begin with a non-numeric character. There must be a single blank character separating the symbolic_name from the message_text. If no quote character is defined, then any blank characters after the separating blank character are considered part of the message text. See gencat for more information about how to specify message_text.

Examples

To process the comp1.msf and comp2.msf message source files and put the output into the comp.msg file, enter:
mkcatdefs comp comp1.msf comp2.msf >comp.msg
The source message file looks similar to the following:
$ This is the message source file for COMP1
$
$quote " Use double quotation marks to delimit message text
$set MSFAC1  Message set for component comp1
$
SYM_FORM "Symbolic identifiers can only contain alphanumeric \
characters or the _ (underscore character)\n"
SYM_LEN  "Symbolic identifiers cannot be more than 65 characters long\n"
5 "You can mix symbolic identifiers and numbers\n"
The generated comp.h file looks similar to the following:
#ifdef  _H_COMP_MSG
#include <limits.h>
#include <nl_types.h>
/*
 Time stamp: 1994 137 19:09 UTC
*/
/* The following was generated from comp1.msf. */
/* definitions for set MSFAC1 */
/* The following was generated from comp2.msf. */
/* definitions for set MSFAC2 */
#endif
mkcatdef creates the comp.h message catalog source file for gencat with numbers assigned to the symbolic identifiers:
$timestamp 1994 137 19:09 UTC
$quote " Use double quotation marks to delimit message text
$delset 1
$set 1
1 "Symbolic identifiers can only contain alphanumeric \
characters or the _ (underscore character)\n"
2 "Symbolic identifiers cannot be more than 65 characters long\n"
5 "You can mix symbolic identifiers and numbers\n"

The assigned message numbers are noncontiguous because the source file contained a specific number. mkcatdefs always assigns the previous number plus 1 to a symbolic identifier.

mkcatdefs inserts a $delset command before a $set command in the output message source file. This means you cannot add, delete, or replace single messages in an existing catalog when piping to the gencat utility. You must enter all messages in the set.