| 9 | )""""; |
| 10 | |
| 11 | int 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 | } |
nothing calls this directly
no test coverage detected