1 1.14 riastrad /* $NetBSD: nl_types.h,v 1.14 2024/10/30 15:56:10 riastradh Exp $ */ 2 1.2 cgd 3 1.6 jtc /*- 4 1.6 jtc * Copyright (c) 1996 The NetBSD Foundation, Inc. 5 1.6 jtc * All rights reserved. 6 1.6 jtc * 7 1.6 jtc * This code is derived from software contributed to The NetBSD Foundation 8 1.6 jtc * by J.T. Conklin. 9 1.6 jtc * 10 1.6 jtc * Redistribution and use in source and binary forms, with or without 11 1.6 jtc * modification, are permitted provided that the following conditions 12 1.6 jtc * are met: 13 1.6 jtc * 1. Redistributions of source code must retain the above copyright 14 1.6 jtc * notice, this list of conditions and the following disclaimer. 15 1.6 jtc * 2. Redistributions in binary form must reproduce the above copyright 16 1.6 jtc * notice, this list of conditions and the following disclaimer in the 17 1.6 jtc * documentation and/or other materials provided with the distribution. 18 1.6 jtc * 19 1.6 jtc * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 20 1.6 jtc * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 21 1.6 jtc * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 22 1.8 jtc * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 23 1.8 jtc * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 1.6 jtc * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 1.6 jtc * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 1.6 jtc * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 1.6 jtc * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 1.6 jtc * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 1.6 jtc * POSSIBILITY OF SUCH DAMAGE. 30 1.6 jtc */ 31 1.1 jtc 32 1.1 jtc #ifndef _NL_TYPES_H_ 33 1.1 jtc #define _NL_TYPES_H_ 34 1.14 riastrad 35 1.1 jtc #include <sys/cdefs.h> 36 1.14 riastrad #include <sys/featuretest.h> 37 1.1 jtc 38 1.6 jtc #ifdef _NLS_PRIVATE 39 1.6 jtc /* 40 1.6 jtc * MESSAGE CATALOG FILE FORMAT. 41 1.6 jtc * 42 1.6 jtc * The NetBSD message catalog format is similar to the format used by 43 1.6 jtc * Svr4 systems. The differences are: 44 1.6 jtc * * fixed byte order (big endian) 45 1.6 jtc * * fixed data field sizes 46 1.6 jtc * 47 1.6 jtc * A message catalog contains four data types: a catalog header, one 48 1.6 jtc * or more set headers, one or more message headers, and one or more 49 1.6 jtc * text strings. 50 1.6 jtc */ 51 1.6 jtc 52 1.6 jtc #define _NLS_MAGIC 0xff88ff89 53 1.6 jtc 54 1.6 jtc struct _nls_cat_hdr { 55 1.6 jtc int32_t __magic; 56 1.6 jtc int32_t __nsets; 57 1.6 jtc int32_t __mem; 58 1.6 jtc int32_t __msg_hdr_offset; 59 1.6 jtc int32_t __msg_txt_offset; 60 1.6 jtc } ; 61 1.6 jtc 62 1.6 jtc struct _nls_set_hdr { 63 1.6 jtc int32_t __setno; /* set number: 0 < x <= NL_SETMAX */ 64 1.6 jtc int32_t __nmsgs; /* number of messages in the set */ 65 1.6 jtc int32_t __index; /* index of first msg_hdr in msg_hdr table */ 66 1.6 jtc } ; 67 1.6 jtc 68 1.6 jtc struct _nls_msg_hdr { 69 1.6 jtc int32_t __msgno; /* msg number: 0 < x <= NL_MSGMAX */ 70 1.6 jtc int32_t __msglen; 71 1.6 jtc int32_t __offset; 72 1.6 jtc } ; 73 1.6 jtc 74 1.6 jtc #endif 75 1.6 jtc 76 1.6 jtc #define NL_SETD 1 77 1.6 jtc #define NL_CAT_LOCALE 1 78 1.6 jtc 79 1.10 wiz typedef struct __nl_cat_d { 80 1.6 jtc void *__data; 81 1.6 jtc int __size; 82 1.6 jtc } *nl_catd; 83 1.1 jtc 84 1.1 jtc typedef long nl_item; 85 1.1 jtc 86 1.7 christos __BEGIN_DECLS 87 1.11 perry nl_catd catopen(const char *, int); 88 1.13 joerg char *catgets(nl_catd, int, int, const char *) __format_arg(4); 89 1.11 perry int catclose(nl_catd); 90 1.7 christos __END_DECLS 91 1.1 jtc 92 1.13 joerg #if defined(_NETBSD_SOURCE) 93 1.13 joerg # ifndef __LOCALE_T_DECLARED 94 1.13 joerg typedef struct _locale *locale_t; 95 1.13 joerg # define __LOCALE_T_DECLARED 96 1.13 joerg # endif 97 1.13 joerg __BEGIN_DECLS 98 1.13 joerg nl_catd catopen_l(const char *, int, locale_t); 99 1.13 joerg __END_DECLS 100 1.13 joerg #endif 101 1.13 joerg 102 1.1 jtc #endif /* _NL_TYPES_H_ */ 103