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

View file

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

View file

@ -1,6 +1,8 @@
/* $Id$ */ /* $Id$ */
#ifndef NOFLOAT #include "loc_incl.h"
#ifndef ACKCONF_NO_STDIO_FLOAT
#include "../stdlib/ext_fmt.h" #include "../stdlib/ext_fmt.h"
void _dbl_ext_cvt(double value, struct EXTEND *e); 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); return cvt(value, ndigit, decpt, sign, 0);
} }
#endif /* NOFLOAT */ #endif /* ACKCONF_NO_STDIO_FLOAT */

View file

@ -3,11 +3,12 @@
*/ */
/* $Id$ */ /* $Id$ */
#ifndef NOFLOAT
#include <string.h> #include <string.h>
#include <stdarg.h> #include <stdarg.h>
#include "loc_incl.h" #include "loc_incl.h"
#ifndef ACKCONF_NO_STDIO_FLOAT
static char * static char *
_pfloat(long double r, register char *s, int n, int flags) _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; return s;
} }
#endif /* NOFLOAT */ #endif /* ACKCONF_NO_STDIO_FLOAT */

View file

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

View file

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

View file

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