mirror of
https://github.com/SerenityOS/serenity.git
synced 2026-11-07 04:29:30 -10:00
LibC: Add stubs for more parts of the locale API
The current version of the libcxx patch stubs these function in libcxx internals. A future revision of the patch will instead require us to define these functions in LibC.
This commit is contained in:
1 parent
e221679ca1
commit
e1bbd5b2d4
4 files changed
+39
No files matched your search
@@ -96,4 +96,10 @@ char* nl_langinfo(nl_item item)
|
||||
// so this cast is probably fine.
|
||||
return const_cast<char*>(__nl_langinfo(item));
|
||||
}
|
||||
|
||||
char* nl_langinfo_l(nl_item item, locale_t)
|
||||
{
|
||||
// FIXME: Support other locales.
|
||||
return nl_langinfo(item);
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
// Includes essentially mandated by POSIX:
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/langinfo.h.html
|
||||
#include <locale.h>
|
||||
#include <nl_types.h>
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
@@ -80,5 +81,6 @@ enum {
|
||||
};
|
||||
|
||||
char* nl_langinfo(nl_item);
|
||||
char* nl_langinfo_l(nl_item, locale_t);
|
||||
|
||||
__END_DECLS
|
||||
@@ -64,4 +64,21 @@ struct lconv* localeconv()
|
||||
{
|
||||
return &default_locale;
|
||||
}
|
||||
|
||||
void freelocale(locale_t)
|
||||
{
|
||||
// FIXME: Implement this.
|
||||
}
|
||||
|
||||
locale_t newlocale(int, char const*, locale_t)
|
||||
{
|
||||
// FIXME: Implement this.
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
locale_t uselocale(locale_t loc)
|
||||
{
|
||||
// FIXME: Implement this.
|
||||
return loc;
|
||||
}
|
||||
}
|
||||
@@ -27,6 +27,14 @@ enum {
|
||||
#define LC_MESSAGES LC_MESSAGES
|
||||
};
|
||||
|
||||
#define LC_NUMERIC_MASK (1 << LC_NUMERIC)
|
||||
#define LC_CTYPE_MASK (1 << LC_CTYPE)
|
||||
#define LC_COLLATE_MASK (1 << LC_COLLATE)
|
||||
#define LC_TIME_MASK (1 << LC_TIME)
|
||||
#define LC_MONETARY_MASK (1 << LC_MONETARY)
|
||||
#define LC_MESSAGES_MASK (1 << LC_MESSAGES)
|
||||
#define LC_ALL_MASK (LC_NUMERIC_MASK | LC_CTYPE_MASK | LC_COLLATE_MASK | LC_TIME_MASK | LC_MONETARY_MASK | LC_MESSAGES_MASK)
|
||||
|
||||
struct lconv {
|
||||
char* decimal_point;
|
||||
char* thousands_sep;
|
||||
@@ -54,7 +62,13 @@ struct lconv {
|
||||
char int_n_sign_posn;
|
||||
};
|
||||
|
||||
struct __locale_t_impl;
|
||||
typedef struct __locale_t_impl* locale_t;
|
||||
|
||||
struct lconv* localeconv(void);
|
||||
void freelocale(locale_t);
|
||||
locale_t newlocale(int, char const*, locale_t);
|
||||
char* setlocale(int category, char const* locale);
|
||||
locale_t uselocale(locale_t);
|
||||
|
||||
__END_DECLS
|
||||
Reference in new issue
Block a user