3 * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
5 * This product is part of the Amsterdam Compiler Kit.
7 * Permission to use, sell, duplicate or disclose this software must be
8 * obtained in writing. Requests for such permissions may be sent to
10 * Dr. Andrew S. Tanenbaum
11 * Wiskundig Seminarium
19 /* Author: J.W. Stevenson */
27 #define assert(x) /* nothing */
31 #define HUGE_DIG DBL_MAX_10_EXP /* log10(maxreal) */
33 #define HUGE_DIG 400 /* log10(maxreal) */
35 #define PREC_DIG 80 /* the maximum digits returned by _fcvt() */
36 #define FILL_CHAR '0' /* char printed if all of _fcvt() used */
37 #define BUFSIZE HUGE_DIG + PREC_DIG + 3
39 _wrf(n
,w
,r
,f
) int n
,w
; double r
; struct file
*f
; {
40 char *p
,*b
; int s
,d
; char buf
[BUFSIZE
];
42 if ( n
< 0 || w
< 0) _trp(EWIDTH
);
47 assert(abs(d
) <= HUGE_DIG
);
54 *p
++ = (*b
? *b
++ : FILL_CHAR
);
64 *p
++ = (*b
? *b
++ : FILL_CHAR
);
65 assert(p
<= buf
+BUFSIZE
);
67 _wstrin(w
,(int)(p
-buf
),buf
,f
);