فهرست منبع

Remove namespaces

Kajetan Johannes Hammerle 9 ماه پیش
والد
کامیت
c0614c01d1
59فایلهای تغییر یافته به همراه386 افزوده شده و 792 حذف شده
  1. 3 3
      CMakeLists.txt
  2. 10 21
      include/core/BitArray.h
  3. 10 20
      include/core/Box.h
  4. 7 16
      include/core/Buffer.h
  5. 10 23
      include/core/Frustum.h
  6. 5 8
      include/core/Generic.h
  7. 10 13
      include/core/HashMap.h
  8. 5 5
      include/core/List.h
  9. 31 57
      include/core/Logger.h
  10. 21 46
      include/core/Matrix.h
  11. 5 12
      include/core/Plane.h
  12. 10 24
      include/core/Quaternion.h
  13. 10 24
      include/core/Queue.h
  14. 7 17
      include/core/Random.h
  15. 3 9
      include/core/ReadLine.h
  16. 4 11
      include/core/SpinLock.h
  17. 54 77
      include/core/Test.h
  18. 24 37
      include/core/ToString.h
  19. 2 7
      include/core/Types.h
  20. 19 41
      include/core/Utility.h
  21. 52 189
      include/core/Vector.h
  22. 12 20
      include/core/View.h
  23. 10 11
      performance/Main.c
  24. 3 4
      src/BitArray.c
  25. 0 1
      src/Box.c
  26. 2 3
      src/Buffer.c
  27. 0 1
      src/Frustum.c
  28. 2 3
      src/Logger.c
  29. 0 1
      src/Matrix.c
  30. 0 1
      src/Plane.c
  31. 0 1
      src/Quaternion.c
  32. 2 3
      src/Queue.c
  33. 0 1
      src/Random.c
  34. 0 1
      src/ReadLine.c
  35. 0 1
      src/SpinLock.c
  36. 12 16
      src/Test.c
  37. 0 1
      src/ToString.c
  38. 2 3
      src/Utility.c
  39. 0 1
      src/Vector.c
  40. 0 1
      src/View.c
  41. 0 1
      test/Main.c
  42. 0 1
      test/modules/BitArrayTests.c
  43. 0 1
      test/modules/BoxTests.c
  44. 0 1
      test/modules/BufferTests.c
  45. 0 1
      test/modules/ComponentsTests.c
  46. 0 1
      test/modules/FrustumTests.c
  47. 1 2
      test/modules/HashMapTests.c
  48. 2 3
      test/modules/ListTests.c
  49. 0 1
      test/modules/MatrixTests.c
  50. 0 1
      test/modules/PlaneTests.c
  51. 0 1
      test/modules/QuaternionTests.c
  52. 0 1
      test/modules/QueueTests.c
  53. 0 1
      test/modules/RandomTests.c
  54. 16 17
      test/modules/ReadLineTests.c
  55. 0 1
      test/modules/SpinLockTests.c
  56. 0 1
      test/modules/TestTests.c
  57. 20 21
      test/modules/UtilityTests.c
  58. 0 1
      test/modules/VectorTests.c
  59. 0 1
      test/modules/ViewTests.c

+ 3 - 3
CMakeLists.txt

@@ -54,9 +54,9 @@ if("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
     set(COMPILE_OPTIONS "")
     set(LINK_OPTIONS "")
     set(LOG_LEVEL 2)
-    set(DEFINITIONS CORE_CHECK_MEMORY)
+    set(DEFINITIONS CHECK_MEMORY)
 else()
-    set(DEFINITIONS ERROR_SIMULATOR CORE_CHECK_MEMORY)
+    set(DEFINITIONS ERROR_SIMULATOR CHECK_MEMORY)
     if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
         set(COMPILE_OPTIONS --coverage)
         set(LINK_OPTIONS gcov)
@@ -88,7 +88,7 @@ target_compile_options(core PUBLIC
     -fdiagnostics-color=always
 )
 target_compile_definitions(core
-    PUBLIC CORE_LOG_LEVEL=${LOG_LEVEL}
+    PUBLIC LOG_LEVEL=${LOG_LEVEL}
     PRIVATE ${DEFINITIONS}
 )
 target_link_libraries(core

+ 10 - 21
include/core/BitArray.h

@@ -3,31 +3,20 @@
 
 #include "core/Types.h"
 
-struct CoreBitArrayT {
+struct BitArrayT {
     u64 length : 56;
     u64 bits : 8;
     u64* data;
 };
-typedef struct CoreBitArrayT CoreBitArray;
-static_assert(sizeof(CoreBitArray) == 16, "invalid bit array size");
+typedef struct BitArrayT BitArray;
+static_assert(sizeof(BitArray) == 16, "invalid bit array size");
 
-void coreInitBitArray(CoreBitArray* a, size_t length, size_t bits);
-void coreDestroyBitArray(CoreBitArray* a);
-void coreSetBits(CoreBitArray* a, size_t index, u64 value);
-void coreSetAllBits(CoreBitArray* a, u64 value);
-u64 coreGetBits(const CoreBitArray* a, size_t index);
-i64 coreSelectBits(const CoreBitArray* a, size_t index);
-void coreSetBitLength(CoreBitArray* a, size_t newLength, size_t newBits);
-
-#ifdef IMPORT_CORE
-#define BitArray CoreBitArray
-#define initBitArray coreInitBitArray
-#define destroyBitArray coreDestroyBitArray
-#define setBits coreSetBits
-#define setAllBits coreSetAllBits
-#define getBits coreGetBits
-#define selectBits coreSelectBits
-#define setBitLength coreSetBitLength
-#endif
+void initBitArray(BitArray* a, size_t length, size_t bits);
+void destroyBitArray(BitArray* a);
+void setBits(BitArray* a, size_t index, u64 value);
+void setAllBits(BitArray* a, u64 value);
+u64 getBits(const BitArray* a, size_t index);
+i64 selectBits(const BitArray* a, size_t index);
+void setBitLength(BitArray* a, size_t newLength, size_t newBits);
 
 #endif

+ 10 - 20
include/core/Box.h

@@ -3,27 +3,17 @@
 
 #include "core/Vector.h"
 
-struct CoreBoxT {
-    CoreVector3 min;
-    CoreVector3 max;
+struct BoxT {
+    Vector3 min;
+    Vector3 max;
 };
-typedef struct CoreBoxT CoreBox;
+typedef struct BoxT Box;
 
-#define CORE_BOX ((CoreBox){0})
-void coreSetBox(CoreBox* box, const CoreVector3* size);
-void coreOffsetBox(CoreBox* box, const CoreVector3* offset);
-bool coreCollidesWithBox(const CoreBox* box, const CoreBox* other);
-void coreExpandBox(CoreBox* box, const CoreVector3* offset);
-void coreGrowBox(CoreBox* box, const CoreVector3* growth);
-
-#ifdef IMPORT_CORE
-#define Box CoreBox
-#define BOX CORE_BOX
-#define setBox coreSetBox
-#define offsetBox coreOffsetBox
-#define collidesWithBox coreCollidesWithBox
-#define expandBox coreExpandBox
-#define growBox coreGrowBox
-#endif
+#define BOX ((Box){0})
+void setBox(Box* box, const Vector3* size);
+void offsetBox(Box* box, const Vector3* offset);
+bool collidesWithBox(const Box* box, const Box* other);
+void expandBox(Box* box, const Vector3* offset);
+void growBox(Box* box, const Vector3* growth);
 
 #endif

+ 7 - 16
include/core/Buffer.h

@@ -7,22 +7,13 @@ typedef struct {
     size_t size;
     size_t capacity;
     char* buffer;
-} CoreBuffer;
+} Buffer;
 
-void coreInitBuffer(CoreBuffer* b);
-void coreDestroyBuffer(CoreBuffer* b);
-void coreAddSizedBufferData(CoreBuffer* b, const void* data, size_t size);
-#define coreAddTypedBufferData(buffer, type, ...)                              \
-    coreAddSizedBufferData(buffer, &(type){__VA_ARGS__}, sizeof(type))
-void coreClearBuffer(CoreBuffer* b);
-
-#ifdef IMPORT_CORE
-#define Buffer CoreBuffer
-#define initBuffer coreInitBuffer
-#define destroyBuffer coreDestroyBuffer
-#define addSizedBufferData coreAddSizedBufferData
-#define addTypedBufferData coreAddTypedBufferData
-#define clearBuffer coreClearBuffer
-#endif
+void initBuffer(Buffer* b);
+void destroyBuffer(Buffer* b);
+void addSizedBufferData(Buffer* b, const void* data, size_t size);
+#define addTypedBufferData(buffer, type, ...)                                  \
+    addSizedBufferData(buffer, &(type){__VA_ARGS__}, sizeof(type))
+void clearBuffer(Buffer* b);
 
 #endif

+ 10 - 23
include/core/Frustum.h

@@ -5,32 +5,19 @@
 #include "core/Plane.h"
 
 typedef struct {
-    CoreMatrix projection;
-    CorePlane planes[6];
+    Matrix projection;
+    Plane planes[6];
     float tan;
     float nearClip;
     float farClip;
-} CoreFrustum;
+} Frustum;
 
-void coreInitFrustum(CoreFrustum* f, float fieldOfView, float nearClip,
-                     float farClip);
-const CoreMatrix* coreUpdateProjection(CoreFrustum* f,
-                                       const CoreIntVector2* size);
-void coreUpdateFrustumPlanes(CoreFrustum* f, const CoreVector3* pos,
-                             const CoreVector3* right, const CoreVector3* up,
-                             const CoreVector3* front,
-                             const CoreIntVector2* size);
-bool coreIsInsideFrustum(const CoreFrustum* f, const CoreVector3* pos);
-bool coreIsInsideFrustumRadius(const CoreFrustum* f, const CoreVector3* pos,
-                               float radius);
-
-#ifdef IMPORT_CORE
-#define Frustum CoreFrustum
-#define initFrustum coreInitFrustum
-#define updateProjection coreUpdateProjection
-#define updateFrustumPlanes coreUpdateFrustumPlanes
-#define isInsideFrustum coreIsInsideFrustum
-#define isInsideFrustumRadius coreIsInsideFrustumRadius
-#endif
+void initFrustum(Frustum* f, float fieldOfView, float nearClip, float farClip);
+const Matrix* updateProjection(Frustum* f, const IntVector2* size);
+void updateFrustumPlanes(Frustum* f, const Vector3* pos, const Vector3* right,
+                         const Vector3* up, const Vector3* front,
+                         const IntVector2* size);
+bool isInsideFrustum(const Frustum* f, const Vector3* pos);
+bool isInsideFrustumRadius(const Frustum* f, const Vector3* pos, float radius);
 
 #endif

+ 5 - 8
include/core/Generic.h

@@ -3,10 +3,9 @@
 
 #include "core/Matrix.h"
 
-#ifdef IMPORT_CORE
-#define GENERIC_PAIR(type, name)                                               \
-    type:                                                                      \
-    name, const type : name
+// clang-format off
+#define GENERIC_PAIR(type, name) type: name, const type : name
+// clang-format on
 
 #define GENERIC_FLOAT_VECTOR(a, name)                                          \
     _Generic((a),                                                              \
@@ -109,8 +108,8 @@
 
 #undef cross
 #define SELECT_OP(_1, _2, _3, name, ...) name
-#define cross3(a, b, c) coreCross(a, b, c)
-#define cross2(a, b) coreCross(&(Vector3){0}, a, b)
+#define cross3(a, b, c) cross(a, b, c)
+#define cross2(a, b) cross(&(Vector3){0}, a, b)
 #define cross(...) SELECT_OP(__VA_ARGS__, cross3, cross2, 0)(__VA_ARGS__)
 
 #define convert(a, b)                                                          \
@@ -123,5 +122,3 @@
         IntVector4 *: convertV4)(a, b)
 
 #endif
-
-#endif

+ 10 - 13
include/core/HashMap.h

@@ -49,8 +49,7 @@ size_t roundUp2(size_t n);
     bool hasNextHashMapNode##N(HashMapIterator##N* mi);                        \
     HashMapNode##N* nextHashMapNode##N(HashMapIterator##N* mi);                \
     size_t toStringHashMap##N(const HashMap##N* m, char* buffer, size_t n,     \
-                              CoreToString keyString,                          \
-                              CoreToString valueString);
+                              ToString keyString, ToString valueString);
 
 #define HASHMAP_SOURCE(K, V, N)                                                \
     static size_t searchSlot##N(HashMap##N* m, K key) {                        \
