xref: /onnv-gate/usr/src/lib/libc/port/print/print.h (revision 1343:d478d112837a)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
50Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
60Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
70Sstevel@tonic-gate  * with the License.
80Sstevel@tonic-gate  *
90Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
100Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
110Sstevel@tonic-gate  * See the License for the specific language governing permissions
120Sstevel@tonic-gate  * and limitations under the License.
130Sstevel@tonic-gate  *
140Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
150Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
160Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
170Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
180Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
190Sstevel@tonic-gate  *
200Sstevel@tonic-gate  * CDDL HEADER END
210Sstevel@tonic-gate  */
22*1343Sraf 
230Sstevel@tonic-gate /*	Copyright (c) 1988 AT&T	*/
240Sstevel@tonic-gate /*	  All Rights Reserved  	*/
250Sstevel@tonic-gate 
260Sstevel@tonic-gate /*
27*1343Sraf  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
280Sstevel@tonic-gate  * Use is subject to license terms.
290Sstevel@tonic-gate  */
300Sstevel@tonic-gate 
310Sstevel@tonic-gate #ifndef	_PRINT_H
320Sstevel@tonic-gate #define	_PRINT_H
330Sstevel@tonic-gate 
340Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"	/* SVr4.0 1.9	*/
350Sstevel@tonic-gate 
360Sstevel@tonic-gate #include "file64.h"
370Sstevel@tonic-gate #include <floatingpoint.h>
380Sstevel@tonic-gate #include <thread.h>
390Sstevel@tonic-gate #include <synch.h>
400Sstevel@tonic-gate #include <stdio.h>
410Sstevel@tonic-gate #include "stdiom.h"
420Sstevel@tonic-gate 
430Sstevel@tonic-gate #ifdef	__cplusplus
440Sstevel@tonic-gate extern "C" {
450Sstevel@tonic-gate #endif
460Sstevel@tonic-gate 
470Sstevel@tonic-gate extern ssize_t
480Sstevel@tonic-gate _doprnt(const char *format, va_list in_args, FILE *iop);
490Sstevel@tonic-gate 
500Sstevel@tonic-gate extern ssize_t
510Sstevel@tonic-gate _ndoprnt(const char *format, va_list in_args, FILE *iop, int flag);
520Sstevel@tonic-gate 
530Sstevel@tonic-gate extern ssize_t
540Sstevel@tonic-gate _wndoprnt(const wchar_t *format, va_list in_args, FILE *iop, int flag);
550Sstevel@tonic-gate 
560Sstevel@tonic-gate extern void
570Sstevel@tonic-gate __aconvert(double arg, int ndigits, int *exp, int *sign, char *buf);
580Sstevel@tonic-gate 
590Sstevel@tonic-gate extern void
600Sstevel@tonic-gate __qaconvert(long double *arg, int ndigits, int *exp, int *sign, char *buf);
610Sstevel@tonic-gate 
620Sstevel@tonic-gate /* Maximum number of digits in any integer representation */
630Sstevel@tonic-gate #define	MAXDIGS 11
640Sstevel@tonic-gate 
650Sstevel@tonic-gate /* Maximum number of digits in any long long representation */
660Sstevel@tonic-gate #define	MAXLLDIGS 21
670Sstevel@tonic-gate 
680Sstevel@tonic-gate /* Maximum total number of digits in E format */
690Sstevel@tonic-gate #define	MAXECVT (DECIMAL_STRING_LENGTH-1)
700Sstevel@tonic-gate 
710Sstevel@tonic-gate /* Maximum number of digits after decimal point in F format */
720Sstevel@tonic-gate #define	MAXFCVT (DECIMAL_STRING_LENGTH-1)
730Sstevel@tonic-gate 
740Sstevel@tonic-gate /* Maximum significant figures in a floating-point number	*/
750Sstevel@tonic-gate /* DECIMAL_STRING_LENGTH in floatingpoint.h is max buffer size	*/
760Sstevel@tonic-gate #define	MAXFSIG (DECIMAL_STRING_LENGTH-1)
770Sstevel@tonic-gate 
780Sstevel@tonic-gate /* Maximum number of characters in an exponent */
790Sstevel@tonic-gate #define	MAXESIZ 7		/* Max for quadruple precision */
800Sstevel@tonic-gate 
810Sstevel@tonic-gate /* Maximum (positive) exponent */
820Sstevel@tonic-gate #define	MAXEXP 4950		/* Max for quadruple precision */
830Sstevel@tonic-gate 
840Sstevel@tonic-gate /* Number of hex digits in a fp type when normalized with a leading 1 */
850Sstevel@tonic-gate #define	HEXFP_SINGLE_DIG	7
860Sstevel@tonic-gate #define	HEXFP_DOUBLE_DIG	14
870Sstevel@tonic-gate #define	HEXFP_EXTENDED_DIG	17
880Sstevel@tonic-gate #define	HEXFP_QUAD_DIG		29
890Sstevel@tonic-gate 
900Sstevel@tonic-gate /* Data type for flags */
910Sstevel@tonic-gate typedef char bool;
920Sstevel@tonic-gate 
930Sstevel@tonic-gate /* Convert a digit character to the corresponding number */
940Sstevel@tonic-gate #define	tonumber(x) ((x)-'0')
950Sstevel@tonic-gate 
960Sstevel@tonic-gate /* Convert a number between 0 and 9 to the corresponding digit */
970Sstevel@tonic-gate #define	todigit(x) ((x)+'0')
980Sstevel@tonic-gate 
990Sstevel@tonic-gate /* Max and Min macros */
1000Sstevel@tonic-gate #define	max(a, b) ((a) > (b)? (a): (b))
1010Sstevel@tonic-gate #define	min(a, b) ((a) < (b)? (a): (b))
1020Sstevel@tonic-gate 
1030Sstevel@tonic-gate /* Max neg. long long */
1040Sstevel@tonic-gate #define	HIBITLL	(1ULL << 63)
1050Sstevel@tonic-gate 
1060Sstevel@tonic-gate #ifdef	__cplusplus
1070Sstevel@tonic-gate }
1080Sstevel@tonic-gate #endif
1090Sstevel@tonic-gate 
1100Sstevel@tonic-gate #endif	/* _PRINT_H */
111