xref: /minix3/include/inttypes.h (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc /*	$NetBSD: inttypes.h,v 1.11 2015/01/16 18:35:59 christos Exp $	*/
22fe8fb19SBen Gras 
32fe8fb19SBen Gras /*-
42fe8fb19SBen Gras  * Copyright (c) 2001 The NetBSD Foundation, Inc.
52fe8fb19SBen Gras  * All rights reserved.
62fe8fb19SBen Gras  *
72fe8fb19SBen Gras  * This code is derived from software contributed to The NetBSD Foundation
82fe8fb19SBen Gras  * by Klaus Klein.
92fe8fb19SBen Gras  *
102fe8fb19SBen Gras  * Redistribution and use in source and binary forms, with or without
112fe8fb19SBen Gras  * modification, are permitted provided that the following conditions
122fe8fb19SBen Gras  * are met:
132fe8fb19SBen Gras  * 1. Redistributions of source code must retain the above copyright
142fe8fb19SBen Gras  *    notice, this list of conditions and the following disclaimer.
152fe8fb19SBen Gras  * 2. Redistributions in binary form must reproduce the above copyright
162fe8fb19SBen Gras  *    notice, this list of conditions and the following disclaimer in the
172fe8fb19SBen Gras  *    documentation and/or other materials provided with the distribution.
182fe8fb19SBen Gras  *
192fe8fb19SBen Gras  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
202fe8fb19SBen Gras  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
212fe8fb19SBen Gras  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
222fe8fb19SBen Gras  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
232fe8fb19SBen Gras  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
242fe8fb19SBen Gras  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
252fe8fb19SBen Gras  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
262fe8fb19SBen Gras  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
272fe8fb19SBen Gras  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
282fe8fb19SBen Gras  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
292fe8fb19SBen Gras  * POSSIBILITY OF SUCH DAMAGE.
30dc23e18cSPhilip Homburg  */
31dc23e18cSPhilip Homburg 
322fe8fb19SBen Gras #ifndef _INTTYPES_H_
332fe8fb19SBen Gras #define _INTTYPES_H_
34dc23e18cSPhilip Homburg 
352fe8fb19SBen Gras #include <sys/cdefs.h>
3684d9c625SLionel Sambuc #include <sys/featuretest.h>
372fe8fb19SBen Gras #include <sys/inttypes.h>
382fe8fb19SBen Gras #include <machine/ansi.h>
392fe8fb19SBen Gras 
402fe8fb19SBen Gras #if defined(_BSD_WCHAR_T_) && !defined(__cplusplus)
412fe8fb19SBen Gras typedef	_BSD_WCHAR_T_	wchar_t;
422fe8fb19SBen Gras #undef	_BSD_WCHAR_T_
43dc23e18cSPhilip Homburg #endif
44dc23e18cSPhilip Homburg 
452fe8fb19SBen Gras __BEGIN_DECLS
462fe8fb19SBen Gras intmax_t	strtoimax(const char * __restrict,
472fe8fb19SBen Gras 		    char ** __restrict, int);
482fe8fb19SBen Gras uintmax_t	strtoumax(const char * __restrict,
492fe8fb19SBen Gras 		    char ** __restrict, int);
502fe8fb19SBen Gras intmax_t	wcstoimax(const wchar_t * __restrict,
512fe8fb19SBen Gras 		    wchar_t ** __restrict, int);
522fe8fb19SBen Gras uintmax_t	wcstoumax(const wchar_t * __restrict,
532fe8fb19SBen Gras 		    wchar_t ** __restrict, int);
54dc23e18cSPhilip Homburg 
552fe8fb19SBen Gras intmax_t	imaxabs(intmax_t);
56f8804c02SErik van der Kouwe 
572fe8fb19SBen Gras typedef struct {
582fe8fb19SBen Gras 	intmax_t quot;
592fe8fb19SBen Gras 	intmax_t rem;
602fe8fb19SBen Gras } imaxdiv_t;
61f8804c02SErik van der Kouwe 
622fe8fb19SBen Gras imaxdiv_t	imaxdiv(intmax_t, intmax_t);
6384d9c625SLionel Sambuc 
6484d9c625SLionel Sambuc #if (_POSIX_C_SOURCE - 0) >= 200809L || defined(_NETBSD_SOURCE)
6584d9c625SLionel Sambuc #  ifndef __LOCALE_T_DECLARED
6684d9c625SLionel Sambuc typedef struct _locale		*locale_t;
6784d9c625SLionel Sambuc #  define __LOCALE_T_DECLARED
6884d9c625SLionel Sambuc #  endif
6984d9c625SLionel Sambuc intmax_t	strtoimax_l(const char * __restrict,
7084d9c625SLionel Sambuc 		    char ** __restrict, int, locale_t);
7184d9c625SLionel Sambuc uintmax_t	strtoumax_l(const char * __restrict,
7284d9c625SLionel Sambuc 		    char ** __restrict, int, locale_t);
7384d9c625SLionel Sambuc intmax_t	wcstoimax_l(const wchar_t * __restrict,
7484d9c625SLionel Sambuc 		    wchar_t ** __restrict, int, locale_t);
7584d9c625SLionel Sambuc uintmax_t	wcstoumax_l(const wchar_t * __restrict,
7684d9c625SLionel Sambuc 		    wchar_t ** __restrict, int, locale_t);
7784d9c625SLionel Sambuc #endif
78*0a6a1f1dSLionel Sambuc 
79*0a6a1f1dSLionel Sambuc 
80*0a6a1f1dSLionel Sambuc #if defined(_NETBSD_SOURCE)
81*0a6a1f1dSLionel Sambuc intmax_t	strtoi(const char * __restrict, char ** __restrict, int,
82*0a6a1f1dSLionel Sambuc 	               intmax_t, intmax_t, int *);
83*0a6a1f1dSLionel Sambuc uintmax_t	strtou(const char * __restrict, char ** __restrict, int,
84*0a6a1f1dSLionel Sambuc 	               uintmax_t, uintmax_t, int *);
85*0a6a1f1dSLionel Sambuc 
86*0a6a1f1dSLionel Sambuc /* i18n variations */
87*0a6a1f1dSLionel Sambuc intmax_t	strtoi_l(const char * __restrict, char ** __restrict, int,
88*0a6a1f1dSLionel Sambuc 	                 intmax_t, intmax_t, int *, locale_t);
89*0a6a1f1dSLionel Sambuc uintmax_t	strtou_l(const char * __restrict, char ** __restrict, int,
90*0a6a1f1dSLionel Sambuc 	                 uintmax_t, uintmax_t, int *, locale_t);
91*0a6a1f1dSLionel Sambuc #endif /* defined(_NETBSD_SOURCE) */
92*0a6a1f1dSLionel Sambuc 
932fe8fb19SBen Gras __END_DECLS
94f8804c02SErik van der Kouwe 
952fe8fb19SBen Gras #endif /* !_INTTYPES_H_ */
96