home *** CD-ROM | disk | FTP | other *** search
/ Team Palmtops 7 / Palmtops_numero07.iso / WinCE / SDKWindowsCE / AutoPC / apcsdk10.exe / data1.cab / Emulation_Include_Files / fpieee.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-05-13  |  5.1 KB  |  285 lines

  1. /***
  2. *fpieee.h - definitions/declarations for handling floating point exceptions
  3. *
  4. *    Copyright (c) 1985-1997, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. *    This file contains constant and type definitions for handling
  8. *    floating point exceptions [ANSI/IEEE std. 754]
  9. *
  10. ****/
  11.  
  12. #ifndef _INC_FPIEEE
  13. #define _INC_FPIEEE
  14.  
  15. #if !defined(_WIN32) && !defined(_MAC)
  16. #error ERROR: Only Mac or Win32 targets supported!
  17. #endif
  18.  
  19.  
  20. #ifndef __assembler    /* MIPS ONLY: Protect from assembler */
  21.  
  22. #ifdef    _MSC_VER
  23. /*
  24.  * Currently, all MS C compilers for Win32 platforms default to 8 byte
  25.  * alignment.
  26.  */
  27. #pragma pack(push,8)
  28. #endif    /* _MSC_VER */
  29.  
  30. #ifdef __cplusplus
  31. extern "C" {
  32. #endif
  33.  
  34.  
  35. /* Define _CRTAPI1 (for compatibility with the NT SDK) */
  36.  
  37. #ifndef _CRTAPI1
  38. #if    _MSC_VER >= 800 && _M_IX86 >= 300
  39. #define _CRTAPI1 __cdecl
  40. #else
  41. #define _CRTAPI1
  42. #endif
  43. #endif
  44.  
  45.  
  46. /* Define _CRTAPI2 (for compatibility with the NT SDK) */
  47.  
  48. #ifndef _CRTAPI2
  49. #if    _MSC_VER >= 800 && _M_IX86 >= 300
  50. #define _CRTAPI2 __cdecl
  51. #else
  52. #define _CRTAPI2
  53. #endif
  54. #endif
  55.  
  56.  
  57. /* Define _CRTIMP */
  58.  
  59. #ifndef _CRTIMP
  60. #ifdef    _NTSDK
  61. /* definition compatible with NT SDK */
  62. #define _CRTIMP
  63. #else    /* ndef _NTSDK */
  64. /* current definition */
  65. #ifdef    _DLL
  66. #define _CRTIMP __declspec(dllimport)
  67. #else    /* ndef _DLL */
  68. #define _CRTIMP
  69. #endif    /* _DLL */
  70. #endif    /* _NTSDK */
  71. #endif    /* _CRTIMP */
  72.  
  73.  
  74. /* Define __cdecl for non-Microsoft compilers */
  75.  
  76. #if    ( !defined(_MSC_VER) && !defined(__cdecl) )
  77. #define __cdecl
  78. #endif
  79.  
  80. /*
  81.  * Define floating point IEEE compare result values.
  82.  */
  83.  
  84. typedef enum {
  85.     _FpCompareEqual,
  86.     _FpCompareGreater,
  87.     _FpCompareLess,
  88.     _FpCompareUnordered
  89. } _FPIEEE_COMPARE_RESULT;
  90.  
  91. /*
  92.  * Define floating point format and result precision values.
  93.  */
  94.  
  95. typedef enum {
  96.     _FpFormatFp32,
  97.     _FpFormatFp64,
  98.     _FpFormatFp80,
  99.     _FpFormatFp128,
  100.     _FpFormatI16,
  101.     _FpFormatI32,
  102.     _FpFormatI64,
  103.     _FpFormatU16,
  104.     _FpFormatU32,
  105.     _FpFormatU64,
  106.     _FpFormatBcd80,
  107.     _FpFormatCompare,
  108.     _FpFormatString
  109. } _FPIEEE_FORMAT;
  110.  
  111. /*
  112.  * Define operation code values.
  113.  */
  114.  
  115. typedef enum {
  116.     _FpCodeUnspecified,
  117.     _FpCodeAdd,
  118.     _FpCodeSubtract,
  119.     _FpCodeMultiply,
  120.     _FpCodeDivide,
  121.     _FpCodeSquareRoot,
  122.     _FpCodeRemainder,
  123.     _FpCodeCompare,
  124.     _FpCodeConvert,
  125.     _FpCodeRound,
  126.     _FpCodeTruncate,
  127.     _FpCodeFloor,
  128.     _FpCodeCeil,
  129.     _FpCodeAcos,
  130.     _FpCodeAsin,
  131.     _FpCodeAtan,
  132.     _FpCodeAtan2,
  133.     _FpCodeCabs,
  134.     _FpCodeCos,
  135.     _FpCodeCosh,
  136.     _FpCodeExp,
  137.     _FpCodeFabs,
  138.     _FpCodeFmod,
  139.     _FpCodeFrexp,
  140.     _FpCodeHypot,
  141.     _FpCodeLdexp,
  142.     _FpCodeLog,
  143.     _FpCodeLog10,
  144.     _FpCodeModf,
  145.     _FpCodePow,
  146.     _FpCodeSin,
  147.     _FpCodeSinh,
  148.     _FpCodeTan,
  149.     _FpCodeTanh,
  150.     _FpCodeY0,
  151.     _FpCodeY1,
  152.     _FpCodeYn,
  153.     _FpCodeLogb,
  154.     _FpCodeNextafter,
  155.     _FpCodeNegate
  156.  
  157. } _FP_OPERATION_CODE;
  158.  
  159. #endif    /* #ifndef __assembler */
  160.  
  161. /*
  162.  * Define rounding modes.
  163.  */
  164.  
  165. #ifndef __assembler    /* MIPS ONLY: Protect from assembler */
  166.  
  167. typedef enum {
  168.     _FpRoundNearest,
  169.     _FpRoundMinusInfinity,
  170.     _FpRoundPlusInfinity,
  171.     _FpRoundChopped
  172. } _FPIEEE_ROUNDING_MODE;
  173.  
  174. typedef enum {
  175.     _FpPrecisionFull,
  176.     _FpPrecision53,
  177.     _FpPrecision24
  178. } _FPIEEE_PRECISION;
  179.  
  180.  
  181. /*
  182.  * Define floating point context record
  183.  */
  184.  
  185. typedef float        _FP32;
  186. typedef double        _FP64;
  187. typedef short        _I16;
  188. typedef int        _I32;
  189. typedef unsigned short    _U16;
  190. typedef unsigned int    _U32;
  191.  
  192.  
  193. typedef struct {
  194.     unsigned short W[5];
  195. } _FP80;
  196.  
  197. typedef struct {
  198.     unsigned long W[4];
  199. } _FP128;
  200.  
  201. typedef struct {
  202.     unsigned long W[2];
  203. } _I64;
  204.  
  205. typedef struct {
  206.     unsigned long W[2];
  207. } _U64;
  208.  
  209. typedef struct {
  210.     unsigned short W[5];
  211. } _BCD80;
  212.  
  213.  
  214. typedef struct {
  215.     union {
  216.     _FP32         Fp32Value;
  217.     _FP64         Fp64Value;
  218.     _FP80         Fp80Value;
  219.     _FP128         Fp128Value;
  220.     _I16         I16Value;
  221.     _I32         I32Value;
  222.     _I64         I64Value;
  223.     _U16         U16Value;
  224.     _U32         U32Value;
  225.     _U64         U64Value;
  226.     _BCD80         Bcd80Value;
  227.     char         *StringValue;
  228.     int         CompareValue;
  229.     } Value;
  230.  
  231.     unsigned int OperandValid : 1;
  232.     unsigned int Format : 4;
  233.  
  234. } _FPIEEE_VALUE;
  235.  
  236.  
  237. typedef struct {
  238.     unsigned int Inexact : 1;
  239.     unsigned int Underflow : 1;
  240.     unsigned int Overflow : 1;
  241.     unsigned int ZeroDivide : 1;
  242.     unsigned int InvalidOperation : 1;
  243. } _FPIEEE_EXCEPTION_FLAGS;
  244.  
  245.  
  246. typedef struct {
  247.     unsigned int RoundingMode : 2;
  248.     unsigned int Precision : 3;
  249.     unsigned int Operation :12;
  250.     _FPIEEE_EXCEPTION_FLAGS Cause;
  251.     _FPIEEE_EXCEPTION_FLAGS Enable;
  252.     _FPIEEE_EXCEPTION_FLAGS Status;
  253.     _FPIEEE_VALUE Operand1;
  254.     _FPIEEE_VALUE Operand2;
  255.     _FPIEEE_VALUE Result;
  256. } _FPIEEE_RECORD;
  257.  
  258.  
  259. struct _EXCEPTION_POINTERS;
  260.  
  261. /*
  262.  * Floating point IEEE exception filter routine
  263.  */
  264.  
  265. _CRTIMP int __cdecl _fpieee_flt(
  266.     unsigned long,
  267.     struct _EXCEPTION_POINTERS *,
  268. #ifdef _M_SH
  269.     int handler(_FPIEEE_RECORD *)
  270. #else
  271.     int (__cdecl *)(_FPIEEE_RECORD *)
  272. #endif
  273.     );
  274.  
  275. #ifdef __cplusplus
  276. }
  277. #endif
  278.  
  279. #ifdef    _MSC_VER
  280. #pragma pack(pop)
  281. #endif    /* _MSC_VER */
  282. #endif    /* #ifndef __assembler */
  283.  
  284. #endif    /* _INC_FPIEEE */
  285.