libc: Add a very bare-bones locale.h
This commit is contained in:
parent
d40654a00c
commit
5c68d50070
@ -19,6 +19,7 @@ set(SOURCES
|
||||
src/env.cpp
|
||||
src/pwd.cpp
|
||||
src/grp.cpp
|
||||
src/locale.cpp
|
||||
src/sys/stat.cpp
|
||||
src/sys/mman.cpp
|
||||
src/sys/wait.cpp
|
||||
|
18
libc/include/bits/locale-cat.h
Normal file
18
libc/include/bits/locale-cat.h
Normal file
@ -0,0 +1,18 @@
|
||||
/* bits/locale-cat.h: Locale categories. */
|
||||
|
||||
#ifndef _BITS_LOCALE_CAT_H
|
||||
#define _BITS_LOCALE_CAT_H
|
||||
|
||||
enum __libc_locale_category
|
||||
{
|
||||
LC_ALL, // Controls all locales.
|
||||
LC_CTYPE, // Character classification and case conversion.
|
||||
LC_COLLATE, // Collation order.
|
||||
LC_MONETARY, // Monetary formatting.
|
||||
LC_NUMERIC, // Numeric, non-monetary formatting.
|
||||
LC_TIME, // Date and time formats.
|
||||
LC_MESSAGES, // Formats of informative and diagnostic messages and interactive responses.
|
||||
__num_locale_categories,
|
||||
};
|
||||
|
||||
#endif
|
20
libc/include/locale.h
Normal file
20
libc/include/locale.h
Normal file
@ -0,0 +1,20 @@
|
||||
/* locale.h: Locale category macros. */
|
||||
|
||||
#ifndef _LOCALE_H
|
||||
#define _LOCALE_H
|
||||
|
||||
#include <bits/locale-cat.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
// Query or set the current locale.
|
||||
char* setlocale(int category, const char* locale);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
12
libc/src/locale.cpp
Normal file
12
libc/src/locale.cpp
Normal file
@ -0,0 +1,12 @@
|
||||
#include <locale.h>
|
||||
|
||||
static char s_default_locale[] = "C";
|
||||
|
||||
extern "C"
|
||||
{
|
||||
char* setlocale(int, const char*)
|
||||
{
|
||||
// FIXME: Set the current locale if <locale> is not NULL.
|
||||
return s_default_locale;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user