00001 /* Description of GNU message catalog format: general file layout. 00002 Copyright (C) 1995, 1997, 2000, 2001 Free Software Foundation, Inc. 00003 00004 This program is free software; you can redistribute it and/or modify it 00005 under the terms of the GNU Library General Public License as published 00006 by the Free Software Foundation; either version 2, or (at your option) 00007 any later version. 00008 00009 This program is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public 00015 License along with this program; if not, write to the Free Software 00016 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 00017 USA. */ 00018 00019 #ifndef _GETTEXT_H 00020 #define _GETTEXT_H 1 00021 00022 #include <limits.h> 00023 00024 /* @@ end of prolog @@ */ 00025 00026 /* The magic number of the GNU message catalog format. */ 00027 #define _MAGIC 0x950412de 00028 #define _MAGIC_SWAPPED 0xde120495 00029 00030 /* Revision number of the currently used .mo (binary) file format. */ 00031 #define MO_REVISION_NUMBER 0 00032 00033 /* The following contortions are an attempt to use the C preprocessor 00034 to determine an unsigned integral type that is 32 bits wide. An 00035 alternative approach is to use autoconf's AC_CHECK_SIZEOF macro, but 00036 as of version autoconf-2.13, the AC_CHECK_SIZEOF macro doesn't work 00037 when cross-compiling. */ 00038 00039 #if __STDC__ 00040 # define UINT_MAX_32_BITS 4294967295U 00041 #else 00042 # define UINT_MAX_32_BITS 0xFFFFFFFF 00043 #endif 00044 00045 /* If UINT_MAX isn't defined, assume it's a 32-bit type. 00046 This should be valid for all systems GNU cares about because 00047 that doesn't include 16-bit systems, and only modern systems 00048 (that certainly have <limits.h>) have 64+-bit integral types. */ 00049 00050 #ifndef UINT_MAX 00051 # define UINT_MAX UINT_MAX_32_BITS 00052 #endif 00053 00054 #if UINT_MAX == UINT_MAX_32_BITS 00055 typedef unsigned nls_uint32; 00056 #else 00057 # if USHRT_MAX == UINT_MAX_32_BITS 00058 typedef unsigned short nls_uint32; 00059 # else 00060 # if ULONG_MAX == UINT_MAX_32_BITS 00061 typedef unsigned long nls_uint32; 00062 # else 00063 /* The following line is intended to throw an error. Using #error is 00064 not portable enough. */ 00065 "Cannot determine unsigned 32-bit data type." 00066 # endif 00067 # endif 00068 #endif 00069 00070 00071 /* Header for binary .mo file format. */ 00072 struct mo_file_header 00073 { 00074 /* The magic number. */ 00075 nls_uint32 magic; 00076 /* The revision number of the file format. */ 00077 nls_uint32 revision; 00078 /* The number of strings pairs. */ 00079 nls_uint32 nstrings; 00080 /* Offset of table with start offsets of original strings. */ 00081 nls_uint32 orig_tab_offset; 00082 /* Offset of table with start offsets of translation strings. */ 00083 nls_uint32 trans_tab_offset; 00084 /* Size of hashing table. */ 00085 nls_uint32 hash_tab_size; 00086 /* Offset of first hashing entry. */ 00087 nls_uint32 hash_tab_offset; 00088 }; 00089 00090 struct string_desc 00091 { 00092 /* Length of addressed string. */ 00093 nls_uint32 length; 00094 /* Offset of string in file. */ 00095 nls_uint32 offset; 00096 }; 00097 00098 /* @@ begin of epilog @@ */ 00099 00100 #endif /* gettext.h */