| 670 | } |
| 671 | |
| 672 | unsigned int nullcFindFunctionIndex(const char* name) |
| 673 | { |
| 674 | using namespace NULLC; |
| 675 | |
| 676 | if(!linker) |
| 677 | { |
| 678 | nullcLastError = "ERROR: NULLC cannot find linked code"; |
| 679 | return ~0u; |
| 680 | } |
| 681 | if(!name) |
| 682 | { |
| 683 | nullcLastError = "ERROR: function name is 'null'"; |
| 684 | return ~0u; |
| 685 | } |
| 686 | unsigned int hash = GetStringHash(name); |
| 687 | unsigned int index = ~0u; |
| 688 | for(unsigned int i = 0; i < linker->exFunctions.size(); i++) |
| 689 | { |
| 690 | if(linker->exFunctions[i].nameHash == hash) |
| 691 | { |
| 692 | if(index != ~0u) |
| 693 | { |
| 694 | nullcLastError = "ERROR: there is more than one function with the same name"; |
| 695 | return ~0u; |
| 696 | } |
| 697 | index = i; |
| 698 | } |
| 699 | } |
| 700 | if(index == ~0u) |
| 701 | { |
| 702 | nullcLastError = "ERROR: function with such name cannot be found"; |
| 703 | return ~0u; |
| 704 | } |
| 705 | if(linker->exFunctions[index].funcCat != ExternFuncInfo::NORMAL) |
| 706 | { |
| 707 | nullcLastError = "ERROR: function uses context, which is unavailable"; |
| 708 | return ~0u; |
| 709 | } |
| 710 | return index; |
| 711 | } |
| 712 | |
| 713 | nullres nullcGetFunction(const char* name, NULLCFuncPtr* func) |
| 714 | { |
no test coverage detected