diff options
author | Tomasz Kramkowski <tk@the-tk.com> | 2018-03-30 15:35:05 +0100 |
---|---|---|
committer | Tomasz Kramkowski <tk@the-tk.com> | 2018-03-30 15:35:05 +0100 |
commit | 83b3fe86b1c13f40a6be4580b4079980030a54a7 (patch) | |
tree | d3ea228b9ac42d7ed34ba8699167bf8ff29931e1 /loadgl.c.in | |
parent | 93c76bf190d843ef77c71682570f28e9fb871a08 (diff) | |
download | faqe-83b3fe86b1c13f40a6be4580b4079980030a54a7.tar.gz faqe-83b3fe86b1c13f40a6be4580b4079980030a54a7.tar.xz faqe-83b3fe86b1c13f40a6be4580b4079980030a54a7.zip |
Simplify gl loading by removing m4 and merging gldefs.h
m4 has been removed, loadgl.c.in is now gl.c, gldefs.h and loadgl.h.in
have now been merged into gl.h. loadgl.m4 has been transformed into
glfunc.h which is being used in the way of a bie index file to
generate information at 3 places.
lgl_load is now gl_load and doesn't return anything, the jongjmp.h
method of error handling was pre-emptive and for now this much simpler
system will suffice. This means that lgl_strerror is no longer neede.
Diffstat (limited to 'loadgl.c.in')
-rw-r--r-- | loadgl.c.in | 64 |
1 files changed, 0 insertions, 64 deletions
diff --git a/loadgl.c.in b/loadgl.c.in deleted file mode 100644 index 1959b64..0000000 --- a/loadgl.c.in +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (C) 2018 Tomasz Kramkowski <tk@the-tk.com> - * SPDX-License-Identifier: MIT - */ -#include <setjmp.h> - -#include "loadgl.h" - -#define LGL_FUNC(name, glname) \ - name##_func *name; \ - static const char *name##_gln = #glname; - -FUNCS()dnl - -static void *load_func(const char *name, lgl_loadfunc *load, jmp_buf env) -{ - void *ret; - - ret = load(name); - if (ret == NULL) - longjmp(env, LGL_MISSING); - - return ret; -} - -enum lgl_status lgl_load(lgl_loadfunc *load) -{ - enum lgl_status status; - jmp_buf env; - - status = setjmp(env); - if (status != 0) - return status; - -#define LGL_LOAD(name) name = (name##_func *)load_func(name##_gln, load, env); - LOADS()dnl - - return LGL_OK; -} - -const char *lgl_strerror(enum lgl_status status) -{ - switch (status) { - case LGL_OK: return "Success"; - case LGL_MISSING: return "Missing function"; - } - return "Unknown"; -} - -const char *gl_strerror(GLenum error) -{ - switch (error) { - case GL_NO_ERROR: return "No error"; - case GL_INVALID_ENUM: return "Invalid enumeration"; - case GL_INVALID_VALUE: return "Invalid value"; - case GL_INVALID_OPERATION: return "Invalid operation"; - case GL_STACK_OVERFLOW: return "Stack overflow"; - case GL_STACK_UNDERFLOW: return "Stack underflow"; - case GL_OUT_OF_MEMORY: return "Out of memory"; - case GL_INVALID_FRAMEBUFFER_OPERATION: return "Invalid framebuffer operation"; - case GL_CONTEXT_LOST: return "Context lost"; - } - return "Unknown"; -} |