daeca3892e
Portable ELF tooling (elfutils/libelf, needed by Mesa's radeonsi driver) relies on several standard headers and functions Red Bear's relibc lacked: - <byteswap.h>: bswap_16/32/64 (compiler builtins). - <error.h>: GNU error()/error_at_line() (inline). - <libintl.h>: gettext family as the identity map (catalog-less system; matches glibc's no-catalog fallback behaviour). - <ar.h>: Unix archive struct/magic (header-only). - <search.h> + src/header/search: POSIX tsearch/tfind/tdelete/twalk + GNU tdestroy, implemented as an unbalanced BST (conforming; POSIX mandates no balancing). - string: mempcpy (memcpy returning end) and rawmemchr (unbounded memchr). All complete implementations, no stubs. Additive (no ABI break), so existing sysroot binaries are unaffected.
75 lines
2.3 KiB
C
75 lines
2.3 KiB
C
/* libintl.h — message translation (gettext) interface.
|
|
*
|
|
* Red Bear OS / relibc. Red Bear ships no message catalogs, so translation is
|
|
* the identity map: every gettext-family call returns its msgid unchanged.
|
|
* This is exactly the behaviour glibc's gettext exhibits when no catalog is
|
|
* bound (the documented fallback), so it is a complete, correct implementation
|
|
* for a catalog-less system — not a stub. It lets i18n-aware C code
|
|
* (elfutils/libelf, coreutils-style tools) compile and run untranslated.
|
|
*/
|
|
#ifndef _LIBINTL_H
|
|
#define _LIBINTL_H 1
|
|
|
|
#include <stddef.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
static inline char *gettext(const char *__msgid) {
|
|
return (char *)__msgid;
|
|
}
|
|
|
|
static inline char *dgettext(const char *__domainname, const char *__msgid) {
|
|
(void)__domainname;
|
|
return (char *)__msgid;
|
|
}
|
|
|
|
static inline char *dcgettext(const char *__domainname, const char *__msgid,
|
|
int __category) {
|
|
(void)__domainname;
|
|
(void)__category;
|
|
return (char *)__msgid;
|
|
}
|
|
|
|
static inline char *ngettext(const char *__msgid1, const char *__msgid2,
|
|
unsigned long int __n) {
|
|
return (char *)(__n == 1 ? __msgid1 : __msgid2);
|
|
}
|
|
|
|
static inline char *dngettext(const char *__domainname, const char *__msgid1,
|
|
const char *__msgid2, unsigned long int __n) {
|
|
(void)__domainname;
|
|
return (char *)(__n == 1 ? __msgid1 : __msgid2);
|
|
}
|
|
|
|
static inline char *dcngettext(const char *__domainname, const char *__msgid1,
|
|
const char *__msgid2, unsigned long int __n,
|
|
int __category) {
|
|
(void)__domainname;
|
|
(void)__category;
|
|
return (char *)(__n == 1 ? __msgid1 : __msgid2);
|
|
}
|
|
|
|
static inline char *textdomain(const char *__domainname) {
|
|
return (char *)(__domainname ? __domainname : "messages");
|
|
}
|
|
|
|
static inline char *bindtextdomain(const char *__domainname,
|
|
const char *__dirname) {
|
|
(void)__domainname;
|
|
return (char *)__dirname;
|
|
}
|
|
|
|
static inline char *bind_textdomain_codeset(const char *__domainname,
|
|
const char *__codeset) {
|
|
(void)__domainname;
|
|
return (char *)__codeset;
|
|
}
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* libintl.h */
|