xref: /titanic_41/usr/src/head/nl_types.h (revision b59b3655028aeb11832ad679eb5c2577c2b75235)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  *  nl_types.h
24  *
25  * Copyright 2014 Garrett D'Amore <garrett@damore.org>
26  *
27  * Copyright (c) 1991,1997,2000 by Sun Microsystems, Inc.
28  * All rights reserved.
29  */
30 
31 /*	Copyright (c) 1988 AT&T	*/
32 /*	All Rights Reserved	*/
33 
34 #ifndef	_NL_TYPES_H
35 #define	_NL_TYPES_H
36 
37 #include <sys/isa_defs.h>
38 
39 #ifdef	__cplusplus
40 extern "C" {
41 #endif
42 
43 #define	NL_SETD 		1    /* XPG3 Conformant Default set number. */
44 #define	NL_CAT_LOCALE 		(-1) /* XPG4 requirement */
45 
46 #define	_CAT_MAGIC 		0xFF88FF89
47 #define	_CAT_HDR_SIZE 		sizeof (struct _cat_hdr)
48 #define	_CAT_SET_HDR_SIZE 	sizeof (struct _cat_set_hdr)
49 #define	_CAT_MSG_HDR_SIZE 	sizeof (struct _cat_msg_hdr)
50 
51 struct _cat_hdr
52 {
53 #if	!defined(_LP64)
54 	long __hdr_magic;		/* must contain CAT_MAGIC */
55 #else
56 	int	__hdr_magic;		/* must contain CAT_MAGIC */
57 #endif
58 	int __nsets;		/* the number of sets in the catalogue */
59 	int __mem;		/* the size of the catalogue; the size	   */
60 				/* does not include the size of the header */
61 #if	!defined(_LP64)
62 	long __msg_hdr_offset;	/* the byte offset of the first message */
63 				/* header */
64 	long __msg_text_offset;	/* the byte offset of the message text area */
65 #else
66 	int __msg_hdr_offset;	/* the byte offset of the first message */
67 				/* header */
68 	int __msg_text_offset;	/* the byte offset of the message text area */
69 #endif
70 };
71 
72 struct _cat_set_hdr
73 {
74 	int __set_no;	/* the set number; must be greater than 0;   */
75 			/* should be less than or equal to NL_SETMAX */
76 	int __nmsgs;	/* the number of msgs in the set */
77 	int __first_msg_hdr;	/* the index of the first message header in */
78 				/* the set; the value is not a byte offset, */
79 				/* it is a 0-based index		    */
80 };
81 
82 struct _cat_msg_hdr
83 {
84 	int __msg_no;	/* the message number; must be greater than 0; */
85 			/* should be less than or equal to NL_MSGMAX   */
86 	int __msg_len;	/* the length of the message; must be greater */
87 			/* than or equal to zero; should be less than */
88 			/* or equal to NL_TEXTMAX */
89 	int __msg_offset; /* the byte offset of the message in the message */
90 			/* area; the offset is relative to the start of  */
91 			/* the message area, not to the start of the	 */
92 			/* catalogue.					 */
93 };
94 
95 struct _nl_catd_struct {
96 	void	*__content;	/* mmaped catalogue contents */
97 	int	__size;		/* Size of catalogue file */
98 	int	__trust;	/* File is from a trusted location */
99 };
100 
101 typedef struct _nl_catd_struct *nl_catd;
102 typedef int nl_item;	/* XPG3 Conformant for nl_langinfo(). */
103 
104 /* The following is just for the compatibility between OSF and Solaris */
105 /* Need to be removed later */
106 typedef	nl_item	__nl_item;
107 
108 int	catclose(nl_catd);
109 char	*catgets(nl_catd, int, int, const char *);
110 nl_catd catopen(const char *, int);
111 
112 #ifdef	__cplusplus
113 }
114 #endif
115 
116 #endif	/* _NL_TYPES_H */
117