2023-09-27 19:24:48 +03:00
|
|
|
#ifndef PRISM_DEFINES_H
|
|
|
|
#define PRISM_DEFINES_H
|
2023-06-20 18:53:02 +03:00
|
|
|
|
2023-10-31 18:38:06 +03:00
|
|
|
// This file should be included first by any *.h or *.c in prism.
|
2023-06-30 21:30:24 +03:00
|
|
|
|
|
|
|
#include <ctype.h>
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <stddef.h>
|
2023-08-29 17:48:20 +03:00
|
|
|
#include <stdint.h>
|
2023-06-30 21:30:24 +03:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
2023-09-27 19:24:48 +03:00
|
|
|
// PRISM_EXPORTED_FUNCTION
|
|
|
|
#ifndef PRISM_EXPORTED_FUNCTION
|
|
|
|
# ifdef PRISM_EXPORT_SYMBOLS
|
2023-07-31 22:26:34 +03:00
|
|
|
# ifdef _WIN32
|
2023-09-27 19:24:48 +03:00
|
|
|
# define PRISM_EXPORTED_FUNCTION __declspec(dllexport) extern
|
2023-06-20 18:53:02 +03:00
|
|
|
# else
|
2023-09-27 19:24:48 +03:00
|
|
|
# define PRISM_EXPORTED_FUNCTION __attribute__((__visibility__("default"))) extern
|
2023-06-20 18:53:02 +03:00
|
|
|
# endif
|
2023-07-31 22:26:34 +03:00
|
|
|
# else
|
2023-09-27 19:24:48 +03:00
|
|
|
# define PRISM_EXPORTED_FUNCTION
|
2023-06-20 18:53:02 +03:00
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
2023-10-27 05:04:54 +03:00
|
|
|
// PRISM_ATTRIBUTE_FORMAT
|
|
|
|
#if defined(__GNUC__)
|
|
|
|
# define PRISM_ATTRIBUTE_FORMAT(string_index, argument_index) __attribute__((format(printf, string_index, argument_index)))
|
|
|
|
#elif defined(__clang__)
|
|
|
|
# define PRISM_ATTRIBUTE_FORMAT(string_index, argument_index) __attribute__((__format__(__printf__, string_index, argument_index)))
|
|
|
|
#else
|
|
|
|
# define PRISM_ATTRIBUTE_FORMAT(string_index, argument_index)
|
|
|
|
#endif
|
|
|
|
|
2023-09-27 19:24:48 +03:00
|
|
|
// PRISM_ATTRIBUTE_UNUSED
|
2023-06-20 18:53:02 +03:00
|
|
|
#if defined(__GNUC__)
|
2023-09-27 19:24:48 +03:00
|
|
|
# define PRISM_ATTRIBUTE_UNUSED __attribute__((unused))
|
2023-06-20 18:53:02 +03:00
|
|
|
#else
|
2023-09-27 19:24:48 +03:00
|
|
|
# define PRISM_ATTRIBUTE_UNUSED
|
2023-06-20 18:53:02 +03:00
|
|
|
#endif
|
|
|
|
|
|
|
|
// inline
|
|
|
|
#if defined(_MSC_VER) && !defined(inline)
|
|
|
|
# define inline __inline
|
|
|
|
#endif
|
|
|
|
|
2023-08-17 01:42:56 +03:00
|
|
|
// Windows versions before 2015 use _snprintf
|
2023-09-05 19:23:35 +03:00
|
|
|
#if !defined(snprintf) && defined(_MSC_VER) && (_MSC_VER < 1900)
|
2023-08-17 01:42:56 +03:00
|
|
|
# define snprintf _snprintf
|
|
|
|
#endif
|
|
|
|
|
2023-06-20 18:53:02 +03:00
|
|
|
#endif
|