home *** CD-ROM | disk | FTP | other *** search
/ Dream 52 / Amiga_Dream_52.iso / Linux / Divers / lyx-0.13.2.tar.gz / lyx-0.13.2.tar / lyx-0.13.2 / intl / libgettext.h < prev    next >
C/C++ Source or Header  |  1998-04-23  |  6KB  |  184 lines

  1. /* Message catalogs for internationalization.
  2.    Copyright (C) 1995, 1996, 1997 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 General Public License as published by
  6.    the Free Software Foundation; either version 2, or (at your option)
  7.    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 General Public License for more details.
  13.  
  14.    You should have received a copy of the GNU General Public License
  15.    along with this program; if not, write to the Free Software Foundation,
  16.    Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
  17.  
  18. /* Because on some systems (e.g. Solaris) we sometimes have to include
  19.    the systems libintl.h as well as this file we have more complex
  20.    include protection above.  But the systems header might perhaps also
  21.    define _LIBINTL_H and therefore we have to protect the definition here.  */
  22.  
  23. #if !defined (_LIBINTL_H) || !defined (_LIBGETTEXT_H)
  24. #if !defined (_LIBINTL_H)
  25. # define _LIBINTL_H    1
  26. #endif
  27. #define _LIBGETTEXT_H    1
  28.  
  29. /* We define an additional symbol to signal that we use the GNU
  30.    implementation of gettext.  */
  31. #define __USE_GNU_GETTEXT 1
  32.  
  33. #include <sys/types.h>
  34.  
  35. #if HAVE_LOCALE_H
  36. # include <locale.h>
  37. #endif
  38.  
  39.  
  40. #ifdef __cplusplus
  41. extern "C" {
  42. #endif
  43.  
  44. /* @@ end of prolog @@ */
  45.  
  46.  
  47. #ifndef PARAMS
  48. # if defined(__STDC__) || defined(__cplusplus)
  49. #  define PARAMS(args) args
  50. # else
  51. #  define PARAMS(args) ()
  52. # endif
  53. #endif
  54.  
  55. #ifndef NULL
  56. # if !defined __cplusplus || defined __GNUC__
  57. #  define NULL ((void *) 0)
  58. # else
  59. #  define NULL (0)
  60. # endif
  61. #endif
  62.  
  63. #if !HAVE_LC_MESSAGES
  64. /* This value determines the behaviour of the gettext() and dgettext()
  65.    function.  But some system does not have this defined.  Define it
  66.    to a default value.  */
  67. # define LC_MESSAGES (-1)
  68. #endif
  69.  
  70.  
  71. /* Declarations for gettext-using-catgets interface.  Derived from
  72.    Jim Meyering's libintl.h.  */
  73. struct _msg_ent
  74. {
  75.   const char *_msg;
  76.   int _msg_number;
  77. };
  78.  
  79.  
  80. #if HAVE_CATGETS
  81. /* These two variables are defined in the automatically by po-to-tbl.sed
  82.    generated file `cat-id-tbl.c'.  */
  83. extern const struct _msg_ent _msg_tbl[];
  84. extern int _msg_tbl_length;
  85. #endif
  86.  
  87.  
  88. /* For automatical extraction of messages sometimes no real
  89.    translation is needed.  Instead the string itself is the result.  */
  90. #define gettext_noop(Str) (Str)
  91.  
  92. /* Look up MSGID in the current default message catalog for the current
  93.    LC_MESSAGES locale.  If not found, returns MSGID itself (the default
  94.    text).  */
  95. extern char *gettext PARAMS ((const char *__msgid));
  96. extern char *gettext__ PARAMS ((const char *__msgid));
  97.  
  98. /* Look up MSGID in the DOMAINNAME message catalog for the current
  99.    LC_MESSAGES locale.  */
  100. extern char *dgettext PARAMS ((const char *__domainname, const char *__msgid));
  101. extern char *dgettext__ PARAMS ((const char *__domainname,
  102.                  const char *__msgid));
  103.  
  104. /* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY
  105.    locale.  */
  106. extern char *dcgettext PARAMS ((const char *__domainname, const char *__msgid,
  107.                 int __category));
  108. extern char *dcgettext__ PARAMS ((const char *__domainname,
  109.                   const char *__msgid, int __category));
  110.  
  111.  
  112. /* Set the current default message catalog to DOMAINNAME.
  113.    If DOMAINNAME is null, return the current default.
  114.    If DOMAINNAME is "", reset to the default of "messages".  */
  115. extern char *textdomain PARAMS ((const char *__domainname));
  116. extern char *textdomain__ PARAMS ((const char *__domainname));
  117.  
  118. /* Specify that the DOMAINNAME message catalog will be found
  119.    in DIRNAME rather than in the system locale data base.  */
  120. extern char *bindtextdomain PARAMS ((const char *__domainname,
  121.                   const char *__dirname));
  122. extern char *bindtextdomain__ PARAMS ((const char *__domainname,
  123.                     const char *__dirname));
  124.  
  125. #if ENABLE_NLS
  126.  
  127. /* Solaris 2.3 has the gettext function but dcgettext is missing.
  128.    So we omit this optimization for Solaris 2.3.  BTW, Solaris 2.4
  129.    has dcgettext.  */
  130. # if !HAVE_CATGETS && (!HAVE_GETTEXT || HAVE_DCGETTEXT)
  131.  
  132. #  define gettext(Msgid)                              \
  133.      dgettext (NULL, Msgid)
  134.  
  135. #  define dgettext(Domainname, Msgid)                          \
  136.      dcgettext (Domainname, Msgid, LC_MESSAGES)
  137.  
  138. #  if defined __GNUC__ && __GNUC__ == 2 && __GNUC_MINOR__ >= 7
  139. /* This global variable is defined in loadmsgcat.c.  We need a sign,
  140.    whether a new catalog was loaded, which can be associated with all
  141.    translations.  */
  142. extern int _nl_msg_cat_cntr;
  143.  
  144. #   define dcgettext(Domainname, Msgid, Category)                  \
  145.   (__extension__                                  \
  146.    ({                                          \
  147.      char *__result;                                  \
  148.      if (__builtin_constant_p ((int)Msgid))                          \
  149.        {                                      \
  150.      static char *__translation__;                          \
  151.      static int __catalog_counter__;                      \
  152.      if (! __translation__ || __catalog_counter__ != _nl_msg_cat_cntr)    \
  153.        {                                      \
  154.          __translation__ =                              \
  155.            dcgettext__ (Domainname, Msgid, Category);              \
  156.          __catalog_counter__ = _nl_msg_cat_cntr;                  \
  157.        }                                      \
  158.      __result = __translation__;                          \
  159.        }                                      \
  160.      else                                      \
  161.        __result = dcgettext__ (Domainname, Msgid, Category);              \
  162.      __result;                                      \
  163.     }))
  164. #  endif
  165. # endif
  166.  
  167. #else
  168.  
  169. # define gettext(Msgid) (Msgid)
  170. # define dgettext(Domainname, Msgid) (Msgid)
  171. # define dcgettext(Domainname, Msgid, Category) (Msgid)
  172. # define textdomain(Domainname) while (0) /* nothing */
  173. # define bindtextdomain(Domainname, Dirname) while (0) /* nothing */
  174.  
  175. #endif
  176.  
  177. /* @@ begin of epilog @@ */
  178.  
  179. #ifdef __cplusplus
  180. }
  181. #endif
  182.  
  183. #endif
  184.