Blame intl/gmo.h

Packit 6c4009
/* Description of GNU message catalog format: general file layout.
Packit 6c4009
   Copyright (C) 1995-2018 Free Software Foundation, Inc.
Packit 6c4009
Packit 6c4009
   This program is free software: you can redistribute it and/or modify
Packit 6c4009
   it under the terms of the GNU Lesser General Public License as published by
Packit 6c4009
   the Free Software Foundation; either version 2.1 of the License, or
Packit 6c4009
   (at your option) any later version.
Packit 6c4009
Packit 6c4009
   This program is distributed in the hope that it will be useful,
Packit 6c4009
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 6c4009
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit 6c4009
   GNU Lesser General Public License for more details.
Packit 6c4009
Packit 6c4009
   You should have received a copy of the GNU Lesser General Public License
Packit 6c4009
   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
Packit 6c4009
Packit 6c4009
#ifndef _GETTEXT_H
Packit 6c4009
#define _GETTEXT_H 1
Packit 6c4009
Packit 6c4009
#include <limits.h>
Packit 6c4009
Packit 6c4009
/* @@ end of prolog @@ */
Packit 6c4009
Packit 6c4009
/* The magic number of the GNU message catalog format.  */
Packit 6c4009
#define _MAGIC 0x950412de
Packit 6c4009
#define _MAGIC_SWAPPED 0xde120495
Packit 6c4009
Packit 6c4009
/* Revision number of the currently used .mo (binary) file format.  */
Packit 6c4009
#define MO_REVISION_NUMBER 0
Packit 6c4009
#define MO_REVISION_NUMBER_WITH_SYSDEP_I 1
Packit 6c4009
Packit 6c4009
/* The following contortions are an attempt to use the C preprocessor
Packit 6c4009
   to determine an unsigned integral type that is 32 bits wide.  An
Packit 6c4009
   alternative approach is to use autoconf's AC_CHECK_SIZEOF macro, but
Packit 6c4009
   as of version autoconf-2.13, the AC_CHECK_SIZEOF macro doesn't work
Packit 6c4009
   when cross-compiling.  */
Packit 6c4009
Packit 6c4009
#if __STDC__
Packit 6c4009
# define UINT_MAX_32_BITS 4294967295U
Packit 6c4009
#else
Packit 6c4009
# define UINT_MAX_32_BITS 0xFFFFFFFF
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
/* If UINT_MAX isn't defined, assume it's a 32-bit type.
Packit 6c4009
   This should be valid for all systems GNU cares about because
Packit 6c4009
   that doesn't include 16-bit systems, and only modern systems
Packit 6c4009
   (that certainly have <limits.h>) have 64+-bit integral types.  */
Packit 6c4009
Packit 6c4009
#ifndef UINT_MAX
Packit 6c4009
# define UINT_MAX UINT_MAX_32_BITS
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
#if UINT_MAX == UINT_MAX_32_BITS
Packit 6c4009
typedef unsigned nls_uint32;
Packit 6c4009
#else
Packit 6c4009
# if USHRT_MAX == UINT_MAX_32_BITS
Packit 6c4009
typedef unsigned short nls_uint32;
Packit 6c4009
# else
Packit 6c4009
#  if ULONG_MAX == UINT_MAX_32_BITS
Packit 6c4009
typedef unsigned long nls_uint32;
Packit 6c4009
#  else
Packit 6c4009
  /* The following line is intended to throw an error.  Using #error is
Packit 6c4009
     not portable enough.  */
Packit 6c4009
  "Cannot determine unsigned 32-bit data type."
