bzr branch
http://gegoxaren.bato24.eu/bzr/simpletypesystem/trunk
|
5.1.1
by Gustav Hartvigsson
* Started work on making the code more prasable by DoxyGen. |
1 |
/*
|
|
5.2.7
by Gustav Hartvigsson
* Switched licence to a more permisive one. |
2 |
Copyright (c) 2013-2014 Gustav Hartvigsson
|
3 |
||
4 |
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5 |
of this software and associated documentation files (the "Software"), to deal
|
|
6 |
in the Software without restriction, including without limitation the rights
|
|
7 |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8 |
copies of the Software, and to permit persons to whom the Software is
|
|
9 |
furnished to do so, subject to the following conditions:
|
|
10 |
||
11 |
The above copyright notice and this permission notice shall be included in
|
|
12 |
all copies or substantial portions of the Software.
|
|
13 |
||
14 |
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15 |
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16 |
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17 |
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18 |
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19 |
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
20 |
THE SOFTWARE.
|
|
|
5.1.1
by Gustav Hartvigsson
* Started work on making the code more prasable by DoxyGen. |
21 |
*/
|
22 |
||
23 |
/** @file */
|
|
|
3
by Gustav Hartvigsson
Fixed a few things... |
24 |
|
25 |
#ifndef __H_ERROR__
|
|
26 |
#define __H_ERROR__
|
|
27 |
||
28 |
#include "baseobject.h" |
|
|
5.2.8
by Gustav Hartvigsson
* Copied over LinkedList and DynamicArray from c_sdl_js |
29 |
#include "defs.h" |
|
22
by Gustav Hartvigsson
* Made code compile |
30 |
#include "utils.h" |
31 |
#include "Func.h" |
|
|
3
by Gustav Hartvigsson
Fixed a few things... |
32 |
#include <limits.h> |
33 |
#include <stdlib.h> |
|
34 |
#include <stdio.h> |
|
35 |
#include <string.h> |
|
36 |
||
|
22
by Gustav Hartvigsson
* Made code compile |
37 |
BEGIN_DECLS
|
38 |
||
|
5.1.1
by Gustav Hartvigsson
* Started work on making the code more prasable by DoxyGen. |
39 |
/**
|
40 |
* An opaque datastructure that holds the SError's private data.
|
|
41 |
*/
|
|
|
39
by Gustav Hartvigsson
* Added "check" target for testing. |
42 |
typedef struct SErrorPrivate SErrorPrivate; |
|
3
by Gustav Hartvigsson
Fixed a few things... |
43 |
|
|
5.1.1
by Gustav Hartvigsson
* Started work on making the code more prasable by DoxyGen. |
44 |
/**
|
|
19
by Gustav Hartvigsson
* Woops |
45 |
* An SError is a data structure that inherits from SBaseObjectInstance.
|
|
5.1.1
by Gustav Hartvigsson
* Started work on making the code more prasable by DoxyGen. |
46 |
*
|
47 |
* An SError represents an error that can occur.
|
|
48 |
*/
|
|
|
39
by Gustav Hartvigsson
* Added "check" target for testing. |
49 |
typedef struct SError { |
|
22
by Gustav Hartvigsson
* Made code compile |
50 |
SObject parent; |
|
5.1.1
by Gustav Hartvigsson
* Started work on making the code more prasable by DoxyGen. |
51 |
SErrorPrivate * priv; /** Pimple pointer to the private data. */ |
|
3
by Gustav Hartvigsson
Fixed a few things... |
52 |
|
53 |
} SError; |
|
54 |
||
55 |
/**
|
|
56 |
* The error class is not changed, no extra methods are needed.
|
|
57 |
*/
|
|
|
39
by Gustav Hartvigsson
* Added "check" target for testing. |
58 |
typedef struct SErrorClass { |
|
22
by Gustav Hartvigsson
* Made code compile |
59 |
SObjectClass parent_class; |
|
3
by Gustav Hartvigsson
Fixed a few things... |
60 |
|
61 |
} SErrorClass; |
|
62 |
||
|
49
by Gustav Hartvigsson
* started work SBox (Untested). |
63 |
#define S_ERROR(o) (SError *)(o)
|
64 |
#define S_ERROR_CLASS(k) (SErrorClass *)(k)
|
|
65 |
||
|
5.1.1
by Gustav Hartvigsson
* Started work on making the code more prasable by DoxyGen. |
66 |
/** @brief
|
67 |
* The different error types.
|
|
68 |
*/
|
|
|
3
by Gustav Hartvigsson
Fixed a few things... |
69 |
typedef enum { |
|
8
by Gustav Hartvigsson
* Fixed a DoxyGen error documentation error of an enum. |
70 |
S_ERROR_NONE = 0, /**< Not on error */ |
|
43
by Gustav Hartvigsson
* Code cleanup |
71 |
S_ERROR_INPUT_OUTPUT,/**< An I/O error */ |
72 |
S_ERROR_OVERFLOW, /**< An Overflow error */ |
|
73 |
S_ERROR_UNUSED_0, |
|
74 |
S_ERROR_UNUSED_1, |
|
75 |
S_ERROR_UNUSED_2, |
|
76 |
S_ERROR_OTHER, /**< Some unknowned error */ |
|
77 |
S_ERROR_NULL /**< An NULL error */ |
|
|
3
by Gustav Hartvigsson
Fixed a few things... |
78 |
} SErrorType; |
79 |
||
|
39
by Gustav Hartvigsson
* Added "check" target for testing. |
80 |
/**
|
81 |
* Holds the names of the string version of SErrorType.
|
|
82 |
*/
|
|
|
49
by Gustav Hartvigsson
* started work SBox (Untested). |
83 |
static char * SErrorTypeName[] __attribute__((unused)) = { |
|
46
by Gustav Hartvigsson
* Renamed DynamicArray to SDynamicArray. |
84 |
"NONE", |
85 |
"INPUT/OUTPUT", |
|
86 |
"OVERFLOW", |
|
|
49
by Gustav Hartvigsson
* started work SBox (Untested). |
87 |
"UNUSED_0/INVALID", |
88 |
"UNUSED_1/INVALID", |
|
89 |
"UNUSED_2/INVALID", |
|
|
46
by Gustav Hartvigsson
* Renamed DynamicArray to SDynamicArray. |
90 |
"OTHER", |
91 |
"NULL", |
|
92 |
0x0, |
|
93 |
0x0 |
|
94 |
};
|
|
|
39
by Gustav Hartvigsson
* Added "check" target for testing. |
95 |
|
|
49
by Gustav Hartvigsson
* started work SBox (Untested). |
96 |
/**
|
97 |
* @brief
|
|
98 |
* Function to get the same of an error.
|
|
99 |
*
|
|
100 |
* For use in bindings.
|
|
101 |
*
|
|
102 |
* @param k The key to look up.
|
|
103 |
*/
|
|
104 |
char * s_error_get_name (SErrorType k); |
|
|
3
by Gustav Hartvigsson
Fixed a few things... |
105 |
|
106 |
/**
|
|
|
5.1.1
by Gustav Hartvigsson
* Started work on making the code more prasable by DoxyGen. |
107 |
* the constructor for the an SError
|
|
3
by Gustav Hartvigsson
Fixed a few things... |
108 |
*/
|
109 |
SError * s_error_new (SErrorType error, char * message); |
|
110 |
||
|
5.1.1
by Gustav Hartvigsson
* Started work on making the code more prasable by DoxyGen. |
111 |
/**
|
112 |
* This function calles the deinitize method of the object.
|
|
113 |
*/
|
|
|
3
by Gustav Hartvigsson
Fixed a few things... |
114 |
void s_error_free (SError * self); |
115 |
||
|
5.1.1
by Gustav Hartvigsson
* Started work on making the code more prasable by DoxyGen. |
116 |
/**
|
117 |
* This function returns the ErrorType of on object.
|
|
118 |
*/
|
|
|
3
by Gustav Hartvigsson
Fixed a few things... |
119 |
SErrorType s_error_get_error_type (SError * self); |
120 |
||
|
5.1.1
by Gustav Hartvigsson
* Started work on making the code more prasable by DoxyGen. |
121 |
/**
|
122 |
* This function prints the current error to stdout.
|
|
123 |
*/
|
|
|
3
by Gustav Hartvigsson
Fixed a few things... |
124 |
void s_error_print_error (SError * self); |
125 |
||
|
22
by Gustav Hartvigsson
* Made code compile |
126 |
END_DECLS
|
127 |
||
|
3
by Gustav Hartvigsson
Fixed a few things... |
128 |
#endif
|