GnuCOBOL  2.0
A free COBOL compiler
gettext.h File Reference
#include <string.h>
#include <stdlib.h>
Include dependency graph for gettext.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define gettext(Msgid)   ((const char *) (Msgid))
 
#define dgettext(Domainname, Msgid)   ((void) (Domainname), gettext (Msgid))
 
#define dcgettext(Domainname, Msgid, Category)   ((void) (Category), dgettext (Domainname, Msgid))
 
#define ngettext(Msgid1, Msgid2, N)
 
#define dngettext(Domainname, Msgid1, Msgid2, N)   ((void) (Domainname), ngettext (Msgid1, Msgid2, N))
 
#define dcngettext(Domainname, Msgid1, Msgid2, N, Category)   ((void) (Category), dngettext (Domainname, Msgid1, Msgid2, N))
 
#define textdomain(Domainname)   ((const char *) (Domainname))
 
#define bindtextdomain(Domainname, Dirname)   ((void) (Domainname), (const char *) (Dirname))
 
#define bind_textdomain_codeset(Domainname, Codeset)   ((void) (Domainname), (const char *) (Codeset))
 
#define gettext_noop(String)   String
 
#define GETTEXT_CONTEXT_GLUE   "\004"
 
#define pgettext(Msgctxt, Msgid)   pgettext_aux (NULL, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES)
 
#define dpgettext(Domainname, Msgctxt, Msgid)   pgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES)
 
#define dcpgettext(Domainname, Msgctxt, Msgid, Category)   pgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, Category)
 
#define npgettext(Msgctxt, Msgid, MsgidPlural, N)   npgettext_aux (NULL, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES)
 
#define dnpgettext(Domainname, Msgctxt, Msgid, MsgidPlural, N)   npgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES)
 
#define dcnpgettext(Domainname, Msgctxt, Msgid, MsgidPlural, N, Category)   npgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, Category)
 
#define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS   0
 
#define pgettext_expr(Msgctxt, Msgid)   dcpgettext_expr (NULL, Msgctxt, Msgid, LC_MESSAGES)
 
#define dpgettext_expr(Domainname, Msgctxt, Msgid)   dcpgettext_expr (Domainname, Msgctxt, Msgid, LC_MESSAGES)
 
#define npgettext_expr(Msgctxt, Msgid, MsgidPlural, N)   dcnpgettext_expr (NULL, Msgctxt, Msgid, MsgidPlural, N, LC_MESSAGES)
 
#define dnpgettext_expr(Domainname, Msgctxt, Msgid, MsgidPlural, N)   dcnpgettext_expr (Domainname, Msgctxt, Msgid, MsgidPlural, N, LC_MESSAGES)
 

Functions

static const char * pgettext_aux (const char *domain, const char *msg_ctxt_id, const char *msgid, int category)
 
static const char * npgettext_aux (const char *domain, const char *msg_ctxt_id, const char *msgid, const char *msgid_plural, unsigned long int n, int category)
 
static const char * dcpgettext_expr (const char *domain, const char *msgctxt, const char *msgid, int category)
 
static const char * dcnpgettext_expr (const char *domain, const char *msgctxt, const char *msgid, const char *msgid_plural, unsigned long int n, int category)
 

Macro Definition Documentation

#define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS   0

Definition at line 189 of file gettext.h.

#define bind_textdomain_codeset (   Domainname,
  Codeset 
)    ((void) (Domainname), (const char *) (Codeset))

Definition at line 89 of file gettext.h.

#define bindtextdomain (   Domainname,
  Dirname 
)    ((void) (Domainname), (const char *) (Dirname))

Definition at line 86 of file gettext.h.

Referenced by cob_init(), and main().

#define dcgettext (   Domainname,
  Msgid,
  Category 
)    ((void) (Category), dgettext (Domainname, Msgid))

Definition at line 70 of file gettext.h.

Referenced by dcpgettext_expr(), and pgettext_aux().

#define dcngettext (   Domainname,
  Msgid1,
  Msgid2,
  N,
  Category 
)    ((void) (Category), dngettext (Domainname, Msgid1, Msgid2, N))

Definition at line 81 of file gettext.h.

Referenced by dcnpgettext_expr(), and npgettext_aux().

#define dcnpgettext (   Domainname,
  Msgctxt,
  Msgid,
  MsgidPlural,
  N,
  Category 
)    npgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, Category)

Definition at line 136 of file gettext.h.

#define dcpgettext (   Domainname,
  Msgctxt,
  Msgid,
  Category 
)    pgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, Category)

Definition at line 125 of file gettext.h.

#define dgettext (   Domainname,
  Msgid 
)    ((void) (Domainname), gettext (Msgid))

Definition at line 68 of file gettext.h.

#define dngettext (   Domainname,
  Msgid1,
  Msgid2,
 
)    ((void) (Domainname), ngettext (Msgid1, Msgid2, N))

Definition at line 78 of file gettext.h.

#define dnpgettext (   Domainname,
  Msgctxt,
  Msgid,
  MsgidPlural,
 
)    npgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES)

Definition at line 134 of file gettext.h.

#define dnpgettext_expr (   Domainname,
  Msgctxt,
  Msgid,
  MsgidPlural,
 
)    dcnpgettext_expr (Domainname, Msgctxt, Msgid, MsgidPlural, N, LC_MESSAGES)

Definition at line 243 of file gettext.h.

#define dpgettext (   Domainname,
  Msgctxt,
  Msgid 
)    pgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES)

Definition at line 123 of file gettext.h.

#define dpgettext_expr (   Domainname,
  Msgctxt,
  Msgid 
)    dcpgettext_expr (Domainname, Msgctxt, Msgid, LC_MESSAGES)

