182
183
#define S_POINTER_TO_HASH_T(p) ((hash_t)(unsigned long) p)
185
* @defgroup Types Type declarations
188
* @brief The typedefs that make up the types that are used in libssts.
193
* sboolean is the standard definition of a boolean value in SSTS.
199
* This is the way it is done in GLib, so it is done here too.
201
typedef int32_t sboolean;
204
typedef size_t hash_t;
206
/** spointer is a convinience typedef of void * */
207
typedef void* spointer;
209
/** sconstpointer is a convinience typedef of const void * */
210
typedef const void* sconstpointer;
213
* To prevent intercomparability problems we def schar and assert its size.
216
static_assert (sizeof(schar) == sizeof (int8_t),
217
"schar has the wrong size. Is not 8 bit long.");
220
* uchar is the representation for use with wide unicode strings and what not.
222
* The rationale for using char32_t as the unicode wide char instead of
223
* wchar_t is that wchar_t's size depends on the implementation, compiler,
226
* To make the wide strings actually work as they should, even over network or
227
* other communication we set this as the standard for the uchar.
229
* @warning This is not an unsigned char. If you need to store such small
232
typedef char32_t suchar;
235
* To prevent interchangeability problems we def long as int64_t.
237
typedef int64_t slong;
240
* To prevent interchangeability problems we def int as int32_t.
242
typedef int32_t sint;
245
* To prevent interchangeability problems we def short as int16_t.
247
typedef int16_t sshort;
250
* To prevent interchangeability problems we def byte as int8_t.
252
typedef int8_t sbyte;
254
/* *************************************
255
******* UNSIGNED VERSIONS ***********
256
************************************* */
259
* To prevent interchangeability problems we def ulong as uint64_t.
261
typedef uint64_t sulong;
264
* To prevent interchangeability problems we def uint as uint32_t.
266
typedef uint32_t suint;
269
* To prevent interchangeability problems we def ushort as uint16_t.
271
typedef uint16_t sushort;
274
* To prevent interchangeability problems we def ubyte as uint8_t.
276
typedef uint8_t subyte;
278
/* *********** FLOATS **************** */
280
typedef float sfloat;
281
static_assert (sizeof (sfloat) == sizeof (int8_t) * 4,
282
"sfloat has the wrong size. Is not 32 bit.");
285
typedef double sdouble;
286
static_assert (sizeof (sdouble) == sizeof (int8_t) * 8,
287
"sdouble has the wrong size. Is not 64 bit.");
290
typedef __float128 squadruple;
291
static_assert (sizeof (squadruple) == sizeof (int8_t) * 16,
292
"squadruple has the wrong size. Is not 128 bit.");
299
* Represents different types of objects.
304
S_TYPE_NONE = 0, /**< Not a type. */
305
S_TYPE_INT, /**< @ref sint */
306
S_TYPE_LONG, /**< @ref slong */
307
S_TYPE_SHORT, /**< @ref sshort */
308
S_TYPE_CHAR, /**< @ref schar */
309
S_TYPE_WCHAR, /**< @deprecated wide char (wchar_t) */
310
S_TYPE_UCHAR, /**< @ref suchar */
311
S_TYPE_UINT, /**< @ref suint */
312
S_TYPE_ULONG, /**< @ref sulong */
313
S_TYPE_USHORT, /**< @ref sushort */
314
S_TYPE_BOOLEAN, /**< @ref sboolean */
315
S_TYPE_STRING, /**< a string of @ref schar s */
316
S_TYPE_WSTRING, /**< @deprecated Platform specific wchar_t string */
317
S_TYPE_USTRING, /**< a string of @ref suchar s */
318
S_TYPE_UNUSED_0, /**< */
319
S_TYPE_UNUSED_1, /**< */
320
S_TYPE_UNUSED_2, /**< */
321
S_TYPE_POINTER, /**< @ref spointer */
322
S_TYPE_OBJECT, /**< @ref SObject */
323
S_TYPE_INVALID /** Invalid type. */
327
* The names of the SType's
331
static char * STypeName[] S_UNUSED = {
338
"UCHAR", /*< char32_t */
357
* @brief Get the name of the SType.
359
* For use in bindings.
362
s_type_get_name (SType k);
186
/* ************************************************************************** *
188
* ************************************************************************** */
365
191
* @defgroup Colours Colours
366
192
* @addtogroup Colours
368
194
* @brief Printing colours for terminal/console printing.
370
196
* Here is a list of macros for use when printing to the console.
371
197
* @ref S_COLOR_RESET is used to reset the colours back to their original
374
200
* An example on how to use them can be found in utils.h:
376
202
#define s_err_print(p, ...)\
377
203
fprintf (stderr, S_COLOR_RED "[ERR] " p S_COLOR_RESET "\n", ##__VA_ARGS__)
381
207
#define S_COLOR_RESET "\033[0m" /**< Reset */
382
208
#define S_COLOR_BLACK "\033[30m" /**< Black */
383
209
#define S_COLOR_RED "\033[31m" /**< Red */