Mercurial > pidgin
annotate libgaim/internal.h @ 15011:aca1bd4db9e8
[gaim-migrate @ 17792]
Specify that source strings are UTF-8
committer: Tailor Script <tailor@pidgin.im>
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Mon, 20 Nov 2006 22:00:31 +0000 |
parents | 390519f29a11 |
children | 59189ce09f10 |
rev | line source |
---|---|
14192 | 1 /** |
2 * @file internal.h Internal definitions and includes | |
3 * @ingroup core | |
4 * | |
5 * gaim | |
6 * | |
7 * Gaim is the legal property of its developers, whose names are too numerous | |
8 * to list here. Please refer to the COPYRIGHT file distributed with this | |
9 * source distribution. | |
10 * | |
11 * This program is free software; you can redistribute it and/or modify | |
12 * it under the terms of the GNU General Public License as published by | |
13 * the Free Software Foundation; either version 2 of the License, or | |
14 * (at your option) any later version. | |
15 * | |
16 * This program is distributed in the hope that it will be useful, | |
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 * GNU General Public License for more details. | |
20 * | |
21 * You should have received a copy of the GNU General Public License | |
22 * along with this program; if not, write to the Free Software | |
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
24 */ | |
25 #ifndef _GAIM_INTERNAL_H_ | |
26 #define _GAIM_INTERNAL_H_ | |
27 | |
28 #ifdef HAVE_CONFIG_H | |
29 # include <config.h> | |
30 #endif | |
31 | |
32 /* | |
33 * If we're using NLS, make sure gettext works. If not, then define | |
34 * dummy macros in place of the normal gettext macros. | |
35 * | |
36 * Also, the perl XS config.h file sometimes defines _ So we need to | |
37 * make sure _ isn't already defined before trying to define it. | |
38 * | |
39 * The Singular/Plural/Number ngettext dummy definition below was | |
40 * taken from an email to the texinfo mailing list by Manuel Guerrero. | |
41 * Thank you Manuel, and thank you Alex's good friend Google. | |
42 */ | |
43 #ifdef ENABLE_NLS | |
44 # include <locale.h> | |
45 # include <libintl.h> | |
14280 | 46 # define _(String) ((const char *)gettext(String)) |
14192 | 47 # ifdef gettext_noop |
48 # define N_(String) gettext_noop (String) | |
49 # else | |
50 # define N_(String) (String) | |
51 # endif | |
52 #else | |
53 # include <locale.h> | |
54 # define N_(String) (String) | |
55 # ifndef _ | |
14280 | 56 # define _(String) ((const char *)String) |
14192 | 57 # endif |
58 # define ngettext(Singular, Plural, Number) ((Number == 1) ? ((const char *)Singular) : ((const char *)Plural)) | |
59 #endif | |
60 | |
61 #ifdef HAVE_ENDIAN_H | |
62 # include <endian.h> | |
63 #endif | |
64 | |
65 #define MSG_LEN 2048 | |
66 /* The above should normally be the same as BUF_LEN, | |
67 * but just so we're explicitly asking for the max message | |
68 * length. */ | |
69 #define BUF_LEN MSG_LEN | |
70 #define BUF_LONG BUF_LEN * 2 | |
71 | |
72 #include <sys/stat.h> | |
73 #include <sys/types.h> | |
74 #ifndef _WIN32 | |
14271
9e5c28c3b163
[gaim-migrate @ 16954]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14192
diff
changeset
|
75 #include <sys/time.h> |
14192 | 76 #include <sys/wait.h> |
77 #endif | |
78 #include <ctype.h> | |
79 #include <errno.h> | |
80 #include <fcntl.h> | |
81 #include <math.h> | |
82 #include <stdio.h> | |
83 #include <stdlib.h> | |
84 #include <string.h> | |
85 #include <time.h> | |
86 | |
87 #ifdef HAVE_ICONV | |
88 #include <iconv.h> | |
89 #endif | |
90 | |
91 #ifdef HAVE_LANGINFO_CODESET | |
92 #include <langinfo.h> | |
93 #endif | |
94 | |
95 #ifdef GAIM_PLUGINS | |
96 # include <gmodule.h> | |
97 # ifndef _WIN32 | |
98 # include <dlfcn.h> | |
99 # endif | |
100 #endif | |
101 | |
102 #ifndef _WIN32 | |
103 # include <netinet/in.h> | |
104 # include <sys/socket.h> | |
105 # include <arpa/inet.h> | |
106 # include <sys/un.h> | |
107 # include <sys/utsname.h> | |
108 # include <netdb.h> | |
109 # include <signal.h> | |
110 # include <unistd.h> | |
111 #endif | |
112 | |
113 #ifndef MAXPATHLEN | |
114 # define MAXPATHLEN 1024 | |
115 #endif | |
116 | |
117 #ifndef HOST_NAME_MAX | |
118 # define HOST_NAME_MAX 255 | |
119 #endif | |
120 | |
121 #define PATHSIZE 1024 | |
122 | |
123 #include <glib.h> | |
14645 | 124 #if !GLIB_CHECK_VERSION(2,4,0) |
125 # define G_MAXUINT32 ((guint32) 0xffffffff) | |
126 #endif | |
127 | |
14192 | 128 #if GLIB_CHECK_VERSION(2,6,0) |
129 # include <glib/gstdio.h> | |
130 #endif | |
131 | |
132 #if !GLIB_CHECK_VERSION(2,6,0) | |
133 # define g_freopen freopen | |
134 # define g_fopen fopen | |
135 # define g_rmdir rmdir | |
136 # define g_remove remove | |
137 # define g_unlink unlink | |
138 # define g_lstat lstat | |
139 # define g_stat stat | |
140 # define g_mkdir mkdir | |
141 # define g_rename rename | |
142 # define g_open open | |
143 #endif | |
144 | |
14912
390519f29a11
[gaim-migrate @ 17684]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14645
diff
changeset
|
145 #if !GLIB_CHECK_VERSION(2,8,0) |
390519f29a11
[gaim-migrate @ 17684]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14645
diff
changeset
|
146 # define g_access access |
390519f29a11
[gaim-migrate @ 17684]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14645
diff
changeset
|
147 #endif |
390519f29a11
[gaim-migrate @ 17684]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14645
diff
changeset
|
148 |
14192 | 149 #if !GLIB_CHECK_VERSION(2,10,0) |
150 # define g_slice_new(type) g_new(type, 1) | |
151 # define g_slice_new0(type) g_new0(type, 1) | |
152 # define g_slice_free(type, mem) g_free(mem) | |
153 #endif | |
154 | |
14912
390519f29a11
[gaim-migrate @ 17684]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14645
diff
changeset
|
155 #ifdef _WIN32 |
390519f29a11
[gaim-migrate @ 17684]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14645
diff
changeset
|
156 #include "win32dep.h" |
390519f29a11
[gaim-migrate @ 17684]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14645
diff
changeset
|
157 #endif |
390519f29a11
[gaim-migrate @ 17684]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14645
diff
changeset
|
158 |
14192 | 159 /* ugly ugly ugly */ |
160 /* This is a workaround for the fact that G_GINT64_MODIFIER and G_GSIZE_FORMAT | |
161 * are only defined in Glib >= 2.4 */ | |
162 #ifndef G_GINT64_MODIFIER | |
163 # if GLIB_SIZEOF_LONG == 8 | |
164 # define G_GINT64_MODIFIER "l" | |
165 # else | |
166 # define G_GINT64_MODIFIER "ll" | |
167 # endif | |
168 #endif | |
169 | |
170 #ifndef G_GSIZE_FORMAT | |
171 # if GLIB_SIZEOF_LONG == 8 | |
172 # define G_GSIZE_FORMAT "lu" | |
173 # else | |
174 # define G_GSIZE_FORMAT "u" | |
175 # endif | |
176 #endif | |
177 | |
178 /* Safer ways to work with static buffers. When using non-static | |
179 * buffers, either use g_strdup_* functions (preferred) or use | |
180 * g_strlcpy/g_strlcpy directly. */ | |
181 #define gaim_strlcpy(dest, src) g_strlcpy(dest, src, sizeof(dest)) | |
182 #define gaim_strlcat(dest, src) g_strlcat(dest, src, sizeof(dest)) | |
183 | |
184 #define GAIM_WEBSITE "http://gaim.sourceforge.net/" | |
185 | |
186 #ifndef _WIN32 | |
187 /* Everything needs to include this, because | |
188 * everything gets the autoconf macros */ | |
189 #include "prefix.h" | |
190 #endif /* _WIN32 */ | |
191 | |
192 #endif /* _GAIM_INTERNAL_H_ */ |