intl-compat.c 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. /* intl-compat.c - Stub functions to call gettext functions from GNU gettext
  2. Library.
  3. Copyright (C) 1995, 2000-2003 Software Foundation, Inc.
  4. This program is free software; you can redistribute it and/or modify it
  5. under the terms of the GNU Library General Public License as published
  6. by the Free Software Foundation; either version 2, or (at your option)
  7. any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Library General Public License for more details.
  12. You should have received a copy of the GNU Library General Public
  13. License along with this program; if not, write to the Free Software
  14. Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301,
  15. USA. */
  16. #ifdef HAVE_CONFIG_H
  17. # include <config.h>
  18. #endif
  19. #include "gettextP.h"
  20. /* @@ end of prolog @@ */
  21. /* This file redirects the gettext functions (without prefix) to those
  22. defined in the included GNU libintl library (with "libintl_" prefix).
  23. It is compiled into libintl in order to make the AM_GNU_GETTEXT test
  24. of gettext <= 0.11.2 work with the libintl library >= 0.11.3 which
  25. has the redirections primarily in the <libintl.h> include file.
  26. It is also compiled into libgnuintl so that libgnuintl.so can be used
  27. as LD_PRELOADable library on glibc systems, to provide the extra
  28. features that the functions in the libc don't have (namely, logging). */
  29. #undef gettext
  30. #undef dgettext
  31. #undef dcgettext
  32. #undef ngettext
  33. #undef dngettext
  34. #undef dcngettext
  35. #undef textdomain
  36. #undef bindtextdomain
  37. #undef bind_textdomain_codeset
  38. /* When building a DLL, we must export some functions. Note that because
  39. the functions are only defined for binary backward compatibility, we
  40. don't need to use __declspec(dllimport) in any case. */
  41. #if defined _MSC_VER && BUILDING_DLL
  42. # define DLL_EXPORTED __declspec(dllexport)
  43. #else
  44. # define DLL_EXPORTED
  45. #endif
  46. DLL_EXPORTED
  47. char *
  48. gettext (msgid)
  49. const char *msgid;
  50. {
  51. return libintl_gettext (msgid);
  52. }
  53. DLL_EXPORTED
  54. char *
  55. dgettext (domainname, msgid)
  56. const char *domainname;
  57. const char *msgid;
  58. {
  59. return libintl_dgettext (domainname, msgid);
  60. }
  61. DLL_EXPORTED
  62. char *
  63. dcgettext (domainname, msgid, category)
  64. const char *domainname;
  65. const char *msgid;
  66. int category;
  67. {
  68. return libintl_dcgettext (domainname, msgid, category);
  69. }
  70. DLL_EXPORTED
  71. char *
  72. ngettext (msgid1, msgid2, n)
  73. const char *msgid1;
  74. const char *msgid2;
  75. unsigned long int n;
  76. {
  77. return libintl_ngettext (msgid1, msgid2, n);
  78. }
  79. DLL_EXPORTED
  80. char *
  81. dngettext (domainname, msgid1, msgid2, n)
  82. const char *domainname;
  83. const char *msgid1;
  84. const char *msgid2;
  85. unsigned long int n;
  86. {
  87. return libintl_dngettext (domainname, msgid1, msgid2, n);
  88. }
  89. DLL_EXPORTED
  90. char *
  91. dcngettext (domainname, msgid1, msgid2, n, category)
  92. const char *domainname;
  93. const char *msgid1;
  94. const char *msgid2;
  95. unsigned long int n;
  96. int category;
  97. {
  98. return libintl_dcngettext (domainname, msgid1, msgid2, n, category);
  99. }
  100. DLL_EXPORTED
  101. char *
  102. textdomain (domainname)
  103. const char *domainname;
  104. {
  105. return libintl_textdomain (domainname);
  106. }
  107. DLL_EXPORTED
  108. char *
  109. bindtextdomain (domainname, dirname)
  110. const char *domainname;
  111. const char *dirname;
  112. {
  113. return libintl_bindtextdomain (domainname, dirname);
  114. }
  115. DLL_EXPORTED
  116. char *
  117. bind_textdomain_codeset (domainname, codeset)
  118. const char *domainname;
  119. const char *codeset;
  120. {
  121. return libintl_bind_textdomain_codeset (domainname, codeset);
  122. }