mkcatdefs

preprocess a message file 

Command


SYNOPSIS

mkcatdefs [symbol_name] source_file... [-h]


DESCRIPTION

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

The source_file message source file contains symbolic identifiers. The mkcatdefs program produces the symbol_name_msg.h file containing statements that equate symbolic identifiers with the set numbers and message ID numbers assigned by mkcatdefs.

The mkcatdefs utility creates two different kinds of output. The first is a header file called symbol_name_msg.h. You must include this symbol_name_msg.h file in your application program to associate the symbolic names to the set and message numbers assigned by the mkcatdefs.

The mkcatdefs utility also sends message source data, with numbers instead of symbolic identifiers, to standard output. This output is suitable as input to the gencat utility. You can use the > (redirection symbol) to write the new message source to a file, and then use the file as input to the gencat command. Optionally, you can pipe the file directly to the gencat command.

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

Options

-h 

does not generate a _msg.h file. This option must be the last argument on the mkcatdefs command line.


EXAMPLES

Use the specified character before and after the message text as shown in the following example source file:

$quote "     Use a double quotation mark to delimit message text
$set MSFAC   Message Facility - symbolic identifiers
SYM_FORM     "Symbolic identifiers can only contain ASCII letters \
or digits or the _ (underscore character)\n"
SYM_LEN      "Symbolic identifiers cannot be more than 65 \
bytes long\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 this example, the $quote command sets the quote character to " (double quote), then disables it before the last message, which contains double quotes.

The preceding file can be processed with mkcatdefs as follows:

mkcatdefs symb symb.msg >symb.src

The generated symb_msg.h file would appear as follows:

#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 SYM_LEN 2
#define MSG_H 6

Note that mkcatdefs also created a symbol MF_SYMB by adding MF_ to the symbol_name using uppercase letters. The mkcatdefs utility assumes that the name of the generated catalog should be symbol_name.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.)

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.

The following source is created:

$quote "   Use double quotation marks to delimit message text
$delset 1
$set 1
1    "Symbolic identifiers can only contain ASCII letters \
or digits or the _ (underscore character)\n"
2    "Symbolic identifiers cannot be more than 65 \
bytes long\n"
5    "You can mix symbolic identifiers and numbers\n"
$quote
6    remember to include the "msg_h" file in your program

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.

Note:

The 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.


DIAGNOSTICS

Possible exit status values are:

0 

Successful completion.

>0 

An error occurred.


PORTABILITY

Windows 7. Windows Server 2008 R2. Windows 8. Windows Server 2012. Windows 10. Windows Server 2016.


AVAILABILITY

PTC MKS Toolkit for Power Users
PTC MKS Toolkit for System Administrators
PTC MKS Toolkit for Developers
PTC MKS Toolkit for Interoperability
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Commands:
gencat

Functions:
catclose(), catgets(), catopen()


PTC MKS Toolkit 10.1 patch 1 Documentation Build 2.