1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27:
28:
29: 30:
31:
32: #ifndef GDTOA_H_INCLUDED
33: #define GDTOA_H_INCLUDED
34:
35: #include "arith.h"
36: #include <stddef.h>
37:
38: #ifndef Long
39: #define Long int
40: #endif
41: #ifndef ULong
42: typedef unsigned Long ULong;
43: #endif
44: #ifndef UShort
45: typedef unsigned short UShort;
46: #endif
47:
48: #ifndef ANSI
49: #ifdef KR_headers
50: #define ANSI(x) ()
51: #define Void
52: #else
53: #define ANSI(x) x
54: #define Void void
55: #endif
56: #endif
57:
58: #ifndef CONST
59: #ifdef KR_headers
60: #define CONST
61: #else
62: #define CONST const
63: #endif
64: #endif
65:
66: enum {
67: STRTOG_Zero = 0x000,
68: STRTOG_Normal = 0x001,
69: STRTOG_Denormal = 0x002,
70: STRTOG_Infinite = 0x003,
71: STRTOG_NaN = 0x004,
72: STRTOG_NaNbits = 0x005,
73: STRTOG_NoNumber = 0x006,
74: STRTOG_NoMemory = 0x007,
75: STRTOG_Retmask = 0x00f,
76:
77:
78:
79: STRTOG_Inexlo = 0x010,
80: STRTOG_Inexhi = 0x020,
81: STRTOG_Inexact = 0x030,
82: STRTOG_Underflow= 0x040,
83: STRTOG_Overflow = 0x080,
84: STRTOG_Neg = 0x100
85: };
86:
87: typedef struct
88: FPI {
89: int nbits;
90: int emin;
91: int emax;
92: int rounding;
93: int sudden_underflow;
94: } FPI;
95:
96: enum {
97: FPI_Round_zero = 0,
98: FPI_Round_near = 1,
99: FPI_Round_up = 2,
100: FPI_Round_down = 3
101: };
102:
103: #ifdef __cplusplus
104: extern "C" {
105: #endif
106:
107: extern char* __dtoa ANSI((double d, int mode, int ndigits, int *decpt,
108: int *sign, char **rve));
109: extern char* __gdtoa ANSI((FPI *fpi, int be, ULong *bits, int *kindp,
110: int mode, int ndigits, int *decpt, char **rve));
111: extern void __freedtoa ANSI((char*));
112: extern float strtof ANSI((CONST char *, char **));
113: extern double strtod ANSI((CONST char *, char **));
114: extern int __strtodg ANSI((CONST char*, char**, FPI*, Long*, ULong*));
115:
116: extern char* __g_ddfmt ANSI((char*, double*, int, size_t));
117: extern char* __g_dfmt ANSI((char*, double*, int, size_t));
118: extern char* __g_ffmt ANSI((char*, float*, int, size_t));
119: extern char* __g_Qfmt ANSI((char*, void*, int, size_t));
120: extern char* __g_xfmt ANSI((char*, void*, int, size_t));
121: extern char* __g_xLfmt ANSI((char*, void*, int, size_t));
122:
123: extern int __strtoId ANSI((CONST char*, char**, double*, double*));
124: extern int __strtoIdd ANSI((CONST char*, char**, double*, double*));
125: extern int __strtoIf ANSI((CONST char*, char**, float*, float*));
126: extern int __strtoIQ ANSI((CONST char*, char**, void*, void*));
127: extern int __strtoIx ANSI((CONST char*, char**, void*, void*));
128: extern int __strtoIxL ANSI((CONST char*, char**, void*, void*));
129: extern int __strtord ANSI((CONST char*, char**, int, double*));
130: extern int __strtordd ANSI((CONST char*, char**, int, double*));
131: extern int __strtorf ANSI((CONST char*, char**, int, float*));
132: extern int __strtorQ ANSI((CONST char*, char**, int, void*));
133: extern int __strtorx ANSI((CONST char*, char**, int, void*));
134: extern int __strtorxL ANSI((CONST char*, char**, int, void*));
135: #if 1
136: extern int __strtodI ANSI((CONST char*, char**, double*));
137: extern int __strtopd ANSI((CONST char*, char**, double*));
138: extern int __strtopdd ANSI((CONST char*, char**, double*));
139: extern int __strtopf ANSI((CONST char*, char**, float*));
140: extern int __strtopQ ANSI((CONST char*, char**, void*));
141: extern int __strtopx ANSI((CONST char*, char**, void*));
142: extern int __strtopxL ANSI((CONST char*, char**, void*));
143: #else
144: #define __strtopd(s,se,x) strtord(s,se,1,x)
145: #define __strtopdd(s,se,x) strtordd(s,se,1,x)
146: #define __strtopf(s,se,x) strtorf(s,se,1,x)
147: #define __strtopQ(s,se,x) strtorQ(s,se,1,x)
148: #define __strtopx(s,se,x) strtorx(s,se,1,x)
149: #define __strtopxL(s,se,x) strtorxL(s,se,1,x)
150: #endif
151:
152: #ifdef __cplusplus
153: }
154: #endif
155: #endif