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

Function fxRemapIDs

xs/sources/xsRun.c:4891–4932  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4889}
4890
4891void fxRemapIDs(txMachine* the, txByte* codeBuffer, txSize codeSize, txID* theIDs)
4892{
4893 register const txS1* bytes = gxCodeSizes;
4894 register txByte* p = codeBuffer;
4895 register txByte* q = codeBuffer + codeSize;
4896 register txS1 offset;
4897 txID id;
4898 while (p < q) {
4899 //fprintf(stderr, "%s", gxCodeNames[*((txU1*)p)]);
4900 offset = (txS1)c_read8(bytes + c_read8(p));
4901 if (0 < offset)
4902 p += offset;
4903 else if (0 == offset) {
4904 p++;
4905 mxDecodeID(p, id);
4906 if (id != XS_NO_ID) {
4907 id = theIDs[id];
4908 p -= sizeof(txID);
4909 mxEncodeID(p, id);
4910 }
4911 }
4912 else if (-1 == offset) {
4913 txU1 index;
4914 p++;
4915 index = *((txU1*)p);
4916 p += 1 + index;
4917 }
4918 else if (-2 == offset) {
4919 txU2 index;
4920 p++;
4921 mxDecode2(p, index);
4922 p += index;
4923 }
4924 else if (-4 == offset) {
4925 txS4 index;
4926 p++;
4927 mxDecode4(p, index);
4928 p += index;
4929 }
4930 //fprintf(stderr, "\n");
4931 }
4932}
4933
4934void fxRemapScript(txMachine* the, txScript* script)
4935{

Callers 1

fxRemapScriptFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected