HP 9000 User Manual page 122

Computers
Hide thumbs Also See for 9000:
Table of Contents

Advertisement

translation is not obvious to someone unfamiliar with the program. Comments
in the message text source file won't help since they are not saved in the
message catalog. See "Guidelines for Using Messaging" later in this chapter for
a description of a "cookbook" to help the translator avoid errors.
Libraries with Messages
Library routines, as well as programs, can use message catalogs. For example,
the C library routine perror(3C) uses a message catalog and can be used by a
program that also uses a message catalog. All the considerations for programs
apply to libraries. There are also some special considerations.
In general, the scope of variables of a library routine is restricted to the routine
so that they do not conflict with the variables of the main program. The
catalog descriptor must be declared so that there can be no conflict with the
main program, since the main program may also use a message catalog.
Since a library routine might be called several times by a program, some
consideration should be given to the way the message catalog file is opened.
There are two general strategies:
• The easy strategy is to open the catalog when it is needed and close it after
use. This uses a file descriptor only when it is needed .
• For cases in which the library routine is called frequently, it may be desirable
to avoid multiple opens/closes of the catalog. This can be done with the
following:
static nl_catd catd;
static int oflg
=
FALSE;
if (
!
oflg ) {
oflg
=
TRUE;
catd
=
catopen( ... );
}
catgets(catd, seLnum, msg_num, dei_str);
Once open, the file descriptor remains in use for the remainder of the program.
The catalog will be closed by exit at program termination. Note, however,
The Message Catalog System 7-15
7

Advertisement

Table of Contents
loading

Table of Contents