- Switched back to custom window management, taking another stab
- Refactored lang yet again, `fennec/lang` is now C++ language. `fennec/string` `fennec/filesystem` and `fennec/format` are now independent.
This commit is contained in:
109
CMakeLists.txt
109
CMakeLists.txt
@@ -110,6 +110,7 @@ add_library(fennec STATIC
|
|||||||
|
|
||||||
include/fennec/containers/array.h
|
include/fennec/containers/array.h
|
||||||
include/fennec/containers/bintree.h
|
include/fennec/containers/bintree.h
|
||||||
|
include/fennec/containers/bitfield.h
|
||||||
include/fennec/containers/deque.h
|
include/fennec/containers/deque.h
|
||||||
include/fennec/containers/dynarray.h
|
include/fennec/containers/dynarray.h
|
||||||
include/fennec/containers/graph.h
|
include/fennec/containers/graph.h
|
||||||
@@ -131,38 +132,41 @@ add_library(fennec STATIC
|
|||||||
include/fennec/containers/detail/_tuple.h
|
include/fennec/containers/detail/_tuple.h
|
||||||
|
|
||||||
|
|
||||||
# langcpp =================================================================================================================
|
# lang =================================================================================================================
|
||||||
include/fennec/langcpp/lang.h
|
include/fennec/lang/lang.h
|
||||||
include/fennec/langcpp/metaprogramming.h
|
include/fennec/lang/metaprogramming.h
|
||||||
|
|
||||||
include/fennec/langcpp/bits.h
|
|
||||||
include/fennec/langcpp/constants.h
|
|
||||||
include/fennec/langcpp/conditional_types.h
|
|
||||||
include/fennec/langcpp/hashing.h
|
|
||||||
include/fennec/langcpp/intrinsics.h
|
|
||||||
include/fennec/langcpp/limits.h
|
|
||||||
include/fennec/langcpp/numeric_transforms.h
|
|
||||||
include/fennec/langcpp/metasequences.h
|
|
||||||
include/fennec/langcpp/static_constructor.h
|
|
||||||
include/fennec/langcpp/type_identity.h
|
|
||||||
include/fennec/langcpp/type_operators.h
|
|
||||||
include/fennec/langcpp/type_sequences.h
|
|
||||||
include/fennec/langcpp/type_traits.h
|
|
||||||
include/fennec/langcpp/type_transforms.h
|
|
||||||
include/fennec/langcpp/types.h
|
|
||||||
include/fennec/langcpp/utility.h
|
|
||||||
include/fennec/langcpp/integer.h
|
|
||||||
|
|
||||||
include/fennec/langcpp/assert.h source/langcpp/assert.cpp
|
|
||||||
|
|
||||||
|
|
||||||
include/fennec/langcpp/detail/_bits.h
|
include/fennec/lang/bits.h
|
||||||
include/fennec/langcpp/detail/_int.h
|
include/fennec/lang/constants.h
|
||||||
include/fennec/langcpp/detail/_numeric_transforms.h
|
include/fennec/lang/conditional_types.h
|
||||||
include/fennec/langcpp/detail/_stdlib.h
|
include/fennec/lang/declval.h
|
||||||
include/fennec/langcpp/detail/_type_traits.h
|
include/fennec/lang/hashing.h
|
||||||
include/fennec/langcpp/detail/_type_transforms.h
|
include/fennec/lang/intrinsics.h
|
||||||
include/fennec/langcpp/detail/_type_sequences.h
|
include/fennec/lang/limits.h
|
||||||
|
include/fennec/lang/numeric_transforms.h
|
||||||
|
include/fennec/lang/metasequences.h
|
||||||
|
include/fennec/lang/ranges.h
|
||||||
|
include/fennec/lang/static_constructor.h
|
||||||
|
include/fennec/lang/type_identity.h
|
||||||
|
include/fennec/lang/type_operators.h
|
||||||
|
include/fennec/lang/type_sequences.h
|
||||||
|
include/fennec/lang/type_traits.h
|
||||||
|
include/fennec/lang/type_transforms.h
|
||||||
|
include/fennec/lang/types.h
|
||||||
|
include/fennec/lang/utility.h
|
||||||
|
include/fennec/lang/integer.h
|
||||||
|
|
||||||
|
include/fennec/lang/assert.h source/lang/assert.cpp
|
||||||
|
|
||||||
|
include/fennec/lang/detail/_bits.h
|
||||||
|
include/fennec/lang/detail/_declval.h
|
||||||
|
include/fennec/lang/detail/_int.h
|
||||||
|
include/fennec/lang/detail/_numeric_transforms.h
|
||||||
|
include/fennec/lang/detail/_stdlib.h
|
||||||
|
include/fennec/lang/detail/_type_traits.h
|
||||||
|
include/fennec/lang/detail/_type_transforms.h
|
||||||
|
include/fennec/lang/detail/_type_sequences.h
|
||||||
|
|
||||||
|
|
||||||
# RTTI =================================================================================================================
|
# RTTI =================================================================================================================
|
||||||
@@ -174,9 +178,10 @@ add_library(fennec STATIC
|
|||||||
include/fennec/rtti/typelist.h
|
include/fennec/rtti/typelist.h
|
||||||
|
|
||||||
|
|
||||||
|
include/fennec/rtti/detail/_constants.h
|
||||||
|
include/fennec/rtti/detail/_this_t.h
|
||||||
include/fennec/rtti/detail/_typeid.h
|
include/fennec/rtti/detail/_typeid.h
|
||||||
include/fennec/rtti/detail/_type_name.h
|
include/fennec/rtti/detail/_type_name.h
|
||||||
include/fennec/rtti/detail/_constants.h
|
|
||||||
|
|
||||||
|
|
||||||
# MEMORY ===============================================================================================================
|
# MEMORY ===============================================================================================================
|
||||||
@@ -230,28 +235,39 @@ add_library(fennec STATIC
|
|||||||
include/fennec/math/detail/_vector_traits.h
|
include/fennec/math/detail/_vector_traits.h
|
||||||
|
|
||||||
|
|
||||||
# lang ================================================================================================================
|
|
||||||
|
|
||||||
# Strings
|
# string ===============================================================================================================
|
||||||
include/fennec/lang/strings/locale.h
|
include/fennec/string/locale.h
|
||||||
include/fennec/lang/strings/cstring.h
|
include/fennec/string/cstring.h
|
||||||
include/fennec/lang/strings/string.h
|
include/fennec/string/string.h
|
||||||
include/fennec/lang/strings/format.h
|
|
||||||
|
|
||||||
include/fennec/lang/strings/detail/_ctype.h
|
include/fennec/string/detail/_ctype.h
|
||||||
|
|
||||||
# Filesystem
|
|
||||||
include/fennec/lang/filesystem/file.h source/lang/filesystem/file.cpp
|
|
||||||
include/fennec/lang/filesystem/path.h source/lang/filesystem/path.cpp
|
|
||||||
|
|
||||||
# Compile
|
|
||||||
include/fennec/lang/compile/tokenizer.h
|
# format ===============================================================================================================
|
||||||
|
include/fennec/format/format.h
|
||||||
|
include/fennec/format/detail/_format.h
|
||||||
|
include/fennec/format/format_arg.h
|
||||||
|
include/fennec/format/formatter.h
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# filesystem ===========================================================================================================
|
||||||
|
include/fennec/filesystem/file.h source/filesystem/file.cpp
|
||||||
|
include/fennec/filesystem/path.h source/filesystem/path.cpp
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# interpret ============================================================================================================
|
||||||
|
include/fennec/interpret/tokenizer.h
|
||||||
|
|
||||||
|
|
||||||
# PLATFORM =============================================================================================================
|
# PLATFORM =============================================================================================================
|
||||||
|
|
||||||
include/fennec/platform/interface/fwd.h
|
include/fennec/platform/interface/fwd.h
|
||||||
include/fennec/platform/interface/platform.h source/platform/interface/platform.cpp
|
include/fennec/platform/interface/platform.h source/platform/interface/platform.cpp
|
||||||
|
include/fennec/platform/interface/display_server.h
|
||||||
include/fennec/platform/interface/window.h
|
include/fennec/platform/interface/window.h
|
||||||
|
|
||||||
# GRAPHICS =============================================================================================================
|
# GRAPHICS =============================================================================================================
|
||||||
@@ -261,13 +277,6 @@ add_library(fennec STATIC
|
|||||||
# EXTRA SOURCES ========================================================================================================
|
# EXTRA SOURCES ========================================================================================================
|
||||||
|
|
||||||
${FENNEC_EXTRA_SOURCES}
|
${FENNEC_EXTRA_SOURCES}
|
||||||
include/fennec/langcpp/ranges.h
|
|
||||||
include/fennec/langcpp/declval.h
|
|
||||||
include/fennec/langcpp/detail/_declval.h
|
|
||||||
include/fennec/containers/bitfield.h
|
|
||||||
include/fennec/platform/interface/display_server.h
|
|
||||||
include/fennec/rtti/detail/_this_t.h
|
|
||||||
include/fennec/platform/linux/wayland/display_server.h
|
|
||||||
)
|
)
|
||||||
|
|
||||||
add_dependencies(fennec metaprogramming fennec-dependencies)
|
add_dependencies(fennec metaprogramming fennec-dependencies)
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ fennec Standards:
|
|||||||
|
|
||||||
- Header Guards should be implemented using `#ifndef`, `#define`, and `#endif` for portability.
|
- Header Guards should be implemented using `#ifndef`, `#define`, and `#endif` for portability.
|
||||||
The naming convention for Header Guards is as follows: `<APP_NAME>_<DIRECTORY_PATH>_<FILE_NAME>_H`.
|
The naming convention for Header Guards is as follows: `<APP_NAME>_<DIRECTORY_PATH>_<FILE_NAME>_H`.
|
||||||
I.E. the engine file `fennec/langcpp/utility.h` has the Header Guard `FENNEC_LANG_UTILITY_H`.
|
I.E. the engine file `fennec/lang/utility.h` has the Header Guard `FENNEC_LANG_UTILITY_H`.
|
||||||
|
|
||||||
* Helper Functions, in the case of classes, should be private.
|
* Helper Functions, in the case of classes, should be private.
|
||||||
In the case of global functions, helpers should be placed in a similarly named file in a subdirectory and namespace
|
In the case of global functions, helpers should be placed in a similarly named file in a subdirectory and namespace
|
||||||
|
|||||||
@@ -109,6 +109,7 @@ macro(fennec_check_wayland)
|
|||||||
include/fennec/platform/linux/wayland/lib/loader.h source/platform/linux/wayland/lib/loader.cpp
|
include/fennec/platform/linux/wayland/lib/loader.h source/platform/linux/wayland/lib/loader.cpp
|
||||||
|
|
||||||
# Fennec Files
|
# Fennec Files
|
||||||
|
include/fennec/platform/linux/wayland/display_server.h
|
||||||
)
|
)
|
||||||
|
|
||||||
fennec_add_definitions(
|
fennec_add_definitions(
|
||||||
|
|||||||
@@ -1049,7 +1049,8 @@ RECURSIVE = YES
|
|||||||
# Note that relative paths are relative to the directory from which doxygen is
|
# Note that relative paths are relative to the directory from which doxygen is
|
||||||
# run.
|
# run.
|
||||||
|
|
||||||
EXCLUDE =
|
EXCLUDE = "@PROJECT_SOURCE_DIR@/include/fennec/platform/linux/wayland/lib" \
|
||||||
|
"@PROJECT_SOURCE_DIR@/include/fennec/platform/linux/xkb/lib"
|
||||||
|
|
||||||
# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
|
# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
|
||||||
# directories that are symbolic links (a Unix file system feature) are excluded
|
# directories that are symbolic links (a Unix file system feature) are excluded
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<!-- HTML header for doxygen 1.9.8-->
|
<!-- HTML header for doxygen 1.9.8-->
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml" langcpp="$langISO">
|
<html xmlns="http://www.w3.org/1999/xhtml" lang="$langISO">
|
||||||
<head>
|
<head>
|
||||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
|
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
|
||||||
|
|||||||
@@ -32,8 +32,8 @@
|
|||||||
#ifndef FENNEC_CONTAINERS_ARRAY_H
|
#ifndef FENNEC_CONTAINERS_ARRAY_H
|
||||||
#define FENNEC_CONTAINERS_ARRAY_H
|
#define FENNEC_CONTAINERS_ARRAY_H
|
||||||
|
|
||||||
#include <fennec/langcpp/types.h>
|
#include <fennec/lang/types.h>
|
||||||
#include <fennec/langcpp/assert.h>
|
#include <fennec/lang/assert.h>
|
||||||
|
|
||||||
namespace fennec
|
namespace fennec
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
#define FENNEC_CONTAINERS_BITFIELD_H
|
#define FENNEC_CONTAINERS_BITFIELD_H
|
||||||
|
|
||||||
#include <fennec/containers/array.h>
|
#include <fennec/containers/array.h>
|
||||||
#include <fennec/langcpp/types.h>
|
#include <fennec/lang/types.h>
|
||||||
|
|
||||||
namespace fennec
|
namespace fennec
|
||||||
{
|
{
|
||||||
@@ -49,21 +49,24 @@ public:
|
|||||||
: _bytes() {
|
: _bytes() {
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr bitfield(const bool (&arr)[N]) {
|
constexpr bitfield(const bool (&arr)[N])
|
||||||
|
: _bytes() {
|
||||||
for (size_t i = 0; i < arr; ++i) {
|
for (size_t i = 0; i < arr; ++i) {
|
||||||
this->store(i, arr[i]);
|
this->store(i, arr[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template<size_t I>
|
template<size_t I>
|
||||||
constexpr bitfield(const size_t (&arr)[I]) {
|
constexpr bitfield(const size_t (&arr)[I])
|
||||||
|
: _bytes() {
|
||||||
for (size_t i : arr) {
|
for (size_t i : arr) {
|
||||||
this->set(i);
|
this->set(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename...ArgsT>
|
template<typename...ArgsT>
|
||||||
constexpr bitfield(ArgsT&&...args) {
|
constexpr bitfield(ArgsT&&...args)
|
||||||
|
: _bytes() {
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
(this->store(i++, fennec::forward<ArgsT>(args)), ...);
|
(this->store(i++, fennec::forward<ArgsT>(args)), ...);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,8 +18,8 @@
|
|||||||
|
|
||||||
#ifndef FENNEC_CONTAINERS_DETAIL_TUPLE_H
|
#ifndef FENNEC_CONTAINERS_DETAIL_TUPLE_H
|
||||||
#define FENNEC_CONTAINERS_DETAIL_TUPLE_H
|
#define FENNEC_CONTAINERS_DETAIL_TUPLE_H
|
||||||
#include <fennec/langcpp/metasequences.h>
|
#include <fennec/lang/metasequences.h>
|
||||||
#include <fennec/langcpp/utility.h>
|
#include <fennec/lang/utility.h>
|
||||||
|
|
||||||
namespace fennec::detail
|
namespace fennec::detail
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
#define FENNEC_CONTAINERS_DYNARRAY_H
|
#define FENNEC_CONTAINERS_DYNARRAY_H
|
||||||
|
|
||||||
#include <fennec/containers/initializer_list.h>
|
#include <fennec/containers/initializer_list.h>
|
||||||
#include <fennec/langcpp/utility.h>
|
#include <fennec/lang/utility.h>
|
||||||
#include <fennec/memory/allocator.h>
|
#include <fennec/memory/allocator.h>
|
||||||
#include <fennec/memory/new.h>
|
#include <fennec/memory/new.h>
|
||||||
|
|
||||||
|
|||||||
@@ -31,10 +31,10 @@
|
|||||||
#ifndef FENNEC_CONTAINERS_OPTIONAL_H
|
#ifndef FENNEC_CONTAINERS_OPTIONAL_H
|
||||||
#define FENNEC_CONTAINERS_OPTIONAL_H
|
#define FENNEC_CONTAINERS_OPTIONAL_H
|
||||||
|
|
||||||
#include <fennec/langcpp/utility.h>
|
#include <fennec/lang/utility.h>
|
||||||
#include <fennec/memory/new.h>
|
#include <fennec/memory/new.h>
|
||||||
|
|
||||||
#include <fennec/langcpp/assert.h>
|
#include <fennec/lang/assert.h>
|
||||||
|
|
||||||
namespace fennec
|
namespace fennec
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -32,8 +32,8 @@
|
|||||||
#define FENNEC_CONTAINERS_PAIR_H
|
#define FENNEC_CONTAINERS_PAIR_H
|
||||||
|
|
||||||
#include <fennec/containers/tuple.h>
|
#include <fennec/containers/tuple.h>
|
||||||
#include <fennec/langcpp/hashing.h>
|
#include <fennec/lang/hashing.h>
|
||||||
#include <fennec/langcpp/utility.h>
|
#include <fennec/lang/utility.h>
|
||||||
|
|
||||||
namespace fennec
|
namespace fennec
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -32,8 +32,8 @@
|
|||||||
#define FENNEC_CONTAINERS_PRIORITY_QUEUE_H
|
#define FENNEC_CONTAINERS_PRIORITY_QUEUE_H
|
||||||
|
|
||||||
#include <fennec/containers/object_pool.h>
|
#include <fennec/containers/object_pool.h>
|
||||||
#include <fennec/langcpp/compare.h>
|
#include <fennec/lang/compare.h>
|
||||||
#include <fennec/langcpp/types.h>
|
#include <fennec/lang/types.h>
|
||||||
#include <fennec/memory/allocator.h>
|
#include <fennec/memory/allocator.h>
|
||||||
|
|
||||||
// Binary heaps are just kinda busted.
|
// Binary heaps are just kinda busted.
|
||||||
|
|||||||
@@ -39,7 +39,7 @@
|
|||||||
#include <fennec/containers/sequence.h>
|
#include <fennec/containers/sequence.h>
|
||||||
#include <fennec/containers/sequence.h>
|
#include <fennec/containers/sequence.h>
|
||||||
#include <fennec/containers/sequence.h>
|
#include <fennec/containers/sequence.h>
|
||||||
#include <fennec/langcpp/compare.h>
|
#include <fennec/lang/compare.h>
|
||||||
#include <fennec/memory/allocator.h>
|
#include <fennec/memory/allocator.h>
|
||||||
|
|
||||||
// https://en.wikipedia.org/wiki/Red%E2%80%93black_tree
|
// https://en.wikipedia.org/wiki/Red%E2%80%93black_tree
|
||||||
|
|||||||
@@ -35,10 +35,10 @@
|
|||||||
|
|
||||||
#include <fennec/containers/optional.h>
|
#include <fennec/containers/optional.h>
|
||||||
#include <fennec/containers/set.h>
|
#include <fennec/containers/set.h>
|
||||||
#include <fennec/langcpp/compare.h>
|
#include <fennec/lang/compare.h>
|
||||||
#include <fennec/math/ext/primes.h>
|
#include <fennec/math/ext/primes.h>
|
||||||
#include <fennec/memory/allocator.h>
|
#include <fennec/memory/allocator.h>
|
||||||
#include <fennec/langcpp/hashing.h>
|
#include <fennec/lang/hashing.h>
|
||||||
|
|
||||||
namespace fennec
|
namespace fennec
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
#define FENNEC_CONTAINERS_TUPLE_H
|
#define FENNEC_CONTAINERS_TUPLE_H
|
||||||
|
|
||||||
#include <fennec/containers/detail/_tuple.h>
|
#include <fennec/containers/detail/_tuple.h>
|
||||||
#include <fennec/langcpp/type_sequences.h>
|
#include <fennec/lang/type_sequences.h>
|
||||||
|
|
||||||
namespace fennec
|
namespace fennec
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
#ifndef FENNEC_CORE_EVENT_H
|
#ifndef FENNEC_CORE_EVENT_H
|
||||||
#define FENNEC_CORE_EVENT_H
|
#define FENNEC_CORE_EVENT_H
|
||||||
|
|
||||||
#include <fennec/langcpp/types.h>
|
#include <fennec/lang/types.h>
|
||||||
#include <fennec/rtti/enable.h>
|
#include <fennec/rtti/enable.h>
|
||||||
|
|
||||||
#include <fennec/rtti/typeid.h>
|
#include <fennec/rtti/typeid.h>
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
#ifndef FENNEC_CORE_SYSTEM_H
|
#ifndef FENNEC_CORE_SYSTEM_H
|
||||||
#define FENNEC_CORE_SYSTEM_H
|
#define FENNEC_CORE_SYSTEM_H
|
||||||
#include <fennec/lang/strings/string.h>
|
#include <fennec/string/string.h>
|
||||||
|
|
||||||
namespace fennec
|
namespace fennec
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -19,11 +19,11 @@
|
|||||||
#ifndef FENNEC_LANGPROC_IO_FILE_H
|
#ifndef FENNEC_LANGPROC_IO_FILE_H
|
||||||
#define FENNEC_LANGPROC_IO_FILE_H
|
#define FENNEC_LANGPROC_IO_FILE_H
|
||||||
|
|
||||||
#include <fennec/lang/filesystem/path.h>
|
#include <fennec/filesystem/path.h>
|
||||||
|
|
||||||
#include <fennec/lang/strings/cstring.h>
|
#include <fennec/string/cstring.h>
|
||||||
#include <fennec/lang/strings/string.h>
|
#include <fennec/string/string.h>
|
||||||
#include <fennec/lang/strings/wstring.h>
|
#include <fennec/string/wstring.h>
|
||||||
|
|
||||||
namespace fennec
|
namespace fennec
|
||||||
{
|
{
|
||||||
@@ -19,8 +19,8 @@
|
|||||||
#ifndef FENNEC_LANGPROC_IO_PATH_H
|
#ifndef FENNEC_LANGPROC_IO_PATH_H
|
||||||
#define FENNEC_LANGPROC_IO_PATH_H
|
#define FENNEC_LANGPROC_IO_PATH_H
|
||||||
|
|
||||||
#include <fennec/lang/filesystem/path.h>
|
#include <fennec/filesystem/path.h>
|
||||||
#include <fennec/lang/strings/string.h>
|
#include <fennec/string/string.h>
|
||||||
|
|
||||||
namespace fennec
|
namespace fennec
|
||||||
{
|
{
|
||||||
90
include/fennec/format/detail/_format.h
Normal file
90
include/fennec/format/detail/_format.h
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
// =====================================================================================================================
|
||||||
|
// fennec, a free and open source game engine
|
||||||
|
// Copyright © 2025 Medusa Slockbower
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
// =====================================================================================================================
|
||||||
|
|
||||||
|
///
|
||||||
|
/// \file _format.h
|
||||||
|
/// \brief
|
||||||
|
///
|
||||||
|
///
|
||||||
|
/// \details
|
||||||
|
/// \author Medusa Slockbower
|
||||||
|
///
|
||||||
|
/// \copyright Copyright © 2025 Medusa Slockbower ([GPLv3](https://www.gnu.org/licenses/gpl-3.0.en.html))
|
||||||
|
///
|
||||||
|
///
|
||||||
|
|
||||||
|
#ifndef FENNEC_LANG_STRINGS_DETAIL_FORMAT_H
|
||||||
|
#define FENNEC_LANG_STRINGS_DETAIL_FORMAT_H
|
||||||
|
|
||||||
|
#include <fennec/memory/pointers.h>
|
||||||
|
#include <fennec/format/formatter.h>
|
||||||
|
#include <fennec/format/format_arg.h>
|
||||||
|
|
||||||
|
namespace fennec::detail
|
||||||
|
{
|
||||||
|
|
||||||
|
// Impl interface for templated polymorphism fuckery
|
||||||
|
struct _format_argimpl {
|
||||||
|
_format_argimpl() {};
|
||||||
|
virtual ~_format_argimpl() {};
|
||||||
|
virtual string format(const format_arg& fmt) = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Polymorphic template specialization
|
||||||
|
template<typename T>
|
||||||
|
struct _format_arg : _format_argimpl {
|
||||||
|
formatter<T> fmtr;
|
||||||
|
const T& val;
|
||||||
|
_format_arg(const T& arg) : val(arg) {
|
||||||
|
}
|
||||||
|
virtual ~_format_arg() = default;
|
||||||
|
virtual string format(const format_arg& fmt) {
|
||||||
|
return fennec::forward<string>(fmtr(fmt, val));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Polymorphic template specialization for rvalue_references
|
||||||
|
template<typename T>
|
||||||
|
struct _format_arg<T&> : _format_argimpl {
|
||||||
|
formatter<T> fmtr;
|
||||||
|
const T& val;
|
||||||
|
_format_arg(const T& arg) : val(arg) {
|
||||||
|
}
|
||||||
|
virtual ~_format_arg() = default;
|
||||||
|
virtual string format(const format_arg& fmt) {
|
||||||
|
return fennec::forward<string>(fmtr(fmt, val));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Containing array for format args
|
||||||
|
template<size_t N>
|
||||||
|
struct _format_argarray {
|
||||||
|
array<unique_ptr<_format_argimpl>, N> args;
|
||||||
|
template<typename...ArgsT>
|
||||||
|
_format_argarray(ArgsT&&...args)
|
||||||
|
: args { unique_ptr<_format_argimpl>(new _format_arg<ArgsT>(fennec::forward<ArgsT>(args)))... } {
|
||||||
|
}
|
||||||
|
|
||||||
|
string format(size_t i, const format_arg& fmt) {
|
||||||
|
return args[i]->format(fmt);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // FENNEC_LANG_STRINGS_DETAIL_FORMAT_H
|
||||||
141
include/fennec/format/format.h
Normal file
141
include/fennec/format/format.h
Normal file
@@ -0,0 +1,141 @@
|
|||||||
|
// =====================================================================================================================
|
||||||
|
// fennec, a free and open source game engine
|
||||||
|
// Copyright © 2025 Medusa Slockbower
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
// =====================================================================================================================
|
||||||
|
|
||||||
|
///
|
||||||
|
/// \file format.h
|
||||||
|
/// \brief
|
||||||
|
///
|
||||||
|
///
|
||||||
|
/// \details
|
||||||
|
/// \author Medusa Slockbower
|
||||||
|
///
|
||||||
|
/// \copyright Copyright © 2025 Medusa Slockbower ([GPLv3](https://www.gnu.org/licenses/gpl-3.0.en.html))
|
||||||
|
///
|
||||||
|
///
|
||||||
|
|
||||||
|
#ifndef FENNEC_LANG_STRINGS_FORMAT_H
|
||||||
|
#define FENNEC_LANG_STRINGS_FORMAT_H
|
||||||
|
|
||||||
|
#include <fennec/string/string.h>
|
||||||
|
|
||||||
|
#include <fennec/format/detail/_format.h>
|
||||||
|
#include <fennec/format/formatter.h>
|
||||||
|
|
||||||
|
namespace fennec
|
||||||
|
{
|
||||||
|
|
||||||
|
template<typename...ArgsT>
|
||||||
|
string format(const cstring& str, ArgsT&&...args) {
|
||||||
|
static constexpr size_t argc = sizeof...(ArgsT);
|
||||||
|
static constexpr format_arg default_fmt = {
|
||||||
|
.fill { // default no fill
|
||||||
|
.c = '\0',
|
||||||
|
.n = 0,
|
||||||
|
},
|
||||||
|
.align = '\0', // default to locale
|
||||||
|
.sign = '-', // default to sign only for negative numbers
|
||||||
|
.alt = false, // default no prefix
|
||||||
|
.width = 0,
|
||||||
|
.precision = 0,
|
||||||
|
.type = '\0',
|
||||||
|
};
|
||||||
|
|
||||||
|
// empty case
|
||||||
|
if constexpr(argc == 0) {
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
|
detail::_format_argarray<argc> argarray = { fennec::forward<ArgsT>(args)... };
|
||||||
|
string res;
|
||||||
|
size_t i = 0;
|
||||||
|
size_t a = -1;
|
||||||
|
|
||||||
|
while (i <= str.length()) {
|
||||||
|
size_t b = str.find('{', i);
|
||||||
|
size_t e = str.find('}', i);
|
||||||
|
format_arg fmt = default_fmt;
|
||||||
|
|
||||||
|
// check for '}}'
|
||||||
|
if (e < b) {
|
||||||
|
if (str[e + 1] == '}') {
|
||||||
|
res += string(str.data() + i, e - i);
|
||||||
|
i = e + 2;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
assertf(false, "fennec::format syntax error, encountered unexpected '{'")
|
||||||
|
}
|
||||||
|
|
||||||
|
// append string
|
||||||
|
if (b >= str.length()) { // handle end case
|
||||||
|
res += string(str.data() + i, str.length() - i);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
res += string(str.data() + i, b - i);
|
||||||
|
|
||||||
|
// next brace, validate escape
|
||||||
|
size_t nb = str.find('{', b + 1);
|
||||||
|
if (b + 1 == nb) {
|
||||||
|
res += '{';
|
||||||
|
i = nb + 1;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// find contained colon
|
||||||
|
size_t c = str.find(':', b);
|
||||||
|
|
||||||
|
// validate colon and brace location
|
||||||
|
assertf(c < nb or e < nb, "fennec::format syntax error, mismatched '{}'");
|
||||||
|
|
||||||
|
// parse index if present
|
||||||
|
size_t id = min(c, e) - 1;
|
||||||
|
if (id > b) {
|
||||||
|
a = 0;
|
||||||
|
} else {
|
||||||
|
++a;
|
||||||
|
}
|
||||||
|
for (size_t j = id, k = 1; j > b; --j, k *= 10) {
|
||||||
|
size_t u = (str[j] - '0');
|
||||||
|
assertf(u < 10, "fennec::format syntax error, invalid argument index");
|
||||||
|
a += k * u;
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate index
|
||||||
|
assertf(a < argc, "fennec::format syntax error, invalid argument index");
|
||||||
|
|
||||||
|
// early return case for no colon
|
||||||
|
if (c > e) {
|
||||||
|
res += argarray.format(a, fmt);
|
||||||
|
i = e + 1;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// parse format specifiers
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// add formatted argument
|
||||||
|
res += argarray.format(a, fmt);
|
||||||
|
i = e + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // FENNEC_LANG_STRINGS_FORMAT_H
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
// =====================================================================================================================
|
// =====================================================================================================================
|
||||||
|
|
||||||
///
|
///
|
||||||
/// \file test_format.h
|
/// \file format_arg.h
|
||||||
/// \brief
|
/// \brief
|
||||||
///
|
///
|
||||||
///
|
///
|
||||||
@@ -28,24 +28,25 @@
|
|||||||
///
|
///
|
||||||
///
|
///
|
||||||
|
|
||||||
#ifndef FENNEC_TEST_LANGPROC_FORMAT_H
|
#ifndef FENNEC_LANG_FORMAT_FORMAT_ARG_H
|
||||||
#define FENNEC_TEST_LANGPROC_FORMAT_H
|
#define FENNEC_LANG_FORMAT_FORMAT_ARG_H
|
||||||
#include <fennec/lang/strings/format.h>
|
|
||||||
|
#include <fennec/lang/types.h>
|
||||||
|
|
||||||
namespace fennec
|
namespace fennec
|
||||||
{
|
{
|
||||||
|
|
||||||
namespace test
|
struct format_arg {
|
||||||
{
|
struct {
|
||||||
|
char c;
|
||||||
inline void fennec_test_langproc_format() {
|
size_t n;
|
||||||
|
} fill;
|
||||||
fennec_test_run(fennec::format("{}", "Hello World!"), string("Hello World!"));
|
char align, sign;
|
||||||
fennec_test_run(fennec::format("{0}", "Hello World!"), string("Hello World!"));
|
bool alt;
|
||||||
}
|
size_t width, precision;
|
||||||
|
char type;
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
#endif // FENNEC_LANG_FORMAT_FORMAT_ARG_H
|
||||||
|
|
||||||
#endif // FENNEC_TEST_LANGPROC_FORMAT_H
|
|
||||||
71
include/fennec/format/formatter.h
Normal file
71
include/fennec/format/formatter.h
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
// =====================================================================================================================
|
||||||
|
// fennec, a free and open source game engine
|
||||||
|
// Copyright © 2025 Medusa Slockbower
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
// =====================================================================================================================
|
||||||
|
|
||||||
|
///
|
||||||
|
/// \file formatter.h
|
||||||
|
/// \brief
|
||||||
|
///
|
||||||
|
///
|
||||||
|
/// \details
|
||||||
|
/// \author Medusa Slockbower
|
||||||
|
///
|
||||||
|
/// \copyright Copyright © 2025 Medusa Slockbower ([GPLv3](https://www.gnu.org/licenses/gpl-3.0.en.html))
|
||||||
|
///
|
||||||
|
///
|
||||||
|
|
||||||
|
#ifndef FENNEC_LANG_FORMAT_FORMATTER_H
|
||||||
|
#define FENNEC_LANG_FORMAT_FORMATTER_H
|
||||||
|
|
||||||
|
#include <fennec/string/string.h>
|
||||||
|
#include <fennec/format/format_arg.h>
|
||||||
|
|
||||||
|
namespace fennec
|
||||||
|
{
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
struct formatter {
|
||||||
|
string operator()(const format_arg&, const T&) {
|
||||||
|
static_assert(false, "Formatter not implemented for the provided type.");
|
||||||
|
return string("");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<size_t N>
|
||||||
|
struct formatter<const char[N]> {
|
||||||
|
string operator()(const format_arg&, const char (&str)[N]) {
|
||||||
|
return string(str);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct formatter<cstring> {
|
||||||
|
string operator()(const format_arg&, const cstring& str) {
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct formatter<string> {
|
||||||
|
string operator()(const format_arg&, const string& str) {
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // FENNEC_LANG_FORMAT_FORMATTER_H
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
#include <fennec/containers/list.h>
|
#include <fennec/containers/list.h>
|
||||||
#include <fennec/containers/map.h>
|
#include <fennec/containers/map.h>
|
||||||
#include <fennec/containers/priority_queue.h>
|
#include <fennec/containers/priority_queue.h>
|
||||||
#include <fennec/lang/strings/string.h>
|
#include <fennec/string/string.h>
|
||||||
|
|
||||||
//
|
//
|
||||||
// escape sequences are tricky, sometimes they must be separated by white space,
|
// escape sequences are tricky, sometimes they must be separated by white space,
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
///
|
///
|
||||||
/// \page fennec_lang_assert Assertions
|
/// \page fennec_lang_assert Assertions
|
||||||
///
|
///
|
||||||
/// \code #include <fennec/langcpp/assert.h> \endcode
|
/// \code #include <fennec/lang/assert.h> \endcode
|
||||||
///
|
///
|
||||||
/// This header contains macros for making assertions about code behaviour.
|
/// This header contains macros for making assertions about code behaviour.
|
||||||
///
|
///
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
///
|
///
|
||||||
/// \page fennec_lang_bit_manipulation Bit Manipulation
|
/// \page fennec_lang_bit_manipulation Bit Manipulation
|
||||||
///
|
///
|
||||||
/// \code #include <fennec/langcpp/bits.h> \endcode
|
/// \code #include <fennec/lang/bits.h> \endcode
|
||||||
///
|
///
|
||||||
/// This header contains definitions for manipulating the bits of a provided object or pointer.
|
/// This header contains definitions for manipulating the bits of a provided object or pointer.
|
||||||
///
|
///
|
||||||
@@ -79,9 +79,9 @@
|
|||||||
///
|
///
|
||||||
///
|
///
|
||||||
|
|
||||||
#include <fennec/langcpp/intrinsics.h>
|
#include <fennec/lang/intrinsics.h>
|
||||||
#include <fennec/memory/common.h>
|
#include <fennec/memory/common.h>
|
||||||
#include <fennec/langcpp/detail/_bits.h>
|
#include <fennec/lang/detail/_bits.h>
|
||||||
|
|
||||||
namespace fennec
|
namespace fennec
|
||||||
{
|
{
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
#ifndef FENNEC_LANG_COMPARE_H
|
#ifndef FENNEC_LANG_COMPARE_H
|
||||||
#define FENNEC_LANG_COMPARE_H
|
#define FENNEC_LANG_COMPARE_H
|
||||||
|
|
||||||
#include <fennec/langcpp/type_operators.h>
|
#include <fennec/lang/type_operators.h>
|
||||||
|
|
||||||
namespace fennec
|
namespace fennec
|
||||||
{
|
{
|
||||||
@@ -32,12 +32,12 @@
|
|||||||
#ifndef FENNEC_LANG_CONDITIONAL_TYPES_H
|
#ifndef FENNEC_LANG_CONDITIONAL_TYPES_H
|
||||||
#define FENNEC_LANG_CONDITIONAL_TYPES_H
|
#define FENNEC_LANG_CONDITIONAL_TYPES_H
|
||||||
|
|
||||||
#include <fennec/langcpp/type_identity.h>
|
#include <fennec/lang/type_identity.h>
|
||||||
|
|
||||||
///
|
///
|
||||||
/// \page fennec_lang_conditional_types Conditional Types
|
/// \page fennec_lang_conditional_types Conditional Types
|
||||||
///
|
///
|
||||||
/// \code #include <fennec/langcpp/conditional_types.h> \endcode
|
/// \code #include <fennec/lang/conditional_types.h> \endcode
|
||||||
///
|
///
|
||||||
/// This header contains various compile-time functions for conditionally setting types, detecting types, or
|
/// This header contains various compile-time functions for conditionally setting types, detecting types, or
|
||||||
/// conditionally enabling functions. <br><br>
|
/// conditionally enabling functions. <br><br>
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
#ifndef FENNEC_LANG_CONSTANTS_H
|
#ifndef FENNEC_LANG_CONSTANTS_H
|
||||||
#define FENNEC_LANG_CONSTANTS_H
|
#define FENNEC_LANG_CONSTANTS_H
|
||||||
|
|
||||||
#include <fennec/langcpp/types.h>
|
#include <fennec/lang/types.h>
|
||||||
|
|
||||||
///
|
///
|
||||||
///
|
///
|
||||||
@@ -40,7 +40,7 @@
|
|||||||
/// \brief This header is part of the metaprogramming library. It defines structures for constant values,
|
/// \brief This header is part of the metaprogramming library. It defines structures for constant values,
|
||||||
/// used during compile time.
|
/// used during compile time.
|
||||||
///
|
///
|
||||||
/// \code #include <fennec/langcpp/constants.h> \endcode
|
/// \code #include <fennec/lang/constants.h> \endcode
|
||||||
///
|
///
|
||||||
/// <table width="100%" class="fieldtable" id="table_fennec_lang_constants">
|
/// <table width="100%" class="fieldtable" id="table_fennec_lang_constants">
|
||||||
/// <tr><th style="vertical-align: top">Syntax
|
/// <tr><th style="vertical-align: top">Syntax
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
#ifndef FENNEC_LANGCPP_DECLVAL_H
|
#ifndef FENNEC_LANGCPP_DECLVAL_H
|
||||||
#define FENNEC_LANGCPP_DECLVAL_H
|
#define FENNEC_LANGCPP_DECLVAL_H
|
||||||
|
|
||||||
#include <fennec/langcpp/detail/_declval.h>
|
#include <fennec/lang/detail/_declval.h>
|
||||||
|
|
||||||
namespace fennec
|
namespace fennec
|
||||||
{
|
{
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
#ifndef FENNEC_LANG_DETAIL_BITS_H
|
#ifndef FENNEC_LANG_DETAIL_BITS_H
|
||||||
#define FENNEC_LANG_DETAIL_BITS_H
|
#define FENNEC_LANG_DETAIL_BITS_H
|
||||||
|
|
||||||
#include <fennec/langcpp/types.h>
|
#include <fennec/lang/types.h>
|
||||||
|
|
||||||
namespace fennec::detail
|
namespace fennec::detail
|
||||||
{
|
{
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
#ifndef FENNEC_LANGCPP_DETAIL_DECLVAL_H
|
#ifndef FENNEC_LANGCPP_DETAIL_DECLVAL_H
|
||||||
#define FENNEC_LANGCPP_DETAIL_DECLVAL_H
|
#define FENNEC_LANGCPP_DETAIL_DECLVAL_H
|
||||||
|
|
||||||
#include <fennec/langcpp/constants.h>
|
#include <fennec/lang/constants.h>
|
||||||
|
|
||||||
namespace fennec::detail
|
namespace fennec::detail
|
||||||
{
|
{
|
||||||
@@ -19,8 +19,8 @@
|
|||||||
#ifndef FENNEC_LANG_DETAIL_NUMERIC_TRANSFORMS_H
|
#ifndef FENNEC_LANG_DETAIL_NUMERIC_TRANSFORMS_H
|
||||||
#define FENNEC_LANG_DETAIL_NUMERIC_TRANSFORMS_H
|
#define FENNEC_LANG_DETAIL_NUMERIC_TRANSFORMS_H
|
||||||
|
|
||||||
#include <fennec/langcpp/types.h>
|
#include <fennec/lang/types.h>
|
||||||
#include <fennec/langcpp/type_transforms.h>
|
#include <fennec/lang/type_transforms.h>
|
||||||
|
|
||||||
namespace fennec::detail
|
namespace fennec::detail
|
||||||
{
|
{
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
#ifndef FENNEC_LANG_DETAIL_TYPE_SEQUENCES_H
|
#ifndef FENNEC_LANG_DETAIL_TYPE_SEQUENCES_H
|
||||||
#define FENNEC_LANG_DETAIL_TYPE_SEQUENCES_H
|
#define FENNEC_LANG_DETAIL_TYPE_SEQUENCES_H
|
||||||
|
|
||||||
#include <fennec/langcpp/type_transforms.h>
|
#include <fennec/lang/type_transforms.h>
|
||||||
|
|
||||||
namespace fennec::detail
|
namespace fennec::detail
|
||||||
{
|
{
|
||||||
@@ -19,9 +19,9 @@
|
|||||||
#ifndef FENNEC_LANG_DETAIL_TYPE_TRAITS_H
|
#ifndef FENNEC_LANG_DETAIL_TYPE_TRAITS_H
|
||||||
#define FENNEC_LANG_DETAIL_TYPE_TRAITS_H
|
#define FENNEC_LANG_DETAIL_TYPE_TRAITS_H
|
||||||
|
|
||||||
#include <fennec/langcpp/ranges.h>
|
#include <fennec/lang/ranges.h>
|
||||||
#include <fennec/langcpp/constants.h>
|
#include <fennec/lang/constants.h>
|
||||||
#include <fennec/langcpp/declval.h>
|
#include <fennec/lang/declval.h>
|
||||||
|
|
||||||
namespace fennec::detail
|
namespace fennec::detail
|
||||||
{
|
{
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
#ifndef FENNEC_LANG_DETAIL_TYPE_TRANSFORMS_H
|
#ifndef FENNEC_LANG_DETAIL_TYPE_TRANSFORMS_H
|
||||||
#define FENNEC_LANG_DETAIL_TYPE_TRANSFORMS_H
|
#define FENNEC_LANG_DETAIL_TYPE_TRANSFORMS_H
|
||||||
|
|
||||||
#include <fennec/langcpp/types.h>
|
#include <fennec/lang/types.h>
|
||||||
|
|
||||||
namespace fennec::detail
|
namespace fennec::detail
|
||||||
{
|
{
|
||||||
@@ -30,7 +30,7 @@
|
|||||||
#ifndef FENNEC_LANG_FLOAT_H
|
#ifndef FENNEC_LANG_FLOAT_H
|
||||||
#define FENNEC_LANG_FLOAT_H
|
#define FENNEC_LANG_FLOAT_H
|
||||||
|
|
||||||
#include <fennec/langcpp/bits.h>
|
#include <fennec/lang/bits.h>
|
||||||
|
|
||||||
#undef FLT_HAS_INFINITY
|
#undef FLT_HAS_INFINITY
|
||||||
#undef FLT_HAS_QUIET_NAN
|
#undef FLT_HAS_QUIET_NAN
|
||||||
@@ -19,8 +19,8 @@
|
|||||||
#ifndef FENNEC_LANG_HASHING_H
|
#ifndef FENNEC_LANG_HASHING_H
|
||||||
#define FENNEC_LANG_HASHING_H
|
#define FENNEC_LANG_HASHING_H
|
||||||
|
|
||||||
#include <fennec/langcpp/types.h>
|
#include <fennec/lang/types.h>
|
||||||
#include <fennec/langcpp/type_traits.h>
|
#include <fennec/lang/type_traits.h>
|
||||||
|
|
||||||
namespace fennec
|
namespace fennec
|
||||||
{
|
{
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
/// \brief This header contains definitions for compiler intrinsics necessary for implementing functions of the
|
/// \brief This header contains definitions for compiler intrinsics necessary for implementing functions of the
|
||||||
/// C++ stdlib.
|
/// C++ stdlib.
|
||||||
///
|
///
|
||||||
/// \code{.cpp}#include <fennec/langcpp/intrinsics.h>\endcode
|
/// \code{.cpp}#include <fennec/lang/intrinsics.h>\endcode
|
||||||
///
|
///
|
||||||
///
|
///
|
||||||
/// <table width="100%" class="fieldtable" id="table_fennec_lang_intrinsics">
|
/// <table width="100%" class="fieldtable" id="table_fennec_lang_intrinsics">
|
||||||
@@ -31,10 +31,10 @@
|
|||||||
#ifndef FENNEC_LANG_H
|
#ifndef FENNEC_LANG_H
|
||||||
#define FENNEC_LANG_H
|
#define FENNEC_LANG_H
|
||||||
|
|
||||||
#include <fennec/langcpp/assert.h>
|
#include <fennec/lang/assert.h>
|
||||||
#include <fennec/langcpp/bits.h>
|
#include <fennec/lang/bits.h>
|
||||||
#include <fennec/langcpp/types.h>
|
#include <fennec/lang/types.h>
|
||||||
#include <fennec/langcpp/utility.h>
|
#include <fennec/lang/utility.h>
|
||||||
|
|
||||||
///
|
///
|
||||||
/// \page fennec_lang C++ Language Library
|
/// \page fennec_lang C++ Language Library
|
||||||
@@ -39,7 +39,7 @@
|
|||||||
/// floats and integers. There are overloads for all builtin types, and overloads for other types are included in
|
/// floats and integers. There are overloads for all builtin types, and overloads for other types are included in
|
||||||
/// their own header.
|
/// their own header.
|
||||||
///
|
///
|
||||||
/// \code{.cpp}#include <fennec/langcpp/limits.h>\endcode
|
/// \code{.cpp}#include <fennec/lang/limits.h>\endcode
|
||||||
///
|
///
|
||||||
/// \section fennec_lang_limits_numeric_limits Numeric Limits
|
/// \section fennec_lang_limits_numeric_limits Numeric Limits
|
||||||
/// <table width="100%" class="fieldtable" id="table_fennec_lang_limits">
|
/// <table width="100%" class="fieldtable" id="table_fennec_lang_limits">
|
||||||
@@ -197,11 +197,11 @@
|
|||||||
///
|
///
|
||||||
///
|
///
|
||||||
|
|
||||||
#include <fennec/langcpp/types.h>
|
#include <fennec/lang/types.h>
|
||||||
#include <fennec/langcpp/type_traits.h>
|
#include <fennec/lang/type_traits.h>
|
||||||
|
|
||||||
#include <fennec/langcpp/integer.h>
|
#include <fennec/lang/integer.h>
|
||||||
#include <fennec/langcpp/float.h>
|
#include <fennec/lang/float.h>
|
||||||
|
|
||||||
namespace fennec
|
namespace fennec
|
||||||
{
|
{
|
||||||
@@ -36,7 +36,7 @@
|
|||||||
///
|
///
|
||||||
/// \brief This header is part of the metaprogramming library. It defines structures for metasequences of values, used during compile time.
|
/// \brief This header is part of the metaprogramming library. It defines structures for metasequences of values, used during compile time.
|
||||||
///
|
///
|
||||||
/// \code #include <fennec/langcpp/metasequences.h> \endcode
|
/// \code #include <fennec/lang/metasequences.h> \endcode
|
||||||
///
|
///
|
||||||
/// <table width="100%" class="fieldtable" id="table_fennec_lang_metasequences">
|
/// <table width="100%" class="fieldtable" id="table_fennec_lang_metasequences">
|
||||||
/// <tr><th style="vertical-align: top">Syntax
|
/// <tr><th style="vertical-align: top">Syntax
|
||||||
@@ -70,7 +70,7 @@
|
|||||||
/// </table>
|
/// </table>
|
||||||
///
|
///
|
||||||
|
|
||||||
#include <fennec/langcpp/type_traits.h>
|
#include <fennec/lang/type_traits.h>
|
||||||
|
|
||||||
namespace fennec
|
namespace fennec
|
||||||
{
|
{
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
///
|
///
|
||||||
/// \page fennec_lang_numeric_transforms Numeric Transforms
|
/// \page fennec_lang_numeric_transforms Numeric Transforms
|
||||||
///
|
///
|
||||||
/// \code #include <fennec/langcpp/numeric_transforms.h> \endcode
|
/// \code #include <fennec/lang/numeric_transforms.h> \endcode
|
||||||
///
|
///
|
||||||
/// This header contains various compile-time functions for changing the characteristics of a provided type
|
/// This header contains various compile-time functions for changing the characteristics of a provided type
|
||||||
///
|
///
|
||||||
@@ -54,8 +54,8 @@
|
|||||||
///
|
///
|
||||||
/// </table>
|
/// </table>
|
||||||
|
|
||||||
#include <fennec/langcpp/type_transforms.h>
|
#include <fennec/lang/type_transforms.h>
|
||||||
#include <fennec/langcpp/detail/_numeric_transforms.h>
|
#include <fennec/lang/detail/_numeric_transforms.h>
|
||||||
|
|
||||||
namespace fennec
|
namespace fennec
|
||||||
{
|
{
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
#ifndef FENNEC_LANGCPP_RANGES_H
|
#ifndef FENNEC_LANGCPP_RANGES_H
|
||||||
#define FENNEC_LANGCPP_RANGES_H
|
#define FENNEC_LANGCPP_RANGES_H
|
||||||
|
|
||||||
#include <fennec/langcpp/types.h>
|
#include <fennec/lang/types.h>
|
||||||
|
|
||||||
namespace fennec
|
namespace fennec
|
||||||
{
|
{
|
||||||
@@ -1,210 +0,0 @@
|
|||||||
// =====================================================================================================================
|
|
||||||
// fennec, a free and open source game engine
|
|
||||||
// Copyright © 2025 Medusa Slockbower
|
|
||||||
//
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU General Public License as published by
|
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
|
||||||
// (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU General Public License
|
|
||||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
// =====================================================================================================================
|
|
||||||
|
|
||||||
///
|
|
||||||
/// \file format.h
|
|
||||||
/// \brief
|
|
||||||
///
|
|
||||||
///
|
|
||||||
/// \details
|
|
||||||
/// \author Medusa Slockbower
|
|
||||||
///
|
|
||||||
/// \copyright Copyright © 2025 Medusa Slockbower ([GPLv3](https://www.gnu.org/licenses/gpl-3.0.en.html))
|
|
||||||
///
|
|
||||||
///
|
|
||||||
|
|
||||||
#ifndef FENNEC_LANGPROC_STRINGS_FORMAT_H
|
|
||||||
#define FENNEC_LANGPROC_STRINGS_FORMAT_H
|
|
||||||
#include <fennec/containers/pair.h>
|
|
||||||
#include <fennec/lang/strings/cstring.h>
|
|
||||||
#include <fennec/lang/strings/string.h>
|
|
||||||
|
|
||||||
namespace fennec
|
|
||||||
{
|
|
||||||
|
|
||||||
template<typename TypeT>
|
|
||||||
struct formatter {
|
|
||||||
constexpr string operator()(const string_view&, const TypeT&) {
|
|
||||||
static_assert(false, "Formatter not implemented for the provided type.");
|
|
||||||
return string{""};
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
template<>
|
|
||||||
struct formatter<cstring> {
|
|
||||||
constexpr string operator()(const string_view&, const cstring& str) {
|
|
||||||
return string(str);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
template<size_t N>
|
|
||||||
struct formatter<const char (&)[N]> {
|
|
||||||
constexpr string operator()(const string_view&, const char (&str)[N]) {
|
|
||||||
return string(str);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
template<size_t N, typename...ArgsT>
|
|
||||||
struct format_string {
|
|
||||||
|
|
||||||
// Definitions =========================================================================================================
|
|
||||||
private:
|
|
||||||
static constexpr size_t npos = -1;
|
|
||||||
|
|
||||||
enum token_ : bool {
|
|
||||||
token_text = false,
|
|
||||||
token_param = true,
|
|
||||||
};
|
|
||||||
|
|
||||||
struct token {
|
|
||||||
uint8_t type;
|
|
||||||
string_view view;
|
|
||||||
size_t param;
|
|
||||||
};
|
|
||||||
|
|
||||||
constexpr const char* find(const char* start, char c) {
|
|
||||||
while (*start != c && *start != '\0') {
|
|
||||||
++start;
|
|
||||||
}
|
|
||||||
return start;
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr size_t parse_index(const char* start, size_t n) {
|
|
||||||
size_t x = 0;
|
|
||||||
while (n-- > 0) {
|
|
||||||
x *= 10;
|
|
||||||
x += *start - '0';
|
|
||||||
}
|
|
||||||
return x;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Constructors & Destructor ===========================================================================================
|
|
||||||
public:
|
|
||||||
format_string() = delete;
|
|
||||||
|
|
||||||
constexpr format_string(const char (&str)[N])
|
|
||||||
: _tokens(), _num_tokens(0) {
|
|
||||||
// TODO: Numbered Parameters
|
|
||||||
|
|
||||||
size_t params = 0;
|
|
||||||
for (size_t i = 0; i < N - 1; ++i) {
|
|
||||||
size_t l = this->find(str + i, '{') - str;
|
|
||||||
|
|
||||||
// Push the current token
|
|
||||||
if (l - i > 0) {
|
|
||||||
_tokens[_num_tokens++] = { token_text, { &str[i], l - i }, npos };
|
|
||||||
}
|
|
||||||
|
|
||||||
// no more braces, break
|
|
||||||
if (l >= N) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// escaped brace
|
|
||||||
if (str[l + 1] == '{') {
|
|
||||||
_tokens[_num_tokens++] = { token_text, { &str[l], 1 }, npos };
|
|
||||||
i = l + 1;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t e = this->find(str + l, '}') - str;
|
|
||||||
assertd(e < N, "Malformed format string, mismatched brace");
|
|
||||||
|
|
||||||
// Colon found
|
|
||||||
size_t c = this->find(str + l, ':') - str;
|
|
||||||
if (c < e) {
|
|
||||||
size_t n = c - l;
|
|
||||||
if (n > 1) { // Check if index is provided
|
|
||||||
params = this->parse_index(str + l + 1, n - 1);
|
|
||||||
}
|
|
||||||
l = c;
|
|
||||||
} else if (e - l > 1) { // check if index is provided
|
|
||||||
params = this->parse_index(str + l + 1, e - l - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
assertd(params < sizeof...(ArgsT), "Malformed format string, parameter count does not match argument count.");
|
|
||||||
_tokens[_num_tokens++] = { token_param, { &str[l + 1], e - l - 1 }, params++ };
|
|
||||||
i = e;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr format_string(const format_string&) = default;
|
|
||||||
constexpr format_string(format_string&&) noexcept = default;
|
|
||||||
|
|
||||||
~format_string() = default;
|
|
||||||
|
|
||||||
string format(ArgsT&&...args) const {
|
|
||||||
string parts[N];
|
|
||||||
|
|
||||||
// Copy raw text tokens
|
|
||||||
size_t i = 0;
|
|
||||||
for (i = 0; i < _num_tokens; ++i) {
|
|
||||||
const token& tok = _tokens[i];
|
|
||||||
if (not tok.type) {
|
|
||||||
parts[i] = tok.view;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Copy arguments
|
|
||||||
this->_format(0, parts, fennec::forward<ArgsT>(args)...);
|
|
||||||
|
|
||||||
string res;
|
|
||||||
for (i = 0; i < _num_tokens; ++i) {
|
|
||||||
res += parts[i];
|
|
||||||
}
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
array<token, N> _tokens;
|
|
||||||
size_t _num_tokens;
|
|
||||||
|
|
||||||
void _format(size_t) const {
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename HeadT, typename...RestT>
|
|
||||||
void _format(size_t p, string (&parts)[N], HeadT&& head, RestT&&...rest) const {
|
|
||||||
size_t i = 0;
|
|
||||||
for (const token& tok : _tokens) {
|
|
||||||
if (i >= _num_tokens) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (tok.param == p) {
|
|
||||||
formatter<HeadT> fmt;
|
|
||||||
parts[i] = fmt(tok.view, head);
|
|
||||||
}
|
|
||||||
++i;
|
|
||||||
}
|
|
||||||
this->_format(p + 1, fennec::forward<RestT>(rest)...);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
template<size_t N, typename...ArgsT>
|
|
||||||
string _format(const format_string<N, ArgsT...>& str, ArgsT&&...args) {
|
|
||||||
return str.format(fennec::forward<ArgsT>(args)...);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<size_t N, typename...ArgsT>
|
|
||||||
string format(const char (&str)[N], ArgsT&&...args) {
|
|
||||||
return fennec::_format<N, ArgsT...>(format_string<N, ArgsT...>(str), fennec::forward<ArgsT>(args)...);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // FENNEC_LANGPROC_STRINGS_FORMAT_H
|
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
/// \brief Part of the fennec metaprogramming library. This header defines structures for copying types with different traits
|
/// \brief Part of the fennec metaprogramming library. This header defines structures for copying types with different traits
|
||||||
/// or rather, transform them, at compile time.
|
/// or rather, transform them, at compile time.
|
||||||
///
|
///
|
||||||
/// \code #include <fennec/langcpp/type_identity.h> \endcode
|
/// \code #include <fennec/lang/type_identity.h> \endcode
|
||||||
///
|
///
|
||||||
///
|
///
|
||||||
/// <table width="100%" class="fieldtable" id="table_fennec_lang_type_identity">
|
/// <table width="100%" class="fieldtable" id="table_fennec_lang_type_identity">
|
||||||
@@ -36,7 +36,7 @@
|
|||||||
///
|
///
|
||||||
/// \brief This header is part of the metaprogramming library. It defines structures for sequences of types, used during compile time.
|
/// \brief This header is part of the metaprogramming library. It defines structures for sequences of types, used during compile time.
|
||||||
///
|
///
|
||||||
/// \code #include <fennec/langcpp/type_sequences.h> \endcode
|
/// \code #include <fennec/lang/type_sequences.h> \endcode
|
||||||
///
|
///
|
||||||
/// <table width="100%" class="fieldtable" id="table_fennec_lang_type_sequences">
|
/// <table width="100%" class="fieldtable" id="table_fennec_lang_type_sequences">
|
||||||
/// <tr><th style="vertical-align: top">Syntax
|
/// <tr><th style="vertical-align: top">Syntax
|
||||||
@@ -54,7 +54,7 @@
|
|||||||
/// </table>
|
/// </table>
|
||||||
///
|
///
|
||||||
|
|
||||||
#include <fennec/langcpp/detail/_type_sequences.h>
|
#include <fennec/lang/detail/_type_sequences.h>
|
||||||
|
|
||||||
namespace fennec
|
namespace fennec
|
||||||
{
|
{
|
||||||
@@ -37,7 +37,7 @@
|
|||||||
/// \brief Part of the fennec metaprogramming library. This header defines structures for accessing traits of types
|
/// \brief Part of the fennec metaprogramming library. This header defines structures for accessing traits of types
|
||||||
/// at compile time.
|
/// at compile time.
|
||||||
///
|
///
|
||||||
/// \code #include <fennec/langcpp/type_traits.h> \endcode
|
/// \code #include <fennec/lang/type_traits.h> \endcode
|
||||||
///
|
///
|
||||||
///
|
///
|
||||||
///
|
///
|
||||||
@@ -427,9 +427,9 @@
|
|||||||
/// </table>
|
/// </table>
|
||||||
///
|
///
|
||||||
|
|
||||||
#include <fennec/langcpp/intrinsics.h>
|
#include <fennec/lang/intrinsics.h>
|
||||||
#include <fennec/langcpp/type_transforms.h>
|
#include <fennec/lang/type_transforms.h>
|
||||||
#include <fennec/langcpp/detail/_type_traits.h>
|
#include <fennec/lang/detail/_type_traits.h>
|
||||||
|
|
||||||
namespace fennec
|
namespace fennec
|
||||||
{
|
{
|
||||||
@@ -31,10 +31,10 @@
|
|||||||
#ifndef FENNEC_LANG_TYPE_TRANSFORMS_H
|
#ifndef FENNEC_LANG_TYPE_TRANSFORMS_H
|
||||||
#define FENNEC_LANG_TYPE_TRANSFORMS_H
|
#define FENNEC_LANG_TYPE_TRANSFORMS_H
|
||||||
|
|
||||||
#include <fennec/langcpp/conditional_types.h>
|
#include <fennec/lang/conditional_types.h>
|
||||||
#include <fennec/langcpp/type_identity.h>
|
#include <fennec/lang/type_identity.h>
|
||||||
#include <fennec/langcpp/detail/_type_traits.h>
|
#include <fennec/lang/detail/_type_traits.h>
|
||||||
#include <fennec/langcpp/detail/_type_transforms.h>
|
#include <fennec/lang/detail/_type_transforms.h>
|
||||||
|
|
||||||
///
|
///
|
||||||
/// \page fennec_lang_type_transforms Type Transforms
|
/// \page fennec_lang_type_transforms Type Transforms
|
||||||
@@ -42,7 +42,7 @@
|
|||||||
/// \brief Part of the fennec metaprogramming library. This header defines structures for copying types with different traits
|
/// \brief Part of the fennec metaprogramming library. This header defines structures for copying types with different traits
|
||||||
/// or rather, transform them, at compile time.
|
/// or rather, transform them, at compile time.
|
||||||
///
|
///
|
||||||
/// \code #include <fennec/langcpp/type_transforms.h> \endcode
|
/// \code #include <fennec/lang/type_transforms.h> \endcode
|
||||||
///
|
///
|
||||||
///
|
///
|
||||||
/// <table width="100%" class="fieldtable" id="table_fennec_lang_type_transforms">
|
/// <table width="100%" class="fieldtable" id="table_fennec_lang_type_transforms">
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
///
|
///
|
||||||
/// \page fennec_lang_types Types
|
/// \page fennec_lang_types Types
|
||||||
///
|
///
|
||||||
/// \code #include <fennec/langcpp/types.h> \endcode
|
/// \code #include <fennec/lang/types.h> \endcode
|
||||||
///
|
///
|
||||||
/// \brief This header contains definitions for the built-in types of the C++ language.
|
/// \brief This header contains definitions for the built-in types of the C++ language.
|
||||||
///
|
///
|
||||||
@@ -201,7 +201,7 @@
|
|||||||
///
|
///
|
||||||
///
|
///
|
||||||
|
|
||||||
#include <fennec/langcpp/detail/_int.h>
|
#include <fennec/lang/detail/_int.h>
|
||||||
|
|
||||||
namespace fennec
|
namespace fennec
|
||||||
{
|
{
|
||||||
@@ -36,7 +36,7 @@
|
|||||||
///
|
///
|
||||||
/// \brief This header contains common utility functions related to the C++ language.
|
/// \brief This header contains common utility functions related to the C++ language.
|
||||||
///
|
///
|
||||||
/// \code #include <fennec/langcpp/utility.h> \endcode
|
/// \code #include <fennec/lang/utility.h> \endcode
|
||||||
///
|
///
|
||||||
/// <table width="100%" class="fieldtable" id="table_fennec_lang_utility">
|
/// <table width="100%" class="fieldtable" id="table_fennec_lang_utility">
|
||||||
/// <tr><th style="vertical-align: top">Syntax
|
/// <tr><th style="vertical-align: top">Syntax
|
||||||
@@ -59,8 +59,8 @@
|
|||||||
/// </table>
|
/// </table>
|
||||||
///
|
///
|
||||||
|
|
||||||
#include <fennec/langcpp/type_transforms.h>
|
#include <fennec/lang/type_transforms.h>
|
||||||
#include <fennec/langcpp/type_traits.h>
|
#include <fennec/lang/type_traits.h>
|
||||||
|
|
||||||
namespace fennec
|
namespace fennec
|
||||||
{
|
{
|
||||||
@@ -271,7 +271,7 @@
|
|||||||
|
|
||||||
#include <fennec/math/detail/_math.h>
|
#include <fennec/math/detail/_math.h>
|
||||||
|
|
||||||
#include <fennec/langcpp/limits.h>
|
#include <fennec/lang/limits.h>
|
||||||
|
|
||||||
#include <fennec/math/vector.h>
|
#include <fennec/math/vector.h>
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
#ifndef FENNEC_MATH_DETAIL_TYPES_H
|
#ifndef FENNEC_MATH_DETAIL_TYPES_H
|
||||||
#define FENNEC_MATH_DETAIL_TYPES_H
|
#define FENNEC_MATH_DETAIL_TYPES_H
|
||||||
|
|
||||||
#include <fennec/langcpp/metasequences.h>
|
#include <fennec/lang/metasequences.h>
|
||||||
|
|
||||||
namespace fennec
|
namespace fennec
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
#include <fennec/math/detail/_fwd.h>
|
#include <fennec/math/detail/_fwd.h>
|
||||||
|
|
||||||
#include <fennec/langcpp/type_traits.h>
|
#include <fennec/lang/type_traits.h>
|
||||||
#include <fennec/math/swizzle.h>
|
#include <fennec/math/swizzle.h>
|
||||||
|
|
||||||
namespace fennec
|
namespace fennec
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
#ifndef FENNEC_MATH_EXT_COMMON_H
|
#ifndef FENNEC_MATH_EXT_COMMON_H
|
||||||
#define FENNEC_MATH_EXT_COMMON_H
|
#define FENNEC_MATH_EXT_COMMON_H
|
||||||
|
|
||||||
#include <fennec/langcpp/limits.h>
|
#include <fennec/lang/limits.h>
|
||||||
|
|
||||||
#include <fennec/math/common.h>
|
#include <fennec/math/common.h>
|
||||||
#include <fennec/math/trigonometric.h>
|
#include <fennec/math/trigonometric.h>
|
||||||
|
|||||||
@@ -111,7 +111,7 @@
|
|||||||
///
|
///
|
||||||
///
|
///
|
||||||
|
|
||||||
#include <fennec/langcpp/types.h>
|
#include <fennec/lang/types.h>
|
||||||
|
|
||||||
namespace fennec
|
namespace fennec
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -57,7 +57,7 @@
|
|||||||
///
|
///
|
||||||
///
|
///
|
||||||
|
|
||||||
#include <fennec/langcpp/types.h>
|
#include <fennec/lang/types.h>
|
||||||
|
|
||||||
#include <fennec/math/detail/_fwd.h>
|
#include <fennec/math/detail/_fwd.h>
|
||||||
#include <fennec/math/detail/_types.h>
|
#include <fennec/math/detail/_types.h>
|
||||||
|
|||||||
@@ -41,7 +41,7 @@
|
|||||||
///
|
///
|
||||||
///
|
///
|
||||||
|
|
||||||
#include <fennec/langcpp/metasequences.h>
|
#include <fennec/lang/metasequences.h>
|
||||||
|
|
||||||
#include <fennec/math/swizzle_storage.h>
|
#include <fennec/math/swizzle_storage.h>
|
||||||
|
|
||||||
|
|||||||
@@ -146,7 +146,7 @@
|
|||||||
|
|
||||||
#include <fennec/math/detail/_math.h>
|
#include <fennec/math/detail/_math.h>
|
||||||
#include <fennec/math/vector.h>
|
#include <fennec/math/vector.h>
|
||||||
#include <fennec/langcpp/types.h>
|
#include <fennec/lang/types.h>
|
||||||
|
|
||||||
namespace fennec
|
namespace fennec
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -108,9 +108,9 @@
|
|||||||
#include <fennec/math/vector_base.h>
|
#include <fennec/math/vector_base.h>
|
||||||
#include <fennec/math/vector_traits.h>
|
#include <fennec/math/vector_traits.h>
|
||||||
|
|
||||||
#include <fennec/langcpp/conditional_types.h>
|
#include <fennec/lang/conditional_types.h>
|
||||||
#include <fennec/langcpp/type_traits.h>
|
#include <fennec/lang/type_traits.h>
|
||||||
#include <fennec/langcpp/utility.h>
|
#include <fennec/lang/utility.h>
|
||||||
|
|
||||||
namespace fennec
|
namespace fennec
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -35,10 +35,10 @@
|
|||||||
#include <fennec/memory/pointer_traits.h>
|
#include <fennec/memory/pointer_traits.h>
|
||||||
#include <fennec/memory/new.h>
|
#include <fennec/memory/new.h>
|
||||||
|
|
||||||
#include <fennec/langcpp/conditional_types.h>
|
#include <fennec/lang/conditional_types.h>
|
||||||
#include <fennec/langcpp/numeric_transforms.h>
|
#include <fennec/lang/numeric_transforms.h>
|
||||||
#include <fennec/langcpp/types.h>
|
#include <fennec/lang/types.h>
|
||||||
#include <fennec/langcpp/type_traits.h>
|
#include <fennec/lang/type_traits.h>
|
||||||
|
|
||||||
#include <fennec/math/ext/constants.h>
|
#include <fennec/math/ext/constants.h>
|
||||||
#include <fennec/math/common.h>
|
#include <fennec/math/common.h>
|
||||||
|
|||||||
@@ -19,9 +19,9 @@
|
|||||||
#ifndef FENNEC_LANG_BYTES_H
|
#ifndef FENNEC_LANG_BYTES_H
|
||||||
#define FENNEC_LANG_BYTES_H
|
#define FENNEC_LANG_BYTES_H
|
||||||
|
|
||||||
#include <fennec/langcpp/assert.h>
|
#include <fennec/lang/assert.h>
|
||||||
#include <fennec/langcpp/types.h>
|
#include <fennec/lang/types.h>
|
||||||
#include <fennec/langcpp/hashing.h>
|
#include <fennec/lang/hashing.h>
|
||||||
|
|
||||||
namespace fennec
|
namespace fennec
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
#ifndef FENNEC_MEMORY_H
|
#ifndef FENNEC_MEMORY_H
|
||||||
#define FENNEC_MEMORY_H
|
#define FENNEC_MEMORY_H
|
||||||
|
|
||||||
#include <fennec/langcpp/type_traits.h>
|
#include <fennec/lang/type_traits.h>
|
||||||
#include <fennec/memory/detail/_string.h>
|
#include <fennec/memory/detail/_string.h>
|
||||||
|
|
||||||
namespace fennec
|
namespace fennec
|
||||||
|
|||||||
@@ -19,10 +19,10 @@
|
|||||||
#ifndef FENNEC_MEMORY_DETAIL_PTR_TRAITS_H
|
#ifndef FENNEC_MEMORY_DETAIL_PTR_TRAITS_H
|
||||||
#define FENNEC_MEMORY_DETAIL_PTR_TRAITS_H
|
#define FENNEC_MEMORY_DETAIL_PTR_TRAITS_H
|
||||||
|
|
||||||
#include <fennec/langcpp/conditional_types.h>
|
#include <fennec/lang/conditional_types.h>
|
||||||
#include <fennec/langcpp/types.h>
|
#include <fennec/lang/types.h>
|
||||||
#include <fennec/langcpp/type_traits.h>
|
#include <fennec/lang/type_traits.h>
|
||||||
#include <fennec/langcpp/type_sequences.h>
|
#include <fennec/lang/type_sequences.h>
|
||||||
|
|
||||||
namespace fennec
|
namespace fennec
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -32,8 +32,8 @@
|
|||||||
#ifndef FENNEC_MEMORY_NEW_H
|
#ifndef FENNEC_MEMORY_NEW_H
|
||||||
#define FENNEC_MEMORY_NEW_H
|
#define FENNEC_MEMORY_NEW_H
|
||||||
|
|
||||||
#include <fennec/langcpp/types.h>
|
#include <fennec/lang/types.h>
|
||||||
#include <fennec/langcpp/utility.h>
|
#include <fennec/lang/utility.h>
|
||||||
|
|
||||||
namespace fennec
|
namespace fennec
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
#ifndef FENNEC_MEMORY_PTR_TRAITS_H
|
#ifndef FENNEC_MEMORY_PTR_TRAITS_H
|
||||||
#define FENNEC_MEMORY_PTR_TRAITS_H
|
#define FENNEC_MEMORY_PTR_TRAITS_H
|
||||||
|
|
||||||
#include <fennec/langcpp/types.h>
|
#include <fennec/lang/types.h>
|
||||||
#include <fennec/memory/detail/_ptr_traits.h>
|
#include <fennec/memory/detail/_ptr_traits.h>
|
||||||
|
|
||||||
namespace fennec
|
namespace fennec
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
#ifndef FENNEC_MEMORY_POINTERS_H
|
#ifndef FENNEC_MEMORY_POINTERS_H
|
||||||
#define FENNEC_MEMORY_POINTERS_H
|
#define FENNEC_MEMORY_POINTERS_H
|
||||||
|
|
||||||
#include <fennec/langcpp/type_traits.h>
|
#include <fennec/lang/type_traits.h>
|
||||||
|
|
||||||
namespace fennec
|
namespace fennec
|
||||||
{
|
{
|
||||||
@@ -109,16 +109,7 @@ public:
|
|||||||
/// \brief Pointer Constructor, creates a unique_ptr that owns `ptr` with deleter `del`
|
/// \brief Pointer Constructor, creates a unique_ptr that owns `ptr` with deleter `del`
|
||||||
/// \param ptr The resource to own
|
/// \param ptr The resource to own
|
||||||
/// \param del The deleter
|
/// \param del The deleter
|
||||||
explicit constexpr unique_ptr(pointer_t ptr, const delete_t& del)
|
explicit constexpr unique_ptr(pointer_t ptr, const delete_t& del = delete_t())
|
||||||
: _delete(del)
|
|
||||||
, _handle(ptr) {
|
|
||||||
}
|
|
||||||
|
|
||||||
///
|
|
||||||
/// \brief Pointer Constructor, creates a unique_ptr that owns `ptr` with deleter `del`
|
|
||||||
/// \param ptr The resource to own
|
|
||||||
/// \param del The deleter
|
|
||||||
explicit constexpr unique_ptr(pointer_t ptr, delete_t&& del = delete_t())
|
|
||||||
: _delete(del)
|
: _delete(del)
|
||||||
, _handle(ptr) {
|
, _handle(ptr) {
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,8 +21,8 @@
|
|||||||
|
|
||||||
#include <fennec/containers/list.h>
|
#include <fennec/containers/list.h>
|
||||||
#include <fennec/containers/sequence.h>
|
#include <fennec/containers/sequence.h>
|
||||||
#include <fennec/lang/strings/cstring.h>
|
#include <fennec/string/cstring.h>
|
||||||
#include <fennec/lang/strings/string.h>
|
#include <fennec/string/string.h>
|
||||||
#include <fennec/platform/interface/fwd.h>
|
#include <fennec/platform/interface/fwd.h>
|
||||||
#include <fennec/platform/interface/window.h>
|
#include <fennec/platform/interface/window.h>
|
||||||
#include <fennec/rtti/enable.h>
|
#include <fennec/rtti/enable.h>
|
||||||
|
|||||||
@@ -31,8 +31,8 @@
|
|||||||
#ifndef FENNEC_PLATFORM_INTERFACE_WINDOW_H
|
#ifndef FENNEC_PLATFORM_INTERFACE_WINDOW_H
|
||||||
#define FENNEC_PLATFORM_INTERFACE_WINDOW_H
|
#define FENNEC_PLATFORM_INTERFACE_WINDOW_H
|
||||||
|
|
||||||
#include <fennec/langcpp/types.h>
|
#include <fennec/lang/types.h>
|
||||||
#include <fennec/lang/strings/string.h>
|
#include <fennec/string/string.h>
|
||||||
#include <fennec/containers/bitfield.h>
|
#include <fennec/containers/bitfield.h>
|
||||||
#include <fennec/renderers/interface/gfxcontext.h>
|
#include <fennec/renderers/interface/gfxcontext.h>
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -16,37 +16,22 @@
|
|||||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
// =====================================================================================================================
|
// =====================================================================================================================
|
||||||
|
|
||||||
#ifndef FENNEC_TEST_LANGPROC_H
|
#ifndef FENNEC_PLATFORM_LINUX_WAYLAND_DYN_H
|
||||||
#define FENNEC_TEST_LANGPROC_H
|
#define FENNEC_PLATFORM_LINUX_WAYLAND_DYN_H
|
||||||
|
|
||||||
#include "../test.h"
|
#include <fennec/platform/interface/platform.h>
|
||||||
|
|
||||||
#include "./lang/test_strings.h"
|
namespace fennec
|
||||||
#include "./lang/test_io.h"
|
|
||||||
#include "lang/test_format.h"
|
|
||||||
|
|
||||||
namespace fennec::test
|
|
||||||
{
|
{
|
||||||
|
|
||||||
inline void fennec_test_langproc() {
|
namespace libwayland
|
||||||
fennec_test_header("strings");
|
{
|
||||||
fennec_test_spacer(2);
|
|
||||||
fennec_test_langproc_strings();
|
|
||||||
fennec_test_spacer(3);
|
|
||||||
|
|
||||||
fennec_test_header("format");
|
bool load_symbols(platform* platform);
|
||||||
fennec_test_spacer(2);
|
void unload_symbols(platform* platform);
|
||||||
fennec_test_langproc_format();
|
|
||||||
fennec_test_spacer(3);
|
|
||||||
|
|
||||||
fennec_test_header("io");
|
|
||||||
fennec_test_spacer(2);
|
|
||||||
fennec_test_langproc_io();
|
|
||||||
fennec_test_spacer(3);
|
|
||||||
|
|
||||||
// TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // FENNEC_TEST_LANGPROC_H
|
}
|
||||||
|
|
||||||
|
#endif // FENNEC_PLATFORM_LINUX_WAYLAND_DYN_H
|
||||||
3299
include/fennec/platform/linux/wayland/lib/protocols/wayland.xml
Normal file
3299
include/fennec/platform/linux/wayland/lib/protocols/wayland.xml
Normal file
File diff suppressed because it is too large
Load Diff
1415
include/fennec/platform/linux/wayland/lib/protocols/xdg-shell.xml
Normal file
1415
include/fennec/platform/linux/wayland/lib/protocols/xdg-shell.xml
Normal file
File diff suppressed because it is too large
Load Diff
114
include/fennec/platform/linux/wayland/lib/sym.h
Normal file
114
include/fennec/platform/linux/wayland/lib/sym.h
Normal file
@@ -0,0 +1,114 @@
|
|||||||
|
// =====================================================================================================================
|
||||||
|
// fennec, a free and open source game engine
|
||||||
|
// Copyright © 2025 Medusa Slockbower
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
// =====================================================================================================================
|
||||||
|
|
||||||
|
#include <fennec/lang/types.h>
|
||||||
|
|
||||||
|
#ifndef FENNEC_LIB
|
||||||
|
#define FENNEC_LIB(...)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef FENNEC_SYMBOL
|
||||||
|
#define FENNEC_SYMBOL(...)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef FENNEC_GLOBAL
|
||||||
|
#define FENNEC_GLOBAL(...)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
FENNEC_LIB(WAYLAND);
|
||||||
|
|
||||||
|
FENNEC_SYMBOL(void, wl_proxy_marshal, struct wl_proxy*, uint32_t, ...);
|
||||||
|
FENNEC_SYMBOL(struct wl_proxy*, wl_proxy_marshal_flags, struct wl_proxy*, uint32_t, const struct wl_interface*, uint32_t, uint32_t, ...);
|
||||||
|
FENNEC_SYMBOL(struct wl_proxy*, wl_proxy_create, struct wl_proxy*, const struct wl_interface*);
|
||||||
|
FENNEC_SYMBOL(void, wl_proxy_destroy, struct wl_proxy*);
|
||||||
|
FENNEC_SYMBOL(int, wl_proxy_add_listener, struct wl_proxy*, void (**)(void), void*);
|
||||||
|
FENNEC_SYMBOL(void, wl_proxy_set_user_data, struct wl_proxy*, void*);
|
||||||
|
FENNEC_SYMBOL(void*, wl_proxy_get_user_data, struct wl_proxy*);
|
||||||
|
FENNEC_SYMBOL(uint32_t, wl_proxy_get_version, struct wl_proxy*);
|
||||||
|
FENNEC_SYMBOL(uint32_t, wl_proxy_get_id, struct wl_proxy*);
|
||||||
|
FENNEC_SYMBOL(const char*, wl_proxy_get_class, struct wl_proxy*);
|
||||||
|
FENNEC_SYMBOL(void, wl_proxy_set_queue, struct wl_proxy*, struct wl_event_queue*);
|
||||||
|
FENNEC_SYMBOL(void*, wl_proxy_create_wrapper, void*);
|
||||||
|
FENNEC_SYMBOL(void, wl_proxy_wrapper_destroy, void*);
|
||||||
|
FENNEC_SYMBOL(struct wl_proxy*, wl_proxy_marshal_constructor, struct wl_proxy*, uint32_t, const struct wl_interface*, ...);
|
||||||
|
FENNEC_SYMBOL(struct wl_proxy*, wl_proxy_marshal_constructor_versioned, struct wl_proxy*, uint32_t, const struct wl_interface*, uint32_t, ...);
|
||||||
|
FENNEC_SYMBOL(void, wl_proxy_set_tag, struct wl_proxy*, const char* const*);
|
||||||
|
FENNEC_SYMBOL(const char* const*, wl_proxy_get_tag, struct wl_proxy*);
|
||||||
|
|
||||||
|
FENNEC_SYMBOL(struct wl_display*, wl_display_connect, const char*);
|
||||||
|
FENNEC_SYMBOL(struct wl_display*, wl_display_connect_to_fd, int);
|
||||||
|
FENNEC_SYMBOL(void, wl_display_disconnect, struct wl_display*);
|
||||||
|
FENNEC_SYMBOL(int, wl_display_get_fd, struct wl_display*);
|
||||||
|
FENNEC_SYMBOL(int, wl_display_dispatch, struct wl_display*);
|
||||||
|
FENNEC_SYMBOL(int, wl_display_dispatch_queue, struct wl_display*, struct wl_event_queue*);
|
||||||
|
FENNEC_SYMBOL(int, wl_display_dispatch_queue_pending, struct wl_display*, struct wl_event_queue*);
|
||||||
|
FENNEC_SYMBOL(int, wl_display_dispatch_pending, struct wl_display*);
|
||||||
|
FENNEC_SYMBOL(int, wl_display_prepare_read, struct wl_display*);
|
||||||
|
FENNEC_SYMBOL(int, wl_display_prepare_read_queue, struct wl_display*, struct wl_event_queue*);
|
||||||
|
FENNEC_SYMBOL(int, wl_display_read_events, struct wl_display*);
|
||||||
|
FENNEC_SYMBOL(void, wl_display_cancel_read, struct wl_display*);
|
||||||
|
FENNEC_SYMBOL(int, wl_display_get_error, struct wl_display*);
|
||||||
|
FENNEC_SYMBOL(int, wl_display_flush, struct wl_display*);
|
||||||
|
FENNEC_SYMBOL(int, wl_display_roundtrip, struct wl_display*);
|
||||||
|
FENNEC_SYMBOL(struct wl_event_queue*, wl_display_create_queue, struct wl_display*);
|
||||||
|
|
||||||
|
FENNEC_SYMBOL(void, wl_event_queue_destroy, struct wl_event_queue*);
|
||||||
|
FENNEC_SYMBOL(void, wl_log_set_handler_client, wl_log_func_t);
|
||||||
|
FENNEC_SYMBOL(void, wl_list_init, struct wl_list*);
|
||||||
|
FENNEC_SYMBOL(void, wl_list_insert, struct wl_list*, struct wl_list*) ;
|
||||||
|
FENNEC_SYMBOL(void, wl_list_remove, struct wl_list*);
|
||||||
|
FENNEC_SYMBOL(int, wl_list_length, const struct wl_list*);
|
||||||
|
FENNEC_SYMBOL(int, wl_list_empty, const struct wl_list*);
|
||||||
|
FENNEC_SYMBOL(void, wl_list_insert_list, struct wl_list*, struct wl_list*);
|
||||||
|
|
||||||
|
FENNEC_GLOBAL(const struct wl_interface, wl_display_interface);
|
||||||
|
FENNEC_GLOBAL(const struct wl_interface, wl_registry_interface);
|
||||||
|
FENNEC_GLOBAL(const struct wl_interface, wl_callback_interface);
|
||||||
|
FENNEC_GLOBAL(const struct wl_interface, wl_compositor_interface);
|
||||||
|
FENNEC_GLOBAL(const struct wl_interface, wl_shm_pool_interface);
|
||||||
|
FENNEC_GLOBAL(const struct wl_interface, wl_shm_interface);
|
||||||
|
FENNEC_GLOBAL(const struct wl_interface, wl_buffer_interface);
|
||||||
|
FENNEC_GLOBAL(const struct wl_interface, wl_data_offer_interface);
|
||||||
|
FENNEC_GLOBAL(const struct wl_interface, wl_data_source_interface);
|
||||||
|
FENNEC_GLOBAL(const struct wl_interface, wl_data_device_interface);
|
||||||
|
FENNEC_GLOBAL(const struct wl_interface, wl_data_device_manager_interface);
|
||||||
|
FENNEC_GLOBAL(const struct wl_interface, wl_shell_interface);
|
||||||
|
FENNEC_GLOBAL(const struct wl_interface, wl_shell_surface_interface);
|
||||||
|
FENNEC_GLOBAL(const struct wl_interface, wl_surface_interface);
|
||||||
|
FENNEC_GLOBAL(const struct wl_interface, wl_seat_interface);
|
||||||
|
FENNEC_GLOBAL(const struct wl_interface, wl_pointer_interface);
|
||||||
|
FENNEC_GLOBAL(const struct wl_interface, wl_keyboard_interface);
|
||||||
|
FENNEC_GLOBAL(const struct wl_interface, wl_touch_interface);
|
||||||
|
FENNEC_GLOBAL(const struct wl_interface, wl_output_interface);
|
||||||
|
FENNEC_GLOBAL(const struct wl_interface, wl_region_interface);
|
||||||
|
FENNEC_GLOBAL(const struct wl_interface, wl_subcompositor_interface);
|
||||||
|
FENNEC_GLOBAL(const struct wl_interface, wl_subsurface_interface);
|
||||||
|
|
||||||
|
FENNEC_LIB(WAYLAND_EGL);
|
||||||
|
|
||||||
|
FENNEC_SYMBOL(struct wl_egl_window*, wl_egl_window_create, struct wl_surface *surface, int width, int height);
|
||||||
|
FENNEC_SYMBOL(void, wl_egl_window_destroy, struct wl_egl_window *egl_window);
|
||||||
|
FENNEC_SYMBOL(void, wl_egl_window_resize, struct wl_egl_window *egl_window, int width, int height, int dx, int dy);
|
||||||
|
FENNEC_SYMBOL(void, wl_egl_window_get_attached_size, struct wl_egl_window *egl_window, int *width, int *height);
|
||||||
|
|
||||||
|
#undef FENNEC_LIB
|
||||||
|
#undef FENNEC_SYMBOL
|
||||||
|
#undef FENNEC_GLOBAL
|
||||||
|
|
||||||
|
|
||||||
98
include/fennec/platform/linux/wayland/lib/wayland.h
Normal file
98
include/fennec/platform/linux/wayland/lib/wayland.h
Normal file
@@ -0,0 +1,98 @@
|
|||||||
|
// =====================================================================================================================
|
||||||
|
// fennec, a free and open source game engine
|
||||||
|
// Copyright © 2025 Medusa Slockbower
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
// =====================================================================================================================
|
||||||
|
|
||||||
|
#ifndef FENNEC_PLATFORM_LINUX_WAYLAND_LIB_WAYLAND_CLIENT_H
|
||||||
|
#define FENNEC_PLATFORM_LINUX_WAYLAND_LIB_WAYLAND_CLIENT_H
|
||||||
|
|
||||||
|
#include <wayland-client-core.h>
|
||||||
|
|
||||||
|
#define FENNEC_LIB(name) extern "C" bool FENNEC_HAS_LIB_##name;
|
||||||
|
#define FENNEC_SYMBOL(ret, fn, ...) using WAYLAND_sym_##fn = ret(*)(__VA_ARGS__); \
|
||||||
|
extern "C" WAYLAND_sym_##fn WAYLAND_##fn;
|
||||||
|
#define FENNEC_GLOBAL(type, name) extern "C" type* WAYLAND_##name;
|
||||||
|
#include <fennec/platform/linux/wayland/lib/sym.h>
|
||||||
|
|
||||||
|
#define wl_proxy_marshal WAYLAND_wl_proxy_marshal
|
||||||
|
#define wl_proxy_marshal_flags WAYLAND_wl_proxy_marshal_flags
|
||||||
|
#define wl_proxy_create WAYLAND_wl_proxy_create
|
||||||
|
#define wl_proxy_destroy WAYLAND_wl_proxy_destroy
|
||||||
|
#define wl_proxy_add_listener WAYLAND_wl_proxy_add_listener
|
||||||
|
#define wl_proxy_set_user_data WAYLAND_wl_proxy_set_user_data
|
||||||
|
#define wl_proxy_get_user_data WAYLAND_wl_proxy_get_user_data
|
||||||
|
#define wl_proxy_get_version WAYLAND_wl_proxy_get_version
|
||||||
|
#define wl_proxy_get_id WAYLAND_wl_proxy_get_id
|
||||||
|
#define wl_proxy_get_class WAYLAND_wl_proxy_get_class
|
||||||
|
#define wl_proxy_set_queue WAYLAND_wl_proxy_set_queue
|
||||||
|
#define wl_proxy_create_wrapper WAYLAND_wl_proxy_create_wrapper
|
||||||
|
#define wl_proxy_wrapper_destroy WAYLAND_wl_proxy_wrapper_destroy
|
||||||
|
#define wl_proxy_marshal_constructor WAYLAND_wl_proxy_marshal_constructor
|
||||||
|
#define wl_proxy_marshal_constructor_versioned WAYLAND_wl_proxy_marshal_constructor_versioned
|
||||||
|
#define wl_proxy_set_tag WAYLAND_wl_proxy_set_tag
|
||||||
|
#define wl_proxy_get_tag WAYLAND_wl_proxy_get_tag
|
||||||
|
|
||||||
|
#define wl_event_queue_destroy WAYLAND_wl_event_queue_destroy
|
||||||
|
#define wl_log_set_handler_client WAYLAND_wl_log_set_handler_client
|
||||||
|
#define wl_list_init WAYLAND_wl_list_init
|
||||||
|
#define wl_list_insert WAYLAND_wl_list_insert
|
||||||
|
#define wl_list_remove WAYLAND_wl_list_remove
|
||||||
|
#define wl_list_length WAYLAND_wl_list_length
|
||||||
|
#define wl_list_empty WAYLAND_wl_list_empty
|
||||||
|
#define wl_list_insert_list WAYLAND_wl_list_insert_list
|
||||||
|
|
||||||
|
#define wl_display_connect WAYLAND_wl_display_connect
|
||||||
|
#define wl_display_connect_to_fd WAYLAND_wl_display_connect_to_fd
|
||||||
|
#define wl_display_reconnect WAYLAND_wl_display_reconnect
|
||||||
|
#define wl_display_disconnect WAYLAND_wl_display_disconnect
|
||||||
|
#define wl_display_get_fd WAYLAND_wl_display_get_fd
|
||||||
|
#define wl_display_dispatch WAYLAND_wl_display_dispatch
|
||||||
|
#define wl_display_dispatch_queue WAYLAND_wl_display_dispatch_queue
|
||||||
|
#define wl_display_dispatch_queue_pending WAYLAND_wl_display_dispatch_queue_pending
|
||||||
|
#define wl_display_dispatch_pending WAYLAND_wl_display_dispatch_pending
|
||||||
|
#define wl_display_prepare_read WAYLAND_wl_display_prepare_read
|
||||||
|
#define wl_display_prepare_read_queue WAYLAND_wl_display_prepare_read_queue
|
||||||
|
#define wl_display_read_events WAYLAND_wl_display_read_events
|
||||||
|
#define wl_display_cancel_read WAYLAND_wl_display_cancel_read
|
||||||
|
#define wl_display_get_error WAYLAND_wl_display_get_error
|
||||||
|
#define wl_display_flush WAYLAND_wl_display_flush
|
||||||
|
#define wl_display_roundtrip WAYLAND_wl_display_roundtrip
|
||||||
|
#define wl_display_create_queue WAYLAND_wl_display_create_queue
|
||||||
|
|
||||||
|
#define wl_seat_interface *WAYLAND_wl_seat_interface
|
||||||
|
#define wl_surface_interface *WAYLAND_wl_surface_interface
|
||||||
|
#define wl_shm_pool_interface *WAYLAND_wl_shm_pool_interface
|
||||||
|
#define wl_buffer_interface *WAYLAND_wl_buffer_interface
|
||||||
|
#define wl_registry_interface *WAYLAND_wl_registry_interface
|
||||||
|
#define wl_region_interface *WAYLAND_wl_region_interface
|
||||||
|
#define wl_pointer_interface *WAYLAND_wl_pointer_interface
|
||||||
|
#define wl_keyboard_interface *WAYLAND_wl_keyboard_interface
|
||||||
|
#define wl_compositor_interface *WAYLAND_wl_compositor_interface
|
||||||
|
#define wl_output_interface *WAYLAND_wl_output_interface
|
||||||
|
#define wl_shm_interface *WAYLAND_wl_shm_interface
|
||||||
|
#define wl_data_device_interface *WAYLAND_wl_data_device_interface
|
||||||
|
#define wl_data_offer_interface *WAYLAND_wl_data_offer_interface
|
||||||
|
#define wl_data_source_interface *WAYLAND_wl_data_source_interface
|
||||||
|
#define wl_data_device_manager_interface *WAYLAND_wl_data_device_manager_interface
|
||||||
|
|
||||||
|
#define wl_egl_window_create WAYLAND_wl_egl_window_create
|
||||||
|
#define wl_egl_window_destroy WAYLAND_wl_egl_window_destroy
|
||||||
|
#define wl_egl_window_resize WAYLAND_wl_egl_window_resize
|
||||||
|
#define wl_egl_window_get_attached_size WAYLAND_wl_egl_window_get_attached_size
|
||||||
|
|
||||||
|
#include <fennec/platform/linux/wayland/lib/headers/wayland-client-protocols.h>
|
||||||
|
|
||||||
|
#endif // FENNEC_PLATFORM_LINUX_WAYLAND_LIB_WAYLAND_CLIENT_H
|
||||||
37
include/fennec/platform/linux/xkb/lib/loader.h
Normal file
37
include/fennec/platform/linux/xkb/lib/loader.h
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
// =====================================================================================================================
|
||||||
|
// fennec, a free and open source game engine
|
||||||
|
// Copyright © 2025 Medusa Slockbower
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
// =====================================================================================================================
|
||||||
|
|
||||||
|
#ifndef FENNEC_PLATFORM_LINUX_XKB_DYN_H
|
||||||
|
#define FENNEC_PLATFORM_LINUX_XKB_DYN_H
|
||||||
|
|
||||||
|
#include <fennec/platform/interface/platform.h>
|
||||||
|
|
||||||
|
namespace fennec
|
||||||
|
{
|
||||||
|
|
||||||
|
namespace libxkbcommon
|
||||||
|
{
|
||||||
|
|
||||||
|
bool load_symbols(platform* platform);
|
||||||
|
void unload_symbols(platform* platform);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // FENNEC_PLATFORM_LINUX_XKB_DYN_H
|
||||||
117
include/fennec/platform/linux/xkb/lib/sym.h
Normal file
117
include/fennec/platform/linux/xkb/lib/sym.h
Normal file
@@ -0,0 +1,117 @@
|
|||||||
|
// =====================================================================================================================
|
||||||
|
// fennec, a free and open source game engine
|
||||||
|
// Copyright © 2025 Medusa Slockbower
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
// =====================================================================================================================
|
||||||
|
|
||||||
|
#include <fennec/lang/types.h>
|
||||||
|
|
||||||
|
#ifndef FENNEC_LIB
|
||||||
|
#define FENNEC_LIB(...)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef FENNEC_SYMBOL
|
||||||
|
#define FENNEC_SYMBOL(...)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef FENNEC_GLOBAL
|
||||||
|
#define FENNEC_GLOBAL(...)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
FENNEC_LIB(XKB);
|
||||||
|
|
||||||
|
FENNEC_SYMBOL(int, xkb_keysym_get_name, xkb_keysym_t, char*, size_t);
|
||||||
|
FENNEC_SYMBOL(xkb_keysym_t, xkb_keysym_from_name, const char*, enum xkb_keysym_flags);
|
||||||
|
FENNEC_SYMBOL(int, xkb_keysym_to_utf8, xkb_keysym_t, char*, size_t);
|
||||||
|
FENNEC_SYMBOL(uint32_t, xkb_keysym_to_utf32, xkb_keysym_t);
|
||||||
|
FENNEC_SYMBOL(xkb_keysym_t, xkb_utf32_to_keysym, uint32_t);
|
||||||
|
FENNEC_SYMBOL(xkb_keysym_t, xkb_keysym_to_upper, xkb_keysym_t);
|
||||||
|
FENNEC_SYMBOL(xkb_keysym_t, xkb_keysym_to_lower, xkb_keysym_t);
|
||||||
|
|
||||||
|
FENNEC_SYMBOL(struct xkb_context*, xkb_context_new, enum xkb_context_flags);
|
||||||
|
FENNEC_SYMBOL(struct xkb_context*, xkb_context_ref, struct xkb_context*);
|
||||||
|
FENNEC_SYMBOL(void, xkb_context_unref, struct xkb_context*);
|
||||||
|
FENNEC_SYMBOL(void, xkb_context_set_user_data, struct xkb_context*, void*);
|
||||||
|
FENNEC_SYMBOL(void*, xkb_context_get_user_data, struct xkb_context*);
|
||||||
|
FENNEC_SYMBOL(int, xkb_context_include_path_append, struct xkb_context*, const char*);
|
||||||
|
FENNEC_SYMBOL(int, xkb_context_include_path_append_default, struct xkb_context*);
|
||||||
|
FENNEC_SYMBOL(int, xkb_context_include_path_reset_defaults, struct xkb_context*);
|
||||||
|
FENNEC_SYMBOL(void, xkb_context_include_path_clear, struct xkb_context*);
|
||||||
|
FENNEC_SYMBOL(unsigned int, xkb_context_num_include_paths, struct xkb_context*);
|
||||||
|
FENNEC_SYMBOL(const char*, xkb_context_include_path_get, struct xkb_context*, unsigned int);
|
||||||
|
FENNEC_SYMBOL(void, xkb_context_set_log_level, struct xkb_context*, enum xkb_log_level);
|
||||||
|
FENNEC_SYMBOL(enum xkb_log_level, xkb_context_get_log_level, struct xkb_context*);
|
||||||
|
FENNEC_SYMBOL(void, xkb_context_set_log_verbosity, struct xkb_context*, int);
|
||||||
|
FENNEC_SYMBOL(int, xkb_context_get_log_verbosity, struct xkb_context*);
|
||||||
|
FENNEC_SYMBOL(void, xkb_context_set_log_fn, struct xkb_context*, void (*)(struct xkb_context*, enum xkb_log_level, const char*, va_list));
|
||||||
|
|
||||||
|
FENNEC_SYMBOL(struct xkb_keymap*, xkb_keymap_new_from_names, struct xkb_context*, const struct xkb_rule_names*, enum xkb_keymap_compile_flags);
|
||||||
|
FENNEC_SYMBOL(struct xkb_keymap*, xkb_keymap_new_from_file, struct xkb_context*, FILE*, enum xkb_keymap_format, enum xkb_keymap_compile_flags);
|
||||||
|
FENNEC_SYMBOL(struct xkb_keymap*, xkb_keymap_new_from_string, struct xkb_context*, const char*, enum xkb_keymap_format, enum xkb_keymap_compile_flags);
|
||||||
|
FENNEC_SYMBOL(struct xkb_keymap*, xkb_keymap_new_from_buffer, struct xkb_context*, const char*, size_t, enum xkb_keymap_format, enum xkb_keymap_compile_flags);
|
||||||
|
FENNEC_SYMBOL(struct xkb_keymap*, xkb_keymap_ref, struct xkb_keymap*);
|
||||||
|
FENNEC_SYMBOL(void, xkb_keymap_unref, struct xkb_keymap*);
|
||||||
|
FENNEC_SYMBOL(char*, xkb_keymap_get_as_string, struct xkb_keymap*, enum xkb_keymap_format);
|
||||||
|
FENNEC_SYMBOL(xkb_keycode_t, xkb_keymap_min_keycode, struct xkb_keymap*);
|
||||||
|
FENNEC_SYMBOL(xkb_keycode_t, xkb_keymap_max_keycode, struct xkb_keymap*);
|
||||||
|
FENNEC_SYMBOL(void, xkb_keymap_key_for_each, struct xkb_keymap*, xkb_keymap_key_iter_t, void*);
|
||||||
|
FENNEC_SYMBOL(const char*, xkb_keymap_key_get_name, struct xkb_keymap*, xkb_keycode_t);
|
||||||
|
FENNEC_SYMBOL(xkb_keycode_t, xkb_keymap_key_by_name, struct xkb_keymap*, const char*);
|
||||||
|
FENNEC_SYMBOL(xkb_mod_index_t, xkb_keymap_num_mods, struct xkb_keymap*);
|
||||||
|
FENNEC_SYMBOL(const char*, xkb_keymap_mod_get_name, struct xkb_keymap*, xkb_mod_index_t);
|
||||||
|
FENNEC_SYMBOL(xkb_mod_index_t, xkb_keymap_mod_get_index, struct xkb_keymap*, const char*);
|
||||||
|
FENNEC_SYMBOL(xkb_layout_index_t, xkb_keymap_num_layouts, struct xkb_keymap*);
|
||||||
|
FENNEC_SYMBOL(const char*, xkb_keymap_layout_get_name, struct xkb_keymap*, xkb_layout_index_t);
|
||||||
|
FENNEC_SYMBOL(xkb_layout_index_t, xkb_keymap_layout_get_index, struct xkb_keymap*, const char*);
|
||||||
|
FENNEC_SYMBOL(xkb_led_index_t, xkb_keymap_num_leds, struct xkb_keymap*);
|
||||||
|
FENNEC_SYMBOL(const char*, xkb_keymap_led_get_name, struct xkb_keymap*, xkb_led_index_t);
|
||||||
|
FENNEC_SYMBOL(xkb_led_index_t, xkb_keymap_led_get_index, struct xkb_keymap*, const char*);
|
||||||
|
FENNEC_SYMBOL(xkb_layout_index_t, xkb_keymap_num_layouts_for_key, struct xkb_keymap*, xkb_keycode_t);
|
||||||
|
FENNEC_SYMBOL(xkb_level_index_t, xkb_keymap_num_levels_for_key, struct xkb_keymap*, xkb_keycode_t, xkb_layout_index_t);
|
||||||
|
FENNEC_SYMBOL(size_t, xkb_keymap_key_get_mods_for_level, struct xkb_keymap*, xkb_keycode_t, xkb_layout_index_t, xkb_level_index_t, xkb_mod_mask_t*, size_t);
|
||||||
|
FENNEC_SYMBOL(int, xkb_keymap_key_get_syms_by_level, struct xkb_keymap*, xkb_keycode_t, xkb_layout_index_t, xkb_level_index_t, const xkb_keysym_t**);
|
||||||
|
FENNEC_SYMBOL(int, xkb_keymap_key_repeats, struct xkb_keymap*, xkb_keycode_t);
|
||||||
|
|
||||||
|
FENNEC_SYMBOL(struct xkb_state*, xkb_state_new, struct xkb_keymap*);
|
||||||
|
FENNEC_SYMBOL(struct xkb_state*, xkb_state_ref, struct xkb_state*);
|
||||||
|
FENNEC_SYMBOL(void, xkb_state_unref, struct xkb_state*);
|
||||||
|
FENNEC_SYMBOL(struct xkb_keymap*, xkb_state_get_keymap, struct xkb_state*);
|
||||||
|
FENNEC_SYMBOL(enum xkb_state_component, xkb_state_update_key, struct xkb_state*, xkb_keycode_t, enum xkb_key_direction);
|
||||||
|
FENNEC_SYMBOL(enum xkb_state_component, xkb_state_update_mask, struct xkb_state*, xkb_mod_mask_t, xkb_mod_mask_t, xkb_mod_mask_t, xkb_layout_index_t, xkb_layout_index_t, xkb_layout_index_t);
|
||||||
|
FENNEC_SYMBOL(int, xkb_state_key_get_syms, struct xkb_state*, xkb_keycode_t, const xkb_keysym_t**);
|
||||||
|
FENNEC_SYMBOL(int, xkb_state_key_get_utf8, struct xkb_state*, xkb_keycode_t, char*, size_t);
|
||||||
|
FENNEC_SYMBOL(uint32_t, xkb_state_key_get_utf32, struct xkb_state*, xkb_keycode_t);
|
||||||
|
FENNEC_SYMBOL(xkb_keysym_t, xkb_state_key_get_one_sym, struct xkb_state*, xkb_keycode_t);
|
||||||
|
FENNEC_SYMBOL(xkb_layout_index_t, xkb_state_key_get_layout, struct xkb_state*, xkb_keycode_t);
|
||||||
|
FENNEC_SYMBOL(xkb_level_index_t, xkb_state_key_get_level, struct xkb_state*, xkb_keycode_t, xkb_layout_index_t);
|
||||||
|
FENNEC_SYMBOL(xkb_mod_mask_t, xkb_state_serialize_mods, struct xkb_state*, enum xkb_state_component);
|
||||||
|
FENNEC_SYMBOL(xkb_layout_index_t, xkb_state_serialize_layout, struct xkb_state*, enum xkb_state_component);
|
||||||
|
FENNEC_SYMBOL(int, xkb_state_mod_name_is_active, struct xkb_state*, const char*, enum xkb_state_component);
|
||||||
|
FENNEC_SYMBOL(int, xkb_state_mod_names_are_active, struct xkb_state*, enum xkb_state_component, enum xkb_state_match, ...);
|
||||||
|
FENNEC_SYMBOL(int, xkb_state_mod_index_is_active, struct xkb_state*, xkb_mod_index_t, enum xkb_state_component);
|
||||||
|
FENNEC_SYMBOL(int, xkb_state_mod_indices_are_active, struct xkb_state*, enum xkb_state_component, enum xkb_state_match, ...);
|
||||||
|
FENNEC_SYMBOL(xkb_mod_mask_t, xkb_state_key_get_consumed_mods2, struct xkb_state*, xkb_keycode_t, enum xkb_consumed_mode);
|
||||||
|
FENNEC_SYMBOL(xkb_mod_mask_t, xkb_state_key_get_consumed_mods, struct xkb_state*, xkb_keycode_t);
|
||||||
|
FENNEC_SYMBOL(int, xkb_state_mod_index_is_consumed2, struct xkb_state*, xkb_keycode_t, xkb_mod_index_t, enum xkb_consumed_mode);
|
||||||
|
FENNEC_SYMBOL(int, xkb_state_mod_index_is_consumed, struct xkb_state*, xkb_keycode_t, xkb_mod_index_t);
|
||||||
|
FENNEC_SYMBOL(xkb_mod_mask_t, xkb_state_mod_mask_remove_consumed, struct xkb_state*, xkb_keycode_t, xkb_mod_mask_t);
|
||||||
|
FENNEC_SYMBOL(int, xkb_state_layout_name_is_active, struct xkb_state*, const char*, enum xkb_state_component);
|
||||||
|
FENNEC_SYMBOL(int, xkb_state_layout_index_is_active, struct xkb_state*, xkb_layout_index_t, enum xkb_state_component);
|
||||||
|
FENNEC_SYMBOL(int, xkb_state_led_name_is_active, struct xkb_state*, const char*);
|
||||||
|
FENNEC_SYMBOL(int, xkb_state_led_index_is_active, struct xkb_state*, xkb_led_index_t);
|
||||||
|
|
||||||
|
#undef FENNEC_LIB
|
||||||
|
#undef FENNEC_SYMBOL
|
||||||
|
#undef FENNEC_GLOBAL
|
||||||
110
include/fennec/platform/linux/xkb/lib/xkb.h
Normal file
110
include/fennec/platform/linux/xkb/lib/xkb.h
Normal file
@@ -0,0 +1,110 @@
|
|||||||
|
// =====================================================================================================================
|
||||||
|
// fennec, a free and open source game engine
|
||||||
|
// Copyright © 2025 Medusa Slockbower
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
// =====================================================================================================================
|
||||||
|
|
||||||
|
#ifndef FENNEC_PLATFORM_LINUX_XKB_LIB_XKB_H
|
||||||
|
#define FENNEC_PLATFORM_LINUX_XKB_LIB_XKB_H
|
||||||
|
|
||||||
|
#include <xkbcommon/xkbcommon.h>
|
||||||
|
|
||||||
|
#define FENNEC_LIB(name) extern bool FENNEC_HAS_LIB_##name;
|
||||||
|
#define FENNEC_SYMBOL(ret, fn, ...) using XKB_sym_##fn = ret(*)(__VA_ARGS__); \
|
||||||
|
extern XKB_sym_##fn XKB_##fn;
|
||||||
|
#define FENNEC_GLOBAL(type, name) extern type* XKB_##name;
|
||||||
|
#include <fennec/platform/linux/xkb/lib/sym.h>
|
||||||
|
|
||||||
|
#define xkb_keysym_get_name XKB_xkb_keysym_get_name
|
||||||
|
#define xkb_keysym_from_name XKB_xkb_keysym_from_name
|
||||||
|
#define xkb_keysym_to_utf8 XKB_xkb_keysym_to_utf8
|
||||||
|
#define xkb_keysym_to_utf32 XKB_xkb_keysym_to_utf32
|
||||||
|
#define xkb_utf32_to_keysym XKB_xkb_utf32_to_keysym
|
||||||
|
#define xkb_keysym_to_upper XKB_xkb_keysym_to_upper
|
||||||
|
#define xkb_keysym_to_lower XKB_xkb_keysym_to_lower
|
||||||
|
|
||||||
|
#define xkb_context_new XKB_xkb_context_new
|
||||||
|
#define xkb_context_ref XKB_xkb_context_ref
|
||||||
|
#define xkb_context_unref XKB_xkb_context_unref
|
||||||
|
#define xkb_context_set_user_data XKB_xkb_context_set_user_data
|
||||||
|
#define xkb_context_get_user_data XKB_xkb_context_get_user_data
|
||||||
|
#define xkb_context_include_path_append XKB_xkb_context_include_path_append
|
||||||
|
#define xkb_context_include_path_append_default XKB_xkb_context_include_path_append_default
|
||||||
|
#define xkb_context_include_path_reset_defaults XKB_xkb_context_include_path_reset_defaults
|
||||||
|
#define xkb_context_include_path_clear XKB_xkb_context_include_path_clear
|
||||||
|
#define xkb_context_num_include_paths XKB_xkb_context_num_include_paths
|
||||||
|
#define xkb_context_include_path_get XKB_xkb_context_include_path_get
|
||||||
|
#define xkb_context_set_log_level XKB_xkb_context_set_log_level
|
||||||
|
#define xkb_context_get_log_level XKB_xkb_context_get_log_level
|
||||||
|
#define xkb_context_set_log_verbosity XKB_xkb_context_set_log_verbosity
|
||||||
|
#define xkb_context_get_log_verbosity XKB_xkb_context_get_log_verbosity
|
||||||
|
#define xkb_context_set_log_fn XKB_xkb_context_set_log_fn
|
||||||
|
|
||||||
|
#define xkb_keymap_new_from_names XKB_xkb_keymap_new_from_names
|
||||||
|
#define xkb_keymap_new_from_file XKB_xkb_keymap_new_from_file
|
||||||
|
#define xkb_keymap_new_from_string XKB_xkb_keymap_new_from_string
|
||||||
|
#define xkb_keymap_new_from_buffer XKB_xkb_keymap_new_from_buffer
|
||||||
|
#define xkb_keymap_ref XKB_xkb_keymap_ref
|
||||||
|
#define xkb_keymap_unref XKB_xkb_keymap_unref
|
||||||
|
#define xkb_keymap_get_as_string XKB_xkb_keymap_get_as_string
|
||||||
|
#define xkb_keymap_min_keycode XKB_xkb_keymap_min_keycode
|
||||||
|
#define xkb_keymap_max_keycode XKB_xkb_keymap_max_keycode
|
||||||
|
#define xkb_keymap_key_for_each XKB_xkb_keymap_key_for_each
|
||||||
|
#define xkb_keymap_key_get_name XKB_xkb_keymap_key_get_name
|
||||||
|
#define xkb_keymap_key_by_name XKB_xkb_keymap_key_by_name
|
||||||
|
#define xkb_keymap_num_mods XKB_xkb_keymap_num_mods
|
||||||
|
#define xkb_keymap_mod_get_name XKB_xkb_keymap_mod_get_name
|
||||||
|
#define xkb_keymap_mod_get_index XKB_xkb_keymap_mod_get_index
|
||||||
|
#define xkb_keymap_num_layouts XKB_xkb_keymap_num_layouts
|
||||||
|
#define xkb_keymap_layout_get_name XKB_xkb_keymap_layout_get_name
|
||||||
|
#define xkb_keymap_layout_get_index XKB_xkb_keymap_layout_get_index
|
||||||
|
#define xkb_keymap_num_leds XKB_xkb_keymap_num_leds
|
||||||
|
#define xkb_keymap_led_get_name XKB_xkb_keymap_led_get_name
|
||||||
|
#define xkb_keymap_led_get_index XKB_xkb_keymap_led_get_index
|
||||||
|
#define xkb_keymap_num_layouts_for_key XKB_xkb_keymap_num_layouts_for_key
|
||||||
|
#define xkb_keymap_num_levels_for_key XKB_xkb_keymap_num_levels_for_key
|
||||||
|
#define xkb_keymap_key_get_mods_for_level XKB_xkb_keymap_key_get_mods_for_level
|
||||||
|
#define xkb_keymap_key_get_syms_by_level XKB_xkb_keymap_key_get_syms_by_level
|
||||||
|
#define xkb_keymap_key_repeats XKB_xkb_keymap_key_repeats
|
||||||
|
|
||||||
|
#define xkb_state_new XKB_xkb_state_new
|
||||||
|
#define xkb_state_ref XKB_xkb_state_ref
|
||||||
|
#define xkb_state_unref XKB_xkb_state_unref
|
||||||
|
#define xkb_state_get_keymap XKB_xkb_state_get_keymap
|
||||||
|
#define xkb_state_update_key XKB_xkb_state_update_key
|
||||||
|
#define xkb_state_update_mask XKB_xkb_state_update_mask
|
||||||
|
#define xkb_state_key_get_syms XKB_xkb_state_key_get_syms
|
||||||
|
#define xkb_state_key_get_utf8 XKB_xkb_state_key_get_utf8
|
||||||
|
#define xkb_state_key_get_utf32 XKB_xkb_state_key_get_utf32
|
||||||
|
#define xkb_state_key_get_one_sym XKB_xkb_state_key_get_one_sym
|
||||||
|
#define xkb_state_key_get_layout XKB_xkb_state_key_get_layout
|
||||||
|
#define xkb_state_key_get_level XKB_xkb_state_key_get_level
|
||||||
|
#define xkb_state_serialize_mods XKB_xkb_state_serialize_mods
|
||||||
|
#define xkb_state_serialize_layout XKB_xkb_state_serialize_layout
|
||||||
|
#define xkb_state_mod_name_is_active XKB_xkb_state_mod_name_is_active
|
||||||
|
#define xkb_state_mod_names_are_active XKB_xkb_state_mod_names_are_active
|
||||||
|
#define xkb_state_mod_index_is_active XKB_xkb_state_mod_index_is_active
|
||||||
|
#define xkb_state_mod_indices_are_active XKB_xkb_state_mod_indices_are_active
|
||||||
|
#define xkb_state_key_get_consumed_mods2 XKB_xkb_state_key_get_consumed_mods2
|
||||||
|
#define xkb_state_key_get_consumed_mods XKB_xkb_state_key_get_consumed_mods
|
||||||
|
#define xkb_state_mod_index_is_consumed2 XKB_xkb_state_mod_index_is_consumed2
|
||||||
|
#define xkb_state_mod_index_is_consumed XKB_xkb_state_mod_index_is_consumed
|
||||||
|
#define xkb_state_mod_mask_remove_consumed XKB_xkb_state_mod_mask_remove_consumed
|
||||||
|
#define xkb_state_layout_name_is_active XKB_xkb_state_layout_name_is_active
|
||||||
|
#define xkb_state_layout_index_is_active XKB_xkb_state_layout_index_is_active
|
||||||
|
#define xkb_state_led_name_is_active XKB_xkb_state_led_name_is_active
|
||||||
|
#define xkb_state_led_index_is_active XKB_xkb_state_led_index_is_active
|
||||||
|
|
||||||
|
#endif // FENNEC_PLATFORM_LINUX_XKB_LIB_XKB_H
|
||||||
@@ -31,8 +31,8 @@
|
|||||||
#ifndef FENNEC_RENDERERS_INTERFACE_GFXCONTEXT_H
|
#ifndef FENNEC_RENDERERS_INTERFACE_GFXCONTEXT_H
|
||||||
#define FENNEC_RENDERERS_INTERFACE_GFXCONTEXT_H
|
#define FENNEC_RENDERERS_INTERFACE_GFXCONTEXT_H
|
||||||
|
|
||||||
#include <fennec/langcpp/types.h>
|
#include <fennec/lang/types.h>
|
||||||
#include <fennec/lang/strings/string.h>
|
#include <fennec/string/string.h>
|
||||||
#include <fennec/renderers/interface/forward.h>
|
#include <fennec/renderers/interface/forward.h>
|
||||||
#include <fennec/renderers/interface/gfxresourcepool.h>
|
#include <fennec/renderers/interface/gfxresourcepool.h>
|
||||||
|
|
||||||
|
|||||||
@@ -31,8 +31,8 @@
|
|||||||
#ifndef FENNEC_PLATFORM_INTERFACE_GFXCONTEXT_H
|
#ifndef FENNEC_PLATFORM_INTERFACE_GFXCONTEXT_H
|
||||||
#define FENNEC_PLATFORM_INTERFACE_GFXCONTEXT_H
|
#define FENNEC_PLATFORM_INTERFACE_GFXCONTEXT_H
|
||||||
|
|
||||||
#include <fennec/langcpp/types.h>
|
#include <fennec/lang/types.h>
|
||||||
#include <fennec/lang/strings/string.h>
|
#include <fennec/string/string.h>
|
||||||
#include <fennec/renderers/interface/forward.h>
|
#include <fennec/renderers/interface/forward.h>
|
||||||
|
|
||||||
namespace fennec
|
namespace fennec
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
#ifndef FENNEC_RTTI_DETAIL_CONSTANTS_H
|
#ifndef FENNEC_RTTI_DETAIL_CONSTANTS_H
|
||||||
#define FENNEC_RTTI_DETAIL_CONSTANTS_H
|
#define FENNEC_RTTI_DETAIL_CONSTANTS_H
|
||||||
|
|
||||||
#include <fennec/langcpp/types.h>
|
#include <fennec/lang/types.h>
|
||||||
|
|
||||||
namespace fennec::detail
|
namespace fennec::detail
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
#ifndef FENNEC_RTTI_DETAIL_THIS_T_H
|
#ifndef FENNEC_RTTI_DETAIL_THIS_T_H
|
||||||
#define FENNEC_RTTI_DETAIL_THIS_T_H
|
#define FENNEC_RTTI_DETAIL_THIS_T_H
|
||||||
#include <fennec/langcpp/type_transforms.h>
|
#include <fennec/lang/type_transforms.h>
|
||||||
|
|
||||||
#define FENNEC_DEFINE_THIS_T \
|
#define FENNEC_DEFINE_THIS_T \
|
||||||
private: \
|
private: \
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
#ifndef FENNEC_RTTI_DETAIL_TYPE_NAME_H
|
#ifndef FENNEC_RTTI_DETAIL_TYPE_NAME_H
|
||||||
#define FENNEC_RTTI_DETAIL_TYPE_NAME_H
|
#define FENNEC_RTTI_DETAIL_TYPE_NAME_H
|
||||||
|
|
||||||
#include <fennec/lang/strings/string.h>
|
#include <fennec/string/string.h>
|
||||||
#include <fennec/rtti/detail/_constants.h>
|
#include <fennec/rtti/detail/_constants.h>
|
||||||
|
|
||||||
namespace fennec::detail
|
namespace fennec::detail
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
#ifndef FENNEC_LANG_DETAIL_TYPEUUID_H
|
#ifndef FENNEC_LANG_DETAIL_TYPEUUID_H
|
||||||
#define FENNEC_LANG_DETAIL_TYPEUUID_H
|
#define FENNEC_LANG_DETAIL_TYPEUUID_H
|
||||||
|
|
||||||
#include <fennec/langcpp/types.h>
|
#include <fennec/lang/types.h>
|
||||||
|
|
||||||
namespace fennec::detail
|
namespace fennec::detail
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
#ifndef FENNEC_RTTI_ENABLE_H
|
#ifndef FENNEC_RTTI_ENABLE_H
|
||||||
#define FENNEC_RTTI_ENABLE_H
|
#define FENNEC_RTTI_ENABLE_H
|
||||||
|
|
||||||
#include <fennec/langcpp/static_constructor.h>
|
#include <fennec/lang/static_constructor.h>
|
||||||
|
|
||||||
#include <fennec/rtti/type.h>
|
#include <fennec/rtti/type.h>
|
||||||
#include <fennec/rtti/typelist.h>
|
#include <fennec/rtti/typelist.h>
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
#ifndef FENNEC_RTTI_TYPE_H
|
#ifndef FENNEC_RTTI_TYPE_H
|
||||||
#define FENNEC_RTTI_TYPE_H
|
#define FENNEC_RTTI_TYPE_H
|
||||||
|
|
||||||
#include <fennec/langcpp/types.h>
|
#include <fennec/lang/types.h>
|
||||||
#include <fennec/rtti/type_data.h>
|
#include <fennec/rtti/type_data.h>
|
||||||
|
|
||||||
namespace fennec
|
namespace fennec
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
|
|
||||||
#include <fennec/containers/bitfield.h>
|
#include <fennec/containers/bitfield.h>
|
||||||
#include <fennec/containers/dynarray.h>
|
#include <fennec/containers/dynarray.h>
|
||||||
#include <fennec/lang/strings/string.h>
|
#include <fennec/string/string.h>
|
||||||
#include <fennec/memory/pointers.h>
|
#include <fennec/memory/pointers.h>
|
||||||
#include <fennec/rtti/typeid.h>
|
#include <fennec/rtti/typeid.h>
|
||||||
#include <fennec/rtti/typelist.h>
|
#include <fennec/rtti/typelist.h>
|
||||||
@@ -48,17 +48,20 @@ struct type_data {
|
|||||||
property_iterable,
|
property_iterable,
|
||||||
property_indexable,
|
property_indexable,
|
||||||
property_mappable,
|
property_mappable,
|
||||||
|
|
||||||
|
property_count
|
||||||
};
|
};
|
||||||
|
|
||||||
|
using properties_t = bitfield<property_count>;
|
||||||
|
|
||||||
uint64_t uuid;
|
uint64_t uuid;
|
||||||
string name;
|
string name;
|
||||||
|
|
||||||
type_data* raw_type;
|
type_data* raw_type;
|
||||||
dynarray<type_data*> supers;
|
dynarray<type_data*> supers;
|
||||||
dynarray<type_data*> subs;
|
dynarray<type_data*> subs;
|
||||||
|
|
||||||
// TODO: Change to bitfield
|
properties_t properties;
|
||||||
bitfield<8> properties;
|
|
||||||
|
|
||||||
type_data* key_type;
|
type_data* key_type;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
#ifndef FENNEC_LANG_TYPEUUID_H
|
#ifndef FENNEC_LANG_TYPEUUID_H
|
||||||
#define FENNEC_LANG_TYPEUUID_H
|
#define FENNEC_LANG_TYPEUUID_H
|
||||||
|
|
||||||
#include <fennec/langcpp/types.h>
|
#include <fennec/lang/types.h>
|
||||||
#include <fennec/rtti/detail/_typeid.h>
|
#include <fennec/rtti/detail/_typeid.h>
|
||||||
|
|
||||||
namespace fennec
|
namespace fennec
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
#ifndef FENNEC_RTTI_TYPELIST_H
|
#ifndef FENNEC_RTTI_TYPELIST_H
|
||||||
#define FENNEC_RTTI_TYPELIST_H
|
#define FENNEC_RTTI_TYPELIST_H
|
||||||
|
|
||||||
#include <fennec/langcpp/types.h>
|
#include <fennec/lang/types.h>
|
||||||
|
|
||||||
namespace fennec
|
namespace fennec
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
#define FENNEC_CORE_SCENE_H
|
#define FENNEC_CORE_SCENE_H
|
||||||
|
|
||||||
#include <fennec/containers/rdtree.h>
|
#include <fennec/containers/rdtree.h>
|
||||||
#include <fennec/lang/strings/string.h>
|
#include <fennec/string/string.h>
|
||||||
|
|
||||||
#include <fennec/scene/forward.h>
|
#include <fennec/scene/forward.h>
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
|
|
||||||
#include <fennec/scene/component.h>
|
#include <fennec/scene/component.h>
|
||||||
|
|
||||||
#include <fennec/lang/strings/string.h>
|
#include <fennec/string/string.h>
|
||||||
|
|
||||||
#include <fennec/rtti/enable.h>
|
#include <fennec/rtti/enable.h>
|
||||||
|
|
||||||
|
|||||||
@@ -19,10 +19,10 @@
|
|||||||
#ifndef FENNEC_LANGPROC_STRINGS_CSTRING_H
|
#ifndef FENNEC_LANGPROC_STRINGS_CSTRING_H
|
||||||
#define FENNEC_LANGPROC_STRINGS_CSTRING_H
|
#define FENNEC_LANGPROC_STRINGS_CSTRING_H
|
||||||
|
|
||||||
#include <fennec/lang/strings/detail/_ctype.h>
|
#include <fennec/string/detail/_ctype.h>
|
||||||
#include <fennec/memory/detail/_string.h>
|
#include <fennec/memory/detail/_string.h>
|
||||||
|
|
||||||
#include <fennec/langcpp/assert.h>
|
#include <fennec/lang/assert.h>
|
||||||
|
|
||||||
#include <fennec/math/common.h>
|
#include <fennec/math/common.h>
|
||||||
#include <fennec/memory/bytes.h>
|
#include <fennec/memory/bytes.h>
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user