MLX42 1.0
MLX42
Loading...
Searching...
No Matches
mlx_error.c File Reference
#include "MLX42/MLX42_Int.h"
Include dependency graph for mlx_error.c:

Go to the source code of this file.

Functions

bool mlx_error (mlx_errno_t val)
 
const charmlx_strerror (mlx_errno_t val)
 

Variables

static const charmlx_errors [MLX_ERRMAX]
 

Function Documentation

◆ mlx_error()

bool mlx_error ( mlx_errno_t  val)

Functions to set the error number, simply for convenience.

Parameters
valThe error value.
Returns
Always false

Definition at line 43 of file mlx_error.c.

44{
45 mlx_errno = val;
46#ifndef NDEBUG
47 fprintf(stderr, "MLX42: %s", mlx_strerror(mlx_errno));
48#endif
49 return (false);
50}
mlx_errno
Definition MLX42.h:371
GLuint GLfloat * val
Definition glad.h:3979
GLuint GLsizei GLsizei * length
Definition glad.h:3372
const char * mlx_strerror(mlx_errno_t val)
Definition mlx_error.c:54
Here is the call graph for this function:
Here is the caller graph for this function:

◆ mlx_strerror()

const char * mlx_strerror ( mlx_errno_t  val)

Gets the english description of the error code.

Parameters
[in]valThe error code.
Returns
The error string that describes the error code.

Definition at line 54 of file mlx_error.c.

55{
56 MLX_ASSERT(val >= 0, "Index must be positive");
57 MLX_ASSERT(val < MLX_ERRMAX, "Index out of bounds");
58
59 return (mlx_errors[val]);
60}
@ MLX_ERRMAX
Definition MLX42.h:388
#define MLX_ASSERT(cond, msg)
Definition MLX42_Int.h:45
static const char * mlx_errors[MLX_ERRMAX]
Definition mlx_error.c:18
Here is the caller graph for this function:

Variable Documentation

◆ mlx_errors

const char* mlx_errors[MLX_ERRMAX]
static
Initial value:
= {
"No Errors",
"File has invalid extension",
"Failed to open the file",
"PNG file is invalid or corrupted",
"XPM42 file is invalid or corrupted",
"The specified X or Y positions are out of bounds",
"The specified Width or Height dimensions are out of bounds",
"The provided image is invalid, might indicate mismanagement of images",
"Failed to compile the vertex shader.",
"Failed to compile the fragment shader.",
"Failed to compile the shaders.",
"Failed to allocate memory",
"Failed to initialize GLAD",
"Failed to initialize GLFW",
"Failed to create window",
"String is too big to be drawn",
}

Definition at line 18 of file mlx_error.c.

18 {
19 "No Errors",
20 "File has invalid extension",
21 "Failed to open the file",
22 "PNG file is invalid or corrupted",
23 "XPM42 file is invalid or corrupted",
24 "The specified X or Y positions are out of bounds",
25 "The specified Width or Height dimensions are out of bounds",
26 "The provided image is invalid, might indicate mismanagement of images",
27 "Failed to compile the vertex shader.",
28 "Failed to compile the fragment shader.",
29 "Failed to compile the shaders.",
30 "Failed to allocate memory",
31 "Failed to initialize GLAD",
32 "Failed to initialize GLFW",
33 "Failed to create window",
34 "String is too big to be drawn",
35};