| 676 | } |
| 677 | |
| 678 | void fxRemapCode(txLinker* linker, txLinkerScript* script) |
| 679 | { |
| 680 | register const txS1* sizes = gxCodeSizes; |
| 681 | register txByte* p = script->codeBuffer; |
| 682 | register txByte* q = p + script->codeSize; |
| 683 | register txByte* r = (txByte*)linker->map; |
| 684 | register txS1 offset; |
| 685 | txU1 code; |
| 686 | txU2 index; |
| 687 | txID id; |
| 688 | while (p < q) { |
| 689 | code = *((txU1*)p); |
| 690 | offset = (txS1)sizes[code]; |
| 691 | if (0 < offset) { |
| 692 | p += offset; |
| 693 | } |
| 694 | else if (0 == offset) { |
| 695 | p++; |
| 696 | mxDecodeID(p, id); |
| 697 | mxEncodeID(r, id); |
| 698 | p -= sizeof(txID); |
| 699 | id = XS_NO_ID; |
| 700 | mxEncodeID(p, id); |
| 701 | } |
| 702 | else if (-1 == offset) { |
| 703 | p++; |
| 704 | index = *((txU1*)p); |
| 705 | p += 1 + index; |
| 706 | } |
| 707 | else if (-2 == offset) { |
| 708 | p++; |
| 709 | mxDecode2(p, index); |
| 710 | p += index; |
| 711 | } |
| 712 | else if (-4 == offset) { |
| 713 | p++; |
| 714 | mxDecode4(p, index); |
| 715 | p += index; |
| 716 | } |
| 717 | } |
| 718 | linker->map = (txID*)r; |
| 719 | } |
| 720 | |
| 721 | void fxReportLinkerError(txLinker* linker, txString theFormat, ...) |
| 722 | { |