Logger.cpp 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. // Copyright (C) 2009-present, Panagiotis Christopoulos Charitos and contributors.
  2. // All rights reserved.
  3. // Code licensed under the BSD License.
  4. // http://www.anki3d.org/LICENSE
  5. // WARNING: This file is auto generated.
  6. #include <AnKi/Script/LuaBinder.h>
  7. namespace anki {
  8. /// Pre-wrap function logi.
  9. static inline int pwraplogi(lua_State* l)
  10. {
  11. [[maybe_unused]] LuaUserData* ud;
  12. [[maybe_unused]] void* voidp;
  13. [[maybe_unused]] PtrSize size;
  14. if(LuaBinder::checkArgsCount(l, 1)) [[unlikely]]
  15. {
  16. return -1;
  17. }
  18. // Pop arguments
  19. const char* arg0;
  20. if(LuaBinder::checkString(l, 1, arg0)) [[unlikely]]
  21. {
  22. return -1;
  23. }
  24. // Call the function
  25. ANKI_SCRIPT_LOGI("%s", arg0);
  26. return 0;
  27. }
  28. /// Wrap function logi.
  29. static int wraplogi(lua_State* l)
  30. {
  31. int res = pwraplogi(l);
  32. if(res >= 0)
  33. {
  34. return res;
  35. }
  36. lua_error(l);
  37. return 0;
  38. }
  39. /// Pre-wrap function loge.
  40. static inline int pwraploge(lua_State* l)
  41. {
  42. [[maybe_unused]] LuaUserData* ud;
  43. [[maybe_unused]] void* voidp;
  44. [[maybe_unused]] PtrSize size;
  45. if(LuaBinder::checkArgsCount(l, 1)) [[unlikely]]
  46. {
  47. return -1;
  48. }
  49. // Pop arguments
  50. const char* arg0;
  51. if(LuaBinder::checkString(l, 1, arg0)) [[unlikely]]
  52. {
  53. return -1;
  54. }
  55. // Call the function
  56. ANKI_SCRIPT_LOGE("%s", arg0);
  57. return 0;
  58. }
  59. /// Wrap function loge.
  60. static int wraploge(lua_State* l)
  61. {
  62. int res = pwraploge(l);
  63. if(res >= 0)
  64. {
  65. return res;
  66. }
  67. lua_error(l);
  68. return 0;
  69. }
  70. /// Pre-wrap function logw.
  71. static inline int pwraplogw(lua_State* l)
  72. {
  73. [[maybe_unused]] LuaUserData* ud;
  74. [[maybe_unused]] void* voidp;
  75. [[maybe_unused]] PtrSize size;
  76. if(LuaBinder::checkArgsCount(l, 1)) [[unlikely]]
  77. {
  78. return -1;
  79. }
  80. // Pop arguments
  81. const char* arg0;
  82. if(LuaBinder::checkString(l, 1, arg0)) [[unlikely]]
  83. {
  84. return -1;
  85. }
  86. // Call the function
  87. ANKI_SCRIPT_LOGW("%s", arg0);
  88. return 0;
  89. }
  90. /// Wrap function logw.
  91. static int wraplogw(lua_State* l)
  92. {
  93. int res = pwraplogw(l);
  94. if(res >= 0)
  95. {
  96. return res;
  97. }
  98. lua_error(l);
  99. return 0;
  100. }
  101. /// Pre-wrap function logv.
  102. static inline int pwraplogv(lua_State* l)
  103. {
  104. [[maybe_unused]] LuaUserData* ud;
  105. [[maybe_unused]] void* voidp;
  106. [[maybe_unused]] PtrSize size;
  107. if(LuaBinder::checkArgsCount(l, 1)) [[unlikely]]
  108. {
  109. return -1;
  110. }
  111. // Pop arguments
  112. const char* arg0;
  113. if(LuaBinder::checkString(l, 1, arg0)) [[unlikely]]
  114. {
  115. return -1;
  116. }
  117. // Call the function
  118. ANKI_SCRIPT_LOGV("%s", arg0);
  119. return 0;
  120. }
  121. /// Wrap function logv.
  122. static int wraplogv(lua_State* l)
  123. {
  124. int res = pwraplogv(l);
  125. if(res >= 0)
  126. {
  127. return res;
  128. }
  129. lua_error(l);
  130. return 0;
  131. }
  132. /// Wrap the module.
  133. void wrapModuleLogger(lua_State* l)
  134. {
  135. LuaBinder::pushLuaCFunc(l, "logi", wraplogi);
  136. LuaBinder::pushLuaCFunc(l, "loge", wraploge);
  137. LuaBinder::pushLuaCFunc(l, "logw", wraplogw);
  138. LuaBinder::pushLuaCFunc(l, "logv", wraplogv);
  139. }
  140. } // end namespace anki