ws2_32/tests: Wait for thread termination before cleaning up winsock.
[wine.git] / dlls / msvcp60 / locale.c
blob53de64c02b0568af91774010d015d0e311430711
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 /* ?_Dowiden@?$ctype@_W@std@@IBE_WD@Z */
2001 /* ?_Dowiden@?$ctype@_W@std@@IEBA_WD@Z */
2002 /* ?_Dowiden@?$ctype@G@std@@IBEGD@Z */
2003 /* ?_Dowiden@?$ctype@G@std@@IEBAGD@Z */
2004 static wchar_t ctype_wchar__Dowiden(const ctype_wchar *this, char ch)
2006 wchar_t ret;
2007 int state = 0;
2008 TRACE("(%p %d)\n", this, ch);
2009 return _Mbrtowc(&ret, &ch, 1, &state, &this->cvt)<0 ? WEOF : ret;
2012 /* ?do_widen@?$ctype@_W@std@@MBE_WD@Z */
2013 /* ?do_widen@?$ctype@_W@std@@MEBA_WD@Z */
2014 /* ?do_widen@?$ctype@G@std@@MBEGD@Z */
2015 /* ?do_widen@?$ctype@G@std@@MEBAGD@Z */
2016 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_widen_ch, 8)
2017 #define call_ctype_wchar_do_widen_ch(this, ch) CALL_VTBL_FUNC(this, 40, \
2018 wchar_t, (const ctype_wchar*, char), (this, ch))
2019 wchar_t __thiscall ctype_wchar_do_widen_ch(const ctype_wchar *this, char ch)
2021 return ctype_wchar__Dowiden(this, ch);
2024 /* ?do_widen@?$ctype@_W@std@@MBEPBDPBD0PA_W@Z */
2025 /* ?do_widen@?$ctype@_W@std@@MEBAPEBDPEBD0PEA_W@Z */
2026 /* ?do_widen@?$ctype@G@std@@MBEPBDPBD0PAG@Z */
2027 /* ?do_widen@?$ctype@G@std@@MEBAPEBDPEBD0PEAG@Z */
2028 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_widen, 16)
2029 #define call_ctype_wchar_do_widen(this, first, last, dest) CALL_VTBL_FUNC(this, 36, \
2030 const char*, (const ctype_wchar*, const char*, const char*, wchar_t*), \
2031 (this, first, last, dest))
2032 const char* __thiscall ctype_wchar_do_widen(const ctype_wchar *this,
2033 const char *first, const char *last, wchar_t *dest)
2035 TRACE("(%p %p %p %p)\n", this, first, last, dest);
2036 for(; first<last; first++)
2037 *dest++ = ctype_wchar__Dowiden(this, *first);
2038 return last;
2041 /* ?widen@?$ctype@_W@std@@QBE_WD@Z */
2042 /* ?widen@?$ctype@_W@std@@QEBA_WD@Z */
2043 /* ?widen@?$ctype@G@std@@QBEGD@Z */
2044 /* ?widen@?$ctype@G@std@@QEBAGD@Z */
2045 DEFINE_THISCALL_WRAPPER(ctype_wchar_widen_ch, 8)
2046 wchar_t __thiscall ctype_wchar_widen_ch(const ctype_wchar *this, char ch)
2048 TRACE("(%p %d)\n", this, ch);
2049 return call_ctype_wchar_do_widen_ch(this, ch);
2052 /* ?widen@?$ctype@_W@std@@QBEPBDPBD0PA_W@Z */
2053 /* ?widen@?$ctype@_W@std@@QEBAPEBDPEBD0PEA_W@Z */
2054 /* ?widen@?$ctype@G@std@@QBEPBDPBD0PAG@Z */
2055 /* ?widen@?$ctype@G@std@@QEBAPEBDPEBD0PEAG@Z */
2056 DEFINE_THISCALL_WRAPPER(ctype_wchar_widen, 16)
2057 const char* __thiscall ctype_wchar_widen(const ctype_wchar *this,
2058 const char *first, const char *last, wchar_t *dest)
2060 TRACE("(%p %p %p %p)\n", this, first, last, dest);
2061 return call_ctype_wchar_do_widen(this, first, last, dest);
2064 /* ?_Getcat@?$ctype@_W@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
2065 /* ?_Getcat@?$ctype@_W@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
2066 static MSVCP_size_t ctype_wchar__Getcat(const locale_facet **facet, const locale *loc)
2068 TRACE("(%p %p)\n", facet, loc);
2070 if(facet && !*facet) {
2071 _Locinfo locinfo;
2073 *facet = MSVCRT_operator_new(sizeof(ctype_wchar));
2074 if(!*facet) {
2075 ERR("Out of memory\n");
2076 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
2077 return 0;
2080 _Locinfo_ctor_cstr(&locinfo, basic_string_char_c_str(&loc->ptr->name));
2081 ctype_wchar_ctor_locinfo((ctype_wchar*)*facet, &locinfo, 0);
2082 _Locinfo_dtor(&locinfo);
2085 return LC_CTYPE;
2088 /* ?_Getcat@?$ctype@G@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
2089 /* ?_Getcat@?$ctype@G@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
2090 static MSVCP_size_t ctype_short__Getcat(const locale_facet **facet, const locale *loc)
2092 if(facet && !*facet) {
2093 ctype_wchar__Getcat(facet, loc);
2094 (*(locale_facet**)facet)->vtable = &MSVCP_ctype_short_vtable;
2097 return LC_CTYPE;
2100 /* _Towlower */
2101 static wchar_t _Towlower(wchar_t ch, const _Ctypevec *ctype)
2103 TRACE("(%d %p)\n", ch, ctype);
2104 return tolowerW(ch);
2107 ctype_wchar* ctype_wchar_use_facet(const locale *loc)
2109 static ctype_wchar *obj = NULL;
2111 _Lockit lock;
2112 const locale_facet *fac;
2114 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
2115 fac = locale__Getfacet(loc, locale_id_operator_size_t(&ctype_wchar_id), TRUE);
2116 if(fac) {
2117 _Lockit_dtor(&lock);
2118 return (ctype_wchar*)fac;
2121 if(obj) {
2122 _Lockit_dtor(&lock);
2123 return obj;
2126 ctype_wchar__Getcat(&fac, loc);
2127 obj = (ctype_wchar*)fac;
2128 locale_facet__Incref(&obj->base.facet);
2129 locale_facet_register(&obj->base.facet);
2130 _Lockit_dtor(&lock);
2132 return obj;
2135 ctype_wchar* ctype_short_use_facet(const locale *loc)
2137 static ctype_wchar *obj = NULL;
2139 _Lockit lock;
2140 const locale_facet *fac;
2142 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
2143 fac = locale__Getfacet(loc, locale_id_operator_size_t(&ctype_short_id), TRUE);
2144 if(fac) {
2145 _Lockit_dtor(&lock);
2146 return (ctype_wchar*)fac;
2149 if(obj) {
2150 _Lockit_dtor(&lock);
2151 return obj;
2154 ctype_short__Getcat(&fac, loc);
2155 obj = (ctype_wchar*)fac;
2156 locale_facet__Incref(&obj->base.facet);
2157 locale_facet_register(&obj->base.facet);
2158 _Lockit_dtor(&lock);
2160 return obj;
2163 /* ?do_tolower@?$ctype@_W@std@@MBE_W_W@Z */
2164 /* ?do_tolower@?$ctype@_W@std@@MEBA_W_W@Z */
2165 /* ?do_tolower@?$ctype@G@std@@MBEGG@Z */
2166 /* ?do_tolower@?$ctype@G@std@@MEBAGG@Z */
2167 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_tolower_ch, 8)
2168 #define call_ctype_wchar_do_tolower_ch(this, ch) CALL_VTBL_FUNC(this, 24, \
2169 wchar_t, (const ctype_wchar*, wchar_t), (this, ch))
2170 wchar_t __thiscall ctype_wchar_do_tolower_ch(const ctype_wchar *this, wchar_t ch)
2172 return _Towlower(ch, &this->ctype);
2175 /* ?do_tolower@?$ctype@_W@std@@MBEPB_WPA_WPB_W@Z */
2176 /* ?do_tolower@?$ctype@_W@std@@MEBAPEB_WPEA_WPEB_W@Z */
2177 /* ?do_tolower@?$ctype@G@std@@MBEPBGPAGPBG@Z */
2178 /* ?do_tolower@?$ctype@G@std@@MEBAPEBGPEAGPEBG@Z */
2179 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_tolower, 12)
2180 #define call_ctype_wchar_do_tolower(this, first, last) CALL_VTBL_FUNC(this, 20, \
2181 const wchar_t*, (const ctype_wchar*, wchar_t*, const wchar_t*), \
2182 (this, first, last))
2183 const wchar_t* __thiscall ctype_wchar_do_tolower(const ctype_wchar *this,
2184 wchar_t *first, const wchar_t *last)
2186 TRACE("(%p %p %p)\n", this, first, last);
2187 for(; first<last; first++)
2188 *first = _Towlower(*first, &this->ctype);
2189 return last;
2192 /* ?tolower@?$ctype@_W@std@@QBE_W_W@Z */
2193 /* ?tolower@?$ctype@_W@std@@QEBA_W_W@Z */
2194 /* ?tolower@?$ctype@G@std@@QBEGG@Z */
2195 /* ?tolower@?$ctype@G@std@@QEBAGG@Z */
2196 DEFINE_THISCALL_WRAPPER(ctype_wchar_tolower_ch, 8)
2197 wchar_t __thiscall ctype_wchar_tolower_ch(const ctype_wchar *this, wchar_t ch)
2199 TRACE("(%p %d)\n", this, ch);
2200 return call_ctype_wchar_do_tolower_ch(this, ch);
2203 /* ?tolower@?$ctype@_W@std@@QBEPB_WPA_WPB_W@Z */
2204 /* ?tolower@?$ctype@_W@std@@QEBAPEB_WPEA_WPEB_W@Z */
2205 /* ?tolower@?$ctype@G@std@@QBEPBGPAGPBG@Z */
2206 /* ?tolower@?$ctype@G@std@@QEBAPEBGPEAGPEBG@Z */
2207 DEFINE_THISCALL_WRAPPER(ctype_wchar_tolower, 12)
2208 const wchar_t* __thiscall ctype_wchar_tolower(const ctype_wchar *this,
2209 wchar_t *first, const wchar_t *last)
2211 TRACE("(%p %p %p)\n", this, first, last);
2212 return call_ctype_wchar_do_tolower(this, first, last);
2215 /* _Towupper */
2216 static wchar_t _Towupper(wchar_t ch, const _Ctypevec *ctype)
2218 TRACE("(%d %p)\n", ch, ctype);
2219 return toupperW(ch);
2222 /* ?do_toupper@?$ctype@_W@std@@MBE_W_W@Z */
2223 /* ?do_toupper@?$ctype@_W@std@@MEBA_W_W@Z */
2224 /* ?do_toupper@?$ctype@G@std@@MBEGG@Z */
2225 /* ?do_toupper@?$ctype@G@std@@MEBAGG@Z */
2226 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_toupper_ch, 8)
2227 #define call_ctype_wchar_do_toupper_ch(this, ch) CALL_VTBL_FUNC(this, 32, \
2228 wchar_t, (const ctype_wchar*, wchar_t), (this, ch))
2229 wchar_t __thiscall ctype_wchar_do_toupper_ch(const ctype_wchar *this, wchar_t ch)
2231 return _Towupper(ch, &this->ctype);
2234 /* ?do_toupper@?$ctype@_W@std@@MBEPB_WPA_WPB_W@Z */
2235 /* ?do_toupper@?$ctype@_W@std@@MEBAPEB_WPEA_WPEB_W@Z */
2236 /* ?do_toupper@?$ctype@G@std@@MBEPBGPAGPBG@Z */
2237 /* ?do_toupper@?$ctype@G@std@@MEBAPEBGPEAGPEBG@Z */
2238 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_toupper, 12)
2239 #define call_ctype_wchar_do_toupper(this, first, last) CALL_VTBL_FUNC(this, 28, \
2240 const wchar_t*, (const ctype_wchar*, wchar_t*, const wchar_t*), \
2241 (this, first, last))
2242 const wchar_t* __thiscall ctype_wchar_do_toupper(const ctype_wchar *this,
2243 wchar_t *first, const wchar_t *last)
2245 TRACE("(%p %p %p)\n", this, first, last);
2246 for(; first<last; first++)
2247 *first = _Towupper(*first, &this->ctype);
2248 return last;
2251 /* ?toupper@?$ctype@_W@std@@QBE_W_W@Z */
2252 /* ?toupper@?$ctype@_W@std@@QEBA_W_W@Z */
2253 /* ?toupper@?$ctype@G@std@@QBEGG@Z */
2254 /* ?toupper@?$ctype@G@std@@QEBAGG@Z */
2255 DEFINE_THISCALL_WRAPPER(ctype_wchar_toupper_ch, 8)
2256 wchar_t __thiscall ctype_wchar_toupper_ch(const ctype_wchar *this, wchar_t ch)
2258 TRACE("(%p %d)\n", this, ch);
2259 return call_ctype_wchar_do_toupper_ch(this, ch);
2262 /* ?toupper@?$ctype@_W@std@@QBEPB_WPA_WPB_W@Z */
2263 /* ?toupper@?$ctype@_W@std@@QEBAPEB_WPEA_WPEB_W@Z */
2264 /* ?toupper@?$ctype@G@std@@QBEPBGPAGPBG@Z */
2265 /* ?toupper@?$ctype@G@std@@QEBAPEBGPEAGPEBG@Z */
2266 DEFINE_THISCALL_WRAPPER(ctype_wchar_toupper, 12)
2267 const wchar_t* __thiscall ctype_wchar_toupper(const ctype_wchar *this,
2268 wchar_t *first, const wchar_t *last)
2270 TRACE("(%p %p %p)\n", this, first, last);
2271 return call_ctype_wchar_do_toupper(this, first, last);
2274 /* _Getwctypes */
2275 static const wchar_t* _Getwctypes(const wchar_t *first, const wchar_t *last,
2276 short *mask, const _Ctypevec *ctype)
2278 TRACE("(%p %p %p %p)\n", first, last, mask, ctype);
2279 GetStringTypeW(CT_CTYPE1, first, last-first, (WORD*)mask);
2280 return last;
2283 /* _Getwctype */
2284 static short _Getwctype(wchar_t ch, const _Ctypevec *ctype)
2286 short mask = 0;
2287 _Getwctypes(&ch, &ch+1, &mask, ctype);
2288 return mask;
2291 /* ?do_is@?$ctype@_W@std@@MBE_NF_W@Z */
2292 /* ?do_is@?$ctype@_W@std@@MEBA_NF_W@Z */
2293 /* ?do_is@?$ctype@G@std@@MBE_NFG@Z */
2294 /* ?do_is@?$ctype@G@std@@MEBA_NFG@Z */
2295 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_is_ch, 12)
2296 #define call_ctype_wchar_do_is_ch(this, mask, ch) CALL_VTBL_FUNC(this, 8, \
2297 MSVCP_bool, (const ctype_wchar*, short, wchar_t), (this, mask, ch))
2298 MSVCP_bool __thiscall ctype_wchar_do_is_ch(const ctype_wchar *this, short mask, wchar_t ch)
2300 TRACE("(%p %x %d)\n", this, mask, ch);
2301 return (_Getwctype(ch, &this->ctype) & mask) != 0;
2304 /* ?do_is@?$ctype@_W@std@@MBEPB_WPB_W0PAF@Z */
2305 /* ?do_is@?$ctype@_W@std@@MEBAPEB_WPEB_W0PEAF@Z */
2306 /* ?do_is@?$ctype@G@std@@MBEPBGPBG0PAF@Z */
2307 /* ?do_is@?$ctype@G@std@@MEBAPEBGPEBG0PEAF@Z */
2308 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_is, 16)
2309 #define call_ctype_wchar_do_is(this, first, last, dest) CALL_VTBL_FUNC(this, 4, \
2310 const wchar_t*, (const ctype_wchar*, const wchar_t*, const wchar_t*, short*), \
2311 (this, first, last, dest))
2312 const wchar_t* __thiscall ctype_wchar_do_is(const ctype_wchar *this,
2313 const wchar_t *first, const wchar_t *last, short *dest)
2315 TRACE("(%p %p %p %p)\n", this, first, last, dest);
2316 return _Getwctypes(first, last, dest, &this->ctype);
2319 /* ?is@?$ctype@_W@std@@QBE_NF_W@Z */
2320 /* ?is@?$ctype@_W@std@@QEBA_NF_W@Z */
2321 /* ?is@?$ctype@G@std@@QBE_NFG@Z */
2322 /* ?is@?$ctype@G@std@@QEBA_NFG@Z */
2323 DEFINE_THISCALL_WRAPPER(ctype_wchar_is_ch, 12)
2324 MSVCP_bool __thiscall ctype_wchar_is_ch(const ctype_wchar *this, short mask, wchar_t ch)
2326 TRACE("(%p %x %d)\n", this, mask, ch);
2327 return call_ctype_wchar_do_is_ch(this, mask, ch);
2330 /* ?is@?$ctype@_W@std@@QBEPB_WPB_W0PAF@Z */
2331 /* ?is@?$ctype@_W@std@@QEBAPEB_WPEB_W0PEAF@Z */
2332 /* ?is@?$ctype@G@std@@QBEPBGPBG0PAF@Z */
2333 /* ?is@?$ctype@G@std@@QEBAPEBGPEBG0PEAF@Z */
2334 DEFINE_THISCALL_WRAPPER(ctype_wchar_is, 16)
2335 const wchar_t* __thiscall ctype_wchar_is(const ctype_wchar *this,
2336 const wchar_t *first, const wchar_t *last, short *dest)
2338 TRACE("(%p %p %p %p)\n", this, first, last, dest);
2339 return call_ctype_wchar_do_is(this, first, last, dest);
2342 /* ?do_scan_is@?$ctype@_W@std@@MBEPB_WFPB_W0@Z */
2343 /* ?do_scan_is@?$ctype@_W@std@@MEBAPEB_WFPEB_W0@Z */
2344 /* ?do_scan_is@?$ctype@G@std@@MBEPBGFPBG0@Z */
2345 /* ?do_scan_is@?$ctype@G@std@@MEBAPEBGFPEBG0@Z */
2346 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_scan_is, 16)
2347 #define call_ctype_wchar_do_scan_is(this, mask, first, last) CALL_VTBL_FUNC(this, 12, \
2348 const wchar_t*, (const ctype_wchar*, short, const wchar_t*, const wchar_t*), \
2349 (this, mask, first, last))
2350 const wchar_t* __thiscall ctype_wchar_do_scan_is(const ctype_wchar *this,
2351 short mask, const wchar_t *first, const wchar_t *last)
2353 TRACE("(%p %d %p %p)\n", this, mask, first, last);
2354 for(; first<last; first++)
2355 if(!ctype_wchar_is_ch(this, mask, *first))
2356 break;
2357 return first;
2360 /* ?scan_is@?$ctype@_W@std@@QBEPB_WFPB_W0@Z */
2361 /* ?scan_is@?$ctype@_W@std@@QEBAPEB_WFPEB_W0@Z */
2362 /* ?scan_is@?$ctype@G@std@@QBEPBGFPBG0@Z */
2363 /* ?scan_is@?$ctype@G@std@@QEBAPEBGFPEBG0@Z */
2364 DEFINE_THISCALL_WRAPPER(ctype_wchar_scan_is, 16)
2365 const wchar_t* __thiscall ctype_wchar_scan_is(const ctype_wchar *this,
2366 short mask, const wchar_t *first, const wchar_t *last)
2368 TRACE("(%p %x %p %p)\n", this, mask, first, last);
2369 return call_ctype_wchar_do_scan_is(this, mask, first, last);
2372 /* ?do_scan_not@?$ctype@_W@std@@MBEPB_WFPB_W0@Z */
2373 /* ?do_scan_not@?$ctype@_W@std@@MEBAPEB_WFPEB_W0@Z */
2374 /* ?do_scan_not@?$ctype@G@std@@MBEPBGFPBG0@Z */
2375 /* ?do_scan_not@?$ctype@G@std@@MEBAPEBGFPEBG0@Z */
2376 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_scan_not, 16)
2377 #define call_ctype_wchar_do_scan_not(this, mask, first, last) CALL_VTBL_FUNC(this, 16, \
2378 const wchar_t*, (const ctype_wchar*, short, const wchar_t*, const wchar_t*), \
2379 (this, mask, first, last))
2380 const wchar_t* __thiscall ctype_wchar_do_scan_not(const ctype_wchar *this,
2381 short mask, const wchar_t *first, const wchar_t *last)
2383 TRACE("(%p %x %p %p)\n", this, mask, first, last);
2384 for(; first<last; first++)
2385 if(ctype_wchar_is_ch(this, mask, *first))
2386 break;
2387 return first;
2390 /* ?scan_not@?$ctype@_W@std@@QBEPB_WFPB_W0@Z */
2391 /* ?scan_not@?$ctype@_W@std@@QEBAPEB_WFPEB_W0@Z */
2392 /* ?scan_not@?$ctype@G@std@@QBEPBGFPBG0@Z */
2393 /* ?scan_not@?$ctype@G@std@@QEBAPEBGFPEBG0@Z */
2394 DEFINE_THISCALL_WRAPPER(ctype_wchar_scan_not, 16)
2395 const wchar_t* __thiscall ctype_wchar_scan_not(const ctype_wchar *this,
2396 short mask, const wchar_t *first, const wchar_t *last)
2398 TRACE("(%p %x %p %p)\n", this, mask, first, last);
2399 return call_ctype_wchar_do_scan_not(this, mask, first, last);
2402 /* ??_7codecvt_base@std@@6B@ */
2403 extern const vtable_ptr MSVCP_codecvt_base_vtable;
2405 /* ??0codecvt_base@std@@QAE@I@Z */
2406 /* ??0codecvt_base@std@@QEAA@_K@Z */
2407 DEFINE_THISCALL_WRAPPER(codecvt_base_ctor_refs, 8)
2408 codecvt_base* __thiscall codecvt_base_ctor_refs(codecvt_base *this, MSVCP_size_t refs)
2410 TRACE("(%p %lu)\n", this, refs);
2411 locale_facet_ctor_refs(&this->facet, refs);
2412 this->facet.vtable = &MSVCP_codecvt_base_vtable;
2413 return this;
2416 /* ??_Fcodecvt_base@std@@QAEXXZ */
2417 /* ??_Fcodecvt_base@std@@QEAAXXZ */
2418 DEFINE_THISCALL_WRAPPER(codecvt_base_ctor, 4)
2419 codecvt_base* __thiscall codecvt_base_ctor(codecvt_base *this)
2421 return codecvt_base_ctor_refs(this, 0);
2424 /* ??1codecvt_base@std@@UAE@XZ */
2425 /* ??1codecvt_base@std@@UEAA@XZ */
2426 DEFINE_THISCALL_WRAPPER(codecvt_base_dtor, 4)
2427 void __thiscall codecvt_base_dtor(codecvt_base *this)
2429 TRACE("(%p)\n", this);
2430 locale_facet_dtor(&this->facet);
2433 DEFINE_THISCALL_WRAPPER(codecvt_base_vector_dtor, 8)
2434 codecvt_base* __thiscall codecvt_base_vector_dtor(codecvt_base *this, unsigned int flags)
2436 TRACE("(%p %x)\n", this, flags);
2437 if(flags & 2) {
2438 /* we have an array, with the number of elements stored before the first object */
2439 INT_PTR i, *ptr = (INT_PTR *)this-1;
2441 for(i=*ptr-1; i>=0; i--)
2442 codecvt_base_dtor(this+i);
2443 MSVCRT_operator_delete(ptr);
2444 } else {
2445 codecvt_base_dtor(this);
2446 if(flags & 1)
2447 MSVCRT_operator_delete(this);
2450 return this;
2453 /* ?do_always_noconv@codecvt_base@std@@MBE_NXZ */
2454 /* ?do_always_noconv@codecvt_base@std@@MEBA_NXZ */
2455 #define call_codecvt_base_do_always_noconv(this) CALL_VTBL_FUNC(this, 4, \
2456 MSVCP_bool, (const codecvt_base*), (this))
2457 DEFINE_THISCALL_WRAPPER(codecvt_base_do_always_noconv, 4)
2458 MSVCP_bool __thiscall codecvt_base_do_always_noconv(const codecvt_base *this)
2460 TRACE("(%p)\n", this);
2461 return TRUE;
2464 /* ?always_noconv@codecvt_base@std@@QBE_NXZ */
2465 /* ?always_noconv@codecvt_base@std@@QEBA_NXZ */
2466 DEFINE_THISCALL_WRAPPER(codecvt_base_always_noconv, 4)
2467 MSVCP_bool __thiscall codecvt_base_always_noconv(const codecvt_base *this)
2469 TRACE("(%p)\n", this);
2470 return call_codecvt_base_do_always_noconv(this);
2473 /* ?do_max_length@codecvt_base@std@@MBEHXZ */
2474 /* ?do_max_length@codecvt_base@std@@MEBAHXZ */
2475 #define call_codecvt_base_do_max_length(this) CALL_VTBL_FUNC(this, 8, \
2476 int, (const codecvt_base*), (this))
2477 DEFINE_THISCALL_WRAPPER(codecvt_base_do_max_length, 4)
2478 int __thiscall codecvt_base_do_max_length(const codecvt_base *this)
2480 TRACE("(%p)\n", this);
2481 return 1;
2484 /* ?max_length@codecvt_base@std@@QBEHXZ */
2485 /* ?max_length@codecvt_base@std@@QEBAHXZ */
2486 DEFINE_THISCALL_WRAPPER(codecvt_base_max_length, 4)
2487 int __thiscall codecvt_base_max_length(const codecvt_base *this)
2489 TRACE("(%p)\n", this);
2490 return call_codecvt_base_do_max_length(this);
2493 /* ?do_encoding@codecvt_base@std@@MBEHXZ */
2494 /* ?do_encoding@codecvt_base@std@@MEBAHXZ */
2495 #define call_codecvt_base_do_encoding(this) CALL_VTBL_FUNC(this, 12, \
2496 int, (const codecvt_base*), (this))
2497 DEFINE_THISCALL_WRAPPER(codecvt_base_do_encoding, 4)
2498 int __thiscall codecvt_base_do_encoding(const codecvt_base *this)
2500 TRACE("(%p)\n", this);
2501 return 1;
2504 /* ?encoding@codecvt_base@std@@QBEHXZ */
2505 /* ?encoding@codecvt_base@std@@QEBAHXZ */
2506 DEFINE_THISCALL_WRAPPER(codecvt_base_encoding, 4)
2507 int __thiscall codecvt_base_encoding(const codecvt_base *this)
2509 TRACE("(%p)\n", this);
2510 return call_codecvt_base_do_encoding(this);
2513 /* ?id@?$codecvt@DDH@std@@2V0locale@2@A */
2514 locale_id codecvt_char_id = {0};
2516 /* ??_7?$codecvt@DDH@std@@6B@ */
2517 extern const vtable_ptr MSVCP_codecvt_char_vtable;
2519 /* ?_Init@?$codecvt@DDH@std@@IAEXABV_Locinfo@2@@Z */
2520 /* ?_Init@?$codecvt@DDH@std@@IEAAXAEBV_Locinfo@2@@Z */
2521 DEFINE_THISCALL_WRAPPER(codecvt_char__Init, 8)
2522 void __thiscall codecvt_char__Init(codecvt_char *this, const _Locinfo *locinfo)
2524 TRACE("(%p %p)\n", this, locinfo);
2527 /* ??0?$codecvt@DDH@std@@QAE@ABV_Locinfo@1@I@Z */
2528 /* ??0?$codecvt@DDH@std@@QEAA@AEBV_Locinfo@1@_K@Z */
2529 DEFINE_THISCALL_WRAPPER(codecvt_char_ctor_locinfo, 12)
2530 codecvt_char* __thiscall codecvt_char_ctor_locinfo(codecvt_char *this, const _Locinfo *locinfo, MSVCP_size_t refs)
2532 TRACE("(%p %p %lu)\n", this, locinfo, refs);
2533 codecvt_base_ctor_refs(&this->base, refs);
2534 this->base.facet.vtable = &MSVCP_codecvt_char_vtable;
2535 return this;
2538 /* ??0?$codecvt@DDH@std@@QAE@I@Z */
2539 /* ??0?$codecvt@DDH@std@@QEAA@_K@Z */
2540 DEFINE_THISCALL_WRAPPER(codecvt_char_ctor_refs, 8)
2541 codecvt_char* __thiscall codecvt_char_ctor_refs(codecvt_char *this, MSVCP_size_t refs)
2543 return codecvt_char_ctor_locinfo(this, NULL, refs);
2546 /* ??_F?$codecvt@DDH@std@@QAEXXZ */
2547 /* ??_F?$codecvt@DDH@std@@QEAAXXZ */
2548 DEFINE_THISCALL_WRAPPER(codecvt_char_ctor, 4)
2549 codecvt_char* __thiscall codecvt_char_ctor(codecvt_char *this)
2551 return codecvt_char_ctor_locinfo(this, NULL, 0);
2554 /* ??1?$codecvt@DDH@std@@UAE@XZ */
2555 /* ??1?$codecvt@DDH@std@@UEAA@XZ */
2556 DEFINE_THISCALL_WRAPPER(codecvt_char_dtor, 4)
2557 void __thiscall codecvt_char_dtor(codecvt_char *this)
2559 TRACE("(%p)\n", this);
2560 codecvt_base_dtor(&this->base);
2563 DEFINE_THISCALL_WRAPPER(codecvt_char_vector_dtor, 8)
2564 codecvt_char* __thiscall codecvt_char_vector_dtor(codecvt_char *this, unsigned int flags)
2566 TRACE("(%p %x)\n", this, flags);
2567 if(flags & 2) {
2568 /* we have an array, with the number of elements stored before the first object */
2569 INT_PTR i, *ptr = (INT_PTR *)this-1;
2571 for(i=*ptr-1; i>=0; i--)
2572 codecvt_char_dtor(this+i);
2573 MSVCRT_operator_delete(ptr);
2574 } else {
2575 codecvt_char_dtor(this);
2576 if(flags & 1)
2577 MSVCRT_operator_delete(this);
2580 return this;
2583 /* ?_Getcat@?$codecvt@DDH@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
2584 /* ?_Getcat@?$codecvt@DDH@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
2585 static MSVCP_size_t codecvt_char__Getcat(const locale_facet **facet, const locale *loc)
2587 TRACE("(%p %p)\n", facet, loc);
2589 if(facet && !*facet) {
2590 *facet = MSVCRT_operator_new(sizeof(codecvt_char));
2591 if(!*facet) {
2592 ERR("Out of memory\n");
2593 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
2594 return 0;
2596 codecvt_char_ctor((codecvt_char*)*facet);
2599 return LC_CTYPE;
2602 codecvt_char* codecvt_char_use_facet(const locale *loc)
2604 static codecvt_char *obj = NULL;
2606 _Lockit lock;
2607 const locale_facet *fac;
2609 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
2610 fac = locale__Getfacet(loc, locale_id_operator_size_t(&codecvt_char_id), TRUE);
2611 if(fac) {
2612 _Lockit_dtor(&lock);
2613 return (codecvt_char*)fac;
2616 if(obj) {
2617 _Lockit_dtor(&lock);
2618 return obj;
2621 codecvt_char__Getcat(&fac, loc);
2622 obj = (codecvt_char*)fac;
2623 locale_facet__Incref(&obj->base.facet);
2624 locale_facet_register(&obj->base.facet);
2625 _Lockit_dtor(&lock);
2627 return obj;
2630 /* ?do_in@?$codecvt@DDH@std@@MBEHAAHPBD1AAPBDPAD3AAPAD@Z */
2631 /* ?do_in@?$codecvt@DDH@std@@MEBAHAEAHPEBD1AEAPEBDPEAD3AEAPEAD@Z */
2632 #define call_codecvt_char_do_in(this, state, from, from_end, from_next, to, to_end, to_next) \
2633 CALL_VTBL_FUNC(this, 16, int, \
2634 (const codecvt_char*, int*, const char*, const char*, const char**, char*, char*, char**), \
2635 (this, state, from, from_end, from_next, to, to_end, to_next))
2636 DEFINE_THISCALL_WRAPPER(codecvt_char_do_in, 32)
2637 int __thiscall codecvt_char_do_in(const codecvt_char *this, int *state,
2638 const char *from, const char *from_end, const char **from_next,
2639 char *to, char *to_end, char **to_next)
2641 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from, from_end,
2642 from_next, to, to_end, to_next);
2643 *from_next = from;
2644 *to_next = to;
2645 return CODECVT_noconv;
2648 /* ?in@?$codecvt@DDH@std@@QBEHAAHPBD1AAPBDPAD3AAPAD@Z */
2649 /* ?in@?$codecvt@DDH@std@@QEBAHAEAHPEBD1AEAPEBDPEAD3AEAPEAD@Z */
2650 DEFINE_THISCALL_WRAPPER(codecvt_char_in, 32)
2651 int __thiscall codecvt_char_in(const codecvt_char *this, int *state,
2652 const char *from, const char *from_end, const char **from_next,
2653 char *to, char *to_end, char **to_next)
2655 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from, from_end,
2656 from_next, to, to_end, to_next);
2657 return call_codecvt_char_do_in(this, state, from, from_end, from_next,
2658 to, to_end, to_next);
2661 /* ?do_out@?$codecvt@DDH@std@@MBEHAAHPBD1AAPBDPAD3AAPAD@Z */
2662 /* ?do_out@?$codecvt@DDH@std@@MEBAHAEAHPEBD1AEAPEBDPEAD3AEAPEAD@Z */
2663 #define call_codecvt_char_do_out(this, state, from, from_end, from_next, to, to_end, to_next) \
2664 CALL_VTBL_FUNC(this, 20, int, \
2665 (const codecvt_char*, int*, const char*, const char*, const char**, char*, char*, char**), \
2666 (this, state, from, from_end, from_next, to, to_end, to_next))
2667 DEFINE_THISCALL_WRAPPER(codecvt_char_do_out, 32)
2668 int __thiscall codecvt_char_do_out(const codecvt_char *this, int *state,
2669 const char *from, const char *from_end, const char **from_next,
2670 char *to, char *to_end, char **to_next)
2672 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from,
2673 from_end, from_next, to, to_end, to_next);
2674 *from_next = from;
2675 *to_next = to;
2676 return CODECVT_noconv;
2679 /* ?out@?$codecvt@DDH@std@@QBEHAAHPBD1AAPBDPAD3AAPAD@Z */
2680 /* ?out@?$codecvt@DDH@std@@QEBAHAEAHPEBD1AEAPEBDPEAD3AEAPEAD@Z */
2681 DEFINE_THISCALL_WRAPPER(codecvt_char_out, 32)
2682 int __thiscall codecvt_char_out(const codecvt_char *this, int *state,
2683 const char *from, const char *from_end, const char **from_next,
2684 char *to, char *to_end, char **to_next)
2686 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from, from_end,
2687 from_next, to, to_end, to_next);
2688 return call_codecvt_char_do_out(this, state, from, from_end, from_next,
2689 to, to_end, to_next);
2692 /* ?do_unshift@?$codecvt@DDH@std@@MBEHAAHPAD1AAPAD@Z */
2693 /* ?do_unshift@?$codecvt@DDH@std@@MEBAHAEAHPEAD1AEAPEAD@Z */
2694 #define call_codecvt_char_do_unshift(this, state, to, to_end, to_next) CALL_VTBL_FUNC(this, 24, \
2695 int, (const codecvt_char*, int*, char*, char*, char**), (this, state, to, to_end, to_next))
2696 DEFINE_THISCALL_WRAPPER(codecvt_char_do_unshift, 20)
2697 int __thiscall codecvt_char_do_unshift(const codecvt_char *this,
2698 int *state, char *to, char *to_end, char **to_next)
2700 TRACE("(%p %p %p %p %p)\n", this, state, to, to_end, to_next);
2701 *to_next = to;
2702 return CODECVT_noconv;
2705 /* ?do_length@?$codecvt@DDH@std@@MBEHABHPBD1I@Z */
2706 /* ?do_length@?$codecvt@DDH@std@@MEBAHAEBHPEBD1_K@Z */
2707 #define call_codecvt_char_do_length(this, state, from, from_end, max) CALL_VTBL_FUNC(this, 28, \
2708 int, (const codecvt_char*, const int*, const char*, const char*, MSVCP_size_t), \
2709 (this, state, from, from_end, max))
2710 DEFINE_THISCALL_WRAPPER(codecvt_char_do_length, 20)
2711 int __thiscall codecvt_char_do_length(const codecvt_char *this, const int *state,
2712 const char *from, const char *from_end, MSVCP_size_t max)
2714 TRACE("(%p %p %p %p %lu)\n", this, state, from, from_end, max);
2715 return (from_end-from > max ? max : from_end-from);
2718 /* ?length@?$codecvt@DDH@std@@QBEHABHPBD1I@Z */
2719 /* ?length@?$codecvt@DDH@std@@QEBAHAEBHPEBD1_K@Z */
2720 DEFINE_THISCALL_WRAPPER(codecvt_char_length, 20)
2721 int __thiscall codecvt_char_length(const codecvt_char *this, const int *state,
2722 const char *from, const char *from_end, MSVCP_size_t max)
2724 TRACE("(%p %p %p %p %lu)\n", this, state, from, from_end, max);
2725 return call_codecvt_char_do_length(this, state, from, from_end, max);
2728 /* ?id@?$codecvt@_WDH@std@@2V0locale@2@A */
2729 static locale_id codecvt_wchar_id = {0};
2730 /* ?id@?$codecvt@GDH@std@@2V0locale@2@A */
2731 locale_id codecvt_short_id = {0};
2733 /* ??_7?$codecvt@_WDH@std@@6B@ */
2734 extern const vtable_ptr MSVCP_codecvt_wchar_vtable;
2735 /* ??_7?$codecvt@GDH@std@@6B@ */
2736 extern const vtable_ptr MSVCP_codecvt_short_vtable;
2738 /* ?_Init@?$codecvt@GDH@std@@IAEXABV_Locinfo@2@@Z */
2739 /* ?_Init@?$codecvt@GDH@std@@IEAAXAEBV_Locinfo@2@@Z */
2740 /* ?_Init@?$codecvt@_WDH@std@@IAEXABV_Locinfo@2@@Z */
2741 /* ?_Init@?$codecvt@_WDH@std@@IEAAXAEBV_Locinfo@2@@Z */
2742 DEFINE_THISCALL_WRAPPER(codecvt_wchar__Init, 8)
2743 void __thiscall codecvt_wchar__Init(codecvt_wchar *this, const _Locinfo *locinfo)
2745 TRACE("(%p %p)\n", this, locinfo);
2746 _Locinfo__Getcvt(locinfo, &this->cvt);
2749 /* ??0?$codecvt@_WDH@std@@QAE@ABV_Locinfo@1@I@Z */
2750 /* ??0?$codecvt@_WDH@std@@QEAA@AEBV_Locinfo@1@_K@Z */
2751 static codecvt_wchar* codecvt_wchar_ctor_locinfo(codecvt_wchar *this, const _Locinfo *locinfo, MSVCP_size_t refs)
2753 TRACE("(%p %p %ld)\n", this, locinfo, refs);
2755 codecvt_base_ctor_refs(&this->base, refs);
2756 this->base.facet.vtable = &MSVCP_codecvt_wchar_vtable;
2758 codecvt_wchar__Init(this, locinfo);
2759 return this;
2762 /* ??0?$codecvt@GDH@std@@QAE@ABV_Locinfo@1@I@Z */
2763 /* ??0?$codecvt@GDH@std@@QEAA@AEBV_Locinfo@1@_K@Z */
2764 DEFINE_THISCALL_WRAPPER(codecvt_short_ctor_locinfo, 12)
2765 codecvt_wchar* __thiscall codecvt_short_ctor_locinfo(codecvt_wchar *this, const _Locinfo *locinfo, MSVCP_size_t refs)
2767 TRACE("(%p %p %ld)\n", this, locinfo, refs);
2769 codecvt_wchar_ctor_locinfo(this, locinfo, refs);
2770 this->base.facet.vtable = &MSVCP_codecvt_short_vtable;
2771 return this;
2774 /* ??0?$codecvt@GDH@std@@QAE@I@Z */
2775 /* ??0?$codecvt@GDH@std@@QEAA@_K@Z */
2776 DEFINE_THISCALL_WRAPPER(codecvt_short_ctor_refs, 8)
2777 codecvt_wchar* __thiscall codecvt_short_ctor_refs(codecvt_wchar *this, MSVCP_size_t refs)
2779 _Locinfo locinfo;
2781 TRACE("(%p %ld)\n", this, refs);
2783 _Locinfo_ctor(&locinfo);
2784 codecvt_short_ctor_locinfo(this, &locinfo, refs);
2785 _Locinfo_dtor(&locinfo);
2786 return this;
2789 /* ??_F?$codecvt@GDH@std@@QAEXXZ */
2790 /* ??_F?$codecvt@GDH@std@@QEAAXXZ */
2791 DEFINE_THISCALL_WRAPPER(codecvt_short_ctor, 4)
2792 codecvt_wchar* __thiscall codecvt_short_ctor(codecvt_wchar *this)
2794 return codecvt_short_ctor_refs(this, 0);
2797 /* ??1?$codecvt@GDH@std@@UAE@XZ */
2798 /* ??1?$codecvt@GDH@std@@UEAA@XZ */
2799 DEFINE_THISCALL_WRAPPER(codecvt_wchar_dtor, 4)
2800 void __thiscall codecvt_wchar_dtor(codecvt_wchar *this)
2802 TRACE("(%p)\n", this);
2803 codecvt_base_dtor(&this->base);
2806 DEFINE_THISCALL_WRAPPER(codecvt_wchar_vector_dtor, 8)
2807 codecvt_wchar* __thiscall codecvt_wchar_vector_dtor(codecvt_wchar *this, unsigned int flags)
2809 TRACE("(%p %x)\n", this, flags);
2810 if(flags & 2) {
2811 /* we have an array, with the number of elements stored before the first object */
2812 INT_PTR i, *ptr = (INT_PTR *)this-1;
2814 for(i=*ptr-1; i>=0; i--)
2815 codecvt_wchar_dtor(this+i);
2816 MSVCRT_operator_delete(ptr);
2817 } else {
2818 codecvt_wchar_dtor(this);
2819 if(flags & 1)
2820 MSVCRT_operator_delete(this);
2823 return this;
2826 /* ?_Getcat@?$codecvt@_WDH@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
2827 /* ?_Getcat@?$codecvt@_WDH@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
2828 static MSVCP_size_t codecvt_wchar__Getcat(const locale_facet **facet, const locale *loc)
2830 TRACE("(%p %p)\n", facet, loc);
2832 if(facet && !*facet) {
2833 _Locinfo locinfo;
2835 *facet = MSVCRT_operator_new(sizeof(codecvt_wchar));
2836 if(!*facet) {
2837 ERR("Out of memory\n");
2838 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
2839 return 0;
2842 _Locinfo_ctor_cstr(&locinfo, basic_string_char_c_str(&loc->ptr->name));
2843 codecvt_wchar_ctor_locinfo((codecvt_wchar*)*facet, &locinfo, 0);
2844 _Locinfo_dtor(&locinfo);
2847 return LC_CTYPE;
2850 static codecvt_wchar* codecvt_wchar_use_facet(const locale *loc)
2852 static codecvt_wchar *obj = NULL;
2854 _Lockit lock;
2855 const locale_facet *fac;
2857 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
2858 fac = locale__Getfacet(loc, locale_id_operator_size_t(&codecvt_wchar_id), TRUE);
2859 if(fac) {
2860 _Lockit_dtor(&lock);
2861 return (codecvt_wchar*)fac;
2864 if(obj) {
2865 _Lockit_dtor(&lock);
2866 return obj;
2869 codecvt_wchar__Getcat(&fac, loc);
2870 obj = (codecvt_wchar*)fac;
2871 locale_facet__Incref(&obj->base.facet);
2872 locale_facet_register(&obj->base.facet);
2873 _Lockit_dtor(&lock);
2875 return obj;
2878 /* ?_Getcat@?$codecvt@GDH@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
2879 /* ?_Getcat@?$codecvt@GDH@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
2880 static MSVCP_size_t codecvt_short__Getcat(const locale_facet **facet, const locale *loc)
2882 TRACE("(%p %p)\n", facet, loc);
2884 if(facet && !*facet) {
2885 _Locinfo locinfo;
2887 *facet = MSVCRT_operator_new(sizeof(codecvt_wchar));
2888 if(!*facet) {
2889 ERR("Out of memory\n");
2890 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
2891 return 0;
2894 _Locinfo_ctor_cstr(&locinfo, basic_string_char_c_str(&loc->ptr->name));
2895 codecvt_short_ctor((codecvt_wchar*)*facet);
2896 _Locinfo_dtor(&locinfo);
2899 return LC_CTYPE;
2902 codecvt_wchar* codecvt_short_use_facet(const locale *loc)
2904 static codecvt_wchar *obj = NULL;
2906 _Lockit lock;
2907 const locale_facet *fac;
2909 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
2910 fac = locale__Getfacet(loc, locale_id_operator_size_t(&codecvt_short_id), TRUE);
2911 if(fac) {
2912 _Lockit_dtor(&lock);
2913 return (codecvt_wchar*)fac;
2916 if(obj) {
2917 _Lockit_dtor(&lock);
2918 return obj;
2921 codecvt_short__Getcat(&fac, loc);
2922 obj = (codecvt_wchar*)fac;
2923 locale_facet__Incref(&obj->base.facet);
2924 locale_facet_register(&obj->base.facet);
2925 _Lockit_dtor(&lock);
2927 return obj;
2930 /* ?do_always_noconv@?$codecvt@GDH@std@@MBE_NXZ */
2931 /* ?do_always_noconv@?$codecvt@GDH@std@@MEBA_NXZ */
2932 /* ?do_always_noconv@?$codecvt@_WDH@std@@MBE_NXZ */
2933 /* ?do_always_noconv@?$codecvt@_WDH@std@@MEBA_NXZ */
2934 DEFINE_THISCALL_WRAPPER(codecvt_wchar_do_always_noconv, 4)
2935 MSVCP_bool __thiscall codecvt_wchar_do_always_noconv(const codecvt_wchar *this)
2937 TRACE("(%p)\n", this);
2938 return FALSE;
2941 /* ?do_max_length@?$codecvt@GDH@std@@MBEHXZ */
2942 /* ?do_max_length@?$codecvt@GDH@std@@MEBAHXZ */
2943 /* ?do_max_length@?$codecvt@_WDH@std@@MBEHXZ */
2944 /* ?do_max_length@?$codecvt@_WDH@std@@MEBAHXZ */
2945 DEFINE_THISCALL_WRAPPER(codecvt_wchar_do_max_length, 4)
2946 int __thiscall codecvt_wchar_do_max_length(const codecvt_wchar *this)
2948 TRACE("(%p)\n", this);
2949 return MB_LEN_MAX;
2952 /* ?do_in@?$codecvt@GDH@std@@MBEHAAHPBD1AAPBDPAG3AAPAG@Z */
2953 /* ?do_in@?$codecvt@GDH@std@@MEBAHAEAHPEBD1AEAPEBDPEAG3AEAPEAG@Z */
2954 /* ?do_in@?$codecvt@_WDH@std@@MBEHAAHPBD1AAPBDPA_W3AAPA_W@Z */
2955 /* ?do_in@?$codecvt@_WDH@std@@MEBAHAEAHPEBD1AEAPEBDPEA_W3AEAPEA_W@Z */
2956 #define call_codecvt_wchar_do_in(this, state, from, from_end, from_next, to, to_end, to_next) \
2957 CALL_VTBL_FUNC(this, 16, int, \
2958 (const codecvt_wchar*, int*, const char*, const char*, const char**, wchar_t*, wchar_t*, wchar_t**), \
2959 (this, state, from, from_end, from_next, to, to_end, to_next))
2960 DEFINE_THISCALL_WRAPPER(codecvt_wchar_do_in, 32)
2961 int __thiscall codecvt_wchar_do_in(const codecvt_wchar *this, int *state,
2962 const char *from, const char *from_end, const char **from_next,
2963 wchar_t *to, wchar_t *to_end, wchar_t **to_next)
2965 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from,
2966 from_end, from_next, to, to_end, to_next);
2968 *from_next = from;
2969 *to_next = to;
2971 while(*from_next!=from_end && *to_next!=to_end) {
2972 switch(_Mbrtowc(*to_next, *from_next, from_end-*from_next, state, &this->cvt)) {
2973 case -2:
2974 *from_next = from_end;
2975 return CODECVT_partial;
2976 case -1:
2977 return CODECVT_error;
2978 case 2:
2979 (*from_next)++;
2980 /* fall through */
2981 case 0:
2982 case 1:
2983 (*from_next)++;
2984 (*to_next)++;
2988 return CODECVT_ok;
2991 /* ?in@?$codecvt@GDH@std@@QBEHAAHPBD1AAPBDPAG3AAPAG@Z */
2992 /* ?in@?$codecvt@GDH@std@@QEBAHAEAHPEBD1AEAPEBDPEAG3AEAPEAG@Z */
2993 /* ?in@?$codecvt@_WDH@std@@QBEHAAHPBD1AAPBDPA_W3AAPA_W@Z */
2994 /* ?in@?$codecvt@_WDH@std@@QEBAHAEAHPEBD1AEAPEBDPEA_W3AEAPEA_W@Z */
2995 DEFINE_THISCALL_WRAPPER(codecvt_wchar_in, 32)
2996 int __thiscall codecvt_wchar_in(const codecvt_wchar *this, int *state,
2997 const char *from, const char *from_end, const char **from_next,
2998 wchar_t *to, wchar_t *to_end, wchar_t **to_next)
3000 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from,
3001 from_end, from_next, to, to_end, to_next);
3002 return call_codecvt_wchar_do_in(this, state, from,
3003 from_end, from_next, to, to_end, to_next);
3006 /* ?do_out@?$codecvt@GDH@std@@MBEHAAHPBG1AAPBGPAD3AAPAD@Z */
3007 /* ?do_out@?$codecvt@GDH@std@@MEBAHAEAHPEBG1AEAPEBGPEAD3AEAPEAD@Z */
3008 /* ?do_out@?$codecvt@_WDH@std@@MBEHAAHPB_W1AAPB_WPAD3AAPAD@Z */
3009 /* ?do_out@?$codecvt@_WDH@std@@MEBAHAEAHPEB_W1AEAPEB_WPEAD3AEAPEAD@Z */
3010 #define call_codecvt_wchar_do_out(this, state, from, from_end, from_next, to, to_end, to_next) \
3011 CALL_VTBL_FUNC(this, 20, int, \
3012 (const codecvt_wchar*, int*, const wchar_t*, const wchar_t*, const wchar_t**, char*, char*, char**), \
3013 (this, state, from, from_end, from_next, to, to_end, to_next))
3014 DEFINE_THISCALL_WRAPPER(codecvt_wchar_do_out, 32)
3015 int __thiscall codecvt_wchar_do_out(const codecvt_wchar *this, int *state,
3016 const wchar_t *from, const wchar_t *from_end, const wchar_t **from_next,
3017 char *to, char *to_end, char **to_next)
3019 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from,
3020 from_end, from_next, to, to_end, to_next);
3022 *from_next = from;
3023 *to_next = to;
3025 while(*from_next!=from_end && *to_next!=to_end) {
3026 int old_state = *state, size;
3027 char buf[MB_LEN_MAX];
3029 switch((size = _Wcrtomb(buf, **from_next, state, &this->cvt))) {
3030 case -1:
3031 return CODECVT_error;
3032 default:
3033 if(size > from_end-*from_next) {
3034 *state = old_state;
3035 return CODECVT_partial;
3038 (*from_next)++;
3039 memcpy_s(*to_next, to_end-*to_next, buf, size);
3040 (*to_next) += size;
3044 return CODECVT_ok;
3047 /* ?out@?$codecvt@GDH@std@@QBEHAAHPBG1AAPBGPAD3AAPAD@Z */
3048 /* ?out@?$codecvt@GDH@std@@QEBAHAEAHPEBG1AEAPEBGPEAD3AEAPEAD@Z */
3049 /* ?out@?$codecvt@_WDH@std@@QBEHAAHPB_W1AAPB_WPAD3AAPAD@Z */
3050 /* ?out@?$codecvt@_WDH@std@@QEBAHAEAHPEB_W1AEAPEB_WPEAD3AEAPEAD@Z */
3051 DEFINE_THISCALL_WRAPPER(codecvt_wchar_out, 32)
3052 int __thiscall codecvt_wchar_out(const codecvt_wchar *this, int *state,
3053 const wchar_t *from, const wchar_t *from_end, const wchar_t **from_next,
3054 char *to, char *to_end, char **to_next)
3056 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from,
3057 from_end, from_next, to, to_end, to_next);
3058 return call_codecvt_wchar_do_out(this, state, from,
3059 from_end, from_next, to, to_end, to_next);
3062 /* ?do_unshift@?$codecvt@GDH@std@@MBEHAAHPAD1AAPAD@Z */
3063 /* ?do_unshift@?$codecvt@GDH@std@@MEBAHAEAHPEAD1AEAPEAD@Z */
3064 /* ?do_unshift@?$codecvt@_WDH@std@@MBEHAAHPAD1AAPAD@Z */
3065 /* ?do_unshift@?$codecvt@_WDH@std@@MEBAHAEAHPEAD1AEAPEAD@Z */
3066 #define call_codecvt_wchar_do_unshift(this, state, to, to_end, to_next) CALL_VTBL_FUNC(this, 24, \
3067 int, (const codecvt_wchar*, int*, char*, char*, char**), (this, state, to, to_end, to_next))
3068 DEFINE_THISCALL_WRAPPER(codecvt_wchar_do_unshift, 20)
3069 int __thiscall codecvt_wchar_do_unshift(const codecvt_wchar *this,
3070 int *state, char *to, char *to_end, char **to_next)
3072 TRACE("(%p %p %p %p %p)\n", this, state, to, to_end, to_next);
3073 if(*state)
3074 WARN("unexpected state: %x\n", *state);
3076 *to_next = to;
3077 return CODECVT_ok;
3080 /* ?do_length@?$codecvt@GDH@std@@MBEHABHPBD1I@Z */
3081 /* ?do_length@?$codecvt@GDH@std@@MEBAHAEBHPEBD1_K@Z */
3082 /* ?do_length@?$codecvt@_WDH@std@@MBEHABHPBD1I@Z */
3083 /* ?do_length@?$codecvt@_WDH@std@@MEBAHAEBHPEBD1_K@Z */
3084 #define call_codecvt_wchar_do_length(this, state, from, from_end, max) CALL_VTBL_FUNC(this, 28, \
3085 int, (const codecvt_wchar*, const int*, const char*, const char*, MSVCP_size_t), \
3086 (this, state, from, from_end, max))
3087 DEFINE_THISCALL_WRAPPER(codecvt_wchar_do_length, 20)
3088 int __thiscall codecvt_wchar_do_length(const codecvt_wchar *this, const int *state,
3089 const char *from, const char *from_end, MSVCP_size_t max)
3091 int tmp_state = *state, ret=0;
3093 TRACE("(%p %p %p %p %ld)\n", this, state, from, from_end, max);
3095 while(ret<max && from!=from_end) {
3096 switch(_Mbrtowc(NULL, from, from_end-from, &tmp_state, &this->cvt)) {
3097 case -2:
3098 case -1:
3099 return ret;
3100 case 2:
3101 from++;
3102 /* fall through */
3103 case 0:
3104 case 1:
3105 from++;
3106 ret++;
3110 return ret;
3113 /* ?id@?$numpunct@D@std@@2V0locale@2@A */
3114 locale_id numpunct_char_id = {0};
3116 /* ??_7?$numpunct@D@std@@6B@ */
3117 extern const vtable_ptr MSVCP_numpunct_char_vtable;
3119 /* ?_Init@?$numpunct@D@std@@IAEXABV_Locinfo@2@_N@Z */
3120 /* ?_Init@?$numpunct@D@std@@IEAAXAEBV_Locinfo@2@_N@Z */
3121 static void numpunct_char__Init(numpunct_char *this, const _Locinfo *locinfo, MSVCP_bool isdef)
3123 int len;
3125 TRACE("(%p %p %d)\n", this, locinfo, isdef);
3127 len = strlen(_Locinfo__Getfalse(locinfo))+1;
3128 this->false_name = MSVCRT_operator_new(len);
3129 if(this->false_name)
3130 memcpy((char*)this->false_name, _Locinfo__Getfalse(locinfo), len);
3132 len = strlen(_Locinfo__Gettrue(locinfo))+1;
3133 this->true_name = MSVCRT_operator_new(len);
3134 if(this->true_name)
3135 memcpy((char*)this->true_name, _Locinfo__Gettrue(locinfo), len);
3137 if(isdef) {
3138 this->grouping = MSVCRT_operator_new(1);
3139 if(this->grouping)
3140 *(char*)this->grouping = 0;
3142 this->dp = '.';
3143 this->sep = ',';
3144 } else {
3145 const struct lconv *lc = _Locinfo__Getlconv(locinfo);
3147 len = strlen(lc->grouping)+1;
3148 this->grouping = MSVCRT_operator_new(len);
3149 if(this->grouping)
3150 memcpy((char*)this->grouping, lc->grouping, len);
3152 this->dp = lc->decimal_point[0];
3153 this->sep = lc->thousands_sep[0];
3156 if(!this->false_name || !this->true_name || !this->grouping) {
3157 MSVCRT_operator_delete((char*)this->grouping);
3158 MSVCRT_operator_delete((char*)this->false_name);
3159 MSVCRT_operator_delete((char*)this->true_name);
3161 ERR("Out of memory\n");
3162 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
3166 /* ?_Tidy@?$numpunct@D@std@@AAEXXZ */
3167 /* ?_Tidy@?$numpunct@D@std@@AEAAXXZ */
3168 static void numpunct_char__Tidy(numpunct_char *this)
3170 TRACE("(%p)\n", this);
3172 MSVCRT_operator_delete((char*)this->grouping);
3173 MSVCRT_operator_delete((char*)this->false_name);
3174 MSVCRT_operator_delete((char*)this->true_name);
3177 /* ??0?$numpunct@D@std@@QAE@ABV_Locinfo@1@I_N@Z */
3178 /* ??0?$numpunct@D@std@@QEAA@AEBV_Locinfo@1@_K_N@Z */
3179 static numpunct_char* numpunct_char_ctor_locinfo(numpunct_char *this,
3180 const _Locinfo *locinfo, MSVCP_size_t refs, MSVCP_bool usedef)
3182 TRACE("(%p %p %lu %d)\n", this, locinfo, refs, usedef);
3183 locale_facet_ctor_refs(&this->facet, refs);
3184 this->facet.vtable = &MSVCP_numpunct_char_vtable;
3185 numpunct_char__Init(this, locinfo, usedef);
3186 return this;
3189 /* ??0?$numpunct@D@std@@IAE@PBDI_N@Z */
3190 /* ??0?$numpunct@D@std@@IEAA@PEBD_K_N@Z */
3191 static numpunct_char* numpunct_char_ctor_name(numpunct_char *this,
3192 const char *name, MSVCP_size_t refs, MSVCP_bool usedef)
3194 _Locinfo locinfo;
3196 TRACE("(%p %s %lu %d)\n", this, debugstr_a(name), refs, usedef);
3197 locale_facet_ctor_refs(&this->facet, refs);
3198 this->facet.vtable = &MSVCP_numpunct_char_vtable;
3200 _Locinfo_ctor_cstr(&locinfo, name);
3201 numpunct_char__Init(this, &locinfo, usedef);
3202 _Locinfo_dtor(&locinfo);
3203 return this;
3206 /* ??0?$numpunct@D@std@@QAE@I@Z */
3207 /* ??0?$numpunct@D@std@@QEAA@_K@Z */
3208 DEFINE_THISCALL_WRAPPER(numpunct_char_ctor_refs, 8)
3209 numpunct_char* __thiscall numpunct_char_ctor_refs(numpunct_char *this, MSVCP_size_t refs)
3211 TRACE("(%p %lu)\n", this, refs);
3212 return numpunct_char_ctor_name(this, "C", refs, FALSE);
3215 /* ??_F?$numpunct@D@std@@QAEXXZ */
3216 /* ??_F?$numpunct@D@std@@QEAAXXZ */
3217 DEFINE_THISCALL_WRAPPER(numpunct_char_ctor, 4)
3218 numpunct_char* __thiscall numpunct_char_ctor(numpunct_char *this)
3220 return numpunct_char_ctor_refs(this, 0);
3223 /* ??1?$numpunct@D@std@@UAE@XZ */
3224 /* ??1?$numpunct@D@std@@UEAA@XZ */
3225 DEFINE_THISCALL_WRAPPER(numpunct_char_dtor, 4)
3226 void __thiscall numpunct_char_dtor(numpunct_char *this)
3228 TRACE("(%p)\n", this);
3229 numpunct_char__Tidy(this);
3232 DEFINE_THISCALL_WRAPPER(numpunct_char_vector_dtor, 8)
3233 numpunct_char* __thiscall numpunct_char_vector_dtor(numpunct_char *this, unsigned int flags)
3235 TRACE("(%p %x)\n", this, flags);
3236 if(flags & 2) {
3237 /* we have an array, with the number of elements stored before the first object */
3238 INT_PTR i, *ptr = (INT_PTR *)this-1;
3240 for(i=*ptr-1; i>=0; i--)
3241 numpunct_char_dtor(this+i);
3242 MSVCRT_operator_delete(ptr);
3243 } else {
3244 numpunct_char_dtor(this);
3245 if(flags & 1)
3246 MSVCRT_operator_delete(this);
3249 return this;
3252 /* ?_Getcat@?$numpunct@D@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
3253 /* ?_Getcat@?$numpunct@D@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
3254 static MSVCP_size_t numpunct_char__Getcat(const locale_facet **facet, const locale *loc)
3256 TRACE("(%p %p)\n", facet, loc);
3258 if(facet && !*facet) {
3259 *facet = MSVCRT_operator_new(sizeof(numpunct_char));
3260 if(!*facet) {
3261 ERR("Out of memory\n");
3262 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
3263 return 0;
3265 numpunct_char_ctor_name((numpunct_char*)*facet,
3266 basic_string_char_c_str(&loc->ptr->name), 0, TRUE);
3269 return LC_NUMERIC;
3272 static numpunct_char* numpunct_char_use_facet(const locale *loc)
3274 static numpunct_char *obj = NULL;
3276 _Lockit lock;
3277 const locale_facet *fac;
3279 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
3280 fac = locale__Getfacet(loc, locale_id_operator_size_t(&numpunct_char_id), TRUE);
3281 if(fac) {
3282 _Lockit_dtor(&lock);
3283 return (numpunct_char*)fac;
3286 if(obj) {
3287 _Lockit_dtor(&lock);
3288 return obj;
3291 numpunct_char__Getcat(&fac, loc);
3292 obj = (numpunct_char*)fac;
3293 locale_facet__Incref(&obj->facet);
3294 locale_facet_register(&obj->facet);
3295 _Lockit_dtor(&lock);
3297 return obj;
3300 /* ?do_decimal_point@?$numpunct@D@std@@MBEDXZ */
3301 /* ?do_decimal_point@?$numpunct@D@std@@MEBADXZ */
3302 DEFINE_THISCALL_WRAPPER(numpunct_char_do_decimal_point, 4)
3303 #define call_numpunct_char_do_decimal_point(this) CALL_VTBL_FUNC(this, 4, \
3304 char, (const numpunct_char *this), (this))
3305 char __thiscall numpunct_char_do_decimal_point(const numpunct_char *this)
3307 TRACE("(%p)\n", this);
3308 return this->dp;
3311 /* ?decimal_point@?$numpunct@D@std@@QBEDXZ */
3312 /* ?decimal_point@?$numpunct@D@std@@QEBADXZ */
3313 DEFINE_THISCALL_WRAPPER(numpunct_char_decimal_point, 4)
3314 char __thiscall numpunct_char_decimal_point(const numpunct_char *this)
3316 TRACE("(%p)\n", this);
3317 return call_numpunct_char_do_decimal_point(this);
3320 /* ?do_thousands_sep@?$numpunct@D@std@@MBEDXZ */
3321 /* ?do_thousands_sep@?$numpunct@D@std@@MEBADXZ */
3322 DEFINE_THISCALL_WRAPPER(numpunct_char_do_thousands_sep, 4)
3323 #define call_numpunct_char_do_thousands_sep(this) CALL_VTBL_FUNC(this, 8, \
3324 char, (const numpunct_char*), (this))
3325 char __thiscall numpunct_char_do_thousands_sep(const numpunct_char *this)
3327 TRACE("(%p)\n", this);
3328 return this->sep;
3331 /* ?thousands_sep@?$numpunct@D@std@@QBEDXZ */
3332 /* ?thousands_sep@?$numpunct@D@std@@QEBADXZ */
3333 DEFINE_THISCALL_WRAPPER(numpunct_char_thousands_sep, 4)
3334 char __thiscall numpunct_char_thousands_sep(const numpunct_char *this)
3336 TRACE("(%p)\n", this);
3337 return call_numpunct_char_do_thousands_sep(this);
3340 /* ?do_grouping@?$numpunct@D@std@@MBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3341 /* ?do_grouping@?$numpunct@D@std@@MEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3342 DEFINE_THISCALL_WRAPPER(numpunct_char_do_grouping, 8)
3343 #define call_numpunct_char_do_grouping(this, ret) CALL_VTBL_FUNC(this, 12, \
3344 basic_string_char*, (const numpunct_char*, basic_string_char*), (this, ret))
3345 basic_string_char* __thiscall numpunct_char_do_grouping(
3346 const numpunct_char *this, basic_string_char *ret)
3348 TRACE("(%p)\n", this);
3349 return basic_string_char_ctor_cstr(ret, this->grouping);
3352 /* ?grouping@?$numpunct@D@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3353 /* ?grouping@?$numpunct@D@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3354 DEFINE_THISCALL_WRAPPER(numpunct_char_grouping, 8)
3355 basic_string_char* __thiscall numpunct_char_grouping(const numpunct_char *this, basic_string_char *ret)
3357 TRACE("(%p)\n", this);
3358 return call_numpunct_char_do_grouping(this, ret);
3361 /* ?do_falsename@?$numpunct@D@std@@MBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3362 /* ?do_falsename@?$numpunct@D@std@@MEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3363 DEFINE_THISCALL_WRAPPER(numpunct_char_do_falsename, 8)
3364 #define call_numpunct_char_do_falsename(this, ret) CALL_VTBL_FUNC(this, 16, \
3365 basic_string_char*, (const numpunct_char*, basic_string_char*), (this, ret))
3366 basic_string_char* __thiscall numpunct_char_do_falsename(
3367 const numpunct_char *this, basic_string_char *ret)
3369 TRACE("(%p)\n", this);
3370 return basic_string_char_ctor_cstr(ret, this->false_name);
3373 /* ?falsename@?$numpunct@D@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3374 /* ?falsename@?$numpunct@D@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3375 DEFINE_THISCALL_WRAPPER(numpunct_char_falsename, 8)
3376 basic_string_char* __thiscall numpunct_char_falsename(const numpunct_char *this, basic_string_char *ret)
3378 TRACE("(%p)\n", this);
3379 return call_numpunct_char_do_falsename(this, ret);
3382 /* ?do_truename@?$numpunct@D@std@@MBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3383 /* ?do_truename@?$numpunct@D@std@@MEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3384 DEFINE_THISCALL_WRAPPER(numpunct_char_do_truename, 8)
3385 #define call_numpunct_char_do_truename(this, ret) CALL_VTBL_FUNC(this, 20, \
3386 basic_string_char*, (const numpunct_char*, basic_string_char*), (this, ret))
3387 basic_string_char* __thiscall numpunct_char_do_truename(
3388 const numpunct_char *this, basic_string_char *ret)
3390 TRACE("(%p)\n", this);
3391 return basic_string_char_ctor_cstr(ret, this->true_name);
3394 /* ?truename@?$numpunct@D@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3395 /* ?truename@?$numpunct@D@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3396 DEFINE_THISCALL_WRAPPER(numpunct_char_truename, 8)
3397 basic_string_char* __thiscall numpunct_char_truename(const numpunct_char *this, basic_string_char *ret)
3399 TRACE("(%p)\n", this);
3400 return call_numpunct_char_do_truename(this, ret);
3403 /* ?id@?$numpunct@_W@std@@2V0locale@2@A */
3404 static locale_id numpunct_wchar_id = {0};
3405 /* ?id@?$numpunct@G@std@@2V0locale@2@A */
3406 locale_id numpunct_short_id = {0};
3408 /* ??_7?$numpunct@_W@std@@6B@ */
3409 extern const vtable_ptr MSVCP_numpunct_wchar_vtable;
3410 /* ??_7?$numpunct@G@std@@6B@ */
3411 extern const vtable_ptr MSVCP_numpunct_short_vtable;
3413 /* ?_Init@?$numpunct@_W@std@@IAEXABV_Locinfo@2@_N@Z */
3414 /* ?_Init@?$numpunct@_W@std@@IEAAXAEBV_Locinfo@2@_N@Z */
3415 /* ?_Init@?$numpunct@G@std@@IAEXABV_Locinfo@2@_N@Z */
3416 /* ?_Init@?$numpunct@G@std@@IEAAXAEBV_Locinfo@2@_N@Z */
3417 static void numpunct_wchar__Init(numpunct_wchar *this,
3418 const _Locinfo *locinfo, MSVCP_bool isdef)
3420 const char *to_convert;
3421 _Cvtvec cvt;
3422 int len;
3424 TRACE("(%p %p %d)\n", this, locinfo, isdef);
3426 _Locinfo__Getcvt(locinfo, &cvt);
3428 to_convert = _Locinfo__Getfalse(locinfo);
3429 len = MultiByteToWideChar(cvt.page, 0, to_convert, -1, NULL, 0);
3430 this->false_name = MSVCRT_operator_new(len*sizeof(WCHAR));
3431 if(this->false_name)
3432 MultiByteToWideChar(cvt.page, 0, to_convert, -1,
3433 (wchar_t*)this->false_name, len);
3435 to_convert = _Locinfo__Gettrue(locinfo);
3436 len = MultiByteToWideChar(cvt.page, 0, to_convert, -1, NULL, 0);
3437 this->true_name = MSVCRT_operator_new(len*sizeof(WCHAR));
3438 if(this->true_name)
3439 MultiByteToWideChar(cvt.page, 0, to_convert, -1,
3440 (wchar_t*)this->true_name, len);
3442 if(isdef) {
3443 this->grouping = MSVCRT_operator_new(1);
3444 if(this->grouping)
3445 *(char*)this->grouping = 0;
3447 this->dp = '.';
3448 this->sep = ',';
3449 } else {
3450 const struct lconv *lc = _Locinfo__Getlconv(locinfo);
3452 len = strlen(lc->grouping)+1;
3453 this->grouping = MSVCRT_operator_new(len);
3454 if(this->grouping)
3455 memcpy((char*)this->grouping, lc->grouping, len);
3457 this->dp = lc->decimal_point[0];
3458 this->sep = lc->thousands_sep[0];
3461 if(!this->false_name || !this->true_name || !this->grouping) {
3462 MSVCRT_operator_delete((char*)this->grouping);
3463 MSVCRT_operator_delete((wchar_t*)this->false_name);
3464 MSVCRT_operator_delete((wchar_t*)this->true_name);
3466 ERR("Out of memory\n");
3467 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
3471 /* ?_Tidy@?$numpunct@_W@std@@AAEXXZ */
3472 /* ?_Tidy@?$numpunct@_W@std@@AEAAXXZ */
3473 /* ?_Tidy@?$numpunct@G@std@@AAEXXZ */
3474 /* ?_Tidy@?$numpunct@G@std@@AEAAXXZ */
3475 static void numpunct_wchar__Tidy(numpunct_wchar *this)
3477 TRACE("(%p)\n", this);
3479 MSVCRT_operator_delete((char*)this->grouping);
3480 MSVCRT_operator_delete((wchar_t*)this->false_name);
3481 MSVCRT_operator_delete((wchar_t*)this->true_name);
3484 /* ??0?$numpunct@_W@std@@QAE@ABV_Locinfo@1@I_N@Z */
3485 /* ??0?$numpunct@_W@std@@QEAA@AEBV_Locinfo@1@_K_N@Z */
3486 static numpunct_wchar* numpunct_wchar_ctor_locinfo(numpunct_wchar *this,
3487 const _Locinfo *locinfo, MSVCP_size_t refs, MSVCP_bool usedef)
3489 TRACE("(%p %p %lu %d)\n", this, locinfo, refs, usedef);
3490 locale_facet_ctor_refs(&this->facet, refs);
3491 this->facet.vtable = &MSVCP_numpunct_wchar_vtable;
3492 numpunct_wchar__Init(this, locinfo, usedef);
3493 return this;
3496 /* ??0?$numpunct@G@std@@QAE@ABV_Locinfo@1@I_N@Z */
3497 /* ??0?$numpunct@G@std@@QEAA@AEBV_Locinfo@1@_K_N@Z */
3498 static numpunct_wchar* numpunct_short_ctor_locinfo(numpunct_wchar *this,
3499 const _Locinfo *locinfo, MSVCP_size_t refs, MSVCP_bool usedef)
3501 numpunct_wchar_ctor_locinfo(this, locinfo, refs, usedef);
3502 this->facet.vtable = &MSVCP_numpunct_short_vtable;
3503 return this;
3506 /* ??0?$numpunct@_W@std@@IAE@PBDI_N@Z */
3507 /* ??0?$numpunct@_W@std@@IEAA@PEBD_K_N@Z */
3508 static numpunct_wchar* numpunct_wchar_ctor_name(numpunct_wchar *this,
3509 const char *name, MSVCP_size_t refs, MSVCP_bool usedef)
3511 _Locinfo locinfo;
3513 TRACE("(%p %s %lu %d)\n", this, debugstr_a(name), refs, usedef);
3514 locale_facet_ctor_refs(&this->facet, refs);
3515 this->facet.vtable = &MSVCP_numpunct_wchar_vtable;
3517 _Locinfo_ctor_cstr(&locinfo, name);
3518 numpunct_wchar__Init(this, &locinfo, usedef);
3519 _Locinfo_dtor(&locinfo);
3520 return this;
3523 /* ??0?$numpunct@G@std@@IAE@PBDI_N@Z */
3524 /* ??0?$numpunct@G@std@@IEAA@PEBD_K_N@Z */
3525 static numpunct_wchar* numpunct_short_ctor_name(numpunct_wchar *this,
3526 const char *name, MSVCP_size_t refs, MSVCP_bool usedef)
3528 numpunct_wchar_ctor_name(this, name, refs, usedef);
3529 this->facet.vtable = &MSVCP_numpunct_short_vtable;
3530 return this;
3533 /* ??0?$numpunct@_W@std@@QAE@I@Z */
3534 /* ??0?$numpunct@_W@std@@QEAA@_K@Z */
3535 static numpunct_wchar* numpunct_wchar_ctor_refs(numpunct_wchar *this, MSVCP_size_t refs)
3537 TRACE("(%p %lu)\n", this, refs);
3538 return numpunct_wchar_ctor_name(this, "C", refs, FALSE);
3541 /* ??0?$numpunct@G@std@@QAE@I@Z */
3542 /* ??0?$numpunct@G@std@@QEAA@_K@Z */
3543 DEFINE_THISCALL_WRAPPER(numpunct_short_ctor_refs, 8)
3544 numpunct_wchar* __thiscall numpunct_short_ctor_refs(numpunct_wchar *this, MSVCP_size_t refs)
3546 numpunct_wchar_ctor_refs(this, refs);
3547 this->facet.vtable = &MSVCP_numpunct_short_vtable;
3548 return this;
3551 /* ??_F?$numpunct@G@std@@QAEXXZ */
3552 /* ??_F?$numpunct@G@std@@QEAAXXZ */
3553 DEFINE_THISCALL_WRAPPER(numpunct_short_ctor, 4)
3554 numpunct_wchar* __thiscall numpunct_short_ctor(numpunct_wchar *this)
3556 return numpunct_short_ctor_refs(this, 0);
3559 /* ??1?$numpunct@G@std@@UAE@XZ */
3560 /* ??1?$numpunct@G@std@@UEAA@XZ */
3561 DEFINE_THISCALL_WRAPPER(numpunct_wchar_dtor, 4)
3562 void __thiscall numpunct_wchar_dtor(numpunct_wchar *this)
3564 TRACE("(%p)\n", this);
3565 numpunct_wchar__Tidy(this);
3568 DEFINE_THISCALL_WRAPPER(numpunct_wchar_vector_dtor, 8)
3569 numpunct_wchar* __thiscall numpunct_wchar_vector_dtor(numpunct_wchar *this, unsigned int flags)
3571 TRACE("(%p %x)\n", this, flags);
3572 if(flags & 2) {
3573 /* we have an array, with the number of elements stored before the first object */
3574 INT_PTR i, *ptr = (INT_PTR *)this-1;
3576 for(i=*ptr-1; i>=0; i--)
3577 numpunct_wchar_dtor(this+i);
3578 MSVCRT_operator_delete(ptr);
3579 } else {
3580 numpunct_wchar_dtor(this);
3581 if(flags & 1)
3582 MSVCRT_operator_delete(this);
3585 return this;
3588 /* ?_Getcat@?$numpunct@_W@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
3589 /* ?_Getcat@?$numpunct@_W@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
3590 static MSVCP_size_t numpunct_wchar__Getcat(const locale_facet **facet, const locale *loc)
3592 TRACE("(%p %p)\n", facet, loc);
3594 if(facet && !*facet) {
3595 *facet = MSVCRT_operator_new(sizeof(numpunct_wchar));
3596 if(!*facet) {
3597 ERR("Out of memory\n");
3598 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
3599 return 0;
3601 numpunct_wchar_ctor_name((numpunct_wchar*)*facet,
3602 basic_string_char_c_str(&loc->ptr->name), 0, TRUE);
3605 return LC_NUMERIC;
3608 static numpunct_wchar* numpunct_wchar_use_facet(const locale *loc)
3610 static numpunct_wchar *obj = NULL;
3612 _Lockit lock;
3613 const locale_facet *fac;
3615 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
3616 fac = locale__Getfacet(loc, locale_id_operator_size_t(&numpunct_wchar_id), TRUE);
3617 if(fac) {
3618 _Lockit_dtor(&lock);
3619 return (numpunct_wchar*)fac;
3622 if(obj) {
3623 _Lockit_dtor(&lock);
3624 return obj;
3627 numpunct_wchar__Getcat(&fac, loc);
3628 obj = (numpunct_wchar*)fac;
3629 locale_facet__Incref(&obj->facet);
3630 locale_facet_register(&obj->facet);
3631 _Lockit_dtor(&lock);
3633 return obj;
3636 /* ?_Getcat@?$numpunct@G@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
3637 /* ?_Getcat@?$numpunct@G@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
3638 static MSVCP_size_t numpunct_short__Getcat(const locale_facet **facet, const locale *loc)
3640 TRACE("(%p %p)\n", facet, loc);
3642 if(facet && !*facet) {
3643 *facet = MSVCRT_operator_new(sizeof(numpunct_wchar));
3644 if(!*facet) {
3645 ERR("Out of memory\n");
3646 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
3647 return 0;
3649 numpunct_short_ctor_name((numpunct_wchar*)*facet,
3650 basic_string_char_c_str(&loc->ptr->name), 0, TRUE);
3653 return LC_NUMERIC;
3656 static numpunct_wchar* numpunct_short_use_facet(const locale *loc)
3658 static numpunct_wchar *obj = NULL;
3660 _Lockit lock;
3661 const locale_facet *fac;
3663 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
3664 fac = locale__Getfacet(loc, locale_id_operator_size_t(&numpunct_short_id), TRUE);
3665 if(fac) {
3666 _Lockit_dtor(&lock);
3667 return (numpunct_wchar*)fac;
3670 if(obj) {
3671 _Lockit_dtor(&lock);
3672 return obj;
3675 numpunct_short__Getcat(&fac, loc);
3676 obj = (numpunct_wchar*)fac;
3677 locale_facet__Incref(&obj->facet);
3678 locale_facet_register(&obj->facet);
3679 _Lockit_dtor(&lock);
3681 return obj;
3684 /* ?do_decimal_point@?$numpunct@_W@std@@MBE_WXZ */
3685 /* ?do_decimal_point@?$numpunct@_W@std@@MEBA_WXZ */
3686 /* ?do_decimal_point@?$numpunct@G@std@@MBEGXZ */
3687 /* ?do_decimal_point@?$numpunct@G@std@@MEBAGXZ */
3688 DEFINE_THISCALL_WRAPPER(numpunct_wchar_do_decimal_point, 4)
3689 #define call_numpunct_wchar_do_decimal_point(this) CALL_VTBL_FUNC(this, 4, \
3690 wchar_t, (const numpunct_wchar *this), (this))
3691 wchar_t __thiscall numpunct_wchar_do_decimal_point(const numpunct_wchar *this)
3693 TRACE("(%p)\n", this);
3694 return this->dp;
3697 /* ?decimal_point@?$numpunct@_W@std@@QBE_WXZ */
3698 /* ?decimal_point@?$numpunct@_W@std@@QEBA_WXZ */
3699 /* ?decimal_point@?$numpunct@G@std@@QBEGXZ */
3700 /* ?decimal_point@?$numpunct@G@std@@QEBAGXZ */
3701 DEFINE_THISCALL_WRAPPER(numpunct_wchar_decimal_point, 4)
3702 wchar_t __thiscall numpunct_wchar_decimal_point(const numpunct_wchar *this)
3704 TRACE("(%p)\n", this);
3705 return call_numpunct_wchar_do_decimal_point(this);
3708 /* ?do_thousands_sep@?$numpunct@_W@std@@MBE_WXZ */
3709 /* ?do_thousands_sep@?$numpunct@_W@std@@MEBA_WXZ */
3710 /* ?do_thousands_sep@?$numpunct@G@std@@MBEGXZ */
3711 /* ?do_thousands_sep@?$numpunct@G@std@@MEBAGXZ */
3712 DEFINE_THISCALL_WRAPPER(numpunct_wchar_do_thousands_sep, 4)
3713 #define call_numpunct_wchar_do_thousands_sep(this) CALL_VTBL_FUNC(this, 8, \
3714 wchar_t, (const numpunct_wchar *this), (this))
3715 wchar_t __thiscall numpunct_wchar_do_thousands_sep(const numpunct_wchar *this)
3717 TRACE("(%p)\n", this);
3718 return this->sep;
3721 /* ?thousands_sep@?$numpunct@_W@std@@QBE_WXZ */
3722 /* ?thousands_sep@?$numpunct@_W@std@@QEBA_WXZ */
3723 /* ?thousands_sep@?$numpunct@G@std@@QBEGXZ */
3724 /* ?thousands_sep@?$numpunct@G@std@@QEBAGXZ */
3725 DEFINE_THISCALL_WRAPPER(numpunct_wchar_thousands_sep, 4)
3726 wchar_t __thiscall numpunct_wchar_thousands_sep(const numpunct_wchar *this)
3728 TRACE("(%p)\n", this);
3729 return call_numpunct_wchar_do_thousands_sep(this);
3732 /* ?do_grouping@?$numpunct@_W@std@@MBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3733 /* ?do_grouping@?$numpunct@_W@std@@MEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3734 /* ?do_grouping@?$numpunct@G@std@@MBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3735 /* ?do_grouping@?$numpunct@G@std@@MEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3736 DEFINE_THISCALL_WRAPPER(numpunct_wchar_do_grouping, 8)
3737 #define call_numpunct_wchar_do_grouping(this, ret) CALL_VTBL_FUNC(this, 12, \
3738 basic_string_char*, (const numpunct_wchar*, basic_string_char*), (this, ret))
3739 basic_string_char* __thiscall numpunct_wchar_do_grouping(const numpunct_wchar *this, basic_string_char *ret)
3741 TRACE("(%p)\n", this);
3742 return basic_string_char_ctor_cstr(ret, this->grouping);
3745 /* ?grouping@?$numpunct@_W@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3746 /* ?grouping@?$numpunct@_W@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3747 /* ?grouping@?$numpunct@G@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3748 /* ?grouping@?$numpunct@G@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3749 DEFINE_THISCALL_WRAPPER(numpunct_wchar_grouping, 8)
3750 basic_string_char* __thiscall numpunct_wchar_grouping(const numpunct_wchar *this, basic_string_char *ret)
3752 TRACE("(%p)\n", this);
3753 return call_numpunct_wchar_do_grouping(this, ret);
3756 /* ?do_falsename@?$numpunct@_W@std@@MBE?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
3757 /* ?do_falsename@?$numpunct@_W@std@@MEBA?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
3758 /* ?do_falsename@?$numpunct@G@std@@MBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
3759 /* ?do_falsename@?$numpunct@G@std@@MEBA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
3760 DEFINE_THISCALL_WRAPPER(numpunct_wchar_do_falsename, 8)
3761 #define call_numpunct_wchar_do_falsename(this, ret) CALL_VTBL_FUNC(this, 16, \
3762 basic_string_wchar*, (const numpunct_wchar*, basic_string_wchar*), (this, ret))
3763 basic_string_wchar* __thiscall numpunct_wchar_do_falsename(const numpunct_wchar *this, basic_string_wchar *ret)
3765 TRACE("(%p)\n", this);
3766 return basic_string_wchar_ctor_cstr(ret, this->false_name);
3769 /* ?falsename@?$numpunct@_W@std@@QBE?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
3770 /* ?falsename@?$numpunct@_W@std@@QEBA?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
3771 /* ?falsename@?$numpunct@G@std@@QBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
3772 /* ?falsename@?$numpunct@G@std@@QEBA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
3773 DEFINE_THISCALL_WRAPPER(numpunct_wchar_falsename, 8)
3774 basic_string_wchar* __thiscall numpunct_wchar_falsename(const numpunct_wchar *this, basic_string_wchar *ret)
3776 TRACE("(%p)\n", this);
3777 return call_numpunct_wchar_do_falsename(this, ret);
3780 /* ?do_truename@?$numpunct@_W@std@@MBE?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
3781 /* ?do_truename@?$numpunct@_W@std@@MEBA?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
3782 /* ?do_truename@?$numpunct@G@std@@MBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
3783 /* ?do_truename@?$numpunct@G@std@@MEBA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
3784 DEFINE_THISCALL_WRAPPER(numpunct_wchar_do_truename, 8)
3785 #define call_numpunct_wchar_do_truename(this, ret) CALL_VTBL_FUNC(this, 20, \
3786 basic_string_wchar*, (const numpunct_wchar*, basic_string_wchar*), (this, ret))
3787 basic_string_wchar* __thiscall numpunct_wchar_do_truename(const numpunct_wchar *this, basic_string_wchar *ret)
3789 TRACE("(%p)\n", this);
3790 return basic_string_wchar_ctor_cstr(ret, this->true_name);
3793 /* ?truename@?$numpunct@_W@std@@QBE?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
3794 /* ?truename@?$numpunct@_W@std@@QEBA?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
3795 /* ?truename@?$numpunct@G@std@@QBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
3796 /* ?truename@?$numpunct@G@std@@QEBA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
3797 DEFINE_THISCALL_WRAPPER(numpunct_wchar_truename, 8)
3798 basic_string_wchar* __thiscall numpunct_wchar_truename(const numpunct_wchar *this, basic_string_wchar *ret)
3800 TRACE("(%p)\n", this);
3801 return call_numpunct_wchar_do_truename(this, ret);
3804 double __cdecl _Stod(const char *buf, char **buf_end, LONG exp)
3806 double ret = strtod(buf, buf_end);
3808 if(exp)
3809 ret *= pow(10, exp);
3810 return ret;
3813 static double _Stodx(const char *buf, char **buf_end, LONG exp, int *err)
3815 double ret;
3817 *err = *_errno();
3818 *_errno() = 0;
3819 ret = _Stod(buf, buf_end, exp);
3820 if(*_errno()) {
3821 *err = *_errno();
3822 }else {
3823 *_errno() = *err;
3824 *err = 0;
3826 return ret;
3829 float __cdecl _Stof(const char *buf, char **buf_end, LONG exp)
3831 return _Stod(buf, buf_end, exp);
3834 static float _Stofx(const char *buf, char **buf_end, LONG exp, int *err)
3836 return _Stodx(buf, buf_end, exp, err);
3839 static __int64 _Stollx(const char *buf, char **buf_end, int base, int *err)
3841 __int64 ret;
3843 *err = *_errno();
3844 *_errno() = 0;
3845 ret = _strtoi64(buf, buf_end, base);
3846 if(*_errno()) {
3847 *err = *_errno();
3848 }else {
3849 *_errno() = *err;
3850 *err = 0;
3852 return ret;
3855 static LONG _Stolx(const char *buf, char **buf_end, int base, int *err)
3857 __int64 i = _Stollx(buf, buf_end, base, err);
3858 if(!*err && i!=(__int64)((LONG)i))
3859 *err = ERANGE;
3860 return i;
3863 static unsigned __int64 _Stoullx(const char *buf, char **buf_end, int base, int *err)
3865 unsigned __int64 ret;
3867 *err = *_errno();
3868 *_errno() = 0;
3869 ret = _strtoui64(buf, buf_end, base);
3870 if(*_errno()) {
3871 *err = *_errno();
3872 }else {
3873 *_errno() = *err;
3874 *err = 0;
3876 return ret;
3879 static ULONG _Stoulx(const char *buf, char **buf_end, int base, int *err)
3881 unsigned __int64 i = _Stoullx(buf[0]=='-' ? buf+1 : buf, buf_end, base, err);
3882 if(!*err && i!=(unsigned __int64)((ULONG)i))
3883 *err = ERANGE;
3884 return buf[0]=='-' ? -i : i;
3887 /* ?id@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@2V0locale@2@A */
3888 static locale_id num_get_wchar_id = {0};
3889 /* ?id@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@2V0locale@2@A */
3890 locale_id num_get_short_id = {0};
3892 /* ??_7?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@6B@ */
3893 extern const vtable_ptr MSVCP_num_get_wchar_vtable;
3894 /* ??_7?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@6B@ */
3895 extern const vtable_ptr MSVCP_num_get_short_vtable;
3897 /* ?_Init@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@IAEXABV_Locinfo@2@@Z */
3898 /* ?_Init@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@IEAAXAEBV_Locinfo@2@@Z */
3899 /* ?_Init@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@IAEXABV_Locinfo@2@@Z */
3900 /* ?_Init@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@IEAAXAEBV_Locinfo@2@@Z */
3901 DEFINE_THISCALL_WRAPPER(num_get_wchar__Init, 8)
3902 void __thiscall num_get_wchar__Init(num_get *this, const _Locinfo *locinfo)
3904 TRACE("(%p %p)\n", this, locinfo);
3905 _Locinfo__Getcvt(locinfo, &this->cvt);
3908 /* ??0?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
3909 /* ??0?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
3910 static num_get* num_get_wchar_ctor_locinfo(num_get *this,
3911 const _Locinfo *locinfo, MSVCP_size_t refs)
3913 TRACE("(%p %p %lu)\n", this, locinfo, refs);
3915 locale_facet_ctor_refs(&this->facet, refs);
3916 this->facet.vtable = &MSVCP_num_get_wchar_vtable;
3918 num_get_wchar__Init(this, locinfo);
3919 return this;
3922 /* ??0?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
3923 /* ??0?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
3924 DEFINE_THISCALL_WRAPPER(num_get_short_ctor_locinfo, 12)
3925 num_get* __thiscall num_get_short_ctor_locinfo(num_get *this,
3926 const _Locinfo *locinfo, MSVCP_size_t refs)
3928 num_get_wchar_ctor_locinfo(this, locinfo, refs);
3929 this->facet.vtable = &MSVCP_num_get_short_vtable;
3930 return this;
3933 /* ??0?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAE@I@Z */
3934 /* ??0?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAA@_K@Z */
3935 static num_get* num_get_wchar_ctor_refs(num_get *this, MSVCP_size_t refs)
3937 _Locinfo locinfo;
3939 TRACE("(%p %lu)\n", this, refs);
3941 _Locinfo_ctor(&locinfo);
3942 num_get_wchar_ctor_locinfo(this, &locinfo, refs);
3943 _Locinfo_dtor(&locinfo);
3944 return this;
3947 /* ??0?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAE@I@Z */
3948 /* ??0?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEAA@_K@Z */
3949 DEFINE_THISCALL_WRAPPER(num_get_short_ctor_refs, 8)
3950 num_get* __thiscall num_get_short_ctor_refs(num_get *this, MSVCP_size_t refs)
3952 num_get_wchar_ctor_refs(this, refs);
3953 this->facet.vtable = &MSVCP_num_get_short_vtable;
3954 return this;
3957 /* ??_F?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAEXXZ */
3958 /* ??_F?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAAXXZ */
3959 DEFINE_THISCALL_WRAPPER(num_get_short_ctor, 4)
3960 num_get* __thiscall num_get_short_ctor(num_get *this)
3962 return num_get_short_ctor_refs(this, 0);
3965 /* ??1?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@UAE@XZ */
3966 /* ??1?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@UEAA@XZ */
3967 DEFINE_THISCALL_WRAPPER(num_get_wchar_dtor, 4)
3968 void __thiscall num_get_wchar_dtor(num_get *this)
3970 TRACE("(%p)\n", this);
3971 locale_facet_dtor(&this->facet);
3974 DEFINE_THISCALL_WRAPPER(num_get_wchar_vector_dtor, 8)
3975 num_get* __thiscall num_get_wchar_vector_dtor(num_get *this, unsigned int flags)
3977 TRACE("(%p %x)\n", this, flags);
3978 if(flags & 2) {
3979 /* we have an array, with the number of elements stored before the first object */
3980 INT_PTR i, *ptr = (INT_PTR *)this-1;
3982 for(i=*ptr-1; i>=0; i--)
3983 num_get_wchar_dtor(this+i);
3984 MSVCRT_operator_delete(ptr);
3985 } else {
3986 num_get_wchar_dtor(this);
3987 if(flags & 1)
3988 MSVCRT_operator_delete(this);
3991 return this;
3994 /* ?_Getcat@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
3995 /* ?_Getcat@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
3996 static MSVCP_size_t num_get_wchar__Getcat(const locale_facet **facet, const locale *loc)
3998 TRACE("(%p %p)\n", facet, loc);
4000 if(facet && !*facet) {
4001 _Locinfo locinfo;
4003 *facet = MSVCRT_operator_new(sizeof(num_get));
4004 if(!*facet) {
4005 ERR("Out of memory\n");
4006 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
4007 return 0;
4010 _Locinfo_ctor_cstr(&locinfo, basic_string_char_c_str(&loc->ptr->name));
4011 num_get_wchar_ctor_locinfo((num_get*)*facet, &locinfo, 0);
4012 _Locinfo_dtor(&locinfo);
4015 return LC_NUMERIC;
4018 static num_get* num_get_wchar_use_facet(const locale *loc)
4020 static num_get *obj = NULL;
4022 _Lockit lock;
4023 const locale_facet *fac;
4025 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
4026 fac = locale__Getfacet(loc, locale_id_operator_size_t(&num_get_wchar_id), TRUE);
4027 if(fac) {
4028 _Lockit_dtor(&lock);
4029 return (num_get*)fac;
4032 if(obj) {
4033 _Lockit_dtor(&lock);
4034 return obj;
4037 num_get_wchar__Getcat(&fac, loc);
4038 obj = (num_get*)fac;
4039 locale_facet__Incref(&obj->facet);
4040 locale_facet_register(&obj->facet);
4041 _Lockit_dtor(&lock);
4043 return obj;
4046 /* ?_Getcat@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
4047 /* ?_Getcat@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
4048 static MSVCP_size_t num_get_short__Getcat(const locale_facet **facet, const locale *loc)
4050 if(facet && !*facet) {
4051 num_get_wchar__Getcat(facet, loc);
4052 (*(locale_facet**)facet)->vtable = &MSVCP_num_get_short_vtable;
4055 return LC_NUMERIC;
4058 num_get* num_get_short_use_facet(const locale *loc)
4060 static num_get *obj = NULL;
4062 _Lockit lock;
4063 const locale_facet *fac;
4065 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
4066 fac = locale__Getfacet(loc, locale_id_operator_size_t(&num_get_short_id), TRUE);
4067 if(fac) {
4068 _Lockit_dtor(&lock);
4069 return (num_get*)fac;
4072 if(obj) {
4073 _Lockit_dtor(&lock);
4074 return obj;
4077 num_get_short__Getcat(&fac, loc);
4078 obj = (num_get*)fac;
4079 locale_facet__Incref(&obj->facet);
4080 locale_facet_register(&obj->facet);
4081 _Lockit_dtor(&lock);
4083 return obj;
4086 static inline wchar_t mb_to_wc(char ch, const _Cvtvec *cvt)
4088 int state = 0;
4089 wchar_t ret;
4091 return _Mbrtowc(&ret, &ch, 1, &state, cvt) == 1 ? ret : 0;
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) || (*c=='#' && pat+1==pat_end)) {
7593 ostreambuf_iterator_wchar_put(&dest, percent);
7594 ostreambuf_iterator_wchar_put(&dest, *pat++);
7595 }else {
7596 if(*c == '#') {
7597 if(!_Wcrtomb(c, *pat++, NULL, &this->cvt)) {
7598 ostreambuf_iterator_wchar_put(&dest, percent);
7599 ostreambuf_iterator_wchar_put(&dest, *(pat-1));
7600 ostreambuf_iterator_wchar_put(&dest, *pat);
7601 }else {
7602 time_put_wchar_put(this, &dest, dest, base, t, *c, '#');
7604 }else {
7605 time_put_wchar_put(this, &dest, dest, base, t, *c, 0);
7610 *ret = dest;
7611 return ret;
7614 /* ??0_Locimp@locale@std@@AAE@_N@Z */
7615 /* ??0_Locimp@locale@std@@AEAA@_N@Z */
7616 static locale__Locimp* locale__Locimp_ctor_transparent(locale__Locimp *this, MSVCP_bool transparent)
7618 TRACE("(%p %d)\n", this, transparent);
7620 memset(this, 0, sizeof(locale__Locimp));
7621 locale_facet_ctor_refs(&this->facet, 1);
7622 this->transparent = transparent;
7623 basic_string_char_ctor_cstr(&this->name, "*");
7624 return this;
7627 /* ??_F_Locimp@locale@std@@QAEXXZ */
7628 /* ??_F_Locimp@locale@std@@QEAAXXZ */
7629 static locale__Locimp* locale__Locimp_ctor(locale__Locimp *this)
7631 return locale__Locimp_ctor_transparent(this, FALSE);
7634 /* ??0_Locimp@locale@std@@AAE@ABV012@@Z */
7635 /* ??0_Locimp@locale@std@@AEAA@AEBV012@@Z */
7636 static locale__Locimp* locale__Locimp_copy_ctor(locale__Locimp *this, const locale__Locimp *copy)
7638 _Lockit lock;
7639 MSVCP_size_t i;
7641 TRACE("(%p %p)\n", this, copy);
7643 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
7644 memcpy(this, copy, sizeof(locale__Locimp));
7645 locale_facet_ctor_refs(&this->facet, 1);
7646 if(copy->facetvec) {
7647 this->facetvec = MSVCRT_operator_new(copy->facet_cnt*sizeof(locale_facet*));
7648 if(!this->facetvec) {
7649 _Lockit_dtor(&lock);
7650 ERR("Out of memory\n");
7651 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7652 return NULL;
7654 for(i=0; i<this->facet_cnt; i++)
7656 this->facetvec[i] = copy->facetvec[i];
7657 if(this->facetvec[i])
7658 locale_facet__Incref(this->facetvec[i]);
7661 basic_string_char_copy_ctor(&this->name, &copy->name);
7662 _Lockit_dtor(&lock);
7663 return this;
7666 /* ??1_Locimp@locale@std@@MAE@XZ */
7667 /* ??1_Locimp@locale@std@@MEAA@XZ */
7668 static void locale__Locimp_dtor(locale__Locimp *this)
7670 MSVCP_size_t i;
7672 TRACE("(%p)\n", this);
7674 locale_facet_dtor(&this->facet);
7675 for(i=0; i<this->facet_cnt; i++)
7676 if(this->facetvec[i] && locale_facet__Decref(this->facetvec[i]))
7677 call_locale_facet_vector_dtor(this->facetvec[i], 1);
7679 MSVCRT_operator_delete(this->facetvec);
7680 basic_string_char_dtor(&this->name);
7683 DEFINE_THISCALL_WRAPPER(locale__Locimp_vector_dtor, 8)
7684 locale__Locimp* __thiscall locale__Locimp_vector_dtor(locale__Locimp *this, unsigned int flags)
7686 TRACE("(%p %x)\n", this, flags);
7687 if(flags & 2) {
7688 /* we have an array, with the number of elements stored before the first object */
7689 INT_PTR i, *ptr = (INT_PTR *)this-1;
7691 for(i=*ptr-1; i>=0; i--)
7692 locale__Locimp_dtor(this+i);
7693 MSVCRT_operator_delete(ptr);
7694 } else {
7695 locale__Locimp_dtor(this);
7696 if(flags & 1)
7697 MSVCRT_operator_delete(this);
7700 return this;
7703 /* ?_Locimp_Addfac@_Locimp@locale@std@@CAXPAV123@PAVfacet@23@I@Z */
7704 /* ?_Locimp_Addfac@_Locimp@locale@std@@CAXPEAV123@PEAVfacet@23@_K@Z */
7705 static void locale__Locimp__Locimp_Addfac(locale__Locimp *locimp, locale_facet *facet, MSVCP_size_t id)
7707 _Lockit lock;
7709 TRACE("(%p %p %lu)\n", locimp, facet, id);
7711 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
7712 if(id >= locimp->facet_cnt) {
7713 MSVCP_size_t new_size = id+1;
7714 locale_facet **new_facetvec;
7716 if(new_size < locale_id__Id_cnt+1)
7717 new_size = locale_id__Id_cnt+1;
7719 new_facetvec = MSVCRT_operator_new(sizeof(locale_facet*)*new_size);
7720 if(!new_facetvec) {
7721 _Lockit_dtor(&lock);
7722 ERR("Out of memory\n");
7723 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7724 return;
7727 memset(new_facetvec, 0, sizeof(locale_facet*)*new_size);
7728 memcpy(new_facetvec, locimp->facetvec, sizeof(locale_facet*)*locimp->facet_cnt);
7729 MSVCRT_operator_delete(locimp->facetvec);
7730 locimp->facetvec = new_facetvec;
7731 locimp->facet_cnt = new_size;
7734 if(locimp->facetvec[id] && locale_facet__Decref(locimp->facetvec[id]))
7735 call_locale_facet_vector_dtor(locimp->facetvec[id], 1);
7737 locimp->facetvec[id] = facet;
7738 if(facet)
7739 locale_facet__Incref(facet);
7740 _Lockit_dtor(&lock);
7743 /* ?_Addfac@_Locimp@locale@std@@AAEXPAVfacet@23@I@Z */
7744 /* ?_Addfac@_Locimp@locale@std@@AEAAXPEAVfacet@23@_K@Z */
7745 static void locale__Locimp__Addfac(locale__Locimp *this, locale_facet *facet, MSVCP_size_t id)
7747 locale__Locimp__Locimp_Addfac(this, facet, id);
7750 /* ?_Makeushloc@_Locimp@locale@std@@CAXABV_Locinfo@3@HPAV123@PBV23@@Z */
7751 /* ?_Makeushloc@_Locimp@locale@std@@CAXAEBV_Locinfo@3@HPEAV123@PEBV23@@Z */
7752 /* List of missing facets:
7753 * messages, money_get, money_put, moneypunct, moneypunct, time_get
7755 static void locale__Locimp__Makeushloc(const _Locinfo *locinfo, category cat, locale__Locimp *locimp, const locale *loc)
7757 FIXME("(%p %d %p %p) semi-stub\n", locinfo, cat, locimp, loc);
7759 if(cat & (1<<(ctype_short__Getcat(NULL, NULL)-1))) {
7760 ctype_wchar *ctype;
7762 if(loc) {
7763 ctype = ctype_short_use_facet(loc);
7764 }else {
7765 ctype = MSVCRT_operator_new(sizeof(ctype_wchar));
7766 if(!ctype) {
7767 ERR("Out of memory\n");
7768 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7770 ctype_short_ctor_locinfo(ctype, locinfo, 0);
7772 locale__Locimp__Addfac(locimp, &ctype->base.facet, locale_id_operator_size_t(&ctype_short_id));
7775 if(cat & (1<<(num_get_short__Getcat(NULL, NULL)-1))) {
7776 num_get *numget;
7778 if(loc) {
7779 numget = num_get_short_use_facet(loc);
7780 }else {
7781 numget = MSVCRT_operator_new(sizeof(num_get));
7782 if(!numget) {
7783 ERR("Out of memory\n");
7784 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7786 num_get_short_ctor_locinfo(numget, locinfo, 0);
7788 locale__Locimp__Addfac(locimp, &numget->facet, locale_id_operator_size_t(&num_get_short_id));
7791 if(cat & (1<<(num_put_short__Getcat(NULL, NULL)-1))) {
7792 num_put *numput;
7794 if(loc) {
7795 numput = num_put_short_use_facet(loc);
7796 }else {
7797 numput = MSVCRT_operator_new(sizeof(num_put));
7798 if(!numput) {
7799 ERR("Out of memory\n");
7800 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7802 num_put_short_ctor_locinfo(numput, locinfo, 0);
7804 locale__Locimp__Addfac(locimp, &numput->facet, locale_id_operator_size_t(&num_put_short_id));
7807 if(cat & (1<<(numpunct_short__Getcat(NULL, NULL)-1))) {
7808 numpunct_wchar *numpunct;
7810 if(loc) {
7811 numpunct = numpunct_short_use_facet(loc);
7812 }else {
7813 numpunct = MSVCRT_operator_new(sizeof(numpunct_wchar));
7814 if(!numpunct) {
7815 ERR("Out of memory\n");
7816 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7818 numpunct_short_ctor_locinfo(numpunct, locinfo, 0, FALSE);
7820 locale__Locimp__Addfac(locimp, &numpunct->facet, locale_id_operator_size_t(&numpunct_short_id));
7823 if(cat & (1<<(collate_short__Getcat(NULL, NULL)-1))) {
7824 collate *c;
7826 if(loc) {
7827 c = collate_short_use_facet(loc);
7828 }else {
7829 c = MSVCRT_operator_new(sizeof(collate));
7830 if(!c) {
7831 ERR("Out of memory\n");
7832 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7834 collate_short_ctor_locinfo(c, locinfo, 0);
7836 locale__Locimp__Addfac(locimp, &c->facet, locale_id_operator_size_t(&collate_short_id));
7839 if(cat & (1<<(time_put_short__Getcat(NULL, NULL)-1))) {
7840 time_put *t;
7842 if(loc) {
7843 t = time_put_short_use_facet(loc);
7844 }else {
7845 t = MSVCRT_operator_new(sizeof(time_put));
7846 if(!t) {
7847 ERR("Out of memory\n");
7848 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7850 time_put_short_ctor_locinfo(t, locinfo, 0);
7852 locale__Locimp__Addfac(locimp, &t->facet, locale_id_operator_size_t(&time_put_short_id));
7855 if(cat & (1<<(codecvt_short__Getcat(NULL, NULL)-1))) {
7856 codecvt_wchar *codecvt;
7858 if(loc) {
7859 codecvt = codecvt_short_use_facet(loc);
7860 }else {
7861 codecvt = MSVCRT_operator_new(sizeof(codecvt_wchar));
7862 if(!codecvt) {
7863 ERR("Out of memory\n");
7864 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7866 codecvt_short_ctor_locinfo(codecvt, locinfo, 0);
7868 locale__Locimp__Addfac(locimp, &codecvt->base.facet, locale_id_operator_size_t(&codecvt_short_id));
7872 /* ?_Makewloc@_Locimp@locale@std@@CAXABV_Locinfo@3@HPAV123@PBV23@@Z */
7873 /* ?_Makewloc@_Locimp@locale@std@@CAXAEBV_Locinfo@3@HPEAV123@PEBV23@@Z */
7874 /* List of missing facets:
7875 * messages, money_get, money_put, moneypunct, moneypunct, time_get
7877 static void locale__Locimp__Makewloc(const _Locinfo *locinfo, category cat, locale__Locimp *locimp, const locale *loc)
7879 FIXME("(%p %d %p %p) semi-stub\n", locinfo, cat, locimp, loc);
7881 if(cat & (1<<(ctype_wchar__Getcat(NULL, NULL)-1))) {
7882 ctype_wchar *ctype;
7884 if(loc) {
7885 ctype = ctype_wchar_use_facet(loc);
7886 }else {
7887 ctype = MSVCRT_operator_new(sizeof(ctype_wchar));
7888 if(!ctype) {
7889 ERR("Out of memory\n");
7890 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7892 ctype_wchar_ctor_locinfo(ctype, locinfo, 0);
7894 locale__Locimp__Addfac(locimp, &ctype->base.facet, locale_id_operator_size_t(&ctype_wchar_id));
7897 if(cat & (1<<(num_get_wchar__Getcat(NULL, NULL)-1))) {
7898 num_get *numget;
7900 if(loc) {
7901 numget = num_get_wchar_use_facet(loc);
7902 }else {
7903 numget = MSVCRT_operator_new(sizeof(num_get));
7904 if(!numget) {
7905 ERR("Out of memory\n");
7906 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7908 num_get_wchar_ctor_locinfo(numget, locinfo, 0);
7910 locale__Locimp__Addfac(locimp, &numget->facet, locale_id_operator_size_t(&num_get_wchar_id));
7913 if(cat & (1<<(num_put_wchar__Getcat(NULL, NULL)-1))) {
7914 num_put *numput;
7916 if(loc) {
7917 numput = num_put_wchar_use_facet(loc);
7918 }else {
7919 numput = MSVCRT_operator_new(sizeof(num_put));
7920 if(!numput) {
7921 ERR("Out of memory\n");
7922 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7924 num_put_wchar_ctor_locinfo(numput, locinfo, 0);
7926 locale__Locimp__Addfac(locimp, &numput->facet, locale_id_operator_size_t(&num_put_wchar_id));
7929 if(cat & (1<<(numpunct_wchar__Getcat(NULL, NULL)-1))) {
7930 numpunct_wchar *numpunct;
7932 if(loc) {
7933 numpunct = numpunct_wchar_use_facet(loc);
7934 }else {
7935 numpunct = MSVCRT_operator_new(sizeof(numpunct_wchar));
7936 if(!numpunct) {
7937 ERR("Out of memory\n");
7938 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7940 numpunct_wchar_ctor_locinfo(numpunct, locinfo, 0, FALSE);
7942 locale__Locimp__Addfac(locimp, &numpunct->facet, locale_id_operator_size_t(&numpunct_wchar_id));
7945 if(cat & (1<<(collate_wchar__Getcat(NULL, NULL)-1))) {
7946 collate *c;
7948 if(loc) {
7949 c = collate_wchar_use_facet(loc);
7950 }else {
7951 c = MSVCRT_operator_new(sizeof(collate));
7952 if(!c) {
7953 ERR("Out of memory\n");
7954 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7956 collate_wchar_ctor_locinfo(c, locinfo, 0);
7958 locale__Locimp__Addfac(locimp, &c->facet, locale_id_operator_size_t(&collate_wchar_id));
7961 if(cat & (1<<(time_put_wchar__Getcat(NULL, NULL)-1))) {
7962 time_put *t;
7964 if(loc) {
7965 t = time_put_wchar_use_facet(loc);
7966 }else {
7967 t = MSVCRT_operator_new(sizeof(time_put));
7968 if(!t) {
7969 ERR("Out of memory\n");
7970 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7972 time_put_wchar_ctor_locinfo(t, locinfo, 0);
7974 locale__Locimp__Addfac(locimp, &t->facet, locale_id_operator_size_t(&time_put_wchar_id));
7977 if(cat & (1<<(codecvt_wchar__Getcat(NULL, NULL)-1))) {
7978 codecvt_wchar *codecvt;
7980 if(loc) {
7981 codecvt = codecvt_wchar_use_facet(loc);
7982 }else {
7983 codecvt = MSVCRT_operator_new(sizeof(codecvt_wchar));
7984 if(!codecvt) {
7985 ERR("Out of memory\n");
7986 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7988 codecvt_wchar_ctor_locinfo(codecvt, locinfo, 0);
7990 locale__Locimp__Addfac(locimp, &codecvt->base.facet, locale_id_operator_size_t(&codecvt_wchar_id));
7994 /* ?_Makexloc@_Locimp@locale@std@@CAXABV_Locinfo@3@HPAV123@PBV23@@Z */
7995 /* ?_Makexloc@_Locimp@locale@std@@CAXAEBV_Locinfo@3@HPEAV123@PEBV23@@Z */
7996 /* List of missing facets:
7997 * messages, money_get, money_put, moneypunct, moneypunct, time_get
7999 static void locale__Locimp__Makexloc(const _Locinfo *locinfo, category cat, locale__Locimp *locimp, const locale *loc)
8001 FIXME("(%p %d %p %p) semi-stub\n", locinfo, cat, locimp, loc);
8003 if(cat & (1<<(ctype_char__Getcat(NULL, NULL)-1))) {
8004 ctype_char *ctype;
8006 if(loc) {
8007 ctype = ctype_char_use_facet(loc);
8008 }else {
8009 ctype = MSVCRT_operator_new(sizeof(ctype_char));
8010 if(!ctype) {
8011 ERR("Out of memory\n");
8012 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8014 ctype_char_ctor_locinfo(ctype, locinfo, 0);
8016 locale__Locimp__Addfac(locimp, &ctype->base.facet, locale_id_operator_size_t(&ctype_char_id));
8019 if(cat & (1<<(num_get_char__Getcat(NULL, NULL)-1))) {
8020 num_get *numget;
8022 if(loc) {
8023 numget = num_get_char_use_facet(loc);
8024 }else {
8025 numget = MSVCRT_operator_new(sizeof(num_get));
8026 if(!numget) {
8027 ERR("Out of memory\n");
8028 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8030 num_get_char_ctor_locinfo(numget, locinfo, 0);
8032 locale__Locimp__Addfac(locimp, &numget->facet, locale_id_operator_size_t(&num_get_char_id));
8035 if(cat & (1<<(num_put_char__Getcat(NULL, NULL)-1))) {
8036 num_put *numput;
8038 if(loc) {
8039 numput = num_put_char_use_facet(loc);
8040 }else {
8041 numput = MSVCRT_operator_new(sizeof(num_put));
8042 if(!numput) {
8043 ERR("Out of memory\n");
8044 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8046 num_put_char_ctor_locinfo(numput, locinfo, 0);
8048 locale__Locimp__Addfac(locimp, &numput->facet, locale_id_operator_size_t(&num_put_char_id));
8051 if(cat & (1<<(numpunct_char__Getcat(NULL, NULL)-1))) {
8052 numpunct_char *numpunct;
8054 if(loc) {
8055 numpunct = numpunct_char_use_facet(loc);
8056 }else {
8057 numpunct = MSVCRT_operator_new(sizeof(numpunct_char));
8058 if(!numpunct) {
8059 ERR("Out of memory\n");
8060 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8062 numpunct_char_ctor_locinfo(numpunct, locinfo, 0, FALSE);
8064 locale__Locimp__Addfac(locimp, &numpunct->facet, locale_id_operator_size_t(&numpunct_char_id));
8067 if(cat & (1<<(collate_char__Getcat(NULL, NULL)-1))) {
8068 collate *c;
8070 if(loc) {
8071 c = collate_char_use_facet(loc);
8072 }else {
8073 c = MSVCRT_operator_new(sizeof(collate));
8074 if(!c) {
8075 ERR("Out of memory\n");
8076 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8078 collate_char_ctor_locinfo(c, locinfo, 0);
8080 locale__Locimp__Addfac(locimp, &c->facet, locale_id_operator_size_t(&collate_char_id));
8083 if(cat & (1<<(time_put_char__Getcat(NULL, NULL)-1))) {
8084 time_put *t;
8086 if(loc) {
8087 t = time_put_char_use_facet(loc);
8088 }else {
8089 t = MSVCRT_operator_new(sizeof(time_put));
8090 if(!t) {
8091 ERR("Out of memory\n");
8092 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8094 time_put_char_ctor_locinfo(t, locinfo, 0);
8096 locale__Locimp__Addfac(locimp, &t->facet, locale_id_operator_size_t(&time_put_char_id));
8099 if(cat & (1<<(codecvt_char__Getcat(NULL, NULL)-1))) {
8100 codecvt_char *codecvt;
8102 if(loc) {
8103 codecvt = codecvt_char_use_facet(loc);
8104 }else {
8105 codecvt = MSVCRT_operator_new(sizeof(codecvt_char));
8106 if(!codecvt) {
8107 ERR("Out of memory\n");
8108 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8110 codecvt_char_ctor_locinfo(codecvt, locinfo, 0);
8112 locale__Locimp__Addfac(locimp, &codecvt->base.facet, locale_id_operator_size_t(&codecvt_char_id));
8116 /* ?_Makeloc@_Locimp@locale@std@@CAPAV123@ABV_Locinfo@3@HPAV123@PBV23@@Z */
8117 /* ?_Makeloc@_Locimp@locale@std@@CAPEAV123@AEBV_Locinfo@3@HPEAV123@PEBV23@@Z */
8118 static locale__Locimp* locale__Locimp__Makeloc(const _Locinfo *locinfo, category cat, locale__Locimp *locimp, const locale *loc)
8120 TRACE("(%p %d %p %p)\n", locinfo, cat, locimp, loc);
8122 locale__Locimp__Makexloc(locinfo, cat, locimp, loc);
8123 locale__Locimp__Makewloc(locinfo, cat, locimp, loc);
8124 locale__Locimp__Makeushloc(locinfo, cat, locimp, loc);
8126 locimp->catmask |= cat;
8127 basic_string_char_assign(&locimp->name, &locinfo->newlocname);
8128 return locimp;
8131 /* ??_7_Locimp@locale@std@@6B@ */
8132 const vtable_ptr MSVCP_locale__Locimp_vtable[] = {
8133 (vtable_ptr)THISCALL_NAME(locale__Locimp_vector_dtor)
8136 /* ??0locale@std@@AAE@PAV_Locimp@01@@Z */
8137 /* ??0locale@std@@AEAA@PEAV_Locimp@01@@Z */
8138 DEFINE_THISCALL_WRAPPER(locale_ctor_locimp, 8)
8139 locale* __thiscall locale_ctor_locimp(locale *this, locale__Locimp *locimp)
8141 TRACE("(%p %p)\n", this, locimp);
8142 /* Don't change locimp reference counter */
8143 this->ptr = locimp;
8144 return this;
8147 /* ?_Init@locale@std@@CAPAV_Locimp@12@XZ */
8148 /* ?_Init@locale@std@@CAPEAV_Locimp@12@XZ */
8149 locale__Locimp* __cdecl locale__Init(void)
8151 _Lockit lock;
8153 TRACE("\n");
8155 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
8156 if(global_locale) {
8157 _Lockit_dtor(&lock);
8158 return global_locale;
8161 global_locale = MSVCRT_operator_new(sizeof(locale__Locimp));
8162 if(!global_locale) {
8163 _Lockit_dtor(&lock);
8164 ERR("Out of memory\n");
8165 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8166 return NULL;
8169 locale__Locimp_ctor(global_locale);
8170 global_locale->catmask = (1<<(LC_MAX+1))-1;
8171 basic_string_char_dtor(&global_locale->name);
8172 basic_string_char_ctor_cstr(&global_locale->name, "C");
8174 locale__Locimp__Clocptr = global_locale;
8175 global_locale->facet.refs++;
8176 locale_ctor_locimp(&classic_locale, locale__Locimp__Clocptr);
8177 _Lockit_dtor(&lock);
8179 return global_locale;
8182 /* ?_Iscloc@locale@std@@QBE_NXZ */
8183 /* ?_Iscloc@locale@std@@QEBA_NXZ */
8184 DEFINE_THISCALL_WRAPPER(locale__Iscloc, 4)
8185 MSVCP_bool __thiscall locale__Iscloc(const locale *this)
8187 TRACE("(%p)\n", this);
8188 return this->ptr == locale__Locimp__Clocptr;
8191 /* ??0locale@std@@QAE@ABV01@0H@Z */
8192 /* ??0locale@std@@QEAA@AEBV01@0H@Z */
8193 DEFINE_THISCALL_WRAPPER(locale_ctor_locale_locale, 16)
8194 locale* __thiscall locale_ctor_locale_locale(locale *this, const locale *loc, const locale *other, category cat)
8196 _Locinfo locinfo;
8198 TRACE("(%p %p %p %d)\n", this, loc, other, cat);
8200 this->ptr = MSVCRT_operator_new(sizeof(locale__Locimp));
8201 if(!this->ptr) {
8202 ERR("Out of memory\n");
8203 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8205 locale__Locimp_copy_ctor(this->ptr, loc->ptr);
8207 _Locinfo_ctor_cat_cstr(&locinfo, loc->ptr->catmask, basic_string_char_c_str(&loc->ptr->name));
8208 _Locinfo__Addcats(&locinfo, cat & other->ptr->catmask, basic_string_char_c_str(&other->ptr->name));
8209 locale__Locimp__Makeloc(&locinfo, cat, this->ptr, other);
8210 _Locinfo_dtor(&locinfo);
8212 return this;
8215 /* ??0locale@std@@QAE@ABV01@@Z */
8216 /* ??0locale@std@@QEAA@AEBV01@@Z */
8217 DEFINE_THISCALL_WRAPPER(locale_copy_ctor, 8)
8218 locale* __thiscall locale_copy_ctor(locale *this, const locale *copy)
8220 TRACE("(%p %p)\n", this, copy);
8221 this->ptr = copy->ptr;
8222 locale_facet__Incref(&this->ptr->facet);
8223 return this;
8226 /* ??0locale@std@@QAE@ABV01@PBDH@Z */
8227 /* ??0locale@std@@QEAA@AEBV01@PEBDH@Z */
8228 DEFINE_THISCALL_WRAPPER(locale_ctor_locale_cstr, 16)
8229 locale* __thiscall locale_ctor_locale_cstr(locale *this, const locale *loc, const char *locname, category cat)
8231 _Locinfo locinfo;
8233 TRACE("(%p %p %s %d)\n", this, loc, locname, cat);
8235 _Locinfo_ctor_cat_cstr(&locinfo, cat, locname);
8236 if(!memcmp(basic_string_char_c_str(&locinfo.newlocname), "*", 2)) {
8237 _Locinfo_dtor(&locinfo);
8238 MSVCRT_operator_delete(this->ptr);
8239 throw_exception(EXCEPTION_RUNTIME_ERROR, "bad locale name");
8242 this->ptr = MSVCRT_operator_new(sizeof(locale__Locimp));
8243 if(!this->ptr) {
8244 ERR("Out of memory\n");
8245 _Locinfo_dtor(&locinfo);
8246 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8248 locale__Locimp_copy_ctor(this->ptr, loc->ptr);
8250 locale__Locimp__Makeloc(&locinfo, cat, this->ptr, NULL);
8251 _Locinfo_dtor(&locinfo);
8252 return this;
8255 /* ??0locale@std@@QAE@PBDH@Z */
8256 /* ??0locale@std@@QEAA@PEBDH@Z */
8257 DEFINE_THISCALL_WRAPPER(locale_ctor_cstr, 12)
8258 locale* __thiscall locale_ctor_cstr(locale *this, const char *locname, category cat)
8260 _Locinfo locinfo;
8262 TRACE("(%p %s %d)\n", this, locname, cat);
8264 this->ptr = MSVCRT_operator_new(sizeof(locale__Locimp));
8265 if(!this->ptr) {
8266 ERR("Out of memory\n");
8267 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8269 locale__Locimp_ctor(this->ptr);
8271 locale__Init();
8273 _Locinfo_ctor_cat_cstr(&locinfo, cat, locname);
8274 if(!memcmp(basic_string_char_c_str(&locinfo.newlocname), "*", 2)) {
8275 _Locinfo_dtor(&locinfo);
8276 MSVCRT_operator_delete(this->ptr);
8277 throw_exception(EXCEPTION_RUNTIME_ERROR, "bad locale name");
8280 locale__Locimp__Makeloc(&locinfo, cat, this->ptr, NULL);
8281 _Locinfo_dtor(&locinfo);
8283 return this;
8286 /* ??0locale@std@@QAE@W4_Uninitialized@1@@Z */
8287 /* ??0locale@std@@QEAA@W4_Uninitialized@1@@Z */
8288 DEFINE_THISCALL_WRAPPER(locale_ctor_uninitialized, 8)
8289 locale* __thiscall locale_ctor_uninitialized(locale *this, int uninitialized)
8291 TRACE("(%p)\n", this);
8292 this->ptr = NULL;
8293 return this;
8296 /* ??0locale@std@@QAE@XZ */
8297 /* ??0locale@std@@QEAA@XZ */
8298 DEFINE_THISCALL_WRAPPER(locale_ctor, 4)
8299 locale* __thiscall locale_ctor(locale *this)
8301 TRACE("(%p)\n", this);
8302 this->ptr = locale__Init();
8303 locale_facet__Incref(&this->ptr->facet);
8304 return this;
8307 /* ??1locale@std@@QAE@XZ */
8308 /* ??1locale@std@@QEAA@XZ */
8309 DEFINE_THISCALL_WRAPPER(locale_dtor, 4)
8310 void __thiscall locale_dtor(locale *this)
8312 TRACE("(%p)\n", this);
8313 if(this->ptr && locale_facet__Decref(&this->ptr->facet)) {
8314 locale__Locimp_dtor(this->ptr);
8315 MSVCRT_operator_delete(this->ptr);
8319 /* ??4locale@std@@QAEAAV01@ABV01@@Z */
8320 /* ??4locale@std@@QEAAAEAV01@AEBV01@@Z */
8321 DEFINE_THISCALL_WRAPPER(locale_operator_assign, 8)
8322 locale* __thiscall locale_operator_assign(locale *this, const locale *loc)
8324 FIXME("(%p %p) stub\n", this, loc);
8325 return NULL;
8328 /* ??8locale@std@@QBE_NABV01@@Z */
8329 /* ??8locale@std@@QEBA_NAEBV01@@Z */
8330 DEFINE_THISCALL_WRAPPER(locale_operator_equal, 8)
8331 MSVCP_bool __thiscall locale_operator_equal(const locale *this, const locale *loc)
8333 FIXME("(%p %p) stub\n", this, loc);
8334 return 0;
8337 /* ??9locale@std@@QBE_NABV01@@Z */
8338 /* ??9locale@std@@QEBA_NAEBV01@@Z */
8339 DEFINE_THISCALL_WRAPPER(locale_operator_not_equal, 8)
8340 MSVCP_bool __thiscall locale_operator_not_equal(const locale *this, locale const *loc)
8342 FIXME("(%p %p) stub\n", this, loc);
8343 return 0;
8346 /* ?_Addfac@locale@std@@QAEAAV12@PAVfacet@12@II@Z */
8347 /* ?_Addfac@locale@std@@QEAAAEAV12@PEAVfacet@12@_K1@Z */
8348 DEFINE_THISCALL_WRAPPER(locale__Addfac, 16)
8349 locale* __thiscall locale__Addfac(locale *this, locale_facet *facet, MSVCP_size_t id, MSVCP_size_t catmask)
8351 TRACE("(%p %p %lu %lu)\n", this, facet, id, catmask);
8353 if(this->ptr->facet.refs > 1) {
8354 locale__Locimp *new_ptr = MSVCRT_operator_new(sizeof(locale__Locimp));
8355 if(!new_ptr) {
8356 ERR("Out of memory\n");
8357 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8358 return NULL;
8360 locale__Locimp_copy_ctor(new_ptr, this->ptr);
8361 locale_facet__Decref(&this->ptr->facet);
8362 this->ptr = new_ptr;
8365 locale__Locimp__Addfac(this->ptr, facet, id);
8367 if(catmask) {
8368 basic_string_char_dtor(&this->ptr->name);
8369 basic_string_char_ctor_cstr(&this->ptr->name, "*");
8371 return this;
8374 /* ?_Getfacet@locale@std@@QBEPBVfacet@12@I_N@Z */
8375 /* ?_Getfacet@locale@std@@QEBAPEBVfacet@12@_K_N@Z */
8376 DEFINE_THISCALL_WRAPPER(locale__Getfacet, 12)
8377 const locale_facet* __thiscall locale__Getfacet(const locale *this,
8378 MSVCP_size_t id, MSVCP_bool allow_transparent)
8380 locale_facet *fac;
8382 TRACE("(%p %lu)\n", this, id);
8384 fac = id < this->ptr->facet_cnt ? this->ptr->facetvec[id] : NULL;
8385 if(fac || !this->ptr->transparent || !allow_transparent)
8386 return fac;
8388 return id < global_locale->facet_cnt ? global_locale->facetvec[id] : NULL;
8391 /* ?classic@locale@std@@SAABV12@XZ */
8392 /* ?classic@locale@std@@SAAEBV12@XZ */
8393 const locale* __cdecl locale_classic(void)
8395 TRACE("\n");
8396 locale__Init();
8397 return &classic_locale;
8400 /* ?empty@locale@std@@SA?AV12@XZ */
8401 locale* __cdecl locale_empty(locale *ret)
8403 TRACE("\n");
8405 locale__Init();
8407 ret->ptr = MSVCRT_operator_new(sizeof(locale__Locimp));
8408 if(!ret->ptr) {
8409 ERR("Out of memory\n");
8410 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8412 locale__Locimp_ctor_transparent(ret->ptr, TRUE);
8413 return ret;
8416 /* ?name@locale@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
8417 /* ?name@locale@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
8418 DEFINE_THISCALL_WRAPPER(locale_name, 8)
8419 basic_string_char* __thiscall locale_name(const locale *this, basic_string_char *ret)
8421 TRACE( "(%p)\n", this);
8422 basic_string_char_copy_ctor(ret, &this->ptr->name);
8423 return ret;
8426 /* ?global@locale@std@@SA?AV12@ABV12@@Z */
8427 /* ?global@locale@std@@SA?AV12@AEBV12@@Z */
8428 locale* __cdecl locale_global(locale *ret, const locale *loc)
8430 _Lockit lock;
8431 int i;
8433 TRACE("(%p %p)\n", loc, ret);
8435 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
8436 locale_ctor(ret);
8438 if(loc->ptr != global_locale) {
8439 locale_facet__Decref(&global_locale->facet);
8440 global_locale = loc->ptr;
8441 locale_facet__Incref(&global_locale->facet);
8443 for(i=LC_ALL+1; i<=LC_MAX; i++) {
8444 if((global_locale->catmask & (1<<(i-1))) == 0)
8445 continue;
8446 setlocale(i, basic_string_char_c_str(&global_locale->name));
8449 _Lockit_dtor(&lock);
8450 return ret;
8453 /* wctrans */
8454 wctrans_t __cdecl wctrans(const char *property)
8456 static const char str_tolower[] = "tolower";
8457 static const char str_toupper[] = "toupper";
8459 if(!strcmp(property, str_tolower))
8460 return 2;
8461 if(!strcmp(property, str_toupper))
8462 return 1;
8463 return 0;
8466 /* towctrans */
8467 wint_t __cdecl towctrans(wint_t c, wctrans_t category)
8469 if(category == 1)
8470 return towupper(c);
8471 return towlower(c);
8474 DEFINE_RTTI_DATA0(locale_facet, 0, ".?AVfacet@locale@std@@")
8475 DEFINE_RTTI_DATA1(collate_char, 0, &locale_facet_rtti_base_descriptor, ".?AV?$collate@D@std@@")
8476 DEFINE_RTTI_DATA1(collate_wchar, 0, &locale_facet_rtti_base_descriptor, ".?AV?$collate@_W@std@@")
8477 DEFINE_RTTI_DATA1(collate_short, 0, &locale_facet_rtti_base_descriptor, ".?AV?$collate@G@std@@")
8478 DEFINE_RTTI_DATA1(ctype_base, 0, &locale_facet_rtti_base_descriptor, ".?AUctype_base@std@@")
8479 DEFINE_RTTI_DATA2(ctype_char, 0, &ctype_base_rtti_base_descriptor, &locale_facet_rtti_base_descriptor, ".?AV?$ctype@D@std@@")
8480 DEFINE_RTTI_DATA2(ctype_wchar, 0, &ctype_base_rtti_base_descriptor, &locale_facet_rtti_base_descriptor, ".?AV?$ctype@_W@std@@")
8481 DEFINE_RTTI_DATA2(ctype_short, 0, &ctype_base_rtti_base_descriptor, &locale_facet_rtti_base_descriptor, ".?AV?$ctype@G@std@@")
8482 DEFINE_RTTI_DATA1(codecvt_base, 0, &locale_facet_rtti_base_descriptor, ".?AVcodecvt_base@std@@")
8483 DEFINE_RTTI_DATA2(codecvt_char, 0, &codecvt_base_rtti_base_descriptor, &locale_facet_rtti_base_descriptor, ".?AV?$codecvt@DDH@std@@")
8484 DEFINE_RTTI_DATA2(codecvt_wchar, 0, &codecvt_base_rtti_base_descriptor, &locale_facet_rtti_base_descriptor, ".?AV?$codecvt@_WDH@std@@")
8485 DEFINE_RTTI_DATA2(codecvt_short, 0, &codecvt_base_rtti_base_descriptor, &locale_facet_rtti_base_descriptor, ".?AV?$codecvt@GDH@std@@")
8486 DEFINE_RTTI_DATA1(numpunct_char, 0, &locale_facet_rtti_base_descriptor, ".?AV?$numpunct@D@std@@")
8487 DEFINE_RTTI_DATA1(numpunct_wchar, 0, &locale_facet_rtti_base_descriptor, ".?AV?$numpunct@_W@std@@")
8488 DEFINE_RTTI_DATA1(numpunct_short, 0, &locale_facet_rtti_base_descriptor, ".?AV?$numpunct@G@std@@")
8489 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@@")
8490 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@@")
8491 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@@")
8492 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@@")
8493 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@@")
8494 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@@")
8495 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@@")
8496 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@@")
8497 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@@")
8499 #ifndef __GNUC__
8500 void __asm_dummy_vtables(void) {
8501 #endif
8502 __ASM_VTABLE(locale_facet,
8503 VTABLE_ADD_FUNC(locale_facet_vector_dtor));
8504 __ASM_VTABLE(collate_char,
8505 VTABLE_ADD_FUNC(collate_char_vector_dtor)
8506 VTABLE_ADD_FUNC(collate_char_do_compare)
8507 VTABLE_ADD_FUNC(collate_char_do_transform)
8508 VTABLE_ADD_FUNC(collate_char_do_hash));
8509 __ASM_VTABLE(collate_wchar,
8510 VTABLE_ADD_FUNC(collate_wchar_vector_dtor)
8511 VTABLE_ADD_FUNC(collate_wchar_do_compare)
8512 VTABLE_ADD_FUNC(collate_wchar_do_transform)
8513 VTABLE_ADD_FUNC(collate_wchar_do_hash));
8514 __ASM_VTABLE(collate_short,
8515 VTABLE_ADD_FUNC(collate_wchar_vector_dtor)
8516 VTABLE_ADD_FUNC(collate_wchar_do_compare)
8517 VTABLE_ADD_FUNC(collate_wchar_do_transform)
8518 VTABLE_ADD_FUNC(collate_wchar_do_hash));
8519 __ASM_VTABLE(ctype_base,
8520 VTABLE_ADD_FUNC(ctype_base_vector_dtor));
8521 __ASM_VTABLE(ctype_char,
8522 VTABLE_ADD_FUNC(ctype_char_vector_dtor)
8523 VTABLE_ADD_FUNC(ctype_char_do_tolower)
8524 VTABLE_ADD_FUNC(ctype_char_do_tolower_ch)
8525 VTABLE_ADD_FUNC(ctype_char_do_toupper)
8526 VTABLE_ADD_FUNC(ctype_char_do_toupper_ch)
8527 VTABLE_ADD_FUNC(ctype_char_do_widen)
8528 VTABLE_ADD_FUNC(ctype_char_do_widen_ch)
8529 VTABLE_ADD_FUNC(ctype_char_do_narrow)
8530 VTABLE_ADD_FUNC(ctype_char_do_narrow_ch));
8531 __ASM_VTABLE(ctype_wchar,
8532 VTABLE_ADD_FUNC(ctype_wchar_vector_dtor)
8533 VTABLE_ADD_FUNC(ctype_wchar_do_is)
8534 VTABLE_ADD_FUNC(ctype_wchar_do_is_ch)
8535 VTABLE_ADD_FUNC(ctype_wchar_do_scan_is)
8536 VTABLE_ADD_FUNC(ctype_wchar_do_scan_not)
8537 VTABLE_ADD_FUNC(ctype_wchar_do_tolower)
8538 VTABLE_ADD_FUNC(ctype_wchar_do_tolower_ch)
8539 VTABLE_ADD_FUNC(ctype_wchar_do_toupper)
8540 VTABLE_ADD_FUNC(ctype_wchar_do_toupper_ch)
8541 VTABLE_ADD_FUNC(ctype_wchar_do_widen)
8542 VTABLE_ADD_FUNC(ctype_wchar_do_widen_ch)
8543 VTABLE_ADD_FUNC(ctype_wchar_do_narrow)
8544 VTABLE_ADD_FUNC(ctype_wchar_do_narrow_ch));
8545 __ASM_VTABLE(ctype_short,
8546 VTABLE_ADD_FUNC(ctype_wchar_vector_dtor)
8547 VTABLE_ADD_FUNC(ctype_wchar_do_is)
8548 VTABLE_ADD_FUNC(ctype_wchar_do_is_ch)
8549 VTABLE_ADD_FUNC(ctype_wchar_do_scan_is)
8550 VTABLE_ADD_FUNC(ctype_wchar_do_scan_not)
8551 VTABLE_ADD_FUNC(ctype_wchar_do_tolower)
8552 VTABLE_ADD_FUNC(ctype_wchar_do_tolower_ch)
8553 VTABLE_ADD_FUNC(ctype_wchar_do_toupper)
8554 VTABLE_ADD_FUNC(ctype_wchar_do_toupper_ch)
8555 VTABLE_ADD_FUNC(ctype_wchar_do_widen)
8556 VTABLE_ADD_FUNC(ctype_wchar_do_widen_ch)
8557 VTABLE_ADD_FUNC(ctype_wchar_do_narrow)
8558 VTABLE_ADD_FUNC(ctype_wchar_do_narrow_ch));
8559 __ASM_VTABLE(codecvt_base,
8560 VTABLE_ADD_FUNC(codecvt_base_vector_dtor)
8561 VTABLE_ADD_FUNC(codecvt_base_do_always_noconv)
8562 VTABLE_ADD_FUNC(codecvt_base_do_max_length)
8563 VTABLE_ADD_FUNC(codecvt_base_do_encoding));
8564 __ASM_VTABLE(codecvt_char,
8565 VTABLE_ADD_FUNC(codecvt_char_vector_dtor)
8566 VTABLE_ADD_FUNC(codecvt_base_do_always_noconv)
8567 VTABLE_ADD_FUNC(codecvt_base_do_max_length)
8568 VTABLE_ADD_FUNC(codecvt_base_do_encoding)
8569 VTABLE_ADD_FUNC(codecvt_char_do_in)
8570 VTABLE_ADD_FUNC(codecvt_char_do_out)
8571 VTABLE_ADD_FUNC(codecvt_char_do_unshift)
8572 VTABLE_ADD_FUNC(codecvt_char_do_length));
8573 __ASM_VTABLE(codecvt_wchar,
8574 VTABLE_ADD_FUNC(codecvt_wchar_vector_dtor)
8575 VTABLE_ADD_FUNC(codecvt_wchar_do_always_noconv)
8576 VTABLE_ADD_FUNC(codecvt_wchar_do_max_length)
8577 VTABLE_ADD_FUNC(codecvt_base_do_encoding)
8578 VTABLE_ADD_FUNC(codecvt_wchar_do_in)
8579 VTABLE_ADD_FUNC(codecvt_wchar_do_out)
8580 VTABLE_ADD_FUNC(codecvt_wchar_do_unshift)
8581 VTABLE_ADD_FUNC(codecvt_wchar_do_length));
8582 __ASM_VTABLE(codecvt_short,
8583 VTABLE_ADD_FUNC(codecvt_wchar_vector_dtor)
8584 VTABLE_ADD_FUNC(codecvt_wchar_do_always_noconv)
8585 VTABLE_ADD_FUNC(codecvt_wchar_do_max_length)
8586 VTABLE_ADD_FUNC(codecvt_base_do_encoding)
8587 VTABLE_ADD_FUNC(codecvt_wchar_do_in)
8588 VTABLE_ADD_FUNC(codecvt_wchar_do_out)
8589 VTABLE_ADD_FUNC(codecvt_wchar_do_unshift)
8590 VTABLE_ADD_FUNC(codecvt_wchar_do_length));
8591 __ASM_VTABLE(numpunct_char,
8592 VTABLE_ADD_FUNC(numpunct_char_vector_dtor)
8593 VTABLE_ADD_FUNC(numpunct_char_do_decimal_point)
8594 VTABLE_ADD_FUNC(numpunct_char_do_thousands_sep)
8595 VTABLE_ADD_FUNC(numpunct_char_do_grouping)
8596 VTABLE_ADD_FUNC(numpunct_char_do_falsename)
8597 VTABLE_ADD_FUNC(numpunct_char_do_truename));
8598 __ASM_VTABLE(numpunct_wchar,
8599 VTABLE_ADD_FUNC(numpunct_wchar_vector_dtor)
8600 VTABLE_ADD_FUNC(numpunct_wchar_do_decimal_point)
8601 VTABLE_ADD_FUNC(numpunct_wchar_do_thousands_sep)
8602 VTABLE_ADD_FUNC(numpunct_wchar_do_grouping)
8603 VTABLE_ADD_FUNC(numpunct_wchar_do_falsename)
8604 VTABLE_ADD_FUNC(numpunct_wchar_do_truename));
8605 __ASM_VTABLE(numpunct_short,
8606 VTABLE_ADD_FUNC(numpunct_wchar_vector_dtor)
8607 VTABLE_ADD_FUNC(numpunct_wchar_do_decimal_point)
8608 VTABLE_ADD_FUNC(numpunct_wchar_do_thousands_sep)
8609 VTABLE_ADD_FUNC(numpunct_wchar_do_grouping)
8610 VTABLE_ADD_FUNC(numpunct_wchar_do_falsename)
8611 VTABLE_ADD_FUNC(numpunct_wchar_do_truename));
8612 __ASM_VTABLE(num_get_char,
8613 VTABLE_ADD_FUNC(num_get_char_vector_dtor)
8614 VTABLE_ADD_FUNC(num_get_char_do_get_void)
8615 VTABLE_ADD_FUNC(num_get_char_do_get_double)
8616 VTABLE_ADD_FUNC(num_get_char_do_get_double)
8617 VTABLE_ADD_FUNC(num_get_char_do_get_float)
8618 VTABLE_ADD_FUNC(num_get_char_do_get_uint64)
8619 VTABLE_ADD_FUNC(num_get_char_do_get_int64)
8620 VTABLE_ADD_FUNC(num_get_char_do_get_ulong)
8621 VTABLE_ADD_FUNC(num_get_char_do_get_long)
8622 VTABLE_ADD_FUNC(num_get_char_do_get_uint)
8623 VTABLE_ADD_FUNC(num_get_char_do_get_ushort)
8624 VTABLE_ADD_FUNC(num_get_char_do_get_bool));
8625 __ASM_VTABLE(num_get_short,
8626 VTABLE_ADD_FUNC(num_get_wchar_vector_dtor)
8627 VTABLE_ADD_FUNC(num_get_short_do_get_void)
8628 VTABLE_ADD_FUNC(num_get_short_do_get_double)
8629 VTABLE_ADD_FUNC(num_get_short_do_get_double)
8630 VTABLE_ADD_FUNC(num_get_short_do_get_float)
8631 VTABLE_ADD_FUNC(num_get_short_do_get_uint64)
8632 VTABLE_ADD_FUNC(num_get_short_do_get_int64)
8633 VTABLE_ADD_FUNC(num_get_short_do_get_ulong)
8634 VTABLE_ADD_FUNC(num_get_short_do_get_long)
8635 VTABLE_ADD_FUNC(num_get_short_do_get_uint)
8636 VTABLE_ADD_FUNC(num_get_short_do_get_ushort)
8637 VTABLE_ADD_FUNC(num_get_short_do_get_bool));
8638 __ASM_VTABLE(num_get_wchar,
8639 VTABLE_ADD_FUNC(num_get_wchar_vector_dtor)
8640 VTABLE_ADD_FUNC(num_get_wchar_do_get_void)
8641 VTABLE_ADD_FUNC(num_get_wchar_do_get_double)
8642 VTABLE_ADD_FUNC(num_get_wchar_do_get_double)
8643 VTABLE_ADD_FUNC(num_get_wchar_do_get_float)
8644 VTABLE_ADD_FUNC(num_get_wchar_do_get_uint64)
8645 VTABLE_ADD_FUNC(num_get_wchar_do_get_int64)
8646 VTABLE_ADD_FUNC(num_get_wchar_do_get_ulong)
8647 VTABLE_ADD_FUNC(num_get_wchar_do_get_long)
8648 VTABLE_ADD_FUNC(num_get_wchar_do_get_uint)
8649 VTABLE_ADD_FUNC(num_get_wchar_do_get_ushort)
8650 VTABLE_ADD_FUNC(num_get_wchar_do_get_bool));
8651 __ASM_VTABLE(num_put_char,
8652 VTABLE_ADD_FUNC(num_put_char_vector_dtor)
8653 VTABLE_ADD_FUNC(num_put_char_do_put_ptr)
8654 VTABLE_ADD_FUNC(num_put_char_do_put_double)
8655 VTABLE_ADD_FUNC(num_put_char_do_put_double)
8656 VTABLE_ADD_FUNC(num_put_char_do_put_uint64)
8657 VTABLE_ADD_FUNC(num_put_char_do_put_int64)
8658 VTABLE_ADD_FUNC(num_put_char_do_put_ulong)
8659 VTABLE_ADD_FUNC(num_put_char_do_put_long)
8660 VTABLE_ADD_FUNC(num_put_char_do_put_bool));
8661 __ASM_VTABLE(num_put_wchar,
8662 VTABLE_ADD_FUNC(num_put_wchar_vector_dtor)
8663 VTABLE_ADD_FUNC(num_put_wchar_do_put_ptr)
8664 VTABLE_ADD_FUNC(num_put_wchar_do_put_double)
8665 VTABLE_ADD_FUNC(num_put_wchar_do_put_double)
8666 VTABLE_ADD_FUNC(num_put_wchar_do_put_uint64)
8667 VTABLE_ADD_FUNC(num_put_wchar_do_put_int64)
8668 VTABLE_ADD_FUNC(num_put_wchar_do_put_ulong)
8669 VTABLE_ADD_FUNC(num_put_wchar_do_put_long)
8670 VTABLE_ADD_FUNC(num_put_wchar_do_put_bool));
8671 __ASM_VTABLE(num_put_short,
8672 VTABLE_ADD_FUNC(num_put_wchar_vector_dtor)
8673 VTABLE_ADD_FUNC(num_put_short_do_put_ptr)
8674 VTABLE_ADD_FUNC(num_put_short_do_put_double)
8675 VTABLE_ADD_FUNC(num_put_short_do_put_double)
8676 VTABLE_ADD_FUNC(num_put_short_do_put_uint64)
8677 VTABLE_ADD_FUNC(num_put_short_do_put_int64)
8678 VTABLE_ADD_FUNC(num_put_short_do_put_ulong)
8679 VTABLE_ADD_FUNC(num_put_short_do_put_long)
8680 VTABLE_ADD_FUNC(num_put_short_do_put_bool));
8681 __ASM_VTABLE(time_put_char,
8682 VTABLE_ADD_FUNC(time_put_char_vector_dtor)
8683 VTABLE_ADD_FUNC(time_put_char_do_put));
8684 __ASM_VTABLE(time_put_wchar,
8685 VTABLE_ADD_FUNC(time_put_wchar_vector_dtor)
8686 VTABLE_ADD_FUNC(time_put_wchar_do_put));
8687 __ASM_VTABLE(time_put_short,
8688 VTABLE_ADD_FUNC(time_put_wchar_vector_dtor)
8689 VTABLE_ADD_FUNC(time_put_wchar_do_put));
8690 #ifndef __GNUC__
8692 #endif
8694 void init_locale(void *base)
8696 #ifdef __x86_64__
8697 init_locale_facet_rtti(base);
8698 init_collate_char_rtti(base);
8699 init_collate_wchar_rtti(base);
8700 init_collate_short_rtti(base);
8701 init_ctype_base_rtti(base);
8702 init_ctype_char_rtti(base);
8703 init_ctype_wchar_rtti(base);
8704 init_ctype_short_rtti(base);
8705 init_codecvt_base_rtti(base);
8706 init_codecvt_char_rtti(base);
8707 init_codecvt_wchar_rtti(base);
8708 init_codecvt_short_rtti(base);
8709 init_numpunct_char_rtti(base);
8710 init_numpunct_wchar_rtti(base);
8711 init_numpunct_short_rtti(base);
8712 init_num_get_char_rtti(base);
8713 init_num_get_wchar_rtti(base);
8714 init_num_get_short_rtti(base);
8715 init_num_put_char_rtti(base);
8716 init_num_put_wchar_rtti(base);
8717 init_num_put_short_rtti(base);
8718 init_time_put_char_rtti(base);
8719 init_time_put_wchar_rtti(base);
8720 init_time_put_short_rtti(base);
8721 #endif
8724 void free_locale(void)
8726 facets_elem *iter, *safe;
8728 if(global_locale) {
8729 locale_dtor(&classic_locale);
8730 locale__Locimp_dtor(global_locale);
8731 MSVCRT_operator_delete(global_locale);
8734 LIST_FOR_EACH_ENTRY_SAFE(iter, safe, &lazy_facets, facets_elem, entry) {
8735 list_remove(&iter->entry);
8736 if(locale_facet__Decref(iter->fac))
8737 call_locale_facet_vector_dtor(iter->fac, 1);
8738 MSVCRT_operator_delete(iter);