@@ -91,7 +90,7 @@ size_t roundUp2(size_t n);
         if(minCapacity <= m->capacity) {                                       \
             return;                                                            \
         }                                                                      \
-        size_t l = roundUp2(coreMaxSize(minCapacity, 8lu)) + 1;                \
+        size_t l = roundUp2(maxSize(minCapacity, 8lu)) + 1;                    \
         HashMap##N map;                                                        \
         initHashMap##N(&map);                                                  \
         size_t keyBytes = l * sizeof(K);                                       \
@@ -115,7 +114,7 @@ size_t roundUp2(size_t n);
                 *putHashMapKey##N(&map, keyEntry) = m->values[length];         \
             }                                                                  \
         }                                                                      \
-        coreSwap(&map, m);                                                     \
+        swap(&map, m);                                                         \
         destroyHashMap##N(&map);                                               \
     }                                                                          \
                                                                                \
@@ -175,7 +174,7 @@ size_t roundUp2(size_t n);
                 r = true;                                                      \
             }                                                                  \
         }                                                                      \
-        coreSwap(&n, m);                                                       \
+        swap(&n, m);                                                           \
         destroyHashMap##N(&n);                                                 \
         return r;                                                              \
     }                                                                          \
@@ -209,23 +208,21 @@ size_t roundUp2(size_t n);
     }                                                                          \
                                                                                \
     size_t toStringHashMap##N(const HashMap##N* m, char* buffer, size_t n,     \
-                              CoreToString keyString,                          \
-                              CoreToString valueString) {                      \
+                              ToString keyString, ToString valueString) {      \
         size_t w = 0;                                                          \
-        coreStringAdd(&w, &buffer, &n, coreToString(buffer, n, "["));          \
+        stringAdd(&w, &buffer, &n, coreToString(buffer, n, "["));              \
         bool notFirst = false;                                                 \
         HashMapIterator##N i;                                                  \
         initHashMapIterator##N(&i, m);                                         \
         while(hasNextHashMapNode##N(&i)) {                                     \
             HashMapNode##N* node = nextHashMapNode##N(&i);                     \
             if(notFirst) {                                                     \
-                coreStringAdd(&w, &buffer, &n, coreToString(buffer, n, ", ")); \
+                stringAdd(&w, &buffer, &n, coreToString(buffer, n, ", "));     \
             }                                                                  \
             notFirst = true;                                                   \
-            coreStringAdd(&w, &buffer, &n, keyString(node->key, buffer, n));   \
-            coreStringAdd(&w, &buffer, &n, coreToString(buffer, n, " = "));    \
-            coreStringAdd(&w, &buffer, &n,                                     \
-                          valueString(node->value, buffer, n));                \
+            stringAdd(&w, &buffer, &n, keyString(node->key, buffer, n));       \
+            stringAdd(&w, &buffer, &n, coreToString(buffer, n, " = "));        \
+            stringAdd(&w, &buffer, &n, valueString(node->value, buffer, n));   \
         }                                                                      \
         stringAdd(&w, &buffer, &n, coreToString(buffer, n, "]"));              \
         return w;                                                              \

+ 5 - 5
include/core/List.h

@@ -61,7 +61,7 @@
     T* addEmptyListData##N(List##N* l) {                                       \
         if(l->length >= l->capacity) {                                         \
             reserveListEntries##N(l, l->capacity +                             \
-                                         coreMaxSize(4lu, l->capacity / 4));   \
+                                         maxSize(4lu, l->capacity / 4));       \
         }                                                                      \
         return l->data + l->length++;                                          \
     }                                                                          \
@@ -114,17 +114,17 @@
     size_t toStringList##N(const List##N* l, char* buffer, size_t n,           \
                            ToString##N c) {                                    \
         size_t w = 0;                                                          \
-        coreStringAdd(&w, &buffer, &n, coreToString(buffer, n, "["));          \
+        stringAdd(&w, &buffer, &n, coreToString(buffer, n, "["));              \
         T* end = getListEnd##N(l);                                             \
         T* p = getListStart##N(l);                                             \
         while(p != end) {                                                      \
-            coreStringAdd(&w, &buffer, &n, c(p, buffer, n));                   \
+            stringAdd(&w, &buffer, &n, c(p, buffer, n));                       \
             p++;                                                               \
             if(p != end) {                                                     \
-                coreStringAdd(&w, &buffer, &n, coreToString(buffer, n, ", ")); \
+                stringAdd(&w, &buffer, &n, coreToString(buffer, n, ", "));     \
             }                                                                  \
         }                                                                      \
-        coreStringAdd(&w, &buffer, &n, coreToString(buffer, n, "]"));          \
+        stringAdd(&w, &buffer, &n, coreToString(buffer, n, "]"));              \
         return w;                                                              \
     }
 

+ 31 - 57
include/core/Logger.h

@@ -3,78 +3,52 @@
 
 #include "core/Check.h"
 
-#define CORE_TERMINAL_RED "\33[1;31m"
-#define CORE_TERMINAL_YELLOW "\33[1;33m"
-#define CORE_TERMINAL_GRAY "\33[1;37m"
-#define CORE_TERMINAL_GREEN "\33[1;32m"
-#define CORE_TERMINAL_RESET "\33[0m"
+#define TERMINAL_RED "\33[1;31m"
+#define TERMINAL_YELLOW "\33[1;33m"
+#define TERMINAL_GRAY "\33[1;37m"
+#define TERMINAL_GREEN "\33[1;32m"
+#define TERMINAL_RESET "\33[0m"
 
-typedef enum {
-    CORE_LOG_NONE,
-    CORE_LOG_ERROR,
-    CORE_LOG_WARNING,
-    CORE_LOG_INFO,
-    CORE_LOG_DEBUG
-} CoreLogLevel;
+typedef enum { LOG_NONE, LOG_ERROR, LOG_WARNING, LOG_INFO, LOG_DEBUG } LogLevel;
 
-extern CoreLogLevel coreLogLevel;
+extern LogLevel logLevel;
 
-const char* coreGetShortFileName(const char* s);
+const char* getShortFileName(const char* s);
 
-check_format(6, 7) void coreLog(CoreLogLevel l, const char* file, int line,
-                                const char* prefix, const char* tag,
-                                const char* format, ...);
+check_format(6, 7) void printLog(LogLevel l, const char* file, int line,
+                                 const char* prefix, const char* tag,
+                                 const char* format, ...);
 
-#if defined(CORE_LOG_LEVEL) && CORE_LOG_LEVEL >= 1
-#define CORE_LOG_ERROR(...)                                                    \
-    coreLog(CORE_LOG_ERROR, __FILE__, __LINE__, CORE_TERMINAL_RED, "[ERROR] ", \
-            __VA_ARGS__)
+#if defined(LOG_LEVEL) && LOG_LEVEL >= 1
+#define LOG_ERROR(...)                                                         \
+    printLog(LOG_ERROR, __FILE__, __LINE__, TERMINAL_RED, "[ERROR] ",          \
+             __VA_ARGS__)
 #else
-#define CORE_LOG_ERROR(...)
+#define LOG_ERROR(...)
 #endif
 
-#if defined(CORE_LOG_LEVEL) && CORE_LOG_LEVEL >= 2
-#define CORE_LOG_WARNING(...)                                                  \
-    coreLog(CORE_LOG_WARNING, __FILE__, __LINE__, CORE_TERMINAL_YELLOW,        \
-            "[WARNING] ", __VA_ARGS__)
+#if defined(LOG_LEVEL) && LOG_LEVEL >= 2
+#define LOG_WARNING(...)                                                       \
+    printLog(LOG_WARNING, __FILE__, __LINE__, TERMINAL_YELLOW, "[WARNING] ",   \
+             __VA_ARGS__)
 #else
-#define CORE_LOG_WARNING(...)
+#define LOG_WARNING(...)
 #endif
 
-#if defined(CORE_LOG_LEVEL) && CORE_LOG_LEVEL >= 3
-#define CORE_LOG_INFO(...)                                                     \
-    coreLog(CORE_LOG_INFO, __FILE__, __LINE__, CORE_TERMINAL_GRAY, "[INFO] ",  \
-            __VA_ARGS__)
+#if defined(LOG_LEVEL) && LOG_LEVEL >= 3
+#define LOG_INFO(...)                                                          \
+    printLog(LOG_INFO, __FILE__, __LINE__, TERMINAL_GRAY, "[INFO] ",           \
+             __VA_ARGS__)
 #else
-#define CORE_LOG_INFO(...)
+#define LOG_INFO(...)
 #endif
 
-#if defined(CORE_LOG_LEVEL) && CORE_LOG_LEVEL >= 4
-#define CORE_LOG_DEBUG(...)                                                    \
-    coreLog(CORE_LOG_DEBUG, __FILE__, __LINE__, CORE_TERMINAL_GREEN,           \
-            "[DEBUG] ", __VA_ARGS__)
+#if defined(LOG_LEVEL) && LOG_LEVEL >= 4
+#define LOG_DEBUG(...)                                                         \
+    printLog(LOG_DEBUG, __FILE__, __LINE__, TERMINAL_GREEN, "[DEBUG] ",        \
+             __VA_ARGS__)
 #else
-#define CORE_LOG_DEBUG(...)
-#endif
-
-#ifdef IMPORT_CORE
-#define TERMINAL_RED CORE_TERMINAL_RED
-#define TERMINAL_YELLOW CORE_TERMINAL_YELLOW
-#define TERMINAL_GRAY CORE_TERMINAL_GRAY
-#define TERMINAL_GREEN CORE_TERMINAL_GREEN
-#define TERMINAL_RESET CORE_TERMINAL_RESET
-#define LogLevel CoreLogLevel
-#define LOG_NONE CORE_LOG_NONE
-#define LOG_ERROR CORE_LOG_ERROR
-#define LOG_WARNING CORE_LOG_WARNING
-#define LOG_INFO CORE_LOG_INFO
-#define LOG_DEBUG CORE_LOG_DEBUG
-#define logLevel coreLogLevel
-#define getShortFileName coreGetShortFileName
-#define LOG_ERROR CORE_LOG_ERROR
-#define LOG_WARNING CORE_LOG_WARNING
-#define LOG_INFO CORE_LOG_INFO
-#define LOG_DEBUG CORE_LOG_DEBUG
+#define LOG_DEBUG(...)
 #endif
 
 #endif

