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