parrotcode: UTF-8 encoding | |
Contents | C |
src/encodings/utf8.c - UTF-8 encoding
UTF-8 (http://www.utf-8.com/).
static UINTVAL utf8_characters
byte_len
bytes from *ptr
.static UINTVAL utf8_decode
*ptr
.static void *utf8_encode
c
.static const void *utf8_skip_forward
ptr
n
characters forward.static const void *utf8_skip_backward
ptr
n
characters back.static UINTVAL utf8_decode_and_advance
get_and_advance
function. if (UTF8_IS_START(c)) {
UINTVAL len = UTF8SKIP(u8ptr);
c &= UTF8_START_MASK(len);
i->bytepos += len;
for (len--; len; len--) {
u8ptr++;
if (!UTF8_IS_CONTINUATION(*u8ptr)) {
real_exception(interp, NULL, MALFORMED_UTF8, "Malformed UTF-8 string\n");
}
c = UTF8_ACCUMULATE(c, *u8ptr);
}
if (UNICODE_IS_SURROGATE(c)) {
real_exception(interp, NULL, MALFORMED_UTF8, "Surrogate in UTF-8 string\n");
}
}
else if (!UNICODE_IS_INVARIANT(c)) {
real_exception(interp, NULL, MALFORMED_UTF8, "Malformed UTF-8 string\n");
}
else {
i->bytepos++;
}
i->charpos++;
return c;
}
static void utf8_encode_and_advance
set_and_advance
function.static void utf8_set_position
set_position
function.static STRING *to_encoding
static UINTVAL get_codepoint
static void set_codepoint
static UINTVAL get_byte
static void set_byte
static STRING *get_codepoints
static STRING *get_bytes
static STRING *get_codepoints_inplace
static STRING *get_bytes_inplace
static void set_codepoints
static void set_bytes
static void become_encoding
static UINTVAL codepoints
static UINTVAL bytes
static void iter_init
ENCODING *Parrot_encoding_utf8_init
src/encodings/fixed_8.c, src/string.c, include/parrot/string.h, docs/string.pod.
|