+ 21 - 46
include/core/Matrix.h

@@ -4,54 +4,29 @@
 #include "core/Quaternion.h"
 #include "core/Vector.h"
 
-struct CoreMatrixT {
-    CoreVector4 data[4];
+struct MatrixT {
+    Vector4 data[4];
 };
-typedef struct CoreMatrixT CoreMatrix;
+typedef struct MatrixT Matrix;
 
-#define CORE_ZERO_MATRIX ((CoreMatrix){0})
-#define CORE_UNIT_MATRIX                                                       \
-    ((CoreMatrix){                                                             \
-        {{{1, 0, 0, 0}}, {{0, 1, 0, 0}}, {{0, 0, 1, 0}}, {{0, 0, 0, 1}}}})
+#define ZERO_MATRIX ((Matrix){0})
+#define UNIT_MATRIX                                                            \
+    ((Matrix){{{{1, 0, 0, 0}}, {{0, 1, 0, 0}}, {{0, 0, 1, 0}}, {{0, 0, 0, 1}}}})
 
-CoreMatrix* coreTransposeMatrix(CoreMatrix* m);
-CoreMatrix* coreMulSetMatrix(CoreMatrix* m, const CoreMatrix* a);
-CoreMatrix* coreMulMatrix(CoreMatrix* m, const CoreMatrix* a,
-                          const CoreMatrix* b);
-CoreVector3* coreMulMatrixV3(CoreVector3* v, const CoreMatrix* m,
-                             const CoreVector3* a);
-CoreMatrix* coreScaleMatrix(CoreMatrix* m, const CoreVector3* v);
-CoreMatrix* coreScaleMatrixF(CoreMatrix* m, float f);
-CoreMatrix* coreTranslateMatrix(CoreMatrix* m, const CoreVector3* v);
-CoreMatrix* coreTranslateMatrixX(CoreMatrix* m, float tx);
-CoreMatrix* coreTranslateMatrixY(CoreMatrix* m, float ty);
-CoreMatrix* coreTranslateMatrixZ(CoreMatrix* m, float tz);
-CoreMatrix* coreTranslateMatrixTo(CoreMatrix* m, const CoreVector3* v);
-CoreMatrix* coreRotateMatrixX(CoreMatrix* m, float degrees);
-CoreMatrix* coreRotateMatrixY(CoreMatrix* m, float degrees);
-CoreMatrix* coreRotateMatrixZ(CoreMatrix* m, float degrees);
-CoreMatrix* coreRotateMatrix(CoreMatrix* m, const CoreQuaternion* q);
-
-#ifdef IMPORT_CORE
-#define Matrix CoreMatrix
-#define ZERO_MATRIX CORE_ZERO_MATRIX
-#define UNIT_MATRIX CORE_UNIT_MATRIX
-#define transposeMatrix coreTransposeMatrix
-#define mulSetMatrix coreMulSetMatrix
-#define mulMatrix coreMulMatrix
-#define mulMatrixV3 coreMulMatrixV3
-#define scaleMatrix coreScaleMatrix
-#define scaleMatrixF coreScaleMatrixF
-#define translateMatrix coreTranslateMatrix
-#define translateMatrixX coreTranslateMatrixX
-#define translateMatrixY coreTranslateMatrixY
-#define translateMatrixZ coreTranslateMatrixZ
-#define translateMatrixTo coreTranslateMatrixTo
-#define rotateMatrixX coreRotateMatrixX
-#define rotateMatrixY coreRotateMatrixY
-#define rotateMatrixZ coreRotateMatrixZ
-#define rotateMatrix coreRotateMatrix
-#define toStringMatrix coreToStringMatrix
-#endif
+Matrix* transposeMatrix(Matrix* m);
+Matrix* mulSetMatrix(Matrix* m, const Matrix* a);
+Matrix* mulMatrix(Matrix* m, const Matrix* a, const Matrix* b);
+Vector3* mulMatrixV3(Vector3* v, const Matrix* m, const Vector3* a);
+Matrix* scaleMatrix(Matrix* m, const Vector3* v);
+Matrix* scaleMatrixF(Matrix* m, float f);
+Matrix* translateMatrix(Matrix* m, const Vector3* v);
+Matrix* translateMatrixX(Matrix* m, float tx);
+Matrix* translateMatrixY(Matrix* m, float ty);
+Matrix* translateMatrixZ(Matrix* m, float tz);
+Matrix* translateMatrixTo(Matrix* m, const Vector3* v);
+Matrix* rotateMatrixX(Matrix* m, float degrees);
+Matrix* rotateMatrixY(Matrix* m, float degrees);
+Matrix* rotateMatrixZ(Matrix* m, float degrees);
+Matrix* rotateMatrix(Matrix* m, const Quaternion* q);
 
 #endif

+ 5 - 12
include/core/Plane.h

@@ -3,20 +3,13 @@
 
 #include "core/Vector.h"
 
-struct CorePlaneT {
-    CoreVector3 abc;
+struct PlaneT {
+    Vector3 abc;
     float d;
 };
-typedef struct CorePlaneT CorePlane;
+typedef struct PlaneT Plane;
 
-void coreInitPlane(CorePlane* p, const CoreVector3* a, const CoreVector3* b,
-                   const CoreVector3* c);
-float coreSignedDistance(const CorePlane* p, const CoreVector3* v);
-
-#ifdef IMPORT_CORE
-#define Plane CorePlane
-#define initPlane coreInitPlane
-#define signedDistance coreSignedDistance
-#endif
+void initPlane(Plane* p, const Vector3* a, const Vector3* b, const Vector3* c);
+float signedDistance(const Plane* p, const Vector3* v);
 
 #endif

+ 10 - 24
include/core/Quaternion.h

@@ -4,32 +4,18 @@
 #include "core/Vector.h"
 
 typedef struct {
-    CoreVector3 xyz;
+    Vector3 xyz;
     float w;
-} CoreQuaternion;
+} Quaternion;
 
-#define CORE_UNIT_QUATERNION ((CoreQuaternion){{{0.0f, 0.0f, 0.0f}}, 1.0f})
+#define UNIT_QUATERNION ((Quaternion){{{0.0f, 0.0f, 0.0f}}, 1.0f})
 
-CoreQuaternion* coreAxisAngleQ(CoreQuaternion* q, const CoreVector3* axis,
-                               float angle);
-CoreQuaternion* coreLerpQ(CoreQuaternion* q, const CoreQuaternion* a, float f,
-                          const CoreQuaternion* b);
-CoreQuaternion* coreMulSetQ(CoreQuaternion* q, const CoreQuaternion* other);
-CoreQuaternion* coreMulQ(CoreQuaternion* q, const CoreQuaternion* a,
-                         const CoreQuaternion* b);
-CoreVector3* coreMulQV3(CoreVector3* r, const CoreQuaternion* q,
-                        const CoreVector3* v);
-size_t coreToStringQ(const CoreQuaternion* q, char* buffer, size_t n);
-
-#ifdef IMPORT_CORE
-#define Quaternion CoreQuaternion
-#define UNIT_QUATERNION CORE_UNIT_QUATERNION
-#define axisAngleQ coreAxisAngleQ
-#define lerpQ coreLerpQ
-#define mulSetQ coreMulSetQ
-#define mulQ coreMulQ
-#define mulQV3 coreMulQV3
-#define toStringQ coreToStringQ
-#endif
+Quaternion* axisAngleQ(Quaternion* q, const Vector3* axis, float angle);
+Quaternion* lerpQ(Quaternion* q, const Quaternion* a, float f,
+                  const Quaternion* b);
+Quaternion* mulSetQ(Quaternion* q, const Quaternion* other);
+Quaternion* mulQ(Quaternion* q, const Quaternion* a, const Quaternion* b);
+Vector3* mulQV3(Vector3* r, const Quaternion* q, const Vector3* v);
+size_t toStringQ(const Quaternion* q, char* buffer, size_t n);
 
 #endif

+ 10 - 24
include/core/Queue.h

@@ -3,7 +3,7 @@
 
 #include "core/Types.h"
 
-struct CoreQueueT {
+struct QueueT {
     size_t writeIndex;
     size_t readIndex;
     size_t length;
@@ -11,29 +11,15 @@ struct CoreQueueT {
     size_t dataSize;
     void* data;
 };
-typedef struct CoreQueueT CoreQueue;
+typedef struct QueueT Queue;
 
-void coreInitQueue(CoreQueue* r, size_t capacity, size_t dataSize);
-void coreDestroyQueue(CoreQueue* r);
-void corePushQueueData(CoreQueue* r, const void* data);
-#define corePushQueueType(l, type, ...)                                        \
-    corePushQueueData(l, &(type){__VA_ARGS__})
-void* coreGetQueueIndex(const CoreQueue* r, size_t index);
-#define coreGetTypedQueueIndex(r, index, type)                                 \
-    (*(type*)coreGetQueueIndex(r, index))
-void coreClearQueue(CoreQueue* r);
-void corePopQueueData(CoreQueue* r);
-
-#ifdef IMPORT_CORE
-#define Queue CoreQueue
-#define initQueue coreInitQueue
-#define destroyQueue coreDestroyQueue
-#define pushQueueData corePushQueueData
-#define pushQueueType corePushQueueType
-#define getQueueIndex coreGetQueueIndex
-#define getTypedQueueIndex coreGetTypedQueueIndex
-#define clearQueue coreClearQueue
-#define popQueueData corePopQueueData
-#endif
+void initQueue(Queue* r, size_t capacity, size_t dataSize);
+void destroyQueue(Queue* r);
+void pushQueueData(Queue* r, const void* data);
+#define pushQueueType(l, type, ...) pushQueueData(l, &(type){__VA_ARGS__})
+void* getQueueIndex(const Queue* r, size_t index);
+#define getTypedQueueIndex(r, index, type) (*(type*)getQueueIndex(r, index))
+void clearQueue(Queue* r);
+void popQueueData(Queue* r);
 
 #endif

+ 7 - 17
include/core/Random.h

@@ -6,23 +6,13 @@
 typedef struct {
     u32 data[25];
     size_t index;
-} CoreRandom;
+} Random;
 
-void coreInitRandom(CoreRandom* r, u32 seed);
-u32 coreRandomU32(CoreRandom* r, u32 min, u32 exclusiveMax);
-i32 coreRandomI32(CoreRandom* r, i32 min, i32 exclusiveMax);
-size_t coreRandomSize(CoreRandom* r, size_t min, size_t exclusiveMax);
-bool coreRandomBool(CoreRandom* r);
-float coreRandomFloat(CoreRandom* r);
-
-#ifdef IMPORT_CORE
-#define Random CoreRandom
-#define initRandom coreInitRandom
-#define randomU32 coreRandomU32
-#define randomI32 coreRandomI32
-#define randomSize coreRandomSize
-#define randomBool coreRandomBool
-#define randomFloat coreRandomFloat
-#endif
+void initRandom(Random* r, u32 seed);
+u32 randomU32(Random* r, u32 min, u32 exclusiveMax);
+i32 randomI32(Random* r, i32 min, i32 exclusiveMax);
+size_t randomSize(Random* r, size_t min, size_t exclusiveMax);
+bool randomBool(Random* r);
+float randomFloat(Random* r);
 
 #endif

+ 3 - 9
include/core/ReadLine.h

@@ -3,14 +3,8 @@
 
 #include <stddef.h>
 
-bool coreStartReadLine(void);
-bool coreReadLine(char* buffer, size_t n);
-void coreStopReadLine(void);
-
-#ifdef IMPORT_CORE
-#define startReadLine coreStartReadLine
-#define readLine coreReadLine
-#define stopReadLine coreStopReadLine
-#endif
+bool startReadLine(void);
+bool readLine(char* buffer, size_t n);
+void stopReadLine(void);
 
 #endif

+ 4 - 11
include/core/SpinLock.h

@@ -5,17 +5,10 @@
 
 typedef struct {
     atomic_bool lock;
-} CoreSpinLock;
+} SpinLock;
 
-void coreInitSpinLock(CoreSpinLock* l);
-void coreLockSpinLock(CoreSpinLock* l);
-void coreUnlockSpinLock(CoreSpinLock* l);
-
-#ifdef IMPORT_CORE
-#define SpinLock CoreSpinLock
-#define initSpinLock coreInitSpinLock
-#define lockSpinLock coreLockSpinLock
-#define unlockSpinLock coreUnlockSpinLock
-#endif
+void initSpinLock(SpinLock* l);
+void lockSpinLock(SpinLock* l);
+void unlockSpinLock(SpinLock* l);
 
 #endif

+ 54 - 77
include/core/Test.h

@@ -3,82 +3,59 @@
 
 #include "core/Types.h"
 
-void coreFinalizeTests(void);
-
-#define CORE_TEST_ARGS const char *file, int line
-#define CORE_TEST_FUNCTION(name, type)                                         \
-    bool coreTest##name(CORE_TEST_ARGS, type wanted, type actual)
-
-CORE_TEST_FUNCTION(Int, int);
-CORE_TEST_FUNCTION(I64, i64);
-CORE_TEST_FUNCTION(U64, u64);
-CORE_TEST_FUNCTION(Size, size_t);
-CORE_TEST_FUNCTION(Bool, bool);
-CORE_TEST_FUNCTION(String, const char*);
-
-bool coreTestFloat(CORE_TEST_ARGS, float wanted, float actual, float error);
-
-bool coreTestNull(CORE_TEST_ARGS, const void* p);
-bool coreTestNotNull(CORE_TEST_ARGS, const void* p);
-
-#define CORE_TEST(wanted, actual, name)                                        \
-    coreTest##name(__FILE__, __LINE__, wanted, actual)
-
-#define CORE_TEST_FLOAT(wanted, actual, error)                                 \
-    coreTestFloat(__FILE__, __LINE__, wanted, actual, error)
-
-#define CORE_TEST_BOOL(wanted, actual) CORE_TEST(wanted, actual, Bool)
-#define CORE_TEST_INT(wanted, actual) CORE_TEST(wanted, actual, Int)
-#define CORE_TEST_I64(wanted, actual) CORE_TEST(wanted, actual, I64)
-#define CORE_TEST_U64(wanted, actual) CORE_TEST(wanted, actual, U64)
-#define CORE_TEST_SIZE(wanted, actual) CORE_TEST(wanted, actual, Size)
-#define CORE_TEST_STRING(wanted, actual) CORE_TEST(wanted, actual, String)
-#define CORE_TEST_FALSE(actual) CORE_TEST(false, actual, Bool)
-#define CORE_TEST_TRUE(actual) CORE_TEST(true, actual, Bool)
-#define CORE_TEST_NULL(actual) coreTestNull(__FILE__, __LINE__, actual)
-#define CORE_TEST_NOT_NULL(actual) coreTestNotNull(__FILE__, __LINE__, actual)
-
-bool coreTestVectorN(CORE_TEST_ARGS, const float* wanted, const float* actual,
-                     size_t n);
-#define CORE_TEST_VN(wanted, actual, n)                                        \
-    coreTestVectorN(__FILE__, __LINE__, (wanted)->data, (actual)->data, n)
-#define CORE_TEST_V2(wanted, actual)                                           \
-    CORE_TEST_VN((CoreVector2*)(wanted), (CoreVector2*)(actual), 2)
-#define CORE_TEST_V3(wanted, actual)                                           \
-    CORE_TEST_VN((CoreVector3*)(wanted), (CoreVector3*)(actual), 3)
-#define CORE_TEST_V4(wanted, actual)                                           \
-    CORE_TEST_VN((CoreVector4*)(wanted), (CoreVector4*)(actual), 4)
-
-bool coreTestIntVectorN(CORE_TEST_ARGS, const int* wanted, const int* actual,
-                        size_t n);
-#define CORE_TEST_IVN(wanted, actual, n)                                       \
-    coreTestIntVectorN(__FILE__, __LINE__, (wanted)->data, (actual)->data, n)
-#define CORE_TEST_IV2(wanted, actual)                                          \
-    CORE_TEST_IVN((CoreIntVector2*)(wanted), (CoreIntVector2*)(actual), 2)
-#define CORE_TEST_IV3(wanted, actual)                                          \
-    CORE_TEST_IVN((CoreIntVector3*)(wanted), (CoreIntVector3*)(actual), 3)
-#define CORE_TEST_IV4(wanted, actual)                                          \
-    CORE_TEST_IVN((CoreIntVector4*)(wanted), (CoreIntVector4*)(actual), 4)
-
-#ifdef IMPORT_CORE
-#define finalizeTests coreFinalizeTests
-#define TEST_FLOAT CORE_TEST_FLOAT
-#define TEST_BOOL CORE_TEST_BOOL
-#define TEST_INT CORE_TEST_INT
-#define TEST_I64 CORE_TEST_I64
-#define TEST_U64 CORE_TEST_U64
-#define TEST_SIZE CORE_TEST_SIZE
-#define TEST_STRING CORE_TEST_STRING
-#define TEST_FALSE CORE_TEST_FALSE
-#define TEST_TRUE CORE_TEST_TRUE
-#define TEST_NULL CORE_TEST_NULL
-#define TEST_NOT_NULL CORE_TEST_NOT_NULL
-#define TEST_V2 CORE_TEST_V2
-#define TEST_V3 CORE_TEST_V3
-#define TEST_V4 CORE_TEST_V4
-#define TEST_IV2 CORE_TEST_IV2
-#define TEST_IV3 CORE_TEST_IV3
-#define TEST_IV4 CORE_TEST_IV4
-#endif
+void finalizeTests(void);
+
+#define TEST_ARGS const char *file, int line
+#define TEST_FUNCTION(name, type)                                              \
+    bool test##name(TEST_ARGS, type wanted, type actual)
+
+TEST_FUNCTION(Int, int);
+TEST_FUNCTION(I64, i64);
+TEST_FUNCTION(U64, u64);
+TEST_FUNCTION(Size, size_t);
+TEST_FUNCTION(Bool, bool);
+TEST_FUNCTION(String, const char*);
+
+bool testFloat(TEST_ARGS, float wanted, float actual, float error);
+
+bool testNull(TEST_ARGS, const void* p);
+bool testNotNull(TEST_ARGS, const void* p);
+
+#define TEST(wanted, actual, name)                                             \
+    test##name(__FILE__, __LINE__, wanted, actual)
+
+#define TEST_FLOAT(wanted, actual, error)                                      \
+    testFloat(__FILE__, __LINE__, wanted, actual, error)
+
+#define TEST_BOOL(wanted, actual) TEST(wanted, actual, Bool)
+#define TEST_INT(wanted, actual) TEST(wanted, actual, Int)
+#define TEST_I64(wanted, actual) TEST(wanted, actual, I64)
+#define TEST_U64(wanted, actual) TEST(wanted, actual, U64)
+#define TEST_SIZE(wanted, actual) TEST(wanted, actual, Size)
+#define TEST_STRING(wanted, actual) TEST(wanted, actual, String)
+#define TEST_FALSE(actual) TEST(false, actual, Bool)
+#define TEST_TRUE(actual) TEST(true, actual, Bool)
+#define TEST_NULL(actual) testNull(__FILE__, __LINE__, actual)
+#define TEST_NOT_NULL(actual) testNotNull(__FILE__, __LINE__, actual)
+
+bool testVectorN(TEST_ARGS, const float* wanted, const float* actual, size_t n);
+#define TEST_VN(wanted, actual, n)                                             \
+    testVectorN(__FILE__, __LINE__, (wanted)->data, (actual)->data, n)
+#define TEST_V2(wanted, actual)                                                \
+    TEST_VN((Vector2*)(wanted), (Vector2*)(actual), 2)
+#define TEST_V3(wanted, actual)                                                \
+    TEST_VN((Vector3*)(wanted), (Vector3*)(actual), 3)
+#define TEST_V4(wanted, actual)                                                \
+    TEST_VN((Vector4*)(wanted), (Vector4*)(actual), 4)
+
+bool testIntVectorN(TEST_ARGS, const int* wanted, const int* actual, size_t n);
+#define TEST_IVN(wanted, actual, n)                                            \
+    testIntVectorN(__FILE__, __LINE__, (wanted)->data, (actual)->data, n)
+#define TEST_IV2(wanted, actual)                                               \
+    TEST_IVN((IntVector2*)(wanted), (IntVector2*)(actual), 2)
+#define TEST_IV3(wanted, actual)                                               \
+    TEST_IVN((IntVector3*)(wanted), (IntVector3*)(actual), 3)
+#define TEST_IV4(wanted, actual)                                               \
+    TEST_IVN((IntVector4*)(wanted), (IntVector4*)(actual), 4)
 
 #endif

+ 24 - 37
include/core/ToString.h

@@ -6,49 +6,36 @@
 
 check_format(3, 4) size_t
     coreToString(char* buffer, size_t n, const char* format, ...);
-size_t coreToStringSize(const void* p, char* buffer, size_t n);
-size_t coreToStringInt(const void* p, char* buffer, size_t n);
-void coreStringAdd(size_t* w, char** buffer, size_t* n, size_t shift);
-
-struct CoreQueueT;
-size_t coreToStringQueue(const struct CoreQueueT* r, char* buffer, size_t n,
-                         CoreToString c);
-
-#define CORE_STRUCT_TO_STRING(type)                                            \
-    struct Core##type##T;                                                      \
-    size_t coreToString##type(const struct Core##type##T* a, char* buffer,     \
-                              size_t n);
-
-CORE_STRUCT_TO_STRING(BitArray)
-CORE_STRUCT_TO_STRING(Box)
-CORE_STRUCT_TO_STRING(Matrix)
-CORE_STRUCT_TO_STRING(Plane)
-
-#ifdef IMPORT_CORE
-#define toStringSize coreToStringSize
-#define toStringInt coreToStringInt
-#define stringAdd coreStringAdd
-#define toStringQueue coreToStringQueue
-#define toStringBitArray coreToStringBitArray
-#define toStringBox coreToStringBox
-#define toStringMatrix coreToStringMatrix
-#define toStringPlane coreToStringPlane
+size_t toStringSize(const void* p, char* buffer, size_t n);
+size_t toStringInt(const void* p, char* buffer, size_t n);
+void stringAdd(size_t* w, char** buffer, size_t* n, size_t shift);
+
+struct QueueT;
+size_t toStringQueue(const struct QueueT* r, char* buffer, size_t n,
+                     ToString c);
+
+#define STRUCT_TO_STRING(type)                                                 \
+    struct type##T;                                                            \
+    size_t toString##type(const struct type##T* a, char* buffer, size_t n);
+
+STRUCT_TO_STRING(BitArray)
+STRUCT_TO_STRING(Box)
+STRUCT_TO_STRING(Matrix)
+STRUCT_TO_STRING(Plane)
 
 // clang-format off
