]> git.proxmox.com Git - mirror_edk2.git/blob - StdLib/LibC/gdtoa/gdtoa.h
Standard Libraries for EDK II.
[mirror_edk2.git] / StdLib / LibC / gdtoa / gdtoa.h
1 /* $NetBSD: gdtoa.h,v 1.6.4.1.4.1 2008/04/08 21:10:55 jdc Exp $ */
2
3 /****************************************************************
4
5 The author of this software is David M. Gay.
6
7 Copyright (C) 1998 by Lucent Technologies
8 All Rights Reserved
9
10 Permission to use, copy, modify, and distribute this software and
11 its documentation for any purpose and without fee is hereby
12 granted, provided that the above copyright notice appear in all
13 copies and that both that the copyright notice and this
14 permission notice and warranty disclaimer appear in supporting
15 documentation, and that the name of Lucent or any of its entities
16 not be used in advertising or publicity pertaining to
17 distribution of the software without specific, written prior
18 permission.
19
20 LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
21 INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
22 IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY
23 SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
24 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
25 IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
26 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
27 THIS SOFTWARE.
28
29 ****************************************************************/
30
31 /* Please send bug reports to David M. Gay (dmg at acm dot org,
32 * with " at " changed at "@" and " dot " changed to "."). */
33
34 #ifndef GDTOA_H_INCLUDED
35 #define GDTOA_H_INCLUDED
36 #include <LibConfig.h>
37
38 #include "arith.h"
39
40 #ifndef Long
41 #define Long EFI_LONG_T
42 #endif
43 #ifndef ULong
44 #define ULong EFI_ULONG_T
45 #endif
46 #ifndef UShort
47 #define UShort uint16_t
48 #endif
49
50 #ifndef ANSI
51 #define ANSI(x) x
52 #define Void void
53 #endif /* ANSI */
54
55 #ifndef CONST
56 #define CONST const
57 #endif /* CONST */
58
59 enum { /* return values from strtodg */
60 STRTOG_Zero = 0,
61 STRTOG_Normal = 1,
62 STRTOG_Denormal = 2,
63 STRTOG_Infinite = 3,
64 STRTOG_NaN = 4,
65 STRTOG_NaNbits = 5,
66 STRTOG_NoNumber = 6,
67 STRTOG_Retmask = 7,
68
69 /* The following may be or-ed into one of the above values. */
70
71 STRTOG_Neg = 0x08,
72 STRTOG_Inexlo = 0x10,
73 STRTOG_Inexhi = 0x20,
74 STRTOG_Inexact = 0x30,
75 STRTOG_Underflow= 0x40,
76 STRTOG_Overflow = 0x80,
77 STRTOG_NoMemory = 0x100
78 };
79
80 typedef struct
81 FPI {
82 int nbits;
83 int emin;
84 int emax;
85 int rounding;
86 int sudden_underflow;
87 } FPI;
88
89 enum { /* FPI.rounding values: same as FLT_ROUNDS */
90 FPI_Round_zero = 0,
91 FPI_Round_near = 1,
92 FPI_Round_up = 2,
93 FPI_Round_down = 3
94 };
95
96 #ifdef __cplusplus
97 extern "C" {
98 #endif
99
100 #define dtoa __dtoa
101 #define gdtoa __gdtoa
102 #define ldtoa __ldtoa
103 #define hldtoa __hldtoa
104 #define hdtoa __hdtoa
105 #define freedtoa __freedtoa
106 #define strtodg __strtodg_D2A
107 #define strtopQ __strtopQ_D2A
108 #define strtopx __strtopx_D2A
109 #define strtopxL __strtopxL_D2A
110 #define strtord __strtord_D2A
111
112 extern char* dtoa ANSI((double d, int mode, int ndigits, int *decpt,
113 int *sign, char **rve));
114 extern char* hdtoa ANSI((double d, const char *xdigs, int ndigits, int *decpt,
115 int *sign, char **rve));
116 extern char* ldtoa ANSI((long double *ld, int mode, int ndigits, int *decpt,
117 int *sign, char **rve));
118 extern char* hldtoa ANSI((long double e, const char *xdigs, int ndigits,
119 int *decpt, int *sign, char **rve));
120
121 extern char* gdtoa ANSI((FPI *fpi, int be, ULong *bits, int *kindp,
122 int mode, int ndigits, int *decpt, char **rve));
123 extern void freedtoa ANSI((char*));
124 extern float strtof ANSI((CONST char *, char **));
125 extern double strtod ANSI((CONST char *, char **));
126 extern int strtodg ANSI((CONST char*, char**, CONST FPI*, Long*, ULong*));
127
128 extern char* g_ddfmt ANSI((char*, double*, int, unsigned));
129 extern char* g_dfmt ANSI((char*, double*, int, unsigned));
130 extern char* g_ffmt ANSI((char*, float*, int, unsigned));
131 extern char* g_Qfmt ANSI((char*, void*, int, unsigned));
132 extern char* g_xfmt ANSI((char*, void*, int, unsigned));
133 extern char* g_xLfmt ANSI((char*, void*, int, unsigned));
134
135 extern int strtoId ANSI((CONST char*, char**, double*, double*));
136 extern int strtoIdd ANSI((CONST char*, char**, double*, double*));
137 extern int strtoIf ANSI((CONST char*, char**, float*, float*));
138 extern int strtoIQ ANSI((CONST char*, char**, void*, void*));
139 extern int strtoIx ANSI((CONST char*, char**, void*, void*));
140 extern int strtoIxL ANSI((CONST char*, char**, void*, void*));
141 extern int strtord ANSI((CONST char*, char**, int, double*));
142 extern int strtordd ANSI((CONST char*, char**, int, double*));
143 extern int strtorf ANSI((CONST char*, char**, int, float*));
144 extern int strtorQ ANSI((CONST char*, char**, int, void*));
145 extern int strtorx ANSI((CONST char*, char**, int, void*));
146 extern int strtorxL ANSI((CONST char*, char**, int, void*));
147
148 extern int strtodI ANSI((CONST char*, char**, double*));
149 extern int strtopd ANSI((CONST char*, char**, double*));
150 extern int strtopdd ANSI((CONST char*, char**, double*));
151 extern int strtopf ANSI((CONST char*, char**, float*));
152 extern int strtopQ ANSI((CONST char*, char**, void*));
153 extern int strtopx ANSI((CONST char*, char**, void*));
154 extern int strtopxL ANSI((CONST char*, char**, void*));
155
156 #ifdef __cplusplus
157 }
158 #endif
159 #endif /* GDTOA_H_INCLUDED */