msvcp: Free facet and _Locimp in Locimp dtor.
[wine.git] / dlls / msvcp90 / locale.c
blobc581d9c37bb52a0f0470996c96e42f2b52c4b98d
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 "config.h"
21 #include <stdarg.h>
23 #include "msvcp90.h"
24 #include "locale.h"
25 #include "errno.h"
26 #include "limits.h"
27 #include "math.h"
28 #include "stdio.h"
30 #include "wine/list.h"
32 #include "windef.h"
33 #include "winbase.h"
34 #include "winnls.h"
35 #include "wine/unicode.h"
36 #include "wine/debug.h"
37 WINE_DEFAULT_DEBUG_CHANNEL(msvcp);
39 char* __cdecl _Getdays(void);
40 char* __cdecl _Getmonths(void);
41 void* __cdecl _Gettnames(void);
42 unsigned int __cdecl ___lc_codepage_func(void);
43 LCID* __cdecl ___lc_handle_func(void);
44 const locale_facet* __thiscall locale__Getfacet(const locale*, MSVCP_size_t);
46 typedef int category;
48 typedef struct {
49 MSVCP_size_t id;
50 } locale_id;
52 typedef struct _locale__Locimp {
53 locale_facet facet;
54 locale_facet **facetvec;
55 MSVCP_size_t facet_cnt;
56 category catmask;
57 MSVCP_bool transparent;
58 basic_string_char name;
59 } locale__Locimp;
61 typedef struct {
62 void *timeptr;
63 } _Timevec;
65 typedef struct {
66 _Lockit lock;
67 basic_string_char days;
68 basic_string_char months;
69 basic_string_char oldlocname;
70 basic_string_char newlocname;
71 } _Locinfo;
73 typedef struct {
74 LCID handle;
75 unsigned page;
76 } _Collvec;
78 typedef struct {
79 locale_facet facet;
80 _Collvec coll;
81 } collate;
83 typedef struct {
84 locale_facet facet;
85 const char *grouping;
86 char dp;
87 char sep;
88 const char *false_name;
89 const char *true_name;
90 } numpunct_char;
92 typedef struct {
93 locale_facet facet;
94 const char *grouping;
95 wchar_t dp;
96 wchar_t sep;
97 const wchar_t *false_name;
98 const wchar_t *true_name;
99 } numpunct_wchar;
101 /* ?_Id_cnt@id@locale@std@@0HA */
102 int locale_id__Id_cnt = 0;
104 static locale__Locimp *global_locale;
105 static locale classic_locale;
107 /* ?_Clocptr@_Locimp@locale@std@@0PAV123@A */
108 /* ?_Clocptr@_Locimp@locale@std@@0PEAV123@EA */
109 locale__Locimp *locale__Locimp__Clocptr = NULL;
111 static char istreambuf_iterator_char_val(istreambuf_iterator_char *this)
113 if(this->strbuf && !this->got) {
114 int c = basic_streambuf_char_sgetc(this->strbuf);
115 if(c == EOF)
116 this->strbuf = NULL;
117 else
118 this->val = c;
121 this->got = TRUE;
122 return this->val;
125 static wchar_t istreambuf_iterator_wchar_val(istreambuf_iterator_wchar *this)
127 if(this->strbuf && !this->got) {
128 unsigned short c = basic_streambuf_wchar_sgetc(this->strbuf);
129 if(c == WEOF)
130 this->strbuf = NULL;
131 else
132 this->val = c;
135 this->got = TRUE;
136 return this->val;
139 static void istreambuf_iterator_char_inc(istreambuf_iterator_char *this)
141 if(!this->strbuf || basic_streambuf_char_sbumpc(this->strbuf)==EOF) {
142 this->strbuf = NULL;
143 this->got = TRUE;
144 }else {
145 this->got = FALSE;
146 istreambuf_iterator_char_val(this);
150 static void istreambuf_iterator_wchar_inc(istreambuf_iterator_wchar *this)
152 if(!this->strbuf || basic_streambuf_wchar_sbumpc(this->strbuf)==WEOF) {
153 this->strbuf = NULL;
154 this->got = TRUE;
155 }else {
156 this->got = FALSE;
157 istreambuf_iterator_wchar_val(this);
161 static void ostreambuf_iterator_char_put(ostreambuf_iterator_char *this, char ch)
163 if(this->failed || basic_streambuf_char_sputc(this->strbuf, ch)==EOF)
164 this->failed = TRUE;
167 static void ostreambuf_iterator_wchar_put(ostreambuf_iterator_wchar *this, wchar_t ch)
169 if(this->failed || basic_streambuf_wchar_sputc(this->strbuf, ch)==WEOF)
170 this->failed = TRUE;
173 /* ??1facet@locale@std@@UAE@XZ */
174 /* ??1facet@locale@std@@UEAA@XZ */
175 DEFINE_THISCALL_WRAPPER(locale_facet_dtor, 4)
176 void __thiscall locale_facet_dtor(locale_facet *this)
178 TRACE("(%p)\n", this);
181 DEFINE_THISCALL_WRAPPER(locale_facet_vector_dtor, 8)
182 #define call_locale_facet_vector_dtor(this, flags) CALL_VTBL_FUNC(this, 0, \
183 locale_facet*, (locale_facet*, unsigned int), (this, flags))
184 locale_facet* __thiscall locale_facet_vector_dtor(locale_facet *this, unsigned int flags)
186 TRACE("(%p %x)\n", this, flags);
187 if(flags & 2) {
188 /* we have an array, with the number of elements stored before the first object */
189 INT_PTR i, *ptr = (INT_PTR *)this-1;
191 for(i=*ptr-1; i>=0; i--)
192 locale_facet_dtor(this+i);
193 MSVCRT_operator_delete(ptr);
194 } else {
195 locale_facet_dtor(this);
196 if(flags & 1)
197 MSVCRT_operator_delete(this);
200 return this;
203 typedef struct
205 locale_facet *fac;
206 struct list entry;
207 } facets_elem;
208 static struct list lazy_facets = LIST_INIT(lazy_facets);
210 /* Not exported from msvcp90 */
211 /* ?facet_Register@facet@locale@std@@CAXPAV123@@Z */
212 /* ?facet_Register@facet@locale@std@@CAXPEAV123@@Z */
213 void __cdecl locale_facet_register(locale_facet *add)
215 facets_elem *head = MSVCRT_operator_new(sizeof(*head));
216 if(!head) {
217 ERR("Out of memory\n");
218 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
221 head->fac = add;
222 list_add_head(&lazy_facets, &head->entry);
225 /* Not exported from msvcp90 */
226 /* ?_Register@facet@locale@std@@QAEXXZ */
227 /* ?_Register@facet@locale@std@@QEAAXXZ */
228 DEFINE_THISCALL_WRAPPER(locale_facet__Register, 4)
229 void __thiscall locale_facet__Register(locale_facet *this)
231 TRACE("(%p)\n", this);
232 locale_facet_register(this);
235 /* Not exported from msvcp90 */
236 /* ??_7facet@locale@std@@6B@ */
237 extern const vtable_ptr MSVCP_locale_facet_vtable;
239 /* ??0id@locale@std@@QAE@I@Z */
240 /* ??0id@locale@std@@QEAA@_K@Z */
241 DEFINE_THISCALL_WRAPPER(locale_id_ctor_id, 8)
242 locale_id* __thiscall locale_id_ctor_id(locale_id *this, MSVCP_size_t id)
244 TRACE("(%p %lu)\n", this, id);
246 this->id = id;
247 return this;
250 /* ??_Fid@locale@std@@QAEXXZ */
251 /* ??_Fid@locale@std@@QEAAXXZ */
252 DEFINE_THISCALL_WRAPPER(locale_id_ctor, 4)
253 locale_id* __thiscall locale_id_ctor(locale_id *this)
255 TRACE("(%p)\n", this);
257 this->id = 0;
258 return this;
261 /* ??Bid@locale@std@@QAEIXZ */
262 /* ??Bid@locale@std@@QEAA_KXZ */
263 DEFINE_THISCALL_WRAPPER(locale_id_operator_size_t, 4)
264 MSVCP_size_t __thiscall locale_id_operator_size_t(locale_id *this)
266 _Lockit lock;
268 TRACE("(%p)\n", this);
270 if(!this->id) {
271 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
272 this->id = ++locale_id__Id_cnt;
273 _Lockit_dtor(&lock);
276 return this->id;
279 /* ?_Id_cnt_func@id@locale@std@@CAAAHXZ */
280 /* ?_Id_cnt_func@id@locale@std@@CAAEAHXZ */
281 int* __cdecl locale_id__Id_cnt_func(void)
283 TRACE("\n");
284 return &locale_id__Id_cnt;
287 /* ??_Ffacet@locale@std@@QAEXXZ */
288 /* ??_Ffacet@locale@std@@QEAAXXZ */
289 DEFINE_THISCALL_WRAPPER(locale_facet_ctor, 4)
290 locale_facet* __thiscall locale_facet_ctor(locale_facet *this)
292 TRACE("(%p)\n", this);
293 this->vtable = &MSVCP_locale_facet_vtable;
294 this->refs = 0;
295 return this;
298 /* ??0facet@locale@std@@IAE@I@Z */
299 /* ??0facet@locale@std@@IEAA@_K@Z */
300 DEFINE_THISCALL_WRAPPER(locale_facet_ctor_refs, 8)
301 locale_facet* __thiscall locale_facet_ctor_refs(locale_facet *this, MSVCP_size_t refs)
303 TRACE("(%p %lu)\n", this, refs);
304 this->vtable = &MSVCP_locale_facet_vtable;
305 this->refs = refs;
306 return this;
309 /* ?_Incref@facet@locale@std@@QAEXXZ */
310 /* ?_Incref@facet@locale@std@@QEAAXXZ */
311 DEFINE_THISCALL_WRAPPER(locale_facet__Incref, 4)
312 void __thiscall locale_facet__Incref(locale_facet *this)
314 _Lockit lock;
316 TRACE("(%p)\n", this);
318 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
319 this->refs++;
320 _Lockit_dtor(&lock);
323 /* ?_Decref@facet@locale@std@@QAEPAV123@XZ */
324 /* ?_Decref@facet@locale@std@@QEAAPEAV123@XZ */
325 DEFINE_THISCALL_WRAPPER(locale_facet__Decref, 4)
326 locale_facet* __thiscall locale_facet__Decref(locale_facet *this)
328 _Lockit lock;
329 locale_facet *ret;
331 TRACE("(%p)\n", this);
333 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
334 if(this->refs)
335 this->refs--;
337 ret = this->refs ? NULL : this;
338 _Lockit_dtor(&lock);
340 return ret;
343 /* ?_Getcat@facet@locale@std@@SAIPAPBV123@PBV23@@Z */
344 /* ?_Getcat@facet@locale@std@@SA_KPEAPEBV123@PEBV23@@Z */
345 MSVCP_size_t __cdecl locale_facet__Getcat(const locale_facet **facet, const locale *loc)
347 TRACE("(%p %p)\n", facet, loc);
348 return -1;
351 /* ??0_Timevec@std@@QAE@ABV01@@Z */
352 /* ??0_Timevec@std@@QEAA@AEBV01@@Z */
353 /* This copy constructor modifies copied object */
354 DEFINE_THISCALL_WRAPPER(_Timevec_copy_ctor, 8)
355 _Timevec* __thiscall _Timevec_copy_ctor(_Timevec *this, _Timevec *copy)
357 TRACE("(%p %p)\n", this, copy);
358 this->timeptr = copy->timeptr;
359 copy->timeptr = NULL;
360 return this;
363 /* ??0_Timevec@std@@QAE@PAX@Z */
364 /* ??0_Timevec@std@@QEAA@PEAX@Z */
365 DEFINE_THISCALL_WRAPPER(_Timevec_ctor_timeptr, 8)
366 _Timevec* __thiscall _Timevec_ctor_timeptr(_Timevec *this, void *timeptr)
368 TRACE("(%p %p)\n", this, timeptr);
369 this->timeptr = timeptr;
370 return this;
373 /* ??_F_Timevec@std@@QAEXXZ */
374 /* ??_F_Timevec@std@@QEAAXXZ */
375 DEFINE_THISCALL_WRAPPER(_Timevec_ctor, 4)
376 _Timevec* __thiscall _Timevec_ctor(_Timevec *this)
378 TRACE("(%p)\n", this);
379 this->timeptr = NULL;
380 return this;
383 /* ??1_Timevec@std@@QAE@XZ */
384 /* ??1_Timevec@std@@QEAA@XZ */
385 DEFINE_THISCALL_WRAPPER(_Timevec_dtor, 4)
386 void __thiscall _Timevec_dtor(_Timevec *this)
388 TRACE("(%p)\n", this);
389 free(this->timeptr);
392 /* ??4_Timevec@std@@QAEAAV01@ABV01@@Z */
393 /* ??4_Timevec@std@@QEAAAEAV01@AEBV01@@Z */
394 DEFINE_THISCALL_WRAPPER(_Timevec_op_assign, 8)
395 _Timevec* __thiscall _Timevec_op_assign(_Timevec *this, _Timevec *right)
397 TRACE("(%p %p)\n", this, right);
398 this->timeptr = right->timeptr;
399 right->timeptr = NULL;
400 return this;
403 /* ?_Getptr@_Timevec@std@@QBEPAXXZ */
404 /* ?_Getptr@_Timevec@std@@QEBAPEAXXZ */
405 DEFINE_THISCALL_WRAPPER(_Timevec__Getptr, 4)
406 void* __thiscall _Timevec__Getptr(_Timevec *this)
408 TRACE("(%p)\n", this);
409 return this->timeptr;
412 /* ?_Locinfo_ctor@_Locinfo@std@@SAXPAV12@HPBD@Z */
413 /* ?_Locinfo_ctor@_Locinfo@std@@SAXPEAV12@HPEBD@Z */
414 _Locinfo* __cdecl _Locinfo__Locinfo_ctor_cat_cstr(_Locinfo *locinfo, int category, const char *locstr)
416 const char *locale = NULL;
418 /* This function is probably modifying more global objects */
419 FIXME("(%p %d %s) semi-stub\n", locinfo, category, locstr);
421 if(!locstr)
422 throw_exception(EXCEPTION_RUNTIME_ERROR, "bad locale name");
424 _Lockit_ctor_locktype(&locinfo->lock, _LOCK_LOCALE);
425 MSVCP_basic_string_char_ctor_cstr(&locinfo->days, "");
426 MSVCP_basic_string_char_ctor_cstr(&locinfo->months, "");
427 MSVCP_basic_string_char_ctor_cstr(&locinfo->oldlocname, setlocale(LC_ALL, NULL));
429 if(category)
430 locale = setlocale(LC_ALL, locstr);
431 else
432 locale = setlocale(LC_ALL, NULL);
434 if(locale)
435 MSVCP_basic_string_char_ctor_cstr(&locinfo->newlocname, locale);
436 else
437 MSVCP_basic_string_char_ctor_cstr(&locinfo->newlocname, "*");
439 return locinfo;
442 /* ??0_Locinfo@std@@QAE@HPBD@Z */
443 /* ??0_Locinfo@std@@QEAA@HPEBD@Z */
444 DEFINE_THISCALL_WRAPPER(_Locinfo_ctor_cat_cstr, 12)
445 _Locinfo* __thiscall _Locinfo_ctor_cat_cstr(_Locinfo *this, int category, const char *locstr)
447 return _Locinfo__Locinfo_ctor_cat_cstr(this, category, locstr);
450 /* ?_Locinfo_ctor@_Locinfo@std@@SAXPAV12@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@@Z */
451 /* ?_Locinfo_ctor@_Locinfo@std@@SAXPEAV12@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@@Z */
452 _Locinfo* __cdecl _Locinfo__Locinfo_ctor_bstr(_Locinfo *locinfo, const basic_string_char *locstr)
454 return _Locinfo__Locinfo_ctor_cat_cstr(locinfo, 1/*FIXME*/, MSVCP_basic_string_char_c_str(locstr));
457 /* ??0_Locinfo@std@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@@Z */
458 /* ??0_Locinfo@std@@QEAA@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@@Z */
459 DEFINE_THISCALL_WRAPPER(_Locinfo_ctor_bstr, 8)
460 _Locinfo* __thiscall _Locinfo_ctor_bstr(_Locinfo *this, const basic_string_char *locstr)
462 return _Locinfo__Locinfo_ctor_cat_cstr(this, 1/*FIXME*/, MSVCP_basic_string_char_c_str(locstr));
465 /* ?_Locinfo_ctor@_Locinfo@std@@SAXPAV12@PBD@Z */
466 /* ?_Locinfo_ctor@_Locinfo@std@@SAXPEAV12@PEBD@Z */
467 _Locinfo* __cdecl _Locinfo__Locinfo_ctor_cstr(_Locinfo *locinfo, const char *locstr)
469 return _Locinfo__Locinfo_ctor_cat_cstr(locinfo, 1/*FIXME*/, locstr);
472 /* ??0_Locinfo@std@@QAE@PBD@Z */
473 /* ??0_Locinfo@std@@QEAA@PEBD@Z */
474 DEFINE_THISCALL_WRAPPER(_Locinfo_ctor_cstr, 8)
475 _Locinfo* __thiscall _Locinfo_ctor_cstr(_Locinfo *this, const char *locstr)
477 return _Locinfo__Locinfo_ctor_cat_cstr(this, 1/*FIXME*/, locstr);
480 /* ?_Locinfo_dtor@_Locinfo@std@@SAXPAV12@@Z */
481 /* ?_Locinfo_dtor@_Locinfo@std@@SAXPEAV12@@Z */
482 void __cdecl _Locinfo__Locinfo_dtor(_Locinfo *locinfo)
484 TRACE("(%p)\n", locinfo);
486 setlocale(LC_ALL, MSVCP_basic_string_char_c_str(&locinfo->oldlocname));
487 MSVCP_basic_string_char_dtor(&locinfo->days);
488 MSVCP_basic_string_char_dtor(&locinfo->months);
489 MSVCP_basic_string_char_dtor(&locinfo->oldlocname);
490 MSVCP_basic_string_char_dtor(&locinfo->newlocname);
491 _Lockit_dtor(&locinfo->lock);
494 /* ??_F_Locinfo@std@@QAEXXZ */
495 /* ??_F_Locinfo@std@@QEAAXXZ */
496 DEFINE_THISCALL_WRAPPER(_Locinfo_ctor, 4)
497 _Locinfo* __thiscall _Locinfo_ctor(_Locinfo *this)
499 return _Locinfo__Locinfo_ctor_cat_cstr(this, 1/*FIXME*/, "C");
502 /* ??1_Locinfo@std@@QAE@XZ */
503 /* ??1_Locinfo@std@@QEAA@XZ */
504 DEFINE_THISCALL_WRAPPER(_Locinfo_dtor, 4)
505 void __thiscall _Locinfo_dtor(_Locinfo *this)
507 _Locinfo__Locinfo_dtor(this);
510 /* ?_Locinfo_Addcats@_Locinfo@std@@SAAAV12@PAV12@HPBD@Z */
511 /* ?_Locinfo_Addcats@_Locinfo@std@@SAAEAV12@PEAV12@HPEBD@Z */
512 _Locinfo* __cdecl _Locinfo__Locinfo_Addcats(_Locinfo *locinfo, int category, const char *locstr)
514 const char *locale = NULL;
516 /* This function is probably modifying more global objects */
517 FIXME("(%p %d %s) semi-stub\n", locinfo, category, locstr);
518 if(!locstr)
519 throw_exception(EXCEPTION_RUNTIME_ERROR, "bad locale name");
521 MSVCP_basic_string_char_dtor(&locinfo->newlocname);
523 if(category)
524 locale = setlocale(LC_ALL, locstr);
525 else
526 locale = setlocale(LC_ALL, NULL);
528 if(locale)
529 MSVCP_basic_string_char_ctor_cstr(&locinfo->newlocname, locale);
530 else
531 MSVCP_basic_string_char_ctor_cstr(&locinfo->newlocname, "*");
533 return locinfo;
536 /* ?_Addcats@_Locinfo@std@@QAEAAV12@HPBD@Z */
537 /* ?_Addcats@_Locinfo@std@@QEAAAEAV12@HPEBD@Z */
538 DEFINE_THISCALL_WRAPPER(_Locinfo__Addcats, 12)
539 _Locinfo* __thiscall _Locinfo__Addcats(_Locinfo *this, int category, const char *locstr)
541 return _Locinfo__Locinfo_Addcats(this, category, locstr);
544 /* _Getcoll */
545 ULONGLONG __cdecl _Getcoll(void)
547 union {
548 _Collvec collvec;
549 ULONGLONG ull;
550 } ret;
551 _locale_t locale = _get_current_locale();
553 TRACE("\n");
555 ret.collvec.page = locale->locinfo->lc_collate_cp;
556 ret.collvec.handle = locale->locinfo->lc_handle[LC_COLLATE];
557 _free_locale(locale);
558 return ret.ull;
561 /* ?_Getcoll@_Locinfo@std@@QBE?AU_Collvec@@XZ */
562 /* ?_Getcoll@_Locinfo@std@@QEBA?AU_Collvec@@XZ */
563 DEFINE_THISCALL_WRAPPER(_Locinfo__Getcoll, 8)
564 _Collvec* __thiscall _Locinfo__Getcoll(const _Locinfo *this, _Collvec *ret)
566 ULONGLONG ull = _Getcoll();
567 memcpy(ret, &ull, sizeof(ull));
568 return ret;
571 /* _Getctype */
572 _Ctypevec* __cdecl _Getctype(_Ctypevec *ret)
574 _locale_t locale = _get_current_locale();
575 short *table;
577 TRACE("\n");
579 ret->page = locale->locinfo->lc_codepage;
580 ret->handle = locale->locinfo->lc_handle[LC_COLLATE];
581 ret->delfl = TRUE;
582 table = malloc(sizeof(short[256]));
583 if(!table) {
584 _free_locale(locale);
585 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
587 memcpy(table, locale->locinfo->pctype, sizeof(short[256]));
588 ret->table = table;
589 _free_locale(locale);
590 return ret;
593 /* ?_Getctype@_Locinfo@std@@QBE?AU_Ctypevec@@XZ */
594 /* ?_Getctype@_Locinfo@std@@QEBA?AU_Ctypevec@@XZ */
595 DEFINE_THISCALL_WRAPPER(_Locinfo__Getctype, 8)
596 _Ctypevec* __thiscall _Locinfo__Getctype(const _Locinfo *this, _Ctypevec *ret)
598 return _Getctype(ret);
601 /* _Getcvt */
602 ULONGLONG __cdecl _Getcvt(void)
604 _locale_t locale = _get_current_locale();
605 union {
606 _Cvtvec cvtvec;
607 ULONGLONG ull;
608 } ret;
610 TRACE("\n");
612 ret.cvtvec.page = locale->locinfo->lc_codepage;
613 ret.cvtvec.handle = locale->locinfo->lc_handle[LC_CTYPE];
614 _free_locale(locale);
615 return ret.ull;
618 /* ?_Getcvt@_Locinfo@std@@QBE?AU_Cvtvec@@XZ */
619 /* ?_Getcvt@_Locinfo@std@@QEBA?AU_Cvtvec@@XZ */
620 DEFINE_THISCALL_WRAPPER(_Locinfo__Getcvt, 8)
621 _Cvtvec* __thiscall _Locinfo__Getcvt(const _Locinfo *this, _Cvtvec *ret)
623 ULONGLONG ull = _Getcvt();
624 memcpy(ret, &ull, sizeof(ull));
625 return ret;
628 /* ?_Getdateorder@_Locinfo@std@@QBEHXZ */
629 /* ?_Getdateorder@_Locinfo@std@@QEBAHXZ */
630 DEFINE_THISCALL_WRAPPER(_Locinfo__Getdateorder, 4)
631 int __thiscall _Locinfo__Getdateorder(const _Locinfo *this)
633 FIXME("(%p) stub\n", this);
634 return 0;
637 /* ?_Getdays@_Locinfo@std@@QBEPBDXZ */
638 /* ?_Getdays@_Locinfo@std@@QEBAPEBDXZ */
639 DEFINE_THISCALL_WRAPPER(_Locinfo__Getdays, 4)
640 const char* __thiscall _Locinfo__Getdays(_Locinfo *this)
642 char *days = _Getdays();
644 TRACE("(%p)\n", this);
646 if(days) {
647 MSVCP_basic_string_char_dtor(&this->days);
648 MSVCP_basic_string_char_ctor_cstr(&this->days, days);
649 free(days);
652 return this->days.size ? MSVCP_basic_string_char_c_str(&this->days) :
653 ":Sun:Sunday:Mon:Monday:Tue:Tuesday:Wed:Wednesday:Thu:Thursday:Fri:Friday:Sat:Saturday";
656 /* ?_Getmonths@_Locinfo@std@@QBEPBDXZ */
657 /* ?_Getmonths@_Locinfo@std@@QEBAPEBDXZ */
658 DEFINE_THISCALL_WRAPPER(_Locinfo__Getmonths, 4)
659 const char* __thiscall _Locinfo__Getmonths(_Locinfo *this)
661 char *months = _Getmonths();
663 TRACE("(%p)\n", this);
665 if(months) {
666 MSVCP_basic_string_char_dtor(&this->months);
667 MSVCP_basic_string_char_ctor_cstr(&this->months, months);
668 free(months);
671 return this->months.size ? MSVCP_basic_string_char_c_str(&this->months) :
672 ":Jan:January:Feb:February:Mar:March:Apr:April:May:May:Jun:June:Jul:July"
673 ":Aug:August:Sep:September:Oct:October:Nov:November:Dec:December";
676 /* ?_Getfalse@_Locinfo@std@@QBEPBDXZ */
677 /* ?_Getfalse@_Locinfo@std@@QEBAPEBDXZ */
678 DEFINE_THISCALL_WRAPPER(_Locinfo__Getfalse, 4)
679 const char* __thiscall _Locinfo__Getfalse(const _Locinfo *this)
681 TRACE("(%p)\n", this);
682 return "false";
685 /* ?_Gettrue@_Locinfo@std@@QBEPBDXZ */
686 /* ?_Gettrue@_Locinfo@std@@QEBAPEBDXZ */
687 DEFINE_THISCALL_WRAPPER(_Locinfo__Gettrue, 4)
688 const char* __thiscall _Locinfo__Gettrue(const _Locinfo *this)
690 TRACE("(%p)\n", this);
691 return "true";
694 /* ?_Getlconv@_Locinfo@std@@QBEPBUlconv@@XZ */
695 /* ?_Getlconv@_Locinfo@std@@QEBAPEBUlconv@@XZ */
696 DEFINE_THISCALL_WRAPPER(_Locinfo__Getlconv, 4)
697 const struct lconv* __thiscall _Locinfo__Getlconv(const _Locinfo *this)
699 TRACE("(%p)\n", this);
700 return localeconv();
703 /* ?_Getname@_Locinfo@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
704 /* ?_Getname@_Locinfo@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
705 DEFINE_THISCALL_WRAPPER(_Locinfo__Getname, 8)
706 basic_string_char* __thiscall _Locinfo__Getname(const _Locinfo *this, basic_string_char *ret)
708 TRACE("(%p)\n", this);
710 MSVCP_basic_string_char_copy_ctor(ret, &this->newlocname);
711 return ret;
714 /* ?_Gettnames@_Locinfo@std@@QBE?AV_Timevec@2@XZ */
715 /* ?_Gettnames@_Locinfo@std@@QEBA?AV_Timevec@2@XZ */
716 DEFINE_THISCALL_WRAPPER(_Locinfo__Gettnames, 8)
717 _Timevec*__thiscall _Locinfo__Gettnames(const _Locinfo *this, _Timevec *ret)
719 TRACE("(%p)\n", this);
721 _Timevec_ctor_timeptr(ret, _Gettnames());
722 return ret;
725 /* ?id@?$collate@D@std@@2V0locale@2@A */
726 locale_id collate_char_id = {0};
728 /* ??_7?$collate@D@std@@6B@ */
729 extern const vtable_ptr MSVCP_collate_char_vtable;
731 /* ?_Init@?$collate@D@std@@IAEXABV_Locinfo@2@@Z */
732 /* ?_Init@?$collate@D@std@@IEAAXAEBV_Locinfo@2@@Z */
733 DEFINE_THISCALL_WRAPPER(collate_char__Init, 8)
734 void __thiscall collate_char__Init(collate *this, const _Locinfo *locinfo)
736 TRACE("(%p %p)\n", this, locinfo);
737 _Locinfo__Getcoll(locinfo, &this->coll);
740 /* ??0?$collate@D@std@@IAE@PBDI@Z */
741 /* ??0?$collate@D@std@@IEAA@PEBD_K@Z */
742 DEFINE_THISCALL_WRAPPER(collate_char_ctor_name, 12)
743 collate* __thiscall collate_char_ctor_name(collate *this, const char *name, MSVCP_size_t refs)
745 _Locinfo locinfo;
747 TRACE("(%p %s %lu)\n", this, name, refs);
749 locale_facet_ctor_refs(&this->facet, refs);
750 this->facet.vtable = &MSVCP_collate_char_vtable;
752 _Locinfo_ctor_cstr(&locinfo, name);
753 collate_char__Init(this, &locinfo);
754 _Locinfo_dtor(&locinfo);
755 return this;
758 /* ??0?$collate@D@std@@QAE@ABV_Locinfo@1@I@Z */
759 /* ??0?$collate@D@std@@QEAA@AEBV_Locinfo@1@_K@Z */
760 DEFINE_THISCALL_WRAPPER(collate_char_ctor_locinfo, 12)
761 collate* __thiscall collate_char_ctor_locinfo(collate *this, _Locinfo *locinfo, MSVCP_size_t refs)
763 TRACE("(%p %p %lu)\n", this, locinfo, refs);
765 locale_facet_ctor_refs(&this->facet, refs);
766 this->facet.vtable = &MSVCP_collate_char_vtable;
767 collate_char__Init(this, locinfo);
768 return this;
771 /* ??0?$collate@D@std@@QAE@I@Z */
772 /* ??0?$collate@D@std@@QEAA@_K@Z */
773 DEFINE_THISCALL_WRAPPER(collate_char_ctor_refs, 8)
774 collate* __thiscall collate_char_ctor_refs(collate *this, MSVCP_size_t refs)
776 return collate_char_ctor_name(this, "C", refs);
779 /* ??1?$collate@D@std@@MAE@XZ */
780 /* ??1?$collate@D@std@@MEAA@XZ */
781 DEFINE_THISCALL_WRAPPER(collate_char_dtor, 4)
782 void __thiscall collate_char_dtor(collate *this)
784 TRACE("(%p)\n", this);
787 DEFINE_THISCALL_WRAPPER(collate_char_vector_dtor, 8)
788 collate* __thiscall collate_char_vector_dtor(collate *this, unsigned int flags)
790 TRACE("(%p %x)\n", this, flags);
791 if(flags & 2) {
792 /* we have an array, with the number of elements stored before the first object */
793 INT_PTR i, *ptr = (INT_PTR *)this-1;
795 for(i=*ptr-1; i>=0; i--)
796 collate_char_dtor(this+i);
797 MSVCRT_operator_delete(ptr);
798 } else {
799 collate_char_dtor(this);
800 if(flags & 1)
801 MSVCRT_operator_delete(this);
804 return this;
807 /* ??_F?$collate@D@std@@QAEXXZ */
808 /* ??_F?$collate@D@std@@QEAAXXZ */
809 DEFINE_THISCALL_WRAPPER(collate_char_ctor, 4)
810 collate* __thiscall collate_char_ctor(collate *this)
812 return collate_char_ctor_name(this, "C", 0);
815 /* ?_Getcat@?$collate@D@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
816 /* ?_Getcat@?$collate@D@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
817 MSVCP_size_t __cdecl collate_char__Getcat(const locale_facet **facet, const locale *loc)
819 TRACE("(%p %p)\n", facet, loc);
821 if(facet && !*facet) {
822 *facet = MSVCRT_operator_new(sizeof(collate));
823 if(!*facet) {
824 ERR("Out of memory\n");
825 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
826 return 0;
828 collate_char_ctor_name((collate*)*facet,
829 MSVCP_basic_string_char_c_str(&loc->ptr->name), 0);
832 return LC_COLLATE;
835 /* _Strcoll */
836 int __cdecl _Strcoll(const char *first1, const char *last1, const char *first2,
837 const char *last2, const _Collvec *coll)
839 LCID lcid;
841 TRACE("(%s %s)\n", debugstr_an(first1, last1-first1), debugstr_an(first2, last2-first2));
843 if(coll)
844 lcid = coll->handle;
845 else
846 lcid = ___lc_handle_func()[LC_COLLATE];
847 return CompareStringA(lcid, 0, first1, last1-first1, first2, last2-first2)-CSTR_EQUAL;
850 /* ?do_compare@?$collate@D@std@@MBEHPBD000@Z */
851 /* ?do_compare@?$collate@D@std@@MEBAHPEBD000@Z */
852 DEFINE_THISCALL_WRAPPER(collate_char_do_compare, 20)
853 #define call_collate_char_do_compare(this, first1, last1, first2, last2) CALL_VTBL_FUNC(this, 4, int, \
854 (const collate*, const char*, const char*, const char*, const char*), \
855 (this, first1, last1, first2, last2))
856 int __thiscall collate_char_do_compare(const collate *this, const char *first1,
857 const char *last1, const char *first2, const char *last2)
859 TRACE("(%p %p %p %p %p)\n", this, first1, last1, first2, last2);
860 return _Strcoll(first1, last1, first2, last2, &this->coll);
863 /* ?compare@?$collate@D@std@@QBEHPBD000@Z */
864 /* ?compare@?$collate@D@std@@QEBAHPEBD000@Z */
865 DEFINE_THISCALL_WRAPPER(collate_char_compare, 20)
866 int __thiscall collate_char_compare(const collate *this, const char *first1,
867 const char *last1, const char *first2, const char *last2)
869 TRACE("(%p %p %p %p %p)\n", this, first1, last1, first2, last2);
870 return call_collate_char_do_compare(this, first1, last1, first2, last2);
873 /* ?do_hash@?$collate@D@std@@MBEJPBD0@Z */
874 /* ?do_hash@?$collate@D@std@@MEBAJPEBD0@Z */
875 DEFINE_THISCALL_WRAPPER(collate_char_do_hash, 12)
876 #define call_collate_char_do_hash(this, first, last) CALL_VTBL_FUNC(this, 12, LONG, \
877 (const collate*, const char*, const char*), (this, first, last))
878 LONG __thiscall collate_char_do_hash(const collate *this,
879 const char *first, const char *last)
881 ULONG ret = 0;
883 TRACE("(%p %p %p)\n", this, first, last);
885 for(; first<last; first++)
886 ret = (ret<<8 | ret>>24) + *first;
887 return ret;
890 /* ?hash@?$collate@D@std@@QBEJPBD0@Z */
891 /* ?hash@?$collate@D@std@@QEBAJPEBD0@Z */
892 DEFINE_THISCALL_WRAPPER(collate_char_hash, 12)
893 LONG __thiscall collate_char_hash(const collate *this,
894 const char *first, const char *last)
896 TRACE("(%p %p %p)\n", this, first, last);
897 return call_collate_char_do_hash(this, first, last);
900 /* ?do_transform@?$collate@D@std@@MBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@PBD0@Z */
901 /* ?do_transform@?$collate@D@std@@MEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@PEBD0@Z */
902 DEFINE_THISCALL_WRAPPER(collate_char_do_transform, 16)
903 basic_string_char* __thiscall collate_char_do_transform(const collate *this,
904 basic_string_char *ret, const char *first, const char *last)
906 FIXME("(%p %p %p) stub\n", this, first, last);
907 return ret;
910 /* ?transform@?$collate@D@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@PBD0@Z */
911 /* ?transform@?$collate@D@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@PEBD0@Z */
912 DEFINE_THISCALL_WRAPPER(collate_char_transform, 16)
913 basic_string_char* __thiscall collate_char_transform(const collate *this,
914 basic_string_char *ret, const char *first, const char *last)
916 FIXME("(%p %p %p) stub\n", this, first, last);
917 return ret;
920 /* ?id@?$collate@_W@std@@2V0locale@2@A */
921 locale_id collate_wchar_id = {0};
922 /* ?id@?$collate@G@std@@2V0locale@2@A */
923 locale_id collate_short_id = {0};
925 /* ??_7?$collate@_W@std@@6B@ */
926 extern const vtable_ptr MSVCP_collate_wchar_vtable;
927 /* ??_7?$collate@G@std@@6B@ */
928 extern const vtable_ptr MSVCP_collate_short_vtable;
930 /* ?_Init@?$collate@_W@std@@IAEXABV_Locinfo@2@@Z */
931 /* ?_Init@?$collate@_W@std@@IEAAXAEBV_Locinfo@2@@Z */
932 /* ?_Init@?$collate@G@std@@IAEXABV_Locinfo@2@@Z */
933 /* ?_Init@?$collate@G@std@@IEAAXAEBV_Locinfo@2@@Z */
934 DEFINE_THISCALL_WRAPPER(collate_wchar__Init, 8)
935 void __thiscall collate_wchar__Init(collate *this, const _Locinfo *locinfo)
937 TRACE("(%p %p)\n", this, locinfo);
938 _Locinfo__Getcoll(locinfo, &this->coll);
941 /* ??0?$collate@_W@std@@IAE@PBDI@Z */
942 /* ??0?$collate@_W@std@@IEAA@PEBD_K@Z */
943 DEFINE_THISCALL_WRAPPER(collate_wchar_ctor_name, 12)
944 collate* __thiscall collate_wchar_ctor_name(collate *this, const char *name, MSVCP_size_t refs)
946 _Locinfo locinfo;
948 TRACE("(%p %s %lu)\n", this, name, refs);
950 locale_facet_ctor_refs(&this->facet, refs);
951 this->facet.vtable = &MSVCP_collate_wchar_vtable;
953 _Locinfo_ctor_cstr(&locinfo, name);
954 collate_wchar__Init(this, &locinfo);
955 _Locinfo_dtor(&locinfo);
956 return this;
959 /* ??0?$collate@G@std@@IAE@PBDI@Z */
960 /* ??0?$collate@G@std@@IEAA@PEBD_K@Z */
961 DEFINE_THISCALL_WRAPPER(collate_short_ctor_name, 12)
962 collate* __thiscall collate_short_ctor_name(collate *this, const char *name, MSVCP_size_t refs)
964 collate *ret = collate_wchar_ctor_name(this, name, refs);
965 ret->facet.vtable = &MSVCP_collate_short_vtable;
966 return ret;
969 /* ??0?$collate@_W@std@@QAE@ABV_Locinfo@1@I@Z */
970 /* ??0?$collate@_W@std@@QEAA@AEBV_Locinfo@1@_K@Z */
971 DEFINE_THISCALL_WRAPPER(collate_wchar_ctor_locinfo, 12)
972 collate* __thiscall collate_wchar_ctor_locinfo(collate *this, _Locinfo *locinfo, MSVCP_size_t refs)
974 TRACE("(%p %p %lu)\n", this, locinfo, refs);
976 locale_facet_ctor_refs(&this->facet, refs);
977 this->facet.vtable = &MSVCP_collate_wchar_vtable;
978 collate_wchar__Init(this, locinfo);
979 return this;
982 /* ??0?$collate@G@std@@QAE@ABV_Locinfo@1@I@Z */
983 /* ??0?$collate@G@std@@QEAA@AEBV_Locinfo@1@_K@Z */
984 DEFINE_THISCALL_WRAPPER(collate_short_ctor_locinfo, 12)
985 collate* __thiscall collate_short_ctor_locinfo(collate *this, _Locinfo *locinfo, MSVCP_size_t refs)
987 collate *ret = collate_wchar_ctor_locinfo(this, locinfo, refs);
988 ret->facet.vtable = &MSVCP_collate_short_vtable;
989 return ret;
992 /* ??0?$collate@_W@std@@QAE@I@Z */
993 /* ??0?$collate@_W@std@@QEAA@_K@Z */
994 DEFINE_THISCALL_WRAPPER(collate_wchar_ctor_refs, 8)
995 collate* __thiscall collate_wchar_ctor_refs(collate *this, MSVCP_size_t refs)
997 return collate_wchar_ctor_name(this, "C", refs);
1000 /* ??0?$collate@G@std@@QAE@I@Z */
1001 /* ??0?$collate@G@std@@QEAA@_K@Z */
1002 DEFINE_THISCALL_WRAPPER(collate_short_ctor_refs, 8)
1003 collate* __thiscall collate_short_ctor_refs(collate *this, MSVCP_size_t refs)
1005 collate *ret = collate_wchar_ctor_refs(this, refs);
1006 ret->facet.vtable = &MSVCP_collate_short_vtable;
1007 return ret;
1010 /* ??1?$collate@_W@std@@MAE@XZ */
1011 /* ??1?$collate@_W@std@@MEAA@XZ */
1012 /* ??1?$collate@G@std@@MAE@XZ */
1013 /* ??1?$collate@G@std@@MEAA@XZ */
1014 DEFINE_THISCALL_WRAPPER(collate_wchar_dtor, 4)
1015 void __thiscall collate_wchar_dtor(collate *this)
1017 TRACE("(%p)\n", this);
1020 DEFINE_THISCALL_WRAPPER(collate_wchar_vector_dtor, 8)
1021 collate* __thiscall collate_wchar_vector_dtor(collate *this, unsigned int flags)
1023 TRACE("(%p %x)\n", this, flags);
1024 if(flags & 2) {
1025 /* we have an array, with the number of elements stored before the first object */
1026 INT_PTR i, *ptr = (INT_PTR *)this-1;
1028 for(i=*ptr-1; i>=0; i--)
1029 collate_wchar_dtor(this+i);
1030 MSVCRT_operator_delete(ptr);
1031 } else {
1032 collate_wchar_dtor(this);
1033 if(flags & 1)
1034 MSVCRT_operator_delete(this);
1037 return this;
1040 /* ??_F?$collate@_W@std@@QAEXXZ */
1041 /* ??_F?$collate@_W@std@@QEAAXXZ */
1042 DEFINE_THISCALL_WRAPPER(collate_wchar_ctor, 4)
1043 collate* __thiscall collate_wchar_ctor(collate *this)
1045 return collate_wchar_ctor_name(this, "C", 0);
1048 /* ??_F?$collate@G@std@@QAEXXZ */
1049 /* ??_F?$collate@G@std@@QEAAXXZ */
1050 DEFINE_THISCALL_WRAPPER(collate_short_ctor, 4)
1051 collate* __thiscall collate_short_ctor(collate *this)
1053 collate *ret = collate_wchar_ctor(this);
1054 ret->facet.vtable = &MSVCP_collate_short_vtable;
1055 return ret;
1058 /* ?_Getcat@?$collate@_W@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
1059 /* ?_Getcat@?$collate@_W@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
1060 MSVCP_size_t __cdecl collate_wchar__Getcat(const locale_facet **facet, const locale *loc)
1062 TRACE("(%p %p)\n", facet, loc);
1064 if(facet && !*facet) {
1065 *facet = MSVCRT_operator_new(sizeof(collate));
1066 if(!*facet) {
1067 ERR("Out of memory\n");
1068 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
1069 return 0;
1071 collate_wchar_ctor_name((collate*)*facet,
1072 MSVCP_basic_string_char_c_str(&loc->ptr->name), 0);
1075 return LC_COLLATE;
1078 /* ?_Getcat@?$collate@G@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
1079 /* ?_Getcat@?$collate@G@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
1080 MSVCP_size_t __cdecl collate_short__Getcat(const locale_facet **facet, const locale *loc)
1082 if(facet && !*facet) {
1083 collate_wchar__Getcat(facet, loc);
1084 (*(locale_facet**)facet)->vtable = &MSVCP_collate_short_vtable;
1087 return LC_COLLATE;
1090 /* _Wcscoll */
1091 int __cdecl _Wcscoll(const wchar_t *first1, const wchar_t *last1, const wchar_t *first2,
1092 const wchar_t *last2, const _Collvec *coll)
1094 LCID lcid;
1096 TRACE("(%s %s)\n", debugstr_wn(first1, last1-first1), debugstr_wn(first2, last2-first2));
1098 if(coll)
1099 lcid = coll->handle;
1100 else
1101 lcid = ___lc_handle_func()[LC_COLLATE];
1102 return CompareStringW(lcid, 0, first1, last1-first1, first2, last2-first2)-CSTR_EQUAL;
1105 /* ?do_compare@?$collate@_W@std@@MBEHPB_W000@Z */
1106 /* ?do_compare@?$collate@_W@std@@MEBAHPEB_W000@Z */
1107 /* ?do_compare@?$collate@G@std@@MBEHPBG000@Z */
1108 /* ?do_compare@?$collate@G@std@@MEBAHPEBG000@Z */
1109 DEFINE_THISCALL_WRAPPER(collate_wchar_do_compare, 20)
1110 #define call_collate_wchar_do_compare(this, first1, last1, first2, last2) CALL_VTBL_FUNC(this, 4, int, \
1111 (const collate*, const wchar_t*, const wchar_t*, const wchar_t*, const wchar_t*), \
1112 (this, first1, last1, first2, last2))
1113 int __thiscall collate_wchar_do_compare(const collate *this, const wchar_t *first1,
1114 const wchar_t *last1, const wchar_t *first2, const wchar_t *last2)
1116 TRACE("(%p %p %p %p %p)\n", this, first1, last1, first2, last2);
1117 return _Wcscoll(first1, last1, first2, last2, &this->coll);
1120 /* ?compare@?$collate@_W@std@@QBEHPB_W000@Z */
1121 /* ?compare@?$collate@_W@std@@QEBAHPEB_W000@Z */
1122 /* ?compare@?$collate@G@std@@QBEHPBG000@Z */
1123 /* ?compare@?$collate@G@std@@QEBAHPEBG000@Z */
1124 DEFINE_THISCALL_WRAPPER(collate_wchar_compare, 20)
1125 int __thiscall collate_wchar_compare(const collate *this, const wchar_t *first1,
1126 const wchar_t *last1, const wchar_t *first2, const wchar_t *last2)
1128 TRACE("(%p %p %p %p %p)\n", this, first1, last1, first2, last2);
1129 return call_collate_wchar_do_compare(this, first1, last1, first2, last2);
1132 /* ?do_hash@?$collate@_W@std@@MBEJPB_W0@Z */
1133 /* ?do_hash@?$collate@_W@std@@MEBAJPEB_W0@Z */
1134 /* ?do_hash@?$collate@G@std@@MBEJPBG0@Z */
1135 /* ?do_hash@?$collate@G@std@@MEBAJPEBG0@Z */
1136 DEFINE_THISCALL_WRAPPER(collate_wchar_do_hash, 12)
1137 #define call_collate_wchar_do_hash(this, first, last) CALL_VTBL_FUNC(this, 12, LONG, \
1138 (const collate*, const wchar_t*, const wchar_t*), (this, first, last))
1139 LONG __thiscall collate_wchar_do_hash(const collate *this,
1140 const wchar_t *first, const wchar_t *last)
1142 ULONG ret = 0;
1144 TRACE("(%p %p %p)\n", this, first, last);
1146 for(; first<last; first++)
1147 ret = (ret<<8 | ret>>24) + *first;
1148 return ret;
1151 /* ?hash@?$collate@_W@std@@QBEJPB_W0@Z */
1152 /* ?hash@?$collate@_W@std@@QEBAJPEB_W0@Z */
1153 /* ?hash@?$collate@G@std@@QBEJPBG0@Z */
1154 /* ?hash@?$collate@G@std@@QEBAJPEBG0@Z */
1155 DEFINE_THISCALL_WRAPPER(collate_wchar_hash, 12)
1156 LONG __thiscall collate_wchar_hash(const collate *this,
1157 const wchar_t *first, const wchar_t *last)
1159 TRACE("(%p %p %p)\n", this, first, last);
1160 return call_collate_wchar_do_hash(this, first, last);
1163 /* ?do_transform@?$collate@_W@std@@MBE?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@PB_W0@Z */
1164 /* ?do_transform@?$collate@_W@std@@MEBA?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@PEB_W0@Z */
1165 /* ?do_transform@?$collate@G@std@@MBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@PBG0@Z */
1166 /* ?do_transform@?$collate@G@std@@MEBA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@PEBG0@Z */
1167 DEFINE_THISCALL_WRAPPER(collate_wchar_do_transform, 16)
1168 basic_string_wchar* __thiscall collate_wchar_do_transform(const collate *this,
1169 basic_string_wchar *ret, const wchar_t *first, const wchar_t *last)
1171 FIXME("(%p %p %p) stub\n", this, first, last);
1172 return ret;
1175 /* ?transform@?$collate@_W@std@@QBE?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@PB_W0@Z */
1176 /* ?transform@?$collate@_W@std@@QEBA?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@PEB_W0@Z */
1177 /* ?transform@?$collate@G@std@@QBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@PBG0@Z */
1178 /* ?transform@?$collate@G@std@@QEBA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@PEBG0@Z */
1179 DEFINE_THISCALL_WRAPPER(collate_wchar_transform, 16)
1180 basic_string_wchar* __thiscall collate_wchar_transform(const collate *this,
1181 basic_string_wchar *ret, const wchar_t *first, const wchar_t *last)
1183 FIXME("(%p %p %p) stub\n", this, first, last);
1184 return ret;
1187 /* ??_7ctype_base@std@@6B@ */
1188 extern const vtable_ptr MSVCP_ctype_base_vtable;
1190 /* ??0ctype_base@std@@QAE@I@Z */
1191 /* ??0ctype_base@std@@QEAA@_K@Z */
1192 DEFINE_THISCALL_WRAPPER(ctype_base_ctor_refs, 8)
1193 ctype_base* __thiscall ctype_base_ctor_refs(ctype_base *this, MSVCP_size_t refs)
1195 TRACE("(%p %lu)\n", this, refs);
1196 locale_facet_ctor_refs(&this->facet, refs);
1197 this->facet.vtable = &MSVCP_ctype_base_vtable;
1198 return this;
1201 /* ??_Fctype_base@std@@QAEXXZ */
1202 /* ??_Fctype_base@std@@QEAAXXZ */
1203 DEFINE_THISCALL_WRAPPER(ctype_base_ctor, 4)
1204 ctype_base* __thiscall ctype_base_ctor(ctype_base *this)
1206 TRACE("(%p)\n", this);
1207 locale_facet_ctor_refs(&this->facet, 0);
1208 this->facet.vtable = &MSVCP_ctype_base_vtable;
1209 return this;
1212 /* ??1ctype_base@std@@UAE@XZ */
1213 /* ??1ctype_base@std@@UEAA@XZ */
1214 DEFINE_THISCALL_WRAPPER(ctype_base_dtor, 4)
1215 void __thiscall ctype_base_dtor(ctype_base *this)
1217 TRACE("(%p)\n", this);
1220 DEFINE_THISCALL_WRAPPER(ctype_base_vector_dtor, 8)
1221 ctype_base* __thiscall ctype_base_vector_dtor(ctype_base *this, unsigned int flags)
1223 TRACE("(%p %x)\n", this, flags);
1224 if(flags & 2) {
1225 /* we have an array, with the number of elements stored before the first object */
1226 INT_PTR i, *ptr = (INT_PTR *)this-1;
1228 for(i=*ptr-1; i>=0; i--)
1229 ctype_base_dtor(this+i);
1230 MSVCRT_operator_delete(ptr);
1231 } else {
1232 ctype_base_dtor(this);
1233 if(flags & 1)
1234 MSVCRT_operator_delete(this);
1237 return this;
1240 /* ?_Xran@ctype_base@std@@KAXXZ */
1241 void __cdecl ctype_base__Xran(void)
1243 throw_exception(EXCEPTION_OUT_OF_RANGE, "out of range in ctype<T>");
1246 /* ?id@?$ctype@D@std@@2V0locale@2@A */
1247 locale_id ctype_char_id = {0};
1248 /* ?table_size@?$ctype@D@std@@2IB */
1249 /* ?table_size@?$ctype@D@std@@2_KB */
1250 MSVCP_size_t ctype_char_table_size = 256;
1252 /* ??_7?$ctype@D@std@@6B@ */
1253 extern const vtable_ptr MSVCP_ctype_char_vtable;
1255 /* ?_Id_func@?$ctype@D@std@@SAAAVid@locale@2@XZ */
1256 /* ?_Id_func@?$ctype@D@std@@SAAEAVid@locale@2@XZ */
1257 locale_id* __cdecl ctype_char__Id_func(void)
1259 TRACE("()\n");
1260 return &ctype_char_id;
1263 /* ?_Init@?$ctype@D@std@@IAEXABV_Locinfo@2@@Z */
1264 /* ?_Init@?$ctype@D@std@@IEAAXAEBV_Locinfo@2@@Z */
1265 DEFINE_THISCALL_WRAPPER(ctype_char__Init, 8)
1266 void __thiscall ctype_char__Init(ctype_char *this, const _Locinfo *locinfo)
1268 TRACE("(%p %p)\n", this, locinfo);
1269 _Locinfo__Getctype(locinfo, &this->ctype);
1272 /* ?_Tidy@?$ctype@D@std@@IAEXXZ */
1273 /* ?_Tidy@?$ctype@D@std@@IEAAXXZ */
1274 DEFINE_THISCALL_WRAPPER(ctype_char__Tidy, 4)
1275 void __thiscall ctype_char__Tidy(ctype_char *this)
1277 TRACE("(%p)\n", this);
1279 if(this->ctype.delfl)
1280 free((short*)this->ctype.table);
1283 /* ?classic_table@?$ctype@D@std@@KAPBFXZ */
1284 /* ?classic_table@?$ctype@D@std@@KAPEBFXZ */
1285 const short* __cdecl ctype_char_classic_table(void)
1287 TRACE("()\n");
1288 return &((short*)GetProcAddress(GetModuleHandleA("msvcrt.dll"), "_ctype"))[1];
1291 /* ??0?$ctype@D@std@@QAE@ABV_Locinfo@1@I@Z */
1292 /* ??0?$ctype@D@std@@QEAA@AEBV_Locinfo@1@_K@Z */
1293 DEFINE_THISCALL_WRAPPER(ctype_char_ctor_locinfo, 12)
1294 ctype_char* __thiscall ctype_char_ctor_locinfo(ctype_char *this,
1295 const _Locinfo *locinfo, MSVCP_size_t refs)
1297 TRACE("(%p %p %lu)\n", this, locinfo, refs);
1298 ctype_base_ctor_refs(&this->base, refs);
1299 this->base.facet.vtable = &MSVCP_ctype_char_vtable;
1300 ctype_char__Init(this, locinfo);
1301 return this;
1304 /* ??0?$ctype@D@std@@QAE@PBF_NI@Z */
1305 /* ??0?$ctype@D@std@@QEAA@PEBF_N_K@Z */
1306 DEFINE_THISCALL_WRAPPER(ctype_char_ctor_table, 16)
1307 ctype_char* __thiscall ctype_char_ctor_table(ctype_char *this,
1308 const short *table, MSVCP_bool delete, MSVCP_size_t refs)
1310 _Locinfo locinfo;
1312 TRACE("(%p %p %d %lu)\n", this, table, delete, refs);
1314 ctype_base_ctor_refs(&this->base, refs);
1315 this->base.facet.vtable = &MSVCP_ctype_char_vtable;
1317 _Locinfo_ctor(&locinfo);
1318 ctype_char__Init(this, &locinfo);
1319 _Locinfo_dtor(&locinfo);
1321 if(table) {
1322 ctype_char__Tidy(this);
1323 this->ctype.table = table;
1324 this->ctype.delfl = delete;
1326 return this;
1329 /* ??_F?$ctype@D@std@@QAEXXZ */
1330 /* ??_F?$ctype@D@std@@QEAAXXZ */
1331 DEFINE_THISCALL_WRAPPER(ctype_char_ctor, 4)
1332 ctype_char* __thiscall ctype_char_ctor(ctype_char *this)
1334 return ctype_char_ctor_table(this, NULL, FALSE, 0);
1337 /* ??1?$ctype@D@std@@MAE@XZ */
1338 /* ??1?$ctype@D@std@@MEAA@XZ */
1339 DEFINE_THISCALL_WRAPPER(ctype_char_dtor, 4)
1340 void __thiscall ctype_char_dtor(ctype_char *this)
1342 TRACE("(%p)\n", this);
1343 ctype_char__Tidy(this);
1346 DEFINE_THISCALL_WRAPPER(ctype_char_vector_dtor, 8)
1347 ctype_char* __thiscall ctype_char_vector_dtor(ctype_char *this, unsigned int flags)
1349 TRACE("(%p %x)\n", this, flags);
1350 if(flags & 2) {
1351 /* we have an array, with the number of elements stored before the first object */
1352 INT_PTR i, *ptr = (INT_PTR *)this-1;
1354 for(i=*ptr-1; i>=0; i--)
1355 ctype_char_dtor(this+i);
1356 MSVCRT_operator_delete(ptr);
1357 } else {
1358 ctype_char_dtor(this);
1359 if(flags & 1)
1360 MSVCRT_operator_delete(this);
1363 return this;
1366 /* ?do_narrow@?$ctype@D@std@@MBEDDD@Z */
1367 /* ?do_narrow@?$ctype@D@std@@MEBADDD@Z */
1368 DEFINE_THISCALL_WRAPPER(ctype_char_do_narrow_ch, 12)
1369 #define call_ctype_char_do_narrow_ch(this, ch, unused) CALL_VTBL_FUNC(this, 36, \
1370 char, (const ctype_char*, char, char), (this, ch, unused))
1371 char __thiscall ctype_char_do_narrow_ch(const ctype_char *this, char ch, char unused)
1373 TRACE("(%p %c %c)\n", this, ch, unused);
1374 return ch;
1377 /* ?do_narrow@?$ctype@D@std@@MBEPBDPBD0DPAD@Z */
1378 /* ?do_narrow@?$ctype@D@std@@MEBAPEBDPEBD0DPEAD@Z */
1379 DEFINE_THISCALL_WRAPPER(ctype_char_do_narrow, 20)
1380 #define call_ctype_char_do_narrow(this, first, last, unused, dest) CALL_VTBL_FUNC(this, 32, \
1381 const char*, (const ctype_char*, const char*, const char*, char, char*), \
1382 (this, first, last, unused, dest))
1383 const char* __thiscall ctype_char_do_narrow(const ctype_char *this,
1384 const char *first, const char *last, char unused, char *dest)
1386 TRACE("(%p %p %p %p)\n", this, first, last, dest);
1387 memcpy(dest, first, last-first);
1388 return last;
1391 /* ?_Do_narrow_s@?$ctype@D@std@@MBEPBDPBD0DPADI@Z */
1392 /* ?_Do_narrow_s@?$ctype@D@std@@MEBAPEBDPEBD0DPEAD_K@Z */
1393 DEFINE_THISCALL_WRAPPER(ctype_char__Do_narrow_s, 24)
1394 #define call_ctype_char__Do_narrow_s(this, first, last, unused, dest, size) CALL_VTBL_FUNC(this, 40, \
1395 const char*, (const ctype_char*, const char*, const char*, char, char*, MSVCP_size_t), \
1396 (this, first, last, unused, dest, size))
1397 const char* __thiscall ctype_char__Do_narrow_s(const ctype_char *this, const char *first,
1398 const char *last, char unused, char *dest, MSVCP_size_t size)
1400 TRACE("(%p %p %p %p %lu)\n", this, first, last, dest, size);
1401 memcpy_s(dest, size, first, last-first);
1402 return last;
1405 /* ?narrow@?$ctype@D@std@@QBEDDD@Z */
1406 /* ?narrow@?$ctype@D@std@@QEBADDD@Z */
1407 DEFINE_THISCALL_WRAPPER(ctype_char_narrow_ch, 12)
1408 char __thiscall ctype_char_narrow_ch(const ctype_char *this, char ch, char dflt)
1410 TRACE("(%p %c %c)\n", this, ch, dflt);
1411 return call_ctype_char_do_narrow_ch(this, ch, dflt);
1414 /* ?narrow@?$ctype@D@std@@QBEPBDPBD0DPAD@Z */
1415 /* ?narrow@?$ctype@D@std@@QEBAPEBDPEBD0DPEAD@Z */
1416 DEFINE_THISCALL_WRAPPER(ctype_char_narrow, 20)
1417 const char* __thiscall ctype_char_narrow(const ctype_char *this,
1418 const char *first, const char *last, char dflt, char *dest)
1420 TRACE("(%p %p %p %c %p)\n", this, first, last, dflt, dest);
1421 return call_ctype_char_do_narrow(this, first, last, dflt, dest);
1424 /* ?_Narrow_s@?$ctype@D@std@@QBEPBDPBD0DPADI@Z */
1425 /* ?_Narrow_s@?$ctype@D@std@@QEBAPEBDPEBD0DPEAD_K@Z */
1426 DEFINE_THISCALL_WRAPPER(ctype_char__Narrow_s, 24)
1427 const char* __thiscall ctype_char__Narrow_s(const ctype_char *this, const char *first,
1428 const char *last, char dflt, char *dest, MSVCP_size_t size)
1430 TRACE("(%p %p %p %p %lu)\n", this, first, last, dest, size);
1431 return call_ctype_char__Do_narrow_s(this, first, last, dflt, dest, size);
1434 /* ?do_widen@?$ctype@D@std@@MBEDD@Z */
1435 /* ?do_widen@?$ctype@D@std@@MEBADD@Z */
1436 DEFINE_THISCALL_WRAPPER(ctype_char_do_widen_ch, 8)
1437 #define call_ctype_char_do_widen_ch(this, ch) CALL_VTBL_FUNC(this, 24, \
1438 char, (const ctype_char*, char), (this, ch))
1439 char __thiscall ctype_char_do_widen_ch(const ctype_char *this, char ch)
1441 TRACE("(%p %c)\n", this, ch);
1442 return ch;
1445 /* ?do_widen@?$ctype@D@std@@MBEPBDPBD0PAD@Z */
1446 /* ?do_widen@?$ctype@D@std@@MEBAPEBDPEBD0PEAD@Z */
1447 DEFINE_THISCALL_WRAPPER(ctype_char_do_widen, 16)
1448 #define call_ctype_char_do_widen(this, first, last, dest) CALL_VTBL_FUNC(this, 20, \
1449 const char*, (const ctype_char*, const char*, const char*, char*), \
1450 (this, first, last, dest))
1451 const char* __thiscall ctype_char_do_widen(const ctype_char *this,
1452 const char *first, const char *last, char *dest)
1454 TRACE("(%p %p %p %p)\n", this, first, last, dest);
1455 memcpy(dest, first, last-first);
1456 return last;
1459 /* ?_Do_widen_s@?$ctype@D@std@@MBEPBDPBD0PADI@Z */
1460 /* ?_Do_widen_s@?$ctype@D@std@@MEBAPEBDPEBD0PEAD_K@Z */
1461 DEFINE_THISCALL_WRAPPER(ctype_char__Do_widen_s, 20)
1462 #define call_ctype_char__Do_widen_s(this, first, last, dest, size) CALL_VTBL_FUNC(this, 28, \
1463 const char*, (const ctype_char*, const char*, const char*, char*, MSVCP_size_t), \
1464 (this, first, last, dest, size))
1465 const char* __thiscall ctype_char__Do_widen_s(const ctype_char *this,
1466 const char *first, const char *last, char *dest, MSVCP_size_t size)
1468 TRACE("(%p %p %p %p %lu)\n", this, first, last, dest, size);
1469 memcpy_s(dest, size, first, last-first);
1470 return last;
1473 /* ?widen@?$ctype@D@std@@QBEDD@Z */
1474 /* ?widen@?$ctype@D@std@@QEBADD@Z */
1475 DEFINE_THISCALL_WRAPPER(ctype_char_widen_ch, 8)
1476 char __thiscall ctype_char_widen_ch(const ctype_char *this, char ch)
1478 TRACE("(%p %c)\n", this, ch);
1479 return call_ctype_char_do_widen_ch(this, ch);
1482 /* ?widen@?$ctype@D@std@@QBEPBDPBD0PAD@Z */
1483 /* ?widen@?$ctype@D@std@@QEBAPEBDPEBD0PEAD@Z */
1484 DEFINE_THISCALL_WRAPPER(ctype_char_widen, 16)
1485 const char* __thiscall ctype_char_widen(const ctype_char *this,
1486 const char *first, const char *last, char *dest)
1488 TRACE("(%p %p %p %p)\n", this, first, last, dest);
1489 return call_ctype_char_do_widen(this, first, last, dest);
1492 /* ?_Widen_s@?$ctype@D@std@@QBEPBDPBD0PADI@Z */
1493 /* ?_Widen_s@?$ctype@D@std@@QEBAPEBDPEBD0PEAD_K@Z */
1494 DEFINE_THISCALL_WRAPPER(ctype_char__Widen_s, 20)
1495 const char* __thiscall ctype_char__Widen_s(const ctype_char *this,
1496 const char *first, const char *last, char *dest, MSVCP_size_t size)
1498 TRACE("(%p %p %p %p %lu)\n", this, first, last, dest, size);
1499 return call_ctype_char__Do_widen_s(this, first, last, dest, size);
1502 /* ?_Getcat@?$ctype@D@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
1503 /* ?_Getcat@?$ctype@D@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
1504 MSVCP_size_t __cdecl ctype_char__Getcat(const locale_facet **facet, const locale *loc)
1506 TRACE("(%p %p)\n", facet, loc);
1508 if(facet && !*facet) {
1509 _Locinfo locinfo;
1511 *facet = MSVCRT_operator_new(sizeof(ctype_char));
1512 if(!*facet) {
1513 ERR("Out of memory\n");
1514 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
1515 return 0;
1518 _Locinfo_ctor_cstr(&locinfo, MSVCP_basic_string_char_c_str(&loc->ptr->name));
1519 ctype_char_ctor_locinfo((ctype_char*)*facet, &locinfo, 0);
1520 _Locinfo_dtor(&locinfo);
1523 return LC_CTYPE;
1526 ctype_char* ctype_char_use_facet(const locale *loc)
1528 static ctype_char *obj = NULL;
1530 _Lockit lock;
1531 const locale_facet *fac;
1533 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
1534 fac = locale__Getfacet(loc, locale_id_operator_size_t(&ctype_char_id));
1535 if(fac) {
1536 _Lockit_dtor(&lock);
1537 return (ctype_char*)fac;
1540 if(obj) {
1541 _Lockit_dtor(&lock);
1542 return obj;
1545 ctype_char__Getcat(&fac, loc);
1546 obj = (ctype_char*)fac;
1547 locale_facet__Incref(&obj->base.facet);
1548 locale_facet_register(&obj->base.facet);
1549 _Lockit_dtor(&lock);
1551 return obj;
1554 /* _Tolower */
1555 int __cdecl _Tolower(int ch, const _Ctypevec *ctype)
1557 unsigned int cp;
1559 TRACE("%d %p\n", ch, ctype);
1561 if(ctype)
1562 cp = ctype->page;
1563 else
1564 cp = ___lc_codepage_func();
1566 /* Don't convert to unicode in case of C locale */
1567 if(!cp) {
1568 if(ch>='A' && ch<='Z')
1569 ch = ch-'A'+'a';
1570 return ch;
1571 } else {
1572 WCHAR wide, lower;
1573 char str[2];
1574 int size;
1576 if(ch > 255) {
1577 str[0] = (ch>>8) & 255;
1578 str[1] = ch & 255;
1579 size = 2;
1580 } else {
1581 str[0] = ch & 255;
1582 size = 1;
1585 if(!MultiByteToWideChar(cp, MB_ERR_INVALID_CHARS, str, size, &wide, 1))
1586 return ch;
1588 lower = tolowerW(wide);
1589 if(lower == wide)
1590 return ch;
1592 WideCharToMultiByte(cp, 0, &lower, 1, str, 2, NULL, NULL);
1594 return str[0] + (str[1]<<8);
1598 /* ?do_tolower@?$ctype@D@std@@MBEDD@Z */
1599 /* ?do_tolower@?$ctype@D@std@@MEBADD@Z */
1600 #define call_ctype_char_do_tolower_ch(this, ch) CALL_VTBL_FUNC(this, 8, \
1601 char, (const ctype_char*, char), (this, ch))
1602 DEFINE_THISCALL_WRAPPER(ctype_char_do_tolower_ch, 8)
1603 char __thiscall ctype_char_do_tolower_ch(const ctype_char *this, char ch)
1605 TRACE("(%p %c)\n", this, ch);
1606 return _Tolower(ch, &this->ctype);
1609 /* ?do_tolower@?$ctype@D@std@@MBEPBDPADPBD@Z */
1610 /* ?do_tolower@?$ctype@D@std@@MEBAPEBDPEADPEBD@Z */
1611 #define call_ctype_char_do_tolower(this, first, last) CALL_VTBL_FUNC(this, 4, \
1612 const char*, (const ctype_char*, char*, const char*), (this, first, last))
1613 DEFINE_THISCALL_WRAPPER(ctype_char_do_tolower, 12)
1614 const char* __thiscall ctype_char_do_tolower(const ctype_char *this, char *first, const char *last)
1616 TRACE("(%p %p %p)\n", this, first, last);
1617 for(; first<last; first++)
1618 *first = _Tolower(*first, &this->ctype);
1619 return last;
1622 /* ?tolower@?$ctype@D@std@@QBEDD@Z */
1623 /* ?tolower@?$ctype@D@std@@QEBADD@Z */
1624 DEFINE_THISCALL_WRAPPER(ctype_char_tolower_ch, 8)
1625 char __thiscall ctype_char_tolower_ch(const ctype_char *this, char ch)
1627 TRACE("(%p %c)\n", this, ch);
1628 return call_ctype_char_do_tolower_ch(this, ch);
1631 /* ?tolower@?$ctype@D@std@@QBEPBDPADPBD@Z */
1632 /* ?tolower@?$ctype@D@std@@QEBAPEBDPEADPEBD@Z */
1633 DEFINE_THISCALL_WRAPPER(ctype_char_tolower, 12)
1634 const char* __thiscall ctype_char_tolower(const ctype_char *this, char *first, const char *last)
1636 TRACE("(%p %p %p)\n", this, first, last);
1637 return call_ctype_char_do_tolower(this, first, last);
1640 /* _Toupper */
1641 int __cdecl _Toupper(int ch, const _Ctypevec *ctype)
1643 unsigned int cp;
1645 TRACE("%d %p\n", ch, ctype);
1647 if(ctype)
1648 cp = ctype->page;
1649 else
1650 cp = ___lc_codepage_func();
1652 /* Don't convert to unicode in case of C locale */
1653 if(!cp) {
1654 if(ch>='a' && ch<='z')
1655 ch = ch-'a'+'A';
1656 return ch;
1657 } else {
1658 WCHAR wide, upper;
1659 char str[2];
1660 int size;
1662 if(ch > 255) {
1663 str[0] = (ch>>8) & 255;
1664 str[1] = ch & 255;
1665 size = 2;
1666 } else {
1667 str[0] = ch & 255;
1668 size = 1;
1671 if(!MultiByteToWideChar(cp, MB_ERR_INVALID_CHARS, str, size, &wide, 1))
1672 return ch;
1674 upper = toupperW(wide);
1675 if(upper == wide)
1676 return ch;
1678 WideCharToMultiByte(cp, 0, &upper, 1, str, 2, NULL, NULL);
1680 return str[0] + (str[1]<<8);
1684 /* ?do_toupper@?$ctype@D@std@@MBEDD@Z */
1685 /* ?do_toupper@?$ctype@D@std@@MEBADD@Z */
1686 #define call_ctype_char_do_toupper_ch(this, ch) CALL_VTBL_FUNC(this, 16, \
1687 char, (const ctype_char*, char), (this, ch))
1688 DEFINE_THISCALL_WRAPPER(ctype_char_do_toupper_ch, 8)
1689 char __thiscall ctype_char_do_toupper_ch(const ctype_char *this, char ch)
1691 TRACE("(%p %c)\n", this, ch);
1692 return _Toupper(ch, &this->ctype);
1695 /* ?do_toupper@?$ctype@D@std@@MBEPBDPADPBD@Z */
1696 /* ?do_toupper@?$ctype@D@std@@MEBAPEBDPEADPEBD@Z */
1697 #define call_ctype_char_do_toupper(this, first, last) CALL_VTBL_FUNC(this, 12, \
1698 const char*, (const ctype_char*, char*, const char*), (this, first, last))
1699 DEFINE_THISCALL_WRAPPER(ctype_char_do_toupper, 12)
1700 const char* __thiscall ctype_char_do_toupper(const ctype_char *this,
1701 char *first, const char *last)
1703 TRACE("(%p %p %p)\n", this, first, last);
1704 for(; first<last; first++)
1705 *first = _Toupper(*first, &this->ctype);
1706 return last;
1709 /* ?toupper@?$ctype@D@std@@QBEDD@Z */
1710 /* ?toupper@?$ctype@D@std@@QEBADD@Z */
1711 DEFINE_THISCALL_WRAPPER(ctype_char_toupper_ch, 8)
1712 char __thiscall ctype_char_toupper_ch(const ctype_char *this, char ch)
1714 TRACE("(%p %c)\n", this, ch);
1715 return call_ctype_char_do_toupper_ch(this, ch);
1718 /* ?toupper@?$ctype@D@std@@QBEPBDPADPBD@Z */
1719 /* ?toupper@?$ctype@D@std@@QEBAPEBDPEADPEBD@Z */
1720 DEFINE_THISCALL_WRAPPER(ctype_char_toupper, 12)
1721 const char* __thiscall ctype_char_toupper(const ctype_char *this, char *first, const char *last)
1723 TRACE("(%p %p %p)\n", this, first, last);
1724 return call_ctype_char_do_toupper(this, first, last);
1727 /* ?is@?$ctype@D@std@@QBE_NFD@Z */
1728 /* ?is@?$ctype@D@std@@QEBA_NFD@Z */
1729 DEFINE_THISCALL_WRAPPER(ctype_char_is_ch, 12)
1730 MSVCP_bool __thiscall ctype_char_is_ch(const ctype_char *this, short mask, char ch)
1732 TRACE("(%p %x %c)\n", this, mask, ch);
1733 return (this->ctype.table[(unsigned char)ch] & mask) != 0;
1736 /* ?is@?$ctype@D@std@@QBEPBDPBD0PAF@Z */
1737 /* ?is@?$ctype@D@std@@QEBAPEBDPEBD0PEAF@Z */
1738 DEFINE_THISCALL_WRAPPER(ctype_char_is, 16)
1739 const char* __thiscall ctype_char_is(const ctype_char *this, const char *first, const char *last, short *dest)
1741 TRACE("(%p %p %p %p)\n", this, first, last, dest);
1742 for(; first<last; first++)
1743 *dest++ = this->ctype.table[(unsigned char)*first];
1744 return last;
1747 /* ?scan_is@?$ctype@D@std@@QBEPBDFPBD0@Z */
1748 /* ?scan_is@?$ctype@D@std@@QEBAPEBDFPEBD0@Z */
1749 DEFINE_THISCALL_WRAPPER(ctype_char_scan_is, 16)
1750 const char* __thiscall ctype_char_scan_is(const ctype_char *this, short mask, const char *first, const char *last)
1752 TRACE("(%p %x %p %p)\n", this, mask, first, last);
1753 for(; first<last; first++)
1754 if(!ctype_char_is_ch(this, mask, *first))
1755 break;
1756 return first;
1759 /* ?scan_not@?$ctype@D@std@@QBEPBDFPBD0@Z */
1760 /* ?scan_not@?$ctype@D@std@@QEBAPEBDFPEBD0@Z */
1761 DEFINE_THISCALL_WRAPPER(ctype_char_scan_not, 16)
1762 const char* __thiscall ctype_char_scan_not(const ctype_char *this, short mask, const char *first, const char *last)
1764 TRACE("(%p %x %p %p)\n", this, mask, first, last);
1765 for(; first<last; first++)
1766 if(ctype_char_is_ch(this, mask, *first))
1767 break;
1768 return first;
1771 /* ?table@?$ctype@D@std@@IBEPBFXZ */
1772 /* ?table@?$ctype@D@std@@IEBAPEBFXZ */
1773 DEFINE_THISCALL_WRAPPER(ctype_char_table, 4)
1774 const short* __thiscall ctype_char_table(const ctype_char *this)
1776 TRACE("(%p)\n", this);
1777 return this->ctype.table;
1780 /* ?id@?$ctype@_W@std@@2V0locale@2@A */
1781 locale_id ctype_wchar_id = {0};
1782 /* ?id@?$ctype@G@std@@2V0locale@2@A */
1783 locale_id ctype_short_id = {0};
1785 /* ??_7?$ctype@_W@std@@6B@ */
1786 extern const vtable_ptr MSVCP_ctype_wchar_vtable;
1787 /* ??_7?$ctype@G@std@@6B@ */
1788 extern const vtable_ptr MSVCP_ctype_short_vtable;
1790 /* ?_Id_func@?$ctype@_W@std@@SAAAVid@locale@2@XZ */
1791 /* ?_Id_func@?$ctype@_W@std@@SAAEAVid@locale@2@XZ */
1792 locale_id* __cdecl ctype_wchar__Id_func(void)
1794 TRACE("()\n");
1795 return &ctype_wchar_id;
1798 /* ?_Id_func@?$ctype@G@std@@SAAAVid@locale@2@XZ */
1799 /* ?_Id_func@?$ctype@G@std@@SAAEAVid@locale@2@XZ */
1800 locale_id* __cdecl ctype_short__Id_func(void)
1802 TRACE("()\n");
1803 return &ctype_short_id;
1806 /* ?_Init@?$ctype@_W@std@@IAEXABV_Locinfo@2@@Z */
1807 /* ?_Init@?$ctype@_W@std@@IEAAXAEBV_Locinfo@2@@Z */
1808 /* ?_Init@?$ctype@G@std@@IAEXABV_Locinfo@2@@Z */
1809 /* ?_Init@?$ctype@G@std@@IEAAXAEBV_Locinfo@2@@Z */
1810 DEFINE_THISCALL_WRAPPER(ctype_wchar__Init, 8)
1811 void __thiscall ctype_wchar__Init(ctype_wchar *this, const _Locinfo *locinfo)
1813 TRACE("(%p %p)\n", this, locinfo);
1814 _Locinfo__Getctype(locinfo, &this->ctype);
1815 _Locinfo__Getcvt(locinfo, &this->cvt);
1818 /* ??0?$ctype@_W@std@@QAE@ABV_Locinfo@1@I@Z */
1819 /* ??0?$ctype@_W@std@@QEAA@AEBV_Locinfo@1@_K@Z */
1820 DEFINE_THISCALL_WRAPPER(ctype_wchar_ctor_locinfo, 12)
1821 ctype_wchar* __thiscall ctype_wchar_ctor_locinfo(ctype_wchar *this,
1822 const _Locinfo *locinfo, MSVCP_size_t refs)
1824 TRACE("(%p %p %lu)\n", this, locinfo, refs);
1825 ctype_base_ctor_refs(&this->base, refs);
1826 this->base.facet.vtable = &MSVCP_ctype_wchar_vtable;
1827 ctype_wchar__Init(this, locinfo);
1828 return this;
1831 /* ??0?$ctype@G@std@@QAE@ABV_Locinfo@1@I@Z */
1832 /* ??0?$ctype@G@std@@QEAA@AEBV_Locinfo@1@_K@Z */
1833 DEFINE_THISCALL_WRAPPER(ctype_short_ctor_locinfo, 12)
1834 ctype_wchar* __thiscall ctype_short_ctor_locinfo(ctype_wchar *this,
1835 const _Locinfo *locinfo, MSVCP_size_t refs)
1837 ctype_wchar *ret = ctype_wchar_ctor_locinfo(this, locinfo, refs);
1838 this->base.facet.vtable = &MSVCP_ctype_short_vtable;
1839 return ret;
1842 /* ??0?$ctype@_W@std@@QAE@I@Z */
1843 /* ??0?$ctype@_W@std@@QEAA@_K@Z */
1844 DEFINE_THISCALL_WRAPPER(ctype_wchar_ctor_refs, 8)
1845 ctype_wchar* __thiscall ctype_wchar_ctor_refs(ctype_wchar *this, MSVCP_size_t refs)
1847 _Locinfo locinfo;
1849 TRACE("(%p %lu)\n", this, refs);
1851 ctype_base_ctor_refs(&this->base, refs);
1852 this->base.facet.vtable = &MSVCP_ctype_wchar_vtable;
1854 _Locinfo_ctor(&locinfo);
1855 ctype_wchar__Init(this, &locinfo);
1856 _Locinfo_dtor(&locinfo);
1857 return this;
1860 /* ??0?$ctype@G@std@@QAE@I@Z */
1861 /* ??0?$ctype@G@std@@QEAA@_K@Z */
1862 DEFINE_THISCALL_WRAPPER(ctype_short_ctor_refs, 8)
1863 ctype_wchar* __thiscall ctype_short_ctor_refs(ctype_wchar *this, MSVCP_size_t refs)
1865 ctype_wchar *ret = ctype_wchar_ctor_refs(this, refs);
1866 this->base.facet.vtable = &MSVCP_ctype_short_vtable;
1867 return ret;
1870 /* ??0?$ctype@G@std@@IAE@PBDI@Z */
1871 /* ??0?$ctype@G@std@@IEAA@PEBD_K@Z */
1872 DEFINE_THISCALL_WRAPPER(ctype_short_ctor_name, 12)
1873 ctype_wchar* __thiscall ctype_short_ctor_name(ctype_wchar *this,
1874 const char *name, MSVCP_size_t refs)
1876 _Locinfo locinfo;
1878 TRACE("(%p %s %lu)\n", this, debugstr_a(name), refs);
1880 ctype_base_ctor_refs(&this->base, refs);
1881 this->base.facet.vtable = &MSVCP_ctype_short_vtable;
1883 _Locinfo_ctor_cstr(&locinfo, name);
1884 ctype_wchar__Init(this, &locinfo);
1885 _Locinfo_dtor(&locinfo);
1886 return this;
1889 /* ??_F?$ctype@_W@std@@QAEXXZ */
1890 /* ??_F?$ctype@_W@std@@QEAAXXZ */
1891 DEFINE_THISCALL_WRAPPER(ctype_wchar_ctor, 4)
1892 ctype_wchar* __thiscall ctype_wchar_ctor(ctype_wchar *this)
1894 TRACE("(%p)\n", this);
1895 return ctype_short_ctor_refs(this, 0);
1898 /* ??_F?$ctype@G@std@@QAEXXZ */
1899 /* ??_F?$ctype@G@std@@QEAAXXZ */
1900 DEFINE_THISCALL_WRAPPER(ctype_short_ctor, 4)
1901 ctype_wchar* __thiscall ctype_short_ctor(ctype_wchar *this)
1903 ctype_wchar *ret = ctype_wchar_ctor(this);
1904 this->base.facet.vtable = &MSVCP_ctype_short_vtable;
1905 return ret;
1908 /* ??1?$ctype@_W@std@@MAE@XZ */
1909 /* ??1?$ctype@_W@std@@MEAA@XZ */
1910 /* ??1?$ctype@G@std@@MAE@XZ */
1911 /* ??1?$ctype@G@std@@MEAA@XZ */
1912 DEFINE_THISCALL_WRAPPER(ctype_wchar_dtor, 4)
1913 void __thiscall ctype_wchar_dtor(ctype_wchar *this)
1915 TRACE("(%p)\n", this);
1916 if(this->ctype.delfl)
1917 free((void*)this->ctype.table);
1920 DEFINE_THISCALL_WRAPPER(ctype_wchar_vector_dtor, 8)
1921 ctype_wchar* __thiscall ctype_wchar_vector_dtor(ctype_wchar *this, unsigned int flags)
1923 TRACE("(%p %x)\n", this, flags);
1924 if(flags & 2) {
1925 /* we have an array, with the number of elements stored before the first object */
1926 INT_PTR i, *ptr = (INT_PTR *)this-1;
1928 for(i=*ptr-1; i>=0; i--)
1929 ctype_wchar_dtor(this+i);
1930 MSVCRT_operator_delete(ptr);
1931 } else {
1932 ctype_wchar_dtor(this);
1933 if(flags & 1)
1934 MSVCRT_operator_delete(this);
1937 return this;
1940 /* _Wcrtomb */
1941 int __cdecl _Wcrtomb(char *s, wchar_t wch, int *state, const _Cvtvec *cvt)
1943 int cp, size;
1944 BOOL def;
1946 TRACE("%p %d %p %p\n", s, wch, state, cvt);
1948 if(cvt)
1949 cp = cvt->page;
1950 else
1951 cp = ___lc_codepage_func();
1953 if(!cp) {
1954 if(wch > 255) {
1955 *_errno() = EILSEQ;
1956 return -1;
1959 *s = wch & 255;
1960 return 1;
1963 size = WideCharToMultiByte(cp, 0, &wch, 1, s, MB_LEN_MAX, NULL, &def);
1964 if(!size || def) {
1965 *_errno() = EILSEQ;
1966 return -1;
1969 return size;
1972 /* ?_Donarrow@?$ctype@_W@std@@IBED_WD@Z */
1973 /* ?_Donarrow@?$ctype@_W@std@@IEBAD_WD@Z */
1974 /* ?_Donarrow@?$ctype@G@std@@IBEDGD@Z */
1975 /* ?_Donarrow@?$ctype@G@std@@IEBADGD@Z */
1976 DEFINE_THISCALL_WRAPPER(ctype_wchar__Donarrow, 12)
1977 char __thiscall ctype_wchar__Donarrow(const ctype_wchar *this, wchar_t ch, char dflt)
1979 char buf[MB_LEN_MAX];
1981 TRACE("(%p %d %d)\n", this, ch, dflt);
1983 return _Wcrtomb(buf, ch, NULL, &this->cvt)==1 ? buf[0] : dflt;
1986 /* ?do_narrow@?$ctype@_W@std@@MBED_WD@Z */
1987 /* ?do_narrow@?$ctype@_W@std@@MEBAD_WD@Z */
1988 /* ?do_narrow@?$ctype@G@std@@MBEDGD@Z */
1989 /* ?do_narrow@?$ctype@G@std@@MEBADGD@Z */
1990 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_narrow_ch, 12)
1991 #define call_ctype_wchar_do_narrow_ch(this, ch, dflt) CALL_VTBL_FUNC(this, 52, \
1992 char, (const ctype_wchar*, wchar_t, char), (this, ch, dflt))
1993 char __thiscall ctype_wchar_do_narrow_ch(const ctype_wchar *this, wchar_t ch, char dflt)
1995 return ctype_wchar__Donarrow(this, ch, dflt);
1998 /* ?do_narrow@?$ctype@_W@std@@MBEPB_WPB_W0DPAD@Z */
1999 /* ?do_narrow@?$ctype@_W@std@@MEBAPEB_WPEB_W0DPEAD@Z */
2000 /* ?do_narrow@?$ctype@G@std@@MBEPBGPBG0DPAD@Z */
2001 /* ?do_narrow@?$ctype@G@std@@MEBAPEBGPEBG0DPEAD@Z */
2002 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_narrow, 20)
2003 #define call_ctype_wchar_do_narrow(this, first, last, dflt, dest) CALL_VTBL_FUNC(this, 48, \
2004 const wchar_t*, (const ctype_wchar*, const wchar_t*, const wchar_t*, char, char*), \
2005 (this, first, last, dflt, dest))
2006 const wchar_t* __thiscall ctype_wchar_do_narrow(const ctype_wchar *this,
2007 const wchar_t *first, const wchar_t *last, char dflt, char *dest)
2009 TRACE("(%p %p %p %d %p)\n", this, first, last, dflt, dest);
2010 for(; first<last; first++)
2011 *dest++ = ctype_wchar__Donarrow(this, *first, dflt);
2012 return last;
2015 /* ?_Do_narrow_s@?$ctype@_W@std@@MBEPB_WPB_W0DPADI@Z */
2016 /* ?_Do_narrow_s@?$ctype@_W@std@@MEBAPEB_WPEB_W0DPEAD_K@Z */
2017 /* ?_Do_narrow_s@?$ctype@G@std@@MBEPBGPBG0DPADI@Z */
2018 /* ?_Do_narrow_s@?$ctype@G@std@@MEBAPEBGPEBG0DPEAD_K@Z */
2019 DEFINE_THISCALL_WRAPPER(ctype_wchar__Do_narrow_s, 24)
2020 #define call_ctype_wchar__Do_narrow_s(this, first, last, dflt, dest, size) CALL_VTBL_FUNC(this, 56, \
2021 const wchar_t*, (const ctype_wchar*, const wchar_t*, const wchar_t*, char, char*, MSVCP_size_t), \
2022 (this, first, last, dflt, dest, size))
2023 const wchar_t* __thiscall ctype_wchar__Do_narrow_s(const ctype_wchar *this,
2024 const wchar_t *first, const wchar_t *last, char dflt, char *dest, MSVCP_size_t size)
2026 TRACE("(%p %p %p %d %p %lu)\n", this, first, last, dflt, dest, size);
2027 /* This function converts all multi-byte characters to dflt,
2028 * thanks to it result size is known before converting */
2029 if(last-first > size)
2030 ctype_base__Xran();
2031 return ctype_wchar_do_narrow(this, first, last, dflt, dest);
2034 /* ?narrow@?$ctype@_W@std@@QBED_WD@Z */
2035 /* ?narrow@?$ctype@_W@std@@QEBAD_WD@Z */
2036 /* ?narrow@?$ctype@G@std@@QBEDGD@Z */
2037 /* ?narrow@?$ctype@G@std@@QEBADGD@Z */
2038 DEFINE_THISCALL_WRAPPER(ctype_wchar_narrow_ch, 12)
2039 char __thiscall ctype_wchar_narrow_ch(const ctype_wchar *this, wchar_t ch, char dflt)
2041 TRACE("(%p %d %d)\n", this, ch, dflt);
2042 return call_ctype_wchar_do_narrow_ch(this, ch, dflt);
2045 /* ?narrow@?$ctype@_W@std@@QBEPB_WPB_W0DPAD@Z */
2046 /* ?narrow@?$ctype@_W@std@@QEBAPEB_WPEB_W0DPEAD@Z */
2047 /* ?narrow@?$ctype@G@std@@QBEPBGPBG0DPAD@Z */
2048 /* ?narrow@?$ctype@G@std@@QEBAPEBGPEBG0DPEAD@Z */
2049 DEFINE_THISCALL_WRAPPER(ctype_wchar_narrow, 20)
2050 const wchar_t* __thiscall ctype_wchar_narrow(const ctype_wchar *this,
2051 const wchar_t *first, const wchar_t *last, char dflt, char *dest)
2053 TRACE("(%p %p %p %d %p)\n", this, first, last, dflt, dest);
2054 return call_ctype_wchar_do_narrow(this, first, last, dflt, dest);
2057 /* ?_Narrow_s@?$ctype@_W@std@@QBEPB_WPB_W0DPADI@Z */
2058 /* ?_Narrow_s@?$ctype@_W@std@@QEBAPEB_WPEB_W0DPEAD_K@Z */
2059 /* ?_Narrow_s@?$ctype@G@std@@QBEPBGPBG0DPADI@Z */
2060 /* ?_Narrow_s@?$ctype@G@std@@QEBAPEBGPEBG0DPEAD_K@Z */
2061 DEFINE_THISCALL_WRAPPER(ctype_wchar__Narrow_s, 24)
2062 const wchar_t* __thiscall ctype_wchar__Narrow_s(const ctype_wchar *this, const wchar_t *first,
2063 const wchar_t *last, char dflt, char *dest, MSVCP_size_t size)
2065 TRACE("(%p %p %p %d %p %lu)\n", this, first, last, dflt, dest, size);
2066 return call_ctype_wchar__Do_narrow_s(this, first, last, dflt, dest, size);
2069 /* _Mbrtowc */
2070 int __cdecl _Mbrtowc(wchar_t *out, const char *in, MSVCP_size_t len, int *state, const _Cvtvec *cvt)
2072 int i, cp;
2073 CPINFO cp_info;
2074 BOOL is_lead;
2076 TRACE("(%p %p %lu %p %p)\n", out, in, len, state, cvt);
2078 if(!len)
2079 return 0;
2081 if(cvt)
2082 cp = cvt->page;
2083 else
2084 cp = ___lc_codepage_func();
2086 if(!cp) {
2087 if(out)
2088 *out = (unsigned char)*in;
2090 *state = 0;
2091 return *in ? 1 : 0;
2094 if(*state) {
2095 ((char*)state)[1] = *in;
2097 if(!MultiByteToWideChar(cp, MB_ERR_INVALID_CHARS, (char*)state, 2, out, out ? 1 : 0)) {
2098 *state = 0;
2099 *_errno() = EILSEQ;
2100 return -1;
2103 *state = 0;
2104 return 2;
2107 GetCPInfo(cp, &cp_info);
2108 is_lead = FALSE;
2109 for(i=0; i<MAX_LEADBYTES; i+=2) {
2110 if(!cp_info.LeadByte[i+1])
2111 break;
2112 if((unsigned char)*in>=cp_info.LeadByte[i] && (unsigned char)*in<=cp_info.LeadByte[i+1]) {
2113 is_lead = TRUE;
2114 break;
2118 if(is_lead) {
2119 if(len == 1) {
2120 *state = (unsigned char)*in;
2121 return -2;
2124 if(!MultiByteToWideChar(cp, MB_ERR_INVALID_CHARS, in, 2, out, out ? 1 : 0)) {
2125 *_errno() = EILSEQ;
2126 return -1;
2128 return 2;
2131 if(!MultiByteToWideChar(cp, MB_ERR_INVALID_CHARS, in, 1, out, out ? 1 : 0)) {
2132 *_errno() = EILSEQ;
2133 return -1;
2135 return 1;
2138 /* ?_Dowiden@?$ctype@_W@std@@IBE_WD@Z */
2139 /* ?_Dowiden@?$ctype@_W@std@@IEBA_WD@Z */
2140 /* ?_Dowiden@?$ctype@G@std@@IBEGD@Z */
2141 /* ?_Dowiden@?$ctype@G@std@@IEBAGD@Z */
2142 DEFINE_THISCALL_WRAPPER(ctype_wchar__Dowiden, 8)
2143 wchar_t __thiscall ctype_wchar__Dowiden(const ctype_wchar *this, char ch)
2145 wchar_t ret;
2146 int state = 0;
2147 TRACE("(%p %d)\n", this, ch);
2148 return _Mbrtowc(&ret, &ch, 1, &state, &this->cvt)<0 ? WEOF : ret;
2151 /* ?do_widen@?$ctype@_W@std@@MBE_WD@Z */
2152 /* ?do_widen@?$ctype@_W@std@@MEBA_WD@Z */
2153 /* ?do_widen@?$ctype@G@std@@MBEGD@Z */
2154 /* ?do_widen@?$ctype@G@std@@MEBAGD@Z */
2155 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_widen_ch, 8)
2156 #define call_ctype_wchar_do_widen_ch(this, ch) CALL_VTBL_FUNC(this, 40, \
2157 wchar_t, (const ctype_wchar*, char), (this, ch))
2158 wchar_t __thiscall ctype_wchar_do_widen_ch(const ctype_wchar *this, char ch)
2160 return ctype_wchar__Dowiden(this, ch);
2163 /* ?do_widen@?$ctype@_W@std@@MBEPBDPBD0PA_W@Z */
2164 /* ?do_widen@?$ctype@_W@std@@MEBAPEBDPEBD0PEA_W@Z */
2165 /* ?do_widen@?$ctype@G@std@@MBEPBDPBD0PAG@Z */
2166 /* ?do_widen@?$ctype@G@std@@MEBAPEBDPEBD0PEAG@Z */
2167 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_widen, 16)
2168 #define call_ctype_wchar_do_widen(this, first, last, dest) CALL_VTBL_FUNC(this, 36, \
2169 const char*, (const ctype_wchar*, const char*, const char*, wchar_t*), \
2170 (this, first, last, dest))
2171 const char* __thiscall ctype_wchar_do_widen(const ctype_wchar *this,
2172 const char *first, const char *last, wchar_t *dest)
2174 TRACE("(%p %p %p %p)\n", this, first, last, dest);
2175 for(; first<last; first++)
2176 *dest++ = ctype_wchar__Dowiden(this, *first);
2177 return last;
2180 /* ?_Do_widen_s@?$ctype@_W@std@@MBEPBDPBD0PA_WI@Z */
2181 /* ?_Do_widen_s@?$ctype@_W@std@@MEBAPEBDPEBD0PEA_W_K@Z */
2182 /* ?_Do_widen_s@?$ctype@G@std@@MBEPBDPBD0PAGI@Z */
2183 /* ?_Do_widen_s@?$ctype@G@std@@MEBAPEBDPEBD0PEAG_K@Z */
2184 DEFINE_THISCALL_WRAPPER(ctype_wchar__Do_widen_s, 20)
2185 #define call_ctype_wchar__Do_widen_s(this, first, last, dest, size) CALL_VTBL_FUNC(this, 44, \
2186 const char*, (const ctype_wchar*, const char*, const char*, wchar_t*, MSVCP_size_t), \
2187 (this, first, last, dest, size))
2188 const char* __thiscall ctype_wchar__Do_widen_s(const ctype_wchar *this,
2189 const char *first, const char *last, wchar_t *dest, MSVCP_size_t size)
2191 TRACE("(%p %p %p %p %lu)\n", this, first, last, dest, size);
2192 /* This function converts all multi-byte characters to WEOF,
2193 * thanks to it result size is known before converting */
2194 if(size < last-first)
2195 ctype_base__Xran();
2196 return ctype_wchar_do_widen(this, first, last, dest);
2199 /* ?widen@?$ctype@_W@std@@QBE_WD@Z */
2200 /* ?widen@?$ctype@_W@std@@QEBA_WD@Z */
2201 /* ?widen@?$ctype@G@std@@QBEGD@Z */
2202 /* ?widen@?$ctype@G@std@@QEBAGD@Z */
2203 DEFINE_THISCALL_WRAPPER(ctype_wchar_widen_ch, 8)
2204 wchar_t __thiscall ctype_wchar_widen_ch(const ctype_wchar *this, char ch)
2206 TRACE("(%p %d)\n", this, ch);
2207 return call_ctype_wchar_do_widen_ch(this, ch);
2210 /* ?widen@?$ctype@_W@std@@QBEPBDPBD0PA_W@Z */
2211 /* ?widen@?$ctype@_W@std@@QEBAPEBDPEBD0PEA_W@Z */
2212 /* ?widen@?$ctype@G@std@@QBEPBDPBD0PAG@Z */
2213 /* ?widen@?$ctype@G@std@@QEBAPEBDPEBD0PEAG@Z */
2214 DEFINE_THISCALL_WRAPPER(ctype_wchar_widen, 16)
2215 const char* __thiscall ctype_wchar_widen(const ctype_wchar *this,
2216 const char *first, const char *last, wchar_t *dest)
2218 TRACE("(%p %p %p %p)\n", this, first, last, dest);
2219 return call_ctype_wchar_do_widen(this, first, last, dest);
2222 /* ?_Widen_s@?$ctype@_W@std@@QBEPBDPBD0PA_WI@Z */
2223 /* ?_Widen_s@?$ctype@_W@std@@QEBAPEBDPEBD0PEA_W_K@Z */
2224 /* ?_Widen_s@?$ctype@G@std@@QBEPBDPBD0PAGI@Z */
2225 /* ?_Widen_s@?$ctype@G@std@@QEBAPEBDPEBD0PEAG_K@Z */
2226 DEFINE_THISCALL_WRAPPER(ctype_wchar__Widen_s, 20)
2227 const char* __thiscall ctype_wchar__Widen_s(const ctype_wchar *this,
2228 const char *first, const char *last, wchar_t *dest, MSVCP_size_t size)
2230 TRACE("(%p %p %p %p %lu)\n", this, first, last, dest, size);
2231 return call_ctype_wchar__Do_widen_s(this, first, last, dest, size);
2234 /* ?_Getcat@?$ctype@_W@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
2235 /* ?_Getcat@?$ctype@_W@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
2236 MSVCP_size_t __cdecl ctype_wchar__Getcat(const locale_facet **facet, const locale *loc)
2238 TRACE("(%p %p)\n", facet, loc);
2240 if(facet && !*facet) {
2241 _Locinfo locinfo;
2243 *facet = MSVCRT_operator_new(sizeof(ctype_wchar));
2244 if(!*facet) {
2245 ERR("Out of memory\n");
2246 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
2247 return 0;
2250 _Locinfo_ctor_cstr(&locinfo, MSVCP_basic_string_char_c_str(&loc->ptr->name));
2251 ctype_wchar_ctor_locinfo((ctype_wchar*)*facet, &locinfo, 0);
2252 _Locinfo_dtor(&locinfo);
2255 return LC_CTYPE;
2258 /* ?_Getcat@?$ctype@G@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
2259 /* ?_Getcat@?$ctype@G@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
2260 MSVCP_size_t __cdecl ctype_short__Getcat(const locale_facet **facet, const locale *loc)
2262 if(facet && !*facet) {
2263 ctype_wchar__Getcat(facet, loc);
2264 (*(locale_facet**)facet)->vtable = &MSVCP_ctype_short_vtable;
2267 return LC_CTYPE;
2270 /* _Towlower */
2271 wchar_t __cdecl _Towlower(wchar_t ch, const _Ctypevec *ctype)
2273 TRACE("(%d %p)\n", ch, ctype);
2274 return tolowerW(ch);
2277 ctype_wchar* ctype_wchar_use_facet(const locale *loc)
2279 static ctype_wchar *obj = NULL;
2281 _Lockit lock;
2282 const locale_facet *fac;
2284 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
2285 fac = locale__Getfacet(loc, locale_id_operator_size_t(&ctype_wchar_id));
2286 if(fac) {
2287 _Lockit_dtor(&lock);
2288 return (ctype_wchar*)fac;
2291 if(obj) {
2292 _Lockit_dtor(&lock);
2293 return obj;
2296 ctype_wchar__Getcat(&fac, loc);
2297 obj = (ctype_wchar*)fac;
2298 locale_facet__Incref(&obj->base.facet);
2299 locale_facet_register(&obj->base.facet);
2300 _Lockit_dtor(&lock);
2302 return obj;
2305 ctype_wchar* ctype_short_use_facet(const locale *loc)
2307 static ctype_wchar *obj = NULL;
2309 _Lockit lock;
2310 const locale_facet *fac;
2312 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
2313 fac = locale__Getfacet(loc, locale_id_operator_size_t(&ctype_short_id));
2314 if(fac) {
2315 _Lockit_dtor(&lock);
2316 return (ctype_wchar*)fac;
2319 if(obj) {
2320 _Lockit_dtor(&lock);
2321 return obj;
2324 ctype_short__Getcat(&fac, loc);
2325 obj = (ctype_wchar*)fac;
2326 locale_facet__Incref(&obj->base.facet);
2327 locale_facet_register(&obj->base.facet);
2328 _Lockit_dtor(&lock);
2330 return obj;
2333 /* ?do_tolower@?$ctype@_W@std@@MBE_W_W@Z */
2334 /* ?do_tolower@?$ctype@_W@std@@MEBA_W_W@Z */
2335 /* ?do_tolower@?$ctype@G@std@@MBEGG@Z */
2336 /* ?do_tolower@?$ctype@G@std@@MEBAGG@Z */
2337 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_tolower_ch, 8)
2338 #define call_ctype_wchar_do_tolower_ch(this, ch) CALL_VTBL_FUNC(this, 24, \
2339 wchar_t, (const ctype_wchar*, wchar_t), (this, ch))
2340 wchar_t __thiscall ctype_wchar_do_tolower_ch(const ctype_wchar *this, wchar_t ch)
2342 return _Towlower(ch, &this->ctype);
2345 /* ?do_tolower@?$ctype@_W@std@@MBEPB_WPA_WPB_W@Z */
2346 /* ?do_tolower@?$ctype@_W@std@@MEBAPEB_WPEA_WPEB_W@Z */
2347 /* ?do_tolower@?$ctype@G@std@@MBEPBGPAGPBG@Z */
2348 /* ?do_tolower@?$ctype@G@std@@MEBAPEBGPEAGPEBG@Z */
2349 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_tolower, 12)
2350 #define call_ctype_wchar_do_tolower(this, first, last) CALL_VTBL_FUNC(this, 20, \
2351 const wchar_t*, (const ctype_wchar*, wchar_t*, const wchar_t*), \
2352 (this, first, last))
2353 const wchar_t* __thiscall ctype_wchar_do_tolower(const ctype_wchar *this,
2354 wchar_t *first, const wchar_t *last)
2356 TRACE("(%p %p %p)\n", this, first, last);
2357 for(; first<last; first++)
2358 *first = _Towlower(*first, &this->ctype);
2359 return last;
2362 /* ?tolower@?$ctype@_W@std@@QBE_W_W@Z */
2363 /* ?tolower@?$ctype@_W@std@@QEBA_W_W@Z */
2364 /* ?tolower@?$ctype@G@std@@QBEGG@Z */
2365 /* ?tolower@?$ctype@G@std@@QEBAGG@Z */
2366 DEFINE_THISCALL_WRAPPER(ctype_wchar_tolower_ch, 8)
2367 wchar_t __thiscall ctype_wchar_tolower_ch(const ctype_wchar *this, wchar_t ch)
2369 TRACE("(%p %d)\n", this, ch);
2370 return call_ctype_wchar_do_tolower_ch(this, ch);
2373 /* ?tolower@?$ctype@_W@std@@QBEPB_WPA_WPB_W@Z */
2374 /* ?tolower@?$ctype@_W@std@@QEBAPEB_WPEA_WPEB_W@Z */
2375 /* ?tolower@?$ctype@G@std@@QBEPBGPAGPBG@Z */
2376 /* ?tolower@?$ctype@G@std@@QEBAPEBGPEAGPEBG@Z */
2377 DEFINE_THISCALL_WRAPPER(ctype_wchar_tolower, 12)
2378 const wchar_t* __thiscall ctype_wchar_tolower(const ctype_wchar *this,
2379 wchar_t *first, const wchar_t *last)
2381 TRACE("(%p %p %p)\n", this, first, last);
2382 return call_ctype_wchar_do_tolower(this, first, last);
2385 /* _Towupper */
2386 wchar_t __cdecl _Towupper(wchar_t ch, const _Ctypevec *ctype)
2388 TRACE("(%d %p)\n", ch, ctype);
2389 return toupperW(ch);
2392 /* ?do_toupper@?$ctype@_W@std@@MBE_W_W@Z */
2393 /* ?do_toupper@?$ctype@_W@std@@MEBA_W_W@Z */
2394 /* ?do_toupper@?$ctype@G@std@@MBEGG@Z */
2395 /* ?do_toupper@?$ctype@G@std@@MEBAGG@Z */
2396 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_toupper_ch, 8)
2397 #define call_ctype_wchar_do_toupper_ch(this, ch) CALL_VTBL_FUNC(this, 32, \
2398 wchar_t, (const ctype_wchar*, wchar_t), (this, ch))
2399 wchar_t __thiscall ctype_wchar_do_toupper_ch(const ctype_wchar *this, wchar_t ch)
2401 return _Towupper(ch, &this->ctype);
2404 /* ?do_toupper@?$ctype@_W@std@@MBEPB_WPA_WPB_W@Z */
2405 /* ?do_toupper@?$ctype@_W@std@@MEBAPEB_WPEA_WPEB_W@Z */
2406 /* ?do_toupper@?$ctype@G@std@@MBEPBGPAGPBG@Z */
2407 /* ?do_toupper@?$ctype@G@std@@MEBAPEBGPEAGPEBG@Z */
2408 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_toupper, 12)
2409 #define call_ctype_wchar_do_toupper(this, first, last) CALL_VTBL_FUNC(this, 28, \
2410 const wchar_t*, (const ctype_wchar*, wchar_t*, const wchar_t*), \
2411 (this, first, last))
2412 const wchar_t* __thiscall ctype_wchar_do_toupper(const ctype_wchar *this,
2413 wchar_t *first, const wchar_t *last)
2415 TRACE("(%p %p %p)\n", this, first, last);
2416 for(; first<last; first++)
2417 *first = _Towupper(*first, &this->ctype);
2418 return last;
2421 /* ?toupper@?$ctype@_W@std@@QBE_W_W@Z */
2422 /* ?toupper@?$ctype@_W@std@@QEBA_W_W@Z */
2423 /* ?toupper@?$ctype@G@std@@QBEGG@Z */
2424 /* ?toupper@?$ctype@G@std@@QEBAGG@Z */
2425 DEFINE_THISCALL_WRAPPER(ctype_wchar_toupper_ch, 8)
2426 wchar_t __thiscall ctype_wchar_toupper_ch(const ctype_wchar *this, wchar_t ch)
2428 TRACE("(%p %d)\n", this, ch);
2429 return call_ctype_wchar_do_toupper_ch(this, ch);
2432 /* ?toupper@?$ctype@_W@std@@QBEPB_WPA_WPB_W@Z */
2433 /* ?toupper@?$ctype@_W@std@@QEBAPEB_WPEA_WPEB_W@Z */
2434 /* ?toupper@?$ctype@G@std@@QBEPBGPAGPBG@Z */
2435 /* ?toupper@?$ctype@G@std@@QEBAPEBGPEAGPEBG@Z */
2436 DEFINE_THISCALL_WRAPPER(ctype_wchar_toupper, 12)
2437 const wchar_t* __thiscall ctype_wchar_toupper(const ctype_wchar *this,
2438 wchar_t *first, const wchar_t *last)
2440 TRACE("(%p %p %p)\n", this, first, last);
2441 return call_ctype_wchar_do_toupper(this, first, last);
2444 /* _Getwctypes */
2445 const wchar_t* __cdecl _Getwctypes(const wchar_t *first, const wchar_t *last,
2446 short *mask, const _Ctypevec *ctype)
2448 TRACE("(%p %p %p %p)\n", first, last, mask, ctype);
2449 GetStringTypeW(CT_CTYPE1, first, last-first, (WORD*)mask);
2450 return last;
2453 /* _Getwctype */
2454 short __cdecl _Getwctype(wchar_t ch, const _Ctypevec *ctype)
2456 short mask = 0;
2457 _Getwctypes(&ch, &ch+1, &mask, ctype);
2458 return mask;
2461 /* ?do_is@?$ctype@_W@std@@MBE_NF_W@Z */
2462 /* ?do_is@?$ctype@_W@std@@MEBA_NF_W@Z */
2463 /* ?do_is@?$ctype@G@std@@MBE_NFG@Z */
2464 /* ?do_is@?$ctype@G@std@@MEBA_NFG@Z */
2465 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_is_ch, 12)
2466 #define call_ctype_wchar_do_is_ch(this, mask, ch) CALL_VTBL_FUNC(this, 8, \
2467 MSVCP_bool, (const ctype_wchar*, short, wchar_t), (this, mask, ch))
2468 MSVCP_bool __thiscall ctype_wchar_do_is_ch(const ctype_wchar *this, short mask, wchar_t ch)
2470 TRACE("(%p %x %d)\n", this, mask, ch);
2471 return (_Getwctype(ch, &this->ctype) & mask) != 0;
2474 /* ?do_is@?$ctype@_W@std@@MBEPB_WPB_W0PAF@Z */
2475 /* ?do_is@?$ctype@_W@std@@MEBAPEB_WPEB_W0PEAF@Z */
2476 /* ?do_is@?$ctype@G@std@@MBEPBGPBG0PAF@Z */
2477 /* ?do_is@?$ctype@G@std@@MEBAPEBGPEBG0PEAF@Z */
2478 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_is, 16)
2479 #define call_ctype_wchar_do_is(this, first, last, dest) CALL_VTBL_FUNC(this, 4, \
2480 const wchar_t*, (const ctype_wchar*, const wchar_t*, const wchar_t*, short*), \
2481 (this, first, last, dest))
2482 const wchar_t* __thiscall ctype_wchar_do_is(const ctype_wchar *this,
2483 const wchar_t *first, const wchar_t *last, short *dest)
2485 TRACE("(%p %p %p %p)\n", this, first, last, dest);
2486 return _Getwctypes(first, last, dest, &this->ctype);
2489 /* ?is@?$ctype@_W@std@@QBE_NF_W@Z */
2490 /* ?is@?$ctype@_W@std@@QEBA_NF_W@Z */
2491 /* ?is@?$ctype@G@std@@QBE_NFG@Z */
2492 /* ?is@?$ctype@G@std@@QEBA_NFG@Z */
2493 DEFINE_THISCALL_WRAPPER(ctype_wchar_is_ch, 12)
2494 MSVCP_bool __thiscall ctype_wchar_is_ch(const ctype_wchar *this, short mask, wchar_t ch)
2496 TRACE("(%p %x %d)\n", this, mask, ch);
2497 return call_ctype_wchar_do_is_ch(this, mask, ch);
2500 /* ?is@?$ctype@_W@std@@QBEPB_WPB_W0PAF@Z */
2501 /* ?is@?$ctype@_W@std@@QEBAPEB_WPEB_W0PEAF@Z */
2502 /* ?is@?$ctype@G@std@@QBEPBGPBG0PAF@Z */
2503 /* ?is@?$ctype@G@std@@QEBAPEBGPEBG0PEAF@Z */
2504 DEFINE_THISCALL_WRAPPER(ctype_wchar_is, 16)
2505 const wchar_t* __thiscall ctype_wchar_is(const ctype_wchar *this,
2506 const wchar_t *first, const wchar_t *last, short *dest)
2508 TRACE("(%p %p %p %p)\n", this, first, last, dest);
2509 return call_ctype_wchar_do_is(this, first, last, dest);
2512 /* ?do_scan_is@?$ctype@_W@std@@MBEPB_WFPB_W0@Z */
2513 /* ?do_scan_is@?$ctype@_W@std@@MEBAPEB_WFPEB_W0@Z */
2514 /* ?do_scan_is@?$ctype@G@std@@MBEPBGFPBG0@Z */
2515 /* ?do_scan_is@?$ctype@G@std@@MEBAPEBGFPEBG0@Z */
2516 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_scan_is, 16)
2517 #define call_ctype_wchar_do_scan_is(this, mask, first, last) CALL_VTBL_FUNC(this, 12, \
2518 const wchar_t*, (const ctype_wchar*, short, const wchar_t*, const wchar_t*), \
2519 (this, mask, first, last))
2520 const wchar_t* __thiscall ctype_wchar_do_scan_is(const ctype_wchar *this,
2521 short mask, const wchar_t *first, const wchar_t *last)
2523 TRACE("(%p %d %p %p)\n", this, mask, first, last);
2524 for(; first<last; first++)
2525 if(!ctype_wchar_is_ch(this, mask, *first))
2526 break;
2527 return first;
2530 /* ?scan_is@?$ctype@_W@std@@QBEPB_WFPB_W0@Z */
2531 /* ?scan_is@?$ctype@_W@std@@QEBAPEB_WFPEB_W0@Z */
2532 /* ?scan_is@?$ctype@G@std@@QBEPBGFPBG0@Z */
2533 /* ?scan_is@?$ctype@G@std@@QEBAPEBGFPEBG0@Z */
2534 DEFINE_THISCALL_WRAPPER(ctype_wchar_scan_is, 16)
2535 const wchar_t* __thiscall ctype_wchar_scan_is(const ctype_wchar *this,
2536 short mask, const wchar_t *first, const wchar_t *last)
2538 TRACE("(%p %x %p %p)\n", this, mask, first, last);
2539 return call_ctype_wchar_do_scan_is(this, mask, first, last);
2542 /* ?do_scan_not@?$ctype@_W@std@@MBEPB_WFPB_W0@Z */
2543 /* ?do_scan_not@?$ctype@_W@std@@MEBAPEB_WFPEB_W0@Z */
2544 /* ?do_scan_not@?$ctype@G@std@@MBEPBGFPBG0@Z */
2545 /* ?do_scan_not@?$ctype@G@std@@MEBAPEBGFPEBG0@Z */
2546 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_scan_not, 16)
2547 #define call_ctype_wchar_do_scan_not(this, mask, first, last) CALL_VTBL_FUNC(this, 16, \
2548 const wchar_t*, (const ctype_wchar*, short, const wchar_t*, const wchar_t*), \
2549 (this, mask, first, last))
2550 const wchar_t* __thiscall ctype_wchar_do_scan_not(const ctype_wchar *this,
2551 short mask, const wchar_t *first, const wchar_t *last)
2553 TRACE("(%p %x %p %p)\n", this, mask, first, last);
2554 for(; first<last; first++)
2555 if(ctype_wchar_is_ch(this, mask, *first))
2556 break;
2557 return first;
2560 /* ?scan_not@?$ctype@_W@std@@QBEPB_WFPB_W0@Z */
2561 /* ?scan_not@?$ctype@_W@std@@QEBAPEB_WFPEB_W0@Z */
2562 /* ?scan_not@?$ctype@G@std@@QBEPBGFPBG0@Z */
2563 /* ?scan_not@?$ctype@G@std@@QEBAPEBGFPEBG0@Z */
2564 DEFINE_THISCALL_WRAPPER(ctype_wchar_scan_not, 16)
2565 const wchar_t* __thiscall ctype_wchar_scan_not(const ctype_wchar *this,
2566 short mask, const wchar_t *first, const wchar_t *last)
2568 TRACE("(%p %x %p %p)\n", this, mask, first, last);
2569 return call_ctype_wchar_do_scan_not(this, mask, first, last);
2572 /* ??_7codecvt_base@std@@6B@ */
2573 extern const vtable_ptr MSVCP_codecvt_base_vtable;
2575 /* ??0codecvt_base@std@@QAE@I@Z */
2576 /* ??0codecvt_base@std@@QEAA@_K@Z */
2577 DEFINE_THISCALL_WRAPPER(codecvt_base_ctor_refs, 8)
2578 codecvt_base* __thiscall codecvt_base_ctor_refs(codecvt_base *this, MSVCP_size_t refs)
2580 TRACE("(%p %lu)\n", this, refs);
2581 locale_facet_ctor_refs(&this->facet, refs);
2582 this->facet.vtable = &MSVCP_codecvt_base_vtable;
2583 return this;
2586 /* ??_Fcodecvt_base@std@@QAEXXZ */
2587 /* ??_Fcodecvt_base@std@@QEAAXXZ */
2588 DEFINE_THISCALL_WRAPPER(codecvt_base_ctor, 4)
2589 codecvt_base* __thiscall codecvt_base_ctor(codecvt_base *this)
2591 return codecvt_base_ctor_refs(this, 0);
2594 /* ??1codecvt_base@std@@UAE@XZ */
2595 /* ??1codecvt_base@std@@UEAA@XZ */
2596 DEFINE_THISCALL_WRAPPER(codecvt_base_dtor, 4)
2597 void __thiscall codecvt_base_dtor(codecvt_base *this)
2599 TRACE("(%p)\n", this);
2600 locale_facet_dtor(&this->facet);
2603 DEFINE_THISCALL_WRAPPER(codecvt_base_vector_dtor, 8)
2604 codecvt_base* __thiscall codecvt_base_vector_dtor(codecvt_base *this, unsigned int flags)
2606 TRACE("(%p %x)\n", this, flags);
2607 if(flags & 2) {
2608 /* we have an array, with the number of elements stored before the first object */
2609 INT_PTR i, *ptr = (INT_PTR *)this-1;
2611 for(i=*ptr-1; i>=0; i--)
2612 codecvt_base_dtor(this+i);
2613 MSVCRT_operator_delete(ptr);
2614 } else {
2615 codecvt_base_dtor(this);
2616 if(flags & 1)
2617 MSVCRT_operator_delete(this);
2620 return this;
2623 /* ?do_always_noconv@codecvt_base@std@@MBE_NXZ */
2624 /* ?do_always_noconv@codecvt_base@std@@MEBA_NXZ */
2625 #define call_codecvt_base_do_always_noconv(this) CALL_VTBL_FUNC(this, 4, \
2626 MSVCP_bool, (const codecvt_base*), (this))
2627 DEFINE_THISCALL_WRAPPER(codecvt_base_do_always_noconv, 4)
2628 MSVCP_bool __thiscall codecvt_base_do_always_noconv(const codecvt_base *this)
2630 TRACE("(%p)\n", this);
2631 return TRUE;
2634 /* ?always_noconv@codecvt_base@std@@QBE_NXZ */
2635 /* ?always_noconv@codecvt_base@std@@QEBA_NXZ */
2636 DEFINE_THISCALL_WRAPPER(codecvt_base_always_noconv, 4)
2637 MSVCP_bool __thiscall codecvt_base_always_noconv(const codecvt_base *this)
2639 TRACE("(%p)\n", this);
2640 return call_codecvt_base_do_always_noconv(this);
2643 /* ?do_max_length@codecvt_base@std@@MBEHXZ */
2644 /* ?do_max_length@codecvt_base@std@@MEBAHXZ */
2645 #define call_codecvt_base_do_max_length(this) CALL_VTBL_FUNC(this, 8, \
2646 int, (const codecvt_base*), (this))
2647 DEFINE_THISCALL_WRAPPER(codecvt_base_do_max_length, 4)
2648 int __thiscall codecvt_base_do_max_length(const codecvt_base *this)
2650 TRACE("(%p)\n", this);
2651 return 1;
2654 /* ?max_length@codecvt_base@std@@QBEHXZ */
2655 /* ?max_length@codecvt_base@std@@QEBAHXZ */
2656 DEFINE_THISCALL_WRAPPER(codecvt_base_max_length, 4)
2657 int __thiscall codecvt_base_max_length(const codecvt_base *this)
2659 TRACE("(%p)\n", this);
2660 return call_codecvt_base_do_max_length(this);
2663 /* ?do_encoding@codecvt_base@std@@MBEHXZ */
2664 /* ?do_encoding@codecvt_base@std@@MEBAHXZ */
2665 #define call_codecvt_base_do_encoding(this) CALL_VTBL_FUNC(this, 12, \
2666 int, (const codecvt_base*), (this))
2667 DEFINE_THISCALL_WRAPPER(codecvt_base_do_encoding, 4)
2668 int __thiscall codecvt_base_do_encoding(const codecvt_base *this)
2670 TRACE("(%p)\n", this);
2671 return 1;
2674 /* ?encoding@codecvt_base@std@@QBEHXZ */
2675 /* ?encoding@codecvt_base@std@@QEBAHXZ */
2676 DEFINE_THISCALL_WRAPPER(codecvt_base_encoding, 4)
2677 int __thiscall codecvt_base_encoding(const codecvt_base *this)
2679 TRACE("(%p)\n", this);
2680 return call_codecvt_base_do_encoding(this);
2683 /* ?id@?$codecvt@DDH@std@@2V0locale@2@A */
2684 locale_id codecvt_char_id = {0};
2686 /* ??_7?$codecvt@DDH@std@@6B@ */
2687 extern const vtable_ptr MSVCP_codecvt_char_vtable;
2689 /* ?_Init@?$codecvt@DDH@std@@IAEXABV_Locinfo@2@@Z */
2690 /* ?_Init@?$codecvt@DDH@std@@IEAAXAEBV_Locinfo@2@@Z */
2691 DEFINE_THISCALL_WRAPPER(codecvt_char__Init, 8)
2692 void __thiscall codecvt_char__Init(codecvt_char *this, const _Locinfo *locinfo)
2694 TRACE("(%p %p)\n", this, locinfo);
2697 /* ??0?$codecvt@DDH@std@@QAE@ABV_Locinfo@1@I@Z */
2698 /* ??0?$codecvt@DDH@std@@QEAA@AEBV_Locinfo@1@_K@Z */
2699 DEFINE_THISCALL_WRAPPER(codecvt_char_ctor_locinfo, 12)
2700 codecvt_char* __thiscall codecvt_char_ctor_locinfo(codecvt_char *this, const _Locinfo *locinfo, MSVCP_size_t refs)
2702 TRACE("(%p %p %lu)\n", this, locinfo, refs);
2703 codecvt_base_ctor_refs(&this->base, refs);
2704 this->base.facet.vtable = &MSVCP_codecvt_char_vtable;
2705 return this;
2708 /* ??0?$codecvt@DDH@std@@QAE@I@Z */
2709 /* ??0?$codecvt@DDH@std@@QEAA@_K@Z */
2710 DEFINE_THISCALL_WRAPPER(codecvt_char_ctor_refs, 8)
2711 codecvt_char* __thiscall codecvt_char_ctor_refs(codecvt_char *this, MSVCP_size_t refs)
2713 return codecvt_char_ctor_locinfo(this, NULL, refs);
2716 /* ??_F?$codecvt@DDH@std@@QAEXXZ */
2717 /* ??_F?$codecvt@DDH@std@@QEAAXXZ */
2718 DEFINE_THISCALL_WRAPPER(codecvt_char_ctor, 4)
2719 codecvt_char* __thiscall codecvt_char_ctor(codecvt_char *this)
2721 return codecvt_char_ctor_locinfo(this, NULL, 0);
2724 /* ??1?$codecvt@DDH@std@@MAE@XZ */
2725 /* ??1?$codecvt@DDH@std@@MEAA@XZ */
2726 DEFINE_THISCALL_WRAPPER(codecvt_char_dtor, 4)
2727 void __thiscall codecvt_char_dtor(codecvt_char *this)
2729 TRACE("(%p)\n", this);
2730 codecvt_base_dtor(&this->base);
2733 DEFINE_THISCALL_WRAPPER(codecvt_char_vector_dtor, 8)
2734 codecvt_char* __thiscall codecvt_char_vector_dtor(codecvt_char *this, unsigned int flags)
2736 TRACE("(%p %x)\n", this, flags);
2737 if(flags & 2) {
2738 /* we have an array, with the number of elements stored before the first object */
2739 INT_PTR i, *ptr = (INT_PTR *)this-1;
2741 for(i=*ptr-1; i>=0; i--)
2742 codecvt_char_dtor(this+i);
2743 MSVCRT_operator_delete(ptr);
2744 } else {
2745 codecvt_char_dtor(this);
2746 if(flags & 1)
2747 MSVCRT_operator_delete(this);
2750 return this;
2753 /* ?_Getcat@?$codecvt@DDH@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
2754 /* ?_Getcat@?$codecvt@DDH@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
2755 MSVCP_size_t __cdecl codecvt_char__Getcat(const locale_facet **facet, const locale *loc)
2757 TRACE("(%p %p)\n", facet, loc);
2759 if(facet && !*facet) {
2760 *facet = MSVCRT_operator_new(sizeof(codecvt_char));
2761 if(!*facet) {
2762 ERR("Out of memory\n");
2763 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
2764 return 0;
2766 codecvt_char_ctor((codecvt_char*)*facet);
2769 return LC_CTYPE;
2772 codecvt_char* codecvt_char_use_facet(const locale *loc)
2774 static codecvt_char *obj = NULL;
2776 _Lockit lock;
2777 const locale_facet *fac;
2779 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
2780 fac = locale__Getfacet(loc, locale_id_operator_size_t(&codecvt_char_id));
2781 if(fac) {
2782 _Lockit_dtor(&lock);
2783 return (codecvt_char*)fac;
2786 if(obj) {
2787 _Lockit_dtor(&lock);
2788 return obj;
2791 codecvt_char__Getcat(&fac, loc);
2792 obj = (codecvt_char*)fac;
2793 locale_facet__Incref(&obj->base.facet);
2794 locale_facet_register(&obj->base.facet);
2795 _Lockit_dtor(&lock);
2797 return obj;
2800 /* ?do_in@?$codecvt@DDH@std@@MBEHAAHPBD1AAPBDPAD3AAPAD@Z */
2801 /* ?do_in@?$codecvt@DDH@std@@MEBAHAEAHPEBD1AEAPEBDPEAD3AEAPEAD@Z */
2802 #define call_codecvt_char_do_in(this, state, from, from_end, from_next, to, to_end, to_next) \
2803 CALL_VTBL_FUNC(this, 16, int, \
2804 (const codecvt_char*, int*, const char*, const char*, const char**, char*, char*, char**), \
2805 (this, state, from, from_end, from_next, to, to_end, to_next))
2806 DEFINE_THISCALL_WRAPPER(codecvt_char_do_in, 32)
2807 int __thiscall codecvt_char_do_in(const codecvt_char *this, int *state,
2808 const char *from, const char *from_end, const char **from_next,
2809 char *to, char *to_end, char **to_next)
2811 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from, from_end,
2812 from_next, to, to_end, to_next);
2813 *from_next = from;
2814 *to_next = to;
2815 return CODECVT_noconv;
2818 /* ?in@?$codecvt@DDH@std@@QBEHAAHPBD1AAPBDPAD3AAPAD@Z */
2819 /* ?in@?$codecvt@DDH@std@@QEBAHAEAHPEBD1AEAPEBDPEAD3AEAPEAD@Z */
2820 DEFINE_THISCALL_WRAPPER(codecvt_char_in, 32)
2821 int __thiscall codecvt_char_in(const codecvt_char *this, int *state,
2822 const char *from, const char *from_end, const char **from_next,
2823 char *to, char *to_end, char **to_next)
2825 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from, from_end,
2826 from_next, to, to_end, to_next);
2827 return call_codecvt_char_do_in(this, state, from, from_end, from_next,
2828 to, to_end, to_next);
2831 /* ?do_out@?$codecvt@DDH@std@@MBEHAAHPBD1AAPBDPAD3AAPAD@Z */
2832 /* ?do_out@?$codecvt@DDH@std@@MEBAHAEAHPEBD1AEAPEBDPEAD3AEAPEAD@Z */
2833 #define call_codecvt_char_do_out(this, state, from, from_end, from_next, to, to_end, to_next) \
2834 CALL_VTBL_FUNC(this, 20, int, \
2835 (const codecvt_char*, int*, const char*, const char*, const char**, char*, char*, char**), \
2836 (this, state, from, from_end, from_next, to, to_end, to_next))
2837 DEFINE_THISCALL_WRAPPER(codecvt_char_do_out, 32)
2838 int __thiscall codecvt_char_do_out(const codecvt_char *this, int *state,
2839 const char *from, const char *from_end, const char **from_next,
2840 char *to, char *to_end, char **to_next)
2842 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from,
2843 from_end, from_next, to, to_end, to_next);
2844 *from_next = from;
2845 *to_next = to;
2846 return CODECVT_noconv;
2849 /* ?out@?$codecvt@DDH@std@@QBEHAAHPBD1AAPBDPAD3AAPAD@Z */
2850 /* ?out@?$codecvt@DDH@std@@QEBAHAEAHPEBD1AEAPEBDPEAD3AEAPEAD@Z */
2851 DEFINE_THISCALL_WRAPPER(codecvt_char_out, 32)
2852 int __thiscall codecvt_char_out(const codecvt_char *this, int *state,
2853 const char *from, const char *from_end, const char **from_next,
2854 char *to, char *to_end, char **to_next)
2856 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from, from_end,
2857 from_next, to, to_end, to_next);
2858 return call_codecvt_char_do_out(this, state, from, from_end, from_next,
2859 to, to_end, to_next);
2862 /* ?do_unshift@?$codecvt@DDH@std@@MBEHAAHPAD1AAPAD@Z */
2863 /* ?do_unshift@?$codecvt@DDH@std@@MEBAHAEAHPEAD1AEAPEAD@Z */
2864 #define call_codecvt_char_do_unshift(this, state, to, to_end, to_next) CALL_VTBL_FUNC(this, 24, \
2865 int, (const codecvt_char*, int*, char*, char*, char**), (this, state, to, to_end, to_next))
2866 DEFINE_THISCALL_WRAPPER(codecvt_char_do_unshift, 20)
2867 int __thiscall codecvt_char_do_unshift(const codecvt_char *this,
2868 int *state, char *to, char *to_end, char **to_next)
2870 TRACE("(%p %p %p %p %p)\n", this, state, to, to_end, to_next);
2871 *to_next = to;
2872 return CODECVT_noconv;
2875 /* ?unshift@?$codecvt@DDH@std@@QBEHAAHPAD1AAPAD@Z */
2876 /* ?unshift@?$codecvt@DDH@std@@QEBAHAEAHPEAD1AEAPEAD@Z */
2877 DEFINE_THISCALL_WRAPPER(codecvt_char_unshift, 20)
2878 int __thiscall codecvt_char_unshift(const codecvt_char *this,
2879 int *state, char *to, char *to_end, char **to_next)
2881 TRACE("(%p %p %p %p %p)\n", this, state, to, to_end, to_next);
2882 return call_codecvt_char_do_unshift(this, state, to, to_end, to_next);
2885 /* ?do_length@?$codecvt@DDH@std@@MBEHABHPBD1I@Z */
2886 /* ?do_length@?$codecvt@DDH@std@@MEBAHAEBHPEBD1_K@Z */
2887 #define call_codecvt_char_do_length(this, state, from, from_end, max) CALL_VTBL_FUNC(this, 28, \
2888 int, (const codecvt_char*, const int*, const char*, const char*, MSVCP_size_t), \
2889 (this, state, from, from_end, max))
2890 DEFINE_THISCALL_WRAPPER(codecvt_char_do_length, 20)
2891 int __thiscall codecvt_char_do_length(const codecvt_char *this, const int *state,
2892 const char *from, const char *from_end, MSVCP_size_t max)
2894 TRACE("(%p %p %p %p %lu)\n", this, state, from, from_end, max);
2895 return (from_end-from > max ? max : from_end-from);
2898 /* ?length@?$codecvt@DDH@std@@QBEHABHPBD1I@Z */
2899 /* ?length@?$codecvt@DDH@std@@QEBAHAEBHPEBD1_K@Z */
2900 DEFINE_THISCALL_WRAPPER(codecvt_char_length, 20)
2901 int __thiscall codecvt_char_length(const codecvt_char *this, const int *state,
2902 const char *from, const char *from_end, MSVCP_size_t max)
2904 TRACE("(%p %p %p %p %lu)\n", this, state, from, from_end, max);
2905 return call_codecvt_char_do_length(this, state, from, from_end, max);
2908 /* ?id@?$codecvt@_WDH@std@@2V0locale@2@A */
2909 locale_id codecvt_wchar_id = {0};
2910 /* ?id@?$codecvt@GDH@std@@2V0locale@2@A */
2911 locale_id codecvt_short_id = {0};
2913 /* ??_7?$codecvt@_WDH@std@@6B@ */
2914 extern const vtable_ptr MSVCP_codecvt_wchar_vtable;
2915 /* ??_7?$codecvt@GDH@std@@6B@ */
2916 extern const vtable_ptr MSVCP_codecvt_short_vtable;
2918 /* ?_Init@?$codecvt@GDH@std@@IAEXABV_Locinfo@2@@Z */
2919 /* ?_Init@?$codecvt@GDH@std@@IEAAXAEBV_Locinfo@2@@Z */
2920 /* ?_Init@?$codecvt@_WDH@std@@IAEXABV_Locinfo@2@@Z */
2921 /* ?_Init@?$codecvt@_WDH@std@@IEAAXAEBV_Locinfo@2@@Z */
2922 DEFINE_THISCALL_WRAPPER(codecvt_wchar__Init, 8)
2923 void __thiscall codecvt_wchar__Init(codecvt_wchar *this, const _Locinfo *locinfo)
2925 TRACE("(%p %p)\n", this, locinfo);
2926 _Locinfo__Getcvt(locinfo, &this->cvt);
2929 /* ??0?$codecvt@_WDH@std@@QAE@ABV_Locinfo@1@I@Z */
2930 /* ??0?$codecvt@_WDH@std@@QEAA@AEBV_Locinfo@1@_K@Z */
2931 DEFINE_THISCALL_WRAPPER(codecvt_wchar_ctor_locinfo, 12)
2932 codecvt_wchar* __thiscall codecvt_wchar_ctor_locinfo(codecvt_wchar *this, const _Locinfo *locinfo, MSVCP_size_t refs)
2934 TRACE("(%p %p %ld)\n", this, locinfo, refs);
2936 codecvt_base_ctor_refs(&this->base, refs);
2937 this->base.facet.vtable = &MSVCP_codecvt_wchar_vtable;
2939 codecvt_wchar__Init(this, locinfo);
2940 return this;
2943 /* ??0?$codecvt@GDH@std@@QAE@ABV_Locinfo@1@I@Z */
2944 /* ??0?$codecvt@GDH@std@@QEAA@AEBV_Locinfo@1@_K@Z */
2945 DEFINE_THISCALL_WRAPPER(codecvt_short_ctor_locinfo, 12)
2946 codecvt_wchar* __thiscall codecvt_short_ctor_locinfo(codecvt_wchar *this, const _Locinfo *locinfo, MSVCP_size_t refs)
2948 TRACE("(%p %p %ld)\n", this, locinfo, refs);
2950 codecvt_wchar_ctor_locinfo(this, locinfo, refs);
2951 this->base.facet.vtable = &MSVCP_codecvt_short_vtable;
2952 return this;
2955 /* ??0?$codecvt@_WDH@std@@QAE@I@Z */
2956 /* ??0?$codecvt@_WDH@std@@QEAA@_K@Z */
2957 DEFINE_THISCALL_WRAPPER(codecvt_wchar_ctor_refs, 8)
2958 codecvt_wchar* __thiscall codecvt_wchar_ctor_refs(codecvt_wchar *this, MSVCP_size_t refs)
2960 _Locinfo locinfo;
2962 TRACE("(%p %ld)\n", this, refs);
2964 _Locinfo_ctor(&locinfo);
2965 codecvt_wchar_ctor_locinfo(this, &locinfo, refs);
2966 _Locinfo_dtor(&locinfo);
2967 return this;
2970 /* ??0?$codecvt@GDH@std@@QAE@I@Z */
2971 /* ??0?$codecvt@GDH@std@@QEAA@_K@Z */
2972 DEFINE_THISCALL_WRAPPER(codecvt_short_ctor_refs, 8)
2973 codecvt_wchar* __thiscall codecvt_short_ctor_refs(codecvt_wchar *this, MSVCP_size_t refs)
2975 _Locinfo locinfo;
2977 TRACE("(%p %ld)\n", this, refs);
2979 _Locinfo_ctor(&locinfo);
2980 codecvt_short_ctor_locinfo(this, &locinfo, refs);
2981 _Locinfo_dtor(&locinfo);
2982 return this;
2985 /* ??0?$codecvt@GDH@std@@IAE@PBDI@Z */
2986 /* ??0?$codecvt@GDH@std@@IEAA@PEBD_K@Z */
2987 DEFINE_THISCALL_WRAPPER(codecvt_short_ctor_name, 12)
2988 codecvt_wchar* __thiscall codecvt_short_ctor_name(codecvt_wchar *this, const char *name, MSVCP_size_t refs)
2990 _Locinfo locinfo;
2992 TRACE("(%p %s %ld)\n", this, name, refs);
2994 _Locinfo_ctor_cstr(&locinfo, name);
2995 codecvt_short_ctor_locinfo(this, &locinfo, refs);
2996 _Locinfo_dtor(&locinfo);
2997 return this;
3000 /* ??_F?$codecvt@_WDH@std@@QAEXXZ */
3001 /* ??_F?$codecvt@_WDH@std@@QEAAXXZ */
3002 DEFINE_THISCALL_WRAPPER(codecvt_wchar_ctor, 4)
3003 codecvt_wchar* __thiscall codecvt_wchar_ctor(codecvt_wchar *this)
3005 return codecvt_wchar_ctor_refs(this, 0);
3008 /* ??_F?$codecvt@GDH@std@@QAEXXZ */
3009 /* ??_F?$codecvt@GDH@std@@QEAAXXZ */
3010 DEFINE_THISCALL_WRAPPER(codecvt_short_ctor, 4)
3011 codecvt_wchar* __thiscall codecvt_short_ctor(codecvt_wchar *this)
3013 return codecvt_short_ctor_refs(this, 0);
3016 /* ??1?$codecvt@GDH@std@@MAE@XZ */
3017 /* ??1?$codecvt@GDH@std@@MEAA@XZ */
3018 /* ??1?$codecvt@_WDH@std@@MAE@XZ */
3019 /* ??1?$codecvt@_WDH@std@@MEAA@XZ */
3020 DEFINE_THISCALL_WRAPPER(codecvt_wchar_dtor, 4)
3021 void __thiscall codecvt_wchar_dtor(codecvt_wchar *this)
3023 TRACE("(%p)\n", this);
3024 codecvt_base_dtor(&this->base);
3027 DEFINE_THISCALL_WRAPPER(codecvt_wchar_vector_dtor, 8)
3028 codecvt_wchar* __thiscall codecvt_wchar_vector_dtor(codecvt_wchar *this, unsigned int flags)
3030 TRACE("(%p %x)\n", this, flags);
3031 if(flags & 2) {
3032 /* we have an array, with the number of elements stored before the first object */
3033 INT_PTR i, *ptr = (INT_PTR *)this-1;
3035 for(i=*ptr-1; i>=0; i--)
3036 codecvt_wchar_dtor(this+i);
3037 MSVCRT_operator_delete(ptr);
3038 } else {
3039 codecvt_wchar_dtor(this);
3040 if(flags & 1)
3041 MSVCRT_operator_delete(this);
3044 return this;
3047 /* ?_Getcat@?$codecvt@_WDH@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
3048 /* ?_Getcat@?$codecvt@_WDH@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
3049 MSVCP_size_t __cdecl codecvt_wchar__Getcat(const locale_facet **facet, const locale *loc)
3051 TRACE("(%p %p)\n", facet, loc);
3053 if(facet && !*facet) {
3054 _Locinfo locinfo;
3056 *facet = MSVCRT_operator_new(sizeof(codecvt_wchar));
3057 if(!*facet) {
3058 ERR("Out of memory\n");
3059 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
3060 return 0;
3063 _Locinfo_ctor_cstr(&locinfo, MSVCP_basic_string_char_c_str(&loc->ptr->name));
3064 codecvt_wchar_ctor_locinfo((codecvt_wchar*)*facet, &locinfo, 0);
3065 _Locinfo_dtor(&locinfo);
3068 return LC_CTYPE;
3071 codecvt_wchar* codecvt_wchar_use_facet(const locale *loc)
3073 static codecvt_wchar *obj = NULL;
3075 _Lockit lock;
3076 const locale_facet *fac;
3078 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
3079 fac = locale__Getfacet(loc, locale_id_operator_size_t(&codecvt_wchar_id));
3080 if(fac) {
3081 _Lockit_dtor(&lock);
3082 return (codecvt_wchar*)fac;
3085 if(obj) {
3086 _Lockit_dtor(&lock);
3087 return obj;
3090 codecvt_wchar__Getcat(&fac, loc);
3091 obj = (codecvt_wchar*)fac;
3092 locale_facet__Incref(&obj->base.facet);
3093 locale_facet_register(&obj->base.facet);
3094 _Lockit_dtor(&lock);
3096 return obj;
3099 /* ?_Getcat@?$codecvt@GDH@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
3100 /* ?_Getcat@?$codecvt@GDH@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
3101 MSVCP_size_t __cdecl codecvt_short__Getcat(const locale_facet **facet, const locale *loc)
3103 TRACE("(%p %p)\n", facet, loc);
3105 if(facet && !*facet) {
3106 _Locinfo locinfo;
3108 *facet = MSVCRT_operator_new(sizeof(codecvt_wchar));
3109 if(!*facet) {
3110 ERR("Out of memory\n");
3111 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
3112 return 0;
3115 _Locinfo_ctor_cstr(&locinfo, MSVCP_basic_string_char_c_str(&loc->ptr->name));
3116 codecvt_short_ctor((codecvt_wchar*)*facet);
3117 _Locinfo_dtor(&locinfo);
3120 return LC_CTYPE;
3123 codecvt_wchar* codecvt_short_use_facet(const locale *loc)
3125 static codecvt_wchar *obj = NULL;
3127 _Lockit lock;
3128 const locale_facet *fac;
3130 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
3131 fac = locale__Getfacet(loc, locale_id_operator_size_t(&codecvt_short_id));
3132 if(fac) {
3133 _Lockit_dtor(&lock);
3134 return (codecvt_wchar*)fac;
3137 if(obj) {
3138 _Lockit_dtor(&lock);
3139 return obj;
3142 codecvt_short__Getcat(&fac, loc);
3143 obj = (codecvt_wchar*)fac;
3144 locale_facet__Incref(&obj->base.facet);
3145 locale_facet_register(&obj->base.facet);
3146 _Lockit_dtor(&lock);
3148 return obj;
3151 /* ?_Id_func@?$codecvt@_WDH@std@@SAAAVid@locale@2@XZ */
3152 /* ?_Id_func@?$codecvt@_WDH@std@@SAAEAVid@locale@2@XZ */
3153 locale_id* __cdecl codecvt_wchar__Id_func(void)
3155 TRACE("()\n");
3156 return &codecvt_wchar_id;
3159 /* ?_Id_func@?$codecvt@GDH@std@@SAAAVid@locale@2@XZ */
3160 /* ?_Id_func@?$codecvt@GDH@std@@SAAEAVid@locale@2@XZ */
3161 locale_id* __cdecl codecvt_short__Id_func(void)
3163 TRACE("()\n");
3164 return &codecvt_short_id;
3167 /* ?do_always_noconv@?$codecvt@GDH@std@@MBE_NXZ */
3168 /* ?do_always_noconv@?$codecvt@GDH@std@@MEBA_NXZ */
3169 /* ?do_always_noconv@?$codecvt@_WDH@std@@MBE_NXZ */
3170 /* ?do_always_noconv@?$codecvt@_WDH@std@@MEBA_NXZ */
3171 DEFINE_THISCALL_WRAPPER(codecvt_wchar_do_always_noconv, 4)
3172 MSVCP_bool __thiscall codecvt_wchar_do_always_noconv(const codecvt_wchar *this)
3174 TRACE("(%p)\n", this);
3175 return FALSE;
3178 /* ?do_max_length@?$codecvt@GDH@std@@MBEHXZ */
3179 /* ?do_max_length@?$codecvt@GDH@std@@MEBAHXZ */
3180 /* ?do_max_length@?$codecvt@_WDH@std@@MBEHXZ */
3181 /* ?do_max_length@?$codecvt@_WDH@std@@MEBAHXZ */
3182 DEFINE_THISCALL_WRAPPER(codecvt_wchar_do_max_length, 4)
3183 int __thiscall codecvt_wchar_do_max_length(const codecvt_wchar *this)
3185 TRACE("(%p)\n", this);
3186 return MB_LEN_MAX;
3189 /* ?do_in@?$codecvt@GDH@std@@MBEHAAHPBD1AAPBDPAG3AAPAG@Z */
3190 /* ?do_in@?$codecvt@GDH@std@@MEBAHAEAHPEBD1AEAPEBDPEAG3AEAPEAG@Z */
3191 /* ?do_in@?$codecvt@_WDH@std@@MBEHAAHPBD1AAPBDPA_W3AAPA_W@Z */
3192 /* ?do_in@?$codecvt@_WDH@std@@MEBAHAEAHPEBD1AEAPEBDPEA_W3AEAPEA_W@Z */
3193 #define call_codecvt_wchar_do_in(this, state, from, from_end, from_next, to, to_end, to_next) \
3194 CALL_VTBL_FUNC(this, 16, int, \
3195 (const codecvt_wchar*, int*, const char*, const char*, const char**, wchar_t*, wchar_t*, wchar_t**), \
3196 (this, state, from, from_end, from_next, to, to_end, to_next))
3197 DEFINE_THISCALL_WRAPPER(codecvt_wchar_do_in, 32)
3198 int __thiscall codecvt_wchar_do_in(const codecvt_wchar *this, int *state,
3199 const char *from, const char *from_end, const char **from_next,
3200 wchar_t *to, wchar_t *to_end, wchar_t **to_next)
3202 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from,
3203 from_end, from_next, to, to_end, to_next);
3205 *from_next = from;
3206 *to_next = to;
3208 while(*from_next!=from_end && *to_next!=to_end) {
3209 switch(_Mbrtowc(*to_next, *from_next, from_end-*from_next, state, &this->cvt)) {
3210 case -2:
3211 *from_next = from_end;
3212 return CODECVT_partial;
3213 case -1:
3214 return CODECVT_error;
3215 case 2:
3216 (*from_next)++;
3217 /* fall through */
3218 case 0:
3219 case 1:
3220 (*from_next)++;
3221 (*to_next)++;
3225 return CODECVT_ok;
3228 /* ?in@?$codecvt@GDH@std@@QBEHAAHPBD1AAPBDPAG3AAPAG@Z */
3229 /* ?in@?$codecvt@GDH@std@@QEBAHAEAHPEBD1AEAPEBDPEAG3AEAPEAG@Z */
3230 /* ?in@?$codecvt@_WDH@std@@QBEHAAHPBD1AAPBDPA_W3AAPA_W@Z */
3231 /* ?in@?$codecvt@_WDH@std@@QEBAHAEAHPEBD1AEAPEBDPEA_W3AEAPEA_W@Z */
3232 DEFINE_THISCALL_WRAPPER(codecvt_wchar_in, 32)
3233 int __thiscall codecvt_wchar_in(const codecvt_wchar *this, int *state,
3234 const char *from, const char *from_end, const char **from_next,
3235 wchar_t *to, wchar_t *to_end, wchar_t **to_next)
3237 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from,
3238 from_end, from_next, to, to_end, to_next);
3239 return call_codecvt_wchar_do_in(this, state, from,
3240 from_end, from_next, to, to_end, to_next);
3243 /* ?do_out@?$codecvt@GDH@std@@MBEHAAHPBG1AAPBGPAD3AAPAD@Z */
3244 /* ?do_out@?$codecvt@GDH@std@@MEBAHAEAHPEBG1AEAPEBGPEAD3AEAPEAD@Z */
3245 /* ?do_out@?$codecvt@_WDH@std@@MBEHAAHPB_W1AAPB_WPAD3AAPAD@Z */
3246 /* ?do_out@?$codecvt@_WDH@std@@MEBAHAEAHPEB_W1AEAPEB_WPEAD3AEAPEAD@Z */
3247 #define call_codecvt_wchar_do_out(this, state, from, from_end, from_next, to, to_end, to_next) \
3248 CALL_VTBL_FUNC(this, 20, int, \
3249 (const codecvt_wchar*, int*, const wchar_t*, const wchar_t*, const wchar_t**, char*, char*, char**), \
3250 (this, state, from, from_end, from_next, to, to_end, to_next))
3251 DEFINE_THISCALL_WRAPPER(codecvt_wchar_do_out, 32)
3252 int __thiscall codecvt_wchar_do_out(const codecvt_wchar *this, int *state,
3253 const wchar_t *from, const wchar_t *from_end, const wchar_t **from_next,
3254 char *to, char *to_end, char **to_next)
3256 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from,
3257 from_end, from_next, to, to_end, to_next);
3259 *from_next = from;
3260 *to_next = to;
3262 while(*from_next!=from_end && *to_next!=to_end) {
3263 int old_state = *state, size;
3264 char buf[MB_LEN_MAX];
3266 switch((size = _Wcrtomb(buf, **from_next, state, &this->cvt))) {
3267 case -1:
3268 return CODECVT_error;
3269 default:
3270 if(size > from_end-*from_next) {
3271 *state = old_state;
3272 return CODECVT_partial;
3275 (*from_next)++;
3276 memcpy_s(*to_next, to_end-*to_next, buf, size);
3277 (*to_next) += size;
3281 return CODECVT_ok;
3284 /* ?out@?$codecvt@GDH@std@@QBEHAAHPBG1AAPBGPAD3AAPAD@Z */
3285 /* ?out@?$codecvt@GDH@std@@QEBAHAEAHPEBG1AEAPEBGPEAD3AEAPEAD@Z */
3286 /* ?out@?$codecvt@_WDH@std@@QBEHAAHPB_W1AAPB_WPAD3AAPAD@Z */
3287 /* ?out@?$codecvt@_WDH@std@@QEBAHAEAHPEB_W1AEAPEB_WPEAD3AEAPEAD@Z */
3288 DEFINE_THISCALL_WRAPPER(codecvt_wchar_out, 32)
3289 int __thiscall codecvt_wchar_out(const codecvt_wchar *this, int *state,
3290 const wchar_t *from, const wchar_t *from_end, const wchar_t **from_next,
3291 char *to, char *to_end, char **to_next)
3293 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from,
3294 from_end, from_next, to, to_end, to_next);
3295 return call_codecvt_wchar_do_out(this, state, from,
3296 from_end, from_next, to, to_end, to_next);
3299 /* ?do_unshift@?$codecvt@GDH@std@@MBEHAAHPAD1AAPAD@Z */
3300 /* ?do_unshift@?$codecvt@GDH@std@@MEBAHAEAHPEAD1AEAPEAD@Z */
3301 /* ?do_unshift@?$codecvt@_WDH@std@@MBEHAAHPAD1AAPAD@Z */
3302 /* ?do_unshift@?$codecvt@_WDH@std@@MEBAHAEAHPEAD1AEAPEAD@Z */
3303 #define call_codecvt_wchar_do_unshift(this, state, to, to_end, to_next) CALL_VTBL_FUNC(this, 24, \
3304 int, (const codecvt_wchar*, int*, char*, char*, char**), (this, state, to, to_end, to_next))
3305 DEFINE_THISCALL_WRAPPER(codecvt_wchar_do_unshift, 20)
3306 int __thiscall codecvt_wchar_do_unshift(const codecvt_wchar *this,
3307 int *state, char *to, char *to_end, char **to_next)
3309 TRACE("(%p %p %p %p %p)\n", this, state, to, to_end, to_next);
3310 if(*state)
3311 WARN("unexpected state: %x\n", *state);
3313 *to_next = to;
3314 return CODECVT_ok;
3317 /* ?unshift@?$codecvt@GDH@std@@QBEHAAHPAD1AAPAD@Z */
3318 /* ?unshift@?$codecvt@GDH@std@@QEBAHAEAHPEAD1AEAPEAD@Z */
3319 /* ?unshift@?$codecvt@_WDH@std@@QBEHAAHPAD1AAPAD@Z */
3320 /* ?unshift@?$codecvt@_WDH@std@@QEBAHAEAHPEAD1AEAPEAD@Z */
3321 DEFINE_THISCALL_WRAPPER(codecvt_wchar_unshift, 20)
3322 int __thiscall codecvt_wchar_unshift(const codecvt_wchar *this,
3323 int *state, char *to, char *to_end, char **to_next)
3325 TRACE("(%p %p %p %p %p)\n", this, state, to, to_end, to_next);
3326 return call_codecvt_wchar_do_unshift(this, state, to, to_end, to_next);
3329 /* ?do_length@?$codecvt@GDH@std@@MBEHABHPBD1I@Z */
3330 /* ?do_length@?$codecvt@GDH@std@@MEBAHAEBHPEBD1_K@Z */
3331 /* ?do_length@?$codecvt@_WDH@std@@MBEHABHPBD1I@Z */
3332 /* ?do_length@?$codecvt@_WDH@std@@MEBAHAEBHPEBD1_K@Z */
3333 #define call_codecvt_wchar_do_length(this, state, from, from_end, max) CALL_VTBL_FUNC(this, 28, \
3334 int, (const codecvt_wchar*, const int*, const char*, const char*, MSVCP_size_t), \
3335 (this, state, from, from_end, max))
3336 DEFINE_THISCALL_WRAPPER(codecvt_wchar_do_length, 20)
3337 int __thiscall codecvt_wchar_do_length(const codecvt_wchar *this, const int *state,
3338 const char *from, const char *from_end, MSVCP_size_t max)
3340 int tmp_state = *state, ret=0;
3342 TRACE("(%p %p %p %p %ld)\n", this, state, from, from_end, max);
3344 while(ret<max && from!=from_end) {
3345 switch(_Mbrtowc(NULL, from, from_end-from, &tmp_state, &this->cvt)) {
3346 case -2:
3347 case -1:
3348 return ret;
3349 case 2:
3350 from++;
3351 /* fall through */
3352 case 0:
3353 case 1:
3354 from++;
3355 ret++;
3359 return ret;
3362 /* ?length@?$codecvt@GDH@std@@QBEHABHPBD1I@Z */
3363 /* ?length@?$codecvt@GDH@std@@QEBAHAEBHPEBD1_K@Z */
3364 /* ?length@?$codecvt@_WDH@std@@QBEHABHPBD1I@Z */
3365 /* ?length@?$codecvt@_WDH@std@@QEBAHAEBHPEBD1_K@Z */
3366 DEFINE_THISCALL_WRAPPER(codecvt_wchar_length, 20)
3367 int __thiscall codecvt_wchar_length(const codecvt_wchar *this, const int *state,
3368 const char *from, const char *from_end, MSVCP_size_t max)
3370 TRACE("(%p %p %p %p %ld)\n", this, state, from, from_end, max);
3371 return call_codecvt_wchar_do_length(this, state, from, from_end, max);
3374 /* ?id@?$numpunct@D@std@@2V0locale@2@A */
3375 locale_id numpunct_char_id = {0};
3377 /* ??_7?$numpunct@D@std@@6B@ */
3378 extern const vtable_ptr MSVCP_numpunct_char_vtable;
3380 /* ?_Init@?$numpunct@D@std@@IAEXABV_Locinfo@2@_N@Z */
3381 /* ?_Init@?$numpunct@D@std@@IEAAXAEBV_Locinfo@2@_N@Z */
3382 DEFINE_THISCALL_WRAPPER(numpunct_char__Init, 12)
3383 void __thiscall numpunct_char__Init(numpunct_char *this, const _Locinfo *locinfo, MSVCP_bool isdef)
3385 int len;
3387 TRACE("(%p %p %d)\n", this, locinfo, isdef);
3389 len = strlen(_Locinfo__Getfalse(locinfo))+1;
3390 this->false_name = MSVCRT_operator_new(len);
3391 if(this->false_name)
3392 memcpy((char*)this->false_name, _Locinfo__Getfalse(locinfo), len);
3394 len = strlen(_Locinfo__Gettrue(locinfo))+1;
3395 this->true_name = MSVCRT_operator_new(len);
3396 if(this->true_name)
3397 memcpy((char*)this->true_name, _Locinfo__Gettrue(locinfo), len);
3399 if(isdef) {
3400 this->grouping = MSVCRT_operator_new(1);
3401 if(this->grouping)
3402 *(char*)this->grouping = 0;
3404 this->dp = '.';
3405 this->sep = ',';
3406 } else {
3407 const struct lconv *lc = _Locinfo__Getlconv(locinfo);
3409 len = strlen(lc->grouping)+1;
3410 this->grouping = MSVCRT_operator_new(len);
3411 if(this->grouping)
3412 memcpy((char*)this->grouping, lc->grouping, len);
3414 this->dp = lc->decimal_point[0];
3415 this->sep = lc->thousands_sep[0];
3418 if(!this->false_name || !this->true_name || !this->grouping) {
3419 MSVCRT_operator_delete((char*)this->grouping);
3420 MSVCRT_operator_delete((char*)this->false_name);
3421 MSVCRT_operator_delete((char*)this->true_name);
3423 ERR("Out of memory\n");
3424 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
3428 /* ?_Tidy@?$numpunct@D@std@@AAEXXZ */
3429 /* ?_Tidy@?$numpunct@D@std@@AEAAXXZ */
3430 DEFINE_THISCALL_WRAPPER(numpunct_char__Tidy, 4)
3431 void __thiscall numpunct_char__Tidy(numpunct_char *this)
3433 TRACE("(%p)\n", this);
3435 MSVCRT_operator_delete((char*)this->grouping);
3436 MSVCRT_operator_delete((char*)this->false_name);
3437 MSVCRT_operator_delete((char*)this->true_name);
3440 /* ??0?$numpunct@D@std@@QAE@ABV_Locinfo@1@I_N@Z */
3441 /* ??0?$numpunct@D@std@@QEAA@AEBV_Locinfo@1@_K_N@Z */
3442 DEFINE_THISCALL_WRAPPER(numpunct_char_ctor_locinfo, 16)
3443 numpunct_char* __thiscall numpunct_char_ctor_locinfo(numpunct_char *this,
3444 const _Locinfo *locinfo, MSVCP_size_t refs, MSVCP_bool usedef)
3446 TRACE("(%p %p %lu %d)\n", this, locinfo, refs, usedef);
3447 locale_facet_ctor_refs(&this->facet, refs);
3448 this->facet.vtable = &MSVCP_numpunct_char_vtable;
3449 numpunct_char__Init(this, locinfo, usedef);
3450 return this;
3453 /* ??0?$numpunct@D@std@@IAE@PBDI_N@Z */
3454 /* ??0?$numpunct@D@std@@IEAA@PEBD_K_N@Z */
3455 DEFINE_THISCALL_WRAPPER(numpunct_char_ctor_name, 16)
3456 numpunct_char* __thiscall numpunct_char_ctor_name(numpunct_char *this,
3457 const char *name, MSVCP_size_t refs, MSVCP_bool usedef)
3459 _Locinfo locinfo;
3461 TRACE("(%p %s %lu %d)\n", this, debugstr_a(name), refs, usedef);
3462 locale_facet_ctor_refs(&this->facet, refs);
3463 this->facet.vtable = &MSVCP_numpunct_char_vtable;
3465 _Locinfo_ctor_cstr(&locinfo, name);
3466 numpunct_char__Init(this, &locinfo, usedef);
3467 _Locinfo_dtor(&locinfo);
3468 return this;
3471 /* ??0?$numpunct@D@std@@QAE@I@Z */
3472 /* ??0?$numpunct@D@std@@QEAA@_K@Z */
3473 DEFINE_THISCALL_WRAPPER(numpunct_char_ctor_refs, 8)
3474 numpunct_char* __thiscall numpunct_char_ctor_refs(numpunct_char *this, MSVCP_size_t refs)
3476 TRACE("(%p %lu)\n", this, refs);
3477 return numpunct_char_ctor_name(this, "C", refs, FALSE);
3480 /* ??_F?$numpunct@D@std@@QAEXXZ */
3481 /* ??_F?$numpunct@D@std@@QEAAXXZ */
3482 DEFINE_THISCALL_WRAPPER(numpunct_char_ctor, 4)
3483 numpunct_char* __thiscall numpunct_char_ctor(numpunct_char *this)
3485 return numpunct_char_ctor_refs(this, 0);
3488 /* ??1?$numpunct@D@std@@MAE@XZ */
3489 /* ??1?$numpunct@D@std@@MEAA@XZ */
3490 DEFINE_THISCALL_WRAPPER(numpunct_char_dtor, 4)
3491 void __thiscall numpunct_char_dtor(numpunct_char *this)
3493 TRACE("(%p)\n", this);
3494 numpunct_char__Tidy(this);
3497 DEFINE_THISCALL_WRAPPER(numpunct_char_vector_dtor, 8)
3498 numpunct_char* __thiscall numpunct_char_vector_dtor(numpunct_char *this, unsigned int flags)
3500 TRACE("(%p %x)\n", this, flags);
3501 if(flags & 2) {
3502 /* we have an array, with the number of elements stored before the first object */
3503 INT_PTR i, *ptr = (INT_PTR *)this-1;
3505 for(i=*ptr-1; i>=0; i--)
3506 numpunct_char_dtor(this+i);
3507 MSVCRT_operator_delete(ptr);
3508 } else {
3509 numpunct_char_dtor(this);
3510 if(flags & 1)
3511 MSVCRT_operator_delete(this);
3514 return this;
3517 /* ?_Getcat@?$numpunct@D@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
3518 /* ?_Getcat@?$numpunct@D@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
3519 MSVCP_size_t __cdecl numpunct_char__Getcat(const locale_facet **facet, const locale *loc)
3521 TRACE("(%p %p)\n", facet, loc);
3523 if(facet && !*facet) {
3524 *facet = MSVCRT_operator_new(sizeof(numpunct_char));
3525 if(!*facet) {
3526 ERR("Out of memory\n");
3527 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
3528 return 0;
3530 numpunct_char_ctor_name((numpunct_char*)*facet,
3531 MSVCP_basic_string_char_c_str(&loc->ptr->name), 0, TRUE);
3534 return LC_NUMERIC;
3537 static numpunct_char* numpunct_char_use_facet(const locale *loc)
3539 static numpunct_char *obj = NULL;
3541 _Lockit lock;
3542 const locale_facet *fac;
3544 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
3545 fac = locale__Getfacet(loc, locale_id_operator_size_t(&numpunct_char_id));
3546 if(fac) {
3547 _Lockit_dtor(&lock);
3548 return (numpunct_char*)fac;
3551 if(obj) {
3552 _Lockit_dtor(&lock);
3553 return obj;
3556 numpunct_char__Getcat(&fac, loc);
3557 obj = (numpunct_char*)fac;
3558 locale_facet__Incref(&obj->facet);
3559 locale_facet_register(&obj->facet);
3560 _Lockit_dtor(&lock);
3562 return obj;
3565 /* ?do_decimal_point@?$numpunct@D@std@@MBEDXZ */
3566 /* ?do_decimal_point@?$numpunct@D@std@@MEBADXZ */
3567 DEFINE_THISCALL_WRAPPER(numpunct_char_do_decimal_point, 4)
3568 #define call_numpunct_char_do_decimal_point(this) CALL_VTBL_FUNC(this, 4, \
3569 char, (const numpunct_char *this), (this))
3570 char __thiscall numpunct_char_do_decimal_point(const numpunct_char *this)
3572 TRACE("(%p)\n", this);
3573 return this->dp;
3576 /* ?decimal_point@?$numpunct@D@std@@QBEDXZ */
3577 /* ?decimal_point@?$numpunct@D@std@@QEBADXZ */
3578 DEFINE_THISCALL_WRAPPER(numpunct_char_decimal_point, 4)
3579 char __thiscall numpunct_char_decimal_point(const numpunct_char *this)
3581 TRACE("(%p)\n", this);
3582 return call_numpunct_char_do_decimal_point(this);
3585 /* ?do_thousands_sep@?$numpunct@D@std@@MBEDXZ */
3586 /* ?do_thousands_sep@?$numpunct@D@std@@MEBADXZ */
3587 DEFINE_THISCALL_WRAPPER(numpunct_char_do_thousands_sep, 4)
3588 #define call_numpunct_char_do_thousands_sep(this) CALL_VTBL_FUNC(this, 8, \
3589 char, (const numpunct_char*), (this))
3590 char __thiscall numpunct_char_do_thousands_sep(const numpunct_char *this)
3592 TRACE("(%p)\n", this);
3593 return this->sep;
3596 /* ?thousands_sep@?$numpunct@D@std@@QBEDXZ */
3597 /* ?thousands_sep@?$numpunct@D@std@@QEBADXZ */
3598 DEFINE_THISCALL_WRAPPER(numpunct_char_thousands_sep, 4)
3599 char __thiscall numpunct_char_thousands_sep(const numpunct_char *this)
3601 TRACE("(%p)\n", this);
3602 return call_numpunct_char_do_thousands_sep(this);
3605 /* ?do_grouping@?$numpunct@D@std@@MBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3606 /* ?do_grouping@?$numpunct@D@std@@MEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3607 DEFINE_THISCALL_WRAPPER(numpunct_char_do_grouping, 8)
3608 #define call_numpunct_char_do_grouping(this, ret) CALL_VTBL_FUNC(this, 12, \
3609 basic_string_char*, (const numpunct_char*, basic_string_char*), (this, ret))
3610 basic_string_char* __thiscall numpunct_char_do_grouping(
3611 const numpunct_char *this, basic_string_char *ret)
3613 TRACE("(%p)\n", this);
3614 return MSVCP_basic_string_char_ctor_cstr(ret, this->grouping);
3617 /* ?grouping@?$numpunct@D@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3618 /* ?grouping@?$numpunct@D@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3619 DEFINE_THISCALL_WRAPPER(numpunct_char_grouping, 8)
3620 basic_string_char* __thiscall numpunct_char_grouping(const numpunct_char *this, basic_string_char *ret)
3622 TRACE("(%p)\n", this);
3623 return call_numpunct_char_do_grouping(this, ret);
3626 /* ?do_falsename@?$numpunct@D@std@@MBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3627 /* ?do_falsename@?$numpunct@D@std@@MEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3628 DEFINE_THISCALL_WRAPPER(numpunct_char_do_falsename, 8)
3629 #define call_numpunct_char_do_falsename(this, ret) CALL_VTBL_FUNC(this, 16, \
3630 basic_string_char*, (const numpunct_char*, basic_string_char*), (this, ret))
3631 basic_string_char* __thiscall numpunct_char_do_falsename(
3632 const numpunct_char *this, basic_string_char *ret)
3634 TRACE("(%p)\n", this);
3635 return MSVCP_basic_string_char_ctor_cstr(ret, this->false_name);
3638 /* ?falsename@?$numpunct@D@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3639 /* ?falsename@?$numpunct@D@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3640 DEFINE_THISCALL_WRAPPER(numpunct_char_falsename, 8)
3641 basic_string_char* __thiscall numpunct_char_falsename(const numpunct_char *this, basic_string_char *ret)
3643 TRACE("(%p)\n", this);
3644 return call_numpunct_char_do_falsename(this, ret);
3647 /* ?do_truename@?$numpunct@D@std@@MBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3648 /* ?do_truename@?$numpunct@D@std@@MEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3649 DEFINE_THISCALL_WRAPPER(numpunct_char_do_truename, 8)
3650 #define call_numpunct_char_do_truename(this, ret) CALL_VTBL_FUNC(this, 20, \
3651 basic_string_char*, (const numpunct_char*, basic_string_char*), (this, ret))
3652 basic_string_char* __thiscall numpunct_char_do_truename(
3653 const numpunct_char *this, basic_string_char *ret)
3655 TRACE("(%p)\n", this);
3656 return MSVCP_basic_string_char_ctor_cstr(ret, this->true_name);
3659 /* ?truename@?$numpunct@D@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3660 /* ?truename@?$numpunct@D@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3661 DEFINE_THISCALL_WRAPPER(numpunct_char_truename, 8)
3662 basic_string_char* __thiscall numpunct_char_truename(const numpunct_char *this, basic_string_char *ret)
3664 TRACE("(%p)\n", this);
3665 return call_numpunct_char_do_truename(this, ret);
3668 /* ?id@?$numpunct@_W@std@@2V0locale@2@A */
3669 locale_id numpunct_wchar_id = {0};
3670 /* ?id@?$numpunct@G@std@@2V0locale@2@A */
3671 locale_id numpunct_short_id = {0};
3673 /* ??_7?$numpunct@_W@std@@6B@ */
3674 extern const vtable_ptr MSVCP_numpunct_wchar_vtable;
3675 /* ??_7?$numpunct@G@std@@6B@ */
3676 extern const vtable_ptr MSVCP_numpunct_short_vtable;
3678 /* ?_Init@?$numpunct@_W@std@@IAEXABV_Locinfo@2@_N@Z */
3679 /* ?_Init@?$numpunct@_W@std@@IEAAXAEBV_Locinfo@2@_N@Z */
3680 /* ?_Init@?$numpunct@G@std@@IAEXABV_Locinfo@2@_N@Z */
3681 /* ?_Init@?$numpunct@G@std@@IEAAXAEBV_Locinfo@2@_N@Z */
3682 DEFINE_THISCALL_WRAPPER(numpunct_wchar__Init, 12)
3683 void __thiscall numpunct_wchar__Init(numpunct_wchar *this,
3684 const _Locinfo *locinfo, MSVCP_bool isdef)
3686 const char *to_convert;
3687 _Cvtvec cvt;
3688 int len;
3690 TRACE("(%p %p %d)\n", this, locinfo, isdef);
3692 _Locinfo__Getcvt(locinfo, &cvt);
3694 to_convert = _Locinfo__Getfalse(locinfo);
3695 len = MultiByteToWideChar(cvt.page, 0, to_convert, -1, NULL, 0);
3696 this->false_name = MSVCRT_operator_new(len*sizeof(WCHAR));
3697 if(this->false_name)
3698 MultiByteToWideChar(cvt.page, 0, to_convert, -1,
3699 (wchar_t*)this->false_name, len);
3701 to_convert = _Locinfo__Gettrue(locinfo);
3702 len = MultiByteToWideChar(cvt.page, 0, to_convert, -1, NULL, 0);
3703 this->true_name = MSVCRT_operator_new(len*sizeof(WCHAR));
3704 if(this->true_name)
3705 MultiByteToWideChar(cvt.page, 0, to_convert, -1,
3706 (wchar_t*)this->true_name, len);
3708 if(isdef) {
3709 this->grouping = MSVCRT_operator_new(1);
3710 if(this->grouping)
3711 *(char*)this->grouping = 0;
3713 this->dp = '.';
3714 this->sep = ',';
3715 } else {
3716 const struct lconv *lc = _Locinfo__Getlconv(locinfo);
3718 len = strlen(lc->grouping)+1;
3719 this->grouping = MSVCRT_operator_new(len);
3720 if(this->grouping)
3721 memcpy((char*)this->grouping, lc->grouping, len);
3723 this->dp = lc->decimal_point[0];
3724 this->sep = lc->thousands_sep[0];
3727 if(!this->false_name || !this->true_name || !this->grouping) {
3728 MSVCRT_operator_delete((char*)this->grouping);
3729 MSVCRT_operator_delete((wchar_t*)this->false_name);
3730 MSVCRT_operator_delete((wchar_t*)this->true_name);
3732 ERR("Out of memory\n");
3733 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
3737 /* ?_Tidy@?$numpunct@_W@std@@AAEXXZ */
3738 /* ?_Tidy@?$numpunct@_W@std@@AEAAXXZ */
3739 /* ?_Tidy@?$numpunct@G@std@@AAEXXZ */
3740 /* ?_Tidy@?$numpunct@G@std@@AEAAXXZ */
3741 DEFINE_THISCALL_WRAPPER(numpunct_wchar__Tidy, 4)
3742 void __thiscall numpunct_wchar__Tidy(numpunct_wchar *this)
3744 TRACE("(%p)\n", this);
3746 MSVCRT_operator_delete((char*)this->grouping);
3747 MSVCRT_operator_delete((wchar_t*)this->false_name);
3748 MSVCRT_operator_delete((wchar_t*)this->true_name);
3751 /* ??0?$numpunct@_W@std@@QAE@ABV_Locinfo@1@I_N@Z */
3752 /* ??0?$numpunct@_W@std@@QEAA@AEBV_Locinfo@1@_K_N@Z */
3753 DEFINE_THISCALL_WRAPPER(numpunct_wchar_ctor_locinfo, 16)
3754 numpunct_wchar* __thiscall numpunct_wchar_ctor_locinfo(numpunct_wchar *this,
3755 const _Locinfo *locinfo, MSVCP_size_t refs, MSVCP_bool usedef)
3757 TRACE("(%p %p %lu %d)\n", this, locinfo, refs, usedef);
3758 locale_facet_ctor_refs(&this->facet, refs);
3759 this->facet.vtable = &MSVCP_numpunct_wchar_vtable;
3760 numpunct_wchar__Init(this, locinfo, usedef);
3761 return this;
3764 /* ??0?$numpunct@G@std@@QAE@ABV_Locinfo@1@I_N@Z */
3765 /* ??0?$numpunct@G@std@@QEAA@AEBV_Locinfo@1@_K_N@Z */
3766 DEFINE_THISCALL_WRAPPER(numpunct_short_ctor_locinfo, 16)
3767 numpunct_wchar* __thiscall numpunct_short_ctor_locinfo(numpunct_wchar *this,
3768 const _Locinfo *locinfo, MSVCP_size_t refs, MSVCP_bool usedef)
3770 numpunct_wchar_ctor_locinfo(this, locinfo, refs, usedef);
3771 this->facet.vtable = &MSVCP_numpunct_short_vtable;
3772 return this;
3775 /* ??0?$numpunct@_W@std@@IAE@PBDI_N@Z */
3776 /* ??0?$numpunct@_W@std@@IEAA@PEBD_K_N@Z */
3777 DEFINE_THISCALL_WRAPPER(numpunct_wchar_ctor_name, 16)
3778 numpunct_wchar* __thiscall numpunct_wchar_ctor_name(numpunct_wchar *this,
3779 const char *name, MSVCP_size_t refs, MSVCP_bool usedef)
3781 _Locinfo locinfo;
3783 TRACE("(%p %s %lu %d)\n", this, debugstr_a(name), refs, usedef);
3784 locale_facet_ctor_refs(&this->facet, refs);
3785 this->facet.vtable = &MSVCP_numpunct_wchar_vtable;
3787 _Locinfo_ctor_cstr(&locinfo, name);
3788 numpunct_wchar__Init(this, &locinfo, usedef);
3789 _Locinfo_dtor(&locinfo);
3790 return this;
3793 /* ??0?$numpunct@G@std@@IAE@PBDI_N@Z */
3794 /* ??0?$numpunct@G@std@@IEAA@PEBD_K_N@Z */
3795 DEFINE_THISCALL_WRAPPER(numpunct_short_ctor_name, 16)
3796 numpunct_wchar* __thiscall numpunct_short_ctor_name(numpunct_wchar *this,
3797 const char *name, MSVCP_size_t refs, MSVCP_bool usedef)
3799 numpunct_wchar_ctor_name(this, name, refs, usedef);
3800 this->facet.vtable = &MSVCP_numpunct_short_vtable;
3801 return this;
3804 /* ??0?$numpunct@_W@std@@QAE@I@Z */
3805 /* ??0?$numpunct@_W@std@@QEAA@_K@Z */
3806 DEFINE_THISCALL_WRAPPER(numpunct_wchar_ctor_refs, 8)
3807 numpunct_wchar* __thiscall numpunct_wchar_ctor_refs(numpunct_wchar *this, MSVCP_size_t refs)
3809 TRACE("(%p %lu)\n", this, refs);
3810 return numpunct_wchar_ctor_name(this, "C", refs, FALSE);
3813 /* ??0?$numpunct@G@std@@QAE@I@Z */
3814 /* ??0?$numpunct@G@std@@QEAA@_K@Z */
3815 DEFINE_THISCALL_WRAPPER(numpunct_short_ctor_refs, 8)
3816 numpunct_wchar* __thiscall numpunct_short_ctor_refs(numpunct_wchar *this, MSVCP_size_t refs)
3818 numpunct_wchar_ctor_refs(this, refs);
3819 this->facet.vtable = &MSVCP_numpunct_short_vtable;
3820 return this;
3823 /* ??_F?$numpunct@_W@std@@QAEXXZ */
3824 /* ??_F?$numpunct@_W@std@@QEAAXXZ */
3825 DEFINE_THISCALL_WRAPPER(numpunct_wchar_ctor, 4)
3826 numpunct_wchar* __thiscall numpunct_wchar_ctor(numpunct_wchar *this)
3828 return numpunct_wchar_ctor_refs(this, 0);
3831 /* ??_F?$numpunct@G@std@@QAEXXZ */
3832 /* ??_F?$numpunct@G@std@@QEAAXXZ */
3833 DEFINE_THISCALL_WRAPPER(numpunct_short_ctor, 4)
3834 numpunct_wchar* __thiscall numpunct_short_ctor(numpunct_wchar *this)
3836 return numpunct_short_ctor_refs(this, 0);
3839 /* ??1?$numpunct@_W@std@@MAE@XZ */
3840 /* ??1?$numpunct@_W@std@@MEAA@XZ */
3841 /* ??1?$numpunct@G@std@@MAE@XZ */
3842 /* ??1?$numpunct@G@std@@MEAA@XZ */
3843 DEFINE_THISCALL_WRAPPER(numpunct_wchar_dtor, 4)
3844 void __thiscall numpunct_wchar_dtor(numpunct_wchar *this)
3846 TRACE("(%p)\n", this);
3847 numpunct_wchar__Tidy(this);
3850 DEFINE_THISCALL_WRAPPER(numpunct_wchar_vector_dtor, 8)
3851 numpunct_wchar* __thiscall numpunct_wchar_vector_dtor(numpunct_wchar *this, unsigned int flags)
3853 TRACE("(%p %x)\n", this, flags);
3854 if(flags & 2) {
3855 /* we have an array, with the number of elements stored before the first object */
3856 INT_PTR i, *ptr = (INT_PTR *)this-1;
3858 for(i=*ptr-1; i>=0; i--)
3859 numpunct_wchar_dtor(this+i);
3860 MSVCRT_operator_delete(ptr);
3861 } else {
3862 numpunct_wchar_dtor(this);
3863 if(flags & 1)
3864 MSVCRT_operator_delete(this);
3867 return this;
3870 /* ?_Getcat@?$numpunct@_W@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
3871 /* ?_Getcat@?$numpunct@_W@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
3872 MSVCP_size_t __cdecl numpunct_wchar__Getcat(const locale_facet **facet, const locale *loc)
3874 TRACE("(%p %p)\n", facet, loc);
3876 if(facet && !*facet) {
3877 *facet = MSVCRT_operator_new(sizeof(numpunct_wchar));
3878 if(!*facet) {
3879 ERR("Out of memory\n");
3880 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
3881 return 0;
3883 numpunct_wchar_ctor_name((numpunct_wchar*)*facet,
3884 MSVCP_basic_string_char_c_str(&loc->ptr->name), 0, TRUE);
3887 return LC_NUMERIC;
3890 static numpunct_wchar* numpunct_wchar_use_facet(const locale *loc)
3892 static numpunct_wchar *obj = NULL;
3894 _Lockit lock;
3895 const locale_facet *fac;
3897 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
3898 fac = locale__Getfacet(loc, locale_id_operator_size_t(&numpunct_wchar_id));
3899 if(fac) {
3900 _Lockit_dtor(&lock);
3901 return (numpunct_wchar*)fac;
3904 if(obj) {
3905 _Lockit_dtor(&lock);
3906 return obj;
3909 numpunct_wchar__Getcat(&fac, loc);
3910 obj = (numpunct_wchar*)fac;
3911 locale_facet__Incref(&obj->facet);
3912 locale_facet_register(&obj->facet);
3913 _Lockit_dtor(&lock);
3915 return obj;
3918 /* ?_Getcat@?$numpunct@G@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
3919 /* ?_Getcat@?$numpunct@G@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
3920 MSVCP_size_t __cdecl numpunct_short__Getcat(const locale_facet **facet, const locale *loc)
3922 TRACE("(%p %p)\n", facet, loc);
3924 if(facet && !*facet) {
3925 *facet = MSVCRT_operator_new(sizeof(numpunct_wchar));
3926 if(!*facet) {
3927 ERR("Out of memory\n");
3928 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
3929 return 0;
3931 numpunct_short_ctor_name((numpunct_wchar*)*facet,
3932 MSVCP_basic_string_char_c_str(&loc->ptr->name), 0, TRUE);
3935 return LC_NUMERIC;
3938 static numpunct_wchar* numpunct_short_use_facet(const locale *loc)
3940 static numpunct_wchar *obj = NULL;
3942 _Lockit lock;
3943 const locale_facet *fac;
3945 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
3946 fac = locale__Getfacet(loc, locale_id_operator_size_t(&numpunct_short_id));
3947 if(fac) {
3948 _Lockit_dtor(&lock);
3949 return (numpunct_wchar*)fac;
3952 if(obj) {
3953 _Lockit_dtor(&lock);
3954 return obj;
3957 numpunct_short__Getcat(&fac, loc);
3958 obj = (numpunct_wchar*)fac;
3959 locale_facet__Incref(&obj->facet);
3960 locale_facet_register(&obj->facet);
3961 _Lockit_dtor(&lock);
3963 return obj;
3966 /* ?do_decimal_point@?$numpunct@_W@std@@MBE_WXZ */
3967 /* ?do_decimal_point@?$numpunct@_W@std@@MEBA_WXZ */
3968 /* ?do_decimal_point@?$numpunct@G@std@@MBEGXZ */
3969 /* ?do_decimal_point@?$numpunct@G@std@@MEBAGXZ */
3970 DEFINE_THISCALL_WRAPPER(numpunct_wchar_do_decimal_point, 4)
3971 #define call_numpunct_wchar_do_decimal_point(this) CALL_VTBL_FUNC(this, 4, \
3972 wchar_t, (const numpunct_wchar *this), (this))
3973 wchar_t __thiscall numpunct_wchar_do_decimal_point(const numpunct_wchar *this)
3975 TRACE("(%p)\n", this);
3976 return this->dp;
3979 /* ?decimal_point@?$numpunct@_W@std@@QBE_WXZ */
3980 /* ?decimal_point@?$numpunct@_W@std@@QEBA_WXZ */
3981 /* ?decimal_point@?$numpunct@G@std@@QBEGXZ */
3982 /* ?decimal_point@?$numpunct@G@std@@QEBAGXZ */
3983 DEFINE_THISCALL_WRAPPER(numpunct_wchar_decimal_point, 4)
3984 wchar_t __thiscall numpunct_wchar_decimal_point(const numpunct_wchar *this)
3986 TRACE("(%p)\n", this);
3987 return call_numpunct_wchar_do_decimal_point(this);
3990 /* ?do_thousands_sep@?$numpunct@_W@std@@MBE_WXZ */
3991 /* ?do_thousands_sep@?$numpunct@_W@std@@MEBA_WXZ */
3992 /* ?do_thousands_sep@?$numpunct@G@std@@MBEGXZ */
3993 /* ?do_thousands_sep@?$numpunct@G@std@@MEBAGXZ */
3994 DEFINE_THISCALL_WRAPPER(numpunct_wchar_do_thousands_sep, 4)
3995 #define call_numpunct_wchar_do_thousands_sep(this) CALL_VTBL_FUNC(this, 8, \
3996 wchar_t, (const numpunct_wchar *this), (this))
3997 wchar_t __thiscall numpunct_wchar_do_thousands_sep(const numpunct_wchar *this)
3999 TRACE("(%p)\n", this);
4000 return this->sep;
4003 /* ?thousands_sep@?$numpunct@_W@std@@QBE_WXZ */
4004 /* ?thousands_sep@?$numpunct@_W@std@@QEBA_WXZ */
4005 /* ?thousands_sep@?$numpunct@G@std@@QBEGXZ */
4006 /* ?thousands_sep@?$numpunct@G@std@@QEBAGXZ */
4007 DEFINE_THISCALL_WRAPPER(numpunct_wchar_thousands_sep, 4)
4008 wchar_t __thiscall numpunct_wchar_thousands_sep(const numpunct_wchar *this)
4010 TRACE("(%p)\n", this);
4011 return call_numpunct_wchar_do_thousands_sep(this);
4014 /* ?do_grouping@?$numpunct@_W@std@@MBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4015 /* ?do_grouping@?$numpunct@_W@std@@MEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4016 /* ?do_grouping@?$numpunct@G@std@@MBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4017 /* ?do_grouping@?$numpunct@G@std@@MEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4018 DEFINE_THISCALL_WRAPPER(numpunct_wchar_do_grouping, 8)
4019 #define call_numpunct_wchar_do_grouping(this, ret) CALL_VTBL_FUNC(this, 12, \
4020 basic_string_char*, (const numpunct_wchar*, basic_string_char*), (this, ret))
4021 basic_string_char* __thiscall numpunct_wchar_do_grouping(const numpunct_wchar *this, basic_string_char *ret)
4023 TRACE("(%p)\n", this);
4024 return MSVCP_basic_string_char_ctor_cstr(ret, this->grouping);
4027 /* ?grouping@?$numpunct@_W@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4028 /* ?grouping@?$numpunct@_W@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4029 /* ?grouping@?$numpunct@G@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4030 /* ?grouping@?$numpunct@G@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4031 DEFINE_THISCALL_WRAPPER(numpunct_wchar_grouping, 8)
4032 basic_string_char* __thiscall numpunct_wchar_grouping(const numpunct_wchar *this, basic_string_char *ret)
4034 TRACE("(%p)\n", this);
4035 return call_numpunct_wchar_do_grouping(this, ret);
4038 /* ?do_falsename@?$numpunct@_W@std@@MBE?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
4039 /* ?do_falsename@?$numpunct@_W@std@@MEBA?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
4040 /* ?do_falsename@?$numpunct@G@std@@MBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
4041 /* ?do_falsename@?$numpunct@G@std@@MEBA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
4042 DEFINE_THISCALL_WRAPPER(numpunct_wchar_do_falsename, 8)
4043 #define call_numpunct_wchar_do_falsename(this, ret) CALL_VTBL_FUNC(this, 16, \
4044 basic_string_wchar*, (const numpunct_wchar*, basic_string_wchar*), (this, ret))
4045 basic_string_wchar* __thiscall numpunct_wchar_do_falsename(const numpunct_wchar *this, basic_string_wchar *ret)
4047 TRACE("(%p)\n", this);
4048 return MSVCP_basic_string_wchar_ctor_cstr(ret, this->false_name);
4051 /* ?falsename@?$numpunct@_W@std@@QBE?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
4052 /* ?falsename@?$numpunct@_W@std@@QEBA?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
4053 /* ?falsename@?$numpunct@G@std@@QBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
4054 /* ?falsename@?$numpunct@G@std@@QEBA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
4055 DEFINE_THISCALL_WRAPPER(numpunct_wchar_falsename, 8)
4056 basic_string_wchar* __thiscall numpunct_wchar_falsename(const numpunct_wchar *this, basic_string_wchar *ret)
4058 TRACE("(%p)\n", this);
4059 return call_numpunct_wchar_do_falsename(this, ret);
4062 /* ?do_truename@?$numpunct@_W@std@@MBE?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
4063 /* ?do_truename@?$numpunct@_W@std@@MEBA?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
4064 /* ?do_truename@?$numpunct@G@std@@MBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
4065 /* ?do_truename@?$numpunct@G@std@@MEBA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
4066 DEFINE_THISCALL_WRAPPER(numpunct_wchar_do_truename, 8)
4067 #define call_numpunct_wchar_do_truename(this, ret) CALL_VTBL_FUNC(this, 20, \
4068 basic_string_wchar*, (const numpunct_wchar*, basic_string_wchar*), (this, ret))
4069 basic_string_wchar* __thiscall numpunct_wchar_do_truename(const numpunct_wchar *this, basic_string_wchar *ret)
4071 TRACE("(%p)\n", this);
4072 return MSVCP_basic_string_wchar_ctor_cstr(ret, this->true_name);
4075 /* ?truename@?$numpunct@_W@std@@QBE?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
4076 /* ?truename@?$numpunct@_W@std@@QEBA?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
4077 /* ?truename@?$numpunct@G@std@@QBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
4078 /* ?truename@?$numpunct@G@std@@QEBA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
4079 DEFINE_THISCALL_WRAPPER(numpunct_wchar_truename, 8)
4080 basic_string_wchar* __thiscall numpunct_wchar_truename(const numpunct_wchar *this, basic_string_wchar *ret)
4082 TRACE("(%p)\n", this);
4083 return call_numpunct_wchar_do_truename(this, ret);
4086 double __cdecl _Stod(const char *buf, char **buf_end, LONG exp)
4088 double ret = strtod(buf, buf_end);
4090 if(exp)
4091 ret *= pow(10, exp);
4092 return ret;
4095 double __cdecl _Stodx(const char *buf, char **buf_end, LONG exp, int *err)
4097 double ret;
4099 *err = *_errno();
4100 *_errno() = 0;
4101 ret = _Stod(buf, buf_end, exp);
4102 if(*_errno()) {
4103 *err = *_errno();
4104 }else {
4105 *_errno() = *err;
4106 *err = 0;
4108 return ret;
4111 float __cdecl _Stof(const char *buf, char **buf_end, LONG exp)
4113 return _Stod(buf, buf_end, exp);
4116 float __cdecl _Stofx(const char *buf, char **buf_end, LONG exp, int *err)
4118 return _Stodx(buf, buf_end, exp, err);
4121 __int64 __cdecl _Stoll(const char *buf, char **buf_end, int base)
4123 return _strtoi64(buf, buf_end, base);
4126 __int64 __cdecl _Stollx(const char *buf, char **buf_end, int base, int *err)
4128 __int64 ret;
4130 *err = *_errno();
4131 *_errno() = 0;
4132 ret = _strtoi64(buf, buf_end, base);
4133 if(*_errno()) {
4134 *err = *_errno();
4135 }else {
4136 *_errno() = *err;
4137 *err = 0;
4139 return ret;
4142 LONG __cdecl _Stolx(const char *buf, char **buf_end, int base, int *err)
4144 __int64 i = _Stollx(buf, buf_end, base, err);
4145 if(!*err && i!=(__int64)((LONG)i))
4146 *err = ERANGE;
4147 return i;
4150 unsigned __int64 __cdecl _Stoull(const char *buf, char **buf_end, int base)
4152 return _strtoui64(buf, buf_end, base);
4155 unsigned __int64 __cdecl _Stoullx(const char *buf, char **buf_end, int base, int *err)
4157 unsigned __int64 ret;
4159 *err = *_errno();
4160 *_errno() = 0;
4161 ret = _strtoui64(buf, buf_end, base);
4162 if(*_errno()) {
4163 *err = *_errno();
4164 }else {
4165 *_errno() = *err;
4166 *err = 0;
4168 return ret;
4171 ULONG __cdecl _Stoul(const char *buf, char **buf_end, int base)
4173 int err;
4174 unsigned __int64 i = _Stoullx(buf[0]=='-' ? buf+1 : buf, buf_end, base, &err);
4175 if(!err && i!=(unsigned __int64)((ULONG)i))
4176 *_errno() = ERANGE;
4177 return buf[0]=='-' ? -i : i;
4180 ULONG __cdecl _Stoulx(const char *buf, char **buf_end, int base, int *err)
4182 unsigned __int64 i = _Stoullx(buf[0]=='-' ? buf+1 : buf, buf_end, base, err);
4183 if(!*err && i!=(unsigned __int64)((ULONG)i))
4184 *err = ERANGE;
4185 return buf[0]=='-' ? -i : i;
4188 /* ?id@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@2V0locale@2@A */
4189 locale_id num_get_wchar_id = {0};
4190 /* ?id@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@2V0locale@2@A */
4191 locale_id num_get_short_id = {0};
4193 /* ??_7?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@6B@ */
4194 extern const vtable_ptr MSVCP_num_get_wchar_vtable;
4195 /* ??_7?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@6B@ */
4196 extern const vtable_ptr MSVCP_num_get_short_vtable;
4198 /* ?_Init@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@IAEXABV_Locinfo@2@@Z */
4199 /* ?_Init@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@IEAAXAEBV_Locinfo@2@@Z */
4200 /* ?_Init@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@IAEXABV_Locinfo@2@@Z */
4201 /* ?_Init@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@IEAAXAEBV_Locinfo@2@@Z */
4202 DEFINE_THISCALL_WRAPPER(num_get_wchar__Init, 8)
4203 void __thiscall num_get_wchar__Init(num_get *this, const _Locinfo *locinfo)
4205 TRACE("(%p %p)\n", this, locinfo);
4206 _Locinfo__Getcvt(locinfo, &this->cvt);
4209 /* ??0?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
4210 /* ??0?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
4211 DEFINE_THISCALL_WRAPPER(num_get_wchar_ctor_locinfo, 12)
4212 num_get* __thiscall num_get_wchar_ctor_locinfo(num_get *this,
4213 const _Locinfo *locinfo, MSVCP_size_t refs)
4215 TRACE("(%p %p %lu)\n", this, locinfo, refs);
4217 locale_facet_ctor_refs(&this->facet, refs);
4218 this->facet.vtable = &MSVCP_num_get_wchar_vtable;
4220 num_get_wchar__Init(this, locinfo);
4221 return this;
4224 /* ??0?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
4225 /* ??0?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
4226 DEFINE_THISCALL_WRAPPER(num_get_short_ctor_locinfo, 12)
4227 num_get* __thiscall num_get_short_ctor_locinfo(num_get *this,
4228 const _Locinfo *locinfo, MSVCP_size_t refs)
4230 num_get_wchar_ctor_locinfo(this, locinfo, refs);
4231 this->facet.vtable = &MSVCP_num_get_short_vtable;
4232 return this;
4235 /* ??0?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAE@I@Z */
4236 /* ??0?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAA@_K@Z */
4237 DEFINE_THISCALL_WRAPPER(num_get_wchar_ctor_refs, 8)
4238 num_get* __thiscall num_get_wchar_ctor_refs(num_get *this, MSVCP_size_t refs)
4240 _Locinfo locinfo;
4242 TRACE("(%p %lu)\n", this, refs);
4244 _Locinfo_ctor(&locinfo);
4245 num_get_wchar_ctor_locinfo(this, &locinfo, refs);
4246 _Locinfo_dtor(&locinfo);
4247 return this;
4250 /* ??0?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAE@I@Z */
4251 /* ??0?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEAA@_K@Z */
4252 DEFINE_THISCALL_WRAPPER(num_get_short_ctor_refs, 8)
4253 num_get* __thiscall num_get_short_ctor_refs(num_get *this, MSVCP_size_t refs)
4255 num_get_wchar_ctor_refs(this, refs);
4256 this->facet.vtable = &MSVCP_num_get_short_vtable;
4257 return this;
4260 /* ??_F?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAEXXZ */
4261 /* ??_F?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAAXXZ */
4262 DEFINE_THISCALL_WRAPPER(num_get_wchar_ctor, 4)
4263 num_get* __thiscall num_get_wchar_ctor(num_get *this)
4265 return num_get_wchar_ctor_refs(this, 0);
4268 /* ??_F?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAEXXZ */
4269 /* ??_F?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAAXXZ */
4270 DEFINE_THISCALL_WRAPPER(num_get_short_ctor, 4)
4271 num_get* __thiscall num_get_short_ctor(num_get *this)
4273 return num_get_short_ctor_refs(this, 0);
4276 /* ??1?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MAE@XZ */
4277 /* ??1?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MEAA@XZ */
4278 /* ??1?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MAE@XZ */
4279 /* ??1?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MEAA@XZ */
4280 DEFINE_THISCALL_WRAPPER(num_get_wchar_dtor, 4)
4281 void __thiscall num_get_wchar_dtor(num_get *this)
4283 TRACE("(%p)\n", this);
4284 locale_facet_dtor(&this->facet);
4287 DEFINE_THISCALL_WRAPPER(num_get_wchar_vector_dtor, 8)
4288 num_get* __thiscall num_get_wchar_vector_dtor(num_get *this, unsigned int flags)
4290 TRACE("(%p %x)\n", this, flags);
4291 if(flags & 2) {
4292 /* we have an array, with the number of elements stored before the first object */
4293 INT_PTR i, *ptr = (INT_PTR *)this-1;
4295 for(i=*ptr-1; i>=0; i--)
4296 num_get_wchar_dtor(this+i);
4297 MSVCRT_operator_delete(ptr);
4298 } else {
4299 num_get_wchar_dtor(this);
4300 if(flags & 1)
4301 MSVCRT_operator_delete(this);
4304 return this;
4307 /* ?_Getcat@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
4308 /* ?_Getcat@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
4309 MSVCP_size_t __cdecl num_get_wchar__Getcat(const locale_facet **facet, const locale *loc)
4311 TRACE("(%p %p)\n", facet, loc);
4313 if(facet && !*facet) {
4314 _Locinfo locinfo;
4316 *facet = MSVCRT_operator_new(sizeof(num_get));
4317 if(!*facet) {
4318 ERR("Out of memory\n");
4319 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
4320 return 0;
4323 _Locinfo_ctor_cstr(&locinfo, MSVCP_basic_string_char_c_str(&loc->ptr->name));
4324 num_get_wchar_ctor_locinfo((num_get*)*facet, &locinfo, 0);
4325 _Locinfo_dtor(&locinfo);
4328 return LC_NUMERIC;
4331 num_get* num_get_wchar_use_facet(const locale *loc)
4333 static num_get *obj = NULL;
4335 _Lockit lock;
4336 const locale_facet *fac;
4338 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
4339 fac = locale__Getfacet(loc, locale_id_operator_size_t(&num_get_wchar_id));
4340 if(fac) {
4341 _Lockit_dtor(&lock);
4342 return (num_get*)fac;
4345 if(obj) {
4346 _Lockit_dtor(&lock);
4347 return obj;
4350 num_get_wchar__Getcat(&fac, loc);
4351 obj = (num_get*)fac;
4352 locale_facet__Incref(&obj->facet);
4353 locale_facet_register(&obj->facet);
4354 _Lockit_dtor(&lock);
4356 return obj;
4359 /* ?_Getcat@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
4360 /* ?_Getcat@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
4361 MSVCP_size_t __cdecl num_get_short__Getcat(const locale_facet **facet, const locale *loc)
4363 if(facet && !*facet) {
4364 num_get_wchar__Getcat(facet, loc);
4365 (*(locale_facet**)facet)->vtable = &MSVCP_num_get_short_vtable;
4368 return LC_NUMERIC;
4371 num_get* num_get_short_use_facet(const locale *loc)
4373 static num_get *obj = NULL;
4375 _Lockit lock;
4376 const locale_facet *fac;
4378 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
4379 fac = locale__Getfacet(loc, locale_id_operator_size_t(&num_get_short_id));
4380 if(fac) {
4381 _Lockit_dtor(&lock);
4382 return (num_get*)fac;
4385 if(obj) {
4386 _Lockit_dtor(&lock);
4387 return obj;
4390 num_get_short__Getcat(&fac, loc);
4391 obj = (num_get*)fac;
4392 locale_facet__Incref(&obj->facet);
4393 locale_facet_register(&obj->facet);
4394 _Lockit_dtor(&lock);
4396 return obj;
4399 static inline wchar_t mb_to_wc(char ch, const _Cvtvec *cvt)
4401 int state = 0;
4402 wchar_t ret;
4404 return _Mbrtowc(&ret, &ch, 1, &state, cvt) == 1 ? ret : 0;
4407 static int num_get__Getffld(const num_get *this, char *dest, istreambuf_iterator_wchar *first,
4408 istreambuf_iterator_wchar *last, const locale *loc, numpunct_wchar *numpunct)
4410 basic_string_char grouping_bstr;
4411 basic_string_char groups_found;
4412 int i, groups_no = 0, cur_group = 0, exp = 0;
4413 char *dest_beg = dest, *num_end = dest+25, *exp_end = dest+31;
4414 wchar_t sep, digits[11], *digits_pos;
4415 const char *grouping, *groups;
4416 BOOL error = FALSE, got_digit = FALSE, got_nonzero = FALSE;
4418 TRACE("(%p %p %p %p)\n", dest, first, last, loc);
4420 for(i=0; i<10; i++)
4421 digits[i] = mb_to_wc('0'+i, &this->cvt);
4422 digits[10] = 0;
4424 numpunct_wchar_grouping(numpunct, &grouping_bstr);
4425 grouping = MSVCP_basic_string_char_c_str(&grouping_bstr);
4426 sep = grouping[0] ? numpunct_wchar_thousands_sep(numpunct) : (wchar_t)0;
4428 if(sep)
4429 MSVCP_basic_string_char_ctor(&groups_found);
4431 istreambuf_iterator_wchar_val(first);
4432 /* get sign */
4433 if(first->strbuf && first->val==mb_to_wc('-', &this->cvt)) {
4434 *dest++ = '-';
4435 istreambuf_iterator_wchar_inc(first);
4436 }else if(first->strbuf && first->val==mb_to_wc('+', &this->cvt)) {
4437 *dest++ = '+';
4438 istreambuf_iterator_wchar_inc(first);
4441 /* read possibly grouped numbers before decimal */
4442 for(; first->strbuf; istreambuf_iterator_wchar_inc(first)) {
4443 if(!(digits_pos = wcschr(digits, first->val))) {
4444 if(sep && first->val==sep) {
4445 if(!groups_no) break; /* empty group - stop parsing */
4446 MSVCP_basic_string_char_append_ch(&groups_found, groups_no);
4447 groups_no = 0;
4448 ++cur_group;
4449 }else {
4450 break;
4452 }else {
4453 got_digit = TRUE; /* found a digit, zero or non-zero */
4454 /* write digit to dest if not a leading zero (to not waste dest buffer) */
4455 if(!got_nonzero && first->val == digits[0])
4457 ++groups_no;
4458 continue;
4460 got_nonzero = TRUE;
4461 if(dest < num_end)
4462 *dest++ = '0'+digits_pos-digits;
4463 else
4464 exp++; /* too many digits, just multiply by 10 */
4465 if(sep && groups_no<CHAR_MAX)
4466 ++groups_no;
4470 /* if all leading zeroes, we didn't write anything so put a zero we check for a decimal */
4471 if(got_digit && !got_nonzero)
4472 *dest++ = '0';
4474 /* get decimal, if any */
4475 if(first->strbuf && first->val==numpunct_wchar_decimal_point(numpunct)) {
4476 if(dest < num_end)
4477 *dest++ = *localeconv()->decimal_point;
4478 istreambuf_iterator_wchar_inc(first);
4481 /* read non-grouped after decimal */
4482 for(; first->strbuf; istreambuf_iterator_wchar_inc(first)) {
4483 if(!(digits_pos = wcschr(digits, first->val)))
4484 break;
4485 else if(dest<num_end) {
4486 got_digit = TRUE;
4487 *dest++ = '0'+digits_pos-digits;
4491 /* read exponent, if any */
4492 if(first->strbuf && (first->val==mb_to_wc('e', &this->cvt) || first->val==mb_to_wc('E', &this->cvt))) {
4493 *dest++ = 'e';
4494 istreambuf_iterator_wchar_inc(first);
4496 if(first->strbuf && first->val==mb_to_wc('-', &this->cvt)) {
4497 *dest++ = '-';
4498 istreambuf_iterator_wchar_inc(first);
4499 }else if(first->strbuf && first->val==mb_to_wc('+', &this->cvt)) {
4500 *dest++ = '+';
4501 istreambuf_iterator_wchar_inc(first);
4504 got_digit = got_nonzero = FALSE;
4505 error = TRUE;
4506 /* skip any leading zeroes */
4507 for(; first->strbuf && first->val==digits[0]; istreambuf_iterator_wchar_inc(first))
4508 error = FALSE;
4510 for(; first->strbuf && (digits_pos = wcschr(digits, first->val)); istreambuf_iterator_wchar_inc(first)) {
4511 got_digit = got_nonzero = TRUE; /* leading zeroes would have been skipped, so first digit is non-zero */
4512 error = FALSE;
4513 if(dest<exp_end)
4514 *dest++ = '0'+digits_pos-digits;
4517 /* if just found zeroes for exponent, use that */
4518 if(got_digit && !got_nonzero)
4520 error = FALSE;
4521 if(dest<exp_end)
4522 *dest++ = '0';
4526 if(sep && groups_no)
4527 MSVCP_basic_string_char_append_ch(&groups_found, groups_no);
4529 groups = MSVCP_basic_string_char_c_str(&groups_found);
4530 if(cur_group && !groups[cur_group])
4532 error = TRUE; /* trailing empty */
4533 }else if(!cur_group) /* no groups, skip loop */
4534 cur_group--;
4536 for(; cur_group>=0 && !error; cur_group--) {
4537 if(*grouping == CHAR_MAX) {
4538 if(cur_group)
4539 error = TRUE;
4540 break;
4541 }else if((cur_group && *grouping!=groups[cur_group])
4542 || (!cur_group && *grouping<groups[cur_group])) {
4543 error = TRUE;
4544 break;
4545 }else if(grouping[1]) {
4546 grouping++;
4549 MSVCP_basic_string_char_dtor(&grouping_bstr);
4550 if(sep)
4551 MSVCP_basic_string_char_dtor(&groups_found);
4553 if(error) {
4554 *dest_beg = '\0';
4555 return 0;
4557 *dest++ = '\0';
4558 return exp;
4561 /* ?_Getffld@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@ABAHPADAAV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@2@1ABVlocale@2@@Z */
4562 /* ?_Getffld@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@AEBAHPEADAEAV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@2@1AEBVlocale@2@@Z */
4563 int __cdecl num_get_wchar__Getffld(const num_get *this, char *dest, istreambuf_iterator_wchar *first,
4564 istreambuf_iterator_wchar *last, const locale *loc)
4566 return num_get__Getffld(this, dest, first, last, loc, numpunct_wchar_use_facet(loc));
4569 /* ?_Getffld@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@ABAHPADAAV?$istreambuf_iterator@GU?$char_traits@G@std@@@2@1ABVlocale@2@@Z */
4570 /* ?_Getffld@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@AEBAHPEADAEAV?$istreambuf_iterator@GU?$char_traits@G@std@@@2@1AEBVlocale@2@@Z */
4571 int __cdecl num_get_short__Getffld(const num_get *this, char *dest, istreambuf_iterator_wchar *first,
4572 istreambuf_iterator_wchar *last, const locale *loc)
4574 return num_get__Getffld(this, dest, first, last, loc, numpunct_short_use_facet(loc));
4577 /* ?_Getffldx@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@ABAHPADAAV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@2@1AAVios_base@2@PAH@Z */
4578 /* ?_Getffldx@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@AEBAHPEADAEAV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@2@1AEAVios_base@2@PEAH@Z */
4579 /* ?_Getffldx@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@ABAHPADAAV?$istreambuf_iterator@GU?$char_traits@G@std@@@2@1AAVios_base@2@PAH@Z */
4580 /* ?_Getffldx@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@AEBAHPEADAEAV?$istreambuf_iterator@GU?$char_traits@G@std@@@2@1AEAVios_base@2@PEAH@Z */
4581 int __cdecl num_get_wchar__Getffldx(num_get *this, char *dest, istreambuf_iterator_wchar *first,
4582 istreambuf_iterator_wchar *last, ios_base *ios, int *phexexp)
4584 FIXME("(%p %p %p %p %p) stub\n", dest, first, last, ios, phexexp);
4585 return -1;
4588 static int num_get__Getifld(const num_get *this, char *dest, istreambuf_iterator_wchar *first,
4589 istreambuf_iterator_wchar *last, int fmtflags, const locale *loc, numpunct_wchar *numpunct)
4591 wchar_t digits[23], *digits_pos, sep;
4592 basic_string_char grouping_bstr;
4593 basic_string_char groups_found;
4594 int i, basefield, base, groups_no = 0, cur_group = 0;
4595 char *dest_beg = dest, *dest_end = dest+24;
4596 const char *grouping, *groups;
4597 BOOL error = TRUE, dest_empty = TRUE, found_zero = FALSE;
4599 TRACE("(%p %p %p %04x %p)\n", dest, first, last, fmtflags, loc);
4601 for(i=0; i<10; i++)
4602 digits[i] = mb_to_wc('0'+i, &this->cvt);
4603 for(i=0; i<6; i++) {
4604 digits[10+i] = mb_to_wc('a'+i, &this->cvt);
4605 digits[16+i] = mb_to_wc('A'+i, &this->cvt);
4608 numpunct_wchar_grouping(numpunct, &grouping_bstr);
4609 grouping = MSVCP_basic_string_char_c_str(&grouping_bstr);
4610 sep = grouping[0] ? numpunct_wchar_thousands_sep(numpunct) : '\0';
4612 basefield = fmtflags & FMTFLAG_basefield;
4613 if(basefield == FMTFLAG_oct)
4614 base = 8;
4615 else if(basefield == FMTFLAG_hex)
4616 base = 22; /* equal to the size of digits buffer */
4617 else if(!basefield)
4618 base = 0;
4619 else
4620 base = 10;
4622 istreambuf_iterator_wchar_val(first);
4623 if(first->strbuf && first->val==mb_to_wc('-', &this->cvt)) {
4624 *dest++ = '-';
4625 istreambuf_iterator_wchar_inc(first);
4626 }else if(first->strbuf && first->val==mb_to_wc('+', &this->cvt)) {
4627 *dest++ = '+';
4628 istreambuf_iterator_wchar_inc(first);
4631 if(first->strbuf && first->val==digits[0]) {
4632 found_zero = TRUE;
4633 istreambuf_iterator_wchar_inc(first);
4634 if(first->strbuf && (first->val==mb_to_wc('x', &this->cvt) || first->val==mb_to_wc('X', &this->cvt))) {
4635 if(!base || base == 22) {
4636 found_zero = FALSE;
4637 istreambuf_iterator_wchar_inc(first);
4638 base = 22;
4639 }else {
4640 base = 10;
4642 }else {
4643 error = FALSE;
4644 if(!base) base = 8;
4646 }else {
4647 if(!base) base = 10;
4649 digits[base] = 0;
4651 if(sep) {
4652 MSVCP_basic_string_char_ctor(&groups_found);
4653 if(found_zero) ++groups_no;
4656 for(; first->strbuf; istreambuf_iterator_wchar_inc(first)) {
4657 if(!(digits_pos = wcschr(digits, first->val))) {
4658 if(sep && first->val==sep) {
4659 if(!groups_no) break; /* empty group - stop parsing */
4660 MSVCP_basic_string_char_append_ch(&groups_found, groups_no);
4661 groups_no = 0;
4662 ++cur_group;
4663 }else {
4664 break;
4666 }else {
4667 error = FALSE;
4668 if(dest_empty && first->val == digits[0]) {
4669 found_zero = TRUE;
4670 ++groups_no;
4671 continue;
4673 dest_empty = FALSE;
4674 /* skip digits that can't be copied to dest buffer, other
4675 * functions are responsible for detecting overflows */
4676 if(dest < dest_end)
4677 *dest++ = (digits_pos-digits<10 ? '0'+digits_pos-digits :
4678 (digits_pos-digits<16 ? 'a'+digits_pos-digits-10 :
4679 'A'+digits_pos-digits-16));
4680 if(sep && groups_no<CHAR_MAX)
4681 ++groups_no;
4685 if(sep && groups_no)
4686 MSVCP_basic_string_char_append_ch(&groups_found, groups_no);
4688 groups = MSVCP_basic_string_char_c_str(&groups_found);
4689 if(cur_group && !groups[cur_group])
4691 error = TRUE; /* trailing empty */
4692 found_zero = FALSE;
4693 }else if(!cur_group) /* no groups, skip loop */
4694 cur_group--;
4696 for(; cur_group>=0 && !error; cur_group--) {
4697 if(*grouping == CHAR_MAX) {
4698 if(cur_group)
4699 error = TRUE;
4700 break;
4701 }else if((cur_group && *grouping!=groups[cur_group])
4702 || (!cur_group && *grouping<groups[cur_group])) {
4703 error = TRUE;
4704 break;
4705 }else if(grouping[1]) {
4706 grouping++;
4710 MSVCP_basic_string_char_dtor(&grouping_bstr);
4711 if(sep)
4712 MSVCP_basic_string_char_dtor(&groups_found);
4714 if(error) {
4715 if (found_zero)
4716 *dest++ = '0';
4717 else
4718 dest = dest_beg;
4719 }else if(dest_empty)
4720 *dest++ = '0';
4721 *dest = '\0';
4723 return (base==22 ? 16 : base);
4726 /* ?_Getifld@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@ABAHPADAAV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@2@1HABVlocale@2@@Z */
4727 /* ?_Getifld@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@AEBAHPEADAEAV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@2@1HAEBVlocale@2@@Z */
4728 int __cdecl num_get_wchar__Getifld(const num_get *this, char *dest, istreambuf_iterator_wchar *first,
4729 istreambuf_iterator_wchar *last, int fmtflags, const locale *loc)
4731 return num_get__Getifld(this, dest, first, last,
4732 fmtflags, loc, numpunct_wchar_use_facet(loc));
4735 /* ?_Getifld@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@ABAHPADAAV?$istreambuf_iterator@GU?$char_traits@G@std@@@2@1HABVlocale@2@@Z */
4736 /* ?_Getifld@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@AEBAHPEADAEAV?$istreambuf_iterator@GU?$char_traits@G@std@@@2@1HAEBVlocale@2@@Z */
4737 int __cdecl num_get_short__Getifld(const num_get *this, char *dest, istreambuf_iterator_wchar *first,
4738 istreambuf_iterator_wchar *last, int fmtflags, const locale *loc)
4740 return num_get__Getifld(this, dest, first, last,
4741 fmtflags, loc, numpunct_short_use_facet(loc));
4744 /* ?_Hexdig@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@ABEH_W000@Z */
4745 /* ?_Hexdig@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@AEBAH_W000@Z */
4746 /* ?_Hexdig@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@ABEHGGGG@Z */
4747 /* ?_Hexdig@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@AEBAHGGGG@Z */
4748 DEFINE_THISCALL_WRAPPER(MSVCP_num_get_wchar__Hexdig, 20)
4749 int __thiscall MSVCP_num_get_wchar__Hexdig(num_get *this, wchar_t dig, wchar_t e0, wchar_t al, wchar_t au)
4751 FIXME("(%p %c %c %c %c) stub\n", this, dig, e0, al, au);
4752 return -1;
4755 static istreambuf_iterator_wchar* num_get_do_get_void(const num_get *this,
4756 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar first,
4757 istreambuf_iterator_wchar last, ios_base *base, int *state,
4758 void **pval, numpunct_wchar *numpunct)
4760 unsigned __int64 v;
4761 char tmp[25], *end;
4762 int err;
4764 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
4766 v = _Stoullx(tmp, &end, num_get__Getifld(this, tmp, &first,
4767 &last, FMTFLAG_hex, base->loc, numpunct), &err);
4768 if(v!=(unsigned __int64)((INT_PTR)v))
4769 *state |= IOSTATE_failbit;
4770 else if(end!=tmp && !err)
4771 *pval = (void*)((INT_PTR)v);
4772 else
4773 *state |= IOSTATE_failbit;
4775 if(!first.strbuf)
4776 *state |= IOSTATE_eofbit;
4778 *ret = first;
4779 return ret;
4782 /* ?do_get@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MBE?AV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@0AAVios_base@2@AAHAAPAX@Z */
4783 /* ?do_get@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MEBA?AV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@0AEAVios_base@2@AEAHAEAPEAX@Z */
4784 #define call_num_get_wchar_do_get_void(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 4, istreambuf_iterator_wchar*, \
4785 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, void**), \
4786 (this, ret, first, last, base, state, pval))
4787 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_void,36)
4788 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_void(const num_get *this, istreambuf_iterator_wchar *ret,
4789 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, void **pval)
4791 return num_get_do_get_void(this, ret, first, last, base,
4792 state, pval, numpunct_wchar_use_facet(base->loc));
4795 /* ?do_get@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MBE?AV?$istreambuf_iterator@GU?$char_traits@G@std@@@2@V32@0AAVios_base@2@AAHAAPAX@Z */
4796 /* ?do_get@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MEBA?AV?$istreambuf_iterator@GU?$char_traits@G@std@@@2@V32@0AEAVios_base@2@AEAHAEAPEAX@Z */
4797 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_void,36)
4798 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_void(const num_get *this, istreambuf_iterator_wchar *ret,
4799 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, void **pval)
4801 return num_get_do_get_void(this, ret, first, last, base,
4802 state, pval, numpunct_short_use_facet(base->loc));
4805 /* ?get@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QBE?AV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@0AAVios_base@2@AAHAAPAX@Z */
4806 /* ?get@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEBA?AV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@0AEAVios_base@2@AEAHAEAPEAX@Z */
4807 /* ?get@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QBE?AV?$istreambuf_iterator@GU?$char_traits@G@std@@@2@V32@0AAVios_base@2@AAHAAPAX@Z */
4808 /* ?get@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEBA?AV?$istreambuf_iterator@GU?$char_traits@G@std@@@2@V32@0AEAVios_base@2@AEAHAEAPEAX@Z */
4809 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_void,36)
4810 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_void(const num_get *this, istreambuf_iterator_wchar *ret,
4811 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, void **pval)
4813 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
4814 return call_num_get_wchar_do_get_void(this, ret, first, last, base, state, pval);
4817 static istreambuf_iterator_wchar* num_get_do_get_double(const num_get *this,
4818 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar first,
4819 istreambuf_iterator_wchar last, ios_base *base, int *state,
4820 double *pval, numpunct_wchar *numpunct)
4822 double v;
4823 char tmp[32], *end;
4824 int err;
4826 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
4828 v = _Stodx(tmp, &end, num_get__Getffld(this, tmp, &first, &last, base->loc, numpunct), &err);
4829 if(end!=tmp && !err)
4830 *pval = v;
4831 else
4832 *state |= IOSTATE_failbit;
4834 if(!first.strbuf)
4835 *state |= IOSTATE_eofbit;
4837 *ret = first;
4838 return ret;
4841 /* ?do_get@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MBE?AV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@0AAVios_base@2@AAHAAO@Z */
4842 /* ?do_get@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MEBA?AV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@0AEAVios_base@2@AEAHAEAO@Z */
4843 /* ?do_get@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MBE?AV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@0AAVios_base@2@AAHAAN@Z */
4844 /* ?do_get@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MEBA?AV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@0AEAVios_base@2@AEAHAEAN@Z */
4845 #define call_num_get_wchar_do_get_ldouble(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 8, istreambuf_iterator_wchar*, \
4846 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, double*), \
4847 (this, ret, first, last, base, state, pval))
4848 #define call_num_get_wchar_do_get_double(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 12, istreambuf_iterator_wchar*, \
4849 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, double*), \
4850 (this, ret, first, last, base, state, pval))
4851 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_double,36)
4852 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_double(const num_get *this, istreambuf_iterator_wchar *ret,
4853 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, double *pval)
4855 return num_get_do_get_double(this, ret, first, last, base,
4856 state, pval, numpunct_wchar_use_facet(base->loc));
4859 /* ?do_get@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MBE?AV?$istreambuf_iterator@GU?$char_traits@G@std@@@2@V32@0AAVios_base@2@AAHAAO@Z */
4860 /* ?do_get@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MEBA?AV?$istreambuf_iterator@GU?$char_traits@G@std@@@2@V32@0AEAVios_base@2@AEAHAEAO@Z */
4861 /* ?do_get@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MBE?AV?$istreambuf_iterator@GU?$char_traits@G@std@@@2@V32@0AAVios_base@2@AAHAAN@Z */
4862 /* ?do_get@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MEBA?AV?$istreambuf_iterator@GU?$char_traits@G@std@@@2@V32@0AEAVios_base@2@AEAHAEAN@Z */
4863 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_double,36)
4864 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_double(const num_get *this, istreambuf_iterator_wchar *ret,
4865 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, double *pval)
4867 return num_get_do_get_double(this, ret, first, last, base,
4868 state, pval, numpunct_short_use_facet(base->loc));
4871 /* ?get@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QBE?AV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@0AAVios_base@2@AAHAAO@Z */
4872 /* ?get@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEBA?AV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@0AEAVios_base@2@AEAHAEAO@Z */
4873 /* ?get@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QBE?AV?$istreambuf_iterator@GU?$char_traits@G@std@@@2@V32@0AAVios_base@2@AAHAAO@Z */
4874 /* ?get@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEBA?AV?$istreambuf_iterator@GU?$char_traits@G@std@@@2@V32@0AEAVios_base@2@AEAHAEAO@Z */
4875 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_ldouble,36)
4876 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_ldouble(const num_get *this, istreambuf_iterator_wchar *ret,
4877 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, double *pval)
4879 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
4880 return call_num_get_wchar_do_get_ldouble(this, ret, first, last, base, state, pval);
4883 /* ?get@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QBE?AV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@0AAVios_base@2@AAHAAN@Z */
4884 /* ?get@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEBA?AV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@0AEAVios_base@2@AEAHAEAN@Z */
4885 /* ?get@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QBE?AV?$istreambuf_iterator@GU?$char_traits@G@std@@@2@V32@0AAVios_base@2@AAHAAN@Z */
4886 /* ?get@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEBA?AV?$istreambuf_iterator@GU?$char_traits@G@std@@@2@V32@0AEAVios_base@2@AEAHAEAN@Z */
4887 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_double,36)
4888 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_double(const num_get *this, istreambuf_iterator_wchar *ret,
4889 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, double *pval)
4891 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
4892 return call_num_get_wchar_do_get_double(this, ret, first, last, base, state, pval);
4895 static istreambuf_iterator_wchar* num_get_do_get_float(const num_get *this,
4896 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar first,
4897 istreambuf_iterator_wchar last, ios_base *base, int *state,
4898 float *pval, numpunct_wchar *numpunct)
4900 float v;
4901 char tmp[32], *end;
4902 int err;
4904 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
4906 v = _Stofx(tmp, &end, num_get__Getffld(this, tmp, &first,
4907 &last, base->loc, numpunct), &err);
4908 if(end!=tmp && !err)
4909 *pval = v;
4910 else
4911 *state |= IOSTATE_failbit;
4913 if(!first.strbuf)
4914 *state |= IOSTATE_eofbit;
4916 *ret = first;
4917 return ret;
4920 /* ?do_get@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MBE?AV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@0AAVios_base@2@AAHAAM@Z */
4921 /* ?do_get@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MEBA?AV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@0AEAVios_base@2@AEAHAEAM@Z */
4922 #define call_num_get_wchar_do_get_float(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 16, istreambuf_iterator_wchar*, \
4923 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, float*), \
4924 (this, ret, first, last, base, state, pval))
4925 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_float,36)
4926 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_float(const num_get *this, istreambuf_iterator_wchar *ret,
4927 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, float *pval)
4929 return num_get_do_get_float(this, ret, first, last, base,
4930 state, pval, numpunct_wchar_use_facet(base->loc));
4933 /* ?do_get@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MBE?AV?$istreambuf_iterator@GU?$char_traits@G@std@@@2@V32@0AAVios_base@2@AAHAAM@Z */
4934 /* ?do_get@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MEBA?AV?$istreambuf_iterator@GU?$char_traits@G@std@@@2@V32@0AEAVios_base@2@AEAHAEAM@Z */
4935 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_float,36)
4936 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_float(const num_get *this, istreambuf_iterator_wchar *ret,
4937 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, float *pval)
4939 return num_get_do_get_float(this, ret, first, last, base,
4940 state, pval, numpunct_short_use_facet(base->loc));
4943 /* ?get@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QBE?AV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@0AAVios_base@2@AAHAAM@Z */
4944 /* ?get@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEBA?AV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@0AEAVios_base@2@AEAHAEAM@Z */
4945 /* ?get@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QBE?AV?$istreambuf_iterator@GU?$char_traits@G@std@@@2@V32@0AAVios_base@2@AAHAAM@Z */
4946 /* ?get@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEBA?AV?$istreambuf_iterator@GU?$char_traits@G@std@@@2@V32@0AEAVios_base@2@AEAHAEAM@Z */
4947 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_float,36)
4948 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_float(const num_get *this, istreambuf_iterator_wchar *ret,
4949 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, float *pval)
4951 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
4952 return call_num_get_wchar_do_get_float(this, ret, first, last, base, state, pval);
4955 static istreambuf_iterator_wchar* num_get_do_get_uint64(const num_get *this,
4956 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar first,
4957 istreambuf_iterator_wchar last, ios_base *base, int *state,
4958 ULONGLONG *pval, numpunct_wchar *numpunct)
4960 unsigned __int64 v;
4961 char tmp[25], *end;
4962 int err;
4964 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
4966 v = _Stoullx(tmp, &end, num_get__Getifld(this, tmp, &first,
4967 &last, base->fmtfl, base->loc, numpunct), &err);
4968 if(end!=tmp && !err)
4969 *pval = v;
4970 else
4971 *state |= IOSTATE_failbit;
4973 if(!first.strbuf)
4974 *state |= IOSTATE_eofbit;
4976 *ret = first;
4977 return ret;
4980 /* ?do_get@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MBE?AV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@0AAVios_base@2@AAHAA_K@Z */
4981 /* ?do_get@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MEBA?AV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@0AEAVios_base@2@AEAHAEA_K@Z */
4982 #define call_num_get_wchar_do_get_uint64(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 20, istreambuf_iterator_wchar*, \
4983 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, ULONGLONG*), \
4984 (this, ret, first, last, base, state, pval))
4985 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_uint64,36)
4986 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_uint64(const num_get *this, istreambuf_iterator_wchar *ret,
4987 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, ULONGLONG *pval)
4989 return num_get_do_get_uint64(this, ret, first, last, base,
4990 state, pval, numpunct_wchar_use_facet(base->loc));
4993 /* ?do_get@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MBE?AV?$istreambuf_iterator@GU?$char_traits@G@std@@@2@V32@0AAVios_base@2@AAHAA_K@Z */
4994 /* ?do_get@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MEBA?AV?$istreambuf_iterator@GU?$char_traits@G@std@@@2@V32@0AEAVios_base@2@AEAHAEA_K@Z */
4995 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_uint64,36)
4996 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_uint64(const num_get *this, istreambuf_iterator_wchar *ret,
4997 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, ULONGLONG *pval)
4999 return num_get_do_get_uint64(this, ret, first, last, base,
5000 state, pval, numpunct_short_use_facet(base->loc));
5003 /* ?get@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QBE?AV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@0AAVios_base@2@AAHAA_K@Z */
5004 /* ?get@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEBA?AV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@0AEAVios_base@2@AEAHAEA_K@Z */
5005 /* ?get@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QBE?AV?$istreambuf_iterator@GU?$char_traits@G@std@@@2@V32@0AAVios_base@2@AAHAA_K@Z */
5006 /* ?get@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEBA?AV?$istreambuf_iterator@GU?$char_traits@G@std@@@2@V32@0AEAVios_base@2@AEAHAEA_K@Z */
5007 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_uint64,36)
5008 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_uint64(const num_get *this, istreambuf_iterator_wchar *ret,
5009 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, ULONGLONG *pval)
5011 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5012 return call_num_get_wchar_do_get_uint64(this, ret, first, last, base, state, pval);
5015 static istreambuf_iterator_wchar* num_get_do_get_int64(const num_get *this,
5016 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar first,
5017 istreambuf_iterator_wchar last, ios_base *base, int *state,
5018 LONGLONG *pval, numpunct_wchar *numpunct)
5020 __int64 v;
5021 char tmp[25], *end;
5022 int err;
5024 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5026 v = _Stollx(tmp, &end, num_get__Getifld(this, tmp, &first,
5027 &last, base->fmtfl, base->loc, numpunct), &err);
5028 if(end!=tmp && !err)
5029 *pval = v;
5030 else
5031 *state |= IOSTATE_failbit;
5033 if(!first.strbuf)
5034 *state |= IOSTATE_eofbit;
5036 *ret = first;
5037 return ret;
5040 /* ?do_get@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MBE?AV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@0AAVios_base@2@AAHAA_J@Z */
5041 /* ?do_get@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MEBA?AV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@0AEAVios_base@2@AEAHAEA_J@Z */
5042 #define call_num_get_wchar_do_get_int64(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 24, istreambuf_iterator_wchar*, \
5043 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, LONGLONG*), \
5044 (this, ret, first, last, base, state, pval))
5045 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_int64,36)
5046 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_int64(const num_get *this, istreambuf_iterator_wchar *ret,
5047 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, LONGLONG *pval)
5049 return num_get_do_get_int64(this, ret, first, last, base,
5050 state, pval, numpunct_wchar_use_facet(base->loc));
5053 /* ?do_get@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MBE?AV?$istreambuf_iterator@GU?$char_traits@G@std@@@2@V32@0AAVios_base@2@AAHAA_J@Z */
5054 /* ?do_get@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MEBA?AV?$istreambuf_iterator@GU?$char_traits@G@std@@@2@V32@0AEAVios_base@2@AEAHAEA_J@Z */
5055 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_int64,36)
5056 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_int64(const num_get *this, istreambuf_iterator_wchar *ret,
5057 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, LONGLONG *pval)
5059 return num_get_do_get_int64(this, ret, first, last, base,
5060 state, pval, numpunct_short_use_facet(base->loc));
5063 /* ?get@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QBE?AV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@0AAVios_base@2@AAHAA_J@Z */
5064 /* ?get@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEBA?AV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@0AEAVios_base@2@AEAHAEA_J@Z */
5065 /* ?get@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QBE?AV?$istreambuf_iterator@GU?$char_traits@G@std@@@2@V32@0AAVios_base@2@AAHAA_J@Z */
5066 /* ?get@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEBA?AV?$istreambuf_iterator@GU?$char_traits@G@std@@@2@V32@0AEAVios_base@2@AEAHAEA_J@Z */
5067 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_int64,36)
5068 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_int64(const num_get *this, istreambuf_iterator_wchar *ret,
5069 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, LONGLONG *pval)
5071 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5072 return call_num_get_wchar_do_get_int64(this, ret, first, last, base, state, pval);
5075 static istreambuf_iterator_wchar* num_get_do_get_ulong(const num_get *this,
5076 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar first,
5077 istreambuf_iterator_wchar last, ios_base *base, int *state,
5078 ULONG *pval, numpunct_wchar *numpunct)
5080 ULONG v;
5081 char tmp[25], *end;
5082 int err;
5084 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5086 v = _Stoulx(tmp, &end, num_get__Getifld(this, tmp, &first,
5087 &last, base->fmtfl, base->loc, numpunct), &err);
5088 if(end!=tmp && !err)
5089 *pval = v;
5090 else
5091 *state |= IOSTATE_failbit;
5093 if(!first.strbuf)
5094 *state |= IOSTATE_eofbit;
5096 *ret = first;
5097 return ret;
5100 /* ?do_get@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MBE?AV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@0AAVios_base@2@AAHAAK@Z */
5101 /* ?do_get@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MEBA?AV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@0AEAVios_base@2@AEAHAEAK@Z */
5102 #define call_num_get_wchar_do_get_ulong(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 28, istreambuf_iterator_wchar*, \
5103 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, ULONG*), \
5104 (this, ret, first, last, base, state, pval))
5105 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_ulong,36)
5106 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_ulong(const num_get *this, istreambuf_iterator_wchar *ret,
5107 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, ULONG *pval)
5109 return num_get_do_get_ulong(this, ret, first, last, base,
5110 state, pval, numpunct_wchar_use_facet(base->loc));
5113 /* ?do_get@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MBE?AV?$istreambuf_iterator@GU?$char_traits@G@std@@@2@V32@0AAVios_base@2@AAHAAK@Z */
5114 /* ?do_get@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MEBA?AV?$istreambuf_iterator@GU?$char_traits@G@std@@@2@V32@0AEAVios_base@2@AEAHAEAK@Z */
5115 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_ulong,36)
5116 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_ulong(const num_get *this, istreambuf_iterator_wchar *ret,
5117 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, ULONG *pval)
5119 return num_get_do_get_ulong(this, ret, first, last, base,
5120 state, pval, numpunct_short_use_facet(base->loc));
5123 /* ?get@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QBE?AV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@0AAVios_base@2@AAHAAK@Z */
5124 /* ?get@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEBA?AV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@0AEAVios_base@2@AEAHAEAK@Z */
5125 /* ?get@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QBE?AV?$istreambuf_iterator@GU?$char_traits@G@std@@@2@V32@0AAVios_base@2@AAHAAK@Z */
5126 /* ?get@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEBA?AV?$istreambuf_iterator@GU?$char_traits@G@std@@@2@V32@0AEAVios_base@2@AEAHAEAK@Z */
5127 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_ulong,36)
5128 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_ulong(const num_get *this, istreambuf_iterator_wchar *ret,
5129 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, ULONG *pval)
5131 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5132 return call_num_get_wchar_do_get_ulong(this, ret, first, last, base, state, pval);
5135 static istreambuf_iterator_wchar* num_get_do_get_long(const num_get *this,
5136 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar first,
5137 istreambuf_iterator_wchar last, ios_base *base, int *state,
5138 LONG *pval, numpunct_wchar *numpunct)
5140 LONG v;
5141 char tmp[25], *end;
5142 int err;
5144 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5146 v = _Stolx(tmp, &end, num_get__Getifld(this, tmp, &first,
5147 &last, base->fmtfl, base->loc, numpunct), &err);
5148 if(end!=tmp && !err)
5149 *pval = v;
5150 else
5151 *state |= IOSTATE_failbit;
5153 if(!first.strbuf)
5154 *state |= IOSTATE_eofbit;
5156 *ret = first;
5157 return ret;
5160 /* ?do_get@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MBE?AV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@0AAVios_base@2@AAHAAJ@Z */
5161 /* ?do_get@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MEBA?AV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@0AEAVios_base@2@AEAHAEAJ@Z */
5162 #define call_num_get_wchar_do_get_long(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 32, istreambuf_iterator_wchar*, \
5163 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, LONG*), \
5164 (this, ret, first, last, base, state, pval))
5165 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_long,36)
5166 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_long(const num_get *this, istreambuf_iterator_wchar *ret,
5167 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, LONG *pval)
5169 return num_get_do_get_long(this, ret, first, last, base,
5170 state, pval, numpunct_wchar_use_facet(base->loc));
5173 /* ?do_get@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MBE?AV?$istreambuf_iterator@GU?$char_traits@G@std@@@2@V32@0AAVios_base@2@AAHAAJ@Z */
5174 /* ?do_get@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MEBA?AV?$istreambuf_iterator@GU?$char_traits@G@std@@@2@V32@0AEAVios_base@2@AEAHAEAJ@Z */
5175 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_long,36)
5176 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_long(const num_get *this, istreambuf_iterator_wchar *ret,
5177 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, LONG *pval)
5179 return num_get_do_get_long(this, ret, first, last, base,
5180 state, pval, numpunct_short_use_facet(base->loc));
5183 /* ?get@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QBE?AV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@0AAVios_base@2@AAHAAJ@Z */
5184 /* ?get@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEBA?AV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@0AEAVios_base@2@AEAHAEAJ@Z */
5185 /* ?get@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QBE?AV?$istreambuf_iterator@GU?$char_traits@G@std@@@2@V32@0AAVios_base@2@AAHAAJ@Z */
5186 /* ?get@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEBA?AV?$istreambuf_iterator@GU?$char_traits@G@std@@@2@V32@0AEAVios_base@2@AEAHAEAJ@Z */
5187 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_long,36)
5188 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_long(const num_get *this, istreambuf_iterator_wchar *ret,
5189 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, LONG *pval)
5191 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5192 return call_num_get_wchar_do_get_long(this, ret, first, last, base, state, pval);
5195 /* ?do_get@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MBE?AV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@0AAVios_base@2@AAHAAI@Z */
5196 /* ?do_get@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MEBA?AV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@0AEAVios_base@2@AEAHAEAI@Z */
5197 #define call_num_get_wchar_do_get_uint(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 36, istreambuf_iterator_wchar*, \
5198 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, unsigned int*), \
5199 (this, ret, first, last, base, state, pval))
5200 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_uint,36)
5201 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_uint(const num_get *this, istreambuf_iterator_wchar *ret,
5202 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, unsigned int *pval)
5204 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5205 return num_get_wchar_do_get_ulong(this, ret, first, last, base, state, pval);
5208 /* ?do_get@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MBE?AV?$istreambuf_iterator@GU?$char_traits@G@std@@@2@V32@0AAVios_base@2@AAHAAI@Z */
5209 /* ?do_get@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MEBA?AV?$istreambuf_iterator@GU?$char_traits@G@std@@@2@V32@0AEAVios_base@2@AEAHAEAI@Z */
5210 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_uint,36)
5211 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_uint(const num_get *this, istreambuf_iterator_wchar *ret,
5212 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, unsigned int *pval)
5214 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5215 return num_get_short_do_get_ulong(this, ret, first, last, base, state, pval);
5218 /* ?get@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QBE?AV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@0AAVios_base@2@AAHAAI@Z */
5219 /* ?get@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEBA?AV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@0AEAVios_base@2@AEAHAEAI@Z */
5220 /* ?get@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QBE?AV?$istreambuf_iterator@GU?$char_traits@G@std@@@2@V32@0AAVios_base@2@AAHAAI@Z */
5221 /* ?get@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEBA?AV?$istreambuf_iterator@GU?$char_traits@G@std@@@2@V32@0AEAVios_base@2@AEAHAEAI@Z */
5222 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_uint,36)
5223 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_uint(const num_get *this, istreambuf_iterator_wchar *ret,
5224 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, unsigned int *pval)
5226 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5227 return call_num_get_wchar_do_get_uint(this, ret, first, last, base, state, pval);
5230 /* ?do_get@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MBE?AV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@0AAVios_base@2@AAHAAG@Z */
5231 /* ?do_get@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MEBA?AV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@0AEAVios_base@2@AEAHAEAG@Z */
5232 #define call_num_get_wchar_do_get_ushort(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 40, istreambuf_iterator_wchar*, \
5233 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, unsigned short*), \
5234 (this, ret, first, last, base, state, pval))
5235 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_ushort,36)
5236 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_ushort(const num_get *this, istreambuf_iterator_wchar *ret,
5237 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, unsigned short *pval)
5239 ULONG v;
5240 char tmp[25], *beg, *end;
5241 int err, b;
5243 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5245 b = num_get_wchar__Getifld(this, tmp,
5246 &first, &last, base->fmtfl, base->loc);
5247 beg = tmp + (tmp[0]=='-' ? 1 : 0);
5248 v = _Stoulx(beg, &end, b, &err);
5250 if(v != (ULONG)((unsigned short)v))
5251 *state |= IOSTATE_failbit;
5252 else if(end!=beg && !err)
5253 *pval = (tmp[0]=='-' ? -((unsigned short)v) : v);
5254 else
5255 *state |= IOSTATE_failbit;
5257 if(!first.strbuf)
5258 *state |= IOSTATE_eofbit;
5260 *ret = first;
5261 return ret;
5264 /* ?do_get@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MBE?AV?$istreambuf_iterator@GU?$char_traits@G@std@@@2@V32@0AAVios_base@2@AAHAAG@Z */
5265 /* ?do_get@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MEBA?AV?$istreambuf_iterator@GU?$char_traits@G@std@@@2@V32@0AEAVios_base@2@AEAHAEAG@Z */
5266 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_ushort,36)
5267 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_ushort(const num_get *this, istreambuf_iterator_wchar *ret,
5268 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, unsigned short *pval)
5270 FIXME("(%p %p %p %p %p) stub\n", this, ret, base, state, pval);
5271 return ret;
5274 /* ?get@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QBE?AV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@0AAVios_base@2@AAHAAG@Z */
5275 /* ?get@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEBA?AV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@0AEAVios_base@2@AEAHAEAG@Z */
5276 /* ?get@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QBE?AV?$istreambuf_iterator@GU?$char_traits@G@std@@@2@V32@0AAVios_base@2@AAHAAG@ */
5277 /* ?get@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEBA?AV?$istreambuf_iterator@GU?$char_traits@G@std@@@2@V32@0AEAVios_base@2@AEAHAEAG@Z */
5278 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_ushort,36)
5279 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_ushort(const num_get *this, istreambuf_iterator_wchar *ret,
5280 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, unsigned short *pval)
5282 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5283 return call_num_get_wchar_do_get_ushort(this, ret, first, last, base, state, pval);
5286 static istreambuf_iterator_wchar* num_get_do_get_bool(const num_get *this,
5287 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar first,
5288 istreambuf_iterator_wchar last, ios_base *base, int *state,
5289 MSVCP_bool *pval, numpunct_wchar *numpunct)
5291 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5293 if(base->fmtfl & FMTFLAG_boolalpha) {
5294 basic_string_wchar false_bstr, true_bstr;
5295 const wchar_t *pfalse, *ptrue;
5297 numpunct_wchar_falsename(numpunct, &false_bstr);
5298 numpunct_wchar_truename(numpunct, &true_bstr);
5299 pfalse = MSVCP_basic_string_wchar_c_str(&false_bstr);
5300 ptrue = MSVCP_basic_string_wchar_c_str(&true_bstr);
5302 for(istreambuf_iterator_wchar_val(&first); first.strbuf;
5303 istreambuf_iterator_wchar_inc(&first)) {
5304 if(pfalse && *pfalse && first.val!=*pfalse)
5305 pfalse = NULL;
5306 if(ptrue && *ptrue && first.val!=*ptrue)
5307 ptrue = NULL;
5309 if(pfalse && *pfalse && ptrue && !*ptrue)
5310 ptrue = NULL;
5311 if(ptrue && *ptrue && pfalse && !*pfalse)
5312 pfalse = NULL;
5314 if(pfalse)
5315 pfalse++;
5316 if(ptrue)
5317 ptrue++;
5319 if((!pfalse || !*pfalse) && (!ptrue || !*ptrue))
5320 break;
5323 if(ptrue)
5324 *pval = TRUE;
5325 else if(pfalse)
5326 *pval = FALSE;
5327 else
5328 *state |= IOSTATE_failbit;
5330 MSVCP_basic_string_wchar_dtor(&false_bstr);
5331 MSVCP_basic_string_wchar_dtor(&true_bstr);
5332 }else {
5333 char tmp[25], *end;
5334 int err;
5335 LONG v = _Stolx(tmp, &end, num_get__Getifld(this, tmp, &first,
5336 &last, base->fmtfl, base->loc, numpunct), &err);
5338 if(end!=tmp && err==0 && (v==0 || v==1))
5339 *pval = v;
5340 else
5341 *state |= IOSTATE_failbit;
5344 if(!first.strbuf)
5345 *state |= IOSTATE_eofbit;
5346 memcpy(ret, &first, sizeof(first));
5347 return ret;
5350 /* ?do_get@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MBE?AV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@0AAVios_base@2@AAHAA_N@Z */
5351 /* ?do_get@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MEBA?AV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@0AEAVios_base@2@AEAHAEA_N@Z */
5352 #define call_num_get_wchar_do_get_bool(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 44, istreambuf_iterator_wchar*, \
5353 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, MSVCP_bool*), \
5354 (this, ret, first, last, base, state, pval))
5355 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_bool,36)
5356 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_bool(const num_get *this, istreambuf_iterator_wchar *ret,
5357 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, MSVCP_bool *pval)
5359 return num_get_do_get_bool(this, ret, first, last, base,
5360 state, pval, numpunct_wchar_use_facet(base->loc));
5363 /* ?do_get@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MBE?AV?$istreambuf_iterator@GU?$char_traits@G@std@@@2@V32@0AAVios_base@2@AAHAA_N@Z */
5364 /* ?do_get@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MEBA?AV?$istreambuf_iterator@GU?$char_traits@G@std@@@2@V32@0AEAVios_base@2@AEAHAEA_N@Z */
5365 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_bool,36)
5366 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_bool(const num_get *this, istreambuf_iterator_wchar *ret,
5367 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, MSVCP_bool *pval)
5369 return num_get_do_get_bool(this, ret, first, last, base,
5370 state, pval, numpunct_short_use_facet(base->loc));
5373 /* ?get@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QBE?AV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@0AAVios_base@2@AAHAA_N@Z */
5374 /* ?get@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEBA?AV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@0AEAVios_base@2@AEAHAEA_N@Z */
5375 /* ?get@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QBE?AV?$istreambuf_iterator@GU?$char_traits@G@std@@@2@V32@0AAVios_base@2@AAHAA_N@Z */
5376 /* ?get@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEBA?AV?$istreambuf_iterator@GU?$char_traits@G@std@@@2@V32@0AEAVios_base@2@AEAHAEA_N@Z */
5377 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_bool,36)
5378 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_bool(const num_get *this, istreambuf_iterator_wchar *ret,
5379 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, MSVCP_bool *pval)
5381 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5382 return call_num_get_wchar_do_get_bool(this, ret, first, last, base, state, pval);
5385 /* ?id@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@2V0locale@2@A */
5386 locale_id num_get_char_id = {0};
5388 /* ??_7?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@6B@ */
5389 extern const vtable_ptr MSVCP_num_get_char_vtable;
5391 /* ?_Init@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@IAEXABV_Locinfo@2@@Z */
5392 /* ?_Init@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@IEAAXAEBV_Locinfo@2@@Z */
5393 DEFINE_THISCALL_WRAPPER(num_get_char__Init, 8)
5394 void __thiscall num_get_char__Init(num_get *this, const _Locinfo *locinfo)
5396 TRACE("(%p %p)\n", this, locinfo);
5397 _Locinfo__Getcvt(locinfo, &this->cvt);
5400 /* ??0?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
5401 /* ??0?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
5402 DEFINE_THISCALL_WRAPPER(num_get_char_ctor_locinfo, 12)
5403 num_get* __thiscall num_get_char_ctor_locinfo(num_get *this,
5404 const _Locinfo *locinfo, MSVCP_size_t refs)
5406 TRACE("(%p %p %lu)\n", this, locinfo, refs);
5408 locale_facet_ctor_refs(&this->facet, refs);
5409 this->facet.vtable = &MSVCP_num_get_char_vtable;
5411 num_get_char__Init(this, locinfo);
5412 return this;
5415 /* ??0?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAE@I@Z */
5416 /* ??0?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAA@_K@Z */
5417 DEFINE_THISCALL_WRAPPER(num_get_char_ctor_refs, 8)
5418 num_get* __thiscall num_get_char_ctor_refs(num_get *this, MSVCP_size_t refs)
5420 _Locinfo locinfo;
5422 TRACE("(%p %lu)\n", this, refs);
5424 _Locinfo_ctor(&locinfo);
5425 num_get_char_ctor_locinfo(this, &locinfo, refs);
5426 _Locinfo_dtor(&locinfo);
5427 return this;
5430 /* ??_F?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAEXXZ */
5431 /* ??_F?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAAXXZ */
5432 DEFINE_THISCALL_WRAPPER(num_get_char_ctor, 4)
5433 num_get* __thiscall num_get_char_ctor(num_get *this)
5435 return num_get_char_ctor_refs(this, 0);
5438 /* ??1?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MAE@XZ */
5439 /* ??1?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MEAA@XZ */
5440 DEFINE_THISCALL_WRAPPER(num_get_char_dtor, 4)
5441 void __thiscall num_get_char_dtor(num_get *this)
5443 TRACE("(%p)\n", this);
5444 locale_facet_dtor(&this->facet);
5447 DEFINE_THISCALL_WRAPPER(num_get_char_vector_dtor, 8)
5448 num_get* __thiscall num_get_char_vector_dtor(num_get *this, unsigned int flags)
5450 TRACE("(%p %x)\n", this, flags);
5451 if(flags & 2) {
5452 /* we have an array, with the number of elements stored before the first object */
5453 INT_PTR i, *ptr = (INT_PTR *)this-1;
5455 for(i=*ptr-1; i>=0; i--)
5456 num_get_char_dtor(this+i);
5457 MSVCRT_operator_delete(ptr);
5458 } else {
5459 num_get_char_dtor(this);
5460 if(flags & 1)
5461 MSVCRT_operator_delete(this);
5464 return this;
5467 /* ?_Getcat@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
5468 /* ?_Getcat@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
5469 MSVCP_size_t __cdecl num_get_char__Getcat(const locale_facet **facet, const locale *loc)
5471 TRACE("(%p %p)\n", facet, loc);
5473 if(facet && !*facet) {
5474 _Locinfo locinfo;
5476 *facet = MSVCRT_operator_new(sizeof(num_get));
5477 if(!*facet) {
5478 ERR("Out of memory\n");
5479 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
5480 return 0;
5483 _Locinfo_ctor_cstr(&locinfo, MSVCP_basic_string_char_c_str(&loc->ptr->name));
5484 num_get_char_ctor_locinfo((num_get*)*facet, &locinfo, 0);
5485 _Locinfo_dtor(&locinfo);
5488 return LC_NUMERIC;
5491 num_get* num_get_char_use_facet(const locale *loc)
5493 static num_get *obj = NULL;
5495 _Lockit lock;
5496 const locale_facet *fac;
5498 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
5499 fac = locale__Getfacet(loc, locale_id_operator_size_t(&num_get_char_id));
5500 if(fac) {
5501 _Lockit_dtor(&lock);
5502 return (num_get*)fac;
5505 if(obj) {
5506 _Lockit_dtor(&lock);
5507 return obj;
5510 num_get_char__Getcat(&fac, loc);
5511 obj = (num_get*)fac;
5512 locale_facet__Incref(&obj->facet);
5513 locale_facet_register(&obj->facet);
5514 _Lockit_dtor(&lock);
5516 return obj;
5519 /* ?_Getffld@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@ABAHPADAAV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@1ABVlocale@2@@Z */
5520 /* ?_Getffld@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@AEBAHPEADAEAV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@1AEBVlocale@2@@Z */
5521 /* Copies number to dest buffer, validates grouping and skips separators.
5522 * Updates first so it points past the number, all digits are skipped.
5523 * Returns how exponent needs to changed.
5524 * Size of dest buffer is not specified, assuming it's not smaller than 32:
5525 * strlen(+0.e+) + 22(digits) + 4(expontent) + 1(nullbyte)
5527 int __cdecl num_get_char__Getffld(const num_get *this, char *dest, istreambuf_iterator_char *first,
5528 istreambuf_iterator_char *last, const locale *loc)
5530 numpunct_char *numpunct = numpunct_char_use_facet(loc);
5531 basic_string_char grouping_bstr;
5532 basic_string_char groups_found;
5533 int groups_no = 0, cur_group = 0, exp = 0;
5534 char *dest_beg = dest, *num_end = dest+25, *exp_end = dest+31, sep;
5535 const char *grouping, *groups;
5536 BOOL error = FALSE, got_digit = FALSE, got_nonzero = FALSE;
5538 TRACE("(%p %p %p %p)\n", dest, first, last, loc);
5540 numpunct_char_grouping(numpunct, &grouping_bstr);
5541 grouping = MSVCP_basic_string_char_c_str(&grouping_bstr);
5542 sep = grouping[0] ? numpunct_char_thousands_sep(numpunct) : '\0';
5544 if(sep)
5545 MSVCP_basic_string_char_ctor(&groups_found);
5547 istreambuf_iterator_char_val(first);
5548 /* get sign */
5549 if(first->strbuf && (first->val=='-' || first->val=='+')) {
5550 *dest++ = first->val;
5551 istreambuf_iterator_char_inc(first);
5554 /* read possibly grouped numbers before decimal */
5555 for(; first->strbuf; istreambuf_iterator_char_inc(first)) {
5556 if(first->val<'0' || first->val>'9') {
5557 if(sep && first->val==sep) {
5558 if(!groups_no) break; /* empty group - stop parsing */
5559 MSVCP_basic_string_char_append_ch(&groups_found, groups_no);
5560 groups_no = 0;
5561 ++cur_group;
5562 }else {
5563 break;
5565 }else {
5566 got_digit = TRUE; /* found a digit, zero or non-zero */
5567 /* write digit to dest if not a leading zero (to not waste dest buffer) */
5568 if(!got_nonzero && first->val == '0')
5570 ++groups_no;
5571 continue;
5573 got_nonzero = TRUE;
5574 if(dest < num_end)
5575 *dest++ = first->val;
5576 else
5577 exp++; /* too many digits, just multiply by 10 */
5578 if(sep && groups_no<CHAR_MAX)
5579 ++groups_no;
5583 /* if all leading zeroes, we didn't write anything so put a zero we check for a decimal */
5584 if(got_digit && !got_nonzero)
5585 *dest++ = '0';
5587 /* get decimal, if any */
5588 if(first->strbuf && first->val==numpunct_char_decimal_point(numpunct)) {
5589 if(dest < num_end)
5590 *dest++ = *localeconv()->decimal_point;
5591 istreambuf_iterator_char_inc(first);
5594 /* read non-grouped after decimal */
5595 for(; first->strbuf; istreambuf_iterator_char_inc(first)) {
5596 if(first->val<'0' || first->val>'9')
5597 break;
5598 else if(dest<num_end) {
5599 got_digit = TRUE;
5600 *dest++ = first->val;
5604 /* read exponent, if any */
5605 if(first->strbuf && (first->val=='e' || first->val=='E')) {
5606 *dest++ = first->val;
5607 istreambuf_iterator_char_inc(first);
5609 if(first->strbuf && (first->val=='-' || first->val=='+')) {
5610 *dest++ = first->val;
5611 istreambuf_iterator_char_inc(first);
5614 got_digit = got_nonzero = FALSE;
5615 error = TRUE;
5616 /* skip any leading zeroes */
5617 for(; first->strbuf && first->val=='0'; istreambuf_iterator_char_inc(first))
5618 got_digit = TRUE;
5620 for(; first->strbuf && first->val>='0' && first->val<='9'; istreambuf_iterator_char_inc(first)) {
5621 got_digit = got_nonzero = TRUE; /* leading zeroes would have been skipped, so first digit is non-zero */
5622 error = FALSE;
5623 if(dest<exp_end)
5624 *dest++ = first->val;
5627 /* if just found zeroes for exponent, use that */
5628 if(got_digit && !got_nonzero)
5630 error = FALSE;
5631 if(dest<exp_end)
5632 *dest++ = '0';
5636 if(sep && groups_no)
5637 MSVCP_basic_string_char_append_ch(&groups_found, groups_no);
5639 groups = MSVCP_basic_string_char_c_str(&groups_found);
5640 if(cur_group && !groups[cur_group])
5642 error = TRUE; /* trailing empty */
5643 }else if(!cur_group) /* no groups, skip loop */
5644 cur_group--;
5646 for(; cur_group>=0 && !error; cur_group--) {
5647 if(*grouping == CHAR_MAX) {
5648 if(cur_group)
5649 error = TRUE;
5650 break;
5651 }else if((cur_group && *grouping!=groups[cur_group])
5652 || (!cur_group && *grouping<groups[cur_group])) {
5653 error = TRUE;
5654 break;
5655 }else if(grouping[1]) {
5656 grouping++;
5659 MSVCP_basic_string_char_dtor(&grouping_bstr);
5660 if(sep)
5661 MSVCP_basic_string_char_dtor(&groups_found);
5663 if(error) {
5664 *dest_beg = '\0';
5665 return 0;
5667 *dest++ = '\0';
5668 return exp;
5671 /* ?_Getffldx@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@ABAHPADAAV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@1AAVios_base@2@PAH@Z */
5672 /* ?_Getffldx@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@AEBAHPEADAEAV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@1AEAVios_base@2@PEAH@Z */
5673 int __cdecl num_get_char__Getffldx(const num_get *this, char *dest, istreambuf_iterator_char *first,
5674 istreambuf_iterator_char *last, ios_base *ios, int *phexexp)
5676 FIXME("(%p %p %p %p %p) stub\n", dest, first, last, ios, phexexp);
5677 return -1;
5680 /* ?_Getifld@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@ABAHPADAAV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@1HABVlocale@2@@Z */
5681 /* ?_Getifld@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@AEBAHPEADAEAV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@1HAEBVlocale@2@@Z */
5682 /* Copies number to dest buffer, validates grouping and skips separators.
5683 * Updates first so it points past the number, all digits are skipped.
5684 * Returns number base (8, 10 or 16).
5685 * Size of dest buffer is not specified, assuming it's not smaller than 25:
5686 * 22(8^22>2^64)+1(detect overflows)+1(sign)+1(nullbyte) = 25
5688 int __cdecl num_get_char__Getifld(const num_get *this, char *dest, istreambuf_iterator_char *first,
5689 istreambuf_iterator_char *last, int fmtflags, const locale *loc)
5691 static const char digits[] = "0123456789abcdefABCDEF";
5693 numpunct_char *numpunct = numpunct_char_use_facet(loc);
5694 basic_string_char grouping_bstr;
5695 basic_string_char groups_found;
5696 int basefield, base, groups_no = 0, cur_group = 0;
5697 char *dest_beg = dest, *dest_end = dest+24, sep;
5698 const char *grouping, *groups;
5699 BOOL error = TRUE, dest_empty = TRUE, found_zero = FALSE;
5701 TRACE("(%p %p %p %04x %p)\n", dest, first, last, fmtflags, loc);
5703 numpunct_char_grouping(numpunct, &grouping_bstr);
5704 grouping = MSVCP_basic_string_char_c_str(&grouping_bstr);
5705 sep = grouping[0] ? numpunct_char_thousands_sep(numpunct) : '\0';
5707 basefield = fmtflags & FMTFLAG_basefield;
5708 if(basefield == FMTFLAG_oct)
5709 base = 8;
5710 else if(basefield == FMTFLAG_hex)
5711 base = 22; /* equal to the size of digits buffer */
5712 else if(!basefield)
5713 base = 0;
5714 else
5715 base = 10;
5717 istreambuf_iterator_char_val(first);
5718 if(first->strbuf && (first->val=='-' || first->val=='+')) {
5719 *dest++ = first->val;
5720 istreambuf_iterator_char_inc(first);
5723 if(first->strbuf && first->val=='0') {
5724 found_zero = TRUE;
5725 istreambuf_iterator_char_inc(first);
5726 if(first->strbuf && (first->val=='x' || first->val=='X')) {
5727 if(!base || base == 22) {
5728 found_zero = FALSE;
5729 istreambuf_iterator_char_inc(first);
5730 base = 22;
5731 }else {
5732 base = 10;
5734 }else {
5735 error = FALSE;
5736 if(!base) base = 8;
5738 }else {
5739 if (!base) base = 10;
5742 if(sep)
5744 MSVCP_basic_string_char_ctor(&groups_found);
5745 if(found_zero) ++groups_no;
5748 for(; first->strbuf; istreambuf_iterator_char_inc(first)) {
5749 if(!memchr(digits, first->val, base)) {
5750 if(sep && first->val==sep) {
5751 if(!groups_no) break; /* empty group - stop parsing */
5752 MSVCP_basic_string_char_append_ch(&groups_found, groups_no);
5753 groups_no = 0;
5754 ++cur_group;
5755 }else {
5756 break;
5758 }else {
5759 error = FALSE;
5760 if(dest_empty && first->val == '0')
5762 found_zero = TRUE;
5763 ++groups_no;
5764 continue;
5766 dest_empty = FALSE;
5767 /* skip digits that can't be copied to dest buffer, other
5768 * functions are responsible for detecting overflows */
5769 if(dest < dest_end)
5770 *dest++ = first->val;
5771 if(sep && groups_no<CHAR_MAX)
5772 ++groups_no;
5776 if(sep && groups_no)
5777 MSVCP_basic_string_char_append_ch(&groups_found, groups_no);
5779 groups = MSVCP_basic_string_char_c_str(&groups_found);
5780 if(cur_group && !groups[cur_group])
5782 error = TRUE; /* trailing empty */
5783 found_zero = FALSE;
5784 }else if(!cur_group) /* no groups, skip loop */
5785 cur_group--;
5787 for(; cur_group>=0 && !error; cur_group--) {
5788 if(*grouping == CHAR_MAX) {
5789 if(cur_group)
5790 error = TRUE;
5791 break;
5792 }else if((cur_group && *grouping!=groups[cur_group])
5793 || (!cur_group && *grouping<groups[cur_group])) {
5794 error = TRUE;
5795 break;
5796 }else if(grouping[1]) {
5797 grouping++;
5801 MSVCP_basic_string_char_dtor(&grouping_bstr);
5802 if(sep)
5803 MSVCP_basic_string_char_dtor(&groups_found);
5805 if(error) {
5806 if (found_zero)
5807 *dest++ = '0';
5808 else
5809 dest = dest_beg;
5810 }else if(dest_empty)
5811 *dest++ = '0';
5812 *dest = '\0';
5814 return (base==22 ? 16 : base);
5817 /* ?_Hexdig@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@ABEHD000@Z */
5818 /* ?_Hexdig@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@AEBAHD000@Z */
5819 DEFINE_THISCALL_WRAPPER(MSVCP_num_get_char__Hexdig, 20)
5820 int __thiscall MSVCP_num_get_char__Hexdig(num_get *this, char dig, char e0, char al, char au)
5822 FIXME("(%p %c %c %c %c) stub\n", this, dig, e0, al, au);
5823 return -1;
5826 /* ?do_get@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MBE?AV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@V32@0AAVios_base@2@AAHAAPAX@Z */
5827 /* ?do_get@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MEBA?AV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@V32@0AEAVios_base@2@AEAHAEAPEAX@Z */
5828 #define call_num_get_char_do_get_void(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 4, istreambuf_iterator_char*, \
5829 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, void**), \
5830 (this, ret, first, last, base, state, pval))
5831 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_void,36)
5832 istreambuf_iterator_char *__thiscall num_get_char_do_get_void(const num_get *this, istreambuf_iterator_char *ret,
5833 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, void **pval)
5835 unsigned __int64 v;
5836 char tmp[25], *end;
5837 int err;
5839 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5841 v = _Stoullx(tmp, &end, num_get_char__Getifld(this, tmp,
5842 &first, &last, FMTFLAG_hex, base->loc), &err);
5843 if(v!=(unsigned __int64)((INT_PTR)v))
5844 *state |= IOSTATE_failbit;
5845 else if(end!=tmp && !err)
5846 *pval = (void*)((INT_PTR)v);
5847 else
5848 *state |= IOSTATE_failbit;
5850 if(!first.strbuf)
5851 *state |= IOSTATE_eofbit;
5853 *ret = first;
5854 return ret;
5857 /* ?get@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QBE?AV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@V32@0AAVios_base@2@AAHAAPAX@Z */
5858 /* ?get@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEBA?AV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@V32@0AEAVios_base@2@AEAHAEAPEAX@Z */
5859 DEFINE_THISCALL_WRAPPER(num_get_char_get_void,36)
5860 istreambuf_iterator_char *__thiscall num_get_char_get_void(const num_get *this, istreambuf_iterator_char *ret,
5861 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, void **pval)
5863 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5864 return call_num_get_char_do_get_void(this, ret, first, last, base, state, pval);
5867 /* ?do_get@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MBE?AV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@V32@0AAVios_base@2@AAHAAO@Z */
5868 /* ?do_get@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MEBA?AV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@V32@0AEAVios_base@2@AEAHAEAO@Z */
5869 /* ?do_get@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MBE?AV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@V32@0AAVios_base@2@AAHAAN@Z */
5870 /* ?do_get@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MEBA?AV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@V32@0AEAVios_base@2@AEAHAEAN@Z */
5871 #define call_num_get_char_do_get_ldouble(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 8, istreambuf_iterator_char*, \
5872 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, double*), \
5873 (this, ret, first, last, base, state, pval))
5874 #define call_num_get_char_do_get_double(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 12, istreambuf_iterator_char*, \
5875 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, double*), \
5876 (this, ret, first, last, base, state, pval))
5877 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_double,36)
5878 istreambuf_iterator_char *__thiscall num_get_char_do_get_double(const num_get *this, istreambuf_iterator_char *ret,
5879 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, double *pval)
5881 double v;
5882 char tmp[32], *end;
5883 int err;
5885 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5887 v = _Stodx(tmp, &end, num_get_char__Getffld(this, tmp, &first, &last, base->loc), &err);
5888 if(end!=tmp && !err)
5889 *pval = v;
5890 else
5891 *state |= IOSTATE_failbit;
5893 if(!first.strbuf)
5894 *state |= IOSTATE_eofbit;
5896 *ret = first;
5897 return ret;
5900 /* ?get@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QBE?AV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@V32@0AAVios_base@2@AAHAAO@Z */
5901 /* ?get@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEBA?AV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@V32@0AEAVios_base@2@AEAHAEAO@Z */
5902 DEFINE_THISCALL_WRAPPER(num_get_char_get_ldouble,36)
5903 istreambuf_iterator_char *__thiscall num_get_char_get_ldouble(const num_get *this, istreambuf_iterator_char *ret,
5904 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, double *pval)
5906 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5907 return call_num_get_char_do_get_ldouble(this, ret, first, last, base, state, pval);
5910 /* ?get@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QBE?AV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@V32@0AAVios_base@2@AAHAAN@Z */
5911 /* ?get@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEBA?AV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@V32@0AEAVios_base@2@AEAHAEAN@Z */
5912 DEFINE_THISCALL_WRAPPER(num_get_char_get_double,36)
5913 istreambuf_iterator_char *__thiscall num_get_char_get_double(const num_get *this, istreambuf_iterator_char *ret,
5914 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, double *pval)
5916 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5917 return call_num_get_char_do_get_double(this, ret, first, last, base, state, pval);
5920 /* ?do_get@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MBE?AV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@V32@0AAVios_base@2@AAHAAM@Z */
5921 /* ?do_get@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MEBA?AV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@V32@0AEAVios_base@2@AEAHAEAM@Z */
5922 #define call_num_get_char_do_get_float(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 16, istreambuf_iterator_char*, \
5923 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, float*), \
5924 (this, ret, first, last, base, state, pval))
5925 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_float,36)
5926 istreambuf_iterator_char *__thiscall num_get_char_do_get_float(const num_get *this, istreambuf_iterator_char *ret,
5927 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, float *pval)
5929 float v;
5930 char tmp[32], *end;
5931 int err;
5933 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5935 v = _Stofx(tmp, &end, num_get_char__Getffld(this, tmp, &first, &last, base->loc), &err);
5936 if(end!=tmp && !err)
5937 *pval = v;
5938 else
5939 *state |= IOSTATE_failbit;
5941 if(!first.strbuf)
5942 *state |= IOSTATE_eofbit;
5944 *ret = first;
5945 return ret;
5948 /* ?get@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QBE?AV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@V32@0AAVios_base@2@AAHAAM@Z */
5949 /* ?get@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEBA?AV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@V32@0AEAVios_base@2@AEAHAEAM@Z */
5950 DEFINE_THISCALL_WRAPPER(num_get_char_get_float,36)
5951 istreambuf_iterator_char *__thiscall num_get_char_get_float(const num_get *this, istreambuf_iterator_char *ret,
5952 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, float *pval)
5954 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5955 return call_num_get_char_do_get_float(this, ret, first, last, base, state, pval);
5958 /* ?do_get@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MBE?AV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@V32@0AAVios_base@2@AAHAA_K@Z */
5959 /* ?do_get@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MEBA?AV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@V32@0AEAVios_base@2@AEAHAEA_K@Z */
5960 #define call_num_get_char_do_get_uint64(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 20, istreambuf_iterator_char*, \
5961 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, ULONGLONG*), \
5962 (this, ret, first, last, base, state, pval))
5963 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_uint64,36)
5964 istreambuf_iterator_char *__thiscall num_get_char_do_get_uint64(const num_get *this, istreambuf_iterator_char *ret,
5965 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, ULONGLONG *pval)
5967 unsigned __int64 v;
5968 char tmp[25], *end;
5969 int err;
5971 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5973 v = _Stoullx(tmp, &end, num_get_char__Getifld(this, tmp,
5974 &first, &last, base->fmtfl, base->loc), &err);
5975 if(end!=tmp && !err)
5976 *pval = v;
5977 else
5978 *state |= IOSTATE_failbit;
5980 if(!first.strbuf)
5981 *state |= IOSTATE_eofbit;
5983 *ret = first;
5984 return ret;
5987 /* ?get@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QBE?AV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@V32@0AAVios_base@2@AAHAA_K@Z */
5988 /* ?get@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEBA?AV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@V32@0AEAVios_base@2@AEAHAEA_K@Z */
5989 DEFINE_THISCALL_WRAPPER(num_get_char_get_uint64,36)
5990 istreambuf_iterator_char *__thiscall num_get_char_get_uint64(const num_get *this, istreambuf_iterator_char *ret,
5991 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, ULONGLONG *pval)
5993 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5994 return call_num_get_char_do_get_uint64(this, ret, first, last, base, state, pval);
5997 /* ?do_get@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MBE?AV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@V32@0AAVios_base@2@AAHAA_J@Z */
5998 /* ?do_get@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MEBA?AV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@V32@0AEAVios_base@2@AEAHAEA_J@Z */
5999 #define call_num_get_char_do_get_int64(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 24, istreambuf_iterator_char*, \
6000 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, LONGLONG*), \
6001 (this, ret, first, last, base, state, pval))
6002 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_int64,36)
6003 istreambuf_iterator_char *__thiscall num_get_char_do_get_int64(const num_get *this, istreambuf_iterator_char *ret,
6004 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, LONGLONG *pval)
6006 __int64 v;
6007 char tmp[25], *end;
6008 int err;
6010 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6012 v = _Stollx(tmp, &end, num_get_char__Getifld(this, tmp,
6013 &first, &last, base->fmtfl, base->loc), &err);
6014 if(end!=tmp && !err)
6015 *pval = v;
6016 else
6017 *state |= IOSTATE_failbit;
6019 if(!first.strbuf)
6020 *state |= IOSTATE_eofbit;
6022 *ret = first;
6023 return ret;
6026 /* ?get@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QBE?AV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@V32@0AAVios_base@2@AAHAA_J@Z */
6027 /* ?get@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEBA?AV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@V32@0AEAVios_base@2@AEAHAEA_J@Z */
6028 DEFINE_THISCALL_WRAPPER(num_get_char_get_int64,36)
6029 istreambuf_iterator_char *__thiscall num_get_char_get_int64(const num_get *this, istreambuf_iterator_char *ret,
6030 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, LONGLONG *pval)
6032 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6033 return call_num_get_char_do_get_int64(this, ret, first, last, base, state, pval);
6036 /* ?do_get@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MBE?AV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@V32@0AAVios_base@2@AAHAAK@Z */
6037 /* ?do_get@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MEBA?AV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@V32@0AEAVios_base@2@AEAHAEAK@Z */
6038 #define call_num_get_char_do_get_ulong(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 28, istreambuf_iterator_char*, \
6039 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, ULONG*), \
6040 (this, ret, first, last, base, state, pval))
6041 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_ulong,36)
6042 istreambuf_iterator_char *__thiscall num_get_char_do_get_ulong(const num_get *this, istreambuf_iterator_char *ret,
6043 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, ULONG *pval)
6045 ULONG v;
6046 char tmp[25], *end;
6047 int err;
6049 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6051 v = _Stoulx(tmp, &end, num_get_char__Getifld(this, tmp,
6052 &first, &last, base->fmtfl, base->loc), &err);
6053 if(end!=tmp && !err)
6054 *pval = v;
6055 else
6056 *state |= IOSTATE_failbit;
6058 if(!first.strbuf)
6059 *state |= IOSTATE_eofbit;
6061 *ret = first;
6062 return ret;
6065 /* ?get@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QBE?AV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@V32@0AAVios_base@2@AAHAAK@Z */
6066 /* ?get@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEBA?AV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@V32@0AEAVios_base@2@AEAHAEAK@Z */
6067 DEFINE_THISCALL_WRAPPER(num_get_char_get_ulong,36)
6068 istreambuf_iterator_char *__thiscall num_get_char_get_ulong(const num_get *this, istreambuf_iterator_char *ret,
6069 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, ULONG *pval)
6071 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6072 return call_num_get_char_do_get_ulong(this, ret, first, last, base, state, pval);
6075 /* ?do_get@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MBE?AV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@V32@0AAVios_base@2@AAHAAJ@Z */
6076 /* ?do_get@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MEBA?AV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@V32@0AEAVios_base@2@AEAHAEAJ@Z */
6077 #define call_num_get_char_do_get_long(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 32, istreambuf_iterator_char*, \
6078 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, LONG*), \
6079 (this, ret, first, last, base, state, pval))
6080 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_long,36)
6081 istreambuf_iterator_char *__thiscall num_get_char_do_get_long(const num_get *this, istreambuf_iterator_char *ret,
6082 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, LONG *pval)
6084 LONG v;
6085 char tmp[25], *end;
6086 int err;
6088 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6090 v = _Stolx(tmp, &end, num_get_char__Getifld(this, tmp,
6091 &first, &last, base->fmtfl, base->loc), &err);
6092 if(end!=tmp && !err)
6093 *pval = v;
6094 else
6095 *state |= IOSTATE_failbit;
6097 if(!first.strbuf)
6098 *state |= IOSTATE_eofbit;
6100 *ret = first;
6101 return ret;
6104 /* ?get@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QBE?AV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@V32@0AAVios_base@2@AAHAAJ@Z */
6105 /* ?get@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEBA?AV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@V32@0AEAVios_base@2@AEAHAEAJ@Z */
6106 DEFINE_THISCALL_WRAPPER(num_get_char_get_long,36)
6107 istreambuf_iterator_char *__thiscall num_get_char_get_long(const num_get *this, istreambuf_iterator_char *ret,
6108 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, LONG *pval)
6110 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6111 return call_num_get_char_do_get_long(this, ret, first, last, base, state, pval);
6114 /* ?do_get@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MBE?AV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@V32@0AAVios_base@2@AAHAAI@Z */
6115 /* ?do_get@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MEBA?AV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@V32@0AEAVios_base@2@AEAHAEAI@Z */
6116 #define call_num_get_char_do_get_uint(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 36, istreambuf_iterator_char*, \
6117 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, unsigned int*), \
6118 (this, ret, first, last, base, state, pval))
6119 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_uint,36)
6120 istreambuf_iterator_char *__thiscall num_get_char_do_get_uint(const num_get *this, istreambuf_iterator_char *ret,
6121 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, unsigned int *pval)
6123 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6124 return num_get_char_do_get_ulong(this, ret, first, last, base, state, pval);
6127 /* ?get@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QBE?AV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@V32@0AAVios_base@2@AAHAAI@Z */
6128 /* ?get@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEBA?AV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@V32@0AEAVios_base@2@AEAHAEAI@Z */
6129 DEFINE_THISCALL_WRAPPER(num_get_char_get_uint,36)
6130 istreambuf_iterator_char *__thiscall num_get_char_get_uint(const num_get *this, istreambuf_iterator_char *ret,
6131 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, unsigned int *pval)
6133 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6134 return call_num_get_char_do_get_uint(this, ret, first, last, base, state, pval);
6137 /* ?do_get@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MBE?AV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@V32@0AAVios_base@2@AAHAAG@Z */
6138 /* ?do_get@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MEBA?AV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@V32@0AEAVios_base@2@AEAHAEAG@Z */
6139 #define call_num_get_char_do_get_ushort(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 40, istreambuf_iterator_char*, \
6140 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, unsigned short*), \
6141 (this, ret, first, last, base, state, pval))
6142 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_ushort,36)
6143 istreambuf_iterator_char *__thiscall num_get_char_do_get_ushort(const num_get *this, istreambuf_iterator_char *ret,
6144 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, unsigned short *pval)
6146 ULONG v;
6147 char tmp[25], *beg, *end;
6148 int err, b;
6150 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6152 b = num_get_char__Getifld(this, tmp,
6153 &first, &last, base->fmtfl, base->loc);
6154 beg = tmp + (tmp[0]=='-' ? 1 : 0);
6155 v = _Stoulx(beg, &end, b, &err);
6157 if(v != (ULONG)((unsigned short)v))
6158 *state |= IOSTATE_failbit;
6159 else if(end!=beg && !err)
6160 *pval = (tmp[0]=='-' ? -((unsigned short)v) : v);
6161 else
6162 *state |= IOSTATE_failbit;
6164 if(!first.strbuf)
6165 *state |= IOSTATE_eofbit;
6167 *ret = first;
6168 return ret;
6171 /* ?get@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QBE?AV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@V32@0AAVios_base@2@AAHAAG@Z */
6172 /* ?get@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEBA?AV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@V32@0AEAVios_base@2@AEAHAEAG@Z */
6173 DEFINE_THISCALL_WRAPPER(num_get_char_get_ushort,36)
6174 istreambuf_iterator_char *__thiscall num_get_char_get_ushort(const num_get *this, istreambuf_iterator_char *ret,
6175 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, unsigned short *pval)
6177 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6178 return call_num_get_char_do_get_ushort(this, ret, first, last, base, state, pval);
6181 /* ?do_get@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MBE?AV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@V32@0AAVios_base@2@AAHAA_N@Z */
6182 /* ?do_get@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MEBA?AV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@V32@0AEAVios_base@2@AEAHAEA_N@Z */
6183 #define call_num_get_char_do_get_bool(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 44, istreambuf_iterator_char*, \
6184 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, MSVCP_bool*), \
6185 (this, ret, first, last, base, state, pval))
6186 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_bool,36)
6187 istreambuf_iterator_char *__thiscall num_get_char_do_get_bool(const num_get *this, istreambuf_iterator_char *ret,
6188 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, MSVCP_bool *pval)
6190 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6192 if(base->fmtfl & FMTFLAG_boolalpha) {
6193 numpunct_char *numpunct = numpunct_char_use_facet(base->loc);
6194 basic_string_char false_bstr, true_bstr;
6195 const char *pfalse, *ptrue;
6197 numpunct_char_falsename(numpunct, &false_bstr);
6198 numpunct_char_truename(numpunct, &true_bstr);
6199 pfalse = MSVCP_basic_string_char_c_str(&false_bstr);
6200 ptrue = MSVCP_basic_string_char_c_str(&true_bstr);
6202 for(istreambuf_iterator_char_val(&first); first.strbuf;
6203 istreambuf_iterator_char_inc(&first)) {
6204 if(pfalse && *pfalse && first.val!=*pfalse)
6205 pfalse = NULL;
6206 if(ptrue && *ptrue && first.val!=*ptrue)
6207 ptrue = NULL;
6209 if(pfalse && *pfalse && ptrue && !*ptrue)
6210 ptrue = NULL;
6211 if(ptrue && *ptrue && pfalse && !*pfalse)
6212 pfalse = NULL;
6214 if(pfalse)
6215 pfalse++;
6216 if(ptrue)
6217 ptrue++;
6219 if((!pfalse || !*pfalse) && (!ptrue || !*ptrue))
6220 break;
6223 if(ptrue)
6224 *pval = TRUE;
6225 else if(pfalse)
6226 *pval = FALSE;
6227 else
6228 *state |= IOSTATE_failbit;
6230 MSVCP_basic_string_char_dtor(&false_bstr);
6231 MSVCP_basic_string_char_dtor(&true_bstr);
6232 }else {
6233 char tmp[25], *end;
6234 int err;
6235 LONG v = _Stolx(tmp, &end, num_get_char__Getifld(this, tmp,
6236 &first, &last, base->fmtfl, base->loc), &err);
6238 if(end!=tmp && err==0 && (v==0 || v==1))
6239 *pval = v;
6240 else
6241 *state |= IOSTATE_failbit;
6244 if(!first.strbuf)
6245 *state |= IOSTATE_eofbit;
6246 memcpy(ret, &first, sizeof(first));
6247 return ret;
6250 /* ?get@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QBE?AV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@V32@0AAVios_base@2@AAHAA_N@Z */
6251 /* ?get@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEBA?AV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@V32@0AEAVios_base@2@AEAHAEA_N@Z */
6252 DEFINE_THISCALL_WRAPPER(num_get_char_get_bool,36)
6253 istreambuf_iterator_char *__thiscall num_get_char_get_bool(const num_get *this, istreambuf_iterator_char *ret,
6254 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, MSVCP_bool *pval)
6256 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6257 return call_num_get_char_do_get_bool(this, ret, first, last, base, state, pval);
6260 /* ?id@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@2V0locale@2@A */
6261 locale_id num_put_char_id = {0};
6263 /* num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@6B@ */
6264 extern const vtable_ptr MSVCP_num_put_char_vtable;
6266 /* ?_Init@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@IAEXABV_Locinfo@2@@Z */
6267 /* ?_Init@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@IEAAXAEBV_Locinfo@2@@Z */
6268 DEFINE_THISCALL_WRAPPER(num_put_char__Init, 8)
6269 void __thiscall num_put_char__Init(num_put *this, const _Locinfo *locinfo)
6271 TRACE("(%p %p)\n", this, locinfo);
6272 _Locinfo__Getcvt(locinfo, &this->cvt);
6275 /* ??0?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
6276 /* ??0?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
6277 DEFINE_THISCALL_WRAPPER(num_put_char_ctor_locinfo, 12)
6278 num_put* __thiscall num_put_char_ctor_locinfo(num_put *this, const _Locinfo *locinfo, MSVCP_size_t refs)
6280 TRACE("(%p %p %ld)\n", this, locinfo, refs);
6282 locale_facet_ctor_refs(&this->facet, refs);
6283 this->facet.vtable = &MSVCP_num_put_char_vtable;
6285 num_put_char__Init(this, locinfo);
6286 return this;
6289 /* ??0?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAE@I@Z */
6290 /* ??0?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAA@_K@Z */
6291 DEFINE_THISCALL_WRAPPER(num_put_char_ctor_refs, 8)
6292 num_put* __thiscall num_put_char_ctor_refs(num_put *this, MSVCP_size_t refs)
6294 _Locinfo locinfo;
6296 TRACE("(%p %lu)\n", this, refs);
6298 _Locinfo_ctor(&locinfo);
6299 num_put_char_ctor_locinfo(this, &locinfo, refs);
6300 _Locinfo_dtor(&locinfo);
6301 return this;
6304 /* ??_F?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAEXXZ */
6305 /* ??_F?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAAXXZ */
6306 DEFINE_THISCALL_WRAPPER(num_put_char_ctor, 4)
6307 num_put* __thiscall num_put_char_ctor(num_put *this)
6309 return num_put_char_ctor_refs(this, 0);
6312 /* ??1?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MAE@XZ */
6313 /* ??1?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MEAA@XZ */
6314 DEFINE_THISCALL_WRAPPER(num_put_char_dtor, 4)
6315 void __thiscall num_put_char_dtor(num_put *this)
6317 TRACE("(%p)\n", this);
6318 locale_facet_dtor(&this->facet);
6321 DEFINE_THISCALL_WRAPPER(num_put_char_vector_dtor, 8)
6322 num_put* __thiscall num_put_char_vector_dtor(num_put *this, unsigned int flags)
6324 TRACE("(%p %x)\n", this, flags);
6325 if(flags & 2) {
6326 /* we have an array, with the number of elements stored before the first object */
6327 INT_PTR i, *ptr = (INT_PTR *)this-1;
6329 for(i=*ptr-1; i>=0; i--)
6330 num_put_char_dtor(this+i);
6331 MSVCRT_operator_delete(ptr);
6332 } else {
6333 num_put_char_dtor(this);
6334 if(flags & 1)
6335 MSVCRT_operator_delete(this);
6338 return this;
6341 /* ?_Getcat@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
6342 /* ?_Getcat@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
6343 MSVCP_size_t __cdecl num_put_char__Getcat(const locale_facet **facet, const locale *loc)
6345 TRACE("(%p %p)\n", facet, loc);
6347 if(facet && !*facet) {
6348 _Locinfo locinfo;
6350 *facet = MSVCRT_operator_new(sizeof(num_put));
6351 if(!*facet) {
6352 ERR("Out of memory\n");
6353 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
6354 return 0;
6357 _Locinfo_ctor_cstr(&locinfo, MSVCP_basic_string_char_c_str(&loc->ptr->name));
6358 num_put_char_ctor_locinfo((num_put*)*facet, &locinfo, 0);
6359 _Locinfo_dtor(&locinfo);
6362 return LC_NUMERIC;
6365 num_put* num_put_char_use_facet(const locale *loc)
6367 static num_put *obj = NULL;
6369 _Lockit lock;
6370 const locale_facet *fac;
6372 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
6373 fac = locale__Getfacet(loc, locale_id_operator_size_t(&num_put_char_id));
6374 if(fac) {
6375 _Lockit_dtor(&lock);
6376 return (num_put*)fac;
6379 if(obj) {
6380 _Lockit_dtor(&lock);
6381 return obj;
6384 num_put_char__Getcat(&fac, loc);
6385 obj = (num_put*)fac;
6386 locale_facet__Incref(&obj->facet);
6387 locale_facet_register(&obj->facet);
6388 _Lockit_dtor(&lock);
6390 return obj;
6393 /* ?_Put@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@ABA?AV?$ostreambuf_iterator@DU?$char_traits@D@std@@@2@V32@PBDI@Z */
6394 /* ?_Put@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@AEBA?AV?$ostreambuf_iterator@DU?$char_traits@D@std@@@2@V32@PEBD_K@Z */
6395 ostreambuf_iterator_char* __cdecl num_put_char__Put(const num_put *this, ostreambuf_iterator_char *ret,
6396 ostreambuf_iterator_char dest, const char *ptr, MSVCP_size_t count)
6398 TRACE("(%p %p %p %ld)\n", this, ret, ptr, count);
6400 for(; count>0; count--)
6401 ostreambuf_iterator_char_put(&dest, *ptr++);
6403 *ret = dest;
6404 return ret;
6407 /* ?_Putc@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@ABA?AV?$ostreambuf_iterator@DU?$char_traits@D@std@@@2@V32@PBDI@Z */
6408 /* ?_Putc@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@AEBA?AV?$ostreambuf_iterator@DU?$char_traits@D@std@@@2@V32@PEBD_K@Z */
6409 ostreambuf_iterator_char* __cdecl num_put_char__Putc(const num_put *this, ostreambuf_iterator_char *ret,
6410 ostreambuf_iterator_char dest, const char *ptr, MSVCP_size_t count)
6412 TRACE("(%p %p %p %ld)\n", this, ret, ptr, count);
6414 for(; count>0; count--)
6415 ostreambuf_iterator_char_put(&dest, *ptr++);
6417 *ret = dest;
6418 return ret;
6421 /* ?_Putgrouped@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@ABA?AV?$ostreambuf_iterator@DU?$char_traits@D@std@@@2@V32@PBDID@Z */
6422 /* ?_Putgrouped@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@AEBA?AV?$ostreambuf_iterator@DU?$char_traits@D@std@@@2@V32@PEBD_KD@Z */
6423 ostreambuf_iterator_char* __cdecl num_put_char__Putgrouped(const num_put *this, ostreambuf_iterator_char *ret,
6424 ostreambuf_iterator_char dest, const char *ptr, MSVCP_size_t count, char delim)
6426 FIXME("(%p %p %p %ld %d) stub\n", this, ret, ptr, count, delim);
6427 return NULL;
6430 /* ?_Rep@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@ABA?AV?$ostreambuf_iterator@DU?$char_traits@D@std@@@2@V32@DI@Z */
6431 /* ?_Rep@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@AEBA?AV?$ostreambuf_iterator@DU?$char_traits@D@std@@@2@V32@D_K@Z */
6432 ostreambuf_iterator_char* __cdecl num_put_char__Rep(const num_put *this, ostreambuf_iterator_char *ret,
6433 ostreambuf_iterator_char dest, char c, MSVCP_size_t count)
6435 TRACE("(%p %p %d %ld)\n", this, ret, c, count);
6437 for(; count>0; count--)
6438 ostreambuf_iterator_char_put(&dest, c);
6440 *ret = dest;
6441 return ret;
6444 /* ?_Ffmt@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@ABAPADPADDH@Z */
6445 /* ?_Ffmt@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@AEBAPEADPEADDH@Z */
6446 char* __cdecl num_put_char__Ffmt(const num_put *this, char *fmt, char spec, int fmtfl)
6448 int type = fmtfl & FMTFLAG_floatfield;
6449 char *p = fmt;
6451 TRACE("(%p %p %d %d)\n", this, fmt, spec, fmtfl);
6453 *p++ = '%';
6454 if(fmtfl & FMTFLAG_showpos)
6455 *p++ = '+';
6456 if(fmtfl & FMTFLAG_showbase)
6457 *p++ = '#';
6458 *p++ = '.';
6459 *p++ = '*';
6460 if(spec)
6461 *p++ = spec;
6463 if(type == FMTFLAG_fixed)
6464 *p++ = 'f';
6465 else if(type == FMTFLAG_scientific)
6466 *p++ = (fmtfl & FMTFLAG_uppercase) ? 'E' : 'e';
6467 else if(type == (FMTFLAG_fixed|FMTFLAG_scientific))
6468 *p++ = (fmtfl & FMTFLAG_uppercase) ? 'A' : 'a';
6469 else
6470 *p++ = (fmtfl & FMTFLAG_uppercase) ? 'G' : 'g';
6472 *p++ = '\0';
6473 return fmt;
6476 /* ?_Fput@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@ABA?AV?$ostreambuf_iterator@DU?$char_traits@D@std@@@2@V32@AAVios_base@2@DPBDIIII@Z */
6477 /* ?_Fput@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@AEBA?AV?$ostreambuf_iterator@DU?$char_traits@D@std@@@2@V32@AEAVios_base@2@DPEBD_K333@Z */
6478 ostreambuf_iterator_char* __cdecl num_put_char__Fput(const num_put *this, ostreambuf_iterator_char *ret,
6479 ostreambuf_iterator_char dest, ios_base *base, char fill, const char *buf, MSVCP_size_t bef_point,
6480 MSVCP_size_t aft_point, MSVCP_size_t trailing, MSVCP_size_t count)
6482 FIXME("(%p %p %p %d %p %ld %ld %ld %ld) stub\n", this, ret, base,
6483 fill, buf, bef_point, aft_point, trailing, count);
6484 return NULL;
6487 /* TODO: This function should be removed when num_put_char__Fput is implemented */
6488 static ostreambuf_iterator_char* num_put_char_fput(const num_put *this, ostreambuf_iterator_char *ret,
6489 ostreambuf_iterator_char dest, ios_base *base, char fill, char *buf, MSVCP_size_t count)
6491 numpunct_char *numpunct = numpunct_char_use_facet(base->loc);
6492 basic_string_char grouping_bstr;
6493 const char *grouping;
6494 char *p, sep = *localeconv()->decimal_point;
6495 int cur_group = 0, group_size = 0;
6496 int adjustfield = base->fmtfl & FMTFLAG_adjustfield;
6497 MSVCP_size_t pad;
6499 TRACE("(%p %p %p %d %s %ld)\n", this, ret, base, fill, buf, count);
6501 /* Change decimal point */
6502 for(p=buf; p<buf+count; p++) {
6503 if(*p == sep) {
6504 *p = numpunct_char_decimal_point(numpunct);
6505 break;
6508 p--;
6510 /* Add separators to number */
6511 numpunct_char_grouping(numpunct, &grouping_bstr);
6512 grouping = MSVCP_basic_string_char_c_str(&grouping_bstr);
6513 sep = grouping[0] ? numpunct_char_thousands_sep(numpunct) : '\0';
6515 for(; p>buf && sep && grouping[cur_group]!=CHAR_MAX; p--) {
6516 group_size++;
6517 if(group_size == grouping[cur_group]) {
6518 group_size = 0;
6519 if(grouping[cur_group+1])
6520 cur_group++;
6522 memmove(p+1, p, buf+count-p);
6523 *p = sep;
6524 count++;
6527 MSVCP_basic_string_char_dtor(&grouping_bstr);
6529 /* Display number with padding */
6530 if(count >= base->wide)
6531 pad = 0;
6532 else
6533 pad = base->wide-count;
6534 base->wide = 0;
6536 if((adjustfield & FMTFLAG_internal) && (buf[0]=='-' || buf[0]=='+')) {
6537 num_put_char__Putc(this, &dest, dest, buf, 1);
6538 buf++;
6540 if(adjustfield != FMTFLAG_left) {
6541 num_put_char__Rep(this, ret, dest, fill, pad);
6542 pad = 0;
6544 num_put_char__Putc(this, &dest, dest, buf, count);
6545 return num_put_char__Rep(this, ret, dest, fill, pad);
6548 /* ?_Ifmt@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@ABAPADPADPBDH@Z */
6549 /* ?_Ifmt@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@AEBAPEADPEADPEBDH@Z */
6550 char* __cdecl num_put_char__Ifmt(const num_put *this, char *fmt, const char *spec, int fmtfl)
6552 int base = fmtfl & FMTFLAG_basefield;
6553 char *p = fmt;
6555 TRACE("(%p %p %p %d)\n", this, fmt, spec, fmtfl);
6557 *p++ = '%';
6558 if(fmtfl & FMTFLAG_showpos)
6559 *p++ = '+';
6560 if(fmtfl & FMTFLAG_showbase)
6561 *p++ = '#';
6563 *p++ = *spec++;
6564 if(*spec == 'l')
6565 *p++ = *spec++;
6567 if(base == FMTFLAG_oct)
6568 *p++ = 'o';
6569 else if(base == FMTFLAG_hex)
6570 *p++ = (fmtfl & FMTFLAG_uppercase) ? 'X' : 'x';
6571 else
6572 *p++ = *spec;
6574 *p++ = '\0';
6575 return fmt;
6578 /* ?_Iput@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@ABA?AV?$ostreambuf_iterator@DU?$char_traits@D@std@@@2@V32@AAVios_base@2@DPADI@Z */
6579 /* ?_Iput@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@AEBA?AV?$ostreambuf_iterator@DU?$char_traits@D@std@@@2@V32@AEAVios_base@2@DPEAD_K@Z */
6580 ostreambuf_iterator_char* __cdecl num_put_char__Iput(const num_put *this, ostreambuf_iterator_char *ret,
6581 ostreambuf_iterator_char dest, ios_base *base, char fill, char *buf, MSVCP_size_t count)
6583 numpunct_char *numpunct = numpunct_char_use_facet(base->loc);
6584 basic_string_char grouping_bstr;
6585 const char *grouping;
6586 char *p, sep;
6587 int cur_group = 0, group_size = 0;
6588 int adjustfield = base->fmtfl & FMTFLAG_adjustfield;
6589 MSVCP_size_t pad;
6591 TRACE("(%p %p %p %d %s %ld)\n", this, ret, base, fill, buf, count);
6593 /* Add separators to number */
6594 numpunct_char_grouping(numpunct, &grouping_bstr);
6595 grouping = MSVCP_basic_string_char_c_str(&grouping_bstr);
6596 sep = grouping[0] ? numpunct_char_thousands_sep(numpunct) : '\0';
6598 for(p=buf+count-1; p>buf && sep && grouping[cur_group]!=CHAR_MAX; p--) {
6599 group_size++;
6600 if(group_size == grouping[cur_group]) {
6601 group_size = 0;
6602 if(grouping[cur_group+1])
6603 cur_group++;
6605 memmove(p+1, p, buf+count-p);
6606 *p = sep;
6607 count++;
6610 MSVCP_basic_string_char_dtor(&grouping_bstr);
6612 /* Display number with padding */
6613 if(count >= base->wide)
6614 pad = 0;
6615 else
6616 pad = base->wide-count;
6617 base->wide = 0;
6619 if((adjustfield & FMTFLAG_internal) && (buf[0]=='-' || buf[0]=='+')) {
6620 num_put_char__Putc(this, &dest, dest, buf, 1);
6621 buf++;
6622 }else if((adjustfield & FMTFLAG_internal) && (buf[1]=='x' || buf[1]=='X')) {
6623 num_put_char__Putc(this, &dest, dest, buf, 2);
6624 buf += 2;
6626 if(adjustfield != FMTFLAG_left) {
6627 num_put_char__Rep(this, ret, dest, fill, pad);
6628 pad = 0;
6630 num_put_char__Putc(this, &dest, dest, buf, count);
6631 return num_put_char__Rep(this, ret, dest, fill, pad);
6634 /* ?do_put@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MBE?AV?$ostreambuf_iterator@DU?$char_traits@D@std@@@2@V32@AAVios_base@2@DJ@Z */
6635 /* ?do_put@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MEBA?AV?$ostreambuf_iterator@DU?$char_traits@D@std@@@2@V32@AEAVios_base@2@DJ@Z */
6636 #define call_num_put_char_do_put_long(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 28, ostreambuf_iterator_char*, \
6637 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, LONG), \
6638 (this, ret, dest, base, fill, v))
6639 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_long, 28)
6640 ostreambuf_iterator_char* __thiscall num_put_char_do_put_long(const num_put *this, ostreambuf_iterator_char *ret,
6641 ostreambuf_iterator_char dest, ios_base *base, char fill, LONG v)
6643 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
6644 char fmt[7]; /* strlen("%+#lld")+1 */
6646 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
6648 return num_put_char__Iput(this, ret, dest, base, fill, tmp,
6649 sprintf(tmp, num_put_char__Ifmt(this, fmt, "ld", base->fmtfl), v));
6652 /* ?put@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QBE?AV?$ostreambuf_iterator@DU?$char_traits@D@std@@@2@V32@AAVios_base@2@DJ@Z */
6653 /* ?put@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEBA?AV?$ostreambuf_iterator@DU?$char_traits@D@std@@@2@V32@AEAVios_base@2@DJ@Z */
6654 DEFINE_THISCALL_WRAPPER(num_put_char_put_long, 28)
6655 ostreambuf_iterator_char* __thiscall num_put_char_put_long(const num_put *this, ostreambuf_iterator_char *ret,
6656 ostreambuf_iterator_char dest, ios_base *base, char fill, LONG v)
6658 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
6659 return call_num_put_char_do_put_long(this, ret, dest, base, fill, v);
6662 /* ?do_put@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MBE?AV?$ostreambuf_iterator@DU?$char_traits@D@std@@@2@V32@AAVios_base@2@DK@Z */
6663 /* ?do_put@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MEBA?AV?$ostreambuf_iterator@DU?$char_traits@D@std@@@2@V32@AEAVios_base@2@DK@Z */
6664 #define call_num_put_char_do_put_ulong(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 24, ostreambuf_iterator_char*, \
6665 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, ULONG), \
6666 (this, ret, dest, base, fill, v))
6667 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_ulong, 28)
6668 ostreambuf_iterator_char* __thiscall num_put_char_do_put_ulong(const num_put *this, ostreambuf_iterator_char *ret,
6669 ostreambuf_iterator_char dest, ios_base *base, char fill, ULONG v)
6671 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
6672 char fmt[7]; /* strlen("%+#lld")+1 */
6674 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
6676 return num_put_char__Iput(this, ret, dest, base, fill, tmp,
6677 sprintf(tmp, num_put_char__Ifmt(this, fmt, "lu", base->fmtfl), v));
6680 /* ?put@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QBE?AV?$ostreambuf_iterator@DU?$char_traits@D@std@@@2@V32@AAVios_base@2@DK@Z */
6681 /* ?put@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEBA?AV?$ostreambuf_iterator@DU?$char_traits@D@std@@@2@V32@AEAVios_base@2@DK@Z */
6682 DEFINE_THISCALL_WRAPPER(num_put_char_put_ulong, 28)
6683 ostreambuf_iterator_char* __thiscall num_put_char_put_ulong(const num_put *this, ostreambuf_iterator_char *ret,
6684 ostreambuf_iterator_char dest, ios_base *base, char fill, ULONG v)
6686 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
6687 return call_num_put_char_do_put_ulong(this, ret, dest, base, fill, v);
6690 /* ?do_put@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MBE?AV?$ostreambuf_iterator@DU?$char_traits@D@std@@@2@V32@AAVios_base@2@DN@Z */
6691 /* ?do_put@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MEBA?AV?$ostreambuf_iterator@DU?$char_traits@D@std@@@2@V32@AEAVios_base@2@DN@Z */
6692 /* ?do_put@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MBE?AV?$ostreambuf_iterator@DU?$char_traits@D@std@@@2@V32@AAVios_base@2@DO@Z */
6693 /* ?do_put@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MEBA?AV?$ostreambuf_iterator@DU?$char_traits@D@std@@@2@V32@AEAVios_base@2@DO@Z */
6694 #define call_num_put_char_do_put_double(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 12, ostreambuf_iterator_char*, \
6695 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, double), \
6696 (this, ret, dest, base, fill, v))
6697 #define call_num_put_char_do_put_ldouble(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 8, ostreambuf_iterator_char*, \
6698 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, double), \
6699 (this, ret, dest, base, fill, v))
6700 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_double, 32)
6701 ostreambuf_iterator_char* __thiscall num_put_char_do_put_double(const num_put *this, ostreambuf_iterator_char *ret,
6702 ostreambuf_iterator_char dest, ios_base *base, char fill, double v)
6704 char *tmp;
6705 char fmt[8]; /* strlen("%+#.*lg")+1 */
6706 int size;
6708 TRACE("(%p %p %p %d %lf)\n", this, ret, base, fill, v);
6710 num_put_char__Ffmt(this, fmt, '\0', base->fmtfl);
6711 size = _scprintf(fmt, base->prec, v);
6713 /* TODO: don't use dynamic allocation */
6714 tmp = MSVCRT_operator_new(size*2);
6715 if(!tmp) {
6716 ERR("Out of memory\n");
6717 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
6719 num_put_char_fput(this, ret, dest, base, fill, tmp, sprintf(tmp, fmt, base->prec, v));
6720 MSVCRT_operator_delete(tmp);
6721 return ret;
6724 /* ?put@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QBE?AV?$ostreambuf_iterator@DU?$char_traits@D@std@@@2@V32@AAVios_base@2@DN@Z */
6725 /* ?put@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEBA?AV?$ostreambuf_iterator@DU?$char_traits@D@std@@@2@V32@AEAVios_base@2@DN@Z */
6726 DEFINE_THISCALL_WRAPPER(num_put_char_put_double, 32)
6727 ostreambuf_iterator_char* __thiscall num_put_char_put_double(const num_put *this, ostreambuf_iterator_char *ret,
6728 ostreambuf_iterator_char dest, ios_base *base, char fill, double v)
6730 TRACE("(%p %p %p %d %lf)\n", this, ret, base, fill, v);
6731 return call_num_put_char_do_put_double(this, ret, dest, base, fill, v);
6734 /* ?put@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QBE?AV?$ostreambuf_iterator@DU?$char_traits@D@std@@@2@V32@AAVios_base@2@DO@Z */
6735 /* ?put@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEBA?AV?$ostreambuf_iterator@DU?$char_traits@D@std@@@2@V32@AEAVios_base@2@DO@Z */
6736 DEFINE_THISCALL_WRAPPER(num_put_char_put_ldouble, 32)
6737 ostreambuf_iterator_char* __thiscall num_put_char_put_ldouble(const num_put *this, ostreambuf_iterator_char *ret,
6738 ostreambuf_iterator_char dest, ios_base *base, char fill, double v)
6740 TRACE("(%p %p %p %d %lf)\n", this, ret, base, fill, v);
6741 return call_num_put_char_do_put_ldouble(this, ret, dest, base, fill, v);
6744 /* ?do_put@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MBE?AV?$ostreambuf_iterator@DU?$char_traits@D@std@@@2@V32@AAVios_base@2@DPBX@Z */
6745 /* ?do_put@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MEBA?AV?$ostreambuf_iterator@DU?$char_traits@D@std@@@2@V32@AEAVios_base@2@DPEBX@Z */
6746 #define call_num_put_char_do_put_ptr(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 4, ostreambuf_iterator_char*, \
6747 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, const void*), \
6748 (this, ret, dest, base, fill, v))
6749 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_ptr, 28)
6750 ostreambuf_iterator_char* __thiscall num_put_char_do_put_ptr(const num_put *this, ostreambuf_iterator_char *ret,
6751 ostreambuf_iterator_char dest, ios_base *base, char fill, const void *v)
6753 char tmp[17]; /* 8(16^8==2^64)*2(separators beetwen every digit) + 1 */
6755 TRACE("(%p %p %p %d %p)\n", this, ret, base, fill, v);
6757 return num_put_char__Iput(this, ret, dest, base, fill, tmp, sprintf(tmp, "%p", v));
6760 /* ?put@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QBE?AV?$ostreambuf_iterator@DU?$char_traits@D@std@@@2@V32@AAVios_base@2@DPBX@Z */
6761 /* ?put@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEBA?AV?$ostreambuf_iterator@DU?$char_traits@D@std@@@2@V32@AEAVios_base@2@DPEBX@Z */
6762 DEFINE_THISCALL_WRAPPER(num_put_char_put_ptr, 28)
6763 ostreambuf_iterator_char* __thiscall num_put_char_put_ptr(const num_put *this, ostreambuf_iterator_char *ret,
6764 ostreambuf_iterator_char dest, ios_base *base, char fill, const void *v)
6766 TRACE("(%p %p %p %d %p)\n", this, ret, base, fill, v);
6767 return call_num_put_char_do_put_ptr(this, ret, dest, base, fill, v);
6770 /* ?do_put@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MBE?AV?$ostreambuf_iterator@DU?$char_traits@D@std@@@2@V32@AAVios_base@2@D_J@Z */
6771 /* ?do_put@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MEBA?AV?$ostreambuf_iterator@DU?$char_traits@D@std@@@2@V32@AEAVios_base@2@D_J@Z */
6772 #define call_num_put_char_do_put_int64(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 20, ostreambuf_iterator_char*, \
6773 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, __int64), \
6774 (this, ret, dest, base, fill, v))
6775 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_int64, 32)
6776 ostreambuf_iterator_char* __thiscall num_put_char_do_put_int64(const num_put *this, ostreambuf_iterator_char *ret,
6777 ostreambuf_iterator_char dest, ios_base *base, char fill, __int64 v)
6779 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
6780 char fmt[7]; /* strlen("%+#lld")+1 */
6782 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
6784 return num_put_char__Iput(this, ret, dest, base, fill, tmp,
6785 sprintf(tmp, num_put_char__Ifmt(this, fmt, "lld", base->fmtfl), v));
6788 /* ?put@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QBE?AV?$ostreambuf_iterator@DU?$char_traits@D@std@@@2@V32@AAVios_base@2@D_J@Z */
6789 /* ?put@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEBA?AV?$ostreambuf_iterator@DU?$char_traits@D@std@@@2@V32@AEAVios_base@2@D_J@Z */
6790 DEFINE_THISCALL_WRAPPER(num_put_char_put_int64, 32)
6791 ostreambuf_iterator_char* __thiscall num_put_char_put_int64(const num_put *this, ostreambuf_iterator_char *ret,
6792 ostreambuf_iterator_char dest, ios_base *base, char fill, __int64 v)
6794 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
6795 return call_num_put_char_do_put_int64(this, ret, dest, base, fill, v);
6798 /* ?do_put@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MBE?AV?$ostreambuf_iterator@DU?$char_traits@D@std@@@2@V32@AAVios_base@2@D_K@Z */
6799 /* ?do_put@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MEBA?AV?$ostreambuf_iterator@DU?$char_traits@D@std@@@2@V32@AEAVios_base@2@D_K@Z */
6800 #define call_num_put_char_do_put_uint64(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 16, ostreambuf_iterator_char*, \
6801 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, unsigned __int64), \
6802 (this, ret, dest, base, fill, v))
6803 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_uint64, 32)
6804 ostreambuf_iterator_char* __thiscall num_put_char_do_put_uint64(const num_put *this, ostreambuf_iterator_char *ret,
6805 ostreambuf_iterator_char dest, ios_base *base, char fill, unsigned __int64 v)
6807 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
6808 char fmt[7]; /* strlen("%+#lld")+1 */
6810 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
6812 return num_put_char__Iput(this, ret, dest, base, fill, tmp,
6813 sprintf(tmp, num_put_char__Ifmt(this, fmt, "llu", base->fmtfl), v));
6816 /* ?put@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QBE?AV?$ostreambuf_iterator@DU?$char_traits@D@std@@@2@V32@AAVios_base@2@D_K@Z */
6817 /* ?put@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEBA?AV?$ostreambuf_iterator@DU?$char_traits@D@std@@@2@V32@AEAVios_base@2@D_K@Z */
6818 DEFINE_THISCALL_WRAPPER(num_put_char_put_uint64, 32)
6819 ostreambuf_iterator_char* __thiscall num_put_char_put_uint64(const num_put *this, ostreambuf_iterator_char *ret,
6820 ostreambuf_iterator_char dest, ios_base *base, char fill, unsigned __int64 v)
6822 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
6823 return call_num_put_char_do_put_uint64(this, ret, dest, base, fill, v);
6826 /* ?do_put@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MBE?AV?$ostreambuf_iterator@DU?$char_traits@D@std@@@2@V32@AAVios_base@2@D_N@Z */
6827 /* ?do_put@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MEBA?AV?$ostreambuf_iterator@DU?$char_traits@D@std@@@2@V32@AEAVios_base@2@D_N@Z */
6828 #define call_num_put_char_do_put_bool(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 32, ostreambuf_iterator_char*, \
6829 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, MSVCP_bool), \
6830 (this, ret, dest, base, fill, v))
6831 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_bool, 28)
6832 ostreambuf_iterator_char* __thiscall num_put_char_do_put_bool(const num_put *this, ostreambuf_iterator_char *ret,
6833 ostreambuf_iterator_char dest, ios_base *base, char fill, MSVCP_bool v)
6835 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
6837 if(base->fmtfl & FMTFLAG_boolalpha) {
6838 numpunct_char *numpunct = numpunct_char_use_facet(base->loc);
6839 basic_string_char str;
6840 MSVCP_size_t pad, len;
6842 if(v)
6843 numpunct_char_truename(numpunct, &str);
6844 else
6845 numpunct_char_falsename(numpunct, &str);
6847 len = MSVCP_basic_string_char_length(&str);
6848 pad = (len>base->wide ? 0 : base->wide-len);
6849 base->wide = 0;
6851 if((base->fmtfl & FMTFLAG_adjustfield) != FMTFLAG_left) {
6852 num_put_char__Rep(this, &dest, dest, fill, pad);
6853 pad = 0;
6855 num_put_char__Putc(this, &dest, dest, MSVCP_basic_string_char_c_str(&str), len);
6856 MSVCP_basic_string_char_dtor(&str);
6857 return num_put_char__Rep(this, ret, dest, fill, pad);
6860 return num_put_char_put_long(this, ret, dest, base, fill, v);
6863 /* ?put@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QBE?AV?$ostreambuf_iterator@DU?$char_traits@D@std@@@2@V32@AAVios_base@2@D_N@Z */
6864 /* ?put@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEBA?AV?$ostreambuf_iterator@DU?$char_traits@D@std@@@2@V32@AEAVios_base@2@D_N@Z */
6865 DEFINE_THISCALL_WRAPPER(num_put_char_put_bool, 28)
6866 ostreambuf_iterator_char* __thiscall num_put_char_put_bool(const num_put *this, ostreambuf_iterator_char *ret,
6867 ostreambuf_iterator_char dest, ios_base *base, char fill, MSVCP_bool v)
6869 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
6870 return call_num_put_char_do_put_bool(this, ret, dest, base, fill, v);
6873 /* ?id@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@2V0locale@2@A */
6874 locale_id num_put_wchar_id = {0};
6875 /* ?id@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@2V0locale@2@A */
6876 locale_id num_put_short_id = {0};
6878 /* num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@6B@ */
6879 extern const vtable_ptr MSVCP_num_put_wchar_vtable;
6880 /* num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@6B@ */
6881 extern const vtable_ptr MSVCP_num_put_short_vtable;
6883 /* ?_Init@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@IAEXABV_Locinfo@2@@Z */
6884 /* ?_Init@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@IEAAXAEBV_Locinfo@2@@Z */
6885 DEFINE_THISCALL_WRAPPER(num_put_wchar__Init, 8)
6886 void __thiscall num_put_wchar__Init(num_put *this, const _Locinfo *locinfo)
6888 TRACE("(%p %p)\n", this, locinfo);
6889 _Locinfo__Getcvt(locinfo, &this->cvt);
6892 /* ??0?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
6893 /* ??0?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
6894 DEFINE_THISCALL_WRAPPER(num_put_wchar_ctor_locinfo, 12)
6895 num_put* __thiscall num_put_wchar_ctor_locinfo(num_put *this, const _Locinfo *locinfo, MSVCP_size_t refs)
6897 TRACE("(%p %p %ld)\n", this, locinfo, refs);
6899 locale_facet_ctor_refs(&this->facet, refs);
6900 this->facet.vtable = &MSVCP_num_put_wchar_vtable;
6902 num_put_wchar__Init(this, locinfo);
6903 return this;
6906 /* ??0?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
6907 /* ??0?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
6908 DEFINE_THISCALL_WRAPPER(num_put_short_ctor_locinfo, 12)
6909 num_put* __thiscall num_put_short_ctor_locinfo(num_put *this, const _Locinfo *locinfo, MSVCP_size_t refs)
6911 num_put_wchar_ctor_locinfo(this, locinfo, refs);
6912 this->facet.vtable = &MSVCP_num_put_short_vtable;
6913 return this;
6916 /* ??0?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAE@I@Z */
6917 /* ??0?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAA@_K@Z */
6918 DEFINE_THISCALL_WRAPPER(num_put_wchar_ctor_refs, 8)
6919 num_put* __thiscall num_put_wchar_ctor_refs(num_put *this, MSVCP_size_t refs)
6921 _Locinfo locinfo;
6923 TRACE("(%p %lu)\n", this, refs);
6925 _Locinfo_ctor(&locinfo);
6926 num_put_wchar_ctor_locinfo(this, &locinfo, refs);
6927 _Locinfo_dtor(&locinfo);
6928 return this;
6931 /* ??0?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAE@I@Z */
6932 /* ??0?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEAA@_K@Z */
6933 DEFINE_THISCALL_WRAPPER(num_put_short_ctor_refs, 8)
6934 num_put* __thiscall num_put_short_ctor_refs(num_put *this, MSVCP_size_t refs)
6936 num_put_wchar_ctor_refs(this, refs);
6937 this->facet.vtable = &MSVCP_num_put_short_vtable;
6938 return this;
6941 /* ??_F?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAEXXZ */
6942 /* ??_F?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAAXXZ */
6943 DEFINE_THISCALL_WRAPPER(num_put_wchar_ctor, 4)
6944 num_put* __thiscall num_put_wchar_ctor(num_put *this)
6946 return num_put_wchar_ctor_refs(this, 0);
6949 /* ??_F?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAEXXZ */
6950 /* ??_F?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEAAXXZ */
6951 DEFINE_THISCALL_WRAPPER(num_put_short_ctor, 4)
6952 num_put* __thiscall num_put_short_ctor(num_put *this)
6954 return num_put_short_ctor_refs(this, 0);
6957 /* ??1?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MAE@XZ */
6958 /* ??1?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MEAA@XZ */
6959 /* ??1?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MAE@XZ */
6960 /* ??1?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MEAA@XZ */
6961 DEFINE_THISCALL_WRAPPER(num_put_wchar_dtor, 4)
6962 void __thiscall num_put_wchar_dtor(num_put *this)
6964 TRACE("(%p)\n", this);
6965 locale_facet_dtor(&this->facet);
6968 DEFINE_THISCALL_WRAPPER(num_put_wchar_vector_dtor, 8)
6969 num_put* __thiscall num_put_wchar_vector_dtor(num_put *this, unsigned int flags)
6971 TRACE("(%p %x)\n", this, flags);
6972 if(flags & 2) {
6973 /* we have an array, with the number of elements stored before the first object */
6974 INT_PTR i, *ptr = (INT_PTR *)this-1;
6976 for(i=*ptr-1; i>=0; i--)
6977 num_put_wchar_dtor(this+i);
6978 MSVCRT_operator_delete(ptr);
6979 } else {
6980 num_put_wchar_dtor(this);
6981 if(flags & 1)
6982 MSVCRT_operator_delete(this);
6985 return this;
6988 /* ?_Getcat@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
6989 /* ?_Getcat@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
6990 MSVCP_size_t __cdecl num_put_wchar__Getcat(const locale_facet **facet, const locale *loc)
6992 TRACE("(%p %p)\n", facet, loc);
6994 if(facet && !*facet) {
6995 _Locinfo locinfo;
6997 *facet = MSVCRT_operator_new(sizeof(num_put));
6998 if(!*facet) {
6999 ERR("Out of memory\n");
7000 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7001 return 0;
7004 _Locinfo_ctor_cstr(&locinfo, MSVCP_basic_string_char_c_str(&loc->ptr->name));
7005 num_put_wchar_ctor_locinfo((num_put*)*facet, &locinfo, 0);
7006 _Locinfo_dtor(&locinfo);
7009 return LC_NUMERIC;
7012 /* ?_Getcat@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
7013 /* ?_Getcat@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
7014 MSVCP_size_t __cdecl num_put_short__Getcat(const locale_facet **facet, const locale *loc)
7016 TRACE("(%p %p)\n", facet, loc);
7018 if(facet && !*facet) {
7019 _Locinfo locinfo;
7021 *facet = MSVCRT_operator_new(sizeof(num_put));
7022 if(!*facet) {
7023 ERR("Out of memory\n");
7024 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7025 return 0;
7028 _Locinfo_ctor_cstr(&locinfo, MSVCP_basic_string_char_c_str(&loc->ptr->name));
7029 num_put_short_ctor_locinfo((num_put*)*facet, &locinfo, 0);
7030 _Locinfo_dtor(&locinfo);
7033 return LC_NUMERIC;
7036 num_put* num_put_wchar_use_facet(const locale *loc)
7038 static num_put *obj = NULL;
7040 _Lockit lock;
7041 const locale_facet *fac;
7043 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
7044 fac = locale__Getfacet(loc, locale_id_operator_size_t(&num_put_wchar_id));
7045 if(fac) {
7046 _Lockit_dtor(&lock);
7047 return (num_put*)fac;
7050 if(obj) {
7051 _Lockit_dtor(&lock);
7052 return obj;
7055 num_put_wchar__Getcat(&fac, loc);
7056 obj = (num_put*)fac;
7057 locale_facet__Incref(&obj->facet);
7058 locale_facet_register(&obj->facet);
7059 _Lockit_dtor(&lock);
7061 return obj;
7064 num_put* num_put_short_use_facet(const locale *loc)
7066 static num_put *obj = NULL;
7068 _Lockit lock;
7069 const locale_facet *fac;
7071 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
7072 fac = locale__Getfacet(loc, locale_id_operator_size_t(&num_put_short_id));
7073 if(fac) {
7074 _Lockit_dtor(&lock);
7075 return (num_put*)fac;
7078 if(obj) {
7079 _Lockit_dtor(&lock);
7080 return obj;
7083 num_put_short__Getcat(&fac, loc);
7084 obj = (num_put*)fac;
7085 locale_facet__Incref(&obj->facet);
7086 locale_facet_register(&obj->facet);
7087 _Lockit_dtor(&lock);
7089 return obj;
7092 /* ?_Put@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@ABA?AV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@PB_WI@Z */
7093 /* ?_Put@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@AEBA?AV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@PEB_W_K@Z */
7094 /* ?_Put@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@ABA?AV?$ostreambuf_iterator@GU?$char_traits@G@std@@@2@V32@PBGI@Z */
7095 /* ?_Put@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@AEBA?AV?$ostreambuf_iterator@GU?$char_traits@G@std@@@2@V32@PEBG_K@Z */
7096 ostreambuf_iterator_wchar* __cdecl num_put_wchar__Put(const num_put *this, ostreambuf_iterator_wchar *ret,
7097 ostreambuf_iterator_wchar dest, const wchar_t *ptr, MSVCP_size_t count)
7099 TRACE("(%p %p %s %ld)\n", this, ret, debugstr_wn(ptr, count), count);
7101 for(; count>0; count--)
7102 ostreambuf_iterator_wchar_put(&dest, *ptr++);
7104 *ret = dest;
7105 return ret;
7108 /* ?_Putc@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@ABA?AV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@PBDI@Z */
7109 /* ?_Putc@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@AEBA?AV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@PEBD_K@Z */
7110 /* ?_Putc@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@ABA?AV?$ostreambuf_iterator@GU?$char_traits@G@std@@@2@V32@PBDI@Z */
7111 /* ?_Putc@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@AEBA?AV?$ostreambuf_iterator@GU?$char_traits@G@std@@@2@V32@PEBD_K@Z */
7112 ostreambuf_iterator_wchar* __cdecl num_put_wchar__Putc(const num_put *this, ostreambuf_iterator_wchar *ret,
7113 ostreambuf_iterator_wchar dest, const char *ptr, MSVCP_size_t count)
7115 int state = 0;
7116 wchar_t ch;
7118 TRACE("(%p %p %s %ld)\n", this, ret, debugstr_an(ptr, count), count);
7120 for(; count>0; count--) {
7121 if(_Mbrtowc(&ch, ptr++, 1, &state, &this->cvt) == 1)
7122 ostreambuf_iterator_wchar_put(&dest, ch);
7125 *ret = dest;
7126 return ret;
7129 /* ?_Putgrouped@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@ABA?AV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@PBDI_W@Z */
7130 /* ?_Putgrouped@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@AEBA?AV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@PEBD_K_W@Z */
7131 /* ?_Putgrouped@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@ABA?AV?$ostreambuf_iterator@GU?$char_traits@G@std@@@2@V32@PBDIG@Z */
7132 /* ?_Putgrouped@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@AEBA?AV?$ostreambuf_iterator@GU?$char_traits@G@std@@@2@V32@PEBD_KG@Z */
7133 ostreambuf_iterator_wchar* __cdecl num_put_wchar__Putgrouped(const num_put *this, ostreambuf_iterator_wchar *ret,
7134 ostreambuf_iterator_wchar dest, const char *ptr, MSVCP_size_t count, wchar_t delim)
7136 FIXME("(%p %p %p %ld %d) stub\n", this, ret, ptr, count, delim);
7137 return NULL;
7140 /* ?_Rep@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@ABA?AV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@_WI@Z */
7141 /* ?_Rep@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@AEBA?AV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@_W_K@Z */
7142 /* ?_Rep@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@ABA?AV?$ostreambuf_iterator@GU?$char_traits@G@std@@@2@V32@GI@Z */
7143 /* ?_Rep@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@AEBA?AV?$ostreambuf_iterator@GU?$char_traits@G@std@@@2@V32@G_K@Z */
7144 ostreambuf_iterator_wchar* __cdecl num_put_wchar__Rep(const num_put *this, ostreambuf_iterator_wchar *ret,
7145 ostreambuf_iterator_wchar dest, wchar_t c, MSVCP_size_t count)
7147 TRACE("(%p %p %d %ld)\n", this, ret, c, count);
7149 for(; count>0; count--)
7150 ostreambuf_iterator_wchar_put(&dest, c);
7152 *ret = dest;
7153 return ret;
7156 /* ?_Ffmt@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@ABAPADPADDH@Z */
7157 /* ?_Ffmt@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@AEBAPEADPEADDH@Z */
7158 /* ?_Ffmt@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@ABAPADPADDH@Z */
7159 /* ?_Ffmt@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@AEBAPEADPEADDH@Z */
7160 char* __cdecl num_put_wchar__Ffmt(const num_put *this, char *fmt, char spec, int fmtfl)
7162 int type = fmtfl & FMTFLAG_floatfield;
7163 char *p = fmt;
7165 TRACE("(%p %p %d %d)\n", this, fmt, spec, fmtfl);
7167 *p++ = '%';
7168 if(fmtfl & FMTFLAG_showpos)
7169 *p++ = '+';
7170 if(fmtfl & FMTFLAG_showbase)
7171 *p++ = '#';
7172 *p++ = '.';
7173 *p++ = '*';
7174 if(spec)
7175 *p++ = spec;
7177 if(type == FMTFLAG_fixed)
7178 *p++ = 'f';
7179 else if(type == FMTFLAG_scientific)
7180 *p++ = (fmtfl & FMTFLAG_uppercase) ? 'E' : 'e';
7181 else if(type == (FMTFLAG_fixed|FMTFLAG_scientific))
7182 *p++ = (fmtfl & FMTFLAG_uppercase) ? 'A' : 'a';
7183 else
7184 *p++ = (fmtfl & FMTFLAG_uppercase) ? 'G' : 'g';
7186 *p++ = '\0';
7187 return fmt;
7190 /* ?_Fput@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@ABA?AV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@AAVios_base@2@_WPBDIIII@Z */
7191 /* ?_Fput@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@AEBA?AV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@AEAVios_base@2@_WPEBD_K444@Z */
7192 ostreambuf_iterator_wchar* __cdecl num_put_wchar__Fput(const num_put *this, ostreambuf_iterator_wchar *ret,
7193 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, const char *buf, MSVCP_size_t bef_point,
7194 MSVCP_size_t aft_point, MSVCP_size_t trailing, MSVCP_size_t count)
7196 FIXME("(%p %p %p %d %p %ld %ld %ld %ld) stub\n", this, ret, base,
7197 fill, buf, bef_point, aft_point, trailing, count);
7198 return NULL;
7201 /* ?_Fput@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@ABA?AV?$ostreambuf_iterator@GU?$char_traits@G@std@@@2@V32@AAVios_base@2@GPBDIIII@Z */
7202 /* ?_Fput@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@AEBA?AV?$ostreambuf_iterator@GU?$char_traits@G@std@@@2@V32@AEAVios_base@2@GPEBD_K333@Z */
7203 ostreambuf_iterator_wchar* __cdecl num_put_short__Fput(const num_put *this, ostreambuf_iterator_wchar *ret,
7204 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, const char *buf, MSVCP_size_t bef_point,
7205 MSVCP_size_t aft_point, MSVCP_size_t trailing, MSVCP_size_t count)
7207 FIXME("(%p %p %p %d %p %ld %ld %ld %ld) stub\n", this, ret, base,
7208 fill, buf, bef_point, aft_point, trailing, count);
7209 return NULL;
7212 /* TODO: This function should be removed when num_put_wchar__Fput is implemented */
7213 static ostreambuf_iterator_wchar* num_put__fput(const num_put *this, ostreambuf_iterator_wchar *ret,
7214 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, char *buf,
7215 MSVCP_size_t count, numpunct_wchar *numpunct)
7217 basic_string_char grouping_bstr;
7218 const char *grouping;
7219 char *p, dec_point = *localeconv()->decimal_point;
7220 wchar_t sep;
7221 int cur_group = 0, group_size = 0;
7222 int adjustfield = base->fmtfl & FMTFLAG_adjustfield;
7223 MSVCP_size_t i, pad;
7225 TRACE("(%p %p %p %d %s %ld)\n", this, ret, base, fill, buf, count);
7227 for(p=buf; p<buf+count; p++) {
7228 if(*p == dec_point)
7229 break;
7231 p--;
7233 /* Add separators to number */
7234 numpunct_wchar_grouping(numpunct, &grouping_bstr);
7235 grouping = MSVCP_basic_string_char_c_str(&grouping_bstr);
7236 sep = grouping[0] ? numpunct_wchar_thousands_sep(numpunct) : '\0';
7238 for(; p>buf && sep && grouping[cur_group]!=CHAR_MAX; p--) {
7239 group_size++;
7240 if(group_size == grouping[cur_group]) {
7241 group_size = 0;
7242 if(grouping[cur_group+1])
7243 cur_group++;
7245 memmove(p+1, p, buf+count-p);
7246 *p = '\0'; /* mark thousands separator positions */
7247 count++;
7250 MSVCP_basic_string_char_dtor(&grouping_bstr);
7252 /* Display number with padding */
7253 if(count >= base->wide)
7254 pad = 0;
7255 else
7256 pad = base->wide-count;
7257 base->wide = 0;
7259 if((adjustfield & FMTFLAG_internal) && (buf[0]=='-' || buf[0]=='+')) {
7260 num_put_wchar__Putc(this, &dest, dest, buf, 1);
7261 buf++;
7263 if(adjustfield != FMTFLAG_left) {
7264 num_put_wchar__Rep(this, ret, dest, fill, pad);
7265 pad = 0;
7268 for(i=0; i<count; i++) {
7269 if(buf[i] == dec_point)
7270 num_put_wchar__Rep(this, &dest, dest, numpunct_wchar_decimal_point(numpunct), 1);
7271 else if(!buf[i])
7272 num_put_wchar__Rep(this, &dest, dest, sep, 1);
7273 else
7274 num_put_wchar__Putc(this, &dest, dest, buf+i, 1);
7277 return num_put_wchar__Rep(this, ret, dest, fill, pad);
7280 /* ?_Ifmt@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@ABAPADPADPBDH@Z */
7281 /* ?_Ifmt@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@AEBAPEADPEADPEBDH@Z */
7282 /* ?_Ifmt@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@ABAPADPADPBDH@Z */
7283 /* ?_Ifmt@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@AEBAPEADPEADPEBDH@Z */
7284 char* __cdecl num_put_wchar__Ifmt(const num_put *this, char *fmt, const char *spec, int fmtfl)
7286 int base = fmtfl & FMTFLAG_basefield;
7287 char *p = fmt;
7289 TRACE("(%p %p %p %d)\n", this, fmt, spec, fmtfl);
7291 *p++ = '%';
7292 if(fmtfl & FMTFLAG_showpos)
7293 *p++ = '+';
7294 if(fmtfl & FMTFLAG_showbase)
7295 *p++ = '#';
7297 *p++ = *spec++;
7298 if(*spec == 'l')
7299 *p++ = *spec++;
7301 if(base == FMTFLAG_oct)
7302 *p++ = 'o';
7303 else if(base == FMTFLAG_hex)
7304 *p++ = (fmtfl & FMTFLAG_uppercase) ? 'X' : 'x';
7305 else
7306 *p++ = *spec;
7308 *p++ = '\0';
7309 return fmt;
7312 static ostreambuf_iterator_wchar* num_put__Iput(const num_put *this, ostreambuf_iterator_wchar *ret,
7313 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, char *buf,
7314 MSVCP_size_t count, numpunct_wchar *numpunct)
7316 basic_string_char grouping_bstr;
7317 const char *grouping;
7318 char *p;
7319 wchar_t sep;
7320 int cur_group = 0, group_size = 0;
7321 int adjustfield = base->fmtfl & FMTFLAG_adjustfield;
7322 MSVCP_size_t i, pad;
7324 TRACE("(%p %p %p %d %s %ld)\n", this, ret, base, fill, buf, count);
7326 /* Add separators to number */
7327 numpunct_wchar_grouping(numpunct, &grouping_bstr);
7328 grouping = MSVCP_basic_string_char_c_str(&grouping_bstr);
7329 sep = grouping[0] ? numpunct_wchar_thousands_sep(numpunct) : '\0';
7331 for(p=buf+count-1; p>buf && sep && grouping[cur_group]!=CHAR_MAX; p--) {
7332 group_size++;
7333 if(group_size == grouping[cur_group]) {
7334 group_size = 0;
7335 if(grouping[cur_group+1])
7336 cur_group++;
7338 memmove(p+1, p, buf+count-p);
7339 *p = '\0'; /* mark thousands separator positions */
7340 count++;
7343 MSVCP_basic_string_char_dtor(&grouping_bstr);
7345 /* Display number with padding */
7346 if(count >= base->wide)
7347 pad = 0;
7348 else
7349 pad = base->wide-count;
7350 base->wide = 0;
7352 if((adjustfield & FMTFLAG_internal) && (buf[0]=='-' || buf[0]=='+')) {
7353 num_put_wchar__Putc(this, &dest, dest, buf, 1);
7354 buf++;
7355 }else if((adjustfield & FMTFLAG_internal) && (buf[1]=='x' || buf[1]=='X')) {
7356 num_put_wchar__Putc(this, &dest, dest, buf, 2);
7357 buf += 2;
7359 if(adjustfield != FMTFLAG_left) {
7360 num_put_wchar__Rep(this, ret, dest, fill, pad);
7361 pad = 0;
7364 for(i=0; i<count; i++) {
7365 if(!buf[i])
7366 num_put_wchar__Rep(this, &dest, dest, sep, 1);
7367 else
7368 num_put_wchar__Putc(this, &dest, dest, buf+i, 1);
7371 return num_put_wchar__Rep(this, ret, dest, fill, pad);
7374 /* ?_Iput@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@ABA?AV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@AAVios_base@2@_WPADI@Z */
7375 /* ?_Iput@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@AEBA?AV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@AEAVios_base@2@_WPEAD_K@Z */
7376 ostreambuf_iterator_wchar* __cdecl num_put_wchar__Iput(const num_put *this, ostreambuf_iterator_wchar *ret,
7377 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, char *buf, MSVCP_size_t count)
7379 return num_put__Iput(this, ret, dest, base, fill, buf, count, numpunct_wchar_use_facet(base->loc));
7382 /* ?_Iput@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@ABA?AV?$ostreambuf_iterator@GU?$char_traits@G@std@@@2@V32@AAVios_base@2@GPADI@Z */
7383 /* ?_Iput@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@AEBA?AV?$ostreambuf_iterator@GU?$char_traits@G@std@@@2@V32@AEAVios_base@2@GPEAD_K@Z */
7384 ostreambuf_iterator_wchar* __cdecl num_put_short__Iput(const num_put *this, ostreambuf_iterator_wchar *ret,
7385 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, char *buf, MSVCP_size_t count)
7387 return num_put__Iput(this, ret, dest, base, fill, buf, count, numpunct_short_use_facet(base->loc));
7390 /* ?do_put@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MBE?AV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@AAVios_base@2@_WJ@Z */
7391 /* ?do_put@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MEBA?AV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@AEAVios_base@2@_WJ@Z */
7392 #define call_num_put_wchar_do_put_long(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 28, ostreambuf_iterator_wchar*, \
7393 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, LONG), \
7394 (this, ret, dest, base, fill, v))
7395 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_long, 28)
7396 ostreambuf_iterator_wchar* __thiscall num_put_wchar_do_put_long(const num_put *this, ostreambuf_iterator_wchar *ret,
7397 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, LONG v)
7399 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
7400 char fmt[7]; /* strlen("%+#lld")+1 */
7402 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
7404 return num_put_wchar__Iput(this, ret, dest, base, fill, tmp,
7405 sprintf(tmp, num_put_wchar__Ifmt(this, fmt, "ld", base->fmtfl), v));
7408 /* ?do_put@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MBE?AV?$ostreambuf_iterator@GU?$char_traits@G@std@@@2@V32@AAVios_base@2@GJ@Z */
7409 /* ?do_put@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MEBA?AV?$ostreambuf_iterator@GU?$char_traits@G@std@@@2@V32@AEAVios_base@2@GJ@Z */
7410 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_long, 28)
7411 ostreambuf_iterator_wchar* __thiscall num_put_short_do_put_long(const num_put *this, ostreambuf_iterator_wchar *ret,
7412 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, LONG v)
7414 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
7415 char fmt[7]; /* strlen("%+#lld")+1 */
7417 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
7419 return num_put_short__Iput(this, ret, dest, base, fill, tmp,
7420 sprintf(tmp, num_put_wchar__Ifmt(this, fmt, "ld", base->fmtfl), v));
7423 /* ?put@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QBE?AV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@AAVios_base@2@_WJ@Z */
7424 /* ?put@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEBA?AV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@AEAVios_base@2@_WJ@Z */
7425 /* ?put@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QBE?AV?$ostreambuf_iterator@GU?$char_traits@G@std@@@2@V32@AAVios_base@2@GJ@Z */
7426 /* ?put@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEBA?AV?$ostreambuf_iterator@GU?$char_traits@G@std@@@2@V32@AEAVios_base@2@GJ@Z */
7427 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_long, 28)
7428 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_long(const num_put *this, ostreambuf_iterator_wchar *ret,
7429 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, LONG v)
7431 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
7432 return call_num_put_wchar_do_put_long(this, ret, dest, base, fill, v);
7435 /* ?do_put@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MBE?AV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@AAVios_base@2@_WK@Z */
7436 /* ?do_put@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MEBA?AV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@AEAVios_base@2@_WK@Z */
7437 #define call_num_put_wchar_do_put_ulong(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 24, ostreambuf_iterator_wchar*, \
7438 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, ULONG), \
7439 (this, ret, dest, base, fill, v))
7440 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_ulong, 28)
7441 ostreambuf_iterator_wchar* __thiscall num_put_wchar_do_put_ulong(const num_put *this, ostreambuf_iterator_wchar *ret,
7442 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, ULONG v)
7444 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
7445 char fmt[7]; /* strlen("%+#lld")+1 */
7447 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
7449 return num_put_wchar__Iput(this, ret, dest, base, fill, tmp,
7450 sprintf(tmp, num_put_wchar__Ifmt(this, fmt, "lu", base->fmtfl), v));
7453 /* ?do_put@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MBE?AV?$ostreambuf_iterator@GU?$char_traits@G@std@@@2@V32@AAVios_base@2@GK@Z */
7454 /* ?do_put@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MEBA?AV?$ostreambuf_iterator@GU?$char_traits@G@std@@@2@V32@AEAVios_base@2@GK@Z */
7455 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_ulong, 28)
7456 ostreambuf_iterator_wchar* __thiscall num_put_short_do_put_ulong(const num_put *this, ostreambuf_iterator_wchar *ret,
7457 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, ULONG v)
7459 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
7460 char fmt[7]; /* strlen("%+#lld")+1 */
7462 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
7464 return num_put_short__Iput(this, ret, dest, base, fill, tmp,
7465 sprintf(tmp, num_put_wchar__Ifmt(this, fmt, "lu", base->fmtfl), v));
7468 /* ?put@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QBE?AV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@AAVios_base@2@_WK@Z */
7469 /* ?put@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEBA?AV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@AEAVios_base@2@_WK@Z */
7470 /* ?put@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QBE?AV?$ostreambuf_iterator@GU?$char_traits@G@std@@@2@V32@AAVios_base@2@GK@Z */
7471 /* ?put@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEBA?AV?$ostreambuf_iterator@GU?$char_traits@G@std@@@2@V32@AEAVios_base@2@GK@Z */
7472 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_ulong, 28)
7473 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_ulong(const num_put *this, ostreambuf_iterator_wchar *ret,
7474 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, ULONG v)
7476 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
7477 return call_num_put_wchar_do_put_ulong(this, ret, dest, base, fill, v);
7480 /* ?do_put@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MBE?AV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@AAVios_base@2@_WN@Z */
7481 /* ?do_put@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MEBA?AV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@AEAVios_base@2@_WN@Z */
7482 /* ?do_put@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MBE?AV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@AAVios_base@2@_WO@Z */
7483 /* ?do_put@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MEBA?AV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@AEAVios_base@2@_WO@Z */
7484 #define call_num_put_wchar_do_put_double(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 12, ostreambuf_iterator_wchar*, \
7485 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, double), \
7486 (this, ret, dest, base, fill, v))
7487 #define call_num_put_wchar_do_put_ldouble(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 8, ostreambuf_iterator_wchar*, \
7488 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, double), \
7489 (this, ret, dest, base, fill, v))
7490 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_double, 32)
7491 ostreambuf_iterator_wchar* __thiscall num_put_wchar_do_put_double(const num_put *this, ostreambuf_iterator_wchar *ret,
7492 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, double v)
7494 char *tmp;
7495 char fmt[8]; /* strlen("%+#.*lg")+1 */
7496 int size;
7498 TRACE("(%p %p %p %d %lf)\n", this, ret, base, fill, v);
7500 num_put_wchar__Ffmt(this, fmt, '\0', base->fmtfl);
7501 size = _scprintf(fmt, base->prec, v);
7503 /* TODO: don't use dynamic allocation */
7504 tmp = MSVCRT_operator_new(size*2);
7505 if(!tmp) {
7506 ERR("Out of memory\n");
7507 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7509 num_put__fput(this, ret, dest, base, fill, tmp, sprintf(tmp, fmt, base->prec, v),
7510 numpunct_wchar_use_facet(base->loc));
7511 MSVCRT_operator_delete(tmp);
7512 return ret;
7515 /* ?do_put@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MBE?AV?$ostreambuf_iterator@GU?$char_traits@G@std@@@2@V32@AAVios_base@2@GN@Z */
7516 /* ?do_put@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MEBA?AV?$ostreambuf_iterator@GU?$char_traits@G@std@@@2@V32@AEAVios_base@2@GN@Z */
7517 /* ?do_put@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MBE?AV?$ostreambuf_iterator@GU?$char_traits@G@std@@@2@V32@AAVios_base@2@GO@Z */
7518 /* ?do_put@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MEBA?AV?$ostreambuf_iterator@GU?$char_traits@G@std@@@2@V32@AEAVios_base@2@GO@Z */
7519 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_double, 32)
7520 ostreambuf_iterator_wchar* __thiscall num_put_short_do_put_double(const num_put *this, ostreambuf_iterator_wchar *ret,
7521 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, double v)
7523 char *tmp;
7524 char fmt[8]; /* strlen("%+#.*lg")+1 */
7525 int size;
7527 TRACE("(%p %p %p %d %lf)\n", this, ret, base, fill, v);
7529 num_put_wchar__Ffmt(this, fmt, '\0', base->fmtfl);
7530 size = _scprintf(fmt, base->prec, v);
7532 /* TODO: don't use dynamic allocation */
7533 tmp = MSVCRT_operator_new(size*2);
7534 if(!tmp) {
7535 ERR("Out of memory\n");
7536 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7538 num_put__fput(this, ret, dest, base, fill, tmp, sprintf(tmp, fmt, base->prec, v),
7539 numpunct_short_use_facet(base->loc));
7540 MSVCRT_operator_delete(tmp);
7541 return ret;
7544 /* ?put@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QBE?AV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@AAVios_base@2@_WN@Z */
7545 /* ?put@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEBA?AV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@AEAVios_base@2@_WN@Z */
7546 /* ?put@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QBE?AV?$ostreambuf_iterator@GU?$char_traits@G@std@@@2@V32@AAVios_base@2@GN@Z */
7547 /* ?put@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEBA?AV?$ostreambuf_iterator@GU?$char_traits@G@std@@@2@V32@AEAVios_base@2@GN@Z */
7548 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_double, 32)
7549 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_double(const num_put *this, ostreambuf_iterator_wchar *ret,
7550 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, double v)
7552 TRACE("(%p %p %p %d %lf)\n", this, ret, base, fill, v);
7553 return call_num_put_wchar_do_put_double(this, ret, dest, base, fill, v);
7556 /* ?put@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QBE?AV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@AAVios_base@2@_WO@Z */
7557 /* ?put@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEBA?AV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@AEAVios_base@2@_WO@Z */
7558 /* ?put@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QBE?AV?$ostreambuf_iterator@GU?$char_traits@G@std@@@2@V32@AAVios_base@2@GO@Z */
7559 /* ?put@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEBA?AV?$ostreambuf_iterator@GU?$char_traits@G@std@@@2@V32@AEAVios_base@2@GO@Z */
7560 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_ldouble, 32)
7561 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_ldouble(const num_put *this, ostreambuf_iterator_wchar *ret,
7562 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, double v)
7564 TRACE("(%p %p %p %d %lf)\n", this, ret, base, fill, v);
7565 return call_num_put_wchar_do_put_ldouble(this, ret, dest, base, fill, v);
7568 /* ?do_put@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MBE?AV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@AAVios_base@2@_WPBX@Z */
7569 /* ?do_put@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MEBA?AV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@AEAVios_base@2@_WPEBX@Z */
7570 #define call_num_put_wchar_do_put_ptr(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 4, ostreambuf_iterator_wchar*, \
7571 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, const void*), \
7572 (this, ret, dest, base, fill, v))
7573 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_ptr, 28)
7574 ostreambuf_iterator_wchar* __thiscall num_put_wchar_do_put_ptr(const num_put *this, ostreambuf_iterator_wchar *ret,
7575 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, const void *v)
7577 char tmp[17]; /* 8(16^8==2^64)*2(separators beetwen every digit) + 1 */
7579 TRACE("(%p %p %p %d %p)\n", this, ret, base, fill, v);
7581 return num_put_wchar__Iput(this, ret, dest, base, fill, tmp, sprintf(tmp, "%p", v));
7584 /* ?do_put@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MBE?AV?$ostreambuf_iterator@GU?$char_traits@G@std@@@2@V32@AAVios_base@2@GPBX@Z */
7585 /* ?do_put@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MEBA?AV?$ostreambuf_iterator@GU?$char_traits@G@std@@@2@V32@AEAVios_base@2@GPEBX@Z */
7586 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_ptr, 28)
7587 ostreambuf_iterator_wchar* __thiscall num_put_short_do_put_ptr(const num_put *this, ostreambuf_iterator_wchar *ret,
7588 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, const void *v)
7590 char tmp[17]; /* 8(16^8==2^64)*2(separators beetwen every digit) + 1 */
7592 TRACE("(%p %p %p %d %p)\n", this, ret, base, fill, v);
7594 return num_put_short__Iput(this, ret, dest, base, fill, tmp, sprintf(tmp, "%p", v));
7597 /* ?put@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QBE?AV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@AAVios_base@2@_WPBX@Z */
7598 /* ?put@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEBA?AV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@AEAVios_base@2@_WPEBX@Z */
7599 /* ?put@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QBE?AV?$ostreambuf_iterator@GU?$char_traits@G@std@@@2@V32@AAVios_base@2@GPBX@Z */
7600 /* ?put@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEBA?AV?$ostreambuf_iterator@GU?$char_traits@G@std@@@2@V32@AEAVios_base@2@GPEBX@Z */
7601 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_ptr, 28)
7602 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_ptr(const num_put *this, ostreambuf_iterator_wchar *ret,
7603 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, const void *v)
7605 TRACE("(%p %p %p %d %p)\n", this, ret, base, fill, v);
7606 return call_num_put_wchar_do_put_ptr(this, ret, dest, base, fill, v);
7609 /* ?do_put@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MBE?AV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@AAVios_base@2@_W_J@Z */
7610 /* ?do_put@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MEBA?AV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@AEAVios_base@2@_W_J@Z */
7611 #define call_num_put_wchar_do_put_int64(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 20, ostreambuf_iterator_wchar*, \
7612 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, __int64), \
7613 (this, ret, dest, base, fill, v))
7614 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_int64, 32)
7615 ostreambuf_iterator_wchar* __thiscall num_put_wchar_do_put_int64(const num_put *this, ostreambuf_iterator_wchar *ret,
7616 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, __int64 v)
7618 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
7619 char fmt[7]; /* strlen("%+#lld")+1 */
7621 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
7623 return num_put_wchar__Iput(this, ret, dest, base, fill, tmp,
7624 sprintf(tmp, num_put_wchar__Ifmt(this, fmt, "lld", base->fmtfl), v));
7627 /* ?do_put@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MBE?AV?$ostreambuf_iterator@GU?$char_traits@G@std@@@2@V32@AAVios_base@2@G_J@Z */
7628 /* ?do_put@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MEBA?AV?$ostreambuf_iterator@GU?$char_traits@G@std@@@2@V32@AEAVios_base@2@G_J@Z */
7629 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_int64, 32)
7630 ostreambuf_iterator_wchar* __thiscall num_put_short_do_put_int64(const num_put *this, ostreambuf_iterator_wchar *ret,
7631 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, __int64 v)
7633 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
7634 char fmt[7]; /* strlen("%+#lld")+1 */
7636 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
7638 return num_put_short__Iput(this, ret, dest, base, fill, tmp,
7639 sprintf(tmp, num_put_wchar__Ifmt(this, fmt, "lld", base->fmtfl), v));
7642 /* ?put@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QBE?AV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@AAVios_base@2@_W_J@Z */
7643 /* ?put@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEBA?AV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@AEAVios_base@2@_W_J@Z */
7644 /* ?put@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QBE?AV?$ostreambuf_iterator@GU?$char_traits@G@std@@@2@V32@AAVios_base@2@G_J@Z */
7645 /* ?put@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEBA?AV?$ostreambuf_iterator@GU?$char_traits@G@std@@@2@V32@AEAVios_base@2@G_J@Z */
7646 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_int64, 32)
7647 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_int64(const num_put *this, ostreambuf_iterator_wchar *ret,
7648 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, __int64 v)
7650 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
7651 return call_num_put_wchar_do_put_int64(this, ret, dest, base, fill, v);
7654 /* ?do_put@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MBE?AV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@AAVios_base@2@_W_K@Z */
7655 /* ?do_put@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MEBA?AV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@AEAVios_base@2@_W_K@Z */
7656 #define call_num_put_wchar_do_put_uint64(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 16, ostreambuf_iterator_wchar*, \
7657 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, unsigned __int64), \
7658 (this, ret, dest, base, fill, v))
7659 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_uint64, 32)
7660 ostreambuf_iterator_wchar* __thiscall num_put_wchar_do_put_uint64(const num_put *this, ostreambuf_iterator_wchar *ret,
7661 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, unsigned __int64 v)
7663 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
7664 char fmt[7]; /* strlen("%+#lld")+1 */
7666 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
7668 return num_put_wchar__Iput(this, ret, dest, base, fill, tmp,
7669 sprintf(tmp, num_put_wchar__Ifmt(this, fmt, "llu", base->fmtfl), v));
7672 /* ?do_put@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MBE?AV?$ostreambuf_iterator@GU?$char_traits@G@std@@@2@V32@AAVios_base@2@G_K@Z */
7673 /* ?do_put@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MEBA?AV?$ostreambuf_iterator@GU?$char_traits@G@std@@@2@V32@AEAVios_base@2@G_K@Z */
7674 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_uint64, 32)
7675 ostreambuf_iterator_wchar* __thiscall num_put_short_do_put_uint64(const num_put *this, ostreambuf_iterator_wchar *ret,
7676 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, unsigned __int64 v)
7678 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
7679 char fmt[7]; /* strlen("%+#lld")+1 */
7681 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
7683 return num_put_short__Iput(this, ret, dest, base, fill, tmp,
7684 sprintf(tmp, num_put_wchar__Ifmt(this, fmt, "llu", base->fmtfl), v));
7687 /* ?put@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QBE?AV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@AAVios_base@2@_W_K@Z */
7688 /* ?put@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEBA?AV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@AEAVios_base@2@_W_K@Z */
7689 /* ?put@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QBE?AV?$ostreambuf_iterator@GU?$char_traits@G@std@@@2@V32@AAVios_base@2@G_K@Z */
7690 /* ?put@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEBA?AV?$ostreambuf_iterator@GU?$char_traits@G@std@@@2@V32@AEAVios_base@2@G_K@Z */
7691 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_uint64, 32)
7692 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_uint64(const num_put *this, ostreambuf_iterator_wchar *ret,
7693 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, unsigned __int64 v)
7695 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
7696 return call_num_put_wchar_do_put_uint64(this, ret, dest, base, fill, v);
7699 /* ?do_put@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MBE?AV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@AAVios_base@2@_W_N@Z */
7700 /* ?do_put@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MEBA?AV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@AEAVios_base@2@_W_N@Z */
7701 #define call_num_put_wchar_do_put_bool(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 32, ostreambuf_iterator_wchar*, \
7702 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, MSVCP_bool), \
7703 (this, ret, dest, base, fill, v))
7704 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_bool, 28)
7705 ostreambuf_iterator_wchar* __thiscall num_put_wchar_do_put_bool(const num_put *this, ostreambuf_iterator_wchar *ret,
7706 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, MSVCP_bool v)
7708 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
7710 if(base->fmtfl & FMTFLAG_boolalpha) {
7711 numpunct_wchar *numpunct = numpunct_wchar_use_facet(base->loc);
7712 basic_string_wchar str;
7713 MSVCP_size_t pad, len;
7715 if(v)
7716 numpunct_wchar_truename(numpunct, &str);
7717 else
7718 numpunct_wchar_falsename(numpunct, &str);
7720 len = MSVCP_basic_string_wchar_length(&str);
7721 pad = (len>base->wide ? 0 : base->wide-len);
7722 base->wide = 0;
7724 if((base->fmtfl & FMTFLAG_adjustfield) != FMTFLAG_left) {
7725 num_put_wchar__Rep(this, &dest, dest, fill, pad);
7726 pad = 0;
7728 num_put_wchar__Put(this, &dest, dest, MSVCP_basic_string_wchar_c_str(&str), len);
7729 MSVCP_basic_string_wchar_dtor(&str);
7730 return num_put_wchar__Rep(this, ret, dest, fill, pad);
7733 return num_put_wchar_put_long(this, ret, dest, base, fill, v);
7736 /* ?do_put@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MBE?AV?$ostreambuf_iterator@GU?$char_traits@G@std@@@2@V32@AAVios_base@2@G_N@Z */
7737 /* ?do_put@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MEBA?AV?$ostreambuf_iterator@GU?$char_traits@G@std@@@2@V32@AEAVios_base@2@G_N@Z */
7738 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_bool, 28)
7739 ostreambuf_iterator_wchar* __thiscall num_put_short_do_put_bool(const num_put *this, ostreambuf_iterator_wchar *ret,
7740 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, MSVCP_bool v)
7742 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
7744 if(base->fmtfl & FMTFLAG_boolalpha) {
7745 numpunct_wchar *numpunct = numpunct_short_use_facet(base->loc);
7746 basic_string_wchar str;
7747 MSVCP_size_t pad, len;
7749 if(v)
7750 numpunct_wchar_truename(numpunct, &str);
7751 else
7752 numpunct_wchar_falsename(numpunct, &str);
7754 len = MSVCP_basic_string_wchar_length(&str);
7755 pad = (len>base->wide ? 0 : base->wide-len);
7756 base->wide = 0;
7758 if((base->fmtfl & FMTFLAG_adjustfield) != FMTFLAG_left) {
7759 num_put_wchar__Rep(this, &dest, dest, fill, pad);
7760 pad = 0;
7762 num_put_wchar__Put(this, &dest, dest, MSVCP_basic_string_wchar_c_str(&str), len);
7763 MSVCP_basic_string_wchar_dtor(&str);
7764 return num_put_wchar__Rep(this, ret, dest, fill, pad);
7767 return num_put_wchar_put_long(this, ret, dest, base, fill, v);
7770 /* ?put@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QBE?AV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@AAVios_base@2@_W_N@Z */
7771 /* ?put@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEBA?AV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@AEAVios_base@2@_W_N@Z */
7772 /* ?put@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QBE?AV?$ostreambuf_iterator@GU?$char_traits@G@std@@@2@V32@AAVios_base@2@G_N@Z */
7773 /* ?put@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEBA?AV?$ostreambuf_iterator@GU?$char_traits@G@std@@@2@V32@AEAVios_base@2@G_N@Z */
7774 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_bool, 28)
7775 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_bool(const num_put *this, ostreambuf_iterator_wchar *ret,
7776 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, MSVCP_bool v)
7778 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
7779 return call_num_put_wchar_do_put_bool(this, ret, dest, base, fill, v);
7782 /* ??0_Locimp@locale@std@@AAE@_N@Z */
7783 /* ??0_Locimp@locale@std@@AEAA@_N@Z */
7784 DEFINE_THISCALL_WRAPPER(locale__Locimp_ctor_transparent, 8)
7785 locale__Locimp* __thiscall locale__Locimp_ctor_transparent(locale__Locimp *this, MSVCP_bool transparent)
7787 TRACE("(%p %d)\n", this, transparent);
7789 memset(this, 0, sizeof(locale__Locimp));
7790 locale_facet_ctor_refs(&this->facet, 1);
7791 this->transparent = transparent;
7792 MSVCP_basic_string_char_ctor_cstr(&this->name, "*");
7793 return this;
7796 /* ??_F_Locimp@locale@std@@QAEXXZ */
7797 /* ??_F_Locimp@locale@std@@QEAAXXZ */
7798 DEFINE_THISCALL_WRAPPER(locale__Locimp_ctor, 4)
7799 locale__Locimp* __thiscall locale__Locimp_ctor(locale__Locimp *this)
7801 return locale__Locimp_ctor_transparent(this, FALSE);
7804 /* ??0_Locimp@locale@std@@AAE@ABV012@@Z */
7805 /* ??0_Locimp@locale@std@@AEAA@AEBV012@@Z */
7806 DEFINE_THISCALL_WRAPPER(locale__Locimp_copy_ctor, 8)
7807 locale__Locimp* __thiscall locale__Locimp_copy_ctor(locale__Locimp *this, const locale__Locimp *copy)
7809 _Lockit lock;
7810 MSVCP_size_t i;
7812 TRACE("(%p %p)\n", this, copy);
7814 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
7815 memcpy(this, copy, sizeof(locale__Locimp));
7816 locale_facet_ctor_refs(&this->facet, 1);
7817 if(copy->facetvec) {
7818 this->facetvec = MSVCRT_operator_new(copy->facet_cnt*sizeof(locale_facet*));
7819 if(!this->facetvec) {
7820 _Lockit_dtor(&lock);
7821 ERR("Out of memory\n");
7822 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7823 return NULL;
7825 for(i=0; i<this->facet_cnt; i++)
7827 this->facetvec[i] = copy->facetvec[i];
7828 if(this->facetvec[i])
7829 locale_facet__Incref(this->facetvec[i]);
7832 MSVCP_basic_string_char_copy_ctor(&this->name, &copy->name);
7833 _Lockit_dtor(&lock);
7834 return this;
7837 /* ?_Locimp_ctor@_Locimp@locale@std@@CAXPAV123@ABV123@@Z */
7838 /* ?_Locimp_ctor@_Locimp@locale@std@@CAXPEAV123@AEBV123@@Z */
7839 locale__Locimp* __cdecl locale__Locimp__Locimp_ctor(locale__Locimp *this, const locale__Locimp *copy)
7841 return locale__Locimp_copy_ctor(this, copy);
7844 /* ??1_Locimp@locale@std@@MAE@XZ */
7845 /* ??1_Locimp@locale@std@@MEAA@XZ */
7846 DEFINE_THISCALL_WRAPPER(locale__Locimp_dtor, 4)
7847 void __thiscall locale__Locimp_dtor(locale__Locimp *this)
7849 MSVCP_size_t i;
7851 TRACE("(%p)\n", this);
7853 locale_facet_dtor(&this->facet);
7854 for(i=0; i<this->facet_cnt; i++)
7855 if(this->facetvec[i] && locale_facet__Decref(this->facetvec[i]))
7856 call_locale_facet_vector_dtor(this->facetvec[i], 1);
7858 MSVCRT_operator_delete(this->facetvec);
7859 MSVCP_basic_string_char_dtor(&this->name);
7862 /* ?_Locimp_dtor@_Locimp@locale@std@@CAXPAV123@@Z */
7863 /* ?_Locimp_dtor@_Locimp@locale@std@@CAXPEAV123@@Z */
7864 void __cdecl locale__Locimp__Locimp_dtor(locale__Locimp *this)
7866 locale__Locimp_dtor(this);
7869 DEFINE_THISCALL_WRAPPER(locale__Locimp_vector_dtor, 8)
7870 locale__Locimp* __thiscall locale__Locimp_vector_dtor(locale__Locimp *this, unsigned int flags)
7872 TRACE("(%p %x)\n", this, flags);
7873 if(flags & 2) {
7874 /* we have an array, with the number of elements stored before the first object */
7875 INT_PTR i, *ptr = (INT_PTR *)this-1;
7877 for(i=*ptr-1; i>=0; i--)
7878 locale__Locimp_dtor(this+i);
7879 MSVCRT_operator_delete(ptr);
7880 } else {
7881 locale__Locimp_dtor(this);
7882 if(flags & 1)
7883 MSVCRT_operator_delete(this);
7886 return this;
7889 /* ?_Locimp_Addfac@_Locimp@locale@std@@CAXPAV123@PAVfacet@23@I@Z */
7890 /* ?_Locimp_Addfac@_Locimp@locale@std@@CAXPEAV123@PEAVfacet@23@_K@Z */
7891 void __cdecl locale__Locimp__Locimp_Addfac(locale__Locimp *locimp, locale_facet *facet, MSVCP_size_t id)
7893 _Lockit lock;
7895 TRACE("(%p %p %lu)\n", locimp, facet, id);
7897 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
7898 if(id >= locimp->facet_cnt) {
7899 MSVCP_size_t new_size = id+1;
7900 locale_facet **new_facetvec;
7902 if(new_size < locale_id__Id_cnt+1)
7903 new_size = locale_id__Id_cnt+1;
7905 new_facetvec = MSVCRT_operator_new(sizeof(locale_facet*)*new_size);
7906 if(!new_facetvec) {
7907 _Lockit_dtor(&lock);
7908 ERR("Out of memory\n");
7909 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7910 return;
7913 memset(new_facetvec, 0, sizeof(locale_facet*)*new_size);
7914 memcpy(new_facetvec, locimp->facetvec, sizeof(locale_facet*)*locimp->facet_cnt);
7915 MSVCRT_operator_delete(locimp->facetvec);
7916 locimp->facetvec = new_facetvec;
7917 locimp->facet_cnt = new_size;
7920 if(locimp->facetvec[id] && locale_facet__Decref(locimp->facetvec[id]))
7921 call_locale_facet_vector_dtor(locimp->facetvec[id], 1);
7923 locimp->facetvec[id] = facet;
7924 if(facet)
7925 locale_facet__Incref(facet);
7926 _Lockit_dtor(&lock);
7929 /* ?_Addfac@_Locimp@locale@std@@AAEXPAVfacet@23@I@Z */
7930 /* ?_Addfac@_Locimp@locale@std@@AEAAXPEAVfacet@23@_K@Z */
7931 DEFINE_THISCALL_WRAPPER(locale__Locimp__Addfac, 12)
7932 void __thiscall locale__Locimp__Addfac(locale__Locimp *this, locale_facet *facet, MSVCP_size_t id)
7934 locale__Locimp__Locimp_Addfac(this, facet, id);
7937 /* ?_Clocptr_func@_Locimp@locale@std@@CAAAPAV123@XZ */
7938 /* ?_Clocptr_func@_Locimp@locale@std@@CAAEAPEAV123@XZ */
7939 locale__Locimp** __cdecl locale__Locimp__Clocptr_func(void)
7941 FIXME("stub\n");
7942 return NULL;
7945 /* ?_Makeushloc@_Locimp@locale@std@@CAXABV_Locinfo@3@HPAV123@PBV23@@Z */
7946 /* ?_Makeushloc@_Locimp@locale@std@@CAXAEBV_Locinfo@3@HPEAV123@PEBV23@@Z */
7947 /* List of missing facets:
7948 * num_put, collate, messages, money_get, money_put, moneypunct, moneypunct, time_get, time_put
7950 void __cdecl locale__Locimp__Makeushloc(const _Locinfo *locinfo, category cat, locale__Locimp *locimp, const locale *loc)
7952 FIXME("(%p %d %p %p) semi-stub\n", locinfo, cat, locimp, loc);
7954 if(cat & (1<<(ctype_short__Getcat(NULL, NULL)-1))) {
7955 ctype_wchar *ctype;
7957 if(loc) {
7958 ctype = ctype_short_use_facet(loc);
7959 }else {
7960 ctype = MSVCRT_operator_new(sizeof(ctype_wchar));
7961 if(!ctype) {
7962 ERR("Out of memory\n");
7963 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7965 ctype_short_ctor_locinfo(ctype, locinfo, 0);
7967 locale__Locimp__Addfac(locimp, &ctype->base.facet, locale_id_operator_size_t(&ctype_short_id));
7970 if(cat & (1<<(num_get_short__Getcat(NULL, NULL)-1))) {
7971 num_get *numget;
7973 if(loc) {
7974 numget = num_get_short_use_facet(loc);
7975 }else {
7976 numget = MSVCRT_operator_new(sizeof(num_get));
7977 if(!numget) {
7978 ERR("Out of memory\n");
7979 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7981 num_get_short_ctor_locinfo(numget, locinfo, 0);
7983 locale__Locimp__Addfac(locimp, &numget->facet, locale_id_operator_size_t(&num_get_short_id));
7986 if(cat & (1<<(num_put_short__Getcat(NULL, NULL)-1))) {
7987 num_put *numput;
7989 if(loc) {
7990 numput = num_put_short_use_facet(loc);
7991 }else {
7992 numput = MSVCRT_operator_new(sizeof(num_put));
7993 if(!numput) {
7994 ERR("Out of memory\n");
7995 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7997 num_put_short_ctor_locinfo(numput, locinfo, 0);
7999 locale__Locimp__Addfac(locimp, &numput->facet, locale_id_operator_size_t(&num_put_short_id));
8002 if(cat & (1<<(numpunct_short__Getcat(NULL, NULL)-1))) {
8003 numpunct_wchar *numpunct;
8005 if(loc) {
8006 numpunct = numpunct_short_use_facet(loc);
8007 }else {
8008 numpunct = MSVCRT_operator_new(sizeof(numpunct_wchar));
8009 if(!numpunct) {
8010 ERR("Out of memory\n");
8011 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8013 numpunct_short_ctor_locinfo(numpunct, locinfo, 0, FALSE);
8015 locale__Locimp__Addfac(locimp, &numpunct->facet, locale_id_operator_size_t(&numpunct_short_id));
8018 if(cat & (1<<(codecvt_short__Getcat(NULL, NULL)-1))) {
8019 codecvt_wchar *codecvt;
8021 if(loc) {
8022 codecvt = codecvt_short_use_facet(loc);
8023 }else {
8024 codecvt = MSVCRT_operator_new(sizeof(codecvt_wchar));
8025 if(!codecvt) {
8026 ERR("Out of memory\n");
8027 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8029 codecvt_short_ctor_locinfo(codecvt, locinfo, 0);
8031 locale__Locimp__Addfac(locimp, &codecvt->base.facet, locale_id_operator_size_t(&codecvt_short_id));
8035 /* ?_Makewloc@_Locimp@locale@std@@CAXABV_Locinfo@3@HPAV123@PBV23@@Z */
8036 /* ?_Makewloc@_Locimp@locale@std@@CAXAEBV_Locinfo@3@HPEAV123@PEBV23@@Z */
8037 /* List of missing facets:
8038 * collate, messages, money_get, money_put, moneypunct, moneypunct, time_get, time_put
8040 void __cdecl locale__Locimp__Makewloc(const _Locinfo *locinfo, category cat, locale__Locimp *locimp, const locale *loc)
8042 FIXME("(%p %d %p %p) semi-stub\n", locinfo, cat, locimp, loc);
8044 if(cat & (1<<(ctype_wchar__Getcat(NULL, NULL)-1))) {
8045 ctype_wchar *ctype;
8047 if(loc) {
8048 ctype = ctype_wchar_use_facet(loc);
8049 }else {
8050 ctype = MSVCRT_operator_new(sizeof(ctype_wchar));
8051 if(!ctype) {
8052 ERR("Out of memory\n");
8053 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8055 ctype_wchar_ctor_locinfo(ctype, locinfo, 0);
8057 locale__Locimp__Addfac(locimp, &ctype->base.facet, locale_id_operator_size_t(&ctype_wchar_id));
8060 if(cat & (1<<(num_get_wchar__Getcat(NULL, NULL)-1))) {
8061 num_get *numget;
8063 if(loc) {
8064 numget = num_get_wchar_use_facet(loc);
8065 }else {
8066 numget = MSVCRT_operator_new(sizeof(num_get));
8067 if(!numget) {
8068 ERR("Out of memory\n");
8069 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8071 num_get_wchar_ctor_locinfo(numget, locinfo, 0);
8073 locale__Locimp__Addfac(locimp, &numget->facet, locale_id_operator_size_t(&num_get_wchar_id));
8076 if(cat & (1<<(num_put_wchar__Getcat(NULL, NULL)-1))) {
8077 num_put *numput;
8079 if(loc) {
8080 numput = num_put_wchar_use_facet(loc);
8081 }else {
8082 numput = MSVCRT_operator_new(sizeof(num_put));
8083 if(!numput) {
8084 ERR("Out of memory\n");
8085 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8087 num_put_wchar_ctor_locinfo(numput, locinfo, 0);
8089 locale__Locimp__Addfac(locimp, &numput->facet, locale_id_operator_size_t(&num_put_wchar_id));
8092 if(cat & (1<<(numpunct_wchar__Getcat(NULL, NULL)-1))) {
8093 numpunct_wchar *numpunct;
8095 if(loc) {
8096 numpunct = numpunct_wchar_use_facet(loc);
8097 }else {
8098 numpunct = MSVCRT_operator_new(sizeof(numpunct_wchar));
8099 if(!numpunct) {
8100 ERR("Out of memory\n");
8101 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8103 numpunct_wchar_ctor_locinfo(numpunct, locinfo, 0, FALSE);
8105 locale__Locimp__Addfac(locimp, &numpunct->facet, locale_id_operator_size_t(&numpunct_wchar_id));
8108 if(cat & (1<<(codecvt_wchar__Getcat(NULL, NULL)-1))) {
8109 codecvt_wchar *codecvt;
8111 if(loc) {
8112 codecvt = codecvt_wchar_use_facet(loc);
8113 }else {
8114 codecvt = MSVCRT_operator_new(sizeof(codecvt_wchar));
8115 if(!codecvt) {
8116 ERR("Out of memory\n");
8117 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8119 codecvt_wchar_ctor_locinfo(codecvt, locinfo, 0);
8121 locale__Locimp__Addfac(locimp, &codecvt->base.facet, locale_id_operator_size_t(&codecvt_wchar_id));
8125 /* ?_Makexloc@_Locimp@locale@std@@CAXABV_Locinfo@3@HPAV123@PBV23@@Z */
8126 /* ?_Makexloc@_Locimp@locale@std@@CAXAEBV_Locinfo@3@HPEAV123@PEBV23@@Z */
8127 /* List of missing facets:
8128 * collate, messages, money_get, money_put, moneypunct, moneypunct, time_get, time_put
8130 void __cdecl locale__Locimp__Makexloc(const _Locinfo *locinfo, category cat, locale__Locimp *locimp, const locale *loc)
8132 FIXME("(%p %d %p %p) semi-stub\n", locinfo, cat, locimp, loc);
8134 if(cat & (1<<(ctype_char__Getcat(NULL, NULL)-1))) {
8135 ctype_char *ctype;
8137 if(loc) {
8138 ctype = ctype_char_use_facet(loc);
8139 }else {
8140 ctype = MSVCRT_operator_new(sizeof(ctype_char));
8141 if(!ctype) {
8142 ERR("Out of memory\n");
8143 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8145 ctype_char_ctor_locinfo(ctype, locinfo, 0);
8147 locale__Locimp__Addfac(locimp, &ctype->base.facet, locale_id_operator_size_t(&ctype_char_id));
8150 if(cat & (1<<(num_get_char__Getcat(NULL, NULL)-1))) {
8151 num_get *numget;
8153 if(loc) {
8154 numget = num_get_char_use_facet(loc);
8155 }else {
8156 numget = MSVCRT_operator_new(sizeof(num_get));
8157 if(!numget) {
8158 ERR("Out of memory\n");
8159 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8161 num_get_char_ctor_locinfo(numget, locinfo, 0);
8163 locale__Locimp__Addfac(locimp, &numget->facet, locale_id_operator_size_t(&num_get_char_id));
8166 if(cat & (1<<(num_put_char__Getcat(NULL, NULL)-1))) {
8167 num_put *numput;
8169 if(loc) {
8170 numput = num_put_char_use_facet(loc);
8171 }else {
8172 numput = MSVCRT_operator_new(sizeof(num_put));
8173 if(!numput) {
8174 ERR("Out of memory\n");
8175 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8177 num_put_char_ctor_locinfo(numput, locinfo, 0);
8179 locale__Locimp__Addfac(locimp, &numput->facet, locale_id_operator_size_t(&num_put_char_id));
8182 if(cat & (1<<(numpunct_char__Getcat(NULL, NULL)-1))) {
8183 numpunct_char *numpunct;
8185 if(loc) {
8186 numpunct = numpunct_char_use_facet(loc);
8187 }else {
8188 numpunct = MSVCRT_operator_new(sizeof(numpunct_char));
8189 if(!numpunct) {
8190 ERR("Out of memory\n");
8191 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8193 numpunct_char_ctor_locinfo(numpunct, locinfo, 0, FALSE);
8195 locale__Locimp__Addfac(locimp, &numpunct->facet, locale_id_operator_size_t(&numpunct_char_id));
8198 if(cat & (1<<(codecvt_char__Getcat(NULL, NULL)-1))) {
8199 codecvt_char *codecvt;
8201 if(loc) {
8202 codecvt = codecvt_char_use_facet(loc);
8203 }else {
8204 codecvt = MSVCRT_operator_new(sizeof(codecvt_char));
8205 if(!codecvt) {
8206 ERR("Out of memory\n");
8207 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8209 codecvt_char_ctor_locinfo(codecvt, locinfo, 0);
8211 locale__Locimp__Addfac(locimp, &codecvt->base.facet, locale_id_operator_size_t(&codecvt_char_id));
8215 /* ?_Makeloc@_Locimp@locale@std@@CAPAV123@ABV_Locinfo@3@HPAV123@PBV23@@Z */
8216 /* ?_Makeloc@_Locimp@locale@std@@CAPEAV123@AEBV_Locinfo@3@HPEAV123@PEBV23@@Z */
8217 locale__Locimp* __cdecl locale__Locimp__Makeloc(const _Locinfo *locinfo, category cat, locale__Locimp *locimp, const locale *loc)
8219 TRACE("(%p %d %p %p)\n", locinfo, cat, locimp, loc);
8221 locale__Locimp__Makexloc(locinfo, cat, locimp, loc);
8222 locale__Locimp__Makewloc(locinfo, cat, locimp, loc);
8223 locale__Locimp__Makeushloc(locinfo, cat, locimp, loc);
8225 locimp->catmask |= cat;
8226 MSVCP_basic_string_char_copy_ctor(&locimp->name, &locinfo->newlocname);
8227 return locimp;
8230 /* ??_7_Locimp@locale@std@@6B@ */
8231 const vtable_ptr MSVCP_locale__Locimp_vtable[] = {
8232 (vtable_ptr)THISCALL_NAME(locale__Locimp_vector_dtor)
8235 /* ??0locale@std@@AAE@PAV_Locimp@01@@Z */
8236 /* ??0locale@std@@AEAA@PEAV_Locimp@01@@Z */
8237 DEFINE_THISCALL_WRAPPER(locale_ctor_locimp, 8)
8238 locale* __thiscall locale_ctor_locimp(locale *this, locale__Locimp *locimp)
8240 TRACE("(%p %p)\n", this, locimp);
8241 /* Don't change locimp reference counter */
8242 this->ptr = locimp;
8243 return this;
8246 /* ?_Init@locale@std@@CAPAV_Locimp@12@XZ */
8247 /* ?_Init@locale@std@@CAPEAV_Locimp@12@XZ */
8248 locale__Locimp* __cdecl locale__Init(void)
8250 _Lockit lock;
8252 TRACE("\n");
8254 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
8255 if(global_locale) {
8256 _Lockit_dtor(&lock);
8257 return global_locale;
8260 global_locale = MSVCRT_operator_new(sizeof(locale__Locimp));
8261 if(!global_locale) {
8262 _Lockit_dtor(&lock);
8263 ERR("Out of memory\n");
8264 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8265 return NULL;
8268 locale__Locimp_ctor(global_locale);
8269 global_locale->catmask = (1<<(LC_MAX+1))-1;
8270 MSVCP_basic_string_char_dtor(&global_locale->name);
8271 MSVCP_basic_string_char_ctor_cstr(&global_locale->name, "C");
8273 locale__Locimp__Clocptr = global_locale;
8274 global_locale->facet.refs++;
8275 locale_ctor_locimp(&classic_locale, locale__Locimp__Clocptr);
8276 _Lockit_dtor(&lock);
8278 return global_locale;
8281 /* ??0locale@std@@QAE@ABV01@0H@Z */
8282 /* ??0locale@std@@QEAA@AEBV01@0H@Z */
8283 DEFINE_THISCALL_WRAPPER(locale_ctor_locale_locale, 16)
8284 locale* __thiscall locale_ctor_locale_locale(locale *this, const locale *loc, const locale *other, category cat)
8286 _Locinfo locinfo;
8288 TRACE("(%p %p %p %d)\n", this, loc, other, cat);
8290 this->ptr = MSVCRT_operator_new(sizeof(locale__Locimp));
8291 if(!this->ptr) {
8292 ERR("Out of memory\n");
8293 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8295 locale__Locimp_copy_ctor(this->ptr, loc->ptr);
8297 _Locinfo_ctor_cat_cstr(&locinfo, loc->ptr->catmask, MSVCP_basic_string_char_c_str(&loc->ptr->name));
8298 _Locinfo__Addcats(&locinfo, cat & other->ptr->catmask, MSVCP_basic_string_char_c_str(&other->ptr->name));
8299 locale__Locimp__Makeloc(&locinfo, cat, this->ptr, other);
8300 _Locinfo_dtor(&locinfo);
8302 return this;
8305 /* ??0locale@std@@QAE@ABV01@@Z */
8306 /* ??0locale@std@@QEAA@AEBV01@@Z */
8307 DEFINE_THISCALL_WRAPPER(locale_copy_ctor, 8)
8308 locale* __thiscall locale_copy_ctor(locale *this, const locale *copy)
8310 TRACE("(%p %p)\n", this, copy);
8311 this->ptr = copy->ptr;
8312 locale_facet__Incref(&this->ptr->facet);
8313 return this;
8316 /* ??0locale@std@@QAE@ABV01@PBDH@Z */
8317 /* ??0locale@std@@QEAA@AEBV01@PEBDH@Z */
8318 DEFINE_THISCALL_WRAPPER(locale_ctor_locale_cstr, 16)
8319 locale* __thiscall locale_ctor_locale_cstr(locale *this, const locale *loc, const char *locname, category cat)
8321 FIXME("(%p %p %s %d) stub\n", this, loc, locname, cat);
8322 return NULL;
8325 /* ??0locale@std@@QAE@PBDH@Z */
8326 /* ??0locale@std@@QEAA@PEBDH@Z */
8327 DEFINE_THISCALL_WRAPPER(locale_ctor_cstr, 12)
8328 locale* __thiscall locale_ctor_cstr(locale *this, const char *locname, category cat)
8330 _Locinfo locinfo;
8332 TRACE("(%p %s %d)\n", this, locname, cat);
8334 this->ptr = MSVCRT_operator_new(sizeof(locale__Locimp));
8335 if(!this->ptr) {
8336 ERR("Out of memory\n");
8337 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8339 locale__Locimp_ctor(this->ptr);
8341 locale__Init();
8343 _Locinfo_ctor_cat_cstr(&locinfo, cat, locname);
8344 if(!memcmp(MSVCP_basic_string_char_c_str(&locinfo.newlocname), "*", 2)) {
8345 _Locinfo_dtor(&locinfo);
8346 MSVCRT_operator_delete(this->ptr);
8347 throw_exception(EXCEPTION_RUNTIME_ERROR, "bad locale name");
8350 locale__Locimp__Makeloc(&locinfo, cat, this->ptr, NULL);
8351 _Locinfo_dtor(&locinfo);
8353 return this;
8356 /* ??0locale@std@@QAE@W4_Uninitialized@1@@Z */
8357 /* ??0locale@std@@QEAA@W4_Uninitialized@1@@Z */
8358 DEFINE_THISCALL_WRAPPER(locale_ctor_uninitialized, 8)
8359 locale* __thiscall locale_ctor_uninitialized(locale *this, int uninitialized)
8361 TRACE("(%p)\n", this);
8362 this->ptr = NULL;
8363 return this;
8366 /* ??0locale@std@@QAE@XZ */
8367 /* ??0locale@std@@QEAA@XZ */
8368 DEFINE_THISCALL_WRAPPER(locale_ctor, 4)
8369 locale* __thiscall locale_ctor(locale *this)
8371 TRACE("(%p)\n", this);
8372 this->ptr = locale__Init();
8373 locale_facet__Incref(&this->ptr->facet);
8374 return this;
8377 /* ??1locale@std@@QAE@XZ */
8378 /* ??1locale@std@@QEAA@XZ */
8379 DEFINE_THISCALL_WRAPPER(locale_dtor, 4)
8380 void __thiscall locale_dtor(locale *this)
8382 TRACE("(%p)\n", this);
8383 if(this->ptr && locale_facet__Decref(&this->ptr->facet))
8385 locale__Locimp_dtor(this->ptr);
8386 MSVCRT_operator_delete(this->ptr);
8390 /* ??4locale@std@@QAEAAV01@ABV01@@Z */
8391 /* ??4locale@std@@QEAAAEAV01@AEBV01@@Z */
8392 DEFINE_THISCALL_WRAPPER(locale_operator_assign, 8)
8393 locale* __thiscall locale_operator_assign(locale *this, const locale *loc)
8395 FIXME("(%p %p) stub\n", this, loc);
8396 return NULL;
8399 /* ??8locale@std@@QBE_NABV01@@Z */
8400 /* ??8locale@std@@QEBA_NAEBV01@@Z */
8401 DEFINE_THISCALL_WRAPPER(locale_operator_equal, 8)
8402 MSVCP_bool __thiscall locale_operator_equal(const locale *this, const locale *loc)
8404 FIXME("(%p %p) stub\n", this, loc);
8405 return 0;
8408 /* ??9locale@std@@QBE_NABV01@@Z */
8409 /* ??9locale@std@@QEBA_NAEBV01@@Z */
8410 DEFINE_THISCALL_WRAPPER(locale_operator_not_equal, 8)
8411 MSVCP_bool __thiscall locale_operator_not_equal(const locale *this, locale const *loc)
8413 FIXME("(%p %p) stub\n", this, loc);
8414 return 0;
8417 /* ?_Addfac@locale@std@@QAEAAV12@PAVfacet@12@II@Z */
8418 /* ?_Addfac@locale@std@@QEAAAEAV12@PEAVfacet@12@_K1@Z */
8419 DEFINE_THISCALL_WRAPPER(locale__Addfac, 16)
8420 locale* __thiscall locale__Addfac(locale *this, locale_facet *facet, MSVCP_size_t id, MSVCP_size_t catmask)
8422 TRACE("(%p %p %lu %lu)\n", this, facet, id, catmask);
8424 if(this->ptr->facet.refs > 1) {
8425 locale__Locimp *new_ptr = MSVCRT_operator_new(sizeof(locale__Locimp));
8426 if(!new_ptr) {
8427 ERR("Out of memory\n");
8428 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8429 return NULL;
8431 locale__Locimp_copy_ctor(new_ptr, this->ptr);
8432 locale_facet__Decref(&this->ptr->facet);
8433 this->ptr = new_ptr;
8436 locale__Locimp__Addfac(this->ptr, facet, id);
8438 if(catmask) {
8439 MSVCP_basic_string_char_dtor(&this->ptr->name);
8440 MSVCP_basic_string_char_ctor_cstr(&this->ptr->name, "*");
8442 return this;
8445 /* ?_Getfacet@locale@std@@QBEPBVfacet@12@I@Z */
8446 /* ?_Getfacet@locale@std@@QEBAPEBVfacet@12@_K@Z */
8447 DEFINE_THISCALL_WRAPPER(locale__Getfacet, 8)
8448 const locale_facet* __thiscall locale__Getfacet(const locale *this, MSVCP_size_t id)
8450 locale_facet *fac;
8452 TRACE("(%p %lu)\n", this, id);
8454 fac = id < this->ptr->facet_cnt ? this->ptr->facetvec[id] : NULL;
8455 if(fac || !this->ptr->transparent)
8456 return fac;
8458 return id < global_locale->facet_cnt ? global_locale->facetvec[id] : NULL;
8461 /* ?_Getgloballocale@locale@std@@CAPAV_Locimp@12@XZ */
8462 /* ?_Getgloballocale@locale@std@@CAPEAV_Locimp@12@XZ */
8463 locale__Locimp* __cdecl locale__Getgloballocale(void)
8465 TRACE("\n");
8466 return global_locale;
8469 /* ?_Setgloballocale@locale@std@@CAXPAX@Z */
8470 /* ?_Setgloballocale@locale@std@@CAXPEAX@Z */
8471 void __cdecl locale__Setgloballocale(void *locimp)
8473 TRACE("(%p)\n", locimp);
8474 global_locale = locimp;
8477 /* ?classic@locale@std@@SAABV12@XZ */
8478 /* ?classic@locale@std@@SAAEBV12@XZ */
8479 const locale* __cdecl locale_classic(void)
8481 TRACE("\n");
8482 locale__Init();
8483 return &classic_locale;
8486 /* ?empty@locale@std@@SA?AV12@XZ */
8487 locale* __cdecl locale_empty(locale *ret)
8489 TRACE("\n");
8491 locale__Init();
8493 ret->ptr = MSVCRT_operator_new(sizeof(locale__Locimp));
8494 if(!ret->ptr) {
8495 ERR("Out of memory\n");
8496 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8498 locale__Locimp_ctor_transparent(ret->ptr, TRUE);
8499 return ret;
8502 /* ?name@locale@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
8503 /* ?name@locale@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
8504 DEFINE_THISCALL_WRAPPER(locale_name, 8)
8505 basic_string_char* __thiscall locale_name(const locale *this, basic_string_char *ret)
8507 TRACE( "(%p)\n", this);
8508 MSVCP_basic_string_char_copy_ctor(ret, &this->ptr->name);
8509 return ret;
8512 /* ?global@locale@std@@SA?AV12@ABV12@@Z */
8513 /* ?global@locale@std@@SA?AV12@AEBV12@@Z */
8514 locale* __cdecl locale_global(locale *ret, const locale *loc)
8516 _Lockit lock;
8517 int i;
8519 TRACE("(%p %p)\n", loc, ret);
8521 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
8522 locale_ctor(ret);
8524 if(loc->ptr != global_locale) {
8525 locale_facet__Decref(&global_locale->facet);
8526 global_locale = loc->ptr;
8527 locale_facet__Incref(&global_locale->facet);
8529 for(i=LC_ALL+1; i<=LC_MAX; i++) {
8530 if((global_locale->catmask & (1<<(i-1))) == 0)
8531 continue;
8532 setlocale(i, MSVCP_basic_string_char_c_str(&global_locale->name));
8535 _Lockit_dtor(&lock);
8536 return ret;
8539 DEFINE_RTTI_DATA0(locale_facet, 0, ".?AVfacet@locale@std@@");
8540 DEFINE_RTTI_DATA1(collate_char, 0, &locale_facet_rtti_base_descriptor, ".?AV?$collate@D@std@@");
8541 DEFINE_RTTI_DATA1(collate_wchar, 0, &locale_facet_rtti_base_descriptor, ".?AV?$collate@_W@std@@");
8542 DEFINE_RTTI_DATA1(collate_short, 0, &locale_facet_rtti_base_descriptor, ".?AV?$collate@G@std@@");
8543 DEFINE_RTTI_DATA1(ctype_base, 0, &locale_facet_rtti_base_descriptor, ".?AUctype_base@std@@");
8544 DEFINE_RTTI_DATA2(ctype_char, 0, &ctype_base_rtti_base_descriptor, &locale_facet_rtti_base_descriptor, ".?AV?$ctype@D@std@@");
8545 DEFINE_RTTI_DATA2(ctype_wchar, 0, &ctype_base_rtti_base_descriptor, &locale_facet_rtti_base_descriptor, ".?AV?$ctype@_W@std@@");
8546 DEFINE_RTTI_DATA2(ctype_short, 0, &ctype_base_rtti_base_descriptor, &locale_facet_rtti_base_descriptor, ".?AV?$ctype@G@std@@");
8547 DEFINE_RTTI_DATA1(codecvt_base, 0, &locale_facet_rtti_base_descriptor, ".?AVcodecvt_base@std@@");
8548 DEFINE_RTTI_DATA2(codecvt_char, 0, &codecvt_base_rtti_base_descriptor, &locale_facet_rtti_base_descriptor, ".?AV?$codecvt@DDH@std@@");
8549 DEFINE_RTTI_DATA2(codecvt_wchar, 0, &codecvt_base_rtti_base_descriptor, &locale_facet_rtti_base_descriptor, ".?AV?$codecvt@_WDH@std@@");
8550 DEFINE_RTTI_DATA2(codecvt_short, 0, &codecvt_base_rtti_base_descriptor, &locale_facet_rtti_base_descriptor, ".?AV?$codecvt@GDH@std@@");
8551 DEFINE_RTTI_DATA1(numpunct_char, 0, &locale_facet_rtti_base_descriptor, ".?AV?$numpunct@D@std@@");
8552 DEFINE_RTTI_DATA1(numpunct_wchar, 0, &locale_facet_rtti_base_descriptor, ".?AV?$numpunct@_W@std@@");
8553 DEFINE_RTTI_DATA1(numpunct_short, 0, &locale_facet_rtti_base_descriptor, ".?AV?$numpunct@G@std@@");
8554 DEFINE_RTTI_DATA1(num_get_char, 0, &locale_facet_rtti_base_descriptor, ".?AV?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@");
8555 DEFINE_RTTI_DATA1(num_get_wchar, 0, &locale_facet_rtti_base_descriptor, ".?AV?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@");
8556 DEFINE_RTTI_DATA1(num_get_short, 0, &locale_facet_rtti_base_descriptor, ".?AV?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@");
8557 DEFINE_RTTI_DATA1(num_put_char, 0, &locale_facet_rtti_base_descriptor, ".?AV?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@");
8558 DEFINE_RTTI_DATA1(num_put_wchar, 0, &locale_facet_rtti_base_descriptor, ".?AV?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@");
8559 DEFINE_RTTI_DATA1(num_put_short, 0, &locale_facet_rtti_base_descriptor, ".?AV?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@");
8561 #ifndef __GNUC__
8562 void __asm_dummy_vtables(void) {
8563 #endif
8564 __ASM_VTABLE(locale_facet,
8565 VTABLE_ADD_FUNC(locale_facet_vector_dtor));
8566 __ASM_VTABLE(collate_char,
8567 VTABLE_ADD_FUNC(collate_char_vector_dtor)
8568 VTABLE_ADD_FUNC(collate_char_do_compare)
8569 VTABLE_ADD_FUNC(collate_char_do_transform)
8570 VTABLE_ADD_FUNC(collate_char_do_hash));
8571 __ASM_VTABLE(collate_wchar,
8572 VTABLE_ADD_FUNC(collate_wchar_vector_dtor)
8573 VTABLE_ADD_FUNC(collate_wchar_do_compare)
8574 VTABLE_ADD_FUNC(collate_wchar_do_transform)
8575 VTABLE_ADD_FUNC(collate_wchar_do_hash));
8576 __ASM_VTABLE(collate_short,
8577 VTABLE_ADD_FUNC(collate_wchar_vector_dtor)
8578 VTABLE_ADD_FUNC(collate_wchar_do_compare)
8579 VTABLE_ADD_FUNC(collate_wchar_do_transform)
8580 VTABLE_ADD_FUNC(collate_wchar_do_hash));
8581 __ASM_VTABLE(ctype_base,
8582 VTABLE_ADD_FUNC(ctype_base_vector_dtor));
8583 __ASM_VTABLE(ctype_char,
8584 VTABLE_ADD_FUNC(ctype_char_vector_dtor)
8585 VTABLE_ADD_FUNC(ctype_char_do_tolower)
8586 VTABLE_ADD_FUNC(ctype_char_do_tolower_ch)
8587 VTABLE_ADD_FUNC(ctype_char_do_toupper)
8588 VTABLE_ADD_FUNC(ctype_char_do_toupper_ch)
8589 VTABLE_ADD_FUNC(ctype_char_do_widen)
8590 VTABLE_ADD_FUNC(ctype_char_do_widen_ch)
8591 VTABLE_ADD_FUNC(ctype_char__Do_widen_s)
8592 VTABLE_ADD_FUNC(ctype_char_do_narrow)
8593 VTABLE_ADD_FUNC(ctype_char_do_narrow_ch)
8594 VTABLE_ADD_FUNC(ctype_char__Do_narrow_s));
8595 __ASM_VTABLE(ctype_wchar,
8596 VTABLE_ADD_FUNC(ctype_wchar_vector_dtor)
8597 VTABLE_ADD_FUNC(ctype_wchar_do_is)
8598 VTABLE_ADD_FUNC(ctype_wchar_do_is_ch)
8599 VTABLE_ADD_FUNC(ctype_wchar_do_scan_is)
8600 VTABLE_ADD_FUNC(ctype_wchar_do_scan_not)
8601 VTABLE_ADD_FUNC(ctype_wchar_do_tolower)
8602 VTABLE_ADD_FUNC(ctype_wchar_do_tolower_ch)
8603 VTABLE_ADD_FUNC(ctype_wchar_do_toupper)
8604 VTABLE_ADD_FUNC(ctype_wchar_do_toupper_ch)
8605 VTABLE_ADD_FUNC(ctype_wchar_do_widen)
8606 VTABLE_ADD_FUNC(ctype_wchar_do_widen_ch)
8607 VTABLE_ADD_FUNC(ctype_wchar__Do_widen_s)
8608 VTABLE_ADD_FUNC(ctype_wchar_do_narrow)
8609 VTABLE_ADD_FUNC(ctype_wchar_do_narrow_ch)
8610 VTABLE_ADD_FUNC(ctype_wchar__Do_narrow_s));
8611 __ASM_VTABLE(ctype_short,
8612 VTABLE_ADD_FUNC(ctype_wchar_vector_dtor)
8613 VTABLE_ADD_FUNC(ctype_wchar_do_is)
8614 VTABLE_ADD_FUNC(ctype_wchar_do_is_ch)
8615 VTABLE_ADD_FUNC(ctype_wchar_do_scan_is)
8616 VTABLE_ADD_FUNC(ctype_wchar_do_scan_not)
8617 VTABLE_ADD_FUNC(ctype_wchar_do_tolower)
8618 VTABLE_ADD_FUNC(ctype_wchar_do_tolower_ch)
8619 VTABLE_ADD_FUNC(ctype_wchar_do_toupper)
8620 VTABLE_ADD_FUNC(ctype_wchar_do_toupper_ch)
8621 VTABLE_ADD_FUNC(ctype_wchar_do_widen)
8622 VTABLE_ADD_FUNC(ctype_wchar_do_widen_ch)
8623 VTABLE_ADD_FUNC(ctype_wchar__Do_widen_s)
8624 VTABLE_ADD_FUNC(ctype_wchar_do_narrow)
8625 VTABLE_ADD_FUNC(ctype_wchar_do_narrow_ch)
8626 VTABLE_ADD_FUNC(ctype_wchar__Do_narrow_s));
8627 __ASM_VTABLE(codecvt_base,
8628 VTABLE_ADD_FUNC(codecvt_base_vector_dtor)
8629 VTABLE_ADD_FUNC(codecvt_base_do_always_noconv)
8630 VTABLE_ADD_FUNC(codecvt_base_do_max_length)
8631 VTABLE_ADD_FUNC(codecvt_base_do_encoding));
8632 __ASM_VTABLE(codecvt_char,
8633 VTABLE_ADD_FUNC(codecvt_char_vector_dtor)
8634 VTABLE_ADD_FUNC(codecvt_base_do_always_noconv)
8635 VTABLE_ADD_FUNC(codecvt_base_do_max_length)
8636 VTABLE_ADD_FUNC(codecvt_base_do_encoding)
8637 VTABLE_ADD_FUNC(codecvt_char_do_in)
8638 VTABLE_ADD_FUNC(codecvt_char_do_out)
8639 VTABLE_ADD_FUNC(codecvt_char_do_unshift)
8640 VTABLE_ADD_FUNC(codecvt_char_do_length));
8641 __ASM_VTABLE(codecvt_wchar,
8642 VTABLE_ADD_FUNC(codecvt_wchar_vector_dtor)
8643 VTABLE_ADD_FUNC(codecvt_wchar_do_always_noconv)
8644 VTABLE_ADD_FUNC(codecvt_wchar_do_max_length)
8645 VTABLE_ADD_FUNC(codecvt_base_do_encoding)
8646 VTABLE_ADD_FUNC(codecvt_wchar_do_in)
8647 VTABLE_ADD_FUNC(codecvt_wchar_do_out)
8648 VTABLE_ADD_FUNC(codecvt_wchar_do_unshift)
8649 VTABLE_ADD_FUNC(codecvt_wchar_do_length));
8650 __ASM_VTABLE(codecvt_short,
8651 VTABLE_ADD_FUNC(codecvt_wchar_vector_dtor)
8652 VTABLE_ADD_FUNC(codecvt_wchar_do_always_noconv)
8653 VTABLE_ADD_FUNC(codecvt_wchar_do_max_length)
8654 VTABLE_ADD_FUNC(codecvt_base_do_encoding)
8655 VTABLE_ADD_FUNC(codecvt_wchar_do_in)
8656 VTABLE_ADD_FUNC(codecvt_wchar_do_out)
8657 VTABLE_ADD_FUNC(codecvt_wchar_do_unshift)
8658 VTABLE_ADD_FUNC(codecvt_wchar_do_length));
8659 __ASM_VTABLE(numpunct_char,
8660 VTABLE_ADD_FUNC(numpunct_char_vector_dtor)
8661 VTABLE_ADD_FUNC(numpunct_char_do_decimal_point)
8662 VTABLE_ADD_FUNC(numpunct_char_do_thousands_sep)
8663 VTABLE_ADD_FUNC(numpunct_char_do_grouping)
8664 VTABLE_ADD_FUNC(numpunct_char_do_falsename)
8665 VTABLE_ADD_FUNC(numpunct_char_do_truename));
8666 __ASM_VTABLE(numpunct_wchar,
8667 VTABLE_ADD_FUNC(numpunct_wchar_vector_dtor)
8668 VTABLE_ADD_FUNC(numpunct_wchar_do_decimal_point)
8669 VTABLE_ADD_FUNC(numpunct_wchar_do_thousands_sep)
8670 VTABLE_ADD_FUNC(numpunct_wchar_do_grouping)
8671 VTABLE_ADD_FUNC(numpunct_wchar_do_falsename)
8672 VTABLE_ADD_FUNC(numpunct_wchar_do_truename));
8673 __ASM_VTABLE(numpunct_short,
8674 VTABLE_ADD_FUNC(numpunct_wchar_vector_dtor)
8675 VTABLE_ADD_FUNC(numpunct_wchar_do_decimal_point)
8676 VTABLE_ADD_FUNC(numpunct_wchar_do_thousands_sep)
8677 VTABLE_ADD_FUNC(numpunct_wchar_do_grouping)
8678 VTABLE_ADD_FUNC(numpunct_wchar_do_falsename)
8679 VTABLE_ADD_FUNC(numpunct_wchar_do_truename));
8680 __ASM_VTABLE(num_get_char,
8681 VTABLE_ADD_FUNC(num_get_char_vector_dtor)
8682 VTABLE_ADD_FUNC(num_get_char_do_get_void)
8683 VTABLE_ADD_FUNC(num_get_char_do_get_double)
8684 VTABLE_ADD_FUNC(num_get_char_do_get_double)
8685 VTABLE_ADD_FUNC(num_get_char_do_get_float)
8686 VTABLE_ADD_FUNC(num_get_char_do_get_uint64)
8687 VTABLE_ADD_FUNC(num_get_char_do_get_int64)
8688 VTABLE_ADD_FUNC(num_get_char_do_get_ulong)
8689 VTABLE_ADD_FUNC(num_get_char_do_get_long)
8690 VTABLE_ADD_FUNC(num_get_char_do_get_uint)
8691 VTABLE_ADD_FUNC(num_get_char_do_get_ushort)
8692 VTABLE_ADD_FUNC(num_get_char_do_get_bool));
8693 __ASM_VTABLE(num_get_short,
8694 VTABLE_ADD_FUNC(num_get_wchar_vector_dtor)
8695 VTABLE_ADD_FUNC(num_get_short_do_get_void)
8696 VTABLE_ADD_FUNC(num_get_short_do_get_double)
8697 VTABLE_ADD_FUNC(num_get_short_do_get_double)
8698 VTABLE_ADD_FUNC(num_get_short_do_get_float)
8699 VTABLE_ADD_FUNC(num_get_short_do_get_uint64)
8700 VTABLE_ADD_FUNC(num_get_short_do_get_int64)
8701 VTABLE_ADD_FUNC(num_get_short_do_get_ulong)
8702 VTABLE_ADD_FUNC(num_get_short_do_get_long)
8703 VTABLE_ADD_FUNC(num_get_short_do_get_uint)
8704 VTABLE_ADD_FUNC(num_get_short_do_get_ushort)
8705 VTABLE_ADD_FUNC(num_get_short_do_get_bool));
8706 __ASM_VTABLE(num_get_wchar,
8707 VTABLE_ADD_FUNC(num_get_wchar_vector_dtor)
8708 VTABLE_ADD_FUNC(num_get_wchar_do_get_void)
8709 VTABLE_ADD_FUNC(num_get_wchar_do_get_double)
8710 VTABLE_ADD_FUNC(num_get_wchar_do_get_double)
8711 VTABLE_ADD_FUNC(num_get_wchar_do_get_float)
8712 VTABLE_ADD_FUNC(num_get_wchar_do_get_uint64)
8713 VTABLE_ADD_FUNC(num_get_wchar_do_get_int64)
8714 VTABLE_ADD_FUNC(num_get_wchar_do_get_ulong)
8715 VTABLE_ADD_FUNC(num_get_wchar_do_get_long)
8716 VTABLE_ADD_FUNC(num_get_wchar_do_get_uint)
8717 VTABLE_ADD_FUNC(num_get_wchar_do_get_ushort)
8718 VTABLE_ADD_FUNC(num_get_wchar_do_get_bool));
8719 __ASM_VTABLE(num_put_char,
8720 VTABLE_ADD_FUNC(num_put_char_vector_dtor)
8721 VTABLE_ADD_FUNC(num_put_char_do_put_ptr)
8722 VTABLE_ADD_FUNC(num_put_char_do_put_double)
8723 VTABLE_ADD_FUNC(num_put_char_do_put_double)
8724 VTABLE_ADD_FUNC(num_put_char_do_put_uint64)
8725 VTABLE_ADD_FUNC(num_put_char_do_put_int64)
8726 VTABLE_ADD_FUNC(num_put_char_do_put_ulong)
8727 VTABLE_ADD_FUNC(num_put_char_do_put_long)
8728 VTABLE_ADD_FUNC(num_put_char_do_put_bool));
8729 __ASM_VTABLE(num_put_wchar,
8730 VTABLE_ADD_FUNC(num_put_wchar_vector_dtor)
8731 VTABLE_ADD_FUNC(num_put_wchar_do_put_ptr)
8732 VTABLE_ADD_FUNC(num_put_wchar_do_put_double)
8733 VTABLE_ADD_FUNC(num_put_wchar_do_put_double)
8734 VTABLE_ADD_FUNC(num_put_wchar_do_put_uint64)
8735 VTABLE_ADD_FUNC(num_put_wchar_do_put_int64)
8736 VTABLE_ADD_FUNC(num_put_wchar_do_put_ulong)
8737 VTABLE_ADD_FUNC(num_put_wchar_do_put_long)
8738 VTABLE_ADD_FUNC(num_put_wchar_do_put_bool));
8739 __ASM_VTABLE(num_put_short,
8740 VTABLE_ADD_FUNC(num_put_wchar_vector_dtor)
8741 VTABLE_ADD_FUNC(num_put_short_do_put_ptr)
8742 VTABLE_ADD_FUNC(num_put_short_do_put_double)
8743 VTABLE_ADD_FUNC(num_put_short_do_put_double)
8744 VTABLE_ADD_FUNC(num_put_short_do_put_uint64)
8745 VTABLE_ADD_FUNC(num_put_short_do_put_int64)
8746 VTABLE_ADD_FUNC(num_put_short_do_put_ulong)
8747 VTABLE_ADD_FUNC(num_put_short_do_put_long)
8748 VTABLE_ADD_FUNC(num_put_short_do_put_bool));
8749 #ifndef __GNUC__
8751 #endif
8753 void init_locale(void *base)
8755 #ifdef __x86_64__
8756 init_locale_facet_rtti(base);
8757 init_collate_char_rtti(base);
8758 init_collate_wchar_rtti(base);
8759 init_collate_short_rtti(base);
8760 init_ctype_base_rtti(base);
8761 init_ctype_char_rtti(base);
8762 init_ctype_wchar_rtti(base);
8763 init_ctype_short_rtti(base);
8764 init_codecvt_base_rtti(base);
8765 init_codecvt_char_rtti(base);
8766 init_codecvt_wchar_rtti(base);
8767 init_codecvt_short_rtti(base);
8768 init_numpunct_char_rtti(base);
8769 init_numpunct_wchar_rtti(base);
8770 init_numpunct_short_rtti(base);
8771 init_num_get_char_rtti(base);
8772 init_num_get_wchar_rtti(base);
8773 init_num_get_short_rtti(base);
8774 init_num_put_char_rtti(base);
8775 init_num_put_wchar_rtti(base);
8776 init_num_put_short_rtti(base);
8777 #endif
8780 void free_locale(void)
8782 facets_elem *iter, *safe;
8784 if(global_locale) {
8785 locale__Locimp_dtor(global_locale);
8786 locale_dtor(&classic_locale);
8789 LIST_FOR_EACH_ENTRY_SAFE(iter, safe, &lazy_facets, facets_elem, entry) {
8790 list_remove(&iter->entry);
8791 if(locale_facet__Decref(iter->fac))
8792 call_locale_facet_vector_dtor(iter->fac, 1);
8793 MSVCRT_operator_delete(iter);