| 489 | } |
| 490 | |
| 491 | void fx_print(xsMachine* the) |
| 492 | { |
| 493 | xsIntegerValue c = xsToInteger(xsArgc), i; |
| 494 | xsStringValue string, p, q; |
| 495 | xsVars(1); |
| 496 | xsVar(0) = xsGet(xsGlobal, xsID("String")); |
| 497 | for (i = 0; i < c; i++) { |
| 498 | if (i) |
| 499 | fprintf(stdout, " "); |
| 500 | xsArg(i) = xsCallFunction1(xsVar(0), xsUndefined, xsArg(i)); |
| 501 | p = string = xsToString(xsArg(i)); |
| 502 | #if mxCESU8 |
| 503 | for (;;) { |
| 504 | xsIntegerValue character; |
| 505 | q = fxUTF8Decode(p, &character); |
| 506 | again: |
| 507 | if (character == C_EOF) |
| 508 | break; |
| 509 | if (character == 0) { |
| 510 | if (p > string) { |
| 511 | char c = *p; |
| 512 | *p = 0; |
| 513 | fprintf(stdout, "%s", string); |
| 514 | *p = c; |
| 515 | } |
| 516 | string = q; |
| 517 | } |
| 518 | else if ((0x0000D800 <= character) && (character <= 0x0000DBFF)) { |
| 519 | xsStringValue r = q; |
| 520 | xsIntegerValue surrogate; |
| 521 | q = fxUTF8Decode(r, &surrogate); |
| 522 | if ((0x0000DC00 <= surrogate) && (surrogate <= 0x0000DFFF)) { |
| 523 | char buffer[5]; |
| 524 | character = (txInteger)(0x00010000 + ((character & 0x03FF) << 10) + (surrogate & 0x03FF)); |
| 525 | if (p > string) { |
| 526 | char c = *p; |
| 527 | *p = 0; |
| 528 | fprintf(stdout, "%s", string); |
| 529 | *p = c; |
| 530 | } |
| 531 | p = fxUTF8Encode(buffer, character); |
| 532 | *p = 0; |
| 533 | fprintf(stdout, "%s", buffer); |
| 534 | string = q; |
| 535 | } |
| 536 | else { |
| 537 | p = r; |
| 538 | character = surrogate; |
| 539 | goto again; |
| 540 | } |
| 541 | } |
| 542 | p = q; |
| 543 | } |
| 544 | #endif |
| 545 | fprintf(stdout, "%s", string); |
| 546 | } |
| 547 | fprintf(stdout, "\n"); |
| 548 | } |
nothing calls this directly
no test coverage detected