rws_common.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*
  2. * Copyright (c) 2014 - 2017 Kulykov Oleh <info@resident.name>
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a copy
  5. * of this software and associated documentation files (the "Software"), to deal
  6. * in the Software without restriction, including without limitation the rights
  7. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8. * copies of the Software, and to permit persons to whom the Software is
  9. * furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice shall be included in
  12. * all copies or substantial portions of the Software.
  13. *
  14. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20. * THE SOFTWARE.
  21. */
  22. #ifndef __RWS_COMMON_H__
  23. #define __RWS_COMMON_H__ 1
  24. #include <stdio.h>
  25. #include <rtthread.h>
  26. #if (RTTHREAD_VERSION <= 30100)
  27. #define DBG_SECTION_NAME "[LIBRWS] "
  28. #else
  29. #define DBG_SECTION_NAME "LIBRWS"
  30. #endif
  31. #define DBG_ENABLE
  32. #define DBG_LEVEL DBG_WARNING
  33. #define DBG_COLOR
  34. #include <rtdbg.h>
  35. #define DBG_FUNCTION_NUM 20
  36. /* check os */
  37. /* gcc -dM -E - < /dev/null */
  38. /* check windows */
  39. #if !defined(RWS_OS_WINDOWS)
  40. #if defined(WIN32) || defined(_WIN32) || defined(WIN32_LEAN_AND_MEAN) || defined(_WIN64) || defined(WIN64)
  41. #define RWS_OS_WINDOWS 1
  42. #endif
  43. #endif
  44. /* end check windows */
  45. /* check Apple */
  46. #if !defined(RWS_OS_APPLE)
  47. #if defined(__APPLE__) || defined(__MACH__)
  48. #define RWS_OS_APPLE 1
  49. #endif
  50. #endif
  51. /* check Unix */
  52. #if !defined(RWS_OS_UNIX)
  53. #if defined(__unix) || defined(unix) || defined(__unix__)
  54. #define RWS_OS_UNIX 1
  55. #endif
  56. #endif
  57. /* check Linux */
  58. #if !defined(RWS_OS_LINUX)
  59. #if defined(__linux__) || defined(__linux)
  60. #define RWS_OS_LINUX 1
  61. #endif
  62. #endif
  63. /* check Android */
  64. #if !defined(RWS_OS_ANDROID)
  65. #if defined(__ANDROID__) || defined(ANDROID)
  66. #define RWS_OS_ANDROID 1
  67. #endif
  68. #endif
  69. #endif