1207536Smav// Prototypes for GLIBC thread locale __-prefixed functions -*- C++ -*-
2207536Smav
3207536Smav// Copyright (C) 2002-2020 Free Software Foundation, Inc.
4207536Smav//
5207536Smav// This file is part of the GNU ISO C++ Library.  This library is free
6207536Smav// software; you can redistribute it and/or modify it under the
7207536Smav// terms of the GNU General Public License as published by the
8207536Smav// Free Software Foundation; either version 3, or (at your option)
9207536Smav// any later version.
10207536Smav
11207536Smav// This library is distributed in the hope that it will be useful,
12207536Smav// but WITHOUT ANY WARRANTY; without even the implied warranty of
13212636Smav// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14212636Smav// GNU General Public License for more details.
15212636Smav
16212636Smav// Under Section 7 of GPL version 3, you are granted additional
17212636Smav// permissions described in the GCC Runtime Library Exception, version
18212636Smav// 3.1, as published by the Free Software Foundation.
19212636Smav
20212636Smav// You should have received a copy of the GNU General Public License and
21212636Smav// a copy of the GCC Runtime Library Exception along with this program;
22212636Smav// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
23212636Smav// <http://www.gnu.org/licenses/>.
24207536Smav
25207536Smav/** @file bits/c++locale_internal.h
26207536Smav *  This is an internal header file, included by other library headers.
27287016Smav *  Do not attempt to use it directly. @headername{locale}
28207536Smav */
29207536Smav
30207536Smav// Written by Jakub Jelinek <jakub@redhat.com>
31207536Smav
32207536Smav#include <bits/c++config.h>
33207536Smav#include <clocale>
34207536Smav#include <cstdlib>
35207536Smav#include <cstring>
36207536Smav#include <cstddef>
37207536Smav#include <langinfo.h>
38207536Smav
39207536Smav#include <vector>
40207536Smav#include <string.h>	// ::strdup
41207536Smav
42207536Smav#include <ext/concurrence.h>
43207536Smav
44207536Smav#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
45207536Smav
46207536Smavextern "C" __typeof(nl_langinfo_l) __nl_langinfo_l;
47207536Smavextern "C" __typeof(strcoll_l) __strcoll_l;
48207536Smavextern "C" __typeof(strftime_l) __strftime_l;
49207536Smavextern "C" __typeof(strtod_l) __strtod_l;
50207536Smavextern "C" __typeof(strtof_l) __strtof_l;
51207536Smavextern "C" __typeof(strtold_l) __strtold_l;
52207536Smavextern "C" __typeof(strxfrm_l) __strxfrm_l;
53207536Smavextern "C" __typeof(newlocale) __newlocale;
54207536Smavextern "C" __typeof(freelocale) __freelocale;
55207536Smavextern "C" __typeof(duplocale) __duplocale;
56207536Smavextern "C" __typeof(uselocale) __uselocale;
57207536Smav
58207536Smav#ifdef _GLIBCXX_USE_WCHAR_T
59207536Smavextern "C" __typeof(iswctype_l) __iswctype_l;
60207536Smavextern "C" __typeof(towlower_l) __towlower_l;
61207536Smavextern "C" __typeof(towupper_l) __towupper_l;
62207536Smavextern "C" __typeof(wcscoll_l) __wcscoll_l;
63207536Smavextern "C" __typeof(wcsftime_l) __wcsftime_l;
64207536Smavextern "C" __typeof(wcsxfrm_l) __wcsxfrm_l;
65247725Smavextern "C" __typeof(wctype_l) __wctype_l;
66207536Smav#endif
67207536Smav
68207536Smav#endif // GLIBC 2.3 and later
69207536Smav
70236443Sjoelnamespace std _GLIBCXX_VISIBILITY(default)
71236443Sjoel{
72207536Smav_GLIBCXX_BEGIN_NAMESPACE_VERSION
73207536Smav
74207536Smav  struct Catalog_info
75207536Smav  {
76207536Smav    Catalog_info(messages_base::catalog __id, const char* __domain,
77207536Smav		 locale __loc)
78207536Smav      : _M_id(__id), _M_domain(strdup(__domain)), _M_locale(__loc)
79207536Smav    { }
80207536Smav
81207536Smav    ~Catalog_info()
82207536Smav    { free(_M_domain); }
83207536Smav
84207536Smav    messages_base::catalog _M_id;
85247725Smav    char* _M_domain;
86207536Smav    locale _M_locale;
87207536Smav
88207536Smav  private:
89207536Smav    Catalog_info(const Catalog_info&);
90207536Smav
91207536Smav    Catalog_info&
92207536Smav    operator=(const Catalog_info&);
93207536Smav  };
94207536Smav
95207536Smav  class Catalogs
96207536Smav  {
97207536Smav  public:
98207536Smav    Catalogs() : _M_catalog_counter(0) { }
99207536Smav    ~Catalogs();
100207536Smav
101207536Smav    messages_base::catalog
102207536Smav    _M_add(const char* __domain, locale __l);
103207536Smav
104207536Smav    void
105207536Smav    _M_erase(messages_base::catalog __c);
106207536Smav
107207536Smav    const Catalog_info*
108207536Smav    _M_get(messages_base::catalog __c) const;
109207536Smav
110207536Smav  private:
111207536Smav    mutable __gnu_cxx::__mutex _M_mutex;
112207536Smav    messages_base::catalog _M_catalog_counter;
113207536Smav    vector<Catalog_info*> _M_infos;
114207536Smav  };
115207536Smav
116227465Sbrueffer  Catalogs&
117227515Sbrueffer  get_catalogs();
118227515Sbrueffer
119207536Smav_GLIBCXX_END_NAMESPACE_VERSION
120207536Smav} // namespace
121207536Smav