MCPcopy Create free account
hub / github.com/SakuraEngine/SakuraEngine / main

Function main

tests/daS/daSTestHybrid/main.cpp:11–36  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9)"""";
10
11int main( int, char * [] ) {
12 // request all da-script built in modules
13 NEED_ALL_DEFAULT_MODULES;
14 // Initialize modules
15 Module::Initialize();
16 // make file access, introduce string as if it was a file
17 auto fAccess = make_smart<FsFileAccess>();
18 auto fileInfo = make_unique<TextFileInfo>(tutorial_text, uint32_t(strlen(tutorial_text)), false);
19 fAccess->setFileInfo("dummy.das", das::move(fileInfo));
20 // compile script
21 TextPrinter tout;
22 ModuleGroup dummyLibGroup;
23 auto program = compileDaScript("dummy.das", fAccess, tout, dummyLibGroup);
24 if ( program->failed() ) return -1;
25 // create context
26 Context ctx(program->getContextStackSize());
27 if ( !program->simulate(ctx, tout) ) return -2;
28 // find function. its up to application to check, if function is not null
29 auto function = ctx.findFunction("test");
30 if ( !function ) return -3;
31 // call context function
32 ctx.evalWithCatch(function, nullptr);
33 // shut-down daScript, free all memory
34 Module::Shutdown();
35 return 0;
36}

Callers

nothing calls this directly

Calls 10

InitializeFunction · 0.85
compileDaScriptFunction · 0.85
ShutdownFunction · 0.85
setFileInfoMethod · 0.80
getContextStackSizeMethod · 0.80
evalWithCatchMethod · 0.80
moveFunction · 0.50
failedMethod · 0.45
simulateMethod · 0.45
findFunctionMethod · 0.45

Tested by

no test coverage detected