bring back error.h to reduce compile dependencies

Sat, 03 May 2025 14:30:56 +0200

author
Mike Becker <universe@uap-core.de>
date
Sat, 03 May 2025 14:30:56 +0200
changeset 106
895f92cff6b8
parent 105
2b7f92ff2c15
child 107
a35b39abe2b2

bring back error.h to reduce compile dependencies

src/Makefile file | annotate | diff | comparison | revisions
src/ascension/context.h file | annotate | diff | comparison | revisions
src/ascension/core.h file | annotate | diff | comparison | revisions
src/ascension/error.h file | annotate | diff | comparison | revisions
src/camera.c file | annotate | diff | comparison | revisions
src/context.c file | annotate | diff | comparison | revisions
src/error.c file | annotate | diff | comparison | revisions
src/font.c file | annotate | diff | comparison | revisions
src/glcontext.c file | annotate | diff | comparison | revisions
src/mesh.c file | annotate | diff | comparison | revisions
src/primitives.c file | annotate | diff | comparison | revisions
src/scene.c file | annotate | diff | comparison | revisions
src/shader.c file | annotate | diff | comparison | revisions
src/text.c file | annotate | diff | comparison | revisions
src/texture.c file | annotate | diff | comparison | revisions
src/window.c file | annotate | diff | comparison | revisions
test/snake/Makefile file | annotate | diff | comparison | revisions
--- a/src/Makefile	Sat May 03 13:49:24 2025 +0200
+++ b/src/Makefile	Sat May 03 14:30:56 2025 +0200
@@ -27,12 +27,12 @@
 
 BUILD_DIR=../build/lib
 
-SRC = context.c glcontext.c filesystem.c window.c \
-	  shader.c \
-	  mesh.c primitives.c texture.c \
-	  sprite.c \
-	  camera.c scene.c scene_node.c \
-	  font.c text.c
+SRC = context.c glcontext.c filesystem.c error.c \
+      window.c shader.c mesh.c texture.c \
+      sprite.c \
+      primitives.c \
+      camera.c scene.c scene_node.c \
+      font.c text.c
 
 OBJ = $(SRC:%.c=$(BUILD_DIR)/%.o)
 
@@ -45,12 +45,8 @@
 
 FORCE:
 
-$(BUILD_DIR)/camera.o: camera.c ascension/context.h ascension/datatypes.h \
- ascension/window.h ascension/glcontext.h ascension/primitives.h \
- ascension/mesh.h ascension/shader.h ascension/texture.h \
- ascension/scene.h ascension/scene_node.h ascension/transform.h \
- ascension/camera.h ascension/input.h ascension/ui/font.h \
- ascension/camera.h
+$(BUILD_DIR)/camera.o: camera.c ascension/error.h ascension/camera.h \
+ ascension/datatypes.h
 	@echo "Compiling $<"
 	$(CC) -o $@ $(CFLAGS) -c $<
 
@@ -59,7 +55,16 @@
  ascension/primitives.h ascension/mesh.h ascension/shader.h \
  ascension/texture.h ascension/scene.h ascension/scene_node.h \
  ascension/transform.h ascension/camera.h ascension/input.h \
- ascension/ui/font.h
+ ascension/ui/font.h ascension/error.h
+	@echo "Compiling $<"
+	$(CC) -o $@ $(CFLAGS) -c $<
+
+$(BUILD_DIR)/error.o: error.c ascension/context.h ascension/datatypes.h \
+ ascension/window.h ascension/glcontext.h ascension/primitives.h \
+ ascension/mesh.h ascension/shader.h ascension/texture.h \
+ ascension/scene.h ascension/scene_node.h ascension/transform.h \
+ ascension/camera.h ascension/input.h ascension/ui/font.h \
+ ascension/error.h
 	@echo "Compiling $<"
 	$(CC) -o $@ $(CFLAGS) -c $<
 
@@ -67,49 +72,38 @@
 	@echo "Compiling $<"
 	$(CC) -o $@ $(CFLAGS) -c $<
 
