langinfo.in.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. /* Substitute for and wrapper around <langinfo.h>.
  2. Copyright (C) 2009-2014 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 Lesser General Public License as published by
  5. the Free Software Foundation; either version 2, 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 Lesser General Public License for more details.
  11. You should have received a copy of the GNU Lesser General Public License
  12. along with this program; if not, see <http://www.gnu.org/licenses/>. */
  13. /*
  14. * POSIX <langinfo.h> for platforms that lack it or have an incomplete one.
  15. * <http://www.opengroup.org/onlinepubs/9699919799/basedefs/langinfo.h.html>
  16. */
  17. #ifndef _@GUARD_PREFIX@_LANGINFO_H
  18. #if __GNUC__ >= 3
  19. @PRAGMA_SYSTEM_HEADER@
  20. #endif
  21. @PRAGMA_COLUMNS@
  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 _@GUARD_PREFIX@_LANGINFO_H
  27. #define _@GUARD_PREFIX@_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. # if !GNULIB_defined_nl_item
  32. typedef int nl_item;
  33. # define GNULIB_defined_nl_item 1
  34. # endif
  35. /* nl_langinfo items of the LC_CTYPE category */
  36. # define CODESET 10000
  37. /* nl_langinfo items of the LC_NUMERIC category */
  38. # define RADIXCHAR 10001
  39. # define THOUSEP 10002
  40. /* nl_langinfo items of the LC_TIME category */
  41. # define D_T_FMT 10003
  42. # define D_FMT 10004
  43. # define T_FMT 10005
  44. # define T_FMT_AMPM 10006
  45. # define AM_STR 10007
  46. # define PM_STR 10008
  47. # define DAY_1 10009
  48. # define DAY_2 (DAY_1 + 1)
  49. # define DAY_3 (DAY_1 + 2)
  50. # define DAY_4 (DAY_1 + 3)
  51. # define DAY_5 (DAY_1 + 4)
  52. # define DAY_6 (DAY_1 + 5)
  53. # define DAY_7 (DAY_1 + 6)
  54. # define ABDAY_1 10016
  55. # define ABDAY_2 (ABDAY_1 + 1)
  56. # define ABDAY_3 (ABDAY_1 + 2)
  57. # define ABDAY_4 (ABDAY_1 + 3)
  58. # define ABDAY_5 (ABDAY_1 + 4)
  59. # define ABDAY_6 (ABDAY_1 + 5)
  60. # define ABDAY_7 (ABDAY_1 + 6)
  61. # define MON_1 10023
  62. # define MON_2 (MON_1 + 1)
  63. # define MON_3 (MON_1 + 2)
  64. # define MON_4 (MON_1 + 3)
  65. # define MON_5 (MON_1 + 4)
  66. # define MON_6 (MON_1 + 5)
  67. # define MON_7 (MON_1 + 6)
  68. # define MON_8 (MON_1 + 7)
  69. # define MON_9 (MON_1 + 8)
  70. # define MON_10 (MON_1 + 9)
  71. # define MON_11 (MON_1 + 10)
  72. # define MON_12 (MON_1 + 11)
  73. # define ABMON_1 10035
  74. # define ABMON_2 (ABMON_1 + 1)
  75. # define ABMON_3 (ABMON_1 + 2)
  76. # define ABMON_4 (ABMON_1 + 3)
  77. # define ABMON_5 (ABMON_1 + 4)
  78. # define ABMON_6 (ABMON_1 + 5)
  79. # define ABMON_7 (ABMON_1 + 6)
  80. # define ABMON_8 (ABMON_1 + 7)
  81. # define ABMON_9 (ABMON_1 + 8)
  82. # define ABMON_10 (ABMON_1 + 9)
  83. # define ABMON_11 (ABMON_1 + 10)
  84. # define ABMON_12 (ABMON_1 + 11)
  85. # define ERA 10047
  86. # define ERA_D_FMT 10048
  87. # define ERA_D_T_FMT 10049
  88. # define ERA_T_FMT 10050
  89. # define ALT_DIGITS 10051
  90. /* nl_langinfo items of the LC_MONETARY category */
  91. # define CRNCYSTR 10052
  92. /* nl_langinfo items of the LC_MESSAGES category */
  93. # define YESEXPR 10053
  94. # define NOEXPR 10054
  95. #else
  96. /* A platform that has <langinfo.h>. */
  97. # if !@HAVE_LANGINFO_CODESET@
  98. # define CODESET 10000
  99. # define GNULIB_defined_CODESET 1
  100. # endif
  101. # if !@HAVE_LANGINFO_T_FMT_AMPM@
  102. # define T_FMT_AMPM 10006
  103. # define GNULIB_defined_T_FMT_AMPM 1
  104. # endif
  105. # if !@HAVE_LANGINFO_ERA@
  106. # define ERA 10047
  107. # define ERA_D_FMT 10048
  108. # define ERA_D_T_FMT 10049
  109. # define ERA_T_FMT 10050
  110. # define ALT_DIGITS 10051
  111. # define GNULIB_defined_ERA 1
  112. # endif
  113. # if !@HAVE_LANGINFO_YESEXPR@
  114. # define YESEXPR 10053
  115. # define NOEXPR 10054
  116. # define GNULIB_defined_YESEXPR 1
  117. # endif
  118. #endif
  119. /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
  120. /* The definition of _GL_WARN_ON_USE is copied here. */
  121. /* Declare overridden functions. */
  122. /* Return a piece of locale dependent information.
  123. Note: The difference between nl_langinfo (CODESET) and locale_charset ()
  124. is that the latter normalizes the encoding names to GNU conventions. */
  125. #if @GNULIB_NL_LANGINFO@
  126. # if @REPLACE_NL_LANGINFO@
  127. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  128. # undef nl_langinfo
  129. # define nl_langinfo rpl_nl_langinfo
  130. # endif
  131. _GL_FUNCDECL_RPL (nl_langinfo, char *, (nl_item item));
  132. _GL_CXXALIAS_RPL (nl_langinfo, char *, (nl_item item));
  133. # else
  134. # if !@HAVE_NL_LANGINFO@
  135. _GL_FUNCDECL_SYS (nl_langinfo, char *, (nl_item item));
  136. # endif
  137. _GL_CXXALIAS_SYS (nl_langinfo, char *, (nl_item item));
  138. # endif
  139. _GL_CXXALIASWARN (nl_langinfo);
  140. #elif defined GNULIB_POSIXCHECK
  141. # undef nl_langinfo
  142. # if HAVE_RAW_DECL_NL_LANGINFO
  143. _GL_WARN_ON_USE (nl_langinfo, "nl_langinfo is not portable - "
  144. "use gnulib module nl_langinfo for portability");
  145. # endif
  146. #endif
  147. #endif /* _@GUARD_PREFIX@_LANGINFO_H */
  148. #endif /* _@GUARD_PREFIX@_LANGINFO_H */