Definition at line 198 of file gettext.h.

#define gettext (   Msgid)    ((const char *) (Msgid))

Definition at line 66 of file gettext.h.

#define GETTEXT_CONTEXT_GLUE   "\004"

Definition at line 110 of file gettext.h.

#define gettext_noop (   String)    String

Definition at line 107 of file gettext.h.

#define ngettext (   Msgid1,
  Msgid2,
 
)
Value:
((N) == 1 \
? ((void) (Msgid2), (const char *) (Msgid1)) \
: ((void) (Msgid1), (const char *) (Msgid2)))

Definition at line 73 of file gettext.h.

#define npgettext (   Msgctxt,
  Msgid,
  MsgidPlural,
 
)    npgettext_aux (NULL, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES)

Definition at line 131 of file gettext.h.

#define npgettext_expr (   Msgctxt,
  Msgid,
  MsgidPlural,
 
)    dcnpgettext_expr (NULL, Msgctxt, Msgid, MsgidPlural, N, LC_MESSAGES)

Definition at line 241 of file gettext.h.

#define pgettext (   Msgctxt,
  Msgid 
)    pgettext_aux (NULL, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES)

Definition at line 120 of file gettext.h.

#define pgettext_expr (   Msgctxt,
  Msgid 
)    dcpgettext_expr (NULL, Msgctxt, Msgid, LC_MESSAGES)

Definition at line 196 of file gettext.h.

#define textdomain (   Domainname)    ((const char *) (Domainname))

Definition at line 84 of file gettext.h.

Referenced by cob_init(), and main().

Function Documentation

static const char* dcnpgettext_expr ( const char *  domain,
const char *  msgctxt,
const char *  msgid,
const char *  msgid_plural,
unsigned long int  n,
int  category 
)
static

Definition at line 254 of file gettext.h.

References dcngettext, and NULL.

258 {
259  size_t msgctxt_len = strlen (msgctxt) + 1;
260  size_t msgid_len = strlen (msgid) + 1;
261  const char *translation;
262 #if _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
263  char msg_ctxt_id[msgctxt_len + msgid_len];
264 #else
265  char buf[1024];
266  char *msg_ctxt_id =
267  (msgctxt_len + msgid_len <= sizeof (buf)
268  ? buf
269  : (char *) malloc (msgctxt_len + msgid_len));
270  if (msg_ctxt_id != NULL)
271 #endif
272  {
273  memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1);
274  msg_ctxt_id[msgctxt_len - 1] = '\004';
275  memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len);
276  translation = dcngettext (domain, msg_ctxt_id, msgid_plural, n, category);
277 #if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
278  if (msg_ctxt_id != buf)
279  free (msg_ctxt_id);
280 #endif
281  if (!(translation == msg_ctxt_id || translation == msgid_plural))
282  return translation;
283  }
284  return (n == 1 ? msgid : msgid_plural);
285 }
#define dcngettext(Domainname, Msgid1, Msgid2, N, Category)
Definition: gettext.h:81
EC ARGUMENT EC EC BOUND EC BOUND EC BOUND EC BOUND TABLE EC DATA EC DATA EC DATA PTR NULL
Definition: exception.def:95
static const char* dcpgettext_expr ( const char *  domain,
const char *  msgctxt,
const char *  msgid,
int  category 
)
static

Definition at line 209 of file gettext.h.

References dcgettext, and NULL.

212 {
213  size_t msgctxt_len = strlen (msgctxt) + 1;
214  size_t msgid_len = strlen (msgid) + 1;
215  const char *translation;
216 #if _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
217  char msg_ctxt_id[msgctxt_len + msgid_len];
218 #else
219  char buf[1024];
220  char *msg_ctxt_id =
221  (msgctxt_len + msgid_len <= sizeof (buf)
222  ? buf
223  : (char *) malloc (msgctxt_len + msgid_len));
224  if (msg_ctxt_id != NULL)
225 #endif
226  {
227  memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1);
228  msg_ctxt_id[msgctxt_len - 1] = '\004';
229  memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len);
230  translation = dcgettext (domain, msg_ctxt_id, category);
231 #if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
232  if (msg_ctxt_id != buf)
233  free (msg_ctxt_id);
234 #endif
235  if (translation != msg_ctxt_id)
236  return translation;
237  }
238  return msgid;
239 }
EC ARGUMENT EC EC BOUND EC BOUND EC BOUND EC BOUND TABLE EC DATA EC DATA EC DATA PTR NULL
Definition: exception.def:95
#define dcgettext(Domainname, Msgid, Category)
Definition: gettext.h:70
static const char* npgettext_aux ( const char *  domain,
const char *  msg_ctxt_id,
const char *  msgid,
const char *  msgid_plural,
unsigned long int  n,
int  category 
)
static

Definition at line 166 of file gettext.h.

References dcngettext.

170 {
171  const char *translation =
172  dcngettext (domain, msg_ctxt_id, msgid_plural, n, category);
173  if (translation == msg_ctxt_id || translation == msgid_plural)
174  return (n == 1 ? msgid : msgid_plural);
175  else
176  return translation;
177 }
#define dcngettext(Domainname, Msgid1, Msgid2, N, Category)
Definition: gettext.h:81
static const char* pgettext_aux ( const char *  domain,
const char *  msg_ctxt_id,
const char *  msgid,
int  category 
)
static

Definition at line 147 of file gettext.h.

References dcgettext.

150 {
151  const char *translation = dcgettext (domain, msg_ctxt_id, category);
152  if (translation == msg_ctxt_id)
153  return msgid;
154  else
155  return translation;
156 }
#define dcgettext(Domainname, Msgid, Category)
Definition: gettext.h:70