-$(BUILD_DIR)/font.o: font.c ascension/context.h ascension/datatypes.h \
- ascension/window.h ascension/glcontext.h ascension/primitives.h \
- ascension/mesh.h ascension/shader.h ascension/texture.h \
- ascension/scene.h ascension/scene_node.h ascension/transform.h \
- ascension/camera.h ascension/input.h ascension/ui/font.h \
- ascension/filesystem.h ascension/ui/font.h
+$(BUILD_DIR)/font.o: font.c ascension/error.h ascension/context.h \
+ ascension/datatypes.h ascension/window.h ascension/glcontext.h \
+ ascension/primitives.h ascension/mesh.h ascension/shader.h \
+ ascension/texture.h ascension/scene.h ascension/scene_node.h \
+ ascension/transform.h ascension/camera.h ascension/input.h \
+ ascension/ui/font.h ascension/filesystem.h ascension/ui/font.h
 	@echo "Compiling $<"
 	$(CC) -o $@ $(CFLAGS) -c $<
 
 $(BUILD_DIR)/glcontext.o: glcontext.c ascension/glcontext.h \
  ascension/primitives.h ascension/mesh.h ascension/shader.h \
- ascension/texture.h ascension/context.h ascension/datatypes.h \
- ascension/window.h ascension/glcontext.h ascension/scene.h \
- ascension/scene_node.h ascension/transform.h ascension/camera.h \
- ascension/input.h ascension/ui/font.h
+ ascension/texture.h ascension/error.h
 	@echo "Compiling $<"
 	$(CC) -o $@ $(CFLAGS) -c $<
 
-$(BUILD_DIR)/mesh.o: mesh.c ascension/mesh.h ascension/context.h \
+$(BUILD_DIR)/mesh.o: mesh.c ascension/error.h ascension/mesh.h
+	@echo "Compiling $<"
+	$(CC) -o $@ $(CFLAGS) -c $<
+
+$(BUILD_DIR)/primitives.o: primitives.c ascension/primitives.h \
+ ascension/mesh.h ascension/error.h
+	@echo "Compiling $<"
+	$(CC) -o $@ $(CFLAGS) -c $<
+
+$(BUILD_DIR)/scene.o: scene.c ascension/error.h ascension/context.h \
  ascension/datatypes.h ascension/window.h ascension/glcontext.h \
  ascension/primitives.h ascension/mesh.h ascension/shader.h \
  ascension/texture.h ascension/scene.h ascension/scene_node.h \
  ascension/transform.h ascension/camera.h ascension/input.h \
- ascension/ui/font.h
-	@echo "Compiling $<"
-	$(CC) -o $@ $(CFLAGS) -c $<
-
-$(BUILD_DIR)/primitives.o: primitives.c ascension/primitives.h \
- ascension/mesh.h ascension/context.h ascension/datatypes.h \
- ascension/window.h ascension/glcontext.h ascension/primitives.h \
- ascension/shader.h ascension/texture.h ascension/scene.h \
- ascension/scene_node.h ascension/transform.h ascension/camera.h \
- ascension/input.h ascension/ui/font.h
-	@echo "Compiling $<"
-	$(CC) -o $@ $(CFLAGS) -c $<
-
-$(BUILD_DIR)/scene.o: scene.c ascension/scene.h ascension/datatypes.h \
- ascension/scene_node.h ascension/transform.h ascension/camera.h \
- ascension/context.h ascension/window.h ascension/glcontext.h \
- ascension/primitives.h ascension/mesh.h ascension/shader.h \
- ascension/texture.h ascension/scene.h ascension/input.h \
- ascension/ui/font.h ascension/2d.h ascension/2d/sprite.h \
- ascension/2d/../scene_node.h ascension/2d/../texture.h
+ ascension/ui/font.h ascension/scene.h ascension/shader.h ascension/2d.h \
+ ascension/2d/sprite.h ascension/2d/../scene_node.h \
+ ascension/2d/../texture.h
 	@echo "Compiling $<"
 	$(CC) -o $@ $(CFLAGS) -c $<
 
@@ -127,7 +121,7 @@
  ascension/mesh.h ascension/shader.h ascension/texture.h \
  ascension/scene.h ascension/scene_node.h ascension/transform.h \
  ascension/camera.h ascension/input.h ascension/ui/font.h \
- ascension/shader.h ascension/filesystem.h
+ ascension/error.h ascension/shader.h ascension/filesystem.h
 	@echo "Compiling $<"
 	$(CC) -o $@ $(CFLAGS) -c $<
 
@@ -142,17 +136,18 @@
 	@echo "Compiling $<"
 	$(CC) -o $@ $(CFLAGS) -c $<
 
