8#ifndef __STDC_LIMIT_MACROS
9#define __STDC_LIMIT_MACROS
26# error This project needs at least Visual Studio 2022 to build
27# elif defined(_MSVC_LANG) && _MSVC_LANG < 202002L
28# error This project must be compiled with /std:c++20 or later
30#elif __cplusplus < 202002L
31# error This project can only be compiled with a compiler that supports C++20
34#if INTPTR_MAX == INT32_MAX
35# define UL_ARCH_32_BIT
36#elif INTPTR_MAX == INT64_MAX
37# define UL_ARCH_64_BIT
39# error "Unknown CPU architecture: environment not 32 or 64-bit."
42#if defined(__aarch64__)
44# if defined(__APPLE__)
45# define UL_ARCH_ARM64_APPLE_SILICON
49#if defined(__WIN32__) || defined(_WIN32)
50# define _thread_local __declspec(thread)
51# ifndef _NATIVE_WCHAR_T_DEFINED
52# define DISABLE_NATIVE_WCHAR_T
55# define _thread_local __thread
58#ifndef UL_COMPILER_GCC_LIKE
59# if defined(__clang__) || defined(__GNUC__) || defined(__GNUG__)
60# define UL_COMPILER_GCC_LIKE
64#ifndef UL_ALWAYS_INLINE
65#if defined(UL_COMPILER_GCC_LIKE) && defined(NDEBUG)
66# define UL_ALWAYS_INLINE inline __attribute__((__always_inline__))
67# elif defined(_MSC_VER) && defined(NDEBUG)
68# define UL_ALWAYS_INLINE __forceinline
70# define UL_ALWAYS_INLINE inline
75# if defined(UL_COMPILER_GCC_LIKE)
76# define UL_UNLIKELY(x) __builtin_expect(!!(x), 0)
78# define UL_UNLIKELY(x) (x)
83# if defined(UL_COMPILER_GCC_LIKE)
84# define UL_LIKELY(x) __builtin_expect(!!(x), 1)
86# define UL_LIKELY(x) (x)
91 #if defined(UL_COMPILER_GCC_LIKE)
92 #define UL_ALIGN(x) __attribute__((aligned(x)))
93 #elif defined(__cplusplus) && __cplusplus >= 201103L
94 #define UL_ALIGN(x) alignas(x)
95 #elif defined(_MSC_VER)
96 #define UL_ALIGN(x) __declspec(align(x))
104#include <type_traits>
132concept BitmaskEnum = std::is_enum_v<T> &&
requires(T e) { ul_enable_bitmask_operators(e); };
134template <BitmaskEnum T>
135constexpr T operator|(T a, T b) {
136 using U = std::underlying_type_t<T>;
137 return static_cast<T
>(
static_cast<U
>(a) |
static_cast<U
>(b));
140template <BitmaskEnum T>
141constexpr T operator&(T a, T b) {
142 using U = std::underlying_type_t<T>;
143 return static_cast<T
>(
static_cast<U
>(a) &
static_cast<U
>(b));
146template <BitmaskEnum T>
147constexpr T operator^(T a, T b) {
148 using U = std::underlying_type_t<T>;
149 return static_cast<T
>(
static_cast<U
>(a) ^
static_cast<U
>(b));
152template <BitmaskEnum T>
153constexpr T operator~(T a) {
154 using U = std::underlying_type_t<T>;
155 return static_cast<T
>(~static_cast<U>(a));
158template <BitmaskEnum T>
159constexpr T& operator|=(T& a, T b) {
return a = a | b; }
161template <BitmaskEnum T>
162constexpr T& operator&=(T& a, T b) {
return a = a & b; }
164template <BitmaskEnum T>
165constexpr T& operator^=(T& a, T b) {
return a = a ^ b; }
180template <BitmaskEnum T>
181constexpr bool HasFlag(T flags, T bits) {
182 using U = std::underlying_type_t<T>;
183 return (
static_cast<U
>(flags) &
static_cast<U
>(bits)) ==
static_cast<U
>(bits)
184 &&
static_cast<U
>(bits) != 0;
193#define ULTRALIGHT_VERSION "2.0.0"
194#define ULTRALIGHT_VERSION_MAJOR 2
195#define ULTRALIGHT_VERSION_MINOR 0
196#define ULTRALIGHT_VERSION_PATCH 0
198#define WEBKIT_VERSION "615.1.18.100.1"
199#define WEBKIT_VERSION_MAJOR 615
200#define WEBKIT_VERSION_MINOR 1
201#define WEBKIT_VERSION_TINY 18
202#define WEBKIT_VERSION_MICRO 100
203#define WEBKIT_VERSION_NANO 1
210# define ULTRALIGHT_USER_AGENT_PLATFORM "Windows NT 10.0; Win64; x64"
211#elif defined(__APPLE__)
212# define ULTRALIGHT_USER_AGENT_PLATFORM "Macintosh; Intel Mac OS X 10_15_7"
213#elif defined(__linux__) && defined(__aarch64__)
214# define ULTRALIGHT_USER_AGENT_PLATFORM "X11; Linux aarch64"
215#elif defined(__linux__)
216# define ULTRALIGHT_USER_AGENT_PLATFORM "X11; Linux x86_64"
218# define ULTRALIGHT_USER_AGENT_PLATFORM "Windows NT 10.0; Win64; x64"
221#define ULTRALIGHT_USER_AGENT "Mozilla/5.0 (" ULTRALIGHT_USER_AGENT_PLATFORM ") " \
222 "AppleWebKit/" WEBKIT_VERSION " (KHTML, like Gecko) " \
223 "Ultralight/" ULTRALIGHT_VERSION " Version/16.4.1 " \
224 "Safari/" WEBKIT_VERSION
#define UExport
Definition Exports.h:22
uint32_t UltralightVersionMinor()
uint32_t UltralightVersionPatch()
uint32_t WebKitVersionMinor()
uint32_t WebKitVersionNano()
uint32_t WebKitVersionMicro()
uint32_t WebKitVersionMajor()
uint32_t UltralightVersionMajor()
const char * WebKitVersionString()
Full WebKit version string (corresponds to WEBKIT_VERSION).
uint32_t WebKitVersionTiny()
const char * UltralightVersionString()
Full library version string (corresponds to ULTRALIGHT_VERSION).
Root namespace for every public Ultralight type, function, and enumeration.