Packit 6c4009
#  endif
Packit 6c4009
# endif
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
Packit 6c4009
/* Header for binary .mo file format.  */
Packit 6c4009
struct mo_file_header
Packit 6c4009
{
Packit 6c4009
  /* The magic number.  */
Packit 6c4009
  nls_uint32 magic;
Packit 6c4009
  /* The revision number of the file format.  */
Packit 6c4009
  nls_uint32 revision;
Packit 6c4009
Packit 6c4009
  /* The following are only used in .mo files with major revision 0 or 1.  */
Packit 6c4009
Packit 6c4009
  /* The number of strings pairs.  */
Packit 6c4009
  nls_uint32 nstrings;
Packit 6c4009
  /* Offset of table with start offsets of original strings.  */
Packit 6c4009
  nls_uint32 orig_tab_offset;
Packit 6c4009
  /* Offset of table with start offsets of translated strings.  */
Packit 6c4009
  nls_uint32 trans_tab_offset;
Packit 6c4009
  /* Size of hash table.  */
Packit 6c4009
  nls_uint32 hash_tab_size;
Packit 6c4009
  /* Offset of first hash table entry.  */
Packit 6c4009
  nls_uint32 hash_tab_offset;
Packit 6c4009
Packit 6c4009
  /* The following are only used in .mo files with minor revision >= 1.  */
Packit 6c4009
Packit 6c4009
  /* The number of system dependent segments.  */
Packit 6c4009
  nls_uint32 n_sysdep_segments;
Packit 6c4009
  /* Offset of table describing system dependent segments.  */
Packit 6c4009
  nls_uint32 sysdep_segments_offset;
Packit 6c4009
  /* The number of system dependent strings pairs.  */
Packit 6c4009
  nls_uint32 n_sysdep_strings;
Packit 6c4009
  /* Offset of table with start offsets of original sysdep strings.  */
Packit 6c4009
  nls_uint32 orig_sysdep_tab_offset;
Packit 6c4009
  /* Offset of table with start offsets of translated sysdep strings.  */
Packit 6c4009
  nls_uint32 trans_sysdep_tab_offset;
Packit 6c4009
};
Packit 6c4009
Packit 6c4009
/* Descriptor for static string contained in the binary .mo file.  */
Packit 6c4009
struct string_desc
Packit 6c4009
{
Packit 6c4009
  /* Length of addressed string, not including the trailing NUL.  */
Packit 6c4009
  nls_uint32 length;
Packit 6c4009
  /* Offset of string in file.  */
Packit 6c4009
  nls_uint32 offset;
Packit 6c4009
};
Packit 6c4009
Packit 6c4009
/* The following are only used in .mo files with minor revision >= 1.  */
Packit 6c4009
Packit 6c4009
/* Descriptor for system dependent string segment.  */
Packit 6c4009
struct sysdep_segment
Packit 6c4009
{
Packit 6c4009
  /* Length of addressed string, including the trailing NUL.  */
Packit 6c4009
  nls_uint32 length;
Packit 6c4009
  /* Offset of string in file.  */
Packit 6c4009
  nls_uint32 offset;
Packit 6c4009
};
Packit 6c4009
Packit 6c4009
/* Pair of a static and a system dependent segment, in struct sysdep_string.  */
Packit 6c4009
struct segment_pair
Packit 6c4009
{
Packit 6c4009
  /* Size of static segment.  */
Packit 6c4009
  nls_uint32 segsize;
Packit 6c4009
  /* Reference to system dependent string segment, or ~0 at the end.  */
Packit 6c4009
  nls_uint32 sysdepref;
Packit 6c4009
};
Packit 6c4009
Packit 6c4009
/* Descriptor for system dependent string.  */
Packit 6c4009
struct sysdep_string
Packit 6c4009
{
Packit 6c4009
  /* Offset of static string segments in file.  */
Packit 6c4009
  nls_uint32 offset;
Packit 6c4009
  /* Alternating sequence of static and system dependent segments.
Packit 6c4009
     The last segment is a static segment, including the trailing NUL.  */
Packit 6c4009
  struct segment_pair segments[1];
Packit 6c4009
};
Packit 6c4009
Packit 6c4009
/* Marker for the end of the segments[] array.  This has the value 0xFFFFFFFF,
Packit 6c4009
   regardless whether 'int' is 16 bit, 32 bit, or 64 bit.  */
Packit 6c4009
#define SEGMENTS_END ((nls_uint32) ~0)
Packit 6c4009
Packit 6c4009
/* @@ begin of epilog @@ */
Packit 6c4009
Packit 6c4009
#endif	/* gettext.h  */