Merge from vendor branch GDB:
[dragonfly.git] / contrib / bind-9.2.4rc7 / lib / isc / include / isc / msgcat.h
1 /*
2  * Copyright (C) 2004  Internet Systems Consortium, Inc. ("ISC")
3  * Copyright (C) 1999-2001  Internet Software Consortium.
4  *
5  * Permission to use, copy, modify, and distribute this software for any
6  * purpose with or without fee is hereby granted, provided that the above
7  * copyright notice and this permission notice appear in all copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
10  * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11  * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
12  * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13  * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
14  * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15  * PERFORMANCE OF THIS SOFTWARE.
16  */
17
18 /* $Id: msgcat.h,v 1.8.2.1 2004/03/09 06:11:58 marka Exp $ */
19
20 #ifndef ISC_MSGCAT_H
21 #define ISC_MSGCAT_H 1
22
23 /*****
24  ***** Module Info
25  *****/
26
27 /*
28  * ISC Message Catalog
29  *
30  * Message catalogs aid internationalization of applications by allowing
31  * messages to be retrieved from locale-specific files instead of
32  * hardwiring them into the application.  This allows translations of
33  * messages appropriate to the locale to be supplied without recompiling
34  * the application.
35  *
36  * Notes:
37  *      It's very important that message catalogs work, even if only the
38  *      default_text can be used.
39  *
40  * MP:
41  *      The caller must ensure appropriate synchronization of
42  *      isc_msgcat_open() and isc_msgcat_close().  isc_msgcat_get()
43  *      ensures appropriate synchronization.
44  *
45  * Reliability:
46  *      No anticipated impact.
47  *
48  * Resources:
49  *      <TBS>
50  *
51  * Security:
52  *      No anticipated impact.
53  *
54  * Standards:
55  *      None.
56  */
57
58 /*****
59  ***** Imports
60  *****/
61
62 #include <isc/lang.h>
63 #include <isc/types.h>
64
65 ISC_LANG_BEGINDECLS
66
67 /*****
68  ***** Methods
69  *****/
70
71 void
72 isc_msgcat_open(const char *name, isc_msgcat_t **msgcatp);
73 /*
74  * Open a message catalog.
75  *
76  * Notes:
77  *
78  *      If memory cannot be allocated or other failures occur, *msgcatp
79  *      will be set to NULL.  If a NULL msgcat is given to isc_msgcat_get(),
80  *      the default_text will be returned, ensuring that some message text
81  *      will be available, no matter what's going wrong.
82  *
83  * Requires:
84  *
85  *      'name' is a valid string.
86  *
87  *      msgcatp != NULL && *msgcatp == NULL
88  */
89
90 void
91 isc_msgcat_close(isc_msgcat_t **msgcatp);
92 /*
93  * Close a message catalog.
94  *
95  * Notes:
96  *
97  *      Any string pointers returned by prior calls to isc_msgcat_get() are
98  *      invalid after isc_msgcat_close() has been called and must not be
99  *      used.
100  *
101  * Requires:
102  *
103  *      *msgcatp is a valid message catalog or is NULL.
104  *
105  * Ensures:
106  *
107  *      All resources associated with the message catalog are released.
108  *
109  *      *msgcatp == NULL
110  */
111
112 const char *
113 isc_msgcat_get(isc_msgcat_t *msgcat, int set, int message,
114                const char *default_text);
115 /*
116  * Get message 'message' from message set 'set' in 'msgcat'.  If it
117  * is not available, use 'default_text'.
118  *
119  * Requires:
120  *
121  *      'msgcat' is a valid message catalog or is NULL.
122  *
123  *      set > 0
124  *
125  *      message > 0
126  *
127  *      'default_text' is a valid string.
128  */
129
130 ISC_LANG_ENDDECLS
131
132 #endif /* ISC_MSGCAT_H */