annotate libmlk-core/mlk/core/err.c @ 437:e1eebc6bf25d

man: initial import
author David Demelier <markand@malikania.fr>
date Sun, 16 Oct 2022 13:21:40 +0200
parents 556c8e2ff995
children 773a082f0b91
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
419
1b4e61bdb9ab core: introduce err.h
David Demelier <markand@malikania.fr>
parents:
diff changeset
1 /*
1b4e61bdb9ab core: introduce err.h
David Demelier <markand@malikania.fr>
parents:
diff changeset
2 * err.h -- error routines
1b4e61bdb9ab core: introduce err.h
David Demelier <markand@malikania.fr>
parents:
diff changeset
3 *
1b4e61bdb9ab core: introduce err.h
David Demelier <markand@malikania.fr>
parents:
diff changeset
4 * Copyright (c) 2020-2022 David Demelier <markand@malikania.fr>
1b4e61bdb9ab core: introduce err.h
David Demelier <markand@malikania.fr>
parents:
diff changeset
5 *
1b4e61bdb9ab core: introduce err.h
David Demelier <markand@malikania.fr>
parents:
diff changeset
6 * Permission to use, copy, modify, and/or distribute this software for any
1b4e61bdb9ab core: introduce err.h
David Demelier <markand@malikania.fr>
parents:
diff changeset
7 * purpose with or without fee is hereby granted, provided that the above
1b4e61bdb9ab core: introduce err.h
David Demelier <markand@malikania.fr>
parents:
diff changeset
8 * copyright notice and this permission notice appear in all copies.
1b4e61bdb9ab core: introduce err.h
David Demelier <markand@malikania.fr>
parents:
diff changeset
9 *
1b4e61bdb9ab core: introduce err.h
David Demelier <markand@malikania.fr>
parents:
diff changeset
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
1b4e61bdb9ab core: introduce err.h
David Demelier <markand@malikania.fr>
parents:
diff changeset
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
1b4e61bdb9ab core: introduce err.h
David Demelier <markand@malikania.fr>
parents:
diff changeset
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
1b4e61bdb9ab core: introduce err.h
David Demelier <markand@malikania.fr>
parents:
diff changeset
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
1b4e61bdb9ab core: introduce err.h
David Demelier <markand@malikania.fr>
parents:
diff changeset
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
1b4e61bdb9ab core: introduce err.h
David Demelier <markand@malikania.fr>
parents:
diff changeset
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
1b4e61bdb9ab core: introduce err.h
David Demelier <markand@malikania.fr>
parents:
diff changeset
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1b4e61bdb9ab core: introduce err.h
David Demelier <markand@malikania.fr>
parents:
diff changeset
17 */
1b4e61bdb9ab core: introduce err.h
David Demelier <markand@malikania.fr>
parents:
diff changeset
18
1b4e61bdb9ab core: introduce err.h
David Demelier <markand@malikania.fr>
parents:
diff changeset
19 #include <SDL.h>
1b4e61bdb9ab core: introduce err.h
David Demelier <markand@malikania.fr>
parents:
diff changeset
20
1b4e61bdb9ab core: introduce err.h
David Demelier <markand@malikania.fr>
parents:
diff changeset
21 #include "err.h"
1b4e61bdb9ab core: introduce err.h
David Demelier <markand@malikania.fr>
parents:
diff changeset
22
1b4e61bdb9ab core: introduce err.h
David Demelier <markand@malikania.fr>
parents:
diff changeset
23 const char *
437
e1eebc6bf25d man: initial import
David Demelier <markand@malikania.fr>
parents: 435
diff changeset
24 mlk_err_string(int e)
419
1b4e61bdb9ab core: introduce err.h
David Demelier <markand@malikania.fr>
parents:
diff changeset
25 {
1b4e61bdb9ab core: introduce err.h
David Demelier <markand@malikania.fr>
parents:
diff changeset
26 switch (e) {
437
e1eebc6bf25d man: initial import
David Demelier <markand@malikania.fr>
parents: 435
diff changeset
27 case MLK_ERR_SDL:
419
1b4e61bdb9ab core: introduce err.h
David Demelier <markand@malikania.fr>
parents:
diff changeset
28 return SDL_GetError();
437
e1eebc6bf25d man: initial import
David Demelier <markand@malikania.fr>
parents: 435
diff changeset
29 case MLK_ERR_NO_MEM:
419
1b4e61bdb9ab core: introduce err.h
David Demelier <markand@malikania.fr>
parents:
diff changeset
30 return "out of memory";
437
e1eebc6bf25d man: initial import
David Demelier <markand@malikania.fr>
parents: 435
diff changeset
31 case MLK_ERR_NO_SUPPORT:
419
1b4e61bdb9ab core: introduce err.h
David Demelier <markand@malikania.fr>
parents:
diff changeset
32 return "operation not supported";
437
e1eebc6bf25d man: initial import
David Demelier <markand@malikania.fr>
parents: 435
diff changeset
33 case MLK_ERR_FORMAT:
435
556c8e2ff995 misc: move tools/* in /
David Demelier <markand@malikania.fr>
parents: 431
diff changeset
34 return "invalid format or corrupt file";
419
1b4e61bdb9ab core: introduce err.h
David Demelier <markand@malikania.fr>
parents:
diff changeset
35 default:
1b4e61bdb9ab core: introduce err.h
David Demelier <markand@malikania.fr>
parents:
diff changeset
36 return "no error";
1b4e61bdb9ab core: introduce err.h
David Demelier <markand@malikania.fr>
parents:
diff changeset
37 }
1b4e61bdb9ab core: introduce err.h
David Demelier <markand@malikania.fr>
parents:
diff changeset
38 }