xref: /illumos-gate/usr/src/head/nl_types.h (revision 6e270ca8)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
57c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
67c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
77c478bd9Sstevel@tonic-gate  * with the License.
87c478bd9Sstevel@tonic-gate  *
97c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
117c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
127c478bd9Sstevel@tonic-gate  * and limitations under the License.
137c478bd9Sstevel@tonic-gate  *
147c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
157c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
177c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
187c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
197c478bd9Sstevel@tonic-gate  *
207c478bd9Sstevel@tonic-gate  * CDDL HEADER END
217c478bd9Sstevel@tonic-gate  */
227c478bd9Sstevel@tonic-gate /*
237c478bd9Sstevel@tonic-gate  *  nl_types.h
247c478bd9Sstevel@tonic-gate  *
25ba3594baSGarrett D'Amore  * Copyright 2014 Garrett D'Amore <garrett@damore.org>
26ba3594baSGarrett D'Amore  *
277c478bd9Sstevel@tonic-gate  * Copyright (c) 1991,1997,2000 by Sun Microsystems, Inc.
287c478bd9Sstevel@tonic-gate  * All rights reserved.
297c478bd9Sstevel@tonic-gate  */
307c478bd9Sstevel@tonic-gate 
317c478bd9Sstevel@tonic-gate /*	Copyright (c) 1988 AT&T	*/
327c478bd9Sstevel@tonic-gate /*	All Rights Reserved	*/
337c478bd9Sstevel@tonic-gate 
347c478bd9Sstevel@tonic-gate #ifndef	_NL_TYPES_H
357c478bd9Sstevel@tonic-gate #define	_NL_TYPES_H
367c478bd9Sstevel@tonic-gate 
377c478bd9Sstevel@tonic-gate #include <sys/isa_defs.h>
387c478bd9Sstevel@tonic-gate 
397c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
407c478bd9Sstevel@tonic-gate extern "C" {
417c478bd9Sstevel@tonic-gate #endif
427c478bd9Sstevel@tonic-gate 
43*6e270ca8SMarcel Telka #define	NL_SETD			1    /* XPG3 Conformant Default set number. */
44*6e270ca8SMarcel Telka #define	NL_CAT_LOCALE		(-1) /* XPG4 requirement */
457c478bd9Sstevel@tonic-gate 
46*6e270ca8SMarcel Telka #define	_CAT_MAGIC		0xFF88FF89
47*6e270ca8SMarcel Telka #define	_CAT_HDR_SIZE		sizeof (struct _cat_hdr)
48*6e270ca8SMarcel Telka #define	_CAT_SET_HDR_SIZE	sizeof (struct _cat_set_hdr)
49*6e270ca8SMarcel Telka #define	_CAT_MSG_HDR_SIZE	sizeof (struct _cat_msg_hdr)
507c478bd9Sstevel@tonic-gate 
517c478bd9Sstevel@tonic-gate struct _cat_hdr
527c478bd9Sstevel@tonic-gate {
537c478bd9Sstevel@tonic-gate #if	!defined(_LP64)
547c478bd9Sstevel@tonic-gate 	long __hdr_magic;		/* must contain CAT_MAGIC */
557c478bd9Sstevel@tonic-gate #else
567c478bd9Sstevel@tonic-gate 	int	__hdr_magic;		/* must contain CAT_MAGIC */
577c478bd9Sstevel@tonic-gate #endif
587c478bd9Sstevel@tonic-gate 	int __nsets;		/* the number of sets in the catalogue */
597c478bd9Sstevel@tonic-gate 	int __mem;		/* the size of the catalogue; the size	   */
607c478bd9Sstevel@tonic-gate 				/* does not include the size of the header */
617c478bd9Sstevel@tonic-gate #if	!defined(_LP64)
627c478bd9Sstevel@tonic-gate 	long __msg_hdr_offset;	/* the byte offset of the first message */
637c478bd9Sstevel@tonic-gate 				/* header */
647c478bd9Sstevel@tonic-gate 	long __msg_text_offset;	/* the byte offset of the message text area */
657c478bd9Sstevel@tonic-gate #else
667c478bd9Sstevel@tonic-gate 	int __msg_hdr_offset;	/* the byte offset of the first message */
677c478bd9Sstevel@tonic-gate 				/* header */
687c478bd9Sstevel@tonic-gate 	int __msg_text_offset;	/* the byte offset of the message text area */
697c478bd9Sstevel@tonic-gate #endif
707c478bd9Sstevel@tonic-gate };
717c478bd9Sstevel@tonic-gate 
727c478bd9Sstevel@tonic-gate struct _cat_set_hdr
737c478bd9Sstevel@tonic-gate {
747c478bd9Sstevel@tonic-gate 	int __set_no;	/* the set number; must be greater than 0;   */
757c478bd9Sstevel@tonic-gate 			/* should be less than or equal to NL_SETMAX */
767c478bd9Sstevel@tonic-gate 	int __nmsgs;	/* the number of msgs in the set */
777c478bd9Sstevel@tonic-gate 	int __first_msg_hdr;	/* the index of the first message header in */
787c478bd9Sstevel@tonic-gate 				/* the set; the value is not a byte offset, */
797c478bd9Sstevel@tonic-gate 				/* it is a 0-based index		    */
807c478bd9Sstevel@tonic-gate };
817c478bd9Sstevel@tonic-gate 
827c478bd9Sstevel@tonic-gate struct _cat_msg_hdr
837c478bd9Sstevel@tonic-gate {
847c478bd9Sstevel@tonic-gate 	int __msg_no;	/* the message number; must be greater than 0; */
857c478bd9Sstevel@tonic-gate 			/* should be less than or equal to NL_MSGMAX   */
867c478bd9Sstevel@tonic-gate 	int __msg_len;	/* the length of the message; must be greater */
877c478bd9Sstevel@tonic-gate 			/* than or equal to zero; should be less than */
887c478bd9Sstevel@tonic-gate 			/* or equal to NL_TEXTMAX */
897c478bd9Sstevel@tonic-gate 	int __msg_offset; /* the byte offset of the message in the message */
907c478bd9Sstevel@tonic-gate 			/* area; the offset is relative to the start of  */
917c478bd9Sstevel@tonic-gate 			/* the message area, not to the start of the	 */
927c478bd9Sstevel@tonic-gate 			/* catalogue.					 */
937c478bd9Sstevel@tonic-gate };
947c478bd9Sstevel@tonic-gate 
957c478bd9Sstevel@tonic-gate struct _nl_catd_struct {
967c478bd9Sstevel@tonic-gate 	void	*__content;	/* mmaped catalogue contents */
977c478bd9Sstevel@tonic-gate 	int	__size;		/* Size of catalogue file */
987c478bd9Sstevel@tonic-gate 	int	__trust;	/* File is from a trusted location */
997c478bd9Sstevel@tonic-gate };
1007c478bd9Sstevel@tonic-gate 
1017c478bd9Sstevel@tonic-gate typedef struct _nl_catd_struct *nl_catd;
1027c478bd9Sstevel@tonic-gate typedef int nl_item;	/* XPG3 Conformant for nl_langinfo(). */
1037c478bd9Sstevel@tonic-gate 
1047c478bd9Sstevel@tonic-gate /* The following is just for the compatibility between OSF and Solaris */
1057c478bd9Sstevel@tonic-gate /* Need to be removed later */
1067c478bd9Sstevel@tonic-gate typedef	nl_item	__nl_item;
1077c478bd9Sstevel@tonic-gate 
1087c478bd9Sstevel@tonic-gate int	catclose(nl_catd);
1097c478bd9Sstevel@tonic-gate char	*catgets(nl_catd, int, int, const char *);
1107c478bd9Sstevel@tonic-gate nl_catd catopen(const char *, int);
1117c478bd9Sstevel@tonic-gate 
1127c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
1137c478bd9Sstevel@tonic-gate }
1147c478bd9Sstevel@tonic-gate #endif
1157c478bd9Sstevel@tonic-gate 
1167c478bd9Sstevel@tonic-gate #endif	/* _NL_TYPES_H */
117