MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / fxUTF8Decode

Function fxUTF8Decode

xs/sources/xsCommon.c:992–1016  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

990}
991
992txString fxUTF8Decode(txString string, txInteger* character)
993{
994 txU1* p = (txU1*)string;
995 txU4 c = c_read8(p++);
996 if (c) {
997 if (c & 0x80) {
998 const txUTF8Sequence *sequence;
999 txS4 size;
1000 for (sequence = gxUTF8Sequences; sequence->size; sequence++) {
1001 if ((c & sequence->cmask) == sequence->cval)
1002 break;
1003 }
1004 size = sequence->size - 1;
1005 while (size > 0) {
1006 size--;
1007 c = (c << 6) | (c_read8(p++) & 0x3F);
1008 }
1009 c &= sequence->lmask;
1010 }
1011 *character = (txInteger)c;
1012 return (txString)p;
1013 }
1014 *character = C_EOF;
1015 return (txString)p;
1016}
1017
1018txString fxUTF8Encode(txString string, txInteger character)
1019{

Callers 15

xs_textencoder_encodeFunction · 0.85
xs_textdecoder_decodeFunction · 0.85
PiuFontGetWidthFunction · 0.85
PiuViewDrawStringFunction · 0.85
PiuTextAdvanceFunction · 0.85
PiuFontGetWidthFunction · 0.85
PiuViewDrawStringAuxFunction · 0.85
PiuCodeFindWordBreakFunction · 0.85
PiuCode_isSpaceFunction · 0.85
PiuCodeParserAdvanceFunction · 0.85
fx_printFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected