GEL  0.99
error.h
Go to the documentation of this file.
1 /*
2  * $Id$
3  *
4  * This file is part of the GEL library.
5  * Copyright (c) 2005-10, IRIT- UPS
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 #ifndef GEL_ERROR_H_
22 #define GEL_ERROR_H_
23 
24 #include <gel/common.h>
25 
27 
28 /* Error codes */
29 #define GEL_ESUCCESS 0
30 #define GEL_EIO 2
31 #define GEL_EFORMAT 4
32 #define GEL_ENOTSUPP 6
33 #define GEL_ENOTFOUND 8
34 #define GEL_ENOTLOADED 10
35 #define GEL_EINVAL 12
36 #define GEL_ERESOURCE 14
37 #define GEL_EDEPEND 16
38 #define GEL_ESTACK 18
39 #define GEL_EMAX 18
40 
41 /* Warning codes */
42 #define GEL_WDYNAMIC 1
43 #define GEL_WNONFATAL 3
44 #define GEL_WMAX 3
45 
46 /* Macros */
47 #define GEL_IS_WARNING (gel_errno & 1)
48 #define GEL_IS_ERROR (!(gel_errno & 1))
49 #define GEL_ERRNO (gel_errno >> 1)
50 
51 /* types */
52 typedef void (gel_error_fun_t)(int code, const char *msg);
53 
54 /* data */
55 extern int gel_errno;
56 
57 /* functions */
58 const char *gel_strerror(void);
60 void gel_set_error(int code, const char *fmt, ...);
61 
63 
64 #endif /* ERROR_H_ */
#define __END_DECLS
Definition: common.h:29
#define __BEGIN_DECLS
Definition: common.h:28
void gel_set_error(int code, const char *fmt,...)
Definition: gel_error.c:135
void() gel_error_fun_t(int code, const char *msg)
Definition: error.h:52
gel_error_fun_t * gel_set_error_fun(gel_error_fun_t *fun)
Definition: gel_error.c:122
const char * gel_strerror(void)
Definition: gel_error.c:95
int gel_errno
Definition: gel_error.c:42