nl_types.h revision 142661
1215976Sjmallett/*	$NetBSD: nl_types.h,v 1.9 2000/10/03 19:53:32 sommerfeld Exp $	*/
2232812Sjmallett
3215976Sjmallett/*-
4215976Sjmallett * Copyright (c) 1996 The NetBSD Foundation, Inc.
5215976Sjmallett * All rights reserved.
6215976Sjmallett *
7215976Sjmallett * This code is derived from software contributed to The NetBSD Foundation
8215976Sjmallett * by J.T. Conklin.
9215976Sjmallett *
10215976Sjmallett * Redistribution and use in source and binary forms, with or without
11215976Sjmallett * modification, are permitted provided that the following conditions
12215976Sjmallett * are met:
13215976Sjmallett * 1. Redistributions of source code must retain the above copyright
14215976Sjmallett *    notice, this list of conditions and the following disclaimer.
15215976Sjmallett * 2. Redistributions in binary form must reproduce the above copyright
16215976Sjmallett *    notice, this list of conditions and the following disclaimer in the
17215976Sjmallett *    documentation and/or other materials provided with the distribution.
18232812Sjmallett * 3. All advertising materials mentioning features or use of this software
19215976Sjmallett *    must display the following acknowledgement:
20215976Sjmallett *        This product includes software developed by the NetBSD
21215976Sjmallett *        Foundation, Inc. and its contributors.
22215976Sjmallett * 4. Neither the name of The NetBSD Foundation nor the names of its
23215976Sjmallett *    contributors may be used to endorse or promote products derived
24215976Sjmallett *    from this software without specific prior written permission.
25215976Sjmallett *
26215976Sjmallett * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27215976Sjmallett * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28215976Sjmallett * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29232812Sjmallett * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30215976Sjmallett * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31215976Sjmallett * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32215976Sjmallett * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33215976Sjmallett * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34215976Sjmallett * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35215976Sjmallett * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36215976Sjmallett * POSSIBILITY OF SUCH DAMAGE.
37215976Sjmallett *
38215976Sjmallett * $FreeBSD: head/include/nl_types.h 142661 2005-02-27 16:20:53Z phantom $
39215976Sjmallett */
40215976Sjmallett
41215976Sjmallett#ifndef _NL_TYPES_H_
42215976Sjmallett#define _NL_TYPES_H_
43215976Sjmallett
44215976Sjmallett#include <sys/cdefs.h>
45215976Sjmallett#include <sys/types.h>
46215976Sjmallett
47215976Sjmallett#ifdef _NLS_PRIVATE
48215976Sjmallett/*
49215976Sjmallett * MESSAGE CATALOG FILE FORMAT.
50215976Sjmallett *
51215976Sjmallett * The NetBSD/FreeBSD message catalog format is similar to the format used by
52232812Sjmallett * Svr4 systems.  The differences are:
53232812Sjmallett *   * fixed byte order (big endian)
54215976Sjmallett *   * fixed data field sizes
55215976Sjmallett *
56215976Sjmallett * A message catalog contains four data types: a catalog header, one
57215976Sjmallett * or more set headers, one or more message headers, and one or more
58215976Sjmallett * text strings.
59215976Sjmallett */
60215976Sjmallett
61215976Sjmallett#define _NLS_MAGIC	0xff88ff89
62215976Sjmallett
63215976Sjmallettstruct _nls_cat_hdr {
64215976Sjmallett	int32_t __magic;
65215976Sjmallett	int32_t __nsets;
66215976Sjmallett	int32_t __mem;
67215976Sjmallett	int32_t __msg_hdr_offset;
68215976Sjmallett	int32_t __msg_txt_offset;
69215976Sjmallett} ;
70215976Sjmallett
71215976Sjmallettstruct _nls_set_hdr {
72215976Sjmallett	int32_t __setno;	/* set number: 0 < x <= NL_SETMAX */
73215976Sjmallett	int32_t __nmsgs;	/* number of messages in the set  */
74232812Sjmallett	int32_t __index;	/* index of first msg_hdr in msg_hdr table */
75215976Sjmallett} ;
76232812Sjmallett
77232812Sjmallettstruct _nls_msg_hdr {
78215976Sjmallett	int32_t __msgno;	/* msg number: 0 < x <= NL_MSGMAX */
79215976Sjmallett	int32_t __msglen;
80215976Sjmallett	int32_t __offset;
81215976Sjmallett} ;
82215976Sjmallett
83215976Sjmallett#endif	/* _NLS_PRIVATE */
84215976Sjmallett
85215976Sjmallett#define	NL_SETD		0
86215976Sjmallett#define	NL_CAT_LOCALE	1
87215976Sjmallett
88215976Sjmalletttypedef struct __nl_cat_d {
89215976Sjmallett	void	*__data;
90215976Sjmallett	int	__size;
91215976Sjmallett} *nl_catd;
92215976Sjmallett
93215976Sjmallett#ifndef _NL_ITEM_DECLARED
94215976Sjmalletttypedef	__nl_item	nl_item;
95215976Sjmallett#define	_NL_ITEM_DECLARED
96215976Sjmallett#endif
97215976Sjmallett
98215976Sjmallett__BEGIN_DECLS
99215976Sjmallettnl_catd  catopen(const char *, int);
100215976Sjmallettchar    *catgets(nl_catd, int, int, const char *)
101215976Sjmallett	__attribute__((__format_arg__(4)));
102215976Sjmallettint	 catclose(nl_catd);
103215976Sjmallett__END_DECLS
104215976Sjmallett
105215976Sjmallett#endif	/* _NL_TYPES_H_ */
106215976Sjmallett