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

Function fxEchoString

xs/sources/xsDebug.c:2196–2269  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2194}
2195
2196void fxEchoString(txMachine* the, txString theString)
2197{
2198 static const txByte gxEscape[256] ICACHE_FLASH_ATTR = {
2199 /* 0 1 2 3 4 5 6 7 8 9 A B C D E F */
2200 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0x */
2201 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 1x */
2202 1,1,0,1,1,1,0,1,1,1,1,1,1,1,1,1, /* 2x !"#$%&'()*+,-./ */
2203 1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1, /* 3x 0123456789:;<=>? */
2204 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 4x @ABCDEFGHIJKLMNO */
2205 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 5X PQRSTUVWXYZ[\]^_ */
2206 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 6x `abcdefghijklmno */
2207 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0, /* 7X pqrstuvwxyz{|}~ */
2208 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 8X */
2209 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 9X */
2210 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* AX */
2211 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* BX */
2212 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* CX */
2213 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* FX */
2214 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* EX */
2215 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 /* FX */
2216 };
2217 txU1 tmp;
2218 txU1* src;
2219 txU1* dst;
2220 txU1* start;
2221 txU1* stop;
2222
2223 src = (txU1*)theString;
2224 dst = (txU1*)the->echoBuffer + the->echoOffset;
2225 start = (txU1*)the->echoBuffer;
2226 stop = (txU1*)the->echoBuffer + sizeof(the->echoBuffer) - 1;
2227 while ((tmp = c_read8(src))) {
2228 src++;
2229 if (dst + 6 > stop) {
2230 the->echoOffset = mxPtrDiff(dst - start);
2231 fxSend(the, 1);
2232 dst = start;
2233 }
2234#if mxCESU8
2235 if (tmp & 0x80) {
2236 txInteger character;
2237 src = (txU1*)fxCESU8Decode((txString)src - 1, &character);
2238 if (character > 128) {
2239 dst = (txU1*)fxUTF8Encode((txString)dst, character);
2240 continue;
2241 }
2242 tmp = (txU1)character;
2243 }
2244#endif
2245 if (c_read8(gxEscape + tmp))
2246 *dst++ = tmp;
2247 else {
2248 *(dst++) = '&';
2249 *(dst++) = '#';
2250 if (tmp >= 100) {
2251 *(dst++) = '0' + (tmp / 100);
2252 tmp %= 100;
2253 *(dst++) = '0' + (tmp / 10);

Callers 15

fxDebugLineFunction · 0.85
fxDebugLoopFunction · 0.85
fxEchoCharacterFunction · 0.85
fxEchoExceptionFunction · 0.85
fxEchoFormatFunction · 0.85
fxEchoInstanceFunction · 0.85
fxEchoPathLineFunction · 0.85
fxEchoPropertyFunction · 0.85
fxEchoPropertyNameFunction · 0.85
fxEchoTypedArrayFunction · 0.85
fxLoginFunction · 0.85
fxBubbleFunction · 0.85

Calls 3

fxCESU8DecodeFunction · 0.85
fxUTF8EncodeFunction · 0.85
fxSendFunction · 0.70

Tested by

no test coverage detected