imported irssi.
[silc.git] / apps / irssi / src / common.h
1 #ifndef __COMMON_H
2 #define __COMMON_H
3
4 #define IRSSI_AUTHOR "Timo Sirainen <tss@iki.fi>"
5 #define IRSSI_WEBSITE "http://irssi.org/"
6
7 #ifdef HAVE_CONFIG_H
8 #include "config.h"
9 #endif
10
11 #include <stdio.h>
12 #include <stddef.h>
13 #include <stdarg.h>
14 #include <ctype.h>
15 #  ifdef HAVE_STRING_H
16 #include <string.h>
17 #endif
18 #ifdef HAVE_STDLIB_H
19 #  include <stdlib.h>
20 #endif
21 #include <errno.h>
22 #include <time.h>
23
24 #include <sys/types.h>
25 #ifdef HAVE_SYS_TIME_H
26 #  include <sys/time.h>
27 #endif
28 #include <sys/stat.h>
29
30 #ifdef HAVE_UNISTD_H
31 #  include <unistd.h>
32 #endif
33 #ifdef HAVE_DIRENT_H
34 #  include <dirent.h>
35 #endif
36 #include <fcntl.h>
37 #ifdef WIN32
38 #  include <win32-compat.h>
39 #endif
40
41 #include <glib.h>
42 #ifdef HAVE_GMODULE
43 #  include <gmodule.h>
44 #endif
45
46 #include "core/memdebug.h"
47
48 #define g_free_not_null(a) \
49         G_STMT_START { \
50           if (a) g_free(a); \
51         } G_STMT_END
52
53 #define g_free_and_null(a) \
54         G_STMT_START { \
55           if (a) { g_free(a); (a) = NULL; } \
56         } G_STMT_END
57
58 #define G_INPUT_READ    (1 << 0)
59 #define G_INPUT_WRITE   (1 << 1)
60
61 typedef void (*GInputFunction) (void *data, GIOChannel *source, int condition);
62
63 int g_input_add(GIOChannel *source, int condition,
64                 GInputFunction function, void *data);
65 int g_input_add_full(GIOChannel *source, int priority, int condition,
66                      GInputFunction function, void *data);
67
68 #define MAX_INT_STRLEN ((sizeof(int) * CHAR_BIT + 2) / 3 + 1)
69
70 typedef struct _IPADDR IPADDR;
71 typedef struct _CONFIG_REC CONFIG_REC;
72 typedef struct _CONFIG_NODE CONFIG_NODE;
73
74 typedef struct _LINEBUF_REC LINEBUF_REC;
75 typedef struct _NET_SENDBUF_REC NET_SENDBUF_REC;
76 typedef struct _RAWLOG_REC RAWLOG_REC;
77
78 typedef struct _CHATNET_REC CHATNET_REC;
79 typedef struct _SERVER_REC SERVER_REC;
80 typedef struct _WI_ITEM_REC WI_ITEM_REC;
81 typedef struct _CHANNEL_REC CHANNEL_REC;
82 typedef struct _QUERY_REC QUERY_REC;
83 typedef struct _NICK_REC NICK_REC;
84
85 typedef struct _SERVER_CONNECT_REC SERVER_CONNECT_REC;
86 typedef struct _SERVER_SETUP_REC SERVER_SETUP_REC;
87 typedef struct _CHANNEL_SETUP_REC CHANNEL_SETUP_REC;
88
89 #endif