/simpletypesystem/trunk

To get this branch, use:
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>
23 by Gustav Hartvigsson
* Fixed some of the build warnings.
9
5.2.7 by Gustav Hartvigsson
* Switched licence to a more permisive one.
10
/** @file
11
 * 
12
 */
13
14
#ifdef __cplusplus
15
#define BEGIN_DECLS extern "C" {
16
#else
17
#define BEGIN_DECLS
18
#endif /*__cplusplus*/
19
20
21
#ifdef __cplusplus
22
#define END_DECLS }
23
#else
24
#define END_DECLS
25
#endif /* __cplusplus */
26
26 by Gustav Hartvigsson
* Added something to config.h.in, still not sure how it cmake works.
27
BEGIN_DECLS
28
43 by Gustav Hartvigsson
* Code cleanup
29
23 by Gustav Hartvigsson
* Fixed some of the build warnings.
30
#ifndef FALSE
46 by Gustav Hartvigsson
* Renamed DynamicArray to SDynamicArray.
31
/**
32
 * FALSE has the absolute value of 0, it is used in as a way to represet a false
33
 * value. A "not" value.
34
 */
23 by Gustav Hartvigsson
* Fixed some of the build warnings.
35
#define FALSE 0
36
#endif
37
38
#ifndef TRUE
46 by Gustav Hartvigsson
* Renamed DynamicArray to SDynamicArray.
39
 /**
40
  * TRUE represets a value that is true. A value that is "not false".
41
  */
42
#define TRUE (!FALSE)
23 by Gustav Hartvigsson
* Fixed some of the build warnings.
43
#endif
44
46 by Gustav Hartvigsson
* Renamed DynamicArray to SDynamicArray.
45
/**
46
 * sboolean is the standard definition of a boolean value in SSTS.
47
 *
48
 * @sa TRUE
49
 * @sa FALSE
50
 *
51
 * @note
52
 * This is the way it is done in GLib, so it is done here too.
53
 */
54
typedef int sboolean;
55
43 by Gustav Hartvigsson
* Code cleanup
56
/** hash type  */
48 by Gustav Hartvigsson
* Finnished SLinkedList.
57
typedef size_t hash_t;
23 by Gustav Hartvigsson
* Fixed some of the build warnings.
58
43 by Gustav Hartvigsson
* Code cleanup
59
/** spointer is a convinience typedef of void * */
23 by Gustav Hartvigsson
* Fixed some of the build warnings.
60
typedef void* spointer;
61
48 by Gustav Hartvigsson
* Finnished SLinkedList.
62
/** sconstpointer is a convinience typedef of const void * */
63
typedef const void* sconstpointer;
46 by Gustav Hartvigsson
* Renamed DynamicArray to SDynamicArray.
64
65
/**
66
 * Represents different types of objects.
67
 *
68
 * @se STypeName
69
 */
23 by Gustav Hartvigsson
* Fixed some of the build warnings.
70
typedef enum {
43 by Gustav Hartvigsson
* Code cleanup
71
  S_TYPE_NONE = 0,
72
  S_TYPE_INT,
49 by Gustav Hartvigsson
* started work SBox (Untested).
73
  S_TYPE_LONG,
74
  S_TYPE_SHORT,
43 by Gustav Hartvigsson
* Code cleanup
75
  S_TYPE_CHAR,
49 by Gustav Hartvigsson
* started work SBox (Untested).
76
  S_TYPE_WCHAR,
77
  S_TYPE_UINT,
78
  S_TYPE_ULONG,
79
  S_TYPE_USHORT,
43 by Gustav Hartvigsson
* Code cleanup
80
  S_TYPE_BOOLEAN,
49 by Gustav Hartvigsson
* started work SBox (Untested).
81
  S_TYPE_STRING,
82
  S_TYPE_WSTRING,
43 by Gustav Hartvigsson
* Code cleanup
83
  S_TYPE_UNUSED_0,
84
  S_TYPE_UNUSED_1,
85
  S_TYPE_UNUSED_2,
49 by Gustav Hartvigsson
* started work SBox (Untested).
86
  S_TYPE_POINTER,
43 by Gustav Hartvigsson
* Code cleanup
87
  S_TYPE_OBJECT,
88
  S_TYPE_INVALID
89
} SType;
5.2.7 by Gustav Hartvigsson
* Switched licence to a more permisive one.
90
46 by Gustav Hartvigsson
* Renamed DynamicArray to SDynamicArray.
91
/** @brief
92
 * The names of the SType's
49 by Gustav Hartvigsson
* started work SBox (Untested).
93
 *
94
 * 
46 by Gustav Hartvigsson
* Renamed DynamicArray to SDynamicArray.
95
 */
