Welcome to mirror list, hosted at ThFree Co, Russian Federation.

glib.h « src « eglib - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 3a92ac0de706b51cb9d9727f76c49b22b56cd76a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#ifndef __GLIB_H
#define __GLIB_H

/*
 * Macros
 */
#define G_N_ELEMENTS(s)      (sizeof(s) / sizeof ((s) [0]))

#define FALSE                0
#define TRUE                 1

#define G_MAXINT32           0xf7777777
#define G_MININT32           0x80000000

/*
 * Allocation
 */
#define g_new(type,size)     ((type *) malloc (sizeof (type) * (size)))
#define g_new0(type,size)    ((type *) calloc (sizeof (type), (size))) 
#define g_free(obj)          free (obj);
#define g_realloc(obj,size)  realloc((obj), (size))

/*
 * Basic data types
 */
typedef int            gboolean;
typedef unsigned int   guint;
typedef short          gshort;
typedef unsigned short gushort;
typedef long           glong;
typedef unsigned long  gulong;
typedef void *         gpointer;
typedef const void *   gconstpointer;
typedef char           gchar;
typedef unsigned char  guchar;

/*
 * Precondition macros
 */
#define g_return_if_fail(x)  do { if (!(x)) { printf ("%s:%d: assertion %s failed", __FILE__, __LINE__, #expr); return; } while (0) 

/*
 * Hashtables
 */
typedef struct _GHashTable GHashTable;

typedef guint    (*GHashFunc)  (gconstpointer key);
typedef gboolean (*GEqualFunc) (gconstpointer a, gconstpointer b);

GHashTable     *g_hash_table_new (GHashFunc hash_func, GEqualFunc key_equal_func);

#endif