Blame intl/gmo.h

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