1 /* Description of GNU message catalog format: general file layout.
2 Copyright (C) 1995-2015 Free Software Foundation, Inc.
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as published by
6 the Free Software Foundation; either version 2.1 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>. */
22 /* @@ end of prolog @@ */
24 /* The magic number of the GNU message catalog format. */
25 #define _MAGIC 0x950412de
26 #define _MAGIC_SWAPPED 0xde120495
28 /* Revision number of the currently used .mo (binary) file format. */
29 #define MO_REVISION_NUMBER 0
30 #define MO_REVISION_NUMBER_WITH_SYSDEP_I 1
32 /* The following contortions are an attempt to use the C preprocessor
33 to determine an unsigned integral type that is 32 bits wide. An
34 alternative approach is to use autoconf's AC_CHECK_SIZEOF macro, but
35 as of version autoconf-2.13, the AC_CHECK_SIZEOF macro doesn't work
36 when cross-compiling. */
39 # define UINT_MAX_32_BITS 4294967295U
41 # define UINT_MAX_32_BITS 0xFFFFFFFF
44 /* If UINT_MAX isn't defined, assume it's a 32-bit type.
45 This should be valid for all systems GNU cares about because
46 that doesn't include 16-bit systems, and only modern systems
47 (that certainly have <limits.h>) have 64+-bit integral types. */
50 # define UINT_MAX UINT_MAX_32_BITS
53 #if UINT_MAX == UINT_MAX_32_BITS
54 typedef unsigned nls_uint32
;
56 # if USHRT_MAX == UINT_MAX_32_BITS
57 typedef unsigned short nls_uint32
;
59 # if ULONG_MAX == UINT_MAX_32_BITS
60 typedef unsigned long nls_uint32
;
62 /* The following line is intended to throw an error. Using #error is
63 not portable enough. */
64 "Cannot determine unsigned 32-bit data type."
70 /* Header for binary .mo file format. */
73 /* The magic number. */
75 /* The revision number of the file format. */
78 /* The following are only used in .mo files with major revision 0 or 1. */
80 /* The number of strings pairs. */
82 /* Offset of table with start offsets of original strings. */
83 nls_uint32 orig_tab_offset
;
84 /* Offset of table with start offsets of translated strings. */
85 nls_uint32 trans_tab_offset
;
86 /* Size of hash table. */
87 nls_uint32 hash_tab_size
;
88 /* Offset of first hash table entry. */
89 nls_uint32 hash_tab_offset
;
91 /* The following are only used in .mo files with minor revision >= 1. */
93 /* The number of system dependent segments. */
94 nls_uint32 n_sysdep_segments
;
95 /* Offset of table describing system dependent segments. */
96 nls_uint32 sysdep_segments_offset
;
97 /* The number of system dependent strings pairs. */
98 nls_uint32 n_sysdep_strings
;
99 /* Offset of table with start offsets of original sysdep strings. */
100 nls_uint32 orig_sysdep_tab_offset
;
101 /* Offset of table with start offsets of translated sysdep strings. */
102 nls_uint32 trans_sysdep_tab_offset
;
105 /* Descriptor for static string contained in the binary .mo file. */
108 /* Length of addressed string, not including the trailing NUL. */
110 /* Offset of string in file. */
114 /* The following are only used in .mo files with minor revision >= 1. */
116 /* Descriptor for system dependent string segment. */
117 struct sysdep_segment
119 /* Length of addressed string, including the trailing NUL. */
121 /* Offset of string in file. */
125 /* Pair of a static and a system dependent segment, in struct sysdep_string. */
128 /* Size of static segment. */
130 /* Reference to system dependent string segment, or ~0 at the end. */
131 nls_uint32 sysdepref
;
134 /* Descriptor for system dependent string. */
137 /* Offset of static string segments in file. */
139 /* Alternating sequence of static and system dependent segments.
140 The last segment is a static segment, including the trailing NUL. */
141 struct segment_pair segments
[1];
144 /* Marker for the end of the segments[] array. This has the value 0xFFFFFFFF,
145 regardless whether 'int' is 16 bit, 32 bit, or 64 bit. */
146 #define SEGMENTS_END ((nls_uint32) ~0)
148 /* @@ begin of epilog @@ */
150 #endif /* gettext.h */