home *** CD-ROM | disk | FTP | other *** search
/ ftp.uni-stuttgart.de/pub/systems/acorn/ / Acorn.tar / Acorn / acornet / dev / c / gcc / g++lib.spk / h / ioprivate < prev    next >
Text File  |  1993-12-08  |  2KB  |  73 lines

  1. //    This is part of the iostream library, providing -*- C++ -*- input/output.
  2. //    Copyright (C) 1991 Per Bothner.
  3. //
  4. //    This library is free software; you can redistribute it and/or
  5. //    modify it under the terms of the GNU Library General Public
  6. //    License as published by the Free Software Foundation; either
  7. //    version 2 of the License, or (at your option) any later version.
  8. //
  9. //    This library is distributed in the hope that it will be useful,
  10. //    but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  12. //    Library General Public License for more details.
  13. //
  14. //    You should have received a copy of the GNU Library General Public
  15. //    License along with this library; if not, write to the Free
  16. //    Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  17.  
  18. extern "C"
  19.   {
  20.   #include <stddef.h>
  21.   #include <stdlib.h>
  22.   #include <string.h>
  23.   #include <unistd.h>
  24.   }
  25. #include "streambuf.h"
  26.  
  27. extern "C"
  28.   {
  29.   #include <stdarg.h>
  30.   #include <stddef.h>
  31.   }
  32.  
  33.  
  34. #define _fstat(x, y) fstat(x,y)
  35. #define _isatty(fd) isatty(fd)
  36.  
  37. extern int __cvt_double(double number, register int prec, int flags,
  38.             int *signp, int fmtch, char *startp, char *endp);
  39.  
  40. /*#define USE_MALLOC_BUF*/
  41.  
  42. #ifndef USE_MALLOC_BUF
  43. #define ALLOC_BUF(size) new char[size]
  44. #define FREE_BUF(ptr) delete [] (ptr)
  45. #else
  46. #define ALLOC_BUF(size) (char*)malloc(size)
  47. #define FREE_BUF(ptr) free(ptr)
  48. #endif
  49.  
  50. #define USE_DTOA
  51.  
  52. // Advantages:
  53. // - Input gets closest value
  54. // - Output emits string that when read yields identical value.
  55. // - Handles Infinity and NaNs (but not re-readable).
  56. // Disadvantages of dtoa:
  57. // - May not work for all double formats.
  58. // - Big chunck of code.
  59. // - Not reentrant - uses atatic variables freelist,
  60. //   result, result_k in dtoa
  61. //   (plus initializes p5s, HOWORD, and LOWORD).
  62.  
  63. #ifdef USE_DTOA
  64. extern "C" double _Xstrtod(const char *s00, char **se);
  65. #define strtod(s, e) _Xstrtod(s, e)
  66. extern "C" char *dtoa(double d, int mode, int ndigits,
  67.                         int *decpt, int *sign, char **rve);
  68. extern int __outfloat(double value, streambuf *sb, char mode,
  69.            int width, int precision, __fmtflags flags,
  70.            char sign_mode, char fill);
  71. #endif
  72.  
  73.