interface
| 5812 | |
| 5813 | // interface |
| 5814 | int asCScriptEngine::RemoveConfigGroup(const char *groupName) |
| 5815 | { |
| 5816 | // It is not allowed to remove a group that is still in use. |
| 5817 | |
| 5818 | // It would be possible to change the code in such a way that |
| 5819 | // the group could be removed even though it was still in use, |
| 5820 | // but that would cause severe negative impact on runtime |
| 5821 | // performance, since the VM would then have to be able handle |
| 5822 | // situations where the types, functions, and global variables |
| 5823 | // can be removed at any time. |
| 5824 | |
| 5825 | for( asUINT n = 0; n < configGroups.GetLength(); n++ ) |
| 5826 | { |
| 5827 | if( configGroups[n]->groupName == groupName ) |
| 5828 | { |
| 5829 | asCConfigGroup *group = configGroups[n]; |
| 5830 | |
| 5831 | // Remove any unused generated template instances |
| 5832 | // before verifying if the config group is still in use. |
| 5833 | // RemoveTemplateInstanceType() checks if the instance is in use |
| 5834 | for( asUINT g = generatedTemplateTypes.GetLength(); g-- > 0; ) |
| 5835 | RemoveTemplateInstanceType(generatedTemplateTypes[g]); |
| 5836 | |
| 5837 | // Make sure the group isn't referenced by anyone |
| 5838 | if( group->refCount > 0 ) |
| 5839 | return asCONFIG_GROUP_IS_IN_USE; |
| 5840 | |
| 5841 | // Verify if any objects registered in this group is still alive |
| 5842 | if( group->HasLiveObjects() ) |
| 5843 | return asCONFIG_GROUP_IS_IN_USE; |
| 5844 | |
| 5845 | // Remove the group from the list |
| 5846 | if( n == configGroups.GetLength() - 1 ) |
| 5847 | configGroups.PopLast(); |
| 5848 | else |
| 5849 | configGroups[n] = configGroups.PopLast(); |
| 5850 | |
| 5851 | // Remove the configurations registered with this group |
| 5852 | group->RemoveConfiguration(this); |
| 5853 | |
| 5854 | asDELETE(group,asCConfigGroup); |
| 5855 | } |
| 5856 | } |
| 5857 | |
| 5858 | return 0; |
| 5859 | } |
| 5860 | |
| 5861 | asCConfigGroup *asCScriptEngine::FindConfigGroupForFunction(int funcId) const |
| 5862 | { |