/src/gettext-0.26/gettext-tools/libgettextpo/gettext.h
Line | Count | Source |
1 | | /* Convenience header for conditional use of GNU <libintl.h>. |
2 | | Copyright (C) 1995-2025 Free Software Foundation, Inc. |
3 | | |
4 | | This program is free software: you can redistribute it and/or modify |
5 | | it under the terms of the GNU Lesser General Public License as published by |
6 | | the Free Software Foundation; either version 2.1 of the License, or |
7 | | (at your option) any later version. |
8 | | |
9 | | This program is distributed in the hope that it will be useful, |
10 | | but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | | GNU Lesser General Public License for more details. |
13 | | |
14 | | You should have received a copy of the GNU Lesser General Public License |
15 | | along with this program. If not, see <https://www.gnu.org/licenses/>. */ |
16 | | |
17 | | #ifndef _LIBGETTEXT_H |
18 | | #define _LIBGETTEXT_H 1 |
19 | | |
20 | | |
21 | | /* NLS can be disabled through the configure --disable-nls option |
22 | | or through "#define ENABLE NLS 0" before including this file. */ |
23 | | #if defined ENABLE_NLS && ENABLE_NLS |
24 | | |
25 | | /* Get declarations of GNU message catalog functions. */ |
26 | | # include <libintl.h> |
27 | | |
28 | | /* You can set the DEFAULT_TEXT_DOMAIN macro to specify the domain used by |
29 | | the gettext() and ngettext() macros. This is an alternative to calling |
30 | | textdomain(), and is useful for libraries. */ |
31 | | # ifdef DEFAULT_TEXT_DOMAIN |
32 | | # undef gettext |
33 | | # define gettext(Msgid) \ |
34 | 0 | dgettext (DEFAULT_TEXT_DOMAIN, Msgid) |
35 | | # undef ngettext |
36 | | # define ngettext(Msgid1, Msgid2, N) \ |
37 | 0 | dngettext (DEFAULT_TEXT_DOMAIN, Msgid1, Msgid2, N) |
38 | | # endif |
39 | | |
40 | | #else |
41 | | |
42 | | /* Solaris /usr/include/locale.h includes /usr/include/libintl.h, which |
43 | | chokes if dcgettext is defined as a macro. So include it now, to make |
44 | | later inclusions of <locale.h> a NOP. We don't include <libintl.h> |
45 | | as well because people using "gettext.h" will not include <libintl.h>, |
46 | | and also including <libintl.h> would fail on SunOS 4, whereas <locale.h> |
47 | | is OK. */ |
48 | | # if defined(__sun) |
49 | | # include <locale.h> |
50 | | # endif |
51 | | |
52 | | /* Many header files from the libstdc++ coming with g++ 3.3 or newer include |
53 | | <libintl.h>, which chokes if dcgettext is defined as a macro. So include |
54 | | it now, to make later inclusions of <libintl.h> a NOP. */ |
55 | | # if defined(__cplusplus) && defined(__GNUG__) && (__GNUC__ >= 3) |
56 | | # include <cstdlib> |
57 | | # if (__GLIBC__ >= 2 && !defined __UCLIBC__) || _GLIBCXX_HAVE_LIBINTL_H |
58 | | # include <libintl.h> |
59 | | # endif |
60 | | # endif |
61 | | |
62 | | /* Disabled NLS. */ |
63 | | # if defined __GNUC__ && !defined __clang__ && !defined __cplusplus |
64 | | /* Use inline functions, to avoid warnings |
65 | | warning: format not a string literal and no format arguments |
66 | | that don't occur with enabled NLS. */ |
67 | | /* The return type 'const char *' serves the purpose of producing warnings |
68 | | for invalid uses of the value returned from these functions. */ |
69 | | # if __GNUC__ >= 9 |
70 | | # pragma GCC diagnostic push |
71 | | # pragma GCC diagnostic ignored "-Wbuiltin-declaration-mismatch" |
72 | | # endif |
73 | | __attribute__ ((__always_inline__, __gnu_inline__)) extern inline |
74 | | # if !defined(__sun) |
75 | | const |
76 | | # endif |
77 | | char * |
78 | | gettext (const char *msgid) |
79 | | { |
80 | | return msgid; |
81 | | } |
82 | | __attribute__ ((__always_inline__, __gnu_inline__)) extern inline |
83 | | # if !defined(__sun) |
84 | | const |
85 | | # endif |
86 | | char * |
87 | | dgettext (const char *domain, const char *msgid) |
88 | | { |
89 | | (void) domain; |
90 | | return msgid; |
91 | | } |
92 | | __attribute__ ((__always_inline__, __gnu_inline__)) extern inline |
93 | | # if !defined(__sun) |
94 | | const |
95 | | # endif |
96 | | char * |
97 | | dcgettext (const char *domain, const char *msgid, int category) |
98 | | { |
99 | | (void) domain; |
100 | | (void) category; |
101 | | return msgid; |
102 | | } |
103 | | # if __GNUC__ >= 9 |
104 | | # pragma GCC diagnostic pop |
105 | | # endif |
106 | | # else |
107 | | /* The casts to 'const char *' serve the purpose of producing warnings |
108 | | for invalid uses of the value returned from these functions. */ |
109 | | # undef gettext |
110 | | # define gettext(Msgid) ((const char *) (Msgid)) |
111 | | # undef dgettext |
112 | | # define dgettext(Domainname, Msgid) ((void) (Domainname), gettext (Msgid)) |
113 | | # undef dcgettext |
114 | | # define dcgettext(Domainname, Msgid, Category) \ |
115 | | ((void) (Category), dgettext (Domainname, Msgid)) |
116 | | # endif |
117 | | # undef ngettext |
118 | | # define ngettext(Msgid1, Msgid2, N) \ |
119 | | ((N) == 1 \ |
120 | | ? ((void) (Msgid2), (const char *) (Msgid1)) \ |
121 | | : ((void) (Msgid1), (const char *) (Msgid2))) |
122 | | # undef dngettext |
123 | | # define dngettext(Domainname, Msgid1, Msgid2, N) \ |
124 | | ((void) (Domainname), ngettext (Msgid1, Msgid2, N)) |
125 | | # undef dcngettext |
126 | | # define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \ |
127 | | ((void) (Category), dngettext (Domainname, Msgid1, Msgid2, N)) |
128 | | # undef textdomain |
129 | | # define textdomain(Domainname) ((const char *) (Domainname)) |
130 | | # undef bindtextdomain |
131 | | # define bindtextdomain(Domainname, Dirname) \ |
132 | | ((void) (Domainname), (const char *) (Dirname)) |
133 | | # undef bind_textdomain_codeset |
134 | | # define bind_textdomain_codeset(Domainname, Codeset) \ |
135 | | ((void) (Domainname), (const char *) (Codeset)) |
136 | | |
137 | | #endif |
138 | | |
139 | | |
140 | | /* Prefer gnulib's setlocale override over libintl's setlocale override. */ |
141 | | #ifdef GNULIB_defined_setlocale |
142 | | # undef setlocale |
143 | | # define setlocale rpl_setlocale |
144 | | #endif |
145 | | |
146 | | |
147 | | /* A pseudo function call that serves as a marker for the automated |
148 | | extraction of messages, but does not call gettext(). The run-time |
149 | | translation is done at a different place in the code. |
150 | | The argument, String, should be a literal string. Concatenated strings |
151 | | and other string expressions won't work. |
152 | | The macro's expansion is not parenthesized, so that it is suitable as |
153 | | initializer for static 'char[]' or 'const char[]' variables. */ |
154 | | #define gettext_noop(String) String |
155 | | |
156 | | |
157 | | /* The separator between msgctxt and msgid in a .mo file. */ |
158 | | #define GETTEXT_CONTEXT_GLUE "\004" |
159 | | |
160 | | /* Pseudo function calls, taking a MSGCTXT and a MSGID instead of just a |
161 | | MSGID. MSGCTXT and MSGID must be string literals. MSGCTXT should be |
162 | | short and rarely need to change. |
163 | | The letter 'p' stands for 'particular' or 'special'. */ |
164 | | |
165 | | #include <locale.h> /* for LC_MESSAGES */ |
166 | | |
167 | | #ifdef DEFAULT_TEXT_DOMAIN |
168 | | # define pgettext(Msgctxt, Msgid) \ |
169 | | pgettext_aux (DEFAULT_TEXT_DOMAIN, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES) |
170 | | #else |
171 | | # define pgettext(Msgctxt, Msgid) \ |
172 | | pgettext_aux (NULL, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES) |
173 | | #endif |
174 | | #define dpgettext(Domainname, Msgctxt, Msgid) \ |
175 | | pgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES) |
176 | | #define dcpgettext(Domainname, Msgctxt, Msgid, Category) \ |
177 | | pgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, Category) |
178 | | #ifdef DEFAULT_TEXT_DOMAIN |
179 | | # define npgettext(Msgctxt, Msgid, MsgidPlural, N) \ |
180 | | npgettext_aux (DEFAULT_TEXT_DOMAIN, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES) |
181 | | #else |
182 | | # define npgettext(Msgctxt, Msgid, MsgidPlural, N) \ |
183 | | npgettext_aux (NULL, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES) |
184 | | #endif |
185 | | #define dnpgettext(Domainname, Msgctxt, Msgid, MsgidPlural, N) \ |
186 | | npgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES) |
187 | | #define dcnpgettext(Domainname, Msgctxt, Msgid, MsgidPlural, N, Category) \ |
188 | | npgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, Category) |
189 | | |
190 | | #if defined __GNUC__ || defined __clang__ |
191 | | __inline |
192 | | #else |
193 | | #ifdef __cplusplus |
194 | | inline |
195 | | #endif |
196 | | #endif |
197 | | static const char * |
198 | | pgettext_aux (const char *domain, |
199 | | const char *msg_ctxt_id, const char *msgid, |
200 | | int category) |
201 | 0 | { |
202 | 0 | const char *translation = dcgettext (domain, msg_ctxt_id, category); |
203 | 0 | if (translation == msg_ctxt_id) |
204 | 0 | return msgid; |
205 | 0 | else |
206 | 0 | return translation; |
207 | 0 | } Unexecuted instantiation: gettext-po.c:pgettext_aux Unexecuted instantiation: write-catalog.c:pgettext_aux Unexecuted instantiation: write-po.c:pgettext_aux Unexecuted instantiation: po-charset.c:pgettext_aux Unexecuted instantiation: read-catalog.c:pgettext_aux Unexecuted instantiation: read-po-lex.c:pgettext_aux Unexecuted instantiation: read-po-gram.c:pgettext_aux Unexecuted instantiation: format.c:pgettext_aux Unexecuted instantiation: msgl-check.c:pgettext_aux Unexecuted instantiation: obstack.c:pgettext_aux Unexecuted instantiation: xalloc-die.c:pgettext_aux Unexecuted instantiation: xstrerror.c:pgettext_aux Unexecuted instantiation: read-catalog-abstract.c:pgettext_aux Unexecuted instantiation: format-c.c:pgettext_aux Unexecuted instantiation: format-c++-brace.c:pgettext_aux Unexecuted instantiation: format-python.c:pgettext_aux Unexecuted instantiation: format-python-brace.c:pgettext_aux Unexecuted instantiation: format-java.c:pgettext_aux Unexecuted instantiation: format-java-printf.c:pgettext_aux Unexecuted instantiation: format-csharp.c:pgettext_aux Unexecuted instantiation: format-javascript.c:pgettext_aux Unexecuted instantiation: format-scheme.c:pgettext_aux Unexecuted instantiation: format-lisp.c:pgettext_aux Unexecuted instantiation: format-elisp.c:pgettext_aux Unexecuted instantiation: format-librep.c:pgettext_aux Unexecuted instantiation: format-rust.c:pgettext_aux Unexecuted instantiation: format-go.c:pgettext_aux Unexecuted instantiation: format-ruby.c:pgettext_aux Unexecuted instantiation: format-sh.c:pgettext_aux Unexecuted instantiation: format-sh-printf.c:pgettext_aux Unexecuted instantiation: format-awk.c:pgettext_aux Unexecuted instantiation: format-lua.c:pgettext_aux Unexecuted instantiation: format-pascal.c:pgettext_aux Unexecuted instantiation: format-modula2.c:pgettext_aux Unexecuted instantiation: format-d.c:pgettext_aux Unexecuted instantiation: format-smalltalk.c:pgettext_aux Unexecuted instantiation: format-qt.c:pgettext_aux Unexecuted instantiation: format-qt-plural.c:pgettext_aux Unexecuted instantiation: format-kde.c:pgettext_aux Unexecuted instantiation: format-kde-kuit.c:pgettext_aux Unexecuted instantiation: format-boost.c:pgettext_aux Unexecuted instantiation: format-tcl.c:pgettext_aux Unexecuted instantiation: format-perl.c:pgettext_aux Unexecuted instantiation: format-perl-brace.c:pgettext_aux Unexecuted instantiation: format-php.c:pgettext_aux Unexecuted instantiation: format-gcc-internal.c:pgettext_aux Unexecuted instantiation: format-gfc-internal.c:pgettext_aux Unexecuted instantiation: markup.c:pgettext_aux |
208 | | |
209 | | #if defined __GNUC__ || defined __clang__ |
210 | | __inline |
211 | | #else |
212 | | #ifdef __cplusplus |
213 | | inline |
214 | | #endif |
215 | | #endif |
216 | | static const char * |
217 | | npgettext_aux (const char *domain, |
218 | | const char *msg_ctxt_id, const char *msgid, |
219 | | const char *msgid_plural, unsigned long int n, |
220 | | int category) |
221 | 0 | { |
222 | 0 | const char *translation = |
223 | 0 | dcngettext (domain, msg_ctxt_id, msgid_plural, n, category); |
224 | 0 | if (translation == msg_ctxt_id || translation == msgid_plural) |
225 | 0 | return (n == 1 ? msgid : msgid_plural); |
226 | 0 | else |
227 | 0 | return translation; |
228 | 0 | } Unexecuted instantiation: gettext-po.c:npgettext_aux Unexecuted instantiation: write-catalog.c:npgettext_aux Unexecuted instantiation: write-po.c:npgettext_aux Unexecuted instantiation: po-charset.c:npgettext_aux Unexecuted instantiation: read-catalog.c:npgettext_aux Unexecuted instantiation: read-po-lex.c:npgettext_aux Unexecuted instantiation: read-po-gram.c:npgettext_aux Unexecuted instantiation: format.c:npgettext_aux Unexecuted instantiation: msgl-check.c:npgettext_aux Unexecuted instantiation: obstack.c:npgettext_aux Unexecuted instantiation: xalloc-die.c:npgettext_aux Unexecuted instantiation: xstrerror.c:npgettext_aux Unexecuted instantiation: read-catalog-abstract.c:npgettext_aux Unexecuted instantiation: format-c.c:npgettext_aux Unexecuted instantiation: format-c++-brace.c:npgettext_aux Unexecuted instantiation: format-python.c:npgettext_aux Unexecuted instantiation: format-python-brace.c:npgettext_aux Unexecuted instantiation: format-java.c:npgettext_aux Unexecuted instantiation: format-java-printf.c:npgettext_aux Unexecuted instantiation: format-csharp.c:npgettext_aux Unexecuted instantiation: format-javascript.c:npgettext_aux Unexecuted instantiation: format-scheme.c:npgettext_aux Unexecuted instantiation: format-lisp.c:npgettext_aux Unexecuted instantiation: format-elisp.c:npgettext_aux Unexecuted instantiation: format-librep.c:npgettext_aux Unexecuted instantiation: format-rust.c:npgettext_aux Unexecuted instantiation: format-go.c:npgettext_aux Unexecuted instantiation: format-ruby.c:npgettext_aux Unexecuted instantiation: format-sh.c:npgettext_aux Unexecuted instantiation: format-sh-printf.c:npgettext_aux Unexecuted instantiation: format-awk.c:npgettext_aux Unexecuted instantiation: format-lua.c:npgettext_aux Unexecuted instantiation: format-pascal.c:npgettext_aux Unexecuted instantiation: format-modula2.c:npgettext_aux Unexecuted instantiation: format-d.c:npgettext_aux Unexecuted instantiation: format-smalltalk.c:npgettext_aux Unexecuted instantiation: format-qt.c:npgettext_aux Unexecuted instantiation: format-qt-plural.c:npgettext_aux Unexecuted instantiation: format-kde.c:npgettext_aux Unexecuted instantiation: format-kde-kuit.c:npgettext_aux Unexecuted instantiation: format-boost.c:npgettext_aux Unexecuted instantiation: format-tcl.c:npgettext_aux Unexecuted instantiation: format-perl.c:npgettext_aux Unexecuted instantiation: format-perl-brace.c:npgettext_aux Unexecuted instantiation: format-php.c:npgettext_aux Unexecuted instantiation: format-gcc-internal.c:npgettext_aux Unexecuted instantiation: format-gfc-internal.c:npgettext_aux Unexecuted instantiation: markup.c:npgettext_aux |
229 | | |
230 | | |
231 | | /* The same thing extended for non-constant arguments. Here MSGCTXT and MSGID |
232 | | can be arbitrary expressions. But for string literals these macros are |
233 | | less efficient than those above. */ |
234 | | |
235 | | #include <string.h> /* for memcpy */ |
236 | | |
237 | | /* GNULIB_NO_VLA can be defined to disable use of VLAs even if supported. |
238 | | This relates to the -Wvla and -Wvla-larger-than warnings, enabled in |
239 | | the default GCC many warnings set. This allows programs to disable use |
240 | | of VLAs, which may be unintended, or may be awkward to support portably, |
241 | | or may have security implications due to non-deterministic stack usage. */ |
242 | | |
243 | | #if (!defined GNULIB_NO_VLA \ |
244 | | && (((__GNUC__ >= 3 || defined __clang__) \ |
245 | | && !defined __STRICT_ANSI__ && !defined __cplusplus) \ |
246 | | /* || (__STDC_VERSION__ == 199901L && !defined __HP_cc) |
247 | | || (__STDC_VERSION__ >= 201112L && !defined __STDC_NO_VLA__) */ )) |
248 | | # define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS 1 |
249 | | #else |
250 | | # define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS 0 |
251 | | #endif |
252 | | |
253 | | #if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS |
254 | | # include <stdlib.h> /* for malloc, free */ |
255 | | #endif |
256 | | |
257 | | #define pgettext_expr(Msgctxt, Msgid) \ |
258 | | dcpgettext_expr (NULL, Msgctxt, Msgid, LC_MESSAGES) |
259 | | #define dpgettext_expr(Domainname, Msgctxt, Msgid) \ |
260 | | dcpgettext_expr (Domainname, Msgctxt, Msgid, LC_MESSAGES) |
261 | | |
262 | | #if defined __GNUC__ || defined __clang__ |
263 | | __inline |
264 | | #else |
265 | | #ifdef __cplusplus |
266 | | inline |
267 | | #endif |
268 | | #endif |
269 | | static const char * |
270 | | dcpgettext_expr (const char *domain, |
271 | | const char *msgctxt, const char *msgid, |
272 | | int category) |
273 | 0 | { |
274 | 0 | size_t msgctxt_len = strlen (msgctxt) + 1; |
275 | 0 | size_t msgid_len = strlen (msgid) + 1; |
276 | 0 | const char *translation; |
277 | 0 | #if _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS |
278 | 0 | char msg_ctxt_id[msgctxt_len + msgid_len]; |
279 | 0 | #else |
280 | 0 | char buf[1024]; |
281 | 0 | char *msg_ctxt_id = |
282 | 0 | (msgctxt_len + msgid_len <= sizeof (buf) |
283 | 0 | ? buf |
284 | 0 | : (char *) malloc (msgctxt_len + msgid_len)); |
285 | 0 | if (msg_ctxt_id != NULL) |
286 | 0 | #endif |
287 | 0 | { |
288 | 0 | int found_translation; |
289 | 0 | memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1); |
290 | 0 | msg_ctxt_id[msgctxt_len - 1] = '\004'; |
291 | 0 | memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len); |
292 | 0 | translation = dcgettext (domain, msg_ctxt_id, category); |
293 | 0 | found_translation = (translation != msg_ctxt_id); |
294 | 0 | #if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS |
295 | 0 | if (msg_ctxt_id != buf) |
296 | 0 | free (msg_ctxt_id); |
297 | 0 | #endif |
298 | 0 | if (found_translation) |
299 | 0 | return translation; |
300 | 0 | } |
301 | 0 | return msgid; |
302 | 0 | } Unexecuted instantiation: gettext-po.c:dcpgettext_expr Unexecuted instantiation: write-catalog.c:dcpgettext_expr Unexecuted instantiation: write-po.c:dcpgettext_expr Unexecuted instantiation: po-charset.c:dcpgettext_expr Unexecuted instantiation: read-catalog.c:dcpgettext_expr Unexecuted instantiation: read-po-lex.c:dcpgettext_expr Unexecuted instantiation: read-po-gram.c:dcpgettext_expr Unexecuted instantiation: format.c:dcpgettext_expr Unexecuted instantiation: msgl-check.c:dcpgettext_expr Unexecuted instantiation: obstack.c:dcpgettext_expr Unexecuted instantiation: xalloc-die.c:dcpgettext_expr Unexecuted instantiation: xstrerror.c:dcpgettext_expr Unexecuted instantiation: read-catalog-abstract.c:dcpgettext_expr Unexecuted instantiation: format-c.c:dcpgettext_expr Unexecuted instantiation: format-c++-brace.c:dcpgettext_expr Unexecuted instantiation: format-python.c:dcpgettext_expr Unexecuted instantiation: format-python-brace.c:dcpgettext_expr Unexecuted instantiation: format-java.c:dcpgettext_expr Unexecuted instantiation: format-java-printf.c:dcpgettext_expr Unexecuted instantiation: format-csharp.c:dcpgettext_expr Unexecuted instantiation: format-javascript.c:dcpgettext_expr Unexecuted instantiation: format-scheme.c:dcpgettext_expr Unexecuted instantiation: format-lisp.c:dcpgettext_expr Unexecuted instantiation: format-elisp.c:dcpgettext_expr Unexecuted instantiation: format-librep.c:dcpgettext_expr Unexecuted instantiation: format-rust.c:dcpgettext_expr Unexecuted instantiation: format-go.c:dcpgettext_expr Unexecuted instantiation: format-ruby.c:dcpgettext_expr Unexecuted instantiation: format-sh.c:dcpgettext_expr Unexecuted instantiation: format-sh-printf.c:dcpgettext_expr Unexecuted instantiation: format-awk.c:dcpgettext_expr Unexecuted instantiation: format-lua.c:dcpgettext_expr Unexecuted instantiation: format-pascal.c:dcpgettext_expr Unexecuted instantiation: format-modula2.c:dcpgettext_expr Unexecuted instantiation: format-d.c:dcpgettext_expr Unexecuted instantiation: format-smalltalk.c:dcpgettext_expr Unexecuted instantiation: format-qt.c:dcpgettext_expr Unexecuted instantiation: format-qt-plural.c:dcpgettext_expr Unexecuted instantiation: format-kde.c:dcpgettext_expr Unexecuted instantiation: format-kde-kuit.c:dcpgettext_expr Unexecuted instantiation: format-boost.c:dcpgettext_expr Unexecuted instantiation: format-tcl.c:dcpgettext_expr Unexecuted instantiation: format-perl.c:dcpgettext_expr Unexecuted instantiation: format-perl-brace.c:dcpgettext_expr Unexecuted instantiation: format-php.c:dcpgettext_expr Unexecuted instantiation: format-gcc-internal.c:dcpgettext_expr Unexecuted instantiation: format-gfc-internal.c:dcpgettext_expr Unexecuted instantiation: markup.c:dcpgettext_expr |
303 | | |
304 | | #define npgettext_expr(Msgctxt, Msgid, MsgidPlural, N) \ |
305 | | dcnpgettext_expr (NULL, Msgctxt, Msgid, MsgidPlural, N, LC_MESSAGES) |
306 | | #define dnpgettext_expr(Domainname, Msgctxt, Msgid, MsgidPlural, N) \ |
307 | | dcnpgettext_expr (Domainname, Msgctxt, Msgid, MsgidPlural, N, LC_MESSAGES) |
308 | | |
309 | | #if defined __GNUC__ || defined __clang__ |
310 | | __inline |
311 | | #else |
312 | | #ifdef __cplusplus |
313 | | inline |
314 | | #endif |
315 | | #endif |
316 | | static const char * |
317 | | dcnpgettext_expr (const char *domain, |
318 | | const char *msgctxt, const char *msgid, |
319 | | const char *msgid_plural, unsigned long int n, |
320 | | int category) |
321 | 0 | { |
322 | 0 | size_t msgctxt_len = strlen (msgctxt) + 1; |
323 | 0 | size_t msgid_len = strlen (msgid) + 1; |
324 | 0 | const char *translation; |
325 | 0 | #if _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS |
326 | 0 | char msg_ctxt_id[msgctxt_len + msgid_len]; |
327 | 0 | #else |
328 | 0 | char buf[1024]; |
329 | 0 | char *msg_ctxt_id = |
330 | 0 | (msgctxt_len + msgid_len <= sizeof (buf) |
331 | 0 | ? buf |
332 | 0 | : (char *) malloc (msgctxt_len + msgid_len)); |
333 | 0 | if (msg_ctxt_id != NULL) |
334 | 0 | #endif |
335 | 0 | { |
336 | 0 | int found_translation; |
337 | 0 | memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1); |
338 | 0 | msg_ctxt_id[msgctxt_len - 1] = '\004'; |
339 | 0 | memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len); |
340 | 0 | translation = dcngettext (domain, msg_ctxt_id, msgid_plural, n, category); |
341 | 0 | found_translation = !(translation == msg_ctxt_id || translation == msgid_plural); |
342 | 0 | #if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS |
343 | 0 | if (msg_ctxt_id != buf) |
344 | 0 | free (msg_ctxt_id); |
345 | 0 | #endif |
346 | 0 | if (found_translation) |
347 | 0 | return translation; |
348 | 0 | } |
349 | 0 | return (n == 1 ? msgid : msgid_plural); |
350 | 0 | } Unexecuted instantiation: gettext-po.c:dcnpgettext_expr Unexecuted instantiation: write-catalog.c:dcnpgettext_expr Unexecuted instantiation: write-po.c:dcnpgettext_expr Unexecuted instantiation: po-charset.c:dcnpgettext_expr Unexecuted instantiation: read-catalog.c:dcnpgettext_expr Unexecuted instantiation: read-po-lex.c:dcnpgettext_expr Unexecuted instantiation: read-po-gram.c:dcnpgettext_expr Unexecuted instantiation: format.c:dcnpgettext_expr Unexecuted instantiation: msgl-check.c:dcnpgettext_expr Unexecuted instantiation: obstack.c:dcnpgettext_expr Unexecuted instantiation: xalloc-die.c:dcnpgettext_expr Unexecuted instantiation: xstrerror.c:dcnpgettext_expr Unexecuted instantiation: read-catalog-abstract.c:dcnpgettext_expr Unexecuted instantiation: format-c.c:dcnpgettext_expr Unexecuted instantiation: format-c++-brace.c:dcnpgettext_expr Unexecuted instantiation: format-python.c:dcnpgettext_expr Unexecuted instantiation: format-python-brace.c:dcnpgettext_expr Unexecuted instantiation: format-java.c:dcnpgettext_expr Unexecuted instantiation: format-java-printf.c:dcnpgettext_expr Unexecuted instantiation: format-csharp.c:dcnpgettext_expr Unexecuted instantiation: format-javascript.c:dcnpgettext_expr Unexecuted instantiation: format-scheme.c:dcnpgettext_expr Unexecuted instantiation: format-lisp.c:dcnpgettext_expr Unexecuted instantiation: format-elisp.c:dcnpgettext_expr Unexecuted instantiation: format-librep.c:dcnpgettext_expr Unexecuted instantiation: format-rust.c:dcnpgettext_expr Unexecuted instantiation: format-go.c:dcnpgettext_expr Unexecuted instantiation: format-ruby.c:dcnpgettext_expr Unexecuted instantiation: format-sh.c:dcnpgettext_expr Unexecuted instantiation: format-sh-printf.c:dcnpgettext_expr Unexecuted instantiation: format-awk.c:dcnpgettext_expr Unexecuted instantiation: format-lua.c:dcnpgettext_expr Unexecuted instantiation: format-pascal.c:dcnpgettext_expr Unexecuted instantiation: format-modula2.c:dcnpgettext_expr Unexecuted instantiation: format-d.c:dcnpgettext_expr Unexecuted instantiation: format-smalltalk.c:dcnpgettext_expr Unexecuted instantiation: format-qt.c:dcnpgettext_expr Unexecuted instantiation: format-qt-plural.c:dcnpgettext_expr Unexecuted instantiation: format-kde.c:dcnpgettext_expr Unexecuted instantiation: format-kde-kuit.c:dcnpgettext_expr Unexecuted instantiation: format-boost.c:dcnpgettext_expr Unexecuted instantiation: format-tcl.c:dcnpgettext_expr Unexecuted instantiation: format-perl.c:dcnpgettext_expr Unexecuted instantiation: format-perl-brace.c:dcnpgettext_expr Unexecuted instantiation: format-php.c:dcnpgettext_expr Unexecuted instantiation: format-gcc-internal.c:dcnpgettext_expr Unexecuted instantiation: format-gfc-internal.c:dcnpgettext_expr Unexecuted instantiation: markup.c:dcnpgettext_expr |
351 | | |
352 | | |
353 | | #endif /* _LIBGETTEXT_H */ |