diff --git a/libc/generic/ansi/dir.makefile b/libc/generic/ansi/dir.makefile index 2c5399d0..0833db63 100644 --- a/libc/generic/ansi/dir.makefile +++ b/libc/generic/ansi/dir.makefile @@ -3,10 +3,10 @@ $c_SRCDIR = $(TREE_PATH)/$c/src $c_HEADERDIR := $(TREE_PATH)/$c/include $c_OBJDIR := $(BUILD_PATH)/$c/obj -$c_HEADERS := assert.h ctype.h errno.h signal.h stdio.h stdlib.h string.h time.h \ +$c_HEADERS := assert.h ctype.h errno.h locale.h signal.h stdio.h stdlib.h string.h time.h \ mlibc/ensure.h -$c_OBJECTS := assert.o ctype.o signal.o stdio.o stdlib.o string.o time.o +$c_OBJECTS := assert.o ctype.o locale.o signal.o stdio.o stdlib.o string.o time.o $c_OBJECT_PATHS := $(addprefix $($c_OBJDIR)/,$($c_OBJECTS)) $c_CXX := x86_64-managarm-g++ diff --git a/libc/generic/ansi/include/locale.h b/libc/generic/ansi/include/locale.h new file mode 100644 index 00000000..57df41d5 --- /dev/null +++ b/libc/generic/ansi/include/locale.h @@ -0,0 +1,58 @@ + +#ifndef _LOCALE_H +#define _LOCALE_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +struct lconv { + char *decimal_point; + char *thousands_sep; + char *grouping; + char *mon_decimal_point; + char *mon_thousands_sep; + char *mon_grouping; + char *positive_sign; + char *negative_sign; + char *currency_symbol; + char frac_digits; + char p_cs_precedes; + char n_cs_precedes; + char p_sep_by_space; + char n_sep_by_space; + char p_sign_posn; + char n_sign_posn; + char *int_curr_symbol; + char int_frac_digits; + char int_p_cs_precedes; + char int_n_cs_precedes; + char int_p_sep_by_space; + char int_n_sep_by_space; + char int_p_sign_posn; + char int_n_sign_posn; +}; + +#define LC_ALL 1 +#define LC_COLLATE 2 +#define LC_CTYPE 3 +#define LC_MONETARY 4 +#define LC_NUMERIC 5 +#define LC_TIME 6 + +// [C11/7.11.1] setlocale() function + +char *setlocale(int category, const char *locale); + +// [C11/7.11.2] Locale inquiry function + +struct lconv *localeconv(void); + +#ifdef __cplusplus +} +#endif + +#endif // _LOCALE_H + diff --git a/libc/generic/ansi/src/locale.cpp b/libc/generic/ansi/src/locale.cpp new file mode 100644 index 00000000..369bf93f --- /dev/null +++ b/libc/generic/ansi/src/locale.cpp @@ -0,0 +1,15 @@ + +#include + +#include + +char *setlocale(int category, const char *locale) { + __ensure(!"Not implemented"); + __builtin_unreachable(); +} + +struct lconv *localeconv(void) { + __ensure(!"Not implemented"); + __builtin_unreachable(); +} +