-#define CORE_PAIR(a, b) a: b
+#define PAIR(a, b) a: b
+#define STRUCT_PAIR(name)                                                      \
+    PAIR(const struct name##T*, toString##name), PAIR(struct name##T*, toString##name)
 // clang-format on
-#define CORE_STRUCT_PAIR(name)                                                 \
-    CORE_PAIR(const struct Core##name##T*, toString##name),                    \
-        CORE_PAIR(struct Core##name##T*, toString##name)
 
 #define toString(t, ...)                                                       \
     _Generic((t),                                                              \
         char*: coreToString,                                                   \
-        CORE_STRUCT_PAIR(BitArray),                                            \
-        CORE_STRUCT_PAIR(Box),                                                 \
-        CORE_STRUCT_PAIR(Matrix),                                              \
-        CORE_STRUCT_PAIR(Plane),                                               \
-        CORE_STRUCT_PAIR(Queue))(t, __VA_ARGS__)
-#endif
+        STRUCT_PAIR(BitArray),                                                 \
+        STRUCT_PAIR(Box),                                                      \
+        STRUCT_PAIR(Matrix),                                                   \
+        STRUCT_PAIR(Plane),                                                    \
+        STRUCT_PAIR(Queue))(t, __VA_ARGS__)
 
 #endif

+ 2 - 7
include/core/Types.h

@@ -12,13 +12,8 @@ typedef uint64_t u64;
 typedef uint32_t u32;
 typedef uint16_t u16;
 typedef uint8_t u8;
-#define CORE_ARRAY_LENGTH(array) (sizeof(array) / sizeof(*array))
+#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(*array))
 
-typedef size_t (*CoreToString)(const void* data, char* buffer, size_t n);
-
-#ifdef IMPORT_CORE
-#define ARRAY_LENGTH CORE_ARRAY_LENGTH
-#define ToString CoreToString
-#endif
+typedef size_t (*ToString)(const void* data, char* buffer, size_t n);
 
 #endif

+ 19 - 41
include/core/Utility.h

@@ -5,33 +5,33 @@
 
 #include "core/Types.h"
 
-size_t corePopCount(u64 u);
-#define coreInterpolate(a, b, factor) (a * (1.0f - factor) + b * factor)
-#define CORE_PI 3.14159265358979323846f
-#define coreRadianToDegree(radians) (radians * (180.0f / CORE_PI))
-#define coreDegreeToRadian(degrees) (degrees * (CORE_PI / 180.0f))
+size_t popCount(u64 u);
+#define interpolate(a, b, factor) (a * (1.0f - factor) + b * factor)
+#define PI 3.14159265358979323846f
+#define radianToDegree(radians) (radians * (180.0f / PI))
+#define degreeToRadian(degrees) (degrees * (PI / 180.0f))
 
-inline size_t coreMaxSize(size_t a, size_t b) {
+inline size_t maxSize(size_t a, size_t b) {
     return a > b ? a : b;
 }
 
-inline size_t coreMinSize(size_t a, size_t b) {
+inline size_t minSize(size_t a, size_t b) {
     return a < b ? a : b;
 }
 
-typedef void (*CoreExitHandler)(int, void*);
-[[noreturn]] void coreExitWithHandler(const char* file, int line, int value);
-void coreSetExitHandler(CoreExitHandler h, void* data);
-#define CORE_EXIT(exitValue) coreExitWithHandler(__FILE__, __LINE__, exitValue)
+typedef void (*ExitHandler)(int, void*);
+[[noreturn]] void exitWithHandler(const char* file, int line, int value);
+void setExitHandler(ExitHandler h, void* data);
+#define EXIT(exitValue) exitWithHandler(__FILE__, __LINE__, exitValue)
 
-typedef void (*CoreOutOfMemoryHandler)(void*);
-void coreSetOutOfMemoryHandler(CoreOutOfMemoryHandler h, void* data);
+typedef void (*OutOfMemoryHandler)(void*);
+void setOutOfMemoryHandler(OutOfMemoryHandler h, void* data);
 
-#ifdef CORE_CHECK_MEMORY
+#ifdef CHECK_MEMORY
 void* coreDebugAllocate(const char* file, int line, size_t n);
 void* coreDebugReallocate(const char* file, int line, void* p, size_t n);
 void coreFreeDebug(const char* file, int line, void* p);
-void corePrintMemoryReport(void);
+void printMemoryReport(void);
 #define coreAllocate(n) coreDebugAllocate(__FILE__, __LINE__, n)
 #define coreReallocate(p, n) coreDebugReallocate(__FILE__, __LINE__, p, n)
 #define coreFree(p) coreFreeDebug(__FILE__, __LINE__, p)
@@ -39,40 +39,18 @@ void corePrintMemoryReport(void);
 void* coreAllocate(size_t n);
 void* coreReallocate(void* p, size_t n);
 void coreFree(void* p);
-#define corePrintMemoryReport()
+#define printMemoryReport()
 #endif
 
-bool coreSleepNanos(i64 nanos);
-i64 coreGetNanos(void);
+bool sleepNanos(i64 nanos);
+i64 getNanos(void);
 
 // TODO: replace typeof with auto when available
-#define coreSwap(a, b)                                                         \
+#define swap(a, b)                                                             \
     do {                                                                       \
         typeof(*(a)) tmp = *(a);                                               \
         *(a) = *(b);                                                           \
         *(b) = tmp;                                                            \
     } while(0)
 
-#ifdef IMPORT_CORE
-#define popCount corePopCount
-#define interpolate coreInterpolate
-#define PI CORE_PI
-#define radianToDegree coreRadianToDegree
-#define degreeToRadian coreDegreeToRadian
-#define maxSize coreMaxSize
-#define minSize coreMinSize
-#define ExitHandler CoreExitHandler
-#define setExitHandler coreSetExitHandler
-#define EXIT CORE_EXIT
-#define OutOfMemoryHandler CoreOutOfMemoryHandler
-#define setOutOfMemoryHandler coreSetOutOfMemoryHandler
-#define printMemoryReport corePrintMemoryReport
-#define cAllocate coreAllocate
-#define cReallocate coreReallocate
-#define cFree coreFree
-#define sleepNanos coreSleepNanos
-#define getNanos coreGetNanos
-#define swap coreSwap
-#endif
-
 #endif

+ 52 - 189
include/core/Vector.h

@@ -3,197 +3,62 @@
 
 #include "core/Types.h"
 
-#define CORE_VECTOR_OP2(name) name *r, const name *a
-#define CORE_VECTOR_OP3(name) CORE_VECTOR_OP2(name), const name* b
+#define VECTOR_OP2(name) name *r, const name *a
+#define VECTOR_OP3(name) VECTOR_OP2(name), const name* b
 
-#define CORE_DEFINE_VECTOR(N, name, sname, type)                               \
+#define DEFINE_VECTOR(N, name, sname, type)                                    \
     typedef struct {                                                           \
         type data[N];                                                          \
     } name;                                                                    \
-    name* coreAddSet##sname(CORE_VECTOR_OP2(name));                            \
-    name* coreAdd##sname(CORE_VECTOR_OP3(name));                               \
-    name* coreSubSet##sname(CORE_VECTOR_OP2(name));                            \
-    name* coreSub##sname(CORE_VECTOR_OP3(name));                               \
-    name* coreMulSet##sname(CORE_VECTOR_OP2(name));                            \
-    name* coreMul##sname(CORE_VECTOR_OP3(name));                               \
-    name* coreDivSet##sname(CORE_VECTOR_OP2(name));                            \
-    name* coreDiv##sname(CORE_VECTOR_OP3(name));                               \
-    name* coreMulSet##sname##F(name* r, type f);                               \
-    name* coreMul##sname##F(name* r, const name* a, type f);                   \
-    name* coreDivSet##sname##F(name* r, type f);                               \
-    name* coreDiv##sname##F(name* r, const name* a, type f);                   \
-    name* coreInvertSet##sname(name* r);                                       \
-    name* coreInvert##sname(name* r, const name* a);                           \
-    size_t coreToString##sname(const name* a, char* buffer, size_t n);
-
-#define CORE_DEFINE_FVECTOR(N, name)                                           \
-    float coreDotV##N(const name* a, const name* b);                           \
-    float coreSquareLengthV##N(const name* a);                                 \
-    float coreLengthV##N(const name* a);                                       \
-    name* coreNormalizeV##N(name* r);
-
-CORE_DEFINE_VECTOR(2, CoreVector2, V2, float)
-CORE_DEFINE_VECTOR(3, CoreVector3, V3, float)
-CORE_DEFINE_VECTOR(4, CoreVector4, V4, float)
-CORE_DEFINE_FVECTOR(2, CoreVector2)
-CORE_DEFINE_FVECTOR(3, CoreVector3)
-CORE_DEFINE_FVECTOR(4, CoreVector4)
-CORE_DEFINE_VECTOR(2, CoreIntVector2, IV2, int)
-CORE_DEFINE_VECTOR(3, CoreIntVector3, IV3, int)
-CORE_DEFINE_VECTOR(4, CoreIntVector4, IV4, int)
-
-CoreVector3* coreAngles(CoreVector3* r, float lengthAngle, float widthAngle);
-CoreVector3* coreCross(CORE_VECTOR_OP3(CoreVector3));
-
-#define CORE_DEFINE_VECTOR_CONVERSION(a, nameA, b, nameB)                      \
-    a* coreConvert##nameB(a* r, const b* c);                                   \
-    b* coreConvert##nameA(b* r, const a* c)
-
-CORE_DEFINE_VECTOR_CONVERSION(CoreVector2, V2, CoreIntVector2, IV2);
-CORE_DEFINE_VECTOR_CONVERSION(CoreVector3, V3, CoreIntVector3, IV3);
-CORE_DEFINE_VECTOR_CONVERSION(CoreVector4, V4, CoreIntVector4, IV4);
-
-#define CORE_VECTOR2 ((CoreVector2){0})
-#define CORE_VECTOR3 ((CoreVector3){0})
-#define CORE_VECTOR4 ((CoreVector4){0})
-#define CORE_INT_VECTOR2 ((CoreIntVector2){0})
-#define CORE_INT_VECTOR3 ((CoreIntVector3){0})
-#define CORE_INT_VECTOR4 ((CoreIntVector4){0})
-
-#ifdef IMPORT_CORE
-#define Vector2 CoreVector2
-#define addSetV2 coreAddSetV2
-#define addV2 coreAddV2
-#define subSetV2 coreSubSetV2
-#define subV2 coreSubV2
-#define mulSetV2 coreMulSetV2
-#define mulV2 coreMulV2
-#define divSetV2 coreDivSetV2
-#define divV2 coreDivV2
-#define mulSetV2F coreMulSetV2F
-#define mulV2F coreMulV2F
-#define divSetV2F coreDivSetV2F
-#define divV2F coreDivV2F
-#define invertSetV2 coreInvertSetV2
-#define invertV2 coreInvertV2
-#define toStringV2 coreToStringV2
-
-#define Vector3 CoreVector3
-#define addSetV3 coreAddSetV3
-#define addV3 coreAddV3
-#define subSetV3 coreSubSetV3
-#define subV3 coreSubV3
-#define mulSetV3 coreMulSetV3
-#define mulV3 coreMulV3
-#define divSetV3 coreDivSetV3
-#define divV3 coreDivV3
-#define mulSetV3F coreMulSetV3F
-#define mulV3F coreMulV3F
-#define divSetV3F coreDivSetV3F
-#define divV3F coreDivV3F
-#define invertSetV3 coreInvertSetV3
-#define invertV3 coreInvertV3
-#define toStringV3 coreToStringV3
-
-#define Vector4 CoreVector4
-#define addSetV4 coreAddSetV4
-#define addV4 coreAddV4
-#define subSetV4 coreSubSetV4
-#define subV4 coreSubV4
-#define mulSetV4 coreMulSetV4
-#define mulV4 coreMulV4
-#define divSetV4 coreDivSetV4
-#define divV4 coreDivV4
-#define mulSetV4F coreMulSetV4F
-#define mulV4F coreMulV4F
-#define divSetV4F coreDivSetV4F
-#define divV4F coreDivV4F
-#define invertSetV4 coreInvertSetV4
-#define invertV4 coreInvertV4
-#define toStringV4 coreToStringV4
-
-#define IntVector2 CoreIntVector2
-#define addSetIV2 coreAddSetIV2
-#define addIV2 coreAddIV2
-#define subSetIV2 coreSubSetIV2
-#define subIV2 coreSubIV2
-#define mulSetIV2 coreMulSetIV2
-#define mulIV2 coreMulIV2
-#define divSetIV2 coreDivSetIV2
-#define divIV2 coreDivIV2
-#define mulSetIV2F coreMulSetIV2F
-#define mulIV2F coreMulIV2F
-#define divSetIV2F coreDivSetIV2F
-#define divIV2F coreDivIV2F
-#define invertSetIV2 coreInvertSetIV2
-#define invertIV2 coreInvertIV2
-#define toStringIV2 coreToStringIV2
-
-#define IntVector3 CoreIntVector3
-#define addSetIV3 coreAddSetIV3
-#define addIV3 coreAddIV3
-#define subSetIV3 coreSubSetIV3
-#define subIV3 coreSubIV3
-#define mulSetIV3 coreMulSetIV3
-#define mulIV3 coreMulIV3
-#define divSetIV3 coreDivSetIV3
-#define divIV3 coreDivIV3
-#define mulSetIV3F coreMulSetIV3F
-#define mulIV3F coreMulIV3F
-#define divSetIV3F coreDivSetIV3F
-#define divIV3F coreDivIV3F
-#define invertSetIV3 coreInvertSetIV3
-#define invertIV3 coreInvertIV3
-#define toStringIV3 coreToStringIV3
-
-#define IntVector4 CoreIntVector4
-#define addSetIV4 coreAddSetIV4
-#define addIV4 coreAddIV4
-#define subSetIV4 coreSubSetIV4
-#define subIV4 coreSubIV4
-#define mulSetIV4 coreMulSetIV4
-#define mulIV4 coreMulIV4
-#define divSetIV4 coreDivSetIV4
-#define divIV4 coreDivIV4
-#define mulSetIV4F coreMulSetIV4F
-#define mulIV4F coreMulIV4F
-#define divSetIV4F coreDivSetIV4F
-#define divIV4F coreDivIV4F
-#define invertSetIV4 coreInvertSetIV4
-#define invertIV4 coreInvertIV4
-#define toStringIV4 coreToStringIV4
-
-#define dotV2 coreDotV2
-#define squareLengthV2 coreSquareLengthV2
-#define lengthV2 coreLengthV2
-#define normalizeV2 coreNormalizeV2
-
-#define dotV3 coreDotV3
-#define squareLengthV3 coreSquareLengthV3
-#define lengthV3 coreLengthV3
-#define normalizeV3 coreNormalizeV3
-
-#define dotV4 coreDotV4
-#define squareLengthV4 coreSquareLengthV4
-#define lengthV4 coreLengthV4
-#define normalizeV4 coreNormalizeV4
-
-#define angles coreAngles
-#define cross coreCross
-
-#define convertV2 coreConvertV2
-#define convertIV2 coreConvertIV2
-#define convertV3 coreConvertV3
-#define convertIV3 coreConvertIV3
-#define convertV4 coreConvertV4
-#define convertIV4 coreConvertIV4
-
-#define VECTOR2 CORE_VECTOR2
-#define VECTOR3 CORE_VECTOR3
-#define VECTOR4 CORE_VECTOR4
-#define INT_VECTOR2 CORE_INT_VECTOR2
-#define INT_VECTOR3 CORE_INT_VECTOR3
-#define INT_VECTOR4 CORE_INT_VECTOR4
+    name* addSet##sname(VECTOR_OP2(name));                                     \
+    name* add##sname(VECTOR_OP3(name));                                        \
+    name* subSet##sname(VECTOR_OP2(name));                                     \
+    name* sub##sname(VECTOR_OP3(name));                                        \
+    name* mulSet##sname(VECTOR_OP2(name));                                     \
+    name* mul##sname(VECTOR_OP3(name));                                        \
+    name* divSet##sname(VECTOR_OP2(name));                                     \
+    name* div##sname(VECTOR_OP3(name));                                        \
+    name* mulSet##sname##F(name* r, type f);                                   \
+    name* mul##sname##F(name* r, const name* a, type f);                       \
+    name* divSet##sname##F(name* r, type f);                                   \
+    name* div##sname##F(name* r, const name* a, type f);                       \
+    name* invertSet##sname(name* r);                                           \
+    name* invert##sname(name* r, const name* a);                               \
+    size_t toString##sname(const name* a, char* buffer, size_t n);
+
+#define DEFINE_FVECTOR(N, name)                                                \
+    float dotV##N(const name* a, const name* b);                               \
+    float squareLengthV##N(const name* a);                                     \
+    float lengthV##N(const name* a);                                           \
+    name* normalizeV##N(name* r);
+
+DEFINE_VECTOR(2, Vector2, V2, float)
+DEFINE_VECTOR(3, Vector3, V3, float)
+DEFINE_VECTOR(4, Vector4, V4, float)
+DEFINE_FVECTOR(2, Vector2)
+DEFINE_FVECTOR(3, Vector3)
+DEFINE_FVECTOR(4, Vector4)
+DEFINE_VECTOR(2, IntVector2, IV2, int)
+DEFINE_VECTOR(3, IntVector3, IV3, int)
+DEFINE_VECTOR(4, IntVector4, IV4, int)
+
+Vector3* angles(Vector3* r, float lengthAngle, float widthAngle);
+Vector3* cross(VECTOR_OP3(Vector3));
+
+#define DEFINE_VECTOR_CONVERSION(a, nameA, b, nameB)                           \
+    a* convert##nameB(a* r, const b* c);                                       \
+    b* convert##nameA(b* r, const a* c)
+
+DEFINE_VECTOR_CONVERSION(Vector2, V2, IntVector2, IV2);
+DEFINE_VECTOR_CONVERSION(Vector3, V3, IntVector3, IV3);
+DEFINE_VECTOR_CONVERSION(Vector4, V4, IntVector4, IV4);
+
+#define VECTOR2 ((Vector2){0})
+#define VECTOR3 ((Vector3){0})
+#define VECTOR4 ((Vector4){0})
+#define INT_VECTOR2 ((IntVector2){0})
+#define INT_VECTOR3 ((IntVector3){0})
+#define INT_VECTOR4 ((IntVector4){0})
 
 #define SELECT_VECTOR(_1, _2, _3, _4, name, ...) name
 #define V(...)                                                                 \
@@ -203,5 +68,3 @@ CORE_DEFINE_VECTOR_CONVERSION(CoreVector4, V4, CoreIntVector4, IV4);
         {__VA_ARGS__}})
 
 #endif
-
-#endif

+ 12 - 20
include/core/View.h

@@ -4,26 +4,18 @@
 #include "core/Matrix.h"
 
 typedef struct {
-    CoreMatrix view;
-    CoreVector3 back;
-    CoreVector3 down;
-    CoreVector3 front;
-    CoreVector3 left;
-    CoreVector3 right;
-    CoreVector3 up;
-} CoreView;
+    Matrix view;
+    Vector3 back;
+    Vector3 down;
+    Vector3 front;
+    Vector3 left;
+    Vector3 right;
+    Vector3 up;
+} View;
 
-void coreInitView(CoreView* v);
-void coreUpdateDirections(CoreView* v, float lengthAngle, float widthAngle);
-void coreUpdateDirectionsQ(CoreView* v, const CoreQuaternion* q);
-CoreMatrix* coreUpdateMatrix(CoreView* v, const CoreVector3* pos);
-
-#ifdef IMPORT_CORE
-#define View CoreView
-#define initView coreInitView
-#define updateDirections coreUpdateDirections
-#define updateDirectionsQ coreUpdateDirectionsQ
-#define updateMatrix coreUpdateMatrix
-#endif
+void initView(View* v);
+void updateDirections(View* v, float lengthAngle, float widthAngle);
+void updateDirectionsQ(View* v, const Quaternion* q);
+Matrix* updateMatrix(View* v, const Vector3* pos);
 
 #endif

+ 10 - 11
performance/Main.c

@@ -1,4 +1,3 @@
-#define IMPORT_CORE
 #include <stdio.h>
 
 #include "core/HashMap.h"
@@ -9,7 +8,7 @@ HASHMAP(int, int, Int)
 HASHMAP_SOURCE(int, int, Int)
 
 static i64 testSearch(const HashMapInt* m) {
-    i64 nanos = coreGetNanos();
+    i64 nanos = getNanos();
     volatile int sum = 0;
     for(int i = 0; i < 10000; i++) {
         for(int k = -5000; k < 5000; k++) {
@@ -19,11 +18,11 @@ static i64 testSearch(const HashMapInt* m) {
             }
         }
     }
-    return coreGetNanos() - nanos;
+    return getNanos() - nanos;
 }
 
 static i64 testEmptySearch(const HashMapInt* m) {
-    i64 nanos = coreGetNanos();
+    i64 nanos = getNanos();
     volatile int sum = 0;
     for(int i = 0; i < 100'000'000; i++) {
         const int* s = searchHashMapKeyInt(m, -i);
@@ -31,26 +30,26 @@ static i64 testEmptySearch(const HashMapInt* m) {
             sum = sum + *s;
         }
     }
-    return coreGetNanos() - nanos;
+    return getNanos() - nanos;
 }
 
 static void fillOrder(HashMapInt* m) {
-    i64 nanos = coreGetNanos();
+    i64 nanos = getNanos();
     for(int i = 0; i < 10000; i++) {
         *putHashMapKeyInt(m, i) = i * i;
     }
-    printf("Fill Order: %ldns\n", coreGetNanos() - nanos);
+    printf("Fill Order: %ldns\n", getNanos() - nanos);
 }
 
 static void fillChaos(HashMapInt* m) {
-    i64 nanos = coreGetNanos();
+    i64 nanos = getNanos();
     Random random;
-    coreInitRandom(&random, 0);
+    initRandom(&random, 0);
     for(int i = 0; i < 10000; i++) {
-        int r = coreRandomI32(&random, 0, 10000);
+        int r = randomI32(&random, 0, 10000);
         *putHashMapKeyInt(m, r) = r * r;
     }
-    printf("Fill Chaos: %ldns\n", coreGetNanos() - nanos);
+    printf("Fill Chaos: %ldns\n", getNanos() - nanos);
 }
 
 static i64 average(HashMapInt* m, i64 (*f)(const HashMapInt* m), int n) {

+ 3 - 4
src/BitArray.c

@@ -1,4 +1,3 @@
-#define IMPORT_CORE
 #include "core/BitArray.h"
 
 #include <assert.h>
@@ -54,7 +53,7 @@ void initBitArray(BitArray* a, size_t length, size_t bits) {
 }
 
 void destroyBitArray(BitArray* a) {
-    cFree(a->data);
+    coreFree(a->data);
     *a = (BitArray){0};
 }
 
@@ -109,7 +108,7 @@ void setBitLength(BitArray* a, size_t newLength, size_t newBits) {
         newBits = 64;
     }
     size_t arrayLength = getArrayLength(newLength, newBits);
-    u64* newData = cAllocate(sizeof(u64) * arrayLength);
+    u64* newData = coreAllocate(sizeof(u64) * arrayLength);
     memset(newData, 0, arrayLength * sizeof(u64));
 
     size_t end = minSize(a->length, newLength);
@@ -119,7 +118,7 @@ void setBitLength(BitArray* a, size_t newLength, size_t newBits) {
     for(size_t i = end; i < newLength; i++) {
         writeBits(newData, i, newBits, 0);
     }
-    cFree(a->data);
+    coreFree(a->data);
     a->data = newData;
     a->length = newLength & 0xFFFFFFFFFFFFFF;
     a->bits = newBits & 0xFF;

+ 0 - 1
src/Box.c

@@ -1,4 +1,3 @@
-#define IMPORT_CORE
 #include "core/Box.h"
 
 #include "core/Generic.h"

+ 2 - 3
src/Buffer.c

@@ -1,4 +1,3 @@
-#define IMPORT_CORE
 #include "core/Buffer.h"
 
 #include <string.h>
@@ -12,14 +11,14 @@ void initBuffer(Buffer* b) {
 }
 
 void destroyBuffer(Buffer* b) {
-    cFree(b->buffer);
+    coreFree(b->buffer);
     initBuffer(b);
 }
 
 void addSizedBufferData(Buffer* b, const void* data, size_t size) {
     while(b->size + size >= b->capacity) {
         b->capacity = b->capacity == 0 ? 8 : (b->capacity * 5) / 4;
-        b->buffer = cReallocate(b->buffer, b->capacity);
+        b->buffer = coreReallocate(b->buffer, b->capacity);
     }
     memcpy(b->buffer + b->size, data, size);
     b->size += size;

+ 0 - 1
src/Frustum.c

@@ -1,4 +1,3 @@
-#define IMPORT_CORE
 #include "core/Frustum.h"
 
 #include <math.h>

+ 2 - 3
src/Logger.c

@@ -1,4 +1,3 @@
-#define IMPORT_CORE
 #include "core/Logger.h"
 
 #include <stdarg.h>
@@ -16,8 +15,8 @@ const char* getShortFileName(const char* s) {
     return r;
 }
 
-void coreLog(LogLevel l, const char* file, int line, const char* prefix,
-             const char* tag, const char* format, ...) {
+void printLog(LogLevel l, const char* file, int line, const char* prefix,
+              const char* tag, const char* format, ...) {
     if(logLevel < l) {
         return;
     }

+ 0 - 1
src/Matrix.c

@@ -1,4 +1,3 @@
-#define IMPORT_CORE
 #include <math.h>
 #include <stdio.h>
 

+ 0 - 1
src/Plane.c

@@ -1,4 +1,3 @@
-#define IMPORT_CORE
 #include "core/Plane.h"
 
 #include "core/Generic.h"

+ 0 - 1
src/Quaternion.c

@@ -1,4 +1,3 @@
-#define IMPORT_CORE
 #include <math.h>
 
 #include "core/Generic.h"

+ 2 - 3
src/Queue.c

@@ -1,4 +1,3 @@
-#define IMPORT_CORE
 #include "core/Queue.h"
 
 #include <assert.h>
@@ -13,7 +12,7 @@ void initQueue(Queue* r, size_t capacity, size_t dataSize) {
 }
 
 void destroyQueue(Queue* r) {
-    cFree(r->data);
+    coreFree(r->data);
     *r = (Queue){0};
 }
 
@@ -25,7 +24,7 @@ void pushQueueData(Queue* r, const void* data) {
     if(r->length >= r->capacity) {
         return;
     } else if(r->data == nullptr) {
-        r->data = cAllocate(r->capacity * r->dataSize);
+        r->data = coreAllocate(r->capacity * r->dataSize);
     }
     memcpy(getPointer(r, r->writeIndex), data, r->dataSize);
     r->writeIndex = (r->writeIndex + 1) % r->capacity;

+ 0 - 1
src/Random.c

@@ -1,4 +1,3 @@
-#define IMPORT_CORE
 #include "core/Random.h"
 
 static const size_t M = 7;

+ 0 - 1
src/ReadLine.c

@@ -1,4 +1,3 @@
-#define IMPORT_CORE
 #include "core/ReadLine.h"
 
 #include <ctype.h>

+ 0 - 1
src/SpinLock.c

@@ -1,4 +1,3 @@
-#define IMPORT_CORE
 #include "core/SpinLock.h"
 
 #include <threads.h>

+ 12 - 16
src/Test.c

@@ -1,4 +1,3 @@
-#define IMPORT_CORE
 #include "core/Test.h"
 
 #include <stdio.h>
@@ -8,8 +7,6 @@
 #include "core/Logger.h"
 #include "core/Utility.h"
 
-#define TEST_ARGS CORE_TEST_ARGS
-
 typedef struct {
     char* file;
     int tests;
@@ -29,7 +26,7 @@ static Result* getResult(const char* file) {
     }
     while(resultsIndex >= resultsCapacity) {
         size_t newCapacity = resultsCapacity == 0 ? 8 : resultsCapacity * 2;
-        results = cReallocate(results, newCapacity * sizeof(Result));
+        results = coreReallocate(results, newCapacity * sizeof(Result));
         resultsCapacity = newCapacity;
     }
     Result* r = results + (resultsIndex++);
@@ -49,7 +46,7 @@ void finalizeTests(void) {
         puts(TERMINAL_RESET);
         free(r->file);
     }
-    cFree(results);
+    coreFree(results);
     results = nullptr;
     resultsIndex = 0;
     resultsCapacity = 0;
@@ -72,7 +69,7 @@ static bool addToResult(const char* file, bool comparison) {
     }
 
 #define TEST_NAMED_COMPARE(name, type, format)                                 \
-    bool coreTest##name(TEST_ARGS, type wanted, type actual) {                 \
+    bool test##name(TEST_ARGS, type wanted, type actual) {                     \
         TEST_SUCCESS(wanted == actual)                                         \
         fputs(TERMINAL_RED, stdout);                                           \
         printf("%s:%d - expected '" format "' got '" format "'", file, line,   \
@@ -87,7 +84,7 @@ TEST_NAMED_COMPARE(U64, u64, "%lu")
 TEST_NAMED_COMPARE(Size, size_t, "%zu")
 TEST_NAMED_COMPARE(Bool, bool, "%d")
 
-bool coreTestString(TEST_ARGS, const char* wanted, const char* actual) {
+bool testString(TEST_ARGS, const char* wanted, const char* actual) {
     TEST_SUCCESS(strcmp(wanted, actual) == 0)
     fputs(TERMINAL_RED, stdout);
     printf("%s:%d - expected '%s' got '%s'", file, line, wanted, actual);
@@ -95,7 +92,7 @@ bool coreTestString(TEST_ARGS, const char* wanted, const char* actual) {
     return false;
 }
 
-bool coreTestFloat(TEST_ARGS, float wanted, float actual, float error) {
+bool testFloat(TEST_ARGS, float wanted, float actual, float error) {
     float diff = wanted - actual;
     diff = diff < 0.0f ? -diff : diff;
     TEST_SUCCESS(diff <= error)
@@ -106,7 +103,7 @@ bool coreTestFloat(TEST_ARGS, float wanted, float actual, float error) {
     return false;
 }
 
-bool coreTestNull(TEST_ARGS, const void* actual) {
+bool testNull(TEST_ARGS, const void* actual) {
     TEST_SUCCESS(actual == nullptr)
     fputs(TERMINAL_RED, stdout);
     printf("%s:%d - expected null", file, line);
@@ -114,7 +111,7 @@ bool coreTestNull(TEST_ARGS, const void* actual) {
     return false;
 }
 
-bool coreTestNotNull(TEST_ARGS, const void* actual) {
+bool testNotNull(TEST_ARGS, const void* actual) {
     TEST_SUCCESS(actual != nullptr)
     fputs(TERMINAL_RED, stdout);
     printf("%s:%d - expected valid pointer", file, line);
@@ -122,20 +119,19 @@ bool coreTestNotNull(TEST_ARGS, const void* actual) {
     return false;
 }
 
-bool coreTestVectorN(TEST_ARGS, const float* wanted, const float* actual,
-                     size_t n) {
+bool testVectorN(TEST_ARGS, const float* wanted, const float* actual,
+                 size_t n) {
     for(size_t i = 0; i < n; i++) {
-        if(!coreTestFloat(file, line, wanted[i], actual[i], 0.01f)) {
+        if(!testFloat(file, line, wanted[i], actual[i], 0.01f)) {
             return false;
         }
     }
     return true;
 }
 
-bool coreTestIntVectorN(TEST_ARGS, const int* wanted, const int* actual,
-                        size_t n) {
+bool testIntVectorN(TEST_ARGS, const int* wanted, const int* actual, size_t n) {
     for(size_t i = 0; i < n; i++) {
-        if(!coreTestInt(file, line, wanted[i], actual[i])) {
+        if(!testInt(file, line, wanted[i], actual[i])) {
             return false;
         }
     }

+ 0 - 1
src/ToString.c

@@ -1,4 +1,3 @@
-#define IMPORT_CORE
 #include "core/ToString.h"
 
 #include <stdarg.h>

+ 2 - 3
src/Utility.c

@@ -1,4 +1,3 @@
-#define IMPORT_CORE
 #include "core/Utility.h"
 
 #include <stdio.h>
@@ -27,7 +26,7 @@ size_t popCount(u64 u) {
     return sum;
 }
 
-[[noreturn]] void coreExitWithHandler(const char* file, int line, int value) {
+[[noreturn]] void exitWithHandler(const char* file, int line, int value) {
     if(value != 0) {
         file = getShortFileName(file);
         LOG_ERROR("Exit from %s:%d with value %d", file, line, value);
@@ -84,7 +83,7 @@ static void RealFree(void* p) {
     free(p);
 }
 
-#ifdef CORE_CHECK_MEMORY
+#ifdef CHECK_MEMORY
 static const u8 CANARY[16] = {0xDE, 0xAD, 0xBE, 0xEF, 0xDE, 0xAD, 0xBE, 0xEF,
                               0xDE, 0xAD, 0xBE, 0xEF, 0xDE, 0xAD, 0xBE, 0xEF};
 

+ 0 - 1
src/Vector.c

@@ -1,4 +1,3 @@
-#define IMPORT_CORE
 #include "core/Vector.h"
 
 #include <math.h>

+ 0 - 1
src/View.c

@@ -1,4 +1,3 @@
-#define IMPORT_CORE
 #include "core/View.h"
 
 #include "core/Generic.h"

+ 0 - 1
test/Main.c

@@ -1,4 +1,3 @@
-#define IMPORT_CORE
 #include <locale.h>
 #include <stdio.h>
 #include <string.h>

+ 0 - 1
test/modules/BitArrayTests.c

@@ -1,4 +1,3 @@
-#define IMPORT_CORE
 #include "../Tests.h"
 #include "core/BitArray.h"
 #include "core/ToString.h"

+ 0 - 1
test/modules/BoxTests.c

@@ -1,4 +1,3 @@
-#define IMPORT_CORE
 #include "../Tests.h"
 #include "core/Box.h"
 #include "core/ToString.h"

+ 0 - 1
test/modules/BufferTests.c

@@ -1,4 +1,3 @@
-#define IMPORT_CORE
 #include "../Tests.h"
 #include "core/Buffer.h"
 

+ 0 - 1
test/modules/ComponentsTests.c

@@ -1,4 +1,3 @@
-#define IMPORT_CORE
 #include "../Tests.h"
 #include "core/Components.h"
 

+ 0 - 1
test/modules/FrustumTests.c

@@ -1,4 +1,3 @@
-#define IMPORT_CORE
 #include "../Tests.h"
 #include "core/Frustum.h"
 #include "core/ToString.h"

+ 1 - 2
test/modules/HashMapTests.c

@@ -1,4 +1,3 @@
-#define IMPORT_CORE
 #include "../Tests.h"
 #include "core/HashMap.h"
 #include "core/ToString.h"
@@ -252,7 +251,7 @@ static void testSearchStruct() {
 
     char buffer[128];
     size_t n = toStringHashMapA(&map, buffer, sizeof(buffer),
-                                (CoreToString)toStringA, coreToStringInt);
+                                (ToString)toStringA, toStringInt);
     TEST_SIZE(24, n);
     TEST_STRING("[{5, 6} = 5, {1, 2} = 3]", buffer);
 

+ 2 - 3
test/modules/ListTests.c

@@ -1,4 +1,3 @@
-#define IMPORT_CORE
 #include "../Tests.h"
 #include "core/List.h"
 #include "core/ToString.h"
@@ -183,7 +182,7 @@ static void testStruct() {
     addListDataV3(&list, v);
     addListDataV3(&list, (Vector3){{2, 3, 4}});
     char buffer[128];
-    size_t n = toStringListV3(&list, buffer, sizeof(buffer), coreToStringV3);
+    size_t n = toStringListV3(&list, buffer, sizeof(buffer), toStringV3);
     TEST_SIZE(46, n);
     TEST_STRING("[[1.000, 2.000, 3.000], [2.000, 3.000, 4.000]]", buffer);
     addLastListDataV3(&list);
@@ -206,7 +205,7 @@ static void testIntList() {
     addListDataInt(&list, 7);
     char buffer[128];
     size_t n = toStringListInt(&list, buffer, sizeof(buffer),
-                               (ToStringInt)coreToStringInt);
+                               (ToStringInt)toStringInt);
     TEST_SIZE(6, n);
     TEST_STRING("[5, 7]", buffer);
     addLastListDataInt(&list);

+ 0 - 1
test/modules/MatrixTests.c

@@ -1,4 +1,3 @@
-#define IMPORT_CORE
 #include "../Tests.h"
 #include "core/Generic.h"
 #include "core/ToString.h"

+ 0 - 1
test/modules/PlaneTests.c

@@ -1,4 +1,3 @@
-#define IMPORT_CORE
 #include "../Tests.h"
 #include "core/Plane.h"
 #include "core/ToString.h"

+ 0 - 1
test/modules/QuaternionTests.c

@@ -1,4 +1,3 @@
-#define IMPORT_CORE
 #include "../Tests.h"
 #include "core/Generic.h"
 

+ 0 - 1
test/modules/QueueTests.c

@@ -1,4 +1,3 @@
-#define IMPORT_CORE
 #include "../Tests.h"
 #include "core/Queue.h"
 #include "core/ToString.h"

+ 0 - 1
test/modules/RandomTests.c

@@ -1,4 +1,3 @@
-#define IMPORT_CORE
 #include "../Tests.h"
 #include "core/Random.h"
 

+ 16 - 17
test/modules/ReadLineTests.c

@@ -1,4 +1,3 @@
-#define IMPORT_CORE
 #include <stdio.h>
 #include <threads.h>
 
@@ -11,7 +10,7 @@ static void sleepMillis(int millis) {
     thrd_sleep(&t, nullptr);
 }
 
-static void testString(int line, const char* s) {
+static void testStringError(int line, const char* s) {
     char buffer[256];
     for(int i = 0; i < 200; i++) {
         if(readLine(buffer, sizeof(buffer))) {
@@ -19,7 +18,7 @@ static void testString(int line, const char* s) {
         }
         sleepMillis(10);
     }
-    if(!coreTestString(__FILE__, line, s, buffer)) {
+    if(!testString(__FILE__, line, s, buffer)) {
         const char* p = buffer;
         printf("Invalid sequence: ");
         while(*p != 0) {
@@ -55,28 +54,28 @@ void testReadLine(void) {
     if(!TEST_FALSE(startReadLine())) {
         return;
     }
-    testString(__LINE__, "wusi");
+    testStringError(__LINE__, "wusi");
 #ifdef ERROR_SIMULATOR
     failMutexLock = false;
     failMutexUnlock = false;
 #endif
-    testString(__LINE__, "gusi");
-    testString(__LINE__, "abc");
-    testString(__LINE__, "abc");
-    testString(__LINE__, "abd");
-    testString(__LINE__, "abö");
-    testString(__LINE__, "ghi");
-    testString(__LINE__, "abcghi");
-    testString(__LINE__, "abcghi");
-    testString(__LINE__, "abö");
-    testString(__LINE__, "abac");
-    testString(
+    testStringError(__LINE__, "gusi");
+    testStringError(__LINE__, "abc");
+    testStringError(__LINE__, "abc");
+    testStringError(__LINE__, "abd");
+    testStringError(__LINE__, "abö");
+    testStringError(__LINE__, "ghi");
+    testStringError(__LINE__, "abcghi");
+    testStringError(__LINE__, "abcghi");
+    testStringError(__LINE__, "abö");
+    testStringError(__LINE__, "abac");
+    testStringError(
         __LINE__,
         "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
         "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
         "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
         "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbb");
-    testString(__LINE__, "abäo");
-    testString(__LINE__, "bäöo");
+    testStringError(__LINE__, "abäo");
+    testStringError(__LINE__, "bäöo");
     stopReadLine();
 }

+ 0 - 1
test/modules/SpinLockTests.c

@@ -1,4 +1,3 @@
-#define IMPORT_CORE
 #include <stdio.h>
 #include <threads.h>
 

+ 0 - 1
test/modules/TestTests.c

@@ -1,4 +1,3 @@
-#define IMPORT_CORE
 #include "../Tests.h"
 #include "core/Vector.h"
 

+ 20 - 21
test/modules/UtilityTests.c

@@ -1,4 +1,3 @@
-#define IMPORT_CORE
 #include "../../src/ErrorSimulator.h"
 #include "../Tests.h"
 #include "core/Utility.h"
@@ -17,22 +16,22 @@ static void testPopCount() {
 }
 
 static void testZeroRellocate() {
-    void* buffer = cReallocate(nullptr, 16);
+    void* buffer = coreReallocate(nullptr, 16);
     TEST_NOT_NULL(buffer);
-    buffer = cReallocate(buffer, 0);
+    buffer = coreReallocate(buffer, 0);
     TEST_NULL(buffer);
 }
 
 static void testMemoryInfoList() {
-    void* a = cAllocate(8);
-    void* b = cAllocate(8);
-    void* c = cAllocate(8);
-    void* d = cAllocate(8);
-    cFree(b); // remove middle element
-    cFree(a); // remove first
-    cFree(d); // remove last
-    cFree(c); // remove single
-    cFree(nullptr);
+    void* a = coreAllocate(8);
+    void* b = coreAllocate(8);
+    void* c = coreAllocate(8);
+    void* d = coreAllocate(8);
+    coreFree(b); // remove middle element
+    coreFree(a); // remove first
+    coreFree(d); // remove last
+    coreFree(c); // remove single
+    coreFree(nullptr);
 }
 
 static void testInterpolate() {
@@ -106,7 +105,7 @@ static void outOfMemory(void*) {
 
 void testInvalidAllocate(void) {
     setOutOfMemoryHandler(outOfMemory, nullptr);
-    cAllocate(0xFFFFFFFFFFF);
+    coreAllocate(0xFFFFFFFFFFF);
     TEST_TRUE(false);
     finalizeTests();
     EXIT(0);
@@ -114,19 +113,19 @@ void testInvalidAllocate(void) {
 
 void testInvalidReallocate(void) {
     setOutOfMemoryHandler(outOfMemory, nullptr);
-    void* p = cAllocate(0xFF);
+    void* p = coreAllocate(0xFF);
     printMemoryReport();
-    cReallocate(p, 0xFFFFFFFFFFF);
+    coreReallocate(p, 0xFFFFFFFFFFF);
     TEST_TRUE(false);
     finalizeTests();
     EXIT(0);
 }
 
 [[noreturn]] void testPreCanary(void) {
-#ifdef CORE_CHECK_MEMORY
-    char* p = cAllocate(16);
+#ifdef CHECK_MEMORY
+    char* p = coreAllocate(16);
     p[-1] = 0;
-    cFree(p);
+    coreFree(p);
     TEST_TRUE(false);
 #endif
     finalizeTests();
@@ -134,10 +133,10 @@ void testInvalidReallocate(void) {
 }
 
 [[noreturn]] void testPostCanary(void) {
-#ifdef CORE_CHECK_MEMORY
-    char* p = cAllocate(16);
+#ifdef CHECK_MEMORY
+    char* p = coreAllocate(16);
     p[17] = 0;
-    cFree(p);
+    coreFree(p);
     TEST_TRUE(false);
 #endif
     finalizeTests();

+ 0 - 1
test/modules/VectorTests.c

@@ -1,4 +1,3 @@
-#define IMPORT_CORE
 #include <math.h>
 
 #include "../Tests.h"

+ 0 - 1
test/modules/ViewTests.c

@@ -1,4 +1,3 @@
-#define IMPORT_CORE
 #include "../Tests.h"
 #include "core/ToString.h"
 #include "core/View.h"