mkcatdefs Command

Purpose

Preprocesses a message source file.

Syntax

mkcatdefs SymbolName SourceFile ... [ -h ]

Description

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

The SourceFile message file contains symbolic identifiers. The mkcatdefs command produces the SymbolName_msg.h file, containing statements that equate symbolic identifiers with the set numbers and message ID numbers assigned by the mkcatdefs command.

The mkcatdefs command creates two outputs. The first is a header file called SymbolName_msg.h. You must include this SymbolName_msg.h file in your application program to associate the symbolic names to the set and message numbers assigned by the mkcatdefs command.

The mkcatdefs command sends message source data, with numbers instead of symbolic identifiers, to standard output. This output is suitable as input to the gencat command. You can use the mkcatdefs command output as input to the gencat command in the following ways:

After running the mkcatdefs command, you can use symbolic names in an application to refer to messages.

Flags

Item Description
-h Suppresses the generation of a SymbolName_msg.h file. This flag must be the last argument to the mkcatdefs command.

Examples

To process the symb.msg message source file and redirect the output to the symb.src file, enter:

mkcatdefs symb symb.msg > symb.src

The generated symb_msg.h file looks similar to the following:

#ifdef      _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      SYM_FORM     1
#define      SYM_LEN      2
#define      MSG_H  6
#endif

The mkcatdefs command also creates the symb.src message catalog source file for the gencat command with numbers assigned to the symbolic identifiers:

$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"
$quote
6       remember to include the "msg_h" file in your program

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

Note: The mkcatdefs command 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 command. You must enter all messages in the set.

Files

Item Description
/usr/bin/mkcatdefs Contains the mkcatdefs command.