summaryrefslogtreecommitdiff
path: root/src/utils
diff options
context:
space:
mode:
author0scar <qgt268@alumni.ku.dk>2024-02-18 09:58:48 +0000
committer0scar <qgt268@alumni.ku.dk>2024-02-18 09:58:48 +0000
commitcd7f02a3dbcc20eea3f9c6043491715a417e4996 (patch)
treecdfed735a7ac7aad0d6265d5bcd905f4e55c17c3 /src/utils
parent01d731faf563c691838c990adceff66783ee79d9 (diff)
Add C++ header guard
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/include/engine/utils.h7
-rw-r--r--src/utils/include/engine/utils/btree.h7
-rw-r--r--src/utils/include/engine/utils/fov.h7
-rw-r--r--src/utils/include/engine/utils/hashmap.h7
-rw-r--r--src/utils/include/engine/utils/list.h7
-rw-r--r--src/utils/include/engine/utils/stack.h31
-rw-r--r--src/utils/include/engine/utils/vector.h8
7 files changed, 50 insertions, 24 deletions
diff --git a/src/utils/include/engine/utils.h b/src/utils/include/engine/utils.h
index d10a03a..aa1343b 100644
--- a/src/utils/include/engine/utils.h
+++ b/src/utils/include/engine/utils.h
@@ -1,6 +1,10 @@
#ifndef ENGINE_UTILS_H
#define ENGINE_UTILS_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include <engine/core/types.h>
#include <engine/utils/vector.h>
@@ -33,4 +37,7 @@ i32* kernmap(const void* map, i32* dstmap, const v2_i32 mapsize,
/* Returns an index from the given weights. */
i32 pick_from_sample(const i32* weights, i32 len);
+#ifdef __cplusplus
+}
+#endif
#endif
diff --git a/src/utils/include/engine/utils/btree.h b/src/utils/include/engine/utils/btree.h
index 04f9ff8..1dd2023 100644
--- a/src/utils/include/engine/utils/btree.h
+++ b/src/utils/include/engine/utils/btree.h
@@ -1,6 +1,10 @@
#ifndef BTREE_H
#define BTREE_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include <stddef.h>
#define BTREE_DEGREE_DEFAULT 4
@@ -51,4 +55,7 @@ void btree_iter_t_reset(struct btree* tree, struct btree_iter_t** it);
void* btree_iter(struct btree* tree, struct btree_iter_t* iter);
+#ifdef __cplusplus
+}
+#endif
#endif
diff --git a/src/utils/include/engine/utils/fov.h b/src/utils/include/engine/utils/fov.h
index b083d2b..50df8fa 100644
--- a/src/utils/include/engine/utils/fov.h
+++ b/src/utils/include/engine/utils/fov.h
@@ -1,6 +1,10 @@
#ifndef ENGINE_FOV_H
#define ENGINE_FOV_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include <engine/core/types.h>
#include <engine/utils/vector.h>
#include <stdbool.h>
@@ -18,4 +22,7 @@ void fov_shadowcast(const void* map, const v2_i32 mapsize,
bool (*visblocking)(const void*), i32* lightmap,
const i32 range, v2_i32 src);
+#ifdef __cplusplus
+}
+#endif
#endif
diff --git a/src/utils/include/engine/utils/hashmap.h b/src/utils/include/engine/utils/hashmap.h
index 046c810..d8fdbf2 100644
--- a/src/utils/include/engine/utils/hashmap.h
+++ b/src/utils/include/engine/utils/hashmap.h
@@ -1,6 +1,10 @@
#ifndef ENGINE_HASHMAP_H
#define ENGINE_HASHMAP_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include <stdlib.h>
#include <engine/core/types.h>
@@ -51,4 +55,7 @@ i32 lolhash(const usize s, i32 v);
} \
}
+#ifdef __cplusplus
+}
+#endif
#endif
diff --git a/src/utils/include/engine/utils/list.h b/src/utils/include/engine/utils/list.h
index 37857f0..04dda04 100644
--- a/src/utils/include/engine/utils/list.h
+++ b/src/utils/include/engine/utils/list.h
@@ -1,6 +1,10 @@
#ifndef ENGINE_LIST_H
#define ENGINE_LIST_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#define DEFINE_LLIST(type) \
struct List_##type { \
type value; \
@@ -8,4 +12,7 @@
/* Force the user to add `;` for style consistency */ \
} List_##type
+#ifdef __cplusplus
+}
+#endif
#endif
diff --git a/src/utils/include/engine/utils/stack.h b/src/utils/include/engine/utils/stack.h
index 9fc53aa..b8e1807 100644
--- a/src/utils/include/engine/utils/stack.h
+++ b/src/utils/include/engine/utils/stack.h
@@ -1,30 +1,10 @@
-/* Copyright © 2021 Upqwerk
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the “Software”), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- * */
-
-/* Stack implementation
- * Author: Upqwerk
- */
#ifndef STACK_H
#define STACK_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include <engine/core/types.h>
typedef struct {
@@ -47,4 +27,7 @@ void* stack_peek(Stack* s);
isize stack_size(const Stack* s);
void stack_swap(Stack* s, Stack* t);
+#ifdef __cplusplus
+}
+#endif
#endif
diff --git a/src/utils/include/engine/utils/vector.h b/src/utils/include/engine/utils/vector.h
index 11517dc..7f4c4a4 100644
--- a/src/utils/include/engine/utils/vector.h
+++ b/src/utils/include/engine/utils/vector.h
@@ -1,6 +1,10 @@
#ifndef VECTOR_H
#define VECTOR_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include <engine/core/types.h>
#include <stdbool.h>
@@ -28,4 +32,8 @@ v2_i32 v2_i32_min(v2_i32 a, v2_i32 b);
v2_i32 v2_i32_lerp(f32 dt, v2_i32 a, v2_i32 b);
void v2_i32_fprintf(FILE* stream, v2_i32 a);
+
+#ifdef __cplusplus
+}
+#endif
#endif