1 --- gdtoaimp.h.orig 2007-10-04 15:00:21.000000000 -0700
2 +++ gdtoaimp.h 2007-10-04 15:35:46.000000000 -0700
5 #ifndef GDTOAIMP_H_INCLUDED
6 #define GDTOAIMP_H_INCLUDED
12 #define Bug(x) {fprintf(stderr, "%s\n", x); exit(1);}
18 +#include "libc_private.h"
19 +#include "spinlock.h"
31 #undef Avoid_Underflow
35 #else /* ifndef Bad_float_h */
37 +/* force the correct definition of FLT_ROUNDS */
38 +extern int __fegetfltrounds( void );
40 +#define FLT_ROUNDS (__fegetfltrounds ())
41 #endif /* Bad_float_h */
48 -#ifndef MULTIPLE_THREADS
49 -#define ACQUIRE_DTOA_LOCK(n) /*nothing*/
50 -#define FREE_DTOA_LOCK(n) /*nothing*/
52 +#define MULTIPLE_THREADS
53 +extern spinlock_t __gdtoa_locks[2];
54 +#define ACQUIRE_DTOA_LOCK(n) do { \
56 + _SPINLOCK(&__gdtoa_locks[n]); \
58 +#define FREE_DTOA_LOCK(n) do { \
60 + _SPINUNLOCK(&__gdtoa_locks[n]); \
66 #define Bcopy(x,y) memcpy(&x->sign,&y->sign,y->wds*sizeof(ULong) + 2*sizeof(int))
67 #endif /* NO_STRING_H */
69 -#define Balloc Balloc_D2A
70 -#define Bfree Bfree_D2A
71 -#define ULtoQ ULtoQ_D2A
72 -#define ULtof ULtof_D2A
73 -#define ULtod ULtod_D2A
74 -#define ULtodd ULtodd_D2A
75 -#define ULtox ULtox_D2A
76 -#define ULtoxL ULtoxL_D2A
77 -#define any_on any_on_D2A
79 -#define bigtens bigtens_D2A
81 -#define copybits copybits_D2A
83 -#define decrement decrement_D2A
84 -#define diff diff_D2A
85 -#define dtoa_result dtoa_result_D2A
86 -#define g__fmt g__fmt_D2A
87 -#define gethex gethex_D2A
88 -#define hexdig hexdig_D2A
89 -#define hexnan hexnan_D2A
90 -#define hi0bits(x) hi0bits_D2A((ULong)(x))
92 -#define increment increment_D2A
93 -#define lo0bits lo0bits_D2A
94 -#define lshift lshift_D2A
95 -#define match match_D2A
96 -#define mult mult_D2A
97 -#define multadd multadd_D2A
98 -#define nrv_alloc nrv_alloc_D2A
99 -#define pow5mult pow5mult_D2A
100 -#define quorem quorem_D2A
101 -#define ratio ratio_D2A
102 -#define rshift rshift_D2A
103 -#define rv_alloc rv_alloc_D2A
105 -#define set_ones set_ones_D2A
106 -#define strcp strcp_D2A
107 -#define strtoIg strtoIg_D2A
109 -#define tens tens_D2A
110 -#define tinytens tinytens_D2A
111 -#define tinytens tinytens_D2A
112 -#define trailz trailz_D2A
115 + * Paranoia: Protect exported symbols, including ones in files we don't
116 + * compile right now. The standard strtof and strtod survive.
119 +#define gdtoa __gdtoa
120 +#define freedtoa __freedtoa
121 +#define strtodg __strtodg
122 +#define g_ddfmt __g_ddfmt
123 +#define g_dfmt __g_dfmt
124 +#define g_ffmt __g_ffmt
125 +#define g_Qfmt __g_Qfmt
126 +#define g_xfmt __g_xfmt
127 +#define g_xLfmt __g_xLfmt
128 +#define strtoId __strtoId
129 +#define strtoIdd __strtoIdd
130 +#define strtoIf __strtoIf
131 +#define strtoIQ __strtoIQ
132 +#define strtoIx __strtoIx
133 +#define strtoIxL __strtoIxL
134 +#define strtord __strtord
135 +#define strtordd __strtordd
136 +#define strtorf __strtorf
137 +#define strtorQ __strtorQ
138 +#define strtorx __strtorx
139 +#define strtorxL __strtorxL
140 +#define strtodI __strtodI
141 +#define strtopd __strtopd
142 +#define strtopdd __strtopdd
143 +#define strtopf __strtopf
144 +#define strtopQ __strtopQ
145 +#define strtopx __strtopx
146 +#define strtopxL __strtopxL
148 +/* Protect gdtoa-internal symbols */
149 +#define Balloc __Balloc_D2A
150 +#define Bfree __Bfree_D2A
151 +#define ULtoQ __ULtoQ_D2A
152 +#define ULtof __ULtof_D2A
153 +#define ULtod __ULtod_D2A
154 +#define ULtodd __ULtodd_D2A
155 +#define ULtox __ULtox_D2A
156 +#define ULtoxL __ULtoxL_D2A
157 +#define any_on __any_on_D2A
158 +#define b2d __b2d_D2A
159 +#define bigtens __bigtens_D2A
160 +#define cmp __cmp_D2A
161 +#define copybits __copybits_D2A
162 +#define d2b __d2b_D2A
163 +#define decrement __decrement_D2A
164 +#define diff __diff_D2A
165 +#define dtoa_result __dtoa_result_D2A
166 +#define g__fmt __g__fmt_D2A
167 +#define gethex __gethex_D2A
168 +#define hexdig __hexdig_D2A
169 +#define hexdig_init_D2A __hexdig_init_D2A
170 +#define hexnan __hexnan_D2A
171 +#define hi0bits __hi0bits_D2A
172 +#define hi0bits_D2A __hi0bits_D2A
173 +#define i2b __i2b_D2A
174 +#define increment __increment_D2A
175 +#define lo0bits __lo0bits_D2A
176 +#define lshift __lshift_D2A
177 +#define match __match_D2A
178 +#define mult __mult_D2A
179 +#define multadd __multadd_D2A
180 +#define nrv_alloc __nrv_alloc_D2A
181 +#define pow5mult __pow5mult_D2A
182 +#define quorem __quorem_D2A
183 +#define ratio __ratio_D2A
184 +#define rshift __rshift_D2A
185 +#define rv_alloc __rv_alloc_D2A
186 +#define s2b __s2b_D2A
187 +#define set_ones __set_ones_D2A
188 +#define strcp __strcp_D2A
189 +#define strcp_D2A __strcp_D2A
190 +#define strtoIg __strtoIg_D2A
191 +#define sum __sum_D2A
192 +#define tens __tens_D2A
193 +#define tinytens __tinytens_D2A
194 +#define tinytens __tinytens_D2A
195 +#define trailz __trailz_D2A
196 +#define ulp __ulp_D2A
198 extern char *dtoa_result;
199 extern CONST double bigtens[], tens[], tinytens[];
201 extern Bigint *diff ANSI((Bigint*, Bigint*));
202 extern char *dtoa ANSI((double d, int mode, int ndigits,
203 int *decpt, int *sign, char **rve));
204 + extern void freedtoa ANSI((char*));
205 + extern char *gdtoa ANSI((FPI *fpi, int be, ULong *bits, int *kindp,
206 + int mode, int ndigits, int *decpt, char **rve));
207 extern char *g__fmt ANSI((char*, char*, char*, int, ULong));
208 - extern int gethex ANSI((CONST char**, FPI*, Long*, Bigint**, int));
209 + extern int gethex ANSI((CONST char**, FPI*, Long*, Bigint**, int, locale_t));
210 extern void hexdig_init_D2A(Void);
211 extern int hexnan ANSI((CONST char**, FPI*, ULong*));
212 extern int hi0bits_D2A ANSI((ULong));
213 @@ -560,11 +618,32 @@
214 extern double ratio ANSI((Bigint*, Bigint*));
215 extern void rshift ANSI((Bigint*, int));
216 extern char *rv_alloc ANSI((int));
217 - extern Bigint *s2b ANSI((CONST char*, int, int, ULong));
218 + extern Bigint *s2b ANSI((CONST char*, int, int, ULong, int));
219 extern Bigint *set_ones ANSI((Bigint*, int));
220 extern char *strcp ANSI((char*, const char*));
221 + extern int strtodg ANSI((CONST char*, char**, FPI*, Long*, ULong*, locale_t)) __DARWIN_ALIAS(strtodg);
223 + extern int strtoId ANSI((CONST char *, char **, double *, double *));
224 + extern int strtoIdd ANSI((CONST char *, char **, double *, double *));
225 + extern int strtoIf ANSI((CONST char *, char **, float *, float *));
226 extern int strtoIg ANSI((CONST char*, char**, FPI*, Long*, Bigint**, int*));
227 + extern int strtoIQ ANSI((CONST char *, char **, void *, void *));
228 + extern int strtoIx ANSI((CONST char *, char **, void *, void *));
229 + extern int strtoIxL ANSI((CONST char *, char **, void *, void *));
230 extern double strtod ANSI((const char *s00, char **se));
231 + extern double strtod_l ANSI((const char *s00, char **se, locale_t));
232 + extern int strtopQ ANSI((CONST char *, char **, Void *));
233 + extern int strtopf ANSI((CONST char *, char **, float *));
234 + extern int strtopd ANSI((CONST char *, char **, double *));
235 + extern int strtopdd ANSI((CONST char *, char **, double *, locale_t));
236 + extern int strtopx ANSI((CONST char *, char **, Void *, locale_t));
237 + extern int strtopxL ANSI((CONST char *, char **, Void *));
238 + extern int strtord ANSI((CONST char *, char **, int, double *));
239 + extern int strtordd ANSI((CONST char *, char **, int, double *));
240 + extern int strtorf ANSI((CONST char *, char **, int, float *));
241 + extern int strtorQ ANSI((CONST char *, char **, int, void *));
242 + extern int strtorx ANSI((CONST char *, char **, int, void *));
243 + extern int strtorxL ANSI((CONST char *, char **, int, void *));
244 extern Bigint *sum ANSI((Bigint*, Bigint*));
245 extern int trailz ANSI((Bigint*));
246 extern double ulp ANSI((double));