-$(BUILD_DIR)/text.o: text.c ascension/context.h ascension/datatypes.h \
- ascension/window.h ascension/glcontext.h ascension/primitives.h \
- ascension/mesh.h ascension/shader.h ascension/texture.h \
- ascension/scene.h ascension/scene_node.h ascension/transform.h \
- ascension/camera.h ascension/input.h ascension/ui/font.h \
- ascension/ui/text.h ascension/ui/font.h ascension/ui/../2d/sprite.h \
- ascension/ui/../2d/../scene_node.h ascension/ui/../2d/../texture.h
+$(BUILD_DIR)/text.o: text.c ascension/error.h ascension/context.h \
+ ascension/datatypes.h ascension/window.h ascension/glcontext.h \
+ ascension/primitives.h ascension/mesh.h ascension/shader.h \
+ ascension/texture.h ascension/scene.h ascension/scene_node.h \
+ ascension/transform.h ascension/camera.h ascension/input.h \
+ ascension/ui/font.h ascension/ui/text.h ascension/ui/font.h \
+ ascension/ui/../2d/sprite.h ascension/ui/../2d/../scene_node.h \
+ ascension/ui/../2d/../texture.h
 	@echo "Compiling $<"
 	$(CC) -o $@ $(CFLAGS) -c $<
 
-$(BUILD_DIR)/texture.o: texture.c ascension/context.h \
+$(BUILD_DIR)/texture.o: texture.c ascension/error.h ascension/context.h \
  ascension/datatypes.h ascension/window.h ascension/glcontext.h \
  ascension/primitives.h ascension/mesh.h ascension/shader.h \
  ascension/texture.h ascension/scene.h ascension/scene_node.h \
@@ -161,12 +156,12 @@
 	@echo "Compiling $<"
 	$(CC) -o $@ $(CFLAGS) -c $<
 
-$(BUILD_DIR)/window.o: window.c ascension/window.h ascension/datatypes.h \
- ascension/glcontext.h ascension/primitives.h ascension/mesh.h \
- ascension/shader.h ascension/texture.h ascension/scene.h \
- ascension/scene_node.h ascension/transform.h ascension/camera.h \
- ascension/context.h ascension/window.h ascension/input.h \
- ascension/ui/font.h
+$(BUILD_DIR)/window.o: window.c ascension/error.h ascension/window.h \
+ ascension/datatypes.h ascension/glcontext.h ascension/primitives.h \
+ ascension/mesh.h ascension/shader.h ascension/texture.h \
+ ascension/scene.h ascension/scene_node.h ascension/transform.h \
+ ascension/camera.h ascension/context.h ascension/window.h \
+ ascension/input.h ascension/ui/font.h
 	@echo "Compiling $<"
 	$(CC) -o $@ $(CFLAGS) -c $<
 
--- a/src/ascension/context.h	Sat May 03 13:49:24 2025 +0200
+++ b/src/ascension/context.h	Sat May 03 14:30:56 2025 +0200
@@ -54,27 +54,6 @@
 #define asc_set_flag(reg, flag) (reg |= flag)
 #define asc_set_flag_masked(reg, mask, flag) (reg = (reg & ~(mask)) | flag)
 
-
-
-void asc_error_impl(const char* file, unsigned line, char const* fmt, ...);
-#define asc_error(...) asc_error_impl(__FILE__, __LINE__, __VA_ARGS__)
-
-void asc_error_gl(unsigned code, const char *message);
-
-int asc_error_catch_all_gl(void);
-
-bool asc_has_error(void);
-char const* asc_get_error(void);
-void asc_clear_error(void);
-
-#define asc_wprintf(...) printf("[WARNING %s %u] ", __FILE__, __LINE__); printf(__VA_ARGS__); putchar('\n')
-#ifdef NDEBUG
-#define asc_dprintf(...)
-#else
-#define asc_dprintf(...) printf("[DEBUG %s %u] ", __FILE__, __LINE__); printf(__VA_ARGS__); putchar('\n')
-#endif
-
-
 /**
  * The global ascension context.
  */
--- a/src/ascension/core.h	Sat May 03 13:49:24 2025 +0200
+++ b/src/ascension/core.h	Sat May 03 14:30:56 2025 +0200
@@ -28,6 +28,7 @@
 #ifndef ASCENSION_CORE_H
 #define ASCENSION_CORE_H
 
+#include "error.h"
 #include "context.h"
 #include "shader.h"
 #include "scene.h"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/ascension/error.h	Sat May 03 14:30:56 2025 +0200
