File tree Expand file tree Collapse file tree 17 files changed +845
-0
lines changed Expand file tree Collapse file tree 17 files changed +845
-0
lines changed Original file line number Diff line number Diff line change @@ -391,6 +391,11 @@ set(TARGET_LIBC_ENTRYPOINTS
391391 libc.src.wchar.wcpcpy
392392 libc.src.wchar.wcpncpy
393393 libc.src.wchar.wcstok
394+ libc.src.wchar.wcstol
395+ libc.src.wchar.wcstoll
396+ libc.src.wchar.wcstoul
397+ libc.src.wchar.wcstoull
398+
394399
395400 # sys/uio.h entrypoints
396401 libc.src.sys.uio.writev
Original file line number Diff line number Diff line change @@ -242,3 +242,35 @@ functions:
242242 - type : wchar_t *__restrict
243243 - type : const wchar_t *__restrict
244244 - type : size_t
245+ - name : wcstol
246+ standards :
247+ - stdc
248+ return_type : long
249+ arguments :
250+ - type : const wchar_t *__restrict
251+ - type : wchar_t **__restrict
252+ - type : int
253+ - name : wcstoll
254+ standards :
255+ - stdc
256+ return_type : long long
257+ arguments :
258+ - type : const wchar_t *__restrict
259+ - type : wchar_t **__restrict
260+ - type : int
261+ - name : wcstoul
262+ standards :
263+ - stdc
264+ return_type : unsigned long
265+ arguments :
266+ - type : const wchar_t *__restrict
267+ - type : wchar_t **__restrict
268+ - type : int
269+ - name : wcstoull
270+ standards :
271+ - stdc
272+ return_type : unsigned long long
273+ arguments :
274+ - type : const wchar_t *__restrict
275+ - type : wchar_t **__restrict
276+ - type : int
Original file line number Diff line number Diff line change @@ -45,6 +45,50 @@ add_entrypoint_object(
4545 libc.src.__support.wctype_utils
4646)
4747
48+ add_entrypoint_object(
49+ wcstol
50+ SRCS
51+ wcstol.cpp
52+ HDRS
53+ wcstol.h
54+ DEPENDS
55+ libc.src.errno.errno
56+ libc.src.__support.wcs_to_integer
57+ )
58+
59+ add_entrypoint_object(
60+ wcstoll
61+ SRCS
62+ wcstoll.cpp
63+ HDRS
64+ wcstoll.h
65+ DEPENDS
66+ libc.src.errno.errno
67+ libc.src.__support.wcs_to_integer
68+ )
69+
70+ add_entrypoint_object(
71+ wcstoul
72+ SRCS
73+ wcstoul.cpp
74+ HDRS
75+ wcstoul.h
76+ DEPENDS
77+ libc.src.errno.errno
78+ libc.src.__support.wcs_to_integer
79+ )
80+
81+ add_entrypoint_object(
82+ wcstoull
83+ SRCS
84+ wcstoull.cpp
85+ HDRS
86+ wcstoull.h
87+ DEPENDS
88+ libc.src.errno.errno
89+ libc.src.__support.wcs_to_integer
90+ )
91+
4892add_entrypoint_object(
4993 wcstok
5094 SRCS
Original file line number Diff line number Diff line change 1+ // ===-- Implementation of wcstol ------------------------------------------===//
2+ //
3+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+ // See https://llvm.org/LICENSE.txt for license information.
5+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+ //
7+ // ===----------------------------------------------------------------------===//
8+
9+ #include " src/wchar/wcstol.h"
10+ #include " src/__support/common.h"
11+ #include " src/__support/libc_errno.h"
12+ #include " src/__support/macros/config.h"
13+ #include " src/__support/wcs_to_integer.h"
14+
15+ namespace LIBC_NAMESPACE_DECL {
16+
17+ LLVM_LIBC_FUNCTION (long , wcstol,
18+ (const wchar_t *__restrict str, wchar_t **__restrict str_end,
19+ int base)) {
20+ auto result = internal::wcstointeger<long >(str, base);
21+ if (result.has_error ())
22+ libc_errno = result.error ;
23+
24+ if (str_end != nullptr )
25+ *str_end = const_cast <wchar_t *>(str + result.parsed_len );
26+
27+ return result;
28+ }
29+
30+ } // namespace LIBC_NAMESPACE_DECL
Original file line number Diff line number Diff line change 1+ // ===-- Implementation header for wcstol ------------------------*- C++ -*-===//
2+ //
3+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+ // See https://llvm.org/LICENSE.txt for license information.
5+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+ //
7+ // ===----------------------------------------------------------------------===//
8+
9+ #ifndef LLVM_LIBC_SRC_WCHAR_WCSTOL_H
10+ #define LLVM_LIBC_SRC_WCHAR_WCSTOL_H
11+
12+ #include " hdr/types/wint_t.h"
13+ #include " src/__support/macros/config.h"
14+
15+ namespace LIBC_NAMESPACE_DECL {
16+
17+ long wcstol (const wchar_t *__restrict str, wchar_t **__restrict str_end,
18+ int base);
19+
20+ } // namespace LIBC_NAMESPACE_DECL
21+
22+ #endif // LLVM_LIBC_SRC_WCHAR_WCSTOL_H
Original file line number Diff line number Diff line change 1+ // ===-- Implementation of wcstoll -----------------------------------------===//
2+ //
3+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+ // See https://llvm.org/LICENSE.txt for license information.
5+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+ //
7+ // ===----------------------------------------------------------------------===//
8+
9+ #include " src/wchar/wcstoll.h"
10+ #include " src/__support/common.h"
11+ #include " src/__support/libc_errno.h"
12+ #include " src/__support/macros/config.h"
13+ #include " src/__support/wcs_to_integer.h"
14+
15+ namespace LIBC_NAMESPACE_DECL {
16+
17+ LLVM_LIBC_FUNCTION (long long , wcstoll,
18+ (const wchar_t *__restrict str, wchar_t **__restrict str_end,
19+ int base)) {
20+ auto result = internal::wcstointeger<long long >(str, base);
21+ if (result.has_error ())
22+ libc_errno = result.error ;
23+
24+ if (str_end != nullptr )
25+ *str_end = const_cast <wchar_t *>(str + result.parsed_len );
26+
27+ return result;
28+ }
29+
30+ } // namespace LIBC_NAMESPACE_DECL
Original file line number Diff line number Diff line change 1+ // ===-- Implementation header for wcstoll -----------------------*- C++ -*-===//
2+ //
3+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+ // See https://llvm.org/LICENSE.txt for license information.
5+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+ //
7+ // ===----------------------------------------------------------------------===//
8+
9+ #ifndef LLVM_LIBC_SRC_WCHAR_WCSTOLL_H
10+ #define LLVM_LIBC_SRC_WCHAR_WCSTOLL_H
11+
12+ #include " hdr/types/wint_t.h"
13+ #include " src/__support/macros/config.h"
14+
15+ namespace LIBC_NAMESPACE_DECL {
16+
17+ long long wcstoll (const wchar_t *__restrict str, wchar_t **__restrict str_end,
18+ int base);
19+
20+ } // namespace LIBC_NAMESPACE_DECL
21+
22+ #endif // LLVM_LIBC_SRC_WCHAR_WCSTOLL_H
Original file line number Diff line number Diff line change 1+ // ===-- Implementation of wcstoul -----------------------------------------===//
2+ //
3+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+ // See https://llvm.org/LICENSE.txt for license information.
5+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+ //
7+ // ===----------------------------------------------------------------------===//
8+
9+ #include " src/wchar/wcstoul.h"
10+ #include " src/__support/common.h"
11+ #include " src/__support/libc_errno.h"
12+ #include " src/__support/macros/config.h"
13+ #include " src/__support/wcs_to_integer.h"
14+
15+ namespace LIBC_NAMESPACE_DECL {
16+
17+ LLVM_LIBC_FUNCTION (unsigned long , wcstoul,
18+ (const wchar_t *__restrict str, wchar_t **__restrict str_end,
19+ int base)) {
20+ auto result = internal::wcstointeger<unsigned long >(str, base);
21+ if (result.has_error ())
22+ libc_errno = result.error ;
23+
24+ if (str_end != nullptr )
25+ *str_end = const_cast <wchar_t *>(str + result.parsed_len );
26+
27+ return result;
28+ }
29+
30+ } // namespace LIBC_NAMESPACE_DECL
Original file line number Diff line number Diff line change 1+ // ===-- Implementation header for wcstoul -----------------------*- C++ -*-===//
2+ //
3+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+ // See https://llvm.org/LICENSE.txt for license information.
5+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+ //
7+ // ===----------------------------------------------------------------------===//
8+
9+ #ifndef LLVM_LIBC_SRC_WCHAR_WCSTOUL_H
10+ #define LLVM_LIBC_SRC_WCHAR_WCSTOUL_H
11+
12+ #include " hdr/types/wint_t.h"
13+ #include " src/__support/macros/config.h"
14+
15+ namespace LIBC_NAMESPACE_DECL {
16+
17+ unsigned long wcstoul (const wchar_t *__restrict str,
18+ wchar_t **__restrict str_end, int base);
19+
20+ } // namespace LIBC_NAMESPACE_DECL
21+
22+ #endif // LLVM_LIBC_SRC_WCHAR_WCSTOUL_H
Original file line number Diff line number Diff line change 1+ // ===-- Implementation of wcstoull ----------------------------------------===//
2+ //
3+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+ // See https://llvm.org/LICENSE.txt for license information.
5+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+ //
7+ // ===----------------------------------------------------------------------===//
8+
9+ #include " src/wchar/wcstoull.h"
10+ #include " src/__support/common.h"
11+ #include " src/__support/libc_errno.h"
12+ #include " src/__support/macros/config.h"
13+ #include " src/__support/wcs_to_integer.h"
14+
15+ namespace LIBC_NAMESPACE_DECL {
16+
17+ LLVM_LIBC_FUNCTION (unsigned long long , wcstoull,
18+ (const wchar_t *__restrict str, wchar_t **__restrict str_end,
19+ int base)) {
20+ auto result = internal::wcstointeger<unsigned long long >(str, base);
21+ if (result.has_error ())
22+ libc_errno = result.error ;
23+
24+ if (str_end != nullptr )
25+ *str_end = const_cast <wchar_t *>(str + result.parsed_len );
26+
27+ return result;
28+ }
29+
30+ } // namespace LIBC_NAMESPACE_DECL
You can’t perform that action at this time.
0 commit comments