Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 0.0000: Begin initalizing engine.
- 0.5910: OpenGL Version: 4.5 (Core Profile) Mesa 13.0.2
- 0.5910: Initializing scheduler
- 0.5910: Engine ready.
- 0.5910: Start task 0xa6d0b1
- 0.5910: Create co 0xa6d0b1
- 0.5910: Start task done.
- 0.5910: Hello from script!
- // das hier kommt von passthrough
- 0.5910: Call EP 0xa6d090
- 0.5910: ackmain reporting in
- 0.5910: Done EP
- // das hier kommt von passthrough2
- 0.5910: Call EPContext 0xa6d090
- 0.5910: ackmain reporting in
- 0.5910: Done EPContext
- 0.5910: Starting ackmain:
- // das hier kommt von task_start
- 0.5910: Start task 0xbc0a3c
- 0.5910: Create co 0xbc0a3c
- 0.5910: Start task done.
- 0.5910: alive?
- 0.5910: Leave co
- The program has unexpectedly finished.
- // gemeinsamer header:
- ACKFUN HANDLE task_start(void (*fn)(), void * context);
- // Im von TCC compilierten script:
- void main()
- {
- engine_log("Hello from script!");
- passthrough(ackmain);
- context = &ackmain;
- passthrough2();
- engine_log("Starting ackmain:");
- start(ackmain, NULL);
- }
- // Im C++-Code:
- ACKFUN void passthrough(void (*ep)())
- {
- engine_log("Call EP %p", ep);
- ep();
- engine_log("Done EP");
- }
- ACKFUN void passthrough2()
- {
- void (*ep)() = reinterpret_cast<void (*)()>(context);
- engine_log("Call EPContext %p", ep);
- ep();
- engine_log("Done EPContext");
- }
- ACKFUN HANDLE task_start(void (*ep)(), void * context)
- {
- engine_log("Start task %p", ep);
- coroutines.emplace_back(ep, context);
- engine_log("Start task done.");
- return coroutines.back().handle;
- }
Advertisement
Add Comment
Please, Sign In to add comment