ntdll/tests: Remove an unneeded NONAMELESSSTRUCT directive.
[wine.git] / dlls / msvcp60 / locale.c
blob6bbd151df3e70768736337fb57363c2562ba8fea
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 "wchar.h"
30 #include "wctype.h"
31 #include "time.h"
32 #include "windef.h"
33 #include "winbase.h"
34 #include "winnls.h"
35 #include "wine/unicode.h"
36 #include "wine/list.h"
37 #include "wine/debug.h"
39 WINE_DEFAULT_DEBUG_CHANNEL(msvcp);
41 typedef enum {
42 DATEORDER_no_order,
43 DATEORDER_dmy,
44 DATEORDER_mdy,
45 DATEORDER_ymd,
46 DATEORDER_ydm
47 } dateorder;
49 char* __cdecl _Getdays(void);
50 char* __cdecl _Getmonths(void);
51 void* __cdecl _Gettnames(void);
52 unsigned int __cdecl ___lc_codepage_func(void);
53 int __cdecl ___lc_collate_cp_func(void);
54 const unsigned short* __cdecl __pctype_func(void);
55 const locale_facet* __thiscall locale__Getfacet(const locale*, MSVCP_size_t, MSVCP_bool);
56 MSVCP_size_t __cdecl _Strftime(char*, MSVCP_size_t, const char*,
57 const struct tm*, struct __lc_time_data*);
59 LCID* __cdecl ___lc_handle_func(void);
61 #define locale_string basic_string_char
62 #define locale_string_char_ctor_cstr(this,str) MSVCP_basic_string_char_ctor_cstr(this,str)
63 #define locale_string_char_copy_ctor(this,copy) MSVCP_basic_string_char_copy_ctor(this,copy)
64 #define locale_string_char_dtor(this) MSVCP_basic_string_char_dtor(this)
65 #define locale_string_char_c_str(this) MSVCP_basic_string_char_c_str(this)
66 #define locale_string_char_assign(this,assign) MSVCP_basic_string_char_assign(this,assign)
68 typedef int category;
70 typedef struct _locale__Locimp {
71 locale_facet facet;
72 locale_facet **facetvec;
73 MSVCP_size_t facet_cnt;
74 category catmask;
75 MSVCP_bool transparent;
76 locale_string name;
77 } locale__Locimp;
79 typedef struct {
80 void *timeptr;
81 } _Timevec;
83 typedef struct {
84 _Lockit lock;
85 locale_string days;
86 locale_string months;
87 locale_string oldlocname;
88 locale_string newlocname;
89 } _Locinfo;
91 typedef struct {
92 LCID handle;
93 unsigned page;
94 } _Collvec;
96 typedef struct {
97 locale_facet facet;
98 _Collvec coll;
99 } collate;
101 typedef struct {
102 locale_facet facet;
103 const char *grouping;
104 char dp;
105 char sep;
106 const char *false_name;
107 const char *true_name;
108 } numpunct_char;
110 typedef struct {
111 locale_facet facet;
112 const char *grouping;
113 wchar_t dp;
114 wchar_t sep;
115 const wchar_t *false_name;
116 const wchar_t *true_name;
117 } numpunct_wchar;
119 typedef struct {
120 locale_facet facet;
121 _Timevec time;
122 _Cvtvec cvt;
123 } time_put;
125 /* ?_Id_cnt@id@locale@std@@0HA */
126 int locale_id__Id_cnt = 0;
128 static locale classic_locale;
130 /* ?_Global@_Locimp@locale@std@@0PAV123@A */
131 /* ?_Global@_Locimp@locale@std@@0PEAV123@EA */
132 locale__Locimp *global_locale = NULL;
134 /* ?_Clocptr@_Locimp@locale@std@@0PAV123@A */
135 /* ?_Clocptr@_Locimp@locale@std@@0PEAV123@EA */
136 locale__Locimp *locale__Locimp__Clocptr = NULL;
138 static char istreambuf_iterator_char_val(istreambuf_iterator_char *this)
140 if(this->strbuf && !this->got) {
141 int c = basic_streambuf_char_sgetc(this->strbuf);
142 if(c == EOF)
143 this->strbuf = NULL;
144 else
145 this->val = c;
148 this->got = TRUE;
149 return this->val;
152 static wchar_t istreambuf_iterator_wchar_val(istreambuf_iterator_wchar *this)
154 if(this->strbuf && !this->got) {
155 unsigned short c = basic_streambuf_wchar_sgetc(this->strbuf);
156 if(c == WEOF)
157 this->strbuf = NULL;
158 else
159 this->val = c;
162 this->got = TRUE;
163 return this->val;
166 static void istreambuf_iterator_char_inc(istreambuf_iterator_char *this)
168 if(!this->strbuf || basic_streambuf_char_sbumpc(this->strbuf)==EOF) {
169 this->strbuf = NULL;
170 this->got = TRUE;
171 }else {
172 this->got = FALSE;
173 istreambuf_iterator_char_val(this);
177 static void istreambuf_iterator_wchar_inc(istreambuf_iterator_wchar *this)
179 if(!this->strbuf || basic_streambuf_wchar_sbumpc(this->strbuf)==WEOF) {
180 this->strbuf = NULL;
181 this->got = TRUE;
182 }else {
183 this->got = FALSE;
184 istreambuf_iterator_wchar_val(this);
188 static void ostreambuf_iterator_char_put(ostreambuf_iterator_char *this, char ch)
190 if(this->failed || basic_streambuf_char_sputc(this->strbuf, ch)==EOF)
191 this->failed = TRUE;
194 static void ostreambuf_iterator_wchar_put(ostreambuf_iterator_wchar *this, wchar_t ch)
196 if(this->failed || basic_streambuf_wchar_sputc(this->strbuf, ch)==WEOF)
197 this->failed = TRUE;
200 /* ??1facet@locale@std@@UAE@XZ */
201 /* ??1facet@locale@std@@UEAA@XZ */
202 /* ??1facet@locale@std@@MAA@XZ */
203 /* ??1facet@locale@std@@MAE@XZ */
204 /* ??1facet@locale@std@@MEAA@XZ */
205 DEFINE_THISCALL_WRAPPER(locale_facet_dtor, 4)
206 void __thiscall locale_facet_dtor(locale_facet *this)
208 TRACE("(%p)\n", this);
211 DEFINE_THISCALL_WRAPPER(locale_facet_vector_dtor, 8)
212 #define call_locale_facet_vector_dtor(this, flags) CALL_VTBL_FUNC(this, 0, \
213 locale_facet*, (locale_facet*, unsigned int), (this, flags))
214 locale_facet* __thiscall locale_facet_vector_dtor(locale_facet *this, unsigned int flags)
216 TRACE("(%p %x)\n", this, flags);
217 if(flags & 2) {
218 /* we have an array, with the number of elements stored before the first object */
219 INT_PTR i, *ptr = (INT_PTR *)this-1;
221 for(i=*ptr-1; i>=0; i--)
222 locale_facet_dtor(this+i);
223 MSVCRT_operator_delete(ptr);
224 } else {
225 locale_facet_dtor(this);
226 if(flags & 1)
227 MSVCRT_operator_delete(this);
230 return this;
233 typedef struct
235 locale_facet *fac;
236 struct list entry;
237 } facets_elem;
238 static struct list lazy_facets = LIST_INIT(lazy_facets);
240 /* Not exported from msvcp90 */
241 /* ?facet_Register@facet@locale@std@@CAXPAV123@@Z */
242 /* ?facet_Register@facet@locale@std@@CAXPEAV123@@Z */
243 void __cdecl locale_facet_register(locale_facet *add)
245 facets_elem *head = MSVCRT_operator_new(sizeof(*head));
246 if(!head) {
247 ERR("Out of memory\n");
248 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
251 head->fac = add;
252 list_add_head(&lazy_facets, &head->entry);
255 /* Not exported from msvcp90 */
256 /* ??_7facet@locale@std@@6B@ */
257 extern const vtable_ptr MSVCP_locale_facet_vtable;
259 /* ??Bid@locale@std@@QAEIXZ */
260 /* ??Bid@locale@std@@QEAA_KXZ */
261 DEFINE_THISCALL_WRAPPER(locale_id_operator_size_t, 4)
262 MSVCP_size_t __thiscall locale_id_operator_size_t(locale_id *this)
264 _Lockit lock;
266 TRACE("(%p)\n", this);
268 if(!this->id) {
269 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
270 this->id = ++locale_id__Id_cnt;
271 _Lockit_dtor(&lock);
274 return this->id;
277 /* ??_Ffacet@locale@std@@QAEXXZ */
278 /* ??_Ffacet@locale@std@@QEAAXXZ */
279 DEFINE_THISCALL_WRAPPER(locale_facet_ctor, 4)
280 locale_facet* __thiscall locale_facet_ctor(locale_facet *this)
282 TRACE("(%p)\n", this);
283 this->vtable = &MSVCP_locale_facet_vtable;
284 this->refs = 0;
285 return this;
288 /* ??0facet@locale@std@@IAE@I@Z */
289 /* ??0facet@locale@std@@IEAA@_K@Z */
290 DEFINE_THISCALL_WRAPPER(locale_facet_ctor_refs, 8)
291 locale_facet* __thiscall locale_facet_ctor_refs(locale_facet *this, MSVCP_size_t refs)
293 TRACE("(%p %lu)\n", this, refs);
294 this->vtable = &MSVCP_locale_facet_vtable;
295 this->refs = refs;
296 return this;
299 /* ?_Incref@facet@locale@std@@QAEXXZ */
300 /* ?_Incref@facet@locale@std@@QEAAXXZ */
301 DEFINE_THISCALL_WRAPPER(locale_facet__Incref, 4)
302 void __thiscall locale_facet__Incref(locale_facet *this)
304 _Lockit lock;
306 TRACE("(%p)\n", this);
308 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
309 this->refs++;
310 _Lockit_dtor(&lock);
313 /* ?_Decref@facet@locale@std@@QAEPAV123@XZ */
314 /* ?_Decref@facet@locale@std@@QEAAPEAV123@XZ */
315 DEFINE_THISCALL_WRAPPER(locale_facet__Decref, 4)
316 locale_facet* __thiscall locale_facet__Decref(locale_facet *this)
318 _Lockit lock;
319 locale_facet *ret;
321 TRACE("(%p)\n", this);
323 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
324 if(this->refs)
325 this->refs--;
327 ret = this->refs ? NULL : this;
328 _Lockit_dtor(&lock);
330 return ret;
333 /* ??0_Timevec@std@@QAE@ABV01@@Z */
334 /* ??0_Timevec@std@@QEAA@AEBV01@@Z */
335 /* This copy constructor modifies copied object */
336 DEFINE_THISCALL_WRAPPER(_Timevec_copy_ctor, 8)
337 _Timevec* __thiscall _Timevec_copy_ctor(_Timevec *this, _Timevec *copy)
339 TRACE("(%p %p)\n", this, copy);
340 this->timeptr = copy->timeptr;
341 copy->timeptr = NULL;
342 return this;
345 /* ??0_Timevec@std@@QAE@PAX@Z */
346 /* ??0_Timevec@std@@QEAA@PEAX@Z */
347 DEFINE_THISCALL_WRAPPER(_Timevec_ctor_timeptr, 8)
348 _Timevec* __thiscall _Timevec_ctor_timeptr(_Timevec *this, void *timeptr)
350 TRACE("(%p %p)\n", this, timeptr);
351 this->timeptr = timeptr;
352 return this;
355 /* ??_F_Timevec@std@@QAEXXZ */
356 /* ??_F_Timevec@std@@QEAAXXZ */
357 DEFINE_THISCALL_WRAPPER(_Timevec_ctor, 4)
358 _Timevec* __thiscall _Timevec_ctor(_Timevec *this)
360 TRACE("(%p)\n", this);
361 this->timeptr = NULL;
362 return this;
365 /* ??1_Timevec@std@@QAE@XZ */
366 /* ??1_Timevec@std@@QEAA@XZ */
367 DEFINE_THISCALL_WRAPPER(_Timevec_dtor, 4)
368 void __thiscall _Timevec_dtor(_Timevec *this)
370 TRACE("(%p)\n", this);
371 free(this->timeptr);
374 /* ??4_Timevec@std@@QAEAAV01@ABV01@@Z */
375 /* ??4_Timevec@std@@QEAAAEAV01@AEBV01@@Z */
376 DEFINE_THISCALL_WRAPPER(_Timevec_op_assign, 8)
377 _Timevec* __thiscall _Timevec_op_assign(_Timevec *this, _Timevec *right)
379 TRACE("(%p %p)\n", this, right);
380 this->timeptr = right->timeptr;
381 right->timeptr = NULL;
382 return this;
385 /* ?_Getptr@_Timevec@std@@QBEPAXXZ */
386 /* ?_Getptr@_Timevec@std@@QEBAPEAXXZ */
387 DEFINE_THISCALL_WRAPPER(_Timevec__Getptr, 4)
388 void* __thiscall _Timevec__Getptr(_Timevec *this)
390 TRACE("(%p)\n", this);
391 return this->timeptr;
394 /* ?_Locinfo_ctor@_Locinfo@std@@SAXPAV12@HPBD@Z */
395 /* ?_Locinfo_ctor@_Locinfo@std@@SAXPEAV12@HPEBD@Z */
396 _Locinfo* __cdecl _Locinfo__Locinfo_ctor_cat_cstr(_Locinfo *locinfo, int category, const char *locstr)
398 const char *locale = NULL;
400 /* This function is probably modifying more global objects */
401 FIXME("(%p %d %s) semi-stub\n", locinfo, category, locstr);
403 if(!locstr)
404 throw_exception(EXCEPTION_RUNTIME_ERROR, "bad locale name");
406 _Lockit_ctor_locktype(&locinfo->lock, _LOCK_LOCALE);
407 locale_string_char_ctor_cstr(&locinfo->days, "");
408 locale_string_char_ctor_cstr(&locinfo->months, "");
409 locale_string_char_ctor_cstr(&locinfo->oldlocname, setlocale(LC_ALL, NULL));
411 if(category)
412 locale = setlocale(LC_ALL, locstr);
413 else
414 locale = setlocale(LC_ALL, NULL);
416 if(locale)
417 locale_string_char_ctor_cstr(&locinfo->newlocname, locale);
418 else
419 locale_string_char_ctor_cstr(&locinfo->newlocname, "*");
421 return locinfo;
424 /* ??0_Locinfo@std@@QAE@HPBD@Z */
425 /* ??0_Locinfo@std@@QEAA@HPEBD@Z */
426 DEFINE_THISCALL_WRAPPER(_Locinfo_ctor_cat_cstr, 12)
427 _Locinfo* __thiscall _Locinfo_ctor_cat_cstr(_Locinfo *this, int category, const char *locstr)
429 return _Locinfo__Locinfo_ctor_cat_cstr(this, category, locstr);
432 /* ??0_Locinfo@std@@QAE@PBD@Z */
433 /* ??0_Locinfo@std@@QEAA@PEBD@Z */
434 DEFINE_THISCALL_WRAPPER(_Locinfo_ctor_cstr, 8)
435 _Locinfo* __thiscall _Locinfo_ctor_cstr(_Locinfo *this, const char *locstr)
437 return _Locinfo__Locinfo_ctor_cat_cstr(this, 1/*FIXME*/, locstr);
440 /* ?_Locinfo_dtor@_Locinfo@std@@SAXPAV12@@Z */
441 /* ?_Locinfo_dtor@_Locinfo@std@@SAXPEAV12@@Z */
442 void __cdecl _Locinfo__Locinfo_dtor(_Locinfo *locinfo)
444 TRACE("(%p)\n", locinfo);
446 setlocale(LC_ALL, locale_string_char_c_str(&locinfo->oldlocname));
447 locale_string_char_dtor(&locinfo->days);
448 locale_string_char_dtor(&locinfo->months);
449 locale_string_char_dtor(&locinfo->oldlocname);
450 locale_string_char_dtor(&locinfo->newlocname);
451 _Lockit_dtor(&locinfo->lock);
454 /* ??_F_Locinfo@std@@QAEXXZ */
455 /* ??_F_Locinfo@std@@QEAAXXZ */
456 DEFINE_THISCALL_WRAPPER(_Locinfo_ctor, 4)
457 _Locinfo* __thiscall _Locinfo_ctor(_Locinfo *this)
459 return _Locinfo__Locinfo_ctor_cat_cstr(this, 1/*FIXME*/, "C");
462 /* ??1_Locinfo@std@@QAE@XZ */
463 /* ??1_Locinfo@std@@QEAA@XZ */
464 DEFINE_THISCALL_WRAPPER(_Locinfo_dtor, 4)
465 void __thiscall _Locinfo_dtor(_Locinfo *this)
467 _Locinfo__Locinfo_dtor(this);
470 /* ?_Locinfo_Addcats@_Locinfo@std@@SAAAV12@PAV12@HPBD@Z */
471 /* ?_Locinfo_Addcats@_Locinfo@std@@SAAEAV12@PEAV12@HPEBD@Z */
472 _Locinfo* __cdecl _Locinfo__Locinfo_Addcats(_Locinfo *locinfo, int category, const char *locstr)
474 const char *locale = NULL;
476 /* This function is probably modifying more global objects */
477 FIXME("(%p %d %s) semi-stub\n", locinfo, category, locstr);
478 if(!locstr)
479 throw_exception(EXCEPTION_RUNTIME_ERROR, "bad locale name");
481 locale_string_char_dtor(&locinfo->newlocname);
483 if(category)
484 locale = setlocale(LC_ALL, locstr);
485 else
486 locale = setlocale(LC_ALL, NULL);
488 if(locale)
489 locale_string_char_ctor_cstr(&locinfo->newlocname, locale);
490 else
491 locale_string_char_ctor_cstr(&locinfo->newlocname, "*");
493 return locinfo;
496 /* ?_Addcats@_Locinfo@std@@QAEAAV12@HPBD@Z */
497 /* ?_Addcats@_Locinfo@std@@QEAAAEAV12@HPEBD@Z */
498 DEFINE_THISCALL_WRAPPER(_Locinfo__Addcats, 12)
499 _Locinfo* __thiscall _Locinfo__Addcats(_Locinfo *this, int category, const char *locstr)
501 return _Locinfo__Locinfo_Addcats(this, category, locstr);
504 /* _Getcoll */
505 ULONGLONG __cdecl _Getcoll(void)
507 union {
508 _Collvec collvec;
509 ULONGLONG ull;
510 } ret;
512 TRACE("\n");
514 ret.collvec.page = ___lc_collate_cp_func();
515 ret.collvec.handle = ___lc_handle_func()[LC_COLLATE];
516 return ret.ull;
519 /* ?_Getcoll@_Locinfo@std@@QBE?AU_Collvec@@XZ */
520 /* ?_Getcoll@_Locinfo@std@@QEBA?AU_Collvec@@XZ */
521 DEFINE_THISCALL_WRAPPER(_Locinfo__Getcoll, 8)
522 _Collvec* __thiscall _Locinfo__Getcoll(const _Locinfo *this, _Collvec *ret)
524 ULONGLONG ull = _Getcoll();
525 memcpy(ret, &ull, sizeof(ull));
526 return ret;
529 /* _Getctype */
530 _Ctypevec* __cdecl _Getctype(_Ctypevec *ret)
532 short *table;
534 TRACE("\n");
536 ret->page = ___lc_codepage_func();
537 #if _MSVCP_VER < 110
538 ret->handle = ___lc_handle_func()[LC_COLLATE];
539 #else
540 /* FIXME: use ___lc_locale_name_func() */
541 ret->name = NULL;
542 #endif
543 ret->delfl = TRUE;
544 table = malloc(sizeof(short[256]));
545 if(!table) throw_exception(EXCEPTION_BAD_ALLOC, NULL);
546 memcpy(table, __pctype_func(), sizeof(short[256]));
547 ret->table = table;
548 return ret;
551 /* ?_Getctype@_Locinfo@std@@QBE?AU_Ctypevec@@XZ */
552 /* ?_Getctype@_Locinfo@std@@QEBA?AU_Ctypevec@@XZ */
553 DEFINE_THISCALL_WRAPPER(_Locinfo__Getctype, 8)
554 _Ctypevec* __thiscall _Locinfo__Getctype(const _Locinfo *this, _Ctypevec *ret)
556 return _Getctype(ret);
559 /* _Getcvt */
560 ULONGLONG __cdecl _Getcvt(void)
562 union {
563 _Cvtvec cvtvec;
564 ULONGLONG ull;
565 } ret;
567 TRACE("\n");
569 ret.cvtvec.page = ___lc_codepage_func();
570 ret.cvtvec.handle = ___lc_handle_func()[LC_CTYPE];
571 return ret.ull;
574 /* ?_Getcvt@_Locinfo@std@@QBE?AU_Cvtvec@@XZ */
575 /* ?_Getcvt@_Locinfo@std@@QEBA?AU_Cvtvec@@XZ */
576 DEFINE_THISCALL_WRAPPER(_Locinfo__Getcvt, 8)
577 _Cvtvec* __thiscall _Locinfo__Getcvt(const _Locinfo *this, _Cvtvec *ret)
579 ULONGLONG ull = _Getcvt();
580 memcpy(ret, &ull, sizeof(ull));
581 return ret;
584 /* ?_Getdays@_Locinfo@std@@QBEPBDXZ */
585 /* ?_Getdays@_Locinfo@std@@QEBAPEBDXZ */
586 DEFINE_THISCALL_WRAPPER(_Locinfo__Getdays, 4)
587 const char* __thiscall _Locinfo__Getdays(_Locinfo *this)
589 char *days = _Getdays();
590 const char *ret;
592 TRACE("(%p)\n", this);
594 if(days) {
595 locale_string_char_dtor(&this->days);
596 locale_string_char_ctor_cstr(&this->days, days);
597 free(days);
600 ret = locale_string_char_c_str(&this->days);
601 if (!ret[0]) ret = ":Sun:Sunday:Mon:Monday:Tue:Tuesday:Wed:Wednesday:Thu:Thursday:Fri:Friday:Sat:Saturday";
602 return ret;
605 /* ?_Getmonths@_Locinfo@std@@QBEPBDXZ */
606 /* ?_Getmonths@_Locinfo@std@@QEBAPEBDXZ */
607 DEFINE_THISCALL_WRAPPER(_Locinfo__Getmonths, 4)
608 const char* __thiscall _Locinfo__Getmonths(_Locinfo *this)
610 char *months = _Getmonths();
611 const char *ret;
613 TRACE("(%p)\n", this);
615 if(months) {
616 locale_string_char_dtor(&this->months);
617 locale_string_char_ctor_cstr(&this->months, months);
618 free(months);
621 ret = locale_string_char_c_str(&this->months);
622 if (!ret[0]) ret = ":Jan:January:Feb:February:Mar:March:Apr:April:May:May:Jun:June:Jul:July"
623 ":Aug:August:Sep:September:Oct:October:Nov:November:Dec:December";
624 return ret;
627 /* ?_Getfalse@_Locinfo@std@@QBEPBDXZ */
628 /* ?_Getfalse@_Locinfo@std@@QEBAPEBDXZ */
629 DEFINE_THISCALL_WRAPPER(_Locinfo__Getfalse, 4)
630 const char* __thiscall _Locinfo__Getfalse(const _Locinfo *this)
632 TRACE("(%p)\n", this);
633 return "false";
636 /* ?_Gettrue@_Locinfo@std@@QBEPBDXZ */
637 /* ?_Gettrue@_Locinfo@std@@QEBAPEBDXZ */
638 DEFINE_THISCALL_WRAPPER(_Locinfo__Gettrue, 4)
639 const char* __thiscall _Locinfo__Gettrue(const _Locinfo *this)
641 TRACE("(%p)\n", this);
642 return "true";
645 /* ?_Getlconv@_Locinfo@std@@QBEPBUlconv@@XZ */
646 /* ?_Getlconv@_Locinfo@std@@QEBAPEBUlconv@@XZ */
647 DEFINE_THISCALL_WRAPPER(_Locinfo__Getlconv, 4)
648 const struct lconv* __thiscall _Locinfo__Getlconv(const _Locinfo *this)
650 TRACE("(%p)\n", this);
651 return localeconv();
654 /* ?_Getname@_Locinfo@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
655 /* ?_Getname@_Locinfo@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
656 DEFINE_THISCALL_WRAPPER(_Locinfo__Getname, 8)
657 basic_string_char* __thiscall _Locinfo__Getname(const _Locinfo *this, basic_string_char *ret)
659 TRACE("(%p)\n", this);
661 MSVCP_basic_string_char_copy_ctor(ret, &this->newlocname);
662 return ret;
665 /* ?_Gettnames@_Locinfo@std@@QBE?AV_Timevec@2@XZ */
666 /* ?_Gettnames@_Locinfo@std@@QEBA?AV_Timevec@2@XZ */
667 DEFINE_THISCALL_WRAPPER(_Locinfo__Gettnames, 8)
668 _Timevec*__thiscall _Locinfo__Gettnames(const _Locinfo *this, _Timevec *ret)
670 TRACE("(%p)\n", this);
672 _Timevec_ctor_timeptr(ret, _Gettnames());
673 return ret;
676 /* ?id@?$collate@D@std@@2V0locale@2@A */
677 locale_id collate_char_id = {0};
679 /* ??_7?$collate@D@std@@6B@ */
680 extern const vtable_ptr MSVCP_collate_char_vtable;
682 /* ?_Init@?$collate@D@std@@IAEXABV_Locinfo@2@@Z */
683 /* ?_Init@?$collate@D@std@@IEAAXAEBV_Locinfo@2@@Z */
684 DEFINE_THISCALL_WRAPPER(collate_char__Init, 8)
685 void __thiscall collate_char__Init(collate *this, const _Locinfo *locinfo)
687 TRACE("(%p %p)\n", this, locinfo);
688 _Locinfo__Getcoll(locinfo, &this->coll);
691 /* ??0?$collate@D@std@@IAE@PBDI@Z */
692 /* ??0?$collate@D@std@@IEAA@PEBD_K@Z */
693 DEFINE_THISCALL_WRAPPER(collate_char_ctor_name, 12)
694 collate* __thiscall collate_char_ctor_name(collate *this, const char *name, MSVCP_size_t refs)
696 _Locinfo locinfo;
698 TRACE("(%p %s %lu)\n", this, name, refs);
700 locale_facet_ctor_refs(&this->facet, refs);
701 this->facet.vtable = &MSVCP_collate_char_vtable;
703 _Locinfo_ctor_cstr(&locinfo, name);
704 collate_char__Init(this, &locinfo);
705 _Locinfo_dtor(&locinfo);
706 return this;
709 /* ??0?$collate@D@std@@QAE@ABV_Locinfo@1@I@Z */
710 /* ??0?$collate@D@std@@QEAA@AEBV_Locinfo@1@_K@Z */
711 DEFINE_THISCALL_WRAPPER(collate_char_ctor_locinfo, 12)
712 collate* __thiscall collate_char_ctor_locinfo(collate *this, const _Locinfo *locinfo, MSVCP_size_t refs)
714 TRACE("(%p %p %lu)\n", this, locinfo, refs);
716 locale_facet_ctor_refs(&this->facet, refs);
717 this->facet.vtable = &MSVCP_collate_char_vtable;
718 collate_char__Init(this, locinfo);
719 return this;
722 /* ??0?$collate@D@std@@QAE@I@Z */
723 /* ??0?$collate@D@std@@QEAA@_K@Z */
724 DEFINE_THISCALL_WRAPPER(collate_char_ctor_refs, 8)
725 collate* __thiscall collate_char_ctor_refs(collate *this, MSVCP_size_t refs)
727 return collate_char_ctor_name(this, "C", refs);
730 /* ??1?$collate@D@std@@UAE@XZ */
731 /* ??1?$collate@D@std@@UEAA@XZ */
732 /* ??1?$collate@D@std@@MAE@XZ */
733 /* ??1?$collate@D@std@@MEAA@XZ */
734 DEFINE_THISCALL_WRAPPER(collate_char_dtor, 4)
735 void __thiscall collate_char_dtor(collate *this)
737 TRACE("(%p)\n", this);
740 DEFINE_THISCALL_WRAPPER(collate_char_vector_dtor, 8)
741 collate* __thiscall collate_char_vector_dtor(collate *this, unsigned int flags)
743 TRACE("(%p %x)\n", this, flags);
744 if(flags & 2) {
745 /* we have an array, with the number of elements stored before the first object */
746 INT_PTR i, *ptr = (INT_PTR *)this-1;
748 for(i=*ptr-1; i>=0; i--)
749 collate_char_dtor(this+i);
750 MSVCRT_operator_delete(ptr);
751 } else {
752 collate_char_dtor(this);
753 if(flags & 1)
754 MSVCRT_operator_delete(this);
757 return this;
760 /* ??_F?$collate@D@std@@QAEXXZ */
761 /* ??_F?$collate@D@std@@QEAAXXZ */
762 DEFINE_THISCALL_WRAPPER(collate_char_ctor, 4)
763 collate* __thiscall collate_char_ctor(collate *this)
765 return collate_char_ctor_name(this, "C", 0);
768 /* ?_Getcat@?$collate@D@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
769 /* ?_Getcat@?$collate@D@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
770 MSVCP_size_t __cdecl collate_char__Getcat(const locale_facet **facet, const locale *loc)
772 TRACE("(%p %p)\n", facet, loc);
774 if(facet && !*facet) {
775 *facet = MSVCRT_operator_new(sizeof(collate));
776 if(!*facet) {
777 ERR("Out of memory\n");
778 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
779 return 0;
781 collate_char_ctor_name((collate*)*facet,
782 locale_string_char_c_str(&loc->ptr->name), 0);
785 return LC_COLLATE;
788 static collate* collate_char_use_facet(const locale *loc)
790 static collate *obj = NULL;
792 _Lockit lock;
793 const locale_facet *fac;
795 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
796 fac = locale__Getfacet(loc, locale_id_operator_size_t(&collate_char_id), TRUE);
797 if(fac) {
798 _Lockit_dtor(&lock);
799 return (collate*)fac;
802 if(obj) {
803 _Lockit_dtor(&lock);
804 return obj;
807 collate_char__Getcat(&fac, loc);
808 obj = (collate*)fac;
809 locale_facet__Incref(&obj->facet);
810 locale_facet_register(&obj->facet);
811 _Lockit_dtor(&lock);
813 return obj;
816 /* _Strcoll */
817 int __cdecl _Strcoll(const char *first1, const char *last1, const char *first2,
818 const char *last2, const _Collvec *coll)
820 LCID lcid;
822 TRACE("(%s %s)\n", debugstr_an(first1, last1-first1), debugstr_an(first2, last2-first2));
824 if(coll)
825 lcid = coll->handle;
826 else
827 lcid = ___lc_handle_func()[LC_COLLATE];
828 return CompareStringA(lcid, 0, first1, last1-first1, first2, last2-first2)-CSTR_EQUAL;
831 /* ?do_compare@?$collate@D@std@@MBEHPBD000@Z */
832 /* ?do_compare@?$collate@D@std@@MEBAHPEBD000@Z */
833 DEFINE_THISCALL_WRAPPER(collate_char_do_compare, 20)
834 #define call_collate_char_do_compare(this, first1, last1, first2, last2) CALL_VTBL_FUNC(this, 4, int, \
835 (const collate*, const char*, const char*, const char*, const char*), \
836 (this, first1, last1, first2, last2))
837 int __thiscall collate_char_do_compare(const collate *this, const char *first1,
838 const char *last1, const char *first2, const char *last2)
840 TRACE("(%p %p %p %p %p)\n", this, first1, last1, first2, last2);
841 return _Strcoll(first1, last1, first2, last2, &this->coll);
844 /* ?compare@?$collate@D@std@@QBEHPBD000@Z */
845 /* ?compare@?$collate@D@std@@QEBAHPEBD000@Z */
846 DEFINE_THISCALL_WRAPPER(collate_char_compare, 20)
847 int __thiscall collate_char_compare(const collate *this, const char *first1,
848 const char *last1, const char *first2, const char *last2)
850 TRACE("(%p %p %p %p %p)\n", this, first1, last1, first2, last2);
851 return call_collate_char_do_compare(this, first1, last1, first2, last2);
854 /* ?do_hash@?$collate@D@std@@MBEJPBD0@Z */
855 /* ?do_hash@?$collate@D@std@@MEBAJPEBD0@Z */
856 DEFINE_THISCALL_WRAPPER(collate_char_do_hash, 12)
857 #define call_collate_char_do_hash(this, first, last) CALL_VTBL_FUNC(this, 12, LONG, \
858 (const collate*, const char*, const char*), (this, first, last))
859 LONG __thiscall collate_char_do_hash(const collate *this,
860 const char *first, const char *last)
862 ULONG ret = 0;
864 TRACE("(%p %p %p)\n", this, first, last);
866 for(; first<last; first++)
867 ret = (ret<<8 | ret>>24) + *first;
868 return ret;
871 /* ?hash@?$collate@D@std@@QBEJPBD0@Z */
872 /* ?hash@?$collate@D@std@@QEBAJPEBD0@Z */
873 DEFINE_THISCALL_WRAPPER(collate_char_hash, 12)
874 LONG __thiscall collate_char_hash(const collate *this,
875 const char *first, const char *last)
877 TRACE("(%p %p %p)\n", this, first, last);
878 return call_collate_char_do_hash(this, first, last);
881 /* ?do_transform@?$collate@D@std@@MBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@PBD0@Z */
882 /* ?do_transform@?$collate@D@std@@MEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@PEBD0@Z */
883 DEFINE_THISCALL_WRAPPER(collate_char_do_transform, 16)
884 basic_string_char* __thiscall collate_char_do_transform(const collate *this,
885 basic_string_char *ret, const char *first, const char *last)
887 FIXME("(%p %p %p) stub\n", this, first, last);
888 return ret;
891 /* ?transform@?$collate@D@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@PBD0@Z */
892 /* ?transform@?$collate@D@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@PEBD0@Z */
893 DEFINE_THISCALL_WRAPPER(collate_char_transform, 16)
894 basic_string_char* __thiscall collate_char_transform(const collate *this,
895 basic_string_char *ret, const char *first, const char *last)
897 FIXME("(%p %p %p) stub\n", this, first, last);
898 return ret;
901 /* ?id@?$collate@_W@std@@2V0locale@2@A */
902 locale_id collate_wchar_id = {0};
903 /* ?id@?$collate@G@std@@2V0locale@2@A */
904 locale_id collate_short_id = {0};
906 /* ??_7?$collate@_W@std@@6B@ */
907 extern const vtable_ptr MSVCP_collate_wchar_vtable;
908 /* ??_7?$collate@G@std@@6B@ */
909 extern const vtable_ptr MSVCP_collate_short_vtable;
911 /* ?_Init@?$collate@_W@std@@IAEXABV_Locinfo@2@@Z */
912 /* ?_Init@?$collate@_W@std@@IEAAXAEBV_Locinfo@2@@Z */
913 /* ?_Init@?$collate@G@std@@IAEXABV_Locinfo@2@@Z */
914 /* ?_Init@?$collate@G@std@@IEAAXAEBV_Locinfo@2@@Z */
915 DEFINE_THISCALL_WRAPPER(collate_wchar__Init, 8)
916 void __thiscall collate_wchar__Init(collate *this, const _Locinfo *locinfo)
918 TRACE("(%p %p)\n", this, locinfo);
919 _Locinfo__Getcoll(locinfo, &this->coll);
922 /* ??0?$collate@_W@std@@IAE@PBDI@Z */
923 /* ??0?$collate@_W@std@@IEAA@PEBD_K@Z */
924 DEFINE_THISCALL_WRAPPER(collate_wchar_ctor_name, 12)
925 collate* __thiscall collate_wchar_ctor_name(collate *this, const char *name, MSVCP_size_t refs)
927 _Locinfo locinfo;
929 TRACE("(%p %s %lu)\n", this, name, refs);
931 locale_facet_ctor_refs(&this->facet, refs);
932 this->facet.vtable = &MSVCP_collate_wchar_vtable;
934 _Locinfo_ctor_cstr(&locinfo, name);
935 collate_wchar__Init(this, &locinfo);
936 _Locinfo_dtor(&locinfo);
937 return this;
940 /* ??0?$collate@_W@std@@QAE@ABV_Locinfo@1@I@Z */
941 /* ??0?$collate@_W@std@@QEAA@AEBV_Locinfo@1@_K@Z */
942 DEFINE_THISCALL_WRAPPER(collate_wchar_ctor_locinfo, 12)
943 collate* __thiscall collate_wchar_ctor_locinfo(collate *this, const _Locinfo *locinfo, MSVCP_size_t refs)
945 TRACE("(%p %p %lu)\n", this, locinfo, refs);
947 locale_facet_ctor_refs(&this->facet, refs);
948 this->facet.vtable = &MSVCP_collate_wchar_vtable;
949 collate_wchar__Init(this, locinfo);
950 return this;
953 /* ??0?$collate@G@std@@QAE@ABV_Locinfo@1@I@Z */
954 /* ??0?$collate@G@std@@QEAA@AEBV_Locinfo@1@_K@Z */
955 DEFINE_THISCALL_WRAPPER(collate_short_ctor_locinfo, 12)
956 collate* __thiscall collate_short_ctor_locinfo(collate *this, const _Locinfo *locinfo, MSVCP_size_t refs)
958 collate *ret = collate_wchar_ctor_locinfo(this, locinfo, refs);
959 ret->facet.vtable = &MSVCP_collate_short_vtable;
960 return ret;
963 /* ??0?$collate@_W@std@@QAE@I@Z */
964 /* ??0?$collate@_W@std@@QEAA@_K@Z */
965 DEFINE_THISCALL_WRAPPER(collate_wchar_ctor_refs, 8)
966 collate* __thiscall collate_wchar_ctor_refs(collate *this, MSVCP_size_t refs)
968 return collate_wchar_ctor_name(this, "C", refs);
971 /* ??0?$collate@G@std@@QAE@I@Z */
972 /* ??0?$collate@G@std@@QEAA@_K@Z */
973 DEFINE_THISCALL_WRAPPER(collate_short_ctor_refs, 8)
974 collate* __thiscall collate_short_ctor_refs(collate *this, MSVCP_size_t refs)
976 collate *ret = collate_wchar_ctor_refs(this, refs);
977 ret->facet.vtable = &MSVCP_collate_short_vtable;
978 return ret;
981 /* ??1?$collate@G@std@@UAE@XZ */
982 /* ??1?$collate@G@std@@UEAA@XZ */
983 /* ??1?$collate@_W@std@@MAE@XZ */
984 /* ??1?$collate@_W@std@@MEAA@XZ */
985 /* ??1?$collate@G@std@@MAE@XZ */
986 /* ??1?$collate@G@std@@MEAA@XZ */
987 DEFINE_THISCALL_WRAPPER(collate_wchar_dtor, 4)
988 void __thiscall collate_wchar_dtor(collate *this)
990 TRACE("(%p)\n", this);
993 DEFINE_THISCALL_WRAPPER(collate_wchar_vector_dtor, 8)
994 collate* __thiscall collate_wchar_vector_dtor(collate *this, unsigned int flags)
996 TRACE("(%p %x)\n", this, flags);
997 if(flags & 2) {
998 /* we have an array, with the number of elements stored before the first object */
999 INT_PTR i, *ptr = (INT_PTR *)this-1;
1001 for(i=*ptr-1; i>=0; i--)
1002 collate_wchar_dtor(this+i);
1003 MSVCRT_operator_delete(ptr);
1004 } else {
1005 collate_wchar_dtor(this);
1006 if(flags & 1)
1007 MSVCRT_operator_delete(this);
1010 return this;
1013 /* ??_F?$collate@_W@std@@QAEXXZ */
1014 /* ??_F?$collate@_W@std@@QEAAXXZ */
1015 DEFINE_THISCALL_WRAPPER(collate_wchar_ctor, 4)
1016 collate* __thiscall collate_wchar_ctor(collate *this)
1018 return collate_wchar_ctor_name(this, "C", 0);
1021 /* ??_F?$collate@G@std@@QAEXXZ */
1022 /* ??_F?$collate@G@std@@QEAAXXZ */
1023 DEFINE_THISCALL_WRAPPER(collate_short_ctor, 4)
1024 collate* __thiscall collate_short_ctor(collate *this)
1026 collate *ret = collate_wchar_ctor(this);
1027 ret->facet.vtable = &MSVCP_collate_short_vtable;
1028 return ret;
1031 /* ?_Getcat@?$collate@_W@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
1032 /* ?_Getcat@?$collate@_W@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
1033 MSVCP_size_t __cdecl collate_wchar__Getcat(const locale_facet **facet, const locale *loc)
1035 TRACE("(%p %p)\n", facet, loc);
1037 if(facet && !*facet) {
1038 *facet = MSVCRT_operator_new(sizeof(collate));
1039 if(!*facet) {
1040 ERR("Out of memory\n");
1041 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
1042 return 0;
1044 collate_wchar_ctor_name((collate*)*facet,
1045 locale_string_char_c_str(&loc->ptr->name), 0);
1048 return LC_COLLATE;
1051 static collate* collate_wchar_use_facet(const locale *loc)
1053 static collate *obj = NULL;
1055 _Lockit lock;
1056 const locale_facet *fac;
1058 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
1059 fac = locale__Getfacet(loc, locale_id_operator_size_t(&collate_wchar_id), TRUE);
1060 if(fac) {
1061 _Lockit_dtor(&lock);
1062 return (collate*)fac;
1065 if(obj) {
1066 _Lockit_dtor(&lock);
1067 return obj;
1070 collate_wchar__Getcat(&fac, loc);
1071 obj = (collate*)fac;
1072 locale_facet__Incref(&obj->facet);
1073 locale_facet_register(&obj->facet);
1074 _Lockit_dtor(&lock);
1076 return obj;
1079 /* ?_Getcat@?$collate@G@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
1080 /* ?_Getcat@?$collate@G@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
1081 MSVCP_size_t __cdecl collate_short__Getcat(const locale_facet **facet, const locale *loc)
1083 if(facet && !*facet) {
1084 collate_wchar__Getcat(facet, loc);
1085 (*(locale_facet**)facet)->vtable = &MSVCP_collate_short_vtable;
1088 return LC_COLLATE;
1091 static collate* collate_short_use_facet(const locale *loc)
1093 static collate *obj = NULL;
1095 _Lockit lock;
1096 const locale_facet *fac;
1098 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
1099 fac = locale__Getfacet(loc, locale_id_operator_size_t(&collate_short_id), TRUE);
1100 if(fac) {
1101 _Lockit_dtor(&lock);
1102 return (collate*)fac;
1105 if(obj) {
1106 _Lockit_dtor(&lock);
1107 return obj;
1110 collate_short__Getcat(&fac, loc);
1111 obj = (collate*)fac;
1112 locale_facet__Incref(&obj->facet);
1113 locale_facet_register(&obj->facet);
1114 _Lockit_dtor(&lock);
1116 return obj;
1119 /* _Wcscoll */
1120 int __cdecl _Wcscoll(const wchar_t *first1, const wchar_t *last1, const wchar_t *first2,
1121 const wchar_t *last2, const _Collvec *coll)
1123 LCID lcid;
1125 TRACE("(%s %s)\n", debugstr_wn(first1, last1-first1), debugstr_wn(first2, last2-first2));
1127 if(coll)
1128 lcid = coll->handle;
1129 else
1130 lcid = ___lc_handle_func()[LC_COLLATE];
1131 return CompareStringW(lcid, 0, first1, last1-first1, first2, last2-first2)-CSTR_EQUAL;
1134 /* ?do_compare@?$collate@_W@std@@MBEHPB_W000@Z */
1135 /* ?do_compare@?$collate@_W@std@@MEBAHPEB_W000@Z */
1136 /* ?do_compare@?$collate@G@std@@MBEHPBG000@Z */
1137 /* ?do_compare@?$collate@G@std@@MEBAHPEBG000@Z */
1138 DEFINE_THISCALL_WRAPPER(collate_wchar_do_compare, 20)
1139 #define call_collate_wchar_do_compare(this, first1, last1, first2, last2) CALL_VTBL_FUNC(this, 4, int, \
1140 (const collate*, const wchar_t*, const wchar_t*, const wchar_t*, const wchar_t*), \
1141 (this, first1, last1, first2, last2))
1142 int __thiscall collate_wchar_do_compare(const collate *this, const wchar_t *first1,
1143 const wchar_t *last1, const wchar_t *first2, const wchar_t *last2)
1145 TRACE("(%p %p %p %p %p)\n", this, first1, last1, first2, last2);
1146 return _Wcscoll(first1, last1, first2, last2, &this->coll);
1149 /* ?compare@?$collate@_W@std@@QBEHPB_W000@Z */
1150 /* ?compare@?$collate@_W@std@@QEBAHPEB_W000@Z */
1151 /* ?compare@?$collate@G@std@@QBEHPBG000@Z */
1152 /* ?compare@?$collate@G@std@@QEBAHPEBG000@Z */
1153 DEFINE_THISCALL_WRAPPER(collate_wchar_compare, 20)
1154 int __thiscall collate_wchar_compare(const collate *this, const wchar_t *first1,
1155 const wchar_t *last1, const wchar_t *first2, const wchar_t *last2)
1157 TRACE("(%p %p %p %p %p)\n", this, first1, last1, first2, last2);
1158 return call_collate_wchar_do_compare(this, first1, last1, first2, last2);
1161 /* ?do_hash@?$collate@_W@std@@MBEJPB_W0@Z */
1162 /* ?do_hash@?$collate@_W@std@@MEBAJPEB_W0@Z */
1163 /* ?do_hash@?$collate@G@std@@MBEJPBG0@Z */
1164 /* ?do_hash@?$collate@G@std@@MEBAJPEBG0@Z */
1165 DEFINE_THISCALL_WRAPPER(collate_wchar_do_hash, 12)
1166 #define call_collate_wchar_do_hash(this, first, last) CALL_VTBL_FUNC(this, 12, LONG, \
1167 (const collate*, const wchar_t*, const wchar_t*), (this, first, last))
1168 LONG __thiscall collate_wchar_do_hash(const collate *this,
1169 const wchar_t *first, const wchar_t *last)
1171 ULONG ret = 0;
1173 TRACE("(%p %p %p)\n", this, first, last);
1175 for(; first<last; first++)
1176 ret = (ret<<8 | ret>>24) + *first;
1177 return ret;
1180 /* ?hash@?$collate@_W@std@@QBEJPB_W0@Z */
1181 /* ?hash@?$collate@_W@std@@QEBAJPEB_W0@Z */
1182 /* ?hash@?$collate@G@std@@QBEJPBG0@Z */
1183 /* ?hash@?$collate@G@std@@QEBAJPEBG0@Z */
1184 DEFINE_THISCALL_WRAPPER(collate_wchar_hash, 12)
1185 LONG __thiscall collate_wchar_hash(const collate *this,
1186 const wchar_t *first, const wchar_t *last)
1188 TRACE("(%p %p %p)\n", this, first, last);
1189 return call_collate_wchar_do_hash(this, first, last);
1192 /* ?do_transform@?$collate@_W@std@@MBE?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@PB_W0@Z */
1193 /* ?do_transform@?$collate@_W@std@@MEBA?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@PEB_W0@Z */
1194 /* ?do_transform@?$collate@G@std@@MBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@PBG0@Z */
1195 /* ?do_transform@?$collate@G@std@@MEBA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@PEBG0@Z */
1196 DEFINE_THISCALL_WRAPPER(collate_wchar_do_transform, 16)
1197 basic_string_wchar* __thiscall collate_wchar_do_transform(const collate *this,
1198 basic_string_wchar *ret, const wchar_t *first, const wchar_t *last)
1200 FIXME("(%p %p %p) stub\n", this, first, last);
1201 return ret;
1204 /* ?transform@?$collate@_W@std@@QBE?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@PB_W0@Z */
1205 /* ?transform@?$collate@_W@std@@QEBA?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@PEB_W0@Z */
1206 /* ?transform@?$collate@G@std@@QBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@PBG0@Z */
1207 /* ?transform@?$collate@G@std@@QEBA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@PEBG0@Z */
1208 DEFINE_THISCALL_WRAPPER(collate_wchar_transform, 16)
1209 basic_string_wchar* __thiscall collate_wchar_transform(const collate *this,
1210 basic_string_wchar *ret, const wchar_t *first, const wchar_t *last)
1212 FIXME("(%p %p %p) stub\n", this, first, last);
1213 return ret;
1216 /* ??_7ctype_base@std@@6B@ */
1217 extern const vtable_ptr MSVCP_ctype_base_vtable;
1219 /* ??0ctype_base@std@@QAE@I@Z */
1220 /* ??0ctype_base@std@@QEAA@_K@Z */
1221 DEFINE_THISCALL_WRAPPER(ctype_base_ctor_refs, 8)
1222 ctype_base* __thiscall ctype_base_ctor_refs(ctype_base *this, MSVCP_size_t refs)
1224 TRACE("(%p %lu)\n", this, refs);
1225 locale_facet_ctor_refs(&this->facet, refs);
1226 this->facet.vtable = &MSVCP_ctype_base_vtable;
1227 return this;
1230 /* ??_Fctype_base@std@@QAEXXZ */
1231 /* ??_Fctype_base@std@@QEAAXXZ */
1232 DEFINE_THISCALL_WRAPPER(ctype_base_ctor, 4)
1233 ctype_base* __thiscall ctype_base_ctor(ctype_base *this)
1235 TRACE("(%p)\n", this);
1236 locale_facet_ctor_refs(&this->facet, 0);
1237 this->facet.vtable = &MSVCP_ctype_base_vtable;
1238 return this;
1241 /* ??1ctype_base@std@@UAE@XZ */
1242 /* ??1ctype_base@std@@UEAA@XZ */
1243 DEFINE_THISCALL_WRAPPER(ctype_base_dtor, 4)
1244 void __thiscall ctype_base_dtor(ctype_base *this)
1246 TRACE("(%p)\n", this);
1249 DEFINE_THISCALL_WRAPPER(ctype_base_vector_dtor, 8)
1250 ctype_base* __thiscall ctype_base_vector_dtor(ctype_base *this, unsigned int flags)
1252 TRACE("(%p %x)\n", this, flags);
1253 if(flags & 2) {
1254 /* we have an array, with the number of elements stored before the first object */
1255 INT_PTR i, *ptr = (INT_PTR *)this-1;
1257 for(i=*ptr-1; i>=0; i--)
1258 ctype_base_dtor(this+i);
1259 MSVCRT_operator_delete(ptr);
1260 } else {
1261 ctype_base_dtor(this);
1262 if(flags & 1)
1263 MSVCRT_operator_delete(this);
1266 return this;
1269 /* ?id@?$ctype@D@std@@2V0locale@2@A */
1270 locale_id ctype_char_id = {0};
1271 /* ?table_size@?$ctype@D@std@@2IB */
1272 /* ?table_size@?$ctype@D@std@@2_KB */
1273 MSVCP_size_t ctype_char_table_size = 256;
1275 /* ??_7?$ctype@D@std@@6B@ */
1276 extern const vtable_ptr MSVCP_ctype_char_vtable;
1278 /* ?_Init@?$ctype@D@std@@IAEXABV_Locinfo@2@@Z */
1279 /* ?_Init@?$ctype@D@std@@IEAAXAEBV_Locinfo@2@@Z */
1280 DEFINE_THISCALL_WRAPPER(ctype_char__Init, 8)
1281 void __thiscall ctype_char__Init(ctype_char *this, const _Locinfo *locinfo)
1283 TRACE("(%p %p)\n", this, locinfo);
1284 _Locinfo__Getctype(locinfo, &this->ctype);
1287 /* ?_Tidy@?$ctype@D@std@@IAEXXZ */
1288 /* ?_Tidy@?$ctype@D@std@@IEAAXXZ */
1289 DEFINE_THISCALL_WRAPPER(ctype_char__Tidy, 4)
1290 void __thiscall ctype_char__Tidy(ctype_char *this)
1292 TRACE("(%p)\n", this);
1294 if(this->ctype.delfl)
1295 free((short*)this->ctype.table);
1298 /* ?classic_table@?$ctype@D@std@@KAPBFXZ */
1299 /* ?classic_table@?$ctype@D@std@@KAPEBFXZ */
1300 const short* __cdecl ctype_char_classic_table(void)
1302 TRACE("()\n");
1303 return &((short*)GetProcAddress(GetModuleHandleA("msvcrt.dll"), "_ctype"))[1];
1306 /* ??0?$ctype@D@std@@QAE@ABV_Locinfo@1@I@Z */
1307 /* ??0?$ctype@D@std@@QEAA@AEBV_Locinfo@1@_K@Z */
1308 DEFINE_THISCALL_WRAPPER(ctype_char_ctor_locinfo, 12)
1309 ctype_char* __thiscall ctype_char_ctor_locinfo(ctype_char *this,
1310 const _Locinfo *locinfo, MSVCP_size_t refs)
1312 TRACE("(%p %p %lu)\n", this, locinfo, refs);
1313 ctype_base_ctor_refs(&this->base, refs);
1314 this->base.facet.vtable = &MSVCP_ctype_char_vtable;
1315 ctype_char__Init(this, locinfo);
1316 return this;
1319 /* ??0?$ctype@D@std@@QAE@PBF_NI@Z */
1320 /* ??0?$ctype@D@std@@QEAA@PEBF_N_K@Z */
1321 DEFINE_THISCALL_WRAPPER(ctype_char_ctor_table, 16)
1322 ctype_char* __thiscall ctype_char_ctor_table(ctype_char *this,
1323 const short *table, MSVCP_bool delete, MSVCP_size_t refs)
1325 _Locinfo locinfo;
1327 TRACE("(%p %p %d %lu)\n", this, table, delete, refs);
1329 ctype_base_ctor_refs(&this->base, refs);
1330 this->base.facet.vtable = &MSVCP_ctype_char_vtable;
1332 _Locinfo_ctor(&locinfo);
1333 ctype_char__Init(this, &locinfo);
1334 _Locinfo_dtor(&locinfo);
1336 if(table) {
1337 ctype_char__Tidy(this);
1338 this->ctype.table = table;
1339 this->ctype.delfl = delete;
1341 return this;
1344 /* ??_F?$ctype@D@std@@QAEXXZ */
1345 /* ??_F?$ctype@D@std@@QEAAXXZ */
1346 DEFINE_THISCALL_WRAPPER(ctype_char_ctor, 4)
1347 ctype_char* __thiscall ctype_char_ctor(ctype_char *this)
1349 return ctype_char_ctor_table(this, NULL, FALSE, 0);
1352 /* ??1?$ctype@D@std@@UAE@XZ */
1353 /* ??1?$ctype@D@std@@UEAA@XZ */
1354 /* ??1?$ctype@D@std@@MAE@XZ */
1355 /* ??1?$ctype@D@std@@MEAA@XZ */
1356 DEFINE_THISCALL_WRAPPER(ctype_char_dtor, 4)
1357 void __thiscall ctype_char_dtor(ctype_char *this)
1359 TRACE("(%p)\n", this);
1360 ctype_char__Tidy(this);
1363 DEFINE_THISCALL_WRAPPER(ctype_char_vector_dtor, 8)
1364 ctype_char* __thiscall ctype_char_vector_dtor(ctype_char *this, unsigned int flags)
1366 TRACE("(%p %x)\n", this, flags);
1367 if(flags & 2) {
1368 /* we have an array, with the number of elements stored before the first object */
1369 INT_PTR i, *ptr = (INT_PTR *)this-1;
1371 for(i=*ptr-1; i>=0; i--)
1372 ctype_char_dtor(this+i);
1373 MSVCRT_operator_delete(ptr);
1374 } else {
1375 ctype_char_dtor(this);
1376 if(flags & 1)
1377 MSVCRT_operator_delete(this);
1380 return this;
1383 /* ?do_narrow@?$ctype@D@std@@MBEDDD@Z */
1384 /* ?do_narrow@?$ctype@D@std@@MEBADDD@Z */
1385 DEFINE_THISCALL_WRAPPER(ctype_char_do_narrow_ch, 12)
1386 #define call_ctype_char_do_narrow_ch(this, ch, unused) CALL_VTBL_FUNC(this, 32, \
1387 char, (const ctype_char*, char, char), (this, ch, unused))
1388 char __thiscall ctype_char_do_narrow_ch(const ctype_char *this, char ch, char unused)
1390 TRACE("(%p %c %c)\n", this, ch, unused);
1391 return ch;
1394 /* ?do_narrow@?$ctype@D@std@@MBEPBDPBD0DPAD@Z */
1395 /* ?do_narrow@?$ctype@D@std@@MEBAPEBDPEBD0DPEAD@Z */
1396 DEFINE_THISCALL_WRAPPER(ctype_char_do_narrow, 20)
1397 #define call_ctype_char_do_narrow(this, first, last, unused, dest) CALL_VTBL_FUNC(this, 28, \
1398 const char*, (const ctype_char*, const char*, const char*, char, char*), \
1399 (this, first, last, unused, dest))
1400 const char* __thiscall ctype_char_do_narrow(const ctype_char *this,
1401 const char *first, const char *last, char unused, char *dest)
1403 TRACE("(%p %p %p %p)\n", this, first, last, dest);
1404 memcpy(dest, first, last-first);
1405 return last;
1408 /* ?narrow@?$ctype@D@std@@QBEDDD@Z */
1409 /* ?narrow@?$ctype@D@std@@QEBADDD@Z */
1410 DEFINE_THISCALL_WRAPPER(ctype_char_narrow_ch, 12)
1411 char __thiscall ctype_char_narrow_ch(const ctype_char *this, char ch, char dflt)
1413 TRACE("(%p %c %c)\n", this, ch, dflt);
1414 return call_ctype_char_do_narrow_ch(this, ch, dflt);
1417 /* ?narrow@?$ctype@D@std@@QBEPBDPBD0DPAD@Z */
1418 /* ?narrow@?$ctype@D@std@@QEBAPEBDPEBD0DPEAD@Z */
1419 DEFINE_THISCALL_WRAPPER(ctype_char_narrow, 20)
1420 const char* __thiscall ctype_char_narrow(const ctype_char *this,
1421 const char *first, const char *last, char dflt, char *dest)
1423 TRACE("(%p %p %p %c %p)\n", this, first, last, dflt, dest);
1424 return call_ctype_char_do_narrow(this, first, last, dflt, dest);
1427 /* ?do_widen@?$ctype@D@std@@MBEDD@Z */
1428 /* ?do_widen@?$ctype@D@std@@MEBADD@Z */
1429 DEFINE_THISCALL_WRAPPER(ctype_char_do_widen_ch, 8)
1430 #define call_ctype_char_do_widen_ch(this, ch) CALL_VTBL_FUNC(this, 24, \
1431 char, (const ctype_char*, char), (this, ch))
1432 char __thiscall ctype_char_do_widen_ch(const ctype_char *this, char ch)
1434 TRACE("(%p %c)\n", this, ch);
1435 return ch;
1438 /* ?do_widen@?$ctype@D@std@@MBEPBDPBD0PAD@Z */
1439 /* ?do_widen@?$ctype@D@std@@MEBAPEBDPEBD0PEAD@Z */
1440 DEFINE_THISCALL_WRAPPER(ctype_char_do_widen, 16)
1441 #define call_ctype_char_do_widen(this, first, last, dest) CALL_VTBL_FUNC(this, 20, \
1442 const char*, (const ctype_char*, const char*, const char*, char*), \
1443 (this, first, last, dest))
1444 const char* __thiscall ctype_char_do_widen(const ctype_char *this,
1445 const char *first, const char *last, char *dest)
1447 TRACE("(%p %p %p %p)\n", this, first, last, dest);
1448 memcpy(dest, first, last-first);
1449 return last;
1452 /* ?widen@?$ctype@D@std@@QBEDD@Z */
1453 /* ?widen@?$ctype@D@std@@QEBADD@Z */
1454 DEFINE_THISCALL_WRAPPER(ctype_char_widen_ch, 8)
1455 char __thiscall ctype_char_widen_ch(const ctype_char *this, char ch)
1457 TRACE("(%p %c)\n", this, ch);
1458 return call_ctype_char_do_widen_ch(this, ch);
1461 /* ?widen@?$ctype@D@std@@QBEPBDPBD0PAD@Z */
1462 /* ?widen@?$ctype@D@std@@QEBAPEBDPEBD0PEAD@Z */
1463 DEFINE_THISCALL_WRAPPER(ctype_char_widen, 16)
1464 const char* __thiscall ctype_char_widen(const ctype_char *this,
1465 const char *first, const char *last, char *dest)
1467 TRACE("(%p %p %p %p)\n", this, first, last, dest);
1468 return call_ctype_char_do_widen(this, first, last, dest);
1471 /* ?_Getcat@?$ctype@D@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
1472 /* ?_Getcat@?$ctype@D@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
1473 MSVCP_size_t __cdecl ctype_char__Getcat(const locale_facet **facet, const locale *loc)
1475 TRACE("(%p %p)\n", facet, loc);
1477 if(facet && !*facet) {
1478 _Locinfo locinfo;
1480 *facet = MSVCRT_operator_new(sizeof(ctype_char));
1481 if(!*facet) {
1482 ERR("Out of memory\n");
1483 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
1484 return 0;
1487 _Locinfo_ctor_cstr(&locinfo, locale_string_char_c_str(&loc->ptr->name));
1488 ctype_char_ctor_locinfo((ctype_char*)*facet, &locinfo, 0);
1489 _Locinfo_dtor(&locinfo);
1492 return LC_CTYPE;
1495 ctype_char* ctype_char_use_facet(const locale *loc)
1497 static ctype_char *obj = NULL;
1499 _Lockit lock;
1500 const locale_facet *fac;
1502 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
1503 fac = locale__Getfacet(loc, locale_id_operator_size_t(&ctype_char_id), TRUE);
1504 if(fac) {
1505 _Lockit_dtor(&lock);
1506 return (ctype_char*)fac;
1509 if(obj) {
1510 _Lockit_dtor(&lock);
1511 return obj;
1514 ctype_char__Getcat(&fac, loc);
1515 obj = (ctype_char*)fac;
1516 locale_facet__Incref(&obj->base.facet);
1517 locale_facet_register(&obj->base.facet);
1518 _Lockit_dtor(&lock);
1520 return obj;
1523 /* _Tolower */
1524 int __cdecl _Tolower(int ch, const _Ctypevec *ctype)
1526 unsigned int cp;
1528 TRACE("%d %p\n", ch, ctype);
1530 if(ctype)
1531 cp = ctype->page;
1532 else
1533 cp = ___lc_codepage_func();
1535 /* Don't convert to unicode in case of C locale */
1536 if(!cp) {
1537 if(ch>='A' && ch<='Z')
1538 ch = ch-'A'+'a';
1539 return ch;
1540 } else {
1541 WCHAR wide, lower;
1542 char str[2];
1543 int size;
1545 if(ch > 255) {
1546 str[0] = (ch>>8) & 255;
1547 str[1] = ch & 255;
1548 size = 2;
1549 } else {
1550 str[0] = ch & 255;
1551 size = 1;
1554 if(!MultiByteToWideChar(cp, MB_ERR_INVALID_CHARS, str, size, &wide, 1))
1555 return ch;
1557 lower = tolowerW(wide);
1558 if(lower == wide)
1559 return ch;
1561 WideCharToMultiByte(cp, 0, &lower, 1, str, 2, NULL, NULL);
1563 return str[0] + (str[1]<<8);
1567 /* ?do_tolower@?$ctype@D@std@@MBEDD@Z */
1568 /* ?do_tolower@?$ctype@D@std@@MEBADD@Z */
1569 #define call_ctype_char_do_tolower_ch(this, ch) CALL_VTBL_FUNC(this, 8, \
1570 char, (const ctype_char*, char), (this, ch))
1571 DEFINE_THISCALL_WRAPPER(ctype_char_do_tolower_ch, 8)
1572 char __thiscall ctype_char_do_tolower_ch(const ctype_char *this, char ch)
1574 TRACE("(%p %c)\n", this, ch);
1575 return _Tolower(ch, &this->ctype);
1578 /* ?do_tolower@?$ctype@D@std@@MBEPBDPADPBD@Z */
1579 /* ?do_tolower@?$ctype@D@std@@MEBAPEBDPEADPEBD@Z */
1580 #define call_ctype_char_do_tolower(this, first, last) CALL_VTBL_FUNC(this, 4, \
1581 const char*, (const ctype_char*, char*, const char*), (this, first, last))
1582 DEFINE_THISCALL_WRAPPER(ctype_char_do_tolower, 12)
1583 const char* __thiscall ctype_char_do_tolower(const ctype_char *this, char *first, const char *last)
1585 TRACE("(%p %p %p)\n", this, first, last);
1586 for(; first<last; first++)
1587 *first = _Tolower(*first, &this->ctype);
1588 return last;
1591 /* ?tolower@?$ctype@D@std@@QBEDD@Z */
1592 /* ?tolower@?$ctype@D@std@@QEBADD@Z */
1593 DEFINE_THISCALL_WRAPPER(ctype_char_tolower_ch, 8)
1594 char __thiscall ctype_char_tolower_ch(const ctype_char *this, char ch)
1596 TRACE("(%p %c)\n", this, ch);
1597 return call_ctype_char_do_tolower_ch(this, ch);
1600 /* ?tolower@?$ctype@D@std@@QBEPBDPADPBD@Z */
1601 /* ?tolower@?$ctype@D@std@@QEBAPEBDPEADPEBD@Z */
1602 DEFINE_THISCALL_WRAPPER(ctype_char_tolower, 12)
1603 const char* __thiscall ctype_char_tolower(const ctype_char *this, char *first, const char *last)
1605 TRACE("(%p %p %p)\n", this, first, last);
1606 return call_ctype_char_do_tolower(this, first, last);
1609 /* _Toupper */
1610 int __cdecl _Toupper(int ch, const _Ctypevec *ctype)
1612 unsigned int cp;
1614 TRACE("%d %p\n", ch, ctype);
1616 if(ctype)
1617 cp = ctype->page;
1618 else
1619 cp = ___lc_codepage_func();
1621 /* Don't convert to unicode in case of C locale */
1622 if(!cp) {
1623 if(ch>='a' && ch<='z')
1624 ch = ch-'a'+'A';
1625 return ch;
1626 } else {
1627 WCHAR wide, upper;
1628 char str[2];
1629 int size;
1631 if(ch > 255) {
1632 str[0] = (ch>>8) & 255;
1633 str[1] = ch & 255;
1634 size = 2;
1635 } else {
1636 str[0] = ch & 255;
1637 size = 1;
1640 if(!MultiByteToWideChar(cp, MB_ERR_INVALID_CHARS, str, size, &wide, 1))
1641 return ch;
1643 upper = toupperW(wide);
1644 if(upper == wide)
1645 return ch;
1647 WideCharToMultiByte(cp, 0, &upper, 1, str, 2, NULL, NULL);
1649 return str[0] + (str[1]<<8);
1653 /* ?do_toupper@?$ctype@D@std@@MBEDD@Z */
1654 /* ?do_toupper@?$ctype@D@std@@MEBADD@Z */
1655 #define call_ctype_char_do_toupper_ch(this, ch) CALL_VTBL_FUNC(this, 16, \
1656 char, (const ctype_char*, char), (this, ch))
1657 DEFINE_THISCALL_WRAPPER(ctype_char_do_toupper_ch, 8)
1658 char __thiscall ctype_char_do_toupper_ch(const ctype_char *this, char ch)
1660 TRACE("(%p %c)\n", this, ch);
1661 return _Toupper(ch, &this->ctype);
1664 /* ?do_toupper@?$ctype@D@std@@MBEPBDPADPBD@Z */
1665 /* ?do_toupper@?$ctype@D@std@@MEBAPEBDPEADPEBD@Z */
1666 #define call_ctype_char_do_toupper(this, first, last) CALL_VTBL_FUNC(this, 12, \
1667 const char*, (const ctype_char*, char*, const char*), (this, first, last))
1668 DEFINE_THISCALL_WRAPPER(ctype_char_do_toupper, 12)
1669 const char* __thiscall ctype_char_do_toupper(const ctype_char *this,
1670 char *first, const char *last)
1672 TRACE("(%p %p %p)\n", this, first, last);
1673 for(; first<last; first++)
1674 *first = _Toupper(*first, &this->ctype);
1675 return last;
1678 /* ?toupper@?$ctype@D@std@@QBEDD@Z */
1679 /* ?toupper@?$ctype@D@std@@QEBADD@Z */
1680 DEFINE_THISCALL_WRAPPER(ctype_char_toupper_ch, 8)
1681 char __thiscall ctype_char_toupper_ch(const ctype_char *this, char ch)
1683 TRACE("(%p %c)\n", this, ch);
1684 return call_ctype_char_do_toupper_ch(this, ch);
1687 /* ?toupper@?$ctype@D@std@@QBEPBDPADPBD@Z */
1688 /* ?toupper@?$ctype@D@std@@QEBAPEBDPEADPEBD@Z */
1689 DEFINE_THISCALL_WRAPPER(ctype_char_toupper, 12)
1690 const char* __thiscall ctype_char_toupper(const ctype_char *this, char *first, const char *last)
1692 TRACE("(%p %p %p)\n", this, first, last);
1693 return call_ctype_char_do_toupper(this, first, last);
1696 /* ?is@?$ctype@D@std@@QBE_NFD@Z */
1697 /* ?is@?$ctype@D@std@@QEBA_NFD@Z */
1698 DEFINE_THISCALL_WRAPPER(ctype_char_is_ch, 12)
1699 MSVCP_bool __thiscall ctype_char_is_ch(const ctype_char *this, short mask, char ch)
1701 TRACE("(%p %x %c)\n", this, mask, ch);
1702 return (this->ctype.table[(unsigned char)ch] & mask) != 0;
1705 /* ?is@?$ctype@D@std@@QBEPBDPBD0PAF@Z */
1706 /* ?is@?$ctype@D@std@@QEBAPEBDPEBD0PEAF@Z */
1707 DEFINE_THISCALL_WRAPPER(ctype_char_is, 16)
1708 const char* __thiscall ctype_char_is(const ctype_char *this, const char *first, const char *last, short *dest)
1710 TRACE("(%p %p %p %p)\n", this, first, last, dest);
1711 for(; first<last; first++)
1712 *dest++ = this->ctype.table[(unsigned char)*first];
1713 return last;
1716 /* ?scan_is@?$ctype@D@std@@QBEPBDFPBD0@Z */
1717 /* ?scan_is@?$ctype@D@std@@QEBAPEBDFPEBD0@Z */
1718 DEFINE_THISCALL_WRAPPER(ctype_char_scan_is, 16)
1719 const char* __thiscall ctype_char_scan_is(const ctype_char *this, short mask, const char *first, const char *last)
1721 TRACE("(%p %x %p %p)\n", this, mask, first, last);
1722 for(; first<last; first++)
1723 if(!ctype_char_is_ch(this, mask, *first))
1724 break;
1725 return first;
1728 /* ?scan_not@?$ctype@D@std@@QBEPBDFPBD0@Z */
1729 /* ?scan_not@?$ctype@D@std@@QEBAPEBDFPEBD0@Z */
1730 DEFINE_THISCALL_WRAPPER(ctype_char_scan_not, 16)
1731 const char* __thiscall ctype_char_scan_not(const ctype_char *this, short mask, const char *first, const char *last)
1733 TRACE("(%p %x %p %p)\n", this, mask, first, last);
1734 for(; first<last; first++)
1735 if(ctype_char_is_ch(this, mask, *first))
1736 break;
1737 return first;
1740 /* ?table@?$ctype@D@std@@IBEPBFXZ */
1741 /* ?table@?$ctype@D@std@@IEBAPEBFXZ */
1742 DEFINE_THISCALL_WRAPPER(ctype_char_table, 4)
1743 const short* __thiscall ctype_char_table(const ctype_char *this)
1745 TRACE("(%p)\n", this);
1746 return this->ctype.table;
1749 /* ?id@?$ctype@_W@std@@2V0locale@2@A */
1750 locale_id ctype_wchar_id = {0};
1751 /* ?id@?$ctype@G@std@@2V0locale@2@A */
1752 locale_id ctype_short_id = {0};
1754 /* ??_7?$ctype@_W@std@@6B@ */
1755 extern const vtable_ptr MSVCP_ctype_wchar_vtable;
1756 /* ??_7?$ctype@G@std@@6B@ */
1757 extern const vtable_ptr MSVCP_ctype_short_vtable;
1759 /* ?_Init@?$ctype@_W@std@@IAEXABV_Locinfo@2@@Z */
1760 /* ?_Init@?$ctype@_W@std@@IEAAXAEBV_Locinfo@2@@Z */
1761 /* ?_Init@?$ctype@G@std@@IAEXABV_Locinfo@2@@Z */
1762 /* ?_Init@?$ctype@G@std@@IEAAXAEBV_Locinfo@2@@Z */
1763 DEFINE_THISCALL_WRAPPER(ctype_wchar__Init, 8)
1764 void __thiscall ctype_wchar__Init(ctype_wchar *this, const _Locinfo *locinfo)
1766 TRACE("(%p %p)\n", this, locinfo);
1767 _Locinfo__Getctype(locinfo, &this->ctype);
1768 _Locinfo__Getcvt(locinfo, &this->cvt);
1771 /* ??0?$ctype@_W@std@@QAE@ABV_Locinfo@1@I@Z */
1772 /* ??0?$ctype@_W@std@@QEAA@AEBV_Locinfo@1@_K@Z */
1773 DEFINE_THISCALL_WRAPPER(ctype_wchar_ctor_locinfo, 12)
1774 ctype_wchar* __thiscall ctype_wchar_ctor_locinfo(ctype_wchar *this,
1775 const _Locinfo *locinfo, MSVCP_size_t refs)
1777 TRACE("(%p %p %lu)\n", this, locinfo, refs);
1778 ctype_base_ctor_refs(&this->base, refs);
1779 this->base.facet.vtable = &MSVCP_ctype_wchar_vtable;
1780 ctype_wchar__Init(this, locinfo);
1781 return this;
1784 /* ??0?$ctype@G@std@@QAE@ABV_Locinfo@1@I@Z */
1785 /* ??0?$ctype@G@std@@QEAA@AEBV_Locinfo@1@_K@Z */
1786 DEFINE_THISCALL_WRAPPER(ctype_short_ctor_locinfo, 12)
1787 ctype_wchar* __thiscall ctype_short_ctor_locinfo(ctype_wchar *this,
1788 const _Locinfo *locinfo, MSVCP_size_t refs)
1790 ctype_wchar *ret = ctype_wchar_ctor_locinfo(this, locinfo, refs);
1791 this->base.facet.vtable = &MSVCP_ctype_short_vtable;
1792 return ret;
1795 /* ??0?$ctype@_W@std@@QAE@I@Z */
1796 /* ??0?$ctype@_W@std@@QEAA@_K@Z */
1797 DEFINE_THISCALL_WRAPPER(ctype_wchar_ctor_refs, 8)
1798 ctype_wchar* __thiscall ctype_wchar_ctor_refs(ctype_wchar *this, MSVCP_size_t refs)
1800 _Locinfo locinfo;
1802 TRACE("(%p %lu)\n", this, refs);
1804 ctype_base_ctor_refs(&this->base, refs);
1805 this->base.facet.vtable = &MSVCP_ctype_wchar_vtable;
1807 _Locinfo_ctor(&locinfo);
1808 ctype_wchar__Init(this, &locinfo);
1809 _Locinfo_dtor(&locinfo);
1810 return this;
1813 /* ??0?$ctype@G@std@@QAE@I@Z */
1814 /* ??0?$ctype@G@std@@QEAA@_K@Z */
1815 DEFINE_THISCALL_WRAPPER(ctype_short_ctor_refs, 8)
1816 ctype_wchar* __thiscall ctype_short_ctor_refs(ctype_wchar *this, MSVCP_size_t refs)
1818 ctype_wchar *ret = ctype_wchar_ctor_refs(this, refs);
1819 this->base.facet.vtable = &MSVCP_ctype_short_vtable;
1820 return ret;
1823 /* ??_F?$ctype@_W@std@@QAEXXZ */
1824 /* ??_F?$ctype@_W@std@@QEAAXXZ */
1825 DEFINE_THISCALL_WRAPPER(ctype_wchar_ctor, 4)
1826 ctype_wchar* __thiscall ctype_wchar_ctor(ctype_wchar *this)
1828 TRACE("(%p)\n", this);
1829 return ctype_short_ctor_refs(this, 0);
1832 /* ??_F?$ctype@G@std@@QAEXXZ */
1833 /* ??_F?$ctype@G@std@@QEAAXXZ */
1834 DEFINE_THISCALL_WRAPPER(ctype_short_ctor, 4)
1835 ctype_wchar* __thiscall ctype_short_ctor(ctype_wchar *this)
1837 ctype_wchar *ret = ctype_wchar_ctor(this);
1838 this->base.facet.vtable = &MSVCP_ctype_short_vtable;
1839 return ret;
1842 /* ??1?$ctype@G@std@@UAE@XZ */
1843 /* ??1?$ctype@G@std@@UEAA@XZ */
1844 /* ??1?$ctype@_W@std@@MAE@XZ */
1845 /* ??1?$ctype@_W@std@@MEAA@XZ */
1846 /* ??1?$ctype@G@std@@MAE@XZ */
1847 /* ??1?$ctype@G@std@@MEAA@XZ */
1848 DEFINE_THISCALL_WRAPPER(ctype_wchar_dtor, 4)
1849 void __thiscall ctype_wchar_dtor(ctype_wchar *this)
1851 TRACE("(%p)\n", this);
1852 if(this->ctype.delfl)
1853 free((void*)this->ctype.table);
1856 DEFINE_THISCALL_WRAPPER(ctype_wchar_vector_dtor, 8)
1857 ctype_wchar* __thiscall ctype_wchar_vector_dtor(ctype_wchar *this, unsigned int flags)
1859 TRACE("(%p %x)\n", this, flags);
1860 if(flags & 2) {
1861 /* we have an array, with the number of elements stored before the first object */
1862 INT_PTR i, *ptr = (INT_PTR *)this-1;
1864 for(i=*ptr-1; i>=0; i--)
1865 ctype_wchar_dtor(this+i);
1866 MSVCRT_operator_delete(ptr);
1867 } else {
1868 ctype_wchar_dtor(this);
1869 if(flags & 1)
1870 MSVCRT_operator_delete(this);
1873 return this;
1876 /* _Wcrtomb */
1877 int __cdecl _Wcrtomb(char *s, wchar_t wch, int *state, const _Cvtvec *cvt)
1879 int cp, size;
1880 BOOL def;
1882 TRACE("%p %d %p %p\n", s, wch, state, cvt);
1884 if(cvt)
1885 cp = cvt->page;
1886 else
1887 cp = ___lc_codepage_func();
1889 if(!cp) {
1890 if(wch > 255) {
1891 *_errno() = EILSEQ;
1892 return -1;
1895 *s = wch & 255;
1896 return 1;
1899 size = WideCharToMultiByte(cp, 0, &wch, 1, s, MB_LEN_MAX, NULL, &def);
1900 if(!size || def) {
1901 *_errno() = EILSEQ;
1902 return -1;
1905 return size;
1908 /* ?_Donarrow@?$ctype@_W@std@@IBED_WD@Z */
1909 /* ?_Donarrow@?$ctype@_W@std@@IEBAD_WD@Z */
1910 /* ?_Donarrow@?$ctype@G@std@@IBEDGD@Z */
1911 /* ?_Donarrow@?$ctype@G@std@@IEBADGD@Z */
1912 DEFINE_THISCALL_WRAPPER(ctype_wchar__Donarrow, 12)
1913 char __thiscall ctype_wchar__Donarrow(const ctype_wchar *this, wchar_t ch, char dflt)
1915 char buf[MB_LEN_MAX];
1917 TRACE("(%p %d %d)\n", this, ch, dflt);
1919 return _Wcrtomb(buf, ch, NULL, &this->cvt)==1 ? buf[0] : dflt;
1922 /* ?do_narrow@?$ctype@_W@std@@MBED_WD@Z */
1923 /* ?do_narrow@?$ctype@_W@std@@MEBAD_WD@Z */
1924 /* ?do_narrow@?$ctype@G@std@@MBEDGD@Z */
1925 /* ?do_narrow@?$ctype@G@std@@MEBADGD@Z */
1926 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_narrow_ch, 12)
1927 #define call_ctype_wchar_do_narrow_ch(this, ch, dflt) CALL_VTBL_FUNC(this, 48, \
1928 char, (const ctype_wchar*, wchar_t, char), (this, ch, dflt))
1929 char __thiscall ctype_wchar_do_narrow_ch(const ctype_wchar *this, wchar_t ch, char dflt)
1931 return ctype_wchar__Donarrow(this, ch, dflt);
1934 /* ?do_narrow@?$ctype@_W@std@@MBEPB_WPB_W0DPAD@Z */
1935 /* ?do_narrow@?$ctype@_W@std@@MEBAPEB_WPEB_W0DPEAD@Z */
1936 /* ?do_narrow@?$ctype@G@std@@MBEPBGPBG0DPAD@Z */
1937 /* ?do_narrow@?$ctype@G@std@@MEBAPEBGPEBG0DPEAD@Z */
1938 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_narrow, 20)
1939 #define call_ctype_wchar_do_narrow(this, first, last, dflt, dest) CALL_VTBL_FUNC(this, 44, \
1940 const wchar_t*, (const ctype_wchar*, const wchar_t*, const wchar_t*, char, char*), \
1941 (this, first, last, dflt, dest))
1942 const wchar_t* __thiscall ctype_wchar_do_narrow(const ctype_wchar *this,
1943 const wchar_t *first, const wchar_t *last, char dflt, char *dest)
1945 TRACE("(%p %p %p %d %p)\n", this, first, last, dflt, dest);
1946 for(; first<last; first++)
1947 *dest++ = ctype_wchar__Donarrow(this, *first, dflt);
1948 return last;
1951 /* ?narrow@?$ctype@_W@std@@QBED_WD@Z */
1952 /* ?narrow@?$ctype@_W@std@@QEBAD_WD@Z */
1953 /* ?narrow@?$ctype@G@std@@QBEDGD@Z */
1954 /* ?narrow@?$ctype@G@std@@QEBADGD@Z */
1955 DEFINE_THISCALL_WRAPPER(ctype_wchar_narrow_ch, 12)
1956 char __thiscall ctype_wchar_narrow_ch(const ctype_wchar *this, wchar_t ch, char dflt)
1958 TRACE("(%p %d %d)\n", this, ch, dflt);
1959 return call_ctype_wchar_do_narrow_ch(this, ch, dflt);
1962 /* ?narrow@?$ctype@_W@std@@QBEPB_WPB_W0DPAD@Z */
1963 /* ?narrow@?$ctype@_W@std@@QEBAPEB_WPEB_W0DPEAD@Z */
1964 /* ?narrow@?$ctype@G@std@@QBEPBGPBG0DPAD@Z */
1965 /* ?narrow@?$ctype@G@std@@QEBAPEBGPEBG0DPEAD@Z */
1966 DEFINE_THISCALL_WRAPPER(ctype_wchar_narrow, 20)
1967 const wchar_t* __thiscall ctype_wchar_narrow(const ctype_wchar *this,
1968 const wchar_t *first, const wchar_t *last, char dflt, char *dest)
1970 TRACE("(%p %p %p %d %p)\n", this, first, last, dflt, dest);
1971 return call_ctype_wchar_do_narrow(this, first, last, dflt, dest);
1974 /* _Mbrtowc */
1975 int __cdecl _Mbrtowc(wchar_t *out, const char *in, MSVCP_size_t len, int *state, const _Cvtvec *cvt)
1977 int i, cp;
1978 CPINFO cp_info;
1979 BOOL is_lead;
1981 TRACE("(%p %p %lu %p %p)\n", out, in, len, state, cvt);
1983 if(!len)
1984 return 0;
1986 if(cvt)
1987 cp = cvt->page;
1988 else
1989 cp = ___lc_codepage_func();
1991 if(!cp) {
1992 if(out)
1993 *out = (unsigned char)*in;
1995 *state = 0;
1996 return *in ? 1 : 0;
1999 if(*state) {
2000 ((char*)state)[1] = *in;
2002 if(!MultiByteToWideChar(cp, MB_ERR_INVALID_CHARS, (char*)state, 2, out, out ? 1 : 0)) {
2003 *state = 0;
2004 *_errno() = EILSEQ;
2005 return -1;
2008 *state = 0;
2009 return 2;
2012 GetCPInfo(cp, &cp_info);
2013 is_lead = FALSE;
2014 for(i=0; i<MAX_LEADBYTES; i+=2) {
2015 if(!cp_info.LeadByte[i+1])
2016 break;
2017 if((unsigned char)*in>=cp_info.LeadByte[i] && (unsigned char)*in<=cp_info.LeadByte[i+1]) {
2018 is_lead = TRUE;
2019 break;
2023 if(is_lead) {
2024 if(len == 1) {
2025 *state = (unsigned char)*in;
2026 return -2;
2029 if(!MultiByteToWideChar(cp, MB_ERR_INVALID_CHARS, in, 2, out, out ? 1 : 0)) {
2030 *_errno() = EILSEQ;
2031 return -1;
2033 return 2;
2036 if(!MultiByteToWideChar(cp, MB_ERR_INVALID_CHARS, in, 1, out, out ? 1 : 0)) {
2037 *_errno() = EILSEQ;
2038 return -1;
2040 return 1;
2043 static inline wchar_t mb_to_wc(char ch, const _Cvtvec *cvt)
2045 int state = 0;
2046 wchar_t ret;
2048 return _Mbrtowc(&ret, &ch, 1, &state, cvt) == 1 ? ret : 0;
2051 /* ?_Dowiden@?$ctype@_W@std@@IBE_WD@Z */
2052 /* ?_Dowiden@?$ctype@_W@std@@IEBA_WD@Z */
2053 /* ?_Dowiden@?$ctype@G@std@@IBEGD@Z */
2054 /* ?_Dowiden@?$ctype@G@std@@IEBAGD@Z */
2055 DEFINE_THISCALL_WRAPPER(ctype_wchar__Dowiden, 8)
2056 wchar_t __thiscall ctype_wchar__Dowiden(const ctype_wchar *this, char ch)
2058 wchar_t ret;
2059 int state = 0;
2060 TRACE("(%p %d)\n", this, ch);
2061 return _Mbrtowc(&ret, &ch, 1, &state, &this->cvt)<0 ? WEOF : ret;
2064 /* ?do_widen@?$ctype@_W@std@@MBE_WD@Z */
2065 /* ?do_widen@?$ctype@_W@std@@MEBA_WD@Z */
2066 /* ?do_widen@?$ctype@G@std@@MBEGD@Z */
2067 /* ?do_widen@?$ctype@G@std@@MEBAGD@Z */
2068 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_widen_ch, 8)
2069 #define call_ctype_wchar_do_widen_ch(this, ch) CALL_VTBL_FUNC(this, 40, \
2070 wchar_t, (const ctype_wchar*, char), (this, ch))
2071 wchar_t __thiscall ctype_wchar_do_widen_ch(const ctype_wchar *this, char ch)
2073 return ctype_wchar__Dowiden(this, ch);
2076 /* ?do_widen@?$ctype@_W@std@@MBEPBDPBD0PA_W@Z */
2077 /* ?do_widen@?$ctype@_W@std@@MEBAPEBDPEBD0PEA_W@Z */
2078 /* ?do_widen@?$ctype@G@std@@MBEPBDPBD0PAG@Z */
2079 /* ?do_widen@?$ctype@G@std@@MEBAPEBDPEBD0PEAG@Z */
2080 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_widen, 16)
2081 #define call_ctype_wchar_do_widen(this, first, last, dest) CALL_VTBL_FUNC(this, 36, \
2082 const char*, (const ctype_wchar*, const char*, const char*, wchar_t*), \
2083 (this, first, last, dest))
2084 const char* __thiscall ctype_wchar_do_widen(const ctype_wchar *this,
2085 const char *first, const char *last, wchar_t *dest)
2087 TRACE("(%p %p %p %p)\n", this, first, last, dest);
2088 for(; first<last; first++)
2089 *dest++ = ctype_wchar__Dowiden(this, *first);
2090 return last;
2093 /* ?widen@?$ctype@_W@std@@QBE_WD@Z */
2094 /* ?widen@?$ctype@_W@std@@QEBA_WD@Z */
2095 /* ?widen@?$ctype@G@std@@QBEGD@Z */
2096 /* ?widen@?$ctype@G@std@@QEBAGD@Z */
2097 DEFINE_THISCALL_WRAPPER(ctype_wchar_widen_ch, 8)
2098 wchar_t __thiscall ctype_wchar_widen_ch(const ctype_wchar *this, char ch)
2100 TRACE("(%p %d)\n", this, ch);
2101 return call_ctype_wchar_do_widen_ch(this, ch);
2104 /* ?widen@?$ctype@_W@std@@QBEPBDPBD0PA_W@Z */
2105 /* ?widen@?$ctype@_W@std@@QEBAPEBDPEBD0PEA_W@Z */
2106 /* ?widen@?$ctype@G@std@@QBEPBDPBD0PAG@Z */
2107 /* ?widen@?$ctype@G@std@@QEBAPEBDPEBD0PEAG@Z */
2108 DEFINE_THISCALL_WRAPPER(ctype_wchar_widen, 16)
2109 const char* __thiscall ctype_wchar_widen(const ctype_wchar *this,
2110 const char *first, const char *last, wchar_t *dest)
2112 TRACE("(%p %p %p %p)\n", this, first, last, dest);
2113 return call_ctype_wchar_do_widen(this, first, last, dest);
2116 /* ?_Getcat@?$ctype@_W@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
2117 /* ?_Getcat@?$ctype@_W@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
2118 MSVCP_size_t __cdecl ctype_wchar__Getcat(const locale_facet **facet, const locale *loc)
2120 TRACE("(%p %p)\n", facet, loc);
2122 if(facet && !*facet) {
2123 _Locinfo locinfo;
2125 *facet = MSVCRT_operator_new(sizeof(ctype_wchar));
2126 if(!*facet) {
2127 ERR("Out of memory\n");
2128 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
2129 return 0;
2132 _Locinfo_ctor_cstr(&locinfo, locale_string_char_c_str(&loc->ptr->name));
2133 ctype_wchar_ctor_locinfo((ctype_wchar*)*facet, &locinfo, 0);
2134 _Locinfo_dtor(&locinfo);
2137 return LC_CTYPE;
2140 /* ?_Getcat@?$ctype@G@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
2141 /* ?_Getcat@?$ctype@G@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
2142 MSVCP_size_t __cdecl ctype_short__Getcat(const locale_facet **facet, const locale *loc)
2144 if(facet && !*facet) {
2145 ctype_wchar__Getcat(facet, loc);
2146 (*(locale_facet**)facet)->vtable = &MSVCP_ctype_short_vtable;
2149 return LC_CTYPE;
2152 /* _Towlower */
2153 wchar_t __cdecl _Towlower(wchar_t ch, const _Ctypevec *ctype)
2155 TRACE("(%d %p)\n", ch, ctype);
2156 return tolowerW(ch);
2159 ctype_wchar* ctype_wchar_use_facet(const locale *loc)
2161 static ctype_wchar *obj = NULL;
2163 _Lockit lock;
2164 const locale_facet *fac;
2166 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
2167 fac = locale__Getfacet(loc, locale_id_operator_size_t(&ctype_wchar_id), TRUE);
2168 if(fac) {
2169 _Lockit_dtor(&lock);
2170 return (ctype_wchar*)fac;
2173 if(obj) {
2174 _Lockit_dtor(&lock);
2175 return obj;
2178 ctype_wchar__Getcat(&fac, loc);
2179 obj = (ctype_wchar*)fac;
2180 locale_facet__Incref(&obj->base.facet);
2181 locale_facet_register(&obj->base.facet);
2182 _Lockit_dtor(&lock);
2184 return obj;
2187 ctype_wchar* ctype_short_use_facet(const locale *loc)
2189 static ctype_wchar *obj = NULL;
2191 _Lockit lock;
2192 const locale_facet *fac;
2194 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
2195 fac = locale__Getfacet(loc, locale_id_operator_size_t(&ctype_short_id), TRUE);
2196 if(fac) {
2197 _Lockit_dtor(&lock);
2198 return (ctype_wchar*)fac;
2201 if(obj) {
2202 _Lockit_dtor(&lock);
2203 return obj;
2206 ctype_short__Getcat(&fac, loc);
2207 obj = (ctype_wchar*)fac;
2208 locale_facet__Incref(&obj->base.facet);
2209 locale_facet_register(&obj->base.facet);
2210 _Lockit_dtor(&lock);
2212 return obj;
2215 /* ?do_tolower@?$ctype@_W@std@@MBE_W_W@Z */
2216 /* ?do_tolower@?$ctype@_W@std@@MEBA_W_W@Z */
2217 /* ?do_tolower@?$ctype@G@std@@MBEGG@Z */
2218 /* ?do_tolower@?$ctype@G@std@@MEBAGG@Z */
2219 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_tolower_ch, 8)
2220 #define call_ctype_wchar_do_tolower_ch(this, ch) CALL_VTBL_FUNC(this, 24, \
2221 wchar_t, (const ctype_wchar*, wchar_t), (this, ch))
2222 wchar_t __thiscall ctype_wchar_do_tolower_ch(const ctype_wchar *this, wchar_t ch)
2224 return _Towlower(ch, &this->ctype);
2227 /* ?do_tolower@?$ctype@_W@std@@MBEPB_WPA_WPB_W@Z */
2228 /* ?do_tolower@?$ctype@_W@std@@MEBAPEB_WPEA_WPEB_W@Z */
2229 /* ?do_tolower@?$ctype@G@std@@MBEPBGPAGPBG@Z */
2230 /* ?do_tolower@?$ctype@G@std@@MEBAPEBGPEAGPEBG@Z */
2231 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_tolower, 12)
2232 #define call_ctype_wchar_do_tolower(this, first, last) CALL_VTBL_FUNC(this, 20, \
2233 const wchar_t*, (const ctype_wchar*, wchar_t*, const wchar_t*), \
2234 (this, first, last))
2235 const wchar_t* __thiscall ctype_wchar_do_tolower(const ctype_wchar *this,
2236 wchar_t *first, const wchar_t *last)
2238 TRACE("(%p %p %p)\n", this, first, last);
2239 for(; first<last; first++)
2240 *first = _Towlower(*first, &this->ctype);
2241 return last;
2244 /* ?tolower@?$ctype@_W@std@@QBE_W_W@Z */
2245 /* ?tolower@?$ctype@_W@std@@QEBA_W_W@Z */
2246 /* ?tolower@?$ctype@G@std@@QBEGG@Z */
2247 /* ?tolower@?$ctype@G@std@@QEBAGG@Z */
2248 DEFINE_THISCALL_WRAPPER(ctype_wchar_tolower_ch, 8)
2249 wchar_t __thiscall ctype_wchar_tolower_ch(const ctype_wchar *this, wchar_t ch)
2251 TRACE("(%p %d)\n", this, ch);
2252 return call_ctype_wchar_do_tolower_ch(this, ch);
2255 /* ?tolower@?$ctype@_W@std@@QBEPB_WPA_WPB_W@Z */
2256 /* ?tolower@?$ctype@_W@std@@QEBAPEB_WPEA_WPEB_W@Z */
2257 /* ?tolower@?$ctype@G@std@@QBEPBGPAGPBG@Z */
2258 /* ?tolower@?$ctype@G@std@@QEBAPEBGPEAGPEBG@Z */
2259 DEFINE_THISCALL_WRAPPER(ctype_wchar_tolower, 12)
2260 const wchar_t* __thiscall ctype_wchar_tolower(const ctype_wchar *this,
2261 wchar_t *first, const wchar_t *last)
2263 TRACE("(%p %p %p)\n", this, first, last);
2264 return call_ctype_wchar_do_tolower(this, first, last);
2267 /* _Towupper */
2268 wchar_t __cdecl _Towupper(wchar_t ch, const _Ctypevec *ctype)
2270 TRACE("(%d %p)\n", ch, ctype);
2271 return toupperW(ch);
2274 /* ?do_toupper@?$ctype@_W@std@@MBE_W_W@Z */
2275 /* ?do_toupper@?$ctype@_W@std@@MEBA_W_W@Z */
2276 /* ?do_toupper@?$ctype@G@std@@MBEGG@Z */
2277 /* ?do_toupper@?$ctype@G@std@@MEBAGG@Z */
2278 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_toupper_ch, 8)
2279 #define call_ctype_wchar_do_toupper_ch(this, ch) CALL_VTBL_FUNC(this, 32, \
2280 wchar_t, (const ctype_wchar*, wchar_t), (this, ch))
2281 wchar_t __thiscall ctype_wchar_do_toupper_ch(const ctype_wchar *this, wchar_t ch)
2283 return _Towupper(ch, &this->ctype);
2286 /* ?do_toupper@?$ctype@_W@std@@MBEPB_WPA_WPB_W@Z */
2287 /* ?do_toupper@?$ctype@_W@std@@MEBAPEB_WPEA_WPEB_W@Z */
2288 /* ?do_toupper@?$ctype@G@std@@MBEPBGPAGPBG@Z */
2289 /* ?do_toupper@?$ctype@G@std@@MEBAPEBGPEAGPEBG@Z */
2290 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_toupper, 12)
2291 #define call_ctype_wchar_do_toupper(this, first, last) CALL_VTBL_FUNC(this, 28, \
2292 const wchar_t*, (const ctype_wchar*, wchar_t*, const wchar_t*), \
2293 (this, first, last))
2294 const wchar_t* __thiscall ctype_wchar_do_toupper(const ctype_wchar *this,
2295 wchar_t *first, const wchar_t *last)
2297 TRACE("(%p %p %p)\n", this, first, last);
2298 for(; first<last; first++)
2299 *first = _Towupper(*first, &this->ctype);
2300 return last;
2303 /* ?toupper@?$ctype@_W@std@@QBE_W_W@Z */
2304 /* ?toupper@?$ctype@_W@std@@QEBA_W_W@Z */
2305 /* ?toupper@?$ctype@G@std@@QBEGG@Z */
2306 /* ?toupper@?$ctype@G@std@@QEBAGG@Z */
2307 DEFINE_THISCALL_WRAPPER(ctype_wchar_toupper_ch, 8)
2308 wchar_t __thiscall ctype_wchar_toupper_ch(const ctype_wchar *this, wchar_t ch)
2310 TRACE("(%p %d)\n", this, ch);
2311 return call_ctype_wchar_do_toupper_ch(this, ch);
2314 /* ?toupper@?$ctype@_W@std@@QBEPB_WPA_WPB_W@Z */
2315 /* ?toupper@?$ctype@_W@std@@QEBAPEB_WPEA_WPEB_W@Z */
2316 /* ?toupper@?$ctype@G@std@@QBEPBGPAGPBG@Z */
2317 /* ?toupper@?$ctype@G@std@@QEBAPEBGPEAGPEBG@Z */
2318 DEFINE_THISCALL_WRAPPER(ctype_wchar_toupper, 12)
2319 const wchar_t* __thiscall ctype_wchar_toupper(const ctype_wchar *this,
2320 wchar_t *first, const wchar_t *last)
2322 TRACE("(%p %p %p)\n", this, first, last);
2323 return call_ctype_wchar_do_toupper(this, first, last);
2326 /* _Getwctypes */
2327 const wchar_t* __cdecl _Getwctypes(const wchar_t *first, const wchar_t *last,
2328 short *mask, const _Ctypevec *ctype)
2330 TRACE("(%p %p %p %p)\n", first, last, mask, ctype);
2331 GetStringTypeW(CT_CTYPE1, first, last-first, (WORD*)mask);
2332 return last;
2335 /* _Getwctype */
2336 short __cdecl _Getwctype(wchar_t ch, const _Ctypevec *ctype)
2338 short mask = 0;
2339 _Getwctypes(&ch, &ch+1, &mask, ctype);
2340 return mask;
2343 /* ?do_is@?$ctype@_W@std@@MBE_NF_W@Z */
2344 /* ?do_is@?$ctype@_W@std@@MEBA_NF_W@Z */
2345 /* ?do_is@?$ctype@G@std@@MBE_NFG@Z */
2346 /* ?do_is@?$ctype@G@std@@MEBA_NFG@Z */
2347 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_is_ch, 12)
2348 #define call_ctype_wchar_do_is_ch(this, mask, ch) CALL_VTBL_FUNC(this, 8, \
2349 MSVCP_bool, (const ctype_wchar*, short, wchar_t), (this, mask, ch))
2350 MSVCP_bool __thiscall ctype_wchar_do_is_ch(const ctype_wchar *this, short mask, wchar_t ch)
2352 TRACE("(%p %x %d)\n", this, mask, ch);
2353 return (_Getwctype(ch, &this->ctype) & mask) != 0;
2356 /* ?do_is@?$ctype@_W@std@@MBEPB_WPB_W0PAF@Z */
2357 /* ?do_is@?$ctype@_W@std@@MEBAPEB_WPEB_W0PEAF@Z */
2358 /* ?do_is@?$ctype@G@std@@MBEPBGPBG0PAF@Z */
2359 /* ?do_is@?$ctype@G@std@@MEBAPEBGPEBG0PEAF@Z */
2360 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_is, 16)
2361 #define call_ctype_wchar_do_is(this, first, last, dest) CALL_VTBL_FUNC(this, 4, \
2362 const wchar_t*, (const ctype_wchar*, const wchar_t*, const wchar_t*, short*), \
2363 (this, first, last, dest))
2364 const wchar_t* __thiscall ctype_wchar_do_is(const ctype_wchar *this,
2365 const wchar_t *first, const wchar_t *last, short *dest)
2367 TRACE("(%p %p %p %p)\n", this, first, last, dest);
2368 return _Getwctypes(first, last, dest, &this->ctype);
2371 /* ?is@?$ctype@_W@std@@QBE_NF_W@Z */
2372 /* ?is@?$ctype@_W@std@@QEBA_NF_W@Z */
2373 /* ?is@?$ctype@G@std@@QBE_NFG@Z */
2374 /* ?is@?$ctype@G@std@@QEBA_NFG@Z */
2375 DEFINE_THISCALL_WRAPPER(ctype_wchar_is_ch, 12)
2376 MSVCP_bool __thiscall ctype_wchar_is_ch(const ctype_wchar *this, short mask, wchar_t ch)
2378 TRACE("(%p %x %d)\n", this, mask, ch);
2379 return call_ctype_wchar_do_is_ch(this, mask, ch);
2382 /* ?is@?$ctype@_W@std@@QBEPB_WPB_W0PAF@Z */
2383 /* ?is@?$ctype@_W@std@@QEBAPEB_WPEB_W0PEAF@Z */
2384 /* ?is@?$ctype@G@std@@QBEPBGPBG0PAF@Z */
2385 /* ?is@?$ctype@G@std@@QEBAPEBGPEBG0PEAF@Z */
2386 DEFINE_THISCALL_WRAPPER(ctype_wchar_is, 16)
2387 const wchar_t* __thiscall ctype_wchar_is(const ctype_wchar *this,
2388 const wchar_t *first, const wchar_t *last, short *dest)
2390 TRACE("(%p %p %p %p)\n", this, first, last, dest);
2391 return call_ctype_wchar_do_is(this, first, last, dest);
2394 /* ?do_scan_is@?$ctype@_W@std@@MBEPB_WFPB_W0@Z */
2395 /* ?do_scan_is@?$ctype@_W@std@@MEBAPEB_WFPEB_W0@Z */
2396 /* ?do_scan_is@?$ctype@G@std@@MBEPBGFPBG0@Z */
2397 /* ?do_scan_is@?$ctype@G@std@@MEBAPEBGFPEBG0@Z */
2398 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_scan_is, 16)
2399 #define call_ctype_wchar_do_scan_is(this, mask, first, last) CALL_VTBL_FUNC(this, 12, \
2400 const wchar_t*, (const ctype_wchar*, short, const wchar_t*, const wchar_t*), \
2401 (this, mask, first, last))
2402 const wchar_t* __thiscall ctype_wchar_do_scan_is(const ctype_wchar *this,
2403 short mask, const wchar_t *first, const wchar_t *last)
2405 TRACE("(%p %d %p %p)\n", this, mask, first, last);
2406 for(; first<last; first++)
2407 if(!ctype_wchar_is_ch(this, mask, *first))
2408 break;
2409 return first;
2412 /* ?scan_is@?$ctype@_W@std@@QBEPB_WFPB_W0@Z */
2413 /* ?scan_is@?$ctype@_W@std@@QEBAPEB_WFPEB_W0@Z */
2414 /* ?scan_is@?$ctype@G@std@@QBEPBGFPBG0@Z */
2415 /* ?scan_is@?$ctype@G@std@@QEBAPEBGFPEBG0@Z */
2416 DEFINE_THISCALL_WRAPPER(ctype_wchar_scan_is, 16)
2417 const wchar_t* __thiscall ctype_wchar_scan_is(const ctype_wchar *this,
2418 short mask, const wchar_t *first, const wchar_t *last)
2420 TRACE("(%p %x %p %p)\n", this, mask, first, last);
2421 return call_ctype_wchar_do_scan_is(this, mask, first, last);
2424 /* ?do_scan_not@?$ctype@_W@std@@MBEPB_WFPB_W0@Z */
2425 /* ?do_scan_not@?$ctype@_W@std@@MEBAPEB_WFPEB_W0@Z */
2426 /* ?do_scan_not@?$ctype@G@std@@MBEPBGFPBG0@Z */
2427 /* ?do_scan_not@?$ctype@G@std@@MEBAPEBGFPEBG0@Z */
2428 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_scan_not, 16)
2429 #define call_ctype_wchar_do_scan_not(this, mask, first, last) CALL_VTBL_FUNC(this, 16, \
2430 const wchar_t*, (const ctype_wchar*, short, const wchar_t*, const wchar_t*), \
2431 (this, mask, first, last))
2432 const wchar_t* __thiscall ctype_wchar_do_scan_not(const ctype_wchar *this,
2433 short mask, const wchar_t *first, const wchar_t *last)
2435 TRACE("(%p %x %p %p)\n", this, mask, first, last);
2436 for(; first<last; first++)
2437 if(ctype_wchar_is_ch(this, mask, *first))
2438 break;
2439 return first;
2442 /* ?scan_not@?$ctype@_W@std@@QBEPB_WFPB_W0@Z */
2443 /* ?scan_not@?$ctype@_W@std@@QEBAPEB_WFPEB_W0@Z */
2444 /* ?scan_not@?$ctype@G@std@@QBEPBGFPBG0@Z */
2445 /* ?scan_not@?$ctype@G@std@@QEBAPEBGFPEBG0@Z */
2446 DEFINE_THISCALL_WRAPPER(ctype_wchar_scan_not, 16)
2447 const wchar_t* __thiscall ctype_wchar_scan_not(const ctype_wchar *this,
2448 short mask, const wchar_t *first, const wchar_t *last)
2450 TRACE("(%p %x %p %p)\n", this, mask, first, last);
2451 return call_ctype_wchar_do_scan_not(this, mask, first, last);
2454 /* ??_7codecvt_base@std@@6B@ */
2455 extern const vtable_ptr MSVCP_codecvt_base_vtable;
2457 /* ??0codecvt_base@std@@QAE@I@Z */
2458 /* ??0codecvt_base@std@@QEAA@_K@Z */
2459 DEFINE_THISCALL_WRAPPER(codecvt_base_ctor_refs, 8)
2460 codecvt_base* __thiscall codecvt_base_ctor_refs(codecvt_base *this, MSVCP_size_t refs)
2462 TRACE("(%p %lu)\n", this, refs);
2463 locale_facet_ctor_refs(&this->facet, refs);
2464 this->facet.vtable = &MSVCP_codecvt_base_vtable;
2465 return this;
2468 /* ??_Fcodecvt_base@std@@QAEXXZ */
2469 /* ??_Fcodecvt_base@std@@QEAAXXZ */
2470 DEFINE_THISCALL_WRAPPER(codecvt_base_ctor, 4)
2471 codecvt_base* __thiscall codecvt_base_ctor(codecvt_base *this)
2473 return codecvt_base_ctor_refs(this, 0);
2476 /* ??1codecvt_base@std@@UAE@XZ */
2477 /* ??1codecvt_base@std@@UEAA@XZ */
2478 DEFINE_THISCALL_WRAPPER(codecvt_base_dtor, 4)
2479 void __thiscall codecvt_base_dtor(codecvt_base *this)
2481 TRACE("(%p)\n", this);
2482 locale_facet_dtor(&this->facet);
2485 DEFINE_THISCALL_WRAPPER(codecvt_base_vector_dtor, 8)
2486 codecvt_base* __thiscall codecvt_base_vector_dtor(codecvt_base *this, unsigned int flags)
2488 TRACE("(%p %x)\n", this, flags);
2489 if(flags & 2) {
2490 /* we have an array, with the number of elements stored before the first object */
2491 INT_PTR i, *ptr = (INT_PTR *)this-1;
2493 for(i=*ptr-1; i>=0; i--)
2494 codecvt_base_dtor(this+i);
2495 MSVCRT_operator_delete(ptr);
2496 } else {
2497 codecvt_base_dtor(this);
2498 if(flags & 1)
2499 MSVCRT_operator_delete(this);
2502 return this;
2505 /* ?do_always_noconv@codecvt_base@std@@MBE_NXZ */
2506 /* ?do_always_noconv@codecvt_base@std@@MEBA_NXZ */
2507 #define call_codecvt_base_do_always_noconv(this) CALL_VTBL_FUNC(this, 4, \
2508 MSVCP_bool, (const codecvt_base*), (this))
2509 DEFINE_THISCALL_WRAPPER(codecvt_base_do_always_noconv, 4)
2510 MSVCP_bool __thiscall codecvt_base_do_always_noconv(const codecvt_base *this)
2512 TRACE("(%p)\n", this);
2513 return TRUE;
2516 /* ?always_noconv@codecvt_base@std@@QBE_NXZ */
2517 /* ?always_noconv@codecvt_base@std@@QEBA_NXZ */
2518 DEFINE_THISCALL_WRAPPER(codecvt_base_always_noconv, 4)
2519 MSVCP_bool __thiscall codecvt_base_always_noconv(const codecvt_base *this)
2521 TRACE("(%p)\n", this);
2522 return call_codecvt_base_do_always_noconv(this);
2525 /* ?do_max_length@codecvt_base@std@@MBEHXZ */
2526 /* ?do_max_length@codecvt_base@std@@MEBAHXZ */
2527 #define call_codecvt_base_do_max_length(this) CALL_VTBL_FUNC(this, 8, \
2528 int, (const codecvt_base*), (this))
2529 DEFINE_THISCALL_WRAPPER(codecvt_base_do_max_length, 4)
2530 int __thiscall codecvt_base_do_max_length(const codecvt_base *this)
2532 TRACE("(%p)\n", this);
2533 return 1;
2536 /* ?max_length@codecvt_base@std@@QBEHXZ */
2537 /* ?max_length@codecvt_base@std@@QEBAHXZ */
2538 DEFINE_THISCALL_WRAPPER(codecvt_base_max_length, 4)
2539 int __thiscall codecvt_base_max_length(const codecvt_base *this)
2541 TRACE("(%p)\n", this);
2542 return call_codecvt_base_do_max_length(this);
2545 /* ?do_encoding@codecvt_base@std@@MBEHXZ */
2546 /* ?do_encoding@codecvt_base@std@@MEBAHXZ */
2547 #define call_codecvt_base_do_encoding(this) CALL_VTBL_FUNC(this, 12, \
2548 int, (const codecvt_base*), (this))
2549 DEFINE_THISCALL_WRAPPER(codecvt_base_do_encoding, 4)
2550 int __thiscall codecvt_base_do_encoding(const codecvt_base *this)
2552 TRACE("(%p)\n", this);
2553 return 1;
2556 /* ?encoding@codecvt_base@std@@QBEHXZ */
2557 /* ?encoding@codecvt_base@std@@QEBAHXZ */
2558 DEFINE_THISCALL_WRAPPER(codecvt_base_encoding, 4)
2559 int __thiscall codecvt_base_encoding(const codecvt_base *this)
2561 TRACE("(%p)\n", this);
2562 return call_codecvt_base_do_encoding(this);
2565 /* ?id@?$codecvt@DDH@std@@2V0locale@2@A */
2566 locale_id codecvt_char_id = {0};
2568 /* ??_7?$codecvt@DDH@std@@6B@ */
2569 extern const vtable_ptr MSVCP_codecvt_char_vtable;
2571 /* ?_Init@?$codecvt@DDH@std@@IAEXABV_Locinfo@2@@Z */
2572 /* ?_Init@?$codecvt@DDH@std@@IEAAXAEBV_Locinfo@2@@Z */
2573 DEFINE_THISCALL_WRAPPER(codecvt_char__Init, 8)
2574 void __thiscall codecvt_char__Init(codecvt_char *this, const _Locinfo *locinfo)
2576 TRACE("(%p %p)\n", this, locinfo);
2579 /* ??0?$codecvt@DDH@std@@QAE@ABV_Locinfo@1@I@Z */
2580 /* ??0?$codecvt@DDH@std@@QEAA@AEBV_Locinfo@1@_K@Z */
2581 DEFINE_THISCALL_WRAPPER(codecvt_char_ctor_locinfo, 12)
2582 codecvt_char* __thiscall codecvt_char_ctor_locinfo(codecvt_char *this, const _Locinfo *locinfo, MSVCP_size_t refs)
2584 TRACE("(%p %p %lu)\n", this, locinfo, refs);
2585 codecvt_base_ctor_refs(&this->base, refs);
2586 this->base.facet.vtable = &MSVCP_codecvt_char_vtable;
2587 return this;
2590 /* ??0?$codecvt@DDH@std@@QAE@I@Z */
2591 /* ??0?$codecvt@DDH@std@@QEAA@_K@Z */
2592 DEFINE_THISCALL_WRAPPER(codecvt_char_ctor_refs, 8)
2593 codecvt_char* __thiscall codecvt_char_ctor_refs(codecvt_char *this, MSVCP_size_t refs)
2595 return codecvt_char_ctor_locinfo(this, NULL, refs);
2598 /* ??_F?$codecvt@DDH@std@@QAEXXZ */
2599 /* ??_F?$codecvt@DDH@std@@QEAAXXZ */
2600 DEFINE_THISCALL_WRAPPER(codecvt_char_ctor, 4)
2601 codecvt_char* __thiscall codecvt_char_ctor(codecvt_char *this)
2603 return codecvt_char_ctor_locinfo(this, NULL, 0);
2606 /* ??1?$codecvt@DDH@std@@UAE@XZ */
2607 /* ??1?$codecvt@DDH@std@@UEAA@XZ */
2608 /* ??1?$codecvt@DDH@std@@MAE@XZ */
2609 /* ??1?$codecvt@DDH@std@@MEAA@XZ */
2610 DEFINE_THISCALL_WRAPPER(codecvt_char_dtor, 4)
2611 void __thiscall codecvt_char_dtor(codecvt_char *this)
2613 TRACE("(%p)\n", this);
2614 codecvt_base_dtor(&this->base);
2617 DEFINE_THISCALL_WRAPPER(codecvt_char_vector_dtor, 8)
2618 codecvt_char* __thiscall codecvt_char_vector_dtor(codecvt_char *this, unsigned int flags)
2620 TRACE("(%p %x)\n", this, flags);
2621 if(flags & 2) {
2622 /* we have an array, with the number of elements stored before the first object */
2623 INT_PTR i, *ptr = (INT_PTR *)this-1;
2625 for(i=*ptr-1; i>=0; i--)
2626 codecvt_char_dtor(this+i);
2627 MSVCRT_operator_delete(ptr);
2628 } else {
2629 codecvt_char_dtor(this);
2630 if(flags & 1)
2631 MSVCRT_operator_delete(this);
2634 return this;
2637 /* ?_Getcat@?$codecvt@DDH@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
2638 /* ?_Getcat@?$codecvt@DDH@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
2639 MSVCP_size_t __cdecl codecvt_char__Getcat(const locale_facet **facet, const locale *loc)
2641 TRACE("(%p %p)\n", facet, loc);
2643 if(facet && !*facet) {
2644 *facet = MSVCRT_operator_new(sizeof(codecvt_char));
2645 if(!*facet) {
2646 ERR("Out of memory\n");
2647 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
2648 return 0;
2650 codecvt_char_ctor((codecvt_char*)*facet);
2653 return LC_CTYPE;
2656 codecvt_char* codecvt_char_use_facet(const locale *loc)
2658 static codecvt_char *obj = NULL;
2660 _Lockit lock;
2661 const locale_facet *fac;
2663 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
2664 fac = locale__Getfacet(loc, locale_id_operator_size_t(&codecvt_char_id), TRUE);
2665 if(fac) {
2666 _Lockit_dtor(&lock);
2667 return (codecvt_char*)fac;
2670 if(obj) {
2671 _Lockit_dtor(&lock);
2672 return obj;
2675 codecvt_char__Getcat(&fac, loc);
2676 obj = (codecvt_char*)fac;
2677 locale_facet__Incref(&obj->base.facet);
2678 locale_facet_register(&obj->base.facet);
2679 _Lockit_dtor(&lock);
2681 return obj;
2684 /* ?do_in@?$codecvt@DDH@std@@MBEHAAHPBD1AAPBDPAD3AAPAD@Z */
2685 /* ?do_in@?$codecvt@DDH@std@@MEBAHAEAHPEBD1AEAPEBDPEAD3AEAPEAD@Z */
2686 #define call_codecvt_char_do_in(this, state, from, from_end, from_next, to, to_end, to_next) \
2687 CALL_VTBL_FUNC(this, 16, int, \
2688 (const codecvt_char*, int*, const char*, const char*, const char**, char*, char*, char**), \
2689 (this, state, from, from_end, from_next, to, to_end, to_next))
2690 DEFINE_THISCALL_WRAPPER(codecvt_char_do_in, 32)
2691 int __thiscall codecvt_char_do_in(const codecvt_char *this, int *state,
2692 const char *from, const char *from_end, const char **from_next,
2693 char *to, char *to_end, char **to_next)
2695 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from, from_end,
2696 from_next, to, to_end, to_next);
2697 *from_next = from;
2698 *to_next = to;
2699 return CODECVT_noconv;
2702 /* ?in@?$codecvt@DDH@std@@QBEHAAHPBD1AAPBDPAD3AAPAD@Z */
2703 /* ?in@?$codecvt@DDH@std@@QEBAHAEAHPEBD1AEAPEBDPEAD3AEAPEAD@Z */
2704 DEFINE_THISCALL_WRAPPER(codecvt_char_in, 32)
2705 int __thiscall codecvt_char_in(const codecvt_char *this, int *state,
2706 const char *from, const char *from_end, const char **from_next,
2707 char *to, char *to_end, char **to_next)
2709 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from, from_end,
2710 from_next, to, to_end, to_next);
2711 return call_codecvt_char_do_in(this, state, from, from_end, from_next,
2712 to, to_end, to_next);
2715 /* ?do_out@?$codecvt@DDH@std@@MBEHAAHPBD1AAPBDPAD3AAPAD@Z */
2716 /* ?do_out@?$codecvt@DDH@std@@MEBAHAEAHPEBD1AEAPEBDPEAD3AEAPEAD@Z */
2717 #define call_codecvt_char_do_out(this, state, from, from_end, from_next, to, to_end, to_next) \
2718 CALL_VTBL_FUNC(this, 20, int, \
2719 (const codecvt_char*, int*, const char*, const char*, const char**, char*, char*, char**), \
2720 (this, state, from, from_end, from_next, to, to_end, to_next))
2721 DEFINE_THISCALL_WRAPPER(codecvt_char_do_out, 32)
2722 int __thiscall codecvt_char_do_out(const codecvt_char *this, int *state,
2723 const char *from, const char *from_end, const char **from_next,
2724 char *to, char *to_end, char **to_next)
2726 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from,
2727 from_end, from_next, to, to_end, to_next);
2728 *from_next = from;
2729 *to_next = to;
2730 return CODECVT_noconv;
2733 /* ?out@?$codecvt@DDH@std@@QBEHAAHPBD1AAPBDPAD3AAPAD@Z */
2734 /* ?out@?$codecvt@DDH@std@@QEBAHAEAHPEBD1AEAPEBDPEAD3AEAPEAD@Z */
2735 DEFINE_THISCALL_WRAPPER(codecvt_char_out, 32)
2736 int __thiscall codecvt_char_out(const codecvt_char *this, int *state,
2737 const char *from, const char *from_end, const char **from_next,
2738 char *to, char *to_end, char **to_next)
2740 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from, from_end,
2741 from_next, to, to_end, to_next);
2742 return call_codecvt_char_do_out(this, state, from, from_end, from_next,
2743 to, to_end, to_next);
2746 /* ?do_unshift@?$codecvt@DDH@std@@MBEHAAHPAD1AAPAD@Z */
2747 /* ?do_unshift@?$codecvt@DDH@std@@MEBAHAEAHPEAD1AEAPEAD@Z */
2748 #define call_codecvt_char_do_unshift(this, state, to, to_end, to_next) CALL_VTBL_FUNC(this, 24, \
2749 int, (const codecvt_char*, int*, char*, char*, char**), (this, state, to, to_end, to_next))
2750 DEFINE_THISCALL_WRAPPER(codecvt_char_do_unshift, 20)
2751 int __thiscall codecvt_char_do_unshift(const codecvt_char *this,
2752 int *state, char *to, char *to_end, char **to_next)
2754 TRACE("(%p %p %p %p %p)\n", this, state, to, to_end, to_next);
2755 *to_next = to;
2756 return CODECVT_noconv;
2759 /* ?do_length@?$codecvt@DDH@std@@MBEHABHPBD1I@Z */
2760 /* ?do_length@?$codecvt@DDH@std@@MEBAHAEBHPEBD1_K@Z */
2761 #define call_codecvt_char_do_length(this, state, from, from_end, max) CALL_VTBL_FUNC(this, 28, \
2762 int, (const codecvt_char*, const int*, const char*, const char*, MSVCP_size_t), \
2763 (this, state, from, from_end, max))
2764 DEFINE_THISCALL_WRAPPER(codecvt_char_do_length, 20)
2765 int __thiscall codecvt_char_do_length(const codecvt_char *this, const int *state,
2766 const char *from, const char *from_end, MSVCP_size_t max)
2768 TRACE("(%p %p %p %p %lu)\n", this, state, from, from_end, max);
2769 return (from_end-from > max ? max : from_end-from);
2772 /* ?length@?$codecvt@DDH@std@@QBEHABHPBD1I@Z */
2773 /* ?length@?$codecvt@DDH@std@@QEBAHAEBHPEBD1_K@Z */
2774 DEFINE_THISCALL_WRAPPER(codecvt_char_length, 20)
2775 int __thiscall codecvt_char_length(const codecvt_char *this, const int *state,
2776 const char *from, const char *from_end, MSVCP_size_t max)
2778 TRACE("(%p %p %p %p %lu)\n", this, state, from, from_end, max);
2779 return call_codecvt_char_do_length(this, state, from, from_end, max);
2782 /* ?id@?$codecvt@_WDH@std@@2V0locale@2@A */
2783 locale_id codecvt_wchar_id = {0};
2784 /* ?id@?$codecvt@GDH@std@@2V0locale@2@A */
2785 locale_id codecvt_short_id = {0};
2787 /* ??_7?$codecvt@_WDH@std@@6B@ */
2788 extern const vtable_ptr MSVCP_codecvt_wchar_vtable;
2789 /* ??_7?$codecvt@GDH@std@@6B@ */
2790 extern const vtable_ptr MSVCP_codecvt_short_vtable;
2792 /* ?_Init@?$codecvt@GDH@std@@IAEXABV_Locinfo@2@@Z */
2793 /* ?_Init@?$codecvt@GDH@std@@IEAAXAEBV_Locinfo@2@@Z */
2794 /* ?_Init@?$codecvt@_WDH@std@@IAEXABV_Locinfo@2@@Z */
2795 /* ?_Init@?$codecvt@_WDH@std@@IEAAXAEBV_Locinfo@2@@Z */
2796 DEFINE_THISCALL_WRAPPER(codecvt_wchar__Init, 8)
2797 void __thiscall codecvt_wchar__Init(codecvt_wchar *this, const _Locinfo *locinfo)
2799 TRACE("(%p %p)\n", this, locinfo);
2800 _Locinfo__Getcvt(locinfo, &this->cvt);
2803 /* ??0?$codecvt@_WDH@std@@QAE@ABV_Locinfo@1@I@Z */
2804 /* ??0?$codecvt@_WDH@std@@QEAA@AEBV_Locinfo@1@_K@Z */
2805 DEFINE_THISCALL_WRAPPER(codecvt_wchar_ctor_locinfo, 12)
2806 codecvt_wchar* __thiscall codecvt_wchar_ctor_locinfo(codecvt_wchar *this, const _Locinfo *locinfo, MSVCP_size_t refs)
2808 TRACE("(%p %p %ld)\n", this, locinfo, refs);
2810 codecvt_base_ctor_refs(&this->base, refs);
2811 this->base.facet.vtable = &MSVCP_codecvt_wchar_vtable;
2813 codecvt_wchar__Init(this, locinfo);
2814 return this;
2817 /* ??0?$codecvt@GDH@std@@QAE@ABV_Locinfo@1@I@Z */
2818 /* ??0?$codecvt@GDH@std@@QEAA@AEBV_Locinfo@1@_K@Z */
2819 DEFINE_THISCALL_WRAPPER(codecvt_short_ctor_locinfo, 12)
2820 codecvt_wchar* __thiscall codecvt_short_ctor_locinfo(codecvt_wchar *this, const _Locinfo *locinfo, MSVCP_size_t refs)
2822 TRACE("(%p %p %ld)\n", this, locinfo, refs);
2824 codecvt_wchar_ctor_locinfo(this, locinfo, refs);
2825 this->base.facet.vtable = &MSVCP_codecvt_short_vtable;
2826 return this;
2829 /* ??0?$codecvt@GDH@std@@QAE@I@Z */
2830 /* ??0?$codecvt@GDH@std@@QEAA@_K@Z */
2831 DEFINE_THISCALL_WRAPPER(codecvt_short_ctor_refs, 8)
2832 codecvt_wchar* __thiscall codecvt_short_ctor_refs(codecvt_wchar *this, MSVCP_size_t refs)
2834 _Locinfo locinfo;
2836 TRACE("(%p %ld)\n", this, refs);
2838 _Locinfo_ctor(&locinfo);
2839 codecvt_short_ctor_locinfo(this, &locinfo, refs);
2840 _Locinfo_dtor(&locinfo);
2841 return this;
2844 /* ??_F?$codecvt@GDH@std@@QAEXXZ */
2845 /* ??_F?$codecvt@GDH@std@@QEAAXXZ */
2846 DEFINE_THISCALL_WRAPPER(codecvt_short_ctor, 4)
2847 codecvt_wchar* __thiscall codecvt_short_ctor(codecvt_wchar *this)
2849 return codecvt_short_ctor_refs(this, 0);
2852 /* ??1?$codecvt@GDH@std@@UAE@XZ */
2853 /* ??1?$codecvt@GDH@std@@UEAA@XZ */
2854 /* ??1?$codecvt@GDH@std@@MAE@XZ */
2855 /* ??1?$codecvt@GDH@std@@MEAA@XZ */
2856 /* ??1?$codecvt@_WDH@std@@MAE@XZ */
2857 /* ??1?$codecvt@_WDH@std@@MEAA@XZ */
2858 DEFINE_THISCALL_WRAPPER(codecvt_wchar_dtor, 4)
2859 void __thiscall codecvt_wchar_dtor(codecvt_wchar *this)
2861 TRACE("(%p)\n", this);
2862 codecvt_base_dtor(&this->base);
2865 DEFINE_THISCALL_WRAPPER(codecvt_wchar_vector_dtor, 8)
2866 codecvt_wchar* __thiscall codecvt_wchar_vector_dtor(codecvt_wchar *this, unsigned int flags)
2868 TRACE("(%p %x)\n", this, flags);
2869 if(flags & 2) {
2870 /* we have an array, with the number of elements stored before the first object */
2871 INT_PTR i, *ptr = (INT_PTR *)this-1;
2873 for(i=*ptr-1; i>=0; i--)
2874 codecvt_wchar_dtor(this+i);
2875 MSVCRT_operator_delete(ptr);
2876 } else {
2877 codecvt_wchar_dtor(this);
2878 if(flags & 1)
2879 MSVCRT_operator_delete(this);
2882 return this;
2885 /* ?_Getcat@?$codecvt@_WDH@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
2886 /* ?_Getcat@?$codecvt@_WDH@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
2887 MSVCP_size_t __cdecl codecvt_wchar__Getcat(const locale_facet **facet, const locale *loc)
2889 TRACE("(%p %p)\n", facet, loc);
2891 if(facet && !*facet) {
2892 _Locinfo locinfo;
2894 *facet = MSVCRT_operator_new(sizeof(codecvt_wchar));
2895 if(!*facet) {
2896 ERR("Out of memory\n");
2897 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
2898 return 0;
2901 _Locinfo_ctor_cstr(&locinfo, locale_string_char_c_str(&loc->ptr->name));
2902 codecvt_wchar_ctor_locinfo((codecvt_wchar*)*facet, &locinfo, 0);
2903 _Locinfo_dtor(&locinfo);
2906 return LC_CTYPE;
2909 static codecvt_wchar* codecvt_wchar_use_facet(const locale *loc)
2911 static codecvt_wchar *obj = NULL;
2913 _Lockit lock;
2914 const locale_facet *fac;
2916 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
2917 fac = locale__Getfacet(loc, locale_id_operator_size_t(&codecvt_wchar_id), TRUE);
2918 if(fac) {
2919 _Lockit_dtor(&lock);
2920 return (codecvt_wchar*)fac;
2923 if(obj) {
2924 _Lockit_dtor(&lock);
2925 return obj;
2928 codecvt_wchar__Getcat(&fac, loc);
2929 obj = (codecvt_wchar*)fac;
2930 locale_facet__Incref(&obj->base.facet);
2931 locale_facet_register(&obj->base.facet);
2932 _Lockit_dtor(&lock);
2934 return obj;
2937 /* ?_Getcat@?$codecvt@GDH@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
2938 /* ?_Getcat@?$codecvt@GDH@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
2939 MSVCP_size_t __cdecl codecvt_short__Getcat(const locale_facet **facet, const locale *loc)
2941 TRACE("(%p %p)\n", facet, loc);
2943 if(facet && !*facet) {
2944 _Locinfo locinfo;
2946 *facet = MSVCRT_operator_new(sizeof(codecvt_wchar));
2947 if(!*facet) {
2948 ERR("Out of memory\n");
2949 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
2950 return 0;
2953 _Locinfo_ctor_cstr(&locinfo, locale_string_char_c_str(&loc->ptr->name));
2954 codecvt_short_ctor((codecvt_wchar*)*facet);
2955 _Locinfo_dtor(&locinfo);
2958 return LC_CTYPE;
2961 codecvt_wchar* codecvt_short_use_facet(const locale *loc)
2963 static codecvt_wchar *obj = NULL;
2965 _Lockit lock;
2966 const locale_facet *fac;
2968 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
2969 fac = locale__Getfacet(loc, locale_id_operator_size_t(&codecvt_short_id), TRUE);
2970 if(fac) {
2971 _Lockit_dtor(&lock);
2972 return (codecvt_wchar*)fac;
2975 if(obj) {
2976 _Lockit_dtor(&lock);
2977 return obj;
2980 codecvt_short__Getcat(&fac, loc);
2981 obj = (codecvt_wchar*)fac;
2982 locale_facet__Incref(&obj->base.facet);
2983 locale_facet_register(&obj->base.facet);
2984 _Lockit_dtor(&lock);
2986 return obj;
2989 /* ?do_always_noconv@?$codecvt@GDH@std@@MBE_NXZ */
2990 /* ?do_always_noconv@?$codecvt@GDH@std@@MEBA_NXZ */
2991 /* ?do_always_noconv@?$codecvt@_WDH@std@@MBE_NXZ */
2992 /* ?do_always_noconv@?$codecvt@_WDH@std@@MEBA_NXZ */
2993 DEFINE_THISCALL_WRAPPER(codecvt_wchar_do_always_noconv, 4)
2994 MSVCP_bool __thiscall codecvt_wchar_do_always_noconv(const codecvt_wchar *this)
2996 TRACE("(%p)\n", this);
2997 return FALSE;
3000 /* ?do_max_length@?$codecvt@GDH@std@@MBEHXZ */
3001 /* ?do_max_length@?$codecvt@GDH@std@@MEBAHXZ */
3002 /* ?do_max_length@?$codecvt@_WDH@std@@MBEHXZ */
3003 /* ?do_max_length@?$codecvt@_WDH@std@@MEBAHXZ */
3004 DEFINE_THISCALL_WRAPPER(codecvt_wchar_do_max_length, 4)
3005 int __thiscall codecvt_wchar_do_max_length(const codecvt_wchar *this)
3007 TRACE("(%p)\n", this);
3008 return MB_LEN_MAX;
3011 /* ?do_in@?$codecvt@GDH@std@@MBEHAAHPBD1AAPBDPAG3AAPAG@Z */
3012 /* ?do_in@?$codecvt@GDH@std@@MEBAHAEAHPEBD1AEAPEBDPEAG3AEAPEAG@Z */
3013 /* ?do_in@?$codecvt@_WDH@std@@MBEHAAHPBD1AAPBDPA_W3AAPA_W@Z */
3014 /* ?do_in@?$codecvt@_WDH@std@@MEBAHAEAHPEBD1AEAPEBDPEA_W3AEAPEA_W@Z */
3015 #define call_codecvt_wchar_do_in(this, state, from, from_end, from_next, to, to_end, to_next) \
3016 CALL_VTBL_FUNC(this, 16, int, \
3017 (const codecvt_wchar*, int*, const char*, const char*, const char**, wchar_t*, wchar_t*, wchar_t**), \
3018 (this, state, from, from_end, from_next, to, to_end, to_next))
3019 DEFINE_THISCALL_WRAPPER(codecvt_wchar_do_in, 32)
3020 int __thiscall codecvt_wchar_do_in(const codecvt_wchar *this, int *state,
3021 const char *from, const char *from_end, const char **from_next,
3022 wchar_t *to, wchar_t *to_end, wchar_t **to_next)
3024 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from,
3025 from_end, from_next, to, to_end, to_next);
3027 *from_next = from;
3028 *to_next = to;
3030 while(*from_next!=from_end && *to_next!=to_end) {
3031 switch(_Mbrtowc(*to_next, *from_next, from_end-*from_next, state, &this->cvt)) {
3032 case -2:
3033 *from_next = from_end;
3034 return CODECVT_partial;
3035 case -1:
3036 return CODECVT_error;
3037 case 2:
3038 (*from_next)++;
3039 /* fall through */
3040 case 0:
3041 case 1:
3042 (*from_next)++;
3043 (*to_next)++;
3047 return CODECVT_ok;
3050 /* ?in@?$codecvt@GDH@std@@QBEHAAHPBD1AAPBDPAG3AAPAG@Z */
3051 /* ?in@?$codecvt@GDH@std@@QEBAHAEAHPEBD1AEAPEBDPEAG3AEAPEAG@Z */
3052 /* ?in@?$codecvt@_WDH@std@@QBEHAAHPBD1AAPBDPA_W3AAPA_W@Z */
3053 /* ?in@?$codecvt@_WDH@std@@QEBAHAEAHPEBD1AEAPEBDPEA_W3AEAPEA_W@Z */
3054 DEFINE_THISCALL_WRAPPER(codecvt_wchar_in, 32)
3055 int __thiscall codecvt_wchar_in(const codecvt_wchar *this, int *state,
3056 const char *from, const char *from_end, const char **from_next,
3057 wchar_t *to, wchar_t *to_end, wchar_t **to_next)
3059 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from,
3060 from_end, from_next, to, to_end, to_next);
3061 return call_codecvt_wchar_do_in(this, state, from,
3062 from_end, from_next, to, to_end, to_next);
3065 /* ?do_out@?$codecvt@GDH@std@@MBEHAAHPBG1AAPBGPAD3AAPAD@Z */
3066 /* ?do_out@?$codecvt@GDH@std@@MEBAHAEAHPEBG1AEAPEBGPEAD3AEAPEAD@Z */
3067 /* ?do_out@?$codecvt@_WDH@std@@MBEHAAHPB_W1AAPB_WPAD3AAPAD@Z */
3068 /* ?do_out@?$codecvt@_WDH@std@@MEBAHAEAHPEB_W1AEAPEB_WPEAD3AEAPEAD@Z */
3069 #define call_codecvt_wchar_do_out(this, state, from, from_end, from_next, to, to_end, to_next) \
3070 CALL_VTBL_FUNC(this, 20, int, \
3071 (const codecvt_wchar*, int*, const wchar_t*, const wchar_t*, const wchar_t**, char*, char*, char**), \
3072 (this, state, from, from_end, from_next, to, to_end, to_next))
3073 DEFINE_THISCALL_WRAPPER(codecvt_wchar_do_out, 32)
3074 int __thiscall codecvt_wchar_do_out(const codecvt_wchar *this, int *state,
3075 const wchar_t *from, const wchar_t *from_end, const wchar_t **from_next,
3076 char *to, char *to_end, char **to_next)
3078 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from,
3079 from_end, from_next, to, to_end, to_next);
3081 *from_next = from;
3082 *to_next = to;
3084 while(*from_next!=from_end && *to_next!=to_end) {
3085 int old_state = *state, size;
3086 char buf[MB_LEN_MAX];
3088 switch((size = _Wcrtomb(buf, **from_next, state, &this->cvt))) {
3089 case -1:
3090 return CODECVT_error;
3091 default:
3092 if(size > from_end-*from_next) {
3093 *state = old_state;
3094 return CODECVT_partial;
3097 (*from_next)++;
3098 memcpy_s(*to_next, to_end-*to_next, buf, size);
3099 (*to_next) += size;
3103 return CODECVT_ok;
3106 /* ?out@?$codecvt@GDH@std@@QBEHAAHPBG1AAPBGPAD3AAPAD@Z */
3107 /* ?out@?$codecvt@GDH@std@@QEBAHAEAHPEBG1AEAPEBGPEAD3AEAPEAD@Z */
3108 /* ?out@?$codecvt@_WDH@std@@QBEHAAHPB_W1AAPB_WPAD3AAPAD@Z */
3109 /* ?out@?$codecvt@_WDH@std@@QEBAHAEAHPEB_W1AEAPEB_WPEAD3AEAPEAD@Z */
3110 DEFINE_THISCALL_WRAPPER(codecvt_wchar_out, 32)
3111 int __thiscall codecvt_wchar_out(const codecvt_wchar *this, int *state,
3112 const wchar_t *from, const wchar_t *from_end, const wchar_t **from_next,
3113 char *to, char *to_end, char **to_next)
3115 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from,
3116 from_end, from_next, to, to_end, to_next);
3117 return call_codecvt_wchar_do_out(this, state, from,
3118 from_end, from_next, to, to_end, to_next);
3121 /* ?do_unshift@?$codecvt@GDH@std@@MBEHAAHPAD1AAPAD@Z */
3122 /* ?do_unshift@?$codecvt@GDH@std@@MEBAHAEAHPEAD1AEAPEAD@Z */
3123 /* ?do_unshift@?$codecvt@_WDH@std@@MBEHAAHPAD1AAPAD@Z */
3124 /* ?do_unshift@?$codecvt@_WDH@std@@MEBAHAEAHPEAD1AEAPEAD@Z */
3125 #define call_codecvt_wchar_do_unshift(this, state, to, to_end, to_next) CALL_VTBL_FUNC(this, 24, \
3126 int, (const codecvt_wchar*, int*, char*, char*, char**), (this, state, to, to_end, to_next))
3127 DEFINE_THISCALL_WRAPPER(codecvt_wchar_do_unshift, 20)
3128 int __thiscall codecvt_wchar_do_unshift(const codecvt_wchar *this,
3129 int *state, char *to, char *to_end, char **to_next)
3131 TRACE("(%p %p %p %p %p)\n", this, state, to, to_end, to_next);
3132 if(*state)
3133 WARN("unexpected state: %x\n", *state);
3135 *to_next = to;
3136 return CODECVT_ok;
3139 /* ?do_length@?$codecvt@GDH@std@@MBEHABHPBD1I@Z */
3140 /* ?do_length@?$codecvt@GDH@std@@MEBAHAEBHPEBD1_K@Z */
3141 /* ?do_length@?$codecvt@_WDH@std@@MBEHABHPBD1I@Z */
3142 /* ?do_length@?$codecvt@_WDH@std@@MEBAHAEBHPEBD1_K@Z */
3143 #define call_codecvt_wchar_do_length(this, state, from, from_end, max) CALL_VTBL_FUNC(this, 28, \
3144 int, (const codecvt_wchar*, const int*, const char*, const char*, MSVCP_size_t), \
3145 (this, state, from, from_end, max))
3146 DEFINE_THISCALL_WRAPPER(codecvt_wchar_do_length, 20)
3147 int __thiscall codecvt_wchar_do_length(const codecvt_wchar *this, const int *state,
3148 const char *from, const char *from_end, MSVCP_size_t max)
3150 int tmp_state = *state, ret=0;
3152 TRACE("(%p %p %p %p %ld)\n", this, state, from, from_end, max);
3154 while(ret<max && from!=from_end) {
3155 switch(_Mbrtowc(NULL, from, from_end-from, &tmp_state, &this->cvt)) {
3156 case -2:
3157 case -1:
3158 return ret;
3159 case 2:
3160 from++;
3161 /* fall through */
3162 case 0:
3163 case 1:
3164 from++;
3165 ret++;
3169 return ret;
3172 /* ?id@?$numpunct@D@std@@2V0locale@2@A */
3173 locale_id numpunct_char_id = {0};
3175 /* ??_7?$numpunct@D@std@@6B@ */
3176 extern const vtable_ptr MSVCP_numpunct_char_vtable;
3178 /* ?_Init@?$numpunct@D@std@@IAEXABV_Locinfo@2@_N@Z */
3179 /* ?_Init@?$numpunct@D@std@@IEAAXAEBV_Locinfo@2@_N@Z */
3180 DEFINE_THISCALL_WRAPPER(numpunct_char__Init, 12)
3181 void __thiscall numpunct_char__Init(numpunct_char *this, const _Locinfo *locinfo, MSVCP_bool isdef)
3183 int len;
3185 TRACE("(%p %p %d)\n", this, locinfo, isdef);
3187 len = strlen(_Locinfo__Getfalse(locinfo))+1;
3188 this->false_name = MSVCRT_operator_new(len);
3189 if(this->false_name)
3190 memcpy((char*)this->false_name, _Locinfo__Getfalse(locinfo), len);
3192 len = strlen(_Locinfo__Gettrue(locinfo))+1;
3193 this->true_name = MSVCRT_operator_new(len);
3194 if(this->true_name)
3195 memcpy((char*)this->true_name, _Locinfo__Gettrue(locinfo), len);
3197 if(isdef) {
3198 this->grouping = MSVCRT_operator_new(1);
3199 if(this->grouping)
3200 *(char*)this->grouping = 0;
3202 this->dp = '.';
3203 this->sep = ',';
3204 } else {
3205 const struct lconv *lc = _Locinfo__Getlconv(locinfo);
3207 len = strlen(lc->grouping)+1;
3208 this->grouping = MSVCRT_operator_new(len);
3209 if(this->grouping)
3210 memcpy((char*)this->grouping, lc->grouping, len);
3212 this->dp = lc->decimal_point[0];
3213 this->sep = lc->thousands_sep[0];
3216 if(!this->false_name || !this->true_name || !this->grouping) {
3217 MSVCRT_operator_delete((char*)this->grouping);
3218 MSVCRT_operator_delete((char*)this->false_name);
3219 MSVCRT_operator_delete((char*)this->true_name);
3221 ERR("Out of memory\n");
3222 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
3226 /* ?_Tidy@?$numpunct@D@std@@AAEXXZ */
3227 /* ?_Tidy@?$numpunct@D@std@@AEAAXXZ */
3228 DEFINE_THISCALL_WRAPPER(numpunct_char__Tidy, 4)
3229 void __thiscall numpunct_char__Tidy(numpunct_char *this)
3231 TRACE("(%p)\n", this);
3233 MSVCRT_operator_delete((char*)this->grouping);
3234 MSVCRT_operator_delete((char*)this->false_name);
3235 MSVCRT_operator_delete((char*)this->true_name);
3238 /* ??0?$numpunct@D@std@@QAE@ABV_Locinfo@1@I_N@Z */
3239 /* ??0?$numpunct@D@std@@QEAA@AEBV_Locinfo@1@_K_N@Z */
3240 DEFINE_THISCALL_WRAPPER(numpunct_char_ctor_locinfo, 16)
3241 numpunct_char* __thiscall numpunct_char_ctor_locinfo(numpunct_char *this,
3242 const _Locinfo *locinfo, MSVCP_size_t refs, MSVCP_bool usedef)
3244 TRACE("(%p %p %lu %d)\n", this, locinfo, refs, usedef);
3245 locale_facet_ctor_refs(&this->facet, refs);
3246 this->facet.vtable = &MSVCP_numpunct_char_vtable;
3247 numpunct_char__Init(this, locinfo, usedef);
3248 return this;
3251 /* ??0?$numpunct@D@std@@IAE@PBDI_N@Z */
3252 /* ??0?$numpunct@D@std@@IEAA@PEBD_K_N@Z */
3253 DEFINE_THISCALL_WRAPPER(numpunct_char_ctor_name, 16)
3254 numpunct_char* __thiscall numpunct_char_ctor_name(numpunct_char *this,
3255 const char *name, MSVCP_size_t refs, MSVCP_bool usedef)
3257 _Locinfo locinfo;
3259 TRACE("(%p %s %lu %d)\n", this, debugstr_a(name), refs, usedef);
3260 locale_facet_ctor_refs(&this->facet, refs);
3261 this->facet.vtable = &MSVCP_numpunct_char_vtable;
3263 _Locinfo_ctor_cstr(&locinfo, name);
3264 numpunct_char__Init(this, &locinfo, usedef);
3265 _Locinfo_dtor(&locinfo);
3266 return this;
3269 /* ??0?$numpunct@D@std@@QAE@I@Z */
3270 /* ??0?$numpunct@D@std@@QEAA@_K@Z */
3271 DEFINE_THISCALL_WRAPPER(numpunct_char_ctor_refs, 8)
3272 numpunct_char* __thiscall numpunct_char_ctor_refs(numpunct_char *this, MSVCP_size_t refs)
3274 TRACE("(%p %lu)\n", this, refs);
3275 return numpunct_char_ctor_name(this, "C", refs, FALSE);
3278 /* ??_F?$numpunct@D@std@@QAEXXZ */
3279 /* ??_F?$numpunct@D@std@@QEAAXXZ */
3280 DEFINE_THISCALL_WRAPPER(numpunct_char_ctor, 4)
3281 numpunct_char* __thiscall numpunct_char_ctor(numpunct_char *this)
3283 return numpunct_char_ctor_refs(this, 0);
3286 /* ??1?$numpunct@D@std@@UAE@XZ */
3287 /* ??1?$numpunct@D@std@@UEAA@XZ */
3288 /* ??1?$numpunct@D@std@@MAE@XZ */
3289 /* ??1?$numpunct@D@std@@MEAA@XZ */
3290 DEFINE_THISCALL_WRAPPER(numpunct_char_dtor, 4)
3291 void __thiscall numpunct_char_dtor(numpunct_char *this)
3293 TRACE("(%p)\n", this);
3294 numpunct_char__Tidy(this);
3297 DEFINE_THISCALL_WRAPPER(numpunct_char_vector_dtor, 8)
3298 numpunct_char* __thiscall numpunct_char_vector_dtor(numpunct_char *this, unsigned int flags)
3300 TRACE("(%p %x)\n", this, flags);
3301 if(flags & 2) {
3302 /* we have an array, with the number of elements stored before the first object */
3303 INT_PTR i, *ptr = (INT_PTR *)this-1;
3305 for(i=*ptr-1; i>=0; i--)
3306 numpunct_char_dtor(this+i);
3307 MSVCRT_operator_delete(ptr);
3308 } else {
3309 numpunct_char_dtor(this);
3310 if(flags & 1)
3311 MSVCRT_operator_delete(this);
3314 return this;
3317 /* ?_Getcat@?$numpunct@D@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
3318 /* ?_Getcat@?$numpunct@D@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
3319 MSVCP_size_t __cdecl numpunct_char__Getcat(const locale_facet **facet, const locale *loc)
3321 TRACE("(%p %p)\n", facet, loc);
3323 if(facet && !*facet) {
3324 *facet = MSVCRT_operator_new(sizeof(numpunct_char));
3325 if(!*facet) {
3326 ERR("Out of memory\n");
3327 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
3328 return 0;
3330 numpunct_char_ctor_name((numpunct_char*)*facet,
3331 locale_string_char_c_str(&loc->ptr->name), 0, TRUE);
3334 return LC_NUMERIC;
3337 static numpunct_char* numpunct_char_use_facet(const locale *loc)
3339 static numpunct_char *obj = NULL;
3341 _Lockit lock;
3342 const locale_facet *fac;
3344 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
3345 fac = locale__Getfacet(loc, locale_id_operator_size_t(&numpunct_char_id), TRUE);
3346 if(fac) {
3347 _Lockit_dtor(&lock);
3348 return (numpunct_char*)fac;
3351 if(obj) {
3352 _Lockit_dtor(&lock);
3353 return obj;
3356 numpunct_char__Getcat(&fac, loc);
3357 obj = (numpunct_char*)fac;
3358 locale_facet__Incref(&obj->facet);
3359 locale_facet_register(&obj->facet);
3360 _Lockit_dtor(&lock);
3362 return obj;
3365 /* ?do_decimal_point@?$numpunct@D@std@@MBEDXZ */
3366 /* ?do_decimal_point@?$numpunct@D@std@@MEBADXZ */
3367 DEFINE_THISCALL_WRAPPER(numpunct_char_do_decimal_point, 4)
3368 #define call_numpunct_char_do_decimal_point(this) CALL_VTBL_FUNC(this, 4, \
3369 char, (const numpunct_char *this), (this))
3370 char __thiscall numpunct_char_do_decimal_point(const numpunct_char *this)
3372 TRACE("(%p)\n", this);
3373 return this->dp;
3376 /* ?decimal_point@?$numpunct@D@std@@QBEDXZ */
3377 /* ?decimal_point@?$numpunct@D@std@@QEBADXZ */
3378 DEFINE_THISCALL_WRAPPER(numpunct_char_decimal_point, 4)
3379 char __thiscall numpunct_char_decimal_point(const numpunct_char *this)
3381 TRACE("(%p)\n", this);
3382 return call_numpunct_char_do_decimal_point(this);
3385 /* ?do_thousands_sep@?$numpunct@D@std@@MBEDXZ */
3386 /* ?do_thousands_sep@?$numpunct@D@std@@MEBADXZ */
3387 DEFINE_THISCALL_WRAPPER(numpunct_char_do_thousands_sep, 4)
3388 #define call_numpunct_char_do_thousands_sep(this) CALL_VTBL_FUNC(this, 8, \
3389 char, (const numpunct_char*), (this))
3390 char __thiscall numpunct_char_do_thousands_sep(const numpunct_char *this)
3392 TRACE("(%p)\n", this);
3393 return this->sep;
3396 /* ?thousands_sep@?$numpunct@D@std@@QBEDXZ */
3397 /* ?thousands_sep@?$numpunct@D@std@@QEBADXZ */
3398 DEFINE_THISCALL_WRAPPER(numpunct_char_thousands_sep, 4)
3399 char __thiscall numpunct_char_thousands_sep(const numpunct_char *this)
3401 TRACE("(%p)\n", this);
3402 return call_numpunct_char_do_thousands_sep(this);
3405 /* ?do_grouping@?$numpunct@D@std@@MBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3406 /* ?do_grouping@?$numpunct@D@std@@MEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3407 DEFINE_THISCALL_WRAPPER(numpunct_char_do_grouping, 8)
3408 #define call_numpunct_char_do_grouping(this, ret) CALL_VTBL_FUNC(this, 12, \
3409 basic_string_char*, (const numpunct_char*, basic_string_char*), (this, ret))
3410 basic_string_char* __thiscall numpunct_char_do_grouping(
3411 const numpunct_char *this, basic_string_char *ret)
3413 TRACE("(%p)\n", this);
3414 return MSVCP_basic_string_char_ctor_cstr(ret, this->grouping);
3417 /* ?grouping@?$numpunct@D@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3418 /* ?grouping@?$numpunct@D@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3419 DEFINE_THISCALL_WRAPPER(numpunct_char_grouping, 8)
3420 basic_string_char* __thiscall numpunct_char_grouping(const numpunct_char *this, basic_string_char *ret)
3422 TRACE("(%p)\n", this);
3423 return call_numpunct_char_do_grouping(this, ret);
3426 /* ?do_falsename@?$numpunct@D@std@@MBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3427 /* ?do_falsename@?$numpunct@D@std@@MEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3428 DEFINE_THISCALL_WRAPPER(numpunct_char_do_falsename, 8)
3429 #define call_numpunct_char_do_falsename(this, ret) CALL_VTBL_FUNC(this, 16, \
3430 basic_string_char*, (const numpunct_char*, basic_string_char*), (this, ret))
3431 basic_string_char* __thiscall numpunct_char_do_falsename(
3432 const numpunct_char *this, basic_string_char *ret)
3434 TRACE("(%p)\n", this);
3435 return MSVCP_basic_string_char_ctor_cstr(ret, this->false_name);
3438 /* ?falsename@?$numpunct@D@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3439 /* ?falsename@?$numpunct@D@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3440 DEFINE_THISCALL_WRAPPER(numpunct_char_falsename, 8)
3441 basic_string_char* __thiscall numpunct_char_falsename(const numpunct_char *this, basic_string_char *ret)
3443 TRACE("(%p)\n", this);
3444 return call_numpunct_char_do_falsename(this, ret);
3447 /* ?do_truename@?$numpunct@D@std@@MBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3448 /* ?do_truename@?$numpunct@D@std@@MEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3449 DEFINE_THISCALL_WRAPPER(numpunct_char_do_truename, 8)
3450 #define call_numpunct_char_do_truename(this, ret) CALL_VTBL_FUNC(this, 20, \
3451 basic_string_char*, (const numpunct_char*, basic_string_char*), (this, ret))
3452 basic_string_char* __thiscall numpunct_char_do_truename(
3453 const numpunct_char *this, basic_string_char *ret)
3455 TRACE("(%p)\n", this);
3456 return MSVCP_basic_string_char_ctor_cstr(ret, this->true_name);
3459 /* ?truename@?$numpunct@D@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3460 /* ?truename@?$numpunct@D@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3461 DEFINE_THISCALL_WRAPPER(numpunct_char_truename, 8)
3462 basic_string_char* __thiscall numpunct_char_truename(const numpunct_char *this, basic_string_char *ret)
3464 TRACE("(%p)\n", this);
3465 return call_numpunct_char_do_truename(this, ret);
3468 /* ?id@?$numpunct@_W@std@@2V0locale@2@A */
3469 locale_id numpunct_wchar_id = {0};
3470 /* ?id@?$numpunct@G@std@@2V0locale@2@A */
3471 locale_id numpunct_short_id = {0};
3473 /* ??_7?$numpunct@_W@std@@6B@ */
3474 extern const vtable_ptr MSVCP_numpunct_wchar_vtable;
3475 /* ??_7?$numpunct@G@std@@6B@ */
3476 extern const vtable_ptr MSVCP_numpunct_short_vtable;
3478 /* ?_Init@?$numpunct@_W@std@@IAEXABV_Locinfo@2@_N@Z */
3479 /* ?_Init@?$numpunct@_W@std@@IEAAXAEBV_Locinfo@2@_N@Z */
3480 /* ?_Init@?$numpunct@G@std@@IAEXABV_Locinfo@2@_N@Z */
3481 /* ?_Init@?$numpunct@G@std@@IEAAXAEBV_Locinfo@2@_N@Z */
3482 DEFINE_THISCALL_WRAPPER(numpunct_wchar__Init, 12)
3483 void __thiscall numpunct_wchar__Init(numpunct_wchar *this,
3484 const _Locinfo *locinfo, MSVCP_bool isdef)
3486 const char *to_convert;
3487 _Cvtvec cvt;
3488 int len;
3490 TRACE("(%p %p %d)\n", this, locinfo, isdef);
3492 _Locinfo__Getcvt(locinfo, &cvt);
3494 to_convert = _Locinfo__Getfalse(locinfo);
3495 len = MultiByteToWideChar(cvt.page, 0, to_convert, -1, NULL, 0);
3496 this->false_name = MSVCRT_operator_new(len*sizeof(WCHAR));
3497 if(this->false_name)
3498 MultiByteToWideChar(cvt.page, 0, to_convert, -1,
3499 (wchar_t*)this->false_name, len);
3501 to_convert = _Locinfo__Gettrue(locinfo);
3502 len = MultiByteToWideChar(cvt.page, 0, to_convert, -1, NULL, 0);
3503 this->true_name = MSVCRT_operator_new(len*sizeof(WCHAR));
3504 if(this->true_name)
3505 MultiByteToWideChar(cvt.page, 0, to_convert, -1,
3506 (wchar_t*)this->true_name, len);
3508 if(isdef) {
3509 this->grouping = MSVCRT_operator_new(1);
3510 if(this->grouping)
3511 *(char*)this->grouping = 0;
3513 this->dp = '.';
3514 this->sep = ',';
3515 } else {
3516 const struct lconv *lc = _Locinfo__Getlconv(locinfo);
3518 len = strlen(lc->grouping)+1;
3519 this->grouping = MSVCRT_operator_new(len);
3520 if(this->grouping)
3521 memcpy((char*)this->grouping, lc->grouping, len);
3523 this->dp = mb_to_wc(lc->decimal_point[0], &cvt);
3524 this->sep = mb_to_wc(lc->thousands_sep[0], &cvt);
3527 if(!this->false_name || !this->true_name || !this->grouping) {
3528 MSVCRT_operator_delete((char*)this->grouping);
3529 MSVCRT_operator_delete((wchar_t*)this->false_name);
3530 MSVCRT_operator_delete((wchar_t*)this->true_name);
3532 ERR("Out of memory\n");
3533 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
3537 /* ?_Tidy@?$numpunct@_W@std@@AAEXXZ */
3538 /* ?_Tidy@?$numpunct@_W@std@@AEAAXXZ */
3539 /* ?_Tidy@?$numpunct@G@std@@AAEXXZ */
3540 /* ?_Tidy@?$numpunct@G@std@@AEAAXXZ */
3541 DEFINE_THISCALL_WRAPPER(numpunct_wchar__Tidy, 4)
3542 void __thiscall numpunct_wchar__Tidy(numpunct_wchar *this)
3544 TRACE("(%p)\n", this);
3546 MSVCRT_operator_delete((char*)this->grouping);
3547 MSVCRT_operator_delete((wchar_t*)this->false_name);
3548 MSVCRT_operator_delete((wchar_t*)this->true_name);
3551 /* ??0?$numpunct@_W@std@@QAE@ABV_Locinfo@1@I_N@Z */
3552 /* ??0?$numpunct@_W@std@@QEAA@AEBV_Locinfo@1@_K_N@Z */
3553 DEFINE_THISCALL_WRAPPER(numpunct_wchar_ctor_locinfo, 16)
3554 numpunct_wchar* __thiscall numpunct_wchar_ctor_locinfo(numpunct_wchar *this,
3555 const _Locinfo *locinfo, MSVCP_size_t refs, MSVCP_bool usedef)
3557 TRACE("(%p %p %lu %d)\n", this, locinfo, refs, usedef);
3558 locale_facet_ctor_refs(&this->facet, refs);
3559 this->facet.vtable = &MSVCP_numpunct_wchar_vtable;
3560 numpunct_wchar__Init(this, locinfo, usedef);
3561 return this;
3564 /* ??0?$numpunct@G@std@@QAE@ABV_Locinfo@1@I_N@Z */
3565 /* ??0?$numpunct@G@std@@QEAA@AEBV_Locinfo@1@_K_N@Z */
3566 DEFINE_THISCALL_WRAPPER(numpunct_short_ctor_locinfo, 16)
3567 numpunct_wchar* __thiscall numpunct_short_ctor_locinfo(numpunct_wchar *this,
3568 const _Locinfo *locinfo, MSVCP_size_t refs, MSVCP_bool usedef)
3570 numpunct_wchar_ctor_locinfo(this, locinfo, refs, usedef);
3571 this->facet.vtable = &MSVCP_numpunct_short_vtable;
3572 return this;
3575 /* ??0?$numpunct@_W@std@@IAE@PBDI_N@Z */
3576 /* ??0?$numpunct@_W@std@@IEAA@PEBD_K_N@Z */
3577 DEFINE_THISCALL_WRAPPER(numpunct_wchar_ctor_name, 16)
3578 numpunct_wchar* __thiscall numpunct_wchar_ctor_name(numpunct_wchar *this,
3579 const char *name, MSVCP_size_t refs, MSVCP_bool usedef)
3581 _Locinfo locinfo;
3583 TRACE("(%p %s %lu %d)\n", this, debugstr_a(name), refs, usedef);
3584 locale_facet_ctor_refs(&this->facet, refs);
3585 this->facet.vtable = &MSVCP_numpunct_wchar_vtable;
3587 _Locinfo_ctor_cstr(&locinfo, name);
3588 numpunct_wchar__Init(this, &locinfo, usedef);
3589 _Locinfo_dtor(&locinfo);
3590 return this;
3593 /* ??0?$numpunct@G@std@@IAE@PBDI_N@Z */
3594 /* ??0?$numpunct@G@std@@IEAA@PEBD_K_N@Z */
3595 DEFINE_THISCALL_WRAPPER(numpunct_short_ctor_name, 16)
3596 numpunct_wchar* __thiscall numpunct_short_ctor_name(numpunct_wchar *this,
3597 const char *name, MSVCP_size_t refs, MSVCP_bool usedef)
3599 numpunct_wchar_ctor_name(this, name, refs, usedef);
3600 this->facet.vtable = &MSVCP_numpunct_short_vtable;
3601 return this;
3604 /* ??0?$numpunct@_W@std@@QAE@I@Z */
3605 /* ??0?$numpunct@_W@std@@QEAA@_K@Z */
3606 DEFINE_THISCALL_WRAPPER(numpunct_wchar_ctor_refs, 8)
3607 numpunct_wchar* __thiscall numpunct_wchar_ctor_refs(numpunct_wchar *this, MSVCP_size_t refs)
3609 TRACE("(%p %lu)\n", this, refs);
3610 return numpunct_wchar_ctor_name(this, "C", refs, FALSE);
3613 /* ??0?$numpunct@G@std@@QAE@I@Z */
3614 /* ??0?$numpunct@G@std@@QEAA@_K@Z */
3615 DEFINE_THISCALL_WRAPPER(numpunct_short_ctor_refs, 8)
3616 numpunct_wchar* __thiscall numpunct_short_ctor_refs(numpunct_wchar *this, MSVCP_size_t refs)
3618 numpunct_wchar_ctor_refs(this, refs);
3619 this->facet.vtable = &MSVCP_numpunct_short_vtable;
3620 return this;
3623 /* ??_F?$numpunct@G@std@@QAEXXZ */
3624 /* ??_F?$numpunct@G@std@@QEAAXXZ */
3625 DEFINE_THISCALL_WRAPPER(numpunct_short_ctor, 4)
3626 numpunct_wchar* __thiscall numpunct_short_ctor(numpunct_wchar *this)
3628 return numpunct_short_ctor_refs(this, 0);
3631 /* ??1?$numpunct@G@std@@UAE@XZ */
3632 /* ??1?$numpunct@G@std@@UEAA@XZ */
3633 /* ??1?$numpunct@_W@std@@MAE@XZ */
3634 /* ??1?$numpunct@_W@std@@MEAA@XZ */
3635 /* ??1?$numpunct@G@std@@MAE@XZ */
3636 /* ??1?$numpunct@G@std@@MEAA@XZ */
3637 DEFINE_THISCALL_WRAPPER(numpunct_wchar_dtor, 4)
3638 void __thiscall numpunct_wchar_dtor(numpunct_wchar *this)
3640 TRACE("(%p)\n", this);
3641 numpunct_wchar__Tidy(this);
3644 DEFINE_THISCALL_WRAPPER(numpunct_wchar_vector_dtor, 8)
3645 numpunct_wchar* __thiscall numpunct_wchar_vector_dtor(numpunct_wchar *this, unsigned int flags)
3647 TRACE("(%p %x)\n", this, flags);
3648 if(flags & 2) {
3649 /* we have an array, with the number of elements stored before the first object */
3650 INT_PTR i, *ptr = (INT_PTR *)this-1;
3652 for(i=*ptr-1; i>=0; i--)
3653 numpunct_wchar_dtor(this+i);
3654 MSVCRT_operator_delete(ptr);
3655 } else {
3656 numpunct_wchar_dtor(this);
3657 if(flags & 1)
3658 MSVCRT_operator_delete(this);
3661 return this;
3664 /* ?_Getcat@?$numpunct@_W@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
3665 /* ?_Getcat@?$numpunct@_W@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
3666 MSVCP_size_t __cdecl numpunct_wchar__Getcat(const locale_facet **facet, const locale *loc)
3668 TRACE("(%p %p)\n", facet, loc);
3670 if(facet && !*facet) {
3671 *facet = MSVCRT_operator_new(sizeof(numpunct_wchar));
3672 if(!*facet) {
3673 ERR("Out of memory\n");
3674 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
3675 return 0;
3677 numpunct_wchar_ctor_name((numpunct_wchar*)*facet,
3678 locale_string_char_c_str(&loc->ptr->name), 0, TRUE);
3681 return LC_NUMERIC;
3684 static numpunct_wchar* numpunct_wchar_use_facet(const locale *loc)
3686 static numpunct_wchar *obj = NULL;
3688 _Lockit lock;
3689 const locale_facet *fac;
3691 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
3692 fac = locale__Getfacet(loc, locale_id_operator_size_t(&numpunct_wchar_id), TRUE);
3693 if(fac) {
3694 _Lockit_dtor(&lock);
3695 return (numpunct_wchar*)fac;
3698 if(obj) {
3699 _Lockit_dtor(&lock);
3700 return obj;
3703 numpunct_wchar__Getcat(&fac, loc);
3704 obj = (numpunct_wchar*)fac;
3705 locale_facet__Incref(&obj->facet);
3706 locale_facet_register(&obj->facet);
3707 _Lockit_dtor(&lock);
3709 return obj;
3712 /* ?_Getcat@?$numpunct@G@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
3713 /* ?_Getcat@?$numpunct@G@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
3714 MSVCP_size_t __cdecl numpunct_short__Getcat(const locale_facet **facet, const locale *loc)
3716 TRACE("(%p %p)\n", facet, loc);
3718 if(facet && !*facet) {
3719 *facet = MSVCRT_operator_new(sizeof(numpunct_wchar));
3720 if(!*facet) {
3721 ERR("Out of memory\n");
3722 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
3723 return 0;
3725 numpunct_short_ctor_name((numpunct_wchar*)*facet,
3726 locale_string_char_c_str(&loc->ptr->name), 0, TRUE);
3729 return LC_NUMERIC;
3732 static numpunct_wchar* numpunct_short_use_facet(const locale *loc)
3734 static numpunct_wchar *obj = NULL;
3736 _Lockit lock;
3737 const locale_facet *fac;
3739 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
3740 fac = locale__Getfacet(loc, locale_id_operator_size_t(&numpunct_short_id), TRUE);
3741 if(fac) {
3742 _Lockit_dtor(&lock);
3743 return (numpunct_wchar*)fac;
3746 if(obj) {
3747 _Lockit_dtor(&lock);
3748 return obj;
3751 numpunct_short__Getcat(&fac, loc);
3752 obj = (numpunct_wchar*)fac;
3753 locale_facet__Incref(&obj->facet);
3754 locale_facet_register(&obj->facet);
3755 _Lockit_dtor(&lock);
3757 return obj;
3760 /* ?do_decimal_point@?$numpunct@_W@std@@MBE_WXZ */
3761 /* ?do_decimal_point@?$numpunct@_W@std@@MEBA_WXZ */
3762 /* ?do_decimal_point@?$numpunct@G@std@@MBEGXZ */
3763 /* ?do_decimal_point@?$numpunct@G@std@@MEBAGXZ */
3764 DEFINE_THISCALL_WRAPPER(numpunct_wchar_do_decimal_point, 4)
3765 #define call_numpunct_wchar_do_decimal_point(this) CALL_VTBL_FUNC(this, 4, \
3766 wchar_t, (const numpunct_wchar *this), (this))
3767 wchar_t __thiscall numpunct_wchar_do_decimal_point(const numpunct_wchar *this)
3769 TRACE("(%p)\n", this);
3770 return this->dp;
3773 /* ?decimal_point@?$numpunct@_W@std@@QBE_WXZ */
3774 /* ?decimal_point@?$numpunct@_W@std@@QEBA_WXZ */
3775 /* ?decimal_point@?$numpunct@G@std@@QBEGXZ */
3776 /* ?decimal_point@?$numpunct@G@std@@QEBAGXZ */
3777 DEFINE_THISCALL_WRAPPER(numpunct_wchar_decimal_point, 4)
3778 wchar_t __thiscall numpunct_wchar_decimal_point(const numpunct_wchar *this)
3780 TRACE("(%p)\n", this);
3781 return call_numpunct_wchar_do_decimal_point(this);
3784 /* ?do_thousands_sep@?$numpunct@_W@std@@MBE_WXZ */
3785 /* ?do_thousands_sep@?$numpunct@_W@std@@MEBA_WXZ */
3786 /* ?do_thousands_sep@?$numpunct@G@std@@MBEGXZ */
3787 /* ?do_thousands_sep@?$numpunct@G@std@@MEBAGXZ */
3788 DEFINE_THISCALL_WRAPPER(numpunct_wchar_do_thousands_sep, 4)
3789 #define call_numpunct_wchar_do_thousands_sep(this) CALL_VTBL_FUNC(this, 8, \
3790 wchar_t, (const numpunct_wchar *this), (this))
3791 wchar_t __thiscall numpunct_wchar_do_thousands_sep(const numpunct_wchar *this)
3793 TRACE("(%p)\n", this);
3794 return this->sep;
3797 /* ?thousands_sep@?$numpunct@_W@std@@QBE_WXZ */
3798 /* ?thousands_sep@?$numpunct@_W@std@@QEBA_WXZ */
3799 /* ?thousands_sep@?$numpunct@G@std@@QBEGXZ */
3800 /* ?thousands_sep@?$numpunct@G@std@@QEBAGXZ */
3801 DEFINE_THISCALL_WRAPPER(numpunct_wchar_thousands_sep, 4)
3802 wchar_t __thiscall numpunct_wchar_thousands_sep(const numpunct_wchar *this)
3804 TRACE("(%p)\n", this);
3805 return call_numpunct_wchar_do_thousands_sep(this);
3808 /* ?do_grouping@?$numpunct@_W@std@@MBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3809 /* ?do_grouping@?$numpunct@_W@std@@MEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3810 /* ?do_grouping@?$numpunct@G@std@@MBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3811 /* ?do_grouping@?$numpunct@G@std@@MEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3812 DEFINE_THISCALL_WRAPPER(numpunct_wchar_do_grouping, 8)
3813 #define call_numpunct_wchar_do_grouping(this, ret) CALL_VTBL_FUNC(this, 12, \
3814 basic_string_char*, (const numpunct_wchar*, basic_string_char*), (this, ret))
3815 basic_string_char* __thiscall numpunct_wchar_do_grouping(const numpunct_wchar *this, basic_string_char *ret)
3817 TRACE("(%p)\n", this);
3818 return MSVCP_basic_string_char_ctor_cstr(ret, this->grouping);
3821 /* ?grouping@?$numpunct@_W@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3822 /* ?grouping@?$numpunct@_W@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3823 /* ?grouping@?$numpunct@G@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3824 /* ?grouping@?$numpunct@G@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3825 DEFINE_THISCALL_WRAPPER(numpunct_wchar_grouping, 8)
3826 basic_string_char* __thiscall numpunct_wchar_grouping(const numpunct_wchar *this, basic_string_char *ret)
3828 TRACE("(%p)\n", this);
3829 return call_numpunct_wchar_do_grouping(this, ret);
3832 /* ?do_falsename@?$numpunct@_W@std@@MBE?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
3833 /* ?do_falsename@?$numpunct@_W@std@@MEBA?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
3834 /* ?do_falsename@?$numpunct@G@std@@MBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
3835 /* ?do_falsename@?$numpunct@G@std@@MEBA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
3836 DEFINE_THISCALL_WRAPPER(numpunct_wchar_do_falsename, 8)
3837 #define call_numpunct_wchar_do_falsename(this, ret) CALL_VTBL_FUNC(this, 16, \
3838 basic_string_wchar*, (const numpunct_wchar*, basic_string_wchar*), (this, ret))
3839 basic_string_wchar* __thiscall numpunct_wchar_do_falsename(const numpunct_wchar *this, basic_string_wchar *ret)
3841 TRACE("(%p)\n", this);
3842 return MSVCP_basic_string_wchar_ctor_cstr(ret, this->false_name);
3845 /* ?falsename@?$numpunct@_W@std@@QBE?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
3846 /* ?falsename@?$numpunct@_W@std@@QEBA?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
3847 /* ?falsename@?$numpunct@G@std@@QBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
3848 /* ?falsename@?$numpunct@G@std@@QEBA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
3849 DEFINE_THISCALL_WRAPPER(numpunct_wchar_falsename, 8)
3850 basic_string_wchar* __thiscall numpunct_wchar_falsename(const numpunct_wchar *this, basic_string_wchar *ret)
3852 TRACE("(%p)\n", this);
3853 return call_numpunct_wchar_do_falsename(this, ret);
3856 /* ?do_truename@?$numpunct@_W@std@@MBE?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
3857 /* ?do_truename@?$numpunct@_W@std@@MEBA?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
3858 /* ?do_truename@?$numpunct@G@std@@MBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
3859 /* ?do_truename@?$numpunct@G@std@@MEBA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
3860 DEFINE_THISCALL_WRAPPER(numpunct_wchar_do_truename, 8)
3861 #define call_numpunct_wchar_do_truename(this, ret) CALL_VTBL_FUNC(this, 20, \
3862 basic_string_wchar*, (const numpunct_wchar*, basic_string_wchar*), (this, ret))
3863 basic_string_wchar* __thiscall numpunct_wchar_do_truename(const numpunct_wchar *this, basic_string_wchar *ret)
3865 TRACE("(%p)\n", this);
3866 return MSVCP_basic_string_wchar_ctor_cstr(ret, this->true_name);
3869 /* ?truename@?$numpunct@_W@std@@QBE?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
3870 /* ?truename@?$numpunct@_W@std@@QEBA?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
3871 /* ?truename@?$numpunct@G@std@@QBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
3872 /* ?truename@?$numpunct@G@std@@QEBA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
3873 DEFINE_THISCALL_WRAPPER(numpunct_wchar_truename, 8)
3874 basic_string_wchar* __thiscall numpunct_wchar_truename(const numpunct_wchar *this, basic_string_wchar *ret)
3876 TRACE("(%p)\n", this);
3877 return call_numpunct_wchar_do_truename(this, ret);
3880 double __cdecl _Stod(const char *buf, char **buf_end, LONG exp)
3882 double ret = strtod(buf, buf_end);
3884 if(exp)
3885 ret *= pow(10, exp);
3886 return ret;
3889 double __cdecl _Stodx(const char *buf, char **buf_end, LONG exp, int *err)
3891 double ret;
3893 *err = *_errno();
3894 *_errno() = 0;
3895 ret = _Stod(buf, buf_end, exp);
3896 if(*_errno()) {
3897 *err = *_errno();
3898 }else {
3899 *_errno() = *err;
3900 *err = 0;
3902 return ret;
3905 float __cdecl _Stof(const char *buf, char **buf_end, LONG exp)
3907 return _Stod(buf, buf_end, exp);
3910 float __cdecl _Stofx(const char *buf, char **buf_end, LONG exp, int *err)
3912 return _Stodx(buf, buf_end, exp, err);
3915 __int64 __cdecl _Stoll(const char *buf, char **buf_end, int base)
3917 return _strtoi64(buf, buf_end, base);
3920 __int64 __cdecl _Stollx(const char *buf, char **buf_end, int base, int *err)
3922 __int64 ret;
3924 *err = *_errno();
3925 *_errno() = 0;
3926 ret = _strtoi64(buf, buf_end, base);
3927 if(*_errno()) {
3928 *err = *_errno();
3929 }else {
3930 *_errno() = *err;
3931 *err = 0;
3933 return ret;
3936 LONG __cdecl _Stolx(const char *buf, char **buf_end, int base, int *err)
3938 __int64 i = _Stollx(buf, buf_end, base, err);
3939 if(!*err && i!=(__int64)((LONG)i))
3940 *err = ERANGE;
3941 return i;
3944 unsigned __int64 __cdecl _Stoull(const char *buf, char **buf_end, int base)
3946 return _strtoui64(buf, buf_end, base);
3949 unsigned __int64 __cdecl _Stoullx(const char *buf, char **buf_end, int base, int *err)
3951 unsigned __int64 ret;
3953 *err = *_errno();
3954 *_errno() = 0;
3955 ret = _strtoui64(buf, buf_end, base);
3956 if(*_errno()) {
3957 *err = *_errno();
3958 }else {
3959 *_errno() = *err;
3960 *err = 0;
3962 return ret;
3965 ULONG __cdecl _Stoul(const char *buf, char **buf_end, int base)
3967 int err;
3968 unsigned __int64 i = _Stoullx(buf[0]=='-' ? buf+1 : buf, buf_end, base, &err);
3969 if(!err && i!=(unsigned __int64)((ULONG)i))
3970 *_errno() = ERANGE;
3971 return buf[0]=='-' ? -i : i;
3974 ULONG __cdecl _Stoulx(const char *buf, char **buf_end, int base, int *err)
3976 unsigned __int64 i = _Stoullx(buf[0]=='-' ? buf+1 : buf, buf_end, base, err);
3977 if(!*err && i!=(unsigned __int64)((ULONG)i))
3978 *err = ERANGE;
3979 return buf[0]=='-' ? -i : i;
3982 /* ?id@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@2V0locale@2@A */
3983 locale_id num_get_wchar_id = {0};
3984 /* ?id@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@2V0locale@2@A */
3985 locale_id num_get_short_id = {0};
3987 /* ??_7?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@6B@ */
3988 extern const vtable_ptr MSVCP_num_get_wchar_vtable;
3989 /* ??_7?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@6B@ */
3990 extern const vtable_ptr MSVCP_num_get_short_vtable;
3992 /* ?_Init@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@IAEXABV_Locinfo@2@@Z */
3993 /* ?_Init@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@IEAAXAEBV_Locinfo@2@@Z */
3994 /* ?_Init@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@IAEXABV_Locinfo@2@@Z */
3995 /* ?_Init@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@IEAAXAEBV_Locinfo@2@@Z */
3996 DEFINE_THISCALL_WRAPPER(num_get_wchar__Init, 8)
3997 void __thiscall num_get_wchar__Init(num_get *this, const _Locinfo *locinfo)
3999 TRACE("(%p %p)\n", this, locinfo);
4000 _Locinfo__Getcvt(locinfo, &this->cvt);
4003 /* ??0?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
4004 /* ??0?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
4005 DEFINE_THISCALL_WRAPPER(num_get_wchar_ctor_locinfo, 12)
4006 num_get* __thiscall num_get_wchar_ctor_locinfo(num_get *this,
4007 const _Locinfo *locinfo, MSVCP_size_t refs)
4009 TRACE("(%p %p %lu)\n", this, locinfo, refs);
4011 locale_facet_ctor_refs(&this->facet, refs);
4012 this->facet.vtable = &MSVCP_num_get_wchar_vtable;
4014 num_get_wchar__Init(this, locinfo);
4015 return this;
4018 /* ??0?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
4019 /* ??0?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
4020 DEFINE_THISCALL_WRAPPER(num_get_short_ctor_locinfo, 12)
4021 num_get* __thiscall num_get_short_ctor_locinfo(num_get *this,
4022 const _Locinfo *locinfo, MSVCP_size_t refs)
4024 num_get_wchar_ctor_locinfo(this, locinfo, refs);
4025 this->facet.vtable = &MSVCP_num_get_short_vtable;
4026 return this;
4029 /* ??0?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAE@I@Z */
4030 /* ??0?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAA@_K@Z */
4031 DEFINE_THISCALL_WRAPPER(num_get_wchar_ctor_refs, 8)
4032 num_get* __thiscall num_get_wchar_ctor_refs(num_get *this, MSVCP_size_t refs)
4034 _Locinfo locinfo;
4036 TRACE("(%p %lu)\n", this, refs);
4038 _Locinfo_ctor(&locinfo);
4039 num_get_wchar_ctor_locinfo(this, &locinfo, refs);
4040 _Locinfo_dtor(&locinfo);
4041 return this;
4044 /* ??0?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAE@I@Z */
4045 /* ??0?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEAA@_K@Z */
4046 DEFINE_THISCALL_WRAPPER(num_get_short_ctor_refs, 8)
4047 num_get* __thiscall num_get_short_ctor_refs(num_get *this, MSVCP_size_t refs)
4049 num_get_wchar_ctor_refs(this, refs);
4050 this->facet.vtable = &MSVCP_num_get_short_vtable;
4051 return this;
4054 /* ??_F?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAEXXZ */
4055 /* ??_F?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAAXXZ */
4056 DEFINE_THISCALL_WRAPPER(num_get_short_ctor, 4)
4057 num_get* __thiscall num_get_short_ctor(num_get *this)
4059 return num_get_short_ctor_refs(this, 0);
4062 /* ??1?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@UAE@XZ */
4063 /* ??1?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@UEAA@XZ */
4064 /* ??1?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MAE@XZ */
4065 /* ??1?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MEAA@XZ */
4066 /* ??1?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MAE@XZ */
4067 /* ??1?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MEAA@XZ */
4068 DEFINE_THISCALL_WRAPPER(num_get_wchar_dtor, 4)
4069 void __thiscall num_get_wchar_dtor(num_get *this)
4071 TRACE("(%p)\n", this);
4072 locale_facet_dtor(&this->facet);
4075 DEFINE_THISCALL_WRAPPER(num_get_wchar_vector_dtor, 8)
4076 num_get* __thiscall num_get_wchar_vector_dtor(num_get *this, unsigned int flags)
4078 TRACE("(%p %x)\n", this, flags);
4079 if(flags & 2) {
4080 /* we have an array, with the number of elements stored before the first object */
4081 INT_PTR i, *ptr = (INT_PTR *)this-1;
4083 for(i=*ptr-1; i>=0; i--)
4084 num_get_wchar_dtor(this+i);
4085 MSVCRT_operator_delete(ptr);
4086 } else {
4087 num_get_wchar_dtor(this);
4088 if(flags & 1)
4089 MSVCRT_operator_delete(this);
4092 return this;
4095 /* ?_Getcat@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
4096 /* ?_Getcat@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
4097 MSVCP_size_t __cdecl num_get_wchar__Getcat(const locale_facet **facet, const locale *loc)
4099 TRACE("(%p %p)\n", facet, loc);
4101 if(facet && !*facet) {
4102 _Locinfo locinfo;
4104 *facet = MSVCRT_operator_new(sizeof(num_get));
4105 if(!*facet) {
4106 ERR("Out of memory\n");
4107 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
4108 return 0;
4111 _Locinfo_ctor_cstr(&locinfo, locale_string_char_c_str(&loc->ptr->name));
4112 num_get_wchar_ctor_locinfo((num_get*)*facet, &locinfo, 0);
4113 _Locinfo_dtor(&locinfo);
4116 return LC_NUMERIC;
4119 static num_get* num_get_wchar_use_facet(const locale *loc)
4121 static num_get *obj = NULL;
4123 _Lockit lock;
4124 const locale_facet *fac;
4126 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
4127 fac = locale__Getfacet(loc, locale_id_operator_size_t(&num_get_wchar_id), TRUE);
4128 if(fac) {
4129 _Lockit_dtor(&lock);
4130 return (num_get*)fac;
4133 if(obj) {
4134 _Lockit_dtor(&lock);
4135 return obj;
4138 num_get_wchar__Getcat(&fac, loc);
4139 obj = (num_get*)fac;
4140 locale_facet__Incref(&obj->facet);
4141 locale_facet_register(&obj->facet);
4142 _Lockit_dtor(&lock);
4144 return obj;
4147 /* ?_Getcat@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
4148 /* ?_Getcat@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
4149 MSVCP_size_t __cdecl num_get_short__Getcat(const locale_facet **facet, const locale *loc)
4151 if(facet && !*facet) {
4152 num_get_wchar__Getcat(facet, loc);
4153 (*(locale_facet**)facet)->vtable = &MSVCP_num_get_short_vtable;
4156 return LC_NUMERIC;
4159 num_get* num_get_short_use_facet(const locale *loc)
4161 static num_get *obj = NULL;
4163 _Lockit lock;
4164 const locale_facet *fac;
4166 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
4167 fac = locale__Getfacet(loc, locale_id_operator_size_t(&num_get_short_id), TRUE);
4168 if(fac) {
4169 _Lockit_dtor(&lock);
4170 return (num_get*)fac;
4173 if(obj) {
4174 _Lockit_dtor(&lock);
4175 return obj;
4178 num_get_short__Getcat(&fac, loc);
4179 obj = (num_get*)fac;
4180 locale_facet__Incref(&obj->facet);
4181 locale_facet_register(&obj->facet);
4182 _Lockit_dtor(&lock);
4184 return obj;
4187 static int num_get__Getffld(const num_get *this, char *dest, istreambuf_iterator_wchar *first,
4188 istreambuf_iterator_wchar *last, const locale *loc, numpunct_wchar *numpunct)
4190 int i, exp = 0;
4191 char *dest_beg = dest, *num_end = dest+25, *exp_end = dest+31;
4192 wchar_t digits[11], *digits_pos;
4193 BOOL error = FALSE, got_digit = FALSE, got_nonzero = FALSE;
4195 TRACE("(%p %p %p %p)\n", dest, first, last, loc);
4197 for(i=0; i<10; i++)
4198 digits[i] = mb_to_wc('0'+i, &this->cvt);
4199 digits[10] = 0;
4201 istreambuf_iterator_wchar_val(first);
4202 /* get sign */
4203 if(first->strbuf && first->val==mb_to_wc('-', &this->cvt)) {
4204 *dest++ = '-';
4205 istreambuf_iterator_wchar_inc(first);
4206 }else if(first->strbuf && first->val==mb_to_wc('+', &this->cvt)) {
4207 *dest++ = '+';
4208 istreambuf_iterator_wchar_inc(first);
4211 /* read numbers before decimal */
4212 for(; first->strbuf; istreambuf_iterator_wchar_inc(first)) {
4213 if(!(digits_pos = wcschr(digits, first->val))) {
4214 break;
4215 }else {
4216 got_digit = TRUE; /* found a digit, zero or non-zero */
4217 /* write digit to dest if not a leading zero (to not waste dest buffer) */
4218 if(!got_nonzero && first->val == digits[0])
4219 continue;
4220 got_nonzero = TRUE;
4221 if(dest < num_end)
4222 *dest++ = '0'+digits_pos-digits;
4223 else
4224 exp++; /* too many digits, just multiply by 10 */
4227 /* if all leading zeroes, we didn't write anything so put a zero we check for a decimal */
4228 if(got_digit && !got_nonzero)
4229 *dest++ = '0';
4231 /* get decimal, if any */
4232 if(first->strbuf && first->val==numpunct_wchar_decimal_point(numpunct)) {
4233 if(dest < num_end)
4234 *dest++ = *localeconv()->decimal_point;
4235 istreambuf_iterator_wchar_inc(first);
4238 /* read non-grouped after decimal */
4239 for(; first->strbuf; istreambuf_iterator_wchar_inc(first)) {
4240 if(!(digits_pos = wcschr(digits, first->val)))
4241 break;
4242 else if(dest<num_end) {
4243 got_digit = TRUE;
4244 *dest++ = '0'+digits_pos-digits;
4248 /* read exponent, if any */
4249 if(first->strbuf && (first->val==mb_to_wc('e', &this->cvt) || first->val==mb_to_wc('E', &this->cvt))) {
4250 *dest++ = 'e';
4251 istreambuf_iterator_wchar_inc(first);
4253 if(first->strbuf && first->val==mb_to_wc('-', &this->cvt)) {
4254 *dest++ = '-';
4255 istreambuf_iterator_wchar_inc(first);
4256 }else if(first->strbuf && first->val==mb_to_wc('+', &this->cvt)) {
4257 *dest++ = '+';
4258 istreambuf_iterator_wchar_inc(first);
4261 got_digit = got_nonzero = FALSE;
4262 error = TRUE;
4263 /* skip any leading zeroes */
4264 for(; first->strbuf && first->val==digits[0]; istreambuf_iterator_wchar_inc(first))
4265 error = FALSE;
4267 for(; first->strbuf && (digits_pos = wcschr(digits, first->val)); istreambuf_iterator_wchar_inc(first)) {
4268 got_digit = got_nonzero = TRUE; /* leading zeroes would have been skipped, so first digit is non-zero */
4269 error = FALSE;
4270 if(dest<exp_end)
4271 *dest++ = '0'+digits_pos-digits;
4274 /* if just found zeroes for exponent, use that */
4275 if(got_digit && !got_nonzero)
4277 error = FALSE;
4278 if(dest<exp_end)
4279 *dest++ = '0';
4283 if(error) {
4284 *dest_beg = '\0';
4285 return 0;
4287 *dest++ = '\0';
4288 return exp;
4291 static int num_get__Getifld(const num_get *this, char *dest, istreambuf_iterator_wchar *first,
4292 istreambuf_iterator_wchar *last, int fmtflags, const locale *loc, numpunct_wchar *numpunct)
4294 wchar_t digits[23], *digits_pos;
4295 int i, basefield, base;
4296 char *dest_beg = dest, *dest_end = dest+24;
4297 BOOL error = TRUE, dest_empty = TRUE, found_zero = FALSE;
4299 TRACE("(%p %p %p %04x %p)\n", dest, first, last, fmtflags, loc);
4301 for(i=0; i<10; i++)
4302 digits[i] = mb_to_wc('0'+i, &this->cvt);
4303 for(i=0; i<6; i++) {
4304 digits[10+i] = mb_to_wc('a'+i, &this->cvt);
4305 digits[16+i] = mb_to_wc('A'+i, &this->cvt);
4308 basefield = fmtflags & FMTFLAG_basefield;
4309 if(basefield == FMTFLAG_oct)
4310 base = 8;
4311 else if(basefield == FMTFLAG_hex)
4312 base = 22; /* equal to the size of digits buffer */
4313 else if(!basefield)
4314 base = 0;
4315 else
4316 base = 10;
4318 istreambuf_iterator_wchar_val(first);
4319 if(first->strbuf && first->val==mb_to_wc('-', &this->cvt)) {
4320 *dest++ = '-';
4321 istreambuf_iterator_wchar_inc(first);
4322 }else if(first->strbuf && first->val==mb_to_wc('+', &this->cvt)) {
4323 *dest++ = '+';
4324 istreambuf_iterator_wchar_inc(first);
4327 if(first->strbuf && first->val==digits[0]) {
4328 found_zero = TRUE;
4329 istreambuf_iterator_wchar_inc(first);
4330 if(first->strbuf && (first->val==mb_to_wc('x', &this->cvt) || first->val==mb_to_wc('X', &this->cvt))) {
4331 if(!base || base == 22) {
4332 found_zero = FALSE;
4333 istreambuf_iterator_wchar_inc(first);
4334 base = 22;
4335 }else {
4336 base = 10;
4338 }else {
4339 error = FALSE;
4340 if(!base) base = 8;
4342 }else {
4343 if(!base) base = 10;
4345 digits[base] = 0;
4347 for(; first->strbuf; istreambuf_iterator_wchar_inc(first)) {
4348 if(!(digits_pos = wcschr(digits, first->val))) {
4349 break;
4350 }else {
4351 error = FALSE;
4352 if(dest_empty && first->val == digits[0]) {
4353 found_zero = TRUE;
4354 continue;
4356 dest_empty = FALSE;
4357 /* skip digits that can't be copied to dest buffer, other
4358 * functions are responsible for detecting overflows */
4359 if(dest < dest_end)
4360 *dest++ = (digits_pos-digits<10 ? '0'+digits_pos-digits :
4361 (digits_pos-digits<16 ? 'a'+digits_pos-digits-10 :
4362 'A'+digits_pos-digits-16));
4366 if(error) {
4367 if (found_zero)
4368 *dest++ = '0';
4369 else
4370 dest = dest_beg;
4371 }else if(dest_empty)
4372 *dest++ = '0';
4373 *dest = '\0';
4375 return (base==22 ? 16 : base);
4378 /* ?_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 */
4379 /* ?_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 */
4380 int __cdecl num_get_wchar__Getifld(const num_get *this, char *dest, istreambuf_iterator_wchar *first,
4381 istreambuf_iterator_wchar *last, int fmtflags, const locale *loc)
4383 return num_get__Getifld(this, dest, first, last,
4384 fmtflags, loc, numpunct_wchar_use_facet(loc));
4387 static istreambuf_iterator_wchar* num_get_do_get_void(const num_get *this,
4388 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar first,
4389 istreambuf_iterator_wchar last, ios_base *base, int *state,
4390 void **pval, numpunct_wchar *numpunct)
4392 unsigned __int64 v;
4393 char tmp[25], *end;
4394 int err;
4396 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
4398 v = _Stoullx(tmp, &end, num_get__Getifld(this, tmp, &first,
4399 &last, FMTFLAG_hex, &base->loc, numpunct), &err);
4400 if(v!=(unsigned __int64)((INT_PTR)v))
4401 *state |= IOSTATE_failbit;
4402 else if(end!=tmp && !err)
4403 *pval = (void*)((INT_PTR)v);
4404 else
4405 *state |= IOSTATE_failbit;
4407 if(!first.strbuf)
4408 *state |= IOSTATE_eofbit;
4410 *ret = first;
4411 return ret;
4414 /* ?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 */
4415 /* ?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 */
4416 #define call_num_get_wchar_do_get_void(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 4, istreambuf_iterator_wchar*, \
4417 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, void**), \
4418 (this, ret, first, last, base, state, pval))
4419 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_void,36)
4420 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_void(const num_get *this, istreambuf_iterator_wchar *ret,
4421 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, void **pval)
4423 return num_get_do_get_void(this, ret, first, last, base,
4424 state, pval, numpunct_wchar_use_facet(&base->loc));
4427 /* ?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 */
4428 /* ?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 */
4429 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_void,36)
4430 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_void(const num_get *this, istreambuf_iterator_wchar *ret,
4431 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, void **pval)
4433 return num_get_do_get_void(this, ret, first, last, base,
4434 state, pval, numpunct_short_use_facet(&base->loc));
4437 /* ?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 */
4438 /* ?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 */
4439 /* ?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 */
4440 /* ?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 */
4441 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_void,36)
4442 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_void(const num_get *this, istreambuf_iterator_wchar *ret,
4443 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, void **pval)
4445 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
4446 return call_num_get_wchar_do_get_void(this, ret, first, last, base, state, pval);
4449 static istreambuf_iterator_wchar* num_get_do_get_double(const num_get *this,
4450 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar first,
4451 istreambuf_iterator_wchar last, ios_base *base, int *state,
4452 double *pval, numpunct_wchar *numpunct)
4454 double v;
4455 char tmp[32], *end;
4456 int err;
4458 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
4460 v = _Stodx(tmp, &end, num_get__Getffld(this, tmp, &first, &last, &base->loc, numpunct), &err);
4461 if(end!=tmp && !err)
4462 *pval = v;
4463 else
4464 *state |= IOSTATE_failbit;
4466 if(!first.strbuf)
4467 *state |= IOSTATE_eofbit;
4469 *ret = first;
4470 return ret;
4473 /* ?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 */
4474 /* ?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 */
4475 /* ?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 */
4476 /* ?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 */
4477 #define call_num_get_wchar_do_get_ldouble(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 8, istreambuf_iterator_wchar*, \
4478 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, double*), \
4479 (this, ret, first, last, base, state, pval))
4480 #define call_num_get_wchar_do_get_double(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 12, istreambuf_iterator_wchar*, \
4481 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, double*), \
4482 (this, ret, first, last, base, state, pval))
4483 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_double,36)
4484 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_double(const num_get *this, istreambuf_iterator_wchar *ret,
4485 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, double *pval)
4487 return num_get_do_get_double(this, ret, first, last, base,
4488 state, pval, numpunct_wchar_use_facet(&base->loc));
4491 /* ?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 */
4492 /* ?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 */
4493 /* ?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 */
4494 /* ?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 */
4495 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_double,36)
4496 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_double(const num_get *this, istreambuf_iterator_wchar *ret,
4497 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, double *pval)
4499 return num_get_do_get_double(this, ret, first, last, base,
4500 state, pval, numpunct_short_use_facet(&base->loc));
4503 /* ?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 */
4504 /* ?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 */
4505 /* ?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 */
4506 /* ?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 */
4507 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_ldouble,36)
4508 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_ldouble(const num_get *this, istreambuf_iterator_wchar *ret,
4509 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, double *pval)
4511 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
4512 return call_num_get_wchar_do_get_ldouble(this, ret, first, last, base, state, pval);
4515 /* ?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 */
4516 /* ?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 */
4517 /* ?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 */
4518 /* ?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 */
4519 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_double,36)
4520 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_double(const num_get *this, istreambuf_iterator_wchar *ret,
4521 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, double *pval)
4523 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
4524 return call_num_get_wchar_do_get_double(this, ret, first, last, base, state, pval);
4527 static istreambuf_iterator_wchar* num_get_do_get_float(const num_get *this,
4528 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar first,
4529 istreambuf_iterator_wchar last, ios_base *base, int *state,
4530 float *pval, numpunct_wchar *numpunct)
4532 float v;
4533 char tmp[32], *end;
4534 int err;
4536 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
4538 v = _Stofx(tmp, &end, num_get__Getffld(this, tmp, &first,
4539 &last, &base->loc, numpunct), &err);
4540 if(end!=tmp && !err)
4541 *pval = v;
4542 else
4543 *state |= IOSTATE_failbit;
4545 if(!first.strbuf)
4546 *state |= IOSTATE_eofbit;
4548 *ret = first;
4549 return ret;
4552 /* ?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 */
4553 /* ?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 */
4554 #define call_num_get_wchar_do_get_float(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 16, istreambuf_iterator_wchar*, \
4555 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, float*), \
4556 (this, ret, first, last, base, state, pval))
4557 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_float,36)
4558 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_float(const num_get *this, istreambuf_iterator_wchar *ret,
4559 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, float *pval)
4561 return num_get_do_get_float(this, ret, first, last, base,
4562 state, pval, numpunct_wchar_use_facet(&base->loc));
4565 /* ?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 */
4566 /* ?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 */
4567 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_float,36)
4568 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_float(const num_get *this, istreambuf_iterator_wchar *ret,
4569 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, float *pval)
4571 return num_get_do_get_float(this, ret, first, last, base,
4572 state, pval, numpunct_short_use_facet(&base->loc));
4575 /* ?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 */
4576 /* ?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 */
4577 /* ?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 */
4578 /* ?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 */
4579 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_float,36)
4580 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_float(const num_get *this, istreambuf_iterator_wchar *ret,
4581 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, float *pval)
4583 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
4584 return call_num_get_wchar_do_get_float(this, ret, first, last, base, state, pval);
4587 static istreambuf_iterator_wchar* num_get_do_get_uint64(const num_get *this,
4588 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar first,
4589 istreambuf_iterator_wchar last, ios_base *base, int *state,
4590 ULONGLONG *pval, numpunct_wchar *numpunct)
4592 unsigned __int64 v;
4593 char tmp[25], *end;
4594 int err;
4596 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
4598 v = _Stoullx(tmp, &end, num_get__Getifld(this, tmp, &first,
4599 &last, base->fmtfl, &base->loc, numpunct), &err);
4600 if(end!=tmp && !err)
4601 *pval = v;
4602 else
4603 *state |= IOSTATE_failbit;
4605 if(!first.strbuf)
4606 *state |= IOSTATE_eofbit;
4608 *ret = first;
4609 return ret;
4612 /* ?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 */
4613 /* ?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 */
4614 #define call_num_get_wchar_do_get_uint64(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 20, istreambuf_iterator_wchar*, \
4615 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, ULONGLONG*), \
4616 (this, ret, first, last, base, state, pval))
4617 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_uint64,36)
4618 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_uint64(const num_get *this, istreambuf_iterator_wchar *ret,
4619 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, ULONGLONG *pval)
4621 return num_get_do_get_uint64(this, ret, first, last, base,
4622 state, pval, numpunct_wchar_use_facet(&base->loc));
4625 /* ?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 */
4626 /* ?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 */
4627 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_uint64,36)
4628 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_uint64(const num_get *this, istreambuf_iterator_wchar *ret,
4629 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, ULONGLONG *pval)
4631 return num_get_do_get_uint64(this, ret, first, last, base,
4632 state, pval, numpunct_short_use_facet(&base->loc));
4635 /* ?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 */
4636 /* ?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 */
4637 /* ?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 */
4638 /* ?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 */
4639 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_uint64,36)
4640 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_uint64(const num_get *this, istreambuf_iterator_wchar *ret,
4641 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, ULONGLONG *pval)
4643 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
4644 return call_num_get_wchar_do_get_uint64(this, ret, first, last, base, state, pval);
4647 static istreambuf_iterator_wchar* num_get_do_get_int64(const num_get *this,
4648 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar first,
4649 istreambuf_iterator_wchar last, ios_base *base, int *state,
4650 LONGLONG *pval, numpunct_wchar *numpunct)
4652 __int64 v;
4653 char tmp[25], *end;
4654 int err;
4656 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
4658 v = _Stollx(tmp, &end, num_get__Getifld(this, tmp, &first,
4659 &last, base->fmtfl, &base->loc, numpunct), &err);
4660 if(end!=tmp && !err)
4661 *pval = v;
4662 else
4663 *state |= IOSTATE_failbit;
4665 if(!first.strbuf)
4666 *state |= IOSTATE_eofbit;
4668 *ret = first;
4669 return ret;
4672 /* ?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 */
4673 /* ?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 */
4674 #define call_num_get_wchar_do_get_int64(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 24, istreambuf_iterator_wchar*, \
4675 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, LONGLONG*), \
4676 (this, ret, first, last, base, state, pval))
4677 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_int64,36)
4678 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_int64(const num_get *this, istreambuf_iterator_wchar *ret,
4679 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, LONGLONG *pval)
4681 return num_get_do_get_int64(this, ret, first, last, base,
4682 state, pval, numpunct_wchar_use_facet(&base->loc));
4685 /* ?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 */
4686 /* ?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 */
4687 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_int64,36)
4688 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_int64(const num_get *this, istreambuf_iterator_wchar *ret,
4689 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, LONGLONG *pval)
4691 return num_get_do_get_int64(this, ret, first, last, base,
4692 state, pval, numpunct_short_use_facet(&base->loc));
4695 /* ?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 */
4696 /* ?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 */
4697 /* ?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 */
4698 /* ?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 */
4699 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_int64,36)
4700 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_int64(const num_get *this, istreambuf_iterator_wchar *ret,
4701 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, LONGLONG *pval)
4703 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
4704 return call_num_get_wchar_do_get_int64(this, ret, first, last, base, state, pval);
4707 static istreambuf_iterator_wchar* num_get_do_get_ulong(const num_get *this,
4708 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar first,
4709 istreambuf_iterator_wchar last, ios_base *base, int *state,
4710 ULONG *pval, numpunct_wchar *numpunct)
4712 ULONG v;
4713 char tmp[25], *end;
4714 int err;
4716 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
4718 v = _Stoulx(tmp, &end, num_get__Getifld(this, tmp, &first,
4719 &last, base->fmtfl, &base->loc, numpunct), &err);
4720 if(end!=tmp && !err)
4721 *pval = v;
4722 else
4723 *state |= IOSTATE_failbit;
4725 if(!first.strbuf)
4726 *state |= IOSTATE_eofbit;
4728 *ret = first;
4729 return ret;
4732 /* ?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 */
4733 /* ?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 */
4734 #define call_num_get_wchar_do_get_ulong(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 28, istreambuf_iterator_wchar*, \
4735 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, ULONG*), \
4736 (this, ret, first, last, base, state, pval))
4737 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_ulong,36)
4738 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_ulong(const num_get *this, istreambuf_iterator_wchar *ret,
4739 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, ULONG *pval)
4741 return num_get_do_get_ulong(this, ret, first, last, base,
4742 state, pval, numpunct_wchar_use_facet(&base->loc));
4745 /* ?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 */
4746 /* ?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 */
4747 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_ulong,36)
4748 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_ulong(const num_get *this, istreambuf_iterator_wchar *ret,
4749 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, ULONG *pval)
4751 return num_get_do_get_ulong(this, ret, first, last, base,
4752 state, pval, numpunct_short_use_facet(&base->loc));
4755 /* ?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 */
4756 /* ?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 */
4757 /* ?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 */
4758 /* ?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 */
4759 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_ulong,36)
4760 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_ulong(const num_get *this, istreambuf_iterator_wchar *ret,
4761 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, ULONG *pval)
4763 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
4764 return call_num_get_wchar_do_get_ulong(this, ret, first, last, base, state, pval);
4767 static istreambuf_iterator_wchar* num_get_do_get_long(const num_get *this,
4768 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar first,
4769 istreambuf_iterator_wchar last, ios_base *base, int *state,
4770 LONG *pval, numpunct_wchar *numpunct)
4772 LONG v;
4773 char tmp[25], *end;
4774 int err;
4776 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
4778 v = _Stolx(tmp, &end, num_get__Getifld(this, tmp, &first,
4779 &last, base->fmtfl, &base->loc, numpunct), &err);
4780 if(end!=tmp && !err)
4781 *pval = v;
4782 else
4783 *state |= IOSTATE_failbit;
4785 if(!first.strbuf)
4786 *state |= IOSTATE_eofbit;
4788 *ret = first;
4789 return ret;
4792 /* ?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 */
4793 /* ?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 */
4794 #define call_num_get_wchar_do_get_long(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 32, istreambuf_iterator_wchar*, \
4795 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, LONG*), \
4796 (this, ret, first, last, base, state, pval))
4797 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_long,36)
4798 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_long(const num_get *this, istreambuf_iterator_wchar *ret,
4799 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, LONG *pval)
4801 return num_get_do_get_long(this, ret, first, last, base,
4802 state, pval, numpunct_wchar_use_facet(&base->loc));
4805 /* ?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 */
4806 /* ?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 */
4807 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_long,36)
4808 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_long(const num_get *this, istreambuf_iterator_wchar *ret,
4809 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, LONG *pval)
4811 return num_get_do_get_long(this, ret, first, last, base,
4812 state, pval, numpunct_short_use_facet(&base->loc));
4815 /* ?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 */
4816 /* ?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 */
4817 /* ?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 */
4818 /* ?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 */
4819 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_long,36)
4820 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_long(const num_get *this, istreambuf_iterator_wchar *ret,
4821 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, LONG *pval)
4823 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
4824 return call_num_get_wchar_do_get_long(this, ret, first, last, base, state, pval);
4827 /* ?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 */
4828 /* ?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 */
4829 #define call_num_get_wchar_do_get_uint(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 36, istreambuf_iterator_wchar*, \
4830 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, unsigned int*), \
4831 (this, ret, first, last, base, state, pval))
4832 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_uint,36)
4833 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_uint(const num_get *this, istreambuf_iterator_wchar *ret,
4834 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, unsigned int *pval)
4836 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
4837 return num_get_wchar_do_get_ulong(this, ret, first, last, base, state, pval);
4840 /* ?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 */
4841 /* ?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 */
4842 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_uint,36)
4843 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_uint(const num_get *this, istreambuf_iterator_wchar *ret,
4844 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, unsigned int *pval)
4846 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
4847 return num_get_short_do_get_ulong(this, ret, first, last, base, state, pval);
4850 /* ?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 */
4851 /* ?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 */
4852 /* ?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 */
4853 /* ?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 */
4854 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_uint,36)
4855 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_uint(const num_get *this, istreambuf_iterator_wchar *ret,
4856 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, unsigned int *pval)
4858 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
4859 return call_num_get_wchar_do_get_uint(this, ret, first, last, base, state, pval);
4862 /* ?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 */
4863 /* ?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 */
4864 #define call_num_get_wchar_do_get_ushort(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 40, istreambuf_iterator_wchar*, \
4865 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, unsigned short*), \
4866 (this, ret, first, last, base, state, pval))
4867 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_ushort,36)
4868 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_ushort(const num_get *this, istreambuf_iterator_wchar *ret,
4869 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, unsigned short *pval)
4871 ULONG v;
4872 char tmp[25], *beg, *end;
4873 int err, b;
4875 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
4877 b = num_get_wchar__Getifld(this, tmp,
4878 &first, &last, base->fmtfl, &base->loc);
4879 beg = tmp + (tmp[0]=='-' ? 1 : 0);
4880 v = _Stoulx(beg, &end, b, &err);
4882 if(v != (ULONG)((unsigned short)v))
4883 *state |= IOSTATE_failbit;
4884 else if(end!=beg && !err)
4885 *pval = (tmp[0]=='-' ? -((unsigned short)v) : v);
4886 else
4887 *state |= IOSTATE_failbit;
4889 if(!first.strbuf)
4890 *state |= IOSTATE_eofbit;
4892 *ret = first;
4893 return ret;
4896 /* ?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 */
4897 /* ?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 */
4898 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_ushort,36)
4899 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_ushort(const num_get *this, istreambuf_iterator_wchar *ret,
4900 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, unsigned short *pval)
4902 FIXME("(%p %p %p %p %p) stub\n", this, ret, base, state, pval);
4903 return ret;
4906 /* ?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 */
4907 /* ?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 */
4908 /* ?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@ */
4909 /* ?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 */
4910 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_ushort,36)
4911 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_ushort(const num_get *this, istreambuf_iterator_wchar *ret,
4912 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, unsigned short *pval)
4914 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
4915 return call_num_get_wchar_do_get_ushort(this, ret, first, last, base, state, pval);
4918 static istreambuf_iterator_wchar* num_get_do_get_bool(const num_get *this,
4919 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar first,
4920 istreambuf_iterator_wchar last, ios_base *base, int *state,
4921 MSVCP_bool *pval, numpunct_wchar *numpunct)
4923 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
4925 if(base->fmtfl & FMTFLAG_boolalpha) {
4926 basic_string_wchar false_bstr, true_bstr;
4927 const wchar_t *pfalse, *ptrue;
4929 numpunct_wchar_falsename(numpunct, &false_bstr);
4930 numpunct_wchar_truename(numpunct, &true_bstr);
4931 pfalse = MSVCP_basic_string_wchar_c_str(&false_bstr);
4932 ptrue = MSVCP_basic_string_wchar_c_str(&true_bstr);
4934 for(istreambuf_iterator_wchar_val(&first); first.strbuf;) {
4935 if(pfalse && *pfalse && first.val!=*pfalse)
4936 pfalse = NULL;
4937 if(ptrue && *ptrue && first.val!=*ptrue)
4938 ptrue = NULL;
4940 if(pfalse && *pfalse && ptrue && !*ptrue)
4941 ptrue = NULL;
4942 if(ptrue && *ptrue && pfalse && !*pfalse)
4943 pfalse = NULL;
4945 if(pfalse)
4946 pfalse++;
4947 if(ptrue)
4948 ptrue++;
4950 if(pfalse || ptrue)
4951 istreambuf_iterator_wchar_inc(&first);
4953 if((!pfalse || !*pfalse) && (!ptrue || !*ptrue))
4954 break;
4957 if(ptrue)
4958 *pval = TRUE;
4959 else if(pfalse)
4960 *pval = FALSE;
4961 else
4962 *state |= IOSTATE_failbit;
4964 MSVCP_basic_string_wchar_dtor(&false_bstr);
4965 MSVCP_basic_string_wchar_dtor(&true_bstr);
4966 }else {
4967 char tmp[25], *end;
4968 int err;
4969 LONG v = _Stolx(tmp, &end, num_get__Getifld(this, tmp, &first,
4970 &last, base->fmtfl, &base->loc, numpunct), &err);
4972 if(end!=tmp && err==0 && (v==0 || v==1))
4973 *pval = v;
4974 else
4975 *state |= IOSTATE_failbit;
4978 if(!first.strbuf)
4979 *state |= IOSTATE_eofbit;
4980 memcpy(ret, &first, sizeof(first));
4981 return ret;
4984 /* ?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 */
4985 /* ?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 */
4986 #define call_num_get_wchar_do_get_bool(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 44, istreambuf_iterator_wchar*, \
4987 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, MSVCP_bool*), \
4988 (this, ret, first, last, base, state, pval))
4989 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_bool,36)
4990 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_bool(const num_get *this, istreambuf_iterator_wchar *ret,
4991 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, MSVCP_bool *pval)
4993 return num_get_do_get_bool(this, ret, first, last, base,
4994 state, pval, numpunct_wchar_use_facet(&base->loc));
4997 /* ?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 */
4998 /* ?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 */
4999 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_bool,36)
5000 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_bool(const num_get *this, istreambuf_iterator_wchar *ret,
5001 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, MSVCP_bool *pval)
5003 return num_get_do_get_bool(this, ret, first, last, base,
5004 state, pval, numpunct_short_use_facet(&base->loc));
5007 /* ?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 */
5008 /* ?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 */
5009 /* ?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 */
5010 /* ?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 */
5011 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_bool,36)
5012 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_bool(const num_get *this, istreambuf_iterator_wchar *ret,
5013 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, MSVCP_bool *pval)
5015 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5016 return call_num_get_wchar_do_get_bool(this, ret, first, last, base, state, pval);
5019 /* ?id@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@2V0locale@2@A */
5020 locale_id num_get_char_id = {0};
5022 /* ??_7?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@6B@ */
5023 extern const vtable_ptr MSVCP_num_get_char_vtable;
5025 /* ?_Init@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@IAEXABV_Locinfo@2@@Z */
5026 /* ?_Init@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@IEAAXAEBV_Locinfo@2@@Z */
5027 DEFINE_THISCALL_WRAPPER(num_get_char__Init, 8)
5028 void __thiscall num_get_char__Init(num_get *this, const _Locinfo *locinfo)
5030 TRACE("(%p %p)\n", this, locinfo);
5031 _Locinfo__Getcvt(locinfo, &this->cvt);
5034 /* ??0?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
5035 /* ??0?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
5036 DEFINE_THISCALL_WRAPPER(num_get_char_ctor_locinfo, 12)
5037 num_get* __thiscall num_get_char_ctor_locinfo(num_get *this,
5038 const _Locinfo *locinfo, MSVCP_size_t refs)
5040 TRACE("(%p %p %lu)\n", this, locinfo, refs);
5042 locale_facet_ctor_refs(&this->facet, refs);
5043 this->facet.vtable = &MSVCP_num_get_char_vtable;
5045 num_get_char__Init(this, locinfo);
5046 return this;
5049 /* ??0?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAE@I@Z */
5050 /* ??0?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAA@_K@Z */
5051 DEFINE_THISCALL_WRAPPER(num_get_char_ctor_refs, 8)
5052 num_get* __thiscall num_get_char_ctor_refs(num_get *this, MSVCP_size_t refs)
5054 _Locinfo locinfo;
5056 TRACE("(%p %lu)\n", this, refs);
5058 _Locinfo_ctor(&locinfo);
5059 num_get_char_ctor_locinfo(this, &locinfo, refs);
5060 _Locinfo_dtor(&locinfo);
5061 return this;
5064 /* ??_F?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAEXXZ */
5065 /* ??_F?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAAXXZ */
5066 DEFINE_THISCALL_WRAPPER(num_get_char_ctor, 4)
5067 num_get* __thiscall num_get_char_ctor(num_get *this)
5069 return num_get_char_ctor_refs(this, 0);
5072 /* ??1?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@UAE@XZ */
5073 /* ??1?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@UEAA@XZ */
5074 /* ??1?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MAE@XZ */
5075 /* ??1?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MEAA@XZ */
5076 DEFINE_THISCALL_WRAPPER(num_get_char_dtor, 4)
5077 void __thiscall num_get_char_dtor(num_get *this)
5079 TRACE("(%p)\n", this);
5080 locale_facet_dtor(&this->facet);
5083 DEFINE_THISCALL_WRAPPER(num_get_char_vector_dtor, 8)
5084 num_get* __thiscall num_get_char_vector_dtor(num_get *this, unsigned int flags)
5086 TRACE("(%p %x)\n", this, flags);
5087 if(flags & 2) {
5088 /* we have an array, with the number of elements stored before the first object */
5089 INT_PTR i, *ptr = (INT_PTR *)this-1;
5091 for(i=*ptr-1; i>=0; i--)
5092 num_get_char_dtor(this+i);
5093 MSVCRT_operator_delete(ptr);
5094 } else {
5095 num_get_char_dtor(this);
5096 if(flags & 1)
5097 MSVCRT_operator_delete(this);
5100 return this;
5103 /* ?_Getcat@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
5104 /* ?_Getcat@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
5105 MSVCP_size_t __cdecl num_get_char__Getcat(const locale_facet **facet, const locale *loc)
5107 TRACE("(%p %p)\n", facet, loc);
5109 if(facet && !*facet) {
5110 _Locinfo locinfo;
5112 *facet = MSVCRT_operator_new(sizeof(num_get));
5113 if(!*facet) {
5114 ERR("Out of memory\n");
5115 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
5116 return 0;
5119 _Locinfo_ctor_cstr(&locinfo, MSVCP_basic_string_char_c_str(&loc->ptr->name));
5120 num_get_char_ctor_locinfo((num_get*)*facet, &locinfo, 0);
5121 _Locinfo_dtor(&locinfo);
5124 return LC_NUMERIC;
5127 num_get* num_get_char_use_facet(const locale *loc)
5129 static num_get *obj = NULL;
5131 _Lockit lock;
5132 const locale_facet *fac;
5134 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
5135 fac = locale__Getfacet(loc, locale_id_operator_size_t(&num_get_char_id), TRUE);
5136 if(fac) {
5137 _Lockit_dtor(&lock);
5138 return (num_get*)fac;
5141 if(obj) {
5142 _Lockit_dtor(&lock);
5143 return obj;
5146 num_get_char__Getcat(&fac, loc);
5147 obj = (num_get*)fac;
5148 locale_facet__Incref(&obj->facet);
5149 locale_facet_register(&obj->facet);
5150 _Lockit_dtor(&lock);
5152 return obj;
5155 /* ?_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 */
5156 /* ?_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 */
5157 /* Copies number to dest buffer, validates grouping and skips separators.
5158 * Updates first so it points past the number, all digits are skipped.
5159 * Returns how exponent needs to changed.
5160 * Size of dest buffer is not specified, assuming it's not smaller than 32:
5161 * strlen(+0.e+) + 22(digits) + 4(expontent) + 1(nullbyte)
5163 int __cdecl num_get_char__Getffld(const num_get *this, char *dest, istreambuf_iterator_char *first,
5164 istreambuf_iterator_char *last, const locale *loc)
5166 numpunct_char *numpunct = numpunct_char_use_facet(loc);
5167 int exp = 0;
5168 char *dest_beg = dest, *num_end = dest+25, *exp_end = dest+31;
5169 BOOL error = FALSE, got_digit = FALSE, got_nonzero = FALSE;
5171 TRACE("(%p %p %p %p)\n", dest, first, last, loc);
5173 istreambuf_iterator_char_val(first);
5174 /* get sign */
5175 if(first->strbuf && (first->val=='-' || first->val=='+')) {
5176 *dest++ = first->val;
5177 istreambuf_iterator_char_inc(first);
5181 /* read numbers before decimal */
5182 for(; first->strbuf; istreambuf_iterator_char_inc(first)) {
5183 if(first->val<'0' || first->val>'9') {
5184 break;
5185 }else {
5186 got_digit = TRUE; /* found a digit, zero or non-zero */
5187 /* write digit to dest if not a leading zero (to not waste dest buffer) */
5188 if(!got_nonzero && first->val == '0')
5189 continue;
5190 got_nonzero = TRUE;
5191 if(dest < num_end)
5192 *dest++ = first->val;
5193 else
5194 exp++; /* too many digits, just multiply by 10 */
5197 /* if all leading zeroes, we didn't write anything so put a zero we check for a decimal */
5198 if(got_digit && !got_nonzero)
5199 *dest++ = '0';
5201 /* get decimal, if any */
5202 if(first->strbuf && first->val==numpunct_char_decimal_point(numpunct)) {
5203 if(dest < num_end)
5204 *dest++ = *localeconv()->decimal_point;
5205 istreambuf_iterator_char_inc(first);
5208 /* read non-grouped after decimal */
5209 for(; first->strbuf; istreambuf_iterator_char_inc(first)) {
5210 if(first->val<'0' || first->val>'9')
5211 break;
5212 else if(dest<num_end) {
5213 got_digit = TRUE;
5214 *dest++ = first->val;
5218 /* read exponent, if any */
5219 if(first->strbuf && (first->val=='e' || first->val=='E')) {
5220 *dest++ = first->val;
5221 istreambuf_iterator_char_inc(first);
5223 if(first->strbuf && (first->val=='-' || first->val=='+')) {
5224 *dest++ = first->val;
5225 istreambuf_iterator_char_inc(first);
5228 got_digit = got_nonzero = FALSE;
5229 error = TRUE;
5230 /* skip any leading zeroes */
5231 for(; first->strbuf && first->val=='0'; istreambuf_iterator_char_inc(first))
5232 got_digit = TRUE;
5234 for(; first->strbuf && first->val>='0' && first->val<='9'; istreambuf_iterator_char_inc(first)) {
5235 got_digit = got_nonzero = TRUE; /* leading zeroes would have been skipped, so first digit is non-zero */
5236 error = FALSE;
5237 if(dest<exp_end)
5238 *dest++ = first->val;
5241 /* if just found zeroes for exponent, use that */
5242 if(got_digit && !got_nonzero)
5244 error = FALSE;
5245 if(dest<exp_end)
5246 *dest++ = '0';
5250 if(error) {
5251 *dest_beg = '\0';
5252 return 0;
5254 *dest++ = '\0';
5255 return exp;
5258 /* ?_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 */
5259 /* ?_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 */
5260 /* Copies number to dest buffer, validates grouping and skips separators.
5261 * Updates first so it points past the number, all digits are skipped.
5262 * Returns number base (8, 10 or 16).
5263 * Size of dest buffer is not specified, assuming it's not smaller than 25:
5264 * 22(8^22>2^64)+1(detect overflows)+1(sign)+1(nullbyte) = 25
5266 int __cdecl num_get_char__Getifld(const num_get *this, char *dest, istreambuf_iterator_char *first,
5267 istreambuf_iterator_char *last, int fmtflags, const locale *loc)
5269 static const char digits[] = "0123456789abcdefABCDEF";
5271 int basefield, base;
5272 char *dest_beg = dest, *dest_end = dest+24;
5273 BOOL error = TRUE, dest_empty = TRUE, found_zero = FALSE;
5275 TRACE("(%p %p %p %04x %p)\n", dest, first, last, fmtflags, loc);
5277 basefield = fmtflags & FMTFLAG_basefield;
5278 if(basefield == FMTFLAG_oct)
5279 base = 8;
5280 else if(basefield == FMTFLAG_hex)
5281 base = 22; /* equal to the size of digits buffer */
5282 else if(!basefield)
5283 base = 0;
5284 else
5285 base = 10;
5287 istreambuf_iterator_char_val(first);
5288 if(first->strbuf && (first->val=='-' || first->val=='+')) {
5289 *dest++ = first->val;
5290 istreambuf_iterator_char_inc(first);
5293 if(first->strbuf && first->val=='0') {
5294 found_zero = TRUE;
5295 istreambuf_iterator_char_inc(first);
5296 if(first->strbuf && (first->val=='x' || first->val=='X')) {
5297 if(!base || base == 22) {
5298 found_zero = FALSE;
5299 istreambuf_iterator_char_inc(first);
5300 base = 22;
5301 }else {
5302 base = 10;
5304 }else {
5305 error = FALSE;
5306 if(!base) base = 8;
5308 }else {
5309 if (!base) base = 10;
5312 for(; first->strbuf; istreambuf_iterator_char_inc(first)) {
5313 if(!memchr(digits, first->val, base)) {
5314 break;
5315 }else {
5316 error = FALSE;
5317 if(dest_empty && first->val == '0')
5319 found_zero = TRUE;
5320 continue;
5322 dest_empty = FALSE;
5323 /* skip digits that can't be copied to dest buffer, other
5324 * functions are responsible for detecting overflows */
5325 if(dest < dest_end)
5326 *dest++ = first->val;
5330 if(error) {
5331 if (found_zero)
5332 *dest++ = '0';
5333 else
5334 dest = dest_beg;
5335 }else if(dest_empty)
5336 *dest++ = '0';
5337 *dest = '\0';
5339 return (base==22 ? 16 : base);
5342 /* ?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 */
5343 /* ?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 */
5344 #define call_num_get_char_do_get_void(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 4, istreambuf_iterator_char*, \
5345 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, void**), \
5346 (this, ret, first, last, base, state, pval))
5347 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_void,36)
5348 istreambuf_iterator_char *__thiscall num_get_char_do_get_void(const num_get *this, istreambuf_iterator_char *ret,
5349 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, void **pval)
5351 unsigned __int64 v;
5352 char tmp[25], *end;
5353 int err;
5355 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5357 v = _Stoullx(tmp, &end, num_get_char__Getifld(this, tmp,
5358 &first, &last, FMTFLAG_hex, &base->loc), &err);
5359 if(v!=(unsigned __int64)((INT_PTR)v))
5360 *state |= IOSTATE_failbit;
5361 else if(end!=tmp && !err)
5362 *pval = (void*)((INT_PTR)v);
5363 else
5364 *state |= IOSTATE_failbit;
5366 if(!first.strbuf)
5367 *state |= IOSTATE_eofbit;
5369 *ret = first;
5370 return ret;
5373 /* ?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 */
5374 /* ?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 */
5375 DEFINE_THISCALL_WRAPPER(num_get_char_get_void,36)
5376 istreambuf_iterator_char *__thiscall num_get_char_get_void(const num_get *this, istreambuf_iterator_char *ret,
5377 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, void **pval)
5379 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5380 return call_num_get_char_do_get_void(this, ret, first, last, base, state, pval);
5383 /* ?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 */
5384 /* ?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 */
5385 /* ?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 */
5386 /* ?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 */
5387 #define call_num_get_char_do_get_ldouble(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 8, istreambuf_iterator_char*, \
5388 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, double*), \
5389 (this, ret, first, last, base, state, pval))
5390 #define call_num_get_char_do_get_double(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 12, istreambuf_iterator_char*, \
5391 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, double*), \
5392 (this, ret, first, last, base, state, pval))
5393 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_double,36)
5394 istreambuf_iterator_char *__thiscall num_get_char_do_get_double(const num_get *this, istreambuf_iterator_char *ret,
5395 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, double *pval)
5397 double v;
5398 char tmp[32], *end;
5399 int err;
5401 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5403 v = _Stodx(tmp, &end, num_get_char__Getffld(this, tmp, &first, &last, &base->loc), &err);
5404 if(end!=tmp && !err)
5405 *pval = v;
5406 else
5407 *state |= IOSTATE_failbit;
5409 if(!first.strbuf)
5410 *state |= IOSTATE_eofbit;
5412 *ret = first;
5413 return ret;
5416 /* ?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 */
5417 /* ?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 */
5418 DEFINE_THISCALL_WRAPPER(num_get_char_get_ldouble,36)
5419 istreambuf_iterator_char *__thiscall num_get_char_get_ldouble(const num_get *this, istreambuf_iterator_char *ret,
5420 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, double *pval)
5422 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5423 return call_num_get_char_do_get_ldouble(this, ret, first, last, base, state, pval);
5426 /* ?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 */
5427 /* ?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 */
5428 DEFINE_THISCALL_WRAPPER(num_get_char_get_double,36)
5429 istreambuf_iterator_char *__thiscall num_get_char_get_double(const num_get *this, istreambuf_iterator_char *ret,
5430 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, double *pval)
5432 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5433 return call_num_get_char_do_get_double(this, ret, first, last, base, state, pval);
5436 /* ?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 */
5437 /* ?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 */
5438 #define call_num_get_char_do_get_float(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 16, istreambuf_iterator_char*, \
5439 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, float*), \
5440 (this, ret, first, last, base, state, pval))
5441 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_float,36)
5442 istreambuf_iterator_char *__thiscall num_get_char_do_get_float(const num_get *this, istreambuf_iterator_char *ret,
5443 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, float *pval)
5445 float v;
5446 char tmp[32], *end;
5447 int err;
5449 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5451 v = _Stofx(tmp, &end, num_get_char__Getffld(this, tmp, &first, &last, &base->loc), &err);
5452 if(end!=tmp && !err)
5453 *pval = v;
5454 else
5455 *state |= IOSTATE_failbit;
5457 if(!first.strbuf)
5458 *state |= IOSTATE_eofbit;
5460 *ret = first;
5461 return ret;
5464 /* ?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 */
5465 /* ?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 */
5466 DEFINE_THISCALL_WRAPPER(num_get_char_get_float,36)
5467 istreambuf_iterator_char *__thiscall num_get_char_get_float(const num_get *this, istreambuf_iterator_char *ret,
5468 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, float *pval)
5470 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5471 return call_num_get_char_do_get_float(this, ret, first, last, base, state, pval);
5474 /* ?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 */
5475 /* ?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 */
5476 #define call_num_get_char_do_get_uint64(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 20, istreambuf_iterator_char*, \
5477 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, ULONGLONG*), \
5478 (this, ret, first, last, base, state, pval))
5479 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_uint64,36)
5480 istreambuf_iterator_char *__thiscall num_get_char_do_get_uint64(const num_get *this, istreambuf_iterator_char *ret,
5481 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, ULONGLONG *pval)
5483 unsigned __int64 v;
5484 char tmp[25], *end;
5485 int err;
5487 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5489 v = _Stoullx(tmp, &end, num_get_char__Getifld(this, tmp,
5490 &first, &last, base->fmtfl, &base->loc), &err);
5491 if(end!=tmp && !err)
5492 *pval = v;
5493 else
5494 *state |= IOSTATE_failbit;
5496 if(!first.strbuf)
5497 *state |= IOSTATE_eofbit;
5499 *ret = first;
5500 return ret;
5503 /* ?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 */
5504 /* ?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 */
5505 DEFINE_THISCALL_WRAPPER(num_get_char_get_uint64,36)
5506 istreambuf_iterator_char *__thiscall num_get_char_get_uint64(const num_get *this, istreambuf_iterator_char *ret,
5507 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, ULONGLONG *pval)
5509 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5510 return call_num_get_char_do_get_uint64(this, ret, first, last, base, state, pval);
5513 /* ?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 */
5514 /* ?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 */
5515 #define call_num_get_char_do_get_int64(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 24, istreambuf_iterator_char*, \
5516 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, LONGLONG*), \
5517 (this, ret, first, last, base, state, pval))
5518 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_int64,36)
5519 istreambuf_iterator_char *__thiscall num_get_char_do_get_int64(const num_get *this, istreambuf_iterator_char *ret,
5520 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, LONGLONG *pval)
5522 __int64 v;
5523 char tmp[25], *end;
5524 int err;
5526 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5528 v = _Stollx(tmp, &end, num_get_char__Getifld(this, tmp,
5529 &first, &last, base->fmtfl, &base->loc), &err);
5530 if(end!=tmp && !err)
5531 *pval = v;
5532 else
5533 *state |= IOSTATE_failbit;
5535 if(!first.strbuf)
5536 *state |= IOSTATE_eofbit;
5538 *ret = first;
5539 return ret;
5542 /* ?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 */
5543 /* ?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 */
5544 DEFINE_THISCALL_WRAPPER(num_get_char_get_int64,36)
5545 istreambuf_iterator_char *__thiscall num_get_char_get_int64(const num_get *this, istreambuf_iterator_char *ret,
5546 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, LONGLONG *pval)
5548 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5549 return call_num_get_char_do_get_int64(this, ret, first, last, base, state, pval);
5552 /* ?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 */
5553 /* ?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 */
5554 #define call_num_get_char_do_get_ulong(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 28, istreambuf_iterator_char*, \
5555 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, ULONG*), \
5556 (this, ret, first, last, base, state, pval))
5557 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_ulong,36)
5558 istreambuf_iterator_char *__thiscall num_get_char_do_get_ulong(const num_get *this, istreambuf_iterator_char *ret,
5559 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, ULONG *pval)
5561 ULONG v;
5562 char tmp[25], *end;
5563 int err;
5565 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5567 v = _Stoulx(tmp, &end, num_get_char__Getifld(this, tmp,
5568 &first, &last, base->fmtfl, &base->loc), &err);
5569 if(end!=tmp && !err)
5570 *pval = v;
5571 else
5572 *state |= IOSTATE_failbit;
5574 if(!first.strbuf)
5575 *state |= IOSTATE_eofbit;
5577 *ret = first;
5578 return ret;
5581 /* ?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 */
5582 /* ?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 */
5583 DEFINE_THISCALL_WRAPPER(num_get_char_get_ulong,36)
5584 istreambuf_iterator_char *__thiscall num_get_char_get_ulong(const num_get *this, istreambuf_iterator_char *ret,
5585 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, ULONG *pval)
5587 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5588 return call_num_get_char_do_get_ulong(this, ret, first, last, base, state, pval);
5591 /* ?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 */
5592 /* ?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 */
5593 #define call_num_get_char_do_get_long(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 32, istreambuf_iterator_char*, \
5594 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, LONG*), \
5595 (this, ret, first, last, base, state, pval))
5596 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_long,36)
5597 istreambuf_iterator_char *__thiscall num_get_char_do_get_long(const num_get *this, istreambuf_iterator_char *ret,
5598 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, LONG *pval)
5600 LONG v;
5601 char tmp[25], *end;
5602 int err;
5604 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5606 v = _Stolx(tmp, &end, num_get_char__Getifld(this, tmp,
5607 &first, &last, base->fmtfl, &base->loc), &err);
5608 if(end!=tmp && !err)
5609 *pval = v;
5610 else
5611 *state |= IOSTATE_failbit;
5613 if(!first.strbuf)
5614 *state |= IOSTATE_eofbit;
5616 *ret = first;
5617 return ret;
5620 /* ?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 */
5621 /* ?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 */
5622 DEFINE_THISCALL_WRAPPER(num_get_char_get_long,36)
5623 istreambuf_iterator_char *__thiscall num_get_char_get_long(const num_get *this, istreambuf_iterator_char *ret,
5624 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, LONG *pval)
5626 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5627 return call_num_get_char_do_get_long(this, ret, first, last, base, state, pval);
5630 /* ?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 */
5631 /* ?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 */
5632 #define call_num_get_char_do_get_uint(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 36, istreambuf_iterator_char*, \
5633 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, unsigned int*), \
5634 (this, ret, first, last, base, state, pval))
5635 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_uint,36)
5636 istreambuf_iterator_char *__thiscall num_get_char_do_get_uint(const num_get *this, istreambuf_iterator_char *ret,
5637 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, unsigned int *pval)
5639 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5640 return num_get_char_do_get_ulong(this, ret, first, last, base, state, pval);
5643 /* ?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 */
5644 /* ?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 */
5645 DEFINE_THISCALL_WRAPPER(num_get_char_get_uint,36)
5646 istreambuf_iterator_char *__thiscall num_get_char_get_uint(const num_get *this, istreambuf_iterator_char *ret,
5647 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, unsigned int *pval)
5649 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5650 return call_num_get_char_do_get_uint(this, ret, first, last, base, state, pval);
5653 /* ?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 */
5654 /* ?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 */
5655 #define call_num_get_char_do_get_ushort(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 40, istreambuf_iterator_char*, \
5656 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, unsigned short*), \
5657 (this, ret, first, last, base, state, pval))
5658 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_ushort,36)
5659 istreambuf_iterator_char *__thiscall num_get_char_do_get_ushort(const num_get *this, istreambuf_iterator_char *ret,
5660 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, unsigned short *pval)
5662 ULONG v;
5663 char tmp[25], *beg, *end;
5664 int err, b;
5666 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5668 b = num_get_char__Getifld(this, tmp,
5669 &first, &last, base->fmtfl, &base->loc);
5670 beg = tmp + (tmp[0]=='-' ? 1 : 0);
5671 v = _Stoulx(beg, &end, b, &err);
5673 if(v != (ULONG)((unsigned short)v))
5674 *state |= IOSTATE_failbit;
5675 else if(end!=beg && !err)
5676 *pval = (tmp[0]=='-' ? -((unsigned short)v) : v);
5677 else
5678 *state |= IOSTATE_failbit;
5680 if(!first.strbuf)
5681 *state |= IOSTATE_eofbit;
5683 *ret = first;
5684 return ret;
5687 /* ?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 */
5688 /* ?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 */
5689 DEFINE_THISCALL_WRAPPER(num_get_char_get_ushort,36)
5690 istreambuf_iterator_char *__thiscall num_get_char_get_ushort(const num_get *this, istreambuf_iterator_char *ret,
5691 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, unsigned short *pval)
5693 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5694 return call_num_get_char_do_get_ushort(this, ret, first, last, base, state, pval);
5697 /* ?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 */
5698 /* ?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 */
5699 #define call_num_get_char_do_get_bool(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 44, istreambuf_iterator_char*, \
5700 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, MSVCP_bool*), \
5701 (this, ret, first, last, base, state, pval))
5702 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_bool,36)
5703 istreambuf_iterator_char *__thiscall num_get_char_do_get_bool(const num_get *this, istreambuf_iterator_char *ret,
5704 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, MSVCP_bool *pval)
5706 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5708 if(base->fmtfl & FMTFLAG_boolalpha) {
5709 numpunct_char *numpunct = numpunct_char_use_facet(&base->loc);
5710 basic_string_char false_bstr, true_bstr;
5711 const char *pfalse, *ptrue;
5713 numpunct_char_falsename(numpunct, &false_bstr);
5714 numpunct_char_truename(numpunct, &true_bstr);
5715 pfalse = MSVCP_basic_string_char_c_str(&false_bstr);
5716 ptrue = MSVCP_basic_string_char_c_str(&true_bstr);
5718 for(istreambuf_iterator_char_val(&first); first.strbuf;) {
5719 if(pfalse && *pfalse && first.val!=*pfalse)
5720 pfalse = NULL;
5721 if(ptrue && *ptrue && first.val!=*ptrue)
5722 ptrue = NULL;
5724 if(pfalse && *pfalse && ptrue && !*ptrue)
5725 ptrue = NULL;
5726 if(ptrue && *ptrue && pfalse && !*pfalse)
5727 pfalse = NULL;
5729 if(pfalse)
5730 pfalse++;
5731 if(ptrue)
5732 ptrue++;
5734 if(pfalse || ptrue)
5735 istreambuf_iterator_char_inc(&first);
5737 if((!pfalse || !*pfalse) && (!ptrue || !*ptrue))
5738 break;
5741 if(ptrue)
5742 *pval = TRUE;
5743 else if(pfalse)
5744 *pval = FALSE;
5745 else
5746 *state |= IOSTATE_failbit;
5748 MSVCP_basic_string_char_dtor(&false_bstr);
5749 MSVCP_basic_string_char_dtor(&true_bstr);
5750 }else {
5751 char tmp[25], *end;
5752 int err;
5753 LONG v = _Stolx(tmp, &end, num_get_char__Getifld(this, tmp,
5754 &first, &last, base->fmtfl, &base->loc), &err);
5756 if(end!=tmp && err==0 && (v==0 || v==1))
5757 *pval = v;
5758 else
5759 *state |= IOSTATE_failbit;
5762 if(!first.strbuf)
5763 *state |= IOSTATE_eofbit;
5764 memcpy(ret, &first, sizeof(first));
5765 return ret;
5768 /* ?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 */
5769 /* ?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 */
5770 DEFINE_THISCALL_WRAPPER(num_get_char_get_bool,36)
5771 istreambuf_iterator_char *__thiscall num_get_char_get_bool(const num_get *this, istreambuf_iterator_char *ret,
5772 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, MSVCP_bool *pval)
5774 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5775 return call_num_get_char_do_get_bool(this, ret, first, last, base, state, pval);
5778 /* ?id@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@2V0locale@2@A */
5779 locale_id num_put_char_id = {0};
5781 /* num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@6B@ */
5782 extern const vtable_ptr MSVCP_num_put_char_vtable;
5784 /* ?_Init@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@IAEXABV_Locinfo@2@@Z */
5785 /* ?_Init@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@IEAAXAEBV_Locinfo@2@@Z */
5786 DEFINE_THISCALL_WRAPPER(num_put_char__Init, 8)
5787 void __thiscall num_put_char__Init(num_put *this, const _Locinfo *locinfo)
5789 TRACE("(%p %p)\n", this, locinfo);
5790 _Locinfo__Getcvt(locinfo, &this->cvt);
5793 /* ??0?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
5794 /* ??0?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
5795 DEFINE_THISCALL_WRAPPER(num_put_char_ctor_locinfo, 12)
5796 num_put* __thiscall num_put_char_ctor_locinfo(num_put *this, const _Locinfo *locinfo, MSVCP_size_t refs)
5798 TRACE("(%p %p %ld)\n", this, locinfo, refs);
5800 locale_facet_ctor_refs(&this->facet, refs);
5801 this->facet.vtable = &MSVCP_num_put_char_vtable;
5803 num_put_char__Init(this, locinfo);
5804 return this;
5807 /* ??0?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAE@I@Z */
5808 /* ??0?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAA@_K@Z */
5809 DEFINE_THISCALL_WRAPPER(num_put_char_ctor_refs, 8)
5810 num_put* __thiscall num_put_char_ctor_refs(num_put *this, MSVCP_size_t refs)
5812 _Locinfo locinfo;
5814 TRACE("(%p %lu)\n", this, refs);
5816 _Locinfo_ctor(&locinfo);
5817 num_put_char_ctor_locinfo(this, &locinfo, refs);
5818 _Locinfo_dtor(&locinfo);
5819 return this;
5822 /* ??_F?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAEXXZ */
5823 /* ??_F?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAAXXZ */
5824 DEFINE_THISCALL_WRAPPER(num_put_char_ctor, 4)
5825 num_put* __thiscall num_put_char_ctor(num_put *this)
5827 return num_put_char_ctor_refs(this, 0);
5830 /* ??1?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@UAE@XZ */
5831 /* ??1?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@UEAA@XZ */
5832 /* ??1?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MAE@XZ */
5833 /* ??1?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MEAA@XZ */
5834 DEFINE_THISCALL_WRAPPER(num_put_char_dtor, 4)
5835 void __thiscall num_put_char_dtor(num_put *this)
5837 TRACE("(%p)\n", this);
5838 locale_facet_dtor(&this->facet);
5841 DEFINE_THISCALL_WRAPPER(num_put_char_vector_dtor, 8)
5842 num_put* __thiscall num_put_char_vector_dtor(num_put *this, unsigned int flags)
5844 TRACE("(%p %x)\n", this, flags);
5845 if(flags & 2) {
5846 /* we have an array, with the number of elements stored before the first object */
5847 INT_PTR i, *ptr = (INT_PTR *)this-1;
5849 for(i=*ptr-1; i>=0; i--)
5850 num_put_char_dtor(this+i);
5851 MSVCRT_operator_delete(ptr);
5852 } else {
5853 num_put_char_dtor(this);
5854 if(flags & 1)
5855 MSVCRT_operator_delete(this);
5858 return this;
5861 /* ?_Getcat@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
5862 /* ?_Getcat@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
5863 MSVCP_size_t __cdecl num_put_char__Getcat(const locale_facet **facet, const locale *loc)
5865 TRACE("(%p %p)\n", facet, loc);
5867 if(facet && !*facet) {
5868 _Locinfo locinfo;
5870 *facet = MSVCRT_operator_new(sizeof(num_put));
5871 if(!*facet) {
5872 ERR("Out of memory\n");
5873 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
5874 return 0;
5877 _Locinfo_ctor_cstr(&locinfo, MSVCP_basic_string_char_c_str(&loc->ptr->name));
5878 num_put_char_ctor_locinfo((num_put*)*facet, &locinfo, 0);
5879 _Locinfo_dtor(&locinfo);
5882 return LC_NUMERIC;
5885 num_put* num_put_char_use_facet(const locale *loc)
5887 static num_put *obj = NULL;
5889 _Lockit lock;
5890 const locale_facet *fac;
5892 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
5893 fac = locale__Getfacet(loc, locale_id_operator_size_t(&num_put_char_id), TRUE);
5894 if(fac) {
5895 _Lockit_dtor(&lock);
5896 return (num_put*)fac;
5899 if(obj) {
5900 _Lockit_dtor(&lock);
5901 return obj;
5904 num_put_char__Getcat(&fac, loc);
5905 obj = (num_put*)fac;
5906 locale_facet__Incref(&obj->facet);
5907 locale_facet_register(&obj->facet);
5908 _Lockit_dtor(&lock);
5910 return obj;
5913 /* ?_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 */
5914 /* ?_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 */
5915 ostreambuf_iterator_char* __cdecl num_put_char__Putc(const num_put *this, ostreambuf_iterator_char *ret,
5916 ostreambuf_iterator_char dest, const char *ptr, MSVCP_size_t count)
5918 TRACE("(%p %p %p %ld)\n", this, ret, ptr, count);
5920 for(; count>0; count--)
5921 ostreambuf_iterator_char_put(&dest, *ptr++);
5923 *ret = dest;
5924 return ret;
5927 /* ?_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 */
5928 /* ?_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 */
5929 ostreambuf_iterator_char* __cdecl num_put_char__Rep(const num_put *this, ostreambuf_iterator_char *ret,
5930 ostreambuf_iterator_char dest, char c, MSVCP_size_t count)
5932 TRACE("(%p %p %d %ld)\n", this, ret, c, count);
5934 for(; count>0; count--)
5935 ostreambuf_iterator_char_put(&dest, c);
5937 *ret = dest;
5938 return ret;
5941 /* ?_Ffmt@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@ABAPADPADDH@Z */
5942 /* ?_Ffmt@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@AEBAPEADPEADDH@Z */
5943 char* __cdecl num_put_char__Ffmt(const num_put *this, char *fmt, char spec, int fmtfl)
5945 int type = fmtfl & FMTFLAG_floatfield;
5946 char *p = fmt;
5948 TRACE("(%p %p %d %d)\n", this, fmt, spec, fmtfl);
5950 *p++ = '%';
5951 if(fmtfl & FMTFLAG_showpos)
5952 *p++ = '+';
5953 if(fmtfl & FMTFLAG_showpoint)
5954 *p++ = '#';
5955 *p++ = '.';
5956 *p++ = '*';
5957 if(spec)
5958 *p++ = spec;
5960 if(type == FMTFLAG_fixed)
5961 *p++ = 'f';
5962 else if(type == FMTFLAG_scientific)
5963 *p++ = (fmtfl & FMTFLAG_uppercase) ? 'E' : 'e';
5964 else if(type == (FMTFLAG_fixed|FMTFLAG_scientific))
5965 *p++ = (fmtfl & FMTFLAG_uppercase) ? 'A' : 'a';
5966 else
5967 *p++ = (fmtfl & FMTFLAG_uppercase) ? 'G' : 'g';
5969 *p++ = '\0';
5970 return fmt;
5973 /* TODO: This function should be removed when num_put_char__Fput is implemented */
5974 static ostreambuf_iterator_char* num_put_char_fput(const num_put *this, ostreambuf_iterator_char *ret,
5975 ostreambuf_iterator_char dest, ios_base *base, char fill, char *buf, MSVCP_size_t count)
5977 numpunct_char *numpunct = numpunct_char_use_facet(&base->loc);
5978 char *p, sep = *localeconv()->decimal_point;
5979 int adjustfield = base->fmtfl & FMTFLAG_adjustfield;
5980 MSVCP_size_t pad;
5982 TRACE("(%p %p %p %d %s %ld)\n", this, ret, base, fill, buf, count);
5984 /* Change decimal point */
5985 for(p=buf; p<buf+count; p++) {
5986 if(*p == sep) {
5987 *p = numpunct_char_decimal_point(numpunct);
5988 break;
5991 p--;
5993 /* Display number with padding */
5994 if(count >= base->wide)
5995 pad = 0;
5996 else
5997 pad = base->wide-count;
5998 base->wide = 0;
6000 if((adjustfield & FMTFLAG_internal) && (buf[0]=='-' || buf[0]=='+')) {
6001 num_put_char__Putc(this, &dest, dest, buf, 1);
6002 buf++;
6004 if(adjustfield != FMTFLAG_left) {
6005 num_put_char__Rep(this, ret, dest, fill, pad);
6006 pad = 0;
6008 num_put_char__Putc(this, &dest, dest, buf, count);
6009 return num_put_char__Rep(this, ret, dest, fill, pad);
6012 /* ?_Ifmt@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@ABAPADPADPBDH@Z */
6013 /* ?_Ifmt@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@AEBAPEADPEADPEBDH@Z */
6014 char* __cdecl num_put_char__Ifmt(const num_put *this, char *fmt, const char *spec, int fmtfl)
6016 int base = fmtfl & FMTFLAG_basefield;
6017 char *p = fmt;
6019 TRACE("(%p %p %p %d)\n", this, fmt, spec, fmtfl);
6021 *p++ = '%';
6022 if(fmtfl & FMTFLAG_showpos)
6023 *p++ = '+';
6024 if(fmtfl & FMTFLAG_showbase)
6025 *p++ = '#';
6027 *p++ = *spec++;
6028 if(*spec == 'l')
6029 *p++ = *spec++;
6031 if(base == FMTFLAG_oct)
6032 *p++ = 'o';
6033 else if(base == FMTFLAG_hex)
6034 *p++ = (fmtfl & FMTFLAG_uppercase) ? 'X' : 'x';
6035 else
6036 *p++ = *spec;
6038 *p++ = '\0';
6039 return fmt;
6042 /* ?_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 */
6043 /* ?_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 */
6044 ostreambuf_iterator_char* __cdecl num_put_char__Iput(const num_put *this, ostreambuf_iterator_char *ret,
6045 ostreambuf_iterator_char dest, ios_base *base, char fill, char *buf, MSVCP_size_t count)
6047 numpunct_char *numpunct = numpunct_char_use_facet(&base->loc);
6048 basic_string_char grouping_bstr;
6049 const char *grouping;
6050 char *p, sep;
6051 int cur_group = 0, group_size = 0;
6052 int adjustfield = base->fmtfl & FMTFLAG_adjustfield;
6053 MSVCP_size_t pad;
6055 TRACE("(%p %p %p %d %s %ld)\n", this, ret, base, fill, buf, count);
6057 /* Add separators to number */
6058 numpunct_char_grouping(numpunct, &grouping_bstr);
6059 grouping = MSVCP_basic_string_char_c_str(&grouping_bstr);
6060 sep = grouping[0] ? numpunct_char_thousands_sep(numpunct) : '\0';
6062 for(p=buf+count-1; p>buf && sep && grouping[cur_group]!=CHAR_MAX; p--) {
6063 group_size++;
6064 if(group_size == grouping[cur_group]) {
6065 group_size = 0;
6066 if(grouping[cur_group+1])
6067 cur_group++;
6069 memmove(p+1, p, buf+count-p);
6070 *p = sep;
6071 count++;
6074 MSVCP_basic_string_char_dtor(&grouping_bstr);
6076 /* Display number with padding */
6077 if(count >= base->wide)
6078 pad = 0;
6079 else
6080 pad = base->wide-count;
6081 base->wide = 0;
6083 if((adjustfield & FMTFLAG_internal) && (buf[0]=='-' || buf[0]=='+')) {
6084 num_put_char__Putc(this, &dest, dest, buf, 1);
6085 buf++;
6086 }else if((adjustfield & FMTFLAG_internal) && (buf[1]=='x' || buf[1]=='X')) {
6087 num_put_char__Putc(this, &dest, dest, buf, 2);
6088 buf += 2;
6090 if(adjustfield != FMTFLAG_left) {
6091 num_put_char__Rep(this, ret, dest, fill, pad);
6092 pad = 0;
6094 num_put_char__Putc(this, &dest, dest, buf, count);
6095 return num_put_char__Rep(this, ret, dest, fill, pad);
6098 /* ?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 */
6099 /* ?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 */
6100 #define call_num_put_char_do_put_long(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 28, ostreambuf_iterator_char*, \
6101 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, LONG), \
6102 (this, ret, dest, base, fill, v))
6103 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_long, 28)
6104 ostreambuf_iterator_char* __thiscall num_put_char_do_put_long(const num_put *this, ostreambuf_iterator_char *ret,
6105 ostreambuf_iterator_char dest, ios_base *base, char fill, LONG v)
6107 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
6108 char fmt[7]; /* strlen("%+#lld")+1 */
6110 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
6112 return num_put_char__Iput(this, ret, dest, base, fill, tmp,
6113 sprintf(tmp, num_put_char__Ifmt(this, fmt, "ld", base->fmtfl), v));
6116 /* ?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 */
6117 /* ?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 */
6118 DEFINE_THISCALL_WRAPPER(num_put_char_put_long, 28)
6119 ostreambuf_iterator_char* __thiscall num_put_char_put_long(const num_put *this, ostreambuf_iterator_char *ret,
6120 ostreambuf_iterator_char dest, ios_base *base, char fill, LONG v)
6122 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
6123 return call_num_put_char_do_put_long(this, ret, dest, base, fill, v);
6126 /* ?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 */
6127 /* ?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 */
6128 #define call_num_put_char_do_put_ulong(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 24, ostreambuf_iterator_char*, \
6129 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, ULONG), \
6130 (this, ret, dest, base, fill, v))
6131 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_ulong, 28)
6132 ostreambuf_iterator_char* __thiscall num_put_char_do_put_ulong(const num_put *this, ostreambuf_iterator_char *ret,
6133 ostreambuf_iterator_char dest, ios_base *base, char fill, ULONG v)
6135 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
6136 char fmt[7]; /* strlen("%+#lld")+1 */
6138 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
6140 return num_put_char__Iput(this, ret, dest, base, fill, tmp,
6141 sprintf(tmp, num_put_char__Ifmt(this, fmt, "lu", base->fmtfl), v));
6144 /* ?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 */
6145 /* ?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 */
6146 DEFINE_THISCALL_WRAPPER(num_put_char_put_ulong, 28)
6147 ostreambuf_iterator_char* __thiscall num_put_char_put_ulong(const num_put *this, ostreambuf_iterator_char *ret,
6148 ostreambuf_iterator_char dest, ios_base *base, char fill, ULONG v)
6150 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
6151 return call_num_put_char_do_put_ulong(this, ret, dest, base, fill, v);
6154 static inline unsigned get_precision(const ios_base *base)
6156 streamsize ret = base->prec <= 0 && !(base->fmtfl & FMTFLAG_fixed) ? 6 : base->prec;
6157 if(ret > UINT_MAX)
6158 ret = UINT_MAX;
6159 return ret;
6162 /* ?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 */
6163 /* ?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 */
6164 /* ?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 */
6165 /* ?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 */
6166 #define call_num_put_char_do_put_double(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 12, ostreambuf_iterator_char*, \
6167 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, double), \
6168 (this, ret, dest, base, fill, v))
6169 #define call_num_put_char_do_put_ldouble(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 8, ostreambuf_iterator_char*, \
6170 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, double), \
6171 (this, ret, dest, base, fill, v))
6172 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_double, 32)
6173 ostreambuf_iterator_char* __thiscall num_put_char_do_put_double(const num_put *this, ostreambuf_iterator_char *ret,
6174 ostreambuf_iterator_char dest, ios_base *base, char fill, double v)
6176 char *tmp;
6177 char fmt[8]; /* strlen("%+#.*lg")+1 */
6178 int size;
6179 unsigned prec;
6181 TRACE("(%p %p %p %d %lf)\n", this, ret, base, fill, v);
6183 num_put_char__Ffmt(this, fmt, '\0', base->fmtfl);
6184 prec = get_precision(base);
6185 size = _scprintf(fmt, prec, v);
6187 /* TODO: don't use dynamic allocation */
6188 tmp = MSVCRT_operator_new(size*2);
6189 if(!tmp) {
6190 ERR("Out of memory\n");
6191 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
6193 num_put_char_fput(this, ret, dest, base, fill, tmp, sprintf(tmp, fmt, prec, v));
6194 MSVCRT_operator_delete(tmp);
6195 return ret;
6198 /* ?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 */
6199 /* ?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 */
6200 DEFINE_THISCALL_WRAPPER(num_put_char_put_double, 32)
6201 ostreambuf_iterator_char* __thiscall num_put_char_put_double(const num_put *this, ostreambuf_iterator_char *ret,
6202 ostreambuf_iterator_char dest, ios_base *base, char fill, double v)
6204 TRACE("(%p %p %p %d %lf)\n", this, ret, base, fill, v);
6205 return call_num_put_char_do_put_double(this, ret, dest, base, fill, v);
6208 /* ?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 */
6209 /* ?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 */
6210 DEFINE_THISCALL_WRAPPER(num_put_char_put_ldouble, 32)
6211 ostreambuf_iterator_char* __thiscall num_put_char_put_ldouble(const num_put *this, ostreambuf_iterator_char *ret,
6212 ostreambuf_iterator_char dest, ios_base *base, char fill, double v)
6214 TRACE("(%p %p %p %d %lf)\n", this, ret, base, fill, v);
6215 return call_num_put_char_do_put_ldouble(this, ret, dest, base, fill, v);
6218 /* ?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 */
6219 /* ?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 */
6220 #define call_num_put_char_do_put_ptr(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 4, ostreambuf_iterator_char*, \
6221 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, const void*), \
6222 (this, ret, dest, base, fill, v))
6223 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_ptr, 28)
6224 ostreambuf_iterator_char* __thiscall num_put_char_do_put_ptr(const num_put *this, ostreambuf_iterator_char *ret,
6225 ostreambuf_iterator_char dest, ios_base *base, char fill, const void *v)
6227 char tmp[17]; /* 8(16^8==2^64)*2(separators beetwen every digit) + 1 */
6229 TRACE("(%p %p %p %d %p)\n", this, ret, base, fill, v);
6231 return num_put_char__Iput(this, ret, dest, base, fill, tmp, sprintf(tmp, "%p", v));
6234 /* ?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 */
6235 /* ?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 */
6236 DEFINE_THISCALL_WRAPPER(num_put_char_put_ptr, 28)
6237 ostreambuf_iterator_char* __thiscall num_put_char_put_ptr(const num_put *this, ostreambuf_iterator_char *ret,
6238 ostreambuf_iterator_char dest, ios_base *base, char fill, const void *v)
6240 TRACE("(%p %p %p %d %p)\n", this, ret, base, fill, v);
6241 return call_num_put_char_do_put_ptr(this, ret, dest, base, fill, v);
6244 /* ?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 */
6245 /* ?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 */
6246 #define call_num_put_char_do_put_int64(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 20, ostreambuf_iterator_char*, \
6247 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, __int64), \
6248 (this, ret, dest, base, fill, v))
6249 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_int64, 32)
6250 ostreambuf_iterator_char* __thiscall num_put_char_do_put_int64(const num_put *this, ostreambuf_iterator_char *ret,
6251 ostreambuf_iterator_char dest, ios_base *base, char fill, __int64 v)
6253 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
6254 char fmt[7]; /* strlen("%+#lld")+1 */
6256 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
6258 return num_put_char__Iput(this, ret, dest, base, fill, tmp,
6259 sprintf(tmp, num_put_char__Ifmt(this, fmt, "lld", base->fmtfl), v));
6262 /* ?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 */
6263 /* ?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 */
6264 DEFINE_THISCALL_WRAPPER(num_put_char_put_int64, 32)
6265 ostreambuf_iterator_char* __thiscall num_put_char_put_int64(const num_put *this, ostreambuf_iterator_char *ret,
6266 ostreambuf_iterator_char dest, ios_base *base, char fill, __int64 v)
6268 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
6269 return call_num_put_char_do_put_int64(this, ret, dest, base, fill, v);
6272 /* ?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 */
6273 /* ?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 */
6274 #define call_num_put_char_do_put_uint64(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 16, ostreambuf_iterator_char*, \
6275 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, unsigned __int64), \
6276 (this, ret, dest, base, fill, v))
6277 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_uint64, 32)
6278 ostreambuf_iterator_char* __thiscall num_put_char_do_put_uint64(const num_put *this, ostreambuf_iterator_char *ret,
6279 ostreambuf_iterator_char dest, ios_base *base, char fill, unsigned __int64 v)
6281 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
6282 char fmt[7]; /* strlen("%+#lld")+1 */
6284 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
6286 return num_put_char__Iput(this, ret, dest, base, fill, tmp,
6287 sprintf(tmp, num_put_char__Ifmt(this, fmt, "llu", base->fmtfl), v));
6290 /* ?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 */
6291 /* ?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 */
6292 DEFINE_THISCALL_WRAPPER(num_put_char_put_uint64, 32)
6293 ostreambuf_iterator_char* __thiscall num_put_char_put_uint64(const num_put *this, ostreambuf_iterator_char *ret,
6294 ostreambuf_iterator_char dest, ios_base *base, char fill, unsigned __int64 v)
6296 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
6297 return call_num_put_char_do_put_uint64(this, ret, dest, base, fill, v);
6300 /* ?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 */
6301 /* ?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 */
6302 #define call_num_put_char_do_put_bool(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 32, ostreambuf_iterator_char*, \
6303 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, MSVCP_bool), \
6304 (this, ret, dest, base, fill, v))
6305 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_bool, 28)
6306 ostreambuf_iterator_char* __thiscall num_put_char_do_put_bool(const num_put *this, ostreambuf_iterator_char *ret,
6307 ostreambuf_iterator_char dest, ios_base *base, char fill, MSVCP_bool v)
6309 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
6311 if(base->fmtfl & FMTFLAG_boolalpha) {
6312 numpunct_char *numpunct = numpunct_char_use_facet(&base->loc);
6313 basic_string_char str;
6314 MSVCP_size_t pad, len;
6316 if(v)
6317 numpunct_char_truename(numpunct, &str);
6318 else
6319 numpunct_char_falsename(numpunct, &str);
6321 len = MSVCP_basic_string_char_length(&str);
6322 pad = (len>base->wide ? 0 : base->wide-len);
6323 base->wide = 0;
6325 if((base->fmtfl & FMTFLAG_adjustfield) != FMTFLAG_left) {
6326 num_put_char__Rep(this, &dest, dest, fill, pad);
6327 pad = 0;
6329 num_put_char__Putc(this, &dest, dest, MSVCP_basic_string_char_c_str(&str), len);
6330 MSVCP_basic_string_char_dtor(&str);
6331 return num_put_char__Rep(this, ret, dest, fill, pad);
6334 return num_put_char_put_long(this, ret, dest, base, fill, v);
6337 /* ?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 */
6338 /* ?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 */
6339 DEFINE_THISCALL_WRAPPER(num_put_char_put_bool, 28)
6340 ostreambuf_iterator_char* __thiscall num_put_char_put_bool(const num_put *this, ostreambuf_iterator_char *ret,
6341 ostreambuf_iterator_char dest, ios_base *base, char fill, MSVCP_bool v)
6343 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
6344 return call_num_put_char_do_put_bool(this, ret, dest, base, fill, v);
6347 /* ?id@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@2V0locale@2@A */
6348 locale_id num_put_wchar_id = {0};
6349 /* ?id@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@2V0locale@2@A */
6350 locale_id num_put_short_id = {0};
6352 /* num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@6B@ */
6353 extern const vtable_ptr MSVCP_num_put_wchar_vtable;
6354 /* num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@6B@ */
6355 extern const vtable_ptr MSVCP_num_put_short_vtable;
6357 /* ?_Init@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@IAEXABV_Locinfo@2@@Z */
6358 /* ?_Init@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@IEAAXAEBV_Locinfo@2@@Z */
6359 DEFINE_THISCALL_WRAPPER(num_put_wchar__Init, 8)
6360 void __thiscall num_put_wchar__Init(num_put *this, const _Locinfo *locinfo)
6362 TRACE("(%p %p)\n", this, locinfo);
6363 _Locinfo__Getcvt(locinfo, &this->cvt);
6366 /* ??0?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
6367 /* ??0?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
6368 DEFINE_THISCALL_WRAPPER(num_put_wchar_ctor_locinfo, 12)
6369 num_put* __thiscall num_put_wchar_ctor_locinfo(num_put *this, const _Locinfo *locinfo, MSVCP_size_t refs)
6371 TRACE("(%p %p %ld)\n", this, locinfo, refs);
6373 locale_facet_ctor_refs(&this->facet, refs);
6374 this->facet.vtable = &MSVCP_num_put_wchar_vtable;
6376 num_put_wchar__Init(this, locinfo);
6377 return this;
6380 /* ??0?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
6381 /* ??0?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
6382 DEFINE_THISCALL_WRAPPER(num_put_short_ctor_locinfo, 12)
6383 num_put* __thiscall num_put_short_ctor_locinfo(num_put *this, const _Locinfo *locinfo, MSVCP_size_t refs)
6385 num_put_wchar_ctor_locinfo(this, locinfo, refs);
6386 this->facet.vtable = &MSVCP_num_put_short_vtable;
6387 return this;
6390 /* ??0?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAE@I@Z */
6391 /* ??0?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAA@_K@Z */
6392 DEFINE_THISCALL_WRAPPER(num_put_wchar_ctor_refs, 8)
6393 num_put* __thiscall num_put_wchar_ctor_refs(num_put *this, MSVCP_size_t refs)
6395 _Locinfo locinfo;
6397 TRACE("(%p %lu)\n", this, refs);
6399 _Locinfo_ctor(&locinfo);
6400 num_put_wchar_ctor_locinfo(this, &locinfo, refs);
6401 _Locinfo_dtor(&locinfo);
6402 return this;
6405 /* ??0?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAE@I@Z */
6406 /* ??0?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEAA@_K@Z */
6407 DEFINE_THISCALL_WRAPPER(num_put_short_ctor_refs, 8)
6408 num_put* __thiscall num_put_short_ctor_refs(num_put *this, MSVCP_size_t refs)
6410 num_put_wchar_ctor_refs(this, refs);
6411 this->facet.vtable = &MSVCP_num_put_short_vtable;
6412 return this;
6415 /* ??_F?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAEXXZ */
6416 /* ??_F?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEAAXXZ */
6417 DEFINE_THISCALL_WRAPPER(num_put_short_ctor, 4)
6418 num_put* __thiscall num_put_short_ctor(num_put *this)
6420 return num_put_short_ctor_refs(this, 0);
6423 /* ??1?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@UAE@XZ */
6424 /* ??1?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@UEAA@XZ */
6425 /* ??1?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MAE@XZ */
6426 /* ??1?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MEAA@XZ */
6427 /* ??1?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MAE@XZ */
6428 /* ??1?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MEAA@XZ */
6429 DEFINE_THISCALL_WRAPPER(num_put_wchar_dtor, 4)
6430 void __thiscall num_put_wchar_dtor(num_put *this)
6432 TRACE("(%p)\n", this);
6433 locale_facet_dtor(&this->facet);
6436 DEFINE_THISCALL_WRAPPER(num_put_wchar_vector_dtor, 8)
6437 num_put* __thiscall num_put_wchar_vector_dtor(num_put *this, unsigned int flags)
6439 TRACE("(%p %x)\n", this, flags);
6440 if(flags & 2) {
6441 /* we have an array, with the number of elements stored before the first object */
6442 INT_PTR i, *ptr = (INT_PTR *)this-1;
6444 for(i=*ptr-1; i>=0; i--)
6445 num_put_wchar_dtor(this+i);
6446 MSVCRT_operator_delete(ptr);
6447 } else {
6448 num_put_wchar_dtor(this);
6449 if(flags & 1)
6450 MSVCRT_operator_delete(this);
6453 return this;
6456 /* ?_Getcat@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
6457 /* ?_Getcat@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
6458 MSVCP_size_t __cdecl num_put_wchar__Getcat(const locale_facet **facet, const locale *loc)
6460 TRACE("(%p %p)\n", facet, loc);
6462 if(facet && !*facet) {
6463 _Locinfo locinfo;
6465 *facet = MSVCRT_operator_new(sizeof(num_put));
6466 if(!*facet) {
6467 ERR("Out of memory\n");
6468 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
6469 return 0;
6472 _Locinfo_ctor_cstr(&locinfo, locale_string_char_c_str(&loc->ptr->name));
6473 num_put_wchar_ctor_locinfo((num_put*)*facet, &locinfo, 0);
6474 _Locinfo_dtor(&locinfo);
6477 return LC_NUMERIC;
6480 /* ?_Getcat@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
6481 /* ?_Getcat@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
6482 MSVCP_size_t __cdecl num_put_short__Getcat(const locale_facet **facet, const locale *loc)
6484 TRACE("(%p %p)\n", facet, loc);
6486 if(facet && !*facet) {
6487 _Locinfo locinfo;
6489 *facet = MSVCRT_operator_new(sizeof(num_put));
6490 if(!*facet) {
6491 ERR("Out of memory\n");
6492 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
6493 return 0;
6496 _Locinfo_ctor_cstr(&locinfo, locale_string_char_c_str(&loc->ptr->name));
6497 num_put_short_ctor_locinfo((num_put*)*facet, &locinfo, 0);
6498 _Locinfo_dtor(&locinfo);
6501 return LC_NUMERIC;
6504 num_put* num_put_wchar_use_facet(const locale *loc)
6506 static num_put *obj = NULL;
6508 _Lockit lock;
6509 const locale_facet *fac;
6511 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
6512 fac = locale__Getfacet(loc, locale_id_operator_size_t(&num_put_wchar_id), TRUE);
6513 if(fac) {
6514 _Lockit_dtor(&lock);
6515 return (num_put*)fac;
6518 if(obj) {
6519 _Lockit_dtor(&lock);
6520 return obj;
6523 num_put_wchar__Getcat(&fac, loc);
6524 obj = (num_put*)fac;
6525 locale_facet__Incref(&obj->facet);
6526 locale_facet_register(&obj->facet);
6527 _Lockit_dtor(&lock);
6529 return obj;
6532 num_put* num_put_short_use_facet(const locale *loc)
6534 static num_put *obj = NULL;
6536 _Lockit lock;
6537 const locale_facet *fac;
6539 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
6540 fac = locale__Getfacet(loc, locale_id_operator_size_t(&num_put_short_id), TRUE);
6541 if(fac) {
6542 _Lockit_dtor(&lock);
6543 return (num_put*)fac;
6546 if(obj) {
6547 _Lockit_dtor(&lock);
6548 return obj;
6551 num_put_short__Getcat(&fac, loc);
6552 obj = (num_put*)fac;
6553 locale_facet__Incref(&obj->facet);
6554 locale_facet_register(&obj->facet);
6555 _Lockit_dtor(&lock);
6557 return obj;
6560 /* ?_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 */
6561 /* ?_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 */
6562 /* ?_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 */
6563 /* ?_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 */
6564 ostreambuf_iterator_wchar* __cdecl num_put_wchar__Put(const num_put *this, ostreambuf_iterator_wchar *ret,
6565 ostreambuf_iterator_wchar dest, const wchar_t *ptr, MSVCP_size_t count)
6567 TRACE("(%p %p %s %ld)\n", this, ret, debugstr_wn(ptr, count), count);
6569 for(; count>0; count--)
6570 ostreambuf_iterator_wchar_put(&dest, *ptr++);
6572 *ret = dest;
6573 return ret;
6576 /* ?_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 */
6577 /* ?_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 */
6578 /* ?_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 */
6579 /* ?_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 */
6580 ostreambuf_iterator_wchar* __cdecl num_put_wchar__Putc(const num_put *this, ostreambuf_iterator_wchar *ret,
6581 ostreambuf_iterator_wchar dest, const char *ptr, MSVCP_size_t count)
6583 int state = 0;
6584 wchar_t ch;
6586 TRACE("(%p %p %s %ld)\n", this, ret, debugstr_an(ptr, count), count);
6588 for(; count>0; count--) {
6589 if(_Mbrtowc(&ch, ptr++, 1, &state, &this->cvt) == 1)
6590 ostreambuf_iterator_wchar_put(&dest, ch);
6593 *ret = dest;
6594 return ret;
6597 /* ?_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 */
6598 /* ?_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 */
6599 /* ?_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 */
6600 /* ?_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 */
6601 ostreambuf_iterator_wchar* __cdecl num_put_wchar__Rep(const num_put *this, ostreambuf_iterator_wchar *ret,
6602 ostreambuf_iterator_wchar dest, wchar_t c, MSVCP_size_t count)
6604 TRACE("(%p %p %d %ld)\n", this, ret, c, count);
6606 for(; count>0; count--)
6607 ostreambuf_iterator_wchar_put(&dest, c);
6609 *ret = dest;
6610 return ret;
6613 /* ?_Ffmt@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@ABAPADPADDH@Z */
6614 /* ?_Ffmt@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@AEBAPEADPEADDH@Z */
6615 /* ?_Ffmt@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@ABAPADPADDH@Z */
6616 /* ?_Ffmt@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@AEBAPEADPEADDH@Z */
6617 char* __cdecl num_put_wchar__Ffmt(const num_put *this, char *fmt, char spec, int fmtfl)
6619 int type = fmtfl & FMTFLAG_floatfield;
6620 char *p = fmt;
6622 TRACE("(%p %p %d %d)\n", this, fmt, spec, fmtfl);
6624 *p++ = '%';
6625 if(fmtfl & FMTFLAG_showpos)
6626 *p++ = '+';
6627 if(fmtfl & FMTFLAG_showbase)
6628 *p++ = '#';
6629 *p++ = '.';
6630 *p++ = '*';
6631 if(spec)
6632 *p++ = spec;
6634 if(type == FMTFLAG_fixed)
6635 *p++ = 'f';
6636 else if(type == FMTFLAG_scientific)
6637 *p++ = (fmtfl & FMTFLAG_uppercase) ? 'E' : 'e';
6638 else if(type == (FMTFLAG_fixed|FMTFLAG_scientific))
6639 *p++ = (fmtfl & FMTFLAG_uppercase) ? 'A' : 'a';
6640 else
6641 *p++ = (fmtfl & FMTFLAG_uppercase) ? 'G' : 'g';
6643 *p++ = '\0';
6644 return fmt;
6647 /* TODO: This function should be removed when num_put_wchar__Fput is implemented */
6648 static ostreambuf_iterator_wchar* num_put__fput(const num_put *this, ostreambuf_iterator_wchar *ret,
6649 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, char *buf,
6650 MSVCP_size_t count, numpunct_wchar *numpunct)
6652 char *p, dec_point = *localeconv()->decimal_point;
6653 int adjustfield = base->fmtfl & FMTFLAG_adjustfield;
6654 MSVCP_size_t i, pad;
6656 TRACE("(%p %p %p %d %s %ld)\n", this, ret, base, fill, buf, count);
6658 for(p=buf; p<buf+count; p++) {
6659 if(*p == dec_point)
6660 break;
6662 p--;
6664 /* Display number with padding */
6665 if(count >= base->wide)
6666 pad = 0;
6667 else
6668 pad = base->wide-count;
6669 base->wide = 0;
6671 if((adjustfield & FMTFLAG_internal) && (buf[0]=='-' || buf[0]=='+')) {
6672 num_put_wchar__Putc(this, &dest, dest, buf, 1);
6673 buf++;
6675 if(adjustfield != FMTFLAG_left) {
6676 num_put_wchar__Rep(this, ret, dest, fill, pad);
6677 pad = 0;
6680 for(i=0; i<count; i++) {
6681 if(buf[i] == dec_point)
6682 num_put_wchar__Rep(this, &dest, dest, numpunct_wchar_decimal_point(numpunct), 1);
6683 else
6684 num_put_wchar__Putc(this, &dest, dest, buf+i, 1);
6687 return num_put_wchar__Rep(this, ret, dest, fill, pad);
6690 /* ?_Ifmt@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@ABAPADPADPBDH@Z */
6691 /* ?_Ifmt@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@AEBAPEADPEADPEBDH@Z */
6692 /* ?_Ifmt@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@ABAPADPADPBDH@Z */
6693 /* ?_Ifmt@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@AEBAPEADPEADPEBDH@Z */
6694 char* __cdecl num_put_wchar__Ifmt(const num_put *this, char *fmt, const char *spec, int fmtfl)
6696 int base = fmtfl & FMTFLAG_basefield;
6697 char *p = fmt;
6699 TRACE("(%p %p %p %d)\n", this, fmt, spec, fmtfl);
6701 *p++ = '%';
6702 if(fmtfl & FMTFLAG_showpos)
6703 *p++ = '+';
6704 if(fmtfl & FMTFLAG_showbase)
6705 *p++ = '#';
6707 *p++ = *spec++;
6708 if(*spec == 'l')
6709 *p++ = *spec++;
6711 if(base == FMTFLAG_oct)
6712 *p++ = 'o';
6713 else if(base == FMTFLAG_hex)
6714 *p++ = (fmtfl & FMTFLAG_uppercase) ? 'X' : 'x';
6715 else
6716 *p++ = *spec;
6718 *p++ = '\0';
6719 return fmt;
6722 static ostreambuf_iterator_wchar* num_put__Iput(const num_put *this, ostreambuf_iterator_wchar *ret,
6723 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, char *buf,
6724 MSVCP_size_t count, numpunct_wchar *numpunct)
6726 basic_string_char grouping_bstr;
6727 const char *grouping;
6728 char *p;
6729 wchar_t sep;
6730 int cur_group = 0, group_size = 0;
6731 int adjustfield = base->fmtfl & FMTFLAG_adjustfield;
6732 MSVCP_size_t i, pad;
6734 TRACE("(%p %p %p %d %s %ld)\n", this, ret, base, fill, buf, count);
6736 /* Add separators to number */
6737 numpunct_wchar_grouping(numpunct, &grouping_bstr);
6738 grouping = MSVCP_basic_string_char_c_str(&grouping_bstr);
6739 sep = grouping[0] ? numpunct_wchar_thousands_sep(numpunct) : '\0';
6741 for(p=buf+count-1; p>buf && sep && grouping[cur_group]!=CHAR_MAX; p--) {
6742 group_size++;
6743 if(group_size == grouping[cur_group]) {
6744 group_size = 0;
6745 if(grouping[cur_group+1])
6746 cur_group++;
6748 memmove(p+1, p, buf+count-p);
6749 *p = '\0'; /* mark thousands separator positions */
6750 count++;
6753 MSVCP_basic_string_char_dtor(&grouping_bstr);
6755 /* Display number with padding */
6756 if(count >= base->wide)
6757 pad = 0;
6758 else
6759 pad = base->wide-count;
6760 base->wide = 0;
6762 if((adjustfield & FMTFLAG_internal) && (buf[0]=='-' || buf[0]=='+')) {
6763 num_put_wchar__Putc(this, &dest, dest, buf, 1);
6764 buf++;
6765 }else if((adjustfield & FMTFLAG_internal) && (buf[1]=='x' || buf[1]=='X')) {
6766 num_put_wchar__Putc(this, &dest, dest, buf, 2);
6767 buf += 2;
6769 if(adjustfield != FMTFLAG_left) {
6770 num_put_wchar__Rep(this, ret, dest, fill, pad);
6771 pad = 0;
6774 for(i=0; i<count; i++) {
6775 if(!buf[i])
6776 num_put_wchar__Rep(this, &dest, dest, sep, 1);
6777 else
6778 num_put_wchar__Putc(this, &dest, dest, buf+i, 1);
6781 return num_put_wchar__Rep(this, ret, dest, fill, pad);
6784 /* ?_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 */
6785 /* ?_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 */
6786 ostreambuf_iterator_wchar* __cdecl num_put_wchar__Iput(const num_put *this, ostreambuf_iterator_wchar *ret,
6787 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, char *buf, MSVCP_size_t count)
6789 return num_put__Iput(this, ret, dest, base, fill, buf, count, numpunct_wchar_use_facet(&base->loc));
6792 /* ?_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 */
6793 /* ?_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 */
6794 ostreambuf_iterator_wchar* __cdecl num_put_short__Iput(const num_put *this, ostreambuf_iterator_wchar *ret,
6795 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, char *buf, MSVCP_size_t count)
6797 return num_put__Iput(this, ret, dest, base, fill, buf, count, numpunct_short_use_facet(&base->loc));
6800 /* ?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 */
6801 /* ?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 */
6802 #define call_num_put_wchar_do_put_long(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 28, ostreambuf_iterator_wchar*, \
6803 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, LONG), \
6804 (this, ret, dest, base, fill, v))
6805 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_long, 28)
6806 ostreambuf_iterator_wchar* __thiscall num_put_wchar_do_put_long(const num_put *this, ostreambuf_iterator_wchar *ret,
6807 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, LONG v)
6809 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
6810 char fmt[7]; /* strlen("%+#lld")+1 */
6812 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
6814 return num_put_wchar__Iput(this, ret, dest, base, fill, tmp,
6815 sprintf(tmp, num_put_wchar__Ifmt(this, fmt, "ld", base->fmtfl), v));
6818 /* ?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 */
6819 /* ?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 */
6820 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_long, 28)
6821 ostreambuf_iterator_wchar* __thiscall num_put_short_do_put_long(const num_put *this, ostreambuf_iterator_wchar *ret,
6822 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, LONG v)
6824 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
6825 char fmt[7]; /* strlen("%+#lld")+1 */
6827 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
6829 return num_put_short__Iput(this, ret, dest, base, fill, tmp,
6830 sprintf(tmp, num_put_wchar__Ifmt(this, fmt, "ld", base->fmtfl), v));
6833 /* ?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 */
6834 /* ?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 */
6835 /* ?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 */
6836 /* ?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 */
6837 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_long, 28)
6838 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_long(const num_put *this, ostreambuf_iterator_wchar *ret,
6839 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, LONG v)
6841 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
6842 return call_num_put_wchar_do_put_long(this, ret, dest, base, fill, v);
6845 /* ?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 */
6846 /* ?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 */
6847 #define call_num_put_wchar_do_put_ulong(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 24, ostreambuf_iterator_wchar*, \
6848 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, ULONG), \
6849 (this, ret, dest, base, fill, v))
6850 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_ulong, 28)
6851 ostreambuf_iterator_wchar* __thiscall num_put_wchar_do_put_ulong(const num_put *this, ostreambuf_iterator_wchar *ret,
6852 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, ULONG v)
6854 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
6855 char fmt[7]; /* strlen("%+#lld")+1 */
6857 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
6859 return num_put_wchar__Iput(this, ret, dest, base, fill, tmp,
6860 sprintf(tmp, num_put_wchar__Ifmt(this, fmt, "lu", base->fmtfl), v));
6863 /* ?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 */
6864 /* ?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 */
6865 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_ulong, 28)
6866 ostreambuf_iterator_wchar* __thiscall num_put_short_do_put_ulong(const num_put *this, ostreambuf_iterator_wchar *ret,
6867 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, ULONG v)
6869 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
6870 char fmt[7]; /* strlen("%+#lld")+1 */
6872 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
6874 return num_put_short__Iput(this, ret, dest, base, fill, tmp,
6875 sprintf(tmp, num_put_wchar__Ifmt(this, fmt, "lu", base->fmtfl), v));
6878 /* ?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 */
6879 /* ?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 */
6880 /* ?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 */
6881 /* ?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 */
6882 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_ulong, 28)
6883 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_ulong(const num_put *this, ostreambuf_iterator_wchar *ret,
6884 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, ULONG v)
6886 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
6887 return call_num_put_wchar_do_put_ulong(this, ret, dest, base, fill, v);
6890 /* ?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 */
6891 /* ?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 */
6892 /* ?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 */
6893 /* ?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 */
6894 #define call_num_put_wchar_do_put_double(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 12, ostreambuf_iterator_wchar*, \
6895 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, double), \
6896 (this, ret, dest, base, fill, v))
6897 #define call_num_put_wchar_do_put_ldouble(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 8, ostreambuf_iterator_wchar*, \
6898 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, double), \
6899 (this, ret, dest, base, fill, v))
6900 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_double, 32)
6901 ostreambuf_iterator_wchar* __thiscall num_put_wchar_do_put_double(const num_put *this, ostreambuf_iterator_wchar *ret,
6902 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, double v)
6904 char *tmp;
6905 char fmt[8]; /* strlen("%+#.*lg")+1 */
6906 int size;
6907 unsigned prec;
6909 TRACE("(%p %p %p %d %lf)\n", this, ret, base, fill, v);
6911 num_put_wchar__Ffmt(this, fmt, '\0', base->fmtfl);
6912 prec = get_precision(base);
6913 size = _scprintf(fmt, prec, v);
6915 /* TODO: don't use dynamic allocation */
6916 tmp = MSVCRT_operator_new(size*2);
6917 if(!tmp) {
6918 ERR("Out of memory\n");
6919 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
6921 num_put__fput(this, ret, dest, base, fill, tmp, sprintf(tmp, fmt, base->prec, v),
6922 numpunct_wchar_use_facet(&base->loc));
6923 MSVCRT_operator_delete(tmp);
6924 return ret;
6927 /* ?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 */
6928 /* ?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 */
6929 /* ?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 */
6930 /* ?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 */
6931 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_double, 32)
6932 ostreambuf_iterator_wchar* __thiscall num_put_short_do_put_double(const num_put *this, ostreambuf_iterator_wchar *ret,
6933 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, double v)
6935 char *tmp;
6936 char fmt[8]; /* strlen("%+#.*lg")+1 */
6937 int size;
6938 unsigned prec;
6940 TRACE("(%p %p %p %d %lf)\n", this, ret, base, fill, v);
6942 num_put_wchar__Ffmt(this, fmt, '\0', base->fmtfl);
6943 prec = get_precision(base);
6944 size = _scprintf(fmt, prec, v);
6946 /* TODO: don't use dynamic allocation */
6947 tmp = MSVCRT_operator_new(size*2);
6948 if(!tmp) {
6949 ERR("Out of memory\n");
6950 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
6952 num_put__fput(this, ret, dest, base, fill, tmp, sprintf(tmp, fmt, prec, v),
6953 numpunct_short_use_facet(&base->loc));
6954 MSVCRT_operator_delete(tmp);
6955 return ret;
6958 /* ?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 */
6959 /* ?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 */
6960 /* ?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 */
6961 /* ?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 */
6962 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_double, 32)
6963 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_double(const num_put *this, ostreambuf_iterator_wchar *ret,
6964 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, double v)
6966 TRACE("(%p %p %p %d %lf)\n", this, ret, base, fill, v);
6967 return call_num_put_wchar_do_put_double(this, ret, dest, base, fill, v);
6970 /* ?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 */
6971 /* ?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 */
6972 /* ?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 */
6973 /* ?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 */
6974 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_ldouble, 32)
6975 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_ldouble(const num_put *this, ostreambuf_iterator_wchar *ret,
6976 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, double v)
6978 TRACE("(%p %p %p %d %lf)\n", this, ret, base, fill, v);
6979 return call_num_put_wchar_do_put_ldouble(this, ret, dest, base, fill, v);
6982 /* ?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 */
6983 /* ?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 */
6984 #define call_num_put_wchar_do_put_ptr(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 4, ostreambuf_iterator_wchar*, \
6985 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, const void*), \
6986 (this, ret, dest, base, fill, v))
6987 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_ptr, 28)
6988 ostreambuf_iterator_wchar* __thiscall num_put_wchar_do_put_ptr(const num_put *this, ostreambuf_iterator_wchar *ret,
6989 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, const void *v)
6991 char tmp[17]; /* 8(16^8==2^64)*2(separators beetwen every digit) + 1 */
6993 TRACE("(%p %p %p %d %p)\n", this, ret, base, fill, v);
6995 return num_put_wchar__Iput(this, ret, dest, base, fill, tmp, sprintf(tmp, "%p", v));
6998 /* ?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 */
6999 /* ?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 */
7000 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_ptr, 28)
7001 ostreambuf_iterator_wchar* __thiscall num_put_short_do_put_ptr(const num_put *this, ostreambuf_iterator_wchar *ret,
7002 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, const void *v)
7004 char tmp[17]; /* 8(16^8==2^64)*2(separators beetwen every digit) + 1 */
7006 TRACE("(%p %p %p %d %p)\n", this, ret, base, fill, v);
7008 return num_put_short__Iput(this, ret, dest, base, fill, tmp, sprintf(tmp, "%p", v));
7011 /* ?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 */
7012 /* ?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 */
7013 /* ?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 */
7014 /* ?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 */
7015 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_ptr, 28)
7016 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_ptr(const num_put *this, ostreambuf_iterator_wchar *ret,
7017 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, const void *v)
7019 TRACE("(%p %p %p %d %p)\n", this, ret, base, fill, v);
7020 return call_num_put_wchar_do_put_ptr(this, ret, dest, base, fill, v);
7023 /* ?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 */
7024 /* ?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 */
7025 #define call_num_put_wchar_do_put_int64(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 20, ostreambuf_iterator_wchar*, \
7026 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, __int64), \
7027 (this, ret, dest, base, fill, v))
7028 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_int64, 32)
7029 ostreambuf_iterator_wchar* __thiscall num_put_wchar_do_put_int64(const num_put *this, ostreambuf_iterator_wchar *ret,
7030 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, __int64 v)
7032 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
7033 char fmt[7]; /* strlen("%+#lld")+1 */
7035 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
7037 return num_put_wchar__Iput(this, ret, dest, base, fill, tmp,
7038 sprintf(tmp, num_put_wchar__Ifmt(this, fmt, "lld", base->fmtfl), v));
7041 /* ?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 */
7042 /* ?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 */
7043 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_int64, 32)
7044 ostreambuf_iterator_wchar* __thiscall num_put_short_do_put_int64(const num_put *this, ostreambuf_iterator_wchar *ret,
7045 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, __int64 v)
7047 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
7048 char fmt[7]; /* strlen("%+#lld")+1 */
7050 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
7052 return num_put_short__Iput(this, ret, dest, base, fill, tmp,
7053 sprintf(tmp, num_put_wchar__Ifmt(this, fmt, "lld", base->fmtfl), v));
7056 /* ?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 */
7057 /* ?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 */
7058 /* ?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 */
7059 /* ?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 */
7060 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_int64, 32)
7061 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_int64(const num_put *this, ostreambuf_iterator_wchar *ret,
7062 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, __int64 v)
7064 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
7065 return call_num_put_wchar_do_put_int64(this, ret, dest, base, fill, v);
7068 /* ?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 */
7069 /* ?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 */
7070 #define call_num_put_wchar_do_put_uint64(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 16, ostreambuf_iterator_wchar*, \
7071 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, unsigned __int64), \
7072 (this, ret, dest, base, fill, v))
7073 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_uint64, 32)
7074 ostreambuf_iterator_wchar* __thiscall num_put_wchar_do_put_uint64(const num_put *this, ostreambuf_iterator_wchar *ret,
7075 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, unsigned __int64 v)
7077 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
7078 char fmt[7]; /* strlen("%+#lld")+1 */
7080 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
7082 return num_put_wchar__Iput(this, ret, dest, base, fill, tmp,
7083 sprintf(tmp, num_put_wchar__Ifmt(this, fmt, "llu", base->fmtfl), v));
7086 /* ?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 */
7087 /* ?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 */
7088 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_uint64, 32)
7089 ostreambuf_iterator_wchar* __thiscall num_put_short_do_put_uint64(const num_put *this, ostreambuf_iterator_wchar *ret,
7090 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, unsigned __int64 v)
7092 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
7093 char fmt[7]; /* strlen("%+#lld")+1 */
7095 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
7097 return num_put_short__Iput(this, ret, dest, base, fill, tmp,
7098 sprintf(tmp, num_put_wchar__Ifmt(this, fmt, "llu", base->fmtfl), v));
7101 /* ?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 */
7102 /* ?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 */
7103 /* ?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 */
7104 /* ?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 */
7105 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_uint64, 32)
7106 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_uint64(const num_put *this, ostreambuf_iterator_wchar *ret,
7107 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, unsigned __int64 v)
7109 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
7110 return call_num_put_wchar_do_put_uint64(this, ret, dest, base, fill, v);
7113 /* ?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 */
7114 /* ?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 */
7115 #define call_num_put_wchar_do_put_bool(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 32, ostreambuf_iterator_wchar*, \
7116 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, MSVCP_bool), \
7117 (this, ret, dest, base, fill, v))
7118 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_bool, 28)
7119 ostreambuf_iterator_wchar* __thiscall num_put_wchar_do_put_bool(const num_put *this, ostreambuf_iterator_wchar *ret,
7120 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, MSVCP_bool v)
7122 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
7124 if(base->fmtfl & FMTFLAG_boolalpha) {
7125 numpunct_wchar *numpunct = numpunct_wchar_use_facet(&base->loc);
7126 basic_string_wchar str;
7127 MSVCP_size_t pad, len;
7129 if(v)
7130 numpunct_wchar_truename(numpunct, &str);
7131 else
7132 numpunct_wchar_falsename(numpunct, &str);
7134 len = MSVCP_basic_string_wchar_length(&str);
7135 pad = (len>base->wide ? 0 : base->wide-len);
7136 base->wide = 0;
7138 if((base->fmtfl & FMTFLAG_adjustfield) != FMTFLAG_left) {
7139 num_put_wchar__Rep(this, &dest, dest, fill, pad);
7140 pad = 0;
7142 num_put_wchar__Put(this, &dest, dest, MSVCP_basic_string_wchar_c_str(&str), len);
7143 MSVCP_basic_string_wchar_dtor(&str);
7144 return num_put_wchar__Rep(this, ret, dest, fill, pad);
7147 return num_put_wchar_put_long(this, ret, dest, base, fill, v);
7150 /* ?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 */
7151 /* ?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 */
7152 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_bool, 28)
7153 ostreambuf_iterator_wchar* __thiscall num_put_short_do_put_bool(const num_put *this, ostreambuf_iterator_wchar *ret,
7154 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, MSVCP_bool v)
7156 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
7158 if(base->fmtfl & FMTFLAG_boolalpha) {
7159 numpunct_wchar *numpunct = numpunct_short_use_facet(&base->loc);
7160 basic_string_wchar str;
7161 MSVCP_size_t pad, len;
7163 if(v)
7164 numpunct_wchar_truename(numpunct, &str);
7165 else
7166 numpunct_wchar_falsename(numpunct, &str);
7168 len = MSVCP_basic_string_wchar_length(&str);
7169 pad = (len>base->wide ? 0 : base->wide-len);
7170 base->wide = 0;
7172 if((base->fmtfl & FMTFLAG_adjustfield) != FMTFLAG_left) {
7173 num_put_wchar__Rep(this, &dest, dest, fill, pad);
7174 pad = 0;
7176 num_put_wchar__Put(this, &dest, dest, MSVCP_basic_string_wchar_c_str(&str), len);
7177 MSVCP_basic_string_wchar_dtor(&str);
7178 return num_put_wchar__Rep(this, ret, dest, fill, pad);
7181 return num_put_wchar_put_long(this, ret, dest, base, fill, v);
7184 /* ?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 */
7185 /* ?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 */
7186 /* ?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 */
7187 /* ?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 */
7188 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_bool, 28)
7189 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_bool(const num_put *this, ostreambuf_iterator_wchar *ret,
7190 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, MSVCP_bool v)
7192 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
7193 return call_num_put_wchar_do_put_bool(this, ret, dest, base, fill, v);
7196 /* ?id@?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@2V0locale@2@A */
7197 locale_id time_put_char_id = {0};
7199 /* ??_7?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@6B@ */
7200 extern const vtable_ptr MSVCP_time_put_char_vtable;
7202 /* ?_Init@?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@IAEXABV_Locinfo@2@@Z */
7203 /* ?_Init@?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@IEAAXAEBV_Locinfo@2@@Z */
7204 DEFINE_THISCALL_WRAPPER(time_put_char__Init, 8)
7205 void __thiscall time_put_char__Init(time_put *this, const _Locinfo *locinfo)
7207 TRACE("(%p %p)\n", this, locinfo);
7208 _Locinfo__Gettnames(locinfo, &this->time);
7209 _Locinfo__Getcvt(locinfo, &this->cvt);
7212 /* ??0?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
7213 /* ??0?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
7214 DEFINE_THISCALL_WRAPPER(time_put_char_ctor_locinfo, 12)
7215 time_put* __thiscall time_put_char_ctor_locinfo(time_put *this, const _Locinfo *locinfo, MSVCP_size_t refs)
7217 TRACE("(%p %p %lu)\n", this, locinfo, refs);
7218 locale_facet_ctor_refs(&this->facet, refs);
7219 this->facet.vtable = &MSVCP_time_put_char_vtable;
7220 time_put_char__Init(this, locinfo);
7221 return this;
7224 /* ??0?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAE@I@Z */
7225 /* ??0?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAA@_K@Z */
7226 DEFINE_THISCALL_WRAPPER(time_put_char_ctor_refs, 8)
7227 time_put* __thiscall time_put_char_ctor_refs(time_put *this, MSVCP_size_t refs)
7229 _Locinfo locinfo;
7231 TRACE("(%p %lu)\n", this, refs);
7233 _Locinfo_ctor(&locinfo);
7234 time_put_char_ctor_locinfo(this, &locinfo, refs);
7235 _Locinfo_dtor(&locinfo);
7236 return this;
7239 /* ??_F?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAEXXZ */
7240 /* ??_F?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAAXXZ */
7241 DEFINE_THISCALL_WRAPPER(time_put_char_ctor, 4)
7242 time_put* __thiscall time_put_char_ctor(time_put *this)
7244 return time_put_char_ctor_refs(this, 0);
7247 /* ??1?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MAE@XZ */
7248 /* ??1?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MEAA@XZ */
7249 DEFINE_THISCALL_WRAPPER(time_put_char_dtor, 4)
7250 void __thiscall time_put_char_dtor(time_put *this)
7252 TRACE("(%p)\n", this);
7253 _Timevec_dtor(&this->time);
7256 DEFINE_THISCALL_WRAPPER(time_put_char_vector_dtor, 8)
7257 time_put* __thiscall time_put_char_vector_dtor(time_put *this, unsigned int flags)
7259 TRACE("(%p %x)\n", this, flags);
7260 if(flags & 2) {
7261 /* we have an array, with the number of elements stored before the first object */
7262 INT_PTR i, *ptr = (INT_PTR *)this-1;
7264 for(i=*ptr-1; i>=0; i--)
7265 time_put_char_dtor(this+i);
7266 MSVCRT_operator_delete(ptr);
7267 } else {
7268 time_put_char_dtor(this);
7269 if(flags & 1)
7270 MSVCRT_operator_delete(this);
7273 return this;
7276 /* ?_Getcat@?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
7277 /* ?_Getcat@?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
7278 MSVCP_size_t __cdecl time_put_char__Getcat(const locale_facet **facet, const locale *loc)
7280 TRACE("(%p %p)\n", facet, loc);
7282 if(facet && !*facet) {
7283 _Locinfo locinfo;
7285 *facet = MSVCRT_operator_new(sizeof(time_put));
7286 if(!*facet) {
7287 ERR("Out of memory\n");
7288 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7289 return 0;
7292 _Locinfo_ctor_cstr(&locinfo, locale_string_char_c_str(&loc->ptr->name));
7293 time_put_char_ctor_locinfo((time_put*)*facet, &locinfo, 0);
7294 _Locinfo_dtor(&locinfo);
7297 return LC_TIME;
7300 static time_put* time_put_char_use_facet(const locale *loc)
7302 static time_put *obj = NULL;
7304 _Lockit lock;
7305 const locale_facet *fac;
7307 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
7308 fac = locale__Getfacet(loc, locale_id_operator_size_t(&time_put_char_id), TRUE);
7309 if(fac) {
7310 _Lockit_dtor(&lock);
7311 return (time_put*)fac;
7314 if(obj) {
7315 _Lockit_dtor(&lock);
7316 return obj;
7319 time_put_char__Getcat(&fac, loc);
7320 obj = (time_put*)fac;
7321 locale_facet__Incref(&obj->facet);
7322 locale_facet_register(&obj->facet);
7323 _Lockit_dtor(&lock);
7325 return obj;
7328 /* ?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 */
7329 /* ?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 */
7330 DEFINE_THISCALL_WRAPPER(time_put_char_do_put, 32)
7331 #define call_time_put_char_do_put(this, ret, dest, base, t, spec, mod) CALL_VTBL_FUNC(this, 4, ostreambuf_iterator_char*, \
7332 (const time_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, const struct tm*, char, char), \
7333 (this, ret, dest, base, t, spec, mod))
7334 ostreambuf_iterator_char* __thiscall time_put_char_do_put(const time_put *this, ostreambuf_iterator_char *ret,
7335 ostreambuf_iterator_char dest, ios_base *base, const struct tm *t, char spec, char mod)
7337 char buf[64], fmt[4], *p = fmt;
7338 MSVCP_size_t i, len;
7340 TRACE("(%p %p %p %p %c %c)\n", this, ret, base, t, spec, mod);
7342 *p++ = '%';
7343 if(mod)
7344 *p++ = mod;
7345 *p++ = spec;
7346 *p++ = 0;
7348 len = _Strftime(buf, sizeof(buf), fmt, t, this->time.timeptr);
7349 for(i=0; i<len; i++)
7350 ostreambuf_iterator_char_put(&dest, buf[i]);
7352 *ret = dest;
7353 return ret;
7356 /* ?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 */
7357 /* ?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 */
7358 DEFINE_THISCALL_WRAPPER(time_put_char_put, 32)
7359 ostreambuf_iterator_char* __thiscall time_put_char_put(const time_put *this, ostreambuf_iterator_char *ret,
7360 ostreambuf_iterator_char dest, ios_base *base, const struct tm *t, char spec, char mod)
7362 TRACE("(%p %p %p %p %c %c)\n", this, ret, base, t, spec, mod);
7363 return call_time_put_char_do_put(this, ret, dest, base, t, spec, mod);
7366 /* ?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 */
7367 /* ?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 */
7368 DEFINE_THISCALL_WRAPPER(time_put_char_put_format, 32)
7369 ostreambuf_iterator_char* __thiscall time_put_char_put_format(const time_put *this, ostreambuf_iterator_char *ret,
7370 ostreambuf_iterator_char dest, ios_base *base, const struct tm *t, const char *pat, const char *pat_end)
7372 TRACE("(%p %p %p %p %s)\n", this, ret, base, t, debugstr_an(pat, pat_end-pat));
7374 while(pat < pat_end) {
7375 if(*pat != '%') {
7376 ostreambuf_iterator_char_put(&dest, *pat++);
7377 }else if(++pat == pat_end) {
7378 ostreambuf_iterator_char_put(&dest, '%');
7379 }else if(*pat=='#' && pat+1==pat_end) {
7380 ostreambuf_iterator_char_put(&dest, '%');
7381 ostreambuf_iterator_char_put(&dest, *pat++);
7382 }else {
7383 char mod;
7385 if(*pat == '#') {
7386 mod = '#';
7387 pat++;
7388 }else {
7389 mod = 0;
7392 time_put_char_put(this, &dest, dest, base, t, *pat++, mod);
7396 *ret = dest;
7397 return ret;
7400 /* ?id@?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@2V0locale@2@A */
7401 locale_id time_put_wchar_id = {0};
7402 /* ?id@?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@2V0locale@2@A */
7403 locale_id time_put_short_id = {0};
7405 /* ??_7?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@6B@ */
7406 extern const vtable_ptr MSVCP_time_put_wchar_vtable;
7407 /* ??_7?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@6B@ */
7408 extern const vtable_ptr MSVCP_time_put_short_vtable;
7410 /* ?_Init@?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@IAEXABV_Locinfo@2@@Z */
7411 /* ?_Init@?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@IEAAXAEBV_Locinfo@2@@Z */
7412 /* ?_Init@?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@IAEXABV_Locinfo@2@@Z */
7413 /* ?_Init@?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@IEAAXAEBV_Locinfo@2@@Z */
7414 DEFINE_THISCALL_WRAPPER(time_put_wchar__Init, 8)
7415 void __thiscall time_put_wchar__Init(time_put *this, const _Locinfo *locinfo)
7417 TRACE("(%p %p)\n", this, locinfo);
7418 _Locinfo__Gettnames(locinfo, &this->time);
7419 _Locinfo__Getcvt(locinfo, &this->cvt);
7422 /* ??0?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
7423 /* ??0?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
7424 DEFINE_THISCALL_WRAPPER(time_put_wchar_ctor_locinfo, 12)
7425 time_put* __thiscall time_put_wchar_ctor_locinfo(time_put *this, const _Locinfo *locinfo, MSVCP_size_t refs)
7427 TRACE("(%p %p %lu)\n", this, locinfo, refs);
7428 locale_facet_ctor_refs(&this->facet, refs);
7429 this->facet.vtable = &MSVCP_time_put_wchar_vtable;
7430 time_put_wchar__Init(this, locinfo);
7431 return this;
7434 /* ??0?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
7435 /* ??0?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
7436 DEFINE_THISCALL_WRAPPER(time_put_short_ctor_locinfo, 12)
7437 time_put* __thiscall time_put_short_ctor_locinfo(time_put *this, const _Locinfo *locinfo, MSVCP_size_t refs)
7439 time_put_wchar_ctor_locinfo(this, locinfo, refs);
7440 this->facet.vtable = &MSVCP_time_put_short_vtable;
7441 return this;
7444 /* ??0?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@IAE@PBDI@Z */
7445 /* ??0?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@IEAA@PEBD_K@Z */
7446 DEFINE_THISCALL_WRAPPER(time_put_wchar_ctor_name, 12)
7447 time_put* __thiscall time_put_wchar_ctor_name(time_put *this, const char *name, MSVCP_size_t refs)
7449 _Locinfo locinfo;
7451 TRACE("(%p %s %lu)\n", this, debugstr_a(name), refs);
7453 _Locinfo_ctor_cstr(&locinfo, name);
7454 time_put_wchar_ctor_locinfo(this, &locinfo, refs);
7455 _Locinfo_dtor(&locinfo);
7456 return this;
7459 /* ??0?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@IAE@PBDI@Z */
7460 /* ??0?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@IEAA@PEBD_K@Z */
7461 DEFINE_THISCALL_WRAPPER(time_put_short_ctor_name, 12)
7462 time_put* __thiscall time_put_short_ctor_name(time_put *this, const char *name, MSVCP_size_t refs)
7464 time_put_wchar_ctor_name(this, name, refs);
7465 this->facet.vtable = &MSVCP_time_put_short_vtable;
7466 return this;
7469 /* ??0?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAE@I@Z */
7470 /* ??0?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAA@_K@Z */
7471 DEFINE_THISCALL_WRAPPER(time_put_wchar_ctor_refs, 8)
7472 time_put* __thiscall time_put_wchar_ctor_refs(time_put *this, MSVCP_size_t refs)
7474 _Locinfo locinfo;
7476 TRACE("(%p %lu)\n", this, refs);
7478 _Locinfo_ctor(&locinfo);
7479 time_put_wchar_ctor_locinfo(this, &locinfo, refs);
7480 _Locinfo_dtor(&locinfo);
7481 return this;
7484 /* ??0?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAE@I@Z */
7485 /* ??0?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEAA@_K@Z */
7486 DEFINE_THISCALL_WRAPPER(time_put_short_ctor_refs, 8)
7487 time_put* __thiscall time_put_short_ctor_refs(time_put *this, MSVCP_size_t refs)
7489 time_put_wchar_ctor_refs(this, refs);
7490 this->facet.vtable = &MSVCP_time_put_short_vtable;
7491 return this;
7494 /* ??_F?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAEXXZ */
7495 /* ??_F?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAAXXZ */
7496 DEFINE_THISCALL_WRAPPER(time_put_wchar_ctor, 4)
7497 time_put* __thiscall time_put_wchar_ctor(time_put *this)
7499 return time_put_wchar_ctor_refs(this, 0);
7502 /* ??_F?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAEXXZ */
7503 /* ??_F?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEAAXXZ */
7504 DEFINE_THISCALL_WRAPPER(time_put_short_ctor, 4)
7505 time_put* __thiscall time_put_short_ctor(time_put *this)
7507 time_put_wchar_ctor(this);
7508 this->facet.vtable = &MSVCP_time_put_short_vtable;
7509 return this;
7512 /* ??1?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MAE@XZ */
7513 /* ??1?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MEAA@XZ */
7514 /* ??1?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MAE@XZ */
7515 /* ??1?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MEAA@XZ */
7516 DEFINE_THISCALL_WRAPPER(time_put_wchar_dtor, 4)
7517 void __thiscall time_put_wchar_dtor(time_put *this)
7519 TRACE("(%p)\n", this);
7520 _Timevec_dtor(&this->time);
7523 DEFINE_THISCALL_WRAPPER(time_put_wchar_vector_dtor, 8)
7524 time_put* __thiscall time_put_wchar_vector_dtor(time_put *this, unsigned int flags)
7526 TRACE("(%p %x)\n", this, flags);
7527 if(flags & 2) {
7528 /* we have an array, with the number of elements stored before the first object */
7529 INT_PTR i, *ptr = (INT_PTR *)this-1;
7531 for(i=*ptr-1; i>=0; i--)
7532 time_put_wchar_dtor(this+i);
7533 MSVCRT_operator_delete(ptr);
7534 } else {
7535 time_put_wchar_dtor(this);
7536 if(flags & 1)
7537 MSVCRT_operator_delete(this);
7540 return this;
7543 /* ?_Getcat@?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
7544 /* ?_Getcat@?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
7545 MSVCP_size_t __cdecl time_put_wchar__Getcat(const locale_facet **facet, const locale *loc)
7547 TRACE("(%p %p)\n", facet, loc);
7549 if(facet && !*facet) {
7550 *facet = MSVCRT_operator_new(sizeof(time_put));
7551 if(!*facet) {
7552 ERR("Out of memory\n");
7553 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7554 return 0;
7556 time_put_wchar_ctor_name((time_put*)*facet,
7557 locale_string_char_c_str(&loc->ptr->name), 0);
7560 return LC_TIME;
7563 static time_put* time_put_wchar_use_facet(const locale *loc)
7565 static time_put *obj = NULL;
7567 _Lockit lock;
7568 const locale_facet *fac;
7570 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
7571 fac = locale__Getfacet(loc, locale_id_operator_size_t(&time_put_wchar_id), TRUE);
7572 if(fac) {
7573 _Lockit_dtor(&lock);
7574 return (time_put*)fac;
7577 if(obj) {
7578 _Lockit_dtor(&lock);
7579 return obj;
7582 time_put_wchar__Getcat(&fac, loc);
7583 obj = (time_put*)fac;
7584 locale_facet__Incref(&obj->facet);
7585 locale_facet_register(&obj->facet);
7586 _Lockit_dtor(&lock);
7588 return obj;
7591 /* ?_Getcat@?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
7592 /* ?_Getcat@?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
7593 MSVCP_size_t __cdecl time_put_short__Getcat(const locale_facet **facet, const locale *loc)
7595 TRACE("(%p %p)\n", facet, loc);
7597 if(facet && !*facet) {
7598 *facet = MSVCRT_operator_new(sizeof(time_put));
7599 if(!*facet) {
7600 ERR("Out of memory\n");
7601 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7602 return 0;
7604 time_put_short_ctor_name((time_put*)*facet,
7605 locale_string_char_c_str(&loc->ptr->name), 0);
7608 return LC_TIME;
7611 static time_put* time_put_short_use_facet(const locale *loc)
7613 static time_put *obj = NULL;
7615 _Lockit lock;
7616 const locale_facet *fac;
7618 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
7619 fac = locale__Getfacet(loc, locale_id_operator_size_t(&time_put_short_id), TRUE);
7620 if(fac) {
7621 _Lockit_dtor(&lock);
7622 return (time_put*)fac;
7625 if(obj) {
7626 _Lockit_dtor(&lock);
7627 return obj;
7630 time_put_short__Getcat(&fac, loc);
7631 obj = (time_put*)fac;
7632 locale_facet__Incref(&obj->facet);
7633 locale_facet_register(&obj->facet);
7634 _Lockit_dtor(&lock);
7636 return obj;
7639 /* ?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 */
7640 /* ?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 */
7641 /* ?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 */
7642 /* ?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 */
7643 DEFINE_THISCALL_WRAPPER(time_put_wchar_do_put, 32)
7644 #define call_time_put_wchar_do_put(this, ret, dest, base, t, spec, mod) CALL_VTBL_FUNC(this, 4, ostreambuf_iterator_wchar*, \
7645 (const time_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, const struct tm*, char, char), \
7646 (this, ret, dest, base, t, spec, mod))
7647 ostreambuf_iterator_wchar* __thiscall time_put_wchar_do_put(const time_put *this,
7648 ostreambuf_iterator_wchar *ret, ostreambuf_iterator_wchar dest, ios_base *base,
7649 const struct tm *t, char spec, char mod)
7651 char buf[64], fmt[4], *p = fmt;
7652 MSVCP_size_t i, len;
7653 wchar_t c;
7655 TRACE("(%p %p %p %p %c %c)\n", this, ret, base, t, spec, mod);
7657 *p++ = '%';
7658 if(mod)
7659 *p++ = mod;
7660 *p++ = spec;
7661 *p++ = 0;
7663 len = _Strftime(buf, sizeof(buf), fmt, t, this->time.timeptr);
7664 for(i=0; i<len; i++) {
7665 c = mb_to_wc(buf[i], &this->cvt);
7666 ostreambuf_iterator_wchar_put(&dest, c);
7669 *ret = dest;
7670 return ret;
7673 /* ?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 */
7674 /* ?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 */
7675 /* ?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 */
7676 /* ?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 */
7677 DEFINE_THISCALL_WRAPPER(time_put_wchar_put, 32)
7678 ostreambuf_iterator_wchar* __thiscall time_put_wchar_put(const time_put *this,
7679 ostreambuf_iterator_wchar *ret, ostreambuf_iterator_wchar dest, ios_base *base,
7680 const struct tm *t, char spec, char mod)
7682 TRACE("(%p %p %p %p %c %c)\n", this, ret, base, t, spec, mod);
7683 return call_time_put_wchar_do_put(this, ret, dest, base, t, spec, mod);
7686 /* ?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 */
7687 /* ?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 */
7688 /* ?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 */
7689 /* ?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 */
7690 DEFINE_THISCALL_WRAPPER(time_put_wchar_put_format, 32)
7691 ostreambuf_iterator_wchar* __thiscall time_put_wchar_put_format(const time_put *this,
7692 ostreambuf_iterator_wchar *ret, ostreambuf_iterator_wchar dest, ios_base *base,
7693 const struct tm *t, const wchar_t *pat, const wchar_t *pat_end)
7695 wchar_t percent = mb_to_wc('%', &this->cvt);
7696 char c[MB_LEN_MAX];
7698 TRACE("(%p %p %p %p %s)\n", this, ret, base, t, debugstr_wn(pat, pat_end-pat));
7700 while(pat < pat_end) {
7701 if(*pat != percent) {
7702 ostreambuf_iterator_wchar_put(&dest, *pat++);
7703 }else if(++pat == pat_end) {
7704 ostreambuf_iterator_wchar_put(&dest, percent);
7705 }else if(_Wcrtomb(c, *pat, NULL, &this->cvt)!=1 || (*c=='#' && pat+1==pat_end)) {
7706 ostreambuf_iterator_wchar_put(&dest, percent);
7707 ostreambuf_iterator_wchar_put(&dest, *pat++);
7708 }else {
7709 pat++;
7710 if(*c == '#') {
7711 if(_Wcrtomb(c, *pat++, NULL, &this->cvt) != 1) {
7712 ostreambuf_iterator_wchar_put(&dest, percent);
7713 ostreambuf_iterator_wchar_put(&dest, *(pat-2));
7714 ostreambuf_iterator_wchar_put(&dest, *(pat-1));
7715 }else {
7716 time_put_wchar_put(this, &dest, dest, base, t, *c, '#');
7718 }else {
7719 time_put_wchar_put(this, &dest, dest, base, t, *c, 0);
7724 *ret = dest;
7725 return ret;
7728 /* ??0_Locimp@locale@std@@AAE@_N@Z */
7729 /* ??0_Locimp@locale@std@@AEAA@_N@Z */
7730 DEFINE_THISCALL_WRAPPER(locale__Locimp_ctor_transparent, 8)
7731 locale__Locimp* __thiscall locale__Locimp_ctor_transparent(locale__Locimp *this, MSVCP_bool transparent)
7733 TRACE("(%p %d)\n", this, transparent);
7735 memset(this, 0, sizeof(locale__Locimp));
7736 locale_facet_ctor_refs(&this->facet, 1);
7737 this->transparent = transparent;
7738 locale_string_char_ctor_cstr(&this->name, "*");
7739 return this;
7742 /* ??_F_Locimp@locale@std@@QAEXXZ */
7743 /* ??_F_Locimp@locale@std@@QEAAXXZ */
7744 DEFINE_THISCALL_WRAPPER(locale__Locimp_ctor, 4)
7745 locale__Locimp* __thiscall locale__Locimp_ctor(locale__Locimp *this)
7747 return locale__Locimp_ctor_transparent(this, FALSE);
7750 /* ??0_Locimp@locale@std@@AAE@ABV012@@Z */
7751 /* ??0_Locimp@locale@std@@AEAA@AEBV012@@Z */
7752 DEFINE_THISCALL_WRAPPER(locale__Locimp_copy_ctor, 8)
7753 locale__Locimp* __thiscall locale__Locimp_copy_ctor(locale__Locimp *this, const locale__Locimp *copy)
7755 _Lockit lock;
7756 MSVCP_size_t i;
7758 TRACE("(%p %p)\n", this, copy);
7760 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
7761 memcpy(this, copy, sizeof(locale__Locimp));
7762 locale_facet_ctor_refs(&this->facet, 1);
7763 if(copy->facetvec) {
7764 this->facetvec = MSVCRT_operator_new(copy->facet_cnt*sizeof(locale_facet*));
7765 if(!this->facetvec) {
7766 _Lockit_dtor(&lock);
7767 ERR("Out of memory\n");
7768 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7769 return NULL;
7771 for(i=0; i<this->facet_cnt; i++)
7773 this->facetvec[i] = copy->facetvec[i];
7774 if(this->facetvec[i])
7775 locale_facet__Incref(this->facetvec[i]);
7778 locale_string_char_copy_ctor(&this->name, &copy->name);
7779 _Lockit_dtor(&lock);
7780 return this;
7783 /* ??1_Locimp@locale@std@@MAE@XZ */
7784 /* ??1_Locimp@locale@std@@MEAA@XZ */
7785 DEFINE_THISCALL_WRAPPER(locale__Locimp_dtor, 4)
7786 void __thiscall locale__Locimp_dtor(locale__Locimp *this)
7788 MSVCP_size_t i;
7790 TRACE("(%p)\n", this);
7792 locale_facet_dtor(&this->facet);
7793 for(i=0; i<this->facet_cnt; i++)
7794 if(this->facetvec[i] && locale_facet__Decref(this->facetvec[i]))
7795 call_locale_facet_vector_dtor(this->facetvec[i], 1);
7797 MSVCRT_operator_delete(this->facetvec);
7798 locale_string_char_dtor(&this->name);
7801 DEFINE_THISCALL_WRAPPER(locale__Locimp_vector_dtor, 8)
7802 locale__Locimp* __thiscall locale__Locimp_vector_dtor(locale__Locimp *this, unsigned int flags)
7804 TRACE("(%p %x)\n", this, flags);
7805 if(flags & 2) {
7806 /* we have an array, with the number of elements stored before the first object */
7807 INT_PTR i, *ptr = (INT_PTR *)this-1;
7809 for(i=*ptr-1; i>=0; i--)
7810 locale__Locimp_dtor(this+i);
7811 MSVCRT_operator_delete(ptr);
7812 } else {
7813 locale__Locimp_dtor(this);
7814 if(flags & 1)
7815 MSVCRT_operator_delete(this);
7818 return this;
7821 /* ?_Locimp_Addfac@_Locimp@locale@std@@CAXPAV123@PAVfacet@23@I@Z */
7822 /* ?_Locimp_Addfac@_Locimp@locale@std@@CAXPEAV123@PEAVfacet@23@_K@Z */
7823 void __cdecl locale__Locimp__Locimp_Addfac(locale__Locimp *locimp, locale_facet *facet, MSVCP_size_t id)
7825 _Lockit lock;
7827 TRACE("(%p %p %lu)\n", locimp, facet, id);
7829 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
7830 if(id >= locimp->facet_cnt) {
7831 MSVCP_size_t new_size = id+1;
7832 locale_facet **new_facetvec;
7834 if(new_size < locale_id__Id_cnt+1)
7835 new_size = locale_id__Id_cnt+1;
7837 new_facetvec = MSVCRT_operator_new(sizeof(locale_facet*)*new_size);
7838 if(!new_facetvec) {
7839 _Lockit_dtor(&lock);
7840 ERR("Out of memory\n");
7841 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7842 return;
7845 memset(new_facetvec, 0, sizeof(locale_facet*)*new_size);
7846 memcpy(new_facetvec, locimp->facetvec, sizeof(locale_facet*)*locimp->facet_cnt);
7847 MSVCRT_operator_delete(locimp->facetvec);
7848 locimp->facetvec = new_facetvec;
7849 locimp->facet_cnt = new_size;
7852 if(locimp->facetvec[id] && locale_facet__Decref(locimp->facetvec[id]))
7853 call_locale_facet_vector_dtor(locimp->facetvec[id], 1);
7855 locimp->facetvec[id] = facet;
7856 if(facet)
7857 locale_facet__Incref(facet);
7858 _Lockit_dtor(&lock);
7861 /* ?_Addfac@_Locimp@locale@std@@AAEXPAVfacet@23@I@Z */
7862 /* ?_Addfac@_Locimp@locale@std@@AEAAXPEAVfacet@23@_K@Z */
7863 static void locale__Locimp__Addfac(locale__Locimp *this, locale_facet *facet, MSVCP_size_t id)
7865 locale__Locimp__Locimp_Addfac(this, facet, id);
7868 /* ?_Makeushloc@_Locimp@locale@std@@CAXABV_Locinfo@3@HPAV123@PBV23@@Z */
7869 /* ?_Makeushloc@_Locimp@locale@std@@CAXAEBV_Locinfo@3@HPEAV123@PEBV23@@Z */
7870 /* List of missing facets:
7871 * messages, money_get, money_put, moneypunct, moneypunct, time_get
7873 void __cdecl locale__Locimp__Makeushloc(const _Locinfo *locinfo, category cat, locale__Locimp *locimp, const locale *loc)
7875 FIXME("(%p %d %p %p) semi-stub\n", locinfo, cat, locimp, loc);
7877 if(cat & (1<<(ctype_short__Getcat(NULL, NULL)-1))) {
7878 ctype_wchar *ctype;
7880 if(loc) {
7881 ctype = ctype_short_use_facet(loc);
7882 }else {
7883 ctype = MSVCRT_operator_new(sizeof(ctype_wchar));
7884 if(!ctype) {
7885 ERR("Out of memory\n");
7886 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7888 ctype_short_ctor_locinfo(ctype, locinfo, 0);
7890 locale__Locimp__Addfac(locimp, &ctype->base.facet, locale_id_operator_size_t(&ctype_short_id));
7893 if(cat & (1<<(num_get_short__Getcat(NULL, NULL)-1))) {
7894 num_get *numget;
7896 if(loc) {
7897 numget = num_get_short_use_facet(loc);
7898 }else {
7899 numget = MSVCRT_operator_new(sizeof(num_get));
7900 if(!numget) {
7901 ERR("Out of memory\n");
7902 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7904 num_get_short_ctor_locinfo(numget, locinfo, 0);
7906 locale__Locimp__Addfac(locimp, &numget->facet, locale_id_operator_size_t(&num_get_short_id));
7909 if(cat & (1<<(num_put_short__Getcat(NULL, NULL)-1))) {
7910 num_put *numput;
7912 if(loc) {
7913 numput = num_put_short_use_facet(loc);
7914 }else {
7915 numput = MSVCRT_operator_new(sizeof(num_put));
7916 if(!numput) {
7917 ERR("Out of memory\n");
7918 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7920 num_put_short_ctor_locinfo(numput, locinfo, 0);
7922 locale__Locimp__Addfac(locimp, &numput->facet, locale_id_operator_size_t(&num_put_short_id));
7925 if(cat & (1<<(numpunct_short__Getcat(NULL, NULL)-1))) {
7926 numpunct_wchar *numpunct;
7928 if(loc) {
7929 numpunct = numpunct_short_use_facet(loc);
7930 }else {
7931 numpunct = MSVCRT_operator_new(sizeof(numpunct_wchar));
7932 if(!numpunct) {
7933 ERR("Out of memory\n");
7934 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7936 numpunct_short_ctor_locinfo(numpunct, locinfo, 0, FALSE);
7938 locale__Locimp__Addfac(locimp, &numpunct->facet, locale_id_operator_size_t(&numpunct_short_id));
7941 if(cat & (1<<(collate_short__Getcat(NULL, NULL)-1))) {
7942 collate *c;
7944 if(loc) {
7945 c = collate_short_use_facet(loc);
7946 }else {
7947 c = MSVCRT_operator_new(sizeof(collate));
7948 if(!c) {
7949 ERR("Out of memory\n");
7950 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7952 collate_short_ctor_locinfo(c, locinfo, 0);
7954 locale__Locimp__Addfac(locimp, &c->facet, locale_id_operator_size_t(&collate_short_id));
7957 if(cat & (1<<(time_put_short__Getcat(NULL, NULL)-1))) {
7958 time_put *t;
7960 if(loc) {
7961 t = time_put_short_use_facet(loc);
7962 }else {
7963 t = MSVCRT_operator_new(sizeof(time_put));
7964 if(!t) {
7965 ERR("Out of memory\n");
7966 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7968 time_put_short_ctor_locinfo(t, locinfo, 0);
7970 locale__Locimp__Addfac(locimp, &t->facet, locale_id_operator_size_t(&time_put_short_id));
7973 if(cat & (1<<(codecvt_short__Getcat(NULL, NULL)-1))) {
7974 codecvt_wchar *codecvt;
7976 if(loc) {
7977 codecvt = codecvt_short_use_facet(loc);
7978 }else {
7979 codecvt = MSVCRT_operator_new(sizeof(codecvt_wchar));
7980 if(!codecvt) {
7981 ERR("Out of memory\n");
7982 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7984 codecvt_short_ctor_locinfo(codecvt, locinfo, 0);
7986 locale__Locimp__Addfac(locimp, &codecvt->base.facet, locale_id_operator_size_t(&codecvt_short_id));
7990 /* ?_Makewloc@_Locimp@locale@std@@CAXABV_Locinfo@3@HPAV123@PBV23@@Z */
7991 /* ?_Makewloc@_Locimp@locale@std@@CAXAEBV_Locinfo@3@HPEAV123@PEBV23@@Z */
7992 /* List of missing facets:
7993 * messages, money_get, money_put, moneypunct, moneypunct, time_get
7995 void __cdecl locale__Locimp__Makewloc(const _Locinfo *locinfo, category cat, locale__Locimp *locimp, const locale *loc)
7997 FIXME("(%p %d %p %p) semi-stub\n", locinfo, cat, locimp, loc);
7999 if(cat & (1<<(ctype_wchar__Getcat(NULL, NULL)-1))) {
8000 ctype_wchar *ctype;
8002 if(loc) {
8003 ctype = ctype_wchar_use_facet(loc);
8004 }else {
8005 ctype = MSVCRT_operator_new(sizeof(ctype_wchar));
8006 if(!ctype) {
8007 ERR("Out of memory\n");
8008 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8010 ctype_wchar_ctor_locinfo(ctype, locinfo, 0);
8012 locale__Locimp__Addfac(locimp, &ctype->base.facet, locale_id_operator_size_t(&ctype_wchar_id));
8015 if(cat & (1<<(num_get_wchar__Getcat(NULL, NULL)-1))) {
8016 num_get *numget;
8018 if(loc) {
8019 numget = num_get_wchar_use_facet(loc);
8020 }else {
8021 numget = MSVCRT_operator_new(sizeof(num_get));
8022 if(!numget) {
8023 ERR("Out of memory\n");
8024 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8026 num_get_wchar_ctor_locinfo(numget, locinfo, 0);
8028 locale__Locimp__Addfac(locimp, &numget->facet, locale_id_operator_size_t(&num_get_wchar_id));
8031 if(cat & (1<<(num_put_wchar__Getcat(NULL, NULL)-1))) {
8032 num_put *numput;
8034 if(loc) {
8035 numput = num_put_wchar_use_facet(loc);
8036 }else {
8037 numput = MSVCRT_operator_new(sizeof(num_put));
8038 if(!numput) {
8039 ERR("Out of memory\n");
8040 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8042 num_put_wchar_ctor_locinfo(numput, locinfo, 0);
8044 locale__Locimp__Addfac(locimp, &numput->facet, locale_id_operator_size_t(&num_put_wchar_id));
8047 if(cat & (1<<(numpunct_wchar__Getcat(NULL, NULL)-1))) {
8048 numpunct_wchar *numpunct;
8050 if(loc) {
8051 numpunct = numpunct_wchar_use_facet(loc);
8052 }else {
8053 numpunct = MSVCRT_operator_new(sizeof(numpunct_wchar));
8054 if(!numpunct) {
8055 ERR("Out of memory\n");
8056 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8058 numpunct_wchar_ctor_locinfo(numpunct, locinfo, 0, FALSE);
8060 locale__Locimp__Addfac(locimp, &numpunct->facet, locale_id_operator_size_t(&numpunct_wchar_id));
8063 if(cat & (1<<(collate_wchar__Getcat(NULL, NULL)-1))) {
8064 collate *c;
8066 if(loc) {
8067 c = collate_wchar_use_facet(loc);
8068 }else {
8069 c = MSVCRT_operator_new(sizeof(collate));
8070 if(!c) {
8071 ERR("Out of memory\n");
8072 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8074 collate_wchar_ctor_locinfo(c, locinfo, 0);
8076 locale__Locimp__Addfac(locimp, &c->facet, locale_id_operator_size_t(&collate_wchar_id));
8079 if(cat & (1<<(time_put_wchar__Getcat(NULL, NULL)-1))) {
8080 time_put *t;
8082 if(loc) {
8083 t = time_put_wchar_use_facet(loc);
8084 }else {
8085 t = MSVCRT_operator_new(sizeof(time_put));
8086 if(!t) {
8087 ERR("Out of memory\n");
8088 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8090 time_put_wchar_ctor_locinfo(t, locinfo, 0);
8092 locale__Locimp__Addfac(locimp, &t->facet, locale_id_operator_size_t(&time_put_wchar_id));
8095 if(cat & (1<<(codecvt_wchar__Getcat(NULL, NULL)-1))) {
8096 codecvt_wchar *codecvt;
8098 if(loc) {
8099 codecvt = codecvt_wchar_use_facet(loc);
8100 }else {
8101 codecvt = MSVCRT_operator_new(sizeof(codecvt_wchar));
8102 if(!codecvt) {
8103 ERR("Out of memory\n");
8104 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8106 codecvt_wchar_ctor_locinfo(codecvt, locinfo, 0);
8108 locale__Locimp__Addfac(locimp, &codecvt->base.facet, locale_id_operator_size_t(&codecvt_wchar_id));
8112 /* ?_Makexloc@_Locimp@locale@std@@CAXABV_Locinfo@3@HPAV123@PBV23@@Z */
8113 /* ?_Makexloc@_Locimp@locale@std@@CAXAEBV_Locinfo@3@HPEAV123@PEBV23@@Z */
8114 /* List of missing facets:
8115 * messages, money_get, money_put, moneypunct, moneypunct, time_get
8117 void __cdecl locale__Locimp__Makexloc(const _Locinfo *locinfo, category cat, locale__Locimp *locimp, const locale *loc)
8119 FIXME("(%p %d %p %p) semi-stub\n", locinfo, cat, locimp, loc);
8121 if(cat & (1<<(ctype_char__Getcat(NULL, NULL)-1))) {
8122 ctype_char *ctype;
8124 if(loc) {
8125 ctype = ctype_char_use_facet(loc);
8126 }else {
8127 ctype = MSVCRT_operator_new(sizeof(ctype_char));
8128 if(!ctype) {
8129 ERR("Out of memory\n");
8130 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8132 ctype_char_ctor_locinfo(ctype, locinfo, 0);
8134 locale__Locimp__Addfac(locimp, &ctype->base.facet, locale_id_operator_size_t(&ctype_char_id));
8137 if(cat & (1<<(num_get_char__Getcat(NULL, NULL)-1))) {
8138 num_get *numget;
8140 if(loc) {
8141 numget = num_get_char_use_facet(loc);
8142 }else {
8143 numget = MSVCRT_operator_new(sizeof(num_get));
8144 if(!numget) {
8145 ERR("Out of memory\n");
8146 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8148 num_get_char_ctor_locinfo(numget, locinfo, 0);
8150 locale__Locimp__Addfac(locimp, &numget->facet, locale_id_operator_size_t(&num_get_char_id));
8153 if(cat & (1<<(num_put_char__Getcat(NULL, NULL)-1))) {
8154 num_put *numput;
8156 if(loc) {
8157 numput = num_put_char_use_facet(loc);
8158 }else {
8159 numput = MSVCRT_operator_new(sizeof(num_put));
8160 if(!numput) {
8161 ERR("Out of memory\n");
8162 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8164 num_put_char_ctor_locinfo(numput, locinfo, 0);
8166 locale__Locimp__Addfac(locimp, &numput->facet, locale_id_operator_size_t(&num_put_char_id));
8169 if(cat & (1<<(numpunct_char__Getcat(NULL, NULL)-1))) {
8170 numpunct_char *numpunct;
8172 if(loc) {
8173 numpunct = numpunct_char_use_facet(loc);
8174 }else {
8175 numpunct = MSVCRT_operator_new(sizeof(numpunct_char));
8176 if(!numpunct) {
8177 ERR("Out of memory\n");
8178 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8180 numpunct_char_ctor_locinfo(numpunct, locinfo, 0, FALSE);
8182 locale__Locimp__Addfac(locimp, &numpunct->facet, locale_id_operator_size_t(&numpunct_char_id));
8185 if(cat & (1<<(collate_char__Getcat(NULL, NULL)-1))) {
8186 collate *c;
8188 if(loc) {
8189 c = collate_char_use_facet(loc);
8190 }else {
8191 c = MSVCRT_operator_new(sizeof(collate));
8192 if(!c) {
8193 ERR("Out of memory\n");
8194 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8196 collate_char_ctor_locinfo(c, locinfo, 0);
8198 locale__Locimp__Addfac(locimp, &c->facet, locale_id_operator_size_t(&collate_char_id));
8201 if(cat & (1<<(time_put_char__Getcat(NULL, NULL)-1))) {
8202 time_put *t;
8204 if(loc) {
8205 t = time_put_char_use_facet(loc);
8206 }else {
8207 t = MSVCRT_operator_new(sizeof(time_put));
8208 if(!t) {
8209 ERR("Out of memory\n");
8210 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8212 time_put_char_ctor_locinfo(t, locinfo, 0);
8214 locale__Locimp__Addfac(locimp, &t->facet, locale_id_operator_size_t(&time_put_char_id));
8217 if(cat & (1<<(codecvt_char__Getcat(NULL, NULL)-1))) {
8218 codecvt_char *codecvt;
8220 if(loc) {
8221 codecvt = codecvt_char_use_facet(loc);
8222 }else {
8223 codecvt = MSVCRT_operator_new(sizeof(codecvt_char));
8224 if(!codecvt) {
8225 ERR("Out of memory\n");
8226 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8228 codecvt_char_ctor_locinfo(codecvt, locinfo, 0);
8230 locale__Locimp__Addfac(locimp, &codecvt->base.facet, locale_id_operator_size_t(&codecvt_char_id));
8234 /* ?_Makeloc@_Locimp@locale@std@@CAPAV123@ABV_Locinfo@3@HPAV123@PBV23@@Z */
8235 /* ?_Makeloc@_Locimp@locale@std@@CAPEAV123@AEBV_Locinfo@3@HPEAV123@PEBV23@@Z */
8236 locale__Locimp* __cdecl locale__Locimp__Makeloc(const _Locinfo *locinfo, category cat, locale__Locimp *locimp, const locale *loc)
8238 TRACE("(%p %d %p %p)\n", locinfo, cat, locimp, loc);
8240 locale__Locimp__Makexloc(locinfo, cat, locimp, loc);
8241 locale__Locimp__Makewloc(locinfo, cat, locimp, loc);
8242 locale__Locimp__Makeushloc(locinfo, cat, locimp, loc);
8244 locimp->catmask |= cat;
8245 locale_string_char_assign(&locimp->name, &locinfo->newlocname);
8246 return locimp;
8249 /* ??_7_Locimp@locale@std@@6B@ */
8250 const vtable_ptr MSVCP_locale__Locimp_vtable[] = {
8251 (vtable_ptr)THISCALL_NAME(locale__Locimp_vector_dtor)
8254 /* ??0locale@std@@AAE@PAV_Locimp@01@@Z */
8255 /* ??0locale@std@@AEAA@PEAV_Locimp@01@@Z */
8256 DEFINE_THISCALL_WRAPPER(locale_ctor_locimp, 8)
8257 locale* __thiscall locale_ctor_locimp(locale *this, locale__Locimp *locimp)
8259 TRACE("(%p %p)\n", this, locimp);
8260 /* Don't change locimp reference counter */
8261 this->ptr = locimp;
8262 return this;
8265 /* ?_Init@locale@std@@CAPAV_Locimp@12@XZ */
8266 /* ?_Init@locale@std@@CAPEAV_Locimp@12@XZ */
8267 locale__Locimp* __cdecl locale__Init(void)
8269 _Lockit lock;
8271 TRACE("\n");
8273 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
8274 if(global_locale) {
8275 _Lockit_dtor(&lock);
8276 return global_locale;
8279 global_locale = MSVCRT_operator_new(sizeof(locale__Locimp));
8280 if(!global_locale) {
8281 _Lockit_dtor(&lock);
8282 ERR("Out of memory\n");
8283 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8284 return NULL;
8287 locale__Locimp_ctor(global_locale);
8288 global_locale->catmask = (1<<(LC_MAX+1))-1;
8289 locale_string_char_dtor(&global_locale->name);
8290 locale_string_char_ctor_cstr(&global_locale->name, "C");
8292 locale__Locimp__Clocptr = global_locale;
8293 global_locale->facet.refs++;
8294 locale_ctor_locimp(&classic_locale, locale__Locimp__Clocptr);
8295 _Lockit_dtor(&lock);
8297 return global_locale;
8300 /* ?_Iscloc@locale@std@@QBE_NXZ */
8301 /* ?_Iscloc@locale@std@@QEBA_NXZ */
8302 DEFINE_THISCALL_WRAPPER(locale__Iscloc, 4)
8303 MSVCP_bool __thiscall locale__Iscloc(const locale *this)
8305 TRACE("(%p)\n", this);
8306 return this->ptr == locale__Locimp__Clocptr;
8309 /* ??0locale@std@@QAE@ABV01@0H@Z */
8310 /* ??0locale@std@@QEAA@AEBV01@0H@Z */
8311 DEFINE_THISCALL_WRAPPER(locale_ctor_locale_locale, 16)
8312 locale* __thiscall locale_ctor_locale_locale(locale *this, const locale *loc, const locale *other, category cat)
8314 _Locinfo locinfo;
8316 TRACE("(%p %p %p %d)\n", this, loc, other, cat);
8318 this->ptr = MSVCRT_operator_new(sizeof(locale__Locimp));
8319 if(!this->ptr) {
8320 ERR("Out of memory\n");
8321 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8323 locale__Locimp_copy_ctor(this->ptr, loc->ptr);
8325 _Locinfo_ctor_cat_cstr(&locinfo, loc->ptr->catmask, locale_string_char_c_str(&loc->ptr->name));
8326 _Locinfo__Addcats(&locinfo, cat & other->ptr->catmask, locale_string_char_c_str(&other->ptr->name));
8327 locale__Locimp__Makeloc(&locinfo, cat, this->ptr, other);
8328 _Locinfo_dtor(&locinfo);
8330 return this;
8333 /* ??0locale@std@@QAE@ABV01@@Z */
8334 /* ??0locale@std@@QEAA@AEBV01@@Z */
8335 DEFINE_THISCALL_WRAPPER(locale_copy_ctor, 8)
8336 locale* __thiscall locale_copy_ctor(locale *this, const locale *copy)
8338 TRACE("(%p %p)\n", this, copy);
8339 this->ptr = copy->ptr;
8340 locale_facet__Incref(&this->ptr->facet);
8341 return this;
8344 /* ??0locale@std@@QAE@ABV01@PBDH@Z */
8345 /* ??0locale@std@@QEAA@AEBV01@PEBDH@Z */
8346 DEFINE_THISCALL_WRAPPER(locale_ctor_locale_cstr, 16)
8347 locale* __thiscall locale_ctor_locale_cstr(locale *this, const locale *loc, const char *locname, category cat)
8349 _Locinfo locinfo;
8351 TRACE("(%p %p %s %d)\n", this, loc, locname, cat);
8353 _Locinfo_ctor_cat_cstr(&locinfo, cat, locname);
8354 if(!memcmp(locale_string_char_c_str(&locinfo.newlocname), "*", 2)) {
8355 _Locinfo_dtor(&locinfo);
8356 MSVCRT_operator_delete(this->ptr);
8357 throw_exception(EXCEPTION_RUNTIME_ERROR, "bad locale name");
8360 this->ptr = MSVCRT_operator_new(sizeof(locale__Locimp));
8361 if(!this->ptr) {
8362 ERR("Out of memory\n");
8363 _Locinfo_dtor(&locinfo);
8364 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8366 locale__Locimp_copy_ctor(this->ptr, loc->ptr);
8368 locale__Locimp__Makeloc(&locinfo, cat, this->ptr, NULL);
8369 _Locinfo_dtor(&locinfo);
8370 return this;
8373 /* ??0locale@std@@QAE@PBDH@Z */
8374 /* ??0locale@std@@QEAA@PEBDH@Z */
8375 DEFINE_THISCALL_WRAPPER(locale_ctor_cstr, 12)
8376 locale* __thiscall locale_ctor_cstr(locale *this, const char *locname, category cat)
8378 _Locinfo locinfo;
8380 TRACE("(%p %s %d)\n", this, locname, cat);
8382 this->ptr = MSVCRT_operator_new(sizeof(locale__Locimp));
8383 if(!this->ptr) {
8384 ERR("Out of memory\n");
8385 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8387 locale__Locimp_ctor(this->ptr);
8389 locale__Init();
8391 _Locinfo_ctor_cat_cstr(&locinfo, cat, locname);
8392 if(!memcmp(locale_string_char_c_str(&locinfo.newlocname), "*", 2)) {
8393 _Locinfo_dtor(&locinfo);
8394 MSVCRT_operator_delete(this->ptr);
8395 throw_exception(EXCEPTION_RUNTIME_ERROR, "bad locale name");
8398 locale__Locimp__Makeloc(&locinfo, cat, this->ptr, NULL);
8399 _Locinfo_dtor(&locinfo);
8401 return this;
8404 /* ??0locale@std@@QAE@W4_Uninitialized@1@@Z */
8405 /* ??0locale@std@@QEAA@W4_Uninitialized@1@@Z */
8406 DEFINE_THISCALL_WRAPPER(locale_ctor_uninitialized, 8)
8407 locale* __thiscall locale_ctor_uninitialized(locale *this, int uninitialized)
8409 TRACE("(%p)\n", this);
8410 this->ptr = NULL;
8411 return this;
8414 /* ??0locale@std@@QAE@XZ */
8415 /* ??0locale@std@@QEAA@XZ */
8416 DEFINE_THISCALL_WRAPPER(locale_ctor, 4)
8417 locale* __thiscall locale_ctor(locale *this)
8419 TRACE("(%p)\n", this);
8420 this->ptr = locale__Init();
8421 locale_facet__Incref(&this->ptr->facet);
8422 return this;
8425 /* ??1locale@std@@QAE@XZ */
8426 /* ??1locale@std@@QEAA@XZ */
8427 DEFINE_THISCALL_WRAPPER(locale_dtor, 4)
8428 void __thiscall locale_dtor(locale *this)
8430 TRACE("(%p)\n", this);
8431 if(this->ptr && locale_facet__Decref(&this->ptr->facet)) {
8432 locale__Locimp_dtor(this->ptr);
8433 MSVCRT_operator_delete(this->ptr);
8437 /* ??4locale@std@@QAEAAV01@ABV01@@Z */
8438 /* ??4locale@std@@QEAAAEAV01@AEBV01@@Z */
8439 DEFINE_THISCALL_WRAPPER(locale_operator_assign, 8)
8440 locale* __thiscall locale_operator_assign(locale *this, const locale *loc)
8442 FIXME("(%p %p) stub\n", this, loc);
8443 return NULL;
8446 /* ??8locale@std@@QBE_NABV01@@Z */
8447 /* ??8locale@std@@QEBA_NAEBV01@@Z */
8448 DEFINE_THISCALL_WRAPPER(locale_operator_equal, 8)
8449 MSVCP_bool __thiscall locale_operator_equal(const locale *this, const locale *loc)
8451 FIXME("(%p %p) stub\n", this, loc);
8452 return 0;
8455 /* ??9locale@std@@QBE_NABV01@@Z */
8456 /* ??9locale@std@@QEBA_NAEBV01@@Z */
8457 DEFINE_THISCALL_WRAPPER(locale_operator_not_equal, 8)
8458 MSVCP_bool __thiscall locale_operator_not_equal(const locale *this, locale const *loc)
8460 FIXME("(%p %p) stub\n", this, loc);
8461 return 0;
8464 /* ?_Addfac@locale@std@@QAEAAV12@PAVfacet@12@II@Z */
8465 /* ?_Addfac@locale@std@@QEAAAEAV12@PEAVfacet@12@_K1@Z */
8466 DEFINE_THISCALL_WRAPPER(locale__Addfac, 16)
8467 locale* __thiscall locale__Addfac(locale *this, locale_facet *facet, MSVCP_size_t id, MSVCP_size_t catmask)
8469 TRACE("(%p %p %lu %lu)\n", this, facet, id, catmask);
8471 if(this->ptr->facet.refs > 1) {
8472 locale__Locimp *new_ptr = MSVCRT_operator_new(sizeof(locale__Locimp));
8473 if(!new_ptr) {
8474 ERR("Out of memory\n");
8475 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8476 return NULL;
8478 locale__Locimp_copy_ctor(new_ptr, this->ptr);
8479 locale_facet__Decref(&this->ptr->facet);
8480 this->ptr = new_ptr;
8483 locale__Locimp__Addfac(this->ptr, facet, id);
8485 if(catmask) {
8486 locale_string_char_dtor(&this->ptr->name);
8487 locale_string_char_ctor_cstr(&this->ptr->name, "*");
8489 return this;
8492 /* ?_Getfacet@locale@std@@QBEPBVfacet@12@I_N@Z */
8493 /* ?_Getfacet@locale@std@@QEBAPEBVfacet@12@_K_N@Z */
8494 DEFINE_THISCALL_WRAPPER(locale__Getfacet, 12)
8495 const locale_facet* __thiscall locale__Getfacet(const locale *this,
8496 MSVCP_size_t id, MSVCP_bool allow_transparent)
8498 locale_facet *fac;
8500 TRACE("(%p %lu)\n", this, id);
8502 fac = id < this->ptr->facet_cnt ? this->ptr->facetvec[id] : NULL;
8503 if(fac || !this->ptr->transparent || !allow_transparent)
8504 return fac;
8506 return id < global_locale->facet_cnt ? global_locale->facetvec[id] : NULL;
8509 /* ?classic@locale@std@@SAABV12@XZ */
8510 /* ?classic@locale@std@@SAAEBV12@XZ */
8511 const locale* __cdecl locale_classic(void)
8513 TRACE("\n");
8514 locale__Init();
8515 return &classic_locale;
8518 /* ?empty@locale@std@@SA?AV12@XZ */
8519 locale* __cdecl locale_empty(locale *ret)
8521 TRACE("\n");
8523 locale__Init();
8525 ret->ptr = MSVCRT_operator_new(sizeof(locale__Locimp));
8526 if(!ret->ptr) {
8527 ERR("Out of memory\n");
8528 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8530 locale__Locimp_ctor_transparent(ret->ptr, TRUE);
8531 return ret;
8534 /* ?name@locale@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
8535 /* ?name@locale@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
8536 DEFINE_THISCALL_WRAPPER(locale_name, 8)
8537 basic_string_char* __thiscall locale_name(const locale *this, basic_string_char *ret)
8539 TRACE( "(%p)\n", this);
8540 MSVCP_basic_string_char_copy_ctor(ret, &this->ptr->name);
8541 return ret;
8544 /* ?global@locale@std@@SA?AV12@ABV12@@Z */
8545 /* ?global@locale@std@@SA?AV12@AEBV12@@Z */
8546 locale* __cdecl locale_global(locale *ret, const locale *loc)
8548 _Lockit lock;
8549 int i;
8551 TRACE("(%p %p)\n", loc, ret);
8553 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
8554 locale_ctor(ret);
8556 if(loc->ptr != global_locale) {
8557 locale_facet__Decref(&global_locale->facet);
8558 global_locale = loc->ptr;
8559 locale_facet__Incref(&global_locale->facet);
8561 for(i=LC_ALL+1; i<=LC_MAX; i++) {
8562 if((global_locale->catmask & (1<<(i-1))) == 0)
8563 continue;
8564 setlocale(i, MSVCP_basic_string_char_c_str(&global_locale->name));
8567 _Lockit_dtor(&lock);
8568 return ret;
8571 /* wctrans */
8572 wctrans_t __cdecl wctrans(const char *property)
8574 static const char str_tolower[] = "tolower";
8575 static const char str_toupper[] = "toupper";
8577 if(!strcmp(property, str_tolower))
8578 return 2;
8579 if(!strcmp(property, str_toupper))
8580 return 1;
8581 return 0;
8584 /* towctrans */
8585 wint_t __cdecl towctrans(wint_t c, wctrans_t category)
8587 if(category == 1)
8588 return towupper(c);
8589 return towlower(c);
8592 DEFINE_RTTI_DATA0(locale_facet, 0, ".?AVfacet@locale@std@@")
8593 DEFINE_RTTI_DATA1(collate_char, 0, &locale_facet_rtti_base_descriptor, ".?AV?$collate@D@std@@")
8594 DEFINE_RTTI_DATA1(collate_wchar, 0, &locale_facet_rtti_base_descriptor, ".?AV?$collate@_W@std@@")
8595 DEFINE_RTTI_DATA1(collate_short, 0, &locale_facet_rtti_base_descriptor, ".?AV?$collate@G@std@@")
8596 DEFINE_RTTI_DATA1(ctype_base, 0, &locale_facet_rtti_base_descriptor, ".?AUctype_base@std@@")
8597 DEFINE_RTTI_DATA2(ctype_char, 0, &ctype_base_rtti_base_descriptor, &locale_facet_rtti_base_descriptor, ".?AV?$ctype@D@std@@")
8598 DEFINE_RTTI_DATA2(ctype_wchar, 0, &ctype_base_rtti_base_descriptor, &locale_facet_rtti_base_descriptor, ".?AV?$ctype@_W@std@@")
8599 DEFINE_RTTI_DATA2(ctype_short, 0, &ctype_base_rtti_base_descriptor, &locale_facet_rtti_base_descriptor, ".?AV?$ctype@G@std@@")
8600 DEFINE_RTTI_DATA1(codecvt_base, 0, &locale_facet_rtti_base_descriptor, ".?AVcodecvt_base@std@@")
8601 DEFINE_RTTI_DATA2(codecvt_char, 0, &codecvt_base_rtti_base_descriptor, &locale_facet_rtti_base_descriptor, ".?AV?$codecvt@DDH@std@@")
8602 DEFINE_RTTI_DATA2(codecvt_wchar, 0, &codecvt_base_rtti_base_descriptor, &locale_facet_rtti_base_descriptor, ".?AV?$codecvt@_WDH@std@@")
8603 DEFINE_RTTI_DATA2(codecvt_short, 0, &codecvt_base_rtti_base_descriptor, &locale_facet_rtti_base_descriptor, ".?AV?$codecvt@GDH@std@@")
8604 DEFINE_RTTI_DATA1(numpunct_char, 0, &locale_facet_rtti_base_descriptor, ".?AV?$numpunct@D@std@@")
8605 DEFINE_RTTI_DATA1(numpunct_wchar, 0, &locale_facet_rtti_base_descriptor, ".?AV?$numpunct@_W@std@@")
8606 DEFINE_RTTI_DATA1(numpunct_short, 0, &locale_facet_rtti_base_descriptor, ".?AV?$numpunct@G@std@@")
8607 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@@")
8608 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@@")
8609 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@@")
8610 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@@")
8611 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@@")
8612 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@@")
8613 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@@")
8614 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@@")
8615 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@@")
8617 #ifndef __GNUC__
8618 void __asm_dummy_vtables(void) {
8619 #endif
8620 __ASM_VTABLE(locale_facet,
8621 VTABLE_ADD_FUNC(locale_facet_vector_dtor));
8622 __ASM_VTABLE(collate_char,
8623 VTABLE_ADD_FUNC(collate_char_vector_dtor)
8624 VTABLE_ADD_FUNC(collate_char_do_compare)
8625 VTABLE_ADD_FUNC(collate_char_do_transform)
8626 VTABLE_ADD_FUNC(collate_char_do_hash));
8627 __ASM_VTABLE(collate_wchar,
8628 VTABLE_ADD_FUNC(collate_wchar_vector_dtor)
8629 VTABLE_ADD_FUNC(collate_wchar_do_compare)
8630 VTABLE_ADD_FUNC(collate_wchar_do_transform)
8631 VTABLE_ADD_FUNC(collate_wchar_do_hash));
8632 __ASM_VTABLE(collate_short,
8633 VTABLE_ADD_FUNC(collate_wchar_vector_dtor)
8634 VTABLE_ADD_FUNC(collate_wchar_do_compare)
8635 VTABLE_ADD_FUNC(collate_wchar_do_transform)
8636 VTABLE_ADD_FUNC(collate_wchar_do_hash));
8637 __ASM_VTABLE(ctype_base,
8638 VTABLE_ADD_FUNC(ctype_base_vector_dtor));
8639 __ASM_VTABLE(ctype_char,
8640 VTABLE_ADD_FUNC(ctype_char_vector_dtor)
8641 VTABLE_ADD_FUNC(ctype_char_do_tolower)
8642 VTABLE_ADD_FUNC(ctype_char_do_tolower_ch)
8643 VTABLE_ADD_FUNC(ctype_char_do_toupper)
8644 VTABLE_ADD_FUNC(ctype_char_do_toupper_ch)
8645 VTABLE_ADD_FUNC(ctype_char_do_widen)
8646 VTABLE_ADD_FUNC(ctype_char_do_widen_ch)
8647 VTABLE_ADD_FUNC(ctype_char_do_narrow)
8648 VTABLE_ADD_FUNC(ctype_char_do_narrow_ch));
8649 __ASM_VTABLE(ctype_wchar,
8650 VTABLE_ADD_FUNC(ctype_wchar_vector_dtor)
8651 VTABLE_ADD_FUNC(ctype_wchar_do_is)
8652 VTABLE_ADD_FUNC(ctype_wchar_do_is_ch)
8653 VTABLE_ADD_FUNC(ctype_wchar_do_scan_is)
8654 VTABLE_ADD_FUNC(ctype_wchar_do_scan_not)
8655 VTABLE_ADD_FUNC(ctype_wchar_do_tolower)
8656 VTABLE_ADD_FUNC(ctype_wchar_do_tolower_ch)
8657 VTABLE_ADD_FUNC(ctype_wchar_do_toupper)
8658 VTABLE_ADD_FUNC(ctype_wchar_do_toupper_ch)
8659 VTABLE_ADD_FUNC(ctype_wchar_do_widen)
8660 VTABLE_ADD_FUNC(ctype_wchar_do_widen_ch)
8661 VTABLE_ADD_FUNC(ctype_wchar_do_narrow)
8662 VTABLE_ADD_FUNC(ctype_wchar_do_narrow_ch));
8663 __ASM_VTABLE(ctype_short,
8664 VTABLE_ADD_FUNC(ctype_wchar_vector_dtor)
8665 VTABLE_ADD_FUNC(ctype_wchar_do_is)
8666 VTABLE_ADD_FUNC(ctype_wchar_do_is_ch)
8667 VTABLE_ADD_FUNC(ctype_wchar_do_scan_is)
8668 VTABLE_ADD_FUNC(ctype_wchar_do_scan_not)
8669 VTABLE_ADD_FUNC(ctype_wchar_do_tolower)
8670 VTABLE_ADD_FUNC(ctype_wchar_do_tolower_ch)
8671 VTABLE_ADD_FUNC(ctype_wchar_do_toupper)
8672 VTABLE_ADD_FUNC(ctype_wchar_do_toupper_ch)
8673 VTABLE_ADD_FUNC(ctype_wchar_do_widen)
8674 VTABLE_ADD_FUNC(ctype_wchar_do_widen_ch)
8675 VTABLE_ADD_FUNC(ctype_wchar_do_narrow)
8676 VTABLE_ADD_FUNC(ctype_wchar_do_narrow_ch));
8677 __ASM_VTABLE(codecvt_base,
8678 VTABLE_ADD_FUNC(codecvt_base_vector_dtor)
8679 VTABLE_ADD_FUNC(codecvt_base_do_always_noconv)
8680 VTABLE_ADD_FUNC(codecvt_base_do_max_length)
8681 VTABLE_ADD_FUNC(codecvt_base_do_encoding));
8682 __ASM_VTABLE(codecvt_char,
8683 VTABLE_ADD_FUNC(codecvt_char_vector_dtor)
8684 VTABLE_ADD_FUNC(codecvt_base_do_always_noconv)
8685 VTABLE_ADD_FUNC(codecvt_base_do_max_length)
8686 VTABLE_ADD_FUNC(codecvt_base_do_encoding)
8687 VTABLE_ADD_FUNC(codecvt_char_do_in)
8688 VTABLE_ADD_FUNC(codecvt_char_do_out)
8689 VTABLE_ADD_FUNC(codecvt_char_do_unshift)
8690 VTABLE_ADD_FUNC(codecvt_char_do_length));
8691 __ASM_VTABLE(codecvt_wchar,
8692 VTABLE_ADD_FUNC(codecvt_wchar_vector_dtor)
8693 VTABLE_ADD_FUNC(codecvt_wchar_do_always_noconv)
8694 VTABLE_ADD_FUNC(codecvt_wchar_do_max_length)
8695 VTABLE_ADD_FUNC(codecvt_base_do_encoding)
8696 VTABLE_ADD_FUNC(codecvt_wchar_do_in)
8697 VTABLE_ADD_FUNC(codecvt_wchar_do_out)
8698 VTABLE_ADD_FUNC(codecvt_wchar_do_unshift)
8699 VTABLE_ADD_FUNC(codecvt_wchar_do_length));
8700 __ASM_VTABLE(codecvt_short,
8701 VTABLE_ADD_FUNC(codecvt_wchar_vector_dtor)
8702 VTABLE_ADD_FUNC(codecvt_wchar_do_always_noconv)
8703 VTABLE_ADD_FUNC(codecvt_wchar_do_max_length)
8704 VTABLE_ADD_FUNC(codecvt_base_do_encoding)
8705 VTABLE_ADD_FUNC(codecvt_wchar_do_in)
8706 VTABLE_ADD_FUNC(codecvt_wchar_do_out)
8707 VTABLE_ADD_FUNC(codecvt_wchar_do_unshift)
8708 VTABLE_ADD_FUNC(codecvt_wchar_do_length));
8709 __ASM_VTABLE(numpunct_char,
8710 VTABLE_ADD_FUNC(numpunct_char_vector_dtor)
8711 VTABLE_ADD_FUNC(numpunct_char_do_decimal_point)
8712 VTABLE_ADD_FUNC(numpunct_char_do_thousands_sep)
8713 VTABLE_ADD_FUNC(numpunct_char_do_grouping)
8714 VTABLE_ADD_FUNC(numpunct_char_do_falsename)
8715 VTABLE_ADD_FUNC(numpunct_char_do_truename));
8716 __ASM_VTABLE(numpunct_wchar,
8717 VTABLE_ADD_FUNC(numpunct_wchar_vector_dtor)
8718 VTABLE_ADD_FUNC(numpunct_wchar_do_decimal_point)
8719 VTABLE_ADD_FUNC(numpunct_wchar_do_thousands_sep)
8720 VTABLE_ADD_FUNC(numpunct_wchar_do_grouping)
8721 VTABLE_ADD_FUNC(numpunct_wchar_do_falsename)
8722 VTABLE_ADD_FUNC(numpunct_wchar_do_truename));
8723 __ASM_VTABLE(numpunct_short,
8724 VTABLE_ADD_FUNC(numpunct_wchar_vector_dtor)
8725 VTABLE_ADD_FUNC(numpunct_wchar_do_decimal_point)
8726 VTABLE_ADD_FUNC(numpunct_wchar_do_thousands_sep)
8727 VTABLE_ADD_FUNC(numpunct_wchar_do_grouping)
8728 VTABLE_ADD_FUNC(numpunct_wchar_do_falsename)
8729 VTABLE_ADD_FUNC(numpunct_wchar_do_truename));
8730 __ASM_VTABLE(num_get_char,
8731 VTABLE_ADD_FUNC(num_get_char_vector_dtor)
8732 VTABLE_ADD_FUNC(num_get_char_do_get_void)
8733 VTABLE_ADD_FUNC(num_get_char_do_get_double)
8734 VTABLE_ADD_FUNC(num_get_char_do_get_double)
8735 VTABLE_ADD_FUNC(num_get_char_do_get_float)
8736 VTABLE_ADD_FUNC(num_get_char_do_get_uint64)
8737 VTABLE_ADD_FUNC(num_get_char_do_get_int64)
8738 VTABLE_ADD_FUNC(num_get_char_do_get_ulong)
8739 VTABLE_ADD_FUNC(num_get_char_do_get_long)
8740 VTABLE_ADD_FUNC(num_get_char_do_get_uint)
8741 VTABLE_ADD_FUNC(num_get_char_do_get_ushort)
8742 VTABLE_ADD_FUNC(num_get_char_do_get_bool));
8743 __ASM_VTABLE(num_get_short,
8744 VTABLE_ADD_FUNC(num_get_wchar_vector_dtor)
8745 VTABLE_ADD_FUNC(num_get_short_do_get_void)
8746 VTABLE_ADD_FUNC(num_get_short_do_get_double)
8747 VTABLE_ADD_FUNC(num_get_short_do_get_double)
8748 VTABLE_ADD_FUNC(num_get_short_do_get_float)
8749 VTABLE_ADD_FUNC(num_get_short_do_get_uint64)
8750 VTABLE_ADD_FUNC(num_get_short_do_get_int64)
8751 VTABLE_ADD_FUNC(num_get_short_do_get_ulong)
8752 VTABLE_ADD_FUNC(num_get_short_do_get_long)
8753 VTABLE_ADD_FUNC(num_get_short_do_get_uint)
8754 VTABLE_ADD_FUNC(num_get_short_do_get_ushort)
8755 VTABLE_ADD_FUNC(num_get_short_do_get_bool));
8756 __ASM_VTABLE(num_get_wchar,
8757 VTABLE_ADD_FUNC(num_get_wchar_vector_dtor)
8758 VTABLE_ADD_FUNC(num_get_wchar_do_get_void)
8759 VTABLE_ADD_FUNC(num_get_wchar_do_get_double)
8760 VTABLE_ADD_FUNC(num_get_wchar_do_get_double)
8761 VTABLE_ADD_FUNC(num_get_wchar_do_get_float)
8762 VTABLE_ADD_FUNC(num_get_wchar_do_get_uint64)
8763 VTABLE_ADD_FUNC(num_get_wchar_do_get_int64)
8764 VTABLE_ADD_FUNC(num_get_wchar_do_get_ulong)
8765 VTABLE_ADD_FUNC(num_get_wchar_do_get_long)
8766 VTABLE_ADD_FUNC(num_get_wchar_do_get_uint)
8767 VTABLE_ADD_FUNC(num_get_wchar_do_get_ushort)
8768 VTABLE_ADD_FUNC(num_get_wchar_do_get_bool));
8769 __ASM_VTABLE(num_put_char,
8770 VTABLE_ADD_FUNC(num_put_char_vector_dtor)
8771 VTABLE_ADD_FUNC(num_put_char_do_put_ptr)
8772 VTABLE_ADD_FUNC(num_put_char_do_put_double)
8773 VTABLE_ADD_FUNC(num_put_char_do_put_double)
8774 VTABLE_ADD_FUNC(num_put_char_do_put_uint64)
8775 VTABLE_ADD_FUNC(num_put_char_do_put_int64)
8776 VTABLE_ADD_FUNC(num_put_char_do_put_ulong)
8777 VTABLE_ADD_FUNC(num_put_char_do_put_long)
8778 VTABLE_ADD_FUNC(num_put_char_do_put_bool));
8779 __ASM_VTABLE(num_put_wchar,
8780 VTABLE_ADD_FUNC(num_put_wchar_vector_dtor)
8781 VTABLE_ADD_FUNC(num_put_wchar_do_put_ptr)
8782 VTABLE_ADD_FUNC(num_put_wchar_do_put_double)
8783 VTABLE_ADD_FUNC(num_put_wchar_do_put_double)
8784 VTABLE_ADD_FUNC(num_put_wchar_do_put_uint64)
8785 VTABLE_ADD_FUNC(num_put_wchar_do_put_int64)
8786 VTABLE_ADD_FUNC(num_put_wchar_do_put_ulong)
8787 VTABLE_ADD_FUNC(num_put_wchar_do_put_long)
8788 VTABLE_ADD_FUNC(num_put_wchar_do_put_bool));
8789 __ASM_VTABLE(num_put_short,
8790 VTABLE_ADD_FUNC(num_put_wchar_vector_dtor)
8791 VTABLE_ADD_FUNC(num_put_short_do_put_ptr)
8792 VTABLE_ADD_FUNC(num_put_short_do_put_double)
8793 VTABLE_ADD_FUNC(num_put_short_do_put_double)
8794 VTABLE_ADD_FUNC(num_put_short_do_put_uint64)
8795 VTABLE_ADD_FUNC(num_put_short_do_put_int64)
8796 VTABLE_ADD_FUNC(num_put_short_do_put_ulong)
8797 VTABLE_ADD_FUNC(num_put_short_do_put_long)
8798 VTABLE_ADD_FUNC(num_put_short_do_put_bool));
8799 __ASM_VTABLE(time_put_char,
8800 VTABLE_ADD_FUNC(time_put_char_vector_dtor)
8801 VTABLE_ADD_FUNC(time_put_char_do_put));
8802 __ASM_VTABLE(time_put_wchar,
8803 VTABLE_ADD_FUNC(time_put_wchar_vector_dtor)
8804 VTABLE_ADD_FUNC(time_put_wchar_do_put));
8805 __ASM_VTABLE(time_put_short,
8806 VTABLE_ADD_FUNC(time_put_wchar_vector_dtor)
8807 VTABLE_ADD_FUNC(time_put_wchar_do_put));
8808 #ifndef __GNUC__
8810 #endif
8812 void init_locale(void *base)
8814 #ifdef __x86_64__
8815 init_locale_facet_rtti(base);
8816 init_collate_char_rtti(base);
8817 init_collate_wchar_rtti(base);
8818 init_collate_short_rtti(base);
8819 init_ctype_base_rtti(base);
8820 init_ctype_char_rtti(base);
8821 init_ctype_wchar_rtti(base);
8822 init_ctype_short_rtti(base);
8823 init_codecvt_base_rtti(base);
8824 init_codecvt_char_rtti(base);
8825 init_codecvt_wchar_rtti(base);
8826 init_codecvt_short_rtti(base);
8827 init_numpunct_char_rtti(base);
8828 init_numpunct_wchar_rtti(base);
8829 init_numpunct_short_rtti(base);
8830 init_num_get_char_rtti(base);
8831 init_num_get_wchar_rtti(base);
8832 init_num_get_short_rtti(base);
8833 init_num_put_char_rtti(base);
8834 init_num_put_wchar_rtti(base);
8835 init_num_put_short_rtti(base);
8836 init_time_put_char_rtti(base);
8837 init_time_put_wchar_rtti(base);
8838 init_time_put_short_rtti(base);
8839 #endif
8842 void free_locale(void)
8844 facets_elem *iter, *safe;
8846 if(global_locale) {
8847 locale_dtor(&classic_locale);
8848 locale__Locimp_dtor(global_locale);
8849 MSVCRT_operator_delete(global_locale);
8852 LIST_FOR_EACH_ENTRY_SAFE(iter, safe, &lazy_facets, facets_elem, entry) {
8853 list_remove(&iter->entry);
8854 if(locale_facet__Decref(iter->fac))
8855 call_locale_facet_vector_dtor(iter->fac, 1);
8856 MSVCRT_operator_delete(iter);