@@ -0,0 +1,52 @@
+/*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ * Copyright 2025 Mike Becker. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *   1. Redistributions of source code must retain the above copyright
+ *      notice, this list of conditions and the following disclaimer.
+ *
+ *   2. Redistributions in binary form must reproduce the above copyright
+ *      notice, this list of conditions and the following disclaimer in the
+ *      documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ASC_ERROR_H
+#define ASC_ERROR_H
+
+#include <stdio.h>
+
+void asc_error_impl(const char* file, unsigned line, char const* fmt, ...);
+#define asc_error(...) asc_error_impl(__FILE__, __LINE__, __VA_ARGS__)
+
+void asc_error_gl(unsigned code, const char *message);
+
+int asc_error_catch_all_gl(void);
+
+bool asc_has_error(void);
+char const* asc_get_error(void);
+void asc_clear_error(void);
+
+#define asc_wprintf(...) printf("[WARNING %s %u] ", __FILE__, __LINE__); printf(__VA_ARGS__); putchar('\n')
+#ifdef NDEBUG
+#define asc_dprintf(...)
+#else
+#define asc_dprintf(...) printf("[DEBUG %s %u] ", __FILE__, __LINE__); printf(__VA_ARGS__); putchar('\n')
+#endif
+
+
+#endif
--- a/src/camera.c	Sat May 03 13:49:24 2025 +0200
+++ b/src/camera.c	Sat May 03 14:30:56 2025 +0200
@@ -25,7 +25,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include "ascension/context.h"
+#include "ascension/error.h"
 #include "ascension/camera.h"
 
 void asc_camera_init(AscCamera *camera, AscCameraParams params) {
--- a/src/context.c	Sat May 03 13:49:24 2025 +0200
+++ b/src/context.c	Sat May 03 14:30:56 2025 +0200
@@ -26,96 +26,18 @@
  */
 
 #include "ascension/context.h"
+#include "ascension/error.h"
 
 #include <SDL2/SDL.h>
 #include <SDL2/SDL_ttf.h>
 #include <SDL2/SDL_image.h>
 
-#include <GL/gl.h>
-
-#include <cx/printf.h>
+#include <GL/glew.h>
 
 #include <time.h>
 
 AscContext asc_context;
 