50 by Gustav Hartvigsson
* Added a bindings friendly way of getting the SType name.
96
static char * STypeName[] __attribute__((unused)) = {
46 by Gustav Hartvigsson
* Renamed DynamicArray to SDynamicArray.
97
  "NONE",
98
  "INT",
49 by Gustav Hartvigsson
* started work SBox (Untested).
99
  "LONG",
100
  "SHORT",
46 by Gustav Hartvigsson
* Renamed DynamicArray to SDynamicArray.
101
  "CHAR",
49 by Gustav Hartvigsson
* started work SBox (Untested).
102
  "WCHAR",
103
  "UINT",
104
  "ULONG",
105
  "USHORT"
46 by Gustav Hartvigsson
* Renamed DynamicArray to SDynamicArray.
106
  "BOOLEAN",
49 by Gustav Hartvigsson
* started work SBox (Untested).
107
  "STRING",
108
  "WSTRING",
109
  "UNUSED_0/INVALID",
110
  "UNUSED_1/INVALID",
111
  "UNUSED_2/INVALID",
112
  "POINTER",
46 by Gustav Hartvigsson
* Renamed DynamicArray to SDynamicArray.
113
  "OBJECT",
114
  "INVALID",
115
  0x0,
116
  0x0,
43 by Gustav Hartvigsson
* Code cleanup
117
};
26 by Gustav Hartvigsson
* Added something to config.h.in, still not sure how it cmake works.
118
50 by Gustav Hartvigsson
* Added a bindings friendly way of getting the SType name.
119
/**
120
 * @brief Get the name of the SType.
121
 *
122
 * For use in bindings.
123
 */
124
char * s_type_get_name (SType k);
46 by Gustav Hartvigsson
* Renamed DynamicArray to SDynamicArray.
125
26 by Gustav Hartvigsson
* Added something to config.h.in, still not sure how it cmake works.
126
/* Colour definitions for console prints */
127
#define RESET   "\033[0m"
128
#define BLACK   "\033[30m"      /* Black */
129
#define RED     "\033[31m"      /* Red */
130
#define GREEN   "\033[32m"      /* Green */
131
#define YELLOW  "\033[33m"      /* Yellow */
132
#define BLUE    "\033[34m"      /* Blue */
133
#define MAGENTA "\033[35m"      /* Magenta */
134
#define CYAN    "\033[36m"      /* Cyan */
135
#define WHITE   "\033[37m"      /* White */
136
#define BOLDBLACK   "\033[1m\033[30m"      /* Bold Black */
137
#define BOLDRED     "\033[1m\033[31m"      /* Bold Red */
138
#define BOLDGREEN   "\033[1m\033[32m"      /* Bold Green */
139
#define BOLDYELLOW  "\033[1m\033[33m"      /* Bold Yellow */
140
#define BOLDBLUE    "\033[1m\033[34m"      /* Bold Blue */
141
#define BOLDMAGENTA "\033[1m\033[35m"      /* Bold Magenta */
142
#define BOLDCYAN    "\033[1m\033[36m"      /* Bold Cyan */
143
#define BOLDWHITE   "\033[1m\033[37m"      /* Bold White */
144
33 by Gustav Hartvigsson
* made test_macros.h a lil' bit more portable
145
26 by Gustav Hartvigsson
* Added something to config.h.in, still not sure how it cmake works.
146
END_DECLS
147
5.2.7 by Gustav Hartvigsson
* Switched licence to a more permisive one.
148
#endif