langinfo.h 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478
  1. /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
  2. /* Substitute for and wrapper around <langinfo.h>.
  3. Copyright (C) 2009-2013 Free Software Foundation, Inc.
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 3, or (at your option)
  7. any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; if not, see <http://www.gnu.org/licenses/>. */
  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_M4_LANGINFO_H
  19. #if __GNUC__ >= 3
  20. #endif
  21. /* The include_next requires a split double-inclusion guard. */
  22. #if 0
  23. # include <langinfo.h>
  24. #endif
  25. #ifndef _GL_M4_LANGINFO_H
  26. #define _GL_M4_LANGINFO_H
  27. #if !0
  28. /* A platform that lacks <langinfo.h>. */
  29. /* Assume that it also lacks <nl_types.h> and the nl_item type. */
  30. # if !GNULIB_defined_nl_item
  31. typedef int nl_item;
  32. # define GNULIB_defined_nl_item 1
  33. # endif
  34. /* nl_langinfo items of the LC_CTYPE category */
  35. # define CODESET 10000
  36. /* nl_langinfo items of the LC_NUMERIC category */
  37. # define RADIXCHAR 10001
  38. # define THOUSEP 10002
  39. /* nl_langinfo items of the LC_TIME category */
  40. # define D_T_FMT 10003
  41. # define D_FMT 10004
  42. # define T_FMT 10005
  43. # define T_FMT_AMPM 10006
  44. # define AM_STR 10007
  45. # define PM_STR 10008
  46. # define DAY_1 10009
  47. # define DAY_2 (DAY_1 + 1)
  48. # define DAY_3 (DAY_1 + 2)
  49. # define DAY_4 (DAY_1 + 3)
  50. # define DAY_5 (DAY_1 + 4)
  51. # define DAY_6 (DAY_1 + 5)
  52. # define DAY_7 (DAY_1 + 6)
  53. # define ABDAY_1 10016
  54. # define ABDAY_2 (ABDAY_1 + 1)
  55. # define ABDAY_3 (ABDAY_1 + 2)
  56. # define ABDAY_4 (ABDAY_1 + 3)
  57. # define ABDAY_5 (ABDAY_1 + 4)
  58. # define ABDAY_6 (ABDAY_1 + 5)
  59. # define ABDAY_7 (ABDAY_1 + 6)
  60. # define MON_1 10023
  61. # define MON_2 (MON_1 + 1)
  62. # define MON_3 (MON_1 + 2)
  63. # define MON_4 (MON_1 + 3)
  64. # define MON_5 (MON_1 + 4)
  65. # define MON_6 (MON_1 + 5)
  66. # define MON_7 (MON_1 + 6)
  67. # define MON_8 (MON_1 + 7)
  68. # define MON_9 (MON_1 + 8)
  69. # define MON_10 (MON_1 + 9)
  70. # define MON_11 (MON_1 + 10)
  71. # define MON_12 (MON_1 + 11)
  72. # define ABMON_1 10035
  73. # define ABMON_2 (ABMON_1 + 1)
  74. # define ABMON_3 (ABMON_1 + 2)
  75. # define ABMON_4 (ABMON_1 + 3)
  76. # define ABMON_5 (ABMON_1 + 4)
  77. # define ABMON_6 (ABMON_1 + 5)
  78. # define ABMON_7 (ABMON_1 + 6)
  79. # define ABMON_8 (ABMON_1 + 7)
  80. # define ABMON_9 (ABMON_1 + 8)
  81. # define ABMON_10 (ABMON_1 + 9)
  82. # define ABMON_11 (ABMON_1 + 10)
  83. # define ABMON_12 (ABMON_1 + 11)
  84. # define ERA 10047
  85. # define ERA_D_FMT 10048
  86. # define ERA_D_T_FMT 10049
  87. # define ERA_T_FMT 10050
  88. # define ALT_DIGITS 10051
  89. /* nl_langinfo items of the LC_MONETARY category */
  90. # define CRNCYSTR 10052
  91. /* nl_langinfo items of the LC_MESSAGES category */
  92. # define YESEXPR 10053
  93. # define NOEXPR 10054
  94. #else
  95. /* A platform that has <langinfo.h>. */
  96. # if !0
  97. # define CODESET 10000
  98. # define GNULIB_defined_CODESET 1
  99. # endif
  100. # if !0
  101. # define T_FMT_AMPM 10006
  102. # define GNULIB_defined_T_FMT_AMPM 1
  103. # endif
  104. # if !0
  105. # define ERA 10047
  106. # define ERA_D_FMT 10048
  107. # define ERA_D_T_FMT 10049
  108. # define ERA_T_FMT 10050
  109. # define ALT_DIGITS 10051
  110. # define GNULIB_defined_ERA 1
  111. # endif
  112. # if !0
  113. # define YESEXPR 10053
  114. # define NOEXPR 10054
  115. # define GNULIB_defined_YESEXPR 1
  116. # endif
  117. #endif
  118. /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
  119. #ifndef _GL_CXXDEFS_H
  120. #define _GL_CXXDEFS_H
  121. /* The three most frequent use cases of these macros are:
  122. * For providing a substitute for a function that is missing on some
  123. platforms, but is declared and works fine on the platforms on which
  124. it exists:
  125. #if @GNULIB_FOO@
  126. # if !@HAVE_FOO@
  127. _GL_FUNCDECL_SYS (foo, ...);
  128. # endif
  129. _GL_CXXALIAS_SYS (foo, ...);
  130. _GL_CXXALIASWARN (foo);
  131. #elif defined GNULIB_POSIXCHECK
  132. ...
  133. #endif
  134. * For providing a replacement for a function that exists on all platforms,
  135. but is broken/insufficient and needs to be replaced on some platforms:
  136. #if @GNULIB_FOO@
  137. # if @REPLACE_FOO@
  138. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  139. # undef foo
  140. # define foo rpl_foo
  141. # endif
  142. _GL_FUNCDECL_RPL (foo, ...);
  143. _GL_CXXALIAS_RPL (foo, ...);
  144. # else
  145. _GL_CXXALIAS_SYS (foo, ...);
  146. # endif
  147. _GL_CXXALIASWARN (foo);
  148. #elif defined GNULIB_POSIXCHECK
  149. ...
  150. #endif
  151. * For providing a replacement for a function that exists on some platforms
  152. but is broken/insufficient and needs to be replaced on some of them and
  153. is additionally either missing or undeclared on some other platforms:
  154. #if @GNULIB_FOO@
  155. # if @REPLACE_FOO@
  156. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  157. # undef foo
  158. # define foo rpl_foo
  159. # endif
  160. _GL_FUNCDECL_RPL (foo, ...);
  161. _GL_CXXALIAS_RPL (foo, ...);
  162. # else
  163. # if !@HAVE_FOO@ or if !@HAVE_DECL_FOO@
  164. _GL_FUNCDECL_SYS (foo, ...);
  165. # endif
  166. _GL_CXXALIAS_SYS (foo, ...);
  167. # endif
  168. _GL_CXXALIASWARN (foo);
  169. #elif defined GNULIB_POSIXCHECK
  170. ...
  171. #endif
  172. */
  173. /* _GL_EXTERN_C declaration;
  174. performs the declaration with C linkage. */
  175. #if defined __cplusplus
  176. # define _GL_EXTERN_C extern "C"
  177. #else
  178. # define _GL_EXTERN_C extern
  179. #endif
  180. /* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes);
  181. declares a replacement function, named rpl_func, with the given prototype,
  182. consisting of return type, parameters, and attributes.
  183. Example:
  184. _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...)
  185. _GL_ARG_NONNULL ((1)));
  186. */
  187. #define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \
  188. _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes)
  189. #define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \
  190. _GL_EXTERN_C rettype rpl_func parameters_and_attributes
  191. /* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes);
  192. declares the system function, named func, with the given prototype,
  193. consisting of return type, parameters, and attributes.
  194. Example:
  195. _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...)
  196. _GL_ARG_NONNULL ((1)));
  197. */
  198. #define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \
  199. _GL_EXTERN_C rettype func parameters_and_attributes
  200. /* _GL_CXXALIAS_RPL (func, rettype, parameters);
  201. declares a C++ alias called GNULIB_NAMESPACE::func
  202. that redirects to rpl_func, if GNULIB_NAMESPACE is defined.
  203. Example:
  204. _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...));
  205. */
  206. #define _GL_CXXALIAS_RPL(func,rettype,parameters) \
  207. _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters)
  208. #if defined __cplusplus && defined GNULIB_NAMESPACE
  209. # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
  210. namespace GNULIB_NAMESPACE \
  211. { \
  212. rettype (*const func) parameters = ::rpl_func; \
  213. } \
  214. _GL_EXTERN_C int _gl_cxxalias_dummy
  215. #else
  216. # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
  217. _GL_EXTERN_C int _gl_cxxalias_dummy
  218. #endif
  219. /* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters);
  220. is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters);
  221. except that the C function rpl_func may have a slightly different
  222. declaration. A cast is used to silence the "invalid conversion" error
  223. that would otherwise occur. */
  224. #if defined __cplusplus && defined GNULIB_NAMESPACE
  225. # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
  226. namespace GNULIB_NAMESPACE \
  227. { \
  228. rettype (*const func) parameters = \
  229. reinterpret_cast<rettype(*)parameters>(::rpl_func); \
  230. } \
  231. _GL_EXTERN_C int _gl_cxxalias_dummy
  232. #else
  233. # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
  234. _GL_EXTERN_C int _gl_cxxalias_dummy
  235. #endif
  236. /* _GL_CXXALIAS_SYS (func, rettype, parameters);
  237. declares a C++ alias called GNULIB_NAMESPACE::func
  238. that redirects to the system provided function func, if GNULIB_NAMESPACE
  239. is defined.
  240. Example:
  241. _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
  242. */
  243. #if defined __cplusplus && defined GNULIB_NAMESPACE
  244. /* If we were to write
  245. rettype (*const func) parameters = ::func;
  246. like above in _GL_CXXALIAS_RPL_1, the compiler could optimize calls
  247. better (remove an indirection through a 'static' pointer variable),
  248. but then the _GL_CXXALIASWARN macro below would cause a warning not only
  249. for uses of ::func but also for uses of GNULIB_NAMESPACE::func. */
  250. # define _GL_CXXALIAS_SYS(func,rettype,parameters) \
  251. namespace GNULIB_NAMESPACE \
  252. { \
  253. static rettype (*func) parameters = ::func; \
  254. } \
  255. _GL_EXTERN_C int _gl_cxxalias_dummy
  256. #else
  257. # define _GL_CXXALIAS_SYS(func,rettype,parameters) \
  258. _GL_EXTERN_C int _gl_cxxalias_dummy
  259. #endif
  260. /* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters);
  261. is like _GL_CXXALIAS_SYS (func, rettype, parameters);
  262. except that the C function func may have a slightly different declaration.
  263. A cast is used to silence the "invalid conversion" error that would
  264. otherwise occur. */
  265. #if defined __cplusplus && defined GNULIB_NAMESPACE
  266. # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
  267. namespace GNULIB_NAMESPACE \
  268. { \
  269. static rettype (*func) parameters = \
  270. reinterpret_cast<rettype(*)parameters>(::func); \
  271. } \
  272. _GL_EXTERN_C int _gl_cxxalias_dummy
  273. #else
  274. # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
  275. _GL_EXTERN_C int _gl_cxxalias_dummy
  276. #endif
  277. /* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2);
  278. is like _GL_CXXALIAS_SYS (func, rettype, parameters);
  279. except that the C function is picked among a set of overloaded functions,
  280. namely the one with rettype2 and parameters2. Two consecutive casts
  281. are used to silence the "cannot find a match" and "invalid conversion"
  282. errors that would otherwise occur. */
  283. #if defined __cplusplus && defined GNULIB_NAMESPACE
  284. /* The outer cast must be a reinterpret_cast.
  285. The inner cast: When the function is defined as a set of overloaded
  286. functions, it works as a static_cast<>, choosing the designated variant.
  287. When the function is defined as a single variant, it works as a
  288. reinterpret_cast<>. The parenthesized cast syntax works both ways. */
  289. # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
  290. namespace GNULIB_NAMESPACE \
  291. { \
  292. static rettype (*func) parameters = \
  293. reinterpret_cast<rettype(*)parameters>( \
  294. (rettype2(*)parameters2)(::func)); \
  295. } \
  296. _GL_EXTERN_C int _gl_cxxalias_dummy
  297. #else
  298. # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
  299. _GL_EXTERN_C int _gl_cxxalias_dummy
  300. #endif
  301. /* _GL_CXXALIASWARN (func);
  302. causes a warning to be emitted when ::func is used but not when
  303. GNULIB_NAMESPACE::func is used. func must be defined without overloaded
  304. variants. */
  305. #if defined __cplusplus && defined GNULIB_NAMESPACE
  306. # define _GL_CXXALIASWARN(func) \
  307. _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE)
  308. # define _GL_CXXALIASWARN_1(func,namespace) \
  309. _GL_CXXALIASWARN_2 (func, namespace)
  310. /* To work around GCC bug <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
  311. we enable the warning only when not optimizing. */
  312. # if !__OPTIMIZE__
  313. # define _GL_CXXALIASWARN_2(func,namespace) \
  314. _GL_WARN_ON_USE (func, \
  315. "The symbol ::" #func " refers to the system function. " \
  316. "Use " #namespace "::" #func " instead.")
  317. # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
  318. # define _GL_CXXALIASWARN_2(func,namespace) \
  319. extern __typeof__ (func) func
  320. # else
  321. # define _GL_CXXALIASWARN_2(func,namespace) \
  322. _GL_EXTERN_C int _gl_cxxalias_dummy
  323. # endif
  324. #else
  325. # define _GL_CXXALIASWARN(func) \
  326. _GL_EXTERN_C int _gl_cxxalias_dummy
  327. #endif
  328. /* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes);
  329. causes a warning to be emitted when the given overloaded variant of ::func
  330. is used but not when GNULIB_NAMESPACE::func is used. */
  331. #if defined __cplusplus && defined GNULIB_NAMESPACE
  332. # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
  333. _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \
  334. GNULIB_NAMESPACE)
  335. # define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \
  336. _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace)
  337. /* To work around GCC bug <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
  338. we enable the warning only when not optimizing. */
  339. # if !__OPTIMIZE__
  340. # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
  341. _GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \
  342. "The symbol ::" #func " refers to the system function. " \
  343. "Use " #namespace "::" #func " instead.")
  344. # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
  345. # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
  346. extern __typeof__ (func) func
  347. # else
  348. # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
  349. _GL_EXTERN_C int _gl_cxxalias_dummy
  350. # endif
  351. #else
  352. # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
  353. _GL_EXTERN_C int _gl_cxxalias_dummy
  354. #endif
  355. #endif /* _GL_CXXDEFS_H */
  356. /* The definition of _GL_WARN_ON_USE is copied here. */
  357. #ifndef _GL_WARN_ON_USE
  358. # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
  359. /* A compiler attribute is available in gcc versions 4.3.0 and later. */
  360. # define _GL_WARN_ON_USE(function, message) \
  361. extern __typeof__ (function) function __attribute__ ((__warning__ (message)))
  362. # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
  363. /* Verify the existence of the function. */
  364. # define _GL_WARN_ON_USE(function, message) \
  365. extern __typeof__ (function) function
  366. # else /* Unsupported. */
  367. # define _GL_WARN_ON_USE(function, message) \
  368. _GL_WARN_EXTERN_C int _gl_warn_on_use
  369. # endif
  370. #endif
  371. /* _GL_WARN_ON_USE_CXX (function, rettype, parameters_and_attributes, "string")
  372. is like _GL_WARN_ON_USE (function, "string"), except that the function is
  373. declared with the given prototype, consisting of return type, parameters,
  374. and attributes.
  375. This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does
  376. not work in this case. */
  377. #ifndef _GL_WARN_ON_USE_CXX
  378. # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
  379. # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
  380. extern rettype function parameters_and_attributes \
  381. __attribute__ ((__warning__ (msg)))
  382. # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
  383. /* Verify the existence of the function. */
  384. # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
  385. extern rettype function parameters_and_attributes
  386. # else /* Unsupported. */
  387. # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
  388. _GL_WARN_EXTERN_C int _gl_warn_on_use
  389. # endif
  390. #endif
  391. /* _GL_WARN_EXTERN_C declaration;
  392. performs the declaration with C linkage. */
  393. #ifndef _GL_WARN_EXTERN_C
  394. # if defined __cplusplus
  395. # define _GL_WARN_EXTERN_C extern "C"
  396. # else
  397. # define _GL_WARN_EXTERN_C extern
  398. # endif
  399. #endif
  400. /* Declare overridden functions. */
  401. /* Return a piece of locale dependent information.
  402. Note: The difference between nl_langinfo (CODESET) and locale_charset ()
  403. is that the latter normalizes the encoding names to GNU conventions. */
  404. #if 1
  405. # if 0
  406. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  407. # undef nl_langinfo
  408. # define nl_langinfo rpl_nl_langinfo
  409. # endif
  410. _GL_FUNCDECL_RPL (nl_langinfo, char *, (nl_item item));
  411. _GL_CXXALIAS_RPL (nl_langinfo, char *, (nl_item item));
  412. # else
  413. # if !0
  414. _GL_FUNCDECL_SYS (nl_langinfo, char *, (nl_item item));
  415. # endif
  416. _GL_CXXALIAS_SYS (nl_langinfo, char *, (nl_item item));
  417. # endif
  418. _GL_CXXALIASWARN (nl_langinfo);
  419. #elif defined GNULIB_POSIXCHECK
  420. # undef nl_langinfo
  421. # if HAVE_RAW_DECL_NL_LANGINFO
  422. _GL_WARN_ON_USE (nl_langinfo, "nl_langinfo is not portable - "
  423. "use gnulib module nl_langinfo for portability");
  424. # endif
  425. #endif
  426. #endif /* _GL_M4_LANGINFO_H */
  427. #endif /* _GL_M4_LANGINFO_H */