nl_types.h revision 142661
1142661Sphantom/*	$NetBSD: nl_types.h,v 1.9 2000/10/03 19:53:32 sommerfeld Exp $	*/
2142661Sphantom
3103899Smike/*-
4142661Sphantom * Copyright (c) 1996 The NetBSD Foundation, Inc.
5142661Sphantom * All rights reserved.
6103899Smike *
7142661Sphantom * This code is derived from software contributed to The NetBSD Foundation
8142661Sphantom * by J.T. Conklin.
9103899Smike *
10142661Sphantom * Redistribution and use in source and binary forms, with or without
11142661Sphantom * modification, are permitted provided that the following conditions
12142661Sphantom * are met:
13142661Sphantom * 1. Redistributions of source code must retain the above copyright
14142661Sphantom *    notice, this list of conditions and the following disclaimer.
15142661Sphantom * 2. Redistributions in binary form must reproduce the above copyright
16142661Sphantom *    notice, this list of conditions and the following disclaimer in the
17142661Sphantom *    documentation and/or other materials provided with the distribution.
18142661Sphantom * 3. All advertising materials mentioning features or use of this software
19142661Sphantom *    must display the following acknowledgement:
20142661Sphantom *        This product includes software developed by the NetBSD
21142661Sphantom *        Foundation, Inc. and its contributors.
22142661Sphantom * 4. Neither the name of The NetBSD Foundation nor the names of its
23142661Sphantom *    contributors may be used to endorse or promote products derived
24142661Sphantom *    from this software without specific prior written permission.
25103899Smike *
26142661Sphantom * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27142661Sphantom * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28142661Sphantom * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29142661Sphantom * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30142661Sphantom * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31142661Sphantom * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32142661Sphantom * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33142661Sphantom * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34142661Sphantom * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35142661Sphantom * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36142661Sphantom * POSSIBILITY OF SUCH DAMAGE.
37103899Smike *
38103899Smike * $FreeBSD: head/include/nl_types.h 142661 2005-02-27 16:20:53Z phantom $
39103899Smike */
407495Sjkh
417495Sjkh#ifndef _NL_TYPES_H_
427495Sjkh#define _NL_TYPES_H_
43103899Smike
447495Sjkh#include <sys/cdefs.h>
45142661Sphantom#include <sys/types.h>
467495Sjkh
47142661Sphantom#ifdef _NLS_PRIVATE
48142661Sphantom/*
49142661Sphantom * MESSAGE CATALOG FILE FORMAT.
50142661Sphantom *
51142661Sphantom * The NetBSD/FreeBSD message catalog format is similar to the format used by
52142661Sphantom * Svr4 systems.  The differences are:
53142661Sphantom *   * fixed byte order (big endian)
54142661Sphantom *   * fixed data field sizes
55142661Sphantom *
56142661Sphantom * A message catalog contains four data types: a catalog header, one
57142661Sphantom * or more set headers, one or more message headers, and one or more
58142661Sphantom * text strings.
59142661Sphantom */
60142661Sphantom
61142661Sphantom#define _NLS_MAGIC	0xff88ff89
62142661Sphantom
63142661Sphantomstruct _nls_cat_hdr {
64142661Sphantom	int32_t __magic;
65142661Sphantom	int32_t __nsets;
66142661Sphantom	int32_t __mem;
67142661Sphantom	int32_t __msg_hdr_offset;
68142661Sphantom	int32_t __msg_txt_offset;
69142661Sphantom} ;
70142661Sphantom
71142661Sphantomstruct _nls_set_hdr {
72142661Sphantom	int32_t __setno;	/* set number: 0 < x <= NL_SETMAX */
73142661Sphantom	int32_t __nmsgs;	/* number of messages in the set  */
74142661Sphantom	int32_t __index;	/* index of first msg_hdr in msg_hdr table */
75142661Sphantom} ;
76142661Sphantom
77142661Sphantomstruct _nls_msg_hdr {
78142661Sphantom	int32_t __msgno;	/* msg number: 0 < x <= NL_MSGMAX */
79142661Sphantom	int32_t __msglen;
80142661Sphantom	int32_t __offset;
81142661Sphantom} ;
82142661Sphantom
83142661Sphantom#endif	/* _NLS_PRIVATE */
84142661Sphantom
8535545Sache#define	NL_SETD		0
8635545Sache#define	NL_CAT_LOCALE	1
877495Sjkh
88142661Sphantomtypedef struct __nl_cat_d {
89142661Sphantom	void	*__data;
90142661Sphantom	int	__size;
91142661Sphantom} *nl_catd;
92103899Smike
93103521Smike#ifndef _NL_ITEM_DECLARED
94103521Smiketypedef	__nl_item	nl_item;
95103521Smike#define	_NL_ITEM_DECLARED
96103521Smike#endif
97103521Smike
9846673Sjkh__BEGIN_DECLS
99142661Sphantomnl_catd  catopen(const char *, int);
100142661Sphantomchar    *catgets(nl_catd, int, int, const char *)
101142661Sphantom	__attribute__((__format_arg__(4)));
102103899Smikeint	 catclose(nl_catd);
10346673Sjkh__END_DECLS
1047495Sjkh
105142661Sphantom#endif	/* _NL_TYPES_H_ */
106