138001Salex/*-
238001Salex * Copyright (c) 2001 Mike Barcroft <mike@FreeBSD.org>
338001Salex * All rights reserved.
438001Salex *
538001Salex * Redistribution and use in source and binary forms, with or without
638001Salex * modification, are permitted provided that the following conditions
738001Salex * are met:
838001Salex * 1. Redistributions of source code must retain the above copyright
938001Salex *    notice, this list of conditions and the following disclaimer.
1038001Salex * 2. Redistributions in binary form must reproduce the above copyright
1138001Salex *    notice, this list of conditions and the following disclaimer in the
1238001Salex *    documentation and/or other materials provided with the distribution.
1338001Salex *
1438001Salex * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1538001Salex * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1638001Salex * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1738001Salex * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
1838001Salex * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1938001Salex * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2038001Salex * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2138001Salex * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2238001Salex * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2338001Salex * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2438001Salex * SUCH DAMAGE.
2538001Salex *
2650473Speter * $FreeBSD$
2738001Salex */
2838001Salex
2938001Salex#ifndef _INTTYPES_H_
30103567Smike#define	_INTTYPES_H_
3138001Salex
32225801Sjkim#include <machine/_inttypes.h>
33225801Sjkim#include <sys/stdint.h>
34103567Smike
35103567Smike#ifndef	__cplusplus
36103567Smike#ifndef _WCHAR_T_DECLARED
37103567Smiketypedef	__wchar_t	wchar_t;
38103567Smike#define	_WCHAR_T_DECLARED
39103567Smike#endif
40103567Smike#endif
41103567Smike
42103567Smiketypedef struct {
43103567Smike	intmax_t	quot;		/* Quotient. */
44103567Smike	intmax_t	rem;		/* Remainder. */
4538001Salex} imaxdiv_t;
46225801Sjkim
47225801Sjkim__BEGIN_DECLS
4838051Sbde#ifdef _XLOCALE_H_
49#include <xlocale/_inttypes.h>
50#endif
51intmax_t	imaxabs(intmax_t) __pure2;
52imaxdiv_t	imaxdiv(intmax_t, intmax_t) __pure2;
53
54intmax_t	strtoimax(const char * __restrict, char ** __restrict, int);
55uintmax_t	strtoumax(const char * __restrict, char ** __restrict, int);
56intmax_t	wcstoimax(const wchar_t * __restrict,
57		    wchar_t ** __restrict, int);
58uintmax_t	wcstoumax(const wchar_t * __restrict,
59		    wchar_t ** __restrict, int);
60__END_DECLS
61
62#endif /* !_INTTYPES_H_ */
63