~ubuntu-branches/ubuntu/utopic/gettext/utopic

« back to all changes in this revision

Viewing changes to gettext-tools/gnulib-lib/gettext.h

  • Committer: Colin Watson
  • Date: 2010-08-01 21:36:08 UTC
  • mfrom: (2.1.10 sid)
  • Revision ID: cjwatson@canonical.com-20100801213608-yy7vkm8lpatep3ci
merge from Debian 0.18.1.1-1

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* Convenience header for conditional use of GNU <libintl.h>.
2
 
   Copyright (C) 1995-1998, 2000-2002, 2004-2006 Free Software Foundation, Inc.
 
2
   Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009 Free Software Foundation, Inc.
3
3
 
4
4
   This program is free software; you can redistribute it and/or modify it
5
5
   under the terms of the GNU General Public License as published
6
 
   by the Free Software Foundation; either version 2, or (at your option)
 
6
   by the Free Software Foundation; either version 3, or (at your option)
7
7
   any later version.
8
8
 
9
9
   This program is distributed in the hope that it will be useful,
64
64
   for invalid uses of the value returned from these functions.
65
65
   On pre-ANSI systems without 'const', the config.h file is supposed to
66
66
   contain "#define const".  */
 
67
# undef gettext
67
68
# define gettext(Msgid) ((const char *) (Msgid))
 
69
# undef dgettext
68
70
# define dgettext(Domainname, Msgid) ((void) (Domainname), gettext (Msgid))
 
71
# undef dcgettext
69
72
# define dcgettext(Domainname, Msgid, Category) \
70
73
    ((void) (Category), dgettext (Domainname, Msgid))
 
74
# undef ngettext
71
75
# define ngettext(Msgid1, Msgid2, N) \
72
76
    ((N) == 1 \
73
77
     ? ((void) (Msgid2), (const char *) (Msgid1)) \
74
78
     : ((void) (Msgid1), (const char *) (Msgid2)))
 
79
# undef dngettext
75
80
# define dngettext(Domainname, Msgid1, Msgid2, N) \
76
81
    ((void) (Domainname), ngettext (Msgid1, Msgid2, N))
 
82
# undef dcngettext
77
83
# define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \
78
84
    ((void) (Category), dngettext(Domainname, Msgid1, Msgid2, N))
 
85
# undef textdomain
79
86
# define textdomain(Domainname) ((const char *) (Domainname))
 
87
# undef bindtextdomain
80
88
# define bindtextdomain(Domainname, Dirname) \
81
89
    ((void) (Domainname), (const char *) (Dirname))
 
90
# undef bind_textdomain_codeset
82
91
# define bind_textdomain_codeset(Domainname, Codeset) \
83
92
    ((void) (Domainname), (const char *) (Codeset))
84
93
 
132
141
#endif
133
142
static const char *
134
143
pgettext_aux (const char *domain,
135
 
              const char *msg_ctxt_id, const char *msgid,
136
 
              int category)
 
144
              const char *msg_ctxt_id, const char *msgid,
 
145
              int category)
137
146
{
138
147
  const char *translation = dcgettext (domain, msg_ctxt_id, category);
139
148
  if (translation == msg_ctxt_id)
151
160
#endif
152
161
static const char *
153
162
npgettext_aux (const char *domain,
154
 
               const char *msg_ctxt_id, const char *msgid,
155
 
               const char *msgid_plural, unsigned long int n,
156
 
               int category)
 
163
               const char *msg_ctxt_id, const char *msgid,
 
164
               const char *msgid_plural, unsigned long int n,
 
165
               int category)
157
166
{
158
167
  const char *translation =
159
168
    dcngettext (domain, msg_ctxt_id, msgid_plural, n, category);
191
200
#endif
192
201
static const char *
193
202
dcpgettext_expr (const char *domain,
194
 
                 const char *msgctxt, const char *msgid,
195
 
                 int category)
 
203
                 const char *msgctxt, const char *msgid,
 
204
                 int category)
196
205
{
197
206
  size_t msgctxt_len = strlen (msgctxt) + 1;
198
207
  size_t msgid_len = strlen (msgid) + 1;
214
223
      translation = dcgettext (domain, msg_ctxt_id, category);
215
224
#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
216
225
      if (msg_ctxt_id != buf)
217
 
        free (msg_ctxt_id);
 
226
        free (msg_ctxt_id);
218
227
#endif
219
228
      if (translation != msg_ctxt_id)
220
 
        return translation;
 
229
        return translation;
221
230
    }
222
231
  return msgid;
223
232
}
236
245
#endif
237
246
static const char *
238
247
dcnpgettext_expr (const char *domain,
239
 
                  const char *msgctxt, const char *msgid,
240
 
                  const char *msgid_plural, unsigned long int n,
241
 
                  int category)
 
248
                  const char *msgctxt, const char *msgid,
 
249
                  const char *msgid_plural, unsigned long int n,
 
250
                  int category)
242
251
{
243
252
  size_t msgctxt_len = strlen (msgctxt) + 1;
244
253
  size_t msgid_len = strlen (msgid) + 1;
260
269
      translation = dcngettext (domain, msg_ctxt_id, msgid_plural, n, category);
261
270
#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
262
271
      if (msg_ctxt_id != buf)
263
 
        free (msg_ctxt_id);
 
272
        free (msg_ctxt_id);
264
273
#endif
265
274
      if (!(translation == msg_ctxt_id || translation == msgid_plural))
266
 
        return translation;
 
275
        return translation;
267
276
    }
268
277
  return (n == 1 ? msgid : msgid_plural);
269
278
}