Loading...
Searching...
No Matches
Defines.h
Go to the documentation of this file.
1/**************************************************************************************************
2 * This file is a part of Ultralight. *
3 * *
4 * See <https://ultralig.ht> for licensing and more. *
5 * *
6 * (C) 2025 Ultralight, Inc. *
7 **************************************************************************************************/
8#pragma once
9
10// Needed for limit defines, like INTMAX_MAX, which is used by the std C++ library
11#ifndef __STDC_LIMIT_MACROS
12#define __STDC_LIMIT_MACROS
13#endif
14
15#include <cstdint>
16#include <cstddef>
17#include <limits.h>
18
19#ifdef SWIG
20#define UExport
21#else
22
23#include <Ultralight/Config.h>
24#include <Ultralight/Exports.h>
25
26// Require C++11 Support
27#if defined(_MSC_VER)
28# if _MSC_VER < 1800
29# error This project needs at least Visual Studio 2013 to build
30# endif
31#elif __cplusplus <= 199711L
32# error This project can only be compiled with a compiler that supports C++11
33#endif
34
35#if INTPTR_MAX == INT32_MAX
36# define UL_ARCH_32_BIT
37#elif INTPTR_MAX == INT64_MAX
38# define UL_ARCH_64_BIT
39#else
40# error "Unknown CPU architecture: environment not 32 or 64-bit."
41#endif
42
43#if defined(__aarch64__)
44# define UL_ARCH_ARM64
45# if defined(__APPLE__)
46# define UL_ARCH_ARM64_APPLE_SILICON
47# endif
48#endif
49
50#if defined(__WIN32__) || defined(_WIN32)
51# define _thread_local __declspec(thread)
52# ifndef _NATIVE_WCHAR_T_DEFINED
53# define DISABLE_NATIVE_WCHAR_T
54# endif
55#else
56# define _thread_local __thread
57#endif
58
59#ifndef UL_COMPILER_GCC_LIKE
60# if defined(__clang__) || defined(__GNUC__) || defined(__GNUG__)
61# define UL_COMPILER_GCC_LIKE
62# endif
63#endif
64
65#ifndef UL_ALWAYS_INLINE
66#if defined(UL_COMPILER_GCC_LIKE) && defined(NDEBUG)
67# define UL_ALWAYS_INLINE inline __attribute__((__always_inline__))
68# elif defined(_MSC_VER) && defined(NDEBUG)
69# define UL_ALWAYS_INLINE __forceinline
70# else
71# define UL_ALWAYS_INLINE inline
72# endif
73#endif
74
75#ifndef UL_UNLIKELY
76# if defined(UL_COMPILER_GCC_LIKE)
77# define UL_UNLIKELY(x) __builtin_expect(!!(x), 0)
78# else
79# define UL_UNLIKELY(x) (x)
80# endif
81#endif
82
83#ifndef UL_ALIGN
84 #if defined(UL_COMPILER_GCC_LIKE)
85 #define UL_ALIGN(x) __attribute__((aligned(x)))
86 #elif defined(__cplusplus) && __cplusplus >= 201103L
87 #define UL_ALIGN(x) alignas(x)
88 #elif defined(_MSC_VER)
89 #define UL_ALIGN(x) __declspec(align(x))
90 #else
91 #define UL_ALIGN(x)
92 #endif
93#endif
94
95#endif // #ifdef SWIG
96
97#define ULTRALIGHT_VERSION "1.4.0"
98#define ULTRALIGHT_VERSION_MAJOR 1
99#define ULTRALIGHT_VERSION_MINOR 4
100#define ULTRALIGHT_VERSION_PATCH 0
101
102#define WEBKIT_VERSION "615.1.18.100.1"
103#define WEBKIT_VERSION_MAJOR 615
104#define WEBKIT_VERSION_MINOR 1
105#define WEBKIT_VERSION_TINY 18
106#define WEBKIT_VERSION_MICRO 100
107#define WEBKIT_VERSION_NANO 1
108
109#define ULTRALIGHT_USER_AGENT "Mozilla/5.0 (Windows NT 10.0; Win64; x64) " \
110 "AppleWebKit/615.1.18.100.1 (KHTML, like Gecko) " \
111 "Ultralight/1.4.0 Version/16.4.1 Safari/615.1.18.100.1"
112
113#ifdef __cplusplus
114extern "C" {
115#endif
116
117///
118/// Full library version string (corresponds to ULTRALIGHT_VERSION)
119///
121
125
126///
127/// Full WebKit version string (corresponds to WEBKIT_VERSION)
128///
130
136
137#ifdef __cplusplus
138}
139#endif
#define UExport
Definition Exports.h:25
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)