libintl.h revision 1.7
11.6Schristos/*	$NetBSD: libintl.h,v 1.7 2015/06/08 15:02:33 christos Exp $	*/
21.1Sitojun
31.1Sitojun/*-
41.1Sitojun * Copyright (c) 2000 Citrus Project,
51.1Sitojun * All rights reserved.
61.1Sitojun *
71.1Sitojun * Redistribution and use in source and binary forms, with or without
81.1Sitojun * modification, are permitted provided that the following conditions
91.1Sitojun * are met:
101.1Sitojun * 1. Redistributions of source code must retain the above copyright
111.1Sitojun *    notice, this list of conditions and the following disclaimer.
121.1Sitojun * 2. Redistributions in binary form must reproduce the above copyright
131.1Sitojun *    notice, this list of conditions and the following disclaimer in the
141.1Sitojun *    documentation and/or other materials provided with the distribution.
151.1Sitojun *
161.1Sitojun * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
171.1Sitojun * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
181.1Sitojun * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
191.1Sitojun * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
201.1Sitojun * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
211.1Sitojun * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
221.1Sitojun * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
231.1Sitojun * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
241.1Sitojun * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
251.1Sitojun * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
261.1Sitojun * SUCH DAMAGE.
271.1Sitojun */
281.1Sitojun
291.6Schristos#ifndef _LIBINTL_H_
301.6Schristos#define _LIBINTL_H_
311.1Sitojun
321.1Sitojun#include <sys/cdefs.h>
331.1Sitojun
341.5Schristos
351.2Sitojun__BEGIN_DECLS
361.4Sjoergchar *gettext(const char *) __format_arg(1);
371.4Sjoergchar *dgettext(const char *, const char *) __format_arg(2);
381.4Sjoergchar *dcgettext(const char *, const char *, int) __format_arg(2);
391.4Sjoergchar *ngettext(const char *, const char *, unsigned long int)
401.5Schristos	       __format_arg(1) __format_arg(2);
411.4Sjoergchar *dngettext(const char *, const char *, const char *, unsigned long int)
421.5Schristos		__format_arg(2) __format_arg(3);
431.3Sjunyoungchar *dcngettext(const char *, const char *, const char *, unsigned long int,
441.5Schristos		 int) __format_arg(2) __format_arg(3);
451.5Schristosconst char *pgettext(const char *, const char *) __format_arg(2);
461.5Schristosconst char *dpgettext(const char *, const char *, const char *)
471.5Schristos		      __format_arg(3);
481.5Schristosconst char *dcpgettext(const char *, const char *, const char *, int)
491.5Schristos		       __format_arg(3);
501.5Schristosconst char *npgettext(const char *, const char *, const char *,
511.5Schristos		      unsigned long int) __format_arg(2) __format_arg(3);
521.5Schristosconst char *dnpgettext(const char *, const char *, const char *,
531.5Schristos		       const char *, unsigned long int) __format_arg(3)
541.5Schristos		       __format_arg(4);
551.5Schristosconst char *dcnpgettext(const char *, const char *, const char *,
561.5Schristos			const char *, unsigned long int, int) __format_arg(3)
571.5Schristos			__format_arg(4);
581.3Sjunyoung
591.3Sjunyoungchar *textdomain(const char *);
601.3Sjunyoungchar *bindtextdomain(const char *, const char *);
611.3Sjunyoungchar *bind_textdomain_codeset(const char *, const char *);
621.7Schristos
631.7Schristos#ifndef _LIBGETTEXT_H
641.7Schristos/*
651.7Schristos * Avoid defining these if the GNU gettext compatibility header includes
661.7Schristos * us, since it re-defines those unconditionally and creates inline functions
671.7Schristos * for some of them. This is horrible.
681.7Schristos */
691.7Schristosstatic __inline __format_arg(2) const char *
701.7Schristospgettext_expr(const char *_msgctxt, const char *_msgid)
711.7Schristos{
721.7Schristos	return pgettext(_msgctxt, _msgid);
731.7Schristos}
741.7Schristos
751.7Schristosstatic __inline __format_arg(3) const char *
761.7Schristosdpgettext_expr(const char *_domainname, const char *_msgctxt,
771.7Schristos    const char *_msgid)
781.7Schristos{
791.7Schristos	return dpgettext(_domainname, _msgctxt, _msgid);
801.7Schristos}
811.7Schristos
821.7Schristosstatic __inline __format_arg(3) const char *
831.7Schristosdcpgettext_expr(const char *_domainname, const char *_msgctxt,
841.7Schristos    const char *_msgid, int _category)
851.7Schristos{
861.7Schristos	return dcpgettext(_domainname, _msgctxt, _msgid, _category);
871.7Schristos}
881.7Schristos
891.7Schristosstatic __inline __format_arg(2) __format_arg(3) const char *
901.7Schristosnpgettext_expr(const char *_msgctx, const char *_msgid1, const char *_msgid2,
911.7Schristos    long int _n)
921.7Schristos{
931.7Schristos	return npgettext(_msgctx, _msgid1, _msgid2, _n);
941.7Schristos}
951.7Schristos
961.7Schristosstatic __inline __format_arg(3) __format_arg(4) const char *
971.7Schristosdnpgettext_expr(const char *_domainname, const char *_msgctx,
981.7Schristos    const char *_msgid1, const char *_msgid2, long int _n)
991.7Schristos{
1001.7Schristos	return dnpgettext(_domainname, _msgctx, _msgid1, _msgid2, _n);
1011.7Schristos}
1021.7Schristos
1031.7Schristosstatic __inline __format_arg(3) __format_arg(4) const char *
1041.7Schristosdcnpgettext_expr(const char *_domainname, const char *_msgctx,
1051.7Schristos    const char *_msgid1, const char *_msgid2, long int _n, int _category)
1061.7Schristos{
1071.7Schristos	return dcnpgettext(_domainname, _msgctx, _msgid1, _msgid2, _n,
1081.7Schristos	    _category);
1091.7Schristos}
1101.7Schristos#endif /* _LIBGETTEXT_H */
1111.7Schristos
1121.2Sitojun__END_DECLS
1131.1Sitojun
1141.6Schristos#endif /* _LIBINTL_H_ */
115