bzr branch
http://gegoxaren.bato24.eu/bzr/simpletypesystem/trunk
|
5.2.7
by Gustav Hartvigsson
* Switched licence to a more permisive one. |
1 |
/*
|
2 |
*/
|
|
3 |
||
4 |
#ifndef __H_DEFS__
|
|
5 |
#define __H_DEFS__
|
|
6 |
||
|
23
by Gustav Hartvigsson
* Fixed some of the build warnings. |
7 |
#include <limits.h> |
|
48
by Gustav Hartvigsson
* Finnished SLinkedList. |
8 |
#include <stddef.h> |
|
67
by Gustav Hartvigsson
* Readded s_wstring_to_string function* |
9 |
#include <uchar.h> |
|
23
by Gustav Hartvigsson
* Fixed some of the build warnings. |
10 |
|
|
5.2.7
by Gustav Hartvigsson
* Switched licence to a more permisive one. |
11 |
/** @file
|
12 |
*
|
|
13 |
*/
|
|
14 |
||
15 |
#ifdef __cplusplus
|
|
16 |
#define BEGIN_DECLS extern "C" {
|
|
17 |
#else
|
|
18 |
#define BEGIN_DECLS
|
|
19 |
#endif /*__cplusplus*/ |
|
20 |
||
21 |
||
22 |
#ifdef __cplusplus
|
|
23 |
#define END_DECLS }
|
|
24 |
#else
|
|
25 |
#define END_DECLS
|
|
26 |
#endif /* __cplusplus */ |
|
27 |
||
|
26
by Gustav Hartvigsson
* Added something to config.h.in, still not sure how it cmake works. |
28 |
BEGIN_DECLS
|
29 |
||
|
57
by Gustav Hartvigsson
* Tested print_backtrace() macro using MingW and Wine... Still needs testing on a real windows system. |
30 |
#include <stdio.h> |
31 |
#include <stdlib.h> |
|
32 |
||
33 |
||
|
23
by Gustav Hartvigsson
* Fixed some of the build warnings. |
34 |
#ifndef FALSE
|
|
46
by Gustav Hartvigsson
* Renamed DynamicArray to SDynamicArray. |
35 |
/**
|
36 |
* FALSE has the absolute value of 0, it is used in as a way to represet a false
|
|
37 |
* value. A "not" value.
|
|
38 |
*/
|
|
|
23
by Gustav Hartvigsson
* Fixed some of the build warnings. |
39 |
#define FALSE 0
|
40 |
#endif
|
|
41 |
||
42 |
#ifndef TRUE
|
|
|
46
by Gustav Hartvigsson
* Renamed DynamicArray to SDynamicArray. |
43 |
/** |
44 |
* TRUE represets a value that is true. A value that is "not false".
|
|
45 |
*/
|
|
46 |
#define TRUE (!FALSE)
|
|
|
23
by Gustav Hartvigsson
* Fixed some of the build warnings. |
47 |
#endif
|
48 |
||
|
53
by Gustav Hartvigsson
* Finnished up s_map_add () ??? |
49 |
#define S_POINTER_TO_HASH_T(p) ((hash_t)(unsigned long) p)
|
50 |
||
|
46
by Gustav Hartvigsson
* Renamed DynamicArray to SDynamicArray. |
51 |
/**
|
52 |
* sboolean is the standard definition of a boolean value in SSTS.
|
|
53 |
*
|
|
54 |
* @sa TRUE
|
|
55 |
* @sa FALSE
|
|
56 |
*
|
|
57 |
* @note
|
|
58 |
* This is the way it is done in GLib, so it is done here too.
|
|
59 |
*/
|
|
60 |
typedef int sboolean; |
|
61 |
||
|
43
by Gustav Hartvigsson
* Code cleanup |
62 |
/** hash type */
|
|
48
by Gustav Hartvigsson
* Finnished SLinkedList. |
63 |
typedef size_t hash_t; |
|
23
by Gustav Hartvigsson
* Fixed some of the build warnings. |
64 |
|
|
43
by Gustav Hartvigsson
* Code cleanup |
65 |
/** spointer is a convinience typedef of void * */
|
|
23
by Gustav Hartvigsson
* Fixed some of the build warnings. |
66 |
typedef void* spointer; |
67 |
||
|
48
by Gustav Hartvigsson
* Finnished SLinkedList. |
68 |
/** sconstpointer is a convinience typedef of const void * */
|
69 |
typedef const void* sconstpointer; |
|
|
46
by Gustav Hartvigsson
* Renamed DynamicArray to SDynamicArray. |
70 |
|
71 |
/**
|
|
|
65
by Gustav Hartvigsson
* added uchar to defs.h |
72 |
* uchar is the representation for use with wide unicode strings and what not.
|
73 |
*
|
|
74 |
* The rationell for using char32_t as the unicode wide char instead of
|
|
75 |
* wchar_t is that wchar_t's size depends on the imprementation, compiler,
|
|
76 |
* and system.
|
|
77 |
*
|
|
78 |
* To make the wide strings actually work as they should, even over network or
|
|
79 |
* other communication we set this as the standard for the uchar.
|
|
80 |
*/
|
|
81 |
typedef char32_t uchar; |
|
82 |
||
83 |
/**
|
|
|
46
by Gustav Hartvigsson
* Renamed DynamicArray to SDynamicArray. |
84 |
* Represents different types of objects.
|
85 |
*
|
|
86 |
* @se STypeName
|
|
87 |
*/
|
|
|
23
by Gustav Hartvigsson
* Fixed some of the build warnings. |
88 |
typedef enum { |
|
43
by Gustav Hartvigsson
* Code cleanup |
89 |
S_TYPE_NONE = 0, |
90 |
S_TYPE_INT, |
|
|
49
by Gustav Hartvigsson
* started work SBox (Untested). |
91 |
S_TYPE_LONG, |
92 |
S_TYPE_SHORT, |
|
|
43
by Gustav Hartvigsson
* Code cleanup |
93 |
S_TYPE_CHAR, |
|
49
by Gustav Hartvigsson
* started work SBox (Untested). |
94 |
S_TYPE_WCHAR, |
|
67
by Gustav Hartvigsson
* Readded s_wstring_to_string function* |
95 |
S_TYPE_UCHAR, /**< char32_t/uchar */ |
|
49
by Gustav Hartvigsson
* started work SBox (Untested). |
96 |
S_TYPE_UINT, |
97 |
S_TYPE_ULONG, |
|
98 |
S_TYPE_USHORT, |
|
|
43
by Gustav Hartvigsson
* Code cleanup |
99 |
S_TYPE_BOOLEAN, |
|
49
by Gustav Hartvigsson
* started work SBox (Untested). |
100 |
S_TYPE_STRING, |
|
67
by Gustav Hartvigsson
* Readded s_wstring_to_string function* |
101 |
S_TYPE_WSTRING, /**< Plarform specific wchar_t */ |
102 |
S_TYPE_USTRING, /**< char32_t String.*/ |
|
|
43
by Gustav Hartvigsson
* Code cleanup |
103 |
S_TYPE_UNUSED_0, |
104 |
S_TYPE_UNUSED_1, |
|
105 |
S_TYPE_UNUSED_2, |
|
|
49
by Gustav Hartvigsson
* started work SBox (Untested). |
106 |
S_TYPE_POINTER, |
|
43
by Gustav Hartvigsson
* Code cleanup |
107 |
S_TYPE_OBJECT, |
108 |
S_TYPE_INVALID |
|
109 |
} SType; |
|
|
5.2.7
by Gustav Hartvigsson
* Switched licence to a more permisive one. |
110 |
|
|
46
by Gustav Hartvigsson
* Renamed DynamicArray to SDynamicArray. |
111 |
/** @brief
|
112 |
* The names of the SType's
|
|
|
49
by Gustav Hartvigsson
* started work SBox (Untested). |
113 |
*
|
114 |
*
|
|
|
46
by Gustav Hartvigsson
* Renamed DynamicArray to SDynamicArray. |
115 |
*/
|
|
50
by Gustav Hartvigsson
* Added a bindings friendly way of getting the SType name. |
116 |
static char * STypeName[] __attribute__((unused)) = { |
|
46
by Gustav Hartvigsson
* Renamed DynamicArray to SDynamicArray. |
117 |
"NONE", |
118 |
"INT", |
|
|
49
by Gustav Hartvigsson
* started work SBox (Untested). |
119 |
"LONG", |
120 |
"SHORT", |
|
|
46
by Gustav Hartvigsson
* Renamed DynamicArray to SDynamicArray. |
121 |
"CHAR", |
|
49
by Gustav Hartvigsson
* started work SBox (Untested). |
122 |
"WCHAR", |
|
67
by Gustav Hartvigsson
* Readded s_wstring_to_string function* |
123 |
"UCHAR", /*< char32_t */ |
|
49
by Gustav Hartvigsson
* started work SBox (Untested). |
124 |
"UINT", |
125 |
"ULONG", |
|
126 |
"USHORT" |
|
|
46
by Gustav Hartvigsson
* Renamed DynamicArray to SDynamicArray. |
127 |
"BOOLEAN", |
|
49
by Gustav Hartvigsson
* started work SBox (Untested). |
128 |
"STRING", |
129 |
"WSTRING", |
|
|
67
by Gustav Hartvigsson
* Readded s_wstring_to_string function* |
130 |
"USTRING", |
|
49
by Gustav Hartvigsson
* started work SBox (Untested). |
131 |
"UNUSED_0/INVALID", |
132 |
"UNUSED_1/INVALID", |
|
133 |
"UNUSED_2/INVALID", |
|
134 |
"POINTER", |
|
|
46
by Gustav Hartvigsson
* Renamed DynamicArray to SDynamicArray. |
135 |
"OBJECT", |
136 |
"INVALID", |
|
137 |
0x0, |
|
138 |
0x0, |
|
|
43
by Gustav Hartvigsson
* Code cleanup |
139 |
};
|
|
26
by Gustav Hartvigsson
* Added something to config.h.in, still not sure how it cmake works. |
140 |
|
|
50
by Gustav Hartvigsson
* Added a bindings friendly way of getting the SType name. |
141 |
/**
|
142 |
* @brief Get the name of the SType.
|
|
143 |
*
|
|
144 |
* For use in bindings.
|
|
145 |
*/
|
|
|
61
by Gustav Hartvigsson
* Made the code more easy to read. |
146 |
char * |
147 |
s_type_get_name (SType k); |
|
|
46
by Gustav Hartvigsson
* Renamed DynamicArray to SDynamicArray. |
148 |
|
|
26
by Gustav Hartvigsson
* Added something to config.h.in, still not sure how it cmake works. |
149 |
/* Colour definitions for console prints */
|
150 |
#define RESET "\033[0m"
|
|
151 |
#define BLACK "\033[30m" /* Black */ |
|
152 |
#define RED "\033[31m" /* Red */ |
|
153 |
#define GREEN "\033[32m" /* Green */ |
|
154 |
#define YELLOW "\033[33m" /* Yellow */ |
|
155 |
#define BLUE "\033[34m" /* Blue */ |
|
156 |
#define MAGENTA "\033[35m" /* Magenta */ |
|
157 |
#define CYAN "\033[36m" /* Cyan */ |
|
158 |
#define WHITE "\033[37m" /* White */ |
|
159 |
#define BOLDBLACK "\033[1m\033[30m" /* Bold Black */ |
|
160 |
#define BOLDRED "\033[1m\033[31m" /* Bold Red */ |
|
161 |
#define BOLDGREEN "\033[1m\033[32m" /* Bold Green */ |
|
162 |
#define BOLDYELLOW "\033[1m\033[33m" /* Bold Yellow */ |
|
163 |
#define BOLDBLUE "\033[1m\033[34m" /* Bold Blue */ |
|
164 |
#define BOLDMAGENTA "\033[1m\033[35m" /* Bold Magenta */ |
|
165 |
#define BOLDCYAN "\033[1m\033[36m" /* Bold Cyan */ |
|
166 |
#define BOLDWHITE "\033[1m\033[37m" /* Bold White */ |
|
167 |
||
|
33
by Gustav Hartvigsson
* made test_macros.h a lil' bit more portable |
168 |
|
|
26
by Gustav Hartvigsson
* Added something to config.h.in, still not sure how it cmake works. |
169 |
END_DECLS
|
170 |
||
|
5.2.7
by Gustav Hartvigsson
* Switched licence to a more permisive one. |
171 |
#endif
|