MCPcopy Create free account
hub / github.com/anjo76/angelscript / GetScriptSectionNameIndex

Method GetScriptSectionNameIndex

sdk/angelscript/source/as_scriptengine.cpp:6531–6557  ·  view source on GitHub ↗

internal

Source from the content-addressed store, hash-verified

6529
6530// internal
6531int asCScriptEngine::GetScriptSectionNameIndex(const char *name)
6532{
6533 ACQUIREEXCLUSIVE(engineRWLock);
6534
6535 // TODO: These names are only released when the engine is freed. The assumption is that
6536 // the same script section names will be reused instead of there always being new
6537 // names. Is this assumption valid? Do we need to add reference counting?
6538
6539 // Store the script section names for future reference
6540 for( asUINT n = 0; n < scriptSectionNames.GetLength(); n++ )
6541 {
6542 if( scriptSectionNames[n]->Compare(name) == 0 )
6543 {
6544 RELEASEEXCLUSIVE(engineRWLock);
6545 return n;
6546 }
6547 }
6548
6549 asCString *str = asNEW(asCString)(name);
6550 if( str )
6551 scriptSectionNames.PushLast(str);
6552 int r = int(scriptSectionNames.GetLength()-1);
6553
6554 RELEASEEXCLUSIVE(engineRWLock);
6555
6556 return r;
6557}
6558
6559// interface
6560void asCScriptEngine::SetEngineUserDataCleanupCallback(asCLEANENGINEFUNC_t callback, asPWORD type)

Callers 7

ReadFunctionMethod · 0.80
FindOrAddCodeMethod · 0.80
CompileGlobalVarMethod · 0.80
CompileFunctionMethod · 0.80
AddScriptSectionMethod · 0.80

Calls 3

CompareMethod · 0.80
PushLastMethod · 0.80
GetLengthMethod · 0.45

Tested by

no test coverage detected