wined3d: Use a separate STATE_TRANSFORM(WINED3D_TS_VIEW) state handler in the GLSL...
[wine/multimedia.git] / dlls / msvcp90 / locale.c
blobe7d816bd0b218f228a913b672058c421f8440c0a
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 typedef enum {
42 DATEORDER_no_order,
43 DATEORDER_dmy,
44 DATEORDER_mdy,
45 DATEORDER_ymd,
46 DATEORDER_ydm
47 } dateorder;
49 char* __cdecl _Getdays(void);
50 char* __cdecl _Getmonths(void);
51 void* __cdecl _Gettnames(void);
52 unsigned int __cdecl ___lc_codepage_func(void);
53 int __cdecl ___lc_collate_cp_func(void);
54 const unsigned short* __cdecl __pctype_func(void);
55 const locale_facet* __thiscall locale__Getfacet(const locale*, MSVCP_size_t);
56 MSVCP_size_t __cdecl _Strftime(char*, MSVCP_size_t, const char*,
57 const struct tm*, struct __lc_time_data*);
58 const locale* __cdecl locale_classic(void);
60 #if _MSVCP_VER >= 110
61 static LCID* ___lc_handle_func(void)
63 LCID *ret;
65 _locale_t loc = _get_current_locale();
66 ret = loc->locinfo->lc_handle;
67 _free_locale(loc);
68 return ret;
70 #else
71 LCID* __cdecl ___lc_handle_func(void);
72 #endif
74 #if _MSVCP_VER < 100
75 #define locale_string basic_string_char
76 #define locale_string_char_ctor_cstr(this,str) MSVCP_basic_string_char_ctor_cstr(this,str)
77 #define locale_string_char_copy_ctor(this,copy) MSVCP_basic_string_char_copy_ctor(this,copy)
78 #define locale_string_char_dtor(this) MSVCP_basic_string_char_dtor(this)
79 #define locale_string_char_c_str(this) MSVCP_basic_string_char_c_str(this)
80 #define locale_string_char_assign(this,assign) MSVCP_basic_string_char_assign(this,assign)
81 #else
82 #define locale_string _Yarn_char
83 #define locale_string_char_ctor_cstr(this,str) _Yarn_char_ctor_cstr(this,str)
84 #define locale_string_char_copy_ctor(this,copy) _Yarn_char_copy_ctor(this,copy)
85 #define locale_string_char_dtor(this) _Yarn_char_dtor(this)
86 #define locale_string_char_c_str(this) _Yarn_char_c_str(this)
87 #define locale_string_char_assign(this,assign) _Yarn_char_op_assign(this,assign)
88 #endif
90 typedef int category;
92 typedef struct {
93 MSVCP_size_t id;
94 } locale_id;
96 typedef struct _locale__Locimp {
97 locale_facet facet;
98 locale_facet **facetvec;
99 MSVCP_size_t facet_cnt;
100 category catmask;
101 MSVCP_bool transparent;
102 locale_string name;
103 } locale__Locimp;
105 typedef struct {
106 void *timeptr;
107 } _Timevec;
109 typedef struct {
110 _Lockit lock;
111 locale_string days;
112 locale_string months;
113 locale_string oldlocname;
114 locale_string newlocname;
115 } _Locinfo;
117 typedef struct {
118 LCID handle;
119 unsigned page;
120 } _Collvec;
122 typedef struct {
123 locale_facet facet;
124 _Collvec coll;
125 } collate;
127 typedef struct {
128 locale_facet facet;
129 const char *grouping;
130 char dp;
131 char sep;
132 const char *false_name;
133 const char *true_name;
134 } numpunct_char;
136 typedef struct {
137 locale_facet facet;
138 const char *grouping;
139 wchar_t dp;
140 wchar_t sep;
141 const wchar_t *false_name;
142 const wchar_t *true_name;
143 } numpunct_wchar;
145 typedef struct {
146 locale_facet facet;
147 _Timevec time;
148 _Cvtvec cvt;
149 } time_put;
151 typedef struct {
152 locale_facet facet;
153 const char *days;
154 const char *months;
155 dateorder dateorder;
156 _Cvtvec cvt;
157 } time_get_char;
159 /* ?_Id_cnt@id@locale@std@@0HA */
160 int locale_id__Id_cnt = 0;
162 static locale classic_locale;
164 /* ?_Global@_Locimp@locale@std@@0PAV123@A */
165 /* ?_Global@_Locimp@locale@std@@0PEAV123@EA */
166 locale__Locimp *global_locale = NULL;
168 /* ?_Clocptr@_Locimp@locale@std@@0PAV123@A */
169 /* ?_Clocptr@_Locimp@locale@std@@0PEAV123@EA */
170 locale__Locimp *locale__Locimp__Clocptr = NULL;
172 static char istreambuf_iterator_char_val(istreambuf_iterator_char *this)
174 if(this->strbuf && !this->got) {
175 int c = basic_streambuf_char_sgetc(this->strbuf);
176 if(c == EOF)
177 this->strbuf = NULL;
178 else
179 this->val = c;
182 this->got = TRUE;
183 return this->val;
186 static wchar_t istreambuf_iterator_wchar_val(istreambuf_iterator_wchar *this)
188 if(this->strbuf && !this->got) {
189 unsigned short c = basic_streambuf_wchar_sgetc(this->strbuf);
190 if(c == WEOF)
191 this->strbuf = NULL;
192 else
193 this->val = c;
196 this->got = TRUE;
197 return this->val;
200 static void istreambuf_iterator_char_inc(istreambuf_iterator_char *this)
202 if(!this->strbuf || basic_streambuf_char_sbumpc(this->strbuf)==EOF) {
203 this->strbuf = NULL;
204 this->got = TRUE;
205 }else {
206 this->got = FALSE;
207 istreambuf_iterator_char_val(this);
211 static void istreambuf_iterator_wchar_inc(istreambuf_iterator_wchar *this)
213 if(!this->strbuf || basic_streambuf_wchar_sbumpc(this->strbuf)==WEOF) {
214 this->strbuf = NULL;
215 this->got = TRUE;
216 }else {
217 this->got = FALSE;
218 istreambuf_iterator_wchar_val(this);
222 static void ostreambuf_iterator_char_put(ostreambuf_iterator_char *this, char ch)
224 if(this->failed || basic_streambuf_char_sputc(this->strbuf, ch)==EOF)
225 this->failed = TRUE;
228 static void ostreambuf_iterator_wchar_put(ostreambuf_iterator_wchar *this, wchar_t ch)
230 if(this->failed || basic_streambuf_wchar_sputc(this->strbuf, ch)==WEOF)
231 this->failed = TRUE;
234 /* ??1facet@locale@std@@UAE@XZ */
235 /* ??1facet@locale@std@@UEAA@XZ */
236 /* ??1facet@locale@std@@MAA@XZ */
237 /* ??1facet@locale@std@@MAE@XZ */
238 /* ??1facet@locale@std@@MEAA@XZ */
239 DEFINE_THISCALL_WRAPPER(locale_facet_dtor, 4)
240 void __thiscall locale_facet_dtor(locale_facet *this)
242 TRACE("(%p)\n", this);
245 DEFINE_THISCALL_WRAPPER(locale_facet_vector_dtor, 8)
246 #define call_locale_facet_vector_dtor(this, flags) CALL_VTBL_FUNC(this, 0, \
247 locale_facet*, (locale_facet*, unsigned int), (this, flags))
248 locale_facet* __thiscall locale_facet_vector_dtor(locale_facet *this, unsigned int flags)
250 TRACE("(%p %x)\n", this, flags);
251 if(flags & 2) {
252 /* we have an array, with the number of elements stored before the first object */
253 INT_PTR i, *ptr = (INT_PTR *)this-1;
255 for(i=*ptr-1; i>=0; i--)
256 locale_facet_dtor(this+i);
257 MSVCRT_operator_delete(ptr);
258 } else {
259 locale_facet_dtor(this);
260 if(flags & 1)
261 MSVCRT_operator_delete(this);
264 return this;
267 typedef struct
269 locale_facet *fac;
270 struct list entry;
271 } facets_elem;
272 static struct list lazy_facets = LIST_INIT(lazy_facets);
274 /* Not exported from msvcp90 */
275 /* ?facet_Register@facet@locale@std@@CAXPAV123@@Z */
276 /* ?facet_Register@facet@locale@std@@CAXPEAV123@@Z */
277 void __cdecl locale_facet_register(locale_facet *add)
279 facets_elem *head = MSVCRT_operator_new(sizeof(*head));
280 if(!head) {
281 ERR("Out of memory\n");
282 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
285 head->fac = add;
286 list_add_head(&lazy_facets, &head->entry);
289 /* Not exported from msvcp90 */
290 /* ?_Register@facet@locale@std@@QAEXXZ */
291 /* ?_Register@facet@locale@std@@QEAAXXZ */
292 DEFINE_THISCALL_WRAPPER(locale_facet__Register, 4)
293 void __thiscall locale_facet__Register(locale_facet *this)
295 TRACE("(%p)\n", this);
296 locale_facet_register(this);
299 /* Not exported from msvcp90 */
300 /* ??_7facet@locale@std@@6B@ */
301 extern const vtable_ptr MSVCP_locale_facet_vtable;
303 /* ??0id@locale@std@@QAE@I@Z */
304 /* ??0id@locale@std@@QEAA@_K@Z */
305 DEFINE_THISCALL_WRAPPER(locale_id_ctor_id, 8)
306 locale_id* __thiscall locale_id_ctor_id(locale_id *this, MSVCP_size_t id)
308 TRACE("(%p %lu)\n", this, id);
310 this->id = id;
311 return this;
314 /* ??_Fid@locale@std@@QAEXXZ */
315 /* ??_Fid@locale@std@@QEAAXXZ */
316 DEFINE_THISCALL_WRAPPER(locale_id_ctor, 4)
317 locale_id* __thiscall locale_id_ctor(locale_id *this)
319 TRACE("(%p)\n", this);
321 this->id = 0;
322 return this;
325 /* ??Bid@locale@std@@QAEIXZ */
326 /* ??Bid@locale@std@@QEAA_KXZ */
327 DEFINE_THISCALL_WRAPPER(locale_id_operator_size_t, 4)
328 MSVCP_size_t __thiscall locale_id_operator_size_t(locale_id *this)
330 _Lockit lock;
332 TRACE("(%p)\n", this);
334 if(!this->id) {
335 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
336 this->id = ++locale_id__Id_cnt;
337 _Lockit_dtor(&lock);
340 return this->id;
343 /* ?_Id_cnt_func@id@locale@std@@CAAAHXZ */
344 /* ?_Id_cnt_func@id@locale@std@@CAAEAHXZ */
345 int* __cdecl locale_id__Id_cnt_func(void)
347 TRACE("\n");
348 return &locale_id__Id_cnt;
351 /* ??_Ffacet@locale@std@@QAEXXZ */
352 /* ??_Ffacet@locale@std@@QEAAXXZ */
353 DEFINE_THISCALL_WRAPPER(locale_facet_ctor, 4)
354 locale_facet* __thiscall locale_facet_ctor(locale_facet *this)
356 TRACE("(%p)\n", this);
357 this->vtable = &MSVCP_locale_facet_vtable;
358 this->refs = 0;
359 return this;
362 /* ??0facet@locale@std@@IAE@I@Z */
363 /* ??0facet@locale@std@@IEAA@_K@Z */
364 DEFINE_THISCALL_WRAPPER(locale_facet_ctor_refs, 8)
365 locale_facet* __thiscall locale_facet_ctor_refs(locale_facet *this, MSVCP_size_t refs)
367 TRACE("(%p %lu)\n", this, refs);
368 this->vtable = &MSVCP_locale_facet_vtable;
369 this->refs = refs;
370 return this;
373 /* ?_Incref@facet@locale@std@@QAEXXZ */
374 /* ?_Incref@facet@locale@std@@QEAAXXZ */
375 /* ?_Incref@facet@locale@std@@UAEXXZ */
376 /* ?_Incref@facet@locale@std@@UEAAXXZ */
377 #if _MSVCP_VER >= 110
378 #define call_locale_facet__Incref(this) CALL_VTBL_FUNC(this, 4, void, (locale_facet*), (this))
379 #else
380 #define call_locale_facet__Incref locale_facet__Incref
381 #endif
382 DEFINE_THISCALL_WRAPPER(locale_facet__Incref, 4)
383 void __thiscall locale_facet__Incref(locale_facet *this)
385 _Lockit lock;
387 TRACE("(%p)\n", this);
389 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
390 this->refs++;
391 _Lockit_dtor(&lock);
394 /* ?_Decref@facet@locale@std@@QAEPAV123@XZ */
395 /* ?_Decref@facet@locale@std@@QEAAPEAV123@XZ */
396 /* ?_Decref@facet@locale@std@@UAEPAV_Facet_base@3@XZ */
397 /* ?_Decref@facet@locale@std@@UEAAPEAV_Facet_base@3@XZ */
398 #if _MSVCP_VER >= 110
399 #define call_locale_facet__Decref(this) CALL_VTBL_FUNC(this, 8, \
400 locale_facet*, (locale_facet*), (this))
401 #else
402 #define call_locale_facet__Decref locale_facet__Decref
403 #endif
404 DEFINE_THISCALL_WRAPPER(locale_facet__Decref, 4)
405 locale_facet* __thiscall locale_facet__Decref(locale_facet *this)
407 _Lockit lock;
408 locale_facet *ret;
410 TRACE("(%p)\n", this);
412 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
413 if(this->refs)
414 this->refs--;
416 ret = this->refs ? NULL : this;
417 _Lockit_dtor(&lock);
419 return ret;
422 /* ?_Getcat@facet@locale@std@@SAIPAPBV123@PBV23@@Z */
423 /* ?_Getcat@facet@locale@std@@SA_KPEAPEBV123@PEBV23@@Z */
424 MSVCP_size_t __cdecl locale_facet__Getcat(const locale_facet **facet, const locale *loc)
426 TRACE("(%p %p)\n", facet, loc);
427 return -1;
430 /* ?_Getcat@facet@locale@std@@SAIPAPBV123@@Z */
431 /* ?_Getcat@facet@locale@std@@SA_KPEAPEBV123@@Z */
432 MSVCP_size_t __cdecl locale_facet__Getcat_old(const locale_facet **facet)
434 TRACE("(%p)\n", facet);
435 return -1;
438 /* ??0_Timevec@std@@QAE@ABV01@@Z */
439 /* ??0_Timevec@std@@QEAA@AEBV01@@Z */
440 /* This copy constructor modifies copied object */
441 DEFINE_THISCALL_WRAPPER(_Timevec_copy_ctor, 8)
442 _Timevec* __thiscall _Timevec_copy_ctor(_Timevec *this, _Timevec *copy)
444 TRACE("(%p %p)\n", this, copy);
445 this->timeptr = copy->timeptr;
446 copy->timeptr = NULL;
447 return this;
450 /* ??0_Timevec@std@@QAE@PAX@Z */
451 /* ??0_Timevec@std@@QEAA@PEAX@Z */
452 DEFINE_THISCALL_WRAPPER(_Timevec_ctor_timeptr, 8)
453 _Timevec* __thiscall _Timevec_ctor_timeptr(_Timevec *this, void *timeptr)
455 TRACE("(%p %p)\n", this, timeptr);
456 this->timeptr = timeptr;
457 return this;
460 /* ??_F_Timevec@std@@QAEXXZ */
461 /* ??_F_Timevec@std@@QEAAXXZ */
462 DEFINE_THISCALL_WRAPPER(_Timevec_ctor, 4)
463 _Timevec* __thiscall _Timevec_ctor(_Timevec *this)
465 TRACE("(%p)\n", this);
466 this->timeptr = NULL;
467 return this;
470 /* ??1_Timevec@std@@QAE@XZ */
471 /* ??1_Timevec@std@@QEAA@XZ */
472 DEFINE_THISCALL_WRAPPER(_Timevec_dtor, 4)
473 void __thiscall _Timevec_dtor(_Timevec *this)
475 TRACE("(%p)\n", this);
476 free(this->timeptr);
479 /* ??4_Timevec@std@@QAEAAV01@ABV01@@Z */
480 /* ??4_Timevec@std@@QEAAAEAV01@AEBV01@@Z */
481 DEFINE_THISCALL_WRAPPER(_Timevec_op_assign, 8)
482 _Timevec* __thiscall _Timevec_op_assign(_Timevec *this, _Timevec *right)
484 TRACE("(%p %p)\n", this, right);
485 this->timeptr = right->timeptr;
486 right->timeptr = NULL;
487 return this;
490 /* ?_Getptr@_Timevec@std@@QBEPAXXZ */
491 /* ?_Getptr@_Timevec@std@@QEBAPEAXXZ */
492 DEFINE_THISCALL_WRAPPER(_Timevec__Getptr, 4)
493 void* __thiscall _Timevec__Getptr(_Timevec *this)
495 TRACE("(%p)\n", this);
496 return this->timeptr;
499 /* ?_Locinfo_ctor@_Locinfo@std@@SAXPAV12@HPBD@Z */
500 /* ?_Locinfo_ctor@_Locinfo@std@@SAXPEAV12@HPEBD@Z */
501 _Locinfo* __cdecl _Locinfo__Locinfo_ctor_cat_cstr(_Locinfo *locinfo, int category, const char *locstr)
503 const char *locale = NULL;
505 /* This function is probably modifying more global objects */
506 FIXME("(%p %d %s) semi-stub\n", locinfo, category, locstr);
508 if(!locstr)
509 throw_exception(EXCEPTION_RUNTIME_ERROR, "bad locale name");
511 _Lockit_ctor_locktype(&locinfo->lock, _LOCK_LOCALE);
512 locale_string_char_ctor_cstr(&locinfo->days, "");
513 locale_string_char_ctor_cstr(&locinfo->months, "");
514 locale_string_char_ctor_cstr(&locinfo->oldlocname, setlocale(LC_ALL, NULL));
516 if(category)
517 locale = setlocale(LC_ALL, locstr);
518 else
519 locale = setlocale(LC_ALL, NULL);
521 if(locale)
522 locale_string_char_ctor_cstr(&locinfo->newlocname, locale);
523 else
524 locale_string_char_ctor_cstr(&locinfo->newlocname, "*");
526 return locinfo;
529 /* ??0_Locinfo@std@@QAE@HPBD@Z */
530 /* ??0_Locinfo@std@@QEAA@HPEBD@Z */
531 DEFINE_THISCALL_WRAPPER(_Locinfo_ctor_cat_cstr, 12)
532 _Locinfo* __thiscall _Locinfo_ctor_cat_cstr(_Locinfo *this, int category, const char *locstr)
534 return _Locinfo__Locinfo_ctor_cat_cstr(this, category, locstr);
537 /* ?_Locinfo_ctor@_Locinfo@std@@SAXPAV12@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@@Z */
538 /* ?_Locinfo_ctor@_Locinfo@std@@SAXPEAV12@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@@Z */
539 _Locinfo* __cdecl _Locinfo__Locinfo_ctor_bstr(_Locinfo *locinfo, const basic_string_char *locstr)
541 return _Locinfo__Locinfo_ctor_cat_cstr(locinfo, 1/*FIXME*/, MSVCP_basic_string_char_c_str(locstr));
544 /* ??0_Locinfo@std@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@@Z */
545 /* ??0_Locinfo@std@@QEAA@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@@Z */
546 DEFINE_THISCALL_WRAPPER(_Locinfo_ctor_bstr, 8)
547 _Locinfo* __thiscall _Locinfo_ctor_bstr(_Locinfo *this, const basic_string_char *locstr)
549 return _Locinfo__Locinfo_ctor_cat_cstr(this, 1/*FIXME*/, MSVCP_basic_string_char_c_str(locstr));
552 /* ?_Locinfo_ctor@_Locinfo@std@@SAXPAV12@PBD@Z */
553 /* ?_Locinfo_ctor@_Locinfo@std@@SAXPEAV12@PEBD@Z */
554 _Locinfo* __cdecl _Locinfo__Locinfo_ctor_cstr(_Locinfo *locinfo, const char *locstr)
556 return _Locinfo__Locinfo_ctor_cat_cstr(locinfo, 1/*FIXME*/, locstr);
559 /* ??0_Locinfo@std@@QAE@PBD@Z */
560 /* ??0_Locinfo@std@@QEAA@PEBD@Z */
561 DEFINE_THISCALL_WRAPPER(_Locinfo_ctor_cstr, 8)
562 _Locinfo* __thiscall _Locinfo_ctor_cstr(_Locinfo *this, const char *locstr)
564 return _Locinfo__Locinfo_ctor_cat_cstr(this, 1/*FIXME*/, locstr);
567 /* ?_Locinfo_dtor@_Locinfo@std@@SAXPAV12@@Z */
568 /* ?_Locinfo_dtor@_Locinfo@std@@SAXPEAV12@@Z */
569 void __cdecl _Locinfo__Locinfo_dtor(_Locinfo *locinfo)
571 TRACE("(%p)\n", locinfo);
573 setlocale(LC_ALL, locale_string_char_c_str(&locinfo->oldlocname));
574 locale_string_char_dtor(&locinfo->days);
575 locale_string_char_dtor(&locinfo->months);
576 locale_string_char_dtor(&locinfo->oldlocname);
577 locale_string_char_dtor(&locinfo->newlocname);
578 _Lockit_dtor(&locinfo->lock);
581 /* ??_F_Locinfo@std@@QAEXXZ */
582 /* ??_F_Locinfo@std@@QEAAXXZ */
583 DEFINE_THISCALL_WRAPPER(_Locinfo_ctor, 4)
584 _Locinfo* __thiscall _Locinfo_ctor(_Locinfo *this)
586 return _Locinfo__Locinfo_ctor_cat_cstr(this, 1/*FIXME*/, "C");
589 /* ??1_Locinfo@std@@QAE@XZ */
590 /* ??1_Locinfo@std@@QEAA@XZ */
591 DEFINE_THISCALL_WRAPPER(_Locinfo_dtor, 4)
592 void __thiscall _Locinfo_dtor(_Locinfo *this)
594 _Locinfo__Locinfo_dtor(this);
597 /* ?_Locinfo_Addcats@_Locinfo@std@@SAAAV12@PAV12@HPBD@Z */
598 /* ?_Locinfo_Addcats@_Locinfo@std@@SAAEAV12@PEAV12@HPEBD@Z */
599 _Locinfo* __cdecl _Locinfo__Locinfo_Addcats(_Locinfo *locinfo, int category, const char *locstr)
601 const char *locale = NULL;
603 /* This function is probably modifying more global objects */
604 FIXME("(%p %d %s) semi-stub\n", locinfo, category, locstr);
605 if(!locstr)
606 throw_exception(EXCEPTION_RUNTIME_ERROR, "bad locale name");
608 locale_string_char_dtor(&locinfo->newlocname);
610 if(category)
611 locale = setlocale(LC_ALL, locstr);
612 else
613 locale = setlocale(LC_ALL, NULL);
615 if(locale)
616 locale_string_char_ctor_cstr(&locinfo->newlocname, locale);
617 else
618 locale_string_char_ctor_cstr(&locinfo->newlocname, "*");
620 return locinfo;
623 /* ?_Addcats@_Locinfo@std@@QAEAAV12@HPBD@Z */
624 /* ?_Addcats@_Locinfo@std@@QEAAAEAV12@HPEBD@Z */
625 DEFINE_THISCALL_WRAPPER(_Locinfo__Addcats, 12)
626 _Locinfo* __thiscall _Locinfo__Addcats(_Locinfo *this, int category, const char *locstr)
628 return _Locinfo__Locinfo_Addcats(this, category, locstr);
631 /* _Getcoll */
632 ULONGLONG __cdecl _Getcoll(void)
634 union {
635 _Collvec collvec;
636 ULONGLONG ull;
637 } ret;
639 TRACE("\n");
641 ret.collvec.page = ___lc_collate_cp_func();
642 ret.collvec.handle = ___lc_handle_func()[LC_COLLATE];
643 return ret.ull;
646 /* ?_Getcoll@_Locinfo@std@@QBE?AU_Collvec@@XZ */
647 /* ?_Getcoll@_Locinfo@std@@QEBA?AU_Collvec@@XZ */
648 DEFINE_THISCALL_WRAPPER(_Locinfo__Getcoll, 8)
649 _Collvec* __thiscall _Locinfo__Getcoll(const _Locinfo *this, _Collvec *ret)
651 ULONGLONG ull = _Getcoll();
652 memcpy(ret, &ull, sizeof(ull));
653 return ret;
656 /* _Getctype */
657 _Ctypevec* __cdecl _Getctype(_Ctypevec *ret)
659 short *table;
661 TRACE("\n");
663 ret->page = ___lc_codepage_func();
664 #if _MSVCP_VER < 110
665 ret->handle = ___lc_handle_func()[LC_COLLATE];
666 #else
667 /* FIXME: use ___lc_locale_name_func() */
668 ret->name = NULL;
669 #endif
670 ret->delfl = TRUE;
671 table = malloc(sizeof(short[256]));
672 if(!table) throw_exception(EXCEPTION_BAD_ALLOC, NULL);
673 memcpy(table, __pctype_func(), sizeof(short[256]));
674 ret->table = table;
675 return ret;
678 /* ?_Getctype@_Locinfo@std@@QBE?AU_Ctypevec@@XZ */
679 /* ?_Getctype@_Locinfo@std@@QEBA?AU_Ctypevec@@XZ */
680 DEFINE_THISCALL_WRAPPER(_Locinfo__Getctype, 8)
681 _Ctypevec* __thiscall _Locinfo__Getctype(const _Locinfo *this, _Ctypevec *ret)
683 return _Getctype(ret);
686 /* _Getcvt */
687 ULONGLONG __cdecl _Getcvt(void)
689 union {
690 _Cvtvec cvtvec;
691 ULONGLONG ull;
692 } ret;
694 TRACE("\n");
696 ret.cvtvec.page = ___lc_codepage_func();
697 ret.cvtvec.handle = ___lc_handle_func()[LC_CTYPE];
698 return ret.ull;
701 /* ?_Getcvt@_Locinfo@std@@QBE?AU_Cvtvec@@XZ */
702 /* ?_Getcvt@_Locinfo@std@@QEBA?AU_Cvtvec@@XZ */
703 DEFINE_THISCALL_WRAPPER(_Locinfo__Getcvt, 8)
704 _Cvtvec* __thiscall _Locinfo__Getcvt(const _Locinfo *this, _Cvtvec *ret)
706 ULONGLONG ull = _Getcvt();
707 memcpy(ret, &ull, sizeof(ull));
708 return ret;
711 int __cdecl _Getdateorder(void)
713 WCHAR date_fmt[2];
715 if(!GetLocaleInfoW(___lc_handle_func()[LC_TIME], LOCALE_ILDATE,
716 date_fmt, sizeof(date_fmt)/sizeof(*date_fmt)))
717 return DATEORDER_no_order;
719 if(*date_fmt == '0') return DATEORDER_mdy;
720 if(*date_fmt == '1') return DATEORDER_dmy;
721 if(*date_fmt == '2') return DATEORDER_ymd;
722 return DATEORDER_no_order;
725 /* ?_Getdateorder@_Locinfo@std@@QBEHXZ */
726 /* ?_Getdateorder@_Locinfo@std@@QEBAHXZ */
727 DEFINE_THISCALL_WRAPPER(_Locinfo__Getdateorder, 4)
728 int __thiscall _Locinfo__Getdateorder(const _Locinfo *this)
730 TRACE("(%p)\n", this);
731 return _Getdateorder();
734 /* ?_Getdays@_Locinfo@std@@QBEPBDXZ */
735 /* ?_Getdays@_Locinfo@std@@QEBAPEBDXZ */
736 DEFINE_THISCALL_WRAPPER(_Locinfo__Getdays, 4)
737 const char* __thiscall _Locinfo__Getdays(_Locinfo *this)
739 char *days = _Getdays();
740 const char *ret;
742 TRACE("(%p)\n", this);
744 if(days) {
745 locale_string_char_dtor(&this->days);
746 locale_string_char_ctor_cstr(&this->days, days);
747 free(days);
750 ret = locale_string_char_c_str(&this->days);
751 if (!ret[0]) ret = ":Sun:Sunday:Mon:Monday:Tue:Tuesday:Wed:Wednesday:Thu:Thursday:Fri:Friday:Sat:Saturday";
752 return ret;
755 /* ?_Getmonths@_Locinfo@std@@QBEPBDXZ */
756 /* ?_Getmonths@_Locinfo@std@@QEBAPEBDXZ */
757 DEFINE_THISCALL_WRAPPER(_Locinfo__Getmonths, 4)
758 const char* __thiscall _Locinfo__Getmonths(_Locinfo *this)
760 char *months = _Getmonths();
761 const char *ret;
763 TRACE("(%p)\n", this);
765 if(months) {
766 locale_string_char_dtor(&this->months);
767 locale_string_char_ctor_cstr(&this->months, months);
768 free(months);
771 ret = locale_string_char_c_str(&this->months);
772 if (!ret[0]) ret = ":Jan:January:Feb:February:Mar:March:Apr:April:May:May:Jun:June:Jul:July"
773 ":Aug:August:Sep:September:Oct:October:Nov:November:Dec:December";
774 return ret;
777 /* ?_Getfalse@_Locinfo@std@@QBEPBDXZ */
778 /* ?_Getfalse@_Locinfo@std@@QEBAPEBDXZ */
779 DEFINE_THISCALL_WRAPPER(_Locinfo__Getfalse, 4)
780 const char* __thiscall _Locinfo__Getfalse(const _Locinfo *this)
782 TRACE("(%p)\n", this);
783 return "false";
786 /* ?_Gettrue@_Locinfo@std@@QBEPBDXZ */
787 /* ?_Gettrue@_Locinfo@std@@QEBAPEBDXZ */
788 DEFINE_THISCALL_WRAPPER(_Locinfo__Gettrue, 4)
789 const char* __thiscall _Locinfo__Gettrue(const _Locinfo *this)
791 TRACE("(%p)\n", this);
792 return "true";
795 /* ?_Getlconv@_Locinfo@std@@QBEPBUlconv@@XZ */
796 /* ?_Getlconv@_Locinfo@std@@QEBAPEBUlconv@@XZ */
797 DEFINE_THISCALL_WRAPPER(_Locinfo__Getlconv, 4)
798 const struct lconv* __thiscall _Locinfo__Getlconv(const _Locinfo *this)
800 TRACE("(%p)\n", this);
801 return localeconv();
804 /* ?_Gettnames@_Locinfo@std@@QBE?AV_Timevec@2@XZ */
805 /* ?_Gettnames@_Locinfo@std@@QEBA?AV_Timevec@2@XZ */
806 DEFINE_THISCALL_WRAPPER(_Locinfo__Gettnames, 8)
807 _Timevec*__thiscall _Locinfo__Gettnames(const _Locinfo *this, _Timevec *ret)
809 TRACE("(%p)\n", this);
811 _Timevec_ctor_timeptr(ret, _Gettnames());
812 return ret;
815 /* ?id@?$collate@D@std@@2V0locale@2@A */
816 locale_id collate_char_id = {0};
818 /* ??_7?$collate@D@std@@6B@ */
819 extern const vtable_ptr MSVCP_collate_char_vtable;
821 /* ?_Init@?$collate@D@std@@IAEXABV_Locinfo@2@@Z */
822 /* ?_Init@?$collate@D@std@@IEAAXAEBV_Locinfo@2@@Z */
823 DEFINE_THISCALL_WRAPPER(collate_char__Init, 8)
824 void __thiscall collate_char__Init(collate *this, const _Locinfo *locinfo)
826 TRACE("(%p %p)\n", this, locinfo);
827 _Locinfo__Getcoll(locinfo, &this->coll);
830 /* ??0?$collate@D@std@@IAE@PBDI@Z */
831 /* ??0?$collate@D@std@@IEAA@PEBD_K@Z */
832 DEFINE_THISCALL_WRAPPER(collate_char_ctor_name, 12)
833 collate* __thiscall collate_char_ctor_name(collate *this, const char *name, MSVCP_size_t refs)
835 _Locinfo locinfo;
837 TRACE("(%p %s %lu)\n", this, name, refs);
839 locale_facet_ctor_refs(&this->facet, refs);
840 this->facet.vtable = &MSVCP_collate_char_vtable;
842 _Locinfo_ctor_cstr(&locinfo, name);
843 collate_char__Init(this, &locinfo);
844 _Locinfo_dtor(&locinfo);
845 return this;
848 /* ??0?$collate@D@std@@QAE@ABV_Locinfo@1@I@Z */
849 /* ??0?$collate@D@std@@QEAA@AEBV_Locinfo@1@_K@Z */
850 DEFINE_THISCALL_WRAPPER(collate_char_ctor_locinfo, 12)
851 collate* __thiscall collate_char_ctor_locinfo(collate *this, const _Locinfo *locinfo, MSVCP_size_t refs)
853 TRACE("(%p %p %lu)\n", this, locinfo, refs);
855 locale_facet_ctor_refs(&this->facet, refs);
856 this->facet.vtable = &MSVCP_collate_char_vtable;
857 collate_char__Init(this, locinfo);
858 return this;
861 /* ??0?$collate@D@std@@QAE@I@Z */
862 /* ??0?$collate@D@std@@QEAA@_K@Z */
863 DEFINE_THISCALL_WRAPPER(collate_char_ctor_refs, 8)
864 collate* __thiscall collate_char_ctor_refs(collate *this, MSVCP_size_t refs)
866 return collate_char_ctor_name(this, "C", refs);
869 /* ??1?$collate@D@std@@UAE@XZ */
870 /* ??1?$collate@D@std@@UEAA@XZ */
871 /* ??1?$collate@D@std@@MAE@XZ */
872 /* ??1?$collate@D@std@@MEAA@XZ */
873 DEFINE_THISCALL_WRAPPER(collate_char_dtor, 4)
874 void __thiscall collate_char_dtor(collate *this)
876 TRACE("(%p)\n", this);
879 DEFINE_THISCALL_WRAPPER(collate_char_vector_dtor, 8)
880 collate* __thiscall collate_char_vector_dtor(collate *this, unsigned int flags)
882 TRACE("(%p %x)\n", this, flags);
883 if(flags & 2) {
884 /* we have an array, with the number of elements stored before the first object */
885 INT_PTR i, *ptr = (INT_PTR *)this-1;
887 for(i=*ptr-1; i>=0; i--)
888 collate_char_dtor(this+i);
889 MSVCRT_operator_delete(ptr);
890 } else {
891 collate_char_dtor(this);
892 if(flags & 1)
893 MSVCRT_operator_delete(this);
896 return this;
899 /* ??_F?$collate@D@std@@QAEXXZ */
900 /* ??_F?$collate@D@std@@QEAAXXZ */
901 DEFINE_THISCALL_WRAPPER(collate_char_ctor, 4)
902 collate* __thiscall collate_char_ctor(collate *this)
904 return collate_char_ctor_name(this, "C", 0);
907 /* ?_Getcat@?$collate@D@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
908 /* ?_Getcat@?$collate@D@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
909 MSVCP_size_t __cdecl collate_char__Getcat(const locale_facet **facet, const locale *loc)
911 TRACE("(%p %p)\n", facet, loc);
913 if(facet && !*facet) {
914 *facet = MSVCRT_operator_new(sizeof(collate));
915 if(!*facet) {
916 ERR("Out of memory\n");
917 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
918 return 0;
920 collate_char_ctor_name((collate*)*facet,
921 locale_string_char_c_str(&loc->ptr->name), 0);
924 return LC_COLLATE;
927 /* ?_Getcat@?$collate@D@std@@SAIPAPBVfacet@locale@2@@Z */
928 /* ?_Getcat@?$collate@D@std@@SA_KPEAPEBVfacet@locale@2@@Z */
929 MSVCP_size_t __cdecl collate_char__Getcat_old(const locale_facet **facet)
931 return collate_char__Getcat(facet, locale_classic());
934 static collate* collate_char_use_facet(const locale *loc)
936 static collate *obj = NULL;
938 _Lockit lock;
939 const locale_facet *fac;
941 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
942 fac = locale__Getfacet(loc, locale_id_operator_size_t(&collate_char_id));
943 if(fac) {
944 _Lockit_dtor(&lock);
945 return (collate*)fac;
948 if(obj) {
949 _Lockit_dtor(&lock);
950 return obj;
953 collate_char__Getcat(&fac, loc);
954 obj = (collate*)fac;
955 call_locale_facet__Incref(&obj->facet);
956 locale_facet_register(&obj->facet);
957 _Lockit_dtor(&lock);
959 return obj;
962 /* _Strcoll */
963 int __cdecl _Strcoll(const char *first1, const char *last1, const char *first2,
964 const char *last2, const _Collvec *coll)
966 LCID lcid;
968 TRACE("(%s %s)\n", debugstr_an(first1, last1-first1), debugstr_an(first2, last2-first2));
970 if(coll)
971 lcid = coll->handle;
972 else
973 lcid = ___lc_handle_func()[LC_COLLATE];
974 return CompareStringA(lcid, 0, first1, last1-first1, first2, last2-first2)-CSTR_EQUAL;
977 /* ?do_compare@?$collate@D@std@@MBEHPBD000@Z */
978 /* ?do_compare@?$collate@D@std@@MEBAHPEBD000@Z */
979 DEFINE_THISCALL_WRAPPER(collate_char_do_compare, 20)
980 #if _MSVCP_VER <= 100
981 #define call_collate_char_do_compare(this, first1, last1, first2, last2) CALL_VTBL_FUNC(this, 4, int, \
982 (const collate*, const char*, const char*, const char*, const char*), \
983 (this, first1, last1, first2, last2))
984 #else
985 #define call_collate_char_do_compare(this, first1, last1, first2, last2) CALL_VTBL_FUNC(this, 12, int, \
986 (const collate*, const char*, const char*, const char*, const char*), \
987 (this, first1, last1, first2, last2))
988 #endif
989 int __thiscall collate_char_do_compare(const collate *this, const char *first1,
990 const char *last1, const char *first2, const char *last2)
992 TRACE("(%p %p %p %p %p)\n", this, first1, last1, first2, last2);
993 return _Strcoll(first1, last1, first2, last2, &this->coll);
996 /* ?compare@?$collate@D@std@@QBEHPBD000@Z */
997 /* ?compare@?$collate@D@std@@QEBAHPEBD000@Z */
998 DEFINE_THISCALL_WRAPPER(collate_char_compare, 20)
999 int __thiscall collate_char_compare(const collate *this, const char *first1,
1000 const char *last1, const char *first2, const char *last2)
1002 TRACE("(%p %p %p %p %p)\n", this, first1, last1, first2, last2);
1003 return call_collate_char_do_compare(this, first1, last1, first2, last2);
1006 /* ?do_hash@?$collate@D@std@@MBEJPBD0@Z */
1007 /* ?do_hash@?$collate@D@std@@MEBAJPEBD0@Z */
1008 DEFINE_THISCALL_WRAPPER(collate_char_do_hash, 12)
1009 #if _MSVCP_VER <= 100
1010 #define call_collate_char_do_hash(this, first, last) CALL_VTBL_FUNC(this, 12, LONG, \
1011 (const collate*, const char*, const char*), (this, first, last))
1012 #else
1013 #define call_collate_char_do_hash(this, first, last) CALL_VTBL_FUNC(this, 20, LONG, \
1014 (const collate*, const char*, const char*), (this, first, last))
1015 #endif
1016 LONG __thiscall collate_char_do_hash(const collate *this,
1017 const char *first, const char *last)
1019 ULONG ret = 0;
1021 TRACE("(%p %p %p)\n", this, first, last);
1023 for(; first<last; first++)
1024 ret = (ret<<8 | ret>>24) + *first;
1025 return ret;
1028 /* ?hash@?$collate@D@std@@QBEJPBD0@Z */
1029 /* ?hash@?$collate@D@std@@QEBAJPEBD0@Z */
1030 DEFINE_THISCALL_WRAPPER(collate_char_hash, 12)
1031 LONG __thiscall collate_char_hash(const collate *this,
1032 const char *first, const char *last)
1034 TRACE("(%p %p %p)\n", this, first, last);
1035 return call_collate_char_do_hash(this, first, last);
1038 /* ?do_transform@?$collate@D@std@@MBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@PBD0@Z */
1039 /* ?do_transform@?$collate@D@std@@MEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@PEBD0@Z */
1040 DEFINE_THISCALL_WRAPPER(collate_char_do_transform, 16)
1041 basic_string_char* __thiscall collate_char_do_transform(const collate *this,
1042 basic_string_char *ret, const char *first, const char *last)
1044 FIXME("(%p %p %p) stub\n", this, first, last);
1045 return ret;
1048 /* ?transform@?$collate@D@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@PBD0@Z */
1049 /* ?transform@?$collate@D@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@PEBD0@Z */
1050 DEFINE_THISCALL_WRAPPER(collate_char_transform, 16)
1051 basic_string_char* __thiscall collate_char_transform(const collate *this,
1052 basic_string_char *ret, const char *first, const char *last)
1054 FIXME("(%p %p %p) stub\n", this, first, last);
1055 return ret;
1058 /* ?id@?$collate@_W@std@@2V0locale@2@A */
1059 locale_id collate_wchar_id = {0};
1060 /* ?id@?$collate@G@std@@2V0locale@2@A */
1061 locale_id collate_short_id = {0};
1063 /* ??_7?$collate@_W@std@@6B@ */
1064 extern const vtable_ptr MSVCP_collate_wchar_vtable;
1065 /* ??_7?$collate@G@std@@6B@ */
1066 extern const vtable_ptr MSVCP_collate_short_vtable;
1068 /* ?_Init@?$collate@_W@std@@IAEXABV_Locinfo@2@@Z */
1069 /* ?_Init@?$collate@_W@std@@IEAAXAEBV_Locinfo@2@@Z */
1070 /* ?_Init@?$collate@G@std@@IAEXABV_Locinfo@2@@Z */
1071 /* ?_Init@?$collate@G@std@@IEAAXAEBV_Locinfo@2@@Z */
1072 DEFINE_THISCALL_WRAPPER(collate_wchar__Init, 8)
1073 void __thiscall collate_wchar__Init(collate *this, const _Locinfo *locinfo)
1075 TRACE("(%p %p)\n", this, locinfo);
1076 _Locinfo__Getcoll(locinfo, &this->coll);
1079 /* ??0?$collate@_W@std@@IAE@PBDI@Z */
1080 /* ??0?$collate@_W@std@@IEAA@PEBD_K@Z */
1081 DEFINE_THISCALL_WRAPPER(collate_wchar_ctor_name, 12)
1082 collate* __thiscall collate_wchar_ctor_name(collate *this, const char *name, MSVCP_size_t refs)
1084 _Locinfo locinfo;
1086 TRACE("(%p %s %lu)\n", this, name, refs);
1088 locale_facet_ctor_refs(&this->facet, refs);
1089 this->facet.vtable = &MSVCP_collate_wchar_vtable;
1091 _Locinfo_ctor_cstr(&locinfo, name);
1092 collate_wchar__Init(this, &locinfo);
1093 _Locinfo_dtor(&locinfo);
1094 return this;
1097 /* ??0?$collate@G@std@@IAE@PBDI@Z */
1098 /* ??0?$collate@G@std@@IEAA@PEBD_K@Z */
1099 DEFINE_THISCALL_WRAPPER(collate_short_ctor_name, 12)
1100 collate* __thiscall collate_short_ctor_name(collate *this, const char *name, MSVCP_size_t refs)
1102 collate *ret = collate_wchar_ctor_name(this, name, refs);
1103 ret->facet.vtable = &MSVCP_collate_short_vtable;
1104 return ret;
1107 /* ??0?$collate@_W@std@@QAE@ABV_Locinfo@1@I@Z */
1108 /* ??0?$collate@_W@std@@QEAA@AEBV_Locinfo@1@_K@Z */
1109 DEFINE_THISCALL_WRAPPER(collate_wchar_ctor_locinfo, 12)
1110 collate* __thiscall collate_wchar_ctor_locinfo(collate *this, const _Locinfo *locinfo, MSVCP_size_t refs)
1112 TRACE("(%p %p %lu)\n", this, locinfo, refs);
1114 locale_facet_ctor_refs(&this->facet, refs);
1115 this->facet.vtable = &MSVCP_collate_wchar_vtable;
1116 collate_wchar__Init(this, locinfo);
1117 return this;
1120 /* ??0?$collate@G@std@@QAE@ABV_Locinfo@1@I@Z */
1121 /* ??0?$collate@G@std@@QEAA@AEBV_Locinfo@1@_K@Z */
1122 DEFINE_THISCALL_WRAPPER(collate_short_ctor_locinfo, 12)
1123 collate* __thiscall collate_short_ctor_locinfo(collate *this, const _Locinfo *locinfo, MSVCP_size_t refs)
1125 collate *ret = collate_wchar_ctor_locinfo(this, locinfo, refs);
1126 ret->facet.vtable = &MSVCP_collate_short_vtable;
1127 return ret;
1130 /* ??0?$collate@_W@std@@QAE@I@Z */
1131 /* ??0?$collate@_W@std@@QEAA@_K@Z */
1132 DEFINE_THISCALL_WRAPPER(collate_wchar_ctor_refs, 8)
1133 collate* __thiscall collate_wchar_ctor_refs(collate *this, MSVCP_size_t refs)
1135 return collate_wchar_ctor_name(this, "C", refs);
1138 /* ??0?$collate@G@std@@QAE@I@Z */
1139 /* ??0?$collate@G@std@@QEAA@_K@Z */
1140 DEFINE_THISCALL_WRAPPER(collate_short_ctor_refs, 8)
1141 collate* __thiscall collate_short_ctor_refs(collate *this, MSVCP_size_t refs)
1143 collate *ret = collate_wchar_ctor_refs(this, refs);
1144 ret->facet.vtable = &MSVCP_collate_short_vtable;
1145 return ret;
1148 /* ??1?$collate@G@std@@UAE@XZ */
1149 /* ??1?$collate@G@std@@UEAA@XZ */
1150 /* ??1?$collate@_W@std@@MAE@XZ */
1151 /* ??1?$collate@_W@std@@MEAA@XZ */
1152 /* ??1?$collate@G@std@@MAE@XZ */
1153 /* ??1?$collate@G@std@@MEAA@XZ */
1154 DEFINE_THISCALL_WRAPPER(collate_wchar_dtor, 4)
1155 void __thiscall collate_wchar_dtor(collate *this)
1157 TRACE("(%p)\n", this);
1160 DEFINE_THISCALL_WRAPPER(collate_wchar_vector_dtor, 8)
1161 collate* __thiscall collate_wchar_vector_dtor(collate *this, unsigned int flags)
1163 TRACE("(%p %x)\n", this, flags);
1164 if(flags & 2) {
1165 /* we have an array, with the number of elements stored before the first object */
1166 INT_PTR i, *ptr = (INT_PTR *)this-1;
1168 for(i=*ptr-1; i>=0; i--)
1169 collate_wchar_dtor(this+i);
1170 MSVCRT_operator_delete(ptr);
1171 } else {
1172 collate_wchar_dtor(this);
1173 if(flags & 1)
1174 MSVCRT_operator_delete(this);
1177 return this;
1180 /* ??_F?$collate@_W@std@@QAEXXZ */
1181 /* ??_F?$collate@_W@std@@QEAAXXZ */
1182 DEFINE_THISCALL_WRAPPER(collate_wchar_ctor, 4)
1183 collate* __thiscall collate_wchar_ctor(collate *this)
1185 return collate_wchar_ctor_name(this, "C", 0);
1188 /* ??_F?$collate@G@std@@QAEXXZ */
1189 /* ??_F?$collate@G@std@@QEAAXXZ */
1190 DEFINE_THISCALL_WRAPPER(collate_short_ctor, 4)
1191 collate* __thiscall collate_short_ctor(collate *this)
1193 collate *ret = collate_wchar_ctor(this);
1194 ret->facet.vtable = &MSVCP_collate_short_vtable;
1195 return ret;
1198 /* ?_Getcat@?$collate@_W@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
1199 /* ?_Getcat@?$collate@_W@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
1200 MSVCP_size_t __cdecl collate_wchar__Getcat(const locale_facet **facet, const locale *loc)
1202 TRACE("(%p %p)\n", facet, loc);
1204 if(facet && !*facet) {
1205 *facet = MSVCRT_operator_new(sizeof(collate));
1206 if(!*facet) {
1207 ERR("Out of memory\n");
1208 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
1209 return 0;
1211 collate_wchar_ctor_name((collate*)*facet,
1212 locale_string_char_c_str(&loc->ptr->name), 0);
1215 return LC_COLLATE;
1218 /* ?_Getcat@?$collate@_W@std@@SAIPAPBVfacet@locale@2@@Z */
1219 /* ?_Getcat@?$collate@_W@std@@SA_KPEAPEBVfacet@locale@2@@Z */
1220 MSVCP_size_t __cdecl collate_wchar__Getcat_old(const locale_facet **facet)
1222 return collate_wchar__Getcat(facet, locale_classic());
1225 static collate* collate_wchar_use_facet(const locale *loc)
1227 static collate *obj = NULL;
1229 _Lockit lock;
1230 const locale_facet *fac;
1232 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
1233 fac = locale__Getfacet(loc, locale_id_operator_size_t(&collate_wchar_id));
1234 if(fac) {
1235 _Lockit_dtor(&lock);
1236 return (collate*)fac;
1239 if(obj) {
1240 _Lockit_dtor(&lock);
1241 return obj;
1244 collate_wchar__Getcat(&fac, loc);
1245 obj = (collate*)fac;
1246 call_locale_facet__Incref(&obj->facet);
1247 locale_facet_register(&obj->facet);
1248 _Lockit_dtor(&lock);
1250 return obj;
1253 /* ?_Getcat@?$collate@G@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
1254 /* ?_Getcat@?$collate@G@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
1255 MSVCP_size_t __cdecl collate_short__Getcat(const locale_facet **facet, const locale *loc)
1257 if(facet && !*facet) {
1258 collate_wchar__Getcat(facet, loc);
1259 (*(locale_facet**)facet)->vtable = &MSVCP_collate_short_vtable;
1262 return LC_COLLATE;
1265 /* ?_Getcat@?$collate@G@std@@SAIPAPBVfacet@locale@2@@Z */
1266 /* ?_Getcat@?$collate@G@std@@SA_KPEAPEBVfacet@locale@2@@Z */
1267 MSVCP_size_t __cdecl collate_short__Getcat_old(const locale_facet **facet)
1269 return collate_short__Getcat(facet, locale_classic());
1272 static collate* collate_short_use_facet(const locale *loc)
1274 static collate *obj = NULL;
1276 _Lockit lock;
1277 const locale_facet *fac;
1279 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
1280 fac = locale__Getfacet(loc, locale_id_operator_size_t(&collate_short_id));
1281 if(fac) {
1282 _Lockit_dtor(&lock);
1283 return (collate*)fac;
1286 if(obj) {
1287 _Lockit_dtor(&lock);
1288 return obj;
1291 collate_short__Getcat(&fac, loc);
1292 obj = (collate*)fac;
1293 call_locale_facet__Incref(&obj->facet);
1294 locale_facet_register(&obj->facet);
1295 _Lockit_dtor(&lock);
1297 return obj;
1300 /* _Wcscoll */
1301 int __cdecl _Wcscoll(const wchar_t *first1, const wchar_t *last1, const wchar_t *first2,
1302 const wchar_t *last2, const _Collvec *coll)
1304 LCID lcid;
1306 TRACE("(%s %s)\n", debugstr_wn(first1, last1-first1), debugstr_wn(first2, last2-first2));
1308 if(coll)
1309 lcid = coll->handle;
1310 else
1311 lcid = ___lc_handle_func()[LC_COLLATE];
1312 return CompareStringW(lcid, 0, first1, last1-first1, first2, last2-first2)-CSTR_EQUAL;
1315 /* ?do_compare@?$collate@_W@std@@MBEHPB_W000@Z */
1316 /* ?do_compare@?$collate@_W@std@@MEBAHPEB_W000@Z */
1317 /* ?do_compare@?$collate@G@std@@MBEHPBG000@Z */
1318 /* ?do_compare@?$collate@G@std@@MEBAHPEBG000@Z */
1319 DEFINE_THISCALL_WRAPPER(collate_wchar_do_compare, 20)
1320 #if _MSVCP_VER <= 100
1321 #define call_collate_wchar_do_compare(this, first1, last1, first2, last2) CALL_VTBL_FUNC(this, 4, int, \
1322 (const collate*, const wchar_t*, const wchar_t*, const wchar_t*, const wchar_t*), \
1323 (this, first1, last1, first2, last2))
1324 #else
1325 #define call_collate_wchar_do_compare(this, first1, last1, first2, last2) CALL_VTBL_FUNC(this, 12, int, \
1326 (const collate*, const wchar_t*, const wchar_t*, const wchar_t*, const wchar_t*), \
1327 (this, first1, last1, first2, last2))
1328 #endif
1329 int __thiscall collate_wchar_do_compare(const collate *this, const wchar_t *first1,
1330 const wchar_t *last1, const wchar_t *first2, const wchar_t *last2)
1332 TRACE("(%p %p %p %p %p)\n", this, first1, last1, first2, last2);
1333 return _Wcscoll(first1, last1, first2, last2, &this->coll);
1336 /* ?compare@?$collate@_W@std@@QBEHPB_W000@Z */
1337 /* ?compare@?$collate@_W@std@@QEBAHPEB_W000@Z */
1338 /* ?compare@?$collate@G@std@@QBEHPBG000@Z */
1339 /* ?compare@?$collate@G@std@@QEBAHPEBG000@Z */
1340 DEFINE_THISCALL_WRAPPER(collate_wchar_compare, 20)
1341 int __thiscall collate_wchar_compare(const collate *this, const wchar_t *first1,
1342 const wchar_t *last1, const wchar_t *first2, const wchar_t *last2)
1344 TRACE("(%p %p %p %p %p)\n", this, first1, last1, first2, last2);
1345 return call_collate_wchar_do_compare(this, first1, last1, first2, last2);
1348 /* ?do_hash@?$collate@_W@std@@MBEJPB_W0@Z */
1349 /* ?do_hash@?$collate@_W@std@@MEBAJPEB_W0@Z */
1350 /* ?do_hash@?$collate@G@std@@MBEJPBG0@Z */
1351 /* ?do_hash@?$collate@G@std@@MEBAJPEBG0@Z */
1352 DEFINE_THISCALL_WRAPPER(collate_wchar_do_hash, 12)
1353 #if _MSVCP_VER <= 100
1354 #define call_collate_wchar_do_hash(this, first, last) CALL_VTBL_FUNC(this, 12, LONG, \
1355 (const collate*, const wchar_t*, const wchar_t*), (this, first, last))
1356 #else
1357 #define call_collate_wchar_do_hash(this, first, last) CALL_VTBL_FUNC(this, 20, LONG, \
1358 (const collate*, const wchar_t*, const wchar_t*), (this, first, last))
1359 #endif
1360 LONG __thiscall collate_wchar_do_hash(const collate *this,
1361 const wchar_t *first, const wchar_t *last)
1363 ULONG ret = 0;
1365 TRACE("(%p %p %p)\n", this, first, last);
1367 for(; first<last; first++)
1368 ret = (ret<<8 | ret>>24) + *first;
1369 return ret;
1372 /* ?hash@?$collate@_W@std@@QBEJPB_W0@Z */
1373 /* ?hash@?$collate@_W@std@@QEBAJPEB_W0@Z */
1374 /* ?hash@?$collate@G@std@@QBEJPBG0@Z */
1375 /* ?hash@?$collate@G@std@@QEBAJPEBG0@Z */
1376 DEFINE_THISCALL_WRAPPER(collate_wchar_hash, 12)
1377 LONG __thiscall collate_wchar_hash(const collate *this,
1378 const wchar_t *first, const wchar_t *last)
1380 TRACE("(%p %p %p)\n", this, first, last);
1381 return call_collate_wchar_do_hash(this, first, last);
1384 /* ?do_transform@?$collate@_W@std@@MBE?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@PB_W0@Z */
1385 /* ?do_transform@?$collate@_W@std@@MEBA?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@PEB_W0@Z */
1386 /* ?do_transform@?$collate@G@std@@MBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@PBG0@Z */
1387 /* ?do_transform@?$collate@G@std@@MEBA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@PEBG0@Z */
1388 DEFINE_THISCALL_WRAPPER(collate_wchar_do_transform, 16)
1389 basic_string_wchar* __thiscall collate_wchar_do_transform(const collate *this,
1390 basic_string_wchar *ret, const wchar_t *first, const wchar_t *last)
1392 FIXME("(%p %p %p) stub\n", this, first, last);
1393 return ret;
1396 /* ?transform@?$collate@_W@std@@QBE?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@PB_W0@Z */
1397 /* ?transform@?$collate@_W@std@@QEBA?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@PEB_W0@Z */
1398 /* ?transform@?$collate@G@std@@QBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@PBG0@Z */
1399 /* ?transform@?$collate@G@std@@QEBA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@PEBG0@Z */
1400 DEFINE_THISCALL_WRAPPER(collate_wchar_transform, 16)
1401 basic_string_wchar* __thiscall collate_wchar_transform(const collate *this,
1402 basic_string_wchar *ret, const wchar_t *first, const wchar_t *last)
1404 FIXME("(%p %p %p) stub\n", this, first, last);
1405 return ret;
1408 /* ??_7ctype_base@std@@6B@ */
1409 extern const vtable_ptr MSVCP_ctype_base_vtable;
1411 /* ??0ctype_base@std@@QAE@I@Z */
1412 /* ??0ctype_base@std@@QEAA@_K@Z */
1413 DEFINE_THISCALL_WRAPPER(ctype_base_ctor_refs, 8)
1414 ctype_base* __thiscall ctype_base_ctor_refs(ctype_base *this, MSVCP_size_t refs)
1416 TRACE("(%p %lu)\n", this, refs);
1417 locale_facet_ctor_refs(&this->facet, refs);
1418 this->facet.vtable = &MSVCP_ctype_base_vtable;
1419 return this;
1422 /* ??_Fctype_base@std@@QAEXXZ */
1423 /* ??_Fctype_base@std@@QEAAXXZ */
1424 DEFINE_THISCALL_WRAPPER(ctype_base_ctor, 4)
1425 ctype_base* __thiscall ctype_base_ctor(ctype_base *this)
1427 TRACE("(%p)\n", this);
1428 locale_facet_ctor_refs(&this->facet, 0);
1429 this->facet.vtable = &MSVCP_ctype_base_vtable;
1430 return this;
1433 /* ??1ctype_base@std@@UAE@XZ */
1434 /* ??1ctype_base@std@@UEAA@XZ */
1435 DEFINE_THISCALL_WRAPPER(ctype_base_dtor, 4)
1436 void __thiscall ctype_base_dtor(ctype_base *this)
1438 TRACE("(%p)\n", this);
1441 DEFINE_THISCALL_WRAPPER(ctype_base_vector_dtor, 8)
1442 ctype_base* __thiscall ctype_base_vector_dtor(ctype_base *this, unsigned int flags)
1444 TRACE("(%p %x)\n", this, flags);
1445 if(flags & 2) {
1446 /* we have an array, with the number of elements stored before the first object */
1447 INT_PTR i, *ptr = (INT_PTR *)this-1;
1449 for(i=*ptr-1; i>=0; i--)
1450 ctype_base_dtor(this+i);
1451 MSVCRT_operator_delete(ptr);
1452 } else {
1453 ctype_base_dtor(this);
1454 if(flags & 1)
1455 MSVCRT_operator_delete(this);
1458 return this;
1461 /* ?_Xran@ctype_base@std@@KAXXZ */
1462 void __cdecl ctype_base__Xran(void)
1464 throw_exception(EXCEPTION_OUT_OF_RANGE, "out of range in ctype<T>");
1467 /* ?id@?$ctype@D@std@@2V0locale@2@A */
1468 locale_id ctype_char_id = {0};
1469 /* ?table_size@?$ctype@D@std@@2IB */
1470 /* ?table_size@?$ctype@D@std@@2_KB */
1471 MSVCP_size_t ctype_char_table_size = 256;
1473 /* ??_7?$ctype@D@std@@6B@ */
1474 extern const vtable_ptr MSVCP_ctype_char_vtable;
1476 /* ?_Id_func@?$ctype@D@std@@SAAAVid@locale@2@XZ */
1477 /* ?_Id_func@?$ctype@D@std@@SAAEAVid@locale@2@XZ */
1478 locale_id* __cdecl ctype_char__Id_func(void)
1480 TRACE("()\n");
1481 return &ctype_char_id;
1484 /* ?_Init@?$ctype@D@std@@IAEXABV_Locinfo@2@@Z */
1485 /* ?_Init@?$ctype@D@std@@IEAAXAEBV_Locinfo@2@@Z */
1486 DEFINE_THISCALL_WRAPPER(ctype_char__Init, 8)
1487 void __thiscall ctype_char__Init(ctype_char *this, const _Locinfo *locinfo)
1489 TRACE("(%p %p)\n", this, locinfo);
1490 _Locinfo__Getctype(locinfo, &this->ctype);
1493 /* ?_Tidy@?$ctype@D@std@@IAEXXZ */
1494 /* ?_Tidy@?$ctype@D@std@@IEAAXXZ */
1495 DEFINE_THISCALL_WRAPPER(ctype_char__Tidy, 4)
1496 void __thiscall ctype_char__Tidy(ctype_char *this)
1498 TRACE("(%p)\n", this);
1500 if(this->ctype.delfl)
1501 free((short*)this->ctype.table);
1502 #if _MSVCP_VER >= 110
1503 free(this->ctype.name);
1504 #endif
1507 /* ?classic_table@?$ctype@D@std@@KAPBFXZ */
1508 /* ?classic_table@?$ctype@D@std@@KAPEBFXZ */
1509 const short* __cdecl ctype_char_classic_table(void)
1511 ctype_char *ctype;
1513 TRACE("()\n");
1514 ctype = ctype_char_use_facet( locale_classic() );
1515 return ctype->ctype.table;
1518 /* ??0?$ctype@D@std@@QAE@ABV_Locinfo@1@I@Z */
1519 /* ??0?$ctype@D@std@@QEAA@AEBV_Locinfo@1@_K@Z */
1520 DEFINE_THISCALL_WRAPPER(ctype_char_ctor_locinfo, 12)
1521 ctype_char* __thiscall ctype_char_ctor_locinfo(ctype_char *this,
1522 const _Locinfo *locinfo, MSVCP_size_t refs)
1524 TRACE("(%p %p %lu)\n", this, locinfo, refs);
1525 ctype_base_ctor_refs(&this->base, refs);
1526 this->base.facet.vtable = &MSVCP_ctype_char_vtable;
1527 ctype_char__Init(this, locinfo);
1528 return this;
1531 /* ??0?$ctype@D@std@@QAE@PBF_NI@Z */
1532 /* ??0?$ctype@D@std@@QEAA@PEBF_N_K@Z */
1533 DEFINE_THISCALL_WRAPPER(ctype_char_ctor_table, 16)
1534 ctype_char* __thiscall ctype_char_ctor_table(ctype_char *this,
1535 const short *table, MSVCP_bool delete, MSVCP_size_t refs)
1537 _Locinfo locinfo;
1539 TRACE("(%p %p %d %lu)\n", this, table, delete, refs);
1541 ctype_base_ctor_refs(&this->base, refs);
1542 this->base.facet.vtable = &MSVCP_ctype_char_vtable;
1544 _Locinfo_ctor(&locinfo);
1545 ctype_char__Init(this, &locinfo);
1546 _Locinfo_dtor(&locinfo);
1548 if(table) {
1549 ctype_char__Tidy(this);
1550 this->ctype.table = table;
1551 this->ctype.delfl = delete;
1553 return this;
1556 /* ??_F?$ctype@D@std@@QAEXXZ */
1557 /* ??_F?$ctype@D@std@@QEAAXXZ */
1558 DEFINE_THISCALL_WRAPPER(ctype_char_ctor, 4)
1559 ctype_char* __thiscall ctype_char_ctor(ctype_char *this)
1561 return ctype_char_ctor_table(this, NULL, FALSE, 0);
1564 /* ??1?$ctype@D@std@@UAE@XZ */
1565 /* ??1?$ctype@D@std@@UEAA@XZ */
1566 /* ??1?$ctype@D@std@@MAE@XZ */
1567 /* ??1?$ctype@D@std@@MEAA@XZ */
1568 DEFINE_THISCALL_WRAPPER(ctype_char_dtor, 4)
1569 void __thiscall ctype_char_dtor(ctype_char *this)
1571 TRACE("(%p)\n", this);
1572 ctype_char__Tidy(this);
1575 DEFINE_THISCALL_WRAPPER(ctype_char_vector_dtor, 8)
1576 ctype_char* __thiscall ctype_char_vector_dtor(ctype_char *this, unsigned int flags)
1578 TRACE("(%p %x)\n", this, flags);
1579 if(flags & 2) {
1580 /* we have an array, with the number of elements stored before the first object */
1581 INT_PTR i, *ptr = (INT_PTR *)this-1;
1583 for(i=*ptr-1; i>=0; i--)
1584 ctype_char_dtor(this+i);
1585 MSVCRT_operator_delete(ptr);
1586 } else {
1587 ctype_char_dtor(this);
1588 if(flags & 1)
1589 MSVCRT_operator_delete(this);
1592 return this;
1595 /* ?do_narrow@?$ctype@D@std@@MBEDDD@Z */
1596 /* ?do_narrow@?$ctype@D@std@@MEBADDD@Z */
1597 DEFINE_THISCALL_WRAPPER(ctype_char_do_narrow_ch, 12)
1598 #if _MSVCP_VER >= 80 && _MSVCP_VER <= 90
1599 #define call_ctype_char_do_narrow_ch(this, ch, unused) CALL_VTBL_FUNC(this, 36, \
1600 char, (const ctype_char*, char, char), (this, ch, unused))
1601 #elif _MSVCP_VER <= 100
1602 #define call_ctype_char_do_narrow_ch(this, ch, unused) CALL_VTBL_FUNC(this, 32, \
1603 char, (const ctype_char*, char, char), (this, ch, unused))
1604 #else
1605 #define call_ctype_char_do_narrow_ch(this, ch, unused) CALL_VTBL_FUNC(this, 40, \
1606 char, (const ctype_char*, char, char), (this, ch, unused))
1607 #endif
1608 char __thiscall ctype_char_do_narrow_ch(const ctype_char *this, char ch, char unused)
1610 TRACE("(%p %c %c)\n", this, ch, unused);
1611 return ch;
1614 /* ?do_narrow@?$ctype@D@std@@MBEPBDPBD0DPAD@Z */
1615 /* ?do_narrow@?$ctype@D@std@@MEBAPEBDPEBD0DPEAD@Z */
1616 DEFINE_THISCALL_WRAPPER(ctype_char_do_narrow, 20)
1617 #if _MSVCP_VER >= 80 && _MSVCP_VER <= 90
1618 #define call_ctype_char_do_narrow(this, first, last, unused, dest) CALL_VTBL_FUNC(this, 32, \
1619 const char*, (const ctype_char*, const char*, const char*, char, char*), \
1620 (this, first, last, unused, dest))
1621 #elif _MSVCP_VER <= 100
1622 #define call_ctype_char_do_narrow(this, first, last, unused, dest) CALL_VTBL_FUNC(this, 28, \
1623 const char*, (const ctype_char*, const char*, const char*, char, char*), \
1624 (this, first, last, unused, dest))
1625 #else
1626 #define call_ctype_char_do_narrow(this, first, last, unused, dest) CALL_VTBL_FUNC(this, 36, \
1627 const char*, (const ctype_char*, const char*, const char*, char, char*), \
1628 (this, first, last, unused, dest))
1629 #endif
1630 const char* __thiscall ctype_char_do_narrow(const ctype_char *this,
1631 const char *first, const char *last, char unused, char *dest)
1633 TRACE("(%p %p %p %p)\n", this, first, last, dest);
1634 memcpy(dest, first, last-first);
1635 return last;
1638 /* ?_Do_narrow_s@?$ctype@D@std@@MBEPBDPBD0DPADI@Z */
1639 /* ?_Do_narrow_s@?$ctype@D@std@@MEBAPEBDPEBD0DPEAD_K@Z */
1640 DEFINE_THISCALL_WRAPPER(ctype_char__Do_narrow_s, 24)
1641 #define call_ctype_char__Do_narrow_s(this, first, last, unused, dest, size) CALL_VTBL_FUNC(this, 40, \
1642 const char*, (const ctype_char*, const char*, const char*, char, char*, MSVCP_size_t), \
1643 (this, first, last, unused, dest, size))
1644 const char* __thiscall ctype_char__Do_narrow_s(const ctype_char *this, const char *first,
1645 const char *last, char unused, char *dest, MSVCP_size_t size)
1647 TRACE("(%p %p %p %p %lu)\n", this, first, last, dest, size);
1648 memcpy_s(dest, size, first, last-first);
1649 return last;
1652 /* ?narrow@?$ctype@D@std@@QBEDDD@Z */
1653 /* ?narrow@?$ctype@D@std@@QEBADDD@Z */
1654 DEFINE_THISCALL_WRAPPER(ctype_char_narrow_ch, 12)
1655 char __thiscall ctype_char_narrow_ch(const ctype_char *this, char ch, char dflt)
1657 TRACE("(%p %c %c)\n", this, ch, dflt);
1658 return call_ctype_char_do_narrow_ch(this, ch, dflt);
1661 /* ?narrow@?$ctype@D@std@@QBEPBDPBD0DPAD@Z */
1662 /* ?narrow@?$ctype@D@std@@QEBAPEBDPEBD0DPEAD@Z */
1663 DEFINE_THISCALL_WRAPPER(ctype_char_narrow, 20)
1664 const char* __thiscall ctype_char_narrow(const ctype_char *this,
1665 const char *first, const char *last, char dflt, char *dest)
1667 TRACE("(%p %p %p %c %p)\n", this, first, last, dflt, dest);
1668 return call_ctype_char_do_narrow(this, first, last, dflt, dest);
1671 /* ?_Narrow_s@?$ctype@D@std@@QBEPBDPBD0DPADI@Z */
1672 /* ?_Narrow_s@?$ctype@D@std@@QEBAPEBDPEBD0DPEAD_K@Z */
1673 DEFINE_THISCALL_WRAPPER(ctype_char__Narrow_s, 24)
1674 const char* __thiscall ctype_char__Narrow_s(const ctype_char *this, const char *first,
1675 const char *last, char dflt, char *dest, MSVCP_size_t size)
1677 TRACE("(%p %p %p %p %lu)\n", this, first, last, dest, size);
1678 return call_ctype_char__Do_narrow_s(this, first, last, dflt, dest, size);
1681 /* ?do_widen@?$ctype@D@std@@MBEDD@Z */
1682 /* ?do_widen@?$ctype@D@std@@MEBADD@Z */
1683 DEFINE_THISCALL_WRAPPER(ctype_char_do_widen_ch, 8)
1684 #if _MSVCP_VER <= 100
1685 #define call_ctype_char_do_widen_ch(this, ch) CALL_VTBL_FUNC(this, 24, \
1686 char, (const ctype_char*, char), (this, ch))
1687 #else
1688 #define call_ctype_char_do_widen_ch(this, ch) CALL_VTBL_FUNC(this, 32, \
1689 char, (const ctype_char*, char), (this, ch))
1690 #endif
1691 char __thiscall ctype_char_do_widen_ch(const ctype_char *this, char ch)
1693 TRACE("(%p %c)\n", this, ch);
1694 return ch;
1697 /* ?do_widen@?$ctype@D@std@@MBEPBDPBD0PAD@Z */
1698 /* ?do_widen@?$ctype@D@std@@MEBAPEBDPEBD0PEAD@Z */
1699 DEFINE_THISCALL_WRAPPER(ctype_char_do_widen, 16)
1700 #if _MSVCP_VER <= 100
1701 #define call_ctype_char_do_widen(this, first, last, dest) CALL_VTBL_FUNC(this, 20, \
1702 const char*, (const ctype_char*, const char*, const char*, char*), \
1703 (this, first, last, dest))
1704 #else
1705 #define call_ctype_char_do_widen(this, first, last, dest) CALL_VTBL_FUNC(this, 28, \
1706 const char*, (const ctype_char*, const char*, const char*, char*), \
1707 (this, first, last, dest))
1708 #endif
1709 const char* __thiscall ctype_char_do_widen(const ctype_char *this,
1710 const char *first, const char *last, char *dest)
1712 TRACE("(%p %p %p %p)\n", this, first, last, dest);
1713 memcpy(dest, first, last-first);
1714 return last;
1717 /* ?_Do_widen_s@?$ctype@D@std@@MBEPBDPBD0PADI@Z */
1718 /* ?_Do_widen_s@?$ctype@D@std@@MEBAPEBDPEBD0PEAD_K@Z */
1719 DEFINE_THISCALL_WRAPPER(ctype_char__Do_widen_s, 20)
1720 #define call_ctype_char__Do_widen_s(this, first, last, dest, size) CALL_VTBL_FUNC(this, 28, \
1721 const char*, (const ctype_char*, const char*, const char*, char*, MSVCP_size_t), \
1722 (this, first, last, dest, size))
1723 const char* __thiscall ctype_char__Do_widen_s(const ctype_char *this,
1724 const char *first, const char *last, char *dest, MSVCP_size_t size)
1726 TRACE("(%p %p %p %p %lu)\n", this, first, last, dest, size);
1727 memcpy_s(dest, size, first, last-first);
1728 return last;
1731 /* ?widen@?$ctype@D@std@@QBEDD@Z */
1732 /* ?widen@?$ctype@D@std@@QEBADD@Z */
1733 DEFINE_THISCALL_WRAPPER(ctype_char_widen_ch, 8)
1734 char __thiscall ctype_char_widen_ch(const ctype_char *this, char ch)
1736 TRACE("(%p %c)\n", this, ch);
1737 return call_ctype_char_do_widen_ch(this, ch);
1740 /* ?widen@?$ctype@D@std@@QBEPBDPBD0PAD@Z */
1741 /* ?widen@?$ctype@D@std@@QEBAPEBDPEBD0PEAD@Z */
1742 DEFINE_THISCALL_WRAPPER(ctype_char_widen, 16)
1743 const char* __thiscall ctype_char_widen(const ctype_char *this,
1744 const char *first, const char *last, char *dest)
1746 TRACE("(%p %p %p %p)\n", this, first, last, dest);
1747 return call_ctype_char_do_widen(this, first, last, dest);
1750 /* ?_Widen_s@?$ctype@D@std@@QBEPBDPBD0PADI@Z */
1751 /* ?_Widen_s@?$ctype@D@std@@QEBAPEBDPEBD0PEAD_K@Z */
1752 DEFINE_THISCALL_WRAPPER(ctype_char__Widen_s, 20)
1753 const char* __thiscall ctype_char__Widen_s(const ctype_char *this,
1754 const char *first, const char *last, char *dest, MSVCP_size_t size)
1756 TRACE("(%p %p %p %p %lu)\n", this, first, last, dest, size);
1757 return call_ctype_char__Do_widen_s(this, first, last, dest, size);
1760 /* ?_Getcat@?$ctype@D@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
1761 /* ?_Getcat@?$ctype@D@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
1762 MSVCP_size_t __cdecl ctype_char__Getcat(const locale_facet **facet, const locale *loc)
1764 TRACE("(%p %p)\n", facet, loc);
1766 if(facet && !*facet) {
1767 _Locinfo locinfo;
1769 *facet = MSVCRT_operator_new(sizeof(ctype_char));
1770 if(!*facet) {
1771 ERR("Out of memory\n");
1772 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
1773 return 0;
1776 _Locinfo_ctor_cstr(&locinfo, locale_string_char_c_str(&loc->ptr->name));
1777 ctype_char_ctor_locinfo((ctype_char*)*facet, &locinfo, 0);
1778 _Locinfo_dtor(&locinfo);
1781 return LC_CTYPE;
1784 /* ?_Getcat@?$ctype@D@std@@SAIPAPBVfacet@locale@2@@Z */
1785 /* ?_Getcat@?$ctype@D@std@@SA_KPEAPEBVfacet@locale@2@@Z */
1786 MSVCP_size_t __cdecl ctype_char__Getcat_old(const locale_facet **facet)
1788 return ctype_char__Getcat(facet, locale_classic());
1791 ctype_char* ctype_char_use_facet(const locale *loc)
1793 static ctype_char *obj = NULL;
1795 _Lockit lock;
1796 const locale_facet *fac;
1798 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
1799 fac = locale__Getfacet(loc, locale_id_operator_size_t(&ctype_char_id));
1800 if(fac) {
1801 _Lockit_dtor(&lock);
1802 return (ctype_char*)fac;
1805 if(obj) {
1806 _Lockit_dtor(&lock);
1807 return obj;
1810 ctype_char__Getcat(&fac, loc);
1811 obj = (ctype_char*)fac;
1812 call_locale_facet__Incref(&obj->base.facet);
1813 locale_facet_register(&obj->base.facet);
1814 _Lockit_dtor(&lock);
1816 return obj;
1819 /* _Tolower */
1820 int __cdecl _Tolower(int ch, const _Ctypevec *ctype)
1822 unsigned int cp;
1824 TRACE("%d %p\n", ch, ctype);
1826 if(ctype)
1827 cp = ctype->page;
1828 else
1829 cp = ___lc_codepage_func();
1831 /* Don't convert to unicode in case of C locale */
1832 if(!cp) {
1833 if(ch>='A' && ch<='Z')
1834 ch = ch-'A'+'a';
1835 return ch;
1836 } else {
1837 WCHAR wide, lower;
1838 char str[2];
1839 int size;
1841 if(ch > 255) {
1842 str[0] = (ch>>8) & 255;
1843 str[1] = ch & 255;
1844 size = 2;
1845 } else {
1846 str[0] = ch & 255;
1847 size = 1;
1850 if(!MultiByteToWideChar(cp, MB_ERR_INVALID_CHARS, str, size, &wide, 1))
1851 return ch;
1853 lower = tolowerW(wide);
1854 if(lower == wide)
1855 return ch;
1857 WideCharToMultiByte(cp, 0, &lower, 1, str, 2, NULL, NULL);
1859 return str[0] + (str[1]<<8);
1863 /* ?do_tolower@?$ctype@D@std@@MBEDD@Z */
1864 /* ?do_tolower@?$ctype@D@std@@MEBADD@Z */
1865 #if _MSVCP_VER <= 100
1866 #define call_ctype_char_do_tolower_ch(this, ch) CALL_VTBL_FUNC(this, 8, \
1867 char, (const ctype_char*, char), (this, ch))
1868 #else
1869 #define call_ctype_char_do_tolower_ch(this, ch) CALL_VTBL_FUNC(this, 16, \
1870 char, (const ctype_char*, char), (this, ch))
1871 #endif
1872 DEFINE_THISCALL_WRAPPER(ctype_char_do_tolower_ch, 8)
1873 char __thiscall ctype_char_do_tolower_ch(const ctype_char *this, char ch)
1875 TRACE("(%p %c)\n", this, ch);
1876 return _Tolower(ch, &this->ctype);
1879 /* ?do_tolower@?$ctype@D@std@@MBEPBDPADPBD@Z */
1880 /* ?do_tolower@?$ctype@D@std@@MEBAPEBDPEADPEBD@Z */
1881 #if _MSVCP_VER <= 100
1882 #define call_ctype_char_do_tolower(this, first, last) CALL_VTBL_FUNC(this, 4, \
1883 const char*, (const ctype_char*, char*, const char*), (this, first, last))
1884 #else
1885 #define call_ctype_char_do_tolower(this, first, last) CALL_VTBL_FUNC(this, 12, \
1886 const char*, (const ctype_char*, char*, const char*), (this, first, last))
1887 #endif
1888 DEFINE_THISCALL_WRAPPER(ctype_char_do_tolower, 12)
1889 const char* __thiscall ctype_char_do_tolower(const ctype_char *this, char *first, const char *last)
1891 TRACE("(%p %p %p)\n", this, first, last);
1892 for(; first<last; first++)
1893 *first = _Tolower(*first, &this->ctype);
1894 return last;
1897 /* ?tolower@?$ctype@D@std@@QBEDD@Z */
1898 /* ?tolower@?$ctype@D@std@@QEBADD@Z */
1899 DEFINE_THISCALL_WRAPPER(ctype_char_tolower_ch, 8)
1900 char __thiscall ctype_char_tolower_ch(const ctype_char *this, char ch)
1902 TRACE("(%p %c)\n", this, ch);
1903 return call_ctype_char_do_tolower_ch(this, ch);
1906 /* ?tolower@?$ctype@D@std@@QBEPBDPADPBD@Z */
1907 /* ?tolower@?$ctype@D@std@@QEBAPEBDPEADPEBD@Z */
1908 DEFINE_THISCALL_WRAPPER(ctype_char_tolower, 12)
1909 const char* __thiscall ctype_char_tolower(const ctype_char *this, char *first, const char *last)
1911 TRACE("(%p %p %p)\n", this, first, last);
1912 return call_ctype_char_do_tolower(this, first, last);
1915 /* _Toupper */
1916 int __cdecl _Toupper(int ch, const _Ctypevec *ctype)
1918 unsigned int cp;
1920 TRACE("%d %p\n", ch, ctype);
1922 if(ctype)
1923 cp = ctype->page;
1924 else
1925 cp = ___lc_codepage_func();
1927 /* Don't convert to unicode in case of C locale */
1928 if(!cp) {
1929 if(ch>='a' && ch<='z')
1930 ch = ch-'a'+'A';
1931 return ch;
1932 } else {
1933 WCHAR wide, upper;
1934 char str[2];
1935 int size;
1937 if(ch > 255) {
1938 str[0] = (ch>>8) & 255;
1939 str[1] = ch & 255;
1940 size = 2;
1941 } else {
1942 str[0] = ch & 255;
1943 size = 1;
1946 if(!MultiByteToWideChar(cp, MB_ERR_INVALID_CHARS, str, size, &wide, 1))
1947 return ch;
1949 upper = toupperW(wide);
1950 if(upper == wide)
1951 return ch;
1953 WideCharToMultiByte(cp, 0, &upper, 1, str, 2, NULL, NULL);
1955 return str[0] + (str[1]<<8);
1959 /* ?do_toupper@?$ctype@D@std@@MBEDD@Z */
1960 /* ?do_toupper@?$ctype@D@std@@MEBADD@Z */
1961 #if _MSVCP_VER <= 100
1962 #define call_ctype_char_do_toupper_ch(this, ch) CALL_VTBL_FUNC(this, 16, \
1963 char, (const ctype_char*, char), (this, ch))
1964 #else
1965 #define call_ctype_char_do_toupper_ch(this, ch) CALL_VTBL_FUNC(this, 24, \
1966 char, (const ctype_char*, char), (this, ch))
1967 #endif
1968 DEFINE_THISCALL_WRAPPER(ctype_char_do_toupper_ch, 8)
1969 char __thiscall ctype_char_do_toupper_ch(const ctype_char *this, char ch)
1971 TRACE("(%p %c)\n", this, ch);
1972 return _Toupper(ch, &this->ctype);
1975 /* ?do_toupper@?$ctype@D@std@@MBEPBDPADPBD@Z */
1976 /* ?do_toupper@?$ctype@D@std@@MEBAPEBDPEADPEBD@Z */
1977 #if _MSVCP_VER <= 100
1978 #define call_ctype_char_do_toupper(this, first, last) CALL_VTBL_FUNC(this, 12, \
1979 const char*, (const ctype_char*, char*, const char*), (this, first, last))
1980 #else
1981 #define call_ctype_char_do_toupper(this, first, last) CALL_VTBL_FUNC(this, 20, \
1982 const char*, (const ctype_char*, char*, const char*), (this, first, last))
1983 #endif
1984 DEFINE_THISCALL_WRAPPER(ctype_char_do_toupper, 12)
1985 const char* __thiscall ctype_char_do_toupper(const ctype_char *this,
1986 char *first, const char *last)
1988 TRACE("(%p %p %p)\n", this, first, last);
1989 for(; first<last; first++)
1990 *first = _Toupper(*first, &this->ctype);
1991 return last;
1994 /* ?toupper@?$ctype@D@std@@QBEDD@Z */
1995 /* ?toupper@?$ctype@D@std@@QEBADD@Z */
1996 DEFINE_THISCALL_WRAPPER(ctype_char_toupper_ch, 8)
1997 char __thiscall ctype_char_toupper_ch(const ctype_char *this, char ch)
1999 TRACE("(%p %c)\n", this, ch);
2000 return call_ctype_char_do_toupper_ch(this, ch);
2003 /* ?toupper@?$ctype@D@std@@QBEPBDPADPBD@Z */
2004 /* ?toupper@?$ctype@D@std@@QEBAPEBDPEADPEBD@Z */
2005 DEFINE_THISCALL_WRAPPER(ctype_char_toupper, 12)
2006 const char* __thiscall ctype_char_toupper(const ctype_char *this, char *first, const char *last)
2008 TRACE("(%p %p %p)\n", this, first, last);
2009 return call_ctype_char_do_toupper(this, first, last);
2012 /* ?is@?$ctype@D@std@@QBE_NFD@Z */
2013 /* ?is@?$ctype@D@std@@QEBA_NFD@Z */
2014 DEFINE_THISCALL_WRAPPER(ctype_char_is_ch, 12)
2015 MSVCP_bool __thiscall ctype_char_is_ch(const ctype_char *this, short mask, char ch)
2017 TRACE("(%p %x %c)\n", this, mask, ch);
2018 return (this->ctype.table[(unsigned char)ch] & mask) != 0;
2021 /* ?is@?$ctype@D@std@@QBEPBDPBD0PAF@Z */
2022 /* ?is@?$ctype@D@std@@QEBAPEBDPEBD0PEAF@Z */
2023 DEFINE_THISCALL_WRAPPER(ctype_char_is, 16)
2024 const char* __thiscall ctype_char_is(const ctype_char *this, const char *first, const char *last, short *dest)
2026 TRACE("(%p %p %p %p)\n", this, first, last, dest);
2027 for(; first<last; first++)
2028 *dest++ = this->ctype.table[(unsigned char)*first];
2029 return last;
2032 /* ?scan_is@?$ctype@D@std@@QBEPBDFPBD0@Z */
2033 /* ?scan_is@?$ctype@D@std@@QEBAPEBDFPEBD0@Z */
2034 DEFINE_THISCALL_WRAPPER(ctype_char_scan_is, 16)
2035 const char* __thiscall ctype_char_scan_is(const ctype_char *this, short mask, const char *first, const char *last)
2037 TRACE("(%p %x %p %p)\n", this, mask, first, last);
2038 for(; first<last; first++)
2039 if(!ctype_char_is_ch(this, mask, *first))
2040 break;
2041 return first;
2044 /* ?scan_not@?$ctype@D@std@@QBEPBDFPBD0@Z */
2045 /* ?scan_not@?$ctype@D@std@@QEBAPEBDFPEBD0@Z */
2046 DEFINE_THISCALL_WRAPPER(ctype_char_scan_not, 16)
2047 const char* __thiscall ctype_char_scan_not(const ctype_char *this, short mask, const char *first, const char *last)
2049 TRACE("(%p %x %p %p)\n", this, mask, first, last);
2050 for(; first<last; first++)
2051 if(ctype_char_is_ch(this, mask, *first))
2052 break;
2053 return first;
2056 /* ?table@?$ctype@D@std@@IBEPBFXZ */
2057 /* ?table@?$ctype@D@std@@IEBAPEBFXZ */
2058 DEFINE_THISCALL_WRAPPER(ctype_char_table, 4)
2059 const short* __thiscall ctype_char_table(const ctype_char *this)
2061 TRACE("(%p)\n", this);
2062 return this->ctype.table;
2065 /* ?id@?$ctype@_W@std@@2V0locale@2@A */
2066 locale_id ctype_wchar_id = {0};
2067 /* ?id@?$ctype@G@std@@2V0locale@2@A */
2068 locale_id ctype_short_id = {0};
2070 /* ??_7?$ctype@_W@std@@6B@ */
2071 extern const vtable_ptr MSVCP_ctype_wchar_vtable;
2072 /* ??_7?$ctype@G@std@@6B@ */
2073 extern const vtable_ptr MSVCP_ctype_short_vtable;
2075 /* ?_Id_func@?$ctype@_W@std@@SAAAVid@locale@2@XZ */
2076 /* ?_Id_func@?$ctype@_W@std@@SAAEAVid@locale@2@XZ */
2077 locale_id* __cdecl ctype_wchar__Id_func(void)
2079 TRACE("()\n");
2080 return &ctype_wchar_id;
2083 /* ?_Id_func@?$ctype@G@std@@SAAAVid@locale@2@XZ */
2084 /* ?_Id_func@?$ctype@G@std@@SAAEAVid@locale@2@XZ */
2085 locale_id* __cdecl ctype_short__Id_func(void)
2087 TRACE("()\n");
2088 return &ctype_short_id;
2091 /* ?_Init@?$ctype@_W@std@@IAEXABV_Locinfo@2@@Z */
2092 /* ?_Init@?$ctype@_W@std@@IEAAXAEBV_Locinfo@2@@Z */
2093 /* ?_Init@?$ctype@G@std@@IAEXABV_Locinfo@2@@Z */
2094 /* ?_Init@?$ctype@G@std@@IEAAXAEBV_Locinfo@2@@Z */
2095 DEFINE_THISCALL_WRAPPER(ctype_wchar__Init, 8)
2096 void __thiscall ctype_wchar__Init(ctype_wchar *this, const _Locinfo *locinfo)
2098 TRACE("(%p %p)\n", this, locinfo);
2099 _Locinfo__Getctype(locinfo, &this->ctype);
2100 _Locinfo__Getcvt(locinfo, &this->cvt);
2103 /* ??0?$ctype@_W@std@@QAE@ABV_Locinfo@1@I@Z */
2104 /* ??0?$ctype@_W@std@@QEAA@AEBV_Locinfo@1@_K@Z */
2105 DEFINE_THISCALL_WRAPPER(ctype_wchar_ctor_locinfo, 12)
2106 ctype_wchar* __thiscall ctype_wchar_ctor_locinfo(ctype_wchar *this,
2107 const _Locinfo *locinfo, MSVCP_size_t refs)
2109 TRACE("(%p %p %lu)\n", this, locinfo, refs);
2110 ctype_base_ctor_refs(&this->base, refs);
2111 this->base.facet.vtable = &MSVCP_ctype_wchar_vtable;
2112 ctype_wchar__Init(this, locinfo);
2113 return this;
2116 /* ??0?$ctype@G@std@@QAE@ABV_Locinfo@1@I@Z */
2117 /* ??0?$ctype@G@std@@QEAA@AEBV_Locinfo@1@_K@Z */
2118 DEFINE_THISCALL_WRAPPER(ctype_short_ctor_locinfo, 12)
2119 ctype_wchar* __thiscall ctype_short_ctor_locinfo(ctype_wchar *this,
2120 const _Locinfo *locinfo, MSVCP_size_t refs)
2122 ctype_wchar *ret = ctype_wchar_ctor_locinfo(this, locinfo, refs);
2123 this->base.facet.vtable = &MSVCP_ctype_short_vtable;
2124 return ret;
2127 /* ??0?$ctype@_W@std@@QAE@I@Z */
2128 /* ??0?$ctype@_W@std@@QEAA@_K@Z */
2129 DEFINE_THISCALL_WRAPPER(ctype_wchar_ctor_refs, 8)
2130 ctype_wchar* __thiscall ctype_wchar_ctor_refs(ctype_wchar *this, MSVCP_size_t refs)
2132 _Locinfo locinfo;
2134 TRACE("(%p %lu)\n", this, refs);
2136 ctype_base_ctor_refs(&this->base, refs);
2137 this->base.facet.vtable = &MSVCP_ctype_wchar_vtable;
2139 _Locinfo_ctor(&locinfo);
2140 ctype_wchar__Init(this, &locinfo);
2141 _Locinfo_dtor(&locinfo);
2142 return this;
2145 /* ??0?$ctype@G@std@@QAE@I@Z */
2146 /* ??0?$ctype@G@std@@QEAA@_K@Z */
2147 DEFINE_THISCALL_WRAPPER(ctype_short_ctor_refs, 8)
2148 ctype_wchar* __thiscall ctype_short_ctor_refs(ctype_wchar *this, MSVCP_size_t refs)
2150 ctype_wchar *ret = ctype_wchar_ctor_refs(this, refs);
2151 this->base.facet.vtable = &MSVCP_ctype_short_vtable;
2152 return ret;
2155 /* ??0?$ctype@G@std@@IAE@PBDI@Z */
2156 /* ??0?$ctype@G@std@@IEAA@PEBD_K@Z */
2157 DEFINE_THISCALL_WRAPPER(ctype_short_ctor_name, 12)
2158 ctype_wchar* __thiscall ctype_short_ctor_name(ctype_wchar *this,
2159 const char *name, MSVCP_size_t refs)
2161 _Locinfo locinfo;
2163 TRACE("(%p %s %lu)\n", this, debugstr_a(name), refs);
2165 ctype_base_ctor_refs(&this->base, refs);
2166 this->base.facet.vtable = &MSVCP_ctype_short_vtable;
2168 _Locinfo_ctor_cstr(&locinfo, name);
2169 ctype_wchar__Init(this, &locinfo);
2170 _Locinfo_dtor(&locinfo);
2171 return this;
2174 /* ??_F?$ctype@_W@std@@QAEXXZ */
2175 /* ??_F?$ctype@_W@std@@QEAAXXZ */
2176 DEFINE_THISCALL_WRAPPER(ctype_wchar_ctor, 4)
2177 ctype_wchar* __thiscall ctype_wchar_ctor(ctype_wchar *this)
2179 TRACE("(%p)\n", this);
2180 return ctype_short_ctor_refs(this, 0);
2183 /* ??_F?$ctype@G@std@@QAEXXZ */
2184 /* ??_F?$ctype@G@std@@QEAAXXZ */
2185 DEFINE_THISCALL_WRAPPER(ctype_short_ctor, 4)
2186 ctype_wchar* __thiscall ctype_short_ctor(ctype_wchar *this)
2188 ctype_wchar *ret = ctype_wchar_ctor(this);
2189 this->base.facet.vtable = &MSVCP_ctype_short_vtable;
2190 return ret;
2193 /* ??1?$ctype@G@std@@UAE@XZ */
2194 /* ??1?$ctype@G@std@@UEAA@XZ */
2195 /* ??1?$ctype@_W@std@@MAE@XZ */
2196 /* ??1?$ctype@_W@std@@MEAA@XZ */
2197 /* ??1?$ctype@G@std@@MAE@XZ */
2198 /* ??1?$ctype@G@std@@MEAA@XZ */
2199 DEFINE_THISCALL_WRAPPER(ctype_wchar_dtor, 4)
2200 void __thiscall ctype_wchar_dtor(ctype_wchar *this)
2202 TRACE("(%p)\n", this);
2203 if(this->ctype.delfl)
2204 free((void*)this->ctype.table);
2205 #if _MSVCP_VER >= 110
2206 free(this->ctype.name);
2207 #endif
2210 DEFINE_THISCALL_WRAPPER(ctype_wchar_vector_dtor, 8)
2211 ctype_wchar* __thiscall ctype_wchar_vector_dtor(ctype_wchar *this, unsigned int flags)
2213 TRACE("(%p %x)\n", this, flags);
2214 if(flags & 2) {
2215 /* we have an array, with the number of elements stored before the first object */
2216 INT_PTR i, *ptr = (INT_PTR *)this-1;
2218 for(i=*ptr-1; i>=0; i--)
2219 ctype_wchar_dtor(this+i);
2220 MSVCRT_operator_delete(ptr);
2221 } else {
2222 ctype_wchar_dtor(this);
2223 if(flags & 1)
2224 MSVCRT_operator_delete(this);
2227 return this;
2230 /* _Wcrtomb */
2231 int __cdecl _Wcrtomb(char *s, wchar_t wch, int *state, const _Cvtvec *cvt)
2233 int cp, size;
2234 BOOL def;
2236 TRACE("%p %d %p %p\n", s, wch, state, cvt);
2238 if(cvt)
2239 cp = cvt->page;
2240 else
2241 cp = ___lc_codepage_func();
2243 if(!cp) {
2244 if(wch > 255) {
2245 *_errno() = EILSEQ;
2246 return -1;
2249 *s = wch & 255;
2250 return 1;
2253 size = WideCharToMultiByte(cp, 0, &wch, 1, s, MB_LEN_MAX, NULL, &def);
2254 if(!size || def) {
2255 *_errno() = EILSEQ;
2256 return -1;
2259 return size;
2262 /* ?_Donarrow@?$ctype@_W@std@@IBED_WD@Z */
2263 /* ?_Donarrow@?$ctype@_W@std@@IEBAD_WD@Z */
2264 /* ?_Donarrow@?$ctype@G@std@@IBEDGD@Z */
2265 /* ?_Donarrow@?$ctype@G@std@@IEBADGD@Z */
2266 DEFINE_THISCALL_WRAPPER(ctype_wchar__Donarrow, 12)
2267 char __thiscall ctype_wchar__Donarrow(const ctype_wchar *this, wchar_t ch, char dflt)
2269 char buf[MB_LEN_MAX];
2271 TRACE("(%p %d %d)\n", this, ch, dflt);
2273 return _Wcrtomb(buf, ch, NULL, &this->cvt)==1 ? buf[0] : dflt;
2276 /* ?do_narrow@?$ctype@_W@std@@MBED_WD@Z */
2277 /* ?do_narrow@?$ctype@_W@std@@MEBAD_WD@Z */
2278 /* ?do_narrow@?$ctype@G@std@@MBEDGD@Z */
2279 /* ?do_narrow@?$ctype@G@std@@MEBADGD@Z */
2280 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_narrow_ch, 12)
2281 #if _MSVCP_VER >= 80 && _MSVCP_VER <= 90
2282 #define call_ctype_wchar_do_narrow_ch(this, ch, dflt) CALL_VTBL_FUNC(this, 52, \
2283 char, (const ctype_wchar*, wchar_t, char), (this, ch, dflt))
2284 #elif _MSVCP_VER <= 100
2285 #define call_ctype_wchar_do_narrow_ch(this, ch, dflt) CALL_VTBL_FUNC(this, 48, \
2286 char, (const ctype_wchar*, wchar_t, char), (this, ch, dflt))
2287 #else
2288 #define call_ctype_wchar_do_narrow_ch(this, ch, dflt) CALL_VTBL_FUNC(this, 56, \
2289 char, (const ctype_wchar*, wchar_t, char), (this, ch, dflt))
2290 #endif
2291 char __thiscall ctype_wchar_do_narrow_ch(const ctype_wchar *this, wchar_t ch, char dflt)
2293 return ctype_wchar__Donarrow(this, ch, dflt);
2296 /* ?do_narrow@?$ctype@_W@std@@MBEPB_WPB_W0DPAD@Z */
2297 /* ?do_narrow@?$ctype@_W@std@@MEBAPEB_WPEB_W0DPEAD@Z */
2298 /* ?do_narrow@?$ctype@G@std@@MBEPBGPBG0DPAD@Z */
2299 /* ?do_narrow@?$ctype@G@std@@MEBAPEBGPEBG0DPEAD@Z */
2300 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_narrow, 20)
2301 #if _MSVCP_VER >= 80 && _MSVCP_VER <= 90
2302 #define call_ctype_wchar_do_narrow(this, first, last, dflt, dest) CALL_VTBL_FUNC(this, 48, \
2303 const wchar_t*, (const ctype_wchar*, const wchar_t*, const wchar_t*, char, char*), \
2304 (this, first, last, dflt, dest))
2305 #elif _MSVCP_VER <= 100
2306 #define call_ctype_wchar_do_narrow(this, first, last, dflt, dest) CALL_VTBL_FUNC(this, 44, \
2307 const wchar_t*, (const ctype_wchar*, const wchar_t*, const wchar_t*, char, char*), \
2308 (this, first, last, dflt, dest))
2309 #else
2310 #define call_ctype_wchar_do_narrow(this, first, last, dflt, dest) CALL_VTBL_FUNC(this, 52, \
2311 const wchar_t*, (const ctype_wchar*, const wchar_t*, const wchar_t*, char, char*), \
2312 (this, first, last, dflt, dest))
2313 #endif
2314 const wchar_t* __thiscall ctype_wchar_do_narrow(const ctype_wchar *this,
2315 const wchar_t *first, const wchar_t *last, char dflt, char *dest)
2317 TRACE("(%p %p %p %d %p)\n", this, first, last, dflt, dest);
2318 for(; first<last; first++)
2319 *dest++ = ctype_wchar__Donarrow(this, *first, dflt);
2320 return last;
2323 /* ?_Do_narrow_s@?$ctype@_W@std@@MBEPB_WPB_W0DPADI@Z */
2324 /* ?_Do_narrow_s@?$ctype@_W@std@@MEBAPEB_WPEB_W0DPEAD_K@Z */
2325 /* ?_Do_narrow_s@?$ctype@G@std@@MBEPBGPBG0DPADI@Z */
2326 /* ?_Do_narrow_s@?$ctype@G@std@@MEBAPEBGPEBG0DPEAD_K@Z */
2327 DEFINE_THISCALL_WRAPPER(ctype_wchar__Do_narrow_s, 24)
2328 #define call_ctype_wchar__Do_narrow_s(this, first, last, dflt, dest, size) CALL_VTBL_FUNC(this, 56, \
2329 const wchar_t*, (const ctype_wchar*, const wchar_t*, const wchar_t*, char, char*, MSVCP_size_t), \
2330 (this, first, last, dflt, dest, size))
2331 const wchar_t* __thiscall ctype_wchar__Do_narrow_s(const ctype_wchar *this,
2332 const wchar_t *first, const wchar_t *last, char dflt, char *dest, MSVCP_size_t size)
2334 TRACE("(%p %p %p %d %p %lu)\n", this, first, last, dflt, dest, size);
2335 /* This function converts all multi-byte characters to dflt,
2336 * thanks to it result size is known before converting */
2337 if(last-first > size)
2338 ctype_base__Xran();
2339 return ctype_wchar_do_narrow(this, first, last, dflt, dest);
2342 /* ?narrow@?$ctype@_W@std@@QBED_WD@Z */
2343 /* ?narrow@?$ctype@_W@std@@QEBAD_WD@Z */
2344 /* ?narrow@?$ctype@G@std@@QBEDGD@Z */
2345 /* ?narrow@?$ctype@G@std@@QEBADGD@Z */
2346 DEFINE_THISCALL_WRAPPER(ctype_wchar_narrow_ch, 12)
2347 char __thiscall ctype_wchar_narrow_ch(const ctype_wchar *this, wchar_t ch, char dflt)
2349 TRACE("(%p %d %d)\n", this, ch, dflt);
2350 return call_ctype_wchar_do_narrow_ch(this, ch, dflt);
2353 /* ?narrow@?$ctype@_W@std@@QBEPB_WPB_W0DPAD@Z */
2354 /* ?narrow@?$ctype@_W@std@@QEBAPEB_WPEB_W0DPEAD@Z */
2355 /* ?narrow@?$ctype@G@std@@QBEPBGPBG0DPAD@Z */
2356 /* ?narrow@?$ctype@G@std@@QEBAPEBGPEBG0DPEAD@Z */
2357 DEFINE_THISCALL_WRAPPER(ctype_wchar_narrow, 20)
2358 const wchar_t* __thiscall ctype_wchar_narrow(const ctype_wchar *this,
2359 const wchar_t *first, const wchar_t *last, char dflt, char *dest)
2361 TRACE("(%p %p %p %d %p)\n", this, first, last, dflt, dest);
2362 return call_ctype_wchar_do_narrow(this, first, last, dflt, dest);
2365 /* ?_Narrow_s@?$ctype@_W@std@@QBEPB_WPB_W0DPADI@Z */
2366 /* ?_Narrow_s@?$ctype@_W@std@@QEBAPEB_WPEB_W0DPEAD_K@Z */
2367 /* ?_Narrow_s@?$ctype@G@std@@QBEPBGPBG0DPADI@Z */
2368 /* ?_Narrow_s@?$ctype@G@std@@QEBAPEBGPEBG0DPEAD_K@Z */
2369 DEFINE_THISCALL_WRAPPER(ctype_wchar__Narrow_s, 24)
2370 const wchar_t* __thiscall ctype_wchar__Narrow_s(const ctype_wchar *this, const wchar_t *first,
2371 const wchar_t *last, char dflt, char *dest, MSVCP_size_t size)
2373 TRACE("(%p %p %p %d %p %lu)\n", this, first, last, dflt, dest, size);
2374 return call_ctype_wchar__Do_narrow_s(this, first, last, dflt, dest, size);
2377 /* _Mbrtowc */
2378 int __cdecl _Mbrtowc(wchar_t *out, const char *in, MSVCP_size_t len, int *state, const _Cvtvec *cvt)
2380 int i, cp;
2381 CPINFO cp_info;
2382 BOOL is_lead;
2384 TRACE("(%p %p %lu %p %p)\n", out, in, len, state, cvt);
2386 if(!len)
2387 return 0;
2389 if(cvt)
2390 cp = cvt->page;
2391 else
2392 cp = ___lc_codepage_func();
2394 if(!cp) {
2395 if(out)
2396 *out = (unsigned char)*in;
2398 *state = 0;
2399 return *in ? 1 : 0;
2402 if(*state) {
2403 ((char*)state)[1] = *in;
2405 if(!MultiByteToWideChar(cp, MB_ERR_INVALID_CHARS, (char*)state, 2, out, out ? 1 : 0)) {
2406 *state = 0;
2407 *_errno() = EILSEQ;
2408 return -1;
2411 *state = 0;
2412 return 2;
2415 GetCPInfo(cp, &cp_info);
2416 is_lead = FALSE;
2417 for(i=0; i<MAX_LEADBYTES; i+=2) {
2418 if(!cp_info.LeadByte[i+1])
2419 break;
2420 if((unsigned char)*in>=cp_info.LeadByte[i] && (unsigned char)*in<=cp_info.LeadByte[i+1]) {
2421 is_lead = TRUE;
2422 break;
2426 if(is_lead) {
2427 if(len == 1) {
2428 *state = (unsigned char)*in;
2429 return -2;
2432 if(!MultiByteToWideChar(cp, MB_ERR_INVALID_CHARS, in, 2, out, out ? 1 : 0)) {
2433 *_errno() = EILSEQ;
2434 return -1;
2436 return 2;
2439 if(!MultiByteToWideChar(cp, MB_ERR_INVALID_CHARS, in, 1, out, out ? 1 : 0)) {
2440 *_errno() = EILSEQ;
2441 return -1;
2443 return 1;
2446 static inline wchar_t mb_to_wc(char ch, const _Cvtvec *cvt)
2448 int state = 0;
2449 wchar_t ret;
2451 return _Mbrtowc(&ret, &ch, 1, &state, cvt) == 1 ? ret : 0;
2454 /* ?_Dowiden@?$ctype@_W@std@@IBE_WD@Z */
2455 /* ?_Dowiden@?$ctype@_W@std@@IEBA_WD@Z */
2456 /* ?_Dowiden@?$ctype@G@std@@IBEGD@Z */
2457 /* ?_Dowiden@?$ctype@G@std@@IEBAGD@Z */
2458 DEFINE_THISCALL_WRAPPER(ctype_wchar__Dowiden, 8)
2459 wchar_t __thiscall ctype_wchar__Dowiden(const ctype_wchar *this, char ch)
2461 wchar_t ret;
2462 int state = 0;
2463 TRACE("(%p %d)\n", this, ch);
2464 return _Mbrtowc(&ret, &ch, 1, &state, &this->cvt)<0 ? WEOF : ret;
2467 /* ?do_widen@?$ctype@_W@std@@MBE_WD@Z */
2468 /* ?do_widen@?$ctype@_W@std@@MEBA_WD@Z */
2469 /* ?do_widen@?$ctype@G@std@@MBEGD@Z */
2470 /* ?do_widen@?$ctype@G@std@@MEBAGD@Z */
2471 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_widen_ch, 8)
2472 #if _MSVCP_VER <= 100
2473 #define call_ctype_wchar_do_widen_ch(this, ch) CALL_VTBL_FUNC(this, 40, \
2474 wchar_t, (const ctype_wchar*, char), (this, ch))
2475 #else
2476 #define call_ctype_wchar_do_widen_ch(this, ch) CALL_VTBL_FUNC(this, 48, \
2477 wchar_t, (const ctype_wchar*, char), (this, ch))
2478 #endif
2479 wchar_t __thiscall ctype_wchar_do_widen_ch(const ctype_wchar *this, char ch)
2481 return ctype_wchar__Dowiden(this, ch);
2484 /* ?do_widen@?$ctype@_W@std@@MBEPBDPBD0PA_W@Z */
2485 /* ?do_widen@?$ctype@_W@std@@MEBAPEBDPEBD0PEA_W@Z */
2486 /* ?do_widen@?$ctype@G@std@@MBEPBDPBD0PAG@Z */
2487 /* ?do_widen@?$ctype@G@std@@MEBAPEBDPEBD0PEAG@Z */
2488 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_widen, 16)
2489 #if _MSVCP_VER <= 100
2490 #define call_ctype_wchar_do_widen(this, first, last, dest) CALL_VTBL_FUNC(this, 36, \
2491 const char*, (const ctype_wchar*, const char*, const char*, wchar_t*), \
2492 (this, first, last, dest))
2493 #else
2494 #define call_ctype_wchar_do_widen(this, first, last, dest) CALL_VTBL_FUNC(this, 44, \
2495 const char*, (const ctype_wchar*, const char*, const char*, wchar_t*), \
2496 (this, first, last, dest))
2497 #endif
2498 const char* __thiscall ctype_wchar_do_widen(const ctype_wchar *this,
2499 const char *first, const char *last, wchar_t *dest)
2501 TRACE("(%p %p %p %p)\n", this, first, last, dest);
2502 for(; first<last; first++)
2503 *dest++ = ctype_wchar__Dowiden(this, *first);
2504 return last;
2507 /* ?_Do_widen_s@?$ctype@_W@std@@MBEPBDPBD0PA_WI@Z */
2508 /* ?_Do_widen_s@?$ctype@_W@std@@MEBAPEBDPEBD0PEA_W_K@Z */
2509 /* ?_Do_widen_s@?$ctype@G@std@@MBEPBDPBD0PAGI@Z */
2510 /* ?_Do_widen_s@?$ctype@G@std@@MEBAPEBDPEBD0PEAG_K@Z */
2511 DEFINE_THISCALL_WRAPPER(ctype_wchar__Do_widen_s, 20)
2512 #define call_ctype_wchar__Do_widen_s(this, first, last, dest, size) CALL_VTBL_FUNC(this, 44, \
2513 const char*, (const ctype_wchar*, const char*, const char*, wchar_t*, MSVCP_size_t), \
2514 (this, first, last, dest, size))
2515 const char* __thiscall ctype_wchar__Do_widen_s(const ctype_wchar *this,
2516 const char *first, const char *last, wchar_t *dest, MSVCP_size_t size)
2518 TRACE("(%p %p %p %p %lu)\n", this, first, last, dest, size);
2519 /* This function converts all multi-byte characters to WEOF,
2520 * thanks to it result size is known before converting */
2521 if(size < last-first)
2522 ctype_base__Xran();
2523 return ctype_wchar_do_widen(this, first, last, dest);
2526 /* ?widen@?$ctype@_W@std@@QBE_WD@Z */
2527 /* ?widen@?$ctype@_W@std@@QEBA_WD@Z */
2528 /* ?widen@?$ctype@G@std@@QBEGD@Z */
2529 /* ?widen@?$ctype@G@std@@QEBAGD@Z */
2530 DEFINE_THISCALL_WRAPPER(ctype_wchar_widen_ch, 8)
2531 wchar_t __thiscall ctype_wchar_widen_ch(const ctype_wchar *this, char ch)
2533 TRACE("(%p %d)\n", this, ch);
2534 return call_ctype_wchar_do_widen_ch(this, ch);
2537 /* ?widen@?$ctype@_W@std@@QBEPBDPBD0PA_W@Z */
2538 /* ?widen@?$ctype@_W@std@@QEBAPEBDPEBD0PEA_W@Z */
2539 /* ?widen@?$ctype@G@std@@QBEPBDPBD0PAG@Z */
2540 /* ?widen@?$ctype@G@std@@QEBAPEBDPEBD0PEAG@Z */
2541 DEFINE_THISCALL_WRAPPER(ctype_wchar_widen, 16)
2542 const char* __thiscall ctype_wchar_widen(const ctype_wchar *this,
2543 const char *first, const char *last, wchar_t *dest)
2545 TRACE("(%p %p %p %p)\n", this, first, last, dest);
2546 return call_ctype_wchar_do_widen(this, first, last, dest);
2549 /* ?_Widen_s@?$ctype@_W@std@@QBEPBDPBD0PA_WI@Z */
2550 /* ?_Widen_s@?$ctype@_W@std@@QEBAPEBDPEBD0PEA_W_K@Z */
2551 /* ?_Widen_s@?$ctype@G@std@@QBEPBDPBD0PAGI@Z */
2552 /* ?_Widen_s@?$ctype@G@std@@QEBAPEBDPEBD0PEAG_K@Z */
2553 DEFINE_THISCALL_WRAPPER(ctype_wchar__Widen_s, 20)
2554 const char* __thiscall ctype_wchar__Widen_s(const ctype_wchar *this,
2555 const char *first, const char *last, wchar_t *dest, MSVCP_size_t size)
2557 TRACE("(%p %p %p %p %lu)\n", this, first, last, dest, size);
2558 return call_ctype_wchar__Do_widen_s(this, first, last, dest, size);
2561 /* ?_Getcat@?$ctype@_W@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
2562 /* ?_Getcat@?$ctype@_W@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
2563 MSVCP_size_t __cdecl ctype_wchar__Getcat(const locale_facet **facet, const locale *loc)
2565 TRACE("(%p %p)\n", facet, loc);
2567 if(facet && !*facet) {
2568 _Locinfo locinfo;
2570 *facet = MSVCRT_operator_new(sizeof(ctype_wchar));
2571 if(!*facet) {
2572 ERR("Out of memory\n");
2573 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
2574 return 0;
2577 _Locinfo_ctor_cstr(&locinfo, locale_string_char_c_str(&loc->ptr->name));
2578 ctype_wchar_ctor_locinfo((ctype_wchar*)*facet, &locinfo, 0);
2579 _Locinfo_dtor(&locinfo);
2582 return LC_CTYPE;
2585 /* ?_Getcat@?$ctype@_W@std@@SAIPAPBVfacet@locale@2@@Z */
2586 /* ?_Getcat@?$ctype@_W@std@@SA_KPEAPEBVfacet@locale@2@@Z */
2587 MSVCP_size_t __cdecl ctype_wchar__Getcat_old(const locale_facet **facet)
2589 return ctype_wchar__Getcat(facet, locale_classic());
2592 /* ?_Getcat@?$ctype@G@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
2593 /* ?_Getcat@?$ctype@G@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
2594 MSVCP_size_t __cdecl ctype_short__Getcat(const locale_facet **facet, const locale *loc)
2596 if(facet && !*facet) {
2597 ctype_wchar__Getcat(facet, loc);
2598 (*(locale_facet**)facet)->vtable = &MSVCP_ctype_short_vtable;
2601 return LC_CTYPE;
2604 /* ?_Getcat@?$ctype@G@std@@SAIPAPBVfacet@locale@2@@Z */
2605 /* ?_Getcat@?$ctype@G@std@@SA_KPEAPEBVfacet@locale@2@@Z */
2606 MSVCP_size_t __cdecl ctype_short__Getcat_old(const locale_facet **facet)
2608 return ctype_short__Getcat(facet, locale_classic());
2611 /* _Towlower */
2612 wchar_t __cdecl _Towlower(wchar_t ch, const _Ctypevec *ctype)
2614 TRACE("(%d %p)\n", ch, ctype);
2615 return tolowerW(ch);
2618 ctype_wchar* ctype_wchar_use_facet(const locale *loc)
2620 static ctype_wchar *obj = NULL;
2622 _Lockit lock;
2623 const locale_facet *fac;
2625 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
2626 fac = locale__Getfacet(loc, locale_id_operator_size_t(&ctype_wchar_id));
2627 if(fac) {
2628 _Lockit_dtor(&lock);
2629 return (ctype_wchar*)fac;
2632 if(obj) {
2633 _Lockit_dtor(&lock);
2634 return obj;
2637 ctype_wchar__Getcat(&fac, loc);
2638 obj = (ctype_wchar*)fac;
2639 call_locale_facet__Incref(&obj->base.facet);
2640 locale_facet_register(&obj->base.facet);
2641 _Lockit_dtor(&lock);
2643 return obj;
2646 ctype_wchar* ctype_short_use_facet(const locale *loc)
2648 static ctype_wchar *obj = NULL;
2650 _Lockit lock;
2651 const locale_facet *fac;
2653 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
2654 fac = locale__Getfacet(loc, locale_id_operator_size_t(&ctype_short_id));
2655 if(fac) {
2656 _Lockit_dtor(&lock);
2657 return (ctype_wchar*)fac;
2660 if(obj) {
2661 _Lockit_dtor(&lock);
2662 return obj;
2665 ctype_short__Getcat(&fac, loc);
2666 obj = (ctype_wchar*)fac;
2667 call_locale_facet__Incref(&obj->base.facet);
2668 locale_facet_register(&obj->base.facet);
2669 _Lockit_dtor(&lock);
2671 return obj;
2674 /* ?do_tolower@?$ctype@_W@std@@MBE_W_W@Z */
2675 /* ?do_tolower@?$ctype@_W@std@@MEBA_W_W@Z */
2676 /* ?do_tolower@?$ctype@G@std@@MBEGG@Z */
2677 /* ?do_tolower@?$ctype@G@std@@MEBAGG@Z */
2678 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_tolower_ch, 8)
2679 #if _MSVCP_VER <= 100
2680 #define call_ctype_wchar_do_tolower_ch(this, ch) CALL_VTBL_FUNC(this, 24, \
2681 wchar_t, (const ctype_wchar*, wchar_t), (this, ch))
2682 #else
2683 #define call_ctype_wchar_do_tolower_ch(this, ch) CALL_VTBL_FUNC(this, 32, \
2684 wchar_t, (const ctype_wchar*, wchar_t), (this, ch))
2685 #endif
2686 wchar_t __thiscall ctype_wchar_do_tolower_ch(const ctype_wchar *this, wchar_t ch)
2688 return _Towlower(ch, &this->ctype);
2691 /* ?do_tolower@?$ctype@_W@std@@MBEPB_WPA_WPB_W@Z */
2692 /* ?do_tolower@?$ctype@_W@std@@MEBAPEB_WPEA_WPEB_W@Z */
2693 /* ?do_tolower@?$ctype@G@std@@MBEPBGPAGPBG@Z */
2694 /* ?do_tolower@?$ctype@G@std@@MEBAPEBGPEAGPEBG@Z */
2695 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_tolower, 12)
2696 #if _MSVCP_VER <= 100
2697 #define call_ctype_wchar_do_tolower(this, first, last) CALL_VTBL_FUNC(this, 20, \
2698 const wchar_t*, (const ctype_wchar*, wchar_t*, const wchar_t*), \
2699 (this, first, last))
2700 #else
2701 #define call_ctype_wchar_do_tolower(this, first, last) CALL_VTBL_FUNC(this, 28, \
2702 const wchar_t*, (const ctype_wchar*, wchar_t*, const wchar_t*), \
2703 (this, first, last))
2704 #endif
2705 const wchar_t* __thiscall ctype_wchar_do_tolower(const ctype_wchar *this,
2706 wchar_t *first, const wchar_t *last)
2708 TRACE("(%p %p %p)\n", this, first, last);
2709 for(; first<last; first++)
2710 *first = _Towlower(*first, &this->ctype);
2711 return last;
2714 /* ?tolower@?$ctype@_W@std@@QBE_W_W@Z */
2715 /* ?tolower@?$ctype@_W@std@@QEBA_W_W@Z */
2716 /* ?tolower@?$ctype@G@std@@QBEGG@Z */
2717 /* ?tolower@?$ctype@G@std@@QEBAGG@Z */
2718 DEFINE_THISCALL_WRAPPER(ctype_wchar_tolower_ch, 8)
2719 wchar_t __thiscall ctype_wchar_tolower_ch(const ctype_wchar *this, wchar_t ch)
2721 TRACE("(%p %d)\n", this, ch);
2722 return call_ctype_wchar_do_tolower_ch(this, ch);
2725 /* ?tolower@?$ctype@_W@std@@QBEPB_WPA_WPB_W@Z */
2726 /* ?tolower@?$ctype@_W@std@@QEBAPEB_WPEA_WPEB_W@Z */
2727 /* ?tolower@?$ctype@G@std@@QBEPBGPAGPBG@Z */
2728 /* ?tolower@?$ctype@G@std@@QEBAPEBGPEAGPEBG@Z */
2729 DEFINE_THISCALL_WRAPPER(ctype_wchar_tolower, 12)
2730 const wchar_t* __thiscall ctype_wchar_tolower(const ctype_wchar *this,
2731 wchar_t *first, const wchar_t *last)
2733 TRACE("(%p %p %p)\n", this, first, last);
2734 return call_ctype_wchar_do_tolower(this, first, last);
2737 /* _Towupper */
2738 wchar_t __cdecl _Towupper(wchar_t ch, const _Ctypevec *ctype)
2740 TRACE("(%d %p)\n", ch, ctype);
2741 return toupperW(ch);
2744 /* ?do_toupper@?$ctype@_W@std@@MBE_W_W@Z */
2745 /* ?do_toupper@?$ctype@_W@std@@MEBA_W_W@Z */
2746 /* ?do_toupper@?$ctype@G@std@@MBEGG@Z */
2747 /* ?do_toupper@?$ctype@G@std@@MEBAGG@Z */
2748 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_toupper_ch, 8)
2749 #if _MSVCP_VER <= 100
2750 #define call_ctype_wchar_do_toupper_ch(this, ch) CALL_VTBL_FUNC(this, 32, \
2751 wchar_t, (const ctype_wchar*, wchar_t), (this, ch))
2752 #else
2753 #define call_ctype_wchar_do_toupper_ch(this, ch) CALL_VTBL_FUNC(this, 40, \
2754 wchar_t, (const ctype_wchar*, wchar_t), (this, ch))
2755 #endif
2756 wchar_t __thiscall ctype_wchar_do_toupper_ch(const ctype_wchar *this, wchar_t ch)
2758 return _Towupper(ch, &this->ctype);
2761 /* ?do_toupper@?$ctype@_W@std@@MBEPB_WPA_WPB_W@Z */
2762 /* ?do_toupper@?$ctype@_W@std@@MEBAPEB_WPEA_WPEB_W@Z */
2763 /* ?do_toupper@?$ctype@G@std@@MBEPBGPAGPBG@Z */
2764 /* ?do_toupper@?$ctype@G@std@@MEBAPEBGPEAGPEBG@Z */
2765 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_toupper, 12)
2766 #if _MSVCP_VER <= 100
2767 #define call_ctype_wchar_do_toupper(this, first, last) CALL_VTBL_FUNC(this, 28, \
2768 const wchar_t*, (const ctype_wchar*, wchar_t*, const wchar_t*), \
2769 (this, first, last))
2770 #else
2771 #define call_ctype_wchar_do_toupper(this, first, last) CALL_VTBL_FUNC(this, 36, \
2772 const wchar_t*, (const ctype_wchar*, wchar_t*, const wchar_t*), \
2773 (this, first, last))
2774 #endif
2775 const wchar_t* __thiscall ctype_wchar_do_toupper(const ctype_wchar *this,
2776 wchar_t *first, const wchar_t *last)
2778 TRACE("(%p %p %p)\n", this, first, last);
2779 for(; first<last; first++)
2780 *first = _Towupper(*first, &this->ctype);
2781 return last;
2784 /* ?toupper@?$ctype@_W@std@@QBE_W_W@Z */
2785 /* ?toupper@?$ctype@_W@std@@QEBA_W_W@Z */
2786 /* ?toupper@?$ctype@G@std@@QBEGG@Z */
2787 /* ?toupper@?$ctype@G@std@@QEBAGG@Z */
2788 DEFINE_THISCALL_WRAPPER(ctype_wchar_toupper_ch, 8)
2789 wchar_t __thiscall ctype_wchar_toupper_ch(const ctype_wchar *this, wchar_t ch)
2791 TRACE("(%p %d)\n", this, ch);
2792 return call_ctype_wchar_do_toupper_ch(this, ch);
2795 /* ?toupper@?$ctype@_W@std@@QBEPB_WPA_WPB_W@Z */
2796 /* ?toupper@?$ctype@_W@std@@QEBAPEB_WPEA_WPEB_W@Z */
2797 /* ?toupper@?$ctype@G@std@@QBEPBGPAGPBG@Z */
2798 /* ?toupper@?$ctype@G@std@@QEBAPEBGPEAGPEBG@Z */
2799 DEFINE_THISCALL_WRAPPER(ctype_wchar_toupper, 12)
2800 const wchar_t* __thiscall ctype_wchar_toupper(const ctype_wchar *this,
2801 wchar_t *first, const wchar_t *last)
2803 TRACE("(%p %p %p)\n", this, first, last);
2804 return call_ctype_wchar_do_toupper(this, first, last);
2807 /* _Getwctypes */
2808 const wchar_t* __cdecl _Getwctypes(const wchar_t *first, const wchar_t *last,
2809 short *mask, const _Ctypevec *ctype)
2811 TRACE("(%p %p %p %p)\n", first, last, mask, ctype);
2812 GetStringTypeW(CT_CTYPE1, first, last-first, (WORD*)mask);
2813 return last;
2816 /* _Getwctype */
2817 short __cdecl _Getwctype(wchar_t ch, const _Ctypevec *ctype)
2819 short mask = 0;
2820 _Getwctypes(&ch, &ch+1, &mask, ctype);
2821 return mask;
2824 /* ?do_is@?$ctype@_W@std@@MBE_NF_W@Z */
2825 /* ?do_is@?$ctype@_W@std@@MEBA_NF_W@Z */
2826 /* ?do_is@?$ctype@G@std@@MBE_NFG@Z */
2827 /* ?do_is@?$ctype@G@std@@MEBA_NFG@Z */
2828 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_is_ch, 12)
2829 #if _MSVCP_VER <= 100
2830 #define call_ctype_wchar_do_is_ch(this, mask, ch) CALL_VTBL_FUNC(this, 8, \
2831 MSVCP_bool, (const ctype_wchar*, short, wchar_t), (this, mask, ch))
2832 #else
2833 #define call_ctype_wchar_do_is_ch(this, mask, ch) CALL_VTBL_FUNC(this, 16, \
2834 MSVCP_bool, (const ctype_wchar*, short, wchar_t), (this, mask, ch))
2835 #endif
2836 MSVCP_bool __thiscall ctype_wchar_do_is_ch(const ctype_wchar *this, short mask, wchar_t ch)
2838 TRACE("(%p %x %d)\n", this, mask, ch);
2839 return (_Getwctype(ch, &this->ctype) & mask) != 0;
2842 /* ?do_is@?$ctype@_W@std@@MBEPB_WPB_W0PAF@Z */
2843 /* ?do_is@?$ctype@_W@std@@MEBAPEB_WPEB_W0PEAF@Z */
2844 /* ?do_is@?$ctype@G@std@@MBEPBGPBG0PAF@Z */
2845 /* ?do_is@?$ctype@G@std@@MEBAPEBGPEBG0PEAF@Z */
2846 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_is, 16)
2847 #if _MSVCP_VER <= 100
2848 #define call_ctype_wchar_do_is(this, first, last, dest) CALL_VTBL_FUNC(this, 4, \
2849 const wchar_t*, (const ctype_wchar*, const wchar_t*, const wchar_t*, short*), \
2850 (this, first, last, dest))
2851 #else
2852 #define call_ctype_wchar_do_is(this, first, last, dest) CALL_VTBL_FUNC(this, 12, \
2853 const wchar_t*, (const ctype_wchar*, const wchar_t*, const wchar_t*, short*), \
2854 (this, first, last, dest))
2855 #endif
2856 const wchar_t* __thiscall ctype_wchar_do_is(const ctype_wchar *this,
2857 const wchar_t *first, const wchar_t *last, short *dest)
2859 TRACE("(%p %p %p %p)\n", this, first, last, dest);
2860 return _Getwctypes(first, last, dest, &this->ctype);
2863 /* ?is@?$ctype@_W@std@@QBE_NF_W@Z */
2864 /* ?is@?$ctype@_W@std@@QEBA_NF_W@Z */
2865 /* ?is@?$ctype@G@std@@QBE_NFG@Z */
2866 /* ?is@?$ctype@G@std@@QEBA_NFG@Z */
2867 DEFINE_THISCALL_WRAPPER(ctype_wchar_is_ch, 12)
2868 MSVCP_bool __thiscall ctype_wchar_is_ch(const ctype_wchar *this, short mask, wchar_t ch)
2870 TRACE("(%p %x %d)\n", this, mask, ch);
2871 return call_ctype_wchar_do_is_ch(this, mask, ch);
2874 /* ?is@?$ctype@_W@std@@QBEPB_WPB_W0PAF@Z */
2875 /* ?is@?$ctype@_W@std@@QEBAPEB_WPEB_W0PEAF@Z */
2876 /* ?is@?$ctype@G@std@@QBEPBGPBG0PAF@Z */
2877 /* ?is@?$ctype@G@std@@QEBAPEBGPEBG0PEAF@Z */
2878 DEFINE_THISCALL_WRAPPER(ctype_wchar_is, 16)
2879 const wchar_t* __thiscall ctype_wchar_is(const ctype_wchar *this,
2880 const wchar_t *first, const wchar_t *last, short *dest)
2882 TRACE("(%p %p %p %p)\n", this, first, last, dest);
2883 return call_ctype_wchar_do_is(this, first, last, dest);
2886 /* ?do_scan_is@?$ctype@_W@std@@MBEPB_WFPB_W0@Z */
2887 /* ?do_scan_is@?$ctype@_W@std@@MEBAPEB_WFPEB_W0@Z */
2888 /* ?do_scan_is@?$ctype@G@std@@MBEPBGFPBG0@Z */
2889 /* ?do_scan_is@?$ctype@G@std@@MEBAPEBGFPEBG0@Z */
2890 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_scan_is, 16)
2891 #if _MSVCP_VER <= 100
2892 #define call_ctype_wchar_do_scan_is(this, mask, first, last) CALL_VTBL_FUNC(this, 12, \
2893 const wchar_t*, (const ctype_wchar*, short, const wchar_t*, const wchar_t*), \
2894 (this, mask, first, last))
2895 #else
2896 #define call_ctype_wchar_do_scan_is(this, mask, first, last) CALL_VTBL_FUNC(this, 20, \
2897 const wchar_t*, (const ctype_wchar*, short, const wchar_t*, const wchar_t*), \
2898 (this, mask, first, last))
2899 #endif
2900 const wchar_t* __thiscall ctype_wchar_do_scan_is(const ctype_wchar *this,
2901 short mask, const wchar_t *first, const wchar_t *last)
2903 TRACE("(%p %d %p %p)\n", this, mask, first, last);
2904 for(; first<last; first++)
2905 if(!ctype_wchar_is_ch(this, mask, *first))
2906 break;
2907 return first;
2910 /* ?scan_is@?$ctype@_W@std@@QBEPB_WFPB_W0@Z */
2911 /* ?scan_is@?$ctype@_W@std@@QEBAPEB_WFPEB_W0@Z */
2912 /* ?scan_is@?$ctype@G@std@@QBEPBGFPBG0@Z */
2913 /* ?scan_is@?$ctype@G@std@@QEBAPEBGFPEBG0@Z */
2914 DEFINE_THISCALL_WRAPPER(ctype_wchar_scan_is, 16)
2915 const wchar_t* __thiscall ctype_wchar_scan_is(const ctype_wchar *this,
2916 short mask, const wchar_t *first, const wchar_t *last)
2918 TRACE("(%p %x %p %p)\n", this, mask, first, last);
2919 return call_ctype_wchar_do_scan_is(this, mask, first, last);
2922 /* ?do_scan_not@?$ctype@_W@std@@MBEPB_WFPB_W0@Z */
2923 /* ?do_scan_not@?$ctype@_W@std@@MEBAPEB_WFPEB_W0@Z */
2924 /* ?do_scan_not@?$ctype@G@std@@MBEPBGFPBG0@Z */
2925 /* ?do_scan_not@?$ctype@G@std@@MEBAPEBGFPEBG0@Z */
2926 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_scan_not, 16)
2927 #if _MSVCP_VER <= 100
2928 #define call_ctype_wchar_do_scan_not(this, mask, first, last) CALL_VTBL_FUNC(this, 16, \
2929 const wchar_t*, (const ctype_wchar*, short, const wchar_t*, const wchar_t*), \
2930 (this, mask, first, last))
2931 #else
2932 #define call_ctype_wchar_do_scan_not(this, mask, first, last) CALL_VTBL_FUNC(this, 24, \
2933 const wchar_t*, (const ctype_wchar*, short, const wchar_t*, const wchar_t*), \
2934 (this, mask, first, last))
2935 #endif
2936 const wchar_t* __thiscall ctype_wchar_do_scan_not(const ctype_wchar *this,
2937 short mask, const wchar_t *first, const wchar_t *last)
2939 TRACE("(%p %x %p %p)\n", this, mask, first, last);
2940 for(; first<last; first++)
2941 if(ctype_wchar_is_ch(this, mask, *first))
2942 break;
2943 return first;
2946 /* ?scan_not@?$ctype@_W@std@@QBEPB_WFPB_W0@Z */
2947 /* ?scan_not@?$ctype@_W@std@@QEBAPEB_WFPEB_W0@Z */
2948 /* ?scan_not@?$ctype@G@std@@QBEPBGFPBG0@Z */
2949 /* ?scan_not@?$ctype@G@std@@QEBAPEBGFPEBG0@Z */
2950 DEFINE_THISCALL_WRAPPER(ctype_wchar_scan_not, 16)
2951 const wchar_t* __thiscall ctype_wchar_scan_not(const ctype_wchar *this,
2952 short mask, const wchar_t *first, const wchar_t *last)
2954 TRACE("(%p %x %p %p)\n", this, mask, first, last);
2955 return call_ctype_wchar_do_scan_not(this, mask, first, last);
2958 /* ??_7codecvt_base@std@@6B@ */
2959 extern const vtable_ptr MSVCP_codecvt_base_vtable;
2961 /* ??0codecvt_base@std@@QAE@I@Z */
2962 /* ??0codecvt_base@std@@QEAA@_K@Z */
2963 DEFINE_THISCALL_WRAPPER(codecvt_base_ctor_refs, 8)
2964 codecvt_base* __thiscall codecvt_base_ctor_refs(codecvt_base *this, MSVCP_size_t refs)
2966 TRACE("(%p %lu)\n", this, refs);
2967 locale_facet_ctor_refs(&this->facet, refs);
2968 this->facet.vtable = &MSVCP_codecvt_base_vtable;
2969 return this;
2972 /* ??_Fcodecvt_base@std@@QAEXXZ */
2973 /* ??_Fcodecvt_base@std@@QEAAXXZ */
2974 DEFINE_THISCALL_WRAPPER(codecvt_base_ctor, 4)
2975 codecvt_base* __thiscall codecvt_base_ctor(codecvt_base *this)
2977 return codecvt_base_ctor_refs(this, 0);
2980 /* ??1codecvt_base@std@@UAE@XZ */
2981 /* ??1codecvt_base@std@@UEAA@XZ */
2982 DEFINE_THISCALL_WRAPPER(codecvt_base_dtor, 4)
2983 void __thiscall codecvt_base_dtor(codecvt_base *this)
2985 TRACE("(%p)\n", this);
2986 locale_facet_dtor(&this->facet);
2989 DEFINE_THISCALL_WRAPPER(codecvt_base_vector_dtor, 8)
2990 codecvt_base* __thiscall codecvt_base_vector_dtor(codecvt_base *this, unsigned int flags)
2992 TRACE("(%p %x)\n", this, flags);
2993 if(flags & 2) {
2994 /* we have an array, with the number of elements stored before the first object */
2995 INT_PTR i, *ptr = (INT_PTR *)this-1;
2997 for(i=*ptr-1; i>=0; i--)
2998 codecvt_base_dtor(this+i);
2999 MSVCRT_operator_delete(ptr);
3000 } else {
3001 codecvt_base_dtor(this);
3002 if(flags & 1)
3003 MSVCRT_operator_delete(this);
3006 return this;
3009 /* ?do_always_noconv@codecvt_base@std@@MBE_NXZ */
3010 /* ?do_always_noconv@codecvt_base@std@@MEBA_NXZ */
3011 #if _MSVCP_VER <= 100
3012 #define call_codecvt_base_do_always_noconv(this) CALL_VTBL_FUNC(this, 4, \
3013 MSVCP_bool, (const codecvt_base*), (this))
3014 #else
3015 #define call_codecvt_base_do_always_noconv(this) CALL_VTBL_FUNC(this, 12, \
3016 MSVCP_bool, (const codecvt_base*), (this))
3017 #endif
3018 DEFINE_THISCALL_WRAPPER(codecvt_base_do_always_noconv, 4)
3019 MSVCP_bool __thiscall codecvt_base_do_always_noconv(const codecvt_base *this)
3021 TRACE("(%p)\n", this);
3022 return TRUE;
3025 /* ?always_noconv@codecvt_base@std@@QBE_NXZ */
3026 /* ?always_noconv@codecvt_base@std@@QEBA_NXZ */
3027 DEFINE_THISCALL_WRAPPER(codecvt_base_always_noconv, 4)
3028 MSVCP_bool __thiscall codecvt_base_always_noconv(const codecvt_base *this)
3030 TRACE("(%p)\n", this);
3031 return call_codecvt_base_do_always_noconv(this);
3034 /* ?do_max_length@codecvt_base@std@@MBEHXZ */
3035 /* ?do_max_length@codecvt_base@std@@MEBAHXZ */
3036 #if _MSVCP_VER <= 100
3037 #define call_codecvt_base_do_max_length(this) CALL_VTBL_FUNC(this, 8, \
3038 int, (const codecvt_base*), (this))
3039 #else
3040 #define call_codecvt_base_do_max_length(this) CALL_VTBL_FUNC(this, 16, \
3041 int, (const codecvt_base*), (this))
3042 #endif
3043 DEFINE_THISCALL_WRAPPER(codecvt_base_do_max_length, 4)
3044 int __thiscall codecvt_base_do_max_length(const codecvt_base *this)
3046 TRACE("(%p)\n", this);
3047 return 1;
3050 /* ?max_length@codecvt_base@std@@QBEHXZ */
3051 /* ?max_length@codecvt_base@std@@QEBAHXZ */
3052 DEFINE_THISCALL_WRAPPER(codecvt_base_max_length, 4)
3053 int __thiscall codecvt_base_max_length(const codecvt_base *this)
3055 TRACE("(%p)\n", this);
3056 return call_codecvt_base_do_max_length(this);
3059 /* ?do_encoding@codecvt_base@std@@MBEHXZ */
3060 /* ?do_encoding@codecvt_base@std@@MEBAHXZ */
3061 #if _MSVCP_VER <= 100
3062 #define call_codecvt_base_do_encoding(this) CALL_VTBL_FUNC(this, 12, \
3063 int, (const codecvt_base*), (this))
3064 #else
3065 #define call_codecvt_base_do_encoding(this) CALL_VTBL_FUNC(this, 20, \
3066 int, (const codecvt_base*), (this))
3067 #endif
3068 DEFINE_THISCALL_WRAPPER(codecvt_base_do_encoding, 4)
3069 int __thiscall codecvt_base_do_encoding(const codecvt_base *this)
3071 TRACE("(%p)\n", this);
3072 return 1;
3075 /* ?encoding@codecvt_base@std@@QBEHXZ */
3076 /* ?encoding@codecvt_base@std@@QEBAHXZ */
3077 DEFINE_THISCALL_WRAPPER(codecvt_base_encoding, 4)
3078 int __thiscall codecvt_base_encoding(const codecvt_base *this)
3080 TRACE("(%p)\n", this);
3081 return call_codecvt_base_do_encoding(this);
3084 /* ?id@?$codecvt@DDH@std@@2V0locale@2@A */
3085 locale_id codecvt_char_id = {0};
3087 /* ??_7?$codecvt@DDH@std@@6B@ */
3088 extern const vtable_ptr MSVCP_codecvt_char_vtable;
3090 /* ?_Init@?$codecvt@DDH@std@@IAEXABV_Locinfo@2@@Z */
3091 /* ?_Init@?$codecvt@DDH@std@@IEAAXAEBV_Locinfo@2@@Z */
3092 DEFINE_THISCALL_WRAPPER(codecvt_char__Init, 8)
3093 void __thiscall codecvt_char__Init(codecvt_char *this, const _Locinfo *locinfo)
3095 TRACE("(%p %p)\n", this, locinfo);
3098 /* ??0?$codecvt@DDH@std@@QAE@ABV_Locinfo@1@I@Z */
3099 /* ??0?$codecvt@DDH@std@@QEAA@AEBV_Locinfo@1@_K@Z */
3100 DEFINE_THISCALL_WRAPPER(codecvt_char_ctor_locinfo, 12)
3101 codecvt_char* __thiscall codecvt_char_ctor_locinfo(codecvt_char *this, const _Locinfo *locinfo, MSVCP_size_t refs)
3103 TRACE("(%p %p %lu)\n", this, locinfo, refs);
3104 codecvt_base_ctor_refs(&this->base, refs);
3105 this->base.facet.vtable = &MSVCP_codecvt_char_vtable;
3106 return this;
3109 /* ??0?$codecvt@DDH@std@@QAE@I@Z */
3110 /* ??0?$codecvt@DDH@std@@QEAA@_K@Z */
3111 DEFINE_THISCALL_WRAPPER(codecvt_char_ctor_refs, 8)
3112 codecvt_char* __thiscall codecvt_char_ctor_refs(codecvt_char *this, MSVCP_size_t refs)
3114 return codecvt_char_ctor_locinfo(this, NULL, refs);
3117 /* ??_F?$codecvt@DDH@std@@QAEXXZ */
3118 /* ??_F?$codecvt@DDH@std@@QEAAXXZ */
3119 DEFINE_THISCALL_WRAPPER(codecvt_char_ctor, 4)
3120 codecvt_char* __thiscall codecvt_char_ctor(codecvt_char *this)
3122 return codecvt_char_ctor_locinfo(this, NULL, 0);
3125 /* ??1?$codecvt@DDH@std@@UAE@XZ */
3126 /* ??1?$codecvt@DDH@std@@UEAA@XZ */
3127 /* ??1?$codecvt@DDH@std@@MAE@XZ */
3128 /* ??1?$codecvt@DDH@std@@MEAA@XZ */
3129 DEFINE_THISCALL_WRAPPER(codecvt_char_dtor, 4)
3130 void __thiscall codecvt_char_dtor(codecvt_char *this)
3132 TRACE("(%p)\n", this);
3133 codecvt_base_dtor(&this->base);
3136 DEFINE_THISCALL_WRAPPER(codecvt_char_vector_dtor, 8)
3137 codecvt_char* __thiscall codecvt_char_vector_dtor(codecvt_char *this, unsigned int flags)
3139 TRACE("(%p %x)\n", this, flags);
3140 if(flags & 2) {
3141 /* we have an array, with the number of elements stored before the first object */
3142 INT_PTR i, *ptr = (INT_PTR *)this-1;
3144 for(i=*ptr-1; i>=0; i--)
3145 codecvt_char_dtor(this+i);
3146 MSVCRT_operator_delete(ptr);
3147 } else {
3148 codecvt_char_dtor(this);
3149 if(flags & 1)
3150 MSVCRT_operator_delete(this);
3153 return this;
3156 /* ?_Getcat@?$codecvt@DDH@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
3157 /* ?_Getcat@?$codecvt@DDH@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
3158 MSVCP_size_t __cdecl codecvt_char__Getcat(const locale_facet **facet, const locale *loc)
3160 TRACE("(%p %p)\n", facet, loc);
3162 if(facet && !*facet) {
3163 *facet = MSVCRT_operator_new(sizeof(codecvt_char));
3164 if(!*facet) {
3165 ERR("Out of memory\n");
3166 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
3167 return 0;
3169 codecvt_char_ctor((codecvt_char*)*facet);
3172 return LC_CTYPE;
3175 /* ?_Getcat@?$codecvt@DDH@std@@SAIPAPBVfacet@locale@2@@Z */
3176 /* ?_Getcat@?$codecvt@DDH@std@@SA_KPEAPEBVfacet@locale@2@@Z */
3177 MSVCP_size_t __cdecl codecvt_char__Getcat_old(const locale_facet **facet)
3179 return codecvt_char__Getcat(facet, locale_classic());
3182 codecvt_char* codecvt_char_use_facet(const locale *loc)
3184 static codecvt_char *obj = NULL;
3186 _Lockit lock;
3187 const locale_facet *fac;
3189 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
3190 fac = locale__Getfacet(loc, locale_id_operator_size_t(&codecvt_char_id));
3191 if(fac) {
3192 _Lockit_dtor(&lock);
3193 return (codecvt_char*)fac;
3196 if(obj) {
3197 _Lockit_dtor(&lock);
3198 return obj;
3201 codecvt_char__Getcat(&fac, loc);
3202 obj = (codecvt_char*)fac;
3203 call_locale_facet__Incref(&obj->base.facet);
3204 locale_facet_register(&obj->base.facet);
3205 _Lockit_dtor(&lock);
3207 return obj;
3210 /* ?do_in@?$codecvt@DDH@std@@MBEHAAHPBD1AAPBDPAD3AAPAD@Z */
3211 /* ?do_in@?$codecvt@DDH@std@@MEBAHAEAHPEBD1AEAPEBDPEAD3AEAPEAD@Z */
3212 #if _MSVCP_VER <= 100
3213 #define call_codecvt_char_do_in(this, state, from, from_end, from_next, to, to_end, to_next) \
3214 CALL_VTBL_FUNC(this, 16, int, \
3215 (const codecvt_char*, int*, const char*, const char*, const char**, char*, char*, char**), \
3216 (this, state, from, from_end, from_next, to, to_end, to_next))
3217 #else
3218 #define call_codecvt_char_do_in(this, state, from, from_end, from_next, to, to_end, to_next) \
3219 CALL_VTBL_FUNC(this, 24, int, \
3220 (const codecvt_char*, int*, const char*, const char*, const char**, char*, char*, char**), \
3221 (this, state, from, from_end, from_next, to, to_end, to_next))
3222 #endif
3223 DEFINE_THISCALL_WRAPPER(codecvt_char_do_in, 32)
3224 int __thiscall codecvt_char_do_in(const codecvt_char *this, int *state,
3225 const char *from, const char *from_end, const char **from_next,
3226 char *to, char *to_end, char **to_next)
3228 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from, from_end,
3229 from_next, to, to_end, to_next);
3230 *from_next = from;
3231 *to_next = to;
3232 return CODECVT_noconv;
3235 /* ?in@?$codecvt@DDH@std@@QBEHAAHPBD1AAPBDPAD3AAPAD@Z */
3236 /* ?in@?$codecvt@DDH@std@@QEBAHAEAHPEBD1AEAPEBDPEAD3AEAPEAD@Z */
3237 DEFINE_THISCALL_WRAPPER(codecvt_char_in, 32)
3238 int __thiscall codecvt_char_in(const codecvt_char *this, int *state,
3239 const char *from, const char *from_end, const char **from_next,
3240 char *to, char *to_end, char **to_next)
3242 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from, from_end,
3243 from_next, to, to_end, to_next);
3244 return call_codecvt_char_do_in(this, state, from, from_end, from_next,
3245 to, to_end, to_next);
3248 /* ?do_out@?$codecvt@DDH@std@@MBEHAAHPBD1AAPBDPAD3AAPAD@Z */
3249 /* ?do_out@?$codecvt@DDH@std@@MEBAHAEAHPEBD1AEAPEBDPEAD3AEAPEAD@Z */
3250 #if _MSVCP_VER <= 100
3251 #define call_codecvt_char_do_out(this, state, from, from_end, from_next, to, to_end, to_next) \
3252 CALL_VTBL_FUNC(this, 20, int, \
3253 (const codecvt_char*, int*, const char*, const char*, const char**, char*, char*, char**), \
3254 (this, state, from, from_end, from_next, to, to_end, to_next))
3255 #else
3256 #define call_codecvt_char_do_out(this, state, from, from_end, from_next, to, to_end, to_next) \
3257 CALL_VTBL_FUNC(this, 28, int, \
3258 (const codecvt_char*, int*, const char*, const char*, const char**, char*, char*, char**), \
3259 (this, state, from, from_end, from_next, to, to_end, to_next))
3260 #endif
3261 DEFINE_THISCALL_WRAPPER(codecvt_char_do_out, 32)
3262 int __thiscall codecvt_char_do_out(const codecvt_char *this, int *state,
3263 const char *from, const char *from_end, const char **from_next,
3264 char *to, char *to_end, char **to_next)
3266 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from,
3267 from_end, from_next, to, to_end, to_next);
3268 *from_next = from;
3269 *to_next = to;
3270 return CODECVT_noconv;
3273 /* ?out@?$codecvt@DDH@std@@QBEHAAHPBD1AAPBDPAD3AAPAD@Z */
3274 /* ?out@?$codecvt@DDH@std@@QEBAHAEAHPEBD1AEAPEBDPEAD3AEAPEAD@Z */
3275 DEFINE_THISCALL_WRAPPER(codecvt_char_out, 32)
3276 int __thiscall codecvt_char_out(const codecvt_char *this, int *state,
3277 const char *from, const char *from_end, const char **from_next,
3278 char *to, char *to_end, char **to_next)
3280 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from, from_end,
3281 from_next, to, to_end, to_next);
3282 return call_codecvt_char_do_out(this, state, from, from_end, from_next,
3283 to, to_end, to_next);
3286 /* ?do_unshift@?$codecvt@DDH@std@@MBEHAAHPAD1AAPAD@Z */
3287 /* ?do_unshift@?$codecvt@DDH@std@@MEBAHAEAHPEAD1AEAPEAD@Z */
3288 #if _MSVCP_VER <= 100
3289 #define call_codecvt_char_do_unshift(this, state, to, to_end, to_next) CALL_VTBL_FUNC(this, 24, \
3290 int, (const codecvt_char*, int*, char*, char*, char**), (this, state, to, to_end, to_next))
3291 #else
3292 #define call_codecvt_char_do_unshift(this, state, to, to_end, to_next) CALL_VTBL_FUNC(this, 32, \
3293 int, (const codecvt_char*, int*, char*, char*, char**), (this, state, to, to_end, to_next))
3294 #endif
3295 DEFINE_THISCALL_WRAPPER(codecvt_char_do_unshift, 20)
3296 int __thiscall codecvt_char_do_unshift(const codecvt_char *this,
3297 int *state, char *to, char *to_end, char **to_next)
3299 TRACE("(%p %p %p %p %p)\n", this, state, to, to_end, to_next);
3300 *to_next = to;
3301 return CODECVT_noconv;
3304 /* ?unshift@?$codecvt@DDH@std@@QBEHAAHPAD1AAPAD@Z */
3305 /* ?unshift@?$codecvt@DDH@std@@QEBAHAEAHPEAD1AEAPEAD@Z */
3306 DEFINE_THISCALL_WRAPPER(codecvt_char_unshift, 20)
3307 int __thiscall codecvt_char_unshift(const codecvt_char *this,
3308 int *state, char *to, char *to_end, char **to_next)
3310 TRACE("(%p %p %p %p %p)\n", this, state, to, to_end, to_next);
3311 return call_codecvt_char_do_unshift(this, state, to, to_end, to_next);
3314 /* ?do_length@?$codecvt@DDH@std@@MBEHABHPBD1I@Z */
3315 /* ?do_length@?$codecvt@DDH@std@@MEBAHAEBHPEBD1_K@Z */
3316 #if _MSVCP_VER <= 100
3317 #define call_codecvt_char_do_length(this, state, from, from_end, max) CALL_VTBL_FUNC(this, 28, \
3318 int, (const codecvt_char*, const int*, const char*, const char*, MSVCP_size_t), \
3319 (this, state, from, from_end, max))
3320 #else
3321 #define call_codecvt_char_do_length(this, state, from, from_end, max) CALL_VTBL_FUNC(this, 36, \
3322 int, (const codecvt_char*, const int*, const char*, const char*, MSVCP_size_t), \
3323 (this, state, from, from_end, max))
3324 #endif
3325 DEFINE_THISCALL_WRAPPER(codecvt_char_do_length, 20)
3326 int __thiscall codecvt_char_do_length(const codecvt_char *this, const int *state,
3327 const char *from, const char *from_end, MSVCP_size_t max)
3329 TRACE("(%p %p %p %p %lu)\n", this, state, from, from_end, max);
3330 return (from_end-from > max ? max : from_end-from);
3333 /* ?length@?$codecvt@DDH@std@@QBEHABHPBD1I@Z */
3334 /* ?length@?$codecvt@DDH@std@@QEBAHAEBHPEBD1_K@Z */
3335 DEFINE_THISCALL_WRAPPER(codecvt_char_length, 20)
3336 int __thiscall codecvt_char_length(const codecvt_char *this, const int *state,
3337 const char *from, const char *from_end, MSVCP_size_t max)
3339 TRACE("(%p %p %p %p %lu)\n", this, state, from, from_end, max);
3340 return call_codecvt_char_do_length(this, state, from, from_end, max);
3343 /* ?id@?$codecvt@_WDH@std@@2V0locale@2@A */
3344 locale_id codecvt_wchar_id = {0};
3345 /* ?id@?$codecvt@GDH@std@@2V0locale@2@A */
3346 locale_id codecvt_short_id = {0};
3348 /* ??_7?$codecvt@_WDH@std@@6B@ */
3349 extern const vtable_ptr MSVCP_codecvt_wchar_vtable;
3350 /* ??_7?$codecvt@GDH@std@@6B@ */
3351 extern const vtable_ptr MSVCP_codecvt_short_vtable;
3353 /* ?_Init@?$codecvt@GDH@std@@IAEXABV_Locinfo@2@@Z */
3354 /* ?_Init@?$codecvt@GDH@std@@IEAAXAEBV_Locinfo@2@@Z */
3355 /* ?_Init@?$codecvt@_WDH@std@@IAEXABV_Locinfo@2@@Z */
3356 /* ?_Init@?$codecvt@_WDH@std@@IEAAXAEBV_Locinfo@2@@Z */
3357 DEFINE_THISCALL_WRAPPER(codecvt_wchar__Init, 8)
3358 void __thiscall codecvt_wchar__Init(codecvt_wchar *this, const _Locinfo *locinfo)
3360 TRACE("(%p %p)\n", this, locinfo);
3361 _Locinfo__Getcvt(locinfo, &this->cvt);
3364 /* ??0?$codecvt@_WDH@std@@QAE@ABV_Locinfo@1@I@Z */
3365 /* ??0?$codecvt@_WDH@std@@QEAA@AEBV_Locinfo@1@_K@Z */
3366 DEFINE_THISCALL_WRAPPER(codecvt_wchar_ctor_locinfo, 12)
3367 codecvt_wchar* __thiscall codecvt_wchar_ctor_locinfo(codecvt_wchar *this, const _Locinfo *locinfo, MSVCP_size_t refs)
3369 TRACE("(%p %p %ld)\n", this, locinfo, refs);
3371 codecvt_base_ctor_refs(&this->base, refs);
3372 this->base.facet.vtable = &MSVCP_codecvt_wchar_vtable;
3374 codecvt_wchar__Init(this, locinfo);
3375 return this;
3378 /* ??0?$codecvt@GDH@std@@QAE@ABV_Locinfo@1@I@Z */
3379 /* ??0?$codecvt@GDH@std@@QEAA@AEBV_Locinfo@1@_K@Z */
3380 DEFINE_THISCALL_WRAPPER(codecvt_short_ctor_locinfo, 12)
3381 codecvt_wchar* __thiscall codecvt_short_ctor_locinfo(codecvt_wchar *this, const _Locinfo *locinfo, MSVCP_size_t refs)
3383 TRACE("(%p %p %ld)\n", this, locinfo, refs);
3385 codecvt_wchar_ctor_locinfo(this, locinfo, refs);
3386 this->base.facet.vtable = &MSVCP_codecvt_short_vtable;
3387 return this;
3390 /* ??0?$codecvt@_WDH@std@@QAE@I@Z */
3391 /* ??0?$codecvt@_WDH@std@@QEAA@_K@Z */
3392 DEFINE_THISCALL_WRAPPER(codecvt_wchar_ctor_refs, 8)
3393 codecvt_wchar* __thiscall codecvt_wchar_ctor_refs(codecvt_wchar *this, MSVCP_size_t refs)
3395 _Locinfo locinfo;
3397 TRACE("(%p %ld)\n", this, refs);
3399 _Locinfo_ctor(&locinfo);
3400 codecvt_wchar_ctor_locinfo(this, &locinfo, refs);
3401 _Locinfo_dtor(&locinfo);
3402 return this;
3405 /* ??0?$codecvt@GDH@std@@QAE@I@Z */
3406 /* ??0?$codecvt@GDH@std@@QEAA@_K@Z */
3407 DEFINE_THISCALL_WRAPPER(codecvt_short_ctor_refs, 8)
3408 codecvt_wchar* __thiscall codecvt_short_ctor_refs(codecvt_wchar *this, MSVCP_size_t refs)
3410 _Locinfo locinfo;
3412 TRACE("(%p %ld)\n", this, refs);
3414 _Locinfo_ctor(&locinfo);
3415 codecvt_short_ctor_locinfo(this, &locinfo, refs);
3416 _Locinfo_dtor(&locinfo);
3417 return this;
3420 /* ??0?$codecvt@GDH@std@@IAE@PBDI@Z */
3421 /* ??0?$codecvt@GDH@std@@IEAA@PEBD_K@Z */
3422 DEFINE_THISCALL_WRAPPER(codecvt_short_ctor_name, 12)
3423 codecvt_wchar* __thiscall codecvt_short_ctor_name(codecvt_wchar *this, const char *name, MSVCP_size_t refs)
3425 _Locinfo locinfo;
3427 TRACE("(%p %s %ld)\n", this, name, refs);
3429 _Locinfo_ctor_cstr(&locinfo, name);
3430 codecvt_short_ctor_locinfo(this, &locinfo, refs);
3431 _Locinfo_dtor(&locinfo);
3432 return this;
3435 /* ??_F?$codecvt@_WDH@std@@QAEXXZ */
3436 /* ??_F?$codecvt@_WDH@std@@QEAAXXZ */
3437 DEFINE_THISCALL_WRAPPER(codecvt_wchar_ctor, 4)
3438 codecvt_wchar* __thiscall codecvt_wchar_ctor(codecvt_wchar *this)
3440 return codecvt_wchar_ctor_refs(this, 0);
3443 /* ??_F?$codecvt@GDH@std@@QAEXXZ */
3444 /* ??_F?$codecvt@GDH@std@@QEAAXXZ */
3445 DEFINE_THISCALL_WRAPPER(codecvt_short_ctor, 4)
3446 codecvt_wchar* __thiscall codecvt_short_ctor(codecvt_wchar *this)
3448 return codecvt_short_ctor_refs(this, 0);
3451 /* ??1?$codecvt@GDH@std@@UAE@XZ */
3452 /* ??1?$codecvt@GDH@std@@UEAA@XZ */
3453 /* ??1?$codecvt@GDH@std@@MAE@XZ */
3454 /* ??1?$codecvt@GDH@std@@MEAA@XZ */
3455 /* ??1?$codecvt@_WDH@std@@MAE@XZ */
3456 /* ??1?$codecvt@_WDH@std@@MEAA@XZ */
3457 DEFINE_THISCALL_WRAPPER(codecvt_wchar_dtor, 4)
3458 void __thiscall codecvt_wchar_dtor(codecvt_wchar *this)
3460 TRACE("(%p)\n", this);
3461 codecvt_base_dtor(&this->base);
3464 DEFINE_THISCALL_WRAPPER(codecvt_wchar_vector_dtor, 8)
3465 codecvt_wchar* __thiscall codecvt_wchar_vector_dtor(codecvt_wchar *this, unsigned int flags)
3467 TRACE("(%p %x)\n", this, flags);
3468 if(flags & 2) {
3469 /* we have an array, with the number of elements stored before the first object */
3470 INT_PTR i, *ptr = (INT_PTR *)this-1;
3472 for(i=*ptr-1; i>=0; i--)
3473 codecvt_wchar_dtor(this+i);
3474 MSVCRT_operator_delete(ptr);
3475 } else {
3476 codecvt_wchar_dtor(this);
3477 if(flags & 1)
3478 MSVCRT_operator_delete(this);
3481 return this;
3484 /* ?_Getcat@?$codecvt@_WDH@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
3485 /* ?_Getcat@?$codecvt@_WDH@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
3486 MSVCP_size_t __cdecl codecvt_wchar__Getcat(const locale_facet **facet, const locale *loc)
3488 TRACE("(%p %p)\n", facet, loc);
3490 if(facet && !*facet) {
3491 _Locinfo locinfo;
3493 *facet = MSVCRT_operator_new(sizeof(codecvt_wchar));
3494 if(!*facet) {
3495 ERR("Out of memory\n");
3496 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
3497 return 0;
3500 _Locinfo_ctor_cstr(&locinfo, locale_string_char_c_str(&loc->ptr->name));
3501 codecvt_wchar_ctor_locinfo((codecvt_wchar*)*facet, &locinfo, 0);
3502 _Locinfo_dtor(&locinfo);
3505 return LC_CTYPE;
3508 /* ?_Getcat@?$codecvt@_WDH@std@@SAIPAPBVfacet@locale@2@@Z */
3509 /* ?_Getcat@?$codecvt@_WDH@std@@SA_KPEAPEBVfacet@locale@2@@Z */
3510 MSVCP_size_t __cdecl codecvt_wchar__Getcat_old(const locale_facet **facet)
3512 return codecvt_wchar__Getcat(facet, locale_classic());
3515 codecvt_wchar* codecvt_wchar_use_facet(const locale *loc)
3517 static codecvt_wchar *obj = NULL;
3519 _Lockit lock;
3520 const locale_facet *fac;
3522 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
3523 fac = locale__Getfacet(loc, locale_id_operator_size_t(&codecvt_wchar_id));
3524 if(fac) {
3525 _Lockit_dtor(&lock);
3526 return (codecvt_wchar*)fac;
3529 if(obj) {
3530 _Lockit_dtor(&lock);
3531 return obj;
3534 codecvt_wchar__Getcat(&fac, loc);
3535 obj = (codecvt_wchar*)fac;
3536 call_locale_facet__Incref(&obj->base.facet);
3537 locale_facet_register(&obj->base.facet);
3538 _Lockit_dtor(&lock);
3540 return obj;
3543 /* ?_Getcat@?$codecvt@GDH@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
3544 /* ?_Getcat@?$codecvt@GDH@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
3545 MSVCP_size_t __cdecl codecvt_short__Getcat(const locale_facet **facet, const locale *loc)
3547 TRACE("(%p %p)\n", facet, loc);
3549 if(facet && !*facet) {
3550 _Locinfo locinfo;
3552 *facet = MSVCRT_operator_new(sizeof(codecvt_wchar));
3553 if(!*facet) {
3554 ERR("Out of memory\n");
3555 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
3556 return 0;
3559 _Locinfo_ctor_cstr(&locinfo, locale_string_char_c_str(&loc->ptr->name));
3560 codecvt_short_ctor((codecvt_wchar*)*facet);
3561 _Locinfo_dtor(&locinfo);
3564 return LC_CTYPE;
3567 /* ?_Getcat@?$codecvt@GDH@std@@SAIPAPBVfacet@locale@2@@Z */
3568 /* ?_Getcat@?$codecvt@GDH@std@@SA_KPEAPEBVfacet@locale@2@@Z */
3569 MSVCP_size_t __cdecl codecvt_short__Getcat_old(const locale_facet **facet)
3571 return codecvt_short__Getcat(facet, locale_classic());
3574 codecvt_wchar* codecvt_short_use_facet(const locale *loc)
3576 static codecvt_wchar *obj = NULL;
3578 _Lockit lock;
3579 const locale_facet *fac;
3581 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
3582 fac = locale__Getfacet(loc, locale_id_operator_size_t(&codecvt_short_id));
3583 if(fac) {
3584 _Lockit_dtor(&lock);
3585 return (codecvt_wchar*)fac;
3588 if(obj) {
3589 _Lockit_dtor(&lock);
3590 return obj;
3593 codecvt_short__Getcat(&fac, loc);
3594 obj = (codecvt_wchar*)fac;
3595 call_locale_facet__Incref(&obj->base.facet);
3596 locale_facet_register(&obj->base.facet);
3597 _Lockit_dtor(&lock);
3599 return obj;
3602 /* ?_Id_func@?$codecvt@_WDH@std@@SAAAVid@locale@2@XZ */
3603 /* ?_Id_func@?$codecvt@_WDH@std@@SAAEAVid@locale@2@XZ */
3604 locale_id* __cdecl codecvt_wchar__Id_func(void)
3606 TRACE("()\n");
3607 return &codecvt_wchar_id;
3610 /* ?_Id_func@?$codecvt@GDH@std@@SAAAVid@locale@2@XZ */
3611 /* ?_Id_func@?$codecvt@GDH@std@@SAAEAVid@locale@2@XZ */
3612 locale_id* __cdecl codecvt_short__Id_func(void)
3614 TRACE("()\n");
3615 return &codecvt_short_id;
3618 /* ?do_always_noconv@?$codecvt@GDH@std@@MBE_NXZ */
3619 /* ?do_always_noconv@?$codecvt@GDH@std@@MEBA_NXZ */
3620 /* ?do_always_noconv@?$codecvt@_WDH@std@@MBE_NXZ */
3621 /* ?do_always_noconv@?$codecvt@_WDH@std@@MEBA_NXZ */
3622 DEFINE_THISCALL_WRAPPER(codecvt_wchar_do_always_noconv, 4)
3623 MSVCP_bool __thiscall codecvt_wchar_do_always_noconv(const codecvt_wchar *this)
3625 TRACE("(%p)\n", this);
3626 return FALSE;
3629 /* ?do_max_length@?$codecvt@GDH@std@@MBEHXZ */
3630 /* ?do_max_length@?$codecvt@GDH@std@@MEBAHXZ */
3631 /* ?do_max_length@?$codecvt@_WDH@std@@MBEHXZ */
3632 /* ?do_max_length@?$codecvt@_WDH@std@@MEBAHXZ */
3633 DEFINE_THISCALL_WRAPPER(codecvt_wchar_do_max_length, 4)
3634 int __thiscall codecvt_wchar_do_max_length(const codecvt_wchar *this)
3636 TRACE("(%p)\n", this);
3637 return MB_LEN_MAX;
3640 /* ?do_in@?$codecvt@GDH@std@@MBEHAAHPBD1AAPBDPAG3AAPAG@Z */
3641 /* ?do_in@?$codecvt@GDH@std@@MEBAHAEAHPEBD1AEAPEBDPEAG3AEAPEAG@Z */
3642 /* ?do_in@?$codecvt@_WDH@std@@MBEHAAHPBD1AAPBDPA_W3AAPA_W@Z */
3643 /* ?do_in@?$codecvt@_WDH@std@@MEBAHAEAHPEBD1AEAPEBDPEA_W3AEAPEA_W@Z */
3644 #if _MSVCP_VER <= 100
3645 #define call_codecvt_wchar_do_in(this, state, from, from_end, from_next, to, to_end, to_next) \
3646 CALL_VTBL_FUNC(this, 16, int, \
3647 (const codecvt_wchar*, int*, const char*, const char*, const char**, wchar_t*, wchar_t*, wchar_t**), \
3648 (this, state, from, from_end, from_next, to, to_end, to_next))
3649 #else
3650 #define call_codecvt_wchar_do_in(this, state, from, from_end, from_next, to, to_end, to_next) \
3651 CALL_VTBL_FUNC(this, 24, int, \
3652 (const codecvt_wchar*, int*, const char*, const char*, const char**, wchar_t*, wchar_t*, wchar_t**), \
3653 (this, state, from, from_end, from_next, to, to_end, to_next))
3654 #endif
3655 DEFINE_THISCALL_WRAPPER(codecvt_wchar_do_in, 32)
3656 int __thiscall codecvt_wchar_do_in(const codecvt_wchar *this, int *state,
3657 const char *from, const char *from_end, const char **from_next,
3658 wchar_t *to, wchar_t *to_end, wchar_t **to_next)
3660 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from,
3661 from_end, from_next, to, to_end, to_next);
3663 *from_next = from;
3664 *to_next = to;
3666 while(*from_next!=from_end && *to_next!=to_end) {
3667 switch(_Mbrtowc(*to_next, *from_next, from_end-*from_next, state, &this->cvt)) {
3668 case -2:
3669 *from_next = from_end;
3670 return CODECVT_partial;
3671 case -1:
3672 return CODECVT_error;
3673 case 2:
3674 (*from_next)++;
3675 /* fall through */
3676 case 0:
3677 case 1:
3678 (*from_next)++;
3679 (*to_next)++;
3683 return CODECVT_ok;
3686 /* ?in@?$codecvt@GDH@std@@QBEHAAHPBD1AAPBDPAG3AAPAG@Z */
3687 /* ?in@?$codecvt@GDH@std@@QEBAHAEAHPEBD1AEAPEBDPEAG3AEAPEAG@Z */
3688 /* ?in@?$codecvt@_WDH@std@@QBEHAAHPBD1AAPBDPA_W3AAPA_W@Z */
3689 /* ?in@?$codecvt@_WDH@std@@QEBAHAEAHPEBD1AEAPEBDPEA_W3AEAPEA_W@Z */
3690 DEFINE_THISCALL_WRAPPER(codecvt_wchar_in, 32)
3691 int __thiscall codecvt_wchar_in(const codecvt_wchar *this, int *state,
3692 const char *from, const char *from_end, const char **from_next,
3693 wchar_t *to, wchar_t *to_end, wchar_t **to_next)
3695 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from,
3696 from_end, from_next, to, to_end, to_next);
3697 return call_codecvt_wchar_do_in(this, state, from,
3698 from_end, from_next, to, to_end, to_next);
3701 /* ?do_out@?$codecvt@GDH@std@@MBEHAAHPBG1AAPBGPAD3AAPAD@Z */
3702 /* ?do_out@?$codecvt@GDH@std@@MEBAHAEAHPEBG1AEAPEBGPEAD3AEAPEAD@Z */
3703 /* ?do_out@?$codecvt@_WDH@std@@MBEHAAHPB_W1AAPB_WPAD3AAPAD@Z */
3704 /* ?do_out@?$codecvt@_WDH@std@@MEBAHAEAHPEB_W1AEAPEB_WPEAD3AEAPEAD@Z */
3705 #if _MSVCP_VER <= 100
3706 #define call_codecvt_wchar_do_out(this, state, from, from_end, from_next, to, to_end, to_next) \
3707 CALL_VTBL_FUNC(this, 20, int, \
3708 (const codecvt_wchar*, int*, const wchar_t*, const wchar_t*, const wchar_t**, char*, char*, char**), \
3709 (this, state, from, from_end, from_next, to, to_end, to_next))
3710 #else
3711 #define call_codecvt_wchar_do_out(this, state, from, from_end, from_next, to, to_end, to_next) \
3712 CALL_VTBL_FUNC(this, 28, int, \
3713 (const codecvt_wchar*, int*, const wchar_t*, const wchar_t*, const wchar_t**, char*, char*, char**), \
3714 (this, state, from, from_end, from_next, to, to_end, to_next))
3715 #endif
3716 DEFINE_THISCALL_WRAPPER(codecvt_wchar_do_out, 32)
3717 int __thiscall codecvt_wchar_do_out(const codecvt_wchar *this, int *state,
3718 const wchar_t *from, const wchar_t *from_end, const wchar_t **from_next,
3719 char *to, char *to_end, char **to_next)
3721 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from,
3722 from_end, from_next, to, to_end, to_next);
3724 *from_next = from;
3725 *to_next = to;
3727 while(*from_next!=from_end && *to_next!=to_end) {
3728 int old_state = *state, size;
3729 char buf[MB_LEN_MAX];
3731 switch((size = _Wcrtomb(buf, **from_next, state, &this->cvt))) {
3732 case -1:
3733 return CODECVT_error;
3734 default:
3735 if(size > from_end-*from_next) {
3736 *state = old_state;
3737 return CODECVT_partial;
3740 (*from_next)++;
3741 memcpy_s(*to_next, to_end-*to_next, buf, size);
3742 (*to_next) += size;
3746 return CODECVT_ok;
3749 /* ?out@?$codecvt@GDH@std@@QBEHAAHPBG1AAPBGPAD3AAPAD@Z */
3750 /* ?out@?$codecvt@GDH@std@@QEBAHAEAHPEBG1AEAPEBGPEAD3AEAPEAD@Z */
3751 /* ?out@?$codecvt@_WDH@std@@QBEHAAHPB_W1AAPB_WPAD3AAPAD@Z */
3752 /* ?out@?$codecvt@_WDH@std@@QEBAHAEAHPEB_W1AEAPEB_WPEAD3AEAPEAD@Z */
3753 DEFINE_THISCALL_WRAPPER(codecvt_wchar_out, 32)
3754 int __thiscall codecvt_wchar_out(const codecvt_wchar *this, int *state,
3755 const wchar_t *from, const wchar_t *from_end, const wchar_t **from_next,
3756 char *to, char *to_end, char **to_next)
3758 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from,
3759 from_end, from_next, to, to_end, to_next);
3760 return call_codecvt_wchar_do_out(this, state, from,
3761 from_end, from_next, to, to_end, to_next);
3764 /* ?do_unshift@?$codecvt@GDH@std@@MBEHAAHPAD1AAPAD@Z */
3765 /* ?do_unshift@?$codecvt@GDH@std@@MEBAHAEAHPEAD1AEAPEAD@Z */
3766 /* ?do_unshift@?$codecvt@_WDH@std@@MBEHAAHPAD1AAPAD@Z */
3767 /* ?do_unshift@?$codecvt@_WDH@std@@MEBAHAEAHPEAD1AEAPEAD@Z */
3768 #if _MSVCP_VER <= 100
3769 #define call_codecvt_wchar_do_unshift(this, state, to, to_end, to_next) CALL_VTBL_FUNC(this, 24, \
3770 int, (const codecvt_wchar*, int*, char*, char*, char**), (this, state, to, to_end, to_next))
3771 #else
3772 #define call_codecvt_wchar_do_unshift(this, state, to, to_end, to_next) CALL_VTBL_FUNC(this, 32, \
3773 int, (const codecvt_wchar*, int*, char*, char*, char**), (this, state, to, to_end, to_next))
3774 #endif
3775 DEFINE_THISCALL_WRAPPER(codecvt_wchar_do_unshift, 20)
3776 int __thiscall codecvt_wchar_do_unshift(const codecvt_wchar *this,
3777 int *state, char *to, char *to_end, char **to_next)
3779 TRACE("(%p %p %p %p %p)\n", this, state, to, to_end, to_next);
3780 if(*state)
3781 WARN("unexpected state: %x\n", *state);
3783 *to_next = to;
3784 return CODECVT_ok;
3787 /* ?unshift@?$codecvt@GDH@std@@QBEHAAHPAD1AAPAD@Z */
3788 /* ?unshift@?$codecvt@GDH@std@@QEBAHAEAHPEAD1AEAPEAD@Z */
3789 /* ?unshift@?$codecvt@_WDH@std@@QBEHAAHPAD1AAPAD@Z */
3790 /* ?unshift@?$codecvt@_WDH@std@@QEBAHAEAHPEAD1AEAPEAD@Z */
3791 DEFINE_THISCALL_WRAPPER(codecvt_wchar_unshift, 20)
3792 int __thiscall codecvt_wchar_unshift(const codecvt_wchar *this,
3793 int *state, char *to, char *to_end, char **to_next)
3795 TRACE("(%p %p %p %p %p)\n", this, state, to, to_end, to_next);
3796 return call_codecvt_wchar_do_unshift(this, state, to, to_end, to_next);
3799 /* ?do_length@?$codecvt@GDH@std@@MBEHABHPBD1I@Z */
3800 /* ?do_length@?$codecvt@GDH@std@@MEBAHAEBHPEBD1_K@Z */
3801 /* ?do_length@?$codecvt@_WDH@std@@MBEHABHPBD1I@Z */
3802 /* ?do_length@?$codecvt@_WDH@std@@MEBAHAEBHPEBD1_K@Z */
3803 #if _MSVCP_VER <= 100
3804 #define call_codecvt_wchar_do_length(this, state, from, from_end, max) CALL_VTBL_FUNC(this, 28, \
3805 int, (const codecvt_wchar*, const int*, const char*, const char*, MSVCP_size_t), \
3806 (this, state, from, from_end, max))
3807 #else
3808 #define call_codecvt_wchar_do_length(this, state, from, from_end, max) CALL_VTBL_FUNC(this, 36, \
3809 int, (const codecvt_wchar*, const int*, const char*, const char*, MSVCP_size_t), \
3810 (this, state, from, from_end, max))
3811 #endif
3812 DEFINE_THISCALL_WRAPPER(codecvt_wchar_do_length, 20)
3813 int __thiscall codecvt_wchar_do_length(const codecvt_wchar *this, const int *state,
3814 const char *from, const char *from_end, MSVCP_size_t max)
3816 int tmp_state = *state, ret=0;
3818 TRACE("(%p %p %p %p %ld)\n", this, state, from, from_end, max);
3820 while(ret<max && from!=from_end) {
3821 switch(_Mbrtowc(NULL, from, from_end-from, &tmp_state, &this->cvt)) {
3822 case -2:
3823 case -1:
3824 return ret;
3825 case 2:
3826 from++;
3827 /* fall through */
3828 case 0:
3829 case 1:
3830 from++;
3831 ret++;
3835 return ret;
3838 /* ?length@?$codecvt@GDH@std@@QBEHABHPBD1I@Z */
3839 /* ?length@?$codecvt@GDH@std@@QEBAHAEBHPEBD1_K@Z */
3840 /* ?length@?$codecvt@_WDH@std@@QBEHABHPBD1I@Z */
3841 /* ?length@?$codecvt@_WDH@std@@QEBAHAEBHPEBD1_K@Z */
3842 DEFINE_THISCALL_WRAPPER(codecvt_wchar_length, 20)
3843 int __thiscall codecvt_wchar_length(const codecvt_wchar *this, const int *state,
3844 const char *from, const char *from_end, MSVCP_size_t max)
3846 TRACE("(%p %p %p %p %ld)\n", this, state, from, from_end, max);
3847 return call_codecvt_wchar_do_length(this, state, from, from_end, max);
3850 /* ?id@?$numpunct@D@std@@2V0locale@2@A */
3851 locale_id numpunct_char_id = {0};
3853 /* ??_7?$numpunct@D@std@@6B@ */
3854 extern const vtable_ptr MSVCP_numpunct_char_vtable;
3856 /* ?_Init@?$numpunct@D@std@@IAEXABV_Locinfo@2@_N@Z */
3857 /* ?_Init@?$numpunct@D@std@@IEAAXAEBV_Locinfo@2@_N@Z */
3858 DEFINE_THISCALL_WRAPPER(numpunct_char__Init, 12)
3859 void __thiscall numpunct_char__Init(numpunct_char *this, const _Locinfo *locinfo, MSVCP_bool isdef)
3861 int len;
3863 TRACE("(%p %p %d)\n", this, locinfo, isdef);
3865 len = strlen(_Locinfo__Getfalse(locinfo))+1;
3866 this->false_name = MSVCRT_operator_new(len);
3867 if(this->false_name)
3868 memcpy((char*)this->false_name, _Locinfo__Getfalse(locinfo), len);
3870 len = strlen(_Locinfo__Gettrue(locinfo))+1;
3871 this->true_name = MSVCRT_operator_new(len);
3872 if(this->true_name)
3873 memcpy((char*)this->true_name, _Locinfo__Gettrue(locinfo), len);
3875 if(isdef) {
3876 this->grouping = MSVCRT_operator_new(1);
3877 if(this->grouping)
3878 *(char*)this->grouping = 0;
3880 this->dp = '.';
3881 this->sep = ',';
3882 } else {
3883 const struct lconv *lc = _Locinfo__Getlconv(locinfo);
3885 len = strlen(lc->grouping)+1;
3886 this->grouping = MSVCRT_operator_new(len);
3887 if(this->grouping)
3888 memcpy((char*)this->grouping, lc->grouping, len);
3890 this->dp = lc->decimal_point[0];
3891 this->sep = lc->thousands_sep[0];
3894 if(!this->false_name || !this->true_name || !this->grouping) {
3895 MSVCRT_operator_delete((char*)this->grouping);
3896 MSVCRT_operator_delete((char*)this->false_name);
3897 MSVCRT_operator_delete((char*)this->true_name);
3899 ERR("Out of memory\n");
3900 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
3904 /* ?_Tidy@?$numpunct@D@std@@AAEXXZ */
3905 /* ?_Tidy@?$numpunct@D@std@@AEAAXXZ */
3906 DEFINE_THISCALL_WRAPPER(numpunct_char__Tidy, 4)
3907 void __thiscall numpunct_char__Tidy(numpunct_char *this)
3909 TRACE("(%p)\n", this);
3911 MSVCRT_operator_delete((char*)this->grouping);
3912 MSVCRT_operator_delete((char*)this->false_name);
3913 MSVCRT_operator_delete((char*)this->true_name);
3916 /* ??0?$numpunct@D@std@@QAE@ABV_Locinfo@1@I_N@Z */
3917 /* ??0?$numpunct@D@std@@QEAA@AEBV_Locinfo@1@_K_N@Z */
3918 DEFINE_THISCALL_WRAPPER(numpunct_char_ctor_locinfo, 16)
3919 numpunct_char* __thiscall numpunct_char_ctor_locinfo(numpunct_char *this,
3920 const _Locinfo *locinfo, MSVCP_size_t refs, MSVCP_bool usedef)
3922 TRACE("(%p %p %lu %d)\n", this, locinfo, refs, usedef);
3923 locale_facet_ctor_refs(&this->facet, refs);
3924 this->facet.vtable = &MSVCP_numpunct_char_vtable;
3925 numpunct_char__Init(this, locinfo, usedef);
3926 return this;
3929 /* ??0?$numpunct@D@std@@IAE@PBDI_N@Z */
3930 /* ??0?$numpunct@D@std@@IEAA@PEBD_K_N@Z */
3931 DEFINE_THISCALL_WRAPPER(numpunct_char_ctor_name, 16)
3932 numpunct_char* __thiscall numpunct_char_ctor_name(numpunct_char *this,
3933 const char *name, MSVCP_size_t refs, MSVCP_bool usedef)
3935 _Locinfo locinfo;
3937 TRACE("(%p %s %lu %d)\n", this, debugstr_a(name), refs, usedef);
3938 locale_facet_ctor_refs(&this->facet, refs);
3939 this->facet.vtable = &MSVCP_numpunct_char_vtable;
3941 _Locinfo_ctor_cstr(&locinfo, name);
3942 numpunct_char__Init(this, &locinfo, usedef);
3943 _Locinfo_dtor(&locinfo);
3944 return this;
3947 /* ??0?$numpunct@D@std@@QAE@I@Z */
3948 /* ??0?$numpunct@D@std@@QEAA@_K@Z */
3949 DEFINE_THISCALL_WRAPPER(numpunct_char_ctor_refs, 8)
3950 numpunct_char* __thiscall numpunct_char_ctor_refs(numpunct_char *this, MSVCP_size_t refs)
3952 TRACE("(%p %lu)\n", this, refs);
3953 return numpunct_char_ctor_name(this, "C", refs, FALSE);
3956 /* ??_F?$numpunct@D@std@@QAEXXZ */
3957 /* ??_F?$numpunct@D@std@@QEAAXXZ */
3958 DEFINE_THISCALL_WRAPPER(numpunct_char_ctor, 4)
3959 numpunct_char* __thiscall numpunct_char_ctor(numpunct_char *this)
3961 return numpunct_char_ctor_refs(this, 0);
3964 /* ??1?$numpunct@D@std@@UAE@XZ */
3965 /* ??1?$numpunct@D@std@@UEAA@XZ */
3966 /* ??1?$numpunct@D@std@@MAE@XZ */
3967 /* ??1?$numpunct@D@std@@MEAA@XZ */
3968 DEFINE_THISCALL_WRAPPER(numpunct_char_dtor, 4)
3969 void __thiscall numpunct_char_dtor(numpunct_char *this)
3971 TRACE("(%p)\n", this);
3972 numpunct_char__Tidy(this);
3975 DEFINE_THISCALL_WRAPPER(numpunct_char_vector_dtor, 8)
3976 numpunct_char* __thiscall numpunct_char_vector_dtor(numpunct_char *this, unsigned int flags)
3978 TRACE("(%p %x)\n", this, flags);
3979 if(flags & 2) {
3980 /* we have an array, with the number of elements stored before the first object */
3981 INT_PTR i, *ptr = (INT_PTR *)this-1;
3983 for(i=*ptr-1; i>=0; i--)
3984 numpunct_char_dtor(this+i);
3985 MSVCRT_operator_delete(ptr);
3986 } else {
3987 numpunct_char_dtor(this);
3988 if(flags & 1)
3989 MSVCRT_operator_delete(this);
3992 return this;
3995 /* ?_Getcat@?$numpunct@D@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
3996 /* ?_Getcat@?$numpunct@D@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
3997 MSVCP_size_t __cdecl numpunct_char__Getcat(const locale_facet **facet, const locale *loc)
3999 TRACE("(%p %p)\n", facet, loc);
4001 if(facet && !*facet) {
4002 *facet = MSVCRT_operator_new(sizeof(numpunct_char));
4003 if(!*facet) {
4004 ERR("Out of memory\n");
4005 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
4006 return 0;
4008 numpunct_char_ctor_name((numpunct_char*)*facet,
4009 locale_string_char_c_str(&loc->ptr->name), 0, TRUE);
4012 return LC_NUMERIC;
4015 /* ?_Getcat@?$numpunct@D@std@@SAIPAPBVfacet@locale@2@@Z */
4016 /* ?_Getcat@?$numpunct@D@std@@SA_KPEAPEBVfacet@locale@2@@Z */
4017 MSVCP_size_t __cdecl numpunct_char__Getcat_old(const locale_facet **facet)
4019 return numpunct_char__Getcat(facet, locale_classic());
4022 static numpunct_char* numpunct_char_use_facet(const locale *loc)
4024 static numpunct_char *obj = NULL;
4026 _Lockit lock;
4027 const locale_facet *fac;
4029 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
4030 fac = locale__Getfacet(loc, locale_id_operator_size_t(&numpunct_char_id));
4031 if(fac) {
4032 _Lockit_dtor(&lock);
4033 return (numpunct_char*)fac;
4036 if(obj) {
4037 _Lockit_dtor(&lock);
4038 return obj;
4041 numpunct_char__Getcat(&fac, loc);
4042 obj = (numpunct_char*)fac;
4043 call_locale_facet__Incref(&obj->facet);
4044 locale_facet_register(&obj->facet);
4045 _Lockit_dtor(&lock);
4047 return obj;
4050 /* ?do_decimal_point@?$numpunct@D@std@@MBEDXZ */
4051 /* ?do_decimal_point@?$numpunct@D@std@@MEBADXZ */
4052 DEFINE_THISCALL_WRAPPER(numpunct_char_do_decimal_point, 4)
4053 #if _MSVCP_VER <= 100
4054 #define call_numpunct_char_do_decimal_point(this) CALL_VTBL_FUNC(this, 4, \
4055 char, (const numpunct_char *this), (this))
4056 #else
4057 #define call_numpunct_char_do_decimal_point(this) CALL_VTBL_FUNC(this, 12, \
4058 char, (const numpunct_char *this), (this))
4059 #endif
4060 char __thiscall numpunct_char_do_decimal_point(const numpunct_char *this)
4062 TRACE("(%p)\n", this);
4063 return this->dp;
4066 /* ?decimal_point@?$numpunct@D@std@@QBEDXZ */
4067 /* ?decimal_point@?$numpunct@D@std@@QEBADXZ */
4068 DEFINE_THISCALL_WRAPPER(numpunct_char_decimal_point, 4)
4069 char __thiscall numpunct_char_decimal_point(const numpunct_char *this)
4071 TRACE("(%p)\n", this);
4072 return call_numpunct_char_do_decimal_point(this);
4075 /* ?do_thousands_sep@?$numpunct@D@std@@MBEDXZ */
4076 /* ?do_thousands_sep@?$numpunct@D@std@@MEBADXZ */
4077 DEFINE_THISCALL_WRAPPER(numpunct_char_do_thousands_sep, 4)
4078 #if _MSVCP_VER <= 100
4079 #define call_numpunct_char_do_thousands_sep(this) CALL_VTBL_FUNC(this, 8, \
4080 char, (const numpunct_char*), (this))
4081 #else
4082 #define call_numpunct_char_do_thousands_sep(this) CALL_VTBL_FUNC(this, 16, \
4083 char, (const numpunct_char*), (this))
4084 #endif
4085 char __thiscall numpunct_char_do_thousands_sep(const numpunct_char *this)
4087 TRACE("(%p)\n", this);
4088 return this->sep;
4091 /* ?thousands_sep@?$numpunct@D@std@@QBEDXZ */
4092 /* ?thousands_sep@?$numpunct@D@std@@QEBADXZ */
4093 DEFINE_THISCALL_WRAPPER(numpunct_char_thousands_sep, 4)
4094 char __thiscall numpunct_char_thousands_sep(const numpunct_char *this)
4096 TRACE("(%p)\n", this);
4097 return call_numpunct_char_do_thousands_sep(this);
4100 /* ?do_grouping@?$numpunct@D@std@@MBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4101 /* ?do_grouping@?$numpunct@D@std@@MEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4102 DEFINE_THISCALL_WRAPPER(numpunct_char_do_grouping, 8)
4103 #if _MSVCP_VER <= 100
4104 #define call_numpunct_char_do_grouping(this, ret) CALL_VTBL_FUNC(this, 12, \
4105 basic_string_char*, (const numpunct_char*, basic_string_char*), (this, ret))
4106 #else
4107 #define call_numpunct_char_do_grouping(this, ret) CALL_VTBL_FUNC(this, 20, \
4108 basic_string_char*, (const numpunct_char*, basic_string_char*), (this, ret))
4109 #endif
4110 basic_string_char* __thiscall numpunct_char_do_grouping(
4111 const numpunct_char *this, basic_string_char *ret)
4113 TRACE("(%p)\n", this);
4114 return MSVCP_basic_string_char_ctor_cstr(ret, this->grouping);
4117 /* ?grouping@?$numpunct@D@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4118 /* ?grouping@?$numpunct@D@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4119 DEFINE_THISCALL_WRAPPER(numpunct_char_grouping, 8)
4120 basic_string_char* __thiscall numpunct_char_grouping(const numpunct_char *this, basic_string_char *ret)
4122 TRACE("(%p)\n", this);
4123 return call_numpunct_char_do_grouping(this, ret);
4126 /* ?do_falsename@?$numpunct@D@std@@MBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4127 /* ?do_falsename@?$numpunct@D@std@@MEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4128 DEFINE_THISCALL_WRAPPER(numpunct_char_do_falsename, 8)
4129 #if _MSVCP_VER <= 100
4130 #define call_numpunct_char_do_falsename(this, ret) CALL_VTBL_FUNC(this, 16, \
4131 basic_string_char*, (const numpunct_char*, basic_string_char*), (this, ret))
4132 #else
4133 #define call_numpunct_char_do_falsename(this, ret) CALL_VTBL_FUNC(this, 24, \
4134 basic_string_char*, (const numpunct_char*, basic_string_char*), (this, ret))
4135 #endif
4136 basic_string_char* __thiscall numpunct_char_do_falsename(
4137 const numpunct_char *this, basic_string_char *ret)
4139 TRACE("(%p)\n", this);
4140 return MSVCP_basic_string_char_ctor_cstr(ret, this->false_name);
4143 /* ?falsename@?$numpunct@D@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4144 /* ?falsename@?$numpunct@D@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4145 DEFINE_THISCALL_WRAPPER(numpunct_char_falsename, 8)
4146 basic_string_char* __thiscall numpunct_char_falsename(const numpunct_char *this, basic_string_char *ret)
4148 TRACE("(%p)\n", this);
4149 return call_numpunct_char_do_falsename(this, ret);
4152 /* ?do_truename@?$numpunct@D@std@@MBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4153 /* ?do_truename@?$numpunct@D@std@@MEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4154 DEFINE_THISCALL_WRAPPER(numpunct_char_do_truename, 8)
4155 #if _MSVCP_VER <= 100
4156 #define call_numpunct_char_do_truename(this, ret) CALL_VTBL_FUNC(this, 20, \
4157 basic_string_char*, (const numpunct_char*, basic_string_char*), (this, ret))
4158 #else
4159 #define call_numpunct_char_do_truename(this, ret) CALL_VTBL_FUNC(this, 28, \
4160 basic_string_char*, (const numpunct_char*, basic_string_char*), (this, ret))
4161 #endif
4162 basic_string_char* __thiscall numpunct_char_do_truename(
4163 const numpunct_char *this, basic_string_char *ret)
4165 TRACE("(%p)\n", this);
4166 return MSVCP_basic_string_char_ctor_cstr(ret, this->true_name);
4169 /* ?truename@?$numpunct@D@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4170 /* ?truename@?$numpunct@D@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4171 DEFINE_THISCALL_WRAPPER(numpunct_char_truename, 8)
4172 basic_string_char* __thiscall numpunct_char_truename(const numpunct_char *this, basic_string_char *ret)
4174 TRACE("(%p)\n", this);
4175 return call_numpunct_char_do_truename(this, ret);
4178 /* ?id@?$numpunct@_W@std@@2V0locale@2@A */
4179 locale_id numpunct_wchar_id = {0};
4180 /* ?id@?$numpunct@G@std@@2V0locale@2@A */
4181 locale_id numpunct_short_id = {0};
4183 /* ??_7?$numpunct@_W@std@@6B@ */
4184 extern const vtable_ptr MSVCP_numpunct_wchar_vtable;
4185 /* ??_7?$numpunct@G@std@@6B@ */
4186 extern const vtable_ptr MSVCP_numpunct_short_vtable;
4188 /* ?_Init@?$numpunct@_W@std@@IAEXABV_Locinfo@2@_N@Z */
4189 /* ?_Init@?$numpunct@_W@std@@IEAAXAEBV_Locinfo@2@_N@Z */
4190 /* ?_Init@?$numpunct@G@std@@IAEXABV_Locinfo@2@_N@Z */
4191 /* ?_Init@?$numpunct@G@std@@IEAAXAEBV_Locinfo@2@_N@Z */
4192 DEFINE_THISCALL_WRAPPER(numpunct_wchar__Init, 12)
4193 void __thiscall numpunct_wchar__Init(numpunct_wchar *this,
4194 const _Locinfo *locinfo, MSVCP_bool isdef)
4196 const char *to_convert;
4197 _Cvtvec cvt;
4198 int len;
4200 TRACE("(%p %p %d)\n", this, locinfo, isdef);
4202 _Locinfo__Getcvt(locinfo, &cvt);
4204 to_convert = _Locinfo__Getfalse(locinfo);
4205 len = MultiByteToWideChar(cvt.page, 0, to_convert, -1, NULL, 0);
4206 this->false_name = MSVCRT_operator_new(len*sizeof(WCHAR));
4207 if(this->false_name)
4208 MultiByteToWideChar(cvt.page, 0, to_convert, -1,
4209 (wchar_t*)this->false_name, len);
4211 to_convert = _Locinfo__Gettrue(locinfo);
4212 len = MultiByteToWideChar(cvt.page, 0, to_convert, -1, NULL, 0);
4213 this->true_name = MSVCRT_operator_new(len*sizeof(WCHAR));
4214 if(this->true_name)
4215 MultiByteToWideChar(cvt.page, 0, to_convert, -1,
4216 (wchar_t*)this->true_name, len);
4218 if(isdef) {
4219 this->grouping = MSVCRT_operator_new(1);
4220 if(this->grouping)
4221 *(char*)this->grouping = 0;
4223 this->dp = '.';
4224 this->sep = ',';
4225 } else {
4226 const struct lconv *lc = _Locinfo__Getlconv(locinfo);
4228 len = strlen(lc->grouping)+1;
4229 this->grouping = MSVCRT_operator_new(len);
4230 if(this->grouping)
4231 memcpy((char*)this->grouping, lc->grouping, len);
4233 this->dp = mb_to_wc(lc->decimal_point[0], &cvt);
4234 this->sep = mb_to_wc(lc->thousands_sep[0], &cvt);
4237 if(!this->false_name || !this->true_name || !this->grouping) {
4238 MSVCRT_operator_delete((char*)this->grouping);
4239 MSVCRT_operator_delete((wchar_t*)this->false_name);
4240 MSVCRT_operator_delete((wchar_t*)this->true_name);
4242 ERR("Out of memory\n");
4243 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
4247 /* ?_Tidy@?$numpunct@_W@std@@AAEXXZ */
4248 /* ?_Tidy@?$numpunct@_W@std@@AEAAXXZ */
4249 /* ?_Tidy@?$numpunct@G@std@@AAEXXZ */
4250 /* ?_Tidy@?$numpunct@G@std@@AEAAXXZ */
4251 DEFINE_THISCALL_WRAPPER(numpunct_wchar__Tidy, 4)
4252 void __thiscall numpunct_wchar__Tidy(numpunct_wchar *this)
4254 TRACE("(%p)\n", this);
4256 MSVCRT_operator_delete((char*)this->grouping);
4257 MSVCRT_operator_delete((wchar_t*)this->false_name);
4258 MSVCRT_operator_delete((wchar_t*)this->true_name);
4261 /* ??0?$numpunct@_W@std@@QAE@ABV_Locinfo@1@I_N@Z */
4262 /* ??0?$numpunct@_W@std@@QEAA@AEBV_Locinfo@1@_K_N@Z */
4263 DEFINE_THISCALL_WRAPPER(numpunct_wchar_ctor_locinfo, 16)
4264 numpunct_wchar* __thiscall numpunct_wchar_ctor_locinfo(numpunct_wchar *this,
4265 const _Locinfo *locinfo, MSVCP_size_t refs, MSVCP_bool usedef)
4267 TRACE("(%p %p %lu %d)\n", this, locinfo, refs, usedef);
4268 locale_facet_ctor_refs(&this->facet, refs);
4269 this->facet.vtable = &MSVCP_numpunct_wchar_vtable;
4270 numpunct_wchar__Init(this, locinfo, usedef);
4271 return this;
4274 /* ??0?$numpunct@G@std@@QAE@ABV_Locinfo@1@I_N@Z */
4275 /* ??0?$numpunct@G@std@@QEAA@AEBV_Locinfo@1@_K_N@Z */
4276 DEFINE_THISCALL_WRAPPER(numpunct_short_ctor_locinfo, 16)
4277 numpunct_wchar* __thiscall numpunct_short_ctor_locinfo(numpunct_wchar *this,
4278 const _Locinfo *locinfo, MSVCP_size_t refs, MSVCP_bool usedef)
4280 numpunct_wchar_ctor_locinfo(this, locinfo, refs, usedef);
4281 this->facet.vtable = &MSVCP_numpunct_short_vtable;
4282 return this;
4285 /* ??0?$numpunct@_W@std@@IAE@PBDI_N@Z */
4286 /* ??0?$numpunct@_W@std@@IEAA@PEBD_K_N@Z */
4287 DEFINE_THISCALL_WRAPPER(numpunct_wchar_ctor_name, 16)
4288 numpunct_wchar* __thiscall numpunct_wchar_ctor_name(numpunct_wchar *this,
4289 const char *name, MSVCP_size_t refs, MSVCP_bool usedef)
4291 _Locinfo locinfo;
4293 TRACE("(%p %s %lu %d)\n", this, debugstr_a(name), refs, usedef);
4294 locale_facet_ctor_refs(&this->facet, refs);
4295 this->facet.vtable = &MSVCP_numpunct_wchar_vtable;
4297 _Locinfo_ctor_cstr(&locinfo, name);
4298 numpunct_wchar__Init(this, &locinfo, usedef);
4299 _Locinfo_dtor(&locinfo);
4300 return this;
4303 /* ??0?$numpunct@G@std@@IAE@PBDI_N@Z */
4304 /* ??0?$numpunct@G@std@@IEAA@PEBD_K_N@Z */
4305 DEFINE_THISCALL_WRAPPER(numpunct_short_ctor_name, 16)
4306 numpunct_wchar* __thiscall numpunct_short_ctor_name(numpunct_wchar *this,
4307 const char *name, MSVCP_size_t refs, MSVCP_bool usedef)
4309 numpunct_wchar_ctor_name(this, name, refs, usedef);
4310 this->facet.vtable = &MSVCP_numpunct_short_vtable;
4311 return this;
4314 /* ??0?$numpunct@_W@std@@QAE@I@Z */
4315 /* ??0?$numpunct@_W@std@@QEAA@_K@Z */
4316 DEFINE_THISCALL_WRAPPER(numpunct_wchar_ctor_refs, 8)
4317 numpunct_wchar* __thiscall numpunct_wchar_ctor_refs(numpunct_wchar *this, MSVCP_size_t refs)
4319 TRACE("(%p %lu)\n", this, refs);
4320 return numpunct_wchar_ctor_name(this, "C", refs, FALSE);
4323 /* ??0?$numpunct@G@std@@QAE@I@Z */
4324 /* ??0?$numpunct@G@std@@QEAA@_K@Z */
4325 DEFINE_THISCALL_WRAPPER(numpunct_short_ctor_refs, 8)
4326 numpunct_wchar* __thiscall numpunct_short_ctor_refs(numpunct_wchar *this, MSVCP_size_t refs)
4328 numpunct_wchar_ctor_refs(this, refs);
4329 this->facet.vtable = &MSVCP_numpunct_short_vtable;
4330 return this;
4333 /* ??_F?$numpunct@_W@std@@QAEXXZ */
4334 /* ??_F?$numpunct@_W@std@@QEAAXXZ */
4335 DEFINE_THISCALL_WRAPPER(numpunct_wchar_ctor, 4)
4336 numpunct_wchar* __thiscall numpunct_wchar_ctor(numpunct_wchar *this)
4338 return numpunct_wchar_ctor_refs(this, 0);
4341 /* ??_F?$numpunct@G@std@@QAEXXZ */
4342 /* ??_F?$numpunct@G@std@@QEAAXXZ */
4343 DEFINE_THISCALL_WRAPPER(numpunct_short_ctor, 4)
4344 numpunct_wchar* __thiscall numpunct_short_ctor(numpunct_wchar *this)
4346 return numpunct_short_ctor_refs(this, 0);
4349 /* ??1?$numpunct@G@std@@UAE@XZ */
4350 /* ??1?$numpunct@G@std@@UEAA@XZ */
4351 /* ??1?$numpunct@_W@std@@MAE@XZ */
4352 /* ??1?$numpunct@_W@std@@MEAA@XZ */
4353 /* ??1?$numpunct@G@std@@MAE@XZ */
4354 /* ??1?$numpunct@G@std@@MEAA@XZ */
4355 DEFINE_THISCALL_WRAPPER(numpunct_wchar_dtor, 4)
4356 void __thiscall numpunct_wchar_dtor(numpunct_wchar *this)
4358 TRACE("(%p)\n", this);
4359 numpunct_wchar__Tidy(this);
4362 DEFINE_THISCALL_WRAPPER(numpunct_wchar_vector_dtor, 8)
4363 numpunct_wchar* __thiscall numpunct_wchar_vector_dtor(numpunct_wchar *this, unsigned int flags)
4365 TRACE("(%p %x)\n", this, flags);
4366 if(flags & 2) {
4367 /* we have an array, with the number of elements stored before the first object */
4368 INT_PTR i, *ptr = (INT_PTR *)this-1;
4370 for(i=*ptr-1; i>=0; i--)
4371 numpunct_wchar_dtor(this+i);
4372 MSVCRT_operator_delete(ptr);
4373 } else {
4374 numpunct_wchar_dtor(this);
4375 if(flags & 1)
4376 MSVCRT_operator_delete(this);
4379 return this;
4382 /* ?_Getcat@?$numpunct@_W@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
4383 /* ?_Getcat@?$numpunct@_W@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
4384 MSVCP_size_t __cdecl numpunct_wchar__Getcat(const locale_facet **facet, const locale *loc)
4386 TRACE("(%p %p)\n", facet, loc);
4388 if(facet && !*facet) {
4389 *facet = MSVCRT_operator_new(sizeof(numpunct_wchar));
4390 if(!*facet) {
4391 ERR("Out of memory\n");
4392 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
4393 return 0;
4395 numpunct_wchar_ctor_name((numpunct_wchar*)*facet,
4396 locale_string_char_c_str(&loc->ptr->name), 0, TRUE);
4399 return LC_NUMERIC;
4402 /* ?_Getcat@?$numpunct@_W@std@@SAIPAPBVfacet@locale@2@@Z */
4403 /* ?_Getcat@?$numpunct@_W@std@@SA_KPEAPEBVfacet@locale@2@@Z */
4404 MSVCP_size_t __cdecl numpunct_wchar__Getcat_old(const locale_facet **facet)
4406 return numpunct_wchar__Getcat(facet, locale_classic());
4409 static numpunct_wchar* numpunct_wchar_use_facet(const locale *loc)
4411 static numpunct_wchar *obj = NULL;
4413 _Lockit lock;
4414 const locale_facet *fac;
4416 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
4417 fac = locale__Getfacet(loc, locale_id_operator_size_t(&numpunct_wchar_id));
4418 if(fac) {
4419 _Lockit_dtor(&lock);
4420 return (numpunct_wchar*)fac;
4423 if(obj) {
4424 _Lockit_dtor(&lock);
4425 return obj;
4428 numpunct_wchar__Getcat(&fac, loc);
4429 obj = (numpunct_wchar*)fac;
4430 call_locale_facet__Incref(&obj->facet);
4431 locale_facet_register(&obj->facet);
4432 _Lockit_dtor(&lock);
4434 return obj;
4437 /* ?_Getcat@?$numpunct@G@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
4438 /* ?_Getcat@?$numpunct@G@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
4439 MSVCP_size_t __cdecl numpunct_short__Getcat(const locale_facet **facet, const locale *loc)
4441 TRACE("(%p %p)\n", facet, loc);
4443 if(facet && !*facet) {
4444 *facet = MSVCRT_operator_new(sizeof(numpunct_wchar));
4445 if(!*facet) {
4446 ERR("Out of memory\n");
4447 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
4448 return 0;
4450 numpunct_short_ctor_name((numpunct_wchar*)*facet,
4451 locale_string_char_c_str(&loc->ptr->name), 0, TRUE);
4454 return LC_NUMERIC;
4457 /* ?_Getcat@?$numpunct@G@std@@SAIPAPBVfacet@locale@2@@Z */
4458 /* ?_Getcat@?$numpunct@G@std@@SA_KPEAPEBVfacet@locale@2@@Z */
4459 MSVCP_size_t __cdecl numpunct_short__Getcat_old(const locale_facet **facet)
4461 return numpunct_short__Getcat(facet, locale_classic());
4464 static numpunct_wchar* numpunct_short_use_facet(const locale *loc)
4466 static numpunct_wchar *obj = NULL;
4468 _Lockit lock;
4469 const locale_facet *fac;
4471 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
4472 fac = locale__Getfacet(loc, locale_id_operator_size_t(&numpunct_short_id));
4473 if(fac) {
4474 _Lockit_dtor(&lock);
4475 return (numpunct_wchar*)fac;
4478 if(obj) {
4479 _Lockit_dtor(&lock);
4480 return obj;
4483 numpunct_short__Getcat(&fac, loc);
4484 obj = (numpunct_wchar*)fac;
4485 call_locale_facet__Incref(&obj->facet);
4486 locale_facet_register(&obj->facet);
4487 _Lockit_dtor(&lock);
4489 return obj;
4492 /* ?do_decimal_point@?$numpunct@_W@std@@MBE_WXZ */
4493 /* ?do_decimal_point@?$numpunct@_W@std@@MEBA_WXZ */
4494 /* ?do_decimal_point@?$numpunct@G@std@@MBEGXZ */
4495 /* ?do_decimal_point@?$numpunct@G@std@@MEBAGXZ */
4496 DEFINE_THISCALL_WRAPPER(numpunct_wchar_do_decimal_point, 4)
4497 #if _MSVCP_VER <= 100
4498 #define call_numpunct_wchar_do_decimal_point(this) CALL_VTBL_FUNC(this, 4, \
4499 wchar_t, (const numpunct_wchar *this), (this))
4500 #else
4501 #define call_numpunct_wchar_do_decimal_point(this) CALL_VTBL_FUNC(this, 12, \
4502 wchar_t, (const numpunct_wchar *this), (this))
4503 #endif
4504 wchar_t __thiscall numpunct_wchar_do_decimal_point(const numpunct_wchar *this)
4506 TRACE("(%p)\n", this);
4507 return this->dp;
4510 /* ?decimal_point@?$numpunct@_W@std@@QBE_WXZ */
4511 /* ?decimal_point@?$numpunct@_W@std@@QEBA_WXZ */
4512 /* ?decimal_point@?$numpunct@G@std@@QBEGXZ */
4513 /* ?decimal_point@?$numpunct@G@std@@QEBAGXZ */
4514 DEFINE_THISCALL_WRAPPER(numpunct_wchar_decimal_point, 4)
4515 wchar_t __thiscall numpunct_wchar_decimal_point(const numpunct_wchar *this)
4517 TRACE("(%p)\n", this);
4518 return call_numpunct_wchar_do_decimal_point(this);
4521 /* ?do_thousands_sep@?$numpunct@_W@std@@MBE_WXZ */
4522 /* ?do_thousands_sep@?$numpunct@_W@std@@MEBA_WXZ */
4523 /* ?do_thousands_sep@?$numpunct@G@std@@MBEGXZ */
4524 /* ?do_thousands_sep@?$numpunct@G@std@@MEBAGXZ */
4525 DEFINE_THISCALL_WRAPPER(numpunct_wchar_do_thousands_sep, 4)
4526 #if _MSVCP_VER <= 100
4527 #define call_numpunct_wchar_do_thousands_sep(this) CALL_VTBL_FUNC(this, 8, \
4528 wchar_t, (const numpunct_wchar *this), (this))
4529 #else
4530 #define call_numpunct_wchar_do_thousands_sep(this) CALL_VTBL_FUNC(this, 16, \
4531 wchar_t, (const numpunct_wchar *this), (this))
4532 #endif
4533 wchar_t __thiscall numpunct_wchar_do_thousands_sep(const numpunct_wchar *this)
4535 TRACE("(%p)\n", this);
4536 return this->sep;
4539 /* ?thousands_sep@?$numpunct@_W@std@@QBE_WXZ */
4540 /* ?thousands_sep@?$numpunct@_W@std@@QEBA_WXZ */
4541 /* ?thousands_sep@?$numpunct@G@std@@QBEGXZ */
4542 /* ?thousands_sep@?$numpunct@G@std@@QEBAGXZ */
4543 DEFINE_THISCALL_WRAPPER(numpunct_wchar_thousands_sep, 4)
4544 wchar_t __thiscall numpunct_wchar_thousands_sep(const numpunct_wchar *this)
4546 TRACE("(%p)\n", this);
4547 return call_numpunct_wchar_do_thousands_sep(this);
4550 /* ?do_grouping@?$numpunct@_W@std@@MBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4551 /* ?do_grouping@?$numpunct@_W@std@@MEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4552 /* ?do_grouping@?$numpunct@G@std@@MBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4553 /* ?do_grouping@?$numpunct@G@std@@MEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4554 DEFINE_THISCALL_WRAPPER(numpunct_wchar_do_grouping, 8)
4555 #if _MSVCP_VER <= 100
4556 #define call_numpunct_wchar_do_grouping(this, ret) CALL_VTBL_FUNC(this, 12, \
4557 basic_string_char*, (const numpunct_wchar*, basic_string_char*), (this, ret))
4558 #else
4559 #define call_numpunct_wchar_do_grouping(this, ret) CALL_VTBL_FUNC(this, 20, \
4560 basic_string_char*, (const numpunct_wchar*, basic_string_char*), (this, ret))
4561 #endif
4562 basic_string_char* __thiscall numpunct_wchar_do_grouping(const numpunct_wchar *this, basic_string_char *ret)
4564 TRACE("(%p)\n", this);
4565 return MSVCP_basic_string_char_ctor_cstr(ret, this->grouping);
4568 /* ?grouping@?$numpunct@_W@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4569 /* ?grouping@?$numpunct@_W@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4570 /* ?grouping@?$numpunct@G@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4571 /* ?grouping@?$numpunct@G@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4572 DEFINE_THISCALL_WRAPPER(numpunct_wchar_grouping, 8)
4573 basic_string_char* __thiscall numpunct_wchar_grouping(const numpunct_wchar *this, basic_string_char *ret)
4575 TRACE("(%p)\n", this);
4576 return call_numpunct_wchar_do_grouping(this, ret);
4579 /* ?do_falsename@?$numpunct@_W@std@@MBE?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
4580 /* ?do_falsename@?$numpunct@_W@std@@MEBA?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
4581 /* ?do_falsename@?$numpunct@G@std@@MBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
4582 /* ?do_falsename@?$numpunct@G@std@@MEBA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
4583 DEFINE_THISCALL_WRAPPER(numpunct_wchar_do_falsename, 8)
4584 #if _MSVCP_VER <= 100
4585 #define call_numpunct_wchar_do_falsename(this, ret) CALL_VTBL_FUNC(this, 16, \
4586 basic_string_wchar*, (const numpunct_wchar*, basic_string_wchar*), (this, ret))
4587 #else
4588 #define call_numpunct_wchar_do_falsename(this, ret) CALL_VTBL_FUNC(this, 24, \
4589 basic_string_wchar*, (const numpunct_wchar*, basic_string_wchar*), (this, ret))
4590 #endif
4591 basic_string_wchar* __thiscall numpunct_wchar_do_falsename(const numpunct_wchar *this, basic_string_wchar *ret)
4593 TRACE("(%p)\n", this);
4594 return MSVCP_basic_string_wchar_ctor_cstr(ret, this->false_name);
4597 /* ?falsename@?$numpunct@_W@std@@QBE?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
4598 /* ?falsename@?$numpunct@_W@std@@QEBA?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
4599 /* ?falsename@?$numpunct@G@std@@QBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
4600 /* ?falsename@?$numpunct@G@std@@QEBA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
4601 DEFINE_THISCALL_WRAPPER(numpunct_wchar_falsename, 8)
4602 basic_string_wchar* __thiscall numpunct_wchar_falsename(const numpunct_wchar *this, basic_string_wchar *ret)
4604 TRACE("(%p)\n", this);
4605 return call_numpunct_wchar_do_falsename(this, ret);
4608 /* ?do_truename@?$numpunct@_W@std@@MBE?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
4609 /* ?do_truename@?$numpunct@_W@std@@MEBA?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
4610 /* ?do_truename@?$numpunct@G@std@@MBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
4611 /* ?do_truename@?$numpunct@G@std@@MEBA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
4612 DEFINE_THISCALL_WRAPPER(numpunct_wchar_do_truename, 8)
4613 #if _MSVCP_VER <= 100
4614 #define call_numpunct_wchar_do_truename(this, ret) CALL_VTBL_FUNC(this, 20, \
4615 basic_string_wchar*, (const numpunct_wchar*, basic_string_wchar*), (this, ret))
4616 #else
4617 #define call_numpunct_wchar_do_truename(this, ret) CALL_VTBL_FUNC(this, 28, \
4618 basic_string_wchar*, (const numpunct_wchar*, basic_string_wchar*), (this, ret))
4619 #endif
4620 basic_string_wchar* __thiscall numpunct_wchar_do_truename(const numpunct_wchar *this, basic_string_wchar *ret)
4622 TRACE("(%p)\n", this);
4623 return MSVCP_basic_string_wchar_ctor_cstr(ret, this->true_name);
4626 /* ?truename@?$numpunct@_W@std@@QBE?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
4627 /* ?truename@?$numpunct@_W@std@@QEBA?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
4628 /* ?truename@?$numpunct@G@std@@QBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
4629 /* ?truename@?$numpunct@G@std@@QEBA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
4630 DEFINE_THISCALL_WRAPPER(numpunct_wchar_truename, 8)
4631 basic_string_wchar* __thiscall numpunct_wchar_truename(const numpunct_wchar *this, basic_string_wchar *ret)
4633 TRACE("(%p)\n", this);
4634 return call_numpunct_wchar_do_truename(this, ret);
4637 double __cdecl _Stod(const char *buf, char **buf_end, LONG exp)
4639 double ret = strtod(buf, buf_end);
4641 if(exp)
4642 ret *= pow(10, exp);
4643 return ret;
4646 double __cdecl _Stodx(const char *buf, char **buf_end, LONG exp, int *err)
4648 double ret;
4650 *err = *_errno();
4651 *_errno() = 0;
4652 ret = _Stod(buf, buf_end, exp);
4653 if(*_errno()) {
4654 *err = *_errno();
4655 }else {
4656 *_errno() = *err;
4657 *err = 0;
4659 return ret;
4662 float __cdecl _Stof(const char *buf, char **buf_end, LONG exp)
4664 return _Stod(buf, buf_end, exp);
4667 float __cdecl _Stofx(const char *buf, char **buf_end, LONG exp, int *err)
4669 return _Stodx(buf, buf_end, exp, err);
4672 __int64 __cdecl _Stoll(const char *buf, char **buf_end, int base)
4674 return _strtoi64(buf, buf_end, base);
4677 __int64 __cdecl _Stollx(const char *buf, char **buf_end, int base, int *err)
4679 __int64 ret;
4681 *err = *_errno();
4682 *_errno() = 0;
4683 ret = _strtoi64(buf, buf_end, base);
4684 if(*_errno()) {
4685 *err = *_errno();
4686 }else {
4687 *_errno() = *err;
4688 *err = 0;
4690 return ret;
4693 LONG __cdecl _Stolx(const char *buf, char **buf_end, int base, int *err)
4695 __int64 i = _Stollx(buf, buf_end, base, err);
4696 if(!*err && i!=(__int64)((LONG)i))
4697 *err = ERANGE;
4698 return i;
4701 unsigned __int64 __cdecl _Stoull(const char *buf, char **buf_end, int base)
4703 return _strtoui64(buf, buf_end, base);
4706 unsigned __int64 __cdecl _Stoullx(const char *buf, char **buf_end, int base, int *err)
4708 unsigned __int64 ret;
4710 *err = *_errno();
4711 *_errno() = 0;
4712 ret = _strtoui64(buf, buf_end, base);
4713 if(*_errno()) {
4714 *err = *_errno();
4715 }else {
4716 *_errno() = *err;
4717 *err = 0;
4719 return ret;
4722 ULONG __cdecl _Stoul(const char *buf, char **buf_end, int base)
4724 int err;
4725 unsigned __int64 i = _Stoullx(buf[0]=='-' ? buf+1 : buf, buf_end, base, &err);
4726 if(!err && i!=(unsigned __int64)((ULONG)i))
4727 *_errno() = ERANGE;
4728 return buf[0]=='-' ? -i : i;
4731 ULONG __cdecl _Stoulx(const char *buf, char **buf_end, int base, int *err)
4733 unsigned __int64 i = _Stoullx(buf[0]=='-' ? buf+1 : buf, buf_end, base, err);
4734 if(!*err && i!=(unsigned __int64)((ULONG)i))
4735 *err = ERANGE;
4736 return buf[0]=='-' ? -i : i;
4739 /* ?id@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@2V0locale@2@A */
4740 locale_id num_get_wchar_id = {0};
4741 /* ?id@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@2V0locale@2@A */
4742 locale_id num_get_short_id = {0};
4744 /* ??_7?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@6B@ */
4745 extern const vtable_ptr MSVCP_num_get_wchar_vtable;
4746 /* ??_7?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@6B@ */
4747 extern const vtable_ptr MSVCP_num_get_short_vtable;
4749 /* ?_Init@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@IAEXABV_Locinfo@2@@Z */
4750 /* ?_Init@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@IEAAXAEBV_Locinfo@2@@Z */
4751 /* ?_Init@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@IAEXABV_Locinfo@2@@Z */
4752 /* ?_Init@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@IEAAXAEBV_Locinfo@2@@Z */
4753 DEFINE_THISCALL_WRAPPER(num_get_wchar__Init, 8)
4754 void __thiscall num_get_wchar__Init(num_get *this, const _Locinfo *locinfo)
4756 TRACE("(%p %p)\n", this, locinfo);
4757 _Locinfo__Getcvt(locinfo, &this->cvt);
4760 /* ??0?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
4761 /* ??0?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
4762 DEFINE_THISCALL_WRAPPER(num_get_wchar_ctor_locinfo, 12)
4763 num_get* __thiscall num_get_wchar_ctor_locinfo(num_get *this,
4764 const _Locinfo *locinfo, MSVCP_size_t refs)
4766 TRACE("(%p %p %lu)\n", this, locinfo, refs);
4768 locale_facet_ctor_refs(&this->facet, refs);
4769 this->facet.vtable = &MSVCP_num_get_wchar_vtable;
4771 num_get_wchar__Init(this, locinfo);
4772 return this;
4775 /* ??0?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
4776 /* ??0?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
4777 DEFINE_THISCALL_WRAPPER(num_get_short_ctor_locinfo, 12)
4778 num_get* __thiscall num_get_short_ctor_locinfo(num_get *this,
4779 const _Locinfo *locinfo, MSVCP_size_t refs)
4781 num_get_wchar_ctor_locinfo(this, locinfo, refs);
4782 this->facet.vtable = &MSVCP_num_get_short_vtable;
4783 return this;
4786 /* ??0?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAE@I@Z */
4787 /* ??0?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAA@_K@Z */
4788 DEFINE_THISCALL_WRAPPER(num_get_wchar_ctor_refs, 8)
4789 num_get* __thiscall num_get_wchar_ctor_refs(num_get *this, MSVCP_size_t refs)
4791 _Locinfo locinfo;
4793 TRACE("(%p %lu)\n", this, refs);
4795 _Locinfo_ctor(&locinfo);
4796 num_get_wchar_ctor_locinfo(this, &locinfo, refs);
4797 _Locinfo_dtor(&locinfo);
4798 return this;
4801 /* ??0?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAE@I@Z */
4802 /* ??0?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEAA@_K@Z */
4803 DEFINE_THISCALL_WRAPPER(num_get_short_ctor_refs, 8)
4804 num_get* __thiscall num_get_short_ctor_refs(num_get *this, MSVCP_size_t refs)
4806 num_get_wchar_ctor_refs(this, refs);
4807 this->facet.vtable = &MSVCP_num_get_short_vtable;
4808 return this;
4811 /* ??_F?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAEXXZ */
4812 /* ??_F?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAAXXZ */
4813 DEFINE_THISCALL_WRAPPER(num_get_wchar_ctor, 4)
4814 num_get* __thiscall num_get_wchar_ctor(num_get *this)
4816 return num_get_wchar_ctor_refs(this, 0);
4819 /* ??_F?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAEXXZ */
4820 /* ??_F?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAAXXZ */
4821 DEFINE_THISCALL_WRAPPER(num_get_short_ctor, 4)
4822 num_get* __thiscall num_get_short_ctor(num_get *this)
4824 return num_get_short_ctor_refs(this, 0);
4827 /* ??1?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@UAE@XZ */
4828 /* ??1?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@UEAA@XZ */
4829 /* ??1?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MAE@XZ */
4830 /* ??1?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MEAA@XZ */
4831 /* ??1?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MAE@XZ */
4832 /* ??1?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MEAA@XZ */
4833 DEFINE_THISCALL_WRAPPER(num_get_wchar_dtor, 4)
4834 void __thiscall num_get_wchar_dtor(num_get *this)
4836 TRACE("(%p)\n", this);
4837 locale_facet_dtor(&this->facet);
4840 DEFINE_THISCALL_WRAPPER(num_get_wchar_vector_dtor, 8)
4841 num_get* __thiscall num_get_wchar_vector_dtor(num_get *this, unsigned int flags)
4843 TRACE("(%p %x)\n", this, flags);
4844 if(flags & 2) {
4845 /* we have an array, with the number of elements stored before the first object */
4846 INT_PTR i, *ptr = (INT_PTR *)this-1;
4848 for(i=*ptr-1; i>=0; i--)
4849 num_get_wchar_dtor(this+i);
4850 MSVCRT_operator_delete(ptr);
4851 } else {
4852 num_get_wchar_dtor(this);
4853 if(flags & 1)
4854 MSVCRT_operator_delete(this);
4857 return this;
4860 /* ?_Getcat@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
4861 /* ?_Getcat@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
4862 MSVCP_size_t __cdecl num_get_wchar__Getcat(const locale_facet **facet, const locale *loc)
4864 TRACE("(%p %p)\n", facet, loc);
4866 if(facet && !*facet) {
4867 _Locinfo locinfo;
4869 *facet = MSVCRT_operator_new(sizeof(num_get));
4870 if(!*facet) {
4871 ERR("Out of memory\n");
4872 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
4873 return 0;
4876 _Locinfo_ctor_cstr(&locinfo, locale_string_char_c_str(&loc->ptr->name));
4877 num_get_wchar_ctor_locinfo((num_get*)*facet, &locinfo, 0);
4878 _Locinfo_dtor(&locinfo);
4881 return LC_NUMERIC;
4884 /* ?_Getcat@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SAIPAPBVfacet@locale@2@@Z */
4885 /* ?_Getcat@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@@Z */
4886 MSVCP_size_t __cdecl num_get_wchar__Getcat_old(const locale_facet **facet)
4888 return num_get_wchar__Getcat(facet, locale_classic());
4891 num_get* num_get_wchar_use_facet(const locale *loc)
4893 static num_get *obj = NULL;
4895 _Lockit lock;
4896 const locale_facet *fac;
4898 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
4899 fac = locale__Getfacet(loc, locale_id_operator_size_t(&num_get_wchar_id));
4900 if(fac) {
4901 _Lockit_dtor(&lock);
4902 return (num_get*)fac;
4905 if(obj) {
4906 _Lockit_dtor(&lock);
4907 return obj;
4910 num_get_wchar__Getcat(&fac, loc);
4911 obj = (num_get*)fac;
4912 call_locale_facet__Incref(&obj->facet);
4913 locale_facet_register(&obj->facet);
4914 _Lockit_dtor(&lock);
4916 return obj;
4919 /* ?_Getcat@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
4920 /* ?_Getcat@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
4921 MSVCP_size_t __cdecl num_get_short__Getcat(const locale_facet **facet, const locale *loc)
4923 if(facet && !*facet) {
4924 num_get_wchar__Getcat(facet, loc);
4925 (*(locale_facet**)facet)->vtable = &MSVCP_num_get_short_vtable;
4928 return LC_NUMERIC;
4931 /* ?_Getcat@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SAIPAPBVfacet@locale@2@@Z */
4932 /* ?_Getcat@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@@Z */
4933 MSVCP_size_t __cdecl num_get_short__Getcat_old(const locale_facet **facet)
4935 return num_get_short__Getcat(facet, locale_classic());
4938 num_get* num_get_short_use_facet(const locale *loc)
4940 static num_get *obj = NULL;
4942 _Lockit lock;
4943 const locale_facet *fac;
4945 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
4946 fac = locale__Getfacet(loc, locale_id_operator_size_t(&num_get_short_id));
4947 if(fac) {
4948 _Lockit_dtor(&lock);
4949 return (num_get*)fac;
4952 if(obj) {
4953 _Lockit_dtor(&lock);
4954 return obj;
4957 num_get_short__Getcat(&fac, loc);
4958 obj = (num_get*)fac;
4959 call_locale_facet__Incref(&obj->facet);
4960 locale_facet_register(&obj->facet);
4961 _Lockit_dtor(&lock);
4963 return obj;
4966 static int num_get__Getffld(const num_get *this, char *dest, istreambuf_iterator_wchar *first,
4967 istreambuf_iterator_wchar *last, const locale *loc, numpunct_wchar *numpunct)
4969 basic_string_char grouping_bstr;
4970 basic_string_char groups_found;
4971 int i, groups_no = 0, cur_group = 0, exp = 0;
4972 char *dest_beg = dest, *num_end = dest+25, *exp_end = dest+31;
4973 wchar_t sep = 0, digits[11], *digits_pos;
4974 const char *grouping, *groups;
4975 BOOL error = FALSE, got_digit = FALSE, got_nonzero = FALSE;
4977 TRACE("(%p %p %p %p)\n", dest, first, last, loc);
4979 for(i=0; i<10; i++)
4980 digits[i] = mb_to_wc('0'+i, &this->cvt);
4981 digits[10] = 0;
4983 numpunct_wchar_grouping(numpunct, &grouping_bstr);
4984 grouping = MSVCP_basic_string_char_c_str(&grouping_bstr);
4985 #if _MSVCP_VER >= 70
4986 if (grouping[0]) sep = numpunct_wchar_thousands_sep(numpunct);
4987 #endif
4989 if(sep)
4990 MSVCP_basic_string_char_ctor(&groups_found);
4992 istreambuf_iterator_wchar_val(first);
4993 /* get sign */
4994 if(first->strbuf && first->val==mb_to_wc('-', &this->cvt)) {
4995 *dest++ = '-';
4996 istreambuf_iterator_wchar_inc(first);
4997 }else if(first->strbuf && first->val==mb_to_wc('+', &this->cvt)) {
4998 *dest++ = '+';
4999 istreambuf_iterator_wchar_inc(first);
5002 /* read possibly grouped numbers before decimal */
5003 for(; first->strbuf; istreambuf_iterator_wchar_inc(first)) {
5004 if(!(digits_pos = wcschr(digits, first->val))) {
5005 if(sep && first->val==sep) {
5006 if(!groups_no) break; /* empty group - stop parsing */
5007 MSVCP_basic_string_char_append_ch(&groups_found, groups_no);
5008 groups_no = 0;
5009 ++cur_group;
5010 }else {
5011 break;
5013 }else {
5014 got_digit = TRUE; /* found a digit, zero or non-zero */
5015 /* write digit to dest if not a leading zero (to not waste dest buffer) */
5016 if(!got_nonzero && first->val == digits[0])
5018 ++groups_no;
5019 continue;
5021 got_nonzero = TRUE;
5022 if(dest < num_end)
5023 *dest++ = '0'+digits_pos-digits;
5024 else
5025 exp++; /* too many digits, just multiply by 10 */
5026 if(sep && groups_no<CHAR_MAX)
5027 ++groups_no;
5031 /* if all leading zeroes, we didn't write anything so put a zero we check for a decimal */
5032 if(got_digit && !got_nonzero)
5033 *dest++ = '0';
5035 /* get decimal, if any */
5036 if(first->strbuf && first->val==numpunct_wchar_decimal_point(numpunct)) {
5037 if(dest < num_end)
5038 *dest++ = *localeconv()->decimal_point;
5039 istreambuf_iterator_wchar_inc(first);
5042 /* read non-grouped after decimal */
5043 for(; first->strbuf; istreambuf_iterator_wchar_inc(first)) {
5044 if(!(digits_pos = wcschr(digits, first->val)))
5045 break;
5046 else if(dest<num_end) {
5047 got_digit = TRUE;
5048 *dest++ = '0'+digits_pos-digits;
5052 /* read exponent, if any */
5053 if(first->strbuf && (first->val==mb_to_wc('e', &this->cvt) || first->val==mb_to_wc('E', &this->cvt))) {
5054 *dest++ = 'e';
5055 istreambuf_iterator_wchar_inc(first);
5057 if(first->strbuf && first->val==mb_to_wc('-', &this->cvt)) {
5058 *dest++ = '-';
5059 istreambuf_iterator_wchar_inc(first);
5060 }else if(first->strbuf && first->val==mb_to_wc('+', &this->cvt)) {
5061 *dest++ = '+';
5062 istreambuf_iterator_wchar_inc(first);
5065 got_digit = got_nonzero = FALSE;
5066 error = TRUE;
5067 /* skip any leading zeroes */
5068 for(; first->strbuf && first->val==digits[0]; istreambuf_iterator_wchar_inc(first))
5069 error = FALSE;
5071 for(; first->strbuf && (digits_pos = wcschr(digits, first->val)); istreambuf_iterator_wchar_inc(first)) {
5072 got_digit = got_nonzero = TRUE; /* leading zeroes would have been skipped, so first digit is non-zero */
5073 error = FALSE;
5074 if(dest<exp_end)
5075 *dest++ = '0'+digits_pos-digits;
5078 /* if just found zeroes for exponent, use that */
5079 if(got_digit && !got_nonzero)
5081 error = FALSE;
5082 if(dest<exp_end)
5083 *dest++ = '0';
5087 if(sep && groups_no)
5088 MSVCP_basic_string_char_append_ch(&groups_found, groups_no);
5090 if(!cur_group) /* no groups, skip loop */
5091 cur_group--;
5092 else if(!(groups = MSVCP_basic_string_char_c_str(&groups_found))[cur_group])
5093 error = TRUE; /* trailing empty */
5095 for(; cur_group>=0 && !error; cur_group--) {
5096 if(*grouping == CHAR_MAX) {
5097 if(cur_group)
5098 error = TRUE;
5099 break;
5100 }else if((cur_group && *grouping!=groups[cur_group])
5101 || (!cur_group && *grouping<groups[cur_group])) {
5102 error = TRUE;
5103 break;
5104 }else if(grouping[1]) {
5105 grouping++;
5108 MSVCP_basic_string_char_dtor(&grouping_bstr);
5109 if(sep)
5110 MSVCP_basic_string_char_dtor(&groups_found);
5112 if(error) {
5113 *dest_beg = '\0';
5114 return 0;
5116 *dest++ = '\0';
5117 return exp;
5120 /* ?_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 */
5121 /* ?_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 */
5122 int __cdecl num_get_wchar__Getffld(const num_get *this, char *dest, istreambuf_iterator_wchar *first,
5123 istreambuf_iterator_wchar *last, const locale *loc)
5125 return num_get__Getffld(this, dest, first, last, loc, numpunct_wchar_use_facet(loc));
5128 /* ?_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 */
5129 /* ?_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 */
5130 int __cdecl num_get_short__Getffld(const num_get *this, char *dest, istreambuf_iterator_wchar *first,
5131 istreambuf_iterator_wchar *last, const locale *loc)
5133 return num_get__Getffld(this, dest, first, last, loc, numpunct_short_use_facet(loc));
5136 /* ?_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 */
5137 /* ?_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 */
5138 /* ?_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 */
5139 /* ?_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 */
5140 int __cdecl num_get_wchar__Getffldx(num_get *this, char *dest, istreambuf_iterator_wchar *first,
5141 istreambuf_iterator_wchar *last, ios_base *ios, int *phexexp)
5143 FIXME("(%p %p %p %p %p) stub\n", dest, first, last, ios, phexexp);
5144 return -1;
5147 static int num_get__Getifld(const num_get *this, char *dest, istreambuf_iterator_wchar *first,
5148 istreambuf_iterator_wchar *last, int fmtflags, const locale *loc, numpunct_wchar *numpunct)
5150 wchar_t digits[23], *digits_pos, sep = 0;
5151 basic_string_char grouping_bstr;
5152 basic_string_char groups_found;
5153 int i, basefield, base, groups_no = 0, cur_group = 0;
5154 char *dest_beg = dest, *dest_end = dest+24;
5155 const char *grouping, *groups;
5156 BOOL error = TRUE, dest_empty = TRUE, found_zero = FALSE;
5158 TRACE("(%p %p %p %04x %p)\n", dest, first, last, fmtflags, loc);
5160 for(i=0; i<10; i++)
5161 digits[i] = mb_to_wc('0'+i, &this->cvt);
5162 for(i=0; i<6; i++) {
5163 digits[10+i] = mb_to_wc('a'+i, &this->cvt);
5164 digits[16+i] = mb_to_wc('A'+i, &this->cvt);
5167 numpunct_wchar_grouping(numpunct, &grouping_bstr);
5168 grouping = MSVCP_basic_string_char_c_str(&grouping_bstr);
5169 #if _MSVCP_VER >= 70
5170 if (grouping[0]) sep = numpunct_wchar_thousands_sep(numpunct);
5171 #endif
5173 basefield = fmtflags & FMTFLAG_basefield;
5174 if(basefield == FMTFLAG_oct)
5175 base = 8;
5176 else if(basefield == FMTFLAG_hex)
5177 base = 22; /* equal to the size of digits buffer */
5178 else if(!basefield)
5179 base = 0;
5180 else
5181 base = 10;
5183 istreambuf_iterator_wchar_val(first);
5184 if(first->strbuf && first->val==mb_to_wc('-', &this->cvt)) {
5185 *dest++ = '-';
5186 istreambuf_iterator_wchar_inc(first);
5187 }else if(first->strbuf && first->val==mb_to_wc('+', &this->cvt)) {
5188 *dest++ = '+';
5189 istreambuf_iterator_wchar_inc(first);
5192 if(first->strbuf && first->val==digits[0]) {
5193 found_zero = TRUE;
5194 istreambuf_iterator_wchar_inc(first);
5195 if(first->strbuf && (first->val==mb_to_wc('x', &this->cvt) || first->val==mb_to_wc('X', &this->cvt))) {
5196 if(!base || base == 22) {
5197 found_zero = FALSE;
5198 istreambuf_iterator_wchar_inc(first);
5199 base = 22;
5200 }else {
5201 base = 10;
5203 }else {
5204 error = FALSE;
5205 if(!base) base = 8;
5207 }else {
5208 if(!base) base = 10;
5210 digits[base] = 0;
5212 if(sep) {
5213 MSVCP_basic_string_char_ctor(&groups_found);
5214 if(found_zero) ++groups_no;
5217 for(; first->strbuf; istreambuf_iterator_wchar_inc(first)) {
5218 if(!(digits_pos = wcschr(digits, first->val))) {
5219 if(sep && first->val==sep) {
5220 if(!groups_no) break; /* empty group - stop parsing */
5221 MSVCP_basic_string_char_append_ch(&groups_found, groups_no);
5222 groups_no = 0;
5223 ++cur_group;
5224 }else {
5225 break;
5227 }else {
5228 error = FALSE;
5229 if(dest_empty && first->val == digits[0]) {
5230 found_zero = TRUE;
5231 ++groups_no;
5232 continue;
5234 dest_empty = FALSE;
5235 /* skip digits that can't be copied to dest buffer, other
5236 * functions are responsible for detecting overflows */
5237 if(dest < dest_end)
5238 *dest++ = (digits_pos-digits<10 ? '0'+digits_pos-digits :
5239 (digits_pos-digits<16 ? 'a'+digits_pos-digits-10 :
5240 'A'+digits_pos-digits-16));
5241 if(sep && groups_no<CHAR_MAX)
5242 ++groups_no;
5246 if(sep && groups_no)
5247 MSVCP_basic_string_char_append_ch(&groups_found, groups_no);
5249 if(!cur_group) { /* no groups, skip loop */
5250 cur_group--;
5251 }else if(!(groups = MSVCP_basic_string_char_c_str(&groups_found))[cur_group]) {
5252 error = TRUE; /* trailing empty */
5253 found_zero = FALSE;
5256 for(; cur_group>=0 && !error; cur_group--) {
5257 if(*grouping == CHAR_MAX) {
5258 if(cur_group)
5259 error = TRUE;
5260 break;
5261 }else if((cur_group && *grouping!=groups[cur_group])
5262 || (!cur_group && *grouping<groups[cur_group])) {
5263 error = TRUE;
5264 break;
5265 }else if(grouping[1]) {
5266 grouping++;
5270 MSVCP_basic_string_char_dtor(&grouping_bstr);
5271 if(sep)
5272 MSVCP_basic_string_char_dtor(&groups_found);
5274 if(error) {
5275 if (found_zero)
5276 *dest++ = '0';
5277 else
5278 dest = dest_beg;
5279 }else if(dest_empty)
5280 *dest++ = '0';
5281 *dest = '\0';
5283 return (base==22 ? 16 : base);
5286 /* ?_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 */
5287 /* ?_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 */
5288 int __cdecl num_get_wchar__Getifld(const num_get *this, char *dest, istreambuf_iterator_wchar *first,
5289 istreambuf_iterator_wchar *last, int fmtflags, const locale *loc)
5291 return num_get__Getifld(this, dest, first, last,
5292 fmtflags, loc, numpunct_wchar_use_facet(loc));
5295 /* ?_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 */
5296 /* ?_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 */
5297 int __cdecl num_get_short__Getifld(const num_get *this, char *dest, istreambuf_iterator_wchar *first,
5298 istreambuf_iterator_wchar *last, int fmtflags, const locale *loc)
5300 return num_get__Getifld(this, dest, first, last,
5301 fmtflags, loc, numpunct_short_use_facet(loc));
5304 /* ?_Hexdig@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@ABEH_W000@Z */
5305 /* ?_Hexdig@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@AEBAH_W000@Z */
5306 /* ?_Hexdig@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@ABEHGGGG@Z */
5307 /* ?_Hexdig@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@AEBAHGGGG@Z */
5308 DEFINE_THISCALL_WRAPPER(MSVCP_num_get_wchar__Hexdig, 20)
5309 int __thiscall MSVCP_num_get_wchar__Hexdig(num_get *this, wchar_t dig, wchar_t e0, wchar_t al, wchar_t au)
5311 FIXME("(%p %c %c %c %c) stub\n", this, dig, e0, al, au);
5312 return -1;
5315 static istreambuf_iterator_wchar* num_get_do_get_void(const num_get *this,
5316 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar first,
5317 istreambuf_iterator_wchar last, ios_base *base, int *state,
5318 void **pval, numpunct_wchar *numpunct)
5320 unsigned __int64 v;
5321 char tmp[25], *end;
5322 int err;
5324 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5326 v = _Stoullx(tmp, &end, num_get__Getifld(this, tmp, &first,
5327 &last, FMTFLAG_hex, IOS_LOCALE(base), numpunct), &err);
5328 if(v!=(unsigned __int64)((INT_PTR)v))
5329 *state |= IOSTATE_failbit;
5330 else if(end!=tmp && !err)
5331 *pval = (void*)((INT_PTR)v);
5332 else
5333 *state |= IOSTATE_failbit;
5335 if(!first.strbuf)
5336 *state |= IOSTATE_eofbit;
5338 *ret = first;
5339 return ret;
5342 /* ?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 */
5343 /* ?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 */
5344 #if _MSVCP_VER <= 100
5345 #define call_num_get_wchar_do_get_void(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 4, istreambuf_iterator_wchar*, \
5346 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, void**), \
5347 (this, ret, first, last, base, state, pval))
5348 #else
5349 #define call_num_get_wchar_do_get_void(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*, void**), \
5351 (this, ret, first, last, base, state, pval))
5352 #endif
5353 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_void,36)
5354 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_void(const num_get *this, istreambuf_iterator_wchar *ret,
5355 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, void **pval)
5357 return num_get_do_get_void(this, ret, first, last, base,
5358 state, pval, numpunct_wchar_use_facet(IOS_LOCALE(base)));
5361 /* ?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 */
5362 /* ?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 */
5363 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_void,36)
5364 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_void(const num_get *this, istreambuf_iterator_wchar *ret,
5365 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, void **pval)
5367 return num_get_do_get_void(this, ret, first, last, base,
5368 state, pval, numpunct_short_use_facet(IOS_LOCALE(base)));
5371 /* ?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 */
5372 /* ?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 */
5373 /* ?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 */
5374 /* ?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 */
5375 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_void,36)
5376 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_void(const num_get *this, istreambuf_iterator_wchar *ret,
5377 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, void **pval)
5379 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5380 return call_num_get_wchar_do_get_void(this, ret, first, last, base, state, pval);
5383 static istreambuf_iterator_wchar* num_get_do_get_double(const num_get *this,
5384 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar first,
5385 istreambuf_iterator_wchar last, ios_base *base, int *state,
5386 double *pval, numpunct_wchar *numpunct)
5388 double v;
5389 char tmp[32], *end;
5390 int err;
5392 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5394 v = _Stodx(tmp, &end, num_get__Getffld(this, tmp, &first, &last, IOS_LOCALE(base), numpunct), &err);
5395 if(end!=tmp && !err)
5396 *pval = v;
5397 else
5398 *state |= IOSTATE_failbit;
5400 if(!first.strbuf)
5401 *state |= IOSTATE_eofbit;
5403 *ret = first;
5404 return ret;
5407 /* ?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 */
5408 /* ?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 */
5409 /* ?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 */
5410 /* ?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 */
5411 #if _MSVCP_VER <= 100
5412 #define call_num_get_wchar_do_get_ldouble(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 8, istreambuf_iterator_wchar*, \
5413 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, double*), \
5414 (this, ret, first, last, base, state, pval))
5415 #define call_num_get_wchar_do_get_double(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 12, istreambuf_iterator_wchar*, \
5416 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, double*), \
5417 (this, ret, first, last, base, state, pval))
5418 #else
5419 #define call_num_get_wchar_do_get_ldouble(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 16, istreambuf_iterator_wchar*, \
5420 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, double*), \
5421 (this, ret, first, last, base, state, pval))
5422 #define call_num_get_wchar_do_get_double(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 20, istreambuf_iterator_wchar*, \
5423 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, double*), \
5424 (this, ret, first, last, base, state, pval))
5425 #endif
5426 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_double,36)
5427 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_double(const num_get *this, istreambuf_iterator_wchar *ret,
5428 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, double *pval)
5430 return num_get_do_get_double(this, ret, first, last, base,
5431 state, pval, numpunct_wchar_use_facet(IOS_LOCALE(base)));
5434 /* ?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 */
5435 /* ?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 */
5436 /* ?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 */
5437 /* ?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 */
5438 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_double,36)
5439 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_double(const num_get *this, istreambuf_iterator_wchar *ret,
5440 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, double *pval)
5442 return num_get_do_get_double(this, ret, first, last, base,
5443 state, pval, numpunct_short_use_facet(IOS_LOCALE(base)));
5446 /* ?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 */
5447 /* ?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 */
5448 /* ?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 */
5449 /* ?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 */
5450 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_ldouble,36)
5451 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_ldouble(const num_get *this, istreambuf_iterator_wchar *ret,
5452 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, double *pval)
5454 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5455 return call_num_get_wchar_do_get_ldouble(this, ret, first, last, base, state, pval);
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@AAHAAN@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@AEAHAEAN@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@AAHAAN@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@AEAHAEAN@Z */
5462 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_double,36)
5463 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_double(const num_get *this, istreambuf_iterator_wchar *ret,
5464 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, double *pval)
5466 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5467 return call_num_get_wchar_do_get_double(this, ret, first, last, base, state, pval);
5470 static istreambuf_iterator_wchar* num_get_do_get_float(const num_get *this,
5471 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar first,
5472 istreambuf_iterator_wchar last, ios_base *base, int *state,
5473 float *pval, numpunct_wchar *numpunct)
5475 float v;
5476 char tmp[32], *end;
5477 int err;
5479 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5481 v = _Stofx(tmp, &end, num_get__Getffld(this, tmp, &first,
5482 &last, IOS_LOCALE(base), 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@AAHAAM@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@AEAHAEAM@Z */
5497 #if _MSVCP_VER <= 100
5498 #define call_num_get_wchar_do_get_float(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 16, istreambuf_iterator_wchar*, \
5499 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, float*), \
5500 (this, ret, first, last, base, state, pval))
5501 #else
5502 #define call_num_get_wchar_do_get_float(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 24, istreambuf_iterator_wchar*, \
5503 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, float*), \
5504 (this, ret, first, last, base, state, pval))
5505 #endif
5506 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_float,36)
5507 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_float(const num_get *this, istreambuf_iterator_wchar *ret,
5508 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, float *pval)
5510 return num_get_do_get_float(this, ret, first, last, base,
5511 state, pval, numpunct_wchar_use_facet(IOS_LOCALE(base)));
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@AAHAAM@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@AEAHAEAM@Z */
5516 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_float,36)
5517 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_float(const num_get *this, istreambuf_iterator_wchar *ret,
5518 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, float *pval)
5520 return num_get_do_get_float(this, ret, first, last, base,
5521 state, pval, numpunct_short_use_facet(IOS_LOCALE(base)));
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@AAHAAM@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@AEAHAEAM@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@AAHAAM@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@AEAHAEAM@Z */
5528 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_float,36)
5529 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_float(const num_get *this, istreambuf_iterator_wchar *ret,
5530 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, float *pval)
5532 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5533 return call_num_get_wchar_do_get_float(this, ret, first, last, base, state, pval);
5536 static istreambuf_iterator_wchar* num_get_do_get_uint64(const num_get *this,
5537 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar first,
5538 istreambuf_iterator_wchar last, ios_base *base, int *state,
5539 ULONGLONG *pval, numpunct_wchar *numpunct)
5541 unsigned __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 = _Stoullx(tmp, &end, num_get__Getifld(this, tmp, &first,
5548 &last, base->fmtfl, IOS_LOCALE(base), 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_K@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_K@Z */
5563 #if _MSVCP_VER <= 100
5564 #define call_num_get_wchar_do_get_uint64(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 20, istreambuf_iterator_wchar*, \
5565 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, ULONGLONG*), \
5566 (this, ret, first, last, base, state, pval))
5567 #else
5568 #define call_num_get_wchar_do_get_uint64(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 28, istreambuf_iterator_wchar*, \
5569 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, ULONGLONG*), \
5570 (this, ret, first, last, base, state, pval))
5571 #endif
5572 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_uint64,36)
5573 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_uint64(const num_get *this, istreambuf_iterator_wchar *ret,
5574 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, ULONGLONG *pval)
5576 return num_get_do_get_uint64(this, ret, first, last, base,
5577 state, pval, numpunct_wchar_use_facet(IOS_LOCALE(base)));
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_K@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_K@Z */
5582 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_uint64,36)
5583 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_uint64(const num_get *this, istreambuf_iterator_wchar *ret,
5584 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, ULONGLONG *pval)
5586 return num_get_do_get_uint64(this, ret, first, last, base,
5587 state, pval, numpunct_short_use_facet(IOS_LOCALE(base)));
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_K@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_K@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_K@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_K@Z */
5594 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_uint64,36)
5595 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_uint64(const num_get *this, istreambuf_iterator_wchar *ret,
5596 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, ULONGLONG *pval)
5598 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5599 return call_num_get_wchar_do_get_uint64(this, ret, first, last, base, state, pval);
5602 static istreambuf_iterator_wchar* num_get_do_get_int64(const num_get *this,
5603 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar first,
5604 istreambuf_iterator_wchar last, ios_base *base, int *state,
5605 LONGLONG *pval, numpunct_wchar *numpunct)
5607 __int64 v;
5608 char tmp[25], *end;
5609 int err;
5611 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5613 v = _Stollx(tmp, &end, num_get__Getifld(this, tmp, &first,
5614 &last, base->fmtfl, IOS_LOCALE(base), 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@AAHAA_J@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@AEAHAEA_J@Z */
5629 #if _MSVCP_VER <= 100
5630 #define call_num_get_wchar_do_get_int64(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 24, istreambuf_iterator_wchar*, \
5631 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, LONGLONG*), \
5632 (this, ret, first, last, base, state, pval))
5633 #else
5634 #define call_num_get_wchar_do_get_int64(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 32, istreambuf_iterator_wchar*, \
5635 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, LONGLONG*), \
5636 (this, ret, first, last, base, state, pval))
5637 #endif
5638 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_int64,36)
5639 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_int64(const num_get *this, istreambuf_iterator_wchar *ret,
5640 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, LONGLONG *pval)
5642 return num_get_do_get_int64(this, ret, first, last, base,
5643 state, pval, numpunct_wchar_use_facet(IOS_LOCALE(base)));
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@AAHAA_J@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@AEAHAEA_J@Z */
5648 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_int64,36)
5649 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_int64(const num_get *this, istreambuf_iterator_wchar *ret,
5650 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, LONGLONG *pval)
5652 return num_get_do_get_int64(this, ret, first, last, base,
5653 state, pval, numpunct_short_use_facet(IOS_LOCALE(base)));
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@AAHAA_J@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@AEAHAEA_J@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@AAHAA_J@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@AEAHAEA_J@Z */
5660 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_int64,36)
5661 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_int64(const num_get *this, istreambuf_iterator_wchar *ret,
5662 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, LONGLONG *pval)
5664 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5665 return call_num_get_wchar_do_get_int64(this, ret, first, last, base, state, pval);
5668 static istreambuf_iterator_wchar* num_get_do_get_ulong(const num_get *this,
5669 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar first,
5670 istreambuf_iterator_wchar last, ios_base *base, int *state,
5671 ULONG *pval, numpunct_wchar *numpunct)
5673 ULONG v;
5674 char tmp[25], *end;
5675 int err;
5677 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5679 v = _Stoulx(tmp, &end, num_get__Getifld(this, tmp, &first,
5680 &last, base->fmtfl, IOS_LOCALE(base), 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@AAHAAK@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@AEAHAEAK@Z */
5695 #if _MSVCP_VER <= 100
5696 #define call_num_get_wchar_do_get_ulong(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 28, istreambuf_iterator_wchar*, \
5697 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, ULONG*), \
5698 (this, ret, first, last, base, state, pval))
5699 #else
5700 #define call_num_get_wchar_do_get_ulong(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 36, istreambuf_iterator_wchar*, \
5701 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, ULONG*), \
5702 (this, ret, first, last, base, state, pval))
5703 #endif
5704 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_ulong,36)
5705 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_ulong(const num_get *this, istreambuf_iterator_wchar *ret,
5706 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, ULONG *pval)
5708 return num_get_do_get_ulong(this, ret, first, last, base,
5709 state, pval, numpunct_wchar_use_facet(IOS_LOCALE(base)));
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@AAHAAK@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@AEAHAEAK@Z */
5714 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_ulong,36)
5715 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_ulong(const num_get *this, istreambuf_iterator_wchar *ret,
5716 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, ULONG *pval)
5718 return num_get_do_get_ulong(this, ret, first, last, base,
5719 state, pval, numpunct_short_use_facet(IOS_LOCALE(base)));
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@AAHAAK@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@AEAHAEAK@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@AAHAAK@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@AEAHAEAK@Z */
5726 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_ulong,36)
5727 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_ulong(const num_get *this, istreambuf_iterator_wchar *ret,
5728 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, ULONG *pval)
5730 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5731 return call_num_get_wchar_do_get_ulong(this, ret, first, last, base, state, pval);
5734 static istreambuf_iterator_wchar* num_get_do_get_long(const num_get *this,
5735 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar first,
5736 istreambuf_iterator_wchar last, ios_base *base, int *state,
5737 LONG *pval, numpunct_wchar *numpunct)
5739 LONG v;
5740 char tmp[25], *end;
5741 int err;
5743 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5745 v = _Stolx(tmp, &end, num_get__Getifld(this, tmp, &first,
5746 &last, base->fmtfl, IOS_LOCALE(base), numpunct), &err);
5747 if(end!=tmp && !err)
5748 *pval = v;
5749 else
5750 *state |= IOSTATE_failbit;
5752 if(!first.strbuf)
5753 *state |= IOSTATE_eofbit;
5755 *ret = first;
5756 return ret;
5759 /* ?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 */
5760 /* ?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 */
5761 #if _MSVCP_VER <= 100
5762 #define call_num_get_wchar_do_get_long(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 32, istreambuf_iterator_wchar*, \
5763 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, LONG*), \
5764 (this, ret, first, last, base, state, pval))
5765 #else
5766 #define call_num_get_wchar_do_get_long(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 40, istreambuf_iterator_wchar*, \
5767 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, LONG*), \
5768 (this, ret, first, last, base, state, pval))
5769 #endif
5770 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_long,36)
5771 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_long(const num_get *this, istreambuf_iterator_wchar *ret,
5772 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, LONG *pval)
5774 return num_get_do_get_long(this, ret, first, last, base,
5775 state, pval, numpunct_wchar_use_facet(IOS_LOCALE(base)));
5778 /* ?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 */
5779 /* ?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 */
5780 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_long,36)
5781 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_long(const num_get *this, istreambuf_iterator_wchar *ret,
5782 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, LONG *pval)
5784 return num_get_do_get_long(this, ret, first, last, base,
5785 state, pval, numpunct_short_use_facet(IOS_LOCALE(base)));
5788 /* ?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 */
5789 /* ?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 */
5790 /* ?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 */
5791 /* ?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 */
5792 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_long,36)
5793 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_long(const num_get *this, istreambuf_iterator_wchar *ret,
5794 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, LONG *pval)
5796 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5797 return call_num_get_wchar_do_get_long(this, ret, first, last, base, state, pval);
5800 /* ?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 */
5801 /* ?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 */
5802 #if _MSVCP_VER <= 100
5803 #define call_num_get_wchar_do_get_uint(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 36, istreambuf_iterator_wchar*, \
5804 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, unsigned int*), \
5805 (this, ret, first, last, base, state, pval))
5806 #else
5807 #define call_num_get_wchar_do_get_uint(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 44, istreambuf_iterator_wchar*, \
5808 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, unsigned int*), \
5809 (this, ret, first, last, base, state, pval))
5810 #endif
5811 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_uint,36)
5812 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_uint(const num_get *this, istreambuf_iterator_wchar *ret,
5813 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, unsigned int *pval)
5815 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5816 return num_get_wchar_do_get_ulong(this, ret, first, last, base, state, pval);
5819 /* ?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 */
5820 /* ?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 */
5821 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_uint,36)
5822 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_uint(const num_get *this, istreambuf_iterator_wchar *ret,
5823 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, unsigned int *pval)
5825 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5826 return num_get_short_do_get_ulong(this, ret, first, last, base, state, pval);
5829 /* ?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 */
5830 /* ?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 */
5831 /* ?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 */
5832 /* ?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 */
5833 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_uint,36)
5834 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_uint(const num_get *this, istreambuf_iterator_wchar *ret,
5835 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, unsigned int *pval)
5837 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5838 return call_num_get_wchar_do_get_uint(this, ret, first, last, base, state, pval);
5841 /* ?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 */
5842 /* ?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 */
5843 #if _MSVCP_VER <= 100
5844 #define call_num_get_wchar_do_get_ushort(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 40, istreambuf_iterator_wchar*, \
5845 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, unsigned short*), \
5846 (this, ret, first, last, base, state, pval))
5847 #else
5848 #define call_num_get_wchar_do_get_ushort(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 48, istreambuf_iterator_wchar*, \
5849 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, unsigned short*), \
5850 (this, ret, first, last, base, state, pval))
5851 #endif
5852 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_ushort,36)
5853 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_ushort(const num_get *this, istreambuf_iterator_wchar *ret,
5854 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, unsigned short *pval)
5856 ULONG v;
5857 char tmp[25], *beg, *end;
5858 int err, b;
5860 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5862 b = num_get_wchar__Getifld(this, tmp,
5863 &first, &last, base->fmtfl, IOS_LOCALE(base));
5864 beg = tmp + (tmp[0]=='-' ? 1 : 0);
5865 v = _Stoulx(beg, &end, b, &err);
5867 if(v != (ULONG)((unsigned short)v))
5868 *state |= IOSTATE_failbit;
5869 else if(end!=beg && !err)
5870 *pval = (tmp[0]=='-' ? -((unsigned short)v) : v);
5871 else
5872 *state |= IOSTATE_failbit;
5874 if(!first.strbuf)
5875 *state |= IOSTATE_eofbit;
5877 *ret = first;
5878 return ret;
5881 /* ?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 */
5882 /* ?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 */
5883 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_ushort,36)
5884 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_ushort(const num_get *this, istreambuf_iterator_wchar *ret,
5885 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, unsigned short *pval)
5887 FIXME("(%p %p %p %p %p) stub\n", this, ret, base, state, pval);
5888 return ret;
5891 /* ?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 */
5892 /* ?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 */
5893 /* ?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@ */
5894 /* ?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 */
5895 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_ushort,36)
5896 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_ushort(const num_get *this, istreambuf_iterator_wchar *ret,
5897 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, unsigned short *pval)
5899 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5900 return call_num_get_wchar_do_get_ushort(this, ret, first, last, base, state, pval);
5903 static istreambuf_iterator_wchar* num_get_do_get_bool(const num_get *this,
5904 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar first,
5905 istreambuf_iterator_wchar last, ios_base *base, int *state,
5906 MSVCP_bool *pval, numpunct_wchar *numpunct)
5908 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5910 if(base->fmtfl & FMTFLAG_boolalpha) {
5911 basic_string_wchar false_bstr, true_bstr;
5912 const wchar_t *pfalse, *ptrue;
5914 numpunct_wchar_falsename(numpunct, &false_bstr);
5915 numpunct_wchar_truename(numpunct, &true_bstr);
5916 pfalse = MSVCP_basic_string_wchar_c_str(&false_bstr);
5917 ptrue = MSVCP_basic_string_wchar_c_str(&true_bstr);
5919 for(istreambuf_iterator_wchar_val(&first); first.strbuf;) {
5920 if(pfalse && *pfalse && first.val!=*pfalse)
5921 pfalse = NULL;
5922 if(ptrue && *ptrue && first.val!=*ptrue)
5923 ptrue = NULL;
5925 if(pfalse && *pfalse && ptrue && !*ptrue)
5926 ptrue = NULL;
5927 if(ptrue && *ptrue && pfalse && !*pfalse)
5928 pfalse = NULL;
5930 if(pfalse)
5931 pfalse++;
5932 if(ptrue)
5933 ptrue++;
5935 if(pfalse || ptrue)
5936 istreambuf_iterator_wchar_inc(&first);
5938 if((!pfalse || !*pfalse) && (!ptrue || !*ptrue))
5939 break;
5942 if(ptrue)
5943 *pval = TRUE;
5944 else if(pfalse)
5945 *pval = FALSE;
5946 else
5947 *state |= IOSTATE_failbit;
5949 MSVCP_basic_string_wchar_dtor(&false_bstr);
5950 MSVCP_basic_string_wchar_dtor(&true_bstr);
5951 }else {
5952 char tmp[25], *end;
5953 int err;
5954 LONG v = _Stolx(tmp, &end, num_get__Getifld(this, tmp, &first,
5955 &last, base->fmtfl, IOS_LOCALE(base), numpunct), &err);
5957 if(end!=tmp && err==0 && (v==0 || v==1))
5958 *pval = v;
5959 else
5960 *state |= IOSTATE_failbit;
5963 if(!first.strbuf)
5964 *state |= IOSTATE_eofbit;
5965 memcpy(ret, &first, sizeof(first));
5966 return ret;
5969 /* ?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 */
5970 /* ?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 */
5971 #if _MSVCP_VER <= 100
5972 #define call_num_get_wchar_do_get_bool(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 44, istreambuf_iterator_wchar*, \
5973 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, MSVCP_bool*), \
5974 (this, ret, first, last, base, state, pval))
5975 #else
5976 #define call_num_get_wchar_do_get_bool(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 52, istreambuf_iterator_wchar*, \
5977 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, MSVCP_bool*), \
5978 (this, ret, first, last, base, state, pval))
5979 #endif
5980 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_bool,36)
5981 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_bool(const num_get *this, istreambuf_iterator_wchar *ret,
5982 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, MSVCP_bool *pval)
5984 return num_get_do_get_bool(this, ret, first, last, base,
5985 state, pval, numpunct_wchar_use_facet(IOS_LOCALE(base)));
5988 /* ?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 */
5989 /* ?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 */
5990 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_bool,36)
5991 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_bool(const num_get *this, istreambuf_iterator_wchar *ret,
5992 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, MSVCP_bool *pval)
5994 return num_get_do_get_bool(this, ret, first, last, base,
5995 state, pval, numpunct_short_use_facet(IOS_LOCALE(base)));
5998 /* ?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 */
5999 /* ?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 */
6000 /* ?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 */
6001 /* ?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 */
6002 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_bool,36)
6003 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_bool(const num_get *this, istreambuf_iterator_wchar *ret,
6004 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, MSVCP_bool *pval)
6006 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6007 return call_num_get_wchar_do_get_bool(this, ret, first, last, base, state, pval);
6010 /* ?id@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@2V0locale@2@A */
6011 locale_id num_get_char_id = {0};
6013 /* ??_7?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@6B@ */
6014 extern const vtable_ptr MSVCP_num_get_char_vtable;
6016 /* ?_Init@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@IAEXABV_Locinfo@2@@Z */
6017 /* ?_Init@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@IEAAXAEBV_Locinfo@2@@Z */
6018 DEFINE_THISCALL_WRAPPER(num_get_char__Init, 8)
6019 void __thiscall num_get_char__Init(num_get *this, const _Locinfo *locinfo)
6021 TRACE("(%p %p)\n", this, locinfo);
6022 _Locinfo__Getcvt(locinfo, &this->cvt);
6025 /* ??0?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
6026 /* ??0?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
6027 DEFINE_THISCALL_WRAPPER(num_get_char_ctor_locinfo, 12)
6028 num_get* __thiscall num_get_char_ctor_locinfo(num_get *this,
6029 const _Locinfo *locinfo, MSVCP_size_t refs)
6031 TRACE("(%p %p %lu)\n", this, locinfo, refs);
6033 locale_facet_ctor_refs(&this->facet, refs);
6034 this->facet.vtable = &MSVCP_num_get_char_vtable;
6036 num_get_char__Init(this, locinfo);
6037 return this;
6040 /* ??0?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAE@I@Z */
6041 /* ??0?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAA@_K@Z */
6042 DEFINE_THISCALL_WRAPPER(num_get_char_ctor_refs, 8)
6043 num_get* __thiscall num_get_char_ctor_refs(num_get *this, MSVCP_size_t refs)
6045 _Locinfo locinfo;
6047 TRACE("(%p %lu)\n", this, refs);
6049 _Locinfo_ctor(&locinfo);
6050 num_get_char_ctor_locinfo(this, &locinfo, refs);
6051 _Locinfo_dtor(&locinfo);
6052 return this;
6055 /* ??_F?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAEXXZ */
6056 /* ??_F?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAAXXZ */
6057 DEFINE_THISCALL_WRAPPER(num_get_char_ctor, 4)
6058 num_get* __thiscall num_get_char_ctor(num_get *this)
6060 return num_get_char_ctor_refs(this, 0);
6063 /* ??1?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@UAE@XZ */
6064 /* ??1?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@UEAA@XZ */
6065 /* ??1?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MAE@XZ */
6066 /* ??1?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MEAA@XZ */
6067 DEFINE_THISCALL_WRAPPER(num_get_char_dtor, 4)
6068 void __thiscall num_get_char_dtor(num_get *this)
6070 TRACE("(%p)\n", this);
6071 locale_facet_dtor(&this->facet);
6074 DEFINE_THISCALL_WRAPPER(num_get_char_vector_dtor, 8)
6075 num_get* __thiscall num_get_char_vector_dtor(num_get *this, unsigned int flags)
6077 TRACE("(%p %x)\n", this, flags);
6078 if(flags & 2) {
6079 /* we have an array, with the number of elements stored before the first object */
6080 INT_PTR i, *ptr = (INT_PTR *)this-1;
6082 for(i=*ptr-1; i>=0; i--)
6083 num_get_char_dtor(this+i);
6084 MSVCRT_operator_delete(ptr);
6085 } else {
6086 num_get_char_dtor(this);
6087 if(flags & 1)
6088 MSVCRT_operator_delete(this);
6091 return this;
6094 /* ?_Getcat@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
6095 /* ?_Getcat@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
6096 MSVCP_size_t __cdecl num_get_char__Getcat(const locale_facet **facet, const locale *loc)
6098 TRACE("(%p %p)\n", facet, loc);
6100 if(facet && !*facet) {
6101 _Locinfo locinfo;
6103 *facet = MSVCRT_operator_new(sizeof(num_get));
6104 if(!*facet) {
6105 ERR("Out of memory\n");
6106 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
6107 return 0;
6110 _Locinfo_ctor_cstr(&locinfo, locale_string_char_c_str(&loc->ptr->name));
6111 num_get_char_ctor_locinfo((num_get*)*facet, &locinfo, 0);
6112 _Locinfo_dtor(&locinfo);
6115 return LC_NUMERIC;
6118 /* ?_Getcat@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SAIPAPBVfacet@locale@2@@Z */
6119 /* ?_Getcat@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@@Z */
6120 MSVCP_size_t __cdecl num_get_char__Getcat_old(const locale_facet **facet)
6122 return num_get_char__Getcat(facet, locale_classic());
6125 num_get* num_get_char_use_facet(const locale *loc)
6127 static num_get *obj = NULL;
6129 _Lockit lock;
6130 const locale_facet *fac;
6132 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
6133 fac = locale__Getfacet(loc, locale_id_operator_size_t(&num_get_char_id));
6134 if(fac) {
6135 _Lockit_dtor(&lock);
6136 return (num_get*)fac;
6139 if(obj) {
6140 _Lockit_dtor(&lock);
6141 return obj;
6144 num_get_char__Getcat(&fac, loc);
6145 obj = (num_get*)fac;
6146 call_locale_facet__Incref(&obj->facet);
6147 locale_facet_register(&obj->facet);
6148 _Lockit_dtor(&lock);
6150 return obj;
6153 /* ?_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 */
6154 /* ?_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 */
6155 /* Copies number to dest buffer, validates grouping and skips separators.
6156 * Updates first so it points past the number, all digits are skipped.
6157 * Returns how exponent needs to changed.
6158 * Size of dest buffer is not specified, assuming it's not smaller than 32:
6159 * strlen(+0.e+) + 22(digits) + 4(expontent) + 1(nullbyte)
6161 int __cdecl num_get_char__Getffld(const num_get *this, char *dest, istreambuf_iterator_char *first,
6162 istreambuf_iterator_char *last, const locale *loc)
6164 numpunct_char *numpunct = numpunct_char_use_facet(loc);
6165 basic_string_char grouping_bstr;
6166 basic_string_char groups_found;
6167 int groups_no = 0, cur_group = 0, exp = 0;
6168 char *dest_beg = dest, *num_end = dest+25, *exp_end = dest+31, sep = 0;
6169 const char *grouping, *groups;
6170 BOOL error = FALSE, got_digit = FALSE, got_nonzero = FALSE;
6172 TRACE("(%p %p %p %p)\n", dest, first, last, loc);
6174 numpunct_char_grouping(numpunct, &grouping_bstr);
6175 grouping = MSVCP_basic_string_char_c_str(&grouping_bstr);
6176 #if _MSVCP_VER >= 70
6177 if (grouping[0]) sep = numpunct_char_thousands_sep(numpunct);
6178 #endif
6180 if(sep)
6181 MSVCP_basic_string_char_ctor(&groups_found);
6183 istreambuf_iterator_char_val(first);
6184 /* get sign */
6185 if(first->strbuf && (first->val=='-' || first->val=='+')) {
6186 *dest++ = first->val;
6187 istreambuf_iterator_char_inc(first);
6190 /* read possibly grouped numbers before decimal */
6191 for(; first->strbuf; istreambuf_iterator_char_inc(first)) {
6192 if(first->val<'0' || first->val>'9') {
6193 if(sep && first->val==sep) {
6194 if(!groups_no) break; /* empty group - stop parsing */
6195 MSVCP_basic_string_char_append_ch(&groups_found, groups_no);
6196 groups_no = 0;
6197 ++cur_group;
6198 }else {
6199 break;
6201 }else {
6202 got_digit = TRUE; /* found a digit, zero or non-zero */
6203 /* write digit to dest if not a leading zero (to not waste dest buffer) */
6204 if(!got_nonzero && first->val == '0')
6206 ++groups_no;
6207 continue;
6209 got_nonzero = TRUE;
6210 if(dest < num_end)
6211 *dest++ = first->val;
6212 else
6213 exp++; /* too many digits, just multiply by 10 */
6214 if(sep && groups_no<CHAR_MAX)
6215 ++groups_no;
6219 /* if all leading zeroes, we didn't write anything so put a zero we check for a decimal */
6220 if(got_digit && !got_nonzero)
6221 *dest++ = '0';
6223 /* get decimal, if any */
6224 if(first->strbuf && first->val==numpunct_char_decimal_point(numpunct)) {
6225 if(dest < num_end)
6226 *dest++ = *localeconv()->decimal_point;
6227 istreambuf_iterator_char_inc(first);
6230 /* read non-grouped after decimal */
6231 for(; first->strbuf; istreambuf_iterator_char_inc(first)) {
6232 if(first->val<'0' || first->val>'9')
6233 break;
6234 else if(dest<num_end) {
6235 got_digit = TRUE;
6236 *dest++ = first->val;
6240 /* read exponent, if any */
6241 if(first->strbuf && (first->val=='e' || first->val=='E')) {
6242 *dest++ = first->val;
6243 istreambuf_iterator_char_inc(first);
6245 if(first->strbuf && (first->val=='-' || first->val=='+')) {
6246 *dest++ = first->val;
6247 istreambuf_iterator_char_inc(first);
6250 got_digit = got_nonzero = FALSE;
6251 error = TRUE;
6252 /* skip any leading zeroes */
6253 for(; first->strbuf && first->val=='0'; istreambuf_iterator_char_inc(first))
6254 got_digit = TRUE;
6256 for(; first->strbuf && first->val>='0' && first->val<='9'; istreambuf_iterator_char_inc(first)) {
6257 got_digit = got_nonzero = TRUE; /* leading zeroes would have been skipped, so first digit is non-zero */
6258 error = FALSE;
6259 if(dest<exp_end)
6260 *dest++ = first->val;
6263 /* if just found zeroes for exponent, use that */
6264 if(got_digit && !got_nonzero)
6266 error = FALSE;
6267 if(dest<exp_end)
6268 *dest++ = '0';
6272 if(sep && groups_no)
6273 MSVCP_basic_string_char_append_ch(&groups_found, groups_no);
6275 if(!cur_group) /* no groups, skip loop */
6276 cur_group--;
6277 else if(!(groups = MSVCP_basic_string_char_c_str(&groups_found))[cur_group])
6278 error = TRUE; /* trailing empty */
6280 for(; cur_group>=0 && !error; cur_group--) {
6281 if(*grouping == CHAR_MAX) {
6282 if(cur_group)
6283 error = TRUE;
6284 break;
6285 }else if((cur_group && *grouping!=groups[cur_group])
6286 || (!cur_group && *grouping<groups[cur_group])) {
6287 error = TRUE;
6288 break;
6289 }else if(grouping[1]) {
6290 grouping++;
6293 MSVCP_basic_string_char_dtor(&grouping_bstr);
6294 if(sep)
6295 MSVCP_basic_string_char_dtor(&groups_found);
6297 if(error) {
6298 *dest_beg = '\0';
6299 return 0;
6301 *dest++ = '\0';
6302 return exp;
6305 /* ?_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 */
6306 /* ?_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 */
6307 int __cdecl num_get_char__Getffldx(const num_get *this, char *dest, istreambuf_iterator_char *first,
6308 istreambuf_iterator_char *last, ios_base *ios, int *phexexp)
6310 FIXME("(%p %p %p %p %p) stub\n", dest, first, last, ios, phexexp);
6311 return -1;
6314 /* ?_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 */
6315 /* ?_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 */
6316 /* Copies number to dest buffer, validates grouping and skips separators.
6317 * Updates first so it points past the number, all digits are skipped.
6318 * Returns number base (8, 10 or 16).
6319 * Size of dest buffer is not specified, assuming it's not smaller than 25:
6320 * 22(8^22>2^64)+1(detect overflows)+1(sign)+1(nullbyte) = 25
6322 int __cdecl num_get_char__Getifld(const num_get *this, char *dest, istreambuf_iterator_char *first,
6323 istreambuf_iterator_char *last, int fmtflags, const locale *loc)
6325 static const char digits[] = "0123456789abcdefABCDEF";
6327 numpunct_char *numpunct = numpunct_char_use_facet(loc);
6328 basic_string_char grouping_bstr;
6329 basic_string_char groups_found;
6330 int basefield, base, groups_no = 0, cur_group = 0;
6331 char *dest_beg = dest, *dest_end = dest+24, sep = 0;
6332 const char *grouping, *groups;
6333 BOOL error = TRUE, dest_empty = TRUE, found_zero = FALSE;
6335 TRACE("(%p %p %p %04x %p)\n", dest, first, last, fmtflags, loc);
6337 numpunct_char_grouping(numpunct, &grouping_bstr);
6338 grouping = MSVCP_basic_string_char_c_str(&grouping_bstr);
6339 #if _MSVCP_VER >= 70
6340 if (grouping[0]) sep = numpunct_char_thousands_sep(numpunct);
6341 #endif
6343 basefield = fmtflags & FMTFLAG_basefield;
6344 if(basefield == FMTFLAG_oct)
6345 base = 8;
6346 else if(basefield == FMTFLAG_hex)
6347 base = 22; /* equal to the size of digits buffer */
6348 else if(!basefield)
6349 base = 0;
6350 else
6351 base = 10;
6353 istreambuf_iterator_char_val(first);
6354 if(first->strbuf && (first->val=='-' || first->val=='+')) {
6355 *dest++ = first->val;
6356 istreambuf_iterator_char_inc(first);
6359 if(first->strbuf && first->val=='0') {
6360 found_zero = TRUE;
6361 istreambuf_iterator_char_inc(first);
6362 if(first->strbuf && (first->val=='x' || first->val=='X')) {
6363 if(!base || base == 22) {
6364 found_zero = FALSE;
6365 istreambuf_iterator_char_inc(first);
6366 base = 22;
6367 }else {
6368 base = 10;
6370 }else {
6371 error = FALSE;
6372 if(!base) base = 8;
6374 }else {
6375 if (!base) base = 10;
6378 if(sep)
6380 MSVCP_basic_string_char_ctor(&groups_found);
6381 if(found_zero) ++groups_no;
6384 for(; first->strbuf; istreambuf_iterator_char_inc(first)) {
6385 if(!memchr(digits, first->val, base)) {
6386 if(sep && first->val==sep) {
6387 if(!groups_no) break; /* empty group - stop parsing */
6388 MSVCP_basic_string_char_append_ch(&groups_found, groups_no);
6389 groups_no = 0;
6390 ++cur_group;
6391 }else {
6392 break;
6394 }else {
6395 error = FALSE;
6396 if(dest_empty && first->val == '0')
6398 found_zero = TRUE;
6399 ++groups_no;
6400 continue;
6402 dest_empty = FALSE;
6403 /* skip digits that can't be copied to dest buffer, other
6404 * functions are responsible for detecting overflows */
6405 if(dest < dest_end)
6406 *dest++ = first->val;
6407 if(sep && groups_no<CHAR_MAX)
6408 ++groups_no;
6412 if(sep && groups_no)
6413 MSVCP_basic_string_char_append_ch(&groups_found, groups_no);
6415 if(!cur_group) { /* no groups, skip loop */
6416 cur_group--;
6417 }else if(!(groups = MSVCP_basic_string_char_c_str(&groups_found))[cur_group]) {
6418 error = TRUE; /* trailing empty */
6419 found_zero = FALSE;
6422 for(; cur_group>=0 && !error; cur_group--) {
6423 if(*grouping == CHAR_MAX) {
6424 if(cur_group)
6425 error = TRUE;
6426 break;
6427 }else if((cur_group && *grouping!=groups[cur_group])
6428 || (!cur_group && *grouping<groups[cur_group])) {
6429 error = TRUE;
6430 break;
6431 }else if(grouping[1]) {
6432 grouping++;
6436 MSVCP_basic_string_char_dtor(&grouping_bstr);
6437 if(sep)
6438 MSVCP_basic_string_char_dtor(&groups_found);
6440 if(error) {
6441 if (found_zero)
6442 *dest++ = '0';
6443 else
6444 dest = dest_beg;
6445 }else if(dest_empty)
6446 *dest++ = '0';
6447 *dest = '\0';
6449 return (base==22 ? 16 : base);
6452 /* ?_Hexdig@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@ABEHD000@Z */
6453 /* ?_Hexdig@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@AEBAHD000@Z */
6454 DEFINE_THISCALL_WRAPPER(MSVCP_num_get_char__Hexdig, 20)
6455 int __thiscall MSVCP_num_get_char__Hexdig(num_get *this, char dig, char e0, char al, char au)
6457 FIXME("(%p %c %c %c %c) stub\n", this, dig, e0, al, au);
6458 return -1;
6461 /* ?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 */
6462 /* ?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 */
6463 #if _MSVCP_VER <= 100
6464 #define call_num_get_char_do_get_void(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 4, istreambuf_iterator_char*, \
6465 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, void**), \
6466 (this, ret, first, last, base, state, pval))
6467 #else
6468 #define call_num_get_char_do_get_void(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 12, istreambuf_iterator_char*, \
6469 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, void**), \
6470 (this, ret, first, last, base, state, pval))
6471 #endif
6472 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_void,36)
6473 istreambuf_iterator_char *__thiscall num_get_char_do_get_void(const num_get *this, istreambuf_iterator_char *ret,
6474 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, void **pval)
6476 unsigned __int64 v;
6477 char tmp[25], *end;
6478 int err;
6480 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6482 v = _Stoullx(tmp, &end, num_get_char__Getifld(this, tmp,
6483 &first, &last, FMTFLAG_hex, IOS_LOCALE(base)), &err);
6484 if(v!=(unsigned __int64)((INT_PTR)v))
6485 *state |= IOSTATE_failbit;
6486 else if(end!=tmp && !err)
6487 *pval = (void*)((INT_PTR)v);
6488 else
6489 *state |= IOSTATE_failbit;
6491 if(!first.strbuf)
6492 *state |= IOSTATE_eofbit;
6494 *ret = first;
6495 return ret;
6498 /* ?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 */
6499 /* ?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 */
6500 DEFINE_THISCALL_WRAPPER(num_get_char_get_void,36)
6501 istreambuf_iterator_char *__thiscall num_get_char_get_void(const num_get *this, istreambuf_iterator_char *ret,
6502 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, void **pval)
6504 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6505 return call_num_get_char_do_get_void(this, ret, first, last, base, state, pval);
6508 /* ?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 */
6509 /* ?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 */
6510 /* ?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 */
6511 /* ?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 */
6512 #if _MSVCP_VER <= 100
6513 #define call_num_get_char_do_get_ldouble(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 8, istreambuf_iterator_char*, \
6514 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, double*), \
6515 (this, ret, first, last, base, state, pval))
6516 #define call_num_get_char_do_get_double(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 12, istreambuf_iterator_char*, \
6517 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, double*), \
6518 (this, ret, first, last, base, state, pval))
6519 #else
6520 #define call_num_get_char_do_get_ldouble(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 16, istreambuf_iterator_char*, \
6521 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, double*), \
6522 (this, ret, first, last, base, state, pval))
6523 #define call_num_get_char_do_get_double(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 20, istreambuf_iterator_char*, \
6524 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, double*), \
6525 (this, ret, first, last, base, state, pval))
6526 #endif
6527 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_double,36)
6528 istreambuf_iterator_char *__thiscall num_get_char_do_get_double(const num_get *this, istreambuf_iterator_char *ret,
6529 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, double *pval)
6531 double v;
6532 char tmp[32], *end;
6533 int err;
6535 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6537 v = _Stodx(tmp, &end, num_get_char__Getffld(this, tmp, &first, &last, IOS_LOCALE(base)), &err);
6538 if(end!=tmp && !err)
6539 *pval = v;
6540 else
6541 *state |= IOSTATE_failbit;
6543 if(!first.strbuf)
6544 *state |= IOSTATE_eofbit;
6546 *ret = first;
6547 return ret;
6550 /* ?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 */
6551 /* ?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 */
6552 DEFINE_THISCALL_WRAPPER(num_get_char_get_ldouble,36)
6553 istreambuf_iterator_char *__thiscall num_get_char_get_ldouble(const num_get *this, istreambuf_iterator_char *ret,
6554 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, double *pval)
6556 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6557 return call_num_get_char_do_get_ldouble(this, ret, first, last, base, state, pval);
6560 /* ?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 */
6561 /* ?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 */
6562 DEFINE_THISCALL_WRAPPER(num_get_char_get_double,36)
6563 istreambuf_iterator_char *__thiscall num_get_char_get_double(const num_get *this, istreambuf_iterator_char *ret,
6564 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, double *pval)
6566 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6567 return call_num_get_char_do_get_double(this, ret, first, last, base, state, pval);
6570 /* ?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 */
6571 /* ?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 */
6572 #if _MSVCP_VER <= 100
6573 #define call_num_get_char_do_get_float(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 16, istreambuf_iterator_char*, \
6574 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, float*), \
6575 (this, ret, first, last, base, state, pval))
6576 #else
6577 #define call_num_get_char_do_get_float(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 24, istreambuf_iterator_char*, \
6578 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, float*), \
6579 (this, ret, first, last, base, state, pval))
6580 #endif
6581 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_float,36)
6582 istreambuf_iterator_char *__thiscall num_get_char_do_get_float(const num_get *this, istreambuf_iterator_char *ret,
6583 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, float *pval)
6585 float v;
6586 char tmp[32], *end;
6587 int err;
6589 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6591 v = _Stofx(tmp, &end, num_get_char__Getffld(this, tmp, &first, &last, IOS_LOCALE(base)), &err);
6592 if(end!=tmp && !err)
6593 *pval = v;
6594 else
6595 *state |= IOSTATE_failbit;
6597 if(!first.strbuf)
6598 *state |= IOSTATE_eofbit;
6600 *ret = first;
6601 return ret;
6604 /* ?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 */
6605 /* ?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 */
6606 DEFINE_THISCALL_WRAPPER(num_get_char_get_float,36)
6607 istreambuf_iterator_char *__thiscall num_get_char_get_float(const num_get *this, istreambuf_iterator_char *ret,
6608 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, float *pval)
6610 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6611 return call_num_get_char_do_get_float(this, ret, first, last, base, state, pval);
6614 /* ?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 */
6615 /* ?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 */
6616 #if _MSVCP_VER <= 100
6617 #define call_num_get_char_do_get_uint64(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 20, istreambuf_iterator_char*, \
6618 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, ULONGLONG*), \
6619 (this, ret, first, last, base, state, pval))
6620 #else
6621 #define call_num_get_char_do_get_uint64(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 28, istreambuf_iterator_char*, \
6622 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, ULONGLONG*), \
6623 (this, ret, first, last, base, state, pval))
6624 #endif
6625 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_uint64,36)
6626 istreambuf_iterator_char *__thiscall num_get_char_do_get_uint64(const num_get *this, istreambuf_iterator_char *ret,
6627 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, ULONGLONG *pval)
6629 unsigned __int64 v;
6630 char tmp[25], *end;
6631 int err;
6633 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6635 v = _Stoullx(tmp, &end, num_get_char__Getifld(this, tmp,
6636 &first, &last, base->fmtfl, IOS_LOCALE(base)), &err);
6637 if(end!=tmp && !err)
6638 *pval = v;
6639 else
6640 *state |= IOSTATE_failbit;
6642 if(!first.strbuf)
6643 *state |= IOSTATE_eofbit;
6645 *ret = first;
6646 return ret;
6649 /* ?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 */
6650 /* ?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 */
6651 DEFINE_THISCALL_WRAPPER(num_get_char_get_uint64,36)
6652 istreambuf_iterator_char *__thiscall num_get_char_get_uint64(const num_get *this, istreambuf_iterator_char *ret,
6653 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, ULONGLONG *pval)
6655 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6656 return call_num_get_char_do_get_uint64(this, ret, first, last, base, state, pval);
6659 /* ?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 */
6660 /* ?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 */
6661 #if _MSVCP_VER <= 100
6662 #define call_num_get_char_do_get_int64(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 24, istreambuf_iterator_char*, \
6663 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, LONGLONG*), \
6664 (this, ret, first, last, base, state, pval))
6665 #else
6666 #define call_num_get_char_do_get_int64(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 32, istreambuf_iterator_char*, \
6667 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, LONGLONG*), \
6668 (this, ret, first, last, base, state, pval))
6669 #endif
6670 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_int64,36)
6671 istreambuf_iterator_char *__thiscall num_get_char_do_get_int64(const num_get *this, istreambuf_iterator_char *ret,
6672 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, LONGLONG *pval)
6674 __int64 v;
6675 char tmp[25], *end;
6676 int err;
6678 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6680 v = _Stollx(tmp, &end, num_get_char__Getifld(this, tmp,
6681 &first, &last, base->fmtfl, IOS_LOCALE(base)), &err);
6682 if(end!=tmp && !err)
6683 *pval = v;
6684 else
6685 *state |= IOSTATE_failbit;
6687 if(!first.strbuf)
6688 *state |= IOSTATE_eofbit;
6690 *ret = first;
6691 return ret;
6694 /* ?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 */
6695 /* ?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 */
6696 DEFINE_THISCALL_WRAPPER(num_get_char_get_int64,36)
6697 istreambuf_iterator_char *__thiscall num_get_char_get_int64(const num_get *this, istreambuf_iterator_char *ret,
6698 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, LONGLONG *pval)
6700 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6701 return call_num_get_char_do_get_int64(this, ret, first, last, base, state, pval);
6704 /* ?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 */
6705 /* ?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 */
6706 #if _MSVCP_VER <= 100
6707 #define call_num_get_char_do_get_ulong(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 28, istreambuf_iterator_char*, \
6708 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, ULONG*), \
6709 (this, ret, first, last, base, state, pval))
6710 #else
6711 #define call_num_get_char_do_get_ulong(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 36, istreambuf_iterator_char*, \
6712 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, ULONG*), \
6713 (this, ret, first, last, base, state, pval))
6714 #endif
6715 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_ulong,36)
6716 istreambuf_iterator_char *__thiscall num_get_char_do_get_ulong(const num_get *this, istreambuf_iterator_char *ret,
6717 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, ULONG *pval)
6719 ULONG v;
6720 char tmp[25], *end;
6721 int err;
6723 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6725 v = _Stoulx(tmp, &end, num_get_char__Getifld(this, tmp,
6726 &first, &last, base->fmtfl, IOS_LOCALE(base)), &err);
6727 if(end!=tmp && !err)
6728 *pval = v;
6729 else
6730 *state |= IOSTATE_failbit;
6732 if(!first.strbuf)
6733 *state |= IOSTATE_eofbit;
6735 *ret = first;
6736 return ret;
6739 /* ?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 */
6740 /* ?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 */
6741 DEFINE_THISCALL_WRAPPER(num_get_char_get_ulong,36)
6742 istreambuf_iterator_char *__thiscall num_get_char_get_ulong(const num_get *this, istreambuf_iterator_char *ret,
6743 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, ULONG *pval)
6745 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6746 return call_num_get_char_do_get_ulong(this, ret, first, last, base, state, pval);
6749 /* ?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 */
6750 /* ?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 */
6751 #if _MSVCP_VER <= 100
6752 #define call_num_get_char_do_get_long(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 32, istreambuf_iterator_char*, \
6753 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, LONG*), \
6754 (this, ret, first, last, base, state, pval))
6755 #else
6756 #define call_num_get_char_do_get_long(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 40, istreambuf_iterator_char*, \
6757 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, LONG*), \
6758 (this, ret, first, last, base, state, pval))
6759 #endif
6760 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_long,36)
6761 istreambuf_iterator_char *__thiscall num_get_char_do_get_long(const num_get *this, istreambuf_iterator_char *ret,
6762 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, LONG *pval)
6764 LONG v;
6765 char tmp[25], *end;
6766 int err;
6768 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6770 v = _Stolx(tmp, &end, num_get_char__Getifld(this, tmp,
6771 &first, &last, base->fmtfl, IOS_LOCALE(base)), &err);
6772 if(end!=tmp && !err)
6773 *pval = v;
6774 else
6775 *state |= IOSTATE_failbit;
6777 if(!first.strbuf)
6778 *state |= IOSTATE_eofbit;
6780 *ret = first;
6781 return ret;
6784 /* ?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 */
6785 /* ?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 */
6786 DEFINE_THISCALL_WRAPPER(num_get_char_get_long,36)
6787 istreambuf_iterator_char *__thiscall num_get_char_get_long(const num_get *this, istreambuf_iterator_char *ret,
6788 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, LONG *pval)
6790 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6791 return call_num_get_char_do_get_long(this, ret, first, last, base, state, pval);
6794 /* ?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 */
6795 /* ?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 */
6796 #if _MSVCP_VER <= 100
6797 #define call_num_get_char_do_get_uint(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 36, istreambuf_iterator_char*, \
6798 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, unsigned int*), \
6799 (this, ret, first, last, base, state, pval))
6800 #else
6801 #define call_num_get_char_do_get_uint(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 44, istreambuf_iterator_char*, \
6802 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, unsigned int*), \
6803 (this, ret, first, last, base, state, pval))
6804 #endif
6805 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_uint,36)
6806 istreambuf_iterator_char *__thiscall num_get_char_do_get_uint(const num_get *this, istreambuf_iterator_char *ret,
6807 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, unsigned int *pval)
6809 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6810 return num_get_char_do_get_ulong(this, ret, first, last, base, state, pval);
6813 /* ?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 */
6814 /* ?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 */
6815 DEFINE_THISCALL_WRAPPER(num_get_char_get_uint,36)
6816 istreambuf_iterator_char *__thiscall num_get_char_get_uint(const num_get *this, istreambuf_iterator_char *ret,
6817 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, unsigned int *pval)
6819 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6820 return call_num_get_char_do_get_uint(this, ret, first, last, base, state, pval);
6823 /* ?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 */
6824 /* ?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 */
6825 #if _MSVCP_VER <= 100
6826 #define call_num_get_char_do_get_ushort(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 40, istreambuf_iterator_char*, \
6827 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, unsigned short*), \
6828 (this, ret, first, last, base, state, pval))
6829 #else
6830 #define call_num_get_char_do_get_ushort(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 48, istreambuf_iterator_char*, \
6831 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, unsigned short*), \
6832 (this, ret, first, last, base, state, pval))
6833 #endif
6834 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_ushort,36)
6835 istreambuf_iterator_char *__thiscall num_get_char_do_get_ushort(const num_get *this, istreambuf_iterator_char *ret,
6836 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, unsigned short *pval)
6838 ULONG v;
6839 char tmp[25], *beg, *end;
6840 int err, b;
6842 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6844 b = num_get_char__Getifld(this, tmp,
6845 &first, &last, base->fmtfl, IOS_LOCALE(base));
6846 beg = tmp + (tmp[0]=='-' ? 1 : 0);
6847 v = _Stoulx(beg, &end, b, &err);
6849 if(v != (ULONG)((unsigned short)v))
6850 *state |= IOSTATE_failbit;
6851 else if(end!=beg && !err)
6852 *pval = (tmp[0]=='-' ? -((unsigned short)v) : v);
6853 else
6854 *state |= IOSTATE_failbit;
6856 if(!first.strbuf)
6857 *state |= IOSTATE_eofbit;
6859 *ret = first;
6860 return ret;
6863 /* ?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 */
6864 /* ?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 */
6865 DEFINE_THISCALL_WRAPPER(num_get_char_get_ushort,36)
6866 istreambuf_iterator_char *__thiscall num_get_char_get_ushort(const num_get *this, istreambuf_iterator_char *ret,
6867 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, unsigned short *pval)
6869 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6870 return call_num_get_char_do_get_ushort(this, ret, first, last, base, state, pval);
6873 /* ?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 */
6874 /* ?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 */
6875 #if _MSVCP_VER <= 100
6876 #define call_num_get_char_do_get_bool(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 44, istreambuf_iterator_char*, \
6877 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, MSVCP_bool*), \
6878 (this, ret, first, last, base, state, pval))
6879 #else
6880 #define call_num_get_char_do_get_bool(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 52, istreambuf_iterator_char*, \
6881 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, MSVCP_bool*), \
6882 (this, ret, first, last, base, state, pval))
6883 #endif
6884 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_bool,36)
6885 istreambuf_iterator_char *__thiscall num_get_char_do_get_bool(const num_get *this, istreambuf_iterator_char *ret,
6886 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, MSVCP_bool *pval)
6888 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6890 if(base->fmtfl & FMTFLAG_boolalpha) {
6891 numpunct_char *numpunct = numpunct_char_use_facet(IOS_LOCALE(base));
6892 basic_string_char false_bstr, true_bstr;
6893 const char *pfalse, *ptrue;
6895 numpunct_char_falsename(numpunct, &false_bstr);
6896 numpunct_char_truename(numpunct, &true_bstr);
6897 pfalse = MSVCP_basic_string_char_c_str(&false_bstr);
6898 ptrue = MSVCP_basic_string_char_c_str(&true_bstr);
6900 for(istreambuf_iterator_char_val(&first); first.strbuf;) {
6901 if(pfalse && *pfalse && first.val!=*pfalse)
6902 pfalse = NULL;
6903 if(ptrue && *ptrue && first.val!=*ptrue)
6904 ptrue = NULL;
6906 if(pfalse && *pfalse && ptrue && !*ptrue)
6907 ptrue = NULL;
6908 if(ptrue && *ptrue && pfalse && !*pfalse)
6909 pfalse = NULL;
6911 if(pfalse)
6912 pfalse++;
6913 if(ptrue)
6914 ptrue++;
6916 if(pfalse || ptrue)
6917 istreambuf_iterator_char_inc(&first);
6919 if((!pfalse || !*pfalse) && (!ptrue || !*ptrue))
6920 break;
6923 if(ptrue)
6924 *pval = TRUE;
6925 else if(pfalse)
6926 *pval = FALSE;
6927 else
6928 *state |= IOSTATE_failbit;
6930 MSVCP_basic_string_char_dtor(&false_bstr);
6931 MSVCP_basic_string_char_dtor(&true_bstr);
6932 }else {
6933 char tmp[25], *end;
6934 int err;
6935 LONG v = _Stolx(tmp, &end, num_get_char__Getifld(this, tmp,
6936 &first, &last, base->fmtfl, IOS_LOCALE(base)), &err);
6938 if(end!=tmp && err==0 && (v==0 || v==1))
6939 *pval = v;
6940 else
6941 *state |= IOSTATE_failbit;
6944 if(!first.strbuf)
6945 *state |= IOSTATE_eofbit;
6946 memcpy(ret, &first, sizeof(first));
6947 return ret;
6950 /* ?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 */
6951 /* ?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 */
6952 DEFINE_THISCALL_WRAPPER(num_get_char_get_bool,36)
6953 istreambuf_iterator_char *__thiscall num_get_char_get_bool(const num_get *this, istreambuf_iterator_char *ret,
6954 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, MSVCP_bool *pval)
6956 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6957 return call_num_get_char_do_get_bool(this, ret, first, last, base, state, pval);
6960 /* ?id@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@2V0locale@2@A */
6961 locale_id num_put_char_id = {0};
6963 /* num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@6B@ */
6964 extern const vtable_ptr MSVCP_num_put_char_vtable;
6966 /* ?_Init@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@IAEXABV_Locinfo@2@@Z */
6967 /* ?_Init@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@IEAAXAEBV_Locinfo@2@@Z */
6968 DEFINE_THISCALL_WRAPPER(num_put_char__Init, 8)
6969 void __thiscall num_put_char__Init(num_put *this, const _Locinfo *locinfo)
6971 TRACE("(%p %p)\n", this, locinfo);
6972 _Locinfo__Getcvt(locinfo, &this->cvt);
6975 /* ??0?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
6976 /* ??0?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
6977 DEFINE_THISCALL_WRAPPER(num_put_char_ctor_locinfo, 12)
6978 num_put* __thiscall num_put_char_ctor_locinfo(num_put *this, const _Locinfo *locinfo, MSVCP_size_t refs)
6980 TRACE("(%p %p %ld)\n", this, locinfo, refs);
6982 locale_facet_ctor_refs(&this->facet, refs);
6983 this->facet.vtable = &MSVCP_num_put_char_vtable;
6985 num_put_char__Init(this, locinfo);
6986 return this;
6989 /* ??0?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAE@I@Z */
6990 /* ??0?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAA@_K@Z */
6991 DEFINE_THISCALL_WRAPPER(num_put_char_ctor_refs, 8)
6992 num_put* __thiscall num_put_char_ctor_refs(num_put *this, MSVCP_size_t refs)
6994 _Locinfo locinfo;
6996 TRACE("(%p %lu)\n", this, refs);
6998 _Locinfo_ctor(&locinfo);
6999 num_put_char_ctor_locinfo(this, &locinfo, refs);
7000 _Locinfo_dtor(&locinfo);
7001 return this;
7004 /* ??_F?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAEXXZ */
7005 /* ??_F?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAAXXZ */
7006 DEFINE_THISCALL_WRAPPER(num_put_char_ctor, 4)
7007 num_put* __thiscall num_put_char_ctor(num_put *this)
7009 return num_put_char_ctor_refs(this, 0);
7012 /* ??1?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@UAE@XZ */
7013 /* ??1?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@UEAA@XZ */
7014 /* ??1?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MAE@XZ */
7015 /* ??1?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MEAA@XZ */
7016 DEFINE_THISCALL_WRAPPER(num_put_char_dtor, 4)
7017 void __thiscall num_put_char_dtor(num_put *this)
7019 TRACE("(%p)\n", this);
7020 locale_facet_dtor(&this->facet);
7023 DEFINE_THISCALL_WRAPPER(num_put_char_vector_dtor, 8)
7024 num_put* __thiscall num_put_char_vector_dtor(num_put *this, unsigned int flags)
7026 TRACE("(%p %x)\n", this, flags);
7027 if(flags & 2) {
7028 /* we have an array, with the number of elements stored before the first object */
7029 INT_PTR i, *ptr = (INT_PTR *)this-1;
7031 for(i=*ptr-1; i>=0; i--)
7032 num_put_char_dtor(this+i);
7033 MSVCRT_operator_delete(ptr);
7034 } else {
7035 num_put_char_dtor(this);
7036 if(flags & 1)
7037 MSVCRT_operator_delete(this);
7040 return this;
7043 /* ?_Getcat@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
7044 /* ?_Getcat@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
7045 MSVCP_size_t __cdecl num_put_char__Getcat(const locale_facet **facet, const locale *loc)
7047 TRACE("(%p %p)\n", facet, loc);
7049 if(facet && !*facet) {
7050 _Locinfo locinfo;
7052 *facet = MSVCRT_operator_new(sizeof(num_put));
7053 if(!*facet) {
7054 ERR("Out of memory\n");
7055 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7056 return 0;
7059 _Locinfo_ctor_cstr(&locinfo, locale_string_char_c_str(&loc->ptr->name));
7060 num_put_char_ctor_locinfo((num_put*)*facet, &locinfo, 0);
7061 _Locinfo_dtor(&locinfo);
7064 return LC_NUMERIC;
7067 /* ?_Getcat@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SAIPAPBVfacet@locale@2@@Z */
7068 /* ?_Getcat@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@@Z */
7069 MSVCP_size_t __cdecl num_put_char__Getcat_old(const locale_facet **facet)
7071 return num_put_char__Getcat(facet, locale_classic());
7074 num_put* num_put_char_use_facet(const locale *loc)
7076 static num_put *obj = NULL;
7078 _Lockit lock;
7079 const locale_facet *fac;
7081 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
7082 fac = locale__Getfacet(loc, locale_id_operator_size_t(&num_put_char_id));
7083 if(fac) {
7084 _Lockit_dtor(&lock);
7085 return (num_put*)fac;
7088 if(obj) {
7089 _Lockit_dtor(&lock);
7090 return obj;
7093 num_put_char__Getcat(&fac, loc);
7094 obj = (num_put*)fac;
7095 call_locale_facet__Incref(&obj->facet);
7096 locale_facet_register(&obj->facet);
7097 _Lockit_dtor(&lock);
7099 return obj;
7102 /* ?_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 */
7103 /* ?_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 */
7104 ostreambuf_iterator_char* __cdecl num_put_char__Put(const num_put *this, ostreambuf_iterator_char *ret,
7105 ostreambuf_iterator_char dest, const char *ptr, MSVCP_size_t count)
7107 TRACE("(%p %p %p %ld)\n", this, ret, ptr, count);
7109 for(; count>0; count--)
7110 ostreambuf_iterator_char_put(&dest, *ptr++);
7112 *ret = dest;
7113 return ret;
7116 /* ?_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 */
7117 /* ?_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 */
7118 ostreambuf_iterator_char* __cdecl num_put_char__Putc(const num_put *this, ostreambuf_iterator_char *ret,
7119 ostreambuf_iterator_char dest, const char *ptr, MSVCP_size_t count)
7121 TRACE("(%p %p %p %ld)\n", this, ret, ptr, count);
7123 for(; count>0; count--)
7124 ostreambuf_iterator_char_put(&dest, *ptr++);
7126 *ret = dest;
7127 return ret;
7130 /* ?_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 */
7131 /* ?_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 */
7132 ostreambuf_iterator_char* __cdecl num_put_char__Putgrouped(const num_put *this, ostreambuf_iterator_char *ret,
7133 ostreambuf_iterator_char dest, const char *ptr, MSVCP_size_t count, char delim)
7135 FIXME("(%p %p %p %ld %d) stub\n", this, ret, ptr, count, delim);
7136 return NULL;
7139 /* ?_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 */
7140 /* ?_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 */
7141 ostreambuf_iterator_char* __cdecl num_put_char__Rep(const num_put *this, ostreambuf_iterator_char *ret,
7142 ostreambuf_iterator_char dest, char c, MSVCP_size_t count)
7144 TRACE("(%p %p %d %ld)\n", this, ret, c, count);
7146 for(; count>0; count--)
7147 ostreambuf_iterator_char_put(&dest, c);
7149 *ret = dest;
7150 return ret;
7153 /* ?_Ffmt@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@ABAPADPADDH@Z */
7154 /* ?_Ffmt@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@AEBAPEADPEADDH@Z */
7155 char* __cdecl num_put_char__Ffmt(const num_put *this, char *fmt, char spec, int fmtfl)
7157 int type = fmtfl & FMTFLAG_floatfield;
7158 char *p = fmt;
7160 TRACE("(%p %p %d %d)\n", this, fmt, spec, fmtfl);
7162 *p++ = '%';
7163 if(fmtfl & FMTFLAG_showpos)
7164 *p++ = '+';
7165 if(fmtfl & FMTFLAG_showpoint)
7166 *p++ = '#';
7167 *p++ = '.';
7168 *p++ = '*';
7169 if(spec)
7170 *p++ = spec;
7172 if(type == FMTFLAG_fixed)
7173 *p++ = 'f';
7174 else if(type == FMTFLAG_scientific)
7175 *p++ = (fmtfl & FMTFLAG_uppercase) ? 'E' : 'e';
7176 else if(type == (FMTFLAG_fixed|FMTFLAG_scientific))
7177 *p++ = (fmtfl & FMTFLAG_uppercase) ? 'A' : 'a';
7178 else
7179 *p++ = (fmtfl & FMTFLAG_uppercase) ? 'G' : 'g';
7181 *p++ = '\0';
7182 return fmt;
7185 /* ?_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 */
7186 /* ?_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 */
7187 ostreambuf_iterator_char* __cdecl num_put_char__Fput(const num_put *this, ostreambuf_iterator_char *ret,
7188 ostreambuf_iterator_char dest, ios_base *base, char fill, const char *buf, MSVCP_size_t bef_point,
7189 MSVCP_size_t aft_point, MSVCP_size_t trailing, MSVCP_size_t count)
7191 FIXME("(%p %p %p %d %p %ld %ld %ld %ld) stub\n", this, ret, base,
7192 fill, buf, bef_point, aft_point, trailing, count);
7193 return NULL;
7196 /* TODO: This function should be removed when num_put_char__Fput is implemented */
7197 static ostreambuf_iterator_char* num_put_char_fput(const num_put *this, ostreambuf_iterator_char *ret,
7198 ostreambuf_iterator_char dest, ios_base *base, char fill, char *buf, MSVCP_size_t count)
7200 numpunct_char *numpunct = numpunct_char_use_facet(IOS_LOCALE(base));
7201 basic_string_char grouping_bstr;
7202 const char *grouping;
7203 char *p, sep = 0, dec_point = *localeconv()->decimal_point;
7204 int cur_group = 0, group_size = 0;
7205 int adjustfield = base->fmtfl & FMTFLAG_adjustfield;
7206 MSVCP_size_t pad;
7208 TRACE("(%p %p %p %d %s %ld)\n", this, ret, base, fill, buf, count);
7210 /* Change decimal point */
7211 for(p=buf; p<buf+count; p++) {
7212 if(*p == dec_point) {
7213 *p = numpunct_char_decimal_point(numpunct);
7214 break;
7217 p--;
7219 /* Add separators to number */
7220 numpunct_char_grouping(numpunct, &grouping_bstr);
7221 grouping = MSVCP_basic_string_char_c_str(&grouping_bstr);
7222 #if _MSVCP_VER >= 70
7223 if (grouping[0]) sep = numpunct_char_thousands_sep(numpunct);
7224 #endif
7226 for(; p>buf && sep && grouping[cur_group]!=CHAR_MAX; p--) {
7227 group_size++;
7228 if(group_size == grouping[cur_group]) {
7229 group_size = 0;
7230 if(grouping[cur_group+1])
7231 cur_group++;
7233 memmove(p+1, p, buf+count-p);
7234 *p = sep;
7235 count++;
7238 MSVCP_basic_string_char_dtor(&grouping_bstr);
7240 /* Display number with padding */
7241 if(count >= base->wide)
7242 pad = 0;
7243 else
7244 pad = base->wide-count;
7245 base->wide = 0;
7247 if((adjustfield & FMTFLAG_internal) && (buf[0]=='-' || buf[0]=='+')) {
7248 num_put_char__Putc(this, &dest, dest, buf, 1);
7249 buf++;
7251 if(adjustfield != FMTFLAG_left) {
7252 num_put_char__Rep(this, ret, dest, fill, pad);
7253 pad = 0;
7255 num_put_char__Putc(this, &dest, dest, buf, count);
7256 return num_put_char__Rep(this, ret, dest, fill, pad);
7259 /* ?_Ifmt@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@ABAPADPADPBDH@Z */
7260 /* ?_Ifmt@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@AEBAPEADPEADPEBDH@Z */
7261 char* __cdecl num_put_char__Ifmt(const num_put *this, char *fmt, const char *spec, int fmtfl)
7263 int base = fmtfl & FMTFLAG_basefield;
7264 char *p = fmt;
7266 TRACE("(%p %p %p %d)\n", this, fmt, spec, fmtfl);
7268 *p++ = '%';
7269 if(fmtfl & FMTFLAG_showpos)
7270 *p++ = '+';
7271 if(fmtfl & FMTFLAG_showbase)
7272 *p++ = '#';
7274 *p++ = *spec++;
7275 if(*spec == 'l')
7276 *p++ = *spec++;
7278 if(base == FMTFLAG_oct)
7279 *p++ = 'o';
7280 else if(base == FMTFLAG_hex)
7281 *p++ = (fmtfl & FMTFLAG_uppercase) ? 'X' : 'x';
7282 else
7283 *p++ = *spec;
7285 *p++ = '\0';
7286 return fmt;
7289 /* ?_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 */
7290 /* ?_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 */
7291 ostreambuf_iterator_char* __cdecl num_put_char__Iput(const num_put *this, ostreambuf_iterator_char *ret,
7292 ostreambuf_iterator_char dest, ios_base *base, char fill, char *buf, MSVCP_size_t count)
7294 numpunct_char *numpunct = numpunct_char_use_facet(IOS_LOCALE(base));
7295 basic_string_char grouping_bstr;
7296 const char *grouping;
7297 char *p, sep = 0;
7298 int cur_group = 0, group_size = 0;
7299 int adjustfield = base->fmtfl & FMTFLAG_adjustfield;
7300 MSVCP_size_t pad;
7302 TRACE("(%p %p %p %d %s %ld)\n", this, ret, base, fill, buf, count);
7304 /* Add separators to number */
7305 numpunct_char_grouping(numpunct, &grouping_bstr);
7306 grouping = MSVCP_basic_string_char_c_str(&grouping_bstr);
7307 #if _MSVCP_VER >= 70
7308 if (grouping[0]) sep = numpunct_char_thousands_sep(numpunct);
7309 #endif
7311 for(p=buf+count-1; p>buf && sep && grouping[cur_group]!=CHAR_MAX; p--) {
7312 group_size++;
7313 if(group_size == grouping[cur_group]) {
7314 group_size = 0;
7315 if(grouping[cur_group+1])
7316 cur_group++;
7318 memmove(p+1, p, buf+count-p);
7319 *p = sep;
7320 count++;
7323 MSVCP_basic_string_char_dtor(&grouping_bstr);
7325 /* Display number with padding */
7326 if(count >= base->wide)
7327 pad = 0;
7328 else
7329 pad = base->wide-count;
7330 base->wide = 0;
7332 if((adjustfield & FMTFLAG_internal) && (buf[0]=='-' || buf[0]=='+')) {
7333 num_put_char__Putc(this, &dest, dest, buf, 1);
7334 buf++;
7335 }else if((adjustfield & FMTFLAG_internal) && (buf[1]=='x' || buf[1]=='X')) {
7336 num_put_char__Putc(this, &dest, dest, buf, 2);
7337 buf += 2;
7339 if(adjustfield != FMTFLAG_left) {
7340 num_put_char__Rep(this, ret, dest, fill, pad);
7341 pad = 0;
7343 num_put_char__Putc(this, &dest, dest, buf, count);
7344 return num_put_char__Rep(this, ret, dest, fill, pad);
7347 /* ?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 */
7348 /* ?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 */
7349 #if _MSVCP_VER <= 100
7350 #define call_num_put_char_do_put_long(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 28, ostreambuf_iterator_char*, \
7351 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, LONG), \
7352 (this, ret, dest, base, fill, v))
7353 #else
7354 #define call_num_put_char_do_put_long(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 36, ostreambuf_iterator_char*, \
7355 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, LONG), \
7356 (this, ret, dest, base, fill, v))
7357 #endif
7358 #if _MSVCP_VER != 80
7359 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_long, 28)
7360 #else
7361 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_long, 32)
7362 #endif
7363 ostreambuf_iterator_char* __thiscall num_put_char_do_put_long(const num_put *this, ostreambuf_iterator_char *ret,
7364 ostreambuf_iterator_char dest, ios_base *base, char fill, LONG v)
7366 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
7367 char fmt[7]; /* strlen("%+#lld")+1 */
7369 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
7371 return num_put_char__Iput(this, ret, dest, base, fill, tmp,
7372 sprintf(tmp, num_put_char__Ifmt(this, fmt, "ld", base->fmtfl), v));
7375 /* ?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 */
7376 /* ?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 */
7377 #if _MSVCP_VER != 80
7378 DEFINE_THISCALL_WRAPPER(num_put_char_put_long, 28)
7379 #else
7380 DEFINE_THISCALL_WRAPPER(num_put_char_put_long, 32)
7381 #endif
7382 ostreambuf_iterator_char* __thiscall num_put_char_put_long(const num_put *this, ostreambuf_iterator_char *ret,
7383 ostreambuf_iterator_char dest, ios_base *base, char fill, LONG v)
7385 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
7386 return call_num_put_char_do_put_long(this, ret, dest, base, fill, v);
7389 /* ?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 */
7390 /* ?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 */
7391 #if _MSVCP_VER <= 100
7392 #define call_num_put_char_do_put_ulong(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 24, ostreambuf_iterator_char*, \
7393 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, ULONG), \
7394 (this, ret, dest, base, fill, v))
7395 #else
7396 #define call_num_put_char_do_put_ulong(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 32, ostreambuf_iterator_char*, \
7397 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, ULONG), \
7398 (this, ret, dest, base, fill, v))
7399 #endif
7400 #if _MSVCP_VER != 80
7401 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_ulong, 28)
7402 #else
7403 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_ulong, 32)
7404 #endif
7405 ostreambuf_iterator_char* __thiscall num_put_char_do_put_ulong(const num_put *this, ostreambuf_iterator_char *ret,
7406 ostreambuf_iterator_char dest, ios_base *base, char fill, ULONG v)
7408 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
7409 char fmt[7]; /* strlen("%+#lld")+1 */
7411 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
7413 return num_put_char__Iput(this, ret, dest, base, fill, tmp,
7414 sprintf(tmp, num_put_char__Ifmt(this, fmt, "lu", base->fmtfl), v));
7417 /* ?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 */
7418 /* ?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 */
7419 #if _MSVCP_VER != 80
7420 DEFINE_THISCALL_WRAPPER(num_put_char_put_ulong, 28)
7421 #else
7422 DEFINE_THISCALL_WRAPPER(num_put_char_put_ulong, 32)
7423 #endif
7424 ostreambuf_iterator_char* __thiscall num_put_char_put_ulong(const num_put *this, ostreambuf_iterator_char *ret,
7425 ostreambuf_iterator_char dest, ios_base *base, char fill, ULONG v)
7427 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
7428 return call_num_put_char_do_put_ulong(this, ret, dest, base, fill, v);
7431 static inline unsigned get_precision(const ios_base *base)
7433 streamsize ret = base->prec <= 0 && !(base->fmtfl & FMTFLAG_fixed) ? 6 : base->prec;
7434 if(ret > UINT_MAX)
7435 ret = UINT_MAX;
7436 return ret;
7439 /* ?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 */
7440 /* ?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 */
7441 /* ?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 */
7442 /* ?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 */
7443 #if _MSVCP_VER <= 100
7444 #define call_num_put_char_do_put_double(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 12, ostreambuf_iterator_char*, \
7445 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, double), \
7446 (this, ret, dest, base, fill, v))
7447 #define call_num_put_char_do_put_ldouble(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 8, ostreambuf_iterator_char*, \
7448 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, double), \
7449 (this, ret, dest, base, fill, v))
7450 #else
7451 #define call_num_put_char_do_put_double(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 20, ostreambuf_iterator_char*, \
7452 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, double), \
7453 (this, ret, dest, base, fill, v))
7454 #define call_num_put_char_do_put_ldouble(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 16, ostreambuf_iterator_char*, \
7455 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, double), \
7456 (this, ret, dest, base, fill, v))
7457 #endif
7458 #if _MSVCP_VER != 80
7459 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_double, 32)
7460 #else
7461 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_double, 36)
7462 #endif
7463 ostreambuf_iterator_char* __thiscall num_put_char_do_put_double(const num_put *this, ostreambuf_iterator_char *ret,
7464 ostreambuf_iterator_char dest, ios_base *base, char fill, double v)
7466 char *tmp;
7467 char fmt[8]; /* strlen("%+#.*lg")+1 */
7468 int size;
7469 unsigned prec;
7471 TRACE("(%p %p %p %d %lf)\n", this, ret, base, fill, v);
7473 num_put_char__Ffmt(this, fmt, '\0', base->fmtfl);
7474 prec = get_precision(base);
7475 size = _scprintf(fmt, prec, v);
7477 /* TODO: don't use dynamic allocation */
7478 tmp = MSVCRT_operator_new(size*2);
7479 if(!tmp) {
7480 ERR("Out of memory\n");
7481 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7483 num_put_char_fput(this, ret, dest, base, fill, tmp, sprintf(tmp, fmt, prec, v));
7484 MSVCRT_operator_delete(tmp);
7485 return ret;
7488 /* ?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 */
7489 /* ?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 */
7490 #if _MSVCP_VER != 80
7491 DEFINE_THISCALL_WRAPPER(num_put_char_put_double, 32)
7492 #else
7493 DEFINE_THISCALL_WRAPPER(num_put_char_put_double, 36)
7494 #endif
7495 ostreambuf_iterator_char* __thiscall num_put_char_put_double(const num_put *this, ostreambuf_iterator_char *ret,
7496 ostreambuf_iterator_char dest, ios_base *base, char fill, double v)
7498 TRACE("(%p %p %p %d %lf)\n", this, ret, base, fill, v);
7499 return call_num_put_char_do_put_double(this, ret, dest, base, fill, v);
7502 /* ?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 */
7503 /* ?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 */
7504 #if _MSVCP_VER != 80
7505 DEFINE_THISCALL_WRAPPER(num_put_char_put_ldouble, 32)
7506 #else
7507 DEFINE_THISCALL_WRAPPER(num_put_char_put_ldouble, 36)
7508 #endif
7509 ostreambuf_iterator_char* __thiscall num_put_char_put_ldouble(const num_put *this, ostreambuf_iterator_char *ret,
7510 ostreambuf_iterator_char dest, ios_base *base, char fill, double v)
7512 TRACE("(%p %p %p %d %lf)\n", this, ret, base, fill, v);
7513 return call_num_put_char_do_put_ldouble(this, ret, dest, base, fill, v);
7516 /* ?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 */
7517 /* ?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 */
7518 #if _MSVCP_VER <= 100
7519 #define call_num_put_char_do_put_ptr(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 4, ostreambuf_iterator_char*, \
7520 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, const void*), \
7521 (this, ret, dest, base, fill, v))
7522 #else
7523 #define call_num_put_char_do_put_ptr(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 12, ostreambuf_iterator_char*, \
7524 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, const void*), \
7525 (this, ret, dest, base, fill, v))
7526 #endif
7527 #if _MSVCP_VER != 80
7528 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_ptr, 28)
7529 #else
7530 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_ptr, 32)
7531 #endif
7532 ostreambuf_iterator_char* __thiscall num_put_char_do_put_ptr(const num_put *this, ostreambuf_iterator_char *ret,
7533 ostreambuf_iterator_char dest, ios_base *base, char fill, const void *v)
7535 char tmp[17]; /* 8(16^8==2^64)*2(separators beetwen every digit) + 1 */
7537 TRACE("(%p %p %p %d %p)\n", this, ret, base, fill, v);
7539 return num_put_char__Iput(this, ret, dest, base, fill, tmp, sprintf(tmp, "%p", v));
7542 /* ?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 */
7543 /* ?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 */
7544 #if _MSVCP_VER != 80
7545 DEFINE_THISCALL_WRAPPER(num_put_char_put_ptr, 28)
7546 #else
7547 DEFINE_THISCALL_WRAPPER(num_put_char_put_ptr, 32)
7548 #endif
7549 ostreambuf_iterator_char* __thiscall num_put_char_put_ptr(const num_put *this, ostreambuf_iterator_char *ret,
7550 ostreambuf_iterator_char dest, ios_base *base, char fill, const void *v)
7552 TRACE("(%p %p %p %d %p)\n", this, ret, base, fill, v);
7553 return call_num_put_char_do_put_ptr(this, ret, dest, base, fill, v);
7556 /* ?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 */
7557 /* ?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 */
7558 #if _MSVCP_VER <= 100
7559 #define call_num_put_char_do_put_int64(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 20, ostreambuf_iterator_char*, \
7560 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, __int64), \
7561 (this, ret, dest, base, fill, v))
7562 #else
7563 #define call_num_put_char_do_put_int64(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 28, ostreambuf_iterator_char*, \
7564 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, __int64), \
7565 (this, ret, dest, base, fill, v))
7566 #endif
7567 #if _MSVCP_VER != 80
7568 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_int64, 32)
7569 #else
7570 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_int64, 36)
7571 #endif
7572 ostreambuf_iterator_char* __thiscall num_put_char_do_put_int64(const num_put *this, ostreambuf_iterator_char *ret,
7573 ostreambuf_iterator_char dest, ios_base *base, char fill, __int64 v)
7575 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
7576 char fmt[7]; /* strlen("%+#lld")+1 */
7578 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
7580 return num_put_char__Iput(this, ret, dest, base, fill, tmp,
7581 sprintf(tmp, num_put_char__Ifmt(this, fmt, "lld", base->fmtfl), v));
7584 /* ?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 */
7585 /* ?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 */
7586 #if _MSVCP_VER != 80
7587 DEFINE_THISCALL_WRAPPER(num_put_char_put_int64, 32)
7588 #else
7589 DEFINE_THISCALL_WRAPPER(num_put_char_put_int64, 36)
7590 #endif
7591 ostreambuf_iterator_char* __thiscall num_put_char_put_int64(const num_put *this, ostreambuf_iterator_char *ret,
7592 ostreambuf_iterator_char dest, ios_base *base, char fill, __int64 v)
7594 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
7595 return call_num_put_char_do_put_int64(this, ret, dest, base, fill, v);
7598 /* ?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 */
7599 /* ?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 */
7600 #if _MSVCP_VER <= 100
7601 #define call_num_put_char_do_put_uint64(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 16, ostreambuf_iterator_char*, \
7602 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, unsigned __int64), \
7603 (this, ret, dest, base, fill, v))
7604 #else
7605 #define call_num_put_char_do_put_uint64(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 24, ostreambuf_iterator_char*, \
7606 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, unsigned __int64), \
7607 (this, ret, dest, base, fill, v))
7608 #endif
7609 #if _MSVCP_VER != 80
7610 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_uint64, 32)
7611 #else
7612 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_uint64, 36)
7613 #endif
7614 ostreambuf_iterator_char* __thiscall num_put_char_do_put_uint64(const num_put *this, ostreambuf_iterator_char *ret,
7615 ostreambuf_iterator_char dest, ios_base *base, char fill, unsigned __int64 v)
7617 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
7618 char fmt[7]; /* strlen("%+#lld")+1 */
7620 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
7622 return num_put_char__Iput(this, ret, dest, base, fill, tmp,
7623 sprintf(tmp, num_put_char__Ifmt(this, fmt, "llu", base->fmtfl), v));
7626 /* ?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 */
7627 /* ?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 */
7628 #if _MSVCP_VER != 80
7629 DEFINE_THISCALL_WRAPPER(num_put_char_put_uint64, 32)
7630 #else
7631 DEFINE_THISCALL_WRAPPER(num_put_char_put_uint64, 36)
7632 #endif
7633 ostreambuf_iterator_char* __thiscall num_put_char_put_uint64(const num_put *this, ostreambuf_iterator_char *ret,
7634 ostreambuf_iterator_char dest, ios_base *base, char fill, unsigned __int64 v)
7636 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
7637 return call_num_put_char_do_put_uint64(this, ret, dest, base, fill, v);
7640 /* ?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 */
7641 /* ?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 */
7642 #if _MSVCP_VER <= 100
7643 #define call_num_put_char_do_put_bool(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 32, ostreambuf_iterator_char*, \
7644 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, MSVCP_bool), \
7645 (this, ret, dest, base, fill, v))
7646 #else
7647 #define call_num_put_char_do_put_bool(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 40, ostreambuf_iterator_char*, \
7648 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, MSVCP_bool), \
7649 (this, ret, dest, base, fill, v))
7650 #endif
7651 #if _MSVCP_VER != 80
7652 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_bool, 28)
7653 #else
7654 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_bool, 32)
7655 #endif
7656 ostreambuf_iterator_char* __thiscall num_put_char_do_put_bool(const num_put *this, ostreambuf_iterator_char *ret,
7657 ostreambuf_iterator_char dest, ios_base *base, char fill, MSVCP_bool v)
7659 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
7661 if(base->fmtfl & FMTFLAG_boolalpha) {
7662 numpunct_char *numpunct = numpunct_char_use_facet(IOS_LOCALE(base));
7663 basic_string_char str;
7664 MSVCP_size_t pad, len;
7666 if(v)
7667 numpunct_char_truename(numpunct, &str);
7668 else
7669 numpunct_char_falsename(numpunct, &str);
7671 len = MSVCP_basic_string_char_length(&str);
7672 pad = (len>base->wide ? 0 : base->wide-len);
7673 base->wide = 0;
7675 if((base->fmtfl & FMTFLAG_adjustfield) != FMTFLAG_left) {
7676 num_put_char__Rep(this, &dest, dest, fill, pad);
7677 pad = 0;
7679 num_put_char__Putc(this, &dest, dest, MSVCP_basic_string_char_c_str(&str), len);
7680 MSVCP_basic_string_char_dtor(&str);
7681 return num_put_char__Rep(this, ret, dest, fill, pad);
7684 return num_put_char_put_long(this, ret, dest, base, fill, v);
7687 /* ?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 */
7688 /* ?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 */
7689 #if _MSVCP_VER != 80
7690 DEFINE_THISCALL_WRAPPER(num_put_char_put_bool, 28)
7691 #else
7692 DEFINE_THISCALL_WRAPPER(num_put_char_put_bool, 32)
7693 #endif
7694 ostreambuf_iterator_char* __thiscall num_put_char_put_bool(const num_put *this, ostreambuf_iterator_char *ret,
7695 ostreambuf_iterator_char dest, ios_base *base, char fill, MSVCP_bool v)
7697 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
7698 return call_num_put_char_do_put_bool(this, ret, dest, base, fill, v);
7701 /* ?id@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@2V0locale@2@A */
7702 locale_id num_put_wchar_id = {0};
7703 /* ?id@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@2V0locale@2@A */
7704 locale_id num_put_short_id = {0};
7706 /* num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@6B@ */
7707 extern const vtable_ptr MSVCP_num_put_wchar_vtable;
7708 /* num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@6B@ */
7709 extern const vtable_ptr MSVCP_num_put_short_vtable;
7711 /* ?_Init@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@IAEXABV_Locinfo@2@@Z */
7712 /* ?_Init@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@IEAAXAEBV_Locinfo@2@@Z */
7713 DEFINE_THISCALL_WRAPPER(num_put_wchar__Init, 8)
7714 void __thiscall num_put_wchar__Init(num_put *this, const _Locinfo *locinfo)
7716 TRACE("(%p %p)\n", this, locinfo);
7717 _Locinfo__Getcvt(locinfo, &this->cvt);
7720 /* ??0?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
7721 /* ??0?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
7722 DEFINE_THISCALL_WRAPPER(num_put_wchar_ctor_locinfo, 12)
7723 num_put* __thiscall num_put_wchar_ctor_locinfo(num_put *this, const _Locinfo *locinfo, MSVCP_size_t refs)
7725 TRACE("(%p %p %ld)\n", this, locinfo, refs);
7727 locale_facet_ctor_refs(&this->facet, refs);
7728 this->facet.vtable = &MSVCP_num_put_wchar_vtable;
7730 num_put_wchar__Init(this, locinfo);
7731 return this;
7734 /* ??0?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
7735 /* ??0?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
7736 DEFINE_THISCALL_WRAPPER(num_put_short_ctor_locinfo, 12)
7737 num_put* __thiscall num_put_short_ctor_locinfo(num_put *this, const _Locinfo *locinfo, MSVCP_size_t refs)
7739 num_put_wchar_ctor_locinfo(this, locinfo, refs);
7740 this->facet.vtable = &MSVCP_num_put_short_vtable;
7741 return this;
7744 /* ??0?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAE@I@Z */
7745 /* ??0?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAA@_K@Z */
7746 DEFINE_THISCALL_WRAPPER(num_put_wchar_ctor_refs, 8)
7747 num_put* __thiscall num_put_wchar_ctor_refs(num_put *this, MSVCP_size_t refs)
7749 _Locinfo locinfo;
7751 TRACE("(%p %lu)\n", this, refs);
7753 _Locinfo_ctor(&locinfo);
7754 num_put_wchar_ctor_locinfo(this, &locinfo, refs);
7755 _Locinfo_dtor(&locinfo);
7756 return this;
7759 /* ??0?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAE@I@Z */
7760 /* ??0?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEAA@_K@Z */
7761 DEFINE_THISCALL_WRAPPER(num_put_short_ctor_refs, 8)
7762 num_put* __thiscall num_put_short_ctor_refs(num_put *this, MSVCP_size_t refs)
7764 num_put_wchar_ctor_refs(this, refs);
7765 this->facet.vtable = &MSVCP_num_put_short_vtable;
7766 return this;
7769 /* ??_F?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAEXXZ */
7770 /* ??_F?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAAXXZ */
7771 DEFINE_THISCALL_WRAPPER(num_put_wchar_ctor, 4)
7772 num_put* __thiscall num_put_wchar_ctor(num_put *this)
7774 return num_put_wchar_ctor_refs(this, 0);
7777 /* ??_F?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAEXXZ */
7778 /* ??_F?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEAAXXZ */
7779 DEFINE_THISCALL_WRAPPER(num_put_short_ctor, 4)
7780 num_put* __thiscall num_put_short_ctor(num_put *this)
7782 return num_put_short_ctor_refs(this, 0);
7785 /* ??1?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@UAE@XZ */
7786 /* ??1?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@UEAA@XZ */
7787 /* ??1?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MAE@XZ */
7788 /* ??1?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MEAA@XZ */
7789 /* ??1?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MAE@XZ */
7790 /* ??1?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MEAA@XZ */
7791 DEFINE_THISCALL_WRAPPER(num_put_wchar_dtor, 4)
7792 void __thiscall num_put_wchar_dtor(num_put *this)
7794 TRACE("(%p)\n", this);
7795 locale_facet_dtor(&this->facet);
7798 DEFINE_THISCALL_WRAPPER(num_put_wchar_vector_dtor, 8)
7799 num_put* __thiscall num_put_wchar_vector_dtor(num_put *this, unsigned int flags)
7801 TRACE("(%p %x)\n", this, flags);
7802 if(flags & 2) {
7803 /* we have an array, with the number of elements stored before the first object */
7804 INT_PTR i, *ptr = (INT_PTR *)this-1;
7806 for(i=*ptr-1; i>=0; i--)
7807 num_put_wchar_dtor(this+i);
7808 MSVCRT_operator_delete(ptr);
7809 } else {
7810 num_put_wchar_dtor(this);
7811 if(flags & 1)
7812 MSVCRT_operator_delete(this);
7815 return this;
7818 /* ?_Getcat@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
7819 /* ?_Getcat@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
7820 MSVCP_size_t __cdecl num_put_wchar__Getcat(const locale_facet **facet, const locale *loc)
7822 TRACE("(%p %p)\n", facet, loc);
7824 if(facet && !*facet) {
7825 _Locinfo locinfo;
7827 *facet = MSVCRT_operator_new(sizeof(num_put));
7828 if(!*facet) {
7829 ERR("Out of memory\n");
7830 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7831 return 0;
7834 _Locinfo_ctor_cstr(&locinfo, locale_string_char_c_str(&loc->ptr->name));
7835 num_put_wchar_ctor_locinfo((num_put*)*facet, &locinfo, 0);
7836 _Locinfo_dtor(&locinfo);
7839 return LC_NUMERIC;
7842 /* ?_Getcat@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SAIPAPBVfacet@locale@2@@Z */
7843 /* ?_Getcat@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@@Z */
7844 MSVCP_size_t __cdecl num_put_wchar__Getcat_old(const locale_facet **facet)
7846 return num_put_wchar__Getcat(facet, locale_classic());
7849 /* ?_Getcat@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
7850 /* ?_Getcat@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
7851 MSVCP_size_t __cdecl num_put_short__Getcat(const locale_facet **facet, const locale *loc)
7853 TRACE("(%p %p)\n", facet, loc);
7855 if(facet && !*facet) {
7856 _Locinfo locinfo;
7858 *facet = MSVCRT_operator_new(sizeof(num_put));
7859 if(!*facet) {
7860 ERR("Out of memory\n");
7861 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7862 return 0;
7865 _Locinfo_ctor_cstr(&locinfo, locale_string_char_c_str(&loc->ptr->name));
7866 num_put_short_ctor_locinfo((num_put*)*facet, &locinfo, 0);
7867 _Locinfo_dtor(&locinfo);
7870 return LC_NUMERIC;
7873 /* ?_Getcat@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SAIPAPBVfacet@locale@2@@Z */
7874 /* ?_Getcat@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@@Z */
7875 MSVCP_size_t __cdecl num_put_short__Getcat_old(const locale_facet **facet)
7877 return num_put_short__Getcat(facet, locale_classic());
7880 num_put* num_put_wchar_use_facet(const locale *loc)
7882 static num_put *obj = NULL;
7884 _Lockit lock;
7885 const locale_facet *fac;
7887 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
7888 fac = locale__Getfacet(loc, locale_id_operator_size_t(&num_put_wchar_id));
7889 if(fac) {
7890 _Lockit_dtor(&lock);
7891 return (num_put*)fac;
7894 if(obj) {
7895 _Lockit_dtor(&lock);
7896 return obj;
7899 num_put_wchar__Getcat(&fac, loc);
7900 obj = (num_put*)fac;
7901 call_locale_facet__Incref(&obj->facet);
7902 locale_facet_register(&obj->facet);
7903 _Lockit_dtor(&lock);
7905 return obj;
7908 num_put* num_put_short_use_facet(const locale *loc)
7910 static num_put *obj = NULL;
7912 _Lockit lock;
7913 const locale_facet *fac;
7915 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
7916 fac = locale__Getfacet(loc, locale_id_operator_size_t(&num_put_short_id));
7917 if(fac) {
7918 _Lockit_dtor(&lock);
7919 return (num_put*)fac;
7922 if(obj) {
7923 _Lockit_dtor(&lock);
7924 return obj;
7927 num_put_short__Getcat(&fac, loc);
7928 obj = (num_put*)fac;
7929 call_locale_facet__Incref(&obj->facet);
7930 locale_facet_register(&obj->facet);
7931 _Lockit_dtor(&lock);
7933 return obj;
7936 /* ?_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 */
7937 /* ?_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 */
7938 /* ?_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 */
7939 /* ?_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 */
7940 ostreambuf_iterator_wchar* __cdecl num_put_wchar__Put(const num_put *this, ostreambuf_iterator_wchar *ret,
7941 ostreambuf_iterator_wchar dest, const wchar_t *ptr, MSVCP_size_t count)
7943 TRACE("(%p %p %s %ld)\n", this, ret, debugstr_wn(ptr, count), count);
7945 for(; count>0; count--)
7946 ostreambuf_iterator_wchar_put(&dest, *ptr++);
7948 *ret = dest;
7949 return ret;
7952 /* ?_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 */
7953 /* ?_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 */
7954 /* ?_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 */
7955 /* ?_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 */
7956 ostreambuf_iterator_wchar* __cdecl num_put_wchar__Putc(const num_put *this, ostreambuf_iterator_wchar *ret,
7957 ostreambuf_iterator_wchar dest, const char *ptr, MSVCP_size_t count)
7959 int state = 0;
7960 wchar_t ch;
7962 TRACE("(%p %p %s %ld)\n", this, ret, debugstr_an(ptr, count), count);
7964 for(; count>0; count--) {
7965 if(_Mbrtowc(&ch, ptr++, 1, &state, &this->cvt) == 1)
7966 ostreambuf_iterator_wchar_put(&dest, ch);
7969 *ret = dest;
7970 return ret;
7973 /* ?_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 */
7974 /* ?_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 */
7975 /* ?_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 */
7976 /* ?_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 */
7977 ostreambuf_iterator_wchar* __cdecl num_put_wchar__Putgrouped(const num_put *this, ostreambuf_iterator_wchar *ret,
7978 ostreambuf_iterator_wchar dest, const char *ptr, MSVCP_size_t count, wchar_t delim)
7980 FIXME("(%p %p %p %ld %d) stub\n", this, ret, ptr, count, delim);
7981 return NULL;
7984 /* ?_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 */
7985 /* ?_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 */
7986 /* ?_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 */
7987 /* ?_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 */
7988 ostreambuf_iterator_wchar* __cdecl num_put_wchar__Rep(const num_put *this, ostreambuf_iterator_wchar *ret,
7989 ostreambuf_iterator_wchar dest, wchar_t c, MSVCP_size_t count)
7991 TRACE("(%p %p %d %ld)\n", this, ret, c, count);
7993 for(; count>0; count--)
7994 ostreambuf_iterator_wchar_put(&dest, c);
7996 *ret = dest;
7997 return ret;
8000 /* ?_Ffmt@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@ABAPADPADDH@Z */
8001 /* ?_Ffmt@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@AEBAPEADPEADDH@Z */
8002 /* ?_Ffmt@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@ABAPADPADDH@Z */
8003 /* ?_Ffmt@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@AEBAPEADPEADDH@Z */
8004 char* __cdecl num_put_wchar__Ffmt(const num_put *this, char *fmt, char spec, int fmtfl)
8006 int type = fmtfl & FMTFLAG_floatfield;
8007 char *p = fmt;
8009 TRACE("(%p %p %d %d)\n", this, fmt, spec, fmtfl);
8011 *p++ = '%';
8012 if(fmtfl & FMTFLAG_showpos)
8013 *p++ = '+';
8014 if(fmtfl & FMTFLAG_showbase)
8015 *p++ = '#';
8016 *p++ = '.';
8017 *p++ = '*';
8018 if(spec)
8019 *p++ = spec;
8021 if(type == FMTFLAG_fixed)
8022 *p++ = 'f';
8023 else if(type == FMTFLAG_scientific)
8024 *p++ = (fmtfl & FMTFLAG_uppercase) ? 'E' : 'e';
8025 else if(type == (FMTFLAG_fixed|FMTFLAG_scientific))
8026 *p++ = (fmtfl & FMTFLAG_uppercase) ? 'A' : 'a';
8027 else
8028 *p++ = (fmtfl & FMTFLAG_uppercase) ? 'G' : 'g';
8030 *p++ = '\0';
8031 return fmt;
8034 /* ?_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 */
8035 /* ?_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 */
8036 ostreambuf_iterator_wchar* __cdecl num_put_wchar__Fput(const num_put *this, ostreambuf_iterator_wchar *ret,
8037 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, const char *buf, MSVCP_size_t bef_point,
8038 MSVCP_size_t aft_point, MSVCP_size_t trailing, MSVCP_size_t count)
8040 FIXME("(%p %p %p %d %p %ld %ld %ld %ld) stub\n", this, ret, base,
8041 fill, buf, bef_point, aft_point, trailing, count);
8042 return NULL;
8045 /* ?_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 */
8046 /* ?_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 */
8047 ostreambuf_iterator_wchar* __cdecl num_put_short__Fput(const num_put *this, ostreambuf_iterator_wchar *ret,
8048 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, const char *buf, MSVCP_size_t bef_point,
8049 MSVCP_size_t aft_point, MSVCP_size_t trailing, MSVCP_size_t count)
8051 FIXME("(%p %p %p %d %p %ld %ld %ld %ld) stub\n", this, ret, base,
8052 fill, buf, bef_point, aft_point, trailing, count);
8053 return NULL;
8056 /* TODO: This function should be removed when num_put_wchar__Fput is implemented */
8057 static ostreambuf_iterator_wchar* num_put__fput(const num_put *this, ostreambuf_iterator_wchar *ret,
8058 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, char *buf,
8059 MSVCP_size_t count, numpunct_wchar *numpunct)
8061 basic_string_char grouping_bstr;
8062 const char *grouping;
8063 char *p, dec_point = *localeconv()->decimal_point;
8064 wchar_t sep = 0;
8065 int cur_group = 0, group_size = 0;
8066 int adjustfield = base->fmtfl & FMTFLAG_adjustfield;
8067 MSVCP_size_t i, pad;
8069 TRACE("(%p %p %p %d %s %ld)\n", this, ret, base, fill, buf, count);
8071 for(p=buf; p<buf+count; p++) {
8072 if(*p == dec_point)
8073 break;
8075 p--;
8077 /* Add separators to number */
8078 numpunct_wchar_grouping(numpunct, &grouping_bstr);
8079 grouping = MSVCP_basic_string_char_c_str(&grouping_bstr);
8080 #if _MSVCP_VER >= 70
8081 if (grouping[0]) sep = numpunct_wchar_thousands_sep(numpunct);
8082 #endif
8084 for(; p>buf && sep && grouping[cur_group]!=CHAR_MAX; p--) {
8085 group_size++;
8086 if(group_size == grouping[cur_group]) {
8087 group_size = 0;
8088 if(grouping[cur_group+1])
8089 cur_group++;
8091 memmove(p+1, p, buf+count-p);
8092 *p = '\0'; /* mark thousands separator positions */
8093 count++;
8096 MSVCP_basic_string_char_dtor(&grouping_bstr);
8098 /* Display number with padding */
8099 if(count >= base->wide)
8100 pad = 0;
8101 else
8102 pad = base->wide-count;
8103 base->wide = 0;
8105 if((adjustfield & FMTFLAG_internal) && (buf[0]=='-' || buf[0]=='+')) {
8106 num_put_wchar__Putc(this, &dest, dest, buf, 1);
8107 buf++;
8109 if(adjustfield != FMTFLAG_left) {
8110 num_put_wchar__Rep(this, ret, dest, fill, pad);
8111 pad = 0;
8114 for(i=0; i<count; i++) {
8115 if(buf[i] == dec_point)
8116 num_put_wchar__Rep(this, &dest, dest, numpunct_wchar_decimal_point(numpunct), 1);
8117 else if(!buf[i])
8118 num_put_wchar__Rep(this, &dest, dest, sep, 1);
8119 else
8120 num_put_wchar__Putc(this, &dest, dest, buf+i, 1);
8123 return num_put_wchar__Rep(this, ret, dest, fill, pad);
8126 /* ?_Ifmt@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@ABAPADPADPBDH@Z */
8127 /* ?_Ifmt@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@AEBAPEADPEADPEBDH@Z */
8128 /* ?_Ifmt@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@ABAPADPADPBDH@Z */
8129 /* ?_Ifmt@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@AEBAPEADPEADPEBDH@Z */
8130 char* __cdecl num_put_wchar__Ifmt(const num_put *this, char *fmt, const char *spec, int fmtfl)
8132 int base = fmtfl & FMTFLAG_basefield;
8133 char *p = fmt;
8135 TRACE("(%p %p %p %d)\n", this, fmt, spec, fmtfl);
8137 *p++ = '%';
8138 if(fmtfl & FMTFLAG_showpos)
8139 *p++ = '+';
8140 if(fmtfl & FMTFLAG_showbase)
8141 *p++ = '#';
8143 *p++ = *spec++;
8144 if(*spec == 'l')
8145 *p++ = *spec++;
8147 if(base == FMTFLAG_oct)
8148 *p++ = 'o';
8149 else if(base == FMTFLAG_hex)
8150 *p++ = (fmtfl & FMTFLAG_uppercase) ? 'X' : 'x';
8151 else
8152 *p++ = *spec;
8154 *p++ = '\0';
8155 return fmt;
8158 static ostreambuf_iterator_wchar* num_put__Iput(const num_put *this, ostreambuf_iterator_wchar *ret,
8159 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, char *buf,
8160 MSVCP_size_t count, numpunct_wchar *numpunct)
8162 basic_string_char grouping_bstr;
8163 const char *grouping;
8164 char *p;
8165 wchar_t sep;
8166 int cur_group = 0, group_size = 0;
8167 int adjustfield = base->fmtfl & FMTFLAG_adjustfield;
8168 MSVCP_size_t i, pad;
8170 TRACE("(%p %p %p %d %s %ld)\n", this, ret, base, fill, buf, count);
8172 /* Add separators to number */
8173 numpunct_wchar_grouping(numpunct, &grouping_bstr);
8174 grouping = MSVCP_basic_string_char_c_str(&grouping_bstr);
8175 sep = grouping[0] ? numpunct_wchar_thousands_sep(numpunct) : '\0';
8177 for(p=buf+count-1; p>buf && sep && grouping[cur_group]!=CHAR_MAX; p--) {
8178 group_size++;
8179 if(group_size == grouping[cur_group]) {
8180 group_size = 0;
8181 if(grouping[cur_group+1])
8182 cur_group++;
8184 memmove(p+1, p, buf+count-p);
8185 *p = '\0'; /* mark thousands separator positions */
8186 count++;
8189 MSVCP_basic_string_char_dtor(&grouping_bstr);
8191 /* Display number with padding */
8192 if(count >= base->wide)
8193 pad = 0;
8194 else
8195 pad = base->wide-count;
8196 base->wide = 0;
8198 if((adjustfield & FMTFLAG_internal) && (buf[0]=='-' || buf[0]=='+')) {
8199 num_put_wchar__Putc(this, &dest, dest, buf, 1);
8200 buf++;
8201 }else if((adjustfield & FMTFLAG_internal) && (buf[1]=='x' || buf[1]=='X')) {
8202 num_put_wchar__Putc(this, &dest, dest, buf, 2);
8203 buf += 2;
8205 if(adjustfield != FMTFLAG_left) {
8206 num_put_wchar__Rep(this, ret, dest, fill, pad);
8207 pad = 0;
8210 for(i=0; i<count; i++) {
8211 if(!buf[i])
8212 num_put_wchar__Rep(this, &dest, dest, sep, 1);
8213 else
8214 num_put_wchar__Putc(this, &dest, dest, buf+i, 1);
8217 return num_put_wchar__Rep(this, ret, dest, fill, pad);
8220 /* ?_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 */
8221 /* ?_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 */
8222 ostreambuf_iterator_wchar* __cdecl num_put_wchar__Iput(const num_put *this, ostreambuf_iterator_wchar *ret,
8223 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, char *buf, MSVCP_size_t count)
8225 return num_put__Iput(this, ret, dest, base, fill, buf, count, numpunct_wchar_use_facet(IOS_LOCALE(base)));
8228 /* ?_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 */
8229 /* ?_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 */
8230 ostreambuf_iterator_wchar* __cdecl num_put_short__Iput(const num_put *this, ostreambuf_iterator_wchar *ret,
8231 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, char *buf, MSVCP_size_t count)
8233 return num_put__Iput(this, ret, dest, base, fill, buf, count, numpunct_short_use_facet(IOS_LOCALE(base)));
8236 /* ?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 */
8237 /* ?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 */
8238 #if _MSVCP_VER <= 100
8239 #define call_num_put_wchar_do_put_long(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 28, ostreambuf_iterator_wchar*, \
8240 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, LONG), \
8241 (this, ret, dest, base, fill, v))
8242 #else
8243 #define call_num_put_wchar_do_put_long(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 36, ostreambuf_iterator_wchar*, \
8244 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, LONG), \
8245 (this, ret, dest, base, fill, v))
8246 #endif
8247 #if _MSVCP_VER != 80
8248 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_long, 28)
8249 #else
8250 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_long, 32)
8251 #endif
8252 ostreambuf_iterator_wchar* __thiscall num_put_wchar_do_put_long(const num_put *this, ostreambuf_iterator_wchar *ret,
8253 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, LONG 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_wchar__Iput(this, ret, dest, base, fill, tmp,
8261 sprintf(tmp, num_put_wchar__Ifmt(this, fmt, "ld", base->fmtfl), v));
8264 /* ?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 */
8265 /* ?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 */
8266 #if _MSVCP_VER != 80
8267 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_long, 28)
8268 #else
8269 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_long, 32)
8270 #endif
8271 ostreambuf_iterator_wchar* __thiscall num_put_short_do_put_long(const num_put *this, ostreambuf_iterator_wchar *ret,
8272 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, LONG v)
8274 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
8275 char fmt[7]; /* strlen("%+#lld")+1 */
8277 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
8279 return num_put_short__Iput(this, ret, dest, base, fill, tmp,
8280 sprintf(tmp, num_put_wchar__Ifmt(this, fmt, "ld", base->fmtfl), v));
8283 /* ?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 */
8284 /* ?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 */
8285 /* ?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 */
8286 /* ?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 */
8287 #if _MSVCP_VER != 80
8288 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_long, 28)
8289 #else
8290 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_long, 32)
8291 #endif
8292 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_long(const num_put *this, ostreambuf_iterator_wchar *ret,
8293 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, LONG v)
8295 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
8296 return call_num_put_wchar_do_put_long(this, ret, dest, base, fill, v);
8299 /* ?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 */
8300 /* ?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 */
8301 #if _MSVCP_VER <= 100
8302 #define call_num_put_wchar_do_put_ulong(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 24, ostreambuf_iterator_wchar*, \
8303 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, ULONG), \
8304 (this, ret, dest, base, fill, v))
8305 #else
8306 #define call_num_put_wchar_do_put_ulong(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 32, ostreambuf_iterator_wchar*, \
8307 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, ULONG), \
8308 (this, ret, dest, base, fill, v))
8309 #endif
8310 #if _MSVCP_VER != 80
8311 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_ulong, 28)
8312 #else
8313 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_ulong, 32)
8314 #endif
8315 ostreambuf_iterator_wchar* __thiscall num_put_wchar_do_put_ulong(const num_put *this, ostreambuf_iterator_wchar *ret,
8316 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, ULONG v)
8318 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
8319 char fmt[7]; /* strlen("%+#lld")+1 */
8321 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
8323 return num_put_wchar__Iput(this, ret, dest, base, fill, tmp,
8324 sprintf(tmp, num_put_wchar__Ifmt(this, fmt, "lu", base->fmtfl), v));
8327 /* ?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 */
8328 /* ?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 */
8329 #if _MSVCP_VER != 80
8330 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_ulong, 28)
8331 #else
8332 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_ulong, 32)
8333 #endif
8334 ostreambuf_iterator_wchar* __thiscall num_put_short_do_put_ulong(const num_put *this, ostreambuf_iterator_wchar *ret,
8335 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, ULONG v)
8337 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
8338 char fmt[7]; /* strlen("%+#lld")+1 */
8340 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
8342 return num_put_short__Iput(this, ret, dest, base, fill, tmp,
8343 sprintf(tmp, num_put_wchar__Ifmt(this, fmt, "lu", base->fmtfl), v));
8346 /* ?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 */
8347 /* ?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 */
8348 /* ?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 */
8349 /* ?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 */
8350 #if _MSVCP_VER != 80
8351 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_ulong, 28)
8352 #else
8353 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_ulong, 32)
8354 #endif
8355 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_ulong(const num_put *this, ostreambuf_iterator_wchar *ret,
8356 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, ULONG v)
8358 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
8359 return call_num_put_wchar_do_put_ulong(this, ret, dest, base, fill, v);
8362 /* ?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 */
8363 /* ?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 */
8364 /* ?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 */
8365 /* ?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 */
8366 #if _MSVCP_VER <= 100
8367 #define call_num_put_wchar_do_put_double(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 12, ostreambuf_iterator_wchar*, \
8368 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, double), \
8369 (this, ret, dest, base, fill, v))
8370 #define call_num_put_wchar_do_put_ldouble(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 8, ostreambuf_iterator_wchar*, \
8371 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, double), \
8372 (this, ret, dest, base, fill, v))
8373 #else
8374 #define call_num_put_wchar_do_put_double(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 20, ostreambuf_iterator_wchar*, \
8375 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, double), \
8376 (this, ret, dest, base, fill, v))
8377 #define call_num_put_wchar_do_put_ldouble(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 16, ostreambuf_iterator_wchar*, \
8378 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, double), \
8379 (this, ret, dest, base, fill, v))
8380 #endif
8381 #if _MSVCP_VER != 80
8382 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_double, 32)
8383 #else
8384 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_double, 36)
8385 #endif
8386 ostreambuf_iterator_wchar* __thiscall num_put_wchar_do_put_double(const num_put *this, ostreambuf_iterator_wchar *ret,
8387 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, double v)
8389 char *tmp;
8390 char fmt[8]; /* strlen("%+#.*lg")+1 */
8391 int size;
8392 unsigned prec;
8394 TRACE("(%p %p %p %d %lf)\n", this, ret, base, fill, v);
8396 num_put_wchar__Ffmt(this, fmt, '\0', base->fmtfl);
8397 prec = get_precision(base);
8398 size = _scprintf(fmt, prec, v);
8400 /* TODO: don't use dynamic allocation */
8401 tmp = MSVCRT_operator_new(size*2);
8402 if(!tmp) {
8403 ERR("Out of memory\n");
8404 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8406 num_put__fput(this, ret, dest, base, fill, tmp, sprintf(tmp, fmt, prec, v),
8407 numpunct_wchar_use_facet(IOS_LOCALE(base)));
8408 MSVCRT_operator_delete(tmp);
8409 return ret;
8412 /* ?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 */
8413 /* ?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 */
8414 /* ?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 */
8415 /* ?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 */
8416 #if _MSVCP_VER != 80
8417 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_double, 32)
8418 #else
8419 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_double, 36)
8420 #endif
8421 ostreambuf_iterator_wchar* __thiscall num_put_short_do_put_double(const num_put *this, ostreambuf_iterator_wchar *ret,
8422 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, double v)
8424 char *tmp;
8425 char fmt[8]; /* strlen("%+#.*lg")+1 */
8426 int size;
8427 unsigned prec;
8429 TRACE("(%p %p %p %d %lf)\n", this, ret, base, fill, v);
8431 num_put_wchar__Ffmt(this, fmt, '\0', base->fmtfl);
8432 prec = get_precision(base);
8433 size = _scprintf(fmt, prec, v);
8435 /* TODO: don't use dynamic allocation */
8436 tmp = MSVCRT_operator_new(size*2);
8437 if(!tmp) {
8438 ERR("Out of memory\n");
8439 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8441 num_put__fput(this, ret, dest, base, fill, tmp, sprintf(tmp, fmt, prec, v),
8442 numpunct_short_use_facet(IOS_LOCALE(base)));
8443 MSVCRT_operator_delete(tmp);
8444 return ret;
8447 /* ?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 */
8448 /* ?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 */
8449 /* ?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 */
8450 /* ?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 */
8451 #if _MSVCP_VER != 80
8452 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_double, 32)
8453 #else
8454 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_double, 36)
8455 #endif
8456 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_double(const num_put *this, ostreambuf_iterator_wchar *ret,
8457 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, double v)
8459 TRACE("(%p %p %p %d %lf)\n", this, ret, base, fill, v);
8460 return call_num_put_wchar_do_put_double(this, ret, dest, base, fill, v);
8463 /* ?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 */
8464 /* ?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 */
8465 /* ?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 */
8466 /* ?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 */
8467 #if _MSVCP_VER != 80
8468 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_ldouble, 32)
8469 #else
8470 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_ldouble, 36)
8471 #endif
8472 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_ldouble(const num_put *this, ostreambuf_iterator_wchar *ret,
8473 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, double v)
8475 TRACE("(%p %p %p %d %lf)\n", this, ret, base, fill, v);
8476 return call_num_put_wchar_do_put_ldouble(this, ret, dest, base, fill, v);
8479 /* ?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 */
8480 /* ?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 */
8481 #if _MSVCP_VER <= 100
8482 #define call_num_put_wchar_do_put_ptr(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 4, ostreambuf_iterator_wchar*, \
8483 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, const void*), \
8484 (this, ret, dest, base, fill, v))
8485 #else
8486 #define call_num_put_wchar_do_put_ptr(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 12, ostreambuf_iterator_wchar*, \
8487 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, const void*), \
8488 (this, ret, dest, base, fill, v))
8489 #endif
8490 #if _MSVCP_VER != 80
8491 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_ptr, 28)
8492 #else
8493 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_ptr, 32)
8494 #endif
8495 ostreambuf_iterator_wchar* __thiscall num_put_wchar_do_put_ptr(const num_put *this, ostreambuf_iterator_wchar *ret,
8496 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, const void *v)
8498 char tmp[17]; /* 8(16^8==2^64)*2(separators beetwen every digit) + 1 */
8500 TRACE("(%p %p %p %d %p)\n", this, ret, base, fill, v);
8502 return num_put_wchar__Iput(this, ret, dest, base, fill, tmp, sprintf(tmp, "%p", v));
8505 /* ?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 */
8506 /* ?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 */
8507 #if _MSVCP_VER != 80
8508 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_ptr, 28)
8509 #else
8510 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_ptr, 32)
8511 #endif
8512 ostreambuf_iterator_wchar* __thiscall num_put_short_do_put_ptr(const num_put *this, ostreambuf_iterator_wchar *ret,
8513 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, const void *v)
8515 char tmp[17]; /* 8(16^8==2^64)*2(separators beetwen every digit) + 1 */
8517 TRACE("(%p %p %p %d %p)\n", this, ret, base, fill, v);
8519 return num_put_short__Iput(this, ret, dest, base, fill, tmp, sprintf(tmp, "%p", v));
8522 /* ?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 */
8523 /* ?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 */
8524 /* ?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 */
8525 /* ?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 */
8526 #if _MSVCP_VER != 80
8527 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_ptr, 28)
8528 #else
8529 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_ptr, 32)
8530 #endif
8531 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_ptr(const num_put *this, ostreambuf_iterator_wchar *ret,
8532 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, const void *v)
8534 TRACE("(%p %p %p %d %p)\n", this, ret, base, fill, v);
8535 return call_num_put_wchar_do_put_ptr(this, ret, dest, base, fill, v);
8538 /* ?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 */
8539 /* ?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 */
8540 #if _MSVCP_VER <= 100
8541 #define call_num_put_wchar_do_put_int64(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 20, ostreambuf_iterator_wchar*, \
8542 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, __int64), \
8543 (this, ret, dest, base, fill, v))
8544 #else
8545 #define call_num_put_wchar_do_put_int64(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 28, ostreambuf_iterator_wchar*, \
8546 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, __int64), \
8547 (this, ret, dest, base, fill, v))
8548 #endif
8549 #if _MSVCP_VER != 80
8550 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_int64, 32)
8551 #else
8552 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_int64, 36)
8553 #endif
8554 ostreambuf_iterator_wchar* __thiscall num_put_wchar_do_put_int64(const num_put *this, ostreambuf_iterator_wchar *ret,
8555 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, __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_wchar__Iput(this, ret, dest, base, fill, tmp,
8563 sprintf(tmp, num_put_wchar__Ifmt(this, fmt, "lld", base->fmtfl), v));
8566 /* ?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 */
8567 /* ?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 */
8568 #if _MSVCP_VER != 80
8569 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_int64, 32)
8570 #else
8571 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_int64, 36)
8572 #endif
8573 ostreambuf_iterator_wchar* __thiscall num_put_short_do_put_int64(const num_put *this, ostreambuf_iterator_wchar *ret,
8574 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, __int64 v)
8576 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
8577 char fmt[7]; /* strlen("%+#lld")+1 */
8579 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
8581 return num_put_short__Iput(this, ret, dest, base, fill, tmp,
8582 sprintf(tmp, num_put_wchar__Ifmt(this, fmt, "lld", base->fmtfl), v));
8585 /* ?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 */
8586 /* ?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 */
8587 /* ?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 */
8588 /* ?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 */
8589 #if _MSVCP_VER != 80
8590 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_int64, 32)
8591 #else
8592 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_int64, 36)
8593 #endif
8594 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_int64(const num_put *this, ostreambuf_iterator_wchar *ret,
8595 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, __int64 v)
8597 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
8598 return call_num_put_wchar_do_put_int64(this, ret, dest, base, fill, v);
8601 /* ?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 */
8602 /* ?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 */
8603 #if _MSVCP_VER <= 100
8604 #define call_num_put_wchar_do_put_uint64(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 16, ostreambuf_iterator_wchar*, \
8605 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, unsigned __int64), \
8606 (this, ret, dest, base, fill, v))
8607 #else
8608 #define call_num_put_wchar_do_put_uint64(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 24, ostreambuf_iterator_wchar*, \
8609 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, unsigned __int64), \
8610 (this, ret, dest, base, fill, v))
8611 #endif
8612 #if _MSVCP_VER != 80
8613 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_uint64, 32)
8614 #else
8615 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_uint64, 36)
8616 #endif
8617 ostreambuf_iterator_wchar* __thiscall num_put_wchar_do_put_uint64(const num_put *this, ostreambuf_iterator_wchar *ret,
8618 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, unsigned __int64 v)
8620 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
8621 char fmt[7]; /* strlen("%+#lld")+1 */
8623 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
8625 return num_put_wchar__Iput(this, ret, dest, base, fill, tmp,
8626 sprintf(tmp, num_put_wchar__Ifmt(this, fmt, "llu", base->fmtfl), 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_K@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_K@Z */
8631 #if _MSVCP_VER != 80
8632 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_uint64, 32)
8633 #else
8634 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_uint64, 36)
8635 #endif
8636 ostreambuf_iterator_wchar* __thiscall num_put_short_do_put_uint64(const num_put *this, ostreambuf_iterator_wchar *ret,
8637 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, unsigned __int64 v)
8639 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
8640 char fmt[7]; /* strlen("%+#lld")+1 */
8642 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
8644 return num_put_short__Iput(this, ret, dest, base, fill, tmp,
8645 sprintf(tmp, num_put_wchar__Ifmt(this, fmt, "llu", base->fmtfl), v));
8648 /* ?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 */
8649 /* ?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 */
8650 /* ?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 */
8651 /* ?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 */
8652 #if _MSVCP_VER != 80
8653 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_uint64, 32)
8654 #else
8655 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_uint64, 36)
8656 #endif
8657 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_uint64(const num_put *this, ostreambuf_iterator_wchar *ret,
8658 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, unsigned __int64 v)
8660 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
8661 return call_num_put_wchar_do_put_uint64(this, ret, dest, base, fill, v);
8664 /* ?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 */
8665 /* ?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 */
8666 #if _MSVCP_VER <= 100
8667 #define call_num_put_wchar_do_put_bool(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 32, ostreambuf_iterator_wchar*, \
8668 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, MSVCP_bool), \
8669 (this, ret, dest, base, fill, v))
8670 #else
8671 #define call_num_put_wchar_do_put_bool(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 40, ostreambuf_iterator_wchar*, \
8672 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, MSVCP_bool), \
8673 (this, ret, dest, base, fill, v))
8674 #endif
8675 #if _MSVCP_VER != 80
8676 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_bool, 28)
8677 #else
8678 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_bool, 32)
8679 #endif
8680 ostreambuf_iterator_wchar* __thiscall num_put_wchar_do_put_bool(const num_put *this, ostreambuf_iterator_wchar *ret,
8681 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, MSVCP_bool v)
8683 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
8685 if(base->fmtfl & FMTFLAG_boolalpha) {
8686 numpunct_wchar *numpunct = numpunct_wchar_use_facet(IOS_LOCALE(base));
8687 basic_string_wchar str;
8688 MSVCP_size_t pad, len;
8690 if(v)
8691 numpunct_wchar_truename(numpunct, &str);
8692 else
8693 numpunct_wchar_falsename(numpunct, &str);
8695 len = MSVCP_basic_string_wchar_length(&str);
8696 pad = (len>base->wide ? 0 : base->wide-len);
8697 base->wide = 0;
8699 if((base->fmtfl & FMTFLAG_adjustfield) != FMTFLAG_left) {
8700 num_put_wchar__Rep(this, &dest, dest, fill, pad);
8701 pad = 0;
8703 num_put_wchar__Put(this, &dest, dest, MSVCP_basic_string_wchar_c_str(&str), len);
8704 MSVCP_basic_string_wchar_dtor(&str);
8705 return num_put_wchar__Rep(this, ret, dest, fill, pad);
8708 return num_put_wchar_put_long(this, ret, dest, base, fill, v);
8711 /* ?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 */
8712 /* ?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 */
8713 #if _MSVCP_VER != 80
8714 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_bool, 28)
8715 #else
8716 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_bool, 32)
8717 #endif
8718 ostreambuf_iterator_wchar* __thiscall num_put_short_do_put_bool(const num_put *this, ostreambuf_iterator_wchar *ret,
8719 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, MSVCP_bool v)
8721 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
8723 if(base->fmtfl & FMTFLAG_boolalpha) {
8724 numpunct_wchar *numpunct = numpunct_short_use_facet(IOS_LOCALE(base));
8725 basic_string_wchar str;
8726 MSVCP_size_t pad, len;
8728 if(v)
8729 numpunct_wchar_truename(numpunct, &str);
8730 else
8731 numpunct_wchar_falsename(numpunct, &str);
8733 len = MSVCP_basic_string_wchar_length(&str);
8734 pad = (len>base->wide ? 0 : base->wide-len);
8735 base->wide = 0;
8737 if((base->fmtfl & FMTFLAG_adjustfield) != FMTFLAG_left) {
8738 num_put_wchar__Rep(this, &dest, dest, fill, pad);
8739 pad = 0;
8741 num_put_wchar__Put(this, &dest, dest, MSVCP_basic_string_wchar_c_str(&str), len);
8742 MSVCP_basic_string_wchar_dtor(&str);
8743 return num_put_wchar__Rep(this, ret, dest, fill, pad);
8746 return num_put_wchar_put_long(this, ret, dest, base, fill, v);
8749 /* ?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 */
8750 /* ?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 */
8751 /* ?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 */
8752 /* ?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 */
8753 #if _MSVCP_VER != 80
8754 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_bool, 28)
8755 #else
8756 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_bool, 32)
8757 #endif
8758 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_bool(const num_put *this, ostreambuf_iterator_wchar *ret,
8759 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, MSVCP_bool v)
8761 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
8762 return call_num_put_wchar_do_put_bool(this, ret, dest, base, fill, v);
8765 /* ?id@?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@2V0locale@2@A */
8766 locale_id time_put_char_id = {0};
8768 /* ??_7?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@6B@ */
8769 extern const vtable_ptr MSVCP_time_put_char_vtable;
8771 /* ?_Init@?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@IAEXABV_Locinfo@2@@Z */
8772 /* ?_Init@?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@IEAAXAEBV_Locinfo@2@@Z */
8773 DEFINE_THISCALL_WRAPPER(time_put_char__Init, 8)
8774 void __thiscall time_put_char__Init(time_put *this, const _Locinfo *locinfo)
8776 TRACE("(%p %p)\n", this, locinfo);
8777 _Locinfo__Gettnames(locinfo, &this->time);
8778 _Locinfo__Getcvt(locinfo, &this->cvt);
8781 /* ??0?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
8782 /* ??0?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
8783 DEFINE_THISCALL_WRAPPER(time_put_char_ctor_locinfo, 12)
8784 time_put* __thiscall time_put_char_ctor_locinfo(time_put *this, const _Locinfo *locinfo, MSVCP_size_t refs)
8786 TRACE("(%p %p %lu)\n", this, locinfo, refs);
8787 locale_facet_ctor_refs(&this->facet, refs);
8788 this->facet.vtable = &MSVCP_time_put_char_vtable;
8789 time_put_char__Init(this, locinfo);
8790 return this;
8793 /* ??0?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAE@I@Z */
8794 /* ??0?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAA@_K@Z */
8795 DEFINE_THISCALL_WRAPPER(time_put_char_ctor_refs, 8)
8796 time_put* __thiscall time_put_char_ctor_refs(time_put *this, MSVCP_size_t refs)
8798 _Locinfo locinfo;
8800 TRACE("(%p %lu)\n", this, refs);
8802 _Locinfo_ctor(&locinfo);
8803 time_put_char_ctor_locinfo(this, &locinfo, refs);
8804 _Locinfo_dtor(&locinfo);
8805 return this;
8808 /* ??_F?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAEXXZ */
8809 /* ??_F?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAAXXZ */
8810 DEFINE_THISCALL_WRAPPER(time_put_char_ctor, 4)
8811 time_put* __thiscall time_put_char_ctor(time_put *this)
8813 return time_put_char_ctor_refs(this, 0);
8816 /* ??1?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MAE@XZ */
8817 /* ??1?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MEAA@XZ */
8818 DEFINE_THISCALL_WRAPPER(time_put_char_dtor, 4)
8819 void __thiscall time_put_char_dtor(time_put *this)
8821 TRACE("(%p)\n", this);
8822 _Timevec_dtor(&this->time);
8825 DEFINE_THISCALL_WRAPPER(time_put_char_vector_dtor, 8)
8826 time_put* __thiscall time_put_char_vector_dtor(time_put *this, unsigned int flags)
8828 TRACE("(%p %x)\n", this, flags);
8829 if(flags & 2) {
8830 /* we have an array, with the number of elements stored before the first object */
8831 INT_PTR i, *ptr = (INT_PTR *)this-1;
8833 for(i=*ptr-1; i>=0; i--)
8834 time_put_char_dtor(this+i);
8835 MSVCRT_operator_delete(ptr);
8836 } else {
8837 time_put_char_dtor(this);
8838 if(flags & 1)
8839 MSVCRT_operator_delete(this);
8842 return this;
8845 /* ?_Getcat@?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
8846 /* ?_Getcat@?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
8847 MSVCP_size_t __cdecl time_put_char__Getcat(const locale_facet **facet, const locale *loc)
8849 TRACE("(%p %p)\n", facet, loc);
8851 if(facet && !*facet) {
8852 _Locinfo locinfo;
8854 *facet = MSVCRT_operator_new(sizeof(time_put));
8855 if(!*facet) {
8856 ERR("Out of memory\n");
8857 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8858 return 0;
8861 _Locinfo_ctor_cstr(&locinfo, locale_string_char_c_str(&loc->ptr->name));
8862 time_put_char_ctor_locinfo((time_put*)*facet, &locinfo, 0);
8863 _Locinfo_dtor(&locinfo);
8866 return LC_TIME;
8869 /* ?_Getcat@?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SAIPAPBVfacet@locale@2@@Z */
8870 /* ?_Getcat@?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@@Z */
8871 MSVCP_size_t __cdecl time_put_char__Getcat_old(const locale_facet **facet)
8873 return time_put_char__Getcat(facet, locale_classic());
8876 static time_put* time_put_char_use_facet(const locale *loc)
8878 static time_put *obj = NULL;
8880 _Lockit lock;
8881 const locale_facet *fac;
8883 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
8884 fac = locale__Getfacet(loc, locale_id_operator_size_t(&time_put_char_id));
8885 if(fac) {
8886 _Lockit_dtor(&lock);
8887 return (time_put*)fac;
8890 if(obj) {
8891 _Lockit_dtor(&lock);
8892 return obj;
8895 time_put_char__Getcat(&fac, loc);
8896 obj = (time_put*)fac;
8897 call_locale_facet__Incref(&obj->facet);
8898 locale_facet_register(&obj->facet);
8899 _Lockit_dtor(&lock);
8901 return obj;
8904 #if _MSVCP_VER >= 70
8906 /* ?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 */
8907 /* ?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 */
8908 #if _MSVCP_VER != 80
8909 DEFINE_THISCALL_WRAPPER(time_put_char_do_put, 36)
8910 #else
8911 DEFINE_THISCALL_WRAPPER(time_put_char_do_put, 40)
8912 #endif
8913 #if _MSVCP_VER <= 100
8914 #define call_time_put_char_do_put(this, ret, dest, base, fill, t, spec, mod) CALL_VTBL_FUNC(this, 4, ostreambuf_iterator_char*, \
8915 (const time_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, const struct tm*, char, char), \
8916 (this, ret, dest, base, fill, t, spec, mod))
8917 #else
8918 #define call_time_put_char_do_put(this, ret, dest, base, fill, t, spec, mod) CALL_VTBL_FUNC(this, 12, ostreambuf_iterator_char*, \
8919 (const time_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, const struct tm*, char, char), \
8920 (this, ret, dest, base, fill, t, spec, mod))
8921 #endif
8922 ostreambuf_iterator_char* __thiscall time_put_char_do_put(const time_put *this, ostreambuf_iterator_char *ret,
8923 ostreambuf_iterator_char dest, ios_base *base, char fill, const struct tm *t, char spec, char mod)
8925 char buf[64], fmt[4], *p = fmt;
8926 MSVCP_size_t i, len;
8928 TRACE("(%p %p %p %c %p %c %c)\n", this, ret, base, fill, t, spec, mod);
8930 *p++ = '%';
8931 if(mod)
8932 *p++ = mod;
8933 *p++ = spec;
8934 *p++ = 0;
8936 len = _Strftime(buf, sizeof(buf), fmt, t, this->time.timeptr);
8937 for(i=0; i<len; i++)
8938 ostreambuf_iterator_char_put(&dest, buf[i]);
8940 *ret = dest;
8941 return ret;
8944 /* ?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 */
8945 /* ?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 */
8946 #if _MSVCP_VER != 80
8947 DEFINE_THISCALL_WRAPPER(time_put_char_put, 36)
8948 #else
8949 DEFINE_THISCALL_WRAPPER(time_put_char_put, 40)
8950 #endif
8951 ostreambuf_iterator_char* __thiscall time_put_char_put(const time_put *this, ostreambuf_iterator_char *ret,
8952 ostreambuf_iterator_char dest, ios_base *base, char fill, const struct tm *t, char spec, char mod)
8954 TRACE("(%p %p %p %c %p %c %c)\n", this, ret, base, fill, t, spec, mod);
8955 return call_time_put_char_do_put(this, ret, dest, base, fill, t, spec, mod);
8958 /* ?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 */
8959 /* ?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 */
8960 #if _MSVCP_VER != 80
8961 DEFINE_THISCALL_WRAPPER(time_put_char_put_format, 36)
8962 #else
8963 DEFINE_THISCALL_WRAPPER(time_put_char_put_format, 40)
8964 #endif
8965 ostreambuf_iterator_char* __thiscall time_put_char_put_format(const time_put *this, ostreambuf_iterator_char *ret,
8966 ostreambuf_iterator_char dest, ios_base *base, char fill, const struct tm *t, const char *pat, const char *pat_end)
8968 TRACE("(%p %p %p %c %p %s)\n", this, ret, base, fill, t, debugstr_an(pat, pat_end-pat));
8970 while(pat < pat_end) {
8971 if(*pat != '%') {
8972 ostreambuf_iterator_char_put(&dest, *pat++);
8973 }else if(++pat == pat_end) {
8974 ostreambuf_iterator_char_put(&dest, '%');
8975 }else if(*pat=='#' && pat+1==pat_end) {
8976 ostreambuf_iterator_char_put(&dest, '%');
8977 ostreambuf_iterator_char_put(&dest, *pat++);
8978 }else {
8979 char mod;
8981 if(*pat == '#') {
8982 mod = '#';
8983 pat++;
8984 }else {
8985 mod = 0;
8988 time_put_char_put(this, &dest, dest, base, fill, t, *pat++, mod);
8992 *ret = dest;
8993 return ret;
8996 #else /* _MSVCP_VER < 70 doesn't have the 'fill' parameter */
8998 /* ?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@PBUtm@@DD@Z */
8999 /* ?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@PEBUtm@@DD@Z */
9000 DEFINE_THISCALL_WRAPPER(time_put_char_do_put, 32)
9001 #define call_time_put_char_do_put(this, ret, dest, base, t, spec, mod) CALL_VTBL_FUNC(this, 4, ostreambuf_iterator_char*, \
9002 (const time_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, const struct tm*, char, char), \
9003 (this, ret, dest, base, t, spec, mod))
9004 ostreambuf_iterator_char* __thiscall time_put_char_do_put(const time_put *this, ostreambuf_iterator_char *ret,
9005 ostreambuf_iterator_char dest, ios_base *base, const struct tm *t, char spec, char mod)
9007 char buf[64], fmt[4], *p = fmt;
9008 MSVCP_size_t i, len;
9010 TRACE("(%p %p %p %p %c %c)\n", this, ret, base, t, spec, mod);
9012 *p++ = '%';
9013 if(mod)
9014 *p++ = mod;
9015 *p++ = spec;
9016 *p++ = 0;
9018 len = _Strftime(buf, sizeof(buf), fmt, t, this->time.timeptr);
9019 for(i=0; i<len; i++)
9020 ostreambuf_iterator_char_put(&dest, buf[i]);
9022 *ret = dest;
9023 return ret;
9026 /* ?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@PBUtm@@DD@Z */
9027 /* ?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@PEBUtm@@DD@Z */
9028 DEFINE_THISCALL_WRAPPER(time_put_char_put, 32)
9029 ostreambuf_iterator_char* __thiscall time_put_char_put(const time_put *this, ostreambuf_iterator_char *ret,
9030 ostreambuf_iterator_char dest, ios_base *base, const struct tm *t, char spec, char mod)
9032 TRACE("(%p %p %p %p %c %c)\n", this, ret, base, t, spec, mod);
9033 return call_time_put_char_do_put(this, ret, dest, base, t, spec, mod);
9036 /* ?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@PBUtm@@PBD3@Z */
9037 /* ?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@PEBUtm@@PEBD3@Z */
9038 DEFINE_THISCALL_WRAPPER(time_put_char_put_format, 32)
9039 ostreambuf_iterator_char* __thiscall time_put_char_put_format(const time_put *this, ostreambuf_iterator_char *ret,
9040 ostreambuf_iterator_char dest, ios_base *base, const struct tm *t, const char *pat, const char *pat_end)
9042 TRACE("(%p %p %p %p %s)\n", this, ret, base, t, debugstr_an(pat, pat_end-pat));
9044 while(pat < pat_end) {
9045 if(*pat != '%') {
9046 ostreambuf_iterator_char_put(&dest, *pat++);
9047 }else if(++pat == pat_end) {
9048 ostreambuf_iterator_char_put(&dest, '%');
9049 }else if(*pat=='#' && pat+1==pat_end) {
9050 ostreambuf_iterator_char_put(&dest, '%');
9051 ostreambuf_iterator_char_put(&dest, *pat++);
9052 }else {
9053 char mod;
9055 if(*pat == '#') {
9056 mod = '#';
9057 pat++;
9058 }else {
9059 mod = 0;
9062 time_put_char_put(this, &dest, dest, base, t, *pat++, mod);
9066 *ret = dest;
9067 return ret;
9070 #endif /* MSVCP_VER >= 70 */
9072 /* ?id@?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@2V0locale@2@A */
9073 locale_id time_put_wchar_id = {0};
9074 /* ?id@?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@2V0locale@2@A */
9075 locale_id time_put_short_id = {0};
9077 /* ??_7?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@6B@ */
9078 extern const vtable_ptr MSVCP_time_put_wchar_vtable;
9079 /* ??_7?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@6B@ */
9080 extern const vtable_ptr MSVCP_time_put_short_vtable;
9082 /* ?_Init@?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@IAEXABV_Locinfo@2@@Z */
9083 /* ?_Init@?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@IEAAXAEBV_Locinfo@2@@Z */
9084 /* ?_Init@?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@IAEXABV_Locinfo@2@@Z */
9085 /* ?_Init@?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@IEAAXAEBV_Locinfo@2@@Z */
9086 DEFINE_THISCALL_WRAPPER(time_put_wchar__Init, 8)
9087 void __thiscall time_put_wchar__Init(time_put *this, const _Locinfo *locinfo)
9089 TRACE("(%p %p)\n", this, locinfo);
9090 _Locinfo__Gettnames(locinfo, &this->time);
9091 _Locinfo__Getcvt(locinfo, &this->cvt);
9094 /* ??0?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
9095 /* ??0?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
9096 DEFINE_THISCALL_WRAPPER(time_put_wchar_ctor_locinfo, 12)
9097 time_put* __thiscall time_put_wchar_ctor_locinfo(time_put *this, const _Locinfo *locinfo, MSVCP_size_t refs)
9099 TRACE("(%p %p %lu)\n", this, locinfo, refs);
9100 locale_facet_ctor_refs(&this->facet, refs);
9101 this->facet.vtable = &MSVCP_time_put_wchar_vtable;
9102 time_put_wchar__Init(this, locinfo);
9103 return this;
9106 /* ??0?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
9107 /* ??0?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
9108 DEFINE_THISCALL_WRAPPER(time_put_short_ctor_locinfo, 12)
9109 time_put* __thiscall time_put_short_ctor_locinfo(time_put *this, const _Locinfo *locinfo, MSVCP_size_t refs)
9111 time_put_wchar_ctor_locinfo(this, locinfo, refs);
9112 this->facet.vtable = &MSVCP_time_put_short_vtable;
9113 return this;
9116 /* ??0?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@IAE@PBDI@Z */
9117 /* ??0?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@IEAA@PEBD_K@Z */
9118 DEFINE_THISCALL_WRAPPER(time_put_wchar_ctor_name, 12)
9119 time_put* __thiscall time_put_wchar_ctor_name(time_put *this, const char *name, MSVCP_size_t refs)
9121 _Locinfo locinfo;
9123 TRACE("(%p %s %lu)\n", this, debugstr_a(name), refs);
9125 _Locinfo_ctor_cstr(&locinfo, name);
9126 time_put_wchar_ctor_locinfo(this, &locinfo, refs);
9127 _Locinfo_dtor(&locinfo);
9128 return this;
9131 /* ??0?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@IAE@PBDI@Z */
9132 /* ??0?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@IEAA@PEBD_K@Z */
9133 DEFINE_THISCALL_WRAPPER(time_put_short_ctor_name, 12)
9134 time_put* __thiscall time_put_short_ctor_name(time_put *this, const char *name, MSVCP_size_t refs)
9136 time_put_wchar_ctor_name(this, name, refs);
9137 this->facet.vtable = &MSVCP_time_put_short_vtable;
9138 return this;
9141 /* ??0?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAE@I@Z */
9142 /* ??0?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAA@_K@Z */
9143 DEFINE_THISCALL_WRAPPER(time_put_wchar_ctor_refs, 8)
9144 time_put* __thiscall time_put_wchar_ctor_refs(time_put *this, MSVCP_size_t refs)
9146 _Locinfo locinfo;
9148 TRACE("(%p %lu)\n", this, refs);
9150 _Locinfo_ctor(&locinfo);
9151 time_put_wchar_ctor_locinfo(this, &locinfo, refs);
9152 _Locinfo_dtor(&locinfo);
9153 return this;
9156 /* ??0?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAE@I@Z */
9157 /* ??0?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEAA@_K@Z */
9158 DEFINE_THISCALL_WRAPPER(time_put_short_ctor_refs, 8)
9159 time_put* __thiscall time_put_short_ctor_refs(time_put *this, MSVCP_size_t refs)
9161 time_put_wchar_ctor_refs(this, refs);
9162 this->facet.vtable = &MSVCP_time_put_short_vtable;
9163 return this;
9166 /* ??_F?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAEXXZ */
9167 /* ??_F?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAAXXZ */
9168 DEFINE_THISCALL_WRAPPER(time_put_wchar_ctor, 4)
9169 time_put* __thiscall time_put_wchar_ctor(time_put *this)
9171 return time_put_wchar_ctor_refs(this, 0);
9174 /* ??_F?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAEXXZ */
9175 /* ??_F?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEAAXXZ */
9176 DEFINE_THISCALL_WRAPPER(time_put_short_ctor, 4)
9177 time_put* __thiscall time_put_short_ctor(time_put *this)
9179 time_put_wchar_ctor(this);
9180 this->facet.vtable = &MSVCP_time_put_short_vtable;
9181 return this;
9184 /* ??1?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MAE@XZ */
9185 /* ??1?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MEAA@XZ */
9186 /* ??1?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MAE@XZ */
9187 /* ??1?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MEAA@XZ */
9188 DEFINE_THISCALL_WRAPPER(time_put_wchar_dtor, 4)
9189 void __thiscall time_put_wchar_dtor(time_put *this)
9191 TRACE("(%p)\n", this);
9192 _Timevec_dtor(&this->time);
9195 DEFINE_THISCALL_WRAPPER(time_put_wchar_vector_dtor, 8)
9196 time_put* __thiscall time_put_wchar_vector_dtor(time_put *this, unsigned int flags)
9198 TRACE("(%p %x)\n", this, flags);
9199 if(flags & 2) {
9200 /* we have an array, with the number of elements stored before the first object */
9201 INT_PTR i, *ptr = (INT_PTR *)this-1;
9203 for(i=*ptr-1; i>=0; i--)
9204 time_put_wchar_dtor(this+i);
9205 MSVCRT_operator_delete(ptr);
9206 } else {
9207 time_put_wchar_dtor(this);
9208 if(flags & 1)
9209 MSVCRT_operator_delete(this);
9212 return this;
9215 /* ?_Getcat@?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
9216 /* ?_Getcat@?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
9217 MSVCP_size_t __cdecl time_put_wchar__Getcat(const locale_facet **facet, const locale *loc)
9219 TRACE("(%p %p)\n", facet, loc);
9221 if(facet && !*facet) {
9222 *facet = MSVCRT_operator_new(sizeof(time_put));
9223 if(!*facet) {
9224 ERR("Out of memory\n");
9225 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
9226 return 0;
9228 time_put_wchar_ctor_name((time_put*)*facet,
9229 locale_string_char_c_str(&loc->ptr->name), 0);
9232 return LC_TIME;
9235 /* ?_Getcat@?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SAIPAPBVfacet@locale@2@@Z */
9236 /* ?_Getcat@?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@@Z */
9237 MSVCP_size_t __cdecl time_put_wchar__Getcat_old(const locale_facet **facet)
9239 return time_put_wchar__Getcat(facet, locale_classic());
9242 static time_put* time_put_wchar_use_facet(const locale *loc)
9244 static time_put *obj = NULL;
9246 _Lockit lock;
9247 const locale_facet *fac;
9249 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
9250 fac = locale__Getfacet(loc, locale_id_operator_size_t(&time_put_wchar_id));
9251 if(fac) {
9252 _Lockit_dtor(&lock);
9253 return (time_put*)fac;
9256 if(obj) {
9257 _Lockit_dtor(&lock);
9258 return obj;
9261 time_put_wchar__Getcat(&fac, loc);
9262 obj = (time_put*)fac;
9263 call_locale_facet__Incref(&obj->facet);
9264 locale_facet_register(&obj->facet);
9265 _Lockit_dtor(&lock);
9267 return obj;
9270 /* ?_Getcat@?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
9271 /* ?_Getcat@?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
9272 MSVCP_size_t __cdecl time_put_short__Getcat(const locale_facet **facet, const locale *loc)
9274 TRACE("(%p %p)\n", facet, loc);
9276 if(facet && !*facet) {
9277 *facet = MSVCRT_operator_new(sizeof(time_put));
9278 if(!*facet) {
9279 ERR("Out of memory\n");
9280 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
9281 return 0;
9283 time_put_short_ctor_name((time_put*)*facet,
9284 locale_string_char_c_str(&loc->ptr->name), 0);
9287 return LC_TIME;
9290 /* ?_Getcat@?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SAIPAPBVfacet@locale@2@@Z */
9291 /* ?_Getcat@?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@@Z */
9292 MSVCP_size_t __cdecl time_put_short__Getcat_old(const locale_facet **facet)
9294 return time_put_short__Getcat(facet, locale_classic());
9297 static time_put* time_put_short_use_facet(const locale *loc)
9299 static time_put *obj = NULL;
9301 _Lockit lock;
9302 const locale_facet *fac;
9304 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
9305 fac = locale__Getfacet(loc, locale_id_operator_size_t(&time_put_short_id));
9306 if(fac) {
9307 _Lockit_dtor(&lock);
9308 return (time_put*)fac;
9311 if(obj) {
9312 _Lockit_dtor(&lock);
9313 return obj;
9316 time_put_short__Getcat(&fac, loc);
9317 obj = (time_put*)fac;
9318 call_locale_facet__Incref(&obj->facet);
9319 locale_facet_register(&obj->facet);
9320 _Lockit_dtor(&lock);
9322 return obj;
9325 #if _MSVCP_VER >= 70
9327 /* ?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 */
9328 /* ?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 */
9329 /* ?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 */
9330 /* ?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 */
9331 #if _MSVCP_VER != 80
9332 DEFINE_THISCALL_WRAPPER(time_put_wchar_do_put, 36)
9333 #else
9334 DEFINE_THISCALL_WRAPPER(time_put_wchar_do_put, 40)
9335 #endif
9336 #if _MSVCP_VER <= 100
9337 #define call_time_put_wchar_do_put(this, ret, dest, base, fill, t, spec, mod) CALL_VTBL_FUNC(this, 4, ostreambuf_iterator_wchar*, \
9338 (const time_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, const struct tm*, char, char), \
9339 (this, ret, dest, base, fill, t, spec, mod))
9340 #else
9341 #define call_time_put_wchar_do_put(this, ret, dest, base, fill, t, spec, mod) CALL_VTBL_FUNC(this, 12, ostreambuf_iterator_wchar*, \
9342 (const time_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, const struct tm*, char, char), \
9343 (this, ret, dest, base, fill, t, spec, mod))
9344 #endif
9345 ostreambuf_iterator_wchar* __thiscall time_put_wchar_do_put(const time_put *this,
9346 ostreambuf_iterator_wchar *ret, ostreambuf_iterator_wchar dest, ios_base *base,
9347 wchar_t fill, const struct tm *t, char spec, char mod)
9349 char buf[64], fmt[4], *p = fmt;
9350 MSVCP_size_t i, len;
9351 wchar_t c;
9353 TRACE("(%p %p %p %c %p %c %c)\n", this, ret, base, fill, t, spec, mod);
9355 *p++ = '%';
9356 if(mod)
9357 *p++ = mod;
9358 *p++ = spec;
9359 *p++ = 0;
9361 len = _Strftime(buf, sizeof(buf), fmt, t, this->time.timeptr);
9362 for(i=0; i<len; i++) {
9363 c = mb_to_wc(buf[i], &this->cvt);
9364 ostreambuf_iterator_wchar_put(&dest, c);
9367 *ret = dest;
9368 return ret;
9371 /* ?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 */
9372 /* ?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 */
9373 /* ?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 */
9374 /* ?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 */
9375 #if _MSVCP_VER != 80
9376 DEFINE_THISCALL_WRAPPER(time_put_wchar_put, 36)
9377 #else
9378 DEFINE_THISCALL_WRAPPER(time_put_wchar_put, 40)
9379 #endif
9380 ostreambuf_iterator_wchar* __thiscall time_put_wchar_put(const time_put *this,
9381 ostreambuf_iterator_wchar *ret, ostreambuf_iterator_wchar dest, ios_base *base,
9382 wchar_t fill, const struct tm *t, char spec, char mod)
9384 TRACE("(%p %p %p %c %p %c %c)\n", this, ret, base, fill, t, spec, mod);
9385 return call_time_put_wchar_do_put(this, ret, dest, base, fill, t, spec, mod);
9388 /* ?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 */
9389 /* ?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 */
9390 /* ?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 */
9391 /* ?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 */
9392 #if _MSVCP_VER != 80
9393 DEFINE_THISCALL_WRAPPER(time_put_wchar_put_format, 36)
9394 #else
9395 DEFINE_THISCALL_WRAPPER(time_put_wchar_put_format, 40)
9396 #endif
9397 ostreambuf_iterator_wchar* __thiscall time_put_wchar_put_format(const time_put *this,
9398 ostreambuf_iterator_wchar *ret, ostreambuf_iterator_wchar dest, ios_base *base,
9399 wchar_t fill, const struct tm *t, const wchar_t *pat, const wchar_t *pat_end)
9401 wchar_t percent = mb_to_wc('%', &this->cvt);
9402 char c[MB_LEN_MAX];
9404 TRACE("(%p %p %p %c %p %s)\n", this, ret, base, fill, t, debugstr_wn(pat, pat_end-pat));
9406 while(pat < pat_end) {
9407 if(*pat != percent) {
9408 ostreambuf_iterator_wchar_put(&dest, *pat++);
9409 }else if(++pat == pat_end) {
9410 ostreambuf_iterator_wchar_put(&dest, percent);
9411 }else if(_Wcrtomb(c, *pat, NULL, &this->cvt)!=1 || (*c=='#' && pat+1==pat_end)) {
9412 ostreambuf_iterator_wchar_put(&dest, percent);
9413 ostreambuf_iterator_wchar_put(&dest, *pat++);
9414 }else {
9415 pat++;
9416 if(*c == '#') {
9417 if(_Wcrtomb(c, *pat++, NULL, &this->cvt) != 1) {
9418 ostreambuf_iterator_wchar_put(&dest, percent);
9419 ostreambuf_iterator_wchar_put(&dest, *(pat-2));
9420 ostreambuf_iterator_wchar_put(&dest, *(pat-1));
9421 }else {
9422 time_put_wchar_put(this, &dest, dest, base, fill, t, *c, '#');
9424 }else {
9425 time_put_wchar_put(this, &dest, dest, base, fill, t, *c, 0);
9430 *ret = dest;
9431 return ret;
9434 #else /* _MSVCP_VER < 70 doesn't have the 'fill' parameter */
9436 /* ?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@PBUtm@@DD@Z */
9437 /* ?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@PEBUtm@@DD@Z */
9438 DEFINE_THISCALL_WRAPPER(time_put_wchar_do_put, 32)
9439 #define call_time_put_wchar_do_put(this, ret, dest, base, t, spec, mod) CALL_VTBL_FUNC(this, 4, ostreambuf_iterator_wchar*, \
9440 (const time_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, const struct tm*, char, char), \
9441 (this, ret, dest, base, t, spec, mod))
9442 ostreambuf_iterator_wchar* __thiscall time_put_wchar_do_put(const time_put *this,
9443 ostreambuf_iterator_wchar *ret, ostreambuf_iterator_wchar dest, ios_base *base,
9444 const struct tm *t, char spec, char mod)
9446 char buf[64], fmt[4], *p = fmt;
9447 MSVCP_size_t i, len;
9448 wchar_t c;
9450 TRACE("(%p %p %p %p %c %c)\n", this, ret, base, t, spec, mod);
9452 *p++ = '%';
9453 if(mod)
9454 *p++ = mod;
9455 *p++ = spec;
9456 *p++ = 0;
9458 len = _Strftime(buf, sizeof(buf), fmt, t, this->time.timeptr);
9459 for(i=0; i<len; i++) {
9460 c = mb_to_wc(buf[i], &this->cvt);
9461 ostreambuf_iterator_wchar_put(&dest, c);
9464 *ret = dest;
9465 return ret;
9468 /* ?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@PBUtm@@DD@Z */
9469 /* ?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@PEBUtm@@DD@Z */
9470 DEFINE_THISCALL_WRAPPER(time_put_wchar_put, 32)
9471 ostreambuf_iterator_wchar* __thiscall time_put_wchar_put(const time_put *this,
9472 ostreambuf_iterator_wchar *ret, ostreambuf_iterator_wchar dest, ios_base *base,
9473 const struct tm *t, char spec, char mod)
9475 TRACE("(%p %p %p %p %c %c)\n", this, ret, base, t, spec, mod);
9476 return call_time_put_wchar_do_put(this, ret, dest, base, t, spec, mod);
9479 /* ?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@PBUtm@@PBG3@Z */
9480 /* ?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@PEBUtm@@PEBG3@Z */
9481 DEFINE_THISCALL_WRAPPER(time_put_wchar_put_format, 32)
9482 ostreambuf_iterator_wchar* __thiscall time_put_wchar_put_format(const time_put *this,
9483 ostreambuf_iterator_wchar *ret, ostreambuf_iterator_wchar dest, ios_base *base,
9484 const struct tm *t, const wchar_t *pat, const wchar_t *pat_end)
9486 wchar_t percent = mb_to_wc('%', &this->cvt);
9487 char c[MB_LEN_MAX];
9489 TRACE("(%p %p %p %p %s)\n", this, ret, base, t, debugstr_wn(pat, pat_end-pat));
9491 while(pat < pat_end) {
9492 if(*pat != percent) {
9493 ostreambuf_iterator_wchar_put(&dest, *pat++);
9494 }else if(++pat == pat_end) {
9495 ostreambuf_iterator_wchar_put(&dest, percent);
9496 }else if(_Wcrtomb(c, *pat, NULL, &this->cvt)!=1 || (*c=='#' && pat+1==pat_end)) {
9497 ostreambuf_iterator_wchar_put(&dest, percent);
9498 ostreambuf_iterator_wchar_put(&dest, *pat++);
9499 }else {
9500 pat++;
9501 if(*c == '#') {
9502 if(_Wcrtomb(c, *pat++, NULL, &this->cvt) != 1) {
9503 ostreambuf_iterator_wchar_put(&dest, percent);
9504 ostreambuf_iterator_wchar_put(&dest, *(pat-2));
9505 ostreambuf_iterator_wchar_put(&dest, *(pat-1));
9506 }else {
9507 time_put_wchar_put(this, &dest, dest, base, t, *c, '#');
9509 }else {
9510 time_put_wchar_put(this, &dest, dest, base, t, *c, 0);
9515 *ret = dest;
9516 return ret;
9519 #endif /* _MSVCP_VER >= 70 */
9521 /* ?id@?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@2V0locale@2@A */
9522 locale_id time_get_char_id = {0};
9524 /* ??_7?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@6B@ */
9525 extern const vtable_ptr MSVCP_time_get_char_vtable;
9527 /* ?_Init@?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@IAEXABV_Locinfo@2@@Z */
9528 /* ?_Init@?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@IEAAXAEBV_Locinfo@2@@Z */
9529 DEFINE_THISCALL_WRAPPER(time_get_char__Init, 8)
9530 void __thiscall time_get_char__Init(time_get_char *this, const _Locinfo *locinfo)
9532 FIXME("(%p %p) stub\n", this, locinfo);
9535 /* ??0?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@IAE@PBDI@Z */
9536 /* ??0?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@IEAA@PEBD_K@Z */
9537 DEFINE_THISCALL_WRAPPER(time_get_char_ctor_name, 12)
9538 time_get_char* __thiscall time_get_char_ctor_name(time_get_char *this, const char *name, unsigned int refs)
9540 FIXME("(%p %p %d) stub\n", this, name, refs);
9541 this->facet.vtable = &MSVCP_time_get_char_vtable;
9542 return NULL;
9545 /* ??0?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
9546 /* ??0?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
9547 DEFINE_THISCALL_WRAPPER(time_get_char_ctor_locinfo, 12)
9548 time_get_char* __thiscall time_get_char_ctor_locinfo(time_get_char *this,
9549 const _Locinfo *locinfo, unsigned int refs)
9551 FIXME("(%p %p %d) stub\n", this, locinfo, refs);
9552 this->facet.vtable = &MSVCP_time_get_char_vtable;
9553 return NULL;
9556 /* ??0?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAE@I@Z */
9557 /* ??0?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAA@_K@Z */
9558 DEFINE_THISCALL_WRAPPER(time_get_char_ctor_refs, 8)
9559 time_get_char* __thiscall time_get_char_ctor_refs(time_get_char *this, unsigned int refs)
9561 FIXME("(%p %d) stub\n", this, refs);
9562 this->facet.vtable = &MSVCP_time_get_char_vtable;
9563 return NULL;
9566 /* ??_F?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAEXXZ */
9567 /* ??_F?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAAXXZ */
9568 DEFINE_THISCALL_WRAPPER(time_get_char_ctor, 4)
9569 time_get_char* __thiscall time_get_char_ctor(time_get_char *this)
9571 return time_get_char_ctor_refs(this, 0);
9574 /* ?_Tidy@?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@AAEXXZ */
9575 /* ?_Tidy@?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@AEAAXXZ */
9576 DEFINE_THISCALL_WRAPPER(time_get_char__Tidy, 4)
9577 void __thiscall time_get_char__Tidy(time_get_char *this)
9579 FIXME("(%p) stub\n", this);
9582 /* ??1?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MAE@XZ */
9583 /* ??1?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MEAA@XZ */
9584 DEFINE_THISCALL_WRAPPER(time_get_char_dtor, 4) /* virtual */
9585 void __thiscall time_get_char_dtor(time_get_char *this)
9587 FIXME("(%p) stub\n", this);
9590 DEFINE_THISCALL_WRAPPER(time_get_char_vector_dtor, 8)
9591 time_get_char* __thiscall time_get_char_vector_dtor(time_get_char *this, unsigned int flags)
9593 TRACE("(%p %x)\n", this, flags);
9594 if(flags & 2) {
9595 /* we have an array, with the number of elements stored before the first object */
9596 INT_PTR i, *ptr = (INT_PTR *)this-1;
9598 for(i=*ptr-1; i>=0; i--)
9599 time_get_char_dtor(this+i);
9600 MSVCRT_operator_delete(ptr);
9601 } else {
9602 time_get_char_dtor(this);
9603 if(flags & 1)
9604 MSVCRT_operator_delete(this);
9607 return this;
9610 /* ?_Getcat@?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
9611 /* ?_Getcat@?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
9612 unsigned int __cdecl time_get_char__Getcat(const locale_facet **facet, const locale *loc)
9614 TRACE("(%p %p)\n", facet, loc);
9616 if(facet && !*facet) {
9617 _Locinfo locinfo;
9619 *facet = MSVCRT_operator_new(sizeof(time_get_char));
9620 if(!*facet) {
9621 ERR("Out of memory\n");
9622 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
9623 return 0;
9626 _Locinfo_ctor_cstr(&locinfo, locale_string_char_c_str(&loc->ptr->name));
9627 time_get_char_ctor_locinfo((time_get_char*)*facet, &locinfo, 0);
9628 _Locinfo_dtor(&locinfo);
9631 return LC_TIME;
9634 static time_get_char* time_get_char_use_facet(const locale *loc)
9636 static time_get_char *obj = NULL;
9638 _Lockit lock;
9639 const locale_facet *fac;
9641 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
9642 fac = locale__Getfacet(loc, locale_id_operator_size_t(&time_get_char_id));
9643 if(fac) {
9644 _Lockit_dtor(&lock);
9645 return (time_get_char*)fac;
9648 if(obj) {
9649 _Lockit_dtor(&lock);
9650 return obj;
9653 time_get_char__Getcat(&fac, loc);
9654 obj = (time_get_char*)fac;
9655 call_locale_facet__Incref(&obj->facet);
9656 locale_facet_register(&obj->facet);
9657 _Lockit_dtor(&lock);
9659 return obj;
9662 /* ?_Getint@?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@ABAHAAV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@0HHAAH@Z */
9663 /* ?_Getint@?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@AEBAHAEAV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@0HHAEAH@Z */
9664 int __cdecl time_get_char__Getint(const time_get_char *this,
9665 istreambuf_iterator_char *b, istreambuf_iterator_char *e,
9666 int unk1, int unk2, int *val)
9668 FIXME("(%p %p %p %d %d %p) stub\n", this, b, e, unk1, unk2, val);
9669 return 0;
9672 /* ?do_date_order@?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MBE?AW4dateorder@time_base@2@XZ */
9673 /* ?do_date_order@?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MEBA?AW4dateorder@time_base@2@XZ */
9674 DEFINE_THISCALL_WRAPPER(time_get_char_do_date_order, 4) /* virtual */
9675 #if _MSVCP_VER <= 100
9676 #define call_time_get_char_do_date_order(this) CALL_VTBL_FUNC(this, 4, dateorder, (const time_get_char*), (this))
9677 #else
9678 #define call_time_get_char_do_date_order(this) CALL_VTBL_FUNC(this, 12, dateorder, (const time_get_char*), (this))
9679 #endif
9680 dateorder __thiscall time_get_char_do_date_order(const time_get_char *this)
9682 TRACE("(%p)\n", this);
9683 return this->dateorder;
9686 /* ?date_order@?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QBE?AW4dateorder@time_base@2@XZ */
9687 /* ?date_order@?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEBA?AW4dateorder@time_base@2@XZ */
9688 DEFINE_THISCALL_WRAPPER(time_get_char_date_order, 4)
9689 dateorder __thiscall time_get_char_date_order(const time_get_char *this)
9691 return call_time_get_char_do_date_order(this);
9694 /* ?do_get_date@?$time_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@AAHPAUtm@@@Z */
9695 /* ?do_get_date@?$time_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@AEAHPEAUtm@@@Z */
9696 DEFINE_THISCALL_WRAPPER(time_get_char_do_get_date, 36) /* virtual */
9697 #if _MSVCP_VER <= 100
9698 #define call_time_get_char_do_get_date(this, ret, s, e, base, err, t) CALL_VTBL_FUNC(this, 12, istreambuf_iterator_char*, \
9699 (const time_get_char*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, struct tm*), \
9700 (this, ret, s, e, base, err, t))
9701 #else
9702 #define call_time_get_char_do_get_date(this, ret, s, e, base, err, t) CALL_VTBL_FUNC(this, 20, istreambuf_iterator_char*, \
9703 (const time_get_char*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, struct tm*), \
9704 (this, ret, s, e, base, err, t))
9705 #endif
9706 istreambuf_iterator_char* __thiscall time_get_char_do_get_date(const time_get_char *this,
9707 istreambuf_iterator_char *ret, istreambuf_iterator_char s, istreambuf_iterator_char e,
9708 ios_base *base, int *err, struct tm *t)
9710 FIXME("(%p %p %p %p %p) stub\n", this, ret, base, err, t);
9711 return NULL;
9714 /* ?get_date@?$time_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@AAHPAUtm@@@Z */
9715 /* ?get_date@?$time_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@AEAHPEAUtm@@@Z */
9716 DEFINE_THISCALL_WRAPPER(time_get_char_get_date, 36)
9717 istreambuf_iterator_char* __thiscall time_get_char_get_date(const time_get_char *this,
9718 istreambuf_iterator_char *ret, istreambuf_iterator_char s, istreambuf_iterator_char e,
9719 ios_base *base, int *err, struct tm *t)
9721 return call_time_get_char_do_get_date(this, ret, s, e, base, err, t);
9724 /* ?do_get_monthname@?$time_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@AAHPAUtm@@@Z */
9725 /* ?do_get_monthname@?$time_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@AEAHPEAUtm@@@Z */
9726 DEFINE_THISCALL_WRAPPER(time_get_char_do_get_monthname, 36) /* virtual */
9727 #if _MSVCP_VER <= 100
9728 #define call_time_get_char_do_get_monthname(this, ret, s, e, base, err, t) CALL_VTBL_FUNC(this, 20, istreambuf_iterator_char*, \
9729 (const time_get_char*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, struct tm*), \
9730 (this, ret, s, e, base, err, t))
9731 #else
9732 #define call_time_get_char_do_get_monthname(this, ret, s, e, base, err, t) CALL_VTBL_FUNC(this, 28, istreambuf_iterator_char*, \
9733 (const time_get_char*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, struct tm*), \
9734 (this, ret, s, e, base, err, t))
9735 #endif
9736 istreambuf_iterator_char* __thiscall time_get_char_do_get_monthname(const time_get_char *this,
9737 istreambuf_iterator_char *ret, istreambuf_iterator_char s, istreambuf_iterator_char e,
9738 ios_base *base, int *err, struct tm *t)
9740 FIXME("(%p %p %p %p %p) stub\n", this, ret, base, err, t);
9741 return NULL;
9744 /* ?get_monthname@?$time_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@AAHPAUtm@@@Z */
9745 /* ?get_monthname@?$time_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@AEAHPEAUtm@@@Z */
9746 DEFINE_THISCALL_WRAPPER(time_get_char_get_monthname, 36)
9747 istreambuf_iterator_char* __thiscall time_get_char_get_monthname(const time_get_char *this,
9748 istreambuf_iterator_char *ret, istreambuf_iterator_char s, istreambuf_iterator_char e,
9749 ios_base *base, int *err, struct tm *t)
9751 return call_time_get_char_do_get_monthname(this, ret, s, e, base, err, t);
9754 /* ?do_get_time@?$time_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@AAHPAUtm@@@Z */
9755 /* ?do_get_time@?$time_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@AEAHPEAUtm@@@Z */
9756 DEFINE_THISCALL_WRAPPER(time_get_char_do_get_time, 36) /* virtual */
9757 #if _MSVCP_VER <= 100
9758 #define call_time_get_char_do_get_time(this, ret, s, e, base, err, t) CALL_VTBL_FUNC(this, 8, istreambuf_iterator_char*, \
9759 (const time_get_char*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, struct tm*), \
9760 (this, ret, s, e, base, err, t))
9761 #else
9762 #define call_time_get_char_do_get_time(this, ret, s, e, base, err, t) CALL_VTBL_FUNC(this, 16, istreambuf_iterator_char*, \
9763 (const time_get_char*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, struct tm*), \
9764 (this, ret, s, e, base, err, t))
9765 #endif
9766 istreambuf_iterator_char* __thiscall time_get_char_do_get_time(const time_get_char *this,
9767 istreambuf_iterator_char *ret, istreambuf_iterator_char s, istreambuf_iterator_char e,
9768 ios_base *base, int *err, struct tm *t)
9770 FIXME("(%p %p %p %p %p) stub\n", this, ret, base, err, t);
9771 return NULL;
9774 /* ?get_time@?$time_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@AAHPAUtm@@@Z */
9775 /* ?get_time@?$time_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@AEAHPEAUtm@@@Z */
9776 DEFINE_THISCALL_WRAPPER(time_get_char_get_time, 36)
9777 istreambuf_iterator_char* __thiscall time_get_char_get_time(const time_get_char *this,
9778 istreambuf_iterator_char *ret, istreambuf_iterator_char s, istreambuf_iterator_char e,
9779 ios_base *base, int *err, struct tm *t)
9781 return call_time_get_char_do_get_time(this, ret, s, e, base, err, t);
9784 /* ?do_get_weekday@?$time_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@AAHPAUtm@@@Z */
9785 /* ?do_get_weekday@?$time_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@AEAHPEAUtm@@@Z */
9786 DEFINE_THISCALL_WRAPPER(time_get_char_do_get_weekday, 36) /* virtual */
9787 #if _MSVCP_VER <= 100
9788 #define call_time_get_char_do_get_weekday(this, ret, s, e, base, err, t) CALL_VTBL_FUNC(this, 16, istreambuf_iterator_char*, \
9789 (const time_get_char*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, struct tm*), \
9790 (this, ret, s, e, base, err, t))
9791 #else
9792 #define call_time_get_char_do_get_weekday(this, ret, s, e, base, err, t) CALL_VTBL_FUNC(this, 24, istreambuf_iterator_char*, \
9793 (const time_get_char*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, struct tm*), \
9794 (this, ret, s, e, base, err, t))
9795 #endif
9796 istreambuf_iterator_char* __thiscall time_get_char_do_get_weekday(const time_get_char *this,
9797 istreambuf_iterator_char *ret, istreambuf_iterator_char s, istreambuf_iterator_char e,
9798 ios_base *base, int *err, struct tm *t)
9800 FIXME("(%p %p %p %p %p) stub\n", this, ret, base, err, t);
9801 return NULL;
9804 /* ?get_weekday@?$time_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@AAHPAUtm@@@Z */
9805 /* ?get_weekday@?$time_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@AEAHPEAUtm@@@Z */
9806 DEFINE_THISCALL_WRAPPER(time_get_char_get_weekday, 36)
9807 istreambuf_iterator_char* __thiscall time_get_char_get_weekday(const time_get_char *this,
9808 istreambuf_iterator_char *ret, istreambuf_iterator_char s, istreambuf_iterator_char e,
9809 ios_base *base, int *err, struct tm *t)
9811 return call_time_get_char_do_get_weekday(this, ret, s, e, base, err, t);
9814 /* ?do_get_year@?$time_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@AAHPAUtm@@@Z */
9815 /* ?do_get_year@?$time_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@AEAHPEAUtm@@@Z */
9816 DEFINE_THISCALL_WRAPPER(time_get_char_do_get_year, 36) /* virtual */
9817 #if _MSVCP_VER <= 100
9818 #define call_time_get_char_do_get_year(this, ret, s, e, base, err, t) CALL_VTBL_FUNC(this, 24, istreambuf_iterator_char*, \
9819 (const time_get_char*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, struct tm*), \
9820 (this, ret, s, e, base, err, t))
9821 #else
9822 #define call_time_get_char_do_get_year(this, ret, s, e, base, err, t) CALL_VTBL_FUNC(this, 32, istreambuf_iterator_char*, \
9823 (const time_get_char*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, struct tm*), \
9824 (this, ret, s, e, base, err, t))
9825 #endif
9826 istreambuf_iterator_char* __thiscall time_get_char_do_get_year(const time_get_char *this,
9827 istreambuf_iterator_char *ret, istreambuf_iterator_char s, istreambuf_iterator_char e,
9828 ios_base *base, int *err, struct tm *t)
9830 FIXME("(%p %p %p %p %p) stub\n", this, ret, base, err, t);
9831 return NULL;
9834 /* ?get_year@?$time_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@AAHPAUtm@@@Z */
9835 /* ?get_year@?$time_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@AEAHPEAUtm@@@Z */
9836 DEFINE_THISCALL_WRAPPER(time_get_char_get_year, 36)
9837 istreambuf_iterator_char* __thiscall time_get_char_get_year(const time_get_char *this,
9838 istreambuf_iterator_char *ret, istreambuf_iterator_char s, istreambuf_iterator_char e,
9839 ios_base *base, int *err, struct tm *t)
9841 return call_time_get_char_do_get_year(this, ret, s, e, base, err, t);
9844 /* ??0_Locimp@locale@std@@AAE@_N@Z */
9845 /* ??0_Locimp@locale@std@@AEAA@_N@Z */
9846 DEFINE_THISCALL_WRAPPER(locale__Locimp_ctor_transparent, 8)
9847 locale__Locimp* __thiscall locale__Locimp_ctor_transparent(locale__Locimp *this, MSVCP_bool transparent)
9849 TRACE("(%p %d)\n", this, transparent);
9851 memset(this, 0, sizeof(locale__Locimp));
9852 locale_facet_ctor_refs(&this->facet, 1);
9853 this->transparent = transparent;
9854 locale_string_char_ctor_cstr(&this->name, "*");
9855 return this;
9858 /* ??_F_Locimp@locale@std@@QAEXXZ */
9859 /* ??_F_Locimp@locale@std@@QEAAXXZ */
9860 DEFINE_THISCALL_WRAPPER(locale__Locimp_ctor, 4)
9861 locale__Locimp* __thiscall locale__Locimp_ctor(locale__Locimp *this)
9863 return locale__Locimp_ctor_transparent(this, FALSE);
9866 /* ??0_Locimp@locale@std@@AAE@ABV012@@Z */
9867 /* ??0_Locimp@locale@std@@AEAA@AEBV012@@Z */
9868 DEFINE_THISCALL_WRAPPER(locale__Locimp_copy_ctor, 8)
9869 locale__Locimp* __thiscall locale__Locimp_copy_ctor(locale__Locimp *this, const locale__Locimp *copy)
9871 _Lockit lock;
9872 MSVCP_size_t i;
9874 TRACE("(%p %p)\n", this, copy);
9876 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
9877 memcpy(this, copy, sizeof(locale__Locimp));
9878 locale_facet_ctor_refs(&this->facet, 1);
9879 if(copy->facetvec) {
9880 this->facetvec = MSVCRT_operator_new(copy->facet_cnt*sizeof(locale_facet*));
9881 if(!this->facetvec) {
9882 _Lockit_dtor(&lock);
9883 ERR("Out of memory\n");
9884 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
9885 return NULL;
9887 for(i=0; i<this->facet_cnt; i++)
9889 this->facetvec[i] = copy->facetvec[i];
9890 if(this->facetvec[i])
9891 call_locale_facet__Incref(this->facetvec[i]);
9894 locale_string_char_copy_ctor(&this->name, &copy->name);
9895 _Lockit_dtor(&lock);
9896 return this;
9899 /* ?_Locimp_ctor@_Locimp@locale@std@@CAXPAV123@ABV123@@Z */
9900 /* ?_Locimp_ctor@_Locimp@locale@std@@CAXPEAV123@AEBV123@@Z */
9901 locale__Locimp* __cdecl locale__Locimp__Locimp_ctor(locale__Locimp *this, const locale__Locimp *copy)
9903 return locale__Locimp_copy_ctor(this, copy);
9906 /* ??1_Locimp@locale@std@@MAE@XZ */
9907 /* ??1_Locimp@locale@std@@MEAA@XZ */
9908 DEFINE_THISCALL_WRAPPER(locale__Locimp_dtor, 4)
9909 void __thiscall locale__Locimp_dtor(locale__Locimp *this)
9911 MSVCP_size_t i;
9913 TRACE("(%p)\n", this);
9915 locale_facet_dtor(&this->facet);
9916 for(i=0; i<this->facet_cnt; i++)
9917 if(this->facetvec[i] && call_locale_facet__Decref(this->facetvec[i]))
9918 call_locale_facet_vector_dtor(this->facetvec[i], 1);
9920 MSVCRT_operator_delete(this->facetvec);
9921 locale_string_char_dtor(&this->name);
9924 /* ?_Locimp_dtor@_Locimp@locale@std@@CAXPAV123@@Z */
9925 /* ?_Locimp_dtor@_Locimp@locale@std@@CAXPEAV123@@Z */
9926 void __cdecl locale__Locimp__Locimp_dtor(locale__Locimp *this)
9928 locale__Locimp_dtor(this);
9931 DEFINE_THISCALL_WRAPPER(locale__Locimp_vector_dtor, 8)
9932 locale__Locimp* __thiscall locale__Locimp_vector_dtor(locale__Locimp *this, unsigned int flags)
9934 TRACE("(%p %x)\n", this, flags);
9935 if(flags & 2) {
9936 /* we have an array, with the number of elements stored before the first object */
9937 INT_PTR i, *ptr = (INT_PTR *)this-1;
9939 for(i=*ptr-1; i>=0; i--)
9940 locale__Locimp_dtor(this+i);
9941 MSVCRT_operator_delete(ptr);
9942 } else {
9943 locale__Locimp_dtor(this);
9944 if(flags & 1)
9945 MSVCRT_operator_delete(this);
9948 return this;
9951 /* ?_New_Locimp@_Locimp@locale@std@@CAPAV123@ABV123@@Z */
9952 /* ?_New_Locimp@_Locimp@locale@std@@CAPEAV123@AEBV123@@Z */
9953 locale__Locimp* __cdecl locale__Locimp__New_Locimp(const locale__Locimp *copy)
9955 locale__Locimp *ret;
9957 TRACE("(%p)\n", copy);
9959 ret = MSVCRT_operator_new(sizeof(locale__Locimp));
9960 if(!ret) {
9961 ERR("Out of memory\n");
9962 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
9963 return NULL;
9965 return locale__Locimp_copy_ctor(ret, copy);
9968 /* ?_New_Locimp@_Locimp@locale@std@@CAPAV123@_N@Z */
9969 /* ?_New_Locimp@_Locimp@locale@std@@CAPEAV123@_N@Z */
9970 locale__Locimp* __cdecl locale__Locimp__New_Locimp_transparent(MSVCP_bool transparent)
9972 locale__Locimp *ret;
9974 TRACE("(%x)\n", transparent);
9976 ret = MSVCRT_operator_new(sizeof(locale__Locimp));
9977 if(!ret) {
9978 ERR("Out of memory\n");
9979 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
9980 return NULL;
9982 return locale__Locimp_ctor_transparent(ret, transparent);
9985 /* ?_Locimp_Addfac@_Locimp@locale@std@@CAXPAV123@PAVfacet@23@I@Z */
9986 /* ?_Locimp_Addfac@_Locimp@locale@std@@CAXPEAV123@PEAVfacet@23@_K@Z */
9987 void __cdecl locale__Locimp__Locimp_Addfac(locale__Locimp *locimp, locale_facet *facet, MSVCP_size_t id)
9989 _Lockit lock;
9991 TRACE("(%p %p %lu)\n", locimp, facet, id);
9993 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
9994 if(id >= locimp->facet_cnt) {
9995 MSVCP_size_t new_size = id+1;
9996 locale_facet **new_facetvec;
9998 if(new_size < locale_id__Id_cnt+1)
9999 new_size = locale_id__Id_cnt+1;
10001 new_facetvec = MSVCRT_operator_new(sizeof(locale_facet*)*new_size);
10002 if(!new_facetvec) {
10003 _Lockit_dtor(&lock);
10004 ERR("Out of memory\n");
10005 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10006 return;
10009 memset(new_facetvec, 0, sizeof(locale_facet*)*new_size);
10010 memcpy(new_facetvec, locimp->facetvec, sizeof(locale_facet*)*locimp->facet_cnt);
10011 MSVCRT_operator_delete(locimp->facetvec);
10012 locimp->facetvec = new_facetvec;
10013 locimp->facet_cnt = new_size;
10016 if(locimp->facetvec[id] && call_locale_facet__Decref(locimp->facetvec[id]))
10017 call_locale_facet_vector_dtor(locimp->facetvec[id], 1);
10019 locimp->facetvec[id] = facet;
10020 if(facet)
10021 call_locale_facet__Incref(facet);
10022 _Lockit_dtor(&lock);
10025 /* ?_Addfac@_Locimp@locale@std@@AAEXPAVfacet@23@I@Z */
10026 /* ?_Addfac@_Locimp@locale@std@@AEAAXPEAVfacet@23@_K@Z */
10027 DEFINE_THISCALL_WRAPPER(locale__Locimp__Addfac, 12)
10028 void __thiscall locale__Locimp__Addfac(locale__Locimp *this, locale_facet *facet, MSVCP_size_t id)
10030 locale__Locimp__Locimp_Addfac(this, facet, id);
10033 /* ?_Clocptr_func@_Locimp@locale@std@@CAAAPAV123@XZ */
10034 /* ?_Clocptr_func@_Locimp@locale@std@@CAAEAPEAV123@XZ */
10035 locale__Locimp** __cdecl locale__Locimp__Clocptr_func(void)
10037 FIXME("stub\n");
10038 return NULL;
10041 /* ?_Makeushloc@_Locimp@locale@std@@CAXABV_Locinfo@3@HPAV123@PBV23@@Z */
10042 /* ?_Makeushloc@_Locimp@locale@std@@CAXAEBV_Locinfo@3@HPEAV123@PEBV23@@Z */
10043 /* List of missing facets:
10044 * messages, money_get, money_put, moneypunct, moneypunct, time_get
10046 void __cdecl locale__Locimp__Makeushloc(const _Locinfo *locinfo, category cat, locale__Locimp *locimp, const locale *loc)
10048 FIXME("(%p %d %p %p) semi-stub\n", locinfo, cat, locimp, loc);
10050 if(cat & (1<<(ctype_short__Getcat(NULL, NULL)-1))) {
10051 ctype_wchar *ctype;
10053 if(loc) {
10054 ctype = ctype_short_use_facet(loc);
10055 }else {
10056 ctype = MSVCRT_operator_new(sizeof(ctype_wchar));
10057 if(!ctype) {
10058 ERR("Out of memory\n");
10059 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10061 ctype_short_ctor_locinfo(ctype, locinfo, 0);
10063 locale__Locimp__Addfac(locimp, &ctype->base.facet, locale_id_operator_size_t(&ctype_short_id));
10066 if(cat & (1<<(num_get_short__Getcat(NULL, NULL)-1))) {
10067 num_get *numget;
10069 if(loc) {
10070 numget = num_get_short_use_facet(loc);
10071 }else {
10072 numget = MSVCRT_operator_new(sizeof(num_get));
10073 if(!numget) {
10074 ERR("Out of memory\n");
10075 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10077 num_get_short_ctor_locinfo(numget, locinfo, 0);
10079 locale__Locimp__Addfac(locimp, &numget->facet, locale_id_operator_size_t(&num_get_short_id));
10082 if(cat & (1<<(num_put_short__Getcat(NULL, NULL)-1))) {
10083 num_put *numput;
10085 if(loc) {
10086 numput = num_put_short_use_facet(loc);
10087 }else {
10088 numput = MSVCRT_operator_new(sizeof(num_put));
10089 if(!numput) {
10090 ERR("Out of memory\n");
10091 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10093 num_put_short_ctor_locinfo(numput, locinfo, 0);
10095 locale__Locimp__Addfac(locimp, &numput->facet, locale_id_operator_size_t(&num_put_short_id));
10098 if(cat & (1<<(numpunct_short__Getcat(NULL, NULL)-1))) {
10099 numpunct_wchar *numpunct;
10101 if(loc) {
10102 numpunct = numpunct_short_use_facet(loc);
10103 }else {
10104 numpunct = MSVCRT_operator_new(sizeof(numpunct_wchar));
10105 if(!numpunct) {
10106 ERR("Out of memory\n");
10107 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10109 numpunct_short_ctor_locinfo(numpunct, locinfo, 0, FALSE);
10111 locale__Locimp__Addfac(locimp, &numpunct->facet, locale_id_operator_size_t(&numpunct_short_id));
10114 if(cat & (1<<(collate_short__Getcat(NULL, NULL)-1))) {
10115 collate *c;
10117 if(loc) {
10118 c = collate_short_use_facet(loc);
10119 }else {
10120 c = MSVCRT_operator_new(sizeof(collate));
10121 if(!c) {
10122 ERR("Out of memory\n");
10123 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10125 collate_short_ctor_locinfo(c, locinfo, 0);
10127 locale__Locimp__Addfac(locimp, &c->facet, locale_id_operator_size_t(&collate_short_id));
10130 if(cat & (1<<(time_put_short__Getcat(NULL, NULL)-1))) {
10131 time_put *t;
10133 if(loc) {
10134 t = time_put_short_use_facet(loc);
10135 }else {
10136 t = MSVCRT_operator_new(sizeof(time_put));
10137 if(!t) {
10138 ERR("Out of memory\n");
10139 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10141 time_put_short_ctor_locinfo(t, locinfo, 0);
10143 locale__Locimp__Addfac(locimp, &t->facet, locale_id_operator_size_t(&time_put_short_id));
10146 if(cat & (1<<(codecvt_short__Getcat(NULL, NULL)-1))) {
10147 codecvt_wchar *codecvt;
10149 if(loc) {
10150 codecvt = codecvt_short_use_facet(loc);
10151 }else {
10152 codecvt = MSVCRT_operator_new(sizeof(codecvt_wchar));
10153 if(!codecvt) {
10154 ERR("Out of memory\n");
10155 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10157 codecvt_short_ctor_locinfo(codecvt, locinfo, 0);
10159 locale__Locimp__Addfac(locimp, &codecvt->base.facet, locale_id_operator_size_t(&codecvt_short_id));
10163 /* ?_Makewloc@_Locimp@locale@std@@CAXABV_Locinfo@3@HPAV123@PBV23@@Z */
10164 /* ?_Makewloc@_Locimp@locale@std@@CAXAEBV_Locinfo@3@HPEAV123@PEBV23@@Z */
10165 /* List of missing facets:
10166 * messages, money_get, money_put, moneypunct, moneypunct, time_get
10168 void __cdecl locale__Locimp__Makewloc(const _Locinfo *locinfo, category cat, locale__Locimp *locimp, const locale *loc)
10170 FIXME("(%p %d %p %p) semi-stub\n", locinfo, cat, locimp, loc);
10172 if(cat & (1<<(ctype_wchar__Getcat(NULL, NULL)-1))) {
10173 ctype_wchar *ctype;
10175 if(loc) {
10176 ctype = ctype_wchar_use_facet(loc);
10177 }else {
10178 ctype = MSVCRT_operator_new(sizeof(ctype_wchar));
10179 if(!ctype) {
10180 ERR("Out of memory\n");
10181 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10183 ctype_wchar_ctor_locinfo(ctype, locinfo, 0);
10185 locale__Locimp__Addfac(locimp, &ctype->base.facet, locale_id_operator_size_t(&ctype_wchar_id));
10188 if(cat & (1<<(num_get_wchar__Getcat(NULL, NULL)-1))) {
10189 num_get *numget;
10191 if(loc) {
10192 numget = num_get_wchar_use_facet(loc);
10193 }else {
10194 numget = MSVCRT_operator_new(sizeof(num_get));
10195 if(!numget) {
10196 ERR("Out of memory\n");
10197 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10199 num_get_wchar_ctor_locinfo(numget, locinfo, 0);
10201 locale__Locimp__Addfac(locimp, &numget->facet, locale_id_operator_size_t(&num_get_wchar_id));
10204 if(cat & (1<<(num_put_wchar__Getcat(NULL, NULL)-1))) {
10205 num_put *numput;
10207 if(loc) {
10208 numput = num_put_wchar_use_facet(loc);
10209 }else {
10210 numput = MSVCRT_operator_new(sizeof(num_put));
10211 if(!numput) {
10212 ERR("Out of memory\n");
10213 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10215 num_put_wchar_ctor_locinfo(numput, locinfo, 0);
10217 locale__Locimp__Addfac(locimp, &numput->facet, locale_id_operator_size_t(&num_put_wchar_id));
10220 if(cat & (1<<(numpunct_wchar__Getcat(NULL, NULL)-1))) {
10221 numpunct_wchar *numpunct;
10223 if(loc) {
10224 numpunct = numpunct_wchar_use_facet(loc);
10225 }else {
10226 numpunct = MSVCRT_operator_new(sizeof(numpunct_wchar));
10227 if(!numpunct) {
10228 ERR("Out of memory\n");
10229 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10231 numpunct_wchar_ctor_locinfo(numpunct, locinfo, 0, FALSE);
10233 locale__Locimp__Addfac(locimp, &numpunct->facet, locale_id_operator_size_t(&numpunct_wchar_id));
10236 if(cat & (1<<(collate_wchar__Getcat(NULL, NULL)-1))) {
10237 collate *c;
10239 if(loc) {
10240 c = collate_wchar_use_facet(loc);
10241 }else {
10242 c = MSVCRT_operator_new(sizeof(collate));
10243 if(!c) {
10244 ERR("Out of memory\n");
10245 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10247 collate_wchar_ctor_locinfo(c, locinfo, 0);
10249 locale__Locimp__Addfac(locimp, &c->facet, locale_id_operator_size_t(&collate_wchar_id));
10252 if(cat & (1<<(time_put_wchar__Getcat(NULL, NULL)-1))) {
10253 time_put *t;
10255 if(loc) {
10256 t = time_put_wchar_use_facet(loc);
10257 }else {
10258 t = MSVCRT_operator_new(sizeof(time_put));
10259 if(!t) {
10260 ERR("Out of memory\n");
10261 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10263 time_put_wchar_ctor_locinfo(t, locinfo, 0);
10265 locale__Locimp__Addfac(locimp, &t->facet, locale_id_operator_size_t(&time_put_wchar_id));
10268 if(cat & (1<<(codecvt_wchar__Getcat(NULL, NULL)-1))) {
10269 codecvt_wchar *codecvt;
10271 if(loc) {
10272 codecvt = codecvt_wchar_use_facet(loc);
10273 }else {
10274 codecvt = MSVCRT_operator_new(sizeof(codecvt_wchar));
10275 if(!codecvt) {
10276 ERR("Out of memory\n");
10277 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10279 codecvt_wchar_ctor_locinfo(codecvt, locinfo, 0);
10281 locale__Locimp__Addfac(locimp, &codecvt->base.facet, locale_id_operator_size_t(&codecvt_wchar_id));
10285 /* ?_Makexloc@_Locimp@locale@std@@CAXABV_Locinfo@3@HPAV123@PBV23@@Z */
10286 /* ?_Makexloc@_Locimp@locale@std@@CAXAEBV_Locinfo@3@HPEAV123@PEBV23@@Z */
10287 /* List of missing facets:
10288 * messages, money_get, money_put, moneypunct, moneypunct, time_get
10290 void __cdecl locale__Locimp__Makexloc(const _Locinfo *locinfo, category cat, locale__Locimp *locimp, const locale *loc)
10292 FIXME("(%p %d %p %p) semi-stub\n", locinfo, cat, locimp, loc);
10294 if(cat & (1<<(ctype_char__Getcat(NULL, NULL)-1))) {
10295 ctype_char *ctype;
10297 if(loc) {
10298 ctype = ctype_char_use_facet(loc);
10299 }else {
10300 ctype = MSVCRT_operator_new(sizeof(ctype_char));
10301 if(!ctype) {
10302 ERR("Out of memory\n");
10303 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10305 ctype_char_ctor_locinfo(ctype, locinfo, 0);
10307 locale__Locimp__Addfac(locimp, &ctype->base.facet, locale_id_operator_size_t(&ctype_char_id));
10310 if(cat & (1<<(num_get_char__Getcat(NULL, NULL)-1))) {
10311 num_get *numget;
10313 if(loc) {
10314 numget = num_get_char_use_facet(loc);
10315 }else {
10316 numget = MSVCRT_operator_new(sizeof(num_get));
10317 if(!numget) {
10318 ERR("Out of memory\n");
10319 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10321 num_get_char_ctor_locinfo(numget, locinfo, 0);
10323 locale__Locimp__Addfac(locimp, &numget->facet, locale_id_operator_size_t(&num_get_char_id));
10326 if(cat & (1<<(num_put_char__Getcat(NULL, NULL)-1))) {
10327 num_put *numput;
10329 if(loc) {
10330 numput = num_put_char_use_facet(loc);
10331 }else {
10332 numput = MSVCRT_operator_new(sizeof(num_put));
10333 if(!numput) {
10334 ERR("Out of memory\n");
10335 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10337 num_put_char_ctor_locinfo(numput, locinfo, 0);
10339 locale__Locimp__Addfac(locimp, &numput->facet, locale_id_operator_size_t(&num_put_char_id));
10342 if(cat & (1<<(numpunct_char__Getcat(NULL, NULL)-1))) {
10343 numpunct_char *numpunct;
10345 if(loc) {
10346 numpunct = numpunct_char_use_facet(loc);
10347 }else {
10348 numpunct = MSVCRT_operator_new(sizeof(numpunct_char));
10349 if(!numpunct) {
10350 ERR("Out of memory\n");
10351 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10353 numpunct_char_ctor_locinfo(numpunct, locinfo, 0, FALSE);
10355 locale__Locimp__Addfac(locimp, &numpunct->facet, locale_id_operator_size_t(&numpunct_char_id));
10358 if(cat & (1<<(collate_char__Getcat(NULL, NULL)-1))) {
10359 collate *c;
10361 if(loc) {
10362 c = collate_char_use_facet(loc);
10363 }else {
10364 c = MSVCRT_operator_new(sizeof(collate));
10365 if(!c) {
10366 ERR("Out of memory\n");
10367 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10369 collate_char_ctor_locinfo(c, locinfo, 0);
10371 locale__Locimp__Addfac(locimp, &c->facet, locale_id_operator_size_t(&collate_char_id));
10374 if(cat & (1<<(time_get_char__Getcat(NULL, NULL)-1))) {
10375 time_get_char *t;
10377 if(loc) {
10378 t = time_get_char_use_facet(loc);
10379 }else {
10380 t = MSVCRT_operator_new(sizeof(time_get_char));
10381 if(!t) {
10382 ERR("Out of memory\n");
10383 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10385 time_get_char_ctor_locinfo(t, locinfo, 0);
10387 locale__Locimp__Addfac(locimp, &t->facet, locale_id_operator_size_t(&time_get_char_id));
10390 if(cat & (1<<(time_put_char__Getcat(NULL, NULL)-1))) {
10391 time_put *t;
10393 if(loc) {
10394 t = time_put_char_use_facet(loc);
10395 }else {
10396 t = MSVCRT_operator_new(sizeof(time_put));
10397 if(!t) {
10398 ERR("Out of memory\n");
10399 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10401 time_put_char_ctor_locinfo(t, locinfo, 0);
10403 locale__Locimp__Addfac(locimp, &t->facet, locale_id_operator_size_t(&time_put_char_id));
10406 if(cat & (1<<(codecvt_char__Getcat(NULL, NULL)-1))) {
10407 codecvt_char *codecvt;
10409 if(loc) {
10410 codecvt = codecvt_char_use_facet(loc);
10411 }else {
10412 codecvt = MSVCRT_operator_new(sizeof(codecvt_char));
10413 if(!codecvt) {
10414 ERR("Out of memory\n");
10415 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10417 codecvt_char_ctor_locinfo(codecvt, locinfo, 0);
10419 locale__Locimp__Addfac(locimp, &codecvt->base.facet, locale_id_operator_size_t(&codecvt_char_id));
10423 /* ?_Makeloc@_Locimp@locale@std@@CAPAV123@ABV_Locinfo@3@HPAV123@PBV23@@Z */
10424 /* ?_Makeloc@_Locimp@locale@std@@CAPEAV123@AEBV_Locinfo@3@HPEAV123@PEBV23@@Z */
10425 locale__Locimp* __cdecl locale__Locimp__Makeloc(const _Locinfo *locinfo, category cat, locale__Locimp *locimp, const locale *loc)
10427 TRACE("(%p %d %p %p)\n", locinfo, cat, locimp, loc);
10429 locale__Locimp__Makexloc(locinfo, cat, locimp, loc);
10430 locale__Locimp__Makewloc(locinfo, cat, locimp, loc);
10431 locale__Locimp__Makeushloc(locinfo, cat, locimp, loc);
10433 locimp->catmask |= cat;
10434 locale_string_char_assign(&locimp->name, &locinfo->newlocname);
10435 return locimp;
10438 /* ??_7_Locimp@locale@std@@6B@ */
10439 const vtable_ptr MSVCP_locale__Locimp_vtable[] = {
10440 (vtable_ptr)THISCALL_NAME(locale__Locimp_vector_dtor)
10443 /* ??0locale@std@@AAE@PAV_Locimp@01@@Z */
10444 /* ??0locale@std@@AEAA@PEAV_Locimp@01@@Z */
10445 DEFINE_THISCALL_WRAPPER(locale_ctor_locimp, 8)
10446 locale* __thiscall locale_ctor_locimp(locale *this, locale__Locimp *locimp)
10448 TRACE("(%p %p)\n", this, locimp);
10449 /* Don't change locimp reference counter */
10450 this->ptr = locimp;
10451 return this;
10454 /* ?_Init@locale@std@@CAPAV_Locimp@12@XZ */
10455 /* ?_Init@locale@std@@CAPEAV_Locimp@12@XZ */
10456 locale__Locimp* __cdecl locale__Init(void)
10458 _Lockit lock;
10460 TRACE("\n");
10462 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
10463 if(global_locale) {
10464 _Lockit_dtor(&lock);
10465 return global_locale;
10468 global_locale = MSVCRT_operator_new(sizeof(locale__Locimp));
10469 if(!global_locale) {
10470 _Lockit_dtor(&lock);
10471 ERR("Out of memory\n");
10472 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10473 return NULL;
10476 locale__Locimp_ctor(global_locale);
10477 global_locale->catmask = (1<<(LC_MAX+1))-1;
10478 locale_string_char_dtor(&global_locale->name);
10479 locale_string_char_ctor_cstr(&global_locale->name, "C");
10481 locale__Locimp__Clocptr = global_locale;
10482 global_locale->facet.refs++;
10483 locale_ctor_locimp(&classic_locale, locale__Locimp__Clocptr);
10484 _Lockit_dtor(&lock);
10486 return global_locale;
10489 /* ?_Init@locale@std@@CAPAV_Locimp@12@_N@Z */
10490 /* ?_Init@locale@std@@CAPEAV_Locimp@12@_N@Z */
10491 locale__Locimp* __cdecl locale__Init_ref(MSVCP_bool inc_ref)
10493 locale__Locimp *ret;
10494 _Lockit lock;
10496 TRACE("(%x)\n", inc_ref);
10498 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
10499 if(inc_ref && global_locale) {
10500 call_locale_facet__Incref(&global_locale->facet);
10501 _Lockit_dtor(&lock);
10502 return global_locale;
10505 ret = locale__Init();
10506 _Lockit_dtor(&lock);
10507 return ret;
10510 /* ?_Iscloc@locale@std@@QBE_NXZ */
10511 /* ?_Iscloc@locale@std@@QEBA_NXZ */
10512 DEFINE_THISCALL_WRAPPER(locale__Iscloc, 4)
10513 MSVCP_bool __thiscall locale__Iscloc(const locale *this)
10515 TRACE("(%p)\n", this);
10516 return this->ptr == locale__Locimp__Clocptr;
10519 /* ??0locale@std@@QAE@ABV01@0H@Z */
10520 /* ??0locale@std@@QEAA@AEBV01@0H@Z */
10521 DEFINE_THISCALL_WRAPPER(locale_ctor_locale_locale, 16)
10522 locale* __thiscall locale_ctor_locale_locale(locale *this, const locale *loc, const locale *other, category cat)
10524 _Locinfo locinfo;
10526 TRACE("(%p %p %p %d)\n", this, loc, other, cat);
10528 this->ptr = MSVCRT_operator_new(sizeof(locale__Locimp));
10529 if(!this->ptr) {
10530 ERR("Out of memory\n");
10531 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10533 locale__Locimp_copy_ctor(this->ptr, loc->ptr);
10535 _Locinfo_ctor_cat_cstr(&locinfo, loc->ptr->catmask, locale_string_char_c_str(&loc->ptr->name));
10536 _Locinfo__Addcats(&locinfo, cat & other->ptr->catmask, locale_string_char_c_str(&other->ptr->name));
10537 locale__Locimp__Makeloc(&locinfo, cat, this->ptr, other);
10538 _Locinfo_dtor(&locinfo);
10540 return this;
10543 /* ??0locale@std@@QAE@ABV01@@Z */
10544 /* ??0locale@std@@QEAA@AEBV01@@Z */
10545 DEFINE_THISCALL_WRAPPER(locale_copy_ctor, 8)
10546 locale* __thiscall locale_copy_ctor(locale *this, const locale *copy)
10548 TRACE("(%p %p)\n", this, copy);
10549 this->ptr = copy->ptr;
10550 call_locale_facet__Incref(&this->ptr->facet);
10551 return this;
10554 /* ??0locale@std@@QAE@ABV01@PBDH@Z */
10555 /* ??0locale@std@@QEAA@AEBV01@PEBDH@Z */
10556 DEFINE_THISCALL_WRAPPER(locale_ctor_locale_cstr, 16)
10557 locale* __thiscall locale_ctor_locale_cstr(locale *this, const locale *loc, const char *locname, category cat)
10559 _Locinfo locinfo;
10561 TRACE("(%p %p %s %d)\n", this, loc, locname, cat);
10563 _Locinfo_ctor_cat_cstr(&locinfo, cat, locname);
10564 if(!memcmp(locale_string_char_c_str(&locinfo.newlocname), "*", 2)) {
10565 _Locinfo_dtor(&locinfo);
10566 MSVCRT_operator_delete(this->ptr);
10567 throw_exception(EXCEPTION_RUNTIME_ERROR, "bad locale name");
10570 this->ptr = MSVCRT_operator_new(sizeof(locale__Locimp));
10571 if(!this->ptr) {
10572 ERR("Out of memory\n");
10573 _Locinfo_dtor(&locinfo);
10574 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10576 locale__Locimp_copy_ctor(this->ptr, loc->ptr);
10578 locale__Locimp__Makeloc(&locinfo, cat, this->ptr, NULL);
10579 _Locinfo_dtor(&locinfo);
10580 return this;
10583 /* ??0locale@std@@QAE@PBDH@Z */
10584 /* ??0locale@std@@QEAA@PEBDH@Z */
10585 DEFINE_THISCALL_WRAPPER(locale_ctor_cstr, 12)
10586 locale* __thiscall locale_ctor_cstr(locale *this, const char *locname, category cat)
10588 _Locinfo locinfo;
10590 TRACE("(%p %s %d)\n", this, locname, cat);
10592 this->ptr = MSVCRT_operator_new(sizeof(locale__Locimp));
10593 if(!this->ptr) {
10594 ERR("Out of memory\n");
10595 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10597 locale__Locimp_ctor(this->ptr);
10599 locale__Init();
10601 _Locinfo_ctor_cat_cstr(&locinfo, cat, locname);
10602 if(!memcmp(locale_string_char_c_str(&locinfo.newlocname), "*", 2)) {
10603 _Locinfo_dtor(&locinfo);
10604 MSVCRT_operator_delete(this->ptr);
10605 throw_exception(EXCEPTION_RUNTIME_ERROR, "bad locale name");
10608 locale__Locimp__Makeloc(&locinfo, cat, this->ptr, NULL);
10609 _Locinfo_dtor(&locinfo);
10611 return this;
10614 /* ??0locale@std@@QAE@W4_Uninitialized@1@@Z */
10615 /* ??0locale@std@@QEAA@W4_Uninitialized@1@@Z */
10616 DEFINE_THISCALL_WRAPPER(locale_ctor_uninitialized, 8)
10617 locale* __thiscall locale_ctor_uninitialized(locale *this, int uninitialized)
10619 TRACE("(%p)\n", this);
10620 this->ptr = NULL;
10621 return this;
10624 /* ??0locale@std@@QAE@XZ */
10625 /* ??0locale@std@@QEAA@XZ */
10626 DEFINE_THISCALL_WRAPPER(locale_ctor, 4)
10627 locale* __thiscall locale_ctor(locale *this)
10629 TRACE("(%p)\n", this);
10630 this->ptr = locale__Init();
10631 call_locale_facet__Incref(&this->ptr->facet);
10632 return this;
10635 /* ??1locale@std@@QAE@XZ */
10636 /* ??1locale@std@@QEAA@XZ */
10637 DEFINE_THISCALL_WRAPPER(locale_dtor, 4)
10638 void __thiscall locale_dtor(locale *this)
10640 TRACE("(%p)\n", this);
10641 if(this->ptr && call_locale_facet__Decref(&this->ptr->facet))
10643 locale__Locimp_dtor(this->ptr);
10644 MSVCRT_operator_delete(this->ptr);
10648 /* ??4locale@std@@QAEAAV01@ABV01@@Z */
10649 /* ??4locale@std@@QEAAAEAV01@AEBV01@@Z */
10650 DEFINE_THISCALL_WRAPPER(locale_operator_assign, 8)
10651 locale* __thiscall locale_operator_assign(locale *this, const locale *loc)
10653 FIXME("(%p %p) stub\n", this, loc);
10654 return NULL;
10657 /* ??8locale@std@@QBE_NABV01@@Z */
10658 /* ??8locale@std@@QEBA_NAEBV01@@Z */
10659 DEFINE_THISCALL_WRAPPER(locale_operator_equal, 8)
10660 MSVCP_bool __thiscall locale_operator_equal(const locale *this, const locale *loc)
10662 FIXME("(%p %p) stub\n", this, loc);
10663 return 0;
10666 /* ??9locale@std@@QBE_NABV01@@Z */
10667 /* ??9locale@std@@QEBA_NAEBV01@@Z */
10668 DEFINE_THISCALL_WRAPPER(locale_operator_not_equal, 8)
10669 MSVCP_bool __thiscall locale_operator_not_equal(const locale *this, locale const *loc)
10671 FIXME("(%p %p) stub\n", this, loc);
10672 return 0;
10675 /* ?_Addfac@locale@std@@QAEAAV12@PAVfacet@12@II@Z */
10676 /* ?_Addfac@locale@std@@QEAAAEAV12@PEAVfacet@12@_K1@Z */
10677 DEFINE_THISCALL_WRAPPER(locale__Addfac, 16)
10678 locale* __thiscall locale__Addfac(locale *this, locale_facet *facet, MSVCP_size_t id, MSVCP_size_t catmask)
10680 TRACE("(%p %p %lu %lu)\n", this, facet, id, catmask);
10682 if(this->ptr->facet.refs > 1) {
10683 locale__Locimp *new_ptr = MSVCRT_operator_new(sizeof(locale__Locimp));
10684 if(!new_ptr) {
10685 ERR("Out of memory\n");
10686 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10687 return NULL;
10689 locale__Locimp_copy_ctor(new_ptr, this->ptr);
10690 call_locale_facet__Decref(&this->ptr->facet);
10691 this->ptr = new_ptr;
10694 locale__Locimp__Addfac(this->ptr, facet, id);
10696 if(catmask) {
10697 locale_string_char_dtor(&this->ptr->name);
10698 locale_string_char_ctor_cstr(&this->ptr->name, "*");
10700 return this;
10703 /* ?_Getfacet@locale@std@@QBEPBVfacet@12@I_N@Z */
10704 /* ?_Getfacet@locale@std@@QEBAPEBVfacet@12@_K_N@Z */
10705 DEFINE_THISCALL_WRAPPER(locale__Getfacet_bool, 12)
10706 const locale_facet* __thiscall locale__Getfacet_bool(const locale *this,
10707 MSVCP_size_t id, MSVCP_bool allow_transparent)
10709 locale_facet *fac;
10711 TRACE("(%p %lu)\n", this, id);
10713 fac = id < this->ptr->facet_cnt ? this->ptr->facetvec[id] : NULL;
10714 if(fac || !this->ptr->transparent || !allow_transparent)
10715 return fac;
10717 return id < global_locale->facet_cnt ? global_locale->facetvec[id] : NULL;
10720 /* ?_Getfacet@locale@std@@QBEPBVfacet@12@I@Z */
10721 /* ?_Getfacet@locale@std@@QEBAPEBVfacet@12@_K@Z */
10722 DEFINE_THISCALL_WRAPPER(locale__Getfacet, 8)
10723 const locale_facet* __thiscall locale__Getfacet(const locale *this, MSVCP_size_t id)
10725 return locale__Getfacet_bool( this, id, TRUE );
10728 /* ?_Getgloballocale@locale@std@@CAPAV_Locimp@12@XZ */
10729 /* ?_Getgloballocale@locale@std@@CAPEAV_Locimp@12@XZ */
10730 locale__Locimp* __cdecl locale__Getgloballocale(void)
10732 TRACE("\n");
10733 return global_locale;
10736 /* ?_Setgloballocale@locale@std@@CAXPAX@Z */
10737 /* ?_Setgloballocale@locale@std@@CAXPEAX@Z */
10738 void __cdecl locale__Setgloballocale(void *locimp)
10740 TRACE("(%p)\n", locimp);
10741 global_locale = locimp;
10744 /* ?classic@locale@std@@SAABV12@XZ */
10745 /* ?classic@locale@std@@SAAEBV12@XZ */
10746 const locale* __cdecl locale_classic(void)
10748 TRACE("\n");
10749 locale__Init();
10750 return &classic_locale;
10753 /* ?empty@locale@std@@SA?AV12@XZ */
10754 locale* __cdecl locale_empty(locale *ret)
10756 TRACE("\n");
10758 locale__Init();
10760 ret->ptr = MSVCRT_operator_new(sizeof(locale__Locimp));
10761 if(!ret->ptr) {
10762 ERR("Out of memory\n");
10763 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10765 locale__Locimp_ctor_transparent(ret->ptr, TRUE);
10766 return ret;
10769 /* ?global@locale@std@@SA?AV12@ABV12@@Z */
10770 /* ?global@locale@std@@SA?AV12@AEBV12@@Z */
10771 locale* __cdecl locale_global(locale *ret, const locale *loc)
10773 _Lockit lock;
10774 int i;
10776 TRACE("(%p %p)\n", loc, ret);
10778 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
10779 locale_ctor(ret);
10781 if(loc->ptr != global_locale) {
10782 call_locale_facet__Decref(&global_locale->facet);
10783 global_locale = loc->ptr;
10784 call_locale_facet__Incref(&global_locale->facet);
10786 for(i=LC_ALL+1; i<=LC_MAX; i++) {
10787 if((global_locale->catmask & (1<<(i-1))) == 0)
10788 continue;
10789 setlocale(i, locale_string_char_c_str(&global_locale->name));
10792 _Lockit_dtor(&lock);
10793 return ret;
10796 #if _MSVCP_VER < 100
10798 /* ?_Getname@_Locinfo@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
10799 /* ?_Getname@_Locinfo@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
10800 DEFINE_THISCALL_WRAPPER(_Locinfo__Getname, 8)
10801 basic_string_char* __thiscall _Locinfo__Getname(const _Locinfo *this, basic_string_char *ret)
10803 TRACE("(%p)\n", this);
10805 MSVCP_basic_string_char_copy_ctor(ret, &this->newlocname);
10806 return ret;
10809 /* ?name@locale@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
10810 /* ?name@locale@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
10811 DEFINE_THISCALL_WRAPPER(locale_name, 8)
10812 basic_string_char* __thiscall locale_name(const locale *this, basic_string_char *ret)
10814 TRACE( "(%p)\n", this);
10815 MSVCP_basic_string_char_copy_ctor(ret, &this->ptr->name);
10816 return ret;
10819 #else
10821 /* ?_Getname@_Locinfo@std@@QBEPBDXZ */
10822 /* ?_Getname@_Locinfo@std@@QEBAPEBDXZ */
10823 DEFINE_THISCALL_WRAPPER(_Locinfo__Getname, 4)
10824 const char * __thiscall _Locinfo__Getname( const _Locinfo *this )
10826 return locale_string_char_c_str( &this->newlocname );
10829 #endif /* _MSVCP_VER < 100 */
10831 /* wctrans */
10832 wctrans_t __cdecl wctrans(const char *property)
10834 static const char str_tolower[] = "tolower";
10835 static const char str_toupper[] = "toupper";
10837 if(!strcmp(property, str_tolower))
10838 return 2;
10839 if(!strcmp(property, str_toupper))
10840 return 1;
10841 return 0;
10844 /* towctrans */
10845 wint_t __cdecl towctrans(wint_t c, wctrans_t category)
10847 if(category == 1)
10848 return towupper(c);
10849 return towlower(c);
10852 /* btowc */
10853 wint_t __cdecl btowc(int c)
10855 wchar_t ret;
10856 int state = 0;
10857 char ch = c;
10859 if (c == EOF || _Mbrtowc( &ret, &ch, 1, &state, NULL ) != 1) return WEOF;
10860 return ret;
10863 /* mbrlen */
10864 size_t __cdecl mbrlen(const char *str, size_t n, mbstate_t *state)
10866 static int local_state;
10868 if (!state) state = &local_state;
10869 return _Mbrtowc( NULL, str, n, state, NULL );
10872 /* mbrtowc */
10873 size_t __cdecl mbrtowc(wchar_t *dst, const char *str, size_t n, mbstate_t *state)
10875 static int local_state;
10877 if (!state) state = &local_state;
10878 return _Mbrtowc( dst, str, n, state, NULL );
10881 /* mbsrtowcs */
10882 size_t __cdecl mbsrtowcs(wchar_t *dst, const char **pstr, size_t n, mbstate_t *state)
10884 static int local_state;
10885 size_t ret = 0;
10886 wchar_t wc;
10887 const char *src;
10889 src = *pstr;
10890 if (!state) state = &local_state;
10892 while (!dst || n > ret)
10894 int len = _Mbrtowc( &wc, src, 2, state, NULL );
10895 if (len < 0) return -1;
10896 if (!len) break;
10897 if (dst) dst[ret] = wc;
10898 ret++;
10899 if (!wc) break;
10900 src += len;
10902 return ret;
10905 /* wctob */
10906 int __cdecl wctob(wint_t wc)
10908 char ret[MB_LEN_MAX];
10910 if (wc == WEOF || _Wcrtomb( ret, wc, NULL, NULL ) != 1) return EOF;
10911 return ret[0];
10914 /* wcrtomb */
10915 size_t __cdecl wcrtomb(char *dst, wchar_t wc, mbstate_t *state)
10917 return _Wcrtomb( dst, wc, state, NULL );
10920 /* wcsrtombs */
10921 size_t __cdecl wcsrtombs(char *dst, const wchar_t **pstr, size_t n, mbstate_t *state)
10923 const wchar_t *src;
10924 char buffer[MB_LEN_MAX];
10925 size_t ret = 0;
10927 src = *pstr;
10929 while (!dst || n > ret)
10931 int len = _Wcrtomb( buffer, *src, state, NULL );
10932 if (len <= 0) return -1;
10933 if (n < ret + len) break;
10934 memcpy( dst + ret, buffer, len );
10935 ret += len;
10936 if (!buffer[0]) break;
10937 src++;
10939 return ret;
10943 DEFINE_RTTI_DATA0(locale_facet, 0, ".?AVfacet@locale@std@@")
10944 DEFINE_RTTI_DATA1(collate_char, 0, &locale_facet_rtti_base_descriptor, ".?AV?$collate@D@std@@")
10945 DEFINE_RTTI_DATA1(collate_wchar, 0, &locale_facet_rtti_base_descriptor, ".?AV?$collate@_W@std@@")
10946 DEFINE_RTTI_DATA1(collate_short, 0, &locale_facet_rtti_base_descriptor, ".?AV?$collate@G@std@@")
10947 DEFINE_RTTI_DATA1(ctype_base, 0, &locale_facet_rtti_base_descriptor, ".?AUctype_base@std@@")
10948 DEFINE_RTTI_DATA2(ctype_char, 0, &ctype_base_rtti_base_descriptor, &locale_facet_rtti_base_descriptor, ".?AV?$ctype@D@std@@")
10949 DEFINE_RTTI_DATA2(ctype_wchar, 0, &ctype_base_rtti_base_descriptor, &locale_facet_rtti_base_descriptor, ".?AV?$ctype@_W@std@@")
10950 DEFINE_RTTI_DATA2(ctype_short, 0, &ctype_base_rtti_base_descriptor, &locale_facet_rtti_base_descriptor, ".?AV?$ctype@G@std@@")
10951 DEFINE_RTTI_DATA1(codecvt_base, 0, &locale_facet_rtti_base_descriptor, ".?AVcodecvt_base@std@@")
10952 DEFINE_RTTI_DATA2(codecvt_char, 0, &codecvt_base_rtti_base_descriptor, &locale_facet_rtti_base_descriptor, ".?AV?$codecvt@DDH@std@@")
10953 DEFINE_RTTI_DATA2(codecvt_wchar, 0, &codecvt_base_rtti_base_descriptor, &locale_facet_rtti_base_descriptor, ".?AV?$codecvt@_WDH@std@@")
10954 DEFINE_RTTI_DATA2(codecvt_short, 0, &codecvt_base_rtti_base_descriptor, &locale_facet_rtti_base_descriptor, ".?AV?$codecvt@GDH@std@@")
10955 DEFINE_RTTI_DATA1(numpunct_char, 0, &locale_facet_rtti_base_descriptor, ".?AV?$numpunct@D@std@@")
10956 DEFINE_RTTI_DATA1(numpunct_wchar, 0, &locale_facet_rtti_base_descriptor, ".?AV?$numpunct@_W@std@@")
10957 DEFINE_RTTI_DATA1(numpunct_short, 0, &locale_facet_rtti_base_descriptor, ".?AV?$numpunct@G@std@@")
10958 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@@")
10959 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@@")
10960 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@@")
10961 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@@")
10962 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@@")
10963 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@@")
10964 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@@")
10965 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@@")
10966 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@@")
10967 DEFINE_RTTI_DATA1(time_base, 0, &locale_facet_rtti_base_descriptor, ".?AUtime_base@std@@")
10968 DEFINE_RTTI_DATA2(time_get_char, 0, &time_base_rtti_base_descriptor, &locale_facet_rtti_base_descriptor, ".?AV?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@")
10970 #ifndef __GNUC__
10971 void __asm_dummy_vtables(void) {
10972 #endif
10973 __ASM_VTABLE(locale_facet,
10974 VTABLE_ADD_FUNC(locale_facet_vector_dtor)
10975 #if _MSVCP_VER >= 110
10976 VTABLE_ADD_FUNC(locale_facet__Incref)
10977 VTABLE_ADD_FUNC(locale_facet__Decref)
10978 #endif
10980 __ASM_VTABLE(collate_char,
10981 VTABLE_ADD_FUNC(collate_char_vector_dtor)
10982 #if _MSVCP_VER >= 110
10983 VTABLE_ADD_FUNC(locale_facet__Incref)
10984 VTABLE_ADD_FUNC(locale_facet__Decref)
10985 #endif
10986 VTABLE_ADD_FUNC(collate_char_do_compare)
10987 VTABLE_ADD_FUNC(collate_char_do_transform)
10988 VTABLE_ADD_FUNC(collate_char_do_hash));
10989 __ASM_VTABLE(collate_wchar,
10990 VTABLE_ADD_FUNC(collate_wchar_vector_dtor)
10991 #if _MSVCP_VER >= 110
10992 VTABLE_ADD_FUNC(locale_facet__Incref)
10993 VTABLE_ADD_FUNC(locale_facet__Decref)
10994 #endif
10995 VTABLE_ADD_FUNC(collate_wchar_do_compare)
10996 VTABLE_ADD_FUNC(collate_wchar_do_transform)
10997 VTABLE_ADD_FUNC(collate_wchar_do_hash));
10998 __ASM_VTABLE(collate_short,
10999 VTABLE_ADD_FUNC(collate_wchar_vector_dtor)
11000 #if _MSVCP_VER >= 110
11001 VTABLE_ADD_FUNC(locale_facet__Incref)
11002 VTABLE_ADD_FUNC(locale_facet__Decref)
11003 #endif
11004 VTABLE_ADD_FUNC(collate_wchar_do_compare)
11005 VTABLE_ADD_FUNC(collate_wchar_do_transform)
11006 VTABLE_ADD_FUNC(collate_wchar_do_hash));
11007 __ASM_VTABLE(ctype_base,
11008 VTABLE_ADD_FUNC(ctype_base_vector_dtor)
11009 #if _MSVCP_VER >= 110
11010 VTABLE_ADD_FUNC(locale_facet__Incref)
11011 VTABLE_ADD_FUNC(locale_facet__Decref)
11012 #endif
11014 __ASM_VTABLE(ctype_char,
11015 VTABLE_ADD_FUNC(ctype_char_vector_dtor)
11016 #if _MSVCP_VER >= 110
11017 VTABLE_ADD_FUNC(locale_facet__Incref)
11018 VTABLE_ADD_FUNC(locale_facet__Decref)
11019 #endif
11020 VTABLE_ADD_FUNC(ctype_char_do_tolower)
11021 VTABLE_ADD_FUNC(ctype_char_do_tolower_ch)
11022 VTABLE_ADD_FUNC(ctype_char_do_toupper)
11023 VTABLE_ADD_FUNC(ctype_char_do_toupper_ch)
11024 VTABLE_ADD_FUNC(ctype_char_do_widen)
11025 VTABLE_ADD_FUNC(ctype_char_do_widen_ch)
11026 #if _MSVCP_VER >= 80 && _MSVCP_VER <= 90
11027 VTABLE_ADD_FUNC(ctype_char__Do_widen_s)
11028 VTABLE_ADD_FUNC(ctype_char_do_narrow)
11029 VTABLE_ADD_FUNC(ctype_char_do_narrow_ch)
11030 VTABLE_ADD_FUNC(ctype_char__Do_narrow_s)
11031 #else
11032 VTABLE_ADD_FUNC(ctype_char_do_narrow)
11033 VTABLE_ADD_FUNC(ctype_char_do_narrow_ch)
11034 #endif
11036 __ASM_VTABLE(ctype_wchar,
11037 VTABLE_ADD_FUNC(ctype_wchar_vector_dtor)
11038 #if _MSVCP_VER >= 110
11039 VTABLE_ADD_FUNC(locale_facet__Incref)
11040 VTABLE_ADD_FUNC(locale_facet__Decref)
11041 #endif
11042 VTABLE_ADD_FUNC(ctype_wchar_do_is)
11043 VTABLE_ADD_FUNC(ctype_wchar_do_is_ch)
11044 VTABLE_ADD_FUNC(ctype_wchar_do_scan_is)
11045 VTABLE_ADD_FUNC(ctype_wchar_do_scan_not)
11046 VTABLE_ADD_FUNC(ctype_wchar_do_tolower)
11047 VTABLE_ADD_FUNC(ctype_wchar_do_tolower_ch)
11048 VTABLE_ADD_FUNC(ctype_wchar_do_toupper)
11049 VTABLE_ADD_FUNC(ctype_wchar_do_toupper_ch)
11050 VTABLE_ADD_FUNC(ctype_wchar_do_widen)
11051 VTABLE_ADD_FUNC(ctype_wchar_do_widen_ch)
11052 #if _MSVCP_VER >= 80 && _MSVCP_VER <= 90
11053 VTABLE_ADD_FUNC(ctype_wchar__Do_widen_s)
11054 VTABLE_ADD_FUNC(ctype_wchar_do_narrow)
11055 VTABLE_ADD_FUNC(ctype_wchar_do_narrow_ch)
11056 VTABLE_ADD_FUNC(ctype_wchar__Do_narrow_s)
11057 #else
11058 VTABLE_ADD_FUNC(ctype_wchar_do_narrow)
11059 VTABLE_ADD_FUNC(ctype_wchar_do_narrow_ch)
11060 #endif
11062 __ASM_VTABLE(ctype_short,
11063 VTABLE_ADD_FUNC(ctype_wchar_vector_dtor)
11064 #if _MSVCP_VER >= 110
11065 VTABLE_ADD_FUNC(locale_facet__Incref)
11066 VTABLE_ADD_FUNC(locale_facet__Decref)
11067 #endif
11068 VTABLE_ADD_FUNC(ctype_wchar_do_is)
11069 VTABLE_ADD_FUNC(ctype_wchar_do_is_ch)
11070 VTABLE_ADD_FUNC(ctype_wchar_do_scan_is)
11071 VTABLE_ADD_FUNC(ctype_wchar_do_scan_not)
11072 VTABLE_ADD_FUNC(ctype_wchar_do_tolower)
11073 VTABLE_ADD_FUNC(ctype_wchar_do_tolower_ch)
11074 VTABLE_ADD_FUNC(ctype_wchar_do_toupper)
11075 VTABLE_ADD_FUNC(ctype_wchar_do_toupper_ch)
11076 VTABLE_ADD_FUNC(ctype_wchar_do_widen)
11077 VTABLE_ADD_FUNC(ctype_wchar_do_widen_ch)
11078 #if _MSVCP_VER >= 80 && _MSVCP_VER <= 90
11079 VTABLE_ADD_FUNC(ctype_wchar__Do_widen_s)
11080 VTABLE_ADD_FUNC(ctype_wchar_do_narrow)
11081 VTABLE_ADD_FUNC(ctype_wchar_do_narrow_ch)
11082 VTABLE_ADD_FUNC(ctype_wchar__Do_narrow_s)
11083 #else
11084 VTABLE_ADD_FUNC(ctype_wchar_do_narrow)
11085 VTABLE_ADD_FUNC(ctype_wchar_do_narrow_ch)
11086 #endif
11088 __ASM_VTABLE(codecvt_base,
11089 VTABLE_ADD_FUNC(codecvt_base_vector_dtor)
11090 #if _MSVCP_VER >= 110
11091 VTABLE_ADD_FUNC(locale_facet__Incref)
11092 VTABLE_ADD_FUNC(locale_facet__Decref)
11093 #endif
11094 VTABLE_ADD_FUNC(codecvt_base_do_always_noconv)
11095 VTABLE_ADD_FUNC(codecvt_base_do_max_length)
11096 VTABLE_ADD_FUNC(codecvt_base_do_encoding));
11097 __ASM_VTABLE(codecvt_char,
11098 VTABLE_ADD_FUNC(codecvt_char_vector_dtor)
11099 #if _MSVCP_VER >= 110
11100 VTABLE_ADD_FUNC(locale_facet__Incref)
11101 VTABLE_ADD_FUNC(locale_facet__Decref)
11102 #endif
11103 VTABLE_ADD_FUNC(codecvt_base_do_always_noconv)
11104 VTABLE_ADD_FUNC(codecvt_base_do_max_length)
11105 VTABLE_ADD_FUNC(codecvt_base_do_encoding)
11106 VTABLE_ADD_FUNC(codecvt_char_do_in)
11107 VTABLE_ADD_FUNC(codecvt_char_do_out)
11108 VTABLE_ADD_FUNC(codecvt_char_do_unshift)
11109 VTABLE_ADD_FUNC(codecvt_char_do_length));
11110 __ASM_VTABLE(codecvt_wchar,
11111 VTABLE_ADD_FUNC(codecvt_wchar_vector_dtor)
11112 #if _MSVCP_VER >= 110
11113 VTABLE_ADD_FUNC(locale_facet__Incref)
11114 VTABLE_ADD_FUNC(locale_facet__Decref)
11115 #endif
11116 VTABLE_ADD_FUNC(codecvt_wchar_do_always_noconv)
11117 VTABLE_ADD_FUNC(codecvt_wchar_do_max_length)
11118 VTABLE_ADD_FUNC(codecvt_base_do_encoding)
11119 VTABLE_ADD_FUNC(codecvt_wchar_do_in)
11120 VTABLE_ADD_FUNC(codecvt_wchar_do_out)
11121 VTABLE_ADD_FUNC(codecvt_wchar_do_unshift)
11122 VTABLE_ADD_FUNC(codecvt_wchar_do_length));
11123 __ASM_VTABLE(codecvt_short,
11124 VTABLE_ADD_FUNC(codecvt_wchar_vector_dtor)
11125 #if _MSVCP_VER >= 110
11126 VTABLE_ADD_FUNC(locale_facet__Incref)
11127 VTABLE_ADD_FUNC(locale_facet__Decref)
11128 #endif
11129 VTABLE_ADD_FUNC(codecvt_wchar_do_always_noconv)
11130 VTABLE_ADD_FUNC(codecvt_wchar_do_max_length)
11131 VTABLE_ADD_FUNC(codecvt_base_do_encoding)
11132 VTABLE_ADD_FUNC(codecvt_wchar_do_in)
11133 VTABLE_ADD_FUNC(codecvt_wchar_do_out)
11134 VTABLE_ADD_FUNC(codecvt_wchar_do_unshift)
11135 VTABLE_ADD_FUNC(codecvt_wchar_do_length));
11136 __ASM_VTABLE(numpunct_char,
11137 VTABLE_ADD_FUNC(numpunct_char_vector_dtor)
11138 #if _MSVCP_VER >= 110
11139 VTABLE_ADD_FUNC(locale_facet__Incref)
11140 VTABLE_ADD_FUNC(locale_facet__Decref)
11141 #endif
11142 VTABLE_ADD_FUNC(numpunct_char_do_decimal_point)
11143 VTABLE_ADD_FUNC(numpunct_char_do_thousands_sep)
11144 VTABLE_ADD_FUNC(numpunct_char_do_grouping)
11145 VTABLE_ADD_FUNC(numpunct_char_do_falsename)
11146 VTABLE_ADD_FUNC(numpunct_char_do_truename));
11147 __ASM_VTABLE(numpunct_wchar,
11148 VTABLE_ADD_FUNC(numpunct_wchar_vector_dtor)
11149 #if _MSVCP_VER >= 110
11150 VTABLE_ADD_FUNC(locale_facet__Incref)
11151 VTABLE_ADD_FUNC(locale_facet__Decref)
11152 #endif
11153 VTABLE_ADD_FUNC(numpunct_wchar_do_decimal_point)
11154 VTABLE_ADD_FUNC(numpunct_wchar_do_thousands_sep)
11155 VTABLE_ADD_FUNC(numpunct_wchar_do_grouping)
11156 VTABLE_ADD_FUNC(numpunct_wchar_do_falsename)
11157 VTABLE_ADD_FUNC(numpunct_wchar_do_truename));
11158 __ASM_VTABLE(numpunct_short,
11159 VTABLE_ADD_FUNC(numpunct_wchar_vector_dtor)
11160 #if _MSVCP_VER >= 110
11161 VTABLE_ADD_FUNC(locale_facet__Incref)
11162 VTABLE_ADD_FUNC(locale_facet__Decref)
11163 #endif
11164 VTABLE_ADD_FUNC(numpunct_wchar_do_decimal_point)
11165 VTABLE_ADD_FUNC(numpunct_wchar_do_thousands_sep)
11166 VTABLE_ADD_FUNC(numpunct_wchar_do_grouping)
11167 VTABLE_ADD_FUNC(numpunct_wchar_do_falsename)
11168 VTABLE_ADD_FUNC(numpunct_wchar_do_truename));
11169 __ASM_VTABLE(num_get_char,
11170 VTABLE_ADD_FUNC(num_get_char_vector_dtor)
11171 #if _MSVCP_VER >= 110
11172 VTABLE_ADD_FUNC(locale_facet__Incref)
11173 VTABLE_ADD_FUNC(locale_facet__Decref)
11174 #endif
11175 VTABLE_ADD_FUNC(num_get_char_do_get_void)
11176 VTABLE_ADD_FUNC(num_get_char_do_get_double)
11177 VTABLE_ADD_FUNC(num_get_char_do_get_double)
11178 VTABLE_ADD_FUNC(num_get_char_do_get_float)
11179 VTABLE_ADD_FUNC(num_get_char_do_get_uint64)
11180 VTABLE_ADD_FUNC(num_get_char_do_get_int64)
11181 VTABLE_ADD_FUNC(num_get_char_do_get_ulong)
11182 VTABLE_ADD_FUNC(num_get_char_do_get_long)
11183 VTABLE_ADD_FUNC(num_get_char_do_get_uint)
11184 VTABLE_ADD_FUNC(num_get_char_do_get_ushort)
11185 VTABLE_ADD_FUNC(num_get_char_do_get_bool));
11186 __ASM_VTABLE(num_get_short,
11187 VTABLE_ADD_FUNC(num_get_wchar_vector_dtor)
11188 #if _MSVCP_VER >= 110
11189 VTABLE_ADD_FUNC(locale_facet__Incref)
11190 VTABLE_ADD_FUNC(locale_facet__Decref)
11191 #endif
11192 VTABLE_ADD_FUNC(num_get_short_do_get_void)
11193 VTABLE_ADD_FUNC(num_get_short_do_get_double)
11194 VTABLE_ADD_FUNC(num_get_short_do_get_double)
11195 VTABLE_ADD_FUNC(num_get_short_do_get_float)
11196 VTABLE_ADD_FUNC(num_get_short_do_get_uint64)
11197 VTABLE_ADD_FUNC(num_get_short_do_get_int64)
11198 VTABLE_ADD_FUNC(num_get_short_do_get_ulong)
11199 VTABLE_ADD_FUNC(num_get_short_do_get_long)
11200 VTABLE_ADD_FUNC(num_get_short_do_get_uint)
11201 VTABLE_ADD_FUNC(num_get_short_do_get_ushort)
11202 VTABLE_ADD_FUNC(num_get_short_do_get_bool));
11203 __ASM_VTABLE(num_get_wchar,
11204 VTABLE_ADD_FUNC(num_get_wchar_vector_dtor)
11205 #if _MSVCP_VER >= 110
11206 VTABLE_ADD_FUNC(locale_facet__Incref)
11207 VTABLE_ADD_FUNC(locale_facet__Decref)
11208 #endif
11209 VTABLE_ADD_FUNC(num_get_wchar_do_get_void)
11210 VTABLE_ADD_FUNC(num_get_wchar_do_get_double)
11211 VTABLE_ADD_FUNC(num_get_wchar_do_get_double)
11212 VTABLE_ADD_FUNC(num_get_wchar_do_get_float)
11213 VTABLE_ADD_FUNC(num_get_wchar_do_get_uint64)
11214 VTABLE_ADD_FUNC(num_get_wchar_do_get_int64)
11215 VTABLE_ADD_FUNC(num_get_wchar_do_get_ulong)
11216 VTABLE_ADD_FUNC(num_get_wchar_do_get_long)
11217 VTABLE_ADD_FUNC(num_get_wchar_do_get_uint)
11218 VTABLE_ADD_FUNC(num_get_wchar_do_get_ushort)
11219 VTABLE_ADD_FUNC(num_get_wchar_do_get_bool));
11220 __ASM_VTABLE(num_put_char,
11221 VTABLE_ADD_FUNC(num_put_char_vector_dtor)
11222 #if _MSVCP_VER >= 110
11223 VTABLE_ADD_FUNC(locale_facet__Incref)
11224 VTABLE_ADD_FUNC(locale_facet__Decref)
11225 #endif
11226 VTABLE_ADD_FUNC(num_put_char_do_put_ptr)
11227 VTABLE_ADD_FUNC(num_put_char_do_put_double)
11228 VTABLE_ADD_FUNC(num_put_char_do_put_double)
11229 VTABLE_ADD_FUNC(num_put_char_do_put_uint64)
11230 VTABLE_ADD_FUNC(num_put_char_do_put_int64)
11231 VTABLE_ADD_FUNC(num_put_char_do_put_ulong)
11232 VTABLE_ADD_FUNC(num_put_char_do_put_long)
11233 VTABLE_ADD_FUNC(num_put_char_do_put_bool));
11234 __ASM_VTABLE(num_put_wchar,
11235 VTABLE_ADD_FUNC(num_put_wchar_vector_dtor)
11236 #if _MSVCP_VER >= 110
11237 VTABLE_ADD_FUNC(locale_facet__Incref)
11238 VTABLE_ADD_FUNC(locale_facet__Decref)
11239 #endif
11240 VTABLE_ADD_FUNC(num_put_wchar_do_put_ptr)
11241 VTABLE_ADD_FUNC(num_put_wchar_do_put_double)
11242 VTABLE_ADD_FUNC(num_put_wchar_do_put_double)
11243 VTABLE_ADD_FUNC(num_put_wchar_do_put_uint64)
11244 VTABLE_ADD_FUNC(num_put_wchar_do_put_int64)
11245 VTABLE_ADD_FUNC(num_put_wchar_do_put_ulong)
11246 VTABLE_ADD_FUNC(num_put_wchar_do_put_long)
11247 VTABLE_ADD_FUNC(num_put_wchar_do_put_bool));
11248 __ASM_VTABLE(num_put_short,
11249 VTABLE_ADD_FUNC(num_put_wchar_vector_dtor)
11250 #if _MSVCP_VER >= 110
11251 VTABLE_ADD_FUNC(locale_facet__Incref)
11252 VTABLE_ADD_FUNC(locale_facet__Decref)
11253 #endif
11254 VTABLE_ADD_FUNC(num_put_short_do_put_ptr)
11255 VTABLE_ADD_FUNC(num_put_short_do_put_double)
11256 VTABLE_ADD_FUNC(num_put_short_do_put_double)
11257 VTABLE_ADD_FUNC(num_put_short_do_put_uint64)
11258 VTABLE_ADD_FUNC(num_put_short_do_put_int64)
11259 VTABLE_ADD_FUNC(num_put_short_do_put_ulong)
11260 VTABLE_ADD_FUNC(num_put_short_do_put_long)
11261 VTABLE_ADD_FUNC(num_put_short_do_put_bool));
11262 __ASM_VTABLE(time_put_char,
11263 VTABLE_ADD_FUNC(time_put_char_vector_dtor)
11264 #if _MSVCP_VER >= 110
11265 VTABLE_ADD_FUNC(locale_facet__Incref)
11266 VTABLE_ADD_FUNC(locale_facet__Decref)
11267 #endif
11268 VTABLE_ADD_FUNC(time_put_char_do_put));
11269 __ASM_VTABLE(time_put_wchar,
11270 VTABLE_ADD_FUNC(time_put_wchar_vector_dtor)
11271 #if _MSVCP_VER >= 110
11272 VTABLE_ADD_FUNC(locale_facet__Incref)
11273 VTABLE_ADD_FUNC(locale_facet__Decref)
11274 #endif
11275 VTABLE_ADD_FUNC(time_put_wchar_do_put));
11276 __ASM_VTABLE(time_put_short,
11277 VTABLE_ADD_FUNC(time_put_wchar_vector_dtor)
11278 #if _MSVCP_VER >= 110
11279 VTABLE_ADD_FUNC(locale_facet__Incref)
11280 VTABLE_ADD_FUNC(locale_facet__Decref)
11281 #endif
11282 VTABLE_ADD_FUNC(time_put_wchar_do_put));
11283 __ASM_VTABLE(time_get_char,
11284 VTABLE_ADD_FUNC(time_get_char_vector_dtor)
11285 #if _MSVCP_VER >= 110
11286 VTABLE_ADD_FUNC(locale_facet__Incref)
11287 VTABLE_ADD_FUNC(locale_facet__Decref)
11288 #endif
11289 VTABLE_ADD_FUNC(time_get_char_do_date_order)
11290 VTABLE_ADD_FUNC(time_get_char_do_get_time)
11291 VTABLE_ADD_FUNC(time_get_char_do_get_date)
11292 VTABLE_ADD_FUNC(time_get_char_do_get_weekday)
11293 VTABLE_ADD_FUNC(time_get_char_do_get_monthname)
11294 VTABLE_ADD_FUNC(time_get_char_do_get_year));
11295 #ifndef __GNUC__
11297 #endif
11299 void init_locale(void *base)
11301 #ifdef __x86_64__
11302 init_locale_facet_rtti(base);
11303 init_collate_char_rtti(base);
11304 init_collate_wchar_rtti(base);
11305 init_collate_short_rtti(base);
11306 init_ctype_base_rtti(base);
11307 init_ctype_char_rtti(base);
11308 init_ctype_wchar_rtti(base);
11309 init_ctype_short_rtti(base);
11310 init_codecvt_base_rtti(base);
11311 init_codecvt_char_rtti(base);
11312 init_codecvt_wchar_rtti(base);
11313 init_codecvt_short_rtti(base);
11314 init_numpunct_char_rtti(base);
11315 init_numpunct_wchar_rtti(base);
11316 init_numpunct_short_rtti(base);
11317 init_num_get_char_rtti(base);
11318 init_num_get_wchar_rtti(base);
11319 init_num_get_short_rtti(base);
11320 init_num_put_char_rtti(base);
11321 init_num_put_wchar_rtti(base);
11322 init_num_put_short_rtti(base);
11323 init_time_put_char_rtti(base);
11324 init_time_put_wchar_rtti(base);
11325 init_time_put_short_rtti(base);
11326 init_time_base_rtti(base);
11327 init_time_get_char_rtti(base);
11328 #endif
11331 void free_locale(void)
11333 facets_elem *iter, *safe;
11335 if(global_locale) {
11336 locale_dtor(&classic_locale);
11337 locale__Locimp_dtor(global_locale);
11338 MSVCRT_operator_delete(global_locale);
11341 LIST_FOR_EACH_ENTRY_SAFE(iter, safe, &lazy_facets, facets_elem, entry) {
11342 list_remove(&iter->entry);
11343 if(call_locale_facet__Decref(iter->fac))
11344 call_locale_facet_vector_dtor(iter->fac, 1);
11345 MSVCRT_operator_delete(iter);