msvcp90: Fixed EOF detection in basic_streambuf_char__Xsgetn_s function.
[wine/multimedia.git] / dlls / msvcp90 / msvcp90.h
blob6f798bb99250b6c271702069cd2fbf283247a835
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*);
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* __thiscall MSVCP_basic_string_wchar_ctor(basic_string_wchar*);
72 basic_string_wchar* __stdcall MSVCP_basic_string_wchar_ctor_cstr(basic_string_wchar*, const wchar_t*);
73 basic_string_wchar* __thiscall MSVCP_basic_string_wchar_ctor_cstr_len(basic_string_wchar*, const wchar_t*, MSVCP_size_t);
74 void __thiscall MSVCP_basic_string_wchar_dtor(basic_string_wchar*);
75 const wchar_t* __thiscall MSVCP_basic_string_wchar_c_str(const basic_string_wchar*);
76 void __thiscall MSVCP_basic_string_wchar_clear(basic_string_wchar*);
77 basic_string_wchar* __thiscall MSVCP_basic_string_wchar_append_ch(basic_string_wchar*, wchar_t);
78 MSVCP_size_t __thiscall MSVCP_basic_string_wchar_length(const basic_string_wchar*);
80 char* __stdcall MSVCP_allocator_char_allocate(void*, MSVCP_size_t);
81 void __stdcall MSVCP_allocator_char_deallocate(void*, char*, MSVCP_size_t);
82 MSVCP_size_t __stdcall MSVCP_allocator_char_max_size(void*);
83 wchar_t* __stdcall MSVCP_allocator_wchar_allocate(void*, MSVCP_size_t);
84 void __stdcall MSVCP_allocator_wchar_deallocate(void*, wchar_t*, MSVCP_size_t);
85 MSVCP_size_t __stdcall MSVCP_allocator_wchar_max_size(void*);
87 /* class locale::facet */
88 typedef struct {
89 const vtable_ptr *vtable;
90 MSVCP_size_t refs;
91 } locale_facet;
93 typedef enum {
94 CODECVT_ok = 0,
95 CODECVT_partial = 1,
96 CODECVT_error = 2,
97 CODECVT_noconv = 3
98 } codecvt_base_result;
100 typedef struct {
101 LCID handle;
102 unsigned page;
103 const short *table;
104 int delfl;
105 } _Ctypevec;
107 /* class codecvt_base */
108 typedef struct {
109 locale_facet facet;
110 } codecvt_base;
112 /* class codecvt<char> */
113 typedef struct {
114 codecvt_base base;
115 } codecvt_char;
117 MSVCP_bool __thiscall codecvt_base_always_noconv(const codecvt_base*);
118 int __thiscall codecvt_char_unshift(const codecvt_char*, int*, char*, char*, char**);
119 int __thiscall codecvt_char_out(const codecvt_char*, int*, const char*,
120 const char*, const char**, char*, char*, char**);
121 int __thiscall codecvt_char_in(const codecvt_char*, int*, const char*,
122 const char*, const char**, char*, char*, char**);
123 int __thiscall codecvt_base_max_length(const codecvt_base*);
125 typedef struct {
126 LCID handle;
127 unsigned page;
128 } _Cvtvec;
130 /* class codecvt<wchar> */
131 typedef struct {
132 codecvt_base base;
133 _Cvtvec cvt;
134 } codecvt_wchar;
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* __thiscall locale_ctor(locale*);
169 locale* __thiscall locale_copy_ctor(locale*, const locale*);
170 locale* __thiscall locale_operator_assign(locale*, const locale*);
171 void __thiscall locale_dtor(locale*);
172 void free_locale(void);
173 codecvt_char* codecvt_char_use_facet(const locale*);
174 codecvt_char* codecvt_char_use_facet(const locale*);
175 ctype_char* ctype_char_use_facet(const locale*);
176 ctype_wchar* ctype_wchar_use_facet(const locale*);
178 /* class _Lockit */
179 typedef struct {
180 int locktype;
181 } _Lockit;
183 #define _LOCK_LOCALE 0
184 #define _LOCK_MALLOC 1
185 #define _LOCK_STREAM 2
186 #define _LOCK_DEBUG 3
187 #define _MAX_LOCK 4
189 void init_lockit(void);
190 void free_lockit(void);
191 _Lockit* __thiscall _Lockit_ctor_locktype(_Lockit*, int);
192 void __thiscall _Lockit_dtor(_Lockit*);
194 /* class mutex */
195 typedef struct {
196 void *mutex;
197 } mutex;
199 mutex* __thiscall mutex_ctor(mutex*);
200 void __thiscall mutex_dtor(mutex*);
201 void __thiscall mutex_lock(mutex*);
202 void __thiscall mutex_unlock(mutex*);
204 typedef enum {
205 FMTFLAG_skipws = 0x0001,
206 FMTFLAG_unitbuf = 0x0002,
207 FMTFLAG_uppercase = 0x0004,
208 FMTFLAG_showbase = 0x0008,
209 FMTFLAG_showpoint = 0x0010,
210 FMTFLAG_showpos = 0x0020,
211 FMTFLAG_left = 0x0040,
212 FMTFLAG_right = 0x0080,
213 FMTFLAG_internal = 0x0100,
214 FMTFLAG_dec = 0x0200,
215 FMTFLAG_oct = 0x0400,
216 FMTFLAG_hex = 0x0800,
217 FMTFLAG_scientific = 0x1000,
218 FMTFLAG_fixed = 0x2000,
219 FMTFLAG_hexfloat = 0x3000,
220 FMTFLAG_boolalpha = 0x4000,
221 FMTFLAG_stdio = 0x8000,
222 FMTFLAG_adjustfield = FMTFLAG_left|FMTFLAG_right|FMTFLAG_internal,
223 FMTFLAG_basefield = FMTFLAG_dec|FMTFLAG_oct|FMTFLAG_hex,
224 FMTFLAG_floatfield = FMTFLAG_scientific|FMTFLAG_fixed,
225 FMTFLAG_mask = 0xffff
226 } IOSB_fmtflags;
228 typedef enum {
229 OPENMODE_in = 0x01,
230 OPENMODE_out = 0x02,
231 OPENMODE_ate = 0x04,
232 OPENMODE_app = 0x08,
233 OPENMODE_trunc = 0x10,
234 OPENMODE__Nocreate = 0x40,
235 OPENMODE__Noreplace = 0x80,
236 OPENMODE_binary = 0x20,
237 OPENMODE_mask = 0xff
238 } IOSB_openmode;
240 typedef enum {
241 SEEKDIR_beg = 0x1,
242 SEEKDIR_cur = 0x2,
243 SEEKDIR_end = 0x3,
244 SEEKDIR_mask = 0x3
245 } IOSB_seekdir;
247 typedef enum {
248 IOSTATE_goodbit = 0x00,
249 IOSTATE_eofbit = 0x01,
250 IOSTATE_failbit = 0x02,
251 IOSTATE_badbit = 0x04,
252 IOSTATE__Hardfail = 0x10,
253 IOSTATE_mask = 0x17
254 } IOSB_iostate;
256 typedef struct _iosarray {
257 struct _iosarray *next;
258 int index;
259 int long_val;
260 void *ptr_val;
261 } IOS_BASE_iosarray;
263 typedef enum {
264 EVENT_erase_event,
265 EVENT_imbue_event,
266 EVENT_copyfmt_event
267 } IOS_BASE_event;
269 struct _ios_base;
270 typedef void (CDECL *IOS_BASE_event_callback)(IOS_BASE_event, struct _ios_base*, int);
271 typedef struct _fnarray {
272 struct _fnarray *next;
273 int index;
274 IOS_BASE_event_callback event_handler;
275 } IOS_BASE_fnarray;
277 /* class ios_base */
278 typedef struct _ios_base {
279 const vtable_ptr *vtable;
280 MSVCP_size_t stdstr;
281 IOSB_iostate state;
282 IOSB_iostate except;
283 IOSB_fmtflags fmtfl;
284 streamsize prec;
285 streamsize wide;
286 IOS_BASE_iosarray *arr;
287 IOS_BASE_fnarray *calls;
288 locale *loc;
289 } ios_base;
291 /* class basic_streambuf<char> */
292 typedef struct {
293 const vtable_ptr *vtable;
294 mutex lock;
295 char *rbuf;
296 char *wbuf;
297 char **prbuf;
298 char **pwbuf;
299 char *rpos;
300 char *wpos;
301 char **prpos;
302 char **pwpos;
303 int rsize;
304 int wsize;
305 int *prsize;
306 int *pwsize;
307 locale *loc;
308 } basic_streambuf_char;
310 typedef struct {
311 basic_streambuf_char *strbuf;
312 MSVCP_bool got;
313 char val;
314 } istreambuf_iterator_char;
316 typedef struct {
317 MSVCP_bool failed;
318 basic_streambuf_char *strbuf;
319 } ostreambuf_iterator_char;
321 int __thiscall basic_streambuf_char_sgetc(basic_streambuf_char*);
322 int __thiscall basic_streambuf_char_sbumpc(basic_streambuf_char*);
323 int __thiscall basic_streambuf_char_sputc(basic_streambuf_char*, char);
325 /* class basic_streambuf<wchar> */
326 typedef struct {
327 const vtable_ptr *vtable;
328 mutex lock;
329 wchar_t *rbuf;
330 wchar_t *wbuf;
331 wchar_t **prbuf;
332 wchar_t **pwbuf;
333 wchar_t *rpos;
334 wchar_t *wpos;
335 wchar_t **prpos;
336 wchar_t **pwpos;
337 int rsize;
338 int wsize;
339 int *prsize;
340 int *pwsize;
341 locale *loc;
342 } basic_streambuf_wchar;
344 typedef struct {
345 basic_streambuf_wchar *strbuf;
346 MSVCP_bool got;
347 wchar_t val;
348 } istreambuf_iterator_wchar;
350 typedef struct {
351 MSVCP_bool failed;
352 basic_streambuf_wchar *strbuf;
353 } ostreambuf_iterator_wchar;
355 unsigned short __thiscall basic_streambuf_wchar_sgetc(basic_streambuf_wchar*);
356 unsigned short __thiscall basic_streambuf_wchar_sbumpc(basic_streambuf_wchar*);
357 unsigned short __thiscall basic_streambuf_wchar_sputc(basic_streambuf_wchar*, wchar_t);
359 /* class num_get<char> */
360 typedef struct {
361 locale_facet facet;
362 _Cvtvec cvt;
363 } num_get;
365 num_get* num_get_char_use_facet(const locale*);
366 istreambuf_iterator_char* __thiscall num_get_char_get_long(const num_get*, istreambuf_iterator_char*,
367 istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, LONG*);
368 istreambuf_iterator_char* __thiscall num_get_char_get_ushort(const num_get*, istreambuf_iterator_char*,
369 istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, unsigned short*);
370 istreambuf_iterator_char* __thiscall num_get_char_get_uint(const num_get*, istreambuf_iterator_char*,
371 istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, unsigned int*);
372 istreambuf_iterator_char* __thiscall num_get_char_get_ulong(const num_get*, istreambuf_iterator_char*,
373 istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, ULONG*);
374 istreambuf_iterator_char* __thiscall num_get_char_get_float(const num_get*, istreambuf_iterator_char*,
375 istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, float*);
376 istreambuf_iterator_char *__thiscall num_get_char_get_double(const num_get*, istreambuf_iterator_char*,
377 istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, double*);
378 istreambuf_iterator_char *__thiscall num_get_char_get_ldouble(const num_get*, istreambuf_iterator_char*,
379 istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, double*);
380 istreambuf_iterator_char *__thiscall num_get_char_get_void(const num_get*, istreambuf_iterator_char*,
381 istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, void**);
382 istreambuf_iterator_char *__thiscall num_get_char_get_int64(const num_get*, istreambuf_iterator_char*,
383 istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, LONGLONG*);
384 istreambuf_iterator_char *__thiscall num_get_char_get_uint64(const num_get*, istreambuf_iterator_char*,
385 istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, ULONGLONG*);
386 istreambuf_iterator_char *__thiscall num_get_char_get_bool(const num_get*, istreambuf_iterator_char*,
387 istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, MSVCP_bool*);
389 num_get* num_get_wchar_use_facet(const locale*);
390 istreambuf_iterator_wchar* __thiscall num_get_wchar_get_long(const num_get*, istreambuf_iterator_wchar*,
391 istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, LONG*);
392 istreambuf_iterator_wchar* __thiscall num_get_wchar_get_ushort(const num_get*, istreambuf_iterator_wchar*,
393 istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, unsigned short*);
394 istreambuf_iterator_wchar* __thiscall num_get_wchar_get_uint(const num_get*, istreambuf_iterator_wchar*,
395 istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, unsigned int*);
396 istreambuf_iterator_wchar* __thiscall num_get_wchar_get_ulong(const num_get*, istreambuf_iterator_wchar*,
397 istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, ULONG*);
398 istreambuf_iterator_wchar* __thiscall num_get_wchar_get_float(const num_get*, istreambuf_iterator_wchar*,
399 istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, float*);
400 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_double(const num_get*, istreambuf_iterator_wchar*,
401 istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, double*);
402 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_ldouble(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_void(const num_get*, istreambuf_iterator_wchar*,
405 istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, void**);
406 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_int64(const num_get*, istreambuf_iterator_wchar*,
407 istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, LONGLONG*);
408 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_uint64(const num_get*, istreambuf_iterator_wchar*,
409 istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, ULONGLONG*);
410 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_bool(const num_get*, istreambuf_iterator_wchar*,
411 istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, MSVCP_bool*);
413 /* class num_put<char> */
414 /* class num_put<wchar> */
415 typedef struct {
416 locale_facet facet;
417 _Cvtvec cvt;
418 } num_put;
420 num_put* num_put_char_use_facet(const locale*);
421 ostreambuf_iterator_char* __thiscall num_put_char_put_long(const num_put*, ostreambuf_iterator_char*,
422 ostreambuf_iterator_char, ios_base*, char, LONG);
423 ostreambuf_iterator_char* __thiscall num_put_char_put_ulong(const num_put*, ostreambuf_iterator_char*,
424 ostreambuf_iterator_char, ios_base*, char, ULONG);
425 ostreambuf_iterator_char* __thiscall num_put_char_put_double(const num_put*, ostreambuf_iterator_char*,
426 ostreambuf_iterator_char, ios_base*, char, double);
427 ostreambuf_iterator_char* __thiscall num_put_char_put_ldouble(const num_put*, ostreambuf_iterator_char*,
428 ostreambuf_iterator_char, ios_base*, char, double);
429 ostreambuf_iterator_char* __thiscall num_put_char_put_ptr(const num_put*, ostreambuf_iterator_char*,
430 ostreambuf_iterator_char, ios_base*, char, const void*);
431 ostreambuf_iterator_char* __thiscall num_put_char_put_int64(const num_put*, ostreambuf_iterator_char*,
432 ostreambuf_iterator_char, ios_base*, char, __int64);
433 ostreambuf_iterator_char* __thiscall num_put_char_put_uint64(const num_put*, ostreambuf_iterator_char*,
434 ostreambuf_iterator_char, ios_base*, char, unsigned __int64);
435 ostreambuf_iterator_char* __thiscall num_put_char_put_bool(const num_put*, ostreambuf_iterator_char*,
436 ostreambuf_iterator_char, ios_base*, char, MSVCP_bool);
438 num_put* num_put_wchar_use_facet(const locale*);
439 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_long(const num_put*, ostreambuf_iterator_wchar*,
440 ostreambuf_iterator_wchar, ios_base*, wchar_t, LONG);
441 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_ulong(const num_put*, ostreambuf_iterator_wchar*,
442 ostreambuf_iterator_wchar, ios_base*, wchar_t, ULONG);
443 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_double(const num_put*, ostreambuf_iterator_wchar*,
444 ostreambuf_iterator_wchar, ios_base*, wchar_t, double);
445 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_ldouble(const num_put*, ostreambuf_iterator_wchar*,
446 ostreambuf_iterator_wchar, ios_base*, wchar_t, double);
447 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_ptr(const num_put*, ostreambuf_iterator_wchar*,
448 ostreambuf_iterator_wchar, ios_base*, wchar_t, const void*);
449 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_int64(const num_put*, ostreambuf_iterator_wchar*,
450 ostreambuf_iterator_wchar, ios_base*, wchar_t, __int64);
451 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_uint64(const num_put*, ostreambuf_iterator_wchar*,
452 ostreambuf_iterator_wchar, ios_base*, wchar_t, unsigned __int64);
453 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_bool(const num_put*, ostreambuf_iterator_wchar*,
454 ostreambuf_iterator_wchar, ios_base*, wchar_t, MSVCP_bool);
456 void init_io(void);
457 void free_io(void);