ReactOS  0.4.13-dev-39-g8b6696f
winesup.c
Go to the documentation of this file.
1 
2 #include "precomp.h"
3 #include "winesup.h"
4 
5 #ifdef _LIBCNT_
6 
7 static struct lconv _LIBCNT_lconv =
8 {
9  ".", // char* decimal_point;
10  ",", // char* thousands_sep;
11  " ", // char* grouping;
12  "$", // char* int_curr_symbol;
13  "$", // char* currency_symbol;
14  ".", // char* mon_decimal_point;
15  "?", // char* mon_thousands_sep;
16  "/", // char* mon_grouping;
17  "+", // char* positive_sign;
18  "-", // char* negative_sign;
19  4, // char int_frac_digits;
20  4, // char frac_digits;
21  4, // char p_cs_precedes;
22  1, // char p_sep_by_space;
23  0, // char n_cs_precedes;
24  1, // char n_sep_by_space;
25  1, // char p_sign_posn;
26  1, // char n_sign_posn;
27 };
28 
29 threadlocinfo _LIBCNT_locinfo =
30 {
31  2, // LONG refcount;
32  0, // CP_ACP, // unsigned int lc_codepage;
33  0, // unsigned int lc_collate_cp;
34  {0}, // unsigned long lc_handle[6];
35  {{0}}, // LC_ID lc_id[6];
36 
37  // struct {
38  // char *locale;
39  // wchar_t *wlocale;
40  // int *refcount;
41  // int *wrefcount;
42  // } lc_category[6];
43  {{0}},
44 
45  0, // int lc_clike;
46  2, // int mb_cur_max;
47  0, // int *lconv_intl_refcount;
48  0, // int *lconv_num_refcount;
49  0, // int *lconv_mon_refcount;
50  &_LIBCNT_lconv, // struct MSVCRT_lconv *lconv;
51  0, // int *ctype1_refcount;
52  0, // unsigned short *ctype1;
53  0, // const unsigned short *pctype;
54  0, // unsigned char *pclmap;
55  0, // unsigned char *pcumap;
56  0, // struct __lc_time_data *lc_time_curr;
57 };
58 
59 #define get_locinfo() (&_LIBCNT_locinfo)
60 
61 #endif
62 
63 #define _SET_NUMBER_(type) *va_arg((*ap), type*) = negative ? -cur : cur
64 
65 void
67 _internal_handle_float(
68  int negative,
69  int exp,
70  int suppress,
71  ULONGLONG d,
72  int l_or_L_prefix,
73  va_list *ap)
74 {
75  long double cur = 1, expcnt = 10;
76  unsigned fpcontrol;
77  BOOL negexp;
78 #ifdef _M_ARM
79  DbgBreakPoint();
80  fpcontrol = _controlfp(0, 0);
81 #else
82  fpcontrol = _control87(0, 0);
85 #endif
86  negexp = (exp < 0);
87  if(negexp)
88  exp = -exp;
89  /* update 'cur' with this exponent. */
90  while(exp) {
91  if(exp & 1)
92  cur *= expcnt;
93  exp /= 2;
94  expcnt = expcnt*expcnt;
95  }
96  cur = (negexp ? d/cur : d*cur);
97 
98 #ifdef _M_ARM
99  DbgBreakPoint();
100  _controlfp(fpcontrol, 0xffffffff);
101 #else
102  _control87(fpcontrol, 0xffffffff);
103 #endif
104 
105  if (!suppress) {
106  if (l_or_L_prefix) _SET_NUMBER_(double);
107  else _SET_NUMBER_(float);
108  }
109 }
boolean suppress
Definition: jpeglib.h:1005
#define _EM_DENORMAL
Definition: float.h:48
unsigned int __cdecl _control87(unsigned int, unsigned int)
Definition: cntrlfp.c:43
#define _EM_INVALID
Definition: float.h:47
void int int ULONGLONG int l_or_L_prefix
Definition: winesup.h:32
void DbgBreakPoint()
Definition: mach.c:558
#define _EM_ZERODIVIDE
Definition: float.h:49
#define noinline
Definition: types.h:60
unsigned int BOOL
Definition: ntddk_ex.h:94
Definition: locale.h:37
char * va_list
Definition: acmsvcex.h:78
#define d
Definition: ke_i.h:81
uint64_t ULONGLONG
Definition: typedefs.h:65
#define _EM_INEXACT
Definition: float.h:52
#define _SET_NUMBER_(type)
Definition: winesup.c:63
#define _EM_OVERFLOW
Definition: float.h:50
DWORD exp
Definition: msg.c:15681
void int int ULONGLONG int va_list * ap
Definition: winesup.h:32
#define _EM_UNDERFLOW
Definition: float.h:51
__MINGW_NOTHROW _CRTIMP unsigned int __cdecl _controlfp(_In_ unsigned int unNew, _In_ unsigned int unMask)
void __declspec(noinline)
Definition: winesup.c:66