odbccp32: Add ordinals to spec file.
[wine.git] / dlls / msvcp90 / locale.c
blob606d6ca85102355b0b7110671c400ce60bf0e10f
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 "locale.h"
24 #include "errno.h"
25 #include "limits.h"
26 #include "math.h"
27 #include "stdio.h"
28 #include "wchar.h"
29 #include "wctype.h"
30 #include "time.h"
31 #include "windef.h"
32 #include "winbase.h"
33 #include "winnls.h"
34 #include "msvcp90.h"
35 #include "wine/unicode.h"
36 #include "wine/list.h"
37 #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 int __cdecl ___lc_collate_cp_func(void);
46 const unsigned short* __cdecl __pctype_func(void);
47 const locale_facet* __thiscall locale__Getfacet(const locale*, MSVCP_size_t);
48 MSVCP_size_t __cdecl _Strftime(char*, MSVCP_size_t, const char*,
49 const struct tm*, struct __lc_time_data*);
50 const locale* __cdecl locale_classic(void);
52 #if _MSVCP_VER >= 110
53 static LCID* ___lc_handle_func(void)
55 LCID *ret;
57 _locale_t loc = _get_current_locale();
58 ret = loc->locinfo->lc_handle;
59 _free_locale(loc);
60 return ret;
62 #else
63 LCID* __cdecl ___lc_handle_func(void);
64 #endif
66 #if _MSVCP_VER < 100
67 #define locale_string basic_string_char
68 #define locale_string_char_ctor_cstr(this,str) MSVCP_basic_string_char_ctor_cstr(this,str)
69 #define locale_string_char_copy_ctor(this,copy) MSVCP_basic_string_char_copy_ctor(this,copy)
70 #define locale_string_char_dtor(this) MSVCP_basic_string_char_dtor(this)
71 #define locale_string_char_c_str(this) MSVCP_basic_string_char_c_str(this)
72 #define locale_string_char_assign(this,assign) MSVCP_basic_string_char_assign(this,assign)
73 #else
74 #define locale_string _Yarn_char
75 #define locale_string_char_ctor_cstr(this,str) _Yarn_char_ctor_cstr(this,str)
76 #define locale_string_char_copy_ctor(this,copy) _Yarn_char_copy_ctor(this,copy)
77 #define locale_string_char_dtor(this) _Yarn_char_dtor(this)
78 #define locale_string_char_c_str(this) _Yarn_char_c_str(this)
79 #define locale_string_char_assign(this,assign) _Yarn_char_op_assign(this,assign)
80 #endif
82 typedef int category;
84 typedef struct {
85 MSVCP_size_t id;
86 } locale_id;
88 typedef struct _locale__Locimp {
89 locale_facet facet;
90 locale_facet **facetvec;
91 MSVCP_size_t facet_cnt;
92 category catmask;
93 MSVCP_bool transparent;
94 locale_string name;
95 } locale__Locimp;
97 typedef struct {
98 void *timeptr;
99 } _Timevec;
101 typedef struct {
102 _Lockit lock;
103 locale_string days;
104 locale_string months;
105 locale_string oldlocname;
106 locale_string newlocname;
107 } _Locinfo;
109 typedef struct {
110 LCID handle;
111 unsigned page;
112 } _Collvec;
114 typedef struct {
115 locale_facet facet;
116 _Collvec coll;
117 } collate;
119 typedef struct {
120 locale_facet facet;
121 const char *grouping;
122 char dp;
123 char sep;
124 const char *false_name;
125 const char *true_name;
126 } numpunct_char;
128 typedef struct {
129 locale_facet facet;
130 const char *grouping;
131 wchar_t dp;
132 wchar_t sep;
133 const wchar_t *false_name;
134 const wchar_t *true_name;
135 } numpunct_wchar;
137 typedef struct {
138 locale_facet facet;
139 _Timevec time;
140 _Cvtvec cvt;
141 } time_put;
143 /* ?_Id_cnt@id@locale@std@@0HA */
144 int locale_id__Id_cnt = 0;
146 static locale__Locimp *global_locale;
147 static locale classic_locale;
149 /* ?_Clocptr@_Locimp@locale@std@@0PAV123@A */
150 /* ?_Clocptr@_Locimp@locale@std@@0PEAV123@EA */
151 locale__Locimp *locale__Locimp__Clocptr = NULL;
153 static char istreambuf_iterator_char_val(istreambuf_iterator_char *this)
155 if(this->strbuf && !this->got) {
156 int c = basic_streambuf_char_sgetc(this->strbuf);
157 if(c == EOF)
158 this->strbuf = NULL;
159 else
160 this->val = c;
163 this->got = TRUE;
164 return this->val;
167 static wchar_t istreambuf_iterator_wchar_val(istreambuf_iterator_wchar *this)
169 if(this->strbuf && !this->got) {
170 unsigned short c = basic_streambuf_wchar_sgetc(this->strbuf);
171 if(c == WEOF)
172 this->strbuf = NULL;
173 else
174 this->val = c;
177 this->got = TRUE;
178 return this->val;
181 static void istreambuf_iterator_char_inc(istreambuf_iterator_char *this)
183 if(!this->strbuf || basic_streambuf_char_sbumpc(this->strbuf)==EOF) {
184 this->strbuf = NULL;
185 this->got = TRUE;
186 }else {
187 this->got = FALSE;
188 istreambuf_iterator_char_val(this);
192 static void istreambuf_iterator_wchar_inc(istreambuf_iterator_wchar *this)
194 if(!this->strbuf || basic_streambuf_wchar_sbumpc(this->strbuf)==WEOF) {
195 this->strbuf = NULL;
196 this->got = TRUE;
197 }else {
198 this->got = FALSE;
199 istreambuf_iterator_wchar_val(this);
203 static void ostreambuf_iterator_char_put(ostreambuf_iterator_char *this, char ch)
205 if(this->failed || basic_streambuf_char_sputc(this->strbuf, ch)==EOF)
206 this->failed = TRUE;
209 static void ostreambuf_iterator_wchar_put(ostreambuf_iterator_wchar *this, wchar_t ch)
211 if(this->failed || basic_streambuf_wchar_sputc(this->strbuf, ch)==WEOF)
212 this->failed = TRUE;
215 /* ??1facet@locale@std@@UAE@XZ */
216 /* ??1facet@locale@std@@UEAA@XZ */
217 DEFINE_THISCALL_WRAPPER(locale_facet_dtor, 4)
218 void __thiscall locale_facet_dtor(locale_facet *this)
220 TRACE("(%p)\n", this);
223 DEFINE_THISCALL_WRAPPER(locale_facet_vector_dtor, 8)
224 #define call_locale_facet_vector_dtor(this, flags) CALL_VTBL_FUNC(this, 0, \
225 locale_facet*, (locale_facet*, unsigned int), (this, flags))
226 locale_facet* __thiscall locale_facet_vector_dtor(locale_facet *this, unsigned int flags)
228 TRACE("(%p %x)\n", this, flags);
229 if(flags & 2) {
230 /* we have an array, with the number of elements stored before the first object */
231 INT_PTR i, *ptr = (INT_PTR *)this-1;
233 for(i=*ptr-1; i>=0; i--)
234 locale_facet_dtor(this+i);
235 MSVCRT_operator_delete(ptr);
236 } else {
237 locale_facet_dtor(this);
238 if(flags & 1)
239 MSVCRT_operator_delete(this);
242 return this;
245 typedef struct
247 locale_facet *fac;
248 struct list entry;
249 } facets_elem;
250 static struct list lazy_facets = LIST_INIT(lazy_facets);
252 /* Not exported from msvcp90 */
253 /* ?facet_Register@facet@locale@std@@CAXPAV123@@Z */
254 /* ?facet_Register@facet@locale@std@@CAXPEAV123@@Z */
255 void __cdecl locale_facet_register(locale_facet *add)
257 facets_elem *head = MSVCRT_operator_new(sizeof(*head));
258 if(!head) {
259 ERR("Out of memory\n");
260 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
263 head->fac = add;
264 list_add_head(&lazy_facets, &head->entry);
267 /* Not exported from msvcp90 */
268 /* ?_Register@facet@locale@std@@QAEXXZ */
269 /* ?_Register@facet@locale@std@@QEAAXXZ */
270 DEFINE_THISCALL_WRAPPER(locale_facet__Register, 4)
271 void __thiscall locale_facet__Register(locale_facet *this)
273 TRACE("(%p)\n", this);
274 locale_facet_register(this);
277 /* Not exported from msvcp90 */
278 /* ??_7facet@locale@std@@6B@ */
279 extern const vtable_ptr MSVCP_locale_facet_vtable;
281 /* ??0id@locale@std@@QAE@I@Z */
282 /* ??0id@locale@std@@QEAA@_K@Z */
283 DEFINE_THISCALL_WRAPPER(locale_id_ctor_id, 8)
284 locale_id* __thiscall locale_id_ctor_id(locale_id *this, MSVCP_size_t id)
286 TRACE("(%p %lu)\n", this, id);
288 this->id = id;
289 return this;
292 /* ??_Fid@locale@std@@QAEXXZ */
293 /* ??_Fid@locale@std@@QEAAXXZ */
294 DEFINE_THISCALL_WRAPPER(locale_id_ctor, 4)
295 locale_id* __thiscall locale_id_ctor(locale_id *this)
297 TRACE("(%p)\n", this);
299 this->id = 0;
300 return this;
303 /* ??Bid@locale@std@@QAEIXZ */
304 /* ??Bid@locale@std@@QEAA_KXZ */
305 DEFINE_THISCALL_WRAPPER(locale_id_operator_size_t, 4)
306 MSVCP_size_t __thiscall locale_id_operator_size_t(locale_id *this)
308 _Lockit lock;
310 TRACE("(%p)\n", this);
312 if(!this->id) {
313 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
314 this->id = ++locale_id__Id_cnt;
315 _Lockit_dtor(&lock);
318 return this->id;
321 /* ?_Id_cnt_func@id@locale@std@@CAAAHXZ */
322 /* ?_Id_cnt_func@id@locale@std@@CAAEAHXZ */
323 int* __cdecl locale_id__Id_cnt_func(void)
325 TRACE("\n");
326 return &locale_id__Id_cnt;
329 /* ??_Ffacet@locale@std@@QAEXXZ */
330 /* ??_Ffacet@locale@std@@QEAAXXZ */
331 DEFINE_THISCALL_WRAPPER(locale_facet_ctor, 4)
332 locale_facet* __thiscall locale_facet_ctor(locale_facet *this)
334 TRACE("(%p)\n", this);
335 this->vtable = &MSVCP_locale_facet_vtable;
336 this->refs = 0;
337 return this;
340 /* ??0facet@locale@std@@IAE@I@Z */
341 /* ??0facet@locale@std@@IEAA@_K@Z */
342 DEFINE_THISCALL_WRAPPER(locale_facet_ctor_refs, 8)
343 locale_facet* __thiscall locale_facet_ctor_refs(locale_facet *this, MSVCP_size_t refs)
345 TRACE("(%p %lu)\n", this, refs);
346 this->vtable = &MSVCP_locale_facet_vtable;
347 this->refs = refs;
348 return this;
351 /* ?_Incref@facet@locale@std@@QAEXXZ */
352 /* ?_Incref@facet@locale@std@@QEAAXXZ */
353 /* ?_Incref@facet@locale@std@@UAEXXZ */
354 /* ?_Incref@facet@locale@std@@UEAAXXZ */
355 #if _MSVCP_VER >= 110
356 #define call_locale_facet__Incref(this) CALL_VTBL_FUNC(this, 4, void, (locale_facet*), (this))
357 #else
358 #define call_locale_facet__Incref locale_facet__Incref
359 #endif
360 DEFINE_THISCALL_WRAPPER(locale_facet__Incref, 4)
361 void __thiscall locale_facet__Incref(locale_facet *this)
363 _Lockit lock;
365 TRACE("(%p)\n", this);
367 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
368 this->refs++;
369 _Lockit_dtor(&lock);
372 /* ?_Decref@facet@locale@std@@QAEPAV123@XZ */
373 /* ?_Decref@facet@locale@std@@QEAAPEAV123@XZ */
374 /* ?_Decref@facet@locale@std@@UAEPAV_Facet_base@3@XZ */
375 /* ?_Decref@facet@locale@std@@UEAAPEAV_Facet_base@3@XZ */
376 #if _MSVCP_VER >= 110
377 #define call_locale_facet__Decref(this) CALL_VTBL_FUNC(this, 8, \
378 locale_facet*, (locale_facet*), (this))
379 #else
380 #define call_locale_facet__Decref locale_facet__Decref
381 #endif
382 DEFINE_THISCALL_WRAPPER(locale_facet__Decref, 4)
383 locale_facet* __thiscall locale_facet__Decref(locale_facet *this)
385 _Lockit lock;
386 locale_facet *ret;
388 TRACE("(%p)\n", this);
390 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
391 if(this->refs)
392 this->refs--;
394 ret = this->refs ? NULL : this;
395 _Lockit_dtor(&lock);
397 return ret;
400 /* ?_Getcat@facet@locale@std@@SAIPAPBV123@PBV23@@Z */
401 /* ?_Getcat@facet@locale@std@@SA_KPEAPEBV123@PEBV23@@Z */
402 MSVCP_size_t __cdecl locale_facet__Getcat(const locale_facet **facet, const locale *loc)
404 TRACE("(%p %p)\n", facet, loc);
405 return -1;
408 /* ??0_Timevec@std@@QAE@ABV01@@Z */
409 /* ??0_Timevec@std@@QEAA@AEBV01@@Z */
410 /* This copy constructor modifies copied object */
411 DEFINE_THISCALL_WRAPPER(_Timevec_copy_ctor, 8)
412 _Timevec* __thiscall _Timevec_copy_ctor(_Timevec *this, _Timevec *copy)
414 TRACE("(%p %p)\n", this, copy);
415 this->timeptr = copy->timeptr;
416 copy->timeptr = NULL;
417 return this;
420 /* ??0_Timevec@std@@QAE@PAX@Z */
421 /* ??0_Timevec@std@@QEAA@PEAX@Z */
422 DEFINE_THISCALL_WRAPPER(_Timevec_ctor_timeptr, 8)
423 _Timevec* __thiscall _Timevec_ctor_timeptr(_Timevec *this, void *timeptr)
425 TRACE("(%p %p)\n", this, timeptr);
426 this->timeptr = timeptr;
427 return this;
430 /* ??_F_Timevec@std@@QAEXXZ */
431 /* ??_F_Timevec@std@@QEAAXXZ */
432 DEFINE_THISCALL_WRAPPER(_Timevec_ctor, 4)
433 _Timevec* __thiscall _Timevec_ctor(_Timevec *this)
435 TRACE("(%p)\n", this);
436 this->timeptr = NULL;
437 return this;
440 /* ??1_Timevec@std@@QAE@XZ */
441 /* ??1_Timevec@std@@QEAA@XZ */
442 DEFINE_THISCALL_WRAPPER(_Timevec_dtor, 4)
443 void __thiscall _Timevec_dtor(_Timevec *this)
445 TRACE("(%p)\n", this);
446 free(this->timeptr);
449 /* ??4_Timevec@std@@QAEAAV01@ABV01@@Z */
450 /* ??4_Timevec@std@@QEAAAEAV01@AEBV01@@Z */
451 DEFINE_THISCALL_WRAPPER(_Timevec_op_assign, 8)
452 _Timevec* __thiscall _Timevec_op_assign(_Timevec *this, _Timevec *right)
454 TRACE("(%p %p)\n", this, right);
455 this->timeptr = right->timeptr;
456 right->timeptr = NULL;
457 return this;
460 /* ?_Getptr@_Timevec@std@@QBEPAXXZ */
461 /* ?_Getptr@_Timevec@std@@QEBAPEAXXZ */
462 DEFINE_THISCALL_WRAPPER(_Timevec__Getptr, 4)
463 void* __thiscall _Timevec__Getptr(_Timevec *this)
465 TRACE("(%p)\n", this);
466 return this->timeptr;
469 /* ?_Locinfo_ctor@_Locinfo@std@@SAXPAV12@HPBD@Z */
470 /* ?_Locinfo_ctor@_Locinfo@std@@SAXPEAV12@HPEBD@Z */
471 _Locinfo* __cdecl _Locinfo__Locinfo_ctor_cat_cstr(_Locinfo *locinfo, int category, const char *locstr)
473 const char *locale = NULL;
475 /* This function is probably modifying more global objects */
476 FIXME("(%p %d %s) semi-stub\n", locinfo, category, locstr);
478 if(!locstr)
479 throw_exception(EXCEPTION_RUNTIME_ERROR, "bad locale name");
481 _Lockit_ctor_locktype(&locinfo->lock, _LOCK_LOCALE);
482 locale_string_char_ctor_cstr(&locinfo->days, "");
483 locale_string_char_ctor_cstr(&locinfo->months, "");
484 locale_string_char_ctor_cstr(&locinfo->oldlocname, setlocale(LC_ALL, NULL));
486 if(category)
487 locale = setlocale(LC_ALL, locstr);
488 else
489 locale = setlocale(LC_ALL, NULL);
491 if(locale)
492 locale_string_char_ctor_cstr(&locinfo->newlocname, locale);
493 else
494 locale_string_char_ctor_cstr(&locinfo->newlocname, "*");
496 return locinfo;
499 /* ??0_Locinfo@std@@QAE@HPBD@Z */
500 /* ??0_Locinfo@std@@QEAA@HPEBD@Z */
501 DEFINE_THISCALL_WRAPPER(_Locinfo_ctor_cat_cstr, 12)
502 _Locinfo* __thiscall _Locinfo_ctor_cat_cstr(_Locinfo *this, int category, const char *locstr)
504 return _Locinfo__Locinfo_ctor_cat_cstr(this, category, locstr);
507 /* ?_Locinfo_ctor@_Locinfo@std@@SAXPAV12@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@@Z */
508 /* ?_Locinfo_ctor@_Locinfo@std@@SAXPEAV12@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@@Z */
509 _Locinfo* __cdecl _Locinfo__Locinfo_ctor_bstr(_Locinfo *locinfo, const basic_string_char *locstr)
511 return _Locinfo__Locinfo_ctor_cat_cstr(locinfo, 1/*FIXME*/, MSVCP_basic_string_char_c_str(locstr));
514 /* ??0_Locinfo@std@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@@Z */
515 /* ??0_Locinfo@std@@QEAA@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@@Z */
516 DEFINE_THISCALL_WRAPPER(_Locinfo_ctor_bstr, 8)
517 _Locinfo* __thiscall _Locinfo_ctor_bstr(_Locinfo *this, const basic_string_char *locstr)
519 return _Locinfo__Locinfo_ctor_cat_cstr(this, 1/*FIXME*/, MSVCP_basic_string_char_c_str(locstr));
522 /* ?_Locinfo_ctor@_Locinfo@std@@SAXPAV12@PBD@Z */
523 /* ?_Locinfo_ctor@_Locinfo@std@@SAXPEAV12@PEBD@Z */
524 _Locinfo* __cdecl _Locinfo__Locinfo_ctor_cstr(_Locinfo *locinfo, const char *locstr)
526 return _Locinfo__Locinfo_ctor_cat_cstr(locinfo, 1/*FIXME*/, locstr);
529 /* ??0_Locinfo@std@@QAE@PBD@Z */
530 /* ??0_Locinfo@std@@QEAA@PEBD@Z */
531 DEFINE_THISCALL_WRAPPER(_Locinfo_ctor_cstr, 8)
532 _Locinfo* __thiscall _Locinfo_ctor_cstr(_Locinfo *this, const char *locstr)
534 return _Locinfo__Locinfo_ctor_cat_cstr(this, 1/*FIXME*/, locstr);
537 /* ?_Locinfo_dtor@_Locinfo@std@@SAXPAV12@@Z */
538 /* ?_Locinfo_dtor@_Locinfo@std@@SAXPEAV12@@Z */
539 void __cdecl _Locinfo__Locinfo_dtor(_Locinfo *locinfo)
541 TRACE("(%p)\n", locinfo);
543 setlocale(LC_ALL, locale_string_char_c_str(&locinfo->oldlocname));
544 locale_string_char_dtor(&locinfo->days);
545 locale_string_char_dtor(&locinfo->months);
546 locale_string_char_dtor(&locinfo->oldlocname);
547 locale_string_char_dtor(&locinfo->newlocname);
548 _Lockit_dtor(&locinfo->lock);
551 /* ??_F_Locinfo@std@@QAEXXZ */
552 /* ??_F_Locinfo@std@@QEAAXXZ */
553 DEFINE_THISCALL_WRAPPER(_Locinfo_ctor, 4)
554 _Locinfo* __thiscall _Locinfo_ctor(_Locinfo *this)
556 return _Locinfo__Locinfo_ctor_cat_cstr(this, 1/*FIXME*/, "C");
559 /* ??1_Locinfo@std@@QAE@XZ */
560 /* ??1_Locinfo@std@@QEAA@XZ */
561 DEFINE_THISCALL_WRAPPER(_Locinfo_dtor, 4)
562 void __thiscall _Locinfo_dtor(_Locinfo *this)
564 _Locinfo__Locinfo_dtor(this);
567 /* ?_Locinfo_Addcats@_Locinfo@std@@SAAAV12@PAV12@HPBD@Z */
568 /* ?_Locinfo_Addcats@_Locinfo@std@@SAAEAV12@PEAV12@HPEBD@Z */
569 _Locinfo* __cdecl _Locinfo__Locinfo_Addcats(_Locinfo *locinfo, int category, const char *locstr)
571 const char *locale = NULL;
573 /* This function is probably modifying more global objects */
574 FIXME("(%p %d %s) semi-stub\n", locinfo, category, locstr);
575 if(!locstr)
576 throw_exception(EXCEPTION_RUNTIME_ERROR, "bad locale name");
578 locale_string_char_dtor(&locinfo->newlocname);
580 if(category)
581 locale = setlocale(LC_ALL, locstr);
582 else
583 locale = setlocale(LC_ALL, NULL);
585 if(locale)
586 locale_string_char_ctor_cstr(&locinfo->newlocname, locale);
587 else
588 locale_string_char_ctor_cstr(&locinfo->newlocname, "*");
590 return locinfo;
593 /* ?_Addcats@_Locinfo@std@@QAEAAV12@HPBD@Z */
594 /* ?_Addcats@_Locinfo@std@@QEAAAEAV12@HPEBD@Z */
595 DEFINE_THISCALL_WRAPPER(_Locinfo__Addcats, 12)
596 _Locinfo* __thiscall _Locinfo__Addcats(_Locinfo *this, int category, const char *locstr)
598 return _Locinfo__Locinfo_Addcats(this, category, locstr);
601 /* _Getcoll */
602 ULONGLONG __cdecl _Getcoll(void)
604 union {
605 _Collvec collvec;
606 ULONGLONG ull;
607 } ret;
609 TRACE("\n");
611 ret.collvec.page = ___lc_collate_cp_func();
612 ret.collvec.handle = ___lc_handle_func()[LC_COLLATE];
613 return ret.ull;
616 /* ?_Getcoll@_Locinfo@std@@QBE?AU_Collvec@@XZ */
617 /* ?_Getcoll@_Locinfo@std@@QEBA?AU_Collvec@@XZ */
618 DEFINE_THISCALL_WRAPPER(_Locinfo__Getcoll, 8)
619 _Collvec* __thiscall _Locinfo__Getcoll(const _Locinfo *this, _Collvec *ret)
621 ULONGLONG ull = _Getcoll();
622 memcpy(ret, &ull, sizeof(ull));
623 return ret;
626 /* _Getctype */
627 _Ctypevec* __cdecl _Getctype(_Ctypevec *ret)
629 short *table;
631 TRACE("\n");
633 ret->page = ___lc_codepage_func();
634 #if _MSVCP_VER < 110
635 ret->handle = ___lc_handle_func()[LC_COLLATE];
636 #else
637 /* FIXME: use ___lc_locale_name_func() */
638 ret->name = NULL;
639 #endif
640 ret->delfl = TRUE;
641 table = malloc(sizeof(short[256]));
642 if(!table) throw_exception(EXCEPTION_BAD_ALLOC, NULL);
643 memcpy(table, __pctype_func(), sizeof(short[256]));
644 ret->table = table;
645 return ret;
648 /* ?_Getctype@_Locinfo@std@@QBE?AU_Ctypevec@@XZ */
649 /* ?_Getctype@_Locinfo@std@@QEBA?AU_Ctypevec@@XZ */
650 DEFINE_THISCALL_WRAPPER(_Locinfo__Getctype, 8)
651 _Ctypevec* __thiscall _Locinfo__Getctype(const _Locinfo *this, _Ctypevec *ret)
653 return _Getctype(ret);
656 /* _Getcvt */
657 ULONGLONG __cdecl _Getcvt(void)
659 union {
660 _Cvtvec cvtvec;
661 ULONGLONG ull;
662 } ret;
664 TRACE("\n");
666 ret.cvtvec.page = ___lc_codepage_func();
667 ret.cvtvec.handle = ___lc_handle_func()[LC_CTYPE];
668 return ret.ull;
671 /* ?_Getcvt@_Locinfo@std@@QBE?AU_Cvtvec@@XZ */
672 /* ?_Getcvt@_Locinfo@std@@QEBA?AU_Cvtvec@@XZ */
673 DEFINE_THISCALL_WRAPPER(_Locinfo__Getcvt, 8)
674 _Cvtvec* __thiscall _Locinfo__Getcvt(const _Locinfo *this, _Cvtvec *ret)
676 ULONGLONG ull = _Getcvt();
677 memcpy(ret, &ull, sizeof(ull));
678 return ret;
681 /* ?_Getdateorder@_Locinfo@std@@QBEHXZ */
682 /* ?_Getdateorder@_Locinfo@std@@QEBAHXZ */
683 DEFINE_THISCALL_WRAPPER(_Locinfo__Getdateorder, 4)
684 int __thiscall _Locinfo__Getdateorder(const _Locinfo *this)
686 FIXME("(%p) stub\n", this);
687 return 0;
690 /* ?_Getdays@_Locinfo@std@@QBEPBDXZ */
691 /* ?_Getdays@_Locinfo@std@@QEBAPEBDXZ */
692 DEFINE_THISCALL_WRAPPER(_Locinfo__Getdays, 4)
693 const char* __thiscall _Locinfo__Getdays(_Locinfo *this)
695 char *days = _Getdays();
696 const char *ret;
698 TRACE("(%p)\n", this);
700 if(days) {
701 locale_string_char_dtor(&this->days);
702 locale_string_char_ctor_cstr(&this->days, days);
703 free(days);
706 ret = locale_string_char_c_str(&this->days);
707 if (!ret[0]) ret = ":Sun:Sunday:Mon:Monday:Tue:Tuesday:Wed:Wednesday:Thu:Thursday:Fri:Friday:Sat:Saturday";
708 return ret;
711 /* ?_Getmonths@_Locinfo@std@@QBEPBDXZ */
712 /* ?_Getmonths@_Locinfo@std@@QEBAPEBDXZ */
713 DEFINE_THISCALL_WRAPPER(_Locinfo__Getmonths, 4)
714 const char* __thiscall _Locinfo__Getmonths(_Locinfo *this)
716 char *months = _Getmonths();
717 const char *ret;
719 TRACE("(%p)\n", this);
721 if(months) {
722 locale_string_char_dtor(&this->months);
723 locale_string_char_ctor_cstr(&this->months, months);
724 free(months);
727 ret = locale_string_char_c_str(&this->months);
728 if (!ret[0]) ret = ":Jan:January:Feb:February:Mar:March:Apr:April:May:May:Jun:June:Jul:July"
729 ":Aug:August:Sep:September:Oct:October:Nov:November:Dec:December";
730 return ret;
733 /* ?_Getfalse@_Locinfo@std@@QBEPBDXZ */
734 /* ?_Getfalse@_Locinfo@std@@QEBAPEBDXZ */
735 DEFINE_THISCALL_WRAPPER(_Locinfo__Getfalse, 4)
736 const char* __thiscall _Locinfo__Getfalse(const _Locinfo *this)
738 TRACE("(%p)\n", this);
739 return "false";
742 /* ?_Gettrue@_Locinfo@std@@QBEPBDXZ */
743 /* ?_Gettrue@_Locinfo@std@@QEBAPEBDXZ */
744 DEFINE_THISCALL_WRAPPER(_Locinfo__Gettrue, 4)
745 const char* __thiscall _Locinfo__Gettrue(const _Locinfo *this)
747 TRACE("(%p)\n", this);
748 return "true";
751 /* ?_Getlconv@_Locinfo@std@@QBEPBUlconv@@XZ */
752 /* ?_Getlconv@_Locinfo@std@@QEBAPEBUlconv@@XZ */
753 DEFINE_THISCALL_WRAPPER(_Locinfo__Getlconv, 4)
754 const struct lconv* __thiscall _Locinfo__Getlconv(const _Locinfo *this)
756 TRACE("(%p)\n", this);
757 return localeconv();
760 /* ?_Gettnames@_Locinfo@std@@QBE?AV_Timevec@2@XZ */
761 /* ?_Gettnames@_Locinfo@std@@QEBA?AV_Timevec@2@XZ */
762 DEFINE_THISCALL_WRAPPER(_Locinfo__Gettnames, 8)
763 _Timevec*__thiscall _Locinfo__Gettnames(const _Locinfo *this, _Timevec *ret)
765 TRACE("(%p)\n", this);
767 _Timevec_ctor_timeptr(ret, _Gettnames());
768 return ret;
771 /* ?id@?$collate@D@std@@2V0locale@2@A */
772 locale_id collate_char_id = {0};
774 /* ??_7?$collate@D@std@@6B@ */
775 extern const vtable_ptr MSVCP_collate_char_vtable;
777 /* ?_Init@?$collate@D@std@@IAEXABV_Locinfo@2@@Z */
778 /* ?_Init@?$collate@D@std@@IEAAXAEBV_Locinfo@2@@Z */
779 DEFINE_THISCALL_WRAPPER(collate_char__Init, 8)
780 void __thiscall collate_char__Init(collate *this, const _Locinfo *locinfo)
782 TRACE("(%p %p)\n", this, locinfo);
783 _Locinfo__Getcoll(locinfo, &this->coll);
786 /* ??0?$collate@D@std@@IAE@PBDI@Z */
787 /* ??0?$collate@D@std@@IEAA@PEBD_K@Z */
788 DEFINE_THISCALL_WRAPPER(collate_char_ctor_name, 12)
789 collate* __thiscall collate_char_ctor_name(collate *this, const char *name, MSVCP_size_t refs)
791 _Locinfo locinfo;
793 TRACE("(%p %s %lu)\n", this, name, refs);
795 locale_facet_ctor_refs(&this->facet, refs);
796 this->facet.vtable = &MSVCP_collate_char_vtable;
798 _Locinfo_ctor_cstr(&locinfo, name);
799 collate_char__Init(this, &locinfo);
800 _Locinfo_dtor(&locinfo);
801 return this;
804 /* ??0?$collate@D@std@@QAE@ABV_Locinfo@1@I@Z */
805 /* ??0?$collate@D@std@@QEAA@AEBV_Locinfo@1@_K@Z */
806 DEFINE_THISCALL_WRAPPER(collate_char_ctor_locinfo, 12)
807 collate* __thiscall collate_char_ctor_locinfo(collate *this, const _Locinfo *locinfo, MSVCP_size_t refs)
809 TRACE("(%p %p %lu)\n", this, locinfo, refs);
811 locale_facet_ctor_refs(&this->facet, refs);
812 this->facet.vtable = &MSVCP_collate_char_vtable;
813 collate_char__Init(this, locinfo);
814 return this;
817 /* ??0?$collate@D@std@@QAE@I@Z */
818 /* ??0?$collate@D@std@@QEAA@_K@Z */
819 DEFINE_THISCALL_WRAPPER(collate_char_ctor_refs, 8)
820 collate* __thiscall collate_char_ctor_refs(collate *this, MSVCP_size_t refs)
822 return collate_char_ctor_name(this, "C", refs);
825 /* ??1?$collate@D@std@@MAE@XZ */
826 /* ??1?$collate@D@std@@MEAA@XZ */
827 DEFINE_THISCALL_WRAPPER(collate_char_dtor, 4)
828 void __thiscall collate_char_dtor(collate *this)
830 TRACE("(%p)\n", this);
833 DEFINE_THISCALL_WRAPPER(collate_char_vector_dtor, 8)
834 collate* __thiscall collate_char_vector_dtor(collate *this, unsigned int flags)
836 TRACE("(%p %x)\n", this, flags);
837 if(flags & 2) {
838 /* we have an array, with the number of elements stored before the first object */
839 INT_PTR i, *ptr = (INT_PTR *)this-1;
841 for(i=*ptr-1; i>=0; i--)
842 collate_char_dtor(this+i);
843 MSVCRT_operator_delete(ptr);
844 } else {
845 collate_char_dtor(this);
846 if(flags & 1)
847 MSVCRT_operator_delete(this);
850 return this;
853 /* ??_F?$collate@D@std@@QAEXXZ */
854 /* ??_F?$collate@D@std@@QEAAXXZ */
855 DEFINE_THISCALL_WRAPPER(collate_char_ctor, 4)
856 collate* __thiscall collate_char_ctor(collate *this)
858 return collate_char_ctor_name(this, "C", 0);
861 /* ?_Getcat@?$collate@D@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
862 /* ?_Getcat@?$collate@D@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
863 MSVCP_size_t __cdecl collate_char__Getcat(const locale_facet **facet, const locale *loc)
865 TRACE("(%p %p)\n", facet, loc);
867 if(facet && !*facet) {
868 *facet = MSVCRT_operator_new(sizeof(collate));
869 if(!*facet) {
870 ERR("Out of memory\n");
871 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
872 return 0;
874 collate_char_ctor_name((collate*)*facet,
875 locale_string_char_c_str(&loc->ptr->name), 0);
878 return LC_COLLATE;
881 /* ?_Getcat@?$collate@D@std@@SAIPAPBVfacet@locale@2@@Z */
882 /* ?_Getcat@?$collate@D@std@@SA_KPEAPEBVfacet@locale@2@@Z */
883 MSVCP_size_t __cdecl collate_char__Getcat_old(const locale_facet **facet)
885 return collate_char__Getcat(facet, locale_classic());
888 static collate* collate_char_use_facet(const locale *loc)
890 static collate *obj = NULL;
892 _Lockit lock;
893 const locale_facet *fac;
895 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
896 fac = locale__Getfacet(loc, locale_id_operator_size_t(&collate_char_id));
897 if(fac) {
898 _Lockit_dtor(&lock);
899 return (collate*)fac;
902 if(obj) {
903 _Lockit_dtor(&lock);
904 return obj;
907 collate_char__Getcat(&fac, loc);
908 obj = (collate*)fac;
909 call_locale_facet__Incref(&obj->facet);
910 locale_facet_register(&obj->facet);
911 _Lockit_dtor(&lock);
913 return obj;
916 /* _Strcoll */
917 int __cdecl _Strcoll(const char *first1, const char *last1, const char *first2,
918 const char *last2, const _Collvec *coll)
920 LCID lcid;
922 TRACE("(%s %s)\n", debugstr_an(first1, last1-first1), debugstr_an(first2, last2-first2));
924 if(coll)
925 lcid = coll->handle;
926 else
927 lcid = ___lc_handle_func()[LC_COLLATE];
928 return CompareStringA(lcid, 0, first1, last1-first1, first2, last2-first2)-CSTR_EQUAL;
931 /* ?do_compare@?$collate@D@std@@MBEHPBD000@Z */
932 /* ?do_compare@?$collate@D@std@@MEBAHPEBD000@Z */
933 DEFINE_THISCALL_WRAPPER(collate_char_do_compare, 20)
934 #if _MSVCP_VER <= 100
935 #define call_collate_char_do_compare(this, first1, last1, first2, last2) CALL_VTBL_FUNC(this, 4, int, \
936 (const collate*, const char*, const char*, const char*, const char*), \
937 (this, first1, last1, first2, last2))
938 #else
939 #define call_collate_char_do_compare(this, first1, last1, first2, last2) CALL_VTBL_FUNC(this, 12, int, \
940 (const collate*, const char*, const char*, const char*, const char*), \
941 (this, first1, last1, first2, last2))
942 #endif
943 int __thiscall collate_char_do_compare(const collate *this, const char *first1,
944 const char *last1, const char *first2, const char *last2)
946 TRACE("(%p %p %p %p %p)\n", this, first1, last1, first2, last2);
947 return _Strcoll(first1, last1, first2, last2, &this->coll);
950 /* ?compare@?$collate@D@std@@QBEHPBD000@Z */
951 /* ?compare@?$collate@D@std@@QEBAHPEBD000@Z */
952 DEFINE_THISCALL_WRAPPER(collate_char_compare, 20)
953 int __thiscall collate_char_compare(const collate *this, const char *first1,
954 const char *last1, const char *first2, const char *last2)
956 TRACE("(%p %p %p %p %p)\n", this, first1, last1, first2, last2);
957 return call_collate_char_do_compare(this, first1, last1, first2, last2);
960 /* ?do_hash@?$collate@D@std@@MBEJPBD0@Z */
961 /* ?do_hash@?$collate@D@std@@MEBAJPEBD0@Z */
962 DEFINE_THISCALL_WRAPPER(collate_char_do_hash, 12)
963 #if _MSVCP_VER <= 100
964 #define call_collate_char_do_hash(this, first, last) CALL_VTBL_FUNC(this, 12, LONG, \
965 (const collate*, const char*, const char*), (this, first, last))
966 #else
967 #define call_collate_char_do_hash(this, first, last) CALL_VTBL_FUNC(this, 20, LONG, \
968 (const collate*, const char*, const char*), (this, first, last))
969 #endif
970 LONG __thiscall collate_char_do_hash(const collate *this,
971 const char *first, const char *last)
973 ULONG ret = 0;
975 TRACE("(%p %p %p)\n", this, first, last);
977 for(; first<last; first++)
978 ret = (ret<<8 | ret>>24) + *first;
979 return ret;
982 /* ?hash@?$collate@D@std@@QBEJPBD0@Z */
983 /* ?hash@?$collate@D@std@@QEBAJPEBD0@Z */
984 DEFINE_THISCALL_WRAPPER(collate_char_hash, 12)
985 LONG __thiscall collate_char_hash(const collate *this,
986 const char *first, const char *last)
988 TRACE("(%p %p %p)\n", this, first, last);
989 return call_collate_char_do_hash(this, first, last);
992 /* ?do_transform@?$collate@D@std@@MBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@PBD0@Z */
993 /* ?do_transform@?$collate@D@std@@MEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@PEBD0@Z */
994 DEFINE_THISCALL_WRAPPER(collate_char_do_transform, 16)
995 basic_string_char* __thiscall collate_char_do_transform(const collate *this,
996 basic_string_char *ret, const char *first, const char *last)
998 FIXME("(%p %p %p) stub\n", this, first, last);
999 return ret;
1002 /* ?transform@?$collate@D@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@PBD0@Z */
1003 /* ?transform@?$collate@D@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@PEBD0@Z */
1004 DEFINE_THISCALL_WRAPPER(collate_char_transform, 16)
1005 basic_string_char* __thiscall collate_char_transform(const collate *this,
1006 basic_string_char *ret, const char *first, const char *last)
1008 FIXME("(%p %p %p) stub\n", this, first, last);
1009 return ret;
1012 /* ?id@?$collate@_W@std@@2V0locale@2@A */
1013 locale_id collate_wchar_id = {0};
1014 /* ?id@?$collate@G@std@@2V0locale@2@A */
1015 locale_id collate_short_id = {0};
1017 /* ??_7?$collate@_W@std@@6B@ */
1018 extern const vtable_ptr MSVCP_collate_wchar_vtable;
1019 /* ??_7?$collate@G@std@@6B@ */
1020 extern const vtable_ptr MSVCP_collate_short_vtable;
1022 /* ?_Init@?$collate@_W@std@@IAEXABV_Locinfo@2@@Z */
1023 /* ?_Init@?$collate@_W@std@@IEAAXAEBV_Locinfo@2@@Z */
1024 /* ?_Init@?$collate@G@std@@IAEXABV_Locinfo@2@@Z */
1025 /* ?_Init@?$collate@G@std@@IEAAXAEBV_Locinfo@2@@Z */
1026 DEFINE_THISCALL_WRAPPER(collate_wchar__Init, 8)
1027 void __thiscall collate_wchar__Init(collate *this, const _Locinfo *locinfo)
1029 TRACE("(%p %p)\n", this, locinfo);
1030 _Locinfo__Getcoll(locinfo, &this->coll);
1033 /* ??0?$collate@_W@std@@IAE@PBDI@Z */
1034 /* ??0?$collate@_W@std@@IEAA@PEBD_K@Z */
1035 DEFINE_THISCALL_WRAPPER(collate_wchar_ctor_name, 12)
1036 collate* __thiscall collate_wchar_ctor_name(collate *this, const char *name, MSVCP_size_t refs)
1038 _Locinfo locinfo;
1040 TRACE("(%p %s %lu)\n", this, name, refs);
1042 locale_facet_ctor_refs(&this->facet, refs);
1043 this->facet.vtable = &MSVCP_collate_wchar_vtable;
1045 _Locinfo_ctor_cstr(&locinfo, name);
1046 collate_wchar__Init(this, &locinfo);
1047 _Locinfo_dtor(&locinfo);
1048 return this;
1051 /* ??0?$collate@G@std@@IAE@PBDI@Z */
1052 /* ??0?$collate@G@std@@IEAA@PEBD_K@Z */
1053 DEFINE_THISCALL_WRAPPER(collate_short_ctor_name, 12)
1054 collate* __thiscall collate_short_ctor_name(collate *this, const char *name, MSVCP_size_t refs)
1056 collate *ret = collate_wchar_ctor_name(this, name, refs);
1057 ret->facet.vtable = &MSVCP_collate_short_vtable;
1058 return ret;
1061 /* ??0?$collate@_W@std@@QAE@ABV_Locinfo@1@I@Z */
1062 /* ??0?$collate@_W@std@@QEAA@AEBV_Locinfo@1@_K@Z */
1063 DEFINE_THISCALL_WRAPPER(collate_wchar_ctor_locinfo, 12)
1064 collate* __thiscall collate_wchar_ctor_locinfo(collate *this, const _Locinfo *locinfo, MSVCP_size_t refs)
1066 TRACE("(%p %p %lu)\n", this, locinfo, refs);
1068 locale_facet_ctor_refs(&this->facet, refs);
1069 this->facet.vtable = &MSVCP_collate_wchar_vtable;
1070 collate_wchar__Init(this, locinfo);
1071 return this;
1074 /* ??0?$collate@G@std@@QAE@ABV_Locinfo@1@I@Z */
1075 /* ??0?$collate@G@std@@QEAA@AEBV_Locinfo@1@_K@Z */
1076 DEFINE_THISCALL_WRAPPER(collate_short_ctor_locinfo, 12)
1077 collate* __thiscall collate_short_ctor_locinfo(collate *this, const _Locinfo *locinfo, MSVCP_size_t refs)
1079 collate *ret = collate_wchar_ctor_locinfo(this, locinfo, refs);
1080 ret->facet.vtable = &MSVCP_collate_short_vtable;
1081 return ret;
1084 /* ??0?$collate@_W@std@@QAE@I@Z */
1085 /* ??0?$collate@_W@std@@QEAA@_K@Z */
1086 DEFINE_THISCALL_WRAPPER(collate_wchar_ctor_refs, 8)
1087 collate* __thiscall collate_wchar_ctor_refs(collate *this, MSVCP_size_t refs)
1089 return collate_wchar_ctor_name(this, "C", refs);
1092 /* ??0?$collate@G@std@@QAE@I@Z */
1093 /* ??0?$collate@G@std@@QEAA@_K@Z */
1094 DEFINE_THISCALL_WRAPPER(collate_short_ctor_refs, 8)
1095 collate* __thiscall collate_short_ctor_refs(collate *this, MSVCP_size_t refs)
1097 collate *ret = collate_wchar_ctor_refs(this, refs);
1098 ret->facet.vtable = &MSVCP_collate_short_vtable;
1099 return ret;
1102 /* ??1?$collate@_W@std@@MAE@XZ */
1103 /* ??1?$collate@_W@std@@MEAA@XZ */
1104 /* ??1?$collate@G@std@@MAE@XZ */
1105 /* ??1?$collate@G@std@@MEAA@XZ */
1106 DEFINE_THISCALL_WRAPPER(collate_wchar_dtor, 4)
1107 void __thiscall collate_wchar_dtor(collate *this)
1109 TRACE("(%p)\n", this);
1112 DEFINE_THISCALL_WRAPPER(collate_wchar_vector_dtor, 8)
1113 collate* __thiscall collate_wchar_vector_dtor(collate *this, unsigned int flags)
1115 TRACE("(%p %x)\n", this, flags);
1116 if(flags & 2) {
1117 /* we have an array, with the number of elements stored before the first object */
1118 INT_PTR i, *ptr = (INT_PTR *)this-1;
1120 for(i=*ptr-1; i>=0; i--)
1121 collate_wchar_dtor(this+i);
1122 MSVCRT_operator_delete(ptr);
1123 } else {
1124 collate_wchar_dtor(this);
1125 if(flags & 1)
1126 MSVCRT_operator_delete(this);
1129 return this;
1132 /* ??_F?$collate@_W@std@@QAEXXZ */
1133 /* ??_F?$collate@_W@std@@QEAAXXZ */
1134 DEFINE_THISCALL_WRAPPER(collate_wchar_ctor, 4)
1135 collate* __thiscall collate_wchar_ctor(collate *this)
1137 return collate_wchar_ctor_name(this, "C", 0);
1140 /* ??_F?$collate@G@std@@QAEXXZ */
1141 /* ??_F?$collate@G@std@@QEAAXXZ */
1142 DEFINE_THISCALL_WRAPPER(collate_short_ctor, 4)
1143 collate* __thiscall collate_short_ctor(collate *this)
1145 collate *ret = collate_wchar_ctor(this);
1146 ret->facet.vtable = &MSVCP_collate_short_vtable;
1147 return ret;
1150 /* ?_Getcat@?$collate@_W@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
1151 /* ?_Getcat@?$collate@_W@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
1152 MSVCP_size_t __cdecl collate_wchar__Getcat(const locale_facet **facet, const locale *loc)
1154 TRACE("(%p %p)\n", facet, loc);
1156 if(facet && !*facet) {
1157 *facet = MSVCRT_operator_new(sizeof(collate));
1158 if(!*facet) {
1159 ERR("Out of memory\n");
1160 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
1161 return 0;
1163 collate_wchar_ctor_name((collate*)*facet,
1164 locale_string_char_c_str(&loc->ptr->name), 0);
1167 return LC_COLLATE;
1170 /* ?_Getcat@?$collate@_W@std@@SAIPAPBVfacet@locale@2@@Z */
1171 /* ?_Getcat@?$collate@_W@std@@SA_KPEAPEBVfacet@locale@2@@Z */
1172 MSVCP_size_t __cdecl collate_wchar__Getcat_old(const locale_facet **facet)
1174 return collate_wchar__Getcat(facet, locale_classic());
1177 static collate* collate_wchar_use_facet(const locale *loc)
1179 static collate *obj = NULL;
1181 _Lockit lock;
1182 const locale_facet *fac;
1184 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
1185 fac = locale__Getfacet(loc, locale_id_operator_size_t(&collate_wchar_id));
1186 if(fac) {
1187 _Lockit_dtor(&lock);
1188 return (collate*)fac;
1191 if(obj) {
1192 _Lockit_dtor(&lock);
1193 return obj;
1196 collate_wchar__Getcat(&fac, loc);
1197 obj = (collate*)fac;
1198 call_locale_facet__Incref(&obj->facet);
1199 locale_facet_register(&obj->facet);
1200 _Lockit_dtor(&lock);
1202 return obj;
1205 /* ?_Getcat@?$collate@G@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
1206 /* ?_Getcat@?$collate@G@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
1207 MSVCP_size_t __cdecl collate_short__Getcat(const locale_facet **facet, const locale *loc)
1209 if(facet && !*facet) {
1210 collate_wchar__Getcat(facet, loc);
1211 (*(locale_facet**)facet)->vtable = &MSVCP_collate_short_vtable;
1214 return LC_COLLATE;
1217 /* ?_Getcat@?$collate@G@std@@SAIPAPBVfacet@locale@2@@Z */
1218 /* ?_Getcat@?$collate@G@std@@SA_KPEAPEBVfacet@locale@2@@Z */
1219 MSVCP_size_t __cdecl collate_short__Getcat_old(const locale_facet **facet)
1221 return collate_short__Getcat(facet, locale_classic());
1224 static collate* collate_short_use_facet(const locale *loc)
1226 static collate *obj = NULL;
1228 _Lockit lock;
1229 const locale_facet *fac;
1231 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
1232 fac = locale__Getfacet(loc, locale_id_operator_size_t(&collate_short_id));
1233 if(fac) {
1234 _Lockit_dtor(&lock);
1235 return (collate*)fac;
1238 if(obj) {
1239 _Lockit_dtor(&lock);
1240 return obj;
1243 collate_short__Getcat(&fac, loc);
1244 obj = (collate*)fac;
1245 call_locale_facet__Incref(&obj->facet);
1246 locale_facet_register(&obj->facet);
1247 _Lockit_dtor(&lock);
1249 return obj;
1252 /* _Wcscoll */
1253 int __cdecl _Wcscoll(const wchar_t *first1, const wchar_t *last1, const wchar_t *first2,
1254 const wchar_t *last2, const _Collvec *coll)
1256 LCID lcid;
1258 TRACE("(%s %s)\n", debugstr_wn(first1, last1-first1), debugstr_wn(first2, last2-first2));
1260 if(coll)
1261 lcid = coll->handle;
1262 else
1263 lcid = ___lc_handle_func()[LC_COLLATE];
1264 return CompareStringW(lcid, 0, first1, last1-first1, first2, last2-first2)-CSTR_EQUAL;
1267 /* ?do_compare@?$collate@_W@std@@MBEHPB_W000@Z */
1268 /* ?do_compare@?$collate@_W@std@@MEBAHPEB_W000@Z */
1269 /* ?do_compare@?$collate@G@std@@MBEHPBG000@Z */
1270 /* ?do_compare@?$collate@G@std@@MEBAHPEBG000@Z */
1271 DEFINE_THISCALL_WRAPPER(collate_wchar_do_compare, 20)
1272 #if _MSVCP_VER <= 100
1273 #define call_collate_wchar_do_compare(this, first1, last1, first2, last2) CALL_VTBL_FUNC(this, 4, int, \
1274 (const collate*, const wchar_t*, const wchar_t*, const wchar_t*, const wchar_t*), \
1275 (this, first1, last1, first2, last2))
1276 #else
1277 #define call_collate_wchar_do_compare(this, first1, last1, first2, last2) CALL_VTBL_FUNC(this, 12, int, \
1278 (const collate*, const wchar_t*, const wchar_t*, const wchar_t*, const wchar_t*), \
1279 (this, first1, last1, first2, last2))
1280 #endif
1281 int __thiscall collate_wchar_do_compare(const collate *this, const wchar_t *first1,
1282 const wchar_t *last1, const wchar_t *first2, const wchar_t *last2)
1284 TRACE("(%p %p %p %p %p)\n", this, first1, last1, first2, last2);
1285 return _Wcscoll(first1, last1, first2, last2, &this->coll);
1288 /* ?compare@?$collate@_W@std@@QBEHPB_W000@Z */
1289 /* ?compare@?$collate@_W@std@@QEBAHPEB_W000@Z */
1290 /* ?compare@?$collate@G@std@@QBEHPBG000@Z */
1291 /* ?compare@?$collate@G@std@@QEBAHPEBG000@Z */
1292 DEFINE_THISCALL_WRAPPER(collate_wchar_compare, 20)
1293 int __thiscall collate_wchar_compare(const collate *this, const wchar_t *first1,
1294 const wchar_t *last1, const wchar_t *first2, const wchar_t *last2)
1296 TRACE("(%p %p %p %p %p)\n", this, first1, last1, first2, last2);
1297 return call_collate_wchar_do_compare(this, first1, last1, first2, last2);
1300 /* ?do_hash@?$collate@_W@std@@MBEJPB_W0@Z */
1301 /* ?do_hash@?$collate@_W@std@@MEBAJPEB_W0@Z */
1302 /* ?do_hash@?$collate@G@std@@MBEJPBG0@Z */
1303 /* ?do_hash@?$collate@G@std@@MEBAJPEBG0@Z */
1304 DEFINE_THISCALL_WRAPPER(collate_wchar_do_hash, 12)
1305 #if _MSVCP_VER <= 100
1306 #define call_collate_wchar_do_hash(this, first, last) CALL_VTBL_FUNC(this, 12, LONG, \
1307 (const collate*, const wchar_t*, const wchar_t*), (this, first, last))
1308 #else
1309 #define call_collate_wchar_do_hash(this, first, last) CALL_VTBL_FUNC(this, 20, LONG, \
1310 (const collate*, const wchar_t*, const wchar_t*), (this, first, last))
1311 #endif
1312 LONG __thiscall collate_wchar_do_hash(const collate *this,
1313 const wchar_t *first, const wchar_t *last)
1315 ULONG ret = 0;
1317 TRACE("(%p %p %p)\n", this, first, last);
1319 for(; first<last; first++)
1320 ret = (ret<<8 | ret>>24) + *first;
1321 return ret;
1324 /* ?hash@?$collate@_W@std@@QBEJPB_W0@Z */
1325 /* ?hash@?$collate@_W@std@@QEBAJPEB_W0@Z */
1326 /* ?hash@?$collate@G@std@@QBEJPBG0@Z */
1327 /* ?hash@?$collate@G@std@@QEBAJPEBG0@Z */
1328 DEFINE_THISCALL_WRAPPER(collate_wchar_hash, 12)
1329 LONG __thiscall collate_wchar_hash(const collate *this,
1330 const wchar_t *first, const wchar_t *last)
1332 TRACE("(%p %p %p)\n", this, first, last);
1333 return call_collate_wchar_do_hash(this, first, last);
1336 /* ?do_transform@?$collate@_W@std@@MBE?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@PB_W0@Z */
1337 /* ?do_transform@?$collate@_W@std@@MEBA?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@PEB_W0@Z */
1338 /* ?do_transform@?$collate@G@std@@MBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@PBG0@Z */
1339 /* ?do_transform@?$collate@G@std@@MEBA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@PEBG0@Z */
1340 DEFINE_THISCALL_WRAPPER(collate_wchar_do_transform, 16)
1341 basic_string_wchar* __thiscall collate_wchar_do_transform(const collate *this,
1342 basic_string_wchar *ret, const wchar_t *first, const wchar_t *last)
1344 FIXME("(%p %p %p) stub\n", this, first, last);
1345 return ret;
1348 /* ?transform@?$collate@_W@std@@QBE?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@PB_W0@Z */
1349 /* ?transform@?$collate@_W@std@@QEBA?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@PEB_W0@Z */
1350 /* ?transform@?$collate@G@std@@QBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@PBG0@Z */
1351 /* ?transform@?$collate@G@std@@QEBA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@PEBG0@Z */
1352 DEFINE_THISCALL_WRAPPER(collate_wchar_transform, 16)
1353 basic_string_wchar* __thiscall collate_wchar_transform(const collate *this,
1354 basic_string_wchar *ret, const wchar_t *first, const wchar_t *last)
1356 FIXME("(%p %p %p) stub\n", this, first, last);
1357 return ret;
1360 /* ??_7ctype_base@std@@6B@ */
1361 extern const vtable_ptr MSVCP_ctype_base_vtable;
1363 /* ??0ctype_base@std@@QAE@I@Z */
1364 /* ??0ctype_base@std@@QEAA@_K@Z */
1365 DEFINE_THISCALL_WRAPPER(ctype_base_ctor_refs, 8)
1366 ctype_base* __thiscall ctype_base_ctor_refs(ctype_base *this, MSVCP_size_t refs)
1368 TRACE("(%p %lu)\n", this, refs);
1369 locale_facet_ctor_refs(&this->facet, refs);
1370 this->facet.vtable = &MSVCP_ctype_base_vtable;
1371 return this;
1374 /* ??_Fctype_base@std@@QAEXXZ */
1375 /* ??_Fctype_base@std@@QEAAXXZ */
1376 DEFINE_THISCALL_WRAPPER(ctype_base_ctor, 4)
1377 ctype_base* __thiscall ctype_base_ctor(ctype_base *this)
1379 TRACE("(%p)\n", this);
1380 locale_facet_ctor_refs(&this->facet, 0);
1381 this->facet.vtable = &MSVCP_ctype_base_vtable;
1382 return this;
1385 /* ??1ctype_base@std@@UAE@XZ */
1386 /* ??1ctype_base@std@@UEAA@XZ */
1387 DEFINE_THISCALL_WRAPPER(ctype_base_dtor, 4)
1388 void __thiscall ctype_base_dtor(ctype_base *this)
1390 TRACE("(%p)\n", this);
1393 DEFINE_THISCALL_WRAPPER(ctype_base_vector_dtor, 8)
1394 ctype_base* __thiscall ctype_base_vector_dtor(ctype_base *this, unsigned int flags)
1396 TRACE("(%p %x)\n", this, flags);
1397 if(flags & 2) {
1398 /* we have an array, with the number of elements stored before the first object */
1399 INT_PTR i, *ptr = (INT_PTR *)this-1;
1401 for(i=*ptr-1; i>=0; i--)
1402 ctype_base_dtor(this+i);
1403 MSVCRT_operator_delete(ptr);
1404 } else {
1405 ctype_base_dtor(this);
1406 if(flags & 1)
1407 MSVCRT_operator_delete(this);
1410 return this;
1413 /* ?_Xran@ctype_base@std@@KAXXZ */
1414 void __cdecl ctype_base__Xran(void)
1416 throw_exception(EXCEPTION_OUT_OF_RANGE, "out of range in ctype<T>");
1419 /* ?id@?$ctype@D@std@@2V0locale@2@A */
1420 locale_id ctype_char_id = {0};
1421 /* ?table_size@?$ctype@D@std@@2IB */
1422 /* ?table_size@?$ctype@D@std@@2_KB */
1423 MSVCP_size_t ctype_char_table_size = 256;
1425 /* ??_7?$ctype@D@std@@6B@ */
1426 extern const vtable_ptr MSVCP_ctype_char_vtable;
1428 /* ?_Id_func@?$ctype@D@std@@SAAAVid@locale@2@XZ */
1429 /* ?_Id_func@?$ctype@D@std@@SAAEAVid@locale@2@XZ */
1430 locale_id* __cdecl ctype_char__Id_func(void)
1432 TRACE("()\n");
1433 return &ctype_char_id;
1436 /* ?_Init@?$ctype@D@std@@IAEXABV_Locinfo@2@@Z */
1437 /* ?_Init@?$ctype@D@std@@IEAAXAEBV_Locinfo@2@@Z */
1438 DEFINE_THISCALL_WRAPPER(ctype_char__Init, 8)
1439 void __thiscall ctype_char__Init(ctype_char *this, const _Locinfo *locinfo)
1441 TRACE("(%p %p)\n", this, locinfo);
1442 _Locinfo__Getctype(locinfo, &this->ctype);
1445 /* ?_Tidy@?$ctype@D@std@@IAEXXZ */
1446 /* ?_Tidy@?$ctype@D@std@@IEAAXXZ */
1447 DEFINE_THISCALL_WRAPPER(ctype_char__Tidy, 4)
1448 void __thiscall ctype_char__Tidy(ctype_char *this)
1450 TRACE("(%p)\n", this);
1452 if(this->ctype.delfl)
1453 free((short*)this->ctype.table);
1454 #if _MSVCP_VER >= 110
1455 free(this->ctype.name);
1456 #endif
1459 /* ?classic_table@?$ctype@D@std@@KAPBFXZ */
1460 /* ?classic_table@?$ctype@D@std@@KAPEBFXZ */
1461 const short* __cdecl ctype_char_classic_table(void)
1463 ctype_char *ctype;
1465 TRACE("()\n");
1466 ctype = ctype_char_use_facet( locale_classic() );
1467 return ctype->ctype.table;
1470 /* ??0?$ctype@D@std@@QAE@ABV_Locinfo@1@I@Z */
1471 /* ??0?$ctype@D@std@@QEAA@AEBV_Locinfo@1@_K@Z */
1472 DEFINE_THISCALL_WRAPPER(ctype_char_ctor_locinfo, 12)
1473 ctype_char* __thiscall ctype_char_ctor_locinfo(ctype_char *this,
1474 const _Locinfo *locinfo, MSVCP_size_t refs)
1476 TRACE("(%p %p %lu)\n", this, locinfo, refs);
1477 ctype_base_ctor_refs(&this->base, refs);
1478 this->base.facet.vtable = &MSVCP_ctype_char_vtable;
1479 ctype_char__Init(this, locinfo);
1480 return this;
1483 /* ??0?$ctype@D@std@@QAE@PBF_NI@Z */
1484 /* ??0?$ctype@D@std@@QEAA@PEBF_N_K@Z */
1485 DEFINE_THISCALL_WRAPPER(ctype_char_ctor_table, 16)
1486 ctype_char* __thiscall ctype_char_ctor_table(ctype_char *this,
1487 const short *table, MSVCP_bool delete, MSVCP_size_t refs)
1489 _Locinfo locinfo;
1491 TRACE("(%p %p %d %lu)\n", this, table, delete, refs);
1493 ctype_base_ctor_refs(&this->base, refs);
1494 this->base.facet.vtable = &MSVCP_ctype_char_vtable;
1496 _Locinfo_ctor(&locinfo);
1497 ctype_char__Init(this, &locinfo);
1498 _Locinfo_dtor(&locinfo);
1500 if(table) {
1501 ctype_char__Tidy(this);
1502 this->ctype.table = table;
1503 this->ctype.delfl = delete;
1505 return this;
1508 /* ??_F?$ctype@D@std@@QAEXXZ */
1509 /* ??_F?$ctype@D@std@@QEAAXXZ */
1510 DEFINE_THISCALL_WRAPPER(ctype_char_ctor, 4)
1511 ctype_char* __thiscall ctype_char_ctor(ctype_char *this)
1513 return ctype_char_ctor_table(this, NULL, FALSE, 0);
1516 /* ??1?$ctype@D@std@@MAE@XZ */
1517 /* ??1?$ctype@D@std@@MEAA@XZ */
1518 DEFINE_THISCALL_WRAPPER(ctype_char_dtor, 4)
1519 void __thiscall ctype_char_dtor(ctype_char *this)
1521 TRACE("(%p)\n", this);
1522 ctype_char__Tidy(this);
1525 DEFINE_THISCALL_WRAPPER(ctype_char_vector_dtor, 8)
1526 ctype_char* __thiscall ctype_char_vector_dtor(ctype_char *this, unsigned int flags)
1528 TRACE("(%p %x)\n", this, flags);
1529 if(flags & 2) {
1530 /* we have an array, with the number of elements stored before the first object */
1531 INT_PTR i, *ptr = (INT_PTR *)this-1;
1533 for(i=*ptr-1; i>=0; i--)
1534 ctype_char_dtor(this+i);
1535 MSVCRT_operator_delete(ptr);
1536 } else {
1537 ctype_char_dtor(this);
1538 if(flags & 1)
1539 MSVCRT_operator_delete(this);
1542 return this;
1545 /* ?do_narrow@?$ctype@D@std@@MBEDDD@Z */
1546 /* ?do_narrow@?$ctype@D@std@@MEBADDD@Z */
1547 DEFINE_THISCALL_WRAPPER(ctype_char_do_narrow_ch, 12)
1548 #if _MSVCP_VER >= 80 && _MSVCP_VER <= 90
1549 #define call_ctype_char_do_narrow_ch(this, ch, unused) CALL_VTBL_FUNC(this, 36, \
1550 char, (const ctype_char*, char, char), (this, ch, unused))
1551 #elif _MSVCP_VER <= 100
1552 #define call_ctype_char_do_narrow_ch(this, ch, unused) CALL_VTBL_FUNC(this, 32, \
1553 char, (const ctype_char*, char, char), (this, ch, unused))
1554 #else
1555 #define call_ctype_char_do_narrow_ch(this, ch, unused) CALL_VTBL_FUNC(this, 40, \
1556 char, (const ctype_char*, char, char), (this, ch, unused))
1557 #endif
1558 char __thiscall ctype_char_do_narrow_ch(const ctype_char *this, char ch, char unused)
1560 TRACE("(%p %c %c)\n", this, ch, unused);
1561 return ch;
1564 /* ?do_narrow@?$ctype@D@std@@MBEPBDPBD0DPAD@Z */
1565 /* ?do_narrow@?$ctype@D@std@@MEBAPEBDPEBD0DPEAD@Z */
1566 DEFINE_THISCALL_WRAPPER(ctype_char_do_narrow, 20)
1567 #if _MSVCP_VER >= 80 && _MSVCP_VER <= 90
1568 #define call_ctype_char_do_narrow(this, first, last, unused, dest) CALL_VTBL_FUNC(this, 32, \
1569 const char*, (const ctype_char*, const char*, const char*, char, char*), \
1570 (this, first, last, unused, dest))
1571 #elif _MSVCP_VER <= 100
1572 #define call_ctype_char_do_narrow(this, first, last, unused, dest) CALL_VTBL_FUNC(this, 28, \
1573 const char*, (const ctype_char*, const char*, const char*, char, char*), \
1574 (this, first, last, unused, dest))
1575 #else
1576 #define call_ctype_char_do_narrow(this, first, last, unused, dest) CALL_VTBL_FUNC(this, 36, \
1577 const char*, (const ctype_char*, const char*, const char*, char, char*), \
1578 (this, first, last, unused, dest))
1579 #endif
1580 const char* __thiscall ctype_char_do_narrow(const ctype_char *this,
1581 const char *first, const char *last, char unused, char *dest)
1583 TRACE("(%p %p %p %p)\n", this, first, last, dest);
1584 memcpy(dest, first, last-first);
1585 return last;
1588 /* ?_Do_narrow_s@?$ctype@D@std@@MBEPBDPBD0DPADI@Z */
1589 /* ?_Do_narrow_s@?$ctype@D@std@@MEBAPEBDPEBD0DPEAD_K@Z */
1590 DEFINE_THISCALL_WRAPPER(ctype_char__Do_narrow_s, 24)
1591 #define call_ctype_char__Do_narrow_s(this, first, last, unused, dest, size) CALL_VTBL_FUNC(this, 40, \
1592 const char*, (const ctype_char*, const char*, const char*, char, char*, MSVCP_size_t), \
1593 (this, first, last, unused, dest, size))
1594 const char* __thiscall ctype_char__Do_narrow_s(const ctype_char *this, const char *first,
1595 const char *last, char unused, char *dest, MSVCP_size_t size)
1597 TRACE("(%p %p %p %p %lu)\n", this, first, last, dest, size);
1598 memcpy_s(dest, size, first, last-first);
1599 return last;
1602 /* ?narrow@?$ctype@D@std@@QBEDDD@Z */
1603 /* ?narrow@?$ctype@D@std@@QEBADDD@Z */
1604 DEFINE_THISCALL_WRAPPER(ctype_char_narrow_ch, 12)
1605 char __thiscall ctype_char_narrow_ch(const ctype_char *this, char ch, char dflt)
1607 TRACE("(%p %c %c)\n", this, ch, dflt);
1608 return call_ctype_char_do_narrow_ch(this, ch, dflt);
1611 /* ?narrow@?$ctype@D@std@@QBEPBDPBD0DPAD@Z */
1612 /* ?narrow@?$ctype@D@std@@QEBAPEBDPEBD0DPEAD@Z */
1613 DEFINE_THISCALL_WRAPPER(ctype_char_narrow, 20)
1614 const char* __thiscall ctype_char_narrow(const ctype_char *this,
1615 const char *first, const char *last, char dflt, char *dest)
1617 TRACE("(%p %p %p %c %p)\n", this, first, last, dflt, dest);
1618 return call_ctype_char_do_narrow(this, first, last, dflt, dest);
1621 /* ?_Narrow_s@?$ctype@D@std@@QBEPBDPBD0DPADI@Z */
1622 /* ?_Narrow_s@?$ctype@D@std@@QEBAPEBDPEBD0DPEAD_K@Z */
1623 DEFINE_THISCALL_WRAPPER(ctype_char__Narrow_s, 24)
1624 const char* __thiscall ctype_char__Narrow_s(const ctype_char *this, const char *first,
1625 const char *last, char dflt, char *dest, MSVCP_size_t size)
1627 TRACE("(%p %p %p %p %lu)\n", this, first, last, dest, size);
1628 return call_ctype_char__Do_narrow_s(this, first, last, dflt, dest, size);
1631 /* ?do_widen@?$ctype@D@std@@MBEDD@Z */
1632 /* ?do_widen@?$ctype@D@std@@MEBADD@Z */
1633 DEFINE_THISCALL_WRAPPER(ctype_char_do_widen_ch, 8)
1634 #if _MSVCP_VER <= 100
1635 #define call_ctype_char_do_widen_ch(this, ch) CALL_VTBL_FUNC(this, 24, \
1636 char, (const ctype_char*, char), (this, ch))
1637 #else
1638 #define call_ctype_char_do_widen_ch(this, ch) CALL_VTBL_FUNC(this, 32, \
1639 char, (const ctype_char*, char), (this, ch))
1640 #endif
1641 char __thiscall ctype_char_do_widen_ch(const ctype_char *this, char ch)
1643 TRACE("(%p %c)\n", this, ch);
1644 return ch;
1647 /* ?do_widen@?$ctype@D@std@@MBEPBDPBD0PAD@Z */
1648 /* ?do_widen@?$ctype@D@std@@MEBAPEBDPEBD0PEAD@Z */
1649 DEFINE_THISCALL_WRAPPER(ctype_char_do_widen, 16)
1650 #if _MSVCP_VER <= 100
1651 #define call_ctype_char_do_widen(this, first, last, dest) CALL_VTBL_FUNC(this, 20, \
1652 const char*, (const ctype_char*, const char*, const char*, char*), \
1653 (this, first, last, dest))
1654 #else
1655 #define call_ctype_char_do_widen(this, first, last, dest) CALL_VTBL_FUNC(this, 28, \
1656 const char*, (const ctype_char*, const char*, const char*, char*), \
1657 (this, first, last, dest))
1658 #endif
1659 const char* __thiscall ctype_char_do_widen(const ctype_char *this,
1660 const char *first, const char *last, char *dest)
1662 TRACE("(%p %p %p %p)\n", this, first, last, dest);
1663 memcpy(dest, first, last-first);
1664 return last;
1667 /* ?_Do_widen_s@?$ctype@D@std@@MBEPBDPBD0PADI@Z */
1668 /* ?_Do_widen_s@?$ctype@D@std@@MEBAPEBDPEBD0PEAD_K@Z */
1669 DEFINE_THISCALL_WRAPPER(ctype_char__Do_widen_s, 20)
1670 #define call_ctype_char__Do_widen_s(this, first, last, dest, size) CALL_VTBL_FUNC(this, 28, \
1671 const char*, (const ctype_char*, const char*, const char*, char*, MSVCP_size_t), \
1672 (this, first, last, dest, size))
1673 const char* __thiscall ctype_char__Do_widen_s(const ctype_char *this,
1674 const char *first, const char *last, char *dest, MSVCP_size_t size)
1676 TRACE("(%p %p %p %p %lu)\n", this, first, last, dest, size);
1677 memcpy_s(dest, size, first, last-first);
1678 return last;
1681 /* ?widen@?$ctype@D@std@@QBEDD@Z */
1682 /* ?widen@?$ctype@D@std@@QEBADD@Z */
1683 DEFINE_THISCALL_WRAPPER(ctype_char_widen_ch, 8)
1684 char __thiscall ctype_char_widen_ch(const ctype_char *this, char ch)
1686 TRACE("(%p %c)\n", this, ch);
1687 return call_ctype_char_do_widen_ch(this, ch);
1690 /* ?widen@?$ctype@D@std@@QBEPBDPBD0PAD@Z */
1691 /* ?widen@?$ctype@D@std@@QEBAPEBDPEBD0PEAD@Z */
1692 DEFINE_THISCALL_WRAPPER(ctype_char_widen, 16)
1693 const char* __thiscall ctype_char_widen(const ctype_char *this,
1694 const char *first, const char *last, char *dest)
1696 TRACE("(%p %p %p %p)\n", this, first, last, dest);
1697 return call_ctype_char_do_widen(this, first, last, dest);
1700 /* ?_Widen_s@?$ctype@D@std@@QBEPBDPBD0PADI@Z */
1701 /* ?_Widen_s@?$ctype@D@std@@QEBAPEBDPEBD0PEAD_K@Z */
1702 DEFINE_THISCALL_WRAPPER(ctype_char__Widen_s, 20)
1703 const char* __thiscall ctype_char__Widen_s(const ctype_char *this,
1704 const char *first, const char *last, char *dest, MSVCP_size_t size)
1706 TRACE("(%p %p %p %p %lu)\n", this, first, last, dest, size);
1707 return call_ctype_char__Do_widen_s(this, first, last, dest, size);
1710 /* ?_Getcat@?$ctype@D@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
1711 /* ?_Getcat@?$ctype@D@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
1712 MSVCP_size_t __cdecl ctype_char__Getcat(const locale_facet **facet, const locale *loc)
1714 TRACE("(%p %p)\n", facet, loc);
1716 if(facet && !*facet) {
1717 _Locinfo locinfo;
1719 *facet = MSVCRT_operator_new(sizeof(ctype_char));
1720 if(!*facet) {
1721 ERR("Out of memory\n");
1722 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
1723 return 0;
1726 _Locinfo_ctor_cstr(&locinfo, locale_string_char_c_str(&loc->ptr->name));
1727 ctype_char_ctor_locinfo((ctype_char*)*facet, &locinfo, 0);
1728 _Locinfo_dtor(&locinfo);
1731 return LC_CTYPE;
1734 /* ?_Getcat@?$ctype@D@std@@SAIPAPBVfacet@locale@2@@Z */
1735 /* ?_Getcat@?$ctype@D@std@@SA_KPEAPEBVfacet@locale@2@@Z */
1736 MSVCP_size_t __cdecl ctype_char__Getcat_old(const locale_facet **facet)
1738 return ctype_char__Getcat(facet, locale_classic());
1741 ctype_char* ctype_char_use_facet(const locale *loc)
1743 static ctype_char *obj = NULL;
1745 _Lockit lock;
1746 const locale_facet *fac;
1748 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
1749 fac = locale__Getfacet(loc, locale_id_operator_size_t(&ctype_char_id));
1750 if(fac) {
1751 _Lockit_dtor(&lock);
1752 return (ctype_char*)fac;
1755 if(obj) {
1756 _Lockit_dtor(&lock);
1757 return obj;
1760 ctype_char__Getcat(&fac, loc);
1761 obj = (ctype_char*)fac;
1762 call_locale_facet__Incref(&obj->base.facet);
1763 locale_facet_register(&obj->base.facet);
1764 _Lockit_dtor(&lock);
1766 return obj;
1769 /* _Tolower */
1770 int __cdecl _Tolower(int ch, const _Ctypevec *ctype)
1772 unsigned int cp;
1774 TRACE("%d %p\n", ch, ctype);
1776 if(ctype)
1777 cp = ctype->page;
1778 else
1779 cp = ___lc_codepage_func();
1781 /* Don't convert to unicode in case of C locale */
1782 if(!cp) {
1783 if(ch>='A' && ch<='Z')
1784 ch = ch-'A'+'a';
1785 return ch;
1786 } else {
1787 WCHAR wide, lower;
1788 char str[2];
1789 int size;
1791 if(ch > 255) {
1792 str[0] = (ch>>8) & 255;
1793 str[1] = ch & 255;
1794 size = 2;
1795 } else {
1796 str[0] = ch & 255;
1797 size = 1;
1800 if(!MultiByteToWideChar(cp, MB_ERR_INVALID_CHARS, str, size, &wide, 1))
1801 return ch;
1803 lower = tolowerW(wide);
1804 if(lower == wide)
1805 return ch;
1807 WideCharToMultiByte(cp, 0, &lower, 1, str, 2, NULL, NULL);
1809 return str[0] + (str[1]<<8);
1813 /* ?do_tolower@?$ctype@D@std@@MBEDD@Z */
1814 /* ?do_tolower@?$ctype@D@std@@MEBADD@Z */
1815 #if _MSVCP_VER <= 100
1816 #define call_ctype_char_do_tolower_ch(this, ch) CALL_VTBL_FUNC(this, 8, \
1817 char, (const ctype_char*, char), (this, ch))
1818 #else
1819 #define call_ctype_char_do_tolower_ch(this, ch) CALL_VTBL_FUNC(this, 16, \
1820 char, (const ctype_char*, char), (this, ch))
1821 #endif
1822 DEFINE_THISCALL_WRAPPER(ctype_char_do_tolower_ch, 8)
1823 char __thiscall ctype_char_do_tolower_ch(const ctype_char *this, char ch)
1825 TRACE("(%p %c)\n", this, ch);
1826 return _Tolower(ch, &this->ctype);
1829 /* ?do_tolower@?$ctype@D@std@@MBEPBDPADPBD@Z */
1830 /* ?do_tolower@?$ctype@D@std@@MEBAPEBDPEADPEBD@Z */
1831 #if _MSVCP_VER <= 100
1832 #define call_ctype_char_do_tolower(this, first, last) CALL_VTBL_FUNC(this, 4, \
1833 const char*, (const ctype_char*, char*, const char*), (this, first, last))
1834 #else
1835 #define call_ctype_char_do_tolower(this, first, last) CALL_VTBL_FUNC(this, 12, \
1836 const char*, (const ctype_char*, char*, const char*), (this, first, last))
1837 #endif
1838 DEFINE_THISCALL_WRAPPER(ctype_char_do_tolower, 12)
1839 const char* __thiscall ctype_char_do_tolower(const ctype_char *this, char *first, const char *last)
1841 TRACE("(%p %p %p)\n", this, first, last);
1842 for(; first<last; first++)
1843 *first = _Tolower(*first, &this->ctype);
1844 return last;
1847 /* ?tolower@?$ctype@D@std@@QBEDD@Z */
1848 /* ?tolower@?$ctype@D@std@@QEBADD@Z */
1849 DEFINE_THISCALL_WRAPPER(ctype_char_tolower_ch, 8)
1850 char __thiscall ctype_char_tolower_ch(const ctype_char *this, char ch)
1852 TRACE("(%p %c)\n", this, ch);
1853 return call_ctype_char_do_tolower_ch(this, ch);
1856 /* ?tolower@?$ctype@D@std@@QBEPBDPADPBD@Z */
1857 /* ?tolower@?$ctype@D@std@@QEBAPEBDPEADPEBD@Z */
1858 DEFINE_THISCALL_WRAPPER(ctype_char_tolower, 12)
1859 const char* __thiscall ctype_char_tolower(const ctype_char *this, char *first, const char *last)
1861 TRACE("(%p %p %p)\n", this, first, last);
1862 return call_ctype_char_do_tolower(this, first, last);
1865 /* _Toupper */
1866 int __cdecl _Toupper(int ch, const _Ctypevec *ctype)
1868 unsigned int cp;
1870 TRACE("%d %p\n", ch, ctype);
1872 if(ctype)
1873 cp = ctype->page;
1874 else
1875 cp = ___lc_codepage_func();
1877 /* Don't convert to unicode in case of C locale */
1878 if(!cp) {
1879 if(ch>='a' && ch<='z')
1880 ch = ch-'a'+'A';
1881 return ch;
1882 } else {
1883 WCHAR wide, upper;
1884 char str[2];
1885 int size;
1887 if(ch > 255) {
1888 str[0] = (ch>>8) & 255;
1889 str[1] = ch & 255;
1890 size = 2;
1891 } else {
1892 str[0] = ch & 255;
1893 size = 1;
1896 if(!MultiByteToWideChar(cp, MB_ERR_INVALID_CHARS, str, size, &wide, 1))
1897 return ch;
1899 upper = toupperW(wide);
1900 if(upper == wide)
1901 return ch;
1903 WideCharToMultiByte(cp, 0, &upper, 1, str, 2, NULL, NULL);
1905 return str[0] + (str[1]<<8);
1909 /* ?do_toupper@?$ctype@D@std@@MBEDD@Z */
1910 /* ?do_toupper@?$ctype@D@std@@MEBADD@Z */
1911 #if _MSVCP_VER <= 100
1912 #define call_ctype_char_do_toupper_ch(this, ch) CALL_VTBL_FUNC(this, 16, \
1913 char, (const ctype_char*, char), (this, ch))
1914 #else
1915 #define call_ctype_char_do_toupper_ch(this, ch) CALL_VTBL_FUNC(this, 24, \
1916 char, (const ctype_char*, char), (this, ch))
1917 #endif
1918 DEFINE_THISCALL_WRAPPER(ctype_char_do_toupper_ch, 8)
1919 char __thiscall ctype_char_do_toupper_ch(const ctype_char *this, char ch)
1921 TRACE("(%p %c)\n", this, ch);
1922 return _Toupper(ch, &this->ctype);
1925 /* ?do_toupper@?$ctype@D@std@@MBEPBDPADPBD@Z */
1926 /* ?do_toupper@?$ctype@D@std@@MEBAPEBDPEADPEBD@Z */
1927 #if _MSVCP_VER <= 100
1928 #define call_ctype_char_do_toupper(this, first, last) CALL_VTBL_FUNC(this, 12, \
1929 const char*, (const ctype_char*, char*, const char*), (this, first, last))
1930 #else
1931 #define call_ctype_char_do_toupper(this, first, last) CALL_VTBL_FUNC(this, 20, \
1932 const char*, (const ctype_char*, char*, const char*), (this, first, last))
1933 #endif
1934 DEFINE_THISCALL_WRAPPER(ctype_char_do_toupper, 12)
1935 const char* __thiscall ctype_char_do_toupper(const ctype_char *this,
1936 char *first, const char *last)
1938 TRACE("(%p %p %p)\n", this, first, last);
1939 for(; first<last; first++)
1940 *first = _Toupper(*first, &this->ctype);
1941 return last;
1944 /* ?toupper@?$ctype@D@std@@QBEDD@Z */
1945 /* ?toupper@?$ctype@D@std@@QEBADD@Z */
1946 DEFINE_THISCALL_WRAPPER(ctype_char_toupper_ch, 8)
1947 char __thiscall ctype_char_toupper_ch(const ctype_char *this, char ch)
1949 TRACE("(%p %c)\n", this, ch);
1950 return call_ctype_char_do_toupper_ch(this, ch);
1953 /* ?toupper@?$ctype@D@std@@QBEPBDPADPBD@Z */
1954 /* ?toupper@?$ctype@D@std@@QEBAPEBDPEADPEBD@Z */
1955 DEFINE_THISCALL_WRAPPER(ctype_char_toupper, 12)
1956 const char* __thiscall ctype_char_toupper(const ctype_char *this, char *first, const char *last)
1958 TRACE("(%p %p %p)\n", this, first, last);
1959 return call_ctype_char_do_toupper(this, first, last);
1962 /* ?is@?$ctype@D@std@@QBE_NFD@Z */
1963 /* ?is@?$ctype@D@std@@QEBA_NFD@Z */
1964 DEFINE_THISCALL_WRAPPER(ctype_char_is_ch, 12)
1965 MSVCP_bool __thiscall ctype_char_is_ch(const ctype_char *this, short mask, char ch)
1967 TRACE("(%p %x %c)\n", this, mask, ch);
1968 return (this->ctype.table[(unsigned char)ch] & mask) != 0;
1971 /* ?is@?$ctype@D@std@@QBEPBDPBD0PAF@Z */
1972 /* ?is@?$ctype@D@std@@QEBAPEBDPEBD0PEAF@Z */
1973 DEFINE_THISCALL_WRAPPER(ctype_char_is, 16)
1974 const char* __thiscall ctype_char_is(const ctype_char *this, const char *first, const char *last, short *dest)
1976 TRACE("(%p %p %p %p)\n", this, first, last, dest);
1977 for(; first<last; first++)
1978 *dest++ = this->ctype.table[(unsigned char)*first];
1979 return last;
1982 /* ?scan_is@?$ctype@D@std@@QBEPBDFPBD0@Z */
1983 /* ?scan_is@?$ctype@D@std@@QEBAPEBDFPEBD0@Z */
1984 DEFINE_THISCALL_WRAPPER(ctype_char_scan_is, 16)
1985 const char* __thiscall ctype_char_scan_is(const ctype_char *this, short mask, const char *first, const char *last)
1987 TRACE("(%p %x %p %p)\n", this, mask, first, last);
1988 for(; first<last; first++)
1989 if(!ctype_char_is_ch(this, mask, *first))
1990 break;
1991 return first;
1994 /* ?scan_not@?$ctype@D@std@@QBEPBDFPBD0@Z */
1995 /* ?scan_not@?$ctype@D@std@@QEBAPEBDFPEBD0@Z */
1996 DEFINE_THISCALL_WRAPPER(ctype_char_scan_not, 16)
1997 const char* __thiscall ctype_char_scan_not(const ctype_char *this, short mask, const char *first, const char *last)
1999 TRACE("(%p %x %p %p)\n", this, mask, first, last);
2000 for(; first<last; first++)
2001 if(ctype_char_is_ch(this, mask, *first))
2002 break;
2003 return first;
2006 /* ?table@?$ctype@D@std@@IBEPBFXZ */
2007 /* ?table@?$ctype@D@std@@IEBAPEBFXZ */
2008 DEFINE_THISCALL_WRAPPER(ctype_char_table, 4)
2009 const short* __thiscall ctype_char_table(const ctype_char *this)
2011 TRACE("(%p)\n", this);
2012 return this->ctype.table;
2015 /* ?id@?$ctype@_W@std@@2V0locale@2@A */
2016 locale_id ctype_wchar_id = {0};
2017 /* ?id@?$ctype@G@std@@2V0locale@2@A */
2018 locale_id ctype_short_id = {0};
2020 /* ??_7?$ctype@_W@std@@6B@ */
2021 extern const vtable_ptr MSVCP_ctype_wchar_vtable;
2022 /* ??_7?$ctype@G@std@@6B@ */
2023 extern const vtable_ptr MSVCP_ctype_short_vtable;
2025 /* ?_Id_func@?$ctype@_W@std@@SAAAVid@locale@2@XZ */
2026 /* ?_Id_func@?$ctype@_W@std@@SAAEAVid@locale@2@XZ */
2027 locale_id* __cdecl ctype_wchar__Id_func(void)
2029 TRACE("()\n");
2030 return &ctype_wchar_id;
2033 /* ?_Id_func@?$ctype@G@std@@SAAAVid@locale@2@XZ */
2034 /* ?_Id_func@?$ctype@G@std@@SAAEAVid@locale@2@XZ */
2035 locale_id* __cdecl ctype_short__Id_func(void)
2037 TRACE("()\n");
2038 return &ctype_short_id;
2041 /* ?_Init@?$ctype@_W@std@@IAEXABV_Locinfo@2@@Z */
2042 /* ?_Init@?$ctype@_W@std@@IEAAXAEBV_Locinfo@2@@Z */
2043 /* ?_Init@?$ctype@G@std@@IAEXABV_Locinfo@2@@Z */
2044 /* ?_Init@?$ctype@G@std@@IEAAXAEBV_Locinfo@2@@Z */
2045 DEFINE_THISCALL_WRAPPER(ctype_wchar__Init, 8)
2046 void __thiscall ctype_wchar__Init(ctype_wchar *this, const _Locinfo *locinfo)
2048 TRACE("(%p %p)\n", this, locinfo);
2049 _Locinfo__Getctype(locinfo, &this->ctype);
2050 _Locinfo__Getcvt(locinfo, &this->cvt);
2053 /* ??0?$ctype@_W@std@@QAE@ABV_Locinfo@1@I@Z */
2054 /* ??0?$ctype@_W@std@@QEAA@AEBV_Locinfo@1@_K@Z */
2055 DEFINE_THISCALL_WRAPPER(ctype_wchar_ctor_locinfo, 12)
2056 ctype_wchar* __thiscall ctype_wchar_ctor_locinfo(ctype_wchar *this,
2057 const _Locinfo *locinfo, MSVCP_size_t refs)
2059 TRACE("(%p %p %lu)\n", this, locinfo, refs);
2060 ctype_base_ctor_refs(&this->base, refs);
2061 this->base.facet.vtable = &MSVCP_ctype_wchar_vtable;
2062 ctype_wchar__Init(this, locinfo);
2063 return this;
2066 /* ??0?$ctype@G@std@@QAE@ABV_Locinfo@1@I@Z */
2067 /* ??0?$ctype@G@std@@QEAA@AEBV_Locinfo@1@_K@Z */
2068 DEFINE_THISCALL_WRAPPER(ctype_short_ctor_locinfo, 12)
2069 ctype_wchar* __thiscall ctype_short_ctor_locinfo(ctype_wchar *this,
2070 const _Locinfo *locinfo, MSVCP_size_t refs)
2072 ctype_wchar *ret = ctype_wchar_ctor_locinfo(this, locinfo, refs);
2073 this->base.facet.vtable = &MSVCP_ctype_short_vtable;
2074 return ret;
2077 /* ??0?$ctype@_W@std@@QAE@I@Z */
2078 /* ??0?$ctype@_W@std@@QEAA@_K@Z */
2079 DEFINE_THISCALL_WRAPPER(ctype_wchar_ctor_refs, 8)
2080 ctype_wchar* __thiscall ctype_wchar_ctor_refs(ctype_wchar *this, MSVCP_size_t refs)
2082 _Locinfo locinfo;
2084 TRACE("(%p %lu)\n", this, refs);
2086 ctype_base_ctor_refs(&this->base, refs);
2087 this->base.facet.vtable = &MSVCP_ctype_wchar_vtable;
2089 _Locinfo_ctor(&locinfo);
2090 ctype_wchar__Init(this, &locinfo);
2091 _Locinfo_dtor(&locinfo);
2092 return this;
2095 /* ??0?$ctype@G@std@@QAE@I@Z */
2096 /* ??0?$ctype@G@std@@QEAA@_K@Z */
2097 DEFINE_THISCALL_WRAPPER(ctype_short_ctor_refs, 8)
2098 ctype_wchar* __thiscall ctype_short_ctor_refs(ctype_wchar *this, MSVCP_size_t refs)
2100 ctype_wchar *ret = ctype_wchar_ctor_refs(this, refs);
2101 this->base.facet.vtable = &MSVCP_ctype_short_vtable;
2102 return ret;
2105 /* ??0?$ctype@G@std@@IAE@PBDI@Z */
2106 /* ??0?$ctype@G@std@@IEAA@PEBD_K@Z */
2107 DEFINE_THISCALL_WRAPPER(ctype_short_ctor_name, 12)
2108 ctype_wchar* __thiscall ctype_short_ctor_name(ctype_wchar *this,
2109 const char *name, MSVCP_size_t refs)
2111 _Locinfo locinfo;
2113 TRACE("(%p %s %lu)\n", this, debugstr_a(name), refs);
2115 ctype_base_ctor_refs(&this->base, refs);
2116 this->base.facet.vtable = &MSVCP_ctype_short_vtable;
2118 _Locinfo_ctor_cstr(&locinfo, name);
2119 ctype_wchar__Init(this, &locinfo);
2120 _Locinfo_dtor(&locinfo);
2121 return this;
2124 /* ??_F?$ctype@_W@std@@QAEXXZ */
2125 /* ??_F?$ctype@_W@std@@QEAAXXZ */
2126 DEFINE_THISCALL_WRAPPER(ctype_wchar_ctor, 4)
2127 ctype_wchar* __thiscall ctype_wchar_ctor(ctype_wchar *this)
2129 TRACE("(%p)\n", this);
2130 return ctype_short_ctor_refs(this, 0);
2133 /* ??_F?$ctype@G@std@@QAEXXZ */
2134 /* ??_F?$ctype@G@std@@QEAAXXZ */
2135 DEFINE_THISCALL_WRAPPER(ctype_short_ctor, 4)
2136 ctype_wchar* __thiscall ctype_short_ctor(ctype_wchar *this)
2138 ctype_wchar *ret = ctype_wchar_ctor(this);
2139 this->base.facet.vtable = &MSVCP_ctype_short_vtable;
2140 return ret;
2143 /* ??1?$ctype@_W@std@@MAE@XZ */
2144 /* ??1?$ctype@_W@std@@MEAA@XZ */
2145 /* ??1?$ctype@G@std@@MAE@XZ */
2146 /* ??1?$ctype@G@std@@MEAA@XZ */
2147 DEFINE_THISCALL_WRAPPER(ctype_wchar_dtor, 4)
2148 void __thiscall ctype_wchar_dtor(ctype_wchar *this)
2150 TRACE("(%p)\n", this);
2151 if(this->ctype.delfl)
2152 free((void*)this->ctype.table);
2153 #if _MSVCP_VER >= 110
2154 free(this->ctype.name);
2155 #endif
2158 DEFINE_THISCALL_WRAPPER(ctype_wchar_vector_dtor, 8)
2159 ctype_wchar* __thiscall ctype_wchar_vector_dtor(ctype_wchar *this, unsigned int flags)
2161 TRACE("(%p %x)\n", this, flags);
2162 if(flags & 2) {
2163 /* we have an array, with the number of elements stored before the first object */
2164 INT_PTR i, *ptr = (INT_PTR *)this-1;
2166 for(i=*ptr-1; i>=0; i--)
2167 ctype_wchar_dtor(this+i);
2168 MSVCRT_operator_delete(ptr);
2169 } else {
2170 ctype_wchar_dtor(this);
2171 if(flags & 1)
2172 MSVCRT_operator_delete(this);
2175 return this;
2178 /* _Wcrtomb */
2179 int __cdecl _Wcrtomb(char *s, wchar_t wch, int *state, const _Cvtvec *cvt)
2181 int cp, size;
2182 BOOL def;
2184 TRACE("%p %d %p %p\n", s, wch, state, cvt);
2186 if(cvt)
2187 cp = cvt->page;
2188 else
2189 cp = ___lc_codepage_func();
2191 if(!cp) {
2192 if(wch > 255) {
2193 *_errno() = EILSEQ;
2194 return -1;
2197 *s = wch & 255;
2198 return 1;
2201 size = WideCharToMultiByte(cp, 0, &wch, 1, s, MB_LEN_MAX, NULL, &def);
2202 if(!size || def) {
2203 *_errno() = EILSEQ;
2204 return -1;
2207 return size;
2210 /* ?_Donarrow@?$ctype@_W@std@@IBED_WD@Z */
2211 /* ?_Donarrow@?$ctype@_W@std@@IEBAD_WD@Z */
2212 /* ?_Donarrow@?$ctype@G@std@@IBEDGD@Z */
2213 /* ?_Donarrow@?$ctype@G@std@@IEBADGD@Z */
2214 DEFINE_THISCALL_WRAPPER(ctype_wchar__Donarrow, 12)
2215 char __thiscall ctype_wchar__Donarrow(const ctype_wchar *this, wchar_t ch, char dflt)
2217 char buf[MB_LEN_MAX];
2219 TRACE("(%p %d %d)\n", this, ch, dflt);
2221 return _Wcrtomb(buf, ch, NULL, &this->cvt)==1 ? buf[0] : dflt;
2224 /* ?do_narrow@?$ctype@_W@std@@MBED_WD@Z */
2225 /* ?do_narrow@?$ctype@_W@std@@MEBAD_WD@Z */
2226 /* ?do_narrow@?$ctype@G@std@@MBEDGD@Z */
2227 /* ?do_narrow@?$ctype@G@std@@MEBADGD@Z */
2228 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_narrow_ch, 12)
2229 #if _MSVCP_VER >= 80 && _MSVCP_VER <= 90
2230 #define call_ctype_wchar_do_narrow_ch(this, ch, dflt) CALL_VTBL_FUNC(this, 52, \
2231 char, (const ctype_wchar*, wchar_t, char), (this, ch, dflt))
2232 #elif _MSVCP_VER <= 100
2233 #define call_ctype_wchar_do_narrow_ch(this, ch, dflt) CALL_VTBL_FUNC(this, 48, \
2234 char, (const ctype_wchar*, wchar_t, char), (this, ch, dflt))
2235 #else
2236 #define call_ctype_wchar_do_narrow_ch(this, ch, dflt) CALL_VTBL_FUNC(this, 56, \
2237 char, (const ctype_wchar*, wchar_t, char), (this, ch, dflt))
2238 #endif
2239 char __thiscall ctype_wchar_do_narrow_ch(const ctype_wchar *this, wchar_t ch, char dflt)
2241 return ctype_wchar__Donarrow(this, ch, dflt);
2244 /* ?do_narrow@?$ctype@_W@std@@MBEPB_WPB_W0DPAD@Z */
2245 /* ?do_narrow@?$ctype@_W@std@@MEBAPEB_WPEB_W0DPEAD@Z */
2246 /* ?do_narrow@?$ctype@G@std@@MBEPBGPBG0DPAD@Z */
2247 /* ?do_narrow@?$ctype@G@std@@MEBAPEBGPEBG0DPEAD@Z */
2248 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_narrow, 20)
2249 #if _MSVCP_VER >= 80 && _MSVCP_VER <= 90
2250 #define call_ctype_wchar_do_narrow(this, first, last, dflt, dest) CALL_VTBL_FUNC(this, 48, \
2251 const wchar_t*, (const ctype_wchar*, const wchar_t*, const wchar_t*, char, char*), \
2252 (this, first, last, dflt, dest))
2253 #elif _MSVCP_VER <= 100
2254 #define call_ctype_wchar_do_narrow(this, first, last, dflt, dest) CALL_VTBL_FUNC(this, 44, \
2255 const wchar_t*, (const ctype_wchar*, const wchar_t*, const wchar_t*, char, char*), \
2256 (this, first, last, dflt, dest))
2257 #else
2258 #define call_ctype_wchar_do_narrow(this, first, last, dflt, dest) CALL_VTBL_FUNC(this, 52, \
2259 const wchar_t*, (const ctype_wchar*, const wchar_t*, const wchar_t*, char, char*), \
2260 (this, first, last, dflt, dest))
2261 #endif
2262 const wchar_t* __thiscall ctype_wchar_do_narrow(const ctype_wchar *this,
2263 const wchar_t *first, const wchar_t *last, char dflt, char *dest)
2265 TRACE("(%p %p %p %d %p)\n", this, first, last, dflt, dest);
2266 for(; first<last; first++)
2267 *dest++ = ctype_wchar__Donarrow(this, *first, dflt);
2268 return last;
2271 /* ?_Do_narrow_s@?$ctype@_W@std@@MBEPB_WPB_W0DPADI@Z */
2272 /* ?_Do_narrow_s@?$ctype@_W@std@@MEBAPEB_WPEB_W0DPEAD_K@Z */
2273 /* ?_Do_narrow_s@?$ctype@G@std@@MBEPBGPBG0DPADI@Z */
2274 /* ?_Do_narrow_s@?$ctype@G@std@@MEBAPEBGPEBG0DPEAD_K@Z */
2275 DEFINE_THISCALL_WRAPPER(ctype_wchar__Do_narrow_s, 24)
2276 #define call_ctype_wchar__Do_narrow_s(this, first, last, dflt, dest, size) CALL_VTBL_FUNC(this, 56, \
2277 const wchar_t*, (const ctype_wchar*, const wchar_t*, const wchar_t*, char, char*, MSVCP_size_t), \
2278 (this, first, last, dflt, dest, size))
2279 const wchar_t* __thiscall ctype_wchar__Do_narrow_s(const ctype_wchar *this,
2280 const wchar_t *first, const wchar_t *last, char dflt, char *dest, MSVCP_size_t size)
2282 TRACE("(%p %p %p %d %p %lu)\n", this, first, last, dflt, dest, size);
2283 /* This function converts all multi-byte characters to dflt,
2284 * thanks to it result size is known before converting */
2285 if(last-first > size)
2286 ctype_base__Xran();
2287 return ctype_wchar_do_narrow(this, first, last, dflt, dest);
2290 /* ?narrow@?$ctype@_W@std@@QBED_WD@Z */
2291 /* ?narrow@?$ctype@_W@std@@QEBAD_WD@Z */
2292 /* ?narrow@?$ctype@G@std@@QBEDGD@Z */
2293 /* ?narrow@?$ctype@G@std@@QEBADGD@Z */
2294 DEFINE_THISCALL_WRAPPER(ctype_wchar_narrow_ch, 12)
2295 char __thiscall ctype_wchar_narrow_ch(const ctype_wchar *this, wchar_t ch, char dflt)
2297 TRACE("(%p %d %d)\n", this, ch, dflt);
2298 return call_ctype_wchar_do_narrow_ch(this, ch, dflt);
2301 /* ?narrow@?$ctype@_W@std@@QBEPB_WPB_W0DPAD@Z */
2302 /* ?narrow@?$ctype@_W@std@@QEBAPEB_WPEB_W0DPEAD@Z */
2303 /* ?narrow@?$ctype@G@std@@QBEPBGPBG0DPAD@Z */
2304 /* ?narrow@?$ctype@G@std@@QEBAPEBGPEBG0DPEAD@Z */
2305 DEFINE_THISCALL_WRAPPER(ctype_wchar_narrow, 20)
2306 const wchar_t* __thiscall ctype_wchar_narrow(const ctype_wchar *this,
2307 const wchar_t *first, const wchar_t *last, char dflt, char *dest)
2309 TRACE("(%p %p %p %d %p)\n", this, first, last, dflt, dest);
2310 return call_ctype_wchar_do_narrow(this, first, last, dflt, dest);
2313 /* ?_Narrow_s@?$ctype@_W@std@@QBEPB_WPB_W0DPADI@Z */
2314 /* ?_Narrow_s@?$ctype@_W@std@@QEBAPEB_WPEB_W0DPEAD_K@Z */
2315 /* ?_Narrow_s@?$ctype@G@std@@QBEPBGPBG0DPADI@Z */
2316 /* ?_Narrow_s@?$ctype@G@std@@QEBAPEBGPEBG0DPEAD_K@Z */
2317 DEFINE_THISCALL_WRAPPER(ctype_wchar__Narrow_s, 24)
2318 const wchar_t* __thiscall ctype_wchar__Narrow_s(const ctype_wchar *this, const wchar_t *first,
2319 const wchar_t *last, char dflt, char *dest, MSVCP_size_t size)
2321 TRACE("(%p %p %p %d %p %lu)\n", this, first, last, dflt, dest, size);
2322 return call_ctype_wchar__Do_narrow_s(this, first, last, dflt, dest, size);
2325 /* _Mbrtowc */
2326 int __cdecl _Mbrtowc(wchar_t *out, const char *in, MSVCP_size_t len, int *state, const _Cvtvec *cvt)
2328 int i, cp;
2329 CPINFO cp_info;
2330 BOOL is_lead;
2332 TRACE("(%p %p %lu %p %p)\n", out, in, len, state, cvt);
2334 if(!len)
2335 return 0;
2337 if(cvt)
2338 cp = cvt->page;
2339 else
2340 cp = ___lc_codepage_func();
2342 if(!cp) {
2343 if(out)
2344 *out = (unsigned char)*in;
2346 *state = 0;
2347 return *in ? 1 : 0;
2350 if(*state) {
2351 ((char*)state)[1] = *in;
2353 if(!MultiByteToWideChar(cp, MB_ERR_INVALID_CHARS, (char*)state, 2, out, out ? 1 : 0)) {
2354 *state = 0;
2355 *_errno() = EILSEQ;
2356 return -1;
2359 *state = 0;
2360 return 2;
2363 GetCPInfo(cp, &cp_info);
2364 is_lead = FALSE;
2365 for(i=0; i<MAX_LEADBYTES; i+=2) {
2366 if(!cp_info.LeadByte[i+1])
2367 break;
2368 if((unsigned char)*in>=cp_info.LeadByte[i] && (unsigned char)*in<=cp_info.LeadByte[i+1]) {
2369 is_lead = TRUE;
2370 break;
2374 if(is_lead) {
2375 if(len == 1) {
2376 *state = (unsigned char)*in;
2377 return -2;
2380 if(!MultiByteToWideChar(cp, MB_ERR_INVALID_CHARS, in, 2, out, out ? 1 : 0)) {
2381 *_errno() = EILSEQ;
2382 return -1;
2384 return 2;
2387 if(!MultiByteToWideChar(cp, MB_ERR_INVALID_CHARS, in, 1, out, out ? 1 : 0)) {
2388 *_errno() = EILSEQ;
2389 return -1;
2391 return 1;
2394 /* ?_Dowiden@?$ctype@_W@std@@IBE_WD@Z */
2395 /* ?_Dowiden@?$ctype@_W@std@@IEBA_WD@Z */
2396 /* ?_Dowiden@?$ctype@G@std@@IBEGD@Z */
2397 /* ?_Dowiden@?$ctype@G@std@@IEBAGD@Z */
2398 DEFINE_THISCALL_WRAPPER(ctype_wchar__Dowiden, 8)
2399 wchar_t __thiscall ctype_wchar__Dowiden(const ctype_wchar *this, char ch)
2401 wchar_t ret;
2402 int state = 0;
2403 TRACE("(%p %d)\n", this, ch);
2404 return _Mbrtowc(&ret, &ch, 1, &state, &this->cvt)<0 ? WEOF : ret;
2407 /* ?do_widen@?$ctype@_W@std@@MBE_WD@Z */
2408 /* ?do_widen@?$ctype@_W@std@@MEBA_WD@Z */
2409 /* ?do_widen@?$ctype@G@std@@MBEGD@Z */
2410 /* ?do_widen@?$ctype@G@std@@MEBAGD@Z */
2411 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_widen_ch, 8)
2412 #if _MSVCP_VER <= 100
2413 #define call_ctype_wchar_do_widen_ch(this, ch) CALL_VTBL_FUNC(this, 40, \
2414 wchar_t, (const ctype_wchar*, char), (this, ch))
2415 #else
2416 #define call_ctype_wchar_do_widen_ch(this, ch) CALL_VTBL_FUNC(this, 48, \
2417 wchar_t, (const ctype_wchar*, char), (this, ch))
2418 #endif
2419 wchar_t __thiscall ctype_wchar_do_widen_ch(const ctype_wchar *this, char ch)
2421 return ctype_wchar__Dowiden(this, ch);
2424 /* ?do_widen@?$ctype@_W@std@@MBEPBDPBD0PA_W@Z */
2425 /* ?do_widen@?$ctype@_W@std@@MEBAPEBDPEBD0PEA_W@Z */
2426 /* ?do_widen@?$ctype@G@std@@MBEPBDPBD0PAG@Z */
2427 /* ?do_widen@?$ctype@G@std@@MEBAPEBDPEBD0PEAG@Z */
2428 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_widen, 16)
2429 #if _MSVCP_VER <= 100
2430 #define call_ctype_wchar_do_widen(this, first, last, dest) CALL_VTBL_FUNC(this, 36, \
2431 const char*, (const ctype_wchar*, const char*, const char*, wchar_t*), \
2432 (this, first, last, dest))
2433 #else
2434 #define call_ctype_wchar_do_widen(this, first, last, dest) CALL_VTBL_FUNC(this, 44, \
2435 const char*, (const ctype_wchar*, const char*, const char*, wchar_t*), \
2436 (this, first, last, dest))
2437 #endif
2438 const char* __thiscall ctype_wchar_do_widen(const ctype_wchar *this,
2439 const char *first, const char *last, wchar_t *dest)
2441 TRACE("(%p %p %p %p)\n", this, first, last, dest);
2442 for(; first<last; first++)
2443 *dest++ = ctype_wchar__Dowiden(this, *first);
2444 return last;
2447 /* ?_Do_widen_s@?$ctype@_W@std@@MBEPBDPBD0PA_WI@Z */
2448 /* ?_Do_widen_s@?$ctype@_W@std@@MEBAPEBDPEBD0PEA_W_K@Z */
2449 /* ?_Do_widen_s@?$ctype@G@std@@MBEPBDPBD0PAGI@Z */
2450 /* ?_Do_widen_s@?$ctype@G@std@@MEBAPEBDPEBD0PEAG_K@Z */
2451 DEFINE_THISCALL_WRAPPER(ctype_wchar__Do_widen_s, 20)
2452 #define call_ctype_wchar__Do_widen_s(this, first, last, dest, size) CALL_VTBL_FUNC(this, 44, \
2453 const char*, (const ctype_wchar*, const char*, const char*, wchar_t*, MSVCP_size_t), \
2454 (this, first, last, dest, size))
2455 const char* __thiscall ctype_wchar__Do_widen_s(const ctype_wchar *this,
2456 const char *first, const char *last, wchar_t *dest, MSVCP_size_t size)
2458 TRACE("(%p %p %p %p %lu)\n", this, first, last, dest, size);
2459 /* This function converts all multi-byte characters to WEOF,
2460 * thanks to it result size is known before converting */
2461 if(size < last-first)
2462 ctype_base__Xran();
2463 return ctype_wchar_do_widen(this, first, last, dest);
2466 /* ?widen@?$ctype@_W@std@@QBE_WD@Z */
2467 /* ?widen@?$ctype@_W@std@@QEBA_WD@Z */
2468 /* ?widen@?$ctype@G@std@@QBEGD@Z */
2469 /* ?widen@?$ctype@G@std@@QEBAGD@Z */
2470 DEFINE_THISCALL_WRAPPER(ctype_wchar_widen_ch, 8)
2471 wchar_t __thiscall ctype_wchar_widen_ch(const ctype_wchar *this, char ch)
2473 TRACE("(%p %d)\n", this, ch);
2474 return call_ctype_wchar_do_widen_ch(this, ch);
2477 /* ?widen@?$ctype@_W@std@@QBEPBDPBD0PA_W@Z */
2478 /* ?widen@?$ctype@_W@std@@QEBAPEBDPEBD0PEA_W@Z */
2479 /* ?widen@?$ctype@G@std@@QBEPBDPBD0PAG@Z */
2480 /* ?widen@?$ctype@G@std@@QEBAPEBDPEBD0PEAG@Z */
2481 DEFINE_THISCALL_WRAPPER(ctype_wchar_widen, 16)
2482 const char* __thiscall ctype_wchar_widen(const ctype_wchar *this,
2483 const char *first, const char *last, wchar_t *dest)
2485 TRACE("(%p %p %p %p)\n", this, first, last, dest);
2486 return call_ctype_wchar_do_widen(this, first, last, dest);
2489 /* ?_Widen_s@?$ctype@_W@std@@QBEPBDPBD0PA_WI@Z */
2490 /* ?_Widen_s@?$ctype@_W@std@@QEBAPEBDPEBD0PEA_W_K@Z */
2491 /* ?_Widen_s@?$ctype@G@std@@QBEPBDPBD0PAGI@Z */
2492 /* ?_Widen_s@?$ctype@G@std@@QEBAPEBDPEBD0PEAG_K@Z */
2493 DEFINE_THISCALL_WRAPPER(ctype_wchar__Widen_s, 20)
2494 const char* __thiscall ctype_wchar__Widen_s(const ctype_wchar *this,
2495 const char *first, const char *last, wchar_t *dest, MSVCP_size_t size)
2497 TRACE("(%p %p %p %p %lu)\n", this, first, last, dest, size);
2498 return call_ctype_wchar__Do_widen_s(this, first, last, dest, size);
2501 /* ?_Getcat@?$ctype@_W@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
2502 /* ?_Getcat@?$ctype@_W@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
2503 MSVCP_size_t __cdecl ctype_wchar__Getcat(const locale_facet **facet, const locale *loc)
2505 TRACE("(%p %p)\n", facet, loc);
2507 if(facet && !*facet) {
2508 _Locinfo locinfo;
2510 *facet = MSVCRT_operator_new(sizeof(ctype_wchar));
2511 if(!*facet) {
2512 ERR("Out of memory\n");
2513 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
2514 return 0;
2517 _Locinfo_ctor_cstr(&locinfo, locale_string_char_c_str(&loc->ptr->name));
2518 ctype_wchar_ctor_locinfo((ctype_wchar*)*facet, &locinfo, 0);
2519 _Locinfo_dtor(&locinfo);
2522 return LC_CTYPE;
2525 /* ?_Getcat@?$ctype@_W@std@@SAIPAPBVfacet@locale@2@@Z */
2526 /* ?_Getcat@?$ctype@_W@std@@SA_KPEAPEBVfacet@locale@2@@Z */
2527 MSVCP_size_t __cdecl ctype_wchar__Getcat_old(const locale_facet **facet)
2529 return ctype_wchar__Getcat(facet, locale_classic());
2532 /* ?_Getcat@?$ctype@G@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
2533 /* ?_Getcat@?$ctype@G@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
2534 MSVCP_size_t __cdecl ctype_short__Getcat(const locale_facet **facet, const locale *loc)
2536 if(facet && !*facet) {
2537 ctype_wchar__Getcat(facet, loc);
2538 (*(locale_facet**)facet)->vtable = &MSVCP_ctype_short_vtable;
2541 return LC_CTYPE;
2544 /* ?_Getcat@?$ctype@G@std@@SAIPAPBVfacet@locale@2@@Z */
2545 /* ?_Getcat@?$ctype@G@std@@SA_KPEAPEBVfacet@locale@2@@Z */
2546 MSVCP_size_t __cdecl ctype_short__Getcat_old(const locale_facet **facet)
2548 return ctype_short__Getcat(facet, locale_classic());
2551 /* _Towlower */
2552 wchar_t __cdecl _Towlower(wchar_t ch, const _Ctypevec *ctype)
2554 TRACE("(%d %p)\n", ch, ctype);
2555 return tolowerW(ch);
2558 ctype_wchar* ctype_wchar_use_facet(const locale *loc)
2560 static ctype_wchar *obj = NULL;
2562 _Lockit lock;
2563 const locale_facet *fac;
2565 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
2566 fac = locale__Getfacet(loc, locale_id_operator_size_t(&ctype_wchar_id));
2567 if(fac) {
2568 _Lockit_dtor(&lock);
2569 return (ctype_wchar*)fac;
2572 if(obj) {
2573 _Lockit_dtor(&lock);
2574 return obj;
2577 ctype_wchar__Getcat(&fac, loc);
2578 obj = (ctype_wchar*)fac;
2579 call_locale_facet__Incref(&obj->base.facet);
2580 locale_facet_register(&obj->base.facet);
2581 _Lockit_dtor(&lock);
2583 return obj;
2586 ctype_wchar* ctype_short_use_facet(const locale *loc)
2588 static ctype_wchar *obj = NULL;
2590 _Lockit lock;
2591 const locale_facet *fac;
2593 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
2594 fac = locale__Getfacet(loc, locale_id_operator_size_t(&ctype_short_id));
2595 if(fac) {
2596 _Lockit_dtor(&lock);
2597 return (ctype_wchar*)fac;
2600 if(obj) {
2601 _Lockit_dtor(&lock);
2602 return obj;
2605 ctype_short__Getcat(&fac, loc);
2606 obj = (ctype_wchar*)fac;
2607 call_locale_facet__Incref(&obj->base.facet);
2608 locale_facet_register(&obj->base.facet);
2609 _Lockit_dtor(&lock);
2611 return obj;
2614 /* ?do_tolower@?$ctype@_W@std@@MBE_W_W@Z */
2615 /* ?do_tolower@?$ctype@_W@std@@MEBA_W_W@Z */
2616 /* ?do_tolower@?$ctype@G@std@@MBEGG@Z */
2617 /* ?do_tolower@?$ctype@G@std@@MEBAGG@Z */
2618 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_tolower_ch, 8)
2619 #if _MSVCP_VER <= 100
2620 #define call_ctype_wchar_do_tolower_ch(this, ch) CALL_VTBL_FUNC(this, 24, \
2621 wchar_t, (const ctype_wchar*, wchar_t), (this, ch))
2622 #else
2623 #define call_ctype_wchar_do_tolower_ch(this, ch) CALL_VTBL_FUNC(this, 32, \
2624 wchar_t, (const ctype_wchar*, wchar_t), (this, ch))
2625 #endif
2626 wchar_t __thiscall ctype_wchar_do_tolower_ch(const ctype_wchar *this, wchar_t ch)
2628 return _Towlower(ch, &this->ctype);
2631 /* ?do_tolower@?$ctype@_W@std@@MBEPB_WPA_WPB_W@Z */
2632 /* ?do_tolower@?$ctype@_W@std@@MEBAPEB_WPEA_WPEB_W@Z */
2633 /* ?do_tolower@?$ctype@G@std@@MBEPBGPAGPBG@Z */
2634 /* ?do_tolower@?$ctype@G@std@@MEBAPEBGPEAGPEBG@Z */
2635 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_tolower, 12)
2636 #if _MSVCP_VER <= 100
2637 #define call_ctype_wchar_do_tolower(this, first, last) CALL_VTBL_FUNC(this, 20, \
2638 const wchar_t*, (const ctype_wchar*, wchar_t*, const wchar_t*), \
2639 (this, first, last))
2640 #else
2641 #define call_ctype_wchar_do_tolower(this, first, last) CALL_VTBL_FUNC(this, 28, \
2642 const wchar_t*, (const ctype_wchar*, wchar_t*, const wchar_t*), \
2643 (this, first, last))
2644 #endif
2645 const wchar_t* __thiscall ctype_wchar_do_tolower(const ctype_wchar *this,
2646 wchar_t *first, const wchar_t *last)
2648 TRACE("(%p %p %p)\n", this, first, last);
2649 for(; first<last; first++)
2650 *first = _Towlower(*first, &this->ctype);
2651 return last;
2654 /* ?tolower@?$ctype@_W@std@@QBE_W_W@Z */
2655 /* ?tolower@?$ctype@_W@std@@QEBA_W_W@Z */
2656 /* ?tolower@?$ctype@G@std@@QBEGG@Z */
2657 /* ?tolower@?$ctype@G@std@@QEBAGG@Z */
2658 DEFINE_THISCALL_WRAPPER(ctype_wchar_tolower_ch, 8)
2659 wchar_t __thiscall ctype_wchar_tolower_ch(const ctype_wchar *this, wchar_t ch)
2661 TRACE("(%p %d)\n", this, ch);
2662 return call_ctype_wchar_do_tolower_ch(this, ch);
2665 /* ?tolower@?$ctype@_W@std@@QBEPB_WPA_WPB_W@Z */
2666 /* ?tolower@?$ctype@_W@std@@QEBAPEB_WPEA_WPEB_W@Z */
2667 /* ?tolower@?$ctype@G@std@@QBEPBGPAGPBG@Z */
2668 /* ?tolower@?$ctype@G@std@@QEBAPEBGPEAGPEBG@Z */
2669 DEFINE_THISCALL_WRAPPER(ctype_wchar_tolower, 12)
2670 const wchar_t* __thiscall ctype_wchar_tolower(const ctype_wchar *this,
2671 wchar_t *first, const wchar_t *last)
2673 TRACE("(%p %p %p)\n", this, first, last);
2674 return call_ctype_wchar_do_tolower(this, first, last);
2677 /* _Towupper */
2678 wchar_t __cdecl _Towupper(wchar_t ch, const _Ctypevec *ctype)
2680 TRACE("(%d %p)\n", ch, ctype);
2681 return toupperW(ch);
2684 /* ?do_toupper@?$ctype@_W@std@@MBE_W_W@Z */
2685 /* ?do_toupper@?$ctype@_W@std@@MEBA_W_W@Z */
2686 /* ?do_toupper@?$ctype@G@std@@MBEGG@Z */
2687 /* ?do_toupper@?$ctype@G@std@@MEBAGG@Z */
2688 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_toupper_ch, 8)
2689 #if _MSVCP_VER <= 100
2690 #define call_ctype_wchar_do_toupper_ch(this, ch) CALL_VTBL_FUNC(this, 32, \
2691 wchar_t, (const ctype_wchar*, wchar_t), (this, ch))
2692 #else
2693 #define call_ctype_wchar_do_toupper_ch(this, ch) CALL_VTBL_FUNC(this, 40, \
2694 wchar_t, (const ctype_wchar*, wchar_t), (this, ch))
2695 #endif
2696 wchar_t __thiscall ctype_wchar_do_toupper_ch(const ctype_wchar *this, wchar_t ch)
2698 return _Towupper(ch, &this->ctype);
2701 /* ?do_toupper@?$ctype@_W@std@@MBEPB_WPA_WPB_W@Z */
2702 /* ?do_toupper@?$ctype@_W@std@@MEBAPEB_WPEA_WPEB_W@Z */
2703 /* ?do_toupper@?$ctype@G@std@@MBEPBGPAGPBG@Z */
2704 /* ?do_toupper@?$ctype@G@std@@MEBAPEBGPEAGPEBG@Z */
2705 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_toupper, 12)
2706 #if _MSVCP_VER <= 100
2707 #define call_ctype_wchar_do_toupper(this, first, last) CALL_VTBL_FUNC(this, 28, \
2708 const wchar_t*, (const ctype_wchar*, wchar_t*, const wchar_t*), \
2709 (this, first, last))
2710 #else
2711 #define call_ctype_wchar_do_toupper(this, first, last) CALL_VTBL_FUNC(this, 36, \
2712 const wchar_t*, (const ctype_wchar*, wchar_t*, const wchar_t*), \
2713 (this, first, last))
2714 #endif
2715 const wchar_t* __thiscall ctype_wchar_do_toupper(const ctype_wchar *this,
2716 wchar_t *first, const wchar_t *last)
2718 TRACE("(%p %p %p)\n", this, first, last);
2719 for(; first<last; first++)
2720 *first = _Towupper(*first, &this->ctype);
2721 return last;
2724 /* ?toupper@?$ctype@_W@std@@QBE_W_W@Z */
2725 /* ?toupper@?$ctype@_W@std@@QEBA_W_W@Z */
2726 /* ?toupper@?$ctype@G@std@@QBEGG@Z */
2727 /* ?toupper@?$ctype@G@std@@QEBAGG@Z */
2728 DEFINE_THISCALL_WRAPPER(ctype_wchar_toupper_ch, 8)
2729 wchar_t __thiscall ctype_wchar_toupper_ch(const ctype_wchar *this, wchar_t ch)
2731 TRACE("(%p %d)\n", this, ch);
2732 return call_ctype_wchar_do_toupper_ch(this, ch);
2735 /* ?toupper@?$ctype@_W@std@@QBEPB_WPA_WPB_W@Z */
2736 /* ?toupper@?$ctype@_W@std@@QEBAPEB_WPEA_WPEB_W@Z */
2737 /* ?toupper@?$ctype@G@std@@QBEPBGPAGPBG@Z */
2738 /* ?toupper@?$ctype@G@std@@QEBAPEBGPEAGPEBG@Z */
2739 DEFINE_THISCALL_WRAPPER(ctype_wchar_toupper, 12)
2740 const wchar_t* __thiscall ctype_wchar_toupper(const ctype_wchar *this,
2741 wchar_t *first, const wchar_t *last)
2743 TRACE("(%p %p %p)\n", this, first, last);
2744 return call_ctype_wchar_do_toupper(this, first, last);
2747 /* _Getwctypes */
2748 const wchar_t* __cdecl _Getwctypes(const wchar_t *first, const wchar_t *last,
2749 short *mask, const _Ctypevec *ctype)
2751 TRACE("(%p %p %p %p)\n", first, last, mask, ctype);
2752 GetStringTypeW(CT_CTYPE1, first, last-first, (WORD*)mask);
2753 return last;
2756 /* _Getwctype */
2757 short __cdecl _Getwctype(wchar_t ch, const _Ctypevec *ctype)
2759 short mask = 0;
2760 _Getwctypes(&ch, &ch+1, &mask, ctype);
2761 return mask;
2764 /* ?do_is@?$ctype@_W@std@@MBE_NF_W@Z */
2765 /* ?do_is@?$ctype@_W@std@@MEBA_NF_W@Z */
2766 /* ?do_is@?$ctype@G@std@@MBE_NFG@Z */
2767 /* ?do_is@?$ctype@G@std@@MEBA_NFG@Z */
2768 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_is_ch, 12)
2769 #if _MSVCP_VER <= 100
2770 #define call_ctype_wchar_do_is_ch(this, mask, ch) CALL_VTBL_FUNC(this, 8, \
2771 MSVCP_bool, (const ctype_wchar*, short, wchar_t), (this, mask, ch))
2772 #else
2773 #define call_ctype_wchar_do_is_ch(this, mask, ch) CALL_VTBL_FUNC(this, 16, \
2774 MSVCP_bool, (const ctype_wchar*, short, wchar_t), (this, mask, ch))
2775 #endif
2776 MSVCP_bool __thiscall ctype_wchar_do_is_ch(const ctype_wchar *this, short mask, wchar_t ch)
2778 TRACE("(%p %x %d)\n", this, mask, ch);
2779 return (_Getwctype(ch, &this->ctype) & mask) != 0;
2782 /* ?do_is@?$ctype@_W@std@@MBEPB_WPB_W0PAF@Z */
2783 /* ?do_is@?$ctype@_W@std@@MEBAPEB_WPEB_W0PEAF@Z */
2784 /* ?do_is@?$ctype@G@std@@MBEPBGPBG0PAF@Z */
2785 /* ?do_is@?$ctype@G@std@@MEBAPEBGPEBG0PEAF@Z */
2786 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_is, 16)
2787 #if _MSVCP_VER <= 100
2788 #define call_ctype_wchar_do_is(this, first, last, dest) CALL_VTBL_FUNC(this, 4, \
2789 const wchar_t*, (const ctype_wchar*, const wchar_t*, const wchar_t*, short*), \
2790 (this, first, last, dest))
2791 #else
2792 #define call_ctype_wchar_do_is(this, first, last, dest) CALL_VTBL_FUNC(this, 12, \
2793 const wchar_t*, (const ctype_wchar*, const wchar_t*, const wchar_t*, short*), \
2794 (this, first, last, dest))
2795 #endif
2796 const wchar_t* __thiscall ctype_wchar_do_is(const ctype_wchar *this,
2797 const wchar_t *first, const wchar_t *last, short *dest)
2799 TRACE("(%p %p %p %p)\n", this, first, last, dest);
2800 return _Getwctypes(first, last, dest, &this->ctype);
2803 /* ?is@?$ctype@_W@std@@QBE_NF_W@Z */
2804 /* ?is@?$ctype@_W@std@@QEBA_NF_W@Z */
2805 /* ?is@?$ctype@G@std@@QBE_NFG@Z */
2806 /* ?is@?$ctype@G@std@@QEBA_NFG@Z */
2807 DEFINE_THISCALL_WRAPPER(ctype_wchar_is_ch, 12)
2808 MSVCP_bool __thiscall ctype_wchar_is_ch(const ctype_wchar *this, short mask, wchar_t ch)
2810 TRACE("(%p %x %d)\n", this, mask, ch);
2811 return call_ctype_wchar_do_is_ch(this, mask, ch);
2814 /* ?is@?$ctype@_W@std@@QBEPB_WPB_W0PAF@Z */
2815 /* ?is@?$ctype@_W@std@@QEBAPEB_WPEB_W0PEAF@Z */
2816 /* ?is@?$ctype@G@std@@QBEPBGPBG0PAF@Z */
2817 /* ?is@?$ctype@G@std@@QEBAPEBGPEBG0PEAF@Z */
2818 DEFINE_THISCALL_WRAPPER(ctype_wchar_is, 16)
2819 const wchar_t* __thiscall ctype_wchar_is(const ctype_wchar *this,
2820 const wchar_t *first, const wchar_t *last, short *dest)
2822 TRACE("(%p %p %p %p)\n", this, first, last, dest);
2823 return call_ctype_wchar_do_is(this, first, last, dest);
2826 /* ?do_scan_is@?$ctype@_W@std@@MBEPB_WFPB_W0@Z */
2827 /* ?do_scan_is@?$ctype@_W@std@@MEBAPEB_WFPEB_W0@Z */
2828 /* ?do_scan_is@?$ctype@G@std@@MBEPBGFPBG0@Z */
2829 /* ?do_scan_is@?$ctype@G@std@@MEBAPEBGFPEBG0@Z */
2830 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_scan_is, 16)
2831 #if _MSVCP_VER <= 100
2832 #define call_ctype_wchar_do_scan_is(this, mask, first, last) CALL_VTBL_FUNC(this, 12, \
2833 const wchar_t*, (const ctype_wchar*, short, const wchar_t*, const wchar_t*), \
2834 (this, mask, first, last))
2835 #else
2836 #define call_ctype_wchar_do_scan_is(this, mask, first, last) CALL_VTBL_FUNC(this, 20, \
2837 const wchar_t*, (const ctype_wchar*, short, const wchar_t*, const wchar_t*), \
2838 (this, mask, first, last))
2839 #endif
2840 const wchar_t* __thiscall ctype_wchar_do_scan_is(const ctype_wchar *this,
2841 short mask, const wchar_t *first, const wchar_t *last)
2843 TRACE("(%p %d %p %p)\n", this, mask, first, last);
2844 for(; first<last; first++)
2845 if(!ctype_wchar_is_ch(this, mask, *first))
2846 break;
2847 return first;
2850 /* ?scan_is@?$ctype@_W@std@@QBEPB_WFPB_W0@Z */
2851 /* ?scan_is@?$ctype@_W@std@@QEBAPEB_WFPEB_W0@Z */
2852 /* ?scan_is@?$ctype@G@std@@QBEPBGFPBG0@Z */
2853 /* ?scan_is@?$ctype@G@std@@QEBAPEBGFPEBG0@Z */
2854 DEFINE_THISCALL_WRAPPER(ctype_wchar_scan_is, 16)
2855 const wchar_t* __thiscall ctype_wchar_scan_is(const ctype_wchar *this,
2856 short mask, const wchar_t *first, const wchar_t *last)
2858 TRACE("(%p %x %p %p)\n", this, mask, first, last);
2859 return call_ctype_wchar_do_scan_is(this, mask, first, last);
2862 /* ?do_scan_not@?$ctype@_W@std@@MBEPB_WFPB_W0@Z */
2863 /* ?do_scan_not@?$ctype@_W@std@@MEBAPEB_WFPEB_W0@Z */
2864 /* ?do_scan_not@?$ctype@G@std@@MBEPBGFPBG0@Z */
2865 /* ?do_scan_not@?$ctype@G@std@@MEBAPEBGFPEBG0@Z */
2866 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_scan_not, 16)
2867 #if _MSVCP_VER <= 100
2868 #define call_ctype_wchar_do_scan_not(this, mask, first, last) CALL_VTBL_FUNC(this, 16, \
2869 const wchar_t*, (const ctype_wchar*, short, const wchar_t*, const wchar_t*), \
2870 (this, mask, first, last))
2871 #else
2872 #define call_ctype_wchar_do_scan_not(this, mask, first, last) CALL_VTBL_FUNC(this, 24, \
2873 const wchar_t*, (const ctype_wchar*, short, const wchar_t*, const wchar_t*), \
2874 (this, mask, first, last))
2875 #endif
2876 const wchar_t* __thiscall ctype_wchar_do_scan_not(const ctype_wchar *this,
2877 short mask, const wchar_t *first, const wchar_t *last)
2879 TRACE("(%p %x %p %p)\n", this, mask, first, last);
2880 for(; first<last; first++)
2881 if(ctype_wchar_is_ch(this, mask, *first))
2882 break;
2883 return first;
2886 /* ?scan_not@?$ctype@_W@std@@QBEPB_WFPB_W0@Z */
2887 /* ?scan_not@?$ctype@_W@std@@QEBAPEB_WFPEB_W0@Z */
2888 /* ?scan_not@?$ctype@G@std@@QBEPBGFPBG0@Z */
2889 /* ?scan_not@?$ctype@G@std@@QEBAPEBGFPEBG0@Z */
2890 DEFINE_THISCALL_WRAPPER(ctype_wchar_scan_not, 16)
2891 const wchar_t* __thiscall ctype_wchar_scan_not(const ctype_wchar *this,
2892 short mask, const wchar_t *first, const wchar_t *last)
2894 TRACE("(%p %x %p %p)\n", this, mask, first, last);
2895 return call_ctype_wchar_do_scan_not(this, mask, first, last);
2898 /* ??_7codecvt_base@std@@6B@ */
2899 extern const vtable_ptr MSVCP_codecvt_base_vtable;
2901 /* ??0codecvt_base@std@@QAE@I@Z */
2902 /* ??0codecvt_base@std@@QEAA@_K@Z */
2903 DEFINE_THISCALL_WRAPPER(codecvt_base_ctor_refs, 8)
2904 codecvt_base* __thiscall codecvt_base_ctor_refs(codecvt_base *this, MSVCP_size_t refs)
2906 TRACE("(%p %lu)\n", this, refs);
2907 locale_facet_ctor_refs(&this->facet, refs);
2908 this->facet.vtable = &MSVCP_codecvt_base_vtable;
2909 return this;
2912 /* ??_Fcodecvt_base@std@@QAEXXZ */
2913 /* ??_Fcodecvt_base@std@@QEAAXXZ */
2914 DEFINE_THISCALL_WRAPPER(codecvt_base_ctor, 4)
2915 codecvt_base* __thiscall codecvt_base_ctor(codecvt_base *this)
2917 return codecvt_base_ctor_refs(this, 0);
2920 /* ??1codecvt_base@std@@UAE@XZ */
2921 /* ??1codecvt_base@std@@UEAA@XZ */
2922 DEFINE_THISCALL_WRAPPER(codecvt_base_dtor, 4)
2923 void __thiscall codecvt_base_dtor(codecvt_base *this)
2925 TRACE("(%p)\n", this);
2926 locale_facet_dtor(&this->facet);
2929 DEFINE_THISCALL_WRAPPER(codecvt_base_vector_dtor, 8)
2930 codecvt_base* __thiscall codecvt_base_vector_dtor(codecvt_base *this, unsigned int flags)
2932 TRACE("(%p %x)\n", this, flags);
2933 if(flags & 2) {
2934 /* we have an array, with the number of elements stored before the first object */
2935 INT_PTR i, *ptr = (INT_PTR *)this-1;
2937 for(i=*ptr-1; i>=0; i--)
2938 codecvt_base_dtor(this+i);
2939 MSVCRT_operator_delete(ptr);
2940 } else {
2941 codecvt_base_dtor(this);
2942 if(flags & 1)
2943 MSVCRT_operator_delete(this);
2946 return this;
2949 /* ?do_always_noconv@codecvt_base@std@@MBE_NXZ */
2950 /* ?do_always_noconv@codecvt_base@std@@MEBA_NXZ */
2951 #if _MSVCP_VER <= 100
2952 #define call_codecvt_base_do_always_noconv(this) CALL_VTBL_FUNC(this, 4, \
2953 MSVCP_bool, (const codecvt_base*), (this))
2954 #else
2955 #define call_codecvt_base_do_always_noconv(this) CALL_VTBL_FUNC(this, 12, \
2956 MSVCP_bool, (const codecvt_base*), (this))
2957 #endif
2958 DEFINE_THISCALL_WRAPPER(codecvt_base_do_always_noconv, 4)
2959 MSVCP_bool __thiscall codecvt_base_do_always_noconv(const codecvt_base *this)
2961 TRACE("(%p)\n", this);
2962 return TRUE;
2965 /* ?always_noconv@codecvt_base@std@@QBE_NXZ */
2966 /* ?always_noconv@codecvt_base@std@@QEBA_NXZ */
2967 DEFINE_THISCALL_WRAPPER(codecvt_base_always_noconv, 4)
2968 MSVCP_bool __thiscall codecvt_base_always_noconv(const codecvt_base *this)
2970 TRACE("(%p)\n", this);
2971 return call_codecvt_base_do_always_noconv(this);
2974 /* ?do_max_length@codecvt_base@std@@MBEHXZ */
2975 /* ?do_max_length@codecvt_base@std@@MEBAHXZ */
2976 #if _MSVCP_VER <= 100
2977 #define call_codecvt_base_do_max_length(this) CALL_VTBL_FUNC(this, 8, \
2978 int, (const codecvt_base*), (this))
2979 #else
2980 #define call_codecvt_base_do_max_length(this) CALL_VTBL_FUNC(this, 16, \
2981 int, (const codecvt_base*), (this))
2982 #endif
2983 DEFINE_THISCALL_WRAPPER(codecvt_base_do_max_length, 4)
2984 int __thiscall codecvt_base_do_max_length(const codecvt_base *this)
2986 TRACE("(%p)\n", this);
2987 return 1;
2990 /* ?max_length@codecvt_base@std@@QBEHXZ */
2991 /* ?max_length@codecvt_base@std@@QEBAHXZ */
2992 DEFINE_THISCALL_WRAPPER(codecvt_base_max_length, 4)
2993 int __thiscall codecvt_base_max_length(const codecvt_base *this)
2995 TRACE("(%p)\n", this);
2996 return call_codecvt_base_do_max_length(this);
2999 /* ?do_encoding@codecvt_base@std@@MBEHXZ */
3000 /* ?do_encoding@codecvt_base@std@@MEBAHXZ */
3001 #if _MSVCP_VER <= 100
3002 #define call_codecvt_base_do_encoding(this) CALL_VTBL_FUNC(this, 12, \
3003 int, (const codecvt_base*), (this))
3004 #else
3005 #define call_codecvt_base_do_encoding(this) CALL_VTBL_FUNC(this, 20, \
3006 int, (const codecvt_base*), (this))
3007 #endif
3008 DEFINE_THISCALL_WRAPPER(codecvt_base_do_encoding, 4)
3009 int __thiscall codecvt_base_do_encoding(const codecvt_base *this)
3011 TRACE("(%p)\n", this);
3012 return 1;
3015 /* ?encoding@codecvt_base@std@@QBEHXZ */
3016 /* ?encoding@codecvt_base@std@@QEBAHXZ */
3017 DEFINE_THISCALL_WRAPPER(codecvt_base_encoding, 4)
3018 int __thiscall codecvt_base_encoding(const codecvt_base *this)
3020 TRACE("(%p)\n", this);
3021 return call_codecvt_base_do_encoding(this);
3024 /* ?id@?$codecvt@DDH@std@@2V0locale@2@A */
3025 locale_id codecvt_char_id = {0};
3027 /* ??_7?$codecvt@DDH@std@@6B@ */
3028 extern const vtable_ptr MSVCP_codecvt_char_vtable;
3030 /* ?_Init@?$codecvt@DDH@std@@IAEXABV_Locinfo@2@@Z */
3031 /* ?_Init@?$codecvt@DDH@std@@IEAAXAEBV_Locinfo@2@@Z */
3032 DEFINE_THISCALL_WRAPPER(codecvt_char__Init, 8)
3033 void __thiscall codecvt_char__Init(codecvt_char *this, const _Locinfo *locinfo)
3035 TRACE("(%p %p)\n", this, locinfo);
3038 /* ??0?$codecvt@DDH@std@@QAE@ABV_Locinfo@1@I@Z */
3039 /* ??0?$codecvt@DDH@std@@QEAA@AEBV_Locinfo@1@_K@Z */
3040 DEFINE_THISCALL_WRAPPER(codecvt_char_ctor_locinfo, 12)
3041 codecvt_char* __thiscall codecvt_char_ctor_locinfo(codecvt_char *this, const _Locinfo *locinfo, MSVCP_size_t refs)
3043 TRACE("(%p %p %lu)\n", this, locinfo, refs);
3044 codecvt_base_ctor_refs(&this->base, refs);
3045 this->base.facet.vtable = &MSVCP_codecvt_char_vtable;
3046 return this;
3049 /* ??0?$codecvt@DDH@std@@QAE@I@Z */
3050 /* ??0?$codecvt@DDH@std@@QEAA@_K@Z */
3051 DEFINE_THISCALL_WRAPPER(codecvt_char_ctor_refs, 8)
3052 codecvt_char* __thiscall codecvt_char_ctor_refs(codecvt_char *this, MSVCP_size_t refs)
3054 return codecvt_char_ctor_locinfo(this, NULL, refs);
3057 /* ??_F?$codecvt@DDH@std@@QAEXXZ */
3058 /* ??_F?$codecvt@DDH@std@@QEAAXXZ */
3059 DEFINE_THISCALL_WRAPPER(codecvt_char_ctor, 4)
3060 codecvt_char* __thiscall codecvt_char_ctor(codecvt_char *this)
3062 return codecvt_char_ctor_locinfo(this, NULL, 0);
3065 /* ??1?$codecvt@DDH@std@@MAE@XZ */
3066 /* ??1?$codecvt@DDH@std@@MEAA@XZ */
3067 DEFINE_THISCALL_WRAPPER(codecvt_char_dtor, 4)
3068 void __thiscall codecvt_char_dtor(codecvt_char *this)
3070 TRACE("(%p)\n", this);
3071 codecvt_base_dtor(&this->base);
3074 DEFINE_THISCALL_WRAPPER(codecvt_char_vector_dtor, 8)
3075 codecvt_char* __thiscall codecvt_char_vector_dtor(codecvt_char *this, unsigned int flags)
3077 TRACE("(%p %x)\n", this, flags);
3078 if(flags & 2) {
3079 /* we have an array, with the number of elements stored before the first object */
3080 INT_PTR i, *ptr = (INT_PTR *)this-1;
3082 for(i=*ptr-1; i>=0; i--)
3083 codecvt_char_dtor(this+i);
3084 MSVCRT_operator_delete(ptr);
3085 } else {
3086 codecvt_char_dtor(this);
3087 if(flags & 1)
3088 MSVCRT_operator_delete(this);
3091 return this;
3094 /* ?_Getcat@?$codecvt@DDH@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
3095 /* ?_Getcat@?$codecvt@DDH@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
3096 MSVCP_size_t __cdecl codecvt_char__Getcat(const locale_facet **facet, const locale *loc)
3098 TRACE("(%p %p)\n", facet, loc);
3100 if(facet && !*facet) {
3101 *facet = MSVCRT_operator_new(sizeof(codecvt_char));
3102 if(!*facet) {
3103 ERR("Out of memory\n");
3104 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
3105 return 0;
3107 codecvt_char_ctor((codecvt_char*)*facet);
3110 return LC_CTYPE;
3113 /* ?_Getcat@?$codecvt@DDH@std@@SAIPAPBVfacet@locale@2@@Z */
3114 /* ?_Getcat@?$codecvt@DDH@std@@SA_KPEAPEBVfacet@locale@2@@Z */
3115 MSVCP_size_t __cdecl codecvt_char__Getcat_old(const locale_facet **facet)
3117 return codecvt_char__Getcat(facet, locale_classic());
3120 codecvt_char* codecvt_char_use_facet(const locale *loc)
3122 static codecvt_char *obj = NULL;
3124 _Lockit lock;
3125 const locale_facet *fac;
3127 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
3128 fac = locale__Getfacet(loc, locale_id_operator_size_t(&codecvt_char_id));
3129 if(fac) {
3130 _Lockit_dtor(&lock);
3131 return (codecvt_char*)fac;
3134 if(obj) {
3135 _Lockit_dtor(&lock);
3136 return obj;
3139 codecvt_char__Getcat(&fac, loc);
3140 obj = (codecvt_char*)fac;
3141 call_locale_facet__Incref(&obj->base.facet);
3142 locale_facet_register(&obj->base.facet);
3143 _Lockit_dtor(&lock);
3145 return obj;
3148 /* ?do_in@?$codecvt@DDH@std@@MBEHAAHPBD1AAPBDPAD3AAPAD@Z */
3149 /* ?do_in@?$codecvt@DDH@std@@MEBAHAEAHPEBD1AEAPEBDPEAD3AEAPEAD@Z */
3150 #if _MSVCP_VER <= 100
3151 #define call_codecvt_char_do_in(this, state, from, from_end, from_next, to, to_end, to_next) \
3152 CALL_VTBL_FUNC(this, 16, int, \
3153 (const codecvt_char*, int*, const char*, const char*, const char**, char*, char*, char**), \
3154 (this, state, from, from_end, from_next, to, to_end, to_next))
3155 #else
3156 #define call_codecvt_char_do_in(this, state, from, from_end, from_next, to, to_end, to_next) \
3157 CALL_VTBL_FUNC(this, 24, int, \
3158 (const codecvt_char*, int*, const char*, const char*, const char**, char*, char*, char**), \
3159 (this, state, from, from_end, from_next, to, to_end, to_next))
3160 #endif
3161 DEFINE_THISCALL_WRAPPER(codecvt_char_do_in, 32)
3162 int __thiscall codecvt_char_do_in(const codecvt_char *this, int *state,
3163 const char *from, const char *from_end, const char **from_next,
3164 char *to, char *to_end, char **to_next)
3166 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from, from_end,
3167 from_next, to, to_end, to_next);
3168 *from_next = from;
3169 *to_next = to;
3170 return CODECVT_noconv;
3173 /* ?in@?$codecvt@DDH@std@@QBEHAAHPBD1AAPBDPAD3AAPAD@Z */
3174 /* ?in@?$codecvt@DDH@std@@QEBAHAEAHPEBD1AEAPEBDPEAD3AEAPEAD@Z */
3175 DEFINE_THISCALL_WRAPPER(codecvt_char_in, 32)
3176 int __thiscall codecvt_char_in(const codecvt_char *this, int *state,
3177 const char *from, const char *from_end, const char **from_next,
3178 char *to, char *to_end, char **to_next)
3180 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from, from_end,
3181 from_next, to, to_end, to_next);
3182 return call_codecvt_char_do_in(this, state, from, from_end, from_next,
3183 to, to_end, to_next);
3186 /* ?do_out@?$codecvt@DDH@std@@MBEHAAHPBD1AAPBDPAD3AAPAD@Z */
3187 /* ?do_out@?$codecvt@DDH@std@@MEBAHAEAHPEBD1AEAPEBDPEAD3AEAPEAD@Z */
3188 #if _MSVCP_VER <= 100
3189 #define call_codecvt_char_do_out(this, state, from, from_end, from_next, to, to_end, to_next) \
3190 CALL_VTBL_FUNC(this, 20, int, \
3191 (const codecvt_char*, int*, const char*, const char*, const char**, char*, char*, char**), \
3192 (this, state, from, from_end, from_next, to, to_end, to_next))
3193 #else
3194 #define call_codecvt_char_do_out(this, state, from, from_end, from_next, to, to_end, to_next) \
3195 CALL_VTBL_FUNC(this, 28, int, \
3196 (const codecvt_char*, int*, const char*, const char*, const char**, char*, char*, char**), \
3197 (this, state, from, from_end, from_next, to, to_end, to_next))
3198 #endif
3199 DEFINE_THISCALL_WRAPPER(codecvt_char_do_out, 32)
3200 int __thiscall codecvt_char_do_out(const codecvt_char *this, int *state,
3201 const char *from, const char *from_end, const char **from_next,
3202 char *to, char *to_end, char **to_next)
3204 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from,
3205 from_end, from_next, to, to_end, to_next);
3206 *from_next = from;
3207 *to_next = to;
3208 return CODECVT_noconv;
3211 /* ?out@?$codecvt@DDH@std@@QBEHAAHPBD1AAPBDPAD3AAPAD@Z */
3212 /* ?out@?$codecvt@DDH@std@@QEBAHAEAHPEBD1AEAPEBDPEAD3AEAPEAD@Z */
3213 DEFINE_THISCALL_WRAPPER(codecvt_char_out, 32)
3214 int __thiscall codecvt_char_out(const codecvt_char *this, int *state,
3215 const char *from, const char *from_end, const char **from_next,
3216 char *to, char *to_end, char **to_next)
3218 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from, from_end,
3219 from_next, to, to_end, to_next);
3220 return call_codecvt_char_do_out(this, state, from, from_end, from_next,
3221 to, to_end, to_next);
3224 /* ?do_unshift@?$codecvt@DDH@std@@MBEHAAHPAD1AAPAD@Z */
3225 /* ?do_unshift@?$codecvt@DDH@std@@MEBAHAEAHPEAD1AEAPEAD@Z */
3226 #if _MSVCP_VER <= 100
3227 #define call_codecvt_char_do_unshift(this, state, to, to_end, to_next) CALL_VTBL_FUNC(this, 24, \
3228 int, (const codecvt_char*, int*, char*, char*, char**), (this, state, to, to_end, to_next))
3229 #else
3230 #define call_codecvt_char_do_unshift(this, state, to, to_end, to_next) CALL_VTBL_FUNC(this, 32, \
3231 int, (const codecvt_char*, int*, char*, char*, char**), (this, state, to, to_end, to_next))
3232 #endif
3233 DEFINE_THISCALL_WRAPPER(codecvt_char_do_unshift, 20)
3234 int __thiscall codecvt_char_do_unshift(const codecvt_char *this,
3235 int *state, char *to, char *to_end, char **to_next)
3237 TRACE("(%p %p %p %p %p)\n", this, state, to, to_end, to_next);
3238 *to_next = to;
3239 return CODECVT_noconv;
3242 /* ?unshift@?$codecvt@DDH@std@@QBEHAAHPAD1AAPAD@Z */
3243 /* ?unshift@?$codecvt@DDH@std@@QEBAHAEAHPEAD1AEAPEAD@Z */
3244 DEFINE_THISCALL_WRAPPER(codecvt_char_unshift, 20)
3245 int __thiscall codecvt_char_unshift(const codecvt_char *this,
3246 int *state, char *to, char *to_end, char **to_next)
3248 TRACE("(%p %p %p %p %p)\n", this, state, to, to_end, to_next);
3249 return call_codecvt_char_do_unshift(this, state, to, to_end, to_next);
3252 /* ?do_length@?$codecvt@DDH@std@@MBEHABHPBD1I@Z */
3253 /* ?do_length@?$codecvt@DDH@std@@MEBAHAEBHPEBD1_K@Z */
3254 #if _MSVCP_VER <= 100
3255 #define call_codecvt_char_do_length(this, state, from, from_end, max) CALL_VTBL_FUNC(this, 28, \
3256 int, (const codecvt_char*, const int*, const char*, const char*, MSVCP_size_t), \
3257 (this, state, from, from_end, max))
3258 #else
3259 #define call_codecvt_char_do_length(this, state, from, from_end, max) CALL_VTBL_FUNC(this, 36, \
3260 int, (const codecvt_char*, const int*, const char*, const char*, MSVCP_size_t), \
3261 (this, state, from, from_end, max))
3262 #endif
3263 DEFINE_THISCALL_WRAPPER(codecvt_char_do_length, 20)
3264 int __thiscall codecvt_char_do_length(const codecvt_char *this, const int *state,
3265 const char *from, const char *from_end, MSVCP_size_t max)
3267 TRACE("(%p %p %p %p %lu)\n", this, state, from, from_end, max);
3268 return (from_end-from > max ? max : from_end-from);
3271 /* ?length@?$codecvt@DDH@std@@QBEHABHPBD1I@Z */
3272 /* ?length@?$codecvt@DDH@std@@QEBAHAEBHPEBD1_K@Z */
3273 DEFINE_THISCALL_WRAPPER(codecvt_char_length, 20)
3274 int __thiscall codecvt_char_length(const codecvt_char *this, const int *state,
3275 const char *from, const char *from_end, MSVCP_size_t max)
3277 TRACE("(%p %p %p %p %lu)\n", this, state, from, from_end, max);
3278 return call_codecvt_char_do_length(this, state, from, from_end, max);
3281 /* ?id@?$codecvt@_WDH@std@@2V0locale@2@A */
3282 locale_id codecvt_wchar_id = {0};
3283 /* ?id@?$codecvt@GDH@std@@2V0locale@2@A */
3284 locale_id codecvt_short_id = {0};
3286 /* ??_7?$codecvt@_WDH@std@@6B@ */
3287 extern const vtable_ptr MSVCP_codecvt_wchar_vtable;
3288 /* ??_7?$codecvt@GDH@std@@6B@ */
3289 extern const vtable_ptr MSVCP_codecvt_short_vtable;
3291 /* ?_Init@?$codecvt@GDH@std@@IAEXABV_Locinfo@2@@Z */
3292 /* ?_Init@?$codecvt@GDH@std@@IEAAXAEBV_Locinfo@2@@Z */
3293 /* ?_Init@?$codecvt@_WDH@std@@IAEXABV_Locinfo@2@@Z */
3294 /* ?_Init@?$codecvt@_WDH@std@@IEAAXAEBV_Locinfo@2@@Z */
3295 DEFINE_THISCALL_WRAPPER(codecvt_wchar__Init, 8)
3296 void __thiscall codecvt_wchar__Init(codecvt_wchar *this, const _Locinfo *locinfo)
3298 TRACE("(%p %p)\n", this, locinfo);
3299 _Locinfo__Getcvt(locinfo, &this->cvt);
3302 /* ??0?$codecvt@_WDH@std@@QAE@ABV_Locinfo@1@I@Z */
3303 /* ??0?$codecvt@_WDH@std@@QEAA@AEBV_Locinfo@1@_K@Z */
3304 DEFINE_THISCALL_WRAPPER(codecvt_wchar_ctor_locinfo, 12)
3305 codecvt_wchar* __thiscall codecvt_wchar_ctor_locinfo(codecvt_wchar *this, const _Locinfo *locinfo, MSVCP_size_t refs)
3307 TRACE("(%p %p %ld)\n", this, locinfo, refs);
3309 codecvt_base_ctor_refs(&this->base, refs);
3310 this->base.facet.vtable = &MSVCP_codecvt_wchar_vtable;
3312 codecvt_wchar__Init(this, locinfo);
3313 return this;
3316 /* ??0?$codecvt@GDH@std@@QAE@ABV_Locinfo@1@I@Z */
3317 /* ??0?$codecvt@GDH@std@@QEAA@AEBV_Locinfo@1@_K@Z */
3318 DEFINE_THISCALL_WRAPPER(codecvt_short_ctor_locinfo, 12)
3319 codecvt_wchar* __thiscall codecvt_short_ctor_locinfo(codecvt_wchar *this, const _Locinfo *locinfo, MSVCP_size_t refs)
3321 TRACE("(%p %p %ld)\n", this, locinfo, refs);
3323 codecvt_wchar_ctor_locinfo(this, locinfo, refs);
3324 this->base.facet.vtable = &MSVCP_codecvt_short_vtable;
3325 return this;
3328 /* ??0?$codecvt@_WDH@std@@QAE@I@Z */
3329 /* ??0?$codecvt@_WDH@std@@QEAA@_K@Z */
3330 DEFINE_THISCALL_WRAPPER(codecvt_wchar_ctor_refs, 8)
3331 codecvt_wchar* __thiscall codecvt_wchar_ctor_refs(codecvt_wchar *this, MSVCP_size_t refs)
3333 _Locinfo locinfo;
3335 TRACE("(%p %ld)\n", this, refs);
3337 _Locinfo_ctor(&locinfo);
3338 codecvt_wchar_ctor_locinfo(this, &locinfo, refs);
3339 _Locinfo_dtor(&locinfo);
3340 return this;
3343 /* ??0?$codecvt@GDH@std@@QAE@I@Z */
3344 /* ??0?$codecvt@GDH@std@@QEAA@_K@Z */
3345 DEFINE_THISCALL_WRAPPER(codecvt_short_ctor_refs, 8)
3346 codecvt_wchar* __thiscall codecvt_short_ctor_refs(codecvt_wchar *this, MSVCP_size_t refs)
3348 _Locinfo locinfo;
3350 TRACE("(%p %ld)\n", this, refs);
3352 _Locinfo_ctor(&locinfo);
3353 codecvt_short_ctor_locinfo(this, &locinfo, refs);
3354 _Locinfo_dtor(&locinfo);
3355 return this;
3358 /* ??0?$codecvt@GDH@std@@IAE@PBDI@Z */
3359 /* ??0?$codecvt@GDH@std@@IEAA@PEBD_K@Z */
3360 DEFINE_THISCALL_WRAPPER(codecvt_short_ctor_name, 12)
3361 codecvt_wchar* __thiscall codecvt_short_ctor_name(codecvt_wchar *this, const char *name, MSVCP_size_t refs)
3363 _Locinfo locinfo;
3365 TRACE("(%p %s %ld)\n", this, name, refs);
3367 _Locinfo_ctor_cstr(&locinfo, name);
3368 codecvt_short_ctor_locinfo(this, &locinfo, refs);
3369 _Locinfo_dtor(&locinfo);
3370 return this;
3373 /* ??_F?$codecvt@_WDH@std@@QAEXXZ */
3374 /* ??_F?$codecvt@_WDH@std@@QEAAXXZ */
3375 DEFINE_THISCALL_WRAPPER(codecvt_wchar_ctor, 4)
3376 codecvt_wchar* __thiscall codecvt_wchar_ctor(codecvt_wchar *this)
3378 return codecvt_wchar_ctor_refs(this, 0);
3381 /* ??_F?$codecvt@GDH@std@@QAEXXZ */
3382 /* ??_F?$codecvt@GDH@std@@QEAAXXZ */
3383 DEFINE_THISCALL_WRAPPER(codecvt_short_ctor, 4)
3384 codecvt_wchar* __thiscall codecvt_short_ctor(codecvt_wchar *this)
3386 return codecvt_short_ctor_refs(this, 0);
3389 /* ??1?$codecvt@GDH@std@@MAE@XZ */
3390 /* ??1?$codecvt@GDH@std@@MEAA@XZ */
3391 /* ??1?$codecvt@_WDH@std@@MAE@XZ */
3392 /* ??1?$codecvt@_WDH@std@@MEAA@XZ */
3393 DEFINE_THISCALL_WRAPPER(codecvt_wchar_dtor, 4)
3394 void __thiscall codecvt_wchar_dtor(codecvt_wchar *this)
3396 TRACE("(%p)\n", this);
3397 codecvt_base_dtor(&this->base);
3400 DEFINE_THISCALL_WRAPPER(codecvt_wchar_vector_dtor, 8)
3401 codecvt_wchar* __thiscall codecvt_wchar_vector_dtor(codecvt_wchar *this, unsigned int flags)
3403 TRACE("(%p %x)\n", this, flags);
3404 if(flags & 2) {
3405 /* we have an array, with the number of elements stored before the first object */
3406 INT_PTR i, *ptr = (INT_PTR *)this-1;
3408 for(i=*ptr-1; i>=0; i--)
3409 codecvt_wchar_dtor(this+i);
3410 MSVCRT_operator_delete(ptr);
3411 } else {
3412 codecvt_wchar_dtor(this);
3413 if(flags & 1)
3414 MSVCRT_operator_delete(this);
3417 return this;
3420 /* ?_Getcat@?$codecvt@_WDH@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
3421 /* ?_Getcat@?$codecvt@_WDH@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
3422 MSVCP_size_t __cdecl codecvt_wchar__Getcat(const locale_facet **facet, const locale *loc)
3424 TRACE("(%p %p)\n", facet, loc);
3426 if(facet && !*facet) {
3427 _Locinfo locinfo;
3429 *facet = MSVCRT_operator_new(sizeof(codecvt_wchar));
3430 if(!*facet) {
3431 ERR("Out of memory\n");
3432 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
3433 return 0;
3436 _Locinfo_ctor_cstr(&locinfo, locale_string_char_c_str(&loc->ptr->name));
3437 codecvt_wchar_ctor_locinfo((codecvt_wchar*)*facet, &locinfo, 0);
3438 _Locinfo_dtor(&locinfo);
3441 return LC_CTYPE;
3444 /* ?_Getcat@?$codecvt@_WDH@std@@SAIPAPBVfacet@locale@2@@Z */
3445 /* ?_Getcat@?$codecvt@_WDH@std@@SA_KPEAPEBVfacet@locale@2@@Z */
3446 MSVCP_size_t __cdecl codecvt_wchar__Getcat_old(const locale_facet **facet)
3448 return codecvt_wchar__Getcat(facet, locale_classic());
3451 codecvt_wchar* codecvt_wchar_use_facet(const locale *loc)
3453 static codecvt_wchar *obj = NULL;
3455 _Lockit lock;
3456 const locale_facet *fac;
3458 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
3459 fac = locale__Getfacet(loc, locale_id_operator_size_t(&codecvt_wchar_id));
3460 if(fac) {
3461 _Lockit_dtor(&lock);
3462 return (codecvt_wchar*)fac;
3465 if(obj) {
3466 _Lockit_dtor(&lock);
3467 return obj;
3470 codecvt_wchar__Getcat(&fac, loc);
3471 obj = (codecvt_wchar*)fac;
3472 call_locale_facet__Incref(&obj->base.facet);
3473 locale_facet_register(&obj->base.facet);
3474 _Lockit_dtor(&lock);
3476 return obj;
3479 /* ?_Getcat@?$codecvt@GDH@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
3480 /* ?_Getcat@?$codecvt@GDH@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
3481 MSVCP_size_t __cdecl codecvt_short__Getcat(const locale_facet **facet, const locale *loc)
3483 TRACE("(%p %p)\n", facet, loc);
3485 if(facet && !*facet) {
3486 _Locinfo locinfo;
3488 *facet = MSVCRT_operator_new(sizeof(codecvt_wchar));
3489 if(!*facet) {
3490 ERR("Out of memory\n");
3491 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
3492 return 0;
3495 _Locinfo_ctor_cstr(&locinfo, locale_string_char_c_str(&loc->ptr->name));
3496 codecvt_short_ctor((codecvt_wchar*)*facet);
3497 _Locinfo_dtor(&locinfo);
3500 return LC_CTYPE;
3503 /* ?_Getcat@?$codecvt@GDH@std@@SAIPAPBVfacet@locale@2@@Z */
3504 /* ?_Getcat@?$codecvt@GDH@std@@SA_KPEAPEBVfacet@locale@2@@Z */
3505 MSVCP_size_t __cdecl codecvt_short__Getcat_old(const locale_facet **facet)
3507 return codecvt_short__Getcat(facet, locale_classic());
3510 codecvt_wchar* codecvt_short_use_facet(const locale *loc)
3512 static codecvt_wchar *obj = NULL;
3514 _Lockit lock;
3515 const locale_facet *fac;
3517 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
3518 fac = locale__Getfacet(loc, locale_id_operator_size_t(&codecvt_short_id));
3519 if(fac) {
3520 _Lockit_dtor(&lock);
3521 return (codecvt_wchar*)fac;
3524 if(obj) {
3525 _Lockit_dtor(&lock);
3526 return obj;
3529 codecvt_short__Getcat(&fac, loc);
3530 obj = (codecvt_wchar*)fac;
3531 call_locale_facet__Incref(&obj->base.facet);
3532 locale_facet_register(&obj->base.facet);
3533 _Lockit_dtor(&lock);
3535 return obj;
3538 /* ?_Id_func@?$codecvt@_WDH@std@@SAAAVid@locale@2@XZ */
3539 /* ?_Id_func@?$codecvt@_WDH@std@@SAAEAVid@locale@2@XZ */
3540 locale_id* __cdecl codecvt_wchar__Id_func(void)
3542 TRACE("()\n");
3543 return &codecvt_wchar_id;
3546 /* ?_Id_func@?$codecvt@GDH@std@@SAAAVid@locale@2@XZ */
3547 /* ?_Id_func@?$codecvt@GDH@std@@SAAEAVid@locale@2@XZ */
3548 locale_id* __cdecl codecvt_short__Id_func(void)
3550 TRACE("()\n");
3551 return &codecvt_short_id;
3554 /* ?do_always_noconv@?$codecvt@GDH@std@@MBE_NXZ */
3555 /* ?do_always_noconv@?$codecvt@GDH@std@@MEBA_NXZ */
3556 /* ?do_always_noconv@?$codecvt@_WDH@std@@MBE_NXZ */
3557 /* ?do_always_noconv@?$codecvt@_WDH@std@@MEBA_NXZ */
3558 DEFINE_THISCALL_WRAPPER(codecvt_wchar_do_always_noconv, 4)
3559 MSVCP_bool __thiscall codecvt_wchar_do_always_noconv(const codecvt_wchar *this)
3561 TRACE("(%p)\n", this);
3562 return FALSE;
3565 /* ?do_max_length@?$codecvt@GDH@std@@MBEHXZ */
3566 /* ?do_max_length@?$codecvt@GDH@std@@MEBAHXZ */
3567 /* ?do_max_length@?$codecvt@_WDH@std@@MBEHXZ */
3568 /* ?do_max_length@?$codecvt@_WDH@std@@MEBAHXZ */
3569 DEFINE_THISCALL_WRAPPER(codecvt_wchar_do_max_length, 4)
3570 int __thiscall codecvt_wchar_do_max_length(const codecvt_wchar *this)
3572 TRACE("(%p)\n", this);
3573 return MB_LEN_MAX;
3576 /* ?do_in@?$codecvt@GDH@std@@MBEHAAHPBD1AAPBDPAG3AAPAG@Z */
3577 /* ?do_in@?$codecvt@GDH@std@@MEBAHAEAHPEBD1AEAPEBDPEAG3AEAPEAG@Z */
3578 /* ?do_in@?$codecvt@_WDH@std@@MBEHAAHPBD1AAPBDPA_W3AAPA_W@Z */
3579 /* ?do_in@?$codecvt@_WDH@std@@MEBAHAEAHPEBD1AEAPEBDPEA_W3AEAPEA_W@Z */
3580 #if _MSVCP_VER <= 100
3581 #define call_codecvt_wchar_do_in(this, state, from, from_end, from_next, to, to_end, to_next) \
3582 CALL_VTBL_FUNC(this, 16, int, \
3583 (const codecvt_wchar*, int*, const char*, const char*, const char**, wchar_t*, wchar_t*, wchar_t**), \
3584 (this, state, from, from_end, from_next, to, to_end, to_next))
3585 #else
3586 #define call_codecvt_wchar_do_in(this, state, from, from_end, from_next, to, to_end, to_next) \
3587 CALL_VTBL_FUNC(this, 24, int, \
3588 (const codecvt_wchar*, int*, const char*, const char*, const char**, wchar_t*, wchar_t*, wchar_t**), \
3589 (this, state, from, from_end, from_next, to, to_end, to_next))
3590 #endif
3591 DEFINE_THISCALL_WRAPPER(codecvt_wchar_do_in, 32)
3592 int __thiscall codecvt_wchar_do_in(const codecvt_wchar *this, int *state,
3593 const char *from, const char *from_end, const char **from_next,
3594 wchar_t *to, wchar_t *to_end, wchar_t **to_next)
3596 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from,
3597 from_end, from_next, to, to_end, to_next);
3599 *from_next = from;
3600 *to_next = to;
3602 while(*from_next!=from_end && *to_next!=to_end) {
3603 switch(_Mbrtowc(*to_next, *from_next, from_end-*from_next, state, &this->cvt)) {
3604 case -2:
3605 *from_next = from_end;
3606 return CODECVT_partial;
3607 case -1:
3608 return CODECVT_error;
3609 case 2:
3610 (*from_next)++;
3611 /* fall through */
3612 case 0:
3613 case 1:
3614 (*from_next)++;
3615 (*to_next)++;
3619 return CODECVT_ok;
3622 /* ?in@?$codecvt@GDH@std@@QBEHAAHPBD1AAPBDPAG3AAPAG@Z */
3623 /* ?in@?$codecvt@GDH@std@@QEBAHAEAHPEBD1AEAPEBDPEAG3AEAPEAG@Z */
3624 /* ?in@?$codecvt@_WDH@std@@QBEHAAHPBD1AAPBDPA_W3AAPA_W@Z */
3625 /* ?in@?$codecvt@_WDH@std@@QEBAHAEAHPEBD1AEAPEBDPEA_W3AEAPEA_W@Z */
3626 DEFINE_THISCALL_WRAPPER(codecvt_wchar_in, 32)
3627 int __thiscall codecvt_wchar_in(const codecvt_wchar *this, int *state,
3628 const char *from, const char *from_end, const char **from_next,
3629 wchar_t *to, wchar_t *to_end, wchar_t **to_next)
3631 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from,
3632 from_end, from_next, to, to_end, to_next);
3633 return call_codecvt_wchar_do_in(this, state, from,
3634 from_end, from_next, to, to_end, to_next);
3637 /* ?do_out@?$codecvt@GDH@std@@MBEHAAHPBG1AAPBGPAD3AAPAD@Z */
3638 /* ?do_out@?$codecvt@GDH@std@@MEBAHAEAHPEBG1AEAPEBGPEAD3AEAPEAD@Z */
3639 /* ?do_out@?$codecvt@_WDH@std@@MBEHAAHPB_W1AAPB_WPAD3AAPAD@Z */
3640 /* ?do_out@?$codecvt@_WDH@std@@MEBAHAEAHPEB_W1AEAPEB_WPEAD3AEAPEAD@Z */
3641 #if _MSVCP_VER <= 100
3642 #define call_codecvt_wchar_do_out(this, state, from, from_end, from_next, to, to_end, to_next) \
3643 CALL_VTBL_FUNC(this, 20, int, \
3644 (const codecvt_wchar*, int*, const wchar_t*, const wchar_t*, const wchar_t**, char*, char*, char**), \
3645 (this, state, from, from_end, from_next, to, to_end, to_next))
3646 #else
3647 #define call_codecvt_wchar_do_out(this, state, from, from_end, from_next, to, to_end, to_next) \
3648 CALL_VTBL_FUNC(this, 28, int, \
3649 (const codecvt_wchar*, int*, const wchar_t*, const wchar_t*, const wchar_t**, char*, char*, char**), \
3650 (this, state, from, from_end, from_next, to, to_end, to_next))
3651 #endif
3652 DEFINE_THISCALL_WRAPPER(codecvt_wchar_do_out, 32)
3653 int __thiscall codecvt_wchar_do_out(const codecvt_wchar *this, int *state,
3654 const wchar_t *from, const wchar_t *from_end, const wchar_t **from_next,
3655 char *to, char *to_end, char **to_next)
3657 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from,
3658 from_end, from_next, to, to_end, to_next);
3660 *from_next = from;
3661 *to_next = to;
3663 while(*from_next!=from_end && *to_next!=to_end) {
3664 int old_state = *state, size;
3665 char buf[MB_LEN_MAX];
3667 switch((size = _Wcrtomb(buf, **from_next, state, &this->cvt))) {
3668 case -1:
3669 return CODECVT_error;
3670 default:
3671 if(size > from_end-*from_next) {
3672 *state = old_state;
3673 return CODECVT_partial;
3676 (*from_next)++;
3677 memcpy_s(*to_next, to_end-*to_next, buf, size);
3678 (*to_next) += size;
3682 return CODECVT_ok;
3685 /* ?out@?$codecvt@GDH@std@@QBEHAAHPBG1AAPBGPAD3AAPAD@Z */
3686 /* ?out@?$codecvt@GDH@std@@QEBAHAEAHPEBG1AEAPEBGPEAD3AEAPEAD@Z */
3687 /* ?out@?$codecvt@_WDH@std@@QBEHAAHPB_W1AAPB_WPAD3AAPAD@Z */
3688 /* ?out@?$codecvt@_WDH@std@@QEBAHAEAHPEB_W1AEAPEB_WPEAD3AEAPEAD@Z */
3689 DEFINE_THISCALL_WRAPPER(codecvt_wchar_out, 32)
3690 int __thiscall codecvt_wchar_out(const codecvt_wchar *this, int *state,
3691 const wchar_t *from, const wchar_t *from_end, const wchar_t **from_next,
3692 char *to, char *to_end, char **to_next)
3694 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from,
3695 from_end, from_next, to, to_end, to_next);
3696 return call_codecvt_wchar_do_out(this, state, from,
3697 from_end, from_next, to, to_end, to_next);
3700 /* ?do_unshift@?$codecvt@GDH@std@@MBEHAAHPAD1AAPAD@Z */
3701 /* ?do_unshift@?$codecvt@GDH@std@@MEBAHAEAHPEAD1AEAPEAD@Z */
3702 /* ?do_unshift@?$codecvt@_WDH@std@@MBEHAAHPAD1AAPAD@Z */
3703 /* ?do_unshift@?$codecvt@_WDH@std@@MEBAHAEAHPEAD1AEAPEAD@Z */
3704 #if _MSVCP_VER <= 100
3705 #define call_codecvt_wchar_do_unshift(this, state, to, to_end, to_next) CALL_VTBL_FUNC(this, 24, \
3706 int, (const codecvt_wchar*, int*, char*, char*, char**), (this, state, to, to_end, to_next))
3707 #else
3708 #define call_codecvt_wchar_do_unshift(this, state, to, to_end, to_next) CALL_VTBL_FUNC(this, 32, \
3709 int, (const codecvt_wchar*, int*, char*, char*, char**), (this, state, to, to_end, to_next))
3710 #endif
3711 DEFINE_THISCALL_WRAPPER(codecvt_wchar_do_unshift, 20)
3712 int __thiscall codecvt_wchar_do_unshift(const codecvt_wchar *this,
3713 int *state, char *to, char *to_end, char **to_next)
3715 TRACE("(%p %p %p %p %p)\n", this, state, to, to_end, to_next);
3716 if(*state)
3717 WARN("unexpected state: %x\n", *state);
3719 *to_next = to;
3720 return CODECVT_ok;
3723 /* ?unshift@?$codecvt@GDH@std@@QBEHAAHPAD1AAPAD@Z */
3724 /* ?unshift@?$codecvt@GDH@std@@QEBAHAEAHPEAD1AEAPEAD@Z */
3725 /* ?unshift@?$codecvt@_WDH@std@@QBEHAAHPAD1AAPAD@Z */
3726 /* ?unshift@?$codecvt@_WDH@std@@QEBAHAEAHPEAD1AEAPEAD@Z */
3727 DEFINE_THISCALL_WRAPPER(codecvt_wchar_unshift, 20)
3728 int __thiscall codecvt_wchar_unshift(const codecvt_wchar *this,
3729 int *state, char *to, char *to_end, char **to_next)
3731 TRACE("(%p %p %p %p %p)\n", this, state, to, to_end, to_next);
3732 return call_codecvt_wchar_do_unshift(this, state, to, to_end, to_next);
3735 /* ?do_length@?$codecvt@GDH@std@@MBEHABHPBD1I@Z */
3736 /* ?do_length@?$codecvt@GDH@std@@MEBAHAEBHPEBD1_K@Z */
3737 /* ?do_length@?$codecvt@_WDH@std@@MBEHABHPBD1I@Z */
3738 /* ?do_length@?$codecvt@_WDH@std@@MEBAHAEBHPEBD1_K@Z */
3739 #if _MSVCP_VER <= 100
3740 #define call_codecvt_wchar_do_length(this, state, from, from_end, max) CALL_VTBL_FUNC(this, 28, \
3741 int, (const codecvt_wchar*, const int*, const char*, const char*, MSVCP_size_t), \
3742 (this, state, from, from_end, max))
3743 #else
3744 #define call_codecvt_wchar_do_length(this, state, from, from_end, max) CALL_VTBL_FUNC(this, 36, \
3745 int, (const codecvt_wchar*, const int*, const char*, const char*, MSVCP_size_t), \
3746 (this, state, from, from_end, max))
3747 #endif
3748 DEFINE_THISCALL_WRAPPER(codecvt_wchar_do_length, 20)
3749 int __thiscall codecvt_wchar_do_length(const codecvt_wchar *this, const int *state,
3750 const char *from, const char *from_end, MSVCP_size_t max)
3752 int tmp_state = *state, ret=0;
3754 TRACE("(%p %p %p %p %ld)\n", this, state, from, from_end, max);
3756 while(ret<max && from!=from_end) {
3757 switch(_Mbrtowc(NULL, from, from_end-from, &tmp_state, &this->cvt)) {
3758 case -2:
3759 case -1:
3760 return ret;
3761 case 2:
3762 from++;
3763 /* fall through */
3764 case 0:
3765 case 1:
3766 from++;
3767 ret++;
3771 return ret;
3774 /* ?length@?$codecvt@GDH@std@@QBEHABHPBD1I@Z */
3775 /* ?length@?$codecvt@GDH@std@@QEBAHAEBHPEBD1_K@Z */
3776 /* ?length@?$codecvt@_WDH@std@@QBEHABHPBD1I@Z */
3777 /* ?length@?$codecvt@_WDH@std@@QEBAHAEBHPEBD1_K@Z */
3778 DEFINE_THISCALL_WRAPPER(codecvt_wchar_length, 20)
3779 int __thiscall codecvt_wchar_length(const codecvt_wchar *this, const int *state,
3780 const char *from, const char *from_end, MSVCP_size_t max)
3782 TRACE("(%p %p %p %p %ld)\n", this, state, from, from_end, max);
3783 return call_codecvt_wchar_do_length(this, state, from, from_end, max);
3786 /* ?id@?$numpunct@D@std@@2V0locale@2@A */
3787 locale_id numpunct_char_id = {0};
3789 /* ??_7?$numpunct@D@std@@6B@ */
3790 extern const vtable_ptr MSVCP_numpunct_char_vtable;
3792 /* ?_Init@?$numpunct@D@std@@IAEXABV_Locinfo@2@_N@Z */
3793 /* ?_Init@?$numpunct@D@std@@IEAAXAEBV_Locinfo@2@_N@Z */
3794 DEFINE_THISCALL_WRAPPER(numpunct_char__Init, 12)
3795 void __thiscall numpunct_char__Init(numpunct_char *this, const _Locinfo *locinfo, MSVCP_bool isdef)
3797 int len;
3799 TRACE("(%p %p %d)\n", this, locinfo, isdef);
3801 len = strlen(_Locinfo__Getfalse(locinfo))+1;
3802 this->false_name = MSVCRT_operator_new(len);
3803 if(this->false_name)
3804 memcpy((char*)this->false_name, _Locinfo__Getfalse(locinfo), len);
3806 len = strlen(_Locinfo__Gettrue(locinfo))+1;
3807 this->true_name = MSVCRT_operator_new(len);
3808 if(this->true_name)
3809 memcpy((char*)this->true_name, _Locinfo__Gettrue(locinfo), len);
3811 if(isdef) {
3812 this->grouping = MSVCRT_operator_new(1);
3813 if(this->grouping)
3814 *(char*)this->grouping = 0;
3816 this->dp = '.';
3817 this->sep = ',';
3818 } else {
3819 const struct lconv *lc = _Locinfo__Getlconv(locinfo);
3821 len = strlen(lc->grouping)+1;
3822 this->grouping = MSVCRT_operator_new(len);
3823 if(this->grouping)
3824 memcpy((char*)this->grouping, lc->grouping, len);
3826 this->dp = lc->decimal_point[0];
3827 this->sep = lc->thousands_sep[0];
3830 if(!this->false_name || !this->true_name || !this->grouping) {
3831 MSVCRT_operator_delete((char*)this->grouping);
3832 MSVCRT_operator_delete((char*)this->false_name);
3833 MSVCRT_operator_delete((char*)this->true_name);
3835 ERR("Out of memory\n");
3836 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
3840 /* ?_Tidy@?$numpunct@D@std@@AAEXXZ */
3841 /* ?_Tidy@?$numpunct@D@std@@AEAAXXZ */
3842 DEFINE_THISCALL_WRAPPER(numpunct_char__Tidy, 4)
3843 void __thiscall numpunct_char__Tidy(numpunct_char *this)
3845 TRACE("(%p)\n", this);
3847 MSVCRT_operator_delete((char*)this->grouping);
3848 MSVCRT_operator_delete((char*)this->false_name);
3849 MSVCRT_operator_delete((char*)this->true_name);
3852 /* ??0?$numpunct@D@std@@QAE@ABV_Locinfo@1@I_N@Z */
3853 /* ??0?$numpunct@D@std@@QEAA@AEBV_Locinfo@1@_K_N@Z */
3854 DEFINE_THISCALL_WRAPPER(numpunct_char_ctor_locinfo, 16)
3855 numpunct_char* __thiscall numpunct_char_ctor_locinfo(numpunct_char *this,
3856 const _Locinfo *locinfo, MSVCP_size_t refs, MSVCP_bool usedef)
3858 TRACE("(%p %p %lu %d)\n", this, locinfo, refs, usedef);
3859 locale_facet_ctor_refs(&this->facet, refs);
3860 this->facet.vtable = &MSVCP_numpunct_char_vtable;
3861 numpunct_char__Init(this, locinfo, usedef);
3862 return this;
3865 /* ??0?$numpunct@D@std@@IAE@PBDI_N@Z */
3866 /* ??0?$numpunct@D@std@@IEAA@PEBD_K_N@Z */
3867 DEFINE_THISCALL_WRAPPER(numpunct_char_ctor_name, 16)
3868 numpunct_char* __thiscall numpunct_char_ctor_name(numpunct_char *this,
3869 const char *name, MSVCP_size_t refs, MSVCP_bool usedef)
3871 _Locinfo locinfo;
3873 TRACE("(%p %s %lu %d)\n", this, debugstr_a(name), refs, usedef);
3874 locale_facet_ctor_refs(&this->facet, refs);
3875 this->facet.vtable = &MSVCP_numpunct_char_vtable;
3877 _Locinfo_ctor_cstr(&locinfo, name);
3878 numpunct_char__Init(this, &locinfo, usedef);
3879 _Locinfo_dtor(&locinfo);
3880 return this;
3883 /* ??0?$numpunct@D@std@@QAE@I@Z */
3884 /* ??0?$numpunct@D@std@@QEAA@_K@Z */
3885 DEFINE_THISCALL_WRAPPER(numpunct_char_ctor_refs, 8)
3886 numpunct_char* __thiscall numpunct_char_ctor_refs(numpunct_char *this, MSVCP_size_t refs)
3888 TRACE("(%p %lu)\n", this, refs);
3889 return numpunct_char_ctor_name(this, "C", refs, FALSE);
3892 /* ??_F?$numpunct@D@std@@QAEXXZ */
3893 /* ??_F?$numpunct@D@std@@QEAAXXZ */
3894 DEFINE_THISCALL_WRAPPER(numpunct_char_ctor, 4)
3895 numpunct_char* __thiscall numpunct_char_ctor(numpunct_char *this)
3897 return numpunct_char_ctor_refs(this, 0);
3900 /* ??1?$numpunct@D@std@@MAE@XZ */
3901 /* ??1?$numpunct@D@std@@MEAA@XZ */
3902 DEFINE_THISCALL_WRAPPER(numpunct_char_dtor, 4)
3903 void __thiscall numpunct_char_dtor(numpunct_char *this)
3905 TRACE("(%p)\n", this);
3906 numpunct_char__Tidy(this);
3909 DEFINE_THISCALL_WRAPPER(numpunct_char_vector_dtor, 8)
3910 numpunct_char* __thiscall numpunct_char_vector_dtor(numpunct_char *this, unsigned int flags)
3912 TRACE("(%p %x)\n", this, flags);
3913 if(flags & 2) {
3914 /* we have an array, with the number of elements stored before the first object */
3915 INT_PTR i, *ptr = (INT_PTR *)this-1;
3917 for(i=*ptr-1; i>=0; i--)
3918 numpunct_char_dtor(this+i);
3919 MSVCRT_operator_delete(ptr);
3920 } else {
3921 numpunct_char_dtor(this);
3922 if(flags & 1)
3923 MSVCRT_operator_delete(this);
3926 return this;
3929 /* ?_Getcat@?$numpunct@D@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
3930 /* ?_Getcat@?$numpunct@D@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
3931 MSVCP_size_t __cdecl numpunct_char__Getcat(const locale_facet **facet, const locale *loc)
3933 TRACE("(%p %p)\n", facet, loc);
3935 if(facet && !*facet) {
3936 *facet = MSVCRT_operator_new(sizeof(numpunct_char));
3937 if(!*facet) {
3938 ERR("Out of memory\n");
3939 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
3940 return 0;
3942 numpunct_char_ctor_name((numpunct_char*)*facet,
3943 locale_string_char_c_str(&loc->ptr->name), 0, TRUE);
3946 return LC_NUMERIC;
3949 /* ?_Getcat@?$numpunct@D@std@@SAIPAPBVfacet@locale@2@@Z */
3950 /* ?_Getcat@?$numpunct@D@std@@SA_KPEAPEBVfacet@locale@2@@Z */
3951 MSVCP_size_t __cdecl numpunct_char__Getcat_old(const locale_facet **facet)
3953 return numpunct_char__Getcat(facet, locale_classic());
3956 static numpunct_char* numpunct_char_use_facet(const locale *loc)
3958 static numpunct_char *obj = NULL;
3960 _Lockit lock;
3961 const locale_facet *fac;
3963 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
3964 fac = locale__Getfacet(loc, locale_id_operator_size_t(&numpunct_char_id));
3965 if(fac) {
3966 _Lockit_dtor(&lock);
3967 return (numpunct_char*)fac;
3970 if(obj) {
3971 _Lockit_dtor(&lock);
3972 return obj;
3975 numpunct_char__Getcat(&fac, loc);
3976 obj = (numpunct_char*)fac;
3977 call_locale_facet__Incref(&obj->facet);
3978 locale_facet_register(&obj->facet);
3979 _Lockit_dtor(&lock);
3981 return obj;
3984 /* ?do_decimal_point@?$numpunct@D@std@@MBEDXZ */
3985 /* ?do_decimal_point@?$numpunct@D@std@@MEBADXZ */
3986 DEFINE_THISCALL_WRAPPER(numpunct_char_do_decimal_point, 4)
3987 #if _MSVCP_VER <= 100
3988 #define call_numpunct_char_do_decimal_point(this) CALL_VTBL_FUNC(this, 4, \
3989 char, (const numpunct_char *this), (this))
3990 #else
3991 #define call_numpunct_char_do_decimal_point(this) CALL_VTBL_FUNC(this, 12, \
3992 char, (const numpunct_char *this), (this))
3993 #endif
3994 char __thiscall numpunct_char_do_decimal_point(const numpunct_char *this)
3996 TRACE("(%p)\n", this);
3997 return this->dp;
4000 /* ?decimal_point@?$numpunct@D@std@@QBEDXZ */
4001 /* ?decimal_point@?$numpunct@D@std@@QEBADXZ */
4002 DEFINE_THISCALL_WRAPPER(numpunct_char_decimal_point, 4)
4003 char __thiscall numpunct_char_decimal_point(const numpunct_char *this)
4005 TRACE("(%p)\n", this);
4006 return call_numpunct_char_do_decimal_point(this);
4009 /* ?do_thousands_sep@?$numpunct@D@std@@MBEDXZ */
4010 /* ?do_thousands_sep@?$numpunct@D@std@@MEBADXZ */
4011 DEFINE_THISCALL_WRAPPER(numpunct_char_do_thousands_sep, 4)
4012 #if _MSVCP_VER <= 100
4013 #define call_numpunct_char_do_thousands_sep(this) CALL_VTBL_FUNC(this, 8, \
4014 char, (const numpunct_char*), (this))
4015 #else
4016 #define call_numpunct_char_do_thousands_sep(this) CALL_VTBL_FUNC(this, 16, \
4017 char, (const numpunct_char*), (this))
4018 #endif
4019 char __thiscall numpunct_char_do_thousands_sep(const numpunct_char *this)
4021 TRACE("(%p)\n", this);
4022 return this->sep;
4025 /* ?thousands_sep@?$numpunct@D@std@@QBEDXZ */
4026 /* ?thousands_sep@?$numpunct@D@std@@QEBADXZ */
4027 DEFINE_THISCALL_WRAPPER(numpunct_char_thousands_sep, 4)
4028 char __thiscall numpunct_char_thousands_sep(const numpunct_char *this)
4030 TRACE("(%p)\n", this);
4031 return call_numpunct_char_do_thousands_sep(this);
4034 /* ?do_grouping@?$numpunct@D@std@@MBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4035 /* ?do_grouping@?$numpunct@D@std@@MEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4036 DEFINE_THISCALL_WRAPPER(numpunct_char_do_grouping, 8)
4037 #if _MSVCP_VER <= 100
4038 #define call_numpunct_char_do_grouping(this, ret) CALL_VTBL_FUNC(this, 12, \
4039 basic_string_char*, (const numpunct_char*, basic_string_char*), (this, ret))
4040 #else
4041 #define call_numpunct_char_do_grouping(this, ret) CALL_VTBL_FUNC(this, 20, \
4042 basic_string_char*, (const numpunct_char*, basic_string_char*), (this, ret))
4043 #endif
4044 basic_string_char* __thiscall numpunct_char_do_grouping(
4045 const numpunct_char *this, basic_string_char *ret)
4047 TRACE("(%p)\n", this);
4048 return MSVCP_basic_string_char_ctor_cstr(ret, this->grouping);
4051 /* ?grouping@?$numpunct@D@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4052 /* ?grouping@?$numpunct@D@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4053 DEFINE_THISCALL_WRAPPER(numpunct_char_grouping, 8)
4054 basic_string_char* __thiscall numpunct_char_grouping(const numpunct_char *this, basic_string_char *ret)
4056 TRACE("(%p)\n", this);
4057 return call_numpunct_char_do_grouping(this, ret);
4060 /* ?do_falsename@?$numpunct@D@std@@MBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4061 /* ?do_falsename@?$numpunct@D@std@@MEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4062 DEFINE_THISCALL_WRAPPER(numpunct_char_do_falsename, 8)
4063 #if _MSVCP_VER <= 100
4064 #define call_numpunct_char_do_falsename(this, ret) CALL_VTBL_FUNC(this, 16, \
4065 basic_string_char*, (const numpunct_char*, basic_string_char*), (this, ret))
4066 #else
4067 #define call_numpunct_char_do_falsename(this, ret) CALL_VTBL_FUNC(this, 24, \
4068 basic_string_char*, (const numpunct_char*, basic_string_char*), (this, ret))
4069 #endif
4070 basic_string_char* __thiscall numpunct_char_do_falsename(
4071 const numpunct_char *this, basic_string_char *ret)
4073 TRACE("(%p)\n", this);
4074 return MSVCP_basic_string_char_ctor_cstr(ret, this->false_name);
4077 /* ?falsename@?$numpunct@D@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4078 /* ?falsename@?$numpunct@D@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4079 DEFINE_THISCALL_WRAPPER(numpunct_char_falsename, 8)
4080 basic_string_char* __thiscall numpunct_char_falsename(const numpunct_char *this, basic_string_char *ret)
4082 TRACE("(%p)\n", this);
4083 return call_numpunct_char_do_falsename(this, ret);
4086 /* ?do_truename@?$numpunct@D@std@@MBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4087 /* ?do_truename@?$numpunct@D@std@@MEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4088 DEFINE_THISCALL_WRAPPER(numpunct_char_do_truename, 8)
4089 #if _MSVCP_VER <= 100
4090 #define call_numpunct_char_do_truename(this, ret) CALL_VTBL_FUNC(this, 20, \
4091 basic_string_char*, (const numpunct_char*, basic_string_char*), (this, ret))
4092 #else
4093 #define call_numpunct_char_do_truename(this, ret) CALL_VTBL_FUNC(this, 28, \
4094 basic_string_char*, (const numpunct_char*, basic_string_char*), (this, ret))
4095 #endif
4096 basic_string_char* __thiscall numpunct_char_do_truename(
4097 const numpunct_char *this, basic_string_char *ret)
4099 TRACE("(%p)\n", this);
4100 return MSVCP_basic_string_char_ctor_cstr(ret, this->true_name);
4103 /* ?truename@?$numpunct@D@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4104 /* ?truename@?$numpunct@D@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4105 DEFINE_THISCALL_WRAPPER(numpunct_char_truename, 8)
4106 basic_string_char* __thiscall numpunct_char_truename(const numpunct_char *this, basic_string_char *ret)
4108 TRACE("(%p)\n", this);
4109 return call_numpunct_char_do_truename(this, ret);
4112 /* ?id@?$numpunct@_W@std@@2V0locale@2@A */
4113 locale_id numpunct_wchar_id = {0};
4114 /* ?id@?$numpunct@G@std@@2V0locale@2@A */
4115 locale_id numpunct_short_id = {0};
4117 /* ??_7?$numpunct@_W@std@@6B@ */
4118 extern const vtable_ptr MSVCP_numpunct_wchar_vtable;
4119 /* ??_7?$numpunct@G@std@@6B@ */
4120 extern const vtable_ptr MSVCP_numpunct_short_vtable;
4122 /* ?_Init@?$numpunct@_W@std@@IAEXABV_Locinfo@2@_N@Z */
4123 /* ?_Init@?$numpunct@_W@std@@IEAAXAEBV_Locinfo@2@_N@Z */
4124 /* ?_Init@?$numpunct@G@std@@IAEXABV_Locinfo@2@_N@Z */
4125 /* ?_Init@?$numpunct@G@std@@IEAAXAEBV_Locinfo@2@_N@Z */
4126 DEFINE_THISCALL_WRAPPER(numpunct_wchar__Init, 12)
4127 void __thiscall numpunct_wchar__Init(numpunct_wchar *this,
4128 const _Locinfo *locinfo, MSVCP_bool isdef)
4130 const char *to_convert;
4131 _Cvtvec cvt;
4132 int len;
4134 TRACE("(%p %p %d)\n", this, locinfo, isdef);
4136 _Locinfo__Getcvt(locinfo, &cvt);
4138 to_convert = _Locinfo__Getfalse(locinfo);
4139 len = MultiByteToWideChar(cvt.page, 0, to_convert, -1, NULL, 0);
4140 this->false_name = MSVCRT_operator_new(len*sizeof(WCHAR));
4141 if(this->false_name)
4142 MultiByteToWideChar(cvt.page, 0, to_convert, -1,
4143 (wchar_t*)this->false_name, len);
4145 to_convert = _Locinfo__Gettrue(locinfo);
4146 len = MultiByteToWideChar(cvt.page, 0, to_convert, -1, NULL, 0);
4147 this->true_name = MSVCRT_operator_new(len*sizeof(WCHAR));
4148 if(this->true_name)
4149 MultiByteToWideChar(cvt.page, 0, to_convert, -1,
4150 (wchar_t*)this->true_name, len);
4152 if(isdef) {
4153 this->grouping = MSVCRT_operator_new(1);
4154 if(this->grouping)
4155 *(char*)this->grouping = 0;
4157 this->dp = '.';
4158 this->sep = ',';
4159 } else {
4160 const struct lconv *lc = _Locinfo__Getlconv(locinfo);
4162 len = strlen(lc->grouping)+1;
4163 this->grouping = MSVCRT_operator_new(len);
4164 if(this->grouping)
4165 memcpy((char*)this->grouping, lc->grouping, len);
4167 this->dp = lc->decimal_point[0];
4168 this->sep = lc->thousands_sep[0];
4171 if(!this->false_name || !this->true_name || !this->grouping) {
4172 MSVCRT_operator_delete((char*)this->grouping);
4173 MSVCRT_operator_delete((wchar_t*)this->false_name);
4174 MSVCRT_operator_delete((wchar_t*)this->true_name);
4176 ERR("Out of memory\n");
4177 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
4181 /* ?_Tidy@?$numpunct@_W@std@@AAEXXZ */
4182 /* ?_Tidy@?$numpunct@_W@std@@AEAAXXZ */
4183 /* ?_Tidy@?$numpunct@G@std@@AAEXXZ */
4184 /* ?_Tidy@?$numpunct@G@std@@AEAAXXZ */
4185 DEFINE_THISCALL_WRAPPER(numpunct_wchar__Tidy, 4)
4186 void __thiscall numpunct_wchar__Tidy(numpunct_wchar *this)
4188 TRACE("(%p)\n", this);
4190 MSVCRT_operator_delete((char*)this->grouping);
4191 MSVCRT_operator_delete((wchar_t*)this->false_name);
4192 MSVCRT_operator_delete((wchar_t*)this->true_name);
4195 /* ??0?$numpunct@_W@std@@QAE@ABV_Locinfo@1@I_N@Z */
4196 /* ??0?$numpunct@_W@std@@QEAA@AEBV_Locinfo@1@_K_N@Z */
4197 DEFINE_THISCALL_WRAPPER(numpunct_wchar_ctor_locinfo, 16)
4198 numpunct_wchar* __thiscall numpunct_wchar_ctor_locinfo(numpunct_wchar *this,
4199 const _Locinfo *locinfo, MSVCP_size_t refs, MSVCP_bool usedef)
4201 TRACE("(%p %p %lu %d)\n", this, locinfo, refs, usedef);
4202 locale_facet_ctor_refs(&this->facet, refs);
4203 this->facet.vtable = &MSVCP_numpunct_wchar_vtable;
4204 numpunct_wchar__Init(this, locinfo, usedef);
4205 return this;
4208 /* ??0?$numpunct@G@std@@QAE@ABV_Locinfo@1@I_N@Z */
4209 /* ??0?$numpunct@G@std@@QEAA@AEBV_Locinfo@1@_K_N@Z */
4210 DEFINE_THISCALL_WRAPPER(numpunct_short_ctor_locinfo, 16)
4211 numpunct_wchar* __thiscall numpunct_short_ctor_locinfo(numpunct_wchar *this,
4212 const _Locinfo *locinfo, MSVCP_size_t refs, MSVCP_bool usedef)
4214 numpunct_wchar_ctor_locinfo(this, locinfo, refs, usedef);
4215 this->facet.vtable = &MSVCP_numpunct_short_vtable;
4216 return this;
4219 /* ??0?$numpunct@_W@std@@IAE@PBDI_N@Z */
4220 /* ??0?$numpunct@_W@std@@IEAA@PEBD_K_N@Z */
4221 DEFINE_THISCALL_WRAPPER(numpunct_wchar_ctor_name, 16)
4222 numpunct_wchar* __thiscall numpunct_wchar_ctor_name(numpunct_wchar *this,
4223 const char *name, MSVCP_size_t refs, MSVCP_bool usedef)
4225 _Locinfo locinfo;
4227 TRACE("(%p %s %lu %d)\n", this, debugstr_a(name), refs, usedef);
4228 locale_facet_ctor_refs(&this->facet, refs);
4229 this->facet.vtable = &MSVCP_numpunct_wchar_vtable;
4231 _Locinfo_ctor_cstr(&locinfo, name);
4232 numpunct_wchar__Init(this, &locinfo, usedef);
4233 _Locinfo_dtor(&locinfo);
4234 return this;
4237 /* ??0?$numpunct@G@std@@IAE@PBDI_N@Z */
4238 /* ??0?$numpunct@G@std@@IEAA@PEBD_K_N@Z */
4239 DEFINE_THISCALL_WRAPPER(numpunct_short_ctor_name, 16)
4240 numpunct_wchar* __thiscall numpunct_short_ctor_name(numpunct_wchar *this,
4241 const char *name, MSVCP_size_t refs, MSVCP_bool usedef)
4243 numpunct_wchar_ctor_name(this, name, refs, usedef);
4244 this->facet.vtable = &MSVCP_numpunct_short_vtable;
4245 return this;
4248 /* ??0?$numpunct@_W@std@@QAE@I@Z */
4249 /* ??0?$numpunct@_W@std@@QEAA@_K@Z */
4250 DEFINE_THISCALL_WRAPPER(numpunct_wchar_ctor_refs, 8)
4251 numpunct_wchar* __thiscall numpunct_wchar_ctor_refs(numpunct_wchar *this, MSVCP_size_t refs)
4253 TRACE("(%p %lu)\n", this, refs);
4254 return numpunct_wchar_ctor_name(this, "C", refs, FALSE);
4257 /* ??0?$numpunct@G@std@@QAE@I@Z */
4258 /* ??0?$numpunct@G@std@@QEAA@_K@Z */
4259 DEFINE_THISCALL_WRAPPER(numpunct_short_ctor_refs, 8)
4260 numpunct_wchar* __thiscall numpunct_short_ctor_refs(numpunct_wchar *this, MSVCP_size_t refs)
4262 numpunct_wchar_ctor_refs(this, refs);
4263 this->facet.vtable = &MSVCP_numpunct_short_vtable;
4264 return this;
4267 /* ??_F?$numpunct@_W@std@@QAEXXZ */
4268 /* ??_F?$numpunct@_W@std@@QEAAXXZ */
4269 DEFINE_THISCALL_WRAPPER(numpunct_wchar_ctor, 4)
4270 numpunct_wchar* __thiscall numpunct_wchar_ctor(numpunct_wchar *this)
4272 return numpunct_wchar_ctor_refs(this, 0);
4275 /* ??_F?$numpunct@G@std@@QAEXXZ */
4276 /* ??_F?$numpunct@G@std@@QEAAXXZ */
4277 DEFINE_THISCALL_WRAPPER(numpunct_short_ctor, 4)
4278 numpunct_wchar* __thiscall numpunct_short_ctor(numpunct_wchar *this)
4280 return numpunct_short_ctor_refs(this, 0);
4283 /* ??1?$numpunct@_W@std@@MAE@XZ */
4284 /* ??1?$numpunct@_W@std@@MEAA@XZ */
4285 /* ??1?$numpunct@G@std@@MAE@XZ */
4286 /* ??1?$numpunct@G@std@@MEAA@XZ */
4287 DEFINE_THISCALL_WRAPPER(numpunct_wchar_dtor, 4)
4288 void __thiscall numpunct_wchar_dtor(numpunct_wchar *this)
4290 TRACE("(%p)\n", this);
4291 numpunct_wchar__Tidy(this);
4294 DEFINE_THISCALL_WRAPPER(numpunct_wchar_vector_dtor, 8)
4295 numpunct_wchar* __thiscall numpunct_wchar_vector_dtor(numpunct_wchar *this, unsigned int flags)
4297 TRACE("(%p %x)\n", this, flags);
4298 if(flags & 2) {
4299 /* we have an array, with the number of elements stored before the first object */
4300 INT_PTR i, *ptr = (INT_PTR *)this-1;
4302 for(i=*ptr-1; i>=0; i--)
4303 numpunct_wchar_dtor(this+i);
4304 MSVCRT_operator_delete(ptr);
4305 } else {
4306 numpunct_wchar_dtor(this);
4307 if(flags & 1)
4308 MSVCRT_operator_delete(this);
4311 return this;
4314 /* ?_Getcat@?$numpunct@_W@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
4315 /* ?_Getcat@?$numpunct@_W@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
4316 MSVCP_size_t __cdecl numpunct_wchar__Getcat(const locale_facet **facet, const locale *loc)
4318 TRACE("(%p %p)\n", facet, loc);
4320 if(facet && !*facet) {
4321 *facet = MSVCRT_operator_new(sizeof(numpunct_wchar));
4322 if(!*facet) {
4323 ERR("Out of memory\n");
4324 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
4325 return 0;
4327 numpunct_wchar_ctor_name((numpunct_wchar*)*facet,
4328 locale_string_char_c_str(&loc->ptr->name), 0, TRUE);
4331 return LC_NUMERIC;
4334 /* ?_Getcat@?$numpunct@_W@std@@SAIPAPBVfacet@locale@2@@Z */
4335 /* ?_Getcat@?$numpunct@_W@std@@SA_KPEAPEBVfacet@locale@2@@Z */
4336 MSVCP_size_t __cdecl numpunct_wchar__Getcat_old(const locale_facet **facet)
4338 return numpunct_wchar__Getcat(facet, locale_classic());
4341 static numpunct_wchar* numpunct_wchar_use_facet(const locale *loc)
4343 static numpunct_wchar *obj = NULL;
4345 _Lockit lock;
4346 const locale_facet *fac;
4348 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
4349 fac = locale__Getfacet(loc, locale_id_operator_size_t(&numpunct_wchar_id));
4350 if(fac) {
4351 _Lockit_dtor(&lock);
4352 return (numpunct_wchar*)fac;
4355 if(obj) {
4356 _Lockit_dtor(&lock);
4357 return obj;
4360 numpunct_wchar__Getcat(&fac, loc);
4361 obj = (numpunct_wchar*)fac;
4362 call_locale_facet__Incref(&obj->facet);
4363 locale_facet_register(&obj->facet);
4364 _Lockit_dtor(&lock);
4366 return obj;
4369 /* ?_Getcat@?$numpunct@G@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
4370 /* ?_Getcat@?$numpunct@G@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
4371 MSVCP_size_t __cdecl numpunct_short__Getcat(const locale_facet **facet, const locale *loc)
4373 TRACE("(%p %p)\n", facet, loc);
4375 if(facet && !*facet) {
4376 *facet = MSVCRT_operator_new(sizeof(numpunct_wchar));
4377 if(!*facet) {
4378 ERR("Out of memory\n");
4379 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
4380 return 0;
4382 numpunct_short_ctor_name((numpunct_wchar*)*facet,
4383 locale_string_char_c_str(&loc->ptr->name), 0, TRUE);
4386 return LC_NUMERIC;
4389 /* ?_Getcat@?$numpunct@G@std@@SAIPAPBVfacet@locale@2@@Z */
4390 /* ?_Getcat@?$numpunct@G@std@@SA_KPEAPEBVfacet@locale@2@@Z */
4391 MSVCP_size_t __cdecl numpunct_short__Getcat_old(const locale_facet **facet)
4393 return numpunct_short__Getcat(facet, locale_classic());
4396 static numpunct_wchar* numpunct_short_use_facet(const locale *loc)
4398 static numpunct_wchar *obj = NULL;
4400 _Lockit lock;
4401 const locale_facet *fac;
4403 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
4404 fac = locale__Getfacet(loc, locale_id_operator_size_t(&numpunct_short_id));
4405 if(fac) {
4406 _Lockit_dtor(&lock);
4407 return (numpunct_wchar*)fac;
4410 if(obj) {
4411 _Lockit_dtor(&lock);
4412 return obj;
4415 numpunct_short__Getcat(&fac, loc);
4416 obj = (numpunct_wchar*)fac;
4417 call_locale_facet__Incref(&obj->facet);
4418 locale_facet_register(&obj->facet);
4419 _Lockit_dtor(&lock);
4421 return obj;
4424 /* ?do_decimal_point@?$numpunct@_W@std@@MBE_WXZ */
4425 /* ?do_decimal_point@?$numpunct@_W@std@@MEBA_WXZ */
4426 /* ?do_decimal_point@?$numpunct@G@std@@MBEGXZ */
4427 /* ?do_decimal_point@?$numpunct@G@std@@MEBAGXZ */
4428 DEFINE_THISCALL_WRAPPER(numpunct_wchar_do_decimal_point, 4)
4429 #if _MSVCP_VER <= 100
4430 #define call_numpunct_wchar_do_decimal_point(this) CALL_VTBL_FUNC(this, 4, \
4431 wchar_t, (const numpunct_wchar *this), (this))
4432 #else
4433 #define call_numpunct_wchar_do_decimal_point(this) CALL_VTBL_FUNC(this, 12, \
4434 wchar_t, (const numpunct_wchar *this), (this))
4435 #endif
4436 wchar_t __thiscall numpunct_wchar_do_decimal_point(const numpunct_wchar *this)
4438 TRACE("(%p)\n", this);
4439 return this->dp;
4442 /* ?decimal_point@?$numpunct@_W@std@@QBE_WXZ */
4443 /* ?decimal_point@?$numpunct@_W@std@@QEBA_WXZ */
4444 /* ?decimal_point@?$numpunct@G@std@@QBEGXZ */
4445 /* ?decimal_point@?$numpunct@G@std@@QEBAGXZ */
4446 DEFINE_THISCALL_WRAPPER(numpunct_wchar_decimal_point, 4)
4447 wchar_t __thiscall numpunct_wchar_decimal_point(const numpunct_wchar *this)
4449 TRACE("(%p)\n", this);
4450 return call_numpunct_wchar_do_decimal_point(this);
4453 /* ?do_thousands_sep@?$numpunct@_W@std@@MBE_WXZ */
4454 /* ?do_thousands_sep@?$numpunct@_W@std@@MEBA_WXZ */
4455 /* ?do_thousands_sep@?$numpunct@G@std@@MBEGXZ */
4456 /* ?do_thousands_sep@?$numpunct@G@std@@MEBAGXZ */
4457 DEFINE_THISCALL_WRAPPER(numpunct_wchar_do_thousands_sep, 4)
4458 #if _MSVCP_VER <= 100
4459 #define call_numpunct_wchar_do_thousands_sep(this) CALL_VTBL_FUNC(this, 8, \
4460 wchar_t, (const numpunct_wchar *this), (this))
4461 #else
4462 #define call_numpunct_wchar_do_thousands_sep(this) CALL_VTBL_FUNC(this, 16, \
4463 wchar_t, (const numpunct_wchar *this), (this))
4464 #endif
4465 wchar_t __thiscall numpunct_wchar_do_thousands_sep(const numpunct_wchar *this)
4467 TRACE("(%p)\n", this);
4468 return this->sep;
4471 /* ?thousands_sep@?$numpunct@_W@std@@QBE_WXZ */
4472 /* ?thousands_sep@?$numpunct@_W@std@@QEBA_WXZ */
4473 /* ?thousands_sep@?$numpunct@G@std@@QBEGXZ */
4474 /* ?thousands_sep@?$numpunct@G@std@@QEBAGXZ */
4475 DEFINE_THISCALL_WRAPPER(numpunct_wchar_thousands_sep, 4)
4476 wchar_t __thiscall numpunct_wchar_thousands_sep(const numpunct_wchar *this)
4478 TRACE("(%p)\n", this);
4479 return call_numpunct_wchar_do_thousands_sep(this);
4482 /* ?do_grouping@?$numpunct@_W@std@@MBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4483 /* ?do_grouping@?$numpunct@_W@std@@MEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4484 /* ?do_grouping@?$numpunct@G@std@@MBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4485 /* ?do_grouping@?$numpunct@G@std@@MEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4486 DEFINE_THISCALL_WRAPPER(numpunct_wchar_do_grouping, 8)
4487 #if _MSVCP_VER <= 100
4488 #define call_numpunct_wchar_do_grouping(this, ret) CALL_VTBL_FUNC(this, 12, \
4489 basic_string_char*, (const numpunct_wchar*, basic_string_char*), (this, ret))
4490 #else
4491 #define call_numpunct_wchar_do_grouping(this, ret) CALL_VTBL_FUNC(this, 20, \
4492 basic_string_char*, (const numpunct_wchar*, basic_string_char*), (this, ret))
4493 #endif
4494 basic_string_char* __thiscall numpunct_wchar_do_grouping(const numpunct_wchar *this, basic_string_char *ret)
4496 TRACE("(%p)\n", this);
4497 return MSVCP_basic_string_char_ctor_cstr(ret, this->grouping);
4500 /* ?grouping@?$numpunct@_W@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4501 /* ?grouping@?$numpunct@_W@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4502 /* ?grouping@?$numpunct@G@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4503 /* ?grouping@?$numpunct@G@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4504 DEFINE_THISCALL_WRAPPER(numpunct_wchar_grouping, 8)
4505 basic_string_char* __thiscall numpunct_wchar_grouping(const numpunct_wchar *this, basic_string_char *ret)
4507 TRACE("(%p)\n", this);
4508 return call_numpunct_wchar_do_grouping(this, ret);
4511 /* ?do_falsename@?$numpunct@_W@std@@MBE?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
4512 /* ?do_falsename@?$numpunct@_W@std@@MEBA?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
4513 /* ?do_falsename@?$numpunct@G@std@@MBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
4514 /* ?do_falsename@?$numpunct@G@std@@MEBA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
4515 DEFINE_THISCALL_WRAPPER(numpunct_wchar_do_falsename, 8)
4516 #if _MSVCP_VER <= 100
4517 #define call_numpunct_wchar_do_falsename(this, ret) CALL_VTBL_FUNC(this, 16, \
4518 basic_string_wchar*, (const numpunct_wchar*, basic_string_wchar*), (this, ret))
4519 #else
4520 #define call_numpunct_wchar_do_falsename(this, ret) CALL_VTBL_FUNC(this, 24, \
4521 basic_string_wchar*, (const numpunct_wchar*, basic_string_wchar*), (this, ret))
4522 #endif
4523 basic_string_wchar* __thiscall numpunct_wchar_do_falsename(const numpunct_wchar *this, basic_string_wchar *ret)
4525 TRACE("(%p)\n", this);
4526 return MSVCP_basic_string_wchar_ctor_cstr(ret, this->false_name);
4529 /* ?falsename@?$numpunct@_W@std@@QBE?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
4530 /* ?falsename@?$numpunct@_W@std@@QEBA?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
4531 /* ?falsename@?$numpunct@G@std@@QBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
4532 /* ?falsename@?$numpunct@G@std@@QEBA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
4533 DEFINE_THISCALL_WRAPPER(numpunct_wchar_falsename, 8)
4534 basic_string_wchar* __thiscall numpunct_wchar_falsename(const numpunct_wchar *this, basic_string_wchar *ret)
4536 TRACE("(%p)\n", this);
4537 return call_numpunct_wchar_do_falsename(this, ret);
4540 /* ?do_truename@?$numpunct@_W@std@@MBE?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
4541 /* ?do_truename@?$numpunct@_W@std@@MEBA?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
4542 /* ?do_truename@?$numpunct@G@std@@MBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
4543 /* ?do_truename@?$numpunct@G@std@@MEBA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
4544 DEFINE_THISCALL_WRAPPER(numpunct_wchar_do_truename, 8)
4545 #if _MSVCP_VER <= 100
4546 #define call_numpunct_wchar_do_truename(this, ret) CALL_VTBL_FUNC(this, 20, \
4547 basic_string_wchar*, (const numpunct_wchar*, basic_string_wchar*), (this, ret))
4548 #else
4549 #define call_numpunct_wchar_do_truename(this, ret) CALL_VTBL_FUNC(this, 28, \
4550 basic_string_wchar*, (const numpunct_wchar*, basic_string_wchar*), (this, ret))
4551 #endif
4552 basic_string_wchar* __thiscall numpunct_wchar_do_truename(const numpunct_wchar *this, basic_string_wchar *ret)
4554 TRACE("(%p)\n", this);
4555 return MSVCP_basic_string_wchar_ctor_cstr(ret, this->true_name);
4558 /* ?truename@?$numpunct@_W@std@@QBE?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
4559 /* ?truename@?$numpunct@_W@std@@QEBA?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
4560 /* ?truename@?$numpunct@G@std@@QBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
4561 /* ?truename@?$numpunct@G@std@@QEBA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
4562 DEFINE_THISCALL_WRAPPER(numpunct_wchar_truename, 8)
4563 basic_string_wchar* __thiscall numpunct_wchar_truename(const numpunct_wchar *this, basic_string_wchar *ret)
4565 TRACE("(%p)\n", this);
4566 return call_numpunct_wchar_do_truename(this, ret);
4569 double __cdecl _Stod(const char *buf, char **buf_end, LONG exp)
4571 double ret = strtod(buf, buf_end);
4573 if(exp)
4574 ret *= pow(10, exp);
4575 return ret;
4578 double __cdecl _Stodx(const char *buf, char **buf_end, LONG exp, int *err)
4580 double ret;
4582 *err = *_errno();
4583 *_errno() = 0;
4584 ret = _Stod(buf, buf_end, exp);
4585 if(*_errno()) {
4586 *err = *_errno();
4587 }else {
4588 *_errno() = *err;
4589 *err = 0;
4591 return ret;
4594 float __cdecl _Stof(const char *buf, char **buf_end, LONG exp)
4596 return _Stod(buf, buf_end, exp);
4599 float __cdecl _Stofx(const char *buf, char **buf_end, LONG exp, int *err)
4601 return _Stodx(buf, buf_end, exp, err);
4604 __int64 __cdecl _Stoll(const char *buf, char **buf_end, int base)
4606 return _strtoi64(buf, buf_end, base);
4609 __int64 __cdecl _Stollx(const char *buf, char **buf_end, int base, int *err)
4611 __int64 ret;
4613 *err = *_errno();
4614 *_errno() = 0;
4615 ret = _strtoi64(buf, buf_end, base);
4616 if(*_errno()) {
4617 *err = *_errno();
4618 }else {
4619 *_errno() = *err;
4620 *err = 0;
4622 return ret;
4625 LONG __cdecl _Stolx(const char *buf, char **buf_end, int base, int *err)
4627 __int64 i = _Stollx(buf, buf_end, base, err);
4628 if(!*err && i!=(__int64)((LONG)i))
4629 *err = ERANGE;
4630 return i;
4633 unsigned __int64 __cdecl _Stoull(const char *buf, char **buf_end, int base)
4635 return _strtoui64(buf, buf_end, base);
4638 unsigned __int64 __cdecl _Stoullx(const char *buf, char **buf_end, int base, int *err)
4640 unsigned __int64 ret;
4642 *err = *_errno();
4643 *_errno() = 0;
4644 ret = _strtoui64(buf, buf_end, base);
4645 if(*_errno()) {
4646 *err = *_errno();
4647 }else {
4648 *_errno() = *err;
4649 *err = 0;
4651 return ret;
4654 ULONG __cdecl _Stoul(const char *buf, char **buf_end, int base)
4656 int err;
4657 unsigned __int64 i = _Stoullx(buf[0]=='-' ? buf+1 : buf, buf_end, base, &err);
4658 if(!err && i!=(unsigned __int64)((ULONG)i))
4659 *_errno() = ERANGE;
4660 return buf[0]=='-' ? -i : i;
4663 ULONG __cdecl _Stoulx(const char *buf, char **buf_end, int base, int *err)
4665 unsigned __int64 i = _Stoullx(buf[0]=='-' ? buf+1 : buf, buf_end, base, err);
4666 if(!*err && i!=(unsigned __int64)((ULONG)i))
4667 *err = ERANGE;
4668 return buf[0]=='-' ? -i : i;
4671 /* ?id@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@2V0locale@2@A */
4672 locale_id num_get_wchar_id = {0};
4673 /* ?id@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@2V0locale@2@A */
4674 locale_id num_get_short_id = {0};
4676 /* ??_7?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@6B@ */
4677 extern const vtable_ptr MSVCP_num_get_wchar_vtable;
4678 /* ??_7?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@6B@ */
4679 extern const vtable_ptr MSVCP_num_get_short_vtable;
4681 /* ?_Init@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@IAEXABV_Locinfo@2@@Z */
4682 /* ?_Init@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@IEAAXAEBV_Locinfo@2@@Z */
4683 /* ?_Init@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@IAEXABV_Locinfo@2@@Z */
4684 /* ?_Init@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@IEAAXAEBV_Locinfo@2@@Z */
4685 DEFINE_THISCALL_WRAPPER(num_get_wchar__Init, 8)
4686 void __thiscall num_get_wchar__Init(num_get *this, const _Locinfo *locinfo)
4688 TRACE("(%p %p)\n", this, locinfo);
4689 _Locinfo__Getcvt(locinfo, &this->cvt);
4692 /* ??0?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
4693 /* ??0?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
4694 DEFINE_THISCALL_WRAPPER(num_get_wchar_ctor_locinfo, 12)
4695 num_get* __thiscall num_get_wchar_ctor_locinfo(num_get *this,
4696 const _Locinfo *locinfo, MSVCP_size_t refs)
4698 TRACE("(%p %p %lu)\n", this, locinfo, refs);
4700 locale_facet_ctor_refs(&this->facet, refs);
4701 this->facet.vtable = &MSVCP_num_get_wchar_vtable;
4703 num_get_wchar__Init(this, locinfo);
4704 return this;
4707 /* ??0?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
4708 /* ??0?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
4709 DEFINE_THISCALL_WRAPPER(num_get_short_ctor_locinfo, 12)
4710 num_get* __thiscall num_get_short_ctor_locinfo(num_get *this,
4711 const _Locinfo *locinfo, MSVCP_size_t refs)
4713 num_get_wchar_ctor_locinfo(this, locinfo, refs);
4714 this->facet.vtable = &MSVCP_num_get_short_vtable;
4715 return this;
4718 /* ??0?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAE@I@Z */
4719 /* ??0?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAA@_K@Z */
4720 DEFINE_THISCALL_WRAPPER(num_get_wchar_ctor_refs, 8)
4721 num_get* __thiscall num_get_wchar_ctor_refs(num_get *this, MSVCP_size_t refs)
4723 _Locinfo locinfo;
4725 TRACE("(%p %lu)\n", this, refs);
4727 _Locinfo_ctor(&locinfo);
4728 num_get_wchar_ctor_locinfo(this, &locinfo, refs);
4729 _Locinfo_dtor(&locinfo);
4730 return this;
4733 /* ??0?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAE@I@Z */
4734 /* ??0?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEAA@_K@Z */
4735 DEFINE_THISCALL_WRAPPER(num_get_short_ctor_refs, 8)
4736 num_get* __thiscall num_get_short_ctor_refs(num_get *this, MSVCP_size_t refs)
4738 num_get_wchar_ctor_refs(this, refs);
4739 this->facet.vtable = &MSVCP_num_get_short_vtable;
4740 return this;
4743 /* ??_F?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAEXXZ */
4744 /* ??_F?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAAXXZ */
4745 DEFINE_THISCALL_WRAPPER(num_get_wchar_ctor, 4)
4746 num_get* __thiscall num_get_wchar_ctor(num_get *this)
4748 return num_get_wchar_ctor_refs(this, 0);
4751 /* ??_F?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAEXXZ */
4752 /* ??_F?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAAXXZ */
4753 DEFINE_THISCALL_WRAPPER(num_get_short_ctor, 4)
4754 num_get* __thiscall num_get_short_ctor(num_get *this)
4756 return num_get_short_ctor_refs(this, 0);
4759 /* ??1?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MAE@XZ */
4760 /* ??1?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MEAA@XZ */
4761 /* ??1?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MAE@XZ */
4762 /* ??1?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MEAA@XZ */
4763 DEFINE_THISCALL_WRAPPER(num_get_wchar_dtor, 4)
4764 void __thiscall num_get_wchar_dtor(num_get *this)
4766 TRACE("(%p)\n", this);
4767 locale_facet_dtor(&this->facet);
4770 DEFINE_THISCALL_WRAPPER(num_get_wchar_vector_dtor, 8)
4771 num_get* __thiscall num_get_wchar_vector_dtor(num_get *this, unsigned int flags)
4773 TRACE("(%p %x)\n", this, flags);
4774 if(flags & 2) {
4775 /* we have an array, with the number of elements stored before the first object */
4776 INT_PTR i, *ptr = (INT_PTR *)this-1;
4778 for(i=*ptr-1; i>=0; i--)
4779 num_get_wchar_dtor(this+i);
4780 MSVCRT_operator_delete(ptr);
4781 } else {
4782 num_get_wchar_dtor(this);
4783 if(flags & 1)
4784 MSVCRT_operator_delete(this);
4787 return this;
4790 /* ?_Getcat@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
4791 /* ?_Getcat@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
4792 MSVCP_size_t __cdecl num_get_wchar__Getcat(const locale_facet **facet, const locale *loc)
4794 TRACE("(%p %p)\n", facet, loc);
4796 if(facet && !*facet) {
4797 _Locinfo locinfo;
4799 *facet = MSVCRT_operator_new(sizeof(num_get));
4800 if(!*facet) {
4801 ERR("Out of memory\n");
4802 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
4803 return 0;
4806 _Locinfo_ctor_cstr(&locinfo, locale_string_char_c_str(&loc->ptr->name));
4807 num_get_wchar_ctor_locinfo((num_get*)*facet, &locinfo, 0);
4808 _Locinfo_dtor(&locinfo);
4811 return LC_NUMERIC;
4814 /* ?_Getcat@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SAIPAPBVfacet@locale@2@@Z */
4815 /* ?_Getcat@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@@Z */
4816 MSVCP_size_t __cdecl num_get_wchar__Getcat_old(const locale_facet **facet)
4818 return num_get_wchar__Getcat(facet, locale_classic());
4821 num_get* num_get_wchar_use_facet(const locale *loc)
4823 static num_get *obj = NULL;
4825 _Lockit lock;
4826 const locale_facet *fac;
4828 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
4829 fac = locale__Getfacet(loc, locale_id_operator_size_t(&num_get_wchar_id));
4830 if(fac) {
4831 _Lockit_dtor(&lock);
4832 return (num_get*)fac;
4835 if(obj) {
4836 _Lockit_dtor(&lock);
4837 return obj;
4840 num_get_wchar__Getcat(&fac, loc);
4841 obj = (num_get*)fac;
4842 call_locale_facet__Incref(&obj->facet);
4843 locale_facet_register(&obj->facet);
4844 _Lockit_dtor(&lock);
4846 return obj;
4849 /* ?_Getcat@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
4850 /* ?_Getcat@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
4851 MSVCP_size_t __cdecl num_get_short__Getcat(const locale_facet **facet, const locale *loc)
4853 if(facet && !*facet) {
4854 num_get_wchar__Getcat(facet, loc);
4855 (*(locale_facet**)facet)->vtable = &MSVCP_num_get_short_vtable;
4858 return LC_NUMERIC;
4861 /* ?_Getcat@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SAIPAPBVfacet@locale@2@@Z */
4862 /* ?_Getcat@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@@Z */
4863 MSVCP_size_t __cdecl num_get_short__Getcat_old(const locale_facet **facet)
4865 return num_get_short__Getcat(facet, locale_classic());
4868 num_get* num_get_short_use_facet(const locale *loc)
4870 static num_get *obj = NULL;
4872 _Lockit lock;
4873 const locale_facet *fac;
4875 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
4876 fac = locale__Getfacet(loc, locale_id_operator_size_t(&num_get_short_id));
4877 if(fac) {
4878 _Lockit_dtor(&lock);
4879 return (num_get*)fac;
4882 if(obj) {
4883 _Lockit_dtor(&lock);
4884 return obj;
4887 num_get_short__Getcat(&fac, loc);
4888 obj = (num_get*)fac;
4889 call_locale_facet__Incref(&obj->facet);
4890 locale_facet_register(&obj->facet);
4891 _Lockit_dtor(&lock);
4893 return obj;
4896 static inline wchar_t mb_to_wc(char ch, const _Cvtvec *cvt)
4898 int state = 0;
4899 wchar_t ret;
4901 return _Mbrtowc(&ret, &ch, 1, &state, cvt) == 1 ? ret : 0;
4904 static int num_get__Getffld(const num_get *this, char *dest, istreambuf_iterator_wchar *first,
4905 istreambuf_iterator_wchar *last, const locale *loc, numpunct_wchar *numpunct)
4907 basic_string_char grouping_bstr;
4908 basic_string_char groups_found;
4909 int i, groups_no = 0, cur_group = 0, exp = 0;
4910 char *dest_beg = dest, *num_end = dest+25, *exp_end = dest+31;
4911 wchar_t sep, digits[11], *digits_pos;
4912 const char *grouping, *groups;
4913 BOOL error = FALSE, got_digit = FALSE, got_nonzero = FALSE;
4915 TRACE("(%p %p %p %p)\n", dest, first, last, loc);
4917 for(i=0; i<10; i++)
4918 digits[i] = mb_to_wc('0'+i, &this->cvt);
4919 digits[10] = 0;
4921 numpunct_wchar_grouping(numpunct, &grouping_bstr);
4922 grouping = MSVCP_basic_string_char_c_str(&grouping_bstr);
4923 sep = grouping[0] ? numpunct_wchar_thousands_sep(numpunct) : 0;
4925 if(sep)
4926 MSVCP_basic_string_char_ctor(&groups_found);
4928 istreambuf_iterator_wchar_val(first);
4929 /* get sign */
4930 if(first->strbuf && first->val==mb_to_wc('-', &this->cvt)) {
4931 *dest++ = '-';
4932 istreambuf_iterator_wchar_inc(first);
4933 }else if(first->strbuf && first->val==mb_to_wc('+', &this->cvt)) {
4934 *dest++ = '+';
4935 istreambuf_iterator_wchar_inc(first);
4938 /* read possibly grouped numbers before decimal */
4939 for(; first->strbuf; istreambuf_iterator_wchar_inc(first)) {
4940 if(!(digits_pos = wcschr(digits, first->val))) {
4941 if(sep && first->val==sep) {
4942 if(!groups_no) break; /* empty group - stop parsing */
4943 MSVCP_basic_string_char_append_ch(&groups_found, groups_no);
4944 groups_no = 0;
4945 ++cur_group;
4946 }else {
4947 break;
4949 }else {
4950 got_digit = TRUE; /* found a digit, zero or non-zero */
4951 /* write digit to dest if not a leading zero (to not waste dest buffer) */
4952 if(!got_nonzero && first->val == digits[0])
4954 ++groups_no;
4955 continue;
4957 got_nonzero = TRUE;
4958 if(dest < num_end)
4959 *dest++ = '0'+digits_pos-digits;
4960 else
4961 exp++; /* too many digits, just multiply by 10 */
4962 if(sep && groups_no<CHAR_MAX)
4963 ++groups_no;
4967 /* if all leading zeroes, we didn't write anything so put a zero we check for a decimal */
4968 if(got_digit && !got_nonzero)
4969 *dest++ = '0';
4971 /* get decimal, if any */
4972 if(first->strbuf && first->val==numpunct_wchar_decimal_point(numpunct)) {
4973 if(dest < num_end)
4974 *dest++ = *localeconv()->decimal_point;
4975 istreambuf_iterator_wchar_inc(first);
4978 /* read non-grouped after decimal */
4979 for(; first->strbuf; istreambuf_iterator_wchar_inc(first)) {
4980 if(!(digits_pos = wcschr(digits, first->val)))
4981 break;
4982 else if(dest<num_end) {
4983 got_digit = TRUE;
4984 *dest++ = '0'+digits_pos-digits;
4988 /* read exponent, if any */
4989 if(first->strbuf && (first->val==mb_to_wc('e', &this->cvt) || first->val==mb_to_wc('E', &this->cvt))) {
4990 *dest++ = 'e';
4991 istreambuf_iterator_wchar_inc(first);
4993 if(first->strbuf && first->val==mb_to_wc('-', &this->cvt)) {
4994 *dest++ = '-';
4995 istreambuf_iterator_wchar_inc(first);
4996 }else if(first->strbuf && first->val==mb_to_wc('+', &this->cvt)) {
4997 *dest++ = '+';
4998 istreambuf_iterator_wchar_inc(first);
5001 got_digit = got_nonzero = FALSE;
5002 error = TRUE;
5003 /* skip any leading zeroes */
5004 for(; first->strbuf && first->val==digits[0]; istreambuf_iterator_wchar_inc(first))
5005 error = FALSE;
5007 for(; first->strbuf && (digits_pos = wcschr(digits, first->val)); istreambuf_iterator_wchar_inc(first)) {
5008 got_digit = got_nonzero = TRUE; /* leading zeroes would have been skipped, so first digit is non-zero */
5009 error = FALSE;
5010 if(dest<exp_end)
5011 *dest++ = '0'+digits_pos-digits;
5014 /* if just found zeroes for exponent, use that */
5015 if(got_digit && !got_nonzero)
5017 error = FALSE;
5018 if(dest<exp_end)
5019 *dest++ = '0';
5023 if(sep && groups_no)
5024 MSVCP_basic_string_char_append_ch(&groups_found, groups_no);
5026 if(!cur_group) /* no groups, skip loop */
5027 cur_group--;
5028 else if(!(groups = MSVCP_basic_string_char_c_str(&groups_found))[cur_group])
5029 error = TRUE; /* trailing empty */
5031 for(; cur_group>=0 && !error; cur_group--) {
5032 if(*grouping == CHAR_MAX) {
5033 if(cur_group)
5034 error = TRUE;
5035 break;
5036 }else if((cur_group && *grouping!=groups[cur_group])
5037 || (!cur_group && *grouping<groups[cur_group])) {
5038 error = TRUE;
5039 break;
5040 }else if(grouping[1]) {
5041 grouping++;
5044 MSVCP_basic_string_char_dtor(&grouping_bstr);
5045 if(sep)
5046 MSVCP_basic_string_char_dtor(&groups_found);
5048 if(error) {
5049 *dest_beg = '\0';
5050 return 0;
5052 *dest++ = '\0';
5053 return exp;
5056 /* ?_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 */
5057 /* ?_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 */
5058 int __cdecl num_get_wchar__Getffld(const num_get *this, char *dest, istreambuf_iterator_wchar *first,
5059 istreambuf_iterator_wchar *last, const locale *loc)
5061 return num_get__Getffld(this, dest, first, last, loc, numpunct_wchar_use_facet(loc));
5064 /* ?_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 */
5065 /* ?_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 */
5066 int __cdecl num_get_short__Getffld(const num_get *this, char *dest, istreambuf_iterator_wchar *first,
5067 istreambuf_iterator_wchar *last, const locale *loc)
5069 return num_get__Getffld(this, dest, first, last, loc, numpunct_short_use_facet(loc));
5072 /* ?_Getffldx@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@ABAHPADAAV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@2@1AAVios_base@2@PAH@Z */
5073 /* ?_Getffldx@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@AEBAHPEADAEAV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@2@1AEAVios_base@2@PEAH@Z */
5074 /* ?_Getffldx@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@ABAHPADAAV?$istreambuf_iterator@GU?$char_traits@G@std@@@2@1AAVios_base@2@PAH@Z */
5075 /* ?_Getffldx@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@AEBAHPEADAEAV?$istreambuf_iterator@GU?$char_traits@G@std@@@2@1AEAVios_base@2@PEAH@Z */
5076 int __cdecl num_get_wchar__Getffldx(num_get *this, char *dest, istreambuf_iterator_wchar *first,
5077 istreambuf_iterator_wchar *last, ios_base *ios, int *phexexp)
5079 FIXME("(%p %p %p %p %p) stub\n", dest, first, last, ios, phexexp);
5080 return -1;
5083 static int num_get__Getifld(const num_get *this, char *dest, istreambuf_iterator_wchar *first,
5084 istreambuf_iterator_wchar *last, int fmtflags, const locale *loc, numpunct_wchar *numpunct)
5086 wchar_t digits[23], *digits_pos, sep;
5087 basic_string_char grouping_bstr;
5088 basic_string_char groups_found;
5089 int i, basefield, base, groups_no = 0, cur_group = 0;
5090 char *dest_beg = dest, *dest_end = dest+24;
5091 const char *grouping, *groups;
5092 BOOL error = TRUE, dest_empty = TRUE, found_zero = FALSE;
5094 TRACE("(%p %p %p %04x %p)\n", dest, first, last, fmtflags, loc);
5096 for(i=0; i<10; i++)
5097 digits[i] = mb_to_wc('0'+i, &this->cvt);
5098 for(i=0; i<6; i++) {
5099 digits[10+i] = mb_to_wc('a'+i, &this->cvt);
5100 digits[16+i] = mb_to_wc('A'+i, &this->cvt);
5103 numpunct_wchar_grouping(numpunct, &grouping_bstr);
5104 grouping = MSVCP_basic_string_char_c_str(&grouping_bstr);
5105 sep = grouping[0] ? numpunct_wchar_thousands_sep(numpunct) : '\0';
5107 basefield = fmtflags & FMTFLAG_basefield;
5108 if(basefield == FMTFLAG_oct)
5109 base = 8;
5110 else if(basefield == FMTFLAG_hex)
5111 base = 22; /* equal to the size of digits buffer */
5112 else if(!basefield)
5113 base = 0;
5114 else
5115 base = 10;
5117 istreambuf_iterator_wchar_val(first);
5118 if(first->strbuf && first->val==mb_to_wc('-', &this->cvt)) {
5119 *dest++ = '-';
5120 istreambuf_iterator_wchar_inc(first);
5121 }else if(first->strbuf && first->val==mb_to_wc('+', &this->cvt)) {
5122 *dest++ = '+';
5123 istreambuf_iterator_wchar_inc(first);
5126 if(first->strbuf && first->val==digits[0]) {
5127 found_zero = TRUE;
5128 istreambuf_iterator_wchar_inc(first);
5129 if(first->strbuf && (first->val==mb_to_wc('x', &this->cvt) || first->val==mb_to_wc('X', &this->cvt))) {
5130 if(!base || base == 22) {
5131 found_zero = FALSE;
5132 istreambuf_iterator_wchar_inc(first);
5133 base = 22;
5134 }else {
5135 base = 10;
5137 }else {
5138 error = FALSE;
5139 if(!base) base = 8;
5141 }else {
5142 if(!base) base = 10;
5144 digits[base] = 0;
5146 if(sep) {
5147 MSVCP_basic_string_char_ctor(&groups_found);
5148 if(found_zero) ++groups_no;
5151 for(; first->strbuf; istreambuf_iterator_wchar_inc(first)) {
5152 if(!(digits_pos = wcschr(digits, first->val))) {
5153 if(sep && first->val==sep) {
5154 if(!groups_no) break; /* empty group - stop parsing */
5155 MSVCP_basic_string_char_append_ch(&groups_found, groups_no);
5156 groups_no = 0;
5157 ++cur_group;
5158 }else {
5159 break;
5161 }else {
5162 error = FALSE;
5163 if(dest_empty && first->val == digits[0]) {
5164 found_zero = TRUE;
5165 ++groups_no;
5166 continue;
5168 dest_empty = FALSE;
5169 /* skip digits that can't be copied to dest buffer, other
5170 * functions are responsible for detecting overflows */
5171 if(dest < dest_end)
5172 *dest++ = (digits_pos-digits<10 ? '0'+digits_pos-digits :
5173 (digits_pos-digits<16 ? 'a'+digits_pos-digits-10 :
5174 'A'+digits_pos-digits-16));
5175 if(sep && groups_no<CHAR_MAX)
5176 ++groups_no;
5180 if(sep && groups_no)
5181 MSVCP_basic_string_char_append_ch(&groups_found, groups_no);
5183 if(!cur_group) { /* no groups, skip loop */
5184 cur_group--;
5185 }else if(!(groups = MSVCP_basic_string_char_c_str(&groups_found))[cur_group]) {
5186 error = TRUE; /* trailing empty */
5187 found_zero = FALSE;
5190 for(; cur_group>=0 && !error; cur_group--) {
5191 if(*grouping == CHAR_MAX) {
5192 if(cur_group)
5193 error = TRUE;
5194 break;
5195 }else if((cur_group && *grouping!=groups[cur_group])
5196 || (!cur_group && *grouping<groups[cur_group])) {
5197 error = TRUE;
5198 break;
5199 }else if(grouping[1]) {
5200 grouping++;
5204 MSVCP_basic_string_char_dtor(&grouping_bstr);
5205 if(sep)
5206 MSVCP_basic_string_char_dtor(&groups_found);
5208 if(error) {
5209 if (found_zero)
5210 *dest++ = '0';
5211 else
5212 dest = dest_beg;
5213 }else if(dest_empty)
5214 *dest++ = '0';
5215 *dest = '\0';
5217 return (base==22 ? 16 : base);
5220 /* ?_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 */
5221 /* ?_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 */
5222 int __cdecl num_get_wchar__Getifld(const num_get *this, char *dest, istreambuf_iterator_wchar *first,
5223 istreambuf_iterator_wchar *last, int fmtflags, const locale *loc)
5225 return num_get__Getifld(this, dest, first, last,
5226 fmtflags, loc, numpunct_wchar_use_facet(loc));
5229 /* ?_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 */
5230 /* ?_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 */
5231 int __cdecl num_get_short__Getifld(const num_get *this, char *dest, istreambuf_iterator_wchar *first,
5232 istreambuf_iterator_wchar *last, int fmtflags, const locale *loc)
5234 return num_get__Getifld(this, dest, first, last,
5235 fmtflags, loc, numpunct_short_use_facet(loc));
5238 /* ?_Hexdig@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@ABEH_W000@Z */
5239 /* ?_Hexdig@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@AEBAH_W000@Z */
5240 /* ?_Hexdig@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@ABEHGGGG@Z */
5241 /* ?_Hexdig@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@AEBAHGGGG@Z */
5242 DEFINE_THISCALL_WRAPPER(MSVCP_num_get_wchar__Hexdig, 20)
5243 int __thiscall MSVCP_num_get_wchar__Hexdig(num_get *this, wchar_t dig, wchar_t e0, wchar_t al, wchar_t au)
5245 FIXME("(%p %c %c %c %c) stub\n", this, dig, e0, al, au);
5246 return -1;
5249 static istreambuf_iterator_wchar* num_get_do_get_void(const num_get *this,
5250 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar first,
5251 istreambuf_iterator_wchar last, ios_base *base, int *state,
5252 void **pval, numpunct_wchar *numpunct)
5254 unsigned __int64 v;
5255 char tmp[25], *end;
5256 int err;
5258 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5260 v = _Stoullx(tmp, &end, num_get__Getifld(this, tmp, &first,
5261 &last, FMTFLAG_hex, base->loc, numpunct), &err);
5262 if(v!=(unsigned __int64)((INT_PTR)v))
5263 *state |= IOSTATE_failbit;
5264 else if(end!=tmp && !err)
5265 *pval = (void*)((INT_PTR)v);
5266 else
5267 *state |= IOSTATE_failbit;
5269 if(!first.strbuf)
5270 *state |= IOSTATE_eofbit;
5272 *ret = first;
5273 return ret;
5276 /* ?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 */
5277 /* ?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 */
5278 #if _MSVCP_VER <= 100
5279 #define call_num_get_wchar_do_get_void(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 4, istreambuf_iterator_wchar*, \
5280 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, void**), \
5281 (this, ret, first, last, base, state, pval))
5282 #else
5283 #define call_num_get_wchar_do_get_void(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 12, istreambuf_iterator_wchar*, \
5284 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, void**), \
5285 (this, ret, first, last, base, state, pval))
5286 #endif
5287 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_void,36)
5288 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_void(const num_get *this, istreambuf_iterator_wchar *ret,
5289 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, void **pval)
5291 return num_get_do_get_void(this, ret, first, last, base,
5292 state, pval, numpunct_wchar_use_facet(base->loc));
5295 /* ?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 */
5296 /* ?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 */
5297 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_void,36)
5298 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_void(const num_get *this, istreambuf_iterator_wchar *ret,
5299 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, void **pval)
5301 return num_get_do_get_void(this, ret, first, last, base,
5302 state, pval, numpunct_short_use_facet(base->loc));
5305 /* ?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 */
5306 /* ?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 */
5307 /* ?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 */
5308 /* ?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 */
5309 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_void,36)
5310 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_void(const num_get *this, istreambuf_iterator_wchar *ret,
5311 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, void **pval)
5313 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5314 return call_num_get_wchar_do_get_void(this, ret, first, last, base, state, pval);
5317 static istreambuf_iterator_wchar* num_get_do_get_double(const num_get *this,
5318 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar first,
5319 istreambuf_iterator_wchar last, ios_base *base, int *state,
5320 double *pval, numpunct_wchar *numpunct)
5322 double v;
5323 char tmp[32], *end;
5324 int err;
5326 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5328 v = _Stodx(tmp, &end, num_get__Getffld(this, tmp, &first, &last, base->loc, numpunct), &err);
5329 if(end!=tmp && !err)
5330 *pval = v;
5331 else
5332 *state |= IOSTATE_failbit;
5334 if(!first.strbuf)
5335 *state |= IOSTATE_eofbit;
5337 *ret = first;
5338 return ret;
5341 /* ?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 */
5342 /* ?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 */
5343 /* ?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 */
5344 /* ?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 */
5345 #if _MSVCP_VER <= 100
5346 #define call_num_get_wchar_do_get_ldouble(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 8, istreambuf_iterator_wchar*, \
5347 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, double*), \
5348 (this, ret, first, last, base, state, pval))
5349 #define call_num_get_wchar_do_get_double(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 12, istreambuf_iterator_wchar*, \
5350 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, double*), \
5351 (this, ret, first, last, base, state, pval))
5352 #else
5353 #define call_num_get_wchar_do_get_ldouble(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 16, istreambuf_iterator_wchar*, \
5354 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, double*), \
5355 (this, ret, first, last, base, state, pval))
5356 #define call_num_get_wchar_do_get_double(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 20, istreambuf_iterator_wchar*, \
5357 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, double*), \
5358 (this, ret, first, last, base, state, pval))
5359 #endif
5360 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_double,36)
5361 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_double(const num_get *this, istreambuf_iterator_wchar *ret,
5362 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, double *pval)
5364 return num_get_do_get_double(this, ret, first, last, base,
5365 state, pval, numpunct_wchar_use_facet(base->loc));
5368 /* ?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 */
5369 /* ?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 */
5370 /* ?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 */
5371 /* ?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 */
5372 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_double,36)
5373 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_double(const num_get *this, istreambuf_iterator_wchar *ret,
5374 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, double *pval)
5376 return num_get_do_get_double(this, ret, first, last, base,
5377 state, pval, numpunct_short_use_facet(base->loc));
5380 /* ?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 */
5381 /* ?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 */
5382 /* ?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 */
5383 /* ?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 */
5384 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_ldouble,36)
5385 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_ldouble(const num_get *this, istreambuf_iterator_wchar *ret,
5386 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, double *pval)
5388 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5389 return call_num_get_wchar_do_get_ldouble(this, ret, first, last, base, state, pval);
5392 /* ?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 */
5393 /* ?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 */
5394 /* ?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 */
5395 /* ?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 */
5396 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_double,36)
5397 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_double(const num_get *this, istreambuf_iterator_wchar *ret,
5398 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, double *pval)
5400 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5401 return call_num_get_wchar_do_get_double(this, ret, first, last, base, state, pval);
5404 static istreambuf_iterator_wchar* num_get_do_get_float(const num_get *this,
5405 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar first,
5406 istreambuf_iterator_wchar last, ios_base *base, int *state,
5407 float *pval, numpunct_wchar *numpunct)
5409 float v;
5410 char tmp[32], *end;
5411 int err;
5413 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5415 v = _Stofx(tmp, &end, num_get__Getffld(this, tmp, &first,
5416 &last, base->loc, numpunct), &err);
5417 if(end!=tmp && !err)
5418 *pval = v;
5419 else
5420 *state |= IOSTATE_failbit;
5422 if(!first.strbuf)
5423 *state |= IOSTATE_eofbit;
5425 *ret = first;
5426 return ret;
5429 /* ?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 */
5430 /* ?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 */
5431 #if _MSVCP_VER <= 100
5432 #define call_num_get_wchar_do_get_float(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 16, istreambuf_iterator_wchar*, \
5433 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, float*), \
5434 (this, ret, first, last, base, state, pval))
5435 #else
5436 #define call_num_get_wchar_do_get_float(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 24, istreambuf_iterator_wchar*, \
5437 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, float*), \
5438 (this, ret, first, last, base, state, pval))
5439 #endif
5440 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_float,36)
5441 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_float(const num_get *this, istreambuf_iterator_wchar *ret,
5442 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, float *pval)
5444 return num_get_do_get_float(this, ret, first, last, base,
5445 state, pval, numpunct_wchar_use_facet(base->loc));
5448 /* ?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 */
5449 /* ?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 */
5450 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_float,36)
5451 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_float(const num_get *this, istreambuf_iterator_wchar *ret,
5452 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, float *pval)
5454 return num_get_do_get_float(this, ret, first, last, base,
5455 state, pval, numpunct_short_use_facet(base->loc));
5458 /* ?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 */
5459 /* ?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 */
5460 /* ?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 */
5461 /* ?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 */
5462 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_float,36)
5463 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_float(const num_get *this, istreambuf_iterator_wchar *ret,
5464 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, float *pval)
5466 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5467 return call_num_get_wchar_do_get_float(this, ret, first, last, base, state, pval);
5470 static istreambuf_iterator_wchar* num_get_do_get_uint64(const num_get *this,
5471 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar first,
5472 istreambuf_iterator_wchar last, ios_base *base, int *state,
5473 ULONGLONG *pval, numpunct_wchar *numpunct)
5475 unsigned __int64 v;
5476 char tmp[25], *end;
5477 int err;
5479 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5481 v = _Stoullx(tmp, &end, num_get__Getifld(this, tmp, &first,
5482 &last, base->fmtfl, base->loc, numpunct), &err);
5483 if(end!=tmp && !err)
5484 *pval = v;
5485 else
5486 *state |= IOSTATE_failbit;
5488 if(!first.strbuf)
5489 *state |= IOSTATE_eofbit;
5491 *ret = first;
5492 return ret;
5495 /* ?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 */
5496 /* ?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 */
5497 #if _MSVCP_VER <= 100
5498 #define call_num_get_wchar_do_get_uint64(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 20, istreambuf_iterator_wchar*, \
5499 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, ULONGLONG*), \
5500 (this, ret, first, last, base, state, pval))
5501 #else
5502 #define call_num_get_wchar_do_get_uint64(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 28, istreambuf_iterator_wchar*, \
5503 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, ULONGLONG*), \
5504 (this, ret, first, last, base, state, pval))
5505 #endif
5506 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_uint64,36)
5507 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_uint64(const num_get *this, istreambuf_iterator_wchar *ret,
5508 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, ULONGLONG *pval)
5510 return num_get_do_get_uint64(this, ret, first, last, base,
5511 state, pval, numpunct_wchar_use_facet(base->loc));
5514 /* ?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 */
5515 /* ?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 */
5516 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_uint64,36)
5517 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_uint64(const num_get *this, istreambuf_iterator_wchar *ret,
5518 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, ULONGLONG *pval)
5520 return num_get_do_get_uint64(this, ret, first, last, base,
5521 state, pval, numpunct_short_use_facet(base->loc));
5524 /* ?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 */
5525 /* ?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 */
5526 /* ?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 */
5527 /* ?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 */
5528 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_uint64,36)
5529 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_uint64(const num_get *this, istreambuf_iterator_wchar *ret,
5530 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, ULONGLONG *pval)
5532 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5533 return call_num_get_wchar_do_get_uint64(this, ret, first, last, base, state, pval);
5536 static istreambuf_iterator_wchar* num_get_do_get_int64(const num_get *this,
5537 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar first,
5538 istreambuf_iterator_wchar last, ios_base *base, int *state,
5539 LONGLONG *pval, numpunct_wchar *numpunct)
5541 __int64 v;
5542 char tmp[25], *end;
5543 int err;
5545 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5547 v = _Stollx(tmp, &end, num_get__Getifld(this, tmp, &first,
5548 &last, base->fmtfl, base->loc, numpunct), &err);
5549 if(end!=tmp && !err)
5550 *pval = v;
5551 else
5552 *state |= IOSTATE_failbit;
5554 if(!first.strbuf)
5555 *state |= IOSTATE_eofbit;
5557 *ret = first;
5558 return ret;
5561 /* ?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 */
5562 /* ?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 */
5563 #if _MSVCP_VER <= 100
5564 #define call_num_get_wchar_do_get_int64(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 24, istreambuf_iterator_wchar*, \
5565 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, LONGLONG*), \
5566 (this, ret, first, last, base, state, pval))
5567 #else
5568 #define call_num_get_wchar_do_get_int64(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 32, istreambuf_iterator_wchar*, \
5569 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, LONGLONG*), \
5570 (this, ret, first, last, base, state, pval))
5571 #endif
5572 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_int64,36)
5573 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_int64(const num_get *this, istreambuf_iterator_wchar *ret,
5574 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, LONGLONG *pval)
5576 return num_get_do_get_int64(this, ret, first, last, base,
5577 state, pval, numpunct_wchar_use_facet(base->loc));
5580 /* ?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 */
5581 /* ?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 */
5582 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_int64,36)
5583 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_int64(const num_get *this, istreambuf_iterator_wchar *ret,
5584 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, LONGLONG *pval)
5586 return num_get_do_get_int64(this, ret, first, last, base,
5587 state, pval, numpunct_short_use_facet(base->loc));
5590 /* ?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 */
5591 /* ?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 */
5592 /* ?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 */
5593 /* ?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 */
5594 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_int64,36)
5595 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_int64(const num_get *this, istreambuf_iterator_wchar *ret,
5596 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, LONGLONG *pval)
5598 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5599 return call_num_get_wchar_do_get_int64(this, ret, first, last, base, state, pval);
5602 static istreambuf_iterator_wchar* num_get_do_get_ulong(const num_get *this,
5603 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar first,
5604 istreambuf_iterator_wchar last, ios_base *base, int *state,
5605 ULONG *pval, numpunct_wchar *numpunct)
5607 ULONG v;
5608 char tmp[25], *end;
5609 int err;
5611 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5613 v = _Stoulx(tmp, &end, num_get__Getifld(this, tmp, &first,
5614 &last, base->fmtfl, base->loc, numpunct), &err);
5615 if(end!=tmp && !err)
5616 *pval = v;
5617 else
5618 *state |= IOSTATE_failbit;
5620 if(!first.strbuf)
5621 *state |= IOSTATE_eofbit;
5623 *ret = first;
5624 return ret;
5627 /* ?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 */
5628 /* ?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 */
5629 #if _MSVCP_VER <= 100
5630 #define call_num_get_wchar_do_get_ulong(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 28, istreambuf_iterator_wchar*, \
5631 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, ULONG*), \
5632 (this, ret, first, last, base, state, pval))
5633 #else
5634 #define call_num_get_wchar_do_get_ulong(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 36, istreambuf_iterator_wchar*, \
5635 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, ULONG*), \
5636 (this, ret, first, last, base, state, pval))
5637 #endif
5638 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_ulong,36)
5639 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_ulong(const num_get *this, istreambuf_iterator_wchar *ret,
5640 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, ULONG *pval)
5642 return num_get_do_get_ulong(this, ret, first, last, base,
5643 state, pval, numpunct_wchar_use_facet(base->loc));
5646 /* ?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 */
5647 /* ?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 */
5648 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_ulong,36)
5649 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_ulong(const num_get *this, istreambuf_iterator_wchar *ret,
5650 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, ULONG *pval)
5652 return num_get_do_get_ulong(this, ret, first, last, base,
5653 state, pval, numpunct_short_use_facet(base->loc));
5656 /* ?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 */
5657 /* ?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 */
5658 /* ?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 */
5659 /* ?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 */
5660 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_ulong,36)
5661 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_ulong(const num_get *this, istreambuf_iterator_wchar *ret,
5662 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, ULONG *pval)
5664 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5665 return call_num_get_wchar_do_get_ulong(this, ret, first, last, base, state, pval);
5668 static istreambuf_iterator_wchar* num_get_do_get_long(const num_get *this,
5669 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar first,
5670 istreambuf_iterator_wchar last, ios_base *base, int *state,
5671 LONG *pval, numpunct_wchar *numpunct)
5673 LONG v;
5674 char tmp[25], *end;
5675 int err;
5677 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5679 v = _Stolx(tmp, &end, num_get__Getifld(this, tmp, &first,
5680 &last, base->fmtfl, base->loc, numpunct), &err);
5681 if(end!=tmp && !err)
5682 *pval = v;
5683 else
5684 *state |= IOSTATE_failbit;
5686 if(!first.strbuf)
5687 *state |= IOSTATE_eofbit;
5689 *ret = first;
5690 return ret;
5693 /* ?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 */
5694 /* ?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 */
5695 #if _MSVCP_VER <= 100
5696 #define call_num_get_wchar_do_get_long(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 32, istreambuf_iterator_wchar*, \
5697 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, LONG*), \
5698 (this, ret, first, last, base, state, pval))
5699 #else
5700 #define call_num_get_wchar_do_get_long(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 40, istreambuf_iterator_wchar*, \
5701 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, LONG*), \
5702 (this, ret, first, last, base, state, pval))
5703 #endif
5704 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_long,36)
5705 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_long(const num_get *this, istreambuf_iterator_wchar *ret,
5706 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, LONG *pval)
5708 return num_get_do_get_long(this, ret, first, last, base,
5709 state, pval, numpunct_wchar_use_facet(base->loc));
5712 /* ?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 */
5713 /* ?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 */
5714 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_long,36)
5715 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_long(const num_get *this, istreambuf_iterator_wchar *ret,
5716 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, LONG *pval)
5718 return num_get_do_get_long(this, ret, first, last, base,
5719 state, pval, numpunct_short_use_facet(base->loc));
5722 /* ?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 */
5723 /* ?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 */
5724 /* ?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 */
5725 /* ?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 */
5726 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_long,36)
5727 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_long(const num_get *this, istreambuf_iterator_wchar *ret,
5728 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, LONG *pval)
5730 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5731 return call_num_get_wchar_do_get_long(this, ret, first, last, base, state, pval);
5734 /* ?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 */
5735 /* ?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 */
5736 #if _MSVCP_VER <= 100
5737 #define call_num_get_wchar_do_get_uint(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 36, istreambuf_iterator_wchar*, \
5738 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, unsigned int*), \
5739 (this, ret, first, last, base, state, pval))
5740 #else
5741 #define call_num_get_wchar_do_get_uint(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 44, istreambuf_iterator_wchar*, \
5742 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, unsigned int*), \
5743 (this, ret, first, last, base, state, pval))
5744 #endif
5745 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_uint,36)
5746 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_uint(const num_get *this, istreambuf_iterator_wchar *ret,
5747 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, unsigned int *pval)
5749 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5750 return num_get_wchar_do_get_ulong(this, ret, first, last, base, state, pval);
5753 /* ?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 */
5754 /* ?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 */
5755 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_uint,36)
5756 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_uint(const num_get *this, istreambuf_iterator_wchar *ret,
5757 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, unsigned int *pval)
5759 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5760 return num_get_short_do_get_ulong(this, ret, first, last, base, state, pval);
5763 /* ?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 */
5764 /* ?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 */
5765 /* ?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 */
5766 /* ?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 */
5767 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_uint,36)
5768 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_uint(const num_get *this, istreambuf_iterator_wchar *ret,
5769 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, unsigned int *pval)
5771 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5772 return call_num_get_wchar_do_get_uint(this, ret, first, last, base, state, pval);
5775 /* ?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 */
5776 /* ?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 */
5777 #if _MSVCP_VER <= 100
5778 #define call_num_get_wchar_do_get_ushort(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 40, istreambuf_iterator_wchar*, \
5779 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, unsigned short*), \
5780 (this, ret, first, last, base, state, pval))
5781 #else
5782 #define call_num_get_wchar_do_get_ushort(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 48, istreambuf_iterator_wchar*, \
5783 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, unsigned short*), \
5784 (this, ret, first, last, base, state, pval))
5785 #endif
5786 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_ushort,36)
5787 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_ushort(const num_get *this, istreambuf_iterator_wchar *ret,
5788 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, unsigned short *pval)
5790 ULONG v;
5791 char tmp[25], *beg, *end;
5792 int err, b;
5794 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5796 b = num_get_wchar__Getifld(this, tmp,
5797 &first, &last, base->fmtfl, base->loc);
5798 beg = tmp + (tmp[0]=='-' ? 1 : 0);
5799 v = _Stoulx(beg, &end, b, &err);
5801 if(v != (ULONG)((unsigned short)v))
5802 *state |= IOSTATE_failbit;
5803 else if(end!=beg && !err)
5804 *pval = (tmp[0]=='-' ? -((unsigned short)v) : v);
5805 else
5806 *state |= IOSTATE_failbit;
5808 if(!first.strbuf)
5809 *state |= IOSTATE_eofbit;
5811 *ret = first;
5812 return ret;
5815 /* ?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 */
5816 /* ?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 */
5817 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_ushort,36)
5818 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_ushort(const num_get *this, istreambuf_iterator_wchar *ret,
5819 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, unsigned short *pval)
5821 FIXME("(%p %p %p %p %p) stub\n", this, ret, base, state, pval);
5822 return ret;
5825 /* ?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 */
5826 /* ?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 */
5827 /* ?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@ */
5828 /* ?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 */
5829 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_ushort,36)
5830 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_ushort(const num_get *this, istreambuf_iterator_wchar *ret,
5831 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, unsigned short *pval)
5833 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5834 return call_num_get_wchar_do_get_ushort(this, ret, first, last, base, state, pval);
5837 static istreambuf_iterator_wchar* num_get_do_get_bool(const num_get *this,
5838 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar first,
5839 istreambuf_iterator_wchar last, ios_base *base, int *state,
5840 MSVCP_bool *pval, numpunct_wchar *numpunct)
5842 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5844 if(base->fmtfl & FMTFLAG_boolalpha) {
5845 basic_string_wchar false_bstr, true_bstr;
5846 const wchar_t *pfalse, *ptrue;
5848 numpunct_wchar_falsename(numpunct, &false_bstr);
5849 numpunct_wchar_truename(numpunct, &true_bstr);
5850 pfalse = MSVCP_basic_string_wchar_c_str(&false_bstr);
5851 ptrue = MSVCP_basic_string_wchar_c_str(&true_bstr);
5853 for(istreambuf_iterator_wchar_val(&first); first.strbuf;) {
5854 if(pfalse && *pfalse && first.val!=*pfalse)
5855 pfalse = NULL;
5856 if(ptrue && *ptrue && first.val!=*ptrue)
5857 ptrue = NULL;
5859 if(pfalse && *pfalse && ptrue && !*ptrue)
5860 ptrue = NULL;
5861 if(ptrue && *ptrue && pfalse && !*pfalse)
5862 pfalse = NULL;
5864 if(pfalse)
5865 pfalse++;
5866 if(ptrue)
5867 ptrue++;
5869 if(pfalse || ptrue)
5870 istreambuf_iterator_wchar_inc(&first);
5872 if((!pfalse || !*pfalse) && (!ptrue || !*ptrue))
5873 break;
5876 if(ptrue)
5877 *pval = TRUE;
5878 else if(pfalse)
5879 *pval = FALSE;
5880 else
5881 *state |= IOSTATE_failbit;
5883 MSVCP_basic_string_wchar_dtor(&false_bstr);
5884 MSVCP_basic_string_wchar_dtor(&true_bstr);
5885 }else {
5886 char tmp[25], *end;
5887 int err;
5888 LONG v = _Stolx(tmp, &end, num_get__Getifld(this, tmp, &first,
5889 &last, base->fmtfl, base->loc, numpunct), &err);
5891 if(end!=tmp && err==0 && (v==0 || v==1))
5892 *pval = v;
5893 else
5894 *state |= IOSTATE_failbit;
5897 if(!first.strbuf)
5898 *state |= IOSTATE_eofbit;
5899 memcpy(ret, &first, sizeof(first));
5900 return ret;
5903 /* ?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 */
5904 /* ?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 */
5905 #if _MSVCP_VER <= 100
5906 #define call_num_get_wchar_do_get_bool(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 44, istreambuf_iterator_wchar*, \
5907 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, MSVCP_bool*), \
5908 (this, ret, first, last, base, state, pval))
5909 #else
5910 #define call_num_get_wchar_do_get_bool(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 52, istreambuf_iterator_wchar*, \
5911 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, MSVCP_bool*), \
5912 (this, ret, first, last, base, state, pval))
5913 #endif
5914 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_bool,36)
5915 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_bool(const num_get *this, istreambuf_iterator_wchar *ret,
5916 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, MSVCP_bool *pval)
5918 return num_get_do_get_bool(this, ret, first, last, base,
5919 state, pval, numpunct_wchar_use_facet(base->loc));
5922 /* ?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 */
5923 /* ?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 */
5924 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_bool,36)
5925 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_bool(const num_get *this, istreambuf_iterator_wchar *ret,
5926 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, MSVCP_bool *pval)
5928 return num_get_do_get_bool(this, ret, first, last, base,
5929 state, pval, numpunct_short_use_facet(base->loc));
5932 /* ?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 */
5933 /* ?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 */
5934 /* ?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 */
5935 /* ?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 */
5936 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_bool,36)
5937 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_bool(const num_get *this, istreambuf_iterator_wchar *ret,
5938 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, MSVCP_bool *pval)
5940 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5941 return call_num_get_wchar_do_get_bool(this, ret, first, last, base, state, pval);
5944 /* ?id@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@2V0locale@2@A */
5945 locale_id num_get_char_id = {0};
5947 /* ??_7?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@6B@ */
5948 extern const vtable_ptr MSVCP_num_get_char_vtable;
5950 /* ?_Init@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@IAEXABV_Locinfo@2@@Z */
5951 /* ?_Init@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@IEAAXAEBV_Locinfo@2@@Z */
5952 DEFINE_THISCALL_WRAPPER(num_get_char__Init, 8)
5953 void __thiscall num_get_char__Init(num_get *this, const _Locinfo *locinfo)
5955 TRACE("(%p %p)\n", this, locinfo);
5956 _Locinfo__Getcvt(locinfo, &this->cvt);
5959 /* ??0?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
5960 /* ??0?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
5961 DEFINE_THISCALL_WRAPPER(num_get_char_ctor_locinfo, 12)
5962 num_get* __thiscall num_get_char_ctor_locinfo(num_get *this,
5963 const _Locinfo *locinfo, MSVCP_size_t refs)
5965 TRACE("(%p %p %lu)\n", this, locinfo, refs);
5967 locale_facet_ctor_refs(&this->facet, refs);
5968 this->facet.vtable = &MSVCP_num_get_char_vtable;
5970 num_get_char__Init(this, locinfo);
5971 return this;
5974 /* ??0?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAE@I@Z */
5975 /* ??0?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAA@_K@Z */
5976 DEFINE_THISCALL_WRAPPER(num_get_char_ctor_refs, 8)
5977 num_get* __thiscall num_get_char_ctor_refs(num_get *this, MSVCP_size_t refs)
5979 _Locinfo locinfo;
5981 TRACE("(%p %lu)\n", this, refs);
5983 _Locinfo_ctor(&locinfo);
5984 num_get_char_ctor_locinfo(this, &locinfo, refs);
5985 _Locinfo_dtor(&locinfo);
5986 return this;
5989 /* ??_F?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAEXXZ */
5990 /* ??_F?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAAXXZ */
5991 DEFINE_THISCALL_WRAPPER(num_get_char_ctor, 4)
5992 num_get* __thiscall num_get_char_ctor(num_get *this)
5994 return num_get_char_ctor_refs(this, 0);
5997 /* ??1?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MAE@XZ */
5998 /* ??1?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MEAA@XZ */
5999 DEFINE_THISCALL_WRAPPER(num_get_char_dtor, 4)
6000 void __thiscall num_get_char_dtor(num_get *this)
6002 TRACE("(%p)\n", this);
6003 locale_facet_dtor(&this->facet);
6006 DEFINE_THISCALL_WRAPPER(num_get_char_vector_dtor, 8)
6007 num_get* __thiscall num_get_char_vector_dtor(num_get *this, unsigned int flags)
6009 TRACE("(%p %x)\n", this, flags);
6010 if(flags & 2) {
6011 /* we have an array, with the number of elements stored before the first object */
6012 INT_PTR i, *ptr = (INT_PTR *)this-1;
6014 for(i=*ptr-1; i>=0; i--)
6015 num_get_char_dtor(this+i);
6016 MSVCRT_operator_delete(ptr);
6017 } else {
6018 num_get_char_dtor(this);
6019 if(flags & 1)
6020 MSVCRT_operator_delete(this);
6023 return this;
6026 /* ?_Getcat@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
6027 /* ?_Getcat@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
6028 MSVCP_size_t __cdecl num_get_char__Getcat(const locale_facet **facet, const locale *loc)
6030 TRACE("(%p %p)\n", facet, loc);
6032 if(facet && !*facet) {
6033 _Locinfo locinfo;
6035 *facet = MSVCRT_operator_new(sizeof(num_get));
6036 if(!*facet) {
6037 ERR("Out of memory\n");
6038 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
6039 return 0;
6042 _Locinfo_ctor_cstr(&locinfo, locale_string_char_c_str(&loc->ptr->name));
6043 num_get_char_ctor_locinfo((num_get*)*facet, &locinfo, 0);
6044 _Locinfo_dtor(&locinfo);
6047 return LC_NUMERIC;
6050 /* ?_Getcat@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SAIPAPBVfacet@locale@2@@Z */
6051 /* ?_Getcat@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@@Z */
6052 MSVCP_size_t __cdecl num_get_char__Getcat_old(const locale_facet **facet)
6054 return num_get_char__Getcat(facet, locale_classic());
6057 num_get* num_get_char_use_facet(const locale *loc)
6059 static num_get *obj = NULL;
6061 _Lockit lock;
6062 const locale_facet *fac;
6064 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
6065 fac = locale__Getfacet(loc, locale_id_operator_size_t(&num_get_char_id));
6066 if(fac) {
6067 _Lockit_dtor(&lock);
6068 return (num_get*)fac;
6071 if(obj) {
6072 _Lockit_dtor(&lock);
6073 return obj;
6076 num_get_char__Getcat(&fac, loc);
6077 obj = (num_get*)fac;
6078 call_locale_facet__Incref(&obj->facet);
6079 locale_facet_register(&obj->facet);
6080 _Lockit_dtor(&lock);
6082 return obj;
6085 /* ?_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 */
6086 /* ?_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 */
6087 /* Copies number to dest buffer, validates grouping and skips separators.
6088 * Updates first so it points past the number, all digits are skipped.
6089 * Returns how exponent needs to changed.
6090 * Size of dest buffer is not specified, assuming it's not smaller than 32:
6091 * strlen(+0.e+) + 22(digits) + 4(expontent) + 1(nullbyte)
6093 int __cdecl num_get_char__Getffld(const num_get *this, char *dest, istreambuf_iterator_char *first,
6094 istreambuf_iterator_char *last, const locale *loc)
6096 numpunct_char *numpunct = numpunct_char_use_facet(loc);
6097 basic_string_char grouping_bstr;
6098 basic_string_char groups_found;
6099 int groups_no = 0, cur_group = 0, exp = 0;
6100 char *dest_beg = dest, *num_end = dest+25, *exp_end = dest+31, sep;
6101 const char *grouping, *groups;
6102 BOOL error = FALSE, got_digit = FALSE, got_nonzero = FALSE;
6104 TRACE("(%p %p %p %p)\n", dest, first, last, loc);
6106 numpunct_char_grouping(numpunct, &grouping_bstr);
6107 grouping = MSVCP_basic_string_char_c_str(&grouping_bstr);
6108 sep = grouping[0] ? numpunct_char_thousands_sep(numpunct) : '\0';
6110 if(sep)
6111 MSVCP_basic_string_char_ctor(&groups_found);
6113 istreambuf_iterator_char_val(first);
6114 /* get sign */
6115 if(first->strbuf && (first->val=='-' || first->val=='+')) {
6116 *dest++ = first->val;
6117 istreambuf_iterator_char_inc(first);
6120 /* read possibly grouped numbers before decimal */
6121 for(; first->strbuf; istreambuf_iterator_char_inc(first)) {
6122 if(first->val<'0' || first->val>'9') {
6123 if(sep && first->val==sep) {
6124 if(!groups_no) break; /* empty group - stop parsing */
6125 MSVCP_basic_string_char_append_ch(&groups_found, groups_no);
6126 groups_no = 0;
6127 ++cur_group;
6128 }else {
6129 break;
6131 }else {
6132 got_digit = TRUE; /* found a digit, zero or non-zero */
6133 /* write digit to dest if not a leading zero (to not waste dest buffer) */
6134 if(!got_nonzero && first->val == '0')
6136 ++groups_no;
6137 continue;
6139 got_nonzero = TRUE;
6140 if(dest < num_end)
6141 *dest++ = first->val;
6142 else
6143 exp++; /* too many digits, just multiply by 10 */
6144 if(sep && groups_no<CHAR_MAX)
6145 ++groups_no;
6149 /* if all leading zeroes, we didn't write anything so put a zero we check for a decimal */
6150 if(got_digit && !got_nonzero)
6151 *dest++ = '0';
6153 /* get decimal, if any */
6154 if(first->strbuf && first->val==numpunct_char_decimal_point(numpunct)) {
6155 if(dest < num_end)
6156 *dest++ = *localeconv()->decimal_point;
6157 istreambuf_iterator_char_inc(first);
6160 /* read non-grouped after decimal */
6161 for(; first->strbuf; istreambuf_iterator_char_inc(first)) {
6162 if(first->val<'0' || first->val>'9')
6163 break;
6164 else if(dest<num_end) {
6165 got_digit = TRUE;
6166 *dest++ = first->val;
6170 /* read exponent, if any */
6171 if(first->strbuf && (first->val=='e' || first->val=='E')) {
6172 *dest++ = first->val;
6173 istreambuf_iterator_char_inc(first);
6175 if(first->strbuf && (first->val=='-' || first->val=='+')) {
6176 *dest++ = first->val;
6177 istreambuf_iterator_char_inc(first);
6180 got_digit = got_nonzero = FALSE;
6181 error = TRUE;
6182 /* skip any leading zeroes */
6183 for(; first->strbuf && first->val=='0'; istreambuf_iterator_char_inc(first))
6184 got_digit = TRUE;
6186 for(; first->strbuf && first->val>='0' && first->val<='9'; istreambuf_iterator_char_inc(first)) {
6187 got_digit = got_nonzero = TRUE; /* leading zeroes would have been skipped, so first digit is non-zero */
6188 error = FALSE;
6189 if(dest<exp_end)
6190 *dest++ = first->val;
6193 /* if just found zeroes for exponent, use that */
6194 if(got_digit && !got_nonzero)
6196 error = FALSE;
6197 if(dest<exp_end)
6198 *dest++ = '0';
6202 if(sep && groups_no)
6203 MSVCP_basic_string_char_append_ch(&groups_found, groups_no);
6205 if(!cur_group) /* no groups, skip loop */
6206 cur_group--;
6207 else if(!(groups = MSVCP_basic_string_char_c_str(&groups_found))[cur_group])
6208 error = TRUE; /* trailing empty */
6210 for(; cur_group>=0 && !error; cur_group--) {
6211 if(*grouping == CHAR_MAX) {
6212 if(cur_group)
6213 error = TRUE;
6214 break;
6215 }else if((cur_group && *grouping!=groups[cur_group])
6216 || (!cur_group && *grouping<groups[cur_group])) {
6217 error = TRUE;
6218 break;
6219 }else if(grouping[1]) {
6220 grouping++;
6223 MSVCP_basic_string_char_dtor(&grouping_bstr);
6224 if(sep)
6225 MSVCP_basic_string_char_dtor(&groups_found);
6227 if(error) {
6228 *dest_beg = '\0';
6229 return 0;
6231 *dest++ = '\0';
6232 return exp;
6235 /* ?_Getffldx@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@ABAHPADAAV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@1AAVios_base@2@PAH@Z */
6236 /* ?_Getffldx@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@AEBAHPEADAEAV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@1AEAVios_base@2@PEAH@Z */
6237 int __cdecl num_get_char__Getffldx(const num_get *this, char *dest, istreambuf_iterator_char *first,
6238 istreambuf_iterator_char *last, ios_base *ios, int *phexexp)
6240 FIXME("(%p %p %p %p %p) stub\n", dest, first, last, ios, phexexp);
6241 return -1;
6244 /* ?_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 */
6245 /* ?_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 */
6246 /* Copies number to dest buffer, validates grouping and skips separators.
6247 * Updates first so it points past the number, all digits are skipped.
6248 * Returns number base (8, 10 or 16).
6249 * Size of dest buffer is not specified, assuming it's not smaller than 25:
6250 * 22(8^22>2^64)+1(detect overflows)+1(sign)+1(nullbyte) = 25
6252 int __cdecl num_get_char__Getifld(const num_get *this, char *dest, istreambuf_iterator_char *first,
6253 istreambuf_iterator_char *last, int fmtflags, const locale *loc)
6255 static const char digits[] = "0123456789abcdefABCDEF";
6257 numpunct_char *numpunct = numpunct_char_use_facet(loc);
6258 basic_string_char grouping_bstr;
6259 basic_string_char groups_found;
6260 int basefield, base, groups_no = 0, cur_group = 0;
6261 char *dest_beg = dest, *dest_end = dest+24, sep;
6262 const char *grouping, *groups;
6263 BOOL error = TRUE, dest_empty = TRUE, found_zero = FALSE;
6265 TRACE("(%p %p %p %04x %p)\n", dest, first, last, fmtflags, loc);
6267 numpunct_char_grouping(numpunct, &grouping_bstr);
6268 grouping = MSVCP_basic_string_char_c_str(&grouping_bstr);
6269 sep = grouping[0] ? numpunct_char_thousands_sep(numpunct) : '\0';
6271 basefield = fmtflags & FMTFLAG_basefield;
6272 if(basefield == FMTFLAG_oct)
6273 base = 8;
6274 else if(basefield == FMTFLAG_hex)
6275 base = 22; /* equal to the size of digits buffer */
6276 else if(!basefield)
6277 base = 0;
6278 else
6279 base = 10;
6281 istreambuf_iterator_char_val(first);
6282 if(first->strbuf && (first->val=='-' || first->val=='+')) {
6283 *dest++ = first->val;
6284 istreambuf_iterator_char_inc(first);
6287 if(first->strbuf && first->val=='0') {
6288 found_zero = TRUE;
6289 istreambuf_iterator_char_inc(first);
6290 if(first->strbuf && (first->val=='x' || first->val=='X')) {
6291 if(!base || base == 22) {
6292 found_zero = FALSE;
6293 istreambuf_iterator_char_inc(first);
6294 base = 22;
6295 }else {
6296 base = 10;
6298 }else {
6299 error = FALSE;
6300 if(!base) base = 8;
6302 }else {
6303 if (!base) base = 10;
6306 if(sep)
6308 MSVCP_basic_string_char_ctor(&groups_found);
6309 if(found_zero) ++groups_no;
6312 for(; first->strbuf; istreambuf_iterator_char_inc(first)) {
6313 if(!memchr(digits, first->val, base)) {
6314 if(sep && first->val==sep) {
6315 if(!groups_no) break; /* empty group - stop parsing */
6316 MSVCP_basic_string_char_append_ch(&groups_found, groups_no);
6317 groups_no = 0;
6318 ++cur_group;
6319 }else {
6320 break;
6322 }else {
6323 error = FALSE;
6324 if(dest_empty && first->val == '0')
6326 found_zero = TRUE;
6327 ++groups_no;
6328 continue;
6330 dest_empty = FALSE;
6331 /* skip digits that can't be copied to dest buffer, other
6332 * functions are responsible for detecting overflows */
6333 if(dest < dest_end)
6334 *dest++ = first->val;
6335 if(sep && groups_no<CHAR_MAX)
6336 ++groups_no;
6340 if(sep && groups_no)
6341 MSVCP_basic_string_char_append_ch(&groups_found, groups_no);
6343 if(!cur_group) { /* no groups, skip loop */
6344 cur_group--;
6345 }else if(!(groups = MSVCP_basic_string_char_c_str(&groups_found))[cur_group]) {
6346 error = TRUE; /* trailing empty */
6347 found_zero = FALSE;
6350 for(; cur_group>=0 && !error; cur_group--) {
6351 if(*grouping == CHAR_MAX) {
6352 if(cur_group)
6353 error = TRUE;
6354 break;
6355 }else if((cur_group && *grouping!=groups[cur_group])
6356 || (!cur_group && *grouping<groups[cur_group])) {
6357 error = TRUE;
6358 break;
6359 }else if(grouping[1]) {
6360 grouping++;
6364 MSVCP_basic_string_char_dtor(&grouping_bstr);
6365 if(sep)
6366 MSVCP_basic_string_char_dtor(&groups_found);
6368 if(error) {
6369 if (found_zero)
6370 *dest++ = '0';
6371 else
6372 dest = dest_beg;
6373 }else if(dest_empty)
6374 *dest++ = '0';
6375 *dest = '\0';
6377 return (base==22 ? 16 : base);
6380 /* ?_Hexdig@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@ABEHD000@Z */
6381 /* ?_Hexdig@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@AEBAHD000@Z */
6382 DEFINE_THISCALL_WRAPPER(MSVCP_num_get_char__Hexdig, 20)
6383 int __thiscall MSVCP_num_get_char__Hexdig(num_get *this, char dig, char e0, char al, char au)
6385 FIXME("(%p %c %c %c %c) stub\n", this, dig, e0, al, au);
6386 return -1;
6389 /* ?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 */
6390 /* ?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 */
6391 #if _MSVCP_VER <= 100
6392 #define call_num_get_char_do_get_void(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 4, istreambuf_iterator_char*, \
6393 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, void**), \
6394 (this, ret, first, last, base, state, pval))
6395 #else
6396 #define call_num_get_char_do_get_void(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 12, istreambuf_iterator_char*, \
6397 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, void**), \
6398 (this, ret, first, last, base, state, pval))
6399 #endif
6400 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_void,36)
6401 istreambuf_iterator_char *__thiscall num_get_char_do_get_void(const num_get *this, istreambuf_iterator_char *ret,
6402 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, void **pval)
6404 unsigned __int64 v;
6405 char tmp[25], *end;
6406 int err;
6408 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6410 v = _Stoullx(tmp, &end, num_get_char__Getifld(this, tmp,
6411 &first, &last, FMTFLAG_hex, base->loc), &err);
6412 if(v!=(unsigned __int64)((INT_PTR)v))
6413 *state |= IOSTATE_failbit;
6414 else if(end!=tmp && !err)
6415 *pval = (void*)((INT_PTR)v);
6416 else
6417 *state |= IOSTATE_failbit;
6419 if(!first.strbuf)
6420 *state |= IOSTATE_eofbit;
6422 *ret = first;
6423 return ret;
6426 /* ?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 */
6427 /* ?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 */
6428 DEFINE_THISCALL_WRAPPER(num_get_char_get_void,36)
6429 istreambuf_iterator_char *__thiscall num_get_char_get_void(const num_get *this, istreambuf_iterator_char *ret,
6430 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, void **pval)
6432 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6433 return call_num_get_char_do_get_void(this, ret, first, last, base, state, pval);
6436 /* ?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 */
6437 /* ?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 */
6438 /* ?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 */
6439 /* ?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 */
6440 #if _MSVCP_VER <= 100
6441 #define call_num_get_char_do_get_ldouble(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 8, istreambuf_iterator_char*, \
6442 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, double*), \
6443 (this, ret, first, last, base, state, pval))
6444 #define call_num_get_char_do_get_double(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 12, istreambuf_iterator_char*, \
6445 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, double*), \
6446 (this, ret, first, last, base, state, pval))
6447 #else
6448 #define call_num_get_char_do_get_ldouble(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 16, istreambuf_iterator_char*, \
6449 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, double*), \
6450 (this, ret, first, last, base, state, pval))
6451 #define call_num_get_char_do_get_double(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 20, istreambuf_iterator_char*, \
6452 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, double*), \
6453 (this, ret, first, last, base, state, pval))
6454 #endif
6455 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_double,36)
6456 istreambuf_iterator_char *__thiscall num_get_char_do_get_double(const num_get *this, istreambuf_iterator_char *ret,
6457 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, double *pval)
6459 double v;
6460 char tmp[32], *end;
6461 int err;
6463 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6465 v = _Stodx(tmp, &end, num_get_char__Getffld(this, tmp, &first, &last, base->loc), &err);
6466 if(end!=tmp && !err)
6467 *pval = v;
6468 else
6469 *state |= IOSTATE_failbit;
6471 if(!first.strbuf)
6472 *state |= IOSTATE_eofbit;
6474 *ret = first;
6475 return ret;
6478 /* ?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 */
6479 /* ?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 */
6480 DEFINE_THISCALL_WRAPPER(num_get_char_get_ldouble,36)
6481 istreambuf_iterator_char *__thiscall num_get_char_get_ldouble(const num_get *this, istreambuf_iterator_char *ret,
6482 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, double *pval)
6484 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6485 return call_num_get_char_do_get_ldouble(this, ret, first, last, base, state, pval);
6488 /* ?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 */
6489 /* ?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 */
6490 DEFINE_THISCALL_WRAPPER(num_get_char_get_double,36)
6491 istreambuf_iterator_char *__thiscall num_get_char_get_double(const num_get *this, istreambuf_iterator_char *ret,
6492 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, double *pval)
6494 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6495 return call_num_get_char_do_get_double(this, ret, first, last, base, state, pval);
6498 /* ?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 */
6499 /* ?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 */
6500 #if _MSVCP_VER <= 100
6501 #define call_num_get_char_do_get_float(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 16, istreambuf_iterator_char*, \
6502 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, float*), \
6503 (this, ret, first, last, base, state, pval))
6504 #else
6505 #define call_num_get_char_do_get_float(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 24, istreambuf_iterator_char*, \
6506 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, float*), \
6507 (this, ret, first, last, base, state, pval))
6508 #endif
6509 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_float,36)
6510 istreambuf_iterator_char *__thiscall num_get_char_do_get_float(const num_get *this, istreambuf_iterator_char *ret,
6511 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, float *pval)
6513 float v;
6514 char tmp[32], *end;
6515 int err;
6517 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6519 v = _Stofx(tmp, &end, num_get_char__Getffld(this, tmp, &first, &last, base->loc), &err);
6520 if(end!=tmp && !err)
6521 *pval = v;
6522 else
6523 *state |= IOSTATE_failbit;
6525 if(!first.strbuf)
6526 *state |= IOSTATE_eofbit;
6528 *ret = first;
6529 return ret;
6532 /* ?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 */
6533 /* ?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 */
6534 DEFINE_THISCALL_WRAPPER(num_get_char_get_float,36)
6535 istreambuf_iterator_char *__thiscall num_get_char_get_float(const num_get *this, istreambuf_iterator_char *ret,
6536 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, float *pval)
6538 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6539 return call_num_get_char_do_get_float(this, ret, first, last, base, state, pval);
6542 /* ?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 */
6543 /* ?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 */
6544 #if _MSVCP_VER <= 100
6545 #define call_num_get_char_do_get_uint64(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 20, istreambuf_iterator_char*, \
6546 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, ULONGLONG*), \
6547 (this, ret, first, last, base, state, pval))
6548 #else
6549 #define call_num_get_char_do_get_uint64(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 28, istreambuf_iterator_char*, \
6550 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, ULONGLONG*), \
6551 (this, ret, first, last, base, state, pval))
6552 #endif
6553 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_uint64,36)
6554 istreambuf_iterator_char *__thiscall num_get_char_do_get_uint64(const num_get *this, istreambuf_iterator_char *ret,
6555 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, ULONGLONG *pval)
6557 unsigned __int64 v;
6558 char tmp[25], *end;
6559 int err;
6561 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6563 v = _Stoullx(tmp, &end, num_get_char__Getifld(this, tmp,
6564 &first, &last, base->fmtfl, base->loc), &err);
6565 if(end!=tmp && !err)
6566 *pval = v;
6567 else
6568 *state |= IOSTATE_failbit;
6570 if(!first.strbuf)
6571 *state |= IOSTATE_eofbit;
6573 *ret = first;
6574 return ret;
6577 /* ?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 */
6578 /* ?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 */
6579 DEFINE_THISCALL_WRAPPER(num_get_char_get_uint64,36)
6580 istreambuf_iterator_char *__thiscall num_get_char_get_uint64(const num_get *this, istreambuf_iterator_char *ret,
6581 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, ULONGLONG *pval)
6583 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6584 return call_num_get_char_do_get_uint64(this, ret, first, last, base, state, pval);
6587 /* ?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 */
6588 /* ?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 */
6589 #if _MSVCP_VER <= 100
6590 #define call_num_get_char_do_get_int64(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 24, istreambuf_iterator_char*, \
6591 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, LONGLONG*), \
6592 (this, ret, first, last, base, state, pval))
6593 #else
6594 #define call_num_get_char_do_get_int64(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 32, istreambuf_iterator_char*, \
6595 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, LONGLONG*), \
6596 (this, ret, first, last, base, state, pval))
6597 #endif
6598 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_int64,36)
6599 istreambuf_iterator_char *__thiscall num_get_char_do_get_int64(const num_get *this, istreambuf_iterator_char *ret,
6600 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, LONGLONG *pval)
6602 __int64 v;
6603 char tmp[25], *end;
6604 int err;
6606 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6608 v = _Stollx(tmp, &end, num_get_char__Getifld(this, tmp,
6609 &first, &last, base->fmtfl, base->loc), &err);
6610 if(end!=tmp && !err)
6611 *pval = v;
6612 else
6613 *state |= IOSTATE_failbit;
6615 if(!first.strbuf)
6616 *state |= IOSTATE_eofbit;
6618 *ret = first;
6619 return ret;
6622 /* ?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 */
6623 /* ?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 */
6624 DEFINE_THISCALL_WRAPPER(num_get_char_get_int64,36)
6625 istreambuf_iterator_char *__thiscall num_get_char_get_int64(const num_get *this, istreambuf_iterator_char *ret,
6626 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, LONGLONG *pval)
6628 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6629 return call_num_get_char_do_get_int64(this, ret, first, last, base, state, pval);
6632 /* ?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 */
6633 /* ?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 */
6634 #if _MSVCP_VER <= 100
6635 #define call_num_get_char_do_get_ulong(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 28, istreambuf_iterator_char*, \
6636 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, ULONG*), \
6637 (this, ret, first, last, base, state, pval))
6638 #else
6639 #define call_num_get_char_do_get_ulong(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 36, istreambuf_iterator_char*, \
6640 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, ULONG*), \
6641 (this, ret, first, last, base, state, pval))
6642 #endif
6643 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_ulong,36)
6644 istreambuf_iterator_char *__thiscall num_get_char_do_get_ulong(const num_get *this, istreambuf_iterator_char *ret,
6645 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, ULONG *pval)
6647 ULONG v;
6648 char tmp[25], *end;
6649 int err;
6651 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6653 v = _Stoulx(tmp, &end, num_get_char__Getifld(this, tmp,
6654 &first, &last, base->fmtfl, base->loc), &err);
6655 if(end!=tmp && !err)
6656 *pval = v;
6657 else
6658 *state |= IOSTATE_failbit;
6660 if(!first.strbuf)
6661 *state |= IOSTATE_eofbit;
6663 *ret = first;
6664 return ret;
6667 /* ?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 */
6668 /* ?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 */
6669 DEFINE_THISCALL_WRAPPER(num_get_char_get_ulong,36)
6670 istreambuf_iterator_char *__thiscall num_get_char_get_ulong(const num_get *this, istreambuf_iterator_char *ret,
6671 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, ULONG *pval)
6673 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6674 return call_num_get_char_do_get_ulong(this, ret, first, last, base, state, pval);
6677 /* ?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 */
6678 /* ?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 */
6679 #if _MSVCP_VER <= 100
6680 #define call_num_get_char_do_get_long(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 32, istreambuf_iterator_char*, \
6681 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, LONG*), \
6682 (this, ret, first, last, base, state, pval))
6683 #else
6684 #define call_num_get_char_do_get_long(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 40, istreambuf_iterator_char*, \
6685 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, LONG*), \
6686 (this, ret, first, last, base, state, pval))
6687 #endif
6688 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_long,36)
6689 istreambuf_iterator_char *__thiscall num_get_char_do_get_long(const num_get *this, istreambuf_iterator_char *ret,
6690 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, LONG *pval)
6692 LONG v;
6693 char tmp[25], *end;
6694 int err;
6696 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6698 v = _Stolx(tmp, &end, num_get_char__Getifld(this, tmp,
6699 &first, &last, base->fmtfl, base->loc), &err);
6700 if(end!=tmp && !err)
6701 *pval = v;
6702 else
6703 *state |= IOSTATE_failbit;
6705 if(!first.strbuf)
6706 *state |= IOSTATE_eofbit;
6708 *ret = first;
6709 return ret;
6712 /* ?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 */
6713 /* ?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 */
6714 DEFINE_THISCALL_WRAPPER(num_get_char_get_long,36)
6715 istreambuf_iterator_char *__thiscall num_get_char_get_long(const num_get *this, istreambuf_iterator_char *ret,
6716 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, LONG *pval)
6718 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6719 return call_num_get_char_do_get_long(this, ret, first, last, base, state, pval);
6722 /* ?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 */
6723 /* ?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 */
6724 #if _MSVCP_VER <= 100
6725 #define call_num_get_char_do_get_uint(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 36, istreambuf_iterator_char*, \
6726 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, unsigned int*), \
6727 (this, ret, first, last, base, state, pval))
6728 #else
6729 #define call_num_get_char_do_get_uint(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 44, istreambuf_iterator_char*, \
6730 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, unsigned int*), \
6731 (this, ret, first, last, base, state, pval))
6732 #endif
6733 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_uint,36)
6734 istreambuf_iterator_char *__thiscall num_get_char_do_get_uint(const num_get *this, istreambuf_iterator_char *ret,
6735 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, unsigned int *pval)
6737 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6738 return num_get_char_do_get_ulong(this, ret, first, last, base, state, pval);
6741 /* ?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 */
6742 /* ?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 */
6743 DEFINE_THISCALL_WRAPPER(num_get_char_get_uint,36)
6744 istreambuf_iterator_char *__thiscall num_get_char_get_uint(const num_get *this, istreambuf_iterator_char *ret,
6745 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, unsigned int *pval)
6747 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6748 return call_num_get_char_do_get_uint(this, ret, first, last, base, state, pval);
6751 /* ?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 */
6752 /* ?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 */
6753 #if _MSVCP_VER <= 100
6754 #define call_num_get_char_do_get_ushort(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 40, istreambuf_iterator_char*, \
6755 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, unsigned short*), \
6756 (this, ret, first, last, base, state, pval))
6757 #else
6758 #define call_num_get_char_do_get_ushort(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 48, istreambuf_iterator_char*, \
6759 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, unsigned short*), \
6760 (this, ret, first, last, base, state, pval))
6761 #endif
6762 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_ushort,36)
6763 istreambuf_iterator_char *__thiscall num_get_char_do_get_ushort(const num_get *this, istreambuf_iterator_char *ret,
6764 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, unsigned short *pval)
6766 ULONG v;
6767 char tmp[25], *beg, *end;
6768 int err, b;
6770 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6772 b = num_get_char__Getifld(this, tmp,
6773 &first, &last, base->fmtfl, base->loc);
6774 beg = tmp + (tmp[0]=='-' ? 1 : 0);
6775 v = _Stoulx(beg, &end, b, &err);
6777 if(v != (ULONG)((unsigned short)v))
6778 *state |= IOSTATE_failbit;
6779 else if(end!=beg && !err)
6780 *pval = (tmp[0]=='-' ? -((unsigned short)v) : v);
6781 else
6782 *state |= IOSTATE_failbit;
6784 if(!first.strbuf)
6785 *state |= IOSTATE_eofbit;
6787 *ret = first;
6788 return ret;
6791 /* ?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 */
6792 /* ?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 */
6793 DEFINE_THISCALL_WRAPPER(num_get_char_get_ushort,36)
6794 istreambuf_iterator_char *__thiscall num_get_char_get_ushort(const num_get *this, istreambuf_iterator_char *ret,
6795 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, unsigned short *pval)
6797 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6798 return call_num_get_char_do_get_ushort(this, ret, first, last, base, state, pval);
6801 /* ?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 */
6802 /* ?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 */
6803 #if _MSVCP_VER <= 100
6804 #define call_num_get_char_do_get_bool(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 44, istreambuf_iterator_char*, \
6805 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, MSVCP_bool*), \
6806 (this, ret, first, last, base, state, pval))
6807 #else
6808 #define call_num_get_char_do_get_bool(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 52, istreambuf_iterator_char*, \
6809 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, MSVCP_bool*), \
6810 (this, ret, first, last, base, state, pval))
6811 #endif
6812 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_bool,36)
6813 istreambuf_iterator_char *__thiscall num_get_char_do_get_bool(const num_get *this, istreambuf_iterator_char *ret,
6814 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, MSVCP_bool *pval)
6816 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6818 if(base->fmtfl & FMTFLAG_boolalpha) {
6819 numpunct_char *numpunct = numpunct_char_use_facet(base->loc);
6820 basic_string_char false_bstr, true_bstr;
6821 const char *pfalse, *ptrue;
6823 numpunct_char_falsename(numpunct, &false_bstr);
6824 numpunct_char_truename(numpunct, &true_bstr);
6825 pfalse = MSVCP_basic_string_char_c_str(&false_bstr);
6826 ptrue = MSVCP_basic_string_char_c_str(&true_bstr);
6828 for(istreambuf_iterator_char_val(&first); first.strbuf;) {
6829 if(pfalse && *pfalse && first.val!=*pfalse)
6830 pfalse = NULL;
6831 if(ptrue && *ptrue && first.val!=*ptrue)
6832 ptrue = NULL;
6834 if(pfalse && *pfalse && ptrue && !*ptrue)
6835 ptrue = NULL;
6836 if(ptrue && *ptrue && pfalse && !*pfalse)
6837 pfalse = NULL;
6839 if(pfalse)
6840 pfalse++;
6841 if(ptrue)
6842 ptrue++;
6844 if(pfalse || ptrue)
6845 istreambuf_iterator_char_inc(&first);
6847 if((!pfalse || !*pfalse) && (!ptrue || !*ptrue))
6848 break;
6851 if(ptrue)
6852 *pval = TRUE;
6853 else if(pfalse)
6854 *pval = FALSE;
6855 else
6856 *state |= IOSTATE_failbit;
6858 MSVCP_basic_string_char_dtor(&false_bstr);
6859 MSVCP_basic_string_char_dtor(&true_bstr);
6860 }else {
6861 char tmp[25], *end;
6862 int err;
6863 LONG v = _Stolx(tmp, &end, num_get_char__Getifld(this, tmp,
6864 &first, &last, base->fmtfl, base->loc), &err);
6866 if(end!=tmp && err==0 && (v==0 || v==1))
6867 *pval = v;
6868 else
6869 *state |= IOSTATE_failbit;
6872 if(!first.strbuf)
6873 *state |= IOSTATE_eofbit;
6874 memcpy(ret, &first, sizeof(first));
6875 return ret;
6878 /* ?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 */
6879 /* ?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 */
6880 DEFINE_THISCALL_WRAPPER(num_get_char_get_bool,36)
6881 istreambuf_iterator_char *__thiscall num_get_char_get_bool(const num_get *this, istreambuf_iterator_char *ret,
6882 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, MSVCP_bool *pval)
6884 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6885 return call_num_get_char_do_get_bool(this, ret, first, last, base, state, pval);
6888 /* ?id@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@2V0locale@2@A */
6889 locale_id num_put_char_id = {0};
6891 /* num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@6B@ */
6892 extern const vtable_ptr MSVCP_num_put_char_vtable;
6894 /* ?_Init@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@IAEXABV_Locinfo@2@@Z */
6895 /* ?_Init@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@IEAAXAEBV_Locinfo@2@@Z */
6896 DEFINE_THISCALL_WRAPPER(num_put_char__Init, 8)
6897 void __thiscall num_put_char__Init(num_put *this, const _Locinfo *locinfo)
6899 TRACE("(%p %p)\n", this, locinfo);
6900 _Locinfo__Getcvt(locinfo, &this->cvt);
6903 /* ??0?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
6904 /* ??0?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
6905 DEFINE_THISCALL_WRAPPER(num_put_char_ctor_locinfo, 12)
6906 num_put* __thiscall num_put_char_ctor_locinfo(num_put *this, const _Locinfo *locinfo, MSVCP_size_t refs)
6908 TRACE("(%p %p %ld)\n", this, locinfo, refs);
6910 locale_facet_ctor_refs(&this->facet, refs);
6911 this->facet.vtable = &MSVCP_num_put_char_vtable;
6913 num_put_char__Init(this, locinfo);
6914 return this;
6917 /* ??0?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAE@I@Z */
6918 /* ??0?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAA@_K@Z */
6919 DEFINE_THISCALL_WRAPPER(num_put_char_ctor_refs, 8)
6920 num_put* __thiscall num_put_char_ctor_refs(num_put *this, MSVCP_size_t refs)
6922 _Locinfo locinfo;
6924 TRACE("(%p %lu)\n", this, refs);
6926 _Locinfo_ctor(&locinfo);
6927 num_put_char_ctor_locinfo(this, &locinfo, refs);
6928 _Locinfo_dtor(&locinfo);
6929 return this;
6932 /* ??_F?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAEXXZ */
6933 /* ??_F?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAAXXZ */
6934 DEFINE_THISCALL_WRAPPER(num_put_char_ctor, 4)
6935 num_put* __thiscall num_put_char_ctor(num_put *this)
6937 return num_put_char_ctor_refs(this, 0);
6940 /* ??1?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MAE@XZ */
6941 /* ??1?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MEAA@XZ */
6942 DEFINE_THISCALL_WRAPPER(num_put_char_dtor, 4)
6943 void __thiscall num_put_char_dtor(num_put *this)
6945 TRACE("(%p)\n", this);
6946 locale_facet_dtor(&this->facet);
6949 DEFINE_THISCALL_WRAPPER(num_put_char_vector_dtor, 8)
6950 num_put* __thiscall num_put_char_vector_dtor(num_put *this, unsigned int flags)
6952 TRACE("(%p %x)\n", this, flags);
6953 if(flags & 2) {
6954 /* we have an array, with the number of elements stored before the first object */
6955 INT_PTR i, *ptr = (INT_PTR *)this-1;
6957 for(i=*ptr-1; i>=0; i--)
6958 num_put_char_dtor(this+i);
6959 MSVCRT_operator_delete(ptr);
6960 } else {
6961 num_put_char_dtor(this);
6962 if(flags & 1)
6963 MSVCRT_operator_delete(this);
6966 return this;
6969 /* ?_Getcat@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
6970 /* ?_Getcat@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
6971 MSVCP_size_t __cdecl num_put_char__Getcat(const locale_facet **facet, const locale *loc)
6973 TRACE("(%p %p)\n", facet, loc);
6975 if(facet && !*facet) {
6976 _Locinfo locinfo;
6978 *facet = MSVCRT_operator_new(sizeof(num_put));
6979 if(!*facet) {
6980 ERR("Out of memory\n");
6981 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
6982 return 0;
6985 _Locinfo_ctor_cstr(&locinfo, locale_string_char_c_str(&loc->ptr->name));
6986 num_put_char_ctor_locinfo((num_put*)*facet, &locinfo, 0);
6987 _Locinfo_dtor(&locinfo);
6990 return LC_NUMERIC;
6993 /* ?_Getcat@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SAIPAPBVfacet@locale@2@@Z */
6994 /* ?_Getcat@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@@Z */
6995 MSVCP_size_t __cdecl num_put_char__Getcat_old(const locale_facet **facet)
6997 return num_put_char__Getcat(facet, locale_classic());
7000 num_put* num_put_char_use_facet(const locale *loc)
7002 static num_put *obj = NULL;
7004 _Lockit lock;
7005 const locale_facet *fac;
7007 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
7008 fac = locale__Getfacet(loc, locale_id_operator_size_t(&num_put_char_id));
7009 if(fac) {
7010 _Lockit_dtor(&lock);
7011 return (num_put*)fac;
7014 if(obj) {
7015 _Lockit_dtor(&lock);
7016 return obj;
7019 num_put_char__Getcat(&fac, loc);
7020 obj = (num_put*)fac;
7021 call_locale_facet__Incref(&obj->facet);
7022 locale_facet_register(&obj->facet);
7023 _Lockit_dtor(&lock);
7025 return obj;
7028 /* ?_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 */
7029 /* ?_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 */
7030 ostreambuf_iterator_char* __cdecl num_put_char__Put(const num_put *this, ostreambuf_iterator_char *ret,
7031 ostreambuf_iterator_char dest, const char *ptr, MSVCP_size_t count)
7033 TRACE("(%p %p %p %ld)\n", this, ret, ptr, count);
7035 for(; count>0; count--)
7036 ostreambuf_iterator_char_put(&dest, *ptr++);
7038 *ret = dest;
7039 return ret;
7042 /* ?_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 */
7043 /* ?_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 */
7044 ostreambuf_iterator_char* __cdecl num_put_char__Putc(const num_put *this, ostreambuf_iterator_char *ret,
7045 ostreambuf_iterator_char dest, const char *ptr, MSVCP_size_t count)
7047 TRACE("(%p %p %p %ld)\n", this, ret, ptr, count);
7049 for(; count>0; count--)
7050 ostreambuf_iterator_char_put(&dest, *ptr++);
7052 *ret = dest;
7053 return ret;
7056 /* ?_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 */
7057 /* ?_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 */
7058 ostreambuf_iterator_char* __cdecl num_put_char__Putgrouped(const num_put *this, ostreambuf_iterator_char *ret,
7059 ostreambuf_iterator_char dest, const char *ptr, MSVCP_size_t count, char delim)
7061 FIXME("(%p %p %p %ld %d) stub\n", this, ret, ptr, count, delim);
7062 return NULL;
7065 /* ?_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 */
7066 /* ?_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 */
7067 ostreambuf_iterator_char* __cdecl num_put_char__Rep(const num_put *this, ostreambuf_iterator_char *ret,
7068 ostreambuf_iterator_char dest, char c, MSVCP_size_t count)
7070 TRACE("(%p %p %d %ld)\n", this, ret, c, count);
7072 for(; count>0; count--)
7073 ostreambuf_iterator_char_put(&dest, c);
7075 *ret = dest;
7076 return ret;
7079 /* ?_Ffmt@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@ABAPADPADDH@Z */
7080 /* ?_Ffmt@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@AEBAPEADPEADDH@Z */
7081 char* __cdecl num_put_char__Ffmt(const num_put *this, char *fmt, char spec, int fmtfl)
7083 int type = fmtfl & FMTFLAG_floatfield;
7084 char *p = fmt;
7086 TRACE("(%p %p %d %d)\n", this, fmt, spec, fmtfl);
7088 *p++ = '%';
7089 if(fmtfl & FMTFLAG_showpos)
7090 *p++ = '+';
7091 if(fmtfl & FMTFLAG_showbase)
7092 *p++ = '#';
7093 *p++ = '.';
7094 *p++ = '*';
7095 if(spec)
7096 *p++ = spec;
7098 if(type == FMTFLAG_fixed)
7099 *p++ = 'f';
7100 else if(type == FMTFLAG_scientific)
7101 *p++ = (fmtfl & FMTFLAG_uppercase) ? 'E' : 'e';
7102 else if(type == (FMTFLAG_fixed|FMTFLAG_scientific))
7103 *p++ = (fmtfl & FMTFLAG_uppercase) ? 'A' : 'a';
7104 else
7105 *p++ = (fmtfl & FMTFLAG_uppercase) ? 'G' : 'g';
7107 *p++ = '\0';
7108 return fmt;
7111 /* ?_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 */
7112 /* ?_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 */
7113 ostreambuf_iterator_char* __cdecl num_put_char__Fput(const num_put *this, ostreambuf_iterator_char *ret,
7114 ostreambuf_iterator_char dest, ios_base *base, char fill, const char *buf, MSVCP_size_t bef_point,
7115 MSVCP_size_t aft_point, MSVCP_size_t trailing, MSVCP_size_t count)
7117 FIXME("(%p %p %p %d %p %ld %ld %ld %ld) stub\n", this, ret, base,
7118 fill, buf, bef_point, aft_point, trailing, count);
7119 return NULL;
7122 /* TODO: This function should be removed when num_put_char__Fput is implemented */
7123 static ostreambuf_iterator_char* num_put_char_fput(const num_put *this, ostreambuf_iterator_char *ret,
7124 ostreambuf_iterator_char dest, ios_base *base, char fill, char *buf, MSVCP_size_t count)
7126 numpunct_char *numpunct = numpunct_char_use_facet(base->loc);
7127 basic_string_char grouping_bstr;
7128 const char *grouping;
7129 char *p, sep = *localeconv()->decimal_point;
7130 int cur_group = 0, group_size = 0;
7131 int adjustfield = base->fmtfl & FMTFLAG_adjustfield;
7132 MSVCP_size_t pad;
7134 TRACE("(%p %p %p %d %s %ld)\n", this, ret, base, fill, buf, count);
7136 /* Change decimal point */
7137 for(p=buf; p<buf+count; p++) {
7138 if(*p == sep) {
7139 *p = numpunct_char_decimal_point(numpunct);
7140 break;
7143 p--;
7145 /* Add separators to number */
7146 numpunct_char_grouping(numpunct, &grouping_bstr);
7147 grouping = MSVCP_basic_string_char_c_str(&grouping_bstr);
7148 sep = grouping[0] ? numpunct_char_thousands_sep(numpunct) : '\0';
7150 for(; p>buf && sep && grouping[cur_group]!=CHAR_MAX; p--) {
7151 group_size++;
7152 if(group_size == grouping[cur_group]) {
7153 group_size = 0;
7154 if(grouping[cur_group+1])
7155 cur_group++;
7157 memmove(p+1, p, buf+count-p);
7158 *p = sep;
7159 count++;
7162 MSVCP_basic_string_char_dtor(&grouping_bstr);
7164 /* Display number with padding */
7165 if(count >= base->wide)
7166 pad = 0;
7167 else
7168 pad = base->wide-count;
7169 base->wide = 0;
7171 if((adjustfield & FMTFLAG_internal) && (buf[0]=='-' || buf[0]=='+')) {
7172 num_put_char__Putc(this, &dest, dest, buf, 1);
7173 buf++;
7175 if(adjustfield != FMTFLAG_left) {
7176 num_put_char__Rep(this, ret, dest, fill, pad);
7177 pad = 0;
7179 num_put_char__Putc(this, &dest, dest, buf, count);
7180 return num_put_char__Rep(this, ret, dest, fill, pad);
7183 /* ?_Ifmt@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@ABAPADPADPBDH@Z */
7184 /* ?_Ifmt@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@AEBAPEADPEADPEBDH@Z */
7185 char* __cdecl num_put_char__Ifmt(const num_put *this, char *fmt, const char *spec, int fmtfl)
7187 int base = fmtfl & FMTFLAG_basefield;
7188 char *p = fmt;
7190 TRACE("(%p %p %p %d)\n", this, fmt, spec, fmtfl);
7192 *p++ = '%';
7193 if(fmtfl & FMTFLAG_showpos)
7194 *p++ = '+';
7195 if(fmtfl & FMTFLAG_showbase)
7196 *p++ = '#';
7198 *p++ = *spec++;
7199 if(*spec == 'l')
7200 *p++ = *spec++;
7202 if(base == FMTFLAG_oct)
7203 *p++ = 'o';
7204 else if(base == FMTFLAG_hex)
7205 *p++ = (fmtfl & FMTFLAG_uppercase) ? 'X' : 'x';
7206 else
7207 *p++ = *spec;
7209 *p++ = '\0';
7210 return fmt;
7213 /* ?_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 */
7214 /* ?_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 */
7215 ostreambuf_iterator_char* __cdecl num_put_char__Iput(const num_put *this, ostreambuf_iterator_char *ret,
7216 ostreambuf_iterator_char dest, ios_base *base, char fill, char *buf, MSVCP_size_t count)
7218 numpunct_char *numpunct = numpunct_char_use_facet(base->loc);
7219 basic_string_char grouping_bstr;
7220 const char *grouping;
7221 char *p, sep;
7222 int cur_group = 0, group_size = 0;
7223 int adjustfield = base->fmtfl & FMTFLAG_adjustfield;
7224 MSVCP_size_t pad;
7226 TRACE("(%p %p %p %d %s %ld)\n", this, ret, base, fill, buf, count);
7228 /* Add separators to number */
7229 numpunct_char_grouping(numpunct, &grouping_bstr);
7230 grouping = MSVCP_basic_string_char_c_str(&grouping_bstr);
7231 sep = grouping[0] ? numpunct_char_thousands_sep(numpunct) : '\0';
7233 for(p=buf+count-1; p>buf && sep && grouping[cur_group]!=CHAR_MAX; p--) {
7234 group_size++;
7235 if(group_size == grouping[cur_group]) {
7236 group_size = 0;
7237 if(grouping[cur_group+1])
7238 cur_group++;
7240 memmove(p+1, p, buf+count-p);
7241 *p = sep;
7242 count++;
7245 MSVCP_basic_string_char_dtor(&grouping_bstr);
7247 /* Display number with padding */
7248 if(count >= base->wide)
7249 pad = 0;
7250 else
7251 pad = base->wide-count;
7252 base->wide = 0;
7254 if((adjustfield & FMTFLAG_internal) && (buf[0]=='-' || buf[0]=='+')) {
7255 num_put_char__Putc(this, &dest, dest, buf, 1);
7256 buf++;
7257 }else if((adjustfield & FMTFLAG_internal) && (buf[1]=='x' || buf[1]=='X')) {
7258 num_put_char__Putc(this, &dest, dest, buf, 2);
7259 buf += 2;
7261 if(adjustfield != FMTFLAG_left) {
7262 num_put_char__Rep(this, ret, dest, fill, pad);
7263 pad = 0;
7265 num_put_char__Putc(this, &dest, dest, buf, count);
7266 return num_put_char__Rep(this, ret, dest, fill, pad);
7269 /* ?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 */
7270 /* ?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 */
7271 #if _MSVCP_VER <= 100
7272 #define call_num_put_char_do_put_long(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 28, ostreambuf_iterator_char*, \
7273 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, LONG), \
7274 (this, ret, dest, base, fill, v))
7275 #else
7276 #define call_num_put_char_do_put_long(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 36, ostreambuf_iterator_char*, \
7277 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, LONG), \
7278 (this, ret, dest, base, fill, v))
7279 #endif
7280 #if _MSVCP_VER != 80
7281 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_long, 28)
7282 #else
7283 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_long, 32)
7284 #endif
7285 ostreambuf_iterator_char* __thiscall num_put_char_do_put_long(const num_put *this, ostreambuf_iterator_char *ret,
7286 ostreambuf_iterator_char dest, ios_base *base, char fill, LONG v)
7288 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
7289 char fmt[7]; /* strlen("%+#lld")+1 */
7291 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
7293 return num_put_char__Iput(this, ret, dest, base, fill, tmp,
7294 sprintf(tmp, num_put_char__Ifmt(this, fmt, "ld", base->fmtfl), v));
7297 /* ?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 */
7298 /* ?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 */
7299 #if _MSVCP_VER != 80
7300 DEFINE_THISCALL_WRAPPER(num_put_char_put_long, 28)
7301 #else
7302 DEFINE_THISCALL_WRAPPER(num_put_char_put_long, 32)
7303 #endif
7304 ostreambuf_iterator_char* __thiscall num_put_char_put_long(const num_put *this, ostreambuf_iterator_char *ret,
7305 ostreambuf_iterator_char dest, ios_base *base, char fill, LONG v)
7307 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
7308 return call_num_put_char_do_put_long(this, ret, dest, base, fill, v);
7311 /* ?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 */
7312 /* ?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 */
7313 #if _MSVCP_VER <= 100
7314 #define call_num_put_char_do_put_ulong(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 24, ostreambuf_iterator_char*, \
7315 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, ULONG), \
7316 (this, ret, dest, base, fill, v))
7317 #else
7318 #define call_num_put_char_do_put_ulong(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 32, ostreambuf_iterator_char*, \
7319 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, ULONG), \
7320 (this, ret, dest, base, fill, v))
7321 #endif
7322 #if _MSVCP_VER != 80
7323 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_ulong, 28)
7324 #else
7325 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_ulong, 32)
7326 #endif
7327 ostreambuf_iterator_char* __thiscall num_put_char_do_put_ulong(const num_put *this, ostreambuf_iterator_char *ret,
7328 ostreambuf_iterator_char dest, ios_base *base, char fill, ULONG v)
7330 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
7331 char fmt[7]; /* strlen("%+#lld")+1 */
7333 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
7335 return num_put_char__Iput(this, ret, dest, base, fill, tmp,
7336 sprintf(tmp, num_put_char__Ifmt(this, fmt, "lu", base->fmtfl), v));
7339 /* ?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 */
7340 /* ?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 */
7341 #if _MSVCP_VER != 80
7342 DEFINE_THISCALL_WRAPPER(num_put_char_put_ulong, 28)
7343 #else
7344 DEFINE_THISCALL_WRAPPER(num_put_char_put_ulong, 32)
7345 #endif
7346 ostreambuf_iterator_char* __thiscall num_put_char_put_ulong(const num_put *this, ostreambuf_iterator_char *ret,
7347 ostreambuf_iterator_char dest, ios_base *base, char fill, ULONG v)
7349 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
7350 return call_num_put_char_do_put_ulong(this, ret, dest, base, fill, v);
7353 static inline unsigned get_precision(const ios_base *base)
7355 streamsize ret = base->prec <= 0 && !(base->fmtfl & FMTFLAG_fixed) ? 6 : base->prec;
7356 if(ret > UINT_MAX)
7357 ret = UINT_MAX;
7358 return ret;
7361 /* ?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 */
7362 /* ?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 */
7363 /* ?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 */
7364 /* ?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 */
7365 #if _MSVCP_VER <= 100
7366 #define call_num_put_char_do_put_double(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 12, ostreambuf_iterator_char*, \
7367 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, double), \
7368 (this, ret, dest, base, fill, v))
7369 #define call_num_put_char_do_put_ldouble(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 8, ostreambuf_iterator_char*, \
7370 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, double), \
7371 (this, ret, dest, base, fill, v))
7372 #else
7373 #define call_num_put_char_do_put_double(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 20, ostreambuf_iterator_char*, \
7374 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, double), \
7375 (this, ret, dest, base, fill, v))
7376 #define call_num_put_char_do_put_ldouble(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 16, ostreambuf_iterator_char*, \
7377 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, double), \
7378 (this, ret, dest, base, fill, v))
7379 #endif
7380 #if _MSVCP_VER != 80
7381 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_double, 32)
7382 #else
7383 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_double, 36)
7384 #endif
7385 ostreambuf_iterator_char* __thiscall num_put_char_do_put_double(const num_put *this, ostreambuf_iterator_char *ret,
7386 ostreambuf_iterator_char dest, ios_base *base, char fill, double v)
7388 char *tmp;
7389 char fmt[8]; /* strlen("%+#.*lg")+1 */
7390 int size;
7391 unsigned prec;
7393 TRACE("(%p %p %p %d %lf)\n", this, ret, base, fill, v);
7395 num_put_char__Ffmt(this, fmt, '\0', base->fmtfl);
7396 prec = get_precision(base);
7397 size = _scprintf(fmt, prec, v);
7399 /* TODO: don't use dynamic allocation */
7400 tmp = MSVCRT_operator_new(size*2);
7401 if(!tmp) {
7402 ERR("Out of memory\n");
7403 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7405 num_put_char_fput(this, ret, dest, base, fill, tmp, sprintf(tmp, fmt, prec, v));
7406 MSVCRT_operator_delete(tmp);
7407 return ret;
7410 /* ?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 */
7411 /* ?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 */
7412 #if _MSVCP_VER != 80
7413 DEFINE_THISCALL_WRAPPER(num_put_char_put_double, 32)
7414 #else
7415 DEFINE_THISCALL_WRAPPER(num_put_char_put_double, 36)
7416 #endif
7417 ostreambuf_iterator_char* __thiscall num_put_char_put_double(const num_put *this, ostreambuf_iterator_char *ret,
7418 ostreambuf_iterator_char dest, ios_base *base, char fill, double v)
7420 TRACE("(%p %p %p %d %lf)\n", this, ret, base, fill, v);
7421 return call_num_put_char_do_put_double(this, ret, dest, base, fill, v);
7424 /* ?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 */
7425 /* ?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 */
7426 #if _MSVCP_VER != 80
7427 DEFINE_THISCALL_WRAPPER(num_put_char_put_ldouble, 32)
7428 #else
7429 DEFINE_THISCALL_WRAPPER(num_put_char_put_ldouble, 36)
7430 #endif
7431 ostreambuf_iterator_char* __thiscall num_put_char_put_ldouble(const num_put *this, ostreambuf_iterator_char *ret,
7432 ostreambuf_iterator_char dest, ios_base *base, char fill, double v)
7434 TRACE("(%p %p %p %d %lf)\n", this, ret, base, fill, v);
7435 return call_num_put_char_do_put_ldouble(this, ret, dest, base, fill, v);
7438 /* ?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 */
7439 /* ?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 */
7440 #if _MSVCP_VER <= 100
7441 #define call_num_put_char_do_put_ptr(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 4, ostreambuf_iterator_char*, \
7442 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, const void*), \
7443 (this, ret, dest, base, fill, v))
7444 #else
7445 #define call_num_put_char_do_put_ptr(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 12, ostreambuf_iterator_char*, \
7446 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, const void*), \
7447 (this, ret, dest, base, fill, v))
7448 #endif
7449 #if _MSVCP_VER != 80
7450 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_ptr, 28)
7451 #else
7452 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_ptr, 32)
7453 #endif
7454 ostreambuf_iterator_char* __thiscall num_put_char_do_put_ptr(const num_put *this, ostreambuf_iterator_char *ret,
7455 ostreambuf_iterator_char dest, ios_base *base, char fill, const void *v)
7457 char tmp[17]; /* 8(16^8==2^64)*2(separators beetwen every digit) + 1 */
7459 TRACE("(%p %p %p %d %p)\n", this, ret, base, fill, v);
7461 return num_put_char__Iput(this, ret, dest, base, fill, tmp, sprintf(tmp, "%p", v));
7464 /* ?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 */
7465 /* ?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 */
7466 #if _MSVCP_VER != 80
7467 DEFINE_THISCALL_WRAPPER(num_put_char_put_ptr, 28)
7468 #else
7469 DEFINE_THISCALL_WRAPPER(num_put_char_put_ptr, 32)
7470 #endif
7471 ostreambuf_iterator_char* __thiscall num_put_char_put_ptr(const num_put *this, ostreambuf_iterator_char *ret,
7472 ostreambuf_iterator_char dest, ios_base *base, char fill, const void *v)
7474 TRACE("(%p %p %p %d %p)\n", this, ret, base, fill, v);
7475 return call_num_put_char_do_put_ptr(this, ret, dest, base, fill, v);
7478 /* ?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 */
7479 /* ?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 */
7480 #if _MSVCP_VER <= 100
7481 #define call_num_put_char_do_put_int64(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 20, ostreambuf_iterator_char*, \
7482 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, __int64), \
7483 (this, ret, dest, base, fill, v))
7484 #else
7485 #define call_num_put_char_do_put_int64(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 28, ostreambuf_iterator_char*, \
7486 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, __int64), \
7487 (this, ret, dest, base, fill, v))
7488 #endif
7489 #if _MSVCP_VER != 80
7490 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_int64, 32)
7491 #else
7492 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_int64, 36)
7493 #endif
7494 ostreambuf_iterator_char* __thiscall num_put_char_do_put_int64(const num_put *this, ostreambuf_iterator_char *ret,
7495 ostreambuf_iterator_char dest, ios_base *base, char fill, __int64 v)
7497 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
7498 char fmt[7]; /* strlen("%+#lld")+1 */
7500 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
7502 return num_put_char__Iput(this, ret, dest, base, fill, tmp,
7503 sprintf(tmp, num_put_char__Ifmt(this, fmt, "lld", base->fmtfl), v));
7506 /* ?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 */
7507 /* ?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 */
7508 #if _MSVCP_VER != 80
7509 DEFINE_THISCALL_WRAPPER(num_put_char_put_int64, 32)
7510 #else
7511 DEFINE_THISCALL_WRAPPER(num_put_char_put_int64, 36)
7512 #endif
7513 ostreambuf_iterator_char* __thiscall num_put_char_put_int64(const num_put *this, ostreambuf_iterator_char *ret,
7514 ostreambuf_iterator_char dest, ios_base *base, char fill, __int64 v)
7516 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
7517 return call_num_put_char_do_put_int64(this, ret, dest, base, fill, v);
7520 /* ?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 */
7521 /* ?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 */
7522 #if _MSVCP_VER <= 100
7523 #define call_num_put_char_do_put_uint64(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 16, ostreambuf_iterator_char*, \
7524 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, unsigned __int64), \
7525 (this, ret, dest, base, fill, v))
7526 #else
7527 #define call_num_put_char_do_put_uint64(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 24, ostreambuf_iterator_char*, \
7528 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, unsigned __int64), \
7529 (this, ret, dest, base, fill, v))
7530 #endif
7531 #if _MSVCP_VER != 80
7532 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_uint64, 32)
7533 #else
7534 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_uint64, 36)
7535 #endif
7536 ostreambuf_iterator_char* __thiscall num_put_char_do_put_uint64(const num_put *this, ostreambuf_iterator_char *ret,
7537 ostreambuf_iterator_char dest, ios_base *base, char fill, unsigned __int64 v)
7539 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
7540 char fmt[7]; /* strlen("%+#lld")+1 */
7542 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
7544 return num_put_char__Iput(this, ret, dest, base, fill, tmp,
7545 sprintf(tmp, num_put_char__Ifmt(this, fmt, "llu", base->fmtfl), v));
7548 /* ?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 */
7549 /* ?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 */
7550 #if _MSVCP_VER != 80
7551 DEFINE_THISCALL_WRAPPER(num_put_char_put_uint64, 32)
7552 #else
7553 DEFINE_THISCALL_WRAPPER(num_put_char_put_uint64, 36)
7554 #endif
7555 ostreambuf_iterator_char* __thiscall num_put_char_put_uint64(const num_put *this, ostreambuf_iterator_char *ret,
7556 ostreambuf_iterator_char dest, ios_base *base, char fill, unsigned __int64 v)
7558 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
7559 return call_num_put_char_do_put_uint64(this, ret, dest, base, fill, v);
7562 /* ?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 */
7563 /* ?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 */
7564 #if _MSVCP_VER <= 100
7565 #define call_num_put_char_do_put_bool(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 32, ostreambuf_iterator_char*, \
7566 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, MSVCP_bool), \
7567 (this, ret, dest, base, fill, v))
7568 #else
7569 #define call_num_put_char_do_put_bool(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 40, ostreambuf_iterator_char*, \
7570 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, MSVCP_bool), \
7571 (this, ret, dest, base, fill, v))
7572 #endif
7573 #if _MSVCP_VER != 80
7574 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_bool, 28)
7575 #else
7576 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_bool, 32)
7577 #endif
7578 ostreambuf_iterator_char* __thiscall num_put_char_do_put_bool(const num_put *this, ostreambuf_iterator_char *ret,
7579 ostreambuf_iterator_char dest, ios_base *base, char fill, MSVCP_bool v)
7581 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
7583 if(base->fmtfl & FMTFLAG_boolalpha) {
7584 numpunct_char *numpunct = numpunct_char_use_facet(base->loc);
7585 basic_string_char str;
7586 MSVCP_size_t pad, len;
7588 if(v)
7589 numpunct_char_truename(numpunct, &str);
7590 else
7591 numpunct_char_falsename(numpunct, &str);
7593 len = MSVCP_basic_string_char_length(&str);
7594 pad = (len>base->wide ? 0 : base->wide-len);
7595 base->wide = 0;
7597 if((base->fmtfl & FMTFLAG_adjustfield) != FMTFLAG_left) {
7598 num_put_char__Rep(this, &dest, dest, fill, pad);
7599 pad = 0;
7601 num_put_char__Putc(this, &dest, dest, MSVCP_basic_string_char_c_str(&str), len);
7602 MSVCP_basic_string_char_dtor(&str);
7603 return num_put_char__Rep(this, ret, dest, fill, pad);
7606 return num_put_char_put_long(this, ret, dest, base, fill, v);
7609 /* ?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 */
7610 /* ?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 */
7611 #if _MSVCP_VER != 80
7612 DEFINE_THISCALL_WRAPPER(num_put_char_put_bool, 28)
7613 #else
7614 DEFINE_THISCALL_WRAPPER(num_put_char_put_bool, 32)
7615 #endif
7616 ostreambuf_iterator_char* __thiscall num_put_char_put_bool(const num_put *this, ostreambuf_iterator_char *ret,
7617 ostreambuf_iterator_char dest, ios_base *base, char fill, MSVCP_bool v)
7619 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
7620 return call_num_put_char_do_put_bool(this, ret, dest, base, fill, v);
7623 /* ?id@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@2V0locale@2@A */
7624 locale_id num_put_wchar_id = {0};
7625 /* ?id@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@2V0locale@2@A */
7626 locale_id num_put_short_id = {0};
7628 /* num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@6B@ */
7629 extern const vtable_ptr MSVCP_num_put_wchar_vtable;
7630 /* num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@6B@ */
7631 extern const vtable_ptr MSVCP_num_put_short_vtable;
7633 /* ?_Init@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@IAEXABV_Locinfo@2@@Z */
7634 /* ?_Init@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@IEAAXAEBV_Locinfo@2@@Z */
7635 DEFINE_THISCALL_WRAPPER(num_put_wchar__Init, 8)
7636 void __thiscall num_put_wchar__Init(num_put *this, const _Locinfo *locinfo)
7638 TRACE("(%p %p)\n", this, locinfo);
7639 _Locinfo__Getcvt(locinfo, &this->cvt);
7642 /* ??0?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
7643 /* ??0?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
7644 DEFINE_THISCALL_WRAPPER(num_put_wchar_ctor_locinfo, 12)
7645 num_put* __thiscall num_put_wchar_ctor_locinfo(num_put *this, const _Locinfo *locinfo, MSVCP_size_t refs)
7647 TRACE("(%p %p %ld)\n", this, locinfo, refs);
7649 locale_facet_ctor_refs(&this->facet, refs);
7650 this->facet.vtable = &MSVCP_num_put_wchar_vtable;
7652 num_put_wchar__Init(this, locinfo);
7653 return this;
7656 /* ??0?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
7657 /* ??0?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
7658 DEFINE_THISCALL_WRAPPER(num_put_short_ctor_locinfo, 12)
7659 num_put* __thiscall num_put_short_ctor_locinfo(num_put *this, const _Locinfo *locinfo, MSVCP_size_t refs)
7661 num_put_wchar_ctor_locinfo(this, locinfo, refs);
7662 this->facet.vtable = &MSVCP_num_put_short_vtable;
7663 return this;
7666 /* ??0?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAE@I@Z */
7667 /* ??0?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAA@_K@Z */
7668 DEFINE_THISCALL_WRAPPER(num_put_wchar_ctor_refs, 8)
7669 num_put* __thiscall num_put_wchar_ctor_refs(num_put *this, MSVCP_size_t refs)
7671 _Locinfo locinfo;
7673 TRACE("(%p %lu)\n", this, refs);
7675 _Locinfo_ctor(&locinfo);
7676 num_put_wchar_ctor_locinfo(this, &locinfo, refs);
7677 _Locinfo_dtor(&locinfo);
7678 return this;
7681 /* ??0?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAE@I@Z */
7682 /* ??0?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEAA@_K@Z */
7683 DEFINE_THISCALL_WRAPPER(num_put_short_ctor_refs, 8)
7684 num_put* __thiscall num_put_short_ctor_refs(num_put *this, MSVCP_size_t refs)
7686 num_put_wchar_ctor_refs(this, refs);
7687 this->facet.vtable = &MSVCP_num_put_short_vtable;
7688 return this;
7691 /* ??_F?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAEXXZ */
7692 /* ??_F?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAAXXZ */
7693 DEFINE_THISCALL_WRAPPER(num_put_wchar_ctor, 4)
7694 num_put* __thiscall num_put_wchar_ctor(num_put *this)
7696 return num_put_wchar_ctor_refs(this, 0);
7699 /* ??_F?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAEXXZ */
7700 /* ??_F?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEAAXXZ */
7701 DEFINE_THISCALL_WRAPPER(num_put_short_ctor, 4)
7702 num_put* __thiscall num_put_short_ctor(num_put *this)
7704 return num_put_short_ctor_refs(this, 0);
7707 /* ??1?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MAE@XZ */
7708 /* ??1?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MEAA@XZ */
7709 /* ??1?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MAE@XZ */
7710 /* ??1?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MEAA@XZ */
7711 DEFINE_THISCALL_WRAPPER(num_put_wchar_dtor, 4)
7712 void __thiscall num_put_wchar_dtor(num_put *this)
7714 TRACE("(%p)\n", this);
7715 locale_facet_dtor(&this->facet);
7718 DEFINE_THISCALL_WRAPPER(num_put_wchar_vector_dtor, 8)
7719 num_put* __thiscall num_put_wchar_vector_dtor(num_put *this, unsigned int flags)
7721 TRACE("(%p %x)\n", this, flags);
7722 if(flags & 2) {
7723 /* we have an array, with the number of elements stored before the first object */
7724 INT_PTR i, *ptr = (INT_PTR *)this-1;
7726 for(i=*ptr-1; i>=0; i--)
7727 num_put_wchar_dtor(this+i);
7728 MSVCRT_operator_delete(ptr);
7729 } else {
7730 num_put_wchar_dtor(this);
7731 if(flags & 1)
7732 MSVCRT_operator_delete(this);
7735 return this;
7738 /* ?_Getcat@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
7739 /* ?_Getcat@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
7740 MSVCP_size_t __cdecl num_put_wchar__Getcat(const locale_facet **facet, const locale *loc)
7742 TRACE("(%p %p)\n", facet, loc);
7744 if(facet && !*facet) {
7745 _Locinfo locinfo;
7747 *facet = MSVCRT_operator_new(sizeof(num_put));
7748 if(!*facet) {
7749 ERR("Out of memory\n");
7750 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7751 return 0;
7754 _Locinfo_ctor_cstr(&locinfo, locale_string_char_c_str(&loc->ptr->name));
7755 num_put_wchar_ctor_locinfo((num_put*)*facet, &locinfo, 0);
7756 _Locinfo_dtor(&locinfo);
7759 return LC_NUMERIC;
7762 /* ?_Getcat@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SAIPAPBVfacet@locale@2@@Z */
7763 /* ?_Getcat@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@@Z */
7764 MSVCP_size_t __cdecl num_put_wchar__Getcat_old(const locale_facet **facet)
7766 return num_put_wchar__Getcat(facet, locale_classic());
7769 /* ?_Getcat@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
7770 /* ?_Getcat@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
7771 MSVCP_size_t __cdecl num_put_short__Getcat(const locale_facet **facet, const locale *loc)
7773 TRACE("(%p %p)\n", facet, loc);
7775 if(facet && !*facet) {
7776 _Locinfo locinfo;
7778 *facet = MSVCRT_operator_new(sizeof(num_put));
7779 if(!*facet) {
7780 ERR("Out of memory\n");
7781 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7782 return 0;
7785 _Locinfo_ctor_cstr(&locinfo, locale_string_char_c_str(&loc->ptr->name));
7786 num_put_short_ctor_locinfo((num_put*)*facet, &locinfo, 0);
7787 _Locinfo_dtor(&locinfo);
7790 return LC_NUMERIC;
7793 /* ?_Getcat@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SAIPAPBVfacet@locale@2@@Z */
7794 /* ?_Getcat@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@@Z */
7795 MSVCP_size_t __cdecl num_put_short__Getcat_old(const locale_facet **facet)
7797 return num_put_short__Getcat(facet, locale_classic());
7800 num_put* num_put_wchar_use_facet(const locale *loc)
7802 static num_put *obj = NULL;
7804 _Lockit lock;
7805 const locale_facet *fac;
7807 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
7808 fac = locale__Getfacet(loc, locale_id_operator_size_t(&num_put_wchar_id));
7809 if(fac) {
7810 _Lockit_dtor(&lock);
7811 return (num_put*)fac;
7814 if(obj) {
7815 _Lockit_dtor(&lock);
7816 return obj;
7819 num_put_wchar__Getcat(&fac, loc);
7820 obj = (num_put*)fac;
7821 call_locale_facet__Incref(&obj->facet);
7822 locale_facet_register(&obj->facet);
7823 _Lockit_dtor(&lock);
7825 return obj;
7828 num_put* num_put_short_use_facet(const locale *loc)
7830 static num_put *obj = NULL;
7832 _Lockit lock;
7833 const locale_facet *fac;
7835 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
7836 fac = locale__Getfacet(loc, locale_id_operator_size_t(&num_put_short_id));
7837 if(fac) {
7838 _Lockit_dtor(&lock);
7839 return (num_put*)fac;
7842 if(obj) {
7843 _Lockit_dtor(&lock);
7844 return obj;
7847 num_put_short__Getcat(&fac, loc);
7848 obj = (num_put*)fac;
7849 call_locale_facet__Incref(&obj->facet);
7850 locale_facet_register(&obj->facet);
7851 _Lockit_dtor(&lock);
7853 return obj;
7856 /* ?_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 */
7857 /* ?_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 */
7858 /* ?_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 */
7859 /* ?_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 */
7860 ostreambuf_iterator_wchar* __cdecl num_put_wchar__Put(const num_put *this, ostreambuf_iterator_wchar *ret,
7861 ostreambuf_iterator_wchar dest, const wchar_t *ptr, MSVCP_size_t count)
7863 TRACE("(%p %p %s %ld)\n", this, ret, debugstr_wn(ptr, count), count);
7865 for(; count>0; count--)
7866 ostreambuf_iterator_wchar_put(&dest, *ptr++);
7868 *ret = dest;
7869 return ret;
7872 /* ?_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 */
7873 /* ?_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 */
7874 /* ?_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 */
7875 /* ?_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 */
7876 ostreambuf_iterator_wchar* __cdecl num_put_wchar__Putc(const num_put *this, ostreambuf_iterator_wchar *ret,
7877 ostreambuf_iterator_wchar dest, const char *ptr, MSVCP_size_t count)
7879 int state = 0;
7880 wchar_t ch;
7882 TRACE("(%p %p %s %ld)\n", this, ret, debugstr_an(ptr, count), count);
7884 for(; count>0; count--) {
7885 if(_Mbrtowc(&ch, ptr++, 1, &state, &this->cvt) == 1)
7886 ostreambuf_iterator_wchar_put(&dest, ch);
7889 *ret = dest;
7890 return ret;
7893 /* ?_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 */
7894 /* ?_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 */
7895 /* ?_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 */
7896 /* ?_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 */
7897 ostreambuf_iterator_wchar* __cdecl num_put_wchar__Putgrouped(const num_put *this, ostreambuf_iterator_wchar *ret,
7898 ostreambuf_iterator_wchar dest, const char *ptr, MSVCP_size_t count, wchar_t delim)
7900 FIXME("(%p %p %p %ld %d) stub\n", this, ret, ptr, count, delim);
7901 return NULL;
7904 /* ?_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 */
7905 /* ?_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 */
7906 /* ?_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 */
7907 /* ?_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 */
7908 ostreambuf_iterator_wchar* __cdecl num_put_wchar__Rep(const num_put *this, ostreambuf_iterator_wchar *ret,
7909 ostreambuf_iterator_wchar dest, wchar_t c, MSVCP_size_t count)
7911 TRACE("(%p %p %d %ld)\n", this, ret, c, count);
7913 for(; count>0; count--)
7914 ostreambuf_iterator_wchar_put(&dest, c);
7916 *ret = dest;
7917 return ret;
7920 /* ?_Ffmt@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@ABAPADPADDH@Z */
7921 /* ?_Ffmt@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@AEBAPEADPEADDH@Z */
7922 /* ?_Ffmt@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@ABAPADPADDH@Z */
7923 /* ?_Ffmt@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@AEBAPEADPEADDH@Z */
7924 char* __cdecl num_put_wchar__Ffmt(const num_put *this, char *fmt, char spec, int fmtfl)
7926 int type = fmtfl & FMTFLAG_floatfield;
7927 char *p = fmt;
7929 TRACE("(%p %p %d %d)\n", this, fmt, spec, fmtfl);
7931 *p++ = '%';
7932 if(fmtfl & FMTFLAG_showpos)
7933 *p++ = '+';
7934 if(fmtfl & FMTFLAG_showbase)
7935 *p++ = '#';
7936 *p++ = '.';
7937 *p++ = '*';
7938 if(spec)
7939 *p++ = spec;
7941 if(type == FMTFLAG_fixed)
7942 *p++ = 'f';
7943 else if(type == FMTFLAG_scientific)
7944 *p++ = (fmtfl & FMTFLAG_uppercase) ? 'E' : 'e';
7945 else if(type == (FMTFLAG_fixed|FMTFLAG_scientific))
7946 *p++ = (fmtfl & FMTFLAG_uppercase) ? 'A' : 'a';
7947 else
7948 *p++ = (fmtfl & FMTFLAG_uppercase) ? 'G' : 'g';
7950 *p++ = '\0';
7951 return fmt;
7954 /* ?_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 */
7955 /* ?_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 */
7956 ostreambuf_iterator_wchar* __cdecl num_put_wchar__Fput(const num_put *this, ostreambuf_iterator_wchar *ret,
7957 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, const char *buf, MSVCP_size_t bef_point,
7958 MSVCP_size_t aft_point, MSVCP_size_t trailing, MSVCP_size_t count)
7960 FIXME("(%p %p %p %d %p %ld %ld %ld %ld) stub\n", this, ret, base,
7961 fill, buf, bef_point, aft_point, trailing, count);
7962 return NULL;
7965 /* ?_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 */
7966 /* ?_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 */
7967 ostreambuf_iterator_wchar* __cdecl num_put_short__Fput(const num_put *this, ostreambuf_iterator_wchar *ret,
7968 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, const char *buf, MSVCP_size_t bef_point,
7969 MSVCP_size_t aft_point, MSVCP_size_t trailing, MSVCP_size_t count)
7971 FIXME("(%p %p %p %d %p %ld %ld %ld %ld) stub\n", this, ret, base,
7972 fill, buf, bef_point, aft_point, trailing, count);
7973 return NULL;
7976 /* TODO: This function should be removed when num_put_wchar__Fput is implemented */
7977 static ostreambuf_iterator_wchar* num_put__fput(const num_put *this, ostreambuf_iterator_wchar *ret,
7978 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, char *buf,
7979 MSVCP_size_t count, numpunct_wchar *numpunct)
7981 basic_string_char grouping_bstr;
7982 const char *grouping;
7983 char *p, dec_point = *localeconv()->decimal_point;
7984 wchar_t sep;
7985 int cur_group = 0, group_size = 0;
7986 int adjustfield = base->fmtfl & FMTFLAG_adjustfield;
7987 MSVCP_size_t i, pad;
7989 TRACE("(%p %p %p %d %s %ld)\n", this, ret, base, fill, buf, count);
7991 for(p=buf; p<buf+count; p++) {
7992 if(*p == dec_point)
7993 break;
7995 p--;
7997 /* Add separators to number */
7998 numpunct_wchar_grouping(numpunct, &grouping_bstr);
7999 grouping = MSVCP_basic_string_char_c_str(&grouping_bstr);
8000 sep = grouping[0] ? numpunct_wchar_thousands_sep(numpunct) : '\0';
8002 for(; p>buf && sep && grouping[cur_group]!=CHAR_MAX; p--) {
8003 group_size++;
8004 if(group_size == grouping[cur_group]) {
8005 group_size = 0;
8006 if(grouping[cur_group+1])
8007 cur_group++;
8009 memmove(p+1, p, buf+count-p);
8010 *p = '\0'; /* mark thousands separator positions */
8011 count++;
8014 MSVCP_basic_string_char_dtor(&grouping_bstr);
8016 /* Display number with padding */
8017 if(count >= base->wide)
8018 pad = 0;
8019 else
8020 pad = base->wide-count;
8021 base->wide = 0;
8023 if((adjustfield & FMTFLAG_internal) && (buf[0]=='-' || buf[0]=='+')) {
8024 num_put_wchar__Putc(this, &dest, dest, buf, 1);
8025 buf++;
8027 if(adjustfield != FMTFLAG_left) {
8028 num_put_wchar__Rep(this, ret, dest, fill, pad);
8029 pad = 0;
8032 for(i=0; i<count; i++) {
8033 if(buf[i] == dec_point)
8034 num_put_wchar__Rep(this, &dest, dest, numpunct_wchar_decimal_point(numpunct), 1);
8035 else if(!buf[i])
8036 num_put_wchar__Rep(this, &dest, dest, sep, 1);
8037 else
8038 num_put_wchar__Putc(this, &dest, dest, buf+i, 1);
8041 return num_put_wchar__Rep(this, ret, dest, fill, pad);
8044 /* ?_Ifmt@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@ABAPADPADPBDH@Z */
8045 /* ?_Ifmt@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@AEBAPEADPEADPEBDH@Z */
8046 /* ?_Ifmt@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@ABAPADPADPBDH@Z */
8047 /* ?_Ifmt@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@AEBAPEADPEADPEBDH@Z */
8048 char* __cdecl num_put_wchar__Ifmt(const num_put *this, char *fmt, const char *spec, int fmtfl)
8050 int base = fmtfl & FMTFLAG_basefield;
8051 char *p = fmt;
8053 TRACE("(%p %p %p %d)\n", this, fmt, spec, fmtfl);
8055 *p++ = '%';
8056 if(fmtfl & FMTFLAG_showpos)
8057 *p++ = '+';
8058 if(fmtfl & FMTFLAG_showbase)
8059 *p++ = '#';
8061 *p++ = *spec++;
8062 if(*spec == 'l')
8063 *p++ = *spec++;
8065 if(base == FMTFLAG_oct)
8066 *p++ = 'o';
8067 else if(base == FMTFLAG_hex)
8068 *p++ = (fmtfl & FMTFLAG_uppercase) ? 'X' : 'x';
8069 else
8070 *p++ = *spec;
8072 *p++ = '\0';
8073 return fmt;
8076 static ostreambuf_iterator_wchar* num_put__Iput(const num_put *this, ostreambuf_iterator_wchar *ret,
8077 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, char *buf,
8078 MSVCP_size_t count, numpunct_wchar *numpunct)
8080 basic_string_char grouping_bstr;
8081 const char *grouping;
8082 char *p;
8083 wchar_t sep;
8084 int cur_group = 0, group_size = 0;
8085 int adjustfield = base->fmtfl & FMTFLAG_adjustfield;
8086 MSVCP_size_t i, pad;
8088 TRACE("(%p %p %p %d %s %ld)\n", this, ret, base, fill, buf, count);
8090 /* Add separators to number */
8091 numpunct_wchar_grouping(numpunct, &grouping_bstr);
8092 grouping = MSVCP_basic_string_char_c_str(&grouping_bstr);
8093 sep = grouping[0] ? numpunct_wchar_thousands_sep(numpunct) : '\0';
8095 for(p=buf+count-1; p>buf && sep && grouping[cur_group]!=CHAR_MAX; p--) {
8096 group_size++;
8097 if(group_size == grouping[cur_group]) {
8098 group_size = 0;
8099 if(grouping[cur_group+1])
8100 cur_group++;
8102 memmove(p+1, p, buf+count-p);
8103 *p = '\0'; /* mark thousands separator positions */
8104 count++;
8107 MSVCP_basic_string_char_dtor(&grouping_bstr);
8109 /* Display number with padding */
8110 if(count >= base->wide)
8111 pad = 0;
8112 else
8113 pad = base->wide-count;
8114 base->wide = 0;
8116 if((adjustfield & FMTFLAG_internal) && (buf[0]=='-' || buf[0]=='+')) {
8117 num_put_wchar__Putc(this, &dest, dest, buf, 1);
8118 buf++;
8119 }else if((adjustfield & FMTFLAG_internal) && (buf[1]=='x' || buf[1]=='X')) {
8120 num_put_wchar__Putc(this, &dest, dest, buf, 2);
8121 buf += 2;
8123 if(adjustfield != FMTFLAG_left) {
8124 num_put_wchar__Rep(this, ret, dest, fill, pad);
8125 pad = 0;
8128 for(i=0; i<count; i++) {
8129 if(!buf[i])
8130 num_put_wchar__Rep(this, &dest, dest, sep, 1);
8131 else
8132 num_put_wchar__Putc(this, &dest, dest, buf+i, 1);
8135 return num_put_wchar__Rep(this, ret, dest, fill, pad);
8138 /* ?_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 */
8139 /* ?_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 */
8140 ostreambuf_iterator_wchar* __cdecl num_put_wchar__Iput(const num_put *this, ostreambuf_iterator_wchar *ret,
8141 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, char *buf, MSVCP_size_t count)
8143 return num_put__Iput(this, ret, dest, base, fill, buf, count, numpunct_wchar_use_facet(base->loc));
8146 /* ?_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 */
8147 /* ?_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 */
8148 ostreambuf_iterator_wchar* __cdecl num_put_short__Iput(const num_put *this, ostreambuf_iterator_wchar *ret,
8149 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, char *buf, MSVCP_size_t count)
8151 return num_put__Iput(this, ret, dest, base, fill, buf, count, numpunct_short_use_facet(base->loc));
8154 /* ?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 */
8155 /* ?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 */
8156 #if _MSVCP_VER <= 100
8157 #define call_num_put_wchar_do_put_long(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 28, ostreambuf_iterator_wchar*, \
8158 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, LONG), \
8159 (this, ret, dest, base, fill, v))
8160 #else
8161 #define call_num_put_wchar_do_put_long(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 36, ostreambuf_iterator_wchar*, \
8162 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, LONG), \
8163 (this, ret, dest, base, fill, v))
8164 #endif
8165 #if _MSVCP_VER != 80
8166 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_long, 28)
8167 #else
8168 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_long, 32)
8169 #endif
8170 ostreambuf_iterator_wchar* __thiscall num_put_wchar_do_put_long(const num_put *this, ostreambuf_iterator_wchar *ret,
8171 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, LONG v)
8173 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
8174 char fmt[7]; /* strlen("%+#lld")+1 */
8176 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
8178 return num_put_wchar__Iput(this, ret, dest, base, fill, tmp,
8179 sprintf(tmp, num_put_wchar__Ifmt(this, fmt, "ld", base->fmtfl), v));
8182 /* ?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 */
8183 /* ?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 */
8184 #if _MSVCP_VER != 80
8185 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_long, 28)
8186 #else
8187 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_long, 32)
8188 #endif
8189 ostreambuf_iterator_wchar* __thiscall num_put_short_do_put_long(const num_put *this, ostreambuf_iterator_wchar *ret,
8190 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, LONG v)
8192 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
8193 char fmt[7]; /* strlen("%+#lld")+1 */
8195 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
8197 return num_put_short__Iput(this, ret, dest, base, fill, tmp,
8198 sprintf(tmp, num_put_wchar__Ifmt(this, fmt, "ld", base->fmtfl), v));
8201 /* ?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 */
8202 /* ?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 */
8203 /* ?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 */
8204 /* ?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 */
8205 #if _MSVCP_VER != 80
8206 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_long, 28)
8207 #else
8208 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_long, 32)
8209 #endif
8210 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_long(const num_put *this, ostreambuf_iterator_wchar *ret,
8211 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, LONG v)
8213 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
8214 return call_num_put_wchar_do_put_long(this, ret, dest, base, fill, v);
8217 /* ?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 */
8218 /* ?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 */
8219 #if _MSVCP_VER <= 100
8220 #define call_num_put_wchar_do_put_ulong(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 24, ostreambuf_iterator_wchar*, \
8221 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, ULONG), \
8222 (this, ret, dest, base, fill, v))
8223 #else
8224 #define call_num_put_wchar_do_put_ulong(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 32, ostreambuf_iterator_wchar*, \
8225 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, ULONG), \
8226 (this, ret, dest, base, fill, v))
8227 #endif
8228 #if _MSVCP_VER != 80
8229 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_ulong, 28)
8230 #else
8231 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_ulong, 32)
8232 #endif
8233 ostreambuf_iterator_wchar* __thiscall num_put_wchar_do_put_ulong(const num_put *this, ostreambuf_iterator_wchar *ret,
8234 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, ULONG v)
8236 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
8237 char fmt[7]; /* strlen("%+#lld")+1 */
8239 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
8241 return num_put_wchar__Iput(this, ret, dest, base, fill, tmp,
8242 sprintf(tmp, num_put_wchar__Ifmt(this, fmt, "lu", base->fmtfl), v));
8245 /* ?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 */
8246 /* ?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 */
8247 #if _MSVCP_VER != 80
8248 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_ulong, 28)
8249 #else
8250 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_ulong, 32)
8251 #endif
8252 ostreambuf_iterator_wchar* __thiscall num_put_short_do_put_ulong(const num_put *this, ostreambuf_iterator_wchar *ret,
8253 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, ULONG v)
8255 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
8256 char fmt[7]; /* strlen("%+#lld")+1 */
8258 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
8260 return num_put_short__Iput(this, ret, dest, base, fill, tmp,
8261 sprintf(tmp, num_put_wchar__Ifmt(this, fmt, "lu", base->fmtfl), v));
8264 /* ?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 */
8265 /* ?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 */
8266 /* ?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 */
8267 /* ?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 */
8268 #if _MSVCP_VER != 80
8269 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_ulong, 28)
8270 #else
8271 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_ulong, 32)
8272 #endif
8273 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_ulong(const num_put *this, ostreambuf_iterator_wchar *ret,
8274 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, ULONG v)
8276 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
8277 return call_num_put_wchar_do_put_ulong(this, ret, dest, base, fill, v);
8280 /* ?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 */
8281 /* ?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 */
8282 /* ?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 */
8283 /* ?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 */
8284 #if _MSVCP_VER <= 100
8285 #define call_num_put_wchar_do_put_double(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 12, ostreambuf_iterator_wchar*, \
8286 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, double), \
8287 (this, ret, dest, base, fill, v))
8288 #define call_num_put_wchar_do_put_ldouble(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 8, ostreambuf_iterator_wchar*, \
8289 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, double), \
8290 (this, ret, dest, base, fill, v))
8291 #else
8292 #define call_num_put_wchar_do_put_double(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 20, ostreambuf_iterator_wchar*, \
8293 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, double), \
8294 (this, ret, dest, base, fill, v))
8295 #define call_num_put_wchar_do_put_ldouble(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 16, ostreambuf_iterator_wchar*, \
8296 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, double), \
8297 (this, ret, dest, base, fill, v))
8298 #endif
8299 #if _MSVCP_VER != 80
8300 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_double, 32)
8301 #else
8302 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_double, 36)
8303 #endif
8304 ostreambuf_iterator_wchar* __thiscall num_put_wchar_do_put_double(const num_put *this, ostreambuf_iterator_wchar *ret,
8305 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, double v)
8307 char *tmp;
8308 char fmt[8]; /* strlen("%+#.*lg")+1 */
8309 int size;
8310 unsigned prec;
8312 TRACE("(%p %p %p %d %lf)\n", this, ret, base, fill, v);
8314 num_put_wchar__Ffmt(this, fmt, '\0', base->fmtfl);
8315 prec = get_precision(base);
8316 size = _scprintf(fmt, prec, v);
8318 /* TODO: don't use dynamic allocation */
8319 tmp = MSVCRT_operator_new(size*2);
8320 if(!tmp) {
8321 ERR("Out of memory\n");
8322 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8324 num_put__fput(this, ret, dest, base, fill, tmp, sprintf(tmp, fmt, prec, v),
8325 numpunct_wchar_use_facet(base->loc));
8326 MSVCRT_operator_delete(tmp);
8327 return ret;
8330 /* ?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 */
8331 /* ?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 */
8332 /* ?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 */
8333 /* ?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 */
8334 #if _MSVCP_VER != 80
8335 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_double, 32)
8336 #else
8337 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_double, 36)
8338 #endif
8339 ostreambuf_iterator_wchar* __thiscall num_put_short_do_put_double(const num_put *this, ostreambuf_iterator_wchar *ret,
8340 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, double v)
8342 char *tmp;
8343 char fmt[8]; /* strlen("%+#.*lg")+1 */
8344 int size;
8345 unsigned prec;
8347 TRACE("(%p %p %p %d %lf)\n", this, ret, base, fill, v);
8349 num_put_wchar__Ffmt(this, fmt, '\0', base->fmtfl);
8350 prec = get_precision(base);
8351 size = _scprintf(fmt, prec, v);
8353 /* TODO: don't use dynamic allocation */
8354 tmp = MSVCRT_operator_new(size*2);
8355 if(!tmp) {
8356 ERR("Out of memory\n");
8357 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8359 num_put__fput(this, ret, dest, base, fill, tmp, sprintf(tmp, fmt, prec, v),
8360 numpunct_short_use_facet(base->loc));
8361 MSVCRT_operator_delete(tmp);
8362 return ret;
8365 /* ?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 */
8366 /* ?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 */
8367 /* ?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 */
8368 /* ?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 */
8369 #if _MSVCP_VER != 80
8370 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_double, 32)
8371 #else
8372 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_double, 36)
8373 #endif
8374 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_double(const num_put *this, ostreambuf_iterator_wchar *ret,
8375 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, double v)
8377 TRACE("(%p %p %p %d %lf)\n", this, ret, base, fill, v);
8378 return call_num_put_wchar_do_put_double(this, ret, dest, base, fill, v);
8381 /* ?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 */
8382 /* ?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 */
8383 /* ?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 */
8384 /* ?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 */
8385 #if _MSVCP_VER != 80
8386 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_ldouble, 32)
8387 #else
8388 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_ldouble, 36)
8389 #endif
8390 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_ldouble(const num_put *this, ostreambuf_iterator_wchar *ret,
8391 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, double v)
8393 TRACE("(%p %p %p %d %lf)\n", this, ret, base, fill, v);
8394 return call_num_put_wchar_do_put_ldouble(this, ret, dest, base, fill, v);
8397 /* ?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 */
8398 /* ?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 */
8399 #if _MSVCP_VER <= 100
8400 #define call_num_put_wchar_do_put_ptr(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 4, ostreambuf_iterator_wchar*, \
8401 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, const void*), \
8402 (this, ret, dest, base, fill, v))
8403 #else
8404 #define call_num_put_wchar_do_put_ptr(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 12, ostreambuf_iterator_wchar*, \
8405 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, const void*), \
8406 (this, ret, dest, base, fill, v))
8407 #endif
8408 #if _MSVCP_VER != 80
8409 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_ptr, 28)
8410 #else
8411 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_ptr, 32)
8412 #endif
8413 ostreambuf_iterator_wchar* __thiscall num_put_wchar_do_put_ptr(const num_put *this, ostreambuf_iterator_wchar *ret,
8414 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, const void *v)
8416 char tmp[17]; /* 8(16^8==2^64)*2(separators beetwen every digit) + 1 */
8418 TRACE("(%p %p %p %d %p)\n", this, ret, base, fill, v);
8420 return num_put_wchar__Iput(this, ret, dest, base, fill, tmp, sprintf(tmp, "%p", v));
8423 /* ?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 */
8424 /* ?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 */
8425 #if _MSVCP_VER != 80
8426 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_ptr, 28)
8427 #else
8428 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_ptr, 32)
8429 #endif
8430 ostreambuf_iterator_wchar* __thiscall num_put_short_do_put_ptr(const num_put *this, ostreambuf_iterator_wchar *ret,
8431 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, const void *v)
8433 char tmp[17]; /* 8(16^8==2^64)*2(separators beetwen every digit) + 1 */
8435 TRACE("(%p %p %p %d %p)\n", this, ret, base, fill, v);
8437 return num_put_short__Iput(this, ret, dest, base, fill, tmp, sprintf(tmp, "%p", v));
8440 /* ?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 */
8441 /* ?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 */
8442 /* ?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 */
8443 /* ?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 */
8444 #if _MSVCP_VER != 80
8445 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_ptr, 28)
8446 #else
8447 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_ptr, 32)
8448 #endif
8449 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_ptr(const num_put *this, ostreambuf_iterator_wchar *ret,
8450 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, const void *v)
8452 TRACE("(%p %p %p %d %p)\n", this, ret, base, fill, v);
8453 return call_num_put_wchar_do_put_ptr(this, ret, dest, base, fill, v);
8456 /* ?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 */
8457 /* ?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 */
8458 #if _MSVCP_VER <= 100
8459 #define call_num_put_wchar_do_put_int64(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 20, ostreambuf_iterator_wchar*, \
8460 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, __int64), \
8461 (this, ret, dest, base, fill, v))
8462 #else
8463 #define call_num_put_wchar_do_put_int64(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 28, ostreambuf_iterator_wchar*, \
8464 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, __int64), \
8465 (this, ret, dest, base, fill, v))
8466 #endif
8467 #if _MSVCP_VER != 80
8468 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_int64, 32)
8469 #else
8470 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_int64, 36)
8471 #endif
8472 ostreambuf_iterator_wchar* __thiscall num_put_wchar_do_put_int64(const num_put *this, ostreambuf_iterator_wchar *ret,
8473 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, __int64 v)
8475 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
8476 char fmt[7]; /* strlen("%+#lld")+1 */
8478 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
8480 return num_put_wchar__Iput(this, ret, dest, base, fill, tmp,
8481 sprintf(tmp, num_put_wchar__Ifmt(this, fmt, "lld", base->fmtfl), v));
8484 /* ?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 */
8485 /* ?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 */
8486 #if _MSVCP_VER != 80
8487 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_int64, 32)
8488 #else
8489 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_int64, 36)
8490 #endif
8491 ostreambuf_iterator_wchar* __thiscall num_put_short_do_put_int64(const num_put *this, ostreambuf_iterator_wchar *ret,
8492 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, __int64 v)
8494 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
8495 char fmt[7]; /* strlen("%+#lld")+1 */
8497 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
8499 return num_put_short__Iput(this, ret, dest, base, fill, tmp,
8500 sprintf(tmp, num_put_wchar__Ifmt(this, fmt, "lld", base->fmtfl), v));
8503 /* ?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 */
8504 /* ?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 */
8505 /* ?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 */
8506 /* ?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 */
8507 #if _MSVCP_VER != 80
8508 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_int64, 32)
8509 #else
8510 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_int64, 36)
8511 #endif
8512 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_int64(const num_put *this, ostreambuf_iterator_wchar *ret,
8513 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, __int64 v)
8515 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
8516 return call_num_put_wchar_do_put_int64(this, ret, dest, base, fill, v);
8519 /* ?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 */
8520 /* ?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 */
8521 #if _MSVCP_VER <= 100
8522 #define call_num_put_wchar_do_put_uint64(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 16, ostreambuf_iterator_wchar*, \
8523 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, unsigned __int64), \
8524 (this, ret, dest, base, fill, v))
8525 #else
8526 #define call_num_put_wchar_do_put_uint64(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 24, ostreambuf_iterator_wchar*, \
8527 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, unsigned __int64), \
8528 (this, ret, dest, base, fill, v))
8529 #endif
8530 #if _MSVCP_VER != 80
8531 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_uint64, 32)
8532 #else
8533 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_uint64, 36)
8534 #endif
8535 ostreambuf_iterator_wchar* __thiscall num_put_wchar_do_put_uint64(const num_put *this, ostreambuf_iterator_wchar *ret,
8536 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, unsigned __int64 v)
8538 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
8539 char fmt[7]; /* strlen("%+#lld")+1 */
8541 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
8543 return num_put_wchar__Iput(this, ret, dest, base, fill, tmp,
8544 sprintf(tmp, num_put_wchar__Ifmt(this, fmt, "llu", base->fmtfl), v));
8547 /* ?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 */
8548 /* ?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 */
8549 #if _MSVCP_VER != 80
8550 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_uint64, 32)
8551 #else
8552 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_uint64, 36)
8553 #endif
8554 ostreambuf_iterator_wchar* __thiscall num_put_short_do_put_uint64(const num_put *this, ostreambuf_iterator_wchar *ret,
8555 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, unsigned __int64 v)
8557 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
8558 char fmt[7]; /* strlen("%+#lld")+1 */
8560 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
8562 return num_put_short__Iput(this, ret, dest, base, fill, tmp,
8563 sprintf(tmp, num_put_wchar__Ifmt(this, fmt, "llu", base->fmtfl), v));
8566 /* ?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 */
8567 /* ?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 */
8568 /* ?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 */
8569 /* ?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 */
8570 #if _MSVCP_VER != 80
8571 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_uint64, 32)
8572 #else
8573 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_uint64, 36)
8574 #endif
8575 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_uint64(const num_put *this, ostreambuf_iterator_wchar *ret,
8576 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, unsigned __int64 v)
8578 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
8579 return call_num_put_wchar_do_put_uint64(this, ret, dest, base, fill, v);
8582 /* ?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 */
8583 /* ?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 */
8584 #if _MSVCP_VER <= 100
8585 #define call_num_put_wchar_do_put_bool(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 32, ostreambuf_iterator_wchar*, \
8586 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, MSVCP_bool), \
8587 (this, ret, dest, base, fill, v))
8588 #else
8589 #define call_num_put_wchar_do_put_bool(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 40, ostreambuf_iterator_wchar*, \
8590 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, MSVCP_bool), \
8591 (this, ret, dest, base, fill, v))
8592 #endif
8593 #if _MSVCP_VER != 80
8594 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_bool, 28)
8595 #else
8596 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_bool, 32)
8597 #endif
8598 ostreambuf_iterator_wchar* __thiscall num_put_wchar_do_put_bool(const num_put *this, ostreambuf_iterator_wchar *ret,
8599 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, MSVCP_bool v)
8601 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
8603 if(base->fmtfl & FMTFLAG_boolalpha) {
8604 numpunct_wchar *numpunct = numpunct_wchar_use_facet(base->loc);
8605 basic_string_wchar str;
8606 MSVCP_size_t pad, len;
8608 if(v)
8609 numpunct_wchar_truename(numpunct, &str);
8610 else
8611 numpunct_wchar_falsename(numpunct, &str);
8613 len = MSVCP_basic_string_wchar_length(&str);
8614 pad = (len>base->wide ? 0 : base->wide-len);
8615 base->wide = 0;
8617 if((base->fmtfl & FMTFLAG_adjustfield) != FMTFLAG_left) {
8618 num_put_wchar__Rep(this, &dest, dest, fill, pad);
8619 pad = 0;
8621 num_put_wchar__Put(this, &dest, dest, MSVCP_basic_string_wchar_c_str(&str), len);
8622 MSVCP_basic_string_wchar_dtor(&str);
8623 return num_put_wchar__Rep(this, ret, dest, fill, pad);
8626 return num_put_wchar_put_long(this, ret, dest, base, fill, v);
8629 /* ?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 */
8630 /* ?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 */
8631 #if _MSVCP_VER != 80
8632 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_bool, 28)
8633 #else
8634 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_bool, 32)
8635 #endif
8636 ostreambuf_iterator_wchar* __thiscall num_put_short_do_put_bool(const num_put *this, ostreambuf_iterator_wchar *ret,
8637 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, MSVCP_bool v)
8639 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
8641 if(base->fmtfl & FMTFLAG_boolalpha) {
8642 numpunct_wchar *numpunct = numpunct_short_use_facet(base->loc);
8643 basic_string_wchar str;
8644 MSVCP_size_t pad, len;
8646 if(v)
8647 numpunct_wchar_truename(numpunct, &str);
8648 else
8649 numpunct_wchar_falsename(numpunct, &str);
8651 len = MSVCP_basic_string_wchar_length(&str);
8652 pad = (len>base->wide ? 0 : base->wide-len);
8653 base->wide = 0;
8655 if((base->fmtfl & FMTFLAG_adjustfield) != FMTFLAG_left) {
8656 num_put_wchar__Rep(this, &dest, dest, fill, pad);
8657 pad = 0;
8659 num_put_wchar__Put(this, &dest, dest, MSVCP_basic_string_wchar_c_str(&str), len);
8660 MSVCP_basic_string_wchar_dtor(&str);
8661 return num_put_wchar__Rep(this, ret, dest, fill, pad);
8664 return num_put_wchar_put_long(this, ret, dest, base, fill, v);
8667 /* ?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 */
8668 /* ?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 */
8669 /* ?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 */
8670 /* ?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 */
8671 #if _MSVCP_VER != 80
8672 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_bool, 28)
8673 #else
8674 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_bool, 32)
8675 #endif
8676 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_bool(const num_put *this, ostreambuf_iterator_wchar *ret,
8677 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, MSVCP_bool v)
8679 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
8680 return call_num_put_wchar_do_put_bool(this, ret, dest, base, fill, v);
8683 /* ?id@?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@2V0locale@2@A */
8684 locale_id time_put_char_id = {0};
8686 /* ??_7?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@6B@ */
8687 extern const vtable_ptr MSVCP_time_put_char_vtable;
8689 /* ?_Init@?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@IAEXABV_Locinfo@2@@Z */
8690 /* ?_Init@?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@IEAAXAEBV_Locinfo@2@@Z */
8691 DEFINE_THISCALL_WRAPPER(time_put_char__Init, 8)
8692 void __thiscall time_put_char__Init(time_put *this, const _Locinfo *locinfo)
8694 TRACE("(%p %p)\n", this, locinfo);
8695 _Locinfo__Gettnames(locinfo, &this->time);
8696 _Locinfo__Getcvt(locinfo, &this->cvt);
8699 /* ??0?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
8700 /* ??0?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
8701 DEFINE_THISCALL_WRAPPER(time_put_char_ctor_locinfo, 12)
8702 time_put* __thiscall time_put_char_ctor_locinfo(time_put *this, const _Locinfo *locinfo, MSVCP_size_t refs)
8704 TRACE("(%p %p %lu)\n", this, locinfo, refs);
8705 locale_facet_ctor_refs(&this->facet, refs);
8706 this->facet.vtable = &MSVCP_time_put_char_vtable;
8707 time_put_char__Init(this, locinfo);
8708 return this;
8711 /* ??0?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAE@I@Z */
8712 /* ??0?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAA@_K@Z */
8713 DEFINE_THISCALL_WRAPPER(time_put_char_ctor_refs, 8)
8714 time_put* __thiscall time_put_char_ctor_refs(time_put *this, MSVCP_size_t refs)
8716 _Locinfo locinfo;
8718 TRACE("(%p %lu)\n", this, refs);
8720 _Locinfo_ctor(&locinfo);
8721 time_put_char_ctor_locinfo(this, &locinfo, refs);
8722 _Locinfo_dtor(&locinfo);
8723 return this;
8726 /* ??_F?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAEXXZ */
8727 /* ??_F?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAAXXZ */
8728 DEFINE_THISCALL_WRAPPER(time_put_char_ctor, 4)
8729 time_put* __thiscall time_put_char_ctor(time_put *this)
8731 return time_put_char_ctor_refs(this, 0);
8734 /* ??1?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MAE@XZ */
8735 /* ??1?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MEAA@XZ */
8736 DEFINE_THISCALL_WRAPPER(time_put_char_dtor, 4)
8737 void __thiscall time_put_char_dtor(time_put *this)
8739 TRACE("(%p)\n", this);
8740 _Timevec_dtor(&this->time);
8743 DEFINE_THISCALL_WRAPPER(time_put_char_vector_dtor, 8)
8744 time_put* __thiscall time_put_char_vector_dtor(time_put *this, unsigned int flags)
8746 TRACE("(%p %x)\n", this, flags);
8747 if(flags & 2) {
8748 /* we have an array, with the number of elements stored before the first object */
8749 INT_PTR i, *ptr = (INT_PTR *)this-1;
8751 for(i=*ptr-1; i>=0; i--)
8752 time_put_char_dtor(this+i);
8753 MSVCRT_operator_delete(ptr);
8754 } else {
8755 time_put_char_dtor(this);
8756 if(flags & 1)
8757 MSVCRT_operator_delete(this);
8760 return this;
8763 /* ?_Getcat@?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
8764 /* ?_Getcat@?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
8765 MSVCP_size_t __cdecl time_put_char__Getcat(const locale_facet **facet, const locale *loc)
8767 TRACE("(%p %p)\n", facet, loc);
8769 if(facet && !*facet) {
8770 _Locinfo locinfo;
8772 *facet = MSVCRT_operator_new(sizeof(time_put));
8773 if(!*facet) {
8774 ERR("Out of memory\n");
8775 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8776 return 0;
8779 _Locinfo_ctor_cstr(&locinfo, locale_string_char_c_str(&loc->ptr->name));
8780 time_put_char_ctor_locinfo((time_put*)*facet, &locinfo, 0);
8781 _Locinfo_dtor(&locinfo);
8784 return LC_TIME;
8787 /* ?_Getcat@?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SAIPAPBVfacet@locale@2@@Z */
8788 /* ?_Getcat@?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@@Z */
8789 MSVCP_size_t __cdecl time_put_char__Getcat_old(const locale_facet **facet)
8791 return time_put_char__Getcat(facet, locale_classic());
8794 static time_put* time_put_char_use_facet(const locale *loc)
8796 static time_put *obj = NULL;
8798 _Lockit lock;
8799 const locale_facet *fac;
8801 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
8802 fac = locale__Getfacet(loc, locale_id_operator_size_t(&time_put_char_id));
8803 if(fac) {
8804 _Lockit_dtor(&lock);
8805 return (time_put*)fac;
8808 if(obj) {
8809 _Lockit_dtor(&lock);
8810 return obj;
8813 time_put_char__Getcat(&fac, loc);
8814 obj = (time_put*)fac;
8815 call_locale_facet__Incref(&obj->facet);
8816 locale_facet_register(&obj->facet);
8817 _Lockit_dtor(&lock);
8819 return obj;
8822 /* ?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 */
8823 /* ?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 */
8824 #if _MSVCP_VER != 80
8825 DEFINE_THISCALL_WRAPPER(time_put_char_do_put, 36)
8826 #else
8827 DEFINE_THISCALL_WRAPPER(time_put_char_do_put, 40)
8828 #endif
8829 #if _MSVCP_VER <= 100
8830 #define call_time_put_char_do_put(this, ret, dest, base, fill, t, spec, mod) CALL_VTBL_FUNC(this, 4, ostreambuf_iterator_char*, \
8831 (const time_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, const struct tm*, char, char), \
8832 (this, ret, dest, base, fill, t, spec, mod))
8833 #else
8834 #define call_time_put_char_do_put(this, ret, dest, base, fill, t, spec, mod) CALL_VTBL_FUNC(this, 12, ostreambuf_iterator_char*, \
8835 (const time_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, const struct tm*, char, char), \
8836 (this, ret, dest, base, fill, t, spec, mod))
8837 #endif
8838 ostreambuf_iterator_char* __thiscall time_put_char_do_put(const time_put *this, ostreambuf_iterator_char *ret,
8839 ostreambuf_iterator_char dest, ios_base *base, char fill, const struct tm *t, char spec, char mod)
8841 char buf[64], fmt[4], *p = fmt;
8842 MSVCP_size_t i, len;
8844 TRACE("(%p %p %p %c %p %c %c)\n", this, ret, base, fill, t, spec, mod);
8846 *p++ = '%';
8847 if(mod)
8848 *p++ = mod;
8849 *p++ = spec;
8850 *p++ = 0;
8852 len = _Strftime(buf, sizeof(buf), fmt, t, this->time.timeptr);
8853 for(i=0; i<len; i++)
8854 ostreambuf_iterator_char_put(&dest, buf[i]);
8856 *ret = dest;
8857 return ret;
8860 /* ?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 */
8861 /* ?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 */
8862 #if _MSVCP_VER != 80
8863 DEFINE_THISCALL_WRAPPER(time_put_char_put, 36)
8864 #else
8865 DEFINE_THISCALL_WRAPPER(time_put_char_put, 40)
8866 #endif
8867 ostreambuf_iterator_char* __thiscall time_put_char_put(const time_put *this, ostreambuf_iterator_char *ret,
8868 ostreambuf_iterator_char dest, ios_base *base, char fill, const struct tm *t, char spec, char mod)
8870 TRACE("(%p %p %p %c %p %c %c)\n", this, ret, base, fill, t, spec, mod);
8871 return call_time_put_char_do_put(this, ret, dest, base, fill, t, spec, mod);
8874 /* ?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 */
8875 /* ?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 */
8876 #if _MSVCP_VER != 80
8877 DEFINE_THISCALL_WRAPPER(time_put_char_put_format, 36)
8878 #else
8879 DEFINE_THISCALL_WRAPPER(time_put_char_put_format, 40)
8880 #endif
8881 ostreambuf_iterator_char* __thiscall time_put_char_put_format(const time_put *this, ostreambuf_iterator_char *ret,
8882 ostreambuf_iterator_char dest, ios_base *base, char fill, const struct tm *t, const char *pat, const char *pat_end)
8884 TRACE("(%p %p %p %c %p %s)\n", this, ret, base, fill, t, debugstr_an(pat, pat_end-pat));
8886 while(pat < pat_end) {
8887 if(*pat != '%') {
8888 ostreambuf_iterator_char_put(&dest, *pat++);
8889 }else if(++pat == pat_end) {
8890 ostreambuf_iterator_char_put(&dest, '%');
8891 }else if(*pat=='#' && pat+1==pat_end) {
8892 ostreambuf_iterator_char_put(&dest, '%');
8893 ostreambuf_iterator_char_put(&dest, *pat++);
8894 }else {
8895 char mod;
8897 if(*pat == '#') {
8898 mod = '#';
8899 pat++;
8900 }else {
8901 mod = 0;
8904 time_put_char_put(this, &dest, dest, base, fill, t, *pat++, mod);
8908 *ret = dest;
8909 return ret;
8912 /* ?id@?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@2V0locale@2@A */
8913 locale_id time_put_wchar_id = {0};
8914 /* ?id@?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@2V0locale@2@A */
8915 locale_id time_put_short_id = {0};
8917 /* ??_7?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@6B@ */
8918 extern const vtable_ptr MSVCP_time_put_wchar_vtable;
8919 /* ??_7?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@6B@ */
8920 extern const vtable_ptr MSVCP_time_put_short_vtable;
8922 /* ?_Init@?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@IAEXABV_Locinfo@2@@Z */
8923 /* ?_Init@?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@IEAAXAEBV_Locinfo@2@@Z */
8924 /* ?_Init@?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@IAEXABV_Locinfo@2@@Z */
8925 /* ?_Init@?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@IEAAXAEBV_Locinfo@2@@Z */
8926 DEFINE_THISCALL_WRAPPER(time_put_wchar__Init, 8)
8927 void __thiscall time_put_wchar__Init(time_put *this, const _Locinfo *locinfo)
8929 TRACE("(%p %p)\n", this, locinfo);
8930 _Locinfo__Gettnames(locinfo, &this->time);
8931 _Locinfo__Getcvt(locinfo, &this->cvt);
8934 /* ??0?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
8935 /* ??0?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
8936 DEFINE_THISCALL_WRAPPER(time_put_wchar_ctor_locinfo, 12)
8937 time_put* __thiscall time_put_wchar_ctor_locinfo(time_put *this, const _Locinfo *locinfo, MSVCP_size_t refs)
8939 TRACE("(%p %p %lu)\n", this, locinfo, refs);
8940 locale_facet_ctor_refs(&this->facet, refs);
8941 this->facet.vtable = &MSVCP_time_put_wchar_vtable;
8942 time_put_wchar__Init(this, locinfo);
8943 return this;
8946 /* ??0?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
8947 /* ??0?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
8948 DEFINE_THISCALL_WRAPPER(time_put_short_ctor_locinfo, 12)
8949 time_put* __thiscall time_put_short_ctor_locinfo(time_put *this, const _Locinfo *locinfo, MSVCP_size_t refs)
8951 time_put_wchar_ctor_locinfo(this, locinfo, refs);
8952 this->facet.vtable = &MSVCP_time_put_short_vtable;
8953 return this;
8956 /* ??0?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@IAE@PBDI@Z */
8957 /* ??0?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@IEAA@PEBD_K@Z */
8958 DEFINE_THISCALL_WRAPPER(time_put_wchar_ctor_name, 12)
8959 time_put* __thiscall time_put_wchar_ctor_name(time_put *this, const char *name, MSVCP_size_t refs)
8961 _Locinfo locinfo;
8963 TRACE("(%p %s %lu)\n", this, debugstr_a(name), refs);
8965 _Locinfo_ctor_cstr(&locinfo, name);
8966 time_put_wchar_ctor_locinfo(this, &locinfo, refs);
8967 _Locinfo_dtor(&locinfo);
8968 return this;
8971 /* ??0?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@IAE@PBDI@Z */
8972 /* ??0?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@IEAA@PEBD_K@Z */
8973 DEFINE_THISCALL_WRAPPER(time_put_short_ctor_name, 12)
8974 time_put* __thiscall time_put_short_ctor_name(time_put *this, const char *name, MSVCP_size_t refs)
8976 time_put_wchar_ctor_name(this, name, refs);
8977 this->facet.vtable = &MSVCP_time_put_short_vtable;
8978 return this;
8981 /* ??0?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAE@I@Z */
8982 /* ??0?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAA@_K@Z */
8983 DEFINE_THISCALL_WRAPPER(time_put_wchar_ctor_refs, 8)
8984 time_put* __thiscall time_put_wchar_ctor_refs(time_put *this, MSVCP_size_t refs)
8986 _Locinfo locinfo;
8988 TRACE("(%p %lu)\n", this, refs);
8990 _Locinfo_ctor(&locinfo);
8991 time_put_wchar_ctor_locinfo(this, &locinfo, refs);
8992 _Locinfo_dtor(&locinfo);
8993 return this;
8996 /* ??0?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAE@I@Z */
8997 /* ??0?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEAA@_K@Z */
8998 DEFINE_THISCALL_WRAPPER(time_put_short_ctor_refs, 8)
8999 time_put* __thiscall time_put_short_ctor_refs(time_put *this, MSVCP_size_t refs)
9001 time_put_wchar_ctor_refs(this, refs);
9002 this->facet.vtable = &MSVCP_time_put_short_vtable;
9003 return this;
9006 /* ??_F?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAEXXZ */
9007 /* ??_F?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAAXXZ */
9008 DEFINE_THISCALL_WRAPPER(time_put_wchar_ctor, 4)
9009 time_put* __thiscall time_put_wchar_ctor(time_put *this)
9011 return time_put_wchar_ctor_refs(this, 0);
9014 /* ??_F?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAEXXZ */
9015 /* ??_F?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEAAXXZ */
9016 DEFINE_THISCALL_WRAPPER(time_put_short_ctor, 4)
9017 time_put* __thiscall time_put_short_ctor(time_put *this)
9019 time_put_wchar_ctor(this);
9020 this->facet.vtable = &MSVCP_time_put_short_vtable;
9021 return this;
9024 /* ??1?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MAE@XZ */
9025 /* ??1?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MEAA@XZ */
9026 /* ??1?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MAE@XZ */
9027 /* ??1?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MEAA@XZ */
9028 DEFINE_THISCALL_WRAPPER(time_put_wchar_dtor, 4)
9029 void __thiscall time_put_wchar_dtor(time_put *this)
9031 TRACE("(%p)\n", this);
9032 _Timevec_dtor(&this->time);
9035 DEFINE_THISCALL_WRAPPER(time_put_wchar_vector_dtor, 8)
9036 time_put* __thiscall time_put_wchar_vector_dtor(time_put *this, unsigned int flags)
9038 TRACE("(%p %x)\n", this, flags);
9039 if(flags & 2) {
9040 /* we have an array, with the number of elements stored before the first object */
9041 INT_PTR i, *ptr = (INT_PTR *)this-1;
9043 for(i=*ptr-1; i>=0; i--)
9044 time_put_wchar_dtor(this+i);
9045 MSVCRT_operator_delete(ptr);
9046 } else {
9047 time_put_wchar_dtor(this);
9048 if(flags & 1)
9049 MSVCRT_operator_delete(this);
9052 return this;
9055 /* ?_Getcat@?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
9056 /* ?_Getcat@?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
9057 MSVCP_size_t __cdecl time_put_wchar__Getcat(const locale_facet **facet, const locale *loc)
9059 TRACE("(%p %p)\n", facet, loc);
9061 if(facet && !*facet) {
9062 *facet = MSVCRT_operator_new(sizeof(time_put));
9063 if(!*facet) {
9064 ERR("Out of memory\n");
9065 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
9066 return 0;
9068 time_put_wchar_ctor_name((time_put*)*facet,
9069 locale_string_char_c_str(&loc->ptr->name), 0);
9072 return LC_TIME;
9075 /* ?_Getcat@?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SAIPAPBVfacet@locale@2@@Z */
9076 /* ?_Getcat@?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@@Z */
9077 MSVCP_size_t __cdecl time_put_wchar__Getcat_old(const locale_facet **facet)
9079 return time_put_wchar__Getcat(facet, locale_classic());
9082 static time_put* time_put_wchar_use_facet(const locale *loc)
9084 static time_put *obj = NULL;
9086 _Lockit lock;
9087 const locale_facet *fac;
9089 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
9090 fac = locale__Getfacet(loc, locale_id_operator_size_t(&time_put_wchar_id));
9091 if(fac) {
9092 _Lockit_dtor(&lock);
9093 return (time_put*)fac;
9096 if(obj) {
9097 _Lockit_dtor(&lock);
9098 return obj;
9101 time_put_wchar__Getcat(&fac, loc);
9102 obj = (time_put*)fac;
9103 call_locale_facet__Incref(&obj->facet);
9104 locale_facet_register(&obj->facet);
9105 _Lockit_dtor(&lock);
9107 return obj;
9110 /* ?_Getcat@?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
9111 /* ?_Getcat@?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
9112 MSVCP_size_t __cdecl time_put_short__Getcat(const locale_facet **facet, const locale *loc)
9114 TRACE("(%p %p)\n", facet, loc);
9116 if(facet && !*facet) {
9117 *facet = MSVCRT_operator_new(sizeof(time_put));
9118 if(!*facet) {
9119 ERR("Out of memory\n");
9120 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
9121 return 0;
9123 time_put_short_ctor_name((time_put*)*facet,
9124 locale_string_char_c_str(&loc->ptr->name), 0);
9127 return LC_TIME;
9130 /* ?_Getcat@?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SAIPAPBVfacet@locale@2@@Z */
9131 /* ?_Getcat@?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@@Z */
9132 MSVCP_size_t __cdecl time_put_short__Getcat_old(const locale_facet **facet)
9134 return time_put_short__Getcat(facet, locale_classic());
9137 static time_put* time_put_short_use_facet(const locale *loc)
9139 static time_put *obj = NULL;
9141 _Lockit lock;
9142 const locale_facet *fac;
9144 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
9145 fac = locale__Getfacet(loc, locale_id_operator_size_t(&time_put_short_id));
9146 if(fac) {
9147 _Lockit_dtor(&lock);
9148 return (time_put*)fac;
9151 if(obj) {
9152 _Lockit_dtor(&lock);
9153 return obj;
9156 time_put_short__Getcat(&fac, loc);
9157 obj = (time_put*)fac;
9158 call_locale_facet__Incref(&obj->facet);
9159 locale_facet_register(&obj->facet);
9160 _Lockit_dtor(&lock);
9162 return obj;
9165 /* ?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 */
9166 /* ?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 */
9167 /* ?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 */
9168 /* ?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 */
9169 #if _MSVCP_VER != 80
9170 DEFINE_THISCALL_WRAPPER(time_put_wchar_do_put, 36)
9171 #else
9172 DEFINE_THISCALL_WRAPPER(time_put_wchar_do_put, 40)
9173 #endif
9174 #if _MSVCP_VER <= 100
9175 #define call_time_put_wchar_do_put(this, ret, dest, base, fill, t, spec, mod) CALL_VTBL_FUNC(this, 4, ostreambuf_iterator_wchar*, \
9176 (const time_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, const struct tm*, char, char), \
9177 (this, ret, dest, base, fill, t, spec, mod))
9178 #else
9179 #define call_time_put_wchar_do_put(this, ret, dest, base, fill, t, spec, mod) CALL_VTBL_FUNC(this, 12, ostreambuf_iterator_wchar*, \
9180 (const time_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, const struct tm*, char, char), \
9181 (this, ret, dest, base, fill, t, spec, mod))
9182 #endif
9183 ostreambuf_iterator_wchar* __thiscall time_put_wchar_do_put(const time_put *this,
9184 ostreambuf_iterator_wchar *ret, ostreambuf_iterator_wchar dest, ios_base *base,
9185 wchar_t fill, const struct tm *t, char spec, char mod)
9187 char buf[64], fmt[4], *p = fmt;
9188 MSVCP_size_t i, len;
9189 wchar_t c;
9191 TRACE("(%p %p %p %c %p %c %c)\n", this, ret, base, fill, t, spec, mod);
9193 *p++ = '%';
9194 if(mod)
9195 *p++ = mod;
9196 *p++ = spec;
9197 *p++ = 0;
9199 len = _Strftime(buf, sizeof(buf), fmt, t, this->time.timeptr);
9200 for(i=0; i<len; i++) {
9201 c = mb_to_wc(buf[i], &this->cvt);
9202 ostreambuf_iterator_wchar_put(&dest, c);
9205 *ret = dest;
9206 return ret;
9209 /* ?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 */
9210 /* ?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 */
9211 /* ?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 */
9212 /* ?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 */
9213 #if _MSVCP_VER != 80
9214 DEFINE_THISCALL_WRAPPER(time_put_wchar_put, 36)
9215 #else
9216 DEFINE_THISCALL_WRAPPER(time_put_wchar_put, 40)
9217 #endif
9218 ostreambuf_iterator_wchar* __thiscall time_put_wchar_put(const time_put *this,
9219 ostreambuf_iterator_wchar *ret, ostreambuf_iterator_wchar dest, ios_base *base,
9220 wchar_t fill, const struct tm *t, char spec, char mod)
9222 TRACE("(%p %p %p %c %p %c %c)\n", this, ret, base, fill, t, spec, mod);
9223 return call_time_put_wchar_do_put(this, ret, dest, base, fill, t, spec, mod);
9226 /* ?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 */
9227 /* ?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 */
9228 /* ?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 */
9229 /* ?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 */
9230 #if _MSVCP_VER != 80
9231 DEFINE_THISCALL_WRAPPER(time_put_wchar_put_format, 36)
9232 #else
9233 DEFINE_THISCALL_WRAPPER(time_put_wchar_put_format, 40)
9234 #endif
9235 ostreambuf_iterator_wchar* __thiscall time_put_wchar_put_format(const time_put *this,
9236 ostreambuf_iterator_wchar *ret, ostreambuf_iterator_wchar dest, ios_base *base,
9237 wchar_t fill, const struct tm *t, const wchar_t *pat, const wchar_t *pat_end)
9239 wchar_t percent = mb_to_wc('%', &this->cvt);
9240 char c[MB_LEN_MAX];
9242 TRACE("(%p %p %p %c %p %s)\n", this, ret, base, fill, t, debugstr_wn(pat, pat_end-pat));
9244 while(pat < pat_end) {
9245 if(*pat != percent) {
9246 ostreambuf_iterator_wchar_put(&dest, *pat++);
9247 }else if(++pat == pat_end) {
9248 ostreambuf_iterator_wchar_put(&dest, percent);
9249 }else if(!_Wcrtomb(c, *pat, NULL, &this->cvt) || (*c=='#' && pat+1==pat_end)) {
9250 ostreambuf_iterator_wchar_put(&dest, percent);
9251 ostreambuf_iterator_wchar_put(&dest, *pat++);
9252 }else {
9253 if(*c == '#') {
9254 if(!_Wcrtomb(c, *pat++, NULL, &this->cvt)) {
9255 ostreambuf_iterator_wchar_put(&dest, percent);
9256 ostreambuf_iterator_wchar_put(&dest, *(pat-1));
9257 ostreambuf_iterator_wchar_put(&dest, *pat);
9258 }else {
9259 time_put_wchar_put(this, &dest, dest, base, fill, t, *c, '#');
9261 }else {
9262 time_put_wchar_put(this, &dest, dest, base, fill, t, *c, 0);
9267 *ret = dest;
9268 return ret;
9271 /* ??0_Locimp@locale@std@@AAE@_N@Z */
9272 /* ??0_Locimp@locale@std@@AEAA@_N@Z */
9273 DEFINE_THISCALL_WRAPPER(locale__Locimp_ctor_transparent, 8)
9274 locale__Locimp* __thiscall locale__Locimp_ctor_transparent(locale__Locimp *this, MSVCP_bool transparent)
9276 TRACE("(%p %d)\n", this, transparent);
9278 memset(this, 0, sizeof(locale__Locimp));
9279 locale_facet_ctor_refs(&this->facet, 1);
9280 this->transparent = transparent;
9281 locale_string_char_ctor_cstr(&this->name, "*");
9282 return this;
9285 /* ??_F_Locimp@locale@std@@QAEXXZ */
9286 /* ??_F_Locimp@locale@std@@QEAAXXZ */
9287 DEFINE_THISCALL_WRAPPER(locale__Locimp_ctor, 4)
9288 locale__Locimp* __thiscall locale__Locimp_ctor(locale__Locimp *this)
9290 return locale__Locimp_ctor_transparent(this, FALSE);
9293 /* ??0_Locimp@locale@std@@AAE@ABV012@@Z */
9294 /* ??0_Locimp@locale@std@@AEAA@AEBV012@@Z */
9295 DEFINE_THISCALL_WRAPPER(locale__Locimp_copy_ctor, 8)
9296 locale__Locimp* __thiscall locale__Locimp_copy_ctor(locale__Locimp *this, const locale__Locimp *copy)
9298 _Lockit lock;
9299 MSVCP_size_t i;
9301 TRACE("(%p %p)\n", this, copy);
9303 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
9304 memcpy(this, copy, sizeof(locale__Locimp));
9305 locale_facet_ctor_refs(&this->facet, 1);
9306 if(copy->facetvec) {
9307 this->facetvec = MSVCRT_operator_new(copy->facet_cnt*sizeof(locale_facet*));
9308 if(!this->facetvec) {
9309 _Lockit_dtor(&lock);
9310 ERR("Out of memory\n");
9311 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
9312 return NULL;
9314 for(i=0; i<this->facet_cnt; i++)
9316 this->facetvec[i] = copy->facetvec[i];
9317 if(this->facetvec[i])
9318 call_locale_facet__Incref(this->facetvec[i]);
9321 locale_string_char_copy_ctor(&this->name, &copy->name);
9322 _Lockit_dtor(&lock);
9323 return this;
9326 /* ?_Locimp_ctor@_Locimp@locale@std@@CAXPAV123@ABV123@@Z */
9327 /* ?_Locimp_ctor@_Locimp@locale@std@@CAXPEAV123@AEBV123@@Z */
9328 locale__Locimp* __cdecl locale__Locimp__Locimp_ctor(locale__Locimp *this, const locale__Locimp *copy)
9330 return locale__Locimp_copy_ctor(this, copy);
9333 /* ??1_Locimp@locale@std@@MAE@XZ */
9334 /* ??1_Locimp@locale@std@@MEAA@XZ */
9335 DEFINE_THISCALL_WRAPPER(locale__Locimp_dtor, 4)
9336 void __thiscall locale__Locimp_dtor(locale__Locimp *this)
9338 MSVCP_size_t i;
9340 TRACE("(%p)\n", this);
9342 locale_facet_dtor(&this->facet);
9343 for(i=0; i<this->facet_cnt; i++)
9344 if(this->facetvec[i] && call_locale_facet__Decref(this->facetvec[i]))
9345 call_locale_facet_vector_dtor(this->facetvec[i], 1);
9347 MSVCRT_operator_delete(this->facetvec);
9348 locale_string_char_dtor(&this->name);
9351 /* ?_Locimp_dtor@_Locimp@locale@std@@CAXPAV123@@Z */
9352 /* ?_Locimp_dtor@_Locimp@locale@std@@CAXPEAV123@@Z */
9353 void __cdecl locale__Locimp__Locimp_dtor(locale__Locimp *this)
9355 locale__Locimp_dtor(this);
9358 DEFINE_THISCALL_WRAPPER(locale__Locimp_vector_dtor, 8)
9359 locale__Locimp* __thiscall locale__Locimp_vector_dtor(locale__Locimp *this, unsigned int flags)
9361 TRACE("(%p %x)\n", this, flags);
9362 if(flags & 2) {
9363 /* we have an array, with the number of elements stored before the first object */
9364 INT_PTR i, *ptr = (INT_PTR *)this-1;
9366 for(i=*ptr-1; i>=0; i--)
9367 locale__Locimp_dtor(this+i);
9368 MSVCRT_operator_delete(ptr);
9369 } else {
9370 locale__Locimp_dtor(this);
9371 if(flags & 1)
9372 MSVCRT_operator_delete(this);
9375 return this;
9378 /* ?_New_Locimp@_Locimp@locale@std@@CAPAV123@ABV123@@Z */
9379 /* ?_New_Locimp@_Locimp@locale@std@@CAPEAV123@AEBV123@@Z */
9380 locale__Locimp* __cdecl locale__Locimp__New_Locimp(const locale__Locimp *copy)
9382 locale__Locimp *ret;
9384 TRACE("(%p)\n", copy);
9386 ret = MSVCRT_operator_new(sizeof(locale__Locimp));
9387 if(!ret) {
9388 ERR("Out of memory\n");
9389 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
9390 return NULL;
9392 return locale__Locimp_copy_ctor(ret, copy);
9395 /* ?_New_Locimp@_Locimp@locale@std@@CAPAV123@_N@Z */
9396 /* ?_New_Locimp@_Locimp@locale@std@@CAPEAV123@_N@Z */
9397 locale__Locimp* __cdecl locale__Locimp__New_Locimp_transparent(MSVCP_bool transparent)
9399 locale__Locimp *ret;
9401 TRACE("(%x)\n", transparent);
9403 ret = MSVCRT_operator_new(sizeof(locale__Locimp));
9404 if(!ret) {
9405 ERR("Out of memory\n");
9406 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
9407 return NULL;
9409 return locale__Locimp_ctor_transparent(ret, transparent);
9412 /* ?_Locimp_Addfac@_Locimp@locale@std@@CAXPAV123@PAVfacet@23@I@Z */
9413 /* ?_Locimp_Addfac@_Locimp@locale@std@@CAXPEAV123@PEAVfacet@23@_K@Z */
9414 void __cdecl locale__Locimp__Locimp_Addfac(locale__Locimp *locimp, locale_facet *facet, MSVCP_size_t id)
9416 _Lockit lock;
9418 TRACE("(%p %p %lu)\n", locimp, facet, id);
9420 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
9421 if(id >= locimp->facet_cnt) {
9422 MSVCP_size_t new_size = id+1;
9423 locale_facet **new_facetvec;
9425 if(new_size < locale_id__Id_cnt+1)
9426 new_size = locale_id__Id_cnt+1;
9428 new_facetvec = MSVCRT_operator_new(sizeof(locale_facet*)*new_size);
9429 if(!new_facetvec) {
9430 _Lockit_dtor(&lock);
9431 ERR("Out of memory\n");
9432 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
9433 return;
9436 memset(new_facetvec, 0, sizeof(locale_facet*)*new_size);
9437 memcpy(new_facetvec, locimp->facetvec, sizeof(locale_facet*)*locimp->facet_cnt);
9438 MSVCRT_operator_delete(locimp->facetvec);
9439 locimp->facetvec = new_facetvec;
9440 locimp->facet_cnt = new_size;
9443 if(locimp->facetvec[id] && call_locale_facet__Decref(locimp->facetvec[id]))
9444 call_locale_facet_vector_dtor(locimp->facetvec[id], 1);
9446 locimp->facetvec[id] = facet;
9447 if(facet)
9448 call_locale_facet__Incref(facet);
9449 _Lockit_dtor(&lock);
9452 /* ?_Addfac@_Locimp@locale@std@@AAEXPAVfacet@23@I@Z */
9453 /* ?_Addfac@_Locimp@locale@std@@AEAAXPEAVfacet@23@_K@Z */
9454 DEFINE_THISCALL_WRAPPER(locale__Locimp__Addfac, 12)
9455 void __thiscall locale__Locimp__Addfac(locale__Locimp *this, locale_facet *facet, MSVCP_size_t id)
9457 locale__Locimp__Locimp_Addfac(this, facet, id);
9460 /* ?_Clocptr_func@_Locimp@locale@std@@CAAAPAV123@XZ */
9461 /* ?_Clocptr_func@_Locimp@locale@std@@CAAEAPEAV123@XZ */
9462 locale__Locimp** __cdecl locale__Locimp__Clocptr_func(void)
9464 FIXME("stub\n");
9465 return NULL;
9468 /* ?_Makeushloc@_Locimp@locale@std@@CAXABV_Locinfo@3@HPAV123@PBV23@@Z */
9469 /* ?_Makeushloc@_Locimp@locale@std@@CAXAEBV_Locinfo@3@HPEAV123@PEBV23@@Z */
9470 /* List of missing facets:
9471 * messages, money_get, money_put, moneypunct, moneypunct, time_get
9473 void __cdecl locale__Locimp__Makeushloc(const _Locinfo *locinfo, category cat, locale__Locimp *locimp, const locale *loc)
9475 FIXME("(%p %d %p %p) semi-stub\n", locinfo, cat, locimp, loc);
9477 if(cat & (1<<(ctype_short__Getcat(NULL, NULL)-1))) {
9478 ctype_wchar *ctype;
9480 if(loc) {
9481 ctype = ctype_short_use_facet(loc);
9482 }else {
9483 ctype = MSVCRT_operator_new(sizeof(ctype_wchar));
9484 if(!ctype) {
9485 ERR("Out of memory\n");
9486 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
9488 ctype_short_ctor_locinfo(ctype, locinfo, 0);
9490 locale__Locimp__Addfac(locimp, &ctype->base.facet, locale_id_operator_size_t(&ctype_short_id));
9493 if(cat & (1<<(num_get_short__Getcat(NULL, NULL)-1))) {
9494 num_get *numget;
9496 if(loc) {
9497 numget = num_get_short_use_facet(loc);
9498 }else {
9499 numget = MSVCRT_operator_new(sizeof(num_get));
9500 if(!numget) {
9501 ERR("Out of memory\n");
9502 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
9504 num_get_short_ctor_locinfo(numget, locinfo, 0);
9506 locale__Locimp__Addfac(locimp, &numget->facet, locale_id_operator_size_t(&num_get_short_id));
9509 if(cat & (1<<(num_put_short__Getcat(NULL, NULL)-1))) {
9510 num_put *numput;
9512 if(loc) {
9513 numput = num_put_short_use_facet(loc);
9514 }else {
9515 numput = MSVCRT_operator_new(sizeof(num_put));
9516 if(!numput) {
9517 ERR("Out of memory\n");
9518 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
9520 num_put_short_ctor_locinfo(numput, locinfo, 0);
9522 locale__Locimp__Addfac(locimp, &numput->facet, locale_id_operator_size_t(&num_put_short_id));
9525 if(cat & (1<<(numpunct_short__Getcat(NULL, NULL)-1))) {
9526 numpunct_wchar *numpunct;
9528 if(loc) {
9529 numpunct = numpunct_short_use_facet(loc);
9530 }else {
9531 numpunct = MSVCRT_operator_new(sizeof(numpunct_wchar));
9532 if(!numpunct) {
9533 ERR("Out of memory\n");
9534 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
9536 numpunct_short_ctor_locinfo(numpunct, locinfo, 0, FALSE);
9538 locale__Locimp__Addfac(locimp, &numpunct->facet, locale_id_operator_size_t(&numpunct_short_id));
9541 if(cat & (1<<(collate_short__Getcat(NULL, NULL)-1))) {
9542 collate *c;
9544 if(loc) {
9545 c = collate_short_use_facet(loc);
9546 }else {
9547 c = MSVCRT_operator_new(sizeof(collate));
9548 if(!c) {
9549 ERR("Out of memory\n");
9550 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
9552 collate_short_ctor_locinfo(c, locinfo, 0);
9554 locale__Locimp__Addfac(locimp, &c->facet, locale_id_operator_size_t(&collate_short_id));
9557 if(cat & (1<<(time_put_short__Getcat(NULL, NULL)-1))) {
9558 time_put *t;
9560 if(loc) {
9561 t = time_put_short_use_facet(loc);
9562 }else {
9563 t = MSVCRT_operator_new(sizeof(time_put));
9564 if(!t) {
9565 ERR("Out of memory\n");
9566 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
9568 time_put_short_ctor_locinfo(t, locinfo, 0);
9570 locale__Locimp__Addfac(locimp, &t->facet, locale_id_operator_size_t(&time_put_short_id));
9573 if(cat & (1<<(codecvt_short__Getcat(NULL, NULL)-1))) {
9574 codecvt_wchar *codecvt;
9576 if(loc) {
9577 codecvt = codecvt_short_use_facet(loc);
9578 }else {
9579 codecvt = MSVCRT_operator_new(sizeof(codecvt_wchar));
9580 if(!codecvt) {
9581 ERR("Out of memory\n");
9582 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
9584 codecvt_short_ctor_locinfo(codecvt, locinfo, 0);
9586 locale__Locimp__Addfac(locimp, &codecvt->base.facet, locale_id_operator_size_t(&codecvt_short_id));
9590 /* ?_Makewloc@_Locimp@locale@std@@CAXABV_Locinfo@3@HPAV123@PBV23@@Z */
9591 /* ?_Makewloc@_Locimp@locale@std@@CAXAEBV_Locinfo@3@HPEAV123@PEBV23@@Z */
9592 /* List of missing facets:
9593 * messages, money_get, money_put, moneypunct, moneypunct, time_get
9595 void __cdecl locale__Locimp__Makewloc(const _Locinfo *locinfo, category cat, locale__Locimp *locimp, const locale *loc)
9597 FIXME("(%p %d %p %p) semi-stub\n", locinfo, cat, locimp, loc);
9599 if(cat & (1<<(ctype_wchar__Getcat(NULL, NULL)-1))) {
9600 ctype_wchar *ctype;
9602 if(loc) {
9603 ctype = ctype_wchar_use_facet(loc);
9604 }else {
9605 ctype = MSVCRT_operator_new(sizeof(ctype_wchar));
9606 if(!ctype) {
9607 ERR("Out of memory\n");
9608 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
9610 ctype_wchar_ctor_locinfo(ctype, locinfo, 0);
9612 locale__Locimp__Addfac(locimp, &ctype->base.facet, locale_id_operator_size_t(&ctype_wchar_id));
9615 if(cat & (1<<(num_get_wchar__Getcat(NULL, NULL)-1))) {
9616 num_get *numget;
9618 if(loc) {
9619 numget = num_get_wchar_use_facet(loc);
9620 }else {
9621 numget = MSVCRT_operator_new(sizeof(num_get));
9622 if(!numget) {
9623 ERR("Out of memory\n");
9624 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
9626 num_get_wchar_ctor_locinfo(numget, locinfo, 0);
9628 locale__Locimp__Addfac(locimp, &numget->facet, locale_id_operator_size_t(&num_get_wchar_id));
9631 if(cat & (1<<(num_put_wchar__Getcat(NULL, NULL)-1))) {
9632 num_put *numput;
9634 if(loc) {
9635 numput = num_put_wchar_use_facet(loc);
9636 }else {
9637 numput = MSVCRT_operator_new(sizeof(num_put));
9638 if(!numput) {
9639 ERR("Out of memory\n");
9640 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
9642 num_put_wchar_ctor_locinfo(numput, locinfo, 0);
9644 locale__Locimp__Addfac(locimp, &numput->facet, locale_id_operator_size_t(&num_put_wchar_id));
9647 if(cat & (1<<(numpunct_wchar__Getcat(NULL, NULL)-1))) {
9648 numpunct_wchar *numpunct;
9650 if(loc) {
9651 numpunct = numpunct_wchar_use_facet(loc);
9652 }else {
9653 numpunct = MSVCRT_operator_new(sizeof(numpunct_wchar));
9654 if(!numpunct) {
9655 ERR("Out of memory\n");
9656 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
9658 numpunct_wchar_ctor_locinfo(numpunct, locinfo, 0, FALSE);
9660 locale__Locimp__Addfac(locimp, &numpunct->facet, locale_id_operator_size_t(&numpunct_wchar_id));
9663 if(cat & (1<<(collate_wchar__Getcat(NULL, NULL)-1))) {
9664 collate *c;
9666 if(loc) {
9667 c = collate_wchar_use_facet(loc);
9668 }else {
9669 c = MSVCRT_operator_new(sizeof(collate));
9670 if(!c) {
9671 ERR("Out of memory\n");
9672 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
9674 collate_wchar_ctor_locinfo(c, locinfo, 0);
9676 locale__Locimp__Addfac(locimp, &c->facet, locale_id_operator_size_t(&collate_wchar_id));
9679 if(cat & (1<<(time_put_wchar__Getcat(NULL, NULL)-1))) {
9680 time_put *t;
9682 if(loc) {
9683 t = time_put_wchar_use_facet(loc);
9684 }else {
9685 t = MSVCRT_operator_new(sizeof(time_put));
9686 if(!t) {
9687 ERR("Out of memory\n");
9688 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
9690 time_put_wchar_ctor_locinfo(t, locinfo, 0);
9692 locale__Locimp__Addfac(locimp, &t->facet, locale_id_operator_size_t(&time_put_wchar_id));
9695 if(cat & (1<<(codecvt_wchar__Getcat(NULL, NULL)-1))) {
9696 codecvt_wchar *codecvt;
9698 if(loc) {
9699 codecvt = codecvt_wchar_use_facet(loc);
9700 }else {
9701 codecvt = MSVCRT_operator_new(sizeof(codecvt_wchar));
9702 if(!codecvt) {
9703 ERR("Out of memory\n");
9704 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
9706 codecvt_wchar_ctor_locinfo(codecvt, locinfo, 0);
9708 locale__Locimp__Addfac(locimp, &codecvt->base.facet, locale_id_operator_size_t(&codecvt_wchar_id));
9712 /* ?_Makexloc@_Locimp@locale@std@@CAXABV_Locinfo@3@HPAV123@PBV23@@Z */
9713 /* ?_Makexloc@_Locimp@locale@std@@CAXAEBV_Locinfo@3@HPEAV123@PEBV23@@Z */
9714 /* List of missing facets:
9715 * messages, money_get, money_put, moneypunct, moneypunct, time_get
9717 void __cdecl locale__Locimp__Makexloc(const _Locinfo *locinfo, category cat, locale__Locimp *locimp, const locale *loc)
9719 FIXME("(%p %d %p %p) semi-stub\n", locinfo, cat, locimp, loc);
9721 if(cat & (1<<(ctype_char__Getcat(NULL, NULL)-1))) {
9722 ctype_char *ctype;
9724 if(loc) {
9725 ctype = ctype_char_use_facet(loc);
9726 }else {
9727 ctype = MSVCRT_operator_new(sizeof(ctype_char));
9728 if(!ctype) {
9729 ERR("Out of memory\n");
9730 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
9732 ctype_char_ctor_locinfo(ctype, locinfo, 0);
9734 locale__Locimp__Addfac(locimp, &ctype->base.facet, locale_id_operator_size_t(&ctype_char_id));
9737 if(cat & (1<<(num_get_char__Getcat(NULL, NULL)-1))) {
9738 num_get *numget;
9740 if(loc) {
9741 numget = num_get_char_use_facet(loc);
9742 }else {
9743 numget = MSVCRT_operator_new(sizeof(num_get));
9744 if(!numget) {
9745 ERR("Out of memory\n");
9746 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
9748 num_get_char_ctor_locinfo(numget, locinfo, 0);
9750 locale__Locimp__Addfac(locimp, &numget->facet, locale_id_operator_size_t(&num_get_char_id));
9753 if(cat & (1<<(num_put_char__Getcat(NULL, NULL)-1))) {
9754 num_put *numput;
9756 if(loc) {
9757 numput = num_put_char_use_facet(loc);
9758 }else {
9759 numput = MSVCRT_operator_new(sizeof(num_put));
9760 if(!numput) {
9761 ERR("Out of memory\n");
9762 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
9764 num_put_char_ctor_locinfo(numput, locinfo, 0);
9766 locale__Locimp__Addfac(locimp, &numput->facet, locale_id_operator_size_t(&num_put_char_id));
9769 if(cat & (1<<(numpunct_char__Getcat(NULL, NULL)-1))) {
9770 numpunct_char *numpunct;
9772 if(loc) {
9773 numpunct = numpunct_char_use_facet(loc);
9774 }else {
9775 numpunct = MSVCRT_operator_new(sizeof(numpunct_char));
9776 if(!numpunct) {
9777 ERR("Out of memory\n");
9778 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
9780 numpunct_char_ctor_locinfo(numpunct, locinfo, 0, FALSE);
9782 locale__Locimp__Addfac(locimp, &numpunct->facet, locale_id_operator_size_t(&numpunct_char_id));
9785 if(cat & (1<<(collate_char__Getcat(NULL, NULL)-1))) {
9786 collate *c;
9788 if(loc) {
9789 c = collate_char_use_facet(loc);
9790 }else {
9791 c = MSVCRT_operator_new(sizeof(collate));
9792 if(!c) {
9793 ERR("Out of memory\n");
9794 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
9796 collate_char_ctor_locinfo(c, locinfo, 0);
9798 locale__Locimp__Addfac(locimp, &c->facet, locale_id_operator_size_t(&collate_char_id));
9801 if(cat & (1<<(time_put_char__Getcat(NULL, NULL)-1))) {
9802 time_put *t;
9804 if(loc) {
9805 t = time_put_char_use_facet(loc);
9806 }else {
9807 t = MSVCRT_operator_new(sizeof(time_put));
9808 if(!t) {
9809 ERR("Out of memory\n");
9810 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
9812 time_put_char_ctor_locinfo(t, locinfo, 0);
9814 locale__Locimp__Addfac(locimp, &t->facet, locale_id_operator_size_t(&time_put_char_id));
9817 if(cat & (1<<(codecvt_char__Getcat(NULL, NULL)-1))) {
9818 codecvt_char *codecvt;
9820 if(loc) {
9821 codecvt = codecvt_char_use_facet(loc);
9822 }else {
9823 codecvt = MSVCRT_operator_new(sizeof(codecvt_char));
9824 if(!codecvt) {
9825 ERR("Out of memory\n");
9826 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
9828 codecvt_char_ctor_locinfo(codecvt, locinfo, 0);
9830 locale__Locimp__Addfac(locimp, &codecvt->base.facet, locale_id_operator_size_t(&codecvt_char_id));
9834 /* ?_Makeloc@_Locimp@locale@std@@CAPAV123@ABV_Locinfo@3@HPAV123@PBV23@@Z */
9835 /* ?_Makeloc@_Locimp@locale@std@@CAPEAV123@AEBV_Locinfo@3@HPEAV123@PEBV23@@Z */
9836 locale__Locimp* __cdecl locale__Locimp__Makeloc(const _Locinfo *locinfo, category cat, locale__Locimp *locimp, const locale *loc)
9838 TRACE("(%p %d %p %p)\n", locinfo, cat, locimp, loc);
9840 locale__Locimp__Makexloc(locinfo, cat, locimp, loc);
9841 locale__Locimp__Makewloc(locinfo, cat, locimp, loc);
9842 locale__Locimp__Makeushloc(locinfo, cat, locimp, loc);
9844 locimp->catmask |= cat;
9845 locale_string_char_assign(&locimp->name, &locinfo->newlocname);
9846 return locimp;
9849 /* ??_7_Locimp@locale@std@@6B@ */
9850 const vtable_ptr MSVCP_locale__Locimp_vtable[] = {
9851 (vtable_ptr)THISCALL_NAME(locale__Locimp_vector_dtor)
9854 /* ??0locale@std@@AAE@PAV_Locimp@01@@Z */
9855 /* ??0locale@std@@AEAA@PEAV_Locimp@01@@Z */
9856 DEFINE_THISCALL_WRAPPER(locale_ctor_locimp, 8)
9857 locale* __thiscall locale_ctor_locimp(locale *this, locale__Locimp *locimp)
9859 TRACE("(%p %p)\n", this, locimp);
9860 /* Don't change locimp reference counter */
9861 this->ptr = locimp;
9862 return this;
9865 /* ?_Init@locale@std@@CAPAV_Locimp@12@XZ */
9866 /* ?_Init@locale@std@@CAPEAV_Locimp@12@XZ */
9867 locale__Locimp* __cdecl locale__Init(void)
9869 _Lockit lock;
9871 TRACE("\n");
9873 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
9874 if(global_locale) {
9875 _Lockit_dtor(&lock);
9876 return global_locale;
9879 global_locale = MSVCRT_operator_new(sizeof(locale__Locimp));
9880 if(!global_locale) {
9881 _Lockit_dtor(&lock);
9882 ERR("Out of memory\n");
9883 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
9884 return NULL;
9887 locale__Locimp_ctor(global_locale);
9888 global_locale->catmask = (1<<(LC_MAX+1))-1;
9889 locale_string_char_dtor(&global_locale->name);
9890 locale_string_char_ctor_cstr(&global_locale->name, "C");
9892 locale__Locimp__Clocptr = global_locale;
9893 global_locale->facet.refs++;
9894 locale_ctor_locimp(&classic_locale, locale__Locimp__Clocptr);
9895 _Lockit_dtor(&lock);
9897 return global_locale;
9900 /* ?_Init@locale@std@@CAPAV_Locimp@12@_N@Z */
9901 /* ?_Init@locale@std@@CAPEAV_Locimp@12@_N@Z */
9902 locale__Locimp* __cdecl locale__Init_ref(MSVCP_bool inc_ref)
9904 locale__Locimp *ret;
9905 _Lockit lock;
9907 TRACE("(%x)\n", inc_ref);
9909 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
9910 if(inc_ref && global_locale) {
9911 call_locale_facet__Incref(&global_locale->facet);
9912 _Lockit_dtor(&lock);
9913 return global_locale;
9916 ret = locale__Init();
9917 _Lockit_dtor(&lock);
9918 return ret;
9921 /* ??0locale@std@@QAE@ABV01@0H@Z */
9922 /* ??0locale@std@@QEAA@AEBV01@0H@Z */
9923 DEFINE_THISCALL_WRAPPER(locale_ctor_locale_locale, 16)
9924 locale* __thiscall locale_ctor_locale_locale(locale *this, const locale *loc, const locale *other, category cat)
9926 _Locinfo locinfo;
9928 TRACE("(%p %p %p %d)\n", this, loc, other, cat);
9930 this->ptr = MSVCRT_operator_new(sizeof(locale__Locimp));
9931 if(!this->ptr) {
9932 ERR("Out of memory\n");
9933 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
9935 locale__Locimp_copy_ctor(this->ptr, loc->ptr);
9937 _Locinfo_ctor_cat_cstr(&locinfo, loc->ptr->catmask, locale_string_char_c_str(&loc->ptr->name));
9938 _Locinfo__Addcats(&locinfo, cat & other->ptr->catmask, locale_string_char_c_str(&other->ptr->name));
9939 locale__Locimp__Makeloc(&locinfo, cat, this->ptr, other);
9940 _Locinfo_dtor(&locinfo);
9942 return this;
9945 /* ??0locale@std@@QAE@ABV01@@Z */
9946 /* ??0locale@std@@QEAA@AEBV01@@Z */
9947 DEFINE_THISCALL_WRAPPER(locale_copy_ctor, 8)
9948 locale* __thiscall locale_copy_ctor(locale *this, const locale *copy)
9950 TRACE("(%p %p)\n", this, copy);
9951 this->ptr = copy->ptr;
9952 call_locale_facet__Incref(&this->ptr->facet);
9953 return this;
9956 /* ??0locale@std@@QAE@ABV01@PBDH@Z */
9957 /* ??0locale@std@@QEAA@AEBV01@PEBDH@Z */
9958 DEFINE_THISCALL_WRAPPER(locale_ctor_locale_cstr, 16)
9959 locale* __thiscall locale_ctor_locale_cstr(locale *this, const locale *loc, const char *locname, category cat)
9961 FIXME("(%p %p %s %d) stub\n", this, loc, locname, cat);
9962 return NULL;
9965 /* ??0locale@std@@QAE@PBDH@Z */
9966 /* ??0locale@std@@QEAA@PEBDH@Z */
9967 DEFINE_THISCALL_WRAPPER(locale_ctor_cstr, 12)
9968 locale* __thiscall locale_ctor_cstr(locale *this, const char *locname, category cat)
9970 _Locinfo locinfo;
9972 TRACE("(%p %s %d)\n", this, locname, cat);
9974 this->ptr = MSVCRT_operator_new(sizeof(locale__Locimp));
9975 if(!this->ptr) {
9976 ERR("Out of memory\n");
9977 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
9979 locale__Locimp_ctor(this->ptr);
9981 locale__Init();
9983 _Locinfo_ctor_cat_cstr(&locinfo, cat, locname);
9984 if(!memcmp(locale_string_char_c_str(&locinfo.newlocname), "*", 2)) {
9985 _Locinfo_dtor(&locinfo);
9986 MSVCRT_operator_delete(this->ptr);
9987 throw_exception(EXCEPTION_RUNTIME_ERROR, "bad locale name");
9990 locale__Locimp__Makeloc(&locinfo, cat, this->ptr, NULL);
9991 _Locinfo_dtor(&locinfo);
9993 return this;
9996 /* ??0locale@std@@QAE@W4_Uninitialized@1@@Z */
9997 /* ??0locale@std@@QEAA@W4_Uninitialized@1@@Z */
9998 DEFINE_THISCALL_WRAPPER(locale_ctor_uninitialized, 8)
9999 locale* __thiscall locale_ctor_uninitialized(locale *this, int uninitialized)
10001 TRACE("(%p)\n", this);
10002 this->ptr = NULL;
10003 return this;
10006 /* ??0locale@std@@QAE@XZ */
10007 /* ??0locale@std@@QEAA@XZ */
10008 DEFINE_THISCALL_WRAPPER(locale_ctor, 4)
10009 locale* __thiscall locale_ctor(locale *this)
10011 TRACE("(%p)\n", this);
10012 this->ptr = locale__Init();
10013 call_locale_facet__Incref(&this->ptr->facet);
10014 return this;
10017 /* ??1locale@std@@QAE@XZ */
10018 /* ??1locale@std@@QEAA@XZ */
10019 DEFINE_THISCALL_WRAPPER(locale_dtor, 4)
10020 void __thiscall locale_dtor(locale *this)
10022 TRACE("(%p)\n", this);
10023 if(this->ptr && call_locale_facet__Decref(&this->ptr->facet))
10025 locale__Locimp_dtor(this->ptr);
10026 MSVCRT_operator_delete(this->ptr);
10030 /* ??4locale@std@@QAEAAV01@ABV01@@Z */
10031 /* ??4locale@std@@QEAAAEAV01@AEBV01@@Z */
10032 DEFINE_THISCALL_WRAPPER(locale_operator_assign, 8)
10033 locale* __thiscall locale_operator_assign(locale *this, const locale *loc)
10035 FIXME("(%p %p) stub\n", this, loc);
10036 return NULL;
10039 /* ??8locale@std@@QBE_NABV01@@Z */
10040 /* ??8locale@std@@QEBA_NAEBV01@@Z */
10041 DEFINE_THISCALL_WRAPPER(locale_operator_equal, 8)
10042 MSVCP_bool __thiscall locale_operator_equal(const locale *this, const locale *loc)
10044 FIXME("(%p %p) stub\n", this, loc);
10045 return 0;
10048 /* ??9locale@std@@QBE_NABV01@@Z */
10049 /* ??9locale@std@@QEBA_NAEBV01@@Z */
10050 DEFINE_THISCALL_WRAPPER(locale_operator_not_equal, 8)
10051 MSVCP_bool __thiscall locale_operator_not_equal(const locale *this, locale const *loc)
10053 FIXME("(%p %p) stub\n", this, loc);
10054 return 0;
10057 /* ?_Addfac@locale@std@@QAEAAV12@PAVfacet@12@II@Z */
10058 /* ?_Addfac@locale@std@@QEAAAEAV12@PEAVfacet@12@_K1@Z */
10059 DEFINE_THISCALL_WRAPPER(locale__Addfac, 16)
10060 locale* __thiscall locale__Addfac(locale *this, locale_facet *facet, MSVCP_size_t id, MSVCP_size_t catmask)
10062 TRACE("(%p %p %lu %lu)\n", this, facet, id, catmask);
10064 if(this->ptr->facet.refs > 1) {
10065 locale__Locimp *new_ptr = MSVCRT_operator_new(sizeof(locale__Locimp));
10066 if(!new_ptr) {
10067 ERR("Out of memory\n");
10068 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10069 return NULL;
10071 locale__Locimp_copy_ctor(new_ptr, this->ptr);
10072 call_locale_facet__Decref(&this->ptr->facet);
10073 this->ptr = new_ptr;
10076 locale__Locimp__Addfac(this->ptr, facet, id);
10078 if(catmask) {
10079 locale_string_char_dtor(&this->ptr->name);
10080 locale_string_char_ctor_cstr(&this->ptr->name, "*");
10082 return this;
10085 /* ?_Getfacet@locale@std@@QBEPBVfacet@12@I@Z */
10086 /* ?_Getfacet@locale@std@@QEBAPEBVfacet@12@_K@Z */
10087 DEFINE_THISCALL_WRAPPER(locale__Getfacet, 8)
10088 const locale_facet* __thiscall locale__Getfacet(const locale *this, MSVCP_size_t id)
10090 locale_facet *fac;
10092 TRACE("(%p %lu)\n", this, id);
10094 fac = id < this->ptr->facet_cnt ? this->ptr->facetvec[id] : NULL;
10095 if(fac || !this->ptr->transparent)
10096 return fac;
10098 return id < global_locale->facet_cnt ? global_locale->facetvec[id] : NULL;
10101 /* ?_Getgloballocale@locale@std@@CAPAV_Locimp@12@XZ */
10102 /* ?_Getgloballocale@locale@std@@CAPEAV_Locimp@12@XZ */
10103 locale__Locimp* __cdecl locale__Getgloballocale(void)
10105 TRACE("\n");
10106 return global_locale;
10109 /* ?_Setgloballocale@locale@std@@CAXPAX@Z */
10110 /* ?_Setgloballocale@locale@std@@CAXPEAX@Z */
10111 void __cdecl locale__Setgloballocale(void *locimp)
10113 TRACE("(%p)\n", locimp);
10114 global_locale = locimp;
10117 /* ?classic@locale@std@@SAABV12@XZ */
10118 /* ?classic@locale@std@@SAAEBV12@XZ */
10119 const locale* __cdecl locale_classic(void)
10121 TRACE("\n");
10122 locale__Init();
10123 return &classic_locale;
10126 /* ?empty@locale@std@@SA?AV12@XZ */
10127 locale* __cdecl locale_empty(locale *ret)
10129 TRACE("\n");
10131 locale__Init();
10133 ret->ptr = MSVCRT_operator_new(sizeof(locale__Locimp));
10134 if(!ret->ptr) {
10135 ERR("Out of memory\n");
10136 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10138 locale__Locimp_ctor_transparent(ret->ptr, TRUE);
10139 return ret;
10142 /* ?global@locale@std@@SA?AV12@ABV12@@Z */
10143 /* ?global@locale@std@@SA?AV12@AEBV12@@Z */
10144 locale* __cdecl locale_global(locale *ret, const locale *loc)
10146 _Lockit lock;
10147 int i;
10149 TRACE("(%p %p)\n", loc, ret);
10151 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
10152 locale_ctor(ret);
10154 if(loc->ptr != global_locale) {
10155 call_locale_facet__Decref(&global_locale->facet);
10156 global_locale = loc->ptr;
10157 call_locale_facet__Incref(&global_locale->facet);
10159 for(i=LC_ALL+1; i<=LC_MAX; i++) {
10160 if((global_locale->catmask & (1<<(i-1))) == 0)
10161 continue;
10162 setlocale(i, locale_string_char_c_str(&global_locale->name));
10165 _Lockit_dtor(&lock);
10166 return ret;
10169 #if _MSVCP_VER < 100
10171 /* ?_Getname@_Locinfo@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
10172 /* ?_Getname@_Locinfo@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
10173 DEFINE_THISCALL_WRAPPER(_Locinfo__Getname, 8)
10174 basic_string_char* __thiscall _Locinfo__Getname(const _Locinfo *this, basic_string_char *ret)
10176 TRACE("(%p)\n", this);
10178 MSVCP_basic_string_char_copy_ctor(ret, &this->newlocname);
10179 return ret;
10182 /* ?name@locale@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
10183 /* ?name@locale@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
10184 DEFINE_THISCALL_WRAPPER(locale_name, 8)
10185 basic_string_char* __thiscall locale_name(const locale *this, basic_string_char *ret)
10187 TRACE( "(%p)\n", this);
10188 MSVCP_basic_string_char_copy_ctor(ret, &this->ptr->name);
10189 return ret;
10192 #else
10194 /* ?_Getname@_Locinfo@std@@QBEPBDXZ */
10195 /* ?_Getname@_Locinfo@std@@QEBAPEBDXZ */
10196 DEFINE_THISCALL_WRAPPER(_Locinfo__Getname, 4)
10197 const char * __thiscall _Locinfo__Getname( const _Locinfo *this )
10199 return locale_string_char_c_str( &this->newlocname );
10202 #endif /* _MSVCP_VER < 100 */
10204 /* wctrans */
10205 wctrans_t __cdecl wctrans(const char *property)
10207 static const char str_tolower[] = "tolower";
10208 static const char str_toupper[] = "toupper";
10210 if(!strcmp(property, str_tolower))
10211 return 2;
10212 if(!strcmp(property, str_toupper))
10213 return 1;
10214 return 0;
10217 /* towctrans */
10218 wint_t __cdecl towctrans(wint_t c, wctrans_t category)
10220 if(category == 1)
10221 return towupper(c);
10222 return towlower(c);
10225 /* btowc */
10226 wint_t __cdecl btowc(int c)
10228 wchar_t ret;
10229 int state = 0;
10230 char ch = c;
10232 if (c == EOF || _Mbrtowc( &ret, &ch, 1, &state, NULL ) != 1) return WEOF;
10233 return ret;
10236 /* mbrlen */
10237 size_t __cdecl mbrlen(const char *str, size_t n, mbstate_t *state)
10239 static int local_state;
10241 if (!state) state = &local_state;
10242 return _Mbrtowc( NULL, str, n, state, NULL );
10245 /* mbrtowc */
10246 size_t __cdecl mbrtowc(wchar_t *dst, const char *str, size_t n, mbstate_t *state)
10248 static int local_state;
10250 if (!state) state = &local_state;
10251 return _Mbrtowc( dst, str, n, state, NULL );
10254 /* mbsrtowcs */
10255 size_t __cdecl mbsrtowcs(wchar_t *dst, const char **pstr, size_t n, mbstate_t *state)
10257 static int local_state;
10258 size_t ret = 0;
10259 wchar_t wc;
10260 const char *src;
10262 src = *pstr;
10263 if (!state) state = &local_state;
10265 while (!dst || n > ret)
10267 int len = _Mbrtowc( &wc, src, 2, state, NULL );
10268 if (len < 0) return -1;
10269 if (!len) break;
10270 if (dst) dst[ret] = wc;
10271 ret++;
10272 if (!wc) break;
10273 src += len;
10275 return ret;
10278 /* wctob */
10279 int __cdecl wctob(wint_t wc)
10281 char ret[MB_LEN_MAX];
10283 if (wc == WEOF || _Wcrtomb( ret, wc, NULL, NULL ) != -1) return EOF;
10284 return ret[0];
10287 /* wcrtomb */
10288 size_t __cdecl wcrtomb(char *dst, wchar_t wc, mbstate_t *state)
10290 return _Wcrtomb( dst, wc, state, NULL );
10293 /* wcsrtombs */
10294 size_t __cdecl wcsrtombs(char *dst, const wchar_t **pstr, size_t n, mbstate_t *state)
10296 const wchar_t *src;
10297 char buffer[MB_LEN_MAX];
10298 size_t ret = 0;
10300 src = *pstr;
10302 while (!dst || n > ret)
10304 int len = _Wcrtomb( buffer, *src, state, NULL );
10305 if (len <= 0) return -1;
10306 if (n < ret + len) break;
10307 memcpy( dst + ret, buffer, len );
10308 ret += len;
10309 if (!buffer[0]) break;
10310 src++;
10312 return ret;
10316 DEFINE_RTTI_DATA0(locale_facet, 0, ".?AVfacet@locale@std@@")
10317 DEFINE_RTTI_DATA1(collate_char, 0, &locale_facet_rtti_base_descriptor, ".?AV?$collate@D@std@@")
10318 DEFINE_RTTI_DATA1(collate_wchar, 0, &locale_facet_rtti_base_descriptor, ".?AV?$collate@_W@std@@")
10319 DEFINE_RTTI_DATA1(collate_short, 0, &locale_facet_rtti_base_descriptor, ".?AV?$collate@G@std@@")
10320 DEFINE_RTTI_DATA1(ctype_base, 0, &locale_facet_rtti_base_descriptor, ".?AUctype_base@std@@")
10321 DEFINE_RTTI_DATA2(ctype_char, 0, &ctype_base_rtti_base_descriptor, &locale_facet_rtti_base_descriptor, ".?AV?$ctype@D@std@@")
10322 DEFINE_RTTI_DATA2(ctype_wchar, 0, &ctype_base_rtti_base_descriptor, &locale_facet_rtti_base_descriptor, ".?AV?$ctype@_W@std@@")
10323 DEFINE_RTTI_DATA2(ctype_short, 0, &ctype_base_rtti_base_descriptor, &locale_facet_rtti_base_descriptor, ".?AV?$ctype@G@std@@")
10324 DEFINE_RTTI_DATA1(codecvt_base, 0, &locale_facet_rtti_base_descriptor, ".?AVcodecvt_base@std@@")
10325 DEFINE_RTTI_DATA2(codecvt_char, 0, &codecvt_base_rtti_base_descriptor, &locale_facet_rtti_base_descriptor, ".?AV?$codecvt@DDH@std@@")
10326 DEFINE_RTTI_DATA2(codecvt_wchar, 0, &codecvt_base_rtti_base_descriptor, &locale_facet_rtti_base_descriptor, ".?AV?$codecvt@_WDH@std@@")
10327 DEFINE_RTTI_DATA2(codecvt_short, 0, &codecvt_base_rtti_base_descriptor, &locale_facet_rtti_base_descriptor, ".?AV?$codecvt@GDH@std@@")
10328 DEFINE_RTTI_DATA1(numpunct_char, 0, &locale_facet_rtti_base_descriptor, ".?AV?$numpunct@D@std@@")
10329 DEFINE_RTTI_DATA1(numpunct_wchar, 0, &locale_facet_rtti_base_descriptor, ".?AV?$numpunct@_W@std@@")
10330 DEFINE_RTTI_DATA1(numpunct_short, 0, &locale_facet_rtti_base_descriptor, ".?AV?$numpunct@G@std@@")
10331 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@@")
10332 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@@")
10333 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@@")
10334 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@@")
10335 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@@")
10336 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@@")
10337 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@@")
10338 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@@")
10339 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@@")
10341 #ifndef __GNUC__
10342 void __asm_dummy_vtables(void) {
10343 #endif
10344 __ASM_VTABLE(locale_facet,
10345 VTABLE_ADD_FUNC(locale_facet_vector_dtor)
10346 #if _MSVCP_VER >= 110
10347 VTABLE_ADD_FUNC(locale_facet__Incref)
10348 VTABLE_ADD_FUNC(locale_facet__Decref)
10349 #endif
10351 __ASM_VTABLE(collate_char,
10352 VTABLE_ADD_FUNC(collate_char_vector_dtor)
10353 #if _MSVCP_VER >= 110
10354 VTABLE_ADD_FUNC(locale_facet__Incref)
10355 VTABLE_ADD_FUNC(locale_facet__Decref)
10356 #endif
10357 VTABLE_ADD_FUNC(collate_char_do_compare)
10358 VTABLE_ADD_FUNC(collate_char_do_transform)
10359 VTABLE_ADD_FUNC(collate_char_do_hash));
10360 __ASM_VTABLE(collate_wchar,
10361 VTABLE_ADD_FUNC(collate_wchar_vector_dtor)
10362 #if _MSVCP_VER >= 110
10363 VTABLE_ADD_FUNC(locale_facet__Incref)
10364 VTABLE_ADD_FUNC(locale_facet__Decref)
10365 #endif
10366 VTABLE_ADD_FUNC(collate_wchar_do_compare)
10367 VTABLE_ADD_FUNC(collate_wchar_do_transform)
10368 VTABLE_ADD_FUNC(collate_wchar_do_hash));
10369 __ASM_VTABLE(collate_short,
10370 VTABLE_ADD_FUNC(collate_wchar_vector_dtor)
10371 #if _MSVCP_VER >= 110
10372 VTABLE_ADD_FUNC(locale_facet__Incref)
10373 VTABLE_ADD_FUNC(locale_facet__Decref)
10374 #endif
10375 VTABLE_ADD_FUNC(collate_wchar_do_compare)
10376 VTABLE_ADD_FUNC(collate_wchar_do_transform)
10377 VTABLE_ADD_FUNC(collate_wchar_do_hash));
10378 __ASM_VTABLE(ctype_base,
10379 VTABLE_ADD_FUNC(ctype_base_vector_dtor)
10380 #if _MSVCP_VER >= 110
10381 VTABLE_ADD_FUNC(locale_facet__Incref)
10382 VTABLE_ADD_FUNC(locale_facet__Decref)
10383 #endif
10385 __ASM_VTABLE(ctype_char,
10386 VTABLE_ADD_FUNC(ctype_char_vector_dtor)
10387 #if _MSVCP_VER >= 110
10388 VTABLE_ADD_FUNC(locale_facet__Incref)
10389 VTABLE_ADD_FUNC(locale_facet__Decref)
10390 #endif
10391 VTABLE_ADD_FUNC(ctype_char_do_tolower)
10392 VTABLE_ADD_FUNC(ctype_char_do_tolower_ch)
10393 VTABLE_ADD_FUNC(ctype_char_do_toupper)
10394 VTABLE_ADD_FUNC(ctype_char_do_toupper_ch)
10395 VTABLE_ADD_FUNC(ctype_char_do_widen)
10396 VTABLE_ADD_FUNC(ctype_char_do_widen_ch)
10397 #if _MSVCP_VER >= 80 && _MSVCP_VER <= 90
10398 VTABLE_ADD_FUNC(ctype_char__Do_widen_s)
10399 VTABLE_ADD_FUNC(ctype_char_do_narrow)
10400 VTABLE_ADD_FUNC(ctype_char_do_narrow_ch)
10401 VTABLE_ADD_FUNC(ctype_char__Do_narrow_s)
10402 #else
10403 VTABLE_ADD_FUNC(ctype_char_do_narrow)
10404 VTABLE_ADD_FUNC(ctype_char_do_narrow_ch)
10405 #endif
10407 __ASM_VTABLE(ctype_wchar,
10408 VTABLE_ADD_FUNC(ctype_wchar_vector_dtor)
10409 #if _MSVCP_VER >= 110
10410 VTABLE_ADD_FUNC(locale_facet__Incref)
10411 VTABLE_ADD_FUNC(locale_facet__Decref)
10412 #endif
10413 VTABLE_ADD_FUNC(ctype_wchar_do_is)
10414 VTABLE_ADD_FUNC(ctype_wchar_do_is_ch)
10415 VTABLE_ADD_FUNC(ctype_wchar_do_scan_is)
10416 VTABLE_ADD_FUNC(ctype_wchar_do_scan_not)
10417 VTABLE_ADD_FUNC(ctype_wchar_do_tolower)
10418 VTABLE_ADD_FUNC(ctype_wchar_do_tolower_ch)
10419 VTABLE_ADD_FUNC(ctype_wchar_do_toupper)
10420 VTABLE_ADD_FUNC(ctype_wchar_do_toupper_ch)
10421 VTABLE_ADD_FUNC(ctype_wchar_do_widen)
10422 VTABLE_ADD_FUNC(ctype_wchar_do_widen_ch)
10423 #if _MSVCP_VER >= 80 && _MSVCP_VER <= 90
10424 VTABLE_ADD_FUNC(ctype_wchar__Do_widen_s)
10425 VTABLE_ADD_FUNC(ctype_wchar_do_narrow)
10426 VTABLE_ADD_FUNC(ctype_wchar_do_narrow_ch)
10427 VTABLE_ADD_FUNC(ctype_wchar__Do_narrow_s)
10428 #else
10429 VTABLE_ADD_FUNC(ctype_wchar_do_narrow)
10430 VTABLE_ADD_FUNC(ctype_wchar_do_narrow_ch)
10431 #endif
10433 __ASM_VTABLE(ctype_short,
10434 VTABLE_ADD_FUNC(ctype_wchar_vector_dtor)
10435 #if _MSVCP_VER >= 110
10436 VTABLE_ADD_FUNC(locale_facet__Incref)
10437 VTABLE_ADD_FUNC(locale_facet__Decref)
10438 #endif
10439 VTABLE_ADD_FUNC(ctype_wchar_do_is)
10440 VTABLE_ADD_FUNC(ctype_wchar_do_is_ch)
10441 VTABLE_ADD_FUNC(ctype_wchar_do_scan_is)
10442 VTABLE_ADD_FUNC(ctype_wchar_do_scan_not)
10443 VTABLE_ADD_FUNC(ctype_wchar_do_tolower)
10444 VTABLE_ADD_FUNC(ctype_wchar_do_tolower_ch)
10445 VTABLE_ADD_FUNC(ctype_wchar_do_toupper)
10446 VTABLE_ADD_FUNC(ctype_wchar_do_toupper_ch)
10447 VTABLE_ADD_FUNC(ctype_wchar_do_widen)
10448 VTABLE_ADD_FUNC(ctype_wchar_do_widen_ch)
10449 #if _MSVCP_VER >= 80 && _MSVCP_VER <= 90
10450 VTABLE_ADD_FUNC(ctype_wchar__Do_widen_s)
10451 VTABLE_ADD_FUNC(ctype_wchar_do_narrow)
10452 VTABLE_ADD_FUNC(ctype_wchar_do_narrow_ch)
10453 VTABLE_ADD_FUNC(ctype_wchar__Do_narrow_s)
10454 #else
10455 VTABLE_ADD_FUNC(ctype_wchar_do_narrow)
10456 VTABLE_ADD_FUNC(ctype_wchar_do_narrow_ch)
10457 #endif
10459 __ASM_VTABLE(codecvt_base,
10460 VTABLE_ADD_FUNC(codecvt_base_vector_dtor)
10461 #if _MSVCP_VER >= 110
10462 VTABLE_ADD_FUNC(locale_facet__Incref)
10463 VTABLE_ADD_FUNC(locale_facet__Decref)
10464 #endif
10465 VTABLE_ADD_FUNC(codecvt_base_do_always_noconv)
10466 VTABLE_ADD_FUNC(codecvt_base_do_max_length)
10467 VTABLE_ADD_FUNC(codecvt_base_do_encoding));
10468 __ASM_VTABLE(codecvt_char,
10469 VTABLE_ADD_FUNC(codecvt_char_vector_dtor)
10470 #if _MSVCP_VER >= 110
10471 VTABLE_ADD_FUNC(locale_facet__Incref)
10472 VTABLE_ADD_FUNC(locale_facet__Decref)
10473 #endif
10474 VTABLE_ADD_FUNC(codecvt_base_do_always_noconv)
10475 VTABLE_ADD_FUNC(codecvt_base_do_max_length)
10476 VTABLE_ADD_FUNC(codecvt_base_do_encoding)
10477 VTABLE_ADD_FUNC(codecvt_char_do_in)
10478 VTABLE_ADD_FUNC(codecvt_char_do_out)
10479 VTABLE_ADD_FUNC(codecvt_char_do_unshift)
10480 VTABLE_ADD_FUNC(codecvt_char_do_length));
10481 __ASM_VTABLE(codecvt_wchar,
10482 VTABLE_ADD_FUNC(codecvt_wchar_vector_dtor)
10483 #if _MSVCP_VER >= 110
10484 VTABLE_ADD_FUNC(locale_facet__Incref)
10485 VTABLE_ADD_FUNC(locale_facet__Decref)
10486 #endif
10487 VTABLE_ADD_FUNC(codecvt_wchar_do_always_noconv)
10488 VTABLE_ADD_FUNC(codecvt_wchar_do_max_length)
10489 VTABLE_ADD_FUNC(codecvt_base_do_encoding)
10490 VTABLE_ADD_FUNC(codecvt_wchar_do_in)
10491 VTABLE_ADD_FUNC(codecvt_wchar_do_out)
10492 VTABLE_ADD_FUNC(codecvt_wchar_do_unshift)
10493 VTABLE_ADD_FUNC(codecvt_wchar_do_length));
10494 __ASM_VTABLE(codecvt_short,
10495 VTABLE_ADD_FUNC(codecvt_wchar_vector_dtor)
10496 #if _MSVCP_VER >= 110
10497 VTABLE_ADD_FUNC(locale_facet__Incref)
10498 VTABLE_ADD_FUNC(locale_facet__Decref)
10499 #endif
10500 VTABLE_ADD_FUNC(codecvt_wchar_do_always_noconv)
10501 VTABLE_ADD_FUNC(codecvt_wchar_do_max_length)
10502 VTABLE_ADD_FUNC(codecvt_base_do_encoding)
10503 VTABLE_ADD_FUNC(codecvt_wchar_do_in)
10504 VTABLE_ADD_FUNC(codecvt_wchar_do_out)
10505 VTABLE_ADD_FUNC(codecvt_wchar_do_unshift)
10506 VTABLE_ADD_FUNC(codecvt_wchar_do_length));
10507 __ASM_VTABLE(numpunct_char,
10508 VTABLE_ADD_FUNC(numpunct_char_vector_dtor)
10509 #if _MSVCP_VER >= 110
10510 VTABLE_ADD_FUNC(locale_facet__Incref)
10511 VTABLE_ADD_FUNC(locale_facet__Decref)
10512 #endif
10513 VTABLE_ADD_FUNC(numpunct_char_do_decimal_point)
10514 VTABLE_ADD_FUNC(numpunct_char_do_thousands_sep)
10515 VTABLE_ADD_FUNC(numpunct_char_do_grouping)
10516 VTABLE_ADD_FUNC(numpunct_char_do_falsename)
10517 VTABLE_ADD_FUNC(numpunct_char_do_truename));
10518 __ASM_VTABLE(numpunct_wchar,
10519 VTABLE_ADD_FUNC(numpunct_wchar_vector_dtor)
10520 #if _MSVCP_VER >= 110
10521 VTABLE_ADD_FUNC(locale_facet__Incref)
10522 VTABLE_ADD_FUNC(locale_facet__Decref)
10523 #endif
10524 VTABLE_ADD_FUNC(numpunct_wchar_do_decimal_point)
10525 VTABLE_ADD_FUNC(numpunct_wchar_do_thousands_sep)
10526 VTABLE_ADD_FUNC(numpunct_wchar_do_grouping)
10527 VTABLE_ADD_FUNC(numpunct_wchar_do_falsename)
10528 VTABLE_ADD_FUNC(numpunct_wchar_do_truename));
10529 __ASM_VTABLE(numpunct_short,
10530 VTABLE_ADD_FUNC(numpunct_wchar_vector_dtor)
10531 #if _MSVCP_VER >= 110
10532 VTABLE_ADD_FUNC(locale_facet__Incref)
10533 VTABLE_ADD_FUNC(locale_facet__Decref)
10534 #endif
10535 VTABLE_ADD_FUNC(numpunct_wchar_do_decimal_point)
10536 VTABLE_ADD_FUNC(numpunct_wchar_do_thousands_sep)
10537 VTABLE_ADD_FUNC(numpunct_wchar_do_grouping)
10538 VTABLE_ADD_FUNC(numpunct_wchar_do_falsename)
10539 VTABLE_ADD_FUNC(numpunct_wchar_do_truename));
10540 __ASM_VTABLE(num_get_char,
10541 VTABLE_ADD_FUNC(num_get_char_vector_dtor)
10542 #if _MSVCP_VER >= 110
10543 VTABLE_ADD_FUNC(locale_facet__Incref)
10544 VTABLE_ADD_FUNC(locale_facet__Decref)
10545 #endif
10546 VTABLE_ADD_FUNC(num_get_char_do_get_void)
10547 VTABLE_ADD_FUNC(num_get_char_do_get_double)
10548 VTABLE_ADD_FUNC(num_get_char_do_get_double)
10549 VTABLE_ADD_FUNC(num_get_char_do_get_float)
10550 VTABLE_ADD_FUNC(num_get_char_do_get_uint64)
10551 VTABLE_ADD_FUNC(num_get_char_do_get_int64)
10552 VTABLE_ADD_FUNC(num_get_char_do_get_ulong)
10553 VTABLE_ADD_FUNC(num_get_char_do_get_long)
10554 VTABLE_ADD_FUNC(num_get_char_do_get_uint)
10555 VTABLE_ADD_FUNC(num_get_char_do_get_ushort)
10556 VTABLE_ADD_FUNC(num_get_char_do_get_bool));
10557 __ASM_VTABLE(num_get_short,
10558 VTABLE_ADD_FUNC(num_get_wchar_vector_dtor)
10559 #if _MSVCP_VER >= 110
10560 VTABLE_ADD_FUNC(locale_facet__Incref)
10561 VTABLE_ADD_FUNC(locale_facet__Decref)
10562 #endif
10563 VTABLE_ADD_FUNC(num_get_short_do_get_void)
10564 VTABLE_ADD_FUNC(num_get_short_do_get_double)
10565 VTABLE_ADD_FUNC(num_get_short_do_get_double)
10566 VTABLE_ADD_FUNC(num_get_short_do_get_float)
10567 VTABLE_ADD_FUNC(num_get_short_do_get_uint64)
10568 VTABLE_ADD_FUNC(num_get_short_do_get_int64)
10569 VTABLE_ADD_FUNC(num_get_short_do_get_ulong)
10570 VTABLE_ADD_FUNC(num_get_short_do_get_long)
10571 VTABLE_ADD_FUNC(num_get_short_do_get_uint)
10572 VTABLE_ADD_FUNC(num_get_short_do_get_ushort)
10573 VTABLE_ADD_FUNC(num_get_short_do_get_bool));
10574 __ASM_VTABLE(num_get_wchar,
10575 VTABLE_ADD_FUNC(num_get_wchar_vector_dtor)
10576 #if _MSVCP_VER >= 110
10577 VTABLE_ADD_FUNC(locale_facet__Incref)
10578 VTABLE_ADD_FUNC(locale_facet__Decref)
10579 #endif
10580 VTABLE_ADD_FUNC(num_get_wchar_do_get_void)
10581 VTABLE_ADD_FUNC(num_get_wchar_do_get_double)
10582 VTABLE_ADD_FUNC(num_get_wchar_do_get_double)
10583 VTABLE_ADD_FUNC(num_get_wchar_do_get_float)
10584 VTABLE_ADD_FUNC(num_get_wchar_do_get_uint64)
10585 VTABLE_ADD_FUNC(num_get_wchar_do_get_int64)
10586 VTABLE_ADD_FUNC(num_get_wchar_do_get_ulong)
10587 VTABLE_ADD_FUNC(num_get_wchar_do_get_long)
10588 VTABLE_ADD_FUNC(num_get_wchar_do_get_uint)
10589 VTABLE_ADD_FUNC(num_get_wchar_do_get_ushort)
10590 VTABLE_ADD_FUNC(num_get_wchar_do_get_bool));
10591 __ASM_VTABLE(num_put_char,
10592 VTABLE_ADD_FUNC(num_put_char_vector_dtor)
10593 #if _MSVCP_VER >= 110
10594 VTABLE_ADD_FUNC(locale_facet__Incref)
10595 VTABLE_ADD_FUNC(locale_facet__Decref)
10596 #endif
10597 VTABLE_ADD_FUNC(num_put_char_do_put_ptr)
10598 VTABLE_ADD_FUNC(num_put_char_do_put_double)
10599 VTABLE_ADD_FUNC(num_put_char_do_put_double)
10600 VTABLE_ADD_FUNC(num_put_char_do_put_uint64)
10601 VTABLE_ADD_FUNC(num_put_char_do_put_int64)
10602 VTABLE_ADD_FUNC(num_put_char_do_put_ulong)
10603 VTABLE_ADD_FUNC(num_put_char_do_put_long)
10604 VTABLE_ADD_FUNC(num_put_char_do_put_bool));
10605 __ASM_VTABLE(num_put_wchar,
10606 VTABLE_ADD_FUNC(num_put_wchar_vector_dtor)
10607 #if _MSVCP_VER >= 110
10608 VTABLE_ADD_FUNC(locale_facet__Incref)
10609 VTABLE_ADD_FUNC(locale_facet__Decref)
10610 #endif
10611 VTABLE_ADD_FUNC(num_put_wchar_do_put_ptr)
10612 VTABLE_ADD_FUNC(num_put_wchar_do_put_double)
10613 VTABLE_ADD_FUNC(num_put_wchar_do_put_double)
10614 VTABLE_ADD_FUNC(num_put_wchar_do_put_uint64)
10615 VTABLE_ADD_FUNC(num_put_wchar_do_put_int64)
10616 VTABLE_ADD_FUNC(num_put_wchar_do_put_ulong)
10617 VTABLE_ADD_FUNC(num_put_wchar_do_put_long)
10618 VTABLE_ADD_FUNC(num_put_wchar_do_put_bool));
10619 __ASM_VTABLE(num_put_short,
10620 VTABLE_ADD_FUNC(num_put_wchar_vector_dtor)
10621 #if _MSVCP_VER >= 110
10622 VTABLE_ADD_FUNC(locale_facet__Incref)
10623 VTABLE_ADD_FUNC(locale_facet__Decref)
10624 #endif
10625 VTABLE_ADD_FUNC(num_put_short_do_put_ptr)
10626 VTABLE_ADD_FUNC(num_put_short_do_put_double)
10627 VTABLE_ADD_FUNC(num_put_short_do_put_double)
10628 VTABLE_ADD_FUNC(num_put_short_do_put_uint64)
10629 VTABLE_ADD_FUNC(num_put_short_do_put_int64)
10630 VTABLE_ADD_FUNC(num_put_short_do_put_ulong)
10631 VTABLE_ADD_FUNC(num_put_short_do_put_long)
10632 VTABLE_ADD_FUNC(num_put_short_do_put_bool));
10633 __ASM_VTABLE(time_put_char,
10634 VTABLE_ADD_FUNC(time_put_char_vector_dtor)
10635 #if _MSVCP_VER >= 110
10636 VTABLE_ADD_FUNC(locale_facet__Incref)
10637 VTABLE_ADD_FUNC(locale_facet__Decref)
10638 #endif
10639 VTABLE_ADD_FUNC(time_put_char_do_put));
10640 __ASM_VTABLE(time_put_wchar,
10641 VTABLE_ADD_FUNC(time_put_wchar_vector_dtor)
10642 #if _MSVCP_VER >= 110
10643 VTABLE_ADD_FUNC(locale_facet__Incref)
10644 VTABLE_ADD_FUNC(locale_facet__Decref)
10645 #endif
10646 VTABLE_ADD_FUNC(time_put_wchar_do_put));
10647 __ASM_VTABLE(time_put_short,
10648 VTABLE_ADD_FUNC(time_put_wchar_vector_dtor)
10649 #if _MSVCP_VER >= 110
10650 VTABLE_ADD_FUNC(locale_facet__Incref)
10651 VTABLE_ADD_FUNC(locale_facet__Decref)
10652 #endif
10653 VTABLE_ADD_FUNC(time_put_wchar_do_put));
10654 #ifndef __GNUC__
10656 #endif
10658 void init_locale(void *base)
10660 #ifdef __x86_64__
10661 init_locale_facet_rtti(base);
10662 init_collate_char_rtti(base);
10663 init_collate_wchar_rtti(base);
10664 init_collate_short_rtti(base);
10665 init_ctype_base_rtti(base);
10666 init_ctype_char_rtti(base);
10667 init_ctype_wchar_rtti(base);
10668 init_ctype_short_rtti(base);
10669 init_codecvt_base_rtti(base);
10670 init_codecvt_char_rtti(base);
10671 init_codecvt_wchar_rtti(base);
10672 init_codecvt_short_rtti(base);
10673 init_numpunct_char_rtti(base);
10674 init_numpunct_wchar_rtti(base);
10675 init_numpunct_short_rtti(base);
10676 init_num_get_char_rtti(base);
10677 init_num_get_wchar_rtti(base);
10678 init_num_get_short_rtti(base);
10679 init_num_put_char_rtti(base);
10680 init_num_put_wchar_rtti(base);
10681 init_num_put_short_rtti(base);
10682 init_time_put_char_rtti(base);
10683 init_time_put_wchar_rtti(base);
10684 init_time_put_short_rtti(base);
10685 #endif
10688 void free_locale(void)
10690 facets_elem *iter, *safe;
10692 if(global_locale) {
10693 locale__Locimp_dtor(global_locale);
10694 locale_dtor(&classic_locale);
10697 LIST_FOR_EACH_ENTRY_SAFE(iter, safe, &lazy_facets, facets_elem, entry) {
10698 list_remove(&iter->entry);
10699 if(call_locale_facet__Decref(iter->fac))
10700 call_locale_facet_vector_dtor(iter->fac, 1);
10701 MSVCRT_operator_delete(iter);