Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

229 lines
6.5 KiB

  1. /***
  2. *fltintrn.h - contains declarations of internal floating point types,
  3. * routines and variables
  4. *
  5. * Copyright (c) 1985-2001, Microsoft Corporation. All rights reserved.
  6. *
  7. *Purpose:
  8. * Declares floating point types, routines and variables used
  9. * internally by the C run-time.
  10. *
  11. * [Internal]
  12. *
  13. *Revision History:
  14. * 10-20-88 JCR Changed 'DOUBLE' to 'double' for 386
  15. * 08-15-89 GJF Fixed copyright, indents
  16. * 10-30-89 GJF Fixed copyright (again)
  17. * 03-02-90 GJF Added #ifndef _INC_STRUCT stuff. Also, cleaned up
  18. * the formatting a bit.
  19. * 03-05-90 GJF Fixed up the arg types in protoypes. Also, added
  20. * #include <cruntime.h>
  21. * 03-22-90 GJF Made _fltin(), _fltin2(), _fltout() and _fltout2()
  22. * _CALLTYPE2 (for now) and added a prototype for
  23. * _fptostr().
  24. * 08-01-90 SBM Moved _cftoe() and _cftof() here from internal.h
  25. * and _cfltcvt_tab from input.c and output.c,
  26. * added typedefs for _cfltcvt_tab entries,
  27. * renamed module from <struct.h> to <fltintrn.h> and
  28. * adjusted #ifndef stuff to #ifndef _INC_FLTINTRN
  29. * 08-29-90 SBM Changed type of _cfltcvt_tab[] to agree with
  30. * definition in cmiscdat.c
  31. * 04-26-91 SRW Removed level 3 warnings
  32. * 08-26-91 JCR Changed MIPS to _MIPS_, ANSI naming
  33. * 08-06-92 GJF Function calling type and variable type macros. Revised
  34. * use of target processor macros.
  35. * 11-09-92 GJF Fixed preprocessing conditionals for MIPS.
  36. * 01-09-93 SRW Remove usage of MIPS and ALPHA to conform to ANSI
  37. * Use _MIPS_ and _ALPHA_ instead.
  38. * 01-21-93 GJF Removed support for C6-386's _cdecl.
  39. * 04-06-93 SKS Replace _CRTAPI1/2 with __cdecl, _CRTVAR1 with nothing
  40. * 09-01-93 GJF Merged Cuda and NT SDK versions.
  41. * 10-13-93 GJF Dropped _MIPS_. Replaced _ALPHA_ with _M_ALPHA.
  42. * 10-29-93 GJF Disabled the ever-annoying 4069 warning.
  43. * 10-02-94 BWT Add PPC support.
  44. * 12-15-94 XY merged with mac header
  45. * 02-14-95 CFW Clean up Mac merge.
  46. * 03-29-95 CFW Add error message to internal headers.
  47. * 12-14-95 JWM Add "#pragma once".
  48. * 02-05-97 GJF Deleted obsolete support for _CRTAPI* and _NTSDK.
  49. * Replaced (defined(_M_MPPC) || defined(_M_M68K)) with
  50. * defined(_MAC) where appropriate. Replaced _CALLTYPE2
  51. * with __cdecl. Also, detab-ed.
  52. * 05-17-99 PML Remove all Macintosh support.
  53. * 09-05-00 GB Changed the defination of fltout functions. Use DOUBLE
  54. * instead of double
  55. *
  56. ****/
  57. #if _MSC_VER > 1000 /*IFSTRIP=IGN*/
  58. #pragma once
  59. #endif
  60. #ifndef _INC_FLTINTRN
  61. #define _INC_FLTINTRN
  62. #ifndef _CRTBLD
  63. /*
  64. * This is an internal C runtime header file. It is used when building
  65. * the C runtimes only. It is not to be used as a public header file.
  66. */
  67. #error ERROR: Use of C runtime library internal header file.
  68. #endif /* _CRTBLD */
  69. #ifdef __cplusplus
  70. extern "C" {
  71. #endif
  72. #include <cruntime.h>
  73. /* Define _CRTIMP */
  74. #ifndef _CRTIMP
  75. #ifdef CRTDLL
  76. #define _CRTIMP __declspec(dllexport)
  77. #else /* ndef CRTDLL */
  78. #ifdef _DLL
  79. #define _CRTIMP __declspec(dllimport)
  80. #else /* ndef _DLL */
  81. #define _CRTIMP
  82. #endif /* _DLL */
  83. #endif /* CRTDLL */
  84. #endif /* _CRTIMP */
  85. /* Define __cdecl for non-Microsoft compilers */
  86. #if ( !defined(_MSC_VER) && !defined(__cdecl) )
  87. #define __cdecl
  88. #endif
  89. /*
  90. * For MS C for the x86 family, disable the annoying "long double is the
  91. * same precision as double" warning
  92. */
  93. #ifdef _M_IX86
  94. #pragma warning(disable:4069)
  95. #endif
  96. /*
  97. * structs used to fool the compiler into not generating floating point
  98. * instructions when copying and pushing [long] double values
  99. */
  100. #ifndef DOUBLE
  101. typedef struct {
  102. double x;
  103. } DOUBLE;
  104. #endif
  105. #ifndef LONGDOUBLE
  106. typedef struct {
  107. #if defined(_M_MRX000) || defined(_M_ALPHA) || defined(_M_PPC)
  108. /*
  109. * No long double type for MIPS, ALPHA, PPC.
  110. */
  111. double x;
  112. #else
  113. /*
  114. * Assume there is a long double type
  115. */
  116. long double x;
  117. #endif
  118. } LONGDOUBLE;
  119. #endif
  120. /*
  121. * typedef for _fltout
  122. */
  123. typedef struct _strflt
  124. {
  125. int sign; /* zero if positive otherwise negative */
  126. int decpt; /* exponent of floating point number */
  127. int flag; /* zero if okay otherwise IEEE overflow */
  128. char *mantissa; /* pointer to mantissa in string form */
  129. }
  130. *STRFLT;
  131. /*
  132. * typedef for _fltin
  133. */
  134. typedef struct _flt
  135. {
  136. int flags;
  137. int nbytes; /* number of characters read */
  138. long lval;
  139. double dval; /* the returned floating point number */
  140. }
  141. *FLT;
  142. /* floating point conversion routines, keep in sync with mrt32\include\convert.h */
  143. char *_cftoe(double *, char *, int, int);
  144. char *_cftof(double *, char *, int);
  145. void __cdecl _fptostr(char *, int, STRFLT);
  146. #ifdef _MT
  147. STRFLT __cdecl _fltout2( DOUBLE, STRFLT, char * );
  148. FLT __cdecl _fltin2( FLT , const char *, int, int, int );
  149. #else
  150. STRFLT __cdecl _fltout( DOUBLE );
  151. FLT __cdecl _fltin( const char *, int, int, int );
  152. #endif
  153. /*
  154. * table of pointers to floating point helper routines
  155. *
  156. * We can't specify the prototypes for the entries of the table accurately,
  157. * since different functions in the table have different arglists.
  158. * So we declare the functions to take and return void (which is the
  159. * correct prototype for _fptrap(), which is what the entries are all
  160. * initialized to if no floating point is loaded) and cast appropriately
  161. * on every usage.
  162. */
  163. typedef void (* PFV)(void);
  164. extern PFV _cfltcvt_tab[6];
  165. typedef void (* PF0)(DOUBLE*, char*, int, int, int);
  166. #define _cfltcvt(a,b,c,d,e) (*((PF0)_cfltcvt_tab[0]))(a,b,c,d,e)
  167. typedef void (* PF1)(char*);
  168. #define _cropzeros(a) (*((PF1)_cfltcvt_tab[1]))(a)
  169. typedef void (* PF2)(int, char*, char*);
  170. #define _fassign(a,b,c) (*((PF2)_cfltcvt_tab[2]))(a,b,c)
  171. typedef void (* PF3)(char*);
  172. #define _forcdecpt(a) (*((PF3)_cfltcvt_tab[3]))(a)
  173. typedef int (* PF4)(DOUBLE*);
  174. #define _positive(a) (*((PF4)_cfltcvt_tab[4]))(a)
  175. typedef void (* PF5)(LONGDOUBLE*, char*, int, int, int);
  176. #define _cldcvt(a,b,c,d,e) (*((PF5)_cfltcvt_tab[5]))(a,b,c,d,e)
  177. #ifdef _M_IX86
  178. #pragma warning(default:4069)
  179. #endif
  180. #ifdef __cplusplus
  181. }
  182. #endif
  183. #endif /* _INC_FLTINTRN */