-void asc_error_impl(const char* file, unsigned line, char const* fmt, ...) {
-    asc_set_flag(asc_context.flags, ASC_FLAG_HAS_ERROR);
-
-    // write to error buffer
-    va_list args;
-    va_start(args, fmt);
-    CxBuffer* buf = &asc_context.error_buffer;
-    size_t bufpos = buf->pos;
-    int written = cx_vfprintf(buf, cxBufferWriteFunc, fmt, args);
-    cxBufferPut(buf, '\n');
-    va_end(args);
-
-    // also print to stderr
-    // avoid double-formatting, get it directly from the buffer
-    fprintf(stderr, "[ERROR %s %u] %.*s\n",
-        file, line, written, buf->space+bufpos);
-}
-
-bool asc_has_error(void) {
-    return asc_test_flag(asc_context.flags, ASC_FLAG_HAS_ERROR);
-}
-
-char const* asc_get_error(void) {
-    // we zero-terminate the current buffer contents before providing them
-    cxBufferPut(&asc_context.error_buffer, 0);
-    --asc_context.error_buffer.pos;
-    --asc_context.error_buffer.size;
-    return asc_context.error_buffer.space;
-}
-
-void asc_clear_error(void) {
-    cxBufferClear(&asc_context.error_buffer);
-    asc_clear_flag(asc_context.flags, ASC_FLAG_HAS_ERROR);
-}
-
-void asc_error_gl(unsigned code, const char *message) {
-    const char *glerr;
-    switch(code) {
-        case GL_NO_ERROR:
-            return;
-        case GL_INVALID_ENUM:
-            glerr = "invalid enum";
-            break;
-        case GL_INVALID_VALUE:
-            glerr = "invalid value";
-            break;
-        case GL_INVALID_OPERATION:
-            glerr = "invalid operation";
-            break;
-        case GL_INVALID_FRAMEBUFFER_OPERATION:
-            glerr = "invalid framebuffer operation";
-            break;
-        case GL_OUT_OF_MEMORY:
-            glerr = "out of memory";
-            break;
-        case GL_STACK_UNDERFLOW:
-            glerr = "stack underflow";
-            break;
-        case GL_STACK_OVERFLOW:
-            glerr = "stack overflow";
-            break;
-        default:
-            glerr = "unknown GL error";
-    }
-    asc_error("%s\nGL Error: %s", message, glerr);
-}
-
-int asc_error_catch_all_gl(void) {
-    GLenum error;
-    int ret = 0;
-    while ((error = glGetError()) != GL_NO_ERROR) {
-        asc_error_gl(error, "Uncaught");
-        ret = 1;
-    }
-    return ret;
-}
-
 static uint64_t asc_nanos(void) {
     struct timespec ts;
     clock_gettime(CLOCK_MONOTONIC, &ts);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/error.c	Sat May 03 14:30:56 2025 +0200
@@ -0,0 +1,111 @@
+/*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ * Copyright 2025 Mike Becker. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *   1. Redistributions of source code must retain the above copyright
+ *      notice, this list of conditions and the following disclaimer.
+ *
+ *   2. Redistributions in binary form must reproduce the above copyright
+ *      notice, this list of conditions and the following disclaimer in the
+ *      documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "ascension/context.h"
+#include "ascension/error.h"
+
+#include <cx/printf.h>
+
+#include <GL/glew.h>
+
+
+void asc_error_impl(const char* file, unsigned line, char const* fmt, ...) {
+    asc_set_flag(asc_context.flags, ASC_FLAG_HAS_ERROR);
+
+    // write to error buffer
+    va_list args;
+    va_start(args, fmt);
+    CxBuffer* buf = &asc_context.error_buffer;
+    size_t bufpos = buf->pos;
+    int written = cx_vfprintf(buf, cxBufferWriteFunc, fmt, args);
+    cxBufferPut(buf, '\n');
+    va_end(args);
+
+    // also print to stderr
+    // avoid double-formatting, get it directly from the buffer
+    fprintf(stderr, "[ERROR %s %u] %.*s\n",
+        file, line, written, buf->space+bufpos);
+}
+
+bool asc_has_error(void) {
+    return asc_test_flag(asc_context.flags, ASC_FLAG_HAS_ERROR);
+}
+
+char const* asc_get_error(void) {
+    // we zero-terminate the current buffer contents before providing them
+    cxBufferPut(&asc_context.error_buffer, 0);
+    --asc_context.error_buffer.pos;
+    --asc_context.error_buffer.size;
+    return asc_context.error_buffer.space;
+}
+
+void asc_clear_error(void) {
+    cxBufferClear(&asc_context.error_buffer);
+    asc_clear_flag(asc_context.flags, ASC_FLAG_HAS_ERROR);
+}
+
+void asc_error_gl(unsigned code, const char *message) {
+    const char *glerr;
+    switch(code) {
+        case GL_NO_ERROR:
+            return;
+        case GL_INVALID_ENUM:
+            glerr = "invalid enum";
+            break;
+        case GL_INVALID_VALUE:
+            glerr = "invalid value";
+            break;
+        case GL_INVALID_OPERATION:
+            glerr = "invalid operation";
+            break;
+        case GL_INVALID_FRAMEBUFFER_OPERATION:
+            glerr = "invalid framebuffer operation";
+            break;
+        case GL_OUT_OF_MEMORY:
+            glerr = "out of memory";
+            break;
+        case GL_STACK_UNDERFLOW:
+            glerr = "stack underflow";
+            break;
+        case GL_STACK_OVERFLOW:
+            glerr = "stack overflow";
+            break;
+        default:
+            glerr = "unknown GL error";
+    }
+    asc_error("%s\nGL Error: %s", message, glerr);
+}
+
+int asc_error_catch_all_gl(void) {
+    GLenum error;
+    int ret = 0;
+    while ((error = glGetError()) != GL_NO_ERROR) {
+        asc_error_gl(error, "Uncaught");
+        ret = 1;
+    }
+    return ret;
+}
--- a/src/font.c	Sat May 03 13:49:24 2025 +0200
+++ b/src/font.c	Sat May 03 14:30:56 2025 +0200
@@ -25,6 +25,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include "ascension/error.h"
 #include "ascension/context.h"
 #include "ascension/filesystem.h"
 #include "ascension/ui/font.h"
--- a/src/glcontext.c	Sat May 03 13:49:24 2025 +0200
+++ b/src/glcontext.c	Sat May 03 14:30:56 2025 +0200
@@ -26,9 +26,7 @@
  */
 
 #include "ascension/glcontext.h"
-#include "ascension/context.h"
-
-#include <cx/printf.h>
+#include "ascension/error.h"
 
 #include <GL/glew.h>
 
--- a/src/mesh.c	Sat May 03 13:49:24 2025 +0200
+++ b/src/mesh.c	Sat May 03 14:30:56 2025 +0200
@@ -25,11 +25,10 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include "ascension/error.h"
 #include "ascension/mesh.h"
-#include "ascension/context.h"
 
 #include <GL/glew.h>
-#include <assert.h>
 
 void asc_mesh_allocate_buffers(AscMesh *mesh, unsigned count) {
     asc_dprintf("Allocate mesh buffers for %u meshes.", count);
--- a/src/primitives.c	Sat May 03 13:49:24 2025 +0200
+++ b/src/primitives.c	Sat May 03 14:30:56 2025 +0200
@@ -26,7 +26,7 @@
  */
 
 #include "ascension/primitives.h"
-#include "ascension/context.h"
+#include "ascension/error.h"
 
 #include <GL/glew.h>
 
--- a/src/scene.c	Sat May 03 13:49:24 2025 +0200
+++ b/src/scene.c	Sat May 03 14:30:56 2025 +0200
@@ -25,10 +25,10 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include "ascension/error.h"
+#include "ascension/context.h"
 #include "ascension/scene.h"
-
-#include "ascension/context.h"
-
+#include "ascension/shader.h"
 #include "ascension/2d.h"
 
 #include <cx/tree.h>
--- a/src/shader.c	Sat May 03 13:49:24 2025 +0200
+++ b/src/shader.c	Sat May 03 14:30:56 2025 +0200
@@ -26,11 +26,13 @@
  */
 
 #include "ascension/context.h"
+#include "ascension/error.h"
 #include "ascension/shader.h"
 #include "ascension/filesystem.h"
 
+#include <string.h>
+#include <stdio.h>
 #include <GL/glew.h>
-#include <string.h>
 #include <cx/buffer.h>
 #include <cx/streams.h>
 
--- a/src/text.c	Sat May 03 13:49:24 2025 +0200
+++ b/src/text.c	Sat May 03 14:30:56 2025 +0200
@@ -25,6 +25,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include "ascension/error.h"
 #include "ascension/context.h"
 #include "ascension/ui/text.h"
 
--- a/src/texture.c	Sat May 03 13:49:24 2025 +0200
+++ b/src/texture.c	Sat May 03 14:30:56 2025 +0200
@@ -25,6 +25,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include "ascension/error.h"
 #include "ascension/context.h"
 #include "ascension/texture.h"
 #include "ascension/filesystem.h"
--- a/src/window.c	Sat May 03 13:49:24 2025 +0200
+++ b/src/window.c	Sat May 03 14:30:56 2025 +0200
@@ -25,6 +25,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include "ascension/error.h"
 #include "ascension/window.h"
 #include "ascension/context.h"
 
--- a/test/snake/Makefile	Sat May 03 13:49:24 2025 +0200
+++ b/test/snake/Makefile	Sat May 03 14:30:56 2025 +0200
@@ -45,15 +45,16 @@
 FORCE:
 
 $(BUILD_DIR)/snake.o: snake.c ../../src/ascension/core.h \
- ../../src/ascension/context.h ../../src/ascension/datatypes.h \
- ../../src/ascension/window.h ../../src/ascension/glcontext.h \
- ../../src/ascension/primitives.h ../../src/ascension/mesh.h \
- ../../src/ascension/shader.h ../../src/ascension/texture.h \
- ../../src/ascension/scene.h ../../src/ascension/scene_node.h \
- ../../src/ascension/transform.h ../../src/ascension/camera.h \
- ../../src/ascension/input.h ../../src/ascension/ui/font.h \
- ../../src/ascension/ui.h ../../src/ascension/ui/text.h \
- ../../src/ascension/ui/font.h ../../src/ascension/ui/../2d/sprite.h \
+ ../../src/ascension/error.h ../../src/ascension/context.h \
+ ../../src/ascension/datatypes.h ../../src/ascension/window.h \
+ ../../src/ascension/glcontext.h ../../src/ascension/primitives.h \
+ ../../src/ascension/mesh.h ../../src/ascension/shader.h \
+ ../../src/ascension/texture.h ../../src/ascension/scene.h \
+ ../../src/ascension/scene_node.h ../../src/ascension/transform.h \
+ ../../src/ascension/camera.h ../../src/ascension/input.h \
+ ../../src/ascension/ui/font.h ../../src/ascension/ui.h \
+ ../../src/ascension/ui/text.h ../../src/ascension/ui/font.h \
+ ../../src/ascension/ui/../2d/sprite.h \
  ../../src/ascension/ui/../2d/../scene_node.h \
  ../../src/ascension/ui/../2d/../texture.h
 	@echo "Compiling $<"

mercurial