langinfo.in.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. /* Substitute for and wrapper around <langinfo.h>.
  2. Copyright (C) 2009, 2010 Free Software Foundation, Inc.
  3. This program is free software; you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation; either version 3, or (at your option)
  6. any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program; if not, write to the Free Software Foundation,
  13. Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
  14. /*
  15. * POSIX <langinfo.h> for platforms that lack it or have an incomplete one.
  16. * <http://www.opengroup.org/onlinepubs/9699919799/basedefs/langinfo.h.html>
  17. */
  18. #ifndef _GL_LANGINFO_H
  19. #if __GNUC__ >= 3
  20. @PRAGMA_SYSTEM_HEADER@
  21. #endif
  22. /* The include_next requires a split double-inclusion guard. */
  23. #if @HAVE_LANGINFO_H@
  24. # @INCLUDE_NEXT@ @NEXT_LANGINFO_H@
  25. #endif
  26. #ifndef _GL_LANGINFO_H
  27. #define _GL_LANGINFO_H
  28. #if !@HAVE_LANGINFO_H@
  29. /* A platform that lacks <langinfo.h>. */
  30. /* Assume that it also lacks <nl_types.h> and the nl_item type. */
  31. typedef int nl_item;
  32. /* nl_langinfo items of the LC_CTYPE category */
  33. # define CODESET 10000
  34. /* nl_langinfo items of the LC_NUMERIC category */
  35. # define RADIXCHAR 10001
  36. # define THOUSEP 10002
  37. /* nl_langinfo items of the LC_TIME category */
  38. # define D_T_FMT 10003
  39. # define D_FMT 10004
  40. # define T_FMT 10005
  41. # define T_FMT_AMPM 10006
  42. # define AM_STR 10007
  43. # define PM_STR 10008
  44. # define DAY_1 10009
  45. # define DAY_2 (DAY_1 + 1)
  46. # define DAY_3 (DAY_1 + 2)
  47. # define DAY_4 (DAY_1 + 3)
  48. # define DAY_5 (DAY_1 + 4)
  49. # define DAY_6 (DAY_1 + 5)
  50. # define DAY_7 (DAY_1 + 6)
  51. # define ABDAY_1 10016
  52. # define ABDAY_2 (ABDAY_1 + 1)
  53. # define ABDAY_3 (ABDAY_1 + 2)
  54. # define ABDAY_4 (ABDAY_1 + 3)
  55. # define ABDAY_5 (ABDAY_1 + 4)
  56. # define ABDAY_6 (ABDAY_1 + 5)
  57. # define ABDAY_7 (ABDAY_1 + 6)
  58. # define MON_1 10023
  59. # define MON_2 (MON_1 + 1)
  60. # define MON_3 (MON_1 + 2)
  61. # define MON_4 (MON_1 + 3)
  62. # define MON_5 (MON_1 + 4)
  63. # define MON_6 (MON_1 + 5)
  64. # define MON_7 (MON_1 + 6)
  65. # define MON_8 (MON_1 + 7)
  66. # define MON_9 (MON_1 + 8)
  67. # define MON_10 (MON_1 + 9)
  68. # define MON_11 (MON_1 + 10)
  69. # define MON_12 (MON_1 + 11)
  70. # define ABMON_1 10035
  71. # define ABMON_2 (ABMON_1 + 1)
  72. # define ABMON_3 (ABMON_1 + 2)
  73. # define ABMON_4 (ABMON_1 + 3)
  74. # define ABMON_5 (ABMON_1 + 4)
  75. # define ABMON_6 (ABMON_1 + 5)
  76. # define ABMON_7 (ABMON_1 + 6)
  77. # define ABMON_8 (ABMON_1 + 7)
  78. # define ABMON_9 (ABMON_1 + 8)
  79. # define ABMON_10 (ABMON_1 + 9)
  80. # define ABMON_11 (ABMON_1 + 10)
  81. # define ABMON_12 (ABMON_1 + 11)
  82. # define ERA 10047
  83. # define ERA_D_FMT 10048
  84. # define ERA_D_T_FMT 10049
  85. # define ERA_T_FMT 10050
  86. # define ALT_DIGITS 10051
  87. /* nl_langinfo items of the LC_MONETARY category */
  88. # define CRNCYSTR 10052
  89. /* nl_langinfo items of the LC_MESSAGES category */
  90. # define YESEXPR 10053
  91. # define NOEXPR 10054
  92. #else
  93. /* A platform that has <langinfo.h>. */
  94. # if !@HAVE_LANGINFO_CODESET@
  95. # define CODESET 10000
  96. # define GNULIB_defined_CODESET 1
  97. # endif
  98. # if !@HAVE_LANGINFO_ERA@
  99. # define ERA 10047
  100. # define ERA_D_FMT 10048
  101. # define ERA_D_T_FMT 10049
  102. # define ERA_T_FMT 10050
  103. # define ALT_DIGITS 10051
  104. # define GNULIB_defined_ERA 1
  105. # endif
  106. #endif
  107. /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
  108. /* The definition of _GL_WARN_ON_USE is copied here. */
  109. /* Declare overridden functions. */
  110. /* Return a piece of locale dependent information.
  111. Note: The difference between nl_langinfo (CODESET) and locale_charset ()
  112. is that the latter normalizes the encoding names to GNU conventions. */
  113. #if @GNULIB_NL_LANGINFO@
  114. # if @REPLACE_NL_LANGINFO@
  115. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  116. # undef nl_langinfo
  117. # define nl_langinfo rpl_nl_langinfo
  118. # endif
  119. _GL_FUNCDECL_RPL (nl_langinfo, char *, (nl_item item));
  120. _GL_CXXALIAS_RPL (nl_langinfo, char *, (nl_item item));
  121. # else
  122. # if !@HAVE_NL_LANGINFO@
  123. _GL_FUNCDECL_SYS (nl_langinfo, char *, (nl_item item));
  124. # endif
  125. _GL_CXXALIAS_SYS (nl_langinfo, char *, (nl_item item));
  126. # endif
  127. _GL_CXXALIASWARN (nl_langinfo);
  128. #elif defined GNULIB_POSIXCHECK
  129. # undef nl_langinfo
  130. # if HAVE_RAW_DECL_NL_LANGINFO
  131. _GL_WARN_ON_USE (nl_langinfo, "nl_langinfo is not portable - "
  132. "use gnulib module nl_langinfo for portability");
  133. # endif
  134. #endif
  135. #endif /* _GL_LANGINFO_H */
  136. #endif /* _GL_LANGINFO_H */