internal
| 1835 | |
| 1836 | // internal |
| 1837 | asCScriptFunction* asCScriptFunction::FindNextFunctionCalled(asUINT startSearchFromProgramPos, int *outStackDelta, asUINT *outProgramPos) |
| 1838 | { |
| 1839 | if (scriptData == 0) |
| 1840 | return 0; |
| 1841 | |
| 1842 | if (outProgramPos) |
| 1843 | *outProgramPos = startSearchFromProgramPos; |
| 1844 | |
| 1845 | // Find out which function that will be called |
| 1846 | asCScriptFunction* calledFunc = 0; |
| 1847 | int stackDelta = 0; |
| 1848 | for (asUINT n = startSearchFromProgramPos; n < scriptData->byteCode.GetLength(); ) |
| 1849 | { |
| 1850 | asBYTE bc = *(asBYTE*)&scriptData->byteCode[n]; |
| 1851 | if (bc == asBC_CALL || |
| 1852 | bc == asBC_CALLSYS || |
| 1853 | bc == asBC_Thiscall1 || |
| 1854 | bc == asBC_CALLINTF || |
| 1855 | bc == asBC_ALLOC || |
| 1856 | bc == asBC_CALLBND || |
| 1857 | bc == asBC_CallPtr) |
| 1858 | { |
| 1859 | calledFunc = GetCalledFunction(n); |
| 1860 | |
| 1861 | if (outProgramPos) |
| 1862 | *outProgramPos = n + asBCTypeSize[asBCInfo[bc].type]; |
| 1863 | |
| 1864 | break; |
| 1865 | } |
| 1866 | |
| 1867 | // Keep track of the stack size between the |
| 1868 | // instruction that needs to be adjusted and the call |
| 1869 | stackDelta += asBCInfo[bc].stackInc; |
| 1870 | |
| 1871 | n += asBCTypeSize[asBCInfo[bc].type]; |
| 1872 | } |
| 1873 | |
| 1874 | if (outStackDelta) |
| 1875 | *outStackDelta = stackDelta; |
| 1876 | |
| 1877 | return calledFunc; |
| 1878 | } |
| 1879 | |
| 1880 | // internal |
| 1881 | asCScriptFunction* asCScriptFunction::GetCalledFunction(asDWORD programPos) |
no test coverage detected