langinfo.in.h 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. /* Substitute for and wrapper around <langinfo.h>.
  2. Copyright (C) 2009-2017 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 DECIMAL_POINT RADIXCHAR
  40. # define THOUSEP 10002
  41. # define THOUSANDS_SEP THOUSEP
  42. # define GROUPING 10114
  43. /* nl_langinfo items of the LC_TIME category */
  44. # define D_T_FMT 10003
  45. # define D_FMT 10004
  46. # define T_FMT 10005
  47. # define T_FMT_AMPM 10006
  48. # define AM_STR 10007
  49. # define PM_STR 10008
  50. # define DAY_1 10009
  51. # define DAY_2 (DAY_1 + 1)
  52. # define DAY_3 (DAY_1 + 2)
  53. # define DAY_4 (DAY_1 + 3)
  54. # define DAY_5 (DAY_1 + 4)
  55. # define DAY_6 (DAY_1 + 5)
  56. # define DAY_7 (DAY_1 + 6)
  57. # define ABDAY_1 10016
  58. # define ABDAY_2 (ABDAY_1 + 1)
  59. # define ABDAY_3 (ABDAY_1 + 2)
  60. # define ABDAY_4 (ABDAY_1 + 3)
  61. # define ABDAY_5 (ABDAY_1 + 4)
  62. # define ABDAY_6 (ABDAY_1 + 5)
  63. # define ABDAY_7 (ABDAY_1 + 6)
  64. # define MON_1 10023
  65. # define MON_2 (MON_1 + 1)
  66. # define MON_3 (MON_1 + 2)
  67. # define MON_4 (MON_1 + 3)
  68. # define MON_5 (MON_1 + 4)
  69. # define MON_6 (MON_1 + 5)
  70. # define MON_7 (MON_1 + 6)
  71. # define MON_8 (MON_1 + 7)
  72. # define MON_9 (MON_1 + 8)
  73. # define MON_10 (MON_1 + 9)
  74. # define MON_11 (MON_1 + 10)
  75. # define MON_12 (MON_1 + 11)
  76. # define ABMON_1 10035
  77. # define ABMON_2 (ABMON_1 + 1)
  78. # define ABMON_3 (ABMON_1 + 2)
  79. # define ABMON_4 (ABMON_1 + 3)
  80. # define ABMON_5 (ABMON_1 + 4)
  81. # define ABMON_6 (ABMON_1 + 5)
  82. # define ABMON_7 (ABMON_1 + 6)
  83. # define ABMON_8 (ABMON_1 + 7)
  84. # define ABMON_9 (ABMON_1 + 8)
  85. # define ABMON_10 (ABMON_1 + 9)
  86. # define ABMON_11 (ABMON_1 + 10)
  87. # define ABMON_12 (ABMON_1 + 11)
  88. # define ERA 10047
  89. # define ERA_D_FMT 10048
  90. # define ERA_D_T_FMT 10049
  91. # define ERA_T_FMT 10050
  92. # define ALT_DIGITS 10051
  93. /* nl_langinfo items of the LC_MONETARY category */
  94. # define CRNCYSTR 10052
  95. # define CURRENCY_SYMBOL CRNCYSTR
  96. # define INT_CURR_SYMBOL 10100
  97. # define MON_DECIMAL_POINT 10101
  98. # define MON_THOUSANDS_SEP 10102
  99. # define MON_GROUPING 10103
  100. # define POSITIVE_SIGN 10104
  101. # define NEGATIVE_SIGN 10105
  102. # define FRAC_DIGITS 10106
  103. # define INT_FRAC_DIGITS 10107
  104. # define P_CS_PRECEDES 10108
  105. # define N_CS_PRECEDES 10109
  106. # define P_SEP_BY_SPACE 10110
  107. # define N_SEP_BY_SPACE 10111
  108. # define P_SIGN_POSN 10112
  109. # define N_SIGN_POSN 10113
  110. /* nl_langinfo items of the LC_MESSAGES category */
  111. # define YESEXPR 10053
  112. # define NOEXPR 10054
  113. #else
  114. /* A platform that has <langinfo.h>. */
  115. # if !@HAVE_LANGINFO_CODESET@
  116. # define CODESET 10000
  117. # define GNULIB_defined_CODESET 1
  118. # endif
  119. # if !@HAVE_LANGINFO_T_FMT_AMPM@
  120. # define T_FMT_AMPM 10006
  121. # define GNULIB_defined_T_FMT_AMPM 1
  122. # endif
  123. # if !@HAVE_LANGINFO_ERA@
  124. # define ERA 10047
  125. # define ERA_D_FMT 10048
  126. # define ERA_D_T_FMT 10049
  127. # define ERA_T_FMT 10050
  128. # define ALT_DIGITS 10051
  129. # define GNULIB_defined_ERA 1
  130. # endif
  131. # if !@HAVE_LANGINFO_YESEXPR@
  132. # define YESEXPR 10053
  133. # define NOEXPR 10054
  134. # define GNULIB_defined_YESEXPR 1
  135. # endif
  136. #endif
  137. /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
  138. /* The definition of _GL_WARN_ON_USE is copied here. */
  139. /* Declare overridden functions. */
  140. /* Return a piece of locale dependent information.
  141. Note: The difference between nl_langinfo (CODESET) and locale_charset ()
  142. is that the latter normalizes the encoding names to GNU conventions. */
  143. #if @GNULIB_NL_LANGINFO@
  144. # if @REPLACE_NL_LANGINFO@
  145. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  146. # undef nl_langinfo
  147. # define nl_langinfo rpl_nl_langinfo
  148. # endif
  149. _GL_FUNCDECL_RPL (nl_langinfo, char *, (nl_item item));
  150. _GL_CXXALIAS_RPL (nl_langinfo, char *, (nl_item item));
  151. # else
  152. # if !@HAVE_NL_LANGINFO@
  153. _GL_FUNCDECL_SYS (nl_langinfo, char *, (nl_item item));
  154. # endif
  155. _GL_CXXALIAS_SYS (nl_langinfo, char *, (nl_item item));
  156. # endif
  157. _GL_CXXALIASWARN (nl_langinfo);
  158. #elif defined GNULIB_POSIXCHECK
  159. # undef nl_langinfo
  160. # if HAVE_RAW_DECL_NL_LANGINFO
  161. _GL_WARN_ON_USE (nl_langinfo, "nl_langinfo is not portable - "
  162. "use gnulib module nl_langinfo for portability");
  163. # endif
  164. #endif
  165. #endif /* _@GUARD_PREFIX@_LANGINFO_H */
  166. #endif /* _@GUARD_PREFIX@_LANGINFO_H */