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

Function fxPrintString

xs/sources/xsProfile.c:509–537  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

507}
508
509void fxPrintString(txMachine* the, FILE* file, txString theString)
510{
511 char buffer[16];
512 for (;;) {
513 txInteger character;
514 char *p;
515 theString = mxStringByteDecode(theString, &character);
516 if (character == C_EOF)
517 break;
518 p = buffer;
519 if ((character < 32) || ((0xD800 <= character) && (character <= 0xDFFF))) {
520 *p++ = '\\';
521 *p++ = 'u';
522 p = fxStringifyUnicodeEscape(p, character, '\\');
523 }
524 else if (character == '"') {
525 *p++ = '\\';
526 *p++ = '"';
527 }
528 else if (character == '\\') {
529 *p++ = '\\';
530 *p++ = '\\';
531 }
532 else
533 p = mxStringByteEncode(p, character);
534 *p = 0;
535 fprintf(file, "%s", buffer);
536 }
537}
538
539#ifdef mxMetering
540void fxPushProfilerSample(txMachine* the, txID recordID, txU4 delta, txU4 deltaMeter)

Callers 1

fxPrintIDFunction · 0.85

Calls 1

fxStringifyUnicodeEscapeFunction · 0.85

Tested by

no test coverage detected