d3d8: Get rid of the format switching code in d3d8_device_CopyRects().
[wine.git] / dlls / msvcp60 / locale.c
blob326a51a39541d88ef522b1a1014bc41e03e34ea2
1 /*
2 * Copyright 2010 Piotr Caban for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #include "config.h"
21 #include <stdarg.h>
23 #include "msvcp.h"
24 #include "locale.h"
25 #include "errno.h"
26 #include "limits.h"
27 #include "math.h"
28 #include "stdio.h"
29 #include "wctype.h"
30 #include "time.h"
32 #include "wine/list.h"
34 #include "windef.h"
35 #include "winbase.h"
36 #include "winnls.h"
37 #include "wine/unicode.h"
38 #include "wine/debug.h"
39 WINE_DEFAULT_DEBUG_CHANNEL(msvcp);
41 char* __cdecl _Getdays(void);
42 char* __cdecl _Getmonths(void);
43 void* __cdecl _Gettnames(void);
44 unsigned int __cdecl ___lc_codepage_func(void);
45 LCID* __cdecl ___lc_handle_func(void);
46 const locale_facet* __thiscall locale__Getfacet(const locale*, MSVCP_size_t, MSVCP_bool);
47 MSVCP_size_t __cdecl _Strftime(char*, MSVCP_size_t, const char*,
48 const struct tm*, struct __lc_time_data*);
50 typedef int category;
52 typedef struct _locale__Locimp {
53 locale_facet facet;
54 locale_facet **facetvec;
55 MSVCP_size_t facet_cnt;
56 category catmask;
57 MSVCP_bool transparent;
58 basic_string_char name;
59 } locale__Locimp;
61 typedef struct {
62 void *timeptr;
63 } _Timevec;
65 typedef struct {
66 _Lockit lock;
67 basic_string_char days;
68 basic_string_char months;
69 basic_string_char oldlocname;
70 basic_string_char newlocname;
71 } _Locinfo;
73 typedef struct {
74 LCID handle;
75 unsigned page;
76 } _Collvec;
78 typedef struct {
79 locale_facet facet;
80 _Collvec coll;
81 } collate;
83 typedef struct {
84 locale_facet facet;
85 const char *grouping;
86 char dp;
87 char sep;
88 const char *false_name;
89 const char *true_name;
90 } numpunct_char;
92 typedef struct {
93 locale_facet facet;
94 const char *grouping;
95 wchar_t dp;
96 wchar_t sep;
97 const wchar_t *false_name;
98 const wchar_t *true_name;
99 } numpunct_wchar;
101 typedef struct {
102 locale_facet facet;
103 _Timevec time;
104 _Cvtvec cvt;
105 } time_put;
107 /* ?_Id_cnt@id@locale@std@@0HA */
108 int locale_id__Id_cnt = 0;
110 static locale classic_locale;
112 /* ?_Global@_Locimp@locale@std@@0PAV123@A */
113 /* ?_Global@_Locimp@locale@std@@0PEAV123@EA */
114 locale__Locimp *global_locale = NULL;
116 /* ?_Clocptr@_Locimp@locale@std@@0PAV123@A */
117 /* ?_Clocptr@_Locimp@locale@std@@0PEAV123@EA */
118 locale__Locimp *locale__Locimp__Clocptr = NULL;
120 static char istreambuf_iterator_char_val(istreambuf_iterator_char *this)
122 if(this->strbuf && !this->got) {
123 int c = basic_streambuf_char_sgetc(this->strbuf);
124 if(c == EOF)
125 this->strbuf = NULL;
126 else
127 this->val = c;
130 this->got = TRUE;
131 return this->val;
134 static wchar_t istreambuf_iterator_wchar_val(istreambuf_iterator_wchar *this)
136 if(this->strbuf && !this->got) {
137 unsigned short c = basic_streambuf_wchar_sgetc(this->strbuf);
138 if(c == WEOF)
139 this->strbuf = NULL;
140 else
141 this->val = c;
144 this->got = TRUE;
145 return this->val;
148 static void istreambuf_iterator_char_inc(istreambuf_iterator_char *this)
150 if(!this->strbuf || basic_streambuf_char_sbumpc(this->strbuf)==EOF) {
151 this->strbuf = NULL;
152 this->got = TRUE;
153 }else {
154 this->got = FALSE;
155 istreambuf_iterator_char_val(this);
159 static void istreambuf_iterator_wchar_inc(istreambuf_iterator_wchar *this)
161 if(!this->strbuf || basic_streambuf_wchar_sbumpc(this->strbuf)==WEOF) {
162 this->strbuf = NULL;
163 this->got = TRUE;
164 }else {
165 this->got = FALSE;
166 istreambuf_iterator_wchar_val(this);
170 static void ostreambuf_iterator_char_put(ostreambuf_iterator_char *this, char ch)
172 if(this->failed || basic_streambuf_char_sputc(this->strbuf, ch)==EOF)
173 this->failed = TRUE;
176 static void ostreambuf_iterator_wchar_put(ostreambuf_iterator_wchar *this, wchar_t ch)
178 if(this->failed || basic_streambuf_wchar_sputc(this->strbuf, ch)==WEOF)
179 this->failed = TRUE;
182 /* ??1facet@locale@std@@UAE@XZ */
183 /* ??1facet@locale@std@@UEAA@XZ */
184 DEFINE_THISCALL_WRAPPER(locale_facet_dtor, 4)
185 void __thiscall locale_facet_dtor(locale_facet *this)
187 TRACE("(%p)\n", this);
190 DEFINE_THISCALL_WRAPPER(locale_facet_vector_dtor, 8)
191 #define call_locale_facet_vector_dtor(this, flags) CALL_VTBL_FUNC(this, 0, \
192 locale_facet*, (locale_facet*, unsigned int), (this, flags))
193 locale_facet* __thiscall locale_facet_vector_dtor(locale_facet *this, unsigned int flags)
195 TRACE("(%p %x)\n", this, flags);
196 if(flags & 2) {
197 /* we have an array, with the number of elements stored before the first object */
198 INT_PTR i, *ptr = (INT_PTR *)this-1;
200 for(i=*ptr-1; i>=0; i--)
201 locale_facet_dtor(this+i);
202 MSVCRT_operator_delete(ptr);
203 } else {
204 locale_facet_dtor(this);
205 if(flags & 1)
206 MSVCRT_operator_delete(this);
209 return this;
212 typedef struct
214 locale_facet *fac;
215 struct list entry;
216 } facets_elem;
217 static struct list lazy_facets = LIST_INIT(lazy_facets);
219 /* Not exported from msvcp90 */
220 /* ?facet_Register@facet@locale@std@@CAXPAV123@@Z */
221 /* ?facet_Register@facet@locale@std@@CAXPEAV123@@Z */
222 static void locale_facet_register(locale_facet *add)
224 facets_elem *head = MSVCRT_operator_new(sizeof(*head));
225 if(!head) {
226 ERR("Out of memory\n");
227 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
230 head->fac = add;
231 list_add_head(&lazy_facets, &head->entry);
234 /* Not exported from msvcp90 */
235 /* ??_7facet@locale@std@@6B@ */
236 extern const vtable_ptr MSVCP_locale_facet_vtable;
238 /* ??Bid@locale@std@@QAEIXZ */
239 /* ??Bid@locale@std@@QEAA_KXZ */
240 DEFINE_THISCALL_WRAPPER(locale_id_operator_size_t, 4)
241 MSVCP_size_t __thiscall locale_id_operator_size_t(locale_id *this)
243 _Lockit lock;
245 TRACE("(%p)\n", this);
247 if(!this->id) {
248 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
249 this->id = ++locale_id__Id_cnt;
250 _Lockit_dtor(&lock);
253 return this->id;
256 /* ??_Ffacet@locale@std@@QAEXXZ */
257 /* ??_Ffacet@locale@std@@QEAAXXZ */
258 DEFINE_THISCALL_WRAPPER(locale_facet_ctor, 4)
259 locale_facet* __thiscall locale_facet_ctor(locale_facet *this)
261 TRACE("(%p)\n", this);
262 this->vtable = &MSVCP_locale_facet_vtable;
263 this->refs = 0;
264 return this;
267 /* ??0facet@locale@std@@IAE@I@Z */
268 /* ??0facet@locale@std@@IEAA@_K@Z */
269 DEFINE_THISCALL_WRAPPER(locale_facet_ctor_refs, 8)
270 locale_facet* __thiscall locale_facet_ctor_refs(locale_facet *this, MSVCP_size_t refs)
272 TRACE("(%p %lu)\n", this, refs);
273 this->vtable = &MSVCP_locale_facet_vtable;
274 this->refs = refs;
275 return this;
278 /* ?_Incref@facet@locale@std@@QAEXXZ */
279 /* ?_Incref@facet@locale@std@@QEAAXXZ */
280 DEFINE_THISCALL_WRAPPER(locale_facet__Incref, 4)
281 void __thiscall locale_facet__Incref(locale_facet *this)
283 _Lockit lock;
285 TRACE("(%p)\n", this);
287 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
288 this->refs++;
289 _Lockit_dtor(&lock);
292 /* ?_Decref@facet@locale@std@@QAEPAV123@XZ */
293 /* ?_Decref@facet@locale@std@@QEAAPEAV123@XZ */
294 DEFINE_THISCALL_WRAPPER(locale_facet__Decref, 4)
295 locale_facet* __thiscall locale_facet__Decref(locale_facet *this)
297 _Lockit lock;
298 locale_facet *ret;
300 TRACE("(%p)\n", this);
302 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
303 if(this->refs)
304 this->refs--;
306 ret = this->refs ? NULL : this;
307 _Lockit_dtor(&lock);
309 return ret;
312 /* ??0_Timevec@std@@QAE@ABV01@@Z */
313 /* ??0_Timevec@std@@QEAA@AEBV01@@Z */
314 /* This copy constructor modifies copied object */
315 DEFINE_THISCALL_WRAPPER(_Timevec_copy_ctor, 8)
316 _Timevec* __thiscall _Timevec_copy_ctor(_Timevec *this, _Timevec *copy)
318 TRACE("(%p %p)\n", this, copy);
319 this->timeptr = copy->timeptr;
320 copy->timeptr = NULL;
321 return this;
324 /* ??0_Timevec@std@@QAE@PAX@Z */
325 /* ??0_Timevec@std@@QEAA@PEAX@Z */
326 DEFINE_THISCALL_WRAPPER(_Timevec_ctor_timeptr, 8)
327 _Timevec* __thiscall _Timevec_ctor_timeptr(_Timevec *this, void *timeptr)
329 TRACE("(%p %p)\n", this, timeptr);
330 this->timeptr = timeptr;
331 return this;
334 /* ??_F_Timevec@std@@QAEXXZ */
335 /* ??_F_Timevec@std@@QEAAXXZ */
336 DEFINE_THISCALL_WRAPPER(_Timevec_ctor, 4)
337 _Timevec* __thiscall _Timevec_ctor(_Timevec *this)
339 TRACE("(%p)\n", this);
340 this->timeptr = NULL;
341 return this;
344 /* ??1_Timevec@std@@QAE@XZ */
345 /* ??1_Timevec@std@@QEAA@XZ */
346 DEFINE_THISCALL_WRAPPER(_Timevec_dtor, 4)
347 void __thiscall _Timevec_dtor(_Timevec *this)
349 TRACE("(%p)\n", this);
350 free(this->timeptr);
353 /* ??4_Timevec@std@@QAEAAV01@ABV01@@Z */
354 /* ??4_Timevec@std@@QEAAAEAV01@AEBV01@@Z */
355 DEFINE_THISCALL_WRAPPER(_Timevec_op_assign, 8)
356 _Timevec* __thiscall _Timevec_op_assign(_Timevec *this, _Timevec *right)
358 TRACE("(%p %p)\n", this, right);
359 this->timeptr = right->timeptr;
360 right->timeptr = NULL;
361 return this;
364 /* ?_Getptr@_Timevec@std@@QBEPAXXZ */
365 /* ?_Getptr@_Timevec@std@@QEBAPEAXXZ */
366 DEFINE_THISCALL_WRAPPER(_Timevec__Getptr, 4)
367 void* __thiscall _Timevec__Getptr(_Timevec *this)
369 TRACE("(%p)\n", this);
370 return this->timeptr;
373 /* ?_Locinfo_ctor@_Locinfo@std@@SAXPAV12@HPBD@Z */
374 /* ?_Locinfo_ctor@_Locinfo@std@@SAXPEAV12@HPEBD@Z */
375 static _Locinfo* _Locinfo__Locinfo_ctor_cat_cstr(_Locinfo *locinfo, int category, const char *locstr)
377 const char *locale = NULL;
379 /* This function is probably modifying more global objects */
380 FIXME("(%p %d %s) semi-stub\n", locinfo, category, locstr);
382 if(!locstr)
383 throw_exception(EXCEPTION_RUNTIME_ERROR, "bad locale name");
385 _Lockit_ctor_locktype(&locinfo->lock, _LOCK_LOCALE);
386 basic_string_char_ctor_cstr(&locinfo->days, "");
387 basic_string_char_ctor_cstr(&locinfo->months, "");
388 basic_string_char_ctor_cstr(&locinfo->oldlocname, setlocale(LC_ALL, NULL));
390 if(category)
391 locale = setlocale(LC_ALL, locstr);
392 else
393 locale = setlocale(LC_ALL, NULL);
395 if(locale)
396 basic_string_char_ctor_cstr(&locinfo->newlocname, locale);
397 else
398 basic_string_char_ctor_cstr(&locinfo->newlocname, "*");
400 return locinfo;
403 /* ??0_Locinfo@std@@QAE@HPBD@Z */
404 /* ??0_Locinfo@std@@QEAA@HPEBD@Z */
405 DEFINE_THISCALL_WRAPPER(_Locinfo_ctor_cat_cstr, 12)
406 _Locinfo* __thiscall _Locinfo_ctor_cat_cstr(_Locinfo *this, int category, const char *locstr)
408 return _Locinfo__Locinfo_ctor_cat_cstr(this, category, locstr);
411 /* ??0_Locinfo@std@@QAE@PBD@Z */
412 /* ??0_Locinfo@std@@QEAA@PEBD@Z */
413 DEFINE_THISCALL_WRAPPER(_Locinfo_ctor_cstr, 8)
414 _Locinfo* __thiscall _Locinfo_ctor_cstr(_Locinfo *this, const char *locstr)
416 return _Locinfo__Locinfo_ctor_cat_cstr(this, 1/*FIXME*/, locstr);
419 /* ?_Locinfo_dtor@_Locinfo@std@@SAXPAV12@@Z */
420 /* ?_Locinfo_dtor@_Locinfo@std@@SAXPEAV12@@Z */
421 static void _Locinfo__Locinfo_dtor(_Locinfo *locinfo)
423 TRACE("(%p)\n", locinfo);
425 setlocale(LC_ALL, basic_string_char_c_str(&locinfo->oldlocname));
426 basic_string_char_dtor(&locinfo->days);
427 basic_string_char_dtor(&locinfo->months);
428 basic_string_char_dtor(&locinfo->oldlocname);
429 basic_string_char_dtor(&locinfo->newlocname);
430 _Lockit_dtor(&locinfo->lock);
433 /* ??_F_Locinfo@std@@QAEXXZ */
434 /* ??_F_Locinfo@std@@QEAAXXZ */
435 DEFINE_THISCALL_WRAPPER(_Locinfo_ctor, 4)
436 _Locinfo* __thiscall _Locinfo_ctor(_Locinfo *this)
438 return _Locinfo__Locinfo_ctor_cat_cstr(this, 1/*FIXME*/, "C");
441 /* ??1_Locinfo@std@@QAE@XZ */
442 /* ??1_Locinfo@std@@QEAA@XZ */
443 DEFINE_THISCALL_WRAPPER(_Locinfo_dtor, 4)
444 void __thiscall _Locinfo_dtor(_Locinfo *this)
446 _Locinfo__Locinfo_dtor(this);
449 /* ?_Locinfo_Addcats@_Locinfo@std@@SAAAV12@PAV12@HPBD@Z */
450 /* ?_Locinfo_Addcats@_Locinfo@std@@SAAEAV12@PEAV12@HPEBD@Z */
451 static _Locinfo* _Locinfo__Locinfo_Addcats(_Locinfo *locinfo, int category, const char *locstr)
453 const char *locale = NULL;
455 /* This function is probably modifying more global objects */
456 FIXME("(%p %d %s) semi-stub\n", locinfo, category, locstr);
457 if(!locstr)
458 throw_exception(EXCEPTION_RUNTIME_ERROR, "bad locale name");
460 basic_string_char_dtor(&locinfo->newlocname);
462 if(category)
463 locale = setlocale(LC_ALL, locstr);
464 else
465 locale = setlocale(LC_ALL, NULL);
467 if(locale)
468 basic_string_char_ctor_cstr(&locinfo->newlocname, locale);
469 else
470 basic_string_char_ctor_cstr(&locinfo->newlocname, "*");
472 return locinfo;
475 /* ?_Addcats@_Locinfo@std@@QAEAAV12@HPBD@Z */
476 /* ?_Addcats@_Locinfo@std@@QEAAAEAV12@HPEBD@Z */
477 DEFINE_THISCALL_WRAPPER(_Locinfo__Addcats, 12)
478 _Locinfo* __thiscall _Locinfo__Addcats(_Locinfo *this, int category, const char *locstr)
480 return _Locinfo__Locinfo_Addcats(this, category, locstr);
483 /* _Getcoll */
484 ULONGLONG __cdecl _Getcoll(void)
486 union {
487 _Collvec collvec;
488 ULONGLONG ull;
489 } ret;
490 _locale_t locale = _get_current_locale();
492 TRACE("\n");
494 ret.collvec.page = locale->locinfo->lc_collate_cp;
495 ret.collvec.handle = locale->locinfo->lc_handle[LC_COLLATE];
496 _free_locale(locale);
497 return ret.ull;
500 /* ?_Getcoll@_Locinfo@std@@QBE?AU_Collvec@@XZ */
501 /* ?_Getcoll@_Locinfo@std@@QEBA?AU_Collvec@@XZ */
502 DEFINE_THISCALL_WRAPPER(_Locinfo__Getcoll, 8)
503 _Collvec* __thiscall _Locinfo__Getcoll(const _Locinfo *this, _Collvec *ret)
505 ULONGLONG ull = _Getcoll();
506 memcpy(ret, &ull, sizeof(ull));
507 return ret;
510 /* _Getctype */
511 _Ctypevec* __cdecl _Getctype(_Ctypevec *ret)
513 _locale_t locale = _get_current_locale();
514 short *table;
516 TRACE("\n");
518 ret->page = locale->locinfo->lc_codepage;
519 ret->handle = locale->locinfo->lc_handle[LC_COLLATE];
520 ret->delfl = TRUE;
521 table = malloc(sizeof(short[256]));
522 if(!table) {
523 _free_locale(locale);
524 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
526 memcpy(table, locale->locinfo->pctype, sizeof(short[256]));
527 ret->table = table;
528 _free_locale(locale);
529 return ret;
532 /* ?_Getctype@_Locinfo@std@@QBE?AU_Ctypevec@@XZ */
533 /* ?_Getctype@_Locinfo@std@@QEBA?AU_Ctypevec@@XZ */
534 DEFINE_THISCALL_WRAPPER(_Locinfo__Getctype, 8)
535 _Ctypevec* __thiscall _Locinfo__Getctype(const _Locinfo *this, _Ctypevec *ret)
537 return _Getctype(ret);
540 /* _Getcvt */
541 ULONGLONG __cdecl _Getcvt(void)
543 _locale_t locale = _get_current_locale();
544 union {
545 _Cvtvec cvtvec;
546 ULONGLONG ull;
547 } ret;
549 TRACE("\n");
551 ret.cvtvec.page = locale->locinfo->lc_codepage;
552 ret.cvtvec.handle = locale->locinfo->lc_handle[LC_CTYPE];
553 _free_locale(locale);
554 return ret.ull;
557 /* ?_Getcvt@_Locinfo@std@@QBE?AU_Cvtvec@@XZ */
558 /* ?_Getcvt@_Locinfo@std@@QEBA?AU_Cvtvec@@XZ */
559 DEFINE_THISCALL_WRAPPER(_Locinfo__Getcvt, 8)
560 _Cvtvec* __thiscall _Locinfo__Getcvt(const _Locinfo *this, _Cvtvec *ret)
562 ULONGLONG ull = _Getcvt();
563 memcpy(ret, &ull, sizeof(ull));
564 return ret;
567 /* ?_Getdays@_Locinfo@std@@QBEPBDXZ */
568 /* ?_Getdays@_Locinfo@std@@QEBAPEBDXZ */
569 DEFINE_THISCALL_WRAPPER(_Locinfo__Getdays, 4)
570 const char* __thiscall _Locinfo__Getdays(_Locinfo *this)
572 char *days = _Getdays();
574 TRACE("(%p)\n", this);
576 if(days) {
577 basic_string_char_dtor(&this->days);
578 basic_string_char_ctor_cstr(&this->days, days);
579 free(days);
582 return this->days.size ? basic_string_char_c_str(&this->days) :
583 ":Sun:Sunday:Mon:Monday:Tue:Tuesday:Wed:Wednesday:Thu:Thursday:Fri:Friday:Sat:Saturday";
586 /* ?_Getmonths@_Locinfo@std@@QBEPBDXZ */
587 /* ?_Getmonths@_Locinfo@std@@QEBAPEBDXZ */
588 DEFINE_THISCALL_WRAPPER(_Locinfo__Getmonths, 4)
589 const char* __thiscall _Locinfo__Getmonths(_Locinfo *this)
591 char *months = _Getmonths();
593 TRACE("(%p)\n", this);
595 if(months) {
596 basic_string_char_dtor(&this->months);
597 basic_string_char_ctor_cstr(&this->months, months);
598 free(months);
601 return this->months.size ? basic_string_char_c_str(&this->months) :
602 ":Jan:January:Feb:February:Mar:March:Apr:April:May:May:Jun:June:Jul:July"
603 ":Aug:August:Sep:September:Oct:October:Nov:November:Dec:December";
606 /* ?_Getfalse@_Locinfo@std@@QBEPBDXZ */
607 /* ?_Getfalse@_Locinfo@std@@QEBAPEBDXZ */
608 DEFINE_THISCALL_WRAPPER(_Locinfo__Getfalse, 4)
609 const char* __thiscall _Locinfo__Getfalse(const _Locinfo *this)
611 TRACE("(%p)\n", this);
612 return "false";
615 /* ?_Gettrue@_Locinfo@std@@QBEPBDXZ */
616 /* ?_Gettrue@_Locinfo@std@@QEBAPEBDXZ */
617 DEFINE_THISCALL_WRAPPER(_Locinfo__Gettrue, 4)
618 const char* __thiscall _Locinfo__Gettrue(const _Locinfo *this)
620 TRACE("(%p)\n", this);
621 return "true";
624 /* ?_Getlconv@_Locinfo@std@@QBEPBUlconv@@XZ */
625 /* ?_Getlconv@_Locinfo@std@@QEBAPEBUlconv@@XZ */
626 DEFINE_THISCALL_WRAPPER(_Locinfo__Getlconv, 4)
627 const struct lconv* __thiscall _Locinfo__Getlconv(const _Locinfo *this)
629 TRACE("(%p)\n", this);
630 return localeconv();
633 /* ?_Getname@_Locinfo@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
634 /* ?_Getname@_Locinfo@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
635 DEFINE_THISCALL_WRAPPER(_Locinfo__Getname, 8)
636 basic_string_char* __thiscall _Locinfo__Getname(const _Locinfo *this, basic_string_char *ret)
638 TRACE("(%p)\n", this);
640 basic_string_char_copy_ctor(ret, &this->newlocname);
641 return ret;
644 /* ?_Gettnames@_Locinfo@std@@QBE?AV_Timevec@2@XZ */
645 /* ?_Gettnames@_Locinfo@std@@QEBA?AV_Timevec@2@XZ */
646 DEFINE_THISCALL_WRAPPER(_Locinfo__Gettnames, 8)
647 _Timevec*__thiscall _Locinfo__Gettnames(const _Locinfo *this, _Timevec *ret)
649 TRACE("(%p)\n", this);
651 _Timevec_ctor_timeptr(ret, _Gettnames());
652 return ret;
655 /* ?id@?$collate@D@std@@2V0locale@2@A */
656 locale_id collate_char_id = {0};
658 /* ??_7?$collate@D@std@@6B@ */
659 extern const vtable_ptr MSVCP_collate_char_vtable;
661 /* ?_Init@?$collate@D@std@@IAEXABV_Locinfo@2@@Z */
662 /* ?_Init@?$collate@D@std@@IEAAXAEBV_Locinfo@2@@Z */
663 DEFINE_THISCALL_WRAPPER(collate_char__Init, 8)
664 void __thiscall collate_char__Init(collate *this, const _Locinfo *locinfo)
666 TRACE("(%p %p)\n", this, locinfo);
667 _Locinfo__Getcoll(locinfo, &this->coll);
670 /* ??0?$collate@D@std@@IAE@PBDI@Z */
671 /* ??0?$collate@D@std@@IEAA@PEBD_K@Z */
672 static collate* collate_char_ctor_name(collate *this, const char *name, MSVCP_size_t refs)
674 _Locinfo locinfo;
676 TRACE("(%p %s %lu)\n", this, name, refs);
678 locale_facet_ctor_refs(&this->facet, refs);
679 this->facet.vtable = &MSVCP_collate_char_vtable;
681 _Locinfo_ctor_cstr(&locinfo, name);
682 collate_char__Init(this, &locinfo);
683 _Locinfo_dtor(&locinfo);
684 return this;
687 /* ??0?$collate@D@std@@QAE@ABV_Locinfo@1@I@Z */
688 /* ??0?$collate@D@std@@QEAA@AEBV_Locinfo@1@_K@Z */
689 DEFINE_THISCALL_WRAPPER(collate_char_ctor_locinfo, 12)
690 collate* __thiscall collate_char_ctor_locinfo(collate *this, const _Locinfo *locinfo, MSVCP_size_t refs)
692 TRACE("(%p %p %lu)\n", this, locinfo, refs);
694 locale_facet_ctor_refs(&this->facet, refs);
695 this->facet.vtable = &MSVCP_collate_char_vtable;
696 collate_char__Init(this, locinfo);
697 return this;
700 /* ??0?$collate@D@std@@QAE@I@Z */
701 /* ??0?$collate@D@std@@QEAA@_K@Z */
702 DEFINE_THISCALL_WRAPPER(collate_char_ctor_refs, 8)
703 collate* __thiscall collate_char_ctor_refs(collate *this, MSVCP_size_t refs)
705 return collate_char_ctor_name(this, "C", refs);
708 /* ??1?$collate@D@std@@UAE@XZ */
709 /* ??1?$collate@D@std@@UEAA@XZ */
710 DEFINE_THISCALL_WRAPPER(collate_char_dtor, 4)
711 void __thiscall collate_char_dtor(collate *this)
713 TRACE("(%p)\n", this);
716 DEFINE_THISCALL_WRAPPER(collate_char_vector_dtor, 8)
717 collate* __thiscall collate_char_vector_dtor(collate *this, unsigned int flags)
719 TRACE("(%p %x)\n", this, flags);
720 if(flags & 2) {
721 /* we have an array, with the number of elements stored before the first object */
722 INT_PTR i, *ptr = (INT_PTR *)this-1;
724 for(i=*ptr-1; i>=0; i--)
725 collate_char_dtor(this+i);
726 MSVCRT_operator_delete(ptr);
727 } else {
728 collate_char_dtor(this);
729 if(flags & 1)
730 MSVCRT_operator_delete(this);
733 return this;
736 /* ??_F?$collate@D@std@@QAEXXZ */
737 /* ??_F?$collate@D@std@@QEAAXXZ */
738 DEFINE_THISCALL_WRAPPER(collate_char_ctor, 4)
739 collate* __thiscall collate_char_ctor(collate *this)
741 return collate_char_ctor_name(this, "C", 0);
744 /* ?_Getcat@?$collate@D@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
745 /* ?_Getcat@?$collate@D@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
746 static MSVCP_size_t collate_char__Getcat(const locale_facet **facet, const locale *loc)
748 TRACE("(%p %p)\n", facet, loc);
750 if(facet && !*facet) {
751 *facet = MSVCRT_operator_new(sizeof(collate));
752 if(!*facet) {
753 ERR("Out of memory\n");
754 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
755 return 0;
757 collate_char_ctor_name((collate*)*facet,
758 basic_string_char_c_str(&loc->ptr->name), 0);
761 return LC_COLLATE;
764 static collate* collate_char_use_facet(const locale *loc)
766 static collate *obj = NULL;
768 _Lockit lock;
769 const locale_facet *fac;
771 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
772 fac = locale__Getfacet(loc, locale_id_operator_size_t(&collate_char_id), TRUE);
773 if(fac) {
774 _Lockit_dtor(&lock);
775 return (collate*)fac;
778 if(obj) {
779 _Lockit_dtor(&lock);
780 return obj;
783 collate_char__Getcat(&fac, loc);
784 obj = (collate*)fac;
785 locale_facet__Incref(&obj->facet);
786 locale_facet_register(&obj->facet);
787 _Lockit_dtor(&lock);
789 return obj;
792 /* _Strcoll */
793 int __cdecl _Strcoll(const char *first1, const char *last1, const char *first2,
794 const char *last2, const _Collvec *coll)
796 LCID lcid;
798 TRACE("(%s %s)\n", debugstr_an(first1, last1-first1), debugstr_an(first2, last2-first2));
800 if(coll)
801 lcid = coll->handle;
802 else
803 lcid = ___lc_handle_func()[LC_COLLATE];
804 return CompareStringA(lcid, 0, first1, last1-first1, first2, last2-first2)-CSTR_EQUAL;
807 /* ?do_compare@?$collate@D@std@@MBEHPBD000@Z */
808 /* ?do_compare@?$collate@D@std@@MEBAHPEBD000@Z */
809 DEFINE_THISCALL_WRAPPER(collate_char_do_compare, 20)
810 #define call_collate_char_do_compare(this, first1, last1, first2, last2) CALL_VTBL_FUNC(this, 4, int, \
811 (const collate*, const char*, const char*, const char*, const char*), \
812 (this, first1, last1, first2, last2))
813 int __thiscall collate_char_do_compare(const collate *this, const char *first1,
814 const char *last1, const char *first2, const char *last2)
816 TRACE("(%p %p %p %p %p)\n", this, first1, last1, first2, last2);
817 return _Strcoll(first1, last1, first2, last2, &this->coll);
820 /* ?compare@?$collate@D@std@@QBEHPBD000@Z */
821 /* ?compare@?$collate@D@std@@QEBAHPEBD000@Z */
822 DEFINE_THISCALL_WRAPPER(collate_char_compare, 20)
823 int __thiscall collate_char_compare(const collate *this, const char *first1,
824 const char *last1, const char *first2, const char *last2)
826 TRACE("(%p %p %p %p %p)\n", this, first1, last1, first2, last2);
827 return call_collate_char_do_compare(this, first1, last1, first2, last2);
830 /* ?do_hash@?$collate@D@std@@MBEJPBD0@Z */
831 /* ?do_hash@?$collate@D@std@@MEBAJPEBD0@Z */
832 DEFINE_THISCALL_WRAPPER(collate_char_do_hash, 12)
833 #define call_collate_char_do_hash(this, first, last) CALL_VTBL_FUNC(this, 12, LONG, \
834 (const collate*, const char*, const char*), (this, first, last))
835 LONG __thiscall collate_char_do_hash(const collate *this,
836 const char *first, const char *last)
838 ULONG ret = 0;
840 TRACE("(%p %p %p)\n", this, first, last);
842 for(; first<last; first++)
843 ret = (ret<<8 | ret>>24) + *first;
844 return ret;
847 /* ?hash@?$collate@D@std@@QBEJPBD0@Z */
848 /* ?hash@?$collate@D@std@@QEBAJPEBD0@Z */
849 DEFINE_THISCALL_WRAPPER(collate_char_hash, 12)
850 LONG __thiscall collate_char_hash(const collate *this,
851 const char *first, const char *last)
853 TRACE("(%p %p %p)\n", this, first, last);
854 return call_collate_char_do_hash(this, first, last);
857 /* ?do_transform@?$collate@D@std@@MBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@PBD0@Z */
858 /* ?do_transform@?$collate@D@std@@MEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@PEBD0@Z */
859 DEFINE_THISCALL_WRAPPER(collate_char_do_transform, 16)
860 basic_string_char* __thiscall collate_char_do_transform(const collate *this,
861 basic_string_char *ret, const char *first, const char *last)
863 FIXME("(%p %p %p) stub\n", this, first, last);
864 return ret;
867 /* ?transform@?$collate@D@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@PBD0@Z */
868 /* ?transform@?$collate@D@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@PEBD0@Z */
869 DEFINE_THISCALL_WRAPPER(collate_char_transform, 16)
870 basic_string_char* __thiscall collate_char_transform(const collate *this,
871 basic_string_char *ret, const char *first, const char *last)
873 FIXME("(%p %p %p) stub\n", this, first, last);
874 return ret;
877 /* ?id@?$collate@_W@std@@2V0locale@2@A */
878 static locale_id collate_wchar_id = {0};
879 /* ?id@?$collate@G@std@@2V0locale@2@A */
880 locale_id collate_short_id = {0};
882 /* ??_7?$collate@_W@std@@6B@ */
883 extern const vtable_ptr MSVCP_collate_wchar_vtable;
884 /* ??_7?$collate@G@std@@6B@ */
885 extern const vtable_ptr MSVCP_collate_short_vtable;
887 /* ?_Init@?$collate@_W@std@@IAEXABV_Locinfo@2@@Z */
888 /* ?_Init@?$collate@_W@std@@IEAAXAEBV_Locinfo@2@@Z */
889 /* ?_Init@?$collate@G@std@@IAEXABV_Locinfo@2@@Z */
890 /* ?_Init@?$collate@G@std@@IEAAXAEBV_Locinfo@2@@Z */
891 DEFINE_THISCALL_WRAPPER(collate_wchar__Init, 8)
892 void __thiscall collate_wchar__Init(collate *this, const _Locinfo *locinfo)
894 TRACE("(%p %p)\n", this, locinfo);
895 _Locinfo__Getcoll(locinfo, &this->coll);
898 /* ??0?$collate@_W@std@@IAE@PBDI@Z */
899 /* ??0?$collate@_W@std@@IEAA@PEBD_K@Z */
900 static collate* collate_wchar_ctor_name(collate *this, const char *name, MSVCP_size_t refs)
902 _Locinfo locinfo;
904 TRACE("(%p %s %lu)\n", this, name, refs);
906 locale_facet_ctor_refs(&this->facet, refs);
907 this->facet.vtable = &MSVCP_collate_wchar_vtable;
909 _Locinfo_ctor_cstr(&locinfo, name);
910 collate_wchar__Init(this, &locinfo);
911 _Locinfo_dtor(&locinfo);
912 return this;
915 /* ??0?$collate@_W@std@@QAE@ABV_Locinfo@1@I@Z */
916 /* ??0?$collate@_W@std@@QEAA@AEBV_Locinfo@1@_K@Z */
917 static collate* collate_wchar_ctor_locinfo(collate *this, const _Locinfo *locinfo, MSVCP_size_t refs)
919 TRACE("(%p %p %lu)\n", this, locinfo, refs);
921 locale_facet_ctor_refs(&this->facet, refs);
922 this->facet.vtable = &MSVCP_collate_wchar_vtable;
923 collate_wchar__Init(this, locinfo);
924 return this;
927 /* ??0?$collate@G@std@@QAE@ABV_Locinfo@1@I@Z */
928 /* ??0?$collate@G@std@@QEAA@AEBV_Locinfo@1@_K@Z */
929 DEFINE_THISCALL_WRAPPER(collate_short_ctor_locinfo, 12)
930 collate* __thiscall collate_short_ctor_locinfo(collate *this, const _Locinfo *locinfo, MSVCP_size_t refs)
932 collate *ret = collate_wchar_ctor_locinfo(this, locinfo, refs);
933 ret->facet.vtable = &MSVCP_collate_short_vtable;
934 return ret;
937 /* ??0?$collate@_W@std@@QAE@I@Z */
938 /* ??0?$collate@_W@std@@QEAA@_K@Z */
939 static collate* collate_wchar_ctor_refs(collate *this, MSVCP_size_t refs)
941 return collate_wchar_ctor_name(this, "C", refs);
944 /* ??0?$collate@G@std@@QAE@I@Z */
945 /* ??0?$collate@G@std@@QEAA@_K@Z */
946 DEFINE_THISCALL_WRAPPER(collate_short_ctor_refs, 8)
947 collate* __thiscall collate_short_ctor_refs(collate *this, MSVCP_size_t refs)
949 collate *ret = collate_wchar_ctor_refs(this, refs);
950 ret->facet.vtable = &MSVCP_collate_short_vtable;
951 return ret;
954 /* ??1?$collate@G@std@@UAE@XZ */
955 /* ??1?$collate@G@std@@UEAA@XZ */
956 DEFINE_THISCALL_WRAPPER(collate_wchar_dtor, 4)
957 void __thiscall collate_wchar_dtor(collate *this)
959 TRACE("(%p)\n", this);
962 DEFINE_THISCALL_WRAPPER(collate_wchar_vector_dtor, 8)
963 collate* __thiscall collate_wchar_vector_dtor(collate *this, unsigned int flags)
965 TRACE("(%p %x)\n", this, flags);
966 if(flags & 2) {
967 /* we have an array, with the number of elements stored before the first object */
968 INT_PTR i, *ptr = (INT_PTR *)this-1;
970 for(i=*ptr-1; i>=0; i--)
971 collate_wchar_dtor(this+i);
972 MSVCRT_operator_delete(ptr);
973 } else {
974 collate_wchar_dtor(this);
975 if(flags & 1)
976 MSVCRT_operator_delete(this);
979 return this;
982 /* ??_F?$collate@_W@std@@QAEXXZ */
983 /* ??_F?$collate@_W@std@@QEAAXXZ */
984 static collate* collate_wchar_ctor(collate *this)
986 return collate_wchar_ctor_name(this, "C", 0);
989 /* ??_F?$collate@G@std@@QAEXXZ */
990 /* ??_F?$collate@G@std@@QEAAXXZ */
991 DEFINE_THISCALL_WRAPPER(collate_short_ctor, 4)
992 collate* __thiscall collate_short_ctor(collate *this)
994 collate *ret = collate_wchar_ctor(this);
995 ret->facet.vtable = &MSVCP_collate_short_vtable;
996 return ret;
999 /* ?_Getcat@?$collate@_W@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
1000 /* ?_Getcat@?$collate@_W@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
1001 static MSVCP_size_t collate_wchar__Getcat(const locale_facet **facet, const locale *loc)
1003 TRACE("(%p %p)\n", facet, loc);
1005 if(facet && !*facet) {
1006 *facet = MSVCRT_operator_new(sizeof(collate));
1007 if(!*facet) {
1008 ERR("Out of memory\n");
1009 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
1010 return 0;
1012 collate_wchar_ctor_name((collate*)*facet,
1013 basic_string_char_c_str(&loc->ptr->name), 0);
1016 return LC_COLLATE;
1019 static collate* collate_wchar_use_facet(const locale *loc)
1021 static collate *obj = NULL;
1023 _Lockit lock;
1024 const locale_facet *fac;
1026 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
1027 fac = locale__Getfacet(loc, locale_id_operator_size_t(&collate_wchar_id), TRUE);
1028 if(fac) {
1029 _Lockit_dtor(&lock);
1030 return (collate*)fac;
1033 if(obj) {
1034 _Lockit_dtor(&lock);
1035 return obj;
1038 collate_wchar__Getcat(&fac, loc);
1039 obj = (collate*)fac;
1040 locale_facet__Incref(&obj->facet);
1041 locale_facet_register(&obj->facet);
1042 _Lockit_dtor(&lock);
1044 return obj;
1047 /* ?_Getcat@?$collate@G@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
1048 /* ?_Getcat@?$collate@G@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
1049 static MSVCP_size_t collate_short__Getcat(const locale_facet **facet, const locale *loc)
1051 if(facet && !*facet) {
1052 collate_wchar__Getcat(facet, loc);
1053 (*(locale_facet**)facet)->vtable = &MSVCP_collate_short_vtable;
1056 return LC_COLLATE;
1059 static collate* collate_short_use_facet(const locale *loc)
1061 static collate *obj = NULL;
1063 _Lockit lock;
1064 const locale_facet *fac;
1066 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
1067 fac = locale__Getfacet(loc, locale_id_operator_size_t(&collate_short_id), TRUE);
1068 if(fac) {
1069 _Lockit_dtor(&lock);
1070 return (collate*)fac;
1073 if(obj) {
1074 _Lockit_dtor(&lock);
1075 return obj;
1078 collate_short__Getcat(&fac, loc);
1079 obj = (collate*)fac;
1080 locale_facet__Incref(&obj->facet);
1081 locale_facet_register(&obj->facet);
1082 _Lockit_dtor(&lock);
1084 return obj;
1087 /* _Wcscoll */
1088 static int _Wcscoll(const wchar_t *first1, const wchar_t *last1, const wchar_t *first2,
1089 const wchar_t *last2, const _Collvec *coll)
1091 LCID lcid;
1093 TRACE("(%s %s)\n", debugstr_wn(first1, last1-first1), debugstr_wn(first2, last2-first2));
1095 if(coll)
1096 lcid = coll->handle;
1097 else
1098 lcid = ___lc_handle_func()[LC_COLLATE];
1099 return CompareStringW(lcid, 0, first1, last1-first1, first2, last2-first2)-CSTR_EQUAL;
1102 /* ?do_compare@?$collate@_W@std@@MBEHPB_W000@Z */
1103 /* ?do_compare@?$collate@_W@std@@MEBAHPEB_W000@Z */
1104 /* ?do_compare@?$collate@G@std@@MBEHPBG000@Z */
1105 /* ?do_compare@?$collate@G@std@@MEBAHPEBG000@Z */
1106 DEFINE_THISCALL_WRAPPER(collate_wchar_do_compare, 20)
1107 #define call_collate_wchar_do_compare(this, first1, last1, first2, last2) CALL_VTBL_FUNC(this, 4, int, \
1108 (const collate*, const wchar_t*, const wchar_t*, const wchar_t*, const wchar_t*), \
1109 (this, first1, last1, first2, last2))
1110 int __thiscall collate_wchar_do_compare(const collate *this, const wchar_t *first1,
1111 const wchar_t *last1, const wchar_t *first2, const wchar_t *last2)
1113 TRACE("(%p %p %p %p %p)\n", this, first1, last1, first2, last2);
1114 return _Wcscoll(first1, last1, first2, last2, &this->coll);
1117 /* ?compare@?$collate@_W@std@@QBEHPB_W000@Z */
1118 /* ?compare@?$collate@_W@std@@QEBAHPEB_W000@Z */
1119 /* ?compare@?$collate@G@std@@QBEHPBG000@Z */
1120 /* ?compare@?$collate@G@std@@QEBAHPEBG000@Z */
1121 DEFINE_THISCALL_WRAPPER(collate_wchar_compare, 20)
1122 int __thiscall collate_wchar_compare(const collate *this, const wchar_t *first1,
1123 const wchar_t *last1, const wchar_t *first2, const wchar_t *last2)
1125 TRACE("(%p %p %p %p %p)\n", this, first1, last1, first2, last2);
1126 return call_collate_wchar_do_compare(this, first1, last1, first2, last2);
1129 /* ?do_hash@?$collate@_W@std@@MBEJPB_W0@Z */
1130 /* ?do_hash@?$collate@_W@std@@MEBAJPEB_W0@Z */
1131 /* ?do_hash@?$collate@G@std@@MBEJPBG0@Z */
1132 /* ?do_hash@?$collate@G@std@@MEBAJPEBG0@Z */
1133 DEFINE_THISCALL_WRAPPER(collate_wchar_do_hash, 12)
1134 #define call_collate_wchar_do_hash(this, first, last) CALL_VTBL_FUNC(this, 12, LONG, \
1135 (const collate*, const wchar_t*, const wchar_t*), (this, first, last))
1136 LONG __thiscall collate_wchar_do_hash(const collate *this,
1137 const wchar_t *first, const wchar_t *last)
1139 ULONG ret = 0;
1141 TRACE("(%p %p %p)\n", this, first, last);
1143 for(; first<last; first++)
1144 ret = (ret<<8 | ret>>24) + *first;
1145 return ret;
1148 /* ?hash@?$collate@_W@std@@QBEJPB_W0@Z */
1149 /* ?hash@?$collate@_W@std@@QEBAJPEB_W0@Z */
1150 /* ?hash@?$collate@G@std@@QBEJPBG0@Z */
1151 /* ?hash@?$collate@G@std@@QEBAJPEBG0@Z */
1152 DEFINE_THISCALL_WRAPPER(collate_wchar_hash, 12)
1153 LONG __thiscall collate_wchar_hash(const collate *this,
1154 const wchar_t *first, const wchar_t *last)
1156 TRACE("(%p %p %p)\n", this, first, last);
1157 return call_collate_wchar_do_hash(this, first, last);
1160 /* ?do_transform@?$collate@_W@std@@MBE?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@PB_W0@Z */
1161 /* ?do_transform@?$collate@_W@std@@MEBA?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@PEB_W0@Z */
1162 /* ?do_transform@?$collate@G@std@@MBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@PBG0@Z */
1163 /* ?do_transform@?$collate@G@std@@MEBA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@PEBG0@Z */
1164 DEFINE_THISCALL_WRAPPER(collate_wchar_do_transform, 16)
1165 basic_string_wchar* __thiscall collate_wchar_do_transform(const collate *this,
1166 basic_string_wchar *ret, const wchar_t *first, const wchar_t *last)
1168 FIXME("(%p %p %p) stub\n", this, first, last);
1169 return ret;
1172 /* ?transform@?$collate@_W@std@@QBE?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@PB_W0@Z */
1173 /* ?transform@?$collate@_W@std@@QEBA?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@PEB_W0@Z */
1174 /* ?transform@?$collate@G@std@@QBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@PBG0@Z */
1175 /* ?transform@?$collate@G@std@@QEBA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@PEBG0@Z */
1176 DEFINE_THISCALL_WRAPPER(collate_wchar_transform, 16)
1177 basic_string_wchar* __thiscall collate_wchar_transform(const collate *this,
1178 basic_string_wchar *ret, const wchar_t *first, const wchar_t *last)
1180 FIXME("(%p %p %p) stub\n", this, first, last);
1181 return ret;
1184 /* ??_7ctype_base@std@@6B@ */
1185 extern const vtable_ptr MSVCP_ctype_base_vtable;
1187 /* ??0ctype_base@std@@QAE@I@Z */
1188 /* ??0ctype_base@std@@QEAA@_K@Z */
1189 DEFINE_THISCALL_WRAPPER(ctype_base_ctor_refs, 8)
1190 ctype_base* __thiscall ctype_base_ctor_refs(ctype_base *this, MSVCP_size_t refs)
1192 TRACE("(%p %lu)\n", this, refs);
1193 locale_facet_ctor_refs(&this->facet, refs);
1194 this->facet.vtable = &MSVCP_ctype_base_vtable;
1195 return this;
1198 /* ??_Fctype_base@std@@QAEXXZ */
1199 /* ??_Fctype_base@std@@QEAAXXZ */
1200 DEFINE_THISCALL_WRAPPER(ctype_base_ctor, 4)
1201 ctype_base* __thiscall ctype_base_ctor(ctype_base *this)
1203 TRACE("(%p)\n", this);
1204 locale_facet_ctor_refs(&this->facet, 0);
1205 this->facet.vtable = &MSVCP_ctype_base_vtable;
1206 return this;
1209 /* ??1ctype_base@std@@UAE@XZ */
1210 /* ??1ctype_base@std@@UEAA@XZ */
1211 DEFINE_THISCALL_WRAPPER(ctype_base_dtor, 4)
1212 void __thiscall ctype_base_dtor(ctype_base *this)
1214 TRACE("(%p)\n", this);
1217 DEFINE_THISCALL_WRAPPER(ctype_base_vector_dtor, 8)
1218 ctype_base* __thiscall ctype_base_vector_dtor(ctype_base *this, unsigned int flags)
1220 TRACE("(%p %x)\n", this, flags);
1221 if(flags & 2) {
1222 /* we have an array, with the number of elements stored before the first object */
1223 INT_PTR i, *ptr = (INT_PTR *)this-1;
1225 for(i=*ptr-1; i>=0; i--)
1226 ctype_base_dtor(this+i);
1227 MSVCRT_operator_delete(ptr);
1228 } else {
1229 ctype_base_dtor(this);
1230 if(flags & 1)
1231 MSVCRT_operator_delete(this);
1234 return this;
1237 /* ?id@?$ctype@D@std@@2V0locale@2@A */
1238 locale_id ctype_char_id = {0};
1239 /* ?table_size@?$ctype@D@std@@2IB */
1240 /* ?table_size@?$ctype@D@std@@2_KB */
1241 MSVCP_size_t ctype_char_table_size = 256;
1243 /* ??_7?$ctype@D@std@@6B@ */
1244 extern const vtable_ptr MSVCP_ctype_char_vtable;
1246 /* ?_Init@?$ctype@D@std@@IAEXABV_Locinfo@2@@Z */
1247 /* ?_Init@?$ctype@D@std@@IEAAXAEBV_Locinfo@2@@Z */
1248 DEFINE_THISCALL_WRAPPER(ctype_char__Init, 8)
1249 void __thiscall ctype_char__Init(ctype_char *this, const _Locinfo *locinfo)
1251 TRACE("(%p %p)\n", this, locinfo);
1252 _Locinfo__Getctype(locinfo, &this->ctype);
1255 /* ?_Tidy@?$ctype@D@std@@IAEXXZ */
1256 /* ?_Tidy@?$ctype@D@std@@IEAAXXZ */
1257 static void ctype_char__Tidy(ctype_char *this)
1259 TRACE("(%p)\n", this);
1261 if(this->ctype.delfl)
1262 free((short*)this->ctype.table);
1265 /* ?classic_table@?$ctype@D@std@@KAPBFXZ */
1266 /* ?classic_table@?$ctype@D@std@@KAPEBFXZ */
1267 const short* __cdecl ctype_char_classic_table(void)
1269 TRACE("()\n");
1270 return &((short*)GetProcAddress(GetModuleHandleA("msvcrt.dll"), "_ctype"))[1];
1273 /* ??0?$ctype@D@std@@QAE@ABV_Locinfo@1@I@Z */
1274 /* ??0?$ctype@D@std@@QEAA@AEBV_Locinfo@1@_K@Z */
1275 DEFINE_THISCALL_WRAPPER(ctype_char_ctor_locinfo, 12)
1276 ctype_char* __thiscall ctype_char_ctor_locinfo(ctype_char *this,
1277 const _Locinfo *locinfo, MSVCP_size_t refs)
1279 TRACE("(%p %p %lu)\n", this, locinfo, refs);
1280 ctype_base_ctor_refs(&this->base, refs);
1281 this->base.facet.vtable = &MSVCP_ctype_char_vtable;
1282 ctype_char__Init(this, locinfo);
1283 return this;
1286 /* ??0?$ctype@D@std@@QAE@PBF_NI@Z */
1287 /* ??0?$ctype@D@std@@QEAA@PEBF_N_K@Z */
1288 DEFINE_THISCALL_WRAPPER(ctype_char_ctor_table, 16)
1289 ctype_char* __thiscall ctype_char_ctor_table(ctype_char *this,
1290 const short *table, MSVCP_bool delete, MSVCP_size_t refs)
1292 _Locinfo locinfo;
1294 TRACE("(%p %p %d %lu)\n", this, table, delete, refs);
1296 ctype_base_ctor_refs(&this->base, refs);
1297 this->base.facet.vtable = &MSVCP_ctype_char_vtable;
1299 _Locinfo_ctor(&locinfo);
1300 ctype_char__Init(this, &locinfo);
1301 _Locinfo_dtor(&locinfo);
1303 if(table) {
1304 ctype_char__Tidy(this);
1305 this->ctype.table = table;
1306 this->ctype.delfl = delete;
1308 return this;
1311 /* ??_F?$ctype@D@std@@QAEXXZ */
1312 /* ??_F?$ctype@D@std@@QEAAXXZ */
1313 DEFINE_THISCALL_WRAPPER(ctype_char_ctor, 4)
1314 ctype_char* __thiscall ctype_char_ctor(ctype_char *this)
1316 return ctype_char_ctor_table(this, NULL, FALSE, 0);
1319 /* ??1?$ctype@D@std@@UAE@XZ */
1320 /* ??1?$ctype@D@std@@UEAA@XZ */
1321 DEFINE_THISCALL_WRAPPER(ctype_char_dtor, 4)
1322 void __thiscall ctype_char_dtor(ctype_char *this)
1324 TRACE("(%p)\n", this);
1325 ctype_char__Tidy(this);
1328 DEFINE_THISCALL_WRAPPER(ctype_char_vector_dtor, 8)
1329 ctype_char* __thiscall ctype_char_vector_dtor(ctype_char *this, unsigned int flags)
1331 TRACE("(%p %x)\n", this, flags);
1332 if(flags & 2) {
1333 /* we have an array, with the number of elements stored before the first object */
1334 INT_PTR i, *ptr = (INT_PTR *)this-1;
1336 for(i=*ptr-1; i>=0; i--)
1337 ctype_char_dtor(this+i);
1338 MSVCRT_operator_delete(ptr);
1339 } else {
1340 ctype_char_dtor(this);
1341 if(flags & 1)
1342 MSVCRT_operator_delete(this);
1345 return this;
1348 /* ?do_narrow@?$ctype@D@std@@MBEDDD@Z */
1349 /* ?do_narrow@?$ctype@D@std@@MEBADDD@Z */
1350 DEFINE_THISCALL_WRAPPER(ctype_char_do_narrow_ch, 12)
1351 #define call_ctype_char_do_narrow_ch(this, ch, unused) CALL_VTBL_FUNC(this, 32, \
1352 char, (const ctype_char*, char, char), (this, ch, unused))
1353 char __thiscall ctype_char_do_narrow_ch(const ctype_char *this, char ch, char unused)
1355 TRACE("(%p %c %c)\n", this, ch, unused);
1356 return ch;
1359 /* ?do_narrow@?$ctype@D@std@@MBEPBDPBD0DPAD@Z */
1360 /* ?do_narrow@?$ctype@D@std@@MEBAPEBDPEBD0DPEAD@Z */
1361 DEFINE_THISCALL_WRAPPER(ctype_char_do_narrow, 20)
1362 #define call_ctype_char_do_narrow(this, first, last, unused, dest) CALL_VTBL_FUNC(this, 28, \
1363 const char*, (const ctype_char*, const char*, const char*, char, char*), \
1364 (this, first, last, unused, dest))
1365 const char* __thiscall ctype_char_do_narrow(const ctype_char *this,
1366 const char *first, const char *last, char unused, char *dest)
1368 TRACE("(%p %p %p %p)\n", this, first, last, dest);
1369 memcpy(dest, first, last-first);
1370 return last;
1373 /* ?narrow@?$ctype@D@std@@QBEDDD@Z */
1374 /* ?narrow@?$ctype@D@std@@QEBADDD@Z */
1375 DEFINE_THISCALL_WRAPPER(ctype_char_narrow_ch, 12)
1376 char __thiscall ctype_char_narrow_ch(const ctype_char *this, char ch, char dflt)
1378 TRACE("(%p %c %c)\n", this, ch, dflt);
1379 return call_ctype_char_do_narrow_ch(this, ch, dflt);
1382 /* ?narrow@?$ctype@D@std@@QBEPBDPBD0DPAD@Z */
1383 /* ?narrow@?$ctype@D@std@@QEBAPEBDPEBD0DPEAD@Z */
1384 DEFINE_THISCALL_WRAPPER(ctype_char_narrow, 20)
1385 const char* __thiscall ctype_char_narrow(const ctype_char *this,
1386 const char *first, const char *last, char dflt, char *dest)
1388 TRACE("(%p %p %p %c %p)\n", this, first, last, dflt, dest);
1389 return call_ctype_char_do_narrow(this, first, last, dflt, dest);
1392 /* ?do_widen@?$ctype@D@std@@MBEDD@Z */
1393 /* ?do_widen@?$ctype@D@std@@MEBADD@Z */
1394 DEFINE_THISCALL_WRAPPER(ctype_char_do_widen_ch, 8)
1395 #define call_ctype_char_do_widen_ch(this, ch) CALL_VTBL_FUNC(this, 24, \
1396 char, (const ctype_char*, char), (this, ch))
1397 char __thiscall ctype_char_do_widen_ch(const ctype_char *this, char ch)
1399 TRACE("(%p %c)\n", this, ch);
1400 return ch;
1403 /* ?do_widen@?$ctype@D@std@@MBEPBDPBD0PAD@Z */
1404 /* ?do_widen@?$ctype@D@std@@MEBAPEBDPEBD0PEAD@Z */
1405 DEFINE_THISCALL_WRAPPER(ctype_char_do_widen, 16)
1406 #define call_ctype_char_do_widen(this, first, last, dest) CALL_VTBL_FUNC(this, 20, \
1407 const char*, (const ctype_char*, const char*, const char*, char*), \
1408 (this, first, last, dest))
1409 const char* __thiscall ctype_char_do_widen(const ctype_char *this,
1410 const char *first, const char *last, char *dest)
1412 TRACE("(%p %p %p %p)\n", this, first, last, dest);
1413 memcpy(dest, first, last-first);
1414 return last;
1417 /* ?widen@?$ctype@D@std@@QBEDD@Z */
1418 /* ?widen@?$ctype@D@std@@QEBADD@Z */
1419 DEFINE_THISCALL_WRAPPER(ctype_char_widen_ch, 8)
1420 char __thiscall ctype_char_widen_ch(const ctype_char *this, char ch)
1422 TRACE("(%p %c)\n", this, ch);
1423 return call_ctype_char_do_widen_ch(this, ch);
1426 /* ?widen@?$ctype@D@std@@QBEPBDPBD0PAD@Z */
1427 /* ?widen@?$ctype@D@std@@QEBAPEBDPEBD0PEAD@Z */
1428 DEFINE_THISCALL_WRAPPER(ctype_char_widen, 16)
1429 const char* __thiscall ctype_char_widen(const ctype_char *this,
1430 const char *first, const char *last, char *dest)
1432 TRACE("(%p %p %p %p)\n", this, first, last, dest);
1433 return call_ctype_char_do_widen(this, first, last, dest);
1436 /* ?_Getcat@?$ctype@D@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
1437 /* ?_Getcat@?$ctype@D@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
1438 static MSVCP_size_t ctype_char__Getcat(const locale_facet **facet, const locale *loc)
1440 TRACE("(%p %p)\n", facet, loc);
1442 if(facet && !*facet) {
1443 _Locinfo locinfo;
1445 *facet = MSVCRT_operator_new(sizeof(ctype_char));
1446 if(!*facet) {
1447 ERR("Out of memory\n");
1448 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
1449 return 0;
1452 _Locinfo_ctor_cstr(&locinfo, basic_string_char_c_str(&loc->ptr->name));
1453 ctype_char_ctor_locinfo((ctype_char*)*facet, &locinfo, 0);
1454 _Locinfo_dtor(&locinfo);
1457 return LC_CTYPE;
1460 ctype_char* ctype_char_use_facet(const locale *loc)
1462 static ctype_char *obj = NULL;
1464 _Lockit lock;
1465 const locale_facet *fac;
1467 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
1468 fac = locale__Getfacet(loc, locale_id_operator_size_t(&ctype_char_id), TRUE);
1469 if(fac) {
1470 _Lockit_dtor(&lock);
1471 return (ctype_char*)fac;
1474 if(obj) {
1475 _Lockit_dtor(&lock);
1476 return obj;
1479 ctype_char__Getcat(&fac, loc);
1480 obj = (ctype_char*)fac;
1481 locale_facet__Incref(&obj->base.facet);
1482 locale_facet_register(&obj->base.facet);
1483 _Lockit_dtor(&lock);
1485 return obj;
1488 /* _Tolower */
1489 int __cdecl _Tolower(int ch, const _Ctypevec *ctype)
1491 unsigned int cp;
1493 TRACE("%d %p\n", ch, ctype);
1495 if(ctype)
1496 cp = ctype->page;
1497 else
1498 cp = ___lc_codepage_func();
1500 /* Don't convert to unicode in case of C locale */
1501 if(!cp) {
1502 if(ch>='A' && ch<='Z')
1503 ch = ch-'A'+'a';
1504 return ch;
1505 } else {
1506 WCHAR wide, lower;
1507 char str[2];
1508 int size;
1510 if(ch > 255) {
1511 str[0] = (ch>>8) & 255;
1512 str[1] = ch & 255;
1513 size = 2;
1514 } else {
1515 str[0] = ch & 255;
1516 size = 1;
1519 if(!MultiByteToWideChar(cp, MB_ERR_INVALID_CHARS, str, size, &wide, 1))
1520 return ch;
1522 lower = tolowerW(wide);
1523 if(lower == wide)
1524 return ch;
1526 WideCharToMultiByte(cp, 0, &lower, 1, str, 2, NULL, NULL);
1528 return str[0] + (str[1]<<8);
1532 /* ?do_tolower@?$ctype@D@std@@MBEDD@Z */
1533 /* ?do_tolower@?$ctype@D@std@@MEBADD@Z */
1534 #define call_ctype_char_do_tolower_ch(this, ch) CALL_VTBL_FUNC(this, 8, \
1535 char, (const ctype_char*, char), (this, ch))
1536 DEFINE_THISCALL_WRAPPER(ctype_char_do_tolower_ch, 8)
1537 char __thiscall ctype_char_do_tolower_ch(const ctype_char *this, char ch)
1539 TRACE("(%p %c)\n", this, ch);
1540 return _Tolower(ch, &this->ctype);
1543 /* ?do_tolower@?$ctype@D@std@@MBEPBDPADPBD@Z */
1544 /* ?do_tolower@?$ctype@D@std@@MEBAPEBDPEADPEBD@Z */
1545 #define call_ctype_char_do_tolower(this, first, last) CALL_VTBL_FUNC(this, 4, \
1546 const char*, (const ctype_char*, char*, const char*), (this, first, last))
1547 DEFINE_THISCALL_WRAPPER(ctype_char_do_tolower, 12)
1548 const char* __thiscall ctype_char_do_tolower(const ctype_char *this, char *first, const char *last)
1550 TRACE("(%p %p %p)\n", this, first, last);
1551 for(; first<last; first++)
1552 *first = _Tolower(*first, &this->ctype);
1553 return last;
1556 /* ?tolower@?$ctype@D@std@@QBEDD@Z */
1557 /* ?tolower@?$ctype@D@std@@QEBADD@Z */
1558 DEFINE_THISCALL_WRAPPER(ctype_char_tolower_ch, 8)
1559 char __thiscall ctype_char_tolower_ch(const ctype_char *this, char ch)
1561 TRACE("(%p %c)\n", this, ch);
1562 return call_ctype_char_do_tolower_ch(this, ch);
1565 /* ?tolower@?$ctype@D@std@@QBEPBDPADPBD@Z */
1566 /* ?tolower@?$ctype@D@std@@QEBAPEBDPEADPEBD@Z */
1567 DEFINE_THISCALL_WRAPPER(ctype_char_tolower, 12)
1568 const char* __thiscall ctype_char_tolower(const ctype_char *this, char *first, const char *last)
1570 TRACE("(%p %p %p)\n", this, first, last);
1571 return call_ctype_char_do_tolower(this, first, last);
1574 /* _Toupper */
1575 int __cdecl _Toupper(int ch, const _Ctypevec *ctype)
1577 unsigned int cp;
1579 TRACE("%d %p\n", ch, ctype);
1581 if(ctype)
1582 cp = ctype->page;
1583 else
1584 cp = ___lc_codepage_func();
1586 /* Don't convert to unicode in case of C locale */
1587 if(!cp) {
1588 if(ch>='a' && ch<='z')
1589 ch = ch-'a'+'A';
1590 return ch;
1591 } else {
1592 WCHAR wide, upper;
1593 char str[2];
1594 int size;
1596 if(ch > 255) {
1597 str[0] = (ch>>8) & 255;
1598 str[1] = ch & 255;
1599 size = 2;
1600 } else {
1601 str[0] = ch & 255;
1602 size = 1;
1605 if(!MultiByteToWideChar(cp, MB_ERR_INVALID_CHARS, str, size, &wide, 1))
1606 return ch;
1608 upper = toupperW(wide);
1609 if(upper == wide)
1610 return ch;
1612 WideCharToMultiByte(cp, 0, &upper, 1, str, 2, NULL, NULL);
1614 return str[0] + (str[1]<<8);
1618 /* ?do_toupper@?$ctype@D@std@@MBEDD@Z */
1619 /* ?do_toupper@?$ctype@D@std@@MEBADD@Z */
1620 #define call_ctype_char_do_toupper_ch(this, ch) CALL_VTBL_FUNC(this, 16, \
1621 char, (const ctype_char*, char), (this, ch))
1622 DEFINE_THISCALL_WRAPPER(ctype_char_do_toupper_ch, 8)
1623 char __thiscall ctype_char_do_toupper_ch(const ctype_char *this, char ch)
1625 TRACE("(%p %c)\n", this, ch);
1626 return _Toupper(ch, &this->ctype);
1629 /* ?do_toupper@?$ctype@D@std@@MBEPBDPADPBD@Z */
1630 /* ?do_toupper@?$ctype@D@std@@MEBAPEBDPEADPEBD@Z */
1631 #define call_ctype_char_do_toupper(this, first, last) CALL_VTBL_FUNC(this, 12, \
1632 const char*, (const ctype_char*, char*, const char*), (this, first, last))
1633 DEFINE_THISCALL_WRAPPER(ctype_char_do_toupper, 12)
1634 const char* __thiscall ctype_char_do_toupper(const ctype_char *this,
1635 char *first, const char *last)
1637 TRACE("(%p %p %p)\n", this, first, last);
1638 for(; first<last; first++)
1639 *first = _Toupper(*first, &this->ctype);
1640 return last;
1643 /* ?toupper@?$ctype@D@std@@QBEDD@Z */
1644 /* ?toupper@?$ctype@D@std@@QEBADD@Z */
1645 DEFINE_THISCALL_WRAPPER(ctype_char_toupper_ch, 8)
1646 char __thiscall ctype_char_toupper_ch(const ctype_char *this, char ch)
1648 TRACE("(%p %c)\n", this, ch);
1649 return call_ctype_char_do_toupper_ch(this, ch);
1652 /* ?toupper@?$ctype@D@std@@QBEPBDPADPBD@Z */
1653 /* ?toupper@?$ctype@D@std@@QEBAPEBDPEADPEBD@Z */
1654 DEFINE_THISCALL_WRAPPER(ctype_char_toupper, 12)
1655 const char* __thiscall ctype_char_toupper(const ctype_char *this, char *first, const char *last)
1657 TRACE("(%p %p %p)\n", this, first, last);
1658 return call_ctype_char_do_toupper(this, first, last);
1661 /* ?is@?$ctype@D@std@@QBE_NFD@Z */
1662 /* ?is@?$ctype@D@std@@QEBA_NFD@Z */
1663 DEFINE_THISCALL_WRAPPER(ctype_char_is_ch, 12)
1664 MSVCP_bool __thiscall ctype_char_is_ch(const ctype_char *this, short mask, char ch)
1666 TRACE("(%p %x %c)\n", this, mask, ch);
1667 return (this->ctype.table[(unsigned char)ch] & mask) != 0;
1670 /* ?is@?$ctype@D@std@@QBEPBDPBD0PAF@Z */
1671 /* ?is@?$ctype@D@std@@QEBAPEBDPEBD0PEAF@Z */
1672 DEFINE_THISCALL_WRAPPER(ctype_char_is, 16)
1673 const char* __thiscall ctype_char_is(const ctype_char *this, const char *first, const char *last, short *dest)
1675 TRACE("(%p %p %p %p)\n", this, first, last, dest);
1676 for(; first<last; first++)
1677 *dest++ = this->ctype.table[(unsigned char)*first];
1678 return last;
1681 /* ?scan_is@?$ctype@D@std@@QBEPBDFPBD0@Z */
1682 /* ?scan_is@?$ctype@D@std@@QEBAPEBDFPEBD0@Z */
1683 DEFINE_THISCALL_WRAPPER(ctype_char_scan_is, 16)
1684 const char* __thiscall ctype_char_scan_is(const ctype_char *this, short mask, const char *first, const char *last)
1686 TRACE("(%p %x %p %p)\n", this, mask, first, last);
1687 for(; first<last; first++)
1688 if(!ctype_char_is_ch(this, mask, *first))
1689 break;
1690 return first;
1693 /* ?scan_not@?$ctype@D@std@@QBEPBDFPBD0@Z */
1694 /* ?scan_not@?$ctype@D@std@@QEBAPEBDFPEBD0@Z */
1695 DEFINE_THISCALL_WRAPPER(ctype_char_scan_not, 16)
1696 const char* __thiscall ctype_char_scan_not(const ctype_char *this, short mask, const char *first, const char *last)
1698 TRACE("(%p %x %p %p)\n", this, mask, first, last);
1699 for(; first<last; first++)
1700 if(ctype_char_is_ch(this, mask, *first))
1701 break;
1702 return first;
1705 /* ?table@?$ctype@D@std@@IBEPBFXZ */
1706 /* ?table@?$ctype@D@std@@IEBAPEBFXZ */
1707 DEFINE_THISCALL_WRAPPER(ctype_char_table, 4)
1708 const short* __thiscall ctype_char_table(const ctype_char *this)
1710 TRACE("(%p)\n", this);
1711 return this->ctype.table;
1714 /* ?id@?$ctype@_W@std@@2V0locale@2@A */
1715 static locale_id ctype_wchar_id = {0};
1716 /* ?id@?$ctype@G@std@@2V0locale@2@A */
1717 locale_id ctype_short_id = {0};
1719 /* ??_7?$ctype@_W@std@@6B@ */
1720 extern const vtable_ptr MSVCP_ctype_wchar_vtable;
1721 /* ??_7?$ctype@G@std@@6B@ */
1722 extern const vtable_ptr MSVCP_ctype_short_vtable;
1724 /* ?_Init@?$ctype@_W@std@@IAEXABV_Locinfo@2@@Z */
1725 /* ?_Init@?$ctype@_W@std@@IEAAXAEBV_Locinfo@2@@Z */
1726 /* ?_Init@?$ctype@G@std@@IAEXABV_Locinfo@2@@Z */
1727 /* ?_Init@?$ctype@G@std@@IEAAXAEBV_Locinfo@2@@Z */
1728 DEFINE_THISCALL_WRAPPER(ctype_wchar__Init, 8)
1729 void __thiscall ctype_wchar__Init(ctype_wchar *this, const _Locinfo *locinfo)
1731 TRACE("(%p %p)\n", this, locinfo);
1732 _Locinfo__Getctype(locinfo, &this->ctype);
1733 _Locinfo__Getcvt(locinfo, &this->cvt);
1736 /* ??0?$ctype@_W@std@@QAE@ABV_Locinfo@1@I@Z */
1737 /* ??0?$ctype@_W@std@@QEAA@AEBV_Locinfo@1@_K@Z */
1738 static ctype_wchar* ctype_wchar_ctor_locinfo(ctype_wchar *this,
1739 const _Locinfo *locinfo, MSVCP_size_t refs)
1741 TRACE("(%p %p %lu)\n", this, locinfo, refs);
1742 ctype_base_ctor_refs(&this->base, refs);
1743 this->base.facet.vtable = &MSVCP_ctype_wchar_vtable;
1744 ctype_wchar__Init(this, locinfo);
1745 return this;
1748 /* ??0?$ctype@G@std@@QAE@ABV_Locinfo@1@I@Z */
1749 /* ??0?$ctype@G@std@@QEAA@AEBV_Locinfo@1@_K@Z */
1750 DEFINE_THISCALL_WRAPPER(ctype_short_ctor_locinfo, 12)
1751 ctype_wchar* __thiscall ctype_short_ctor_locinfo(ctype_wchar *this,
1752 const _Locinfo *locinfo, MSVCP_size_t refs)
1754 ctype_wchar *ret = ctype_wchar_ctor_locinfo(this, locinfo, refs);
1755 this->base.facet.vtable = &MSVCP_ctype_short_vtable;
1756 return ret;
1759 /* ??0?$ctype@_W@std@@QAE@I@Z */
1760 /* ??0?$ctype@_W@std@@QEAA@_K@Z */
1761 static ctype_wchar* ctype_wchar_ctor_refs(ctype_wchar *this, MSVCP_size_t refs)
1763 _Locinfo locinfo;
1765 TRACE("(%p %lu)\n", this, refs);
1767 ctype_base_ctor_refs(&this->base, refs);
1768 this->base.facet.vtable = &MSVCP_ctype_wchar_vtable;
1770 _Locinfo_ctor(&locinfo);
1771 ctype_wchar__Init(this, &locinfo);
1772 _Locinfo_dtor(&locinfo);
1773 return this;
1776 /* ??0?$ctype@G@std@@QAE@I@Z */
1777 /* ??0?$ctype@G@std@@QEAA@_K@Z */
1778 DEFINE_THISCALL_WRAPPER(ctype_short_ctor_refs, 8)
1779 ctype_wchar* __thiscall ctype_short_ctor_refs(ctype_wchar *this, MSVCP_size_t refs)
1781 ctype_wchar *ret = ctype_wchar_ctor_refs(this, refs);
1782 this->base.facet.vtable = &MSVCP_ctype_short_vtable;
1783 return ret;
1786 /* ??_F?$ctype@_W@std@@QAEXXZ */
1787 /* ??_F?$ctype@_W@std@@QEAAXXZ */
1788 static ctype_wchar* ctype_wchar_ctor(ctype_wchar *this)
1790 TRACE("(%p)\n", this);
1791 return ctype_short_ctor_refs(this, 0);
1794 /* ??_F?$ctype@G@std@@QAEXXZ */
1795 /* ??_F?$ctype@G@std@@QEAAXXZ */
1796 DEFINE_THISCALL_WRAPPER(ctype_short_ctor, 4)
1797 ctype_wchar* __thiscall ctype_short_ctor(ctype_wchar *this)
1799 ctype_wchar *ret = ctype_wchar_ctor(this);
1800 this->base.facet.vtable = &MSVCP_ctype_short_vtable;
1801 return ret;
1804 /* ??1?$ctype@G@std@@UAE@XZ */
1805 /* ??1?$ctype@G@std@@UEAA@XZ */
1806 DEFINE_THISCALL_WRAPPER(ctype_wchar_dtor, 4)
1807 void __thiscall ctype_wchar_dtor(ctype_wchar *this)
1809 TRACE("(%p)\n", this);
1810 if(this->ctype.delfl)
1811 free((void*)this->ctype.table);
1814 DEFINE_THISCALL_WRAPPER(ctype_wchar_vector_dtor, 8)
1815 ctype_wchar* __thiscall ctype_wchar_vector_dtor(ctype_wchar *this, unsigned int flags)
1817 TRACE("(%p %x)\n", this, flags);
1818 if(flags & 2) {
1819 /* we have an array, with the number of elements stored before the first object */
1820 INT_PTR i, *ptr = (INT_PTR *)this-1;
1822 for(i=*ptr-1; i>=0; i--)
1823 ctype_wchar_dtor(this+i);
1824 MSVCRT_operator_delete(ptr);
1825 } else {
1826 ctype_wchar_dtor(this);
1827 if(flags & 1)
1828 MSVCRT_operator_delete(this);
1831 return this;
1834 /* _Wcrtomb */
1835 int __cdecl _Wcrtomb(char *s, wchar_t wch, int *state, const _Cvtvec *cvt)
1837 int cp, size;
1838 BOOL def;
1840 TRACE("%p %d %p %p\n", s, wch, state, cvt);
1842 if(cvt)
1843 cp = cvt->page;
1844 else
1845 cp = ___lc_codepage_func();
1847 if(!cp) {
1848 if(wch > 255) {
1849 *_errno() = EILSEQ;
1850 return -1;
1853 *s = wch & 255;
1854 return 1;
1857 size = WideCharToMultiByte(cp, 0, &wch, 1, s, MB_LEN_MAX, NULL, &def);
1858 if(!size || def) {
1859 *_errno() = EILSEQ;
1860 return -1;
1863 return size;
1866 /* ?_Donarrow@?$ctype@_W@std@@IBED_WD@Z */
1867 /* ?_Donarrow@?$ctype@_W@std@@IEBAD_WD@Z */
1868 /* ?_Donarrow@?$ctype@G@std@@IBEDGD@Z */
1869 /* ?_Donarrow@?$ctype@G@std@@IEBADGD@Z */
1870 static char ctype_wchar__Donarrow(const ctype_wchar *this, wchar_t ch, char dflt)
1872 char buf[MB_LEN_MAX];
1874 TRACE("(%p %d %d)\n", this, ch, dflt);
1876 return _Wcrtomb(buf, ch, NULL, &this->cvt)==1 ? buf[0] : dflt;
1879 /* ?do_narrow@?$ctype@_W@std@@MBED_WD@Z */
1880 /* ?do_narrow@?$ctype@_W@std@@MEBAD_WD@Z */
1881 /* ?do_narrow@?$ctype@G@std@@MBEDGD@Z */
1882 /* ?do_narrow@?$ctype@G@std@@MEBADGD@Z */
1883 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_narrow_ch, 12)
1884 #define call_ctype_wchar_do_narrow_ch(this, ch, dflt) CALL_VTBL_FUNC(this, 48, \
1885 char, (const ctype_wchar*, wchar_t, char), (this, ch, dflt))
1886 char __thiscall ctype_wchar_do_narrow_ch(const ctype_wchar *this, wchar_t ch, char dflt)
1888 return ctype_wchar__Donarrow(this, ch, dflt);
1891 /* ?do_narrow@?$ctype@_W@std@@MBEPB_WPB_W0DPAD@Z */
1892 /* ?do_narrow@?$ctype@_W@std@@MEBAPEB_WPEB_W0DPEAD@Z */
1893 /* ?do_narrow@?$ctype@G@std@@MBEPBGPBG0DPAD@Z */
1894 /* ?do_narrow@?$ctype@G@std@@MEBAPEBGPEBG0DPEAD@Z */
1895 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_narrow, 20)
1896 #define call_ctype_wchar_do_narrow(this, first, last, dflt, dest) CALL_VTBL_FUNC(this, 44, \
1897 const wchar_t*, (const ctype_wchar*, const wchar_t*, const wchar_t*, char, char*), \
1898 (this, first, last, dflt, dest))
1899 const wchar_t* __thiscall ctype_wchar_do_narrow(const ctype_wchar *this,
1900 const wchar_t *first, const wchar_t *last, char dflt, char *dest)
1902 TRACE("(%p %p %p %d %p)\n", this, first, last, dflt, dest);
1903 for(; first<last; first++)
1904 *dest++ = ctype_wchar__Donarrow(this, *first, dflt);
1905 return last;
1908 /* ?narrow@?$ctype@_W@std@@QBED_WD@Z */
1909 /* ?narrow@?$ctype@_W@std@@QEBAD_WD@Z */
1910 /* ?narrow@?$ctype@G@std@@QBEDGD@Z */
1911 /* ?narrow@?$ctype@G@std@@QEBADGD@Z */
1912 DEFINE_THISCALL_WRAPPER(ctype_wchar_narrow_ch, 12)
1913 char __thiscall ctype_wchar_narrow_ch(const ctype_wchar *this, wchar_t ch, char dflt)
1915 TRACE("(%p %d %d)\n", this, ch, dflt);
1916 return call_ctype_wchar_do_narrow_ch(this, ch, dflt);
1919 /* ?narrow@?$ctype@_W@std@@QBEPB_WPB_W0DPAD@Z */
1920 /* ?narrow@?$ctype@_W@std@@QEBAPEB_WPEB_W0DPEAD@Z */
1921 /* ?narrow@?$ctype@G@std@@QBEPBGPBG0DPAD@Z */
1922 /* ?narrow@?$ctype@G@std@@QEBAPEBGPEBG0DPEAD@Z */
1923 DEFINE_THISCALL_WRAPPER(ctype_wchar_narrow, 20)
1924 const wchar_t* __thiscall ctype_wchar_narrow(const ctype_wchar *this,
1925 const wchar_t *first, const wchar_t *last, char dflt, char *dest)
1927 TRACE("(%p %p %p %d %p)\n", this, first, last, dflt, dest);
1928 return call_ctype_wchar_do_narrow(this, first, last, dflt, dest);
1931 /* _Mbrtowc */
1932 int __cdecl _Mbrtowc(wchar_t *out, const char *in, MSVCP_size_t len, int *state, const _Cvtvec *cvt)
1934 int i, cp;
1935 CPINFO cp_info;
1936 BOOL is_lead;
1938 TRACE("(%p %p %lu %p %p)\n", out, in, len, state, cvt);
1940 if(!len)
1941 return 0;
1943 if(cvt)
1944 cp = cvt->page;
1945 else
1946 cp = ___lc_codepage_func();
1948 if(!cp) {
1949 if(out)
1950 *out = (unsigned char)*in;
1952 *state = 0;
1953 return *in ? 1 : 0;
1956 if(*state) {
1957 ((char*)state)[1] = *in;
1959 if(!MultiByteToWideChar(cp, MB_ERR_INVALID_CHARS, (char*)state, 2, out, out ? 1 : 0)) {
1960 *state = 0;
1961 *_errno() = EILSEQ;
1962 return -1;
1965 *state = 0;
1966 return 2;
1969 GetCPInfo(cp, &cp_info);
1970 is_lead = FALSE;
1971 for(i=0; i<MAX_LEADBYTES; i+=2) {
1972 if(!cp_info.LeadByte[i+1])
1973 break;
1974 if((unsigned char)*in>=cp_info.LeadByte[i] && (unsigned char)*in<=cp_info.LeadByte[i+1]) {
1975 is_lead = TRUE;
1976 break;
1980 if(is_lead) {
1981 if(len == 1) {
1982 *state = (unsigned char)*in;
1983 return -2;
1986 if(!MultiByteToWideChar(cp, MB_ERR_INVALID_CHARS, in, 2, out, out ? 1 : 0)) {
1987 *_errno() = EILSEQ;
1988 return -1;
1990 return 2;
1993 if(!MultiByteToWideChar(cp, MB_ERR_INVALID_CHARS, in, 1, out, out ? 1 : 0)) {
1994 *_errno() = EILSEQ;
1995 return -1;
1997 return 1;
2000 /* ?_Dowiden@?$ctype@_W@std@@IBE_WD@Z */
2001 /* ?_Dowiden@?$ctype@_W@std@@IEBA_WD@Z */
2002 /* ?_Dowiden@?$ctype@G@std@@IBEGD@Z */
2003 /* ?_Dowiden@?$ctype@G@std@@IEBAGD@Z */
2004 static wchar_t ctype_wchar__Dowiden(const ctype_wchar *this, char ch)
2006 wchar_t ret;
2007 int state = 0;
2008 TRACE("(%p %d)\n", this, ch);
2009 return _Mbrtowc(&ret, &ch, 1, &state, &this->cvt)<0 ? WEOF : ret;
2012 /* ?do_widen@?$ctype@_W@std@@MBE_WD@Z */
2013 /* ?do_widen@?$ctype@_W@std@@MEBA_WD@Z */
2014 /* ?do_widen@?$ctype@G@std@@MBEGD@Z */
2015 /* ?do_widen@?$ctype@G@std@@MEBAGD@Z */
2016 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_widen_ch, 8)
2017 #define call_ctype_wchar_do_widen_ch(this, ch) CALL_VTBL_FUNC(this, 40, \
2018 wchar_t, (const ctype_wchar*, char), (this, ch))
2019 wchar_t __thiscall ctype_wchar_do_widen_ch(const ctype_wchar *this, char ch)
2021 return ctype_wchar__Dowiden(this, ch);
2024 /* ?do_widen@?$ctype@_W@std@@MBEPBDPBD0PA_W@Z */
2025 /* ?do_widen@?$ctype@_W@std@@MEBAPEBDPEBD0PEA_W@Z */
2026 /* ?do_widen@?$ctype@G@std@@MBEPBDPBD0PAG@Z */
2027 /* ?do_widen@?$ctype@G@std@@MEBAPEBDPEBD0PEAG@Z */
2028 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_widen, 16)
2029 #define call_ctype_wchar_do_widen(this, first, last, dest) CALL_VTBL_FUNC(this, 36, \
2030 const char*, (const ctype_wchar*, const char*, const char*, wchar_t*), \
2031 (this, first, last, dest))
2032 const char* __thiscall ctype_wchar_do_widen(const ctype_wchar *this,
2033 const char *first, const char *last, wchar_t *dest)
2035 TRACE("(%p %p %p %p)\n", this, first, last, dest);
2036 for(; first<last; first++)
2037 *dest++ = ctype_wchar__Dowiden(this, *first);
2038 return last;
2041 /* ?widen@?$ctype@_W@std@@QBE_WD@Z */
2042 /* ?widen@?$ctype@_W@std@@QEBA_WD@Z */
2043 /* ?widen@?$ctype@G@std@@QBEGD@Z */
2044 /* ?widen@?$ctype@G@std@@QEBAGD@Z */
2045 DEFINE_THISCALL_WRAPPER(ctype_wchar_widen_ch, 8)
2046 wchar_t __thiscall ctype_wchar_widen_ch(const ctype_wchar *this, char ch)
2048 TRACE("(%p %d)\n", this, ch);
2049 return call_ctype_wchar_do_widen_ch(this, ch);
2052 /* ?widen@?$ctype@_W@std@@QBEPBDPBD0PA_W@Z */
2053 /* ?widen@?$ctype@_W@std@@QEBAPEBDPEBD0PEA_W@Z */
2054 /* ?widen@?$ctype@G@std@@QBEPBDPBD0PAG@Z */
2055 /* ?widen@?$ctype@G@std@@QEBAPEBDPEBD0PEAG@Z */
2056 DEFINE_THISCALL_WRAPPER(ctype_wchar_widen, 16)
2057 const char* __thiscall ctype_wchar_widen(const ctype_wchar *this,
2058 const char *first, const char *last, wchar_t *dest)
2060 TRACE("(%p %p %p %p)\n", this, first, last, dest);
2061 return call_ctype_wchar_do_widen(this, first, last, dest);
2064 /* ?_Getcat@?$ctype@_W@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
2065 /* ?_Getcat@?$ctype@_W@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
2066 static MSVCP_size_t ctype_wchar__Getcat(const locale_facet **facet, const locale *loc)
2068 TRACE("(%p %p)\n", facet, loc);
2070 if(facet && !*facet) {
2071 _Locinfo locinfo;
2073 *facet = MSVCRT_operator_new(sizeof(ctype_wchar));
2074 if(!*facet) {
2075 ERR("Out of memory\n");
2076 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
2077 return 0;
2080 _Locinfo_ctor_cstr(&locinfo, basic_string_char_c_str(&loc->ptr->name));
2081 ctype_wchar_ctor_locinfo((ctype_wchar*)*facet, &locinfo, 0);
2082 _Locinfo_dtor(&locinfo);
2085 return LC_CTYPE;
2088 /* ?_Getcat@?$ctype@G@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
2089 /* ?_Getcat@?$ctype@G@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
2090 static MSVCP_size_t ctype_short__Getcat(const locale_facet **facet, const locale *loc)
2092 if(facet && !*facet) {
2093 ctype_wchar__Getcat(facet, loc);
2094 (*(locale_facet**)facet)->vtable = &MSVCP_ctype_short_vtable;
2097 return LC_CTYPE;
2100 /* _Towlower */
2101 static wchar_t _Towlower(wchar_t ch, const _Ctypevec *ctype)
2103 TRACE("(%d %p)\n", ch, ctype);
2104 return tolowerW(ch);
2107 ctype_wchar* ctype_wchar_use_facet(const locale *loc)
2109 static ctype_wchar *obj = NULL;
2111 _Lockit lock;
2112 const locale_facet *fac;
2114 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
2115 fac = locale__Getfacet(loc, locale_id_operator_size_t(&ctype_wchar_id), TRUE);
2116 if(fac) {
2117 _Lockit_dtor(&lock);
2118 return (ctype_wchar*)fac;
2121 if(obj) {
2122 _Lockit_dtor(&lock);
2123 return obj;
2126 ctype_wchar__Getcat(&fac, loc);
2127 obj = (ctype_wchar*)fac;
2128 locale_facet__Incref(&obj->base.facet);
2129 locale_facet_register(&obj->base.facet);
2130 _Lockit_dtor(&lock);
2132 return obj;
2135 ctype_wchar* ctype_short_use_facet(const locale *loc)
2137 static ctype_wchar *obj = NULL;
2139 _Lockit lock;
2140 const locale_facet *fac;
2142 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
2143 fac = locale__Getfacet(loc, locale_id_operator_size_t(&ctype_short_id), TRUE);
2144 if(fac) {
2145 _Lockit_dtor(&lock);
2146 return (ctype_wchar*)fac;
2149 if(obj) {
2150 _Lockit_dtor(&lock);
2151 return obj;
2154 ctype_short__Getcat(&fac, loc);
2155 obj = (ctype_wchar*)fac;
2156 locale_facet__Incref(&obj->base.facet);
2157 locale_facet_register(&obj->base.facet);
2158 _Lockit_dtor(&lock);
2160 return obj;
2163 /* ?do_tolower@?$ctype@_W@std@@MBE_W_W@Z */
2164 /* ?do_tolower@?$ctype@_W@std@@MEBA_W_W@Z */
2165 /* ?do_tolower@?$ctype@G@std@@MBEGG@Z */
2166 /* ?do_tolower@?$ctype@G@std@@MEBAGG@Z */
2167 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_tolower_ch, 8)
2168 #define call_ctype_wchar_do_tolower_ch(this, ch) CALL_VTBL_FUNC(this, 24, \
2169 wchar_t, (const ctype_wchar*, wchar_t), (this, ch))
2170 wchar_t __thiscall ctype_wchar_do_tolower_ch(const ctype_wchar *this, wchar_t ch)
2172 return _Towlower(ch, &this->ctype);
2175 /* ?do_tolower@?$ctype@_W@std@@MBEPB_WPA_WPB_W@Z */
2176 /* ?do_tolower@?$ctype@_W@std@@MEBAPEB_WPEA_WPEB_W@Z */
2177 /* ?do_tolower@?$ctype@G@std@@MBEPBGPAGPBG@Z */
2178 /* ?do_tolower@?$ctype@G@std@@MEBAPEBGPEAGPEBG@Z */
2179 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_tolower, 12)
2180 #define call_ctype_wchar_do_tolower(this, first, last) CALL_VTBL_FUNC(this, 20, \
2181 const wchar_t*, (const ctype_wchar*, wchar_t*, const wchar_t*), \
2182 (this, first, last))
2183 const wchar_t* __thiscall ctype_wchar_do_tolower(const ctype_wchar *this,
2184 wchar_t *first, const wchar_t *last)
2186 TRACE("(%p %p %p)\n", this, first, last);
2187 for(; first<last; first++)
2188 *first = _Towlower(*first, &this->ctype);
2189 return last;
2192 /* ?tolower@?$ctype@_W@std@@QBE_W_W@Z */
2193 /* ?tolower@?$ctype@_W@std@@QEBA_W_W@Z */
2194 /* ?tolower@?$ctype@G@std@@QBEGG@Z */
2195 /* ?tolower@?$ctype@G@std@@QEBAGG@Z */
2196 DEFINE_THISCALL_WRAPPER(ctype_wchar_tolower_ch, 8)
2197 wchar_t __thiscall ctype_wchar_tolower_ch(const ctype_wchar *this, wchar_t ch)
2199 TRACE("(%p %d)\n", this, ch);
2200 return call_ctype_wchar_do_tolower_ch(this, ch);
2203 /* ?tolower@?$ctype@_W@std@@QBEPB_WPA_WPB_W@Z */
2204 /* ?tolower@?$ctype@_W@std@@QEBAPEB_WPEA_WPEB_W@Z */
2205 /* ?tolower@?$ctype@G@std@@QBEPBGPAGPBG@Z */
2206 /* ?tolower@?$ctype@G@std@@QEBAPEBGPEAGPEBG@Z */
2207 DEFINE_THISCALL_WRAPPER(ctype_wchar_tolower, 12)
2208 const wchar_t* __thiscall ctype_wchar_tolower(const ctype_wchar *this,
2209 wchar_t *first, const wchar_t *last)
2211 TRACE("(%p %p %p)\n", this, first, last);
2212 return call_ctype_wchar_do_tolower(this, first, last);
2215 /* _Towupper */
2216 static wchar_t _Towupper(wchar_t ch, const _Ctypevec *ctype)
2218 TRACE("(%d %p)\n", ch, ctype);
2219 return toupperW(ch);
2222 /* ?do_toupper@?$ctype@_W@std@@MBE_W_W@Z */
2223 /* ?do_toupper@?$ctype@_W@std@@MEBA_W_W@Z */
2224 /* ?do_toupper@?$ctype@G@std@@MBEGG@Z */
2225 /* ?do_toupper@?$ctype@G@std@@MEBAGG@Z */
2226 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_toupper_ch, 8)
2227 #define call_ctype_wchar_do_toupper_ch(this, ch) CALL_VTBL_FUNC(this, 32, \
2228 wchar_t, (const ctype_wchar*, wchar_t), (this, ch))
2229 wchar_t __thiscall ctype_wchar_do_toupper_ch(const ctype_wchar *this, wchar_t ch)
2231 return _Towupper(ch, &this->ctype);
2234 /* ?do_toupper@?$ctype@_W@std@@MBEPB_WPA_WPB_W@Z */
2235 /* ?do_toupper@?$ctype@_W@std@@MEBAPEB_WPEA_WPEB_W@Z */
2236 /* ?do_toupper@?$ctype@G@std@@MBEPBGPAGPBG@Z */
2237 /* ?do_toupper@?$ctype@G@std@@MEBAPEBGPEAGPEBG@Z */
2238 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_toupper, 12)
2239 #define call_ctype_wchar_do_toupper(this, first, last) CALL_VTBL_FUNC(this, 28, \
2240 const wchar_t*, (const ctype_wchar*, wchar_t*, const wchar_t*), \
2241 (this, first, last))
2242 const wchar_t* __thiscall ctype_wchar_do_toupper(const ctype_wchar *this,
2243 wchar_t *first, const wchar_t *last)
2245 TRACE("(%p %p %p)\n", this, first, last);
2246 for(; first<last; first++)
2247 *first = _Towupper(*first, &this->ctype);
2248 return last;
2251 /* ?toupper@?$ctype@_W@std@@QBE_W_W@Z */
2252 /* ?toupper@?$ctype@_W@std@@QEBA_W_W@Z */
2253 /* ?toupper@?$ctype@G@std@@QBEGG@Z */
2254 /* ?toupper@?$ctype@G@std@@QEBAGG@Z */
2255 DEFINE_THISCALL_WRAPPER(ctype_wchar_toupper_ch, 8)
2256 wchar_t __thiscall ctype_wchar_toupper_ch(const ctype_wchar *this, wchar_t ch)
2258 TRACE("(%p %d)\n", this, ch);
2259 return call_ctype_wchar_do_toupper_ch(this, ch);
2262 /* ?toupper@?$ctype@_W@std@@QBEPB_WPA_WPB_W@Z */
2263 /* ?toupper@?$ctype@_W@std@@QEBAPEB_WPEA_WPEB_W@Z */
2264 /* ?toupper@?$ctype@G@std@@QBEPBGPAGPBG@Z */
2265 /* ?toupper@?$ctype@G@std@@QEBAPEBGPEAGPEBG@Z */
2266 DEFINE_THISCALL_WRAPPER(ctype_wchar_toupper, 12)
2267 const wchar_t* __thiscall ctype_wchar_toupper(const ctype_wchar *this,
2268 wchar_t *first, const wchar_t *last)
2270 TRACE("(%p %p %p)\n", this, first, last);
2271 return call_ctype_wchar_do_toupper(this, first, last);
2274 /* _Getwctypes */
2275 static const wchar_t* _Getwctypes(const wchar_t *first, const wchar_t *last,
2276 short *mask, const _Ctypevec *ctype)
2278 TRACE("(%p %p %p %p)\n", first, last, mask, ctype);
2279 GetStringTypeW(CT_CTYPE1, first, last-first, (WORD*)mask);
2280 return last;
2283 /* _Getwctype */
2284 static short _Getwctype(wchar_t ch, const _Ctypevec *ctype)
2286 short mask = 0;
2287 _Getwctypes(&ch, &ch+1, &mask, ctype);
2288 return mask;
2291 /* ?do_is@?$ctype@_W@std@@MBE_NF_W@Z */
2292 /* ?do_is@?$ctype@_W@std@@MEBA_NF_W@Z */
2293 /* ?do_is@?$ctype@G@std@@MBE_NFG@Z */
2294 /* ?do_is@?$ctype@G@std@@MEBA_NFG@Z */
2295 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_is_ch, 12)
2296 #define call_ctype_wchar_do_is_ch(this, mask, ch) CALL_VTBL_FUNC(this, 8, \
2297 MSVCP_bool, (const ctype_wchar*, short, wchar_t), (this, mask, ch))
2298 MSVCP_bool __thiscall ctype_wchar_do_is_ch(const ctype_wchar *this, short mask, wchar_t ch)
2300 TRACE("(%p %x %d)\n", this, mask, ch);
2301 return (_Getwctype(ch, &this->ctype) & mask) != 0;
2304 /* ?do_is@?$ctype@_W@std@@MBEPB_WPB_W0PAF@Z */
2305 /* ?do_is@?$ctype@_W@std@@MEBAPEB_WPEB_W0PEAF@Z */
2306 /* ?do_is@?$ctype@G@std@@MBEPBGPBG0PAF@Z */
2307 /* ?do_is@?$ctype@G@std@@MEBAPEBGPEBG0PEAF@Z */
2308 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_is, 16)
2309 #define call_ctype_wchar_do_is(this, first, last, dest) CALL_VTBL_FUNC(this, 4, \
2310 const wchar_t*, (const ctype_wchar*, const wchar_t*, const wchar_t*, short*), \
2311 (this, first, last, dest))
2312 const wchar_t* __thiscall ctype_wchar_do_is(const ctype_wchar *this,
2313 const wchar_t *first, const wchar_t *last, short *dest)
2315 TRACE("(%p %p %p %p)\n", this, first, last, dest);
2316 return _Getwctypes(first, last, dest, &this->ctype);
2319 /* ?is@?$ctype@_W@std@@QBE_NF_W@Z */
2320 /* ?is@?$ctype@_W@std@@QEBA_NF_W@Z */
2321 /* ?is@?$ctype@G@std@@QBE_NFG@Z */
2322 /* ?is@?$ctype@G@std@@QEBA_NFG@Z */
2323 DEFINE_THISCALL_WRAPPER(ctype_wchar_is_ch, 12)
2324 MSVCP_bool __thiscall ctype_wchar_is_ch(const ctype_wchar *this, short mask, wchar_t ch)
2326 TRACE("(%p %x %d)\n", this, mask, ch);
2327 return call_ctype_wchar_do_is_ch(this, mask, ch);
2330 /* ?is@?$ctype@_W@std@@QBEPB_WPB_W0PAF@Z */
2331 /* ?is@?$ctype@_W@std@@QEBAPEB_WPEB_W0PEAF@Z */
2332 /* ?is@?$ctype@G@std@@QBEPBGPBG0PAF@Z */
2333 /* ?is@?$ctype@G@std@@QEBAPEBGPEBG0PEAF@Z */
2334 DEFINE_THISCALL_WRAPPER(ctype_wchar_is, 16)
2335 const wchar_t* __thiscall ctype_wchar_is(const ctype_wchar *this,
2336 const wchar_t *first, const wchar_t *last, short *dest)
2338 TRACE("(%p %p %p %p)\n", this, first, last, dest);
2339 return call_ctype_wchar_do_is(this, first, last, dest);
2342 /* ?do_scan_is@?$ctype@_W@std@@MBEPB_WFPB_W0@Z */
2343 /* ?do_scan_is@?$ctype@_W@std@@MEBAPEB_WFPEB_W0@Z */
2344 /* ?do_scan_is@?$ctype@G@std@@MBEPBGFPBG0@Z */
2345 /* ?do_scan_is@?$ctype@G@std@@MEBAPEBGFPEBG0@Z */
2346 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_scan_is, 16)
2347 #define call_ctype_wchar_do_scan_is(this, mask, first, last) CALL_VTBL_FUNC(this, 12, \
2348 const wchar_t*, (const ctype_wchar*, short, const wchar_t*, const wchar_t*), \
2349 (this, mask, first, last))
2350 const wchar_t* __thiscall ctype_wchar_do_scan_is(const ctype_wchar *this,
2351 short mask, const wchar_t *first, const wchar_t *last)
2353 TRACE("(%p %d %p %p)\n", this, mask, first, last);
2354 for(; first<last; first++)
2355 if(!ctype_wchar_is_ch(this, mask, *first))
2356 break;
2357 return first;
2360 /* ?scan_is@?$ctype@_W@std@@QBEPB_WFPB_W0@Z */
2361 /* ?scan_is@?$ctype@_W@std@@QEBAPEB_WFPEB_W0@Z */
2362 /* ?scan_is@?$ctype@G@std@@QBEPBGFPBG0@Z */
2363 /* ?scan_is@?$ctype@G@std@@QEBAPEBGFPEBG0@Z */
2364 DEFINE_THISCALL_WRAPPER(ctype_wchar_scan_is, 16)
2365 const wchar_t* __thiscall ctype_wchar_scan_is(const ctype_wchar *this,
2366 short mask, const wchar_t *first, const wchar_t *last)
2368 TRACE("(%p %x %p %p)\n", this, mask, first, last);
2369 return call_ctype_wchar_do_scan_is(this, mask, first, last);
2372 /* ?do_scan_not@?$ctype@_W@std@@MBEPB_WFPB_W0@Z */
2373 /* ?do_scan_not@?$ctype@_W@std@@MEBAPEB_WFPEB_W0@Z */
2374 /* ?do_scan_not@?$ctype@G@std@@MBEPBGFPBG0@Z */
2375 /* ?do_scan_not@?$ctype@G@std@@MEBAPEBGFPEBG0@Z */
2376 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_scan_not, 16)
2377 #define call_ctype_wchar_do_scan_not(this, mask, first, last) CALL_VTBL_FUNC(this, 16, \
2378 const wchar_t*, (const ctype_wchar*, short, const wchar_t*, const wchar_t*), \
2379 (this, mask, first, last))
2380 const wchar_t* __thiscall ctype_wchar_do_scan_not(const ctype_wchar *this,
2381 short mask, const wchar_t *first, const wchar_t *last)
2383 TRACE("(%p %x %p %p)\n", this, mask, first, last);
2384 for(; first<last; first++)
2385 if(ctype_wchar_is_ch(this, mask, *first))
2386 break;
2387 return first;
2390 /* ?scan_not@?$ctype@_W@std@@QBEPB_WFPB_W0@Z */
2391 /* ?scan_not@?$ctype@_W@std@@QEBAPEB_WFPEB_W0@Z */
2392 /* ?scan_not@?$ctype@G@std@@QBEPBGFPBG0@Z */
2393 /* ?scan_not@?$ctype@G@std@@QEBAPEBGFPEBG0@Z */
2394 DEFINE_THISCALL_WRAPPER(ctype_wchar_scan_not, 16)
2395 const wchar_t* __thiscall ctype_wchar_scan_not(const ctype_wchar *this,
2396 short mask, const wchar_t *first, const wchar_t *last)
2398 TRACE("(%p %x %p %p)\n", this, mask, first, last);
2399 return call_ctype_wchar_do_scan_not(this, mask, first, last);
2402 /* ??_7codecvt_base@std@@6B@ */
2403 extern const vtable_ptr MSVCP_codecvt_base_vtable;
2405 /* ??0codecvt_base@std@@QAE@I@Z */
2406 /* ??0codecvt_base@std@@QEAA@_K@Z */
2407 DEFINE_THISCALL_WRAPPER(codecvt_base_ctor_refs, 8)
2408 codecvt_base* __thiscall codecvt_base_ctor_refs(codecvt_base *this, MSVCP_size_t refs)
2410 TRACE("(%p %lu)\n", this, refs);
2411 locale_facet_ctor_refs(&this->facet, refs);
2412 this->facet.vtable = &MSVCP_codecvt_base_vtable;
2413 return this;
2416 /* ??_Fcodecvt_base@std@@QAEXXZ */
2417 /* ??_Fcodecvt_base@std@@QEAAXXZ */
2418 DEFINE_THISCALL_WRAPPER(codecvt_base_ctor, 4)
2419 codecvt_base* __thiscall codecvt_base_ctor(codecvt_base *this)
2421 return codecvt_base_ctor_refs(this, 0);
2424 /* ??1codecvt_base@std@@UAE@XZ */
2425 /* ??1codecvt_base@std@@UEAA@XZ */
2426 DEFINE_THISCALL_WRAPPER(codecvt_base_dtor, 4)
2427 void __thiscall codecvt_base_dtor(codecvt_base *this)
2429 TRACE("(%p)\n", this);
2430 locale_facet_dtor(&this->facet);
2433 DEFINE_THISCALL_WRAPPER(codecvt_base_vector_dtor, 8)
2434 codecvt_base* __thiscall codecvt_base_vector_dtor(codecvt_base *this, unsigned int flags)
2436 TRACE("(%p %x)\n", this, flags);
2437 if(flags & 2) {
2438 /* we have an array, with the number of elements stored before the first object */
2439 INT_PTR i, *ptr = (INT_PTR *)this-1;
2441 for(i=*ptr-1; i>=0; i--)
2442 codecvt_base_dtor(this+i);
2443 MSVCRT_operator_delete(ptr);
2444 } else {
2445 codecvt_base_dtor(this);
2446 if(flags & 1)
2447 MSVCRT_operator_delete(this);
2450 return this;
2453 /* ?do_always_noconv@codecvt_base@std@@MBE_NXZ */
2454 /* ?do_always_noconv@codecvt_base@std@@MEBA_NXZ */
2455 #define call_codecvt_base_do_always_noconv(this) CALL_VTBL_FUNC(this, 4, \
2456 MSVCP_bool, (const codecvt_base*), (this))
2457 DEFINE_THISCALL_WRAPPER(codecvt_base_do_always_noconv, 4)
2458 MSVCP_bool __thiscall codecvt_base_do_always_noconv(const codecvt_base *this)
2460 TRACE("(%p)\n", this);
2461 return TRUE;
2464 /* ?always_noconv@codecvt_base@std@@QBE_NXZ */
2465 /* ?always_noconv@codecvt_base@std@@QEBA_NXZ */
2466 DEFINE_THISCALL_WRAPPER(codecvt_base_always_noconv, 4)
2467 MSVCP_bool __thiscall codecvt_base_always_noconv(const codecvt_base *this)
2469 TRACE("(%p)\n", this);
2470 return call_codecvt_base_do_always_noconv(this);
2473 /* ?do_max_length@codecvt_base@std@@MBEHXZ */
2474 /* ?do_max_length@codecvt_base@std@@MEBAHXZ */
2475 #define call_codecvt_base_do_max_length(this) CALL_VTBL_FUNC(this, 8, \
2476 int, (const codecvt_base*), (this))
2477 DEFINE_THISCALL_WRAPPER(codecvt_base_do_max_length, 4)
2478 int __thiscall codecvt_base_do_max_length(const codecvt_base *this)
2480 TRACE("(%p)\n", this);
2481 return 1;
2484 /* ?max_length@codecvt_base@std@@QBEHXZ */
2485 /* ?max_length@codecvt_base@std@@QEBAHXZ */
2486 DEFINE_THISCALL_WRAPPER(codecvt_base_max_length, 4)
2487 int __thiscall codecvt_base_max_length(const codecvt_base *this)
2489 TRACE("(%p)\n", this);
2490 return call_codecvt_base_do_max_length(this);
2493 /* ?do_encoding@codecvt_base@std@@MBEHXZ */
2494 /* ?do_encoding@codecvt_base@std@@MEBAHXZ */
2495 #define call_codecvt_base_do_encoding(this) CALL_VTBL_FUNC(this, 12, \
2496 int, (const codecvt_base*), (this))
2497 DEFINE_THISCALL_WRAPPER(codecvt_base_do_encoding, 4)
2498 int __thiscall codecvt_base_do_encoding(const codecvt_base *this)
2500 TRACE("(%p)\n", this);
2501 return 1;
2504 /* ?encoding@codecvt_base@std@@QBEHXZ */
2505 /* ?encoding@codecvt_base@std@@QEBAHXZ */
2506 DEFINE_THISCALL_WRAPPER(codecvt_base_encoding, 4)
2507 int __thiscall codecvt_base_encoding(const codecvt_base *this)
2509 TRACE("(%p)\n", this);
2510 return call_codecvt_base_do_encoding(this);
2513 /* ?id@?$codecvt@DDH@std@@2V0locale@2@A */
2514 locale_id codecvt_char_id = {0};
2516 /* ??_7?$codecvt@DDH@std@@6B@ */
2517 extern const vtable_ptr MSVCP_codecvt_char_vtable;
2519 /* ?_Init@?$codecvt@DDH@std@@IAEXABV_Locinfo@2@@Z */
2520 /* ?_Init@?$codecvt@DDH@std@@IEAAXAEBV_Locinfo@2@@Z */
2521 DEFINE_THISCALL_WRAPPER(codecvt_char__Init, 8)
2522 void __thiscall codecvt_char__Init(codecvt_char *this, const _Locinfo *locinfo)
2524 TRACE("(%p %p)\n", this, locinfo);
2527 /* ??0?$codecvt@DDH@std@@QAE@ABV_Locinfo@1@I@Z */
2528 /* ??0?$codecvt@DDH@std@@QEAA@AEBV_Locinfo@1@_K@Z */
2529 DEFINE_THISCALL_WRAPPER(codecvt_char_ctor_locinfo, 12)
2530 codecvt_char* __thiscall codecvt_char_ctor_locinfo(codecvt_char *this, const _Locinfo *locinfo, MSVCP_size_t refs)
2532 TRACE("(%p %p %lu)\n", this, locinfo, refs);
2533 codecvt_base_ctor_refs(&this->base, refs);
2534 this->base.facet.vtable = &MSVCP_codecvt_char_vtable;
2535 return this;
2538 /* ??0?$codecvt@DDH@std@@QAE@I@Z */
2539 /* ??0?$codecvt@DDH@std@@QEAA@_K@Z */
2540 DEFINE_THISCALL_WRAPPER(codecvt_char_ctor_refs, 8)
2541 codecvt_char* __thiscall codecvt_char_ctor_refs(codecvt_char *this, MSVCP_size_t refs)
2543 return codecvt_char_ctor_locinfo(this, NULL, refs);
2546 /* ??_F?$codecvt@DDH@std@@QAEXXZ */
2547 /* ??_F?$codecvt@DDH@std@@QEAAXXZ */
2548 DEFINE_THISCALL_WRAPPER(codecvt_char_ctor, 4)
2549 codecvt_char* __thiscall codecvt_char_ctor(codecvt_char *this)
2551 return codecvt_char_ctor_locinfo(this, NULL, 0);
2554 /* ??1?$codecvt@DDH@std@@UAE@XZ */
2555 /* ??1?$codecvt@DDH@std@@UEAA@XZ */
2556 DEFINE_THISCALL_WRAPPER(codecvt_char_dtor, 4)
2557 void __thiscall codecvt_char_dtor(codecvt_char *this)
2559 TRACE("(%p)\n", this);
2560 codecvt_base_dtor(&this->base);
2563 DEFINE_THISCALL_WRAPPER(codecvt_char_vector_dtor, 8)
2564 codecvt_char* __thiscall codecvt_char_vector_dtor(codecvt_char *this, unsigned int flags)
2566 TRACE("(%p %x)\n", this, flags);
2567 if(flags & 2) {
2568 /* we have an array, with the number of elements stored before the first object */
2569 INT_PTR i, *ptr = (INT_PTR *)this-1;
2571 for(i=*ptr-1; i>=0; i--)
2572 codecvt_char_dtor(this+i);
2573 MSVCRT_operator_delete(ptr);
2574 } else {
2575 codecvt_char_dtor(this);
2576 if(flags & 1)
2577 MSVCRT_operator_delete(this);
2580 return this;
2583 /* ?_Getcat@?$codecvt@DDH@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
2584 /* ?_Getcat@?$codecvt@DDH@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
2585 static MSVCP_size_t codecvt_char__Getcat(const locale_facet **facet, const locale *loc)
2587 TRACE("(%p %p)\n", facet, loc);
2589 if(facet && !*facet) {
2590 *facet = MSVCRT_operator_new(sizeof(codecvt_char));
2591 if(!*facet) {
2592 ERR("Out of memory\n");
2593 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
2594 return 0;
2596 codecvt_char_ctor((codecvt_char*)*facet);
2599 return LC_CTYPE;
2602 codecvt_char* codecvt_char_use_facet(const locale *loc)
2604 static codecvt_char *obj = NULL;
2606 _Lockit lock;
2607 const locale_facet *fac;
2609 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
2610 fac = locale__Getfacet(loc, locale_id_operator_size_t(&codecvt_char_id), TRUE);
2611 if(fac) {
2612 _Lockit_dtor(&lock);
2613 return (codecvt_char*)fac;
2616 if(obj) {
2617 _Lockit_dtor(&lock);
2618 return obj;
2621 codecvt_char__Getcat(&fac, loc);
2622 obj = (codecvt_char*)fac;
2623 locale_facet__Incref(&obj->base.facet);
2624 locale_facet_register(&obj->base.facet);
2625 _Lockit_dtor(&lock);
2627 return obj;
2630 /* ?do_in@?$codecvt@DDH@std@@MBEHAAHPBD1AAPBDPAD3AAPAD@Z */
2631 /* ?do_in@?$codecvt@DDH@std@@MEBAHAEAHPEBD1AEAPEBDPEAD3AEAPEAD@Z */
2632 #define call_codecvt_char_do_in(this, state, from, from_end, from_next, to, to_end, to_next) \
2633 CALL_VTBL_FUNC(this, 16, int, \
2634 (const codecvt_char*, int*, const char*, const char*, const char**, char*, char*, char**), \
2635 (this, state, from, from_end, from_next, to, to_end, to_next))
2636 DEFINE_THISCALL_WRAPPER(codecvt_char_do_in, 32)
2637 int __thiscall codecvt_char_do_in(const codecvt_char *this, int *state,
2638 const char *from, const char *from_end, const char **from_next,
2639 char *to, char *to_end, char **to_next)
2641 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from, from_end,
2642 from_next, to, to_end, to_next);
2643 *from_next = from;
2644 *to_next = to;
2645 return CODECVT_noconv;
2648 /* ?in@?$codecvt@DDH@std@@QBEHAAHPBD1AAPBDPAD3AAPAD@Z */
2649 /* ?in@?$codecvt@DDH@std@@QEBAHAEAHPEBD1AEAPEBDPEAD3AEAPEAD@Z */
2650 DEFINE_THISCALL_WRAPPER(codecvt_char_in, 32)
2651 int __thiscall codecvt_char_in(const codecvt_char *this, int *state,
2652 const char *from, const char *from_end, const char **from_next,
2653 char *to, char *to_end, char **to_next)
2655 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from, from_end,
2656 from_next, to, to_end, to_next);
2657 return call_codecvt_char_do_in(this, state, from, from_end, from_next,
2658 to, to_end, to_next);
2661 /* ?do_out@?$codecvt@DDH@std@@MBEHAAHPBD1AAPBDPAD3AAPAD@Z */
2662 /* ?do_out@?$codecvt@DDH@std@@MEBAHAEAHPEBD1AEAPEBDPEAD3AEAPEAD@Z */
2663 #define call_codecvt_char_do_out(this, state, from, from_end, from_next, to, to_end, to_next) \
2664 CALL_VTBL_FUNC(this, 20, int, \
2665 (const codecvt_char*, int*, const char*, const char*, const char**, char*, char*, char**), \
2666 (this, state, from, from_end, from_next, to, to_end, to_next))
2667 DEFINE_THISCALL_WRAPPER(codecvt_char_do_out, 32)
2668 int __thiscall codecvt_char_do_out(const codecvt_char *this, int *state,
2669 const char *from, const char *from_end, const char **from_next,
2670 char *to, char *to_end, char **to_next)
2672 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from,
2673 from_end, from_next, to, to_end, to_next);
2674 *from_next = from;
2675 *to_next = to;
2676 return CODECVT_noconv;
2679 /* ?out@?$codecvt@DDH@std@@QBEHAAHPBD1AAPBDPAD3AAPAD@Z */
2680 /* ?out@?$codecvt@DDH@std@@QEBAHAEAHPEBD1AEAPEBDPEAD3AEAPEAD@Z */
2681 DEFINE_THISCALL_WRAPPER(codecvt_char_out, 32)
2682 int __thiscall codecvt_char_out(const codecvt_char *this, int *state,
2683 const char *from, const char *from_end, const char **from_next,
2684 char *to, char *to_end, char **to_next)
2686 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from, from_end,
2687 from_next, to, to_end, to_next);
2688 return call_codecvt_char_do_out(this, state, from, from_end, from_next,
2689 to, to_end, to_next);
2692 /* ?do_unshift@?$codecvt@DDH@std@@MBEHAAHPAD1AAPAD@Z */
2693 /* ?do_unshift@?$codecvt@DDH@std@@MEBAHAEAHPEAD1AEAPEAD@Z */
2694 #define call_codecvt_char_do_unshift(this, state, to, to_end, to_next) CALL_VTBL_FUNC(this, 24, \
2695 int, (const codecvt_char*, int*, char*, char*, char**), (this, state, to, to_end, to_next))
2696 DEFINE_THISCALL_WRAPPER(codecvt_char_do_unshift, 20)
2697 int __thiscall codecvt_char_do_unshift(const codecvt_char *this,
2698 int *state, char *to, char *to_end, char **to_next)
2700 TRACE("(%p %p %p %p %p)\n", this, state, to, to_end, to_next);
2701 *to_next = to;
2702 return CODECVT_noconv;
2705 /* ?do_length@?$codecvt@DDH@std@@MBEHABHPBD1I@Z */
2706 /* ?do_length@?$codecvt@DDH@std@@MEBAHAEBHPEBD1_K@Z */
2707 #define call_codecvt_char_do_length(this, state, from, from_end, max) CALL_VTBL_FUNC(this, 28, \
2708 int, (const codecvt_char*, const int*, const char*, const char*, MSVCP_size_t), \
2709 (this, state, from, from_end, max))
2710 DEFINE_THISCALL_WRAPPER(codecvt_char_do_length, 20)
2711 int __thiscall codecvt_char_do_length(const codecvt_char *this, const int *state,
2712 const char *from, const char *from_end, MSVCP_size_t max)
2714 TRACE("(%p %p %p %p %lu)\n", this, state, from, from_end, max);
2715 return (from_end-from > max ? max : from_end-from);
2718 /* ?id@?$codecvt@_WDH@std@@2V0locale@2@A */
2719 static locale_id codecvt_wchar_id = {0};
2720 /* ?id@?$codecvt@GDH@std@@2V0locale@2@A */
2721 locale_id codecvt_short_id = {0};
2723 /* ??_7?$codecvt@_WDH@std@@6B@ */
2724 extern const vtable_ptr MSVCP_codecvt_wchar_vtable;
2725 /* ??_7?$codecvt@GDH@std@@6B@ */
2726 extern const vtable_ptr MSVCP_codecvt_short_vtable;
2728 /* ?_Init@?$codecvt@GDH@std@@IAEXABV_Locinfo@2@@Z */
2729 /* ?_Init@?$codecvt@GDH@std@@IEAAXAEBV_Locinfo@2@@Z */
2730 /* ?_Init@?$codecvt@_WDH@std@@IAEXABV_Locinfo@2@@Z */
2731 /* ?_Init@?$codecvt@_WDH@std@@IEAAXAEBV_Locinfo@2@@Z */
2732 DEFINE_THISCALL_WRAPPER(codecvt_wchar__Init, 8)
2733 void __thiscall codecvt_wchar__Init(codecvt_wchar *this, const _Locinfo *locinfo)
2735 TRACE("(%p %p)\n", this, locinfo);
2736 _Locinfo__Getcvt(locinfo, &this->cvt);
2739 /* ??0?$codecvt@_WDH@std@@QAE@ABV_Locinfo@1@I@Z */
2740 /* ??0?$codecvt@_WDH@std@@QEAA@AEBV_Locinfo@1@_K@Z */
2741 static codecvt_wchar* codecvt_wchar_ctor_locinfo(codecvt_wchar *this, const _Locinfo *locinfo, MSVCP_size_t refs)
2743 TRACE("(%p %p %ld)\n", this, locinfo, refs);
2745 codecvt_base_ctor_refs(&this->base, refs);
2746 this->base.facet.vtable = &MSVCP_codecvt_wchar_vtable;
2748 codecvt_wchar__Init(this, locinfo);
2749 return this;
2752 /* ??0?$codecvt@GDH@std@@QAE@ABV_Locinfo@1@I@Z */
2753 /* ??0?$codecvt@GDH@std@@QEAA@AEBV_Locinfo@1@_K@Z */
2754 DEFINE_THISCALL_WRAPPER(codecvt_short_ctor_locinfo, 12)
2755 codecvt_wchar* __thiscall codecvt_short_ctor_locinfo(codecvt_wchar *this, const _Locinfo *locinfo, MSVCP_size_t refs)
2757 TRACE("(%p %p %ld)\n", this, locinfo, refs);
2759 codecvt_wchar_ctor_locinfo(this, locinfo, refs);
2760 this->base.facet.vtable = &MSVCP_codecvt_short_vtable;
2761 return this;
2764 /* ??0?$codecvt@GDH@std@@QAE@I@Z */
2765 /* ??0?$codecvt@GDH@std@@QEAA@_K@Z */
2766 DEFINE_THISCALL_WRAPPER(codecvt_short_ctor_refs, 8)
2767 codecvt_wchar* __thiscall codecvt_short_ctor_refs(codecvt_wchar *this, MSVCP_size_t refs)
2769 _Locinfo locinfo;
2771 TRACE("(%p %ld)\n", this, refs);
2773 _Locinfo_ctor(&locinfo);
2774 codecvt_short_ctor_locinfo(this, &locinfo, refs);
2775 _Locinfo_dtor(&locinfo);
2776 return this;
2779 /* ??_F?$codecvt@GDH@std@@QAEXXZ */
2780 /* ??_F?$codecvt@GDH@std@@QEAAXXZ */
2781 DEFINE_THISCALL_WRAPPER(codecvt_short_ctor, 4)
2782 codecvt_wchar* __thiscall codecvt_short_ctor(codecvt_wchar *this)
2784 return codecvt_short_ctor_refs(this, 0);
2787 /* ??1?$codecvt@GDH@std@@UAE@XZ */
2788 /* ??1?$codecvt@GDH@std@@UEAA@XZ */
2789 DEFINE_THISCALL_WRAPPER(codecvt_wchar_dtor, 4)
2790 void __thiscall codecvt_wchar_dtor(codecvt_wchar *this)
2792 TRACE("(%p)\n", this);
2793 codecvt_base_dtor(&this->base);
2796 DEFINE_THISCALL_WRAPPER(codecvt_wchar_vector_dtor, 8)
2797 codecvt_wchar* __thiscall codecvt_wchar_vector_dtor(codecvt_wchar *this, unsigned int flags)
2799 TRACE("(%p %x)\n", this, flags);
2800 if(flags & 2) {
2801 /* we have an array, with the number of elements stored before the first object */
2802 INT_PTR i, *ptr = (INT_PTR *)this-1;
2804 for(i=*ptr-1; i>=0; i--)
2805 codecvt_wchar_dtor(this+i);
2806 MSVCRT_operator_delete(ptr);
2807 } else {
2808 codecvt_wchar_dtor(this);
2809 if(flags & 1)
2810 MSVCRT_operator_delete(this);
2813 return this;
2816 /* ?_Getcat@?$codecvt@_WDH@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
2817 /* ?_Getcat@?$codecvt@_WDH@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
2818 static MSVCP_size_t codecvt_wchar__Getcat(const locale_facet **facet, const locale *loc)
2820 TRACE("(%p %p)\n", facet, loc);
2822 if(facet && !*facet) {
2823 _Locinfo locinfo;
2825 *facet = MSVCRT_operator_new(sizeof(codecvt_wchar));
2826 if(!*facet) {
2827 ERR("Out of memory\n");
2828 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
2829 return 0;
2832 _Locinfo_ctor_cstr(&locinfo, basic_string_char_c_str(&loc->ptr->name));
2833 codecvt_wchar_ctor_locinfo((codecvt_wchar*)*facet, &locinfo, 0);
2834 _Locinfo_dtor(&locinfo);
2837 return LC_CTYPE;
2840 static codecvt_wchar* codecvt_wchar_use_facet(const locale *loc)
2842 static codecvt_wchar *obj = NULL;
2844 _Lockit lock;
2845 const locale_facet *fac;
2847 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
2848 fac = locale__Getfacet(loc, locale_id_operator_size_t(&codecvt_wchar_id), TRUE);
2849 if(fac) {
2850 _Lockit_dtor(&lock);
2851 return (codecvt_wchar*)fac;
2854 if(obj) {
2855 _Lockit_dtor(&lock);
2856 return obj;
2859 codecvt_wchar__Getcat(&fac, loc);
2860 obj = (codecvt_wchar*)fac;
2861 locale_facet__Incref(&obj->base.facet);
2862 locale_facet_register(&obj->base.facet);
2863 _Lockit_dtor(&lock);
2865 return obj;
2868 /* ?_Getcat@?$codecvt@GDH@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
2869 /* ?_Getcat@?$codecvt@GDH@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
2870 static MSVCP_size_t codecvt_short__Getcat(const locale_facet **facet, const locale *loc)
2872 TRACE("(%p %p)\n", facet, loc);
2874 if(facet && !*facet) {
2875 _Locinfo locinfo;
2877 *facet = MSVCRT_operator_new(sizeof(codecvt_wchar));
2878 if(!*facet) {
2879 ERR("Out of memory\n");
2880 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
2881 return 0;
2884 _Locinfo_ctor_cstr(&locinfo, basic_string_char_c_str(&loc->ptr->name));
2885 codecvt_short_ctor((codecvt_wchar*)*facet);
2886 _Locinfo_dtor(&locinfo);
2889 return LC_CTYPE;
2892 codecvt_wchar* codecvt_short_use_facet(const locale *loc)
2894 static codecvt_wchar *obj = NULL;
2896 _Lockit lock;
2897 const locale_facet *fac;
2899 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
2900 fac = locale__Getfacet(loc, locale_id_operator_size_t(&codecvt_short_id), TRUE);
2901 if(fac) {
2902 _Lockit_dtor(&lock);
2903 return (codecvt_wchar*)fac;
2906 if(obj) {
2907 _Lockit_dtor(&lock);
2908 return obj;
2911 codecvt_short__Getcat(&fac, loc);
2912 obj = (codecvt_wchar*)fac;
2913 locale_facet__Incref(&obj->base.facet);
2914 locale_facet_register(&obj->base.facet);
2915 _Lockit_dtor(&lock);
2917 return obj;
2920 /* ?do_always_noconv@?$codecvt@GDH@std@@MBE_NXZ */
2921 /* ?do_always_noconv@?$codecvt@GDH@std@@MEBA_NXZ */
2922 /* ?do_always_noconv@?$codecvt@_WDH@std@@MBE_NXZ */
2923 /* ?do_always_noconv@?$codecvt@_WDH@std@@MEBA_NXZ */
2924 DEFINE_THISCALL_WRAPPER(codecvt_wchar_do_always_noconv, 4)
2925 MSVCP_bool __thiscall codecvt_wchar_do_always_noconv(const codecvt_wchar *this)
2927 TRACE("(%p)\n", this);
2928 return FALSE;
2931 /* ?do_max_length@?$codecvt@GDH@std@@MBEHXZ */
2932 /* ?do_max_length@?$codecvt@GDH@std@@MEBAHXZ */
2933 /* ?do_max_length@?$codecvt@_WDH@std@@MBEHXZ */
2934 /* ?do_max_length@?$codecvt@_WDH@std@@MEBAHXZ */
2935 DEFINE_THISCALL_WRAPPER(codecvt_wchar_do_max_length, 4)
2936 int __thiscall codecvt_wchar_do_max_length(const codecvt_wchar *this)
2938 TRACE("(%p)\n", this);
2939 return MB_LEN_MAX;
2942 /* ?do_in@?$codecvt@GDH@std@@MBEHAAHPBD1AAPBDPAG3AAPAG@Z */
2943 /* ?do_in@?$codecvt@GDH@std@@MEBAHAEAHPEBD1AEAPEBDPEAG3AEAPEAG@Z */
2944 /* ?do_in@?$codecvt@_WDH@std@@MBEHAAHPBD1AAPBDPA_W3AAPA_W@Z */
2945 /* ?do_in@?$codecvt@_WDH@std@@MEBAHAEAHPEBD1AEAPEBDPEA_W3AEAPEA_W@Z */
2946 #define call_codecvt_wchar_do_in(this, state, from, from_end, from_next, to, to_end, to_next) \
2947 CALL_VTBL_FUNC(this, 16, int, \
2948 (const codecvt_wchar*, int*, const char*, const char*, const char**, wchar_t*, wchar_t*, wchar_t**), \
2949 (this, state, from, from_end, from_next, to, to_end, to_next))
2950 DEFINE_THISCALL_WRAPPER(codecvt_wchar_do_in, 32)
2951 int __thiscall codecvt_wchar_do_in(const codecvt_wchar *this, int *state,
2952 const char *from, const char *from_end, const char **from_next,
2953 wchar_t *to, wchar_t *to_end, wchar_t **to_next)
2955 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from,
2956 from_end, from_next, to, to_end, to_next);
2958 *from_next = from;
2959 *to_next = to;
2961 while(*from_next!=from_end && *to_next!=to_end) {
2962 switch(_Mbrtowc(*to_next, *from_next, from_end-*from_next, state, &this->cvt)) {
2963 case -2:
2964 *from_next = from_end;
2965 return CODECVT_partial;
2966 case -1:
2967 return CODECVT_error;
2968 case 2:
2969 (*from_next)++;
2970 /* fall through */
2971 case 0:
2972 case 1:
2973 (*from_next)++;
2974 (*to_next)++;
2978 return CODECVT_ok;
2981 /* ?in@?$codecvt@GDH@std@@QBEHAAHPBD1AAPBDPAG3AAPAG@Z */
2982 /* ?in@?$codecvt@GDH@std@@QEBAHAEAHPEBD1AEAPEBDPEAG3AEAPEAG@Z */
2983 /* ?in@?$codecvt@_WDH@std@@QBEHAAHPBD1AAPBDPA_W3AAPA_W@Z */
2984 /* ?in@?$codecvt@_WDH@std@@QEBAHAEAHPEBD1AEAPEBDPEA_W3AEAPEA_W@Z */
2985 DEFINE_THISCALL_WRAPPER(codecvt_wchar_in, 32)
2986 int __thiscall codecvt_wchar_in(const codecvt_wchar *this, int *state,
2987 const char *from, const char *from_end, const char **from_next,
2988 wchar_t *to, wchar_t *to_end, wchar_t **to_next)
2990 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from,
2991 from_end, from_next, to, to_end, to_next);
2992 return call_codecvt_wchar_do_in(this, state, from,
2993 from_end, from_next, to, to_end, to_next);
2996 /* ?do_out@?$codecvt@GDH@std@@MBEHAAHPBG1AAPBGPAD3AAPAD@Z */
2997 /* ?do_out@?$codecvt@GDH@std@@MEBAHAEAHPEBG1AEAPEBGPEAD3AEAPEAD@Z */
2998 /* ?do_out@?$codecvt@_WDH@std@@MBEHAAHPB_W1AAPB_WPAD3AAPAD@Z */
2999 /* ?do_out@?$codecvt@_WDH@std@@MEBAHAEAHPEB_W1AEAPEB_WPEAD3AEAPEAD@Z */
3000 #define call_codecvt_wchar_do_out(this, state, from, from_end, from_next, to, to_end, to_next) \
3001 CALL_VTBL_FUNC(this, 20, int, \
3002 (const codecvt_wchar*, int*, const wchar_t*, const wchar_t*, const wchar_t**, char*, char*, char**), \
3003 (this, state, from, from_end, from_next, to, to_end, to_next))
3004 DEFINE_THISCALL_WRAPPER(codecvt_wchar_do_out, 32)
3005 int __thiscall codecvt_wchar_do_out(const codecvt_wchar *this, int *state,
3006 const wchar_t *from, const wchar_t *from_end, const wchar_t **from_next,
3007 char *to, char *to_end, char **to_next)
3009 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from,
3010 from_end, from_next, to, to_end, to_next);
3012 *from_next = from;
3013 *to_next = to;
3015 while(*from_next!=from_end && *to_next!=to_end) {
3016 int old_state = *state, size;
3017 char buf[MB_LEN_MAX];
3019 switch((size = _Wcrtomb(buf, **from_next, state, &this->cvt))) {
3020 case -1:
3021 return CODECVT_error;
3022 default:
3023 if(size > from_end-*from_next) {
3024 *state = old_state;
3025 return CODECVT_partial;
3028 (*from_next)++;
3029 memcpy_s(*to_next, to_end-*to_next, buf, size);
3030 (*to_next) += size;
3034 return CODECVT_ok;
3037 /* ?out@?$codecvt@GDH@std@@QBEHAAHPBG1AAPBGPAD3AAPAD@Z */
3038 /* ?out@?$codecvt@GDH@std@@QEBAHAEAHPEBG1AEAPEBGPEAD3AEAPEAD@Z */
3039 /* ?out@?$codecvt@_WDH@std@@QBEHAAHPB_W1AAPB_WPAD3AAPAD@Z */
3040 /* ?out@?$codecvt@_WDH@std@@QEBAHAEAHPEB_W1AEAPEB_WPEAD3AEAPEAD@Z */
3041 DEFINE_THISCALL_WRAPPER(codecvt_wchar_out, 32)
3042 int __thiscall codecvt_wchar_out(const codecvt_wchar *this, int *state,
3043 const wchar_t *from, const wchar_t *from_end, const wchar_t **from_next,
3044 char *to, char *to_end, char **to_next)
3046 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from,
3047 from_end, from_next, to, to_end, to_next);
3048 return call_codecvt_wchar_do_out(this, state, from,
3049 from_end, from_next, to, to_end, to_next);
3052 /* ?do_unshift@?$codecvt@GDH@std@@MBEHAAHPAD1AAPAD@Z */
3053 /* ?do_unshift@?$codecvt@GDH@std@@MEBAHAEAHPEAD1AEAPEAD@Z */
3054 /* ?do_unshift@?$codecvt@_WDH@std@@MBEHAAHPAD1AAPAD@Z */
3055 /* ?do_unshift@?$codecvt@_WDH@std@@MEBAHAEAHPEAD1AEAPEAD@Z */
3056 #define call_codecvt_wchar_do_unshift(this, state, to, to_end, to_next) CALL_VTBL_FUNC(this, 24, \
3057 int, (const codecvt_wchar*, int*, char*, char*, char**), (this, state, to, to_end, to_next))
3058 DEFINE_THISCALL_WRAPPER(codecvt_wchar_do_unshift, 20)
3059 int __thiscall codecvt_wchar_do_unshift(const codecvt_wchar *this,
3060 int *state, char *to, char *to_end, char **to_next)
3062 TRACE("(%p %p %p %p %p)\n", this, state, to, to_end, to_next);
3063 if(*state)
3064 WARN("unexpected state: %x\n", *state);
3066 *to_next = to;
3067 return CODECVT_ok;
3070 /* ?do_length@?$codecvt@GDH@std@@MBEHABHPBD1I@Z */
3071 /* ?do_length@?$codecvt@GDH@std@@MEBAHAEBHPEBD1_K@Z */
3072 /* ?do_length@?$codecvt@_WDH@std@@MBEHABHPBD1I@Z */
3073 /* ?do_length@?$codecvt@_WDH@std@@MEBAHAEBHPEBD1_K@Z */
3074 #define call_codecvt_wchar_do_length(this, state, from, from_end, max) CALL_VTBL_FUNC(this, 28, \
3075 int, (const codecvt_wchar*, const int*, const char*, const char*, MSVCP_size_t), \
3076 (this, state, from, from_end, max))
3077 DEFINE_THISCALL_WRAPPER(codecvt_wchar_do_length, 20)
3078 int __thiscall codecvt_wchar_do_length(const codecvt_wchar *this, const int *state,
3079 const char *from, const char *from_end, MSVCP_size_t max)
3081 int tmp_state = *state, ret=0;
3083 TRACE("(%p %p %p %p %ld)\n", this, state, from, from_end, max);
3085 while(ret<max && from!=from_end) {
3086 switch(_Mbrtowc(NULL, from, from_end-from, &tmp_state, &this->cvt)) {
3087 case -2:
3088 case -1:
3089 return ret;
3090 case 2:
3091 from++;
3092 /* fall through */
3093 case 0:
3094 case 1:
3095 from++;
3096 ret++;
3100 return ret;
3103 /* ?id@?$numpunct@D@std@@2V0locale@2@A */
3104 locale_id numpunct_char_id = {0};
3106 /* ??_7?$numpunct@D@std@@6B@ */
3107 extern const vtable_ptr MSVCP_numpunct_char_vtable;
3109 /* ?_Init@?$numpunct@D@std@@IAEXABV_Locinfo@2@_N@Z */
3110 /* ?_Init@?$numpunct@D@std@@IEAAXAEBV_Locinfo@2@_N@Z */
3111 static void numpunct_char__Init(numpunct_char *this, const _Locinfo *locinfo, MSVCP_bool isdef)
3113 int len;
3115 TRACE("(%p %p %d)\n", this, locinfo, isdef);
3117 len = strlen(_Locinfo__Getfalse(locinfo))+1;
3118 this->false_name = MSVCRT_operator_new(len);
3119 if(this->false_name)
3120 memcpy((char*)this->false_name, _Locinfo__Getfalse(locinfo), len);
3122 len = strlen(_Locinfo__Gettrue(locinfo))+1;
3123 this->true_name = MSVCRT_operator_new(len);
3124 if(this->true_name)
3125 memcpy((char*)this->true_name, _Locinfo__Gettrue(locinfo), len);
3127 if(isdef) {
3128 this->grouping = MSVCRT_operator_new(1);
3129 if(this->grouping)
3130 *(char*)this->grouping = 0;
3132 this->dp = '.';
3133 this->sep = ',';
3134 } else {
3135 const struct lconv *lc = _Locinfo__Getlconv(locinfo);
3137 len = strlen(lc->grouping)+1;
3138 this->grouping = MSVCRT_operator_new(len);
3139 if(this->grouping)
3140 memcpy((char*)this->grouping, lc->grouping, len);
3142 this->dp = lc->decimal_point[0];
3143 this->sep = lc->thousands_sep[0];
3146 if(!this->false_name || !this->true_name || !this->grouping) {
3147 MSVCRT_operator_delete((char*)this->grouping);
3148 MSVCRT_operator_delete((char*)this->false_name);
3149 MSVCRT_operator_delete((char*)this->true_name);
3151 ERR("Out of memory\n");
3152 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
3156 /* ?_Tidy@?$numpunct@D@std@@AAEXXZ */
3157 /* ?_Tidy@?$numpunct@D@std@@AEAAXXZ */
3158 static void numpunct_char__Tidy(numpunct_char *this)
3160 TRACE("(%p)\n", this);
3162 MSVCRT_operator_delete((char*)this->grouping);
3163 MSVCRT_operator_delete((char*)this->false_name);
3164 MSVCRT_operator_delete((char*)this->true_name);
3167 /* ??0?$numpunct@D@std@@QAE@ABV_Locinfo@1@I_N@Z */
3168 /* ??0?$numpunct@D@std@@QEAA@AEBV_Locinfo@1@_K_N@Z */
3169 static numpunct_char* numpunct_char_ctor_locinfo(numpunct_char *this,
3170 const _Locinfo *locinfo, MSVCP_size_t refs, MSVCP_bool usedef)
3172 TRACE("(%p %p %lu %d)\n", this, locinfo, refs, usedef);
3173 locale_facet_ctor_refs(&this->facet, refs);
3174 this->facet.vtable = &MSVCP_numpunct_char_vtable;
3175 numpunct_char__Init(this, locinfo, usedef);
3176 return this;
3179 /* ??0?$numpunct@D@std@@IAE@PBDI_N@Z */
3180 /* ??0?$numpunct@D@std@@IEAA@PEBD_K_N@Z */
3181 static numpunct_char* numpunct_char_ctor_name(numpunct_char *this,
3182 const char *name, MSVCP_size_t refs, MSVCP_bool usedef)
3184 _Locinfo locinfo;
3186 TRACE("(%p %s %lu %d)\n", this, debugstr_a(name), refs, usedef);
3187 locale_facet_ctor_refs(&this->facet, refs);
3188 this->facet.vtable = &MSVCP_numpunct_char_vtable;
3190 _Locinfo_ctor_cstr(&locinfo, name);
3191 numpunct_char__Init(this, &locinfo, usedef);
3192 _Locinfo_dtor(&locinfo);
3193 return this;
3196 /* ??0?$numpunct@D@std@@QAE@I@Z */
3197 /* ??0?$numpunct@D@std@@QEAA@_K@Z */
3198 DEFINE_THISCALL_WRAPPER(numpunct_char_ctor_refs, 8)
3199 numpunct_char* __thiscall numpunct_char_ctor_refs(numpunct_char *this, MSVCP_size_t refs)
3201 TRACE("(%p %lu)\n", this, refs);
3202 return numpunct_char_ctor_name(this, "C", refs, FALSE);
3205 /* ??_F?$numpunct@D@std@@QAEXXZ */
3206 /* ??_F?$numpunct@D@std@@QEAAXXZ */
3207 DEFINE_THISCALL_WRAPPER(numpunct_char_ctor, 4)
3208 numpunct_char* __thiscall numpunct_char_ctor(numpunct_char *this)
3210 return numpunct_char_ctor_refs(this, 0);
3213 /* ??1?$numpunct@D@std@@UAE@XZ */
3214 /* ??1?$numpunct@D@std@@UEAA@XZ */
3215 DEFINE_THISCALL_WRAPPER(numpunct_char_dtor, 4)
3216 void __thiscall numpunct_char_dtor(numpunct_char *this)
3218 TRACE("(%p)\n", this);
3219 numpunct_char__Tidy(this);
3222 DEFINE_THISCALL_WRAPPER(numpunct_char_vector_dtor, 8)
3223 numpunct_char* __thiscall numpunct_char_vector_dtor(numpunct_char *this, unsigned int flags)
3225 TRACE("(%p %x)\n", this, flags);
3226 if(flags & 2) {
3227 /* we have an array, with the number of elements stored before the first object */
3228 INT_PTR i, *ptr = (INT_PTR *)this-1;
3230 for(i=*ptr-1; i>=0; i--)
3231 numpunct_char_dtor(this+i);
3232 MSVCRT_operator_delete(ptr);
3233 } else {
3234 numpunct_char_dtor(this);
3235 if(flags & 1)
3236 MSVCRT_operator_delete(this);
3239 return this;
3242 /* ?_Getcat@?$numpunct@D@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
3243 /* ?_Getcat@?$numpunct@D@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
3244 static MSVCP_size_t numpunct_char__Getcat(const locale_facet **facet, const locale *loc)
3246 TRACE("(%p %p)\n", facet, loc);
3248 if(facet && !*facet) {
3249 *facet = MSVCRT_operator_new(sizeof(numpunct_char));
3250 if(!*facet) {
3251 ERR("Out of memory\n");
3252 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
3253 return 0;
3255 numpunct_char_ctor_name((numpunct_char*)*facet,
3256 basic_string_char_c_str(&loc->ptr->name), 0, TRUE);
3259 return LC_NUMERIC;
3262 static numpunct_char* numpunct_char_use_facet(const locale *loc)
3264 static numpunct_char *obj = NULL;
3266 _Lockit lock;
3267 const locale_facet *fac;
3269 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
3270 fac = locale__Getfacet(loc, locale_id_operator_size_t(&numpunct_char_id), TRUE);
3271 if(fac) {
3272 _Lockit_dtor(&lock);
3273 return (numpunct_char*)fac;
3276 if(obj) {
3277 _Lockit_dtor(&lock);
3278 return obj;
3281 numpunct_char__Getcat(&fac, loc);
3282 obj = (numpunct_char*)fac;
3283 locale_facet__Incref(&obj->facet);
3284 locale_facet_register(&obj->facet);
3285 _Lockit_dtor(&lock);
3287 return obj;
3290 /* ?do_decimal_point@?$numpunct@D@std@@MBEDXZ */
3291 /* ?do_decimal_point@?$numpunct@D@std@@MEBADXZ */
3292 DEFINE_THISCALL_WRAPPER(numpunct_char_do_decimal_point, 4)
3293 #define call_numpunct_char_do_decimal_point(this) CALL_VTBL_FUNC(this, 4, \
3294 char, (const numpunct_char *this), (this))
3295 char __thiscall numpunct_char_do_decimal_point(const numpunct_char *this)
3297 TRACE("(%p)\n", this);
3298 return this->dp;
3301 /* ?decimal_point@?$numpunct@D@std@@QBEDXZ */
3302 /* ?decimal_point@?$numpunct@D@std@@QEBADXZ */
3303 DEFINE_THISCALL_WRAPPER(numpunct_char_decimal_point, 4)
3304 char __thiscall numpunct_char_decimal_point(const numpunct_char *this)
3306 TRACE("(%p)\n", this);
3307 return call_numpunct_char_do_decimal_point(this);
3310 /* ?do_thousands_sep@?$numpunct@D@std@@MBEDXZ */
3311 /* ?do_thousands_sep@?$numpunct@D@std@@MEBADXZ */
3312 DEFINE_THISCALL_WRAPPER(numpunct_char_do_thousands_sep, 4)
3313 #define call_numpunct_char_do_thousands_sep(this) CALL_VTBL_FUNC(this, 8, \
3314 char, (const numpunct_char*), (this))
3315 char __thiscall numpunct_char_do_thousands_sep(const numpunct_char *this)
3317 TRACE("(%p)\n", this);
3318 return this->sep;
3321 /* ?thousands_sep@?$numpunct@D@std@@QBEDXZ */
3322 /* ?thousands_sep@?$numpunct@D@std@@QEBADXZ */
3323 DEFINE_THISCALL_WRAPPER(numpunct_char_thousands_sep, 4)
3324 char __thiscall numpunct_char_thousands_sep(const numpunct_char *this)
3326 TRACE("(%p)\n", this);
3327 return call_numpunct_char_do_thousands_sep(this);
3330 /* ?do_grouping@?$numpunct@D@std@@MBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3331 /* ?do_grouping@?$numpunct@D@std@@MEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3332 DEFINE_THISCALL_WRAPPER(numpunct_char_do_grouping, 8)
3333 #define call_numpunct_char_do_grouping(this, ret) CALL_VTBL_FUNC(this, 12, \
3334 basic_string_char*, (const numpunct_char*, basic_string_char*), (this, ret))
3335 basic_string_char* __thiscall numpunct_char_do_grouping(
3336 const numpunct_char *this, basic_string_char *ret)
3338 TRACE("(%p)\n", this);
3339 return basic_string_char_ctor_cstr(ret, this->grouping);
3342 /* ?grouping@?$numpunct@D@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3343 /* ?grouping@?$numpunct@D@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3344 DEFINE_THISCALL_WRAPPER(numpunct_char_grouping, 8)
3345 basic_string_char* __thiscall numpunct_char_grouping(const numpunct_char *this, basic_string_char *ret)
3347 TRACE("(%p)\n", this);
3348 return call_numpunct_char_do_grouping(this, ret);
3351 /* ?do_falsename@?$numpunct@D@std@@MBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3352 /* ?do_falsename@?$numpunct@D@std@@MEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3353 DEFINE_THISCALL_WRAPPER(numpunct_char_do_falsename, 8)
3354 #define call_numpunct_char_do_falsename(this, ret) CALL_VTBL_FUNC(this, 16, \
3355 basic_string_char*, (const numpunct_char*, basic_string_char*), (this, ret))
3356 basic_string_char* __thiscall numpunct_char_do_falsename(
3357 const numpunct_char *this, basic_string_char *ret)
3359 TRACE("(%p)\n", this);
3360 return basic_string_char_ctor_cstr(ret, this->false_name);
3363 /* ?falsename@?$numpunct@D@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3364 /* ?falsename@?$numpunct@D@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3365 DEFINE_THISCALL_WRAPPER(numpunct_char_falsename, 8)
3366 basic_string_char* __thiscall numpunct_char_falsename(const numpunct_char *this, basic_string_char *ret)
3368 TRACE("(%p)\n", this);
3369 return call_numpunct_char_do_falsename(this, ret);
3372 /* ?do_truename@?$numpunct@D@std@@MBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3373 /* ?do_truename@?$numpunct@D@std@@MEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3374 DEFINE_THISCALL_WRAPPER(numpunct_char_do_truename, 8)
3375 #define call_numpunct_char_do_truename(this, ret) CALL_VTBL_FUNC(this, 20, \
3376 basic_string_char*, (const numpunct_char*, basic_string_char*), (this, ret))
3377 basic_string_char* __thiscall numpunct_char_do_truename(
3378 const numpunct_char *this, basic_string_char *ret)
3380 TRACE("(%p)\n", this);
3381 return basic_string_char_ctor_cstr(ret, this->true_name);
3384 /* ?truename@?$numpunct@D@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3385 /* ?truename@?$numpunct@D@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3386 DEFINE_THISCALL_WRAPPER(numpunct_char_truename, 8)
3387 basic_string_char* __thiscall numpunct_char_truename(const numpunct_char *this, basic_string_char *ret)
3389 TRACE("(%p)\n", this);
3390 return call_numpunct_char_do_truename(this, ret);
3393 /* ?id@?$numpunct@_W@std@@2V0locale@2@A */
3394 static locale_id numpunct_wchar_id = {0};
3395 /* ?id@?$numpunct@G@std@@2V0locale@2@A */
3396 locale_id numpunct_short_id = {0};
3398 /* ??_7?$numpunct@_W@std@@6B@ */
3399 extern const vtable_ptr MSVCP_numpunct_wchar_vtable;
3400 /* ??_7?$numpunct@G@std@@6B@ */
3401 extern const vtable_ptr MSVCP_numpunct_short_vtable;
3403 /* ?_Init@?$numpunct@_W@std@@IAEXABV_Locinfo@2@_N@Z */
3404 /* ?_Init@?$numpunct@_W@std@@IEAAXAEBV_Locinfo@2@_N@Z */
3405 /* ?_Init@?$numpunct@G@std@@IAEXABV_Locinfo@2@_N@Z */
3406 /* ?_Init@?$numpunct@G@std@@IEAAXAEBV_Locinfo@2@_N@Z */
3407 static void numpunct_wchar__Init(numpunct_wchar *this,
3408 const _Locinfo *locinfo, MSVCP_bool isdef)
3410 const char *to_convert;
3411 _Cvtvec cvt;
3412 int len;
3414 TRACE("(%p %p %d)\n", this, locinfo, isdef);
3416 _Locinfo__Getcvt(locinfo, &cvt);
3418 to_convert = _Locinfo__Getfalse(locinfo);
3419 len = MultiByteToWideChar(cvt.page, 0, to_convert, -1, NULL, 0);
3420 this->false_name = MSVCRT_operator_new(len*sizeof(WCHAR));
3421 if(this->false_name)
3422 MultiByteToWideChar(cvt.page, 0, to_convert, -1,
3423 (wchar_t*)this->false_name, len);
3425 to_convert = _Locinfo__Gettrue(locinfo);
3426 len = MultiByteToWideChar(cvt.page, 0, to_convert, -1, NULL, 0);
3427 this->true_name = MSVCRT_operator_new(len*sizeof(WCHAR));
3428 if(this->true_name)
3429 MultiByteToWideChar(cvt.page, 0, to_convert, -1,
3430 (wchar_t*)this->true_name, len);
3432 if(isdef) {
3433 this->grouping = MSVCRT_operator_new(1);
3434 if(this->grouping)
3435 *(char*)this->grouping = 0;
3437 this->dp = '.';
3438 this->sep = ',';
3439 } else {
3440 const struct lconv *lc = _Locinfo__Getlconv(locinfo);
3442 len = strlen(lc->grouping)+1;
3443 this->grouping = MSVCRT_operator_new(len);
3444 if(this->grouping)
3445 memcpy((char*)this->grouping, lc->grouping, len);
3447 this->dp = lc->decimal_point[0];
3448 this->sep = lc->thousands_sep[0];
3451 if(!this->false_name || !this->true_name || !this->grouping) {
3452 MSVCRT_operator_delete((char*)this->grouping);
3453 MSVCRT_operator_delete((wchar_t*)this->false_name);
3454 MSVCRT_operator_delete((wchar_t*)this->true_name);
3456 ERR("Out of memory\n");
3457 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
3461 /* ?_Tidy@?$numpunct@_W@std@@AAEXXZ */
3462 /* ?_Tidy@?$numpunct@_W@std@@AEAAXXZ */
3463 /* ?_Tidy@?$numpunct@G@std@@AAEXXZ */
3464 /* ?_Tidy@?$numpunct@G@std@@AEAAXXZ */
3465 static void numpunct_wchar__Tidy(numpunct_wchar *this)
3467 TRACE("(%p)\n", this);
3469 MSVCRT_operator_delete((char*)this->grouping);
3470 MSVCRT_operator_delete((wchar_t*)this->false_name);
3471 MSVCRT_operator_delete((wchar_t*)this->true_name);
3474 /* ??0?$numpunct@_W@std@@QAE@ABV_Locinfo@1@I_N@Z */
3475 /* ??0?$numpunct@_W@std@@QEAA@AEBV_Locinfo@1@_K_N@Z */
3476 static numpunct_wchar* numpunct_wchar_ctor_locinfo(numpunct_wchar *this,
3477 const _Locinfo *locinfo, MSVCP_size_t refs, MSVCP_bool usedef)
3479 TRACE("(%p %p %lu %d)\n", this, locinfo, refs, usedef);
3480 locale_facet_ctor_refs(&this->facet, refs);
3481 this->facet.vtable = &MSVCP_numpunct_wchar_vtable;
3482 numpunct_wchar__Init(this, locinfo, usedef);
3483 return this;
3486 /* ??0?$numpunct@G@std@@QAE@ABV_Locinfo@1@I_N@Z */
3487 /* ??0?$numpunct@G@std@@QEAA@AEBV_Locinfo@1@_K_N@Z */
3488 static numpunct_wchar* numpunct_short_ctor_locinfo(numpunct_wchar *this,
3489 const _Locinfo *locinfo, MSVCP_size_t refs, MSVCP_bool usedef)
3491 numpunct_wchar_ctor_locinfo(this, locinfo, refs, usedef);
3492 this->facet.vtable = &MSVCP_numpunct_short_vtable;
3493 return this;
3496 /* ??0?$numpunct@_W@std@@IAE@PBDI_N@Z */
3497 /* ??0?$numpunct@_W@std@@IEAA@PEBD_K_N@Z */
3498 static numpunct_wchar* numpunct_wchar_ctor_name(numpunct_wchar *this,
3499 const char *name, MSVCP_size_t refs, MSVCP_bool usedef)
3501 _Locinfo locinfo;
3503 TRACE("(%p %s %lu %d)\n", this, debugstr_a(name), refs, usedef);
3504 locale_facet_ctor_refs(&this->facet, refs);
3505 this->facet.vtable = &MSVCP_numpunct_wchar_vtable;
3507 _Locinfo_ctor_cstr(&locinfo, name);
3508 numpunct_wchar__Init(this, &locinfo, usedef);
3509 _Locinfo_dtor(&locinfo);
3510 return this;
3513 /* ??0?$numpunct@G@std@@IAE@PBDI_N@Z */
3514 /* ??0?$numpunct@G@std@@IEAA@PEBD_K_N@Z */
3515 static numpunct_wchar* numpunct_short_ctor_name(numpunct_wchar *this,
3516 const char *name, MSVCP_size_t refs, MSVCP_bool usedef)
3518 numpunct_wchar_ctor_name(this, name, refs, usedef);
3519 this->facet.vtable = &MSVCP_numpunct_short_vtable;
3520 return this;
3523 /* ??0?$numpunct@_W@std@@QAE@I@Z */
3524 /* ??0?$numpunct@_W@std@@QEAA@_K@Z */
3525 static numpunct_wchar* numpunct_wchar_ctor_refs(numpunct_wchar *this, MSVCP_size_t refs)
3527 TRACE("(%p %lu)\n", this, refs);
3528 return numpunct_wchar_ctor_name(this, "C", refs, FALSE);
3531 /* ??0?$numpunct@G@std@@QAE@I@Z */
3532 /* ??0?$numpunct@G@std@@QEAA@_K@Z */
3533 DEFINE_THISCALL_WRAPPER(numpunct_short_ctor_refs, 8)
3534 numpunct_wchar* __thiscall numpunct_short_ctor_refs(numpunct_wchar *this, MSVCP_size_t refs)
3536 numpunct_wchar_ctor_refs(this, refs);
3537 this->facet.vtable = &MSVCP_numpunct_short_vtable;
3538 return this;
3541 /* ??_F?$numpunct@G@std@@QAEXXZ */
3542 /* ??_F?$numpunct@G@std@@QEAAXXZ */
3543 DEFINE_THISCALL_WRAPPER(numpunct_short_ctor, 4)
3544 numpunct_wchar* __thiscall numpunct_short_ctor(numpunct_wchar *this)
3546 return numpunct_short_ctor_refs(this, 0);
3549 /* ??1?$numpunct@G@std@@UAE@XZ */
3550 /* ??1?$numpunct@G@std@@UEAA@XZ */
3551 DEFINE_THISCALL_WRAPPER(numpunct_wchar_dtor, 4)
3552 void __thiscall numpunct_wchar_dtor(numpunct_wchar *this)
3554 TRACE("(%p)\n", this);
3555 numpunct_wchar__Tidy(this);
3558 DEFINE_THISCALL_WRAPPER(numpunct_wchar_vector_dtor, 8)
3559 numpunct_wchar* __thiscall numpunct_wchar_vector_dtor(numpunct_wchar *this, unsigned int flags)
3561 TRACE("(%p %x)\n", this, flags);
3562 if(flags & 2) {
3563 /* we have an array, with the number of elements stored before the first object */
3564 INT_PTR i, *ptr = (INT_PTR *)this-1;
3566 for(i=*ptr-1; i>=0; i--)
3567 numpunct_wchar_dtor(this+i);
3568 MSVCRT_operator_delete(ptr);
3569 } else {
3570 numpunct_wchar_dtor(this);
3571 if(flags & 1)
3572 MSVCRT_operator_delete(this);
3575 return this;
3578 /* ?_Getcat@?$numpunct@_W@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
3579 /* ?_Getcat@?$numpunct@_W@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
3580 static MSVCP_size_t numpunct_wchar__Getcat(const locale_facet **facet, const locale *loc)
3582 TRACE("(%p %p)\n", facet, loc);
3584 if(facet && !*facet) {
3585 *facet = MSVCRT_operator_new(sizeof(numpunct_wchar));
3586 if(!*facet) {
3587 ERR("Out of memory\n");
3588 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
3589 return 0;
3591 numpunct_wchar_ctor_name((numpunct_wchar*)*facet,
3592 basic_string_char_c_str(&loc->ptr->name), 0, TRUE);
3595 return LC_NUMERIC;
3598 static numpunct_wchar* numpunct_wchar_use_facet(const locale *loc)
3600 static numpunct_wchar *obj = NULL;
3602 _Lockit lock;
3603 const locale_facet *fac;
3605 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
3606 fac = locale__Getfacet(loc, locale_id_operator_size_t(&numpunct_wchar_id), TRUE);
3607 if(fac) {
3608 _Lockit_dtor(&lock);
3609 return (numpunct_wchar*)fac;
3612 if(obj) {
3613 _Lockit_dtor(&lock);
3614 return obj;
3617 numpunct_wchar__Getcat(&fac, loc);
3618 obj = (numpunct_wchar*)fac;
3619 locale_facet__Incref(&obj->facet);
3620 locale_facet_register(&obj->facet);
3621 _Lockit_dtor(&lock);
3623 return obj;
3626 /* ?_Getcat@?$numpunct@G@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
3627 /* ?_Getcat@?$numpunct@G@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
3628 static MSVCP_size_t numpunct_short__Getcat(const locale_facet **facet, const locale *loc)
3630 TRACE("(%p %p)\n", facet, loc);
3632 if(facet && !*facet) {
3633 *facet = MSVCRT_operator_new(sizeof(numpunct_wchar));
3634 if(!*facet) {
3635 ERR("Out of memory\n");
3636 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
3637 return 0;
3639 numpunct_short_ctor_name((numpunct_wchar*)*facet,
3640 basic_string_char_c_str(&loc->ptr->name), 0, TRUE);
3643 return LC_NUMERIC;
3646 static numpunct_wchar* numpunct_short_use_facet(const locale *loc)
3648 static numpunct_wchar *obj = NULL;
3650 _Lockit lock;
3651 const locale_facet *fac;
3653 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
3654 fac = locale__Getfacet(loc, locale_id_operator_size_t(&numpunct_short_id), TRUE);
3655 if(fac) {
3656 _Lockit_dtor(&lock);
3657 return (numpunct_wchar*)fac;
3660 if(obj) {
3661 _Lockit_dtor(&lock);
3662 return obj;
3665 numpunct_short__Getcat(&fac, loc);
3666 obj = (numpunct_wchar*)fac;
3667 locale_facet__Incref(&obj->facet);
3668 locale_facet_register(&obj->facet);
3669 _Lockit_dtor(&lock);
3671 return obj;
3674 /* ?do_decimal_point@?$numpunct@_W@std@@MBE_WXZ */
3675 /* ?do_decimal_point@?$numpunct@_W@std@@MEBA_WXZ */
3676 /* ?do_decimal_point@?$numpunct@G@std@@MBEGXZ */
3677 /* ?do_decimal_point@?$numpunct@G@std@@MEBAGXZ */
3678 DEFINE_THISCALL_WRAPPER(numpunct_wchar_do_decimal_point, 4)
3679 #define call_numpunct_wchar_do_decimal_point(this) CALL_VTBL_FUNC(this, 4, \
3680 wchar_t, (const numpunct_wchar *this), (this))
3681 wchar_t __thiscall numpunct_wchar_do_decimal_point(const numpunct_wchar *this)
3683 TRACE("(%p)\n", this);
3684 return this->dp;
3687 /* ?decimal_point@?$numpunct@_W@std@@QBE_WXZ */
3688 /* ?decimal_point@?$numpunct@_W@std@@QEBA_WXZ */
3689 /* ?decimal_point@?$numpunct@G@std@@QBEGXZ */
3690 /* ?decimal_point@?$numpunct@G@std@@QEBAGXZ */
3691 DEFINE_THISCALL_WRAPPER(numpunct_wchar_decimal_point, 4)
3692 wchar_t __thiscall numpunct_wchar_decimal_point(const numpunct_wchar *this)
3694 TRACE("(%p)\n", this);
3695 return call_numpunct_wchar_do_decimal_point(this);
3698 /* ?do_thousands_sep@?$numpunct@_W@std@@MBE_WXZ */
3699 /* ?do_thousands_sep@?$numpunct@_W@std@@MEBA_WXZ */
3700 /* ?do_thousands_sep@?$numpunct@G@std@@MBEGXZ */
3701 /* ?do_thousands_sep@?$numpunct@G@std@@MEBAGXZ */
3702 DEFINE_THISCALL_WRAPPER(numpunct_wchar_do_thousands_sep, 4)
3703 #define call_numpunct_wchar_do_thousands_sep(this) CALL_VTBL_FUNC(this, 8, \
3704 wchar_t, (const numpunct_wchar *this), (this))
3705 wchar_t __thiscall numpunct_wchar_do_thousands_sep(const numpunct_wchar *this)
3707 TRACE("(%p)\n", this);
3708 return this->sep;
3711 /* ?thousands_sep@?$numpunct@_W@std@@QBE_WXZ */
3712 /* ?thousands_sep@?$numpunct@_W@std@@QEBA_WXZ */
3713 /* ?thousands_sep@?$numpunct@G@std@@QBEGXZ */
3714 /* ?thousands_sep@?$numpunct@G@std@@QEBAGXZ */
3715 DEFINE_THISCALL_WRAPPER(numpunct_wchar_thousands_sep, 4)
3716 wchar_t __thiscall numpunct_wchar_thousands_sep(const numpunct_wchar *this)
3718 TRACE("(%p)\n", this);
3719 return call_numpunct_wchar_do_thousands_sep(this);
3722 /* ?do_grouping@?$numpunct@_W@std@@MBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3723 /* ?do_grouping@?$numpunct@_W@std@@MEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3724 /* ?do_grouping@?$numpunct@G@std@@MBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3725 /* ?do_grouping@?$numpunct@G@std@@MEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3726 DEFINE_THISCALL_WRAPPER(numpunct_wchar_do_grouping, 8)
3727 #define call_numpunct_wchar_do_grouping(this, ret) CALL_VTBL_FUNC(this, 12, \
3728 basic_string_char*, (const numpunct_wchar*, basic_string_char*), (this, ret))
3729 basic_string_char* __thiscall numpunct_wchar_do_grouping(const numpunct_wchar *this, basic_string_char *ret)
3731 TRACE("(%p)\n", this);
3732 return basic_string_char_ctor_cstr(ret, this->grouping);
3735 /* ?grouping@?$numpunct@_W@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3736 /* ?grouping@?$numpunct@_W@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3737 /* ?grouping@?$numpunct@G@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3738 /* ?grouping@?$numpunct@G@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3739 DEFINE_THISCALL_WRAPPER(numpunct_wchar_grouping, 8)
3740 basic_string_char* __thiscall numpunct_wchar_grouping(const numpunct_wchar *this, basic_string_char *ret)
3742 TRACE("(%p)\n", this);
3743 return call_numpunct_wchar_do_grouping(this, ret);
3746 /* ?do_falsename@?$numpunct@_W@std@@MBE?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
3747 /* ?do_falsename@?$numpunct@_W@std@@MEBA?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
3748 /* ?do_falsename@?$numpunct@G@std@@MBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
3749 /* ?do_falsename@?$numpunct@G@std@@MEBA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
3750 DEFINE_THISCALL_WRAPPER(numpunct_wchar_do_falsename, 8)
3751 #define call_numpunct_wchar_do_falsename(this, ret) CALL_VTBL_FUNC(this, 16, \
3752 basic_string_wchar*, (const numpunct_wchar*, basic_string_wchar*), (this, ret))
3753 basic_string_wchar* __thiscall numpunct_wchar_do_falsename(const numpunct_wchar *this, basic_string_wchar *ret)
3755 TRACE("(%p)\n", this);
3756 return basic_string_wchar_ctor_cstr(ret, this->false_name);
3759 /* ?falsename@?$numpunct@_W@std@@QBE?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
3760 /* ?falsename@?$numpunct@_W@std@@QEBA?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
3761 /* ?falsename@?$numpunct@G@std@@QBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
3762 /* ?falsename@?$numpunct@G@std@@QEBA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
3763 DEFINE_THISCALL_WRAPPER(numpunct_wchar_falsename, 8)
3764 basic_string_wchar* __thiscall numpunct_wchar_falsename(const numpunct_wchar *this, basic_string_wchar *ret)
3766 TRACE("(%p)\n", this);
3767 return call_numpunct_wchar_do_falsename(this, ret);
3770 /* ?do_truename@?$numpunct@_W@std@@MBE?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
3771 /* ?do_truename@?$numpunct@_W@std@@MEBA?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
3772 /* ?do_truename@?$numpunct@G@std@@MBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
3773 /* ?do_truename@?$numpunct@G@std@@MEBA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
3774 DEFINE_THISCALL_WRAPPER(numpunct_wchar_do_truename, 8)
3775 #define call_numpunct_wchar_do_truename(this, ret) CALL_VTBL_FUNC(this, 20, \
3776 basic_string_wchar*, (const numpunct_wchar*, basic_string_wchar*), (this, ret))
3777 basic_string_wchar* __thiscall numpunct_wchar_do_truename(const numpunct_wchar *this, basic_string_wchar *ret)
3779 TRACE("(%p)\n", this);
3780 return basic_string_wchar_ctor_cstr(ret, this->true_name);
3783 /* ?truename@?$numpunct@_W@std@@QBE?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
3784 /* ?truename@?$numpunct@_W@std@@QEBA?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
3785 /* ?truename@?$numpunct@G@std@@QBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
3786 /* ?truename@?$numpunct@G@std@@QEBA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
3787 DEFINE_THISCALL_WRAPPER(numpunct_wchar_truename, 8)
3788 basic_string_wchar* __thiscall numpunct_wchar_truename(const numpunct_wchar *this, basic_string_wchar *ret)
3790 TRACE("(%p)\n", this);
3791 return call_numpunct_wchar_do_truename(this, ret);
3794 double __cdecl _Stod(const char *buf, char **buf_end, LONG exp)
3796 double ret = strtod(buf, buf_end);
3798 if(exp)
3799 ret *= pow(10, exp);
3800 return ret;
3803 static double _Stodx(const char *buf, char **buf_end, LONG exp, int *err)
3805 double ret;
3807 *err = *_errno();
3808 *_errno() = 0;
3809 ret = _Stod(buf, buf_end, exp);
3810 if(*_errno()) {
3811 *err = *_errno();
3812 }else {
3813 *_errno() = *err;
3814 *err = 0;
3816 return ret;
3819 float __cdecl _Stof(const char *buf, char **buf_end, LONG exp)
3821 return _Stod(buf, buf_end, exp);
3824 static float _Stofx(const char *buf, char **buf_end, LONG exp, int *err)
3826 return _Stodx(buf, buf_end, exp, err);
3829 static __int64 _Stollx(const char *buf, char **buf_end, int base, int *err)
3831 __int64 ret;
3833 *err = *_errno();
3834 *_errno() = 0;
3835 ret = _strtoi64(buf, buf_end, base);
3836 if(*_errno()) {
3837 *err = *_errno();
3838 }else {
3839 *_errno() = *err;
3840 *err = 0;
3842 return ret;
3845 static LONG _Stolx(const char *buf, char **buf_end, int base, int *err)
3847 __int64 i = _Stollx(buf, buf_end, base, err);
3848 if(!*err && i!=(__int64)((LONG)i))
3849 *err = ERANGE;
3850 return i;
3853 static unsigned __int64 _Stoullx(const char *buf, char **buf_end, int base, int *err)
3855 unsigned __int64 ret;
3857 *err = *_errno();
3858 *_errno() = 0;
3859 ret = _strtoui64(buf, buf_end, base);
3860 if(*_errno()) {
3861 *err = *_errno();
3862 }else {
3863 *_errno() = *err;
3864 *err = 0;
3866 return ret;
3869 static ULONG _Stoulx(const char *buf, char **buf_end, int base, int *err)
3871 unsigned __int64 i = _Stoullx(buf[0]=='-' ? buf+1 : buf, buf_end, base, err);
3872 if(!*err && i!=(unsigned __int64)((ULONG)i))
3873 *err = ERANGE;
3874 return buf[0]=='-' ? -i : i;
3877 /* ?id@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@2V0locale@2@A */
3878 static locale_id num_get_wchar_id = {0};
3879 /* ?id@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@2V0locale@2@A */
3880 locale_id num_get_short_id = {0};
3882 /* ??_7?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@6B@ */
3883 extern const vtable_ptr MSVCP_num_get_wchar_vtable;
3884 /* ??_7?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@6B@ */
3885 extern const vtable_ptr MSVCP_num_get_short_vtable;
3887 /* ?_Init@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@IAEXABV_Locinfo@2@@Z */
3888 /* ?_Init@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@IEAAXAEBV_Locinfo@2@@Z */
3889 /* ?_Init@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@IAEXABV_Locinfo@2@@Z */
3890 /* ?_Init@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@IEAAXAEBV_Locinfo@2@@Z */
3891 DEFINE_THISCALL_WRAPPER(num_get_wchar__Init, 8)
3892 void __thiscall num_get_wchar__Init(num_get *this, const _Locinfo *locinfo)
3894 TRACE("(%p %p)\n", this, locinfo);
3895 _Locinfo__Getcvt(locinfo, &this->cvt);
3898 /* ??0?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
3899 /* ??0?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
3900 static num_get* num_get_wchar_ctor_locinfo(num_get *this,
3901 const _Locinfo *locinfo, MSVCP_size_t refs)
3903 TRACE("(%p %p %lu)\n", this, locinfo, refs);
3905 locale_facet_ctor_refs(&this->facet, refs);
3906 this->facet.vtable = &MSVCP_num_get_wchar_vtable;
3908 num_get_wchar__Init(this, locinfo);
3909 return this;
3912 /* ??0?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
3913 /* ??0?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
3914 DEFINE_THISCALL_WRAPPER(num_get_short_ctor_locinfo, 12)
3915 num_get* __thiscall num_get_short_ctor_locinfo(num_get *this,
3916 const _Locinfo *locinfo, MSVCP_size_t refs)
3918 num_get_wchar_ctor_locinfo(this, locinfo, refs);
3919 this->facet.vtable = &MSVCP_num_get_short_vtable;
3920 return this;
3923 /* ??0?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAE@I@Z */
3924 /* ??0?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAA@_K@Z */
3925 static num_get* num_get_wchar_ctor_refs(num_get *this, MSVCP_size_t refs)
3927 _Locinfo locinfo;
3929 TRACE("(%p %lu)\n", this, refs);
3931 _Locinfo_ctor(&locinfo);
3932 num_get_wchar_ctor_locinfo(this, &locinfo, refs);
3933 _Locinfo_dtor(&locinfo);
3934 return this;
3937 /* ??0?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAE@I@Z */
3938 /* ??0?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEAA@_K@Z */
3939 DEFINE_THISCALL_WRAPPER(num_get_short_ctor_refs, 8)
3940 num_get* __thiscall num_get_short_ctor_refs(num_get *this, MSVCP_size_t refs)
3942 num_get_wchar_ctor_refs(this, refs);
3943 this->facet.vtable = &MSVCP_num_get_short_vtable;
3944 return this;
3947 /* ??_F?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAEXXZ */
3948 /* ??_F?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAAXXZ */
3949 DEFINE_THISCALL_WRAPPER(num_get_short_ctor, 4)
3950 num_get* __thiscall num_get_short_ctor(num_get *this)
3952 return num_get_short_ctor_refs(this, 0);
3955 /* ??1?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@UAE@XZ */
3956 /* ??1?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@UEAA@XZ */
3957 DEFINE_THISCALL_WRAPPER(num_get_wchar_dtor, 4)
3958 void __thiscall num_get_wchar_dtor(num_get *this)
3960 TRACE("(%p)\n", this);
3961 locale_facet_dtor(&this->facet);
3964 DEFINE_THISCALL_WRAPPER(num_get_wchar_vector_dtor, 8)
3965 num_get* __thiscall num_get_wchar_vector_dtor(num_get *this, unsigned int flags)
3967 TRACE("(%p %x)\n", this, flags);
3968 if(flags & 2) {
3969 /* we have an array, with the number of elements stored before the first object */
3970 INT_PTR i, *ptr = (INT_PTR *)this-1;
3972 for(i=*ptr-1; i>=0; i--)
3973 num_get_wchar_dtor(this+i);
3974 MSVCRT_operator_delete(ptr);
3975 } else {
3976 num_get_wchar_dtor(this);
3977 if(flags & 1)
3978 MSVCRT_operator_delete(this);
3981 return this;
3984 /* ?_Getcat@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
3985 /* ?_Getcat@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
3986 static MSVCP_size_t num_get_wchar__Getcat(const locale_facet **facet, const locale *loc)
3988 TRACE("(%p %p)\n", facet, loc);
3990 if(facet && !*facet) {
3991 _Locinfo locinfo;
3993 *facet = MSVCRT_operator_new(sizeof(num_get));
3994 if(!*facet) {
3995 ERR("Out of memory\n");
3996 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
3997 return 0;
4000 _Locinfo_ctor_cstr(&locinfo, basic_string_char_c_str(&loc->ptr->name));
4001 num_get_wchar_ctor_locinfo((num_get*)*facet, &locinfo, 0);
4002 _Locinfo_dtor(&locinfo);
4005 return LC_NUMERIC;
4008 static num_get* num_get_wchar_use_facet(const locale *loc)
4010 static num_get *obj = NULL;
4012 _Lockit lock;
4013 const locale_facet *fac;
4015 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
4016 fac = locale__Getfacet(loc, locale_id_operator_size_t(&num_get_wchar_id), TRUE);
4017 if(fac) {
4018 _Lockit_dtor(&lock);
4019 return (num_get*)fac;
4022 if(obj) {
4023 _Lockit_dtor(&lock);
4024 return obj;
4027 num_get_wchar__Getcat(&fac, loc);
4028 obj = (num_get*)fac;
4029 locale_facet__Incref(&obj->facet);
4030 locale_facet_register(&obj->facet);
4031 _Lockit_dtor(&lock);
4033 return obj;
4036 /* ?_Getcat@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
4037 /* ?_Getcat@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
4038 static MSVCP_size_t num_get_short__Getcat(const locale_facet **facet, const locale *loc)
4040 if(facet && !*facet) {
4041 num_get_wchar__Getcat(facet, loc);
4042 (*(locale_facet**)facet)->vtable = &MSVCP_num_get_short_vtable;
4045 return LC_NUMERIC;
4048 num_get* num_get_short_use_facet(const locale *loc)
4050 static num_get *obj = NULL;
4052 _Lockit lock;
4053 const locale_facet *fac;
4055 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
4056 fac = locale__Getfacet(loc, locale_id_operator_size_t(&num_get_short_id), TRUE);
4057 if(fac) {
4058 _Lockit_dtor(&lock);
4059 return (num_get*)fac;
4062 if(obj) {
4063 _Lockit_dtor(&lock);
4064 return obj;
4067 num_get_short__Getcat(&fac, loc);
4068 obj = (num_get*)fac;
4069 locale_facet__Incref(&obj->facet);
4070 locale_facet_register(&obj->facet);
4071 _Lockit_dtor(&lock);
4073 return obj;
4076 static inline wchar_t mb_to_wc(char ch, const _Cvtvec *cvt)
4078 int state = 0;
4079 wchar_t ret;
4081 return _Mbrtowc(&ret, &ch, 1, &state, cvt) == 1 ? ret : 0;
4084 static int num_get__Getffld(const num_get *this, char *dest, istreambuf_iterator_wchar *first,
4085 istreambuf_iterator_wchar *last, const locale *loc, numpunct_wchar *numpunct)
4087 int i, exp = 0;
4088 char *dest_beg = dest, *num_end = dest+25, *exp_end = dest+31;
4089 wchar_t digits[11], *digits_pos;
4090 BOOL error = FALSE, got_digit = FALSE, got_nonzero = FALSE;
4092 TRACE("(%p %p %p %p)\n", dest, first, last, loc);
4094 for(i=0; i<10; i++)
4095 digits[i] = mb_to_wc('0'+i, &this->cvt);
4096 digits[10] = 0;
4098 istreambuf_iterator_wchar_val(first);
4099 /* get sign */
4100 if(first->strbuf && first->val==mb_to_wc('-', &this->cvt)) {
4101 *dest++ = '-';
4102 istreambuf_iterator_wchar_inc(first);
4103 }else if(first->strbuf && first->val==mb_to_wc('+', &this->cvt)) {
4104 *dest++ = '+';
4105 istreambuf_iterator_wchar_inc(first);
4108 /* read numbers before decimal */
4109 for(; first->strbuf; istreambuf_iterator_wchar_inc(first)) {
4110 if(!(digits_pos = wcschr(digits, first->val))) {
4111 break;
4112 }else {
4113 got_digit = TRUE; /* found a digit, zero or non-zero */
4114 /* write digit to dest if not a leading zero (to not waste dest buffer) */
4115 if(!got_nonzero && first->val == digits[0])
4116 continue;
4117 got_nonzero = TRUE;
4118 if(dest < num_end)
4119 *dest++ = '0'+digits_pos-digits;
4120 else
4121 exp++; /* too many digits, just multiply by 10 */
4124 /* if all leading zeroes, we didn't write anything so put a zero we check for a decimal */
4125 if(got_digit && !got_nonzero)
4126 *dest++ = '0';
4128 /* get decimal, if any */
4129 if(first->strbuf && first->val==numpunct_wchar_decimal_point(numpunct)) {
4130 if(dest < num_end)
4131 *dest++ = *localeconv()->decimal_point;
4132 istreambuf_iterator_wchar_inc(first);
4135 /* read non-grouped after decimal */
4136 for(; first->strbuf; istreambuf_iterator_wchar_inc(first)) {
4137 if(!(digits_pos = wcschr(digits, first->val)))
4138 break;
4139 else if(dest<num_end) {
4140 got_digit = TRUE;
4141 *dest++ = '0'+digits_pos-digits;
4145 /* read exponent, if any */
4146 if(first->strbuf && (first->val==mb_to_wc('e', &this->cvt) || first->val==mb_to_wc('E', &this->cvt))) {
4147 *dest++ = 'e';
4148 istreambuf_iterator_wchar_inc(first);
4150 if(first->strbuf && first->val==mb_to_wc('-', &this->cvt)) {
4151 *dest++ = '-';
4152 istreambuf_iterator_wchar_inc(first);
4153 }else if(first->strbuf && first->val==mb_to_wc('+', &this->cvt)) {
4154 *dest++ = '+';
4155 istreambuf_iterator_wchar_inc(first);
4158 got_digit = got_nonzero = FALSE;
4159 error = TRUE;
4160 /* skip any leading zeroes */
4161 for(; first->strbuf && first->val==digits[0]; istreambuf_iterator_wchar_inc(first))
4162 error = FALSE;
4164 for(; first->strbuf && (digits_pos = wcschr(digits, first->val)); istreambuf_iterator_wchar_inc(first)) {
4165 got_digit = got_nonzero = TRUE; /* leading zeroes would have been skipped, so first digit is non-zero */
4166 error = FALSE;
4167 if(dest<exp_end)
4168 *dest++ = '0'+digits_pos-digits;
4171 /* if just found zeroes for exponent, use that */
4172 if(got_digit && !got_nonzero)
4174 error = FALSE;
4175 if(dest<exp_end)
4176 *dest++ = '0';
4180 if(error) {
4181 *dest_beg = '\0';
4182 return 0;
4184 *dest++ = '\0';
4185 return exp;
4188 static int num_get__Getifld(const num_get *this, char *dest, istreambuf_iterator_wchar *first,
4189 istreambuf_iterator_wchar *last, int fmtflags, const locale *loc, numpunct_wchar *numpunct)
4191 wchar_t digits[23], *digits_pos;
4192 int i, basefield, base;
4193 char *dest_beg = dest, *dest_end = dest+24;
4194 BOOL error = TRUE, dest_empty = TRUE, found_zero = FALSE;
4196 TRACE("(%p %p %p %04x %p)\n", dest, first, last, fmtflags, loc);
4198 for(i=0; i<10; i++)
4199 digits[i] = mb_to_wc('0'+i, &this->cvt);
4200 for(i=0; i<6; i++) {
4201 digits[10+i] = mb_to_wc('a'+i, &this->cvt);
4202 digits[16+i] = mb_to_wc('A'+i, &this->cvt);
4205 basefield = fmtflags & FMTFLAG_basefield;
4206 if(basefield == FMTFLAG_oct)
4207 base = 8;
4208 else if(basefield == FMTFLAG_hex)
4209 base = 22; /* equal to the size of digits buffer */
4210 else if(!basefield)
4211 base = 0;
4212 else
4213 base = 10;
4215 istreambuf_iterator_wchar_val(first);
4216 if(first->strbuf && first->val==mb_to_wc('-', &this->cvt)) {
4217 *dest++ = '-';
4218 istreambuf_iterator_wchar_inc(first);
4219 }else if(first->strbuf && first->val==mb_to_wc('+', &this->cvt)) {
4220 *dest++ = '+';
4221 istreambuf_iterator_wchar_inc(first);
4224 if(first->strbuf && first->val==digits[0]) {
4225 found_zero = TRUE;
4226 istreambuf_iterator_wchar_inc(first);
4227 if(first->strbuf && (first->val==mb_to_wc('x', &this->cvt) || first->val==mb_to_wc('X', &this->cvt))) {
4228 if(!base || base == 22) {
4229 found_zero = FALSE;
4230 istreambuf_iterator_wchar_inc(first);
4231 base = 22;
4232 }else {
4233 base = 10;
4235 }else {
4236 error = FALSE;
4237 if(!base) base = 8;
4239 }else {
4240 if(!base) base = 10;
4242 digits[base] = 0;
4244 for(; first->strbuf; istreambuf_iterator_wchar_inc(first)) {
4245 if(!(digits_pos = wcschr(digits, first->val))) {
4246 break;
4247 }else {
4248 error = FALSE;
4249 if(dest_empty && first->val == digits[0]) {
4250 found_zero = TRUE;
4251 continue;
4253 dest_empty = FALSE;
4254 /* skip digits that can't be copied to dest buffer, other
4255 * functions are responsible for detecting overflows */
4256 if(dest < dest_end)
4257 *dest++ = (digits_pos-digits<10 ? '0'+digits_pos-digits :
4258 (digits_pos-digits<16 ? 'a'+digits_pos-digits-10 :
4259 'A'+digits_pos-digits-16));
4263 if(error) {
4264 if (found_zero)
4265 *dest++ = '0';
4266 else
4267 dest = dest_beg;
4268 }else if(dest_empty)
4269 *dest++ = '0';
4270 *dest = '\0';
4272 return (base==22 ? 16 : base);
4275 /* ?_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 */
4276 /* ?_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 */
4277 static int num_get_wchar__Getifld(const num_get *this, char *dest, istreambuf_iterator_wchar *first,
4278 istreambuf_iterator_wchar *last, int fmtflags, const locale *loc)
4280 return num_get__Getifld(this, dest, first, last,
4281 fmtflags, loc, numpunct_wchar_use_facet(loc));
4284 static istreambuf_iterator_wchar* num_get_do_get_void(const num_get *this,
4285 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar first,
4286 istreambuf_iterator_wchar last, ios_base *base, int *state,
4287 void **pval, numpunct_wchar *numpunct)
4289 unsigned __int64 v;
4290 char tmp[25], *end;
4291 int err;
4293 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
4295 v = _Stoullx(tmp, &end, num_get__Getifld(this, tmp, &first,
4296 &last, FMTFLAG_hex, &base->loc, numpunct), &err);
4297 if(v!=(unsigned __int64)((INT_PTR)v))
4298 *state |= IOSTATE_failbit;
4299 else if(end!=tmp && !err)
4300 *pval = (void*)((INT_PTR)v);
4301 else
4302 *state |= IOSTATE_failbit;
4304 if(!first.strbuf)
4305 *state |= IOSTATE_eofbit;
4307 *ret = first;
4308 return ret;
4311 /* ?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 */
4312 /* ?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 */
4313 #define call_num_get_wchar_do_get_void(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 4, istreambuf_iterator_wchar*, \
4314 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, void**), \
4315 (this, ret, first, last, base, state, pval))
4316 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_void,36)
4317 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_void(const num_get *this, istreambuf_iterator_wchar *ret,
4318 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, void **pval)
4320 return num_get_do_get_void(this, ret, first, last, base,
4321 state, pval, numpunct_wchar_use_facet(&base->loc));
4324 /* ?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 */
4325 /* ?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 */
4326 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_void,36)
4327 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_void(const num_get *this, istreambuf_iterator_wchar *ret,
4328 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, void **pval)
4330 return num_get_do_get_void(this, ret, first, last, base,
4331 state, pval, numpunct_short_use_facet(&base->loc));
4334 /* ?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 */
4335 /* ?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 */
4336 /* ?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 */
4337 /* ?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 */
4338 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_void,36)
4339 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_void(const num_get *this, istreambuf_iterator_wchar *ret,
4340 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, void **pval)
4342 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
4343 return call_num_get_wchar_do_get_void(this, ret, first, last, base, state, pval);
4346 static istreambuf_iterator_wchar* num_get_do_get_double(const num_get *this,
4347 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar first,
4348 istreambuf_iterator_wchar last, ios_base *base, int *state,
4349 double *pval, numpunct_wchar *numpunct)
4351 double v;
4352 char tmp[32], *end;
4353 int err;
4355 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
4357 v = _Stodx(tmp, &end, num_get__Getffld(this, tmp, &first, &last, &base->loc, numpunct), &err);
4358 if(end!=tmp && !err)
4359 *pval = v;
4360 else
4361 *state |= IOSTATE_failbit;
4363 if(!first.strbuf)
4364 *state |= IOSTATE_eofbit;
4366 *ret = first;
4367 return ret;
4370 /* ?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 */
4371 /* ?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 */
4372 /* ?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 */
4373 /* ?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 */
4374 #define call_num_get_wchar_do_get_ldouble(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 8, istreambuf_iterator_wchar*, \
4375 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, double*), \
4376 (this, ret, first, last, base, state, pval))
4377 #define call_num_get_wchar_do_get_double(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 12, istreambuf_iterator_wchar*, \
4378 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, double*), \
4379 (this, ret, first, last, base, state, pval))
4380 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_double,36)
4381 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_double(const num_get *this, istreambuf_iterator_wchar *ret,
4382 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, double *pval)
4384 return num_get_do_get_double(this, ret, first, last, base,
4385 state, pval, numpunct_wchar_use_facet(&base->loc));
4388 /* ?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 */
4389 /* ?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 */
4390 /* ?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 */
4391 /* ?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 */
4392 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_double,36)
4393 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_double(const num_get *this, istreambuf_iterator_wchar *ret,
4394 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, double *pval)
4396 return num_get_do_get_double(this, ret, first, last, base,
4397 state, pval, numpunct_short_use_facet(&base->loc));
4400 /* ?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 */
4401 /* ?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 */
4402 /* ?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 */
4403 /* ?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 */
4404 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_ldouble,36)
4405 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_ldouble(const num_get *this, istreambuf_iterator_wchar *ret,
4406 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, double *pval)
4408 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
4409 return call_num_get_wchar_do_get_ldouble(this, ret, first, last, base, state, pval);
4412 /* ?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 */
4413 /* ?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 */
4414 /* ?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 */
4415 /* ?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 */
4416 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_double,36)
4417 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_double(const num_get *this, istreambuf_iterator_wchar *ret,
4418 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, double *pval)
4420 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
4421 return call_num_get_wchar_do_get_double(this, ret, first, last, base, state, pval);
4424 static istreambuf_iterator_wchar* num_get_do_get_float(const num_get *this,
4425 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar first,
4426 istreambuf_iterator_wchar last, ios_base *base, int *state,
4427 float *pval, numpunct_wchar *numpunct)
4429 float v;
4430 char tmp[32], *end;
4431 int err;
4433 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
4435 v = _Stofx(tmp, &end, num_get__Getffld(this, tmp, &first,
4436 &last, &base->loc, numpunct), &err);
4437 if(end!=tmp && !err)
4438 *pval = v;
4439 else
4440 *state |= IOSTATE_failbit;
4442 if(!first.strbuf)
4443 *state |= IOSTATE_eofbit;
4445 *ret = first;
4446 return ret;
4449 /* ?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 */
4450 /* ?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 */
4451 #define call_num_get_wchar_do_get_float(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 16, istreambuf_iterator_wchar*, \
4452 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, float*), \
4453 (this, ret, first, last, base, state, pval))
4454 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_float,36)
4455 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_float(const num_get *this, istreambuf_iterator_wchar *ret,
4456 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, float *pval)
4458 return num_get_do_get_float(this, ret, first, last, base,
4459 state, pval, numpunct_wchar_use_facet(&base->loc));
4462 /* ?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 */
4463 /* ?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 */
4464 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_float,36)
4465 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_float(const num_get *this, istreambuf_iterator_wchar *ret,
4466 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, float *pval)
4468 return num_get_do_get_float(this, ret, first, last, base,
4469 state, pval, numpunct_short_use_facet(&base->loc));
4472 /* ?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 */
4473 /* ?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 */
4474 /* ?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 */
4475 /* ?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 */
4476 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_float,36)
4477 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_float(const num_get *this, istreambuf_iterator_wchar *ret,
4478 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, float *pval)
4480 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
4481 return call_num_get_wchar_do_get_float(this, ret, first, last, base, state, pval);
4484 static istreambuf_iterator_wchar* num_get_do_get_uint64(const num_get *this,
4485 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar first,
4486 istreambuf_iterator_wchar last, ios_base *base, int *state,
4487 ULONGLONG *pval, numpunct_wchar *numpunct)
4489 unsigned __int64 v;
4490 char tmp[25], *end;
4491 int err;
4493 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
4495 v = _Stoullx(tmp, &end, num_get__Getifld(this, tmp, &first,
4496 &last, base->fmtfl, &base->loc, numpunct), &err);
4497 if(end!=tmp && !err)
4498 *pval = v;
4499 else
4500 *state |= IOSTATE_failbit;
4502 if(!first.strbuf)
4503 *state |= IOSTATE_eofbit;
4505 *ret = first;
4506 return ret;
4509 /* ?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 */
4510 /* ?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 */
4511 #define call_num_get_wchar_do_get_uint64(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 20, istreambuf_iterator_wchar*, \
4512 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, ULONGLONG*), \
4513 (this, ret, first, last, base, state, pval))
4514 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_uint64,36)
4515 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_uint64(const num_get *this, istreambuf_iterator_wchar *ret,
4516 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, ULONGLONG *pval)
4518 return num_get_do_get_uint64(this, ret, first, last, base,
4519 state, pval, numpunct_wchar_use_facet(&base->loc));
4522 /* ?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 */
4523 /* ?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 */
4524 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_uint64,36)
4525 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_uint64(const num_get *this, istreambuf_iterator_wchar *ret,
4526 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, ULONGLONG *pval)
4528 return num_get_do_get_uint64(this, ret, first, last, base,
4529 state, pval, numpunct_short_use_facet(&base->loc));
4532 /* ?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 */
4533 /* ?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 */
4534 /* ?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 */
4535 /* ?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 */
4536 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_uint64,36)
4537 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_uint64(const num_get *this, istreambuf_iterator_wchar *ret,
4538 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, ULONGLONG *pval)
4540 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
4541 return call_num_get_wchar_do_get_uint64(this, ret, first, last, base, state, pval);
4544 static istreambuf_iterator_wchar* num_get_do_get_int64(const num_get *this,
4545 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar first,
4546 istreambuf_iterator_wchar last, ios_base *base, int *state,
4547 LONGLONG *pval, numpunct_wchar *numpunct)
4549 __int64 v;
4550 char tmp[25], *end;
4551 int err;
4553 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
4555 v = _Stollx(tmp, &end, num_get__Getifld(this, tmp, &first,
4556 &last, base->fmtfl, &base->loc, numpunct), &err);
4557 if(end!=tmp && !err)
4558 *pval = v;
4559 else
4560 *state |= IOSTATE_failbit;
4562 if(!first.strbuf)
4563 *state |= IOSTATE_eofbit;
4565 *ret = first;
4566 return ret;
4569 /* ?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 */
4570 /* ?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 */
4571 #define call_num_get_wchar_do_get_int64(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 24, istreambuf_iterator_wchar*, \
4572 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, LONGLONG*), \
4573 (this, ret, first, last, base, state, pval))
4574 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_int64,36)
4575 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_int64(const num_get *this, istreambuf_iterator_wchar *ret,
4576 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, LONGLONG *pval)
4578 return num_get_do_get_int64(this, ret, first, last, base,
4579 state, pval, numpunct_wchar_use_facet(&base->loc));
4582 /* ?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 */
4583 /* ?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 */
4584 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_int64,36)
4585 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_int64(const num_get *this, istreambuf_iterator_wchar *ret,
4586 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, LONGLONG *pval)
4588 return num_get_do_get_int64(this, ret, first, last, base,
4589 state, pval, numpunct_short_use_facet(&base->loc));
4592 /* ?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 */
4593 /* ?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 */
4594 /* ?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 */
4595 /* ?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 */
4596 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_int64,36)
4597 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_int64(const num_get *this, istreambuf_iterator_wchar *ret,
4598 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, LONGLONG *pval)
4600 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
4601 return call_num_get_wchar_do_get_int64(this, ret, first, last, base, state, pval);
4604 static istreambuf_iterator_wchar* num_get_do_get_ulong(const num_get *this,
4605 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar first,
4606 istreambuf_iterator_wchar last, ios_base *base, int *state,
4607 ULONG *pval, numpunct_wchar *numpunct)
4609 ULONG v;
4610 char tmp[25], *end;
4611 int err;
4613 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
4615 v = _Stoulx(tmp, &end, num_get__Getifld(this, tmp, &first,
4616 &last, base->fmtfl, &base->loc, numpunct), &err);
4617 if(end!=tmp && !err)
4618 *pval = v;
4619 else
4620 *state |= IOSTATE_failbit;
4622 if(!first.strbuf)
4623 *state |= IOSTATE_eofbit;
4625 *ret = first;
4626 return ret;
4629 /* ?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 */
4630 /* ?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 */
4631 #define call_num_get_wchar_do_get_ulong(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 28, istreambuf_iterator_wchar*, \
4632 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, ULONG*), \
4633 (this, ret, first, last, base, state, pval))
4634 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_ulong,36)
4635 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_ulong(const num_get *this, istreambuf_iterator_wchar *ret,
4636 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, ULONG *pval)
4638 return num_get_do_get_ulong(this, ret, first, last, base,
4639 state, pval, numpunct_wchar_use_facet(&base->loc));
4642 /* ?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 */
4643 /* ?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 */
4644 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_ulong,36)
4645 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_ulong(const num_get *this, istreambuf_iterator_wchar *ret,
4646 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, ULONG *pval)
4648 return num_get_do_get_ulong(this, ret, first, last, base,
4649 state, pval, numpunct_short_use_facet(&base->loc));
4652 /* ?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 */
4653 /* ?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 */
4654 /* ?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 */
4655 /* ?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 */
4656 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_ulong,36)
4657 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_ulong(const num_get *this, istreambuf_iterator_wchar *ret,
4658 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, ULONG *pval)
4660 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
4661 return call_num_get_wchar_do_get_ulong(this, ret, first, last, base, state, pval);
4664 static istreambuf_iterator_wchar* num_get_do_get_long(const num_get *this,
4665 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar first,
4666 istreambuf_iterator_wchar last, ios_base *base, int *state,
4667 LONG *pval, numpunct_wchar *numpunct)
4669 LONG v;
4670 char tmp[25], *end;
4671 int err;
4673 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
4675 v = _Stolx(tmp, &end, num_get__Getifld(this, tmp, &first,
4676 &last, base->fmtfl, &base->loc, numpunct), &err);
4677 if(end!=tmp && !err)
4678 *pval = v;
4679 else
4680 *state |= IOSTATE_failbit;
4682 if(!first.strbuf)
4683 *state |= IOSTATE_eofbit;
4685 *ret = first;
4686 return ret;
4689 /* ?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 */
4690 /* ?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 */
4691 #define call_num_get_wchar_do_get_long(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 32, istreambuf_iterator_wchar*, \
4692 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, LONG*), \
4693 (this, ret, first, last, base, state, pval))
4694 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_long,36)
4695 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_long(const num_get *this, istreambuf_iterator_wchar *ret,
4696 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, LONG *pval)
4698 return num_get_do_get_long(this, ret, first, last, base,
4699 state, pval, numpunct_wchar_use_facet(&base->loc));
4702 /* ?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 */
4703 /* ?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 */
4704 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_long,36)
4705 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_long(const num_get *this, istreambuf_iterator_wchar *ret,
4706 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, LONG *pval)
4708 return num_get_do_get_long(this, ret, first, last, base,
4709 state, pval, numpunct_short_use_facet(&base->loc));
4712 /* ?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 */
4713 /* ?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 */
4714 /* ?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 */
4715 /* ?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 */
4716 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_long,36)
4717 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_long(const num_get *this, istreambuf_iterator_wchar *ret,
4718 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, LONG *pval)
4720 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
4721 return call_num_get_wchar_do_get_long(this, ret, first, last, base, state, pval);
4724 /* ?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 */
4725 /* ?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 */
4726 #define call_num_get_wchar_do_get_uint(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 36, istreambuf_iterator_wchar*, \
4727 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, unsigned int*), \
4728 (this, ret, first, last, base, state, pval))
4729 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_uint,36)
4730 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_uint(const num_get *this, istreambuf_iterator_wchar *ret,
4731 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, unsigned int *pval)
4733 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
4734 return num_get_wchar_do_get_ulong(this, ret, first, last, base, state, pval);
4737 /* ?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 */
4738 /* ?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 */
4739 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_uint,36)
4740 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_uint(const num_get *this, istreambuf_iterator_wchar *ret,
4741 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, unsigned int *pval)
4743 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
4744 return num_get_short_do_get_ulong(this, ret, first, last, base, state, pval);
4747 /* ?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 */
4748 /* ?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 */
4749 /* ?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 */
4750 /* ?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 */
4751 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_uint,36)
4752 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_uint(const num_get *this, istreambuf_iterator_wchar *ret,
4753 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, unsigned int *pval)
4755 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
4756 return call_num_get_wchar_do_get_uint(this, ret, first, last, base, state, pval);
4759 /* ?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 */
4760 /* ?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 */
4761 #define call_num_get_wchar_do_get_ushort(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 40, istreambuf_iterator_wchar*, \
4762 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, unsigned short*), \
4763 (this, ret, first, last, base, state, pval))
4764 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_ushort,36)
4765 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_ushort(const num_get *this, istreambuf_iterator_wchar *ret,
4766 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, unsigned short *pval)
4768 ULONG v;
4769 char tmp[25], *beg, *end;
4770 int err, b;
4772 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
4774 b = num_get_wchar__Getifld(this, tmp,
4775 &first, &last, base->fmtfl, &base->loc);
4776 beg = tmp + (tmp[0]=='-' ? 1 : 0);
4777 v = _Stoulx(beg, &end, b, &err);
4779 if(v != (ULONG)((unsigned short)v))
4780 *state |= IOSTATE_failbit;
4781 else if(end!=beg && !err)
4782 *pval = (tmp[0]=='-' ? -((unsigned short)v) : v);
4783 else
4784 *state |= IOSTATE_failbit;
4786 if(!first.strbuf)
4787 *state |= IOSTATE_eofbit;
4789 *ret = first;
4790 return ret;
4793 /* ?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 */
4794 /* ?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 */
4795 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_ushort,36)
4796 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_ushort(const num_get *this, istreambuf_iterator_wchar *ret,
4797 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, unsigned short *pval)
4799 FIXME("(%p %p %p %p %p) stub\n", this, ret, base, state, pval);
4800 return ret;
4803 /* ?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 */
4804 /* ?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 */
4805 /* ?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@ */
4806 /* ?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 */
4807 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_ushort,36)
4808 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_ushort(const num_get *this, istreambuf_iterator_wchar *ret,
4809 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, unsigned short *pval)
4811 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
4812 return call_num_get_wchar_do_get_ushort(this, ret, first, last, base, state, pval);
4815 static istreambuf_iterator_wchar* num_get_do_get_bool(const num_get *this,
4816 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar first,
4817 istreambuf_iterator_wchar last, ios_base *base, int *state,
4818 MSVCP_bool *pval, numpunct_wchar *numpunct)
4820 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
4822 if(base->fmtfl & FMTFLAG_boolalpha) {
4823 basic_string_wchar false_bstr, true_bstr;
4824 const wchar_t *pfalse, *ptrue;
4826 numpunct_wchar_falsename(numpunct, &false_bstr);
4827 numpunct_wchar_truename(numpunct, &true_bstr);
4828 pfalse = basic_string_wchar_c_str(&false_bstr);
4829 ptrue = basic_string_wchar_c_str(&true_bstr);
4831 for(istreambuf_iterator_wchar_val(&first); first.strbuf;) {
4832 if(pfalse && *pfalse && first.val!=*pfalse)
4833 pfalse = NULL;
4834 if(ptrue && *ptrue && first.val!=*ptrue)
4835 ptrue = NULL;
4837 if(pfalse && *pfalse && ptrue && !*ptrue)
4838 ptrue = NULL;
4839 if(ptrue && *ptrue && pfalse && !*pfalse)
4840 pfalse = NULL;
4842 if(pfalse)
4843 pfalse++;
4844 if(ptrue)
4845 ptrue++;
4847 if(pfalse || ptrue)
4848 istreambuf_iterator_wchar_inc(&first);
4850 if((!pfalse || !*pfalse) && (!ptrue || !*ptrue))
4851 break;
4854 if(ptrue)
4855 *pval = TRUE;
4856 else if(pfalse)
4857 *pval = FALSE;
4858 else
4859 *state |= IOSTATE_failbit;
4861 basic_string_wchar_dtor(&false_bstr);
4862 basic_string_wchar_dtor(&true_bstr);
4863 }else {
4864 char tmp[25], *end;
4865 int err;
4866 LONG v = _Stolx(tmp, &end, num_get__Getifld(this, tmp, &first,
4867 &last, base->fmtfl, &base->loc, numpunct), &err);
4869 if(end!=tmp && err==0 && (v==0 || v==1))
4870 *pval = v;
4871 else
4872 *state |= IOSTATE_failbit;
4875 if(!first.strbuf)
4876 *state |= IOSTATE_eofbit;
4877 memcpy(ret, &first, sizeof(first));
4878 return ret;
4881 /* ?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 */
4882 /* ?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 */
4883 #define call_num_get_wchar_do_get_bool(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 44, istreambuf_iterator_wchar*, \
4884 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, MSVCP_bool*), \
4885 (this, ret, first, last, base, state, pval))
4886 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_bool,36)
4887 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_bool(const num_get *this, istreambuf_iterator_wchar *ret,
4888 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, MSVCP_bool *pval)
4890 return num_get_do_get_bool(this, ret, first, last, base,
4891 state, pval, numpunct_wchar_use_facet(&base->loc));
4894 /* ?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 */
4895 /* ?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 */
4896 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_bool,36)
4897 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_bool(const num_get *this, istreambuf_iterator_wchar *ret,
4898 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, MSVCP_bool *pval)
4900 return num_get_do_get_bool(this, ret, first, last, base,
4901 state, pval, numpunct_short_use_facet(&base->loc));
4904 /* ?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 */
4905 /* ?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 */
4906 /* ?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 */
4907 /* ?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 */
4908 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_bool,36)
4909 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_bool(const num_get *this, istreambuf_iterator_wchar *ret,
4910 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, MSVCP_bool *pval)
4912 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
4913 return call_num_get_wchar_do_get_bool(this, ret, first, last, base, state, pval);
4916 /* ?id@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@2V0locale@2@A */
4917 locale_id num_get_char_id = {0};
4919 /* ??_7?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@6B@ */
4920 extern const vtable_ptr MSVCP_num_get_char_vtable;
4922 /* ?_Init@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@IAEXABV_Locinfo@2@@Z */
4923 /* ?_Init@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@IEAAXAEBV_Locinfo@2@@Z */
4924 DEFINE_THISCALL_WRAPPER(num_get_char__Init, 8)
4925 void __thiscall num_get_char__Init(num_get *this, const _Locinfo *locinfo)
4927 TRACE("(%p %p)\n", this, locinfo);
4928 _Locinfo__Getcvt(locinfo, &this->cvt);
4931 /* ??0?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
4932 /* ??0?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
4933 DEFINE_THISCALL_WRAPPER(num_get_char_ctor_locinfo, 12)
4934 num_get* __thiscall num_get_char_ctor_locinfo(num_get *this,
4935 const _Locinfo *locinfo, MSVCP_size_t refs)
4937 TRACE("(%p %p %lu)\n", this, locinfo, refs);
4939 locale_facet_ctor_refs(&this->facet, refs);
4940 this->facet.vtable = &MSVCP_num_get_char_vtable;
4942 num_get_char__Init(this, locinfo);
4943 return this;
4946 /* ??0?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAE@I@Z */
4947 /* ??0?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAA@_K@Z */
4948 DEFINE_THISCALL_WRAPPER(num_get_char_ctor_refs, 8)
4949 num_get* __thiscall num_get_char_ctor_refs(num_get *this, MSVCP_size_t refs)
4951 _Locinfo locinfo;
4953 TRACE("(%p %lu)\n", this, refs);
4955 _Locinfo_ctor(&locinfo);
4956 num_get_char_ctor_locinfo(this, &locinfo, refs);
4957 _Locinfo_dtor(&locinfo);
4958 return this;
4961 /* ??_F?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAEXXZ */
4962 /* ??_F?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAAXXZ */
4963 DEFINE_THISCALL_WRAPPER(num_get_char_ctor, 4)
4964 num_get* __thiscall num_get_char_ctor(num_get *this)
4966 return num_get_char_ctor_refs(this, 0);
4969 /* ??1?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@UAE@XZ */
4970 /* ??1?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@UEAA@XZ */
4971 DEFINE_THISCALL_WRAPPER(num_get_char_dtor, 4)
4972 void __thiscall num_get_char_dtor(num_get *this)
4974 TRACE("(%p)\n", this);
4975 locale_facet_dtor(&this->facet);
4978 DEFINE_THISCALL_WRAPPER(num_get_char_vector_dtor, 8)
4979 num_get* __thiscall num_get_char_vector_dtor(num_get *this, unsigned int flags)
4981 TRACE("(%p %x)\n", this, flags);
4982 if(flags & 2) {
4983 /* we have an array, with the number of elements stored before the first object */
4984 INT_PTR i, *ptr = (INT_PTR *)this-1;
4986 for(i=*ptr-1; i>=0; i--)
4987 num_get_char_dtor(this+i);
4988 MSVCRT_operator_delete(ptr);
4989 } else {
4990 num_get_char_dtor(this);
4991 if(flags & 1)
4992 MSVCRT_operator_delete(this);
4995 return this;
4998 /* ?_Getcat@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
4999 /* ?_Getcat@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
5000 static MSVCP_size_t num_get_char__Getcat(const locale_facet **facet, const locale *loc)
5002 TRACE("(%p %p)\n", facet, loc);
5004 if(facet && !*facet) {
5005 _Locinfo locinfo;
5007 *facet = MSVCRT_operator_new(sizeof(num_get));
5008 if(!*facet) {
5009 ERR("Out of memory\n");
5010 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
5011 return 0;
5014 _Locinfo_ctor_cstr(&locinfo, basic_string_char_c_str(&loc->ptr->name));
5015 num_get_char_ctor_locinfo((num_get*)*facet, &locinfo, 0);
5016 _Locinfo_dtor(&locinfo);
5019 return LC_NUMERIC;
5022 num_get* num_get_char_use_facet(const locale *loc)
5024 static num_get *obj = NULL;
5026 _Lockit lock;
5027 const locale_facet *fac;
5029 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
5030 fac = locale__Getfacet(loc, locale_id_operator_size_t(&num_get_char_id), TRUE);
5031 if(fac) {
5032 _Lockit_dtor(&lock);
5033 return (num_get*)fac;
5036 if(obj) {
5037 _Lockit_dtor(&lock);
5038 return obj;
5041 num_get_char__Getcat(&fac, loc);
5042 obj = (num_get*)fac;
5043 locale_facet__Incref(&obj->facet);
5044 locale_facet_register(&obj->facet);
5045 _Lockit_dtor(&lock);
5047 return obj;
5050 /* ?_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 */
5051 /* ?_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 */
5052 /* Copies number to dest buffer, validates grouping and skips separators.
5053 * Updates first so it points past the number, all digits are skipped.
5054 * Returns how exponent needs to changed.
5055 * Size of dest buffer is not specified, assuming it's not smaller than 32:
5056 * strlen(+0.e+) + 22(digits) + 4(expontent) + 1(nullbyte)
5058 static int num_get_char__Getffld(const num_get *this, char *dest, istreambuf_iterator_char *first,
5059 istreambuf_iterator_char *last, const locale *loc)
5061 numpunct_char *numpunct = numpunct_char_use_facet(loc);
5062 int exp = 0;
5063 char *dest_beg = dest, *num_end = dest+25, *exp_end = dest+31;
5064 BOOL error = FALSE, got_digit = FALSE, got_nonzero = FALSE;
5066 TRACE("(%p %p %p %p)\n", dest, first, last, loc);
5068 istreambuf_iterator_char_val(first);
5069 /* get sign */
5070 if(first->strbuf && (first->val=='-' || first->val=='+')) {
5071 *dest++ = first->val;
5072 istreambuf_iterator_char_inc(first);
5076 /* read numbers before decimal */
5077 for(; first->strbuf; istreambuf_iterator_char_inc(first)) {
5078 if(first->val<'0' || first->val>'9') {
5079 break;
5080 }else {
5081 got_digit = TRUE; /* found a digit, zero or non-zero */
5082 /* write digit to dest if not a leading zero (to not waste dest buffer) */
5083 if(!got_nonzero && first->val == '0')
5084 continue;
5085 got_nonzero = TRUE;
5086 if(dest < num_end)
5087 *dest++ = first->val;
5088 else
5089 exp++; /* too many digits, just multiply by 10 */
5092 /* if all leading zeroes, we didn't write anything so put a zero we check for a decimal */
5093 if(got_digit && !got_nonzero)
5094 *dest++ = '0';
5096 /* get decimal, if any */
5097 if(first->strbuf && first->val==numpunct_char_decimal_point(numpunct)) {
5098 if(dest < num_end)
5099 *dest++ = *localeconv()->decimal_point;
5100 istreambuf_iterator_char_inc(first);
5103 /* read non-grouped after decimal */
5104 for(; first->strbuf; istreambuf_iterator_char_inc(first)) {
5105 if(first->val<'0' || first->val>'9')
5106 break;
5107 else if(dest<num_end) {
5108 got_digit = TRUE;
5109 *dest++ = first->val;
5113 /* read exponent, if any */
5114 if(first->strbuf && (first->val=='e' || first->val=='E')) {
5115 *dest++ = first->val;
5116 istreambuf_iterator_char_inc(first);
5118 if(first->strbuf && (first->val=='-' || first->val=='+')) {
5119 *dest++ = first->val;
5120 istreambuf_iterator_char_inc(first);
5123 got_digit = got_nonzero = FALSE;
5124 error = TRUE;
5125 /* skip any leading zeroes */
5126 for(; first->strbuf && first->val=='0'; istreambuf_iterator_char_inc(first))
5127 got_digit = TRUE;
5129 for(; first->strbuf && first->val>='0' && first->val<='9'; istreambuf_iterator_char_inc(first)) {
5130 got_digit = got_nonzero = TRUE; /* leading zeroes would have been skipped, so first digit is non-zero */
5131 error = FALSE;
5132 if(dest<exp_end)
5133 *dest++ = first->val;
5136 /* if just found zeroes for exponent, use that */
5137 if(got_digit && !got_nonzero)
5139 error = FALSE;
5140 if(dest<exp_end)
5141 *dest++ = '0';
5145 if(error) {
5146 *dest_beg = '\0';
5147 return 0;
5149 *dest++ = '\0';
5150 return exp;
5153 /* ?_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 */
5154 /* ?_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 */
5155 /* Copies number to dest buffer, validates grouping and skips separators.
5156 * Updates first so it points past the number, all digits are skipped.
5157 * Returns number base (8, 10 or 16).
5158 * Size of dest buffer is not specified, assuming it's not smaller than 25:
5159 * 22(8^22>2^64)+1(detect overflows)+1(sign)+1(nullbyte) = 25
5161 static int num_get_char__Getifld(const num_get *this, char *dest, istreambuf_iterator_char *first,
5162 istreambuf_iterator_char *last, int fmtflags, const locale *loc)
5164 static const char digits[] = "0123456789abcdefABCDEF";
5166 int basefield, base;
5167 char *dest_beg = dest, *dest_end = dest+24;
5168 BOOL error = TRUE, dest_empty = TRUE, found_zero = FALSE;
5170 TRACE("(%p %p %p %04x %p)\n", dest, first, last, fmtflags, loc);
5172 basefield = fmtflags & FMTFLAG_basefield;
5173 if(basefield == FMTFLAG_oct)
5174 base = 8;
5175 else if(basefield == FMTFLAG_hex)
5176 base = 22; /* equal to the size of digits buffer */
5177 else if(!basefield)
5178 base = 0;
5179 else
5180 base = 10;
5182 istreambuf_iterator_char_val(first);
5183 if(first->strbuf && (first->val=='-' || first->val=='+')) {
5184 *dest++ = first->val;
5185 istreambuf_iterator_char_inc(first);
5188 if(first->strbuf && first->val=='0') {
5189 found_zero = TRUE;
5190 istreambuf_iterator_char_inc(first);
5191 if(first->strbuf && (first->val=='x' || first->val=='X')) {
5192 if(!base || base == 22) {
5193 found_zero = FALSE;
5194 istreambuf_iterator_char_inc(first);
5195 base = 22;
5196 }else {
5197 base = 10;
5199 }else {
5200 error = FALSE;
5201 if(!base) base = 8;
5203 }else {
5204 if (!base) base = 10;
5207 for(; first->strbuf; istreambuf_iterator_char_inc(first)) {
5208 if(!memchr(digits, first->val, base)) {
5209 break;
5210 }else {
5211 error = FALSE;
5212 if(dest_empty && first->val == '0')
5214 found_zero = TRUE;
5215 continue;
5217 dest_empty = FALSE;
5218 /* skip digits that can't be copied to dest buffer, other
5219 * functions are responsible for detecting overflows */
5220 if(dest < dest_end)
5221 *dest++ = first->val;
5225 if(error) {
5226 if (found_zero)
5227 *dest++ = '0';
5228 else
5229 dest = dest_beg;
5230 }else if(dest_empty)
5231 *dest++ = '0';
5232 *dest = '\0';
5234 return (base==22 ? 16 : base);
5237 /* ?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 */
5238 /* ?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 */
5239 #define call_num_get_char_do_get_void(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 4, istreambuf_iterator_char*, \
5240 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, void**), \
5241 (this, ret, first, last, base, state, pval))
5242 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_void,36)
5243 istreambuf_iterator_char *__thiscall num_get_char_do_get_void(const num_get *this, istreambuf_iterator_char *ret,
5244 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, void **pval)
5246 unsigned __int64 v;
5247 char tmp[25], *end;
5248 int err;
5250 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5252 v = _Stoullx(tmp, &end, num_get_char__Getifld(this, tmp,
5253 &first, &last, FMTFLAG_hex, &base->loc), &err);
5254 if(v!=(unsigned __int64)((INT_PTR)v))
5255 *state |= IOSTATE_failbit;
5256 else if(end!=tmp && !err)
5257 *pval = (void*)((INT_PTR)v);
5258 else
5259 *state |= IOSTATE_failbit;
5261 if(!first.strbuf)
5262 *state |= IOSTATE_eofbit;
5264 *ret = first;
5265 return ret;
5268 /* ?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 */
5269 /* ?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 */
5270 DEFINE_THISCALL_WRAPPER(num_get_char_get_void,36)
5271 istreambuf_iterator_char *__thiscall num_get_char_get_void(const num_get *this, istreambuf_iterator_char *ret,
5272 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, void **pval)
5274 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5275 return call_num_get_char_do_get_void(this, ret, first, last, base, state, pval);
5278 /* ?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 */
5279 /* ?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 */
5280 /* ?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 */
5281 /* ?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 */
5282 #define call_num_get_char_do_get_ldouble(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 8, istreambuf_iterator_char*, \
5283 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, double*), \
5284 (this, ret, first, last, base, state, pval))
5285 #define call_num_get_char_do_get_double(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 12, istreambuf_iterator_char*, \
5286 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, double*), \
5287 (this, ret, first, last, base, state, pval))
5288 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_double,36)
5289 istreambuf_iterator_char *__thiscall num_get_char_do_get_double(const num_get *this, istreambuf_iterator_char *ret,
5290 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, double *pval)
5292 double v;
5293 char tmp[32], *end;
5294 int err;
5296 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5298 v = _Stodx(tmp, &end, num_get_char__Getffld(this, tmp, &first, &last, &base->loc), &err);
5299 if(end!=tmp && !err)
5300 *pval = v;
5301 else
5302 *state |= IOSTATE_failbit;
5304 if(!first.strbuf)
5305 *state |= IOSTATE_eofbit;
5307 *ret = first;
5308 return ret;
5311 /* ?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 */
5312 /* ?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 */
5313 DEFINE_THISCALL_WRAPPER(num_get_char_get_ldouble,36)
5314 istreambuf_iterator_char *__thiscall num_get_char_get_ldouble(const num_get *this, istreambuf_iterator_char *ret,
5315 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, double *pval)
5317 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5318 return call_num_get_char_do_get_ldouble(this, ret, first, last, base, state, pval);
5321 /* ?get@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QBE?AV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@V32@0AAVios_base@2@AAHAAN@Z */
5322 /* ?get@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEBA?AV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@V32@0AEAVios_base@2@AEAHAEAN@Z */
5323 DEFINE_THISCALL_WRAPPER(num_get_char_get_double,36)
5324 istreambuf_iterator_char *__thiscall num_get_char_get_double(const num_get *this, istreambuf_iterator_char *ret,
5325 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, double *pval)
5327 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5328 return call_num_get_char_do_get_double(this, ret, first, last, base, state, pval);
5331 /* ?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 */
5332 /* ?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 */
5333 #define call_num_get_char_do_get_float(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 16, istreambuf_iterator_char*, \
5334 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, float*), \
5335 (this, ret, first, last, base, state, pval))
5336 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_float,36)
5337 istreambuf_iterator_char *__thiscall num_get_char_do_get_float(const num_get *this, istreambuf_iterator_char *ret,
5338 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, float *pval)
5340 float v;
5341 char tmp[32], *end;
5342 int err;
5344 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5346 v = _Stofx(tmp, &end, num_get_char__Getffld(this, tmp, &first, &last, &base->loc), &err);
5347 if(end!=tmp && !err)
5348 *pval = v;
5349 else
5350 *state |= IOSTATE_failbit;
5352 if(!first.strbuf)
5353 *state |= IOSTATE_eofbit;
5355 *ret = first;
5356 return ret;
5359 /* ?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 */
5360 /* ?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 */
5361 DEFINE_THISCALL_WRAPPER(num_get_char_get_float,36)
5362 istreambuf_iterator_char *__thiscall num_get_char_get_float(const num_get *this, istreambuf_iterator_char *ret,
5363 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, float *pval)
5365 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5366 return call_num_get_char_do_get_float(this, ret, first, last, base, state, pval);
5369 /* ?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 */
5370 /* ?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 */
5371 #define call_num_get_char_do_get_uint64(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 20, istreambuf_iterator_char*, \
5372 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, ULONGLONG*), \
5373 (this, ret, first, last, base, state, pval))
5374 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_uint64,36)
5375 istreambuf_iterator_char *__thiscall num_get_char_do_get_uint64(const num_get *this, istreambuf_iterator_char *ret,
5376 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, ULONGLONG *pval)
5378 unsigned __int64 v;
5379 char tmp[25], *end;
5380 int err;
5382 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5384 v = _Stoullx(tmp, &end, num_get_char__Getifld(this, tmp,
5385 &first, &last, base->fmtfl, &base->loc), &err);
5386 if(end!=tmp && !err)
5387 *pval = v;
5388 else
5389 *state |= IOSTATE_failbit;
5391 if(!first.strbuf)
5392 *state |= IOSTATE_eofbit;
5394 *ret = first;
5395 return ret;
5398 /* ?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 */
5399 /* ?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 */
5400 DEFINE_THISCALL_WRAPPER(num_get_char_get_uint64,36)
5401 istreambuf_iterator_char *__thiscall num_get_char_get_uint64(const num_get *this, istreambuf_iterator_char *ret,
5402 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, ULONGLONG *pval)
5404 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5405 return call_num_get_char_do_get_uint64(this, ret, first, last, base, state, pval);
5408 /* ?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 */
5409 /* ?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 */
5410 #define call_num_get_char_do_get_int64(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 24, istreambuf_iterator_char*, \
5411 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, LONGLONG*), \
5412 (this, ret, first, last, base, state, pval))
5413 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_int64,36)
5414 istreambuf_iterator_char *__thiscall num_get_char_do_get_int64(const num_get *this, istreambuf_iterator_char *ret,
5415 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, LONGLONG *pval)
5417 __int64 v;
5418 char tmp[25], *end;
5419 int err;
5421 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5423 v = _Stollx(tmp, &end, num_get_char__Getifld(this, tmp,
5424 &first, &last, base->fmtfl, &base->loc), &err);
5425 if(end!=tmp && !err)
5426 *pval = v;
5427 else
5428 *state |= IOSTATE_failbit;
5430 if(!first.strbuf)
5431 *state |= IOSTATE_eofbit;
5433 *ret = first;
5434 return ret;
5437 /* ?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 */
5438 /* ?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 */
5439 DEFINE_THISCALL_WRAPPER(num_get_char_get_int64,36)
5440 istreambuf_iterator_char *__thiscall num_get_char_get_int64(const num_get *this, istreambuf_iterator_char *ret,
5441 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, LONGLONG *pval)
5443 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5444 return call_num_get_char_do_get_int64(this, ret, first, last, base, state, pval);
5447 /* ?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 */
5448 /* ?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 */
5449 #define call_num_get_char_do_get_ulong(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 28, istreambuf_iterator_char*, \
5450 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, ULONG*), \
5451 (this, ret, first, last, base, state, pval))
5452 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_ulong,36)
5453 istreambuf_iterator_char *__thiscall num_get_char_do_get_ulong(const num_get *this, istreambuf_iterator_char *ret,
5454 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, ULONG *pval)
5456 ULONG v;
5457 char tmp[25], *end;
5458 int err;
5460 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5462 v = _Stoulx(tmp, &end, num_get_char__Getifld(this, tmp,
5463 &first, &last, base->fmtfl, &base->loc), &err);
5464 if(end!=tmp && !err)
5465 *pval = v;
5466 else
5467 *state |= IOSTATE_failbit;
5469 if(!first.strbuf)
5470 *state |= IOSTATE_eofbit;
5472 *ret = first;
5473 return ret;
5476 /* ?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 */
5477 /* ?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 */
5478 DEFINE_THISCALL_WRAPPER(num_get_char_get_ulong,36)
5479 istreambuf_iterator_char *__thiscall num_get_char_get_ulong(const num_get *this, istreambuf_iterator_char *ret,
5480 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, ULONG *pval)
5482 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5483 return call_num_get_char_do_get_ulong(this, ret, first, last, base, state, pval);
5486 /* ?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 */
5487 /* ?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 */
5488 #define call_num_get_char_do_get_long(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 32, istreambuf_iterator_char*, \
5489 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, LONG*), \
5490 (this, ret, first, last, base, state, pval))
5491 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_long,36)
5492 istreambuf_iterator_char *__thiscall num_get_char_do_get_long(const num_get *this, istreambuf_iterator_char *ret,
5493 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, LONG *pval)
5495 LONG v;
5496 char tmp[25], *end;
5497 int err;
5499 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5501 v = _Stolx(tmp, &end, num_get_char__Getifld(this, tmp,
5502 &first, &last, base->fmtfl, &base->loc), &err);
5503 if(end!=tmp && !err)
5504 *pval = v;
5505 else
5506 *state |= IOSTATE_failbit;
5508 if(!first.strbuf)
5509 *state |= IOSTATE_eofbit;
5511 *ret = first;
5512 return ret;
5515 /* ?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 */
5516 /* ?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 */
5517 DEFINE_THISCALL_WRAPPER(num_get_char_get_long,36)
5518 istreambuf_iterator_char *__thiscall num_get_char_get_long(const num_get *this, istreambuf_iterator_char *ret,
5519 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, LONG *pval)
5521 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5522 return call_num_get_char_do_get_long(this, ret, first, last, base, state, pval);
5525 /* ?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 */
5526 /* ?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 */
5527 #define call_num_get_char_do_get_uint(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 36, istreambuf_iterator_char*, \
5528 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, unsigned int*), \
5529 (this, ret, first, last, base, state, pval))
5530 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_uint,36)
5531 istreambuf_iterator_char *__thiscall num_get_char_do_get_uint(const num_get *this, istreambuf_iterator_char *ret,
5532 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, unsigned int *pval)
5534 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5535 return num_get_char_do_get_ulong(this, ret, first, last, base, state, pval);
5538 /* ?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 */
5539 /* ?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 */
5540 DEFINE_THISCALL_WRAPPER(num_get_char_get_uint,36)
5541 istreambuf_iterator_char *__thiscall num_get_char_get_uint(const num_get *this, istreambuf_iterator_char *ret,
5542 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, unsigned int *pval)
5544 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5545 return call_num_get_char_do_get_uint(this, ret, first, last, base, state, pval);
5548 /* ?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 */
5549 /* ?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 */
5550 #define call_num_get_char_do_get_ushort(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 40, istreambuf_iterator_char*, \
5551 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, unsigned short*), \
5552 (this, ret, first, last, base, state, pval))
5553 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_ushort,36)
5554 istreambuf_iterator_char *__thiscall num_get_char_do_get_ushort(const num_get *this, istreambuf_iterator_char *ret,
5555 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, unsigned short *pval)
5557 ULONG v;
5558 char tmp[25], *beg, *end;
5559 int err, b;
5561 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5563 b = num_get_char__Getifld(this, tmp,
5564 &first, &last, base->fmtfl, &base->loc);
5565 beg = tmp + (tmp[0]=='-' ? 1 : 0);
5566 v = _Stoulx(beg, &end, b, &err);
5568 if(v != (ULONG)((unsigned short)v))
5569 *state |= IOSTATE_failbit;
5570 else if(end!=beg && !err)
5571 *pval = (tmp[0]=='-' ? -((unsigned short)v) : v);
5572 else
5573 *state |= IOSTATE_failbit;
5575 if(!first.strbuf)
5576 *state |= IOSTATE_eofbit;
5578 *ret = first;
5579 return ret;
5582 /* ?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 */
5583 /* ?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 */
5584 DEFINE_THISCALL_WRAPPER(num_get_char_get_ushort,36)
5585 istreambuf_iterator_char *__thiscall num_get_char_get_ushort(const num_get *this, istreambuf_iterator_char *ret,
5586 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, unsigned short *pval)
5588 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5589 return call_num_get_char_do_get_ushort(this, ret, first, last, base, state, pval);
5592 /* ?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 */
5593 /* ?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 */
5594 #define call_num_get_char_do_get_bool(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 44, istreambuf_iterator_char*, \
5595 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, MSVCP_bool*), \
5596 (this, ret, first, last, base, state, pval))
5597 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_bool,36)
5598 istreambuf_iterator_char *__thiscall num_get_char_do_get_bool(const num_get *this, istreambuf_iterator_char *ret,
5599 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, MSVCP_bool *pval)
5601 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5603 if(base->fmtfl & FMTFLAG_boolalpha) {
5604 numpunct_char *numpunct = numpunct_char_use_facet(&base->loc);
5605 basic_string_char false_bstr, true_bstr;
5606 const char *pfalse, *ptrue;
5608 numpunct_char_falsename(numpunct, &false_bstr);
5609 numpunct_char_truename(numpunct, &true_bstr);
5610 pfalse = basic_string_char_c_str(&false_bstr);
5611 ptrue = basic_string_char_c_str(&true_bstr);
5613 for(istreambuf_iterator_char_val(&first); first.strbuf;) {
5614 if(pfalse && *pfalse && first.val!=*pfalse)
5615 pfalse = NULL;
5616 if(ptrue && *ptrue && first.val!=*ptrue)
5617 ptrue = NULL;
5619 if(pfalse && *pfalse && ptrue && !*ptrue)
5620 ptrue = NULL;
5621 if(ptrue && *ptrue && pfalse && !*pfalse)
5622 pfalse = NULL;
5624 if(pfalse)
5625 pfalse++;
5626 if(ptrue)
5627 ptrue++;
5629 if(pfalse || ptrue)
5630 istreambuf_iterator_char_inc(&first);
5632 if((!pfalse || !*pfalse) && (!ptrue || !*ptrue))
5633 break;
5636 if(ptrue)
5637 *pval = TRUE;
5638 else if(pfalse)
5639 *pval = FALSE;
5640 else
5641 *state |= IOSTATE_failbit;
5643 basic_string_char_dtor(&false_bstr);
5644 basic_string_char_dtor(&true_bstr);
5645 }else {
5646 char tmp[25], *end;
5647 int err;
5648 LONG v = _Stolx(tmp, &end, num_get_char__Getifld(this, tmp,
5649 &first, &last, base->fmtfl, &base->loc), &err);
5651 if(end!=tmp && err==0 && (v==0 || v==1))
5652 *pval = v;
5653 else
5654 *state |= IOSTATE_failbit;
5657 if(!first.strbuf)
5658 *state |= IOSTATE_eofbit;
5659 memcpy(ret, &first, sizeof(first));
5660 return ret;
5663 /* ?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 */
5664 /* ?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 */
5665 DEFINE_THISCALL_WRAPPER(num_get_char_get_bool,36)
5666 istreambuf_iterator_char *__thiscall num_get_char_get_bool(const num_get *this, istreambuf_iterator_char *ret,
5667 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, MSVCP_bool *pval)
5669 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5670 return call_num_get_char_do_get_bool(this, ret, first, last, base, state, pval);
5673 /* ?id@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@2V0locale@2@A */
5674 locale_id num_put_char_id = {0};
5676 /* num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@6B@ */
5677 extern const vtable_ptr MSVCP_num_put_char_vtable;
5679 /* ?_Init@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@IAEXABV_Locinfo@2@@Z */
5680 /* ?_Init@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@IEAAXAEBV_Locinfo@2@@Z */
5681 DEFINE_THISCALL_WRAPPER(num_put_char__Init, 8)
5682 void __thiscall num_put_char__Init(num_put *this, const _Locinfo *locinfo)
5684 TRACE("(%p %p)\n", this, locinfo);
5685 _Locinfo__Getcvt(locinfo, &this->cvt);
5688 /* ??0?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
5689 /* ??0?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
5690 DEFINE_THISCALL_WRAPPER(num_put_char_ctor_locinfo, 12)
5691 num_put* __thiscall num_put_char_ctor_locinfo(num_put *this, const _Locinfo *locinfo, MSVCP_size_t refs)
5693 TRACE("(%p %p %ld)\n", this, locinfo, refs);
5695 locale_facet_ctor_refs(&this->facet, refs);
5696 this->facet.vtable = &MSVCP_num_put_char_vtable;
5698 num_put_char__Init(this, locinfo);
5699 return this;
5702 /* ??0?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAE@I@Z */
5703 /* ??0?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAA@_K@Z */
5704 DEFINE_THISCALL_WRAPPER(num_put_char_ctor_refs, 8)
5705 num_put* __thiscall num_put_char_ctor_refs(num_put *this, MSVCP_size_t refs)
5707 _Locinfo locinfo;
5709 TRACE("(%p %lu)\n", this, refs);
5711 _Locinfo_ctor(&locinfo);
5712 num_put_char_ctor_locinfo(this, &locinfo, refs);
5713 _Locinfo_dtor(&locinfo);
5714 return this;
5717 /* ??_F?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAEXXZ */
5718 /* ??_F?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAAXXZ */
5719 DEFINE_THISCALL_WRAPPER(num_put_char_ctor, 4)
5720 num_put* __thiscall num_put_char_ctor(num_put *this)
5722 return num_put_char_ctor_refs(this, 0);
5725 /* ??1?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@UAE@XZ */
5726 /* ??1?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@UEAA@XZ */
5727 DEFINE_THISCALL_WRAPPER(num_put_char_dtor, 4)
5728 void __thiscall num_put_char_dtor(num_put *this)
5730 TRACE("(%p)\n", this);
5731 locale_facet_dtor(&this->facet);
5734 DEFINE_THISCALL_WRAPPER(num_put_char_vector_dtor, 8)
5735 num_put* __thiscall num_put_char_vector_dtor(num_put *this, unsigned int flags)
5737 TRACE("(%p %x)\n", this, flags);
5738 if(flags & 2) {
5739 /* we have an array, with the number of elements stored before the first object */
5740 INT_PTR i, *ptr = (INT_PTR *)this-1;
5742 for(i=*ptr-1; i>=0; i--)
5743 num_put_char_dtor(this+i);
5744 MSVCRT_operator_delete(ptr);
5745 } else {
5746 num_put_char_dtor(this);
5747 if(flags & 1)
5748 MSVCRT_operator_delete(this);
5751 return this;
5754 /* ?_Getcat@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
5755 /* ?_Getcat@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
5756 static MSVCP_size_t num_put_char__Getcat(const locale_facet **facet, const locale *loc)
5758 TRACE("(%p %p)\n", facet, loc);
5760 if(facet && !*facet) {
5761 _Locinfo locinfo;
5763 *facet = MSVCRT_operator_new(sizeof(num_put));
5764 if(!*facet) {
5765 ERR("Out of memory\n");
5766 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
5767 return 0;
5770 _Locinfo_ctor_cstr(&locinfo, basic_string_char_c_str(&loc->ptr->name));
5771 num_put_char_ctor_locinfo((num_put*)*facet, &locinfo, 0);
5772 _Locinfo_dtor(&locinfo);
5775 return LC_NUMERIC;
5778 num_put* num_put_char_use_facet(const locale *loc)
5780 static num_put *obj = NULL;
5782 _Lockit lock;
5783 const locale_facet *fac;
5785 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
5786 fac = locale__Getfacet(loc, locale_id_operator_size_t(&num_put_char_id), TRUE);
5787 if(fac) {
5788 _Lockit_dtor(&lock);
5789 return (num_put*)fac;
5792 if(obj) {
5793 _Lockit_dtor(&lock);
5794 return obj;
5797 num_put_char__Getcat(&fac, loc);
5798 obj = (num_put*)fac;
5799 locale_facet__Incref(&obj->facet);
5800 locale_facet_register(&obj->facet);
5801 _Lockit_dtor(&lock);
5803 return obj;
5806 /* ?_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 */
5807 /* ?_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 */
5808 static ostreambuf_iterator_char* num_put_char__Putc(const num_put *this, ostreambuf_iterator_char *ret,
5809 ostreambuf_iterator_char dest, const char *ptr, MSVCP_size_t count)
5811 TRACE("(%p %p %p %ld)\n", this, ret, ptr, count);
5813 for(; count>0; count--)
5814 ostreambuf_iterator_char_put(&dest, *ptr++);
5816 *ret = dest;
5817 return ret;
5820 /* ?_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 */
5821 /* ?_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 */
5822 static ostreambuf_iterator_char* num_put_char__Rep(const num_put *this, ostreambuf_iterator_char *ret,
5823 ostreambuf_iterator_char dest, char c, MSVCP_size_t count)
5825 TRACE("(%p %p %d %ld)\n", this, ret, c, count);
5827 for(; count>0; count--)
5828 ostreambuf_iterator_char_put(&dest, c);
5830 *ret = dest;
5831 return ret;
5834 /* ?_Ffmt@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@ABAPADPADDH@Z */
5835 /* ?_Ffmt@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@AEBAPEADPEADDH@Z */
5836 static char* num_put_char__Ffmt(const num_put *this, char *fmt, char spec, int fmtfl)
5838 int type = fmtfl & FMTFLAG_floatfield;
5839 char *p = fmt;
5841 TRACE("(%p %p %d %d)\n", this, fmt, spec, fmtfl);
5843 *p++ = '%';
5844 if(fmtfl & FMTFLAG_showpos)
5845 *p++ = '+';
5846 if(fmtfl & FMTFLAG_showpoint)
5847 *p++ = '#';
5848 *p++ = '.';
5849 *p++ = '*';
5850 if(spec)
5851 *p++ = spec;
5853 if(type == FMTFLAG_fixed)
5854 *p++ = 'f';
5855 else if(type == FMTFLAG_scientific)
5856 *p++ = (fmtfl & FMTFLAG_uppercase) ? 'E' : 'e';
5857 else if(type == (FMTFLAG_fixed|FMTFLAG_scientific))
5858 *p++ = (fmtfl & FMTFLAG_uppercase) ? 'A' : 'a';
5859 else
5860 *p++ = (fmtfl & FMTFLAG_uppercase) ? 'G' : 'g';
5862 *p++ = '\0';
5863 return fmt;
5866 /* TODO: This function should be removed when num_put_char__Fput is implemented */
5867 static ostreambuf_iterator_char* num_put_char_fput(const num_put *this, ostreambuf_iterator_char *ret,
5868 ostreambuf_iterator_char dest, ios_base *base, char fill, char *buf, MSVCP_size_t count)
5870 numpunct_char *numpunct = numpunct_char_use_facet(&base->loc);
5871 char *p, sep = *localeconv()->decimal_point;
5872 int adjustfield = base->fmtfl & FMTFLAG_adjustfield;
5873 MSVCP_size_t pad;
5875 TRACE("(%p %p %p %d %s %ld)\n", this, ret, base, fill, buf, count);
5877 /* Change decimal point */
5878 for(p=buf; p<buf+count; p++) {
5879 if(*p == sep) {
5880 *p = numpunct_char_decimal_point(numpunct);
5881 break;
5884 p--;
5886 /* Display number with padding */
5887 if(count >= base->wide)
5888 pad = 0;
5889 else
5890 pad = base->wide-count;
5891 base->wide = 0;
5893 if((adjustfield & FMTFLAG_internal) && (buf[0]=='-' || buf[0]=='+')) {
5894 num_put_char__Putc(this, &dest, dest, buf, 1);
5895 buf++;
5897 if(adjustfield != FMTFLAG_left) {
5898 num_put_char__Rep(this, ret, dest, fill, pad);
5899 pad = 0;
5901 num_put_char__Putc(this, &dest, dest, buf, count);
5902 return num_put_char__Rep(this, ret, dest, fill, pad);
5905 /* ?_Ifmt@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@ABAPADPADPBDH@Z */
5906 /* ?_Ifmt@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@AEBAPEADPEADPEBDH@Z */
5907 static char* num_put_char__Ifmt(const num_put *this, char *fmt, const char *spec, int fmtfl)
5909 int base = fmtfl & FMTFLAG_basefield;
5910 char *p = fmt;
5912 TRACE("(%p %p %p %d)\n", this, fmt, spec, fmtfl);
5914 *p++ = '%';
5915 if(fmtfl & FMTFLAG_showpos)
5916 *p++ = '+';
5917 if(fmtfl & FMTFLAG_showbase)
5918 *p++ = '#';
5920 *p++ = *spec++;
5921 if(*spec == 'l')
5922 *p++ = *spec++;
5924 if(base == FMTFLAG_oct)
5925 *p++ = 'o';
5926 else if(base == FMTFLAG_hex)
5927 *p++ = (fmtfl & FMTFLAG_uppercase) ? 'X' : 'x';
5928 else
5929 *p++ = *spec;
5931 *p++ = '\0';
5932 return fmt;
5935 /* ?_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 */
5936 /* ?_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 */
5937 static ostreambuf_iterator_char* num_put_char__Iput(const num_put *this, ostreambuf_iterator_char *ret,
5938 ostreambuf_iterator_char dest, ios_base *base, char fill, char *buf, MSVCP_size_t count)
5940 numpunct_char *numpunct = numpunct_char_use_facet(&base->loc);
5941 basic_string_char grouping_bstr;
5942 const char *grouping;
5943 char *p, sep;
5944 int cur_group = 0, group_size = 0;
5945 int adjustfield = base->fmtfl & FMTFLAG_adjustfield;
5946 MSVCP_size_t pad;
5948 TRACE("(%p %p %p %d %s %ld)\n", this, ret, base, fill, buf, count);
5950 /* Add separators to number */
5951 numpunct_char_grouping(numpunct, &grouping_bstr);
5952 grouping = basic_string_char_c_str(&grouping_bstr);
5953 sep = grouping[0] ? numpunct_char_thousands_sep(numpunct) : '\0';
5955 for(p=buf+count-1; p>buf && sep && grouping[cur_group]!=CHAR_MAX; p--) {
5956 group_size++;
5957 if(group_size == grouping[cur_group]) {
5958 group_size = 0;
5959 if(grouping[cur_group+1])
5960 cur_group++;
5962 memmove(p+1, p, buf+count-p);
5963 *p = sep;
5964 count++;
5967 basic_string_char_dtor(&grouping_bstr);
5969 /* Display number with padding */
5970 if(count >= base->wide)
5971 pad = 0;
5972 else
5973 pad = base->wide-count;
5974 base->wide = 0;
5976 if((adjustfield & FMTFLAG_internal) && (buf[0]=='-' || buf[0]=='+')) {
5977 num_put_char__Putc(this, &dest, dest, buf, 1);
5978 buf++;
5979 }else if((adjustfield & FMTFLAG_internal) && (buf[1]=='x' || buf[1]=='X')) {
5980 num_put_char__Putc(this, &dest, dest, buf, 2);
5981 buf += 2;
5983 if(adjustfield != FMTFLAG_left) {
5984 num_put_char__Rep(this, ret, dest, fill, pad);
5985 pad = 0;
5987 num_put_char__Putc(this, &dest, dest, buf, count);
5988 return num_put_char__Rep(this, ret, dest, fill, pad);
5991 /* ?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 */
5992 /* ?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 */
5993 #define call_num_put_char_do_put_long(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 28, ostreambuf_iterator_char*, \
5994 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, LONG), \
5995 (this, ret, dest, base, fill, v))
5996 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_long, 28)
5997 ostreambuf_iterator_char* __thiscall num_put_char_do_put_long(const num_put *this, ostreambuf_iterator_char *ret,
5998 ostreambuf_iterator_char dest, ios_base *base, char fill, LONG v)
6000 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
6001 char fmt[7]; /* strlen("%+#lld")+1 */
6003 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
6005 return num_put_char__Iput(this, ret, dest, base, fill, tmp,
6006 sprintf(tmp, num_put_char__Ifmt(this, fmt, "ld", base->fmtfl), v));
6009 /* ?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 */
6010 /* ?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 */
6011 DEFINE_THISCALL_WRAPPER(num_put_char_put_long, 28)
6012 ostreambuf_iterator_char* __thiscall num_put_char_put_long(const num_put *this, ostreambuf_iterator_char *ret,
6013 ostreambuf_iterator_char dest, ios_base *base, char fill, LONG v)
6015 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
6016 return call_num_put_char_do_put_long(this, ret, dest, base, fill, v);
6019 /* ?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 */
6020 /* ?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 */
6021 #define call_num_put_char_do_put_ulong(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 24, ostreambuf_iterator_char*, \
6022 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, ULONG), \
6023 (this, ret, dest, base, fill, v))
6024 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_ulong, 28)
6025 ostreambuf_iterator_char* __thiscall num_put_char_do_put_ulong(const num_put *this, ostreambuf_iterator_char *ret,
6026 ostreambuf_iterator_char dest, ios_base *base, char fill, ULONG v)
6028 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
6029 char fmt[7]; /* strlen("%+#lld")+1 */
6031 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
6033 return num_put_char__Iput(this, ret, dest, base, fill, tmp,
6034 sprintf(tmp, num_put_char__Ifmt(this, fmt, "lu", base->fmtfl), v));
6037 /* ?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 */
6038 /* ?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 */
6039 DEFINE_THISCALL_WRAPPER(num_put_char_put_ulong, 28)
6040 ostreambuf_iterator_char* __thiscall num_put_char_put_ulong(const num_put *this, ostreambuf_iterator_char *ret,
6041 ostreambuf_iterator_char dest, ios_base *base, char fill, ULONG v)
6043 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
6044 return call_num_put_char_do_put_ulong(this, ret, dest, base, fill, v);
6047 static inline streamsize get_precision(const ios_base *base)
6049 return base->prec <= 0 && !(base->fmtfl & FMTFLAG_fixed) ? 6 : base->prec;
6052 /* ?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 */
6053 /* ?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 */
6054 /* ?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 */
6055 /* ?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 */
6056 #define call_num_put_char_do_put_double(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 12, ostreambuf_iterator_char*, \
6057 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, double), \
6058 (this, ret, dest, base, fill, v))
6059 #define call_num_put_char_do_put_ldouble(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 8, ostreambuf_iterator_char*, \
6060 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, double), \
6061 (this, ret, dest, base, fill, v))
6062 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_double, 32)
6063 ostreambuf_iterator_char* __thiscall num_put_char_do_put_double(const num_put *this, ostreambuf_iterator_char *ret,
6064 ostreambuf_iterator_char dest, ios_base *base, char fill, double v)
6066 char *tmp;
6067 char fmt[8]; /* strlen("%+#.*lg")+1 */
6068 int size;
6069 streamsize prec;
6071 TRACE("(%p %p %p %d %lf)\n", this, ret, base, fill, v);
6073 num_put_char__Ffmt(this, fmt, '\0', base->fmtfl);
6074 prec = get_precision(base);
6075 size = _scprintf(fmt, prec, v);
6077 /* TODO: don't use dynamic allocation */
6078 tmp = MSVCRT_operator_new(size*2);
6079 if(!tmp) {
6080 ERR("Out of memory\n");
6081 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
6083 num_put_char_fput(this, ret, dest, base, fill, tmp, sprintf(tmp, fmt, prec, v));
6084 MSVCRT_operator_delete(tmp);
6085 return ret;
6088 /* ?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 */
6089 /* ?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 */
6090 DEFINE_THISCALL_WRAPPER(num_put_char_put_double, 32)
6091 ostreambuf_iterator_char* __thiscall num_put_char_put_double(const num_put *this, ostreambuf_iterator_char *ret,
6092 ostreambuf_iterator_char dest, ios_base *base, char fill, double v)
6094 TRACE("(%p %p %p %d %lf)\n", this, ret, base, fill, v);
6095 return call_num_put_char_do_put_double(this, ret, dest, base, fill, v);
6098 /* ?put@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QBE?AV?$ostreambuf_iterator@DU?$char_traits@D@std@@@2@V32@AAVios_base@2@DO@Z */
6099 /* ?put@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEBA?AV?$ostreambuf_iterator@DU?$char_traits@D@std@@@2@V32@AEAVios_base@2@DO@Z */
6100 DEFINE_THISCALL_WRAPPER(num_put_char_put_ldouble, 32)
6101 ostreambuf_iterator_char* __thiscall num_put_char_put_ldouble(const num_put *this, ostreambuf_iterator_char *ret,
6102 ostreambuf_iterator_char dest, ios_base *base, char fill, double v)
6104 TRACE("(%p %p %p %d %lf)\n", this, ret, base, fill, v);
6105 return call_num_put_char_do_put_ldouble(this, ret, dest, base, fill, v);
6108 /* ?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 */
6109 /* ?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 */
6110 #define call_num_put_char_do_put_ptr(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 4, ostreambuf_iterator_char*, \
6111 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, const void*), \
6112 (this, ret, dest, base, fill, v))
6113 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_ptr, 28)
6114 ostreambuf_iterator_char* __thiscall num_put_char_do_put_ptr(const num_put *this, ostreambuf_iterator_char *ret,
6115 ostreambuf_iterator_char dest, ios_base *base, char fill, const void *v)
6117 char tmp[17]; /* 8(16^8==2^64)*2(separators beetwen every digit) + 1 */
6119 TRACE("(%p %p %p %d %p)\n", this, ret, base, fill, v);
6121 return num_put_char__Iput(this, ret, dest, base, fill, tmp, sprintf(tmp, "%p", v));
6124 /* ?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 */
6125 /* ?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 */
6126 DEFINE_THISCALL_WRAPPER(num_put_char_put_ptr, 28)
6127 ostreambuf_iterator_char* __thiscall num_put_char_put_ptr(const num_put *this, ostreambuf_iterator_char *ret,
6128 ostreambuf_iterator_char dest, ios_base *base, char fill, const void *v)
6130 TRACE("(%p %p %p %d %p)\n", this, ret, base, fill, v);
6131 return call_num_put_char_do_put_ptr(this, ret, dest, base, fill, v);
6134 /* ?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 */
6135 /* ?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 */
6136 #define call_num_put_char_do_put_int64(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 20, ostreambuf_iterator_char*, \
6137 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, __int64), \
6138 (this, ret, dest, base, fill, v))
6139 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_int64, 32)
6140 ostreambuf_iterator_char* __thiscall num_put_char_do_put_int64(const num_put *this, ostreambuf_iterator_char *ret,
6141 ostreambuf_iterator_char dest, ios_base *base, char fill, __int64 v)
6143 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
6144 char fmt[7]; /* strlen("%+#lld")+1 */
6146 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
6148 return num_put_char__Iput(this, ret, dest, base, fill, tmp,
6149 sprintf(tmp, num_put_char__Ifmt(this, fmt, "lld", base->fmtfl), v));
6152 /* ?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 */
6153 /* ?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 */
6154 DEFINE_THISCALL_WRAPPER(num_put_char_put_int64, 32)
6155 ostreambuf_iterator_char* __thiscall num_put_char_put_int64(const num_put *this, ostreambuf_iterator_char *ret,
6156 ostreambuf_iterator_char dest, ios_base *base, char fill, __int64 v)
6158 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
6159 return call_num_put_char_do_put_int64(this, ret, dest, base, fill, v);
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@D_K@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@D_K@Z */
6164 #define call_num_put_char_do_put_uint64(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 16, ostreambuf_iterator_char*, \
6165 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, unsigned __int64), \
6166 (this, ret, dest, base, fill, v))
6167 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_uint64, 32)
6168 ostreambuf_iterator_char* __thiscall num_put_char_do_put_uint64(const num_put *this, ostreambuf_iterator_char *ret,
6169 ostreambuf_iterator_char dest, ios_base *base, char fill, unsigned __int64 v)
6171 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
6172 char fmt[7]; /* strlen("%+#lld")+1 */
6174 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
6176 return num_put_char__Iput(this, ret, dest, base, fill, tmp,
6177 sprintf(tmp, num_put_char__Ifmt(this, fmt, "llu", base->fmtfl), v));
6180 /* ?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 */
6181 /* ?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 */
6182 DEFINE_THISCALL_WRAPPER(num_put_char_put_uint64, 32)
6183 ostreambuf_iterator_char* __thiscall num_put_char_put_uint64(const num_put *this, ostreambuf_iterator_char *ret,
6184 ostreambuf_iterator_char dest, ios_base *base, char fill, unsigned __int64 v)
6186 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
6187 return call_num_put_char_do_put_uint64(this, ret, dest, base, fill, v);
6190 /* ?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 */
6191 /* ?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 */
6192 #define call_num_put_char_do_put_bool(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 32, ostreambuf_iterator_char*, \
6193 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, MSVCP_bool), \
6194 (this, ret, dest, base, fill, v))
6195 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_bool, 28)
6196 ostreambuf_iterator_char* __thiscall num_put_char_do_put_bool(const num_put *this, ostreambuf_iterator_char *ret,
6197 ostreambuf_iterator_char dest, ios_base *base, char fill, MSVCP_bool v)
6199 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
6201 if(base->fmtfl & FMTFLAG_boolalpha) {
6202 numpunct_char *numpunct = numpunct_char_use_facet(&base->loc);
6203 basic_string_char str;
6204 MSVCP_size_t pad, len;
6206 if(v)
6207 numpunct_char_truename(numpunct, &str);
6208 else
6209 numpunct_char_falsename(numpunct, &str);
6211 len = basic_string_char_length(&str);
6212 pad = (len>base->wide ? 0 : base->wide-len);
6213 base->wide = 0;
6215 if((base->fmtfl & FMTFLAG_adjustfield) != FMTFLAG_left) {
6216 num_put_char__Rep(this, &dest, dest, fill, pad);
6217 pad = 0;
6219 num_put_char__Putc(this, &dest, dest, basic_string_char_c_str(&str), len);
6220 basic_string_char_dtor(&str);
6221 return num_put_char__Rep(this, ret, dest, fill, pad);
6224 return num_put_char_put_long(this, ret, dest, base, fill, v);
6227 /* ?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 */
6228 /* ?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 */
6229 DEFINE_THISCALL_WRAPPER(num_put_char_put_bool, 28)
6230 ostreambuf_iterator_char* __thiscall num_put_char_put_bool(const num_put *this, ostreambuf_iterator_char *ret,
6231 ostreambuf_iterator_char dest, ios_base *base, char fill, MSVCP_bool v)
6233 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
6234 return call_num_put_char_do_put_bool(this, ret, dest, base, fill, v);
6237 /* ?id@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@2V0locale@2@A */
6238 static locale_id num_put_wchar_id = {0};
6239 /* ?id@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@2V0locale@2@A */
6240 locale_id num_put_short_id = {0};
6242 /* num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@6B@ */
6243 extern const vtable_ptr MSVCP_num_put_wchar_vtable;
6244 /* num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@6B@ */
6245 extern const vtable_ptr MSVCP_num_put_short_vtable;
6247 /* ?_Init@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@IAEXABV_Locinfo@2@@Z */
6248 /* ?_Init@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@IEAAXAEBV_Locinfo@2@@Z */
6249 DEFINE_THISCALL_WRAPPER(num_put_wchar__Init, 8)
6250 void __thiscall num_put_wchar__Init(num_put *this, const _Locinfo *locinfo)
6252 TRACE("(%p %p)\n", this, locinfo);
6253 _Locinfo__Getcvt(locinfo, &this->cvt);
6256 /* ??0?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
6257 /* ??0?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
6258 static num_put* num_put_wchar_ctor_locinfo(num_put *this, const _Locinfo *locinfo, MSVCP_size_t refs)
6260 TRACE("(%p %p %ld)\n", this, locinfo, refs);
6262 locale_facet_ctor_refs(&this->facet, refs);
6263 this->facet.vtable = &MSVCP_num_put_wchar_vtable;
6265 num_put_wchar__Init(this, locinfo);
6266 return this;
6269 /* ??0?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
6270 /* ??0?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
6271 DEFINE_THISCALL_WRAPPER(num_put_short_ctor_locinfo, 12)
6272 num_put* __thiscall num_put_short_ctor_locinfo(num_put *this, const _Locinfo *locinfo, MSVCP_size_t refs)
6274 num_put_wchar_ctor_locinfo(this, locinfo, refs);
6275 this->facet.vtable = &MSVCP_num_put_short_vtable;
6276 return this;
6279 /* ??0?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAE@I@Z */
6280 /* ??0?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAA@_K@Z */
6281 static num_put* num_put_wchar_ctor_refs(num_put *this, MSVCP_size_t refs)
6283 _Locinfo locinfo;
6285 TRACE("(%p %lu)\n", this, refs);
6287 _Locinfo_ctor(&locinfo);
6288 num_put_wchar_ctor_locinfo(this, &locinfo, refs);
6289 _Locinfo_dtor(&locinfo);
6290 return this;
6293 /* ??0?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAE@I@Z */
6294 /* ??0?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEAA@_K@Z */
6295 DEFINE_THISCALL_WRAPPER(num_put_short_ctor_refs, 8)
6296 num_put* __thiscall num_put_short_ctor_refs(num_put *this, MSVCP_size_t refs)
6298 num_put_wchar_ctor_refs(this, refs);
6299 this->facet.vtable = &MSVCP_num_put_short_vtable;
6300 return this;
6303 /* ??_F?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAEXXZ */
6304 /* ??_F?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEAAXXZ */
6305 DEFINE_THISCALL_WRAPPER(num_put_short_ctor, 4)
6306 num_put* __thiscall num_put_short_ctor(num_put *this)
6308 return num_put_short_ctor_refs(this, 0);
6311 /* ??1?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@UAE@XZ */
6312 /* ??1?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@UEAA@XZ */
6313 DEFINE_THISCALL_WRAPPER(num_put_wchar_dtor, 4)
6314 void __thiscall num_put_wchar_dtor(num_put *this)
6316 TRACE("(%p)\n", this);
6317 locale_facet_dtor(&this->facet);
6320 DEFINE_THISCALL_WRAPPER(num_put_wchar_vector_dtor, 8)
6321 num_put* __thiscall num_put_wchar_vector_dtor(num_put *this, unsigned int flags)
6323 TRACE("(%p %x)\n", this, flags);
6324 if(flags & 2) {
6325 /* we have an array, with the number of elements stored before the first object */
6326 INT_PTR i, *ptr = (INT_PTR *)this-1;
6328 for(i=*ptr-1; i>=0; i--)
6329 num_put_wchar_dtor(this+i);
6330 MSVCRT_operator_delete(ptr);
6331 } else {
6332 num_put_wchar_dtor(this);
6333 if(flags & 1)
6334 MSVCRT_operator_delete(this);
6337 return this;
6340 /* ?_Getcat@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
6341 /* ?_Getcat@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
6342 static MSVCP_size_t num_put_wchar__Getcat(const locale_facet **facet, const locale *loc)
6344 TRACE("(%p %p)\n", facet, loc);
6346 if(facet && !*facet) {
6347 _Locinfo locinfo;
6349 *facet = MSVCRT_operator_new(sizeof(num_put));
6350 if(!*facet) {
6351 ERR("Out of memory\n");
6352 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
6353 return 0;
6356 _Locinfo_ctor_cstr(&locinfo, basic_string_char_c_str(&loc->ptr->name));
6357 num_put_wchar_ctor_locinfo((num_put*)*facet, &locinfo, 0);
6358 _Locinfo_dtor(&locinfo);
6361 return LC_NUMERIC;
6364 /* ?_Getcat@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
6365 /* ?_Getcat@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
6366 static MSVCP_size_t num_put_short__Getcat(const locale_facet **facet, const locale *loc)
6368 TRACE("(%p %p)\n", facet, loc);
6370 if(facet && !*facet) {
6371 _Locinfo locinfo;
6373 *facet = MSVCRT_operator_new(sizeof(num_put));
6374 if(!*facet) {
6375 ERR("Out of memory\n");
6376 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
6377 return 0;
6380 _Locinfo_ctor_cstr(&locinfo, basic_string_char_c_str(&loc->ptr->name));
6381 num_put_short_ctor_locinfo((num_put*)*facet, &locinfo, 0);
6382 _Locinfo_dtor(&locinfo);
6385 return LC_NUMERIC;
6388 static num_put* num_put_wchar_use_facet(const locale *loc)
6390 static num_put *obj = NULL;
6392 _Lockit lock;
6393 const locale_facet *fac;
6395 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
6396 fac = locale__Getfacet(loc, locale_id_operator_size_t(&num_put_wchar_id), TRUE);
6397 if(fac) {
6398 _Lockit_dtor(&lock);
6399 return (num_put*)fac;
6402 if(obj) {
6403 _Lockit_dtor(&lock);
6404 return obj;
6407 num_put_wchar__Getcat(&fac, loc);
6408 obj = (num_put*)fac;
6409 locale_facet__Incref(&obj->facet);
6410 locale_facet_register(&obj->facet);
6411 _Lockit_dtor(&lock);
6413 return obj;
6416 num_put* num_put_short_use_facet(const locale *loc)
6418 static num_put *obj = NULL;
6420 _Lockit lock;
6421 const locale_facet *fac;
6423 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
6424 fac = locale__Getfacet(loc, locale_id_operator_size_t(&num_put_short_id), TRUE);
6425 if(fac) {
6426 _Lockit_dtor(&lock);
6427 return (num_put*)fac;
6430 if(obj) {
6431 _Lockit_dtor(&lock);
6432 return obj;
6435 num_put_short__Getcat(&fac, loc);
6436 obj = (num_put*)fac;
6437 locale_facet__Incref(&obj->facet);
6438 locale_facet_register(&obj->facet);
6439 _Lockit_dtor(&lock);
6441 return obj;
6444 /* ?_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 */
6445 /* ?_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 */
6446 /* ?_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 */
6447 /* ?_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 */
6448 static ostreambuf_iterator_wchar* num_put_wchar__Put(const num_put *this, ostreambuf_iterator_wchar *ret,
6449 ostreambuf_iterator_wchar dest, const wchar_t *ptr, MSVCP_size_t count)
6451 TRACE("(%p %p %s %ld)\n", this, ret, debugstr_wn(ptr, count), count);
6453 for(; count>0; count--)
6454 ostreambuf_iterator_wchar_put(&dest, *ptr++);
6456 *ret = dest;
6457 return ret;
6460 /* ?_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 */
6461 /* ?_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 */
6462 /* ?_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 */
6463 /* ?_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 */
6464 static ostreambuf_iterator_wchar* num_put_wchar__Putc(const num_put *this, ostreambuf_iterator_wchar *ret,
6465 ostreambuf_iterator_wchar dest, const char *ptr, MSVCP_size_t count)
6467 int state = 0;
6468 wchar_t ch;
6470 TRACE("(%p %p %s %ld)\n", this, ret, debugstr_an(ptr, count), count);
6472 for(; count>0; count--) {
6473 if(_Mbrtowc(&ch, ptr++, 1, &state, &this->cvt) == 1)
6474 ostreambuf_iterator_wchar_put(&dest, ch);
6477 *ret = dest;
6478 return ret;
6481 /* ?_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 */
6482 /* ?_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 */
6483 /* ?_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 */
6484 /* ?_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 */
6485 static ostreambuf_iterator_wchar* num_put_wchar__Rep(const num_put *this, ostreambuf_iterator_wchar *ret,
6486 ostreambuf_iterator_wchar dest, wchar_t c, MSVCP_size_t count)
6488 TRACE("(%p %p %d %ld)\n", this, ret, c, count);
6490 for(; count>0; count--)
6491 ostreambuf_iterator_wchar_put(&dest, c);
6493 *ret = dest;
6494 return ret;
6497 /* ?_Ffmt@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@ABAPADPADDH@Z */
6498 /* ?_Ffmt@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@AEBAPEADPEADDH@Z */
6499 /* ?_Ffmt@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@ABAPADPADDH@Z */
6500 /* ?_Ffmt@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@AEBAPEADPEADDH@Z */
6501 static char* num_put_wchar__Ffmt(const num_put *this, char *fmt, char spec, int fmtfl)
6503 int type = fmtfl & FMTFLAG_floatfield;
6504 char *p = fmt;
6506 TRACE("(%p %p %d %d)\n", this, fmt, spec, fmtfl);
6508 *p++ = '%';
6509 if(fmtfl & FMTFLAG_showpos)
6510 *p++ = '+';
6511 if(fmtfl & FMTFLAG_showbase)
6512 *p++ = '#';
6513 *p++ = '.';
6514 *p++ = '*';
6515 if(spec)
6516 *p++ = spec;
6518 if(type == FMTFLAG_fixed)
6519 *p++ = 'f';
6520 else if(type == FMTFLAG_scientific)
6521 *p++ = (fmtfl & FMTFLAG_uppercase) ? 'E' : 'e';
6522 else if(type == (FMTFLAG_fixed|FMTFLAG_scientific))
6523 *p++ = (fmtfl & FMTFLAG_uppercase) ? 'A' : 'a';
6524 else
6525 *p++ = (fmtfl & FMTFLAG_uppercase) ? 'G' : 'g';
6527 *p++ = '\0';
6528 return fmt;
6531 /* TODO: This function should be removed when num_put_wchar__Fput is implemented */
6532 static ostreambuf_iterator_wchar* num_put__fput(const num_put *this, ostreambuf_iterator_wchar *ret,
6533 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, char *buf,
6534 MSVCP_size_t count, numpunct_wchar *numpunct)
6536 char *p, dec_point = *localeconv()->decimal_point;
6537 int adjustfield = base->fmtfl & FMTFLAG_adjustfield;
6538 MSVCP_size_t i, pad;
6540 TRACE("(%p %p %p %d %s %ld)\n", this, ret, base, fill, buf, count);
6542 for(p=buf; p<buf+count; p++) {
6543 if(*p == dec_point)
6544 break;
6546 p--;
6548 /* Display number with padding */
6549 if(count >= base->wide)
6550 pad = 0;
6551 else
6552 pad = base->wide-count;
6553 base->wide = 0;
6555 if((adjustfield & FMTFLAG_internal) && (buf[0]=='-' || buf[0]=='+')) {
6556 num_put_wchar__Putc(this, &dest, dest, buf, 1);
6557 buf++;
6559 if(adjustfield != FMTFLAG_left) {
6560 num_put_wchar__Rep(this, ret, dest, fill, pad);
6561 pad = 0;
6564 for(i=0; i<count; i++) {
6565 if(buf[i] == dec_point)
6566 num_put_wchar__Rep(this, &dest, dest, numpunct_wchar_decimal_point(numpunct), 1);
6567 else
6568 num_put_wchar__Putc(this, &dest, dest, buf+i, 1);
6571 return num_put_wchar__Rep(this, ret, dest, fill, pad);
6574 /* ?_Ifmt@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@ABAPADPADPBDH@Z */
6575 /* ?_Ifmt@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@AEBAPEADPEADPEBDH@Z */
6576 /* ?_Ifmt@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@ABAPADPADPBDH@Z */
6577 /* ?_Ifmt@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@AEBAPEADPEADPEBDH@Z */
6578 static char* num_put_wchar__Ifmt(const num_put *this, char *fmt, const char *spec, int fmtfl)
6580 int base = fmtfl & FMTFLAG_basefield;
6581 char *p = fmt;
6583 TRACE("(%p %p %p %d)\n", this, fmt, spec, fmtfl);
6585 *p++ = '%';
6586 if(fmtfl & FMTFLAG_showpos)
6587 *p++ = '+';
6588 if(fmtfl & FMTFLAG_showbase)
6589 *p++ = '#';
6591 *p++ = *spec++;
6592 if(*spec == 'l')
6593 *p++ = *spec++;
6595 if(base == FMTFLAG_oct)
6596 *p++ = 'o';
6597 else if(base == FMTFLAG_hex)
6598 *p++ = (fmtfl & FMTFLAG_uppercase) ? 'X' : 'x';
6599 else
6600 *p++ = *spec;
6602 *p++ = '\0';
6603 return fmt;
6606 static ostreambuf_iterator_wchar* num_put__Iput(const num_put *this, ostreambuf_iterator_wchar *ret,
6607 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, char *buf,
6608 MSVCP_size_t count, numpunct_wchar *numpunct)
6610 basic_string_char grouping_bstr;
6611 const char *grouping;
6612 char *p;
6613 wchar_t sep;
6614 int cur_group = 0, group_size = 0;
6615 int adjustfield = base->fmtfl & FMTFLAG_adjustfield;
6616 MSVCP_size_t i, pad;
6618 TRACE("(%p %p %p %d %s %ld)\n", this, ret, base, fill, buf, count);
6620 /* Add separators to number */
6621 numpunct_wchar_grouping(numpunct, &grouping_bstr);
6622 grouping = basic_string_char_c_str(&grouping_bstr);
6623 sep = grouping[0] ? numpunct_wchar_thousands_sep(numpunct) : '\0';
6625 for(p=buf+count-1; p>buf && sep && grouping[cur_group]!=CHAR_MAX; p--) {
6626 group_size++;
6627 if(group_size == grouping[cur_group]) {
6628 group_size = 0;
6629 if(grouping[cur_group+1])
6630 cur_group++;
6632 memmove(p+1, p, buf+count-p);
6633 *p = '\0'; /* mark thousands separator positions */
6634 count++;
6637 basic_string_char_dtor(&grouping_bstr);
6639 /* Display number with padding */
6640 if(count >= base->wide)
6641 pad = 0;
6642 else
6643 pad = base->wide-count;
6644 base->wide = 0;
6646 if((adjustfield & FMTFLAG_internal) && (buf[0]=='-' || buf[0]=='+')) {
6647 num_put_wchar__Putc(this, &dest, dest, buf, 1);
6648 buf++;
6649 }else if((adjustfield & FMTFLAG_internal) && (buf[1]=='x' || buf[1]=='X')) {
6650 num_put_wchar__Putc(this, &dest, dest, buf, 2);
6651 buf += 2;
6653 if(adjustfield != FMTFLAG_left) {
6654 num_put_wchar__Rep(this, ret, dest, fill, pad);
6655 pad = 0;
6658 for(i=0; i<count; i++) {
6659 if(!buf[i])
6660 num_put_wchar__Rep(this, &dest, dest, sep, 1);
6661 else
6662 num_put_wchar__Putc(this, &dest, dest, buf+i, 1);
6665 return num_put_wchar__Rep(this, ret, dest, fill, pad);
6668 /* ?_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 */
6669 /* ?_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 */
6670 static ostreambuf_iterator_wchar* num_put_wchar__Iput(const num_put *this, ostreambuf_iterator_wchar *ret,
6671 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, char *buf, MSVCP_size_t count)
6673 return num_put__Iput(this, ret, dest, base, fill, buf, count, numpunct_wchar_use_facet(&base->loc));
6676 /* ?_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 */
6677 /* ?_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 */
6678 static ostreambuf_iterator_wchar* num_put_short__Iput(const num_put *this, ostreambuf_iterator_wchar *ret,
6679 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, char *buf, MSVCP_size_t count)
6681 return num_put__Iput(this, ret, dest, base, fill, buf, count, numpunct_short_use_facet(&base->loc));
6684 /* ?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 */
6685 /* ?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 */
6686 #define call_num_put_wchar_do_put_long(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 28, ostreambuf_iterator_wchar*, \
6687 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, LONG), \
6688 (this, ret, dest, base, fill, v))
6689 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_long, 28)
6690 ostreambuf_iterator_wchar* __thiscall num_put_wchar_do_put_long(const num_put *this, ostreambuf_iterator_wchar *ret,
6691 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, LONG v)
6693 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
6694 char fmt[7]; /* strlen("%+#lld")+1 */
6696 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
6698 return num_put_wchar__Iput(this, ret, dest, base, fill, tmp,
6699 sprintf(tmp, num_put_wchar__Ifmt(this, fmt, "ld", base->fmtfl), v));
6702 /* ?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 */
6703 /* ?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 */
6704 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_long, 28)
6705 ostreambuf_iterator_wchar* __thiscall num_put_short_do_put_long(const num_put *this, ostreambuf_iterator_wchar *ret,
6706 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, LONG v)
6708 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
6709 char fmt[7]; /* strlen("%+#lld")+1 */
6711 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
6713 return num_put_short__Iput(this, ret, dest, base, fill, tmp,
6714 sprintf(tmp, num_put_wchar__Ifmt(this, fmt, "ld", base->fmtfl), v));
6717 /* ?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 */
6718 /* ?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 */
6719 /* ?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 */
6720 /* ?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 */
6721 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_long, 28)
6722 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_long(const num_put *this, ostreambuf_iterator_wchar *ret,
6723 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, LONG v)
6725 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
6726 return call_num_put_wchar_do_put_long(this, ret, dest, base, fill, v);
6729 /* ?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 */
6730 /* ?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 */
6731 #define call_num_put_wchar_do_put_ulong(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 24, ostreambuf_iterator_wchar*, \
6732 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, ULONG), \
6733 (this, ret, dest, base, fill, v))
6734 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_ulong, 28)
6735 ostreambuf_iterator_wchar* __thiscall num_put_wchar_do_put_ulong(const num_put *this, ostreambuf_iterator_wchar *ret,
6736 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, ULONG v)
6738 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
6739 char fmt[7]; /* strlen("%+#lld")+1 */
6741 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
6743 return num_put_wchar__Iput(this, ret, dest, base, fill, tmp,
6744 sprintf(tmp, num_put_wchar__Ifmt(this, fmt, "lu", base->fmtfl), v));
6747 /* ?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 */
6748 /* ?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 */
6749 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_ulong, 28)
6750 ostreambuf_iterator_wchar* __thiscall num_put_short_do_put_ulong(const num_put *this, ostreambuf_iterator_wchar *ret,
6751 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, ULONG v)
6753 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
6754 char fmt[7]; /* strlen("%+#lld")+1 */
6756 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
6758 return num_put_short__Iput(this, ret, dest, base, fill, tmp,
6759 sprintf(tmp, num_put_wchar__Ifmt(this, fmt, "lu", base->fmtfl), v));
6762 /* ?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 */
6763 /* ?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 */
6764 /* ?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 */
6765 /* ?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 */
6766 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_ulong, 28)
6767 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_ulong(const num_put *this, ostreambuf_iterator_wchar *ret,
6768 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, ULONG v)
6770 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
6771 return call_num_put_wchar_do_put_ulong(this, ret, dest, base, fill, v);
6774 /* ?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 */
6775 /* ?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 */
6776 /* ?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 */
6777 /* ?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 */
6778 #define call_num_put_wchar_do_put_double(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 12, ostreambuf_iterator_wchar*, \
6779 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, double), \
6780 (this, ret, dest, base, fill, v))
6781 #define call_num_put_wchar_do_put_ldouble(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 8, ostreambuf_iterator_wchar*, \
6782 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, double), \
6783 (this, ret, dest, base, fill, v))
6784 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_double, 32)
6785 ostreambuf_iterator_wchar* __thiscall num_put_wchar_do_put_double(const num_put *this, ostreambuf_iterator_wchar *ret,
6786 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, double v)
6788 char *tmp;
6789 char fmt[8]; /* strlen("%+#.*lg")+1 */
6790 int size;
6792 TRACE("(%p %p %p %d %lf)\n", this, ret, base, fill, v);
6794 num_put_wchar__Ffmt(this, fmt, '\0', base->fmtfl);
6795 size = _scprintf(fmt, base->prec, v);
6797 /* TODO: don't use dynamic allocation */
6798 tmp = MSVCRT_operator_new(size*2);
6799 if(!tmp) {
6800 ERR("Out of memory\n");
6801 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
6803 num_put__fput(this, ret, dest, base, fill, tmp, sprintf(tmp, fmt, base->prec, v),
6804 numpunct_wchar_use_facet(&base->loc));
6805 MSVCRT_operator_delete(tmp);
6806 return ret;
6809 /* ?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 */
6810 /* ?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 */
6811 /* ?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 */
6812 /* ?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 */
6813 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_double, 32)
6814 ostreambuf_iterator_wchar* __thiscall num_put_short_do_put_double(const num_put *this, ostreambuf_iterator_wchar *ret,
6815 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, double v)
6817 char *tmp;
6818 char fmt[8]; /* strlen("%+#.*lg")+1 */
6819 int size;
6820 streamsize prec;
6822 TRACE("(%p %p %p %d %lf)\n", this, ret, base, fill, v);
6824 num_put_wchar__Ffmt(this, fmt, '\0', base->fmtfl);
6825 prec = get_precision(base);
6826 size = _scprintf(fmt, prec, v);
6828 /* TODO: don't use dynamic allocation */
6829 tmp = MSVCRT_operator_new(size*2);
6830 if(!tmp) {
6831 ERR("Out of memory\n");
6832 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
6834 num_put__fput(this, ret, dest, base, fill, tmp, sprintf(tmp, fmt, prec, v),
6835 numpunct_short_use_facet(&base->loc));
6836 MSVCRT_operator_delete(tmp);
6837 return ret;
6840 /* ?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 */
6841 /* ?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 */
6842 /* ?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 */
6843 /* ?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 */
6844 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_double, 32)
6845 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_double(const num_put *this, ostreambuf_iterator_wchar *ret,
6846 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, double v)
6848 TRACE("(%p %p %p %d %lf)\n", this, ret, base, fill, v);
6849 return call_num_put_wchar_do_put_double(this, ret, dest, base, fill, v);
6852 /* ?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 */
6853 /* ?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 */
6854 /* ?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 */
6855 /* ?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 */
6856 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_ldouble, 32)
6857 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_ldouble(const num_put *this, ostreambuf_iterator_wchar *ret,
6858 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, double v)
6860 TRACE("(%p %p %p %d %lf)\n", this, ret, base, fill, v);
6861 return call_num_put_wchar_do_put_ldouble(this, ret, dest, base, fill, v);
6864 /* ?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 */
6865 /* ?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 */
6866 #define call_num_put_wchar_do_put_ptr(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 4, ostreambuf_iterator_wchar*, \
6867 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, const void*), \
6868 (this, ret, dest, base, fill, v))
6869 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_ptr, 28)
6870 ostreambuf_iterator_wchar* __thiscall num_put_wchar_do_put_ptr(const num_put *this, ostreambuf_iterator_wchar *ret,
6871 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, const void *v)
6873 char tmp[17]; /* 8(16^8==2^64)*2(separators beetwen every digit) + 1 */
6875 TRACE("(%p %p %p %d %p)\n", this, ret, base, fill, v);
6877 return num_put_wchar__Iput(this, ret, dest, base, fill, tmp, sprintf(tmp, "%p", v));
6880 /* ?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 */
6881 /* ?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 */
6882 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_ptr, 28)
6883 ostreambuf_iterator_wchar* __thiscall num_put_short_do_put_ptr(const num_put *this, ostreambuf_iterator_wchar *ret,
6884 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, const void *v)
6886 char tmp[17]; /* 8(16^8==2^64)*2(separators beetwen every digit) + 1 */
6888 TRACE("(%p %p %p %d %p)\n", this, ret, base, fill, v);
6890 return num_put_short__Iput(this, ret, dest, base, fill, tmp, sprintf(tmp, "%p", v));
6893 /* ?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 */
6894 /* ?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 */
6895 /* ?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 */
6896 /* ?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 */
6897 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_ptr, 28)
6898 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_ptr(const num_put *this, ostreambuf_iterator_wchar *ret,
6899 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, const void *v)
6901 TRACE("(%p %p %p %d %p)\n", this, ret, base, fill, v);
6902 return call_num_put_wchar_do_put_ptr(this, ret, dest, base, fill, v);
6905 /* ?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 */
6906 /* ?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 */
6907 #define call_num_put_wchar_do_put_int64(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 20, ostreambuf_iterator_wchar*, \
6908 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, __int64), \
6909 (this, ret, dest, base, fill, v))
6910 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_int64, 32)
6911 ostreambuf_iterator_wchar* __thiscall num_put_wchar_do_put_int64(const num_put *this, ostreambuf_iterator_wchar *ret,
6912 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, __int64 v)
6914 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
6915 char fmt[7]; /* strlen("%+#lld")+1 */
6917 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
6919 return num_put_wchar__Iput(this, ret, dest, base, fill, tmp,
6920 sprintf(tmp, num_put_wchar__Ifmt(this, fmt, "lld", base->fmtfl), v));
6923 /* ?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 */
6924 /* ?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 */
6925 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_int64, 32)
6926 ostreambuf_iterator_wchar* __thiscall num_put_short_do_put_int64(const num_put *this, ostreambuf_iterator_wchar *ret,
6927 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, __int64 v)
6929 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
6930 char fmt[7]; /* strlen("%+#lld")+1 */
6932 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
6934 return num_put_short__Iput(this, ret, dest, base, fill, tmp,
6935 sprintf(tmp, num_put_wchar__Ifmt(this, fmt, "lld", base->fmtfl), v));
6938 /* ?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 */
6939 /* ?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 */
6940 /* ?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 */
6941 /* ?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 */
6942 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_int64, 32)
6943 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_int64(const num_put *this, ostreambuf_iterator_wchar *ret,
6944 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, __int64 v)
6946 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
6947 return call_num_put_wchar_do_put_int64(this, ret, dest, base, fill, v);
6950 /* ?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 */
6951 /* ?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 */
6952 #define call_num_put_wchar_do_put_uint64(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 16, ostreambuf_iterator_wchar*, \
6953 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, unsigned __int64), \
6954 (this, ret, dest, base, fill, v))
6955 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_uint64, 32)
6956 ostreambuf_iterator_wchar* __thiscall num_put_wchar_do_put_uint64(const num_put *this, ostreambuf_iterator_wchar *ret,
6957 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, unsigned __int64 v)
6959 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
6960 char fmt[7]; /* strlen("%+#lld")+1 */
6962 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
6964 return num_put_wchar__Iput(this, ret, dest, base, fill, tmp,
6965 sprintf(tmp, num_put_wchar__Ifmt(this, fmt, "llu", base->fmtfl), v));
6968 /* ?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 */
6969 /* ?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 */
6970 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_uint64, 32)
6971 ostreambuf_iterator_wchar* __thiscall num_put_short_do_put_uint64(const num_put *this, ostreambuf_iterator_wchar *ret,
6972 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, unsigned __int64 v)
6974 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
6975 char fmt[7]; /* strlen("%+#lld")+1 */
6977 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
6979 return num_put_short__Iput(this, ret, dest, base, fill, tmp,
6980 sprintf(tmp, num_put_wchar__Ifmt(this, fmt, "llu", base->fmtfl), v));
6983 /* ?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 */
6984 /* ?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 */
6985 /* ?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 */
6986 /* ?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 */
6987 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_uint64, 32)
6988 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_uint64(const num_put *this, ostreambuf_iterator_wchar *ret,
6989 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, unsigned __int64 v)
6991 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
6992 return call_num_put_wchar_do_put_uint64(this, ret, dest, base, fill, v);
6995 /* ?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 */
6996 /* ?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 */
6997 #define call_num_put_wchar_do_put_bool(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 32, ostreambuf_iterator_wchar*, \
6998 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, MSVCP_bool), \
6999 (this, ret, dest, base, fill, v))
7000 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_bool, 28)
7001 ostreambuf_iterator_wchar* __thiscall num_put_wchar_do_put_bool(const num_put *this, ostreambuf_iterator_wchar *ret,
7002 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, MSVCP_bool v)
7004 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
7006 if(base->fmtfl & FMTFLAG_boolalpha) {
7007 numpunct_wchar *numpunct = numpunct_wchar_use_facet(&base->loc);
7008 basic_string_wchar str;
7009 MSVCP_size_t pad, len;
7011 if(v)
7012 numpunct_wchar_truename(numpunct, &str);
7013 else
7014 numpunct_wchar_falsename(numpunct, &str);
7016 len = basic_string_wchar_length(&str);
7017 pad = (len>base->wide ? 0 : base->wide-len);
7018 base->wide = 0;
7020 if((base->fmtfl & FMTFLAG_adjustfield) != FMTFLAG_left) {
7021 num_put_wchar__Rep(this, &dest, dest, fill, pad);
7022 pad = 0;
7024 num_put_wchar__Put(this, &dest, dest, basic_string_wchar_c_str(&str), len);
7025 basic_string_wchar_dtor(&str);
7026 return num_put_wchar__Rep(this, ret, dest, fill, pad);
7029 return num_put_wchar_put_long(this, ret, dest, base, fill, v);
7032 /* ?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 */
7033 /* ?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 */
7034 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_bool, 28)
7035 ostreambuf_iterator_wchar* __thiscall num_put_short_do_put_bool(const num_put *this, ostreambuf_iterator_wchar *ret,
7036 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, MSVCP_bool v)
7038 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
7040 if(base->fmtfl & FMTFLAG_boolalpha) {
7041 numpunct_wchar *numpunct = numpunct_short_use_facet(&base->loc);
7042 basic_string_wchar str;
7043 MSVCP_size_t pad, len;
7045 if(v)
7046 numpunct_wchar_truename(numpunct, &str);
7047 else
7048 numpunct_wchar_falsename(numpunct, &str);
7050 len = basic_string_wchar_length(&str);
7051 pad = (len>base->wide ? 0 : base->wide-len);
7052 base->wide = 0;
7054 if((base->fmtfl & FMTFLAG_adjustfield) != FMTFLAG_left) {
7055 num_put_wchar__Rep(this, &dest, dest, fill, pad);
7056 pad = 0;
7058 num_put_wchar__Put(this, &dest, dest, basic_string_wchar_c_str(&str), len);
7059 basic_string_wchar_dtor(&str);
7060 return num_put_wchar__Rep(this, ret, dest, fill, pad);
7063 return num_put_wchar_put_long(this, ret, dest, base, fill, v);
7066 /* ?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 */
7067 /* ?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 */
7068 /* ?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 */
7069 /* ?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 */
7070 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_bool, 28)
7071 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_bool(const num_put *this, ostreambuf_iterator_wchar *ret,
7072 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, MSVCP_bool v)
7074 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
7075 return call_num_put_wchar_do_put_bool(this, ret, dest, base, fill, v);
7078 /* ?id@?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@2V0locale@2@A */
7079 locale_id time_put_char_id = {0};
7081 /* ??_7?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@6B@ */
7082 extern const vtable_ptr MSVCP_time_put_char_vtable;
7084 /* ?_Init@?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@IAEXABV_Locinfo@2@@Z */
7085 /* ?_Init@?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@IEAAXAEBV_Locinfo@2@@Z */
7086 DEFINE_THISCALL_WRAPPER(time_put_char__Init, 8)
7087 void __thiscall time_put_char__Init(time_put *this, const _Locinfo *locinfo)
7089 TRACE("(%p %p)\n", this, locinfo);
7090 _Locinfo__Gettnames(locinfo, &this->time);
7091 _Locinfo__Getcvt(locinfo, &this->cvt);
7094 /* ??0?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
7095 /* ??0?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
7096 DEFINE_THISCALL_WRAPPER(time_put_char_ctor_locinfo, 12)
7097 time_put* __thiscall time_put_char_ctor_locinfo(time_put *this, const _Locinfo *locinfo, MSVCP_size_t refs)
7099 TRACE("(%p %p %lu)\n", this, locinfo, refs);
7100 locale_facet_ctor_refs(&this->facet, refs);
7101 this->facet.vtable = &MSVCP_time_put_char_vtable;
7102 time_put_char__Init(this, locinfo);
7103 return this;
7106 /* ??0?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAE@I@Z */
7107 /* ??0?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAA@_K@Z */
7108 DEFINE_THISCALL_WRAPPER(time_put_char_ctor_refs, 8)
7109 time_put* __thiscall time_put_char_ctor_refs(time_put *this, MSVCP_size_t refs)
7111 _Locinfo locinfo;
7113 TRACE("(%p %lu)\n", this, refs);
7115 _Locinfo_ctor(&locinfo);
7116 time_put_char_ctor_locinfo(this, &locinfo, refs);
7117 _Locinfo_dtor(&locinfo);
7118 return this;
7121 /* ??_F?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAEXXZ */
7122 /* ??_F?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAAXXZ */
7123 DEFINE_THISCALL_WRAPPER(time_put_char_ctor, 4)
7124 time_put* __thiscall time_put_char_ctor(time_put *this)
7126 return time_put_char_ctor_refs(this, 0);
7129 /* ??1?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MAE@XZ */
7130 /* ??1?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MEAA@XZ */
7131 DEFINE_THISCALL_WRAPPER(time_put_char_dtor, 4)
7132 void __thiscall time_put_char_dtor(time_put *this)
7134 TRACE("(%p)\n", this);
7135 _Timevec_dtor(&this->time);
7138 DEFINE_THISCALL_WRAPPER(time_put_char_vector_dtor, 8)
7139 time_put* __thiscall time_put_char_vector_dtor(time_put *this, unsigned int flags)
7141 TRACE("(%p %x)\n", this, flags);
7142 if(flags & 2) {
7143 /* we have an array, with the number of elements stored before the first object */
7144 INT_PTR i, *ptr = (INT_PTR *)this-1;
7146 for(i=*ptr-1; i>=0; i--)
7147 time_put_char_dtor(this+i);
7148 MSVCRT_operator_delete(ptr);
7149 } else {
7150 time_put_char_dtor(this);
7151 if(flags & 1)
7152 MSVCRT_operator_delete(this);
7155 return this;
7158 /* ?_Getcat@?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
7159 /* ?_Getcat@?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
7160 static MSVCP_size_t time_put_char__Getcat(const locale_facet **facet, const locale *loc)
7162 TRACE("(%p %p)\n", facet, loc);
7164 if(facet && !*facet) {
7165 _Locinfo locinfo;
7167 *facet = MSVCRT_operator_new(sizeof(time_put));
7168 if(!*facet) {
7169 ERR("Out of memory\n");
7170 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7171 return 0;
7174 _Locinfo_ctor_cstr(&locinfo, basic_string_char_c_str(&loc->ptr->name));
7175 time_put_char_ctor_locinfo((time_put*)*facet, &locinfo, 0);
7176 _Locinfo_dtor(&locinfo);
7179 return LC_TIME;
7182 static time_put* time_put_char_use_facet(const locale *loc)
7184 static time_put *obj = NULL;
7186 _Lockit lock;
7187 const locale_facet *fac;
7189 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
7190 fac = locale__Getfacet(loc, locale_id_operator_size_t(&time_put_char_id), TRUE);
7191 if(fac) {
7192 _Lockit_dtor(&lock);
7193 return (time_put*)fac;
7196 if(obj) {
7197 _Lockit_dtor(&lock);
7198 return obj;
7201 time_put_char__Getcat(&fac, loc);
7202 obj = (time_put*)fac;
7203 locale_facet__Incref(&obj->facet);
7204 locale_facet_register(&obj->facet);
7205 _Lockit_dtor(&lock);
7207 return obj;
7210 /* ?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 */
7211 /* ?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 */
7212 DEFINE_THISCALL_WRAPPER(time_put_char_do_put, 32)
7213 #define call_time_put_char_do_put(this, ret, dest, base, t, spec, mod) CALL_VTBL_FUNC(this, 4, ostreambuf_iterator_char*, \
7214 (const time_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, const struct tm*, char, char), \
7215 (this, ret, dest, base, t, spec, mod))
7216 ostreambuf_iterator_char* __thiscall time_put_char_do_put(const time_put *this, ostreambuf_iterator_char *ret,
7217 ostreambuf_iterator_char dest, ios_base *base, const struct tm *t, char spec, char mod)
7219 char buf[64], fmt[4], *p = fmt;
7220 MSVCP_size_t i, len;
7222 TRACE("(%p %p %p %p %c %c)\n", this, ret, base, t, spec, mod);
7224 *p++ = '%';
7225 if(mod)
7226 *p++ = mod;
7227 *p++ = spec;
7228 *p++ = 0;
7230 len = _Strftime(buf, sizeof(buf), fmt, t, this->time.timeptr);
7231 for(i=0; i<len; i++)
7232 ostreambuf_iterator_char_put(&dest, buf[i]);
7234 *ret = dest;
7235 return ret;
7238 /* ?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 */
7239 /* ?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 */
7240 DEFINE_THISCALL_WRAPPER(time_put_char_put, 32)
7241 ostreambuf_iterator_char* __thiscall time_put_char_put(const time_put *this, ostreambuf_iterator_char *ret,
7242 ostreambuf_iterator_char dest, ios_base *base, const struct tm *t, char spec, char mod)
7244 TRACE("(%p %p %p %p %c %c)\n", this, ret, base, t, spec, mod);
7245 return call_time_put_char_do_put(this, ret, dest, base, t, spec, mod);
7248 /* ?put@?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QBE?AV?$ostreambuf_iterator@DU?$char_traits@D@std@@@2@V32@AAVios_base@2@DPBUtm@@PBD3@Z */
7249 /* ?put@?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEBA?AV?$ostreambuf_iterator@DU?$char_traits@D@std@@@2@V32@AEAVios_base@2@DPEBUtm@@PEBD3@Z */
7250 DEFINE_THISCALL_WRAPPER(time_put_char_put_format, 32)
7251 ostreambuf_iterator_char* __thiscall time_put_char_put_format(const time_put *this, ostreambuf_iterator_char *ret,
7252 ostreambuf_iterator_char dest, ios_base *base, const struct tm *t, const char *pat, const char *pat_end)
7254 TRACE("(%p %p %p %p %s)\n", this, ret, base, t, debugstr_an(pat, pat_end-pat));
7256 while(pat < pat_end) {
7257 if(*pat != '%') {
7258 ostreambuf_iterator_char_put(&dest, *pat++);
7259 }else if(++pat == pat_end) {
7260 ostreambuf_iterator_char_put(&dest, '%');
7261 }else if(*pat=='#' && pat+1==pat_end) {
7262 ostreambuf_iterator_char_put(&dest, '%');
7263 ostreambuf_iterator_char_put(&dest, *pat++);
7264 }else {
7265 char mod;
7267 if(*pat == '#') {
7268 mod = '#';
7269 pat++;
7270 }else {
7271 mod = 0;
7274 time_put_char_put(this, &dest, dest, base, t, *pat++, mod);
7278 *ret = dest;
7279 return ret;
7282 /* ?id@?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@2V0locale@2@A */
7283 static locale_id time_put_wchar_id = {0};
7284 /* ?id@?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@2V0locale@2@A */
7285 locale_id time_put_short_id = {0};
7287 /* ??_7?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@6B@ */
7288 extern const vtable_ptr MSVCP_time_put_wchar_vtable;
7289 /* ??_7?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@6B@ */
7290 extern const vtable_ptr MSVCP_time_put_short_vtable;
7292 /* ?_Init@?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@IAEXABV_Locinfo@2@@Z */
7293 /* ?_Init@?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@IEAAXAEBV_Locinfo@2@@Z */
7294 /* ?_Init@?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@IAEXABV_Locinfo@2@@Z */
7295 /* ?_Init@?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@IEAAXAEBV_Locinfo@2@@Z */
7296 DEFINE_THISCALL_WRAPPER(time_put_wchar__Init, 8)
7297 void __thiscall time_put_wchar__Init(time_put *this, const _Locinfo *locinfo)
7299 TRACE("(%p %p)\n", this, locinfo);
7300 _Locinfo__Gettnames(locinfo, &this->time);
7301 _Locinfo__Getcvt(locinfo, &this->cvt);
7304 /* ??0?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
7305 /* ??0?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
7306 static time_put* time_put_wchar_ctor_locinfo(time_put *this, const _Locinfo *locinfo, MSVCP_size_t refs)
7308 TRACE("(%p %p %lu)\n", this, locinfo, refs);
7309 locale_facet_ctor_refs(&this->facet, refs);
7310 this->facet.vtable = &MSVCP_time_put_wchar_vtable;
7311 time_put_wchar__Init(this, locinfo);
7312 return this;
7315 /* ??0?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
7316 /* ??0?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
7317 DEFINE_THISCALL_WRAPPER(time_put_short_ctor_locinfo, 12)
7318 time_put* __thiscall time_put_short_ctor_locinfo(time_put *this, const _Locinfo *locinfo, MSVCP_size_t refs)
7320 time_put_wchar_ctor_locinfo(this, locinfo, refs);
7321 this->facet.vtable = &MSVCP_time_put_short_vtable;
7322 return this;
7325 /* ??0?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@IAE@PBDI@Z */
7326 /* ??0?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@IEAA@PEBD_K@Z */
7327 static time_put* time_put_wchar_ctor_name(time_put *this, const char *name, MSVCP_size_t refs)
7329 _Locinfo locinfo;
7331 TRACE("(%p %s %lu)\n", this, debugstr_a(name), refs);
7333 _Locinfo_ctor_cstr(&locinfo, name);
7334 time_put_wchar_ctor_locinfo(this, &locinfo, refs);
7335 _Locinfo_dtor(&locinfo);
7336 return this;
7339 /* ??0?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@IAE@PBDI@Z */
7340 /* ??0?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@IEAA@PEBD_K@Z */
7341 static time_put* time_put_short_ctor_name(time_put *this, const char *name, MSVCP_size_t refs)
7343 time_put_wchar_ctor_name(this, name, refs);
7344 this->facet.vtable = &MSVCP_time_put_short_vtable;
7345 return this;
7348 /* ??0?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAE@I@Z */
7349 /* ??0?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAA@_K@Z */
7350 static time_put* time_put_wchar_ctor_refs(time_put *this, MSVCP_size_t refs)
7352 _Locinfo locinfo;
7354 TRACE("(%p %lu)\n", this, refs);
7356 _Locinfo_ctor(&locinfo);
7357 time_put_wchar_ctor_locinfo(this, &locinfo, refs);
7358 _Locinfo_dtor(&locinfo);
7359 return this;
7362 /* ??0?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAE@I@Z */
7363 /* ??0?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEAA@_K@Z */
7364 DEFINE_THISCALL_WRAPPER(time_put_short_ctor_refs, 8)
7365 time_put* __thiscall time_put_short_ctor_refs(time_put *this, MSVCP_size_t refs)
7367 time_put_wchar_ctor_refs(this, refs);
7368 this->facet.vtable = &MSVCP_time_put_short_vtable;
7369 return this;
7372 /* ??_F?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAEXXZ */
7373 /* ??_F?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAAXXZ */
7374 static time_put* time_put_wchar_ctor(time_put *this)
7376 return time_put_wchar_ctor_refs(this, 0);
7379 /* ??_F?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAEXXZ */
7380 /* ??_F?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEAAXXZ */
7381 DEFINE_THISCALL_WRAPPER(time_put_short_ctor, 4)
7382 time_put* __thiscall time_put_short_ctor(time_put *this)
7384 time_put_wchar_ctor(this);
7385 this->facet.vtable = &MSVCP_time_put_short_vtable;
7386 return this;
7389 /* ??1?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MAE@XZ */
7390 /* ??1?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MEAA@XZ */
7391 /* ??1?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MAE@XZ */
7392 /* ??1?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MEAA@XZ */
7393 DEFINE_THISCALL_WRAPPER(time_put_wchar_dtor, 4)
7394 void __thiscall time_put_wchar_dtor(time_put *this)
7396 TRACE("(%p)\n", this);
7397 _Timevec_dtor(&this->time);
7400 DEFINE_THISCALL_WRAPPER(time_put_wchar_vector_dtor, 8)
7401 time_put* __thiscall time_put_wchar_vector_dtor(time_put *this, unsigned int flags)
7403 TRACE("(%p %x)\n", this, flags);
7404 if(flags & 2) {
7405 /* we have an array, with the number of elements stored before the first object */
7406 INT_PTR i, *ptr = (INT_PTR *)this-1;
7408 for(i=*ptr-1; i>=0; i--)
7409 time_put_wchar_dtor(this+i);
7410 MSVCRT_operator_delete(ptr);
7411 } else {
7412 time_put_wchar_dtor(this);
7413 if(flags & 1)
7414 MSVCRT_operator_delete(this);
7417 return this;
7420 /* ?_Getcat@?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
7421 /* ?_Getcat@?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
7422 static MSVCP_size_t time_put_wchar__Getcat(const locale_facet **facet, const locale *loc)
7424 TRACE("(%p %p)\n", facet, loc);
7426 if(facet && !*facet) {
7427 *facet = MSVCRT_operator_new(sizeof(time_put));
7428 if(!*facet) {
7429 ERR("Out of memory\n");
7430 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7431 return 0;
7433 time_put_wchar_ctor_name((time_put*)*facet,
7434 basic_string_char_c_str(&loc->ptr->name), 0);
7437 return LC_TIME;
7440 static time_put* time_put_wchar_use_facet(const locale *loc)
7442 static time_put *obj = NULL;
7444 _Lockit lock;
7445 const locale_facet *fac;
7447 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
7448 fac = locale__Getfacet(loc, locale_id_operator_size_t(&time_put_wchar_id), TRUE);
7449 if(fac) {
7450 _Lockit_dtor(&lock);
7451 return (time_put*)fac;
7454 if(obj) {
7455 _Lockit_dtor(&lock);
7456 return obj;
7459 time_put_wchar__Getcat(&fac, loc);
7460 obj = (time_put*)fac;
7461 locale_facet__Incref(&obj->facet);
7462 locale_facet_register(&obj->facet);
7463 _Lockit_dtor(&lock);
7465 return obj;
7468 /* ?_Getcat@?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
7469 /* ?_Getcat@?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
7470 static MSVCP_size_t time_put_short__Getcat(const locale_facet **facet, const locale *loc)
7472 TRACE("(%p %p)\n", facet, loc);
7474 if(facet && !*facet) {
7475 *facet = MSVCRT_operator_new(sizeof(time_put));
7476 if(!*facet) {
7477 ERR("Out of memory\n");
7478 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7479 return 0;
7481 time_put_short_ctor_name((time_put*)*facet,
7482 basic_string_char_c_str(&loc->ptr->name), 0);
7485 return LC_TIME;
7488 static time_put* time_put_short_use_facet(const locale *loc)
7490 static time_put *obj = NULL;
7492 _Lockit lock;
7493 const locale_facet *fac;
7495 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
7496 fac = locale__Getfacet(loc, locale_id_operator_size_t(&time_put_short_id), TRUE);
7497 if(fac) {
7498 _Lockit_dtor(&lock);
7499 return (time_put*)fac;
7502 if(obj) {
7503 _Lockit_dtor(&lock);
7504 return obj;
7507 time_put_short__Getcat(&fac, loc);
7508 obj = (time_put*)fac;
7509 locale_facet__Incref(&obj->facet);
7510 locale_facet_register(&obj->facet);
7511 _Lockit_dtor(&lock);
7513 return obj;
7516 /* ?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 */
7517 /* ?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 */
7518 /* ?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 */
7519 /* ?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 */
7520 DEFINE_THISCALL_WRAPPER(time_put_wchar_do_put, 32)
7521 #define call_time_put_wchar_do_put(this, ret, dest, base, t, spec, mod) CALL_VTBL_FUNC(this, 4, ostreambuf_iterator_wchar*, \
7522 (const time_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, const struct tm*, char, char), \
7523 (this, ret, dest, base, t, spec, mod))
7524 ostreambuf_iterator_wchar* __thiscall time_put_wchar_do_put(const time_put *this,
7525 ostreambuf_iterator_wchar *ret, ostreambuf_iterator_wchar dest, ios_base *base,
7526 const struct tm *t, char spec, char mod)
7528 char buf[64], fmt[4], *p = fmt;
7529 MSVCP_size_t i, len;
7530 wchar_t c;
7532 TRACE("(%p %p %p %p %c %c)\n", this, ret, base, t, spec, mod);
7534 *p++ = '%';
7535 if(mod)
7536 *p++ = mod;
7537 *p++ = spec;
7538 *p++ = 0;
7540 len = _Strftime(buf, sizeof(buf), fmt, t, this->time.timeptr);
7541 for(i=0; i<len; i++) {
7542 c = mb_to_wc(buf[i], &this->cvt);
7543 ostreambuf_iterator_wchar_put(&dest, c);
7546 *ret = dest;
7547 return ret;
7550 /* ?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 */
7551 /* ?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 */
7552 /* ?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 */
7553 /* ?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 */
7554 DEFINE_THISCALL_WRAPPER(time_put_wchar_put, 32)
7555 ostreambuf_iterator_wchar* __thiscall time_put_wchar_put(const time_put *this,
7556 ostreambuf_iterator_wchar *ret, ostreambuf_iterator_wchar dest, ios_base *base,
7557 const struct tm *t, char spec, char mod)
7559 TRACE("(%p %p %p %p %c %c)\n", this, ret, base, t, spec, mod);
7560 return call_time_put_wchar_do_put(this, ret, dest, base, t, spec, mod);
7563 /* ?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 */
7564 /* ?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 */
7565 /* ?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 */
7566 /* ?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 */
7567 DEFINE_THISCALL_WRAPPER(time_put_wchar_put_format, 32)
7568 ostreambuf_iterator_wchar* __thiscall time_put_wchar_put_format(const time_put *this,
7569 ostreambuf_iterator_wchar *ret, ostreambuf_iterator_wchar dest, ios_base *base,
7570 const struct tm *t, const wchar_t *pat, const wchar_t *pat_end)
7572 wchar_t percent = mb_to_wc('%', &this->cvt);
7573 char c[MB_LEN_MAX];
7575 TRACE("(%p %p %p %p %s)\n", this, ret, base, t, debugstr_wn(pat, pat_end-pat));
7577 while(pat < pat_end) {
7578 if(*pat != percent) {
7579 ostreambuf_iterator_wchar_put(&dest, *pat++);
7580 }else if(++pat == pat_end) {
7581 ostreambuf_iterator_wchar_put(&dest, percent);
7582 }else if(!_Wcrtomb(c, *pat, NULL, &this->cvt) || (*c=='#' && pat+1==pat_end)) {
7583 ostreambuf_iterator_wchar_put(&dest, percent);
7584 ostreambuf_iterator_wchar_put(&dest, *pat++);
7585 }else {
7586 if(*c == '#') {
7587 if(!_Wcrtomb(c, *pat++, NULL, &this->cvt)) {
7588 ostreambuf_iterator_wchar_put(&dest, percent);
7589 ostreambuf_iterator_wchar_put(&dest, *(pat-1));
7590 ostreambuf_iterator_wchar_put(&dest, *pat);
7591 }else {
7592 time_put_wchar_put(this, &dest, dest, base, t, *c, '#');
7594 }else {
7595 time_put_wchar_put(this, &dest, dest, base, t, *c, 0);
7600 *ret = dest;
7601 return ret;
7604 /* ??0_Locimp@locale@std@@AAE@_N@Z */
7605 /* ??0_Locimp@locale@std@@AEAA@_N@Z */
7606 static locale__Locimp* locale__Locimp_ctor_transparent(locale__Locimp *this, MSVCP_bool transparent)
7608 TRACE("(%p %d)\n", this, transparent);
7610 memset(this, 0, sizeof(locale__Locimp));
7611 locale_facet_ctor_refs(&this->facet, 1);
7612 this->transparent = transparent;
7613 basic_string_char_ctor_cstr(&this->name, "*");
7614 return this;
7617 /* ??_F_Locimp@locale@std@@QAEXXZ */
7618 /* ??_F_Locimp@locale@std@@QEAAXXZ */
7619 static locale__Locimp* locale__Locimp_ctor(locale__Locimp *this)
7621 return locale__Locimp_ctor_transparent(this, FALSE);
7624 /* ??0_Locimp@locale@std@@AAE@ABV012@@Z */
7625 /* ??0_Locimp@locale@std@@AEAA@AEBV012@@Z */
7626 static locale__Locimp* locale__Locimp_copy_ctor(locale__Locimp *this, const locale__Locimp *copy)
7628 _Lockit lock;
7629 MSVCP_size_t i;
7631 TRACE("(%p %p)\n", this, copy);
7633 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
7634 memcpy(this, copy, sizeof(locale__Locimp));
7635 locale_facet_ctor_refs(&this->facet, 1);
7636 if(copy->facetvec) {
7637 this->facetvec = MSVCRT_operator_new(copy->facet_cnt*sizeof(locale_facet*));
7638 if(!this->facetvec) {
7639 _Lockit_dtor(&lock);
7640 ERR("Out of memory\n");
7641 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7642 return NULL;
7644 for(i=0; i<this->facet_cnt; i++)
7646 this->facetvec[i] = copy->facetvec[i];
7647 if(this->facetvec[i])
7648 locale_facet__Incref(this->facetvec[i]);
7651 basic_string_char_copy_ctor(&this->name, &copy->name);
7652 _Lockit_dtor(&lock);
7653 return this;
7656 /* ??1_Locimp@locale@std@@MAE@XZ */
7657 /* ??1_Locimp@locale@std@@MEAA@XZ */
7658 static void locale__Locimp_dtor(locale__Locimp *this)
7660 MSVCP_size_t i;
7662 TRACE("(%p)\n", this);
7664 locale_facet_dtor(&this->facet);
7665 for(i=0; i<this->facet_cnt; i++)
7666 if(this->facetvec[i] && locale_facet__Decref(this->facetvec[i]))
7667 call_locale_facet_vector_dtor(this->facetvec[i], 1);
7669 MSVCRT_operator_delete(this->facetvec);
7670 basic_string_char_dtor(&this->name);
7673 DEFINE_THISCALL_WRAPPER(locale__Locimp_vector_dtor, 8)
7674 locale__Locimp* __thiscall locale__Locimp_vector_dtor(locale__Locimp *this, unsigned int flags)
7676 TRACE("(%p %x)\n", this, flags);
7677 if(flags & 2) {
7678 /* we have an array, with the number of elements stored before the first object */
7679 INT_PTR i, *ptr = (INT_PTR *)this-1;
7681 for(i=*ptr-1; i>=0; i--)
7682 locale__Locimp_dtor(this+i);
7683 MSVCRT_operator_delete(ptr);
7684 } else {
7685 locale__Locimp_dtor(this);
7686 if(flags & 1)
7687 MSVCRT_operator_delete(this);
7690 return this;
7693 /* ?_Locimp_Addfac@_Locimp@locale@std@@CAXPAV123@PAVfacet@23@I@Z */
7694 /* ?_Locimp_Addfac@_Locimp@locale@std@@CAXPEAV123@PEAVfacet@23@_K@Z */
7695 static void locale__Locimp__Locimp_Addfac(locale__Locimp *locimp, locale_facet *facet, MSVCP_size_t id)
7697 _Lockit lock;
7699 TRACE("(%p %p %lu)\n", locimp, facet, id);
7701 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
7702 if(id >= locimp->facet_cnt) {
7703 MSVCP_size_t new_size = id+1;
7704 locale_facet **new_facetvec;
7706 if(new_size < locale_id__Id_cnt+1)
7707 new_size = locale_id__Id_cnt+1;
7709 new_facetvec = MSVCRT_operator_new(sizeof(locale_facet*)*new_size);
7710 if(!new_facetvec) {
7711 _Lockit_dtor(&lock);
7712 ERR("Out of memory\n");
7713 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7714 return;
7717 memset(new_facetvec, 0, sizeof(locale_facet*)*new_size);
7718 memcpy(new_facetvec, locimp->facetvec, sizeof(locale_facet*)*locimp->facet_cnt);
7719 MSVCRT_operator_delete(locimp->facetvec);
7720 locimp->facetvec = new_facetvec;
7721 locimp->facet_cnt = new_size;
7724 if(locimp->facetvec[id] && locale_facet__Decref(locimp->facetvec[id]))
7725 call_locale_facet_vector_dtor(locimp->facetvec[id], 1);
7727 locimp->facetvec[id] = facet;
7728 if(facet)
7729 locale_facet__Incref(facet);
7730 _Lockit_dtor(&lock);
7733 /* ?_Addfac@_Locimp@locale@std@@AAEXPAVfacet@23@I@Z */
7734 /* ?_Addfac@_Locimp@locale@std@@AEAAXPEAVfacet@23@_K@Z */
7735 static void locale__Locimp__Addfac(locale__Locimp *this, locale_facet *facet, MSVCP_size_t id)
7737 locale__Locimp__Locimp_Addfac(this, facet, id);
7740 /* ?_Makeushloc@_Locimp@locale@std@@CAXABV_Locinfo@3@HPAV123@PBV23@@Z */
7741 /* ?_Makeushloc@_Locimp@locale@std@@CAXAEBV_Locinfo@3@HPEAV123@PEBV23@@Z */
7742 /* List of missing facets:
7743 * messages, money_get, money_put, moneypunct, moneypunct, time_get
7745 static void locale__Locimp__Makeushloc(const _Locinfo *locinfo, category cat, locale__Locimp *locimp, const locale *loc)
7747 FIXME("(%p %d %p %p) semi-stub\n", locinfo, cat, locimp, loc);
7749 if(cat & (1<<(ctype_short__Getcat(NULL, NULL)-1))) {
7750 ctype_wchar *ctype;
7752 if(loc) {
7753 ctype = ctype_short_use_facet(loc);
7754 }else {
7755 ctype = MSVCRT_operator_new(sizeof(ctype_wchar));
7756 if(!ctype) {
7757 ERR("Out of memory\n");
7758 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7760 ctype_short_ctor_locinfo(ctype, locinfo, 0);
7762 locale__Locimp__Addfac(locimp, &ctype->base.facet, locale_id_operator_size_t(&ctype_short_id));
7765 if(cat & (1<<(num_get_short__Getcat(NULL, NULL)-1))) {
7766 num_get *numget;
7768 if(loc) {
7769 numget = num_get_short_use_facet(loc);
7770 }else {
7771 numget = MSVCRT_operator_new(sizeof(num_get));
7772 if(!numget) {
7773 ERR("Out of memory\n");
7774 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7776 num_get_short_ctor_locinfo(numget, locinfo, 0);
7778 locale__Locimp__Addfac(locimp, &numget->facet, locale_id_operator_size_t(&num_get_short_id));
7781 if(cat & (1<<(num_put_short__Getcat(NULL, NULL)-1))) {
7782 num_put *numput;
7784 if(loc) {
7785 numput = num_put_short_use_facet(loc);
7786 }else {
7787 numput = MSVCRT_operator_new(sizeof(num_put));
7788 if(!numput) {
7789 ERR("Out of memory\n");
7790 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7792 num_put_short_ctor_locinfo(numput, locinfo, 0);
7794 locale__Locimp__Addfac(locimp, &numput->facet, locale_id_operator_size_t(&num_put_short_id));
7797 if(cat & (1<<(numpunct_short__Getcat(NULL, NULL)-1))) {
7798 numpunct_wchar *numpunct;
7800 if(loc) {
7801 numpunct = numpunct_short_use_facet(loc);
7802 }else {
7803 numpunct = MSVCRT_operator_new(sizeof(numpunct_wchar));
7804 if(!numpunct) {
7805 ERR("Out of memory\n");
7806 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7808 numpunct_short_ctor_locinfo(numpunct, locinfo, 0, FALSE);
7810 locale__Locimp__Addfac(locimp, &numpunct->facet, locale_id_operator_size_t(&numpunct_short_id));
7813 if(cat & (1<<(collate_short__Getcat(NULL, NULL)-1))) {
7814 collate *c;
7816 if(loc) {
7817 c = collate_short_use_facet(loc);
7818 }else {
7819 c = MSVCRT_operator_new(sizeof(collate));
7820 if(!c) {
7821 ERR("Out of memory\n");
7822 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7824 collate_short_ctor_locinfo(c, locinfo, 0);
7826 locale__Locimp__Addfac(locimp, &c->facet, locale_id_operator_size_t(&collate_short_id));
7829 if(cat & (1<<(time_put_short__Getcat(NULL, NULL)-1))) {
7830 time_put *t;
7832 if(loc) {
7833 t = time_put_short_use_facet(loc);
7834 }else {
7835 t = MSVCRT_operator_new(sizeof(time_put));
7836 if(!t) {
7837 ERR("Out of memory\n");
7838 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7840 time_put_short_ctor_locinfo(t, locinfo, 0);
7842 locale__Locimp__Addfac(locimp, &t->facet, locale_id_operator_size_t(&time_put_short_id));
7845 if(cat & (1<<(codecvt_short__Getcat(NULL, NULL)-1))) {
7846 codecvt_wchar *codecvt;
7848 if(loc) {
7849 codecvt = codecvt_short_use_facet(loc);
7850 }else {
7851 codecvt = MSVCRT_operator_new(sizeof(codecvt_wchar));
7852 if(!codecvt) {
7853 ERR("Out of memory\n");
7854 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7856 codecvt_short_ctor_locinfo(codecvt, locinfo, 0);
7858 locale__Locimp__Addfac(locimp, &codecvt->base.facet, locale_id_operator_size_t(&codecvt_short_id));
7862 /* ?_Makewloc@_Locimp@locale@std@@CAXABV_Locinfo@3@HPAV123@PBV23@@Z */
7863 /* ?_Makewloc@_Locimp@locale@std@@CAXAEBV_Locinfo@3@HPEAV123@PEBV23@@Z */
7864 /* List of missing facets:
7865 * messages, money_get, money_put, moneypunct, moneypunct, time_get
7867 static void locale__Locimp__Makewloc(const _Locinfo *locinfo, category cat, locale__Locimp *locimp, const locale *loc)
7869 FIXME("(%p %d %p %p) semi-stub\n", locinfo, cat, locimp, loc);
7871 if(cat & (1<<(ctype_wchar__Getcat(NULL, NULL)-1))) {
7872 ctype_wchar *ctype;
7874 if(loc) {
7875 ctype = ctype_wchar_use_facet(loc);
7876 }else {
7877 ctype = MSVCRT_operator_new(sizeof(ctype_wchar));
7878 if(!ctype) {
7879 ERR("Out of memory\n");
7880 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7882 ctype_wchar_ctor_locinfo(ctype, locinfo, 0);
7884 locale__Locimp__Addfac(locimp, &ctype->base.facet, locale_id_operator_size_t(&ctype_wchar_id));
7887 if(cat & (1<<(num_get_wchar__Getcat(NULL, NULL)-1))) {
7888 num_get *numget;
7890 if(loc) {
7891 numget = num_get_wchar_use_facet(loc);
7892 }else {
7893 numget = MSVCRT_operator_new(sizeof(num_get));
7894 if(!numget) {
7895 ERR("Out of memory\n");
7896 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7898 num_get_wchar_ctor_locinfo(numget, locinfo, 0);
7900 locale__Locimp__Addfac(locimp, &numget->facet, locale_id_operator_size_t(&num_get_wchar_id));
7903 if(cat & (1<<(num_put_wchar__Getcat(NULL, NULL)-1))) {
7904 num_put *numput;
7906 if(loc) {
7907 numput = num_put_wchar_use_facet(loc);
7908 }else {
7909 numput = MSVCRT_operator_new(sizeof(num_put));
7910 if(!numput) {
7911 ERR("Out of memory\n");
7912 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7914 num_put_wchar_ctor_locinfo(numput, locinfo, 0);
7916 locale__Locimp__Addfac(locimp, &numput->facet, locale_id_operator_size_t(&num_put_wchar_id));
7919 if(cat & (1<<(numpunct_wchar__Getcat(NULL, NULL)-1))) {
7920 numpunct_wchar *numpunct;
7922 if(loc) {
7923 numpunct = numpunct_wchar_use_facet(loc);
7924 }else {
7925 numpunct = MSVCRT_operator_new(sizeof(numpunct_wchar));
7926 if(!numpunct) {
7927 ERR("Out of memory\n");
7928 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7930 numpunct_wchar_ctor_locinfo(numpunct, locinfo, 0, FALSE);
7932 locale__Locimp__Addfac(locimp, &numpunct->facet, locale_id_operator_size_t(&numpunct_wchar_id));
7935 if(cat & (1<<(collate_wchar__Getcat(NULL, NULL)-1))) {
7936 collate *c;
7938 if(loc) {
7939 c = collate_wchar_use_facet(loc);
7940 }else {
7941 c = MSVCRT_operator_new(sizeof(collate));
7942 if(!c) {
7943 ERR("Out of memory\n");
7944 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7946 collate_wchar_ctor_locinfo(c, locinfo, 0);
7948 locale__Locimp__Addfac(locimp, &c->facet, locale_id_operator_size_t(&collate_wchar_id));
7951 if(cat & (1<<(time_put_wchar__Getcat(NULL, NULL)-1))) {
7952 time_put *t;
7954 if(loc) {
7955 t = time_put_wchar_use_facet(loc);
7956 }else {
7957 t = MSVCRT_operator_new(sizeof(time_put));
7958 if(!t) {
7959 ERR("Out of memory\n");
7960 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7962 time_put_wchar_ctor_locinfo(t, locinfo, 0);
7964 locale__Locimp__Addfac(locimp, &t->facet, locale_id_operator_size_t(&time_put_wchar_id));
7967 if(cat & (1<<(codecvt_wchar__Getcat(NULL, NULL)-1))) {
7968 codecvt_wchar *codecvt;
7970 if(loc) {
7971 codecvt = codecvt_wchar_use_facet(loc);
7972 }else {
7973 codecvt = MSVCRT_operator_new(sizeof(codecvt_wchar));
7974 if(!codecvt) {
7975 ERR("Out of memory\n");
7976 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7978 codecvt_wchar_ctor_locinfo(codecvt, locinfo, 0);
7980 locale__Locimp__Addfac(locimp, &codecvt->base.facet, locale_id_operator_size_t(&codecvt_wchar_id));
7984 /* ?_Makexloc@_Locimp@locale@std@@CAXABV_Locinfo@3@HPAV123@PBV23@@Z */
7985 /* ?_Makexloc@_Locimp@locale@std@@CAXAEBV_Locinfo@3@HPEAV123@PEBV23@@Z */
7986 /* List of missing facets:
7987 * messages, money_get, money_put, moneypunct, moneypunct, time_get
7989 static void locale__Locimp__Makexloc(const _Locinfo *locinfo, category cat, locale__Locimp *locimp, const locale *loc)
7991 FIXME("(%p %d %p %p) semi-stub\n", locinfo, cat, locimp, loc);
7993 if(cat & (1<<(ctype_char__Getcat(NULL, NULL)-1))) {
7994 ctype_char *ctype;
7996 if(loc) {
7997 ctype = ctype_char_use_facet(loc);
7998 }else {
7999 ctype = MSVCRT_operator_new(sizeof(ctype_char));
8000 if(!ctype) {
8001 ERR("Out of memory\n");
8002 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8004 ctype_char_ctor_locinfo(ctype, locinfo, 0);
8006 locale__Locimp__Addfac(locimp, &ctype->base.facet, locale_id_operator_size_t(&ctype_char_id));
8009 if(cat & (1<<(num_get_char__Getcat(NULL, NULL)-1))) {
8010 num_get *numget;
8012 if(loc) {
8013 numget = num_get_char_use_facet(loc);
8014 }else {
8015 numget = MSVCRT_operator_new(sizeof(num_get));
8016 if(!numget) {
8017 ERR("Out of memory\n");
8018 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8020 num_get_char_ctor_locinfo(numget, locinfo, 0);
8022 locale__Locimp__Addfac(locimp, &numget->facet, locale_id_operator_size_t(&num_get_char_id));
8025 if(cat & (1<<(num_put_char__Getcat(NULL, NULL)-1))) {
8026 num_put *numput;
8028 if(loc) {
8029 numput = num_put_char_use_facet(loc);
8030 }else {
8031 numput = MSVCRT_operator_new(sizeof(num_put));
8032 if(!numput) {
8033 ERR("Out of memory\n");
8034 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8036 num_put_char_ctor_locinfo(numput, locinfo, 0);
8038 locale__Locimp__Addfac(locimp, &numput->facet, locale_id_operator_size_t(&num_put_char_id));
8041 if(cat & (1<<(numpunct_char__Getcat(NULL, NULL)-1))) {
8042 numpunct_char *numpunct;
8044 if(loc) {
8045 numpunct = numpunct_char_use_facet(loc);
8046 }else {
8047 numpunct = MSVCRT_operator_new(sizeof(numpunct_char));
8048 if(!numpunct) {
8049 ERR("Out of memory\n");
8050 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8052 numpunct_char_ctor_locinfo(numpunct, locinfo, 0, FALSE);
8054 locale__Locimp__Addfac(locimp, &numpunct->facet, locale_id_operator_size_t(&numpunct_char_id));
8057 if(cat & (1<<(collate_char__Getcat(NULL, NULL)-1))) {
8058 collate *c;
8060 if(loc) {
8061 c = collate_char_use_facet(loc);
8062 }else {
8063 c = MSVCRT_operator_new(sizeof(collate));
8064 if(!c) {
8065 ERR("Out of memory\n");
8066 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8068 collate_char_ctor_locinfo(c, locinfo, 0);
8070 locale__Locimp__Addfac(locimp, &c->facet, locale_id_operator_size_t(&collate_char_id));
8073 if(cat & (1<<(time_put_char__Getcat(NULL, NULL)-1))) {
8074 time_put *t;
8076 if(loc) {
8077 t = time_put_char_use_facet(loc);
8078 }else {
8079 t = MSVCRT_operator_new(sizeof(time_put));
8080 if(!t) {
8081 ERR("Out of memory\n");
8082 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8084 time_put_char_ctor_locinfo(t, locinfo, 0);
8086 locale__Locimp__Addfac(locimp, &t->facet, locale_id_operator_size_t(&time_put_char_id));
8089 if(cat & (1<<(codecvt_char__Getcat(NULL, NULL)-1))) {
8090 codecvt_char *codecvt;
8092 if(loc) {
8093 codecvt = codecvt_char_use_facet(loc);
8094 }else {
8095 codecvt = MSVCRT_operator_new(sizeof(codecvt_char));
8096 if(!codecvt) {
8097 ERR("Out of memory\n");
8098 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8100 codecvt_char_ctor_locinfo(codecvt, locinfo, 0);
8102 locale__Locimp__Addfac(locimp, &codecvt->base.facet, locale_id_operator_size_t(&codecvt_char_id));
8106 /* ?_Makeloc@_Locimp@locale@std@@CAPAV123@ABV_Locinfo@3@HPAV123@PBV23@@Z */
8107 /* ?_Makeloc@_Locimp@locale@std@@CAPEAV123@AEBV_Locinfo@3@HPEAV123@PEBV23@@Z */
8108 static locale__Locimp* locale__Locimp__Makeloc(const _Locinfo *locinfo, category cat, locale__Locimp *locimp, const locale *loc)
8110 TRACE("(%p %d %p %p)\n", locinfo, cat, locimp, loc);
8112 locale__Locimp__Makexloc(locinfo, cat, locimp, loc);
8113 locale__Locimp__Makewloc(locinfo, cat, locimp, loc);
8114 locale__Locimp__Makeushloc(locinfo, cat, locimp, loc);
8116 locimp->catmask |= cat;
8117 basic_string_char_assign(&locimp->name, &locinfo->newlocname);
8118 return locimp;
8121 /* ??_7_Locimp@locale@std@@6B@ */
8122 const vtable_ptr MSVCP_locale__Locimp_vtable[] = {
8123 (vtable_ptr)THISCALL_NAME(locale__Locimp_vector_dtor)
8126 /* ??0locale@std@@AAE@PAV_Locimp@01@@Z */
8127 /* ??0locale@std@@AEAA@PEAV_Locimp@01@@Z */
8128 DEFINE_THISCALL_WRAPPER(locale_ctor_locimp, 8)
8129 locale* __thiscall locale_ctor_locimp(locale *this, locale__Locimp *locimp)
8131 TRACE("(%p %p)\n", this, locimp);
8132 /* Don't change locimp reference counter */
8133 this->ptr = locimp;
8134 return this;
8137 /* ?_Init@locale@std@@CAPAV_Locimp@12@XZ */
8138 /* ?_Init@locale@std@@CAPEAV_Locimp@12@XZ */
8139 locale__Locimp* __cdecl locale__Init(void)
8141 _Lockit lock;
8143 TRACE("\n");
8145 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
8146 if(global_locale) {
8147 _Lockit_dtor(&lock);
8148 return global_locale;
8151 global_locale = MSVCRT_operator_new(sizeof(locale__Locimp));
8152 if(!global_locale) {
8153 _Lockit_dtor(&lock);
8154 ERR("Out of memory\n");
8155 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8156 return NULL;
8159 locale__Locimp_ctor(global_locale);
8160 global_locale->catmask = (1<<(LC_MAX+1))-1;
8161 basic_string_char_dtor(&global_locale->name);
8162 basic_string_char_ctor_cstr(&global_locale->name, "C");
8164 locale__Locimp__Clocptr = global_locale;
8165 global_locale->facet.refs++;
8166 locale_ctor_locimp(&classic_locale, locale__Locimp__Clocptr);
8167 _Lockit_dtor(&lock);
8169 return global_locale;
8172 /* ?_Iscloc@locale@std@@QBE_NXZ */
8173 /* ?_Iscloc@locale@std@@QEBA_NXZ */
8174 DEFINE_THISCALL_WRAPPER(locale__Iscloc, 4)
8175 MSVCP_bool __thiscall locale__Iscloc(const locale *this)
8177 TRACE("(%p)\n", this);
8178 return this->ptr == locale__Locimp__Clocptr;
8181 /* ??0locale@std@@QAE@ABV01@0H@Z */
8182 /* ??0locale@std@@QEAA@AEBV01@0H@Z */
8183 DEFINE_THISCALL_WRAPPER(locale_ctor_locale_locale, 16)
8184 locale* __thiscall locale_ctor_locale_locale(locale *this, const locale *loc, const locale *other, category cat)
8186 _Locinfo locinfo;
8188 TRACE("(%p %p %p %d)\n", this, loc, other, cat);
8190 this->ptr = MSVCRT_operator_new(sizeof(locale__Locimp));
8191 if(!this->ptr) {
8192 ERR("Out of memory\n");
8193 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8195 locale__Locimp_copy_ctor(this->ptr, loc->ptr);
8197 _Locinfo_ctor_cat_cstr(&locinfo, loc->ptr->catmask, basic_string_char_c_str(&loc->ptr->name));
8198 _Locinfo__Addcats(&locinfo, cat & other->ptr->catmask, basic_string_char_c_str(&other->ptr->name));
8199 locale__Locimp__Makeloc(&locinfo, cat, this->ptr, other);
8200 _Locinfo_dtor(&locinfo);
8202 return this;
8205 /* ??0locale@std@@QAE@ABV01@@Z */
8206 /* ??0locale@std@@QEAA@AEBV01@@Z */
8207 DEFINE_THISCALL_WRAPPER(locale_copy_ctor, 8)
8208 locale* __thiscall locale_copy_ctor(locale *this, const locale *copy)
8210 TRACE("(%p %p)\n", this, copy);
8211 this->ptr = copy->ptr;
8212 locale_facet__Incref(&this->ptr->facet);
8213 return this;
8216 /* ??0locale@std@@QAE@ABV01@PBDH@Z */
8217 /* ??0locale@std@@QEAA@AEBV01@PEBDH@Z */
8218 DEFINE_THISCALL_WRAPPER(locale_ctor_locale_cstr, 16)
8219 locale* __thiscall locale_ctor_locale_cstr(locale *this, const locale *loc, const char *locname, category cat)
8221 FIXME("(%p %p %s %d) stub\n", this, loc, locname, cat);
8222 return NULL;
8225 /* ??0locale@std@@QAE@PBDH@Z */
8226 /* ??0locale@std@@QEAA@PEBDH@Z */
8227 DEFINE_THISCALL_WRAPPER(locale_ctor_cstr, 12)
8228 locale* __thiscall locale_ctor_cstr(locale *this, const char *locname, category cat)
8230 _Locinfo locinfo;
8232 TRACE("(%p %s %d)\n", this, locname, cat);
8234 this->ptr = MSVCRT_operator_new(sizeof(locale__Locimp));
8235 if(!this->ptr) {
8236 ERR("Out of memory\n");
8237 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8239 locale__Locimp_ctor(this->ptr);
8241 locale__Init();
8243 _Locinfo_ctor_cat_cstr(&locinfo, cat, locname);
8244 if(!memcmp(basic_string_char_c_str(&locinfo.newlocname), "*", 2)) {
8245 _Locinfo_dtor(&locinfo);
8246 MSVCRT_operator_delete(this->ptr);
8247 throw_exception(EXCEPTION_RUNTIME_ERROR, "bad locale name");
8250 locale__Locimp__Makeloc(&locinfo, cat, this->ptr, NULL);
8251 _Locinfo_dtor(&locinfo);
8253 return this;
8256 /* ??0locale@std@@QAE@W4_Uninitialized@1@@Z */
8257 /* ??0locale@std@@QEAA@W4_Uninitialized@1@@Z */
8258 DEFINE_THISCALL_WRAPPER(locale_ctor_uninitialized, 8)
8259 locale* __thiscall locale_ctor_uninitialized(locale *this, int uninitialized)
8261 TRACE("(%p)\n", this);
8262 this->ptr = NULL;
8263 return this;
8266 /* ??0locale@std@@QAE@XZ */
8267 /* ??0locale@std@@QEAA@XZ */
8268 DEFINE_THISCALL_WRAPPER(locale_ctor, 4)
8269 locale* __thiscall locale_ctor(locale *this)
8271 TRACE("(%p)\n", this);
8272 this->ptr = locale__Init();
8273 locale_facet__Incref(&this->ptr->facet);
8274 return this;
8277 /* ??1locale@std@@QAE@XZ */
8278 /* ??1locale@std@@QEAA@XZ */
8279 DEFINE_THISCALL_WRAPPER(locale_dtor, 4)
8280 void __thiscall locale_dtor(locale *this)
8282 TRACE("(%p)\n", this);
8283 if(this->ptr && locale_facet__Decref(&this->ptr->facet)) {
8284 locale__Locimp_dtor(this->ptr);
8285 MSVCRT_operator_delete(this->ptr);
8289 /* ??4locale@std@@QAEAAV01@ABV01@@Z */
8290 /* ??4locale@std@@QEAAAEAV01@AEBV01@@Z */
8291 DEFINE_THISCALL_WRAPPER(locale_operator_assign, 8)
8292 locale* __thiscall locale_operator_assign(locale *this, const locale *loc)
8294 FIXME("(%p %p) stub\n", this, loc);
8295 return NULL;
8298 /* ??8locale@std@@QBE_NABV01@@Z */
8299 /* ??8locale@std@@QEBA_NAEBV01@@Z */
8300 DEFINE_THISCALL_WRAPPER(locale_operator_equal, 8)
8301 MSVCP_bool __thiscall locale_operator_equal(const locale *this, const locale *loc)
8303 FIXME("(%p %p) stub\n", this, loc);
8304 return 0;
8307 /* ??9locale@std@@QBE_NABV01@@Z */
8308 /* ??9locale@std@@QEBA_NAEBV01@@Z */
8309 DEFINE_THISCALL_WRAPPER(locale_operator_not_equal, 8)
8310 MSVCP_bool __thiscall locale_operator_not_equal(const locale *this, locale const *loc)
8312 FIXME("(%p %p) stub\n", this, loc);
8313 return 0;
8316 /* ?_Addfac@locale@std@@QAEAAV12@PAVfacet@12@II@Z */
8317 /* ?_Addfac@locale@std@@QEAAAEAV12@PEAVfacet@12@_K1@Z */
8318 DEFINE_THISCALL_WRAPPER(locale__Addfac, 16)
8319 locale* __thiscall locale__Addfac(locale *this, locale_facet *facet, MSVCP_size_t id, MSVCP_size_t catmask)
8321 TRACE("(%p %p %lu %lu)\n", this, facet, id, catmask);
8323 if(this->ptr->facet.refs > 1) {
8324 locale__Locimp *new_ptr = MSVCRT_operator_new(sizeof(locale__Locimp));
8325 if(!new_ptr) {
8326 ERR("Out of memory\n");
8327 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8328 return NULL;
8330 locale__Locimp_copy_ctor(new_ptr, this->ptr);
8331 locale_facet__Decref(&this->ptr->facet);
8332 this->ptr = new_ptr;
8335 locale__Locimp__Addfac(this->ptr, facet, id);
8337 if(catmask) {
8338 basic_string_char_dtor(&this->ptr->name);
8339 basic_string_char_ctor_cstr(&this->ptr->name, "*");
8341 return this;
8344 /* ?_Getfacet@locale@std@@QBEPBVfacet@12@I_N@Z */
8345 /* ?_Getfacet@locale@std@@QEBAPEBVfacet@12@_K_N@Z */
8346 DEFINE_THISCALL_WRAPPER(locale__Getfacet, 12)
8347 const locale_facet* __thiscall locale__Getfacet(const locale *this,
8348 MSVCP_size_t id, MSVCP_bool allow_transparent)
8350 locale_facet *fac;
8352 TRACE("(%p %lu)\n", this, id);
8354 fac = id < this->ptr->facet_cnt ? this->ptr->facetvec[id] : NULL;
8355 if(fac || !this->ptr->transparent || !allow_transparent)
8356 return fac;
8358 return id < global_locale->facet_cnt ? global_locale->facetvec[id] : NULL;
8361 /* ?classic@locale@std@@SAABV12@XZ */
8362 /* ?classic@locale@std@@SAAEBV12@XZ */
8363 const locale* __cdecl locale_classic(void)
8365 TRACE("\n");
8366 locale__Init();
8367 return &classic_locale;
8370 /* ?empty@locale@std@@SA?AV12@XZ */
8371 locale* __cdecl locale_empty(locale *ret)
8373 TRACE("\n");
8375 locale__Init();
8377 ret->ptr = MSVCRT_operator_new(sizeof(locale__Locimp));
8378 if(!ret->ptr) {
8379 ERR("Out of memory\n");
8380 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8382 locale__Locimp_ctor_transparent(ret->ptr, TRUE);
8383 return ret;
8386 /* ?name@locale@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
8387 /* ?name@locale@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
8388 DEFINE_THISCALL_WRAPPER(locale_name, 8)
8389 basic_string_char* __thiscall locale_name(const locale *this, basic_string_char *ret)
8391 TRACE( "(%p)\n", this);
8392 basic_string_char_copy_ctor(ret, &this->ptr->name);
8393 return ret;
8396 /* ?global@locale@std@@SA?AV12@ABV12@@Z */
8397 /* ?global@locale@std@@SA?AV12@AEBV12@@Z */
8398 locale* __cdecl locale_global(locale *ret, const locale *loc)
8400 _Lockit lock;
8401 int i;
8403 TRACE("(%p %p)\n", loc, ret);
8405 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
8406 locale_ctor(ret);
8408 if(loc->ptr != global_locale) {
8409 locale_facet__Decref(&global_locale->facet);
8410 global_locale = loc->ptr;
8411 locale_facet__Incref(&global_locale->facet);
8413 for(i=LC_ALL+1; i<=LC_MAX; i++) {
8414 if((global_locale->catmask & (1<<(i-1))) == 0)
8415 continue;
8416 setlocale(i, basic_string_char_c_str(&global_locale->name));
8419 _Lockit_dtor(&lock);
8420 return ret;
8423 /* wctrans */
8424 wctrans_t __cdecl wctrans(const char *property)
8426 static const char str_tolower[] = "tolower";
8427 static const char str_toupper[] = "toupper";
8429 if(!strcmp(property, str_tolower))
8430 return 2;
8431 if(!strcmp(property, str_toupper))
8432 return 1;
8433 return 0;
8436 /* towctrans */
8437 wint_t __cdecl towctrans(wint_t c, wctrans_t category)
8439 if(category == 1)
8440 return towupper(c);
8441 return towlower(c);
8444 DEFINE_RTTI_DATA0(locale_facet, 0, ".?AVfacet@locale@std@@")
8445 DEFINE_RTTI_DATA1(collate_char, 0, &locale_facet_rtti_base_descriptor, ".?AV?$collate@D@std@@")
8446 DEFINE_RTTI_DATA1(collate_wchar, 0, &locale_facet_rtti_base_descriptor, ".?AV?$collate@_W@std@@")
8447 DEFINE_RTTI_DATA1(collate_short, 0, &locale_facet_rtti_base_descriptor, ".?AV?$collate@G@std@@")
8448 DEFINE_RTTI_DATA1(ctype_base, 0, &locale_facet_rtti_base_descriptor, ".?AUctype_base@std@@")
8449 DEFINE_RTTI_DATA2(ctype_char, 0, &ctype_base_rtti_base_descriptor, &locale_facet_rtti_base_descriptor, ".?AV?$ctype@D@std@@")
8450 DEFINE_RTTI_DATA2(ctype_wchar, 0, &ctype_base_rtti_base_descriptor, &locale_facet_rtti_base_descriptor, ".?AV?$ctype@_W@std@@")
8451 DEFINE_RTTI_DATA2(ctype_short, 0, &ctype_base_rtti_base_descriptor, &locale_facet_rtti_base_descriptor, ".?AV?$ctype@G@std@@")
8452 DEFINE_RTTI_DATA1(codecvt_base, 0, &locale_facet_rtti_base_descriptor, ".?AVcodecvt_base@std@@")
8453 DEFINE_RTTI_DATA2(codecvt_char, 0, &codecvt_base_rtti_base_descriptor, &locale_facet_rtti_base_descriptor, ".?AV?$codecvt@DDH@std@@")
8454 DEFINE_RTTI_DATA2(codecvt_wchar, 0, &codecvt_base_rtti_base_descriptor, &locale_facet_rtti_base_descriptor, ".?AV?$codecvt@_WDH@std@@")
8455 DEFINE_RTTI_DATA2(codecvt_short, 0, &codecvt_base_rtti_base_descriptor, &locale_facet_rtti_base_descriptor, ".?AV?$codecvt@GDH@std@@")
8456 DEFINE_RTTI_DATA1(numpunct_char, 0, &locale_facet_rtti_base_descriptor, ".?AV?$numpunct@D@std@@")
8457 DEFINE_RTTI_DATA1(numpunct_wchar, 0, &locale_facet_rtti_base_descriptor, ".?AV?$numpunct@_W@std@@")
8458 DEFINE_RTTI_DATA1(numpunct_short, 0, &locale_facet_rtti_base_descriptor, ".?AV?$numpunct@G@std@@")
8459 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@@")
8460 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@@")
8461 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@@")
8462 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@@")
8463 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@@")
8464 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@@")
8465 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@@")
8466 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@@")
8467 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@@")
8469 #ifndef __GNUC__
8470 void __asm_dummy_vtables(void) {
8471 #endif
8472 __ASM_VTABLE(locale_facet,
8473 VTABLE_ADD_FUNC(locale_facet_vector_dtor));
8474 __ASM_VTABLE(collate_char,
8475 VTABLE_ADD_FUNC(collate_char_vector_dtor)
8476 VTABLE_ADD_FUNC(collate_char_do_compare)
8477 VTABLE_ADD_FUNC(collate_char_do_transform)
8478 VTABLE_ADD_FUNC(collate_char_do_hash));
8479 __ASM_VTABLE(collate_wchar,
8480 VTABLE_ADD_FUNC(collate_wchar_vector_dtor)
8481 VTABLE_ADD_FUNC(collate_wchar_do_compare)
8482 VTABLE_ADD_FUNC(collate_wchar_do_transform)
8483 VTABLE_ADD_FUNC(collate_wchar_do_hash));
8484 __ASM_VTABLE(collate_short,
8485 VTABLE_ADD_FUNC(collate_wchar_vector_dtor)
8486 VTABLE_ADD_FUNC(collate_wchar_do_compare)
8487 VTABLE_ADD_FUNC(collate_wchar_do_transform)
8488 VTABLE_ADD_FUNC(collate_wchar_do_hash));
8489 __ASM_VTABLE(ctype_base,
8490 VTABLE_ADD_FUNC(ctype_base_vector_dtor));
8491 __ASM_VTABLE(ctype_char,
8492 VTABLE_ADD_FUNC(ctype_char_vector_dtor)
8493 VTABLE_ADD_FUNC(ctype_char_do_tolower)
8494 VTABLE_ADD_FUNC(ctype_char_do_tolower_ch)
8495 VTABLE_ADD_FUNC(ctype_char_do_toupper)
8496 VTABLE_ADD_FUNC(ctype_char_do_toupper_ch)
8497 VTABLE_ADD_FUNC(ctype_char_do_widen)
8498 VTABLE_ADD_FUNC(ctype_char_do_widen_ch)
8499 VTABLE_ADD_FUNC(ctype_char_do_narrow)
8500 VTABLE_ADD_FUNC(ctype_char_do_narrow_ch));
8501 __ASM_VTABLE(ctype_wchar,
8502 VTABLE_ADD_FUNC(ctype_wchar_vector_dtor)
8503 VTABLE_ADD_FUNC(ctype_wchar_do_is)
8504 VTABLE_ADD_FUNC(ctype_wchar_do_is_ch)
8505 VTABLE_ADD_FUNC(ctype_wchar_do_scan_is)
8506 VTABLE_ADD_FUNC(ctype_wchar_do_scan_not)
8507 VTABLE_ADD_FUNC(ctype_wchar_do_tolower)
8508 VTABLE_ADD_FUNC(ctype_wchar_do_tolower_ch)
8509 VTABLE_ADD_FUNC(ctype_wchar_do_toupper)
8510 VTABLE_ADD_FUNC(ctype_wchar_do_toupper_ch)
8511 VTABLE_ADD_FUNC(ctype_wchar_do_widen)
8512 VTABLE_ADD_FUNC(ctype_wchar_do_widen_ch)
8513 VTABLE_ADD_FUNC(ctype_wchar_do_narrow)
8514 VTABLE_ADD_FUNC(ctype_wchar_do_narrow_ch));
8515 __ASM_VTABLE(ctype_short,
8516 VTABLE_ADD_FUNC(ctype_wchar_vector_dtor)
8517 VTABLE_ADD_FUNC(ctype_wchar_do_is)
8518 VTABLE_ADD_FUNC(ctype_wchar_do_is_ch)
8519 VTABLE_ADD_FUNC(ctype_wchar_do_scan_is)
8520 VTABLE_ADD_FUNC(ctype_wchar_do_scan_not)
8521 VTABLE_ADD_FUNC(ctype_wchar_do_tolower)
8522 VTABLE_ADD_FUNC(ctype_wchar_do_tolower_ch)
8523 VTABLE_ADD_FUNC(ctype_wchar_do_toupper)
8524 VTABLE_ADD_FUNC(ctype_wchar_do_toupper_ch)
8525 VTABLE_ADD_FUNC(ctype_wchar_do_widen)
8526 VTABLE_ADD_FUNC(ctype_wchar_do_widen_ch)
8527 VTABLE_ADD_FUNC(ctype_wchar_do_narrow)
8528 VTABLE_ADD_FUNC(ctype_wchar_do_narrow_ch));
8529 __ASM_VTABLE(codecvt_base,
8530 VTABLE_ADD_FUNC(codecvt_base_vector_dtor)
8531 VTABLE_ADD_FUNC(codecvt_base_do_always_noconv)
8532 VTABLE_ADD_FUNC(codecvt_base_do_max_length)
8533 VTABLE_ADD_FUNC(codecvt_base_do_encoding));
8534 __ASM_VTABLE(codecvt_char,
8535 VTABLE_ADD_FUNC(codecvt_char_vector_dtor)
8536 VTABLE_ADD_FUNC(codecvt_base_do_always_noconv)
8537 VTABLE_ADD_FUNC(codecvt_base_do_max_length)
8538 VTABLE_ADD_FUNC(codecvt_base_do_encoding)
8539 VTABLE_ADD_FUNC(codecvt_char_do_in)
8540 VTABLE_ADD_FUNC(codecvt_char_do_out)
8541 VTABLE_ADD_FUNC(codecvt_char_do_unshift)
8542 VTABLE_ADD_FUNC(codecvt_char_do_length));
8543 __ASM_VTABLE(codecvt_wchar,
8544 VTABLE_ADD_FUNC(codecvt_wchar_vector_dtor)
8545 VTABLE_ADD_FUNC(codecvt_wchar_do_always_noconv)
8546 VTABLE_ADD_FUNC(codecvt_wchar_do_max_length)
8547 VTABLE_ADD_FUNC(codecvt_base_do_encoding)
8548 VTABLE_ADD_FUNC(codecvt_wchar_do_in)
8549 VTABLE_ADD_FUNC(codecvt_wchar_do_out)
8550 VTABLE_ADD_FUNC(codecvt_wchar_do_unshift)
8551 VTABLE_ADD_FUNC(codecvt_wchar_do_length));
8552 __ASM_VTABLE(codecvt_short,
8553 VTABLE_ADD_FUNC(codecvt_wchar_vector_dtor)
8554 VTABLE_ADD_FUNC(codecvt_wchar_do_always_noconv)
8555 VTABLE_ADD_FUNC(codecvt_wchar_do_max_length)
8556 VTABLE_ADD_FUNC(codecvt_base_do_encoding)
8557 VTABLE_ADD_FUNC(codecvt_wchar_do_in)
8558 VTABLE_ADD_FUNC(codecvt_wchar_do_out)
8559 VTABLE_ADD_FUNC(codecvt_wchar_do_unshift)
8560 VTABLE_ADD_FUNC(codecvt_wchar_do_length));
8561 __ASM_VTABLE(numpunct_char,
8562 VTABLE_ADD_FUNC(numpunct_char_vector_dtor)
8563 VTABLE_ADD_FUNC(numpunct_char_do_decimal_point)
8564 VTABLE_ADD_FUNC(numpunct_char_do_thousands_sep)
8565 VTABLE_ADD_FUNC(numpunct_char_do_grouping)
8566 VTABLE_ADD_FUNC(numpunct_char_do_falsename)
8567 VTABLE_ADD_FUNC(numpunct_char_do_truename));
8568 __ASM_VTABLE(numpunct_wchar,
8569 VTABLE_ADD_FUNC(numpunct_wchar_vector_dtor)
8570 VTABLE_ADD_FUNC(numpunct_wchar_do_decimal_point)
8571 VTABLE_ADD_FUNC(numpunct_wchar_do_thousands_sep)
8572 VTABLE_ADD_FUNC(numpunct_wchar_do_grouping)
8573 VTABLE_ADD_FUNC(numpunct_wchar_do_falsename)
8574 VTABLE_ADD_FUNC(numpunct_wchar_do_truename));
8575 __ASM_VTABLE(numpunct_short,
8576 VTABLE_ADD_FUNC(numpunct_wchar_vector_dtor)
8577 VTABLE_ADD_FUNC(numpunct_wchar_do_decimal_point)
8578 VTABLE_ADD_FUNC(numpunct_wchar_do_thousands_sep)
8579 VTABLE_ADD_FUNC(numpunct_wchar_do_grouping)
8580 VTABLE_ADD_FUNC(numpunct_wchar_do_falsename)
8581 VTABLE_ADD_FUNC(numpunct_wchar_do_truename));
8582 __ASM_VTABLE(num_get_char,
8583 VTABLE_ADD_FUNC(num_get_char_vector_dtor)
8584 VTABLE_ADD_FUNC(num_get_char_do_get_void)
8585 VTABLE_ADD_FUNC(num_get_char_do_get_double)
8586 VTABLE_ADD_FUNC(num_get_char_do_get_double)
8587 VTABLE_ADD_FUNC(num_get_char_do_get_float)
8588 VTABLE_ADD_FUNC(num_get_char_do_get_uint64)
8589 VTABLE_ADD_FUNC(num_get_char_do_get_int64)
8590 VTABLE_ADD_FUNC(num_get_char_do_get_ulong)
8591 VTABLE_ADD_FUNC(num_get_char_do_get_long)
8592 VTABLE_ADD_FUNC(num_get_char_do_get_uint)
8593 VTABLE_ADD_FUNC(num_get_char_do_get_ushort)
8594 VTABLE_ADD_FUNC(num_get_char_do_get_bool));
8595 __ASM_VTABLE(num_get_short,
8596 VTABLE_ADD_FUNC(num_get_wchar_vector_dtor)
8597 VTABLE_ADD_FUNC(num_get_short_do_get_void)
8598 VTABLE_ADD_FUNC(num_get_short_do_get_double)
8599 VTABLE_ADD_FUNC(num_get_short_do_get_double)
8600 VTABLE_ADD_FUNC(num_get_short_do_get_float)
8601 VTABLE_ADD_FUNC(num_get_short_do_get_uint64)
8602 VTABLE_ADD_FUNC(num_get_short_do_get_int64)
8603 VTABLE_ADD_FUNC(num_get_short_do_get_ulong)
8604 VTABLE_ADD_FUNC(num_get_short_do_get_long)
8605 VTABLE_ADD_FUNC(num_get_short_do_get_uint)
8606 VTABLE_ADD_FUNC(num_get_short_do_get_ushort)
8607 VTABLE_ADD_FUNC(num_get_short_do_get_bool));
8608 __ASM_VTABLE(num_get_wchar,
8609 VTABLE_ADD_FUNC(num_get_wchar_vector_dtor)
8610 VTABLE_ADD_FUNC(num_get_wchar_do_get_void)
8611 VTABLE_ADD_FUNC(num_get_wchar_do_get_double)
8612 VTABLE_ADD_FUNC(num_get_wchar_do_get_double)
8613 VTABLE_ADD_FUNC(num_get_wchar_do_get_float)
8614 VTABLE_ADD_FUNC(num_get_wchar_do_get_uint64)
8615 VTABLE_ADD_FUNC(num_get_wchar_do_get_int64)
8616 VTABLE_ADD_FUNC(num_get_wchar_do_get_ulong)
8617 VTABLE_ADD_FUNC(num_get_wchar_do_get_long)
8618 VTABLE_ADD_FUNC(num_get_wchar_do_get_uint)
8619 VTABLE_ADD_FUNC(num_get_wchar_do_get_ushort)
8620 VTABLE_ADD_FUNC(num_get_wchar_do_get_bool));
8621 __ASM_VTABLE(num_put_char,
8622 VTABLE_ADD_FUNC(num_put_char_vector_dtor)
8623 VTABLE_ADD_FUNC(num_put_char_do_put_ptr)
8624 VTABLE_ADD_FUNC(num_put_char_do_put_double)
8625 VTABLE_ADD_FUNC(num_put_char_do_put_double)
8626 VTABLE_ADD_FUNC(num_put_char_do_put_uint64)
8627 VTABLE_ADD_FUNC(num_put_char_do_put_int64)
8628 VTABLE_ADD_FUNC(num_put_char_do_put_ulong)
8629 VTABLE_ADD_FUNC(num_put_char_do_put_long)
8630 VTABLE_ADD_FUNC(num_put_char_do_put_bool));
8631 __ASM_VTABLE(num_put_wchar,
8632 VTABLE_ADD_FUNC(num_put_wchar_vector_dtor)
8633 VTABLE_ADD_FUNC(num_put_wchar_do_put_ptr)
8634 VTABLE_ADD_FUNC(num_put_wchar_do_put_double)
8635 VTABLE_ADD_FUNC(num_put_wchar_do_put_double)
8636 VTABLE_ADD_FUNC(num_put_wchar_do_put_uint64)
8637 VTABLE_ADD_FUNC(num_put_wchar_do_put_int64)
8638 VTABLE_ADD_FUNC(num_put_wchar_do_put_ulong)
8639 VTABLE_ADD_FUNC(num_put_wchar_do_put_long)
8640 VTABLE_ADD_FUNC(num_put_wchar_do_put_bool));
8641 __ASM_VTABLE(num_put_short,
8642 VTABLE_ADD_FUNC(num_put_wchar_vector_dtor)
8643 VTABLE_ADD_FUNC(num_put_short_do_put_ptr)
8644 VTABLE_ADD_FUNC(num_put_short_do_put_double)
8645 VTABLE_ADD_FUNC(num_put_short_do_put_double)
8646 VTABLE_ADD_FUNC(num_put_short_do_put_uint64)
8647 VTABLE_ADD_FUNC(num_put_short_do_put_int64)
8648 VTABLE_ADD_FUNC(num_put_short_do_put_ulong)
8649 VTABLE_ADD_FUNC(num_put_short_do_put_long)
8650 VTABLE_ADD_FUNC(num_put_short_do_put_bool));
8651 __ASM_VTABLE(time_put_char,
8652 VTABLE_ADD_FUNC(time_put_char_vector_dtor)
8653 VTABLE_ADD_FUNC(time_put_char_do_put));
8654 __ASM_VTABLE(time_put_wchar,
8655 VTABLE_ADD_FUNC(time_put_wchar_vector_dtor)
8656 VTABLE_ADD_FUNC(time_put_wchar_do_put));
8657 __ASM_VTABLE(time_put_short,
8658 VTABLE_ADD_FUNC(time_put_wchar_vector_dtor)
8659 VTABLE_ADD_FUNC(time_put_wchar_do_put));
8660 #ifndef __GNUC__
8662 #endif
8664 void init_locale(void *base)
8666 #ifdef __x86_64__
8667 init_locale_facet_rtti(base);
8668 init_collate_char_rtti(base);
8669 init_collate_wchar_rtti(base);
8670 init_collate_short_rtti(base);
8671 init_ctype_base_rtti(base);
8672 init_ctype_char_rtti(base);
8673 init_ctype_wchar_rtti(base);
8674 init_ctype_short_rtti(base);
8675 init_codecvt_base_rtti(base);
8676 init_codecvt_char_rtti(base);
8677 init_codecvt_wchar_rtti(base);
8678 init_codecvt_short_rtti(base);
8679 init_numpunct_char_rtti(base);
8680 init_numpunct_wchar_rtti(base);
8681 init_numpunct_short_rtti(base);
8682 init_num_get_char_rtti(base);
8683 init_num_get_wchar_rtti(base);
8684 init_num_get_short_rtti(base);
8685 init_num_put_char_rtti(base);
8686 init_num_put_wchar_rtti(base);
8687 init_num_put_short_rtti(base);
8688 init_time_put_char_rtti(base);
8689 init_time_put_wchar_rtti(base);
8690 init_time_put_short_rtti(base);
8691 #endif
8694 void free_locale(void)
8696 facets_elem *iter, *safe;
8698 if(global_locale) {
8699 locale_dtor(&classic_locale);
8700 locale__Locimp_dtor(global_locale);
8701 MSVCRT_operator_delete(global_locale);
8704 LIST_FOR_EACH_ENTRY_SAFE(iter, safe, &lazy_facets, facets_elem, entry) {
8705 list_remove(&iter->entry);
8706 if(locale_facet__Decref(iter->fac))
8707 call_locale_facet_vector_dtor(iter->fac, 1);
8708 MSVCRT_operator_delete(iter);