wbemprox: Add a partial implementation of Win32_NetworkAdapterConfiguration.
[wine.git] / dlls / msvcp80 / locale.c
blob78d44edb3eb0808ce06dfb8ff055c5508e2d68b9
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);
47 MSVCP_size_t __cdecl _Strftime(char*, MSVCP_size_t, const char*,
48 const struct tm*, struct __lc_time_data*);
49 const locale* __cdecl locale_classic(void);
51 typedef int category;
53 typedef struct {
54 MSVCP_size_t id;
55 } locale_id;
57 typedef struct _locale__Locimp {
58 locale_facet facet;
59 locale_facet **facetvec;
60 MSVCP_size_t facet_cnt;
61 category catmask;
62 MSVCP_bool transparent;
63 basic_string_char name;
64 } locale__Locimp;
66 typedef struct {
67 void *timeptr;
68 } _Timevec;
70 typedef struct {
71 _Lockit lock;
72 basic_string_char days;
73 basic_string_char months;
74 basic_string_char oldlocname;
75 basic_string_char newlocname;
76 } _Locinfo;
78 typedef struct {
79 LCID handle;
80 unsigned page;
81 } _Collvec;
83 typedef struct {
84 locale_facet facet;
85 _Collvec coll;
86 } collate;
88 typedef struct {
89 locale_facet facet;
90 const char *grouping;
91 char dp;
92 char sep;
93 const char *false_name;
94 const char *true_name;
95 } numpunct_char;
97 typedef struct {
98 locale_facet facet;
99 const char *grouping;
100 wchar_t dp;
101 wchar_t sep;
102 const wchar_t *false_name;
103 const wchar_t *true_name;
104 } numpunct_wchar;
106 typedef struct {
107 locale_facet facet;
108 _Timevec time;
109 _Cvtvec cvt;
110 } time_put;
112 /* ?_Id_cnt@id@locale@std@@0HA */
113 int locale_id__Id_cnt = 0;
115 static locale__Locimp *global_locale;
116 static locale classic_locale;
118 /* ?_Clocptr@_Locimp@locale@std@@0PAV123@A */
119 /* ?_Clocptr@_Locimp@locale@std@@0PEAV123@EA */
120 locale__Locimp *locale__Locimp__Clocptr = NULL;
122 static char istreambuf_iterator_char_val(istreambuf_iterator_char *this)
124 if(this->strbuf && !this->got) {
125 int c = basic_streambuf_char_sgetc(this->strbuf);
126 if(c == EOF)
127 this->strbuf = NULL;
128 else
129 this->val = c;
132 this->got = TRUE;
133 return this->val;
136 static wchar_t istreambuf_iterator_wchar_val(istreambuf_iterator_wchar *this)
138 if(this->strbuf && !this->got) {
139 unsigned short c = basic_streambuf_wchar_sgetc(this->strbuf);
140 if(c == WEOF)
141 this->strbuf = NULL;
142 else
143 this->val = c;
146 this->got = TRUE;
147 return this->val;
150 static void istreambuf_iterator_char_inc(istreambuf_iterator_char *this)
152 if(!this->strbuf || basic_streambuf_char_sbumpc(this->strbuf)==EOF) {
153 this->strbuf = NULL;
154 this->got = TRUE;
155 }else {
156 this->got = FALSE;
157 istreambuf_iterator_char_val(this);
161 static void istreambuf_iterator_wchar_inc(istreambuf_iterator_wchar *this)
163 if(!this->strbuf || basic_streambuf_wchar_sbumpc(this->strbuf)==WEOF) {
164 this->strbuf = NULL;
165 this->got = TRUE;
166 }else {
167 this->got = FALSE;
168 istreambuf_iterator_wchar_val(this);
172 static void ostreambuf_iterator_char_put(ostreambuf_iterator_char *this, char ch)
174 if(this->failed || basic_streambuf_char_sputc(this->strbuf, ch)==EOF)
175 this->failed = TRUE;
178 static void ostreambuf_iterator_wchar_put(ostreambuf_iterator_wchar *this, wchar_t ch)
180 if(this->failed || basic_streambuf_wchar_sputc(this->strbuf, ch)==WEOF)
181 this->failed = TRUE;
184 /* ??1facet@locale@std@@UAE@XZ */
185 /* ??1facet@locale@std@@UEAA@XZ */
186 DEFINE_THISCALL_WRAPPER(locale_facet_dtor, 4)
187 void __thiscall locale_facet_dtor(locale_facet *this)
189 TRACE("(%p)\n", this);
192 DEFINE_THISCALL_WRAPPER(locale_facet_vector_dtor, 8)
193 #define call_locale_facet_vector_dtor(this, flags) CALL_VTBL_FUNC(this, 0, \
194 locale_facet*, (locale_facet*, unsigned int), (this, flags))
195 locale_facet* __thiscall locale_facet_vector_dtor(locale_facet *this, unsigned int flags)
197 TRACE("(%p %x)\n", this, flags);
198 if(flags & 2) {
199 /* we have an array, with the number of elements stored before the first object */
200 INT_PTR i, *ptr = (INT_PTR *)this-1;
202 for(i=*ptr-1; i>=0; i--)
203 locale_facet_dtor(this+i);
204 MSVCRT_operator_delete(ptr);
205 } else {
206 locale_facet_dtor(this);
207 if(flags & 1)
208 MSVCRT_operator_delete(this);
211 return this;
214 typedef struct
216 locale_facet *fac;
217 struct list entry;
218 } facets_elem;
219 static struct list lazy_facets = LIST_INIT(lazy_facets);
221 /* ?facet_Register@facet@locale@std@@CAXPAV123@@Z */
222 /* ?facet_Register@facet@locale@std@@CAXPEAV123@@Z */
223 void __cdecl locale_facet_register(locale_facet *add)
225 facets_elem *head = MSVCRT_operator_new(sizeof(*head));
226 if(!head) {
227 ERR("Out of memory\n");
228 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
231 head->fac = add;
232 list_add_head(&lazy_facets, &head->entry);
235 /* ?_Register@facet@locale@std@@QAEXXZ */
236 /* ?_Register@facet@locale@std@@QEAAXXZ */
237 DEFINE_THISCALL_WRAPPER(locale_facet__Register, 4)
238 void __thiscall locale_facet__Register(locale_facet *this)
240 TRACE("(%p)\n", this);
241 locale_facet_register(this);
244 /* ??_7facet@locale@std@@6B@ */
245 extern const vtable_ptr MSVCP_locale_facet_vtable;
247 /* ??0id@locale@std@@QAE@I@Z */
248 /* ??0id@locale@std@@QEAA@_K@Z */
249 DEFINE_THISCALL_WRAPPER(locale_id_ctor_id, 8)
250 locale_id* __thiscall locale_id_ctor_id(locale_id *this, MSVCP_size_t id)
252 TRACE("(%p %lu)\n", this, id);
254 this->id = id;
255 return this;
258 /* ??_Fid@locale@std@@QAEXXZ */
259 /* ??_Fid@locale@std@@QEAAXXZ */
260 DEFINE_THISCALL_WRAPPER(locale_id_ctor, 4)
261 locale_id* __thiscall locale_id_ctor(locale_id *this)
263 TRACE("(%p)\n", this);
265 this->id = 0;
266 return this;
269 /* ??Bid@locale@std@@QAEIXZ */
270 /* ??Bid@locale@std@@QEAA_KXZ */
271 DEFINE_THISCALL_WRAPPER(locale_id_operator_size_t, 4)
272 MSVCP_size_t __thiscall locale_id_operator_size_t(locale_id *this)
274 _Lockit lock;
276 TRACE("(%p)\n", this);
278 if(!this->id) {
279 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
280 this->id = ++locale_id__Id_cnt;
281 _Lockit_dtor(&lock);
284 return this->id;
287 /* ?_Id_cnt_func@id@locale@std@@CAAAHXZ */
288 /* ?_Id_cnt_func@id@locale@std@@CAAEAHXZ */
289 int* __cdecl locale_id__Id_cnt_func(void)
291 TRACE("\n");
292 return &locale_id__Id_cnt;
295 /* ??_Ffacet@locale@std@@QAEXXZ */
296 /* ??_Ffacet@locale@std@@QEAAXXZ */
297 DEFINE_THISCALL_WRAPPER(locale_facet_ctor, 4)
298 locale_facet* __thiscall locale_facet_ctor(locale_facet *this)
300 TRACE("(%p)\n", this);
301 this->vtable = &MSVCP_locale_facet_vtable;
302 this->refs = 0;
303 return this;
306 /* ??0facet@locale@std@@IAE@I@Z */
307 /* ??0facet@locale@std@@IEAA@_K@Z */
308 DEFINE_THISCALL_WRAPPER(locale_facet_ctor_refs, 8)
309 locale_facet* __thiscall locale_facet_ctor_refs(locale_facet *this, MSVCP_size_t refs)
311 TRACE("(%p %lu)\n", this, refs);
312 this->vtable = &MSVCP_locale_facet_vtable;
313 this->refs = refs;
314 return this;
317 /* ?_Incref@facet@locale@std@@QAEXXZ */
318 /* ?_Incref@facet@locale@std@@QEAAXXZ */
319 DEFINE_THISCALL_WRAPPER(locale_facet__Incref, 4)
320 void __thiscall locale_facet__Incref(locale_facet *this)
322 _Lockit lock;
324 TRACE("(%p)\n", this);
326 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
327 this->refs++;
328 _Lockit_dtor(&lock);
331 /* ?_Decref@facet@locale@std@@QAEPAV123@XZ */
332 /* ?_Decref@facet@locale@std@@QEAAPEAV123@XZ */
333 DEFINE_THISCALL_WRAPPER(locale_facet__Decref, 4)
334 locale_facet* __thiscall locale_facet__Decref(locale_facet *this)
336 _Lockit lock;
337 locale_facet *ret;
339 TRACE("(%p)\n", this);
341 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
342 if(this->refs)
343 this->refs--;
345 ret = this->refs ? NULL : this;
346 _Lockit_dtor(&lock);
348 return ret;
351 /* ??0_Timevec@std@@QAE@ABV01@@Z */
352 /* ??0_Timevec@std@@QEAA@AEBV01@@Z */
353 /* This copy constructor modifies copied object */
354 DEFINE_THISCALL_WRAPPER(_Timevec_copy_ctor, 8)
355 _Timevec* __thiscall _Timevec_copy_ctor(_Timevec *this, _Timevec *copy)
357 TRACE("(%p %p)\n", this, copy);
358 this->timeptr = copy->timeptr;
359 copy->timeptr = NULL;
360 return this;
363 /* ??0_Timevec@std@@QAE@PAX@Z */
364 /* ??0_Timevec@std@@QEAA@PEAX@Z */
365 DEFINE_THISCALL_WRAPPER(_Timevec_ctor_timeptr, 8)
366 _Timevec* __thiscall _Timevec_ctor_timeptr(_Timevec *this, void *timeptr)
368 TRACE("(%p %p)\n", this, timeptr);
369 this->timeptr = timeptr;
370 return this;
373 /* ??_F_Timevec@std@@QAEXXZ */
374 /* ??_F_Timevec@std@@QEAAXXZ */
375 DEFINE_THISCALL_WRAPPER(_Timevec_ctor, 4)
376 _Timevec* __thiscall _Timevec_ctor(_Timevec *this)
378 TRACE("(%p)\n", this);
379 this->timeptr = NULL;
380 return this;
383 /* ??1_Timevec@std@@QAE@XZ */
384 /* ??1_Timevec@std@@QEAA@XZ */
385 DEFINE_THISCALL_WRAPPER(_Timevec_dtor, 4)
386 void __thiscall _Timevec_dtor(_Timevec *this)
388 TRACE("(%p)\n", this);
389 free(this->timeptr);
392 /* ??4_Timevec@std@@QAEAAV01@ABV01@@Z */
393 /* ??4_Timevec@std@@QEAAAEAV01@AEBV01@@Z */
394 DEFINE_THISCALL_WRAPPER(_Timevec_op_assign, 8)
395 _Timevec* __thiscall _Timevec_op_assign(_Timevec *this, _Timevec *right)
397 TRACE("(%p %p)\n", this, right);
398 this->timeptr = right->timeptr;
399 right->timeptr = NULL;
400 return this;
403 /* ?_Getptr@_Timevec@std@@QBEPAXXZ */
404 /* ?_Getptr@_Timevec@std@@QEBAPEAXXZ */
405 DEFINE_THISCALL_WRAPPER(_Timevec__Getptr, 4)
406 void* __thiscall _Timevec__Getptr(_Timevec *this)
408 TRACE("(%p)\n", this);
409 return this->timeptr;
412 /* ?_Locinfo_ctor@_Locinfo@std@@SAXPAV12@HPBD@Z */
413 /* ?_Locinfo_ctor@_Locinfo@std@@SAXPEAV12@HPEBD@Z */
414 _Locinfo* __cdecl _Locinfo__Locinfo_ctor_cat_cstr(_Locinfo *locinfo, int category, const char *locstr)
416 const char *locale = NULL;
418 /* This function is probably modifying more global objects */
419 FIXME("(%p %d %s) semi-stub\n", locinfo, category, locstr);
421 if(!locstr)
422 throw_exception(EXCEPTION_RUNTIME_ERROR, "bad locale name");
424 _Lockit_ctor_locktype(&locinfo->lock, _LOCK_LOCALE);
425 MSVCP_basic_string_char_ctor_cstr(&locinfo->days, "");
426 MSVCP_basic_string_char_ctor_cstr(&locinfo->months, "");
427 MSVCP_basic_string_char_ctor_cstr(&locinfo->oldlocname, setlocale(LC_ALL, NULL));
429 if(category)
430 locale = setlocale(LC_ALL, locstr);
431 else
432 locale = setlocale(LC_ALL, NULL);
434 if(locale)
435 MSVCP_basic_string_char_ctor_cstr(&locinfo->newlocname, locale);
436 else
437 MSVCP_basic_string_char_ctor_cstr(&locinfo->newlocname, "*");
439 return locinfo;
442 /* ??0_Locinfo@std@@QAE@HPBD@Z */
443 /* ??0_Locinfo@std@@QEAA@HPEBD@Z */
444 DEFINE_THISCALL_WRAPPER(_Locinfo_ctor_cat_cstr, 12)
445 _Locinfo* __thiscall _Locinfo_ctor_cat_cstr(_Locinfo *this, int category, const char *locstr)
447 return _Locinfo__Locinfo_ctor_cat_cstr(this, category, locstr);
450 /* ?_Locinfo_ctor@_Locinfo@std@@SAXPAV12@PBD@Z */
451 /* ?_Locinfo_ctor@_Locinfo@std@@SAXPEAV12@PEBD@Z */
452 _Locinfo* __cdecl _Locinfo__Locinfo_ctor_cstr(_Locinfo *locinfo, const char *locstr)
454 return _Locinfo__Locinfo_ctor_cat_cstr(locinfo, 1/*FIXME*/, locstr);
457 /* ??0_Locinfo@std@@QAE@PBD@Z */
458 /* ??0_Locinfo@std@@QEAA@PEBD@Z */
459 DEFINE_THISCALL_WRAPPER(_Locinfo_ctor_cstr, 8)
460 _Locinfo* __thiscall _Locinfo_ctor_cstr(_Locinfo *this, const char *locstr)
462 return _Locinfo__Locinfo_ctor_cat_cstr(this, 1/*FIXME*/, locstr);
465 /* ?_Locinfo_dtor@_Locinfo@std@@SAXPAV12@@Z */
466 /* ?_Locinfo_dtor@_Locinfo@std@@SAXPEAV12@@Z */
467 void __cdecl _Locinfo__Locinfo_dtor(_Locinfo *locinfo)
469 TRACE("(%p)\n", locinfo);
471 setlocale(LC_ALL, MSVCP_basic_string_char_c_str(&locinfo->oldlocname));
472 MSVCP_basic_string_char_dtor(&locinfo->days);
473 MSVCP_basic_string_char_dtor(&locinfo->months);
474 MSVCP_basic_string_char_dtor(&locinfo->oldlocname);
475 MSVCP_basic_string_char_dtor(&locinfo->newlocname);
476 _Lockit_dtor(&locinfo->lock);
479 /* ??_F_Locinfo@std@@QAEXXZ */
480 /* ??_F_Locinfo@std@@QEAAXXZ */
481 DEFINE_THISCALL_WRAPPER(_Locinfo_ctor, 4)
482 _Locinfo* __thiscall _Locinfo_ctor(_Locinfo *this)
484 return _Locinfo__Locinfo_ctor_cat_cstr(this, 1/*FIXME*/, "C");
487 /* ??1_Locinfo@std@@QAE@XZ */
488 /* ??1_Locinfo@std@@QEAA@XZ */
489 DEFINE_THISCALL_WRAPPER(_Locinfo_dtor, 4)
490 void __thiscall _Locinfo_dtor(_Locinfo *this)
492 _Locinfo__Locinfo_dtor(this);
495 /* ?_Locinfo_Addcats@_Locinfo@std@@SAAAV12@PAV12@HPBD@Z */
496 /* ?_Locinfo_Addcats@_Locinfo@std@@SAAEAV12@PEAV12@HPEBD@Z */
497 _Locinfo* __cdecl _Locinfo__Locinfo_Addcats(_Locinfo *locinfo, int category, const char *locstr)
499 const char *locale = NULL;
501 /* This function is probably modifying more global objects */
502 FIXME("(%p %d %s) semi-stub\n", locinfo, category, locstr);
503 if(!locstr)
504 throw_exception(EXCEPTION_RUNTIME_ERROR, "bad locale name");
506 MSVCP_basic_string_char_dtor(&locinfo->newlocname);
508 if(category)
509 locale = setlocale(LC_ALL, locstr);
510 else
511 locale = setlocale(LC_ALL, NULL);
513 if(locale)
514 MSVCP_basic_string_char_ctor_cstr(&locinfo->newlocname, locale);
515 else
516 MSVCP_basic_string_char_ctor_cstr(&locinfo->newlocname, "*");
518 return locinfo;
521 /* ?_Addcats@_Locinfo@std@@QAEAAV12@HPBD@Z */
522 /* ?_Addcats@_Locinfo@std@@QEAAAEAV12@HPEBD@Z */
523 DEFINE_THISCALL_WRAPPER(_Locinfo__Addcats, 12)
524 _Locinfo* __thiscall _Locinfo__Addcats(_Locinfo *this, int category, const char *locstr)
526 return _Locinfo__Locinfo_Addcats(this, category, locstr);
529 /* _Getcoll */
530 ULONGLONG __cdecl _Getcoll(void)
532 union {
533 _Collvec collvec;
534 ULONGLONG ull;
535 } ret;
536 _locale_t locale = _get_current_locale();
538 TRACE("\n");
540 ret.collvec.page = locale->locinfo->lc_collate_cp;
541 ret.collvec.handle = locale->locinfo->lc_handle[LC_COLLATE];
542 _free_locale(locale);
543 return ret.ull;
546 /* ?_Getcoll@_Locinfo@std@@QBE?AU_Collvec@@XZ */
547 /* ?_Getcoll@_Locinfo@std@@QEBA?AU_Collvec@@XZ */
548 DEFINE_THISCALL_WRAPPER(_Locinfo__Getcoll, 8)
549 _Collvec* __thiscall _Locinfo__Getcoll(const _Locinfo *this, _Collvec *ret)
551 ULONGLONG ull = _Getcoll();
552 memcpy(ret, &ull, sizeof(ull));
553 return ret;
556 /* _Getctype */
557 _Ctypevec* __cdecl _Getctype(_Ctypevec *ret)
559 _locale_t locale = _get_current_locale();
560 short *table;
562 TRACE("\n");
564 ret->page = locale->locinfo->lc_codepage;
565 ret->handle = locale->locinfo->lc_handle[LC_COLLATE];
566 ret->delfl = TRUE;
567 table = malloc(sizeof(short[256]));
568 if(!table) {
569 _free_locale(locale);
570 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
572 memcpy(table, locale->locinfo->pctype, sizeof(short[256]));
573 ret->table = table;
574 _free_locale(locale);
575 return ret;
578 /* ?_Getctype@_Locinfo@std@@QBE?AU_Ctypevec@@XZ */
579 /* ?_Getctype@_Locinfo@std@@QEBA?AU_Ctypevec@@XZ */
580 DEFINE_THISCALL_WRAPPER(_Locinfo__Getctype, 8)
581 _Ctypevec* __thiscall _Locinfo__Getctype(const _Locinfo *this, _Ctypevec *ret)
583 return _Getctype(ret);
586 /* _Getcvt */
587 ULONGLONG __cdecl _Getcvt(void)
589 _locale_t locale = _get_current_locale();
590 union {
591 _Cvtvec cvtvec;
592 ULONGLONG ull;
593 } ret;
595 TRACE("\n");
597 ret.cvtvec.page = locale->locinfo->lc_codepage;
598 ret.cvtvec.handle = locale->locinfo->lc_handle[LC_CTYPE];
599 _free_locale(locale);
600 return ret.ull;
603 /* ?_Getcvt@_Locinfo@std@@QBE?AU_Cvtvec@@XZ */
604 /* ?_Getcvt@_Locinfo@std@@QEBA?AU_Cvtvec@@XZ */
605 DEFINE_THISCALL_WRAPPER(_Locinfo__Getcvt, 8)
606 _Cvtvec* __thiscall _Locinfo__Getcvt(const _Locinfo *this, _Cvtvec *ret)
608 ULONGLONG ull = _Getcvt();
609 memcpy(ret, &ull, sizeof(ull));
610 return ret;
613 /* ?_Getdateorder@_Locinfo@std@@QBEHXZ */
614 /* ?_Getdateorder@_Locinfo@std@@QEBAHXZ */
615 DEFINE_THISCALL_WRAPPER(_Locinfo__Getdateorder, 4)
616 int __thiscall _Locinfo__Getdateorder(const _Locinfo *this)
618 FIXME("(%p) stub\n", this);
619 return 0;
622 /* ?_Getdays@_Locinfo@std@@QBEPBDXZ */
623 /* ?_Getdays@_Locinfo@std@@QEBAPEBDXZ */
624 DEFINE_THISCALL_WRAPPER(_Locinfo__Getdays, 4)
625 const char* __thiscall _Locinfo__Getdays(_Locinfo *this)
627 char *days = _Getdays();
629 TRACE("(%p)\n", this);
631 if(days) {
632 MSVCP_basic_string_char_dtor(&this->days);
633 MSVCP_basic_string_char_ctor_cstr(&this->days, days);
634 free(days);
637 return this->days.size ? MSVCP_basic_string_char_c_str(&this->days) :
638 ":Sun:Sunday:Mon:Monday:Tue:Tuesday:Wed:Wednesday:Thu:Thursday:Fri:Friday:Sat:Saturday";
641 /* ?_Getmonths@_Locinfo@std@@QBEPBDXZ */
642 /* ?_Getmonths@_Locinfo@std@@QEBAPEBDXZ */
643 DEFINE_THISCALL_WRAPPER(_Locinfo__Getmonths, 4)
644 const char* __thiscall _Locinfo__Getmonths(_Locinfo *this)
646 char *months = _Getmonths();
648 TRACE("(%p)\n", this);
650 if(months) {
651 MSVCP_basic_string_char_dtor(&this->months);
652 MSVCP_basic_string_char_ctor_cstr(&this->months, months);
653 free(months);
656 return this->months.size ? MSVCP_basic_string_char_c_str(&this->months) :
657 ":Jan:January:Feb:February:Mar:March:Apr:April:May:May:Jun:June:Jul:July"
658 ":Aug:August:Sep:September:Oct:October:Nov:November:Dec:December";
661 /* ?_Getfalse@_Locinfo@std@@QBEPBDXZ */
662 /* ?_Getfalse@_Locinfo@std@@QEBAPEBDXZ */
663 DEFINE_THISCALL_WRAPPER(_Locinfo__Getfalse, 4)
664 const char* __thiscall _Locinfo__Getfalse(const _Locinfo *this)
666 TRACE("(%p)\n", this);
667 return "false";
670 /* ?_Gettrue@_Locinfo@std@@QBEPBDXZ */
671 /* ?_Gettrue@_Locinfo@std@@QEBAPEBDXZ */
672 DEFINE_THISCALL_WRAPPER(_Locinfo__Gettrue, 4)
673 const char* __thiscall _Locinfo__Gettrue(const _Locinfo *this)
675 TRACE("(%p)\n", this);
676 return "true";
679 /* ?_Getlconv@_Locinfo@std@@QBEPBUlconv@@XZ */
680 /* ?_Getlconv@_Locinfo@std@@QEBAPEBUlconv@@XZ */
681 DEFINE_THISCALL_WRAPPER(_Locinfo__Getlconv, 4)
682 const struct lconv* __thiscall _Locinfo__Getlconv(const _Locinfo *this)
684 TRACE("(%p)\n", this);
685 return localeconv();
688 /* ?_Getname@_Locinfo@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
689 /* ?_Getname@_Locinfo@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
690 DEFINE_THISCALL_WRAPPER(_Locinfo__Getname, 8)
691 basic_string_char* __thiscall _Locinfo__Getname(const _Locinfo *this, basic_string_char *ret)
693 TRACE("(%p)\n", this);
695 MSVCP_basic_string_char_copy_ctor(ret, &this->newlocname);
696 return ret;
699 /* ?_Gettnames@_Locinfo@std@@QBE?AV_Timevec@2@XZ */
700 /* ?_Gettnames@_Locinfo@std@@QEBA?AV_Timevec@2@XZ */
701 DEFINE_THISCALL_WRAPPER(_Locinfo__Gettnames, 8)
702 _Timevec*__thiscall _Locinfo__Gettnames(const _Locinfo *this, _Timevec *ret)
704 TRACE("(%p)\n", this);
706 _Timevec_ctor_timeptr(ret, _Gettnames());
707 return ret;
710 /* ?id@?$collate@D@std@@2V0locale@2@A */
711 locale_id collate_char_id = {0};
713 /* ??_7?$collate@D@std@@6B@ */
714 extern const vtable_ptr MSVCP_collate_char_vtable;
716 /* ?_Init@?$collate@D@std@@IAEXABV_Locinfo@2@@Z */
717 /* ?_Init@?$collate@D@std@@IEAAXAEBV_Locinfo@2@@Z */
718 DEFINE_THISCALL_WRAPPER(collate_char__Init, 8)
719 void __thiscall collate_char__Init(collate *this, const _Locinfo *locinfo)
721 TRACE("(%p %p)\n", this, locinfo);
722 _Locinfo__Getcoll(locinfo, &this->coll);
725 /* ??0?$collate@D@std@@IAE@PBDI@Z */
726 /* ??0?$collate@D@std@@IEAA@PEBD_K@Z */
727 DEFINE_THISCALL_WRAPPER(collate_char_ctor_name, 12)
728 collate* __thiscall collate_char_ctor_name(collate *this, const char *name, MSVCP_size_t refs)
730 _Locinfo locinfo;
732 TRACE("(%p %s %lu)\n", this, name, refs);
734 locale_facet_ctor_refs(&this->facet, refs);
735 this->facet.vtable = &MSVCP_collate_char_vtable;
737 _Locinfo_ctor_cstr(&locinfo, name);
738 collate_char__Init(this, &locinfo);
739 _Locinfo_dtor(&locinfo);
740 return this;
743 /* ??0?$collate@D@std@@QAE@ABV_Locinfo@1@I@Z */
744 /* ??0?$collate@D@std@@QEAA@AEBV_Locinfo@1@_K@Z */
745 DEFINE_THISCALL_WRAPPER(collate_char_ctor_locinfo, 12)
746 collate* __thiscall collate_char_ctor_locinfo(collate *this, const _Locinfo *locinfo, MSVCP_size_t refs)
748 TRACE("(%p %p %lu)\n", this, locinfo, refs);
750 locale_facet_ctor_refs(&this->facet, refs);
751 this->facet.vtable = &MSVCP_collate_char_vtable;
752 collate_char__Init(this, locinfo);
753 return this;
756 /* ??0?$collate@D@std@@QAE@I@Z */
757 /* ??0?$collate@D@std@@QEAA@_K@Z */
758 DEFINE_THISCALL_WRAPPER(collate_char_ctor_refs, 8)
759 collate* __thiscall collate_char_ctor_refs(collate *this, MSVCP_size_t refs)
761 return collate_char_ctor_name(this, "C", refs);
764 /* ??1?$collate@D@std@@MAE@XZ */
765 /* ??1?$collate@D@std@@MEAA@XZ */
766 DEFINE_THISCALL_WRAPPER(collate_char_dtor, 4)
767 void __thiscall collate_char_dtor(collate *this)
769 TRACE("(%p)\n", this);
772 DEFINE_THISCALL_WRAPPER(collate_char_vector_dtor, 8)
773 collate* __thiscall collate_char_vector_dtor(collate *this, unsigned int flags)
775 TRACE("(%p %x)\n", this, flags);
776 if(flags & 2) {
777 /* we have an array, with the number of elements stored before the first object */
778 INT_PTR i, *ptr = (INT_PTR *)this-1;
780 for(i=*ptr-1; i>=0; i--)
781 collate_char_dtor(this+i);
782 MSVCRT_operator_delete(ptr);
783 } else {
784 collate_char_dtor(this);
785 if(flags & 1)
786 MSVCRT_operator_delete(this);
789 return this;
792 /* ??_F?$collate@D@std@@QAEXXZ */
793 /* ??_F?$collate@D@std@@QEAAXXZ */
794 DEFINE_THISCALL_WRAPPER(collate_char_ctor, 4)
795 collate* __thiscall collate_char_ctor(collate *this)
797 return collate_char_ctor_name(this, "C", 0);
800 /* ?_Getcat@?$collate@D@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
801 /* ?_Getcat@?$collate@D@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
802 static MSVCP_size_t collate_char__Getcat(const locale_facet **facet, const locale *loc)
804 TRACE("(%p %p)\n", facet, loc);
806 if(facet && !*facet) {
807 *facet = MSVCRT_operator_new(sizeof(collate));
808 if(!*facet) {
809 ERR("Out of memory\n");
810 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
811 return 0;
813 collate_char_ctor_name((collate*)*facet,
814 MSVCP_basic_string_char_c_str(&loc->ptr->name), 0);
817 return LC_COLLATE;
820 /* ?_Getcat@?$collate@D@std@@SAIPAPBVfacet@locale@2@@Z */
821 /* ?_Getcat@?$collate@D@std@@SA_KPEAPEBVfacet@locale@2@@Z */
822 MSVCP_size_t __cdecl collate_char__Getcat_old(const locale_facet **facet)
824 return collate_char__Getcat(facet, locale_classic());
827 static collate* collate_char_use_facet(const locale *loc)
829 static collate *obj = NULL;
831 _Lockit lock;
832 const locale_facet *fac;
834 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
835 fac = locale__Getfacet(loc, locale_id_operator_size_t(&collate_char_id));
836 if(fac) {
837 _Lockit_dtor(&lock);
838 return (collate*)fac;
841 if(obj) {
842 _Lockit_dtor(&lock);
843 return obj;
846 collate_char__Getcat(&fac, loc);
847 obj = (collate*)fac;
848 locale_facet__Incref(&obj->facet);
849 locale_facet_register(&obj->facet);
850 _Lockit_dtor(&lock);
852 return obj;
855 /* _Strcoll */
856 int __cdecl _Strcoll(const char *first1, const char *last1, const char *first2,
857 const char *last2, const _Collvec *coll)
859 LCID lcid;
861 TRACE("(%s %s)\n", debugstr_an(first1, last1-first1), debugstr_an(first2, last2-first2));
863 if(coll)
864 lcid = coll->handle;
865 else
866 lcid = ___lc_handle_func()[LC_COLLATE];
867 return CompareStringA(lcid, 0, first1, last1-first1, first2, last2-first2)-CSTR_EQUAL;
870 /* ?do_compare@?$collate@D@std@@MBEHPBD000@Z */
871 /* ?do_compare@?$collate@D@std@@MEBAHPEBD000@Z */
872 DEFINE_THISCALL_WRAPPER(collate_char_do_compare, 20)
873 #define call_collate_char_do_compare(this, first1, last1, first2, last2) CALL_VTBL_FUNC(this, 4, int, \
874 (const collate*, const char*, const char*, const char*, const char*), \
875 (this, first1, last1, first2, last2))
876 int __thiscall collate_char_do_compare(const collate *this, const char *first1,
877 const char *last1, const char *first2, const char *last2)
879 TRACE("(%p %p %p %p %p)\n", this, first1, last1, first2, last2);
880 return _Strcoll(first1, last1, first2, last2, &this->coll);
883 /* ?compare@?$collate@D@std@@QBEHPBD000@Z */
884 /* ?compare@?$collate@D@std@@QEBAHPEBD000@Z */
885 DEFINE_THISCALL_WRAPPER(collate_char_compare, 20)
886 int __thiscall collate_char_compare(const collate *this, const char *first1,
887 const char *last1, const char *first2, const char *last2)
889 TRACE("(%p %p %p %p %p)\n", this, first1, last1, first2, last2);
890 return call_collate_char_do_compare(this, first1, last1, first2, last2);
893 /* ?do_hash@?$collate@D@std@@MBEJPBD0@Z */
894 /* ?do_hash@?$collate@D@std@@MEBAJPEBD0@Z */
895 DEFINE_THISCALL_WRAPPER(collate_char_do_hash, 12)
896 #define call_collate_char_do_hash(this, first, last) CALL_VTBL_FUNC(this, 12, LONG, \
897 (const collate*, const char*, const char*), (this, first, last))
898 LONG __thiscall collate_char_do_hash(const collate *this,
899 const char *first, const char *last)
901 ULONG ret = 0;
903 TRACE("(%p %p %p)\n", this, first, last);
905 for(; first<last; first++)
906 ret = (ret<<8 | ret>>24) + *first;
907 return ret;
910 /* ?hash@?$collate@D@std@@QBEJPBD0@Z */
911 /* ?hash@?$collate@D@std@@QEBAJPEBD0@Z */
912 DEFINE_THISCALL_WRAPPER(collate_char_hash, 12)
913 LONG __thiscall collate_char_hash(const collate *this,
914 const char *first, const char *last)
916 TRACE("(%p %p %p)\n", this, first, last);
917 return call_collate_char_do_hash(this, first, last);
920 /* ?do_transform@?$collate@D@std@@MBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@PBD0@Z */
921 /* ?do_transform@?$collate@D@std@@MEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@PEBD0@Z */
922 DEFINE_THISCALL_WRAPPER(collate_char_do_transform, 16)
923 basic_string_char* __thiscall collate_char_do_transform(const collate *this,
924 basic_string_char *ret, const char *first, const char *last)
926 FIXME("(%p %p %p) stub\n", this, first, last);
927 return ret;
930 /* ?transform@?$collate@D@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@PBD0@Z */
931 /* ?transform@?$collate@D@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@PEBD0@Z */
932 DEFINE_THISCALL_WRAPPER(collate_char_transform, 16)
933 basic_string_char* __thiscall collate_char_transform(const collate *this,
934 basic_string_char *ret, const char *first, const char *last)
936 FIXME("(%p %p %p) stub\n", this, first, last);
937 return ret;
940 /* ?id@?$collate@_W@std@@2V0locale@2@A */
941 locale_id collate_wchar_id = {0};
942 /* ?id@?$collate@G@std@@2V0locale@2@A */
943 locale_id collate_short_id = {0};
945 /* ??_7?$collate@_W@std@@6B@ */
946 extern const vtable_ptr MSVCP_collate_wchar_vtable;
947 /* ??_7?$collate@G@std@@6B@ */
948 extern const vtable_ptr MSVCP_collate_short_vtable;
950 /* ?_Init@?$collate@_W@std@@IAEXABV_Locinfo@2@@Z */
951 /* ?_Init@?$collate@_W@std@@IEAAXAEBV_Locinfo@2@@Z */
952 /* ?_Init@?$collate@G@std@@IAEXABV_Locinfo@2@@Z */
953 /* ?_Init@?$collate@G@std@@IEAAXAEBV_Locinfo@2@@Z */
954 DEFINE_THISCALL_WRAPPER(collate_wchar__Init, 8)
955 void __thiscall collate_wchar__Init(collate *this, const _Locinfo *locinfo)
957 TRACE("(%p %p)\n", this, locinfo);
958 _Locinfo__Getcoll(locinfo, &this->coll);
961 /* ??0?$collate@_W@std@@IAE@PBDI@Z */
962 /* ??0?$collate@_W@std@@IEAA@PEBD_K@Z */
963 DEFINE_THISCALL_WRAPPER(collate_wchar_ctor_name, 12)
964 collate* __thiscall collate_wchar_ctor_name(collate *this, const char *name, MSVCP_size_t refs)
966 _Locinfo locinfo;
968 TRACE("(%p %s %lu)\n", this, name, refs);
970 locale_facet_ctor_refs(&this->facet, refs);
971 this->facet.vtable = &MSVCP_collate_wchar_vtable;
973 _Locinfo_ctor_cstr(&locinfo, name);
974 collate_wchar__Init(this, &locinfo);
975 _Locinfo_dtor(&locinfo);
976 return this;
979 /* ??0?$collate@G@std@@IAE@PBDI@Z */
980 /* ??0?$collate@G@std@@IEAA@PEBD_K@Z */
981 DEFINE_THISCALL_WRAPPER(collate_short_ctor_name, 12)
982 collate* __thiscall collate_short_ctor_name(collate *this, const char *name, MSVCP_size_t refs)
984 collate *ret = collate_wchar_ctor_name(this, name, refs);
985 ret->facet.vtable = &MSVCP_collate_short_vtable;
986 return ret;
989 /* ??0?$collate@_W@std@@QAE@ABV_Locinfo@1@I@Z */
990 /* ??0?$collate@_W@std@@QEAA@AEBV_Locinfo@1@_K@Z */
991 DEFINE_THISCALL_WRAPPER(collate_wchar_ctor_locinfo, 12)
992 collate* __thiscall collate_wchar_ctor_locinfo(collate *this, const _Locinfo *locinfo, MSVCP_size_t refs)
994 TRACE("(%p %p %lu)\n", this, locinfo, refs);
996 locale_facet_ctor_refs(&this->facet, refs);
997 this->facet.vtable = &MSVCP_collate_wchar_vtable;
998 collate_wchar__Init(this, locinfo);
999 return this;
1002 /* ??0?$collate@G@std@@QAE@ABV_Locinfo@1@I@Z */
1003 /* ??0?$collate@G@std@@QEAA@AEBV_Locinfo@1@_K@Z */
1004 DEFINE_THISCALL_WRAPPER(collate_short_ctor_locinfo, 12)
1005 collate* __thiscall collate_short_ctor_locinfo(collate *this, const _Locinfo *locinfo, MSVCP_size_t refs)
1007 collate *ret = collate_wchar_ctor_locinfo(this, locinfo, refs);
1008 ret->facet.vtable = &MSVCP_collate_short_vtable;
1009 return ret;
1012 /* ??0?$collate@_W@std@@QAE@I@Z */
1013 /* ??0?$collate@_W@std@@QEAA@_K@Z */
1014 DEFINE_THISCALL_WRAPPER(collate_wchar_ctor_refs, 8)
1015 collate* __thiscall collate_wchar_ctor_refs(collate *this, MSVCP_size_t refs)
1017 return collate_wchar_ctor_name(this, "C", refs);
1020 /* ??0?$collate@G@std@@QAE@I@Z */
1021 /* ??0?$collate@G@std@@QEAA@_K@Z */
1022 DEFINE_THISCALL_WRAPPER(collate_short_ctor_refs, 8)
1023 collate* __thiscall collate_short_ctor_refs(collate *this, MSVCP_size_t refs)
1025 collate *ret = collate_wchar_ctor_refs(this, refs);
1026 ret->facet.vtable = &MSVCP_collate_short_vtable;
1027 return ret;
1030 /* ??1?$collate@_W@std@@MAE@XZ */
1031 /* ??1?$collate@_W@std@@MEAA@XZ */
1032 /* ??1?$collate@G@std@@MAE@XZ */
1033 /* ??1?$collate@G@std@@MEAA@XZ */
1034 DEFINE_THISCALL_WRAPPER(collate_wchar_dtor, 4)
1035 void __thiscall collate_wchar_dtor(collate *this)
1037 TRACE("(%p)\n", this);
1040 DEFINE_THISCALL_WRAPPER(collate_wchar_vector_dtor, 8)
1041 collate* __thiscall collate_wchar_vector_dtor(collate *this, unsigned int flags)
1043 TRACE("(%p %x)\n", this, flags);
1044 if(flags & 2) {
1045 /* we have an array, with the number of elements stored before the first object */
1046 INT_PTR i, *ptr = (INT_PTR *)this-1;
1048 for(i=*ptr-1; i>=0; i--)
1049 collate_wchar_dtor(this+i);
1050 MSVCRT_operator_delete(ptr);
1051 } else {
1052 collate_wchar_dtor(this);
1053 if(flags & 1)
1054 MSVCRT_operator_delete(this);
1057 return this;
1060 /* ??_F?$collate@_W@std@@QAEXXZ */
1061 /* ??_F?$collate@_W@std@@QEAAXXZ */
1062 DEFINE_THISCALL_WRAPPER(collate_wchar_ctor, 4)
1063 collate* __thiscall collate_wchar_ctor(collate *this)
1065 return collate_wchar_ctor_name(this, "C", 0);
1068 /* ??_F?$collate@G@std@@QAEXXZ */
1069 /* ??_F?$collate@G@std@@QEAAXXZ */
1070 DEFINE_THISCALL_WRAPPER(collate_short_ctor, 4)
1071 collate* __thiscall collate_short_ctor(collate *this)
1073 collate *ret = collate_wchar_ctor(this);
1074 ret->facet.vtable = &MSVCP_collate_short_vtable;
1075 return ret;
1078 /* ?_Getcat@?$collate@_W@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
1079 /* ?_Getcat@?$collate@_W@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
1080 static MSVCP_size_t collate_wchar__Getcat(const locale_facet **facet, const locale *loc)
1082 TRACE("(%p %p)\n", facet, loc);
1084 if(facet && !*facet) {
1085 *facet = MSVCRT_operator_new(sizeof(collate));
1086 if(!*facet) {
1087 ERR("Out of memory\n");
1088 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
1089 return 0;
1091 collate_wchar_ctor_name((collate*)*facet,
1092 MSVCP_basic_string_char_c_str(&loc->ptr->name), 0);
1095 return LC_COLLATE;
1098 /* ?_Getcat@?$collate@_W@std@@SAIPAPBVfacet@locale@2@@Z */
1099 /* ?_Getcat@?$collate@_W@std@@SA_KPEAPEBVfacet@locale@2@@Z */
1100 MSVCP_size_t __cdecl collate_wchar__Getcat_old(const locale_facet **facet)
1102 return collate_wchar__Getcat(facet, locale_classic());
1105 static collate* collate_wchar_use_facet(const locale *loc)
1107 static collate *obj = NULL;
1109 _Lockit lock;
1110 const locale_facet *fac;
1112 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
1113 fac = locale__Getfacet(loc, locale_id_operator_size_t(&collate_wchar_id));
1114 if(fac) {
1115 _Lockit_dtor(&lock);
1116 return (collate*)fac;
1119 if(obj) {
1120 _Lockit_dtor(&lock);
1121 return obj;
1124 collate_wchar__Getcat(&fac, loc);
1125 obj = (collate*)fac;
1126 locale_facet__Incref(&obj->facet);
1127 locale_facet_register(&obj->facet);
1128 _Lockit_dtor(&lock);
1130 return obj;
1133 /* ?_Getcat@?$collate@G@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
1134 /* ?_Getcat@?$collate@G@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
1135 static MSVCP_size_t collate_short__Getcat(const locale_facet **facet, const locale *loc)
1137 if(facet && !*facet) {
1138 collate_wchar__Getcat(facet, loc);
1139 (*(locale_facet**)facet)->vtable = &MSVCP_collate_short_vtable;
1142 return LC_COLLATE;
1145 /* ?_Getcat@?$collate@G@std@@SAIPAPBVfacet@locale@2@@Z */
1146 /* ?_Getcat@?$collate@G@std@@SA_KPEAPEBVfacet@locale@2@@Z */
1147 MSVCP_size_t __cdecl collate_short__Getcat_old(const locale_facet **facet)
1149 return collate_short__Getcat(facet, locale_classic());
1152 static collate* collate_short_use_facet(const locale *loc)
1154 static collate *obj = NULL;
1156 _Lockit lock;
1157 const locale_facet *fac;
1159 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
1160 fac = locale__Getfacet(loc, locale_id_operator_size_t(&collate_short_id));
1161 if(fac) {
1162 _Lockit_dtor(&lock);
1163 return (collate*)fac;
1166 if(obj) {
1167 _Lockit_dtor(&lock);
1168 return obj;
1171 collate_short__Getcat(&fac, loc);
1172 obj = (collate*)fac;
1173 locale_facet__Incref(&obj->facet);
1174 locale_facet_register(&obj->facet);
1175 _Lockit_dtor(&lock);
1177 return obj;
1180 /* _Wcscoll */
1181 int __cdecl _Wcscoll(const wchar_t *first1, const wchar_t *last1, const wchar_t *first2,
1182 const wchar_t *last2, const _Collvec *coll)
1184 LCID lcid;
1186 TRACE("(%s %s)\n", debugstr_wn(first1, last1-first1), debugstr_wn(first2, last2-first2));
1188 if(coll)
1189 lcid = coll->handle;
1190 else
1191 lcid = ___lc_handle_func()[LC_COLLATE];
1192 return CompareStringW(lcid, 0, first1, last1-first1, first2, last2-first2)-CSTR_EQUAL;
1195 /* ?do_compare@?$collate@_W@std@@MBEHPB_W000@Z */
1196 /* ?do_compare@?$collate@_W@std@@MEBAHPEB_W000@Z */
1197 /* ?do_compare@?$collate@G@std@@MBEHPBG000@Z */
1198 /* ?do_compare@?$collate@G@std@@MEBAHPEBG000@Z */
1199 DEFINE_THISCALL_WRAPPER(collate_wchar_do_compare, 20)
1200 #define call_collate_wchar_do_compare(this, first1, last1, first2, last2) CALL_VTBL_FUNC(this, 4, int, \
1201 (const collate*, const wchar_t*, const wchar_t*, const wchar_t*, const wchar_t*), \
1202 (this, first1, last1, first2, last2))
1203 int __thiscall collate_wchar_do_compare(const collate *this, const wchar_t *first1,
1204 const wchar_t *last1, const wchar_t *first2, const wchar_t *last2)
1206 TRACE("(%p %p %p %p %p)\n", this, first1, last1, first2, last2);
1207 return _Wcscoll(first1, last1, first2, last2, &this->coll);
1210 /* ?compare@?$collate@_W@std@@QBEHPB_W000@Z */
1211 /* ?compare@?$collate@_W@std@@QEBAHPEB_W000@Z */
1212 /* ?compare@?$collate@G@std@@QBEHPBG000@Z */
1213 /* ?compare@?$collate@G@std@@QEBAHPEBG000@Z */
1214 DEFINE_THISCALL_WRAPPER(collate_wchar_compare, 20)
1215 int __thiscall collate_wchar_compare(const collate *this, const wchar_t *first1,
1216 const wchar_t *last1, const wchar_t *first2, const wchar_t *last2)
1218 TRACE("(%p %p %p %p %p)\n", this, first1, last1, first2, last2);
1219 return call_collate_wchar_do_compare(this, first1, last1, first2, last2);
1222 /* ?do_hash@?$collate@_W@std@@MBEJPB_W0@Z */
1223 /* ?do_hash@?$collate@_W@std@@MEBAJPEB_W0@Z */
1224 /* ?do_hash@?$collate@G@std@@MBEJPBG0@Z */
1225 /* ?do_hash@?$collate@G@std@@MEBAJPEBG0@Z */
1226 DEFINE_THISCALL_WRAPPER(collate_wchar_do_hash, 12)
1227 #define call_collate_wchar_do_hash(this, first, last) CALL_VTBL_FUNC(this, 12, LONG, \
1228 (const collate*, const wchar_t*, const wchar_t*), (this, first, last))
1229 LONG __thiscall collate_wchar_do_hash(const collate *this,
1230 const wchar_t *first, const wchar_t *last)
1232 ULONG ret = 0;
1234 TRACE("(%p %p %p)\n", this, first, last);
1236 for(; first<last; first++)
1237 ret = (ret<<8 | ret>>24) + *first;
1238 return ret;
1241 /* ?hash@?$collate@_W@std@@QBEJPB_W0@Z */
1242 /* ?hash@?$collate@_W@std@@QEBAJPEB_W0@Z */
1243 /* ?hash@?$collate@G@std@@QBEJPBG0@Z */
1244 /* ?hash@?$collate@G@std@@QEBAJPEBG0@Z */
1245 DEFINE_THISCALL_WRAPPER(collate_wchar_hash, 12)
1246 LONG __thiscall collate_wchar_hash(const collate *this,
1247 const wchar_t *first, const wchar_t *last)
1249 TRACE("(%p %p %p)\n", this, first, last);
1250 return call_collate_wchar_do_hash(this, first, last);
1253 /* ?do_transform@?$collate@_W@std@@MBE?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@PB_W0@Z */
1254 /* ?do_transform@?$collate@_W@std@@MEBA?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@PEB_W0@Z */
1255 /* ?do_transform@?$collate@G@std@@MBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@PBG0@Z */
1256 /* ?do_transform@?$collate@G@std@@MEBA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@PEBG0@Z */
1257 DEFINE_THISCALL_WRAPPER(collate_wchar_do_transform, 16)
1258 basic_string_wchar* __thiscall collate_wchar_do_transform(const collate *this,
1259 basic_string_wchar *ret, const wchar_t *first, const wchar_t *last)
1261 FIXME("(%p %p %p) stub\n", this, first, last);
1262 return ret;
1265 /* ?transform@?$collate@_W@std@@QBE?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@PB_W0@Z */
1266 /* ?transform@?$collate@_W@std@@QEBA?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@PEB_W0@Z */
1267 /* ?transform@?$collate@G@std@@QBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@PBG0@Z */
1268 /* ?transform@?$collate@G@std@@QEBA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@PEBG0@Z */
1269 DEFINE_THISCALL_WRAPPER(collate_wchar_transform, 16)
1270 basic_string_wchar* __thiscall collate_wchar_transform(const collate *this,
1271 basic_string_wchar *ret, const wchar_t *first, const wchar_t *last)
1273 FIXME("(%p %p %p) stub\n", this, first, last);
1274 return ret;
1277 /* ??_7ctype_base@std@@6B@ */
1278 extern const vtable_ptr MSVCP_ctype_base_vtable;
1280 /* ??0ctype_base@std@@QAE@I@Z */
1281 /* ??0ctype_base@std@@QEAA@_K@Z */
1282 DEFINE_THISCALL_WRAPPER(ctype_base_ctor_refs, 8)
1283 ctype_base* __thiscall ctype_base_ctor_refs(ctype_base *this, MSVCP_size_t refs)
1285 TRACE("(%p %lu)\n", this, refs);
1286 locale_facet_ctor_refs(&this->facet, refs);
1287 this->facet.vtable = &MSVCP_ctype_base_vtable;
1288 return this;
1291 /* ??_Fctype_base@std@@QAEXXZ */
1292 /* ??_Fctype_base@std@@QEAAXXZ */
1293 DEFINE_THISCALL_WRAPPER(ctype_base_ctor, 4)
1294 ctype_base* __thiscall ctype_base_ctor(ctype_base *this)
1296 TRACE("(%p)\n", this);
1297 locale_facet_ctor_refs(&this->facet, 0);
1298 this->facet.vtable = &MSVCP_ctype_base_vtable;
1299 return this;
1302 /* ??1ctype_base@std@@UAE@XZ */
1303 /* ??1ctype_base@std@@UEAA@XZ */
1304 DEFINE_THISCALL_WRAPPER(ctype_base_dtor, 4)
1305 void __thiscall ctype_base_dtor(ctype_base *this)
1307 TRACE("(%p)\n", this);
1310 DEFINE_THISCALL_WRAPPER(ctype_base_vector_dtor, 8)
1311 ctype_base* __thiscall ctype_base_vector_dtor(ctype_base *this, unsigned int flags)
1313 TRACE("(%p %x)\n", this, flags);
1314 if(flags & 2) {
1315 /* we have an array, with the number of elements stored before the first object */
1316 INT_PTR i, *ptr = (INT_PTR *)this-1;
1318 for(i=*ptr-1; i>=0; i--)
1319 ctype_base_dtor(this+i);
1320 MSVCRT_operator_delete(ptr);
1321 } else {
1322 ctype_base_dtor(this);
1323 if(flags & 1)
1324 MSVCRT_operator_delete(this);
1327 return this;
1330 /* ?_Xran@ctype_base@std@@KAXXZ */
1331 void __cdecl ctype_base__Xran(void)
1333 throw_exception(EXCEPTION_OUT_OF_RANGE, "out of range in ctype<T>");
1336 /* ?id@?$ctype@D@std@@2V0locale@2@A */
1337 locale_id ctype_char_id = {0};
1338 /* ?table_size@?$ctype@D@std@@2IB */
1339 /* ?table_size@?$ctype@D@std@@2_KB */
1340 MSVCP_size_t ctype_char_table_size = 256;
1342 /* ??_7?$ctype@D@std@@6B@ */
1343 extern const vtable_ptr MSVCP_ctype_char_vtable;
1345 /* ?_Id_func@?$ctype@D@std@@SAAAVid@locale@2@XZ */
1346 /* ?_Id_func@?$ctype@D@std@@SAAEAVid@locale@2@XZ */
1347 locale_id* __cdecl ctype_char__Id_func(void)
1349 TRACE("()\n");
1350 return &ctype_char_id;
1353 /* ?_Init@?$ctype@D@std@@IAEXABV_Locinfo@2@@Z */
1354 /* ?_Init@?$ctype@D@std@@IEAAXAEBV_Locinfo@2@@Z */
1355 DEFINE_THISCALL_WRAPPER(ctype_char__Init, 8)
1356 void __thiscall ctype_char__Init(ctype_char *this, const _Locinfo *locinfo)
1358 TRACE("(%p %p)\n", this, locinfo);
1359 _Locinfo__Getctype(locinfo, &this->ctype);
1362 /* ?_Tidy@?$ctype@D@std@@IAEXXZ */
1363 /* ?_Tidy@?$ctype@D@std@@IEAAXXZ */
1364 DEFINE_THISCALL_WRAPPER(ctype_char__Tidy, 4)
1365 void __thiscall ctype_char__Tidy(ctype_char *this)
1367 TRACE("(%p)\n", this);
1369 if(this->ctype.delfl)
1370 free((short*)this->ctype.table);
1373 /* ?classic_table@?$ctype@D@std@@KAPBFXZ */
1374 /* ?classic_table@?$ctype@D@std@@KAPEBFXZ */
1375 const short* __cdecl ctype_char_classic_table(void)
1377 TRACE("()\n");
1378 return &((short*)GetProcAddress(GetModuleHandleA("msvcrt.dll"), "_ctype"))[1];
1381 /* ??0?$ctype@D@std@@QAE@ABV_Locinfo@1@I@Z */
1382 /* ??0?$ctype@D@std@@QEAA@AEBV_Locinfo@1@_K@Z */
1383 DEFINE_THISCALL_WRAPPER(ctype_char_ctor_locinfo, 12)
1384 ctype_char* __thiscall ctype_char_ctor_locinfo(ctype_char *this,
1385 const _Locinfo *locinfo, MSVCP_size_t refs)
1387 TRACE("(%p %p %lu)\n", this, locinfo, refs);
1388 ctype_base_ctor_refs(&this->base, refs);
1389 this->base.facet.vtable = &MSVCP_ctype_char_vtable;
1390 ctype_char__Init(this, locinfo);
1391 return this;
1394 /* ??0?$ctype@D@std@@QAE@PBF_NI@Z */
1395 /* ??0?$ctype@D@std@@QEAA@PEBF_N_K@Z */
1396 DEFINE_THISCALL_WRAPPER(ctype_char_ctor_table, 16)
1397 ctype_char* __thiscall ctype_char_ctor_table(ctype_char *this,
1398 const short *table, MSVCP_bool delete, MSVCP_size_t refs)
1400 _Locinfo locinfo;
1402 TRACE("(%p %p %d %lu)\n", this, table, delete, refs);
1404 ctype_base_ctor_refs(&this->base, refs);
1405 this->base.facet.vtable = &MSVCP_ctype_char_vtable;
1407 _Locinfo_ctor(&locinfo);
1408 ctype_char__Init(this, &locinfo);
1409 _Locinfo_dtor(&locinfo);
1411 if(table) {
1412 ctype_char__Tidy(this);
1413 this->ctype.table = table;
1414 this->ctype.delfl = delete;
1416 return this;
1419 /* ??_F?$ctype@D@std@@QAEXXZ */
1420 /* ??_F?$ctype@D@std@@QEAAXXZ */
1421 DEFINE_THISCALL_WRAPPER(ctype_char_ctor, 4)
1422 ctype_char* __thiscall ctype_char_ctor(ctype_char *this)
1424 return ctype_char_ctor_table(this, NULL, FALSE, 0);
1427 /* ??1?$ctype@D@std@@MAE@XZ */
1428 /* ??1?$ctype@D@std@@MEAA@XZ */
1429 DEFINE_THISCALL_WRAPPER(ctype_char_dtor, 4)
1430 void __thiscall ctype_char_dtor(ctype_char *this)
1432 TRACE("(%p)\n", this);
1433 ctype_char__Tidy(this);
1436 DEFINE_THISCALL_WRAPPER(ctype_char_vector_dtor, 8)
1437 ctype_char* __thiscall ctype_char_vector_dtor(ctype_char *this, unsigned int flags)
1439 TRACE("(%p %x)\n", this, flags);
1440 if(flags & 2) {
1441 /* we have an array, with the number of elements stored before the first object */
1442 INT_PTR i, *ptr = (INT_PTR *)this-1;
1444 for(i=*ptr-1; i>=0; i--)
1445 ctype_char_dtor(this+i);
1446 MSVCRT_operator_delete(ptr);
1447 } else {
1448 ctype_char_dtor(this);
1449 if(flags & 1)
1450 MSVCRT_operator_delete(this);
1453 return this;
1456 /* ?do_narrow@?$ctype@D@std@@MBEDDD@Z */
1457 /* ?do_narrow@?$ctype@D@std@@MEBADDD@Z */
1458 DEFINE_THISCALL_WRAPPER(ctype_char_do_narrow_ch, 12)
1459 #define call_ctype_char_do_narrow_ch(this, ch, unused) CALL_VTBL_FUNC(this, 36, \
1460 char, (const ctype_char*, char, char), (this, ch, unused))
1461 char __thiscall ctype_char_do_narrow_ch(const ctype_char *this, char ch, char unused)
1463 TRACE("(%p %c %c)\n", this, ch, unused);
1464 return ch;
1467 /* ?do_narrow@?$ctype@D@std@@MBEPBDPBD0DPAD@Z */
1468 /* ?do_narrow@?$ctype@D@std@@MEBAPEBDPEBD0DPEAD@Z */
1469 DEFINE_THISCALL_WRAPPER(ctype_char_do_narrow, 20)
1470 #define call_ctype_char_do_narrow(this, first, last, unused, dest) CALL_VTBL_FUNC(this, 32, \
1471 const char*, (const ctype_char*, const char*, const char*, char, char*), \
1472 (this, first, last, unused, dest))
1473 const char* __thiscall ctype_char_do_narrow(const ctype_char *this,
1474 const char *first, const char *last, char unused, char *dest)
1476 TRACE("(%p %p %p %p)\n", this, first, last, dest);
1477 memcpy(dest, first, last-first);
1478 return last;
1481 /* ?_Do_narrow_s@?$ctype@D@std@@MBEPBDPBD0DPADI@Z */
1482 /* ?_Do_narrow_s@?$ctype@D@std@@MEBAPEBDPEBD0DPEAD_K@Z */
1483 DEFINE_THISCALL_WRAPPER(ctype_char__Do_narrow_s, 24)
1484 #define call_ctype_char__Do_narrow_s(this, first, last, unused, dest, size) CALL_VTBL_FUNC(this, 40, \
1485 const char*, (const ctype_char*, const char*, const char*, char, char*, MSVCP_size_t), \
1486 (this, first, last, unused, dest, size))
1487 const char* __thiscall ctype_char__Do_narrow_s(const ctype_char *this, const char *first,
1488 const char *last, char unused, char *dest, MSVCP_size_t size)
1490 TRACE("(%p %p %p %p %lu)\n", this, first, last, dest, size);
1491 memcpy_s(dest, size, first, last-first);
1492 return last;
1495 /* ?narrow@?$ctype@D@std@@QBEDDD@Z */
1496 /* ?narrow@?$ctype@D@std@@QEBADDD@Z */
1497 DEFINE_THISCALL_WRAPPER(ctype_char_narrow_ch, 12)
1498 char __thiscall ctype_char_narrow_ch(const ctype_char *this, char ch, char dflt)
1500 TRACE("(%p %c %c)\n", this, ch, dflt);
1501 return call_ctype_char_do_narrow_ch(this, ch, dflt);
1504 /* ?narrow@?$ctype@D@std@@QBEPBDPBD0DPAD@Z */
1505 /* ?narrow@?$ctype@D@std@@QEBAPEBDPEBD0DPEAD@Z */
1506 DEFINE_THISCALL_WRAPPER(ctype_char_narrow, 20)
1507 const char* __thiscall ctype_char_narrow(const ctype_char *this,
1508 const char *first, const char *last, char dflt, char *dest)
1510 TRACE("(%p %p %p %c %p)\n", this, first, last, dflt, dest);
1511 return call_ctype_char_do_narrow(this, first, last, dflt, dest);
1514 /* ?_Narrow_s@?$ctype@D@std@@QBEPBDPBD0DPADI@Z */
1515 /* ?_Narrow_s@?$ctype@D@std@@QEBAPEBDPEBD0DPEAD_K@Z */
1516 DEFINE_THISCALL_WRAPPER(ctype_char__Narrow_s, 24)
1517 const char* __thiscall ctype_char__Narrow_s(const ctype_char *this, const char *first,
1518 const char *last, char dflt, char *dest, MSVCP_size_t size)
1520 TRACE("(%p %p %p %p %lu)\n", this, first, last, dest, size);
1521 return call_ctype_char__Do_narrow_s(this, first, last, dflt, dest, size);
1524 /* ?do_widen@?$ctype@D@std@@MBEDD@Z */
1525 /* ?do_widen@?$ctype@D@std@@MEBADD@Z */
1526 DEFINE_THISCALL_WRAPPER(ctype_char_do_widen_ch, 8)
1527 #define call_ctype_char_do_widen_ch(this, ch) CALL_VTBL_FUNC(this, 24, \
1528 char, (const ctype_char*, char), (this, ch))
1529 char __thiscall ctype_char_do_widen_ch(const ctype_char *this, char ch)
1531 TRACE("(%p %c)\n", this, ch);
1532 return ch;
1535 /* ?do_widen@?$ctype@D@std@@MBEPBDPBD0PAD@Z */
1536 /* ?do_widen@?$ctype@D@std@@MEBAPEBDPEBD0PEAD@Z */
1537 DEFINE_THISCALL_WRAPPER(ctype_char_do_widen, 16)
1538 #define call_ctype_char_do_widen(this, first, last, dest) CALL_VTBL_FUNC(this, 20, \
1539 const char*, (const ctype_char*, const char*, const char*, char*), \
1540 (this, first, last, dest))
1541 const char* __thiscall ctype_char_do_widen(const ctype_char *this,
1542 const char *first, const char *last, char *dest)
1544 TRACE("(%p %p %p %p)\n", this, first, last, dest);
1545 memcpy(dest, first, last-first);
1546 return last;
1549 /* ?_Do_widen_s@?$ctype@D@std@@MBEPBDPBD0PADI@Z */
1550 /* ?_Do_widen_s@?$ctype@D@std@@MEBAPEBDPEBD0PEAD_K@Z */
1551 DEFINE_THISCALL_WRAPPER(ctype_char__Do_widen_s, 20)
1552 #define call_ctype_char__Do_widen_s(this, first, last, dest, size) CALL_VTBL_FUNC(this, 28, \
1553 const char*, (const ctype_char*, const char*, const char*, char*, MSVCP_size_t), \
1554 (this, first, last, dest, size))
1555 const char* __thiscall ctype_char__Do_widen_s(const ctype_char *this,
1556 const char *first, const char *last, char *dest, MSVCP_size_t size)
1558 TRACE("(%p %p %p %p %lu)\n", this, first, last, dest, size);
1559 memcpy_s(dest, size, first, last-first);
1560 return last;
1563 /* ?widen@?$ctype@D@std@@QBEDD@Z */
1564 /* ?widen@?$ctype@D@std@@QEBADD@Z */
1565 DEFINE_THISCALL_WRAPPER(ctype_char_widen_ch, 8)
1566 char __thiscall ctype_char_widen_ch(const ctype_char *this, char ch)
1568 TRACE("(%p %c)\n", this, ch);
1569 return call_ctype_char_do_widen_ch(this, ch);
1572 /* ?widen@?$ctype@D@std@@QBEPBDPBD0PAD@Z */
1573 /* ?widen@?$ctype@D@std@@QEBAPEBDPEBD0PEAD@Z */
1574 DEFINE_THISCALL_WRAPPER(ctype_char_widen, 16)
1575 const char* __thiscall ctype_char_widen(const ctype_char *this,
1576 const char *first, const char *last, char *dest)
1578 TRACE("(%p %p %p %p)\n", this, first, last, dest);
1579 return call_ctype_char_do_widen(this, first, last, dest);
1582 /* ?_Widen_s@?$ctype@D@std@@QBEPBDPBD0PADI@Z */
1583 /* ?_Widen_s@?$ctype@D@std@@QEBAPEBDPEBD0PEAD_K@Z */
1584 DEFINE_THISCALL_WRAPPER(ctype_char__Widen_s, 20)
1585 const char* __thiscall ctype_char__Widen_s(const ctype_char *this,
1586 const char *first, const char *last, char *dest, MSVCP_size_t size)
1588 TRACE("(%p %p %p %p %lu)\n", this, first, last, dest, size);
1589 return call_ctype_char__Do_widen_s(this, first, last, dest, size);
1592 /* ?_Getcat@?$ctype@D@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
1593 /* ?_Getcat@?$ctype@D@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
1594 static MSVCP_size_t ctype_char__Getcat(const locale_facet **facet, const locale *loc)
1596 TRACE("(%p %p)\n", facet, loc);
1598 if(facet && !*facet) {
1599 _Locinfo locinfo;
1601 *facet = MSVCRT_operator_new(sizeof(ctype_char));
1602 if(!*facet) {
1603 ERR("Out of memory\n");
1604 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
1605 return 0;
1608 _Locinfo_ctor_cstr(&locinfo, MSVCP_basic_string_char_c_str(&loc->ptr->name));
1609 ctype_char_ctor_locinfo((ctype_char*)*facet, &locinfo, 0);
1610 _Locinfo_dtor(&locinfo);
1613 return LC_CTYPE;
1616 /* ?_Getcat@?$ctype@D@std@@SAIPAPBVfacet@locale@2@@Z */
1617 /* ?_Getcat@?$ctype@D@std@@SA_KPEAPEBVfacet@locale@2@@Z */
1618 MSVCP_size_t __cdecl ctype_char__Getcat_old(const locale_facet **facet)
1620 return ctype_char__Getcat(facet, locale_classic());
1623 ctype_char* ctype_char_use_facet(const locale *loc)
1625 static ctype_char *obj = NULL;
1627 _Lockit lock;
1628 const locale_facet *fac;
1630 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
1631 fac = locale__Getfacet(loc, locale_id_operator_size_t(&ctype_char_id));
1632 if(fac) {
1633 _Lockit_dtor(&lock);
1634 return (ctype_char*)fac;
1637 if(obj) {
1638 _Lockit_dtor(&lock);
1639 return obj;
1642 ctype_char__Getcat(&fac, loc);
1643 obj = (ctype_char*)fac;
1644 locale_facet__Incref(&obj->base.facet);
1645 locale_facet_register(&obj->base.facet);
1646 _Lockit_dtor(&lock);
1648 return obj;
1651 /* _Tolower */
1652 int __cdecl _Tolower(int ch, const _Ctypevec *ctype)
1654 unsigned int cp;
1656 TRACE("%d %p\n", ch, ctype);
1658 if(ctype)
1659 cp = ctype->page;
1660 else
1661 cp = ___lc_codepage_func();
1663 /* Don't convert to unicode in case of C locale */
1664 if(!cp) {
1665 if(ch>='A' && ch<='Z')
1666 ch = ch-'A'+'a';
1667 return ch;
1668 } else {
1669 WCHAR wide, lower;
1670 char str[2];
1671 int size;
1673 if(ch > 255) {
1674 str[0] = (ch>>8) & 255;
1675 str[1] = ch & 255;
1676 size = 2;
1677 } else {
1678 str[0] = ch & 255;
1679 size = 1;
1682 if(!MultiByteToWideChar(cp, MB_ERR_INVALID_CHARS, str, size, &wide, 1))
1683 return ch;
1685 lower = tolowerW(wide);
1686 if(lower == wide)
1687 return ch;
1689 WideCharToMultiByte(cp, 0, &lower, 1, str, 2, NULL, NULL);
1691 return str[0] + (str[1]<<8);
1695 /* ?do_tolower@?$ctype@D@std@@MBEDD@Z */
1696 /* ?do_tolower@?$ctype@D@std@@MEBADD@Z */
1697 #define call_ctype_char_do_tolower_ch(this, ch) CALL_VTBL_FUNC(this, 8, \
1698 char, (const ctype_char*, char), (this, ch))
1699 DEFINE_THISCALL_WRAPPER(ctype_char_do_tolower_ch, 8)
1700 char __thiscall ctype_char_do_tolower_ch(const ctype_char *this, char ch)
1702 TRACE("(%p %c)\n", this, ch);
1703 return _Tolower(ch, &this->ctype);
1706 /* ?do_tolower@?$ctype@D@std@@MBEPBDPADPBD@Z */
1707 /* ?do_tolower@?$ctype@D@std@@MEBAPEBDPEADPEBD@Z */
1708 #define call_ctype_char_do_tolower(this, first, last) CALL_VTBL_FUNC(this, 4, \
1709 const char*, (const ctype_char*, char*, const char*), (this, first, last))
1710 DEFINE_THISCALL_WRAPPER(ctype_char_do_tolower, 12)
1711 const char* __thiscall ctype_char_do_tolower(const ctype_char *this, char *first, const char *last)
1713 TRACE("(%p %p %p)\n", this, first, last);
1714 for(; first<last; first++)
1715 *first = _Tolower(*first, &this->ctype);
1716 return last;
1719 /* ?tolower@?$ctype@D@std@@QBEDD@Z */
1720 /* ?tolower@?$ctype@D@std@@QEBADD@Z */
1721 DEFINE_THISCALL_WRAPPER(ctype_char_tolower_ch, 8)
1722 char __thiscall ctype_char_tolower_ch(const ctype_char *this, char ch)
1724 TRACE("(%p %c)\n", this, ch);
1725 return call_ctype_char_do_tolower_ch(this, ch);
1728 /* ?tolower@?$ctype@D@std@@QBEPBDPADPBD@Z */
1729 /* ?tolower@?$ctype@D@std@@QEBAPEBDPEADPEBD@Z */
1730 DEFINE_THISCALL_WRAPPER(ctype_char_tolower, 12)
1731 const char* __thiscall ctype_char_tolower(const ctype_char *this, char *first, const char *last)
1733 TRACE("(%p %p %p)\n", this, first, last);
1734 return call_ctype_char_do_tolower(this, first, last);
1737 /* _Toupper */
1738 int __cdecl _Toupper(int ch, const _Ctypevec *ctype)
1740 unsigned int cp;
1742 TRACE("%d %p\n", ch, ctype);
1744 if(ctype)
1745 cp = ctype->page;
1746 else
1747 cp = ___lc_codepage_func();
1749 /* Don't convert to unicode in case of C locale */
1750 if(!cp) {
1751 if(ch>='a' && ch<='z')
1752 ch = ch-'a'+'A';
1753 return ch;
1754 } else {
1755 WCHAR wide, upper;
1756 char str[2];
1757 int size;
1759 if(ch > 255) {
1760 str[0] = (ch>>8) & 255;
1761 str[1] = ch & 255;
1762 size = 2;
1763 } else {
1764 str[0] = ch & 255;
1765 size = 1;
1768 if(!MultiByteToWideChar(cp, MB_ERR_INVALID_CHARS, str, size, &wide, 1))
1769 return ch;
1771 upper = toupperW(wide);
1772 if(upper == wide)
1773 return ch;
1775 WideCharToMultiByte(cp, 0, &upper, 1, str, 2, NULL, NULL);
1777 return str[0] + (str[1]<<8);
1781 /* ?do_toupper@?$ctype@D@std@@MBEDD@Z */
1782 /* ?do_toupper@?$ctype@D@std@@MEBADD@Z */
1783 #define call_ctype_char_do_toupper_ch(this, ch) CALL_VTBL_FUNC(this, 16, \
1784 char, (const ctype_char*, char), (this, ch))
1785 DEFINE_THISCALL_WRAPPER(ctype_char_do_toupper_ch, 8)
1786 char __thiscall ctype_char_do_toupper_ch(const ctype_char *this, char ch)
1788 TRACE("(%p %c)\n", this, ch);
1789 return _Toupper(ch, &this->ctype);
1792 /* ?do_toupper@?$ctype@D@std@@MBEPBDPADPBD@Z */
1793 /* ?do_toupper@?$ctype@D@std@@MEBAPEBDPEADPEBD@Z */
1794 #define call_ctype_char_do_toupper(this, first, last) CALL_VTBL_FUNC(this, 12, \
1795 const char*, (const ctype_char*, char*, const char*), (this, first, last))
1796 DEFINE_THISCALL_WRAPPER(ctype_char_do_toupper, 12)
1797 const char* __thiscall ctype_char_do_toupper(const ctype_char *this,
1798 char *first, const char *last)
1800 TRACE("(%p %p %p)\n", this, first, last);
1801 for(; first<last; first++)
1802 *first = _Toupper(*first, &this->ctype);
1803 return last;
1806 /* ?toupper@?$ctype@D@std@@QBEDD@Z */
1807 /* ?toupper@?$ctype@D@std@@QEBADD@Z */
1808 DEFINE_THISCALL_WRAPPER(ctype_char_toupper_ch, 8)
1809 char __thiscall ctype_char_toupper_ch(const ctype_char *this, char ch)
1811 TRACE("(%p %c)\n", this, ch);
1812 return call_ctype_char_do_toupper_ch(this, ch);
1815 /* ?toupper@?$ctype@D@std@@QBEPBDPADPBD@Z */
1816 /* ?toupper@?$ctype@D@std@@QEBAPEBDPEADPEBD@Z */
1817 DEFINE_THISCALL_WRAPPER(ctype_char_toupper, 12)
1818 const char* __thiscall ctype_char_toupper(const ctype_char *this, char *first, const char *last)
1820 TRACE("(%p %p %p)\n", this, first, last);
1821 return call_ctype_char_do_toupper(this, first, last);
1824 /* ?is@?$ctype@D@std@@QBE_NFD@Z */
1825 /* ?is@?$ctype@D@std@@QEBA_NFD@Z */
1826 DEFINE_THISCALL_WRAPPER(ctype_char_is_ch, 12)
1827 MSVCP_bool __thiscall ctype_char_is_ch(const ctype_char *this, short mask, char ch)
1829 TRACE("(%p %x %c)\n", this, mask, ch);
1830 return (this->ctype.table[(unsigned char)ch] & mask) != 0;
1833 /* ?is@?$ctype@D@std@@QBEPBDPBD0PAF@Z */
1834 /* ?is@?$ctype@D@std@@QEBAPEBDPEBD0PEAF@Z */
1835 DEFINE_THISCALL_WRAPPER(ctype_char_is, 16)
1836 const char* __thiscall ctype_char_is(const ctype_char *this, const char *first, const char *last, short *dest)
1838 TRACE("(%p %p %p %p)\n", this, first, last, dest);
1839 for(; first<last; first++)
1840 *dest++ = this->ctype.table[(unsigned char)*first];
1841 return last;
1844 /* ?scan_is@?$ctype@D@std@@QBEPBDFPBD0@Z */
1845 /* ?scan_is@?$ctype@D@std@@QEBAPEBDFPEBD0@Z */
1846 DEFINE_THISCALL_WRAPPER(ctype_char_scan_is, 16)
1847 const char* __thiscall ctype_char_scan_is(const ctype_char *this, short mask, const char *first, const char *last)
1849 TRACE("(%p %x %p %p)\n", this, mask, first, last);
1850 for(; first<last; first++)
1851 if(!ctype_char_is_ch(this, mask, *first))
1852 break;
1853 return first;
1856 /* ?scan_not@?$ctype@D@std@@QBEPBDFPBD0@Z */
1857 /* ?scan_not@?$ctype@D@std@@QEBAPEBDFPEBD0@Z */
1858 DEFINE_THISCALL_WRAPPER(ctype_char_scan_not, 16)
1859 const char* __thiscall ctype_char_scan_not(const ctype_char *this, short mask, const char *first, const char *last)
1861 TRACE("(%p %x %p %p)\n", this, mask, first, last);
1862 for(; first<last; first++)
1863 if(ctype_char_is_ch(this, mask, *first))
1864 break;
1865 return first;
1868 /* ?table@?$ctype@D@std@@IBEPBFXZ */
1869 /* ?table@?$ctype@D@std@@IEBAPEBFXZ */
1870 DEFINE_THISCALL_WRAPPER(ctype_char_table, 4)
1871 const short* __thiscall ctype_char_table(const ctype_char *this)
1873 TRACE("(%p)\n", this);
1874 return this->ctype.table;
1877 /* ?id@?$ctype@_W@std@@2V0locale@2@A */
1878 locale_id ctype_wchar_id = {0};
1879 /* ?id@?$ctype@G@std@@2V0locale@2@A */
1880 locale_id ctype_short_id = {0};
1882 /* ??_7?$ctype@_W@std@@6B@ */
1883 extern const vtable_ptr MSVCP_ctype_wchar_vtable;
1884 /* ??_7?$ctype@G@std@@6B@ */
1885 extern const vtable_ptr MSVCP_ctype_short_vtable;
1887 /* ?_Id_func@?$ctype@_W@std@@SAAAVid@locale@2@XZ */
1888 /* ?_Id_func@?$ctype@_W@std@@SAAEAVid@locale@2@XZ */
1889 locale_id* __cdecl ctype_wchar__Id_func(void)
1891 TRACE("()\n");
1892 return &ctype_wchar_id;
1895 /* ?_Id_func@?$ctype@G@std@@SAAAVid@locale@2@XZ */
1896 /* ?_Id_func@?$ctype@G@std@@SAAEAVid@locale@2@XZ */
1897 locale_id* __cdecl ctype_short__Id_func(void)
1899 TRACE("()\n");
1900 return &ctype_short_id;
1903 /* ?_Init@?$ctype@_W@std@@IAEXABV_Locinfo@2@@Z */
1904 /* ?_Init@?$ctype@_W@std@@IEAAXAEBV_Locinfo@2@@Z */
1905 /* ?_Init@?$ctype@G@std@@IAEXABV_Locinfo@2@@Z */
1906 /* ?_Init@?$ctype@G@std@@IEAAXAEBV_Locinfo@2@@Z */
1907 DEFINE_THISCALL_WRAPPER(ctype_wchar__Init, 8)
1908 void __thiscall ctype_wchar__Init(ctype_wchar *this, const _Locinfo *locinfo)
1910 TRACE("(%p %p)\n", this, locinfo);
1911 _Locinfo__Getctype(locinfo, &this->ctype);
1912 _Locinfo__Getcvt(locinfo, &this->cvt);
1915 /* ??0?$ctype@_W@std@@QAE@ABV_Locinfo@1@I@Z */
1916 /* ??0?$ctype@_W@std@@QEAA@AEBV_Locinfo@1@_K@Z */
1917 DEFINE_THISCALL_WRAPPER(ctype_wchar_ctor_locinfo, 12)
1918 ctype_wchar* __thiscall ctype_wchar_ctor_locinfo(ctype_wchar *this,
1919 const _Locinfo *locinfo, MSVCP_size_t refs)
1921 TRACE("(%p %p %lu)\n", this, locinfo, refs);
1922 ctype_base_ctor_refs(&this->base, refs);
1923 this->base.facet.vtable = &MSVCP_ctype_wchar_vtable;
1924 ctype_wchar__Init(this, locinfo);
1925 return this;
1928 /* ??0?$ctype@G@std@@QAE@ABV_Locinfo@1@I@Z */
1929 /* ??0?$ctype@G@std@@QEAA@AEBV_Locinfo@1@_K@Z */
1930 DEFINE_THISCALL_WRAPPER(ctype_short_ctor_locinfo, 12)
1931 ctype_wchar* __thiscall ctype_short_ctor_locinfo(ctype_wchar *this,
1932 const _Locinfo *locinfo, MSVCP_size_t refs)
1934 ctype_wchar *ret = ctype_wchar_ctor_locinfo(this, locinfo, refs);
1935 this->base.facet.vtable = &MSVCP_ctype_short_vtable;
1936 return ret;
1939 /* ??0?$ctype@_W@std@@QAE@I@Z */
1940 /* ??0?$ctype@_W@std@@QEAA@_K@Z */
1941 DEFINE_THISCALL_WRAPPER(ctype_wchar_ctor_refs, 8)
1942 ctype_wchar* __thiscall ctype_wchar_ctor_refs(ctype_wchar *this, MSVCP_size_t refs)
1944 _Locinfo locinfo;
1946 TRACE("(%p %lu)\n", this, refs);
1948 ctype_base_ctor_refs(&this->base, refs);
1949 this->base.facet.vtable = &MSVCP_ctype_wchar_vtable;
1951 _Locinfo_ctor(&locinfo);
1952 ctype_wchar__Init(this, &locinfo);
1953 _Locinfo_dtor(&locinfo);
1954 return this;
1957 /* ??0?$ctype@G@std@@QAE@I@Z */
1958 /* ??0?$ctype@G@std@@QEAA@_K@Z */
1959 DEFINE_THISCALL_WRAPPER(ctype_short_ctor_refs, 8)
1960 ctype_wchar* __thiscall ctype_short_ctor_refs(ctype_wchar *this, MSVCP_size_t refs)
1962 ctype_wchar *ret = ctype_wchar_ctor_refs(this, refs);
1963 this->base.facet.vtable = &MSVCP_ctype_short_vtable;
1964 return ret;
1967 /* ??0?$ctype@G@std@@IAE@PBDI@Z */
1968 /* ??0?$ctype@G@std@@IEAA@PEBD_K@Z */
1969 DEFINE_THISCALL_WRAPPER(ctype_short_ctor_name, 12)
1970 ctype_wchar* __thiscall ctype_short_ctor_name(ctype_wchar *this,
1971 const char *name, MSVCP_size_t refs)
1973 _Locinfo locinfo;
1975 TRACE("(%p %s %lu)\n", this, debugstr_a(name), refs);
1977 ctype_base_ctor_refs(&this->base, refs);
1978 this->base.facet.vtable = &MSVCP_ctype_short_vtable;
1980 _Locinfo_ctor_cstr(&locinfo, name);
1981 ctype_wchar__Init(this, &locinfo);
1982 _Locinfo_dtor(&locinfo);
1983 return this;
1986 /* ??_F?$ctype@_W@std@@QAEXXZ */
1987 /* ??_F?$ctype@_W@std@@QEAAXXZ */
1988 DEFINE_THISCALL_WRAPPER(ctype_wchar_ctor, 4)
1989 ctype_wchar* __thiscall ctype_wchar_ctor(ctype_wchar *this)
1991 TRACE("(%p)\n", this);
1992 return ctype_short_ctor_refs(this, 0);
1995 /* ??_F?$ctype@G@std@@QAEXXZ */
1996 /* ??_F?$ctype@G@std@@QEAAXXZ */
1997 DEFINE_THISCALL_WRAPPER(ctype_short_ctor, 4)
1998 ctype_wchar* __thiscall ctype_short_ctor(ctype_wchar *this)
2000 ctype_wchar *ret = ctype_wchar_ctor(this);
2001 this->base.facet.vtable = &MSVCP_ctype_short_vtable;
2002 return ret;
2005 /* ??1?$ctype@_W@std@@MAE@XZ */
2006 /* ??1?$ctype@_W@std@@MEAA@XZ */
2007 /* ??1?$ctype@G@std@@MAE@XZ */
2008 /* ??1?$ctype@G@std@@MEAA@XZ */
2009 DEFINE_THISCALL_WRAPPER(ctype_wchar_dtor, 4)
2010 void __thiscall ctype_wchar_dtor(ctype_wchar *this)
2012 TRACE("(%p)\n", this);
2013 if(this->ctype.delfl)
2014 free((void*)this->ctype.table);
2017 DEFINE_THISCALL_WRAPPER(ctype_wchar_vector_dtor, 8)
2018 ctype_wchar* __thiscall ctype_wchar_vector_dtor(ctype_wchar *this, unsigned int flags)
2020 TRACE("(%p %x)\n", this, flags);
2021 if(flags & 2) {
2022 /* we have an array, with the number of elements stored before the first object */
2023 INT_PTR i, *ptr = (INT_PTR *)this-1;
2025 for(i=*ptr-1; i>=0; i--)
2026 ctype_wchar_dtor(this+i);
2027 MSVCRT_operator_delete(ptr);
2028 } else {
2029 ctype_wchar_dtor(this);
2030 if(flags & 1)
2031 MSVCRT_operator_delete(this);
2034 return this;
2037 /* _Wcrtomb */
2038 int __cdecl _Wcrtomb(char *s, wchar_t wch, int *state, const _Cvtvec *cvt)
2040 int cp, size;
2041 BOOL def;
2043 TRACE("%p %d %p %p\n", s, wch, state, cvt);
2045 if(cvt)
2046 cp = cvt->page;
2047 else
2048 cp = ___lc_codepage_func();
2050 if(!cp) {
2051 if(wch > 255) {
2052 *_errno() = EILSEQ;
2053 return -1;
2056 *s = wch & 255;
2057 return 1;
2060 size = WideCharToMultiByte(cp, 0, &wch, 1, s, MB_LEN_MAX, NULL, &def);
2061 if(!size || def) {
2062 *_errno() = EILSEQ;
2063 return -1;
2066 return size;
2069 /* ?_Donarrow@?$ctype@_W@std@@IBED_WD@Z */
2070 /* ?_Donarrow@?$ctype@_W@std@@IEBAD_WD@Z */
2071 /* ?_Donarrow@?$ctype@G@std@@IBEDGD@Z */
2072 /* ?_Donarrow@?$ctype@G@std@@IEBADGD@Z */
2073 DEFINE_THISCALL_WRAPPER(ctype_wchar__Donarrow, 12)
2074 char __thiscall ctype_wchar__Donarrow(const ctype_wchar *this, wchar_t ch, char dflt)
2076 char buf[MB_LEN_MAX];
2078 TRACE("(%p %d %d)\n", this, ch, dflt);
2080 return _Wcrtomb(buf, ch, NULL, &this->cvt)==1 ? buf[0] : dflt;
2083 /* ?do_narrow@?$ctype@_W@std@@MBED_WD@Z */
2084 /* ?do_narrow@?$ctype@_W@std@@MEBAD_WD@Z */
2085 /* ?do_narrow@?$ctype@G@std@@MBEDGD@Z */
2086 /* ?do_narrow@?$ctype@G@std@@MEBADGD@Z */
2087 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_narrow_ch, 12)
2088 #define call_ctype_wchar_do_narrow_ch(this, ch, dflt) CALL_VTBL_FUNC(this, 52, \
2089 char, (const ctype_wchar*, wchar_t, char), (this, ch, dflt))
2090 char __thiscall ctype_wchar_do_narrow_ch(const ctype_wchar *this, wchar_t ch, char dflt)
2092 return ctype_wchar__Donarrow(this, ch, dflt);
2095 /* ?do_narrow@?$ctype@_W@std@@MBEPB_WPB_W0DPAD@Z */
2096 /* ?do_narrow@?$ctype@_W@std@@MEBAPEB_WPEB_W0DPEAD@Z */
2097 /* ?do_narrow@?$ctype@G@std@@MBEPBGPBG0DPAD@Z */
2098 /* ?do_narrow@?$ctype@G@std@@MEBAPEBGPEBG0DPEAD@Z */
2099 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_narrow, 20)
2100 #define call_ctype_wchar_do_narrow(this, first, last, dflt, dest) CALL_VTBL_FUNC(this, 48, \
2101 const wchar_t*, (const ctype_wchar*, const wchar_t*, const wchar_t*, char, char*), \
2102 (this, first, last, dflt, dest))
2103 const wchar_t* __thiscall ctype_wchar_do_narrow(const ctype_wchar *this,
2104 const wchar_t *first, const wchar_t *last, char dflt, char *dest)
2106 TRACE("(%p %p %p %d %p)\n", this, first, last, dflt, dest);
2107 for(; first<last; first++)
2108 *dest++ = ctype_wchar__Donarrow(this, *first, dflt);
2109 return last;
2112 /* ?_Do_narrow_s@?$ctype@_W@std@@MBEPB_WPB_W0DPADI@Z */
2113 /* ?_Do_narrow_s@?$ctype@_W@std@@MEBAPEB_WPEB_W0DPEAD_K@Z */
2114 /* ?_Do_narrow_s@?$ctype@G@std@@MBEPBGPBG0DPADI@Z */
2115 /* ?_Do_narrow_s@?$ctype@G@std@@MEBAPEBGPEBG0DPEAD_K@Z */
2116 DEFINE_THISCALL_WRAPPER(ctype_wchar__Do_narrow_s, 24)
2117 #define call_ctype_wchar__Do_narrow_s(this, first, last, dflt, dest, size) CALL_VTBL_FUNC(this, 56, \
2118 const wchar_t*, (const ctype_wchar*, const wchar_t*, const wchar_t*, char, char*, MSVCP_size_t), \
2119 (this, first, last, dflt, dest, size))
2120 const wchar_t* __thiscall ctype_wchar__Do_narrow_s(const ctype_wchar *this,
2121 const wchar_t *first, const wchar_t *last, char dflt, char *dest, MSVCP_size_t size)
2123 TRACE("(%p %p %p %d %p %lu)\n", this, first, last, dflt, dest, size);
2124 /* This function converts all multi-byte characters to dflt,
2125 * thanks to it result size is known before converting */
2126 if(last-first > size)
2127 ctype_base__Xran();
2128 return ctype_wchar_do_narrow(this, first, last, dflt, dest);
2131 /* ?narrow@?$ctype@_W@std@@QBED_WD@Z */
2132 /* ?narrow@?$ctype@_W@std@@QEBAD_WD@Z */
2133 /* ?narrow@?$ctype@G@std@@QBEDGD@Z */
2134 /* ?narrow@?$ctype@G@std@@QEBADGD@Z */
2135 DEFINE_THISCALL_WRAPPER(ctype_wchar_narrow_ch, 12)
2136 char __thiscall ctype_wchar_narrow_ch(const ctype_wchar *this, wchar_t ch, char dflt)
2138 TRACE("(%p %d %d)\n", this, ch, dflt);
2139 return call_ctype_wchar_do_narrow_ch(this, ch, dflt);
2142 /* ?narrow@?$ctype@_W@std@@QBEPB_WPB_W0DPAD@Z */
2143 /* ?narrow@?$ctype@_W@std@@QEBAPEB_WPEB_W0DPEAD@Z */
2144 /* ?narrow@?$ctype@G@std@@QBEPBGPBG0DPAD@Z */
2145 /* ?narrow@?$ctype@G@std@@QEBAPEBGPEBG0DPEAD@Z */
2146 DEFINE_THISCALL_WRAPPER(ctype_wchar_narrow, 20)
2147 const wchar_t* __thiscall ctype_wchar_narrow(const ctype_wchar *this,
2148 const wchar_t *first, const wchar_t *last, char dflt, char *dest)
2150 TRACE("(%p %p %p %d %p)\n", this, first, last, dflt, dest);
2151 return call_ctype_wchar_do_narrow(this, first, last, dflt, dest);
2154 /* ?_Narrow_s@?$ctype@_W@std@@QBEPB_WPB_W0DPADI@Z */
2155 /* ?_Narrow_s@?$ctype@_W@std@@QEBAPEB_WPEB_W0DPEAD_K@Z */
2156 /* ?_Narrow_s@?$ctype@G@std@@QBEPBGPBG0DPADI@Z */
2157 /* ?_Narrow_s@?$ctype@G@std@@QEBAPEBGPEBG0DPEAD_K@Z */
2158 DEFINE_THISCALL_WRAPPER(ctype_wchar__Narrow_s, 24)
2159 const wchar_t* __thiscall ctype_wchar__Narrow_s(const ctype_wchar *this, const wchar_t *first,
2160 const wchar_t *last, char dflt, char *dest, MSVCP_size_t size)
2162 TRACE("(%p %p %p %d %p %lu)\n", this, first, last, dflt, dest, size);
2163 return call_ctype_wchar__Do_narrow_s(this, first, last, dflt, dest, size);
2166 /* _Mbrtowc */
2167 int __cdecl _Mbrtowc(wchar_t *out, const char *in, MSVCP_size_t len, int *state, const _Cvtvec *cvt)
2169 int i, cp;
2170 CPINFO cp_info;
2171 BOOL is_lead;
2173 TRACE("(%p %p %lu %p %p)\n", out, in, len, state, cvt);
2175 if(!len)
2176 return 0;
2178 if(cvt)
2179 cp = cvt->page;
2180 else
2181 cp = ___lc_codepage_func();
2183 if(!cp) {
2184 if(out)
2185 *out = (unsigned char)*in;
2187 *state = 0;
2188 return *in ? 1 : 0;
2191 if(*state) {
2192 ((char*)state)[1] = *in;
2194 if(!MultiByteToWideChar(cp, MB_ERR_INVALID_CHARS, (char*)state, 2, out, out ? 1 : 0)) {
2195 *state = 0;
2196 *_errno() = EILSEQ;
2197 return -1;
2200 *state = 0;
2201 return 2;
2204 GetCPInfo(cp, &cp_info);
2205 is_lead = FALSE;
2206 for(i=0; i<MAX_LEADBYTES; i+=2) {
2207 if(!cp_info.LeadByte[i+1])
2208 break;
2209 if((unsigned char)*in>=cp_info.LeadByte[i] && (unsigned char)*in<=cp_info.LeadByte[i+1]) {
2210 is_lead = TRUE;
2211 break;
2215 if(is_lead) {
2216 if(len == 1) {
2217 *state = (unsigned char)*in;
2218 return -2;
2221 if(!MultiByteToWideChar(cp, MB_ERR_INVALID_CHARS, in, 2, out, out ? 1 : 0)) {
2222 *_errno() = EILSEQ;
2223 return -1;
2225 return 2;
2228 if(!MultiByteToWideChar(cp, MB_ERR_INVALID_CHARS, in, 1, out, out ? 1 : 0)) {
2229 *_errno() = EILSEQ;
2230 return -1;
2232 return 1;
2235 /* ?_Dowiden@?$ctype@_W@std@@IBE_WD@Z */
2236 /* ?_Dowiden@?$ctype@_W@std@@IEBA_WD@Z */
2237 /* ?_Dowiden@?$ctype@G@std@@IBEGD@Z */
2238 /* ?_Dowiden@?$ctype@G@std@@IEBAGD@Z */
2239 DEFINE_THISCALL_WRAPPER(ctype_wchar__Dowiden, 8)
2240 wchar_t __thiscall ctype_wchar__Dowiden(const ctype_wchar *this, char ch)
2242 wchar_t ret;
2243 int state = 0;
2244 TRACE("(%p %d)\n", this, ch);
2245 return _Mbrtowc(&ret, &ch, 1, &state, &this->cvt)<0 ? WEOF : ret;
2248 /* ?do_widen@?$ctype@_W@std@@MBE_WD@Z */
2249 /* ?do_widen@?$ctype@_W@std@@MEBA_WD@Z */
2250 /* ?do_widen@?$ctype@G@std@@MBEGD@Z */
2251 /* ?do_widen@?$ctype@G@std@@MEBAGD@Z */
2252 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_widen_ch, 8)
2253 #define call_ctype_wchar_do_widen_ch(this, ch) CALL_VTBL_FUNC(this, 40, \
2254 wchar_t, (const ctype_wchar*, char), (this, ch))
2255 wchar_t __thiscall ctype_wchar_do_widen_ch(const ctype_wchar *this, char ch)
2257 return ctype_wchar__Dowiden(this, ch);
2260 /* ?do_widen@?$ctype@_W@std@@MBEPBDPBD0PA_W@Z */
2261 /* ?do_widen@?$ctype@_W@std@@MEBAPEBDPEBD0PEA_W@Z */
2262 /* ?do_widen@?$ctype@G@std@@MBEPBDPBD0PAG@Z */
2263 /* ?do_widen@?$ctype@G@std@@MEBAPEBDPEBD0PEAG@Z */
2264 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_widen, 16)
2265 #define call_ctype_wchar_do_widen(this, first, last, dest) CALL_VTBL_FUNC(this, 36, \
2266 const char*, (const ctype_wchar*, const char*, const char*, wchar_t*), \
2267 (this, first, last, dest))
2268 const char* __thiscall ctype_wchar_do_widen(const ctype_wchar *this,
2269 const char *first, const char *last, wchar_t *dest)
2271 TRACE("(%p %p %p %p)\n", this, first, last, dest);
2272 for(; first<last; first++)
2273 *dest++ = ctype_wchar__Dowiden(this, *first);
2274 return last;
2277 /* ?_Do_widen_s@?$ctype@_W@std@@MBEPBDPBD0PA_WI@Z */
2278 /* ?_Do_widen_s@?$ctype@_W@std@@MEBAPEBDPEBD0PEA_W_K@Z */
2279 /* ?_Do_widen_s@?$ctype@G@std@@MBEPBDPBD0PAGI@Z */
2280 /* ?_Do_widen_s@?$ctype@G@std@@MEBAPEBDPEBD0PEAG_K@Z */
2281 DEFINE_THISCALL_WRAPPER(ctype_wchar__Do_widen_s, 20)
2282 #define call_ctype_wchar__Do_widen_s(this, first, last, dest, size) CALL_VTBL_FUNC(this, 44, \
2283 const char*, (const ctype_wchar*, const char*, const char*, wchar_t*, MSVCP_size_t), \
2284 (this, first, last, dest, size))
2285 const char* __thiscall ctype_wchar__Do_widen_s(const ctype_wchar *this,
2286 const char *first, const char *last, wchar_t *dest, MSVCP_size_t size)
2288 TRACE("(%p %p %p %p %lu)\n", this, first, last, dest, size);
2289 /* This function converts all multi-byte characters to WEOF,
2290 * thanks to it result size is known before converting */
2291 if(size < last-first)
2292 ctype_base__Xran();
2293 return ctype_wchar_do_widen(this, first, last, dest);
2296 /* ?widen@?$ctype@_W@std@@QBE_WD@Z */
2297 /* ?widen@?$ctype@_W@std@@QEBA_WD@Z */
2298 /* ?widen@?$ctype@G@std@@QBEGD@Z */
2299 /* ?widen@?$ctype@G@std@@QEBAGD@Z */
2300 DEFINE_THISCALL_WRAPPER(ctype_wchar_widen_ch, 8)
2301 wchar_t __thiscall ctype_wchar_widen_ch(const ctype_wchar *this, char ch)
2303 TRACE("(%p %d)\n", this, ch);
2304 return call_ctype_wchar_do_widen_ch(this, ch);
2307 /* ?widen@?$ctype@_W@std@@QBEPBDPBD0PA_W@Z */
2308 /* ?widen@?$ctype@_W@std@@QEBAPEBDPEBD0PEA_W@Z */
2309 /* ?widen@?$ctype@G@std@@QBEPBDPBD0PAG@Z */
2310 /* ?widen@?$ctype@G@std@@QEBAPEBDPEBD0PEAG@Z */
2311 DEFINE_THISCALL_WRAPPER(ctype_wchar_widen, 16)
2312 const char* __thiscall ctype_wchar_widen(const ctype_wchar *this,
2313 const char *first, const char *last, wchar_t *dest)
2315 TRACE("(%p %p %p %p)\n", this, first, last, dest);
2316 return call_ctype_wchar_do_widen(this, first, last, dest);
2319 /* ?_Widen_s@?$ctype@_W@std@@QBEPBDPBD0PA_WI@Z */
2320 /* ?_Widen_s@?$ctype@_W@std@@QEBAPEBDPEBD0PEA_W_K@Z */
2321 /* ?_Widen_s@?$ctype@G@std@@QBEPBDPBD0PAGI@Z */
2322 /* ?_Widen_s@?$ctype@G@std@@QEBAPEBDPEBD0PEAG_K@Z */
2323 DEFINE_THISCALL_WRAPPER(ctype_wchar__Widen_s, 20)
2324 const char* __thiscall ctype_wchar__Widen_s(const ctype_wchar *this,
2325 const char *first, const char *last, wchar_t *dest, MSVCP_size_t size)
2327 TRACE("(%p %p %p %p %lu)\n", this, first, last, dest, size);
2328 return call_ctype_wchar__Do_widen_s(this, first, last, dest, size);
2331 /* ?_Getcat@?$ctype@_W@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
2332 /* ?_Getcat@?$ctype@_W@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
2333 static MSVCP_size_t ctype_wchar__Getcat(const locale_facet **facet, const locale *loc)
2335 TRACE("(%p %p)\n", facet, loc);
2337 if(facet && !*facet) {
2338 _Locinfo locinfo;
2340 *facet = MSVCRT_operator_new(sizeof(ctype_wchar));
2341 if(!*facet) {
2342 ERR("Out of memory\n");
2343 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
2344 return 0;
2347 _Locinfo_ctor_cstr(&locinfo, MSVCP_basic_string_char_c_str(&loc->ptr->name));
2348 ctype_wchar_ctor_locinfo((ctype_wchar*)*facet, &locinfo, 0);
2349 _Locinfo_dtor(&locinfo);
2352 return LC_CTYPE;
2355 /* ?_Getcat@?$ctype@_W@std@@SAIPAPBVfacet@locale@2@@Z */
2356 /* ?_Getcat@?$ctype@_W@std@@SA_KPEAPEBVfacet@locale@2@@Z */
2357 MSVCP_size_t __cdecl ctype_wchar__Getcat_old(const locale_facet **facet)
2359 return ctype_wchar__Getcat(facet, locale_classic());
2362 /* ?_Getcat@?$ctype@G@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
2363 /* ?_Getcat@?$ctype@G@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
2364 static MSVCP_size_t ctype_short__Getcat(const locale_facet **facet, const locale *loc)
2366 if(facet && !*facet) {
2367 ctype_wchar__Getcat(facet, loc);
2368 (*(locale_facet**)facet)->vtable = &MSVCP_ctype_short_vtable;
2371 return LC_CTYPE;
2374 /* ?_Getcat@?$ctype@G@std@@SAIPAPBVfacet@locale@2@@Z */
2375 /* ?_Getcat@?$ctype@G@std@@SA_KPEAPEBVfacet@locale@2@@Z */
2376 MSVCP_size_t __cdecl ctype_short__Getcat_old(const locale_facet **facet)
2378 return ctype_short__Getcat(facet, locale_classic());
2381 /* _Towlower */
2382 wchar_t __cdecl _Towlower(wchar_t ch, const _Ctypevec *ctype)
2384 TRACE("(%d %p)\n", ch, ctype);
2385 return tolowerW(ch);
2388 ctype_wchar* ctype_wchar_use_facet(const locale *loc)
2390 static ctype_wchar *obj = NULL;
2392 _Lockit lock;
2393 const locale_facet *fac;
2395 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
2396 fac = locale__Getfacet(loc, locale_id_operator_size_t(&ctype_wchar_id));
2397 if(fac) {
2398 _Lockit_dtor(&lock);
2399 return (ctype_wchar*)fac;
2402 if(obj) {
2403 _Lockit_dtor(&lock);
2404 return obj;
2407 ctype_wchar__Getcat(&fac, loc);
2408 obj = (ctype_wchar*)fac;
2409 locale_facet__Incref(&obj->base.facet);
2410 locale_facet_register(&obj->base.facet);
2411 _Lockit_dtor(&lock);
2413 return obj;
2416 ctype_wchar* ctype_short_use_facet(const locale *loc)
2418 static ctype_wchar *obj = NULL;
2420 _Lockit lock;
2421 const locale_facet *fac;
2423 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
2424 fac = locale__Getfacet(loc, locale_id_operator_size_t(&ctype_short_id));
2425 if(fac) {
2426 _Lockit_dtor(&lock);
2427 return (ctype_wchar*)fac;
2430 if(obj) {
2431 _Lockit_dtor(&lock);
2432 return obj;
2435 ctype_short__Getcat(&fac, loc);
2436 obj = (ctype_wchar*)fac;
2437 locale_facet__Incref(&obj->base.facet);
2438 locale_facet_register(&obj->base.facet);
2439 _Lockit_dtor(&lock);
2441 return obj;
2444 /* ?do_tolower@?$ctype@_W@std@@MBE_W_W@Z */
2445 /* ?do_tolower@?$ctype@_W@std@@MEBA_W_W@Z */
2446 /* ?do_tolower@?$ctype@G@std@@MBEGG@Z */
2447 /* ?do_tolower@?$ctype@G@std@@MEBAGG@Z */
2448 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_tolower_ch, 8)
2449 #define call_ctype_wchar_do_tolower_ch(this, ch) CALL_VTBL_FUNC(this, 24, \
2450 wchar_t, (const ctype_wchar*, wchar_t), (this, ch))
2451 wchar_t __thiscall ctype_wchar_do_tolower_ch(const ctype_wchar *this, wchar_t ch)
2453 return _Towlower(ch, &this->ctype);
2456 /* ?do_tolower@?$ctype@_W@std@@MBEPB_WPA_WPB_W@Z */
2457 /* ?do_tolower@?$ctype@_W@std@@MEBAPEB_WPEA_WPEB_W@Z */
2458 /* ?do_tolower@?$ctype@G@std@@MBEPBGPAGPBG@Z */
2459 /* ?do_tolower@?$ctype@G@std@@MEBAPEBGPEAGPEBG@Z */
2460 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_tolower, 12)
2461 #define call_ctype_wchar_do_tolower(this, first, last) CALL_VTBL_FUNC(this, 20, \
2462 const wchar_t*, (const ctype_wchar*, wchar_t*, const wchar_t*), \
2463 (this, first, last))
2464 const wchar_t* __thiscall ctype_wchar_do_tolower(const ctype_wchar *this,
2465 wchar_t *first, const wchar_t *last)
2467 TRACE("(%p %p %p)\n", this, first, last);
2468 for(; first<last; first++)
2469 *first = _Towlower(*first, &this->ctype);
2470 return last;
2473 /* ?tolower@?$ctype@_W@std@@QBE_W_W@Z */
2474 /* ?tolower@?$ctype@_W@std@@QEBA_W_W@Z */
2475 /* ?tolower@?$ctype@G@std@@QBEGG@Z */
2476 /* ?tolower@?$ctype@G@std@@QEBAGG@Z */
2477 DEFINE_THISCALL_WRAPPER(ctype_wchar_tolower_ch, 8)
2478 wchar_t __thiscall ctype_wchar_tolower_ch(const ctype_wchar *this, wchar_t ch)
2480 TRACE("(%p %d)\n", this, ch);
2481 return call_ctype_wchar_do_tolower_ch(this, ch);
2484 /* ?tolower@?$ctype@_W@std@@QBEPB_WPA_WPB_W@Z */
2485 /* ?tolower@?$ctype@_W@std@@QEBAPEB_WPEA_WPEB_W@Z */
2486 /* ?tolower@?$ctype@G@std@@QBEPBGPAGPBG@Z */
2487 /* ?tolower@?$ctype@G@std@@QEBAPEBGPEAGPEBG@Z */
2488 DEFINE_THISCALL_WRAPPER(ctype_wchar_tolower, 12)
2489 const wchar_t* __thiscall ctype_wchar_tolower(const ctype_wchar *this,
2490 wchar_t *first, const wchar_t *last)
2492 TRACE("(%p %p %p)\n", this, first, last);
2493 return call_ctype_wchar_do_tolower(this, first, last);
2496 /* _Towupper */
2497 wchar_t __cdecl _Towupper(wchar_t ch, const _Ctypevec *ctype)
2499 TRACE("(%d %p)\n", ch, ctype);
2500 return toupperW(ch);
2503 /* ?do_toupper@?$ctype@_W@std@@MBE_W_W@Z */
2504 /* ?do_toupper@?$ctype@_W@std@@MEBA_W_W@Z */
2505 /* ?do_toupper@?$ctype@G@std@@MBEGG@Z */
2506 /* ?do_toupper@?$ctype@G@std@@MEBAGG@Z */
2507 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_toupper_ch, 8)
2508 #define call_ctype_wchar_do_toupper_ch(this, ch) CALL_VTBL_FUNC(this, 32, \
2509 wchar_t, (const ctype_wchar*, wchar_t), (this, ch))
2510 wchar_t __thiscall ctype_wchar_do_toupper_ch(const ctype_wchar *this, wchar_t ch)
2512 return _Towupper(ch, &this->ctype);
2515 /* ?do_toupper@?$ctype@_W@std@@MBEPB_WPA_WPB_W@Z */
2516 /* ?do_toupper@?$ctype@_W@std@@MEBAPEB_WPEA_WPEB_W@Z */
2517 /* ?do_toupper@?$ctype@G@std@@MBEPBGPAGPBG@Z */
2518 /* ?do_toupper@?$ctype@G@std@@MEBAPEBGPEAGPEBG@Z */
2519 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_toupper, 12)
2520 #define call_ctype_wchar_do_toupper(this, first, last) CALL_VTBL_FUNC(this, 28, \
2521 const wchar_t*, (const ctype_wchar*, wchar_t*, const wchar_t*), \
2522 (this, first, last))
2523 const wchar_t* __thiscall ctype_wchar_do_toupper(const ctype_wchar *this,
2524 wchar_t *first, const wchar_t *last)
2526 TRACE("(%p %p %p)\n", this, first, last);
2527 for(; first<last; first++)
2528 *first = _Towupper(*first, &this->ctype);
2529 return last;
2532 /* ?toupper@?$ctype@_W@std@@QBE_W_W@Z */
2533 /* ?toupper@?$ctype@_W@std@@QEBA_W_W@Z */
2534 /* ?toupper@?$ctype@G@std@@QBEGG@Z */
2535 /* ?toupper@?$ctype@G@std@@QEBAGG@Z */
2536 DEFINE_THISCALL_WRAPPER(ctype_wchar_toupper_ch, 8)
2537 wchar_t __thiscall ctype_wchar_toupper_ch(const ctype_wchar *this, wchar_t ch)
2539 TRACE("(%p %d)\n", this, ch);
2540 return call_ctype_wchar_do_toupper_ch(this, ch);
2543 /* ?toupper@?$ctype@_W@std@@QBEPB_WPA_WPB_W@Z */
2544 /* ?toupper@?$ctype@_W@std@@QEBAPEB_WPEA_WPEB_W@Z */
2545 /* ?toupper@?$ctype@G@std@@QBEPBGPAGPBG@Z */
2546 /* ?toupper@?$ctype@G@std@@QEBAPEBGPEAGPEBG@Z */
2547 DEFINE_THISCALL_WRAPPER(ctype_wchar_toupper, 12)
2548 const wchar_t* __thiscall ctype_wchar_toupper(const ctype_wchar *this,
2549 wchar_t *first, const wchar_t *last)
2551 TRACE("(%p %p %p)\n", this, first, last);
2552 return call_ctype_wchar_do_toupper(this, first, last);
2555 /* _Getwctypes */
2556 const wchar_t* __cdecl _Getwctypes(const wchar_t *first, const wchar_t *last,
2557 short *mask, const _Ctypevec *ctype)
2559 TRACE("(%p %p %p %p)\n", first, last, mask, ctype);
2560 GetStringTypeW(CT_CTYPE1, first, last-first, (WORD*)mask);
2561 return last;
2564 /* _Getwctype */
2565 short __cdecl _Getwctype(wchar_t ch, const _Ctypevec *ctype)
2567 short mask = 0;
2568 _Getwctypes(&ch, &ch+1, &mask, ctype);
2569 return mask;
2572 /* ?do_is@?$ctype@_W@std@@MBE_NF_W@Z */
2573 /* ?do_is@?$ctype@_W@std@@MEBA_NF_W@Z */
2574 /* ?do_is@?$ctype@G@std@@MBE_NFG@Z */
2575 /* ?do_is@?$ctype@G@std@@MEBA_NFG@Z */
2576 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_is_ch, 12)
2577 #define call_ctype_wchar_do_is_ch(this, mask, ch) CALL_VTBL_FUNC(this, 8, \
2578 MSVCP_bool, (const ctype_wchar*, short, wchar_t), (this, mask, ch))
2579 MSVCP_bool __thiscall ctype_wchar_do_is_ch(const ctype_wchar *this, short mask, wchar_t ch)
2581 TRACE("(%p %x %d)\n", this, mask, ch);
2582 return (_Getwctype(ch, &this->ctype) & mask) != 0;
2585 /* ?do_is@?$ctype@_W@std@@MBEPB_WPB_W0PAF@Z */
2586 /* ?do_is@?$ctype@_W@std@@MEBAPEB_WPEB_W0PEAF@Z */
2587 /* ?do_is@?$ctype@G@std@@MBEPBGPBG0PAF@Z */
2588 /* ?do_is@?$ctype@G@std@@MEBAPEBGPEBG0PEAF@Z */
2589 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_is, 16)
2590 #define call_ctype_wchar_do_is(this, first, last, dest) CALL_VTBL_FUNC(this, 4, \
2591 const wchar_t*, (const ctype_wchar*, const wchar_t*, const wchar_t*, short*), \
2592 (this, first, last, dest))
2593 const wchar_t* __thiscall ctype_wchar_do_is(const ctype_wchar *this,
2594 const wchar_t *first, const wchar_t *last, short *dest)
2596 TRACE("(%p %p %p %p)\n", this, first, last, dest);
2597 return _Getwctypes(first, last, dest, &this->ctype);
2600 /* ?is@?$ctype@_W@std@@QBE_NF_W@Z */
2601 /* ?is@?$ctype@_W@std@@QEBA_NF_W@Z */
2602 /* ?is@?$ctype@G@std@@QBE_NFG@Z */
2603 /* ?is@?$ctype@G@std@@QEBA_NFG@Z */
2604 DEFINE_THISCALL_WRAPPER(ctype_wchar_is_ch, 12)
2605 MSVCP_bool __thiscall ctype_wchar_is_ch(const ctype_wchar *this, short mask, wchar_t ch)
2607 TRACE("(%p %x %d)\n", this, mask, ch);
2608 return call_ctype_wchar_do_is_ch(this, mask, ch);
2611 /* ?is@?$ctype@_W@std@@QBEPB_WPB_W0PAF@Z */
2612 /* ?is@?$ctype@_W@std@@QEBAPEB_WPEB_W0PEAF@Z */
2613 /* ?is@?$ctype@G@std@@QBEPBGPBG0PAF@Z */
2614 /* ?is@?$ctype@G@std@@QEBAPEBGPEBG0PEAF@Z */
2615 DEFINE_THISCALL_WRAPPER(ctype_wchar_is, 16)
2616 const wchar_t* __thiscall ctype_wchar_is(const ctype_wchar *this,
2617 const wchar_t *first, const wchar_t *last, short *dest)
2619 TRACE("(%p %p %p %p)\n", this, first, last, dest);
2620 return call_ctype_wchar_do_is(this, first, last, dest);
2623 /* ?do_scan_is@?$ctype@_W@std@@MBEPB_WFPB_W0@Z */
2624 /* ?do_scan_is@?$ctype@_W@std@@MEBAPEB_WFPEB_W0@Z */
2625 /* ?do_scan_is@?$ctype@G@std@@MBEPBGFPBG0@Z */
2626 /* ?do_scan_is@?$ctype@G@std@@MEBAPEBGFPEBG0@Z */
2627 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_scan_is, 16)
2628 #define call_ctype_wchar_do_scan_is(this, mask, first, last) CALL_VTBL_FUNC(this, 12, \
2629 const wchar_t*, (const ctype_wchar*, short, const wchar_t*, const wchar_t*), \
2630 (this, mask, first, last))
2631 const wchar_t* __thiscall ctype_wchar_do_scan_is(const ctype_wchar *this,
2632 short mask, const wchar_t *first, const wchar_t *last)
2634 TRACE("(%p %d %p %p)\n", this, mask, first, last);
2635 for(; first<last; first++)
2636 if(!ctype_wchar_is_ch(this, mask, *first))
2637 break;
2638 return first;
2641 /* ?scan_is@?$ctype@_W@std@@QBEPB_WFPB_W0@Z */
2642 /* ?scan_is@?$ctype@_W@std@@QEBAPEB_WFPEB_W0@Z */
2643 /* ?scan_is@?$ctype@G@std@@QBEPBGFPBG0@Z */
2644 /* ?scan_is@?$ctype@G@std@@QEBAPEBGFPEBG0@Z */
2645 DEFINE_THISCALL_WRAPPER(ctype_wchar_scan_is, 16)
2646 const wchar_t* __thiscall ctype_wchar_scan_is(const ctype_wchar *this,
2647 short mask, const wchar_t *first, const wchar_t *last)
2649 TRACE("(%p %x %p %p)\n", this, mask, first, last);
2650 return call_ctype_wchar_do_scan_is(this, mask, first, last);
2653 /* ?do_scan_not@?$ctype@_W@std@@MBEPB_WFPB_W0@Z */
2654 /* ?do_scan_not@?$ctype@_W@std@@MEBAPEB_WFPEB_W0@Z */
2655 /* ?do_scan_not@?$ctype@G@std@@MBEPBGFPBG0@Z */
2656 /* ?do_scan_not@?$ctype@G@std@@MEBAPEBGFPEBG0@Z */
2657 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_scan_not, 16)
2658 #define call_ctype_wchar_do_scan_not(this, mask, first, last) CALL_VTBL_FUNC(this, 16, \
2659 const wchar_t*, (const ctype_wchar*, short, const wchar_t*, const wchar_t*), \
2660 (this, mask, first, last))
2661 const wchar_t* __thiscall ctype_wchar_do_scan_not(const ctype_wchar *this,
2662 short mask, const wchar_t *first, const wchar_t *last)
2664 TRACE("(%p %x %p %p)\n", this, mask, first, last);
2665 for(; first<last; first++)
2666 if(ctype_wchar_is_ch(this, mask, *first))
2667 break;
2668 return first;
2671 /* ?scan_not@?$ctype@_W@std@@QBEPB_WFPB_W0@Z */
2672 /* ?scan_not@?$ctype@_W@std@@QEBAPEB_WFPEB_W0@Z */
2673 /* ?scan_not@?$ctype@G@std@@QBEPBGFPBG0@Z */
2674 /* ?scan_not@?$ctype@G@std@@QEBAPEBGFPEBG0@Z */
2675 DEFINE_THISCALL_WRAPPER(ctype_wchar_scan_not, 16)
2676 const wchar_t* __thiscall ctype_wchar_scan_not(const ctype_wchar *this,
2677 short mask, const wchar_t *first, const wchar_t *last)
2679 TRACE("(%p %x %p %p)\n", this, mask, first, last);
2680 return call_ctype_wchar_do_scan_not(this, mask, first, last);
2683 /* ??_7codecvt_base@std@@6B@ */
2684 extern const vtable_ptr MSVCP_codecvt_base_vtable;
2686 /* ??0codecvt_base@std@@QAE@I@Z */
2687 /* ??0codecvt_base@std@@QEAA@_K@Z */
2688 DEFINE_THISCALL_WRAPPER(codecvt_base_ctor_refs, 8)
2689 codecvt_base* __thiscall codecvt_base_ctor_refs(codecvt_base *this, MSVCP_size_t refs)
2691 TRACE("(%p %lu)\n", this, refs);
2692 locale_facet_ctor_refs(&this->facet, refs);
2693 this->facet.vtable = &MSVCP_codecvt_base_vtable;
2694 return this;
2697 /* ??_Fcodecvt_base@std@@QAEXXZ */
2698 /* ??_Fcodecvt_base@std@@QEAAXXZ */
2699 DEFINE_THISCALL_WRAPPER(codecvt_base_ctor, 4)
2700 codecvt_base* __thiscall codecvt_base_ctor(codecvt_base *this)
2702 return codecvt_base_ctor_refs(this, 0);
2705 /* ??1codecvt_base@std@@UAE@XZ */
2706 /* ??1codecvt_base@std@@UEAA@XZ */
2707 DEFINE_THISCALL_WRAPPER(codecvt_base_dtor, 4)
2708 void __thiscall codecvt_base_dtor(codecvt_base *this)
2710 TRACE("(%p)\n", this);
2711 locale_facet_dtor(&this->facet);
2714 DEFINE_THISCALL_WRAPPER(codecvt_base_vector_dtor, 8)
2715 codecvt_base* __thiscall codecvt_base_vector_dtor(codecvt_base *this, unsigned int flags)
2717 TRACE("(%p %x)\n", this, flags);
2718 if(flags & 2) {
2719 /* we have an array, with the number of elements stored before the first object */
2720 INT_PTR i, *ptr = (INT_PTR *)this-1;
2722 for(i=*ptr-1; i>=0; i--)
2723 codecvt_base_dtor(this+i);
2724 MSVCRT_operator_delete(ptr);
2725 } else {
2726 codecvt_base_dtor(this);
2727 if(flags & 1)
2728 MSVCRT_operator_delete(this);
2731 return this;
2734 /* ?do_always_noconv@codecvt_base@std@@MBE_NXZ */
2735 /* ?do_always_noconv@codecvt_base@std@@MEBA_NXZ */
2736 #define call_codecvt_base_do_always_noconv(this) CALL_VTBL_FUNC(this, 4, \
2737 MSVCP_bool, (const codecvt_base*), (this))
2738 DEFINE_THISCALL_WRAPPER(codecvt_base_do_always_noconv, 4)
2739 MSVCP_bool __thiscall codecvt_base_do_always_noconv(const codecvt_base *this)
2741 TRACE("(%p)\n", this);
2742 return TRUE;
2745 /* ?always_noconv@codecvt_base@std@@QBE_NXZ */
2746 /* ?always_noconv@codecvt_base@std@@QEBA_NXZ */
2747 DEFINE_THISCALL_WRAPPER(codecvt_base_always_noconv, 4)
2748 MSVCP_bool __thiscall codecvt_base_always_noconv(const codecvt_base *this)
2750 TRACE("(%p)\n", this);
2751 return call_codecvt_base_do_always_noconv(this);
2754 /* ?do_max_length@codecvt_base@std@@MBEHXZ */
2755 /* ?do_max_length@codecvt_base@std@@MEBAHXZ */
2756 #define call_codecvt_base_do_max_length(this) CALL_VTBL_FUNC(this, 8, \
2757 int, (const codecvt_base*), (this))
2758 DEFINE_THISCALL_WRAPPER(codecvt_base_do_max_length, 4)
2759 int __thiscall codecvt_base_do_max_length(const codecvt_base *this)
2761 TRACE("(%p)\n", this);
2762 return 1;
2765 /* ?max_length@codecvt_base@std@@QBEHXZ */
2766 /* ?max_length@codecvt_base@std@@QEBAHXZ */
2767 DEFINE_THISCALL_WRAPPER(codecvt_base_max_length, 4)
2768 int __thiscall codecvt_base_max_length(const codecvt_base *this)
2770 TRACE("(%p)\n", this);
2771 return call_codecvt_base_do_max_length(this);
2774 /* ?do_encoding@codecvt_base@std@@MBEHXZ */
2775 /* ?do_encoding@codecvt_base@std@@MEBAHXZ */
2776 #define call_codecvt_base_do_encoding(this) CALL_VTBL_FUNC(this, 12, \
2777 int, (const codecvt_base*), (this))
2778 DEFINE_THISCALL_WRAPPER(codecvt_base_do_encoding, 4)
2779 int __thiscall codecvt_base_do_encoding(const codecvt_base *this)
2781 TRACE("(%p)\n", this);
2782 return 1;
2785 /* ?encoding@codecvt_base@std@@QBEHXZ */
2786 /* ?encoding@codecvt_base@std@@QEBAHXZ */
2787 DEFINE_THISCALL_WRAPPER(codecvt_base_encoding, 4)
2788 int __thiscall codecvt_base_encoding(const codecvt_base *this)
2790 TRACE("(%p)\n", this);
2791 return call_codecvt_base_do_encoding(this);
2794 /* ?id@?$codecvt@DDH@std@@2V0locale@2@A */
2795 locale_id codecvt_char_id = {0};
2797 /* ??_7?$codecvt@DDH@std@@6B@ */
2798 extern const vtable_ptr MSVCP_codecvt_char_vtable;
2800 /* ?_Init@?$codecvt@DDH@std@@IAEXABV_Locinfo@2@@Z */
2801 /* ?_Init@?$codecvt@DDH@std@@IEAAXAEBV_Locinfo@2@@Z */
2802 DEFINE_THISCALL_WRAPPER(codecvt_char__Init, 8)
2803 void __thiscall codecvt_char__Init(codecvt_char *this, const _Locinfo *locinfo)
2805 TRACE("(%p %p)\n", this, locinfo);
2808 /* ??0?$codecvt@DDH@std@@QAE@ABV_Locinfo@1@I@Z */
2809 /* ??0?$codecvt@DDH@std@@QEAA@AEBV_Locinfo@1@_K@Z */
2810 DEFINE_THISCALL_WRAPPER(codecvt_char_ctor_locinfo, 12)
2811 codecvt_char* __thiscall codecvt_char_ctor_locinfo(codecvt_char *this, const _Locinfo *locinfo, MSVCP_size_t refs)
2813 TRACE("(%p %p %lu)\n", this, locinfo, refs);
2814 codecvt_base_ctor_refs(&this->base, refs);
2815 this->base.facet.vtable = &MSVCP_codecvt_char_vtable;
2816 return this;
2819 /* ??0?$codecvt@DDH@std@@QAE@I@Z */
2820 /* ??0?$codecvt@DDH@std@@QEAA@_K@Z */
2821 DEFINE_THISCALL_WRAPPER(codecvt_char_ctor_refs, 8)
2822 codecvt_char* __thiscall codecvt_char_ctor_refs(codecvt_char *this, MSVCP_size_t refs)
2824 return codecvt_char_ctor_locinfo(this, NULL, refs);
2827 /* ??_F?$codecvt@DDH@std@@QAEXXZ */
2828 /* ??_F?$codecvt@DDH@std@@QEAAXXZ */
2829 DEFINE_THISCALL_WRAPPER(codecvt_char_ctor, 4)
2830 codecvt_char* __thiscall codecvt_char_ctor(codecvt_char *this)
2832 return codecvt_char_ctor_locinfo(this, NULL, 0);
2835 /* ??1?$codecvt@DDH@std@@MAE@XZ */
2836 /* ??1?$codecvt@DDH@std@@MEAA@XZ */
2837 DEFINE_THISCALL_WRAPPER(codecvt_char_dtor, 4)
2838 void __thiscall codecvt_char_dtor(codecvt_char *this)
2840 TRACE("(%p)\n", this);
2841 codecvt_base_dtor(&this->base);
2844 DEFINE_THISCALL_WRAPPER(codecvt_char_vector_dtor, 8)
2845 codecvt_char* __thiscall codecvt_char_vector_dtor(codecvt_char *this, unsigned int flags)
2847 TRACE("(%p %x)\n", this, flags);
2848 if(flags & 2) {
2849 /* we have an array, with the number of elements stored before the first object */
2850 INT_PTR i, *ptr = (INT_PTR *)this-1;
2852 for(i=*ptr-1; i>=0; i--)
2853 codecvt_char_dtor(this+i);
2854 MSVCRT_operator_delete(ptr);
2855 } else {
2856 codecvt_char_dtor(this);
2857 if(flags & 1)
2858 MSVCRT_operator_delete(this);
2861 return this;
2864 /* ?_Getcat@?$codecvt@DDH@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
2865 /* ?_Getcat@?$codecvt@DDH@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
2866 static MSVCP_size_t codecvt_char__Getcat(const locale_facet **facet, const locale *loc)
2868 TRACE("(%p %p)\n", facet, loc);
2870 if(facet && !*facet) {
2871 *facet = MSVCRT_operator_new(sizeof(codecvt_char));
2872 if(!*facet) {
2873 ERR("Out of memory\n");
2874 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
2875 return 0;
2877 codecvt_char_ctor((codecvt_char*)*facet);
2880 return LC_CTYPE;
2883 /* ?_Getcat@?$codecvt@DDH@std@@SAIPAPBVfacet@locale@2@@Z */
2884 /* ?_Getcat@?$codecvt@DDH@std@@SA_KPEAPEBVfacet@locale@2@@Z */
2885 MSVCP_size_t __cdecl codecvt_char__Getcat_old(const locale_facet **facet)
2887 return codecvt_char__Getcat(facet, locale_classic());
2890 codecvt_char* codecvt_char_use_facet(const locale *loc)
2892 static codecvt_char *obj = NULL;
2894 _Lockit lock;
2895 const locale_facet *fac;
2897 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
2898 fac = locale__Getfacet(loc, locale_id_operator_size_t(&codecvt_char_id));
2899 if(fac) {
2900 _Lockit_dtor(&lock);
2901 return (codecvt_char*)fac;
2904 if(obj) {
2905 _Lockit_dtor(&lock);
2906 return obj;
2909 codecvt_char__Getcat(&fac, loc);
2910 obj = (codecvt_char*)fac;
2911 locale_facet__Incref(&obj->base.facet);
2912 locale_facet_register(&obj->base.facet);
2913 _Lockit_dtor(&lock);
2915 return obj;
2918 /* ?do_in@?$codecvt@DDH@std@@MBEHAAHPBD1AAPBDPAD3AAPAD@Z */
2919 /* ?do_in@?$codecvt@DDH@std@@MEBAHAEAHPEBD1AEAPEBDPEAD3AEAPEAD@Z */
2920 #define call_codecvt_char_do_in(this, state, from, from_end, from_next, to, to_end, to_next) \
2921 CALL_VTBL_FUNC(this, 16, int, \
2922 (const codecvt_char*, int*, const char*, const char*, const char**, char*, char*, char**), \
2923 (this, state, from, from_end, from_next, to, to_end, to_next))
2924 DEFINE_THISCALL_WRAPPER(codecvt_char_do_in, 32)
2925 int __thiscall codecvt_char_do_in(const codecvt_char *this, int *state,
2926 const char *from, const char *from_end, const char **from_next,
2927 char *to, char *to_end, char **to_next)
2929 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from, from_end,
2930 from_next, to, to_end, to_next);
2931 *from_next = from;
2932 *to_next = to;
2933 return CODECVT_noconv;
2936 /* ?in@?$codecvt@DDH@std@@QBEHAAHPBD1AAPBDPAD3AAPAD@Z */
2937 /* ?in@?$codecvt@DDH@std@@QEBAHAEAHPEBD1AEAPEBDPEAD3AEAPEAD@Z */
2938 DEFINE_THISCALL_WRAPPER(codecvt_char_in, 32)
2939 int __thiscall codecvt_char_in(const codecvt_char *this, int *state,
2940 const char *from, const char *from_end, const char **from_next,
2941 char *to, char *to_end, char **to_next)
2943 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from, from_end,
2944 from_next, to, to_end, to_next);
2945 return call_codecvt_char_do_in(this, state, from, from_end, from_next,
2946 to, to_end, to_next);
2949 /* ?do_out@?$codecvt@DDH@std@@MBEHAAHPBD1AAPBDPAD3AAPAD@Z */
2950 /* ?do_out@?$codecvt@DDH@std@@MEBAHAEAHPEBD1AEAPEBDPEAD3AEAPEAD@Z */
2951 #define call_codecvt_char_do_out(this, state, from, from_end, from_next, to, to_end, to_next) \
2952 CALL_VTBL_FUNC(this, 20, int, \
2953 (const codecvt_char*, int*, const char*, const char*, const char**, char*, char*, char**), \
2954 (this, state, from, from_end, from_next, to, to_end, to_next))
2955 DEFINE_THISCALL_WRAPPER(codecvt_char_do_out, 32)
2956 int __thiscall codecvt_char_do_out(const codecvt_char *this, int *state,
2957 const char *from, const char *from_end, const char **from_next,
2958 char *to, char *to_end, char **to_next)
2960 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from,
2961 from_end, from_next, to, to_end, to_next);
2962 *from_next = from;
2963 *to_next = to;
2964 return CODECVT_noconv;
2967 /* ?out@?$codecvt@DDH@std@@QBEHAAHPBD1AAPBDPAD3AAPAD@Z */
2968 /* ?out@?$codecvt@DDH@std@@QEBAHAEAHPEBD1AEAPEBDPEAD3AEAPEAD@Z */
2969 DEFINE_THISCALL_WRAPPER(codecvt_char_out, 32)
2970 int __thiscall codecvt_char_out(const codecvt_char *this, int *state,
2971 const char *from, const char *from_end, const char **from_next,
2972 char *to, char *to_end, char **to_next)
2974 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from, from_end,
2975 from_next, to, to_end, to_next);
2976 return call_codecvt_char_do_out(this, state, from, from_end, from_next,
2977 to, to_end, to_next);
2980 /* ?do_unshift@?$codecvt@DDH@std@@MBEHAAHPAD1AAPAD@Z */
2981 /* ?do_unshift@?$codecvt@DDH@std@@MEBAHAEAHPEAD1AEAPEAD@Z */
2982 #define call_codecvt_char_do_unshift(this, state, to, to_end, to_next) CALL_VTBL_FUNC(this, 24, \
2983 int, (const codecvt_char*, int*, char*, char*, char**), (this, state, to, to_end, to_next))
2984 DEFINE_THISCALL_WRAPPER(codecvt_char_do_unshift, 20)
2985 int __thiscall codecvt_char_do_unshift(const codecvt_char *this,
2986 int *state, char *to, char *to_end, char **to_next)
2988 TRACE("(%p %p %p %p %p)\n", this, state, to, to_end, to_next);
2989 *to_next = to;
2990 return CODECVT_noconv;
2993 /* ?unshift@?$codecvt@DDH@std@@QBEHAAHPAD1AAPAD@Z */
2994 /* ?unshift@?$codecvt@DDH@std@@QEBAHAEAHPEAD1AEAPEAD@Z */
2995 DEFINE_THISCALL_WRAPPER(codecvt_char_unshift, 20)
2996 int __thiscall codecvt_char_unshift(const codecvt_char *this,
2997 int *state, char *to, char *to_end, char **to_next)
2999 TRACE("(%p %p %p %p %p)\n", this, state, to, to_end, to_next);
3000 return call_codecvt_char_do_unshift(this, state, to, to_end, to_next);
3003 /* ?do_length@?$codecvt@DDH@std@@MBEHABHPBD1I@Z */
3004 /* ?do_length@?$codecvt@DDH@std@@MEBAHAEBHPEBD1_K@Z */
3005 #define call_codecvt_char_do_length(this, state, from, from_end, max) CALL_VTBL_FUNC(this, 28, \
3006 int, (const codecvt_char*, const int*, const char*, const char*, MSVCP_size_t), \
3007 (this, state, from, from_end, max))
3008 DEFINE_THISCALL_WRAPPER(codecvt_char_do_length, 20)
3009 int __thiscall codecvt_char_do_length(const codecvt_char *this, const int *state,
3010 const char *from, const char *from_end, MSVCP_size_t max)
3012 TRACE("(%p %p %p %p %lu)\n", this, state, from, from_end, max);
3013 return (from_end-from > max ? max : from_end-from);
3016 /* ?length@?$codecvt@DDH@std@@QBEHABHPBD1I@Z */
3017 /* ?length@?$codecvt@DDH@std@@QEBAHAEBHPEBD1_K@Z */
3018 DEFINE_THISCALL_WRAPPER(codecvt_char_length, 20)
3019 int __thiscall codecvt_char_length(const codecvt_char *this, const int *state,
3020 const char *from, const char *from_end, MSVCP_size_t max)
3022 TRACE("(%p %p %p %p %lu)\n", this, state, from, from_end, max);
3023 return call_codecvt_char_do_length(this, state, from, from_end, max);
3026 /* ?id@?$codecvt@_WDH@std@@2V0locale@2@A */
3027 locale_id codecvt_wchar_id = {0};
3028 /* ?id@?$codecvt@GDH@std@@2V0locale@2@A */
3029 locale_id codecvt_short_id = {0};
3031 /* ??_7?$codecvt@_WDH@std@@6B@ */
3032 extern const vtable_ptr MSVCP_codecvt_wchar_vtable;
3033 /* ??_7?$codecvt@GDH@std@@6B@ */
3034 extern const vtable_ptr MSVCP_codecvt_short_vtable;
3036 /* ?_Init@?$codecvt@GDH@std@@IAEXABV_Locinfo@2@@Z */
3037 /* ?_Init@?$codecvt@GDH@std@@IEAAXAEBV_Locinfo@2@@Z */
3038 /* ?_Init@?$codecvt@_WDH@std@@IAEXABV_Locinfo@2@@Z */
3039 /* ?_Init@?$codecvt@_WDH@std@@IEAAXAEBV_Locinfo@2@@Z */
3040 DEFINE_THISCALL_WRAPPER(codecvt_wchar__Init, 8)
3041 void __thiscall codecvt_wchar__Init(codecvt_wchar *this, const _Locinfo *locinfo)
3043 TRACE("(%p %p)\n", this, locinfo);
3044 _Locinfo__Getcvt(locinfo, &this->cvt);
3047 /* ??0?$codecvt@_WDH@std@@QAE@ABV_Locinfo@1@I@Z */
3048 /* ??0?$codecvt@_WDH@std@@QEAA@AEBV_Locinfo@1@_K@Z */
3049 DEFINE_THISCALL_WRAPPER(codecvt_wchar_ctor_locinfo, 12)
3050 codecvt_wchar* __thiscall codecvt_wchar_ctor_locinfo(codecvt_wchar *this, const _Locinfo *locinfo, MSVCP_size_t refs)
3052 TRACE("(%p %p %ld)\n", this, locinfo, refs);
3054 codecvt_base_ctor_refs(&this->base, refs);
3055 this->base.facet.vtable = &MSVCP_codecvt_wchar_vtable;
3057 codecvt_wchar__Init(this, locinfo);
3058 return this;
3061 /* ??0?$codecvt@GDH@std@@QAE@ABV_Locinfo@1@I@Z */
3062 /* ??0?$codecvt@GDH@std@@QEAA@AEBV_Locinfo@1@_K@Z */
3063 DEFINE_THISCALL_WRAPPER(codecvt_short_ctor_locinfo, 12)
3064 codecvt_wchar* __thiscall codecvt_short_ctor_locinfo(codecvt_wchar *this, const _Locinfo *locinfo, MSVCP_size_t refs)
3066 TRACE("(%p %p %ld)\n", this, locinfo, refs);
3068 codecvt_wchar_ctor_locinfo(this, locinfo, refs);
3069 this->base.facet.vtable = &MSVCP_codecvt_short_vtable;
3070 return this;
3073 /* ??0?$codecvt@_WDH@std@@QAE@I@Z */
3074 /* ??0?$codecvt@_WDH@std@@QEAA@_K@Z */
3075 DEFINE_THISCALL_WRAPPER(codecvt_wchar_ctor_refs, 8)
3076 codecvt_wchar* __thiscall codecvt_wchar_ctor_refs(codecvt_wchar *this, MSVCP_size_t refs)
3078 _Locinfo locinfo;
3080 TRACE("(%p %ld)\n", this, refs);
3082 _Locinfo_ctor(&locinfo);
3083 codecvt_wchar_ctor_locinfo(this, &locinfo, refs);
3084 _Locinfo_dtor(&locinfo);
3085 return this;
3088 /* ??0?$codecvt@GDH@std@@QAE@I@Z */
3089 /* ??0?$codecvt@GDH@std@@QEAA@_K@Z */
3090 DEFINE_THISCALL_WRAPPER(codecvt_short_ctor_refs, 8)
3091 codecvt_wchar* __thiscall codecvt_short_ctor_refs(codecvt_wchar *this, MSVCP_size_t refs)
3093 _Locinfo locinfo;
3095 TRACE("(%p %ld)\n", this, refs);
3097 _Locinfo_ctor(&locinfo);
3098 codecvt_short_ctor_locinfo(this, &locinfo, refs);
3099 _Locinfo_dtor(&locinfo);
3100 return this;
3103 /* ??0?$codecvt@GDH@std@@IAE@PBDI@Z */
3104 /* ??0?$codecvt@GDH@std@@IEAA@PEBD_K@Z */
3105 DEFINE_THISCALL_WRAPPER(codecvt_short_ctor_name, 12)
3106 codecvt_wchar* __thiscall codecvt_short_ctor_name(codecvt_wchar *this, const char *name, MSVCP_size_t refs)
3108 _Locinfo locinfo;
3110 TRACE("(%p %s %ld)\n", this, name, refs);
3112 _Locinfo_ctor_cstr(&locinfo, name);
3113 codecvt_short_ctor_locinfo(this, &locinfo, refs);
3114 _Locinfo_dtor(&locinfo);
3115 return this;
3118 /* ??_F?$codecvt@_WDH@std@@QAEXXZ */
3119 /* ??_F?$codecvt@_WDH@std@@QEAAXXZ */
3120 DEFINE_THISCALL_WRAPPER(codecvt_wchar_ctor, 4)
3121 codecvt_wchar* __thiscall codecvt_wchar_ctor(codecvt_wchar *this)
3123 return codecvt_wchar_ctor_refs(this, 0);
3126 /* ??_F?$codecvt@GDH@std@@QAEXXZ */
3127 /* ??_F?$codecvt@GDH@std@@QEAAXXZ */
3128 DEFINE_THISCALL_WRAPPER(codecvt_short_ctor, 4)
3129 codecvt_wchar* __thiscall codecvt_short_ctor(codecvt_wchar *this)
3131 return codecvt_short_ctor_refs(this, 0);
3134 /* ??1?$codecvt@GDH@std@@MAE@XZ */
3135 /* ??1?$codecvt@GDH@std@@MEAA@XZ */
3136 /* ??1?$codecvt@_WDH@std@@MAE@XZ */
3137 /* ??1?$codecvt@_WDH@std@@MEAA@XZ */
3138 DEFINE_THISCALL_WRAPPER(codecvt_wchar_dtor, 4)
3139 void __thiscall codecvt_wchar_dtor(codecvt_wchar *this)
3141 TRACE("(%p)\n", this);
3142 codecvt_base_dtor(&this->base);
3145 DEFINE_THISCALL_WRAPPER(codecvt_wchar_vector_dtor, 8)
3146 codecvt_wchar* __thiscall codecvt_wchar_vector_dtor(codecvt_wchar *this, unsigned int flags)
3148 TRACE("(%p %x)\n", this, flags);
3149 if(flags & 2) {
3150 /* we have an array, with the number of elements stored before the first object */
3151 INT_PTR i, *ptr = (INT_PTR *)this-1;
3153 for(i=*ptr-1; i>=0; i--)
3154 codecvt_wchar_dtor(this+i);
3155 MSVCRT_operator_delete(ptr);
3156 } else {
3157 codecvt_wchar_dtor(this);
3158 if(flags & 1)
3159 MSVCRT_operator_delete(this);
3162 return this;
3165 /* ?_Getcat@?$codecvt@_WDH@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
3166 /* ?_Getcat@?$codecvt@_WDH@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
3167 static MSVCP_size_t codecvt_wchar__Getcat(const locale_facet **facet, const locale *loc)
3169 TRACE("(%p %p)\n", facet, loc);
3171 if(facet && !*facet) {
3172 _Locinfo locinfo;
3174 *facet = MSVCRT_operator_new(sizeof(codecvt_wchar));
3175 if(!*facet) {
3176 ERR("Out of memory\n");
3177 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
3178 return 0;
3181 _Locinfo_ctor_cstr(&locinfo, MSVCP_basic_string_char_c_str(&loc->ptr->name));
3182 codecvt_wchar_ctor_locinfo((codecvt_wchar*)*facet, &locinfo, 0);
3183 _Locinfo_dtor(&locinfo);
3186 return LC_CTYPE;
3189 /* ?_Getcat@?$codecvt@_WDH@std@@SAIPAPBVfacet@locale@2@@Z */
3190 /* ?_Getcat@?$codecvt@_WDH@std@@SA_KPEAPEBVfacet@locale@2@@Z */
3191 MSVCP_size_t __cdecl codecvt_wchar__Getcat_old(const locale_facet **facet)
3193 return codecvt_wchar__Getcat(facet, locale_classic());
3196 codecvt_wchar* codecvt_wchar_use_facet(const locale *loc)
3198 static codecvt_wchar *obj = NULL;
3200 _Lockit lock;
3201 const locale_facet *fac;
3203 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
3204 fac = locale__Getfacet(loc, locale_id_operator_size_t(&codecvt_wchar_id));
3205 if(fac) {
3206 _Lockit_dtor(&lock);
3207 return (codecvt_wchar*)fac;
3210 if(obj) {
3211 _Lockit_dtor(&lock);
3212 return obj;
3215 codecvt_wchar__Getcat(&fac, loc);
3216 obj = (codecvt_wchar*)fac;
3217 locale_facet__Incref(&obj->base.facet);
3218 locale_facet_register(&obj->base.facet);
3219 _Lockit_dtor(&lock);
3221 return obj;
3224 /* ?_Getcat@?$codecvt@GDH@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
3225 /* ?_Getcat@?$codecvt@GDH@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
3226 static MSVCP_size_t codecvt_short__Getcat(const locale_facet **facet, const locale *loc)
3228 TRACE("(%p %p)\n", facet, loc);
3230 if(facet && !*facet) {
3231 _Locinfo locinfo;
3233 *facet = MSVCRT_operator_new(sizeof(codecvt_wchar));
3234 if(!*facet) {
3235 ERR("Out of memory\n");
3236 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
3237 return 0;
3240 _Locinfo_ctor_cstr(&locinfo, MSVCP_basic_string_char_c_str(&loc->ptr->name));
3241 codecvt_short_ctor((codecvt_wchar*)*facet);
3242 _Locinfo_dtor(&locinfo);
3245 return LC_CTYPE;
3248 /* ?_Getcat@?$codecvt@GDH@std@@SAIPAPBVfacet@locale@2@@Z */
3249 /* ?_Getcat@?$codecvt@GDH@std@@SA_KPEAPEBVfacet@locale@2@@Z */
3250 MSVCP_size_t __cdecl codecvt_short__Getcat_old(const locale_facet **facet)
3252 return codecvt_short__Getcat(facet, locale_classic());
3255 codecvt_wchar* codecvt_short_use_facet(const locale *loc)
3257 static codecvt_wchar *obj = NULL;
3259 _Lockit lock;
3260 const locale_facet *fac;
3262 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
3263 fac = locale__Getfacet(loc, locale_id_operator_size_t(&codecvt_short_id));
3264 if(fac) {
3265 _Lockit_dtor(&lock);
3266 return (codecvt_wchar*)fac;
3269 if(obj) {
3270 _Lockit_dtor(&lock);
3271 return obj;
3274 codecvt_short__Getcat(&fac, loc);
3275 obj = (codecvt_wchar*)fac;
3276 locale_facet__Incref(&obj->base.facet);
3277 locale_facet_register(&obj->base.facet);
3278 _Lockit_dtor(&lock);
3280 return obj;
3283 /* ?_Id_func@?$codecvt@_WDH@std@@SAAAVid@locale@2@XZ */
3284 /* ?_Id_func@?$codecvt@_WDH@std@@SAAEAVid@locale@2@XZ */
3285 locale_id* __cdecl codecvt_wchar__Id_func(void)
3287 TRACE("()\n");
3288 return &codecvt_wchar_id;
3291 /* ?_Id_func@?$codecvt@GDH@std@@SAAAVid@locale@2@XZ */
3292 /* ?_Id_func@?$codecvt@GDH@std@@SAAEAVid@locale@2@XZ */
3293 locale_id* __cdecl codecvt_short__Id_func(void)
3295 TRACE("()\n");
3296 return &codecvt_short_id;
3299 /* ?do_always_noconv@?$codecvt@GDH@std@@MBE_NXZ */
3300 /* ?do_always_noconv@?$codecvt@GDH@std@@MEBA_NXZ */
3301 /* ?do_always_noconv@?$codecvt@_WDH@std@@MBE_NXZ */
3302 /* ?do_always_noconv@?$codecvt@_WDH@std@@MEBA_NXZ */
3303 DEFINE_THISCALL_WRAPPER(codecvt_wchar_do_always_noconv, 4)
3304 MSVCP_bool __thiscall codecvt_wchar_do_always_noconv(const codecvt_wchar *this)
3306 TRACE("(%p)\n", this);
3307 return FALSE;
3310 /* ?do_max_length@?$codecvt@GDH@std@@MBEHXZ */
3311 /* ?do_max_length@?$codecvt@GDH@std@@MEBAHXZ */
3312 /* ?do_max_length@?$codecvt@_WDH@std@@MBEHXZ */
3313 /* ?do_max_length@?$codecvt@_WDH@std@@MEBAHXZ */
3314 DEFINE_THISCALL_WRAPPER(codecvt_wchar_do_max_length, 4)
3315 int __thiscall codecvt_wchar_do_max_length(const codecvt_wchar *this)
3317 TRACE("(%p)\n", this);
3318 return MB_LEN_MAX;
3321 /* ?do_in@?$codecvt@GDH@std@@MBEHAAHPBD1AAPBDPAG3AAPAG@Z */
3322 /* ?do_in@?$codecvt@GDH@std@@MEBAHAEAHPEBD1AEAPEBDPEAG3AEAPEAG@Z */
3323 /* ?do_in@?$codecvt@_WDH@std@@MBEHAAHPBD1AAPBDPA_W3AAPA_W@Z */
3324 /* ?do_in@?$codecvt@_WDH@std@@MEBAHAEAHPEBD1AEAPEBDPEA_W3AEAPEA_W@Z */
3325 #define call_codecvt_wchar_do_in(this, state, from, from_end, from_next, to, to_end, to_next) \
3326 CALL_VTBL_FUNC(this, 16, int, \
3327 (const codecvt_wchar*, int*, const char*, const char*, const char**, wchar_t*, wchar_t*, wchar_t**), \
3328 (this, state, from, from_end, from_next, to, to_end, to_next))
3329 DEFINE_THISCALL_WRAPPER(codecvt_wchar_do_in, 32)
3330 int __thiscall codecvt_wchar_do_in(const codecvt_wchar *this, int *state,
3331 const char *from, const char *from_end, const char **from_next,
3332 wchar_t *to, wchar_t *to_end, wchar_t **to_next)
3334 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from,
3335 from_end, from_next, to, to_end, to_next);
3337 *from_next = from;
3338 *to_next = to;
3340 while(*from_next!=from_end && *to_next!=to_end) {
3341 switch(_Mbrtowc(*to_next, *from_next, from_end-*from_next, state, &this->cvt)) {
3342 case -2:
3343 *from_next = from_end;
3344 return CODECVT_partial;
3345 case -1:
3346 return CODECVT_error;
3347 case 2:
3348 (*from_next)++;
3349 /* fall through */
3350 case 0:
3351 case 1:
3352 (*from_next)++;
3353 (*to_next)++;
3357 return CODECVT_ok;
3360 /* ?in@?$codecvt@GDH@std@@QBEHAAHPBD1AAPBDPAG3AAPAG@Z */
3361 /* ?in@?$codecvt@GDH@std@@QEBAHAEAHPEBD1AEAPEBDPEAG3AEAPEAG@Z */
3362 /* ?in@?$codecvt@_WDH@std@@QBEHAAHPBD1AAPBDPA_W3AAPA_W@Z */
3363 /* ?in@?$codecvt@_WDH@std@@QEBAHAEAHPEBD1AEAPEBDPEA_W3AEAPEA_W@Z */
3364 DEFINE_THISCALL_WRAPPER(codecvt_wchar_in, 32)
3365 int __thiscall codecvt_wchar_in(const codecvt_wchar *this, int *state,
3366 const char *from, const char *from_end, const char **from_next,
3367 wchar_t *to, wchar_t *to_end, wchar_t **to_next)
3369 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from,
3370 from_end, from_next, to, to_end, to_next);
3371 return call_codecvt_wchar_do_in(this, state, from,
3372 from_end, from_next, to, to_end, to_next);
3375 /* ?do_out@?$codecvt@GDH@std@@MBEHAAHPBG1AAPBGPAD3AAPAD@Z */
3376 /* ?do_out@?$codecvt@GDH@std@@MEBAHAEAHPEBG1AEAPEBGPEAD3AEAPEAD@Z */
3377 /* ?do_out@?$codecvt@_WDH@std@@MBEHAAHPB_W1AAPB_WPAD3AAPAD@Z */
3378 /* ?do_out@?$codecvt@_WDH@std@@MEBAHAEAHPEB_W1AEAPEB_WPEAD3AEAPEAD@Z */
3379 #define call_codecvt_wchar_do_out(this, state, from, from_end, from_next, to, to_end, to_next) \
3380 CALL_VTBL_FUNC(this, 20, int, \
3381 (const codecvt_wchar*, int*, const wchar_t*, const wchar_t*, const wchar_t**, char*, char*, char**), \
3382 (this, state, from, from_end, from_next, to, to_end, to_next))
3383 DEFINE_THISCALL_WRAPPER(codecvt_wchar_do_out, 32)
3384 int __thiscall codecvt_wchar_do_out(const codecvt_wchar *this, int *state,
3385 const wchar_t *from, const wchar_t *from_end, const wchar_t **from_next,
3386 char *to, char *to_end, char **to_next)
3388 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from,
3389 from_end, from_next, to, to_end, to_next);
3391 *from_next = from;
3392 *to_next = to;
3394 while(*from_next!=from_end && *to_next!=to_end) {
3395 int old_state = *state, size;
3396 char buf[MB_LEN_MAX];
3398 switch((size = _Wcrtomb(buf, **from_next, state, &this->cvt))) {
3399 case -1:
3400 return CODECVT_error;
3401 default:
3402 if(size > from_end-*from_next) {
3403 *state = old_state;
3404 return CODECVT_partial;
3407 (*from_next)++;
3408 memcpy_s(*to_next, to_end-*to_next, buf, size);
3409 (*to_next) += size;
3413 return CODECVT_ok;
3416 /* ?out@?$codecvt@GDH@std@@QBEHAAHPBG1AAPBGPAD3AAPAD@Z */
3417 /* ?out@?$codecvt@GDH@std@@QEBAHAEAHPEBG1AEAPEBGPEAD3AEAPEAD@Z */
3418 /* ?out@?$codecvt@_WDH@std@@QBEHAAHPB_W1AAPB_WPAD3AAPAD@Z */
3419 /* ?out@?$codecvt@_WDH@std@@QEBAHAEAHPEB_W1AEAPEB_WPEAD3AEAPEAD@Z */
3420 DEFINE_THISCALL_WRAPPER(codecvt_wchar_out, 32)
3421 int __thiscall codecvt_wchar_out(const codecvt_wchar *this, int *state,
3422 const wchar_t *from, const wchar_t *from_end, const wchar_t **from_next,
3423 char *to, char *to_end, char **to_next)
3425 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from,
3426 from_end, from_next, to, to_end, to_next);
3427 return call_codecvt_wchar_do_out(this, state, from,
3428 from_end, from_next, to, to_end, to_next);
3431 /* ?do_unshift@?$codecvt@GDH@std@@MBEHAAHPAD1AAPAD@Z */
3432 /* ?do_unshift@?$codecvt@GDH@std@@MEBAHAEAHPEAD1AEAPEAD@Z */
3433 /* ?do_unshift@?$codecvt@_WDH@std@@MBEHAAHPAD1AAPAD@Z */
3434 /* ?do_unshift@?$codecvt@_WDH@std@@MEBAHAEAHPEAD1AEAPEAD@Z */
3435 #define call_codecvt_wchar_do_unshift(this, state, to, to_end, to_next) CALL_VTBL_FUNC(this, 24, \
3436 int, (const codecvt_wchar*, int*, char*, char*, char**), (this, state, to, to_end, to_next))
3437 DEFINE_THISCALL_WRAPPER(codecvt_wchar_do_unshift, 20)
3438 int __thiscall codecvt_wchar_do_unshift(const codecvt_wchar *this,
3439 int *state, char *to, char *to_end, char **to_next)
3441 TRACE("(%p %p %p %p %p)\n", this, state, to, to_end, to_next);
3442 if(*state)
3443 WARN("unexpected state: %x\n", *state);
3445 *to_next = to;
3446 return CODECVT_ok;
3449 /* ?unshift@?$codecvt@GDH@std@@QBEHAAHPAD1AAPAD@Z */
3450 /* ?unshift@?$codecvt@GDH@std@@QEBAHAEAHPEAD1AEAPEAD@Z */
3451 /* ?unshift@?$codecvt@_WDH@std@@QBEHAAHPAD1AAPAD@Z */
3452 /* ?unshift@?$codecvt@_WDH@std@@QEBAHAEAHPEAD1AEAPEAD@Z */
3453 DEFINE_THISCALL_WRAPPER(codecvt_wchar_unshift, 20)
3454 int __thiscall codecvt_wchar_unshift(const codecvt_wchar *this,
3455 int *state, char *to, char *to_end, char **to_next)
3457 TRACE("(%p %p %p %p %p)\n", this, state, to, to_end, to_next);
3458 return call_codecvt_wchar_do_unshift(this, state, to, to_end, to_next);
3461 /* ?do_length@?$codecvt@GDH@std@@MBEHABHPBD1I@Z */
3462 /* ?do_length@?$codecvt@GDH@std@@MEBAHAEBHPEBD1_K@Z */
3463 /* ?do_length@?$codecvt@_WDH@std@@MBEHABHPBD1I@Z */
3464 /* ?do_length@?$codecvt@_WDH@std@@MEBAHAEBHPEBD1_K@Z */
3465 #define call_codecvt_wchar_do_length(this, state, from, from_end, max) CALL_VTBL_FUNC(this, 28, \
3466 int, (const codecvt_wchar*, const int*, const char*, const char*, MSVCP_size_t), \
3467 (this, state, from, from_end, max))
3468 DEFINE_THISCALL_WRAPPER(codecvt_wchar_do_length, 20)
3469 int __thiscall codecvt_wchar_do_length(const codecvt_wchar *this, const int *state,
3470 const char *from, const char *from_end, MSVCP_size_t max)
3472 int tmp_state = *state, ret=0;
3474 TRACE("(%p %p %p %p %ld)\n", this, state, from, from_end, max);
3476 while(ret<max && from!=from_end) {
3477 switch(_Mbrtowc(NULL, from, from_end-from, &tmp_state, &this->cvt)) {
3478 case -2:
3479 case -1:
3480 return ret;
3481 case 2:
3482 from++;
3483 /* fall through */
3484 case 0:
3485 case 1:
3486 from++;
3487 ret++;
3491 return ret;
3494 /* ?length@?$codecvt@GDH@std@@QBEHABHPBD1I@Z */
3495 /* ?length@?$codecvt@GDH@std@@QEBAHAEBHPEBD1_K@Z */
3496 /* ?length@?$codecvt@_WDH@std@@QBEHABHPBD1I@Z */
3497 /* ?length@?$codecvt@_WDH@std@@QEBAHAEBHPEBD1_K@Z */
3498 DEFINE_THISCALL_WRAPPER(codecvt_wchar_length, 20)
3499 int __thiscall codecvt_wchar_length(const codecvt_wchar *this, const int *state,
3500 const char *from, const char *from_end, MSVCP_size_t max)
3502 TRACE("(%p %p %p %p %ld)\n", this, state, from, from_end, max);
3503 return call_codecvt_wchar_do_length(this, state, from, from_end, max);
3506 /* ?id@?$numpunct@D@std@@2V0locale@2@A */
3507 locale_id numpunct_char_id = {0};
3509 /* ??_7?$numpunct@D@std@@6B@ */
3510 extern const vtable_ptr MSVCP_numpunct_char_vtable;
3512 /* ?_Init@?$numpunct@D@std@@IAEXABV_Locinfo@2@_N@Z */
3513 /* ?_Init@?$numpunct@D@std@@IEAAXAEBV_Locinfo@2@_N@Z */
3514 static void numpunct_char__Init(numpunct_char *this, const _Locinfo *locinfo, MSVCP_bool isdef)
3516 int len;
3518 TRACE("(%p %p %d)\n", this, locinfo, isdef);
3520 len = strlen(_Locinfo__Getfalse(locinfo))+1;
3521 this->false_name = MSVCRT_operator_new(len);
3522 if(this->false_name)
3523 memcpy((char*)this->false_name, _Locinfo__Getfalse(locinfo), len);
3525 len = strlen(_Locinfo__Gettrue(locinfo))+1;
3526 this->true_name = MSVCRT_operator_new(len);
3527 if(this->true_name)
3528 memcpy((char*)this->true_name, _Locinfo__Gettrue(locinfo), len);
3530 if(isdef) {
3531 this->grouping = MSVCRT_operator_new(1);
3532 if(this->grouping)
3533 *(char*)this->grouping = 0;
3535 this->dp = '.';
3536 this->sep = ',';
3537 } else {
3538 const struct lconv *lc = _Locinfo__Getlconv(locinfo);
3540 len = strlen(lc->grouping)+1;
3541 this->grouping = MSVCRT_operator_new(len);
3542 if(this->grouping)
3543 memcpy((char*)this->grouping, lc->grouping, len);
3545 this->dp = lc->decimal_point[0];
3546 this->sep = lc->thousands_sep[0];
3549 if(!this->false_name || !this->true_name || !this->grouping) {
3550 MSVCRT_operator_delete((char*)this->grouping);
3551 MSVCRT_operator_delete((char*)this->false_name);
3552 MSVCRT_operator_delete((char*)this->true_name);
3554 ERR("Out of memory\n");
3555 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
3559 /* ?_Tidy@?$numpunct@D@std@@AAEXXZ */
3560 /* ?_Tidy@?$numpunct@D@std@@AEAAXXZ */
3561 DEFINE_THISCALL_WRAPPER(numpunct_char__Tidy, 4)
3562 void __thiscall numpunct_char__Tidy(numpunct_char *this)
3564 TRACE("(%p)\n", this);
3566 MSVCRT_operator_delete((char*)this->grouping);
3567 MSVCRT_operator_delete((char*)this->false_name);
3568 MSVCRT_operator_delete((char*)this->true_name);
3571 /* ??0?$numpunct@D@std@@QAE@ABV_Locinfo@1@I_N@Z */
3572 /* ??0?$numpunct@D@std@@QEAA@AEBV_Locinfo@1@_K_N@Z */
3573 static numpunct_char* numpunct_char_ctor_locinfo(numpunct_char *this,
3574 const _Locinfo *locinfo, MSVCP_size_t refs, MSVCP_bool usedef)
3576 TRACE("(%p %p %lu %d)\n", this, locinfo, refs, usedef);
3577 locale_facet_ctor_refs(&this->facet, refs);
3578 this->facet.vtable = &MSVCP_numpunct_char_vtable;
3579 numpunct_char__Init(this, locinfo, usedef);
3580 return this;
3583 /* ??0?$numpunct@D@std@@IAE@PBDI_N@Z */
3584 /* ??0?$numpunct@D@std@@IEAA@PEBD_K_N@Z */
3585 static numpunct_char* numpunct_char_ctor_name(numpunct_char *this,
3586 const char *name, MSVCP_size_t refs, MSVCP_bool usedef)
3588 _Locinfo locinfo;
3590 TRACE("(%p %s %lu %d)\n", this, debugstr_a(name), refs, usedef);
3591 locale_facet_ctor_refs(&this->facet, refs);
3592 this->facet.vtable = &MSVCP_numpunct_char_vtable;
3594 _Locinfo_ctor_cstr(&locinfo, name);
3595 numpunct_char__Init(this, &locinfo, usedef);
3596 _Locinfo_dtor(&locinfo);
3597 return this;
3600 /* ??0?$numpunct@D@std@@QAE@I@Z */
3601 /* ??0?$numpunct@D@std@@QEAA@_K@Z */
3602 DEFINE_THISCALL_WRAPPER(numpunct_char_ctor_refs, 8)
3603 numpunct_char* __thiscall numpunct_char_ctor_refs(numpunct_char *this, MSVCP_size_t refs)
3605 TRACE("(%p %lu)\n", this, refs);
3606 return numpunct_char_ctor_name(this, "C", refs, FALSE);
3609 /* ??_F?$numpunct@D@std@@QAEXXZ */
3610 /* ??_F?$numpunct@D@std@@QEAAXXZ */
3611 DEFINE_THISCALL_WRAPPER(numpunct_char_ctor, 4)
3612 numpunct_char* __thiscall numpunct_char_ctor(numpunct_char *this)
3614 return numpunct_char_ctor_refs(this, 0);
3617 /* ??1?$numpunct@D@std@@MAE@XZ */
3618 /* ??1?$numpunct@D@std@@MEAA@XZ */
3619 DEFINE_THISCALL_WRAPPER(numpunct_char_dtor, 4)
3620 void __thiscall numpunct_char_dtor(numpunct_char *this)
3622 TRACE("(%p)\n", this);
3623 numpunct_char__Tidy(this);
3626 DEFINE_THISCALL_WRAPPER(numpunct_char_vector_dtor, 8)
3627 numpunct_char* __thiscall numpunct_char_vector_dtor(numpunct_char *this, unsigned int flags)
3629 TRACE("(%p %x)\n", this, flags);
3630 if(flags & 2) {
3631 /* we have an array, with the number of elements stored before the first object */
3632 INT_PTR i, *ptr = (INT_PTR *)this-1;
3634 for(i=*ptr-1; i>=0; i--)
3635 numpunct_char_dtor(this+i);
3636 MSVCRT_operator_delete(ptr);
3637 } else {
3638 numpunct_char_dtor(this);
3639 if(flags & 1)
3640 MSVCRT_operator_delete(this);
3643 return this;
3646 /* ?_Getcat@?$numpunct@D@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
3647 /* ?_Getcat@?$numpunct@D@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
3648 static MSVCP_size_t numpunct_char__Getcat(const locale_facet **facet, const locale *loc)
3650 TRACE("(%p %p)\n", facet, loc);
3652 if(facet && !*facet) {
3653 *facet = MSVCRT_operator_new(sizeof(numpunct_char));
3654 if(!*facet) {
3655 ERR("Out of memory\n");
3656 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
3657 return 0;
3659 numpunct_char_ctor_name((numpunct_char*)*facet,
3660 MSVCP_basic_string_char_c_str(&loc->ptr->name), 0, TRUE);
3663 return LC_NUMERIC;
3666 /* ?_Getcat@?$numpunct@D@std@@SAIPAPBVfacet@locale@2@@Z */
3667 /* ?_Getcat@?$numpunct@D@std@@SA_KPEAPEBVfacet@locale@2@@Z */
3668 MSVCP_size_t __cdecl numpunct_char__Getcat_old(const locale_facet **facet)
3670 return numpunct_char__Getcat(facet, locale_classic());
3673 static numpunct_char* numpunct_char_use_facet(const locale *loc)
3675 static numpunct_char *obj = NULL;
3677 _Lockit lock;
3678 const locale_facet *fac;
3680 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
3681 fac = locale__Getfacet(loc, locale_id_operator_size_t(&numpunct_char_id));
3682 if(fac) {
3683 _Lockit_dtor(&lock);
3684 return (numpunct_char*)fac;
3687 if(obj) {
3688 _Lockit_dtor(&lock);
3689 return obj;
3692 numpunct_char__Getcat(&fac, loc);
3693 obj = (numpunct_char*)fac;
3694 locale_facet__Incref(&obj->facet);
3695 locale_facet_register(&obj->facet);
3696 _Lockit_dtor(&lock);
3698 return obj;
3701 /* ?do_decimal_point@?$numpunct@D@std@@MBEDXZ */
3702 /* ?do_decimal_point@?$numpunct@D@std@@MEBADXZ */
3703 DEFINE_THISCALL_WRAPPER(numpunct_char_do_decimal_point, 4)
3704 #define call_numpunct_char_do_decimal_point(this) CALL_VTBL_FUNC(this, 4, \
3705 char, (const numpunct_char *this), (this))
3706 char __thiscall numpunct_char_do_decimal_point(const numpunct_char *this)
3708 TRACE("(%p)\n", this);
3709 return this->dp;
3712 /* ?decimal_point@?$numpunct@D@std@@QBEDXZ */
3713 /* ?decimal_point@?$numpunct@D@std@@QEBADXZ */
3714 DEFINE_THISCALL_WRAPPER(numpunct_char_decimal_point, 4)
3715 char __thiscall numpunct_char_decimal_point(const numpunct_char *this)
3717 TRACE("(%p)\n", this);
3718 return call_numpunct_char_do_decimal_point(this);
3721 /* ?do_thousands_sep@?$numpunct@D@std@@MBEDXZ */
3722 /* ?do_thousands_sep@?$numpunct@D@std@@MEBADXZ */
3723 DEFINE_THISCALL_WRAPPER(numpunct_char_do_thousands_sep, 4)
3724 #define call_numpunct_char_do_thousands_sep(this) CALL_VTBL_FUNC(this, 8, \
3725 char, (const numpunct_char*), (this))
3726 char __thiscall numpunct_char_do_thousands_sep(const numpunct_char *this)
3728 TRACE("(%p)\n", this);
3729 return this->sep;
3732 /* ?thousands_sep@?$numpunct@D@std@@QBEDXZ */
3733 /* ?thousands_sep@?$numpunct@D@std@@QEBADXZ */
3734 DEFINE_THISCALL_WRAPPER(numpunct_char_thousands_sep, 4)
3735 char __thiscall numpunct_char_thousands_sep(const numpunct_char *this)
3737 TRACE("(%p)\n", this);
3738 return call_numpunct_char_do_thousands_sep(this);
3741 /* ?do_grouping@?$numpunct@D@std@@MBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3742 /* ?do_grouping@?$numpunct@D@std@@MEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3743 DEFINE_THISCALL_WRAPPER(numpunct_char_do_grouping, 8)
3744 #define call_numpunct_char_do_grouping(this, ret) CALL_VTBL_FUNC(this, 12, \
3745 basic_string_char*, (const numpunct_char*, basic_string_char*), (this, ret))
3746 basic_string_char* __thiscall numpunct_char_do_grouping(
3747 const numpunct_char *this, basic_string_char *ret)
3749 TRACE("(%p)\n", this);
3750 return MSVCP_basic_string_char_ctor_cstr(ret, this->grouping);
3753 /* ?grouping@?$numpunct@D@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3754 /* ?grouping@?$numpunct@D@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3755 DEFINE_THISCALL_WRAPPER(numpunct_char_grouping, 8)
3756 basic_string_char* __thiscall numpunct_char_grouping(const numpunct_char *this, basic_string_char *ret)
3758 TRACE("(%p)\n", this);
3759 return call_numpunct_char_do_grouping(this, ret);
3762 /* ?do_falsename@?$numpunct@D@std@@MBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3763 /* ?do_falsename@?$numpunct@D@std@@MEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3764 DEFINE_THISCALL_WRAPPER(numpunct_char_do_falsename, 8)
3765 #define call_numpunct_char_do_falsename(this, ret) CALL_VTBL_FUNC(this, 16, \
3766 basic_string_char*, (const numpunct_char*, basic_string_char*), (this, ret))
3767 basic_string_char* __thiscall numpunct_char_do_falsename(
3768 const numpunct_char *this, basic_string_char *ret)
3770 TRACE("(%p)\n", this);
3771 return MSVCP_basic_string_char_ctor_cstr(ret, this->false_name);
3774 /* ?falsename@?$numpunct@D@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3775 /* ?falsename@?$numpunct@D@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3776 DEFINE_THISCALL_WRAPPER(numpunct_char_falsename, 8)
3777 basic_string_char* __thiscall numpunct_char_falsename(const numpunct_char *this, basic_string_char *ret)
3779 TRACE("(%p)\n", this);
3780 return call_numpunct_char_do_falsename(this, ret);
3783 /* ?do_truename@?$numpunct@D@std@@MBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3784 /* ?do_truename@?$numpunct@D@std@@MEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3785 DEFINE_THISCALL_WRAPPER(numpunct_char_do_truename, 8)
3786 #define call_numpunct_char_do_truename(this, ret) CALL_VTBL_FUNC(this, 20, \
3787 basic_string_char*, (const numpunct_char*, basic_string_char*), (this, ret))
3788 basic_string_char* __thiscall numpunct_char_do_truename(
3789 const numpunct_char *this, basic_string_char *ret)
3791 TRACE("(%p)\n", this);
3792 return MSVCP_basic_string_char_ctor_cstr(ret, this->true_name);
3795 /* ?truename@?$numpunct@D@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3796 /* ?truename@?$numpunct@D@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3797 DEFINE_THISCALL_WRAPPER(numpunct_char_truename, 8)
3798 basic_string_char* __thiscall numpunct_char_truename(const numpunct_char *this, basic_string_char *ret)
3800 TRACE("(%p)\n", this);
3801 return call_numpunct_char_do_truename(this, ret);
3804 /* ?id@?$numpunct@_W@std@@2V0locale@2@A */
3805 locale_id numpunct_wchar_id = {0};
3806 /* ?id@?$numpunct@G@std@@2V0locale@2@A */
3807 locale_id numpunct_short_id = {0};
3809 /* ??_7?$numpunct@_W@std@@6B@ */
3810 extern const vtable_ptr MSVCP_numpunct_wchar_vtable;
3811 /* ??_7?$numpunct@G@std@@6B@ */
3812 extern const vtable_ptr MSVCP_numpunct_short_vtable;
3814 /* ?_Init@?$numpunct@_W@std@@IAEXABV_Locinfo@2@_N@Z */
3815 /* ?_Init@?$numpunct@_W@std@@IEAAXAEBV_Locinfo@2@_N@Z */
3816 /* ?_Init@?$numpunct@G@std@@IAEXABV_Locinfo@2@_N@Z */
3817 /* ?_Init@?$numpunct@G@std@@IEAAXAEBV_Locinfo@2@_N@Z */
3818 static void numpunct_wchar__Init(numpunct_wchar *this,
3819 const _Locinfo *locinfo, MSVCP_bool isdef)
3821 const char *to_convert;
3822 _Cvtvec cvt;
3823 int len;
3825 TRACE("(%p %p %d)\n", this, locinfo, isdef);
3827 _Locinfo__Getcvt(locinfo, &cvt);
3829 to_convert = _Locinfo__Getfalse(locinfo);
3830 len = MultiByteToWideChar(cvt.page, 0, to_convert, -1, NULL, 0);
3831 this->false_name = MSVCRT_operator_new(len*sizeof(WCHAR));
3832 if(this->false_name)
3833 MultiByteToWideChar(cvt.page, 0, to_convert, -1,
3834 (wchar_t*)this->false_name, len);
3836 to_convert = _Locinfo__Gettrue(locinfo);
3837 len = MultiByteToWideChar(cvt.page, 0, to_convert, -1, NULL, 0);
3838 this->true_name = MSVCRT_operator_new(len*sizeof(WCHAR));
3839 if(this->true_name)
3840 MultiByteToWideChar(cvt.page, 0, to_convert, -1,
3841 (wchar_t*)this->true_name, len);
3843 if(isdef) {
3844 this->grouping = MSVCRT_operator_new(1);
3845 if(this->grouping)
3846 *(char*)this->grouping = 0;
3848 this->dp = '.';
3849 this->sep = ',';
3850 } else {
3851 const struct lconv *lc = _Locinfo__Getlconv(locinfo);
3853 len = strlen(lc->grouping)+1;
3854 this->grouping = MSVCRT_operator_new(len);
3855 if(this->grouping)
3856 memcpy((char*)this->grouping, lc->grouping, len);
3858 this->dp = lc->decimal_point[0];
3859 this->sep = lc->thousands_sep[0];
3862 if(!this->false_name || !this->true_name || !this->grouping) {
3863 MSVCRT_operator_delete((char*)this->grouping);
3864 MSVCRT_operator_delete((wchar_t*)this->false_name);
3865 MSVCRT_operator_delete((wchar_t*)this->true_name);
3867 ERR("Out of memory\n");
3868 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
3872 /* ?_Tidy@?$numpunct@_W@std@@AAEXXZ */
3873 /* ?_Tidy@?$numpunct@_W@std@@AEAAXXZ */
3874 /* ?_Tidy@?$numpunct@G@std@@AAEXXZ */
3875 /* ?_Tidy@?$numpunct@G@std@@AEAAXXZ */
3876 DEFINE_THISCALL_WRAPPER(numpunct_wchar__Tidy, 4)
3877 void __thiscall numpunct_wchar__Tidy(numpunct_wchar *this)
3879 TRACE("(%p)\n", this);
3881 MSVCRT_operator_delete((char*)this->grouping);
3882 MSVCRT_operator_delete((wchar_t*)this->false_name);
3883 MSVCRT_operator_delete((wchar_t*)this->true_name);
3886 /* ??0?$numpunct@_W@std@@QAE@ABV_Locinfo@1@I_N@Z */
3887 /* ??0?$numpunct@_W@std@@QEAA@AEBV_Locinfo@1@_K_N@Z */
3888 static numpunct_wchar* numpunct_wchar_ctor_locinfo(numpunct_wchar *this,
3889 const _Locinfo *locinfo, MSVCP_size_t refs, MSVCP_bool usedef)
3891 TRACE("(%p %p %lu %d)\n", this, locinfo, refs, usedef);
3892 locale_facet_ctor_refs(&this->facet, refs);
3893 this->facet.vtable = &MSVCP_numpunct_wchar_vtable;
3894 numpunct_wchar__Init(this, locinfo, usedef);
3895 return this;
3898 /* ??0?$numpunct@G@std@@QAE@ABV_Locinfo@1@I_N@Z */
3899 /* ??0?$numpunct@G@std@@QEAA@AEBV_Locinfo@1@_K_N@Z */
3900 static numpunct_wchar* numpunct_short_ctor_locinfo(numpunct_wchar *this,
3901 const _Locinfo *locinfo, MSVCP_size_t refs, MSVCP_bool usedef)
3903 numpunct_wchar_ctor_locinfo(this, locinfo, refs, usedef);
3904 this->facet.vtable = &MSVCP_numpunct_short_vtable;
3905 return this;
3908 /* ??0?$numpunct@_W@std@@IAE@PBDI_N@Z */
3909 /* ??0?$numpunct@_W@std@@IEAA@PEBD_K_N@Z */
3910 static numpunct_wchar* numpunct_wchar_ctor_name(numpunct_wchar *this,
3911 const char *name, MSVCP_size_t refs, MSVCP_bool usedef)
3913 _Locinfo locinfo;
3915 TRACE("(%p %s %lu %d)\n", this, debugstr_a(name), refs, usedef);
3916 locale_facet_ctor_refs(&this->facet, refs);
3917 this->facet.vtable = &MSVCP_numpunct_wchar_vtable;
3919 _Locinfo_ctor_cstr(&locinfo, name);
3920 numpunct_wchar__Init(this, &locinfo, usedef);
3921 _Locinfo_dtor(&locinfo);
3922 return this;
3925 /* ??0?$numpunct@G@std@@IAE@PBDI_N@Z */
3926 /* ??0?$numpunct@G@std@@IEAA@PEBD_K_N@Z */
3927 static numpunct_wchar* numpunct_short_ctor_name(numpunct_wchar *this,
3928 const char *name, MSVCP_size_t refs, MSVCP_bool usedef)
3930 numpunct_wchar_ctor_name(this, name, refs, usedef);
3931 this->facet.vtable = &MSVCP_numpunct_short_vtable;
3932 return this;
3935 /* ??0?$numpunct@_W@std@@QAE@I@Z */
3936 /* ??0?$numpunct@_W@std@@QEAA@_K@Z */
3937 DEFINE_THISCALL_WRAPPER(numpunct_wchar_ctor_refs, 8)
3938 numpunct_wchar* __thiscall numpunct_wchar_ctor_refs(numpunct_wchar *this, MSVCP_size_t refs)
3940 TRACE("(%p %lu)\n", this, refs);
3941 return numpunct_wchar_ctor_name(this, "C", refs, FALSE);
3944 /* ??0?$numpunct@G@std@@QAE@I@Z */
3945 /* ??0?$numpunct@G@std@@QEAA@_K@Z */
3946 DEFINE_THISCALL_WRAPPER(numpunct_short_ctor_refs, 8)
3947 numpunct_wchar* __thiscall numpunct_short_ctor_refs(numpunct_wchar *this, MSVCP_size_t refs)
3949 numpunct_wchar_ctor_refs(this, refs);
3950 this->facet.vtable = &MSVCP_numpunct_short_vtable;
3951 return this;
3954 /* ??_F?$numpunct@_W@std@@QAEXXZ */
3955 /* ??_F?$numpunct@_W@std@@QEAAXXZ */
3956 DEFINE_THISCALL_WRAPPER(numpunct_wchar_ctor, 4)
3957 numpunct_wchar* __thiscall numpunct_wchar_ctor(numpunct_wchar *this)
3959 return numpunct_wchar_ctor_refs(this, 0);
3962 /* ??_F?$numpunct@G@std@@QAEXXZ */
3963 /* ??_F?$numpunct@G@std@@QEAAXXZ */
3964 DEFINE_THISCALL_WRAPPER(numpunct_short_ctor, 4)
3965 numpunct_wchar* __thiscall numpunct_short_ctor(numpunct_wchar *this)
3967 return numpunct_short_ctor_refs(this, 0);
3970 /* ??1?$numpunct@_W@std@@MAE@XZ */
3971 /* ??1?$numpunct@_W@std@@MEAA@XZ */
3972 /* ??1?$numpunct@G@std@@MAE@XZ */
3973 /* ??1?$numpunct@G@std@@MEAA@XZ */
3974 DEFINE_THISCALL_WRAPPER(numpunct_wchar_dtor, 4)
3975 void __thiscall numpunct_wchar_dtor(numpunct_wchar *this)
3977 TRACE("(%p)\n", this);
3978 numpunct_wchar__Tidy(this);
3981 DEFINE_THISCALL_WRAPPER(numpunct_wchar_vector_dtor, 8)
3982 numpunct_wchar* __thiscall numpunct_wchar_vector_dtor(numpunct_wchar *this, unsigned int flags)
3984 TRACE("(%p %x)\n", this, flags);
3985 if(flags & 2) {
3986 /* we have an array, with the number of elements stored before the first object */
3987 INT_PTR i, *ptr = (INT_PTR *)this-1;
3989 for(i=*ptr-1; i>=0; i--)
3990 numpunct_wchar_dtor(this+i);
3991 MSVCRT_operator_delete(ptr);
3992 } else {
3993 numpunct_wchar_dtor(this);
3994 if(flags & 1)
3995 MSVCRT_operator_delete(this);
3998 return this;
4001 /* ?_Getcat@?$numpunct@_W@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
4002 /* ?_Getcat@?$numpunct@_W@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
4003 static MSVCP_size_t numpunct_wchar__Getcat(const locale_facet **facet, const locale *loc)
4005 TRACE("(%p %p)\n", facet, loc);
4007 if(facet && !*facet) {
4008 *facet = MSVCRT_operator_new(sizeof(numpunct_wchar));
4009 if(!*facet) {
4010 ERR("Out of memory\n");
4011 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
4012 return 0;
4014 numpunct_wchar_ctor_name((numpunct_wchar*)*facet,
4015 MSVCP_basic_string_char_c_str(&loc->ptr->name), 0, TRUE);
4018 return LC_NUMERIC;
4021 /* ?_Getcat@?$numpunct@_W@std@@SAIPAPBVfacet@locale@2@@Z */
4022 /* ?_Getcat@?$numpunct@_W@std@@SA_KPEAPEBVfacet@locale@2@@Z */
4023 MSVCP_size_t __cdecl numpunct_wchar__Getcat_old(const locale_facet **facet)
4025 return numpunct_wchar__Getcat(facet, locale_classic());
4028 static numpunct_wchar* numpunct_wchar_use_facet(const locale *loc)
4030 static numpunct_wchar *obj = NULL;
4032 _Lockit lock;
4033 const locale_facet *fac;
4035 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
4036 fac = locale__Getfacet(loc, locale_id_operator_size_t(&numpunct_wchar_id));
4037 if(fac) {
4038 _Lockit_dtor(&lock);
4039 return (numpunct_wchar*)fac;
4042 if(obj) {
4043 _Lockit_dtor(&lock);
4044 return obj;
4047 numpunct_wchar__Getcat(&fac, loc);
4048 obj = (numpunct_wchar*)fac;
4049 locale_facet__Incref(&obj->facet);
4050 locale_facet_register(&obj->facet);
4051 _Lockit_dtor(&lock);
4053 return obj;
4056 /* ?_Getcat@?$numpunct@G@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
4057 /* ?_Getcat@?$numpunct@G@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
4058 static MSVCP_size_t numpunct_short__Getcat(const locale_facet **facet, const locale *loc)
4060 TRACE("(%p %p)\n", facet, loc);
4062 if(facet && !*facet) {
4063 *facet = MSVCRT_operator_new(sizeof(numpunct_wchar));
4064 if(!*facet) {
4065 ERR("Out of memory\n");
4066 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
4067 return 0;
4069 numpunct_short_ctor_name((numpunct_wchar*)*facet,
4070 MSVCP_basic_string_char_c_str(&loc->ptr->name), 0, TRUE);
4073 return LC_NUMERIC;
4076 /* ?_Getcat@?$numpunct@G@std@@SAIPAPBVfacet@locale@2@@Z */
4077 /* ?_Getcat@?$numpunct@G@std@@SA_KPEAPEBVfacet@locale@2@@Z */
4078 MSVCP_size_t __cdecl numpunct_short__Getcat_old(const locale_facet **facet)
4080 return numpunct_short__Getcat(facet, locale_classic());
4083 static numpunct_wchar* numpunct_short_use_facet(const locale *loc)
4085 static numpunct_wchar *obj = NULL;
4087 _Lockit lock;
4088 const locale_facet *fac;
4090 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
4091 fac = locale__Getfacet(loc, locale_id_operator_size_t(&numpunct_short_id));
4092 if(fac) {
4093 _Lockit_dtor(&lock);
4094 return (numpunct_wchar*)fac;
4097 if(obj) {
4098 _Lockit_dtor(&lock);
4099 return obj;
4102 numpunct_short__Getcat(&fac, loc);
4103 obj = (numpunct_wchar*)fac;
4104 locale_facet__Incref(&obj->facet);
4105 locale_facet_register(&obj->facet);
4106 _Lockit_dtor(&lock);
4108 return obj;
4111 /* ?do_decimal_point@?$numpunct@_W@std@@MBE_WXZ */
4112 /* ?do_decimal_point@?$numpunct@_W@std@@MEBA_WXZ */
4113 /* ?do_decimal_point@?$numpunct@G@std@@MBEGXZ */
4114 /* ?do_decimal_point@?$numpunct@G@std@@MEBAGXZ */
4115 DEFINE_THISCALL_WRAPPER(numpunct_wchar_do_decimal_point, 4)
4116 #define call_numpunct_wchar_do_decimal_point(this) CALL_VTBL_FUNC(this, 4, \
4117 wchar_t, (const numpunct_wchar *this), (this))
4118 wchar_t __thiscall numpunct_wchar_do_decimal_point(const numpunct_wchar *this)
4120 TRACE("(%p)\n", this);
4121 return this->dp;
4124 /* ?decimal_point@?$numpunct@_W@std@@QBE_WXZ */
4125 /* ?decimal_point@?$numpunct@_W@std@@QEBA_WXZ */
4126 /* ?decimal_point@?$numpunct@G@std@@QBEGXZ */
4127 /* ?decimal_point@?$numpunct@G@std@@QEBAGXZ */
4128 DEFINE_THISCALL_WRAPPER(numpunct_wchar_decimal_point, 4)
4129 wchar_t __thiscall numpunct_wchar_decimal_point(const numpunct_wchar *this)
4131 TRACE("(%p)\n", this);
4132 return call_numpunct_wchar_do_decimal_point(this);
4135 /* ?do_thousands_sep@?$numpunct@_W@std@@MBE_WXZ */
4136 /* ?do_thousands_sep@?$numpunct@_W@std@@MEBA_WXZ */
4137 /* ?do_thousands_sep@?$numpunct@G@std@@MBEGXZ */
4138 /* ?do_thousands_sep@?$numpunct@G@std@@MEBAGXZ */
4139 DEFINE_THISCALL_WRAPPER(numpunct_wchar_do_thousands_sep, 4)
4140 #define call_numpunct_wchar_do_thousands_sep(this) CALL_VTBL_FUNC(this, 8, \
4141 wchar_t, (const numpunct_wchar *this), (this))
4142 wchar_t __thiscall numpunct_wchar_do_thousands_sep(const numpunct_wchar *this)
4144 TRACE("(%p)\n", this);
4145 return this->sep;
4148 /* ?thousands_sep@?$numpunct@_W@std@@QBE_WXZ */
4149 /* ?thousands_sep@?$numpunct@_W@std@@QEBA_WXZ */
4150 /* ?thousands_sep@?$numpunct@G@std@@QBEGXZ */
4151 /* ?thousands_sep@?$numpunct@G@std@@QEBAGXZ */
4152 DEFINE_THISCALL_WRAPPER(numpunct_wchar_thousands_sep, 4)
4153 wchar_t __thiscall numpunct_wchar_thousands_sep(const numpunct_wchar *this)
4155 TRACE("(%p)\n", this);
4156 return call_numpunct_wchar_do_thousands_sep(this);
4159 /* ?do_grouping@?$numpunct@_W@std@@MBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4160 /* ?do_grouping@?$numpunct@_W@std@@MEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4161 /* ?do_grouping@?$numpunct@G@std@@MBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4162 /* ?do_grouping@?$numpunct@G@std@@MEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4163 DEFINE_THISCALL_WRAPPER(numpunct_wchar_do_grouping, 8)
4164 #define call_numpunct_wchar_do_grouping(this, ret) CALL_VTBL_FUNC(this, 12, \
4165 basic_string_char*, (const numpunct_wchar*, basic_string_char*), (this, ret))
4166 basic_string_char* __thiscall numpunct_wchar_do_grouping(const numpunct_wchar *this, basic_string_char *ret)
4168 TRACE("(%p)\n", this);
4169 return MSVCP_basic_string_char_ctor_cstr(ret, this->grouping);
4172 /* ?grouping@?$numpunct@_W@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4173 /* ?grouping@?$numpunct@_W@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4174 /* ?grouping@?$numpunct@G@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4175 /* ?grouping@?$numpunct@G@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4176 DEFINE_THISCALL_WRAPPER(numpunct_wchar_grouping, 8)
4177 basic_string_char* __thiscall numpunct_wchar_grouping(const numpunct_wchar *this, basic_string_char *ret)
4179 TRACE("(%p)\n", this);
4180 return call_numpunct_wchar_do_grouping(this, ret);
4183 /* ?do_falsename@?$numpunct@_W@std@@MBE?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
4184 /* ?do_falsename@?$numpunct@_W@std@@MEBA?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
4185 /* ?do_falsename@?$numpunct@G@std@@MBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
4186 /* ?do_falsename@?$numpunct@G@std@@MEBA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
4187 DEFINE_THISCALL_WRAPPER(numpunct_wchar_do_falsename, 8)
4188 #define call_numpunct_wchar_do_falsename(this, ret) CALL_VTBL_FUNC(this, 16, \
4189 basic_string_wchar*, (const numpunct_wchar*, basic_string_wchar*), (this, ret))
4190 basic_string_wchar* __thiscall numpunct_wchar_do_falsename(const numpunct_wchar *this, basic_string_wchar *ret)
4192 TRACE("(%p)\n", this);
4193 return MSVCP_basic_string_wchar_ctor_cstr(ret, this->false_name);
4196 /* ?falsename@?$numpunct@_W@std@@QBE?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
4197 /* ?falsename@?$numpunct@_W@std@@QEBA?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
4198 /* ?falsename@?$numpunct@G@std@@QBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
4199 /* ?falsename@?$numpunct@G@std@@QEBA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
4200 DEFINE_THISCALL_WRAPPER(numpunct_wchar_falsename, 8)
4201 basic_string_wchar* __thiscall numpunct_wchar_falsename(const numpunct_wchar *this, basic_string_wchar *ret)
4203 TRACE("(%p)\n", this);
4204 return call_numpunct_wchar_do_falsename(this, ret);
4207 /* ?do_truename@?$numpunct@_W@std@@MBE?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
4208 /* ?do_truename@?$numpunct@_W@std@@MEBA?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
4209 /* ?do_truename@?$numpunct@G@std@@MBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
4210 /* ?do_truename@?$numpunct@G@std@@MEBA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
4211 DEFINE_THISCALL_WRAPPER(numpunct_wchar_do_truename, 8)
4212 #define call_numpunct_wchar_do_truename(this, ret) CALL_VTBL_FUNC(this, 20, \
4213 basic_string_wchar*, (const numpunct_wchar*, basic_string_wchar*), (this, ret))
4214 basic_string_wchar* __thiscall numpunct_wchar_do_truename(const numpunct_wchar *this, basic_string_wchar *ret)
4216 TRACE("(%p)\n", this);
4217 return MSVCP_basic_string_wchar_ctor_cstr(ret, this->true_name);
4220 /* ?truename@?$numpunct@_W@std@@QBE?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
4221 /* ?truename@?$numpunct@_W@std@@QEBA?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
4222 /* ?truename@?$numpunct@G@std@@QBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
4223 /* ?truename@?$numpunct@G@std@@QEBA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
4224 DEFINE_THISCALL_WRAPPER(numpunct_wchar_truename, 8)
4225 basic_string_wchar* __thiscall numpunct_wchar_truename(const numpunct_wchar *this, basic_string_wchar *ret)
4227 TRACE("(%p)\n", this);
4228 return call_numpunct_wchar_do_truename(this, ret);
4231 double __cdecl _Stod(const char *buf, char **buf_end, LONG exp)
4233 double ret = strtod(buf, buf_end);
4235 if(exp)
4236 ret *= pow(10, exp);
4237 return ret;
4240 double __cdecl _Stodx(const char *buf, char **buf_end, LONG exp, int *err)
4242 double ret;
4244 *err = *_errno();
4245 *_errno() = 0;
4246 ret = _Stod(buf, buf_end, exp);
4247 if(*_errno()) {
4248 *err = *_errno();
4249 }else {
4250 *_errno() = *err;
4251 *err = 0;
4253 return ret;
4256 float __cdecl _Stof(const char *buf, char **buf_end, LONG exp)
4258 return _Stod(buf, buf_end, exp);
4261 float __cdecl _Stofx(const char *buf, char **buf_end, LONG exp, int *err)
4263 return _Stodx(buf, buf_end, exp, err);
4266 static __int64 _Stollx(const char *buf, char **buf_end, int base, int *err)
4268 __int64 ret;
4270 *err = *_errno();
4271 *_errno() = 0;
4272 ret = _strtoi64(buf, buf_end, base);
4273 if(*_errno()) {
4274 *err = *_errno();
4275 }else {
4276 *_errno() = *err;
4277 *err = 0;
4279 return ret;
4282 LONG __cdecl _Stolx(const char *buf, char **buf_end, int base, int *err)
4284 __int64 i = _Stollx(buf, buf_end, base, err);
4285 if(!*err && i!=(__int64)((LONG)i))
4286 *err = ERANGE;
4287 return i;
4290 static unsigned __int64 _Stoullx(const char *buf, char **buf_end, int base, int *err)
4292 unsigned __int64 ret;
4294 *err = *_errno();
4295 *_errno() = 0;
4296 ret = _strtoui64(buf, buf_end, base);
4297 if(*_errno()) {
4298 *err = *_errno();
4299 }else {
4300 *_errno() = *err;
4301 *err = 0;
4303 return ret;
4306 ULONG __cdecl _Stoul(const char *buf, char **buf_end, int base)
4308 int err;
4309 unsigned __int64 i = _Stoullx(buf[0]=='-' ? buf+1 : buf, buf_end, base, &err);
4310 if(!err && i!=(unsigned __int64)((ULONG)i))
4311 *_errno() = ERANGE;
4312 return buf[0]=='-' ? -i : i;
4315 ULONG __cdecl _Stoulx(const char *buf, char **buf_end, int base, int *err)
4317 unsigned __int64 i = _Stoullx(buf[0]=='-' ? buf+1 : buf, buf_end, base, err);
4318 if(!*err && i!=(unsigned __int64)((ULONG)i))
4319 *err = ERANGE;
4320 return buf[0]=='-' ? -i : i;
4323 /* ?id@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@2V0locale@2@A */
4324 locale_id num_get_wchar_id = {0};
4325 /* ?id@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@2V0locale@2@A */
4326 locale_id num_get_short_id = {0};
4328 /* ??_7?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@6B@ */
4329 extern const vtable_ptr MSVCP_num_get_wchar_vtable;
4330 /* ??_7?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@6B@ */
4331 extern const vtable_ptr MSVCP_num_get_short_vtable;
4333 /* ?_Init@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@IAEXABV_Locinfo@2@@Z */
4334 /* ?_Init@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@IEAAXAEBV_Locinfo@2@@Z */
4335 /* ?_Init@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@IAEXABV_Locinfo@2@@Z */
4336 /* ?_Init@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@IEAAXAEBV_Locinfo@2@@Z */
4337 DEFINE_THISCALL_WRAPPER(num_get_wchar__Init, 8)
4338 void __thiscall num_get_wchar__Init(num_get *this, const _Locinfo *locinfo)
4340 TRACE("(%p %p)\n", this, locinfo);
4341 _Locinfo__Getcvt(locinfo, &this->cvt);
4344 /* ??0?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
4345 /* ??0?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
4346 DEFINE_THISCALL_WRAPPER(num_get_wchar_ctor_locinfo, 12)
4347 num_get* __thiscall num_get_wchar_ctor_locinfo(num_get *this,
4348 const _Locinfo *locinfo, MSVCP_size_t refs)
4350 TRACE("(%p %p %lu)\n", this, locinfo, refs);
4352 locale_facet_ctor_refs(&this->facet, refs);
4353 this->facet.vtable = &MSVCP_num_get_wchar_vtable;
4355 num_get_wchar__Init(this, locinfo);
4356 return this;
4359 /* ??0?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
4360 /* ??0?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
4361 DEFINE_THISCALL_WRAPPER(num_get_short_ctor_locinfo, 12)
4362 num_get* __thiscall num_get_short_ctor_locinfo(num_get *this,
4363 const _Locinfo *locinfo, MSVCP_size_t refs)
4365 num_get_wchar_ctor_locinfo(this, locinfo, refs);
4366 this->facet.vtable = &MSVCP_num_get_short_vtable;
4367 return this;
4370 /* ??0?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAE@I@Z */
4371 /* ??0?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAA@_K@Z */
4372 DEFINE_THISCALL_WRAPPER(num_get_wchar_ctor_refs, 8)
4373 num_get* __thiscall num_get_wchar_ctor_refs(num_get *this, MSVCP_size_t refs)
4375 _Locinfo locinfo;
4377 TRACE("(%p %lu)\n", this, refs);
4379 _Locinfo_ctor(&locinfo);
4380 num_get_wchar_ctor_locinfo(this, &locinfo, refs);
4381 _Locinfo_dtor(&locinfo);
4382 return this;
4385 /* ??0?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAE@I@Z */
4386 /* ??0?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEAA@_K@Z */
4387 DEFINE_THISCALL_WRAPPER(num_get_short_ctor_refs, 8)
4388 num_get* __thiscall num_get_short_ctor_refs(num_get *this, MSVCP_size_t refs)
4390 num_get_wchar_ctor_refs(this, refs);
4391 this->facet.vtable = &MSVCP_num_get_short_vtable;
4392 return this;
4395 /* ??_F?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAEXXZ */
4396 /* ??_F?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAAXXZ */
4397 DEFINE_THISCALL_WRAPPER(num_get_wchar_ctor, 4)
4398 num_get* __thiscall num_get_wchar_ctor(num_get *this)
4400 return num_get_wchar_ctor_refs(this, 0);
4403 /* ??_F?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAEXXZ */
4404 /* ??_F?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAAXXZ */
4405 DEFINE_THISCALL_WRAPPER(num_get_short_ctor, 4)
4406 num_get* __thiscall num_get_short_ctor(num_get *this)
4408 return num_get_short_ctor_refs(this, 0);
4411 /* ??1?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MAE@XZ */
4412 /* ??1?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MEAA@XZ */
4413 /* ??1?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MAE@XZ */
4414 /* ??1?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MEAA@XZ */
4415 DEFINE_THISCALL_WRAPPER(num_get_wchar_dtor, 4)
4416 void __thiscall num_get_wchar_dtor(num_get *this)
4418 TRACE("(%p)\n", this);
4419 locale_facet_dtor(&this->facet);
4422 DEFINE_THISCALL_WRAPPER(num_get_wchar_vector_dtor, 8)
4423 num_get* __thiscall num_get_wchar_vector_dtor(num_get *this, unsigned int flags)
4425 TRACE("(%p %x)\n", this, flags);
4426 if(flags & 2) {
4427 /* we have an array, with the number of elements stored before the first object */
4428 INT_PTR i, *ptr = (INT_PTR *)this-1;
4430 for(i=*ptr-1; i>=0; i--)
4431 num_get_wchar_dtor(this+i);
4432 MSVCRT_operator_delete(ptr);
4433 } else {
4434 num_get_wchar_dtor(this);
4435 if(flags & 1)
4436 MSVCRT_operator_delete(this);
4439 return this;
4442 /* ?_Getcat@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
4443 /* ?_Getcat@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
4444 static MSVCP_size_t num_get_wchar__Getcat(const locale_facet **facet, const locale *loc)
4446 TRACE("(%p %p)\n", facet, loc);
4448 if(facet && !*facet) {
4449 _Locinfo locinfo;
4451 *facet = MSVCRT_operator_new(sizeof(num_get));
4452 if(!*facet) {
4453 ERR("Out of memory\n");
4454 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
4455 return 0;
4458 _Locinfo_ctor_cstr(&locinfo, MSVCP_basic_string_char_c_str(&loc->ptr->name));
4459 num_get_wchar_ctor_locinfo((num_get*)*facet, &locinfo, 0);
4460 _Locinfo_dtor(&locinfo);
4463 return LC_NUMERIC;
4466 /* ?_Getcat@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SAIPAPBVfacet@locale@2@@Z */
4467 /* ?_Getcat@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@@Z */
4468 MSVCP_size_t __cdecl num_get_wchar__Getcat_old(const locale_facet **facet)
4470 return num_get_wchar__Getcat(facet, locale_classic());
4473 num_get* num_get_wchar_use_facet(const locale *loc)
4475 static num_get *obj = NULL;
4477 _Lockit lock;
4478 const locale_facet *fac;
4480 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
4481 fac = locale__Getfacet(loc, locale_id_operator_size_t(&num_get_wchar_id));
4482 if(fac) {
4483 _Lockit_dtor(&lock);
4484 return (num_get*)fac;
4487 if(obj) {
4488 _Lockit_dtor(&lock);
4489 return obj;
4492 num_get_wchar__Getcat(&fac, loc);
4493 obj = (num_get*)fac;
4494 locale_facet__Incref(&obj->facet);
4495 locale_facet_register(&obj->facet);
4496 _Lockit_dtor(&lock);
4498 return obj;
4501 /* ?_Getcat@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
4502 /* ?_Getcat@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
4503 static MSVCP_size_t num_get_short__Getcat(const locale_facet **facet, const locale *loc)
4505 if(facet && !*facet) {
4506 num_get_wchar__Getcat(facet, loc);
4507 (*(locale_facet**)facet)->vtable = &MSVCP_num_get_short_vtable;
4510 return LC_NUMERIC;
4513 /* ?_Getcat@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SAIPAPBVfacet@locale@2@@Z */
4514 /* ?_Getcat@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@@Z */
4515 MSVCP_size_t __cdecl num_get_short__Getcat_old(const locale_facet **facet)
4517 return num_get_short__Getcat(facet, locale_classic());
4520 num_get* num_get_short_use_facet(const locale *loc)
4522 static num_get *obj = NULL;
4524 _Lockit lock;
4525 const locale_facet *fac;
4527 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
4528 fac = locale__Getfacet(loc, locale_id_operator_size_t(&num_get_short_id));
4529 if(fac) {
4530 _Lockit_dtor(&lock);
4531 return (num_get*)fac;
4534 if(obj) {
4535 _Lockit_dtor(&lock);
4536 return obj;
4539 num_get_short__Getcat(&fac, loc);
4540 obj = (num_get*)fac;
4541 locale_facet__Incref(&obj->facet);
4542 locale_facet_register(&obj->facet);
4543 _Lockit_dtor(&lock);
4545 return obj;
4548 static inline wchar_t mb_to_wc(char ch, const _Cvtvec *cvt)
4550 int state = 0;
4551 wchar_t ret;
4553 return _Mbrtowc(&ret, &ch, 1, &state, cvt) == 1 ? ret : 0;
4556 static int num_get__Getffld(const num_get *this, char *dest, istreambuf_iterator_wchar *first,
4557 istreambuf_iterator_wchar *last, const locale *loc, numpunct_wchar *numpunct)
4559 basic_string_char grouping_bstr;
4560 basic_string_char groups_found;
4561 int i, groups_no = 0, cur_group = 0, exp = 0;
4562 char *dest_beg = dest, *num_end = dest+25, *exp_end = dest+31;
4563 wchar_t sep, digits[11], *digits_pos;
4564 const char *grouping, *groups;
4565 BOOL error = FALSE, got_digit = FALSE, got_nonzero = FALSE;
4567 TRACE("(%p %p %p %p)\n", dest, first, last, loc);
4569 for(i=0; i<10; i++)
4570 digits[i] = mb_to_wc('0'+i, &this->cvt);
4571 digits[10] = 0;
4573 numpunct_wchar_grouping(numpunct, &grouping_bstr);
4574 grouping = MSVCP_basic_string_char_c_str(&grouping_bstr);
4575 sep = grouping[0] ? numpunct_wchar_thousands_sep(numpunct) : 0;
4577 if(sep)
4578 MSVCP_basic_string_char_ctor(&groups_found);
4580 istreambuf_iterator_wchar_val(first);
4581 /* get sign */
4582 if(first->strbuf && first->val==mb_to_wc('-', &this->cvt)) {
4583 *dest++ = '-';
4584 istreambuf_iterator_wchar_inc(first);
4585 }else if(first->strbuf && first->val==mb_to_wc('+', &this->cvt)) {
4586 *dest++ = '+';
4587 istreambuf_iterator_wchar_inc(first);
4590 /* read possibly grouped numbers before decimal */
4591 for(; first->strbuf; istreambuf_iterator_wchar_inc(first)) {
4592 if(!(digits_pos = wcschr(digits, first->val))) {
4593 if(sep && first->val==sep) {
4594 if(!groups_no) break; /* empty group - stop parsing */
4595 MSVCP_basic_string_char_append_ch(&groups_found, groups_no);
4596 groups_no = 0;
4597 ++cur_group;
4598 }else {
4599 break;
4601 }else {
4602 got_digit = TRUE; /* found a digit, zero or non-zero */
4603 /* write digit to dest if not a leading zero (to not waste dest buffer) */
4604 if(!got_nonzero && first->val == digits[0])
4606 ++groups_no;
4607 continue;
4609 got_nonzero = TRUE;
4610 if(dest < num_end)
4611 *dest++ = '0'+digits_pos-digits;
4612 else
4613 exp++; /* too many digits, just multiply by 10 */
4614 if(sep && groups_no<CHAR_MAX)
4615 ++groups_no;
4619 /* if all leading zeroes, we didn't write anything so put a zero we check for a decimal */
4620 if(got_digit && !got_nonzero)
4621 *dest++ = '0';
4623 /* get decimal, if any */
4624 if(first->strbuf && first->val==numpunct_wchar_decimal_point(numpunct)) {
4625 if(dest < num_end)
4626 *dest++ = *localeconv()->decimal_point;
4627 istreambuf_iterator_wchar_inc(first);
4630 /* read non-grouped after decimal */
4631 for(; first->strbuf; istreambuf_iterator_wchar_inc(first)) {
4632 if(!(digits_pos = wcschr(digits, first->val)))
4633 break;
4634 else if(dest<num_end) {
4635 got_digit = TRUE;
4636 *dest++ = '0'+digits_pos-digits;
4640 /* read exponent, if any */
4641 if(first->strbuf && (first->val==mb_to_wc('e', &this->cvt) || first->val==mb_to_wc('E', &this->cvt))) {
4642 *dest++ = 'e';
4643 istreambuf_iterator_wchar_inc(first);
4645 if(first->strbuf && first->val==mb_to_wc('-', &this->cvt)) {
4646 *dest++ = '-';
4647 istreambuf_iterator_wchar_inc(first);
4648 }else if(first->strbuf && first->val==mb_to_wc('+', &this->cvt)) {
4649 *dest++ = '+';
4650 istreambuf_iterator_wchar_inc(first);
4653 got_digit = got_nonzero = FALSE;
4654 error = TRUE;
4655 /* skip any leading zeroes */
4656 for(; first->strbuf && first->val==digits[0]; istreambuf_iterator_wchar_inc(first))
4657 error = FALSE;
4659 for(; first->strbuf && (digits_pos = wcschr(digits, first->val)); istreambuf_iterator_wchar_inc(first)) {
4660 got_digit = got_nonzero = TRUE; /* leading zeroes would have been skipped, so first digit is non-zero */
4661 error = FALSE;
4662 if(dest<exp_end)
4663 *dest++ = '0'+digits_pos-digits;
4666 /* if just found zeroes for exponent, use that */
4667 if(got_digit && !got_nonzero)
4669 error = FALSE;
4670 if(dest<exp_end)
4671 *dest++ = '0';
4675 if(sep && groups_no)
4676 MSVCP_basic_string_char_append_ch(&groups_found, groups_no);
4678 if(!cur_group) /* no groups, skip loop */
4679 cur_group--;
4680 else if(!(groups = MSVCP_basic_string_char_c_str(&groups_found))[cur_group])
4681 error = TRUE; /* trailing empty */
4683 for(; cur_group>=0 && !error; cur_group--) {
4684 if(*grouping == CHAR_MAX) {
4685 if(cur_group)
4686 error = TRUE;
4687 break;
4688 }else if((cur_group && *grouping!=groups[cur_group])
4689 || (!cur_group && *grouping<groups[cur_group])) {
4690 error = TRUE;
4691 break;
4692 }else if(grouping[1]) {
4693 grouping++;
4696 MSVCP_basic_string_char_dtor(&grouping_bstr);
4697 if(sep)
4698 MSVCP_basic_string_char_dtor(&groups_found);
4700 if(error) {
4701 *dest_beg = '\0';
4702 return 0;
4704 *dest++ = '\0';
4705 return exp;
4708 /* ?_Getffld@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@ABAHPADAAV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@2@1ABVlocale@2@@Z */
4709 /* ?_Getffld@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@AEBAHPEADAEAV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@2@1AEBVlocale@2@@Z */
4710 int __cdecl num_get_wchar__Getffld(const num_get *this, char *dest, istreambuf_iterator_wchar *first,
4711 istreambuf_iterator_wchar *last, const locale *loc)
4713 return num_get__Getffld(this, dest, first, last, loc, numpunct_wchar_use_facet(loc));
4716 /* ?_Getffld@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@ABAHPADAAV?$istreambuf_iterator@GU?$char_traits@G@std@@@2@1ABVlocale@2@@Z */
4717 /* ?_Getffld@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@AEBAHPEADAEAV?$istreambuf_iterator@GU?$char_traits@G@std@@@2@1AEBVlocale@2@@Z */
4718 int __cdecl num_get_short__Getffld(const num_get *this, char *dest, istreambuf_iterator_wchar *first,
4719 istreambuf_iterator_wchar *last, const locale *loc)
4721 return num_get__Getffld(this, dest, first, last, loc, numpunct_short_use_facet(loc));
4724 static int num_get__Getifld(const num_get *this, char *dest, istreambuf_iterator_wchar *first,
4725 istreambuf_iterator_wchar *last, int fmtflags, const locale *loc, numpunct_wchar *numpunct)
4727 wchar_t digits[23], *digits_pos, sep;
4728 basic_string_char grouping_bstr;
4729 basic_string_char groups_found;
4730 int i, basefield, base, groups_no = 0, cur_group = 0;
4731 char *dest_beg = dest, *dest_end = dest+24;
4732 const char *grouping, *groups;
4733 BOOL error = TRUE, dest_empty = TRUE, found_zero = FALSE;
4735 TRACE("(%p %p %p %04x %p)\n", dest, first, last, fmtflags, loc);
4737 for(i=0; i<10; i++)
4738 digits[i] = mb_to_wc('0'+i, &this->cvt);
4739 for(i=0; i<6; i++) {
4740 digits[10+i] = mb_to_wc('a'+i, &this->cvt);
4741 digits[16+i] = mb_to_wc('A'+i, &this->cvt);
4744 numpunct_wchar_grouping(numpunct, &grouping_bstr);
4745 grouping = MSVCP_basic_string_char_c_str(&grouping_bstr);
4746 sep = grouping[0] ? numpunct_wchar_thousands_sep(numpunct) : '\0';
4748 basefield = fmtflags & FMTFLAG_basefield;
4749 if(basefield == FMTFLAG_oct)
4750 base = 8;
4751 else if(basefield == FMTFLAG_hex)
4752 base = 22; /* equal to the size of digits buffer */
4753 else if(!basefield)
4754 base = 0;
4755 else
4756 base = 10;
4758 istreambuf_iterator_wchar_val(first);
4759 if(first->strbuf && first->val==mb_to_wc('-', &this->cvt)) {
4760 *dest++ = '-';
4761 istreambuf_iterator_wchar_inc(first);
4762 }else if(first->strbuf && first->val==mb_to_wc('+', &this->cvt)) {
4763 *dest++ = '+';
4764 istreambuf_iterator_wchar_inc(first);
4767 if(first->strbuf && first->val==digits[0]) {
4768 found_zero = TRUE;
4769 istreambuf_iterator_wchar_inc(first);
4770 if(first->strbuf && (first->val==mb_to_wc('x', &this->cvt) || first->val==mb_to_wc('X', &this->cvt))) {
4771 if(!base || base == 22) {
4772 found_zero = FALSE;
4773 istreambuf_iterator_wchar_inc(first);
4774 base = 22;
4775 }else {
4776 base = 10;
4778 }else {
4779 error = FALSE;
4780 if(!base) base = 8;
4782 }else {
4783 if(!base) base = 10;
4785 digits[base] = 0;
4787 if(sep) {
4788 MSVCP_basic_string_char_ctor(&groups_found);
4789 if(found_zero) ++groups_no;
4792 for(; first->strbuf; istreambuf_iterator_wchar_inc(first)) {
4793 if(!(digits_pos = wcschr(digits, first->val))) {
4794 if(sep && first->val==sep) {
4795 if(!groups_no) break; /* empty group - stop parsing */
4796 MSVCP_basic_string_char_append_ch(&groups_found, groups_no);
4797 groups_no = 0;
4798 ++cur_group;
4799 }else {
4800 break;
4802 }else {
4803 error = FALSE;
4804 if(dest_empty && first->val == digits[0]) {
4805 found_zero = TRUE;
4806 ++groups_no;
4807 continue;
4809 dest_empty = FALSE;
4810 /* skip digits that can't be copied to dest buffer, other
4811 * functions are responsible for detecting overflows */
4812 if(dest < dest_end)
4813 *dest++ = (digits_pos-digits<10 ? '0'+digits_pos-digits :
4814 (digits_pos-digits<16 ? 'a'+digits_pos-digits-10 :
4815 'A'+digits_pos-digits-16));
4816 if(sep && groups_no<CHAR_MAX)
4817 ++groups_no;
4821 if(sep && groups_no)
4822 MSVCP_basic_string_char_append_ch(&groups_found, groups_no);
4824 if(!cur_group) { /* no groups, skip loop */
4825 cur_group--;
4826 }else if(!(groups = MSVCP_basic_string_char_c_str(&groups_found))[cur_group]) {
4827 error = TRUE; /* trailing empty */
4828 found_zero = FALSE;
4831 for(; cur_group>=0 && !error; cur_group--) {
4832 if(*grouping == CHAR_MAX) {
4833 if(cur_group)
4834 error = TRUE;
4835 break;
4836 }else if((cur_group && *grouping!=groups[cur_group])
4837 || (!cur_group && *grouping<groups[cur_group])) {
4838 error = TRUE;
4839 break;
4840 }else if(grouping[1]) {
4841 grouping++;
4845 MSVCP_basic_string_char_dtor(&grouping_bstr);
4846 if(sep)
4847 MSVCP_basic_string_char_dtor(&groups_found);
4849 if(error) {
4850 if (found_zero)
4851 *dest++ = '0';
4852 else
4853 dest = dest_beg;
4854 }else if(dest_empty)
4855 *dest++ = '0';
4856 *dest = '\0';
4858 return (base==22 ? 16 : base);
4861 /* ?_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 */
4862 /* ?_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 */
4863 int __cdecl num_get_wchar__Getifld(const num_get *this, char *dest, istreambuf_iterator_wchar *first,
4864 istreambuf_iterator_wchar *last, int fmtflags, const locale *loc)
4866 return num_get__Getifld(this, dest, first, last,
4867 fmtflags, loc, numpunct_wchar_use_facet(loc));
4870 /* ?_Getifld@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@ABAHPADAAV?$istreambuf_iterator@GU?$char_traits@G@std@@@2@1HABVlocale@2@@Z */
4871 /* ?_Getifld@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@AEBAHPEADAEAV?$istreambuf_iterator@GU?$char_traits@G@std@@@2@1HAEBVlocale@2@@Z */
4872 int __cdecl num_get_short__Getifld(const num_get *this, char *dest, istreambuf_iterator_wchar *first,
4873 istreambuf_iterator_wchar *last, int fmtflags, const locale *loc)
4875 return num_get__Getifld(this, dest, first, last,
4876 fmtflags, loc, numpunct_short_use_facet(loc));
4879 static istreambuf_iterator_wchar* num_get_do_get_void(const num_get *this,
4880 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar first,
4881 istreambuf_iterator_wchar last, ios_base *base, int *state,
4882 void **pval, numpunct_wchar *numpunct)
4884 unsigned __int64 v;
4885 char tmp[25], *end;
4886 int err;
4888 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
4890 v = _Stoullx(tmp, &end, num_get__Getifld(this, tmp, &first,
4891 &last, FMTFLAG_hex, base->loc, numpunct), &err);
4892 if(v!=(unsigned __int64)((INT_PTR)v))
4893 *state |= IOSTATE_failbit;
4894 else if(end!=tmp && !err)
4895 *pval = (void*)((INT_PTR)v);
4896 else
4897 *state |= IOSTATE_failbit;
4899 if(!first.strbuf)
4900 *state |= IOSTATE_eofbit;
4902 *ret = first;
4903 return ret;
4906 /* ?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 */
4907 /* ?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 */
4908 #define call_num_get_wchar_do_get_void(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 4, istreambuf_iterator_wchar*, \
4909 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, void**), \
4910 (this, ret, first, last, base, state, pval))
4911 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_void,36)
4912 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_void(const num_get *this, istreambuf_iterator_wchar *ret,
4913 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, void **pval)
4915 return num_get_do_get_void(this, ret, first, last, base,
4916 state, pval, numpunct_wchar_use_facet(base->loc));
4919 /* ?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 */
4920 /* ?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 */
4921 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_void,36)
4922 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_void(const num_get *this, istreambuf_iterator_wchar *ret,
4923 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, void **pval)
4925 return num_get_do_get_void(this, ret, first, last, base,
4926 state, pval, numpunct_short_use_facet(base->loc));
4929 /* ?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 */
4930 /* ?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 */
4931 /* ?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 */
4932 /* ?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 */
4933 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_void,36)
4934 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_void(const num_get *this, istreambuf_iterator_wchar *ret,
4935 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, void **pval)
4937 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
4938 return call_num_get_wchar_do_get_void(this, ret, first, last, base, state, pval);
4941 static istreambuf_iterator_wchar* num_get_do_get_double(const num_get *this,
4942 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar first,
4943 istreambuf_iterator_wchar last, ios_base *base, int *state,
4944 double *pval, numpunct_wchar *numpunct)
4946 double v;
4947 char tmp[32], *end;
4948 int err;
4950 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
4952 v = _Stodx(tmp, &end, num_get__Getffld(this, tmp, &first, &last, base->loc, numpunct), &err);
4953 if(end!=tmp && !err)
4954 *pval = v;
4955 else
4956 *state |= IOSTATE_failbit;
4958 if(!first.strbuf)
4959 *state |= IOSTATE_eofbit;
4961 *ret = first;
4962 return ret;
4965 /* ?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 */
4966 /* ?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 */
4967 /* ?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 */
4968 /* ?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 */
4969 #define call_num_get_wchar_do_get_ldouble(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 8, istreambuf_iterator_wchar*, \
4970 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, double*), \
4971 (this, ret, first, last, base, state, pval))
4972 #define call_num_get_wchar_do_get_double(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 12, istreambuf_iterator_wchar*, \
4973 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, double*), \
4974 (this, ret, first, last, base, state, pval))
4975 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_double,36)
4976 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_double(const num_get *this, istreambuf_iterator_wchar *ret,
4977 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, double *pval)
4979 return num_get_do_get_double(this, ret, first, last, base,
4980 state, pval, numpunct_wchar_use_facet(base->loc));
4983 /* ?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 */
4984 /* ?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 */
4985 /* ?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 */
4986 /* ?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 */
4987 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_double,36)
4988 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_double(const num_get *this, istreambuf_iterator_wchar *ret,
4989 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, double *pval)
4991 return num_get_do_get_double(this, ret, first, last, base,
4992 state, pval, numpunct_short_use_facet(base->loc));
4995 /* ?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 */
4996 /* ?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 */
4997 /* ?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 */
4998 /* ?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 */
4999 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_ldouble,36)
5000 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_ldouble(const num_get *this, istreambuf_iterator_wchar *ret,
5001 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, double *pval)
5003 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5004 return call_num_get_wchar_do_get_ldouble(this, ret, first, last, base, state, pval);
5007 /* ?get@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QBE?AV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@0AAVios_base@2@AAHAAN@Z */
5008 /* ?get@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEBA?AV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@0AEAVios_base@2@AEAHAEAN@Z */
5009 /* ?get@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QBE?AV?$istreambuf_iterator@GU?$char_traits@G@std@@@2@V32@0AAVios_base@2@AAHAAN@Z */
5010 /* ?get@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEBA?AV?$istreambuf_iterator@GU?$char_traits@G@std@@@2@V32@0AEAVios_base@2@AEAHAEAN@Z */
5011 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_double,36)
5012 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_double(const num_get *this, istreambuf_iterator_wchar *ret,
5013 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, double *pval)
5015 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5016 return call_num_get_wchar_do_get_double(this, ret, first, last, base, state, pval);
5019 static istreambuf_iterator_wchar* num_get_do_get_float(const num_get *this,
5020 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar first,
5021 istreambuf_iterator_wchar last, ios_base *base, int *state,
5022 float *pval, numpunct_wchar *numpunct)
5024 float v;
5025 char tmp[32], *end;
5026 int err;
5028 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5030 v = _Stofx(tmp, &end, num_get__Getffld(this, tmp, &first,
5031 &last, base->loc, numpunct), &err);
5032 if(end!=tmp && !err)
5033 *pval = v;
5034 else
5035 *state |= IOSTATE_failbit;
5037 if(!first.strbuf)
5038 *state |= IOSTATE_eofbit;
5040 *ret = first;
5041 return ret;
5044 /* ?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 */
5045 /* ?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 */
5046 #define call_num_get_wchar_do_get_float(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 16, istreambuf_iterator_wchar*, \
5047 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, float*), \
5048 (this, ret, first, last, base, state, pval))
5049 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_float,36)
5050 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_float(const num_get *this, istreambuf_iterator_wchar *ret,
5051 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, float *pval)
5053 return num_get_do_get_float(this, ret, first, last, base,
5054 state, pval, numpunct_wchar_use_facet(base->loc));
5057 /* ?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 */
5058 /* ?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 */
5059 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_float,36)
5060 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_float(const num_get *this, istreambuf_iterator_wchar *ret,
5061 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, float *pval)
5063 return num_get_do_get_float(this, ret, first, last, base,
5064 state, pval, numpunct_short_use_facet(base->loc));
5067 /* ?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 */
5068 /* ?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 */
5069 /* ?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 */
5070 /* ?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 */
5071 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_float,36)
5072 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_float(const num_get *this, istreambuf_iterator_wchar *ret,
5073 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, float *pval)
5075 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5076 return call_num_get_wchar_do_get_float(this, ret, first, last, base, state, pval);
5079 static istreambuf_iterator_wchar* num_get_do_get_uint64(const num_get *this,
5080 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar first,
5081 istreambuf_iterator_wchar last, ios_base *base, int *state,
5082 ULONGLONG *pval, numpunct_wchar *numpunct)
5084 unsigned __int64 v;
5085 char tmp[25], *end;
5086 int err;
5088 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5090 v = _Stoullx(tmp, &end, num_get__Getifld(this, tmp, &first,
5091 &last, base->fmtfl, base->loc, numpunct), &err);
5092 if(end!=tmp && !err)
5093 *pval = v;
5094 else
5095 *state |= IOSTATE_failbit;
5097 if(!first.strbuf)
5098 *state |= IOSTATE_eofbit;
5100 *ret = first;
5101 return ret;
5104 /* ?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 */
5105 /* ?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 */
5106 #define call_num_get_wchar_do_get_uint64(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 20, istreambuf_iterator_wchar*, \
5107 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, ULONGLONG*), \
5108 (this, ret, first, last, base, state, pval))
5109 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_uint64,36)
5110 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_uint64(const num_get *this, istreambuf_iterator_wchar *ret,
5111 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, ULONGLONG *pval)
5113 return num_get_do_get_uint64(this, ret, first, last, base,
5114 state, pval, numpunct_wchar_use_facet(base->loc));
5117 /* ?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 */
5118 /* ?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 */
5119 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_uint64,36)
5120 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_uint64(const num_get *this, istreambuf_iterator_wchar *ret,
5121 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, ULONGLONG *pval)
5123 return num_get_do_get_uint64(this, ret, first, last, base,
5124 state, pval, numpunct_short_use_facet(base->loc));
5127 /* ?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 */
5128 /* ?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 */
5129 /* ?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 */
5130 /* ?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 */
5131 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_uint64,36)
5132 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_uint64(const num_get *this, istreambuf_iterator_wchar *ret,
5133 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, ULONGLONG *pval)
5135 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5136 return call_num_get_wchar_do_get_uint64(this, ret, first, last, base, state, pval);
5139 static istreambuf_iterator_wchar* num_get_do_get_int64(const num_get *this,
5140 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar first,
5141 istreambuf_iterator_wchar last, ios_base *base, int *state,
5142 LONGLONG *pval, numpunct_wchar *numpunct)
5144 __int64 v;
5145 char tmp[25], *end;
5146 int err;
5148 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5150 v = _Stollx(tmp, &end, num_get__Getifld(this, tmp, &first,
5151 &last, base->fmtfl, base->loc, numpunct), &err);
5152 if(end!=tmp && !err)
5153 *pval = v;
5154 else
5155 *state |= IOSTATE_failbit;
5157 if(!first.strbuf)
5158 *state |= IOSTATE_eofbit;
5160 *ret = first;
5161 return ret;
5164 /* ?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 */
5165 /* ?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 */
5166 #define call_num_get_wchar_do_get_int64(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 24, istreambuf_iterator_wchar*, \
5167 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, LONGLONG*), \
5168 (this, ret, first, last, base, state, pval))
5169 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_int64,36)
5170 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_int64(const num_get *this, istreambuf_iterator_wchar *ret,
5171 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, LONGLONG *pval)
5173 return num_get_do_get_int64(this, ret, first, last, base,
5174 state, pval, numpunct_wchar_use_facet(base->loc));
5177 /* ?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 */
5178 /* ?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 */
5179 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_int64,36)
5180 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_int64(const num_get *this, istreambuf_iterator_wchar *ret,
5181 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, LONGLONG *pval)
5183 return num_get_do_get_int64(this, ret, first, last, base,
5184 state, pval, numpunct_short_use_facet(base->loc));
5187 /* ?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 */
5188 /* ?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 */
5189 /* ?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 */
5190 /* ?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 */
5191 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_int64,36)
5192 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_int64(const num_get *this, istreambuf_iterator_wchar *ret,
5193 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, LONGLONG *pval)
5195 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5196 return call_num_get_wchar_do_get_int64(this, ret, first, last, base, state, pval);
5199 static istreambuf_iterator_wchar* num_get_do_get_ulong(const num_get *this,
5200 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar first,
5201 istreambuf_iterator_wchar last, ios_base *base, int *state,
5202 ULONG *pval, numpunct_wchar *numpunct)
5204 ULONG v;
5205 char tmp[25], *end;
5206 int err;
5208 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5210 v = _Stoulx(tmp, &end, num_get__Getifld(this, tmp, &first,
5211 &last, base->fmtfl, base->loc, numpunct), &err);
5212 if(end!=tmp && !err)
5213 *pval = v;
5214 else
5215 *state |= IOSTATE_failbit;
5217 if(!first.strbuf)
5218 *state |= IOSTATE_eofbit;
5220 *ret = first;
5221 return ret;
5224 /* ?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 */
5225 /* ?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 */
5226 #define call_num_get_wchar_do_get_ulong(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 28, istreambuf_iterator_wchar*, \
5227 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, ULONG*), \
5228 (this, ret, first, last, base, state, pval))
5229 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_ulong,36)
5230 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_ulong(const num_get *this, istreambuf_iterator_wchar *ret,
5231 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, ULONG *pval)
5233 return num_get_do_get_ulong(this, ret, first, last, base,
5234 state, pval, numpunct_wchar_use_facet(base->loc));
5237 /* ?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 */
5238 /* ?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 */
5239 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_ulong,36)
5240 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_ulong(const num_get *this, istreambuf_iterator_wchar *ret,
5241 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, ULONG *pval)
5243 return num_get_do_get_ulong(this, ret, first, last, base,
5244 state, pval, numpunct_short_use_facet(base->loc));
5247 /* ?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 */
5248 /* ?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 */
5249 /* ?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 */
5250 /* ?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 */
5251 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_ulong,36)
5252 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_ulong(const num_get *this, istreambuf_iterator_wchar *ret,
5253 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, ULONG *pval)
5255 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5256 return call_num_get_wchar_do_get_ulong(this, ret, first, last, base, state, pval);
5259 static istreambuf_iterator_wchar* num_get_do_get_long(const num_get *this,
5260 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar first,
5261 istreambuf_iterator_wchar last, ios_base *base, int *state,
5262 LONG *pval, numpunct_wchar *numpunct)
5264 LONG v;
5265 char tmp[25], *end;
5266 int err;
5268 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5270 v = _Stolx(tmp, &end, num_get__Getifld(this, tmp, &first,
5271 &last, base->fmtfl, base->loc, numpunct), &err);
5272 if(end!=tmp && !err)
5273 *pval = v;
5274 else
5275 *state |= IOSTATE_failbit;
5277 if(!first.strbuf)
5278 *state |= IOSTATE_eofbit;
5280 *ret = first;
5281 return ret;
5284 /* ?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 */
5285 /* ?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 */
5286 #define call_num_get_wchar_do_get_long(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 32, istreambuf_iterator_wchar*, \
5287 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, LONG*), \
5288 (this, ret, first, last, base, state, pval))
5289 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_long,36)
5290 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_long(const num_get *this, istreambuf_iterator_wchar *ret,
5291 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, LONG *pval)
5293 return num_get_do_get_long(this, ret, first, last, base,
5294 state, pval, numpunct_wchar_use_facet(base->loc));
5297 /* ?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 */
5298 /* ?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 */
5299 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_long,36)
5300 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_long(const num_get *this, istreambuf_iterator_wchar *ret,
5301 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, LONG *pval)
5303 return num_get_do_get_long(this, ret, first, last, base,
5304 state, pval, numpunct_short_use_facet(base->loc));
5307 /* ?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 */
5308 /* ?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 */
5309 /* ?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 */
5310 /* ?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 */
5311 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_long,36)
5312 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_long(const num_get *this, istreambuf_iterator_wchar *ret,
5313 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, LONG *pval)
5315 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5316 return call_num_get_wchar_do_get_long(this, ret, first, last, base, state, pval);
5319 /* ?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 */
5320 /* ?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 */
5321 #define call_num_get_wchar_do_get_uint(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 36, istreambuf_iterator_wchar*, \
5322 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, unsigned int*), \
5323 (this, ret, first, last, base, state, pval))
5324 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_uint,36)
5325 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_uint(const num_get *this, istreambuf_iterator_wchar *ret,
5326 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, unsigned int *pval)
5328 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5329 return num_get_wchar_do_get_ulong(this, ret, first, last, base, state, pval);
5332 /* ?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 */
5333 /* ?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 */
5334 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_uint,36)
5335 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_uint(const num_get *this, istreambuf_iterator_wchar *ret,
5336 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, unsigned int *pval)
5338 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5339 return num_get_short_do_get_ulong(this, ret, first, last, base, state, pval);
5342 /* ?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 */
5343 /* ?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 */
5344 /* ?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 */
5345 /* ?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 */
5346 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_uint,36)
5347 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_uint(const num_get *this, istreambuf_iterator_wchar *ret,
5348 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, unsigned int *pval)
5350 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5351 return call_num_get_wchar_do_get_uint(this, ret, first, last, base, state, pval);
5354 /* ?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 */
5355 /* ?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 */
5356 #define call_num_get_wchar_do_get_ushort(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 40, istreambuf_iterator_wchar*, \
5357 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, unsigned short*), \
5358 (this, ret, first, last, base, state, pval))
5359 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_ushort,36)
5360 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_ushort(const num_get *this, istreambuf_iterator_wchar *ret,
5361 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, unsigned short *pval)
5363 ULONG v;
5364 char tmp[25], *beg, *end;
5365 int err, b;
5367 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5369 b = num_get_wchar__Getifld(this, tmp,
5370 &first, &last, base->fmtfl, base->loc);
5371 beg = tmp + (tmp[0]=='-' ? 1 : 0);
5372 v = _Stoulx(beg, &end, b, &err);
5374 if(v != (ULONG)((unsigned short)v))
5375 *state |= IOSTATE_failbit;
5376 else if(end!=beg && !err)
5377 *pval = (tmp[0]=='-' ? -((unsigned short)v) : v);
5378 else
5379 *state |= IOSTATE_failbit;
5381 if(!first.strbuf)
5382 *state |= IOSTATE_eofbit;
5384 *ret = first;
5385 return ret;
5388 /* ?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 */
5389 /* ?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 */
5390 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_ushort,36)
5391 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_ushort(const num_get *this, istreambuf_iterator_wchar *ret,
5392 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, unsigned short *pval)
5394 FIXME("(%p %p %p %p %p) stub\n", this, ret, base, state, pval);
5395 return ret;
5398 /* ?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 */
5399 /* ?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 */
5400 /* ?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@ */
5401 /* ?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 */
5402 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_ushort,36)
5403 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_ushort(const num_get *this, istreambuf_iterator_wchar *ret,
5404 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, unsigned short *pval)
5406 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5407 return call_num_get_wchar_do_get_ushort(this, ret, first, last, base, state, pval);
5410 static istreambuf_iterator_wchar* num_get_do_get_bool(const num_get *this,
5411 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar first,
5412 istreambuf_iterator_wchar last, ios_base *base, int *state,
5413 MSVCP_bool *pval, numpunct_wchar *numpunct)
5415 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5417 if(base->fmtfl & FMTFLAG_boolalpha) {
5418 basic_string_wchar false_bstr, true_bstr;
5419 const wchar_t *pfalse, *ptrue;
5421 numpunct_wchar_falsename(numpunct, &false_bstr);
5422 numpunct_wchar_truename(numpunct, &true_bstr);
5423 pfalse = MSVCP_basic_string_wchar_c_str(&false_bstr);
5424 ptrue = MSVCP_basic_string_wchar_c_str(&true_bstr);
5426 for(istreambuf_iterator_wchar_val(&first); first.strbuf;
5427 istreambuf_iterator_wchar_inc(&first)) {
5428 if(pfalse && *pfalse && first.val!=*pfalse)
5429 pfalse = NULL;
5430 if(ptrue && *ptrue && first.val!=*ptrue)
5431 ptrue = NULL;
5433 if(pfalse && *pfalse && ptrue && !*ptrue)
5434 ptrue = NULL;
5435 if(ptrue && *ptrue && pfalse && !*pfalse)
5436 pfalse = NULL;
5438 if(pfalse)
5439 pfalse++;
5440 if(ptrue)
5441 ptrue++;
5443 if((!pfalse || !*pfalse) && (!ptrue || !*ptrue))
5444 break;
5447 if(ptrue)
5448 *pval = TRUE;
5449 else if(pfalse)
5450 *pval = FALSE;
5451 else
5452 *state |= IOSTATE_failbit;
5454 MSVCP_basic_string_wchar_dtor(&false_bstr);
5455 MSVCP_basic_string_wchar_dtor(&true_bstr);
5456 }else {
5457 char tmp[25], *end;
5458 int err;
5459 LONG v = _Stolx(tmp, &end, num_get__Getifld(this, tmp, &first,
5460 &last, base->fmtfl, base->loc, numpunct), &err);
5462 if(end!=tmp && err==0 && (v==0 || v==1))
5463 *pval = v;
5464 else
5465 *state |= IOSTATE_failbit;
5468 if(!first.strbuf)
5469 *state |= IOSTATE_eofbit;
5470 memcpy(ret, &first, sizeof(first));
5471 return ret;
5474 /* ?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 */
5475 /* ?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 */
5476 #define call_num_get_wchar_do_get_bool(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 44, istreambuf_iterator_wchar*, \
5477 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, MSVCP_bool*), \
5478 (this, ret, first, last, base, state, pval))
5479 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_bool,36)
5480 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_bool(const num_get *this, istreambuf_iterator_wchar *ret,
5481 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, MSVCP_bool *pval)
5483 return num_get_do_get_bool(this, ret, first, last, base,
5484 state, pval, numpunct_wchar_use_facet(base->loc));
5487 /* ?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 */
5488 /* ?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 */
5489 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_bool,36)
5490 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_bool(const num_get *this, istreambuf_iterator_wchar *ret,
5491 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, MSVCP_bool *pval)
5493 return num_get_do_get_bool(this, ret, first, last, base,
5494 state, pval, numpunct_short_use_facet(base->loc));
5497 /* ?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 */
5498 /* ?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 */
5499 /* ?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 */
5500 /* ?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 */
5501 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_bool,36)
5502 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_bool(const num_get *this, istreambuf_iterator_wchar *ret,
5503 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, MSVCP_bool *pval)
5505 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5506 return call_num_get_wchar_do_get_bool(this, ret, first, last, base, state, pval);
5509 /* ?id@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@2V0locale@2@A */
5510 locale_id num_get_char_id = {0};
5512 /* ??_7?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@6B@ */
5513 extern const vtable_ptr MSVCP_num_get_char_vtable;
5515 /* ?_Init@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@IAEXABV_Locinfo@2@@Z */
5516 /* ?_Init@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@IEAAXAEBV_Locinfo@2@@Z */
5517 DEFINE_THISCALL_WRAPPER(num_get_char__Init, 8)
5518 void __thiscall num_get_char__Init(num_get *this, const _Locinfo *locinfo)
5520 TRACE("(%p %p)\n", this, locinfo);
5521 _Locinfo__Getcvt(locinfo, &this->cvt);
5524 /* ??0?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
5525 /* ??0?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
5526 DEFINE_THISCALL_WRAPPER(num_get_char_ctor_locinfo, 12)
5527 num_get* __thiscall num_get_char_ctor_locinfo(num_get *this,
5528 const _Locinfo *locinfo, MSVCP_size_t refs)
5530 TRACE("(%p %p %lu)\n", this, locinfo, refs);
5532 locale_facet_ctor_refs(&this->facet, refs);
5533 this->facet.vtable = &MSVCP_num_get_char_vtable;
5535 num_get_char__Init(this, locinfo);
5536 return this;
5539 /* ??0?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAE@I@Z */
5540 /* ??0?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAA@_K@Z */
5541 DEFINE_THISCALL_WRAPPER(num_get_char_ctor_refs, 8)
5542 num_get* __thiscall num_get_char_ctor_refs(num_get *this, MSVCP_size_t refs)
5544 _Locinfo locinfo;
5546 TRACE("(%p %lu)\n", this, refs);
5548 _Locinfo_ctor(&locinfo);
5549 num_get_char_ctor_locinfo(this, &locinfo, refs);
5550 _Locinfo_dtor(&locinfo);
5551 return this;
5554 /* ??_F?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAEXXZ */
5555 /* ??_F?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAAXXZ */
5556 DEFINE_THISCALL_WRAPPER(num_get_char_ctor, 4)
5557 num_get* __thiscall num_get_char_ctor(num_get *this)
5559 return num_get_char_ctor_refs(this, 0);
5562 /* ??1?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MAE@XZ */
5563 /* ??1?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MEAA@XZ */
5564 DEFINE_THISCALL_WRAPPER(num_get_char_dtor, 4)
5565 void __thiscall num_get_char_dtor(num_get *this)
5567 TRACE("(%p)\n", this);
5568 locale_facet_dtor(&this->facet);
5571 DEFINE_THISCALL_WRAPPER(num_get_char_vector_dtor, 8)
5572 num_get* __thiscall num_get_char_vector_dtor(num_get *this, unsigned int flags)
5574 TRACE("(%p %x)\n", this, flags);
5575 if(flags & 2) {
5576 /* we have an array, with the number of elements stored before the first object */
5577 INT_PTR i, *ptr = (INT_PTR *)this-1;
5579 for(i=*ptr-1; i>=0; i--)
5580 num_get_char_dtor(this+i);
5581 MSVCRT_operator_delete(ptr);
5582 } else {
5583 num_get_char_dtor(this);
5584 if(flags & 1)
5585 MSVCRT_operator_delete(this);
5588 return this;
5591 /* ?_Getcat@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
5592 /* ?_Getcat@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
5593 static MSVCP_size_t num_get_char__Getcat(const locale_facet **facet, const locale *loc)
5595 TRACE("(%p %p)\n", facet, loc);
5597 if(facet && !*facet) {
5598 _Locinfo locinfo;
5600 *facet = MSVCRT_operator_new(sizeof(num_get));
5601 if(!*facet) {
5602 ERR("Out of memory\n");
5603 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
5604 return 0;
5607 _Locinfo_ctor_cstr(&locinfo, MSVCP_basic_string_char_c_str(&loc->ptr->name));
5608 num_get_char_ctor_locinfo((num_get*)*facet, &locinfo, 0);
5609 _Locinfo_dtor(&locinfo);
5612 return LC_NUMERIC;
5615 /* ?_Getcat@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SAIPAPBVfacet@locale@2@@Z */
5616 /* ?_Getcat@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@@Z */
5617 MSVCP_size_t __cdecl num_get_char__Getcat_old(const locale_facet **facet)
5619 return num_get_char__Getcat(facet, locale_classic());
5622 num_get* num_get_char_use_facet(const locale *loc)
5624 static num_get *obj = NULL;
5626 _Lockit lock;
5627 const locale_facet *fac;
5629 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
5630 fac = locale__Getfacet(loc, locale_id_operator_size_t(&num_get_char_id));
5631 if(fac) {
5632 _Lockit_dtor(&lock);
5633 return (num_get*)fac;
5636 if(obj) {
5637 _Lockit_dtor(&lock);
5638 return obj;
5641 num_get_char__Getcat(&fac, loc);
5642 obj = (num_get*)fac;
5643 locale_facet__Incref(&obj->facet);
5644 locale_facet_register(&obj->facet);
5645 _Lockit_dtor(&lock);
5647 return obj;
5650 /* ?_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 */
5651 /* ?_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 */
5652 /* Copies number to dest buffer, validates grouping and skips separators.
5653 * Updates first so it points past the number, all digits are skipped.
5654 * Returns how exponent needs to changed.
5655 * Size of dest buffer is not specified, assuming it's not smaller than 32:
5656 * strlen(+0.e+) + 22(digits) + 4(expontent) + 1(nullbyte)
5658 int __cdecl num_get_char__Getffld(const num_get *this, char *dest, istreambuf_iterator_char *first,
5659 istreambuf_iterator_char *last, const locale *loc)
5661 numpunct_char *numpunct = numpunct_char_use_facet(loc);
5662 basic_string_char grouping_bstr;
5663 basic_string_char groups_found;
5664 int groups_no = 0, cur_group = 0, exp = 0;
5665 char *dest_beg = dest, *num_end = dest+25, *exp_end = dest+31, sep;
5666 const char *grouping, *groups;
5667 BOOL error = FALSE, got_digit = FALSE, got_nonzero = FALSE;
5669 TRACE("(%p %p %p %p)\n", dest, first, last, loc);
5671 numpunct_char_grouping(numpunct, &grouping_bstr);
5672 grouping = MSVCP_basic_string_char_c_str(&grouping_bstr);
5673 sep = grouping[0] ? numpunct_char_thousands_sep(numpunct) : '\0';
5675 if(sep)
5676 MSVCP_basic_string_char_ctor(&groups_found);
5678 istreambuf_iterator_char_val(first);
5679 /* get sign */
5680 if(first->strbuf && (first->val=='-' || first->val=='+')) {
5681 *dest++ = first->val;
5682 istreambuf_iterator_char_inc(first);
5685 /* read possibly grouped numbers before decimal */
5686 for(; first->strbuf; istreambuf_iterator_char_inc(first)) {
5687 if(first->val<'0' || first->val>'9') {
5688 if(sep && first->val==sep) {
5689 if(!groups_no) break; /* empty group - stop parsing */
5690 MSVCP_basic_string_char_append_ch(&groups_found, groups_no);
5691 groups_no = 0;
5692 ++cur_group;
5693 }else {
5694 break;
5696 }else {
5697 got_digit = TRUE; /* found a digit, zero or non-zero */
5698 /* write digit to dest if not a leading zero (to not waste dest buffer) */
5699 if(!got_nonzero && first->val == '0')
5701 ++groups_no;
5702 continue;
5704 got_nonzero = TRUE;
5705 if(dest < num_end)
5706 *dest++ = first->val;
5707 else
5708 exp++; /* too many digits, just multiply by 10 */
5709 if(sep && groups_no<CHAR_MAX)
5710 ++groups_no;
5714 /* if all leading zeroes, we didn't write anything so put a zero we check for a decimal */
5715 if(got_digit && !got_nonzero)
5716 *dest++ = '0';
5718 /* get decimal, if any */
5719 if(first->strbuf && first->val==numpunct_char_decimal_point(numpunct)) {
5720 if(dest < num_end)
5721 *dest++ = *localeconv()->decimal_point;
5722 istreambuf_iterator_char_inc(first);
5725 /* read non-grouped after decimal */
5726 for(; first->strbuf; istreambuf_iterator_char_inc(first)) {
5727 if(first->val<'0' || first->val>'9')
5728 break;
5729 else if(dest<num_end) {
5730 got_digit = TRUE;
5731 *dest++ = first->val;
5735 /* read exponent, if any */
5736 if(first->strbuf && (first->val=='e' || first->val=='E')) {
5737 *dest++ = first->val;
5738 istreambuf_iterator_char_inc(first);
5740 if(first->strbuf && (first->val=='-' || first->val=='+')) {
5741 *dest++ = first->val;
5742 istreambuf_iterator_char_inc(first);
5745 got_digit = got_nonzero = FALSE;
5746 error = TRUE;
5747 /* skip any leading zeroes */
5748 for(; first->strbuf && first->val=='0'; istreambuf_iterator_char_inc(first))
5749 got_digit = TRUE;
5751 for(; first->strbuf && first->val>='0' && first->val<='9'; istreambuf_iterator_char_inc(first)) {
5752 got_digit = got_nonzero = TRUE; /* leading zeroes would have been skipped, so first digit is non-zero */
5753 error = FALSE;
5754 if(dest<exp_end)
5755 *dest++ = first->val;
5758 /* if just found zeroes for exponent, use that */
5759 if(got_digit && !got_nonzero)
5761 error = FALSE;
5762 if(dest<exp_end)
5763 *dest++ = '0';
5767 if(sep && groups_no)
5768 MSVCP_basic_string_char_append_ch(&groups_found, groups_no);
5770 if(!cur_group) /* no groups, skip loop */
5771 cur_group--;
5772 else if(!(groups = MSVCP_basic_string_char_c_str(&groups_found))[cur_group])
5773 error = TRUE; /* trailing empty */
5775 for(; cur_group>=0 && !error; cur_group--) {
5776 if(*grouping == CHAR_MAX) {
5777 if(cur_group)
5778 error = TRUE;
5779 break;
5780 }else if((cur_group && *grouping!=groups[cur_group])
5781 || (!cur_group && *grouping<groups[cur_group])) {
5782 error = TRUE;
5783 break;
5784 }else if(grouping[1]) {
5785 grouping++;
5788 MSVCP_basic_string_char_dtor(&grouping_bstr);
5789 if(sep)
5790 MSVCP_basic_string_char_dtor(&groups_found);
5792 if(error) {
5793 *dest_beg = '\0';
5794 return 0;
5796 *dest++ = '\0';
5797 return exp;
5800 /* ?_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 */
5801 /* ?_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 */
5802 /* Copies number to dest buffer, validates grouping and skips separators.
5803 * Updates first so it points past the number, all digits are skipped.
5804 * Returns number base (8, 10 or 16).
5805 * Size of dest buffer is not specified, assuming it's not smaller than 25:
5806 * 22(8^22>2^64)+1(detect overflows)+1(sign)+1(nullbyte) = 25
5808 int __cdecl num_get_char__Getifld(const num_get *this, char *dest, istreambuf_iterator_char *first,
5809 istreambuf_iterator_char *last, int fmtflags, const locale *loc)
5811 static const char digits[] = "0123456789abcdefABCDEF";
5813 numpunct_char *numpunct = numpunct_char_use_facet(loc);
5814 basic_string_char grouping_bstr;
5815 basic_string_char groups_found;
5816 int basefield, base, groups_no = 0, cur_group = 0;
5817 char *dest_beg = dest, *dest_end = dest+24, sep;
5818 const char *grouping, *groups;
5819 BOOL error = TRUE, dest_empty = TRUE, found_zero = FALSE;
5821 TRACE("(%p %p %p %04x %p)\n", dest, first, last, fmtflags, loc);
5823 numpunct_char_grouping(numpunct, &grouping_bstr);
5824 grouping = MSVCP_basic_string_char_c_str(&grouping_bstr);
5825 sep = grouping[0] ? numpunct_char_thousands_sep(numpunct) : '\0';
5827 basefield = fmtflags & FMTFLAG_basefield;
5828 if(basefield == FMTFLAG_oct)
5829 base = 8;
5830 else if(basefield == FMTFLAG_hex)
5831 base = 22; /* equal to the size of digits buffer */
5832 else if(!basefield)
5833 base = 0;
5834 else
5835 base = 10;
5837 istreambuf_iterator_char_val(first);
5838 if(first->strbuf && (first->val=='-' || first->val=='+')) {
5839 *dest++ = first->val;
5840 istreambuf_iterator_char_inc(first);
5843 if(first->strbuf && first->val=='0') {
5844 found_zero = TRUE;
5845 istreambuf_iterator_char_inc(first);
5846 if(first->strbuf && (first->val=='x' || first->val=='X')) {
5847 if(!base || base == 22) {
5848 found_zero = FALSE;
5849 istreambuf_iterator_char_inc(first);
5850 base = 22;
5851 }else {
5852 base = 10;
5854 }else {
5855 error = FALSE;
5856 if(!base) base = 8;
5858 }else {
5859 if (!base) base = 10;
5862 if(sep)
5864 MSVCP_basic_string_char_ctor(&groups_found);
5865 if(found_zero) ++groups_no;
5868 for(; first->strbuf; istreambuf_iterator_char_inc(first)) {
5869 if(!memchr(digits, first->val, base)) {
5870 if(sep && first->val==sep) {
5871 if(!groups_no) break; /* empty group - stop parsing */
5872 MSVCP_basic_string_char_append_ch(&groups_found, groups_no);
5873 groups_no = 0;
5874 ++cur_group;
5875 }else {
5876 break;
5878 }else {
5879 error = FALSE;
5880 if(dest_empty && first->val == '0')
5882 found_zero = TRUE;
5883 ++groups_no;
5884 continue;
5886 dest_empty = FALSE;
5887 /* skip digits that can't be copied to dest buffer, other
5888 * functions are responsible for detecting overflows */
5889 if(dest < dest_end)
5890 *dest++ = first->val;
5891 if(sep && groups_no<CHAR_MAX)
5892 ++groups_no;
5896 if(sep && groups_no)
5897 MSVCP_basic_string_char_append_ch(&groups_found, groups_no);
5899 if(!cur_group) { /* no groups, skip loop */
5900 cur_group--;
5901 }else if(!(groups = MSVCP_basic_string_char_c_str(&groups_found))[cur_group]) {
5902 error = TRUE; /* trailing empty */
5903 found_zero = FALSE;
5906 for(; cur_group>=0 && !error; cur_group--) {
5907 if(*grouping == CHAR_MAX) {
5908 if(cur_group)
5909 error = TRUE;
5910 break;
5911 }else if((cur_group && *grouping!=groups[cur_group])
5912 || (!cur_group && *grouping<groups[cur_group])) {
5913 error = TRUE;
5914 break;
5915 }else if(grouping[1]) {
5916 grouping++;
5920 MSVCP_basic_string_char_dtor(&grouping_bstr);
5921 if(sep)
5922 MSVCP_basic_string_char_dtor(&groups_found);
5924 if(error) {
5925 if (found_zero)
5926 *dest++ = '0';
5927 else
5928 dest = dest_beg;
5929 }else if(dest_empty)
5930 *dest++ = '0';
5931 *dest = '\0';
5933 return (base==22 ? 16 : base);
5936 /* ?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 */
5937 /* ?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 */
5938 #define call_num_get_char_do_get_void(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 4, istreambuf_iterator_char*, \
5939 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, void**), \
5940 (this, ret, first, last, base, state, pval))
5941 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_void,36)
5942 istreambuf_iterator_char *__thiscall num_get_char_do_get_void(const num_get *this, istreambuf_iterator_char *ret,
5943 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, void **pval)
5945 unsigned __int64 v;
5946 char tmp[25], *end;
5947 int err;
5949 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5951 v = _Stoullx(tmp, &end, num_get_char__Getifld(this, tmp,
5952 &first, &last, FMTFLAG_hex, base->loc), &err);
5953 if(v!=(unsigned __int64)((INT_PTR)v))
5954 *state |= IOSTATE_failbit;
5955 else if(end!=tmp && !err)
5956 *pval = (void*)((INT_PTR)v);
5957 else
5958 *state |= IOSTATE_failbit;
5960 if(!first.strbuf)
5961 *state |= IOSTATE_eofbit;
5963 *ret = first;
5964 return ret;
5967 /* ?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 */
5968 /* ?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 */
5969 DEFINE_THISCALL_WRAPPER(num_get_char_get_void,36)
5970 istreambuf_iterator_char *__thiscall num_get_char_get_void(const num_get *this, istreambuf_iterator_char *ret,
5971 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, void **pval)
5973 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5974 return call_num_get_char_do_get_void(this, ret, first, last, base, state, pval);
5977 /* ?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 */
5978 /* ?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 */
5979 /* ?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 */
5980 /* ?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 */
5981 #define call_num_get_char_do_get_ldouble(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 8, istreambuf_iterator_char*, \
5982 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, double*), \
5983 (this, ret, first, last, base, state, pval))
5984 #define call_num_get_char_do_get_double(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 12, istreambuf_iterator_char*, \
5985 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, double*), \
5986 (this, ret, first, last, base, state, pval))
5987 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_double,36)
5988 istreambuf_iterator_char *__thiscall num_get_char_do_get_double(const num_get *this, istreambuf_iterator_char *ret,
5989 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, double *pval)
5991 double v;
5992 char tmp[32], *end;
5993 int err;
5995 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5997 v = _Stodx(tmp, &end, num_get_char__Getffld(this, tmp, &first, &last, base->loc), &err);
5998 if(end!=tmp && !err)
5999 *pval = v;
6000 else
6001 *state |= IOSTATE_failbit;
6003 if(!first.strbuf)
6004 *state |= IOSTATE_eofbit;
6006 *ret = first;
6007 return ret;
6010 /* ?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 */
6011 /* ?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 */
6012 DEFINE_THISCALL_WRAPPER(num_get_char_get_ldouble,36)
6013 istreambuf_iterator_char *__thiscall num_get_char_get_ldouble(const num_get *this, istreambuf_iterator_char *ret,
6014 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, double *pval)
6016 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6017 return call_num_get_char_do_get_ldouble(this, ret, first, last, base, state, pval);
6020 /* ?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 */
6021 /* ?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 */
6022 DEFINE_THISCALL_WRAPPER(num_get_char_get_double,36)
6023 istreambuf_iterator_char *__thiscall num_get_char_get_double(const num_get *this, istreambuf_iterator_char *ret,
6024 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, double *pval)
6026 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6027 return call_num_get_char_do_get_double(this, ret, first, last, base, state, pval);
6030 /* ?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 */
6031 /* ?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 */
6032 #define call_num_get_char_do_get_float(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 16, istreambuf_iterator_char*, \
6033 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, float*), \
6034 (this, ret, first, last, base, state, pval))
6035 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_float,36)
6036 istreambuf_iterator_char *__thiscall num_get_char_do_get_float(const num_get *this, istreambuf_iterator_char *ret,
6037 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, float *pval)
6039 float v;
6040 char tmp[32], *end;
6041 int err;
6043 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6045 v = _Stofx(tmp, &end, num_get_char__Getffld(this, tmp, &first, &last, base->loc), &err);
6046 if(end!=tmp && !err)
6047 *pval = v;
6048 else
6049 *state |= IOSTATE_failbit;
6051 if(!first.strbuf)
6052 *state |= IOSTATE_eofbit;
6054 *ret = first;
6055 return ret;
6058 /* ?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 */
6059 /* ?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 */
6060 DEFINE_THISCALL_WRAPPER(num_get_char_get_float,36)
6061 istreambuf_iterator_char *__thiscall num_get_char_get_float(const num_get *this, istreambuf_iterator_char *ret,
6062 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, float *pval)
6064 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6065 return call_num_get_char_do_get_float(this, ret, first, last, base, state, pval);
6068 /* ?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 */
6069 /* ?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 */
6070 #define call_num_get_char_do_get_uint64(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 20, istreambuf_iterator_char*, \
6071 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, ULONGLONG*), \
6072 (this, ret, first, last, base, state, pval))
6073 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_uint64,36)
6074 istreambuf_iterator_char *__thiscall num_get_char_do_get_uint64(const num_get *this, istreambuf_iterator_char *ret,
6075 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, ULONGLONG *pval)
6077 unsigned __int64 v;
6078 char tmp[25], *end;
6079 int err;
6081 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6083 v = _Stoullx(tmp, &end, num_get_char__Getifld(this, tmp,
6084 &first, &last, base->fmtfl, base->loc), &err);
6085 if(end!=tmp && !err)
6086 *pval = v;
6087 else
6088 *state |= IOSTATE_failbit;
6090 if(!first.strbuf)
6091 *state |= IOSTATE_eofbit;
6093 *ret = first;
6094 return ret;
6097 /* ?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 */
6098 /* ?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 */
6099 DEFINE_THISCALL_WRAPPER(num_get_char_get_uint64,36)
6100 istreambuf_iterator_char *__thiscall num_get_char_get_uint64(const num_get *this, istreambuf_iterator_char *ret,
6101 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, ULONGLONG *pval)
6103 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6104 return call_num_get_char_do_get_uint64(this, ret, first, last, base, state, pval);
6107 /* ?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 */
6108 /* ?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 */
6109 #define call_num_get_char_do_get_int64(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 24, istreambuf_iterator_char*, \
6110 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, LONGLONG*), \
6111 (this, ret, first, last, base, state, pval))
6112 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_int64,36)
6113 istreambuf_iterator_char *__thiscall num_get_char_do_get_int64(const num_get *this, istreambuf_iterator_char *ret,
6114 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, LONGLONG *pval)
6116 __int64 v;
6117 char tmp[25], *end;
6118 int err;
6120 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6122 v = _Stollx(tmp, &end, num_get_char__Getifld(this, tmp,
6123 &first, &last, base->fmtfl, base->loc), &err);
6124 if(end!=tmp && !err)
6125 *pval = v;
6126 else
6127 *state |= IOSTATE_failbit;
6129 if(!first.strbuf)
6130 *state |= IOSTATE_eofbit;
6132 *ret = first;
6133 return ret;
6136 /* ?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 */
6137 /* ?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 */
6138 DEFINE_THISCALL_WRAPPER(num_get_char_get_int64,36)
6139 istreambuf_iterator_char *__thiscall num_get_char_get_int64(const num_get *this, istreambuf_iterator_char *ret,
6140 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, LONGLONG *pval)
6142 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6143 return call_num_get_char_do_get_int64(this, ret, first, last, base, state, pval);
6146 /* ?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 */
6147 /* ?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 */
6148 #define call_num_get_char_do_get_ulong(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 28, istreambuf_iterator_char*, \
6149 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, ULONG*), \
6150 (this, ret, first, last, base, state, pval))
6151 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_ulong,36)
6152 istreambuf_iterator_char *__thiscall num_get_char_do_get_ulong(const num_get *this, istreambuf_iterator_char *ret,
6153 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, ULONG *pval)
6155 ULONG v;
6156 char tmp[25], *end;
6157 int err;
6159 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6161 v = _Stoulx(tmp, &end, num_get_char__Getifld(this, tmp,
6162 &first, &last, base->fmtfl, base->loc), &err);
6163 if(end!=tmp && !err)
6164 *pval = v;
6165 else
6166 *state |= IOSTATE_failbit;
6168 if(!first.strbuf)
6169 *state |= IOSTATE_eofbit;
6171 *ret = first;
6172 return ret;
6175 /* ?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 */
6176 /* ?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 */
6177 DEFINE_THISCALL_WRAPPER(num_get_char_get_ulong,36)
6178 istreambuf_iterator_char *__thiscall num_get_char_get_ulong(const num_get *this, istreambuf_iterator_char *ret,
6179 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, ULONG *pval)
6181 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6182 return call_num_get_char_do_get_ulong(this, ret, first, last, base, state, pval);
6185 /* ?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 */
6186 /* ?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 */
6187 #define call_num_get_char_do_get_long(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 32, istreambuf_iterator_char*, \
6188 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, LONG*), \
6189 (this, ret, first, last, base, state, pval))
6190 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_long,36)
6191 istreambuf_iterator_char *__thiscall num_get_char_do_get_long(const num_get *this, istreambuf_iterator_char *ret,
6192 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, LONG *pval)
6194 LONG v;
6195 char tmp[25], *end;
6196 int err;
6198 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6200 v = _Stolx(tmp, &end, num_get_char__Getifld(this, tmp,
6201 &first, &last, base->fmtfl, base->loc), &err);
6202 if(end!=tmp && !err)
6203 *pval = v;
6204 else
6205 *state |= IOSTATE_failbit;
6207 if(!first.strbuf)
6208 *state |= IOSTATE_eofbit;
6210 *ret = first;
6211 return ret;
6214 /* ?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 */
6215 /* ?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 */
6216 DEFINE_THISCALL_WRAPPER(num_get_char_get_long,36)
6217 istreambuf_iterator_char *__thiscall num_get_char_get_long(const num_get *this, istreambuf_iterator_char *ret,
6218 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, LONG *pval)
6220 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6221 return call_num_get_char_do_get_long(this, ret, first, last, base, state, pval);
6224 /* ?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 */
6225 /* ?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 */
6226 #define call_num_get_char_do_get_uint(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 36, istreambuf_iterator_char*, \
6227 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, unsigned int*), \
6228 (this, ret, first, last, base, state, pval))
6229 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_uint,36)
6230 istreambuf_iterator_char *__thiscall num_get_char_do_get_uint(const num_get *this, istreambuf_iterator_char *ret,
6231 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, unsigned int *pval)
6233 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6234 return num_get_char_do_get_ulong(this, ret, first, last, base, state, pval);
6237 /* ?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 */
6238 /* ?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 */
6239 DEFINE_THISCALL_WRAPPER(num_get_char_get_uint,36)
6240 istreambuf_iterator_char *__thiscall num_get_char_get_uint(const num_get *this, istreambuf_iterator_char *ret,
6241 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, unsigned int *pval)
6243 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6244 return call_num_get_char_do_get_uint(this, ret, first, last, base, state, pval);
6247 /* ?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 */
6248 /* ?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 */
6249 #define call_num_get_char_do_get_ushort(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 40, istreambuf_iterator_char*, \
6250 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, unsigned short*), \
6251 (this, ret, first, last, base, state, pval))
6252 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_ushort,36)
6253 istreambuf_iterator_char *__thiscall num_get_char_do_get_ushort(const num_get *this, istreambuf_iterator_char *ret,
6254 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, unsigned short *pval)
6256 ULONG v;
6257 char tmp[25], *beg, *end;
6258 int err, b;
6260 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6262 b = num_get_char__Getifld(this, tmp,
6263 &first, &last, base->fmtfl, base->loc);
6264 beg = tmp + (tmp[0]=='-' ? 1 : 0);
6265 v = _Stoulx(beg, &end, b, &err);
6267 if(v != (ULONG)((unsigned short)v))
6268 *state |= IOSTATE_failbit;
6269 else if(end!=beg && !err)
6270 *pval = (tmp[0]=='-' ? -((unsigned short)v) : v);
6271 else
6272 *state |= IOSTATE_failbit;
6274 if(!first.strbuf)
6275 *state |= IOSTATE_eofbit;
6277 *ret = first;
6278 return ret;
6281 /* ?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 */
6282 /* ?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 */
6283 DEFINE_THISCALL_WRAPPER(num_get_char_get_ushort,36)
6284 istreambuf_iterator_char *__thiscall num_get_char_get_ushort(const num_get *this, istreambuf_iterator_char *ret,
6285 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, unsigned short *pval)
6287 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6288 return call_num_get_char_do_get_ushort(this, ret, first, last, base, state, pval);
6291 /* ?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 */
6292 /* ?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 */
6293 #define call_num_get_char_do_get_bool(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 44, istreambuf_iterator_char*, \
6294 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, MSVCP_bool*), \
6295 (this, ret, first, last, base, state, pval))
6296 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_bool,36)
6297 istreambuf_iterator_char *__thiscall num_get_char_do_get_bool(const num_get *this, istreambuf_iterator_char *ret,
6298 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, MSVCP_bool *pval)
6300 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6302 if(base->fmtfl & FMTFLAG_boolalpha) {
6303 numpunct_char *numpunct = numpunct_char_use_facet(base->loc);
6304 basic_string_char false_bstr, true_bstr;
6305 const char *pfalse, *ptrue;
6307 numpunct_char_falsename(numpunct, &false_bstr);
6308 numpunct_char_truename(numpunct, &true_bstr);
6309 pfalse = MSVCP_basic_string_char_c_str(&false_bstr);
6310 ptrue = MSVCP_basic_string_char_c_str(&true_bstr);
6312 for(istreambuf_iterator_char_val(&first); first.strbuf;
6313 istreambuf_iterator_char_inc(&first)) {
6314 if(pfalse && *pfalse && first.val!=*pfalse)
6315 pfalse = NULL;
6316 if(ptrue && *ptrue && first.val!=*ptrue)
6317 ptrue = NULL;
6319 if(pfalse && *pfalse && ptrue && !*ptrue)
6320 ptrue = NULL;
6321 if(ptrue && *ptrue && pfalse && !*pfalse)
6322 pfalse = NULL;
6324 if(pfalse)
6325 pfalse++;
6326 if(ptrue)
6327 ptrue++;
6329 if((!pfalse || !*pfalse) && (!ptrue || !*ptrue))
6330 break;
6333 if(ptrue)
6334 *pval = TRUE;
6335 else if(pfalse)
6336 *pval = FALSE;
6337 else
6338 *state |= IOSTATE_failbit;
6340 MSVCP_basic_string_char_dtor(&false_bstr);
6341 MSVCP_basic_string_char_dtor(&true_bstr);
6342 }else {
6343 char tmp[25], *end;
6344 int err;
6345 LONG v = _Stolx(tmp, &end, num_get_char__Getifld(this, tmp,
6346 &first, &last, base->fmtfl, base->loc), &err);
6348 if(end!=tmp && err==0 && (v==0 || v==1))
6349 *pval = v;
6350 else
6351 *state |= IOSTATE_failbit;
6354 if(!first.strbuf)
6355 *state |= IOSTATE_eofbit;
6356 memcpy(ret, &first, sizeof(first));
6357 return ret;
6360 /* ?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 */
6361 /* ?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 */
6362 DEFINE_THISCALL_WRAPPER(num_get_char_get_bool,36)
6363 istreambuf_iterator_char *__thiscall num_get_char_get_bool(const num_get *this, istreambuf_iterator_char *ret,
6364 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, MSVCP_bool *pval)
6366 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6367 return call_num_get_char_do_get_bool(this, ret, first, last, base, state, pval);
6370 /* ?id@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@2V0locale@2@A */
6371 locale_id num_put_char_id = {0};
6373 /* num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@6B@ */
6374 extern const vtable_ptr MSVCP_num_put_char_vtable;
6376 /* ?_Init@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@IAEXABV_Locinfo@2@@Z */
6377 /* ?_Init@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@IEAAXAEBV_Locinfo@2@@Z */
6378 DEFINE_THISCALL_WRAPPER(num_put_char__Init, 8)
6379 void __thiscall num_put_char__Init(num_put *this, const _Locinfo *locinfo)
6381 TRACE("(%p %p)\n", this, locinfo);
6382 _Locinfo__Getcvt(locinfo, &this->cvt);
6385 /* ??0?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
6386 /* ??0?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
6387 DEFINE_THISCALL_WRAPPER(num_put_char_ctor_locinfo, 12)
6388 num_put* __thiscall num_put_char_ctor_locinfo(num_put *this, const _Locinfo *locinfo, MSVCP_size_t refs)
6390 TRACE("(%p %p %ld)\n", this, locinfo, refs);
6392 locale_facet_ctor_refs(&this->facet, refs);
6393 this->facet.vtable = &MSVCP_num_put_char_vtable;
6395 num_put_char__Init(this, locinfo);
6396 return this;
6399 /* ??0?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAE@I@Z */
6400 /* ??0?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAA@_K@Z */
6401 DEFINE_THISCALL_WRAPPER(num_put_char_ctor_refs, 8)
6402 num_put* __thiscall num_put_char_ctor_refs(num_put *this, MSVCP_size_t refs)
6404 _Locinfo locinfo;
6406 TRACE("(%p %lu)\n", this, refs);
6408 _Locinfo_ctor(&locinfo);
6409 num_put_char_ctor_locinfo(this, &locinfo, refs);
6410 _Locinfo_dtor(&locinfo);
6411 return this;
6414 /* ??_F?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAEXXZ */
6415 /* ??_F?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAAXXZ */
6416 DEFINE_THISCALL_WRAPPER(num_put_char_ctor, 4)
6417 num_put* __thiscall num_put_char_ctor(num_put *this)
6419 return num_put_char_ctor_refs(this, 0);
6422 /* ??1?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MAE@XZ */
6423 /* ??1?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MEAA@XZ */
6424 DEFINE_THISCALL_WRAPPER(num_put_char_dtor, 4)
6425 void __thiscall num_put_char_dtor(num_put *this)
6427 TRACE("(%p)\n", this);
6428 locale_facet_dtor(&this->facet);
6431 DEFINE_THISCALL_WRAPPER(num_put_char_vector_dtor, 8)
6432 num_put* __thiscall num_put_char_vector_dtor(num_put *this, unsigned int flags)
6434 TRACE("(%p %x)\n", this, flags);
6435 if(flags & 2) {
6436 /* we have an array, with the number of elements stored before the first object */
6437 INT_PTR i, *ptr = (INT_PTR *)this-1;
6439 for(i=*ptr-1; i>=0; i--)
6440 num_put_char_dtor(this+i);
6441 MSVCRT_operator_delete(ptr);
6442 } else {
6443 num_put_char_dtor(this);
6444 if(flags & 1)
6445 MSVCRT_operator_delete(this);
6448 return this;
6451 /* ?_Getcat@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
6452 /* ?_Getcat@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
6453 static MSVCP_size_t num_put_char__Getcat(const locale_facet **facet, const locale *loc)
6455 TRACE("(%p %p)\n", facet, loc);
6457 if(facet && !*facet) {
6458 _Locinfo locinfo;
6460 *facet = MSVCRT_operator_new(sizeof(num_put));
6461 if(!*facet) {
6462 ERR("Out of memory\n");
6463 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
6464 return 0;
6467 _Locinfo_ctor_cstr(&locinfo, MSVCP_basic_string_char_c_str(&loc->ptr->name));
6468 num_put_char_ctor_locinfo((num_put*)*facet, &locinfo, 0);
6469 _Locinfo_dtor(&locinfo);
6472 return LC_NUMERIC;
6475 /* ?_Getcat@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SAIPAPBVfacet@locale@2@@Z */
6476 /* ?_Getcat@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@@Z */
6477 MSVCP_size_t __cdecl num_put_char__Getcat_old(const locale_facet **facet)
6479 return num_put_char__Getcat(facet, locale_classic());
6482 num_put* num_put_char_use_facet(const locale *loc)
6484 static num_put *obj = NULL;
6486 _Lockit lock;
6487 const locale_facet *fac;
6489 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
6490 fac = locale__Getfacet(loc, locale_id_operator_size_t(&num_put_char_id));
6491 if(fac) {
6492 _Lockit_dtor(&lock);
6493 return (num_put*)fac;
6496 if(obj) {
6497 _Lockit_dtor(&lock);
6498 return obj;
6501 num_put_char__Getcat(&fac, loc);
6502 obj = (num_put*)fac;
6503 locale_facet__Incref(&obj->facet);
6504 locale_facet_register(&obj->facet);
6505 _Lockit_dtor(&lock);
6507 return obj;
6510 /* ?_Put@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@ABA?AV?$ostreambuf_iterator@DU?$char_traits@D@std@@@2@V32@PBDI@Z */
6511 /* ?_Put@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@AEBA?AV?$ostreambuf_iterator@DU?$char_traits@D@std@@@2@V32@PEBD_K@Z */
6512 ostreambuf_iterator_char* __cdecl num_put_char__Put(const num_put *this, ostreambuf_iterator_char *ret,
6513 ostreambuf_iterator_char dest, const char *ptr, MSVCP_size_t count)
6515 TRACE("(%p %p %p %ld)\n", this, ret, ptr, count);
6517 for(; count>0; count--)
6518 ostreambuf_iterator_char_put(&dest, *ptr++);
6520 *ret = dest;
6521 return ret;
6524 /* ?_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 */
6525 /* ?_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 */
6526 ostreambuf_iterator_char* __cdecl num_put_char__Putc(const num_put *this, ostreambuf_iterator_char *ret,
6527 ostreambuf_iterator_char dest, const char *ptr, MSVCP_size_t count)
6529 TRACE("(%p %p %p %ld)\n", this, ret, ptr, count);
6531 for(; count>0; count--)
6532 ostreambuf_iterator_char_put(&dest, *ptr++);
6534 *ret = dest;
6535 return ret;
6538 /* ?_Putgrouped@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@ABA?AV?$ostreambuf_iterator@DU?$char_traits@D@std@@@2@V32@PBDID@Z */
6539 /* ?_Putgrouped@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@AEBA?AV?$ostreambuf_iterator@DU?$char_traits@D@std@@@2@V32@PEBD_KD@Z */
6540 ostreambuf_iterator_char* __cdecl num_put_char__Putgrouped(const num_put *this, ostreambuf_iterator_char *ret,
6541 ostreambuf_iterator_char dest, const char *ptr, MSVCP_size_t count, char delim)
6543 FIXME("(%p %p %p %ld %d) stub\n", this, ret, ptr, count, delim);
6544 return NULL;
6547 /* ?_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 */
6548 /* ?_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 */
6549 ostreambuf_iterator_char* __cdecl num_put_char__Rep(const num_put *this, ostreambuf_iterator_char *ret,
6550 ostreambuf_iterator_char dest, char c, MSVCP_size_t count)
6552 TRACE("(%p %p %d %ld)\n", this, ret, c, count);
6554 for(; count>0; count--)
6555 ostreambuf_iterator_char_put(&dest, c);
6557 *ret = dest;
6558 return ret;
6561 /* ?_Ffmt@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@ABAPADPADDH@Z */
6562 /* ?_Ffmt@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@AEBAPEADPEADDH@Z */
6563 char* __cdecl num_put_char__Ffmt(const num_put *this, char *fmt, char spec, int fmtfl)
6565 int type = fmtfl & FMTFLAG_floatfield;
6566 char *p = fmt;
6568 TRACE("(%p %p %d %d)\n", this, fmt, spec, fmtfl);
6570 *p++ = '%';
6571 if(fmtfl & FMTFLAG_showpos)
6572 *p++ = '+';
6573 if(fmtfl & FMTFLAG_showbase)
6574 *p++ = '#';
6575 *p++ = '.';
6576 *p++ = '*';
6577 if(spec)
6578 *p++ = spec;
6580 if(type == FMTFLAG_fixed)
6581 *p++ = 'f';
6582 else if(type == FMTFLAG_scientific)
6583 *p++ = (fmtfl & FMTFLAG_uppercase) ? 'E' : 'e';
6584 else if(type == (FMTFLAG_fixed|FMTFLAG_scientific))
6585 *p++ = (fmtfl & FMTFLAG_uppercase) ? 'A' : 'a';
6586 else
6587 *p++ = (fmtfl & FMTFLAG_uppercase) ? 'G' : 'g';
6589 *p++ = '\0';
6590 return fmt;
6593 /* ?_Fput@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@ABA?AV?$ostreambuf_iterator@DU?$char_traits@D@std@@@2@V32@AAVios_base@2@DPBDIIII@Z */
6594 /* ?_Fput@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@AEBA?AV?$ostreambuf_iterator@DU?$char_traits@D@std@@@2@V32@AEAVios_base@2@DPEBD_K333@Z */
6595 ostreambuf_iterator_char* __cdecl num_put_char__Fput(const num_put *this, ostreambuf_iterator_char *ret,
6596 ostreambuf_iterator_char dest, ios_base *base, char fill, const char *buf, MSVCP_size_t bef_point,
6597 MSVCP_size_t aft_point, MSVCP_size_t trailing, MSVCP_size_t count)
6599 FIXME("(%p %p %p %d %p %ld %ld %ld %ld) stub\n", this, ret, base,
6600 fill, buf, bef_point, aft_point, trailing, count);
6601 return NULL;
6604 /* TODO: This function should be removed when num_put_char__Fput is implemented */
6605 static ostreambuf_iterator_char* num_put_char_fput(const num_put *this, ostreambuf_iterator_char *ret,
6606 ostreambuf_iterator_char dest, ios_base *base, char fill, char *buf, MSVCP_size_t count)
6608 numpunct_char *numpunct = numpunct_char_use_facet(base->loc);
6609 basic_string_char grouping_bstr;
6610 const char *grouping;
6611 char *p, sep = *localeconv()->decimal_point;
6612 int cur_group = 0, group_size = 0;
6613 int adjustfield = base->fmtfl & FMTFLAG_adjustfield;
6614 MSVCP_size_t pad;
6616 TRACE("(%p %p %p %d %s %ld)\n", this, ret, base, fill, buf, count);
6618 /* Change decimal point */
6619 for(p=buf; p<buf+count; p++) {
6620 if(*p == sep) {
6621 *p = numpunct_char_decimal_point(numpunct);
6622 break;
6625 p--;
6627 /* Add separators to number */
6628 numpunct_char_grouping(numpunct, &grouping_bstr);
6629 grouping = MSVCP_basic_string_char_c_str(&grouping_bstr);
6630 sep = grouping[0] ? numpunct_char_thousands_sep(numpunct) : '\0';
6632 for(; p>buf && sep && grouping[cur_group]!=CHAR_MAX; p--) {
6633 group_size++;
6634 if(group_size == grouping[cur_group]) {
6635 group_size = 0;
6636 if(grouping[cur_group+1])
6637 cur_group++;
6639 memmove(p+1, p, buf+count-p);
6640 *p = sep;
6641 count++;
6644 MSVCP_basic_string_char_dtor(&grouping_bstr);
6646 /* Display number with padding */
6647 if(count >= base->wide)
6648 pad = 0;
6649 else
6650 pad = base->wide-count;
6651 base->wide = 0;
6653 if((adjustfield & FMTFLAG_internal) && (buf[0]=='-' || buf[0]=='+')) {
6654 num_put_char__Putc(this, &dest, dest, buf, 1);
6655 buf++;
6657 if(adjustfield != FMTFLAG_left) {
6658 num_put_char__Rep(this, ret, dest, fill, pad);
6659 pad = 0;
6661 num_put_char__Putc(this, &dest, dest, buf, count);
6662 return num_put_char__Rep(this, ret, dest, fill, pad);
6665 /* ?_Ifmt@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@ABAPADPADPBDH@Z */
6666 /* ?_Ifmt@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@AEBAPEADPEADPEBDH@Z */
6667 char* __cdecl num_put_char__Ifmt(const num_put *this, char *fmt, const char *spec, int fmtfl)
6669 int base = fmtfl & FMTFLAG_basefield;
6670 char *p = fmt;
6672 TRACE("(%p %p %p %d)\n", this, fmt, spec, fmtfl);
6674 *p++ = '%';
6675 if(fmtfl & FMTFLAG_showpos)
6676 *p++ = '+';
6677 if(fmtfl & FMTFLAG_showbase)
6678 *p++ = '#';
6680 *p++ = *spec++;
6681 if(*spec == 'l')
6682 *p++ = *spec++;
6684 if(base == FMTFLAG_oct)
6685 *p++ = 'o';
6686 else if(base == FMTFLAG_hex)
6687 *p++ = (fmtfl & FMTFLAG_uppercase) ? 'X' : 'x';
6688 else
6689 *p++ = *spec;
6691 *p++ = '\0';
6692 return fmt;
6695 /* ?_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 */
6696 /* ?_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 */
6697 ostreambuf_iterator_char* __cdecl num_put_char__Iput(const num_put *this, ostreambuf_iterator_char *ret,
6698 ostreambuf_iterator_char dest, ios_base *base, char fill, char *buf, MSVCP_size_t count)
6700 numpunct_char *numpunct = numpunct_char_use_facet(base->loc);
6701 basic_string_char grouping_bstr;
6702 const char *grouping;
6703 char *p, sep;
6704 int cur_group = 0, group_size = 0;
6705 int adjustfield = base->fmtfl & FMTFLAG_adjustfield;
6706 MSVCP_size_t pad;
6708 TRACE("(%p %p %p %d %s %ld)\n", this, ret, base, fill, buf, count);
6710 /* Add separators to number */
6711 numpunct_char_grouping(numpunct, &grouping_bstr);
6712 grouping = MSVCP_basic_string_char_c_str(&grouping_bstr);
6713 sep = grouping[0] ? numpunct_char_thousands_sep(numpunct) : '\0';
6715 for(p=buf+count-1; p>buf && sep && grouping[cur_group]!=CHAR_MAX; p--) {
6716 group_size++;
6717 if(group_size == grouping[cur_group]) {
6718 group_size = 0;
6719 if(grouping[cur_group+1])
6720 cur_group++;
6722 memmove(p+1, p, buf+count-p);
6723 *p = sep;
6724 count++;
6727 MSVCP_basic_string_char_dtor(&grouping_bstr);
6729 /* Display number with padding */
6730 if(count >= base->wide)
6731 pad = 0;
6732 else
6733 pad = base->wide-count;
6734 base->wide = 0;
6736 if((adjustfield & FMTFLAG_internal) && (buf[0]=='-' || buf[0]=='+')) {
6737 num_put_char__Putc(this, &dest, dest, buf, 1);
6738 buf++;
6739 }else if((adjustfield & FMTFLAG_internal) && (buf[1]=='x' || buf[1]=='X')) {
6740 num_put_char__Putc(this, &dest, dest, buf, 2);
6741 buf += 2;
6743 if(adjustfield != FMTFLAG_left) {
6744 num_put_char__Rep(this, ret, dest, fill, pad);
6745 pad = 0;
6747 num_put_char__Putc(this, &dest, dest, buf, count);
6748 return num_put_char__Rep(this, ret, dest, fill, pad);
6751 /* ?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 */
6752 /* ?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 */
6753 #define call_num_put_char_do_put_long(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 28, ostreambuf_iterator_char*, \
6754 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, LONG), \
6755 (this, ret, dest, base, fill, v))
6756 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_long, 28)
6757 ostreambuf_iterator_char* __thiscall num_put_char_do_put_long(const num_put *this, ostreambuf_iterator_char *ret,
6758 ostreambuf_iterator_char dest, ios_base *base, char fill, LONG v)
6760 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
6761 char fmt[7]; /* strlen("%+#lld")+1 */
6763 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
6765 return num_put_char__Iput(this, ret, dest, base, fill, tmp,
6766 sprintf(tmp, num_put_char__Ifmt(this, fmt, "ld", base->fmtfl), v));
6769 /* ?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 */
6770 /* ?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 */
6771 DEFINE_THISCALL_WRAPPER(num_put_char_put_long, 28)
6772 ostreambuf_iterator_char* __thiscall num_put_char_put_long(const num_put *this, ostreambuf_iterator_char *ret,
6773 ostreambuf_iterator_char dest, ios_base *base, char fill, LONG v)
6775 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
6776 return call_num_put_char_do_put_long(this, ret, dest, base, fill, v);
6779 /* ?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 */
6780 /* ?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 */
6781 #define call_num_put_char_do_put_ulong(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 24, ostreambuf_iterator_char*, \
6782 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, ULONG), \
6783 (this, ret, dest, base, fill, v))
6784 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_ulong, 28)
6785 ostreambuf_iterator_char* __thiscall num_put_char_do_put_ulong(const num_put *this, ostreambuf_iterator_char *ret,
6786 ostreambuf_iterator_char dest, ios_base *base, char fill, ULONG v)
6788 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
6789 char fmt[7]; /* strlen("%+#lld")+1 */
6791 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
6793 return num_put_char__Iput(this, ret, dest, base, fill, tmp,
6794 sprintf(tmp, num_put_char__Ifmt(this, fmt, "lu", base->fmtfl), v));
6797 /* ?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 */
6798 /* ?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 */
6799 DEFINE_THISCALL_WRAPPER(num_put_char_put_ulong, 28)
6800 ostreambuf_iterator_char* __thiscall num_put_char_put_ulong(const num_put *this, ostreambuf_iterator_char *ret,
6801 ostreambuf_iterator_char dest, ios_base *base, char fill, ULONG v)
6803 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
6804 return call_num_put_char_do_put_ulong(this, ret, dest, base, fill, v);
6807 static inline streamsize get_precision(const ios_base *base)
6809 return base->prec <= 0 && !(base->fmtfl & FMTFLAG_fixed) ? 6 : base->prec;
6812 /* ?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 */
6813 /* ?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 */
6814 /* ?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 */
6815 /* ?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 */
6816 #define call_num_put_char_do_put_double(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 12, ostreambuf_iterator_char*, \
6817 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, double), \
6818 (this, ret, dest, base, fill, v))
6819 #define call_num_put_char_do_put_ldouble(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 8, ostreambuf_iterator_char*, \
6820 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, double), \
6821 (this, ret, dest, base, fill, v))
6822 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_double, 32)
6823 ostreambuf_iterator_char* __thiscall num_put_char_do_put_double(const num_put *this, ostreambuf_iterator_char *ret,
6824 ostreambuf_iterator_char dest, ios_base *base, char fill, double v)
6826 char *tmp;
6827 char fmt[8]; /* strlen("%+#.*lg")+1 */
6828 int size;
6829 streamsize prec;
6831 TRACE("(%p %p %p %d %lf)\n", this, ret, base, fill, v);
6833 num_put_char__Ffmt(this, fmt, '\0', base->fmtfl);
6834 prec = get_precision(base);
6835 size = _scprintf(fmt, prec, v);
6837 /* TODO: don't use dynamic allocation */
6838 tmp = MSVCRT_operator_new(size*2);
6839 if(!tmp) {
6840 ERR("Out of memory\n");
6841 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
6843 num_put_char_fput(this, ret, dest, base, fill, tmp, sprintf(tmp, fmt, prec, v));
6844 MSVCRT_operator_delete(tmp);
6845 return ret;
6848 /* ?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 */
6849 /* ?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 */
6850 DEFINE_THISCALL_WRAPPER(num_put_char_put_double, 32)
6851 ostreambuf_iterator_char* __thiscall num_put_char_put_double(const num_put *this, ostreambuf_iterator_char *ret,
6852 ostreambuf_iterator_char dest, ios_base *base, char fill, double v)
6854 TRACE("(%p %p %p %d %lf)\n", this, ret, base, fill, v);
6855 return call_num_put_char_do_put_double(this, ret, dest, base, fill, v);
6858 /* ?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 */
6859 /* ?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 */
6860 DEFINE_THISCALL_WRAPPER(num_put_char_put_ldouble, 32)
6861 ostreambuf_iterator_char* __thiscall num_put_char_put_ldouble(const num_put *this, ostreambuf_iterator_char *ret,
6862 ostreambuf_iterator_char dest, ios_base *base, char fill, double v)
6864 TRACE("(%p %p %p %d %lf)\n", this, ret, base, fill, v);
6865 return call_num_put_char_do_put_ldouble(this, ret, dest, base, fill, v);
6868 /* ?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 */
6869 /* ?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 */
6870 #define call_num_put_char_do_put_ptr(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 4, ostreambuf_iterator_char*, \
6871 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, const void*), \
6872 (this, ret, dest, base, fill, v))
6873 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_ptr, 28)
6874 ostreambuf_iterator_char* __thiscall num_put_char_do_put_ptr(const num_put *this, ostreambuf_iterator_char *ret,
6875 ostreambuf_iterator_char dest, ios_base *base, char fill, const void *v)
6877 char tmp[17]; /* 8(16^8==2^64)*2(separators beetwen every digit) + 1 */
6879 TRACE("(%p %p %p %d %p)\n", this, ret, base, fill, v);
6881 return num_put_char__Iput(this, ret, dest, base, fill, tmp, sprintf(tmp, "%p", v));
6884 /* ?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 */
6885 /* ?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 */
6886 DEFINE_THISCALL_WRAPPER(num_put_char_put_ptr, 28)
6887 ostreambuf_iterator_char* __thiscall num_put_char_put_ptr(const num_put *this, ostreambuf_iterator_char *ret,
6888 ostreambuf_iterator_char dest, ios_base *base, char fill, const void *v)
6890 TRACE("(%p %p %p %d %p)\n", this, ret, base, fill, v);
6891 return call_num_put_char_do_put_ptr(this, ret, dest, base, fill, v);
6894 /* ?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 */
6895 /* ?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 */
6896 #define call_num_put_char_do_put_int64(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 20, ostreambuf_iterator_char*, \
6897 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, __int64), \
6898 (this, ret, dest, base, fill, v))
6899 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_int64, 32)
6900 ostreambuf_iterator_char* __thiscall num_put_char_do_put_int64(const num_put *this, ostreambuf_iterator_char *ret,
6901 ostreambuf_iterator_char dest, ios_base *base, char fill, __int64 v)
6903 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
6904 char fmt[7]; /* strlen("%+#lld")+1 */
6906 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
6908 return num_put_char__Iput(this, ret, dest, base, fill, tmp,
6909 sprintf(tmp, num_put_char__Ifmt(this, fmt, "lld", base->fmtfl), v));
6912 /* ?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 */
6913 /* ?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 */
6914 DEFINE_THISCALL_WRAPPER(num_put_char_put_int64, 32)
6915 ostreambuf_iterator_char* __thiscall num_put_char_put_int64(const num_put *this, ostreambuf_iterator_char *ret,
6916 ostreambuf_iterator_char dest, ios_base *base, char fill, __int64 v)
6918 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
6919 return call_num_put_char_do_put_int64(this, ret, dest, base, fill, v);
6922 /* ?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 */
6923 /* ?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 */
6924 #define call_num_put_char_do_put_uint64(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 16, ostreambuf_iterator_char*, \
6925 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, unsigned __int64), \
6926 (this, ret, dest, base, fill, v))
6927 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_uint64, 32)
6928 ostreambuf_iterator_char* __thiscall num_put_char_do_put_uint64(const num_put *this, ostreambuf_iterator_char *ret,
6929 ostreambuf_iterator_char dest, ios_base *base, char fill, unsigned __int64 v)
6931 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
6932 char fmt[7]; /* strlen("%+#lld")+1 */
6934 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
6936 return num_put_char__Iput(this, ret, dest, base, fill, tmp,
6937 sprintf(tmp, num_put_char__Ifmt(this, fmt, "llu", base->fmtfl), v));
6940 /* ?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 */
6941 /* ?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 */
6942 DEFINE_THISCALL_WRAPPER(num_put_char_put_uint64, 32)
6943 ostreambuf_iterator_char* __thiscall num_put_char_put_uint64(const num_put *this, ostreambuf_iterator_char *ret,
6944 ostreambuf_iterator_char dest, ios_base *base, char fill, unsigned __int64 v)
6946 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
6947 return call_num_put_char_do_put_uint64(this, ret, dest, base, fill, v);
6950 /* ?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 */
6951 /* ?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 */
6952 #define call_num_put_char_do_put_bool(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 32, ostreambuf_iterator_char*, \
6953 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, MSVCP_bool), \
6954 (this, ret, dest, base, fill, v))
6955 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_bool, 28)
6956 ostreambuf_iterator_char* __thiscall num_put_char_do_put_bool(const num_put *this, ostreambuf_iterator_char *ret,
6957 ostreambuf_iterator_char dest, ios_base *base, char fill, MSVCP_bool v)
6959 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
6961 if(base->fmtfl & FMTFLAG_boolalpha) {
6962 numpunct_char *numpunct = numpunct_char_use_facet(base->loc);
6963 basic_string_char str;
6964 MSVCP_size_t pad, len;
6966 if(v)
6967 numpunct_char_truename(numpunct, &str);
6968 else
6969 numpunct_char_falsename(numpunct, &str);
6971 len = MSVCP_basic_string_char_length(&str);
6972 pad = (len>base->wide ? 0 : base->wide-len);
6973 base->wide = 0;
6975 if((base->fmtfl & FMTFLAG_adjustfield) != FMTFLAG_left) {
6976 num_put_char__Rep(this, &dest, dest, fill, pad);
6977 pad = 0;
6979 num_put_char__Putc(this, &dest, dest, MSVCP_basic_string_char_c_str(&str), len);
6980 MSVCP_basic_string_char_dtor(&str);
6981 return num_put_char__Rep(this, ret, dest, fill, pad);
6984 return num_put_char_put_long(this, ret, dest, base, fill, v);
6987 /* ?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 */
6988 /* ?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 */
6989 DEFINE_THISCALL_WRAPPER(num_put_char_put_bool, 28)
6990 ostreambuf_iterator_char* __thiscall num_put_char_put_bool(const num_put *this, ostreambuf_iterator_char *ret,
6991 ostreambuf_iterator_char dest, ios_base *base, char fill, MSVCP_bool v)
6993 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
6994 return call_num_put_char_do_put_bool(this, ret, dest, base, fill, v);
6997 /* ?id@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@2V0locale@2@A */
6998 locale_id num_put_wchar_id = {0};
6999 /* ?id@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@2V0locale@2@A */
7000 locale_id num_put_short_id = {0};
7002 /* num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@6B@ */
7003 extern const vtable_ptr MSVCP_num_put_wchar_vtable;
7004 /* num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@6B@ */
7005 extern const vtable_ptr MSVCP_num_put_short_vtable;
7007 /* ?_Init@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@IAEXABV_Locinfo@2@@Z */
7008 /* ?_Init@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@IEAAXAEBV_Locinfo@2@@Z */
7009 DEFINE_THISCALL_WRAPPER(num_put_wchar__Init, 8)
7010 void __thiscall num_put_wchar__Init(num_put *this, const _Locinfo *locinfo)
7012 TRACE("(%p %p)\n", this, locinfo);
7013 _Locinfo__Getcvt(locinfo, &this->cvt);
7016 /* ??0?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
7017 /* ??0?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
7018 DEFINE_THISCALL_WRAPPER(num_put_wchar_ctor_locinfo, 12)
7019 num_put* __thiscall num_put_wchar_ctor_locinfo(num_put *this, const _Locinfo *locinfo, MSVCP_size_t refs)
7021 TRACE("(%p %p %ld)\n", this, locinfo, refs);
7023 locale_facet_ctor_refs(&this->facet, refs);
7024 this->facet.vtable = &MSVCP_num_put_wchar_vtable;
7026 num_put_wchar__Init(this, locinfo);
7027 return this;
7030 /* ??0?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
7031 /* ??0?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
7032 DEFINE_THISCALL_WRAPPER(num_put_short_ctor_locinfo, 12)
7033 num_put* __thiscall num_put_short_ctor_locinfo(num_put *this, const _Locinfo *locinfo, MSVCP_size_t refs)
7035 num_put_wchar_ctor_locinfo(this, locinfo, refs);
7036 this->facet.vtable = &MSVCP_num_put_short_vtable;
7037 return this;
7040 /* ??0?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAE@I@Z */
7041 /* ??0?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAA@_K@Z */
7042 DEFINE_THISCALL_WRAPPER(num_put_wchar_ctor_refs, 8)
7043 num_put* __thiscall num_put_wchar_ctor_refs(num_put *this, MSVCP_size_t refs)
7045 _Locinfo locinfo;
7047 TRACE("(%p %lu)\n", this, refs);
7049 _Locinfo_ctor(&locinfo);
7050 num_put_wchar_ctor_locinfo(this, &locinfo, refs);
7051 _Locinfo_dtor(&locinfo);
7052 return this;
7055 /* ??0?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAE@I@Z */
7056 /* ??0?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEAA@_K@Z */
7057 DEFINE_THISCALL_WRAPPER(num_put_short_ctor_refs, 8)
7058 num_put* __thiscall num_put_short_ctor_refs(num_put *this, MSVCP_size_t refs)
7060 num_put_wchar_ctor_refs(this, refs);
7061 this->facet.vtable = &MSVCP_num_put_short_vtable;
7062 return this;
7065 /* ??_F?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAEXXZ */
7066 /* ??_F?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAAXXZ */
7067 DEFINE_THISCALL_WRAPPER(num_put_wchar_ctor, 4)
7068 num_put* __thiscall num_put_wchar_ctor(num_put *this)
7070 return num_put_wchar_ctor_refs(this, 0);
7073 /* ??_F?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAEXXZ */
7074 /* ??_F?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEAAXXZ */
7075 DEFINE_THISCALL_WRAPPER(num_put_short_ctor, 4)
7076 num_put* __thiscall num_put_short_ctor(num_put *this)
7078 return num_put_short_ctor_refs(this, 0);
7081 /* ??1?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MAE@XZ */
7082 /* ??1?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MEAA@XZ */
7083 /* ??1?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MAE@XZ */
7084 /* ??1?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MEAA@XZ */
7085 DEFINE_THISCALL_WRAPPER(num_put_wchar_dtor, 4)
7086 void __thiscall num_put_wchar_dtor(num_put *this)
7088 TRACE("(%p)\n", this);
7089 locale_facet_dtor(&this->facet);
7092 DEFINE_THISCALL_WRAPPER(num_put_wchar_vector_dtor, 8)
7093 num_put* __thiscall num_put_wchar_vector_dtor(num_put *this, unsigned int flags)
7095 TRACE("(%p %x)\n", this, flags);
7096 if(flags & 2) {
7097 /* we have an array, with the number of elements stored before the first object */
7098 INT_PTR i, *ptr = (INT_PTR *)this-1;
7100 for(i=*ptr-1; i>=0; i--)
7101 num_put_wchar_dtor(this+i);
7102 MSVCRT_operator_delete(ptr);
7103 } else {
7104 num_put_wchar_dtor(this);
7105 if(flags & 1)
7106 MSVCRT_operator_delete(this);
7109 return this;
7112 /* ?_Getcat@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
7113 /* ?_Getcat@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
7114 static MSVCP_size_t num_put_wchar__Getcat(const locale_facet **facet, const locale *loc)
7116 TRACE("(%p %p)\n", facet, loc);
7118 if(facet && !*facet) {
7119 _Locinfo locinfo;
7121 *facet = MSVCRT_operator_new(sizeof(num_put));
7122 if(!*facet) {
7123 ERR("Out of memory\n");
7124 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7125 return 0;
7128 _Locinfo_ctor_cstr(&locinfo, MSVCP_basic_string_char_c_str(&loc->ptr->name));
7129 num_put_wchar_ctor_locinfo((num_put*)*facet, &locinfo, 0);
7130 _Locinfo_dtor(&locinfo);
7133 return LC_NUMERIC;
7136 /* ?_Getcat@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SAIPAPBVfacet@locale@2@@Z */
7137 /* ?_Getcat@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@@Z */
7138 MSVCP_size_t __cdecl num_put_wchar__Getcat_old(const locale_facet **facet)
7140 return num_put_wchar__Getcat(facet, locale_classic());
7143 /* ?_Getcat@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
7144 /* ?_Getcat@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
7145 static MSVCP_size_t num_put_short__Getcat(const locale_facet **facet, const locale *loc)
7147 TRACE("(%p %p)\n", facet, loc);
7149 if(facet && !*facet) {
7150 _Locinfo locinfo;
7152 *facet = MSVCRT_operator_new(sizeof(num_put));
7153 if(!*facet) {
7154 ERR("Out of memory\n");
7155 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7156 return 0;
7159 _Locinfo_ctor_cstr(&locinfo, MSVCP_basic_string_char_c_str(&loc->ptr->name));
7160 num_put_short_ctor_locinfo((num_put*)*facet, &locinfo, 0);
7161 _Locinfo_dtor(&locinfo);
7164 return LC_NUMERIC;
7167 /* ?_Getcat@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SAIPAPBVfacet@locale@2@@Z */
7168 /* ?_Getcat@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@@Z */
7169 MSVCP_size_t __cdecl num_put_short__Getcat_old(const locale_facet **facet)
7171 return num_put_short__Getcat(facet, locale_classic());
7174 num_put* num_put_wchar_use_facet(const locale *loc)
7176 static num_put *obj = NULL;
7178 _Lockit lock;
7179 const locale_facet *fac;
7181 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
7182 fac = locale__Getfacet(loc, locale_id_operator_size_t(&num_put_wchar_id));
7183 if(fac) {
7184 _Lockit_dtor(&lock);
7185 return (num_put*)fac;
7188 if(obj) {
7189 _Lockit_dtor(&lock);
7190 return obj;
7193 num_put_wchar__Getcat(&fac, loc);
7194 obj = (num_put*)fac;
7195 locale_facet__Incref(&obj->facet);
7196 locale_facet_register(&obj->facet);
7197 _Lockit_dtor(&lock);
7199 return obj;
7202 num_put* num_put_short_use_facet(const locale *loc)
7204 static num_put *obj = NULL;
7206 _Lockit lock;
7207 const locale_facet *fac;
7209 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
7210 fac = locale__Getfacet(loc, locale_id_operator_size_t(&num_put_short_id));
7211 if(fac) {
7212 _Lockit_dtor(&lock);
7213 return (num_put*)fac;
7216 if(obj) {
7217 _Lockit_dtor(&lock);
7218 return obj;
7221 num_put_short__Getcat(&fac, loc);
7222 obj = (num_put*)fac;
7223 locale_facet__Incref(&obj->facet);
7224 locale_facet_register(&obj->facet);
7225 _Lockit_dtor(&lock);
7227 return obj;
7230 /* ?_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 */
7231 /* ?_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 */
7232 /* ?_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 */
7233 /* ?_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 */
7234 ostreambuf_iterator_wchar* __cdecl num_put_wchar__Put(const num_put *this, ostreambuf_iterator_wchar *ret,
7235 ostreambuf_iterator_wchar dest, const wchar_t *ptr, MSVCP_size_t count)
7237 TRACE("(%p %p %s %ld)\n", this, ret, debugstr_wn(ptr, count), count);
7239 for(; count>0; count--)
7240 ostreambuf_iterator_wchar_put(&dest, *ptr++);
7242 *ret = dest;
7243 return ret;
7246 /* ?_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 */
7247 /* ?_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 */
7248 /* ?_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 */
7249 /* ?_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 */
7250 ostreambuf_iterator_wchar* __cdecl num_put_wchar__Putc(const num_put *this, ostreambuf_iterator_wchar *ret,
7251 ostreambuf_iterator_wchar dest, const char *ptr, MSVCP_size_t count)
7253 int state = 0;
7254 wchar_t ch;
7256 TRACE("(%p %p %s %ld)\n", this, ret, debugstr_an(ptr, count), count);
7258 for(; count>0; count--) {
7259 if(_Mbrtowc(&ch, ptr++, 1, &state, &this->cvt) == 1)
7260 ostreambuf_iterator_wchar_put(&dest, ch);
7263 *ret = dest;
7264 return ret;
7267 /* ?_Putgrouped@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@ABA?AV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@PBDI_W@Z */
7268 /* ?_Putgrouped@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@AEBA?AV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@PEBD_K_W@Z */
7269 /* ?_Putgrouped@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@ABA?AV?$ostreambuf_iterator@GU?$char_traits@G@std@@@2@V32@PBDIG@Z */
7270 /* ?_Putgrouped@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@AEBA?AV?$ostreambuf_iterator@GU?$char_traits@G@std@@@2@V32@PEBD_KG@Z */
7271 ostreambuf_iterator_wchar* __cdecl num_put_wchar__Putgrouped(const num_put *this, ostreambuf_iterator_wchar *ret,
7272 ostreambuf_iterator_wchar dest, const char *ptr, MSVCP_size_t count, wchar_t delim)
7274 FIXME("(%p %p %p %ld %d) stub\n", this, ret, ptr, count, delim);
7275 return NULL;
7278 /* ?_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 */
7279 /* ?_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 */
7280 /* ?_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 */
7281 /* ?_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 */
7282 ostreambuf_iterator_wchar* __cdecl num_put_wchar__Rep(const num_put *this, ostreambuf_iterator_wchar *ret,
7283 ostreambuf_iterator_wchar dest, wchar_t c, MSVCP_size_t count)
7285 TRACE("(%p %p %d %ld)\n", this, ret, c, count);
7287 for(; count>0; count--)
7288 ostreambuf_iterator_wchar_put(&dest, c);
7290 *ret = dest;
7291 return ret;
7294 /* ?_Ffmt@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@ABAPADPADDH@Z */
7295 /* ?_Ffmt@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@AEBAPEADPEADDH@Z */
7296 /* ?_Ffmt@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@ABAPADPADDH@Z */
7297 /* ?_Ffmt@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@AEBAPEADPEADDH@Z */
7298 char* __cdecl num_put_wchar__Ffmt(const num_put *this, char *fmt, char spec, int fmtfl)
7300 int type = fmtfl & FMTFLAG_floatfield;
7301 char *p = fmt;
7303 TRACE("(%p %p %d %d)\n", this, fmt, spec, fmtfl);
7305 *p++ = '%';
7306 if(fmtfl & FMTFLAG_showpos)
7307 *p++ = '+';
7308 if(fmtfl & FMTFLAG_showbase)
7309 *p++ = '#';
7310 *p++ = '.';
7311 *p++ = '*';
7312 if(spec)
7313 *p++ = spec;
7315 if(type == FMTFLAG_fixed)
7316 *p++ = 'f';
7317 else if(type == FMTFLAG_scientific)
7318 *p++ = (fmtfl & FMTFLAG_uppercase) ? 'E' : 'e';
7319 else if(type == (FMTFLAG_fixed|FMTFLAG_scientific))
7320 *p++ = (fmtfl & FMTFLAG_uppercase) ? 'A' : 'a';
7321 else
7322 *p++ = (fmtfl & FMTFLAG_uppercase) ? 'G' : 'g';
7324 *p++ = '\0';
7325 return fmt;
7328 /* ?_Fput@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@ABA?AV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@AAVios_base@2@_WPBDIIII@Z */
7329 /* ?_Fput@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@AEBA?AV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@AEAVios_base@2@_WPEBD_K444@Z */
7330 ostreambuf_iterator_wchar* __cdecl num_put_wchar__Fput(const num_put *this, ostreambuf_iterator_wchar *ret,
7331 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, const char *buf, MSVCP_size_t bef_point,
7332 MSVCP_size_t aft_point, MSVCP_size_t trailing, MSVCP_size_t count)
7334 FIXME("(%p %p %p %d %p %ld %ld %ld %ld) stub\n", this, ret, base,
7335 fill, buf, bef_point, aft_point, trailing, count);
7336 return NULL;
7339 /* ?_Fput@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@ABA?AV?$ostreambuf_iterator@GU?$char_traits@G@std@@@2@V32@AAVios_base@2@GPBDIIII@Z */
7340 /* ?_Fput@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@AEBA?AV?$ostreambuf_iterator@GU?$char_traits@G@std@@@2@V32@AEAVios_base@2@GPEBD_K333@Z */
7341 ostreambuf_iterator_wchar* __cdecl num_put_short__Fput(const num_put *this, ostreambuf_iterator_wchar *ret,
7342 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, const char *buf, MSVCP_size_t bef_point,
7343 MSVCP_size_t aft_point, MSVCP_size_t trailing, MSVCP_size_t count)
7345 FIXME("(%p %p %p %d %p %ld %ld %ld %ld) stub\n", this, ret, base,
7346 fill, buf, bef_point, aft_point, trailing, count);
7347 return NULL;
7350 /* TODO: This function should be removed when num_put_wchar__Fput is implemented */
7351 static ostreambuf_iterator_wchar* num_put__fput(const num_put *this, ostreambuf_iterator_wchar *ret,
7352 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, char *buf,
7353 MSVCP_size_t count, numpunct_wchar *numpunct)
7355 basic_string_char grouping_bstr;
7356 const char *grouping;
7357 char *p, dec_point = *localeconv()->decimal_point;
7358 wchar_t sep;
7359 int cur_group = 0, group_size = 0;
7360 int adjustfield = base->fmtfl & FMTFLAG_adjustfield;
7361 MSVCP_size_t i, pad;
7363 TRACE("(%p %p %p %d %s %ld)\n", this, ret, base, fill, buf, count);
7365 for(p=buf; p<buf+count; p++) {
7366 if(*p == dec_point)
7367 break;
7369 p--;
7371 /* Add separators to number */
7372 numpunct_wchar_grouping(numpunct, &grouping_bstr);
7373 grouping = MSVCP_basic_string_char_c_str(&grouping_bstr);
7374 sep = grouping[0] ? numpunct_wchar_thousands_sep(numpunct) : '\0';
7376 for(; p>buf && sep && grouping[cur_group]!=CHAR_MAX; p--) {
7377 group_size++;
7378 if(group_size == grouping[cur_group]) {
7379 group_size = 0;
7380 if(grouping[cur_group+1])
7381 cur_group++;
7383 memmove(p+1, p, buf+count-p);
7384 *p = '\0'; /* mark thousands separator positions */
7385 count++;
7388 MSVCP_basic_string_char_dtor(&grouping_bstr);
7390 /* Display number with padding */
7391 if(count >= base->wide)
7392 pad = 0;
7393 else
7394 pad = base->wide-count;
7395 base->wide = 0;
7397 if((adjustfield & FMTFLAG_internal) && (buf[0]=='-' || buf[0]=='+')) {
7398 num_put_wchar__Putc(this, &dest, dest, buf, 1);
7399 buf++;
7401 if(adjustfield != FMTFLAG_left) {
7402 num_put_wchar__Rep(this, ret, dest, fill, pad);
7403 pad = 0;
7406 for(i=0; i<count; i++) {
7407 if(buf[i] == dec_point)
7408 num_put_wchar__Rep(this, &dest, dest, numpunct_wchar_decimal_point(numpunct), 1);
7409 else if(!buf[i])
7410 num_put_wchar__Rep(this, &dest, dest, sep, 1);
7411 else
7412 num_put_wchar__Putc(this, &dest, dest, buf+i, 1);
7415 return num_put_wchar__Rep(this, ret, dest, fill, pad);
7418 /* ?_Ifmt@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@ABAPADPADPBDH@Z */
7419 /* ?_Ifmt@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@AEBAPEADPEADPEBDH@Z */
7420 /* ?_Ifmt@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@ABAPADPADPBDH@Z */
7421 /* ?_Ifmt@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@AEBAPEADPEADPEBDH@Z */
7422 char* __cdecl num_put_wchar__Ifmt(const num_put *this, char *fmt, const char *spec, int fmtfl)
7424 int base = fmtfl & FMTFLAG_basefield;
7425 char *p = fmt;
7427 TRACE("(%p %p %p %d)\n", this, fmt, spec, fmtfl);
7429 *p++ = '%';
7430 if(fmtfl & FMTFLAG_showpos)
7431 *p++ = '+';
7432 if(fmtfl & FMTFLAG_showbase)
7433 *p++ = '#';
7435 *p++ = *spec++;
7436 if(*spec == 'l')
7437 *p++ = *spec++;
7439 if(base == FMTFLAG_oct)
7440 *p++ = 'o';
7441 else if(base == FMTFLAG_hex)
7442 *p++ = (fmtfl & FMTFLAG_uppercase) ? 'X' : 'x';
7443 else
7444 *p++ = *spec;
7446 *p++ = '\0';
7447 return fmt;
7450 static ostreambuf_iterator_wchar* num_put__Iput(const num_put *this, ostreambuf_iterator_wchar *ret,
7451 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, char *buf,
7452 MSVCP_size_t count, numpunct_wchar *numpunct)
7454 basic_string_char grouping_bstr;
7455 const char *grouping;
7456 char *p;
7457 wchar_t sep;
7458 int cur_group = 0, group_size = 0;
7459 int adjustfield = base->fmtfl & FMTFLAG_adjustfield;
7460 MSVCP_size_t i, pad;
7462 TRACE("(%p %p %p %d %s %ld)\n", this, ret, base, fill, buf, count);
7464 /* Add separators to number */
7465 numpunct_wchar_grouping(numpunct, &grouping_bstr);
7466 grouping = MSVCP_basic_string_char_c_str(&grouping_bstr);
7467 sep = grouping[0] ? numpunct_wchar_thousands_sep(numpunct) : '\0';
7469 for(p=buf+count-1; p>buf && sep && grouping[cur_group]!=CHAR_MAX; p--) {
7470 group_size++;
7471 if(group_size == grouping[cur_group]) {
7472 group_size = 0;
7473 if(grouping[cur_group+1])
7474 cur_group++;
7476 memmove(p+1, p, buf+count-p);
7477 *p = '\0'; /* mark thousands separator positions */
7478 count++;
7481 MSVCP_basic_string_char_dtor(&grouping_bstr);
7483 /* Display number with padding */
7484 if(count >= base->wide)
7485 pad = 0;
7486 else
7487 pad = base->wide-count;
7488 base->wide = 0;
7490 if((adjustfield & FMTFLAG_internal) && (buf[0]=='-' || buf[0]=='+')) {
7491 num_put_wchar__Putc(this, &dest, dest, buf, 1);
7492 buf++;
7493 }else if((adjustfield & FMTFLAG_internal) && (buf[1]=='x' || buf[1]=='X')) {
7494 num_put_wchar__Putc(this, &dest, dest, buf, 2);
7495 buf += 2;
7497 if(adjustfield != FMTFLAG_left) {
7498 num_put_wchar__Rep(this, ret, dest, fill, pad);
7499 pad = 0;
7502 for(i=0; i<count; i++) {
7503 if(!buf[i])
7504 num_put_wchar__Rep(this, &dest, dest, sep, 1);
7505 else
7506 num_put_wchar__Putc(this, &dest, dest, buf+i, 1);
7509 return num_put_wchar__Rep(this, ret, dest, fill, pad);
7512 /* ?_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 */
7513 /* ?_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 */
7514 ostreambuf_iterator_wchar* __cdecl num_put_wchar__Iput(const num_put *this, ostreambuf_iterator_wchar *ret,
7515 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, char *buf, MSVCP_size_t count)
7517 return num_put__Iput(this, ret, dest, base, fill, buf, count, numpunct_wchar_use_facet(base->loc));
7520 /* ?_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 */
7521 /* ?_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 */
7522 ostreambuf_iterator_wchar* __cdecl num_put_short__Iput(const num_put *this, ostreambuf_iterator_wchar *ret,
7523 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, char *buf, MSVCP_size_t count)
7525 return num_put__Iput(this, ret, dest, base, fill, buf, count, numpunct_short_use_facet(base->loc));
7528 /* ?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 */
7529 /* ?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 */
7530 #define call_num_put_wchar_do_put_long(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 28, ostreambuf_iterator_wchar*, \
7531 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, LONG), \
7532 (this, ret, dest, base, fill, v))
7533 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_long, 28)
7534 ostreambuf_iterator_wchar* __thiscall num_put_wchar_do_put_long(const num_put *this, ostreambuf_iterator_wchar *ret,
7535 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, LONG v)
7537 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
7538 char fmt[7]; /* strlen("%+#lld")+1 */
7540 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
7542 return num_put_wchar__Iput(this, ret, dest, base, fill, tmp,
7543 sprintf(tmp, num_put_wchar__Ifmt(this, fmt, "ld", base->fmtfl), v));
7546 /* ?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 */
7547 /* ?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 */
7548 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_long, 28)
7549 ostreambuf_iterator_wchar* __thiscall num_put_short_do_put_long(const num_put *this, ostreambuf_iterator_wchar *ret,
7550 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, LONG v)
7552 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
7553 char fmt[7]; /* strlen("%+#lld")+1 */
7555 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
7557 return num_put_short__Iput(this, ret, dest, base, fill, tmp,
7558 sprintf(tmp, num_put_wchar__Ifmt(this, fmt, "ld", base->fmtfl), v));
7561 /* ?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 */
7562 /* ?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 */
7563 /* ?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 */
7564 /* ?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 */
7565 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_long, 28)
7566 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_long(const num_put *this, ostreambuf_iterator_wchar *ret,
7567 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, LONG v)
7569 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
7570 return call_num_put_wchar_do_put_long(this, ret, dest, base, fill, v);
7573 /* ?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 */
7574 /* ?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 */
7575 #define call_num_put_wchar_do_put_ulong(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 24, ostreambuf_iterator_wchar*, \
7576 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, ULONG), \
7577 (this, ret, dest, base, fill, v))
7578 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_ulong, 28)
7579 ostreambuf_iterator_wchar* __thiscall num_put_wchar_do_put_ulong(const num_put *this, ostreambuf_iterator_wchar *ret,
7580 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, ULONG v)
7582 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
7583 char fmt[7]; /* strlen("%+#lld")+1 */
7585 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
7587 return num_put_wchar__Iput(this, ret, dest, base, fill, tmp,
7588 sprintf(tmp, num_put_wchar__Ifmt(this, fmt, "lu", base->fmtfl), v));
7591 /* ?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 */
7592 /* ?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 */
7593 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_ulong, 28)
7594 ostreambuf_iterator_wchar* __thiscall num_put_short_do_put_ulong(const num_put *this, ostreambuf_iterator_wchar *ret,
7595 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, ULONG v)
7597 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
7598 char fmt[7]; /* strlen("%+#lld")+1 */
7600 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
7602 return num_put_short__Iput(this, ret, dest, base, fill, tmp,
7603 sprintf(tmp, num_put_wchar__Ifmt(this, fmt, "lu", base->fmtfl), v));
7606 /* ?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 */
7607 /* ?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 */
7608 /* ?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 */
7609 /* ?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 */
7610 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_ulong, 28)
7611 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_ulong(const num_put *this, ostreambuf_iterator_wchar *ret,
7612 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, ULONG v)
7614 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
7615 return call_num_put_wchar_do_put_ulong(this, ret, dest, base, fill, v);
7618 /* ?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 */
7619 /* ?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 */
7620 /* ?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 */
7621 /* ?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 */
7622 #define call_num_put_wchar_do_put_double(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 12, ostreambuf_iterator_wchar*, \
7623 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, double), \
7624 (this, ret, dest, base, fill, v))
7625 #define call_num_put_wchar_do_put_ldouble(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 8, ostreambuf_iterator_wchar*, \
7626 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, double), \
7627 (this, ret, dest, base, fill, v))
7628 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_double, 32)
7629 ostreambuf_iterator_wchar* __thiscall num_put_wchar_do_put_double(const num_put *this, ostreambuf_iterator_wchar *ret,
7630 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, double v)
7632 char *tmp;
7633 char fmt[8]; /* strlen("%+#.*lg")+1 */
7634 int size;
7635 streamsize prec;
7637 TRACE("(%p %p %p %d %lf)\n", this, ret, base, fill, v);
7639 num_put_wchar__Ffmt(this, fmt, '\0', base->fmtfl);
7640 prec = get_precision(base);
7641 size = _scprintf(fmt, prec, v);
7643 /* TODO: don't use dynamic allocation */
7644 tmp = MSVCRT_operator_new(size*2);
7645 if(!tmp) {
7646 ERR("Out of memory\n");
7647 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7649 num_put__fput(this, ret, dest, base, fill, tmp, sprintf(tmp, fmt, prec, v),
7650 numpunct_wchar_use_facet(base->loc));
7651 MSVCRT_operator_delete(tmp);
7652 return ret;
7655 /* ?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 */
7656 /* ?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 */
7657 /* ?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 */
7658 /* ?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 */
7659 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_double, 32)
7660 ostreambuf_iterator_wchar* __thiscall num_put_short_do_put_double(const num_put *this, ostreambuf_iterator_wchar *ret,
7661 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, double v)
7663 char *tmp;
7664 char fmt[8]; /* strlen("%+#.*lg")+1 */
7665 int size;
7666 streamsize prec;
7668 TRACE("(%p %p %p %d %lf)\n", this, ret, base, fill, v);
7670 num_put_wchar__Ffmt(this, fmt, '\0', base->fmtfl);
7671 prec = get_precision(base);
7672 size = _scprintf(fmt, prec, v);
7674 /* TODO: don't use dynamic allocation */
7675 tmp = MSVCRT_operator_new(size*2);
7676 if(!tmp) {
7677 ERR("Out of memory\n");
7678 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7680 num_put__fput(this, ret, dest, base, fill, tmp, sprintf(tmp, fmt, prec, v),
7681 numpunct_short_use_facet(base->loc));
7682 MSVCRT_operator_delete(tmp);
7683 return ret;
7686 /* ?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 */
7687 /* ?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 */
7688 /* ?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 */
7689 /* ?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 */
7690 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_double, 32)
7691 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_double(const num_put *this, ostreambuf_iterator_wchar *ret,
7692 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, double v)
7694 TRACE("(%p %p %p %d %lf)\n", this, ret, base, fill, v);
7695 return call_num_put_wchar_do_put_double(this, ret, dest, base, fill, v);
7698 /* ?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 */
7699 /* ?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 */
7700 /* ?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 */
7701 /* ?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 */
7702 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_ldouble, 32)
7703 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_ldouble(const num_put *this, ostreambuf_iterator_wchar *ret,
7704 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, double v)
7706 TRACE("(%p %p %p %d %lf)\n", this, ret, base, fill, v);
7707 return call_num_put_wchar_do_put_ldouble(this, ret, dest, base, fill, v);
7710 /* ?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 */
7711 /* ?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 */
7712 #define call_num_put_wchar_do_put_ptr(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 4, ostreambuf_iterator_wchar*, \
7713 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, const void*), \
7714 (this, ret, dest, base, fill, v))
7715 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_ptr, 28)
7716 ostreambuf_iterator_wchar* __thiscall num_put_wchar_do_put_ptr(const num_put *this, ostreambuf_iterator_wchar *ret,
7717 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, const void *v)
7719 char tmp[17]; /* 8(16^8==2^64)*2(separators beetwen every digit) + 1 */
7721 TRACE("(%p %p %p %d %p)\n", this, ret, base, fill, v);
7723 return num_put_wchar__Iput(this, ret, dest, base, fill, tmp, sprintf(tmp, "%p", v));
7726 /* ?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 */
7727 /* ?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 */
7728 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_ptr, 28)
7729 ostreambuf_iterator_wchar* __thiscall num_put_short_do_put_ptr(const num_put *this, ostreambuf_iterator_wchar *ret,
7730 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, const void *v)
7732 char tmp[17]; /* 8(16^8==2^64)*2(separators beetwen every digit) + 1 */
7734 TRACE("(%p %p %p %d %p)\n", this, ret, base, fill, v);
7736 return num_put_short__Iput(this, ret, dest, base, fill, tmp, sprintf(tmp, "%p", v));
7739 /* ?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 */
7740 /* ?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 */
7741 /* ?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 */
7742 /* ?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 */
7743 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_ptr, 28)
7744 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_ptr(const num_put *this, ostreambuf_iterator_wchar *ret,
7745 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, const void *v)
7747 TRACE("(%p %p %p %d %p)\n", this, ret, base, fill, v);
7748 return call_num_put_wchar_do_put_ptr(this, ret, dest, base, fill, v);
7751 /* ?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 */
7752 /* ?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 */
7753 #define call_num_put_wchar_do_put_int64(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 20, ostreambuf_iterator_wchar*, \
7754 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, __int64), \
7755 (this, ret, dest, base, fill, v))
7756 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_int64, 32)
7757 ostreambuf_iterator_wchar* __thiscall num_put_wchar_do_put_int64(const num_put *this, ostreambuf_iterator_wchar *ret,
7758 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, __int64 v)
7760 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
7761 char fmt[7]; /* strlen("%+#lld")+1 */
7763 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
7765 return num_put_wchar__Iput(this, ret, dest, base, fill, tmp,
7766 sprintf(tmp, num_put_wchar__Ifmt(this, fmt, "lld", base->fmtfl), v));
7769 /* ?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 */
7770 /* ?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 */
7771 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_int64, 32)
7772 ostreambuf_iterator_wchar* __thiscall num_put_short_do_put_int64(const num_put *this, ostreambuf_iterator_wchar *ret,
7773 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, __int64 v)
7775 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
7776 char fmt[7]; /* strlen("%+#lld")+1 */
7778 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
7780 return num_put_short__Iput(this, ret, dest, base, fill, tmp,
7781 sprintf(tmp, num_put_wchar__Ifmt(this, fmt, "lld", base->fmtfl), v));
7784 /* ?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 */
7785 /* ?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 */
7786 /* ?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 */
7787 /* ?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 */
7788 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_int64, 32)
7789 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_int64(const num_put *this, ostreambuf_iterator_wchar *ret,
7790 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, __int64 v)
7792 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
7793 return call_num_put_wchar_do_put_int64(this, ret, dest, base, fill, v);
7796 /* ?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 */
7797 /* ?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 */
7798 #define call_num_put_wchar_do_put_uint64(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 16, ostreambuf_iterator_wchar*, \
7799 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, unsigned __int64), \
7800 (this, ret, dest, base, fill, v))
7801 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_uint64, 32)
7802 ostreambuf_iterator_wchar* __thiscall num_put_wchar_do_put_uint64(const num_put *this, ostreambuf_iterator_wchar *ret,
7803 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, unsigned __int64 v)
7805 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
7806 char fmt[7]; /* strlen("%+#lld")+1 */
7808 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
7810 return num_put_wchar__Iput(this, ret, dest, base, fill, tmp,
7811 sprintf(tmp, num_put_wchar__Ifmt(this, fmt, "llu", base->fmtfl), v));
7814 /* ?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 */
7815 /* ?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 */
7816 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_uint64, 32)
7817 ostreambuf_iterator_wchar* __thiscall num_put_short_do_put_uint64(const num_put *this, ostreambuf_iterator_wchar *ret,
7818 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, unsigned __int64 v)
7820 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
7821 char fmt[7]; /* strlen("%+#lld")+1 */
7823 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
7825 return num_put_short__Iput(this, ret, dest, base, fill, tmp,
7826 sprintf(tmp, num_put_wchar__Ifmt(this, fmt, "llu", base->fmtfl), v));
7829 /* ?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 */
7830 /* ?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 */
7831 /* ?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 */
7832 /* ?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 */
7833 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_uint64, 32)
7834 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_uint64(const num_put *this, ostreambuf_iterator_wchar *ret,
7835 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, unsigned __int64 v)
7837 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
7838 return call_num_put_wchar_do_put_uint64(this, ret, dest, base, fill, v);
7841 /* ?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 */
7842 /* ?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 */
7843 #define call_num_put_wchar_do_put_bool(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 32, ostreambuf_iterator_wchar*, \
7844 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, MSVCP_bool), \
7845 (this, ret, dest, base, fill, v))
7846 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_bool, 28)
7847 ostreambuf_iterator_wchar* __thiscall num_put_wchar_do_put_bool(const num_put *this, ostreambuf_iterator_wchar *ret,
7848 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, MSVCP_bool v)
7850 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
7852 if(base->fmtfl & FMTFLAG_boolalpha) {
7853 numpunct_wchar *numpunct = numpunct_wchar_use_facet(base->loc);
7854 basic_string_wchar str;
7855 MSVCP_size_t pad, len;
7857 if(v)
7858 numpunct_wchar_truename(numpunct, &str);
7859 else
7860 numpunct_wchar_falsename(numpunct, &str);
7862 len = MSVCP_basic_string_wchar_length(&str);
7863 pad = (len>base->wide ? 0 : base->wide-len);
7864 base->wide = 0;
7866 if((base->fmtfl & FMTFLAG_adjustfield) != FMTFLAG_left) {
7867 num_put_wchar__Rep(this, &dest, dest, fill, pad);
7868 pad = 0;
7870 num_put_wchar__Put(this, &dest, dest, MSVCP_basic_string_wchar_c_str(&str), len);
7871 MSVCP_basic_string_wchar_dtor(&str);
7872 return num_put_wchar__Rep(this, ret, dest, fill, pad);
7875 return num_put_wchar_put_long(this, ret, dest, base, fill, v);
7878 /* ?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 */
7879 /* ?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 */
7880 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_bool, 28)
7881 ostreambuf_iterator_wchar* __thiscall num_put_short_do_put_bool(const num_put *this, ostreambuf_iterator_wchar *ret,
7882 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, MSVCP_bool v)
7884 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
7886 if(base->fmtfl & FMTFLAG_boolalpha) {
7887 numpunct_wchar *numpunct = numpunct_short_use_facet(base->loc);
7888 basic_string_wchar str;
7889 MSVCP_size_t pad, len;
7891 if(v)
7892 numpunct_wchar_truename(numpunct, &str);
7893 else
7894 numpunct_wchar_falsename(numpunct, &str);
7896 len = MSVCP_basic_string_wchar_length(&str);
7897 pad = (len>base->wide ? 0 : base->wide-len);
7898 base->wide = 0;
7900 if((base->fmtfl & FMTFLAG_adjustfield) != FMTFLAG_left) {
7901 num_put_wchar__Rep(this, &dest, dest, fill, pad);
7902 pad = 0;
7904 num_put_wchar__Put(this, &dest, dest, MSVCP_basic_string_wchar_c_str(&str), len);
7905 MSVCP_basic_string_wchar_dtor(&str);
7906 return num_put_wchar__Rep(this, ret, dest, fill, pad);
7909 return num_put_wchar_put_long(this, ret, dest, base, fill, v);
7912 /* ?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 */
7913 /* ?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 */
7914 /* ?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 */
7915 /* ?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 */
7916 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_bool, 28)
7917 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_bool(const num_put *this, ostreambuf_iterator_wchar *ret,
7918 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, MSVCP_bool v)
7920 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
7921 return call_num_put_wchar_do_put_bool(this, ret, dest, base, fill, v);
7924 /* ?id@?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@2V0locale@2@A */
7925 locale_id time_put_char_id = {0};
7927 /* ??_7?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@6B@ */
7928 extern const vtable_ptr MSVCP_time_put_char_vtable;
7930 /* ?_Init@?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@IAEXABV_Locinfo@2@@Z */
7931 /* ?_Init@?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@IEAAXAEBV_Locinfo@2@@Z */
7932 DEFINE_THISCALL_WRAPPER(time_put_char__Init, 8)
7933 void __thiscall time_put_char__Init(time_put *this, const _Locinfo *locinfo)
7935 TRACE("(%p %p)\n", this, locinfo);
7936 _Locinfo__Gettnames(locinfo, &this->time);
7937 _Locinfo__Getcvt(locinfo, &this->cvt);
7940 /* ??0?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
7941 /* ??0?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
7942 DEFINE_THISCALL_WRAPPER(time_put_char_ctor_locinfo, 12)
7943 time_put* __thiscall time_put_char_ctor_locinfo(time_put *this, const _Locinfo *locinfo, MSVCP_size_t refs)
7945 TRACE("(%p %p %lu)\n", this, locinfo, refs);
7946 locale_facet_ctor_refs(&this->facet, refs);
7947 this->facet.vtable = &MSVCP_time_put_char_vtable;
7948 time_put_char__Init(this, locinfo);
7949 return this;
7952 /* ??0?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAE@I@Z */
7953 /* ??0?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAA@_K@Z */
7954 DEFINE_THISCALL_WRAPPER(time_put_char_ctor_refs, 8)
7955 time_put* __thiscall time_put_char_ctor_refs(time_put *this, MSVCP_size_t refs)
7957 _Locinfo locinfo;
7959 TRACE("(%p %lu)\n", this, refs);
7961 _Locinfo_ctor(&locinfo);
7962 time_put_char_ctor_locinfo(this, &locinfo, refs);
7963 _Locinfo_dtor(&locinfo);
7964 return this;
7967 /* ??_F?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAEXXZ */
7968 /* ??_F?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAAXXZ */
7969 DEFINE_THISCALL_WRAPPER(time_put_char_ctor, 4)
7970 time_put* __thiscall time_put_char_ctor(time_put *this)
7972 return time_put_char_ctor_refs(this, 0);
7975 /* ??1?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MAE@XZ */
7976 /* ??1?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MEAA@XZ */
7977 DEFINE_THISCALL_WRAPPER(time_put_char_dtor, 4)
7978 void __thiscall time_put_char_dtor(time_put *this)
7980 TRACE("(%p)\n", this);
7981 _Timevec_dtor(&this->time);
7984 DEFINE_THISCALL_WRAPPER(time_put_char_vector_dtor, 8)
7985 time_put* __thiscall time_put_char_vector_dtor(time_put *this, unsigned int flags)
7987 TRACE("(%p %x)\n", this, flags);
7988 if(flags & 2) {
7989 /* we have an array, with the number of elements stored before the first object */
7990 INT_PTR i, *ptr = (INT_PTR *)this-1;
7992 for(i=*ptr-1; i>=0; i--)
7993 time_put_char_dtor(this+i);
7994 MSVCRT_operator_delete(ptr);
7995 } else {
7996 time_put_char_dtor(this);
7997 if(flags & 1)
7998 MSVCRT_operator_delete(this);
8001 return this;
8004 /* ?_Getcat@?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
8005 /* ?_Getcat@?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
8006 static MSVCP_size_t time_put_char__Getcat(const locale_facet **facet, const locale *loc)
8008 TRACE("(%p %p)\n", facet, loc);
8010 if(facet && !*facet) {
8011 _Locinfo locinfo;
8013 *facet = MSVCRT_operator_new(sizeof(time_put));
8014 if(!*facet) {
8015 ERR("Out of memory\n");
8016 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8017 return 0;
8020 _Locinfo_ctor_cstr(&locinfo, MSVCP_basic_string_char_c_str(&loc->ptr->name));
8021 time_put_char_ctor_locinfo((time_put*)*facet, &locinfo, 0);
8022 _Locinfo_dtor(&locinfo);
8025 return LC_TIME;
8028 /* ?_Getcat@?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SAIPAPBVfacet@locale@2@@Z */
8029 /* ?_Getcat@?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@@Z */
8030 MSVCP_size_t __cdecl time_put_char__Getcat_old(const locale_facet **facet)
8032 return time_put_char__Getcat(facet, locale_classic());
8035 static time_put* time_put_char_use_facet(const locale *loc)
8037 static time_put *obj = NULL;
8039 _Lockit lock;
8040 const locale_facet *fac;
8042 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
8043 fac = locale__Getfacet(loc, locale_id_operator_size_t(&time_put_char_id));
8044 if(fac) {
8045 _Lockit_dtor(&lock);
8046 return (time_put*)fac;
8049 if(obj) {
8050 _Lockit_dtor(&lock);
8051 return obj;
8054 time_put_char__Getcat(&fac, loc);
8055 obj = (time_put*)fac;
8056 locale_facet__Incref(&obj->facet);
8057 locale_facet_register(&obj->facet);
8058 _Lockit_dtor(&lock);
8060 return obj;
8063 /* ?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 */
8064 /* ?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 */
8065 DEFINE_THISCALL_WRAPPER(time_put_char_do_put, 36)
8066 #define call_time_put_char_do_put(this, ret, dest, base, fill, t, spec, mod) CALL_VTBL_FUNC(this, 4, ostreambuf_iterator_char*, \
8067 (const time_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, const struct tm*, char, char), \
8068 (this, ret, dest, base, fill, t, spec, mod))
8069 ostreambuf_iterator_char* __thiscall time_put_char_do_put(const time_put *this, ostreambuf_iterator_char *ret,
8070 ostreambuf_iterator_char dest, ios_base *base, char fill, const struct tm *t, char spec, char mod)
8072 char buf[64], fmt[4], *p = fmt;
8073 MSVCP_size_t i, len;
8075 TRACE("(%p %p %p %c %p %c %c)\n", this, ret, base, fill, t, spec, mod);
8077 *p++ = '%';
8078 if(mod)
8079 *p++ = mod;
8080 *p++ = spec;
8081 *p++ = 0;
8083 len = _Strftime(buf, sizeof(buf), fmt, t, this->time.timeptr);
8084 for(i=0; i<len; i++)
8085 ostreambuf_iterator_char_put(&dest, buf[i]);
8087 *ret = dest;
8088 return ret;
8091 /* ?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 */
8092 /* ?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 */
8093 DEFINE_THISCALL_WRAPPER(time_put_char_put, 36)
8094 ostreambuf_iterator_char* __thiscall time_put_char_put(const time_put *this, ostreambuf_iterator_char *ret,
8095 ostreambuf_iterator_char dest, ios_base *base, char fill, const struct tm *t, char spec, char mod)
8097 TRACE("(%p %p %p %c %p %c %c)\n", this, ret, base, fill, t, spec, mod);
8098 return call_time_put_char_do_put(this, ret, dest, base, fill, t, spec, mod);
8101 /* ?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 */
8102 /* ?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 */
8103 DEFINE_THISCALL_WRAPPER(time_put_char_put_format, 36)
8104 ostreambuf_iterator_char* __thiscall time_put_char_put_format(const time_put *this, ostreambuf_iterator_char *ret,
8105 ostreambuf_iterator_char dest, ios_base *base, char fill, const struct tm *t, const char *pat, const char *pat_end)
8107 TRACE("(%p %p %p %c %p %s)\n", this, ret, base, fill, t, debugstr_an(pat, pat_end-pat));
8109 while(pat < pat_end) {
8110 if(*pat != '%') {
8111 ostreambuf_iterator_char_put(&dest, *pat++);
8112 }else if(++pat == pat_end) {
8113 ostreambuf_iterator_char_put(&dest, '%');
8114 }else if(*pat=='#' && pat+1==pat_end) {
8115 ostreambuf_iterator_char_put(&dest, '%');
8116 ostreambuf_iterator_char_put(&dest, *pat++);
8117 }else {
8118 char mod;
8120 if(*pat == '#') {
8121 mod = '#';
8122 pat++;
8123 }else {
8124 mod = 0;
8127 time_put_char_put(this, &dest, dest, base, fill, t, *pat++, mod);
8131 *ret = dest;
8132 return ret;
8135 /* ?id@?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@2V0locale@2@A */
8136 locale_id time_put_wchar_id = {0};
8137 /* ?id@?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@2V0locale@2@A */
8138 locale_id time_put_short_id = {0};
8140 /* ??_7?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@6B@ */
8141 extern const vtable_ptr MSVCP_time_put_wchar_vtable;
8142 /* ??_7?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@6B@ */
8143 extern const vtable_ptr MSVCP_time_put_short_vtable;
8145 /* ?_Init@?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@IAEXABV_Locinfo@2@@Z */
8146 /* ?_Init@?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@IEAAXAEBV_Locinfo@2@@Z */
8147 /* ?_Init@?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@IAEXABV_Locinfo@2@@Z */
8148 /* ?_Init@?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@IEAAXAEBV_Locinfo@2@@Z */
8149 DEFINE_THISCALL_WRAPPER(time_put_wchar__Init, 8)
8150 void __thiscall time_put_wchar__Init(time_put *this, const _Locinfo *locinfo)
8152 TRACE("(%p %p)\n", this, locinfo);
8153 _Locinfo__Gettnames(locinfo, &this->time);
8154 _Locinfo__Getcvt(locinfo, &this->cvt);
8157 /* ??0?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
8158 /* ??0?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
8159 DEFINE_THISCALL_WRAPPER(time_put_wchar_ctor_locinfo, 12)
8160 time_put* __thiscall time_put_wchar_ctor_locinfo(time_put *this, const _Locinfo *locinfo, MSVCP_size_t refs)
8162 TRACE("(%p %p %lu)\n", this, locinfo, refs);
8163 locale_facet_ctor_refs(&this->facet, refs);
8164 this->facet.vtable = &MSVCP_time_put_wchar_vtable;
8165 time_put_wchar__Init(this, locinfo);
8166 return this;
8169 /* ??0?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
8170 /* ??0?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
8171 DEFINE_THISCALL_WRAPPER(time_put_short_ctor_locinfo, 12)
8172 time_put* __thiscall time_put_short_ctor_locinfo(time_put *this, const _Locinfo *locinfo, MSVCP_size_t refs)
8174 time_put_wchar_ctor_locinfo(this, locinfo, refs);
8175 this->facet.vtable = &MSVCP_time_put_short_vtable;
8176 return this;
8179 /* ??0?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@IAE@PBDI@Z */
8180 /* ??0?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@IEAA@PEBD_K@Z */
8181 DEFINE_THISCALL_WRAPPER(time_put_wchar_ctor_name, 12)
8182 time_put* __thiscall time_put_wchar_ctor_name(time_put *this, const char *name, MSVCP_size_t refs)
8184 _Locinfo locinfo;
8186 TRACE("(%p %s %lu)\n", this, debugstr_a(name), refs);
8188 _Locinfo_ctor_cstr(&locinfo, name);
8189 time_put_wchar_ctor_locinfo(this, &locinfo, refs);
8190 _Locinfo_dtor(&locinfo);
8191 return this;
8194 /* ??0?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@IAE@PBDI@Z */
8195 /* ??0?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@IEAA@PEBD_K@Z */
8196 DEFINE_THISCALL_WRAPPER(time_put_short_ctor_name, 12)
8197 time_put* __thiscall time_put_short_ctor_name(time_put *this, const char *name, MSVCP_size_t refs)
8199 time_put_wchar_ctor_name(this, name, refs);
8200 this->facet.vtable = &MSVCP_time_put_short_vtable;
8201 return this;
8204 /* ??0?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAE@I@Z */
8205 /* ??0?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAA@_K@Z */
8206 DEFINE_THISCALL_WRAPPER(time_put_wchar_ctor_refs, 8)
8207 time_put* __thiscall time_put_wchar_ctor_refs(time_put *this, MSVCP_size_t refs)
8209 _Locinfo locinfo;
8211 TRACE("(%p %lu)\n", this, refs);
8213 _Locinfo_ctor(&locinfo);
8214 time_put_wchar_ctor_locinfo(this, &locinfo, refs);
8215 _Locinfo_dtor(&locinfo);
8216 return this;
8219 /* ??0?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAE@I@Z */
8220 /* ??0?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEAA@_K@Z */
8221 DEFINE_THISCALL_WRAPPER(time_put_short_ctor_refs, 8)
8222 time_put* __thiscall time_put_short_ctor_refs(time_put *this, MSVCP_size_t refs)
8224 time_put_wchar_ctor_refs(this, refs);
8225 this->facet.vtable = &MSVCP_time_put_short_vtable;
8226 return this;
8229 /* ??_F?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAEXXZ */
8230 /* ??_F?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAAXXZ */
8231 DEFINE_THISCALL_WRAPPER(time_put_wchar_ctor, 4)
8232 time_put* __thiscall time_put_wchar_ctor(time_put *this)
8234 return time_put_wchar_ctor_refs(this, 0);
8237 /* ??_F?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAEXXZ */
8238 /* ??_F?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEAAXXZ */
8239 DEFINE_THISCALL_WRAPPER(time_put_short_ctor, 4)
8240 time_put* __thiscall time_put_short_ctor(time_put *this)
8242 time_put_wchar_ctor(this);
8243 this->facet.vtable = &MSVCP_time_put_short_vtable;
8244 return this;
8247 /* ??1?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MAE@XZ */
8248 /* ??1?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MEAA@XZ */
8249 /* ??1?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MAE@XZ */
8250 /* ??1?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MEAA@XZ */
8251 DEFINE_THISCALL_WRAPPER(time_put_wchar_dtor, 4)
8252 void __thiscall time_put_wchar_dtor(time_put *this)
8254 TRACE("(%p)\n", this);
8255 _Timevec_dtor(&this->time);
8258 DEFINE_THISCALL_WRAPPER(time_put_wchar_vector_dtor, 8)
8259 time_put* __thiscall time_put_wchar_vector_dtor(time_put *this, unsigned int flags)
8261 TRACE("(%p %x)\n", this, flags);
8262 if(flags & 2) {
8263 /* we have an array, with the number of elements stored before the first object */
8264 INT_PTR i, *ptr = (INT_PTR *)this-1;
8266 for(i=*ptr-1; i>=0; i--)
8267 time_put_wchar_dtor(this+i);
8268 MSVCRT_operator_delete(ptr);
8269 } else {
8270 time_put_wchar_dtor(this);
8271 if(flags & 1)
8272 MSVCRT_operator_delete(this);
8275 return this;
8278 /* ?_Getcat@?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
8279 /* ?_Getcat@?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
8280 static MSVCP_size_t time_put_wchar__Getcat(const locale_facet **facet, const locale *loc)
8282 TRACE("(%p %p)\n", facet, loc);
8284 if(facet && !*facet) {
8285 *facet = MSVCRT_operator_new(sizeof(time_put));
8286 if(!*facet) {
8287 ERR("Out of memory\n");
8288 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8289 return 0;
8291 time_put_wchar_ctor_name((time_put*)*facet,
8292 MSVCP_basic_string_char_c_str(&loc->ptr->name), 0);
8295 return LC_TIME;
8298 /* ?_Getcat@?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SAIPAPBVfacet@locale@2@@Z */
8299 /* ?_Getcat@?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@@Z */
8300 MSVCP_size_t __cdecl time_put_wchar__Getcat_old(const locale_facet **facet)
8302 return time_put_wchar__Getcat(facet, locale_classic());
8305 static time_put* time_put_wchar_use_facet(const locale *loc)
8307 static time_put *obj = NULL;
8309 _Lockit lock;
8310 const locale_facet *fac;
8312 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
8313 fac = locale__Getfacet(loc, locale_id_operator_size_t(&time_put_wchar_id));
8314 if(fac) {
8315 _Lockit_dtor(&lock);
8316 return (time_put*)fac;
8319 if(obj) {
8320 _Lockit_dtor(&lock);
8321 return obj;
8324 time_put_wchar__Getcat(&fac, loc);
8325 obj = (time_put*)fac;
8326 locale_facet__Incref(&obj->facet);
8327 locale_facet_register(&obj->facet);
8328 _Lockit_dtor(&lock);
8330 return obj;
8333 /* ?_Getcat@?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
8334 /* ?_Getcat@?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
8335 static MSVCP_size_t time_put_short__Getcat(const locale_facet **facet, const locale *loc)
8337 TRACE("(%p %p)\n", facet, loc);
8339 if(facet && !*facet) {
8340 *facet = MSVCRT_operator_new(sizeof(time_put));
8341 if(!*facet) {
8342 ERR("Out of memory\n");
8343 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8344 return 0;
8346 time_put_short_ctor_name((time_put*)*facet,
8347 MSVCP_basic_string_char_c_str(&loc->ptr->name), 0);
8350 return LC_TIME;
8353 /* ?_Getcat@?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SAIPAPBVfacet@locale@2@@Z */
8354 /* ?_Getcat@?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@@Z */
8355 MSVCP_size_t __cdecl time_put_short__Getcat_old(const locale_facet **facet)
8357 return time_put_short__Getcat(facet, locale_classic());
8360 static time_put* time_put_short_use_facet(const locale *loc)
8362 static time_put *obj = NULL;
8364 _Lockit lock;
8365 const locale_facet *fac;
8367 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
8368 fac = locale__Getfacet(loc, locale_id_operator_size_t(&time_put_short_id));
8369 if(fac) {
8370 _Lockit_dtor(&lock);
8371 return (time_put*)fac;
8374 if(obj) {
8375 _Lockit_dtor(&lock);
8376 return obj;
8379 time_put_short__Getcat(&fac, loc);
8380 obj = (time_put*)fac;
8381 locale_facet__Incref(&obj->facet);
8382 locale_facet_register(&obj->facet);
8383 _Lockit_dtor(&lock);
8385 return obj;
8388 /* ?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 */
8389 /* ?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 */
8390 /* ?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 */
8391 /* ?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 */
8392 DEFINE_THISCALL_WRAPPER(time_put_wchar_do_put, 36)
8393 #define call_time_put_wchar_do_put(this, ret, dest, base, fill, t, spec, mod) CALL_VTBL_FUNC(this, 4, ostreambuf_iterator_wchar*, \
8394 (const time_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, const struct tm*, char, char), \
8395 (this, ret, dest, base, fill, t, spec, mod))
8396 ostreambuf_iterator_wchar* __thiscall time_put_wchar_do_put(const time_put *this,
8397 ostreambuf_iterator_wchar *ret, ostreambuf_iterator_wchar dest, ios_base *base,
8398 wchar_t fill, const struct tm *t, char spec, char mod)
8400 char buf[64], fmt[4], *p = fmt;
8401 MSVCP_size_t i, len;
8402 wchar_t c;
8404 TRACE("(%p %p %p %c %p %c %c)\n", this, ret, base, fill, t, spec, mod);
8406 *p++ = '%';
8407 if(mod)
8408 *p++ = mod;
8409 *p++ = spec;
8410 *p++ = 0;
8412 len = _Strftime(buf, sizeof(buf), fmt, t, this->time.timeptr);
8413 for(i=0; i<len; i++) {
8414 c = mb_to_wc(buf[i], &this->cvt);
8415 ostreambuf_iterator_wchar_put(&dest, c);
8418 *ret = dest;
8419 return ret;
8422 /* ?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 */
8423 /* ?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 */
8424 /* ?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 */
8425 /* ?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 */
8426 DEFINE_THISCALL_WRAPPER(time_put_wchar_put, 36)
8427 ostreambuf_iterator_wchar* __thiscall time_put_wchar_put(const time_put *this,
8428 ostreambuf_iterator_wchar *ret, ostreambuf_iterator_wchar dest, ios_base *base,
8429 wchar_t fill, const struct tm *t, char spec, char mod)
8431 TRACE("(%p %p %p %c %p %c %c)\n", this, ret, base, fill, t, spec, mod);
8432 return call_time_put_wchar_do_put(this, ret, dest, base, fill, t, spec, mod);
8435 /* ?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 */
8436 /* ?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 */
8437 /* ?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 */
8438 /* ?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 */
8439 DEFINE_THISCALL_WRAPPER(time_put_wchar_put_format, 36)
8440 ostreambuf_iterator_wchar* __thiscall time_put_wchar_put_format(const time_put *this,
8441 ostreambuf_iterator_wchar *ret, ostreambuf_iterator_wchar dest, ios_base *base,
8442 wchar_t fill, const struct tm *t, const wchar_t *pat, const wchar_t *pat_end)
8444 wchar_t percent = mb_to_wc('%', &this->cvt);
8445 char c[MB_LEN_MAX];
8447 TRACE("(%p %p %p %c %p %s)\n", this, ret, base, fill, t, debugstr_wn(pat, pat_end-pat));
8449 while(pat < pat_end) {
8450 if(*pat != percent) {
8451 ostreambuf_iterator_wchar_put(&dest, *pat++);
8452 }else if(++pat == pat_end) {
8453 ostreambuf_iterator_wchar_put(&dest, percent);
8454 }else if(!_Wcrtomb(c, *pat, NULL, &this->cvt) || (*c=='#' && pat+1==pat_end)) {
8455 ostreambuf_iterator_wchar_put(&dest, percent);
8456 ostreambuf_iterator_wchar_put(&dest, *pat++);
8457 }else {
8458 if(*c == '#') {
8459 if(!_Wcrtomb(c, *pat++, NULL, &this->cvt)) {
8460 ostreambuf_iterator_wchar_put(&dest, percent);
8461 ostreambuf_iterator_wchar_put(&dest, *(pat-1));
8462 ostreambuf_iterator_wchar_put(&dest, *pat);
8463 }else {
8464 time_put_wchar_put(this, &dest, dest, base, fill, t, *c, '#');
8466 }else {
8467 time_put_wchar_put(this, &dest, dest, base, fill, t, *c, 0);
8472 *ret = dest;
8473 return ret;
8476 /* ??0_Locimp@locale@std@@AAE@_N@Z */
8477 /* ??0_Locimp@locale@std@@AEAA@_N@Z */
8478 DEFINE_THISCALL_WRAPPER(locale__Locimp_ctor_transparent, 8)
8479 locale__Locimp* __thiscall locale__Locimp_ctor_transparent(locale__Locimp *this, MSVCP_bool transparent)
8481 TRACE("(%p %d)\n", this, transparent);
8483 memset(this, 0, sizeof(locale__Locimp));
8484 locale_facet_ctor_refs(&this->facet, 1);
8485 this->transparent = transparent;
8486 MSVCP_basic_string_char_ctor_cstr(&this->name, "*");
8487 return this;
8490 /* ??_F_Locimp@locale@std@@QAEXXZ */
8491 /* ??_F_Locimp@locale@std@@QEAAXXZ */
8492 DEFINE_THISCALL_WRAPPER(locale__Locimp_ctor, 4)
8493 locale__Locimp* __thiscall locale__Locimp_ctor(locale__Locimp *this)
8495 return locale__Locimp_ctor_transparent(this, FALSE);
8498 /* ??0_Locimp@locale@std@@AAE@ABV012@@Z */
8499 /* ??0_Locimp@locale@std@@AEAA@AEBV012@@Z */
8500 DEFINE_THISCALL_WRAPPER(locale__Locimp_copy_ctor, 8)
8501 locale__Locimp* __thiscall locale__Locimp_copy_ctor(locale__Locimp *this, const locale__Locimp *copy)
8503 _Lockit lock;
8504 MSVCP_size_t i;
8506 TRACE("(%p %p)\n", this, copy);
8508 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
8509 memcpy(this, copy, sizeof(locale__Locimp));
8510 locale_facet_ctor_refs(&this->facet, 1);
8511 if(copy->facetvec) {
8512 this->facetvec = MSVCRT_operator_new(copy->facet_cnt*sizeof(locale_facet*));
8513 if(!this->facetvec) {
8514 _Lockit_dtor(&lock);
8515 ERR("Out of memory\n");
8516 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8517 return NULL;
8519 for(i=0; i<this->facet_cnt; i++)
8521 this->facetvec[i] = copy->facetvec[i];
8522 if(this->facetvec[i])
8523 locale_facet__Incref(this->facetvec[i]);
8526 MSVCP_basic_string_char_copy_ctor(&this->name, &copy->name);
8527 _Lockit_dtor(&lock);
8528 return this;
8531 /* ?_Locimp_ctor@_Locimp@locale@std@@CAXPAV123@ABV123@@Z */
8532 /* ?_Locimp_ctor@_Locimp@locale@std@@CAXPEAV123@AEBV123@@Z */
8533 locale__Locimp* __cdecl locale__Locimp__Locimp_ctor(locale__Locimp *this, const locale__Locimp *copy)
8535 return locale__Locimp_copy_ctor(this, copy);
8538 /* ??1_Locimp@locale@std@@MAE@XZ */
8539 /* ??1_Locimp@locale@std@@MEAA@XZ */
8540 DEFINE_THISCALL_WRAPPER(locale__Locimp_dtor, 4)
8541 void __thiscall locale__Locimp_dtor(locale__Locimp *this)
8543 MSVCP_size_t i;
8545 TRACE("(%p)\n", this);
8547 locale_facet_dtor(&this->facet);
8548 for(i=0; i<this->facet_cnt; i++)
8549 if(this->facetvec[i] && locale_facet__Decref(this->facetvec[i]))
8550 call_locale_facet_vector_dtor(this->facetvec[i], 1);
8552 MSVCRT_operator_delete(this->facetvec);
8553 MSVCP_basic_string_char_dtor(&this->name);
8556 /* ?_Locimp_dtor@_Locimp@locale@std@@CAXPAV123@@Z */
8557 /* ?_Locimp_dtor@_Locimp@locale@std@@CAXPEAV123@@Z */
8558 void __cdecl locale__Locimp__Locimp_dtor(locale__Locimp *this)
8560 locale__Locimp_dtor(this);
8563 DEFINE_THISCALL_WRAPPER(locale__Locimp_vector_dtor, 8)
8564 locale__Locimp* __thiscall locale__Locimp_vector_dtor(locale__Locimp *this, unsigned int flags)
8566 TRACE("(%p %x)\n", this, flags);
8567 if(flags & 2) {
8568 /* we have an array, with the number of elements stored before the first object */
8569 INT_PTR i, *ptr = (INT_PTR *)this-1;
8571 for(i=*ptr-1; i>=0; i--)
8572 locale__Locimp_dtor(this+i);
8573 MSVCRT_operator_delete(ptr);
8574 } else {
8575 locale__Locimp_dtor(this);
8576 if(flags & 1)
8577 MSVCRT_operator_delete(this);
8580 return this;
8583 /* ?_Locimp_Addfac@_Locimp@locale@std@@CAXPAV123@PAVfacet@23@I@Z */
8584 /* ?_Locimp_Addfac@_Locimp@locale@std@@CAXPEAV123@PEAVfacet@23@_K@Z */
8585 void __cdecl locale__Locimp__Locimp_Addfac(locale__Locimp *locimp, locale_facet *facet, MSVCP_size_t id)
8587 _Lockit lock;
8589 TRACE("(%p %p %lu)\n", locimp, facet, id);
8591 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
8592 if(id >= locimp->facet_cnt) {
8593 MSVCP_size_t new_size = id+1;
8594 locale_facet **new_facetvec;
8596 if(new_size < locale_id__Id_cnt+1)
8597 new_size = locale_id__Id_cnt+1;
8599 new_facetvec = MSVCRT_operator_new(sizeof(locale_facet*)*new_size);
8600 if(!new_facetvec) {
8601 _Lockit_dtor(&lock);
8602 ERR("Out of memory\n");
8603 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8604 return;
8607 memset(new_facetvec, 0, sizeof(locale_facet*)*new_size);
8608 memcpy(new_facetvec, locimp->facetvec, sizeof(locale_facet*)*locimp->facet_cnt);
8609 MSVCRT_operator_delete(locimp->facetvec);
8610 locimp->facetvec = new_facetvec;
8611 locimp->facet_cnt = new_size;
8614 if(locimp->facetvec[id] && locale_facet__Decref(locimp->facetvec[id]))
8615 call_locale_facet_vector_dtor(locimp->facetvec[id], 1);
8617 locimp->facetvec[id] = facet;
8618 if(facet)
8619 locale_facet__Incref(facet);
8620 _Lockit_dtor(&lock);
8623 /* ?_Addfac@_Locimp@locale@std@@AAEXPAVfacet@23@I@Z */
8624 /* ?_Addfac@_Locimp@locale@std@@AEAAXPEAVfacet@23@_K@Z */
8625 DEFINE_THISCALL_WRAPPER(locale__Locimp__Addfac, 12)
8626 void __thiscall locale__Locimp__Addfac(locale__Locimp *this, locale_facet *facet, MSVCP_size_t id)
8628 locale__Locimp__Locimp_Addfac(this, facet, id);
8631 /* ?_Clocptr_func@_Locimp@locale@std@@CAAAPAV123@XZ */
8632 /* ?_Clocptr_func@_Locimp@locale@std@@CAAEAPEAV123@XZ */
8633 locale__Locimp** __cdecl locale__Locimp__Clocptr_func(void)
8635 FIXME("stub\n");
8636 return NULL;
8639 /* ?_Makeushloc@_Locimp@locale@std@@CAXABV_Locinfo@3@HPAV123@PBV23@@Z */
8640 /* ?_Makeushloc@_Locimp@locale@std@@CAXAEBV_Locinfo@3@HPEAV123@PEBV23@@Z */
8641 /* List of missing facets:
8642 * messages, money_get, money_put, moneypunct, moneypunct, time_get
8644 void __cdecl locale__Locimp__Makeushloc(const _Locinfo *locinfo, category cat, locale__Locimp *locimp, const locale *loc)
8646 FIXME("(%p %d %p %p) semi-stub\n", locinfo, cat, locimp, loc);
8648 if(cat & (1<<(ctype_short__Getcat(NULL, NULL)-1))) {
8649 ctype_wchar *ctype;
8651 if(loc) {
8652 ctype = ctype_short_use_facet(loc);
8653 }else {
8654 ctype = MSVCRT_operator_new(sizeof(ctype_wchar));
8655 if(!ctype) {
8656 ERR("Out of memory\n");
8657 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8659 ctype_short_ctor_locinfo(ctype, locinfo, 0);
8661 locale__Locimp__Addfac(locimp, &ctype->base.facet, locale_id_operator_size_t(&ctype_short_id));
8664 if(cat & (1<<(num_get_short__Getcat(NULL, NULL)-1))) {
8665 num_get *numget;
8667 if(loc) {
8668 numget = num_get_short_use_facet(loc);
8669 }else {
8670 numget = MSVCRT_operator_new(sizeof(num_get));
8671 if(!numget) {
8672 ERR("Out of memory\n");
8673 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8675 num_get_short_ctor_locinfo(numget, locinfo, 0);
8677 locale__Locimp__Addfac(locimp, &numget->facet, locale_id_operator_size_t(&num_get_short_id));
8680 if(cat & (1<<(num_put_short__Getcat(NULL, NULL)-1))) {
8681 num_put *numput;
8683 if(loc) {
8684 numput = num_put_short_use_facet(loc);
8685 }else {
8686 numput = MSVCRT_operator_new(sizeof(num_put));
8687 if(!numput) {
8688 ERR("Out of memory\n");
8689 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8691 num_put_short_ctor_locinfo(numput, locinfo, 0);
8693 locale__Locimp__Addfac(locimp, &numput->facet, locale_id_operator_size_t(&num_put_short_id));
8696 if(cat & (1<<(numpunct_short__Getcat(NULL, NULL)-1))) {
8697 numpunct_wchar *numpunct;
8699 if(loc) {
8700 numpunct = numpunct_short_use_facet(loc);
8701 }else {
8702 numpunct = MSVCRT_operator_new(sizeof(numpunct_wchar));
8703 if(!numpunct) {
8704 ERR("Out of memory\n");
8705 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8707 numpunct_short_ctor_locinfo(numpunct, locinfo, 0, FALSE);
8709 locale__Locimp__Addfac(locimp, &numpunct->facet, locale_id_operator_size_t(&numpunct_short_id));
8712 if(cat & (1<<(collate_short__Getcat(NULL, NULL)-1))) {
8713 collate *c;
8715 if(loc) {
8716 c = collate_short_use_facet(loc);
8717 }else {
8718 c = MSVCRT_operator_new(sizeof(collate));
8719 if(!c) {
8720 ERR("Out of memory\n");
8721 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8723 collate_short_ctor_locinfo(c, locinfo, 0);
8725 locale__Locimp__Addfac(locimp, &c->facet, locale_id_operator_size_t(&collate_short_id));
8728 if(cat & (1<<(time_put_short__Getcat(NULL, NULL)-1))) {
8729 time_put *t;
8731 if(loc) {
8732 t = time_put_short_use_facet(loc);
8733 }else {
8734 t = MSVCRT_operator_new(sizeof(time_put));
8735 if(!t) {
8736 ERR("Out of memory\n");
8737 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8739 time_put_short_ctor_locinfo(t, locinfo, 0);
8741 locale__Locimp__Addfac(locimp, &t->facet, locale_id_operator_size_t(&time_put_short_id));
8744 if(cat & (1<<(codecvt_short__Getcat(NULL, NULL)-1))) {
8745 codecvt_wchar *codecvt;
8747 if(loc) {
8748 codecvt = codecvt_short_use_facet(loc);
8749 }else {
8750 codecvt = MSVCRT_operator_new(sizeof(codecvt_wchar));
8751 if(!codecvt) {
8752 ERR("Out of memory\n");
8753 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8755 codecvt_short_ctor_locinfo(codecvt, locinfo, 0);
8757 locale__Locimp__Addfac(locimp, &codecvt->base.facet, locale_id_operator_size_t(&codecvt_short_id));
8761 /* ?_Makewloc@_Locimp@locale@std@@CAXABV_Locinfo@3@HPAV123@PBV23@@Z */
8762 /* ?_Makewloc@_Locimp@locale@std@@CAXAEBV_Locinfo@3@HPEAV123@PEBV23@@Z */
8763 /* List of missing facets:
8764 * messages, money_get, money_put, moneypunct, moneypunct, time_get
8766 void __cdecl locale__Locimp__Makewloc(const _Locinfo *locinfo, category cat, locale__Locimp *locimp, const locale *loc)
8768 FIXME("(%p %d %p %p) semi-stub\n", locinfo, cat, locimp, loc);
8770 if(cat & (1<<(ctype_wchar__Getcat(NULL, NULL)-1))) {
8771 ctype_wchar *ctype;
8773 if(loc) {
8774 ctype = ctype_wchar_use_facet(loc);
8775 }else {
8776 ctype = MSVCRT_operator_new(sizeof(ctype_wchar));
8777 if(!ctype) {
8778 ERR("Out of memory\n");
8779 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8781 ctype_wchar_ctor_locinfo(ctype, locinfo, 0);
8783 locale__Locimp__Addfac(locimp, &ctype->base.facet, locale_id_operator_size_t(&ctype_wchar_id));
8786 if(cat & (1<<(num_get_wchar__Getcat(NULL, NULL)-1))) {
8787 num_get *numget;
8789 if(loc) {
8790 numget = num_get_wchar_use_facet(loc);
8791 }else {
8792 numget = MSVCRT_operator_new(sizeof(num_get));
8793 if(!numget) {
8794 ERR("Out of memory\n");
8795 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8797 num_get_wchar_ctor_locinfo(numget, locinfo, 0);
8799 locale__Locimp__Addfac(locimp, &numget->facet, locale_id_operator_size_t(&num_get_wchar_id));
8802 if(cat & (1<<(num_put_wchar__Getcat(NULL, NULL)-1))) {
8803 num_put *numput;
8805 if(loc) {
8806 numput = num_put_wchar_use_facet(loc);
8807 }else {
8808 numput = MSVCRT_operator_new(sizeof(num_put));
8809 if(!numput) {
8810 ERR("Out of memory\n");
8811 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8813 num_put_wchar_ctor_locinfo(numput, locinfo, 0);
8815 locale__Locimp__Addfac(locimp, &numput->facet, locale_id_operator_size_t(&num_put_wchar_id));
8818 if(cat & (1<<(numpunct_wchar__Getcat(NULL, NULL)-1))) {
8819 numpunct_wchar *numpunct;
8821 if(loc) {
8822 numpunct = numpunct_wchar_use_facet(loc);
8823 }else {
8824 numpunct = MSVCRT_operator_new(sizeof(numpunct_wchar));
8825 if(!numpunct) {
8826 ERR("Out of memory\n");
8827 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8829 numpunct_wchar_ctor_locinfo(numpunct, locinfo, 0, FALSE);
8831 locale__Locimp__Addfac(locimp, &numpunct->facet, locale_id_operator_size_t(&numpunct_wchar_id));
8834 if(cat & (1<<(collate_wchar__Getcat(NULL, NULL)-1))) {
8835 collate *c;
8837 if(loc) {
8838 c = collate_wchar_use_facet(loc);
8839 }else {
8840 c = MSVCRT_operator_new(sizeof(collate));
8841 if(!c) {
8842 ERR("Out of memory\n");
8843 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8845 collate_wchar_ctor_locinfo(c, locinfo, 0);
8847 locale__Locimp__Addfac(locimp, &c->facet, locale_id_operator_size_t(&collate_wchar_id));
8850 if(cat & (1<<(time_put_wchar__Getcat(NULL, NULL)-1))) {
8851 time_put *t;
8853 if(loc) {
8854 t = time_put_wchar_use_facet(loc);
8855 }else {
8856 t = MSVCRT_operator_new(sizeof(time_put));
8857 if(!t) {
8858 ERR("Out of memory\n");
8859 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8861 time_put_wchar_ctor_locinfo(t, locinfo, 0);
8863 locale__Locimp__Addfac(locimp, &t->facet, locale_id_operator_size_t(&time_put_wchar_id));
8866 if(cat & (1<<(codecvt_wchar__Getcat(NULL, NULL)-1))) {
8867 codecvt_wchar *codecvt;
8869 if(loc) {
8870 codecvt = codecvt_wchar_use_facet(loc);
8871 }else {
8872 codecvt = MSVCRT_operator_new(sizeof(codecvt_wchar));
8873 if(!codecvt) {
8874 ERR("Out of memory\n");
8875 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8877 codecvt_wchar_ctor_locinfo(codecvt, locinfo, 0);
8879 locale__Locimp__Addfac(locimp, &codecvt->base.facet, locale_id_operator_size_t(&codecvt_wchar_id));
8883 /* ?_Makexloc@_Locimp@locale@std@@CAXABV_Locinfo@3@HPAV123@PBV23@@Z */
8884 /* ?_Makexloc@_Locimp@locale@std@@CAXAEBV_Locinfo@3@HPEAV123@PEBV23@@Z */
8885 /* List of missing facets:
8886 * messages, money_get, money_put, moneypunct, moneypunct, time_get
8888 void __cdecl locale__Locimp__Makexloc(const _Locinfo *locinfo, category cat, locale__Locimp *locimp, const locale *loc)
8890 FIXME("(%p %d %p %p) semi-stub\n", locinfo, cat, locimp, loc);
8892 if(cat & (1<<(ctype_char__Getcat(NULL, NULL)-1))) {
8893 ctype_char *ctype;
8895 if(loc) {
8896 ctype = ctype_char_use_facet(loc);
8897 }else {
8898 ctype = MSVCRT_operator_new(sizeof(ctype_char));
8899 if(!ctype) {
8900 ERR("Out of memory\n");
8901 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8903 ctype_char_ctor_locinfo(ctype, locinfo, 0);
8905 locale__Locimp__Addfac(locimp, &ctype->base.facet, locale_id_operator_size_t(&ctype_char_id));
8908 if(cat & (1<<(num_get_char__Getcat(NULL, NULL)-1))) {
8909 num_get *numget;
8911 if(loc) {
8912 numget = num_get_char_use_facet(loc);
8913 }else {
8914 numget = MSVCRT_operator_new(sizeof(num_get));
8915 if(!numget) {
8916 ERR("Out of memory\n");
8917 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8919 num_get_char_ctor_locinfo(numget, locinfo, 0);
8921 locale__Locimp__Addfac(locimp, &numget->facet, locale_id_operator_size_t(&num_get_char_id));
8924 if(cat & (1<<(num_put_char__Getcat(NULL, NULL)-1))) {
8925 num_put *numput;
8927 if(loc) {
8928 numput = num_put_char_use_facet(loc);
8929 }else {
8930 numput = MSVCRT_operator_new(sizeof(num_put));
8931 if(!numput) {
8932 ERR("Out of memory\n");
8933 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8935 num_put_char_ctor_locinfo(numput, locinfo, 0);
8937 locale__Locimp__Addfac(locimp, &numput->facet, locale_id_operator_size_t(&num_put_char_id));
8940 if(cat & (1<<(numpunct_char__Getcat(NULL, NULL)-1))) {
8941 numpunct_char *numpunct;
8943 if(loc) {
8944 numpunct = numpunct_char_use_facet(loc);
8945 }else {
8946 numpunct = MSVCRT_operator_new(sizeof(numpunct_char));
8947 if(!numpunct) {
8948 ERR("Out of memory\n");
8949 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8951 numpunct_char_ctor_locinfo(numpunct, locinfo, 0, FALSE);
8953 locale__Locimp__Addfac(locimp, &numpunct->facet, locale_id_operator_size_t(&numpunct_char_id));
8956 if(cat & (1<<(collate_char__Getcat(NULL, NULL)-1))) {
8957 collate *c;
8959 if(loc) {
8960 c = collate_char_use_facet(loc);
8961 }else {
8962 c = MSVCRT_operator_new(sizeof(collate));
8963 if(!c) {
8964 ERR("Out of memory\n");
8965 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8967 collate_char_ctor_locinfo(c, locinfo, 0);
8969 locale__Locimp__Addfac(locimp, &c->facet, locale_id_operator_size_t(&collate_char_id));
8972 if(cat & (1<<(time_put_char__Getcat(NULL, NULL)-1))) {
8973 time_put *t;
8975 if(loc) {
8976 t = time_put_char_use_facet(loc);
8977 }else {
8978 t = MSVCRT_operator_new(sizeof(time_put));
8979 if(!t) {
8980 ERR("Out of memory\n");
8981 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8983 time_put_char_ctor_locinfo(t, locinfo, 0);
8985 locale__Locimp__Addfac(locimp, &t->facet, locale_id_operator_size_t(&time_put_char_id));
8988 if(cat & (1<<(codecvt_char__Getcat(NULL, NULL)-1))) {
8989 codecvt_char *codecvt;
8991 if(loc) {
8992 codecvt = codecvt_char_use_facet(loc);
8993 }else {
8994 codecvt = MSVCRT_operator_new(sizeof(codecvt_char));
8995 if(!codecvt) {
8996 ERR("Out of memory\n");
8997 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8999 codecvt_char_ctor_locinfo(codecvt, locinfo, 0);
9001 locale__Locimp__Addfac(locimp, &codecvt->base.facet, locale_id_operator_size_t(&codecvt_char_id));
9005 /* ?_Makeloc@_Locimp@locale@std@@CAPAV123@ABV_Locinfo@3@HPAV123@PBV23@@Z */
9006 /* ?_Makeloc@_Locimp@locale@std@@CAPEAV123@AEBV_Locinfo@3@HPEAV123@PEBV23@@Z */
9007 locale__Locimp* __cdecl locale__Locimp__Makeloc(const _Locinfo *locinfo, category cat, locale__Locimp *locimp, const locale *loc)
9009 TRACE("(%p %d %p %p)\n", locinfo, cat, locimp, loc);
9011 locale__Locimp__Makexloc(locinfo, cat, locimp, loc);
9012 locale__Locimp__Makewloc(locinfo, cat, locimp, loc);
9013 locale__Locimp__Makeushloc(locinfo, cat, locimp, loc);
9015 locimp->catmask |= cat;
9016 MSVCP_basic_string_char_assign(&locimp->name, &locinfo->newlocname);
9017 return locimp;
9020 /* ??_7_Locimp@locale@std@@6B@ */
9021 const vtable_ptr MSVCP_locale__Locimp_vtable[] = {
9022 (vtable_ptr)THISCALL_NAME(locale__Locimp_vector_dtor)
9025 /* ??0locale@std@@AAE@PAV_Locimp@01@@Z */
9026 /* ??0locale@std@@AEAA@PEAV_Locimp@01@@Z */
9027 DEFINE_THISCALL_WRAPPER(locale_ctor_locimp, 8)
9028 locale* __thiscall locale_ctor_locimp(locale *this, locale__Locimp *locimp)
9030 TRACE("(%p %p)\n", this, locimp);
9031 /* Don't change locimp reference counter */
9032 this->ptr = locimp;
9033 return this;
9036 /* ?_Init@locale@std@@CAPAV_Locimp@12@XZ */
9037 /* ?_Init@locale@std@@CAPEAV_Locimp@12@XZ */
9038 locale__Locimp* __cdecl locale__Init(void)
9040 _Lockit lock;
9042 TRACE("\n");
9044 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
9045 if(global_locale) {
9046 _Lockit_dtor(&lock);
9047 return global_locale;
9050 global_locale = MSVCRT_operator_new(sizeof(locale__Locimp));
9051 if(!global_locale) {
9052 _Lockit_dtor(&lock);
9053 ERR("Out of memory\n");
9054 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
9055 return NULL;
9058 locale__Locimp_ctor(global_locale);
9059 global_locale->catmask = (1<<(LC_MAX+1))-1;
9060 MSVCP_basic_string_char_dtor(&global_locale->name);
9061 MSVCP_basic_string_char_ctor_cstr(&global_locale->name, "C");
9063 locale__Locimp__Clocptr = global_locale;
9064 global_locale->facet.refs++;
9065 locale_ctor_locimp(&classic_locale, locale__Locimp__Clocptr);
9066 _Lockit_dtor(&lock);
9068 return global_locale;
9071 /* ??0locale@std@@QAE@ABV01@0H@Z */
9072 /* ??0locale@std@@QEAA@AEBV01@0H@Z */
9073 DEFINE_THISCALL_WRAPPER(locale_ctor_locale_locale, 16)
9074 locale* __thiscall locale_ctor_locale_locale(locale *this, const locale *loc, const locale *other, category cat)
9076 _Locinfo locinfo;
9078 TRACE("(%p %p %p %d)\n", this, loc, other, cat);
9080 this->ptr = MSVCRT_operator_new(sizeof(locale__Locimp));
9081 if(!this->ptr) {
9082 ERR("Out of memory\n");
9083 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
9085 locale__Locimp_copy_ctor(this->ptr, loc->ptr);
9087 _Locinfo_ctor_cat_cstr(&locinfo, loc->ptr->catmask, MSVCP_basic_string_char_c_str(&loc->ptr->name));
9088 _Locinfo__Addcats(&locinfo, cat & other->ptr->catmask, MSVCP_basic_string_char_c_str(&other->ptr->name));
9089 locale__Locimp__Makeloc(&locinfo, cat, this->ptr, other);
9090 _Locinfo_dtor(&locinfo);
9092 return this;
9095 /* ??0locale@std@@QAE@ABV01@@Z */
9096 /* ??0locale@std@@QEAA@AEBV01@@Z */
9097 DEFINE_THISCALL_WRAPPER(locale_copy_ctor, 8)
9098 locale* __thiscall locale_copy_ctor(locale *this, const locale *copy)
9100 TRACE("(%p %p)\n", this, copy);
9101 this->ptr = copy->ptr;
9102 locale_facet__Incref(&this->ptr->facet);
9103 return this;
9106 /* ??0locale@std@@QAE@ABV01@PBDH@Z */
9107 /* ??0locale@std@@QEAA@AEBV01@PEBDH@Z */
9108 DEFINE_THISCALL_WRAPPER(locale_ctor_locale_cstr, 16)
9109 locale* __thiscall locale_ctor_locale_cstr(locale *this, const locale *loc, const char *locname, category cat)
9111 FIXME("(%p %p %s %d) stub\n", this, loc, locname, cat);
9112 return NULL;
9115 /* ??0locale@std@@QAE@PBDH@Z */
9116 /* ??0locale@std@@QEAA@PEBDH@Z */
9117 DEFINE_THISCALL_WRAPPER(locale_ctor_cstr, 12)
9118 locale* __thiscall locale_ctor_cstr(locale *this, const char *locname, category cat)
9120 _Locinfo locinfo;
9122 TRACE("(%p %s %d)\n", this, locname, cat);
9124 this->ptr = MSVCRT_operator_new(sizeof(locale__Locimp));
9125 if(!this->ptr) {
9126 ERR("Out of memory\n");
9127 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
9129 locale__Locimp_ctor(this->ptr);
9131 locale__Init();
9133 _Locinfo_ctor_cat_cstr(&locinfo, cat, locname);
9134 if(!memcmp(MSVCP_basic_string_char_c_str(&locinfo.newlocname), "*", 2)) {
9135 _Locinfo_dtor(&locinfo);
9136 MSVCRT_operator_delete(this->ptr);
9137 throw_exception(EXCEPTION_RUNTIME_ERROR, "bad locale name");
9140 locale__Locimp__Makeloc(&locinfo, cat, this->ptr, NULL);
9141 _Locinfo_dtor(&locinfo);
9143 return this;
9146 /* ??0locale@std@@QAE@W4_Uninitialized@1@@Z */
9147 /* ??0locale@std@@QEAA@W4_Uninitialized@1@@Z */
9148 DEFINE_THISCALL_WRAPPER(locale_ctor_uninitialized, 8)
9149 locale* __thiscall locale_ctor_uninitialized(locale *this, int uninitialized)
9151 TRACE("(%p)\n", this);
9152 this->ptr = NULL;
9153 return this;
9156 /* ??0locale@std@@QAE@XZ */
9157 /* ??0locale@std@@QEAA@XZ */
9158 DEFINE_THISCALL_WRAPPER(locale_ctor, 4)
9159 locale* __thiscall locale_ctor(locale *this)
9161 TRACE("(%p)\n", this);
9162 this->ptr = locale__Init();
9163 locale_facet__Incref(&this->ptr->facet);
9164 return this;
9167 /* ??1locale@std@@QAE@XZ */
9168 /* ??1locale@std@@QEAA@XZ */
9169 DEFINE_THISCALL_WRAPPER(locale_dtor, 4)
9170 void __thiscall locale_dtor(locale *this)
9172 TRACE("(%p)\n", this);
9173 if(this->ptr && locale_facet__Decref(&this->ptr->facet))
9175 locale__Locimp_dtor(this->ptr);
9176 MSVCRT_operator_delete(this->ptr);
9180 /* ??4locale@std@@QAEAAV01@ABV01@@Z */
9181 /* ??4locale@std@@QEAAAEAV01@AEBV01@@Z */
9182 DEFINE_THISCALL_WRAPPER(locale_operator_assign, 8)
9183 locale* __thiscall locale_operator_assign(locale *this, const locale *loc)
9185 FIXME("(%p %p) stub\n", this, loc);
9186 return NULL;
9189 /* ??8locale@std@@QBE_NABV01@@Z */
9190 /* ??8locale@std@@QEBA_NAEBV01@@Z */
9191 DEFINE_THISCALL_WRAPPER(locale_operator_equal, 8)
9192 MSVCP_bool __thiscall locale_operator_equal(const locale *this, const locale *loc)
9194 FIXME("(%p %p) stub\n", this, loc);
9195 return 0;
9198 /* ??9locale@std@@QBE_NABV01@@Z */
9199 /* ??9locale@std@@QEBA_NAEBV01@@Z */
9200 DEFINE_THISCALL_WRAPPER(locale_operator_not_equal, 8)
9201 MSVCP_bool __thiscall locale_operator_not_equal(const locale *this, locale const *loc)
9203 FIXME("(%p %p) stub\n", this, loc);
9204 return 0;
9207 /* ?_Addfac@locale@std@@QAEAAV12@PAVfacet@12@II@Z */
9208 /* ?_Addfac@locale@std@@QEAAAEAV12@PEAVfacet@12@_K1@Z */
9209 DEFINE_THISCALL_WRAPPER(locale__Addfac, 16)
9210 locale* __thiscall locale__Addfac(locale *this, locale_facet *facet, MSVCP_size_t id, MSVCP_size_t catmask)
9212 TRACE("(%p %p %lu %lu)\n", this, facet, id, catmask);
9214 if(this->ptr->facet.refs > 1) {
9215 locale__Locimp *new_ptr = MSVCRT_operator_new(sizeof(locale__Locimp));
9216 if(!new_ptr) {
9217 ERR("Out of memory\n");
9218 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
9219 return NULL;
9221 locale__Locimp_copy_ctor(new_ptr, this->ptr);
9222 locale_facet__Decref(&this->ptr->facet);
9223 this->ptr = new_ptr;
9226 locale__Locimp__Addfac(this->ptr, facet, id);
9228 if(catmask) {
9229 MSVCP_basic_string_char_dtor(&this->ptr->name);
9230 MSVCP_basic_string_char_ctor_cstr(&this->ptr->name, "*");
9232 return this;
9235 /* ?_Getfacet@locale@std@@QBEPBVfacet@12@I@Z */
9236 /* ?_Getfacet@locale@std@@QEBAPEBVfacet@12@_K@Z */
9237 DEFINE_THISCALL_WRAPPER(locale__Getfacet, 8)
9238 const locale_facet* __thiscall locale__Getfacet(const locale *this, MSVCP_size_t id)
9240 locale_facet *fac;
9242 TRACE("(%p %lu)\n", this, id);
9244 fac = id < this->ptr->facet_cnt ? this->ptr->facetvec[id] : NULL;
9245 if(fac || !this->ptr->transparent)
9246 return fac;
9248 return id < global_locale->facet_cnt ? global_locale->facetvec[id] : NULL;
9251 /* ?_Getgloballocale@locale@std@@CAPAV_Locimp@12@XZ */
9252 /* ?_Getgloballocale@locale@std@@CAPEAV_Locimp@12@XZ */
9253 locale__Locimp* __cdecl locale__Getgloballocale(void)
9255 TRACE("\n");
9256 return global_locale;
9259 /* ?_Setgloballocale@locale@std@@CAXPAX@Z */
9260 /* ?_Setgloballocale@locale@std@@CAXPEAX@Z */
9261 void __cdecl locale__Setgloballocale(void *locimp)
9263 TRACE("(%p)\n", locimp);
9264 global_locale = locimp;
9267 /* ?classic@locale@std@@SAABV12@XZ */
9268 /* ?classic@locale@std@@SAAEBV12@XZ */
9269 const locale* __cdecl locale_classic(void)
9271 TRACE("\n");
9272 locale__Init();
9273 return &classic_locale;
9276 /* ?empty@locale@std@@SA?AV12@XZ */
9277 locale* __cdecl locale_empty(locale *ret)
9279 TRACE("\n");
9281 locale__Init();
9283 ret->ptr = MSVCRT_operator_new(sizeof(locale__Locimp));
9284 if(!ret->ptr) {
9285 ERR("Out of memory\n");
9286 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
9288 locale__Locimp_ctor_transparent(ret->ptr, TRUE);
9289 return ret;
9292 /* ?name@locale@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
9293 /* ?name@locale@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
9294 DEFINE_THISCALL_WRAPPER(locale_name, 8)
9295 basic_string_char* __thiscall locale_name(const locale *this, basic_string_char *ret)
9297 TRACE( "(%p)\n", this);
9298 MSVCP_basic_string_char_copy_ctor(ret, &this->ptr->name);
9299 return ret;
9302 /* ?global@locale@std@@SA?AV12@ABV12@@Z */
9303 /* ?global@locale@std@@SA?AV12@AEBV12@@Z */
9304 locale* __cdecl locale_global(locale *ret, const locale *loc)
9306 _Lockit lock;
9307 int i;
9309 TRACE("(%p %p)\n", loc, ret);
9311 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
9312 locale_ctor(ret);
9314 if(loc->ptr != global_locale) {
9315 locale_facet__Decref(&global_locale->facet);
9316 global_locale = loc->ptr;
9317 locale_facet__Incref(&global_locale->facet);
9319 for(i=LC_ALL+1; i<=LC_MAX; i++) {
9320 if((global_locale->catmask & (1<<(i-1))) == 0)
9321 continue;
9322 setlocale(i, MSVCP_basic_string_char_c_str(&global_locale->name));
9325 _Lockit_dtor(&lock);
9326 return ret;
9329 /* wctrans */
9330 wctrans_t __cdecl wctrans(const char *property)
9332 static const char str_tolower[] = "tolower";
9333 static const char str_toupper[] = "toupper";
9335 if(!strcmp(property, str_tolower))
9336 return 2;
9337 if(!strcmp(property, str_toupper))
9338 return 1;
9339 return 0;
9342 /* towctrans */
9343 wint_t __cdecl towctrans(wint_t c, wctrans_t category)
9345 if(category == 1)
9346 return towupper(c);
9347 return towlower(c);
9350 DEFINE_RTTI_DATA0(locale_facet, 0, ".?AVfacet@locale@std@@")
9351 DEFINE_RTTI_DATA1(collate_char, 0, &locale_facet_rtti_base_descriptor, ".?AV?$collate@D@std@@")
9352 DEFINE_RTTI_DATA1(collate_wchar, 0, &locale_facet_rtti_base_descriptor, ".?AV?$collate@_W@std@@")
9353 DEFINE_RTTI_DATA1(collate_short, 0, &locale_facet_rtti_base_descriptor, ".?AV?$collate@G@std@@")
9354 DEFINE_RTTI_DATA1(ctype_base, 0, &locale_facet_rtti_base_descriptor, ".?AUctype_base@std@@")
9355 DEFINE_RTTI_DATA2(ctype_char, 0, &ctype_base_rtti_base_descriptor, &locale_facet_rtti_base_descriptor, ".?AV?$ctype@D@std@@")
9356 DEFINE_RTTI_DATA2(ctype_wchar, 0, &ctype_base_rtti_base_descriptor, &locale_facet_rtti_base_descriptor, ".?AV?$ctype@_W@std@@")
9357 DEFINE_RTTI_DATA2(ctype_short, 0, &ctype_base_rtti_base_descriptor, &locale_facet_rtti_base_descriptor, ".?AV?$ctype@G@std@@")
9358 DEFINE_RTTI_DATA1(codecvt_base, 0, &locale_facet_rtti_base_descriptor, ".?AVcodecvt_base@std@@")
9359 DEFINE_RTTI_DATA2(codecvt_char, 0, &codecvt_base_rtti_base_descriptor, &locale_facet_rtti_base_descriptor, ".?AV?$codecvt@DDH@std@@")
9360 DEFINE_RTTI_DATA2(codecvt_wchar, 0, &codecvt_base_rtti_base_descriptor, &locale_facet_rtti_base_descriptor, ".?AV?$codecvt@_WDH@std@@")
9361 DEFINE_RTTI_DATA2(codecvt_short, 0, &codecvt_base_rtti_base_descriptor, &locale_facet_rtti_base_descriptor, ".?AV?$codecvt@GDH@std@@")
9362 DEFINE_RTTI_DATA1(numpunct_char, 0, &locale_facet_rtti_base_descriptor, ".?AV?$numpunct@D@std@@")
9363 DEFINE_RTTI_DATA1(numpunct_wchar, 0, &locale_facet_rtti_base_descriptor, ".?AV?$numpunct@_W@std@@")
9364 DEFINE_RTTI_DATA1(numpunct_short, 0, &locale_facet_rtti_base_descriptor, ".?AV?$numpunct@G@std@@")
9365 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@@")
9366 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@@")
9367 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@@")
9368 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@@")
9369 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@@")
9370 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@@")
9371 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@@")
9372 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@@")
9373 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@@")
9375 #ifndef __GNUC__
9376 void __asm_dummy_vtables(void) {
9377 #endif
9378 __ASM_VTABLE(locale_facet,
9379 VTABLE_ADD_FUNC(locale_facet_vector_dtor));
9380 __ASM_VTABLE(collate_char,
9381 VTABLE_ADD_FUNC(collate_char_vector_dtor)
9382 VTABLE_ADD_FUNC(collate_char_do_compare)
9383 VTABLE_ADD_FUNC(collate_char_do_transform)
9384 VTABLE_ADD_FUNC(collate_char_do_hash));
9385 __ASM_VTABLE(collate_wchar,
9386 VTABLE_ADD_FUNC(collate_wchar_vector_dtor)
9387 VTABLE_ADD_FUNC(collate_wchar_do_compare)
9388 VTABLE_ADD_FUNC(collate_wchar_do_transform)
9389 VTABLE_ADD_FUNC(collate_wchar_do_hash));
9390 __ASM_VTABLE(collate_short,
9391 VTABLE_ADD_FUNC(collate_wchar_vector_dtor)
9392 VTABLE_ADD_FUNC(collate_wchar_do_compare)
9393 VTABLE_ADD_FUNC(collate_wchar_do_transform)
9394 VTABLE_ADD_FUNC(collate_wchar_do_hash));
9395 __ASM_VTABLE(ctype_base,
9396 VTABLE_ADD_FUNC(ctype_base_vector_dtor));
9397 __ASM_VTABLE(ctype_char,
9398 VTABLE_ADD_FUNC(ctype_char_vector_dtor)
9399 VTABLE_ADD_FUNC(ctype_char_do_tolower)
9400 VTABLE_ADD_FUNC(ctype_char_do_tolower_ch)
9401 VTABLE_ADD_FUNC(ctype_char_do_toupper)
9402 VTABLE_ADD_FUNC(ctype_char_do_toupper_ch)
9403 VTABLE_ADD_FUNC(ctype_char_do_widen)
9404 VTABLE_ADD_FUNC(ctype_char_do_widen_ch)
9405 VTABLE_ADD_FUNC(ctype_char__Do_widen_s)
9406 VTABLE_ADD_FUNC(ctype_char_do_narrow)
9407 VTABLE_ADD_FUNC(ctype_char_do_narrow_ch)
9408 VTABLE_ADD_FUNC(ctype_char__Do_narrow_s));
9409 __ASM_VTABLE(ctype_wchar,
9410 VTABLE_ADD_FUNC(ctype_wchar_vector_dtor)
9411 VTABLE_ADD_FUNC(ctype_wchar_do_is)
9412 VTABLE_ADD_FUNC(ctype_wchar_do_is_ch)
9413 VTABLE_ADD_FUNC(ctype_wchar_do_scan_is)
9414 VTABLE_ADD_FUNC(ctype_wchar_do_scan_not)
9415 VTABLE_ADD_FUNC(ctype_wchar_do_tolower)
9416 VTABLE_ADD_FUNC(ctype_wchar_do_tolower_ch)
9417 VTABLE_ADD_FUNC(ctype_wchar_do_toupper)
9418 VTABLE_ADD_FUNC(ctype_wchar_do_toupper_ch)
9419 VTABLE_ADD_FUNC(ctype_wchar_do_widen)
9420 VTABLE_ADD_FUNC(ctype_wchar_do_widen_ch)
9421 VTABLE_ADD_FUNC(ctype_wchar__Do_widen_s)
9422 VTABLE_ADD_FUNC(ctype_wchar_do_narrow)
9423 VTABLE_ADD_FUNC(ctype_wchar_do_narrow_ch)
9424 VTABLE_ADD_FUNC(ctype_wchar__Do_narrow_s));
9425 __ASM_VTABLE(ctype_short,
9426 VTABLE_ADD_FUNC(ctype_wchar_vector_dtor)
9427 VTABLE_ADD_FUNC(ctype_wchar_do_is)
9428 VTABLE_ADD_FUNC(ctype_wchar_do_is_ch)
9429 VTABLE_ADD_FUNC(ctype_wchar_do_scan_is)
9430 VTABLE_ADD_FUNC(ctype_wchar_do_scan_not)
9431 VTABLE_ADD_FUNC(ctype_wchar_do_tolower)
9432 VTABLE_ADD_FUNC(ctype_wchar_do_tolower_ch)
9433 VTABLE_ADD_FUNC(ctype_wchar_do_toupper)
9434 VTABLE_ADD_FUNC(ctype_wchar_do_toupper_ch)
9435 VTABLE_ADD_FUNC(ctype_wchar_do_widen)
9436 VTABLE_ADD_FUNC(ctype_wchar_do_widen_ch)
9437 VTABLE_ADD_FUNC(ctype_wchar__Do_widen_s)
9438 VTABLE_ADD_FUNC(ctype_wchar_do_narrow)
9439 VTABLE_ADD_FUNC(ctype_wchar_do_narrow_ch)
9440 VTABLE_ADD_FUNC(ctype_wchar__Do_narrow_s));
9441 __ASM_VTABLE(codecvt_base,
9442 VTABLE_ADD_FUNC(codecvt_base_vector_dtor)
9443 VTABLE_ADD_FUNC(codecvt_base_do_always_noconv)
9444 VTABLE_ADD_FUNC(codecvt_base_do_max_length)
9445 VTABLE_ADD_FUNC(codecvt_base_do_encoding));
9446 __ASM_VTABLE(codecvt_char,
9447 VTABLE_ADD_FUNC(codecvt_char_vector_dtor)
9448 VTABLE_ADD_FUNC(codecvt_base_do_always_noconv)
9449 VTABLE_ADD_FUNC(codecvt_base_do_max_length)
9450 VTABLE_ADD_FUNC(codecvt_base_do_encoding)
9451 VTABLE_ADD_FUNC(codecvt_char_do_in)
9452 VTABLE_ADD_FUNC(codecvt_char_do_out)
9453 VTABLE_ADD_FUNC(codecvt_char_do_unshift)
9454 VTABLE_ADD_FUNC(codecvt_char_do_length));
9455 __ASM_VTABLE(codecvt_wchar,
9456 VTABLE_ADD_FUNC(codecvt_wchar_vector_dtor)
9457 VTABLE_ADD_FUNC(codecvt_wchar_do_always_noconv)
9458 VTABLE_ADD_FUNC(codecvt_wchar_do_max_length)
9459 VTABLE_ADD_FUNC(codecvt_base_do_encoding)
9460 VTABLE_ADD_FUNC(codecvt_wchar_do_in)
9461 VTABLE_ADD_FUNC(codecvt_wchar_do_out)
9462 VTABLE_ADD_FUNC(codecvt_wchar_do_unshift)
9463 VTABLE_ADD_FUNC(codecvt_wchar_do_length));
9464 __ASM_VTABLE(codecvt_short,
9465 VTABLE_ADD_FUNC(codecvt_wchar_vector_dtor)
9466 VTABLE_ADD_FUNC(codecvt_wchar_do_always_noconv)
9467 VTABLE_ADD_FUNC(codecvt_wchar_do_max_length)
9468 VTABLE_ADD_FUNC(codecvt_base_do_encoding)
9469 VTABLE_ADD_FUNC(codecvt_wchar_do_in)
9470 VTABLE_ADD_FUNC(codecvt_wchar_do_out)
9471 VTABLE_ADD_FUNC(codecvt_wchar_do_unshift)
9472 VTABLE_ADD_FUNC(codecvt_wchar_do_length));
9473 __ASM_VTABLE(numpunct_char,
9474 VTABLE_ADD_FUNC(numpunct_char_vector_dtor)
9475 VTABLE_ADD_FUNC(numpunct_char_do_decimal_point)
9476 VTABLE_ADD_FUNC(numpunct_char_do_thousands_sep)
9477 VTABLE_ADD_FUNC(numpunct_char_do_grouping)
9478 VTABLE_ADD_FUNC(numpunct_char_do_falsename)
9479 VTABLE_ADD_FUNC(numpunct_char_do_truename));
9480 __ASM_VTABLE(numpunct_wchar,
9481 VTABLE_ADD_FUNC(numpunct_wchar_vector_dtor)
9482 VTABLE_ADD_FUNC(numpunct_wchar_do_decimal_point)
9483 VTABLE_ADD_FUNC(numpunct_wchar_do_thousands_sep)
9484 VTABLE_ADD_FUNC(numpunct_wchar_do_grouping)
9485 VTABLE_ADD_FUNC(numpunct_wchar_do_falsename)
9486 VTABLE_ADD_FUNC(numpunct_wchar_do_truename));
9487 __ASM_VTABLE(numpunct_short,
9488 VTABLE_ADD_FUNC(numpunct_wchar_vector_dtor)
9489 VTABLE_ADD_FUNC(numpunct_wchar_do_decimal_point)
9490 VTABLE_ADD_FUNC(numpunct_wchar_do_thousands_sep)
9491 VTABLE_ADD_FUNC(numpunct_wchar_do_grouping)
9492 VTABLE_ADD_FUNC(numpunct_wchar_do_falsename)
9493 VTABLE_ADD_FUNC(numpunct_wchar_do_truename));
9494 __ASM_VTABLE(num_get_char,
9495 VTABLE_ADD_FUNC(num_get_char_vector_dtor)
9496 VTABLE_ADD_FUNC(num_get_char_do_get_void)
9497 VTABLE_ADD_FUNC(num_get_char_do_get_double)
9498 VTABLE_ADD_FUNC(num_get_char_do_get_double)
9499 VTABLE_ADD_FUNC(num_get_char_do_get_float)
9500 VTABLE_ADD_FUNC(num_get_char_do_get_uint64)
9501 VTABLE_ADD_FUNC(num_get_char_do_get_int64)
9502 VTABLE_ADD_FUNC(num_get_char_do_get_ulong)
9503 VTABLE_ADD_FUNC(num_get_char_do_get_long)
9504 VTABLE_ADD_FUNC(num_get_char_do_get_uint)
9505 VTABLE_ADD_FUNC(num_get_char_do_get_ushort)
9506 VTABLE_ADD_FUNC(num_get_char_do_get_bool));
9507 __ASM_VTABLE(num_get_short,
9508 VTABLE_ADD_FUNC(num_get_wchar_vector_dtor)
9509 VTABLE_ADD_FUNC(num_get_short_do_get_void)
9510 VTABLE_ADD_FUNC(num_get_short_do_get_double)
9511 VTABLE_ADD_FUNC(num_get_short_do_get_double)
9512 VTABLE_ADD_FUNC(num_get_short_do_get_float)
9513 VTABLE_ADD_FUNC(num_get_short_do_get_uint64)
9514 VTABLE_ADD_FUNC(num_get_short_do_get_int64)
9515 VTABLE_ADD_FUNC(num_get_short_do_get_ulong)
9516 VTABLE_ADD_FUNC(num_get_short_do_get_long)
9517 VTABLE_ADD_FUNC(num_get_short_do_get_uint)
9518 VTABLE_ADD_FUNC(num_get_short_do_get_ushort)
9519 VTABLE_ADD_FUNC(num_get_short_do_get_bool));
9520 __ASM_VTABLE(num_get_wchar,
9521 VTABLE_ADD_FUNC(num_get_wchar_vector_dtor)
9522 VTABLE_ADD_FUNC(num_get_wchar_do_get_void)
9523 VTABLE_ADD_FUNC(num_get_wchar_do_get_double)
9524 VTABLE_ADD_FUNC(num_get_wchar_do_get_double)
9525 VTABLE_ADD_FUNC(num_get_wchar_do_get_float)
9526 VTABLE_ADD_FUNC(num_get_wchar_do_get_uint64)
9527 VTABLE_ADD_FUNC(num_get_wchar_do_get_int64)
9528 VTABLE_ADD_FUNC(num_get_wchar_do_get_ulong)
9529 VTABLE_ADD_FUNC(num_get_wchar_do_get_long)
9530 VTABLE_ADD_FUNC(num_get_wchar_do_get_uint)
9531 VTABLE_ADD_FUNC(num_get_wchar_do_get_ushort)
9532 VTABLE_ADD_FUNC(num_get_wchar_do_get_bool));
9533 __ASM_VTABLE(num_put_char,
9534 VTABLE_ADD_FUNC(num_put_char_vector_dtor)
9535 VTABLE_ADD_FUNC(num_put_char_do_put_ptr)
9536 VTABLE_ADD_FUNC(num_put_char_do_put_double)
9537 VTABLE_ADD_FUNC(num_put_char_do_put_double)
9538 VTABLE_ADD_FUNC(num_put_char_do_put_uint64)
9539 VTABLE_ADD_FUNC(num_put_char_do_put_int64)
9540 VTABLE_ADD_FUNC(num_put_char_do_put_ulong)
9541 VTABLE_ADD_FUNC(num_put_char_do_put_long)
9542 VTABLE_ADD_FUNC(num_put_char_do_put_bool));
9543 __ASM_VTABLE(num_put_wchar,
9544 VTABLE_ADD_FUNC(num_put_wchar_vector_dtor)
9545 VTABLE_ADD_FUNC(num_put_wchar_do_put_ptr)
9546 VTABLE_ADD_FUNC(num_put_wchar_do_put_double)
9547 VTABLE_ADD_FUNC(num_put_wchar_do_put_double)
9548 VTABLE_ADD_FUNC(num_put_wchar_do_put_uint64)
9549 VTABLE_ADD_FUNC(num_put_wchar_do_put_int64)
9550 VTABLE_ADD_FUNC(num_put_wchar_do_put_ulong)
9551 VTABLE_ADD_FUNC(num_put_wchar_do_put_long)
9552 VTABLE_ADD_FUNC(num_put_wchar_do_put_bool));
9553 __ASM_VTABLE(num_put_short,
9554 VTABLE_ADD_FUNC(num_put_wchar_vector_dtor)
9555 VTABLE_ADD_FUNC(num_put_short_do_put_ptr)
9556 VTABLE_ADD_FUNC(num_put_short_do_put_double)
9557 VTABLE_ADD_FUNC(num_put_short_do_put_double)
9558 VTABLE_ADD_FUNC(num_put_short_do_put_uint64)
9559 VTABLE_ADD_FUNC(num_put_short_do_put_int64)
9560 VTABLE_ADD_FUNC(num_put_short_do_put_ulong)
9561 VTABLE_ADD_FUNC(num_put_short_do_put_long)
9562 VTABLE_ADD_FUNC(num_put_short_do_put_bool));
9563 __ASM_VTABLE(time_put_char,
9564 VTABLE_ADD_FUNC(time_put_char_vector_dtor)
9565 VTABLE_ADD_FUNC(time_put_char_do_put));
9566 __ASM_VTABLE(time_put_wchar,
9567 VTABLE_ADD_FUNC(time_put_wchar_vector_dtor)
9568 VTABLE_ADD_FUNC(time_put_wchar_do_put));
9569 __ASM_VTABLE(time_put_short,
9570 VTABLE_ADD_FUNC(time_put_wchar_vector_dtor)
9571 VTABLE_ADD_FUNC(time_put_wchar_do_put));
9572 #ifndef __GNUC__
9574 #endif
9576 void init_locale(void *base)
9578 #ifdef __x86_64__
9579 init_locale_facet_rtti(base);
9580 init_collate_char_rtti(base);
9581 init_collate_wchar_rtti(base);
9582 init_collate_short_rtti(base);
9583 init_ctype_base_rtti(base);
9584 init_ctype_char_rtti(base);
9585 init_ctype_wchar_rtti(base);
9586 init_ctype_short_rtti(base);
9587 init_codecvt_base_rtti(base);
9588 init_codecvt_char_rtti(base);
9589 init_codecvt_wchar_rtti(base);
9590 init_codecvt_short_rtti(base);
9591 init_numpunct_char_rtti(base);
9592 init_numpunct_wchar_rtti(base);
9593 init_numpunct_short_rtti(base);
9594 init_num_get_char_rtti(base);
9595 init_num_get_wchar_rtti(base);
9596 init_num_get_short_rtti(base);
9597 init_num_put_char_rtti(base);
9598 init_num_put_wchar_rtti(base);
9599 init_num_put_short_rtti(base);
9600 init_time_put_char_rtti(base);
9601 init_time_put_wchar_rtti(base);
9602 init_time_put_short_rtti(base);
9603 #endif
9606 void free_locale(void)
9608 facets_elem *iter, *safe;
9610 if(global_locale) {
9611 locale__Locimp_dtor(global_locale);
9612 locale_dtor(&classic_locale);
9615 LIST_FOR_EACH_ENTRY_SAFE(iter, safe, &lazy_facets, facets_elem, entry) {
9616 list_remove(&iter->entry);
9617 if(locale_facet__Decref(iter->fac))
9618 call_locale_facet_vector_dtor(iter->fac, 1);
9619 MSVCRT_operator_delete(iter);