unicode: add UCS4 constants

Four helpers that define maximum UCS4 values, invalid values and a
replacement character for unknown values.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This commit is contained in:
David Herrmann 2012-09-14 18:00:59 +02:00
parent c1075fba18
commit 468e265138
2 changed files with 5 additions and 1 deletions

View File

@ -465,7 +465,7 @@ int tsm_utf8_mach_feed(struct tsm_utf8_mach *mach, char ci)
uint32_t tsm_utf8_mach_get(struct tsm_utf8_mach *mach)
{
if (!mach || mach->state != TSM_UTF8_ACCEPT)
return KMSCON_UCS4_INVALID;
return TSM_UCS4_REPLACEMENT;
return mach->ch;
}

View File

@ -51,6 +51,10 @@
#include <inttypes.h>
#include <stdlib.h>
#define TSM_UCS4_MAX (0x7fffffffUL)
#define TSM_UCS4_INVALID (TSM_UCS4_MAX + 1)
#define TSM_UCS4_REPLACEMENT (0xfffdUL)
/* symbols */
typedef uint32_t kmscon_symbol_t;