faux.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /** @file faux.h
  2. * @brief Additional usefull data types and base functions.
  3. */
  4. #ifndef _faux_types_h
  5. #define _faux_types_h
  6. #include <stdlib.h>
  7. /**
  8. * A standard boolean type. The possible values are
  9. * BOOL_FALSE and BOOL_TRUE.
  10. */
  11. typedef enum {
  12. BOOL_FALSE = 0,
  13. BOOL_TRUE = 1
  14. } bool_t;
  15. /** @def C_DECL_BEGIN
  16. * This macro can be used instead standard preprocessor
  17. * directive like this:
  18. * @code
  19. * #ifdef __cplusplus
  20. * extern "C" {
  21. * #endif
  22. *
  23. * int foobar(void);
  24. *
  25. * #ifdef __cplusplus
  26. * }
  27. * #endif
  28. * @endcode
  29. * It make linker to use C-style linking for functions.
  30. * Use C_DECL_BEGIN before functions declaration and C_DECL_END
  31. * after declaration:
  32. * @code
  33. * C_DECL_BEGIN
  34. *
  35. * int foobar(void);
  36. *
  37. * C_DECL_END
  38. * @endcode
  39. */
  40. /** @def C_DECL_END
  41. * See the macro C_DECL_BEGIN.
  42. * @sa C_DECL_BEGIN
  43. */
  44. #ifdef __cplusplus
  45. #define C_DECL_BEGIN extern "C" {
  46. #define C_DECL_END }
  47. #else
  48. #define C_DECL_BEGIN
  49. #define C_DECL_END
  50. #endif
  51. C_DECL_BEGIN
  52. void faux_free(void *ptr);
  53. void *faux_malloc(size_t size);
  54. void faux_bzero(void *ptr, size_t size);
  55. void *faux_zmalloc(size_t size);
  56. C_DECL_END
  57. #endif /* _faux_types_h */