| 560 | } |
| 561 | |
| 562 | void fxVerifyCode(txMachine* the, txSlot* list, txSlot* path, txByte* codeBuffer, txSize codeSize) |
| 563 | { |
| 564 | const txS1* bytes = gxCodeSizes; |
| 565 | txByte* p = codeBuffer; |
| 566 | txByte* q = p + codeSize; |
| 567 | txU1 byte; |
| 568 | txS1 offset; |
| 569 | txID id; |
| 570 | txInteger count = 0; |
| 571 | txByte flag = 0; |
| 572 | txByte* flags = fxGetHostChunk(the, mxVarv(0)); |
| 573 | while (p < q) { |
| 574 | // fprintf(stderr, "%s", gxCodeNames[*((txU1*)p)]); |
| 575 | byte = (txU1)c_read8(p); |
| 576 | offset = (txS1)c_read8(bytes + byte); |
| 577 | if (0 < offset) { |
| 578 | p += offset; |
| 579 | } |
| 580 | else if (0 == offset) { |
| 581 | p++; |
| 582 | mxDecodeID(p, id); |
| 583 | if (byte == XS_CODE_PROGRAM_REFERENCE) { |
| 584 | flag = 1; |
| 585 | flags[id] = 1; |
| 586 | } |
| 587 | } |
| 588 | else if (-1 == offset) { |
| 589 | txU1 index; |
| 590 | p++; |
| 591 | index = *((txU1*)p); |
| 592 | p += 1 + index; |
| 593 | } |
| 594 | else if (-2 == offset) { |
| 595 | txU2 index; |
| 596 | p++; |
| 597 | mxDecode2(p, index); |
| 598 | p += index; |
| 599 | } |
| 600 | else if (-4 == offset) { |
| 601 | txS4 index; |
| 602 | p++; |
| 603 | mxDecode4(p, index); |
| 604 | p += index; |
| 605 | } |
| 606 | // fprintf(stderr, "\n"); |
| 607 | if ((XS_CODE_BEGIN_SLOPPY <= byte) && (byte <= XS_CODE_BEGIN_STRICT_FIELD)) { |
| 608 | count++; |
| 609 | } |
| 610 | else if ((XS_CODE_END <= byte) && (byte <= XS_CODE_END_DERIVED)) { |
| 611 | count--; |
| 612 | if (count == 0) |
| 613 | break; |
| 614 | } |
| 615 | } |
| 616 | if (flag) { |
| 617 | txSlot* instance = fxGetInstance(the, mxVarv(1)); |
| 618 | txSlot* item; |
| 619 | txSlot* name; |
no test coverage detected