c_locale.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. /*
  2. * Copyright (c) 1999
  3. * Silicon Graphics Computer Systems, Inc.
  4. *
  5. * Copyright (c) 1999
  6. * Boris Fomitchev
  7. *
  8. * This material is provided "as is", with absolutely no warranty expressed
  9. * or implied. Any use is at your own risk.
  10. *
  11. * Permission to use or copy this software for any purpose is hereby granted
  12. * without fee, provided the above notices are retained on all copies.
  13. * Permission to modify the code and to distribute modified code is granted,
  14. * provided the above notices are retained, and a notice that the code was
  15. * modified is included with the above copyright notice.
  16. *
  17. */
  18. #ifndef _STLP_C_LOCALE_H
  19. #define _STLP_C_LOCALE_H
  20. /*
  21. * Implementation dependent definitions.
  22. * Beware: This header is not a purely internal header, it is also included
  23. * from the outside world when building the STLport library. So this header
  24. * should not reference internal headers (stlport/stl/_*.h) directly.
  25. */
  26. #if defined (__sgi)
  27. # if defined (ROOT_65) /* IRIX 6.5.x */
  28. # include <sgidefs.h>
  29. # include <standards.h>
  30. # include <wchar.h>
  31. # include <ctype.h>
  32. # else /* IRIX pre-6.5 */
  33. # include <sgidefs.h>
  34. # include <standards.h>
  35. # if !defined(_SIZE_T) && !defined(_SIZE_T_)
  36. # define _SIZE_T
  37. # if (_MIPS_SZLONG == 32)
  38. typedef unsigned int size_t;
  39. # endif
  40. # if (_MIPS_SZLONG == 64)
  41. typedef unsigned long size_t;
  42. # endif
  43. # endif
  44. # if !defined (_WCHAR_T)
  45. # define _WCHAR_T
  46. # if (_MIPS_SZLONG == 32)
  47. typedef long wchar_t;
  48. # endif
  49. # if (_MIPS_SZLONG == 64)
  50. typedef __int32_t wchar_t;
  51. # endif
  52. # endif /* _WCHAR_T */
  53. # if !defined (_WINT_T)
  54. # define _WINT_T
  55. # if (_MIPS_SZLONG == 32)
  56. typedef long wint_t;
  57. # endif
  58. # if (_MIPS_SZLONG == 64)
  59. typedef __int32_t wint_t;
  60. # endif
  61. # endif /* _WINT_T */
  62. # if !defined (_MBSTATE_T)
  63. # define _MBSTATE_T
  64. /* _MSC_VER check is here for historical reason and seems wrong as it is the macro defined
  65. * by Microsoft compilers to give their version. But we are in a SGI platform section so it
  66. * is weird. However _MSC_VER might also be a SGI compiler macro so we keep it this way.*/
  67. # if defined (_MSC_VER)
  68. typedef int mbstate_t;
  69. # else
  70. typedef char mbstate_t;
  71. # endif
  72. # endif /* _MBSTATE_T */
  73. # endif /* ROOT65 */
  74. #elif defined (_STLP_USE_GLIBC)
  75. # include <ctype.h>
  76. #endif
  77. /*
  78. * GENERAL FRAMEWORK
  79. */
  80. /*
  81. * Opaque types, implementation (if there is one) depends
  82. * on platform localisation API.
  83. */
  84. struct _Locale_ctype;
  85. struct _Locale_codecvt;
  86. struct _Locale_numeric;
  87. struct _Locale_time;
  88. struct _Locale_collate;
  89. struct _Locale_monetary;
  90. struct _Locale_messages;
  91. /*
  92. Bitmask macros.
  93. */
  94. /*
  95. * For narrow characters, we expose the lookup table interface.
  96. */
  97. #if defined (_STLP_USE_GLIBC)
  98. /* This section uses macros defined in the gnu libc ctype.h header */
  99. # define _Locale_CNTRL _IScntrl
  100. # define _Locale_UPPER _ISupper
  101. # define _Locale_LOWER _ISlower
  102. # define _Locale_DIGIT _ISdigit
  103. # define _Locale_XDIGIT _ISxdigit
  104. # define _Locale_PUNCT _ISpunct
  105. # define _Locale_SPACE _ISspace
  106. # define _Locale_PRINT _ISprint
  107. # define _Locale_ALPHA _ISalpha
  108. #else
  109. /* Default values based on C++ Standard 22.2.1.
  110. * Under Windows the localisation implementation take care of mapping its
  111. * mask values to those internal values. For other platforms without real
  112. * localization support we are free to use the most suitable values.*/
  113. # define _Locale_SPACE 0x0001
  114. # define _Locale_PRINT 0x0002
  115. # define _Locale_CNTRL 0x0004
  116. # define _Locale_UPPER 0x0008
  117. # define _Locale_LOWER 0x0010
  118. # define _Locale_ALPHA 0x0020
  119. # define _Locale_DIGIT 0x0040
  120. # define _Locale_PUNCT 0x0080
  121. # define _Locale_XDIGIT 0x0100
  122. #endif
  123. #endif /* _STLP_C_LOCALE_H */