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