| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| header: locale.h | ||
| functions: | ||
| - name: localeconv | ||
| standards: | ||
| - stdc | ||
| return_type: struct lconv * | ||
| arguments: | ||
| - type: void | ||
| - name: duplocale | ||
| standards: | ||
| - stdc | ||
| return_type: locale_t | ||
| arguments: | ||
| - type: locale_t | ||
| - name: freelocale | ||
| standards: | ||
| - stdc | ||
| return_type: void | ||
| arguments: | ||
| - type: locale_t | ||
| - name: newlocale | ||
| standards: | ||
| - stdc | ||
| return_type: locale_t | ||
| arguments: | ||
| - type: int | ||
| - type: const char * | ||
| - type: locale_t | ||
| - name: setlocale | ||
| standards: | ||
| - stdc | ||
| return_type: char * | ||
| arguments: | ||
| - type: int | ||
| - type: const char * | ||
| - name: uselocale | ||
| standards: | ||
| - stdc | ||
| return_type: locale_t | ||
| arguments: | ||
| - type: locale_t |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| //===-- Implementation of isalnum -----------------------------------------===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #include "src/ctype/isalnum_l.h" | ||
| #include "src/__support/ctype_utils.h" | ||
|
|
||
| #include "src/__support/common.h" | ||
| #include "src/__support/macros/config.h" | ||
|
|
||
| namespace LIBC_NAMESPACE_DECL { | ||
|
|
||
| LLVM_LIBC_FUNCTION(int, isalnum_l, (int c, locale_t)) { | ||
| return static_cast<int>(internal::isalnum(static_cast<unsigned>(c))); | ||
| } | ||
|
|
||
| } // namespace LIBC_NAMESPACE_DECL |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| //===-- Implementation header for isalnum_l -----------------------*-C++-*-===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef LLVM_LIBC_SRC_CTYPE_ISALNUM_H | ||
| #define LLVM_LIBC_SRC_CTYPE_ISALNUM_H | ||
|
|
||
| #include "hdr/types/locale_t.h" | ||
| #include "src/__support/macros/config.h" | ||
|
|
||
| namespace LIBC_NAMESPACE_DECL { | ||
|
|
||
| int isalnum_l(int c, locale_t locale); | ||
|
|
||
| } // namespace LIBC_NAMESPACE_DECL | ||
|
|
||
| #endif // LLVM_LIBC_SRC_CTYPE_ISALNUM_H |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| //===-- Implementation of isalpha -----------------------------------------===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #include "src/ctype/isalpha_l.h" | ||
|
|
||
| #include "src/__support/common.h" | ||
| #include "src/__support/ctype_utils.h" | ||
| #include "src/__support/macros/config.h" | ||
|
|
||
| namespace LIBC_NAMESPACE_DECL { | ||
|
|
||
| LLVM_LIBC_FUNCTION(int, isalpha_l, (int c, locale_t)) { | ||
| return static_cast<int>(internal::isalpha(static_cast<unsigned>(c))); | ||
| } | ||
|
|
||
| } // namespace LIBC_NAMESPACE_DECL |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| //===-- Implementation header for isalpha_l -----------------------*-C++-*-===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef LLVM_LIBC_SRC_CTYPE_ISALPHA_H | ||
| #define LLVM_LIBC_SRC_CTYPE_ISALPHA_H | ||
|
|
||
| #include "hdr/types/locale_t.h" | ||
| #include "src/__support/macros/config.h" | ||
|
|
||
| namespace LIBC_NAMESPACE_DECL { | ||
|
|
||
| int isalpha_l(int c, locale_t locale); | ||
|
|
||
| } // namespace LIBC_NAMESPACE_DECL | ||
|
|
||
| #endif // LLVM_LIBC_SRC_CTYPE_ISALPHA_H |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| //===-- Implementation of isblank -----------------------------------------===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #include "src/ctype/isblank_l.h" | ||
|
|
||
| #include "src/__support/common.h" | ||
| #include "src/__support/macros/config.h" | ||
|
|
||
| namespace LIBC_NAMESPACE_DECL { | ||
|
|
||
| LLVM_LIBC_FUNCTION(int, isblank_l, (int c, locale_t)) { | ||
| return static_cast<int>(c == ' ' || c == '\t'); | ||
| } | ||
|
|
||
| } // namespace LIBC_NAMESPACE_DECL |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| //===-- Implementation header for isblank_l -----------------------*-C++-*-===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef LLVM_LIBC_SRC_CTYPE_ISBLANK_H | ||
| #define LLVM_LIBC_SRC_CTYPE_ISBLANK_H | ||
|
|
||
| #include "hdr/types/locale_t.h" | ||
| #include "src/__support/macros/config.h" | ||
|
|
||
| namespace LIBC_NAMESPACE_DECL { | ||
|
|
||
| int isblank_l(int c, locale_t locale); | ||
|
|
||
| } // namespace LIBC_NAMESPACE_DECL | ||
|
|
||
| #endif // LLVM_LIBC_SRC_CTYPE_ISBLANK_H |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| //===-- Implementation of iscntrl -----------------------------------------===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #include "src/ctype/iscntrl_l.h" | ||
|
|
||
| #include "src/__support/common.h" | ||
| #include "src/__support/macros/config.h" | ||
|
|
||
| namespace LIBC_NAMESPACE_DECL { | ||
|
|
||
| LLVM_LIBC_FUNCTION(int, iscntrl_l, (int c, locale_t)) { | ||
| const unsigned ch = static_cast<unsigned>(c); | ||
| return static_cast<int>(ch < 0x20 || ch == 0x7f); | ||
| } | ||
|
|
||
| } // namespace LIBC_NAMESPACE_DECL |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| //===-- Implementation header for iscntrl_l -----------------------*-C++-*-===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef LLVM_LIBC_SRC_CTYPE_ISCNTRL_H | ||
| #define LLVM_LIBC_SRC_CTYPE_ISCNTRL_H | ||
|
|
||
| #include "hdr/types/locale_t.h" | ||
| #include "src/__support/macros/config.h" | ||
|
|
||
| namespace LIBC_NAMESPACE_DECL { | ||
|
|
||
| int iscntrl_l(int c, locale_t locale); | ||
|
|
||
| } // namespace LIBC_NAMESPACE_DECL | ||
|
|
||
| #endif // LLVM_LIBC_SRC_CTYPE_ISCNTRL_H |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| //===-- Implementation of isdigit -----------------------------------------===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #include "src/ctype/isdigit_l.h" | ||
| #include "src/__support/common.h" | ||
| #include "src/__support/ctype_utils.h" | ||
| #include "src/__support/macros/config.h" | ||
|
|
||
| namespace LIBC_NAMESPACE_DECL { | ||
|
|
||
| LLVM_LIBC_FUNCTION(int, isdigit_l, (int c, locale_t)) { | ||
| return static_cast<int>(internal::isdigit(static_cast<unsigned>(c))); | ||
| } | ||
|
|
||
| } // namespace LIBC_NAMESPACE_DECL |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| //===-- Implementation header for isdigit_l -----------------------*-C++-*-===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef LLVM_LIBC_SRC_CTYPE_ISDIGIT_H | ||
| #define LLVM_LIBC_SRC_CTYPE_ISDIGIT_H | ||
|
|
||
| #include "hdr/types/locale_t.h" | ||
| #include "src/__support/macros/config.h" | ||
|
|
||
| namespace LIBC_NAMESPACE_DECL { | ||
|
|
||
| int isdigit_l(int c, locale_t locale); | ||
|
|
||
| } // namespace LIBC_NAMESPACE_DECL | ||
|
|
||
| #endif // LLVM_LIBC_SRC_CTYPE_ISDIGIT_H |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| //===-- Implementation of isgraph -----------------------------------------===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #include "src/ctype/isgraph_l.h" | ||
|
|
||
| #include "src/__support/common.h" | ||
| #include "src/__support/ctype_utils.h" | ||
| #include "src/__support/macros/config.h" | ||
|
|
||
| namespace LIBC_NAMESPACE_DECL { | ||
|
|
||
| LLVM_LIBC_FUNCTION(int, isgraph_l, (int c, locale_t)) { | ||
| return static_cast<int>(internal::isgraph(static_cast<unsigned>(c))); | ||
| } | ||
|
|
||
| } // namespace LIBC_NAMESPACE_DECL |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| //===-- Implementation header for isgraph_l -----------------------*-C++-*-===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef LLVM_LIBC_SRC_CTYPE_ISGRAPH_H | ||
| #define LLVM_LIBC_SRC_CTYPE_ISGRAPH_H | ||
|
|
||
| #include "hdr/types/locale_t.h" | ||
| #include "src/__support/macros/config.h" | ||
|
|
||
| namespace LIBC_NAMESPACE_DECL { | ||
|
|
||
| int isgraph_l(int c, locale_t locale); | ||
|
|
||
| } // namespace LIBC_NAMESPACE_DECL | ||
|
|
||
| #endif // LLVM_LIBC_SRC_CTYPE_ISGRAPH_H |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| //===-- Implementation of islower -----------------------------------------===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #include "src/ctype/islower_l.h" | ||
| #include "src/__support/ctype_utils.h" | ||
|
|
||
| #include "src/__support/common.h" | ||
| #include "src/__support/macros/config.h" | ||
|
|
||
| namespace LIBC_NAMESPACE_DECL { | ||
|
|
||
| LLVM_LIBC_FUNCTION(int, islower_l, (int c, locale_t)) { | ||
| return static_cast<int>(internal::islower(static_cast<unsigned>(c))); | ||
| } | ||
|
|
||
| } // namespace LIBC_NAMESPACE_DECL |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| //===-- Implementation header for islower_l -----------------------*-C++-*-===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef LLVM_LIBC_SRC_CTYPE_ISLOWER_H | ||
| #define LLVM_LIBC_SRC_CTYPE_ISLOWER_H | ||
|
|
||
| #include "hdr/types/locale_t.h" | ||
| #include "src/__support/macros/config.h" | ||
|
|
||
| namespace LIBC_NAMESPACE_DECL { | ||
|
|
||
| int islower_l(int c, locale_t locale); | ||
|
|
||
| } // namespace LIBC_NAMESPACE_DECL | ||
|
|
||
| #endif // LLVM_LIBC_SRC_CTYPE_ISLOWER_H |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| //===-- Implementation of isprint -----------------------------------------===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #include "src/ctype/isprint_l.h" | ||
|
|
||
| #include "src/__support/common.h" | ||
| #include "src/__support/macros/config.h" | ||
|
|
||
| namespace LIBC_NAMESPACE_DECL { | ||
|
|
||
| LLVM_LIBC_FUNCTION(int, isprint_l, (int c, locale_t)) { | ||
| const unsigned ch = static_cast<unsigned>(c); | ||
| return static_cast<int>((ch - ' ') < 95); | ||
| } | ||
|
|
||
| } // namespace LIBC_NAMESPACE_DECL |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| //===-- Implementation header for isprint_l -----------------------*-C++-*-===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef LLVM_LIBC_SRC_CTYPE_ISPRINT_H | ||
| #define LLVM_LIBC_SRC_CTYPE_ISPRINT_H | ||
|
|
||
| #include "hdr/types/locale_t.h" | ||
| #include "src/__support/macros/config.h" | ||
|
|
||
| namespace LIBC_NAMESPACE_DECL { | ||
|
|
||
| int isprint_l(int c, locale_t locale); | ||
|
|
||
| } // namespace LIBC_NAMESPACE_DECL | ||
|
|
||
| #endif // LLVM_LIBC_SRC_CTYPE_ISPRINT_H |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| //===-- Implementation of ispunct -----------------------------------------===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #include "src/ctype/ispunct_l.h" | ||
|
|
||
| #include "src/__support/common.h" | ||
| #include "src/__support/ctype_utils.h" | ||
| #include "src/__support/macros/config.h" | ||
|
|
||
| namespace LIBC_NAMESPACE_DECL { | ||
|
|
||
| LLVM_LIBC_FUNCTION(int, ispunct_l, (int c, locale_t)) { | ||
| const unsigned ch = static_cast<unsigned>(c); | ||
| return static_cast<int>(!internal::isalnum(ch) && internal::isgraph(ch)); | ||
| } | ||
|
|
||
| } // namespace LIBC_NAMESPACE_DECL |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| //===-- Implementation header for ispunct_l -----------------------*-C++-*-===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef LLVM_LIBC_SRC_CTYPE_ISPUNCT_H | ||
| #define LLVM_LIBC_SRC_CTYPE_ISPUNCT_H | ||
|
|
||
| #include "hdr/types/locale_t.h" | ||
| #include "src/__support/macros/config.h" | ||
|
|
||
| namespace LIBC_NAMESPACE_DECL { | ||
|
|
||
| int ispunct_l(int c, locale_t locale); | ||
|
|
||
| } // namespace LIBC_NAMESPACE_DECL | ||
|
|
||
| #endif // LLVM_LIBC_SRC_CTYPE_ISPUNCT_H |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| //===-- Implementation of isspace -----------------------------------------===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #include "src/ctype/isspace_l.h" | ||
| #include "src/__support/ctype_utils.h" | ||
|
|
||
| #include "src/__support/common.h" | ||
| #include "src/__support/macros/config.h" | ||
|
|
||
| namespace LIBC_NAMESPACE_DECL { | ||
|
|
||
| LLVM_LIBC_FUNCTION(int, isspace_l, (int c, locale_t)) { | ||
| return static_cast<int>(internal::isspace(static_cast<unsigned>(c))); | ||
| } | ||
|
|
||
| } // namespace LIBC_NAMESPACE_DECL |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| //===-- Implementation header for isspace_l -----------------------*-C++-*-===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef LLVM_LIBC_SRC_CTYPE_ISSPACE_H | ||
| #define LLVM_LIBC_SRC_CTYPE_ISSPACE_H | ||
|
|
||
| #include "hdr/types/locale_t.h" | ||
| #include "src/__support/macros/config.h" | ||
|
|
||
| namespace LIBC_NAMESPACE_DECL { | ||
|
|
||
| int isspace_l(int c, locale_t locale); | ||
|
|
||
| } // namespace LIBC_NAMESPACE_DECL | ||
|
|
||
| #endif // LLVM_LIBC_SRC_CTYPE_ISSPACE_H |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| //===-- Implementation of isupper -----------------------------------------===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #include "src/ctype/isupper_l.h" | ||
| #include "src/__support/ctype_utils.h" | ||
|
|
||
| #include "src/__support/common.h" | ||
| #include "src/__support/macros/config.h" | ||
|
|
||
| namespace LIBC_NAMESPACE_DECL { | ||
|
|
||
| LLVM_LIBC_FUNCTION(int, isupper_l, (int c, locale_t)) { | ||
| return static_cast<int>(internal::isupper(static_cast<unsigned>(c))); | ||
| } | ||
|
|
||
| } // namespace LIBC_NAMESPACE_DECL |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| //===-- Implementation header for isupper_l -----------------------*-C++-*-===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef LLVM_LIBC_SRC_CTYPE_ISUPPER_H | ||
| #define LLVM_LIBC_SRC_CTYPE_ISUPPER_H | ||
|
|
||
| #include "hdr/types/locale_t.h" | ||
| #include "src/__support/macros/config.h" | ||
|
|
||
| namespace LIBC_NAMESPACE_DECL { | ||
|
|
||
| int isupper_l(int c, locale_t locale); | ||
|
|
||
| } // namespace LIBC_NAMESPACE_DECL | ||
|
|
||
| #endif // LLVM_LIBC_SRC_CTYPE_ISUPPER_H |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| //===-- Implementation of isxdigit ----------------------------------------===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #include "src/ctype/isxdigit_l.h" | ||
| #include "src/__support/ctype_utils.h" | ||
|
|
||
| #include "src/__support/common.h" | ||
| #include "src/__support/macros/config.h" | ||
|
|
||
| namespace LIBC_NAMESPACE_DECL { | ||
|
|
||
| LLVM_LIBC_FUNCTION(int, isxdigit_l, (int c, locale_t)) { | ||
| const unsigned ch = static_cast<unsigned>(c); | ||
| return static_cast<int>(internal::isdigit(ch) || (ch | 32) - 'a' < 6); | ||
| } | ||
|
|
||
| } // namespace LIBC_NAMESPACE_DECL |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| //===-- Implementation header for isxdigit_l ----------------------*-C++-*-===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef LLVM_LIBC_SRC_CTYPE_ISXDIGIT_H | ||
| #define LLVM_LIBC_SRC_CTYPE_ISXDIGIT_H | ||
|
|
||
| #include "hdr/types/locale_t.h" | ||
| #include "src/__support/macros/config.h" | ||
|
|
||
| namespace LIBC_NAMESPACE_DECL { | ||
|
|
||
| int isxdigit_l(int c, locale_t locale); | ||
|
|
||
| } // namespace LIBC_NAMESPACE_DECL | ||
|
|
||
| #endif // LLVM_LIBC_SRC_CTYPE_ISXDIGIT_H |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| //===-- Implementation of tolower -----------------------------------------===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #include "src/ctype/tolower_l.h" | ||
| #include "src/__support/ctype_utils.h" | ||
|
|
||
| #include "src/__support/common.h" | ||
| #include "src/__support/macros/config.h" | ||
|
|
||
| namespace LIBC_NAMESPACE_DECL { | ||
|
|
||
| LLVM_LIBC_FUNCTION(int, tolower_l, (int c, locale_t)) { | ||
| return internal::tolower(c); | ||
| } | ||
|
|
||
| } // namespace LIBC_NAMESPACE_DECL |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| //===-- Implementation header for tolower_l -----------------------*-C++-*-===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef LLVM_LIBC_SRC_CTYPE_TOLOWER_H | ||
| #define LLVM_LIBC_SRC_CTYPE_TOLOWER_H | ||
|
|
||
| #include "hdr/types/locale_t.h" | ||
| #include "src/__support/macros/config.h" | ||
|
|
||
| namespace LIBC_NAMESPACE_DECL { | ||
|
|
||
| int tolower_l(int c, locale_t locale); | ||
|
|
||
| } // namespace LIBC_NAMESPACE_DECL | ||
|
|
||
| #endif // LLVM_LIBC_SRC_CTYPE_TOLOWER_H |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| //===-- Implementation of toupper_l ---------------------------------------===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #include "src/ctype/toupper_l.h" | ||
| #include "src/__support/ctype_utils.h" | ||
|
|
||
| #include "src/__support/common.h" | ||
| #include "src/__support/macros/config.h" | ||
|
|
||
| namespace LIBC_NAMESPACE_DECL { | ||
|
|
||
| LLVM_LIBC_FUNCTION(int, toupper_l, (int c, locale_t)) { | ||
| if (internal::islower(c)) | ||
| return c - ('a' - 'A'); | ||
| return c; | ||
| } | ||
|
|
||
| } // namespace LIBC_NAMESPACE_DECL |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| //===-- Implementation header for toupper_l -----------------------*-C++-*-===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef LLVM_LIBC_SRC_CTYPE_TOUPPER_H | ||
| #define LLVM_LIBC_SRC_CTYPE_TOUPPER_H | ||
|
|
||
| #include "hdr/types/locale_t.h" | ||
| #include "src/__support/macros/config.h" | ||
|
|
||
| namespace LIBC_NAMESPACE_DECL { | ||
|
|
||
| int toupper_l(int c, locale_t locale); | ||
|
|
||
| } // namespace LIBC_NAMESPACE_DECL | ||
|
|
||
| #endif // LLVM_LIBC_SRC_CTYPE_TOUPPER_H |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| add_object_library( | ||
| locale | ||
| SRCS | ||
| locale.cpp | ||
| HDRS | ||
| locale.h | ||
| DEPENDS | ||
| libc.include.locale | ||
| ) | ||
|
|
||
| add_entrypoint_object( | ||
| localeconv | ||
| SRCS | ||
| localeconv.cpp | ||
| HDRS | ||
| localeconv.h | ||
| DEPENDS | ||
| libc.include.locale | ||
| CXX_STANDARD | ||
| 20 # For designated initializers | ||
| ) | ||
|
|
||
| add_entrypoint_object( | ||
| newlocale | ||
| SRCS | ||
| newlocale.cpp | ||
| HDRS | ||
| newlocale.h | ||
| DEPENDS | ||
| libc.include.locale | ||
| .locale | ||
| ) | ||
|
|
||
| add_entrypoint_object( | ||
| duplocale | ||
| SRCS | ||
| duplocale.cpp | ||
| HDRS | ||
| duplocale.h | ||
| DEPENDS | ||
| libc.include.locale | ||
| .locale | ||
| ) | ||
|
|
||
| add_entrypoint_object( | ||
| setlocale | ||
| SRCS | ||
| setlocale.cpp | ||
| HDRS | ||
| setlocale.h | ||
| DEPENDS | ||
| libc.include.locale | ||
| .locale | ||
| ) | ||
|
|
||
| add_entrypoint_object( | ||
| uselocale | ||
| SRCS | ||
| uselocale.cpp | ||
| HDRS | ||
| uselocale.h | ||
| DEPENDS | ||
| libc.include.locale | ||
| .locale | ||
| ) | ||
|
|
||
| add_entrypoint_object( | ||
| freelocale | ||
| SRCS | ||
| freelocale.cpp | ||
| HDRS | ||
| freelocale.h | ||
| DEPENDS | ||
| libc.include.locale | ||
| .locale | ||
| ) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| //===-- Implementation of duplocale ---------------------------------------===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #include "src/locale/duplocale.h" | ||
| #include "include/llvm-libc-macros/locale-macros.h" | ||
| #include "src/locale/locale.h" | ||
|
|
||
| #include "src/__support/CPP/string_view.h" | ||
| #include "src/__support/common.h" | ||
| #include "src/__support/macros/config.h" | ||
|
|
||
| namespace LIBC_NAMESPACE_DECL { | ||
|
|
||
| LLVM_LIBC_FUNCTION(locale_t, duplocale, (locale_t loc)) { return loc; } | ||
|
|
||
| } // namespace LIBC_NAMESPACE_DECL |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| //===-- Implementation header for duplocale ---------------------*- C++ -*-===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef LLVM_LIBC_SRC_LOCALE_DUPLOCALE_H | ||
| #define LLVM_LIBC_SRC_LOCALE_DUPLOCALE_H | ||
|
|
||
| #include "src/__support/macros/config.h" | ||
|
|
||
| #include "hdr/types/locale_t.h" | ||
|
|
||
| namespace LIBC_NAMESPACE_DECL { | ||
|
|
||
| locale_t duplocale(locale_t loc); | ||
|
|
||
| } // namespace LIBC_NAMESPACE_DECL | ||
|
|
||
| #endif // LLVM_LIBC_SRC_LOCALE_DUPLOCALE_H |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| //===-- Implementation of freelocale --------------------------------------===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #include "src/locale/freelocale.h" | ||
| #include "include/llvm-libc-macros/locale-macros.h" | ||
| #include "src/locale/locale.h" | ||
|
|
||
| #include "src/__support/CPP/string_view.h" | ||
| #include "src/__support/common.h" | ||
| #include "src/__support/macros/config.h" | ||
|
|
||
| namespace LIBC_NAMESPACE_DECL { | ||
|
|
||
| LLVM_LIBC_FUNCTION(void, freelocale, (locale_t)) {} | ||
|
|
||
| } // namespace LIBC_NAMESPACE_DECL |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| //===-- Implementation header for freelocale --------------------*- C++ -*-===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef LLVM_LIBC_SRC_LOCALE_FREELOCALE_H | ||
| #define LLVM_LIBC_SRC_LOCALE_FREELOCALE_H | ||
|
|
||
| #include "src/__support/macros/config.h" | ||
|
|
||
| #include "hdr/types/locale_t.h" | ||
|
|
||
| namespace LIBC_NAMESPACE_DECL { | ||
|
|
||
| void freelocale(locale_t loc); | ||
|
|
||
| } // namespace LIBC_NAMESPACE_DECL | ||
|
|
||
| #endif // LLVM_LIBC_SRC_LOCALE_FREELOCALE_H |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| //===-- Implementation of locale ------------------------------------------===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #include "src/locale/locale.h" | ||
|
|
||
| #include "include/llvm-libc-macros/locale-macros.h" | ||
| #include "src/__support/common.h" | ||
| #include "src/__support/macros/config.h" | ||
|
|
||
| namespace LIBC_NAMESPACE_DECL { | ||
|
|
||
| __locale_t c_locale = {nullptr}; | ||
|
|
||
| LIBC_THREAD_LOCAL locale_t locale = nullptr; | ||
|
|
||
| } // namespace LIBC_NAMESPACE_DECL |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| //===-- Implementation header for the locale --------------------*- C++ -*-===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef LLVM_LIBC_SRC_LOCALE_LOCALECONV_H | ||
| #define LLVM_LIBC_SRC_LOCALE_LOCALECONV_H | ||
|
|
||
| #include "src/__support/macros/attributes.h" | ||
| #include "src/__support/macros/config.h" | ||
|
|
||
| #include "hdr/types/locale_t.h" | ||
|
|
||
| #include <stddef.h> | ||
|
|
||
| namespace LIBC_NAMESPACE_DECL { | ||
|
|
||
| // We only support the "C" locale right now. | ||
| static constexpr size_t MAX_LOCALE_NAME_SIZE = 2; | ||
|
|
||
| struct __locale_data { | ||
| char name[MAX_LOCALE_NAME_SIZE]; | ||
| }; | ||
|
|
||
| // The pointer to the default "C" locale. | ||
| extern __locale_t c_locale; | ||
|
|
||
| // The global locale instance. | ||
| LIBC_THREAD_LOCAL extern locale_t locale; | ||
|
|
||
| } // namespace LIBC_NAMESPACE_DECL | ||
|
|
||
| #endif // LLVM_LIBC_SRC_LOCALE_LOCALECONV_H |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| //===-- Implementation of localeconv --------------------------------------===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #include "src/locale/localeconv.h" | ||
|
|
||
| #include "src/__support/CPP/limits.h" | ||
| #include "src/__support/common.h" | ||
| #include "src/__support/macros/config.h" | ||
|
|
||
| namespace LIBC_NAMESPACE_DECL { | ||
|
|
||
| static char DOT_STRING[] = "."; | ||
| static char EMPTY_STRING[] = ""; | ||
|
|
||
| static struct lconv C_LCONV = { | ||
| .decimal_point = DOT_STRING, | ||
| .thousands_sep = EMPTY_STRING, | ||
| .grouping = EMPTY_STRING, | ||
| .mon_decimal_point = EMPTY_STRING, | ||
| .mon_thousands_sep = EMPTY_STRING, | ||
| .mon_grouping = EMPTY_STRING, | ||
| .positive_sign = EMPTY_STRING, | ||
| .negative_sign = EMPTY_STRING, | ||
| .currency_symbol = EMPTY_STRING, | ||
| .frac_digits = CHAR_MAX, | ||
| .p_cs_precedes = CHAR_MAX, | ||
| .n_cs_precedes = CHAR_MAX, | ||
| .p_sep_by_space = CHAR_MAX, | ||
| .n_sep_by_space = CHAR_MAX, | ||
| .p_sign_posn = CHAR_MAX, | ||
| .n_sign_posn = CHAR_MAX, | ||
| .int_curr_symbol = EMPTY_STRING, | ||
| .int_frac_digits = CHAR_MAX, | ||
| .int_p_cs_precedes = CHAR_MAX, | ||
| .int_n_cs_precedes = CHAR_MAX, | ||
| .int_p_sep_by_space = CHAR_MAX, | ||
| .int_n_sep_by_space = CHAR_MAX, | ||
| .int_p_sign_posn = CHAR_MAX, | ||
| .int_n_sign_posn = CHAR_MAX, | ||
| }; | ||
|
|
||
| LLVM_LIBC_FUNCTION(struct lconv *, localeconv, ()) { return &C_LCONV; } | ||
|
|
||
| } // namespace LIBC_NAMESPACE_DECL |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| //===-- Implementation header for localeconv --------------------*- C++ -*-===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef LLVM_LIBC_SRC_LOCALE_LOCALECONV_H | ||
| #define LLVM_LIBC_SRC_LOCALE_LOCALECONV_H | ||
|
|
||
| #include "src/__support/macros/config.h" | ||
|
|
||
| #include "include/llvm-libc-types/struct_lconv.h" | ||
|
|
||
| namespace LIBC_NAMESPACE_DECL { | ||
|
|
||
| struct lconv *localeconv(); | ||
|
|
||
| } // namespace LIBC_NAMESPACE_DECL | ||
|
|
||
| #endif // LLVM_LIBC_SRC_LOCALE_LOCALECONV_H |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| //===-- Implementation of newlocale ---------------------------------------===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #include "src/locale/newlocale.h" | ||
| #include "include/llvm-libc-macros/locale-macros.h" | ||
| #include "src/locale/locale.h" | ||
|
|
||
| #include "src/__support/CPP/string_view.h" | ||
| #include "src/__support/common.h" | ||
| #include "src/__support/macros/config.h" | ||
|
|
||
| namespace LIBC_NAMESPACE_DECL { | ||
|
|
||
| LLVM_LIBC_FUNCTION(locale_t, newlocale, | ||
| (int category_mask, const char *locale_name, locale_t)) { | ||
| cpp::string_view name(locale_name); | ||
| if (category_mask > LC_ALL || (!name.empty() && name != "C")) | ||
| return nullptr; | ||
|
|
||
| return &c_locale; | ||
| } | ||
|
|
||
| } // namespace LIBC_NAMESPACE_DECL |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| //===-- Implementation header for setlocale ---------------------*- C++ -*-===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef LLVM_LIBC_SRC_LOCALE_SETLOCALE_H | ||
| #define LLVM_LIBC_SRC_LOCALE_SETLOCALE_H | ||
|
|
||
| #include "src/__support/macros/config.h" | ||
|
|
||
| #include "hdr/types/locale_t.h" | ||
|
|
||
| namespace LIBC_NAMESPACE_DECL { | ||
|
|
||
| locale_t newlocale(int category_mask, const char *locale_name, locale_t base); | ||
|
|
||
| } // namespace LIBC_NAMESPACE_DECL | ||
|
|
||
| #endif // LLVM_LIBC_SRC_LOCALE_SETLOCALE_H |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| //===-- Implementation of setlocale ---------------------------------------===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #include "src/locale/setlocale.h" | ||
| #include "include/llvm-libc-macros/locale-macros.h" | ||
| #include "src/locale/locale.h" | ||
|
|
||
| #include "src/__support/CPP/string_view.h" | ||
| #include "src/__support/common.h" | ||
| #include "src/__support/macros/config.h" | ||
|
|
||
| namespace LIBC_NAMESPACE_DECL { | ||
|
|
||
| LLVM_LIBC_FUNCTION(char *, setlocale, (int category, const char *locale_name)) { | ||
| cpp::string_view name(locale_name); | ||
| if (category > LC_ALL || (!name.empty() && name != "C")) | ||
| return nullptr; | ||
|
|
||
| static char locale_str[] = "C"; | ||
| return locale_str; | ||
| } | ||
|
|
||
| } // namespace LIBC_NAMESPACE_DECL |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| //===-- Implementation header for setlocale ---------------------*- C++ -*-===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef LLVM_LIBC_SRC_LOCALE_SETLOCALE_H | ||
| #define LLVM_LIBC_SRC_LOCALE_SETLOCALE_H | ||
|
|
||
| #include "src/__support/macros/config.h" | ||
|
|
||
| #include "hdr/types/locale_t.h" | ||
|
|
||
| namespace LIBC_NAMESPACE_DECL { | ||
|
|
||
| char *setlocale(int category, const char *locale_name); | ||
|
|
||
| } // namespace LIBC_NAMESPACE_DECL | ||
|
|
||
| #endif // LLVM_LIBC_SRC_LOCALE_SETLOCALE_H |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| //===-- Implementation of uselocale ---------------------------------------===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #include "src/locale/uselocale.h" | ||
| #include "src/locale/locale.h" | ||
|
|
||
| #include "src/__support/common.h" | ||
| #include "src/__support/macros/config.h" | ||
|
|
||
| namespace LIBC_NAMESPACE_DECL { | ||
|
|
||
| LLVM_LIBC_FUNCTION(locale_t, uselocale, (locale_t newloc)) { | ||
| if (!newloc) | ||
| return locale; | ||
| return locale = newloc; | ||
| } | ||
|
|
||
| } // namespace LIBC_NAMESPACE_DECL |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| //===-- Implementation header for uselocale ---------------------*- C++ -*-===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef LLVM_LIBC_SRC_LOCALE_USELOCALE_H | ||
| #define LLVM_LIBC_SRC_LOCALE_USELOCALE_H | ||
|
|
||
| #include "src/__support/macros/config.h" | ||
|
|
||
| #include "hdr/types/locale_t.h" | ||
|
|
||
| namespace LIBC_NAMESPACE_DECL { | ||
|
|
||
| locale_t uselocale(locale_t newloc); | ||
|
|
||
| } // namespace LIBC_NAMESPACE_DECL | ||
|
|
||
| #endif // LLVM_LIBC_SRC_LOCALE_USELOCALE_H |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| add_custom_target(libc-locale-tests) | ||
|
|
||
| add_libc_test( | ||
| locale_test | ||
| SUITE | ||
| libc-locale-tests | ||
| SRCS | ||
| locale_test.cpp | ||
| DEPENDS | ||
| libc.include.locale | ||
| libc.src.locale.newlocale | ||
| libc.src.locale.uselocale | ||
| libc.src.locale.freelocale | ||
| ) | ||
|
|
||
| add_libc_test( | ||
| localeconv_test | ||
| SUITE | ||
| libc-locale-tests | ||
| SRCS | ||
| localeconv_test.cpp | ||
| DEPENDS | ||
| libc.include.locale | ||
| libc.src.locale.localeconv | ||
| ) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| //===-- Unittests for locale ----------------------------------------------===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #include "src/locale/freelocale.h" | ||
| #include "src/locale/newlocale.h" | ||
| #include "src/locale/uselocale.h" | ||
|
|
||
| #include "test/UnitTest/Test.h" | ||
|
|
||
| #include "include/llvm-libc-macros/locale-macros.h" | ||
|
|
||
| TEST(LlvmLibcLocale, DefaultLocale) { | ||
| locale_t new_locale = LIBC_NAMESPACE::newlocale(LC_ALL, "C", nullptr); | ||
| EXPECT_NE(new_locale, static_cast<locale_t>(nullptr)); | ||
|
|
||
| locale_t old_locale = LIBC_NAMESPACE::uselocale(new_locale); | ||
| EXPECT_NE(old_locale, static_cast<locale_t>(nullptr)); | ||
|
|
||
| LIBC_NAMESPACE::freelocale(new_locale); | ||
|
|
||
| LIBC_NAMESPACE::uselocale(old_locale); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| //===-- Unittests for localeconv ------------------------------------------===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #include "include/llvm-libc-macros/locale-macros.h" | ||
| #include "src/locale/localeconv.h" | ||
|
|
||
| #include "test/UnitTest/Test.h" | ||
|
|
||
| TEST(LlvmLibcLocale, DefaultLocale) { | ||
| struct lconv *conv = LIBC_NAMESPACE::localeconv(); | ||
| EXPECT_STREQ(conv->decimal_point, "."); | ||
| } |