makeargs.py 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. text = """
  2. #define FUNC$numR(m_r,m_func,$argt)\\
  3. virtual m_r m_func($argtp) { \\
  4. if (Thread::get_caller_id()!=server_thread) {\\
  5. m_r ret;\\
  6. command_queue.push_and_ret( visual_server, &VisualServer::m_func,$argp,&ret);\\
  7. return ret;\\
  8. } else {\\
  9. return visual_server->m_func($argp);\\
  10. }\\
  11. }
  12. #define FUNC$numRC(m_r,m_func,$argt)\\
  13. virtual m_r m_func($argtp) const { \\
  14. if (Thread::get_caller_id()!=server_thread) {\\
  15. m_r ret;\\
  16. command_queue.push_and_ret( visual_server, &VisualServer::m_func,$argp,&ret);\\
  17. return ret;\\
  18. } else {\\
  19. return visual_server->m_func($argp);\\
  20. }\\
  21. }
  22. #define FUNC$numS(m_func,$argt)\\
  23. virtual void m_func($argtp) { \\
  24. if (Thread::get_caller_id()!=server_thread) {\\
  25. command_queue.push_and_sync( visual_server, &VisualServer::m_func,$argp);\\
  26. } else {\\
  27. visual_server->m_func($argp);\\
  28. }\\
  29. }
  30. #define FUNC$numSC(m_func,$argt)\\
  31. virtual void m_func($argtp) const { \\
  32. if (Thread::get_caller_id()!=server_thread) {\\
  33. command_queue.push_and_sync( visual_server, &VisualServer::m_func,$argp);\\
  34. } else {\\
  35. visual_server->m_func($argp);\\
  36. }\\
  37. }
  38. #define FUNC$num(m_func,$argt)\\
  39. virtual void m_func($argtp) { \\
  40. if (Thread::get_caller_id()!=server_thread) {\\
  41. command_queue.push( visual_server, &VisualServer::m_func,$argp);\\
  42. } else {\\
  43. visual_server->m_func($argp);\\
  44. }\\
  45. }
  46. #define FUNC$numC(m_func,$argt)\\
  47. virtual void m_func($argtp) const { \\
  48. if (Thread::get_caller_id()!=server_thread) {\\
  49. command_queue.push( visual_server, &VisualServer::m_func,$argp);\\
  50. } else {\\
  51. visual_server->m_func($argp);\\
  52. }\\
  53. }
  54. """
  55. for i in range(1, 8):
  56. tp = ""
  57. p = ""
  58. t = ""
  59. for j in range(i):
  60. if (j > 0):
  61. tp += ", "
  62. p += ", "
  63. t += ", "
  64. tp += ("m_arg" + str(j + 1) + " p" + str(j + 1))
  65. p += ("p" + str(j + 1))
  66. t += ("m_arg" + str(j + 1))
  67. t = text.replace("$argtp", tp).replace("$argp", p).replace("$argt", t).replace("$num", str(i))
  68. print(t)