xref: /openbsd-src/gnu/usr.bin/binutils-2.17/intl/gettext.h (revision 3d8817e467ea46cf4772788d6804dd293abfb01a)
1*3d8817e4Smiod /* Internal header for GNU gettext internationalization functions.
2*3d8817e4Smiod    Copyright (C) 1995, 1997 Free Software Foundation, Inc.
3*3d8817e4Smiod 
4*3d8817e4Smiod    This program is free software; you can redistribute it and/or modify
5*3d8817e4Smiod    it under the terms of the GNU General Public License as published by
6*3d8817e4Smiod    the Free Software Foundation; either version 2, or (at your option)
7*3d8817e4Smiod    any later version.
8*3d8817e4Smiod 
9*3d8817e4Smiod    This program is distributed in the hope that it will be useful,
10*3d8817e4Smiod    but WITHOUT ANY WARRANTY; without even the implied warranty of
11*3d8817e4Smiod    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12*3d8817e4Smiod    GNU General Public License for more details.
13*3d8817e4Smiod 
14*3d8817e4Smiod    You should have received a copy of the GNU Library General Public
15*3d8817e4Smiod    License along with the GNU C Library; see the file COPYING.LIB.  If not,
16*3d8817e4Smiod    write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
17*3d8817e4Smiod    Boston, MA 02110-1301, USA.  */
18*3d8817e4Smiod 
19*3d8817e4Smiod #ifndef _GETTEXT_H
20*3d8817e4Smiod #define _GETTEXT_H 1
21*3d8817e4Smiod 
22*3d8817e4Smiod #include <stdio.h>
23*3d8817e4Smiod 
24*3d8817e4Smiod #if HAVE_LIMITS_H || _LIBC
25*3d8817e4Smiod # include <limits.h>
26*3d8817e4Smiod #endif
27*3d8817e4Smiod 
28*3d8817e4Smiod /* @@ end of prolog @@ */
29*3d8817e4Smiod 
30*3d8817e4Smiod /* The magic number of the GNU message catalog format.  */
31*3d8817e4Smiod #define _MAGIC 0x950412de
32*3d8817e4Smiod #define _MAGIC_SWAPPED 0xde120495
33*3d8817e4Smiod 
34*3d8817e4Smiod /* Revision number of the currently used .mo (binary) file format.  */
35*3d8817e4Smiod #define MO_REVISION_NUMBER 0
36*3d8817e4Smiod 
37*3d8817e4Smiod /* The following contortions are an attempt to use the C preprocessor
38*3d8817e4Smiod    to determine an unsigned integral type that is 32 bits wide.  An
39*3d8817e4Smiod    alternative approach is to use autoconf's AC_CHECK_SIZEOF macro, but
40*3d8817e4Smiod    doing that would require that the configure script compile and *run*
41*3d8817e4Smiod    the resulting executable.  Locally running cross-compiled executables
42*3d8817e4Smiod    is usually not possible.  */
43*3d8817e4Smiod 
44*3d8817e4Smiod #if __STDC__
45*3d8817e4Smiod # define UINT_MAX_32_BITS 4294967295U
46*3d8817e4Smiod #else
47*3d8817e4Smiod # define UINT_MAX_32_BITS 0xFFFFFFFF
48*3d8817e4Smiod #endif
49*3d8817e4Smiod 
50*3d8817e4Smiod /* If UINT_MAX isn't defined, assume it's a 32-bit type.
51*3d8817e4Smiod    This should be valid for all systems GNU cares about because
52*3d8817e4Smiod    that doesn't include 16-bit systems, and only modern systems
53*3d8817e4Smiod    (that certainly have <limits.h>) have 64+-bit integral types.  */
54*3d8817e4Smiod 
55*3d8817e4Smiod #ifndef UINT_MAX
56*3d8817e4Smiod # define UINT_MAX UINT_MAX_32_BITS
57*3d8817e4Smiod #endif
58*3d8817e4Smiod 
59*3d8817e4Smiod #if UINT_MAX == UINT_MAX_32_BITS
60*3d8817e4Smiod typedef unsigned nls_uint32;
61*3d8817e4Smiod #else
62*3d8817e4Smiod # if USHRT_MAX == UINT_MAX_32_BITS
63*3d8817e4Smiod typedef unsigned short nls_uint32;
64*3d8817e4Smiod # else
65*3d8817e4Smiod #  if ULONG_MAX == UINT_MAX_32_BITS
66*3d8817e4Smiod typedef unsigned long nls_uint32;
67*3d8817e4Smiod #  else
68*3d8817e4Smiod   /* The following line is intended to throw an error.  Using #error is
69*3d8817e4Smiod      not portable enough.  */
70*3d8817e4Smiod   "Cannot determine unsigned 32-bit data type."
71*3d8817e4Smiod #  endif
72*3d8817e4Smiod # endif
73*3d8817e4Smiod #endif
74*3d8817e4Smiod 
75*3d8817e4Smiod 
76*3d8817e4Smiod /* Header for binary .mo file format.  */
77*3d8817e4Smiod struct mo_file_header
78*3d8817e4Smiod {
79*3d8817e4Smiod   /* The magic number.  */
80*3d8817e4Smiod   nls_uint32 magic;
81*3d8817e4Smiod   /* The revision number of the file format.  */
82*3d8817e4Smiod   nls_uint32 revision;
83*3d8817e4Smiod   /* The number of strings pairs.  */
84*3d8817e4Smiod   nls_uint32 nstrings;
85*3d8817e4Smiod   /* Offset of table with start offsets of original strings.  */
86*3d8817e4Smiod   nls_uint32 orig_tab_offset;
87*3d8817e4Smiod   /* Offset of table with start offsets of translation strings.  */
88*3d8817e4Smiod   nls_uint32 trans_tab_offset;
89*3d8817e4Smiod   /* Size of hashing table.  */
90*3d8817e4Smiod   nls_uint32 hash_tab_size;
91*3d8817e4Smiod   /* Offset of first hashing entry.  */
92*3d8817e4Smiod   nls_uint32 hash_tab_offset;
93*3d8817e4Smiod };
94*3d8817e4Smiod 
95*3d8817e4Smiod struct string_desc
96*3d8817e4Smiod {
97*3d8817e4Smiod   /* Length of addressed string.  */
98*3d8817e4Smiod   nls_uint32 length;
99*3d8817e4Smiod   /* Offset of string in file.  */
100*3d8817e4Smiod   nls_uint32 offset;
101*3d8817e4Smiod };
102*3d8817e4Smiod 
103*3d8817e4Smiod /* @@ begin of epilog @@ */
104*3d8817e4Smiod 
105*3d8817e4Smiod #endif	/* gettext.h  */
106