po: Fix a mistake in Dutch translation.
[wine.git] / dlls / msvcp60 / locale.c
blob7aa09c523bf88aa8af824b2a5a41a3892aa17aef
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 "msvcp.h"
24 #include "locale.h"
25 #include "errno.h"
26 #include "limits.h"
27 #include "math.h"
28 #include "stdio.h"
29 #include "wctype.h"
30 #include "time.h"
32 #include "wine/list.h"
34 #include "windef.h"
35 #include "winbase.h"
36 #include "winnls.h"
37 #include "wine/unicode.h"
38 #include "wine/debug.h"
39 WINE_DEFAULT_DEBUG_CHANNEL(msvcp);
41 char* __cdecl _Getdays(void);
42 char* __cdecl _Getmonths(void);
43 void* __cdecl _Gettnames(void);
44 unsigned int __cdecl ___lc_codepage_func(void);
45 LCID* __cdecl ___lc_handle_func(void);
46 const locale_facet* __thiscall locale__Getfacet(const locale*, MSVCP_size_t, MSVCP_bool);
47 MSVCP_size_t __cdecl _Strftime(char*, MSVCP_size_t, const char*,
48 const struct tm*, struct __lc_time_data*);
50 typedef int category;
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 typedef struct {
102 locale_facet facet;
103 _Timevec time;
104 _Cvtvec cvt;
105 } time_put;
107 /* ?_Id_cnt@id@locale@std@@0HA */
108 int locale_id__Id_cnt = 0;
110 static locale classic_locale;
112 /* ?_Global@_Locimp@locale@std@@0PAV123@A */
113 /* ?_Global@_Locimp@locale@std@@0PEAV123@EA */
114 locale__Locimp *global_locale = NULL;
116 /* ?_Clocptr@_Locimp@locale@std@@0PAV123@A */
117 /* ?_Clocptr@_Locimp@locale@std@@0PEAV123@EA */
118 locale__Locimp *locale__Locimp__Clocptr = NULL;
120 static char istreambuf_iterator_char_val(istreambuf_iterator_char *this)
122 if(this->strbuf && !this->got) {
123 int c = basic_streambuf_char_sgetc(this->strbuf);
124 if(c == EOF)
125 this->strbuf = NULL;
126 else
127 this->val = c;
130 this->got = TRUE;
131 return this->val;
134 static wchar_t istreambuf_iterator_wchar_val(istreambuf_iterator_wchar *this)
136 if(this->strbuf && !this->got) {
137 unsigned short c = basic_streambuf_wchar_sgetc(this->strbuf);
138 if(c == WEOF)
139 this->strbuf = NULL;
140 else
141 this->val = c;
144 this->got = TRUE;
145 return this->val;
148 static void istreambuf_iterator_char_inc(istreambuf_iterator_char *this)
150 if(!this->strbuf || basic_streambuf_char_sbumpc(this->strbuf)==EOF) {
151 this->strbuf = NULL;
152 this->got = TRUE;
153 }else {
154 this->got = FALSE;
155 istreambuf_iterator_char_val(this);
159 static void istreambuf_iterator_wchar_inc(istreambuf_iterator_wchar *this)
161 if(!this->strbuf || basic_streambuf_wchar_sbumpc(this->strbuf)==WEOF) {
162 this->strbuf = NULL;
163 this->got = TRUE;
164 }else {
165 this->got = FALSE;
166 istreambuf_iterator_wchar_val(this);
170 static void ostreambuf_iterator_char_put(ostreambuf_iterator_char *this, char ch)
172 if(this->failed || basic_streambuf_char_sputc(this->strbuf, ch)==EOF)
173 this->failed = TRUE;
176 static void ostreambuf_iterator_wchar_put(ostreambuf_iterator_wchar *this, wchar_t ch)
178 if(this->failed || basic_streambuf_wchar_sputc(this->strbuf, ch)==WEOF)
179 this->failed = TRUE;
182 /* ??1facet@locale@std@@UAE@XZ */
183 /* ??1facet@locale@std@@UEAA@XZ */
184 DEFINE_THISCALL_WRAPPER(locale_facet_dtor, 4)
185 void __thiscall locale_facet_dtor(locale_facet *this)
187 TRACE("(%p)\n", this);
190 DEFINE_THISCALL_WRAPPER(locale_facet_vector_dtor, 8)
191 #define call_locale_facet_vector_dtor(this, flags) CALL_VTBL_FUNC(this, 0, \
192 locale_facet*, (locale_facet*, unsigned int), (this, flags))
193 locale_facet* __thiscall locale_facet_vector_dtor(locale_facet *this, unsigned int flags)
195 TRACE("(%p %x)\n", this, flags);
196 if(flags & 2) {
197 /* we have an array, with the number of elements stored before the first object */
198 INT_PTR i, *ptr = (INT_PTR *)this-1;
200 for(i=*ptr-1; i>=0; i--)
201 locale_facet_dtor(this+i);
202 MSVCRT_operator_delete(ptr);
203 } else {
204 locale_facet_dtor(this);
205 if(flags & 1)
206 MSVCRT_operator_delete(this);
209 return this;
212 typedef struct
214 locale_facet *fac;
215 struct list entry;
216 } facets_elem;
217 static struct list lazy_facets = LIST_INIT(lazy_facets);
219 /* Not exported from msvcp90 */
220 /* ?facet_Register@facet@locale@std@@CAXPAV123@@Z */
221 /* ?facet_Register@facet@locale@std@@CAXPEAV123@@Z */
222 static void locale_facet_register(locale_facet *add)
224 facets_elem *head = MSVCRT_operator_new(sizeof(*head));
225 if(!head) {
226 ERR("Out of memory\n");
227 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
230 head->fac = add;
231 list_add_head(&lazy_facets, &head->entry);
234 /* Not exported from msvcp90 */
235 /* ??_7facet@locale@std@@6B@ */
236 extern const vtable_ptr MSVCP_locale_facet_vtable;
238 /* ??Bid@locale@std@@QAEIXZ */
239 /* ??Bid@locale@std@@QEAA_KXZ */
240 DEFINE_THISCALL_WRAPPER(locale_id_operator_size_t, 4)
241 MSVCP_size_t __thiscall locale_id_operator_size_t(locale_id *this)
243 _Lockit lock;
245 TRACE("(%p)\n", this);
247 if(!this->id) {
248 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
249 this->id = ++locale_id__Id_cnt;
250 _Lockit_dtor(&lock);
253 return this->id;
256 /* ??_Ffacet@locale@std@@QAEXXZ */
257 /* ??_Ffacet@locale@std@@QEAAXXZ */
258 DEFINE_THISCALL_WRAPPER(locale_facet_ctor, 4)
259 locale_facet* __thiscall locale_facet_ctor(locale_facet *this)
261 TRACE("(%p)\n", this);
262 this->vtable = &MSVCP_locale_facet_vtable;
263 this->refs = 0;
264 return this;
267 /* ??0facet@locale@std@@IAE@I@Z */
268 /* ??0facet@locale@std@@IEAA@_K@Z */
269 DEFINE_THISCALL_WRAPPER(locale_facet_ctor_refs, 8)
270 locale_facet* __thiscall locale_facet_ctor_refs(locale_facet *this, MSVCP_size_t refs)
272 TRACE("(%p %lu)\n", this, refs);
273 this->vtable = &MSVCP_locale_facet_vtable;
274 this->refs = refs;
275 return this;
278 /* ?_Incref@facet@locale@std@@QAEXXZ */
279 /* ?_Incref@facet@locale@std@@QEAAXXZ */
280 DEFINE_THISCALL_WRAPPER(locale_facet__Incref, 4)
281 void __thiscall locale_facet__Incref(locale_facet *this)
283 _Lockit lock;
285 TRACE("(%p)\n", this);
287 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
288 this->refs++;
289 _Lockit_dtor(&lock);
292 /* ?_Decref@facet@locale@std@@QAEPAV123@XZ */
293 /* ?_Decref@facet@locale@std@@QEAAPEAV123@XZ */
294 DEFINE_THISCALL_WRAPPER(locale_facet__Decref, 4)
295 locale_facet* __thiscall locale_facet__Decref(locale_facet *this)
297 _Lockit lock;
298 locale_facet *ret;
300 TRACE("(%p)\n", this);
302 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
303 if(this->refs)
304 this->refs--;
306 ret = this->refs ? NULL : this;
307 _Lockit_dtor(&lock);
309 return ret;
312 /* ??0_Timevec@std@@QAE@ABV01@@Z */
313 /* ??0_Timevec@std@@QEAA@AEBV01@@Z */
314 /* This copy constructor modifies copied object */
315 DEFINE_THISCALL_WRAPPER(_Timevec_copy_ctor, 8)
316 _Timevec* __thiscall _Timevec_copy_ctor(_Timevec *this, _Timevec *copy)
318 TRACE("(%p %p)\n", this, copy);
319 this->timeptr = copy->timeptr;
320 copy->timeptr = NULL;
321 return this;
324 /* ??0_Timevec@std@@QAE@PAX@Z */
325 /* ??0_Timevec@std@@QEAA@PEAX@Z */
326 DEFINE_THISCALL_WRAPPER(_Timevec_ctor_timeptr, 8)
327 _Timevec* __thiscall _Timevec_ctor_timeptr(_Timevec *this, void *timeptr)
329 TRACE("(%p %p)\n", this, timeptr);
330 this->timeptr = timeptr;
331 return this;
334 /* ??_F_Timevec@std@@QAEXXZ */
335 /* ??_F_Timevec@std@@QEAAXXZ */
336 DEFINE_THISCALL_WRAPPER(_Timevec_ctor, 4)
337 _Timevec* __thiscall _Timevec_ctor(_Timevec *this)
339 TRACE("(%p)\n", this);
340 this->timeptr = NULL;
341 return this;
344 /* ??1_Timevec@std@@QAE@XZ */
345 /* ??1_Timevec@std@@QEAA@XZ */
346 DEFINE_THISCALL_WRAPPER(_Timevec_dtor, 4)
347 void __thiscall _Timevec_dtor(_Timevec *this)
349 TRACE("(%p)\n", this);
350 free(this->timeptr);
353 /* ??4_Timevec@std@@QAEAAV01@ABV01@@Z */
354 /* ??4_Timevec@std@@QEAAAEAV01@AEBV01@@Z */
355 DEFINE_THISCALL_WRAPPER(_Timevec_op_assign, 8)
356 _Timevec* __thiscall _Timevec_op_assign(_Timevec *this, _Timevec *right)
358 TRACE("(%p %p)\n", this, right);
359 this->timeptr = right->timeptr;
360 right->timeptr = NULL;
361 return this;
364 /* ?_Getptr@_Timevec@std@@QBEPAXXZ */
365 /* ?_Getptr@_Timevec@std@@QEBAPEAXXZ */
366 DEFINE_THISCALL_WRAPPER(_Timevec__Getptr, 4)
367 void* __thiscall _Timevec__Getptr(_Timevec *this)
369 TRACE("(%p)\n", this);
370 return this->timeptr;
373 /* ?_Locinfo_ctor@_Locinfo@std@@SAXPAV12@HPBD@Z */
374 /* ?_Locinfo_ctor@_Locinfo@std@@SAXPEAV12@HPEBD@Z */
375 static _Locinfo* _Locinfo__Locinfo_ctor_cat_cstr(_Locinfo *locinfo, int category, const char *locstr)
377 const char *locale = NULL;
379 /* This function is probably modifying more global objects */
380 FIXME("(%p %d %s) semi-stub\n", locinfo, category, locstr);
382 if(!locstr)
383 throw_exception(EXCEPTION_RUNTIME_ERROR, "bad locale name");
385 _Lockit_ctor_locktype(&locinfo->lock, _LOCK_LOCALE);
386 basic_string_char_ctor_cstr(&locinfo->days, "");
387 basic_string_char_ctor_cstr(&locinfo->months, "");
388 basic_string_char_ctor_cstr(&locinfo->oldlocname, setlocale(LC_ALL, NULL));
390 if(category)
391 locale = setlocale(LC_ALL, locstr);
392 else
393 locale = setlocale(LC_ALL, NULL);
395 if(locale)
396 basic_string_char_ctor_cstr(&locinfo->newlocname, locale);
397 else
398 basic_string_char_ctor_cstr(&locinfo->newlocname, "*");
400 return locinfo;
403 /* ??0_Locinfo@std@@QAE@HPBD@Z */
404 /* ??0_Locinfo@std@@QEAA@HPEBD@Z */
405 DEFINE_THISCALL_WRAPPER(_Locinfo_ctor_cat_cstr, 12)
406 _Locinfo* __thiscall _Locinfo_ctor_cat_cstr(_Locinfo *this, int category, const char *locstr)
408 return _Locinfo__Locinfo_ctor_cat_cstr(this, category, locstr);
411 /* ??0_Locinfo@std@@QAE@PBD@Z */
412 /* ??0_Locinfo@std@@QEAA@PEBD@Z */
413 DEFINE_THISCALL_WRAPPER(_Locinfo_ctor_cstr, 8)
414 _Locinfo* __thiscall _Locinfo_ctor_cstr(_Locinfo *this, const char *locstr)
416 return _Locinfo__Locinfo_ctor_cat_cstr(this, 1/*FIXME*/, locstr);
419 /* ?_Locinfo_dtor@_Locinfo@std@@SAXPAV12@@Z */
420 /* ?_Locinfo_dtor@_Locinfo@std@@SAXPEAV12@@Z */
421 static void _Locinfo__Locinfo_dtor(_Locinfo *locinfo)
423 TRACE("(%p)\n", locinfo);
425 setlocale(LC_ALL, basic_string_char_c_str(&locinfo->oldlocname));
426 basic_string_char_dtor(&locinfo->days);
427 basic_string_char_dtor(&locinfo->months);
428 basic_string_char_dtor(&locinfo->oldlocname);
429 basic_string_char_dtor(&locinfo->newlocname);
430 _Lockit_dtor(&locinfo->lock);
433 /* ??_F_Locinfo@std@@QAEXXZ */
434 /* ??_F_Locinfo@std@@QEAAXXZ */
435 DEFINE_THISCALL_WRAPPER(_Locinfo_ctor, 4)
436 _Locinfo* __thiscall _Locinfo_ctor(_Locinfo *this)
438 return _Locinfo__Locinfo_ctor_cat_cstr(this, 1/*FIXME*/, "C");
441 /* ??1_Locinfo@std@@QAE@XZ */
442 /* ??1_Locinfo@std@@QEAA@XZ */
443 DEFINE_THISCALL_WRAPPER(_Locinfo_dtor, 4)
444 void __thiscall _Locinfo_dtor(_Locinfo *this)
446 _Locinfo__Locinfo_dtor(this);
449 /* ?_Locinfo_Addcats@_Locinfo@std@@SAAAV12@PAV12@HPBD@Z */
450 /* ?_Locinfo_Addcats@_Locinfo@std@@SAAEAV12@PEAV12@HPEBD@Z */
451 static _Locinfo* _Locinfo__Locinfo_Addcats(_Locinfo *locinfo, int category, const char *locstr)
453 const char *locale = NULL;
455 /* This function is probably modifying more global objects */
456 FIXME("(%p %d %s) semi-stub\n", locinfo, category, locstr);
457 if(!locstr)
458 throw_exception(EXCEPTION_RUNTIME_ERROR, "bad locale name");
460 basic_string_char_dtor(&locinfo->newlocname);
462 if(category)
463 locale = setlocale(LC_ALL, locstr);
464 else
465 locale = setlocale(LC_ALL, NULL);
467 if(locale)
468 basic_string_char_ctor_cstr(&locinfo->newlocname, locale);
469 else
470 basic_string_char_ctor_cstr(&locinfo->newlocname, "*");
472 return locinfo;
475 /* ?_Addcats@_Locinfo@std@@QAEAAV12@HPBD@Z */
476 /* ?_Addcats@_Locinfo@std@@QEAAAEAV12@HPEBD@Z */
477 DEFINE_THISCALL_WRAPPER(_Locinfo__Addcats, 12)
478 _Locinfo* __thiscall _Locinfo__Addcats(_Locinfo *this, int category, const char *locstr)
480 return _Locinfo__Locinfo_Addcats(this, category, locstr);
483 /* _Getcoll */
484 ULONGLONG __cdecl _Getcoll(void)
486 union {
487 _Collvec collvec;
488 ULONGLONG ull;
489 } ret;
490 _locale_t locale = _get_current_locale();
492 TRACE("\n");
494 ret.collvec.page = locale->locinfo->lc_collate_cp;
495 ret.collvec.handle = locale->locinfo->lc_handle[LC_COLLATE];
496 _free_locale(locale);
497 return ret.ull;
500 /* ?_Getcoll@_Locinfo@std@@QBE?AU_Collvec@@XZ */
501 /* ?_Getcoll@_Locinfo@std@@QEBA?AU_Collvec@@XZ */
502 DEFINE_THISCALL_WRAPPER(_Locinfo__Getcoll, 8)
503 _Collvec* __thiscall _Locinfo__Getcoll(const _Locinfo *this, _Collvec *ret)
505 ULONGLONG ull = _Getcoll();
506 memcpy(ret, &ull, sizeof(ull));
507 return ret;
510 /* _Getctype */
511 _Ctypevec* __cdecl _Getctype(_Ctypevec *ret)
513 _locale_t locale = _get_current_locale();
514 short *table;
516 TRACE("\n");
518 ret->page = locale->locinfo->lc_codepage;
519 ret->handle = locale->locinfo->lc_handle[LC_COLLATE];
520 ret->delfl = TRUE;
521 table = malloc(sizeof(short[256]));
522 if(!table) {
523 _free_locale(locale);
524 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
526 memcpy(table, locale->locinfo->pctype, sizeof(short[256]));
527 ret->table = table;
528 _free_locale(locale);
529 return ret;
532 /* ?_Getctype@_Locinfo@std@@QBE?AU_Ctypevec@@XZ */
533 /* ?_Getctype@_Locinfo@std@@QEBA?AU_Ctypevec@@XZ */
534 DEFINE_THISCALL_WRAPPER(_Locinfo__Getctype, 8)
535 _Ctypevec* __thiscall _Locinfo__Getctype(const _Locinfo *this, _Ctypevec *ret)
537 return _Getctype(ret);
540 /* _Getcvt */
541 ULONGLONG __cdecl _Getcvt(void)
543 _locale_t locale = _get_current_locale();
544 union {
545 _Cvtvec cvtvec;
546 ULONGLONG ull;
547 } ret;
549 TRACE("\n");
551 ret.cvtvec.page = locale->locinfo->lc_codepage;
552 ret.cvtvec.handle = locale->locinfo->lc_handle[LC_CTYPE];
553 _free_locale(locale);
554 return ret.ull;
557 /* ?_Getcvt@_Locinfo@std@@QBE?AU_Cvtvec@@XZ */
558 /* ?_Getcvt@_Locinfo@std@@QEBA?AU_Cvtvec@@XZ */
559 DEFINE_THISCALL_WRAPPER(_Locinfo__Getcvt, 8)
560 _Cvtvec* __thiscall _Locinfo__Getcvt(const _Locinfo *this, _Cvtvec *ret)
562 ULONGLONG ull = _Getcvt();
563 memcpy(ret, &ull, sizeof(ull));
564 return ret;
567 /* ?_Getdays@_Locinfo@std@@QBEPBDXZ */
568 /* ?_Getdays@_Locinfo@std@@QEBAPEBDXZ */
569 DEFINE_THISCALL_WRAPPER(_Locinfo__Getdays, 4)
570 const char* __thiscall _Locinfo__Getdays(_Locinfo *this)
572 char *days = _Getdays();
574 TRACE("(%p)\n", this);
576 if(days) {
577 basic_string_char_dtor(&this->days);
578 basic_string_char_ctor_cstr(&this->days, days);
579 free(days);
582 return this->days.size ? basic_string_char_c_str(&this->days) :
583 ":Sun:Sunday:Mon:Monday:Tue:Tuesday:Wed:Wednesday:Thu:Thursday:Fri:Friday:Sat:Saturday";
586 /* ?_Getmonths@_Locinfo@std@@QBEPBDXZ */
587 /* ?_Getmonths@_Locinfo@std@@QEBAPEBDXZ */
588 DEFINE_THISCALL_WRAPPER(_Locinfo__Getmonths, 4)
589 const char* __thiscall _Locinfo__Getmonths(_Locinfo *this)
591 char *months = _Getmonths();
593 TRACE("(%p)\n", this);
595 if(months) {
596 basic_string_char_dtor(&this->months);
597 basic_string_char_ctor_cstr(&this->months, months);
598 free(months);
601 return this->months.size ? basic_string_char_c_str(&this->months) :
602 ":Jan:January:Feb:February:Mar:March:Apr:April:May:May:Jun:June:Jul:July"
603 ":Aug:August:Sep:September:Oct:October:Nov:November:Dec:December";
606 /* ?_Getfalse@_Locinfo@std@@QBEPBDXZ */
607 /* ?_Getfalse@_Locinfo@std@@QEBAPEBDXZ */
608 DEFINE_THISCALL_WRAPPER(_Locinfo__Getfalse, 4)
609 const char* __thiscall _Locinfo__Getfalse(const _Locinfo *this)
611 TRACE("(%p)\n", this);
612 return "false";
615 /* ?_Gettrue@_Locinfo@std@@QBEPBDXZ */
616 /* ?_Gettrue@_Locinfo@std@@QEBAPEBDXZ */
617 DEFINE_THISCALL_WRAPPER(_Locinfo__Gettrue, 4)
618 const char* __thiscall _Locinfo__Gettrue(const _Locinfo *this)
620 TRACE("(%p)\n", this);
621 return "true";
624 /* ?_Getlconv@_Locinfo@std@@QBEPBUlconv@@XZ */
625 /* ?_Getlconv@_Locinfo@std@@QEBAPEBUlconv@@XZ */
626 DEFINE_THISCALL_WRAPPER(_Locinfo__Getlconv, 4)
627 const struct lconv* __thiscall _Locinfo__Getlconv(const _Locinfo *this)
629 TRACE("(%p)\n", this);
630 return localeconv();
633 /* ?_Getname@_Locinfo@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
634 /* ?_Getname@_Locinfo@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
635 DEFINE_THISCALL_WRAPPER(_Locinfo__Getname, 8)
636 basic_string_char* __thiscall _Locinfo__Getname(const _Locinfo *this, basic_string_char *ret)
638 TRACE("(%p)\n", this);
640 basic_string_char_copy_ctor(ret, &this->newlocname);
641 return ret;
644 /* ?_Gettnames@_Locinfo@std@@QBE?AV_Timevec@2@XZ */
645 /* ?_Gettnames@_Locinfo@std@@QEBA?AV_Timevec@2@XZ */
646 DEFINE_THISCALL_WRAPPER(_Locinfo__Gettnames, 8)
647 _Timevec*__thiscall _Locinfo__Gettnames(const _Locinfo *this, _Timevec *ret)
649 TRACE("(%p)\n", this);
651 _Timevec_ctor_timeptr(ret, _Gettnames());
652 return ret;
655 /* ?id@?$collate@D@std@@2V0locale@2@A */
656 locale_id collate_char_id = {0};
658 /* ??_7?$collate@D@std@@6B@ */
659 extern const vtable_ptr MSVCP_collate_char_vtable;
661 /* ?_Init@?$collate@D@std@@IAEXABV_Locinfo@2@@Z */
662 /* ?_Init@?$collate@D@std@@IEAAXAEBV_Locinfo@2@@Z */
663 DEFINE_THISCALL_WRAPPER(collate_char__Init, 8)
664 void __thiscall collate_char__Init(collate *this, const _Locinfo *locinfo)
666 TRACE("(%p %p)\n", this, locinfo);
667 _Locinfo__Getcoll(locinfo, &this->coll);
670 /* ??0?$collate@D@std@@IAE@PBDI@Z */
671 /* ??0?$collate@D@std@@IEAA@PEBD_K@Z */
672 static collate* collate_char_ctor_name(collate *this, const char *name, MSVCP_size_t refs)
674 _Locinfo locinfo;
676 TRACE("(%p %s %lu)\n", this, name, refs);
678 locale_facet_ctor_refs(&this->facet, refs);
679 this->facet.vtable = &MSVCP_collate_char_vtable;
681 _Locinfo_ctor_cstr(&locinfo, name);
682 collate_char__Init(this, &locinfo);
683 _Locinfo_dtor(&locinfo);
684 return this;
687 /* ??0?$collate@D@std@@QAE@ABV_Locinfo@1@I@Z */
688 /* ??0?$collate@D@std@@QEAA@AEBV_Locinfo@1@_K@Z */
689 DEFINE_THISCALL_WRAPPER(collate_char_ctor_locinfo, 12)
690 collate* __thiscall collate_char_ctor_locinfo(collate *this, const _Locinfo *locinfo, MSVCP_size_t refs)
692 TRACE("(%p %p %lu)\n", this, locinfo, refs);
694 locale_facet_ctor_refs(&this->facet, refs);
695 this->facet.vtable = &MSVCP_collate_char_vtable;
696 collate_char__Init(this, locinfo);
697 return this;
700 /* ??0?$collate@D@std@@QAE@I@Z */
701 /* ??0?$collate@D@std@@QEAA@_K@Z */
702 DEFINE_THISCALL_WRAPPER(collate_char_ctor_refs, 8)
703 collate* __thiscall collate_char_ctor_refs(collate *this, MSVCP_size_t refs)
705 return collate_char_ctor_name(this, "C", refs);
708 /* ??1?$collate@D@std@@UAE@XZ */
709 /* ??1?$collate@D@std@@UEAA@XZ */
710 DEFINE_THISCALL_WRAPPER(collate_char_dtor, 4)
711 void __thiscall collate_char_dtor(collate *this)
713 TRACE("(%p)\n", this);
716 DEFINE_THISCALL_WRAPPER(collate_char_vector_dtor, 8)
717 collate* __thiscall collate_char_vector_dtor(collate *this, unsigned int flags)
719 TRACE("(%p %x)\n", this, flags);
720 if(flags & 2) {
721 /* we have an array, with the number of elements stored before the first object */
722 INT_PTR i, *ptr = (INT_PTR *)this-1;
724 for(i=*ptr-1; i>=0; i--)
725 collate_char_dtor(this+i);
726 MSVCRT_operator_delete(ptr);
727 } else {
728 collate_char_dtor(this);
729 if(flags & 1)
730 MSVCRT_operator_delete(this);
733 return this;
736 /* ??_F?$collate@D@std@@QAEXXZ */
737 /* ??_F?$collate@D@std@@QEAAXXZ */
738 DEFINE_THISCALL_WRAPPER(collate_char_ctor, 4)
739 collate* __thiscall collate_char_ctor(collate *this)
741 return collate_char_ctor_name(this, "C", 0);
744 /* ?_Getcat@?$collate@D@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
745 /* ?_Getcat@?$collate@D@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
746 static MSVCP_size_t collate_char__Getcat(const locale_facet **facet, const locale *loc)
748 TRACE("(%p %p)\n", facet, loc);
750 if(facet && !*facet) {
751 *facet = MSVCRT_operator_new(sizeof(collate));
752 if(!*facet) {
753 ERR("Out of memory\n");
754 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
755 return 0;
757 collate_char_ctor_name((collate*)*facet,
758 basic_string_char_c_str(&loc->ptr->name), 0);
761 return LC_COLLATE;
764 static collate* collate_char_use_facet(const locale *loc)
766 static collate *obj = NULL;
768 _Lockit lock;
769 const locale_facet *fac;
771 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
772 fac = locale__Getfacet(loc, locale_id_operator_size_t(&collate_char_id), TRUE);
773 if(fac) {
774 _Lockit_dtor(&lock);
775 return (collate*)fac;
778 if(obj) {
779 _Lockit_dtor(&lock);
780 return obj;
783 collate_char__Getcat(&fac, loc);
784 obj = (collate*)fac;
785 locale_facet__Incref(&obj->facet);
786 locale_facet_register(&obj->facet);
787 _Lockit_dtor(&lock);
789 return obj;
792 /* _Strcoll */
793 int __cdecl _Strcoll(const char *first1, const char *last1, const char *first2,
794 const char *last2, const _Collvec *coll)
796 LCID lcid;
798 TRACE("(%s %s)\n", debugstr_an(first1, last1-first1), debugstr_an(first2, last2-first2));
800 if(coll)
801 lcid = coll->handle;
802 else
803 lcid = ___lc_handle_func()[LC_COLLATE];
804 return CompareStringA(lcid, 0, first1, last1-first1, first2, last2-first2)-CSTR_EQUAL;
807 /* ?do_compare@?$collate@D@std@@MBEHPBD000@Z */
808 /* ?do_compare@?$collate@D@std@@MEBAHPEBD000@Z */
809 DEFINE_THISCALL_WRAPPER(collate_char_do_compare, 20)
810 #define call_collate_char_do_compare(this, first1, last1, first2, last2) CALL_VTBL_FUNC(this, 4, int, \
811 (const collate*, const char*, const char*, const char*, const char*), \
812 (this, first1, last1, first2, last2))
813 int __thiscall collate_char_do_compare(const collate *this, const char *first1,
814 const char *last1, const char *first2, const char *last2)
816 TRACE("(%p %p %p %p %p)\n", this, first1, last1, first2, last2);
817 return _Strcoll(first1, last1, first2, last2, &this->coll);
820 /* ?compare@?$collate@D@std@@QBEHPBD000@Z */
821 /* ?compare@?$collate@D@std@@QEBAHPEBD000@Z */
822 DEFINE_THISCALL_WRAPPER(collate_char_compare, 20)
823 int __thiscall collate_char_compare(const collate *this, const char *first1,
824 const char *last1, const char *first2, const char *last2)
826 TRACE("(%p %p %p %p %p)\n", this, first1, last1, first2, last2);
827 return call_collate_char_do_compare(this, first1, last1, first2, last2);
830 /* ?do_hash@?$collate@D@std@@MBEJPBD0@Z */
831 /* ?do_hash@?$collate@D@std@@MEBAJPEBD0@Z */
832 DEFINE_THISCALL_WRAPPER(collate_char_do_hash, 12)
833 #define call_collate_char_do_hash(this, first, last) CALL_VTBL_FUNC(this, 12, LONG, \
834 (const collate*, const char*, const char*), (this, first, last))
835 LONG __thiscall collate_char_do_hash(const collate *this,
836 const char *first, const char *last)
838 ULONG ret = 0;
840 TRACE("(%p %p %p)\n", this, first, last);
842 for(; first<last; first++)
843 ret = (ret<<8 | ret>>24) + *first;
844 return ret;
847 /* ?hash@?$collate@D@std@@QBEJPBD0@Z */
848 /* ?hash@?$collate@D@std@@QEBAJPEBD0@Z */
849 DEFINE_THISCALL_WRAPPER(collate_char_hash, 12)
850 LONG __thiscall collate_char_hash(const collate *this,
851 const char *first, const char *last)
853 TRACE("(%p %p %p)\n", this, first, last);
854 return call_collate_char_do_hash(this, first, last);
857 /* ?do_transform@?$collate@D@std@@MBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@PBD0@Z */
858 /* ?do_transform@?$collate@D@std@@MEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@PEBD0@Z */
859 DEFINE_THISCALL_WRAPPER(collate_char_do_transform, 16)
860 basic_string_char* __thiscall collate_char_do_transform(const collate *this,
861 basic_string_char *ret, const char *first, const char *last)
863 FIXME("(%p %p %p) stub\n", this, first, last);
864 return ret;
867 /* ?transform@?$collate@D@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@PBD0@Z */
868 /* ?transform@?$collate@D@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@PEBD0@Z */
869 DEFINE_THISCALL_WRAPPER(collate_char_transform, 16)
870 basic_string_char* __thiscall collate_char_transform(const collate *this,
871 basic_string_char *ret, const char *first, const char *last)
873 FIXME("(%p %p %p) stub\n", this, first, last);
874 return ret;
877 /* ?id@?$collate@_W@std@@2V0locale@2@A */
878 static locale_id collate_wchar_id = {0};
879 /* ?id@?$collate@G@std@@2V0locale@2@A */
880 locale_id collate_short_id = {0};
882 /* ??_7?$collate@_W@std@@6B@ */
883 extern const vtable_ptr MSVCP_collate_wchar_vtable;
884 /* ??_7?$collate@G@std@@6B@ */
885 extern const vtable_ptr MSVCP_collate_short_vtable;
887 /* ?_Init@?$collate@_W@std@@IAEXABV_Locinfo@2@@Z */
888 /* ?_Init@?$collate@_W@std@@IEAAXAEBV_Locinfo@2@@Z */
889 /* ?_Init@?$collate@G@std@@IAEXABV_Locinfo@2@@Z */
890 /* ?_Init@?$collate@G@std@@IEAAXAEBV_Locinfo@2@@Z */
891 DEFINE_THISCALL_WRAPPER(collate_wchar__Init, 8)
892 void __thiscall collate_wchar__Init(collate *this, const _Locinfo *locinfo)
894 TRACE("(%p %p)\n", this, locinfo);
895 _Locinfo__Getcoll(locinfo, &this->coll);
898 /* ??0?$collate@_W@std@@IAE@PBDI@Z */
899 /* ??0?$collate@_W@std@@IEAA@PEBD_K@Z */
900 static collate* collate_wchar_ctor_name(collate *this, const char *name, MSVCP_size_t refs)
902 _Locinfo locinfo;
904 TRACE("(%p %s %lu)\n", this, name, refs);
906 locale_facet_ctor_refs(&this->facet, refs);
907 this->facet.vtable = &MSVCP_collate_wchar_vtable;
909 _Locinfo_ctor_cstr(&locinfo, name);
910 collate_wchar__Init(this, &locinfo);
911 _Locinfo_dtor(&locinfo);
912 return this;
915 /* ??0?$collate@_W@std@@QAE@ABV_Locinfo@1@I@Z */
916 /* ??0?$collate@_W@std@@QEAA@AEBV_Locinfo@1@_K@Z */
917 static collate* collate_wchar_ctor_locinfo(collate *this, const _Locinfo *locinfo, MSVCP_size_t refs)
919 TRACE("(%p %p %lu)\n", this, locinfo, refs);
921 locale_facet_ctor_refs(&this->facet, refs);
922 this->facet.vtable = &MSVCP_collate_wchar_vtable;
923 collate_wchar__Init(this, locinfo);
924 return this;
927 /* ??0?$collate@G@std@@QAE@ABV_Locinfo@1@I@Z */
928 /* ??0?$collate@G@std@@QEAA@AEBV_Locinfo@1@_K@Z */
929 DEFINE_THISCALL_WRAPPER(collate_short_ctor_locinfo, 12)
930 collate* __thiscall collate_short_ctor_locinfo(collate *this, const _Locinfo *locinfo, MSVCP_size_t refs)
932 collate *ret = collate_wchar_ctor_locinfo(this, locinfo, refs);
933 ret->facet.vtable = &MSVCP_collate_short_vtable;
934 return ret;
937 /* ??0?$collate@_W@std@@QAE@I@Z */
938 /* ??0?$collate@_W@std@@QEAA@_K@Z */
939 static collate* collate_wchar_ctor_refs(collate *this, MSVCP_size_t refs)
941 return collate_wchar_ctor_name(this, "C", refs);
944 /* ??0?$collate@G@std@@QAE@I@Z */
945 /* ??0?$collate@G@std@@QEAA@_K@Z */
946 DEFINE_THISCALL_WRAPPER(collate_short_ctor_refs, 8)
947 collate* __thiscall collate_short_ctor_refs(collate *this, MSVCP_size_t refs)
949 collate *ret = collate_wchar_ctor_refs(this, refs);
950 ret->facet.vtable = &MSVCP_collate_short_vtable;
951 return ret;
954 /* ??1?$collate@G@std@@UAE@XZ */
955 /* ??1?$collate@G@std@@UEAA@XZ */
956 DEFINE_THISCALL_WRAPPER(collate_wchar_dtor, 4)
957 void __thiscall collate_wchar_dtor(collate *this)
959 TRACE("(%p)\n", this);
962 DEFINE_THISCALL_WRAPPER(collate_wchar_vector_dtor, 8)
963 collate* __thiscall collate_wchar_vector_dtor(collate *this, unsigned int flags)
965 TRACE("(%p %x)\n", this, flags);
966 if(flags & 2) {
967 /* we have an array, with the number of elements stored before the first object */
968 INT_PTR i, *ptr = (INT_PTR *)this-1;
970 for(i=*ptr-1; i>=0; i--)
971 collate_wchar_dtor(this+i);
972 MSVCRT_operator_delete(ptr);
973 } else {
974 collate_wchar_dtor(this);
975 if(flags & 1)
976 MSVCRT_operator_delete(this);
979 return this;
982 /* ??_F?$collate@_W@std@@QAEXXZ */
983 /* ??_F?$collate@_W@std@@QEAAXXZ */
984 static collate* collate_wchar_ctor(collate *this)
986 return collate_wchar_ctor_name(this, "C", 0);
989 /* ??_F?$collate@G@std@@QAEXXZ */
990 /* ??_F?$collate@G@std@@QEAAXXZ */
991 DEFINE_THISCALL_WRAPPER(collate_short_ctor, 4)
992 collate* __thiscall collate_short_ctor(collate *this)
994 collate *ret = collate_wchar_ctor(this);
995 ret->facet.vtable = &MSVCP_collate_short_vtable;
996 return ret;
999 /* ?_Getcat@?$collate@_W@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
1000 /* ?_Getcat@?$collate@_W@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
1001 static MSVCP_size_t collate_wchar__Getcat(const locale_facet **facet, const locale *loc)
1003 TRACE("(%p %p)\n", facet, loc);
1005 if(facet && !*facet) {
1006 *facet = MSVCRT_operator_new(sizeof(collate));
1007 if(!*facet) {
1008 ERR("Out of memory\n");
1009 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
1010 return 0;
1012 collate_wchar_ctor_name((collate*)*facet,
1013 basic_string_char_c_str(&loc->ptr->name), 0);
1016 return LC_COLLATE;
1019 static collate* collate_wchar_use_facet(const locale *loc)
1021 static collate *obj = NULL;
1023 _Lockit lock;
1024 const locale_facet *fac;
1026 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
1027 fac = locale__Getfacet(loc, locale_id_operator_size_t(&collate_wchar_id), TRUE);
1028 if(fac) {
1029 _Lockit_dtor(&lock);
1030 return (collate*)fac;
1033 if(obj) {
1034 _Lockit_dtor(&lock);
1035 return obj;
1038 collate_wchar__Getcat(&fac, loc);
1039 obj = (collate*)fac;
1040 locale_facet__Incref(&obj->facet);
1041 locale_facet_register(&obj->facet);
1042 _Lockit_dtor(&lock);
1044 return obj;
1047 /* ?_Getcat@?$collate@G@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
1048 /* ?_Getcat@?$collate@G@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
1049 static MSVCP_size_t collate_short__Getcat(const locale_facet **facet, const locale *loc)
1051 if(facet && !*facet) {
1052 collate_wchar__Getcat(facet, loc);
1053 (*(locale_facet**)facet)->vtable = &MSVCP_collate_short_vtable;
1056 return LC_COLLATE;
1059 static collate* collate_short_use_facet(const locale *loc)
1061 static collate *obj = NULL;
1063 _Lockit lock;
1064 const locale_facet *fac;
1066 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
1067 fac = locale__Getfacet(loc, locale_id_operator_size_t(&collate_short_id), TRUE);
1068 if(fac) {
1069 _Lockit_dtor(&lock);
1070 return (collate*)fac;
1073 if(obj) {
1074 _Lockit_dtor(&lock);
1075 return obj;
1078 collate_short__Getcat(&fac, loc);
1079 obj = (collate*)fac;
1080 locale_facet__Incref(&obj->facet);
1081 locale_facet_register(&obj->facet);
1082 _Lockit_dtor(&lock);
1084 return obj;
1087 /* _Wcscoll */
1088 static int _Wcscoll(const wchar_t *first1, const wchar_t *last1, const wchar_t *first2,
1089 const wchar_t *last2, const _Collvec *coll)
1091 LCID lcid;
1093 TRACE("(%s %s)\n", debugstr_wn(first1, last1-first1), debugstr_wn(first2, last2-first2));
1095 if(coll)
1096 lcid = coll->handle;
1097 else
1098 lcid = ___lc_handle_func()[LC_COLLATE];
1099 return CompareStringW(lcid, 0, first1, last1-first1, first2, last2-first2)-CSTR_EQUAL;
1102 /* ?do_compare@?$collate@_W@std@@MBEHPB_W000@Z */
1103 /* ?do_compare@?$collate@_W@std@@MEBAHPEB_W000@Z */
1104 /* ?do_compare@?$collate@G@std@@MBEHPBG000@Z */
1105 /* ?do_compare@?$collate@G@std@@MEBAHPEBG000@Z */
1106 DEFINE_THISCALL_WRAPPER(collate_wchar_do_compare, 20)
1107 #define call_collate_wchar_do_compare(this, first1, last1, first2, last2) CALL_VTBL_FUNC(this, 4, int, \
1108 (const collate*, const wchar_t*, const wchar_t*, const wchar_t*, const wchar_t*), \
1109 (this, first1, last1, first2, last2))
1110 int __thiscall collate_wchar_do_compare(const collate *this, const wchar_t *first1,
1111 const wchar_t *last1, const wchar_t *first2, const wchar_t *last2)
1113 TRACE("(%p %p %p %p %p)\n", this, first1, last1, first2, last2);
1114 return _Wcscoll(first1, last1, first2, last2, &this->coll);
1117 /* ?compare@?$collate@_W@std@@QBEHPB_W000@Z */
1118 /* ?compare@?$collate@_W@std@@QEBAHPEB_W000@Z */
1119 /* ?compare@?$collate@G@std@@QBEHPBG000@Z */
1120 /* ?compare@?$collate@G@std@@QEBAHPEBG000@Z */
1121 DEFINE_THISCALL_WRAPPER(collate_wchar_compare, 20)
1122 int __thiscall collate_wchar_compare(const collate *this, const wchar_t *first1,
1123 const wchar_t *last1, const wchar_t *first2, const wchar_t *last2)
1125 TRACE("(%p %p %p %p %p)\n", this, first1, last1, first2, last2);
1126 return call_collate_wchar_do_compare(this, first1, last1, first2, last2);
1129 /* ?do_hash@?$collate@_W@std@@MBEJPB_W0@Z */
1130 /* ?do_hash@?$collate@_W@std@@MEBAJPEB_W0@Z */
1131 /* ?do_hash@?$collate@G@std@@MBEJPBG0@Z */
1132 /* ?do_hash@?$collate@G@std@@MEBAJPEBG0@Z */
1133 DEFINE_THISCALL_WRAPPER(collate_wchar_do_hash, 12)
1134 #define call_collate_wchar_do_hash(this, first, last) CALL_VTBL_FUNC(this, 12, LONG, \
1135 (const collate*, const wchar_t*, const wchar_t*), (this, first, last))
1136 LONG __thiscall collate_wchar_do_hash(const collate *this,
1137 const wchar_t *first, const wchar_t *last)
1139 ULONG ret = 0;
1141 TRACE("(%p %p %p)\n", this, first, last);
1143 for(; first<last; first++)
1144 ret = (ret<<8 | ret>>24) + *first;
1145 return ret;
1148 /* ?hash@?$collate@_W@std@@QBEJPB_W0@Z */
1149 /* ?hash@?$collate@_W@std@@QEBAJPEB_W0@Z */
1150 /* ?hash@?$collate@G@std@@QBEJPBG0@Z */
1151 /* ?hash@?$collate@G@std@@QEBAJPEBG0@Z */
1152 DEFINE_THISCALL_WRAPPER(collate_wchar_hash, 12)
1153 LONG __thiscall collate_wchar_hash(const collate *this,
1154 const wchar_t *first, const wchar_t *last)
1156 TRACE("(%p %p %p)\n", this, first, last);
1157 return call_collate_wchar_do_hash(this, first, last);
1160 /* ?do_transform@?$collate@_W@std@@MBE?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@PB_W0@Z */
1161 /* ?do_transform@?$collate@_W@std@@MEBA?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@PEB_W0@Z */
1162 /* ?do_transform@?$collate@G@std@@MBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@PBG0@Z */
1163 /* ?do_transform@?$collate@G@std@@MEBA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@PEBG0@Z */
1164 DEFINE_THISCALL_WRAPPER(collate_wchar_do_transform, 16)
1165 basic_string_wchar* __thiscall collate_wchar_do_transform(const collate *this,
1166 basic_string_wchar *ret, const wchar_t *first, const wchar_t *last)
1168 FIXME("(%p %p %p) stub\n", this, first, last);
1169 return ret;
1172 /* ?transform@?$collate@_W@std@@QBE?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@PB_W0@Z */
1173 /* ?transform@?$collate@_W@std@@QEBA?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@PEB_W0@Z */
1174 /* ?transform@?$collate@G@std@@QBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@PBG0@Z */
1175 /* ?transform@?$collate@G@std@@QEBA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@PEBG0@Z */
1176 DEFINE_THISCALL_WRAPPER(collate_wchar_transform, 16)
1177 basic_string_wchar* __thiscall collate_wchar_transform(const collate *this,
1178 basic_string_wchar *ret, const wchar_t *first, const wchar_t *last)
1180 FIXME("(%p %p %p) stub\n", this, first, last);
1181 return ret;
1184 /* ??_7ctype_base@std@@6B@ */
1185 extern const vtable_ptr MSVCP_ctype_base_vtable;
1187 /* ??0ctype_base@std@@QAE@I@Z */
1188 /* ??0ctype_base@std@@QEAA@_K@Z */
1189 DEFINE_THISCALL_WRAPPER(ctype_base_ctor_refs, 8)
1190 ctype_base* __thiscall ctype_base_ctor_refs(ctype_base *this, MSVCP_size_t refs)
1192 TRACE("(%p %lu)\n", this, refs);
1193 locale_facet_ctor_refs(&this->facet, refs);
1194 this->facet.vtable = &MSVCP_ctype_base_vtable;
1195 return this;
1198 /* ??_Fctype_base@std@@QAEXXZ */
1199 /* ??_Fctype_base@std@@QEAAXXZ */
1200 DEFINE_THISCALL_WRAPPER(ctype_base_ctor, 4)
1201 ctype_base* __thiscall ctype_base_ctor(ctype_base *this)
1203 TRACE("(%p)\n", this);
1204 locale_facet_ctor_refs(&this->facet, 0);
1205 this->facet.vtable = &MSVCP_ctype_base_vtable;
1206 return this;
1209 /* ??1ctype_base@std@@UAE@XZ */
1210 /* ??1ctype_base@std@@UEAA@XZ */
1211 DEFINE_THISCALL_WRAPPER(ctype_base_dtor, 4)
1212 void __thiscall ctype_base_dtor(ctype_base *this)
1214 TRACE("(%p)\n", this);
1217 DEFINE_THISCALL_WRAPPER(ctype_base_vector_dtor, 8)
1218 ctype_base* __thiscall ctype_base_vector_dtor(ctype_base *this, unsigned int flags)
1220 TRACE("(%p %x)\n", this, flags);
1221 if(flags & 2) {
1222 /* we have an array, with the number of elements stored before the first object */
1223 INT_PTR i, *ptr = (INT_PTR *)this-1;
1225 for(i=*ptr-1; i>=0; i--)
1226 ctype_base_dtor(this+i);
1227 MSVCRT_operator_delete(ptr);
1228 } else {
1229 ctype_base_dtor(this);
1230 if(flags & 1)
1231 MSVCRT_operator_delete(this);
1234 return this;
1237 /* ?id@?$ctype@D@std@@2V0locale@2@A */
1238 locale_id ctype_char_id = {0};
1239 /* ?table_size@?$ctype@D@std@@2IB */
1240 /* ?table_size@?$ctype@D@std@@2_KB */
1241 MSVCP_size_t ctype_char_table_size = 256;
1243 /* ??_7?$ctype@D@std@@6B@ */
1244 extern const vtable_ptr MSVCP_ctype_char_vtable;
1246 /* ?_Init@?$ctype@D@std@@IAEXABV_Locinfo@2@@Z */
1247 /* ?_Init@?$ctype@D@std@@IEAAXAEBV_Locinfo@2@@Z */
1248 DEFINE_THISCALL_WRAPPER(ctype_char__Init, 8)
1249 void __thiscall ctype_char__Init(ctype_char *this, const _Locinfo *locinfo)
1251 TRACE("(%p %p)\n", this, locinfo);
1252 _Locinfo__Getctype(locinfo, &this->ctype);
1255 /* ?_Tidy@?$ctype@D@std@@IAEXXZ */
1256 /* ?_Tidy@?$ctype@D@std@@IEAAXXZ */
1257 static void ctype_char__Tidy(ctype_char *this)
1259 TRACE("(%p)\n", this);
1261 if(this->ctype.delfl)
1262 free((short*)this->ctype.table);
1265 /* ?classic_table@?$ctype@D@std@@KAPBFXZ */
1266 /* ?classic_table@?$ctype@D@std@@KAPEBFXZ */
1267 const short* __cdecl ctype_char_classic_table(void)
1269 TRACE("()\n");
1270 return &((short*)GetProcAddress(GetModuleHandleA("msvcrt.dll"), "_ctype"))[1];
1273 /* ??0?$ctype@D@std@@QAE@ABV_Locinfo@1@I@Z */
1274 /* ??0?$ctype@D@std@@QEAA@AEBV_Locinfo@1@_K@Z */
1275 DEFINE_THISCALL_WRAPPER(ctype_char_ctor_locinfo, 12)
1276 ctype_char* __thiscall ctype_char_ctor_locinfo(ctype_char *this,
1277 const _Locinfo *locinfo, MSVCP_size_t refs)
1279 TRACE("(%p %p %lu)\n", this, locinfo, refs);
1280 ctype_base_ctor_refs(&this->base, refs);
1281 this->base.facet.vtable = &MSVCP_ctype_char_vtable;
1282 ctype_char__Init(this, locinfo);
1283 return this;
1286 /* ??0?$ctype@D@std@@QAE@PBF_NI@Z */
1287 /* ??0?$ctype@D@std@@QEAA@PEBF_N_K@Z */
1288 DEFINE_THISCALL_WRAPPER(ctype_char_ctor_table, 16)
1289 ctype_char* __thiscall ctype_char_ctor_table(ctype_char *this,
1290 const short *table, MSVCP_bool delete, MSVCP_size_t refs)
1292 _Locinfo locinfo;
1294 TRACE("(%p %p %d %lu)\n", this, table, delete, refs);
1296 ctype_base_ctor_refs(&this->base, refs);
1297 this->base.facet.vtable = &MSVCP_ctype_char_vtable;
1299 _Locinfo_ctor(&locinfo);
1300 ctype_char__Init(this, &locinfo);
1301 _Locinfo_dtor(&locinfo);
1303 if(table) {
1304 ctype_char__Tidy(this);
1305 this->ctype.table = table;
1306 this->ctype.delfl = delete;
1308 return this;
1311 /* ??_F?$ctype@D@std@@QAEXXZ */
1312 /* ??_F?$ctype@D@std@@QEAAXXZ */
1313 DEFINE_THISCALL_WRAPPER(ctype_char_ctor, 4)
1314 ctype_char* __thiscall ctype_char_ctor(ctype_char *this)
1316 return ctype_char_ctor_table(this, NULL, FALSE, 0);
1319 /* ??1?$ctype@D@std@@UAE@XZ */
1320 /* ??1?$ctype@D@std@@UEAA@XZ */
1321 DEFINE_THISCALL_WRAPPER(ctype_char_dtor, 4)
1322 void __thiscall ctype_char_dtor(ctype_char *this)
1324 TRACE("(%p)\n", this);
1325 ctype_char__Tidy(this);
1328 DEFINE_THISCALL_WRAPPER(ctype_char_vector_dtor, 8)
1329 ctype_char* __thiscall ctype_char_vector_dtor(ctype_char *this, unsigned int flags)
1331 TRACE("(%p %x)\n", this, flags);
1332 if(flags & 2) {
1333 /* we have an array, with the number of elements stored before the first object */
1334 INT_PTR i, *ptr = (INT_PTR *)this-1;
1336 for(i=*ptr-1; i>=0; i--)
1337 ctype_char_dtor(this+i);
1338 MSVCRT_operator_delete(ptr);
1339 } else {
1340 ctype_char_dtor(this);
1341 if(flags & 1)
1342 MSVCRT_operator_delete(this);
1345 return this;
1348 /* ?do_narrow@?$ctype@D@std@@MBEDDD@Z */
1349 /* ?do_narrow@?$ctype@D@std@@MEBADDD@Z */
1350 DEFINE_THISCALL_WRAPPER(ctype_char_do_narrow_ch, 12)
1351 #define call_ctype_char_do_narrow_ch(this, ch, unused) CALL_VTBL_FUNC(this, 32, \
1352 char, (const ctype_char*, char, char), (this, ch, unused))
1353 char __thiscall ctype_char_do_narrow_ch(const ctype_char *this, char ch, char unused)
1355 TRACE("(%p %c %c)\n", this, ch, unused);
1356 return ch;
1359 /* ?do_narrow@?$ctype@D@std@@MBEPBDPBD0DPAD@Z */
1360 /* ?do_narrow@?$ctype@D@std@@MEBAPEBDPEBD0DPEAD@Z */
1361 DEFINE_THISCALL_WRAPPER(ctype_char_do_narrow, 20)
1362 #define call_ctype_char_do_narrow(this, first, last, unused, dest) CALL_VTBL_FUNC(this, 28, \
1363 const char*, (const ctype_char*, const char*, const char*, char, char*), \
1364 (this, first, last, unused, dest))
1365 const char* __thiscall ctype_char_do_narrow(const ctype_char *this,
1366 const char *first, const char *last, char unused, char *dest)
1368 TRACE("(%p %p %p %p)\n", this, first, last, dest);
1369 memcpy(dest, first, last-first);
1370 return last;
1373 /* ?narrow@?$ctype@D@std@@QBEDDD@Z */
1374 /* ?narrow@?$ctype@D@std@@QEBADDD@Z */
1375 DEFINE_THISCALL_WRAPPER(ctype_char_narrow_ch, 12)
1376 char __thiscall ctype_char_narrow_ch(const ctype_char *this, char ch, char dflt)
1378 TRACE("(%p %c %c)\n", this, ch, dflt);
1379 return call_ctype_char_do_narrow_ch(this, ch, dflt);
1382 /* ?narrow@?$ctype@D@std@@QBEPBDPBD0DPAD@Z */
1383 /* ?narrow@?$ctype@D@std@@QEBAPEBDPEBD0DPEAD@Z */
1384 DEFINE_THISCALL_WRAPPER(ctype_char_narrow, 20)
1385 const char* __thiscall ctype_char_narrow(const ctype_char *this,
1386 const char *first, const char *last, char dflt, char *dest)
1388 TRACE("(%p %p %p %c %p)\n", this, first, last, dflt, dest);
1389 return call_ctype_char_do_narrow(this, first, last, dflt, dest);
1392 /* ?do_widen@?$ctype@D@std@@MBEDD@Z */
1393 /* ?do_widen@?$ctype@D@std@@MEBADD@Z */
1394 DEFINE_THISCALL_WRAPPER(ctype_char_do_widen_ch, 8)
1395 #define call_ctype_char_do_widen_ch(this, ch) CALL_VTBL_FUNC(this, 24, \
1396 char, (const ctype_char*, char), (this, ch))
1397 char __thiscall ctype_char_do_widen_ch(const ctype_char *this, char ch)
1399 TRACE("(%p %c)\n", this, ch);
1400 return ch;
1403 /* ?do_widen@?$ctype@D@std@@MBEPBDPBD0PAD@Z */
1404 /* ?do_widen@?$ctype@D@std@@MEBAPEBDPEBD0PEAD@Z */
1405 DEFINE_THISCALL_WRAPPER(ctype_char_do_widen, 16)
1406 #define call_ctype_char_do_widen(this, first, last, dest) CALL_VTBL_FUNC(this, 20, \
1407 const char*, (const ctype_char*, const char*, const char*, char*), \
1408 (this, first, last, dest))
1409 const char* __thiscall ctype_char_do_widen(const ctype_char *this,
1410 const char *first, const char *last, char *dest)
1412 TRACE("(%p %p %p %p)\n", this, first, last, dest);
1413 memcpy(dest, first, last-first);
1414 return last;
1417 /* ?widen@?$ctype@D@std@@QBEDD@Z */
1418 /* ?widen@?$ctype@D@std@@QEBADD@Z */
1419 DEFINE_THISCALL_WRAPPER(ctype_char_widen_ch, 8)
1420 char __thiscall ctype_char_widen_ch(const ctype_char *this, char ch)
1422 TRACE("(%p %c)\n", this, ch);
1423 return call_ctype_char_do_widen_ch(this, ch);
1426 /* ?widen@?$ctype@D@std@@QBEPBDPBD0PAD@Z */
1427 /* ?widen@?$ctype@D@std@@QEBAPEBDPEBD0PEAD@Z */
1428 DEFINE_THISCALL_WRAPPER(ctype_char_widen, 16)
1429 const char* __thiscall ctype_char_widen(const ctype_char *this,
1430 const char *first, const char *last, char *dest)
1432 TRACE("(%p %p %p %p)\n", this, first, last, dest);
1433 return call_ctype_char_do_widen(this, first, last, dest);
1436 /* ?_Getcat@?$ctype@D@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
1437 /* ?_Getcat@?$ctype@D@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
1438 static MSVCP_size_t ctype_char__Getcat(const locale_facet **facet, const locale *loc)
1440 TRACE("(%p %p)\n", facet, loc);
1442 if(facet && !*facet) {
1443 _Locinfo locinfo;
1445 *facet = MSVCRT_operator_new(sizeof(ctype_char));
1446 if(!*facet) {
1447 ERR("Out of memory\n");
1448 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
1449 return 0;
1452 _Locinfo_ctor_cstr(&locinfo, basic_string_char_c_str(&loc->ptr->name));
1453 ctype_char_ctor_locinfo((ctype_char*)*facet, &locinfo, 0);
1454 _Locinfo_dtor(&locinfo);
1457 return LC_CTYPE;
1460 ctype_char* ctype_char_use_facet(const locale *loc)
1462 static ctype_char *obj = NULL;
1464 _Lockit lock;
1465 const locale_facet *fac;
1467 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
1468 fac = locale__Getfacet(loc, locale_id_operator_size_t(&ctype_char_id), TRUE);
1469 if(fac) {
1470 _Lockit_dtor(&lock);
1471 return (ctype_char*)fac;
1474 if(obj) {
1475 _Lockit_dtor(&lock);
1476 return obj;
1479 ctype_char__Getcat(&fac, loc);
1480 obj = (ctype_char*)fac;
1481 locale_facet__Incref(&obj->base.facet);
1482 locale_facet_register(&obj->base.facet);
1483 _Lockit_dtor(&lock);
1485 return obj;
1488 /* _Tolower */
1489 int __cdecl _Tolower(int ch, const _Ctypevec *ctype)
1491 unsigned int cp;
1493 TRACE("%d %p\n", ch, ctype);
1495 if(ctype)
1496 cp = ctype->page;
1497 else
1498 cp = ___lc_codepage_func();
1500 /* Don't convert to unicode in case of C locale */
1501 if(!cp) {
1502 if(ch>='A' && ch<='Z')
1503 ch = ch-'A'+'a';
1504 return ch;
1505 } else {
1506 WCHAR wide, lower;
1507 char str[2];
1508 int size;
1510 if(ch > 255) {
1511 str[0] = (ch>>8) & 255;
1512 str[1] = ch & 255;
1513 size = 2;
1514 } else {
1515 str[0] = ch & 255;
1516 size = 1;
1519 if(!MultiByteToWideChar(cp, MB_ERR_INVALID_CHARS, str, size, &wide, 1))
1520 return ch;
1522 lower = tolowerW(wide);
1523 if(lower == wide)
1524 return ch;
1526 WideCharToMultiByte(cp, 0, &lower, 1, str, 2, NULL, NULL);
1528 return str[0] + (str[1]<<8);
1532 /* ?do_tolower@?$ctype@D@std@@MBEDD@Z */
1533 /* ?do_tolower@?$ctype@D@std@@MEBADD@Z */
1534 #define call_ctype_char_do_tolower_ch(this, ch) CALL_VTBL_FUNC(this, 8, \
1535 char, (const ctype_char*, char), (this, ch))
1536 DEFINE_THISCALL_WRAPPER(ctype_char_do_tolower_ch, 8)
1537 char __thiscall ctype_char_do_tolower_ch(const ctype_char *this, char ch)
1539 TRACE("(%p %c)\n", this, ch);
1540 return _Tolower(ch, &this->ctype);
1543 /* ?do_tolower@?$ctype@D@std@@MBEPBDPADPBD@Z */
1544 /* ?do_tolower@?$ctype@D@std@@MEBAPEBDPEADPEBD@Z */
1545 #define call_ctype_char_do_tolower(this, first, last) CALL_VTBL_FUNC(this, 4, \
1546 const char*, (const ctype_char*, char*, const char*), (this, first, last))
1547 DEFINE_THISCALL_WRAPPER(ctype_char_do_tolower, 12)
1548 const char* __thiscall ctype_char_do_tolower(const ctype_char *this, char *first, const char *last)
1550 TRACE("(%p %p %p)\n", this, first, last);
1551 for(; first<last; first++)
1552 *first = _Tolower(*first, &this->ctype);
1553 return last;
1556 /* ?tolower@?$ctype@D@std@@QBEDD@Z */
1557 /* ?tolower@?$ctype@D@std@@QEBADD@Z */
1558 DEFINE_THISCALL_WRAPPER(ctype_char_tolower_ch, 8)
1559 char __thiscall ctype_char_tolower_ch(const ctype_char *this, char ch)
1561 TRACE("(%p %c)\n", this, ch);
1562 return call_ctype_char_do_tolower_ch(this, ch);
1565 /* ?tolower@?$ctype@D@std@@QBEPBDPADPBD@Z */
1566 /* ?tolower@?$ctype@D@std@@QEBAPEBDPEADPEBD@Z */
1567 DEFINE_THISCALL_WRAPPER(ctype_char_tolower, 12)
1568 const char* __thiscall ctype_char_tolower(const ctype_char *this, char *first, const char *last)
1570 TRACE("(%p %p %p)\n", this, first, last);
1571 return call_ctype_char_do_tolower(this, first, last);
1574 /* _Toupper */
1575 int __cdecl _Toupper(int ch, const _Ctypevec *ctype)
1577 unsigned int cp;
1579 TRACE("%d %p\n", ch, ctype);
1581 if(ctype)
1582 cp = ctype->page;
1583 else
1584 cp = ___lc_codepage_func();
1586 /* Don't convert to unicode in case of C locale */
1587 if(!cp) {
1588 if(ch>='a' && ch<='z')
1589 ch = ch-'a'+'A';
1590 return ch;
1591 } else {
1592 WCHAR wide, upper;
1593 char str[2];
1594 int size;
1596 if(ch > 255) {
1597 str[0] = (ch>>8) & 255;
1598 str[1] = ch & 255;
1599 size = 2;
1600 } else {
1601 str[0] = ch & 255;
1602 size = 1;
1605 if(!MultiByteToWideChar(cp, MB_ERR_INVALID_CHARS, str, size, &wide, 1))
1606 return ch;
1608 upper = toupperW(wide);
1609 if(upper == wide)
1610 return ch;
1612 WideCharToMultiByte(cp, 0, &upper, 1, str, 2, NULL, NULL);
1614 return str[0] + (str[1]<<8);
1618 /* ?do_toupper@?$ctype@D@std@@MBEDD@Z */
1619 /* ?do_toupper@?$ctype@D@std@@MEBADD@Z */
1620 #define call_ctype_char_do_toupper_ch(this, ch) CALL_VTBL_FUNC(this, 16, \
1621 char, (const ctype_char*, char), (this, ch))
1622 DEFINE_THISCALL_WRAPPER(ctype_char_do_toupper_ch, 8)
1623 char __thiscall ctype_char_do_toupper_ch(const ctype_char *this, char ch)
1625 TRACE("(%p %c)\n", this, ch);
1626 return _Toupper(ch, &this->ctype);
1629 /* ?do_toupper@?$ctype@D@std@@MBEPBDPADPBD@Z */
1630 /* ?do_toupper@?$ctype@D@std@@MEBAPEBDPEADPEBD@Z */
1631 #define call_ctype_char_do_toupper(this, first, last) CALL_VTBL_FUNC(this, 12, \
1632 const char*, (const ctype_char*, char*, const char*), (this, first, last))
1633 DEFINE_THISCALL_WRAPPER(ctype_char_do_toupper, 12)
1634 const char* __thiscall ctype_char_do_toupper(const ctype_char *this,
1635 char *first, const char *last)
1637 TRACE("(%p %p %p)\n", this, first, last);
1638 for(; first<last; first++)
1639 *first = _Toupper(*first, &this->ctype);
1640 return last;
1643 /* ?toupper@?$ctype@D@std@@QBEDD@Z */
1644 /* ?toupper@?$ctype@D@std@@QEBADD@Z */
1645 DEFINE_THISCALL_WRAPPER(ctype_char_toupper_ch, 8)
1646 char __thiscall ctype_char_toupper_ch(const ctype_char *this, char ch)
1648 TRACE("(%p %c)\n", this, ch);
1649 return call_ctype_char_do_toupper_ch(this, ch);
1652 /* ?toupper@?$ctype@D@std@@QBEPBDPADPBD@Z */
1653 /* ?toupper@?$ctype@D@std@@QEBAPEBDPEADPEBD@Z */
1654 DEFINE_THISCALL_WRAPPER(ctype_char_toupper, 12)
1655 const char* __thiscall ctype_char_toupper(const ctype_char *this, char *first, const char *last)
1657 TRACE("(%p %p %p)\n", this, first, last);
1658 return call_ctype_char_do_toupper(this, first, last);
1661 /* ?is@?$ctype@D@std@@QBE_NFD@Z */
1662 /* ?is@?$ctype@D@std@@QEBA_NFD@Z */
1663 DEFINE_THISCALL_WRAPPER(ctype_char_is_ch, 12)
1664 MSVCP_bool __thiscall ctype_char_is_ch(const ctype_char *this, short mask, char ch)
1666 TRACE("(%p %x %c)\n", this, mask, ch);
1667 return (this->ctype.table[(unsigned char)ch] & mask) != 0;
1670 /* ?is@?$ctype@D@std@@QBEPBDPBD0PAF@Z */
1671 /* ?is@?$ctype@D@std@@QEBAPEBDPEBD0PEAF@Z */
1672 DEFINE_THISCALL_WRAPPER(ctype_char_is, 16)
1673 const char* __thiscall ctype_char_is(const ctype_char *this, const char *first, const char *last, short *dest)
1675 TRACE("(%p %p %p %p)\n", this, first, last, dest);
1676 for(; first<last; first++)
1677 *dest++ = this->ctype.table[(unsigned char)*first];
1678 return last;
1681 /* ?scan_is@?$ctype@D@std@@QBEPBDFPBD0@Z */
1682 /* ?scan_is@?$ctype@D@std@@QEBAPEBDFPEBD0@Z */
1683 DEFINE_THISCALL_WRAPPER(ctype_char_scan_is, 16)
1684 const char* __thiscall ctype_char_scan_is(const ctype_char *this, short mask, const char *first, const char *last)
1686 TRACE("(%p %x %p %p)\n", this, mask, first, last);
1687 for(; first<last; first++)
1688 if(!ctype_char_is_ch(this, mask, *first))
1689 break;
1690 return first;
1693 /* ?scan_not@?$ctype@D@std@@QBEPBDFPBD0@Z */
1694 /* ?scan_not@?$ctype@D@std@@QEBAPEBDFPEBD0@Z */
1695 DEFINE_THISCALL_WRAPPER(ctype_char_scan_not, 16)
1696 const char* __thiscall ctype_char_scan_not(const ctype_char *this, short mask, const char *first, const char *last)
1698 TRACE("(%p %x %p %p)\n", this, mask, first, last);
1699 for(; first<last; first++)
1700 if(ctype_char_is_ch(this, mask, *first))
1701 break;
1702 return first;
1705 /* ?table@?$ctype@D@std@@IBEPBFXZ */
1706 /* ?table@?$ctype@D@std@@IEBAPEBFXZ */
1707 DEFINE_THISCALL_WRAPPER(ctype_char_table, 4)
1708 const short* __thiscall ctype_char_table(const ctype_char *this)
1710 TRACE("(%p)\n", this);
1711 return this->ctype.table;
1714 /* ?id@?$ctype@_W@std@@2V0locale@2@A */
1715 static locale_id ctype_wchar_id = {0};
1716 /* ?id@?$ctype@G@std@@2V0locale@2@A */
1717 locale_id ctype_short_id = {0};
1719 /* ??_7?$ctype@_W@std@@6B@ */
1720 extern const vtable_ptr MSVCP_ctype_wchar_vtable;
1721 /* ??_7?$ctype@G@std@@6B@ */
1722 extern const vtable_ptr MSVCP_ctype_short_vtable;
1724 /* ?_Init@?$ctype@_W@std@@IAEXABV_Locinfo@2@@Z */
1725 /* ?_Init@?$ctype@_W@std@@IEAAXAEBV_Locinfo@2@@Z */
1726 /* ?_Init@?$ctype@G@std@@IAEXABV_Locinfo@2@@Z */
1727 /* ?_Init@?$ctype@G@std@@IEAAXAEBV_Locinfo@2@@Z */
1728 DEFINE_THISCALL_WRAPPER(ctype_wchar__Init, 8)
1729 void __thiscall ctype_wchar__Init(ctype_wchar *this, const _Locinfo *locinfo)
1731 TRACE("(%p %p)\n", this, locinfo);
1732 _Locinfo__Getctype(locinfo, &this->ctype);
1733 _Locinfo__Getcvt(locinfo, &this->cvt);
1736 /* ??0?$ctype@_W@std@@QAE@ABV_Locinfo@1@I@Z */
1737 /* ??0?$ctype@_W@std@@QEAA@AEBV_Locinfo@1@_K@Z */
1738 static ctype_wchar* ctype_wchar_ctor_locinfo(ctype_wchar *this,
1739 const _Locinfo *locinfo, MSVCP_size_t refs)
1741 TRACE("(%p %p %lu)\n", this, locinfo, refs);
1742 ctype_base_ctor_refs(&this->base, refs);
1743 this->base.facet.vtable = &MSVCP_ctype_wchar_vtable;
1744 ctype_wchar__Init(this, locinfo);
1745 return this;
1748 /* ??0?$ctype@G@std@@QAE@ABV_Locinfo@1@I@Z */
1749 /* ??0?$ctype@G@std@@QEAA@AEBV_Locinfo@1@_K@Z */
1750 DEFINE_THISCALL_WRAPPER(ctype_short_ctor_locinfo, 12)
1751 ctype_wchar* __thiscall ctype_short_ctor_locinfo(ctype_wchar *this,
1752 const _Locinfo *locinfo, MSVCP_size_t refs)
1754 ctype_wchar *ret = ctype_wchar_ctor_locinfo(this, locinfo, refs);
1755 this->base.facet.vtable = &MSVCP_ctype_short_vtable;
1756 return ret;
1759 /* ??0?$ctype@_W@std@@QAE@I@Z */
1760 /* ??0?$ctype@_W@std@@QEAA@_K@Z */
1761 static ctype_wchar* ctype_wchar_ctor_refs(ctype_wchar *this, MSVCP_size_t refs)
1763 _Locinfo locinfo;
1765 TRACE("(%p %lu)\n", this, refs);
1767 ctype_base_ctor_refs(&this->base, refs);
1768 this->base.facet.vtable = &MSVCP_ctype_wchar_vtable;
1770 _Locinfo_ctor(&locinfo);
1771 ctype_wchar__Init(this, &locinfo);
1772 _Locinfo_dtor(&locinfo);
1773 return this;
1776 /* ??0?$ctype@G@std@@QAE@I@Z */
1777 /* ??0?$ctype@G@std@@QEAA@_K@Z */
1778 DEFINE_THISCALL_WRAPPER(ctype_short_ctor_refs, 8)
1779 ctype_wchar* __thiscall ctype_short_ctor_refs(ctype_wchar *this, MSVCP_size_t refs)
1781 ctype_wchar *ret = ctype_wchar_ctor_refs(this, refs);
1782 this->base.facet.vtable = &MSVCP_ctype_short_vtable;
1783 return ret;
1786 /* ??_F?$ctype@_W@std@@QAEXXZ */
1787 /* ??_F?$ctype@_W@std@@QEAAXXZ */
1788 static ctype_wchar* ctype_wchar_ctor(ctype_wchar *this)
1790 TRACE("(%p)\n", this);
1791 return ctype_short_ctor_refs(this, 0);
1794 /* ??_F?$ctype@G@std@@QAEXXZ */
1795 /* ??_F?$ctype@G@std@@QEAAXXZ */
1796 DEFINE_THISCALL_WRAPPER(ctype_short_ctor, 4)
1797 ctype_wchar* __thiscall ctype_short_ctor(ctype_wchar *this)
1799 ctype_wchar *ret = ctype_wchar_ctor(this);
1800 this->base.facet.vtable = &MSVCP_ctype_short_vtable;
1801 return ret;
1804 /* ??1?$ctype@G@std@@UAE@XZ */
1805 /* ??1?$ctype@G@std@@UEAA@XZ */
1806 DEFINE_THISCALL_WRAPPER(ctype_wchar_dtor, 4)
1807 void __thiscall ctype_wchar_dtor(ctype_wchar *this)
1809 TRACE("(%p)\n", this);
1810 if(this->ctype.delfl)
1811 free((void*)this->ctype.table);
1814 DEFINE_THISCALL_WRAPPER(ctype_wchar_vector_dtor, 8)
1815 ctype_wchar* __thiscall ctype_wchar_vector_dtor(ctype_wchar *this, unsigned int flags)
1817 TRACE("(%p %x)\n", this, flags);
1818 if(flags & 2) {
1819 /* we have an array, with the number of elements stored before the first object */
1820 INT_PTR i, *ptr = (INT_PTR *)this-1;
1822 for(i=*ptr-1; i>=0; i--)
1823 ctype_wchar_dtor(this+i);
1824 MSVCRT_operator_delete(ptr);
1825 } else {
1826 ctype_wchar_dtor(this);
1827 if(flags & 1)
1828 MSVCRT_operator_delete(this);
1831 return this;
1834 /* _Wcrtomb */
1835 int __cdecl _Wcrtomb(char *s, wchar_t wch, int *state, const _Cvtvec *cvt)
1837 int cp, size;
1838 BOOL def;
1840 TRACE("%p %d %p %p\n", s, wch, state, cvt);
1842 if(cvt)
1843 cp = cvt->page;
1844 else
1845 cp = ___lc_codepage_func();
1847 if(!cp) {
1848 if(wch > 255) {
1849 *_errno() = EILSEQ;
1850 return -1;
1853 *s = wch & 255;
1854 return 1;
1857 size = WideCharToMultiByte(cp, 0, &wch, 1, s, MB_LEN_MAX, NULL, &def);
1858 if(!size || def) {
1859 *_errno() = EILSEQ;
1860 return -1;
1863 return size;
1866 /* ?_Donarrow@?$ctype@_W@std@@IBED_WD@Z */
1867 /* ?_Donarrow@?$ctype@_W@std@@IEBAD_WD@Z */
1868 /* ?_Donarrow@?$ctype@G@std@@IBEDGD@Z */
1869 /* ?_Donarrow@?$ctype@G@std@@IEBADGD@Z */
1870 static char ctype_wchar__Donarrow(const ctype_wchar *this, wchar_t ch, char dflt)
1872 char buf[MB_LEN_MAX];
1874 TRACE("(%p %d %d)\n", this, ch, dflt);
1876 return _Wcrtomb(buf, ch, NULL, &this->cvt)==1 ? buf[0] : dflt;
1879 /* ?do_narrow@?$ctype@_W@std@@MBED_WD@Z */
1880 /* ?do_narrow@?$ctype@_W@std@@MEBAD_WD@Z */
1881 /* ?do_narrow@?$ctype@G@std@@MBEDGD@Z */
1882 /* ?do_narrow@?$ctype@G@std@@MEBADGD@Z */
1883 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_narrow_ch, 12)
1884 #define call_ctype_wchar_do_narrow_ch(this, ch, dflt) CALL_VTBL_FUNC(this, 48, \
1885 char, (const ctype_wchar*, wchar_t, char), (this, ch, dflt))
1886 char __thiscall ctype_wchar_do_narrow_ch(const ctype_wchar *this, wchar_t ch, char dflt)
1888 return ctype_wchar__Donarrow(this, ch, dflt);
1891 /* ?do_narrow@?$ctype@_W@std@@MBEPB_WPB_W0DPAD@Z */
1892 /* ?do_narrow@?$ctype@_W@std@@MEBAPEB_WPEB_W0DPEAD@Z */
1893 /* ?do_narrow@?$ctype@G@std@@MBEPBGPBG0DPAD@Z */
1894 /* ?do_narrow@?$ctype@G@std@@MEBAPEBGPEBG0DPEAD@Z */
1895 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_narrow, 20)
1896 #define call_ctype_wchar_do_narrow(this, first, last, dflt, dest) CALL_VTBL_FUNC(this, 44, \
1897 const wchar_t*, (const ctype_wchar*, const wchar_t*, const wchar_t*, char, char*), \
1898 (this, first, last, dflt, dest))
1899 const wchar_t* __thiscall ctype_wchar_do_narrow(const ctype_wchar *this,
1900 const wchar_t *first, const wchar_t *last, char dflt, char *dest)
1902 TRACE("(%p %p %p %d %p)\n", this, first, last, dflt, dest);
1903 for(; first<last; first++)
1904 *dest++ = ctype_wchar__Donarrow(this, *first, dflt);
1905 return last;
1908 /* ?narrow@?$ctype@_W@std@@QBED_WD@Z */
1909 /* ?narrow@?$ctype@_W@std@@QEBAD_WD@Z */
1910 /* ?narrow@?$ctype@G@std@@QBEDGD@Z */
1911 /* ?narrow@?$ctype@G@std@@QEBADGD@Z */
1912 DEFINE_THISCALL_WRAPPER(ctype_wchar_narrow_ch, 12)
1913 char __thiscall ctype_wchar_narrow_ch(const ctype_wchar *this, wchar_t ch, char dflt)
1915 TRACE("(%p %d %d)\n", this, ch, dflt);
1916 return call_ctype_wchar_do_narrow_ch(this, ch, dflt);
1919 /* ?narrow@?$ctype@_W@std@@QBEPB_WPB_W0DPAD@Z */
1920 /* ?narrow@?$ctype@_W@std@@QEBAPEB_WPEB_W0DPEAD@Z */
1921 /* ?narrow@?$ctype@G@std@@QBEPBGPBG0DPAD@Z */
1922 /* ?narrow@?$ctype@G@std@@QEBAPEBGPEBG0DPEAD@Z */
1923 DEFINE_THISCALL_WRAPPER(ctype_wchar_narrow, 20)
1924 const wchar_t* __thiscall ctype_wchar_narrow(const ctype_wchar *this,
1925 const wchar_t *first, const wchar_t *last, char dflt, char *dest)
1927 TRACE("(%p %p %p %d %p)\n", this, first, last, dflt, dest);
1928 return call_ctype_wchar_do_narrow(this, first, last, dflt, dest);
1931 /* _Mbrtowc */
1932 int __cdecl _Mbrtowc(wchar_t *out, const char *in, MSVCP_size_t len, int *state, const _Cvtvec *cvt)
1934 int i, cp;
1935 CPINFO cp_info;
1936 BOOL is_lead;
1938 TRACE("(%p %p %lu %p %p)\n", out, in, len, state, cvt);
1940 if(!len)
1941 return 0;
1943 if(cvt)
1944 cp = cvt->page;
1945 else
1946 cp = ___lc_codepage_func();
1948 if(!cp) {
1949 if(out)
1950 *out = (unsigned char)*in;
1952 *state = 0;
1953 return *in ? 1 : 0;
1956 if(*state) {
1957 ((char*)state)[1] = *in;
1959 if(!MultiByteToWideChar(cp, MB_ERR_INVALID_CHARS, (char*)state, 2, out, out ? 1 : 0)) {
1960 *state = 0;
1961 *_errno() = EILSEQ;
1962 return -1;
1965 *state = 0;
1966 return 2;
1969 GetCPInfo(cp, &cp_info);
1970 is_lead = FALSE;
1971 for(i=0; i<MAX_LEADBYTES; i+=2) {
1972 if(!cp_info.LeadByte[i+1])
1973 break;
1974 if((unsigned char)*in>=cp_info.LeadByte[i] && (unsigned char)*in<=cp_info.LeadByte[i+1]) {
1975 is_lead = TRUE;
1976 break;
1980 if(is_lead) {
1981 if(len == 1) {
1982 *state = (unsigned char)*in;
1983 return -2;
1986 if(!MultiByteToWideChar(cp, MB_ERR_INVALID_CHARS, in, 2, out, out ? 1 : 0)) {
1987 *_errno() = EILSEQ;
1988 return -1;
1990 return 2;
1993 if(!MultiByteToWideChar(cp, MB_ERR_INVALID_CHARS, in, 1, out, out ? 1 : 0)) {
1994 *_errno() = EILSEQ;
1995 return -1;
1997 return 1;
2000 static inline wchar_t mb_to_wc(char ch, const _Cvtvec *cvt)
2002 int state = 0;
2003 wchar_t ret;
2005 return _Mbrtowc(&ret, &ch, 1, &state, cvt) == 1 ? ret : 0;
2008 /* ?_Dowiden@?$ctype@_W@std@@IBE_WD@Z */
2009 /* ?_Dowiden@?$ctype@_W@std@@IEBA_WD@Z */
2010 /* ?_Dowiden@?$ctype@G@std@@IBEGD@Z */
2011 /* ?_Dowiden@?$ctype@G@std@@IEBAGD@Z */
2012 static wchar_t ctype_wchar__Dowiden(const ctype_wchar *this, char ch)
2014 wchar_t ret;
2015 int state = 0;
2016 TRACE("(%p %d)\n", this, ch);
2017 return _Mbrtowc(&ret, &ch, 1, &state, &this->cvt)<0 ? WEOF : ret;
2020 /* ?do_widen@?$ctype@_W@std@@MBE_WD@Z */
2021 /* ?do_widen@?$ctype@_W@std@@MEBA_WD@Z */
2022 /* ?do_widen@?$ctype@G@std@@MBEGD@Z */
2023 /* ?do_widen@?$ctype@G@std@@MEBAGD@Z */
2024 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_widen_ch, 8)
2025 #define call_ctype_wchar_do_widen_ch(this, ch) CALL_VTBL_FUNC(this, 40, \
2026 wchar_t, (const ctype_wchar*, char), (this, ch))
2027 wchar_t __thiscall ctype_wchar_do_widen_ch(const ctype_wchar *this, char ch)
2029 return ctype_wchar__Dowiden(this, ch);
2032 /* ?do_widen@?$ctype@_W@std@@MBEPBDPBD0PA_W@Z */
2033 /* ?do_widen@?$ctype@_W@std@@MEBAPEBDPEBD0PEA_W@Z */
2034 /* ?do_widen@?$ctype@G@std@@MBEPBDPBD0PAG@Z */
2035 /* ?do_widen@?$ctype@G@std@@MEBAPEBDPEBD0PEAG@Z */
2036 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_widen, 16)
2037 #define call_ctype_wchar_do_widen(this, first, last, dest) CALL_VTBL_FUNC(this, 36, \
2038 const char*, (const ctype_wchar*, const char*, const char*, wchar_t*), \
2039 (this, first, last, dest))
2040 const char* __thiscall ctype_wchar_do_widen(const ctype_wchar *this,
2041 const char *first, const char *last, wchar_t *dest)
2043 TRACE("(%p %p %p %p)\n", this, first, last, dest);
2044 for(; first<last; first++)
2045 *dest++ = ctype_wchar__Dowiden(this, *first);
2046 return last;
2049 /* ?widen@?$ctype@_W@std@@QBE_WD@Z */
2050 /* ?widen@?$ctype@_W@std@@QEBA_WD@Z */
2051 /* ?widen@?$ctype@G@std@@QBEGD@Z */
2052 /* ?widen@?$ctype@G@std@@QEBAGD@Z */
2053 DEFINE_THISCALL_WRAPPER(ctype_wchar_widen_ch, 8)
2054 wchar_t __thiscall ctype_wchar_widen_ch(const ctype_wchar *this, char ch)
2056 TRACE("(%p %d)\n", this, ch);
2057 return call_ctype_wchar_do_widen_ch(this, ch);
2060 /* ?widen@?$ctype@_W@std@@QBEPBDPBD0PA_W@Z */
2061 /* ?widen@?$ctype@_W@std@@QEBAPEBDPEBD0PEA_W@Z */
2062 /* ?widen@?$ctype@G@std@@QBEPBDPBD0PAG@Z */
2063 /* ?widen@?$ctype@G@std@@QEBAPEBDPEBD0PEAG@Z */
2064 DEFINE_THISCALL_WRAPPER(ctype_wchar_widen, 16)
2065 const char* __thiscall ctype_wchar_widen(const ctype_wchar *this,
2066 const char *first, const char *last, wchar_t *dest)
2068 TRACE("(%p %p %p %p)\n", this, first, last, dest);
2069 return call_ctype_wchar_do_widen(this, first, last, dest);
2072 /* ?_Getcat@?$ctype@_W@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
2073 /* ?_Getcat@?$ctype@_W@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
2074 static MSVCP_size_t ctype_wchar__Getcat(const locale_facet **facet, const locale *loc)
2076 TRACE("(%p %p)\n", facet, loc);
2078 if(facet && !*facet) {
2079 _Locinfo locinfo;
2081 *facet = MSVCRT_operator_new(sizeof(ctype_wchar));
2082 if(!*facet) {
2083 ERR("Out of memory\n");
2084 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
2085 return 0;
2088 _Locinfo_ctor_cstr(&locinfo, basic_string_char_c_str(&loc->ptr->name));
2089 ctype_wchar_ctor_locinfo((ctype_wchar*)*facet, &locinfo, 0);
2090 _Locinfo_dtor(&locinfo);
2093 return LC_CTYPE;
2096 /* ?_Getcat@?$ctype@G@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
2097 /* ?_Getcat@?$ctype@G@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
2098 static MSVCP_size_t ctype_short__Getcat(const locale_facet **facet, const locale *loc)
2100 if(facet && !*facet) {
2101 ctype_wchar__Getcat(facet, loc);
2102 (*(locale_facet**)facet)->vtable = &MSVCP_ctype_short_vtable;
2105 return LC_CTYPE;
2108 /* _Towlower */
2109 static wchar_t _Towlower(wchar_t ch, const _Ctypevec *ctype)
2111 TRACE("(%d %p)\n", ch, ctype);
2112 return tolowerW(ch);
2115 ctype_wchar* ctype_wchar_use_facet(const locale *loc)
2117 static ctype_wchar *obj = NULL;
2119 _Lockit lock;
2120 const locale_facet *fac;
2122 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
2123 fac = locale__Getfacet(loc, locale_id_operator_size_t(&ctype_wchar_id), TRUE);
2124 if(fac) {
2125 _Lockit_dtor(&lock);
2126 return (ctype_wchar*)fac;
2129 if(obj) {
2130 _Lockit_dtor(&lock);
2131 return obj;
2134 ctype_wchar__Getcat(&fac, loc);
2135 obj = (ctype_wchar*)fac;
2136 locale_facet__Incref(&obj->base.facet);
2137 locale_facet_register(&obj->base.facet);
2138 _Lockit_dtor(&lock);
2140 return obj;
2143 ctype_wchar* ctype_short_use_facet(const locale *loc)
2145 static ctype_wchar *obj = NULL;
2147 _Lockit lock;
2148 const locale_facet *fac;
2150 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
2151 fac = locale__Getfacet(loc, locale_id_operator_size_t(&ctype_short_id), TRUE);
2152 if(fac) {
2153 _Lockit_dtor(&lock);
2154 return (ctype_wchar*)fac;
2157 if(obj) {
2158 _Lockit_dtor(&lock);
2159 return obj;
2162 ctype_short__Getcat(&fac, loc);
2163 obj = (ctype_wchar*)fac;
2164 locale_facet__Incref(&obj->base.facet);
2165 locale_facet_register(&obj->base.facet);
2166 _Lockit_dtor(&lock);
2168 return obj;
2171 /* ?do_tolower@?$ctype@_W@std@@MBE_W_W@Z */
2172 /* ?do_tolower@?$ctype@_W@std@@MEBA_W_W@Z */
2173 /* ?do_tolower@?$ctype@G@std@@MBEGG@Z */
2174 /* ?do_tolower@?$ctype@G@std@@MEBAGG@Z */
2175 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_tolower_ch, 8)
2176 #define call_ctype_wchar_do_tolower_ch(this, ch) CALL_VTBL_FUNC(this, 24, \
2177 wchar_t, (const ctype_wchar*, wchar_t), (this, ch))
2178 wchar_t __thiscall ctype_wchar_do_tolower_ch(const ctype_wchar *this, wchar_t ch)
2180 return _Towlower(ch, &this->ctype);
2183 /* ?do_tolower@?$ctype@_W@std@@MBEPB_WPA_WPB_W@Z */
2184 /* ?do_tolower@?$ctype@_W@std@@MEBAPEB_WPEA_WPEB_W@Z */
2185 /* ?do_tolower@?$ctype@G@std@@MBEPBGPAGPBG@Z */
2186 /* ?do_tolower@?$ctype@G@std@@MEBAPEBGPEAGPEBG@Z */
2187 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_tolower, 12)
2188 #define call_ctype_wchar_do_tolower(this, first, last) CALL_VTBL_FUNC(this, 20, \
2189 const wchar_t*, (const ctype_wchar*, wchar_t*, const wchar_t*), \
2190 (this, first, last))
2191 const wchar_t* __thiscall ctype_wchar_do_tolower(const ctype_wchar *this,
2192 wchar_t *first, const wchar_t *last)
2194 TRACE("(%p %p %p)\n", this, first, last);
2195 for(; first<last; first++)
2196 *first = _Towlower(*first, &this->ctype);
2197 return last;
2200 /* ?tolower@?$ctype@_W@std@@QBE_W_W@Z */
2201 /* ?tolower@?$ctype@_W@std@@QEBA_W_W@Z */
2202 /* ?tolower@?$ctype@G@std@@QBEGG@Z */
2203 /* ?tolower@?$ctype@G@std@@QEBAGG@Z */
2204 DEFINE_THISCALL_WRAPPER(ctype_wchar_tolower_ch, 8)
2205 wchar_t __thiscall ctype_wchar_tolower_ch(const ctype_wchar *this, wchar_t ch)
2207 TRACE("(%p %d)\n", this, ch);
2208 return call_ctype_wchar_do_tolower_ch(this, ch);
2211 /* ?tolower@?$ctype@_W@std@@QBEPB_WPA_WPB_W@Z */
2212 /* ?tolower@?$ctype@_W@std@@QEBAPEB_WPEA_WPEB_W@Z */
2213 /* ?tolower@?$ctype@G@std@@QBEPBGPAGPBG@Z */
2214 /* ?tolower@?$ctype@G@std@@QEBAPEBGPEAGPEBG@Z */
2215 DEFINE_THISCALL_WRAPPER(ctype_wchar_tolower, 12)
2216 const wchar_t* __thiscall ctype_wchar_tolower(const ctype_wchar *this,
2217 wchar_t *first, const wchar_t *last)
2219 TRACE("(%p %p %p)\n", this, first, last);
2220 return call_ctype_wchar_do_tolower(this, first, last);
2223 /* _Towupper */
2224 static wchar_t _Towupper(wchar_t ch, const _Ctypevec *ctype)
2226 TRACE("(%d %p)\n", ch, ctype);
2227 return toupperW(ch);
2230 /* ?do_toupper@?$ctype@_W@std@@MBE_W_W@Z */
2231 /* ?do_toupper@?$ctype@_W@std@@MEBA_W_W@Z */
2232 /* ?do_toupper@?$ctype@G@std@@MBEGG@Z */
2233 /* ?do_toupper@?$ctype@G@std@@MEBAGG@Z */
2234 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_toupper_ch, 8)
2235 #define call_ctype_wchar_do_toupper_ch(this, ch) CALL_VTBL_FUNC(this, 32, \
2236 wchar_t, (const ctype_wchar*, wchar_t), (this, ch))
2237 wchar_t __thiscall ctype_wchar_do_toupper_ch(const ctype_wchar *this, wchar_t ch)
2239 return _Towupper(ch, &this->ctype);
2242 /* ?do_toupper@?$ctype@_W@std@@MBEPB_WPA_WPB_W@Z */
2243 /* ?do_toupper@?$ctype@_W@std@@MEBAPEB_WPEA_WPEB_W@Z */
2244 /* ?do_toupper@?$ctype@G@std@@MBEPBGPAGPBG@Z */
2245 /* ?do_toupper@?$ctype@G@std@@MEBAPEBGPEAGPEBG@Z */
2246 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_toupper, 12)
2247 #define call_ctype_wchar_do_toupper(this, first, last) CALL_VTBL_FUNC(this, 28, \
2248 const wchar_t*, (const ctype_wchar*, wchar_t*, const wchar_t*), \
2249 (this, first, last))
2250 const wchar_t* __thiscall ctype_wchar_do_toupper(const ctype_wchar *this,
2251 wchar_t *first, const wchar_t *last)
2253 TRACE("(%p %p %p)\n", this, first, last);
2254 for(; first<last; first++)
2255 *first = _Towupper(*first, &this->ctype);
2256 return last;
2259 /* ?toupper@?$ctype@_W@std@@QBE_W_W@Z */
2260 /* ?toupper@?$ctype@_W@std@@QEBA_W_W@Z */
2261 /* ?toupper@?$ctype@G@std@@QBEGG@Z */
2262 /* ?toupper@?$ctype@G@std@@QEBAGG@Z */
2263 DEFINE_THISCALL_WRAPPER(ctype_wchar_toupper_ch, 8)
2264 wchar_t __thiscall ctype_wchar_toupper_ch(const ctype_wchar *this, wchar_t ch)
2266 TRACE("(%p %d)\n", this, ch);
2267 return call_ctype_wchar_do_toupper_ch(this, ch);
2270 /* ?toupper@?$ctype@_W@std@@QBEPB_WPA_WPB_W@Z */
2271 /* ?toupper@?$ctype@_W@std@@QEBAPEB_WPEA_WPEB_W@Z */
2272 /* ?toupper@?$ctype@G@std@@QBEPBGPAGPBG@Z */
2273 /* ?toupper@?$ctype@G@std@@QEBAPEBGPEAGPEBG@Z */
2274 DEFINE_THISCALL_WRAPPER(ctype_wchar_toupper, 12)
2275 const wchar_t* __thiscall ctype_wchar_toupper(const ctype_wchar *this,
2276 wchar_t *first, const wchar_t *last)
2278 TRACE("(%p %p %p)\n", this, first, last);
2279 return call_ctype_wchar_do_toupper(this, first, last);
2282 /* _Getwctypes */
2283 static const wchar_t* _Getwctypes(const wchar_t *first, const wchar_t *last,
2284 short *mask, const _Ctypevec *ctype)
2286 TRACE("(%p %p %p %p)\n", first, last, mask, ctype);
2287 GetStringTypeW(CT_CTYPE1, first, last-first, (WORD*)mask);
2288 return last;
2291 /* _Getwctype */
2292 static short _Getwctype(wchar_t ch, const _Ctypevec *ctype)
2294 short mask = 0;
2295 _Getwctypes(&ch, &ch+1, &mask, ctype);
2296 return mask;
2299 /* ?do_is@?$ctype@_W@std@@MBE_NF_W@Z */
2300 /* ?do_is@?$ctype@_W@std@@MEBA_NF_W@Z */
2301 /* ?do_is@?$ctype@G@std@@MBE_NFG@Z */
2302 /* ?do_is@?$ctype@G@std@@MEBA_NFG@Z */
2303 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_is_ch, 12)
2304 #define call_ctype_wchar_do_is_ch(this, mask, ch) CALL_VTBL_FUNC(this, 8, \
2305 MSVCP_bool, (const ctype_wchar*, short, wchar_t), (this, mask, ch))
2306 MSVCP_bool __thiscall ctype_wchar_do_is_ch(const ctype_wchar *this, short mask, wchar_t ch)
2308 TRACE("(%p %x %d)\n", this, mask, ch);
2309 return (_Getwctype(ch, &this->ctype) & mask) != 0;
2312 /* ?do_is@?$ctype@_W@std@@MBEPB_WPB_W0PAF@Z */
2313 /* ?do_is@?$ctype@_W@std@@MEBAPEB_WPEB_W0PEAF@Z */
2314 /* ?do_is@?$ctype@G@std@@MBEPBGPBG0PAF@Z */
2315 /* ?do_is@?$ctype@G@std@@MEBAPEBGPEBG0PEAF@Z */
2316 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_is, 16)
2317 #define call_ctype_wchar_do_is(this, first, last, dest) CALL_VTBL_FUNC(this, 4, \
2318 const wchar_t*, (const ctype_wchar*, const wchar_t*, const wchar_t*, short*), \
2319 (this, first, last, dest))
2320 const wchar_t* __thiscall ctype_wchar_do_is(const ctype_wchar *this,
2321 const wchar_t *first, const wchar_t *last, short *dest)
2323 TRACE("(%p %p %p %p)\n", this, first, last, dest);
2324 return _Getwctypes(first, last, dest, &this->ctype);
2327 /* ?is@?$ctype@_W@std@@QBE_NF_W@Z */
2328 /* ?is@?$ctype@_W@std@@QEBA_NF_W@Z */
2329 /* ?is@?$ctype@G@std@@QBE_NFG@Z */
2330 /* ?is@?$ctype@G@std@@QEBA_NFG@Z */
2331 DEFINE_THISCALL_WRAPPER(ctype_wchar_is_ch, 12)
2332 MSVCP_bool __thiscall ctype_wchar_is_ch(const ctype_wchar *this, short mask, wchar_t ch)
2334 TRACE("(%p %x %d)\n", this, mask, ch);
2335 return call_ctype_wchar_do_is_ch(this, mask, ch);
2338 /* ?is@?$ctype@_W@std@@QBEPB_WPB_W0PAF@Z */
2339 /* ?is@?$ctype@_W@std@@QEBAPEB_WPEB_W0PEAF@Z */
2340 /* ?is@?$ctype@G@std@@QBEPBGPBG0PAF@Z */
2341 /* ?is@?$ctype@G@std@@QEBAPEBGPEBG0PEAF@Z */
2342 DEFINE_THISCALL_WRAPPER(ctype_wchar_is, 16)
2343 const wchar_t* __thiscall ctype_wchar_is(const ctype_wchar *this,
2344 const wchar_t *first, const wchar_t *last, short *dest)
2346 TRACE("(%p %p %p %p)\n", this, first, last, dest);
2347 return call_ctype_wchar_do_is(this, first, last, dest);
2350 /* ?do_scan_is@?$ctype@_W@std@@MBEPB_WFPB_W0@Z */
2351 /* ?do_scan_is@?$ctype@_W@std@@MEBAPEB_WFPEB_W0@Z */
2352 /* ?do_scan_is@?$ctype@G@std@@MBEPBGFPBG0@Z */
2353 /* ?do_scan_is@?$ctype@G@std@@MEBAPEBGFPEBG0@Z */
2354 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_scan_is, 16)
2355 #define call_ctype_wchar_do_scan_is(this, mask, first, last) CALL_VTBL_FUNC(this, 12, \
2356 const wchar_t*, (const ctype_wchar*, short, const wchar_t*, const wchar_t*), \
2357 (this, mask, first, last))
2358 const wchar_t* __thiscall ctype_wchar_do_scan_is(const ctype_wchar *this,
2359 short mask, const wchar_t *first, const wchar_t *last)
2361 TRACE("(%p %d %p %p)\n", this, mask, first, last);
2362 for(; first<last; first++)
2363 if(!ctype_wchar_is_ch(this, mask, *first))
2364 break;
2365 return first;
2368 /* ?scan_is@?$ctype@_W@std@@QBEPB_WFPB_W0@Z */
2369 /* ?scan_is@?$ctype@_W@std@@QEBAPEB_WFPEB_W0@Z */
2370 /* ?scan_is@?$ctype@G@std@@QBEPBGFPBG0@Z */
2371 /* ?scan_is@?$ctype@G@std@@QEBAPEBGFPEBG0@Z */
2372 DEFINE_THISCALL_WRAPPER(ctype_wchar_scan_is, 16)
2373 const wchar_t* __thiscall ctype_wchar_scan_is(const ctype_wchar *this,
2374 short mask, const wchar_t *first, const wchar_t *last)
2376 TRACE("(%p %x %p %p)\n", this, mask, first, last);
2377 return call_ctype_wchar_do_scan_is(this, mask, first, last);
2380 /* ?do_scan_not@?$ctype@_W@std@@MBEPB_WFPB_W0@Z */
2381 /* ?do_scan_not@?$ctype@_W@std@@MEBAPEB_WFPEB_W0@Z */
2382 /* ?do_scan_not@?$ctype@G@std@@MBEPBGFPBG0@Z */
2383 /* ?do_scan_not@?$ctype@G@std@@MEBAPEBGFPEBG0@Z */
2384 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_scan_not, 16)
2385 #define call_ctype_wchar_do_scan_not(this, mask, first, last) CALL_VTBL_FUNC(this, 16, \
2386 const wchar_t*, (const ctype_wchar*, short, const wchar_t*, const wchar_t*), \
2387 (this, mask, first, last))
2388 const wchar_t* __thiscall ctype_wchar_do_scan_not(const ctype_wchar *this,
2389 short mask, const wchar_t *first, const wchar_t *last)
2391 TRACE("(%p %x %p %p)\n", this, mask, first, last);
2392 for(; first<last; first++)
2393 if(ctype_wchar_is_ch(this, mask, *first))
2394 break;
2395 return first;
2398 /* ?scan_not@?$ctype@_W@std@@QBEPB_WFPB_W0@Z */
2399 /* ?scan_not@?$ctype@_W@std@@QEBAPEB_WFPEB_W0@Z */
2400 /* ?scan_not@?$ctype@G@std@@QBEPBGFPBG0@Z */
2401 /* ?scan_not@?$ctype@G@std@@QEBAPEBGFPEBG0@Z */
2402 DEFINE_THISCALL_WRAPPER(ctype_wchar_scan_not, 16)
2403 const wchar_t* __thiscall ctype_wchar_scan_not(const ctype_wchar *this,
2404 short mask, const wchar_t *first, const wchar_t *last)
2406 TRACE("(%p %x %p %p)\n", this, mask, first, last);
2407 return call_ctype_wchar_do_scan_not(this, mask, first, last);
2410 /* ??_7codecvt_base@std@@6B@ */
2411 extern const vtable_ptr MSVCP_codecvt_base_vtable;
2413 /* ??0codecvt_base@std@@QAE@I@Z */
2414 /* ??0codecvt_base@std@@QEAA@_K@Z */
2415 DEFINE_THISCALL_WRAPPER(codecvt_base_ctor_refs, 8)
2416 codecvt_base* __thiscall codecvt_base_ctor_refs(codecvt_base *this, MSVCP_size_t refs)
2418 TRACE("(%p %lu)\n", this, refs);
2419 locale_facet_ctor_refs(&this->facet, refs);
2420 this->facet.vtable = &MSVCP_codecvt_base_vtable;
2421 return this;
2424 /* ??_Fcodecvt_base@std@@QAEXXZ */
2425 /* ??_Fcodecvt_base@std@@QEAAXXZ */
2426 DEFINE_THISCALL_WRAPPER(codecvt_base_ctor, 4)
2427 codecvt_base* __thiscall codecvt_base_ctor(codecvt_base *this)
2429 return codecvt_base_ctor_refs(this, 0);
2432 /* ??1codecvt_base@std@@UAE@XZ */
2433 /* ??1codecvt_base@std@@UEAA@XZ */
2434 DEFINE_THISCALL_WRAPPER(codecvt_base_dtor, 4)
2435 void __thiscall codecvt_base_dtor(codecvt_base *this)
2437 TRACE("(%p)\n", this);
2438 locale_facet_dtor(&this->facet);
2441 DEFINE_THISCALL_WRAPPER(codecvt_base_vector_dtor, 8)
2442 codecvt_base* __thiscall codecvt_base_vector_dtor(codecvt_base *this, unsigned int flags)
2444 TRACE("(%p %x)\n", this, flags);
2445 if(flags & 2) {
2446 /* we have an array, with the number of elements stored before the first object */
2447 INT_PTR i, *ptr = (INT_PTR *)this-1;
2449 for(i=*ptr-1; i>=0; i--)
2450 codecvt_base_dtor(this+i);
2451 MSVCRT_operator_delete(ptr);
2452 } else {
2453 codecvt_base_dtor(this);
2454 if(flags & 1)
2455 MSVCRT_operator_delete(this);
2458 return this;
2461 /* ?do_always_noconv@codecvt_base@std@@MBE_NXZ */
2462 /* ?do_always_noconv@codecvt_base@std@@MEBA_NXZ */
2463 #define call_codecvt_base_do_always_noconv(this) CALL_VTBL_FUNC(this, 4, \
2464 MSVCP_bool, (const codecvt_base*), (this))
2465 DEFINE_THISCALL_WRAPPER(codecvt_base_do_always_noconv, 4)
2466 MSVCP_bool __thiscall codecvt_base_do_always_noconv(const codecvt_base *this)
2468 TRACE("(%p)\n", this);
2469 return TRUE;
2472 /* ?always_noconv@codecvt_base@std@@QBE_NXZ */
2473 /* ?always_noconv@codecvt_base@std@@QEBA_NXZ */
2474 DEFINE_THISCALL_WRAPPER(codecvt_base_always_noconv, 4)
2475 MSVCP_bool __thiscall codecvt_base_always_noconv(const codecvt_base *this)
2477 TRACE("(%p)\n", this);
2478 return call_codecvt_base_do_always_noconv(this);
2481 /* ?do_max_length@codecvt_base@std@@MBEHXZ */
2482 /* ?do_max_length@codecvt_base@std@@MEBAHXZ */
2483 #define call_codecvt_base_do_max_length(this) CALL_VTBL_FUNC(this, 8, \
2484 int, (const codecvt_base*), (this))
2485 DEFINE_THISCALL_WRAPPER(codecvt_base_do_max_length, 4)
2486 int __thiscall codecvt_base_do_max_length(const codecvt_base *this)
2488 TRACE("(%p)\n", this);
2489 return 1;
2492 /* ?max_length@codecvt_base@std@@QBEHXZ */
2493 /* ?max_length@codecvt_base@std@@QEBAHXZ */
2494 DEFINE_THISCALL_WRAPPER(codecvt_base_max_length, 4)
2495 int __thiscall codecvt_base_max_length(const codecvt_base *this)
2497 TRACE("(%p)\n", this);
2498 return call_codecvt_base_do_max_length(this);
2501 /* ?do_encoding@codecvt_base@std@@MBEHXZ */
2502 /* ?do_encoding@codecvt_base@std@@MEBAHXZ */
2503 #define call_codecvt_base_do_encoding(this) CALL_VTBL_FUNC(this, 12, \
2504 int, (const codecvt_base*), (this))
2505 DEFINE_THISCALL_WRAPPER(codecvt_base_do_encoding, 4)
2506 int __thiscall codecvt_base_do_encoding(const codecvt_base *this)
2508 TRACE("(%p)\n", this);
2509 return 1;
2512 /* ?encoding@codecvt_base@std@@QBEHXZ */
2513 /* ?encoding@codecvt_base@std@@QEBAHXZ */
2514 DEFINE_THISCALL_WRAPPER(codecvt_base_encoding, 4)
2515 int __thiscall codecvt_base_encoding(const codecvt_base *this)
2517 TRACE("(%p)\n", this);
2518 return call_codecvt_base_do_encoding(this);
2521 /* ?id@?$codecvt@DDH@std@@2V0locale@2@A */
2522 locale_id codecvt_char_id = {0};
2524 /* ??_7?$codecvt@DDH@std@@6B@ */
2525 extern const vtable_ptr MSVCP_codecvt_char_vtable;
2527 /* ?_Init@?$codecvt@DDH@std@@IAEXABV_Locinfo@2@@Z */
2528 /* ?_Init@?$codecvt@DDH@std@@IEAAXAEBV_Locinfo@2@@Z */
2529 DEFINE_THISCALL_WRAPPER(codecvt_char__Init, 8)
2530 void __thiscall codecvt_char__Init(codecvt_char *this, const _Locinfo *locinfo)
2532 TRACE("(%p %p)\n", this, locinfo);
2535 /* ??0?$codecvt@DDH@std@@QAE@ABV_Locinfo@1@I@Z */
2536 /* ??0?$codecvt@DDH@std@@QEAA@AEBV_Locinfo@1@_K@Z */
2537 DEFINE_THISCALL_WRAPPER(codecvt_char_ctor_locinfo, 12)
2538 codecvt_char* __thiscall codecvt_char_ctor_locinfo(codecvt_char *this, const _Locinfo *locinfo, MSVCP_size_t refs)
2540 TRACE("(%p %p %lu)\n", this, locinfo, refs);
2541 codecvt_base_ctor_refs(&this->base, refs);
2542 this->base.facet.vtable = &MSVCP_codecvt_char_vtable;
2543 return this;
2546 /* ??0?$codecvt@DDH@std@@QAE@I@Z */
2547 /* ??0?$codecvt@DDH@std@@QEAA@_K@Z */
2548 DEFINE_THISCALL_WRAPPER(codecvt_char_ctor_refs, 8)
2549 codecvt_char* __thiscall codecvt_char_ctor_refs(codecvt_char *this, MSVCP_size_t refs)
2551 return codecvt_char_ctor_locinfo(this, NULL, refs);
2554 /* ??_F?$codecvt@DDH@std@@QAEXXZ */
2555 /* ??_F?$codecvt@DDH@std@@QEAAXXZ */
2556 DEFINE_THISCALL_WRAPPER(codecvt_char_ctor, 4)
2557 codecvt_char* __thiscall codecvt_char_ctor(codecvt_char *this)
2559 return codecvt_char_ctor_locinfo(this, NULL, 0);
2562 /* ??1?$codecvt@DDH@std@@UAE@XZ */
2563 /* ??1?$codecvt@DDH@std@@UEAA@XZ */
2564 DEFINE_THISCALL_WRAPPER(codecvt_char_dtor, 4)
2565 void __thiscall codecvt_char_dtor(codecvt_char *this)
2567 TRACE("(%p)\n", this);
2568 codecvt_base_dtor(&this->base);
2571 DEFINE_THISCALL_WRAPPER(codecvt_char_vector_dtor, 8)
2572 codecvt_char* __thiscall codecvt_char_vector_dtor(codecvt_char *this, unsigned int flags)
2574 TRACE("(%p %x)\n", this, flags);
2575 if(flags & 2) {
2576 /* we have an array, with the number of elements stored before the first object */
2577 INT_PTR i, *ptr = (INT_PTR *)this-1;
2579 for(i=*ptr-1; i>=0; i--)
2580 codecvt_char_dtor(this+i);
2581 MSVCRT_operator_delete(ptr);
2582 } else {
2583 codecvt_char_dtor(this);
2584 if(flags & 1)
2585 MSVCRT_operator_delete(this);
2588 return this;
2591 /* ?_Getcat@?$codecvt@DDH@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
2592 /* ?_Getcat@?$codecvt@DDH@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
2593 static MSVCP_size_t codecvt_char__Getcat(const locale_facet **facet, const locale *loc)
2595 TRACE("(%p %p)\n", facet, loc);
2597 if(facet && !*facet) {
2598 *facet = MSVCRT_operator_new(sizeof(codecvt_char));
2599 if(!*facet) {
2600 ERR("Out of memory\n");
2601 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
2602 return 0;
2604 codecvt_char_ctor((codecvt_char*)*facet);
2607 return LC_CTYPE;
2610 codecvt_char* codecvt_char_use_facet(const locale *loc)
2612 static codecvt_char *obj = NULL;
2614 _Lockit lock;
2615 const locale_facet *fac;
2617 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
2618 fac = locale__Getfacet(loc, locale_id_operator_size_t(&codecvt_char_id), TRUE);
2619 if(fac) {
2620 _Lockit_dtor(&lock);
2621 return (codecvt_char*)fac;
2624 if(obj) {
2625 _Lockit_dtor(&lock);
2626 return obj;
2629 codecvt_char__Getcat(&fac, loc);
2630 obj = (codecvt_char*)fac;
2631 locale_facet__Incref(&obj->base.facet);
2632 locale_facet_register(&obj->base.facet);
2633 _Lockit_dtor(&lock);
2635 return obj;
2638 /* ?do_in@?$codecvt@DDH@std@@MBEHAAHPBD1AAPBDPAD3AAPAD@Z */
2639 /* ?do_in@?$codecvt@DDH@std@@MEBAHAEAHPEBD1AEAPEBDPEAD3AEAPEAD@Z */
2640 #define call_codecvt_char_do_in(this, state, from, from_end, from_next, to, to_end, to_next) \
2641 CALL_VTBL_FUNC(this, 16, int, \
2642 (const codecvt_char*, int*, const char*, const char*, const char**, char*, char*, char**), \
2643 (this, state, from, from_end, from_next, to, to_end, to_next))
2644 DEFINE_THISCALL_WRAPPER(codecvt_char_do_in, 32)
2645 int __thiscall codecvt_char_do_in(const codecvt_char *this, int *state,
2646 const char *from, const char *from_end, const char **from_next,
2647 char *to, char *to_end, char **to_next)
2649 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from, from_end,
2650 from_next, to, to_end, to_next);
2651 *from_next = from;
2652 *to_next = to;
2653 return CODECVT_noconv;
2656 /* ?in@?$codecvt@DDH@std@@QBEHAAHPBD1AAPBDPAD3AAPAD@Z */
2657 /* ?in@?$codecvt@DDH@std@@QEBAHAEAHPEBD1AEAPEBDPEAD3AEAPEAD@Z */
2658 DEFINE_THISCALL_WRAPPER(codecvt_char_in, 32)
2659 int __thiscall codecvt_char_in(const codecvt_char *this, int *state,
2660 const char *from, const char *from_end, const char **from_next,
2661 char *to, char *to_end, char **to_next)
2663 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from, from_end,
2664 from_next, to, to_end, to_next);
2665 return call_codecvt_char_do_in(this, state, from, from_end, from_next,
2666 to, to_end, to_next);
2669 /* ?do_out@?$codecvt@DDH@std@@MBEHAAHPBD1AAPBDPAD3AAPAD@Z */
2670 /* ?do_out@?$codecvt@DDH@std@@MEBAHAEAHPEBD1AEAPEBDPEAD3AEAPEAD@Z */
2671 #define call_codecvt_char_do_out(this, state, from, from_end, from_next, to, to_end, to_next) \
2672 CALL_VTBL_FUNC(this, 20, int, \
2673 (const codecvt_char*, int*, const char*, const char*, const char**, char*, char*, char**), \
2674 (this, state, from, from_end, from_next, to, to_end, to_next))
2675 DEFINE_THISCALL_WRAPPER(codecvt_char_do_out, 32)
2676 int __thiscall codecvt_char_do_out(const codecvt_char *this, int *state,
2677 const char *from, const char *from_end, const char **from_next,
2678 char *to, char *to_end, char **to_next)
2680 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from,
2681 from_end, from_next, to, to_end, to_next);
2682 *from_next = from;
2683 *to_next = to;
2684 return CODECVT_noconv;
2687 /* ?out@?$codecvt@DDH@std@@QBEHAAHPBD1AAPBDPAD3AAPAD@Z */
2688 /* ?out@?$codecvt@DDH@std@@QEBAHAEAHPEBD1AEAPEBDPEAD3AEAPEAD@Z */
2689 DEFINE_THISCALL_WRAPPER(codecvt_char_out, 32)
2690 int __thiscall codecvt_char_out(const codecvt_char *this, int *state,
2691 const char *from, const char *from_end, const char **from_next,
2692 char *to, char *to_end, char **to_next)
2694 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from, from_end,
2695 from_next, to, to_end, to_next);
2696 return call_codecvt_char_do_out(this, state, from, from_end, from_next,
2697 to, to_end, to_next);
2700 /* ?do_unshift@?$codecvt@DDH@std@@MBEHAAHPAD1AAPAD@Z */
2701 /* ?do_unshift@?$codecvt@DDH@std@@MEBAHAEAHPEAD1AEAPEAD@Z */
2702 #define call_codecvt_char_do_unshift(this, state, to, to_end, to_next) CALL_VTBL_FUNC(this, 24, \
2703 int, (const codecvt_char*, int*, char*, char*, char**), (this, state, to, to_end, to_next))
2704 DEFINE_THISCALL_WRAPPER(codecvt_char_do_unshift, 20)
2705 int __thiscall codecvt_char_do_unshift(const codecvt_char *this,
2706 int *state, char *to, char *to_end, char **to_next)
2708 TRACE("(%p %p %p %p %p)\n", this, state, to, to_end, to_next);
2709 *to_next = to;
2710 return CODECVT_noconv;
2713 /* ?do_length@?$codecvt@DDH@std@@MBEHABHPBD1I@Z */
2714 /* ?do_length@?$codecvt@DDH@std@@MEBAHAEBHPEBD1_K@Z */
2715 #define call_codecvt_char_do_length(this, state, from, from_end, max) CALL_VTBL_FUNC(this, 28, \
2716 int, (const codecvt_char*, const int*, const char*, const char*, MSVCP_size_t), \
2717 (this, state, from, from_end, max))
2718 DEFINE_THISCALL_WRAPPER(codecvt_char_do_length, 20)
2719 int __thiscall codecvt_char_do_length(const codecvt_char *this, const int *state,
2720 const char *from, const char *from_end, MSVCP_size_t max)
2722 TRACE("(%p %p %p %p %lu)\n", this, state, from, from_end, max);
2723 return (from_end-from > max ? max : from_end-from);
2726 /* ?length@?$codecvt@DDH@std@@QBEHABHPBD1I@Z */
2727 /* ?length@?$codecvt@DDH@std@@QEBAHAEBHPEBD1_K@Z */
2728 DEFINE_THISCALL_WRAPPER(codecvt_char_length, 20)
2729 int __thiscall codecvt_char_length(const codecvt_char *this, const int *state,
2730 const char *from, const char *from_end, MSVCP_size_t max)
2732 TRACE("(%p %p %p %p %lu)\n", this, state, from, from_end, max);
2733 return call_codecvt_char_do_length(this, state, from, from_end, max);
2736 /* ?id@?$codecvt@_WDH@std@@2V0locale@2@A */
2737 static locale_id codecvt_wchar_id = {0};
2738 /* ?id@?$codecvt@GDH@std@@2V0locale@2@A */
2739 locale_id codecvt_short_id = {0};
2741 /* ??_7?$codecvt@_WDH@std@@6B@ */
2742 extern const vtable_ptr MSVCP_codecvt_wchar_vtable;
2743 /* ??_7?$codecvt@GDH@std@@6B@ */
2744 extern const vtable_ptr MSVCP_codecvt_short_vtable;
2746 /* ?_Init@?$codecvt@GDH@std@@IAEXABV_Locinfo@2@@Z */
2747 /* ?_Init@?$codecvt@GDH@std@@IEAAXAEBV_Locinfo@2@@Z */
2748 /* ?_Init@?$codecvt@_WDH@std@@IAEXABV_Locinfo@2@@Z */
2749 /* ?_Init@?$codecvt@_WDH@std@@IEAAXAEBV_Locinfo@2@@Z */
2750 DEFINE_THISCALL_WRAPPER(codecvt_wchar__Init, 8)
2751 void __thiscall codecvt_wchar__Init(codecvt_wchar *this, const _Locinfo *locinfo)
2753 TRACE("(%p %p)\n", this, locinfo);
2754 _Locinfo__Getcvt(locinfo, &this->cvt);
2757 /* ??0?$codecvt@_WDH@std@@QAE@ABV_Locinfo@1@I@Z */
2758 /* ??0?$codecvt@_WDH@std@@QEAA@AEBV_Locinfo@1@_K@Z */
2759 static codecvt_wchar* codecvt_wchar_ctor_locinfo(codecvt_wchar *this, const _Locinfo *locinfo, MSVCP_size_t refs)
2761 TRACE("(%p %p %ld)\n", this, locinfo, refs);
2763 codecvt_base_ctor_refs(&this->base, refs);
2764 this->base.facet.vtable = &MSVCP_codecvt_wchar_vtable;
2766 codecvt_wchar__Init(this, locinfo);
2767 return this;
2770 /* ??0?$codecvt@GDH@std@@QAE@ABV_Locinfo@1@I@Z */
2771 /* ??0?$codecvt@GDH@std@@QEAA@AEBV_Locinfo@1@_K@Z */
2772 DEFINE_THISCALL_WRAPPER(codecvt_short_ctor_locinfo, 12)
2773 codecvt_wchar* __thiscall codecvt_short_ctor_locinfo(codecvt_wchar *this, const _Locinfo *locinfo, MSVCP_size_t refs)
2775 TRACE("(%p %p %ld)\n", this, locinfo, refs);
2777 codecvt_wchar_ctor_locinfo(this, locinfo, refs);
2778 this->base.facet.vtable = &MSVCP_codecvt_short_vtable;
2779 return this;
2782 /* ??0?$codecvt@GDH@std@@QAE@I@Z */
2783 /* ??0?$codecvt@GDH@std@@QEAA@_K@Z */
2784 DEFINE_THISCALL_WRAPPER(codecvt_short_ctor_refs, 8)
2785 codecvt_wchar* __thiscall codecvt_short_ctor_refs(codecvt_wchar *this, MSVCP_size_t refs)
2787 _Locinfo locinfo;
2789 TRACE("(%p %ld)\n", this, refs);
2791 _Locinfo_ctor(&locinfo);
2792 codecvt_short_ctor_locinfo(this, &locinfo, refs);
2793 _Locinfo_dtor(&locinfo);
2794 return this;
2797 /* ??_F?$codecvt@GDH@std@@QAEXXZ */
2798 /* ??_F?$codecvt@GDH@std@@QEAAXXZ */
2799 DEFINE_THISCALL_WRAPPER(codecvt_short_ctor, 4)
2800 codecvt_wchar* __thiscall codecvt_short_ctor(codecvt_wchar *this)
2802 return codecvt_short_ctor_refs(this, 0);
2805 /* ??1?$codecvt@GDH@std@@UAE@XZ */
2806 /* ??1?$codecvt@GDH@std@@UEAA@XZ */
2807 DEFINE_THISCALL_WRAPPER(codecvt_wchar_dtor, 4)
2808 void __thiscall codecvt_wchar_dtor(codecvt_wchar *this)
2810 TRACE("(%p)\n", this);
2811 codecvt_base_dtor(&this->base);
2814 DEFINE_THISCALL_WRAPPER(codecvt_wchar_vector_dtor, 8)
2815 codecvt_wchar* __thiscall codecvt_wchar_vector_dtor(codecvt_wchar *this, unsigned int flags)
2817 TRACE("(%p %x)\n", this, flags);
2818 if(flags & 2) {
2819 /* we have an array, with the number of elements stored before the first object */
2820 INT_PTR i, *ptr = (INT_PTR *)this-1;
2822 for(i=*ptr-1; i>=0; i--)
2823 codecvt_wchar_dtor(this+i);
2824 MSVCRT_operator_delete(ptr);
2825 } else {
2826 codecvt_wchar_dtor(this);
2827 if(flags & 1)
2828 MSVCRT_operator_delete(this);
2831 return this;
2834 /* ?_Getcat@?$codecvt@_WDH@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
2835 /* ?_Getcat@?$codecvt@_WDH@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
2836 static MSVCP_size_t codecvt_wchar__Getcat(const locale_facet **facet, const locale *loc)
2838 TRACE("(%p %p)\n", facet, loc);
2840 if(facet && !*facet) {
2841 _Locinfo locinfo;
2843 *facet = MSVCRT_operator_new(sizeof(codecvt_wchar));
2844 if(!*facet) {
2845 ERR("Out of memory\n");
2846 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
2847 return 0;
2850 _Locinfo_ctor_cstr(&locinfo, basic_string_char_c_str(&loc->ptr->name));
2851 codecvt_wchar_ctor_locinfo((codecvt_wchar*)*facet, &locinfo, 0);
2852 _Locinfo_dtor(&locinfo);
2855 return LC_CTYPE;
2858 static codecvt_wchar* codecvt_wchar_use_facet(const locale *loc)
2860 static codecvt_wchar *obj = NULL;
2862 _Lockit lock;
2863 const locale_facet *fac;
2865 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
2866 fac = locale__Getfacet(loc, locale_id_operator_size_t(&codecvt_wchar_id), TRUE);
2867 if(fac) {
2868 _Lockit_dtor(&lock);
2869 return (codecvt_wchar*)fac;
2872 if(obj) {
2873 _Lockit_dtor(&lock);
2874 return obj;
2877 codecvt_wchar__Getcat(&fac, loc);
2878 obj = (codecvt_wchar*)fac;
2879 locale_facet__Incref(&obj->base.facet);
2880 locale_facet_register(&obj->base.facet);
2881 _Lockit_dtor(&lock);
2883 return obj;
2886 /* ?_Getcat@?$codecvt@GDH@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
2887 /* ?_Getcat@?$codecvt@GDH@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
2888 static MSVCP_size_t codecvt_short__Getcat(const locale_facet **facet, const locale *loc)
2890 TRACE("(%p %p)\n", facet, loc);
2892 if(facet && !*facet) {
2893 _Locinfo locinfo;
2895 *facet = MSVCRT_operator_new(sizeof(codecvt_wchar));
2896 if(!*facet) {
2897 ERR("Out of memory\n");
2898 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
2899 return 0;
2902 _Locinfo_ctor_cstr(&locinfo, basic_string_char_c_str(&loc->ptr->name));
2903 codecvt_short_ctor((codecvt_wchar*)*facet);
2904 _Locinfo_dtor(&locinfo);
2907 return LC_CTYPE;
2910 codecvt_wchar* codecvt_short_use_facet(const locale *loc)
2912 static codecvt_wchar *obj = NULL;
2914 _Lockit lock;
2915 const locale_facet *fac;
2917 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
2918 fac = locale__Getfacet(loc, locale_id_operator_size_t(&codecvt_short_id), TRUE);
2919 if(fac) {
2920 _Lockit_dtor(&lock);
2921 return (codecvt_wchar*)fac;
2924 if(obj) {
2925 _Lockit_dtor(&lock);
2926 return obj;
2929 codecvt_short__Getcat(&fac, loc);
2930 obj = (codecvt_wchar*)fac;
2931 locale_facet__Incref(&obj->base.facet);
2932 locale_facet_register(&obj->base.facet);
2933 _Lockit_dtor(&lock);
2935 return obj;
2938 /* ?do_always_noconv@?$codecvt@GDH@std@@MBE_NXZ */
2939 /* ?do_always_noconv@?$codecvt@GDH@std@@MEBA_NXZ */
2940 /* ?do_always_noconv@?$codecvt@_WDH@std@@MBE_NXZ */
2941 /* ?do_always_noconv@?$codecvt@_WDH@std@@MEBA_NXZ */
2942 DEFINE_THISCALL_WRAPPER(codecvt_wchar_do_always_noconv, 4)
2943 MSVCP_bool __thiscall codecvt_wchar_do_always_noconv(const codecvt_wchar *this)
2945 TRACE("(%p)\n", this);
2946 return FALSE;
2949 /* ?do_max_length@?$codecvt@GDH@std@@MBEHXZ */
2950 /* ?do_max_length@?$codecvt@GDH@std@@MEBAHXZ */
2951 /* ?do_max_length@?$codecvt@_WDH@std@@MBEHXZ */
2952 /* ?do_max_length@?$codecvt@_WDH@std@@MEBAHXZ */
2953 DEFINE_THISCALL_WRAPPER(codecvt_wchar_do_max_length, 4)
2954 int __thiscall codecvt_wchar_do_max_length(const codecvt_wchar *this)
2956 TRACE("(%p)\n", this);
2957 return MB_LEN_MAX;
2960 /* ?do_in@?$codecvt@GDH@std@@MBEHAAHPBD1AAPBDPAG3AAPAG@Z */
2961 /* ?do_in@?$codecvt@GDH@std@@MEBAHAEAHPEBD1AEAPEBDPEAG3AEAPEAG@Z */
2962 /* ?do_in@?$codecvt@_WDH@std@@MBEHAAHPBD1AAPBDPA_W3AAPA_W@Z */
2963 /* ?do_in@?$codecvt@_WDH@std@@MEBAHAEAHPEBD1AEAPEBDPEA_W3AEAPEA_W@Z */
2964 #define call_codecvt_wchar_do_in(this, state, from, from_end, from_next, to, to_end, to_next) \
2965 CALL_VTBL_FUNC(this, 16, int, \
2966 (const codecvt_wchar*, int*, const char*, const char*, const char**, wchar_t*, wchar_t*, wchar_t**), \
2967 (this, state, from, from_end, from_next, to, to_end, to_next))
2968 DEFINE_THISCALL_WRAPPER(codecvt_wchar_do_in, 32)
2969 int __thiscall codecvt_wchar_do_in(const codecvt_wchar *this, int *state,
2970 const char *from, const char *from_end, const char **from_next,
2971 wchar_t *to, wchar_t *to_end, wchar_t **to_next)
2973 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from,
2974 from_end, from_next, to, to_end, to_next);
2976 *from_next = from;
2977 *to_next = to;
2979 while(*from_next!=from_end && *to_next!=to_end) {
2980 switch(_Mbrtowc(*to_next, *from_next, from_end-*from_next, state, &this->cvt)) {
2981 case -2:
2982 *from_next = from_end;
2983 return CODECVT_partial;
2984 case -1:
2985 return CODECVT_error;
2986 case 2:
2987 (*from_next)++;
2988 /* fall through */
2989 case 0:
2990 case 1:
2991 (*from_next)++;
2992 (*to_next)++;
2996 return CODECVT_ok;
2999 /* ?in@?$codecvt@GDH@std@@QBEHAAHPBD1AAPBDPAG3AAPAG@Z */
3000 /* ?in@?$codecvt@GDH@std@@QEBAHAEAHPEBD1AEAPEBDPEAG3AEAPEAG@Z */
3001 /* ?in@?$codecvt@_WDH@std@@QBEHAAHPBD1AAPBDPA_W3AAPA_W@Z */
3002 /* ?in@?$codecvt@_WDH@std@@QEBAHAEAHPEBD1AEAPEBDPEA_W3AEAPEA_W@Z */
3003 DEFINE_THISCALL_WRAPPER(codecvt_wchar_in, 32)
3004 int __thiscall codecvt_wchar_in(const codecvt_wchar *this, int *state,
3005 const char *from, const char *from_end, const char **from_next,
3006 wchar_t *to, wchar_t *to_end, wchar_t **to_next)
3008 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from,
3009 from_end, from_next, to, to_end, to_next);
3010 return call_codecvt_wchar_do_in(this, state, from,
3011 from_end, from_next, to, to_end, to_next);
3014 /* ?do_out@?$codecvt@GDH@std@@MBEHAAHPBG1AAPBGPAD3AAPAD@Z */
3015 /* ?do_out@?$codecvt@GDH@std@@MEBAHAEAHPEBG1AEAPEBGPEAD3AEAPEAD@Z */
3016 /* ?do_out@?$codecvt@_WDH@std@@MBEHAAHPB_W1AAPB_WPAD3AAPAD@Z */
3017 /* ?do_out@?$codecvt@_WDH@std@@MEBAHAEAHPEB_W1AEAPEB_WPEAD3AEAPEAD@Z */
3018 #define call_codecvt_wchar_do_out(this, state, from, from_end, from_next, to, to_end, to_next) \
3019 CALL_VTBL_FUNC(this, 20, int, \
3020 (const codecvt_wchar*, int*, const wchar_t*, const wchar_t*, const wchar_t**, char*, char*, char**), \
3021 (this, state, from, from_end, from_next, to, to_end, to_next))
3022 DEFINE_THISCALL_WRAPPER(codecvt_wchar_do_out, 32)
3023 int __thiscall codecvt_wchar_do_out(const codecvt_wchar *this, int *state,
3024 const wchar_t *from, const wchar_t *from_end, const wchar_t **from_next,
3025 char *to, char *to_end, char **to_next)
3027 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from,
3028 from_end, from_next, to, to_end, to_next);
3030 *from_next = from;
3031 *to_next = to;
3033 while(*from_next!=from_end && *to_next!=to_end) {
3034 int old_state = *state, size;
3035 char buf[MB_LEN_MAX];
3037 switch((size = _Wcrtomb(buf, **from_next, state, &this->cvt))) {
3038 case -1:
3039 return CODECVT_error;
3040 default:
3041 if(size > from_end-*from_next) {
3042 *state = old_state;
3043 return CODECVT_partial;
3046 (*from_next)++;
3047 memcpy_s(*to_next, to_end-*to_next, buf, size);
3048 (*to_next) += size;
3052 return CODECVT_ok;
3055 /* ?out@?$codecvt@GDH@std@@QBEHAAHPBG1AAPBGPAD3AAPAD@Z */
3056 /* ?out@?$codecvt@GDH@std@@QEBAHAEAHPEBG1AEAPEBGPEAD3AEAPEAD@Z */
3057 /* ?out@?$codecvt@_WDH@std@@QBEHAAHPB_W1AAPB_WPAD3AAPAD@Z */
3058 /* ?out@?$codecvt@_WDH@std@@QEBAHAEAHPEB_W1AEAPEB_WPEAD3AEAPEAD@Z */
3059 DEFINE_THISCALL_WRAPPER(codecvt_wchar_out, 32)
3060 int __thiscall codecvt_wchar_out(const codecvt_wchar *this, int *state,
3061 const wchar_t *from, const wchar_t *from_end, const wchar_t **from_next,
3062 char *to, char *to_end, char **to_next)
3064 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from,
3065 from_end, from_next, to, to_end, to_next);
3066 return call_codecvt_wchar_do_out(this, state, from,
3067 from_end, from_next, to, to_end, to_next);
3070 /* ?do_unshift@?$codecvt@GDH@std@@MBEHAAHPAD1AAPAD@Z */
3071 /* ?do_unshift@?$codecvt@GDH@std@@MEBAHAEAHPEAD1AEAPEAD@Z */
3072 /* ?do_unshift@?$codecvt@_WDH@std@@MBEHAAHPAD1AAPAD@Z */
3073 /* ?do_unshift@?$codecvt@_WDH@std@@MEBAHAEAHPEAD1AEAPEAD@Z */
3074 #define call_codecvt_wchar_do_unshift(this, state, to, to_end, to_next) CALL_VTBL_FUNC(this, 24, \
3075 int, (const codecvt_wchar*, int*, char*, char*, char**), (this, state, to, to_end, to_next))
3076 DEFINE_THISCALL_WRAPPER(codecvt_wchar_do_unshift, 20)
3077 int __thiscall codecvt_wchar_do_unshift(const codecvt_wchar *this,
3078 int *state, char *to, char *to_end, char **to_next)
3080 TRACE("(%p %p %p %p %p)\n", this, state, to, to_end, to_next);
3081 if(*state)
3082 WARN("unexpected state: %x\n", *state);
3084 *to_next = to;
3085 return CODECVT_ok;
3088 /* ?do_length@?$codecvt@GDH@std@@MBEHABHPBD1I@Z */
3089 /* ?do_length@?$codecvt@GDH@std@@MEBAHAEBHPEBD1_K@Z */
3090 /* ?do_length@?$codecvt@_WDH@std@@MBEHABHPBD1I@Z */
3091 /* ?do_length@?$codecvt@_WDH@std@@MEBAHAEBHPEBD1_K@Z */
3092 #define call_codecvt_wchar_do_length(this, state, from, from_end, max) CALL_VTBL_FUNC(this, 28, \
3093 int, (const codecvt_wchar*, const int*, const char*, const char*, MSVCP_size_t), \
3094 (this, state, from, from_end, max))
3095 DEFINE_THISCALL_WRAPPER(codecvt_wchar_do_length, 20)
3096 int __thiscall codecvt_wchar_do_length(const codecvt_wchar *this, const int *state,
3097 const char *from, const char *from_end, MSVCP_size_t max)
3099 int tmp_state = *state, ret=0;
3101 TRACE("(%p %p %p %p %ld)\n", this, state, from, from_end, max);
3103 while(ret<max && from!=from_end) {
3104 switch(_Mbrtowc(NULL, from, from_end-from, &tmp_state, &this->cvt)) {
3105 case -2:
3106 case -1:
3107 return ret;
3108 case 2:
3109 from++;
3110 /* fall through */
3111 case 0:
3112 case 1:
3113 from++;
3114 ret++;
3118 return ret;
3121 /* ?id@?$numpunct@D@std@@2V0locale@2@A */
3122 locale_id numpunct_char_id = {0};
3124 /* ??_7?$numpunct@D@std@@6B@ */
3125 extern const vtable_ptr MSVCP_numpunct_char_vtable;
3127 /* ?_Init@?$numpunct@D@std@@IAEXABV_Locinfo@2@_N@Z */
3128 /* ?_Init@?$numpunct@D@std@@IEAAXAEBV_Locinfo@2@_N@Z */
3129 static void numpunct_char__Init(numpunct_char *this, const _Locinfo *locinfo, MSVCP_bool isdef)
3131 int len;
3133 TRACE("(%p %p %d)\n", this, locinfo, isdef);
3135 len = strlen(_Locinfo__Getfalse(locinfo))+1;
3136 this->false_name = MSVCRT_operator_new(len);
3137 if(this->false_name)
3138 memcpy((char*)this->false_name, _Locinfo__Getfalse(locinfo), len);
3140 len = strlen(_Locinfo__Gettrue(locinfo))+1;
3141 this->true_name = MSVCRT_operator_new(len);
3142 if(this->true_name)
3143 memcpy((char*)this->true_name, _Locinfo__Gettrue(locinfo), len);
3145 if(isdef) {
3146 this->grouping = MSVCRT_operator_new(1);
3147 if(this->grouping)
3148 *(char*)this->grouping = 0;
3150 this->dp = '.';
3151 this->sep = ',';
3152 } else {
3153 const struct lconv *lc = _Locinfo__Getlconv(locinfo);
3155 len = strlen(lc->grouping)+1;
3156 this->grouping = MSVCRT_operator_new(len);
3157 if(this->grouping)
3158 memcpy((char*)this->grouping, lc->grouping, len);
3160 this->dp = lc->decimal_point[0];
3161 this->sep = lc->thousands_sep[0];
3164 if(!this->false_name || !this->true_name || !this->grouping) {
3165 MSVCRT_operator_delete((char*)this->grouping);
3166 MSVCRT_operator_delete((char*)this->false_name);
3167 MSVCRT_operator_delete((char*)this->true_name);
3169 ERR("Out of memory\n");
3170 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
3174 /* ?_Tidy@?$numpunct@D@std@@AAEXXZ */
3175 /* ?_Tidy@?$numpunct@D@std@@AEAAXXZ */
3176 static void numpunct_char__Tidy(numpunct_char *this)
3178 TRACE("(%p)\n", this);
3180 MSVCRT_operator_delete((char*)this->grouping);
3181 MSVCRT_operator_delete((char*)this->false_name);
3182 MSVCRT_operator_delete((char*)this->true_name);
3185 /* ??0?$numpunct@D@std@@QAE@ABV_Locinfo@1@I_N@Z */
3186 /* ??0?$numpunct@D@std@@QEAA@AEBV_Locinfo@1@_K_N@Z */
3187 static numpunct_char* numpunct_char_ctor_locinfo(numpunct_char *this,
3188 const _Locinfo *locinfo, MSVCP_size_t refs, MSVCP_bool usedef)
3190 TRACE("(%p %p %lu %d)\n", this, locinfo, refs, usedef);
3191 locale_facet_ctor_refs(&this->facet, refs);
3192 this->facet.vtable = &MSVCP_numpunct_char_vtable;
3193 numpunct_char__Init(this, locinfo, usedef);
3194 return this;
3197 /* ??0?$numpunct@D@std@@IAE@PBDI_N@Z */
3198 /* ??0?$numpunct@D@std@@IEAA@PEBD_K_N@Z */
3199 static numpunct_char* numpunct_char_ctor_name(numpunct_char *this,
3200 const char *name, MSVCP_size_t refs, MSVCP_bool usedef)
3202 _Locinfo locinfo;
3204 TRACE("(%p %s %lu %d)\n", this, debugstr_a(name), refs, usedef);
3205 locale_facet_ctor_refs(&this->facet, refs);
3206 this->facet.vtable = &MSVCP_numpunct_char_vtable;
3208 _Locinfo_ctor_cstr(&locinfo, name);
3209 numpunct_char__Init(this, &locinfo, usedef);
3210 _Locinfo_dtor(&locinfo);
3211 return this;
3214 /* ??0?$numpunct@D@std@@QAE@I@Z */
3215 /* ??0?$numpunct@D@std@@QEAA@_K@Z */
3216 DEFINE_THISCALL_WRAPPER(numpunct_char_ctor_refs, 8)
3217 numpunct_char* __thiscall numpunct_char_ctor_refs(numpunct_char *this, MSVCP_size_t refs)
3219 TRACE("(%p %lu)\n", this, refs);
3220 return numpunct_char_ctor_name(this, "C", refs, FALSE);
3223 /* ??_F?$numpunct@D@std@@QAEXXZ */
3224 /* ??_F?$numpunct@D@std@@QEAAXXZ */
3225 DEFINE_THISCALL_WRAPPER(numpunct_char_ctor, 4)
3226 numpunct_char* __thiscall numpunct_char_ctor(numpunct_char *this)
3228 return numpunct_char_ctor_refs(this, 0);
3231 /* ??1?$numpunct@D@std@@UAE@XZ */
3232 /* ??1?$numpunct@D@std@@UEAA@XZ */
3233 DEFINE_THISCALL_WRAPPER(numpunct_char_dtor, 4)
3234 void __thiscall numpunct_char_dtor(numpunct_char *this)
3236 TRACE("(%p)\n", this);
3237 numpunct_char__Tidy(this);
3240 DEFINE_THISCALL_WRAPPER(numpunct_char_vector_dtor, 8)
3241 numpunct_char* __thiscall numpunct_char_vector_dtor(numpunct_char *this, unsigned int flags)
3243 TRACE("(%p %x)\n", this, flags);
3244 if(flags & 2) {
3245 /* we have an array, with the number of elements stored before the first object */
3246 INT_PTR i, *ptr = (INT_PTR *)this-1;
3248 for(i=*ptr-1; i>=0; i--)
3249 numpunct_char_dtor(this+i);
3250 MSVCRT_operator_delete(ptr);
3251 } else {
3252 numpunct_char_dtor(this);
3253 if(flags & 1)
3254 MSVCRT_operator_delete(this);
3257 return this;
3260 /* ?_Getcat@?$numpunct@D@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
3261 /* ?_Getcat@?$numpunct@D@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
3262 static MSVCP_size_t numpunct_char__Getcat(const locale_facet **facet, const locale *loc)
3264 TRACE("(%p %p)\n", facet, loc);
3266 if(facet && !*facet) {
3267 *facet = MSVCRT_operator_new(sizeof(numpunct_char));
3268 if(!*facet) {
3269 ERR("Out of memory\n");
3270 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
3271 return 0;
3273 numpunct_char_ctor_name((numpunct_char*)*facet,
3274 basic_string_char_c_str(&loc->ptr->name), 0, TRUE);
3277 return LC_NUMERIC;
3280 static numpunct_char* numpunct_char_use_facet(const locale *loc)
3282 static numpunct_char *obj = NULL;
3284 _Lockit lock;
3285 const locale_facet *fac;
3287 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
3288 fac = locale__Getfacet(loc, locale_id_operator_size_t(&numpunct_char_id), TRUE);
3289 if(fac) {
3290 _Lockit_dtor(&lock);
3291 return (numpunct_char*)fac;
3294 if(obj) {
3295 _Lockit_dtor(&lock);
3296 return obj;
3299 numpunct_char__Getcat(&fac, loc);
3300 obj = (numpunct_char*)fac;
3301 locale_facet__Incref(&obj->facet);
3302 locale_facet_register(&obj->facet);
3303 _Lockit_dtor(&lock);
3305 return obj;
3308 /* ?do_decimal_point@?$numpunct@D@std@@MBEDXZ */
3309 /* ?do_decimal_point@?$numpunct@D@std@@MEBADXZ */
3310 DEFINE_THISCALL_WRAPPER(numpunct_char_do_decimal_point, 4)
3311 #define call_numpunct_char_do_decimal_point(this) CALL_VTBL_FUNC(this, 4, \
3312 char, (const numpunct_char *this), (this))
3313 char __thiscall numpunct_char_do_decimal_point(const numpunct_char *this)
3315 TRACE("(%p)\n", this);
3316 return this->dp;
3319 /* ?decimal_point@?$numpunct@D@std@@QBEDXZ */
3320 /* ?decimal_point@?$numpunct@D@std@@QEBADXZ */
3321 DEFINE_THISCALL_WRAPPER(numpunct_char_decimal_point, 4)
3322 char __thiscall numpunct_char_decimal_point(const numpunct_char *this)
3324 TRACE("(%p)\n", this);
3325 return call_numpunct_char_do_decimal_point(this);
3328 /* ?do_thousands_sep@?$numpunct@D@std@@MBEDXZ */
3329 /* ?do_thousands_sep@?$numpunct@D@std@@MEBADXZ */
3330 DEFINE_THISCALL_WRAPPER(numpunct_char_do_thousands_sep, 4)
3331 #define call_numpunct_char_do_thousands_sep(this) CALL_VTBL_FUNC(this, 8, \
3332 char, (const numpunct_char*), (this))
3333 char __thiscall numpunct_char_do_thousands_sep(const numpunct_char *this)
3335 TRACE("(%p)\n", this);
3336 return this->sep;
3339 /* ?thousands_sep@?$numpunct@D@std@@QBEDXZ */
3340 /* ?thousands_sep@?$numpunct@D@std@@QEBADXZ */
3341 DEFINE_THISCALL_WRAPPER(numpunct_char_thousands_sep, 4)
3342 char __thiscall numpunct_char_thousands_sep(const numpunct_char *this)
3344 TRACE("(%p)\n", this);
3345 return call_numpunct_char_do_thousands_sep(this);
3348 /* ?do_grouping@?$numpunct@D@std@@MBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3349 /* ?do_grouping@?$numpunct@D@std@@MEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3350 DEFINE_THISCALL_WRAPPER(numpunct_char_do_grouping, 8)
3351 #define call_numpunct_char_do_grouping(this, ret) CALL_VTBL_FUNC(this, 12, \
3352 basic_string_char*, (const numpunct_char*, basic_string_char*), (this, ret))
3353 basic_string_char* __thiscall numpunct_char_do_grouping(
3354 const numpunct_char *this, basic_string_char *ret)
3356 TRACE("(%p)\n", this);
3357 return basic_string_char_ctor_cstr(ret, this->grouping);
3360 /* ?grouping@?$numpunct@D@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3361 /* ?grouping@?$numpunct@D@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3362 DEFINE_THISCALL_WRAPPER(numpunct_char_grouping, 8)
3363 basic_string_char* __thiscall numpunct_char_grouping(const numpunct_char *this, basic_string_char *ret)
3365 TRACE("(%p)\n", this);
3366 return call_numpunct_char_do_grouping(this, ret);
3369 /* ?do_falsename@?$numpunct@D@std@@MBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3370 /* ?do_falsename@?$numpunct@D@std@@MEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3371 DEFINE_THISCALL_WRAPPER(numpunct_char_do_falsename, 8)
3372 #define call_numpunct_char_do_falsename(this, ret) CALL_VTBL_FUNC(this, 16, \
3373 basic_string_char*, (const numpunct_char*, basic_string_char*), (this, ret))
3374 basic_string_char* __thiscall numpunct_char_do_falsename(
3375 const numpunct_char *this, basic_string_char *ret)
3377 TRACE("(%p)\n", this);
3378 return basic_string_char_ctor_cstr(ret, this->false_name);
3381 /* ?falsename@?$numpunct@D@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3382 /* ?falsename@?$numpunct@D@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3383 DEFINE_THISCALL_WRAPPER(numpunct_char_falsename, 8)
3384 basic_string_char* __thiscall numpunct_char_falsename(const numpunct_char *this, basic_string_char *ret)
3386 TRACE("(%p)\n", this);
3387 return call_numpunct_char_do_falsename(this, ret);
3390 /* ?do_truename@?$numpunct@D@std@@MBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3391 /* ?do_truename@?$numpunct@D@std@@MEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3392 DEFINE_THISCALL_WRAPPER(numpunct_char_do_truename, 8)
3393 #define call_numpunct_char_do_truename(this, ret) CALL_VTBL_FUNC(this, 20, \
3394 basic_string_char*, (const numpunct_char*, basic_string_char*), (this, ret))
3395 basic_string_char* __thiscall numpunct_char_do_truename(
3396 const numpunct_char *this, basic_string_char *ret)
3398 TRACE("(%p)\n", this);
3399 return basic_string_char_ctor_cstr(ret, this->true_name);
3402 /* ?truename@?$numpunct@D@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3403 /* ?truename@?$numpunct@D@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3404 DEFINE_THISCALL_WRAPPER(numpunct_char_truename, 8)
3405 basic_string_char* __thiscall numpunct_char_truename(const numpunct_char *this, basic_string_char *ret)
3407 TRACE("(%p)\n", this);
3408 return call_numpunct_char_do_truename(this, ret);
3411 /* ?id@?$numpunct@_W@std@@2V0locale@2@A */
3412 static locale_id numpunct_wchar_id = {0};
3413 /* ?id@?$numpunct@G@std@@2V0locale@2@A */
3414 locale_id numpunct_short_id = {0};
3416 /* ??_7?$numpunct@_W@std@@6B@ */
3417 extern const vtable_ptr MSVCP_numpunct_wchar_vtable;
3418 /* ??_7?$numpunct@G@std@@6B@ */
3419 extern const vtable_ptr MSVCP_numpunct_short_vtable;
3421 /* ?_Init@?$numpunct@_W@std@@IAEXABV_Locinfo@2@_N@Z */
3422 /* ?_Init@?$numpunct@_W@std@@IEAAXAEBV_Locinfo@2@_N@Z */
3423 /* ?_Init@?$numpunct@G@std@@IAEXABV_Locinfo@2@_N@Z */
3424 /* ?_Init@?$numpunct@G@std@@IEAAXAEBV_Locinfo@2@_N@Z */
3425 static void numpunct_wchar__Init(numpunct_wchar *this,
3426 const _Locinfo *locinfo, MSVCP_bool isdef)
3428 const char *to_convert;
3429 _Cvtvec cvt;
3430 int len;
3432 TRACE("(%p %p %d)\n", this, locinfo, isdef);
3434 _Locinfo__Getcvt(locinfo, &cvt);
3436 to_convert = _Locinfo__Getfalse(locinfo);
3437 len = MultiByteToWideChar(cvt.page, 0, to_convert, -1, NULL, 0);
3438 this->false_name = MSVCRT_operator_new(len*sizeof(WCHAR));
3439 if(this->false_name)
3440 MultiByteToWideChar(cvt.page, 0, to_convert, -1,
3441 (wchar_t*)this->false_name, len);
3443 to_convert = _Locinfo__Gettrue(locinfo);
3444 len = MultiByteToWideChar(cvt.page, 0, to_convert, -1, NULL, 0);
3445 this->true_name = MSVCRT_operator_new(len*sizeof(WCHAR));
3446 if(this->true_name)
3447 MultiByteToWideChar(cvt.page, 0, to_convert, -1,
3448 (wchar_t*)this->true_name, len);
3450 if(isdef) {
3451 this->grouping = MSVCRT_operator_new(1);
3452 if(this->grouping)
3453 *(char*)this->grouping = 0;
3455 this->dp = '.';
3456 this->sep = ',';
3457 } else {
3458 const struct lconv *lc = _Locinfo__Getlconv(locinfo);
3460 len = strlen(lc->grouping)+1;
3461 this->grouping = MSVCRT_operator_new(len);
3462 if(this->grouping)
3463 memcpy((char*)this->grouping, lc->grouping, len);
3465 this->dp = mb_to_wc(lc->decimal_point[0], &cvt);
3466 this->sep = mb_to_wc(lc->thousands_sep[0], &cvt);
3469 if(!this->false_name || !this->true_name || !this->grouping) {
3470 MSVCRT_operator_delete((char*)this->grouping);
3471 MSVCRT_operator_delete((wchar_t*)this->false_name);
3472 MSVCRT_operator_delete((wchar_t*)this->true_name);
3474 ERR("Out of memory\n");
3475 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
3479 /* ?_Tidy@?$numpunct@_W@std@@AAEXXZ */
3480 /* ?_Tidy@?$numpunct@_W@std@@AEAAXXZ */
3481 /* ?_Tidy@?$numpunct@G@std@@AAEXXZ */
3482 /* ?_Tidy@?$numpunct@G@std@@AEAAXXZ */
3483 static void numpunct_wchar__Tidy(numpunct_wchar *this)
3485 TRACE("(%p)\n", this);
3487 MSVCRT_operator_delete((char*)this->grouping);
3488 MSVCRT_operator_delete((wchar_t*)this->false_name);
3489 MSVCRT_operator_delete((wchar_t*)this->true_name);
3492 /* ??0?$numpunct@_W@std@@QAE@ABV_Locinfo@1@I_N@Z */
3493 /* ??0?$numpunct@_W@std@@QEAA@AEBV_Locinfo@1@_K_N@Z */
3494 static numpunct_wchar* numpunct_wchar_ctor_locinfo(numpunct_wchar *this,
3495 const _Locinfo *locinfo, MSVCP_size_t refs, MSVCP_bool usedef)
3497 TRACE("(%p %p %lu %d)\n", this, locinfo, refs, usedef);
3498 locale_facet_ctor_refs(&this->facet, refs);
3499 this->facet.vtable = &MSVCP_numpunct_wchar_vtable;
3500 numpunct_wchar__Init(this, locinfo, usedef);
3501 return this;
3504 /* ??0?$numpunct@G@std@@QAE@ABV_Locinfo@1@I_N@Z */
3505 /* ??0?$numpunct@G@std@@QEAA@AEBV_Locinfo@1@_K_N@Z */
3506 static numpunct_wchar* numpunct_short_ctor_locinfo(numpunct_wchar *this,
3507 const _Locinfo *locinfo, MSVCP_size_t refs, MSVCP_bool usedef)
3509 numpunct_wchar_ctor_locinfo(this, locinfo, refs, usedef);
3510 this->facet.vtable = &MSVCP_numpunct_short_vtable;
3511 return this;
3514 /* ??0?$numpunct@_W@std@@IAE@PBDI_N@Z */
3515 /* ??0?$numpunct@_W@std@@IEAA@PEBD_K_N@Z */
3516 static numpunct_wchar* numpunct_wchar_ctor_name(numpunct_wchar *this,
3517 const char *name, MSVCP_size_t refs, MSVCP_bool usedef)
3519 _Locinfo locinfo;
3521 TRACE("(%p %s %lu %d)\n", this, debugstr_a(name), refs, usedef);
3522 locale_facet_ctor_refs(&this->facet, refs);
3523 this->facet.vtable = &MSVCP_numpunct_wchar_vtable;
3525 _Locinfo_ctor_cstr(&locinfo, name);
3526 numpunct_wchar__Init(this, &locinfo, usedef);
3527 _Locinfo_dtor(&locinfo);
3528 return this;
3531 /* ??0?$numpunct@G@std@@IAE@PBDI_N@Z */
3532 /* ??0?$numpunct@G@std@@IEAA@PEBD_K_N@Z */
3533 static numpunct_wchar* numpunct_short_ctor_name(numpunct_wchar *this,
3534 const char *name, MSVCP_size_t refs, MSVCP_bool usedef)
3536 numpunct_wchar_ctor_name(this, name, refs, usedef);
3537 this->facet.vtable = &MSVCP_numpunct_short_vtable;
3538 return this;
3541 /* ??0?$numpunct@_W@std@@QAE@I@Z */
3542 /* ??0?$numpunct@_W@std@@QEAA@_K@Z */
3543 static numpunct_wchar* numpunct_wchar_ctor_refs(numpunct_wchar *this, MSVCP_size_t refs)
3545 TRACE("(%p %lu)\n", this, refs);
3546 return numpunct_wchar_ctor_name(this, "C", refs, FALSE);
3549 /* ??0?$numpunct@G@std@@QAE@I@Z */
3550 /* ??0?$numpunct@G@std@@QEAA@_K@Z */
3551 DEFINE_THISCALL_WRAPPER(numpunct_short_ctor_refs, 8)
3552 numpunct_wchar* __thiscall numpunct_short_ctor_refs(numpunct_wchar *this, MSVCP_size_t refs)
3554 numpunct_wchar_ctor_refs(this, refs);
3555 this->facet.vtable = &MSVCP_numpunct_short_vtable;
3556 return this;
3559 /* ??_F?$numpunct@G@std@@QAEXXZ */
3560 /* ??_F?$numpunct@G@std@@QEAAXXZ */
3561 DEFINE_THISCALL_WRAPPER(numpunct_short_ctor, 4)
3562 numpunct_wchar* __thiscall numpunct_short_ctor(numpunct_wchar *this)
3564 return numpunct_short_ctor_refs(this, 0);
3567 /* ??1?$numpunct@G@std@@UAE@XZ */
3568 /* ??1?$numpunct@G@std@@UEAA@XZ */
3569 DEFINE_THISCALL_WRAPPER(numpunct_wchar_dtor, 4)
3570 void __thiscall numpunct_wchar_dtor(numpunct_wchar *this)
3572 TRACE("(%p)\n", this);
3573 numpunct_wchar__Tidy(this);
3576 DEFINE_THISCALL_WRAPPER(numpunct_wchar_vector_dtor, 8)
3577 numpunct_wchar* __thiscall numpunct_wchar_vector_dtor(numpunct_wchar *this, unsigned int flags)
3579 TRACE("(%p %x)\n", this, flags);
3580 if(flags & 2) {
3581 /* we have an array, with the number of elements stored before the first object */
3582 INT_PTR i, *ptr = (INT_PTR *)this-1;
3584 for(i=*ptr-1; i>=0; i--)
3585 numpunct_wchar_dtor(this+i);
3586 MSVCRT_operator_delete(ptr);
3587 } else {
3588 numpunct_wchar_dtor(this);
3589 if(flags & 1)
3590 MSVCRT_operator_delete(this);
3593 return this;
3596 /* ?_Getcat@?$numpunct@_W@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
3597 /* ?_Getcat@?$numpunct@_W@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
3598 static MSVCP_size_t numpunct_wchar__Getcat(const locale_facet **facet, const locale *loc)
3600 TRACE("(%p %p)\n", facet, loc);
3602 if(facet && !*facet) {
3603 *facet = MSVCRT_operator_new(sizeof(numpunct_wchar));
3604 if(!*facet) {
3605 ERR("Out of memory\n");
3606 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
3607 return 0;
3609 numpunct_wchar_ctor_name((numpunct_wchar*)*facet,
3610 basic_string_char_c_str(&loc->ptr->name), 0, TRUE);
3613 return LC_NUMERIC;
3616 static numpunct_wchar* numpunct_wchar_use_facet(const locale *loc)
3618 static numpunct_wchar *obj = NULL;
3620 _Lockit lock;
3621 const locale_facet *fac;
3623 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
3624 fac = locale__Getfacet(loc, locale_id_operator_size_t(&numpunct_wchar_id), TRUE);
3625 if(fac) {
3626 _Lockit_dtor(&lock);
3627 return (numpunct_wchar*)fac;
3630 if(obj) {
3631 _Lockit_dtor(&lock);
3632 return obj;
3635 numpunct_wchar__Getcat(&fac, loc);
3636 obj = (numpunct_wchar*)fac;
3637 locale_facet__Incref(&obj->facet);
3638 locale_facet_register(&obj->facet);
3639 _Lockit_dtor(&lock);
3641 return obj;
3644 /* ?_Getcat@?$numpunct@G@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
3645 /* ?_Getcat@?$numpunct@G@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
3646 static MSVCP_size_t numpunct_short__Getcat(const locale_facet **facet, const locale *loc)
3648 TRACE("(%p %p)\n", facet, loc);
3650 if(facet && !*facet) {
3651 *facet = MSVCRT_operator_new(sizeof(numpunct_wchar));
3652 if(!*facet) {
3653 ERR("Out of memory\n");
3654 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
3655 return 0;
3657 numpunct_short_ctor_name((numpunct_wchar*)*facet,
3658 basic_string_char_c_str(&loc->ptr->name), 0, TRUE);
3661 return LC_NUMERIC;
3664 static numpunct_wchar* numpunct_short_use_facet(const locale *loc)
3666 static numpunct_wchar *obj = NULL;
3668 _Lockit lock;
3669 const locale_facet *fac;
3671 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
3672 fac = locale__Getfacet(loc, locale_id_operator_size_t(&numpunct_short_id), TRUE);
3673 if(fac) {
3674 _Lockit_dtor(&lock);
3675 return (numpunct_wchar*)fac;
3678 if(obj) {
3679 _Lockit_dtor(&lock);
3680 return obj;
3683 numpunct_short__Getcat(&fac, loc);
3684 obj = (numpunct_wchar*)fac;
3685 locale_facet__Incref(&obj->facet);
3686 locale_facet_register(&obj->facet);
3687 _Lockit_dtor(&lock);
3689 return obj;
3692 /* ?do_decimal_point@?$numpunct@_W@std@@MBE_WXZ */
3693 /* ?do_decimal_point@?$numpunct@_W@std@@MEBA_WXZ */
3694 /* ?do_decimal_point@?$numpunct@G@std@@MBEGXZ */
3695 /* ?do_decimal_point@?$numpunct@G@std@@MEBAGXZ */
3696 DEFINE_THISCALL_WRAPPER(numpunct_wchar_do_decimal_point, 4)
3697 #define call_numpunct_wchar_do_decimal_point(this) CALL_VTBL_FUNC(this, 4, \
3698 wchar_t, (const numpunct_wchar *this), (this))
3699 wchar_t __thiscall numpunct_wchar_do_decimal_point(const numpunct_wchar *this)
3701 TRACE("(%p)\n", this);
3702 return this->dp;
3705 /* ?decimal_point@?$numpunct@_W@std@@QBE_WXZ */
3706 /* ?decimal_point@?$numpunct@_W@std@@QEBA_WXZ */
3707 /* ?decimal_point@?$numpunct@G@std@@QBEGXZ */
3708 /* ?decimal_point@?$numpunct@G@std@@QEBAGXZ */
3709 DEFINE_THISCALL_WRAPPER(numpunct_wchar_decimal_point, 4)
3710 wchar_t __thiscall numpunct_wchar_decimal_point(const numpunct_wchar *this)
3712 TRACE("(%p)\n", this);
3713 return call_numpunct_wchar_do_decimal_point(this);
3716 /* ?do_thousands_sep@?$numpunct@_W@std@@MBE_WXZ */
3717 /* ?do_thousands_sep@?$numpunct@_W@std@@MEBA_WXZ */
3718 /* ?do_thousands_sep@?$numpunct@G@std@@MBEGXZ */
3719 /* ?do_thousands_sep@?$numpunct@G@std@@MEBAGXZ */
3720 DEFINE_THISCALL_WRAPPER(numpunct_wchar_do_thousands_sep, 4)
3721 #define call_numpunct_wchar_do_thousands_sep(this) CALL_VTBL_FUNC(this, 8, \
3722 wchar_t, (const numpunct_wchar *this), (this))
3723 wchar_t __thiscall numpunct_wchar_do_thousands_sep(const numpunct_wchar *this)
3725 TRACE("(%p)\n", this);
3726 return this->sep;
3729 /* ?thousands_sep@?$numpunct@_W@std@@QBE_WXZ */
3730 /* ?thousands_sep@?$numpunct@_W@std@@QEBA_WXZ */
3731 /* ?thousands_sep@?$numpunct@G@std@@QBEGXZ */
3732 /* ?thousands_sep@?$numpunct@G@std@@QEBAGXZ */
3733 DEFINE_THISCALL_WRAPPER(numpunct_wchar_thousands_sep, 4)
3734 wchar_t __thiscall numpunct_wchar_thousands_sep(const numpunct_wchar *this)
3736 TRACE("(%p)\n", this);
3737 return call_numpunct_wchar_do_thousands_sep(this);
3740 /* ?do_grouping@?$numpunct@_W@std@@MBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3741 /* ?do_grouping@?$numpunct@_W@std@@MEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3742 /* ?do_grouping@?$numpunct@G@std@@MBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3743 /* ?do_grouping@?$numpunct@G@std@@MEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3744 DEFINE_THISCALL_WRAPPER(numpunct_wchar_do_grouping, 8)
3745 #define call_numpunct_wchar_do_grouping(this, ret) CALL_VTBL_FUNC(this, 12, \
3746 basic_string_char*, (const numpunct_wchar*, basic_string_char*), (this, ret))
3747 basic_string_char* __thiscall numpunct_wchar_do_grouping(const numpunct_wchar *this, basic_string_char *ret)
3749 TRACE("(%p)\n", this);
3750 return basic_string_char_ctor_cstr(ret, this->grouping);
3753 /* ?grouping@?$numpunct@_W@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3754 /* ?grouping@?$numpunct@_W@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3755 /* ?grouping@?$numpunct@G@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3756 /* ?grouping@?$numpunct@G@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3757 DEFINE_THISCALL_WRAPPER(numpunct_wchar_grouping, 8)
3758 basic_string_char* __thiscall numpunct_wchar_grouping(const numpunct_wchar *this, basic_string_char *ret)
3760 TRACE("(%p)\n", this);
3761 return call_numpunct_wchar_do_grouping(this, ret);
3764 /* ?do_falsename@?$numpunct@_W@std@@MBE?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
3765 /* ?do_falsename@?$numpunct@_W@std@@MEBA?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
3766 /* ?do_falsename@?$numpunct@G@std@@MBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
3767 /* ?do_falsename@?$numpunct@G@std@@MEBA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
3768 DEFINE_THISCALL_WRAPPER(numpunct_wchar_do_falsename, 8)
3769 #define call_numpunct_wchar_do_falsename(this, ret) CALL_VTBL_FUNC(this, 16, \
3770 basic_string_wchar*, (const numpunct_wchar*, basic_string_wchar*), (this, ret))
3771 basic_string_wchar* __thiscall numpunct_wchar_do_falsename(const numpunct_wchar *this, basic_string_wchar *ret)
3773 TRACE("(%p)\n", this);
3774 return basic_string_wchar_ctor_cstr(ret, this->false_name);
3777 /* ?falsename@?$numpunct@_W@std@@QBE?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
3778 /* ?falsename@?$numpunct@_W@std@@QEBA?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
3779 /* ?falsename@?$numpunct@G@std@@QBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
3780 /* ?falsename@?$numpunct@G@std@@QEBA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
3781 DEFINE_THISCALL_WRAPPER(numpunct_wchar_falsename, 8)
3782 basic_string_wchar* __thiscall numpunct_wchar_falsename(const numpunct_wchar *this, basic_string_wchar *ret)
3784 TRACE("(%p)\n", this);
3785 return call_numpunct_wchar_do_falsename(this, ret);
3788 /* ?do_truename@?$numpunct@_W@std@@MBE?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
3789 /* ?do_truename@?$numpunct@_W@std@@MEBA?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
3790 /* ?do_truename@?$numpunct@G@std@@MBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
3791 /* ?do_truename@?$numpunct@G@std@@MEBA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
3792 DEFINE_THISCALL_WRAPPER(numpunct_wchar_do_truename, 8)
3793 #define call_numpunct_wchar_do_truename(this, ret) CALL_VTBL_FUNC(this, 20, \
3794 basic_string_wchar*, (const numpunct_wchar*, basic_string_wchar*), (this, ret))
3795 basic_string_wchar* __thiscall numpunct_wchar_do_truename(const numpunct_wchar *this, basic_string_wchar *ret)
3797 TRACE("(%p)\n", this);
3798 return basic_string_wchar_ctor_cstr(ret, this->true_name);
3801 /* ?truename@?$numpunct@_W@std@@QBE?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
3802 /* ?truename@?$numpunct@_W@std@@QEBA?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
3803 /* ?truename@?$numpunct@G@std@@QBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
3804 /* ?truename@?$numpunct@G@std@@QEBA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
3805 DEFINE_THISCALL_WRAPPER(numpunct_wchar_truename, 8)
3806 basic_string_wchar* __thiscall numpunct_wchar_truename(const numpunct_wchar *this, basic_string_wchar *ret)
3808 TRACE("(%p)\n", this);
3809 return call_numpunct_wchar_do_truename(this, ret);
3812 double __cdecl _Stod(const char *buf, char **buf_end, LONG exp)
3814 double ret = strtod(buf, buf_end);
3816 if(exp)
3817 ret *= pow(10, exp);
3818 return ret;
3821 static double _Stodx(const char *buf, char **buf_end, LONG exp, int *err)
3823 double ret;
3825 *err = *_errno();
3826 *_errno() = 0;
3827 ret = _Stod(buf, buf_end, exp);
3828 if(*_errno()) {
3829 *err = *_errno();
3830 }else {
3831 *_errno() = *err;
3832 *err = 0;
3834 return ret;
3837 float __cdecl _Stof(const char *buf, char **buf_end, LONG exp)
3839 return _Stod(buf, buf_end, exp);
3842 static float _Stofx(const char *buf, char **buf_end, LONG exp, int *err)
3844 return _Stodx(buf, buf_end, exp, err);
3847 static __int64 _Stollx(const char *buf, char **buf_end, int base, int *err)
3849 __int64 ret;
3851 *err = *_errno();
3852 *_errno() = 0;
3853 ret = _strtoi64(buf, buf_end, base);
3854 if(*_errno()) {
3855 *err = *_errno();
3856 }else {
3857 *_errno() = *err;
3858 *err = 0;
3860 return ret;
3863 static LONG _Stolx(const char *buf, char **buf_end, int base, int *err)
3865 __int64 i = _Stollx(buf, buf_end, base, err);
3866 if(!*err && i!=(__int64)((LONG)i))
3867 *err = ERANGE;
3868 return i;
3871 static unsigned __int64 _Stoullx(const char *buf, char **buf_end, int base, int *err)
3873 unsigned __int64 ret;
3875 *err = *_errno();
3876 *_errno() = 0;
3877 ret = _strtoui64(buf, buf_end, base);
3878 if(*_errno()) {
3879 *err = *_errno();
3880 }else {
3881 *_errno() = *err;
3882 *err = 0;
3884 return ret;
3887 static ULONG _Stoulx(const char *buf, char **buf_end, int base, int *err)
3889 unsigned __int64 i = _Stoullx(buf[0]=='-' ? buf+1 : buf, buf_end, base, err);
3890 if(!*err && i!=(unsigned __int64)((ULONG)i))
3891 *err = ERANGE;
3892 return buf[0]=='-' ? -i : i;
3895 /* ?id@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@2V0locale@2@A */
3896 static locale_id num_get_wchar_id = {0};
3897 /* ?id@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@2V0locale@2@A */
3898 locale_id num_get_short_id = {0};
3900 /* ??_7?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@6B@ */
3901 extern const vtable_ptr MSVCP_num_get_wchar_vtable;
3902 /* ??_7?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@6B@ */
3903 extern const vtable_ptr MSVCP_num_get_short_vtable;
3905 /* ?_Init@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@IAEXABV_Locinfo@2@@Z */
3906 /* ?_Init@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@IEAAXAEBV_Locinfo@2@@Z */
3907 /* ?_Init@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@IAEXABV_Locinfo@2@@Z */
3908 /* ?_Init@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@IEAAXAEBV_Locinfo@2@@Z */
3909 DEFINE_THISCALL_WRAPPER(num_get_wchar__Init, 8)
3910 void __thiscall num_get_wchar__Init(num_get *this, const _Locinfo *locinfo)
3912 TRACE("(%p %p)\n", this, locinfo);
3913 _Locinfo__Getcvt(locinfo, &this->cvt);
3916 /* ??0?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
3917 /* ??0?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
3918 static num_get* num_get_wchar_ctor_locinfo(num_get *this,
3919 const _Locinfo *locinfo, MSVCP_size_t refs)
3921 TRACE("(%p %p %lu)\n", this, locinfo, refs);
3923 locale_facet_ctor_refs(&this->facet, refs);
3924 this->facet.vtable = &MSVCP_num_get_wchar_vtable;
3926 num_get_wchar__Init(this, locinfo);
3927 return this;
3930 /* ??0?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
3931 /* ??0?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
3932 DEFINE_THISCALL_WRAPPER(num_get_short_ctor_locinfo, 12)
3933 num_get* __thiscall num_get_short_ctor_locinfo(num_get *this,
3934 const _Locinfo *locinfo, MSVCP_size_t refs)
3936 num_get_wchar_ctor_locinfo(this, locinfo, refs);
3937 this->facet.vtable = &MSVCP_num_get_short_vtable;
3938 return this;
3941 /* ??0?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAE@I@Z */
3942 /* ??0?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAA@_K@Z */
3943 static num_get* num_get_wchar_ctor_refs(num_get *this, MSVCP_size_t refs)
3945 _Locinfo locinfo;
3947 TRACE("(%p %lu)\n", this, refs);
3949 _Locinfo_ctor(&locinfo);
3950 num_get_wchar_ctor_locinfo(this, &locinfo, refs);
3951 _Locinfo_dtor(&locinfo);
3952 return this;
3955 /* ??0?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAE@I@Z */
3956 /* ??0?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEAA@_K@Z */
3957 DEFINE_THISCALL_WRAPPER(num_get_short_ctor_refs, 8)
3958 num_get* __thiscall num_get_short_ctor_refs(num_get *this, MSVCP_size_t refs)
3960 num_get_wchar_ctor_refs(this, refs);
3961 this->facet.vtable = &MSVCP_num_get_short_vtable;
3962 return this;
3965 /* ??_F?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAEXXZ */
3966 /* ??_F?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAAXXZ */
3967 DEFINE_THISCALL_WRAPPER(num_get_short_ctor, 4)
3968 num_get* __thiscall num_get_short_ctor(num_get *this)
3970 return num_get_short_ctor_refs(this, 0);
3973 /* ??1?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@UAE@XZ */
3974 /* ??1?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@UEAA@XZ */
3975 DEFINE_THISCALL_WRAPPER(num_get_wchar_dtor, 4)
3976 void __thiscall num_get_wchar_dtor(num_get *this)
3978 TRACE("(%p)\n", this);
3979 locale_facet_dtor(&this->facet);
3982 DEFINE_THISCALL_WRAPPER(num_get_wchar_vector_dtor, 8)
3983 num_get* __thiscall num_get_wchar_vector_dtor(num_get *this, unsigned int flags)
3985 TRACE("(%p %x)\n", this, flags);
3986 if(flags & 2) {
3987 /* we have an array, with the number of elements stored before the first object */
3988 INT_PTR i, *ptr = (INT_PTR *)this-1;
3990 for(i=*ptr-1; i>=0; i--)
3991 num_get_wchar_dtor(this+i);
3992 MSVCRT_operator_delete(ptr);
3993 } else {
3994 num_get_wchar_dtor(this);
3995 if(flags & 1)
3996 MSVCRT_operator_delete(this);
3999 return this;
4002 /* ?_Getcat@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
4003 /* ?_Getcat@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
4004 static MSVCP_size_t num_get_wchar__Getcat(const locale_facet **facet, const locale *loc)
4006 TRACE("(%p %p)\n", facet, loc);
4008 if(facet && !*facet) {
4009 _Locinfo locinfo;
4011 *facet = MSVCRT_operator_new(sizeof(num_get));
4012 if(!*facet) {
4013 ERR("Out of memory\n");
4014 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
4015 return 0;
4018 _Locinfo_ctor_cstr(&locinfo, basic_string_char_c_str(&loc->ptr->name));
4019 num_get_wchar_ctor_locinfo((num_get*)*facet, &locinfo, 0);
4020 _Locinfo_dtor(&locinfo);
4023 return LC_NUMERIC;
4026 static num_get* num_get_wchar_use_facet(const locale *loc)
4028 static num_get *obj = NULL;
4030 _Lockit lock;
4031 const locale_facet *fac;
4033 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
4034 fac = locale__Getfacet(loc, locale_id_operator_size_t(&num_get_wchar_id), TRUE);
4035 if(fac) {
4036 _Lockit_dtor(&lock);
4037 return (num_get*)fac;
4040 if(obj) {
4041 _Lockit_dtor(&lock);
4042 return obj;
4045 num_get_wchar__Getcat(&fac, loc);
4046 obj = (num_get*)fac;
4047 locale_facet__Incref(&obj->facet);
4048 locale_facet_register(&obj->facet);
4049 _Lockit_dtor(&lock);
4051 return obj;
4054 /* ?_Getcat@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
4055 /* ?_Getcat@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
4056 static MSVCP_size_t num_get_short__Getcat(const locale_facet **facet, const locale *loc)
4058 if(facet && !*facet) {
4059 num_get_wchar__Getcat(facet, loc);
4060 (*(locale_facet**)facet)->vtable = &MSVCP_num_get_short_vtable;
4063 return LC_NUMERIC;
4066 num_get* num_get_short_use_facet(const locale *loc)
4068 static num_get *obj = NULL;
4070 _Lockit lock;
4071 const locale_facet *fac;
4073 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
4074 fac = locale__Getfacet(loc, locale_id_operator_size_t(&num_get_short_id), TRUE);
4075 if(fac) {
4076 _Lockit_dtor(&lock);
4077 return (num_get*)fac;
4080 if(obj) {
4081 _Lockit_dtor(&lock);
4082 return obj;
4085 num_get_short__Getcat(&fac, loc);
4086 obj = (num_get*)fac;
4087 locale_facet__Incref(&obj->facet);
4088 locale_facet_register(&obj->facet);
4089 _Lockit_dtor(&lock);
4091 return obj;
4094 static int num_get__Getffld(const num_get *this, char *dest, istreambuf_iterator_wchar *first,
4095 istreambuf_iterator_wchar *last, const locale *loc, numpunct_wchar *numpunct)
4097 int i, exp = 0;
4098 char *dest_beg = dest, *num_end = dest+25, *exp_end = dest+31;
4099 wchar_t digits[11], *digits_pos;
4100 BOOL error = FALSE, got_digit = FALSE, got_nonzero = FALSE;
4102 TRACE("(%p %p %p %p)\n", dest, first, last, loc);
4104 for(i=0; i<10; i++)
4105 digits[i] = mb_to_wc('0'+i, &this->cvt);
4106 digits[10] = 0;
4108 istreambuf_iterator_wchar_val(first);
4109 /* get sign */
4110 if(first->strbuf && first->val==mb_to_wc('-', &this->cvt)) {
4111 *dest++ = '-';
4112 istreambuf_iterator_wchar_inc(first);
4113 }else if(first->strbuf && first->val==mb_to_wc('+', &this->cvt)) {
4114 *dest++ = '+';
4115 istreambuf_iterator_wchar_inc(first);
4118 /* read numbers before decimal */
4119 for(; first->strbuf; istreambuf_iterator_wchar_inc(first)) {
4120 if(!(digits_pos = wcschr(digits, first->val))) {
4121 break;
4122 }else {
4123 got_digit = TRUE; /* found a digit, zero or non-zero */
4124 /* write digit to dest if not a leading zero (to not waste dest buffer) */
4125 if(!got_nonzero && first->val == digits[0])
4126 continue;
4127 got_nonzero = TRUE;
4128 if(dest < num_end)
4129 *dest++ = '0'+digits_pos-digits;
4130 else
4131 exp++; /* too many digits, just multiply by 10 */
4134 /* if all leading zeroes, we didn't write anything so put a zero we check for a decimal */
4135 if(got_digit && !got_nonzero)
4136 *dest++ = '0';
4138 /* get decimal, if any */
4139 if(first->strbuf && first->val==numpunct_wchar_decimal_point(numpunct)) {
4140 if(dest < num_end)
4141 *dest++ = *localeconv()->decimal_point;
4142 istreambuf_iterator_wchar_inc(first);
4145 /* read non-grouped after decimal */
4146 for(; first->strbuf; istreambuf_iterator_wchar_inc(first)) {
4147 if(!(digits_pos = wcschr(digits, first->val)))
4148 break;
4149 else if(dest<num_end) {
4150 got_digit = TRUE;
4151 *dest++ = '0'+digits_pos-digits;
4155 /* read exponent, if any */
4156 if(first->strbuf && (first->val==mb_to_wc('e', &this->cvt) || first->val==mb_to_wc('E', &this->cvt))) {
4157 *dest++ = 'e';
4158 istreambuf_iterator_wchar_inc(first);
4160 if(first->strbuf && first->val==mb_to_wc('-', &this->cvt)) {
4161 *dest++ = '-';
4162 istreambuf_iterator_wchar_inc(first);
4163 }else if(first->strbuf && first->val==mb_to_wc('+', &this->cvt)) {
4164 *dest++ = '+';
4165 istreambuf_iterator_wchar_inc(first);
4168 got_digit = got_nonzero = FALSE;
4169 error = TRUE;
4170 /* skip any leading zeroes */
4171 for(; first->strbuf && first->val==digits[0]; istreambuf_iterator_wchar_inc(first))
4172 error = FALSE;
4174 for(; first->strbuf && (digits_pos = wcschr(digits, first->val)); istreambuf_iterator_wchar_inc(first)) {
4175 got_digit = got_nonzero = TRUE; /* leading zeroes would have been skipped, so first digit is non-zero */
4176 error = FALSE;
4177 if(dest<exp_end)
4178 *dest++ = '0'+digits_pos-digits;
4181 /* if just found zeroes for exponent, use that */
4182 if(got_digit && !got_nonzero)
4184 error = FALSE;
4185 if(dest<exp_end)
4186 *dest++ = '0';
4190 if(error) {
4191 *dest_beg = '\0';
4192 return 0;
4194 *dest++ = '\0';
4195 return exp;
4198 static int num_get__Getifld(const num_get *this, char *dest, istreambuf_iterator_wchar *first,
4199 istreambuf_iterator_wchar *last, int fmtflags, const locale *loc, numpunct_wchar *numpunct)
4201 wchar_t digits[23], *digits_pos;
4202 int i, basefield, base;
4203 char *dest_beg = dest, *dest_end = dest+24;
4204 BOOL error = TRUE, dest_empty = TRUE, found_zero = FALSE;
4206 TRACE("(%p %p %p %04x %p)\n", dest, first, last, fmtflags, loc);
4208 for(i=0; i<10; i++)
4209 digits[i] = mb_to_wc('0'+i, &this->cvt);
4210 for(i=0; i<6; i++) {
4211 digits[10+i] = mb_to_wc('a'+i, &this->cvt);
4212 digits[16+i] = mb_to_wc('A'+i, &this->cvt);
4215 basefield = fmtflags & FMTFLAG_basefield;
4216 if(basefield == FMTFLAG_oct)
4217 base = 8;
4218 else if(basefield == FMTFLAG_hex)
4219 base = 22; /* equal to the size of digits buffer */
4220 else if(!basefield)
4221 base = 0;
4222 else
4223 base = 10;
4225 istreambuf_iterator_wchar_val(first);
4226 if(first->strbuf && first->val==mb_to_wc('-', &this->cvt)) {
4227 *dest++ = '-';
4228 istreambuf_iterator_wchar_inc(first);
4229 }else if(first->strbuf && first->val==mb_to_wc('+', &this->cvt)) {
4230 *dest++ = '+';
4231 istreambuf_iterator_wchar_inc(first);
4234 if(first->strbuf && first->val==digits[0]) {
4235 found_zero = TRUE;
4236 istreambuf_iterator_wchar_inc(first);
4237 if(first->strbuf && (first->val==mb_to_wc('x', &this->cvt) || first->val==mb_to_wc('X', &this->cvt))) {
4238 if(!base || base == 22) {
4239 found_zero = FALSE;
4240 istreambuf_iterator_wchar_inc(first);
4241 base = 22;
4242 }else {
4243 base = 10;
4245 }else {
4246 error = FALSE;
4247 if(!base) base = 8;
4249 }else {
4250 if(!base) base = 10;
4252 digits[base] = 0;
4254 for(; first->strbuf; istreambuf_iterator_wchar_inc(first)) {
4255 if(!(digits_pos = wcschr(digits, first->val))) {
4256 break;
4257 }else {
4258 error = FALSE;
4259 if(dest_empty && first->val == digits[0]) {
4260 found_zero = TRUE;
4261 continue;
4263 dest_empty = FALSE;
4264 /* skip digits that can't be copied to dest buffer, other
4265 * functions are responsible for detecting overflows */
4266 if(dest < dest_end)
4267 *dest++ = (digits_pos-digits<10 ? '0'+digits_pos-digits :
4268 (digits_pos-digits<16 ? 'a'+digits_pos-digits-10 :
4269 'A'+digits_pos-digits-16));
4273 if(error) {
4274 if (found_zero)
4275 *dest++ = '0';
4276 else
4277 dest = dest_beg;
4278 }else if(dest_empty)
4279 *dest++ = '0';
4280 *dest = '\0';
4282 return (base==22 ? 16 : base);
4285 /* ?_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 */
4286 /* ?_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 */
4287 static int num_get_wchar__Getifld(const num_get *this, char *dest, istreambuf_iterator_wchar *first,
4288 istreambuf_iterator_wchar *last, int fmtflags, const locale *loc)
4290 return num_get__Getifld(this, dest, first, last,
4291 fmtflags, loc, numpunct_wchar_use_facet(loc));
4294 static istreambuf_iterator_wchar* num_get_do_get_void(const num_get *this,
4295 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar first,
4296 istreambuf_iterator_wchar last, ios_base *base, int *state,
4297 void **pval, numpunct_wchar *numpunct)
4299 unsigned __int64 v;
4300 char tmp[25], *end;
4301 int err;
4303 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
4305 v = _Stoullx(tmp, &end, num_get__Getifld(this, tmp, &first,
4306 &last, FMTFLAG_hex, &base->loc, numpunct), &err);
4307 if(v!=(unsigned __int64)((INT_PTR)v))
4308 *state |= IOSTATE_failbit;
4309 else if(end!=tmp && !err)
4310 *pval = (void*)((INT_PTR)v);
4311 else
4312 *state |= IOSTATE_failbit;
4314 if(!first.strbuf)
4315 *state |= IOSTATE_eofbit;
4317 *ret = first;
4318 return ret;
4321 /* ?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 */
4322 /* ?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 */
4323 #define call_num_get_wchar_do_get_void(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 4, istreambuf_iterator_wchar*, \
4324 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, void**), \
4325 (this, ret, first, last, base, state, pval))
4326 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_void,36)
4327 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_void(const num_get *this, istreambuf_iterator_wchar *ret,
4328 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, void **pval)
4330 return num_get_do_get_void(this, ret, first, last, base,
4331 state, pval, numpunct_wchar_use_facet(&base->loc));
4334 /* ?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 */
4335 /* ?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 */
4336 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_void,36)
4337 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_void(const num_get *this, istreambuf_iterator_wchar *ret,
4338 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, void **pval)
4340 return num_get_do_get_void(this, ret, first, last, base,
4341 state, pval, numpunct_short_use_facet(&base->loc));
4344 /* ?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 */
4345 /* ?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 */
4346 /* ?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 */
4347 /* ?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 */
4348 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_void,36)
4349 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_void(const num_get *this, istreambuf_iterator_wchar *ret,
4350 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, void **pval)
4352 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
4353 return call_num_get_wchar_do_get_void(this, ret, first, last, base, state, pval);
4356 static istreambuf_iterator_wchar* num_get_do_get_double(const num_get *this,
4357 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar first,
4358 istreambuf_iterator_wchar last, ios_base *base, int *state,
4359 double *pval, numpunct_wchar *numpunct)
4361 double v;
4362 char tmp[32], *end;
4363 int err;
4365 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
4367 v = _Stodx(tmp, &end, num_get__Getffld(this, tmp, &first, &last, &base->loc, numpunct), &err);
4368 if(end!=tmp && !err)
4369 *pval = v;
4370 else
4371 *state |= IOSTATE_failbit;
4373 if(!first.strbuf)
4374 *state |= IOSTATE_eofbit;
4376 *ret = first;
4377 return ret;
4380 /* ?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 */
4381 /* ?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 */
4382 /* ?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 */
4383 /* ?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 */
4384 #define call_num_get_wchar_do_get_ldouble(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 8, istreambuf_iterator_wchar*, \
4385 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, double*), \
4386 (this, ret, first, last, base, state, pval))
4387 #define call_num_get_wchar_do_get_double(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 12, istreambuf_iterator_wchar*, \
4388 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, double*), \
4389 (this, ret, first, last, base, state, pval))
4390 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_double,36)
4391 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_double(const num_get *this, istreambuf_iterator_wchar *ret,
4392 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, double *pval)
4394 return num_get_do_get_double(this, ret, first, last, base,
4395 state, pval, numpunct_wchar_use_facet(&base->loc));
4398 /* ?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 */
4399 /* ?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 */
4400 /* ?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 */
4401 /* ?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 */
4402 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_double,36)
4403 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_double(const num_get *this, istreambuf_iterator_wchar *ret,
4404 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, double *pval)
4406 return num_get_do_get_double(this, ret, first, last, base,
4407 state, pval, numpunct_short_use_facet(&base->loc));
4410 /* ?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 */
4411 /* ?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 */
4412 /* ?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 */
4413 /* ?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 */
4414 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_ldouble,36)
4415 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_ldouble(const num_get *this, istreambuf_iterator_wchar *ret,
4416 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, double *pval)
4418 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
4419 return call_num_get_wchar_do_get_ldouble(this, ret, first, last, base, state, pval);
4422 /* ?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 */
4423 /* ?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 */
4424 /* ?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 */
4425 /* ?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 */
4426 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_double,36)
4427 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_double(const num_get *this, istreambuf_iterator_wchar *ret,
4428 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, double *pval)
4430 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
4431 return call_num_get_wchar_do_get_double(this, ret, first, last, base, state, pval);
4434 static istreambuf_iterator_wchar* num_get_do_get_float(const num_get *this,
4435 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar first,
4436 istreambuf_iterator_wchar last, ios_base *base, int *state,
4437 float *pval, numpunct_wchar *numpunct)
4439 float v;
4440 char tmp[32], *end;
4441 int err;
4443 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
4445 v = _Stofx(tmp, &end, num_get__Getffld(this, tmp, &first,
4446 &last, &base->loc, numpunct), &err);
4447 if(end!=tmp && !err)
4448 *pval = v;
4449 else
4450 *state |= IOSTATE_failbit;
4452 if(!first.strbuf)
4453 *state |= IOSTATE_eofbit;
4455 *ret = first;
4456 return ret;
4459 /* ?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 */
4460 /* ?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 */
4461 #define call_num_get_wchar_do_get_float(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 16, istreambuf_iterator_wchar*, \
4462 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, float*), \
4463 (this, ret, first, last, base, state, pval))
4464 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_float,36)
4465 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_float(const num_get *this, istreambuf_iterator_wchar *ret,
4466 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, float *pval)
4468 return num_get_do_get_float(this, ret, first, last, base,
4469 state, pval, numpunct_wchar_use_facet(&base->loc));
4472 /* ?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 */
4473 /* ?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 */
4474 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_float,36)
4475 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_float(const num_get *this, istreambuf_iterator_wchar *ret,
4476 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, float *pval)
4478 return num_get_do_get_float(this, ret, first, last, base,
4479 state, pval, numpunct_short_use_facet(&base->loc));
4482 /* ?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 */
4483 /* ?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 */
4484 /* ?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 */
4485 /* ?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 */
4486 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_float,36)
4487 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_float(const num_get *this, istreambuf_iterator_wchar *ret,
4488 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, float *pval)
4490 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
4491 return call_num_get_wchar_do_get_float(this, ret, first, last, base, state, pval);
4494 static istreambuf_iterator_wchar* num_get_do_get_uint64(const num_get *this,
4495 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar first,
4496 istreambuf_iterator_wchar last, ios_base *base, int *state,
4497 ULONGLONG *pval, numpunct_wchar *numpunct)
4499 unsigned __int64 v;
4500 char tmp[25], *end;
4501 int err;
4503 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
4505 v = _Stoullx(tmp, &end, num_get__Getifld(this, tmp, &first,
4506 &last, base->fmtfl, &base->loc, numpunct), &err);
4507 if(end!=tmp && !err)
4508 *pval = v;
4509 else
4510 *state |= IOSTATE_failbit;
4512 if(!first.strbuf)
4513 *state |= IOSTATE_eofbit;
4515 *ret = first;
4516 return ret;
4519 /* ?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 */
4520 /* ?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 */
4521 #define call_num_get_wchar_do_get_uint64(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 20, istreambuf_iterator_wchar*, \
4522 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, ULONGLONG*), \
4523 (this, ret, first, last, base, state, pval))
4524 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_uint64,36)
4525 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_uint64(const num_get *this, istreambuf_iterator_wchar *ret,
4526 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, ULONGLONG *pval)
4528 return num_get_do_get_uint64(this, ret, first, last, base,
4529 state, pval, numpunct_wchar_use_facet(&base->loc));
4532 /* ?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 */
4533 /* ?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 */
4534 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_uint64,36)
4535 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_uint64(const num_get *this, istreambuf_iterator_wchar *ret,
4536 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, ULONGLONG *pval)
4538 return num_get_do_get_uint64(this, ret, first, last, base,
4539 state, pval, numpunct_short_use_facet(&base->loc));
4542 /* ?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 */
4543 /* ?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 */
4544 /* ?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 */
4545 /* ?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 */
4546 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_uint64,36)
4547 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_uint64(const num_get *this, istreambuf_iterator_wchar *ret,
4548 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, ULONGLONG *pval)
4550 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
4551 return call_num_get_wchar_do_get_uint64(this, ret, first, last, base, state, pval);
4554 static istreambuf_iterator_wchar* num_get_do_get_int64(const num_get *this,
4555 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar first,
4556 istreambuf_iterator_wchar last, ios_base *base, int *state,
4557 LONGLONG *pval, numpunct_wchar *numpunct)
4559 __int64 v;
4560 char tmp[25], *end;
4561 int err;
4563 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
4565 v = _Stollx(tmp, &end, num_get__Getifld(this, tmp, &first,
4566 &last, base->fmtfl, &base->loc, numpunct), &err);
4567 if(end!=tmp && !err)
4568 *pval = v;
4569 else
4570 *state |= IOSTATE_failbit;
4572 if(!first.strbuf)
4573 *state |= IOSTATE_eofbit;
4575 *ret = first;
4576 return ret;
4579 /* ?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 */
4580 /* ?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 */
4581 #define call_num_get_wchar_do_get_int64(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 24, istreambuf_iterator_wchar*, \
4582 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, LONGLONG*), \
4583 (this, ret, first, last, base, state, pval))
4584 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_int64,36)
4585 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_int64(const num_get *this, istreambuf_iterator_wchar *ret,
4586 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, LONGLONG *pval)
4588 return num_get_do_get_int64(this, ret, first, last, base,
4589 state, pval, numpunct_wchar_use_facet(&base->loc));
4592 /* ?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 */
4593 /* ?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 */
4594 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_int64,36)
4595 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_int64(const num_get *this, istreambuf_iterator_wchar *ret,
4596 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, LONGLONG *pval)
4598 return num_get_do_get_int64(this, ret, first, last, base,
4599 state, pval, numpunct_short_use_facet(&base->loc));
4602 /* ?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 */
4603 /* ?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 */
4604 /* ?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 */
4605 /* ?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 */
4606 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_int64,36)
4607 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_int64(const num_get *this, istreambuf_iterator_wchar *ret,
4608 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, LONGLONG *pval)
4610 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
4611 return call_num_get_wchar_do_get_int64(this, ret, first, last, base, state, pval);
4614 static istreambuf_iterator_wchar* num_get_do_get_ulong(const num_get *this,
4615 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar first,
4616 istreambuf_iterator_wchar last, ios_base *base, int *state,
4617 ULONG *pval, numpunct_wchar *numpunct)
4619 ULONG v;
4620 char tmp[25], *end;
4621 int err;
4623 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
4625 v = _Stoulx(tmp, &end, num_get__Getifld(this, tmp, &first,
4626 &last, base->fmtfl, &base->loc, numpunct), &err);
4627 if(end!=tmp && !err)
4628 *pval = v;
4629 else
4630 *state |= IOSTATE_failbit;
4632 if(!first.strbuf)
4633 *state |= IOSTATE_eofbit;
4635 *ret = first;
4636 return ret;
4639 /* ?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 */
4640 /* ?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 */
4641 #define call_num_get_wchar_do_get_ulong(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 28, istreambuf_iterator_wchar*, \
4642 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, ULONG*), \
4643 (this, ret, first, last, base, state, pval))
4644 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_ulong,36)
4645 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_ulong(const num_get *this, istreambuf_iterator_wchar *ret,
4646 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, ULONG *pval)
4648 return num_get_do_get_ulong(this, ret, first, last, base,
4649 state, pval, numpunct_wchar_use_facet(&base->loc));
4652 /* ?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 */
4653 /* ?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 */
4654 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_ulong,36)
4655 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_ulong(const num_get *this, istreambuf_iterator_wchar *ret,
4656 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, ULONG *pval)
4658 return num_get_do_get_ulong(this, ret, first, last, base,
4659 state, pval, numpunct_short_use_facet(&base->loc));
4662 /* ?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 */
4663 /* ?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 */
4664 /* ?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 */
4665 /* ?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 */
4666 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_ulong,36)
4667 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_ulong(const num_get *this, istreambuf_iterator_wchar *ret,
4668 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, ULONG *pval)
4670 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
4671 return call_num_get_wchar_do_get_ulong(this, ret, first, last, base, state, pval);
4674 static istreambuf_iterator_wchar* num_get_do_get_long(const num_get *this,
4675 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar first,
4676 istreambuf_iterator_wchar last, ios_base *base, int *state,
4677 LONG *pval, numpunct_wchar *numpunct)
4679 LONG v;
4680 char tmp[25], *end;
4681 int err;
4683 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
4685 v = _Stolx(tmp, &end, num_get__Getifld(this, tmp, &first,
4686 &last, base->fmtfl, &base->loc, numpunct), &err);
4687 if(end!=tmp && !err)
4688 *pval = v;
4689 else
4690 *state |= IOSTATE_failbit;
4692 if(!first.strbuf)
4693 *state |= IOSTATE_eofbit;
4695 *ret = first;
4696 return ret;
4699 /* ?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 */
4700 /* ?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 */
4701 #define call_num_get_wchar_do_get_long(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 32, istreambuf_iterator_wchar*, \
4702 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, LONG*), \
4703 (this, ret, first, last, base, state, pval))
4704 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_long,36)
4705 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_long(const num_get *this, istreambuf_iterator_wchar *ret,
4706 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, LONG *pval)
4708 return num_get_do_get_long(this, ret, first, last, base,
4709 state, pval, numpunct_wchar_use_facet(&base->loc));
4712 /* ?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 */
4713 /* ?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 */
4714 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_long,36)
4715 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_long(const num_get *this, istreambuf_iterator_wchar *ret,
4716 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, LONG *pval)
4718 return num_get_do_get_long(this, ret, first, last, base,
4719 state, pval, numpunct_short_use_facet(&base->loc));
4722 /* ?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 */
4723 /* ?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 */
4724 /* ?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 */
4725 /* ?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 */
4726 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_long,36)
4727 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_long(const num_get *this, istreambuf_iterator_wchar *ret,
4728 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, LONG *pval)
4730 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
4731 return call_num_get_wchar_do_get_long(this, ret, first, last, base, state, pval);
4734 /* ?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 */
4735 /* ?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 */
4736 #define call_num_get_wchar_do_get_uint(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 36, istreambuf_iterator_wchar*, \
4737 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, unsigned int*), \
4738 (this, ret, first, last, base, state, pval))
4739 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_uint,36)
4740 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_uint(const num_get *this, istreambuf_iterator_wchar *ret,
4741 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, unsigned int *pval)
4743 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
4744 return num_get_wchar_do_get_ulong(this, ret, first, last, base, state, pval);
4747 /* ?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 */
4748 /* ?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 */
4749 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_uint,36)
4750 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_uint(const num_get *this, istreambuf_iterator_wchar *ret,
4751 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, unsigned int *pval)
4753 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
4754 return num_get_short_do_get_ulong(this, ret, first, last, base, state, pval);
4757 /* ?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 */
4758 /* ?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 */
4759 /* ?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 */
4760 /* ?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 */
4761 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_uint,36)
4762 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_uint(const num_get *this, istreambuf_iterator_wchar *ret,
4763 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, unsigned int *pval)
4765 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
4766 return call_num_get_wchar_do_get_uint(this, ret, first, last, base, state, pval);
4769 /* ?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 */
4770 /* ?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 */
4771 #define call_num_get_wchar_do_get_ushort(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 40, istreambuf_iterator_wchar*, \
4772 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, unsigned short*), \
4773 (this, ret, first, last, base, state, pval))
4774 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_ushort,36)
4775 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_ushort(const num_get *this, istreambuf_iterator_wchar *ret,
4776 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, unsigned short *pval)
4778 ULONG v;
4779 char tmp[25], *beg, *end;
4780 int err, b;
4782 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
4784 b = num_get_wchar__Getifld(this, tmp,
4785 &first, &last, base->fmtfl, &base->loc);
4786 beg = tmp + (tmp[0]=='-' ? 1 : 0);
4787 v = _Stoulx(beg, &end, b, &err);
4789 if(v != (ULONG)((unsigned short)v))
4790 *state |= IOSTATE_failbit;
4791 else if(end!=beg && !err)
4792 *pval = (tmp[0]=='-' ? -((unsigned short)v) : v);
4793 else
4794 *state |= IOSTATE_failbit;
4796 if(!first.strbuf)
4797 *state |= IOSTATE_eofbit;
4799 *ret = first;
4800 return ret;
4803 /* ?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 */
4804 /* ?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 */
4805 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_ushort,36)
4806 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_ushort(const num_get *this, istreambuf_iterator_wchar *ret,
4807 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, unsigned short *pval)
4809 FIXME("(%p %p %p %p %p) stub\n", this, ret, base, state, pval);
4810 return ret;
4813 /* ?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 */
4814 /* ?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 */
4815 /* ?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@ */
4816 /* ?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 */
4817 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_ushort,36)
4818 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_ushort(const num_get *this, istreambuf_iterator_wchar *ret,
4819 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, unsigned short *pval)
4821 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
4822 return call_num_get_wchar_do_get_ushort(this, ret, first, last, base, state, pval);
4825 static istreambuf_iterator_wchar* num_get_do_get_bool(const num_get *this,
4826 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar first,
4827 istreambuf_iterator_wchar last, ios_base *base, int *state,
4828 MSVCP_bool *pval, numpunct_wchar *numpunct)
4830 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
4832 if(base->fmtfl & FMTFLAG_boolalpha) {
4833 basic_string_wchar false_bstr, true_bstr;
4834 const wchar_t *pfalse, *ptrue;
4836 numpunct_wchar_falsename(numpunct, &false_bstr);
4837 numpunct_wchar_truename(numpunct, &true_bstr);
4838 pfalse = basic_string_wchar_c_str(&false_bstr);
4839 ptrue = basic_string_wchar_c_str(&true_bstr);
4841 for(istreambuf_iterator_wchar_val(&first); first.strbuf;) {
4842 if(pfalse && *pfalse && first.val!=*pfalse)
4843 pfalse = NULL;
4844 if(ptrue && *ptrue && first.val!=*ptrue)
4845 ptrue = NULL;
4847 if(pfalse && *pfalse && ptrue && !*ptrue)
4848 ptrue = NULL;
4849 if(ptrue && *ptrue && pfalse && !*pfalse)
4850 pfalse = NULL;
4852 if(pfalse)
4853 pfalse++;
4854 if(ptrue)
4855 ptrue++;
4857 if(pfalse || ptrue)
4858 istreambuf_iterator_wchar_inc(&first);
4860 if((!pfalse || !*pfalse) && (!ptrue || !*ptrue))
4861 break;
4864 if(ptrue)
4865 *pval = TRUE;
4866 else if(pfalse)
4867 *pval = FALSE;
4868 else
4869 *state |= IOSTATE_failbit;
4871 basic_string_wchar_dtor(&false_bstr);
4872 basic_string_wchar_dtor(&true_bstr);
4873 }else {
4874 char tmp[25], *end;
4875 int err;
4876 LONG v = _Stolx(tmp, &end, num_get__Getifld(this, tmp, &first,
4877 &last, base->fmtfl, &base->loc, numpunct), &err);
4879 if(end!=tmp && err==0 && (v==0 || v==1))
4880 *pval = v;
4881 else
4882 *state |= IOSTATE_failbit;
4885 if(!first.strbuf)
4886 *state |= IOSTATE_eofbit;
4887 memcpy(ret, &first, sizeof(first));
4888 return ret;
4891 /* ?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 */
4892 /* ?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 */
4893 #define call_num_get_wchar_do_get_bool(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 44, istreambuf_iterator_wchar*, \
4894 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, MSVCP_bool*), \
4895 (this, ret, first, last, base, state, pval))
4896 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_bool,36)
4897 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_bool(const num_get *this, istreambuf_iterator_wchar *ret,
4898 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, MSVCP_bool *pval)
4900 return num_get_do_get_bool(this, ret, first, last, base,
4901 state, pval, numpunct_wchar_use_facet(&base->loc));
4904 /* ?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 */
4905 /* ?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 */
4906 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_bool,36)
4907 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_bool(const num_get *this, istreambuf_iterator_wchar *ret,
4908 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, MSVCP_bool *pval)
4910 return num_get_do_get_bool(this, ret, first, last, base,
4911 state, pval, numpunct_short_use_facet(&base->loc));
4914 /* ?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 */
4915 /* ?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 */
4916 /* ?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 */
4917 /* ?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 */
4918 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_bool,36)
4919 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_bool(const num_get *this, istreambuf_iterator_wchar *ret,
4920 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, MSVCP_bool *pval)
4922 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
4923 return call_num_get_wchar_do_get_bool(this, ret, first, last, base, state, pval);
4926 /* ?id@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@2V0locale@2@A */
4927 locale_id num_get_char_id = {0};
4929 /* ??_7?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@6B@ */
4930 extern const vtable_ptr MSVCP_num_get_char_vtable;
4932 /* ?_Init@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@IAEXABV_Locinfo@2@@Z */
4933 /* ?_Init@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@IEAAXAEBV_Locinfo@2@@Z */
4934 DEFINE_THISCALL_WRAPPER(num_get_char__Init, 8)
4935 void __thiscall num_get_char__Init(num_get *this, const _Locinfo *locinfo)
4937 TRACE("(%p %p)\n", this, locinfo);
4938 _Locinfo__Getcvt(locinfo, &this->cvt);
4941 /* ??0?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
4942 /* ??0?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
4943 DEFINE_THISCALL_WRAPPER(num_get_char_ctor_locinfo, 12)
4944 num_get* __thiscall num_get_char_ctor_locinfo(num_get *this,
4945 const _Locinfo *locinfo, MSVCP_size_t refs)
4947 TRACE("(%p %p %lu)\n", this, locinfo, refs);
4949 locale_facet_ctor_refs(&this->facet, refs);
4950 this->facet.vtable = &MSVCP_num_get_char_vtable;
4952 num_get_char__Init(this, locinfo);
4953 return this;
4956 /* ??0?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAE@I@Z */
4957 /* ??0?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAA@_K@Z */
4958 DEFINE_THISCALL_WRAPPER(num_get_char_ctor_refs, 8)
4959 num_get* __thiscall num_get_char_ctor_refs(num_get *this, MSVCP_size_t refs)
4961 _Locinfo locinfo;
4963 TRACE("(%p %lu)\n", this, refs);
4965 _Locinfo_ctor(&locinfo);
4966 num_get_char_ctor_locinfo(this, &locinfo, refs);
4967 _Locinfo_dtor(&locinfo);
4968 return this;
4971 /* ??_F?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAEXXZ */
4972 /* ??_F?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAAXXZ */
4973 DEFINE_THISCALL_WRAPPER(num_get_char_ctor, 4)
4974 num_get* __thiscall num_get_char_ctor(num_get *this)
4976 return num_get_char_ctor_refs(this, 0);
4979 /* ??1?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@UAE@XZ */
4980 /* ??1?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@UEAA@XZ */
4981 DEFINE_THISCALL_WRAPPER(num_get_char_dtor, 4)
4982 void __thiscall num_get_char_dtor(num_get *this)
4984 TRACE("(%p)\n", this);
4985 locale_facet_dtor(&this->facet);
4988 DEFINE_THISCALL_WRAPPER(num_get_char_vector_dtor, 8)
4989 num_get* __thiscall num_get_char_vector_dtor(num_get *this, unsigned int flags)
4991 TRACE("(%p %x)\n", this, flags);
4992 if(flags & 2) {
4993 /* we have an array, with the number of elements stored before the first object */
4994 INT_PTR i, *ptr = (INT_PTR *)this-1;
4996 for(i=*ptr-1; i>=0; i--)
4997 num_get_char_dtor(this+i);
4998 MSVCRT_operator_delete(ptr);
4999 } else {
5000 num_get_char_dtor(this);
5001 if(flags & 1)
5002 MSVCRT_operator_delete(this);
5005 return this;
5008 /* ?_Getcat@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
5009 /* ?_Getcat@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
5010 static MSVCP_size_t num_get_char__Getcat(const locale_facet **facet, const locale *loc)
5012 TRACE("(%p %p)\n", facet, loc);
5014 if(facet && !*facet) {
5015 _Locinfo locinfo;
5017 *facet = MSVCRT_operator_new(sizeof(num_get));
5018 if(!*facet) {
5019 ERR("Out of memory\n");
5020 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
5021 return 0;
5024 _Locinfo_ctor_cstr(&locinfo, basic_string_char_c_str(&loc->ptr->name));
5025 num_get_char_ctor_locinfo((num_get*)*facet, &locinfo, 0);
5026 _Locinfo_dtor(&locinfo);
5029 return LC_NUMERIC;
5032 num_get* num_get_char_use_facet(const locale *loc)
5034 static num_get *obj = NULL;
5036 _Lockit lock;
5037 const locale_facet *fac;
5039 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
5040 fac = locale__Getfacet(loc, locale_id_operator_size_t(&num_get_char_id), TRUE);
5041 if(fac) {
5042 _Lockit_dtor(&lock);
5043 return (num_get*)fac;
5046 if(obj) {
5047 _Lockit_dtor(&lock);
5048 return obj;
5051 num_get_char__Getcat(&fac, loc);
5052 obj = (num_get*)fac;
5053 locale_facet__Incref(&obj->facet);
5054 locale_facet_register(&obj->facet);
5055 _Lockit_dtor(&lock);
5057 return obj;
5060 /* ?_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 */
5061 /* ?_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 */
5062 /* Copies number to dest buffer, validates grouping and skips separators.
5063 * Updates first so it points past the number, all digits are skipped.
5064 * Returns how exponent needs to changed.
5065 * Size of dest buffer is not specified, assuming it's not smaller than 32:
5066 * strlen(+0.e+) + 22(digits) + 4(expontent) + 1(nullbyte)
5068 static int num_get_char__Getffld(const num_get *this, char *dest, istreambuf_iterator_char *first,
5069 istreambuf_iterator_char *last, const locale *loc)
5071 numpunct_char *numpunct = numpunct_char_use_facet(loc);
5072 int exp = 0;
5073 char *dest_beg = dest, *num_end = dest+25, *exp_end = dest+31;
5074 BOOL error = FALSE, got_digit = FALSE, got_nonzero = FALSE;
5076 TRACE("(%p %p %p %p)\n", dest, first, last, loc);
5078 istreambuf_iterator_char_val(first);
5079 /* get sign */
5080 if(first->strbuf && (first->val=='-' || first->val=='+')) {
5081 *dest++ = first->val;
5082 istreambuf_iterator_char_inc(first);
5086 /* read numbers before decimal */
5087 for(; first->strbuf; istreambuf_iterator_char_inc(first)) {
5088 if(first->val<'0' || first->val>'9') {
5089 break;
5090 }else {
5091 got_digit = TRUE; /* found a digit, zero or non-zero */
5092 /* write digit to dest if not a leading zero (to not waste dest buffer) */
5093 if(!got_nonzero && first->val == '0')
5094 continue;
5095 got_nonzero = TRUE;
5096 if(dest < num_end)
5097 *dest++ = first->val;
5098 else
5099 exp++; /* too many digits, just multiply by 10 */
5102 /* if all leading zeroes, we didn't write anything so put a zero we check for a decimal */
5103 if(got_digit && !got_nonzero)
5104 *dest++ = '0';
5106 /* get decimal, if any */
5107 if(first->strbuf && first->val==numpunct_char_decimal_point(numpunct)) {
5108 if(dest < num_end)
5109 *dest++ = *localeconv()->decimal_point;
5110 istreambuf_iterator_char_inc(first);
5113 /* read non-grouped after decimal */
5114 for(; first->strbuf; istreambuf_iterator_char_inc(first)) {
5115 if(first->val<'0' || first->val>'9')
5116 break;
5117 else if(dest<num_end) {
5118 got_digit = TRUE;
5119 *dest++ = first->val;
5123 /* read exponent, if any */
5124 if(first->strbuf && (first->val=='e' || first->val=='E')) {
5125 *dest++ = first->val;
5126 istreambuf_iterator_char_inc(first);
5128 if(first->strbuf && (first->val=='-' || first->val=='+')) {
5129 *dest++ = first->val;
5130 istreambuf_iterator_char_inc(first);
5133 got_digit = got_nonzero = FALSE;
5134 error = TRUE;
5135 /* skip any leading zeroes */
5136 for(; first->strbuf && first->val=='0'; istreambuf_iterator_char_inc(first))
5137 got_digit = TRUE;
5139 for(; first->strbuf && first->val>='0' && first->val<='9'; istreambuf_iterator_char_inc(first)) {
5140 got_digit = got_nonzero = TRUE; /* leading zeroes would have been skipped, so first digit is non-zero */
5141 error = FALSE;
5142 if(dest<exp_end)
5143 *dest++ = first->val;
5146 /* if just found zeroes for exponent, use that */
5147 if(got_digit && !got_nonzero)
5149 error = FALSE;
5150 if(dest<exp_end)
5151 *dest++ = '0';
5155 if(error) {
5156 *dest_beg = '\0';
5157 return 0;
5159 *dest++ = '\0';
5160 return exp;
5163 /* ?_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 */
5164 /* ?_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 */
5165 /* Copies number to dest buffer, validates grouping and skips separators.
5166 * Updates first so it points past the number, all digits are skipped.
5167 * Returns number base (8, 10 or 16).
5168 * Size of dest buffer is not specified, assuming it's not smaller than 25:
5169 * 22(8^22>2^64)+1(detect overflows)+1(sign)+1(nullbyte) = 25
5171 static int num_get_char__Getifld(const num_get *this, char *dest, istreambuf_iterator_char *first,
5172 istreambuf_iterator_char *last, int fmtflags, const locale *loc)
5174 static const char digits[] = "0123456789abcdefABCDEF";
5176 int basefield, base;
5177 char *dest_beg = dest, *dest_end = dest+24;
5178 BOOL error = TRUE, dest_empty = TRUE, found_zero = FALSE;
5180 TRACE("(%p %p %p %04x %p)\n", dest, first, last, fmtflags, loc);
5182 basefield = fmtflags & FMTFLAG_basefield;
5183 if(basefield == FMTFLAG_oct)
5184 base = 8;
5185 else if(basefield == FMTFLAG_hex)
5186 base = 22; /* equal to the size of digits buffer */
5187 else if(!basefield)
5188 base = 0;
5189 else
5190 base = 10;
5192 istreambuf_iterator_char_val(first);
5193 if(first->strbuf && (first->val=='-' || first->val=='+')) {
5194 *dest++ = first->val;
5195 istreambuf_iterator_char_inc(first);
5198 if(first->strbuf && first->val=='0') {
5199 found_zero = TRUE;
5200 istreambuf_iterator_char_inc(first);
5201 if(first->strbuf && (first->val=='x' || first->val=='X')) {
5202 if(!base || base == 22) {
5203 found_zero = FALSE;
5204 istreambuf_iterator_char_inc(first);
5205 base = 22;
5206 }else {
5207 base = 10;
5209 }else {
5210 error = FALSE;
5211 if(!base) base = 8;
5213 }else {
5214 if (!base) base = 10;
5217 for(; first->strbuf; istreambuf_iterator_char_inc(first)) {
5218 if(!memchr(digits, first->val, base)) {
5219 break;
5220 }else {
5221 error = FALSE;
5222 if(dest_empty && first->val == '0')
5224 found_zero = TRUE;
5225 continue;
5227 dest_empty = FALSE;
5228 /* skip digits that can't be copied to dest buffer, other
5229 * functions are responsible for detecting overflows */
5230 if(dest < dest_end)
5231 *dest++ = first->val;
5235 if(error) {
5236 if (found_zero)
5237 *dest++ = '0';
5238 else
5239 dest = dest_beg;
5240 }else if(dest_empty)
5241 *dest++ = '0';
5242 *dest = '\0';
5244 return (base==22 ? 16 : base);
5247 /* ?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 */
5248 /* ?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 */
5249 #define call_num_get_char_do_get_void(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 4, istreambuf_iterator_char*, \
5250 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, void**), \
5251 (this, ret, first, last, base, state, pval))
5252 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_void,36)
5253 istreambuf_iterator_char *__thiscall num_get_char_do_get_void(const num_get *this, istreambuf_iterator_char *ret,
5254 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, void **pval)
5256 unsigned __int64 v;
5257 char tmp[25], *end;
5258 int err;
5260 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5262 v = _Stoullx(tmp, &end, num_get_char__Getifld(this, tmp,
5263 &first, &last, FMTFLAG_hex, &base->loc), &err);
5264 if(v!=(unsigned __int64)((INT_PTR)v))
5265 *state |= IOSTATE_failbit;
5266 else if(end!=tmp && !err)
5267 *pval = (void*)((INT_PTR)v);
5268 else
5269 *state |= IOSTATE_failbit;
5271 if(!first.strbuf)
5272 *state |= IOSTATE_eofbit;
5274 *ret = first;
5275 return ret;
5278 /* ?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 */
5279 /* ?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 */
5280 DEFINE_THISCALL_WRAPPER(num_get_char_get_void,36)
5281 istreambuf_iterator_char *__thiscall num_get_char_get_void(const num_get *this, istreambuf_iterator_char *ret,
5282 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, void **pval)
5284 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5285 return call_num_get_char_do_get_void(this, ret, first, last, base, state, pval);
5288 /* ?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 */
5289 /* ?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 */
5290 /* ?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 */
5291 /* ?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 */
5292 #define call_num_get_char_do_get_ldouble(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 8, istreambuf_iterator_char*, \
5293 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, double*), \
5294 (this, ret, first, last, base, state, pval))
5295 #define call_num_get_char_do_get_double(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 12, istreambuf_iterator_char*, \
5296 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, double*), \
5297 (this, ret, first, last, base, state, pval))
5298 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_double,36)
5299 istreambuf_iterator_char *__thiscall num_get_char_do_get_double(const num_get *this, istreambuf_iterator_char *ret,
5300 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, double *pval)
5302 double v;
5303 char tmp[32], *end;
5304 int err;
5306 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5308 v = _Stodx(tmp, &end, num_get_char__Getffld(this, tmp, &first, &last, &base->loc), &err);
5309 if(end!=tmp && !err)
5310 *pval = v;
5311 else
5312 *state |= IOSTATE_failbit;
5314 if(!first.strbuf)
5315 *state |= IOSTATE_eofbit;
5317 *ret = first;
5318 return ret;
5321 /* ?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 */
5322 /* ?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 */
5323 DEFINE_THISCALL_WRAPPER(num_get_char_get_ldouble,36)
5324 istreambuf_iterator_char *__thiscall num_get_char_get_ldouble(const num_get *this, istreambuf_iterator_char *ret,
5325 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, double *pval)
5327 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5328 return call_num_get_char_do_get_ldouble(this, ret, first, last, base, state, pval);
5331 /* ?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 */
5332 /* ?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 */
5333 DEFINE_THISCALL_WRAPPER(num_get_char_get_double,36)
5334 istreambuf_iterator_char *__thiscall num_get_char_get_double(const num_get *this, istreambuf_iterator_char *ret,
5335 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, double *pval)
5337 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5338 return call_num_get_char_do_get_double(this, ret, first, last, base, state, pval);
5341 /* ?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 */
5342 /* ?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 */
5343 #define call_num_get_char_do_get_float(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 16, istreambuf_iterator_char*, \
5344 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, float*), \
5345 (this, ret, first, last, base, state, pval))
5346 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_float,36)
5347 istreambuf_iterator_char *__thiscall num_get_char_do_get_float(const num_get *this, istreambuf_iterator_char *ret,
5348 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, float *pval)
5350 float v;
5351 char tmp[32], *end;
5352 int err;
5354 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5356 v = _Stofx(tmp, &end, num_get_char__Getffld(this, tmp, &first, &last, &base->loc), &err);
5357 if(end!=tmp && !err)
5358 *pval = v;
5359 else
5360 *state |= IOSTATE_failbit;
5362 if(!first.strbuf)
5363 *state |= IOSTATE_eofbit;
5365 *ret = first;
5366 return ret;
5369 /* ?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 */
5370 /* ?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 */
5371 DEFINE_THISCALL_WRAPPER(num_get_char_get_float,36)
5372 istreambuf_iterator_char *__thiscall num_get_char_get_float(const num_get *this, istreambuf_iterator_char *ret,
5373 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, float *pval)
5375 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5376 return call_num_get_char_do_get_float(this, ret, first, last, base, state, pval);
5379 /* ?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 */
5380 /* ?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 */
5381 #define call_num_get_char_do_get_uint64(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 20, istreambuf_iterator_char*, \
5382 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, ULONGLONG*), \
5383 (this, ret, first, last, base, state, pval))
5384 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_uint64,36)
5385 istreambuf_iterator_char *__thiscall num_get_char_do_get_uint64(const num_get *this, istreambuf_iterator_char *ret,
5386 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, ULONGLONG *pval)
5388 unsigned __int64 v;
5389 char tmp[25], *end;
5390 int err;
5392 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5394 v = _Stoullx(tmp, &end, num_get_char__Getifld(this, tmp,
5395 &first, &last, base->fmtfl, &base->loc), &err);
5396 if(end!=tmp && !err)
5397 *pval = v;
5398 else
5399 *state |= IOSTATE_failbit;
5401 if(!first.strbuf)
5402 *state |= IOSTATE_eofbit;
5404 *ret = first;
5405 return ret;
5408 /* ?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 */
5409 /* ?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 */
5410 DEFINE_THISCALL_WRAPPER(num_get_char_get_uint64,36)
5411 istreambuf_iterator_char *__thiscall num_get_char_get_uint64(const num_get *this, istreambuf_iterator_char *ret,
5412 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, ULONGLONG *pval)
5414 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5415 return call_num_get_char_do_get_uint64(this, ret, first, last, base, state, pval);
5418 /* ?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 */
5419 /* ?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 */
5420 #define call_num_get_char_do_get_int64(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 24, istreambuf_iterator_char*, \
5421 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, LONGLONG*), \
5422 (this, ret, first, last, base, state, pval))
5423 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_int64,36)
5424 istreambuf_iterator_char *__thiscall num_get_char_do_get_int64(const num_get *this, istreambuf_iterator_char *ret,
5425 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, LONGLONG *pval)
5427 __int64 v;
5428 char tmp[25], *end;
5429 int err;
5431 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5433 v = _Stollx(tmp, &end, num_get_char__Getifld(this, tmp,
5434 &first, &last, base->fmtfl, &base->loc), &err);
5435 if(end!=tmp && !err)
5436 *pval = v;
5437 else
5438 *state |= IOSTATE_failbit;
5440 if(!first.strbuf)
5441 *state |= IOSTATE_eofbit;
5443 *ret = first;
5444 return ret;
5447 /* ?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 */
5448 /* ?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 */
5449 DEFINE_THISCALL_WRAPPER(num_get_char_get_int64,36)
5450 istreambuf_iterator_char *__thiscall num_get_char_get_int64(const num_get *this, istreambuf_iterator_char *ret,
5451 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, LONGLONG *pval)
5453 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5454 return call_num_get_char_do_get_int64(this, ret, first, last, base, state, pval);
5457 /* ?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 */
5458 /* ?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 */
5459 #define call_num_get_char_do_get_ulong(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 28, istreambuf_iterator_char*, \
5460 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, ULONG*), \
5461 (this, ret, first, last, base, state, pval))
5462 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_ulong,36)
5463 istreambuf_iterator_char *__thiscall num_get_char_do_get_ulong(const num_get *this, istreambuf_iterator_char *ret,
5464 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, ULONG *pval)
5466 ULONG v;
5467 char tmp[25], *end;
5468 int err;
5470 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5472 v = _Stoulx(tmp, &end, num_get_char__Getifld(this, tmp,
5473 &first, &last, base->fmtfl, &base->loc), &err);
5474 if(end!=tmp && !err)
5475 *pval = v;
5476 else
5477 *state |= IOSTATE_failbit;
5479 if(!first.strbuf)
5480 *state |= IOSTATE_eofbit;
5482 *ret = first;
5483 return ret;
5486 /* ?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 */
5487 /* ?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 */
5488 DEFINE_THISCALL_WRAPPER(num_get_char_get_ulong,36)
5489 istreambuf_iterator_char *__thiscall num_get_char_get_ulong(const num_get *this, istreambuf_iterator_char *ret,
5490 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, ULONG *pval)
5492 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5493 return call_num_get_char_do_get_ulong(this, ret, first, last, base, state, pval);
5496 /* ?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 */
5497 /* ?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 */
5498 #define call_num_get_char_do_get_long(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 32, istreambuf_iterator_char*, \
5499 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, LONG*), \
5500 (this, ret, first, last, base, state, pval))
5501 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_long,36)
5502 istreambuf_iterator_char *__thiscall num_get_char_do_get_long(const num_get *this, istreambuf_iterator_char *ret,
5503 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, LONG *pval)
5505 LONG v;
5506 char tmp[25], *end;
5507 int err;
5509 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5511 v = _Stolx(tmp, &end, num_get_char__Getifld(this, tmp,
5512 &first, &last, base->fmtfl, &base->loc), &err);
5513 if(end!=tmp && !err)
5514 *pval = v;
5515 else
5516 *state |= IOSTATE_failbit;
5518 if(!first.strbuf)
5519 *state |= IOSTATE_eofbit;
5521 *ret = first;
5522 return ret;
5525 /* ?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 */
5526 /* ?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 */
5527 DEFINE_THISCALL_WRAPPER(num_get_char_get_long,36)
5528 istreambuf_iterator_char *__thiscall num_get_char_get_long(const num_get *this, istreambuf_iterator_char *ret,
5529 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, LONG *pval)
5531 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5532 return call_num_get_char_do_get_long(this, ret, first, last, base, state, pval);
5535 /* ?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 */
5536 /* ?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 */
5537 #define call_num_get_char_do_get_uint(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 36, istreambuf_iterator_char*, \
5538 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, unsigned int*), \
5539 (this, ret, first, last, base, state, pval))
5540 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_uint,36)
5541 istreambuf_iterator_char *__thiscall num_get_char_do_get_uint(const num_get *this, istreambuf_iterator_char *ret,
5542 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, unsigned int *pval)
5544 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5545 return num_get_char_do_get_ulong(this, ret, first, last, base, state, pval);
5548 /* ?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 */
5549 /* ?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 */
5550 DEFINE_THISCALL_WRAPPER(num_get_char_get_uint,36)
5551 istreambuf_iterator_char *__thiscall num_get_char_get_uint(const num_get *this, istreambuf_iterator_char *ret,
5552 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, unsigned int *pval)
5554 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5555 return call_num_get_char_do_get_uint(this, ret, first, last, base, state, pval);
5558 /* ?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 */
5559 /* ?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 */
5560 #define call_num_get_char_do_get_ushort(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 40, istreambuf_iterator_char*, \
5561 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, unsigned short*), \
5562 (this, ret, first, last, base, state, pval))
5563 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_ushort,36)
5564 istreambuf_iterator_char *__thiscall num_get_char_do_get_ushort(const num_get *this, istreambuf_iterator_char *ret,
5565 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, unsigned short *pval)
5567 ULONG v;
5568 char tmp[25], *beg, *end;
5569 int err, b;
5571 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5573 b = num_get_char__Getifld(this, tmp,
5574 &first, &last, base->fmtfl, &base->loc);
5575 beg = tmp + (tmp[0]=='-' ? 1 : 0);
5576 v = _Stoulx(beg, &end, b, &err);
5578 if(v != (ULONG)((unsigned short)v))
5579 *state |= IOSTATE_failbit;
5580 else if(end!=beg && !err)
5581 *pval = (tmp[0]=='-' ? -((unsigned short)v) : v);
5582 else
5583 *state |= IOSTATE_failbit;
5585 if(!first.strbuf)
5586 *state |= IOSTATE_eofbit;
5588 *ret = first;
5589 return ret;
5592 /* ?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 */
5593 /* ?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 */
5594 DEFINE_THISCALL_WRAPPER(num_get_char_get_ushort,36)
5595 istreambuf_iterator_char *__thiscall num_get_char_get_ushort(const num_get *this, istreambuf_iterator_char *ret,
5596 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, unsigned short *pval)
5598 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5599 return call_num_get_char_do_get_ushort(this, ret, first, last, base, state, pval);
5602 /* ?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 */
5603 /* ?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 */
5604 #define call_num_get_char_do_get_bool(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 44, istreambuf_iterator_char*, \
5605 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, MSVCP_bool*), \
5606 (this, ret, first, last, base, state, pval))
5607 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_bool,36)
5608 istreambuf_iterator_char *__thiscall num_get_char_do_get_bool(const num_get *this, istreambuf_iterator_char *ret,
5609 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, MSVCP_bool *pval)
5611 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5613 if(base->fmtfl & FMTFLAG_boolalpha) {
5614 numpunct_char *numpunct = numpunct_char_use_facet(&base->loc);
5615 basic_string_char false_bstr, true_bstr;
5616 const char *pfalse, *ptrue;
5618 numpunct_char_falsename(numpunct, &false_bstr);
5619 numpunct_char_truename(numpunct, &true_bstr);
5620 pfalse = basic_string_char_c_str(&false_bstr);
5621 ptrue = basic_string_char_c_str(&true_bstr);
5623 for(istreambuf_iterator_char_val(&first); first.strbuf;) {
5624 if(pfalse && *pfalse && first.val!=*pfalse)
5625 pfalse = NULL;
5626 if(ptrue && *ptrue && first.val!=*ptrue)
5627 ptrue = NULL;
5629 if(pfalse && *pfalse && ptrue && !*ptrue)
5630 ptrue = NULL;
5631 if(ptrue && *ptrue && pfalse && !*pfalse)
5632 pfalse = NULL;
5634 if(pfalse)
5635 pfalse++;
5636 if(ptrue)
5637 ptrue++;
5639 if(pfalse || ptrue)
5640 istreambuf_iterator_char_inc(&first);
5642 if((!pfalse || !*pfalse) && (!ptrue || !*ptrue))
5643 break;
5646 if(ptrue)
5647 *pval = TRUE;
5648 else if(pfalse)
5649 *pval = FALSE;
5650 else
5651 *state |= IOSTATE_failbit;
5653 basic_string_char_dtor(&false_bstr);
5654 basic_string_char_dtor(&true_bstr);
5655 }else {
5656 char tmp[25], *end;
5657 int err;
5658 LONG v = _Stolx(tmp, &end, num_get_char__Getifld(this, tmp,
5659 &first, &last, base->fmtfl, &base->loc), &err);
5661 if(end!=tmp && err==0 && (v==0 || v==1))
5662 *pval = v;
5663 else
5664 *state |= IOSTATE_failbit;
5667 if(!first.strbuf)
5668 *state |= IOSTATE_eofbit;
5669 memcpy(ret, &first, sizeof(first));
5670 return ret;
5673 /* ?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 */
5674 /* ?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 */
5675 DEFINE_THISCALL_WRAPPER(num_get_char_get_bool,36)
5676 istreambuf_iterator_char *__thiscall num_get_char_get_bool(const num_get *this, istreambuf_iterator_char *ret,
5677 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, MSVCP_bool *pval)
5679 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5680 return call_num_get_char_do_get_bool(this, ret, first, last, base, state, pval);
5683 /* ?id@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@2V0locale@2@A */
5684 locale_id num_put_char_id = {0};
5686 /* num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@6B@ */
5687 extern const vtable_ptr MSVCP_num_put_char_vtable;
5689 /* ?_Init@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@IAEXABV_Locinfo@2@@Z */
5690 /* ?_Init@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@IEAAXAEBV_Locinfo@2@@Z */
5691 DEFINE_THISCALL_WRAPPER(num_put_char__Init, 8)
5692 void __thiscall num_put_char__Init(num_put *this, const _Locinfo *locinfo)
5694 TRACE("(%p %p)\n", this, locinfo);
5695 _Locinfo__Getcvt(locinfo, &this->cvt);
5698 /* ??0?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
5699 /* ??0?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
5700 DEFINE_THISCALL_WRAPPER(num_put_char_ctor_locinfo, 12)
5701 num_put* __thiscall num_put_char_ctor_locinfo(num_put *this, const _Locinfo *locinfo, MSVCP_size_t refs)
5703 TRACE("(%p %p %ld)\n", this, locinfo, refs);
5705 locale_facet_ctor_refs(&this->facet, refs);
5706 this->facet.vtable = &MSVCP_num_put_char_vtable;
5708 num_put_char__Init(this, locinfo);
5709 return this;
5712 /* ??0?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAE@I@Z */
5713 /* ??0?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAA@_K@Z */
5714 DEFINE_THISCALL_WRAPPER(num_put_char_ctor_refs, 8)
5715 num_put* __thiscall num_put_char_ctor_refs(num_put *this, MSVCP_size_t refs)
5717 _Locinfo locinfo;
5719 TRACE("(%p %lu)\n", this, refs);
5721 _Locinfo_ctor(&locinfo);
5722 num_put_char_ctor_locinfo(this, &locinfo, refs);
5723 _Locinfo_dtor(&locinfo);
5724 return this;
5727 /* ??_F?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAEXXZ */
5728 /* ??_F?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAAXXZ */
5729 DEFINE_THISCALL_WRAPPER(num_put_char_ctor, 4)
5730 num_put* __thiscall num_put_char_ctor(num_put *this)
5732 return num_put_char_ctor_refs(this, 0);
5735 /* ??1?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@UAE@XZ */
5736 /* ??1?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@UEAA@XZ */
5737 DEFINE_THISCALL_WRAPPER(num_put_char_dtor, 4)
5738 void __thiscall num_put_char_dtor(num_put *this)
5740 TRACE("(%p)\n", this);
5741 locale_facet_dtor(&this->facet);
5744 DEFINE_THISCALL_WRAPPER(num_put_char_vector_dtor, 8)
5745 num_put* __thiscall num_put_char_vector_dtor(num_put *this, unsigned int flags)
5747 TRACE("(%p %x)\n", this, flags);
5748 if(flags & 2) {
5749 /* we have an array, with the number of elements stored before the first object */
5750 INT_PTR i, *ptr = (INT_PTR *)this-1;
5752 for(i=*ptr-1; i>=0; i--)
5753 num_put_char_dtor(this+i);
5754 MSVCRT_operator_delete(ptr);
5755 } else {
5756 num_put_char_dtor(this);
5757 if(flags & 1)
5758 MSVCRT_operator_delete(this);
5761 return this;
5764 /* ?_Getcat@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
5765 /* ?_Getcat@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
5766 static MSVCP_size_t num_put_char__Getcat(const locale_facet **facet, const locale *loc)
5768 TRACE("(%p %p)\n", facet, loc);
5770 if(facet && !*facet) {
5771 _Locinfo locinfo;
5773 *facet = MSVCRT_operator_new(sizeof(num_put));
5774 if(!*facet) {
5775 ERR("Out of memory\n");
5776 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
5777 return 0;
5780 _Locinfo_ctor_cstr(&locinfo, basic_string_char_c_str(&loc->ptr->name));
5781 num_put_char_ctor_locinfo((num_put*)*facet, &locinfo, 0);
5782 _Locinfo_dtor(&locinfo);
5785 return LC_NUMERIC;
5788 num_put* num_put_char_use_facet(const locale *loc)
5790 static num_put *obj = NULL;
5792 _Lockit lock;
5793 const locale_facet *fac;
5795 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
5796 fac = locale__Getfacet(loc, locale_id_operator_size_t(&num_put_char_id), TRUE);
5797 if(fac) {
5798 _Lockit_dtor(&lock);
5799 return (num_put*)fac;
5802 if(obj) {
5803 _Lockit_dtor(&lock);
5804 return obj;
5807 num_put_char__Getcat(&fac, loc);
5808 obj = (num_put*)fac;
5809 locale_facet__Incref(&obj->facet);
5810 locale_facet_register(&obj->facet);
5811 _Lockit_dtor(&lock);
5813 return obj;
5816 /* ?_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 */
5817 /* ?_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 */
5818 static ostreambuf_iterator_char* num_put_char__Putc(const num_put *this, ostreambuf_iterator_char *ret,
5819 ostreambuf_iterator_char dest, const char *ptr, MSVCP_size_t count)
5821 TRACE("(%p %p %p %ld)\n", this, ret, ptr, count);
5823 for(; count>0; count--)
5824 ostreambuf_iterator_char_put(&dest, *ptr++);
5826 *ret = dest;
5827 return ret;
5830 /* ?_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 */
5831 /* ?_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 */
5832 static ostreambuf_iterator_char* num_put_char__Rep(const num_put *this, ostreambuf_iterator_char *ret,
5833 ostreambuf_iterator_char dest, char c, MSVCP_size_t count)
5835 TRACE("(%p %p %d %ld)\n", this, ret, c, count);
5837 for(; count>0; count--)
5838 ostreambuf_iterator_char_put(&dest, c);
5840 *ret = dest;
5841 return ret;
5844 /* ?_Ffmt@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@ABAPADPADDH@Z */
5845 /* ?_Ffmt@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@AEBAPEADPEADDH@Z */
5846 static char* num_put_char__Ffmt(const num_put *this, char *fmt, char spec, int fmtfl)
5848 int type = fmtfl & FMTFLAG_floatfield;
5849 char *p = fmt;
5851 TRACE("(%p %p %d %d)\n", this, fmt, spec, fmtfl);
5853 *p++ = '%';
5854 if(fmtfl & FMTFLAG_showpos)
5855 *p++ = '+';
5856 if(fmtfl & FMTFLAG_showpoint)
5857 *p++ = '#';
5858 *p++ = '.';
5859 *p++ = '*';
5860 if(spec)
5861 *p++ = spec;
5863 if(type == FMTFLAG_fixed)
5864 *p++ = 'f';
5865 else if(type == FMTFLAG_scientific)
5866 *p++ = (fmtfl & FMTFLAG_uppercase) ? 'E' : 'e';
5867 else if(type == (FMTFLAG_fixed|FMTFLAG_scientific))
5868 *p++ = (fmtfl & FMTFLAG_uppercase) ? 'A' : 'a';
5869 else
5870 *p++ = (fmtfl & FMTFLAG_uppercase) ? 'G' : 'g';
5872 *p++ = '\0';
5873 return fmt;
5876 /* TODO: This function should be removed when num_put_char__Fput is implemented */
5877 static ostreambuf_iterator_char* num_put_char_fput(const num_put *this, ostreambuf_iterator_char *ret,
5878 ostreambuf_iterator_char dest, ios_base *base, char fill, char *buf, MSVCP_size_t count)
5880 numpunct_char *numpunct = numpunct_char_use_facet(&base->loc);
5881 char *p, sep = *localeconv()->decimal_point;
5882 int adjustfield = base->fmtfl & FMTFLAG_adjustfield;
5883 MSVCP_size_t pad;
5885 TRACE("(%p %p %p %d %s %ld)\n", this, ret, base, fill, buf, count);
5887 /* Change decimal point */
5888 for(p=buf; p<buf+count; p++) {
5889 if(*p == sep) {
5890 *p = numpunct_char_decimal_point(numpunct);
5891 break;
5894 p--;
5896 /* Display number with padding */
5897 if(count >= base->wide)
5898 pad = 0;
5899 else
5900 pad = base->wide-count;
5901 base->wide = 0;
5903 if((adjustfield & FMTFLAG_internal) && (buf[0]=='-' || buf[0]=='+')) {
5904 num_put_char__Putc(this, &dest, dest, buf, 1);
5905 buf++;
5907 if(adjustfield != FMTFLAG_left) {
5908 num_put_char__Rep(this, ret, dest, fill, pad);
5909 pad = 0;
5911 num_put_char__Putc(this, &dest, dest, buf, count);
5912 return num_put_char__Rep(this, ret, dest, fill, pad);
5915 /* ?_Ifmt@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@ABAPADPADPBDH@Z */
5916 /* ?_Ifmt@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@AEBAPEADPEADPEBDH@Z */
5917 static char* num_put_char__Ifmt(const num_put *this, char *fmt, const char *spec, int fmtfl)
5919 int base = fmtfl & FMTFLAG_basefield;
5920 char *p = fmt;
5922 TRACE("(%p %p %p %d)\n", this, fmt, spec, fmtfl);
5924 *p++ = '%';
5925 if(fmtfl & FMTFLAG_showpos)
5926 *p++ = '+';
5927 if(fmtfl & FMTFLAG_showbase)
5928 *p++ = '#';
5930 *p++ = *spec++;
5931 if(*spec == 'l')
5932 *p++ = *spec++;
5934 if(base == FMTFLAG_oct)
5935 *p++ = 'o';
5936 else if(base == FMTFLAG_hex)
5937 *p++ = (fmtfl & FMTFLAG_uppercase) ? 'X' : 'x';
5938 else
5939 *p++ = *spec;
5941 *p++ = '\0';
5942 return fmt;
5945 /* ?_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 */
5946 /* ?_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 */
5947 static ostreambuf_iterator_char* num_put_char__Iput(const num_put *this, ostreambuf_iterator_char *ret,
5948 ostreambuf_iterator_char dest, ios_base *base, char fill, char *buf, MSVCP_size_t count)
5950 numpunct_char *numpunct = numpunct_char_use_facet(&base->loc);
5951 basic_string_char grouping_bstr;
5952 const char *grouping;
5953 char *p, sep;
5954 int cur_group = 0, group_size = 0;
5955 int adjustfield = base->fmtfl & FMTFLAG_adjustfield;
5956 MSVCP_size_t pad;
5958 TRACE("(%p %p %p %d %s %ld)\n", this, ret, base, fill, buf, count);
5960 /* Add separators to number */
5961 numpunct_char_grouping(numpunct, &grouping_bstr);
5962 grouping = basic_string_char_c_str(&grouping_bstr);
5963 sep = grouping[0] ? numpunct_char_thousands_sep(numpunct) : '\0';
5965 for(p=buf+count-1; p>buf && sep && grouping[cur_group]!=CHAR_MAX; p--) {
5966 group_size++;
5967 if(group_size == grouping[cur_group]) {
5968 group_size = 0;
5969 if(grouping[cur_group+1])
5970 cur_group++;
5972 memmove(p+1, p, buf+count-p);
5973 *p = sep;
5974 count++;
5977 basic_string_char_dtor(&grouping_bstr);
5979 /* Display number with padding */
5980 if(count >= base->wide)
5981 pad = 0;
5982 else
5983 pad = base->wide-count;
5984 base->wide = 0;
5986 if((adjustfield & FMTFLAG_internal) && (buf[0]=='-' || buf[0]=='+')) {
5987 num_put_char__Putc(this, &dest, dest, buf, 1);
5988 buf++;
5989 }else if((adjustfield & FMTFLAG_internal) && (buf[1]=='x' || buf[1]=='X')) {
5990 num_put_char__Putc(this, &dest, dest, buf, 2);
5991 buf += 2;
5993 if(adjustfield != FMTFLAG_left) {
5994 num_put_char__Rep(this, ret, dest, fill, pad);
5995 pad = 0;
5997 num_put_char__Putc(this, &dest, dest, buf, count);
5998 return num_put_char__Rep(this, ret, dest, fill, pad);
6001 /* ?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 */
6002 /* ?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 */
6003 #define call_num_put_char_do_put_long(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 28, ostreambuf_iterator_char*, \
6004 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, LONG), \
6005 (this, ret, dest, base, fill, v))
6006 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_long, 28)
6007 ostreambuf_iterator_char* __thiscall num_put_char_do_put_long(const num_put *this, ostreambuf_iterator_char *ret,
6008 ostreambuf_iterator_char dest, ios_base *base, char fill, LONG v)
6010 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
6011 char fmt[7]; /* strlen("%+#lld")+1 */
6013 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
6015 return num_put_char__Iput(this, ret, dest, base, fill, tmp,
6016 sprintf(tmp, num_put_char__Ifmt(this, fmt, "ld", base->fmtfl), v));
6019 /* ?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 */
6020 /* ?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 */
6021 DEFINE_THISCALL_WRAPPER(num_put_char_put_long, 28)
6022 ostreambuf_iterator_char* __thiscall num_put_char_put_long(const num_put *this, ostreambuf_iterator_char *ret,
6023 ostreambuf_iterator_char dest, ios_base *base, char fill, LONG v)
6025 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
6026 return call_num_put_char_do_put_long(this, ret, dest, base, fill, v);
6029 /* ?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 */
6030 /* ?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 */
6031 #define call_num_put_char_do_put_ulong(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 24, ostreambuf_iterator_char*, \
6032 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, ULONG), \
6033 (this, ret, dest, base, fill, v))
6034 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_ulong, 28)
6035 ostreambuf_iterator_char* __thiscall num_put_char_do_put_ulong(const num_put *this, ostreambuf_iterator_char *ret,
6036 ostreambuf_iterator_char dest, ios_base *base, char fill, ULONG v)
6038 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
6039 char fmt[7]; /* strlen("%+#lld")+1 */
6041 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
6043 return num_put_char__Iput(this, ret, dest, base, fill, tmp,
6044 sprintf(tmp, num_put_char__Ifmt(this, fmt, "lu", base->fmtfl), v));
6047 /* ?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 */
6048 /* ?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 */
6049 DEFINE_THISCALL_WRAPPER(num_put_char_put_ulong, 28)
6050 ostreambuf_iterator_char* __thiscall num_put_char_put_ulong(const num_put *this, ostreambuf_iterator_char *ret,
6051 ostreambuf_iterator_char dest, ios_base *base, char fill, ULONG v)
6053 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
6054 return call_num_put_char_do_put_ulong(this, ret, dest, base, fill, v);
6057 static inline streamsize get_precision(const ios_base *base)
6059 return base->prec <= 0 && !(base->fmtfl & FMTFLAG_fixed) ? 6 : base->prec;
6062 /* ?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 */
6063 /* ?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 */
6064 /* ?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 */
6065 /* ?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 */
6066 #define call_num_put_char_do_put_double(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 12, ostreambuf_iterator_char*, \
6067 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, double), \
6068 (this, ret, dest, base, fill, v))
6069 #define call_num_put_char_do_put_ldouble(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 8, ostreambuf_iterator_char*, \
6070 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, double), \
6071 (this, ret, dest, base, fill, v))
6072 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_double, 32)
6073 ostreambuf_iterator_char* __thiscall num_put_char_do_put_double(const num_put *this, ostreambuf_iterator_char *ret,
6074 ostreambuf_iterator_char dest, ios_base *base, char fill, double v)
6076 char *tmp;
6077 char fmt[8]; /* strlen("%+#.*lg")+1 */
6078 int size;
6079 streamsize prec;
6081 TRACE("(%p %p %p %d %lf)\n", this, ret, base, fill, v);
6083 num_put_char__Ffmt(this, fmt, '\0', base->fmtfl);
6084 prec = get_precision(base);
6085 size = _scprintf(fmt, prec, v);
6087 /* TODO: don't use dynamic allocation */
6088 tmp = MSVCRT_operator_new(size*2);
6089 if(!tmp) {
6090 ERR("Out of memory\n");
6091 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
6093 num_put_char_fput(this, ret, dest, base, fill, tmp, sprintf(tmp, fmt, prec, v));
6094 MSVCRT_operator_delete(tmp);
6095 return ret;
6098 /* ?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 */
6099 /* ?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 */
6100 DEFINE_THISCALL_WRAPPER(num_put_char_put_double, 32)
6101 ostreambuf_iterator_char* __thiscall num_put_char_put_double(const num_put *this, ostreambuf_iterator_char *ret,
6102 ostreambuf_iterator_char dest, ios_base *base, char fill, double v)
6104 TRACE("(%p %p %p %d %lf)\n", this, ret, base, fill, v);
6105 return call_num_put_char_do_put_double(this, ret, dest, base, fill, v);
6108 /* ?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 */
6109 /* ?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 */
6110 DEFINE_THISCALL_WRAPPER(num_put_char_put_ldouble, 32)
6111 ostreambuf_iterator_char* __thiscall num_put_char_put_ldouble(const num_put *this, ostreambuf_iterator_char *ret,
6112 ostreambuf_iterator_char dest, ios_base *base, char fill, double v)
6114 TRACE("(%p %p %p %d %lf)\n", this, ret, base, fill, v);
6115 return call_num_put_char_do_put_ldouble(this, ret, dest, base, fill, v);
6118 /* ?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 */
6119 /* ?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 */
6120 #define call_num_put_char_do_put_ptr(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 4, ostreambuf_iterator_char*, \
6121 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, const void*), \
6122 (this, ret, dest, base, fill, v))
6123 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_ptr, 28)
6124 ostreambuf_iterator_char* __thiscall num_put_char_do_put_ptr(const num_put *this, ostreambuf_iterator_char *ret,
6125 ostreambuf_iterator_char dest, ios_base *base, char fill, const void *v)
6127 char tmp[17]; /* 8(16^8==2^64)*2(separators beetwen every digit) + 1 */
6129 TRACE("(%p %p %p %d %p)\n", this, ret, base, fill, v);
6131 return num_put_char__Iput(this, ret, dest, base, fill, tmp, sprintf(tmp, "%p", v));
6134 /* ?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 */
6135 /* ?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 */
6136 DEFINE_THISCALL_WRAPPER(num_put_char_put_ptr, 28)
6137 ostreambuf_iterator_char* __thiscall num_put_char_put_ptr(const num_put *this, ostreambuf_iterator_char *ret,
6138 ostreambuf_iterator_char dest, ios_base *base, char fill, const void *v)
6140 TRACE("(%p %p %p %d %p)\n", this, ret, base, fill, v);
6141 return call_num_put_char_do_put_ptr(this, ret, dest, base, fill, v);
6144 /* ?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 */
6145 /* ?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 */
6146 #define call_num_put_char_do_put_int64(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 20, ostreambuf_iterator_char*, \
6147 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, __int64), \
6148 (this, ret, dest, base, fill, v))
6149 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_int64, 32)
6150 ostreambuf_iterator_char* __thiscall num_put_char_do_put_int64(const num_put *this, ostreambuf_iterator_char *ret,
6151 ostreambuf_iterator_char dest, ios_base *base, char fill, __int64 v)
6153 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
6154 char fmt[7]; /* strlen("%+#lld")+1 */
6156 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
6158 return num_put_char__Iput(this, ret, dest, base, fill, tmp,
6159 sprintf(tmp, num_put_char__Ifmt(this, fmt, "lld", base->fmtfl), v));
6162 /* ?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 */
6163 /* ?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 */
6164 DEFINE_THISCALL_WRAPPER(num_put_char_put_int64, 32)
6165 ostreambuf_iterator_char* __thiscall num_put_char_put_int64(const num_put *this, ostreambuf_iterator_char *ret,
6166 ostreambuf_iterator_char dest, ios_base *base, char fill, __int64 v)
6168 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
6169 return call_num_put_char_do_put_int64(this, ret, dest, base, fill, v);
6172 /* ?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 */
6173 /* ?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 */
6174 #define call_num_put_char_do_put_uint64(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 16, ostreambuf_iterator_char*, \
6175 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, unsigned __int64), \
6176 (this, ret, dest, base, fill, v))
6177 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_uint64, 32)
6178 ostreambuf_iterator_char* __thiscall num_put_char_do_put_uint64(const num_put *this, ostreambuf_iterator_char *ret,
6179 ostreambuf_iterator_char dest, ios_base *base, char fill, unsigned __int64 v)
6181 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
6182 char fmt[7]; /* strlen("%+#lld")+1 */
6184 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
6186 return num_put_char__Iput(this, ret, dest, base, fill, tmp,
6187 sprintf(tmp, num_put_char__Ifmt(this, fmt, "llu", base->fmtfl), v));
6190 /* ?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 */
6191 /* ?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 */
6192 DEFINE_THISCALL_WRAPPER(num_put_char_put_uint64, 32)
6193 ostreambuf_iterator_char* __thiscall num_put_char_put_uint64(const num_put *this, ostreambuf_iterator_char *ret,
6194 ostreambuf_iterator_char dest, ios_base *base, char fill, unsigned __int64 v)
6196 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
6197 return call_num_put_char_do_put_uint64(this, ret, dest, base, fill, v);
6200 /* ?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 */
6201 /* ?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 */
6202 #define call_num_put_char_do_put_bool(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 32, ostreambuf_iterator_char*, \
6203 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, MSVCP_bool), \
6204 (this, ret, dest, base, fill, v))
6205 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_bool, 28)
6206 ostreambuf_iterator_char* __thiscall num_put_char_do_put_bool(const num_put *this, ostreambuf_iterator_char *ret,
6207 ostreambuf_iterator_char dest, ios_base *base, char fill, MSVCP_bool v)
6209 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
6211 if(base->fmtfl & FMTFLAG_boolalpha) {
6212 numpunct_char *numpunct = numpunct_char_use_facet(&base->loc);
6213 basic_string_char str;
6214 MSVCP_size_t pad, len;
6216 if(v)
6217 numpunct_char_truename(numpunct, &str);
6218 else
6219 numpunct_char_falsename(numpunct, &str);
6221 len = basic_string_char_length(&str);
6222 pad = (len>base->wide ? 0 : base->wide-len);
6223 base->wide = 0;
6225 if((base->fmtfl & FMTFLAG_adjustfield) != FMTFLAG_left) {
6226 num_put_char__Rep(this, &dest, dest, fill, pad);
6227 pad = 0;
6229 num_put_char__Putc(this, &dest, dest, basic_string_char_c_str(&str), len);
6230 basic_string_char_dtor(&str);
6231 return num_put_char__Rep(this, ret, dest, fill, pad);
6234 return num_put_char_put_long(this, ret, dest, base, fill, v);
6237 /* ?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 */
6238 /* ?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 */
6239 DEFINE_THISCALL_WRAPPER(num_put_char_put_bool, 28)
6240 ostreambuf_iterator_char* __thiscall num_put_char_put_bool(const num_put *this, ostreambuf_iterator_char *ret,
6241 ostreambuf_iterator_char dest, ios_base *base, char fill, MSVCP_bool v)
6243 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
6244 return call_num_put_char_do_put_bool(this, ret, dest, base, fill, v);
6247 /* ?id@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@2V0locale@2@A */
6248 static locale_id num_put_wchar_id = {0};
6249 /* ?id@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@2V0locale@2@A */
6250 locale_id num_put_short_id = {0};
6252 /* num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@6B@ */
6253 extern const vtable_ptr MSVCP_num_put_wchar_vtable;
6254 /* num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@6B@ */
6255 extern const vtable_ptr MSVCP_num_put_short_vtable;
6257 /* ?_Init@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@IAEXABV_Locinfo@2@@Z */
6258 /* ?_Init@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@IEAAXAEBV_Locinfo@2@@Z */
6259 DEFINE_THISCALL_WRAPPER(num_put_wchar__Init, 8)
6260 void __thiscall num_put_wchar__Init(num_put *this, const _Locinfo *locinfo)
6262 TRACE("(%p %p)\n", this, locinfo);
6263 _Locinfo__Getcvt(locinfo, &this->cvt);
6266 /* ??0?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
6267 /* ??0?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
6268 static num_put* num_put_wchar_ctor_locinfo(num_put *this, const _Locinfo *locinfo, MSVCP_size_t refs)
6270 TRACE("(%p %p %ld)\n", this, locinfo, refs);
6272 locale_facet_ctor_refs(&this->facet, refs);
6273 this->facet.vtable = &MSVCP_num_put_wchar_vtable;
6275 num_put_wchar__Init(this, locinfo);
6276 return this;
6279 /* ??0?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
6280 /* ??0?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
6281 DEFINE_THISCALL_WRAPPER(num_put_short_ctor_locinfo, 12)
6282 num_put* __thiscall num_put_short_ctor_locinfo(num_put *this, const _Locinfo *locinfo, MSVCP_size_t refs)
6284 num_put_wchar_ctor_locinfo(this, locinfo, refs);
6285 this->facet.vtable = &MSVCP_num_put_short_vtable;
6286 return this;
6289 /* ??0?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAE@I@Z */
6290 /* ??0?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAA@_K@Z */
6291 static num_put* num_put_wchar_ctor_refs(num_put *this, MSVCP_size_t refs)
6293 _Locinfo locinfo;
6295 TRACE("(%p %lu)\n", this, refs);
6297 _Locinfo_ctor(&locinfo);
6298 num_put_wchar_ctor_locinfo(this, &locinfo, refs);
6299 _Locinfo_dtor(&locinfo);
6300 return this;
6303 /* ??0?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAE@I@Z */
6304 /* ??0?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEAA@_K@Z */
6305 DEFINE_THISCALL_WRAPPER(num_put_short_ctor_refs, 8)
6306 num_put* __thiscall num_put_short_ctor_refs(num_put *this, MSVCP_size_t refs)
6308 num_put_wchar_ctor_refs(this, refs);
6309 this->facet.vtable = &MSVCP_num_put_short_vtable;
6310 return this;
6313 /* ??_F?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAEXXZ */
6314 /* ??_F?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEAAXXZ */
6315 DEFINE_THISCALL_WRAPPER(num_put_short_ctor, 4)
6316 num_put* __thiscall num_put_short_ctor(num_put *this)
6318 return num_put_short_ctor_refs(this, 0);
6321 /* ??1?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@UAE@XZ */
6322 /* ??1?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@UEAA@XZ */
6323 DEFINE_THISCALL_WRAPPER(num_put_wchar_dtor, 4)
6324 void __thiscall num_put_wchar_dtor(num_put *this)
6326 TRACE("(%p)\n", this);
6327 locale_facet_dtor(&this->facet);
6330 DEFINE_THISCALL_WRAPPER(num_put_wchar_vector_dtor, 8)
6331 num_put* __thiscall num_put_wchar_vector_dtor(num_put *this, unsigned int flags)
6333 TRACE("(%p %x)\n", this, flags);
6334 if(flags & 2) {
6335 /* we have an array, with the number of elements stored before the first object */
6336 INT_PTR i, *ptr = (INT_PTR *)this-1;
6338 for(i=*ptr-1; i>=0; i--)
6339 num_put_wchar_dtor(this+i);
6340 MSVCRT_operator_delete(ptr);
6341 } else {
6342 num_put_wchar_dtor(this);
6343 if(flags & 1)
6344 MSVCRT_operator_delete(this);
6347 return this;
6350 /* ?_Getcat@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
6351 /* ?_Getcat@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
6352 static MSVCP_size_t num_put_wchar__Getcat(const locale_facet **facet, const locale *loc)
6354 TRACE("(%p %p)\n", facet, loc);
6356 if(facet && !*facet) {
6357 _Locinfo locinfo;
6359 *facet = MSVCRT_operator_new(sizeof(num_put));
6360 if(!*facet) {
6361 ERR("Out of memory\n");
6362 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
6363 return 0;
6366 _Locinfo_ctor_cstr(&locinfo, basic_string_char_c_str(&loc->ptr->name));
6367 num_put_wchar_ctor_locinfo((num_put*)*facet, &locinfo, 0);
6368 _Locinfo_dtor(&locinfo);
6371 return LC_NUMERIC;
6374 /* ?_Getcat@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
6375 /* ?_Getcat@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
6376 static MSVCP_size_t num_put_short__Getcat(const locale_facet **facet, const locale *loc)
6378 TRACE("(%p %p)\n", facet, loc);
6380 if(facet && !*facet) {
6381 _Locinfo locinfo;
6383 *facet = MSVCRT_operator_new(sizeof(num_put));
6384 if(!*facet) {
6385 ERR("Out of memory\n");
6386 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
6387 return 0;
6390 _Locinfo_ctor_cstr(&locinfo, basic_string_char_c_str(&loc->ptr->name));
6391 num_put_short_ctor_locinfo((num_put*)*facet, &locinfo, 0);
6392 _Locinfo_dtor(&locinfo);
6395 return LC_NUMERIC;
6398 static num_put* num_put_wchar_use_facet(const locale *loc)
6400 static num_put *obj = NULL;
6402 _Lockit lock;
6403 const locale_facet *fac;
6405 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
6406 fac = locale__Getfacet(loc, locale_id_operator_size_t(&num_put_wchar_id), TRUE);
6407 if(fac) {
6408 _Lockit_dtor(&lock);
6409 return (num_put*)fac;
6412 if(obj) {
6413 _Lockit_dtor(&lock);
6414 return obj;
6417 num_put_wchar__Getcat(&fac, loc);
6418 obj = (num_put*)fac;
6419 locale_facet__Incref(&obj->facet);
6420 locale_facet_register(&obj->facet);
6421 _Lockit_dtor(&lock);
6423 return obj;
6426 num_put* num_put_short_use_facet(const locale *loc)
6428 static num_put *obj = NULL;
6430 _Lockit lock;
6431 const locale_facet *fac;
6433 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
6434 fac = locale__Getfacet(loc, locale_id_operator_size_t(&num_put_short_id), TRUE);
6435 if(fac) {
6436 _Lockit_dtor(&lock);
6437 return (num_put*)fac;
6440 if(obj) {
6441 _Lockit_dtor(&lock);
6442 return obj;
6445 num_put_short__Getcat(&fac, loc);
6446 obj = (num_put*)fac;
6447 locale_facet__Incref(&obj->facet);
6448 locale_facet_register(&obj->facet);
6449 _Lockit_dtor(&lock);
6451 return obj;
6454 /* ?_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 */
6455 /* ?_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 */
6456 /* ?_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 */
6457 /* ?_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 */
6458 static ostreambuf_iterator_wchar* num_put_wchar__Put(const num_put *this, ostreambuf_iterator_wchar *ret,
6459 ostreambuf_iterator_wchar dest, const wchar_t *ptr, MSVCP_size_t count)
6461 TRACE("(%p %p %s %ld)\n", this, ret, debugstr_wn(ptr, count), count);
6463 for(; count>0; count--)
6464 ostreambuf_iterator_wchar_put(&dest, *ptr++);
6466 *ret = dest;
6467 return ret;
6470 /* ?_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 */
6471 /* ?_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 */
6472 /* ?_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 */
6473 /* ?_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 */
6474 static ostreambuf_iterator_wchar* num_put_wchar__Putc(const num_put *this, ostreambuf_iterator_wchar *ret,
6475 ostreambuf_iterator_wchar dest, const char *ptr, MSVCP_size_t count)
6477 int state = 0;
6478 wchar_t ch;
6480 TRACE("(%p %p %s %ld)\n", this, ret, debugstr_an(ptr, count), count);
6482 for(; count>0; count--) {
6483 if(_Mbrtowc(&ch, ptr++, 1, &state, &this->cvt) == 1)
6484 ostreambuf_iterator_wchar_put(&dest, ch);
6487 *ret = dest;
6488 return ret;
6491 /* ?_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 */
6492 /* ?_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 */
6493 /* ?_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 */
6494 /* ?_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 */
6495 static ostreambuf_iterator_wchar* num_put_wchar__Rep(const num_put *this, ostreambuf_iterator_wchar *ret,
6496 ostreambuf_iterator_wchar dest, wchar_t c, MSVCP_size_t count)
6498 TRACE("(%p %p %d %ld)\n", this, ret, c, count);
6500 for(; count>0; count--)
6501 ostreambuf_iterator_wchar_put(&dest, c);
6503 *ret = dest;
6504 return ret;
6507 /* ?_Ffmt@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@ABAPADPADDH@Z */
6508 /* ?_Ffmt@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@AEBAPEADPEADDH@Z */
6509 /* ?_Ffmt@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@ABAPADPADDH@Z */
6510 /* ?_Ffmt@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@AEBAPEADPEADDH@Z */
6511 static char* num_put_wchar__Ffmt(const num_put *this, char *fmt, char spec, int fmtfl)
6513 int type = fmtfl & FMTFLAG_floatfield;
6514 char *p = fmt;
6516 TRACE("(%p %p %d %d)\n", this, fmt, spec, fmtfl);
6518 *p++ = '%';
6519 if(fmtfl & FMTFLAG_showpos)
6520 *p++ = '+';
6521 if(fmtfl & FMTFLAG_showbase)
6522 *p++ = '#';
6523 *p++ = '.';
6524 *p++ = '*';
6525 if(spec)
6526 *p++ = spec;
6528 if(type == FMTFLAG_fixed)
6529 *p++ = 'f';
6530 else if(type == FMTFLAG_scientific)
6531 *p++ = (fmtfl & FMTFLAG_uppercase) ? 'E' : 'e';
6532 else if(type == (FMTFLAG_fixed|FMTFLAG_scientific))
6533 *p++ = (fmtfl & FMTFLAG_uppercase) ? 'A' : 'a';
6534 else
6535 *p++ = (fmtfl & FMTFLAG_uppercase) ? 'G' : 'g';
6537 *p++ = '\0';
6538 return fmt;
6541 /* TODO: This function should be removed when num_put_wchar__Fput is implemented */
6542 static ostreambuf_iterator_wchar* num_put__fput(const num_put *this, ostreambuf_iterator_wchar *ret,
6543 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, char *buf,
6544 MSVCP_size_t count, numpunct_wchar *numpunct)
6546 char *p, dec_point = *localeconv()->decimal_point;
6547 int adjustfield = base->fmtfl & FMTFLAG_adjustfield;
6548 MSVCP_size_t i, pad;
6550 TRACE("(%p %p %p %d %s %ld)\n", this, ret, base, fill, buf, count);
6552 for(p=buf; p<buf+count; p++) {
6553 if(*p == dec_point)
6554 break;
6556 p--;
6558 /* Display number with padding */
6559 if(count >= base->wide)
6560 pad = 0;
6561 else
6562 pad = base->wide-count;
6563 base->wide = 0;
6565 if((adjustfield & FMTFLAG_internal) && (buf[0]=='-' || buf[0]=='+')) {
6566 num_put_wchar__Putc(this, &dest, dest, buf, 1);
6567 buf++;
6569 if(adjustfield != FMTFLAG_left) {
6570 num_put_wchar__Rep(this, ret, dest, fill, pad);
6571 pad = 0;
6574 for(i=0; i<count; i++) {
6575 if(buf[i] == dec_point)
6576 num_put_wchar__Rep(this, &dest, dest, numpunct_wchar_decimal_point(numpunct), 1);
6577 else
6578 num_put_wchar__Putc(this, &dest, dest, buf+i, 1);
6581 return num_put_wchar__Rep(this, ret, dest, fill, pad);
6584 /* ?_Ifmt@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@ABAPADPADPBDH@Z */
6585 /* ?_Ifmt@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@AEBAPEADPEADPEBDH@Z */
6586 /* ?_Ifmt@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@ABAPADPADPBDH@Z */
6587 /* ?_Ifmt@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@AEBAPEADPEADPEBDH@Z */
6588 static char* num_put_wchar__Ifmt(const num_put *this, char *fmt, const char *spec, int fmtfl)
6590 int base = fmtfl & FMTFLAG_basefield;
6591 char *p = fmt;
6593 TRACE("(%p %p %p %d)\n", this, fmt, spec, fmtfl);
6595 *p++ = '%';
6596 if(fmtfl & FMTFLAG_showpos)
6597 *p++ = '+';
6598 if(fmtfl & FMTFLAG_showbase)
6599 *p++ = '#';
6601 *p++ = *spec++;
6602 if(*spec == 'l')
6603 *p++ = *spec++;
6605 if(base == FMTFLAG_oct)
6606 *p++ = 'o';
6607 else if(base == FMTFLAG_hex)
6608 *p++ = (fmtfl & FMTFLAG_uppercase) ? 'X' : 'x';
6609 else
6610 *p++ = *spec;
6612 *p++ = '\0';
6613 return fmt;
6616 static ostreambuf_iterator_wchar* num_put__Iput(const num_put *this, ostreambuf_iterator_wchar *ret,
6617 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, char *buf,
6618 MSVCP_size_t count, numpunct_wchar *numpunct)
6620 basic_string_char grouping_bstr;
6621 const char *grouping;
6622 char *p;
6623 wchar_t sep;
6624 int cur_group = 0, group_size = 0;
6625 int adjustfield = base->fmtfl & FMTFLAG_adjustfield;
6626 MSVCP_size_t i, pad;
6628 TRACE("(%p %p %p %d %s %ld)\n", this, ret, base, fill, buf, count);
6630 /* Add separators to number */
6631 numpunct_wchar_grouping(numpunct, &grouping_bstr);
6632 grouping = basic_string_char_c_str(&grouping_bstr);
6633 sep = grouping[0] ? numpunct_wchar_thousands_sep(numpunct) : '\0';
6635 for(p=buf+count-1; p>buf && sep && grouping[cur_group]!=CHAR_MAX; p--) {
6636 group_size++;
6637 if(group_size == grouping[cur_group]) {
6638 group_size = 0;
6639 if(grouping[cur_group+1])
6640 cur_group++;
6642 memmove(p+1, p, buf+count-p);
6643 *p = '\0'; /* mark thousands separator positions */
6644 count++;
6647 basic_string_char_dtor(&grouping_bstr);
6649 /* Display number with padding */
6650 if(count >= base->wide)
6651 pad = 0;
6652 else
6653 pad = base->wide-count;
6654 base->wide = 0;
6656 if((adjustfield & FMTFLAG_internal) && (buf[0]=='-' || buf[0]=='+')) {
6657 num_put_wchar__Putc(this, &dest, dest, buf, 1);
6658 buf++;
6659 }else if((adjustfield & FMTFLAG_internal) && (buf[1]=='x' || buf[1]=='X')) {
6660 num_put_wchar__Putc(this, &dest, dest, buf, 2);
6661 buf += 2;
6663 if(adjustfield != FMTFLAG_left) {
6664 num_put_wchar__Rep(this, ret, dest, fill, pad);
6665 pad = 0;
6668 for(i=0; i<count; i++) {
6669 if(!buf[i])
6670 num_put_wchar__Rep(this, &dest, dest, sep, 1);
6671 else
6672 num_put_wchar__Putc(this, &dest, dest, buf+i, 1);
6675 return num_put_wchar__Rep(this, ret, dest, fill, pad);
6678 /* ?_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 */
6679 /* ?_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 */
6680 static ostreambuf_iterator_wchar* num_put_wchar__Iput(const num_put *this, ostreambuf_iterator_wchar *ret,
6681 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, char *buf, MSVCP_size_t count)
6683 return num_put__Iput(this, ret, dest, base, fill, buf, count, numpunct_wchar_use_facet(&base->loc));
6686 /* ?_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 */
6687 /* ?_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 */
6688 static ostreambuf_iterator_wchar* num_put_short__Iput(const num_put *this, ostreambuf_iterator_wchar *ret,
6689 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, char *buf, MSVCP_size_t count)
6691 return num_put__Iput(this, ret, dest, base, fill, buf, count, numpunct_short_use_facet(&base->loc));
6694 /* ?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 */
6695 /* ?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 */
6696 #define call_num_put_wchar_do_put_long(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 28, ostreambuf_iterator_wchar*, \
6697 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, LONG), \
6698 (this, ret, dest, base, fill, v))
6699 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_long, 28)
6700 ostreambuf_iterator_wchar* __thiscall num_put_wchar_do_put_long(const num_put *this, ostreambuf_iterator_wchar *ret,
6701 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, LONG v)
6703 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
6704 char fmt[7]; /* strlen("%+#lld")+1 */
6706 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
6708 return num_put_wchar__Iput(this, ret, dest, base, fill, tmp,
6709 sprintf(tmp, num_put_wchar__Ifmt(this, fmt, "ld", base->fmtfl), v));
6712 /* ?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 */
6713 /* ?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 */
6714 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_long, 28)
6715 ostreambuf_iterator_wchar* __thiscall num_put_short_do_put_long(const num_put *this, ostreambuf_iterator_wchar *ret,
6716 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, LONG v)
6718 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
6719 char fmt[7]; /* strlen("%+#lld")+1 */
6721 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
6723 return num_put_short__Iput(this, ret, dest, base, fill, tmp,
6724 sprintf(tmp, num_put_wchar__Ifmt(this, fmt, "ld", base->fmtfl), v));
6727 /* ?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 */
6728 /* ?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 */
6729 /* ?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 */
6730 /* ?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 */
6731 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_long, 28)
6732 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_long(const num_put *this, ostreambuf_iterator_wchar *ret,
6733 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, LONG v)
6735 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
6736 return call_num_put_wchar_do_put_long(this, ret, dest, base, fill, v);
6739 /* ?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 */
6740 /* ?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 */
6741 #define call_num_put_wchar_do_put_ulong(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 24, ostreambuf_iterator_wchar*, \
6742 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, ULONG), \
6743 (this, ret, dest, base, fill, v))
6744 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_ulong, 28)
6745 ostreambuf_iterator_wchar* __thiscall num_put_wchar_do_put_ulong(const num_put *this, ostreambuf_iterator_wchar *ret,
6746 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, ULONG v)
6748 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
6749 char fmt[7]; /* strlen("%+#lld")+1 */
6751 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
6753 return num_put_wchar__Iput(this, ret, dest, base, fill, tmp,
6754 sprintf(tmp, num_put_wchar__Ifmt(this, fmt, "lu", base->fmtfl), v));
6757 /* ?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 */
6758 /* ?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 */
6759 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_ulong, 28)
6760 ostreambuf_iterator_wchar* __thiscall num_put_short_do_put_ulong(const num_put *this, ostreambuf_iterator_wchar *ret,
6761 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, ULONG v)
6763 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
6764 char fmt[7]; /* strlen("%+#lld")+1 */
6766 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
6768 return num_put_short__Iput(this, ret, dest, base, fill, tmp,
6769 sprintf(tmp, num_put_wchar__Ifmt(this, fmt, "lu", base->fmtfl), v));
6772 /* ?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 */
6773 /* ?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 */
6774 /* ?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 */
6775 /* ?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 */
6776 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_ulong, 28)
6777 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_ulong(const num_put *this, ostreambuf_iterator_wchar *ret,
6778 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, ULONG v)
6780 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
6781 return call_num_put_wchar_do_put_ulong(this, ret, dest, base, fill, v);
6784 /* ?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 */
6785 /* ?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 */
6786 /* ?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 */
6787 /* ?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 */
6788 #define call_num_put_wchar_do_put_double(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 12, ostreambuf_iterator_wchar*, \
6789 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, double), \
6790 (this, ret, dest, base, fill, v))
6791 #define call_num_put_wchar_do_put_ldouble(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 8, ostreambuf_iterator_wchar*, \
6792 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, double), \
6793 (this, ret, dest, base, fill, v))
6794 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_double, 32)
6795 ostreambuf_iterator_wchar* __thiscall num_put_wchar_do_put_double(const num_put *this, ostreambuf_iterator_wchar *ret,
6796 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, double v)
6798 char *tmp;
6799 char fmt[8]; /* strlen("%+#.*lg")+1 */
6800 int size;
6802 TRACE("(%p %p %p %d %lf)\n", this, ret, base, fill, v);
6804 num_put_wchar__Ffmt(this, fmt, '\0', base->fmtfl);
6805 size = _scprintf(fmt, base->prec, v);
6807 /* TODO: don't use dynamic allocation */
6808 tmp = MSVCRT_operator_new(size*2);
6809 if(!tmp) {
6810 ERR("Out of memory\n");
6811 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
6813 num_put__fput(this, ret, dest, base, fill, tmp, sprintf(tmp, fmt, base->prec, v),
6814 numpunct_wchar_use_facet(&base->loc));
6815 MSVCRT_operator_delete(tmp);
6816 return ret;
6819 /* ?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 */
6820 /* ?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 */
6821 /* ?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 */
6822 /* ?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 */
6823 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_double, 32)
6824 ostreambuf_iterator_wchar* __thiscall num_put_short_do_put_double(const num_put *this, ostreambuf_iterator_wchar *ret,
6825 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, double v)
6827 char *tmp;
6828 char fmt[8]; /* strlen("%+#.*lg")+1 */
6829 int size;
6830 streamsize prec;
6832 TRACE("(%p %p %p %d %lf)\n", this, ret, base, fill, v);
6834 num_put_wchar__Ffmt(this, fmt, '\0', base->fmtfl);
6835 prec = get_precision(base);
6836 size = _scprintf(fmt, prec, v);
6838 /* TODO: don't use dynamic allocation */
6839 tmp = MSVCRT_operator_new(size*2);
6840 if(!tmp) {
6841 ERR("Out of memory\n");
6842 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
6844 num_put__fput(this, ret, dest, base, fill, tmp, sprintf(tmp, fmt, prec, v),
6845 numpunct_short_use_facet(&base->loc));
6846 MSVCRT_operator_delete(tmp);
6847 return ret;
6850 /* ?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 */
6851 /* ?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 */
6852 /* ?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 */
6853 /* ?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 */
6854 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_double, 32)
6855 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_double(const num_put *this, ostreambuf_iterator_wchar *ret,
6856 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, double v)
6858 TRACE("(%p %p %p %d %lf)\n", this, ret, base, fill, v);
6859 return call_num_put_wchar_do_put_double(this, ret, dest, base, fill, v);
6862 /* ?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 */
6863 /* ?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 */
6864 /* ?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 */
6865 /* ?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 */
6866 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_ldouble, 32)
6867 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_ldouble(const num_put *this, ostreambuf_iterator_wchar *ret,
6868 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, double v)
6870 TRACE("(%p %p %p %d %lf)\n", this, ret, base, fill, v);
6871 return call_num_put_wchar_do_put_ldouble(this, ret, dest, base, fill, v);
6874 /* ?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 */
6875 /* ?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 */
6876 #define call_num_put_wchar_do_put_ptr(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 4, ostreambuf_iterator_wchar*, \
6877 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, const void*), \
6878 (this, ret, dest, base, fill, v))
6879 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_ptr, 28)
6880 ostreambuf_iterator_wchar* __thiscall num_put_wchar_do_put_ptr(const num_put *this, ostreambuf_iterator_wchar *ret,
6881 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, const void *v)
6883 char tmp[17]; /* 8(16^8==2^64)*2(separators beetwen every digit) + 1 */
6885 TRACE("(%p %p %p %d %p)\n", this, ret, base, fill, v);
6887 return num_put_wchar__Iput(this, ret, dest, base, fill, tmp, sprintf(tmp, "%p", v));
6890 /* ?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 */
6891 /* ?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 */
6892 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_ptr, 28)
6893 ostreambuf_iterator_wchar* __thiscall num_put_short_do_put_ptr(const num_put *this, ostreambuf_iterator_wchar *ret,
6894 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, const void *v)
6896 char tmp[17]; /* 8(16^8==2^64)*2(separators beetwen every digit) + 1 */
6898 TRACE("(%p %p %p %d %p)\n", this, ret, base, fill, v);
6900 return num_put_short__Iput(this, ret, dest, base, fill, tmp, sprintf(tmp, "%p", v));
6903 /* ?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 */
6904 /* ?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 */
6905 /* ?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 */
6906 /* ?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 */
6907 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_ptr, 28)
6908 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_ptr(const num_put *this, ostreambuf_iterator_wchar *ret,
6909 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, const void *v)
6911 TRACE("(%p %p %p %d %p)\n", this, ret, base, fill, v);
6912 return call_num_put_wchar_do_put_ptr(this, ret, dest, base, fill, v);
6915 /* ?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 */
6916 /* ?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 */
6917 #define call_num_put_wchar_do_put_int64(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 20, ostreambuf_iterator_wchar*, \
6918 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, __int64), \
6919 (this, ret, dest, base, fill, v))
6920 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_int64, 32)
6921 ostreambuf_iterator_wchar* __thiscall num_put_wchar_do_put_int64(const num_put *this, ostreambuf_iterator_wchar *ret,
6922 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, __int64 v)
6924 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
6925 char fmt[7]; /* strlen("%+#lld")+1 */
6927 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
6929 return num_put_wchar__Iput(this, ret, dest, base, fill, tmp,
6930 sprintf(tmp, num_put_wchar__Ifmt(this, fmt, "lld", base->fmtfl), v));
6933 /* ?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 */
6934 /* ?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 */
6935 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_int64, 32)
6936 ostreambuf_iterator_wchar* __thiscall num_put_short_do_put_int64(const num_put *this, ostreambuf_iterator_wchar *ret,
6937 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, __int64 v)
6939 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
6940 char fmt[7]; /* strlen("%+#lld")+1 */
6942 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
6944 return num_put_short__Iput(this, ret, dest, base, fill, tmp,
6945 sprintf(tmp, num_put_wchar__Ifmt(this, fmt, "lld", base->fmtfl), v));
6948 /* ?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 */
6949 /* ?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 */
6950 /* ?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 */
6951 /* ?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 */
6952 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_int64, 32)
6953 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_int64(const num_put *this, ostreambuf_iterator_wchar *ret,
6954 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, __int64 v)
6956 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
6957 return call_num_put_wchar_do_put_int64(this, ret, dest, base, fill, v);
6960 /* ?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 */
6961 /* ?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 */
6962 #define call_num_put_wchar_do_put_uint64(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 16, ostreambuf_iterator_wchar*, \
6963 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, unsigned __int64), \
6964 (this, ret, dest, base, fill, v))
6965 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_uint64, 32)
6966 ostreambuf_iterator_wchar* __thiscall num_put_wchar_do_put_uint64(const num_put *this, ostreambuf_iterator_wchar *ret,
6967 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, unsigned __int64 v)
6969 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
6970 char fmt[7]; /* strlen("%+#lld")+1 */
6972 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
6974 return num_put_wchar__Iput(this, ret, dest, base, fill, tmp,
6975 sprintf(tmp, num_put_wchar__Ifmt(this, fmt, "llu", base->fmtfl), v));
6978 /* ?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 */
6979 /* ?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 */
6980 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_uint64, 32)
6981 ostreambuf_iterator_wchar* __thiscall num_put_short_do_put_uint64(const num_put *this, ostreambuf_iterator_wchar *ret,
6982 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, unsigned __int64 v)
6984 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
6985 char fmt[7]; /* strlen("%+#lld")+1 */
6987 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
6989 return num_put_short__Iput(this, ret, dest, base, fill, tmp,
6990 sprintf(tmp, num_put_wchar__Ifmt(this, fmt, "llu", base->fmtfl), v));
6993 /* ?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 */
6994 /* ?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 */
6995 /* ?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 */
6996 /* ?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 */
6997 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_uint64, 32)
6998 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_uint64(const num_put *this, ostreambuf_iterator_wchar *ret,
6999 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, unsigned __int64 v)
7001 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
7002 return call_num_put_wchar_do_put_uint64(this, ret, dest, base, fill, v);
7005 /* ?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 */
7006 /* ?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 */
7007 #define call_num_put_wchar_do_put_bool(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 32, ostreambuf_iterator_wchar*, \
7008 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, MSVCP_bool), \
7009 (this, ret, dest, base, fill, v))
7010 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_bool, 28)
7011 ostreambuf_iterator_wchar* __thiscall num_put_wchar_do_put_bool(const num_put *this, ostreambuf_iterator_wchar *ret,
7012 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, MSVCP_bool v)
7014 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
7016 if(base->fmtfl & FMTFLAG_boolalpha) {
7017 numpunct_wchar *numpunct = numpunct_wchar_use_facet(&base->loc);
7018 basic_string_wchar str;
7019 MSVCP_size_t pad, len;
7021 if(v)
7022 numpunct_wchar_truename(numpunct, &str);
7023 else
7024 numpunct_wchar_falsename(numpunct, &str);
7026 len = basic_string_wchar_length(&str);
7027 pad = (len>base->wide ? 0 : base->wide-len);
7028 base->wide = 0;
7030 if((base->fmtfl & FMTFLAG_adjustfield) != FMTFLAG_left) {
7031 num_put_wchar__Rep(this, &dest, dest, fill, pad);
7032 pad = 0;
7034 num_put_wchar__Put(this, &dest, dest, basic_string_wchar_c_str(&str), len);
7035 basic_string_wchar_dtor(&str);
7036 return num_put_wchar__Rep(this, ret, dest, fill, pad);
7039 return num_put_wchar_put_long(this, ret, dest, base, fill, v);
7042 /* ?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 */
7043 /* ?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 */
7044 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_bool, 28)
7045 ostreambuf_iterator_wchar* __thiscall num_put_short_do_put_bool(const num_put *this, ostreambuf_iterator_wchar *ret,
7046 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, MSVCP_bool v)
7048 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
7050 if(base->fmtfl & FMTFLAG_boolalpha) {
7051 numpunct_wchar *numpunct = numpunct_short_use_facet(&base->loc);
7052 basic_string_wchar str;
7053 MSVCP_size_t pad, len;
7055 if(v)
7056 numpunct_wchar_truename(numpunct, &str);
7057 else
7058 numpunct_wchar_falsename(numpunct, &str);
7060 len = basic_string_wchar_length(&str);
7061 pad = (len>base->wide ? 0 : base->wide-len);
7062 base->wide = 0;
7064 if((base->fmtfl & FMTFLAG_adjustfield) != FMTFLAG_left) {
7065 num_put_wchar__Rep(this, &dest, dest, fill, pad);
7066 pad = 0;
7068 num_put_wchar__Put(this, &dest, dest, basic_string_wchar_c_str(&str), len);
7069 basic_string_wchar_dtor(&str);
7070 return num_put_wchar__Rep(this, ret, dest, fill, pad);
7073 return num_put_wchar_put_long(this, ret, dest, base, fill, v);
7076 /* ?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 */
7077 /* ?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 */
7078 /* ?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 */
7079 /* ?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 */
7080 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_bool, 28)
7081 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_bool(const num_put *this, ostreambuf_iterator_wchar *ret,
7082 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, MSVCP_bool v)
7084 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
7085 return call_num_put_wchar_do_put_bool(this, ret, dest, base, fill, v);
7088 /* ?id@?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@2V0locale@2@A */
7089 locale_id time_put_char_id = {0};
7091 /* ??_7?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@6B@ */
7092 extern const vtable_ptr MSVCP_time_put_char_vtable;
7094 /* ?_Init@?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@IAEXABV_Locinfo@2@@Z */
7095 /* ?_Init@?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@IEAAXAEBV_Locinfo@2@@Z */
7096 DEFINE_THISCALL_WRAPPER(time_put_char__Init, 8)
7097 void __thiscall time_put_char__Init(time_put *this, const _Locinfo *locinfo)
7099 TRACE("(%p %p)\n", this, locinfo);
7100 _Locinfo__Gettnames(locinfo, &this->time);
7101 _Locinfo__Getcvt(locinfo, &this->cvt);
7104 /* ??0?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
7105 /* ??0?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
7106 DEFINE_THISCALL_WRAPPER(time_put_char_ctor_locinfo, 12)
7107 time_put* __thiscall time_put_char_ctor_locinfo(time_put *this, const _Locinfo *locinfo, MSVCP_size_t refs)
7109 TRACE("(%p %p %lu)\n", this, locinfo, refs);
7110 locale_facet_ctor_refs(&this->facet, refs);
7111 this->facet.vtable = &MSVCP_time_put_char_vtable;
7112 time_put_char__Init(this, locinfo);
7113 return this;
7116 /* ??0?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAE@I@Z */
7117 /* ??0?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAA@_K@Z */
7118 DEFINE_THISCALL_WRAPPER(time_put_char_ctor_refs, 8)
7119 time_put* __thiscall time_put_char_ctor_refs(time_put *this, MSVCP_size_t refs)
7121 _Locinfo locinfo;
7123 TRACE("(%p %lu)\n", this, refs);
7125 _Locinfo_ctor(&locinfo);
7126 time_put_char_ctor_locinfo(this, &locinfo, refs);
7127 _Locinfo_dtor(&locinfo);
7128 return this;
7131 /* ??_F?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAEXXZ */
7132 /* ??_F?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAAXXZ */
7133 DEFINE_THISCALL_WRAPPER(time_put_char_ctor, 4)
7134 time_put* __thiscall time_put_char_ctor(time_put *this)
7136 return time_put_char_ctor_refs(this, 0);
7139 /* ??1?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MAE@XZ */
7140 /* ??1?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MEAA@XZ */
7141 DEFINE_THISCALL_WRAPPER(time_put_char_dtor, 4)
7142 void __thiscall time_put_char_dtor(time_put *this)
7144 TRACE("(%p)\n", this);
7145 _Timevec_dtor(&this->time);
7148 DEFINE_THISCALL_WRAPPER(time_put_char_vector_dtor, 8)
7149 time_put* __thiscall time_put_char_vector_dtor(time_put *this, unsigned int flags)
7151 TRACE("(%p %x)\n", this, flags);
7152 if(flags & 2) {
7153 /* we have an array, with the number of elements stored before the first object */
7154 INT_PTR i, *ptr = (INT_PTR *)this-1;
7156 for(i=*ptr-1; i>=0; i--)
7157 time_put_char_dtor(this+i);
7158 MSVCRT_operator_delete(ptr);
7159 } else {
7160 time_put_char_dtor(this);
7161 if(flags & 1)
7162 MSVCRT_operator_delete(this);
7165 return this;
7168 /* ?_Getcat@?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
7169 /* ?_Getcat@?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
7170 static MSVCP_size_t time_put_char__Getcat(const locale_facet **facet, const locale *loc)
7172 TRACE("(%p %p)\n", facet, loc);
7174 if(facet && !*facet) {
7175 _Locinfo locinfo;
7177 *facet = MSVCRT_operator_new(sizeof(time_put));
7178 if(!*facet) {
7179 ERR("Out of memory\n");
7180 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7181 return 0;
7184 _Locinfo_ctor_cstr(&locinfo, basic_string_char_c_str(&loc->ptr->name));
7185 time_put_char_ctor_locinfo((time_put*)*facet, &locinfo, 0);
7186 _Locinfo_dtor(&locinfo);
7189 return LC_TIME;
7192 static time_put* time_put_char_use_facet(const locale *loc)
7194 static time_put *obj = NULL;
7196 _Lockit lock;
7197 const locale_facet *fac;
7199 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
7200 fac = locale__Getfacet(loc, locale_id_operator_size_t(&time_put_char_id), TRUE);
7201 if(fac) {
7202 _Lockit_dtor(&lock);
7203 return (time_put*)fac;
7206 if(obj) {
7207 _Lockit_dtor(&lock);
7208 return obj;
7211 time_put_char__Getcat(&fac, loc);
7212 obj = (time_put*)fac;
7213 locale_facet__Incref(&obj->facet);
7214 locale_facet_register(&obj->facet);
7215 _Lockit_dtor(&lock);
7217 return obj;
7220 /* ?do_put@?$time_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@DPBUtm@@DD@Z */
7221 /* ?do_put@?$time_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@DPEBUtm@@DD@Z */
7222 DEFINE_THISCALL_WRAPPER(time_put_char_do_put, 32)
7223 #define call_time_put_char_do_put(this, ret, dest, base, t, spec, mod) CALL_VTBL_FUNC(this, 4, ostreambuf_iterator_char*, \
7224 (const time_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, const struct tm*, char, char), \
7225 (this, ret, dest, base, t, spec, mod))
7226 ostreambuf_iterator_char* __thiscall time_put_char_do_put(const time_put *this, ostreambuf_iterator_char *ret,
7227 ostreambuf_iterator_char dest, ios_base *base, const struct tm *t, char spec, char mod)
7229 char buf[64], fmt[4], *p = fmt;
7230 MSVCP_size_t i, len;
7232 TRACE("(%p %p %p %p %c %c)\n", this, ret, base, t, spec, mod);
7234 *p++ = '%';
7235 if(mod)
7236 *p++ = mod;
7237 *p++ = spec;
7238 *p++ = 0;
7240 len = _Strftime(buf, sizeof(buf), fmt, t, this->time.timeptr);
7241 for(i=0; i<len; i++)
7242 ostreambuf_iterator_char_put(&dest, buf[i]);
7244 *ret = dest;
7245 return ret;
7248 /* ?put@?$time_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@DPBUtm@@DD@Z */
7249 /* ?put@?$time_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@DPEBUtm@@DD@Z */
7250 DEFINE_THISCALL_WRAPPER(time_put_char_put, 32)
7251 ostreambuf_iterator_char* __thiscall time_put_char_put(const time_put *this, ostreambuf_iterator_char *ret,
7252 ostreambuf_iterator_char dest, ios_base *base, const struct tm *t, char spec, char mod)
7254 TRACE("(%p %p %p %p %c %c)\n", this, ret, base, t, spec, mod);
7255 return call_time_put_char_do_put(this, ret, dest, base, t, spec, mod);
7258 /* ?put@?$time_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@DPBUtm@@PBD3@Z */
7259 /* ?put@?$time_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@DPEBUtm@@PEBD3@Z */
7260 DEFINE_THISCALL_WRAPPER(time_put_char_put_format, 32)
7261 ostreambuf_iterator_char* __thiscall time_put_char_put_format(const time_put *this, ostreambuf_iterator_char *ret,
7262 ostreambuf_iterator_char dest, ios_base *base, const struct tm *t, const char *pat, const char *pat_end)
7264 TRACE("(%p %p %p %p %s)\n", this, ret, base, t, debugstr_an(pat, pat_end-pat));
7266 while(pat < pat_end) {
7267 if(*pat != '%') {
7268 ostreambuf_iterator_char_put(&dest, *pat++);
7269 }else if(++pat == pat_end) {
7270 ostreambuf_iterator_char_put(&dest, '%');
7271 }else if(*pat=='#' && pat+1==pat_end) {
7272 ostreambuf_iterator_char_put(&dest, '%');
7273 ostreambuf_iterator_char_put(&dest, *pat++);
7274 }else {
7275 char mod;
7277 if(*pat == '#') {
7278 mod = '#';
7279 pat++;
7280 }else {
7281 mod = 0;
7284 time_put_char_put(this, &dest, dest, base, t, *pat++, mod);
7288 *ret = dest;
7289 return ret;
7292 /* ?id@?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@2V0locale@2@A */
7293 static locale_id time_put_wchar_id = {0};
7294 /* ?id@?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@2V0locale@2@A */
7295 locale_id time_put_short_id = {0};
7297 /* ??_7?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@6B@ */
7298 extern const vtable_ptr MSVCP_time_put_wchar_vtable;
7299 /* ??_7?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@6B@ */
7300 extern const vtable_ptr MSVCP_time_put_short_vtable;
7302 /* ?_Init@?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@IAEXABV_Locinfo@2@@Z */
7303 /* ?_Init@?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@IEAAXAEBV_Locinfo@2@@Z */
7304 /* ?_Init@?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@IAEXABV_Locinfo@2@@Z */
7305 /* ?_Init@?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@IEAAXAEBV_Locinfo@2@@Z */
7306 DEFINE_THISCALL_WRAPPER(time_put_wchar__Init, 8)
7307 void __thiscall time_put_wchar__Init(time_put *this, const _Locinfo *locinfo)
7309 TRACE("(%p %p)\n", this, locinfo);
7310 _Locinfo__Gettnames(locinfo, &this->time);
7311 _Locinfo__Getcvt(locinfo, &this->cvt);
7314 /* ??0?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
7315 /* ??0?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
7316 static time_put* time_put_wchar_ctor_locinfo(time_put *this, const _Locinfo *locinfo, MSVCP_size_t refs)
7318 TRACE("(%p %p %lu)\n", this, locinfo, refs);
7319 locale_facet_ctor_refs(&this->facet, refs);
7320 this->facet.vtable = &MSVCP_time_put_wchar_vtable;
7321 time_put_wchar__Init(this, locinfo);
7322 return this;
7325 /* ??0?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
7326 /* ??0?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
7327 DEFINE_THISCALL_WRAPPER(time_put_short_ctor_locinfo, 12)
7328 time_put* __thiscall time_put_short_ctor_locinfo(time_put *this, const _Locinfo *locinfo, MSVCP_size_t refs)
7330 time_put_wchar_ctor_locinfo(this, locinfo, refs);
7331 this->facet.vtable = &MSVCP_time_put_short_vtable;
7332 return this;
7335 /* ??0?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@IAE@PBDI@Z */
7336 /* ??0?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@IEAA@PEBD_K@Z */
7337 static time_put* time_put_wchar_ctor_name(time_put *this, const char *name, MSVCP_size_t refs)
7339 _Locinfo locinfo;
7341 TRACE("(%p %s %lu)\n", this, debugstr_a(name), refs);
7343 _Locinfo_ctor_cstr(&locinfo, name);
7344 time_put_wchar_ctor_locinfo(this, &locinfo, refs);
7345 _Locinfo_dtor(&locinfo);
7346 return this;
7349 /* ??0?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@IAE@PBDI@Z */
7350 /* ??0?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@IEAA@PEBD_K@Z */
7351 static time_put* time_put_short_ctor_name(time_put *this, const char *name, MSVCP_size_t refs)
7353 time_put_wchar_ctor_name(this, name, refs);
7354 this->facet.vtable = &MSVCP_time_put_short_vtable;
7355 return this;
7358 /* ??0?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAE@I@Z */
7359 /* ??0?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAA@_K@Z */
7360 static time_put* time_put_wchar_ctor_refs(time_put *this, MSVCP_size_t refs)
7362 _Locinfo locinfo;
7364 TRACE("(%p %lu)\n", this, refs);
7366 _Locinfo_ctor(&locinfo);
7367 time_put_wchar_ctor_locinfo(this, &locinfo, refs);
7368 _Locinfo_dtor(&locinfo);
7369 return this;
7372 /* ??0?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAE@I@Z */
7373 /* ??0?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEAA@_K@Z */
7374 DEFINE_THISCALL_WRAPPER(time_put_short_ctor_refs, 8)
7375 time_put* __thiscall time_put_short_ctor_refs(time_put *this, MSVCP_size_t refs)
7377 time_put_wchar_ctor_refs(this, refs);
7378 this->facet.vtable = &MSVCP_time_put_short_vtable;
7379 return this;
7382 /* ??_F?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAEXXZ */
7383 /* ??_F?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAAXXZ */
7384 static time_put* time_put_wchar_ctor(time_put *this)
7386 return time_put_wchar_ctor_refs(this, 0);
7389 /* ??_F?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAEXXZ */
7390 /* ??_F?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEAAXXZ */
7391 DEFINE_THISCALL_WRAPPER(time_put_short_ctor, 4)
7392 time_put* __thiscall time_put_short_ctor(time_put *this)
7394 time_put_wchar_ctor(this);
7395 this->facet.vtable = &MSVCP_time_put_short_vtable;
7396 return this;
7399 /* ??1?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MAE@XZ */
7400 /* ??1?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MEAA@XZ */
7401 /* ??1?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MAE@XZ */
7402 /* ??1?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MEAA@XZ */
7403 DEFINE_THISCALL_WRAPPER(time_put_wchar_dtor, 4)
7404 void __thiscall time_put_wchar_dtor(time_put *this)
7406 TRACE("(%p)\n", this);
7407 _Timevec_dtor(&this->time);
7410 DEFINE_THISCALL_WRAPPER(time_put_wchar_vector_dtor, 8)
7411 time_put* __thiscall time_put_wchar_vector_dtor(time_put *this, unsigned int flags)
7413 TRACE("(%p %x)\n", this, flags);
7414 if(flags & 2) {
7415 /* we have an array, with the number of elements stored before the first object */
7416 INT_PTR i, *ptr = (INT_PTR *)this-1;
7418 for(i=*ptr-1; i>=0; i--)
7419 time_put_wchar_dtor(this+i);
7420 MSVCRT_operator_delete(ptr);
7421 } else {
7422 time_put_wchar_dtor(this);
7423 if(flags & 1)
7424 MSVCRT_operator_delete(this);
7427 return this;
7430 /* ?_Getcat@?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
7431 /* ?_Getcat@?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
7432 static MSVCP_size_t time_put_wchar__Getcat(const locale_facet **facet, const locale *loc)
7434 TRACE("(%p %p)\n", facet, loc);
7436 if(facet && !*facet) {
7437 *facet = MSVCRT_operator_new(sizeof(time_put));
7438 if(!*facet) {
7439 ERR("Out of memory\n");
7440 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7441 return 0;
7443 time_put_wchar_ctor_name((time_put*)*facet,
7444 basic_string_char_c_str(&loc->ptr->name), 0);
7447 return LC_TIME;
7450 static time_put* time_put_wchar_use_facet(const locale *loc)
7452 static time_put *obj = NULL;
7454 _Lockit lock;
7455 const locale_facet *fac;
7457 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
7458 fac = locale__Getfacet(loc, locale_id_operator_size_t(&time_put_wchar_id), TRUE);
7459 if(fac) {
7460 _Lockit_dtor(&lock);
7461 return (time_put*)fac;
7464 if(obj) {
7465 _Lockit_dtor(&lock);
7466 return obj;
7469 time_put_wchar__Getcat(&fac, loc);
7470 obj = (time_put*)fac;
7471 locale_facet__Incref(&obj->facet);
7472 locale_facet_register(&obj->facet);
7473 _Lockit_dtor(&lock);
7475 return obj;
7478 /* ?_Getcat@?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
7479 /* ?_Getcat@?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
7480 static MSVCP_size_t time_put_short__Getcat(const locale_facet **facet, const locale *loc)
7482 TRACE("(%p %p)\n", facet, loc);
7484 if(facet && !*facet) {
7485 *facet = MSVCRT_operator_new(sizeof(time_put));
7486 if(!*facet) {
7487 ERR("Out of memory\n");
7488 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7489 return 0;
7491 time_put_short_ctor_name((time_put*)*facet,
7492 basic_string_char_c_str(&loc->ptr->name), 0);
7495 return LC_TIME;
7498 static time_put* time_put_short_use_facet(const locale *loc)
7500 static time_put *obj = NULL;
7502 _Lockit lock;
7503 const locale_facet *fac;
7505 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
7506 fac = locale__Getfacet(loc, locale_id_operator_size_t(&time_put_short_id), TRUE);
7507 if(fac) {
7508 _Lockit_dtor(&lock);
7509 return (time_put*)fac;
7512 if(obj) {
7513 _Lockit_dtor(&lock);
7514 return obj;
7517 time_put_short__Getcat(&fac, loc);
7518 obj = (time_put*)fac;
7519 locale_facet__Incref(&obj->facet);
7520 locale_facet_register(&obj->facet);
7521 _Lockit_dtor(&lock);
7523 return obj;
7526 /* ?do_put@?$time_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@GPBUtm@@DD@Z */
7527 /* ?do_put@?$time_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@GPEBUtm@@DD@Z */
7528 /* ?do_put@?$time_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@_WPBUtm@@DD@Z */
7529 /* ?do_put@?$time_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@_WPEBUtm@@DD@Z */
7530 DEFINE_THISCALL_WRAPPER(time_put_wchar_do_put, 32)
7531 #define call_time_put_wchar_do_put(this, ret, dest, base, t, spec, mod) CALL_VTBL_FUNC(this, 4, ostreambuf_iterator_wchar*, \
7532 (const time_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, const struct tm*, char, char), \
7533 (this, ret, dest, base, t, spec, mod))
7534 ostreambuf_iterator_wchar* __thiscall time_put_wchar_do_put(const time_put *this,
7535 ostreambuf_iterator_wchar *ret, ostreambuf_iterator_wchar dest, ios_base *base,
7536 const struct tm *t, char spec, char mod)
7538 char buf[64], fmt[4], *p = fmt;
7539 MSVCP_size_t i, len;
7540 wchar_t c;
7542 TRACE("(%p %p %p %p %c %c)\n", this, ret, base, t, spec, mod);
7544 *p++ = '%';
7545 if(mod)
7546 *p++ = mod;
7547 *p++ = spec;
7548 *p++ = 0;
7550 len = _Strftime(buf, sizeof(buf), fmt, t, this->time.timeptr);
7551 for(i=0; i<len; i++) {
7552 c = mb_to_wc(buf[i], &this->cvt);
7553 ostreambuf_iterator_wchar_put(&dest, c);
7556 *ret = dest;
7557 return ret;
7560 /* ?put@?$time_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@GPBUtm@@DD@Z */
7561 /* ?put@?$time_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@GPEBUtm@@DD@Z */
7562 /* ?put@?$time_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@_WPBUtm@@DD@Z */
7563 /* ?put@?$time_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@_WPEBUtm@@DD@Z */
7564 DEFINE_THISCALL_WRAPPER(time_put_wchar_put, 32)
7565 ostreambuf_iterator_wchar* __thiscall time_put_wchar_put(const time_put *this,
7566 ostreambuf_iterator_wchar *ret, ostreambuf_iterator_wchar dest, ios_base *base,
7567 const struct tm *t, char spec, char mod)
7569 TRACE("(%p %p %p %p %c %c)\n", this, ret, base, t, spec, mod);
7570 return call_time_put_wchar_do_put(this, ret, dest, base, t, spec, mod);
7573 /* ?put@?$time_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@GPBUtm@@PBG3@Z */
7574 /* ?put@?$time_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@GPEBUtm@@PEBG3@Z */
7575 /* ?put@?$time_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@_WPBUtm@@PB_W4@Z */
7576 /* ?put@?$time_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@_WPEBUtm@@PEB_W4@Z */
7577 DEFINE_THISCALL_WRAPPER(time_put_wchar_put_format, 32)
7578 ostreambuf_iterator_wchar* __thiscall time_put_wchar_put_format(const time_put *this,
7579 ostreambuf_iterator_wchar *ret, ostreambuf_iterator_wchar dest, ios_base *base,
7580 const struct tm *t, const wchar_t *pat, const wchar_t *pat_end)
7582 wchar_t percent = mb_to_wc('%', &this->cvt);
7583 char c[MB_LEN_MAX];
7585 TRACE("(%p %p %p %p %s)\n", this, ret, base, t, debugstr_wn(pat, pat_end-pat));
7587 while(pat < pat_end) {
7588 if(*pat != percent) {
7589 ostreambuf_iterator_wchar_put(&dest, *pat++);
7590 }else if(++pat == pat_end) {
7591 ostreambuf_iterator_wchar_put(&dest, percent);
7592 }else if(_Wcrtomb(c, *pat, NULL, &this->cvt)!=1 || (*c=='#' && pat+1==pat_end)) {
7593 ostreambuf_iterator_wchar_put(&dest, percent);
7594 ostreambuf_iterator_wchar_put(&dest, *pat++);
7595 }else {
7596 pat++;
7597 if(*c == '#') {
7598 if(_Wcrtomb(c, *pat++, NULL, &this->cvt) != 1) {
7599 ostreambuf_iterator_wchar_put(&dest, percent);
7600 ostreambuf_iterator_wchar_put(&dest, *(pat-2));
7601 ostreambuf_iterator_wchar_put(&dest, *(pat-1));
7602 }else {
7603 time_put_wchar_put(this, &dest, dest, base, t, *c, '#');
7605 }else {
7606 time_put_wchar_put(this, &dest, dest, base, t, *c, 0);
7611 *ret = dest;
7612 return ret;
7615 /* ??0_Locimp@locale@std@@AAE@_N@Z */
7616 /* ??0_Locimp@locale@std@@AEAA@_N@Z */
7617 static locale__Locimp* locale__Locimp_ctor_transparent(locale__Locimp *this, MSVCP_bool transparent)
7619 TRACE("(%p %d)\n", this, transparent);
7621 memset(this, 0, sizeof(locale__Locimp));
7622 locale_facet_ctor_refs(&this->facet, 1);
7623 this->transparent = transparent;
7624 basic_string_char_ctor_cstr(&this->name, "*");
7625 return this;
7628 /* ??_F_Locimp@locale@std@@QAEXXZ */
7629 /* ??_F_Locimp@locale@std@@QEAAXXZ */
7630 static locale__Locimp* locale__Locimp_ctor(locale__Locimp *this)
7632 return locale__Locimp_ctor_transparent(this, FALSE);
7635 /* ??0_Locimp@locale@std@@AAE@ABV012@@Z */
7636 /* ??0_Locimp@locale@std@@AEAA@AEBV012@@Z */
7637 static locale__Locimp* locale__Locimp_copy_ctor(locale__Locimp *this, const locale__Locimp *copy)
7639 _Lockit lock;
7640 MSVCP_size_t i;
7642 TRACE("(%p %p)\n", this, copy);
7644 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
7645 memcpy(this, copy, sizeof(locale__Locimp));
7646 locale_facet_ctor_refs(&this->facet, 1);
7647 if(copy->facetvec) {
7648 this->facetvec = MSVCRT_operator_new(copy->facet_cnt*sizeof(locale_facet*));
7649 if(!this->facetvec) {
7650 _Lockit_dtor(&lock);
7651 ERR("Out of memory\n");
7652 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7653 return NULL;
7655 for(i=0; i<this->facet_cnt; i++)
7657 this->facetvec[i] = copy->facetvec[i];
7658 if(this->facetvec[i])
7659 locale_facet__Incref(this->facetvec[i]);
7662 basic_string_char_copy_ctor(&this->name, &copy->name);
7663 _Lockit_dtor(&lock);
7664 return this;
7667 /* ??1_Locimp@locale@std@@MAE@XZ */
7668 /* ??1_Locimp@locale@std@@MEAA@XZ */
7669 static void locale__Locimp_dtor(locale__Locimp *this)
7671 MSVCP_size_t i;
7673 TRACE("(%p)\n", this);
7675 locale_facet_dtor(&this->facet);
7676 for(i=0; i<this->facet_cnt; i++)
7677 if(this->facetvec[i] && locale_facet__Decref(this->facetvec[i]))
7678 call_locale_facet_vector_dtor(this->facetvec[i], 1);
7680 MSVCRT_operator_delete(this->facetvec);
7681 basic_string_char_dtor(&this->name);
7684 DEFINE_THISCALL_WRAPPER(locale__Locimp_vector_dtor, 8)
7685 locale__Locimp* __thiscall locale__Locimp_vector_dtor(locale__Locimp *this, unsigned int flags)
7687 TRACE("(%p %x)\n", this, flags);
7688 if(flags & 2) {
7689 /* we have an array, with the number of elements stored before the first object */
7690 INT_PTR i, *ptr = (INT_PTR *)this-1;
7692 for(i=*ptr-1; i>=0; i--)
7693 locale__Locimp_dtor(this+i);
7694 MSVCRT_operator_delete(ptr);
7695 } else {
7696 locale__Locimp_dtor(this);
7697 if(flags & 1)
7698 MSVCRT_operator_delete(this);
7701 return this;
7704 /* ?_Locimp_Addfac@_Locimp@locale@std@@CAXPAV123@PAVfacet@23@I@Z */
7705 /* ?_Locimp_Addfac@_Locimp@locale@std@@CAXPEAV123@PEAVfacet@23@_K@Z */
7706 static void locale__Locimp__Locimp_Addfac(locale__Locimp *locimp, locale_facet *facet, MSVCP_size_t id)
7708 _Lockit lock;
7710 TRACE("(%p %p %lu)\n", locimp, facet, id);
7712 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
7713 if(id >= locimp->facet_cnt) {
7714 MSVCP_size_t new_size = id+1;
7715 locale_facet **new_facetvec;
7717 if(new_size < locale_id__Id_cnt+1)
7718 new_size = locale_id__Id_cnt+1;
7720 new_facetvec = MSVCRT_operator_new(sizeof(locale_facet*)*new_size);
7721 if(!new_facetvec) {
7722 _Lockit_dtor(&lock);
7723 ERR("Out of memory\n");
7724 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7725 return;
7728 memset(new_facetvec, 0, sizeof(locale_facet*)*new_size);
7729 memcpy(new_facetvec, locimp->facetvec, sizeof(locale_facet*)*locimp->facet_cnt);
7730 MSVCRT_operator_delete(locimp->facetvec);
7731 locimp->facetvec = new_facetvec;
7732 locimp->facet_cnt = new_size;
7735 if(locimp->facetvec[id] && locale_facet__Decref(locimp->facetvec[id]))
7736 call_locale_facet_vector_dtor(locimp->facetvec[id], 1);
7738 locimp->facetvec[id] = facet;
7739 if(facet)
7740 locale_facet__Incref(facet);
7741 _Lockit_dtor(&lock);
7744 /* ?_Addfac@_Locimp@locale@std@@AAEXPAVfacet@23@I@Z */
7745 /* ?_Addfac@_Locimp@locale@std@@AEAAXPEAVfacet@23@_K@Z */
7746 static void locale__Locimp__Addfac(locale__Locimp *this, locale_facet *facet, MSVCP_size_t id)
7748 locale__Locimp__Locimp_Addfac(this, facet, id);
7751 /* ?_Makeushloc@_Locimp@locale@std@@CAXABV_Locinfo@3@HPAV123@PBV23@@Z */
7752 /* ?_Makeushloc@_Locimp@locale@std@@CAXAEBV_Locinfo@3@HPEAV123@PEBV23@@Z */
7753 /* List of missing facets:
7754 * messages, money_get, money_put, moneypunct, moneypunct, time_get
7756 static void locale__Locimp__Makeushloc(const _Locinfo *locinfo, category cat, locale__Locimp *locimp, const locale *loc)
7758 FIXME("(%p %d %p %p) semi-stub\n", locinfo, cat, locimp, loc);
7760 if(cat & (1<<(ctype_short__Getcat(NULL, NULL)-1))) {
7761 ctype_wchar *ctype;
7763 if(loc) {
7764 ctype = ctype_short_use_facet(loc);
7765 }else {
7766 ctype = MSVCRT_operator_new(sizeof(ctype_wchar));
7767 if(!ctype) {
7768 ERR("Out of memory\n");
7769 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7771 ctype_short_ctor_locinfo(ctype, locinfo, 0);
7773 locale__Locimp__Addfac(locimp, &ctype->base.facet, locale_id_operator_size_t(&ctype_short_id));
7776 if(cat & (1<<(num_get_short__Getcat(NULL, NULL)-1))) {
7777 num_get *numget;
7779 if(loc) {
7780 numget = num_get_short_use_facet(loc);
7781 }else {
7782 numget = MSVCRT_operator_new(sizeof(num_get));
7783 if(!numget) {
7784 ERR("Out of memory\n");
7785 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7787 num_get_short_ctor_locinfo(numget, locinfo, 0);
7789 locale__Locimp__Addfac(locimp, &numget->facet, locale_id_operator_size_t(&num_get_short_id));
7792 if(cat & (1<<(num_put_short__Getcat(NULL, NULL)-1))) {
7793 num_put *numput;
7795 if(loc) {
7796 numput = num_put_short_use_facet(loc);
7797 }else {
7798 numput = MSVCRT_operator_new(sizeof(num_put));
7799 if(!numput) {
7800 ERR("Out of memory\n");
7801 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7803 num_put_short_ctor_locinfo(numput, locinfo, 0);
7805 locale__Locimp__Addfac(locimp, &numput->facet, locale_id_operator_size_t(&num_put_short_id));
7808 if(cat & (1<<(numpunct_short__Getcat(NULL, NULL)-1))) {
7809 numpunct_wchar *numpunct;
7811 if(loc) {
7812 numpunct = numpunct_short_use_facet(loc);
7813 }else {
7814 numpunct = MSVCRT_operator_new(sizeof(numpunct_wchar));
7815 if(!numpunct) {
7816 ERR("Out of memory\n");
7817 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7819 numpunct_short_ctor_locinfo(numpunct, locinfo, 0, FALSE);
7821 locale__Locimp__Addfac(locimp, &numpunct->facet, locale_id_operator_size_t(&numpunct_short_id));
7824 if(cat & (1<<(collate_short__Getcat(NULL, NULL)-1))) {
7825 collate *c;
7827 if(loc) {
7828 c = collate_short_use_facet(loc);
7829 }else {
7830 c = MSVCRT_operator_new(sizeof(collate));
7831 if(!c) {
7832 ERR("Out of memory\n");
7833 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7835 collate_short_ctor_locinfo(c, locinfo, 0);
7837 locale__Locimp__Addfac(locimp, &c->facet, locale_id_operator_size_t(&collate_short_id));
7840 if(cat & (1<<(time_put_short__Getcat(NULL, NULL)-1))) {
7841 time_put *t;
7843 if(loc) {
7844 t = time_put_short_use_facet(loc);
7845 }else {
7846 t = MSVCRT_operator_new(sizeof(time_put));
7847 if(!t) {
7848 ERR("Out of memory\n");
7849 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7851 time_put_short_ctor_locinfo(t, locinfo, 0);
7853 locale__Locimp__Addfac(locimp, &t->facet, locale_id_operator_size_t(&time_put_short_id));
7856 if(cat & (1<<(codecvt_short__Getcat(NULL, NULL)-1))) {
7857 codecvt_wchar *codecvt;
7859 if(loc) {
7860 codecvt = codecvt_short_use_facet(loc);
7861 }else {
7862 codecvt = MSVCRT_operator_new(sizeof(codecvt_wchar));
7863 if(!codecvt) {
7864 ERR("Out of memory\n");
7865 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7867 codecvt_short_ctor_locinfo(codecvt, locinfo, 0);
7869 locale__Locimp__Addfac(locimp, &codecvt->base.facet, locale_id_operator_size_t(&codecvt_short_id));
7873 /* ?_Makewloc@_Locimp@locale@std@@CAXABV_Locinfo@3@HPAV123@PBV23@@Z */
7874 /* ?_Makewloc@_Locimp@locale@std@@CAXAEBV_Locinfo@3@HPEAV123@PEBV23@@Z */
7875 /* List of missing facets:
7876 * messages, money_get, money_put, moneypunct, moneypunct, time_get
7878 static void locale__Locimp__Makewloc(const _Locinfo *locinfo, category cat, locale__Locimp *locimp, const locale *loc)
7880 FIXME("(%p %d %p %p) semi-stub\n", locinfo, cat, locimp, loc);
7882 if(cat & (1<<(ctype_wchar__Getcat(NULL, NULL)-1))) {
7883 ctype_wchar *ctype;
7885 if(loc) {
7886 ctype = ctype_wchar_use_facet(loc);
7887 }else {
7888 ctype = MSVCRT_operator_new(sizeof(ctype_wchar));
7889 if(!ctype) {
7890 ERR("Out of memory\n");
7891 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7893 ctype_wchar_ctor_locinfo(ctype, locinfo, 0);
7895 locale__Locimp__Addfac(locimp, &ctype->base.facet, locale_id_operator_size_t(&ctype_wchar_id));
7898 if(cat & (1<<(num_get_wchar__Getcat(NULL, NULL)-1))) {
7899 num_get *numget;
7901 if(loc) {
7902 numget = num_get_wchar_use_facet(loc);
7903 }else {
7904 numget = MSVCRT_operator_new(sizeof(num_get));
7905 if(!numget) {
7906 ERR("Out of memory\n");
7907 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7909 num_get_wchar_ctor_locinfo(numget, locinfo, 0);
7911 locale__Locimp__Addfac(locimp, &numget->facet, locale_id_operator_size_t(&num_get_wchar_id));
7914 if(cat & (1<<(num_put_wchar__Getcat(NULL, NULL)-1))) {
7915 num_put *numput;
7917 if(loc) {
7918 numput = num_put_wchar_use_facet(loc);
7919 }else {
7920 numput = MSVCRT_operator_new(sizeof(num_put));
7921 if(!numput) {
7922 ERR("Out of memory\n");
7923 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7925 num_put_wchar_ctor_locinfo(numput, locinfo, 0);
7927 locale__Locimp__Addfac(locimp, &numput->facet, locale_id_operator_size_t(&num_put_wchar_id));
7930 if(cat & (1<<(numpunct_wchar__Getcat(NULL, NULL)-1))) {
7931 numpunct_wchar *numpunct;
7933 if(loc) {
7934 numpunct = numpunct_wchar_use_facet(loc);
7935 }else {
7936 numpunct = MSVCRT_operator_new(sizeof(numpunct_wchar));
7937 if(!numpunct) {
7938 ERR("Out of memory\n");
7939 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7941 numpunct_wchar_ctor_locinfo(numpunct, locinfo, 0, FALSE);
7943 locale__Locimp__Addfac(locimp, &numpunct->facet, locale_id_operator_size_t(&numpunct_wchar_id));
7946 if(cat & (1<<(collate_wchar__Getcat(NULL, NULL)-1))) {
7947 collate *c;
7949 if(loc) {
7950 c = collate_wchar_use_facet(loc);
7951 }else {
7952 c = MSVCRT_operator_new(sizeof(collate));
7953 if(!c) {
7954 ERR("Out of memory\n");
7955 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7957 collate_wchar_ctor_locinfo(c, locinfo, 0);
7959 locale__Locimp__Addfac(locimp, &c->facet, locale_id_operator_size_t(&collate_wchar_id));
7962 if(cat & (1<<(time_put_wchar__Getcat(NULL, NULL)-1))) {
7963 time_put *t;
7965 if(loc) {
7966 t = time_put_wchar_use_facet(loc);
7967 }else {
7968 t = MSVCRT_operator_new(sizeof(time_put));
7969 if(!t) {
7970 ERR("Out of memory\n");
7971 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7973 time_put_wchar_ctor_locinfo(t, locinfo, 0);
7975 locale__Locimp__Addfac(locimp, &t->facet, locale_id_operator_size_t(&time_put_wchar_id));
7978 if(cat & (1<<(codecvt_wchar__Getcat(NULL, NULL)-1))) {
7979 codecvt_wchar *codecvt;
7981 if(loc) {
7982 codecvt = codecvt_wchar_use_facet(loc);
7983 }else {
7984 codecvt = MSVCRT_operator_new(sizeof(codecvt_wchar));
7985 if(!codecvt) {
7986 ERR("Out of memory\n");
7987 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7989 codecvt_wchar_ctor_locinfo(codecvt, locinfo, 0);
7991 locale__Locimp__Addfac(locimp, &codecvt->base.facet, locale_id_operator_size_t(&codecvt_wchar_id));
7995 /* ?_Makexloc@_Locimp@locale@std@@CAXABV_Locinfo@3@HPAV123@PBV23@@Z */
7996 /* ?_Makexloc@_Locimp@locale@std@@CAXAEBV_Locinfo@3@HPEAV123@PEBV23@@Z */
7997 /* List of missing facets:
7998 * messages, money_get, money_put, moneypunct, moneypunct, time_get
8000 static void locale__Locimp__Makexloc(const _Locinfo *locinfo, category cat, locale__Locimp *locimp, const locale *loc)
8002 FIXME("(%p %d %p %p) semi-stub\n", locinfo, cat, locimp, loc);
8004 if(cat & (1<<(ctype_char__Getcat(NULL, NULL)-1))) {
8005 ctype_char *ctype;
8007 if(loc) {
8008 ctype = ctype_char_use_facet(loc);
8009 }else {
8010 ctype = MSVCRT_operator_new(sizeof(ctype_char));
8011 if(!ctype) {
8012 ERR("Out of memory\n");
8013 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8015 ctype_char_ctor_locinfo(ctype, locinfo, 0);
8017 locale__Locimp__Addfac(locimp, &ctype->base.facet, locale_id_operator_size_t(&ctype_char_id));
8020 if(cat & (1<<(num_get_char__Getcat(NULL, NULL)-1))) {
8021 num_get *numget;
8023 if(loc) {
8024 numget = num_get_char_use_facet(loc);
8025 }else {
8026 numget = MSVCRT_operator_new(sizeof(num_get));
8027 if(!numget) {
8028 ERR("Out of memory\n");
8029 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8031 num_get_char_ctor_locinfo(numget, locinfo, 0);
8033 locale__Locimp__Addfac(locimp, &numget->facet, locale_id_operator_size_t(&num_get_char_id));
8036 if(cat & (1<<(num_put_char__Getcat(NULL, NULL)-1))) {
8037 num_put *numput;
8039 if(loc) {
8040 numput = num_put_char_use_facet(loc);
8041 }else {
8042 numput = MSVCRT_operator_new(sizeof(num_put));
8043 if(!numput) {
8044 ERR("Out of memory\n");
8045 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8047 num_put_char_ctor_locinfo(numput, locinfo, 0);
8049 locale__Locimp__Addfac(locimp, &numput->facet, locale_id_operator_size_t(&num_put_char_id));
8052 if(cat & (1<<(numpunct_char__Getcat(NULL, NULL)-1))) {
8053 numpunct_char *numpunct;
8055 if(loc) {
8056 numpunct = numpunct_char_use_facet(loc);
8057 }else {
8058 numpunct = MSVCRT_operator_new(sizeof(numpunct_char));
8059 if(!numpunct) {
8060 ERR("Out of memory\n");
8061 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8063 numpunct_char_ctor_locinfo(numpunct, locinfo, 0, FALSE);
8065 locale__Locimp__Addfac(locimp, &numpunct->facet, locale_id_operator_size_t(&numpunct_char_id));
8068 if(cat & (1<<(collate_char__Getcat(NULL, NULL)-1))) {
8069 collate *c;
8071 if(loc) {
8072 c = collate_char_use_facet(loc);
8073 }else {
8074 c = MSVCRT_operator_new(sizeof(collate));
8075 if(!c) {
8076 ERR("Out of memory\n");
8077 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8079 collate_char_ctor_locinfo(c, locinfo, 0);
8081 locale__Locimp__Addfac(locimp, &c->facet, locale_id_operator_size_t(&collate_char_id));
8084 if(cat & (1<<(time_put_char__Getcat(NULL, NULL)-1))) {
8085 time_put *t;
8087 if(loc) {
8088 t = time_put_char_use_facet(loc);
8089 }else {
8090 t = MSVCRT_operator_new(sizeof(time_put));
8091 if(!t) {
8092 ERR("Out of memory\n");
8093 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8095 time_put_char_ctor_locinfo(t, locinfo, 0);
8097 locale__Locimp__Addfac(locimp, &t->facet, locale_id_operator_size_t(&time_put_char_id));
8100 if(cat & (1<<(codecvt_char__Getcat(NULL, NULL)-1))) {
8101 codecvt_char *codecvt;
8103 if(loc) {
8104 codecvt = codecvt_char_use_facet(loc);
8105 }else {
8106 codecvt = MSVCRT_operator_new(sizeof(codecvt_char));
8107 if(!codecvt) {
8108 ERR("Out of memory\n");
8109 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8111 codecvt_char_ctor_locinfo(codecvt, locinfo, 0);
8113 locale__Locimp__Addfac(locimp, &codecvt->base.facet, locale_id_operator_size_t(&codecvt_char_id));
8117 /* ?_Makeloc@_Locimp@locale@std@@CAPAV123@ABV_Locinfo@3@HPAV123@PBV23@@Z */
8118 /* ?_Makeloc@_Locimp@locale@std@@CAPEAV123@AEBV_Locinfo@3@HPEAV123@PEBV23@@Z */
8119 static locale__Locimp* locale__Locimp__Makeloc(const _Locinfo *locinfo, category cat, locale__Locimp *locimp, const locale *loc)
8121 TRACE("(%p %d %p %p)\n", locinfo, cat, locimp, loc);
8123 locale__Locimp__Makexloc(locinfo, cat, locimp, loc);
8124 locale__Locimp__Makewloc(locinfo, cat, locimp, loc);
8125 locale__Locimp__Makeushloc(locinfo, cat, locimp, loc);
8127 locimp->catmask |= cat;
8128 basic_string_char_assign(&locimp->name, &locinfo->newlocname);
8129 return locimp;
8132 /* ??_7_Locimp@locale@std@@6B@ */
8133 const vtable_ptr MSVCP_locale__Locimp_vtable[] = {
8134 (vtable_ptr)THISCALL_NAME(locale__Locimp_vector_dtor)
8137 /* ??0locale@std@@AAE@PAV_Locimp@01@@Z */
8138 /* ??0locale@std@@AEAA@PEAV_Locimp@01@@Z */
8139 DEFINE_THISCALL_WRAPPER(locale_ctor_locimp, 8)
8140 locale* __thiscall locale_ctor_locimp(locale *this, locale__Locimp *locimp)
8142 TRACE("(%p %p)\n", this, locimp);
8143 /* Don't change locimp reference counter */
8144 this->ptr = locimp;
8145 return this;
8148 /* ?_Init@locale@std@@CAPAV_Locimp@12@XZ */
8149 /* ?_Init@locale@std@@CAPEAV_Locimp@12@XZ */
8150 locale__Locimp* __cdecl locale__Init(void)
8152 _Lockit lock;
8154 TRACE("\n");
8156 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
8157 if(global_locale) {
8158 _Lockit_dtor(&lock);
8159 return global_locale;
8162 global_locale = MSVCRT_operator_new(sizeof(locale__Locimp));
8163 if(!global_locale) {
8164 _Lockit_dtor(&lock);
8165 ERR("Out of memory\n");
8166 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8167 return NULL;
8170 locale__Locimp_ctor(global_locale);
8171 global_locale->catmask = (1<<(LC_MAX+1))-1;
8172 basic_string_char_dtor(&global_locale->name);
8173 basic_string_char_ctor_cstr(&global_locale->name, "C");
8175 locale__Locimp__Clocptr = global_locale;
8176 global_locale->facet.refs++;
8177 locale_ctor_locimp(&classic_locale, locale__Locimp__Clocptr);
8178 _Lockit_dtor(&lock);
8180 return global_locale;
8183 /* ?_Iscloc@locale@std@@QBE_NXZ */
8184 /* ?_Iscloc@locale@std@@QEBA_NXZ */
8185 DEFINE_THISCALL_WRAPPER(locale__Iscloc, 4)
8186 MSVCP_bool __thiscall locale__Iscloc(const locale *this)
8188 TRACE("(%p)\n", this);
8189 return this->ptr == locale__Locimp__Clocptr;
8192 /* ??0locale@std@@QAE@ABV01@0H@Z */
8193 /* ??0locale@std@@QEAA@AEBV01@0H@Z */
8194 DEFINE_THISCALL_WRAPPER(locale_ctor_locale_locale, 16)
8195 locale* __thiscall locale_ctor_locale_locale(locale *this, const locale *loc, const locale *other, category cat)
8197 _Locinfo locinfo;
8199 TRACE("(%p %p %p %d)\n", this, loc, other, cat);
8201 this->ptr = MSVCRT_operator_new(sizeof(locale__Locimp));
8202 if(!this->ptr) {
8203 ERR("Out of memory\n");
8204 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8206 locale__Locimp_copy_ctor(this->ptr, loc->ptr);
8208 _Locinfo_ctor_cat_cstr(&locinfo, loc->ptr->catmask, basic_string_char_c_str(&loc->ptr->name));
8209 _Locinfo__Addcats(&locinfo, cat & other->ptr->catmask, basic_string_char_c_str(&other->ptr->name));
8210 locale__Locimp__Makeloc(&locinfo, cat, this->ptr, other);
8211 _Locinfo_dtor(&locinfo);
8213 return this;
8216 /* ??0locale@std@@QAE@ABV01@@Z */
8217 /* ??0locale@std@@QEAA@AEBV01@@Z */
8218 DEFINE_THISCALL_WRAPPER(locale_copy_ctor, 8)
8219 locale* __thiscall locale_copy_ctor(locale *this, const locale *copy)
8221 TRACE("(%p %p)\n", this, copy);
8222 this->ptr = copy->ptr;
8223 locale_facet__Incref(&this->ptr->facet);
8224 return this;
8227 /* ??0locale@std@@QAE@ABV01@PBDH@Z */
8228 /* ??0locale@std@@QEAA@AEBV01@PEBDH@Z */
8229 DEFINE_THISCALL_WRAPPER(locale_ctor_locale_cstr, 16)
8230 locale* __thiscall locale_ctor_locale_cstr(locale *this, const locale *loc, const char *locname, category cat)
8232 _Locinfo locinfo;
8234 TRACE("(%p %p %s %d)\n", this, loc, locname, cat);
8236 _Locinfo_ctor_cat_cstr(&locinfo, cat, locname);
8237 if(!memcmp(basic_string_char_c_str(&locinfo.newlocname), "*", 2)) {
8238 _Locinfo_dtor(&locinfo);
8239 MSVCRT_operator_delete(this->ptr);
8240 throw_exception(EXCEPTION_RUNTIME_ERROR, "bad locale name");
8243 this->ptr = MSVCRT_operator_new(sizeof(locale__Locimp));
8244 if(!this->ptr) {
8245 ERR("Out of memory\n");
8246 _Locinfo_dtor(&locinfo);
8247 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8249 locale__Locimp_copy_ctor(this->ptr, loc->ptr);
8251 locale__Locimp__Makeloc(&locinfo, cat, this->ptr, NULL);
8252 _Locinfo_dtor(&locinfo);
8253 return this;
8256 /* ??0locale@std@@QAE@PBDH@Z */
8257 /* ??0locale@std@@QEAA@PEBDH@Z */
8258 DEFINE_THISCALL_WRAPPER(locale_ctor_cstr, 12)
8259 locale* __thiscall locale_ctor_cstr(locale *this, const char *locname, category cat)
8261 _Locinfo locinfo;
8263 TRACE("(%p %s %d)\n", this, locname, cat);
8265 this->ptr = MSVCRT_operator_new(sizeof(locale__Locimp));
8266 if(!this->ptr) {
8267 ERR("Out of memory\n");
8268 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8270 locale__Locimp_ctor(this->ptr);
8272 locale__Init();
8274 _Locinfo_ctor_cat_cstr(&locinfo, cat, locname);
8275 if(!memcmp(basic_string_char_c_str(&locinfo.newlocname), "*", 2)) {
8276 _Locinfo_dtor(&locinfo);
8277 MSVCRT_operator_delete(this->ptr);
8278 throw_exception(EXCEPTION_RUNTIME_ERROR, "bad locale name");
8281 locale__Locimp__Makeloc(&locinfo, cat, this->ptr, NULL);
8282 _Locinfo_dtor(&locinfo);
8284 return this;
8287 /* ??0locale@std@@QAE@W4_Uninitialized@1@@Z */
8288 /* ??0locale@std@@QEAA@W4_Uninitialized@1@@Z */
8289 DEFINE_THISCALL_WRAPPER(locale_ctor_uninitialized, 8)
8290 locale* __thiscall locale_ctor_uninitialized(locale *this, int uninitialized)
8292 TRACE("(%p)\n", this);
8293 this->ptr = NULL;
8294 return this;
8297 /* ??0locale@std@@QAE@XZ */
8298 /* ??0locale@std@@QEAA@XZ */
8299 DEFINE_THISCALL_WRAPPER(locale_ctor, 4)
8300 locale* __thiscall locale_ctor(locale *this)
8302 TRACE("(%p)\n", this);
8303 this->ptr = locale__Init();
8304 locale_facet__Incref(&this->ptr->facet);
8305 return this;
8308 /* ??1locale@std@@QAE@XZ */
8309 /* ??1locale@std@@QEAA@XZ */
8310 DEFINE_THISCALL_WRAPPER(locale_dtor, 4)
8311 void __thiscall locale_dtor(locale *this)
8313 TRACE("(%p)\n", this);
8314 if(this->ptr && locale_facet__Decref(&this->ptr->facet)) {
8315 locale__Locimp_dtor(this->ptr);
8316 MSVCRT_operator_delete(this->ptr);
8320 /* ??4locale@std@@QAEAAV01@ABV01@@Z */
8321 /* ??4locale@std@@QEAAAEAV01@AEBV01@@Z */
8322 DEFINE_THISCALL_WRAPPER(locale_operator_assign, 8)
8323 locale* __thiscall locale_operator_assign(locale *this, const locale *loc)
8325 FIXME("(%p %p) stub\n", this, loc);
8326 return NULL;
8329 /* ??8locale@std@@QBE_NABV01@@Z */
8330 /* ??8locale@std@@QEBA_NAEBV01@@Z */
8331 DEFINE_THISCALL_WRAPPER(locale_operator_equal, 8)
8332 MSVCP_bool __thiscall locale_operator_equal(const locale *this, const locale *loc)
8334 FIXME("(%p %p) stub\n", this, loc);
8335 return 0;
8338 /* ??9locale@std@@QBE_NABV01@@Z */
8339 /* ??9locale@std@@QEBA_NAEBV01@@Z */
8340 DEFINE_THISCALL_WRAPPER(locale_operator_not_equal, 8)
8341 MSVCP_bool __thiscall locale_operator_not_equal(const locale *this, locale const *loc)
8343 FIXME("(%p %p) stub\n", this, loc);
8344 return 0;
8347 /* ?_Addfac@locale@std@@QAEAAV12@PAVfacet@12@II@Z */
8348 /* ?_Addfac@locale@std@@QEAAAEAV12@PEAVfacet@12@_K1@Z */
8349 DEFINE_THISCALL_WRAPPER(locale__Addfac, 16)
8350 locale* __thiscall locale__Addfac(locale *this, locale_facet *facet, MSVCP_size_t id, MSVCP_size_t catmask)
8352 TRACE("(%p %p %lu %lu)\n", this, facet, id, catmask);
8354 if(this->ptr->facet.refs > 1) {
8355 locale__Locimp *new_ptr = MSVCRT_operator_new(sizeof(locale__Locimp));
8356 if(!new_ptr) {
8357 ERR("Out of memory\n");
8358 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8359 return NULL;
8361 locale__Locimp_copy_ctor(new_ptr, this->ptr);
8362 locale_facet__Decref(&this->ptr->facet);
8363 this->ptr = new_ptr;
8366 locale__Locimp__Addfac(this->ptr, facet, id);
8368 if(catmask) {
8369 basic_string_char_dtor(&this->ptr->name);
8370 basic_string_char_ctor_cstr(&this->ptr->name, "*");
8372 return this;
8375 /* ?_Getfacet@locale@std@@QBEPBVfacet@12@I_N@Z */
8376 /* ?_Getfacet@locale@std@@QEBAPEBVfacet@12@_K_N@Z */
8377 DEFINE_THISCALL_WRAPPER(locale__Getfacet, 12)
8378 const locale_facet* __thiscall locale__Getfacet(const locale *this,
8379 MSVCP_size_t id, MSVCP_bool allow_transparent)
8381 locale_facet *fac;
8383 TRACE("(%p %lu)\n", this, id);
8385 fac = id < this->ptr->facet_cnt ? this->ptr->facetvec[id] : NULL;
8386 if(fac || !this->ptr->transparent || !allow_transparent)
8387 return fac;
8389 return id < global_locale->facet_cnt ? global_locale->facetvec[id] : NULL;
8392 /* ?classic@locale@std@@SAABV12@XZ */
8393 /* ?classic@locale@std@@SAAEBV12@XZ */
8394 const locale* __cdecl locale_classic(void)
8396 TRACE("\n");
8397 locale__Init();
8398 return &classic_locale;
8401 /* ?empty@locale@std@@SA?AV12@XZ */
8402 locale* __cdecl locale_empty(locale *ret)
8404 TRACE("\n");
8406 locale__Init();
8408 ret->ptr = MSVCRT_operator_new(sizeof(locale__Locimp));
8409 if(!ret->ptr) {
8410 ERR("Out of memory\n");
8411 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8413 locale__Locimp_ctor_transparent(ret->ptr, TRUE);
8414 return ret;
8417 /* ?name@locale@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
8418 /* ?name@locale@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
8419 DEFINE_THISCALL_WRAPPER(locale_name, 8)
8420 basic_string_char* __thiscall locale_name(const locale *this, basic_string_char *ret)
8422 TRACE( "(%p)\n", this);
8423 basic_string_char_copy_ctor(ret, &this->ptr->name);
8424 return ret;
8427 /* ?global@locale@std@@SA?AV12@ABV12@@Z */
8428 /* ?global@locale@std@@SA?AV12@AEBV12@@Z */
8429 locale* __cdecl locale_global(locale *ret, const locale *loc)
8431 _Lockit lock;
8432 int i;
8434 TRACE("(%p %p)\n", loc, ret);
8436 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
8437 locale_ctor(ret);
8439 if(loc->ptr != global_locale) {
8440 locale_facet__Decref(&global_locale->facet);
8441 global_locale = loc->ptr;
8442 locale_facet__Incref(&global_locale->facet);
8444 for(i=LC_ALL+1; i<=LC_MAX; i++) {
8445 if((global_locale->catmask & (1<<(i-1))) == 0)
8446 continue;
8447 setlocale(i, basic_string_char_c_str(&global_locale->name));
8450 _Lockit_dtor(&lock);
8451 return ret;
8454 /* wctrans */
8455 wctrans_t __cdecl wctrans(const char *property)
8457 static const char str_tolower[] = "tolower";
8458 static const char str_toupper[] = "toupper";
8460 if(!strcmp(property, str_tolower))
8461 return 2;
8462 if(!strcmp(property, str_toupper))
8463 return 1;
8464 return 0;
8467 /* towctrans */
8468 wint_t __cdecl towctrans(wint_t c, wctrans_t category)
8470 if(category == 1)
8471 return towupper(c);
8472 return towlower(c);
8475 DEFINE_RTTI_DATA0(locale_facet, 0, ".?AVfacet@locale@std@@")
8476 DEFINE_RTTI_DATA1(collate_char, 0, &locale_facet_rtti_base_descriptor, ".?AV?$collate@D@std@@")
8477 DEFINE_RTTI_DATA1(collate_wchar, 0, &locale_facet_rtti_base_descriptor, ".?AV?$collate@_W@std@@")
8478 DEFINE_RTTI_DATA1(collate_short, 0, &locale_facet_rtti_base_descriptor, ".?AV?$collate@G@std@@")
8479 DEFINE_RTTI_DATA1(ctype_base, 0, &locale_facet_rtti_base_descriptor, ".?AUctype_base@std@@")
8480 DEFINE_RTTI_DATA2(ctype_char, 0, &ctype_base_rtti_base_descriptor, &locale_facet_rtti_base_descriptor, ".?AV?$ctype@D@std@@")
8481 DEFINE_RTTI_DATA2(ctype_wchar, 0, &ctype_base_rtti_base_descriptor, &locale_facet_rtti_base_descriptor, ".?AV?$ctype@_W@std@@")
8482 DEFINE_RTTI_DATA2(ctype_short, 0, &ctype_base_rtti_base_descriptor, &locale_facet_rtti_base_descriptor, ".?AV?$ctype@G@std@@")
8483 DEFINE_RTTI_DATA1(codecvt_base, 0, &locale_facet_rtti_base_descriptor, ".?AVcodecvt_base@std@@")
8484 DEFINE_RTTI_DATA2(codecvt_char, 0, &codecvt_base_rtti_base_descriptor, &locale_facet_rtti_base_descriptor, ".?AV?$codecvt@DDH@std@@")
8485 DEFINE_RTTI_DATA2(codecvt_wchar, 0, &codecvt_base_rtti_base_descriptor, &locale_facet_rtti_base_descriptor, ".?AV?$codecvt@_WDH@std@@")
8486 DEFINE_RTTI_DATA2(codecvt_short, 0, &codecvt_base_rtti_base_descriptor, &locale_facet_rtti_base_descriptor, ".?AV?$codecvt@GDH@std@@")
8487 DEFINE_RTTI_DATA1(numpunct_char, 0, &locale_facet_rtti_base_descriptor, ".?AV?$numpunct@D@std@@")
8488 DEFINE_RTTI_DATA1(numpunct_wchar, 0, &locale_facet_rtti_base_descriptor, ".?AV?$numpunct@_W@std@@")
8489 DEFINE_RTTI_DATA1(numpunct_short, 0, &locale_facet_rtti_base_descriptor, ".?AV?$numpunct@G@std@@")
8490 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@@")
8491 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@@")
8492 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@@")
8493 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@@")
8494 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@@")
8495 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@@")
8496 DEFINE_RTTI_DATA1(time_put_char, 0, &locale_facet_rtti_base_descriptor, ".?AV?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@")
8497 DEFINE_RTTI_DATA1(time_put_wchar, 0, &locale_facet_rtti_base_descriptor, ".?AV?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@")
8498 DEFINE_RTTI_DATA1(time_put_short, 0, &locale_facet_rtti_base_descriptor, ".?AV?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@")
8500 #ifndef __GNUC__
8501 void __asm_dummy_vtables(void) {
8502 #endif
8503 __ASM_VTABLE(locale_facet,
8504 VTABLE_ADD_FUNC(locale_facet_vector_dtor));
8505 __ASM_VTABLE(collate_char,
8506 VTABLE_ADD_FUNC(collate_char_vector_dtor)
8507 VTABLE_ADD_FUNC(collate_char_do_compare)
8508 VTABLE_ADD_FUNC(collate_char_do_transform)
8509 VTABLE_ADD_FUNC(collate_char_do_hash));
8510 __ASM_VTABLE(collate_wchar,
8511 VTABLE_ADD_FUNC(collate_wchar_vector_dtor)
8512 VTABLE_ADD_FUNC(collate_wchar_do_compare)
8513 VTABLE_ADD_FUNC(collate_wchar_do_transform)
8514 VTABLE_ADD_FUNC(collate_wchar_do_hash));
8515 __ASM_VTABLE(collate_short,
8516 VTABLE_ADD_FUNC(collate_wchar_vector_dtor)
8517 VTABLE_ADD_FUNC(collate_wchar_do_compare)
8518 VTABLE_ADD_FUNC(collate_wchar_do_transform)
8519 VTABLE_ADD_FUNC(collate_wchar_do_hash));
8520 __ASM_VTABLE(ctype_base,
8521 VTABLE_ADD_FUNC(ctype_base_vector_dtor));
8522 __ASM_VTABLE(ctype_char,
8523 VTABLE_ADD_FUNC(ctype_char_vector_dtor)
8524 VTABLE_ADD_FUNC(ctype_char_do_tolower)
8525 VTABLE_ADD_FUNC(ctype_char_do_tolower_ch)
8526 VTABLE_ADD_FUNC(ctype_char_do_toupper)
8527 VTABLE_ADD_FUNC(ctype_char_do_toupper_ch)
8528 VTABLE_ADD_FUNC(ctype_char_do_widen)
8529 VTABLE_ADD_FUNC(ctype_char_do_widen_ch)
8530 VTABLE_ADD_FUNC(ctype_char_do_narrow)
8531 VTABLE_ADD_FUNC(ctype_char_do_narrow_ch));
8532 __ASM_VTABLE(ctype_wchar,
8533 VTABLE_ADD_FUNC(ctype_wchar_vector_dtor)
8534 VTABLE_ADD_FUNC(ctype_wchar_do_is)
8535 VTABLE_ADD_FUNC(ctype_wchar_do_is_ch)
8536 VTABLE_ADD_FUNC(ctype_wchar_do_scan_is)
8537 VTABLE_ADD_FUNC(ctype_wchar_do_scan_not)
8538 VTABLE_ADD_FUNC(ctype_wchar_do_tolower)
8539 VTABLE_ADD_FUNC(ctype_wchar_do_tolower_ch)
8540 VTABLE_ADD_FUNC(ctype_wchar_do_toupper)
8541 VTABLE_ADD_FUNC(ctype_wchar_do_toupper_ch)
8542 VTABLE_ADD_FUNC(ctype_wchar_do_widen)
8543 VTABLE_ADD_FUNC(ctype_wchar_do_widen_ch)
8544 VTABLE_ADD_FUNC(ctype_wchar_do_narrow)
8545 VTABLE_ADD_FUNC(ctype_wchar_do_narrow_ch));
8546 __ASM_VTABLE(ctype_short,
8547 VTABLE_ADD_FUNC(ctype_wchar_vector_dtor)
8548 VTABLE_ADD_FUNC(ctype_wchar_do_is)
8549 VTABLE_ADD_FUNC(ctype_wchar_do_is_ch)
8550 VTABLE_ADD_FUNC(ctype_wchar_do_scan_is)
8551 VTABLE_ADD_FUNC(ctype_wchar_do_scan_not)
8552 VTABLE_ADD_FUNC(ctype_wchar_do_tolower)
8553 VTABLE_ADD_FUNC(ctype_wchar_do_tolower_ch)
8554 VTABLE_ADD_FUNC(ctype_wchar_do_toupper)
8555 VTABLE_ADD_FUNC(ctype_wchar_do_toupper_ch)
8556 VTABLE_ADD_FUNC(ctype_wchar_do_widen)
8557 VTABLE_ADD_FUNC(ctype_wchar_do_widen_ch)
8558 VTABLE_ADD_FUNC(ctype_wchar_do_narrow)
8559 VTABLE_ADD_FUNC(ctype_wchar_do_narrow_ch));
8560 __ASM_VTABLE(codecvt_base,
8561 VTABLE_ADD_FUNC(codecvt_base_vector_dtor)
8562 VTABLE_ADD_FUNC(codecvt_base_do_always_noconv)
8563 VTABLE_ADD_FUNC(codecvt_base_do_max_length)
8564 VTABLE_ADD_FUNC(codecvt_base_do_encoding));
8565 __ASM_VTABLE(codecvt_char,
8566 VTABLE_ADD_FUNC(codecvt_char_vector_dtor)
8567 VTABLE_ADD_FUNC(codecvt_base_do_always_noconv)
8568 VTABLE_ADD_FUNC(codecvt_base_do_max_length)
8569 VTABLE_ADD_FUNC(codecvt_base_do_encoding)
8570 VTABLE_ADD_FUNC(codecvt_char_do_in)
8571 VTABLE_ADD_FUNC(codecvt_char_do_out)
8572 VTABLE_ADD_FUNC(codecvt_char_do_unshift)
8573 VTABLE_ADD_FUNC(codecvt_char_do_length));
8574 __ASM_VTABLE(codecvt_wchar,
8575 VTABLE_ADD_FUNC(codecvt_wchar_vector_dtor)
8576 VTABLE_ADD_FUNC(codecvt_wchar_do_always_noconv)
8577 VTABLE_ADD_FUNC(codecvt_wchar_do_max_length)
8578 VTABLE_ADD_FUNC(codecvt_base_do_encoding)
8579 VTABLE_ADD_FUNC(codecvt_wchar_do_in)
8580 VTABLE_ADD_FUNC(codecvt_wchar_do_out)
8581 VTABLE_ADD_FUNC(codecvt_wchar_do_unshift)
8582 VTABLE_ADD_FUNC(codecvt_wchar_do_length));
8583 __ASM_VTABLE(codecvt_short,
8584 VTABLE_ADD_FUNC(codecvt_wchar_vector_dtor)
8585 VTABLE_ADD_FUNC(codecvt_wchar_do_always_noconv)
8586 VTABLE_ADD_FUNC(codecvt_wchar_do_max_length)
8587 VTABLE_ADD_FUNC(codecvt_base_do_encoding)
8588 VTABLE_ADD_FUNC(codecvt_wchar_do_in)
8589 VTABLE_ADD_FUNC(codecvt_wchar_do_out)
8590 VTABLE_ADD_FUNC(codecvt_wchar_do_unshift)
8591 VTABLE_ADD_FUNC(codecvt_wchar_do_length));
8592 __ASM_VTABLE(numpunct_char,
8593 VTABLE_ADD_FUNC(numpunct_char_vector_dtor)
8594 VTABLE_ADD_FUNC(numpunct_char_do_decimal_point)
8595 VTABLE_ADD_FUNC(numpunct_char_do_thousands_sep)
8596 VTABLE_ADD_FUNC(numpunct_char_do_grouping)
8597 VTABLE_ADD_FUNC(numpunct_char_do_falsename)
8598 VTABLE_ADD_FUNC(numpunct_char_do_truename));
8599 __ASM_VTABLE(numpunct_wchar,
8600 VTABLE_ADD_FUNC(numpunct_wchar_vector_dtor)
8601 VTABLE_ADD_FUNC(numpunct_wchar_do_decimal_point)
8602 VTABLE_ADD_FUNC(numpunct_wchar_do_thousands_sep)
8603 VTABLE_ADD_FUNC(numpunct_wchar_do_grouping)
8604 VTABLE_ADD_FUNC(numpunct_wchar_do_falsename)
8605 VTABLE_ADD_FUNC(numpunct_wchar_do_truename));
8606 __ASM_VTABLE(numpunct_short,
8607 VTABLE_ADD_FUNC(numpunct_wchar_vector_dtor)
8608 VTABLE_ADD_FUNC(numpunct_wchar_do_decimal_point)
8609 VTABLE_ADD_FUNC(numpunct_wchar_do_thousands_sep)
8610 VTABLE_ADD_FUNC(numpunct_wchar_do_grouping)
8611 VTABLE_ADD_FUNC(numpunct_wchar_do_falsename)
8612 VTABLE_ADD_FUNC(numpunct_wchar_do_truename));
8613 __ASM_VTABLE(num_get_char,
8614 VTABLE_ADD_FUNC(num_get_char_vector_dtor)
8615 VTABLE_ADD_FUNC(num_get_char_do_get_void)
8616 VTABLE_ADD_FUNC(num_get_char_do_get_double)
8617 VTABLE_ADD_FUNC(num_get_char_do_get_double)
8618 VTABLE_ADD_FUNC(num_get_char_do_get_float)
8619 VTABLE_ADD_FUNC(num_get_char_do_get_uint64)
8620 VTABLE_ADD_FUNC(num_get_char_do_get_int64)
8621 VTABLE_ADD_FUNC(num_get_char_do_get_ulong)
8622 VTABLE_ADD_FUNC(num_get_char_do_get_long)
8623 VTABLE_ADD_FUNC(num_get_char_do_get_uint)
8624 VTABLE_ADD_FUNC(num_get_char_do_get_ushort)
8625 VTABLE_ADD_FUNC(num_get_char_do_get_bool));
8626 __ASM_VTABLE(num_get_short,
8627 VTABLE_ADD_FUNC(num_get_wchar_vector_dtor)
8628 VTABLE_ADD_FUNC(num_get_short_do_get_void)
8629 VTABLE_ADD_FUNC(num_get_short_do_get_double)
8630 VTABLE_ADD_FUNC(num_get_short_do_get_double)
8631 VTABLE_ADD_FUNC(num_get_short_do_get_float)
8632 VTABLE_ADD_FUNC(num_get_short_do_get_uint64)
8633 VTABLE_ADD_FUNC(num_get_short_do_get_int64)
8634 VTABLE_ADD_FUNC(num_get_short_do_get_ulong)
8635 VTABLE_ADD_FUNC(num_get_short_do_get_long)
8636 VTABLE_ADD_FUNC(num_get_short_do_get_uint)
8637 VTABLE_ADD_FUNC(num_get_short_do_get_ushort)
8638 VTABLE_ADD_FUNC(num_get_short_do_get_bool));
8639 __ASM_VTABLE(num_get_wchar,
8640 VTABLE_ADD_FUNC(num_get_wchar_vector_dtor)
8641 VTABLE_ADD_FUNC(num_get_wchar_do_get_void)
8642 VTABLE_ADD_FUNC(num_get_wchar_do_get_double)
8643 VTABLE_ADD_FUNC(num_get_wchar_do_get_double)
8644 VTABLE_ADD_FUNC(num_get_wchar_do_get_float)
8645 VTABLE_ADD_FUNC(num_get_wchar_do_get_uint64)
8646 VTABLE_ADD_FUNC(num_get_wchar_do_get_int64)
8647 VTABLE_ADD_FUNC(num_get_wchar_do_get_ulong)
8648 VTABLE_ADD_FUNC(num_get_wchar_do_get_long)
8649 VTABLE_ADD_FUNC(num_get_wchar_do_get_uint)
8650 VTABLE_ADD_FUNC(num_get_wchar_do_get_ushort)
8651 VTABLE_ADD_FUNC(num_get_wchar_do_get_bool));
8652 __ASM_VTABLE(num_put_char,
8653 VTABLE_ADD_FUNC(num_put_char_vector_dtor)
8654 VTABLE_ADD_FUNC(num_put_char_do_put_ptr)
8655 VTABLE_ADD_FUNC(num_put_char_do_put_double)
8656 VTABLE_ADD_FUNC(num_put_char_do_put_double)
8657 VTABLE_ADD_FUNC(num_put_char_do_put_uint64)
8658 VTABLE_ADD_FUNC(num_put_char_do_put_int64)
8659 VTABLE_ADD_FUNC(num_put_char_do_put_ulong)
8660 VTABLE_ADD_FUNC(num_put_char_do_put_long)
8661 VTABLE_ADD_FUNC(num_put_char_do_put_bool));
8662 __ASM_VTABLE(num_put_wchar,
8663 VTABLE_ADD_FUNC(num_put_wchar_vector_dtor)
8664 VTABLE_ADD_FUNC(num_put_wchar_do_put_ptr)
8665 VTABLE_ADD_FUNC(num_put_wchar_do_put_double)
8666 VTABLE_ADD_FUNC(num_put_wchar_do_put_double)
8667 VTABLE_ADD_FUNC(num_put_wchar_do_put_uint64)
8668 VTABLE_ADD_FUNC(num_put_wchar_do_put_int64)
8669 VTABLE_ADD_FUNC(num_put_wchar_do_put_ulong)
8670 VTABLE_ADD_FUNC(num_put_wchar_do_put_long)
8671 VTABLE_ADD_FUNC(num_put_wchar_do_put_bool));
8672 __ASM_VTABLE(num_put_short,
8673 VTABLE_ADD_FUNC(num_put_wchar_vector_dtor)
8674 VTABLE_ADD_FUNC(num_put_short_do_put_ptr)
8675 VTABLE_ADD_FUNC(num_put_short_do_put_double)
8676 VTABLE_ADD_FUNC(num_put_short_do_put_double)
8677 VTABLE_ADD_FUNC(num_put_short_do_put_uint64)
8678 VTABLE_ADD_FUNC(num_put_short_do_put_int64)
8679 VTABLE_ADD_FUNC(num_put_short_do_put_ulong)
8680 VTABLE_ADD_FUNC(num_put_short_do_put_long)
8681 VTABLE_ADD_FUNC(num_put_short_do_put_bool));
8682 __ASM_VTABLE(time_put_char,
8683 VTABLE_ADD_FUNC(time_put_char_vector_dtor)
8684 VTABLE_ADD_FUNC(time_put_char_do_put));
8685 __ASM_VTABLE(time_put_wchar,
8686 VTABLE_ADD_FUNC(time_put_wchar_vector_dtor)
8687 VTABLE_ADD_FUNC(time_put_wchar_do_put));
8688 __ASM_VTABLE(time_put_short,
8689 VTABLE_ADD_FUNC(time_put_wchar_vector_dtor)
8690 VTABLE_ADD_FUNC(time_put_wchar_do_put));
8691 #ifndef __GNUC__
8693 #endif
8695 void init_locale(void *base)
8697 #ifdef __x86_64__
8698 init_locale_facet_rtti(base);
8699 init_collate_char_rtti(base);
8700 init_collate_wchar_rtti(base);
8701 init_collate_short_rtti(base);
8702 init_ctype_base_rtti(base);
8703 init_ctype_char_rtti(base);
8704 init_ctype_wchar_rtti(base);
8705 init_ctype_short_rtti(base);
8706 init_codecvt_base_rtti(base);
8707 init_codecvt_char_rtti(base);
8708 init_codecvt_wchar_rtti(base);
8709 init_codecvt_short_rtti(base);
8710 init_numpunct_char_rtti(base);
8711 init_numpunct_wchar_rtti(base);
8712 init_numpunct_short_rtti(base);
8713 init_num_get_char_rtti(base);
8714 init_num_get_wchar_rtti(base);
8715 init_num_get_short_rtti(base);
8716 init_num_put_char_rtti(base);
8717 init_num_put_wchar_rtti(base);
8718 init_num_put_short_rtti(base);
8719 init_time_put_char_rtti(base);
8720 init_time_put_wchar_rtti(base);
8721 init_time_put_short_rtti(base);
8722 #endif
8725 void free_locale(void)
8727 facets_elem *iter, *safe;
8729 if(global_locale) {
8730 locale_dtor(&classic_locale);
8731 locale__Locimp_dtor(global_locale);
8732 MSVCRT_operator_delete(global_locale);
8735 LIST_FOR_EACH_ENTRY_SAFE(iter, safe, &lazy_facets, facets_elem, entry) {
8736 list_remove(&iter->entry);
8737 if(locale_facet__Decref(iter->fac))
8738 call_locale_facet_vector_dtor(iter->fac, 1);
8739 MSVCRT_operator_delete(iter);