Aucune description

debug.h 2.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /****************************************************************************
  2. * Copyright (C) 2015-2016 by the SotS Team *
  3. * *
  4. * This file is part of Sovereign of the Skies. *
  5. * *
  6. * Sovereign of the Skies is free software: you can redistribute it *
  7. * and/or modify it *
  8. * under the terms of the GNU Lesser General Public License as published *
  9. * by the Free Software Foundation, either version 3 of the License, or *
  10. * (at your option) any later version provided you include a copy of the *
  11. * licence and this header. *
  12. * *
  13. * Sovereign of the Skies is distributed in the hope that it will be *
  14. * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of *
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
  16. * GNU Lesser General Public License for more details. *
  17. * *
  18. * You should have received a copy of the GNU Lesser General Public *
  19. * License along with Sovereign of the Skies. *
  20. * If not, see <http://www.gnu.org/licenses/>. *
  21. ****************************************************************************/
  22. /**
  23. * @file debug.h
  24. * @author Sturmvogel
  25. * @date 15 dec 2016
  26. * @brief Operate with the sots debug engine, very temporary
  27. */
  28. #ifndef DEBUG_H
  29. #define DEBUG_H
  30. /* === MACROS === */
  31. #define STRINGIFY(x) #x
  32. #define TOSTRING(x) STRINGIFY(x)
  33. #define assert(EX) if(!EX) {as_assert(STRINGIFY(EX), __FILE__, __LINE__);}
  34. struct print_engine{
  35. u8 line;
  36. u8 row;
  37. u8 color;
  38. };
  39. /**
  40. * @brief temporary method to initiate a debug process / unit test
  41. */
  42. void debug_some_test();
  43. /**
  44. * @brief set bg color
  45. * @param color color to set bg to
  46. */
  47. void debug_set_bg(u16 color);
  48. /**
  49. * @brief clean debug screen from any text and reset cursor
  50. */
  51. void debug_clean();
  52. /**
  53. * @brief print string onto debug environment at current position with parsing
  54. * @param str string to print
  55. */
  56. void debug_print(char* str);
  57. /**
  58. * @brief wait for button press
  59. * @param field bitfield to specify buttom combination
  60. */
  61. void debug_wait_for_btn(u16 field);
  62. /**
  63. * @brief print in format to debug environment
  64. * @param str string with format
  65. * @param arg argument to print (only one, not an array)
  66. */
  67. void debug_printf(char* str, int arg);
  68. /**
  69. * @brief handle for the assert scene
  70. */
  71. void debug_assert_scene();
  72. void as_assert(char* expression, char* file, int line);
  73. #endif /* DEBUG_H */