Cleaned up and enabled the support for conditionally emitting the floating-point stdio code.

This commit is contained in:
dtrg 2007-04-27 22:41:39 +00:00
parent 7f266d6b4e
commit 0d8578410c
7 changed files with 21 additions and 12 deletions

View file

@ -232,7 +232,7 @@ _doprnt(register const char *fmt, va_list ap, FILE *stream)
case 'c':
*s++ = va_arg(ap, int);
break;
#ifndef NOFLOAT
#ifndef ACKCONF_NO_STDIO_FLOAT
case 'G':
case 'g':
if ((flags & FL_PRECSPEC) && (precision == 0))
@ -249,7 +249,7 @@ _doprnt(register const char *fmt, va_list ap, FILE *stream)
flags |= FL_SIGNEDCONV;
s = _f_print(&ap, flags, s, c, precision);
break;
#endif /* NOFLOAT */
#endif /* ACKCONF_NO_STDIO_FLOAT */
case 'r':
ap = va_arg(ap, va_list);
fmt = va_arg(ap, char *);

View file

@ -88,7 +88,7 @@ o_collect(register int c, register FILE *stream, char type,
return bufp - 1;
}
#ifndef NOFLOAT
#ifndef ACKCONF_NO_STDIO_FLOAT
/* The function f_collect() reads a string that has the format of a
* floating-point number. The function returns as soon as a format-error
* is encountered, leaving the offending character in the input. This means
@ -158,7 +158,7 @@ f_collect(register int c, register FILE *stream, register int width)
*bufp = '\0';
return bufp - 1;
}
#endif /* NOFLOAT */
#endif /* ACKCONF_NO_STDIO_FLOAT */
/*
@ -180,7 +180,7 @@ _doscan(register FILE *stream, const char *format, va_list ap)
int reverse; /* reverse the checking in [...] */
int kind;
register int ic; /* the input character */
#ifndef NOFLOAT
#ifndef ACKCONF_NO_STDIO_FLOAT
long double ld_val;
#endif
@ -406,7 +406,7 @@ _doscan(register FILE *stream, const char *format, va_list ap)
*str = '\0';
}
break;
#ifndef NOFLOAT
#ifndef ACKCONF_NO_STDIO_FLOAT
case 'e':
case 'E':
case 'f':

View file

@ -1,6 +1,8 @@
/* $Id$ */
#ifndef NOFLOAT
#include "loc_incl.h"
#ifndef ACKCONF_NO_STDIO_FLOAT
#include "../stdlib/ext_fmt.h"
void _dbl_ext_cvt(double value, struct EXTEND *e);
@ -28,4 +30,4 @@ _fcvt(long double value, int ndigit, int *decpt, int *sign)
return cvt(value, ndigit, decpt, sign, 0);
}
#endif /* NOFLOAT */
#endif /* ACKCONF_NO_STDIO_FLOAT */

View file

@ -3,11 +3,12 @@
*/
/* $Id$ */
#ifndef NOFLOAT
#include <string.h>
#include <stdarg.h>
#include "loc_incl.h"
#ifndef ACKCONF_NO_STDIO_FLOAT
static char *
_pfloat(long double r, register char *s, int n, int flags)
{
@ -175,4 +176,4 @@ _f_print(va_list *ap, int flags, char *s, char c, int precision)
}
return s;
}
#endif /* NOFLOAT */
#endif /* ACKCONF_NO_STDIO_FLOAT */

View file

@ -4,6 +4,7 @@
/* $Id$ */
#include <stdio.h>
#include <ack/config.h>
#define fileno(p) ((p)->_fd)
#define io_testflag(p,x) ((p)->_flags & (x))
@ -18,10 +19,10 @@ void __cleanup(void);
FILE *popen(const char *command, const char *type);
FILE *fdopen(int fd, const char *mode);
#ifndef NOFLOAT
#ifndef ACKCONF_NO_STDIO_FLOAT
char *_ecvt(long double value, int ndigit, int *decpt, int *sign);
char *_fcvt(long double value, int ndigit, int *decpt, int *sign);
#endif /* NOFLOAT */
#endif /* ACKCONF_NO_STDIO_FLOAT */
#define FL_LJUST 0x0001 /* left-justify field */
#define FL_SIGN 0x0002 /* sign in signed conversions */

View file

@ -15,6 +15,7 @@
#include <float.h>
#include <errno.h>
#include <ctype.h>
#include <ack/config.h>
static int b64_add(struct mantissa *e1, struct mantissa *e2);
static b64_sft(struct mantissa *e1, int n);

View file

@ -3,6 +3,8 @@
#include <stdlib.h>
#include "ext_fmt.h"
#ifndef ACKCONF_NO_STDIO_FLOAT
void _str_ext_cvt(const char *s, char **ss, struct EXTEND *e);
double _ext_dbl_cvt(struct EXTEND *e);
@ -14,3 +16,5 @@ strtod(const char *p, char **pp)
_str_ext_cvt(p, pp, &e);
return _ext_dbl_cvt(&e);
}
#endif