File tree Expand file tree Collapse file tree 14 files changed +282
-0
lines changed
Expand file tree Collapse file tree 14 files changed +282
-0
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ set(TARGET_PUBLIC_HEADERS
1717 libc.include.uchar
1818 libc.include.features
1919 libc.include.locale
20+ libc.include.langinfo
2021
2122 # Header for RPC extensions
2223 libc.include.gpu_rpc
Original file line number Diff line number Diff line change @@ -732,6 +732,17 @@ add_header_macro(
732732 .llvm-libc-types.struct_lconv
733733)
734734
735+ add_header_macro(
736+ langinfo
737+ ../libc/newhdrgen/yaml/langinfo.yaml
738+ langinfo.h.def
739+ langinfo.h
740+ DEPENDS
741+ .llvm_libc_common_h
742+ .llvm-libc-macros .langinfo_macros
743+ .llvm-libc-types.nl_item
744+ )
745+
735746if (LIBC_TARGET_OS_IS_GPU)
736747 file (MAKE_DIRECTORY ${LIBC_INCLUDE_DIR} /gpu)
737748
Original file line number Diff line number Diff line change 1+ //===-- C standard library header langinfo.h --------------------------------===//
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_LANGINFO_H
10+ #define LLVM_LIBC_LANGINFO_H
11+
12+ #include "__llvm-libc-common.h"
13+
14+ #include "llvm-libc-types/locale_t.h"
15+ #include "llvm-libc-macros/langinfo-macros.h"
16+
17+ %%public_api()
18+
19+ #endif // LLVM_LIBC_LANGINFO_H
20+
Original file line number Diff line number Diff line change @@ -301,3 +301,9 @@ add_macro_header(
301301 HDR
302302 locale-macros .h
303303)
304+
305+ add_macro_header(
306+ langinfo_macros
307+ HDR
308+ langinfo-macros .h
309+ )
Original file line number Diff line number Diff line change 1+ //===-- Definition of macros from langinfo.h ------------------------------===//
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_MACROS_LANGINFO_MACROS_H
10+ #define LLVM_LIBC_MACROS_LANGINFO_MACROS_H
11+
12+ // TODO: Define these for the C locale.
13+ #define CODESET 0
14+
15+ #define D_T_FMT 0
16+ #define D_FMT 0
17+ #define T_FMT 0
18+ #define T_FMT_AMPM 0
19+
20+ #define AM_STR 0
21+ #define PM_STR 0
22+
23+ #define DAY_1 0
24+ #define DAY_2 0
25+ #define DAY_3 0
26+ #define DAY_4 0
27+ #define DAY_5 0
28+ #define DAY_6 0
29+ #define DAY_7 0
30+
31+ #define ABDAY_1 0
32+ #define ABDAY_2 0
33+ #define ABDAY_3 0
34+ #define ABDAY_4 0
35+ #define ABDAY_5 0
36+ #define ABDAY_6 0
37+ #define ABDAY_7 0
38+
39+ #define MON_1 0
40+ #define MON_2 0
41+ #define MON_3 0
42+ #define MON_4 0
43+ #define MON_5 0
44+ #define MON_6 0
45+ #define MON_7 0
46+ #define MON_8 0
47+ #define MON_9 0
48+ #define MON_10 0
49+ #define MON_11 0
50+ #define MON_12 0
51+
52+ #define ABMON_1 0
53+ #define ABMON_2 0
54+ #define ABMON_3 0
55+ #define ABMON_4 0
56+ #define ABMON_5 0
57+ #define ABMON_6 0
58+ #define ABMON_7 0
59+ #define ABMON_8 0
60+ #define ABMON_9 0
61+ #define ABMON_10 0
62+ #define ABMON_11 0
63+ #define ABMON_12 0
64+
65+ #define ERA 0
66+ #define ERA_D_FMT 0
67+ #define ERA_D_T_FMT 0
68+ #define ERA_T_FMT 0
69+
70+ #define ALT_DIGITS 0
71+
72+ #define RADIXCHAR 0
73+
74+ #define THOUSEP 0
75+
76+ #define YESEXPR 0
77+ #define NOEXPR 0
78+
79+ #define CRNCYSTR 0
80+
81+ #endif // LLVM_LIBC_MACROS_LANGINFO_MACROS_H
Original file line number Diff line number Diff line change @@ -144,3 +144,4 @@ DEPENDS
144144)
145145add_header(locale_t HDR locale_t.h)
146146add_header(struct_lconv HDR struct_lconv.h)
147+ add_header(nl_item HDR nl_item.h)
Original file line number Diff line number Diff line change 1+ //===-- Definition of type nl_item ----------------------------------------===//
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_TYPES_NL_ITEM_H
10+ #define LLVM_LIBC_TYPES_NL_ITEM_H
11+
12+ typedef int nl_item ;
13+
14+ #endif // LLVM_LIBC_TYPES_NL_ITEM_H
Original file line number Diff line number Diff line change 1+ header : langinfo.h
2+ macros : []
3+ types : []
4+ enums : []
5+ objects : []
6+ functions :
7+ - name : nl_langinfo
8+ standards :
9+ - POSIX
10+ return_type : char *
11+ arguments :
12+ - type : nl_item
13+ - name : nl_langinfo_l
14+ standards :
15+ - POSIX
16+ return_type : char *
17+ arguments :
18+ - type : nl_item
19+ - type : locale_t
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ def StdC : StandardSpec<"stdc"> {
55 PtrType TimeTTypePtr = PtrType<TimeTType>;
66 NamedType ClockT = NamedType<"clock_t">;
77 NamedType LocaleT = NamedType<"locale_t">;
8+ NamedType NLItem = NamedType<"nl_item">;
89
910 NamedType DivTType = NamedType<"div_t">;
1011 NamedType LDivTType = NamedType<"ldiv_t">;
@@ -1754,6 +1755,30 @@ def StdC : StandardSpec<"stdc"> {
17541755 ] // Functions
17551756 >;
17561757
1758+ HeaderSpec LangInfo = HeaderSpec<
1759+ "langinfo.h",
1760+ [],
1761+ [], // Types
1762+ [], // Enumerations
1763+ [
1764+ FunctionSpec<
1765+ "nl_langinfo",
1766+ RetValSpec<CharPtr>,
1767+ [
1768+ ArgSpec<NLItem>
1769+ ]
1770+ >,
1771+ FunctionSpec<
1772+ "nl_langinfo",
1773+ RetValSpec<CharPtr>,
1774+ [
1775+ ArgSpec<NLItem>,
1776+ ArgSpec<LocaleT>
1777+ ]
1778+ >
1779+ ] // Functions
1780+ >;
1781+
17571782 let Headers = [
17581783 Assert,
17591784 CType,
@@ -1776,5 +1801,6 @@ def StdC : StandardSpec<"stdc"> {
17761801 UChar,
17771802 WChar,
17781803 Locale,
1804+ LangInfo,
17791805 ];
17801806}
Original file line number Diff line number Diff line change 1+ add_object_library(
2+ nl_langinfo
3+ SRCS
4+ nl_langinfo.cpp
5+ HDRS
6+ nl_langinfo.h
7+ DEPENDS
8+ libc.include .langinfo
9+ libc.include .locale
10+ )
11+
12+ add_object_library(
13+ nl_langinfo_l
14+ SRCS
15+ nl_langinfo_l.cpp
16+ HDRS
17+ nl_langinfo_l.h
18+ DEPENDS
19+ libc.include .locale
20+ )
You can’t perform that action at this time.
0 commit comments