gettext.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /* Description of GNU message catalog format: general file layout.
  2. Copyright (C) 1995, 1997, 2000, 2001 Free Software Foundation, Inc.
  3. This program is free software; you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation; either version 2, or (at your option)
  6. any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program; if not, write to the Free Software Foundation,
  13. Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
  14. #ifndef _GETTEXT_H
  15. #define _GETTEXT_H 1
  16. #if HAVE_LIMITS_H || _LIBC
  17. # include <limits.h>
  18. #endif
  19. /* @@ end of prolog @@ */
  20. /* The magic number of the GNU message catalog format. */
  21. #define _MAGIC 0x950412de
  22. #define _MAGIC_SWAPPED 0xde120495
  23. /* Revision number of the currently used .mo (binary) file format. */
  24. #define MO_REVISION_NUMBER 0
  25. /* The following contortions are an attempt to use the C preprocessor
  26. to determine an unsigned integral type that is 32 bits wide. An
  27. alternative approach is to use autoconf's AC_CHECK_SIZEOF macro, but
  28. as of version autoconf-2.13, the AC_CHECK_SIZEOF macro doesn't work
  29. when cross-compiling. */
  30. #if __STDC__
  31. # define UINT_MAX_32_BITS 4294967295U
  32. #else
  33. # define UINT_MAX_32_BITS 0xFFFFFFFF
  34. #endif
  35. /* If UINT_MAX isn't defined, assume it's a 32-bit type.
  36. This should be valid for all systems GNU cares about because
  37. that doesn't include 16-bit systems, and only modern systems
  38. (that certainly have <limits.h>) have 64+-bit integral types. */
  39. #ifndef UINT_MAX
  40. # define UINT_MAX UINT_MAX_32_BITS
  41. #endif
  42. #if UINT_MAX == UINT_MAX_32_BITS
  43. typedef unsigned nls_uint32;
  44. #else
  45. # if USHRT_MAX == UINT_MAX_32_BITS
  46. typedef unsigned short nls_uint32;
  47. # else
  48. # if ULONG_MAX == UINT_MAX_32_BITS
  49. typedef unsigned long nls_uint32;
  50. # else
  51. /* The following line is intended to throw an error. Using #error is
  52. not portable enough. */
  53. "Cannot determine unsigned 32-bit data type."
  54. # endif
  55. # endif
  56. #endif
  57. /* Header for binary .mo file format. */
  58. struct mo_file_header
  59. {
  60. /* The magic number. */
  61. nls_uint32 magic;
  62. /* The revision number of the file format. */
  63. nls_uint32 revision;
  64. /* The number of strings pairs. */
  65. nls_uint32 nstrings;
  66. /* Offset of table with start offsets of original strings. */
  67. nls_uint32 orig_tab_offset;
  68. /* Offset of table with start offsets of translation strings. */
  69. nls_uint32 trans_tab_offset;
  70. /* Size of hashing table. */
  71. nls_uint32 hash_tab_size;
  72. /* Offset of first hashing entry. */
  73. nls_uint32 hash_tab_offset;
  74. };
  75. struct string_desc
  76. {
  77. /* Length of addressed string. */
  78. nls_uint32 length;
  79. /* Offset of string in file. */
  80. nls_uint32 offset;
  81. };
  82. /* @@ begin of epilog @@ */
  83. #endif /* gettext.h */