commit 11bb72a464215693d5a3a6896b25e568cc6e3313 Author: utkumaden@hotmail.com Date: Tue Mar 19 21:38:32 2024 +0300 Initial commit. diff --git a/README.md b/README.md new file mode 100644 index 0000000..d397496 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +Quik.Common +============ +Common files for QUIK source code repositories. \ No newline at end of file diff --git a/assets/quik.svg b/assets/quik.svg new file mode 100644 index 0000000..03d6024 --- /dev/null +++ b/assets/quik.svg @@ -0,0 +1,79 @@ + + + + + + + + + Q + UIK + + + + diff --git a/assets/quik_ico.svg b/assets/quik_ico.svg new file mode 100644 index 0000000..a8dbded --- /dev/null +++ b/assets/quik_ico.svg @@ -0,0 +1,99 @@ + + + + + + + + + + + + + + + + Q + + diff --git a/assets/quik_ico_128.png b/assets/quik_ico_128.png new file mode 100644 index 0000000..5437843 Binary files /dev/null and b/assets/quik_ico_128.png differ diff --git a/assets/quik_ico_16.png b/assets/quik_ico_16.png new file mode 100644 index 0000000..d163a31 Binary files /dev/null and b/assets/quik_ico_16.png differ diff --git a/assets/quik_ico_256.png b/assets/quik_ico_256.png new file mode 100644 index 0000000..5f1ee3f Binary files /dev/null and b/assets/quik_ico_256.png differ diff --git a/assets/quik_ico_32.png b/assets/quik_ico_32.png new file mode 100644 index 0000000..3d650ce Binary files /dev/null and b/assets/quik_ico_32.png differ diff --git a/assets/quik_ico_64.png b/assets/quik_ico_64.png new file mode 100644 index 0000000..7e91020 Binary files /dev/null and b/assets/quik_ico_64.png differ diff --git a/include/quik_common.h b/include/quik_common.h new file mode 100644 index 0000000..1ea86dd --- /dev/null +++ b/include/quik_common.h @@ -0,0 +1,47 @@ +#ifndef _QUIK_COMMON_H_ +#define _QUIK_COMMON_H_ + +#include "stdlib.h" + +#if __GNUC__ || __MSC_VER + #define __QUIK_FUNCTION__ __FUNCTION__ + #define QEXTERN extern +#else + #define __QUIK_FUNCTION__ NULL +#endif + +/** + * @brief Callback for failed assert function for QUIK redist libraries. + * @param[in] expr The expression that failed. + * @param[in] file The failing file (if available) + * @param[in] line The failing line number (if available) + * @param[in] func The failing function (if available) +*/ +typedef void (*quik_failed_assert_cb_t)(const char *expr, const char *file, int line, const char* func); + +#define DECLARE_ASSERT_CB(NAME) \ + QEXTERN quik_failed_assert_cb_t NAME##_failed_assert +#define DECLARE_ASSERT_STORE(NAME) \ + QEXTERN void NAME##_failed_assert_store(quik_failed_assert_cb_t cb) + +#define DEFINE_ASSERT_CB(NAME) \ + quik_failed_assert_cb_t NAME##_failed_assert +#define DEFINE_ASSERT_STORE(NAME) \ + void NAME##_failed_assert_store(quik_failed_assert_cb_t cb) { \ + NAME##_failed_assert = cb != NULL ? cb : quik_default_assert; \ + } + +#define QUIK_DECLARE_LIB(NAME) \ + DECLARE_ASSERT_CB(NAME); \ + DECLARE_ASSERT_STORE(NAME); + +#define QUIK_DEFINE_LIB(NAME) \ + DEFINE_ASSERT_CB(NAME); \ + DEFINE_ASSERT_STORE(NAME); + +inline static void quik_default_assert(const char *expr, const char *file, int line, const char *function) +{ + abort(); +} + +#endif