oleaut32: Use BOOL type where appropriate.
[wine.git] / dlls / msvcp80 / msvcp.h
blob59f85445024513069cb0e7b94eaf0400095e8a13
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 typedef unsigned char MSVCP_bool;
24 typedef SIZE_T MSVCP_size_t;
25 typedef SSIZE_T streamoff;
26 typedef SSIZE_T streamsize;
28 void __cdecl _invalid_parameter(const wchar_t*, const wchar_t*,
29 const wchar_t*, unsigned int, uintptr_t);
30 BOOL __cdecl __uncaught_exception(void);
32 extern void* (__cdecl *MSVCRT_operator_new)(MSVCP_size_t);
33 extern void (__cdecl *MSVCRT_operator_delete)(void*);
34 extern void* (__cdecl *MSVCRT_set_new_handler)(void*);
36 /* basic_string<char, char_traits<char>, allocator<char>> */
37 #define BUF_SIZE_CHAR 16
38 typedef struct
40 void *allocator;
41 union {
42 char buf[BUF_SIZE_CHAR];
43 char *ptr;
44 } data;
45 MSVCP_size_t size;
46 MSVCP_size_t res;
47 } basic_string_char;
49 basic_string_char* __thiscall MSVCP_basic_string_char_ctor(basic_string_char*);
50 basic_string_char* __stdcall MSVCP_basic_string_char_ctor_cstr(basic_string_char*, const char*);
51 basic_string_char* __thiscall MSVCP_basic_string_char_ctor_cstr_len(basic_string_char*, const char*, MSVCP_size_t);
52 basic_string_char* __stdcall MSVCP_basic_string_char_copy_ctor(basic_string_char*, const basic_string_char*);
53 void __stdcall MSVCP_basic_string_char_dtor(basic_string_char*);
54 const char* __stdcall MSVCP_basic_string_char_c_str(const basic_string_char*);
55 void __thiscall MSVCP_basic_string_char_clear(basic_string_char*);
56 basic_string_char* __thiscall MSVCP_basic_string_char_append_ch(basic_string_char*, char);
57 MSVCP_size_t __thiscall MSVCP_basic_string_char_length(const basic_string_char*);
58 basic_string_char* __thiscall MSVCP_basic_string_char_assign(basic_string_char*, const basic_string_char*);
60 #define BUF_SIZE_WCHAR 8
61 typedef struct
63 void *allocator;
64 union {
65 wchar_t buf[BUF_SIZE_WCHAR];
66 wchar_t *ptr;
67 } data;
68 MSVCP_size_t size;
69 MSVCP_size_t res;
70 } basic_string_wchar;
72 basic_string_wchar* __thiscall MSVCP_basic_string_wchar_ctor(basic_string_wchar*);
73 basic_string_wchar* __stdcall MSVCP_basic_string_wchar_ctor_cstr(basic_string_wchar*, const wchar_t*);
74 basic_string_wchar* __thiscall MSVCP_basic_string_wchar_ctor_cstr_len(basic_string_wchar*, const wchar_t*, MSVCP_size_t);
75 void __thiscall MSVCP_basic_string_wchar_dtor(basic_string_wchar*);
76 const wchar_t* __thiscall MSVCP_basic_string_wchar_c_str(const basic_string_wchar*);
77 void __thiscall MSVCP_basic_string_wchar_clear(basic_string_wchar*);
78 basic_string_wchar* __thiscall MSVCP_basic_string_wchar_append_ch(basic_string_wchar*, wchar_t);
79 MSVCP_size_t __thiscall MSVCP_basic_string_wchar_length(const basic_string_wchar*);
81 char* __stdcall MSVCP_allocator_char_allocate(void*, MSVCP_size_t);
82 void __stdcall MSVCP_allocator_char_deallocate(void*, char*, MSVCP_size_t);
83 MSVCP_size_t __stdcall MSVCP_allocator_char_max_size(void*);
84 wchar_t* __stdcall MSVCP_allocator_wchar_allocate(void*, MSVCP_size_t);
85 void __stdcall MSVCP_allocator_wchar_deallocate(void*, wchar_t*, MSVCP_size_t);
86 MSVCP_size_t __stdcall MSVCP_allocator_wchar_max_size(void*);
88 /* class locale::facet */
89 typedef struct {
90 const vtable_ptr *vtable;
91 MSVCP_size_t refs;
92 } locale_facet;
94 typedef enum {
95 CODECVT_ok = 0,
96 CODECVT_partial = 1,
97 CODECVT_error = 2,
98 CODECVT_noconv = 3
99 } codecvt_base_result;
101 typedef struct {
102 LCID handle;
103 unsigned page;
104 const short *table;
105 int delfl;
106 } _Ctypevec;
108 /* class codecvt_base */
109 typedef struct {
110 locale_facet facet;
111 } codecvt_base;
113 /* class codecvt<char> */
114 typedef struct {
115 codecvt_base base;
116 } codecvt_char;
118 MSVCP_bool __thiscall codecvt_base_always_noconv(const codecvt_base*);
119 int __thiscall codecvt_char_unshift(const codecvt_char*, int*, char*, char*, char**);
120 int __thiscall codecvt_char_out(const codecvt_char*, int*, const char*,
121 const char*, const char**, char*, char*, char**);
122 int __thiscall codecvt_char_in(const codecvt_char*, int*, const char*,
123 const char*, const char**, char*, char*, char**);
124 int __thiscall codecvt_base_max_length(const codecvt_base*);
126 typedef struct {
127 LCID handle;
128 unsigned page;
129 } _Cvtvec;
131 /* class codecvt<wchar> */
132 typedef struct {
133 codecvt_base base;
134 _Cvtvec cvt;
135 } codecvt_wchar;
137 int __thiscall codecvt_wchar_unshift(const codecvt_wchar*, int*, char*, char*, char**);
138 int __thiscall codecvt_wchar_out(const codecvt_wchar*, int*, const wchar_t*,
139 const wchar_t*, const wchar_t**, char*, char*, char**);
140 int __thiscall codecvt_wchar_in(const codecvt_wchar*, int*, const char*,
141 const char*, const char**, wchar_t*, wchar_t*, wchar_t**);
143 /* class ctype_base */
144 typedef struct {
145 locale_facet facet;
146 } ctype_base;
148 /* class ctype<char> */
149 typedef struct {
150 ctype_base base;
151 _Ctypevec ctype;
152 } ctype_char;
154 MSVCP_bool __thiscall ctype_char_is_ch(const ctype_char*, short, char);
155 char __thiscall ctype_char_narrow_ch(const ctype_char*, char, char);
156 char __thiscall ctype_char_widen_ch(const ctype_char*, char);
158 /* class ctype<wchar> */
159 typedef struct {
160 ctype_base base;
161 _Ctypevec ctype;
162 _Cvtvec cvt;
163 } ctype_wchar;
165 MSVCP_bool __thiscall ctype_wchar_is_ch(const ctype_wchar*, short, wchar_t);
166 char __thiscall ctype_wchar_narrow_ch(const ctype_wchar*, wchar_t, char);
167 wchar_t __thiscall ctype_wchar_widen_ch(const ctype_wchar*, char);
169 /* class locale */
170 typedef struct
172 struct _locale__Locimp *ptr;
173 } locale;
175 locale* __thiscall locale_ctor(locale*);
176 locale* __thiscall locale_copy_ctor(locale*, const locale*);
177 locale* __thiscall locale_operator_assign(locale*, const locale*);
178 void __thiscall locale_dtor(locale*);
179 void free_locale(void);
180 codecvt_char* codecvt_char_use_facet(const locale*);
181 codecvt_wchar* codecvt_wchar_use_facet(const locale*);
182 codecvt_wchar* codecvt_short_use_facet(const locale*);
183 ctype_char* ctype_char_use_facet(const locale*);
184 ctype_wchar* ctype_wchar_use_facet(const locale*);
185 ctype_wchar* ctype_short_use_facet(const locale*);
187 /* class _Lockit */
188 typedef struct {
189 int locktype;
190 } _Lockit;
192 #define _LOCK_LOCALE 0
193 #define _LOCK_MALLOC 1
194 #define _LOCK_STREAM 2
195 #define _LOCK_DEBUG 3
196 #define _MAX_LOCK 4
198 void init_lockit(void);
199 void free_lockit(void);
200 _Lockit* __thiscall _Lockit_ctor_locktype(_Lockit*, int);
201 void __thiscall _Lockit_dtor(_Lockit*);
203 /* class mutex */
204 typedef struct {
205 void *mutex;
206 } mutex;
208 mutex* __thiscall mutex_ctor(mutex*);
209 void __thiscall mutex_dtor(mutex*);
210 void __thiscall mutex_lock(mutex*);
211 void __thiscall mutex_unlock(mutex*);
213 typedef enum {
214 FMTFLAG_skipws = 0x0001,
215 FMTFLAG_unitbuf = 0x0002,
216 FMTFLAG_uppercase = 0x0004,
217 FMTFLAG_showbase = 0x0008,
218 FMTFLAG_showpoint = 0x0010,
219 FMTFLAG_showpos = 0x0020,
220 FMTFLAG_left = 0x0040,
221 FMTFLAG_right = 0x0080,
222 FMTFLAG_internal = 0x0100,
223 FMTFLAG_dec = 0x0200,
224 FMTFLAG_oct = 0x0400,
225 FMTFLAG_hex = 0x0800,
226 FMTFLAG_scientific = 0x1000,
227 FMTFLAG_fixed = 0x2000,
228 FMTFLAG_hexfloat = 0x3000,
229 FMTFLAG_boolalpha = 0x4000,
230 FMTFLAG_stdio = 0x8000,
231 FMTFLAG_adjustfield = FMTFLAG_left|FMTFLAG_right|FMTFLAG_internal,
232 FMTFLAG_basefield = FMTFLAG_dec|FMTFLAG_oct|FMTFLAG_hex,
233 FMTFLAG_floatfield = FMTFLAG_scientific|FMTFLAG_fixed,
234 FMTFLAG_mask = 0xffff
235 } IOSB_fmtflags;
237 typedef enum {
238 OPENMODE_in = 0x01,
239 OPENMODE_out = 0x02,
240 OPENMODE_ate = 0x04,
241 OPENMODE_app = 0x08,
242 OPENMODE_trunc = 0x10,
243 OPENMODE__Nocreate = 0x40,
244 OPENMODE__Noreplace = 0x80,
245 OPENMODE_binary = 0x20,
246 OPENMODE_mask = 0xff
247 } IOSB_openmode;
249 typedef enum {
250 SEEKDIR_beg = 0x0,
251 SEEKDIR_cur = 0x1,
252 SEEKDIR_end = 0x2,
253 SEEKDIR_mask = 0x3
254 } IOSB_seekdir;
256 typedef enum {
257 IOSTATE_goodbit = 0x00,
258 IOSTATE_eofbit = 0x01,
259 IOSTATE_failbit = 0x02,
260 IOSTATE_badbit = 0x04,
261 IOSTATE__Hardfail = 0x10,
262 IOSTATE_mask = 0x17
263 } IOSB_iostate;
265 typedef struct _iosarray {
266 struct _iosarray *next;
267 int index;
268 int long_val;
269 void *ptr_val;
270 } IOS_BASE_iosarray;
272 typedef enum {
273 EVENT_erase_event,
274 EVENT_imbue_event,
275 EVENT_copyfmt_event
276 } IOS_BASE_event;
278 struct _ios_base;
279 typedef void (CDECL *IOS_BASE_event_callback)(IOS_BASE_event, struct _ios_base*, int);
280 typedef struct _fnarray {
281 struct _fnarray *next;
282 int index;
283 IOS_BASE_event_callback event_handler;
284 } IOS_BASE_fnarray;
286 /* class ios_base */
287 typedef struct _ios_base {
288 const vtable_ptr *vtable;
289 MSVCP_size_t stdstr;
290 IOSB_iostate state;
291 IOSB_iostate except;
292 IOSB_fmtflags fmtfl;
293 streamsize prec;
294 streamsize wide;
295 IOS_BASE_iosarray *arr;
296 IOS_BASE_fnarray *calls;
297 locale *loc;
298 } ios_base;
300 /* class basic_streambuf<char> */
301 typedef struct {
302 const vtable_ptr *vtable;
303 mutex lock;
304 char *rbuf;
305 char *wbuf;
306 char **prbuf;
307 char **pwbuf;
308 char *rpos;
309 char *wpos;
310 char **prpos;
311 char **pwpos;
312 int rsize;
313 int wsize;
314 int *prsize;
315 int *pwsize;
316 locale *loc;
317 } basic_streambuf_char;
319 typedef struct {
320 basic_streambuf_char *strbuf;
321 MSVCP_bool got;
322 char val;
323 } istreambuf_iterator_char;
325 typedef struct {
326 MSVCP_bool failed;
327 basic_streambuf_char *strbuf;
328 } ostreambuf_iterator_char;
330 int __thiscall basic_streambuf_char_sgetc(basic_streambuf_char*);
331 int __thiscall basic_streambuf_char_sbumpc(basic_streambuf_char*);
332 int __thiscall basic_streambuf_char_sputc(basic_streambuf_char*, char);
334 /* class basic_streambuf<wchar> */
335 typedef struct {
336 const vtable_ptr *vtable;
337 mutex lock;
338 wchar_t *rbuf;
339 wchar_t *wbuf;
340 wchar_t **prbuf;
341 wchar_t **pwbuf;
342 wchar_t *rpos;
343 wchar_t *wpos;
344 wchar_t **prpos;
345 wchar_t **pwpos;
346 int rsize;
347 int wsize;
348 int *prsize;
349 int *pwsize;
350 locale *loc;
351 } basic_streambuf_wchar;
353 typedef struct {
354 basic_streambuf_wchar *strbuf;
355 MSVCP_bool got;
356 wchar_t val;
357 } istreambuf_iterator_wchar;
359 typedef struct {
360 MSVCP_bool failed;
361 basic_streambuf_wchar *strbuf;
362 } ostreambuf_iterator_wchar;
364 unsigned short __thiscall basic_streambuf_wchar_sgetc(basic_streambuf_wchar*);
365 unsigned short __thiscall basic_streambuf_wchar_sbumpc(basic_streambuf_wchar*);
366 unsigned short __thiscall basic_streambuf_wchar_sputc(basic_streambuf_wchar*, wchar_t);
368 /* class num_get<char> */
369 typedef struct {
370 locale_facet facet;
371 _Cvtvec cvt;
372 } num_get;
374 num_get* num_get_char_use_facet(const locale*);
375 istreambuf_iterator_char* __thiscall num_get_char_get_long(const num_get*, istreambuf_iterator_char*,
376 istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, LONG*);
377 istreambuf_iterator_char* __thiscall num_get_char_get_ushort(const num_get*, istreambuf_iterator_char*,
378 istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, unsigned short*);
379 istreambuf_iterator_char* __thiscall num_get_char_get_uint(const num_get*, istreambuf_iterator_char*,
380 istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, unsigned int*);
381 istreambuf_iterator_char* __thiscall num_get_char_get_ulong(const num_get*, istreambuf_iterator_char*,
382 istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, ULONG*);
383 istreambuf_iterator_char* __thiscall num_get_char_get_float(const num_get*, istreambuf_iterator_char*,
384 istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, float*);
385 istreambuf_iterator_char *__thiscall num_get_char_get_double(const num_get*, istreambuf_iterator_char*,
386 istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, double*);
387 istreambuf_iterator_char *__thiscall num_get_char_get_ldouble(const num_get*, istreambuf_iterator_char*,
388 istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, double*);
389 istreambuf_iterator_char *__thiscall num_get_char_get_void(const num_get*, istreambuf_iterator_char*,
390 istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, void**);
391 istreambuf_iterator_char *__thiscall num_get_char_get_int64(const num_get*, istreambuf_iterator_char*,
392 istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, LONGLONG*);
393 istreambuf_iterator_char *__thiscall num_get_char_get_uint64(const num_get*, istreambuf_iterator_char*,
394 istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, ULONGLONG*);
395 istreambuf_iterator_char *__thiscall num_get_char_get_bool(const num_get*, istreambuf_iterator_char*,
396 istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, MSVCP_bool*);
398 num_get* num_get_wchar_use_facet(const locale*);
399 num_get* num_get_short_use_facet(const locale*);
400 istreambuf_iterator_wchar* __thiscall num_get_wchar_get_long(const num_get*, istreambuf_iterator_wchar*,
401 istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, LONG*);
402 istreambuf_iterator_wchar* __thiscall num_get_wchar_get_ushort(const num_get*, istreambuf_iterator_wchar*,
403 istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, unsigned short*);
404 istreambuf_iterator_wchar* __thiscall num_get_wchar_get_uint(const num_get*, istreambuf_iterator_wchar*,
405 istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, unsigned int*);
406 istreambuf_iterator_wchar* __thiscall num_get_wchar_get_ulong(const num_get*, istreambuf_iterator_wchar*,
407 istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, ULONG*);
408 istreambuf_iterator_wchar* __thiscall num_get_wchar_get_float(const num_get*, istreambuf_iterator_wchar*,
409 istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, float*);
410 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_double(const num_get*, istreambuf_iterator_wchar*,
411 istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, double*);
412 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_ldouble(const num_get*, istreambuf_iterator_wchar*,
413 istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, double*);
414 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_void(const num_get*, istreambuf_iterator_wchar*,
415 istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, void**);
416 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_int64(const num_get*, istreambuf_iterator_wchar*,
417 istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, LONGLONG*);
418 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_uint64(const num_get*, istreambuf_iterator_wchar*,
419 istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, ULONGLONG*);
420 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_bool(const num_get*, istreambuf_iterator_wchar*,
421 istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, MSVCP_bool*);
423 /* class num_put<char> */
424 /* class num_put<wchar> */
425 typedef struct {
426 locale_facet facet;
427 _Cvtvec cvt;
428 } num_put;
430 num_put* num_put_char_use_facet(const locale*);
431 ostreambuf_iterator_char* __thiscall num_put_char_put_long(const num_put*, ostreambuf_iterator_char*,
432 ostreambuf_iterator_char, ios_base*, char, LONG);
433 ostreambuf_iterator_char* __thiscall num_put_char_put_ulong(const num_put*, ostreambuf_iterator_char*,
434 ostreambuf_iterator_char, ios_base*, char, ULONG);
435 ostreambuf_iterator_char* __thiscall num_put_char_put_double(const num_put*, ostreambuf_iterator_char*,
436 ostreambuf_iterator_char, ios_base*, char, double);
437 ostreambuf_iterator_char* __thiscall num_put_char_put_ldouble(const num_put*, ostreambuf_iterator_char*,
438 ostreambuf_iterator_char, ios_base*, char, double);
439 ostreambuf_iterator_char* __thiscall num_put_char_put_ptr(const num_put*, ostreambuf_iterator_char*,
440 ostreambuf_iterator_char, ios_base*, char, const void*);
441 ostreambuf_iterator_char* __thiscall num_put_char_put_int64(const num_put*, ostreambuf_iterator_char*,
442 ostreambuf_iterator_char, ios_base*, char, __int64);
443 ostreambuf_iterator_char* __thiscall num_put_char_put_uint64(const num_put*, ostreambuf_iterator_char*,
444 ostreambuf_iterator_char, ios_base*, char, unsigned __int64);
445 ostreambuf_iterator_char* __thiscall num_put_char_put_bool(const num_put*, ostreambuf_iterator_char*,
446 ostreambuf_iterator_char, ios_base*, char, MSVCP_bool);
448 num_put* num_put_wchar_use_facet(const locale*);
449 num_put* num_put_short_use_facet(const locale*);
450 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_long(const num_put*, ostreambuf_iterator_wchar*,
451 ostreambuf_iterator_wchar, ios_base*, wchar_t, LONG);
452 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_ulong(const num_put*, ostreambuf_iterator_wchar*,
453 ostreambuf_iterator_wchar, ios_base*, wchar_t, ULONG);
454 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_double(const num_put*, ostreambuf_iterator_wchar*,
455 ostreambuf_iterator_wchar, ios_base*, wchar_t, double);
456 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_ldouble(const num_put*, ostreambuf_iterator_wchar*,
457 ostreambuf_iterator_wchar, ios_base*, wchar_t, double);
458 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_ptr(const num_put*, ostreambuf_iterator_wchar*,
459 ostreambuf_iterator_wchar, ios_base*, wchar_t, const void*);
460 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_int64(const num_put*, ostreambuf_iterator_wchar*,
461 ostreambuf_iterator_wchar, ios_base*, wchar_t, __int64);
462 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_uint64(const num_put*, ostreambuf_iterator_wchar*,
463 ostreambuf_iterator_wchar, ios_base*, wchar_t, unsigned __int64);
464 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_bool(const num_put*, ostreambuf_iterator_wchar*,
465 ostreambuf_iterator_wchar, ios_base*, wchar_t, MSVCP_bool);
467 void init_exception(void*);
468 void init_locale(void*);
469 void init_io(void*);
470 void free_io(void);
472 /* class complex<float> */
473 typedef struct {
474 float real;
475 float imag;
476 } complex_float;
478 /* class complex<double> */
479 /* class complex<long double> */
480 typedef struct {
481 double real;
482 double imag;
483 } complex_double;