msvcp: Sync num_get<>::_Getifld.
[wine.git] / dlls / msvcp100 / msvcp.h
blob571c2d06640bb365a76c4c9de23b7064e3a19b0b
1 /*
2 * Copyright 2010 Piotr Caban for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #include "stdlib.h"
20 #include "windef.h"
21 #include "cxx.h"
23 #define ALIGNED_SIZE(size, alignment) (((size)+((alignment)-1))/(alignment)*(alignment))
25 typedef unsigned char MSVCP_bool;
26 typedef SIZE_T MSVCP_size_t;
27 typedef __int64 DECLSPEC_ALIGN(8) streamoff;
28 typedef __int64 DECLSPEC_ALIGN(8) streamsize;
30 void __cdecl _invalid_parameter(const wchar_t*, const wchar_t*,
31 const wchar_t*, unsigned int, uintptr_t);
32 BOOL __cdecl __uncaught_exception(void);
34 extern void* (__cdecl *MSVCRT_operator_new)(MSVCP_size_t);
35 extern void (__cdecl *MSVCRT_operator_delete)(void*);
36 extern void* (__cdecl *MSVCRT_set_new_handler)(void*);
38 /* basic_string<char, char_traits<char>, allocator<char>> */
39 #define BUF_SIZE_CHAR 16
40 typedef struct
42 void *allocator;
43 union {
44 char buf[BUF_SIZE_CHAR];
45 char *ptr;
46 } data;
47 MSVCP_size_t size;
48 MSVCP_size_t res;
49 } basic_string_char;
51 basic_string_char* MSVCP_basic_string_char_ctor(basic_string_char*);
52 basic_string_char* MSVCP_basic_string_char_ctor_cstr(basic_string_char*, const char*);
53 basic_string_char* MSVCP_basic_string_char_copy_ctor(basic_string_char*, const basic_string_char*);
54 void MSVCP_basic_string_char_dtor(basic_string_char*);
55 const char* MSVCP_basic_string_char_c_str(const basic_string_char*);
56 basic_string_char* MSVCP_basic_string_char_append_ch(basic_string_char*, char);
57 MSVCP_size_t MSVCP_basic_string_char_length(const basic_string_char*);
59 #define BUF_SIZE_WCHAR 8
60 typedef struct
62 void *allocator;
63 union {
64 wchar_t buf[BUF_SIZE_WCHAR];
65 wchar_t *ptr;
66 } data;
67 MSVCP_size_t size;
68 MSVCP_size_t res;
69 } basic_string_wchar;
71 basic_string_wchar* MSVCP_basic_string_wchar_ctor_cstr(basic_string_wchar*, const wchar_t*);
72 void MSVCP_basic_string_wchar_dtor(basic_string_wchar*);
73 const wchar_t* MSVCP_basic_string_wchar_c_str(const basic_string_wchar*);
74 MSVCP_size_t MSVCP_basic_string_wchar_length(const basic_string_wchar*);
76 char* MSVCP_allocator_char_allocate(void*, MSVCP_size_t);
77 void MSVCP_allocator_char_deallocate(void*, char*, MSVCP_size_t);
78 wchar_t* MSVCP_allocator_wchar_allocate(void*, MSVCP_size_t);
79 void MSVCP_allocator_wchar_deallocate(void*, wchar_t*, MSVCP_size_t);
81 /* class locale::facet */
82 typedef struct {
83 const vtable_ptr *vtable;
84 MSVCP_size_t refs;
85 } locale_facet;
87 typedef enum {
88 CODECVT_ok = 0,
89 CODECVT_partial = 1,
90 CODECVT_error = 2,
91 CODECVT_noconv = 3
92 } codecvt_base_result;
94 typedef struct {
95 LCID handle;
96 unsigned page;
97 const short *table;
98 int delfl;
99 } _Ctypevec;
101 /* class codecvt_base */
102 typedef struct {
103 locale_facet facet;
104 } codecvt_base;
106 /* class codecvt<char> */
107 typedef struct {
108 codecvt_base base;
109 } codecvt_char;
111 MSVCP_bool __thiscall codecvt_base_always_noconv(const codecvt_base*);
112 int __thiscall codecvt_char_unshift(const codecvt_char*, int*, char*, char*, char**);
113 int __thiscall codecvt_char_out(const codecvt_char*, int*, const char*,
114 const char*, const char**, char*, char*, char**);
115 int __thiscall codecvt_char_in(const codecvt_char*, int*, const char*,
116 const char*, const char**, char*, char*, char**);
117 int __thiscall codecvt_base_max_length(const codecvt_base*);
119 typedef struct {
120 LCID handle;
121 unsigned page;
122 } _Cvtvec;
124 /* class codecvt<wchar> */
125 typedef struct {
126 codecvt_base base;
127 _Cvtvec cvt;
128 } codecvt_wchar;
130 int __thiscall codecvt_wchar_unshift(const codecvt_wchar*, int*, char*, char*, char**);
131 int __thiscall codecvt_wchar_out(const codecvt_wchar*, int*, const wchar_t*,
132 const wchar_t*, const wchar_t**, char*, char*, char**);
133 int __thiscall codecvt_wchar_in(const codecvt_wchar*, int*, const char*,
134 const char*, const char**, wchar_t*, wchar_t*, wchar_t**);
136 /* class ctype_base */
137 typedef struct {
138 locale_facet facet;
139 } ctype_base;
141 /* class ctype<char> */
142 typedef struct {
143 ctype_base base;
144 _Ctypevec ctype;
145 } ctype_char;
147 MSVCP_bool __thiscall ctype_char_is_ch(const ctype_char*, short, char);
148 char __thiscall ctype_char_narrow_ch(const ctype_char*, char, char);
149 char __thiscall ctype_char_widen_ch(const ctype_char*, char);
151 /* class ctype<wchar> */
152 typedef struct {
153 ctype_base base;
154 _Ctypevec ctype;
155 _Cvtvec cvt;
156 } ctype_wchar;
158 MSVCP_bool __thiscall ctype_wchar_is_ch(const ctype_wchar*, short, wchar_t);
159 char __thiscall ctype_wchar_narrow_ch(const ctype_wchar*, wchar_t, char);
160 wchar_t __thiscall ctype_wchar_widen_ch(const ctype_wchar*, char);
162 /* class locale */
163 typedef struct
165 struct _locale__Locimp *ptr;
166 } locale;
168 locale* locale_ctor(locale*);
169 locale* locale_copy_ctor(locale*, const locale*);
170 locale* locale_operator_assign(locale*, const locale*);
171 void locale_dtor(locale*);
172 void free_locale(void);
173 codecvt_char* codecvt_char_use_facet(const locale*);
174 codecvt_wchar* codecvt_wchar_use_facet(const locale*);
175 codecvt_wchar* codecvt_short_use_facet(const locale*);
176 ctype_char* ctype_char_use_facet(const locale*);
177 ctype_wchar* ctype_wchar_use_facet(const locale*);
179 /* class _Lockit */
180 typedef struct {
181 int locktype;
182 } _Lockit;
184 #define _LOCK_LOCALE 0
185 #define _LOCK_MALLOC 1
186 #define _LOCK_STREAM 2
187 #define _LOCK_DEBUG 3
188 #define _MAX_LOCK 4
190 void init_lockit(void);
191 void free_lockit(void);
192 _Lockit* __thiscall _Lockit_ctor_locktype(_Lockit*, int);
193 void __thiscall _Lockit_dtor(_Lockit*);
195 /* class mutex */
196 typedef struct {
197 void *mutex;
198 } mutex;
200 mutex* __thiscall mutex_ctor(mutex*);
201 void __thiscall mutex_dtor(mutex*);
202 void __thiscall mutex_lock(mutex*);
203 void __thiscall mutex_unlock(mutex*);
205 typedef enum {
206 FMTFLAG_skipws = 0x0001,
207 FMTFLAG_unitbuf = 0x0002,
208 FMTFLAG_uppercase = 0x0004,
209 FMTFLAG_showbase = 0x0008,
210 FMTFLAG_showpoint = 0x0010,
211 FMTFLAG_showpos = 0x0020,
212 FMTFLAG_left = 0x0040,
213 FMTFLAG_right = 0x0080,
214 FMTFLAG_internal = 0x0100,
215 FMTFLAG_dec = 0x0200,
216 FMTFLAG_oct = 0x0400,
217 FMTFLAG_hex = 0x0800,
218 FMTFLAG_scientific = 0x1000,
219 FMTFLAG_fixed = 0x2000,
220 FMTFLAG_hexfloat = 0x3000,
221 FMTFLAG_boolalpha = 0x4000,
222 FMTFLAG_stdio = 0x8000,
223 FMTFLAG_adjustfield = FMTFLAG_left|FMTFLAG_right|FMTFLAG_internal,
224 FMTFLAG_basefield = FMTFLAG_dec|FMTFLAG_oct|FMTFLAG_hex,
225 FMTFLAG_floatfield = FMTFLAG_scientific|FMTFLAG_fixed,
226 FMTFLAG_mask = 0xffff
227 } IOSB_fmtflags;
229 typedef enum {
230 OPENMODE_in = 0x01,
231 OPENMODE_out = 0x02,
232 OPENMODE_ate = 0x04,
233 OPENMODE_app = 0x08,
234 OPENMODE_trunc = 0x10,
235 OPENMODE__Nocreate = 0x40,
236 OPENMODE__Noreplace = 0x80,
237 OPENMODE_binary = 0x20,
238 OPENMODE_mask = 0xff
239 } IOSB_openmode;
241 typedef enum {
242 SEEKDIR_beg = 0x0,
243 SEEKDIR_cur = 0x1,
244 SEEKDIR_end = 0x2,
245 SEEKDIR_mask = 0x3
246 } IOSB_seekdir;
248 typedef enum {
249 IOSTATE_goodbit = 0x00,
250 IOSTATE_eofbit = 0x01,
251 IOSTATE_failbit = 0x02,
252 IOSTATE_badbit = 0x04,
253 IOSTATE__Hardfail = 0x10,
254 IOSTATE_mask = 0x17
255 } IOSB_iostate;
257 typedef struct _iosarray {
258 struct _iosarray *next;
259 int index;
260 int long_val;
261 void *ptr_val;
262 } IOS_BASE_iosarray;
264 typedef enum {
265 EVENT_erase_event,
266 EVENT_imbue_event,
267 EVENT_copyfmt_event
268 } IOS_BASE_event;
270 struct _ios_base;
271 typedef void (CDECL *IOS_BASE_event_callback)(IOS_BASE_event, struct _ios_base*, int);
272 typedef struct _fnarray {
273 struct _fnarray *next;
274 int index;
275 IOS_BASE_event_callback event_handler;
276 } IOS_BASE_fnarray;
278 /* class ios_base */
279 typedef struct _ios_base {
280 const vtable_ptr *vtable;
281 MSVCP_size_t stdstr;
282 IOSB_iostate state;
283 IOSB_iostate except;
284 IOSB_fmtflags fmtfl;
285 streamsize prec;
286 streamsize wide;
287 IOS_BASE_iosarray *arr;
288 IOS_BASE_fnarray *calls;
289 locale *loc;
290 } ios_base;
292 /* class basic_streambuf<char> */
293 typedef struct {
294 const vtable_ptr *vtable;
295 mutex lock;
296 char *rbuf;
297 char *wbuf;
298 char **prbuf;
299 char **pwbuf;
300 char *rpos;
301 char *wpos;
302 char **prpos;
303 char **pwpos;
304 int rsize;
305 int wsize;
306 int *prsize;
307 int *pwsize;
308 locale *loc;
309 } basic_streambuf_char;
311 typedef struct {
312 basic_streambuf_char *strbuf;
313 MSVCP_bool got;
314 char val;
315 } istreambuf_iterator_char;
317 typedef struct {
318 MSVCP_bool failed;
319 basic_streambuf_char *strbuf;
320 } ostreambuf_iterator_char;
322 int __thiscall basic_streambuf_char_sgetc(basic_streambuf_char*);
323 int __thiscall basic_streambuf_char_sbumpc(basic_streambuf_char*);
324 int __thiscall basic_streambuf_char_sputc(basic_streambuf_char*, char);
326 /* class basic_streambuf<wchar> */
327 typedef struct {
328 const vtable_ptr *vtable;
329 mutex lock;
330 wchar_t *rbuf;
331 wchar_t *wbuf;
332 wchar_t **prbuf;
333 wchar_t **pwbuf;
334 wchar_t *rpos;
335 wchar_t *wpos;
336 wchar_t **prpos;
337 wchar_t **pwpos;
338 int rsize;
339 int wsize;
340 int *prsize;
341 int *pwsize;
342 locale *loc;
343 } basic_streambuf_wchar;
345 typedef struct {
346 basic_streambuf_wchar *strbuf;
347 MSVCP_bool got;
348 wchar_t val;
349 } istreambuf_iterator_wchar;
351 typedef struct {
352 MSVCP_bool failed;
353 basic_streambuf_wchar *strbuf;
354 } ostreambuf_iterator_wchar;
356 unsigned short __thiscall basic_streambuf_wchar_sgetc(basic_streambuf_wchar*);
357 unsigned short __thiscall basic_streambuf_wchar_sbumpc(basic_streambuf_wchar*);
358 unsigned short __thiscall basic_streambuf_wchar_sputc(basic_streambuf_wchar*, wchar_t);
360 /* class num_get<char> */
361 typedef struct {
362 locale_facet facet;
363 _Cvtvec cvt;
364 } num_get;
366 num_get* num_get_char_use_facet(const locale*);
367 istreambuf_iterator_char* __thiscall num_get_char_get_long(const num_get*, istreambuf_iterator_char*,
368 istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, LONG*);
369 istreambuf_iterator_char* __thiscall num_get_char_get_ushort(const num_get*, istreambuf_iterator_char*,
370 istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, unsigned short*);
371 istreambuf_iterator_char* __thiscall num_get_char_get_uint(const num_get*, istreambuf_iterator_char*,
372 istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, unsigned int*);
373 istreambuf_iterator_char* __thiscall num_get_char_get_ulong(const num_get*, istreambuf_iterator_char*,
374 istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, ULONG*);
375 istreambuf_iterator_char* __thiscall num_get_char_get_float(const num_get*, istreambuf_iterator_char*,
376 istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, float*);
377 istreambuf_iterator_char *__thiscall num_get_char_get_double(const num_get*, istreambuf_iterator_char*,
378 istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, double*);
379 istreambuf_iterator_char *__thiscall num_get_char_get_ldouble(const num_get*, istreambuf_iterator_char*,
380 istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, double*);
381 istreambuf_iterator_char *__thiscall num_get_char_get_void(const num_get*, istreambuf_iterator_char*,
382 istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, void**);
383 istreambuf_iterator_char *__thiscall num_get_char_get_int64(const num_get*, istreambuf_iterator_char*,
384 istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, LONGLONG*);
385 istreambuf_iterator_char *__thiscall num_get_char_get_uint64(const num_get*, istreambuf_iterator_char*,
386 istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, ULONGLONG*);
387 istreambuf_iterator_char *__thiscall num_get_char_get_bool(const num_get*, istreambuf_iterator_char*,
388 istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, MSVCP_bool*);
390 num_get* num_get_wchar_use_facet(const locale*);
391 num_get* num_get_short_use_facet(const locale*);
392 istreambuf_iterator_wchar* __thiscall num_get_wchar_get_long(const num_get*, istreambuf_iterator_wchar*,
393 istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, LONG*);
394 istreambuf_iterator_wchar* __thiscall num_get_wchar_get_ushort(const num_get*, istreambuf_iterator_wchar*,
395 istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, unsigned short*);
396 istreambuf_iterator_wchar* __thiscall num_get_wchar_get_uint(const num_get*, istreambuf_iterator_wchar*,
397 istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, unsigned int*);
398 istreambuf_iterator_wchar* __thiscall num_get_wchar_get_ulong(const num_get*, istreambuf_iterator_wchar*,
399 istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, ULONG*);
400 istreambuf_iterator_wchar* __thiscall num_get_wchar_get_float(const num_get*, istreambuf_iterator_wchar*,
401 istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, float*);
402 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_double(const num_get*, istreambuf_iterator_wchar*,
403 istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, double*);
404 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_ldouble(const num_get*, istreambuf_iterator_wchar*,
405 istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, double*);
406 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_void(const num_get*, istreambuf_iterator_wchar*,
407 istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, void**);
408 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_int64(const num_get*, istreambuf_iterator_wchar*,
409 istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, LONGLONG*);
410 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_uint64(const num_get*, istreambuf_iterator_wchar*,
411 istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, ULONGLONG*);
412 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_bool(const num_get*, istreambuf_iterator_wchar*,
413 istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, MSVCP_bool*);
415 /* class num_put<char> */
416 /* class num_put<wchar> */
417 typedef struct {
418 locale_facet facet;
419 _Cvtvec cvt;
420 } num_put;
422 num_put* num_put_char_use_facet(const locale*);
423 ostreambuf_iterator_char* __thiscall num_put_char_put_long(const num_put*, ostreambuf_iterator_char*,
424 ostreambuf_iterator_char, ios_base*, char, LONG);
425 ostreambuf_iterator_char* __thiscall num_put_char_put_ulong(const num_put*, ostreambuf_iterator_char*,
426 ostreambuf_iterator_char, ios_base*, char, ULONG);
427 ostreambuf_iterator_char* __thiscall num_put_char_put_double(const num_put*, ostreambuf_iterator_char*,
428 ostreambuf_iterator_char, ios_base*, char, double);
429 ostreambuf_iterator_char* __thiscall num_put_char_put_ldouble(const num_put*, ostreambuf_iterator_char*,
430 ostreambuf_iterator_char, ios_base*, char, double);
431 ostreambuf_iterator_char* __thiscall num_put_char_put_ptr(const num_put*, ostreambuf_iterator_char*,
432 ostreambuf_iterator_char, ios_base*, char, const void*);
433 ostreambuf_iterator_char* __thiscall num_put_char_put_int64(const num_put*, ostreambuf_iterator_char*,
434 ostreambuf_iterator_char, ios_base*, char, __int64);
435 ostreambuf_iterator_char* __thiscall num_put_char_put_uint64(const num_put*, ostreambuf_iterator_char*,
436 ostreambuf_iterator_char, ios_base*, char, unsigned __int64);
437 ostreambuf_iterator_char* __thiscall num_put_char_put_bool(const num_put*, ostreambuf_iterator_char*,
438 ostreambuf_iterator_char, ios_base*, char, MSVCP_bool);
440 num_put* num_put_wchar_use_facet(const locale*);
441 num_put* num_put_short_use_facet(const locale*);
442 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_long(const num_put*, ostreambuf_iterator_wchar*,
443 ostreambuf_iterator_wchar, ios_base*, wchar_t, LONG);
444 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_ulong(const num_put*, ostreambuf_iterator_wchar*,
445 ostreambuf_iterator_wchar, ios_base*, wchar_t, ULONG);
446 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_double(const num_put*, ostreambuf_iterator_wchar*,
447 ostreambuf_iterator_wchar, ios_base*, wchar_t, double);
448 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_ldouble(const num_put*, ostreambuf_iterator_wchar*,
449 ostreambuf_iterator_wchar, ios_base*, wchar_t, double);
450 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_ptr(const num_put*, ostreambuf_iterator_wchar*,
451 ostreambuf_iterator_wchar, ios_base*, wchar_t, const void*);
452 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_int64(const num_put*, ostreambuf_iterator_wchar*,
453 ostreambuf_iterator_wchar, ios_base*, wchar_t, __int64);
454 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_uint64(const num_put*, ostreambuf_iterator_wchar*,
455 ostreambuf_iterator_wchar, ios_base*, wchar_t, unsigned __int64);
456 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_bool(const num_put*, ostreambuf_iterator_wchar*,
457 ostreambuf_iterator_wchar, ios_base*, wchar_t, MSVCP_bool);
459 void init_exception(void*);
460 void init_locale(void*);
461 void init_io(void*);
462 void free_io(void);