langinfo.in.h 5.2 KB

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