Guest User

Untitled

a guest
Dec 6th, 2016
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.61 KB | None | 0 0
  1.  0.0000: Begin initalizing engine.
  2.     0.5910: OpenGL Version: 4.5 (Core Profile) Mesa 13.0.2
  3.     0.5910: Initializing scheduler
  4.     0.5910: Engine ready.
  5.     0.5910: Start task 0xa6d0b1
  6.     0.5910: Create co 0xa6d0b1
  7.     0.5910: Start task done.
  8.     0.5910: Hello from script!
  9. // das hier kommt von passthrough
  10.     0.5910: Call EP 0xa6d090
  11.     0.5910: ackmain reporting in
  12.     0.5910: Done EP
  13. // das hier kommt von passthrough2
  14.     0.5910: Call EPContext 0xa6d090
  15.     0.5910: ackmain reporting in
  16.     0.5910: Done EPContext
  17.     0.5910: Starting ackmain:
  18. // das hier kommt von task_start
  19.     0.5910: Start task 0xbc0a3c
  20.     0.5910: Create co 0xbc0a3c
  21.     0.5910: Start task done.
  22.     0.5910: alive?
  23.     0.5910: Leave co
  24. The program has unexpectedly finished.
  25.  
  26. // gemeinsamer header:
  27. ACKFUN HANDLE task_start(void (*fn)(), void * context);
  28.  
  29.  
  30. // Im von TCC compilierten script:
  31. void main()
  32. {
  33.     engine_log("Hello from script!");
  34.  
  35.     passthrough(ackmain);
  36.  
  37.     context = &ackmain;
  38.     passthrough2();
  39.  
  40.     engine_log("Starting ackmain:");
  41.     start(ackmain, NULL);
  42. }
  43.  
  44. // Im C++-Code:
  45.  
  46.  
  47. ACKFUN void passthrough(void (*ep)())
  48. {
  49.     engine_log("Call EP %p", ep);
  50.     ep();
  51.     engine_log("Done EP");
  52. }
  53.  
  54. ACKFUN void passthrough2()
  55. {
  56.     void (*ep)() = reinterpret_cast<void (*)()>(context);
  57.     engine_log("Call EPContext %p", ep);
  58.     ep();
  59.     engine_log("Done EPContext");
  60. }
  61.  
  62. ACKFUN HANDLE task_start(void (*ep)(), void * context)
  63. {
  64.     engine_log("Start task %p", ep);
  65.     coroutines.emplace_back(ep, context);
  66.     engine_log("Start task done.");
  67.     return coroutines.back().handle;
  68. }
Advertisement
Add Comment
Please, Sign In to add comment