From 0d8578410c802d36dab182ec22e7d9b484f79446 Mon Sep 17 00:00:00 2001 From: dtrg Date: Fri, 27 Apr 2007 22:41:39 +0000 Subject: [PATCH] Cleaned up and enabled the support for conditionally emitting the floating-point stdio code. --- lang/cem/libcc.ansi/stdio/doprnt.c | 4 ++-- lang/cem/libcc.ansi/stdio/doscan.c | 8 ++++---- lang/cem/libcc.ansi/stdio/ecvt.c | 6 ++++-- lang/cem/libcc.ansi/stdio/fltpr.c | 5 +++-- lang/cem/libcc.ansi/stdio/loc_incl.h | 5 +++-- lang/cem/libcc.ansi/stdlib/ext_comp.c | 1 + lang/cem/libcc.ansi/stdlib/strtod.c | 4 ++++ 7 files changed, 21 insertions(+), 12 deletions(-) diff --git a/lang/cem/libcc.ansi/stdio/doprnt.c b/lang/cem/libcc.ansi/stdio/doprnt.c index 0a794eaf1..81714de47 100644 --- a/lang/cem/libcc.ansi/stdio/doprnt.c +++ b/lang/cem/libcc.ansi/stdio/doprnt.c @@ -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 *); diff --git a/lang/cem/libcc.ansi/stdio/doscan.c b/lang/cem/libcc.ansi/stdio/doscan.c index 914feb632..eb93a4029 100644 --- a/lang/cem/libcc.ansi/stdio/doscan.c +++ b/lang/cem/libcc.ansi/stdio/doscan.c @@ -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': diff --git a/lang/cem/libcc.ansi/stdio/ecvt.c b/lang/cem/libcc.ansi/stdio/ecvt.c index 31a702be7..9a15b5cde 100644 --- a/lang/cem/libcc.ansi/stdio/ecvt.c +++ b/lang/cem/libcc.ansi/stdio/ecvt.c @@ -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 */ diff --git a/lang/cem/libcc.ansi/stdio/fltpr.c b/lang/cem/libcc.ansi/stdio/fltpr.c index 622fd7943..ad8e16d46 100644 --- a/lang/cem/libcc.ansi/stdio/fltpr.c +++ b/lang/cem/libcc.ansi/stdio/fltpr.c @@ -3,11 +3,12 @@ */ /* $Id$ */ -#ifndef NOFLOAT #include #include #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 */ diff --git a/lang/cem/libcc.ansi/stdio/loc_incl.h b/lang/cem/libcc.ansi/stdio/loc_incl.h index 4d1daaae1..126a31faf 100644 --- a/lang/cem/libcc.ansi/stdio/loc_incl.h +++ b/lang/cem/libcc.ansi/stdio/loc_incl.h @@ -4,6 +4,7 @@ /* $Id$ */ #include +#include #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 */ diff --git a/lang/cem/libcc.ansi/stdlib/ext_comp.c b/lang/cem/libcc.ansi/stdlib/ext_comp.c index 41ee65dba..2133e64bd 100644 --- a/lang/cem/libcc.ansi/stdlib/ext_comp.c +++ b/lang/cem/libcc.ansi/stdlib/ext_comp.c @@ -15,6 +15,7 @@ #include #include #include +#include static int b64_add(struct mantissa *e1, struct mantissa *e2); static b64_sft(struct mantissa *e1, int n); diff --git a/lang/cem/libcc.ansi/stdlib/strtod.c b/lang/cem/libcc.ansi/stdlib/strtod.c index c12361ce7..222a744b9 100644 --- a/lang/cem/libcc.ansi/stdlib/strtod.c +++ b/lang/cem/libcc.ansi/stdlib/strtod.c @@ -3,6 +3,8 @@ #include #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