langinfo.in.h 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. /* Substitute for and wrapper around <langinfo.h>.
  2. Copyright (C) 2009-2023 Free Software Foundation, Inc.
  3. This file is free software: you can redistribute it and/or modify
  4. it under the terms of the GNU Lesser General Public License as
  5. published by the Free Software Foundation; either version 2.1 of the
  6. License, or (at your option) any later version.
  7. This file 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 <https://www.gnu.org/licenses/>. */
  13. /*
  14. * POSIX <langinfo.h> for platforms that lack it or have an incomplete one.
  15. * <https://pubs.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 ALTMON_1 10200
  77. # define ALTMON_2 (ALTMON_1 + 1)
  78. # define ALTMON_3 (ALTMON_1 + 2)
  79. # define ALTMON_4 (ALTMON_1 + 3)
  80. # define ALTMON_5 (ALTMON_1 + 4)
  81. # define ALTMON_6 (ALTMON_1 + 5)
  82. # define ALTMON_7 (ALTMON_1 + 6)
  83. # define ALTMON_8 (ALTMON_1 + 7)
  84. # define ALTMON_9 (ALTMON_1 + 8)
  85. # define ALTMON_10 (ALTMON_1 + 9)
  86. # define ALTMON_11 (ALTMON_1 + 10)
  87. # define ALTMON_12 (ALTMON_1 + 11)
  88. # define ABMON_1 10035
  89. # define ABMON_2 (ABMON_1 + 1)
  90. # define ABMON_3 (ABMON_1 + 2)
  91. # define ABMON_4 (ABMON_1 + 3)
  92. # define ABMON_5 (ABMON_1 + 4)
  93. # define ABMON_6 (ABMON_1 + 5)
  94. # define ABMON_7 (ABMON_1 + 6)
  95. # define ABMON_8 (ABMON_1 + 7)
  96. # define ABMON_9 (ABMON_1 + 8)
  97. # define ABMON_10 (ABMON_1 + 9)
  98. # define ABMON_11 (ABMON_1 + 10)
  99. # define ABMON_12 (ABMON_1 + 11)
  100. # define ERA 10047
  101. # define ERA_D_FMT 10048
  102. # define ERA_D_T_FMT 10049
  103. # define ERA_T_FMT 10050
  104. # define ALT_DIGITS 10051
  105. /* nl_langinfo items of the LC_MONETARY category */
  106. # define CRNCYSTR 10052
  107. # define CURRENCY_SYMBOL CRNCYSTR
  108. # define INT_CURR_SYMBOL 10100
  109. # define MON_DECIMAL_POINT 10101
  110. # define MON_THOUSANDS_SEP 10102
  111. # define MON_GROUPING 10103
  112. # define POSITIVE_SIGN 10104
  113. # define NEGATIVE_SIGN 10105
  114. # define FRAC_DIGITS 10106
  115. # define INT_FRAC_DIGITS 10107
  116. # define P_CS_PRECEDES 10108
  117. # define N_CS_PRECEDES 10109
  118. # define P_SEP_BY_SPACE 10110
  119. # define N_SEP_BY_SPACE 10111
  120. # define P_SIGN_POSN 10112
  121. # define N_SIGN_POSN 10113
  122. /* nl_langinfo items of the LC_MESSAGES category */
  123. # define YESEXPR 10053
  124. # define NOEXPR 10054
  125. #else
  126. /* A platform that has <langinfo.h>. */
  127. # if !@HAVE_LANGINFO_CODESET@
  128. # define CODESET 10000
  129. # define GNULIB_defined_CODESET 1
  130. # endif
  131. # if !@HAVE_LANGINFO_T_FMT_AMPM@
  132. # define T_FMT_AMPM 10006
  133. # define GNULIB_defined_T_FMT_AMPM 1
  134. # endif
  135. # if !@HAVE_LANGINFO_ALTMON@
  136. # define ALTMON_1 10200
  137. # define ALTMON_2 (ALTMON_1 + 1)
  138. # define ALTMON_3 (ALTMON_1 + 2)
  139. # define ALTMON_4 (ALTMON_1 + 3)
  140. # define ALTMON_5 (ALTMON_1 + 4)
  141. # define ALTMON_6 (ALTMON_1 + 5)
  142. # define ALTMON_7 (ALTMON_1 + 6)
  143. # define ALTMON_8 (ALTMON_1 + 7)
  144. # define ALTMON_9 (ALTMON_1 + 8)
  145. # define ALTMON_10 (ALTMON_1 + 9)
  146. # define ALTMON_11 (ALTMON_1 + 10)
  147. # define ALTMON_12 (ALTMON_1 + 11)
  148. # define GNULIB_defined_ALTMON 1
  149. # endif
  150. # if !@HAVE_LANGINFO_ERA@
  151. # define ERA 10047
  152. # define ERA_D_FMT 10048
  153. # define ERA_D_T_FMT 10049
  154. # define ERA_T_FMT 10050
  155. # define ALT_DIGITS 10051
  156. # define GNULIB_defined_ERA 1
  157. # endif
  158. # if !@HAVE_LANGINFO_YESEXPR@
  159. # define YESEXPR 10053
  160. # define NOEXPR 10054
  161. # define GNULIB_defined_YESEXPR 1
  162. # endif
  163. #endif
  164. /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
  165. /* The definition of _GL_WARN_ON_USE is copied here. */
  166. /* Declare overridden functions. */
  167. /* Return a piece of locale dependent information.
  168. Note: The difference between nl_langinfo (CODESET) and locale_charset ()
  169. is that the latter normalizes the encoding names to GNU conventions. */
  170. #if @GNULIB_NL_LANGINFO@
  171. # if @REPLACE_NL_LANGINFO@
  172. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  173. # undef nl_langinfo
  174. # define nl_langinfo rpl_nl_langinfo
  175. # endif
  176. _GL_FUNCDECL_RPL (nl_langinfo, char *, (nl_item item));
  177. _GL_CXXALIAS_RPL (nl_langinfo, char *, (nl_item item));
  178. # else
  179. # if !@HAVE_NL_LANGINFO@
  180. _GL_FUNCDECL_SYS (nl_langinfo, char *, (nl_item item));
  181. # endif
  182. _GL_CXXALIAS_SYS (nl_langinfo, char *, (nl_item item));
  183. # endif
  184. _GL_CXXALIASWARN (nl_langinfo);
  185. #elif defined GNULIB_POSIXCHECK
  186. # undef nl_langinfo
  187. # if HAVE_RAW_DECL_NL_LANGINFO
  188. _GL_WARN_ON_USE (nl_langinfo, "nl_langinfo is not portable - "
  189. "use gnulib module nl_langinfo for portability");
  190. # endif
  191. #endif
  192. #endif /* _@GUARD_PREFIX@_LANGINFO_H */
  193. #endif /* _@GUARD_PREFIX@_LANGINFO_H */