xref: /titanic_52/usr/src/lib/libc/port/print/print.h (revision bdfc6d18da790deeec2e0eb09c625902defe2498)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*	Copyright (c) 1988 AT&T	*/
23 /*	  All Rights Reserved  	*/
24 
25 
26 /*
27  * Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
28  * Use is subject to license terms.
29  */
30 
31 #ifndef	_PRINT_H
32 #define	_PRINT_H
33 
34 #pragma ident	"%Z%%M%	%I%	%E% SMI"	/* SVr4.0 1.9	*/
35 
36 #include "file64.h"
37 #include <floatingpoint.h>
38 #include <thread.h>
39 #include <synch.h>
40 #include <stdio.h>
41 #include "stdiom.h"
42 
43 #ifdef	__cplusplus
44 extern "C" {
45 #endif
46 
47 extern ssize_t
48 _doprnt(const char *format, va_list in_args, FILE *iop);
49 
50 extern ssize_t
51 _ndoprnt(const char *format, va_list in_args, FILE *iop, int flag);
52 
53 extern ssize_t
54 _wndoprnt(const wchar_t *format, va_list in_args, FILE *iop, int flag);
55 
56 extern ssize_t
57 _dostrfmon_unlocked(size_t limit_cnt, const char *format, \
58     va_list in_args, FILE *iop);
59 
60 extern void
61 __aconvert(double arg, int ndigits, int *exp, int *sign, char *buf);
62 
63 extern void
64 __qaconvert(long double *arg, int ndigits, int *exp, int *sign, char *buf);
65 
66 /* Maximum number of digits in any integer representation */
67 #define	MAXDIGS 11
68 
69 /* Maximum number of digits in any long long representation */
70 #define	MAXLLDIGS 21
71 
72 /* Maximum total number of digits in E format */
73 #define	MAXECVT (DECIMAL_STRING_LENGTH-1)
74 
75 /* Maximum number of digits after decimal point in F format */
76 #define	MAXFCVT (DECIMAL_STRING_LENGTH-1)
77 
78 /* Maximum significant figures in a floating-point number	*/
79 /* DECIMAL_STRING_LENGTH in floatingpoint.h is max buffer size	*/
80 #define	MAXFSIG (DECIMAL_STRING_LENGTH-1)
81 
82 /* Maximum number of characters in an exponent */
83 #define	MAXESIZ 7		/* Max for quadruple precision */
84 
85 /* Maximum (positive) exponent */
86 #define	MAXEXP 4950		/* Max for quadruple precision */
87 
88 /* Number of hex digits in a fp type when normalized with a leading 1 */
89 #define	HEXFP_SINGLE_DIG	7
90 #define	HEXFP_DOUBLE_DIG	14
91 #define	HEXFP_EXTENDED_DIG	17
92 #define	HEXFP_QUAD_DIG		29
93 
94 /* Data type for flags */
95 typedef char bool;
96 
97 /* Convert a digit character to the corresponding number */
98 #define	tonumber(x) ((x)-'0')
99 
100 /* Convert a number between 0 and 9 to the corresponding digit */
101 #define	todigit(x) ((x)+'0')
102 
103 /* Max and Min macros */
104 #define	max(a, b) ((a) > (b)? (a): (b))
105 #define	min(a, b) ((a) < (b)? (a): (b))
106 
107 /* Max neg. long long */
108 #define	HIBITLL	(1ULL << 63)
109 
110 #ifdef	__cplusplus
111 }
112 #endif
113 
114 #endif	/* _PRINT_H */
115