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

Function print

sdk/tests/test_feature/source/test_addon_scriptarray.cpp:196–213  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

194
195static std::stringstream printResult;
196static void print(asIScriptGeneric* gen)
197{
198 void* ptr = *(void**)gen->GetAddressOfArg(0);
199 int typeId = gen->GetArgTypeId(0);
200
201 asIScriptContext* ctx = asGetActiveContext();
202 asIScriptEngine* engine = ctx->GetEngine();
203 asITypeInfo* ti = engine->GetTypeInfoById(typeId);
204 asIScriptFunction* func = ti->GetMethodByName("get_value");
205 ctx->PushState();
206 ctx->Prepare(func);
207 if (typeId & asTYPEID_OBJHANDLE)
208 ptr = *(void**)ptr;
209 ctx->SetObject(ptr); //##Crash!
210 ctx->Execute();
211 printResult << ctx->GetReturnDWord() << "\n";
212 ctx->PopState();
213}
214
215static bool testVal = false;
216static bool called = false;

Callers

nothing calls this directly

Calls 11

GetArgTypeIdMethod · 0.80
GetTypeInfoByIdMethod · 0.80
PushStateMethod · 0.80
SetObjectMethod · 0.80
ExecuteMethod · 0.80
GetReturnDWordMethod · 0.80
PopStateMethod · 0.80
GetAddressOfArgMethod · 0.45
GetEngineMethod · 0.45
GetMethodByNameMethod · 0.45
PrepareMethod · 0.45

Tested by

no test coverage detected