MCPcopy Create free account
hub / github.com/HaxeFoundation/hxcpp / CppiaObject

Class CppiaObject

src/hx/cppia/CppiaModule.cpp:279–355  ·  view source on GitHub ↗

Cppia Object - manage

Source from the content-addressed store, hash-verified

277
278// Cppia Object - manage
279class CppiaObject : public hx::CppiaLoadedModule_obj
280{
281public:
282 CppiaModule *cppia;
283 bool booted;
284
285 CppiaObject(CppiaModule *inModule)
286 {
287 cppia = inModule;
288 GCSetFinalizer( this, onRelease );
289 }
290 static void onRelease(hx::Object *inObj)
291 {
292 delete ((CppiaObject *)inObj)->cppia;
293 }
294 void __Mark(hx::MarkContext *ctx) HXCPP_OVERRIDE { cppia->mark(ctx); }
295#ifdef HXCPP_VISIT_ALLOCS
296 void __Visit(hx::VisitContext *ctx) HXCPP_OVERRIDE { cppia->visit(ctx); }
297#endif
298
299
300 void boot() HXCPP_OVERRIDE
301 {
302 if (booted)
303 return;
304
305 booted = true;
306 try
307 {
308 DBGLOG("--- Boot --------------------------------------------\n");
309 CppiaCtx *ctx = CppiaCtx::getCurrent();
310 cppia->boot(ctx);
311 }
312 catch(const char *errorString)
313 {
314 String error(errorString);
315 hx::Throw(error);
316 }
317 }
318
319
320 void run() HXCPP_OVERRIDE
321 {
322 if (!booted)
323 boot();
324 if (cppia->main)
325 {
326 try
327 {
328 //__hxcpp_enable(false);
329 DBGLOG("--- Run --------------------------------------------\n");
330 CppiaCtx *ctx = CppiaCtx::getCurrent();
331 ctx->runVoid(cppia->main);
332 if (ctx->exception)
333 {
334 hx::Object *e = ctx->exception;
335 ctx->exception = 0;
336 hx::Throw( Dynamic(e) );

Callers

nothing calls this directly

Calls 4

ThrowFunction · 0.85
bootMethod · 0.80
DynamicClass · 0.50
runVoidMethod · 0.45

Tested by

no test coverage detected