annotate intl/loadmsgcat.c @ 360:222a0d71cbcf trunk

[svn] - change our slogan to "The future of UNIX multimedia." - clarify who is developing on 0.2 and who developed on the 0.1 branch. - extend our copyright to 2006
author nenolod
date Fri, 30 Dec 2005 17:39:28 -0800
parents cb178e5ad177
children f12d7e208b43
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1 /* Load needed message catalogs.
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
2 Copyright (C) 1995-1999, 2000-2003 Free Software Foundation, Inc.
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
3
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
4 This program is free software; you can redistribute it and/or modify it
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
5 under the terms of the GNU Library General Public License as published
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
6 by the Free Software Foundation; either version 2, or (at your option)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
7 any later version.
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
8
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
9 This program is distributed in the hope that it will be useful,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
12 Library General Public License for more details.
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
13
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
14 You should have received a copy of the GNU Library General Public
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
15 License along with this program; if not, write to the Free Software
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
16 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
17 USA. */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
18
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
19 /* Tell glibc's <string.h> to provide a prototype for mempcpy().
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
20 This must come before <config.h> because <config.h> may include
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
21 <features.h>, and once <features.h> has been included, it's too late. */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
22 #ifndef _GNU_SOURCE
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
23 # define _GNU_SOURCE 1
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
24 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
25
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
26 #ifdef HAVE_CONFIG_H
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
27 # include <config.h>
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
28 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
29
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
30 #include <ctype.h>
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
31 #include <errno.h>
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
32 #include <fcntl.h>
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
33 #include <sys/types.h>
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
34 #include <sys/stat.h>
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
35
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
36 #ifdef __GNUC__
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
37 # undef alloca
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
38 # define alloca __builtin_alloca
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
39 # define HAVE_ALLOCA 1
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
40 #else
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
41 # ifdef _MSC_VER
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
42 # include <malloc.h>
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
43 # define alloca _alloca
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
44 # else
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
45 # if defined HAVE_ALLOCA_H || defined _LIBC
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
46 # include <alloca.h>
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
47 # else
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
48 # ifdef _AIX
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
49 #pragma alloca
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
50 # else
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
51 # ifndef alloca
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
52 char *alloca ();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
53 # endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
54 # endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
55 # endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
56 # endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
57 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
58
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
59 #include <stdlib.h>
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
60 #include <string.h>
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
61
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
62 #if defined HAVE_UNISTD_H || defined _LIBC
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
63 # include <unistd.h>
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
64 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
65
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
66 #ifdef _LIBC
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
67 # include <langinfo.h>
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
68 # include <locale.h>
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
69 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
70
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
71 #if (defined HAVE_MMAP && defined HAVE_MUNMAP && !defined DISALLOW_MMAP) \
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
72 || (defined _LIBC && defined _POSIX_MAPPED_FILES)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
73 # include <sys/mman.h>
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
74 # undef HAVE_MMAP
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
75 # define HAVE_MMAP 1
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
76 #else
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
77 # undef HAVE_MMAP
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
78 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
79
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
80 #if defined HAVE_STDINT_H_WITH_UINTMAX || defined _LIBC
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
81 # include <stdint.h>
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
82 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
83 #if defined HAVE_INTTYPES_H || defined _LIBC
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
84 # include <inttypes.h>
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
85 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
86
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
87 #include "gmo.h"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
88 #include "gettextP.h"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
89 #include "hash-string.h"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
90 #include "plural-exp.h"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
91
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
92 #ifdef _LIBC
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
93 # include "../locale/localeinfo.h"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
94 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
95
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
96 /* Provide fallback values for macros that ought to be defined in <inttypes.h>.
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
97 Note that our fallback values need not be literal strings, because we don't
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
98 use them with preprocessor string concatenation. */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
99 #if !defined PRId8 || PRI_MACROS_BROKEN
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
100 # undef PRId8
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
101 # define PRId8 "d"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
102 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
103 #if !defined PRIi8 || PRI_MACROS_BROKEN
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
104 # undef PRIi8
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
105 # define PRIi8 "i"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
106 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
107 #if !defined PRIo8 || PRI_MACROS_BROKEN
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
108 # undef PRIo8
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
109 # define PRIo8 "o"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
110 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
111 #if !defined PRIu8 || PRI_MACROS_BROKEN
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
112 # undef PRIu8
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
113 # define PRIu8 "u"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
114 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
115 #if !defined PRIx8 || PRI_MACROS_BROKEN
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
116 # undef PRIx8
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
117 # define PRIx8 "x"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
118 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
119 #if !defined PRIX8 || PRI_MACROS_BROKEN
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
120 # undef PRIX8
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
121 # define PRIX8 "X"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
122 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
123 #if !defined PRId16 || PRI_MACROS_BROKEN
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
124 # undef PRId16
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
125 # define PRId16 "d"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
126 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
127 #if !defined PRIi16 || PRI_MACROS_BROKEN
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
128 # undef PRIi16
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
129 # define PRIi16 "i"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
130 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
131 #if !defined PRIo16 || PRI_MACROS_BROKEN
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
132 # undef PRIo16
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
133 # define PRIo16 "o"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
134 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
135 #if !defined PRIu16 || PRI_MACROS_BROKEN
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
136 # undef PRIu16
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
137 # define PRIu16 "u"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
138 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
139 #if !defined PRIx16 || PRI_MACROS_BROKEN
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
140 # undef PRIx16
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
141 # define PRIx16 "x"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
142 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
143 #if !defined PRIX16 || PRI_MACROS_BROKEN
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
144 # undef PRIX16
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
145 # define PRIX16 "X"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
146 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
147 #if !defined PRId32 || PRI_MACROS_BROKEN
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
148 # undef PRId32
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
149 # define PRId32 "d"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
150 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
151 #if !defined PRIi32 || PRI_MACROS_BROKEN
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
152 # undef PRIi32
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
153 # define PRIi32 "i"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
154 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
155 #if !defined PRIo32 || PRI_MACROS_BROKEN
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
156 # undef PRIo32
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
157 # define PRIo32 "o"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
158 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
159 #if !defined PRIu32 || PRI_MACROS_BROKEN
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
160 # undef PRIu32
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
161 # define PRIu32 "u"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
162 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
163 #if !defined PRIx32 || PRI_MACROS_BROKEN
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
164 # undef PRIx32
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
165 # define PRIx32 "x"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
166 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
167 #if !defined PRIX32 || PRI_MACROS_BROKEN
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
168 # undef PRIX32
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
169 # define PRIX32 "X"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
170 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
171 #if !defined PRId64 || PRI_MACROS_BROKEN
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
172 # undef PRId64
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
173 # define PRId64 (sizeof (long) == 8 ? "ld" : "lld")
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
174 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
175 #if !defined PRIi64 || PRI_MACROS_BROKEN
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
176 # undef PRIi64
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
177 # define PRIi64 (sizeof (long) == 8 ? "li" : "lli")
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
178 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
179 #if !defined PRIo64 || PRI_MACROS_BROKEN
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
180 # undef PRIo64
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
181 # define PRIo64 (sizeof (long) == 8 ? "lo" : "llo")
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
182 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
183 #if !defined PRIu64 || PRI_MACROS_BROKEN
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
184 # undef PRIu64
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
185 # define PRIu64 (sizeof (long) == 8 ? "lu" : "llu")
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
186 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
187 #if !defined PRIx64 || PRI_MACROS_BROKEN
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
188 # undef PRIx64
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
189 # define PRIx64 (sizeof (long) == 8 ? "lx" : "llx")
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
190 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
191 #if !defined PRIX64 || PRI_MACROS_BROKEN
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
192 # undef PRIX64
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
193 # define PRIX64 (sizeof (long) == 8 ? "lX" : "llX")
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
194 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
195 #if !defined PRIdLEAST8 || PRI_MACROS_BROKEN
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
196 # undef PRIdLEAST8
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
197 # define PRIdLEAST8 "d"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
198 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
199 #if !defined PRIiLEAST8 || PRI_MACROS_BROKEN
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
200 # undef PRIiLEAST8
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
201 # define PRIiLEAST8 "i"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
202 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
203 #if !defined PRIoLEAST8 || PRI_MACROS_BROKEN
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
204 # undef PRIoLEAST8
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
205 # define PRIoLEAST8 "o"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
206 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
207 #if !defined PRIuLEAST8 || PRI_MACROS_BROKEN
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
208 # undef PRIuLEAST8
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
209 # define PRIuLEAST8 "u"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
210 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
211 #if !defined PRIxLEAST8 || PRI_MACROS_BROKEN
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
212 # undef PRIxLEAST8
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
213 # define PRIxLEAST8 "x"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
214 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
215 #if !defined PRIXLEAST8 || PRI_MACROS_BROKEN
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
216 # undef PRIXLEAST8
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
217 # define PRIXLEAST8 "X"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
218 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
219 #if !defined PRIdLEAST16 || PRI_MACROS_BROKEN
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
220 # undef PRIdLEAST16
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
221 # define PRIdLEAST16 "d"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
222 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
223 #if !defined PRIiLEAST16 || PRI_MACROS_BROKEN
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
224 # undef PRIiLEAST16
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
225 # define PRIiLEAST16 "i"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
226 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
227 #if !defined PRIoLEAST16 || PRI_MACROS_BROKEN
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
228 # undef PRIoLEAST16
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
229 # define PRIoLEAST16 "o"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
230 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
231 #if !defined PRIuLEAST16 || PRI_MACROS_BROKEN
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
232 # undef PRIuLEAST16
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
233 # define PRIuLEAST16 "u"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
234 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
235 #if !defined PRIxLEAST16 || PRI_MACROS_BROKEN
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
236 # undef PRIxLEAST16
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
237 # define PRIxLEAST16 "x"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
238 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
239 #if !defined PRIXLEAST16 || PRI_MACROS_BROKEN
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
240 # undef PRIXLEAST16
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
241 # define PRIXLEAST16 "X"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
242 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
243 #if !defined PRIdLEAST32 || PRI_MACROS_BROKEN
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
244 # undef PRIdLEAST32
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
245 # define PRIdLEAST32 "d"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
246 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
247 #if !defined PRIiLEAST32 || PRI_MACROS_BROKEN
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
248 # undef PRIiLEAST32
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
249 # define PRIiLEAST32 "i"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
250 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
251 #if !defined PRIoLEAST32 || PRI_MACROS_BROKEN
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
252 # undef PRIoLEAST32
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
253 # define PRIoLEAST32 "o"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
254 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
255 #if !defined PRIuLEAST32 || PRI_MACROS_BROKEN
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
256 # undef PRIuLEAST32
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
257 # define PRIuLEAST32 "u"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
258 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
259 #if !defined PRIxLEAST32 || PRI_MACROS_BROKEN
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
260 # undef PRIxLEAST32
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
261 # define PRIxLEAST32 "x"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
262 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
263 #if !defined PRIXLEAST32 || PRI_MACROS_BROKEN
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
264 # undef PRIXLEAST32
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
265 # define PRIXLEAST32 "X"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
266 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
267 #if !defined PRIdLEAST64 || PRI_MACROS_BROKEN
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
268 # undef PRIdLEAST64
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
269 # define PRIdLEAST64 PRId64
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
270 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
271 #if !defined PRIiLEAST64 || PRI_MACROS_BROKEN
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
272 # undef PRIiLEAST64
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
273 # define PRIiLEAST64 PRIi64
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
274 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
275 #if !defined PRIoLEAST64 || PRI_MACROS_BROKEN
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
276 # undef PRIoLEAST64
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
277 # define PRIoLEAST64 PRIo64
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
278 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
279 #if !defined PRIuLEAST64 || PRI_MACROS_BROKEN
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
280 # undef PRIuLEAST64
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
281 # define PRIuLEAST64 PRIu64
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
282 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
283 #if !defined PRIxLEAST64 || PRI_MACROS_BROKEN
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
284 # undef PRIxLEAST64
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
285 # define PRIxLEAST64 PRIx64
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
286 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
287 #if !defined PRIXLEAST64 || PRI_MACROS_BROKEN
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
288 # undef PRIXLEAST64
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
289 # define PRIXLEAST64 PRIX64
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
290 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
291 #if !defined PRIdFAST8 || PRI_MACROS_BROKEN
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
292 # undef PRIdFAST8
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
293 # define PRIdFAST8 "d"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
294 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
295 #if !defined PRIiFAST8 || PRI_MACROS_BROKEN
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
296 # undef PRIiFAST8
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
297 # define PRIiFAST8 "i"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
298 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
299 #if !defined PRIoFAST8 || PRI_MACROS_BROKEN
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
300 # undef PRIoFAST8
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
301 # define PRIoFAST8 "o"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
302 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
303 #if !defined PRIuFAST8 || PRI_MACROS_BROKEN
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
304 # undef PRIuFAST8
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
305 # define PRIuFAST8 "u"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
306 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
307 #if !defined PRIxFAST8 || PRI_MACROS_BROKEN
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
308 # undef PRIxFAST8
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
309 # define PRIxFAST8 "x"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
310 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
311 #if !defined PRIXFAST8 || PRI_MACROS_BROKEN
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
312 # undef PRIXFAST8
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
313 # define PRIXFAST8 "X"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
314 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
315 #if !defined PRIdFAST16 || PRI_MACROS_BROKEN
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
316 # undef PRIdFAST16
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
317 # define PRIdFAST16 "d"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
318 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
319 #if !defined PRIiFAST16 || PRI_MACROS_BROKEN
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
320 # undef PRIiFAST16
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
321 # define PRIiFAST16 "i"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
322 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
323 #if !defined PRIoFAST16 || PRI_MACROS_BROKEN
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
324 # undef PRIoFAST16
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
325 # define PRIoFAST16 "o"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
326 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
327 #if !defined PRIuFAST16 || PRI_MACROS_BROKEN
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
328 # undef PRIuFAST16
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
329 # define PRIuFAST16 "u"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
330 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
331 #if !defined PRIxFAST16 || PRI_MACROS_BROKEN
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
332 # undef PRIxFAST16
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
333 # define PRIxFAST16 "x"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
334 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
335 #if !defined PRIXFAST16 || PRI_MACROS_BROKEN
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
336 # undef PRIXFAST16
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
337 # define PRIXFAST16 "X"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
338 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
339 #if !defined PRIdFAST32 || PRI_MACROS_BROKEN
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
340 # undef PRIdFAST32
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
341 # define PRIdFAST32 "d"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
342 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
343 #if !defined PRIiFAST32 || PRI_MACROS_BROKEN
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
344 # undef PRIiFAST32
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
345 # define PRIiFAST32 "i"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
346 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
347 #if !defined PRIoFAST32 || PRI_MACROS_BROKEN
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
348 # undef PRIoFAST32
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
349 # define PRIoFAST32 "o"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
350 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
351 #if !defined PRIuFAST32 || PRI_MACROS_BROKEN
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
352 # undef PRIuFAST32
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
353 # define PRIuFAST32 "u"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
354 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
355 #if !defined PRIxFAST32 || PRI_MACROS_BROKEN
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
356 # undef PRIxFAST32
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
357 # define PRIxFAST32 "x"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
358 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
359 #if !defined PRIXFAST32 || PRI_MACROS_BROKEN
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
360 # undef PRIXFAST32
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
361 # define PRIXFAST32 "X"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
362 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
363 #if !defined PRIdFAST64 || PRI_MACROS_BROKEN
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
364 # undef PRIdFAST64
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
365 # define PRIdFAST64 PRId64
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
366 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
367 #if !defined PRIiFAST64 || PRI_MACROS_BROKEN
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
368 # undef PRIiFAST64
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
369 # define PRIiFAST64 PRIi64
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
370 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
371 #if !defined PRIoFAST64 || PRI_MACROS_BROKEN
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
372 # undef PRIoFAST64
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
373 # define PRIoFAST64 PRIo64
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
374 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
375 #if !defined PRIuFAST64 || PRI_MACROS_BROKEN
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
376 # undef PRIuFAST64
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
377 # define PRIuFAST64 PRIu64
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
378 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
379 #if !defined PRIxFAST64 || PRI_MACROS_BROKEN
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
380 # undef PRIxFAST64
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
381 # define PRIxFAST64 PRIx64
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
382 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
383 #if !defined PRIXFAST64 || PRI_MACROS_BROKEN
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
384 # undef PRIXFAST64
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
385 # define PRIXFAST64 PRIX64
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
386 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
387 #if !defined PRIdMAX || PRI_MACROS_BROKEN
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
388 # undef PRIdMAX
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
389 # define PRIdMAX (sizeof (uintmax_t) == sizeof (long) ? "ld" : "lld")
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
390 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
391 #if !defined PRIiMAX || PRI_MACROS_BROKEN
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
392 # undef PRIiMAX
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
393 # define PRIiMAX (sizeof (uintmax_t) == sizeof (long) ? "li" : "lli")
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
394 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
395 #if !defined PRIoMAX || PRI_MACROS_BROKEN
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
396 # undef PRIoMAX
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
397 # define PRIoMAX (sizeof (uintmax_t) == sizeof (long) ? "lo" : "llo")
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
398 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
399 #if !defined PRIuMAX || PRI_MACROS_BROKEN
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
400 # undef PRIuMAX
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
401 # define PRIuMAX (sizeof (uintmax_t) == sizeof (long) ? "lu" : "llu")
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
402 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
403 #if !defined PRIxMAX || PRI_MACROS_BROKEN
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
404 # undef PRIxMAX
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
405 # define PRIxMAX (sizeof (uintmax_t) == sizeof (long) ? "lx" : "llx")
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
406 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
407 #if !defined PRIXMAX || PRI_MACROS_BROKEN
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
408 # undef PRIXMAX
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
409 # define PRIXMAX (sizeof (uintmax_t) == sizeof (long) ? "lX" : "llX")
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
410 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
411 #if !defined PRIdPTR || PRI_MACROS_BROKEN
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
412 # undef PRIdPTR
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
413 # define PRIdPTR \
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
414 (sizeof (void *) == sizeof (long) ? "ld" : \
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
415 sizeof (void *) == sizeof (int) ? "d" : \
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
416 "lld")
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
417 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
418 #if !defined PRIiPTR || PRI_MACROS_BROKEN
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
419 # undef PRIiPTR
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
420 # define PRIiPTR \
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
421 (sizeof (void *) == sizeof (long) ? "li" : \
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
422 sizeof (void *) == sizeof (int) ? "i" : \
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
423 "lli")
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
424 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
425 #if !defined PRIoPTR || PRI_MACROS_BROKEN
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
426 # undef PRIoPTR
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
427 # define PRIoPTR \
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
428 (sizeof (void *) == sizeof (long) ? "lo" : \
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
429 sizeof (void *) == sizeof (int) ? "o" : \
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
430 "llo")
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
431 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
432 #if !defined PRIuPTR || PRI_MACROS_BROKEN
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
433 # undef PRIuPTR
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
434 # define PRIuPTR \
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
435 (sizeof (void *) == sizeof (long) ? "lu" : \
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
436 sizeof (void *) == sizeof (int) ? "u" : \
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
437 "llu")
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
438 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
439 #if !defined PRIxPTR || PRI_MACROS_BROKEN
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
440 # undef PRIxPTR
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
441 # define PRIxPTR \
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
442 (sizeof (void *) == sizeof (long) ? "lx" : \
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
443 sizeof (void *) == sizeof (int) ? "x" : \
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
444 "llx")
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
445 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
446 #if !defined PRIXPTR || PRI_MACROS_BROKEN
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
447 # undef PRIXPTR
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
448 # define PRIXPTR \
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
449 (sizeof (void *) == sizeof (long) ? "lX" : \
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
450 sizeof (void *) == sizeof (int) ? "X" : \
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
451 "llX")
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
452 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
453
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
454 /* @@ end of prolog @@ */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
455
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
456 #ifdef _LIBC
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
457 /* Rename the non ISO C functions. This is required by the standard
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
458 because some ISO C functions will require linking with this object
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
459 file and the name space must not be polluted. */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
460 # define open __open
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
461 # define close __close
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
462 # define read __read
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
463 # define mmap __mmap
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
464 # define munmap __munmap
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
465 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
466
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
467 /* For those losing systems which don't have `alloca' we have to add
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
468 some additional code emulating it. */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
469 #ifdef HAVE_ALLOCA
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
470 # define freea(p) /* nothing */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
471 #else
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
472 # define alloca(n) malloc (n)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
473 # define freea(p) free (p)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
474 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
475
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
476 /* For systems that distinguish between text and binary I/O.
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
477 O_BINARY is usually declared in <fcntl.h>. */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
478 #if !defined O_BINARY && defined _O_BINARY
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
479 /* For MSC-compatible compilers. */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
480 # define O_BINARY _O_BINARY
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
481 # define O_TEXT _O_TEXT
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
482 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
483 #ifdef __BEOS__
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
484 /* BeOS 5 has O_BINARY and O_TEXT, but they have no effect. */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
485 # undef O_BINARY
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
486 # undef O_TEXT
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
487 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
488 /* On reasonable systems, binary I/O is the default. */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
489 #ifndef O_BINARY
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
490 # define O_BINARY 0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
491 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
492
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
493
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
494 /* Prototypes for local functions. Needed to ensure compiler checking of
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
495 function argument counts despite of K&R C function definition syntax. */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
496 static const char *get_sysdep_segment_value PARAMS ((const char *name));
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
497
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
498
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
499 /* We need a sign, whether a new catalog was loaded, which can be associated
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
500 with all translations. This is important if the translations are
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
501 cached by one of GCC's features. */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
502 int _nl_msg_cat_cntr;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
503
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
504
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
505 /* Expand a system dependent string segment. Return NULL if unsupported. */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
506 static const char *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
507 get_sysdep_segment_value (name)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
508 const char *name;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
509 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
510 /* Test for an ISO C 99 section 7.8.1 format string directive.
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
511 Syntax:
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
512 P R I { d | i | o | u | x | X }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
513 { { | LEAST | FAST } { 8 | 16 | 32 | 64 } | MAX | PTR } */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
514 /* We don't use a table of 14 times 6 'const char *' strings here, because
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
515 data relocations cost startup time. */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
516 if (name[0] == 'P' && name[1] == 'R' && name[2] == 'I')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
517 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
518 if (name[3] == 'd' || name[3] == 'i' || name[3] == 'o' || name[3] == 'u'
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
519 || name[3] == 'x' || name[3] == 'X')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
520 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
521 if (name[4] == '8' && name[5] == '\0')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
522 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
523 if (name[3] == 'd')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
524 return PRId8;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
525 if (name[3] == 'i')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
526 return PRIi8;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
527 if (name[3] == 'o')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
528 return PRIo8;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
529 if (name[3] == 'u')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
530 return PRIu8;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
531 if (name[3] == 'x')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
532 return PRIx8;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
533 if (name[3] == 'X')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
534 return PRIX8;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
535 abort ();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
536 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
537 if (name[4] == '1' && name[5] == '6' && name[6] == '\0')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
538 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
539 if (name[3] == 'd')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
540 return PRId16;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
541 if (name[3] == 'i')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
542 return PRIi16;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
543 if (name[3] == 'o')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
544 return PRIo16;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
545 if (name[3] == 'u')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
546 return PRIu16;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
547 if (name[3] == 'x')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
548 return PRIx16;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
549 if (name[3] == 'X')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
550 return PRIX16;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
551 abort ();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
552 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
553 if (name[4] == '3' && name[5] == '2' && name[6] == '\0')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
554 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
555 if (name[3] == 'd')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
556 return PRId32;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
557 if (name[3] == 'i')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
558 return PRIi32;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
559 if (name[3] == 'o')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
560 return PRIo32;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
561 if (name[3] == 'u')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
562 return PRIu32;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
563 if (name[3] == 'x')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
564 return PRIx32;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
565 if (name[3] == 'X')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
566 return PRIX32;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
567 abort ();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
568 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
569 if (name[4] == '6' && name[5] == '4' && name[6] == '\0')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
570 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
571 if (name[3] == 'd')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
572 return PRId64;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
573 if (name[3] == 'i')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
574 return PRIi64;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
575 if (name[3] == 'o')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
576 return PRIo64;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
577 if (name[3] == 'u')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
578 return PRIu64;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
579 if (name[3] == 'x')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
580 return PRIx64;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
581 if (name[3] == 'X')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
582 return PRIX64;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
583 abort ();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
584 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
585 if (name[4] == 'L' && name[5] == 'E' && name[6] == 'A'
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
586 && name[7] == 'S' && name[8] == 'T')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
587 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
588 if (name[9] == '8' && name[10] == '\0')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
589 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
590 if (name[3] == 'd')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
591 return PRIdLEAST8;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
592 if (name[3] == 'i')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
593 return PRIiLEAST8;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
594 if (name[3] == 'o')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
595 return PRIoLEAST8;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
596 if (name[3] == 'u')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
597 return PRIuLEAST8;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
598 if (name[3] == 'x')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
599 return PRIxLEAST8;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
600 if (name[3] == 'X')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
601 return PRIXLEAST8;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
602 abort ();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
603 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
604 if (name[9] == '1' && name[10] == '6' && name[11] == '\0')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
605 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
606 if (name[3] == 'd')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
607 return PRIdLEAST16;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
608 if (name[3] == 'i')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
609 return PRIiLEAST16;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
610 if (name[3] == 'o')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
611 return PRIoLEAST16;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
612 if (name[3] == 'u')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
613 return PRIuLEAST16;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
614 if (name[3] == 'x')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
615 return PRIxLEAST16;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
616 if (name[3] == 'X')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
617 return PRIXLEAST16;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
618 abort ();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
619 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
620 if (name[9] == '3' && name[10] == '2' && name[11] == '\0')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
621 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
622 if (name[3] == 'd')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
623 return PRIdLEAST32;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
624 if (name[3] == 'i')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
625 return PRIiLEAST32;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
626 if (name[3] == 'o')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
627 return PRIoLEAST32;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
628 if (name[3] == 'u')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
629 return PRIuLEAST32;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
630 if (name[3] == 'x')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
631 return PRIxLEAST32;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
632 if (name[3] == 'X')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
633 return PRIXLEAST32;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
634 abort ();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
635 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
636 if (name[9] == '6' && name[10] == '4' && name[11] == '\0')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
637 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
638 if (name[3] == 'd')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
639 return PRIdLEAST64;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
640 if (name[3] == 'i')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
641 return PRIiLEAST64;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
642 if (name[3] == 'o')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
643 return PRIoLEAST64;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
644 if (name[3] == 'u')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
645 return PRIuLEAST64;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
646 if (name[3] == 'x')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
647 return PRIxLEAST64;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
648 if (name[3] == 'X')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
649 return PRIXLEAST64;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
650 abort ();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
651 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
652 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
653 if (name[4] == 'F' && name[5] == 'A' && name[6] == 'S'
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
654 && name[7] == 'T')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
655 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
656 if (name[8] == '8' && name[9] == '\0')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
657 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
658 if (name[3] == 'd')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
659 return PRIdFAST8;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
660 if (name[3] == 'i')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
661 return PRIiFAST8;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
662 if (name[3] == 'o')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
663 return PRIoFAST8;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
664 if (name[3] == 'u')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
665 return PRIuFAST8;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
666 if (name[3] == 'x')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
667 return PRIxFAST8;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
668 if (name[3] == 'X')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
669 return PRIXFAST8;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
670 abort ();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
671 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
672 if (name[8] == '1' && name[9] == '6' && name[10] == '\0')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
673 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
674 if (name[3] == 'd')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
675 return PRIdFAST16;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
676 if (name[3] == 'i')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
677 return PRIiFAST16;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
678 if (name[3] == 'o')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
679 return PRIoFAST16;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
680 if (name[3] == 'u')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
681 return PRIuFAST16;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
682 if (name[3] == 'x')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
683 return PRIxFAST16;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
684 if (name[3] == 'X')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
685 return PRIXFAST16;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
686 abort ();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
687 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
688 if (name[8] == '3' && name[9] == '2' && name[10] == '\0')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
689 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
690 if (name[3] == 'd')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
691 return PRIdFAST32;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
692 if (name[3] == 'i')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
693 return PRIiFAST32;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
694 if (name[3] == 'o')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
695 return PRIoFAST32;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
696 if (name[3] == 'u')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
697 return PRIuFAST32;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
698 if (name[3] == 'x')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
699 return PRIxFAST32;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
700 if (name[3] == 'X')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
701 return PRIXFAST32;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
702 abort ();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
703 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
704 if (name[8] == '6' && name[9] == '4' && name[10] == '\0')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
705 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
706 if (name[3] == 'd')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
707 return PRIdFAST64;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
708 if (name[3] == 'i')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
709 return PRIiFAST64;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
710 if (name[3] == 'o')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
711 return PRIoFAST64;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
712 if (name[3] == 'u')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
713 return PRIuFAST64;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
714 if (name[3] == 'x')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
715 return PRIxFAST64;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
716 if (name[3] == 'X')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
717 return PRIXFAST64;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
718 abort ();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
719 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
720 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
721 if (name[4] == 'M' && name[5] == 'A' && name[6] == 'X'
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
722 && name[7] == '\0')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
723 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
724 if (name[3] == 'd')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
725 return PRIdMAX;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
726 if (name[3] == 'i')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
727 return PRIiMAX;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
728 if (name[3] == 'o')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
729 return PRIoMAX;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
730 if (name[3] == 'u')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
731 return PRIuMAX;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
732 if (name[3] == 'x')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
733 return PRIxMAX;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
734 if (name[3] == 'X')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
735 return PRIXMAX;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
736 abort ();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
737 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
738 if (name[4] == 'P' && name[5] == 'T' && name[6] == 'R'
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
739 && name[7] == '\0')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
740 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
741 if (name[3] == 'd')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
742 return PRIdPTR;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
743 if (name[3] == 'i')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
744 return PRIiPTR;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
745 if (name[3] == 'o')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
746 return PRIoPTR;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
747 if (name[3] == 'u')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
748 return PRIuPTR;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
749 if (name[3] == 'x')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
750 return PRIxPTR;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
751 if (name[3] == 'X')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
752 return PRIXPTR;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
753 abort ();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
754 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
755 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
756 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
757 /* Other system dependent strings are not valid. */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
758 return NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
759 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
760
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
761 /* Initialize the codeset dependent parts of an opened message catalog.
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
762 Return the header entry. */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
763 const char *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
764 internal_function
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
765 _nl_init_domain_conv (domain_file, domain, domainbinding)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
766 struct loaded_l10nfile *domain_file;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
767 struct loaded_domain *domain;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
768 struct binding *domainbinding;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
769 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
770 /* Find out about the character set the file is encoded with.
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
771 This can be found (in textual form) in the entry "". If this
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
772 entry does not exist or if this does not contain the `charset='
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
773 information, we will assume the charset matches the one the
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
774 current locale and we don't have to perform any conversion. */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
775 char *nullentry;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
776 size_t nullentrylen;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
777
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
778 /* Preinitialize fields, to avoid recursion during _nl_find_msg. */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
779 domain->codeset_cntr =
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
780 (domainbinding != NULL ? domainbinding->codeset_cntr : 0);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
781 #ifdef _LIBC
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
782 domain->conv = (__gconv_t) -1;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
783 #else
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
784 # if HAVE_ICONV
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
785 domain->conv = (iconv_t) -1;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
786 # endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
787 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
788 domain->conv_tab = NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
789
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
790 /* Get the header entry. */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
791 nullentry = _nl_find_msg (domain_file, domainbinding, "", &nullentrylen);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
792
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
793 if (nullentry != NULL)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
794 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
795 #if defined _LIBC || HAVE_ICONV
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
796 const char *charsetstr;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
797
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
798 charsetstr = strstr (nullentry, "charset=");
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
799 if (charsetstr != NULL)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
800 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
801 size_t len;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
802 char *charset;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
803 const char *outcharset;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
804
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
805 charsetstr += strlen ("charset=");
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
806 len = strcspn (charsetstr, " \t\n");
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
807
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
808 charset = (char *) alloca (len + 1);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
809 # if defined _LIBC || HAVE_MEMPCPY
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
810 *((char *) mempcpy (charset, charsetstr, len)) = '\0';
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
811 # else
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
812 memcpy (charset, charsetstr, len);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
813 charset[len] = '\0';
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
814 # endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
815
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
816 /* The output charset should normally be determined by the
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
817 locale. But sometimes the locale is not used or not correctly
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
818 set up, so we provide a possibility for the user to override
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
819 this. Moreover, the value specified through
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
820 bind_textdomain_codeset overrides both. */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
821 if (domainbinding != NULL && domainbinding->codeset != NULL)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
822 outcharset = domainbinding->codeset;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
823 else
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
824 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
825 outcharset = getenv ("OUTPUT_CHARSET");
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
826 if (outcharset == NULL || outcharset[0] == '\0')
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
827 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
828 # ifdef _LIBC
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
829 outcharset = _NL_CURRENT (LC_CTYPE, CODESET);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
830 # else
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
831 # if HAVE_ICONV
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
832 extern const char *locale_charset PARAMS ((void));
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
833 outcharset = locale_charset ();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
834 # endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
835 # endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
836 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
837 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
838
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
839 # ifdef _LIBC
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
840 /* We always want to use transliteration. */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
841 outcharset = norm_add_slashes (outcharset, "TRANSLIT");
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
842 charset = norm_add_slashes (charset, NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
843 if (__gconv_open (outcharset, charset, &domain->conv,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
844 GCONV_AVOID_NOCONV)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
845 != __GCONV_OK)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
846 domain->conv = (__gconv_t) -1;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
847 # else
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
848 # if HAVE_ICONV
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
849 /* When using GNU libc >= 2.2 or GNU libiconv >= 1.5,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
850 we want to use transliteration. */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
851 # if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) || __GLIBC__ > 2 \
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
852 || _LIBICONV_VERSION >= 0x0105
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
853 if (strchr (outcharset, '/') == NULL)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
854 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
855 char *tmp;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
856
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
857 len = strlen (outcharset);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
858 tmp = (char *) alloca (len + 10 + 1);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
859 memcpy (tmp, outcharset, len);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
860 memcpy (tmp + len, "//TRANSLIT", 10 + 1);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
861 outcharset = tmp;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
862
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
863 domain->conv = iconv_open (outcharset, charset);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
864
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
865 freea (outcharset);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
866 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
867 else
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
868 # endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
869 domain->conv = iconv_open (outcharset, charset);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
870 # endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
871 # endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
872
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
873 freea (charset);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
874 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
875 #endif /* _LIBC || HAVE_ICONV */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
876 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
877
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
878 return nullentry;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
879 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
880
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
881 /* Frees the codeset dependent parts of an opened message catalog. */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
882 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
883 internal_function
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
884 _nl_free_domain_conv (domain)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
885 struct loaded_domain *domain;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
886 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
887 if (domain->conv_tab != NULL && domain->conv_tab != (char **) -1)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
888 free (domain->conv_tab);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
889
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
890 #ifdef _LIBC
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
891 if (domain->conv != (__gconv_t) -1)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
892 __gconv_close (domain->conv);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
893 #else
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
894 # if HAVE_ICONV
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
895 if (domain->conv != (iconv_t) -1)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
896 iconv_close (domain->conv);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
897 # endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
898 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
899 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
900
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
901 /* Load the message catalogs specified by FILENAME. If it is no valid
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
902 message catalog do nothing. */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
903 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
904 internal_function
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
905 _nl_load_domain (domain_file, domainbinding)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
906 struct loaded_l10nfile *domain_file;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
907 struct binding *domainbinding;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
908 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
909 int fd;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
910 size_t size;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
911 #ifdef _LIBC
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
912 struct stat64 st;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
913 #else
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
914 struct stat st;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
915 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
916 struct mo_file_header *data = (struct mo_file_header *) -1;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
917 int use_mmap = 0;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
918 struct loaded_domain *domain;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
919 int revision;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
920 const char *nullentry;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
921
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
922 domain_file->decided = 1;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
923 domain_file->data = NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
924
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
925 /* Note that it would be useless to store domainbinding in domain_file
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
926 because domainbinding might be == NULL now but != NULL later (after
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
927 a call to bind_textdomain_codeset). */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
928
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
929 /* If the record does not represent a valid locale the FILENAME
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
930 might be NULL. This can happen when according to the given
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
931 specification the locale file name is different for XPG and CEN
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
932 syntax. */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
933 if (domain_file->filename == NULL)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
934 return;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
935
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
936 /* Try to open the addressed file. */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
937 fd = open (domain_file->filename, O_RDONLY | O_BINARY);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
938 if (fd == -1)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
939 return;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
940
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
941 /* We must know about the size of the file. */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
942 if (
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
943 #ifdef _LIBC
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
944 __builtin_expect (fstat64 (fd, &st) != 0, 0)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
945 #else
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
946 __builtin_expect (fstat (fd, &st) != 0, 0)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
947 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
948 || __builtin_expect ((size = (size_t) st.st_size) != st.st_size, 0)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
949 || __builtin_expect (size < sizeof (struct mo_file_header), 0))
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
950 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
951 /* Something went wrong. */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
952 close (fd);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
953 return;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
954 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
955
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
956 #ifdef HAVE_MMAP
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
957 /* Now we are ready to load the file. If mmap() is available we try
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
958 this first. If not available or it failed we try to load it. */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
959 data = (struct mo_file_header *) mmap (NULL, size, PROT_READ,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
960 MAP_PRIVATE, fd, 0);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
961
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
962 if (__builtin_expect (data != (struct mo_file_header *) -1, 1))
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
963 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
964 /* mmap() call was successful. */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
965 close (fd);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
966 use_mmap = 1;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
967 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
968 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
969
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
970 /* If the data is not yet available (i.e. mmap'ed) we try to load
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
971 it manually. */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
972 if (data == (struct mo_file_header *) -1)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
973 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
974 size_t to_read;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
975 char *read_ptr;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
976
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
977 data = (struct mo_file_header *) malloc (size);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
978 if (data == NULL)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
979 return;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
980
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
981 to_read = size;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
982 read_ptr = (char *) data;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
983 do
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
984 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
985 long int nb = (long int) read (fd, read_ptr, to_read);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
986 if (nb <= 0)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
987 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
988 #ifdef EINTR
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
989 if (nb == -1 && errno == EINTR)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
990 continue;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
991 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
992 close (fd);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
993 return;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
994 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
995 read_ptr += nb;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
996 to_read -= nb;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
997 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
998 while (to_read > 0);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
999
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1000 close (fd);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1001 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1002
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1003 /* Using the magic number we can test whether it really is a message
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1004 catalog file. */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1005 if (__builtin_expect (data->magic != _MAGIC && data->magic != _MAGIC_SWAPPED,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1006 0))
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1007 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1008 /* The magic number is wrong: not a message catalog file. */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1009 #ifdef HAVE_MMAP
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1010 if (use_mmap)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1011 munmap ((caddr_t) data, size);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1012 else
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1013 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1014 free (data);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1015 return;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1016 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1017
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1018 domain = (struct loaded_domain *) malloc (sizeof (struct loaded_domain));
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1019 if (domain == NULL)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1020 return;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1021 domain_file->data = domain;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1022
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1023 domain->data = (char *) data;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1024 domain->use_mmap = use_mmap;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1025 domain->mmap_size = size;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1026 domain->must_swap = data->magic != _MAGIC;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1027 domain->malloced = NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1028
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1029 /* Fill in the information about the available tables. */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1030 revision = W (domain->must_swap, data->revision);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1031 /* We support only the major revision 0. */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1032 switch (revision >> 16)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1033 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1034 case 0:
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1035 domain->nstrings = W (domain->must_swap, data->nstrings);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1036 domain->orig_tab = (const struct string_desc *)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1037 ((char *) data + W (domain->must_swap, data->orig_tab_offset));
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1038 domain->trans_tab = (const struct string_desc *)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1039 ((char *) data + W (domain->must_swap, data->trans_tab_offset));
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1040 domain->hash_size = W (domain->must_swap, data->hash_tab_size);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1041 domain->hash_tab =
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1042 (domain->hash_size > 2
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1043 ? (const nls_uint32 *)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1044 ((char *) data + W (domain->must_swap, data->hash_tab_offset))
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1045 : NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1046 domain->must_swap_hash_tab = domain->must_swap;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1047
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1048 /* Now dispatch on the minor revision. */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1049 switch (revision & 0xffff)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1050 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1051 case 0:
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1052 domain->n_sysdep_strings = 0;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1053 domain->orig_sysdep_tab = NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1054 domain->trans_sysdep_tab = NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1055 break;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1056 case 1:
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1057 default:
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1058 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1059 nls_uint32 n_sysdep_strings;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1060
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1061 if (domain->hash_tab == NULL)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1062 /* This is invalid. These minor revisions need a hash table. */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1063 goto invalid;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1064
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1065 n_sysdep_strings =
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1066 W (domain->must_swap, data->n_sysdep_strings);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1067 if (n_sysdep_strings > 0)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1068 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1069 nls_uint32 n_sysdep_segments;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1070 const struct sysdep_segment *sysdep_segments;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1071 const char **sysdep_segment_values;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1072 const nls_uint32 *orig_sysdep_tab;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1073 const nls_uint32 *trans_sysdep_tab;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1074 size_t memneed;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1075 char *mem;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1076 struct sysdep_string_desc *inmem_orig_sysdep_tab;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1077 struct sysdep_string_desc *inmem_trans_sysdep_tab;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1078 nls_uint32 *inmem_hash_tab;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1079 unsigned int i;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1080
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1081 /* Get the values of the system dependent segments. */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1082 n_sysdep_segments =
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1083 W (domain->must_swap, data->n_sysdep_segments);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1084 sysdep_segments = (const struct sysdep_segment *)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1085 ((char *) data
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1086 + W (domain->must_swap, data->sysdep_segments_offset));
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1087 sysdep_segment_values =
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1088 alloca (n_sysdep_segments * sizeof (const char *));
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1089 for (i = 0; i < n_sysdep_segments; i++)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1090 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1091 const char *name =
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1092 (char *) data
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1093 + W (domain->must_swap, sysdep_segments[i].offset);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1094 nls_uint32 namelen =
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1095 W (domain->must_swap, sysdep_segments[i].length);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1096
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1097 if (!(namelen > 0 && name[namelen - 1] == '\0'))
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1098 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1099 freea (sysdep_segment_values);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1100 goto invalid;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1101 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1102
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1103 sysdep_segment_values[i] = get_sysdep_segment_value (name);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1104 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1105
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1106 orig_sysdep_tab = (const nls_uint32 *)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1107 ((char *) data
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1108 + W (domain->must_swap, data->orig_sysdep_tab_offset));
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1109 trans_sysdep_tab = (const nls_uint32 *)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1110 ((char *) data
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1111 + W (domain->must_swap, data->trans_sysdep_tab_offset));
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1112
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1113 /* Compute the amount of additional memory needed for the
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1114 system dependent strings and the augmented hash table. */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1115 memneed = 2 * n_sysdep_strings
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1116 * sizeof (struct sysdep_string_desc)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1117 + domain->hash_size * sizeof (nls_uint32);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1118 for (i = 0; i < 2 * n_sysdep_strings; i++)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1119 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1120 const struct sysdep_string *sysdep_string =
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1121 (const struct sysdep_string *)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1122 ((char *) data
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1123 + W (domain->must_swap,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1124 i < n_sysdep_strings
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1125 ? orig_sysdep_tab[i]
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1126 : trans_sysdep_tab[i - n_sysdep_strings]));
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1127 size_t need = 0;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1128 const struct segment_pair *p = sysdep_string->segments;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1129
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1130 if (W (domain->must_swap, p->sysdepref) != SEGMENTS_END)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1131 for (p = sysdep_string->segments;; p++)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1132 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1133 nls_uint32 sysdepref;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1134
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1135 need += W (domain->must_swap, p->segsize);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1136
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1137 sysdepref = W (domain->must_swap, p->sysdepref);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1138 if (sysdepref == SEGMENTS_END)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1139 break;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1140
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1141 if (sysdepref >= n_sysdep_segments)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1142 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1143 /* Invalid. */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1144 freea (sysdep_segment_values);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1145 goto invalid;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1146 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1147
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1148 need += strlen (sysdep_segment_values[sysdepref]);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1149 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1150
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1151 memneed += need;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1152 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1153
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1154 /* Allocate additional memory. */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1155 mem = (char *) malloc (memneed);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1156 if (mem == NULL)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1157 goto invalid;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1158
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1159 domain->malloced = mem;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1160 inmem_orig_sysdep_tab = (struct sysdep_string_desc *) mem;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1161 mem += n_sysdep_strings * sizeof (struct sysdep_string_desc);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1162 inmem_trans_sysdep_tab = (struct sysdep_string_desc *) mem;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1163 mem += n_sysdep_strings * sizeof (struct sysdep_string_desc);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1164 inmem_hash_tab = (nls_uint32 *) mem;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1165 mem += domain->hash_size * sizeof (nls_uint32);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1166
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1167 /* Compute the system dependent strings. */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1168 for (i = 0; i < 2 * n_sysdep_strings; i++)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1169 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1170 const struct sysdep_string *sysdep_string =
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1171 (const struct sysdep_string *)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1172 ((char *) data
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1173 + W (domain->must_swap,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1174 i < n_sysdep_strings
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1175 ? orig_sysdep_tab[i]
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1176 : trans_sysdep_tab[i - n_sysdep_strings]));
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1177 const char *static_segments =
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1178 (char *) data
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1179 + W (domain->must_swap, sysdep_string->offset);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1180 const struct segment_pair *p = sysdep_string->segments;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1181
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1182 /* Concatenate the segments, and fill
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1183 inmem_orig_sysdep_tab[i] (for i < n_sysdep_strings) and
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1184 inmem_trans_sysdep_tab[i-n_sysdep_strings] (for
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1185 i >= n_sysdep_strings). */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1186
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1187 if (W (domain->must_swap, p->sysdepref) == SEGMENTS_END)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1188 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1189 /* Only one static segment. */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1190 inmem_orig_sysdep_tab[i].length =
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1191 W (domain->must_swap, p->segsize);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1192 inmem_orig_sysdep_tab[i].pointer = static_segments;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1193 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1194 else
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1195 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1196 inmem_orig_sysdep_tab[i].pointer = mem;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1197
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1198 for (p = sysdep_string->segments;; p++)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1199 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1200 nls_uint32 segsize =
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1201 W (domain->must_swap, p->segsize);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1202 nls_uint32 sysdepref =
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1203 W (domain->must_swap, p->sysdepref);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1204 size_t n;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1205
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1206 if (segsize > 0)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1207 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1208 memcpy (mem, static_segments, segsize);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1209 mem += segsize;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1210 static_segments += segsize;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1211 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1212
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1213 if (sysdepref == SEGMENTS_END)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1214 break;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1215
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1216 n = strlen (sysdep_segment_values[sysdepref]);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1217 memcpy (mem, sysdep_segment_values[sysdepref], n);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1218 mem += n;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1219 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1220
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1221 inmem_orig_sysdep_tab[i].length =
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1222 mem - inmem_orig_sysdep_tab[i].pointer;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1223 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1224 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1225
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1226 /* Compute the augmented hash table. */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1227 for (i = 0; i < domain->hash_size; i++)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1228 inmem_hash_tab[i] =
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1229 W (domain->must_swap_hash_tab, domain->hash_tab[i]);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1230 for (i = 0; i < n_sysdep_strings; i++)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1231 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1232 const char *msgid = inmem_orig_sysdep_tab[i].pointer;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1233 nls_uint32 hash_val = hash_string (msgid);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1234 nls_uint32 idx = hash_val % domain->hash_size;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1235 nls_uint32 incr = 1 + (hash_val % (domain->hash_size - 2));
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1236
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1237 for (;;)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1238 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1239 if (inmem_hash_tab[idx] == 0)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1240 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1241 /* Hash table entry is empty. Use it. */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1242 inmem_hash_tab[idx] = 1 + domain->nstrings + i;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1243 break;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1244 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1245
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1246 if (idx >= domain->hash_size - incr)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1247 idx -= domain->hash_size - incr;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1248 else
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1249 idx += incr;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1250 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1251 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1252
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1253 freea (sysdep_segment_values);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1254
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1255 domain->n_sysdep_strings = n_sysdep_strings;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1256 domain->orig_sysdep_tab = inmem_orig_sysdep_tab;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1257 domain->trans_sysdep_tab = inmem_trans_sysdep_tab;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1258
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1259 domain->hash_tab = inmem_hash_tab;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1260 domain->must_swap_hash_tab = 0;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1261 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1262 else
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1263 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1264 domain->n_sysdep_strings = 0;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1265 domain->orig_sysdep_tab = NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1266 domain->trans_sysdep_tab = NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1267 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1268 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1269 break;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1270 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1271 break;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1272 default:
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1273 /* This is an invalid revision. */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1274 invalid:
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1275 /* This is an invalid .mo file. */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1276 if (domain->malloced)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1277 free (domain->malloced);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1278 #ifdef HAVE_MMAP
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1279 if (use_mmap)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1280 munmap ((caddr_t) data, size);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1281 else
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1282 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1283 free (data);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1284 free (domain);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1285 domain_file->data = NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1286 return;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1287 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1288
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1289 /* Now initialize the character set converter from the character set
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1290 the file is encoded with (found in the header entry) to the domain's
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1291 specified character set or the locale's character set. */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1292 nullentry = _nl_init_domain_conv (domain_file, domain, domainbinding);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1293
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1294 /* Also look for a plural specification. */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1295 EXTRACT_PLURAL_EXPRESSION (nullentry, &domain->plural, &domain->nplurals);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1296 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1297
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1298
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1299 #ifdef _LIBC
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1300 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1301 internal_function
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1302 _nl_unload_domain (domain)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1303 struct loaded_domain *domain;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1304 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1305 if (domain->plural != &__gettext_germanic_plural)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1306 __gettext_free_exp (domain->plural);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1307
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1308 _nl_free_domain_conv (domain);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1309
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1310 if (domain->malloced)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1311 free (domain->malloced);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1312
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1313 # ifdef _POSIX_MAPPED_FILES
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1314 if (domain->use_mmap)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1315 munmap ((caddr_t) domain->data, domain->mmap_size);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1316 else
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1317 # endif /* _POSIX_MAPPED_FILES */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1318 free ((void *) domain->data);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1319
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1320 free (domain);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1321 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1322 #endif