libintl_local.h revision 1.7 1 1.7 yamt /* $NetBSD: libintl_local.h,v 1.7 2004/01/18 08:40:40 yamt Exp $ */
2 1.1 itojun
3 1.1 itojun /*-
4 1.5 minoura * Copyright (c) 2000, 2001 Citrus Project,
5 1.1 itojun * All rights reserved.
6 1.1 itojun *
7 1.1 itojun * Redistribution and use in source and binary forms, with or without
8 1.1 itojun * modification, are permitted provided that the following conditions
9 1.1 itojun * are met:
10 1.1 itojun * 1. Redistributions of source code must retain the above copyright
11 1.1 itojun * notice, this list of conditions and the following disclaimer.
12 1.1 itojun * 2. Redistributions in binary form must reproduce the above copyright
13 1.1 itojun * notice, this list of conditions and the following disclaimer in the
14 1.1 itojun * documentation and/or other materials provided with the distribution.
15 1.1 itojun *
16 1.1 itojun * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17 1.1 itojun * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 1.1 itojun * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 1.1 itojun * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20 1.1 itojun * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 1.1 itojun * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 1.1 itojun * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 1.1 itojun * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 1.1 itojun * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 1.1 itojun * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 1.1 itojun * SUCH DAMAGE.
27 1.6 yamt *
28 1.6 yamt * $Citrus: xpg4dl/FreeBSD/lib/libintl/libintl_local.h,v 1.13 2001/09/27 15:18:45 yamt Exp $
29 1.1 itojun */
30 1.1 itojun
31 1.1 itojun #define MO_MAGIC 0x950412de
32 1.1 itojun #define MO_MAGIC_SWAPPED 0xde120495
33 1.1 itojun #define MO_REVISION 0
34 1.1 itojun
35 1.6 yamt #define GETTEXT_MMAP_MAX (1024 * 1024) /*XXX*/
36 1.2 itojun
37 1.2 itojun #define DEFAULT_DOMAINNAME "messages"
38 1.1 itojun
39 1.1 itojun /* *.mo file format */
40 1.1 itojun struct mo {
41 1.1 itojun u_int32_t mo_magic; /* determines endian */
42 1.1 itojun u_int32_t mo_revision; /* file format revision: 0 */
43 1.1 itojun u_int32_t mo_nstring; /* N: number of strings */
44 1.1 itojun u_int32_t mo_otable; /* O: original text table offset */
45 1.1 itojun u_int32_t mo_ttable; /* T: translated text table offset */
46 1.1 itojun u_int32_t mo_hsize; /* S: size of hashing table */
47 1.1 itojun u_int32_t mo_hoffset; /* H: offset of hashing table */
48 1.3 itojun } __attribute__((__packed__));
49 1.1 itojun
50 1.1 itojun struct moentry {
51 1.1 itojun u_int32_t len; /* strlen(str), so region will be len + 1 */
52 1.1 itojun u_int32_t off; /* offset of \0-terminated string */
53 1.3 itojun } __attribute__((__packed__));
54 1.1 itojun
55 1.1 itojun /* libintl internal data format */
56 1.1 itojun struct moentry_h {
57 1.1 itojun size_t len; /* strlen(str), so region will be len + 1 */
58 1.1 itojun char *off; /* offset of \0-terminated string */
59 1.1 itojun };
60 1.1 itojun
61 1.1 itojun struct mo_h {
62 1.1 itojun u_int32_t mo_magic; /* determines endian */
63 1.1 itojun u_int32_t mo_revision; /* file format revision: 0 */
64 1.1 itojun u_int32_t mo_nstring; /* N: number of strings */
65 1.1 itojun struct moentry_h *mo_otable; /* O: original text table offset */
66 1.1 itojun struct moentry_h *mo_ttable; /* T: translated text table offset */
67 1.1 itojun const char *mo_header;
68 1.1 itojun char *mo_charset;
69 1.1 itojun };
70 1.1 itojun
71 1.1 itojun struct mohandle {
72 1.1 itojun void *addr; /* mmap'ed region */
73 1.1 itojun size_t len;
74 1.1 itojun struct mo_h mo; /* endian-flipped mo file header */
75 1.1 itojun };
76 1.4 itojun
77 1.4 itojun struct domainbinding {
78 1.4 itojun struct domainbinding *next;
79 1.4 itojun char domainname[PATH_MAX];
80 1.4 itojun char path[PATH_MAX];
81 1.7 yamt char *codeset;
82 1.5 minoura struct mohandle mohandle;
83 1.4 itojun };
84 1.4 itojun
85 1.5 minoura extern struct domainbinding *__bindings;
86 1.5 minoura extern char __current_domainname[PATH_MAX];
87 1.7 yamt
88 1.7 yamt const char *__gettext_iconv __P((const char *, struct domainbinding *));
89