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