| 1 |
// -*- C++ -*- |
| 2 |
//===----------------------------------------------------------------------===// |
| 3 |
// |
| 4 |
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 5 |
// See https://llvm.org/LICENSE.txt for license information. |
| 6 |
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 7 |
// |
| 8 |
//===----------------------------------------------------------------------===// |
| 9 |
|
| 10 |
#ifndef _LIBCPP___CXX03___SUPPORT_IBM_LOCALE_MGMT_ZOS_H |
| 11 |
#define _LIBCPP___CXX03___SUPPORT_IBM_LOCALE_MGMT_ZOS_H |
| 12 |
|
| 13 |
#if defined(__MVS__) |
| 14 |
# include <__cxx03/locale.h> |
| 15 |
# include <__cxx03/string> |
| 16 |
|
| 17 |
# ifdef __cplusplus |
| 18 |
extern "C" { |
| 19 |
# endif |
| 20 |
|
| 21 |
# define _LC_MAX LC_MESSAGES /* highest real category */ |
| 22 |
# define _NCAT (_LC_MAX + 1) /* maximum + 1 */ |
| 23 |
|
| 24 |
# define _CATMASK(n) (1 << (n)) |
| 25 |
# define LC_COLLATE_MASK _CATMASK(LC_COLLATE) |
| 26 |
# define LC_CTYPE_MASK _CATMASK(LC_CTYPE) |
| 27 |
# define LC_MONETARY_MASK _CATMASK(LC_MONETARY) |
| 28 |
# define LC_NUMERIC_MASK _CATMASK(LC_NUMERIC) |
| 29 |
# define LC_TIME_MASK _CATMASK(LC_TIME) |
| 30 |
# define LC_MESSAGES_MASK _CATMASK(LC_MESSAGES) |
| 31 |
# define LC_ALL_MASK (_CATMASK(_NCAT) - 1) |
| 32 |
|
| 33 |
typedef struct locale_struct { |
| 34 |
int category_mask; |
| 35 |
std::string lc_collate; |
| 36 |
std::string lc_ctype; |
| 37 |
std::string lc_monetary; |
| 38 |
std::string lc_numeric; |
| 39 |
std::string lc_time; |
| 40 |
std::string lc_messages; |
| 41 |
}* locale_t; |
| 42 |
|
| 43 |
// z/OS does not have newlocale, freelocale and uselocale. |
| 44 |
// The functions below are workarounds in single thread mode. |
| 45 |
locale_t newlocale(int category_mask, const char* locale, locale_t base); |
| 46 |
void freelocale(locale_t locobj); |
| 47 |
locale_t uselocale(locale_t newloc); |
| 48 |
|
| 49 |
# ifdef __cplusplus |
| 50 |
} |
| 51 |
# endif |
| 52 |
#endif // defined(__MVS__) |
| 53 |
#endif // _LIBCPP___CXX03___SUPPORT_IBM_LOCALE_MGMT_ZOS_H |