Message catalog lookup and plural-form evaluation subroutines. This implementation comes from musl. See below for details and copyright info.
More...
#include "msgcat.h"
Go to the source code of this file.
|
| static uint64_t | msgcat_plural_eval (const char *, uint64_t) |
| static const char * | msgcat_mo_lookup (const void *p, size_t size, const char *s) |
| void | msgcat_init (msgcat_t *p, const void *map, size_t map_size) |
| | Initialize a msgcat_t, given the contents and content-length of a .mo file.
|
| const char * | msgcat_ngettext (const msgcat_t *p, const char *msgid1, const char *msgid2, uint64_t n) |
| | Return a translation, if present, from the given message catalog.
|
| static uint32_t | swapc (uint32_t x, int c) |
| uint32_t | msgcat_nstringsFromHeader (const char buf[12]) |
| | Return the number of strings in a message catalog, given its first 12 bytes.
|
| static const char * | skipspace (const char *s) |
| static const char * | evalexpr (struct st *st, const char *s, int d) |
| static const char * | evalprim (struct st *st, const char *s, int d) |
| static int | binop (struct st *st, int op, uint64_t left) |
| static const char * | parseop (struct st *st, const char *s) |
| static const char * | evalbinop (struct st *st, const char *s, int minprec, int d) |
Message catalog lookup and plural-form evaluation subroutines. This implementation comes from musl. See below for details and copyright info.
Definition in file msgcat.c.
◆ binop()
| int binop |
( |
struct st * | st, |
|
|
int | op, |
|
|
uint64_t | left ) |
|
static |
◆ evalbinop()
| const char * evalbinop |
( |
struct st * | st, |
|
|
const char * | s, |
|
|
int | minprec, |
|
|
int | d ) |
|
static |
◆ evalexpr()
| const char * evalexpr |
( |
struct st * | st, |
|
|
const char * | s, |
|
|
int | d ) |
|
static |
◆ evalprim()
| const char * evalprim |
( |
struct st * | st, |
|
|
const char * | s, |
|
|
int | d ) |
|
static |
◆ msgcat_init()
| void msgcat_init |
( |
msgcat_t * | p, |
|
|
const void * | map, |
|
|
size_t | map_size ) |
Initialize a msgcat_t, given the contents and content-length of a .mo file.
Definition at line 56 of file msgcat.c.
◆ msgcat_mo_lookup()
| const char * msgcat_mo_lookup |
( |
const void * | p, |
|
|
size_t | size, |
|
|
const char * | s ) |
|
static |
◆ msgcat_ngettext()
| const char * msgcat_ngettext |
( |
const msgcat_t * | p, |
|
|
const char * | msgid1, |
|
|
const char * | msgid2, |
|
|
uint64_t | n ) |
Return a translation, if present, from the given message catalog.
- Parameters
-
| p | The message catalog. |
| msgid1 | The English singular form. |
| msgid2 | The English plural form. (Pass NULL if simply translating msgid1.) |
| n | The number determining the plural form to use. (Pass 1 if simply translating msgid1.) |
- Returns
- The translation in the message catalog, if it exists, else NULL. (
msgid1 is not passed through; the higher-level gettext.c functions handle fallbacks.)
Definition at line 98 of file msgcat.c.
◆ msgcat_nstringsFromHeader()
| uint32_t msgcat_nstringsFromHeader |
( |
const char | buf[12] | ) |
|
Return the number of strings in a message catalog, given its first 12 bytes.
Definition at line 166 of file msgcat.c.
◆ msgcat_plural_eval()
| uint64_t msgcat_plural_eval |
( |
const char * | s, |
|
|
uint64_t | n ) |
|
static |
◆ parseop()
| const char * parseop |
( |
struct st * | st, |
|
|
const char * | s ) |
|
static |
◆ skipspace()
| const char * skipspace |
( |
const char * | s | ) |
|
|
static |
◆ swapc()
| uint32_t swapc |
( |
uint32_t | x, |
|
|
int | c ) |
|
inlinestatic |