Rename platform constants
This commit is contained in:
@@ -6,14 +6,14 @@
|
||||
#include "../platform/platform.h"
|
||||
#include <stdint.h>
|
||||
|
||||
#if defined(WAPP_PLATFORM_C) && WAPP_PLATFORM_C_VERSION >= WAPP_PLATFORM_C11_VERSION && !defined(WAPP_PLATFORM_APPLE)
|
||||
#if defined(WP_PLATFORM_C) && WP_PLATFORM_C_VERSION >= WP_PLATFORM_C11_VERSION && !defined(WP_PLATFORM_APPLE)
|
||||
#include <uchar.h>
|
||||
|
||||
#if WAPP_PLATFORM_C_VERSION >= WAPP_PLATFORM_C23_VERSION
|
||||
#if WP_PLATFORM_C_VERSION >= WP_PLATFORM_C23_VERSION
|
||||
typedef char8_t c8;
|
||||
#else
|
||||
typedef uint8_t c8;
|
||||
#endif // !WAPP_PLATFORM_C23_VERSION
|
||||
#endif // !WP_PLATFORM_C23_VERSION
|
||||
|
||||
typedef char16_t c16;
|
||||
typedef char32_t c32;
|
||||
@@ -21,7 +21,7 @@
|
||||
typedef uint8_t c8;
|
||||
typedef uint16_t c16;
|
||||
typedef uint32_t c32;
|
||||
#endif // !WAPP_PLATFORM_C
|
||||
#endif // !WP_PLATFORM_C
|
||||
|
||||
typedef uint8_t u8;
|
||||
typedef uint16_t u16;
|
||||
@@ -30,7 +30,7 @@ typedef uint64_t u64;
|
||||
|
||||
typedef uint8_t b8;
|
||||
|
||||
#ifndef WAPP_PLATFORM_CPP
|
||||
#ifndef WP_PLATFORM_CPP
|
||||
|
||||
#ifndef false
|
||||
#define false (b8)0
|
||||
@@ -40,7 +40,7 @@ typedef uint8_t b8;
|
||||
#define true (b8)1
|
||||
#endif // !true
|
||||
|
||||
#endif // !WAPP_PLATFORM_CPP
|
||||
#endif // !WP_PLATFORM_CPP
|
||||
|
||||
typedef int8_t i8;
|
||||
typedef int16_t i16;
|
||||
@@ -58,10 +58,10 @@ typedef intptr_t iptr;
|
||||
#define wapp_intern static
|
||||
#define wapp_persist static
|
||||
|
||||
#ifdef WAPP_PLATFORM_CPP
|
||||
#ifdef WP_PLATFORM_CPP
|
||||
#define wapp_class_mem static
|
||||
#define BEGIN_C_LINKAGE wapp_extern "C" {
|
||||
#define END_C_LINKAGE }
|
||||
#endif // WAPP_PLATFORM_CPP
|
||||
#endif // WP_PLATFORM_CPP
|
||||
|
||||
#endif // !ALIASES_H
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
#include <stdlib.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#ifdef WAPP_PLATFORM_CPP
|
||||
#ifdef WP_PLATFORM_CPP
|
||||
BEGIN_C_LINKAGE
|
||||
#endif // !WAPP_PLATFORM_CPP
|
||||
#endif // !WP_PLATFORM_CPP
|
||||
|
||||
#define wapp_static_assert(EXPR, MSG) wapp_extern char ASSERTION_FAILED[EXPR ? 1 : -1]
|
||||
|
||||
@@ -27,7 +27,7 @@ BEGIN_C_LINKAGE
|
||||
#define wapp_debug_assert(EXPR, MSG)
|
||||
#endif
|
||||
|
||||
#ifdef WAPP_PLATFORM_WINDOWS
|
||||
#ifdef WP_PLATFORM_WINDOWS
|
||||
#define __wapp_runtime_assert(EXPR, MSG) do { \
|
||||
__pragma(warning(push)) \
|
||||
__pragma(warning(disable:4127)) \
|
||||
@@ -42,7 +42,7 @@ BEGIN_C_LINKAGE
|
||||
__runtime_assert_failed(EXPR, MSG); \
|
||||
} \
|
||||
} while(false)
|
||||
#endif // !WAPP_PLATFORM_WINDOWS
|
||||
#endif // !WP_PLATFORM_WINDOWS
|
||||
|
||||
#define __runtime_assert_failed(EXPR, MSG) do { \
|
||||
fprintf( \
|
||||
@@ -54,8 +54,8 @@ BEGIN_C_LINKAGE
|
||||
abort(); \
|
||||
} while(false)
|
||||
|
||||
#ifdef WAPP_PLATFORM_CPP
|
||||
#ifdef WP_PLATFORM_CPP
|
||||
END_C_LINKAGE
|
||||
#endif // !WAPP_PLATFORM_CPP
|
||||
#endif // !WP_PLATFORM_CPP
|
||||
|
||||
#endif // !WAPP_ASSERT_H
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
|
||||
#include "../aliases/aliases.h"
|
||||
|
||||
#ifdef WAPP_PLATFORM_CPP
|
||||
#ifdef WP_PLATFORM_CPP
|
||||
BEGIN_C_LINKAGE
|
||||
#endif // !WAPP_PLATFORM_CPP
|
||||
#endif // !WP_PLATFORM_CPP
|
||||
|
||||
#define KiB(SIZE) (((u64)SIZE) << 10)
|
||||
#define MiB(SIZE) (((u64)SIZE) << 20)
|
||||
@@ -50,7 +50,7 @@ BEGIN_C_LINKAGE
|
||||
#define wapp_is_power_of_two(NUM) ((NUM & (NUM - 1)) == 0)
|
||||
#define wapp_pointer_offset(PTR, OFFSET) ((void *)((uptr)(PTR) + (OFFSET)))
|
||||
|
||||
#ifdef WAPP_PLATFORM_CPP
|
||||
#ifdef WP_PLATFORM_CPP
|
||||
END_C_LINKAGE
|
||||
|
||||
#include <tuple>
|
||||
@@ -58,6 +58,6 @@ END_C_LINKAGE
|
||||
#define wapp_misc_utils_va_args_count(T, ...) (std::tuple_size<decltype(std::make_tuple(__VA_ARGS__))>::value)
|
||||
#else
|
||||
#define wapp_misc_utils_va_args_count(T, ...) (sizeof((T[]){__VA_ARGS__})/sizeof(T))
|
||||
#endif // !WAPP_PLATFORM_CPP
|
||||
#endif // !WP_PLATFORM_CPP
|
||||
|
||||
#endif // !MISC_UTILS_H
|
||||
|
||||
@@ -4,110 +4,110 @@
|
||||
#define PLATFORM_H
|
||||
|
||||
#if defined(__ANDROID__)
|
||||
#define WAPP_PLATFORM_ANDROID
|
||||
#define WAPP_PLATFORM_POSIX
|
||||
#define WP_PLATFORM_ANDROID
|
||||
#define WP_PLATFORM_POSIX
|
||||
#elif defined(__FreeBSD__)
|
||||
#define WAPP_PLATFORM_FREE_BSD
|
||||
#define WAPP_PLATFORM_BSD
|
||||
#define WAPP_PLATFORM_POSIX
|
||||
#define WP_PLATFORM_FREE_BSD
|
||||
#define WP_PLATFORM_BSD
|
||||
#define WP_PLATFORM_POSIX
|
||||
#elif defined(__NetBSD__)
|
||||
#define WAPP_PLATFORM_NET_BSD
|
||||
#define WAPP_PLATFORM_BSD
|
||||
#define WAPP_PLATFORM_POSIX
|
||||
#define WP_PLATFORM_NET_BSD
|
||||
#define WP_PLATFORM_BSD
|
||||
#define WP_PLATFORM_POSIX
|
||||
#elif defined(__OpenBSD__)
|
||||
#define WAPP_PLATFORM_OPEN_BSD
|
||||
#define WAPP_PLATFORM_BSD
|
||||
#define WAPP_PLATFORM_POSIX
|
||||
#define WP_PLATFORM_OPEN_BSD
|
||||
#define WP_PLATFORM_BSD
|
||||
#define WP_PLATFORM_POSIX
|
||||
#elif defined(__DragonFly__)
|
||||
#define WAPP_PLATFORM_DRAGON_FLY
|
||||
#define WAPP_PLATFORM_BSD
|
||||
#define WAPP_PLATFORM_POSIX
|
||||
#define WP_PLATFORM_DRAGON_FLY
|
||||
#define WP_PLATFORM_BSD
|
||||
#define WP_PLATFORM_POSIX
|
||||
#elif defined(__bsdi__)
|
||||
#define WAPP_PLATFORM_BSD
|
||||
#define WAPP_PLATFORM_POSIX
|
||||
#define WP_PLATFORM_BSD
|
||||
#define WP_PLATFORM_POSIX
|
||||
#elif defined(__linux__) || defined(linux) || defined(__linux) || defined(__gnu_linux__)
|
||||
#define WAPP_PLATFORM_LINUX
|
||||
#define WAPP_PLATFORM_POSIX
|
||||
#define WP_PLATFORM_LINUX
|
||||
#define WP_PLATFORM_POSIX
|
||||
#elif defined(__GNU__) || defined(__gnu_hurd__)
|
||||
#define WAPP_PLATFORM_GNU
|
||||
#define WAPP_PLATFORM_POSIX
|
||||
#define WP_PLATFORM_GNU
|
||||
#define WP_PLATFORM_POSIX
|
||||
#elif defined(__APPLE__) || defined(__MACH__)
|
||||
#include <TargetConditionals.h>
|
||||
#if TARGET_OS_IPHONE
|
||||
#define WAPP_PLATFORM_IOS
|
||||
#define WAPP_PLATFORM_APPLE
|
||||
#define WAPP_PLATFORM_POSIX
|
||||
#define WP_PLATFORM_IOS
|
||||
#define WP_PLATFORM_APPLE
|
||||
#define WP_PLATFORM_POSIX
|
||||
#elif TARGET_OS_MAC
|
||||
#define WAPP_PLATFORM_MACOS
|
||||
#define WAPP_PLATFORM_APPLE
|
||||
#define WAPP_PLATFORM_POSIX
|
||||
#define WP_PLATFORM_MACOS
|
||||
#define WP_PLATFORM_APPLE
|
||||
#define WP_PLATFORM_POSIX
|
||||
#else
|
||||
#error "Unrecognised Apple platform"
|
||||
#endif
|
||||
#elif defined(_WIN64)
|
||||
#define WAPP_PLATFORM_WINDOWS64
|
||||
#define WAPP_PLATFORM_WINDOWS
|
||||
#define WP_PLATFORM_WINDOWS64
|
||||
#define WP_PLATFORM_WINDOWS
|
||||
#elif defined(_WIN32)
|
||||
#define WAPP_PLATFORM_WINDOWS32
|
||||
#define WAPP_PLATFORM_WINDOWS
|
||||
#define WP_PLATFORM_WINDOWS32
|
||||
#define WP_PLATFORM_WINDOWS
|
||||
#elif defined(__CYGWIN__)
|
||||
#define WAPP_PLATFORM_CYGWIN
|
||||
#define WAPP_PLATFORM_WINDOWS
|
||||
#define WP_PLATFORM_CYGWIN
|
||||
#define WP_PLATFORM_WINDOWS
|
||||
#elif defined(__unix__) || defined(__unix)
|
||||
#define WAPP_PLATFORM_UNIX
|
||||
#define WAPP_PLATFORM_POSIX
|
||||
#define WP_PLATFORM_UNIX
|
||||
#define WP_PLATFORM_POSIX
|
||||
#else
|
||||
#error "Unrecognised platform"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define WAPP_PLATFORM_CPP
|
||||
#define WAPP_PLATFORM_CPP_VERSION __cplusplus
|
||||
#define WAPP_PLATFORM_CPP98_VERSION 199711L
|
||||
#define WAPP_PLATFORM_CPP11_VERSION 201103L
|
||||
#define WAPP_PLATFORM_CPP14_VERSION 201402L
|
||||
#define WAPP_PLATFORM_CPP17_VERSION 201703L
|
||||
#define WAPP_PLATFORM_CPP20_VERSION 202002L
|
||||
#define WAPP_PLATFORM_CPP23_VERSION 202302L
|
||||
#define WP_PLATFORM_CPP
|
||||
#define WP_PLATFORM_CPP_VERSION __cplusplus
|
||||
#define WP_PLATFORM_CPP98_VERSION 199711L
|
||||
#define WP_PLATFORM_CPP11_VERSION 201103L
|
||||
#define WP_PLATFORM_CPP14_VERSION 201402L
|
||||
#define WP_PLATFORM_CPP17_VERSION 201703L
|
||||
#define WP_PLATFORM_CPP20_VERSION 202002L
|
||||
#define WP_PLATFORM_CPP23_VERSION 202302L
|
||||
|
||||
#if WAPP_PLATFORM_CPP_VERSION == WAPP_PLATFORM_CPP98_VERSION
|
||||
#define WAPP_PLATFORM_CPP98
|
||||
#elif WAPP_PLATFORM_CPP_VERSION == WAPP_PLATFORM_CPP11_VERSION
|
||||
#define WAPP_PLATFORM_CPP11
|
||||
#elif WAPP_PLATFORM_CPP_VERSION == WAPP_PLATFORM_CPP14_VERSION
|
||||
#define WAPP_PLATFORM_CPP14
|
||||
#elif WAPP_PLATFORM_CPP_VERSION == WAPP_PLATFORM_CPP17_VERSION
|
||||
#define WAPP_PLATFORM_CPP17
|
||||
#elif WAPP_PLATFORM_CPP_VERSION == WAPP_PLATFORM_CPP20_VERSION
|
||||
#define WAPP_PLATFORM_CPP20
|
||||
#elif WAPP_PLATFORM_CPP_VERSION == WAPP_PLATFORM_CPP23_VERSION
|
||||
#define WAPP_PLATFORM_CPP23
|
||||
#if WP_PLATFORM_CPP_VERSION == WP_PLATFORM_CPP98_VERSION
|
||||
#define WP_PLATFORM_CPP98
|
||||
#elif WP_PLATFORM_CPP_VERSION == WP_PLATFORM_CPP11_VERSION
|
||||
#define WP_PLATFORM_CPP11
|
||||
#elif WP_PLATFORM_CPP_VERSION == WP_PLATFORM_CPP14_VERSION
|
||||
#define WP_PLATFORM_CPP14
|
||||
#elif WP_PLATFORM_CPP_VERSION == WP_PLATFORM_CPP17_VERSION
|
||||
#define WP_PLATFORM_CPP17
|
||||
#elif WP_PLATFORM_CPP_VERSION == WP_PLATFORM_CPP20_VERSION
|
||||
#define WP_PLATFORM_CPP20
|
||||
#elif WP_PLATFORM_CPP_VERSION == WP_PLATFORM_CPP23_VERSION
|
||||
#define WP_PLATFORM_CPP23
|
||||
#else
|
||||
#error "Unrecognised C++ version"
|
||||
#endif
|
||||
#else
|
||||
#define WAPP_PLATFORM_C
|
||||
#define WP_PLATFORM_C
|
||||
|
||||
#if defined(__STDC_VERSION__)
|
||||
#define WAPP_PLATFORM_C_VERSION __STDC_VERSION__
|
||||
#define WAPP_PLATFORM_C99_VERSION 199901L
|
||||
#define WAPP_PLATFORM_C11_VERSION 201112L
|
||||
#define WAPP_PLATFORM_C17_VERSION 201710L
|
||||
#define WAPP_PLATFORM_C23_VERSION 202311L
|
||||
#define WP_PLATFORM_C_VERSION __STDC_VERSION__
|
||||
#define WP_PLATFORM_C99_VERSION 199901L
|
||||
#define WP_PLATFORM_C11_VERSION 201112L
|
||||
#define WP_PLATFORM_C17_VERSION 201710L
|
||||
#define WP_PLATFORM_C23_VERSION 202311L
|
||||
|
||||
#if WAPP_PLATFORM_C_VERSION == WAPP_PLATFORM_C99_VERSION
|
||||
#define WAPP_PLATFORM_C99
|
||||
#elif WAPP_PLATFORM_C_VERSION == WAPP_PLATFORM_C11_VERSION
|
||||
#define WAPP_PLATFORM_C11
|
||||
#elif WAPP_PLATFORM_C_VERSION == WAPP_PLATFORM_C17_VERSION
|
||||
#define WAPP_PLATFORM_C17
|
||||
#elif WAPP_PLATFORM_C_VERSION == WAPP_PLATFORM_C23_VERSION
|
||||
#define WAPP_PLATFORM_C23
|
||||
#if WP_PLATFORM_C_VERSION == WP_PLATFORM_C99_VERSION
|
||||
#define WP_PLATFORM_C99
|
||||
#elif WP_PLATFORM_C_VERSION == WP_PLATFORM_C11_VERSION
|
||||
#define WP_PLATFORM_C11
|
||||
#elif WP_PLATFORM_C_VERSION == WP_PLATFORM_C17_VERSION
|
||||
#define WP_PLATFORM_C17
|
||||
#elif WP_PLATFORM_C_VERSION == WP_PLATFORM_C23_VERSION
|
||||
#define WP_PLATFORM_C23
|
||||
#else
|
||||
#error "Unrecognised C version"
|
||||
#endif
|
||||
#else
|
||||
#define WAPP_PLATFORM_C89
|
||||
#define WP_PLATFORM_C89
|
||||
#endif
|
||||
#endif // !__cplusplus
|
||||
|
||||
|
||||
Reference in New Issue
Block a user