libwine: Generate the composition tables access code along with the tables.
[wine.git] / dlls / msvcp90 / locale.c
blobf3ad140e52d0d0d42620819848aed7756d501ac9
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 "assert.h"
24 #include "locale.h"
25 #include "errno.h"
26 #include "limits.h"
27 #include "math.h"
28 #include "mbctype.h"
29 #include "stdio.h"
30 #include "wchar.h"
31 #include "wctype.h"
32 #include "time.h"
33 #include "windef.h"
34 #include "winbase.h"
35 #include "winnls.h"
36 #include "msvcp90.h"
37 #include "wine/unicode.h"
38 #include "wine/list.h"
39 #include "wine/debug.h"
41 WINE_DEFAULT_DEBUG_CHANNEL(msvcp);
43 typedef enum {
44 DATEORDER_no_order,
45 DATEORDER_dmy,
46 DATEORDER_mdy,
47 DATEORDER_ymd,
48 DATEORDER_ydm
49 } dateorder;
51 char* __cdecl _Getdays(void);
52 wchar_t* __cdecl _W_Getdays(void);
53 char* __cdecl _Getmonths(void);
54 wchar_t* __cdecl _W_Getmonths(void);
55 void* __cdecl _Gettnames(void);
56 unsigned int __cdecl ___lc_codepage_func(void);
57 int __cdecl ___lc_collate_cp_func(void);
58 const unsigned short* __cdecl __pctype_func(void);
59 const locale_facet* __thiscall locale__Getfacet(const locale*, MSVCP_size_t);
60 MSVCP_size_t __cdecl _Strftime(char*, MSVCP_size_t, const char*,
61 const struct tm*, struct __lc_time_data*);
62 const locale* __cdecl locale_classic(void);
64 #if _MSVCP_VER >= 110
65 wchar_t ** __cdecl ___lc_locale_name_func(void);
66 #else
67 LCID* __cdecl ___lc_handle_func(void);
68 #endif
70 #if _MSVCP_VER < 100
71 #define locale_string basic_string_char
72 #define locale_string_char_ctor_cstr(this,str) MSVCP_basic_string_char_ctor_cstr(this,str)
73 #define locale_string_char_copy_ctor(this,copy) MSVCP_basic_string_char_copy_ctor(this,copy)
74 #define locale_string_char_dtor(this) MSVCP_basic_string_char_dtor(this)
75 #define locale_string_char_c_str(this) MSVCP_basic_string_char_c_str(this)
76 #define locale_string_char_assign(this,assign) MSVCP_basic_string_char_assign(this,assign)
77 #else
78 #define locale_string _Yarn_char
79 #define locale_string_char_ctor_cstr(this,str) _Yarn_char_ctor_cstr(this,str)
80 #define locale_string_char_copy_ctor(this,copy) _Yarn_char_copy_ctor(this,copy)
81 #define locale_string_char_dtor(this) _Yarn_char_dtor(this)
82 #define locale_string_char_c_str(this) _Yarn_char_c_str(this)
83 #define locale_string_char_assign(this,assign) _Yarn_char_op_assign(this,assign)
85 #define locale_string_wchar _Yarn_wchar
86 #define locale_string_wchar_ctor(this) _Yarn_wchar_ctor(this)
87 #define locale_string_wchar_ctor_cstr(this,str) _Yarn_wchar_ctor(this); _Yarn_wchar_op_assign_cstr(this,str)
88 #define locale_string_wchar_dtor(this) _Yarn_wchar_dtor(this)
89 #define locale_string_wchar_c_str(this) _Yarn_wchar__C_str(this)
90 #endif
92 typedef int category;
94 typedef struct {
95 MSVCP_size_t id;
96 } locale_id;
98 typedef struct _locale__Locimp {
99 locale_facet facet;
100 locale_facet **facetvec;
101 MSVCP_size_t facet_cnt;
102 category catmask;
103 MSVCP_bool transparent;
104 locale_string name;
105 } locale__Locimp;
107 typedef struct {
108 void *timeptr;
109 } _Timevec;
111 typedef struct {
112 _Lockit lock;
113 locale_string days;
114 locale_string months;
115 #if _MSVCP_VER >= 110
116 locale_string_wchar wdays;
117 locale_string_wchar wmonths;
118 #endif
119 locale_string oldlocname;
120 locale_string newlocname;
121 } _Locinfo;
123 typedef struct {
124 #if _MSVCP_VER < 110
125 LCID handle;
126 #endif
127 unsigned page;
128 #if _MSVCP_VER >= 110
129 wchar_t *lc_name;
130 #endif
131 } _Collvec;
133 typedef struct {
134 locale_facet facet;
135 _Collvec coll;
136 } collate;
138 typedef struct {
139 locale_facet facet;
140 const char *grouping;
141 char dp;
142 char sep;
143 const char *false_name;
144 const char *true_name;
145 } numpunct_char;
147 typedef struct {
148 locale_facet facet;
149 const char *grouping;
150 wchar_t dp;
151 wchar_t sep;
152 const wchar_t *false_name;
153 const wchar_t *true_name;
154 } numpunct_wchar;
156 typedef struct {
157 locale_facet facet;
158 _Timevec time;
159 _Cvtvec cvt;
160 } time_put;
162 typedef struct {
163 locale_facet facet;
164 const char *days;
165 const char *months;
166 dateorder dateorder;
167 _Cvtvec cvt;
168 } time_get_char;
170 /* ?_Id_cnt@id@locale@std@@0HA */
171 int locale_id__Id_cnt = 0;
173 static locale classic_locale;
175 /* ?_Global@_Locimp@locale@std@@0PAV123@A */
176 /* ?_Global@_Locimp@locale@std@@0PEAV123@EA */
177 locale__Locimp *global_locale = NULL;
179 /* ?_Clocptr@_Locimp@locale@std@@0PAV123@A */
180 /* ?_Clocptr@_Locimp@locale@std@@0PEAV123@EA */
181 locale__Locimp *locale__Locimp__Clocptr = NULL;
183 static char istreambuf_iterator_char_val(istreambuf_iterator_char *this)
185 if(this->strbuf && !this->got) {
186 int c = basic_streambuf_char_sgetc(this->strbuf);
187 if(c == EOF)
188 this->strbuf = NULL;
189 else
190 this->val = c;
193 this->got = TRUE;
194 return this->val;
197 static wchar_t istreambuf_iterator_wchar_val(istreambuf_iterator_wchar *this)
199 if(this->strbuf && !this->got) {
200 unsigned short c = basic_streambuf_wchar_sgetc(this->strbuf);
201 if(c == WEOF)
202 this->strbuf = NULL;
203 else
204 this->val = c;
207 this->got = TRUE;
208 return this->val;
211 static void istreambuf_iterator_char_inc(istreambuf_iterator_char *this)
213 if(!this->strbuf || basic_streambuf_char_sbumpc(this->strbuf)==EOF) {
214 this->strbuf = NULL;
215 this->got = TRUE;
216 }else {
217 this->got = FALSE;
218 istreambuf_iterator_char_val(this);
222 static void istreambuf_iterator_wchar_inc(istreambuf_iterator_wchar *this)
224 if(!this->strbuf || basic_streambuf_wchar_sbumpc(this->strbuf)==WEOF) {
225 this->strbuf = NULL;
226 this->got = TRUE;
227 }else {
228 this->got = FALSE;
229 istreambuf_iterator_wchar_val(this);
233 static void ostreambuf_iterator_char_put(ostreambuf_iterator_char *this, char ch)
235 if(this->failed || basic_streambuf_char_sputc(this->strbuf, ch)==EOF)
236 this->failed = TRUE;
239 static void ostreambuf_iterator_wchar_put(ostreambuf_iterator_wchar *this, wchar_t ch)
241 if(this->failed || basic_streambuf_wchar_sputc(this->strbuf, ch)==WEOF)
242 this->failed = TRUE;
245 /* ??1facet@locale@std@@UAE@XZ */
246 /* ??1facet@locale@std@@UEAA@XZ */
247 /* ??1facet@locale@std@@MAA@XZ */
248 /* ??1facet@locale@std@@MAE@XZ */
249 /* ??1facet@locale@std@@MEAA@XZ */
250 DEFINE_THISCALL_WRAPPER(locale_facet_dtor, 4)
251 void __thiscall locale_facet_dtor(locale_facet *this)
253 TRACE("(%p)\n", this);
256 DEFINE_THISCALL_WRAPPER(locale_facet_vector_dtor, 8)
257 #define call_locale_facet_vector_dtor(this, flags) CALL_VTBL_FUNC(this, 0, \
258 locale_facet*, (locale_facet*, unsigned int), (this, flags))
259 locale_facet* __thiscall locale_facet_vector_dtor(locale_facet *this, unsigned int flags)
261 TRACE("(%p %x)\n", this, flags);
262 if(flags & 2) {
263 /* we have an array, with the number of elements stored before the first object */
264 INT_PTR i, *ptr = (INT_PTR *)this-1;
266 for(i=*ptr-1; i>=0; i--)
267 locale_facet_dtor(this+i);
268 MSVCRT_operator_delete(ptr);
269 } else {
270 locale_facet_dtor(this);
271 if(flags & 1)
272 MSVCRT_operator_delete(this);
275 return this;
278 typedef struct
280 locale_facet *fac;
281 struct list entry;
282 } facets_elem;
283 static struct list lazy_facets = LIST_INIT(lazy_facets);
285 /* Not exported from msvcp90 */
286 /* ?facet_Register@facet@locale@std@@CAXPAV123@@Z */
287 /* ?facet_Register@facet@locale@std@@CAXPEAV123@@Z */
288 void __cdecl locale_facet_register(locale_facet *add)
290 facets_elem *head = MSVCRT_operator_new(sizeof(*head));
291 if(!head) {
292 ERR("Out of memory\n");
293 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
296 head->fac = add;
297 list_add_head(&lazy_facets, &head->entry);
300 /* Not exported from msvcp90 */
301 /* ?_Register@facet@locale@std@@QAEXXZ */
302 /* ?_Register@facet@locale@std@@QEAAXXZ */
303 DEFINE_THISCALL_WRAPPER(locale_facet__Register, 4)
304 void __thiscall locale_facet__Register(locale_facet *this)
306 TRACE("(%p)\n", this);
307 locale_facet_register(this);
310 /* Not exported from msvcp90 */
311 /* ??_7facet@locale@std@@6B@ */
312 extern const vtable_ptr MSVCP_locale_facet_vtable;
314 /* ??0id@locale@std@@QAE@I@Z */
315 /* ??0id@locale@std@@QEAA@_K@Z */
316 DEFINE_THISCALL_WRAPPER(locale_id_ctor_id, 8)
317 locale_id* __thiscall locale_id_ctor_id(locale_id *this, MSVCP_size_t id)
319 TRACE("(%p %lu)\n", this, id);
321 this->id = id;
322 return this;
325 /* ??_Fid@locale@std@@QAEXXZ */
326 /* ??_Fid@locale@std@@QEAAXXZ */
327 DEFINE_THISCALL_WRAPPER(locale_id_ctor, 4)
328 locale_id* __thiscall locale_id_ctor(locale_id *this)
330 TRACE("(%p)\n", this);
332 this->id = 0;
333 return this;
336 /* ??Bid@locale@std@@QAEIXZ */
337 /* ??Bid@locale@std@@QEAA_KXZ */
338 DEFINE_THISCALL_WRAPPER(locale_id_operator_size_t, 4)
339 MSVCP_size_t __thiscall locale_id_operator_size_t(locale_id *this)
341 _Lockit lock;
343 TRACE("(%p)\n", this);
345 if(!this->id) {
346 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
347 this->id = ++locale_id__Id_cnt;
348 _Lockit_dtor(&lock);
351 return this->id;
354 /* ?_Id_cnt_func@id@locale@std@@CAAAHXZ */
355 /* ?_Id_cnt_func@id@locale@std@@CAAEAHXZ */
356 int* __cdecl locale_id__Id_cnt_func(void)
358 TRACE("\n");
359 return &locale_id__Id_cnt;
362 /* ??_Ffacet@locale@std@@QAEXXZ */
363 /* ??_Ffacet@locale@std@@QEAAXXZ */
364 DEFINE_THISCALL_WRAPPER(locale_facet_ctor, 4)
365 locale_facet* __thiscall locale_facet_ctor(locale_facet *this)
367 TRACE("(%p)\n", this);
368 this->vtable = &MSVCP_locale_facet_vtable;
369 this->refs = 0;
370 return this;
373 /* ??0facet@locale@std@@IAE@I@Z */
374 /* ??0facet@locale@std@@IEAA@_K@Z */
375 DEFINE_THISCALL_WRAPPER(locale_facet_ctor_refs, 8)
376 locale_facet* __thiscall locale_facet_ctor_refs(locale_facet *this, MSVCP_size_t refs)
378 TRACE("(%p %lu)\n", this, refs);
379 this->vtable = &MSVCP_locale_facet_vtable;
380 this->refs = refs;
381 return this;
384 /* ?_Incref@facet@locale@std@@QAEXXZ */
385 /* ?_Incref@facet@locale@std@@QEAAXXZ */
386 /* ?_Incref@facet@locale@std@@UAEXXZ */
387 /* ?_Incref@facet@locale@std@@UEAAXXZ */
388 #if _MSVCP_VER >= 110
389 #define call_locale_facet__Incref(this) CALL_VTBL_FUNC(this, 4, void, (locale_facet*), (this))
390 #else
391 #define call_locale_facet__Incref locale_facet__Incref
392 #endif
393 DEFINE_THISCALL_WRAPPER(locale_facet__Incref, 4)
394 void __thiscall locale_facet__Incref(locale_facet *this)
396 _Lockit lock;
398 TRACE("(%p)\n", this);
400 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
401 this->refs++;
402 _Lockit_dtor(&lock);
405 /* ?_Decref@facet@locale@std@@QAEPAV123@XZ */
406 /* ?_Decref@facet@locale@std@@QEAAPEAV123@XZ */
407 /* ?_Decref@facet@locale@std@@UAEPAV_Facet_base@3@XZ */
408 /* ?_Decref@facet@locale@std@@UEAAPEAV_Facet_base@3@XZ */
409 #if _MSVCP_VER >= 110
410 #define call_locale_facet__Decref(this) CALL_VTBL_FUNC(this, 8, \
411 locale_facet*, (locale_facet*), (this))
412 #else
413 #define call_locale_facet__Decref locale_facet__Decref
414 #endif
415 DEFINE_THISCALL_WRAPPER(locale_facet__Decref, 4)
416 locale_facet* __thiscall locale_facet__Decref(locale_facet *this)
418 _Lockit lock;
419 locale_facet *ret;
421 TRACE("(%p)\n", this);
423 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
424 if(this->refs)
425 this->refs--;
427 ret = this->refs ? NULL : this;
428 _Lockit_dtor(&lock);
430 return ret;
433 /* ?_Getcat@facet@locale@std@@SAIPAPBV123@PBV23@@Z */
434 /* ?_Getcat@facet@locale@std@@SA_KPEAPEBV123@PEBV23@@Z */
435 MSVCP_size_t __cdecl locale_facet__Getcat(const locale_facet **facet, const locale *loc)
437 TRACE("(%p %p)\n", facet, loc);
438 return -1;
441 /* ?_Getcat@facet@locale@std@@SAIPAPBV123@@Z */
442 /* ?_Getcat@facet@locale@std@@SA_KPEAPEBV123@@Z */
443 MSVCP_size_t __cdecl locale_facet__Getcat_old(const locale_facet **facet)
445 TRACE("(%p)\n", facet);
446 return -1;
449 /* ??0_Timevec@std@@QAE@ABV01@@Z */
450 /* ??0_Timevec@std@@QEAA@AEBV01@@Z */
451 /* This copy constructor modifies copied object */
452 DEFINE_THISCALL_WRAPPER(_Timevec_copy_ctor, 8)
453 _Timevec* __thiscall _Timevec_copy_ctor(_Timevec *this, _Timevec *copy)
455 TRACE("(%p %p)\n", this, copy);
456 this->timeptr = copy->timeptr;
457 copy->timeptr = NULL;
458 return this;
461 /* ??0_Timevec@std@@QAE@PAX@Z */
462 /* ??0_Timevec@std@@QEAA@PEAX@Z */
463 DEFINE_THISCALL_WRAPPER(_Timevec_ctor_timeptr, 8)
464 _Timevec* __thiscall _Timevec_ctor_timeptr(_Timevec *this, void *timeptr)
466 TRACE("(%p %p)\n", this, timeptr);
467 this->timeptr = timeptr;
468 return this;
471 /* ??_F_Timevec@std@@QAEXXZ */
472 /* ??_F_Timevec@std@@QEAAXXZ */
473 DEFINE_THISCALL_WRAPPER(_Timevec_ctor, 4)
474 _Timevec* __thiscall _Timevec_ctor(_Timevec *this)
476 TRACE("(%p)\n", this);
477 this->timeptr = NULL;
478 return this;
481 /* ??1_Timevec@std@@QAE@XZ */
482 /* ??1_Timevec@std@@QEAA@XZ */
483 DEFINE_THISCALL_WRAPPER(_Timevec_dtor, 4)
484 void __thiscall _Timevec_dtor(_Timevec *this)
486 TRACE("(%p)\n", this);
487 free(this->timeptr);
490 /* ??4_Timevec@std@@QAEAAV01@ABV01@@Z */
491 /* ??4_Timevec@std@@QEAAAEAV01@AEBV01@@Z */
492 DEFINE_THISCALL_WRAPPER(_Timevec_op_assign, 8)
493 _Timevec* __thiscall _Timevec_op_assign(_Timevec *this, _Timevec *right)
495 TRACE("(%p %p)\n", this, right);
496 this->timeptr = right->timeptr;
497 right->timeptr = NULL;
498 return this;
501 /* ?_Getptr@_Timevec@std@@QBEPAXXZ */
502 /* ?_Getptr@_Timevec@std@@QEBAPEAXXZ */
503 DEFINE_THISCALL_WRAPPER(_Timevec__Getptr, 4)
504 void* __thiscall _Timevec__Getptr(_Timevec *this)
506 TRACE("(%p)\n", this);
507 return this->timeptr;
510 /* ?_Locinfo_ctor@_Locinfo@std@@SAXPAV12@HPBD@Z */
511 /* ?_Locinfo_ctor@_Locinfo@std@@SAXPEAV12@HPEBD@Z */
512 _Locinfo* __cdecl _Locinfo__Locinfo_ctor_cat_cstr(_Locinfo *locinfo, int category, const char *locstr)
514 const char *locale = NULL;
515 #if _MSVCP_VER >= 110
516 static const wchar_t empty[] = { '\0' };
517 #endif
519 /* This function is probably modifying more global objects */
520 FIXME("(%p %d %s) semi-stub\n", locinfo, category, locstr);
522 if(!locstr)
523 throw_exception(EXCEPTION_RUNTIME_ERROR, "bad locale name");
525 _Lockit_ctor_locktype(&locinfo->lock, _LOCK_LOCALE);
526 locale_string_char_ctor_cstr(&locinfo->days, "");
527 locale_string_char_ctor_cstr(&locinfo->months, "");
528 #if _MSVCP_VER >= 110
529 locale_string_wchar_ctor_cstr(&locinfo->wdays, empty);
530 locale_string_wchar_ctor_cstr(&locinfo->wmonths, empty);
531 #endif
532 locale_string_char_ctor_cstr(&locinfo->oldlocname, setlocale(LC_ALL, NULL));
534 if(category)
535 locale = setlocale(LC_ALL, locstr);
536 else
537 locale = setlocale(LC_ALL, NULL);
539 if(locale)
540 locale_string_char_ctor_cstr(&locinfo->newlocname, locale);
541 else
542 locale_string_char_ctor_cstr(&locinfo->newlocname, "*");
544 return locinfo;
547 /* ??0_Locinfo@std@@QAE@HPBD@Z */
548 /* ??0_Locinfo@std@@QEAA@HPEBD@Z */
549 DEFINE_THISCALL_WRAPPER(_Locinfo_ctor_cat_cstr, 12)
550 _Locinfo* __thiscall _Locinfo_ctor_cat_cstr(_Locinfo *this, int category, const char *locstr)
552 return _Locinfo__Locinfo_ctor_cat_cstr(this, category, locstr);
555 /* ?_Locinfo_ctor@_Locinfo@std@@SAXPAV12@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@@Z */
556 /* ?_Locinfo_ctor@_Locinfo@std@@SAXPEAV12@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@@Z */
557 _Locinfo* __cdecl _Locinfo__Locinfo_ctor_bstr(_Locinfo *locinfo, const basic_string_char *locstr)
559 return _Locinfo__Locinfo_ctor_cat_cstr(locinfo, 1/*FIXME*/, MSVCP_basic_string_char_c_str(locstr));
562 /* ??0_Locinfo@std@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@@Z */
563 /* ??0_Locinfo@std@@QEAA@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@@Z */
564 DEFINE_THISCALL_WRAPPER(_Locinfo_ctor_bstr, 8)
565 _Locinfo* __thiscall _Locinfo_ctor_bstr(_Locinfo *this, const basic_string_char *locstr)
567 return _Locinfo__Locinfo_ctor_cat_cstr(this, 1/*FIXME*/, MSVCP_basic_string_char_c_str(locstr));
570 /* ?_Locinfo_ctor@_Locinfo@std@@SAXPAV12@PBD@Z */
571 /* ?_Locinfo_ctor@_Locinfo@std@@SAXPEAV12@PEBD@Z */
572 _Locinfo* __cdecl _Locinfo__Locinfo_ctor_cstr(_Locinfo *locinfo, const char *locstr)
574 return _Locinfo__Locinfo_ctor_cat_cstr(locinfo, 1/*FIXME*/, locstr);
577 /* ??0_Locinfo@std@@QAE@PBD@Z */
578 /* ??0_Locinfo@std@@QEAA@PEBD@Z */
579 DEFINE_THISCALL_WRAPPER(_Locinfo_ctor_cstr, 8)
580 _Locinfo* __thiscall _Locinfo_ctor_cstr(_Locinfo *this, const char *locstr)
582 return _Locinfo__Locinfo_ctor_cat_cstr(this, 1/*FIXME*/, locstr);
585 /* ?_Locinfo_dtor@_Locinfo@std@@SAXPAV12@@Z */
586 /* ?_Locinfo_dtor@_Locinfo@std@@SAXPEAV12@@Z */
587 void __cdecl _Locinfo__Locinfo_dtor(_Locinfo *locinfo)
589 TRACE("(%p)\n", locinfo);
591 setlocale(LC_ALL, locale_string_char_c_str(&locinfo->oldlocname));
592 locale_string_char_dtor(&locinfo->days);
593 locale_string_char_dtor(&locinfo->months);
594 #if _MSVCP_VER >= 110
595 locale_string_wchar_dtor(&locinfo->wdays);
596 locale_string_wchar_dtor(&locinfo->wmonths);
597 #endif
598 locale_string_char_dtor(&locinfo->oldlocname);
599 locale_string_char_dtor(&locinfo->newlocname);
600 _Lockit_dtor(&locinfo->lock);
603 /* ??_F_Locinfo@std@@QAEXXZ */
604 /* ??_F_Locinfo@std@@QEAAXXZ */
605 DEFINE_THISCALL_WRAPPER(_Locinfo_ctor, 4)
606 _Locinfo* __thiscall _Locinfo_ctor(_Locinfo *this)
608 return _Locinfo__Locinfo_ctor_cat_cstr(this, 1/*FIXME*/, "C");
611 /* ??1_Locinfo@std@@QAE@XZ */
612 /* ??1_Locinfo@std@@QEAA@XZ */
613 DEFINE_THISCALL_WRAPPER(_Locinfo_dtor, 4)
614 void __thiscall _Locinfo_dtor(_Locinfo *this)
616 _Locinfo__Locinfo_dtor(this);
619 /* ?_Locinfo_Addcats@_Locinfo@std@@SAAAV12@PAV12@HPBD@Z */
620 /* ?_Locinfo_Addcats@_Locinfo@std@@SAAEAV12@PEAV12@HPEBD@Z */
621 _Locinfo* __cdecl _Locinfo__Locinfo_Addcats(_Locinfo *locinfo, int category, const char *locstr)
623 const char *locale = NULL;
625 /* This function is probably modifying more global objects */
626 FIXME("(%p %d %s) semi-stub\n", locinfo, category, locstr);
627 if(!locstr)
628 throw_exception(EXCEPTION_RUNTIME_ERROR, "bad locale name");
630 locale_string_char_dtor(&locinfo->newlocname);
632 if(category)
633 locale = setlocale(LC_ALL, locstr);
634 else
635 locale = setlocale(LC_ALL, NULL);
637 if(locale)
638 locale_string_char_ctor_cstr(&locinfo->newlocname, locale);
639 else
640 locale_string_char_ctor_cstr(&locinfo->newlocname, "*");
642 return locinfo;
645 /* ?_Addcats@_Locinfo@std@@QAEAAV12@HPBD@Z */
646 /* ?_Addcats@_Locinfo@std@@QEAAAEAV12@HPEBD@Z */
647 DEFINE_THISCALL_WRAPPER(_Locinfo__Addcats, 12)
648 _Locinfo* __thiscall _Locinfo__Addcats(_Locinfo *this, int category, const char *locstr)
650 return _Locinfo__Locinfo_Addcats(this, category, locstr);
653 static _Collvec* getcoll(_Collvec *ret)
655 TRACE("\n");
657 ret->page = ___lc_collate_cp_func();
658 #if _MSVCP_VER < 110
659 ret->handle = ___lc_handle_func()[LC_COLLATE];
660 #else
661 ret->lc_name = ___lc_locale_name_func()[LC_COLLATE];
662 #endif
663 return ret;
666 /* _Getcoll */
667 #if defined(__i386__) || _MSVCP_VER<110
668 ULONGLONG __cdecl _Getcoll(void)
670 ULONGLONG ret;
672 C_ASSERT(sizeof(_Collvec) <= sizeof(ULONGLONG));
674 getcoll((_Collvec*)&ret);
675 return ret;
677 #else
678 _Collvec* __cdecl _Getcoll(_Collvec *ret)
680 return getcoll(ret);
682 #endif
684 /* ?_Getcoll@_Locinfo@std@@QBE?AU_Collvec@@XZ */
685 /* ?_Getcoll@_Locinfo@std@@QEBA?AU_Collvec@@XZ */
686 DEFINE_THISCALL_WRAPPER(_Locinfo__Getcoll, 8)
687 _Collvec* __thiscall _Locinfo__Getcoll(const _Locinfo *this, _Collvec *ret)
689 return getcoll(ret);
692 /* _Getctype */
693 _Ctypevec* __cdecl _Getctype(_Ctypevec *ret)
695 short *table;
696 #if _MSVCP_VER >= 110
697 wchar_t *name;
698 MSVCP_size_t size;
699 #endif
701 TRACE("\n");
703 ret->page = ___lc_codepage_func();
704 #if _MSVCP_VER < 110
705 ret->handle = ___lc_handle_func()[LC_COLLATE];
706 #else
707 if((name = ___lc_locale_name_func()[LC_COLLATE])) {
708 size = wcslen(name)+1;
709 ret->name = malloc(size*sizeof(*name));
710 if(!ret->name) throw_exception(EXCEPTION_BAD_ALLOC, NULL);
711 memcpy(ret->name, name, size*sizeof(*name));
712 } else {
713 ret->name = NULL;
715 #endif
716 ret->delfl = TRUE;
717 table = malloc(sizeof(short[256]));
718 if(!table) throw_exception(EXCEPTION_BAD_ALLOC, NULL);
719 memcpy(table, __pctype_func(), sizeof(short[256]));
720 ret->table = table;
721 return ret;
724 /* ?_Getctype@_Locinfo@std@@QBE?AU_Ctypevec@@XZ */
725 /* ?_Getctype@_Locinfo@std@@QEBA?AU_Ctypevec@@XZ */
726 DEFINE_THISCALL_WRAPPER(_Locinfo__Getctype, 8)
727 _Ctypevec* __thiscall _Locinfo__Getctype(const _Locinfo *this, _Ctypevec *ret)
729 return _Getctype(ret);
732 /* _Getcvt */
733 #if _MSVCP_VER < 110
734 ULONGLONG __cdecl _Getcvt(void)
736 union {
737 _Cvtvec cvtvec;
738 ULONGLONG ull;
739 } ret;
741 TRACE("\n");
743 ret.cvtvec.page = ___lc_codepage_func();
744 ret.cvtvec.handle = ___lc_handle_func()[LC_CTYPE];
745 return ret.ull;
747 #else
748 _Cvtvec* __cdecl _Getcvt(_Cvtvec *ret)
750 int i;
752 TRACE("\n");
754 memset(ret, 0, sizeof(*ret));
755 ret->page = ___lc_codepage_func();
756 ret->mb_max = ___mb_cur_max_func();
758 if(ret->mb_max > 1) {
759 for(i=0; i<256; i++)
760 if(_ismbblead(i)) ret->isleadbyte[i/8] |= 1 << (i&7);
762 return ret;
764 #endif
766 /* ?_Getcvt@_Locinfo@std@@QBE?AU_Cvtvec@@XZ */
767 /* ?_Getcvt@_Locinfo@std@@QEBA?AU_Cvtvec@@XZ */
768 DEFINE_THISCALL_WRAPPER(_Locinfo__Getcvt, 8)
769 _Cvtvec* __thiscall _Locinfo__Getcvt(const _Locinfo *this, _Cvtvec *ret)
771 #if _MSVCP_VER < 110
772 ULONGLONG ull = _Getcvt();
773 memcpy(ret, &ull, sizeof(ull));
774 #else
775 _Cvtvec cvtvec;
776 _Getcvt(&cvtvec);
777 memcpy(ret, &cvtvec, sizeof(cvtvec));
778 #endif
779 return ret;
782 int __cdecl _Getdateorder(void)
784 WCHAR date_fmt[2];
786 #if _MSVCP_VER < 110
787 if(!GetLocaleInfoW(___lc_handle_func()[LC_TIME], LOCALE_ILDATE,
788 date_fmt, sizeof(date_fmt)/sizeof(*date_fmt)))
789 return DATEORDER_no_order;
790 #else
791 if(!GetLocaleInfoEx(___lc_locale_name_func()[LC_TIME], LOCALE_ILDATE,
792 date_fmt, sizeof(date_fmt)/sizeof(*date_fmt)))
793 return DATEORDER_no_order;
794 #endif
796 if(*date_fmt == '0') return DATEORDER_mdy;
797 if(*date_fmt == '1') return DATEORDER_dmy;
798 if(*date_fmt == '2') return DATEORDER_ymd;
799 return DATEORDER_no_order;
802 /* ?_Getdateorder@_Locinfo@std@@QBEHXZ */
803 /* ?_Getdateorder@_Locinfo@std@@QEBAHXZ */
804 DEFINE_THISCALL_WRAPPER(_Locinfo__Getdateorder, 4)
805 int __thiscall _Locinfo__Getdateorder(const _Locinfo *this)
807 TRACE("(%p)\n", this);
808 return _Getdateorder();
811 /* ?_Getdays@_Locinfo@std@@QBEPBDXZ */
812 /* ?_Getdays@_Locinfo@std@@QEBAPEBDXZ */
813 DEFINE_THISCALL_WRAPPER(_Locinfo__Getdays, 4)
814 const char* __thiscall _Locinfo__Getdays(const _Locinfo *this)
816 char *days = _Getdays();
817 const char *ret;
819 TRACE("(%p)\n", this);
821 if(days) {
822 locale_string_char_dtor((locale_string *)&this->days);
823 locale_string_char_ctor_cstr((locale_string *)&this->days, days);
824 free(days);
827 ret = locale_string_char_c_str(&this->days);
828 if (!ret[0]) ret = ":Sun:Sunday:Mon:Monday:Tue:Tuesday:Wed:Wednesday:Thu:Thursday:Fri:Friday:Sat:Saturday";
829 return ret;
832 #if _MSVCP_VER >= 110
833 /* ?_W_Getdays@_Locinfo@std@@QBEPBGXZ */
834 /* ?_W_Getdays@_Locinfo@std@@QEBAPEBGXZ */
835 DEFINE_THISCALL_WRAPPER(_Locinfo__W_Getdays, 4)
836 const wchar_t* __thiscall _Locinfo__W_Getdays(const _Locinfo *this)
838 static const wchar_t defdays[] =
840 ':','S','u','n',':','S','u','n','d','a','y',
841 ':','M','o','n',':','M','o','n','d','a','y',
842 ':','T','u','e',':','T','u','e','s','d','a','y',
843 ':','W','e','d',':','W','e','d','n','e','s','d','a','y',
844 ':','T','h','u',':','T','h','u','r','s','d','a','y',
845 ':','F','r','i',':','F','r','i','d','a','y',
846 ':','S','a','t',':','S','a','t','u','r','d','a','y'
848 wchar_t *wdays = _W_Getdays();
849 const wchar_t *ret;
851 TRACE("(%p)\n", this);
853 if(wdays) {
854 locale_string_wchar_dtor((locale_string_wchar *)&this->wdays);
855 locale_string_wchar_ctor_cstr((locale_string_wchar *)&this->wdays, wdays);
856 free(wdays);
859 ret = locale_string_wchar_c_str(&this->wdays);
860 if (!ret[0]) ret = defdays;
861 return ret;
864 /* ?_W_Getmonths@_Locinfo@std@@QBEPBGXZ */
865 /* ?_W_Getmonths@_Locinfo@std@@QEBAPEBGXZ */
866 DEFINE_THISCALL_WRAPPER(_Locinfo__W_Getmonths, 4)
867 const wchar_t* __thiscall _Locinfo__W_Getmonths(const _Locinfo *this)
869 static const wchar_t defmonths[] =
871 ':','J','a','n',':','J','a','n','u','a','r','y',
872 ':','F','e','b',':','F','e','b','r','u','a','r','y',
873 ':','M','a','r',':','M','a','r','c','h',
874 ':','A','p','r',':','A','p','r','i','l',
875 ':','M','a','y',':','M','a','y',
876 ':','J','u','n',':','J','u','n','e',
877 ':','J','u','l',':','J','u','l','y',
878 ':','A','u','g',':','A','u','g','u','s','t',
879 ':','S','e','p',':','S','e','p','t','e','m','b','e','r',
880 ':','O','c','t',':','O','c','t','o','b','e','r',
881 ':','N','o','v',':','N','o','v','e','m','b','e','r',
882 ':','D','e','c',':','D','e','c','e','m','b','e','r'
884 wchar_t *wmonths = _W_Getmonths();
885 const wchar_t *ret;
887 TRACE("(%p)\n", this);
889 if(wmonths) {
890 locale_string_wchar_dtor((locale_string_wchar *)&this->wmonths);
891 locale_string_wchar_ctor_cstr((locale_string_wchar *)&this->wmonths, wmonths);
892 free(wmonths);
895 ret = locale_string_wchar_c_str(&this->wmonths);
896 if (!ret[0]) ret = defmonths;
897 return ret;
899 #endif
901 /* ?_Getmonths@_Locinfo@std@@QBEPBDXZ */
902 /* ?_Getmonths@_Locinfo@std@@QEBAPEBDXZ */
903 DEFINE_THISCALL_WRAPPER(_Locinfo__Getmonths, 4)
904 const char* __thiscall _Locinfo__Getmonths(const _Locinfo *this)
906 char *months = _Getmonths();
907 const char *ret;
909 TRACE("(%p)\n", this);
911 if(months) {
912 locale_string_char_dtor((locale_string *)&this->months);
913 locale_string_char_ctor_cstr((locale_string *)&this->months, months);
914 free(months);
917 ret = locale_string_char_c_str(&this->months);
918 if (!ret[0]) ret = ":Jan:January:Feb:February:Mar:March:Apr:April:May:May:Jun:June:Jul:July"
919 ":Aug:August:Sep:September:Oct:October:Nov:November:Dec:December";
920 return ret;
923 /* ?_Getfalse@_Locinfo@std@@QBEPBDXZ */
924 /* ?_Getfalse@_Locinfo@std@@QEBAPEBDXZ */
925 DEFINE_THISCALL_WRAPPER(_Locinfo__Getfalse, 4)
926 const char* __thiscall _Locinfo__Getfalse(const _Locinfo *this)
928 TRACE("(%p)\n", this);
929 return "false";
932 /* ?_Gettrue@_Locinfo@std@@QBEPBDXZ */
933 /* ?_Gettrue@_Locinfo@std@@QEBAPEBDXZ */
934 DEFINE_THISCALL_WRAPPER(_Locinfo__Gettrue, 4)
935 const char* __thiscall _Locinfo__Gettrue(const _Locinfo *this)
937 TRACE("(%p)\n", this);
938 return "true";
941 /* ?_Getlconv@_Locinfo@std@@QBEPBUlconv@@XZ */
942 /* ?_Getlconv@_Locinfo@std@@QEBAPEBUlconv@@XZ */
943 DEFINE_THISCALL_WRAPPER(_Locinfo__Getlconv, 4)
944 const struct lconv* __thiscall _Locinfo__Getlconv(const _Locinfo *this)
946 TRACE("(%p)\n", this);
947 return localeconv();
950 /* ?_Gettnames@_Locinfo@std@@QBE?AV_Timevec@2@XZ */
951 /* ?_Gettnames@_Locinfo@std@@QEBA?AV_Timevec@2@XZ */
952 DEFINE_THISCALL_WRAPPER(_Locinfo__Gettnames, 8)
953 _Timevec*__thiscall _Locinfo__Gettnames(const _Locinfo *this, _Timevec *ret)
955 TRACE("(%p)\n", this);
957 _Timevec_ctor_timeptr(ret, _Gettnames());
958 return ret;
961 /* ?id@?$collate@D@std@@2V0locale@2@A */
962 locale_id collate_char_id = {0};
964 /* ??_7?$collate@D@std@@6B@ */
965 extern const vtable_ptr MSVCP_collate_char_vtable;
967 /* ?_Init@?$collate@D@std@@IAEXABV_Locinfo@2@@Z */
968 /* ?_Init@?$collate@D@std@@IEAAXAEBV_Locinfo@2@@Z */
969 DEFINE_THISCALL_WRAPPER(collate_char__Init, 8)
970 void __thiscall collate_char__Init(collate *this, const _Locinfo *locinfo)
972 TRACE("(%p %p)\n", this, locinfo);
973 _Locinfo__Getcoll(locinfo, &this->coll);
976 /* ??0?$collate@D@std@@IAE@PBDI@Z */
977 /* ??0?$collate@D@std@@IEAA@PEBD_K@Z */
978 DEFINE_THISCALL_WRAPPER(collate_char_ctor_name, 12)
979 collate* __thiscall collate_char_ctor_name(collate *this, const char *name, MSVCP_size_t refs)
981 _Locinfo locinfo;
983 TRACE("(%p %s %lu)\n", this, name, refs);
985 locale_facet_ctor_refs(&this->facet, refs);
986 this->facet.vtable = &MSVCP_collate_char_vtable;
988 _Locinfo_ctor_cstr(&locinfo, name);
989 collate_char__Init(this, &locinfo);
990 _Locinfo_dtor(&locinfo);
991 return this;
994 /* ??0?$collate@D@std@@QAE@ABV_Locinfo@1@I@Z */
995 /* ??0?$collate@D@std@@QEAA@AEBV_Locinfo@1@_K@Z */
996 DEFINE_THISCALL_WRAPPER(collate_char_ctor_locinfo, 12)
997 collate* __thiscall collate_char_ctor_locinfo(collate *this, const _Locinfo *locinfo, MSVCP_size_t refs)
999 TRACE("(%p %p %lu)\n", this, locinfo, refs);
1001 locale_facet_ctor_refs(&this->facet, refs);
1002 this->facet.vtable = &MSVCP_collate_char_vtable;
1003 collate_char__Init(this, locinfo);
1004 return this;
1007 /* ??0?$collate@D@std@@QAE@I@Z */
1008 /* ??0?$collate@D@std@@QEAA@_K@Z */
1009 DEFINE_THISCALL_WRAPPER(collate_char_ctor_refs, 8)
1010 collate* __thiscall collate_char_ctor_refs(collate *this, MSVCP_size_t refs)
1012 return collate_char_ctor_name(this, "C", refs);
1015 /* ??1?$collate@D@std@@UAE@XZ */
1016 /* ??1?$collate@D@std@@UEAA@XZ */
1017 /* ??1?$collate@D@std@@MAE@XZ */
1018 /* ??1?$collate@D@std@@MEAA@XZ */
1019 DEFINE_THISCALL_WRAPPER(collate_char_dtor, 4)
1020 void __thiscall collate_char_dtor(collate *this)
1022 TRACE("(%p)\n", this);
1025 DEFINE_THISCALL_WRAPPER(collate_char_vector_dtor, 8)
1026 collate* __thiscall collate_char_vector_dtor(collate *this, unsigned int flags)
1028 TRACE("(%p %x)\n", this, flags);
1029 if(flags & 2) {
1030 /* we have an array, with the number of elements stored before the first object */
1031 INT_PTR i, *ptr = (INT_PTR *)this-1;
1033 for(i=*ptr-1; i>=0; i--)
1034 collate_char_dtor(this+i);
1035 MSVCRT_operator_delete(ptr);
1036 } else {
1037 collate_char_dtor(this);
1038 if(flags & 1)
1039 MSVCRT_operator_delete(this);
1042 return this;
1045 /* ??_F?$collate@D@std@@QAEXXZ */
1046 /* ??_F?$collate@D@std@@QEAAXXZ */
1047 DEFINE_THISCALL_WRAPPER(collate_char_ctor, 4)
1048 collate* __thiscall collate_char_ctor(collate *this)
1050 return collate_char_ctor_name(this, "C", 0);
1053 /* ?_Getcat@?$collate@D@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
1054 /* ?_Getcat@?$collate@D@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
1055 MSVCP_size_t __cdecl collate_char__Getcat(const locale_facet **facet, const locale *loc)
1057 TRACE("(%p %p)\n", facet, loc);
1059 if(facet && !*facet) {
1060 *facet = MSVCRT_operator_new(sizeof(collate));
1061 if(!*facet) {
1062 ERR("Out of memory\n");
1063 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
1064 return 0;
1066 collate_char_ctor_name((collate*)*facet,
1067 locale_string_char_c_str(&loc->ptr->name), 0);
1070 return LC_COLLATE;
1073 /* ?_Getcat@?$collate@D@std@@SAIPAPBVfacet@locale@2@@Z */
1074 /* ?_Getcat@?$collate@D@std@@SA_KPEAPEBVfacet@locale@2@@Z */
1075 MSVCP_size_t __cdecl collate_char__Getcat_old(const locale_facet **facet)
1077 return collate_char__Getcat(facet, locale_classic());
1080 static collate* collate_char_use_facet(const locale *loc)
1082 static collate *obj = NULL;
1084 _Lockit lock;
1085 const locale_facet *fac;
1087 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
1088 fac = locale__Getfacet(loc, locale_id_operator_size_t(&collate_char_id));
1089 if(fac) {
1090 _Lockit_dtor(&lock);
1091 return (collate*)fac;
1094 if(obj) {
1095 _Lockit_dtor(&lock);
1096 return obj;
1099 collate_char__Getcat(&fac, loc);
1100 obj = (collate*)fac;
1101 call_locale_facet__Incref(&obj->facet);
1102 locale_facet_register(&obj->facet);
1103 _Lockit_dtor(&lock);
1105 return obj;
1108 /* _Strcoll */
1109 int __cdecl _Strcoll(const char *first1, const char *last1, const char *first2,
1110 const char *last2, const _Collvec *coll)
1112 LCID lcid;
1114 TRACE("(%s %s)\n", debugstr_an(first1, last1-first1), debugstr_an(first2, last2-first2));
1116 #if _MSVCP_VER < 110
1117 lcid = (coll ? coll->handle : ___lc_handle_func()[LC_COLLATE]);
1118 #else
1119 lcid = LocaleNameToLCID(coll ? coll->lc_name : ___lc_locale_name_func()[LC_COLLATE], 0);
1120 #endif
1121 return CompareStringA(lcid, 0, first1, last1-first1, first2, last2-first2)-CSTR_EQUAL;
1124 /* ?do_compare@?$collate@D@std@@MBEHPBD000@Z */
1125 /* ?do_compare@?$collate@D@std@@MEBAHPEBD000@Z */
1126 DEFINE_THISCALL_WRAPPER(collate_char_do_compare, 20)
1127 #if _MSVCP_VER <= 100
1128 #define call_collate_char_do_compare(this, first1, last1, first2, last2) CALL_VTBL_FUNC(this, 4, int, \
1129 (const collate*, const char*, const char*, const char*, const char*), \
1130 (this, first1, last1, first2, last2))
1131 #else
1132 #define call_collate_char_do_compare(this, first1, last1, first2, last2) CALL_VTBL_FUNC(this, 12, int, \
1133 (const collate*, const char*, const char*, const char*, const char*), \
1134 (this, first1, last1, first2, last2))
1135 #endif
1136 int __thiscall collate_char_do_compare(const collate *this, const char *first1,
1137 const char *last1, const char *first2, const char *last2)
1139 TRACE("(%p %p %p %p %p)\n", this, first1, last1, first2, last2);
1140 return _Strcoll(first1, last1, first2, last2, &this->coll);
1143 /* ?compare@?$collate@D@std@@QBEHPBD000@Z */
1144 /* ?compare@?$collate@D@std@@QEBAHPEBD000@Z */
1145 DEFINE_THISCALL_WRAPPER(collate_char_compare, 20)
1146 int __thiscall collate_char_compare(const collate *this, const char *first1,
1147 const char *last1, const char *first2, const char *last2)
1149 TRACE("(%p %p %p %p %p)\n", this, first1, last1, first2, last2);
1150 return call_collate_char_do_compare(this, first1, last1, first2, last2);
1153 /* ?do_hash@?$collate@D@std@@MBEJPBD0@Z */
1154 /* ?do_hash@?$collate@D@std@@MEBAJPEBD0@Z */
1155 DEFINE_THISCALL_WRAPPER(collate_char_do_hash, 12)
1156 #if _MSVCP_VER <= 100
1157 #define call_collate_char_do_hash(this, first, last) CALL_VTBL_FUNC(this, 12, LONG, \
1158 (const collate*, const char*, const char*), (this, first, last))
1159 #else
1160 #define call_collate_char_do_hash(this, first, last) CALL_VTBL_FUNC(this, 20, LONG, \
1161 (const collate*, const char*, const char*), (this, first, last))
1162 #endif
1163 LONG __thiscall collate_char_do_hash(const collate *this,
1164 const char *first, const char *last)
1166 ULONG ret = 0;
1168 TRACE("(%p %p %p)\n", this, first, last);
1170 for(; first<last; first++)
1171 ret = (ret<<8 | ret>>24) + *first;
1172 return ret;
1175 /* ?hash@?$collate@D@std@@QBEJPBD0@Z */
1176 /* ?hash@?$collate@D@std@@QEBAJPEBD0@Z */
1177 DEFINE_THISCALL_WRAPPER(collate_char_hash, 12)
1178 LONG __thiscall collate_char_hash(const collate *this,
1179 const char *first, const char *last)
1181 TRACE("(%p %p %p)\n", this, first, last);
1182 return call_collate_char_do_hash(this, first, last);
1185 /* ?do_transform@?$collate@D@std@@MBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@PBD0@Z */
1186 /* ?do_transform@?$collate@D@std@@MEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@PEBD0@Z */
1187 DEFINE_THISCALL_WRAPPER(collate_char_do_transform, 16)
1188 basic_string_char* __thiscall collate_char_do_transform(const collate *this,
1189 basic_string_char *ret, const char *first, const char *last)
1191 FIXME("(%p %p %p) stub\n", this, first, last);
1192 return ret;
1195 /* ?transform@?$collate@D@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@PBD0@Z */
1196 /* ?transform@?$collate@D@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@PEBD0@Z */
1197 DEFINE_THISCALL_WRAPPER(collate_char_transform, 16)
1198 basic_string_char* __thiscall collate_char_transform(const collate *this,
1199 basic_string_char *ret, const char *first, const char *last)
1201 FIXME("(%p %p %p) stub\n", this, first, last);
1202 return ret;
1205 /* ?id@?$collate@_W@std@@2V0locale@2@A */
1206 locale_id collate_wchar_id = {0};
1207 /* ?id@?$collate@G@std@@2V0locale@2@A */
1208 locale_id collate_short_id = {0};
1210 /* ??_7?$collate@_W@std@@6B@ */
1211 extern const vtable_ptr MSVCP_collate_wchar_vtable;
1212 /* ??_7?$collate@G@std@@6B@ */
1213 extern const vtable_ptr MSVCP_collate_short_vtable;
1215 /* ?_Init@?$collate@_W@std@@IAEXABV_Locinfo@2@@Z */
1216 /* ?_Init@?$collate@_W@std@@IEAAXAEBV_Locinfo@2@@Z */
1217 /* ?_Init@?$collate@G@std@@IAEXABV_Locinfo@2@@Z */
1218 /* ?_Init@?$collate@G@std@@IEAAXAEBV_Locinfo@2@@Z */
1219 DEFINE_THISCALL_WRAPPER(collate_wchar__Init, 8)
1220 void __thiscall collate_wchar__Init(collate *this, const _Locinfo *locinfo)
1222 TRACE("(%p %p)\n", this, locinfo);
1223 _Locinfo__Getcoll(locinfo, &this->coll);
1226 /* ??0?$collate@_W@std@@IAE@PBDI@Z */
1227 /* ??0?$collate@_W@std@@IEAA@PEBD_K@Z */
1228 DEFINE_THISCALL_WRAPPER(collate_wchar_ctor_name, 12)
1229 collate* __thiscall collate_wchar_ctor_name(collate *this, const char *name, MSVCP_size_t refs)
1231 _Locinfo locinfo;
1233 TRACE("(%p %s %lu)\n", this, name, refs);
1235 locale_facet_ctor_refs(&this->facet, refs);
1236 this->facet.vtable = &MSVCP_collate_wchar_vtable;
1238 _Locinfo_ctor_cstr(&locinfo, name);
1239 collate_wchar__Init(this, &locinfo);
1240 _Locinfo_dtor(&locinfo);
1241 return this;
1244 /* ??0?$collate@G@std@@IAE@PBDI@Z */
1245 /* ??0?$collate@G@std@@IEAA@PEBD_K@Z */
1246 DEFINE_THISCALL_WRAPPER(collate_short_ctor_name, 12)
1247 collate* __thiscall collate_short_ctor_name(collate *this, const char *name, MSVCP_size_t refs)
1249 collate *ret = collate_wchar_ctor_name(this, name, refs);
1250 ret->facet.vtable = &MSVCP_collate_short_vtable;
1251 return ret;
1254 /* ??0?$collate@_W@std@@QAE@ABV_Locinfo@1@I@Z */
1255 /* ??0?$collate@_W@std@@QEAA@AEBV_Locinfo@1@_K@Z */
1256 DEFINE_THISCALL_WRAPPER(collate_wchar_ctor_locinfo, 12)
1257 collate* __thiscall collate_wchar_ctor_locinfo(collate *this, const _Locinfo *locinfo, MSVCP_size_t refs)
1259 TRACE("(%p %p %lu)\n", this, locinfo, refs);
1261 locale_facet_ctor_refs(&this->facet, refs);
1262 this->facet.vtable = &MSVCP_collate_wchar_vtable;
1263 collate_wchar__Init(this, locinfo);
1264 return this;
1267 /* ??0?$collate@G@std@@QAE@ABV_Locinfo@1@I@Z */
1268 /* ??0?$collate@G@std@@QEAA@AEBV_Locinfo@1@_K@Z */
1269 DEFINE_THISCALL_WRAPPER(collate_short_ctor_locinfo, 12)
1270 collate* __thiscall collate_short_ctor_locinfo(collate *this, const _Locinfo *locinfo, MSVCP_size_t refs)
1272 collate *ret = collate_wchar_ctor_locinfo(this, locinfo, refs);
1273 ret->facet.vtable = &MSVCP_collate_short_vtable;
1274 return ret;
1277 /* ??0?$collate@_W@std@@QAE@I@Z */
1278 /* ??0?$collate@_W@std@@QEAA@_K@Z */
1279 DEFINE_THISCALL_WRAPPER(collate_wchar_ctor_refs, 8)
1280 collate* __thiscall collate_wchar_ctor_refs(collate *this, MSVCP_size_t refs)
1282 return collate_wchar_ctor_name(this, "C", refs);
1285 /* ??0?$collate@G@std@@QAE@I@Z */
1286 /* ??0?$collate@G@std@@QEAA@_K@Z */
1287 DEFINE_THISCALL_WRAPPER(collate_short_ctor_refs, 8)
1288 collate* __thiscall collate_short_ctor_refs(collate *this, MSVCP_size_t refs)
1290 collate *ret = collate_wchar_ctor_refs(this, refs);
1291 ret->facet.vtable = &MSVCP_collate_short_vtable;
1292 return ret;
1295 /* ??1?$collate@G@std@@UAE@XZ */
1296 /* ??1?$collate@G@std@@UEAA@XZ */
1297 /* ??1?$collate@_W@std@@MAE@XZ */
1298 /* ??1?$collate@_W@std@@MEAA@XZ */
1299 /* ??1?$collate@G@std@@MAE@XZ */
1300 /* ??1?$collate@G@std@@MEAA@XZ */
1301 DEFINE_THISCALL_WRAPPER(collate_wchar_dtor, 4)
1302 void __thiscall collate_wchar_dtor(collate *this)
1304 TRACE("(%p)\n", this);
1307 DEFINE_THISCALL_WRAPPER(collate_wchar_vector_dtor, 8)
1308 collate* __thiscall collate_wchar_vector_dtor(collate *this, unsigned int flags)
1310 TRACE("(%p %x)\n", this, flags);
1311 if(flags & 2) {
1312 /* we have an array, with the number of elements stored before the first object */
1313 INT_PTR i, *ptr = (INT_PTR *)this-1;
1315 for(i=*ptr-1; i>=0; i--)
1316 collate_wchar_dtor(this+i);
1317 MSVCRT_operator_delete(ptr);
1318 } else {
1319 collate_wchar_dtor(this);
1320 if(flags & 1)
1321 MSVCRT_operator_delete(this);
1324 return this;
1327 /* ??_F?$collate@_W@std@@QAEXXZ */
1328 /* ??_F?$collate@_W@std@@QEAAXXZ */
1329 DEFINE_THISCALL_WRAPPER(collate_wchar_ctor, 4)
1330 collate* __thiscall collate_wchar_ctor(collate *this)
1332 return collate_wchar_ctor_name(this, "C", 0);
1335 /* ??_F?$collate@G@std@@QAEXXZ */
1336 /* ??_F?$collate@G@std@@QEAAXXZ */
1337 DEFINE_THISCALL_WRAPPER(collate_short_ctor, 4)
1338 collate* __thiscall collate_short_ctor(collate *this)
1340 collate *ret = collate_wchar_ctor(this);
1341 ret->facet.vtable = &MSVCP_collate_short_vtable;
1342 return ret;
1345 /* ?_Getcat@?$collate@_W@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
1346 /* ?_Getcat@?$collate@_W@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
1347 MSVCP_size_t __cdecl collate_wchar__Getcat(const locale_facet **facet, const locale *loc)
1349 TRACE("(%p %p)\n", facet, loc);
1351 if(facet && !*facet) {
1352 *facet = MSVCRT_operator_new(sizeof(collate));
1353 if(!*facet) {
1354 ERR("Out of memory\n");
1355 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
1356 return 0;
1358 collate_wchar_ctor_name((collate*)*facet,
1359 locale_string_char_c_str(&loc->ptr->name), 0);
1362 return LC_COLLATE;
1365 /* ?_Getcat@?$collate@_W@std@@SAIPAPBVfacet@locale@2@@Z */
1366 /* ?_Getcat@?$collate@_W@std@@SA_KPEAPEBVfacet@locale@2@@Z */
1367 MSVCP_size_t __cdecl collate_wchar__Getcat_old(const locale_facet **facet)
1369 return collate_wchar__Getcat(facet, locale_classic());
1372 static collate* collate_wchar_use_facet(const locale *loc)
1374 static collate *obj = NULL;
1376 _Lockit lock;
1377 const locale_facet *fac;
1379 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
1380 fac = locale__Getfacet(loc, locale_id_operator_size_t(&collate_wchar_id));
1381 if(fac) {
1382 _Lockit_dtor(&lock);
1383 return (collate*)fac;
1386 if(obj) {
1387 _Lockit_dtor(&lock);
1388 return obj;
1391 collate_wchar__Getcat(&fac, loc);
1392 obj = (collate*)fac;
1393 call_locale_facet__Incref(&obj->facet);
1394 locale_facet_register(&obj->facet);
1395 _Lockit_dtor(&lock);
1397 return obj;
1400 /* ?_Getcat@?$collate@G@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
1401 /* ?_Getcat@?$collate@G@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
1402 MSVCP_size_t __cdecl collate_short__Getcat(const locale_facet **facet, const locale *loc)
1404 if(facet && !*facet) {
1405 collate_wchar__Getcat(facet, loc);
1406 (*(locale_facet**)facet)->vtable = &MSVCP_collate_short_vtable;
1409 return LC_COLLATE;
1412 /* ?_Getcat@?$collate@G@std@@SAIPAPBVfacet@locale@2@@Z */
1413 /* ?_Getcat@?$collate@G@std@@SA_KPEAPEBVfacet@locale@2@@Z */
1414 MSVCP_size_t __cdecl collate_short__Getcat_old(const locale_facet **facet)
1416 return collate_short__Getcat(facet, locale_classic());
1419 static collate* collate_short_use_facet(const locale *loc)
1421 static collate *obj = NULL;
1423 _Lockit lock;
1424 const locale_facet *fac;
1426 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
1427 fac = locale__Getfacet(loc, locale_id_operator_size_t(&collate_short_id));
1428 if(fac) {
1429 _Lockit_dtor(&lock);
1430 return (collate*)fac;
1433 if(obj) {
1434 _Lockit_dtor(&lock);
1435 return obj;
1438 collate_short__Getcat(&fac, loc);
1439 obj = (collate*)fac;
1440 call_locale_facet__Incref(&obj->facet);
1441 locale_facet_register(&obj->facet);
1442 _Lockit_dtor(&lock);
1444 return obj;
1447 /* _Wcscoll */
1448 int __cdecl _Wcscoll(const wchar_t *first1, const wchar_t *last1, const wchar_t *first2,
1449 const wchar_t *last2, const _Collvec *coll)
1451 TRACE("(%s %s)\n", debugstr_wn(first1, last1-first1), debugstr_wn(first2, last2-first2));
1453 #if _MSVCP_VER < 110
1454 return CompareStringW(coll ? coll->handle : ___lc_handle_func()[LC_COLLATE],
1455 0, first1, last1-first1, first2, last2-first2)-CSTR_EQUAL;
1456 #else
1457 return CompareStringEx(coll ? coll->lc_name : ___lc_locale_name_func()[LC_COLLATE],
1458 0, first1, last1-first1, first2, last2-first2, NULL, NULL, 0)-CSTR_EQUAL;
1459 #endif
1462 /* ?do_compare@?$collate@_W@std@@MBEHPB_W000@Z */
1463 /* ?do_compare@?$collate@_W@std@@MEBAHPEB_W000@Z */
1464 /* ?do_compare@?$collate@G@std@@MBEHPBG000@Z */
1465 /* ?do_compare@?$collate@G@std@@MEBAHPEBG000@Z */
1466 DEFINE_THISCALL_WRAPPER(collate_wchar_do_compare, 20)
1467 #if _MSVCP_VER <= 100
1468 #define call_collate_wchar_do_compare(this, first1, last1, first2, last2) CALL_VTBL_FUNC(this, 4, int, \
1469 (const collate*, const wchar_t*, const wchar_t*, const wchar_t*, const wchar_t*), \
1470 (this, first1, last1, first2, last2))
1471 #else
1472 #define call_collate_wchar_do_compare(this, first1, last1, first2, last2) CALL_VTBL_FUNC(this, 12, int, \
1473 (const collate*, const wchar_t*, const wchar_t*, const wchar_t*, const wchar_t*), \
1474 (this, first1, last1, first2, last2))
1475 #endif
1476 int __thiscall collate_wchar_do_compare(const collate *this, const wchar_t *first1,
1477 const wchar_t *last1, const wchar_t *first2, const wchar_t *last2)
1479 TRACE("(%p %p %p %p %p)\n", this, first1, last1, first2, last2);
1480 return _Wcscoll(first1, last1, first2, last2, &this->coll);
1483 /* ?compare@?$collate@_W@std@@QBEHPB_W000@Z */
1484 /* ?compare@?$collate@_W@std@@QEBAHPEB_W000@Z */
1485 /* ?compare@?$collate@G@std@@QBEHPBG000@Z */
1486 /* ?compare@?$collate@G@std@@QEBAHPEBG000@Z */
1487 DEFINE_THISCALL_WRAPPER(collate_wchar_compare, 20)
1488 int __thiscall collate_wchar_compare(const collate *this, const wchar_t *first1,
1489 const wchar_t *last1, const wchar_t *first2, const wchar_t *last2)
1491 TRACE("(%p %p %p %p %p)\n", this, first1, last1, first2, last2);
1492 return call_collate_wchar_do_compare(this, first1, last1, first2, last2);
1495 /* ?do_hash@?$collate@_W@std@@MBEJPB_W0@Z */
1496 /* ?do_hash@?$collate@_W@std@@MEBAJPEB_W0@Z */
1497 /* ?do_hash@?$collate@G@std@@MBEJPBG0@Z */
1498 /* ?do_hash@?$collate@G@std@@MEBAJPEBG0@Z */
1499 DEFINE_THISCALL_WRAPPER(collate_wchar_do_hash, 12)
1500 #if _MSVCP_VER <= 100
1501 #define call_collate_wchar_do_hash(this, first, last) CALL_VTBL_FUNC(this, 12, LONG, \
1502 (const collate*, const wchar_t*, const wchar_t*), (this, first, last))
1503 #else
1504 #define call_collate_wchar_do_hash(this, first, last) CALL_VTBL_FUNC(this, 20, LONG, \
1505 (const collate*, const wchar_t*, const wchar_t*), (this, first, last))
1506 #endif
1507 LONG __thiscall collate_wchar_do_hash(const collate *this,
1508 const wchar_t *first, const wchar_t *last)
1510 ULONG ret = 0;
1512 TRACE("(%p %p %p)\n", this, first, last);
1514 for(; first<last; first++)
1515 ret = (ret<<8 | ret>>24) + *first;
1516 return ret;
1519 /* ?hash@?$collate@_W@std@@QBEJPB_W0@Z */
1520 /* ?hash@?$collate@_W@std@@QEBAJPEB_W0@Z */
1521 /* ?hash@?$collate@G@std@@QBEJPBG0@Z */
1522 /* ?hash@?$collate@G@std@@QEBAJPEBG0@Z */
1523 DEFINE_THISCALL_WRAPPER(collate_wchar_hash, 12)
1524 LONG __thiscall collate_wchar_hash(const collate *this,
1525 const wchar_t *first, const wchar_t *last)
1527 TRACE("(%p %p %p)\n", this, first, last);
1528 return call_collate_wchar_do_hash(this, first, last);
1531 /* ?do_transform@?$collate@_W@std@@MBE?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@PB_W0@Z */
1532 /* ?do_transform@?$collate@_W@std@@MEBA?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@PEB_W0@Z */
1533 /* ?do_transform@?$collate@G@std@@MBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@PBG0@Z */
1534 /* ?do_transform@?$collate@G@std@@MEBA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@PEBG0@Z */
1535 DEFINE_THISCALL_WRAPPER(collate_wchar_do_transform, 16)
1536 basic_string_wchar* __thiscall collate_wchar_do_transform(const collate *this,
1537 basic_string_wchar *ret, const wchar_t *first, const wchar_t *last)
1539 FIXME("(%p %p %p) stub\n", this, first, last);
1540 return ret;
1543 /* ?transform@?$collate@_W@std@@QBE?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@PB_W0@Z */
1544 /* ?transform@?$collate@_W@std@@QEBA?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@PEB_W0@Z */
1545 /* ?transform@?$collate@G@std@@QBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@PBG0@Z */
1546 /* ?transform@?$collate@G@std@@QEBA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@PEBG0@Z */
1547 DEFINE_THISCALL_WRAPPER(collate_wchar_transform, 16)
1548 basic_string_wchar* __thiscall collate_wchar_transform(const collate *this,
1549 basic_string_wchar *ret, const wchar_t *first, const wchar_t *last)
1551 FIXME("(%p %p %p) stub\n", this, first, last);
1552 return ret;
1555 /* ??_7ctype_base@std@@6B@ */
1556 extern const vtable_ptr MSVCP_ctype_base_vtable;
1558 /* ??0ctype_base@std@@QAE@I@Z */
1559 /* ??0ctype_base@std@@QEAA@_K@Z */
1560 DEFINE_THISCALL_WRAPPER(ctype_base_ctor_refs, 8)
1561 ctype_base* __thiscall ctype_base_ctor_refs(ctype_base *this, MSVCP_size_t refs)
1563 TRACE("(%p %lu)\n", this, refs);
1564 locale_facet_ctor_refs(&this->facet, refs);
1565 this->facet.vtable = &MSVCP_ctype_base_vtable;
1566 return this;
1569 /* ??_Fctype_base@std@@QAEXXZ */
1570 /* ??_Fctype_base@std@@QEAAXXZ */
1571 DEFINE_THISCALL_WRAPPER(ctype_base_ctor, 4)
1572 ctype_base* __thiscall ctype_base_ctor(ctype_base *this)
1574 TRACE("(%p)\n", this);
1575 locale_facet_ctor_refs(&this->facet, 0);
1576 this->facet.vtable = &MSVCP_ctype_base_vtable;
1577 return this;
1580 /* ??1ctype_base@std@@UAE@XZ */
1581 /* ??1ctype_base@std@@UEAA@XZ */
1582 DEFINE_THISCALL_WRAPPER(ctype_base_dtor, 4)
1583 void __thiscall ctype_base_dtor(ctype_base *this)
1585 TRACE("(%p)\n", this);
1588 DEFINE_THISCALL_WRAPPER(ctype_base_vector_dtor, 8)
1589 ctype_base* __thiscall ctype_base_vector_dtor(ctype_base *this, unsigned int flags)
1591 TRACE("(%p %x)\n", this, flags);
1592 if(flags & 2) {
1593 /* we have an array, with the number of elements stored before the first object */
1594 INT_PTR i, *ptr = (INT_PTR *)this-1;
1596 for(i=*ptr-1; i>=0; i--)
1597 ctype_base_dtor(this+i);
1598 MSVCRT_operator_delete(ptr);
1599 } else {
1600 ctype_base_dtor(this);
1601 if(flags & 1)
1602 MSVCRT_operator_delete(this);
1605 return this;
1608 /* ?_Xran@ctype_base@std@@KAXXZ */
1609 void __cdecl ctype_base__Xran(void)
1611 throw_exception(EXCEPTION_OUT_OF_RANGE, "out of range in ctype<T>");
1614 /* ?id@?$ctype@D@std@@2V0locale@2@A */
1615 locale_id ctype_char_id = {0};
1616 /* ?table_size@?$ctype@D@std@@2IB */
1617 /* ?table_size@?$ctype@D@std@@2_KB */
1618 MSVCP_size_t ctype_char_table_size = 256;
1620 /* ??_7?$ctype@D@std@@6B@ */
1621 extern const vtable_ptr MSVCP_ctype_char_vtable;
1623 /* ?_Id_func@?$ctype@D@std@@SAAAVid@locale@2@XZ */
1624 /* ?_Id_func@?$ctype@D@std@@SAAEAVid@locale@2@XZ */
1625 locale_id* __cdecl ctype_char__Id_func(void)
1627 TRACE("()\n");
1628 return &ctype_char_id;
1631 /* ?_Init@?$ctype@D@std@@IAEXABV_Locinfo@2@@Z */
1632 /* ?_Init@?$ctype@D@std@@IEAAXAEBV_Locinfo@2@@Z */
1633 DEFINE_THISCALL_WRAPPER(ctype_char__Init, 8)
1634 void __thiscall ctype_char__Init(ctype_char *this, const _Locinfo *locinfo)
1636 TRACE("(%p %p)\n", this, locinfo);
1637 _Locinfo__Getctype(locinfo, &this->ctype);
1640 /* ?_Tidy@?$ctype@D@std@@IAEXXZ */
1641 /* ?_Tidy@?$ctype@D@std@@IEAAXXZ */
1642 DEFINE_THISCALL_WRAPPER(ctype_char__Tidy, 4)
1643 void __thiscall ctype_char__Tidy(ctype_char *this)
1645 TRACE("(%p)\n", this);
1647 if(this->ctype.delfl)
1648 free((short*)this->ctype.table);
1649 #if _MSVCP_VER >= 110
1650 free(this->ctype.name);
1651 #endif
1654 /* ?classic_table@?$ctype@D@std@@KAPBFXZ */
1655 /* ?classic_table@?$ctype@D@std@@KAPEBFXZ */
1656 const short* __cdecl ctype_char_classic_table(void)
1658 ctype_char *ctype;
1660 TRACE("()\n");
1661 ctype = ctype_char_use_facet( locale_classic() );
1662 return ctype->ctype.table;
1665 /* ??0?$ctype@D@std@@QAE@ABV_Locinfo@1@I@Z */
1666 /* ??0?$ctype@D@std@@QEAA@AEBV_Locinfo@1@_K@Z */
1667 DEFINE_THISCALL_WRAPPER(ctype_char_ctor_locinfo, 12)
1668 ctype_char* __thiscall ctype_char_ctor_locinfo(ctype_char *this,
1669 const _Locinfo *locinfo, MSVCP_size_t refs)
1671 TRACE("(%p %p %lu)\n", this, locinfo, refs);
1672 ctype_base_ctor_refs(&this->base, refs);
1673 this->base.facet.vtable = &MSVCP_ctype_char_vtable;
1674 ctype_char__Init(this, locinfo);
1675 return this;
1678 /* ??0?$ctype@D@std@@QAE@PBF_NI@Z */
1679 /* ??0?$ctype@D@std@@QEAA@PEBF_N_K@Z */
1680 DEFINE_THISCALL_WRAPPER(ctype_char_ctor_table, 16)
1681 ctype_char* __thiscall ctype_char_ctor_table(ctype_char *this,
1682 const short *table, MSVCP_bool delete, MSVCP_size_t refs)
1684 _Locinfo locinfo;
1686 TRACE("(%p %p %d %lu)\n", this, table, delete, refs);
1688 ctype_base_ctor_refs(&this->base, refs);
1689 this->base.facet.vtable = &MSVCP_ctype_char_vtable;
1691 _Locinfo_ctor(&locinfo);
1692 ctype_char__Init(this, &locinfo);
1693 _Locinfo_dtor(&locinfo);
1695 if(table) {
1696 ctype_char__Tidy(this);
1697 this->ctype.table = table;
1698 this->ctype.delfl = delete;
1700 return this;
1703 /* ??_F?$ctype@D@std@@QAEXXZ */
1704 /* ??_F?$ctype@D@std@@QEAAXXZ */
1705 DEFINE_THISCALL_WRAPPER(ctype_char_ctor, 4)
1706 ctype_char* __thiscall ctype_char_ctor(ctype_char *this)
1708 return ctype_char_ctor_table(this, NULL, FALSE, 0);
1711 /* ??1?$ctype@D@std@@UAE@XZ */
1712 /* ??1?$ctype@D@std@@UEAA@XZ */
1713 /* ??1?$ctype@D@std@@MAE@XZ */
1714 /* ??1?$ctype@D@std@@MEAA@XZ */
1715 DEFINE_THISCALL_WRAPPER(ctype_char_dtor, 4)
1716 void __thiscall ctype_char_dtor(ctype_char *this)
1718 TRACE("(%p)\n", this);
1719 ctype_char__Tidy(this);
1722 DEFINE_THISCALL_WRAPPER(ctype_char_vector_dtor, 8)
1723 ctype_char* __thiscall ctype_char_vector_dtor(ctype_char *this, unsigned int flags)
1725 TRACE("(%p %x)\n", this, flags);
1726 if(flags & 2) {
1727 /* we have an array, with the number of elements stored before the first object */
1728 INT_PTR i, *ptr = (INT_PTR *)this-1;
1730 for(i=*ptr-1; i>=0; i--)
1731 ctype_char_dtor(this+i);
1732 MSVCRT_operator_delete(ptr);
1733 } else {
1734 ctype_char_dtor(this);
1735 if(flags & 1)
1736 MSVCRT_operator_delete(this);
1739 return this;
1742 /* ?do_narrow@?$ctype@D@std@@MBEDDD@Z */
1743 /* ?do_narrow@?$ctype@D@std@@MEBADDD@Z */
1744 DEFINE_THISCALL_WRAPPER(ctype_char_do_narrow_ch, 12)
1745 #if _MSVCP_VER >= 80 && _MSVCP_VER <= 90
1746 #define call_ctype_char_do_narrow_ch(this, ch, unused) CALL_VTBL_FUNC(this, 36, \
1747 char, (const ctype_char*, char, char), (this, ch, unused))
1748 #elif _MSVCP_VER <= 100
1749 #define call_ctype_char_do_narrow_ch(this, ch, unused) CALL_VTBL_FUNC(this, 32, \
1750 char, (const ctype_char*, char, char), (this, ch, unused))
1751 #else
1752 #define call_ctype_char_do_narrow_ch(this, ch, unused) CALL_VTBL_FUNC(this, 40, \
1753 char, (const ctype_char*, char, char), (this, ch, unused))
1754 #endif
1755 char __thiscall ctype_char_do_narrow_ch(const ctype_char *this, char ch, char unused)
1757 TRACE("(%p %c %c)\n", this, ch, unused);
1758 return ch;
1761 /* ?do_narrow@?$ctype@D@std@@MBEPBDPBD0DPAD@Z */
1762 /* ?do_narrow@?$ctype@D@std@@MEBAPEBDPEBD0DPEAD@Z */
1763 DEFINE_THISCALL_WRAPPER(ctype_char_do_narrow, 20)
1764 #if _MSVCP_VER >= 80 && _MSVCP_VER <= 90
1765 #define call_ctype_char_do_narrow(this, first, last, unused, dest) CALL_VTBL_FUNC(this, 32, \
1766 const char*, (const ctype_char*, const char*, const char*, char, char*), \
1767 (this, first, last, unused, dest))
1768 #elif _MSVCP_VER <= 100
1769 #define call_ctype_char_do_narrow(this, first, last, unused, dest) CALL_VTBL_FUNC(this, 28, \
1770 const char*, (const ctype_char*, const char*, const char*, char, char*), \
1771 (this, first, last, unused, dest))
1772 #else
1773 #define call_ctype_char_do_narrow(this, first, last, unused, dest) CALL_VTBL_FUNC(this, 36, \
1774 const char*, (const ctype_char*, const char*, const char*, char, char*), \
1775 (this, first, last, unused, dest))
1776 #endif
1777 const char* __thiscall ctype_char_do_narrow(const ctype_char *this,
1778 const char *first, const char *last, char unused, char *dest)
1780 TRACE("(%p %p %p %p)\n", this, first, last, dest);
1781 memcpy(dest, first, last-first);
1782 return last;
1785 /* ?_Do_narrow_s@?$ctype@D@std@@MBEPBDPBD0DPADI@Z */
1786 /* ?_Do_narrow_s@?$ctype@D@std@@MEBAPEBDPEBD0DPEAD_K@Z */
1787 DEFINE_THISCALL_WRAPPER(ctype_char__Do_narrow_s, 24)
1788 #define call_ctype_char__Do_narrow_s(this, first, last, unused, dest, size) CALL_VTBL_FUNC(this, 40, \
1789 const char*, (const ctype_char*, const char*, const char*, char, char*, MSVCP_size_t), \
1790 (this, first, last, unused, dest, size))
1791 const char* __thiscall ctype_char__Do_narrow_s(const ctype_char *this, const char *first,
1792 const char *last, char unused, char *dest, MSVCP_size_t size)
1794 TRACE("(%p %p %p %p %lu)\n", this, first, last, dest, size);
1795 memcpy_s(dest, size, first, last-first);
1796 return last;
1799 /* ?narrow@?$ctype@D@std@@QBEDDD@Z */
1800 /* ?narrow@?$ctype@D@std@@QEBADDD@Z */
1801 DEFINE_THISCALL_WRAPPER(ctype_char_narrow_ch, 12)
1802 char __thiscall ctype_char_narrow_ch(const ctype_char *this, char ch, char dflt)
1804 TRACE("(%p %c %c)\n", this, ch, dflt);
1805 return call_ctype_char_do_narrow_ch(this, ch, dflt);
1808 /* ?narrow@?$ctype@D@std@@QBEPBDPBD0DPAD@Z */
1809 /* ?narrow@?$ctype@D@std@@QEBAPEBDPEBD0DPEAD@Z */
1810 DEFINE_THISCALL_WRAPPER(ctype_char_narrow, 20)
1811 const char* __thiscall ctype_char_narrow(const ctype_char *this,
1812 const char *first, const char *last, char dflt, char *dest)
1814 TRACE("(%p %p %p %c %p)\n", this, first, last, dflt, dest);
1815 return call_ctype_char_do_narrow(this, first, last, dflt, dest);
1818 /* ?_Narrow_s@?$ctype@D@std@@QBEPBDPBD0DPADI@Z */
1819 /* ?_Narrow_s@?$ctype@D@std@@QEBAPEBDPEBD0DPEAD_K@Z */
1820 DEFINE_THISCALL_WRAPPER(ctype_char__Narrow_s, 24)
1821 const char* __thiscall ctype_char__Narrow_s(const ctype_char *this, const char *first,
1822 const char *last, char dflt, char *dest, MSVCP_size_t size)
1824 TRACE("(%p %p %p %p %lu)\n", this, first, last, dest, size);
1825 return call_ctype_char__Do_narrow_s(this, first, last, dflt, dest, size);
1828 /* ?do_widen@?$ctype@D@std@@MBEDD@Z */
1829 /* ?do_widen@?$ctype@D@std@@MEBADD@Z */
1830 DEFINE_THISCALL_WRAPPER(ctype_char_do_widen_ch, 8)
1831 #if _MSVCP_VER <= 100
1832 #define call_ctype_char_do_widen_ch(this, ch) CALL_VTBL_FUNC(this, 24, \
1833 char, (const ctype_char*, char), (this, ch))
1834 #else
1835 #define call_ctype_char_do_widen_ch(this, ch) CALL_VTBL_FUNC(this, 32, \
1836 char, (const ctype_char*, char), (this, ch))
1837 #endif
1838 char __thiscall ctype_char_do_widen_ch(const ctype_char *this, char ch)
1840 TRACE("(%p %c)\n", this, ch);
1841 return ch;
1844 /* ?do_widen@?$ctype@D@std@@MBEPBDPBD0PAD@Z */
1845 /* ?do_widen@?$ctype@D@std@@MEBAPEBDPEBD0PEAD@Z */
1846 DEFINE_THISCALL_WRAPPER(ctype_char_do_widen, 16)
1847 #if _MSVCP_VER <= 100
1848 #define call_ctype_char_do_widen(this, first, last, dest) CALL_VTBL_FUNC(this, 20, \
1849 const char*, (const ctype_char*, const char*, const char*, char*), \
1850 (this, first, last, dest))
1851 #else
1852 #define call_ctype_char_do_widen(this, first, last, dest) CALL_VTBL_FUNC(this, 28, \
1853 const char*, (const ctype_char*, const char*, const char*, char*), \
1854 (this, first, last, dest))
1855 #endif
1856 const char* __thiscall ctype_char_do_widen(const ctype_char *this,
1857 const char *first, const char *last, char *dest)
1859 TRACE("(%p %p %p %p)\n", this, first, last, dest);
1860 memcpy(dest, first, last-first);
1861 return last;
1864 /* ?_Do_widen_s@?$ctype@D@std@@MBEPBDPBD0PADI@Z */
1865 /* ?_Do_widen_s@?$ctype@D@std@@MEBAPEBDPEBD0PEAD_K@Z */
1866 DEFINE_THISCALL_WRAPPER(ctype_char__Do_widen_s, 20)
1867 #define call_ctype_char__Do_widen_s(this, first, last, dest, size) CALL_VTBL_FUNC(this, 28, \
1868 const char*, (const ctype_char*, const char*, const char*, char*, MSVCP_size_t), \
1869 (this, first, last, dest, size))
1870 const char* __thiscall ctype_char__Do_widen_s(const ctype_char *this,
1871 const char *first, const char *last, char *dest, MSVCP_size_t size)
1873 TRACE("(%p %p %p %p %lu)\n", this, first, last, dest, size);
1874 memcpy_s(dest, size, first, last-first);
1875 return last;
1878 /* ?widen@?$ctype@D@std@@QBEDD@Z */
1879 /* ?widen@?$ctype@D@std@@QEBADD@Z */
1880 DEFINE_THISCALL_WRAPPER(ctype_char_widen_ch, 8)
1881 char __thiscall ctype_char_widen_ch(const ctype_char *this, char ch)
1883 TRACE("(%p %c)\n", this, ch);
1884 return call_ctype_char_do_widen_ch(this, ch);
1887 /* ?widen@?$ctype@D@std@@QBEPBDPBD0PAD@Z */
1888 /* ?widen@?$ctype@D@std@@QEBAPEBDPEBD0PEAD@Z */
1889 DEFINE_THISCALL_WRAPPER(ctype_char_widen, 16)
1890 const char* __thiscall ctype_char_widen(const ctype_char *this,
1891 const char *first, const char *last, char *dest)
1893 TRACE("(%p %p %p %p)\n", this, first, last, dest);
1894 return call_ctype_char_do_widen(this, first, last, dest);
1897 /* ?_Widen_s@?$ctype@D@std@@QBEPBDPBD0PADI@Z */
1898 /* ?_Widen_s@?$ctype@D@std@@QEBAPEBDPEBD0PEAD_K@Z */
1899 DEFINE_THISCALL_WRAPPER(ctype_char__Widen_s, 20)
1900 const char* __thiscall ctype_char__Widen_s(const ctype_char *this,
1901 const char *first, const char *last, char *dest, MSVCP_size_t size)
1903 TRACE("(%p %p %p %p %lu)\n", this, first, last, dest, size);
1904 return call_ctype_char__Do_widen_s(this, first, last, dest, size);
1907 /* ?_Getcat@?$ctype@D@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
1908 /* ?_Getcat@?$ctype@D@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
1909 MSVCP_size_t __cdecl ctype_char__Getcat(const locale_facet **facet, const locale *loc)
1911 TRACE("(%p %p)\n", facet, loc);
1913 if(facet && !*facet) {
1914 _Locinfo locinfo;
1916 *facet = MSVCRT_operator_new(sizeof(ctype_char));
1917 if(!*facet) {
1918 ERR("Out of memory\n");
1919 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
1920 return 0;
1923 _Locinfo_ctor_cstr(&locinfo, locale_string_char_c_str(&loc->ptr->name));
1924 ctype_char_ctor_locinfo((ctype_char*)*facet, &locinfo, 0);
1925 _Locinfo_dtor(&locinfo);
1928 return LC_CTYPE;
1931 /* ?_Getcat@?$ctype@D@std@@SAIPAPBVfacet@locale@2@@Z */
1932 /* ?_Getcat@?$ctype@D@std@@SA_KPEAPEBVfacet@locale@2@@Z */
1933 MSVCP_size_t __cdecl ctype_char__Getcat_old(const locale_facet **facet)
1935 return ctype_char__Getcat(facet, locale_classic());
1938 ctype_char* ctype_char_use_facet(const locale *loc)
1940 static ctype_char *obj = NULL;
1942 _Lockit lock;
1943 const locale_facet *fac;
1945 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
1946 fac = locale__Getfacet(loc, locale_id_operator_size_t(&ctype_char_id));
1947 if(fac) {
1948 _Lockit_dtor(&lock);
1949 return (ctype_char*)fac;
1952 if(obj) {
1953 _Lockit_dtor(&lock);
1954 return obj;
1957 ctype_char__Getcat(&fac, loc);
1958 obj = (ctype_char*)fac;
1959 call_locale_facet__Incref(&obj->base.facet);
1960 locale_facet_register(&obj->base.facet);
1961 _Lockit_dtor(&lock);
1963 return obj;
1966 /* _Tolower */
1967 int __cdecl _Tolower(int ch, const _Ctypevec *ctype)
1969 unsigned int cp;
1971 TRACE("%d %p\n", ch, ctype);
1973 if(ctype)
1974 cp = ctype->page;
1975 else
1976 cp = ___lc_codepage_func();
1978 /* Don't convert to unicode in case of C locale */
1979 if(!cp) {
1980 if(ch>='A' && ch<='Z')
1981 ch = ch-'A'+'a';
1982 return ch;
1983 } else {
1984 WCHAR wide, lower;
1985 char str[2];
1986 int size;
1988 if(ch > 255) {
1989 str[0] = (ch>>8) & 255;
1990 str[1] = ch & 255;
1991 size = 2;
1992 } else {
1993 str[0] = ch & 255;
1994 size = 1;
1997 if(!MultiByteToWideChar(cp, MB_ERR_INVALID_CHARS, str, size, &wide, 1))
1998 return ch;
2000 lower = tolowerW(wide);
2001 if(lower == wide)
2002 return ch;
2004 WideCharToMultiByte(cp, 0, &lower, 1, str, 2, NULL, NULL);
2006 return str[0] + (str[1]<<8);
2010 /* ?do_tolower@?$ctype@D@std@@MBEDD@Z */
2011 /* ?do_tolower@?$ctype@D@std@@MEBADD@Z */
2012 #if _MSVCP_VER <= 100
2013 #define call_ctype_char_do_tolower_ch(this, ch) CALL_VTBL_FUNC(this, 8, \
2014 char, (const ctype_char*, char), (this, ch))
2015 #else
2016 #define call_ctype_char_do_tolower_ch(this, ch) CALL_VTBL_FUNC(this, 16, \
2017 char, (const ctype_char*, char), (this, ch))
2018 #endif
2019 DEFINE_THISCALL_WRAPPER(ctype_char_do_tolower_ch, 8)
2020 char __thiscall ctype_char_do_tolower_ch(const ctype_char *this, char ch)
2022 TRACE("(%p %c)\n", this, ch);
2023 return _Tolower(ch, &this->ctype);
2026 /* ?do_tolower@?$ctype@D@std@@MBEPBDPADPBD@Z */
2027 /* ?do_tolower@?$ctype@D@std@@MEBAPEBDPEADPEBD@Z */
2028 #if _MSVCP_VER <= 100
2029 #define call_ctype_char_do_tolower(this, first, last) CALL_VTBL_FUNC(this, 4, \
2030 const char*, (const ctype_char*, char*, const char*), (this, first, last))
2031 #else
2032 #define call_ctype_char_do_tolower(this, first, last) CALL_VTBL_FUNC(this, 12, \
2033 const char*, (const ctype_char*, char*, const char*), (this, first, last))
2034 #endif
2035 DEFINE_THISCALL_WRAPPER(ctype_char_do_tolower, 12)
2036 const char* __thiscall ctype_char_do_tolower(const ctype_char *this, char *first, const char *last)
2038 TRACE("(%p %p %p)\n", this, first, last);
2039 for(; first<last; first++)
2040 *first = _Tolower(*first, &this->ctype);
2041 return last;
2044 /* ?tolower@?$ctype@D@std@@QBEDD@Z */
2045 /* ?tolower@?$ctype@D@std@@QEBADD@Z */
2046 DEFINE_THISCALL_WRAPPER(ctype_char_tolower_ch, 8)
2047 char __thiscall ctype_char_tolower_ch(const ctype_char *this, char ch)
2049 TRACE("(%p %c)\n", this, ch);
2050 return call_ctype_char_do_tolower_ch(this, ch);
2053 /* ?tolower@?$ctype@D@std@@QBEPBDPADPBD@Z */
2054 /* ?tolower@?$ctype@D@std@@QEBAPEBDPEADPEBD@Z */
2055 DEFINE_THISCALL_WRAPPER(ctype_char_tolower, 12)
2056 const char* __thiscall ctype_char_tolower(const ctype_char *this, char *first, const char *last)
2058 TRACE("(%p %p %p)\n", this, first, last);
2059 return call_ctype_char_do_tolower(this, first, last);
2062 /* _Toupper */
2063 int __cdecl _Toupper(int ch, const _Ctypevec *ctype)
2065 unsigned int cp;
2067 TRACE("%d %p\n", ch, ctype);
2069 if(ctype)
2070 cp = ctype->page;
2071 else
2072 cp = ___lc_codepage_func();
2074 /* Don't convert to unicode in case of C locale */
2075 if(!cp) {
2076 if(ch>='a' && ch<='z')
2077 ch = ch-'a'+'A';
2078 return ch;
2079 } else {
2080 WCHAR wide, upper;
2081 char str[2];
2082 int size;
2084 if(ch > 255) {
2085 str[0] = (ch>>8) & 255;
2086 str[1] = ch & 255;
2087 size = 2;
2088 } else {
2089 str[0] = ch & 255;
2090 size = 1;
2093 if(!MultiByteToWideChar(cp, MB_ERR_INVALID_CHARS, str, size, &wide, 1))
2094 return ch;
2096 upper = toupperW(wide);
2097 if(upper == wide)
2098 return ch;
2100 WideCharToMultiByte(cp, 0, &upper, 1, str, 2, NULL, NULL);
2102 return str[0] + (str[1]<<8);
2106 /* ?do_toupper@?$ctype@D@std@@MBEDD@Z */
2107 /* ?do_toupper@?$ctype@D@std@@MEBADD@Z */
2108 #if _MSVCP_VER <= 100
2109 #define call_ctype_char_do_toupper_ch(this, ch) CALL_VTBL_FUNC(this, 16, \
2110 char, (const ctype_char*, char), (this, ch))
2111 #else
2112 #define call_ctype_char_do_toupper_ch(this, ch) CALL_VTBL_FUNC(this, 24, \
2113 char, (const ctype_char*, char), (this, ch))
2114 #endif
2115 DEFINE_THISCALL_WRAPPER(ctype_char_do_toupper_ch, 8)
2116 char __thiscall ctype_char_do_toupper_ch(const ctype_char *this, char ch)
2118 TRACE("(%p %c)\n", this, ch);
2119 return _Toupper(ch, &this->ctype);
2122 /* ?do_toupper@?$ctype@D@std@@MBEPBDPADPBD@Z */
2123 /* ?do_toupper@?$ctype@D@std@@MEBAPEBDPEADPEBD@Z */
2124 #if _MSVCP_VER <= 100
2125 #define call_ctype_char_do_toupper(this, first, last) CALL_VTBL_FUNC(this, 12, \
2126 const char*, (const ctype_char*, char*, const char*), (this, first, last))
2127 #else
2128 #define call_ctype_char_do_toupper(this, first, last) CALL_VTBL_FUNC(this, 20, \
2129 const char*, (const ctype_char*, char*, const char*), (this, first, last))
2130 #endif
2131 DEFINE_THISCALL_WRAPPER(ctype_char_do_toupper, 12)
2132 const char* __thiscall ctype_char_do_toupper(const ctype_char *this,
2133 char *first, const char *last)
2135 TRACE("(%p %p %p)\n", this, first, last);
2136 for(; first<last; first++)
2137 *first = _Toupper(*first, &this->ctype);
2138 return last;
2141 /* ?toupper@?$ctype@D@std@@QBEDD@Z */
2142 /* ?toupper@?$ctype@D@std@@QEBADD@Z */
2143 DEFINE_THISCALL_WRAPPER(ctype_char_toupper_ch, 8)
2144 char __thiscall ctype_char_toupper_ch(const ctype_char *this, char ch)
2146 TRACE("(%p %c)\n", this, ch);
2147 return call_ctype_char_do_toupper_ch(this, ch);
2150 /* ?toupper@?$ctype@D@std@@QBEPBDPADPBD@Z */
2151 /* ?toupper@?$ctype@D@std@@QEBAPEBDPEADPEBD@Z */
2152 DEFINE_THISCALL_WRAPPER(ctype_char_toupper, 12)
2153 const char* __thiscall ctype_char_toupper(const ctype_char *this, char *first, const char *last)
2155 TRACE("(%p %p %p)\n", this, first, last);
2156 return call_ctype_char_do_toupper(this, first, last);
2159 /* ?is@?$ctype@D@std@@QBE_NFD@Z */
2160 /* ?is@?$ctype@D@std@@QEBA_NFD@Z */
2161 DEFINE_THISCALL_WRAPPER(ctype_char_is_ch, 12)
2162 MSVCP_bool __thiscall ctype_char_is_ch(const ctype_char *this, short mask, char ch)
2164 TRACE("(%p %x %c)\n", this, mask, ch);
2165 return (this->ctype.table[(unsigned char)ch] & mask) != 0;
2168 /* ?is@?$ctype@D@std@@QBEPBDPBD0PAF@Z */
2169 /* ?is@?$ctype@D@std@@QEBAPEBDPEBD0PEAF@Z */
2170 DEFINE_THISCALL_WRAPPER(ctype_char_is, 16)
2171 const char* __thiscall ctype_char_is(const ctype_char *this, const char *first, const char *last, short *dest)
2173 TRACE("(%p %p %p %p)\n", this, first, last, dest);
2174 for(; first<last; first++)
2175 *dest++ = this->ctype.table[(unsigned char)*first];
2176 return last;
2179 /* ?scan_is@?$ctype@D@std@@QBEPBDFPBD0@Z */
2180 /* ?scan_is@?$ctype@D@std@@QEBAPEBDFPEBD0@Z */
2181 DEFINE_THISCALL_WRAPPER(ctype_char_scan_is, 16)
2182 const char* __thiscall ctype_char_scan_is(const ctype_char *this, short mask, const char *first, const char *last)
2184 TRACE("(%p %x %p %p)\n", this, mask, first, last);
2185 for(; first<last; first++)
2186 if(!ctype_char_is_ch(this, mask, *first))
2187 break;
2188 return first;
2191 /* ?scan_not@?$ctype@D@std@@QBEPBDFPBD0@Z */
2192 /* ?scan_not@?$ctype@D@std@@QEBAPEBDFPEBD0@Z */
2193 DEFINE_THISCALL_WRAPPER(ctype_char_scan_not, 16)
2194 const char* __thiscall ctype_char_scan_not(const ctype_char *this, short mask, const char *first, const char *last)
2196 TRACE("(%p %x %p %p)\n", this, mask, first, last);
2197 for(; first<last; first++)
2198 if(ctype_char_is_ch(this, mask, *first))
2199 break;
2200 return first;
2203 /* ?table@?$ctype@D@std@@IBEPBFXZ */
2204 /* ?table@?$ctype@D@std@@IEBAPEBFXZ */
2205 DEFINE_THISCALL_WRAPPER(ctype_char_table, 4)
2206 const short* __thiscall ctype_char_table(const ctype_char *this)
2208 TRACE("(%p)\n", this);
2209 return this->ctype.table;
2212 /* ?id@?$ctype@_W@std@@2V0locale@2@A */
2213 locale_id ctype_wchar_id = {0};
2214 /* ?id@?$ctype@G@std@@2V0locale@2@A */
2215 locale_id ctype_short_id = {0};
2217 /* ??_7?$ctype@_W@std@@6B@ */
2218 extern const vtable_ptr MSVCP_ctype_wchar_vtable;
2219 /* ??_7?$ctype@G@std@@6B@ */
2220 extern const vtable_ptr MSVCP_ctype_short_vtable;
2222 /* ?_Id_func@?$ctype@_W@std@@SAAAVid@locale@2@XZ */
2223 /* ?_Id_func@?$ctype@_W@std@@SAAEAVid@locale@2@XZ */
2224 locale_id* __cdecl ctype_wchar__Id_func(void)
2226 TRACE("()\n");
2227 return &ctype_wchar_id;
2230 /* ?_Id_func@?$ctype@G@std@@SAAAVid@locale@2@XZ */
2231 /* ?_Id_func@?$ctype@G@std@@SAAEAVid@locale@2@XZ */
2232 locale_id* __cdecl ctype_short__Id_func(void)
2234 TRACE("()\n");
2235 return &ctype_short_id;
2238 /* ?_Init@?$ctype@_W@std@@IAEXABV_Locinfo@2@@Z */
2239 /* ?_Init@?$ctype@_W@std@@IEAAXAEBV_Locinfo@2@@Z */
2240 /* ?_Init@?$ctype@G@std@@IAEXABV_Locinfo@2@@Z */
2241 /* ?_Init@?$ctype@G@std@@IEAAXAEBV_Locinfo@2@@Z */
2242 DEFINE_THISCALL_WRAPPER(ctype_wchar__Init, 8)
2243 void __thiscall ctype_wchar__Init(ctype_wchar *this, const _Locinfo *locinfo)
2245 TRACE("(%p %p)\n", this, locinfo);
2246 _Locinfo__Getctype(locinfo, &this->ctype);
2247 _Locinfo__Getcvt(locinfo, &this->cvt);
2250 /* ??0?$ctype@_W@std@@QAE@ABV_Locinfo@1@I@Z */
2251 /* ??0?$ctype@_W@std@@QEAA@AEBV_Locinfo@1@_K@Z */
2252 DEFINE_THISCALL_WRAPPER(ctype_wchar_ctor_locinfo, 12)
2253 ctype_wchar* __thiscall ctype_wchar_ctor_locinfo(ctype_wchar *this,
2254 const _Locinfo *locinfo, MSVCP_size_t refs)
2256 TRACE("(%p %p %lu)\n", this, locinfo, refs);
2257 ctype_base_ctor_refs(&this->base, refs);
2258 this->base.facet.vtable = &MSVCP_ctype_wchar_vtable;
2259 ctype_wchar__Init(this, locinfo);
2260 return this;
2263 /* ??0?$ctype@G@std@@QAE@ABV_Locinfo@1@I@Z */
2264 /* ??0?$ctype@G@std@@QEAA@AEBV_Locinfo@1@_K@Z */
2265 DEFINE_THISCALL_WRAPPER(ctype_short_ctor_locinfo, 12)
2266 ctype_wchar* __thiscall ctype_short_ctor_locinfo(ctype_wchar *this,
2267 const _Locinfo *locinfo, MSVCP_size_t refs)
2269 ctype_wchar *ret = ctype_wchar_ctor_locinfo(this, locinfo, refs);
2270 this->base.facet.vtable = &MSVCP_ctype_short_vtable;
2271 return ret;
2274 /* ??0?$ctype@_W@std@@QAE@I@Z */
2275 /* ??0?$ctype@_W@std@@QEAA@_K@Z */
2276 DEFINE_THISCALL_WRAPPER(ctype_wchar_ctor_refs, 8)
2277 ctype_wchar* __thiscall ctype_wchar_ctor_refs(ctype_wchar *this, MSVCP_size_t refs)
2279 _Locinfo locinfo;
2281 TRACE("(%p %lu)\n", this, refs);
2283 ctype_base_ctor_refs(&this->base, refs);
2284 this->base.facet.vtable = &MSVCP_ctype_wchar_vtable;
2286 _Locinfo_ctor(&locinfo);
2287 ctype_wchar__Init(this, &locinfo);
2288 _Locinfo_dtor(&locinfo);
2289 return this;
2292 /* ??0?$ctype@G@std@@QAE@I@Z */
2293 /* ??0?$ctype@G@std@@QEAA@_K@Z */
2294 DEFINE_THISCALL_WRAPPER(ctype_short_ctor_refs, 8)
2295 ctype_wchar* __thiscall ctype_short_ctor_refs(ctype_wchar *this, MSVCP_size_t refs)
2297 ctype_wchar *ret = ctype_wchar_ctor_refs(this, refs);
2298 this->base.facet.vtable = &MSVCP_ctype_short_vtable;
2299 return ret;
2302 /* ??0?$ctype@G@std@@IAE@PBDI@Z */
2303 /* ??0?$ctype@G@std@@IEAA@PEBD_K@Z */
2304 DEFINE_THISCALL_WRAPPER(ctype_short_ctor_name, 12)
2305 ctype_wchar* __thiscall ctype_short_ctor_name(ctype_wchar *this,
2306 const char *name, MSVCP_size_t refs)
2308 _Locinfo locinfo;
2310 TRACE("(%p %s %lu)\n", this, debugstr_a(name), refs);
2312 ctype_base_ctor_refs(&this->base, refs);
2313 this->base.facet.vtable = &MSVCP_ctype_short_vtable;
2315 _Locinfo_ctor_cstr(&locinfo, name);
2316 ctype_wchar__Init(this, &locinfo);
2317 _Locinfo_dtor(&locinfo);
2318 return this;
2321 /* ??_F?$ctype@_W@std@@QAEXXZ */
2322 /* ??_F?$ctype@_W@std@@QEAAXXZ */
2323 DEFINE_THISCALL_WRAPPER(ctype_wchar_ctor, 4)
2324 ctype_wchar* __thiscall ctype_wchar_ctor(ctype_wchar *this)
2326 TRACE("(%p)\n", this);
2327 return ctype_short_ctor_refs(this, 0);
2330 /* ??_F?$ctype@G@std@@QAEXXZ */
2331 /* ??_F?$ctype@G@std@@QEAAXXZ */
2332 DEFINE_THISCALL_WRAPPER(ctype_short_ctor, 4)
2333 ctype_wchar* __thiscall ctype_short_ctor(ctype_wchar *this)
2335 ctype_wchar *ret = ctype_wchar_ctor(this);
2336 this->base.facet.vtable = &MSVCP_ctype_short_vtable;
2337 return ret;
2340 /* ??1?$ctype@G@std@@UAE@XZ */
2341 /* ??1?$ctype@G@std@@UEAA@XZ */
2342 /* ??1?$ctype@_W@std@@MAE@XZ */
2343 /* ??1?$ctype@_W@std@@MEAA@XZ */
2344 /* ??1?$ctype@G@std@@MAE@XZ */
2345 /* ??1?$ctype@G@std@@MEAA@XZ */
2346 DEFINE_THISCALL_WRAPPER(ctype_wchar_dtor, 4)
2347 void __thiscall ctype_wchar_dtor(ctype_wchar *this)
2349 TRACE("(%p)\n", this);
2350 if(this->ctype.delfl)
2351 free((void*)this->ctype.table);
2352 #if _MSVCP_VER >= 110
2353 free(this->ctype.name);
2354 #endif
2357 DEFINE_THISCALL_WRAPPER(ctype_wchar_vector_dtor, 8)
2358 ctype_wchar* __thiscall ctype_wchar_vector_dtor(ctype_wchar *this, unsigned int flags)
2360 TRACE("(%p %x)\n", this, flags);
2361 if(flags & 2) {
2362 /* we have an array, with the number of elements stored before the first object */
2363 INT_PTR i, *ptr = (INT_PTR *)this-1;
2365 for(i=*ptr-1; i>=0; i--)
2366 ctype_wchar_dtor(this+i);
2367 MSVCRT_operator_delete(ptr);
2368 } else {
2369 ctype_wchar_dtor(this);
2370 if(flags & 1)
2371 MSVCRT_operator_delete(this);
2374 return this;
2377 /* _Wcrtomb */
2378 int __cdecl _Wcrtomb(char *s, wchar_t wch, int *state, const _Cvtvec *cvt)
2380 int cp, size;
2381 BOOL def;
2383 TRACE("%p %d %p %p\n", s, wch, state, cvt);
2385 if(cvt)
2386 cp = cvt->page;
2387 else
2388 cp = ___lc_codepage_func();
2390 if(!cp) {
2391 if(wch > 255) {
2392 *_errno() = EILSEQ;
2393 return -1;
2396 *s = wch & 255;
2397 return 1;
2400 size = WideCharToMultiByte(cp, 0, &wch, 1, s, MB_LEN_MAX, NULL, &def);
2401 if(!size || def) {
2402 *_errno() = EILSEQ;
2403 return -1;
2406 return size;
2409 /* ?_Donarrow@?$ctype@_W@std@@IBED_WD@Z */
2410 /* ?_Donarrow@?$ctype@_W@std@@IEBAD_WD@Z */
2411 /* ?_Donarrow@?$ctype@G@std@@IBEDGD@Z */
2412 /* ?_Donarrow@?$ctype@G@std@@IEBADGD@Z */
2413 DEFINE_THISCALL_WRAPPER(ctype_wchar__Donarrow, 12)
2414 char __thiscall ctype_wchar__Donarrow(const ctype_wchar *this, wchar_t ch, char dflt)
2416 char buf[MB_LEN_MAX];
2418 TRACE("(%p %d %d)\n", this, ch, dflt);
2420 return _Wcrtomb(buf, ch, NULL, &this->cvt)==1 ? buf[0] : dflt;
2423 /* ?do_narrow@?$ctype@_W@std@@MBED_WD@Z */
2424 /* ?do_narrow@?$ctype@_W@std@@MEBAD_WD@Z */
2425 /* ?do_narrow@?$ctype@G@std@@MBEDGD@Z */
2426 /* ?do_narrow@?$ctype@G@std@@MEBADGD@Z */
2427 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_narrow_ch, 12)
2428 #if _MSVCP_VER >= 80 && _MSVCP_VER <= 90
2429 #define call_ctype_wchar_do_narrow_ch(this, ch, dflt) CALL_VTBL_FUNC(this, 52, \
2430 char, (const ctype_wchar*, wchar_t, char), (this, ch, dflt))
2431 #elif _MSVCP_VER <= 100
2432 #define call_ctype_wchar_do_narrow_ch(this, ch, dflt) CALL_VTBL_FUNC(this, 48, \
2433 char, (const ctype_wchar*, wchar_t, char), (this, ch, dflt))
2434 #else
2435 #define call_ctype_wchar_do_narrow_ch(this, ch, dflt) CALL_VTBL_FUNC(this, 56, \
2436 char, (const ctype_wchar*, wchar_t, char), (this, ch, dflt))
2437 #endif
2438 char __thiscall ctype_wchar_do_narrow_ch(const ctype_wchar *this, wchar_t ch, char dflt)
2440 return ctype_wchar__Donarrow(this, ch, dflt);
2443 /* ?do_narrow@?$ctype@_W@std@@MBEPB_WPB_W0DPAD@Z */
2444 /* ?do_narrow@?$ctype@_W@std@@MEBAPEB_WPEB_W0DPEAD@Z */
2445 /* ?do_narrow@?$ctype@G@std@@MBEPBGPBG0DPAD@Z */
2446 /* ?do_narrow@?$ctype@G@std@@MEBAPEBGPEBG0DPEAD@Z */
2447 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_narrow, 20)
2448 #if _MSVCP_VER >= 80 && _MSVCP_VER <= 90
2449 #define call_ctype_wchar_do_narrow(this, first, last, dflt, dest) CALL_VTBL_FUNC(this, 48, \
2450 const wchar_t*, (const ctype_wchar*, const wchar_t*, const wchar_t*, char, char*), \
2451 (this, first, last, dflt, dest))
2452 #elif _MSVCP_VER <= 100
2453 #define call_ctype_wchar_do_narrow(this, first, last, dflt, dest) CALL_VTBL_FUNC(this, 44, \
2454 const wchar_t*, (const ctype_wchar*, const wchar_t*, const wchar_t*, char, char*), \
2455 (this, first, last, dflt, dest))
2456 #else
2457 #define call_ctype_wchar_do_narrow(this, first, last, dflt, dest) CALL_VTBL_FUNC(this, 52, \
2458 const wchar_t*, (const ctype_wchar*, const wchar_t*, const wchar_t*, char, char*), \
2459 (this, first, last, dflt, dest))
2460 #endif
2461 const wchar_t* __thiscall ctype_wchar_do_narrow(const ctype_wchar *this,
2462 const wchar_t *first, const wchar_t *last, char dflt, char *dest)
2464 TRACE("(%p %p %p %d %p)\n", this, first, last, dflt, dest);
2465 for(; first<last; first++)
2466 *dest++ = ctype_wchar__Donarrow(this, *first, dflt);
2467 return last;
2470 /* ?_Do_narrow_s@?$ctype@_W@std@@MBEPB_WPB_W0DPADI@Z */
2471 /* ?_Do_narrow_s@?$ctype@_W@std@@MEBAPEB_WPEB_W0DPEAD_K@Z */
2472 /* ?_Do_narrow_s@?$ctype@G@std@@MBEPBGPBG0DPADI@Z */
2473 /* ?_Do_narrow_s@?$ctype@G@std@@MEBAPEBGPEBG0DPEAD_K@Z */
2474 DEFINE_THISCALL_WRAPPER(ctype_wchar__Do_narrow_s, 24)
2475 #define call_ctype_wchar__Do_narrow_s(this, first, last, dflt, dest, size) CALL_VTBL_FUNC(this, 56, \
2476 const wchar_t*, (const ctype_wchar*, const wchar_t*, const wchar_t*, char, char*, MSVCP_size_t), \
2477 (this, first, last, dflt, dest, size))
2478 const wchar_t* __thiscall ctype_wchar__Do_narrow_s(const ctype_wchar *this,
2479 const wchar_t *first, const wchar_t *last, char dflt, char *dest, MSVCP_size_t size)
2481 TRACE("(%p %p %p %d %p %lu)\n", this, first, last, dflt, dest, size);
2482 /* This function converts all multi-byte characters to dflt,
2483 * thanks to it result size is known before converting */
2484 if(last-first > size)
2485 ctype_base__Xran();
2486 return ctype_wchar_do_narrow(this, first, last, dflt, dest);
2489 /* ?narrow@?$ctype@_W@std@@QBED_WD@Z */
2490 /* ?narrow@?$ctype@_W@std@@QEBAD_WD@Z */
2491 /* ?narrow@?$ctype@G@std@@QBEDGD@Z */
2492 /* ?narrow@?$ctype@G@std@@QEBADGD@Z */
2493 DEFINE_THISCALL_WRAPPER(ctype_wchar_narrow_ch, 12)
2494 char __thiscall ctype_wchar_narrow_ch(const ctype_wchar *this, wchar_t ch, char dflt)
2496 TRACE("(%p %d %d)\n", this, ch, dflt);
2497 return call_ctype_wchar_do_narrow_ch(this, ch, dflt);
2500 /* ?narrow@?$ctype@_W@std@@QBEPB_WPB_W0DPAD@Z */
2501 /* ?narrow@?$ctype@_W@std@@QEBAPEB_WPEB_W0DPEAD@Z */
2502 /* ?narrow@?$ctype@G@std@@QBEPBGPBG0DPAD@Z */
2503 /* ?narrow@?$ctype@G@std@@QEBAPEBGPEBG0DPEAD@Z */
2504 DEFINE_THISCALL_WRAPPER(ctype_wchar_narrow, 20)
2505 const wchar_t* __thiscall ctype_wchar_narrow(const ctype_wchar *this,
2506 const wchar_t *first, const wchar_t *last, char dflt, char *dest)
2508 TRACE("(%p %p %p %d %p)\n", this, first, last, dflt, dest);
2509 return call_ctype_wchar_do_narrow(this, first, last, dflt, dest);
2512 /* ?_Narrow_s@?$ctype@_W@std@@QBEPB_WPB_W0DPADI@Z */
2513 /* ?_Narrow_s@?$ctype@_W@std@@QEBAPEB_WPEB_W0DPEAD_K@Z */
2514 /* ?_Narrow_s@?$ctype@G@std@@QBEPBGPBG0DPADI@Z */
2515 /* ?_Narrow_s@?$ctype@G@std@@QEBAPEBGPEBG0DPEAD_K@Z */
2516 DEFINE_THISCALL_WRAPPER(ctype_wchar__Narrow_s, 24)
2517 const wchar_t* __thiscall ctype_wchar__Narrow_s(const ctype_wchar *this, const wchar_t *first,
2518 const wchar_t *last, char dflt, char *dest, MSVCP_size_t size)
2520 TRACE("(%p %p %p %d %p %lu)\n", this, first, last, dflt, dest, size);
2521 return call_ctype_wchar__Do_narrow_s(this, first, last, dflt, dest, size);
2524 /* _Mbrtowc */
2525 int __cdecl _Mbrtowc(wchar_t *out, const char *in, MSVCP_size_t len, int *state, const _Cvtvec *cvt)
2527 int i, cp;
2528 CPINFO cp_info;
2529 BOOL is_lead;
2531 TRACE("(%p %p %lu %p %p)\n", out, in, len, state, cvt);
2533 if(!len)
2534 return 0;
2536 if(cvt)
2537 cp = cvt->page;
2538 else
2539 cp = ___lc_codepage_func();
2541 if(!cp) {
2542 if(out)
2543 *out = (unsigned char)*in;
2545 *state = 0;
2546 return *in ? 1 : 0;
2549 if(*state) {
2550 ((char*)state)[1] = *in;
2552 if(!MultiByteToWideChar(cp, MB_ERR_INVALID_CHARS, (char*)state, 2, out, out ? 1 : 0)) {
2553 *state = 0;
2554 *_errno() = EILSEQ;
2555 return -1;
2558 *state = 0;
2559 return 2;
2562 GetCPInfo(cp, &cp_info);
2563 is_lead = FALSE;
2564 for(i=0; i<MAX_LEADBYTES; i+=2) {
2565 if(!cp_info.LeadByte[i+1])
2566 break;
2567 if((unsigned char)*in>=cp_info.LeadByte[i] && (unsigned char)*in<=cp_info.LeadByte[i+1]) {
2568 is_lead = TRUE;
2569 break;
2573 if(is_lead) {
2574 if(len == 1) {
2575 *state = (unsigned char)*in;
2576 return -2;
2579 if(!MultiByteToWideChar(cp, MB_ERR_INVALID_CHARS, in, 2, out, out ? 1 : 0)) {
2580 *_errno() = EILSEQ;
2581 return -1;
2583 return 2;
2586 if(!MultiByteToWideChar(cp, MB_ERR_INVALID_CHARS, in, 1, out, out ? 1 : 0)) {
2587 *_errno() = EILSEQ;
2588 return -1;
2590 return 1;
2593 static inline wchar_t mb_to_wc(char ch, const _Cvtvec *cvt)
2595 int state = 0;
2596 wchar_t ret;
2598 return _Mbrtowc(&ret, &ch, 1, &state, cvt) == 1 ? ret : 0;
2601 /* ?_Dowiden@?$ctype@_W@std@@IBE_WD@Z */
2602 /* ?_Dowiden@?$ctype@_W@std@@IEBA_WD@Z */
2603 /* ?_Dowiden@?$ctype@G@std@@IBEGD@Z */
2604 /* ?_Dowiden@?$ctype@G@std@@IEBAGD@Z */
2605 DEFINE_THISCALL_WRAPPER(ctype_wchar__Dowiden, 8)
2606 wchar_t __thiscall ctype_wchar__Dowiden(const ctype_wchar *this, char ch)
2608 wchar_t ret;
2609 int state = 0;
2610 TRACE("(%p %d)\n", this, ch);
2611 return _Mbrtowc(&ret, &ch, 1, &state, &this->cvt)<0 ? WEOF : ret;
2614 /* ?do_widen@?$ctype@_W@std@@MBE_WD@Z */
2615 /* ?do_widen@?$ctype@_W@std@@MEBA_WD@Z */
2616 /* ?do_widen@?$ctype@G@std@@MBEGD@Z */
2617 /* ?do_widen@?$ctype@G@std@@MEBAGD@Z */
2618 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_widen_ch, 8)
2619 #if _MSVCP_VER <= 100
2620 #define call_ctype_wchar_do_widen_ch(this, ch) CALL_VTBL_FUNC(this, 40, \
2621 wchar_t, (const ctype_wchar*, char), (this, ch))
2622 #else
2623 #define call_ctype_wchar_do_widen_ch(this, ch) CALL_VTBL_FUNC(this, 48, \
2624 wchar_t, (const ctype_wchar*, char), (this, ch))
2625 #endif
2626 wchar_t __thiscall ctype_wchar_do_widen_ch(const ctype_wchar *this, char ch)
2628 return ctype_wchar__Dowiden(this, ch);
2631 /* ?do_widen@?$ctype@_W@std@@MBEPBDPBD0PA_W@Z */
2632 /* ?do_widen@?$ctype@_W@std@@MEBAPEBDPEBD0PEA_W@Z */
2633 /* ?do_widen@?$ctype@G@std@@MBEPBDPBD0PAG@Z */
2634 /* ?do_widen@?$ctype@G@std@@MEBAPEBDPEBD0PEAG@Z */
2635 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_widen, 16)
2636 #if _MSVCP_VER <= 100
2637 #define call_ctype_wchar_do_widen(this, first, last, dest) CALL_VTBL_FUNC(this, 36, \
2638 const char*, (const ctype_wchar*, const char*, const char*, wchar_t*), \
2639 (this, first, last, dest))
2640 #else
2641 #define call_ctype_wchar_do_widen(this, first, last, dest) CALL_VTBL_FUNC(this, 44, \
2642 const char*, (const ctype_wchar*, const char*, const char*, wchar_t*), \
2643 (this, first, last, dest))
2644 #endif
2645 const char* __thiscall ctype_wchar_do_widen(const ctype_wchar *this,
2646 const char *first, const char *last, wchar_t *dest)
2648 TRACE("(%p %p %p %p)\n", this, first, last, dest);
2649 for(; first<last; first++)
2650 *dest++ = ctype_wchar__Dowiden(this, *first);
2651 return last;
2654 /* ?_Do_widen_s@?$ctype@_W@std@@MBEPBDPBD0PA_WI@Z */
2655 /* ?_Do_widen_s@?$ctype@_W@std@@MEBAPEBDPEBD0PEA_W_K@Z */
2656 /* ?_Do_widen_s@?$ctype@G@std@@MBEPBDPBD0PAGI@Z */
2657 /* ?_Do_widen_s@?$ctype@G@std@@MEBAPEBDPEBD0PEAG_K@Z */
2658 DEFINE_THISCALL_WRAPPER(ctype_wchar__Do_widen_s, 20)
2659 #define call_ctype_wchar__Do_widen_s(this, first, last, dest, size) CALL_VTBL_FUNC(this, 44, \
2660 const char*, (const ctype_wchar*, const char*, const char*, wchar_t*, MSVCP_size_t), \
2661 (this, first, last, dest, size))
2662 const char* __thiscall ctype_wchar__Do_widen_s(const ctype_wchar *this,
2663 const char *first, const char *last, wchar_t *dest, MSVCP_size_t size)
2665 TRACE("(%p %p %p %p %lu)\n", this, first, last, dest, size);
2666 /* This function converts all multi-byte characters to WEOF,
2667 * thanks to it result size is known before converting */
2668 if(size < last-first)
2669 ctype_base__Xran();
2670 return ctype_wchar_do_widen(this, first, last, dest);
2673 /* ?widen@?$ctype@_W@std@@QBE_WD@Z */
2674 /* ?widen@?$ctype@_W@std@@QEBA_WD@Z */
2675 /* ?widen@?$ctype@G@std@@QBEGD@Z */
2676 /* ?widen@?$ctype@G@std@@QEBAGD@Z */
2677 DEFINE_THISCALL_WRAPPER(ctype_wchar_widen_ch, 8)
2678 wchar_t __thiscall ctype_wchar_widen_ch(const ctype_wchar *this, char ch)
2680 TRACE("(%p %d)\n", this, ch);
2681 return call_ctype_wchar_do_widen_ch(this, ch);
2684 /* ?widen@?$ctype@_W@std@@QBEPBDPBD0PA_W@Z */
2685 /* ?widen@?$ctype@_W@std@@QEBAPEBDPEBD0PEA_W@Z */
2686 /* ?widen@?$ctype@G@std@@QBEPBDPBD0PAG@Z */
2687 /* ?widen@?$ctype@G@std@@QEBAPEBDPEBD0PEAG@Z */
2688 DEFINE_THISCALL_WRAPPER(ctype_wchar_widen, 16)
2689 const char* __thiscall ctype_wchar_widen(const ctype_wchar *this,
2690 const char *first, const char *last, wchar_t *dest)
2692 TRACE("(%p %p %p %p)\n", this, first, last, dest);
2693 return call_ctype_wchar_do_widen(this, first, last, dest);
2696 /* ?_Widen_s@?$ctype@_W@std@@QBEPBDPBD0PA_WI@Z */
2697 /* ?_Widen_s@?$ctype@_W@std@@QEBAPEBDPEBD0PEA_W_K@Z */
2698 /* ?_Widen_s@?$ctype@G@std@@QBEPBDPBD0PAGI@Z */
2699 /* ?_Widen_s@?$ctype@G@std@@QEBAPEBDPEBD0PEAG_K@Z */
2700 DEFINE_THISCALL_WRAPPER(ctype_wchar__Widen_s, 20)
2701 const char* __thiscall ctype_wchar__Widen_s(const ctype_wchar *this,
2702 const char *first, const char *last, wchar_t *dest, MSVCP_size_t size)
2704 TRACE("(%p %p %p %p %lu)\n", this, first, last, dest, size);
2705 return call_ctype_wchar__Do_widen_s(this, first, last, dest, size);
2708 /* ?_Getcat@?$ctype@_W@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
2709 /* ?_Getcat@?$ctype@_W@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
2710 MSVCP_size_t __cdecl ctype_wchar__Getcat(const locale_facet **facet, const locale *loc)
2712 TRACE("(%p %p)\n", facet, loc);
2714 if(facet && !*facet) {
2715 _Locinfo locinfo;
2717 *facet = MSVCRT_operator_new(sizeof(ctype_wchar));
2718 if(!*facet) {
2719 ERR("Out of memory\n");
2720 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
2721 return 0;
2724 _Locinfo_ctor_cstr(&locinfo, locale_string_char_c_str(&loc->ptr->name));
2725 ctype_wchar_ctor_locinfo((ctype_wchar*)*facet, &locinfo, 0);
2726 _Locinfo_dtor(&locinfo);
2729 return LC_CTYPE;
2732 /* ?_Getcat@?$ctype@_W@std@@SAIPAPBVfacet@locale@2@@Z */
2733 /* ?_Getcat@?$ctype@_W@std@@SA_KPEAPEBVfacet@locale@2@@Z */
2734 MSVCP_size_t __cdecl ctype_wchar__Getcat_old(const locale_facet **facet)
2736 return ctype_wchar__Getcat(facet, locale_classic());
2739 /* ?_Getcat@?$ctype@G@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
2740 /* ?_Getcat@?$ctype@G@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
2741 MSVCP_size_t __cdecl ctype_short__Getcat(const locale_facet **facet, const locale *loc)
2743 if(facet && !*facet) {
2744 ctype_wchar__Getcat(facet, loc);
2745 (*(locale_facet**)facet)->vtable = &MSVCP_ctype_short_vtable;
2748 return LC_CTYPE;
2751 /* ?_Getcat@?$ctype@G@std@@SAIPAPBVfacet@locale@2@@Z */
2752 /* ?_Getcat@?$ctype@G@std@@SA_KPEAPEBVfacet@locale@2@@Z */
2753 MSVCP_size_t __cdecl ctype_short__Getcat_old(const locale_facet **facet)
2755 return ctype_short__Getcat(facet, locale_classic());
2758 /* _Towlower */
2759 wchar_t __cdecl _Towlower(wchar_t ch, const _Ctypevec *ctype)
2761 TRACE("(%d %p)\n", ch, ctype);
2762 return tolowerW(ch);
2765 ctype_wchar* ctype_wchar_use_facet(const locale *loc)
2767 static ctype_wchar *obj = NULL;
2769 _Lockit lock;
2770 const locale_facet *fac;
2772 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
2773 fac = locale__Getfacet(loc, locale_id_operator_size_t(&ctype_wchar_id));
2774 if(fac) {
2775 _Lockit_dtor(&lock);
2776 return (ctype_wchar*)fac;
2779 if(obj) {
2780 _Lockit_dtor(&lock);
2781 return obj;
2784 ctype_wchar__Getcat(&fac, loc);
2785 obj = (ctype_wchar*)fac;
2786 call_locale_facet__Incref(&obj->base.facet);
2787 locale_facet_register(&obj->base.facet);
2788 _Lockit_dtor(&lock);
2790 return obj;
2793 ctype_wchar* ctype_short_use_facet(const locale *loc)
2795 static ctype_wchar *obj = NULL;
2797 _Lockit lock;
2798 const locale_facet *fac;
2800 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
2801 fac = locale__Getfacet(loc, locale_id_operator_size_t(&ctype_short_id));
2802 if(fac) {
2803 _Lockit_dtor(&lock);
2804 return (ctype_wchar*)fac;
2807 if(obj) {
2808 _Lockit_dtor(&lock);
2809 return obj;
2812 ctype_short__Getcat(&fac, loc);
2813 obj = (ctype_wchar*)fac;
2814 call_locale_facet__Incref(&obj->base.facet);
2815 locale_facet_register(&obj->base.facet);
2816 _Lockit_dtor(&lock);
2818 return obj;
2821 /* ?do_tolower@?$ctype@_W@std@@MBE_W_W@Z */
2822 /* ?do_tolower@?$ctype@_W@std@@MEBA_W_W@Z */
2823 /* ?do_tolower@?$ctype@G@std@@MBEGG@Z */
2824 /* ?do_tolower@?$ctype@G@std@@MEBAGG@Z */
2825 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_tolower_ch, 8)
2826 #if _MSVCP_VER <= 100
2827 #define call_ctype_wchar_do_tolower_ch(this, ch) CALL_VTBL_FUNC(this, 24, \
2828 wchar_t, (const ctype_wchar*, wchar_t), (this, ch))
2829 #else
2830 #define call_ctype_wchar_do_tolower_ch(this, ch) CALL_VTBL_FUNC(this, 32, \
2831 wchar_t, (const ctype_wchar*, wchar_t), (this, ch))
2832 #endif
2833 wchar_t __thiscall ctype_wchar_do_tolower_ch(const ctype_wchar *this, wchar_t ch)
2835 return _Towlower(ch, &this->ctype);
2838 /* ?do_tolower@?$ctype@_W@std@@MBEPB_WPA_WPB_W@Z */
2839 /* ?do_tolower@?$ctype@_W@std@@MEBAPEB_WPEA_WPEB_W@Z */
2840 /* ?do_tolower@?$ctype@G@std@@MBEPBGPAGPBG@Z */
2841 /* ?do_tolower@?$ctype@G@std@@MEBAPEBGPEAGPEBG@Z */
2842 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_tolower, 12)
2843 #if _MSVCP_VER <= 100
2844 #define call_ctype_wchar_do_tolower(this, first, last) CALL_VTBL_FUNC(this, 20, \
2845 const wchar_t*, (const ctype_wchar*, wchar_t*, const wchar_t*), \
2846 (this, first, last))
2847 #else
2848 #define call_ctype_wchar_do_tolower(this, first, last) CALL_VTBL_FUNC(this, 28, \
2849 const wchar_t*, (const ctype_wchar*, wchar_t*, const wchar_t*), \
2850 (this, first, last))
2851 #endif
2852 const wchar_t* __thiscall ctype_wchar_do_tolower(const ctype_wchar *this,
2853 wchar_t *first, const wchar_t *last)
2855 TRACE("(%p %p %p)\n", this, first, last);
2856 for(; first<last; first++)
2857 *first = _Towlower(*first, &this->ctype);
2858 return last;
2861 /* ?tolower@?$ctype@_W@std@@QBE_W_W@Z */
2862 /* ?tolower@?$ctype@_W@std@@QEBA_W_W@Z */
2863 /* ?tolower@?$ctype@G@std@@QBEGG@Z */
2864 /* ?tolower@?$ctype@G@std@@QEBAGG@Z */
2865 DEFINE_THISCALL_WRAPPER(ctype_wchar_tolower_ch, 8)
2866 wchar_t __thiscall ctype_wchar_tolower_ch(const ctype_wchar *this, wchar_t ch)
2868 TRACE("(%p %d)\n", this, ch);
2869 return call_ctype_wchar_do_tolower_ch(this, ch);
2872 /* ?tolower@?$ctype@_W@std@@QBEPB_WPA_WPB_W@Z */
2873 /* ?tolower@?$ctype@_W@std@@QEBAPEB_WPEA_WPEB_W@Z */
2874 /* ?tolower@?$ctype@G@std@@QBEPBGPAGPBG@Z */
2875 /* ?tolower@?$ctype@G@std@@QEBAPEBGPEAGPEBG@Z */
2876 DEFINE_THISCALL_WRAPPER(ctype_wchar_tolower, 12)
2877 const wchar_t* __thiscall ctype_wchar_tolower(const ctype_wchar *this,
2878 wchar_t *first, const wchar_t *last)
2880 TRACE("(%p %p %p)\n", this, first, last);
2881 return call_ctype_wchar_do_tolower(this, first, last);
2884 /* _Towupper */
2885 wchar_t __cdecl _Towupper(wchar_t ch, const _Ctypevec *ctype)
2887 TRACE("(%d %p)\n", ch, ctype);
2888 return toupperW(ch);
2891 /* ?do_toupper@?$ctype@_W@std@@MBE_W_W@Z */
2892 /* ?do_toupper@?$ctype@_W@std@@MEBA_W_W@Z */
2893 /* ?do_toupper@?$ctype@G@std@@MBEGG@Z */
2894 /* ?do_toupper@?$ctype@G@std@@MEBAGG@Z */
2895 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_toupper_ch, 8)
2896 #if _MSVCP_VER <= 100
2897 #define call_ctype_wchar_do_toupper_ch(this, ch) CALL_VTBL_FUNC(this, 32, \
2898 wchar_t, (const ctype_wchar*, wchar_t), (this, ch))
2899 #else
2900 #define call_ctype_wchar_do_toupper_ch(this, ch) CALL_VTBL_FUNC(this, 40, \
2901 wchar_t, (const ctype_wchar*, wchar_t), (this, ch))
2902 #endif
2903 wchar_t __thiscall ctype_wchar_do_toupper_ch(const ctype_wchar *this, wchar_t ch)
2905 return _Towupper(ch, &this->ctype);
2908 /* ?do_toupper@?$ctype@_W@std@@MBEPB_WPA_WPB_W@Z */
2909 /* ?do_toupper@?$ctype@_W@std@@MEBAPEB_WPEA_WPEB_W@Z */
2910 /* ?do_toupper@?$ctype@G@std@@MBEPBGPAGPBG@Z */
2911 /* ?do_toupper@?$ctype@G@std@@MEBAPEBGPEAGPEBG@Z */
2912 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_toupper, 12)
2913 #if _MSVCP_VER <= 100
2914 #define call_ctype_wchar_do_toupper(this, first, last) CALL_VTBL_FUNC(this, 28, \
2915 const wchar_t*, (const ctype_wchar*, wchar_t*, const wchar_t*), \
2916 (this, first, last))
2917 #else
2918 #define call_ctype_wchar_do_toupper(this, first, last) CALL_VTBL_FUNC(this, 36, \
2919 const wchar_t*, (const ctype_wchar*, wchar_t*, const wchar_t*), \
2920 (this, first, last))
2921 #endif
2922 const wchar_t* __thiscall ctype_wchar_do_toupper(const ctype_wchar *this,
2923 wchar_t *first, const wchar_t *last)
2925 TRACE("(%p %p %p)\n", this, first, last);
2926 for(; first<last; first++)
2927 *first = _Towupper(*first, &this->ctype);
2928 return last;
2931 /* ?toupper@?$ctype@_W@std@@QBE_W_W@Z */
2932 /* ?toupper@?$ctype@_W@std@@QEBA_W_W@Z */
2933 /* ?toupper@?$ctype@G@std@@QBEGG@Z */
2934 /* ?toupper@?$ctype@G@std@@QEBAGG@Z */
2935 DEFINE_THISCALL_WRAPPER(ctype_wchar_toupper_ch, 8)
2936 wchar_t __thiscall ctype_wchar_toupper_ch(const ctype_wchar *this, wchar_t ch)
2938 TRACE("(%p %d)\n", this, ch);
2939 return call_ctype_wchar_do_toupper_ch(this, ch);
2942 /* ?toupper@?$ctype@_W@std@@QBEPB_WPA_WPB_W@Z */
2943 /* ?toupper@?$ctype@_W@std@@QEBAPEB_WPEA_WPEB_W@Z */
2944 /* ?toupper@?$ctype@G@std@@QBEPBGPAGPBG@Z */
2945 /* ?toupper@?$ctype@G@std@@QEBAPEBGPEAGPEBG@Z */
2946 DEFINE_THISCALL_WRAPPER(ctype_wchar_toupper, 12)
2947 const wchar_t* __thiscall ctype_wchar_toupper(const ctype_wchar *this,
2948 wchar_t *first, const wchar_t *last)
2950 TRACE("(%p %p %p)\n", this, first, last);
2951 return call_ctype_wchar_do_toupper(this, first, last);
2954 /* _Getwctypes */
2955 const wchar_t* __cdecl _Getwctypes(const wchar_t *first, const wchar_t *last,
2956 short *mask, const _Ctypevec *ctype)
2958 TRACE("(%p %p %p %p)\n", first, last, mask, ctype);
2959 GetStringTypeW(CT_CTYPE1, first, last-first, (WORD*)mask);
2960 return last;
2963 /* _Getwctype */
2964 short __cdecl _Getwctype(wchar_t ch, const _Ctypevec *ctype)
2966 short mask = 0;
2967 _Getwctypes(&ch, &ch+1, &mask, ctype);
2968 return mask;
2971 /* ?do_is@?$ctype@_W@std@@MBE_NF_W@Z */
2972 /* ?do_is@?$ctype@_W@std@@MEBA_NF_W@Z */
2973 /* ?do_is@?$ctype@G@std@@MBE_NFG@Z */
2974 /* ?do_is@?$ctype@G@std@@MEBA_NFG@Z */
2975 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_is_ch, 12)
2976 #if _MSVCP_VER <= 100
2977 #define call_ctype_wchar_do_is_ch(this, mask, ch) CALL_VTBL_FUNC(this, 8, \
2978 MSVCP_bool, (const ctype_wchar*, short, wchar_t), (this, mask, ch))
2979 #else
2980 #define call_ctype_wchar_do_is_ch(this, mask, ch) CALL_VTBL_FUNC(this, 16, \
2981 MSVCP_bool, (const ctype_wchar*, short, wchar_t), (this, mask, ch))
2982 #endif
2983 MSVCP_bool __thiscall ctype_wchar_do_is_ch(const ctype_wchar *this, short mask, wchar_t ch)
2985 TRACE("(%p %x %d)\n", this, mask, ch);
2986 return (_Getwctype(ch, &this->ctype) & mask) != 0;
2989 /* ?do_is@?$ctype@_W@std@@MBEPB_WPB_W0PAF@Z */
2990 /* ?do_is@?$ctype@_W@std@@MEBAPEB_WPEB_W0PEAF@Z */
2991 /* ?do_is@?$ctype@G@std@@MBEPBGPBG0PAF@Z */
2992 /* ?do_is@?$ctype@G@std@@MEBAPEBGPEBG0PEAF@Z */
2993 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_is, 16)
2994 #if _MSVCP_VER <= 100
2995 #define call_ctype_wchar_do_is(this, first, last, dest) CALL_VTBL_FUNC(this, 4, \
2996 const wchar_t*, (const ctype_wchar*, const wchar_t*, const wchar_t*, short*), \
2997 (this, first, last, dest))
2998 #else
2999 #define call_ctype_wchar_do_is(this, first, last, dest) CALL_VTBL_FUNC(this, 12, \
3000 const wchar_t*, (const ctype_wchar*, const wchar_t*, const wchar_t*, short*), \
3001 (this, first, last, dest))
3002 #endif
3003 const wchar_t* __thiscall ctype_wchar_do_is(const ctype_wchar *this,
3004 const wchar_t *first, const wchar_t *last, short *dest)
3006 TRACE("(%p %p %p %p)\n", this, first, last, dest);
3007 return _Getwctypes(first, last, dest, &this->ctype);
3010 /* ?is@?$ctype@_W@std@@QBE_NF_W@Z */
3011 /* ?is@?$ctype@_W@std@@QEBA_NF_W@Z */
3012 /* ?is@?$ctype@G@std@@QBE_NFG@Z */
3013 /* ?is@?$ctype@G@std@@QEBA_NFG@Z */
3014 DEFINE_THISCALL_WRAPPER(ctype_wchar_is_ch, 12)
3015 MSVCP_bool __thiscall ctype_wchar_is_ch(const ctype_wchar *this, short mask, wchar_t ch)
3017 TRACE("(%p %x %d)\n", this, mask, ch);
3018 return call_ctype_wchar_do_is_ch(this, mask, ch);
3021 /* ?is@?$ctype@_W@std@@QBEPB_WPB_W0PAF@Z */
3022 /* ?is@?$ctype@_W@std@@QEBAPEB_WPEB_W0PEAF@Z */
3023 /* ?is@?$ctype@G@std@@QBEPBGPBG0PAF@Z */
3024 /* ?is@?$ctype@G@std@@QEBAPEBGPEBG0PEAF@Z */
3025 DEFINE_THISCALL_WRAPPER(ctype_wchar_is, 16)
3026 const wchar_t* __thiscall ctype_wchar_is(const ctype_wchar *this,
3027 const wchar_t *first, const wchar_t *last, short *dest)
3029 TRACE("(%p %p %p %p)\n", this, first, last, dest);
3030 return call_ctype_wchar_do_is(this, first, last, dest);
3033 /* ?do_scan_is@?$ctype@_W@std@@MBEPB_WFPB_W0@Z */
3034 /* ?do_scan_is@?$ctype@_W@std@@MEBAPEB_WFPEB_W0@Z */
3035 /* ?do_scan_is@?$ctype@G@std@@MBEPBGFPBG0@Z */
3036 /* ?do_scan_is@?$ctype@G@std@@MEBAPEBGFPEBG0@Z */
3037 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_scan_is, 16)
3038 #if _MSVCP_VER <= 100
3039 #define call_ctype_wchar_do_scan_is(this, mask, first, last) CALL_VTBL_FUNC(this, 12, \
3040 const wchar_t*, (const ctype_wchar*, short, const wchar_t*, const wchar_t*), \
3041 (this, mask, first, last))
3042 #else
3043 #define call_ctype_wchar_do_scan_is(this, mask, first, last) CALL_VTBL_FUNC(this, 20, \
3044 const wchar_t*, (const ctype_wchar*, short, const wchar_t*, const wchar_t*), \
3045 (this, mask, first, last))
3046 #endif
3047 const wchar_t* __thiscall ctype_wchar_do_scan_is(const ctype_wchar *this,
3048 short mask, const wchar_t *first, const wchar_t *last)
3050 TRACE("(%p %d %p %p)\n", this, mask, first, last);
3051 for(; first<last; first++)
3052 if(!ctype_wchar_is_ch(this, mask, *first))
3053 break;
3054 return first;
3057 /* ?scan_is@?$ctype@_W@std@@QBEPB_WFPB_W0@Z */
3058 /* ?scan_is@?$ctype@_W@std@@QEBAPEB_WFPEB_W0@Z */
3059 /* ?scan_is@?$ctype@G@std@@QBEPBGFPBG0@Z */
3060 /* ?scan_is@?$ctype@G@std@@QEBAPEBGFPEBG0@Z */
3061 DEFINE_THISCALL_WRAPPER(ctype_wchar_scan_is, 16)
3062 const wchar_t* __thiscall ctype_wchar_scan_is(const ctype_wchar *this,
3063 short mask, const wchar_t *first, const wchar_t *last)
3065 TRACE("(%p %x %p %p)\n", this, mask, first, last);
3066 return call_ctype_wchar_do_scan_is(this, mask, first, last);
3069 /* ?do_scan_not@?$ctype@_W@std@@MBEPB_WFPB_W0@Z */
3070 /* ?do_scan_not@?$ctype@_W@std@@MEBAPEB_WFPEB_W0@Z */
3071 /* ?do_scan_not@?$ctype@G@std@@MBEPBGFPBG0@Z */
3072 /* ?do_scan_not@?$ctype@G@std@@MEBAPEBGFPEBG0@Z */
3073 DEFINE_THISCALL_WRAPPER(ctype_wchar_do_scan_not, 16)
3074 #if _MSVCP_VER <= 100
3075 #define call_ctype_wchar_do_scan_not(this, mask, first, last) CALL_VTBL_FUNC(this, 16, \
3076 const wchar_t*, (const ctype_wchar*, short, const wchar_t*, const wchar_t*), \
3077 (this, mask, first, last))
3078 #else
3079 #define call_ctype_wchar_do_scan_not(this, mask, first, last) CALL_VTBL_FUNC(this, 24, \
3080 const wchar_t*, (const ctype_wchar*, short, const wchar_t*, const wchar_t*), \
3081 (this, mask, first, last))
3082 #endif
3083 const wchar_t* __thiscall ctype_wchar_do_scan_not(const ctype_wchar *this,
3084 short mask, const wchar_t *first, const wchar_t *last)
3086 TRACE("(%p %x %p %p)\n", this, mask, first, last);
3087 for(; first<last; first++)
3088 if(ctype_wchar_is_ch(this, mask, *first))
3089 break;
3090 return first;
3093 /* ?scan_not@?$ctype@_W@std@@QBEPB_WFPB_W0@Z */
3094 /* ?scan_not@?$ctype@_W@std@@QEBAPEB_WFPEB_W0@Z */
3095 /* ?scan_not@?$ctype@G@std@@QBEPBGFPBG0@Z */
3096 /* ?scan_not@?$ctype@G@std@@QEBAPEBGFPEBG0@Z */
3097 DEFINE_THISCALL_WRAPPER(ctype_wchar_scan_not, 16)
3098 const wchar_t* __thiscall ctype_wchar_scan_not(const ctype_wchar *this,
3099 short mask, const wchar_t *first, const wchar_t *last)
3101 TRACE("(%p %x %p %p)\n", this, mask, first, last);
3102 return call_ctype_wchar_do_scan_not(this, mask, first, last);
3105 /* ??_7codecvt_base@std@@6B@ */
3106 extern const vtable_ptr MSVCP_codecvt_base_vtable;
3108 /* ??0codecvt_base@std@@QAE@I@Z */
3109 /* ??0codecvt_base@std@@QEAA@_K@Z */
3110 DEFINE_THISCALL_WRAPPER(codecvt_base_ctor_refs, 8)
3111 codecvt_base* __thiscall codecvt_base_ctor_refs(codecvt_base *this, MSVCP_size_t refs)
3113 TRACE("(%p %lu)\n", this, refs);
3114 locale_facet_ctor_refs(&this->facet, refs);
3115 this->facet.vtable = &MSVCP_codecvt_base_vtable;
3116 return this;
3119 /* ??_Fcodecvt_base@std@@QAEXXZ */
3120 /* ??_Fcodecvt_base@std@@QEAAXXZ */
3121 DEFINE_THISCALL_WRAPPER(codecvt_base_ctor, 4)
3122 codecvt_base* __thiscall codecvt_base_ctor(codecvt_base *this)
3124 return codecvt_base_ctor_refs(this, 0);
3127 /* ??1codecvt_base@std@@UAE@XZ */
3128 /* ??1codecvt_base@std@@UEAA@XZ */
3129 DEFINE_THISCALL_WRAPPER(codecvt_base_dtor, 4)
3130 void __thiscall codecvt_base_dtor(codecvt_base *this)
3132 TRACE("(%p)\n", this);
3133 locale_facet_dtor(&this->facet);
3136 DEFINE_THISCALL_WRAPPER(codecvt_base_vector_dtor, 8)
3137 codecvt_base* __thiscall codecvt_base_vector_dtor(codecvt_base *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_base_dtor(this+i);
3146 MSVCRT_operator_delete(ptr);
3147 } else {
3148 codecvt_base_dtor(this);
3149 if(flags & 1)
3150 MSVCRT_operator_delete(this);
3153 return this;
3156 /* ?do_always_noconv@codecvt_base@std@@MBE_NXZ */
3157 /* ?do_always_noconv@codecvt_base@std@@MEBA_NXZ */
3158 #if _MSVCP_VER <= 100
3159 #define call_codecvt_base_do_always_noconv(this) CALL_VTBL_FUNC(this, 4, \
3160 MSVCP_bool, (const codecvt_base*), (this))
3161 #else
3162 #define call_codecvt_base_do_always_noconv(this) CALL_VTBL_FUNC(this, 12, \
3163 MSVCP_bool, (const codecvt_base*), (this))
3164 #endif
3165 DEFINE_THISCALL_WRAPPER(codecvt_base_do_always_noconv, 4)
3166 MSVCP_bool __thiscall codecvt_base_do_always_noconv(const codecvt_base *this)
3168 TRACE("(%p)\n", this);
3169 return TRUE;
3172 /* ?always_noconv@codecvt_base@std@@QBE_NXZ */
3173 /* ?always_noconv@codecvt_base@std@@QEBA_NXZ */
3174 DEFINE_THISCALL_WRAPPER(codecvt_base_always_noconv, 4)
3175 MSVCP_bool __thiscall codecvt_base_always_noconv(const codecvt_base *this)
3177 TRACE("(%p)\n", this);
3178 return call_codecvt_base_do_always_noconv(this);
3181 /* ?do_max_length@codecvt_base@std@@MBEHXZ */
3182 /* ?do_max_length@codecvt_base@std@@MEBAHXZ */
3183 #if _MSVCP_VER <= 100
3184 #define call_codecvt_base_do_max_length(this) CALL_VTBL_FUNC(this, 8, \
3185 int, (const codecvt_base*), (this))
3186 #else
3187 #define call_codecvt_base_do_max_length(this) CALL_VTBL_FUNC(this, 16, \
3188 int, (const codecvt_base*), (this))
3189 #endif
3190 DEFINE_THISCALL_WRAPPER(codecvt_base_do_max_length, 4)
3191 int __thiscall codecvt_base_do_max_length(const codecvt_base *this)
3193 TRACE("(%p)\n", this);
3194 return 1;
3197 /* ?max_length@codecvt_base@std@@QBEHXZ */
3198 /* ?max_length@codecvt_base@std@@QEBAHXZ */
3199 DEFINE_THISCALL_WRAPPER(codecvt_base_max_length, 4)
3200 int __thiscall codecvt_base_max_length(const codecvt_base *this)
3202 TRACE("(%p)\n", this);
3203 return call_codecvt_base_do_max_length(this);
3206 /* ?do_encoding@codecvt_base@std@@MBEHXZ */
3207 /* ?do_encoding@codecvt_base@std@@MEBAHXZ */
3208 #if _MSVCP_VER <= 100
3209 #define call_codecvt_base_do_encoding(this) CALL_VTBL_FUNC(this, 12, \
3210 int, (const codecvt_base*), (this))
3211 #else
3212 #define call_codecvt_base_do_encoding(this) CALL_VTBL_FUNC(this, 20, \
3213 int, (const codecvt_base*), (this))
3214 #endif
3215 DEFINE_THISCALL_WRAPPER(codecvt_base_do_encoding, 4)
3216 int __thiscall codecvt_base_do_encoding(const codecvt_base *this)
3218 TRACE("(%p)\n", this);
3219 return 1;
3222 /* ?encoding@codecvt_base@std@@QBEHXZ */
3223 /* ?encoding@codecvt_base@std@@QEBAHXZ */
3224 DEFINE_THISCALL_WRAPPER(codecvt_base_encoding, 4)
3225 int __thiscall codecvt_base_encoding(const codecvt_base *this)
3227 TRACE("(%p)\n", this);
3228 return call_codecvt_base_do_encoding(this);
3231 /* ?id@?$codecvt@DDH@std@@2V0locale@2@A */
3232 locale_id codecvt_char_id = {0};
3234 /* ??_7?$codecvt@DDH@std@@6B@ */
3235 extern const vtable_ptr MSVCP_codecvt_char_vtable;
3237 /* ?_Init@?$codecvt@DDH@std@@IAEXABV_Locinfo@2@@Z */
3238 /* ?_Init@?$codecvt@DDH@std@@IEAAXAEBV_Locinfo@2@@Z */
3239 DEFINE_THISCALL_WRAPPER(codecvt_char__Init, 8)
3240 void __thiscall codecvt_char__Init(codecvt_char *this, const _Locinfo *locinfo)
3242 TRACE("(%p %p)\n", this, locinfo);
3245 /* ??0?$codecvt@DDH@std@@QAE@ABV_Locinfo@1@I@Z */
3246 /* ??0?$codecvt@DDH@std@@QEAA@AEBV_Locinfo@1@_K@Z */
3247 DEFINE_THISCALL_WRAPPER(codecvt_char_ctor_locinfo, 12)
3248 codecvt_char* __thiscall codecvt_char_ctor_locinfo(codecvt_char *this, const _Locinfo *locinfo, MSVCP_size_t refs)
3250 TRACE("(%p %p %lu)\n", this, locinfo, refs);
3251 codecvt_base_ctor_refs(&this->base, refs);
3252 this->base.facet.vtable = &MSVCP_codecvt_char_vtable;
3253 return this;
3256 /* ??0?$codecvt@DDH@std@@QAE@I@Z */
3257 /* ??0?$codecvt@DDH@std@@QEAA@_K@Z */
3258 DEFINE_THISCALL_WRAPPER(codecvt_char_ctor_refs, 8)
3259 codecvt_char* __thiscall codecvt_char_ctor_refs(codecvt_char *this, MSVCP_size_t refs)
3261 return codecvt_char_ctor_locinfo(this, NULL, refs);
3264 /* ??_F?$codecvt@DDH@std@@QAEXXZ */
3265 /* ??_F?$codecvt@DDH@std@@QEAAXXZ */
3266 DEFINE_THISCALL_WRAPPER(codecvt_char_ctor, 4)
3267 codecvt_char* __thiscall codecvt_char_ctor(codecvt_char *this)
3269 return codecvt_char_ctor_locinfo(this, NULL, 0);
3272 /* ??1?$codecvt@DDH@std@@UAE@XZ */
3273 /* ??1?$codecvt@DDH@std@@UEAA@XZ */
3274 /* ??1?$codecvt@DDH@std@@MAE@XZ */
3275 /* ??1?$codecvt@DDH@std@@MEAA@XZ */
3276 DEFINE_THISCALL_WRAPPER(codecvt_char_dtor, 4)
3277 void __thiscall codecvt_char_dtor(codecvt_char *this)
3279 TRACE("(%p)\n", this);
3280 codecvt_base_dtor(&this->base);
3283 DEFINE_THISCALL_WRAPPER(codecvt_char_vector_dtor, 8)
3284 codecvt_char* __thiscall codecvt_char_vector_dtor(codecvt_char *this, unsigned int flags)
3286 TRACE("(%p %x)\n", this, flags);
3287 if(flags & 2) {
3288 /* we have an array, with the number of elements stored before the first object */
3289 INT_PTR i, *ptr = (INT_PTR *)this-1;
3291 for(i=*ptr-1; i>=0; i--)
3292 codecvt_char_dtor(this+i);
3293 MSVCRT_operator_delete(ptr);
3294 } else {
3295 codecvt_char_dtor(this);
3296 if(flags & 1)
3297 MSVCRT_operator_delete(this);
3300 return this;
3303 /* ?_Getcat@?$codecvt@DDH@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
3304 /* ?_Getcat@?$codecvt@DDH@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
3305 MSVCP_size_t __cdecl codecvt_char__Getcat(const locale_facet **facet, const locale *loc)
3307 TRACE("(%p %p)\n", facet, loc);
3309 if(facet && !*facet) {
3310 *facet = MSVCRT_operator_new(sizeof(codecvt_char));
3311 if(!*facet) {
3312 ERR("Out of memory\n");
3313 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
3314 return 0;
3316 codecvt_char_ctor((codecvt_char*)*facet);
3319 return LC_CTYPE;
3322 /* ?_Getcat@?$codecvt@DDH@std@@SAIPAPBVfacet@locale@2@@Z */
3323 /* ?_Getcat@?$codecvt@DDH@std@@SA_KPEAPEBVfacet@locale@2@@Z */
3324 MSVCP_size_t __cdecl codecvt_char__Getcat_old(const locale_facet **facet)
3326 return codecvt_char__Getcat(facet, locale_classic());
3329 codecvt_char* codecvt_char_use_facet(const locale *loc)
3331 static codecvt_char *obj = NULL;
3333 _Lockit lock;
3334 const locale_facet *fac;
3336 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
3337 fac = locale__Getfacet(loc, locale_id_operator_size_t(&codecvt_char_id));
3338 if(fac) {
3339 _Lockit_dtor(&lock);
3340 return (codecvt_char*)fac;
3343 if(obj) {
3344 _Lockit_dtor(&lock);
3345 return obj;
3348 codecvt_char__Getcat(&fac, loc);
3349 obj = (codecvt_char*)fac;
3350 call_locale_facet__Incref(&obj->base.facet);
3351 locale_facet_register(&obj->base.facet);
3352 _Lockit_dtor(&lock);
3354 return obj;
3357 /* ?do_in@?$codecvt@DDH@std@@MBEHAAHPBD1AAPBDPAD3AAPAD@Z */
3358 /* ?do_in@?$codecvt@DDH@std@@MEBAHAEAHPEBD1AEAPEBDPEAD3AEAPEAD@Z */
3359 #if _MSVCP_VER <= 100
3360 #define call_codecvt_char_do_in(this, state, from, from_end, from_next, to, to_end, to_next) \
3361 CALL_VTBL_FUNC(this, 16, int, \
3362 (const codecvt_char*, int*, const char*, const char*, const char**, char*, char*, char**), \
3363 (this, state, from, from_end, from_next, to, to_end, to_next))
3364 #else
3365 #define call_codecvt_char_do_in(this, state, from, from_end, from_next, to, to_end, to_next) \
3366 CALL_VTBL_FUNC(this, 24, int, \
3367 (const codecvt_char*, int*, const char*, const char*, const char**, char*, char*, char**), \
3368 (this, state, from, from_end, from_next, to, to_end, to_next))
3369 #endif
3370 DEFINE_THISCALL_WRAPPER(codecvt_char_do_in, 32)
3371 int __thiscall codecvt_char_do_in(const codecvt_char *this, int *state,
3372 const char *from, const char *from_end, const char **from_next,
3373 char *to, char *to_end, char **to_next)
3375 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from, from_end,
3376 from_next, to, to_end, to_next);
3377 *from_next = from;
3378 *to_next = to;
3379 return CODECVT_noconv;
3382 /* ?in@?$codecvt@DDH@std@@QBEHAAHPBD1AAPBDPAD3AAPAD@Z */
3383 /* ?in@?$codecvt@DDH@std@@QEBAHAEAHPEBD1AEAPEBDPEAD3AEAPEAD@Z */
3384 DEFINE_THISCALL_WRAPPER(codecvt_char_in, 32)
3385 int __thiscall codecvt_char_in(const codecvt_char *this, int *state,
3386 const char *from, const char *from_end, const char **from_next,
3387 char *to, char *to_end, char **to_next)
3389 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from, from_end,
3390 from_next, to, to_end, to_next);
3391 return call_codecvt_char_do_in(this, state, from, from_end, from_next,
3392 to, to_end, to_next);
3395 /* ?do_out@?$codecvt@DDH@std@@MBEHAAHPBD1AAPBDPAD3AAPAD@Z */
3396 /* ?do_out@?$codecvt@DDH@std@@MEBAHAEAHPEBD1AEAPEBDPEAD3AEAPEAD@Z */
3397 #if _MSVCP_VER <= 100
3398 #define call_codecvt_char_do_out(this, state, from, from_end, from_next, to, to_end, to_next) \
3399 CALL_VTBL_FUNC(this, 20, int, \
3400 (const codecvt_char*, int*, const char*, const char*, const char**, char*, char*, char**), \
3401 (this, state, from, from_end, from_next, to, to_end, to_next))
3402 #else
3403 #define call_codecvt_char_do_out(this, state, from, from_end, from_next, to, to_end, to_next) \
3404 CALL_VTBL_FUNC(this, 28, int, \
3405 (const codecvt_char*, int*, const char*, const char*, const char**, char*, char*, char**), \
3406 (this, state, from, from_end, from_next, to, to_end, to_next))
3407 #endif
3408 DEFINE_THISCALL_WRAPPER(codecvt_char_do_out, 32)
3409 int __thiscall codecvt_char_do_out(const codecvt_char *this, int *state,
3410 const char *from, const char *from_end, const char **from_next,
3411 char *to, char *to_end, char **to_next)
3413 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from,
3414 from_end, from_next, to, to_end, to_next);
3415 *from_next = from;
3416 *to_next = to;
3417 return CODECVT_noconv;
3420 /* ?out@?$codecvt@DDH@std@@QBEHAAHPBD1AAPBDPAD3AAPAD@Z */
3421 /* ?out@?$codecvt@DDH@std@@QEBAHAEAHPEBD1AEAPEBDPEAD3AEAPEAD@Z */
3422 DEFINE_THISCALL_WRAPPER(codecvt_char_out, 32)
3423 int __thiscall codecvt_char_out(const codecvt_char *this, int *state,
3424 const char *from, const char *from_end, const char **from_next,
3425 char *to, char *to_end, char **to_next)
3427 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from, from_end,
3428 from_next, to, to_end, to_next);
3429 return call_codecvt_char_do_out(this, state, from, from_end, from_next,
3430 to, to_end, to_next);
3433 /* ?do_unshift@?$codecvt@DDH@std@@MBEHAAHPAD1AAPAD@Z */
3434 /* ?do_unshift@?$codecvt@DDH@std@@MEBAHAEAHPEAD1AEAPEAD@Z */
3435 #if _MSVCP_VER <= 100
3436 #define call_codecvt_char_do_unshift(this, state, to, to_end, to_next) CALL_VTBL_FUNC(this, 24, \
3437 int, (const codecvt_char*, int*, char*, char*, char**), (this, state, to, to_end, to_next))
3438 #else
3439 #define call_codecvt_char_do_unshift(this, state, to, to_end, to_next) CALL_VTBL_FUNC(this, 32, \
3440 int, (const codecvt_char*, int*, char*, char*, char**), (this, state, to, to_end, to_next))
3441 #endif
3442 DEFINE_THISCALL_WRAPPER(codecvt_char_do_unshift, 20)
3443 int __thiscall codecvt_char_do_unshift(const codecvt_char *this,
3444 int *state, char *to, char *to_end, char **to_next)
3446 TRACE("(%p %p %p %p %p)\n", this, state, to, to_end, to_next);
3447 *to_next = to;
3448 return CODECVT_noconv;
3451 /* ?unshift@?$codecvt@DDH@std@@QBEHAAHPAD1AAPAD@Z */
3452 /* ?unshift@?$codecvt@DDH@std@@QEBAHAEAHPEAD1AEAPEAD@Z */
3453 DEFINE_THISCALL_WRAPPER(codecvt_char_unshift, 20)
3454 int __thiscall codecvt_char_unshift(const codecvt_char *this,
3455 int *state, char *to, char *to_end, char **to_next)
3457 TRACE("(%p %p %p %p %p)\n", this, state, to, to_end, to_next);
3458 return call_codecvt_char_do_unshift(this, state, to, to_end, to_next);
3461 /* ?do_length@?$codecvt@DDH@std@@MBEHABHPBD1I@Z */
3462 /* ?do_length@?$codecvt@DDH@std@@MEBAHAEBHPEBD1_K@Z */
3463 #if _MSVCP_VER <= 100
3464 #define call_codecvt_char_do_length(this, state, from, from_end, max) CALL_VTBL_FUNC(this, 28, \
3465 int, (const codecvt_char*, const int*, const char*, const char*, MSVCP_size_t), \
3466 (this, state, from, from_end, max))
3467 #else
3468 #define call_codecvt_char_do_length(this, state, from, from_end, max) CALL_VTBL_FUNC(this, 36, \
3469 int, (const codecvt_char*, const int*, const char*, const char*, MSVCP_size_t), \
3470 (this, state, from, from_end, max))
3471 #endif
3472 DEFINE_THISCALL_WRAPPER(codecvt_char_do_length, 20)
3473 int __thiscall codecvt_char_do_length(const codecvt_char *this, const int *state,
3474 const char *from, const char *from_end, MSVCP_size_t max)
3476 TRACE("(%p %p %p %p %lu)\n", this, state, from, from_end, max);
3477 return (from_end-from > max ? max : from_end-from);
3480 /* ?length@?$codecvt@DDH@std@@QBEHABHPBD1I@Z */
3481 /* ?length@?$codecvt@DDH@std@@QEBAHAEBHPEBD1_K@Z */
3482 DEFINE_THISCALL_WRAPPER(codecvt_char_length, 20)
3483 int __thiscall codecvt_char_length(const codecvt_char *this, const int *state,
3484 const char *from, const char *from_end, MSVCP_size_t max)
3486 TRACE("(%p %p %p %p %lu)\n", this, state, from, from_end, max);
3487 return call_codecvt_char_do_length(this, state, from, from_end, max);
3490 /* ?id@?$codecvt@_WDH@std@@2V0locale@2@A */
3491 locale_id codecvt_wchar_id = {0};
3492 /* ?id@?$codecvt@GDH@std@@2V0locale@2@A */
3493 locale_id codecvt_short_id = {0};
3495 /* ??_7?$codecvt@_WDH@std@@6B@ */
3496 extern const vtable_ptr MSVCP_codecvt_wchar_vtable;
3497 /* ??_7?$codecvt@GDH@std@@6B@ */
3498 extern const vtable_ptr MSVCP_codecvt_short_vtable;
3500 /* ?_Init@?$codecvt@GDH@std@@IAEXABV_Locinfo@2@@Z */
3501 /* ?_Init@?$codecvt@GDH@std@@IEAAXAEBV_Locinfo@2@@Z */
3502 /* ?_Init@?$codecvt@_WDH@std@@IAEXABV_Locinfo@2@@Z */
3503 /* ?_Init@?$codecvt@_WDH@std@@IEAAXAEBV_Locinfo@2@@Z */
3504 DEFINE_THISCALL_WRAPPER(codecvt_wchar__Init, 8)
3505 void __thiscall codecvt_wchar__Init(codecvt_wchar *this, const _Locinfo *locinfo)
3507 TRACE("(%p %p)\n", this, locinfo);
3508 _Locinfo__Getcvt(locinfo, &this->cvt);
3511 /* ??0?$codecvt@_WDH@std@@QAE@ABV_Locinfo@1@I@Z */
3512 /* ??0?$codecvt@_WDH@std@@QEAA@AEBV_Locinfo@1@_K@Z */
3513 DEFINE_THISCALL_WRAPPER(codecvt_wchar_ctor_locinfo, 12)
3514 codecvt_wchar* __thiscall codecvt_wchar_ctor_locinfo(codecvt_wchar *this, const _Locinfo *locinfo, MSVCP_size_t refs)
3516 TRACE("(%p %p %ld)\n", this, locinfo, refs);
3518 codecvt_base_ctor_refs(&this->base, refs);
3519 this->base.facet.vtable = &MSVCP_codecvt_wchar_vtable;
3521 codecvt_wchar__Init(this, locinfo);
3522 return this;
3525 /* ??0?$codecvt@GDH@std@@QAE@ABV_Locinfo@1@I@Z */
3526 /* ??0?$codecvt@GDH@std@@QEAA@AEBV_Locinfo@1@_K@Z */
3527 DEFINE_THISCALL_WRAPPER(codecvt_short_ctor_locinfo, 12)
3528 codecvt_wchar* __thiscall codecvt_short_ctor_locinfo(codecvt_wchar *this, const _Locinfo *locinfo, MSVCP_size_t refs)
3530 TRACE("(%p %p %ld)\n", this, locinfo, refs);
3532 codecvt_wchar_ctor_locinfo(this, locinfo, refs);
3533 this->base.facet.vtable = &MSVCP_codecvt_short_vtable;
3534 return this;
3537 /* ??0?$codecvt@_WDH@std@@QAE@I@Z */
3538 /* ??0?$codecvt@_WDH@std@@QEAA@_K@Z */
3539 DEFINE_THISCALL_WRAPPER(codecvt_wchar_ctor_refs, 8)
3540 codecvt_wchar* __thiscall codecvt_wchar_ctor_refs(codecvt_wchar *this, MSVCP_size_t refs)
3542 _Locinfo locinfo;
3544 TRACE("(%p %ld)\n", this, refs);
3546 _Locinfo_ctor(&locinfo);
3547 codecvt_wchar_ctor_locinfo(this, &locinfo, refs);
3548 _Locinfo_dtor(&locinfo);
3549 return this;
3552 /* ??0?$codecvt@GDH@std@@QAE@I@Z */
3553 /* ??0?$codecvt@GDH@std@@QEAA@_K@Z */
3554 DEFINE_THISCALL_WRAPPER(codecvt_short_ctor_refs, 8)
3555 codecvt_wchar* __thiscall codecvt_short_ctor_refs(codecvt_wchar *this, MSVCP_size_t refs)
3557 _Locinfo locinfo;
3559 TRACE("(%p %ld)\n", this, refs);
3561 _Locinfo_ctor(&locinfo);
3562 codecvt_short_ctor_locinfo(this, &locinfo, refs);
3563 _Locinfo_dtor(&locinfo);
3564 return this;
3567 /* ??0?$codecvt@GDH@std@@IAE@PBDI@Z */
3568 /* ??0?$codecvt@GDH@std@@IEAA@PEBD_K@Z */
3569 DEFINE_THISCALL_WRAPPER(codecvt_short_ctor_name, 12)
3570 codecvt_wchar* __thiscall codecvt_short_ctor_name(codecvt_wchar *this, const char *name, MSVCP_size_t refs)
3572 _Locinfo locinfo;
3574 TRACE("(%p %s %ld)\n", this, name, refs);
3576 _Locinfo_ctor_cstr(&locinfo, name);
3577 codecvt_short_ctor_locinfo(this, &locinfo, refs);
3578 _Locinfo_dtor(&locinfo);
3579 return this;
3582 /* ??_F?$codecvt@_WDH@std@@QAEXXZ */
3583 /* ??_F?$codecvt@_WDH@std@@QEAAXXZ */
3584 DEFINE_THISCALL_WRAPPER(codecvt_wchar_ctor, 4)
3585 codecvt_wchar* __thiscall codecvt_wchar_ctor(codecvt_wchar *this)
3587 return codecvt_wchar_ctor_refs(this, 0);
3590 /* ??_F?$codecvt@GDH@std@@QAEXXZ */
3591 /* ??_F?$codecvt@GDH@std@@QEAAXXZ */
3592 DEFINE_THISCALL_WRAPPER(codecvt_short_ctor, 4)
3593 codecvt_wchar* __thiscall codecvt_short_ctor(codecvt_wchar *this)
3595 return codecvt_short_ctor_refs(this, 0);
3598 /* ??1?$codecvt@GDH@std@@UAE@XZ */
3599 /* ??1?$codecvt@GDH@std@@UEAA@XZ */
3600 /* ??1?$codecvt@GDH@std@@MAE@XZ */
3601 /* ??1?$codecvt@GDH@std@@MEAA@XZ */
3602 /* ??1?$codecvt@_WDH@std@@MAE@XZ */
3603 /* ??1?$codecvt@_WDH@std@@MEAA@XZ */
3604 DEFINE_THISCALL_WRAPPER(codecvt_wchar_dtor, 4)
3605 void __thiscall codecvt_wchar_dtor(codecvt_wchar *this)
3607 TRACE("(%p)\n", this);
3608 codecvt_base_dtor(&this->base);
3611 DEFINE_THISCALL_WRAPPER(codecvt_wchar_vector_dtor, 8)
3612 codecvt_wchar* __thiscall codecvt_wchar_vector_dtor(codecvt_wchar *this, unsigned int flags)
3614 TRACE("(%p %x)\n", this, flags);
3615 if(flags & 2) {
3616 /* we have an array, with the number of elements stored before the first object */
3617 INT_PTR i, *ptr = (INT_PTR *)this-1;
3619 for(i=*ptr-1; i>=0; i--)
3620 codecvt_wchar_dtor(this+i);
3621 MSVCRT_operator_delete(ptr);
3622 } else {
3623 codecvt_wchar_dtor(this);
3624 if(flags & 1)
3625 MSVCRT_operator_delete(this);
3628 return this;
3631 /* ?_Getcat@?$codecvt@_WDH@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
3632 /* ?_Getcat@?$codecvt@_WDH@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
3633 MSVCP_size_t __cdecl codecvt_wchar__Getcat(const locale_facet **facet, const locale *loc)
3635 TRACE("(%p %p)\n", facet, loc);
3637 if(facet && !*facet) {
3638 _Locinfo locinfo;
3640 *facet = MSVCRT_operator_new(sizeof(codecvt_wchar));
3641 if(!*facet) {
3642 ERR("Out of memory\n");
3643 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
3644 return 0;
3647 _Locinfo_ctor_cstr(&locinfo, locale_string_char_c_str(&loc->ptr->name));
3648 codecvt_wchar_ctor_locinfo((codecvt_wchar*)*facet, &locinfo, 0);
3649 _Locinfo_dtor(&locinfo);
3652 return LC_CTYPE;
3655 /* ?_Getcat@?$codecvt@_WDH@std@@SAIPAPBVfacet@locale@2@@Z */
3656 /* ?_Getcat@?$codecvt@_WDH@std@@SA_KPEAPEBVfacet@locale@2@@Z */
3657 MSVCP_size_t __cdecl codecvt_wchar__Getcat_old(const locale_facet **facet)
3659 return codecvt_wchar__Getcat(facet, locale_classic());
3662 codecvt_wchar* codecvt_wchar_use_facet(const locale *loc)
3664 static codecvt_wchar *obj = NULL;
3666 _Lockit lock;
3667 const locale_facet *fac;
3669 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
3670 fac = locale__Getfacet(loc, locale_id_operator_size_t(&codecvt_wchar_id));
3671 if(fac) {
3672 _Lockit_dtor(&lock);
3673 return (codecvt_wchar*)fac;
3676 if(obj) {
3677 _Lockit_dtor(&lock);
3678 return obj;
3681 codecvt_wchar__Getcat(&fac, loc);
3682 obj = (codecvt_wchar*)fac;
3683 call_locale_facet__Incref(&obj->base.facet);
3684 locale_facet_register(&obj->base.facet);
3685 _Lockit_dtor(&lock);
3687 return obj;
3690 /* ?_Getcat@?$codecvt@GDH@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
3691 /* ?_Getcat@?$codecvt@GDH@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
3692 MSVCP_size_t __cdecl codecvt_short__Getcat(const locale_facet **facet, const locale *loc)
3694 TRACE("(%p %p)\n", facet, loc);
3696 if(facet && !*facet) {
3697 _Locinfo locinfo;
3699 *facet = MSVCRT_operator_new(sizeof(codecvt_wchar));
3700 if(!*facet) {
3701 ERR("Out of memory\n");
3702 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
3703 return 0;
3706 _Locinfo_ctor_cstr(&locinfo, locale_string_char_c_str(&loc->ptr->name));
3707 codecvt_short_ctor((codecvt_wchar*)*facet);
3708 _Locinfo_dtor(&locinfo);
3711 return LC_CTYPE;
3714 /* ?_Getcat@?$codecvt@GDH@std@@SAIPAPBVfacet@locale@2@@Z */
3715 /* ?_Getcat@?$codecvt@GDH@std@@SA_KPEAPEBVfacet@locale@2@@Z */
3716 MSVCP_size_t __cdecl codecvt_short__Getcat_old(const locale_facet **facet)
3718 return codecvt_short__Getcat(facet, locale_classic());
3721 codecvt_wchar* codecvt_short_use_facet(const locale *loc)
3723 static codecvt_wchar *obj = NULL;
3725 _Lockit lock;
3726 const locale_facet *fac;
3728 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
3729 fac = locale__Getfacet(loc, locale_id_operator_size_t(&codecvt_short_id));
3730 if(fac) {
3731 _Lockit_dtor(&lock);
3732 return (codecvt_wchar*)fac;
3735 if(obj) {
3736 _Lockit_dtor(&lock);
3737 return obj;
3740 codecvt_short__Getcat(&fac, loc);
3741 obj = (codecvt_wchar*)fac;
3742 call_locale_facet__Incref(&obj->base.facet);
3743 locale_facet_register(&obj->base.facet);
3744 _Lockit_dtor(&lock);
3746 return obj;
3749 /* ?_Id_func@?$codecvt@_WDH@std@@SAAAVid@locale@2@XZ */
3750 /* ?_Id_func@?$codecvt@_WDH@std@@SAAEAVid@locale@2@XZ */
3751 locale_id* __cdecl codecvt_wchar__Id_func(void)
3753 TRACE("()\n");
3754 return &codecvt_wchar_id;
3757 /* ?_Id_func@?$codecvt@GDH@std@@SAAAVid@locale@2@XZ */
3758 /* ?_Id_func@?$codecvt@GDH@std@@SAAEAVid@locale@2@XZ */
3759 locale_id* __cdecl codecvt_short__Id_func(void)
3761 TRACE("()\n");
3762 return &codecvt_short_id;
3765 /* ?do_always_noconv@?$codecvt@GDH@std@@MBE_NXZ */
3766 /* ?do_always_noconv@?$codecvt@GDH@std@@MEBA_NXZ */
3767 /* ?do_always_noconv@?$codecvt@_WDH@std@@MBE_NXZ */
3768 /* ?do_always_noconv@?$codecvt@_WDH@std@@MEBA_NXZ */
3769 DEFINE_THISCALL_WRAPPER(codecvt_wchar_do_always_noconv, 4)
3770 MSVCP_bool __thiscall codecvt_wchar_do_always_noconv(const codecvt_wchar *this)
3772 TRACE("(%p)\n", this);
3773 return FALSE;
3776 /* ?do_max_length@?$codecvt@GDH@std@@MBEHXZ */
3777 /* ?do_max_length@?$codecvt@GDH@std@@MEBAHXZ */
3778 /* ?do_max_length@?$codecvt@_WDH@std@@MBEHXZ */
3779 /* ?do_max_length@?$codecvt@_WDH@std@@MEBAHXZ */
3780 DEFINE_THISCALL_WRAPPER(codecvt_wchar_do_max_length, 4)
3781 int __thiscall codecvt_wchar_do_max_length(const codecvt_wchar *this)
3783 TRACE("(%p)\n", this);
3784 return MB_LEN_MAX;
3787 /* ?do_in@?$codecvt@GDH@std@@MBEHAAHPBD1AAPBDPAG3AAPAG@Z */
3788 /* ?do_in@?$codecvt@GDH@std@@MEBAHAEAHPEBD1AEAPEBDPEAG3AEAPEAG@Z */
3789 /* ?do_in@?$codecvt@_WDH@std@@MBEHAAHPBD1AAPBDPA_W3AAPA_W@Z */
3790 /* ?do_in@?$codecvt@_WDH@std@@MEBAHAEAHPEBD1AEAPEBDPEA_W3AEAPEA_W@Z */
3791 #if _MSVCP_VER <= 100
3792 #define call_codecvt_wchar_do_in(this, state, from, from_end, from_next, to, to_end, to_next) \
3793 CALL_VTBL_FUNC(this, 16, int, \
3794 (const codecvt_wchar*, int*, const char*, const char*, const char**, wchar_t*, wchar_t*, wchar_t**), \
3795 (this, state, from, from_end, from_next, to, to_end, to_next))
3796 #else
3797 #define call_codecvt_wchar_do_in(this, state, from, from_end, from_next, to, to_end, to_next) \
3798 CALL_VTBL_FUNC(this, 24, int, \
3799 (const codecvt_wchar*, int*, const char*, const char*, const char**, wchar_t*, wchar_t*, wchar_t**), \
3800 (this, state, from, from_end, from_next, to, to_end, to_next))
3801 #endif
3802 DEFINE_THISCALL_WRAPPER(codecvt_wchar_do_in, 32)
3803 int __thiscall codecvt_wchar_do_in(const codecvt_wchar *this, int *state,
3804 const char *from, const char *from_end, const char **from_next,
3805 wchar_t *to, wchar_t *to_end, wchar_t **to_next)
3807 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from,
3808 from_end, from_next, to, to_end, to_next);
3810 *from_next = from;
3811 *to_next = to;
3813 while(*from_next!=from_end && *to_next!=to_end) {
3814 switch(_Mbrtowc(*to_next, *from_next, from_end-*from_next, state, &this->cvt)) {
3815 case -2:
3816 *from_next = from_end;
3817 return CODECVT_partial;
3818 case -1:
3819 return CODECVT_error;
3820 case 2:
3821 (*from_next)++;
3822 /* fall through */
3823 case 0:
3824 case 1:
3825 (*from_next)++;
3826 (*to_next)++;
3830 return CODECVT_ok;
3833 /* ?in@?$codecvt@GDH@std@@QBEHAAHPBD1AAPBDPAG3AAPAG@Z */
3834 /* ?in@?$codecvt@GDH@std@@QEBAHAEAHPEBD1AEAPEBDPEAG3AEAPEAG@Z */
3835 /* ?in@?$codecvt@_WDH@std@@QBEHAAHPBD1AAPBDPA_W3AAPA_W@Z */
3836 /* ?in@?$codecvt@_WDH@std@@QEBAHAEAHPEBD1AEAPEBDPEA_W3AEAPEA_W@Z */
3837 DEFINE_THISCALL_WRAPPER(codecvt_wchar_in, 32)
3838 int __thiscall codecvt_wchar_in(const codecvt_wchar *this, int *state,
3839 const char *from, const char *from_end, const char **from_next,
3840 wchar_t *to, wchar_t *to_end, wchar_t **to_next)
3842 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from,
3843 from_end, from_next, to, to_end, to_next);
3844 return call_codecvt_wchar_do_in(this, state, from,
3845 from_end, from_next, to, to_end, to_next);
3848 /* ?do_out@?$codecvt@GDH@std@@MBEHAAHPBG1AAPBGPAD3AAPAD@Z */
3849 /* ?do_out@?$codecvt@GDH@std@@MEBAHAEAHPEBG1AEAPEBGPEAD3AEAPEAD@Z */
3850 /* ?do_out@?$codecvt@_WDH@std@@MBEHAAHPB_W1AAPB_WPAD3AAPAD@Z */
3851 /* ?do_out@?$codecvt@_WDH@std@@MEBAHAEAHPEB_W1AEAPEB_WPEAD3AEAPEAD@Z */
3852 #if _MSVCP_VER <= 100
3853 #define call_codecvt_wchar_do_out(this, state, from, from_end, from_next, to, to_end, to_next) \
3854 CALL_VTBL_FUNC(this, 20, int, \
3855 (const codecvt_wchar*, int*, const wchar_t*, const wchar_t*, const wchar_t**, char*, char*, char**), \
3856 (this, state, from, from_end, from_next, to, to_end, to_next))
3857 #else
3858 #define call_codecvt_wchar_do_out(this, state, from, from_end, from_next, to, to_end, to_next) \
3859 CALL_VTBL_FUNC(this, 28, int, \
3860 (const codecvt_wchar*, int*, const wchar_t*, const wchar_t*, const wchar_t**, char*, char*, char**), \
3861 (this, state, from, from_end, from_next, to, to_end, to_next))
3862 #endif
3863 DEFINE_THISCALL_WRAPPER(codecvt_wchar_do_out, 32)
3864 int __thiscall codecvt_wchar_do_out(const codecvt_wchar *this, int *state,
3865 const wchar_t *from, const wchar_t *from_end, const wchar_t **from_next,
3866 char *to, char *to_end, char **to_next)
3868 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from,
3869 from_end, from_next, to, to_end, to_next);
3871 *from_next = from;
3872 *to_next = to;
3874 while(*from_next!=from_end && *to_next!=to_end) {
3875 int old_state = *state, size;
3876 char buf[MB_LEN_MAX];
3878 switch((size = _Wcrtomb(buf, **from_next, state, &this->cvt))) {
3879 case -1:
3880 return CODECVT_error;
3881 default:
3882 if(size > from_end-*from_next) {
3883 *state = old_state;
3884 return CODECVT_partial;
3887 (*from_next)++;
3888 memcpy_s(*to_next, to_end-*to_next, buf, size);
3889 (*to_next) += size;
3893 return CODECVT_ok;
3896 /* ?out@?$codecvt@GDH@std@@QBEHAAHPBG1AAPBGPAD3AAPAD@Z */
3897 /* ?out@?$codecvt@GDH@std@@QEBAHAEAHPEBG1AEAPEBGPEAD3AEAPEAD@Z */
3898 /* ?out@?$codecvt@_WDH@std@@QBEHAAHPB_W1AAPB_WPAD3AAPAD@Z */
3899 /* ?out@?$codecvt@_WDH@std@@QEBAHAEAHPEB_W1AEAPEB_WPEAD3AEAPEAD@Z */
3900 DEFINE_THISCALL_WRAPPER(codecvt_wchar_out, 32)
3901 int __thiscall codecvt_wchar_out(const codecvt_wchar *this, int *state,
3902 const wchar_t *from, const wchar_t *from_end, const wchar_t **from_next,
3903 char *to, char *to_end, char **to_next)
3905 TRACE("(%p %p %p %p %p %p %p %p)\n", this, state, from,
3906 from_end, from_next, to, to_end, to_next);
3907 return call_codecvt_wchar_do_out(this, state, from,
3908 from_end, from_next, to, to_end, to_next);
3911 /* ?do_unshift@?$codecvt@GDH@std@@MBEHAAHPAD1AAPAD@Z */
3912 /* ?do_unshift@?$codecvt@GDH@std@@MEBAHAEAHPEAD1AEAPEAD@Z */
3913 /* ?do_unshift@?$codecvt@_WDH@std@@MBEHAAHPAD1AAPAD@Z */
3914 /* ?do_unshift@?$codecvt@_WDH@std@@MEBAHAEAHPEAD1AEAPEAD@Z */
3915 #if _MSVCP_VER <= 100
3916 #define call_codecvt_wchar_do_unshift(this, state, to, to_end, to_next) CALL_VTBL_FUNC(this, 24, \
3917 int, (const codecvt_wchar*, int*, char*, char*, char**), (this, state, to, to_end, to_next))
3918 #else
3919 #define call_codecvt_wchar_do_unshift(this, state, to, to_end, to_next) CALL_VTBL_FUNC(this, 32, \
3920 int, (const codecvt_wchar*, int*, char*, char*, char**), (this, state, to, to_end, to_next))
3921 #endif
3922 DEFINE_THISCALL_WRAPPER(codecvt_wchar_do_unshift, 20)
3923 int __thiscall codecvt_wchar_do_unshift(const codecvt_wchar *this,
3924 int *state, char *to, char *to_end, char **to_next)
3926 TRACE("(%p %p %p %p %p)\n", this, state, to, to_end, to_next);
3927 if(*state)
3928 WARN("unexpected state: %x\n", *state);
3930 *to_next = to;
3931 return CODECVT_ok;
3934 /* ?unshift@?$codecvt@GDH@std@@QBEHAAHPAD1AAPAD@Z */
3935 /* ?unshift@?$codecvt@GDH@std@@QEBAHAEAHPEAD1AEAPEAD@Z */
3936 /* ?unshift@?$codecvt@_WDH@std@@QBEHAAHPAD1AAPAD@Z */
3937 /* ?unshift@?$codecvt@_WDH@std@@QEBAHAEAHPEAD1AEAPEAD@Z */
3938 DEFINE_THISCALL_WRAPPER(codecvt_wchar_unshift, 20)
3939 int __thiscall codecvt_wchar_unshift(const codecvt_wchar *this,
3940 int *state, char *to, char *to_end, char **to_next)
3942 TRACE("(%p %p %p %p %p)\n", this, state, to, to_end, to_next);
3943 return call_codecvt_wchar_do_unshift(this, state, to, to_end, to_next);
3946 /* ?do_length@?$codecvt@GDH@std@@MBEHABHPBD1I@Z */
3947 /* ?do_length@?$codecvt@GDH@std@@MEBAHAEBHPEBD1_K@Z */
3948 /* ?do_length@?$codecvt@_WDH@std@@MBEHABHPBD1I@Z */
3949 /* ?do_length@?$codecvt@_WDH@std@@MEBAHAEBHPEBD1_K@Z */
3950 #if _MSVCP_VER <= 100
3951 #define call_codecvt_wchar_do_length(this, state, from, from_end, max) CALL_VTBL_FUNC(this, 28, \
3952 int, (const codecvt_wchar*, const int*, const char*, const char*, MSVCP_size_t), \
3953 (this, state, from, from_end, max))
3954 #else
3955 #define call_codecvt_wchar_do_length(this, state, from, from_end, max) CALL_VTBL_FUNC(this, 36, \
3956 int, (const codecvt_wchar*, const int*, const char*, const char*, MSVCP_size_t), \
3957 (this, state, from, from_end, max))
3958 #endif
3959 DEFINE_THISCALL_WRAPPER(codecvt_wchar_do_length, 20)
3960 int __thiscall codecvt_wchar_do_length(const codecvt_wchar *this, const int *state,
3961 const char *from, const char *from_end, MSVCP_size_t max)
3963 int tmp_state = *state, ret=0;
3965 TRACE("(%p %p %p %p %ld)\n", this, state, from, from_end, max);
3967 while(ret<max && from!=from_end) {
3968 switch(_Mbrtowc(NULL, from, from_end-from, &tmp_state, &this->cvt)) {
3969 case -2:
3970 case -1:
3971 return ret;
3972 case 2:
3973 from++;
3974 /* fall through */
3975 case 0:
3976 case 1:
3977 from++;
3978 ret++;
3982 return ret;
3985 /* ?length@?$codecvt@GDH@std@@QBEHABHPBD1I@Z */
3986 /* ?length@?$codecvt@GDH@std@@QEBAHAEBHPEBD1_K@Z */
3987 /* ?length@?$codecvt@_WDH@std@@QBEHABHPBD1I@Z */
3988 /* ?length@?$codecvt@_WDH@std@@QEBAHAEBHPEBD1_K@Z */
3989 DEFINE_THISCALL_WRAPPER(codecvt_wchar_length, 20)
3990 int __thiscall codecvt_wchar_length(const codecvt_wchar *this, const int *state,
3991 const char *from, const char *from_end, MSVCP_size_t max)
3993 TRACE("(%p %p %p %p %ld)\n", this, state, from, from_end, max);
3994 return call_codecvt_wchar_do_length(this, state, from, from_end, max);
3997 /* ?id@?$numpunct@D@std@@2V0locale@2@A */
3998 locale_id numpunct_char_id = {0};
4000 /* ??_7?$numpunct@D@std@@6B@ */
4001 extern const vtable_ptr MSVCP_numpunct_char_vtable;
4003 /* ?_Init@?$numpunct@D@std@@IAEXABV_Locinfo@2@_N@Z */
4004 /* ?_Init@?$numpunct@D@std@@IEAAXAEBV_Locinfo@2@_N@Z */
4005 DEFINE_THISCALL_WRAPPER(numpunct_char__Init, 12)
4006 void __thiscall numpunct_char__Init(numpunct_char *this, const _Locinfo *locinfo, MSVCP_bool isdef)
4008 int len;
4010 TRACE("(%p %p %d)\n", this, locinfo, isdef);
4012 len = strlen(_Locinfo__Getfalse(locinfo))+1;
4013 this->false_name = MSVCRT_operator_new(len);
4014 if(this->false_name)
4015 memcpy((char*)this->false_name, _Locinfo__Getfalse(locinfo), len);
4017 len = strlen(_Locinfo__Gettrue(locinfo))+1;
4018 this->true_name = MSVCRT_operator_new(len);
4019 if(this->true_name)
4020 memcpy((char*)this->true_name, _Locinfo__Gettrue(locinfo), len);
4022 if(isdef) {
4023 this->grouping = MSVCRT_operator_new(1);
4024 if(this->grouping)
4025 *(char*)this->grouping = 0;
4027 this->dp = '.';
4028 this->sep = ',';
4029 } else {
4030 const struct lconv *lc = _Locinfo__Getlconv(locinfo);
4032 len = strlen(lc->grouping)+1;
4033 this->grouping = MSVCRT_operator_new(len);
4034 if(this->grouping)
4035 memcpy((char*)this->grouping, lc->grouping, len);
4037 this->dp = lc->decimal_point[0];
4038 this->sep = lc->thousands_sep[0];
4041 if(!this->false_name || !this->true_name || !this->grouping) {
4042 MSVCRT_operator_delete((char*)this->grouping);
4043 MSVCRT_operator_delete((char*)this->false_name);
4044 MSVCRT_operator_delete((char*)this->true_name);
4046 ERR("Out of memory\n");
4047 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
4051 /* ?_Tidy@?$numpunct@D@std@@AAEXXZ */
4052 /* ?_Tidy@?$numpunct@D@std@@AEAAXXZ */
4053 DEFINE_THISCALL_WRAPPER(numpunct_char__Tidy, 4)
4054 void __thiscall numpunct_char__Tidy(numpunct_char *this)
4056 TRACE("(%p)\n", this);
4058 MSVCRT_operator_delete((char*)this->grouping);
4059 MSVCRT_operator_delete((char*)this->false_name);
4060 MSVCRT_operator_delete((char*)this->true_name);
4063 /* ??0?$numpunct@D@std@@QAE@ABV_Locinfo@1@I_N@Z */
4064 /* ??0?$numpunct@D@std@@QEAA@AEBV_Locinfo@1@_K_N@Z */
4065 DEFINE_THISCALL_WRAPPER(numpunct_char_ctor_locinfo, 16)
4066 numpunct_char* __thiscall numpunct_char_ctor_locinfo(numpunct_char *this,
4067 const _Locinfo *locinfo, MSVCP_size_t refs, MSVCP_bool usedef)
4069 TRACE("(%p %p %lu %d)\n", this, locinfo, refs, usedef);
4070 locale_facet_ctor_refs(&this->facet, refs);
4071 this->facet.vtable = &MSVCP_numpunct_char_vtable;
4072 numpunct_char__Init(this, locinfo, usedef);
4073 return this;
4076 /* ??0?$numpunct@D@std@@IAE@PBDI_N@Z */
4077 /* ??0?$numpunct@D@std@@IEAA@PEBD_K_N@Z */
4078 DEFINE_THISCALL_WRAPPER(numpunct_char_ctor_name, 16)
4079 numpunct_char* __thiscall numpunct_char_ctor_name(numpunct_char *this,
4080 const char *name, MSVCP_size_t refs, MSVCP_bool usedef)
4082 _Locinfo locinfo;
4084 TRACE("(%p %s %lu %d)\n", this, debugstr_a(name), refs, usedef);
4085 locale_facet_ctor_refs(&this->facet, refs);
4086 this->facet.vtable = &MSVCP_numpunct_char_vtable;
4088 _Locinfo_ctor_cstr(&locinfo, name);
4089 numpunct_char__Init(this, &locinfo, usedef);
4090 _Locinfo_dtor(&locinfo);
4091 return this;
4094 /* ??0?$numpunct@D@std@@QAE@I@Z */
4095 /* ??0?$numpunct@D@std@@QEAA@_K@Z */
4096 DEFINE_THISCALL_WRAPPER(numpunct_char_ctor_refs, 8)
4097 numpunct_char* __thiscall numpunct_char_ctor_refs(numpunct_char *this, MSVCP_size_t refs)
4099 TRACE("(%p %lu)\n", this, refs);
4100 return numpunct_char_ctor_name(this, "C", refs, FALSE);
4103 /* ??_F?$numpunct@D@std@@QAEXXZ */
4104 /* ??_F?$numpunct@D@std@@QEAAXXZ */
4105 DEFINE_THISCALL_WRAPPER(numpunct_char_ctor, 4)
4106 numpunct_char* __thiscall numpunct_char_ctor(numpunct_char *this)
4108 return numpunct_char_ctor_refs(this, 0);
4111 /* ??1?$numpunct@D@std@@UAE@XZ */
4112 /* ??1?$numpunct@D@std@@UEAA@XZ */
4113 /* ??1?$numpunct@D@std@@MAE@XZ */
4114 /* ??1?$numpunct@D@std@@MEAA@XZ */
4115 DEFINE_THISCALL_WRAPPER(numpunct_char_dtor, 4)
4116 void __thiscall numpunct_char_dtor(numpunct_char *this)
4118 TRACE("(%p)\n", this);
4119 numpunct_char__Tidy(this);
4122 DEFINE_THISCALL_WRAPPER(numpunct_char_vector_dtor, 8)
4123 numpunct_char* __thiscall numpunct_char_vector_dtor(numpunct_char *this, unsigned int flags)
4125 TRACE("(%p %x)\n", this, flags);
4126 if(flags & 2) {
4127 /* we have an array, with the number of elements stored before the first object */
4128 INT_PTR i, *ptr = (INT_PTR *)this-1;
4130 for(i=*ptr-1; i>=0; i--)
4131 numpunct_char_dtor(this+i);
4132 MSVCRT_operator_delete(ptr);
4133 } else {
4134 numpunct_char_dtor(this);
4135 if(flags & 1)
4136 MSVCRT_operator_delete(this);
4139 return this;
4142 /* ?_Getcat@?$numpunct@D@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
4143 /* ?_Getcat@?$numpunct@D@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
4144 MSVCP_size_t __cdecl numpunct_char__Getcat(const locale_facet **facet, const locale *loc)
4146 TRACE("(%p %p)\n", facet, loc);
4148 if(facet && !*facet) {
4149 *facet = MSVCRT_operator_new(sizeof(numpunct_char));
4150 if(!*facet) {
4151 ERR("Out of memory\n");
4152 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
4153 return 0;
4155 numpunct_char_ctor_name((numpunct_char*)*facet,
4156 locale_string_char_c_str(&loc->ptr->name), 0, TRUE);
4159 return LC_NUMERIC;
4162 /* ?_Getcat@?$numpunct@D@std@@SAIPAPBVfacet@locale@2@@Z */
4163 /* ?_Getcat@?$numpunct@D@std@@SA_KPEAPEBVfacet@locale@2@@Z */
4164 MSVCP_size_t __cdecl numpunct_char__Getcat_old(const locale_facet **facet)
4166 return numpunct_char__Getcat(facet, locale_classic());
4169 static numpunct_char* numpunct_char_use_facet(const locale *loc)
4171 static numpunct_char *obj = NULL;
4173 _Lockit lock;
4174 const locale_facet *fac;
4176 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
4177 fac = locale__Getfacet(loc, locale_id_operator_size_t(&numpunct_char_id));
4178 if(fac) {
4179 _Lockit_dtor(&lock);
4180 return (numpunct_char*)fac;
4183 if(obj) {
4184 _Lockit_dtor(&lock);
4185 return obj;
4188 numpunct_char__Getcat(&fac, loc);
4189 obj = (numpunct_char*)fac;
4190 call_locale_facet__Incref(&obj->facet);
4191 locale_facet_register(&obj->facet);
4192 _Lockit_dtor(&lock);
4194 return obj;
4197 /* ?do_decimal_point@?$numpunct@D@std@@MBEDXZ */
4198 /* ?do_decimal_point@?$numpunct@D@std@@MEBADXZ */
4199 DEFINE_THISCALL_WRAPPER(numpunct_char_do_decimal_point, 4)
4200 #if _MSVCP_VER <= 100
4201 #define call_numpunct_char_do_decimal_point(this) CALL_VTBL_FUNC(this, 4, \
4202 char, (const numpunct_char *this), (this))
4203 #else
4204 #define call_numpunct_char_do_decimal_point(this) CALL_VTBL_FUNC(this, 12, \
4205 char, (const numpunct_char *this), (this))
4206 #endif
4207 char __thiscall numpunct_char_do_decimal_point(const numpunct_char *this)
4209 TRACE("(%p)\n", this);
4210 return this->dp;
4213 /* ?decimal_point@?$numpunct@D@std@@QBEDXZ */
4214 /* ?decimal_point@?$numpunct@D@std@@QEBADXZ */
4215 DEFINE_THISCALL_WRAPPER(numpunct_char_decimal_point, 4)
4216 char __thiscall numpunct_char_decimal_point(const numpunct_char *this)
4218 TRACE("(%p)\n", this);
4219 return call_numpunct_char_do_decimal_point(this);
4222 /* ?do_thousands_sep@?$numpunct@D@std@@MBEDXZ */
4223 /* ?do_thousands_sep@?$numpunct@D@std@@MEBADXZ */
4224 DEFINE_THISCALL_WRAPPER(numpunct_char_do_thousands_sep, 4)
4225 #if _MSVCP_VER <= 100
4226 #define call_numpunct_char_do_thousands_sep(this) CALL_VTBL_FUNC(this, 8, \
4227 char, (const numpunct_char*), (this))
4228 #else
4229 #define call_numpunct_char_do_thousands_sep(this) CALL_VTBL_FUNC(this, 16, \
4230 char, (const numpunct_char*), (this))
4231 #endif
4232 char __thiscall numpunct_char_do_thousands_sep(const numpunct_char *this)
4234 TRACE("(%p)\n", this);
4235 return this->sep;
4238 /* ?thousands_sep@?$numpunct@D@std@@QBEDXZ */
4239 /* ?thousands_sep@?$numpunct@D@std@@QEBADXZ */
4240 DEFINE_THISCALL_WRAPPER(numpunct_char_thousands_sep, 4)
4241 char __thiscall numpunct_char_thousands_sep(const numpunct_char *this)
4243 TRACE("(%p)\n", this);
4244 return call_numpunct_char_do_thousands_sep(this);
4247 /* ?do_grouping@?$numpunct@D@std@@MBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4248 /* ?do_grouping@?$numpunct@D@std@@MEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4249 DEFINE_THISCALL_WRAPPER(numpunct_char_do_grouping, 8)
4250 #if _MSVCP_VER <= 100
4251 #define call_numpunct_char_do_grouping(this, ret) CALL_VTBL_FUNC(this, 12, \
4252 basic_string_char*, (const numpunct_char*, basic_string_char*), (this, ret))
4253 #else
4254 #define call_numpunct_char_do_grouping(this, ret) CALL_VTBL_FUNC(this, 20, \
4255 basic_string_char*, (const numpunct_char*, basic_string_char*), (this, ret))
4256 #endif
4257 basic_string_char* __thiscall numpunct_char_do_grouping(
4258 const numpunct_char *this, basic_string_char *ret)
4260 TRACE("(%p)\n", this);
4261 return MSVCP_basic_string_char_ctor_cstr(ret, this->grouping);
4264 /* ?grouping@?$numpunct@D@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4265 /* ?grouping@?$numpunct@D@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4266 DEFINE_THISCALL_WRAPPER(numpunct_char_grouping, 8)
4267 basic_string_char* __thiscall numpunct_char_grouping(const numpunct_char *this, basic_string_char *ret)
4269 TRACE("(%p)\n", this);
4270 return call_numpunct_char_do_grouping(this, ret);
4273 /* ?do_falsename@?$numpunct@D@std@@MBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4274 /* ?do_falsename@?$numpunct@D@std@@MEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4275 DEFINE_THISCALL_WRAPPER(numpunct_char_do_falsename, 8)
4276 #if _MSVCP_VER <= 100
4277 #define call_numpunct_char_do_falsename(this, ret) CALL_VTBL_FUNC(this, 16, \
4278 basic_string_char*, (const numpunct_char*, basic_string_char*), (this, ret))
4279 #else
4280 #define call_numpunct_char_do_falsename(this, ret) CALL_VTBL_FUNC(this, 24, \
4281 basic_string_char*, (const numpunct_char*, basic_string_char*), (this, ret))
4282 #endif
4283 basic_string_char* __thiscall numpunct_char_do_falsename(
4284 const numpunct_char *this, basic_string_char *ret)
4286 TRACE("(%p)\n", this);
4287 return MSVCP_basic_string_char_ctor_cstr(ret, this->false_name);
4290 /* ?falsename@?$numpunct@D@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4291 /* ?falsename@?$numpunct@D@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4292 DEFINE_THISCALL_WRAPPER(numpunct_char_falsename, 8)
4293 basic_string_char* __thiscall numpunct_char_falsename(const numpunct_char *this, basic_string_char *ret)
4295 TRACE("(%p)\n", this);
4296 return call_numpunct_char_do_falsename(this, ret);
4299 /* ?do_truename@?$numpunct@D@std@@MBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4300 /* ?do_truename@?$numpunct@D@std@@MEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4301 DEFINE_THISCALL_WRAPPER(numpunct_char_do_truename, 8)
4302 #if _MSVCP_VER <= 100
4303 #define call_numpunct_char_do_truename(this, ret) CALL_VTBL_FUNC(this, 20, \
4304 basic_string_char*, (const numpunct_char*, basic_string_char*), (this, ret))
4305 #else
4306 #define call_numpunct_char_do_truename(this, ret) CALL_VTBL_FUNC(this, 28, \
4307 basic_string_char*, (const numpunct_char*, basic_string_char*), (this, ret))
4308 #endif
4309 basic_string_char* __thiscall numpunct_char_do_truename(
4310 const numpunct_char *this, basic_string_char *ret)
4312 TRACE("(%p)\n", this);
4313 return MSVCP_basic_string_char_ctor_cstr(ret, this->true_name);
4316 /* ?truename@?$numpunct@D@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4317 /* ?truename@?$numpunct@D@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4318 DEFINE_THISCALL_WRAPPER(numpunct_char_truename, 8)
4319 basic_string_char* __thiscall numpunct_char_truename(const numpunct_char *this, basic_string_char *ret)
4321 TRACE("(%p)\n", this);
4322 return call_numpunct_char_do_truename(this, ret);
4325 /* ?id@?$numpunct@_W@std@@2V0locale@2@A */
4326 locale_id numpunct_wchar_id = {0};
4327 /* ?id@?$numpunct@G@std@@2V0locale@2@A */
4328 locale_id numpunct_short_id = {0};
4330 /* ??_7?$numpunct@_W@std@@6B@ */
4331 extern const vtable_ptr MSVCP_numpunct_wchar_vtable;
4332 /* ??_7?$numpunct@G@std@@6B@ */
4333 extern const vtable_ptr MSVCP_numpunct_short_vtable;
4335 /* ?_Init@?$numpunct@_W@std@@IAEXABV_Locinfo@2@_N@Z */
4336 /* ?_Init@?$numpunct@_W@std@@IEAAXAEBV_Locinfo@2@_N@Z */
4337 /* ?_Init@?$numpunct@G@std@@IAEXABV_Locinfo@2@_N@Z */
4338 /* ?_Init@?$numpunct@G@std@@IEAAXAEBV_Locinfo@2@_N@Z */
4339 DEFINE_THISCALL_WRAPPER(numpunct_wchar__Init, 12)
4340 void __thiscall numpunct_wchar__Init(numpunct_wchar *this,
4341 const _Locinfo *locinfo, MSVCP_bool isdef)
4343 const char *to_convert;
4344 _Cvtvec cvt;
4345 int len;
4347 TRACE("(%p %p %d)\n", this, locinfo, isdef);
4349 _Locinfo__Getcvt(locinfo, &cvt);
4351 to_convert = _Locinfo__Getfalse(locinfo);
4352 len = MultiByteToWideChar(cvt.page, 0, to_convert, -1, NULL, 0);
4353 this->false_name = MSVCRT_operator_new(len*sizeof(WCHAR));
4354 if(this->false_name)
4355 MultiByteToWideChar(cvt.page, 0, to_convert, -1,
4356 (wchar_t*)this->false_name, len);
4358 to_convert = _Locinfo__Gettrue(locinfo);
4359 len = MultiByteToWideChar(cvt.page, 0, to_convert, -1, NULL, 0);
4360 this->true_name = MSVCRT_operator_new(len*sizeof(WCHAR));
4361 if(this->true_name)
4362 MultiByteToWideChar(cvt.page, 0, to_convert, -1,
4363 (wchar_t*)this->true_name, len);
4365 if(isdef) {
4366 this->grouping = MSVCRT_operator_new(1);
4367 if(this->grouping)
4368 *(char*)this->grouping = 0;
4370 this->dp = '.';
4371 this->sep = ',';
4372 } else {
4373 const struct lconv *lc = _Locinfo__Getlconv(locinfo);
4375 len = strlen(lc->grouping)+1;
4376 this->grouping = MSVCRT_operator_new(len);
4377 if(this->grouping)
4378 memcpy((char*)this->grouping, lc->grouping, len);
4380 this->dp = mb_to_wc(lc->decimal_point[0], &cvt);
4381 this->sep = mb_to_wc(lc->thousands_sep[0], &cvt);
4384 if(!this->false_name || !this->true_name || !this->grouping) {
4385 MSVCRT_operator_delete((char*)this->grouping);
4386 MSVCRT_operator_delete((wchar_t*)this->false_name);
4387 MSVCRT_operator_delete((wchar_t*)this->true_name);
4389 ERR("Out of memory\n");
4390 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
4394 /* ?_Tidy@?$numpunct@_W@std@@AAEXXZ */
4395 /* ?_Tidy@?$numpunct@_W@std@@AEAAXXZ */
4396 /* ?_Tidy@?$numpunct@G@std@@AAEXXZ */
4397 /* ?_Tidy@?$numpunct@G@std@@AEAAXXZ */
4398 DEFINE_THISCALL_WRAPPER(numpunct_wchar__Tidy, 4)
4399 void __thiscall numpunct_wchar__Tidy(numpunct_wchar *this)
4401 TRACE("(%p)\n", this);
4403 MSVCRT_operator_delete((char*)this->grouping);
4404 MSVCRT_operator_delete((wchar_t*)this->false_name);
4405 MSVCRT_operator_delete((wchar_t*)this->true_name);
4408 /* ??0?$numpunct@_W@std@@QAE@ABV_Locinfo@1@I_N@Z */
4409 /* ??0?$numpunct@_W@std@@QEAA@AEBV_Locinfo@1@_K_N@Z */
4410 DEFINE_THISCALL_WRAPPER(numpunct_wchar_ctor_locinfo, 16)
4411 numpunct_wchar* __thiscall numpunct_wchar_ctor_locinfo(numpunct_wchar *this,
4412 const _Locinfo *locinfo, MSVCP_size_t refs, MSVCP_bool usedef)
4414 TRACE("(%p %p %lu %d)\n", this, locinfo, refs, usedef);
4415 locale_facet_ctor_refs(&this->facet, refs);
4416 this->facet.vtable = &MSVCP_numpunct_wchar_vtable;
4417 numpunct_wchar__Init(this, locinfo, usedef);
4418 return this;
4421 /* ??0?$numpunct@G@std@@QAE@ABV_Locinfo@1@I_N@Z */
4422 /* ??0?$numpunct@G@std@@QEAA@AEBV_Locinfo@1@_K_N@Z */
4423 DEFINE_THISCALL_WRAPPER(numpunct_short_ctor_locinfo, 16)
4424 numpunct_wchar* __thiscall numpunct_short_ctor_locinfo(numpunct_wchar *this,
4425 const _Locinfo *locinfo, MSVCP_size_t refs, MSVCP_bool usedef)
4427 numpunct_wchar_ctor_locinfo(this, locinfo, refs, usedef);
4428 this->facet.vtable = &MSVCP_numpunct_short_vtable;
4429 return this;
4432 /* ??0?$numpunct@_W@std@@IAE@PBDI_N@Z */
4433 /* ??0?$numpunct@_W@std@@IEAA@PEBD_K_N@Z */
4434 DEFINE_THISCALL_WRAPPER(numpunct_wchar_ctor_name, 16)
4435 numpunct_wchar* __thiscall numpunct_wchar_ctor_name(numpunct_wchar *this,
4436 const char *name, MSVCP_size_t refs, MSVCP_bool usedef)
4438 _Locinfo locinfo;
4440 TRACE("(%p %s %lu %d)\n", this, debugstr_a(name), refs, usedef);
4441 locale_facet_ctor_refs(&this->facet, refs);
4442 this->facet.vtable = &MSVCP_numpunct_wchar_vtable;
4444 _Locinfo_ctor_cstr(&locinfo, name);
4445 numpunct_wchar__Init(this, &locinfo, usedef);
4446 _Locinfo_dtor(&locinfo);
4447 return this;
4450 /* ??0?$numpunct@G@std@@IAE@PBDI_N@Z */
4451 /* ??0?$numpunct@G@std@@IEAA@PEBD_K_N@Z */
4452 DEFINE_THISCALL_WRAPPER(numpunct_short_ctor_name, 16)
4453 numpunct_wchar* __thiscall numpunct_short_ctor_name(numpunct_wchar *this,
4454 const char *name, MSVCP_size_t refs, MSVCP_bool usedef)
4456 numpunct_wchar_ctor_name(this, name, refs, usedef);
4457 this->facet.vtable = &MSVCP_numpunct_short_vtable;
4458 return this;
4461 /* ??0?$numpunct@_W@std@@QAE@I@Z */
4462 /* ??0?$numpunct@_W@std@@QEAA@_K@Z */
4463 DEFINE_THISCALL_WRAPPER(numpunct_wchar_ctor_refs, 8)
4464 numpunct_wchar* __thiscall numpunct_wchar_ctor_refs(numpunct_wchar *this, MSVCP_size_t refs)
4466 TRACE("(%p %lu)\n", this, refs);
4467 return numpunct_wchar_ctor_name(this, "C", refs, FALSE);
4470 /* ??0?$numpunct@G@std@@QAE@I@Z */
4471 /* ??0?$numpunct@G@std@@QEAA@_K@Z */
4472 DEFINE_THISCALL_WRAPPER(numpunct_short_ctor_refs, 8)
4473 numpunct_wchar* __thiscall numpunct_short_ctor_refs(numpunct_wchar *this, MSVCP_size_t refs)
4475 numpunct_wchar_ctor_refs(this, refs);
4476 this->facet.vtable = &MSVCP_numpunct_short_vtable;
4477 return this;
4480 /* ??_F?$numpunct@_W@std@@QAEXXZ */
4481 /* ??_F?$numpunct@_W@std@@QEAAXXZ */
4482 DEFINE_THISCALL_WRAPPER(numpunct_wchar_ctor, 4)
4483 numpunct_wchar* __thiscall numpunct_wchar_ctor(numpunct_wchar *this)
4485 return numpunct_wchar_ctor_refs(this, 0);
4488 /* ??_F?$numpunct@G@std@@QAEXXZ */
4489 /* ??_F?$numpunct@G@std@@QEAAXXZ */
4490 DEFINE_THISCALL_WRAPPER(numpunct_short_ctor, 4)
4491 numpunct_wchar* __thiscall numpunct_short_ctor(numpunct_wchar *this)
4493 return numpunct_short_ctor_refs(this, 0);
4496 /* ??1?$numpunct@G@std@@UAE@XZ */
4497 /* ??1?$numpunct@G@std@@UEAA@XZ */
4498 /* ??1?$numpunct@_W@std@@MAE@XZ */
4499 /* ??1?$numpunct@_W@std@@MEAA@XZ */
4500 /* ??1?$numpunct@G@std@@MAE@XZ */
4501 /* ??1?$numpunct@G@std@@MEAA@XZ */
4502 DEFINE_THISCALL_WRAPPER(numpunct_wchar_dtor, 4)
4503 void __thiscall numpunct_wchar_dtor(numpunct_wchar *this)
4505 TRACE("(%p)\n", this);
4506 numpunct_wchar__Tidy(this);
4509 DEFINE_THISCALL_WRAPPER(numpunct_wchar_vector_dtor, 8)
4510 numpunct_wchar* __thiscall numpunct_wchar_vector_dtor(numpunct_wchar *this, unsigned int flags)
4512 TRACE("(%p %x)\n", this, flags);
4513 if(flags & 2) {
4514 /* we have an array, with the number of elements stored before the first object */
4515 INT_PTR i, *ptr = (INT_PTR *)this-1;
4517 for(i=*ptr-1; i>=0; i--)
4518 numpunct_wchar_dtor(this+i);
4519 MSVCRT_operator_delete(ptr);
4520 } else {
4521 numpunct_wchar_dtor(this);
4522 if(flags & 1)
4523 MSVCRT_operator_delete(this);
4526 return this;
4529 /* ?_Getcat@?$numpunct@_W@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
4530 /* ?_Getcat@?$numpunct@_W@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
4531 MSVCP_size_t __cdecl numpunct_wchar__Getcat(const locale_facet **facet, const locale *loc)
4533 TRACE("(%p %p)\n", facet, loc);
4535 if(facet && !*facet) {
4536 *facet = MSVCRT_operator_new(sizeof(numpunct_wchar));
4537 if(!*facet) {
4538 ERR("Out of memory\n");
4539 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
4540 return 0;
4542 numpunct_wchar_ctor_name((numpunct_wchar*)*facet,
4543 locale_string_char_c_str(&loc->ptr->name), 0, TRUE);
4546 return LC_NUMERIC;
4549 /* ?_Getcat@?$numpunct@_W@std@@SAIPAPBVfacet@locale@2@@Z */
4550 /* ?_Getcat@?$numpunct@_W@std@@SA_KPEAPEBVfacet@locale@2@@Z */
4551 MSVCP_size_t __cdecl numpunct_wchar__Getcat_old(const locale_facet **facet)
4553 return numpunct_wchar__Getcat(facet, locale_classic());
4556 static numpunct_wchar* numpunct_wchar_use_facet(const locale *loc)
4558 static numpunct_wchar *obj = NULL;
4560 _Lockit lock;
4561 const locale_facet *fac;
4563 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
4564 fac = locale__Getfacet(loc, locale_id_operator_size_t(&numpunct_wchar_id));
4565 if(fac) {
4566 _Lockit_dtor(&lock);
4567 return (numpunct_wchar*)fac;
4570 if(obj) {
4571 _Lockit_dtor(&lock);
4572 return obj;
4575 numpunct_wchar__Getcat(&fac, loc);
4576 obj = (numpunct_wchar*)fac;
4577 call_locale_facet__Incref(&obj->facet);
4578 locale_facet_register(&obj->facet);
4579 _Lockit_dtor(&lock);
4581 return obj;
4584 /* ?_Getcat@?$numpunct@G@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
4585 /* ?_Getcat@?$numpunct@G@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
4586 MSVCP_size_t __cdecl numpunct_short__Getcat(const locale_facet **facet, const locale *loc)
4588 TRACE("(%p %p)\n", facet, loc);
4590 if(facet && !*facet) {
4591 *facet = MSVCRT_operator_new(sizeof(numpunct_wchar));
4592 if(!*facet) {
4593 ERR("Out of memory\n");
4594 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
4595 return 0;
4597 numpunct_short_ctor_name((numpunct_wchar*)*facet,
4598 locale_string_char_c_str(&loc->ptr->name), 0, TRUE);
4601 return LC_NUMERIC;
4604 /* ?_Getcat@?$numpunct@G@std@@SAIPAPBVfacet@locale@2@@Z */
4605 /* ?_Getcat@?$numpunct@G@std@@SA_KPEAPEBVfacet@locale@2@@Z */
4606 MSVCP_size_t __cdecl numpunct_short__Getcat_old(const locale_facet **facet)
4608 return numpunct_short__Getcat(facet, locale_classic());
4611 static numpunct_wchar* numpunct_short_use_facet(const locale *loc)
4613 static numpunct_wchar *obj = NULL;
4615 _Lockit lock;
4616 const locale_facet *fac;
4618 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
4619 fac = locale__Getfacet(loc, locale_id_operator_size_t(&numpunct_short_id));
4620 if(fac) {
4621 _Lockit_dtor(&lock);
4622 return (numpunct_wchar*)fac;
4625 if(obj) {
4626 _Lockit_dtor(&lock);
4627 return obj;
4630 numpunct_short__Getcat(&fac, loc);
4631 obj = (numpunct_wchar*)fac;
4632 call_locale_facet__Incref(&obj->facet);
4633 locale_facet_register(&obj->facet);
4634 _Lockit_dtor(&lock);
4636 return obj;
4639 /* ?do_decimal_point@?$numpunct@_W@std@@MBE_WXZ */
4640 /* ?do_decimal_point@?$numpunct@_W@std@@MEBA_WXZ */
4641 /* ?do_decimal_point@?$numpunct@G@std@@MBEGXZ */
4642 /* ?do_decimal_point@?$numpunct@G@std@@MEBAGXZ */
4643 DEFINE_THISCALL_WRAPPER(numpunct_wchar_do_decimal_point, 4)
4644 #if _MSVCP_VER <= 100
4645 #define call_numpunct_wchar_do_decimal_point(this) CALL_VTBL_FUNC(this, 4, \
4646 wchar_t, (const numpunct_wchar *this), (this))
4647 #else
4648 #define call_numpunct_wchar_do_decimal_point(this) CALL_VTBL_FUNC(this, 12, \
4649 wchar_t, (const numpunct_wchar *this), (this))
4650 #endif
4651 wchar_t __thiscall numpunct_wchar_do_decimal_point(const numpunct_wchar *this)
4653 TRACE("(%p)\n", this);
4654 return this->dp;
4657 /* ?decimal_point@?$numpunct@_W@std@@QBE_WXZ */
4658 /* ?decimal_point@?$numpunct@_W@std@@QEBA_WXZ */
4659 /* ?decimal_point@?$numpunct@G@std@@QBEGXZ */
4660 /* ?decimal_point@?$numpunct@G@std@@QEBAGXZ */
4661 DEFINE_THISCALL_WRAPPER(numpunct_wchar_decimal_point, 4)
4662 wchar_t __thiscall numpunct_wchar_decimal_point(const numpunct_wchar *this)
4664 TRACE("(%p)\n", this);
4665 return call_numpunct_wchar_do_decimal_point(this);
4668 /* ?do_thousands_sep@?$numpunct@_W@std@@MBE_WXZ */
4669 /* ?do_thousands_sep@?$numpunct@_W@std@@MEBA_WXZ */
4670 /* ?do_thousands_sep@?$numpunct@G@std@@MBEGXZ */
4671 /* ?do_thousands_sep@?$numpunct@G@std@@MEBAGXZ */
4672 DEFINE_THISCALL_WRAPPER(numpunct_wchar_do_thousands_sep, 4)
4673 #if _MSVCP_VER <= 100
4674 #define call_numpunct_wchar_do_thousands_sep(this) CALL_VTBL_FUNC(this, 8, \
4675 wchar_t, (const numpunct_wchar *this), (this))
4676 #else
4677 #define call_numpunct_wchar_do_thousands_sep(this) CALL_VTBL_FUNC(this, 16, \
4678 wchar_t, (const numpunct_wchar *this), (this))
4679 #endif
4680 wchar_t __thiscall numpunct_wchar_do_thousands_sep(const numpunct_wchar *this)
4682 TRACE("(%p)\n", this);
4683 return this->sep;
4686 /* ?thousands_sep@?$numpunct@_W@std@@QBE_WXZ */
4687 /* ?thousands_sep@?$numpunct@_W@std@@QEBA_WXZ */
4688 /* ?thousands_sep@?$numpunct@G@std@@QBEGXZ */
4689 /* ?thousands_sep@?$numpunct@G@std@@QEBAGXZ */
4690 DEFINE_THISCALL_WRAPPER(numpunct_wchar_thousands_sep, 4)
4691 wchar_t __thiscall numpunct_wchar_thousands_sep(const numpunct_wchar *this)
4693 TRACE("(%p)\n", this);
4694 return call_numpunct_wchar_do_thousands_sep(this);
4697 /* ?do_grouping@?$numpunct@_W@std@@MBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4698 /* ?do_grouping@?$numpunct@_W@std@@MEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4699 /* ?do_grouping@?$numpunct@G@std@@MBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4700 /* ?do_grouping@?$numpunct@G@std@@MEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4701 DEFINE_THISCALL_WRAPPER(numpunct_wchar_do_grouping, 8)
4702 #if _MSVCP_VER <= 100
4703 #define call_numpunct_wchar_do_grouping(this, ret) CALL_VTBL_FUNC(this, 12, \
4704 basic_string_char*, (const numpunct_wchar*, basic_string_char*), (this, ret))
4705 #else
4706 #define call_numpunct_wchar_do_grouping(this, ret) CALL_VTBL_FUNC(this, 20, \
4707 basic_string_char*, (const numpunct_wchar*, basic_string_char*), (this, ret))
4708 #endif
4709 basic_string_char* __thiscall numpunct_wchar_do_grouping(const numpunct_wchar *this, basic_string_char *ret)
4711 TRACE("(%p)\n", this);
4712 return MSVCP_basic_string_char_ctor_cstr(ret, this->grouping);
4715 /* ?grouping@?$numpunct@_W@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4716 /* ?grouping@?$numpunct@_W@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4717 /* ?grouping@?$numpunct@G@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4718 /* ?grouping@?$numpunct@G@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
4719 DEFINE_THISCALL_WRAPPER(numpunct_wchar_grouping, 8)
4720 basic_string_char* __thiscall numpunct_wchar_grouping(const numpunct_wchar *this, basic_string_char *ret)
4722 TRACE("(%p)\n", this);
4723 return call_numpunct_wchar_do_grouping(this, ret);
4726 /* ?do_falsename@?$numpunct@_W@std@@MBE?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
4727 /* ?do_falsename@?$numpunct@_W@std@@MEBA?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
4728 /* ?do_falsename@?$numpunct@G@std@@MBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
4729 /* ?do_falsename@?$numpunct@G@std@@MEBA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
4730 DEFINE_THISCALL_WRAPPER(numpunct_wchar_do_falsename, 8)
4731 #if _MSVCP_VER <= 100
4732 #define call_numpunct_wchar_do_falsename(this, ret) CALL_VTBL_FUNC(this, 16, \
4733 basic_string_wchar*, (const numpunct_wchar*, basic_string_wchar*), (this, ret))
4734 #else
4735 #define call_numpunct_wchar_do_falsename(this, ret) CALL_VTBL_FUNC(this, 24, \
4736 basic_string_wchar*, (const numpunct_wchar*, basic_string_wchar*), (this, ret))
4737 #endif
4738 basic_string_wchar* __thiscall numpunct_wchar_do_falsename(const numpunct_wchar *this, basic_string_wchar *ret)
4740 TRACE("(%p)\n", this);
4741 return MSVCP_basic_string_wchar_ctor_cstr(ret, this->false_name);
4744 /* ?falsename@?$numpunct@_W@std@@QBE?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
4745 /* ?falsename@?$numpunct@_W@std@@QEBA?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
4746 /* ?falsename@?$numpunct@G@std@@QBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
4747 /* ?falsename@?$numpunct@G@std@@QEBA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
4748 DEFINE_THISCALL_WRAPPER(numpunct_wchar_falsename, 8)
4749 basic_string_wchar* __thiscall numpunct_wchar_falsename(const numpunct_wchar *this, basic_string_wchar *ret)
4751 TRACE("(%p)\n", this);
4752 return call_numpunct_wchar_do_falsename(this, ret);
4755 /* ?do_truename@?$numpunct@_W@std@@MBE?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
4756 /* ?do_truename@?$numpunct@_W@std@@MEBA?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
4757 /* ?do_truename@?$numpunct@G@std@@MBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
4758 /* ?do_truename@?$numpunct@G@std@@MEBA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
4759 DEFINE_THISCALL_WRAPPER(numpunct_wchar_do_truename, 8)
4760 #if _MSVCP_VER <= 100
4761 #define call_numpunct_wchar_do_truename(this, ret) CALL_VTBL_FUNC(this, 20, \
4762 basic_string_wchar*, (const numpunct_wchar*, basic_string_wchar*), (this, ret))
4763 #else
4764 #define call_numpunct_wchar_do_truename(this, ret) CALL_VTBL_FUNC(this, 28, \
4765 basic_string_wchar*, (const numpunct_wchar*, basic_string_wchar*), (this, ret))
4766 #endif
4767 basic_string_wchar* __thiscall numpunct_wchar_do_truename(const numpunct_wchar *this, basic_string_wchar *ret)
4769 TRACE("(%p)\n", this);
4770 return MSVCP_basic_string_wchar_ctor_cstr(ret, this->true_name);
4773 /* ?truename@?$numpunct@_W@std@@QBE?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
4774 /* ?truename@?$numpunct@_W@std@@QEBA?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
4775 /* ?truename@?$numpunct@G@std@@QBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
4776 /* ?truename@?$numpunct@G@std@@QEBA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
4777 DEFINE_THISCALL_WRAPPER(numpunct_wchar_truename, 8)
4778 basic_string_wchar* __thiscall numpunct_wchar_truename(const numpunct_wchar *this, basic_string_wchar *ret)
4780 TRACE("(%p)\n", this);
4781 return call_numpunct_wchar_do_truename(this, ret);
4784 double __cdecl _Stod(const char *buf, char **buf_end, LONG exp)
4786 double ret = strtod(buf, buf_end);
4788 if(exp)
4789 ret *= pow(10, exp);
4790 return ret;
4793 double __cdecl _Stodx(const char *buf, char **buf_end, LONG exp, int *err)
4795 double ret;
4797 *err = *_errno();
4798 *_errno() = 0;
4799 ret = _Stod(buf, buf_end, exp);
4800 if(*_errno()) {
4801 *err = *_errno();
4802 }else {
4803 *_errno() = *err;
4804 *err = 0;
4806 return ret;
4809 float __cdecl _Stof(const char *buf, char **buf_end, LONG exp)
4811 return _Stod(buf, buf_end, exp);
4814 float __cdecl _Stofx(const char *buf, char **buf_end, LONG exp, int *err)
4816 return _Stodx(buf, buf_end, exp, err);
4819 __int64 __cdecl _Stoll(const char *buf, char **buf_end, int base)
4821 return _strtoi64(buf, buf_end, base);
4824 __int64 __cdecl _Stollx(const char *buf, char **buf_end, int base, int *err)
4826 __int64 ret;
4828 *err = *_errno();
4829 *_errno() = 0;
4830 ret = _strtoi64(buf, buf_end, base);
4831 if(*_errno()) {
4832 *err = *_errno();
4833 }else {
4834 *_errno() = *err;
4835 *err = 0;
4837 return ret;
4840 LONG __cdecl _Stolx(const char *buf, char **buf_end, int base, int *err)
4842 __int64 i = _Stollx(buf, buf_end, base, err);
4843 if(!*err && i!=(__int64)((LONG)i))
4844 *err = ERANGE;
4845 return i;
4848 unsigned __int64 __cdecl _Stoull(const char *buf, char **buf_end, int base)
4850 return _strtoui64(buf, buf_end, base);
4853 unsigned __int64 __cdecl _Stoullx(const char *buf, char **buf_end, int base, int *err)
4855 unsigned __int64 ret;
4857 *err = *_errno();
4858 *_errno() = 0;
4859 ret = _strtoui64(buf, buf_end, base);
4860 if(*_errno()) {
4861 *err = *_errno();
4862 }else {
4863 *_errno() = *err;
4864 *err = 0;
4866 return ret;
4869 ULONG __cdecl _Stoul(const char *buf, char **buf_end, int base)
4871 int err;
4872 unsigned __int64 i = _Stoullx(buf[0]=='-' ? buf+1 : buf, buf_end, base, &err);
4873 if(!err && i!=(unsigned __int64)((ULONG)i))
4874 *_errno() = ERANGE;
4875 return buf[0]=='-' ? -i : i;
4878 ULONG __cdecl _Stoulx(const char *buf, char **buf_end, int base, int *err)
4880 unsigned __int64 i = _Stoullx(buf[0]=='-' ? buf+1 : buf, buf_end, base, err);
4881 if(!*err && i!=(unsigned __int64)((ULONG)i))
4882 *err = ERANGE;
4883 return buf[0]=='-' ? -i : i;
4886 /* ?id@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@2V0locale@2@A */
4887 locale_id num_get_wchar_id = {0};
4888 /* ?id@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@2V0locale@2@A */
4889 locale_id num_get_short_id = {0};
4891 /* ??_7?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@6B@ */
4892 extern const vtable_ptr MSVCP_num_get_wchar_vtable;
4893 /* ??_7?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@6B@ */
4894 extern const vtable_ptr MSVCP_num_get_short_vtable;
4896 /* ?_Init@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@IAEXABV_Locinfo@2@@Z */
4897 /* ?_Init@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@IEAAXAEBV_Locinfo@2@@Z */
4898 /* ?_Init@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@IAEXABV_Locinfo@2@@Z */
4899 /* ?_Init@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@IEAAXAEBV_Locinfo@2@@Z */
4900 DEFINE_THISCALL_WRAPPER(num_get_wchar__Init, 8)
4901 void __thiscall num_get_wchar__Init(num_get *this, const _Locinfo *locinfo)
4903 TRACE("(%p %p)\n", this, locinfo);
4904 _Locinfo__Getcvt(locinfo, &this->cvt);
4907 /* ??0?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
4908 /* ??0?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
4909 DEFINE_THISCALL_WRAPPER(num_get_wchar_ctor_locinfo, 12)
4910 num_get* __thiscall num_get_wchar_ctor_locinfo(num_get *this,
4911 const _Locinfo *locinfo, MSVCP_size_t refs)
4913 TRACE("(%p %p %lu)\n", this, locinfo, refs);
4915 locale_facet_ctor_refs(&this->facet, refs);
4916 this->facet.vtable = &MSVCP_num_get_wchar_vtable;
4918 num_get_wchar__Init(this, locinfo);
4919 return this;
4922 /* ??0?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
4923 /* ??0?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
4924 DEFINE_THISCALL_WRAPPER(num_get_short_ctor_locinfo, 12)
4925 num_get* __thiscall num_get_short_ctor_locinfo(num_get *this,
4926 const _Locinfo *locinfo, MSVCP_size_t refs)
4928 num_get_wchar_ctor_locinfo(this, locinfo, refs);
4929 this->facet.vtable = &MSVCP_num_get_short_vtable;
4930 return this;
4933 /* ??0?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAE@I@Z */
4934 /* ??0?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAA@_K@Z */
4935 DEFINE_THISCALL_WRAPPER(num_get_wchar_ctor_refs, 8)
4936 num_get* __thiscall num_get_wchar_ctor_refs(num_get *this, MSVCP_size_t refs)
4938 _Locinfo locinfo;
4940 TRACE("(%p %lu)\n", this, refs);
4942 _Locinfo_ctor(&locinfo);
4943 num_get_wchar_ctor_locinfo(this, &locinfo, refs);
4944 _Locinfo_dtor(&locinfo);
4945 return this;
4948 /* ??0?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAE@I@Z */
4949 /* ??0?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEAA@_K@Z */
4950 DEFINE_THISCALL_WRAPPER(num_get_short_ctor_refs, 8)
4951 num_get* __thiscall num_get_short_ctor_refs(num_get *this, MSVCP_size_t refs)
4953 num_get_wchar_ctor_refs(this, refs);
4954 this->facet.vtable = &MSVCP_num_get_short_vtable;
4955 return this;
4958 /* ??_F?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAEXXZ */
4959 /* ??_F?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAAXXZ */
4960 DEFINE_THISCALL_WRAPPER(num_get_wchar_ctor, 4)
4961 num_get* __thiscall num_get_wchar_ctor(num_get *this)
4963 return num_get_wchar_ctor_refs(this, 0);
4966 /* ??_F?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAEXXZ */
4967 /* ??_F?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAAXXZ */
4968 DEFINE_THISCALL_WRAPPER(num_get_short_ctor, 4)
4969 num_get* __thiscall num_get_short_ctor(num_get *this)
4971 return num_get_short_ctor_refs(this, 0);
4974 /* ??1?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@UAE@XZ */
4975 /* ??1?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@UEAA@XZ */
4976 /* ??1?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MAE@XZ */
4977 /* ??1?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MEAA@XZ */
4978 /* ??1?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MAE@XZ */
4979 /* ??1?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MEAA@XZ */
4980 DEFINE_THISCALL_WRAPPER(num_get_wchar_dtor, 4)
4981 void __thiscall num_get_wchar_dtor(num_get *this)
4983 TRACE("(%p)\n", this);
4984 locale_facet_dtor(&this->facet);
4987 DEFINE_THISCALL_WRAPPER(num_get_wchar_vector_dtor, 8)
4988 num_get* __thiscall num_get_wchar_vector_dtor(num_get *this, unsigned int flags)
4990 TRACE("(%p %x)\n", this, flags);
4991 if(flags & 2) {
4992 /* we have an array, with the number of elements stored before the first object */
4993 INT_PTR i, *ptr = (INT_PTR *)this-1;
4995 for(i=*ptr-1; i>=0; i--)
4996 num_get_wchar_dtor(this+i);
4997 MSVCRT_operator_delete(ptr);
4998 } else {
4999 num_get_wchar_dtor(this);
5000 if(flags & 1)
5001 MSVCRT_operator_delete(this);
5004 return this;
5007 /* ?_Getcat@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
5008 /* ?_Getcat@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
5009 MSVCP_size_t __cdecl num_get_wchar__Getcat(const locale_facet **facet, const locale *loc)
5011 TRACE("(%p %p)\n", facet, loc);
5013 if(facet && !*facet) {
5014 _Locinfo locinfo;
5016 *facet = MSVCRT_operator_new(sizeof(num_get));
5017 if(!*facet) {
5018 ERR("Out of memory\n");
5019 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
5020 return 0;
5023 _Locinfo_ctor_cstr(&locinfo, locale_string_char_c_str(&loc->ptr->name));
5024 num_get_wchar_ctor_locinfo((num_get*)*facet, &locinfo, 0);
5025 _Locinfo_dtor(&locinfo);
5028 return LC_NUMERIC;
5031 /* ?_Getcat@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SAIPAPBVfacet@locale@2@@Z */
5032 /* ?_Getcat@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@@Z */
5033 MSVCP_size_t __cdecl num_get_wchar__Getcat_old(const locale_facet **facet)
5035 return num_get_wchar__Getcat(facet, locale_classic());
5038 num_get* num_get_wchar_use_facet(const locale *loc)
5040 static num_get *obj = NULL;
5042 _Lockit lock;
5043 const locale_facet *fac;
5045 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
5046 fac = locale__Getfacet(loc, locale_id_operator_size_t(&num_get_wchar_id));
5047 if(fac) {
5048 _Lockit_dtor(&lock);
5049 return (num_get*)fac;
5052 if(obj) {
5053 _Lockit_dtor(&lock);
5054 return obj;
5057 num_get_wchar__Getcat(&fac, loc);
5058 obj = (num_get*)fac;
5059 call_locale_facet__Incref(&obj->facet);
5060 locale_facet_register(&obj->facet);
5061 _Lockit_dtor(&lock);
5063 return obj;
5066 /* ?_Getcat@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
5067 /* ?_Getcat@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
5068 MSVCP_size_t __cdecl num_get_short__Getcat(const locale_facet **facet, const locale *loc)
5070 if(facet && !*facet) {
5071 num_get_wchar__Getcat(facet, loc);
5072 (*(locale_facet**)facet)->vtable = &MSVCP_num_get_short_vtable;
5075 return LC_NUMERIC;
5078 /* ?_Getcat@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SAIPAPBVfacet@locale@2@@Z */
5079 /* ?_Getcat@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@@Z */
5080 MSVCP_size_t __cdecl num_get_short__Getcat_old(const locale_facet **facet)
5082 return num_get_short__Getcat(facet, locale_classic());
5085 num_get* num_get_short_use_facet(const locale *loc)
5087 static num_get *obj = NULL;
5089 _Lockit lock;
5090 const locale_facet *fac;
5092 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
5093 fac = locale__Getfacet(loc, locale_id_operator_size_t(&num_get_short_id));
5094 if(fac) {
5095 _Lockit_dtor(&lock);
5096 return (num_get*)fac;
5099 if(obj) {
5100 _Lockit_dtor(&lock);
5101 return obj;
5104 num_get_short__Getcat(&fac, loc);
5105 obj = (num_get*)fac;
5106 call_locale_facet__Incref(&obj->facet);
5107 locale_facet_register(&obj->facet);
5108 _Lockit_dtor(&lock);
5110 return obj;
5113 static int num_get__Getffld(const num_get *this, char *dest, istreambuf_iterator_wchar *first,
5114 istreambuf_iterator_wchar *last, const locale *loc, numpunct_wchar *numpunct)
5116 basic_string_char grouping_bstr;
5117 basic_string_char groups_found;
5118 int i, groups_no = 0, cur_group = 0, exp = 0;
5119 char *dest_beg = dest, *num_end = dest+25, *exp_end = dest+31;
5120 wchar_t sep = 0, digits[11], *digits_pos;
5121 const char *grouping, *groups;
5122 BOOL error = FALSE, got_digit = FALSE, got_nonzero = FALSE;
5124 TRACE("(%p %p %p %p)\n", dest, first, last, loc);
5126 for(i=0; i<10; i++)
5127 digits[i] = mb_to_wc('0'+i, &this->cvt);
5128 digits[10] = 0;
5130 numpunct_wchar_grouping(numpunct, &grouping_bstr);
5131 grouping = MSVCP_basic_string_char_c_str(&grouping_bstr);
5132 #if _MSVCP_VER >= 70
5133 if (grouping[0]) sep = numpunct_wchar_thousands_sep(numpunct);
5134 #endif
5136 if(sep)
5137 MSVCP_basic_string_char_ctor(&groups_found);
5139 istreambuf_iterator_wchar_val(first);
5140 /* get sign */
5141 if(first->strbuf && first->val==mb_to_wc('-', &this->cvt)) {
5142 *dest++ = '-';
5143 istreambuf_iterator_wchar_inc(first);
5144 }else if(first->strbuf && first->val==mb_to_wc('+', &this->cvt)) {
5145 *dest++ = '+';
5146 istreambuf_iterator_wchar_inc(first);
5149 /* read possibly grouped numbers before decimal */
5150 for(; first->strbuf; istreambuf_iterator_wchar_inc(first)) {
5151 if(!(digits_pos = wcschr(digits, first->val))) {
5152 if(sep && first->val==sep) {
5153 if(!groups_no) break; /* empty group - stop parsing */
5154 MSVCP_basic_string_char_append_ch(&groups_found, groups_no);
5155 groups_no = 0;
5156 ++cur_group;
5157 }else {
5158 break;
5160 }else {
5161 got_digit = TRUE; /* found a digit, zero or non-zero */
5162 /* write digit to dest if not a leading zero (to not waste dest buffer) */
5163 if(!got_nonzero && first->val == digits[0])
5165 ++groups_no;
5166 continue;
5168 got_nonzero = TRUE;
5169 if(dest < num_end)
5170 *dest++ = '0'+digits_pos-digits;
5171 else
5172 exp++; /* too many digits, just multiply by 10 */
5173 if(sep && groups_no<CHAR_MAX)
5174 ++groups_no;
5178 /* if all leading zeroes, we didn't write anything so put a zero we check for a decimal */
5179 if(got_digit && !got_nonzero)
5180 *dest++ = '0';
5182 /* get decimal, if any */
5183 if(first->strbuf && first->val==numpunct_wchar_decimal_point(numpunct)) {
5184 if(dest < num_end)
5185 *dest++ = *localeconv()->decimal_point;
5186 istreambuf_iterator_wchar_inc(first);
5189 /* read non-grouped after decimal */
5190 for(; first->strbuf; istreambuf_iterator_wchar_inc(first)) {
5191 if(!(digits_pos = wcschr(digits, first->val)))
5192 break;
5193 else if(dest<num_end) {
5194 got_digit = TRUE;
5195 *dest++ = '0'+digits_pos-digits;
5199 /* read exponent, if any */
5200 if(first->strbuf && (first->val==mb_to_wc('e', &this->cvt) || first->val==mb_to_wc('E', &this->cvt))) {
5201 *dest++ = 'e';
5202 istreambuf_iterator_wchar_inc(first);
5204 if(first->strbuf && first->val==mb_to_wc('-', &this->cvt)) {
5205 *dest++ = '-';
5206 istreambuf_iterator_wchar_inc(first);
5207 }else if(first->strbuf && first->val==mb_to_wc('+', &this->cvt)) {
5208 *dest++ = '+';
5209 istreambuf_iterator_wchar_inc(first);
5212 got_digit = got_nonzero = FALSE;
5213 error = TRUE;
5214 /* skip any leading zeroes */
5215 for(; first->strbuf && first->val==digits[0]; istreambuf_iterator_wchar_inc(first))
5216 error = FALSE;
5218 for(; first->strbuf && (digits_pos = wcschr(digits, first->val)); istreambuf_iterator_wchar_inc(first)) {
5219 got_digit = got_nonzero = TRUE; /* leading zeroes would have been skipped, so first digit is non-zero */
5220 error = FALSE;
5221 if(dest<exp_end)
5222 *dest++ = '0'+digits_pos-digits;
5225 /* if just found zeroes for exponent, use that */
5226 if(got_digit && !got_nonzero)
5228 error = FALSE;
5229 if(dest<exp_end)
5230 *dest++ = '0';
5234 if(sep && groups_no)
5235 MSVCP_basic_string_char_append_ch(&groups_found, groups_no);
5237 if(!cur_group) /* no groups, skip loop */
5238 cur_group--;
5239 else if(!(groups = MSVCP_basic_string_char_c_str(&groups_found))[cur_group])
5240 error = TRUE; /* trailing empty */
5242 for(; cur_group>=0 && !error; cur_group--) {
5243 if(*grouping == CHAR_MAX) {
5244 if(cur_group)
5245 error = TRUE;
5246 break;
5247 }else if((cur_group && *grouping!=groups[cur_group])
5248 || (!cur_group && *grouping<groups[cur_group])) {
5249 error = TRUE;
5250 break;
5251 }else if(grouping[1]) {
5252 grouping++;
5255 MSVCP_basic_string_char_dtor(&grouping_bstr);
5256 if(sep)
5257 MSVCP_basic_string_char_dtor(&groups_found);
5259 if(error) {
5260 *dest_beg = '\0';
5261 return 0;
5263 *dest++ = '\0';
5264 return exp;
5267 /* ?_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 */
5268 /* ?_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 */
5269 int __cdecl num_get_wchar__Getffld(const num_get *this, char *dest, istreambuf_iterator_wchar *first,
5270 istreambuf_iterator_wchar *last, const locale *loc)
5272 return num_get__Getffld(this, dest, first, last, loc, numpunct_wchar_use_facet(loc));
5275 /* ?_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 */
5276 /* ?_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 */
5277 int __cdecl num_get_short__Getffld(const num_get *this, char *dest, istreambuf_iterator_wchar *first,
5278 istreambuf_iterator_wchar *last, const locale *loc)
5280 return num_get__Getffld(this, dest, first, last, loc, numpunct_short_use_facet(loc));
5283 /* ?_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 */
5284 /* ?_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 */
5285 /* ?_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 */
5286 /* ?_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 */
5287 int __cdecl num_get_wchar__Getffldx(num_get *this, char *dest, istreambuf_iterator_wchar *first,
5288 istreambuf_iterator_wchar *last, ios_base *ios, int *phexexp)
5290 FIXME("(%p %p %p %p %p) stub\n", dest, first, last, ios, phexexp);
5291 return -1;
5294 static int num_get__Getifld(const num_get *this, char *dest, istreambuf_iterator_wchar *first,
5295 istreambuf_iterator_wchar *last, int fmtflags, const locale *loc, numpunct_wchar *numpunct)
5297 wchar_t digits[23], *digits_pos, sep = 0;
5298 basic_string_char grouping_bstr;
5299 basic_string_char groups_found;
5300 int i, basefield, base, groups_no = 0, cur_group = 0;
5301 char *dest_beg = dest, *dest_end = dest+24;
5302 const char *grouping, *groups;
5303 BOOL error = TRUE, dest_empty = TRUE, found_zero = FALSE;
5305 TRACE("(%p %p %p %04x %p)\n", dest, first, last, fmtflags, loc);
5307 for(i=0; i<10; i++)
5308 digits[i] = mb_to_wc('0'+i, &this->cvt);
5309 for(i=0; i<6; i++) {
5310 digits[10+i] = mb_to_wc('a'+i, &this->cvt);
5311 digits[16+i] = mb_to_wc('A'+i, &this->cvt);
5314 numpunct_wchar_grouping(numpunct, &grouping_bstr);
5315 grouping = MSVCP_basic_string_char_c_str(&grouping_bstr);
5316 #if _MSVCP_VER >= 70
5317 if (grouping[0]) sep = numpunct_wchar_thousands_sep(numpunct);
5318 #endif
5320 basefield = fmtflags & FMTFLAG_basefield;
5321 if(basefield == FMTFLAG_oct)
5322 base = 8;
5323 else if(basefield == FMTFLAG_hex)
5324 base = 22; /* equal to the size of digits buffer */
5325 else if(!basefield)
5326 base = 0;
5327 else
5328 base = 10;
5330 istreambuf_iterator_wchar_val(first);
5331 if(first->strbuf && first->val==mb_to_wc('-', &this->cvt)) {
5332 *dest++ = '-';
5333 istreambuf_iterator_wchar_inc(first);
5334 }else if(first->strbuf && first->val==mb_to_wc('+', &this->cvt)) {
5335 *dest++ = '+';
5336 istreambuf_iterator_wchar_inc(first);
5339 if(first->strbuf && first->val==digits[0]) {
5340 found_zero = TRUE;
5341 istreambuf_iterator_wchar_inc(first);
5342 if(first->strbuf && (first->val==mb_to_wc('x', &this->cvt) || first->val==mb_to_wc('X', &this->cvt))) {
5343 if(!base || base == 22) {
5344 found_zero = FALSE;
5345 istreambuf_iterator_wchar_inc(first);
5346 base = 22;
5347 }else {
5348 base = 10;
5350 }else {
5351 error = FALSE;
5352 if(!base) base = 8;
5354 }else {
5355 if(!base) base = 10;
5357 digits[base] = 0;
5359 if(sep) {
5360 MSVCP_basic_string_char_ctor(&groups_found);
5361 if(found_zero) ++groups_no;
5364 for(; first->strbuf; istreambuf_iterator_wchar_inc(first)) {
5365 if(!(digits_pos = wcschr(digits, first->val))) {
5366 if(sep && first->val==sep) {
5367 if(!groups_no) break; /* empty group - stop parsing */
5368 MSVCP_basic_string_char_append_ch(&groups_found, groups_no);
5369 groups_no = 0;
5370 ++cur_group;
5371 }else {
5372 break;
5374 }else {
5375 error = FALSE;
5376 if(dest_empty && first->val == digits[0]) {
5377 found_zero = TRUE;
5378 ++groups_no;
5379 continue;
5381 dest_empty = FALSE;
5382 /* skip digits that can't be copied to dest buffer, other
5383 * functions are responsible for detecting overflows */
5384 if(dest < dest_end)
5385 *dest++ = (digits_pos-digits<10 ? '0'+digits_pos-digits :
5386 (digits_pos-digits<16 ? 'a'+digits_pos-digits-10 :
5387 'A'+digits_pos-digits-16));
5388 if(sep && groups_no<CHAR_MAX)
5389 ++groups_no;
5393 if(sep && groups_no)
5394 MSVCP_basic_string_char_append_ch(&groups_found, groups_no);
5396 if(!cur_group) { /* no groups, skip loop */
5397 cur_group--;
5398 }else if(!(groups = MSVCP_basic_string_char_c_str(&groups_found))[cur_group]) {
5399 error = TRUE; /* trailing empty */
5400 found_zero = FALSE;
5403 for(; cur_group>=0 && !error; cur_group--) {
5404 if(*grouping == CHAR_MAX) {
5405 if(cur_group)
5406 error = TRUE;
5407 break;
5408 }else if((cur_group && *grouping!=groups[cur_group])
5409 || (!cur_group && *grouping<groups[cur_group])) {
5410 error = TRUE;
5411 break;
5412 }else if(grouping[1]) {
5413 grouping++;
5417 MSVCP_basic_string_char_dtor(&grouping_bstr);
5418 if(sep)
5419 MSVCP_basic_string_char_dtor(&groups_found);
5421 if(error) {
5422 if (found_zero)
5423 *dest++ = '0';
5424 else
5425 dest = dest_beg;
5426 }else if(dest_empty)
5427 *dest++ = '0';
5428 *dest = '\0';
5430 return (base==22 ? 16 : base);
5433 /* ?_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 */
5434 /* ?_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 */
5435 int __cdecl num_get_wchar__Getifld(const num_get *this, char *dest, istreambuf_iterator_wchar *first,
5436 istreambuf_iterator_wchar *last, int fmtflags, const locale *loc)
5438 return num_get__Getifld(this, dest, first, last,
5439 fmtflags, loc, numpunct_wchar_use_facet(loc));
5442 /* ?_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 */
5443 /* ?_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 */
5444 int __cdecl num_get_short__Getifld(const num_get *this, char *dest, istreambuf_iterator_wchar *first,
5445 istreambuf_iterator_wchar *last, int fmtflags, const locale *loc)
5447 return num_get__Getifld(this, dest, first, last,
5448 fmtflags, loc, numpunct_short_use_facet(loc));
5451 /* ?_Hexdig@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@ABEH_W000@Z */
5452 /* ?_Hexdig@?$num_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@AEBAH_W000@Z */
5453 /* ?_Hexdig@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@ABEHGGGG@Z */
5454 /* ?_Hexdig@?$num_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@AEBAHGGGG@Z */
5455 DEFINE_THISCALL_WRAPPER(MSVCP_num_get_wchar__Hexdig, 20)
5456 int __thiscall MSVCP_num_get_wchar__Hexdig(num_get *this, wchar_t dig, wchar_t e0, wchar_t al, wchar_t au)
5458 FIXME("(%p %c %c %c %c) stub\n", this, dig, e0, al, au);
5459 return -1;
5462 static istreambuf_iterator_wchar* num_get_do_get_void(const num_get *this,
5463 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar first,
5464 istreambuf_iterator_wchar last, ios_base *base, int *state,
5465 void **pval, numpunct_wchar *numpunct)
5467 unsigned __int64 v;
5468 char tmp[25], *end;
5469 int err;
5471 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5473 v = _Stoullx(tmp, &end, num_get__Getifld(this, tmp, &first,
5474 &last, FMTFLAG_hex, IOS_LOCALE(base), numpunct), &err);
5475 if(v!=(unsigned __int64)((INT_PTR)v))
5476 *state |= IOSTATE_failbit;
5477 else if(end!=tmp && !err)
5478 *pval = (void*)((INT_PTR)v);
5479 else
5480 *state |= IOSTATE_failbit;
5482 if(!first.strbuf)
5483 *state |= IOSTATE_eofbit;
5485 *ret = first;
5486 return ret;
5489 /* ?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 */
5490 /* ?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 */
5491 #if _MSVCP_VER <= 100
5492 #define call_num_get_wchar_do_get_void(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 4, istreambuf_iterator_wchar*, \
5493 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, void**), \
5494 (this, ret, first, last, base, state, pval))
5495 #else
5496 #define call_num_get_wchar_do_get_void(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 12, istreambuf_iterator_wchar*, \
5497 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, void**), \
5498 (this, ret, first, last, base, state, pval))
5499 #endif
5500 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_void,36)
5501 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_void(const num_get *this, istreambuf_iterator_wchar *ret,
5502 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, void **pval)
5504 return num_get_do_get_void(this, ret, first, last, base,
5505 state, pval, numpunct_wchar_use_facet(IOS_LOCALE(base)));
5508 /* ?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 */
5509 /* ?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 */
5510 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_void,36)
5511 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_void(const num_get *this, istreambuf_iterator_wchar *ret,
5512 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, void **pval)
5514 return num_get_do_get_void(this, ret, first, last, base,
5515 state, pval, numpunct_short_use_facet(IOS_LOCALE(base)));
5518 /* ?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 */
5519 /* ?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 */
5520 /* ?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 */
5521 /* ?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 */
5522 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_void,36)
5523 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_void(const num_get *this, istreambuf_iterator_wchar *ret,
5524 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, void **pval)
5526 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5527 return call_num_get_wchar_do_get_void(this, ret, first, last, base, state, pval);
5530 static istreambuf_iterator_wchar* num_get_do_get_double(const num_get *this,
5531 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar first,
5532 istreambuf_iterator_wchar last, ios_base *base, int *state,
5533 double *pval, numpunct_wchar *numpunct)
5535 double v;
5536 char tmp[32], *end;
5537 int err;
5539 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5541 v = _Stodx(tmp, &end, num_get__Getffld(this, tmp, &first, &last, IOS_LOCALE(base), numpunct), &err);
5542 if(end!=tmp && !err)
5543 *pval = v;
5544 else
5545 *state |= IOSTATE_failbit;
5547 if(!first.strbuf)
5548 *state |= IOSTATE_eofbit;
5550 *ret = first;
5551 return ret;
5554 /* ?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 */
5555 /* ?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 */
5556 /* ?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 */
5557 /* ?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 */
5558 #if _MSVCP_VER <= 100
5559 #define call_num_get_wchar_do_get_ldouble(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 8, istreambuf_iterator_wchar*, \
5560 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, double*), \
5561 (this, ret, first, last, base, state, pval))
5562 #define call_num_get_wchar_do_get_double(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 12, istreambuf_iterator_wchar*, \
5563 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, double*), \
5564 (this, ret, first, last, base, state, pval))
5565 #else
5566 #define call_num_get_wchar_do_get_ldouble(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 16, istreambuf_iterator_wchar*, \
5567 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, double*), \
5568 (this, ret, first, last, base, state, pval))
5569 #define call_num_get_wchar_do_get_double(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 20, istreambuf_iterator_wchar*, \
5570 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, double*), \
5571 (this, ret, first, last, base, state, pval))
5572 #endif
5573 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_double,36)
5574 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_double(const num_get *this, istreambuf_iterator_wchar *ret,
5575 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, double *pval)
5577 return num_get_do_get_double(this, ret, first, last, base,
5578 state, pval, numpunct_wchar_use_facet(IOS_LOCALE(base)));
5581 /* ?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 */
5582 /* ?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 */
5583 /* ?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 */
5584 /* ?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 */
5585 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_double,36)
5586 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_double(const num_get *this, istreambuf_iterator_wchar *ret,
5587 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, double *pval)
5589 return num_get_do_get_double(this, ret, first, last, base,
5590 state, pval, numpunct_short_use_facet(IOS_LOCALE(base)));
5593 /* ?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 */
5594 /* ?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 */
5595 /* ?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 */
5596 /* ?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 */
5597 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_ldouble,36)
5598 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_ldouble(const num_get *this, istreambuf_iterator_wchar *ret,
5599 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, double *pval)
5601 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5602 return call_num_get_wchar_do_get_ldouble(this, ret, first, last, base, state, pval);
5605 /* ?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 */
5606 /* ?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 */
5607 /* ?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 */
5608 /* ?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 */
5609 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_double,36)
5610 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_double(const num_get *this, istreambuf_iterator_wchar *ret,
5611 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, double *pval)
5613 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5614 return call_num_get_wchar_do_get_double(this, ret, first, last, base, state, pval);
5617 static istreambuf_iterator_wchar* num_get_do_get_float(const num_get *this,
5618 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar first,
5619 istreambuf_iterator_wchar last, ios_base *base, int *state,
5620 float *pval, numpunct_wchar *numpunct)
5622 float v;
5623 char tmp[32], *end;
5624 int err;
5626 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5628 v = _Stofx(tmp, &end, num_get__Getffld(this, tmp, &first,
5629 &last, IOS_LOCALE(base), numpunct), &err);
5630 if(end!=tmp && !err)
5631 *pval = v;
5632 else
5633 *state |= IOSTATE_failbit;
5635 if(!first.strbuf)
5636 *state |= IOSTATE_eofbit;
5638 *ret = first;
5639 return ret;
5642 /* ?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 */
5643 /* ?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 */
5644 #if _MSVCP_VER <= 100
5645 #define call_num_get_wchar_do_get_float(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 16, istreambuf_iterator_wchar*, \
5646 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, float*), \
5647 (this, ret, first, last, base, state, pval))
5648 #else
5649 #define call_num_get_wchar_do_get_float(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 24, istreambuf_iterator_wchar*, \
5650 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, float*), \
5651 (this, ret, first, last, base, state, pval))
5652 #endif
5653 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_float,36)
5654 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_float(const num_get *this, istreambuf_iterator_wchar *ret,
5655 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, float *pval)
5657 return num_get_do_get_float(this, ret, first, last, base,
5658 state, pval, numpunct_wchar_use_facet(IOS_LOCALE(base)));
5661 /* ?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 */
5662 /* ?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 */
5663 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_float,36)
5664 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_float(const num_get *this, istreambuf_iterator_wchar *ret,
5665 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, float *pval)
5667 return num_get_do_get_float(this, ret, first, last, base,
5668 state, pval, numpunct_short_use_facet(IOS_LOCALE(base)));
5671 /* ?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 */
5672 /* ?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 */
5673 /* ?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 */
5674 /* ?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 */
5675 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_float,36)
5676 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_float(const num_get *this, istreambuf_iterator_wchar *ret,
5677 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, float *pval)
5679 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5680 return call_num_get_wchar_do_get_float(this, ret, first, last, base, state, pval);
5683 static istreambuf_iterator_wchar* num_get_do_get_uint64(const num_get *this,
5684 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar first,
5685 istreambuf_iterator_wchar last, ios_base *base, int *state,
5686 ULONGLONG *pval, numpunct_wchar *numpunct)
5688 unsigned __int64 v;
5689 char tmp[25], *end;
5690 int err;
5692 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5694 v = _Stoullx(tmp, &end, num_get__Getifld(this, tmp, &first,
5695 &last, base->fmtfl, IOS_LOCALE(base), numpunct), &err);
5696 if(end!=tmp && !err)
5697 *pval = v;
5698 else
5699 *state |= IOSTATE_failbit;
5701 if(!first.strbuf)
5702 *state |= IOSTATE_eofbit;
5704 *ret = first;
5705 return ret;
5708 /* ?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 */
5709 /* ?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 */
5710 #if _MSVCP_VER <= 100
5711 #define call_num_get_wchar_do_get_uint64(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 20, istreambuf_iterator_wchar*, \
5712 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, ULONGLONG*), \
5713 (this, ret, first, last, base, state, pval))
5714 #else
5715 #define call_num_get_wchar_do_get_uint64(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 28, istreambuf_iterator_wchar*, \
5716 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, ULONGLONG*), \
5717 (this, ret, first, last, base, state, pval))
5718 #endif
5719 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_uint64,36)
5720 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_uint64(const num_get *this, istreambuf_iterator_wchar *ret,
5721 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, ULONGLONG *pval)
5723 return num_get_do_get_uint64(this, ret, first, last, base,
5724 state, pval, numpunct_wchar_use_facet(IOS_LOCALE(base)));
5727 /* ?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 */
5728 /* ?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 */
5729 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_uint64,36)
5730 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_uint64(const num_get *this, istreambuf_iterator_wchar *ret,
5731 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, ULONGLONG *pval)
5733 return num_get_do_get_uint64(this, ret, first, last, base,
5734 state, pval, numpunct_short_use_facet(IOS_LOCALE(base)));
5737 /* ?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 */
5738 /* ?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 */
5739 /* ?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 */
5740 /* ?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 */
5741 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_uint64,36)
5742 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_uint64(const num_get *this, istreambuf_iterator_wchar *ret,
5743 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, ULONGLONG *pval)
5745 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5746 return call_num_get_wchar_do_get_uint64(this, ret, first, last, base, state, pval);
5749 static istreambuf_iterator_wchar* num_get_do_get_int64(const num_get *this,
5750 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar first,
5751 istreambuf_iterator_wchar last, ios_base *base, int *state,
5752 LONGLONG *pval, numpunct_wchar *numpunct)
5754 __int64 v;
5755 char tmp[25], *end;
5756 int err;
5758 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5760 v = _Stollx(tmp, &end, num_get__Getifld(this, tmp, &first,
5761 &last, base->fmtfl, IOS_LOCALE(base), numpunct), &err);
5762 if(end!=tmp && !err)
5763 *pval = v;
5764 else
5765 *state |= IOSTATE_failbit;
5767 if(!first.strbuf)
5768 *state |= IOSTATE_eofbit;
5770 *ret = first;
5771 return ret;
5774 /* ?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 */
5775 /* ?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 */
5776 #if _MSVCP_VER <= 100
5777 #define call_num_get_wchar_do_get_int64(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 24, istreambuf_iterator_wchar*, \
5778 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, LONGLONG*), \
5779 (this, ret, first, last, base, state, pval))
5780 #else
5781 #define call_num_get_wchar_do_get_int64(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 32, istreambuf_iterator_wchar*, \
5782 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, LONGLONG*), \
5783 (this, ret, first, last, base, state, pval))
5784 #endif
5785 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_int64,36)
5786 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_int64(const num_get *this, istreambuf_iterator_wchar *ret,
5787 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, LONGLONG *pval)
5789 return num_get_do_get_int64(this, ret, first, last, base,
5790 state, pval, numpunct_wchar_use_facet(IOS_LOCALE(base)));
5793 /* ?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 */
5794 /* ?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 */
5795 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_int64,36)
5796 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_int64(const num_get *this, istreambuf_iterator_wchar *ret,
5797 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, LONGLONG *pval)
5799 return num_get_do_get_int64(this, ret, first, last, base,
5800 state, pval, numpunct_short_use_facet(IOS_LOCALE(base)));
5803 /* ?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 */
5804 /* ?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 */
5805 /* ?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 */
5806 /* ?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 */
5807 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_int64,36)
5808 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_int64(const num_get *this, istreambuf_iterator_wchar *ret,
5809 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, LONGLONG *pval)
5811 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5812 return call_num_get_wchar_do_get_int64(this, ret, first, last, base, state, pval);
5815 static istreambuf_iterator_wchar* num_get_do_get_ulong(const num_get *this,
5816 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar first,
5817 istreambuf_iterator_wchar last, ios_base *base, int *state,
5818 ULONG *pval, numpunct_wchar *numpunct)
5820 ULONG v;
5821 char tmp[25], *end;
5822 int err;
5824 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5826 v = _Stoulx(tmp, &end, num_get__Getifld(this, tmp, &first,
5827 &last, base->fmtfl, IOS_LOCALE(base), numpunct), &err);
5828 if(end!=tmp && !err)
5829 *pval = v;
5830 else
5831 *state |= IOSTATE_failbit;
5833 if(!first.strbuf)
5834 *state |= IOSTATE_eofbit;
5836 *ret = first;
5837 return ret;
5840 /* ?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 */
5841 /* ?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 */
5842 #if _MSVCP_VER <= 100
5843 #define call_num_get_wchar_do_get_ulong(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 28, istreambuf_iterator_wchar*, \
5844 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, ULONG*), \
5845 (this, ret, first, last, base, state, pval))
5846 #else
5847 #define call_num_get_wchar_do_get_ulong(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 36, istreambuf_iterator_wchar*, \
5848 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, ULONG*), \
5849 (this, ret, first, last, base, state, pval))
5850 #endif
5851 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_ulong,36)
5852 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_ulong(const num_get *this, istreambuf_iterator_wchar *ret,
5853 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, ULONG *pval)
5855 return num_get_do_get_ulong(this, ret, first, last, base,
5856 state, pval, numpunct_wchar_use_facet(IOS_LOCALE(base)));
5859 /* ?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 */
5860 /* ?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 */
5861 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_ulong,36)
5862 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_ulong(const num_get *this, istreambuf_iterator_wchar *ret,
5863 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, ULONG *pval)
5865 return num_get_do_get_ulong(this, ret, first, last, base,
5866 state, pval, numpunct_short_use_facet(IOS_LOCALE(base)));
5869 /* ?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 */
5870 /* ?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 */
5871 /* ?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 */
5872 /* ?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 */
5873 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_ulong,36)
5874 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_ulong(const num_get *this, istreambuf_iterator_wchar *ret,
5875 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, ULONG *pval)
5877 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5878 return call_num_get_wchar_do_get_ulong(this, ret, first, last, base, state, pval);
5881 static istreambuf_iterator_wchar* num_get_do_get_long(const num_get *this,
5882 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar first,
5883 istreambuf_iterator_wchar last, ios_base *base, int *state,
5884 LONG *pval, numpunct_wchar *numpunct)
5886 LONG v;
5887 char tmp[25], *end;
5888 int err;
5890 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5892 v = _Stolx(tmp, &end, num_get__Getifld(this, tmp, &first,
5893 &last, base->fmtfl, IOS_LOCALE(base), numpunct), &err);
5894 if(end!=tmp && !err)
5895 *pval = v;
5896 else
5897 *state |= IOSTATE_failbit;
5899 if(!first.strbuf)
5900 *state |= IOSTATE_eofbit;
5902 *ret = first;
5903 return ret;
5906 /* ?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 */
5907 /* ?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 */
5908 #if _MSVCP_VER <= 100
5909 #define call_num_get_wchar_do_get_long(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 32, istreambuf_iterator_wchar*, \
5910 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, LONG*), \
5911 (this, ret, first, last, base, state, pval))
5912 #else
5913 #define call_num_get_wchar_do_get_long(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 40, istreambuf_iterator_wchar*, \
5914 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, LONG*), \
5915 (this, ret, first, last, base, state, pval))
5916 #endif
5917 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_long,36)
5918 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_long(const num_get *this, istreambuf_iterator_wchar *ret,
5919 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, LONG *pval)
5921 return num_get_do_get_long(this, ret, first, last, base,
5922 state, pval, numpunct_wchar_use_facet(IOS_LOCALE(base)));
5925 /* ?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 */
5926 /* ?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 */
5927 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_long,36)
5928 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_long(const num_get *this, istreambuf_iterator_wchar *ret,
5929 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, LONG *pval)
5931 return num_get_do_get_long(this, ret, first, last, base,
5932 state, pval, numpunct_short_use_facet(IOS_LOCALE(base)));
5935 /* ?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 */
5936 /* ?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 */
5937 /* ?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 */
5938 /* ?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 */
5939 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_long,36)
5940 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_long(const num_get *this, istreambuf_iterator_wchar *ret,
5941 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, LONG *pval)
5943 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5944 return call_num_get_wchar_do_get_long(this, ret, first, last, base, state, pval);
5947 /* ?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 */
5948 /* ?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 */
5949 #if _MSVCP_VER <= 100
5950 #define call_num_get_wchar_do_get_uint(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 36, istreambuf_iterator_wchar*, \
5951 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, unsigned int*), \
5952 (this, ret, first, last, base, state, pval))
5953 #else
5954 #define call_num_get_wchar_do_get_uint(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 44, istreambuf_iterator_wchar*, \
5955 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, unsigned int*), \
5956 (this, ret, first, last, base, state, pval))
5957 #endif
5958 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_uint,36)
5959 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_uint(const num_get *this, istreambuf_iterator_wchar *ret,
5960 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, unsigned int *pval)
5962 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5963 return num_get_wchar_do_get_ulong(this, ret, first, last, base, state, pval);
5966 /* ?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 */
5967 /* ?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 */
5968 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_uint,36)
5969 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_uint(const num_get *this, istreambuf_iterator_wchar *ret,
5970 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, unsigned int *pval)
5972 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5973 return num_get_short_do_get_ulong(this, ret, first, last, base, state, pval);
5976 /* ?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 */
5977 /* ?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 */
5978 /* ?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 */
5979 /* ?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 */
5980 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_uint,36)
5981 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_uint(const num_get *this, istreambuf_iterator_wchar *ret,
5982 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, unsigned int *pval)
5984 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
5985 return call_num_get_wchar_do_get_uint(this, ret, first, last, base, state, pval);
5988 /* ?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 */
5989 /* ?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 */
5990 #if _MSVCP_VER <= 100
5991 #define call_num_get_wchar_do_get_ushort(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 40, istreambuf_iterator_wchar*, \
5992 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, unsigned short*), \
5993 (this, ret, first, last, base, state, pval))
5994 #else
5995 #define call_num_get_wchar_do_get_ushort(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 48, istreambuf_iterator_wchar*, \
5996 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, unsigned short*), \
5997 (this, ret, first, last, base, state, pval))
5998 #endif
5999 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_ushort,36)
6000 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_ushort(const num_get *this, istreambuf_iterator_wchar *ret,
6001 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, unsigned short *pval)
6003 ULONG v;
6004 char tmp[25], *beg, *end;
6005 int err, b;
6007 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6009 b = num_get_wchar__Getifld(this, tmp,
6010 &first, &last, base->fmtfl, IOS_LOCALE(base));
6011 beg = tmp + (tmp[0]=='-' ? 1 : 0);
6012 v = _Stoulx(beg, &end, b, &err);
6014 if(v != (ULONG)((unsigned short)v))
6015 *state |= IOSTATE_failbit;
6016 else if(end!=beg && !err)
6017 *pval = (tmp[0]=='-' ? -((unsigned short)v) : v);
6018 else
6019 *state |= IOSTATE_failbit;
6021 if(!first.strbuf)
6022 *state |= IOSTATE_eofbit;
6024 *ret = first;
6025 return ret;
6028 /* ?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 */
6029 /* ?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 */
6030 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_ushort,36)
6031 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_ushort(const num_get *this, istreambuf_iterator_wchar *ret,
6032 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, unsigned short *pval)
6034 FIXME("(%p %p %p %p %p) stub\n", this, ret, base, state, pval);
6035 return ret;
6038 /* ?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 */
6039 /* ?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 */
6040 /* ?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@ */
6041 /* ?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 */
6042 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_ushort,36)
6043 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_ushort(const num_get *this, istreambuf_iterator_wchar *ret,
6044 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, unsigned short *pval)
6046 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6047 return call_num_get_wchar_do_get_ushort(this, ret, first, last, base, state, pval);
6050 static istreambuf_iterator_wchar* num_get_do_get_bool(const num_get *this,
6051 istreambuf_iterator_wchar *ret, istreambuf_iterator_wchar first,
6052 istreambuf_iterator_wchar last, ios_base *base, int *state,
6053 MSVCP_bool *pval, numpunct_wchar *numpunct)
6055 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6057 if(base->fmtfl & FMTFLAG_boolalpha) {
6058 basic_string_wchar false_bstr, true_bstr;
6059 const wchar_t *pfalse, *ptrue;
6061 numpunct_wchar_falsename(numpunct, &false_bstr);
6062 numpunct_wchar_truename(numpunct, &true_bstr);
6063 pfalse = MSVCP_basic_string_wchar_c_str(&false_bstr);
6064 ptrue = MSVCP_basic_string_wchar_c_str(&true_bstr);
6066 for(istreambuf_iterator_wchar_val(&first); first.strbuf;) {
6067 if(pfalse && *pfalse && first.val!=*pfalse)
6068 pfalse = NULL;
6069 if(ptrue && *ptrue && first.val!=*ptrue)
6070 ptrue = NULL;
6072 if(pfalse && *pfalse && ptrue && !*ptrue)
6073 ptrue = NULL;
6074 if(ptrue && *ptrue && pfalse && !*pfalse)
6075 pfalse = NULL;
6077 if(pfalse)
6078 pfalse++;
6079 if(ptrue)
6080 ptrue++;
6082 if(pfalse || ptrue)
6083 istreambuf_iterator_wchar_inc(&first);
6085 if((!pfalse || !*pfalse) && (!ptrue || !*ptrue))
6086 break;
6089 if(ptrue)
6090 *pval = TRUE;
6091 else if(pfalse)
6092 *pval = FALSE;
6093 else
6094 *state |= IOSTATE_failbit;
6096 MSVCP_basic_string_wchar_dtor(&false_bstr);
6097 MSVCP_basic_string_wchar_dtor(&true_bstr);
6098 }else {
6099 char tmp[25], *end;
6100 int err;
6101 LONG v = _Stolx(tmp, &end, num_get__Getifld(this, tmp, &first,
6102 &last, base->fmtfl, IOS_LOCALE(base), numpunct), &err);
6104 if(end!=tmp && err==0 && (v==0 || v==1))
6105 *pval = v;
6106 else
6107 *state |= IOSTATE_failbit;
6110 if(!first.strbuf)
6111 *state |= IOSTATE_eofbit;
6112 memcpy(ret, &first, sizeof(first));
6113 return ret;
6116 /* ?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 */
6117 /* ?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 */
6118 #if _MSVCP_VER <= 100
6119 #define call_num_get_wchar_do_get_bool(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 44, istreambuf_iterator_wchar*, \
6120 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, MSVCP_bool*), \
6121 (this, ret, first, last, base, state, pval))
6122 #else
6123 #define call_num_get_wchar_do_get_bool(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 52, istreambuf_iterator_wchar*, \
6124 (const num_get*, istreambuf_iterator_wchar*, istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, MSVCP_bool*), \
6125 (this, ret, first, last, base, state, pval))
6126 #endif
6127 DEFINE_THISCALL_WRAPPER(num_get_wchar_do_get_bool,36)
6128 istreambuf_iterator_wchar *__thiscall num_get_wchar_do_get_bool(const num_get *this, istreambuf_iterator_wchar *ret,
6129 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, MSVCP_bool *pval)
6131 return num_get_do_get_bool(this, ret, first, last, base,
6132 state, pval, numpunct_wchar_use_facet(IOS_LOCALE(base)));
6135 /* ?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 */
6136 /* ?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 */
6137 DEFINE_THISCALL_WRAPPER(num_get_short_do_get_bool,36)
6138 istreambuf_iterator_wchar *__thiscall num_get_short_do_get_bool(const num_get *this, istreambuf_iterator_wchar *ret,
6139 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, MSVCP_bool *pval)
6141 return num_get_do_get_bool(this, ret, first, last, base,
6142 state, pval, numpunct_short_use_facet(IOS_LOCALE(base)));
6145 /* ?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 */
6146 /* ?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 */
6147 /* ?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 */
6148 /* ?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 */
6149 DEFINE_THISCALL_WRAPPER(num_get_wchar_get_bool,36)
6150 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_bool(const num_get *this, istreambuf_iterator_wchar *ret,
6151 istreambuf_iterator_wchar first, istreambuf_iterator_wchar last, ios_base *base, int *state, MSVCP_bool *pval)
6153 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6154 return call_num_get_wchar_do_get_bool(this, ret, first, last, base, state, pval);
6157 /* ?id@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@2V0locale@2@A */
6158 locale_id num_get_char_id = {0};
6160 /* ??_7?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@6B@ */
6161 extern const vtable_ptr MSVCP_num_get_char_vtable;
6163 /* ?_Init@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@IAEXABV_Locinfo@2@@Z */
6164 /* ?_Init@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@IEAAXAEBV_Locinfo@2@@Z */
6165 DEFINE_THISCALL_WRAPPER(num_get_char__Init, 8)
6166 void __thiscall num_get_char__Init(num_get *this, const _Locinfo *locinfo)
6168 TRACE("(%p %p)\n", this, locinfo);
6169 _Locinfo__Getcvt(locinfo, &this->cvt);
6172 /* ??0?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
6173 /* ??0?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
6174 DEFINE_THISCALL_WRAPPER(num_get_char_ctor_locinfo, 12)
6175 num_get* __thiscall num_get_char_ctor_locinfo(num_get *this,
6176 const _Locinfo *locinfo, MSVCP_size_t refs)
6178 TRACE("(%p %p %lu)\n", this, locinfo, refs);
6180 locale_facet_ctor_refs(&this->facet, refs);
6181 this->facet.vtable = &MSVCP_num_get_char_vtable;
6183 num_get_char__Init(this, locinfo);
6184 return this;
6187 /* ??0?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAE@I@Z */
6188 /* ??0?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAA@_K@Z */
6189 DEFINE_THISCALL_WRAPPER(num_get_char_ctor_refs, 8)
6190 num_get* __thiscall num_get_char_ctor_refs(num_get *this, MSVCP_size_t refs)
6192 _Locinfo locinfo;
6194 TRACE("(%p %lu)\n", this, refs);
6196 _Locinfo_ctor(&locinfo);
6197 num_get_char_ctor_locinfo(this, &locinfo, refs);
6198 _Locinfo_dtor(&locinfo);
6199 return this;
6202 /* ??_F?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAEXXZ */
6203 /* ??_F?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAAXXZ */
6204 DEFINE_THISCALL_WRAPPER(num_get_char_ctor, 4)
6205 num_get* __thiscall num_get_char_ctor(num_get *this)
6207 return num_get_char_ctor_refs(this, 0);
6210 /* ??1?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@UAE@XZ */
6211 /* ??1?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@UEAA@XZ */
6212 /* ??1?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MAE@XZ */
6213 /* ??1?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MEAA@XZ */
6214 DEFINE_THISCALL_WRAPPER(num_get_char_dtor, 4)
6215 void __thiscall num_get_char_dtor(num_get *this)
6217 TRACE("(%p)\n", this);
6218 locale_facet_dtor(&this->facet);
6221 DEFINE_THISCALL_WRAPPER(num_get_char_vector_dtor, 8)
6222 num_get* __thiscall num_get_char_vector_dtor(num_get *this, unsigned int flags)
6224 TRACE("(%p %x)\n", this, flags);
6225 if(flags & 2) {
6226 /* we have an array, with the number of elements stored before the first object */
6227 INT_PTR i, *ptr = (INT_PTR *)this-1;
6229 for(i=*ptr-1; i>=0; i--)
6230 num_get_char_dtor(this+i);
6231 MSVCRT_operator_delete(ptr);
6232 } else {
6233 num_get_char_dtor(this);
6234 if(flags & 1)
6235 MSVCRT_operator_delete(this);
6238 return this;
6241 /* ?_Getcat@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
6242 /* ?_Getcat@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
6243 MSVCP_size_t __cdecl num_get_char__Getcat(const locale_facet **facet, const locale *loc)
6245 TRACE("(%p %p)\n", facet, loc);
6247 if(facet && !*facet) {
6248 _Locinfo locinfo;
6250 *facet = MSVCRT_operator_new(sizeof(num_get));
6251 if(!*facet) {
6252 ERR("Out of memory\n");
6253 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
6254 return 0;
6257 _Locinfo_ctor_cstr(&locinfo, locale_string_char_c_str(&loc->ptr->name));
6258 num_get_char_ctor_locinfo((num_get*)*facet, &locinfo, 0);
6259 _Locinfo_dtor(&locinfo);
6262 return LC_NUMERIC;
6265 /* ?_Getcat@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SAIPAPBVfacet@locale@2@@Z */
6266 /* ?_Getcat@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@@Z */
6267 MSVCP_size_t __cdecl num_get_char__Getcat_old(const locale_facet **facet)
6269 return num_get_char__Getcat(facet, locale_classic());
6272 num_get* num_get_char_use_facet(const locale *loc)
6274 static num_get *obj = NULL;
6276 _Lockit lock;
6277 const locale_facet *fac;
6279 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
6280 fac = locale__Getfacet(loc, locale_id_operator_size_t(&num_get_char_id));
6281 if(fac) {
6282 _Lockit_dtor(&lock);
6283 return (num_get*)fac;
6286 if(obj) {
6287 _Lockit_dtor(&lock);
6288 return obj;
6291 num_get_char__Getcat(&fac, loc);
6292 obj = (num_get*)fac;
6293 call_locale_facet__Incref(&obj->facet);
6294 locale_facet_register(&obj->facet);
6295 _Lockit_dtor(&lock);
6297 return obj;
6300 /* ?_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 */
6301 /* ?_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 */
6302 /* Copies number to dest buffer, validates grouping and skips separators.
6303 * Updates first so it points past the number, all digits are skipped.
6304 * Returns how exponent needs to changed.
6305 * Size of dest buffer is not specified, assuming it's not smaller than 32:
6306 * strlen(+0.e+) + 22(digits) + 4(expontent) + 1(nullbyte)
6308 int __cdecl num_get_char__Getffld(const num_get *this, char *dest, istreambuf_iterator_char *first,
6309 istreambuf_iterator_char *last, const locale *loc)
6311 numpunct_char *numpunct = numpunct_char_use_facet(loc);
6312 basic_string_char grouping_bstr;
6313 basic_string_char groups_found;
6314 int groups_no = 0, cur_group = 0, exp = 0;
6315 char *dest_beg = dest, *num_end = dest+25, *exp_end = dest+31, sep = 0;
6316 const char *grouping, *groups;
6317 BOOL error = FALSE, got_digit = FALSE, got_nonzero = FALSE;
6319 TRACE("(%p %p %p %p)\n", dest, first, last, loc);
6321 numpunct_char_grouping(numpunct, &grouping_bstr);
6322 grouping = MSVCP_basic_string_char_c_str(&grouping_bstr);
6323 #if _MSVCP_VER >= 70
6324 if (grouping[0]) sep = numpunct_char_thousands_sep(numpunct);
6325 #endif
6327 if(sep)
6328 MSVCP_basic_string_char_ctor(&groups_found);
6330 istreambuf_iterator_char_val(first);
6331 /* get sign */
6332 if(first->strbuf && (first->val=='-' || first->val=='+')) {
6333 *dest++ = first->val;
6334 istreambuf_iterator_char_inc(first);
6337 /* read possibly grouped numbers before decimal */
6338 for(; first->strbuf; istreambuf_iterator_char_inc(first)) {
6339 if(first->val<'0' || first->val>'9') {
6340 if(sep && first->val==sep) {
6341 if(!groups_no) break; /* empty group - stop parsing */
6342 MSVCP_basic_string_char_append_ch(&groups_found, groups_no);
6343 groups_no = 0;
6344 ++cur_group;
6345 }else {
6346 break;
6348 }else {
6349 got_digit = TRUE; /* found a digit, zero or non-zero */
6350 /* write digit to dest if not a leading zero (to not waste dest buffer) */
6351 if(!got_nonzero && first->val == '0')
6353 ++groups_no;
6354 continue;
6356 got_nonzero = TRUE;
6357 if(dest < num_end)
6358 *dest++ = first->val;
6359 else
6360 exp++; /* too many digits, just multiply by 10 */
6361 if(sep && groups_no<CHAR_MAX)
6362 ++groups_no;
6366 /* if all leading zeroes, we didn't write anything so put a zero we check for a decimal */
6367 if(got_digit && !got_nonzero)
6368 *dest++ = '0';
6370 /* get decimal, if any */
6371 if(first->strbuf && first->val==numpunct_char_decimal_point(numpunct)) {
6372 if(dest < num_end)
6373 *dest++ = *localeconv()->decimal_point;
6374 istreambuf_iterator_char_inc(first);
6377 /* read non-grouped after decimal */
6378 for(; first->strbuf; istreambuf_iterator_char_inc(first)) {
6379 if(first->val<'0' || first->val>'9')
6380 break;
6381 else if(dest<num_end) {
6382 got_digit = TRUE;
6383 *dest++ = first->val;
6387 /* read exponent, if any */
6388 if(first->strbuf && (first->val=='e' || first->val=='E')) {
6389 *dest++ = first->val;
6390 istreambuf_iterator_char_inc(first);
6392 if(first->strbuf && (first->val=='-' || first->val=='+')) {
6393 *dest++ = first->val;
6394 istreambuf_iterator_char_inc(first);
6397 got_digit = got_nonzero = FALSE;
6398 error = TRUE;
6399 /* skip any leading zeroes */
6400 for(; first->strbuf && first->val=='0'; istreambuf_iterator_char_inc(first))
6401 got_digit = TRUE;
6403 for(; first->strbuf && first->val>='0' && first->val<='9'; istreambuf_iterator_char_inc(first)) {
6404 got_digit = got_nonzero = TRUE; /* leading zeroes would have been skipped, so first digit is non-zero */
6405 error = FALSE;
6406 if(dest<exp_end)
6407 *dest++ = first->val;
6410 /* if just found zeroes for exponent, use that */
6411 if(got_digit && !got_nonzero)
6413 error = FALSE;
6414 if(dest<exp_end)
6415 *dest++ = '0';
6419 if(sep && groups_no)
6420 MSVCP_basic_string_char_append_ch(&groups_found, groups_no);
6422 if(!cur_group) /* no groups, skip loop */
6423 cur_group--;
6424 else if(!(groups = MSVCP_basic_string_char_c_str(&groups_found))[cur_group])
6425 error = TRUE; /* trailing empty */
6427 for(; cur_group>=0 && !error; cur_group--) {
6428 if(*grouping == CHAR_MAX) {
6429 if(cur_group)
6430 error = TRUE;
6431 break;
6432 }else if((cur_group && *grouping!=groups[cur_group])
6433 || (!cur_group && *grouping<groups[cur_group])) {
6434 error = TRUE;
6435 break;
6436 }else if(grouping[1]) {
6437 grouping++;
6440 MSVCP_basic_string_char_dtor(&grouping_bstr);
6441 if(sep)
6442 MSVCP_basic_string_char_dtor(&groups_found);
6444 if(error) {
6445 *dest_beg = '\0';
6446 return 0;
6448 *dest++ = '\0';
6449 return exp;
6452 /* ?_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 */
6453 /* ?_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 */
6454 int __cdecl num_get_char__Getffldx(const num_get *this, char *dest, istreambuf_iterator_char *first,
6455 istreambuf_iterator_char *last, ios_base *ios, int *phexexp)
6457 FIXME("(%p %p %p %p %p) stub\n", dest, first, last, ios, phexexp);
6458 return -1;
6461 /* ?_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 */
6462 /* ?_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 */
6463 /* Copies number to dest buffer, validates grouping and skips separators.
6464 * Updates first so it points past the number, all digits are skipped.
6465 * Returns number base (8, 10 or 16).
6466 * Size of dest buffer is not specified, assuming it's not smaller than 25:
6467 * 22(8^22>2^64)+1(detect overflows)+1(sign)+1(nullbyte) = 25
6469 int __cdecl num_get_char__Getifld(const num_get *this, char *dest, istreambuf_iterator_char *first,
6470 istreambuf_iterator_char *last, int fmtflags, const locale *loc)
6472 static const char digits[] = "0123456789abcdefABCDEF";
6474 numpunct_char *numpunct = numpunct_char_use_facet(loc);
6475 basic_string_char grouping_bstr;
6476 basic_string_char groups_found;
6477 int basefield, base, groups_no = 0, cur_group = 0;
6478 char *dest_beg = dest, *dest_end = dest+24, sep = 0;
6479 const char *grouping, *groups;
6480 BOOL error = TRUE, dest_empty = TRUE, found_zero = FALSE;
6482 TRACE("(%p %p %p %04x %p)\n", dest, first, last, fmtflags, loc);
6484 numpunct_char_grouping(numpunct, &grouping_bstr);
6485 grouping = MSVCP_basic_string_char_c_str(&grouping_bstr);
6486 #if _MSVCP_VER >= 70
6487 if (grouping[0]) sep = numpunct_char_thousands_sep(numpunct);
6488 #endif
6490 basefield = fmtflags & FMTFLAG_basefield;
6491 if(basefield == FMTFLAG_oct)
6492 base = 8;
6493 else if(basefield == FMTFLAG_hex)
6494 base = 22; /* equal to the size of digits buffer */
6495 else if(!basefield)
6496 base = 0;
6497 else
6498 base = 10;
6500 istreambuf_iterator_char_val(first);
6501 if(first->strbuf && (first->val=='-' || first->val=='+')) {
6502 *dest++ = first->val;
6503 istreambuf_iterator_char_inc(first);
6506 if(first->strbuf && first->val=='0') {
6507 found_zero = TRUE;
6508 istreambuf_iterator_char_inc(first);
6509 if(first->strbuf && (first->val=='x' || first->val=='X')) {
6510 if(!base || base == 22) {
6511 found_zero = FALSE;
6512 istreambuf_iterator_char_inc(first);
6513 base = 22;
6514 }else {
6515 base = 10;
6517 }else {
6518 error = FALSE;
6519 if(!base) base = 8;
6521 }else {
6522 if (!base) base = 10;
6525 if(sep)
6527 MSVCP_basic_string_char_ctor(&groups_found);
6528 if(found_zero) ++groups_no;
6531 for(; first->strbuf; istreambuf_iterator_char_inc(first)) {
6532 if(!memchr(digits, first->val, base)) {
6533 if(sep && first->val==sep) {
6534 if(!groups_no) break; /* empty group - stop parsing */
6535 MSVCP_basic_string_char_append_ch(&groups_found, groups_no);
6536 groups_no = 0;
6537 ++cur_group;
6538 }else {
6539 break;
6541 }else {
6542 error = FALSE;
6543 if(dest_empty && first->val == '0')
6545 found_zero = TRUE;
6546 ++groups_no;
6547 continue;
6549 dest_empty = FALSE;
6550 /* skip digits that can't be copied to dest buffer, other
6551 * functions are responsible for detecting overflows */
6552 if(dest < dest_end)
6553 *dest++ = first->val;
6554 if(sep && groups_no<CHAR_MAX)
6555 ++groups_no;
6559 if(sep && groups_no)
6560 MSVCP_basic_string_char_append_ch(&groups_found, groups_no);
6562 if(!cur_group) { /* no groups, skip loop */
6563 cur_group--;
6564 }else if(!(groups = MSVCP_basic_string_char_c_str(&groups_found))[cur_group]) {
6565 error = TRUE; /* trailing empty */
6566 found_zero = FALSE;
6569 for(; cur_group>=0 && !error; cur_group--) {
6570 if(*grouping == CHAR_MAX) {
6571 if(cur_group)
6572 error = TRUE;
6573 break;
6574 }else if((cur_group && *grouping!=groups[cur_group])
6575 || (!cur_group && *grouping<groups[cur_group])) {
6576 error = TRUE;
6577 break;
6578 }else if(grouping[1]) {
6579 grouping++;
6583 MSVCP_basic_string_char_dtor(&grouping_bstr);
6584 if(sep)
6585 MSVCP_basic_string_char_dtor(&groups_found);
6587 if(error) {
6588 if (found_zero)
6589 *dest++ = '0';
6590 else
6591 dest = dest_beg;
6592 }else if(dest_empty)
6593 *dest++ = '0';
6594 *dest = '\0';
6596 return (base==22 ? 16 : base);
6599 /* ?_Hexdig@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@ABEHD000@Z */
6600 /* ?_Hexdig@?$num_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@AEBAHD000@Z */
6601 DEFINE_THISCALL_WRAPPER(MSVCP_num_get_char__Hexdig, 20)
6602 int __thiscall MSVCP_num_get_char__Hexdig(num_get *this, char dig, char e0, char al, char au)
6604 FIXME("(%p %c %c %c %c) stub\n", this, dig, e0, al, au);
6605 return -1;
6608 /* ?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 */
6609 /* ?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 */
6610 #if _MSVCP_VER <= 100
6611 #define call_num_get_char_do_get_void(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 4, istreambuf_iterator_char*, \
6612 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, void**), \
6613 (this, ret, first, last, base, state, pval))
6614 #else
6615 #define call_num_get_char_do_get_void(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 12, istreambuf_iterator_char*, \
6616 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, void**), \
6617 (this, ret, first, last, base, state, pval))
6618 #endif
6619 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_void,36)
6620 istreambuf_iterator_char *__thiscall num_get_char_do_get_void(const num_get *this, istreambuf_iterator_char *ret,
6621 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, void **pval)
6623 unsigned __int64 v;
6624 char tmp[25], *end;
6625 int err;
6627 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6629 v = _Stoullx(tmp, &end, num_get_char__Getifld(this, tmp,
6630 &first, &last, FMTFLAG_hex, IOS_LOCALE(base)), &err);
6631 if(v!=(unsigned __int64)((INT_PTR)v))
6632 *state |= IOSTATE_failbit;
6633 else if(end!=tmp && !err)
6634 *pval = (void*)((INT_PTR)v);
6635 else
6636 *state |= IOSTATE_failbit;
6638 if(!first.strbuf)
6639 *state |= IOSTATE_eofbit;
6641 *ret = first;
6642 return ret;
6645 /* ?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 */
6646 /* ?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 */
6647 DEFINE_THISCALL_WRAPPER(num_get_char_get_void,36)
6648 istreambuf_iterator_char *__thiscall num_get_char_get_void(const num_get *this, istreambuf_iterator_char *ret,
6649 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, void **pval)
6651 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6652 return call_num_get_char_do_get_void(this, ret, first, last, base, state, pval);
6655 /* ?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 */
6656 /* ?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 */
6657 /* ?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 */
6658 /* ?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 */
6659 #if _MSVCP_VER <= 100
6660 #define call_num_get_char_do_get_ldouble(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 8, istreambuf_iterator_char*, \
6661 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, double*), \
6662 (this, ret, first, last, base, state, pval))
6663 #define call_num_get_char_do_get_double(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 12, istreambuf_iterator_char*, \
6664 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, double*), \
6665 (this, ret, first, last, base, state, pval))
6666 #else
6667 #define call_num_get_char_do_get_ldouble(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 16, istreambuf_iterator_char*, \
6668 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, double*), \
6669 (this, ret, first, last, base, state, pval))
6670 #define call_num_get_char_do_get_double(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 20, istreambuf_iterator_char*, \
6671 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, double*), \
6672 (this, ret, first, last, base, state, pval))
6673 #endif
6674 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_double,36)
6675 istreambuf_iterator_char *__thiscall num_get_char_do_get_double(const num_get *this, istreambuf_iterator_char *ret,
6676 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, double *pval)
6678 double v;
6679 char tmp[32], *end;
6680 int err;
6682 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6684 v = _Stodx(tmp, &end, num_get_char__Getffld(this, tmp, &first, &last, IOS_LOCALE(base)), &err);
6685 if(end!=tmp && !err)
6686 *pval = v;
6687 else
6688 *state |= IOSTATE_failbit;
6690 if(!first.strbuf)
6691 *state |= IOSTATE_eofbit;
6693 *ret = first;
6694 return ret;
6697 /* ?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 */
6698 /* ?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 */
6699 DEFINE_THISCALL_WRAPPER(num_get_char_get_ldouble,36)
6700 istreambuf_iterator_char *__thiscall num_get_char_get_ldouble(const num_get *this, istreambuf_iterator_char *ret,
6701 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, double *pval)
6703 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6704 return call_num_get_char_do_get_ldouble(this, ret, first, last, base, state, pval);
6707 /* ?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 */
6708 /* ?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 */
6709 DEFINE_THISCALL_WRAPPER(num_get_char_get_double,36)
6710 istreambuf_iterator_char *__thiscall num_get_char_get_double(const num_get *this, istreambuf_iterator_char *ret,
6711 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, double *pval)
6713 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6714 return call_num_get_char_do_get_double(this, ret, first, last, base, state, pval);
6717 /* ?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 */
6718 /* ?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 */
6719 #if _MSVCP_VER <= 100
6720 #define call_num_get_char_do_get_float(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 16, istreambuf_iterator_char*, \
6721 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, float*), \
6722 (this, ret, first, last, base, state, pval))
6723 #else
6724 #define call_num_get_char_do_get_float(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 24, istreambuf_iterator_char*, \
6725 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, float*), \
6726 (this, ret, first, last, base, state, pval))
6727 #endif
6728 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_float,36)
6729 istreambuf_iterator_char *__thiscall num_get_char_do_get_float(const num_get *this, istreambuf_iterator_char *ret,
6730 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, float *pval)
6732 float v;
6733 char tmp[32], *end;
6734 int err;
6736 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6738 v = _Stofx(tmp, &end, num_get_char__Getffld(this, tmp, &first, &last, IOS_LOCALE(base)), &err);
6739 if(end!=tmp && !err)
6740 *pval = v;
6741 else
6742 *state |= IOSTATE_failbit;
6744 if(!first.strbuf)
6745 *state |= IOSTATE_eofbit;
6747 *ret = first;
6748 return ret;
6751 /* ?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 */
6752 /* ?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 */
6753 DEFINE_THISCALL_WRAPPER(num_get_char_get_float,36)
6754 istreambuf_iterator_char *__thiscall num_get_char_get_float(const num_get *this, istreambuf_iterator_char *ret,
6755 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, float *pval)
6757 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6758 return call_num_get_char_do_get_float(this, ret, first, last, base, state, pval);
6761 /* ?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 */
6762 /* ?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 */
6763 #if _MSVCP_VER <= 100
6764 #define call_num_get_char_do_get_uint64(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 20, istreambuf_iterator_char*, \
6765 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, ULONGLONG*), \
6766 (this, ret, first, last, base, state, pval))
6767 #else
6768 #define call_num_get_char_do_get_uint64(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 28, istreambuf_iterator_char*, \
6769 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, ULONGLONG*), \
6770 (this, ret, first, last, base, state, pval))
6771 #endif
6772 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_uint64,36)
6773 istreambuf_iterator_char *__thiscall num_get_char_do_get_uint64(const num_get *this, istreambuf_iterator_char *ret,
6774 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, ULONGLONG *pval)
6776 unsigned __int64 v;
6777 char tmp[25], *end;
6778 int err;
6780 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6782 v = _Stoullx(tmp, &end, num_get_char__Getifld(this, tmp,
6783 &first, &last, base->fmtfl, IOS_LOCALE(base)), &err);
6784 if(end!=tmp && !err)
6785 *pval = v;
6786 else
6787 *state |= IOSTATE_failbit;
6789 if(!first.strbuf)
6790 *state |= IOSTATE_eofbit;
6792 *ret = first;
6793 return ret;
6796 /* ?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 */
6797 /* ?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 */
6798 DEFINE_THISCALL_WRAPPER(num_get_char_get_uint64,36)
6799 istreambuf_iterator_char *__thiscall num_get_char_get_uint64(const num_get *this, istreambuf_iterator_char *ret,
6800 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, ULONGLONG *pval)
6802 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6803 return call_num_get_char_do_get_uint64(this, ret, first, last, base, state, pval);
6806 /* ?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 */
6807 /* ?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 */
6808 #if _MSVCP_VER <= 100
6809 #define call_num_get_char_do_get_int64(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 24, istreambuf_iterator_char*, \
6810 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, LONGLONG*), \
6811 (this, ret, first, last, base, state, pval))
6812 #else
6813 #define call_num_get_char_do_get_int64(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 32, istreambuf_iterator_char*, \
6814 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, LONGLONG*), \
6815 (this, ret, first, last, base, state, pval))
6816 #endif
6817 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_int64,36)
6818 istreambuf_iterator_char *__thiscall num_get_char_do_get_int64(const num_get *this, istreambuf_iterator_char *ret,
6819 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, LONGLONG *pval)
6821 __int64 v;
6822 char tmp[25], *end;
6823 int err;
6825 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6827 v = _Stollx(tmp, &end, num_get_char__Getifld(this, tmp,
6828 &first, &last, base->fmtfl, IOS_LOCALE(base)), &err);
6829 if(end!=tmp && !err)
6830 *pval = v;
6831 else
6832 *state |= IOSTATE_failbit;
6834 if(!first.strbuf)
6835 *state |= IOSTATE_eofbit;
6837 *ret = first;
6838 return ret;
6841 /* ?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 */
6842 /* ?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 */
6843 DEFINE_THISCALL_WRAPPER(num_get_char_get_int64,36)
6844 istreambuf_iterator_char *__thiscall num_get_char_get_int64(const num_get *this, istreambuf_iterator_char *ret,
6845 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, LONGLONG *pval)
6847 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6848 return call_num_get_char_do_get_int64(this, ret, first, last, base, state, pval);
6851 /* ?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 */
6852 /* ?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 */
6853 #if _MSVCP_VER <= 100
6854 #define call_num_get_char_do_get_ulong(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 28, istreambuf_iterator_char*, \
6855 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, ULONG*), \
6856 (this, ret, first, last, base, state, pval))
6857 #else
6858 #define call_num_get_char_do_get_ulong(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 36, istreambuf_iterator_char*, \
6859 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, ULONG*), \
6860 (this, ret, first, last, base, state, pval))
6861 #endif
6862 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_ulong,36)
6863 istreambuf_iterator_char *__thiscall num_get_char_do_get_ulong(const num_get *this, istreambuf_iterator_char *ret,
6864 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, ULONG *pval)
6866 ULONG v;
6867 char tmp[25], *end;
6868 int err;
6870 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6872 v = _Stoulx(tmp, &end, num_get_char__Getifld(this, tmp,
6873 &first, &last, base->fmtfl, IOS_LOCALE(base)), &err);
6874 if(end!=tmp && !err)
6875 *pval = v;
6876 else
6877 *state |= IOSTATE_failbit;
6879 if(!first.strbuf)
6880 *state |= IOSTATE_eofbit;
6882 *ret = first;
6883 return ret;
6886 /* ?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 */
6887 /* ?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 */
6888 DEFINE_THISCALL_WRAPPER(num_get_char_get_ulong,36)
6889 istreambuf_iterator_char *__thiscall num_get_char_get_ulong(const num_get *this, istreambuf_iterator_char *ret,
6890 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, ULONG *pval)
6892 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6893 return call_num_get_char_do_get_ulong(this, ret, first, last, base, state, pval);
6896 /* ?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 */
6897 /* ?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 */
6898 #if _MSVCP_VER <= 100
6899 #define call_num_get_char_do_get_long(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 32, istreambuf_iterator_char*, \
6900 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, LONG*), \
6901 (this, ret, first, last, base, state, pval))
6902 #else
6903 #define call_num_get_char_do_get_long(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 40, istreambuf_iterator_char*, \
6904 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, LONG*), \
6905 (this, ret, first, last, base, state, pval))
6906 #endif
6907 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_long,36)
6908 istreambuf_iterator_char *__thiscall num_get_char_do_get_long(const num_get *this, istreambuf_iterator_char *ret,
6909 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, LONG *pval)
6911 LONG v;
6912 char tmp[25], *end;
6913 int err;
6915 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6917 v = _Stolx(tmp, &end, num_get_char__Getifld(this, tmp,
6918 &first, &last, base->fmtfl, IOS_LOCALE(base)), &err);
6919 if(end!=tmp && !err)
6920 *pval = v;
6921 else
6922 *state |= IOSTATE_failbit;
6924 if(!first.strbuf)
6925 *state |= IOSTATE_eofbit;
6927 *ret = first;
6928 return ret;
6931 /* ?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 */
6932 /* ?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 */
6933 DEFINE_THISCALL_WRAPPER(num_get_char_get_long,36)
6934 istreambuf_iterator_char *__thiscall num_get_char_get_long(const num_get *this, istreambuf_iterator_char *ret,
6935 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, LONG *pval)
6937 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6938 return call_num_get_char_do_get_long(this, ret, first, last, base, state, pval);
6941 /* ?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 */
6942 /* ?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 */
6943 #if _MSVCP_VER <= 100
6944 #define call_num_get_char_do_get_uint(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 36, istreambuf_iterator_char*, \
6945 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, unsigned int*), \
6946 (this, ret, first, last, base, state, pval))
6947 #else
6948 #define call_num_get_char_do_get_uint(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 44, istreambuf_iterator_char*, \
6949 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, unsigned int*), \
6950 (this, ret, first, last, base, state, pval))
6951 #endif
6952 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_uint,36)
6953 istreambuf_iterator_char *__thiscall num_get_char_do_get_uint(const num_get *this, istreambuf_iterator_char *ret,
6954 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, unsigned int *pval)
6956 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6957 return num_get_char_do_get_ulong(this, ret, first, last, base, state, pval);
6960 /* ?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 */
6961 /* ?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 */
6962 DEFINE_THISCALL_WRAPPER(num_get_char_get_uint,36)
6963 istreambuf_iterator_char *__thiscall num_get_char_get_uint(const num_get *this, istreambuf_iterator_char *ret,
6964 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, unsigned int *pval)
6966 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6967 return call_num_get_char_do_get_uint(this, ret, first, last, base, state, pval);
6970 /* ?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 */
6971 /* ?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 */
6972 #if _MSVCP_VER <= 100
6973 #define call_num_get_char_do_get_ushort(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 40, istreambuf_iterator_char*, \
6974 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, unsigned short*), \
6975 (this, ret, first, last, base, state, pval))
6976 #else
6977 #define call_num_get_char_do_get_ushort(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 48, istreambuf_iterator_char*, \
6978 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, unsigned short*), \
6979 (this, ret, first, last, base, state, pval))
6980 #endif
6981 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_ushort,36)
6982 istreambuf_iterator_char *__thiscall num_get_char_do_get_ushort(const num_get *this, istreambuf_iterator_char *ret,
6983 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, unsigned short *pval)
6985 ULONG v;
6986 char tmp[25], *beg, *end;
6987 int err, b;
6989 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
6991 b = num_get_char__Getifld(this, tmp,
6992 &first, &last, base->fmtfl, IOS_LOCALE(base));
6993 beg = tmp + (tmp[0]=='-' ? 1 : 0);
6994 v = _Stoulx(beg, &end, b, &err);
6996 if(v != (ULONG)((unsigned short)v))
6997 *state |= IOSTATE_failbit;
6998 else if(end!=beg && !err)
6999 *pval = (tmp[0]=='-' ? -((unsigned short)v) : v);
7000 else
7001 *state |= IOSTATE_failbit;
7003 if(!first.strbuf)
7004 *state |= IOSTATE_eofbit;
7006 *ret = first;
7007 return ret;
7010 /* ?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 */
7011 /* ?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 */
7012 DEFINE_THISCALL_WRAPPER(num_get_char_get_ushort,36)
7013 istreambuf_iterator_char *__thiscall num_get_char_get_ushort(const num_get *this, istreambuf_iterator_char *ret,
7014 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, unsigned short *pval)
7016 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
7017 return call_num_get_char_do_get_ushort(this, ret, first, last, base, state, pval);
7020 /* ?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 */
7021 /* ?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 */
7022 #if _MSVCP_VER <= 100
7023 #define call_num_get_char_do_get_bool(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 44, istreambuf_iterator_char*, \
7024 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, MSVCP_bool*), \
7025 (this, ret, first, last, base, state, pval))
7026 #else
7027 #define call_num_get_char_do_get_bool(this, ret, first, last, base, state, pval) CALL_VTBL_FUNC(this, 52, istreambuf_iterator_char*, \
7028 (const num_get*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, MSVCP_bool*), \
7029 (this, ret, first, last, base, state, pval))
7030 #endif
7031 DEFINE_THISCALL_WRAPPER(num_get_char_do_get_bool,36)
7032 istreambuf_iterator_char *__thiscall num_get_char_do_get_bool(const num_get *this, istreambuf_iterator_char *ret,
7033 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, MSVCP_bool *pval)
7035 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
7037 if(base->fmtfl & FMTFLAG_boolalpha) {
7038 numpunct_char *numpunct = numpunct_char_use_facet(IOS_LOCALE(base));
7039 basic_string_char false_bstr, true_bstr;
7040 const char *pfalse, *ptrue;
7042 numpunct_char_falsename(numpunct, &false_bstr);
7043 numpunct_char_truename(numpunct, &true_bstr);
7044 pfalse = MSVCP_basic_string_char_c_str(&false_bstr);
7045 ptrue = MSVCP_basic_string_char_c_str(&true_bstr);
7047 for(istreambuf_iterator_char_val(&first); first.strbuf;) {
7048 if(pfalse && *pfalse && first.val!=*pfalse)
7049 pfalse = NULL;
7050 if(ptrue && *ptrue && first.val!=*ptrue)
7051 ptrue = NULL;
7053 if(pfalse && *pfalse && ptrue && !*ptrue)
7054 ptrue = NULL;
7055 if(ptrue && *ptrue && pfalse && !*pfalse)
7056 pfalse = NULL;
7058 if(pfalse)
7059 pfalse++;
7060 if(ptrue)
7061 ptrue++;
7063 if(pfalse || ptrue)
7064 istreambuf_iterator_char_inc(&first);
7066 if((!pfalse || !*pfalse) && (!ptrue || !*ptrue))
7067 break;
7070 if(ptrue)
7071 *pval = TRUE;
7072 else if(pfalse)
7073 *pval = FALSE;
7074 else
7075 *state |= IOSTATE_failbit;
7077 MSVCP_basic_string_char_dtor(&false_bstr);
7078 MSVCP_basic_string_char_dtor(&true_bstr);
7079 }else {
7080 char tmp[25], *end;
7081 int err;
7082 LONG v = _Stolx(tmp, &end, num_get_char__Getifld(this, tmp,
7083 &first, &last, base->fmtfl, IOS_LOCALE(base)), &err);
7085 if(end!=tmp && err==0 && (v==0 || v==1))
7086 *pval = v;
7087 else
7088 *state |= IOSTATE_failbit;
7091 if(!first.strbuf)
7092 *state |= IOSTATE_eofbit;
7093 memcpy(ret, &first, sizeof(first));
7094 return ret;
7097 /* ?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 */
7098 /* ?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 */
7099 DEFINE_THISCALL_WRAPPER(num_get_char_get_bool,36)
7100 istreambuf_iterator_char *__thiscall num_get_char_get_bool(const num_get *this, istreambuf_iterator_char *ret,
7101 istreambuf_iterator_char first, istreambuf_iterator_char last, ios_base *base, int *state, MSVCP_bool *pval)
7103 TRACE("(%p %p %p %p %p)\n", this, ret, base, state, pval);
7104 return call_num_get_char_do_get_bool(this, ret, first, last, base, state, pval);
7107 /* ?id@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@2V0locale@2@A */
7108 locale_id num_put_char_id = {0};
7110 /* num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@6B@ */
7111 extern const vtable_ptr MSVCP_num_put_char_vtable;
7113 /* ?_Init@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@IAEXABV_Locinfo@2@@Z */
7114 /* ?_Init@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@IEAAXAEBV_Locinfo@2@@Z */
7115 DEFINE_THISCALL_WRAPPER(num_put_char__Init, 8)
7116 void __thiscall num_put_char__Init(num_put *this, const _Locinfo *locinfo)
7118 TRACE("(%p %p)\n", this, locinfo);
7119 _Locinfo__Getcvt(locinfo, &this->cvt);
7122 /* ??0?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
7123 /* ??0?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
7124 DEFINE_THISCALL_WRAPPER(num_put_char_ctor_locinfo, 12)
7125 num_put* __thiscall num_put_char_ctor_locinfo(num_put *this, const _Locinfo *locinfo, MSVCP_size_t refs)
7127 TRACE("(%p %p %ld)\n", this, locinfo, refs);
7129 locale_facet_ctor_refs(&this->facet, refs);
7130 this->facet.vtable = &MSVCP_num_put_char_vtable;
7132 num_put_char__Init(this, locinfo);
7133 return this;
7136 /* ??0?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAE@I@Z */
7137 /* ??0?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAA@_K@Z */
7138 DEFINE_THISCALL_WRAPPER(num_put_char_ctor_refs, 8)
7139 num_put* __thiscall num_put_char_ctor_refs(num_put *this, MSVCP_size_t refs)
7141 _Locinfo locinfo;
7143 TRACE("(%p %lu)\n", this, refs);
7145 _Locinfo_ctor(&locinfo);
7146 num_put_char_ctor_locinfo(this, &locinfo, refs);
7147 _Locinfo_dtor(&locinfo);
7148 return this;
7151 /* ??_F?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAEXXZ */
7152 /* ??_F?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAAXXZ */
7153 DEFINE_THISCALL_WRAPPER(num_put_char_ctor, 4)
7154 num_put* __thiscall num_put_char_ctor(num_put *this)
7156 return num_put_char_ctor_refs(this, 0);
7159 /* ??1?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@UAE@XZ */
7160 /* ??1?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@UEAA@XZ */
7161 /* ??1?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MAE@XZ */
7162 /* ??1?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MEAA@XZ */
7163 DEFINE_THISCALL_WRAPPER(num_put_char_dtor, 4)
7164 void __thiscall num_put_char_dtor(num_put *this)
7166 TRACE("(%p)\n", this);
7167 locale_facet_dtor(&this->facet);
7170 DEFINE_THISCALL_WRAPPER(num_put_char_vector_dtor, 8)
7171 num_put* __thiscall num_put_char_vector_dtor(num_put *this, unsigned int flags)
7173 TRACE("(%p %x)\n", this, flags);
7174 if(flags & 2) {
7175 /* we have an array, with the number of elements stored before the first object */
7176 INT_PTR i, *ptr = (INT_PTR *)this-1;
7178 for(i=*ptr-1; i>=0; i--)
7179 num_put_char_dtor(this+i);
7180 MSVCRT_operator_delete(ptr);
7181 } else {
7182 num_put_char_dtor(this);
7183 if(flags & 1)
7184 MSVCRT_operator_delete(this);
7187 return this;
7190 /* ?_Getcat@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
7191 /* ?_Getcat@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
7192 MSVCP_size_t __cdecl num_put_char__Getcat(const locale_facet **facet, const locale *loc)
7194 TRACE("(%p %p)\n", facet, loc);
7196 if(facet && !*facet) {
7197 _Locinfo locinfo;
7199 *facet = MSVCRT_operator_new(sizeof(num_put));
7200 if(!*facet) {
7201 ERR("Out of memory\n");
7202 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7203 return 0;
7206 _Locinfo_ctor_cstr(&locinfo, locale_string_char_c_str(&loc->ptr->name));
7207 num_put_char_ctor_locinfo((num_put*)*facet, &locinfo, 0);
7208 _Locinfo_dtor(&locinfo);
7211 return LC_NUMERIC;
7214 /* ?_Getcat@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SAIPAPBVfacet@locale@2@@Z */
7215 /* ?_Getcat@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@@Z */
7216 MSVCP_size_t __cdecl num_put_char__Getcat_old(const locale_facet **facet)
7218 return num_put_char__Getcat(facet, locale_classic());
7221 num_put* num_put_char_use_facet(const locale *loc)
7223 static num_put *obj = NULL;
7225 _Lockit lock;
7226 const locale_facet *fac;
7228 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
7229 fac = locale__Getfacet(loc, locale_id_operator_size_t(&num_put_char_id));
7230 if(fac) {
7231 _Lockit_dtor(&lock);
7232 return (num_put*)fac;
7235 if(obj) {
7236 _Lockit_dtor(&lock);
7237 return obj;
7240 num_put_char__Getcat(&fac, loc);
7241 obj = (num_put*)fac;
7242 call_locale_facet__Incref(&obj->facet);
7243 locale_facet_register(&obj->facet);
7244 _Lockit_dtor(&lock);
7246 return obj;
7249 /* ?_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 */
7250 /* ?_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 */
7251 ostreambuf_iterator_char* __cdecl num_put_char__Put(const num_put *this, ostreambuf_iterator_char *ret,
7252 ostreambuf_iterator_char dest, const char *ptr, MSVCP_size_t count)
7254 TRACE("(%p %p %p %ld)\n", this, ret, ptr, count);
7256 for(; count>0; count--)
7257 ostreambuf_iterator_char_put(&dest, *ptr++);
7259 *ret = dest;
7260 return ret;
7263 /* ?_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 */
7264 /* ?_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 */
7265 ostreambuf_iterator_char* __cdecl num_put_char__Putc(const num_put *this, ostreambuf_iterator_char *ret,
7266 ostreambuf_iterator_char dest, const char *ptr, MSVCP_size_t count)
7268 TRACE("(%p %p %p %ld)\n", this, ret, ptr, count);
7270 for(; count>0; count--)
7271 ostreambuf_iterator_char_put(&dest, *ptr++);
7273 *ret = dest;
7274 return ret;
7277 /* ?_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 */
7278 /* ?_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 */
7279 ostreambuf_iterator_char* __cdecl num_put_char__Putgrouped(const num_put *this, ostreambuf_iterator_char *ret,
7280 ostreambuf_iterator_char dest, const char *ptr, MSVCP_size_t count, char delim)
7282 FIXME("(%p %p %p %ld %d) stub\n", this, ret, ptr, count, delim);
7283 return NULL;
7286 /* ?_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 */
7287 /* ?_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 */
7288 ostreambuf_iterator_char* __cdecl num_put_char__Rep(const num_put *this, ostreambuf_iterator_char *ret,
7289 ostreambuf_iterator_char dest, char c, MSVCP_size_t count)
7291 TRACE("(%p %p %d %ld)\n", this, ret, c, count);
7293 for(; count>0; count--)
7294 ostreambuf_iterator_char_put(&dest, c);
7296 *ret = dest;
7297 return ret;
7300 /* ?_Ffmt@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@ABAPADPADDH@Z */
7301 /* ?_Ffmt@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@AEBAPEADPEADDH@Z */
7302 char* __cdecl num_put_char__Ffmt(const num_put *this, char *fmt, char spec, int fmtfl)
7304 int type = fmtfl & FMTFLAG_floatfield;
7305 char *p = fmt;
7307 TRACE("(%p %p %d %d)\n", this, fmt, spec, fmtfl);
7309 *p++ = '%';
7310 if(fmtfl & FMTFLAG_showpos)
7311 *p++ = '+';
7312 if(fmtfl & FMTFLAG_showpoint)
7313 *p++ = '#';
7314 *p++ = '.';
7315 *p++ = '*';
7316 if(spec)
7317 *p++ = spec;
7319 if(type == FMTFLAG_fixed)
7320 *p++ = 'f';
7321 else if(type == FMTFLAG_scientific)
7322 *p++ = (fmtfl & FMTFLAG_uppercase) ? 'E' : 'e';
7323 else if(type == (FMTFLAG_fixed|FMTFLAG_scientific))
7324 *p++ = (fmtfl & FMTFLAG_uppercase) ? 'A' : 'a';
7325 else
7326 *p++ = (fmtfl & FMTFLAG_uppercase) ? 'G' : 'g';
7328 *p++ = '\0';
7329 return fmt;
7332 /* ?_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 */
7333 /* ?_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 */
7334 ostreambuf_iterator_char* __cdecl num_put_char__Fput(const num_put *this, ostreambuf_iterator_char *ret,
7335 ostreambuf_iterator_char dest, ios_base *base, char fill, const char *buf, MSVCP_size_t bef_point,
7336 MSVCP_size_t aft_point, MSVCP_size_t trailing, MSVCP_size_t count)
7338 FIXME("(%p %p %p %d %p %ld %ld %ld %ld) stub\n", this, ret, base,
7339 fill, buf, bef_point, aft_point, trailing, count);
7340 return NULL;
7343 /* TODO: This function should be removed when num_put_char__Fput is implemented */
7344 static ostreambuf_iterator_char* num_put_char_fput(const num_put *this, ostreambuf_iterator_char *ret,
7345 ostreambuf_iterator_char dest, ios_base *base, char fill, char *buf, MSVCP_size_t count)
7347 numpunct_char *numpunct = numpunct_char_use_facet(IOS_LOCALE(base));
7348 basic_string_char grouping_bstr;
7349 const char *grouping;
7350 char *p, sep = 0, dec_point = *localeconv()->decimal_point;
7351 int cur_group = 0, group_size = 0;
7352 int adjustfield = base->fmtfl & FMTFLAG_adjustfield;
7353 MSVCP_size_t pad;
7355 TRACE("(%p %p %p %d %s %ld)\n", this, ret, base, fill, buf, count);
7357 /* Change decimal point */
7358 for(p=buf; p<buf+count; p++) {
7359 if(*p == dec_point) {
7360 *p = numpunct_char_decimal_point(numpunct);
7361 break;
7364 p--;
7366 /* Add separators to number */
7367 numpunct_char_grouping(numpunct, &grouping_bstr);
7368 grouping = MSVCP_basic_string_char_c_str(&grouping_bstr);
7369 #if _MSVCP_VER >= 70
7370 if (grouping[0]) sep = numpunct_char_thousands_sep(numpunct);
7371 #endif
7373 for(; p>buf && sep && grouping[cur_group]!=CHAR_MAX; p--) {
7374 group_size++;
7375 if(group_size == grouping[cur_group]) {
7376 group_size = 0;
7377 if(grouping[cur_group+1])
7378 cur_group++;
7380 memmove(p+1, p, buf+count-p);
7381 *p = sep;
7382 count++;
7385 MSVCP_basic_string_char_dtor(&grouping_bstr);
7387 /* Display number with padding */
7388 if(count >= base->wide)
7389 pad = 0;
7390 else
7391 pad = base->wide-count;
7392 base->wide = 0;
7394 if((adjustfield & FMTFLAG_internal) && (buf[0]=='-' || buf[0]=='+')) {
7395 num_put_char__Putc(this, &dest, dest, buf, 1);
7396 buf++;
7398 if(adjustfield != FMTFLAG_left) {
7399 num_put_char__Rep(this, ret, dest, fill, pad);
7400 pad = 0;
7402 num_put_char__Putc(this, &dest, dest, buf, count);
7403 return num_put_char__Rep(this, ret, dest, fill, pad);
7406 /* ?_Ifmt@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@ABAPADPADPBDH@Z */
7407 /* ?_Ifmt@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@AEBAPEADPEADPEBDH@Z */
7408 char* __cdecl num_put_char__Ifmt(const num_put *this, char *fmt, const char *spec, int fmtfl)
7410 int base = fmtfl & FMTFLAG_basefield;
7411 char *p = fmt;
7413 TRACE("(%p %p %p %d)\n", this, fmt, spec, fmtfl);
7415 *p++ = '%';
7416 if(fmtfl & FMTFLAG_showpos)
7417 *p++ = '+';
7418 if(fmtfl & FMTFLAG_showbase)
7419 *p++ = '#';
7421 *p++ = *spec++;
7422 if(*spec == 'l')
7423 *p++ = *spec++;
7425 if(base == FMTFLAG_oct)
7426 *p++ = 'o';
7427 else if(base == FMTFLAG_hex)
7428 *p++ = (fmtfl & FMTFLAG_uppercase) ? 'X' : 'x';
7429 else
7430 *p++ = *spec;
7432 *p++ = '\0';
7433 return fmt;
7436 /* ?_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 */
7437 /* ?_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 */
7438 ostreambuf_iterator_char* __cdecl num_put_char__Iput(const num_put *this, ostreambuf_iterator_char *ret,
7439 ostreambuf_iterator_char dest, ios_base *base, char fill, char *buf, MSVCP_size_t count)
7441 numpunct_char *numpunct = numpunct_char_use_facet(IOS_LOCALE(base));
7442 basic_string_char grouping_bstr;
7443 const char *grouping;
7444 char *p, sep = 0;
7445 int cur_group = 0, group_size = 0;
7446 int adjustfield = base->fmtfl & FMTFLAG_adjustfield;
7447 MSVCP_size_t pad;
7449 TRACE("(%p %p %p %d %s %ld)\n", this, ret, base, fill, buf, count);
7451 /* Add separators to number */
7452 numpunct_char_grouping(numpunct, &grouping_bstr);
7453 grouping = MSVCP_basic_string_char_c_str(&grouping_bstr);
7454 #if _MSVCP_VER >= 70
7455 if (grouping[0]) sep = numpunct_char_thousands_sep(numpunct);
7456 #endif
7458 for(p=buf+count-1; p>buf && sep && grouping[cur_group]!=CHAR_MAX; p--) {
7459 group_size++;
7460 if(group_size == grouping[cur_group]) {
7461 group_size = 0;
7462 if(grouping[cur_group+1])
7463 cur_group++;
7465 memmove(p+1, p, buf+count-p);
7466 *p = sep;
7467 count++;
7470 MSVCP_basic_string_char_dtor(&grouping_bstr);
7472 /* Display number with padding */
7473 if(count >= base->wide)
7474 pad = 0;
7475 else
7476 pad = base->wide-count;
7477 base->wide = 0;
7479 if((adjustfield & FMTFLAG_internal) && (buf[0]=='-' || buf[0]=='+')) {
7480 num_put_char__Putc(this, &dest, dest, buf, 1);
7481 buf++;
7482 }else if((adjustfield & FMTFLAG_internal) && (buf[1]=='x' || buf[1]=='X')) {
7483 num_put_char__Putc(this, &dest, dest, buf, 2);
7484 buf += 2;
7486 if(adjustfield != FMTFLAG_left) {
7487 num_put_char__Rep(this, ret, dest, fill, pad);
7488 pad = 0;
7490 num_put_char__Putc(this, &dest, dest, buf, count);
7491 return num_put_char__Rep(this, ret, dest, fill, pad);
7494 /* ?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 */
7495 /* ?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 */
7496 #if _MSVCP_VER <= 100
7497 #define call_num_put_char_do_put_long(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 28, ostreambuf_iterator_char*, \
7498 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, LONG), \
7499 (this, ret, dest, base, fill, v))
7500 #else
7501 #define call_num_put_char_do_put_long(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 36, ostreambuf_iterator_char*, \
7502 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, LONG), \
7503 (this, ret, dest, base, fill, v))
7504 #endif
7505 #if _MSVCP_VER != 80
7506 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_long, 28)
7507 #else
7508 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_long, 32)
7509 #endif
7510 ostreambuf_iterator_char* __thiscall num_put_char_do_put_long(const num_put *this, ostreambuf_iterator_char *ret,
7511 ostreambuf_iterator_char dest, ios_base *base, char fill, LONG v)
7513 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
7514 char fmt[7]; /* strlen("%+#lld")+1 */
7516 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
7518 return num_put_char__Iput(this, ret, dest, base, fill, tmp,
7519 sprintf(tmp, num_put_char__Ifmt(this, fmt, "ld", base->fmtfl), v));
7522 /* ?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 */
7523 /* ?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 */
7524 #if _MSVCP_VER != 80
7525 DEFINE_THISCALL_WRAPPER(num_put_char_put_long, 28)
7526 #else
7527 DEFINE_THISCALL_WRAPPER(num_put_char_put_long, 32)
7528 #endif
7529 ostreambuf_iterator_char* __thiscall num_put_char_put_long(const num_put *this, ostreambuf_iterator_char *ret,
7530 ostreambuf_iterator_char dest, ios_base *base, char fill, LONG v)
7532 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
7533 return call_num_put_char_do_put_long(this, ret, dest, base, fill, v);
7536 /* ?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 */
7537 /* ?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 */
7538 #if _MSVCP_VER <= 100
7539 #define call_num_put_char_do_put_ulong(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 24, ostreambuf_iterator_char*, \
7540 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, ULONG), \
7541 (this, ret, dest, base, fill, v))
7542 #else
7543 #define call_num_put_char_do_put_ulong(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 32, ostreambuf_iterator_char*, \
7544 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, ULONG), \
7545 (this, ret, dest, base, fill, v))
7546 #endif
7547 #if _MSVCP_VER != 80
7548 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_ulong, 28)
7549 #else
7550 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_ulong, 32)
7551 #endif
7552 ostreambuf_iterator_char* __thiscall num_put_char_do_put_ulong(const num_put *this, ostreambuf_iterator_char *ret,
7553 ostreambuf_iterator_char dest, ios_base *base, char fill, ULONG v)
7555 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
7556 char fmt[7]; /* strlen("%+#lld")+1 */
7558 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
7560 return num_put_char__Iput(this, ret, dest, base, fill, tmp,
7561 sprintf(tmp, num_put_char__Ifmt(this, fmt, "lu", base->fmtfl), v));
7564 /* ?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 */
7565 /* ?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 */
7566 #if _MSVCP_VER != 80
7567 DEFINE_THISCALL_WRAPPER(num_put_char_put_ulong, 28)
7568 #else
7569 DEFINE_THISCALL_WRAPPER(num_put_char_put_ulong, 32)
7570 #endif
7571 ostreambuf_iterator_char* __thiscall num_put_char_put_ulong(const num_put *this, ostreambuf_iterator_char *ret,
7572 ostreambuf_iterator_char dest, ios_base *base, char fill, ULONG v)
7574 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
7575 return call_num_put_char_do_put_ulong(this, ret, dest, base, fill, v);
7578 static inline unsigned get_precision(const ios_base *base)
7580 streamsize ret = base->prec <= 0 && !(base->fmtfl & FMTFLAG_fixed) ? 6 : base->prec;
7581 if(ret > UINT_MAX)
7582 ret = UINT_MAX;
7583 return ret;
7586 /* ?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 */
7587 /* ?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 */
7588 /* ?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 */
7589 /* ?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 */
7590 #if _MSVCP_VER <= 100
7591 #define call_num_put_char_do_put_double(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 12, ostreambuf_iterator_char*, \
7592 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, double), \
7593 (this, ret, dest, base, fill, v))
7594 #define call_num_put_char_do_put_ldouble(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 8, ostreambuf_iterator_char*, \
7595 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, double), \
7596 (this, ret, dest, base, fill, v))
7597 #else
7598 #define call_num_put_char_do_put_double(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 20, ostreambuf_iterator_char*, \
7599 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, double), \
7600 (this, ret, dest, base, fill, v))
7601 #define call_num_put_char_do_put_ldouble(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, double), \
7603 (this, ret, dest, base, fill, v))
7604 #endif
7605 #if _MSVCP_VER != 80
7606 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_double, 32)
7607 #else
7608 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_double, 36)
7609 #endif
7610 ostreambuf_iterator_char* __thiscall num_put_char_do_put_double(const num_put *this, ostreambuf_iterator_char *ret,
7611 ostreambuf_iterator_char dest, ios_base *base, char fill, double v)
7613 char *tmp;
7614 char fmt[8]; /* strlen("%+#.*lg")+1 */
7615 int size;
7616 unsigned prec;
7618 TRACE("(%p %p %p %d %lf)\n", this, ret, base, fill, v);
7620 num_put_char__Ffmt(this, fmt, '\0', base->fmtfl);
7621 prec = get_precision(base);
7622 size = _scprintf(fmt, prec, v);
7624 /* TODO: don't use dynamic allocation */
7625 tmp = MSVCRT_operator_new(size*2);
7626 if(!tmp) {
7627 ERR("Out of memory\n");
7628 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7630 num_put_char_fput(this, ret, dest, base, fill, tmp, sprintf(tmp, fmt, prec, v));
7631 MSVCRT_operator_delete(tmp);
7632 return ret;
7635 /* ?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 */
7636 /* ?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 */
7637 #if _MSVCP_VER != 80
7638 DEFINE_THISCALL_WRAPPER(num_put_char_put_double, 32)
7639 #else
7640 DEFINE_THISCALL_WRAPPER(num_put_char_put_double, 36)
7641 #endif
7642 ostreambuf_iterator_char* __thiscall num_put_char_put_double(const num_put *this, ostreambuf_iterator_char *ret,
7643 ostreambuf_iterator_char dest, ios_base *base, char fill, double v)
7645 TRACE("(%p %p %p %d %lf)\n", this, ret, base, fill, v);
7646 return call_num_put_char_do_put_double(this, ret, dest, base, fill, v);
7649 /* ?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 */
7650 /* ?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 */
7651 #if _MSVCP_VER != 80
7652 DEFINE_THISCALL_WRAPPER(num_put_char_put_ldouble, 32)
7653 #else
7654 DEFINE_THISCALL_WRAPPER(num_put_char_put_ldouble, 36)
7655 #endif
7656 ostreambuf_iterator_char* __thiscall num_put_char_put_ldouble(const num_put *this, ostreambuf_iterator_char *ret,
7657 ostreambuf_iterator_char dest, ios_base *base, char fill, double v)
7659 TRACE("(%p %p %p %d %lf)\n", this, ret, base, fill, v);
7660 return call_num_put_char_do_put_ldouble(this, ret, dest, base, fill, v);
7663 /* ?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 */
7664 /* ?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 */
7665 #if _MSVCP_VER <= 100
7666 #define call_num_put_char_do_put_ptr(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 4, ostreambuf_iterator_char*, \
7667 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, const void*), \
7668 (this, ret, dest, base, fill, v))
7669 #else
7670 #define call_num_put_char_do_put_ptr(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 12, ostreambuf_iterator_char*, \
7671 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, const void*), \
7672 (this, ret, dest, base, fill, v))
7673 #endif
7674 #if _MSVCP_VER != 80
7675 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_ptr, 28)
7676 #else
7677 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_ptr, 32)
7678 #endif
7679 ostreambuf_iterator_char* __thiscall num_put_char_do_put_ptr(const num_put *this, ostreambuf_iterator_char *ret,
7680 ostreambuf_iterator_char dest, ios_base *base, char fill, const void *v)
7682 char tmp[17]; /* 8(16^8==2^64)*2(separators beetwen every digit) + 1 */
7684 TRACE("(%p %p %p %d %p)\n", this, ret, base, fill, v);
7686 return num_put_char__Iput(this, ret, dest, base, fill, tmp, sprintf(tmp, "%p", v));
7689 /* ?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 */
7690 /* ?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 */
7691 #if _MSVCP_VER != 80
7692 DEFINE_THISCALL_WRAPPER(num_put_char_put_ptr, 28)
7693 #else
7694 DEFINE_THISCALL_WRAPPER(num_put_char_put_ptr, 32)
7695 #endif
7696 ostreambuf_iterator_char* __thiscall num_put_char_put_ptr(const num_put *this, ostreambuf_iterator_char *ret,
7697 ostreambuf_iterator_char dest, ios_base *base, char fill, const void *v)
7699 TRACE("(%p %p %p %d %p)\n", this, ret, base, fill, v);
7700 return call_num_put_char_do_put_ptr(this, ret, dest, base, fill, v);
7703 /* ?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 */
7704 /* ?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 */
7705 #if _MSVCP_VER <= 100
7706 #define call_num_put_char_do_put_int64(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 20, ostreambuf_iterator_char*, \
7707 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, __int64), \
7708 (this, ret, dest, base, fill, v))
7709 #else
7710 #define call_num_put_char_do_put_int64(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 28, ostreambuf_iterator_char*, \
7711 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, __int64), \
7712 (this, ret, dest, base, fill, v))
7713 #endif
7714 #if _MSVCP_VER != 80
7715 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_int64, 32)
7716 #else
7717 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_int64, 36)
7718 #endif
7719 ostreambuf_iterator_char* __thiscall num_put_char_do_put_int64(const num_put *this, ostreambuf_iterator_char *ret,
7720 ostreambuf_iterator_char dest, ios_base *base, char fill, __int64 v)
7722 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
7723 char fmt[7]; /* strlen("%+#lld")+1 */
7725 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
7727 return num_put_char__Iput(this, ret, dest, base, fill, tmp,
7728 sprintf(tmp, num_put_char__Ifmt(this, fmt, "lld", base->fmtfl), v));
7731 /* ?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 */
7732 /* ?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 */
7733 #if _MSVCP_VER != 80
7734 DEFINE_THISCALL_WRAPPER(num_put_char_put_int64, 32)
7735 #else
7736 DEFINE_THISCALL_WRAPPER(num_put_char_put_int64, 36)
7737 #endif
7738 ostreambuf_iterator_char* __thiscall num_put_char_put_int64(const num_put *this, ostreambuf_iterator_char *ret,
7739 ostreambuf_iterator_char dest, ios_base *base, char fill, __int64 v)
7741 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
7742 return call_num_put_char_do_put_int64(this, ret, dest, base, fill, v);
7745 /* ?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 */
7746 /* ?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 */
7747 #if _MSVCP_VER <= 100
7748 #define call_num_put_char_do_put_uint64(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 16, ostreambuf_iterator_char*, \
7749 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, unsigned __int64), \
7750 (this, ret, dest, base, fill, v))
7751 #else
7752 #define call_num_put_char_do_put_uint64(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 24, ostreambuf_iterator_char*, \
7753 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, unsigned __int64), \
7754 (this, ret, dest, base, fill, v))
7755 #endif
7756 #if _MSVCP_VER != 80
7757 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_uint64, 32)
7758 #else
7759 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_uint64, 36)
7760 #endif
7761 ostreambuf_iterator_char* __thiscall num_put_char_do_put_uint64(const num_put *this, ostreambuf_iterator_char *ret,
7762 ostreambuf_iterator_char dest, ios_base *base, char fill, unsigned __int64 v)
7764 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
7765 char fmt[7]; /* strlen("%+#lld")+1 */
7767 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
7769 return num_put_char__Iput(this, ret, dest, base, fill, tmp,
7770 sprintf(tmp, num_put_char__Ifmt(this, fmt, "llu", base->fmtfl), v));
7773 /* ?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 */
7774 /* ?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 */
7775 #if _MSVCP_VER != 80
7776 DEFINE_THISCALL_WRAPPER(num_put_char_put_uint64, 32)
7777 #else
7778 DEFINE_THISCALL_WRAPPER(num_put_char_put_uint64, 36)
7779 #endif
7780 ostreambuf_iterator_char* __thiscall num_put_char_put_uint64(const num_put *this, ostreambuf_iterator_char *ret,
7781 ostreambuf_iterator_char dest, ios_base *base, char fill, unsigned __int64 v)
7783 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
7784 return call_num_put_char_do_put_uint64(this, ret, dest, base, fill, v);
7787 /* ?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 */
7788 /* ?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 */
7789 #if _MSVCP_VER <= 100
7790 #define call_num_put_char_do_put_bool(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 32, ostreambuf_iterator_char*, \
7791 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, MSVCP_bool), \
7792 (this, ret, dest, base, fill, v))
7793 #else
7794 #define call_num_put_char_do_put_bool(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 40, ostreambuf_iterator_char*, \
7795 (const num_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, MSVCP_bool), \
7796 (this, ret, dest, base, fill, v))
7797 #endif
7798 #if _MSVCP_VER != 80
7799 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_bool, 28)
7800 #else
7801 DEFINE_THISCALL_WRAPPER(num_put_char_do_put_bool, 32)
7802 #endif
7803 ostreambuf_iterator_char* __thiscall num_put_char_do_put_bool(const num_put *this, ostreambuf_iterator_char *ret,
7804 ostreambuf_iterator_char dest, ios_base *base, char fill, MSVCP_bool v)
7806 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
7808 if(base->fmtfl & FMTFLAG_boolalpha) {
7809 numpunct_char *numpunct = numpunct_char_use_facet(IOS_LOCALE(base));
7810 basic_string_char str;
7811 MSVCP_size_t pad, len;
7813 if(v)
7814 numpunct_char_truename(numpunct, &str);
7815 else
7816 numpunct_char_falsename(numpunct, &str);
7818 len = MSVCP_basic_string_char_length(&str);
7819 pad = (len>base->wide ? 0 : base->wide-len);
7820 base->wide = 0;
7822 if((base->fmtfl & FMTFLAG_adjustfield) != FMTFLAG_left) {
7823 num_put_char__Rep(this, &dest, dest, fill, pad);
7824 pad = 0;
7826 num_put_char__Putc(this, &dest, dest, MSVCP_basic_string_char_c_str(&str), len);
7827 MSVCP_basic_string_char_dtor(&str);
7828 return num_put_char__Rep(this, ret, dest, fill, pad);
7831 return num_put_char_put_long(this, ret, dest, base, fill, v);
7834 /* ?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 */
7835 /* ?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 */
7836 #if _MSVCP_VER != 80
7837 DEFINE_THISCALL_WRAPPER(num_put_char_put_bool, 28)
7838 #else
7839 DEFINE_THISCALL_WRAPPER(num_put_char_put_bool, 32)
7840 #endif
7841 ostreambuf_iterator_char* __thiscall num_put_char_put_bool(const num_put *this, ostreambuf_iterator_char *ret,
7842 ostreambuf_iterator_char dest, ios_base *base, char fill, MSVCP_bool v)
7844 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
7845 return call_num_put_char_do_put_bool(this, ret, dest, base, fill, v);
7848 /* ?id@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@2V0locale@2@A */
7849 locale_id num_put_wchar_id = {0};
7850 /* ?id@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@2V0locale@2@A */
7851 locale_id num_put_short_id = {0};
7853 /* num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@6B@ */
7854 extern const vtable_ptr MSVCP_num_put_wchar_vtable;
7855 /* num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@6B@ */
7856 extern const vtable_ptr MSVCP_num_put_short_vtable;
7858 /* ?_Init@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@IAEXABV_Locinfo@2@@Z */
7859 /* ?_Init@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@IEAAXAEBV_Locinfo@2@@Z */
7860 DEFINE_THISCALL_WRAPPER(num_put_wchar__Init, 8)
7861 void __thiscall num_put_wchar__Init(num_put *this, const _Locinfo *locinfo)
7863 TRACE("(%p %p)\n", this, locinfo);
7864 _Locinfo__Getcvt(locinfo, &this->cvt);
7867 /* ??0?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
7868 /* ??0?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
7869 DEFINE_THISCALL_WRAPPER(num_put_wchar_ctor_locinfo, 12)
7870 num_put* __thiscall num_put_wchar_ctor_locinfo(num_put *this, const _Locinfo *locinfo, MSVCP_size_t refs)
7872 TRACE("(%p %p %ld)\n", this, locinfo, refs);
7874 locale_facet_ctor_refs(&this->facet, refs);
7875 this->facet.vtable = &MSVCP_num_put_wchar_vtable;
7877 num_put_wchar__Init(this, locinfo);
7878 return this;
7881 /* ??0?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
7882 /* ??0?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
7883 DEFINE_THISCALL_WRAPPER(num_put_short_ctor_locinfo, 12)
7884 num_put* __thiscall num_put_short_ctor_locinfo(num_put *this, const _Locinfo *locinfo, MSVCP_size_t refs)
7886 num_put_wchar_ctor_locinfo(this, locinfo, refs);
7887 this->facet.vtable = &MSVCP_num_put_short_vtable;
7888 return this;
7891 /* ??0?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAE@I@Z */
7892 /* ??0?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAA@_K@Z */
7893 DEFINE_THISCALL_WRAPPER(num_put_wchar_ctor_refs, 8)
7894 num_put* __thiscall num_put_wchar_ctor_refs(num_put *this, MSVCP_size_t refs)
7896 _Locinfo locinfo;
7898 TRACE("(%p %lu)\n", this, refs);
7900 _Locinfo_ctor(&locinfo);
7901 num_put_wchar_ctor_locinfo(this, &locinfo, refs);
7902 _Locinfo_dtor(&locinfo);
7903 return this;
7906 /* ??0?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAE@I@Z */
7907 /* ??0?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEAA@_K@Z */
7908 DEFINE_THISCALL_WRAPPER(num_put_short_ctor_refs, 8)
7909 num_put* __thiscall num_put_short_ctor_refs(num_put *this, MSVCP_size_t refs)
7911 num_put_wchar_ctor_refs(this, refs);
7912 this->facet.vtable = &MSVCP_num_put_short_vtable;
7913 return this;
7916 /* ??_F?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAEXXZ */
7917 /* ??_F?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAAXXZ */
7918 DEFINE_THISCALL_WRAPPER(num_put_wchar_ctor, 4)
7919 num_put* __thiscall num_put_wchar_ctor(num_put *this)
7921 return num_put_wchar_ctor_refs(this, 0);
7924 /* ??_F?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAEXXZ */
7925 /* ??_F?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEAAXXZ */
7926 DEFINE_THISCALL_WRAPPER(num_put_short_ctor, 4)
7927 num_put* __thiscall num_put_short_ctor(num_put *this)
7929 return num_put_short_ctor_refs(this, 0);
7932 /* ??1?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@UAE@XZ */
7933 /* ??1?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@UEAA@XZ */
7934 /* ??1?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MAE@XZ */
7935 /* ??1?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MEAA@XZ */
7936 /* ??1?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MAE@XZ */
7937 /* ??1?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MEAA@XZ */
7938 DEFINE_THISCALL_WRAPPER(num_put_wchar_dtor, 4)
7939 void __thiscall num_put_wchar_dtor(num_put *this)
7941 TRACE("(%p)\n", this);
7942 locale_facet_dtor(&this->facet);
7945 DEFINE_THISCALL_WRAPPER(num_put_wchar_vector_dtor, 8)
7946 num_put* __thiscall num_put_wchar_vector_dtor(num_put *this, unsigned int flags)
7948 TRACE("(%p %x)\n", this, flags);
7949 if(flags & 2) {
7950 /* we have an array, with the number of elements stored before the first object */
7951 INT_PTR i, *ptr = (INT_PTR *)this-1;
7953 for(i=*ptr-1; i>=0; i--)
7954 num_put_wchar_dtor(this+i);
7955 MSVCRT_operator_delete(ptr);
7956 } else {
7957 num_put_wchar_dtor(this);
7958 if(flags & 1)
7959 MSVCRT_operator_delete(this);
7962 return this;
7965 /* ?_Getcat@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
7966 /* ?_Getcat@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
7967 MSVCP_size_t __cdecl num_put_wchar__Getcat(const locale_facet **facet, const locale *loc)
7969 TRACE("(%p %p)\n", facet, loc);
7971 if(facet && !*facet) {
7972 _Locinfo locinfo;
7974 *facet = MSVCRT_operator_new(sizeof(num_put));
7975 if(!*facet) {
7976 ERR("Out of memory\n");
7977 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
7978 return 0;
7981 _Locinfo_ctor_cstr(&locinfo, locale_string_char_c_str(&loc->ptr->name));
7982 num_put_wchar_ctor_locinfo((num_put*)*facet, &locinfo, 0);
7983 _Locinfo_dtor(&locinfo);
7986 return LC_NUMERIC;
7989 /* ?_Getcat@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SAIPAPBVfacet@locale@2@@Z */
7990 /* ?_Getcat@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@@Z */
7991 MSVCP_size_t __cdecl num_put_wchar__Getcat_old(const locale_facet **facet)
7993 return num_put_wchar__Getcat(facet, locale_classic());
7996 /* ?_Getcat@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
7997 /* ?_Getcat@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
7998 MSVCP_size_t __cdecl num_put_short__Getcat(const locale_facet **facet, const locale *loc)
8000 TRACE("(%p %p)\n", facet, loc);
8002 if(facet && !*facet) {
8003 _Locinfo locinfo;
8005 *facet = MSVCRT_operator_new(sizeof(num_put));
8006 if(!*facet) {
8007 ERR("Out of memory\n");
8008 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8009 return 0;
8012 _Locinfo_ctor_cstr(&locinfo, locale_string_char_c_str(&loc->ptr->name));
8013 num_put_short_ctor_locinfo((num_put*)*facet, &locinfo, 0);
8014 _Locinfo_dtor(&locinfo);
8017 return LC_NUMERIC;
8020 /* ?_Getcat@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SAIPAPBVfacet@locale@2@@Z */
8021 /* ?_Getcat@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@@Z */
8022 MSVCP_size_t __cdecl num_put_short__Getcat_old(const locale_facet **facet)
8024 return num_put_short__Getcat(facet, locale_classic());
8027 num_put* num_put_wchar_use_facet(const locale *loc)
8029 static num_put *obj = NULL;
8031 _Lockit lock;
8032 const locale_facet *fac;
8034 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
8035 fac = locale__Getfacet(loc, locale_id_operator_size_t(&num_put_wchar_id));
8036 if(fac) {
8037 _Lockit_dtor(&lock);
8038 return (num_put*)fac;
8041 if(obj) {
8042 _Lockit_dtor(&lock);
8043 return obj;
8046 num_put_wchar__Getcat(&fac, loc);
8047 obj = (num_put*)fac;
8048 call_locale_facet__Incref(&obj->facet);
8049 locale_facet_register(&obj->facet);
8050 _Lockit_dtor(&lock);
8052 return obj;
8055 num_put* num_put_short_use_facet(const locale *loc)
8057 static num_put *obj = NULL;
8059 _Lockit lock;
8060 const locale_facet *fac;
8062 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
8063 fac = locale__Getfacet(loc, locale_id_operator_size_t(&num_put_short_id));
8064 if(fac) {
8065 _Lockit_dtor(&lock);
8066 return (num_put*)fac;
8069 if(obj) {
8070 _Lockit_dtor(&lock);
8071 return obj;
8074 num_put_short__Getcat(&fac, loc);
8075 obj = (num_put*)fac;
8076 call_locale_facet__Incref(&obj->facet);
8077 locale_facet_register(&obj->facet);
8078 _Lockit_dtor(&lock);
8080 return obj;
8083 /* ?_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 */
8084 /* ?_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 */
8085 /* ?_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 */
8086 /* ?_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 */
8087 ostreambuf_iterator_wchar* __cdecl num_put_wchar__Put(const num_put *this, ostreambuf_iterator_wchar *ret,
8088 ostreambuf_iterator_wchar dest, const wchar_t *ptr, MSVCP_size_t count)
8090 TRACE("(%p %p %s %ld)\n", this, ret, debugstr_wn(ptr, count), count);
8092 for(; count>0; count--)
8093 ostreambuf_iterator_wchar_put(&dest, *ptr++);
8095 *ret = dest;
8096 return ret;
8099 /* ?_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 */
8100 /* ?_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 */
8101 /* ?_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 */
8102 /* ?_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 */
8103 ostreambuf_iterator_wchar* __cdecl num_put_wchar__Putc(const num_put *this, ostreambuf_iterator_wchar *ret,
8104 ostreambuf_iterator_wchar dest, const char *ptr, MSVCP_size_t count)
8106 int state = 0;
8107 wchar_t ch;
8109 TRACE("(%p %p %s %ld)\n", this, ret, debugstr_an(ptr, count), count);
8111 for(; count>0; count--) {
8112 if(_Mbrtowc(&ch, ptr++, 1, &state, &this->cvt) == 1)
8113 ostreambuf_iterator_wchar_put(&dest, ch);
8116 *ret = dest;
8117 return ret;
8120 /* ?_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 */
8121 /* ?_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 */
8122 /* ?_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 */
8123 /* ?_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 */
8124 ostreambuf_iterator_wchar* __cdecl num_put_wchar__Putgrouped(const num_put *this, ostreambuf_iterator_wchar *ret,
8125 ostreambuf_iterator_wchar dest, const char *ptr, MSVCP_size_t count, wchar_t delim)
8127 FIXME("(%p %p %p %ld %d) stub\n", this, ret, ptr, count, delim);
8128 return NULL;
8131 /* ?_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 */
8132 /* ?_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 */
8133 /* ?_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 */
8134 /* ?_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 */
8135 ostreambuf_iterator_wchar* __cdecl num_put_wchar__Rep(const num_put *this, ostreambuf_iterator_wchar *ret,
8136 ostreambuf_iterator_wchar dest, wchar_t c, MSVCP_size_t count)
8138 TRACE("(%p %p %d %ld)\n", this, ret, c, count);
8140 for(; count>0; count--)
8141 ostreambuf_iterator_wchar_put(&dest, c);
8143 *ret = dest;
8144 return ret;
8147 /* ?_Ffmt@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@ABAPADPADDH@Z */
8148 /* ?_Ffmt@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@AEBAPEADPEADDH@Z */
8149 /* ?_Ffmt@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@ABAPADPADDH@Z */
8150 /* ?_Ffmt@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@AEBAPEADPEADDH@Z */
8151 char* __cdecl num_put_wchar__Ffmt(const num_put *this, char *fmt, char spec, int fmtfl)
8153 int type = fmtfl & FMTFLAG_floatfield;
8154 char *p = fmt;
8156 TRACE("(%p %p %d %d)\n", this, fmt, spec, fmtfl);
8158 *p++ = '%';
8159 if(fmtfl & FMTFLAG_showpos)
8160 *p++ = '+';
8161 if(fmtfl & FMTFLAG_showbase)
8162 *p++ = '#';
8163 *p++ = '.';
8164 *p++ = '*';
8165 if(spec)
8166 *p++ = spec;
8168 if(type == FMTFLAG_fixed)
8169 *p++ = 'f';
8170 else if(type == FMTFLAG_scientific)
8171 *p++ = (fmtfl & FMTFLAG_uppercase) ? 'E' : 'e';
8172 else if(type == (FMTFLAG_fixed|FMTFLAG_scientific))
8173 *p++ = (fmtfl & FMTFLAG_uppercase) ? 'A' : 'a';
8174 else
8175 *p++ = (fmtfl & FMTFLAG_uppercase) ? 'G' : 'g';
8177 *p++ = '\0';
8178 return fmt;
8181 /* ?_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 */
8182 /* ?_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 */
8183 ostreambuf_iterator_wchar* __cdecl num_put_wchar__Fput(const num_put *this, ostreambuf_iterator_wchar *ret,
8184 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, const char *buf, MSVCP_size_t bef_point,
8185 MSVCP_size_t aft_point, MSVCP_size_t trailing, MSVCP_size_t count)
8187 FIXME("(%p %p %p %d %p %ld %ld %ld %ld) stub\n", this, ret, base,
8188 fill, buf, bef_point, aft_point, trailing, count);
8189 return NULL;
8192 /* ?_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 */
8193 /* ?_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 */
8194 ostreambuf_iterator_wchar* __cdecl num_put_short__Fput(const num_put *this, ostreambuf_iterator_wchar *ret,
8195 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, const char *buf, MSVCP_size_t bef_point,
8196 MSVCP_size_t aft_point, MSVCP_size_t trailing, MSVCP_size_t count)
8198 FIXME("(%p %p %p %d %p %ld %ld %ld %ld) stub\n", this, ret, base,
8199 fill, buf, bef_point, aft_point, trailing, count);
8200 return NULL;
8203 /* TODO: This function should be removed when num_put_wchar__Fput is implemented */
8204 static ostreambuf_iterator_wchar* num_put__fput(const num_put *this, ostreambuf_iterator_wchar *ret,
8205 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, char *buf,
8206 MSVCP_size_t count, numpunct_wchar *numpunct)
8208 basic_string_char grouping_bstr;
8209 const char *grouping;
8210 char *p, dec_point = *localeconv()->decimal_point;
8211 wchar_t sep = 0;
8212 int cur_group = 0, group_size = 0;
8213 int adjustfield = base->fmtfl & FMTFLAG_adjustfield;
8214 MSVCP_size_t i, pad;
8216 TRACE("(%p %p %p %d %s %ld)\n", this, ret, base, fill, buf, count);
8218 for(p=buf; p<buf+count; p++) {
8219 if(*p == dec_point)
8220 break;
8222 p--;
8224 /* Add separators to number */
8225 numpunct_wchar_grouping(numpunct, &grouping_bstr);
8226 grouping = MSVCP_basic_string_char_c_str(&grouping_bstr);
8227 #if _MSVCP_VER >= 70
8228 if (grouping[0]) sep = numpunct_wchar_thousands_sep(numpunct);
8229 #endif
8231 for(; p>buf && sep && grouping[cur_group]!=CHAR_MAX; p--) {
8232 group_size++;
8233 if(group_size == grouping[cur_group]) {
8234 group_size = 0;
8235 if(grouping[cur_group+1])
8236 cur_group++;
8238 memmove(p+1, p, buf+count-p);
8239 *p = '\0'; /* mark thousands separator positions */
8240 count++;
8243 MSVCP_basic_string_char_dtor(&grouping_bstr);
8245 /* Display number with padding */
8246 if(count >= base->wide)
8247 pad = 0;
8248 else
8249 pad = base->wide-count;
8250 base->wide = 0;
8252 if((adjustfield & FMTFLAG_internal) && (buf[0]=='-' || buf[0]=='+')) {
8253 num_put_wchar__Putc(this, &dest, dest, buf, 1);
8254 buf++;
8256 if(adjustfield != FMTFLAG_left) {
8257 num_put_wchar__Rep(this, ret, dest, fill, pad);
8258 pad = 0;
8261 for(i=0; i<count; i++) {
8262 if(buf[i] == dec_point)
8263 num_put_wchar__Rep(this, &dest, dest, numpunct_wchar_decimal_point(numpunct), 1);
8264 else if(!buf[i])
8265 num_put_wchar__Rep(this, &dest, dest, sep, 1);
8266 else
8267 num_put_wchar__Putc(this, &dest, dest, buf+i, 1);
8270 return num_put_wchar__Rep(this, ret, dest, fill, pad);
8273 /* ?_Ifmt@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@ABAPADPADPBDH@Z */
8274 /* ?_Ifmt@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@AEBAPEADPEADPEBDH@Z */
8275 /* ?_Ifmt@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@ABAPADPADPBDH@Z */
8276 /* ?_Ifmt@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@AEBAPEADPEADPEBDH@Z */
8277 char* __cdecl num_put_wchar__Ifmt(const num_put *this, char *fmt, const char *spec, int fmtfl)
8279 int base = fmtfl & FMTFLAG_basefield;
8280 char *p = fmt;
8282 TRACE("(%p %p %p %d)\n", this, fmt, spec, fmtfl);
8284 *p++ = '%';
8285 if(fmtfl & FMTFLAG_showpos)
8286 *p++ = '+';
8287 if(fmtfl & FMTFLAG_showbase)
8288 *p++ = '#';
8290 *p++ = *spec++;
8291 if(*spec == 'l')
8292 *p++ = *spec++;
8294 if(base == FMTFLAG_oct)
8295 *p++ = 'o';
8296 else if(base == FMTFLAG_hex)
8297 *p++ = (fmtfl & FMTFLAG_uppercase) ? 'X' : 'x';
8298 else
8299 *p++ = *spec;
8301 *p++ = '\0';
8302 return fmt;
8305 static ostreambuf_iterator_wchar* num_put__Iput(const num_put *this, ostreambuf_iterator_wchar *ret,
8306 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, char *buf,
8307 MSVCP_size_t count, numpunct_wchar *numpunct)
8309 basic_string_char grouping_bstr;
8310 const char *grouping;
8311 char *p;
8312 wchar_t sep;
8313 int cur_group = 0, group_size = 0;
8314 int adjustfield = base->fmtfl & FMTFLAG_adjustfield;
8315 MSVCP_size_t i, pad;
8317 TRACE("(%p %p %p %d %s %ld)\n", this, ret, base, fill, buf, count);
8319 /* Add separators to number */
8320 numpunct_wchar_grouping(numpunct, &grouping_bstr);
8321 grouping = MSVCP_basic_string_char_c_str(&grouping_bstr);
8322 sep = grouping[0] ? numpunct_wchar_thousands_sep(numpunct) : '\0';
8324 for(p=buf+count-1; p>buf && sep && grouping[cur_group]!=CHAR_MAX; p--) {
8325 group_size++;
8326 if(group_size == grouping[cur_group]) {
8327 group_size = 0;
8328 if(grouping[cur_group+1])
8329 cur_group++;
8331 memmove(p+1, p, buf+count-p);
8332 *p = '\0'; /* mark thousands separator positions */
8333 count++;
8336 MSVCP_basic_string_char_dtor(&grouping_bstr);
8338 /* Display number with padding */
8339 if(count >= base->wide)
8340 pad = 0;
8341 else
8342 pad = base->wide-count;
8343 base->wide = 0;
8345 if((adjustfield & FMTFLAG_internal) && (buf[0]=='-' || buf[0]=='+')) {
8346 num_put_wchar__Putc(this, &dest, dest, buf, 1);
8347 buf++;
8348 }else if((adjustfield & FMTFLAG_internal) && (buf[1]=='x' || buf[1]=='X')) {
8349 num_put_wchar__Putc(this, &dest, dest, buf, 2);
8350 buf += 2;
8352 if(adjustfield != FMTFLAG_left) {
8353 num_put_wchar__Rep(this, ret, dest, fill, pad);
8354 pad = 0;
8357 for(i=0; i<count; i++) {
8358 if(!buf[i])
8359 num_put_wchar__Rep(this, &dest, dest, sep, 1);
8360 else
8361 num_put_wchar__Putc(this, &dest, dest, buf+i, 1);
8364 return num_put_wchar__Rep(this, ret, dest, fill, pad);
8367 /* ?_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 */
8368 /* ?_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 */
8369 ostreambuf_iterator_wchar* __cdecl num_put_wchar__Iput(const num_put *this, ostreambuf_iterator_wchar *ret,
8370 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, char *buf, MSVCP_size_t count)
8372 return num_put__Iput(this, ret, dest, base, fill, buf, count, numpunct_wchar_use_facet(IOS_LOCALE(base)));
8375 /* ?_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 */
8376 /* ?_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 */
8377 ostreambuf_iterator_wchar* __cdecl num_put_short__Iput(const num_put *this, ostreambuf_iterator_wchar *ret,
8378 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, char *buf, MSVCP_size_t count)
8380 return num_put__Iput(this, ret, dest, base, fill, buf, count, numpunct_short_use_facet(IOS_LOCALE(base)));
8383 /* ?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 */
8384 /* ?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 */
8385 #if _MSVCP_VER <= 100
8386 #define call_num_put_wchar_do_put_long(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 28, ostreambuf_iterator_wchar*, \
8387 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, LONG), \
8388 (this, ret, dest, base, fill, v))
8389 #else
8390 #define call_num_put_wchar_do_put_long(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 36, ostreambuf_iterator_wchar*, \
8391 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, LONG), \
8392 (this, ret, dest, base, fill, v))
8393 #endif
8394 #if _MSVCP_VER != 80
8395 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_long, 28)
8396 #else
8397 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_long, 32)
8398 #endif
8399 ostreambuf_iterator_wchar* __thiscall num_put_wchar_do_put_long(const num_put *this, ostreambuf_iterator_wchar *ret,
8400 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, LONG v)
8402 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
8403 char fmt[7]; /* strlen("%+#lld")+1 */
8405 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
8407 return num_put_wchar__Iput(this, ret, dest, base, fill, tmp,
8408 sprintf(tmp, num_put_wchar__Ifmt(this, fmt, "ld", base->fmtfl), v));
8411 /* ?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 */
8412 /* ?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 */
8413 #if _MSVCP_VER != 80
8414 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_long, 28)
8415 #else
8416 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_long, 32)
8417 #endif
8418 ostreambuf_iterator_wchar* __thiscall num_put_short_do_put_long(const num_put *this, ostreambuf_iterator_wchar *ret,
8419 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, LONG v)
8421 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
8422 char fmt[7]; /* strlen("%+#lld")+1 */
8424 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
8426 return num_put_short__Iput(this, ret, dest, base, fill, tmp,
8427 sprintf(tmp, num_put_wchar__Ifmt(this, fmt, "ld", base->fmtfl), v));
8430 /* ?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 */
8431 /* ?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 */
8432 /* ?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 */
8433 /* ?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 */
8434 #if _MSVCP_VER != 80
8435 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_long, 28)
8436 #else
8437 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_long, 32)
8438 #endif
8439 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_long(const num_put *this, ostreambuf_iterator_wchar *ret,
8440 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, LONG v)
8442 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
8443 return call_num_put_wchar_do_put_long(this, ret, dest, base, fill, v);
8446 /* ?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 */
8447 /* ?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 */
8448 #if _MSVCP_VER <= 100
8449 #define call_num_put_wchar_do_put_ulong(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 24, ostreambuf_iterator_wchar*, \
8450 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, ULONG), \
8451 (this, ret, dest, base, fill, v))
8452 #else
8453 #define call_num_put_wchar_do_put_ulong(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 32, ostreambuf_iterator_wchar*, \
8454 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, ULONG), \
8455 (this, ret, dest, base, fill, v))
8456 #endif
8457 #if _MSVCP_VER != 80
8458 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_ulong, 28)
8459 #else
8460 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_ulong, 32)
8461 #endif
8462 ostreambuf_iterator_wchar* __thiscall num_put_wchar_do_put_ulong(const num_put *this, ostreambuf_iterator_wchar *ret,
8463 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, ULONG v)
8465 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
8466 char fmt[7]; /* strlen("%+#lld")+1 */
8468 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
8470 return num_put_wchar__Iput(this, ret, dest, base, fill, tmp,
8471 sprintf(tmp, num_put_wchar__Ifmt(this, fmt, "lu", base->fmtfl), v));
8474 /* ?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 */
8475 /* ?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 */
8476 #if _MSVCP_VER != 80
8477 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_ulong, 28)
8478 #else
8479 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_ulong, 32)
8480 #endif
8481 ostreambuf_iterator_wchar* __thiscall num_put_short_do_put_ulong(const num_put *this, ostreambuf_iterator_wchar *ret,
8482 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, ULONG v)
8484 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
8485 char fmt[7]; /* strlen("%+#lld")+1 */
8487 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
8489 return num_put_short__Iput(this, ret, dest, base, fill, tmp,
8490 sprintf(tmp, num_put_wchar__Ifmt(this, fmt, "lu", base->fmtfl), v));
8493 /* ?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 */
8494 /* ?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 */
8495 /* ?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 */
8496 /* ?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 */
8497 #if _MSVCP_VER != 80
8498 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_ulong, 28)
8499 #else
8500 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_ulong, 32)
8501 #endif
8502 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_ulong(const num_put *this, ostreambuf_iterator_wchar *ret,
8503 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, ULONG v)
8505 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
8506 return call_num_put_wchar_do_put_ulong(this, ret, dest, base, fill, v);
8509 /* ?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 */
8510 /* ?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 */
8511 /* ?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 */
8512 /* ?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 */
8513 #if _MSVCP_VER <= 100
8514 #define call_num_put_wchar_do_put_double(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 12, ostreambuf_iterator_wchar*, \
8515 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, double), \
8516 (this, ret, dest, base, fill, v))
8517 #define call_num_put_wchar_do_put_ldouble(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 8, ostreambuf_iterator_wchar*, \
8518 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, double), \
8519 (this, ret, dest, base, fill, v))
8520 #else
8521 #define call_num_put_wchar_do_put_double(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 20, ostreambuf_iterator_wchar*, \
8522 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, double), \
8523 (this, ret, dest, base, fill, v))
8524 #define call_num_put_wchar_do_put_ldouble(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 16, ostreambuf_iterator_wchar*, \
8525 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, double), \
8526 (this, ret, dest, base, fill, v))
8527 #endif
8528 #if _MSVCP_VER != 80
8529 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_double, 32)
8530 #else
8531 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_double, 36)
8532 #endif
8533 ostreambuf_iterator_wchar* __thiscall num_put_wchar_do_put_double(const num_put *this, ostreambuf_iterator_wchar *ret,
8534 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, double v)
8536 char *tmp;
8537 char fmt[8]; /* strlen("%+#.*lg")+1 */
8538 int size;
8539 unsigned prec;
8541 TRACE("(%p %p %p %d %lf)\n", this, ret, base, fill, v);
8543 num_put_wchar__Ffmt(this, fmt, '\0', base->fmtfl);
8544 prec = get_precision(base);
8545 size = _scprintf(fmt, prec, v);
8547 /* TODO: don't use dynamic allocation */
8548 tmp = MSVCRT_operator_new(size*2);
8549 if(!tmp) {
8550 ERR("Out of memory\n");
8551 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8553 num_put__fput(this, ret, dest, base, fill, tmp, sprintf(tmp, fmt, prec, v),
8554 numpunct_wchar_use_facet(IOS_LOCALE(base)));
8555 MSVCRT_operator_delete(tmp);
8556 return ret;
8559 /* ?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 */
8560 /* ?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 */
8561 /* ?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 */
8562 /* ?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 */
8563 #if _MSVCP_VER != 80
8564 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_double, 32)
8565 #else
8566 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_double, 36)
8567 #endif
8568 ostreambuf_iterator_wchar* __thiscall num_put_short_do_put_double(const num_put *this, ostreambuf_iterator_wchar *ret,
8569 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, double v)
8571 char *tmp;
8572 char fmt[8]; /* strlen("%+#.*lg")+1 */
8573 int size;
8574 unsigned prec;
8576 TRACE("(%p %p %p %d %lf)\n", this, ret, base, fill, v);
8578 num_put_wchar__Ffmt(this, fmt, '\0', base->fmtfl);
8579 prec = get_precision(base);
8580 size = _scprintf(fmt, prec, v);
8582 /* TODO: don't use dynamic allocation */
8583 tmp = MSVCRT_operator_new(size*2);
8584 if(!tmp) {
8585 ERR("Out of memory\n");
8586 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
8588 num_put__fput(this, ret, dest, base, fill, tmp, sprintf(tmp, fmt, prec, v),
8589 numpunct_short_use_facet(IOS_LOCALE(base)));
8590 MSVCRT_operator_delete(tmp);
8591 return ret;
8594 /* ?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 */
8595 /* ?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 */
8596 /* ?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 */
8597 /* ?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 */
8598 #if _MSVCP_VER != 80
8599 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_double, 32)
8600 #else
8601 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_double, 36)
8602 #endif
8603 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_double(const num_put *this, ostreambuf_iterator_wchar *ret,
8604 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, double v)
8606 TRACE("(%p %p %p %d %lf)\n", this, ret, base, fill, v);
8607 return call_num_put_wchar_do_put_double(this, ret, dest, base, fill, v);
8610 /* ?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 */
8611 /* ?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 */
8612 /* ?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 */
8613 /* ?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 */
8614 #if _MSVCP_VER != 80
8615 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_ldouble, 32)
8616 #else
8617 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_ldouble, 36)
8618 #endif
8619 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_ldouble(const num_put *this, ostreambuf_iterator_wchar *ret,
8620 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, double v)
8622 TRACE("(%p %p %p %d %lf)\n", this, ret, base, fill, v);
8623 return call_num_put_wchar_do_put_ldouble(this, ret, dest, base, fill, v);
8626 /* ?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 */
8627 /* ?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 */
8628 #if _MSVCP_VER <= 100
8629 #define call_num_put_wchar_do_put_ptr(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 4, ostreambuf_iterator_wchar*, \
8630 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, const void*), \
8631 (this, ret, dest, base, fill, v))
8632 #else
8633 #define call_num_put_wchar_do_put_ptr(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 12, ostreambuf_iterator_wchar*, \
8634 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, const void*), \
8635 (this, ret, dest, base, fill, v))
8636 #endif
8637 #if _MSVCP_VER != 80
8638 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_ptr, 28)
8639 #else
8640 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_ptr, 32)
8641 #endif
8642 ostreambuf_iterator_wchar* __thiscall num_put_wchar_do_put_ptr(const num_put *this, ostreambuf_iterator_wchar *ret,
8643 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, const void *v)
8645 char tmp[17]; /* 8(16^8==2^64)*2(separators beetwen every digit) + 1 */
8647 TRACE("(%p %p %p %d %p)\n", this, ret, base, fill, v);
8649 return num_put_wchar__Iput(this, ret, dest, base, fill, tmp, sprintf(tmp, "%p", v));
8652 /* ?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 */
8653 /* ?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 */
8654 #if _MSVCP_VER != 80
8655 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_ptr, 28)
8656 #else
8657 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_ptr, 32)
8658 #endif
8659 ostreambuf_iterator_wchar* __thiscall num_put_short_do_put_ptr(const num_put *this, ostreambuf_iterator_wchar *ret,
8660 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, const void *v)
8662 char tmp[17]; /* 8(16^8==2^64)*2(separators beetwen every digit) + 1 */
8664 TRACE("(%p %p %p %d %p)\n", this, ret, base, fill, v);
8666 return num_put_short__Iput(this, ret, dest, base, fill, tmp, sprintf(tmp, "%p", v));
8669 /* ?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 */
8670 /* ?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 */
8671 /* ?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 */
8672 /* ?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 */
8673 #if _MSVCP_VER != 80
8674 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_ptr, 28)
8675 #else
8676 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_ptr, 32)
8677 #endif
8678 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_ptr(const num_put *this, ostreambuf_iterator_wchar *ret,
8679 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, const void *v)
8681 TRACE("(%p %p %p %d %p)\n", this, ret, base, fill, v);
8682 return call_num_put_wchar_do_put_ptr(this, ret, dest, base, fill, v);
8685 /* ?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 */
8686 /* ?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 */
8687 #if _MSVCP_VER <= 100
8688 #define call_num_put_wchar_do_put_int64(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 20, ostreambuf_iterator_wchar*, \
8689 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, __int64), \
8690 (this, ret, dest, base, fill, v))
8691 #else
8692 #define call_num_put_wchar_do_put_int64(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 28, ostreambuf_iterator_wchar*, \
8693 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, __int64), \
8694 (this, ret, dest, base, fill, v))
8695 #endif
8696 #if _MSVCP_VER != 80
8697 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_int64, 32)
8698 #else
8699 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_int64, 36)
8700 #endif
8701 ostreambuf_iterator_wchar* __thiscall num_put_wchar_do_put_int64(const num_put *this, ostreambuf_iterator_wchar *ret,
8702 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, __int64 v)
8704 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
8705 char fmt[7]; /* strlen("%+#lld")+1 */
8707 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
8709 return num_put_wchar__Iput(this, ret, dest, base, fill, tmp,
8710 sprintf(tmp, num_put_wchar__Ifmt(this, fmt, "lld", base->fmtfl), v));
8713 /* ?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 */
8714 /* ?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 */
8715 #if _MSVCP_VER != 80
8716 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_int64, 32)
8717 #else
8718 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_int64, 36)
8719 #endif
8720 ostreambuf_iterator_wchar* __thiscall num_put_short_do_put_int64(const num_put *this, ostreambuf_iterator_wchar *ret,
8721 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, __int64 v)
8723 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
8724 char fmt[7]; /* strlen("%+#lld")+1 */
8726 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
8728 return num_put_short__Iput(this, ret, dest, base, fill, tmp,
8729 sprintf(tmp, num_put_wchar__Ifmt(this, fmt, "lld", base->fmtfl), v));
8732 /* ?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 */
8733 /* ?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 */
8734 /* ?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 */
8735 /* ?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 */
8736 #if _MSVCP_VER != 80
8737 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_int64, 32)
8738 #else
8739 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_int64, 36)
8740 #endif
8741 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_int64(const num_put *this, ostreambuf_iterator_wchar *ret,
8742 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, __int64 v)
8744 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
8745 return call_num_put_wchar_do_put_int64(this, ret, dest, base, fill, v);
8748 /* ?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 */
8749 /* ?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 */
8750 #if _MSVCP_VER <= 100
8751 #define call_num_put_wchar_do_put_uint64(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 16, ostreambuf_iterator_wchar*, \
8752 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, unsigned __int64), \
8753 (this, ret, dest, base, fill, v))
8754 #else
8755 #define call_num_put_wchar_do_put_uint64(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 24, ostreambuf_iterator_wchar*, \
8756 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, unsigned __int64), \
8757 (this, ret, dest, base, fill, v))
8758 #endif
8759 #if _MSVCP_VER != 80
8760 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_uint64, 32)
8761 #else
8762 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_uint64, 36)
8763 #endif
8764 ostreambuf_iterator_wchar* __thiscall num_put_wchar_do_put_uint64(const num_put *this, ostreambuf_iterator_wchar *ret,
8765 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, unsigned __int64 v)
8767 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
8768 char fmt[7]; /* strlen("%+#lld")+1 */
8770 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
8772 return num_put_wchar__Iput(this, ret, dest, base, fill, tmp,
8773 sprintf(tmp, num_put_wchar__Ifmt(this, fmt, "llu", base->fmtfl), v));
8776 /* ?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 */
8777 /* ?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 */
8778 #if _MSVCP_VER != 80
8779 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_uint64, 32)
8780 #else
8781 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_uint64, 36)
8782 #endif
8783 ostreambuf_iterator_wchar* __thiscall num_put_short_do_put_uint64(const num_put *this, ostreambuf_iterator_wchar *ret,
8784 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, unsigned __int64 v)
8786 char tmp[48]; /* 22(8^22>2^64)*2(separators beetwen every digit) + 3(strlen("+0x"))+1 */
8787 char fmt[7]; /* strlen("%+#lld")+1 */
8789 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
8791 return num_put_short__Iput(this, ret, dest, base, fill, tmp,
8792 sprintf(tmp, num_put_wchar__Ifmt(this, fmt, "llu", base->fmtfl), v));
8795 /* ?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 */
8796 /* ?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 */
8797 /* ?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 */
8798 /* ?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 */
8799 #if _MSVCP_VER != 80
8800 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_uint64, 32)
8801 #else
8802 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_uint64, 36)
8803 #endif
8804 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_uint64(const num_put *this, ostreambuf_iterator_wchar *ret,
8805 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, unsigned __int64 v)
8807 TRACE("(%p %p %p %d)\n", this, ret, base, fill);
8808 return call_num_put_wchar_do_put_uint64(this, ret, dest, base, fill, v);
8811 /* ?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 */
8812 /* ?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 */
8813 #if _MSVCP_VER <= 100
8814 #define call_num_put_wchar_do_put_bool(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 32, ostreambuf_iterator_wchar*, \
8815 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, MSVCP_bool), \
8816 (this, ret, dest, base, fill, v))
8817 #else
8818 #define call_num_put_wchar_do_put_bool(this, ret, dest, base, fill, v) CALL_VTBL_FUNC(this, 40, ostreambuf_iterator_wchar*, \
8819 (const num_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, MSVCP_bool), \
8820 (this, ret, dest, base, fill, v))
8821 #endif
8822 #if _MSVCP_VER != 80
8823 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_bool, 28)
8824 #else
8825 DEFINE_THISCALL_WRAPPER(num_put_wchar_do_put_bool, 32)
8826 #endif
8827 ostreambuf_iterator_wchar* __thiscall num_put_wchar_do_put_bool(const num_put *this, ostreambuf_iterator_wchar *ret,
8828 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, MSVCP_bool v)
8830 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
8832 if(base->fmtfl & FMTFLAG_boolalpha) {
8833 numpunct_wchar *numpunct = numpunct_wchar_use_facet(IOS_LOCALE(base));
8834 basic_string_wchar str;
8835 MSVCP_size_t pad, len;
8837 if(v)
8838 numpunct_wchar_truename(numpunct, &str);
8839 else
8840 numpunct_wchar_falsename(numpunct, &str);
8842 len = MSVCP_basic_string_wchar_length(&str);
8843 pad = (len>base->wide ? 0 : base->wide-len);
8844 base->wide = 0;
8846 if((base->fmtfl & FMTFLAG_adjustfield) != FMTFLAG_left) {
8847 num_put_wchar__Rep(this, &dest, dest, fill, pad);
8848 pad = 0;
8850 num_put_wchar__Put(this, &dest, dest, MSVCP_basic_string_wchar_c_str(&str), len);
8851 MSVCP_basic_string_wchar_dtor(&str);
8852 return num_put_wchar__Rep(this, ret, dest, fill, pad);
8855 return num_put_wchar_put_long(this, ret, dest, base, fill, v);
8858 /* ?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 */
8859 /* ?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 */
8860 #if _MSVCP_VER != 80
8861 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_bool, 28)
8862 #else
8863 DEFINE_THISCALL_WRAPPER(num_put_short_do_put_bool, 32)
8864 #endif
8865 ostreambuf_iterator_wchar* __thiscall num_put_short_do_put_bool(const num_put *this, ostreambuf_iterator_wchar *ret,
8866 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, MSVCP_bool v)
8868 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
8870 if(base->fmtfl & FMTFLAG_boolalpha) {
8871 numpunct_wchar *numpunct = numpunct_short_use_facet(IOS_LOCALE(base));
8872 basic_string_wchar str;
8873 MSVCP_size_t pad, len;
8875 if(v)
8876 numpunct_wchar_truename(numpunct, &str);
8877 else
8878 numpunct_wchar_falsename(numpunct, &str);
8880 len = MSVCP_basic_string_wchar_length(&str);
8881 pad = (len>base->wide ? 0 : base->wide-len);
8882 base->wide = 0;
8884 if((base->fmtfl & FMTFLAG_adjustfield) != FMTFLAG_left) {
8885 num_put_wchar__Rep(this, &dest, dest, fill, pad);
8886 pad = 0;
8888 num_put_wchar__Put(this, &dest, dest, MSVCP_basic_string_wchar_c_str(&str), len);
8889 MSVCP_basic_string_wchar_dtor(&str);
8890 return num_put_wchar__Rep(this, ret, dest, fill, pad);
8893 return num_put_wchar_put_long(this, ret, dest, base, fill, v);
8896 /* ?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 */
8897 /* ?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 */
8898 /* ?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 */
8899 /* ?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 */
8900 #if _MSVCP_VER != 80
8901 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_bool, 28)
8902 #else
8903 DEFINE_THISCALL_WRAPPER(num_put_wchar_put_bool, 32)
8904 #endif
8905 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_bool(const num_put *this, ostreambuf_iterator_wchar *ret,
8906 ostreambuf_iterator_wchar dest, ios_base *base, wchar_t fill, MSVCP_bool v)
8908 TRACE("(%p %p %p %d %d)\n", this, ret, base, fill, v);
8909 return call_num_put_wchar_do_put_bool(this, ret, dest, base, fill, v);
8912 /* ?id@?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@2V0locale@2@A */
8913 locale_id time_put_char_id = {0};
8915 /* ??_7?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@6B@ */
8916 extern const vtable_ptr MSVCP_time_put_char_vtable;
8918 /* ?_Init@?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@IAEXABV_Locinfo@2@@Z */
8919 /* ?_Init@?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@IEAAXAEBV_Locinfo@2@@Z */
8920 DEFINE_THISCALL_WRAPPER(time_put_char__Init, 8)
8921 void __thiscall time_put_char__Init(time_put *this, const _Locinfo *locinfo)
8923 TRACE("(%p %p)\n", this, locinfo);
8924 _Locinfo__Gettnames(locinfo, &this->time);
8925 _Locinfo__Getcvt(locinfo, &this->cvt);
8928 /* ??0?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
8929 /* ??0?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
8930 DEFINE_THISCALL_WRAPPER(time_put_char_ctor_locinfo, 12)
8931 time_put* __thiscall time_put_char_ctor_locinfo(time_put *this, const _Locinfo *locinfo, MSVCP_size_t refs)
8933 TRACE("(%p %p %lu)\n", this, locinfo, refs);
8934 locale_facet_ctor_refs(&this->facet, refs);
8935 this->facet.vtable = &MSVCP_time_put_char_vtable;
8936 time_put_char__Init(this, locinfo);
8937 return this;
8940 /* ??0?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAE@I@Z */
8941 /* ??0?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAA@_K@Z */
8942 DEFINE_THISCALL_WRAPPER(time_put_char_ctor_refs, 8)
8943 time_put* __thiscall time_put_char_ctor_refs(time_put *this, MSVCP_size_t refs)
8945 _Locinfo locinfo;
8947 TRACE("(%p %lu)\n", this, refs);
8949 _Locinfo_ctor(&locinfo);
8950 time_put_char_ctor_locinfo(this, &locinfo, refs);
8951 _Locinfo_dtor(&locinfo);
8952 return this;
8955 /* ??_F?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAEXXZ */
8956 /* ??_F?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAAXXZ */
8957 DEFINE_THISCALL_WRAPPER(time_put_char_ctor, 4)
8958 time_put* __thiscall time_put_char_ctor(time_put *this)
8960 return time_put_char_ctor_refs(this, 0);
8963 /* ??1?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MAE@XZ */
8964 /* ??1?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MEAA@XZ */
8965 DEFINE_THISCALL_WRAPPER(time_put_char_dtor, 4)
8966 void __thiscall time_put_char_dtor(time_put *this)
8968 TRACE("(%p)\n", this);
8969 _Timevec_dtor(&this->time);
8972 DEFINE_THISCALL_WRAPPER(time_put_char_vector_dtor, 8)
8973 time_put* __thiscall time_put_char_vector_dtor(time_put *this, unsigned int flags)
8975 TRACE("(%p %x)\n", this, flags);
8976 if(flags & 2) {
8977 /* we have an array, with the number of elements stored before the first object */
8978 INT_PTR i, *ptr = (INT_PTR *)this-1;
8980 for(i=*ptr-1; i>=0; i--)
8981 time_put_char_dtor(this+i);
8982 MSVCRT_operator_delete(ptr);
8983 } else {
8984 time_put_char_dtor(this);
8985 if(flags & 1)
8986 MSVCRT_operator_delete(this);
8989 return this;
8992 /* ?_Getcat@?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
8993 /* ?_Getcat@?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
8994 MSVCP_size_t __cdecl time_put_char__Getcat(const locale_facet **facet, const locale *loc)
8996 TRACE("(%p %p)\n", facet, loc);
8998 if(facet && !*facet) {
8999 _Locinfo locinfo;
9001 *facet = MSVCRT_operator_new(sizeof(time_put));
9002 if(!*facet) {
9003 ERR("Out of memory\n");
9004 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
9005 return 0;
9008 _Locinfo_ctor_cstr(&locinfo, locale_string_char_c_str(&loc->ptr->name));
9009 time_put_char_ctor_locinfo((time_put*)*facet, &locinfo, 0);
9010 _Locinfo_dtor(&locinfo);
9013 return LC_TIME;
9016 /* ?_Getcat@?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SAIPAPBVfacet@locale@2@@Z */
9017 /* ?_Getcat@?$time_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@@Z */
9018 MSVCP_size_t __cdecl time_put_char__Getcat_old(const locale_facet **facet)
9020 return time_put_char__Getcat(facet, locale_classic());
9023 static time_put* time_put_char_use_facet(const locale *loc)
9025 static time_put *obj = NULL;
9027 _Lockit lock;
9028 const locale_facet *fac;
9030 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
9031 fac = locale__Getfacet(loc, locale_id_operator_size_t(&time_put_char_id));
9032 if(fac) {
9033 _Lockit_dtor(&lock);
9034 return (time_put*)fac;
9037 if(obj) {
9038 _Lockit_dtor(&lock);
9039 return obj;
9042 time_put_char__Getcat(&fac, loc);
9043 obj = (time_put*)fac;
9044 call_locale_facet__Incref(&obj->facet);
9045 locale_facet_register(&obj->facet);
9046 _Lockit_dtor(&lock);
9048 return obj;
9051 #if _MSVCP_VER >= 70
9053 /* ?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 */
9054 /* ?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 */
9055 #if _MSVCP_VER != 80
9056 DEFINE_THISCALL_WRAPPER(time_put_char_do_put, 36)
9057 #else
9058 DEFINE_THISCALL_WRAPPER(time_put_char_do_put, 40)
9059 #endif
9060 #if _MSVCP_VER <= 100
9061 #define call_time_put_char_do_put(this, ret, dest, base, fill, t, spec, mod) CALL_VTBL_FUNC(this, 4, ostreambuf_iterator_char*, \
9062 (const time_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, const struct tm*, char, char), \
9063 (this, ret, dest, base, fill, t, spec, mod))
9064 #else
9065 #define call_time_put_char_do_put(this, ret, dest, base, fill, t, spec, mod) CALL_VTBL_FUNC(this, 12, ostreambuf_iterator_char*, \
9066 (const time_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, char, const struct tm*, char, char), \
9067 (this, ret, dest, base, fill, t, spec, mod))
9068 #endif
9069 ostreambuf_iterator_char* __thiscall time_put_char_do_put(const time_put *this, ostreambuf_iterator_char *ret,
9070 ostreambuf_iterator_char dest, ios_base *base, char fill, const struct tm *t, char spec, char mod)
9072 char buf[64], fmt[4], *p = fmt;
9073 MSVCP_size_t i, len;
9075 TRACE("(%p %p %p %c %p %c %c)\n", this, ret, base, fill, t, spec, mod);
9077 *p++ = '%';
9078 if(mod)
9079 *p++ = mod;
9080 *p++ = spec;
9081 *p++ = 0;
9083 len = _Strftime(buf, sizeof(buf), fmt, t, this->time.timeptr);
9084 for(i=0; i<len; i++)
9085 ostreambuf_iterator_char_put(&dest, buf[i]);
9087 *ret = dest;
9088 return ret;
9091 /* ?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 */
9092 /* ?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 */
9093 #if _MSVCP_VER != 80
9094 DEFINE_THISCALL_WRAPPER(time_put_char_put, 36)
9095 #else
9096 DEFINE_THISCALL_WRAPPER(time_put_char_put, 40)
9097 #endif
9098 ostreambuf_iterator_char* __thiscall time_put_char_put(const time_put *this, ostreambuf_iterator_char *ret,
9099 ostreambuf_iterator_char dest, ios_base *base, char fill, const struct tm *t, char spec, char mod)
9101 TRACE("(%p %p %p %c %p %c %c)\n", this, ret, base, fill, t, spec, mod);
9102 return call_time_put_char_do_put(this, ret, dest, base, fill, t, spec, mod);
9105 /* ?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 */
9106 /* ?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 */
9107 #if _MSVCP_VER != 80
9108 DEFINE_THISCALL_WRAPPER(time_put_char_put_format, 36)
9109 #else
9110 DEFINE_THISCALL_WRAPPER(time_put_char_put_format, 40)
9111 #endif
9112 ostreambuf_iterator_char* __thiscall time_put_char_put_format(const time_put *this, ostreambuf_iterator_char *ret,
9113 ostreambuf_iterator_char dest, ios_base *base, char fill, const struct tm *t, const char *pat, const char *pat_end)
9115 TRACE("(%p %p %p %c %p %s)\n", this, ret, base, fill, t, debugstr_an(pat, pat_end-pat));
9117 while(pat < pat_end) {
9118 if(*pat != '%') {
9119 ostreambuf_iterator_char_put(&dest, *pat++);
9120 }else if(++pat == pat_end) {
9121 ostreambuf_iterator_char_put(&dest, '%');
9122 }else if(*pat=='#' && pat+1==pat_end) {
9123 ostreambuf_iterator_char_put(&dest, '%');
9124 ostreambuf_iterator_char_put(&dest, *pat++);
9125 }else {
9126 char mod;
9128 if(*pat == '#') {
9129 mod = '#';
9130 pat++;
9131 }else {
9132 mod = 0;
9135 time_put_char_put(this, &dest, dest, base, fill, t, *pat++, mod);
9139 *ret = dest;
9140 return ret;
9143 #else /* _MSVCP_VER < 70 doesn't have the 'fill' parameter */
9145 /* ?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 */
9146 /* ?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 */
9147 DEFINE_THISCALL_WRAPPER(time_put_char_do_put, 32)
9148 #define call_time_put_char_do_put(this, ret, dest, base, t, spec, mod) CALL_VTBL_FUNC(this, 4, ostreambuf_iterator_char*, \
9149 (const time_put*, ostreambuf_iterator_char*, ostreambuf_iterator_char, ios_base*, const struct tm*, char, char), \
9150 (this, ret, dest, base, t, spec, mod))
9151 ostreambuf_iterator_char* __thiscall time_put_char_do_put(const time_put *this, ostreambuf_iterator_char *ret,
9152 ostreambuf_iterator_char dest, ios_base *base, const struct tm *t, char spec, char mod)
9154 char buf[64], fmt[4], *p = fmt;
9155 MSVCP_size_t i, len;
9157 TRACE("(%p %p %p %p %c %c)\n", this, ret, base, t, spec, mod);
9159 *p++ = '%';
9160 if(mod)
9161 *p++ = mod;
9162 *p++ = spec;
9163 *p++ = 0;
9165 len = _Strftime(buf, sizeof(buf), fmt, t, this->time.timeptr);
9166 for(i=0; i<len; i++)
9167 ostreambuf_iterator_char_put(&dest, buf[i]);
9169 *ret = dest;
9170 return ret;
9173 /* ?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 */
9174 /* ?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 */
9175 DEFINE_THISCALL_WRAPPER(time_put_char_put, 32)
9176 ostreambuf_iterator_char* __thiscall time_put_char_put(const time_put *this, ostreambuf_iterator_char *ret,
9177 ostreambuf_iterator_char dest, ios_base *base, const struct tm *t, char spec, char mod)
9179 TRACE("(%p %p %p %p %c %c)\n", this, ret, base, t, spec, mod);
9180 return call_time_put_char_do_put(this, ret, dest, base, t, spec, mod);
9183 /* ?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 */
9184 /* ?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 */
9185 DEFINE_THISCALL_WRAPPER(time_put_char_put_format, 32)
9186 ostreambuf_iterator_char* __thiscall time_put_char_put_format(const time_put *this, ostreambuf_iterator_char *ret,
9187 ostreambuf_iterator_char dest, ios_base *base, const struct tm *t, const char *pat, const char *pat_end)
9189 TRACE("(%p %p %p %p %s)\n", this, ret, base, t, debugstr_an(pat, pat_end-pat));
9191 while(pat < pat_end) {
9192 if(*pat != '%') {
9193 ostreambuf_iterator_char_put(&dest, *pat++);
9194 }else if(++pat == pat_end) {
9195 ostreambuf_iterator_char_put(&dest, '%');
9196 }else if(*pat=='#' && pat+1==pat_end) {
9197 ostreambuf_iterator_char_put(&dest, '%');
9198 ostreambuf_iterator_char_put(&dest, *pat++);
9199 }else {
9200 char mod;
9202 if(*pat == '#') {
9203 mod = '#';
9204 pat++;
9205 }else {
9206 mod = 0;
9209 time_put_char_put(this, &dest, dest, base, t, *pat++, mod);
9213 *ret = dest;
9214 return ret;
9217 #endif /* MSVCP_VER >= 70 */
9219 /* ?id@?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@2V0locale@2@A */
9220 locale_id time_put_wchar_id = {0};
9221 /* ?id@?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@2V0locale@2@A */
9222 locale_id time_put_short_id = {0};
9224 /* ??_7?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@6B@ */
9225 extern const vtable_ptr MSVCP_time_put_wchar_vtable;
9226 /* ??_7?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@6B@ */
9227 extern const vtable_ptr MSVCP_time_put_short_vtable;
9229 /* ?_Init@?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@IAEXABV_Locinfo@2@@Z */
9230 /* ?_Init@?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@IEAAXAEBV_Locinfo@2@@Z */
9231 /* ?_Init@?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@IAEXABV_Locinfo@2@@Z */
9232 /* ?_Init@?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@IEAAXAEBV_Locinfo@2@@Z */
9233 DEFINE_THISCALL_WRAPPER(time_put_wchar__Init, 8)
9234 void __thiscall time_put_wchar__Init(time_put *this, const _Locinfo *locinfo)
9236 TRACE("(%p %p)\n", this, locinfo);
9237 _Locinfo__Gettnames(locinfo, &this->time);
9238 _Locinfo__Getcvt(locinfo, &this->cvt);
9241 /* ??0?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
9242 /* ??0?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
9243 DEFINE_THISCALL_WRAPPER(time_put_wchar_ctor_locinfo, 12)
9244 time_put* __thiscall time_put_wchar_ctor_locinfo(time_put *this, const _Locinfo *locinfo, MSVCP_size_t refs)
9246 TRACE("(%p %p %lu)\n", this, locinfo, refs);
9247 locale_facet_ctor_refs(&this->facet, refs);
9248 this->facet.vtable = &MSVCP_time_put_wchar_vtable;
9249 time_put_wchar__Init(this, locinfo);
9250 return this;
9253 /* ??0?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
9254 /* ??0?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
9255 DEFINE_THISCALL_WRAPPER(time_put_short_ctor_locinfo, 12)
9256 time_put* __thiscall time_put_short_ctor_locinfo(time_put *this, const _Locinfo *locinfo, MSVCP_size_t refs)
9258 time_put_wchar_ctor_locinfo(this, locinfo, refs);
9259 this->facet.vtable = &MSVCP_time_put_short_vtable;
9260 return this;
9263 /* ??0?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@IAE@PBDI@Z */
9264 /* ??0?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@IEAA@PEBD_K@Z */
9265 DEFINE_THISCALL_WRAPPER(time_put_wchar_ctor_name, 12)
9266 time_put* __thiscall time_put_wchar_ctor_name(time_put *this, const char *name, MSVCP_size_t refs)
9268 _Locinfo locinfo;
9270 TRACE("(%p %s %lu)\n", this, debugstr_a(name), refs);
9272 _Locinfo_ctor_cstr(&locinfo, name);
9273 time_put_wchar_ctor_locinfo(this, &locinfo, refs);
9274 _Locinfo_dtor(&locinfo);
9275 return this;
9278 /* ??0?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@IAE@PBDI@Z */
9279 /* ??0?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@IEAA@PEBD_K@Z */
9280 DEFINE_THISCALL_WRAPPER(time_put_short_ctor_name, 12)
9281 time_put* __thiscall time_put_short_ctor_name(time_put *this, const char *name, MSVCP_size_t refs)
9283 time_put_wchar_ctor_name(this, name, refs);
9284 this->facet.vtable = &MSVCP_time_put_short_vtable;
9285 return this;
9288 /* ??0?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAE@I@Z */
9289 /* ??0?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAA@_K@Z */
9290 DEFINE_THISCALL_WRAPPER(time_put_wchar_ctor_refs, 8)
9291 time_put* __thiscall time_put_wchar_ctor_refs(time_put *this, MSVCP_size_t refs)
9293 _Locinfo locinfo;
9295 TRACE("(%p %lu)\n", this, refs);
9297 _Locinfo_ctor(&locinfo);
9298 time_put_wchar_ctor_locinfo(this, &locinfo, refs);
9299 _Locinfo_dtor(&locinfo);
9300 return this;
9303 /* ??0?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAE@I@Z */
9304 /* ??0?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEAA@_K@Z */
9305 DEFINE_THISCALL_WRAPPER(time_put_short_ctor_refs, 8)
9306 time_put* __thiscall time_put_short_ctor_refs(time_put *this, MSVCP_size_t refs)
9308 time_put_wchar_ctor_refs(this, refs);
9309 this->facet.vtable = &MSVCP_time_put_short_vtable;
9310 return this;
9313 /* ??_F?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QAEXXZ */
9314 /* ??_F?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QEAAXXZ */
9315 DEFINE_THISCALL_WRAPPER(time_put_wchar_ctor, 4)
9316 time_put* __thiscall time_put_wchar_ctor(time_put *this)
9318 return time_put_wchar_ctor_refs(this, 0);
9321 /* ??_F?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QAEXXZ */
9322 /* ??_F?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QEAAXXZ */
9323 DEFINE_THISCALL_WRAPPER(time_put_short_ctor, 4)
9324 time_put* __thiscall time_put_short_ctor(time_put *this)
9326 time_put_wchar_ctor(this);
9327 this->facet.vtable = &MSVCP_time_put_short_vtable;
9328 return this;
9331 /* ??1?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MAE@XZ */
9332 /* ??1?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@MEAA@XZ */
9333 /* ??1?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MAE@XZ */
9334 /* ??1?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@MEAA@XZ */
9335 DEFINE_THISCALL_WRAPPER(time_put_wchar_dtor, 4)
9336 void __thiscall time_put_wchar_dtor(time_put *this)
9338 TRACE("(%p)\n", this);
9339 _Timevec_dtor(&this->time);
9342 DEFINE_THISCALL_WRAPPER(time_put_wchar_vector_dtor, 8)
9343 time_put* __thiscall time_put_wchar_vector_dtor(time_put *this, unsigned int flags)
9345 TRACE("(%p %x)\n", this, flags);
9346 if(flags & 2) {
9347 /* we have an array, with the number of elements stored before the first object */
9348 INT_PTR i, *ptr = (INT_PTR *)this-1;
9350 for(i=*ptr-1; i>=0; i--)
9351 time_put_wchar_dtor(this+i);
9352 MSVCRT_operator_delete(ptr);
9353 } else {
9354 time_put_wchar_dtor(this);
9355 if(flags & 1)
9356 MSVCRT_operator_delete(this);
9359 return this;
9362 /* ?_Getcat@?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
9363 /* ?_Getcat@?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
9364 MSVCP_size_t __cdecl time_put_wchar__Getcat(const locale_facet **facet, const locale *loc)
9366 TRACE("(%p %p)\n", facet, loc);
9368 if(facet && !*facet) {
9369 *facet = MSVCRT_operator_new(sizeof(time_put));
9370 if(!*facet) {
9371 ERR("Out of memory\n");
9372 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
9373 return 0;
9375 time_put_wchar_ctor_name((time_put*)*facet,
9376 locale_string_char_c_str(&loc->ptr->name), 0);
9379 return LC_TIME;
9382 /* ?_Getcat@?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SAIPAPBVfacet@locale@2@@Z */
9383 /* ?_Getcat@?$time_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@@Z */
9384 MSVCP_size_t __cdecl time_put_wchar__Getcat_old(const locale_facet **facet)
9386 return time_put_wchar__Getcat(facet, locale_classic());
9389 static time_put* time_put_wchar_use_facet(const locale *loc)
9391 static time_put *obj = NULL;
9393 _Lockit lock;
9394 const locale_facet *fac;
9396 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
9397 fac = locale__Getfacet(loc, locale_id_operator_size_t(&time_put_wchar_id));
9398 if(fac) {
9399 _Lockit_dtor(&lock);
9400 return (time_put*)fac;
9403 if(obj) {
9404 _Lockit_dtor(&lock);
9405 return obj;
9408 time_put_wchar__Getcat(&fac, loc);
9409 obj = (time_put*)fac;
9410 call_locale_facet__Incref(&obj->facet);
9411 locale_facet_register(&obj->facet);
9412 _Lockit_dtor(&lock);
9414 return obj;
9417 /* ?_Getcat@?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
9418 /* ?_Getcat@?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
9419 MSVCP_size_t __cdecl time_put_short__Getcat(const locale_facet **facet, const locale *loc)
9421 TRACE("(%p %p)\n", facet, loc);
9423 if(facet && !*facet) {
9424 *facet = MSVCRT_operator_new(sizeof(time_put));
9425 if(!*facet) {
9426 ERR("Out of memory\n");
9427 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
9428 return 0;
9430 time_put_short_ctor_name((time_put*)*facet,
9431 locale_string_char_c_str(&loc->ptr->name), 0);
9434 return LC_TIME;
9437 /* ?_Getcat@?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SAIPAPBVfacet@locale@2@@Z */
9438 /* ?_Getcat@?$time_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@@Z */
9439 MSVCP_size_t __cdecl time_put_short__Getcat_old(const locale_facet **facet)
9441 return time_put_short__Getcat(facet, locale_classic());
9444 static time_put* time_put_short_use_facet(const locale *loc)
9446 static time_put *obj = NULL;
9448 _Lockit lock;
9449 const locale_facet *fac;
9451 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
9452 fac = locale__Getfacet(loc, locale_id_operator_size_t(&time_put_short_id));
9453 if(fac) {
9454 _Lockit_dtor(&lock);
9455 return (time_put*)fac;
9458 if(obj) {
9459 _Lockit_dtor(&lock);
9460 return obj;
9463 time_put_short__Getcat(&fac, loc);
9464 obj = (time_put*)fac;
9465 call_locale_facet__Incref(&obj->facet);
9466 locale_facet_register(&obj->facet);
9467 _Lockit_dtor(&lock);
9469 return obj;
9472 #if _MSVCP_VER >= 70
9474 /* ?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 */
9475 /* ?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 */
9476 /* ?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 */
9477 /* ?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 */
9478 #if _MSVCP_VER != 80
9479 DEFINE_THISCALL_WRAPPER(time_put_wchar_do_put, 36)
9480 #else
9481 DEFINE_THISCALL_WRAPPER(time_put_wchar_do_put, 40)
9482 #endif
9483 #if _MSVCP_VER <= 100
9484 #define call_time_put_wchar_do_put(this, ret, dest, base, fill, t, spec, mod) CALL_VTBL_FUNC(this, 4, ostreambuf_iterator_wchar*, \
9485 (const time_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, const struct tm*, char, char), \
9486 (this, ret, dest, base, fill, t, spec, mod))
9487 #else
9488 #define call_time_put_wchar_do_put(this, ret, dest, base, fill, t, spec, mod) CALL_VTBL_FUNC(this, 12, ostreambuf_iterator_wchar*, \
9489 (const time_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, wchar_t, const struct tm*, char, char), \
9490 (this, ret, dest, base, fill, t, spec, mod))
9491 #endif
9492 ostreambuf_iterator_wchar* __thiscall time_put_wchar_do_put(const time_put *this,
9493 ostreambuf_iterator_wchar *ret, ostreambuf_iterator_wchar dest, ios_base *base,
9494 wchar_t fill, const struct tm *t, char spec, char mod)
9496 char buf[64], fmt[4], *p = fmt;
9497 MSVCP_size_t i, len;
9498 wchar_t c;
9500 TRACE("(%p %p %p %c %p %c %c)\n", this, ret, base, fill, t, spec, mod);
9502 *p++ = '%';
9503 if(mod)
9504 *p++ = mod;
9505 *p++ = spec;
9506 *p++ = 0;
9508 len = _Strftime(buf, sizeof(buf), fmt, t, this->time.timeptr);
9509 for(i=0; i<len; i++) {
9510 c = mb_to_wc(buf[i], &this->cvt);
9511 ostreambuf_iterator_wchar_put(&dest, c);
9514 *ret = dest;
9515 return ret;
9518 /* ?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 */
9519 /* ?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 */
9520 /* ?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 */
9521 /* ?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 */
9522 #if _MSVCP_VER != 80
9523 DEFINE_THISCALL_WRAPPER(time_put_wchar_put, 36)
9524 #else
9525 DEFINE_THISCALL_WRAPPER(time_put_wchar_put, 40)
9526 #endif
9527 ostreambuf_iterator_wchar* __thiscall time_put_wchar_put(const time_put *this,
9528 ostreambuf_iterator_wchar *ret, ostreambuf_iterator_wchar dest, ios_base *base,
9529 wchar_t fill, const struct tm *t, char spec, char mod)
9531 TRACE("(%p %p %p %c %p %c %c)\n", this, ret, base, fill, t, spec, mod);
9532 return call_time_put_wchar_do_put(this, ret, dest, base, fill, t, spec, mod);
9535 /* ?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 */
9536 /* ?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 */
9537 /* ?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 */
9538 /* ?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 */
9539 #if _MSVCP_VER != 80
9540 DEFINE_THISCALL_WRAPPER(time_put_wchar_put_format, 36)
9541 #else
9542 DEFINE_THISCALL_WRAPPER(time_put_wchar_put_format, 40)
9543 #endif
9544 ostreambuf_iterator_wchar* __thiscall time_put_wchar_put_format(const time_put *this,
9545 ostreambuf_iterator_wchar *ret, ostreambuf_iterator_wchar dest, ios_base *base,
9546 wchar_t fill, const struct tm *t, const wchar_t *pat, const wchar_t *pat_end)
9548 wchar_t percent = mb_to_wc('%', &this->cvt);
9549 char c[MB_LEN_MAX];
9551 TRACE("(%p %p %p %c %p %s)\n", this, ret, base, fill, t, debugstr_wn(pat, pat_end-pat));
9553 while(pat < pat_end) {
9554 if(*pat != percent) {
9555 ostreambuf_iterator_wchar_put(&dest, *pat++);
9556 }else if(++pat == pat_end) {
9557 ostreambuf_iterator_wchar_put(&dest, percent);
9558 }else if(_Wcrtomb(c, *pat, NULL, &this->cvt)!=1 || (*c=='#' && pat+1==pat_end)) {
9559 ostreambuf_iterator_wchar_put(&dest, percent);
9560 ostreambuf_iterator_wchar_put(&dest, *pat++);
9561 }else {
9562 pat++;
9563 if(*c == '#') {
9564 if(_Wcrtomb(c, *pat++, NULL, &this->cvt) != 1) {
9565 ostreambuf_iterator_wchar_put(&dest, percent);
9566 ostreambuf_iterator_wchar_put(&dest, *(pat-2));
9567 ostreambuf_iterator_wchar_put(&dest, *(pat-1));
9568 }else {
9569 time_put_wchar_put(this, &dest, dest, base, fill, t, *c, '#');
9571 }else {
9572 time_put_wchar_put(this, &dest, dest, base, fill, t, *c, 0);
9577 *ret = dest;
9578 return ret;
9581 #else /* _MSVCP_VER < 70 doesn't have the 'fill' parameter */
9583 /* ?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 */
9584 /* ?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 */
9585 DEFINE_THISCALL_WRAPPER(time_put_wchar_do_put, 32)
9586 #define call_time_put_wchar_do_put(this, ret, dest, base, t, spec, mod) CALL_VTBL_FUNC(this, 4, ostreambuf_iterator_wchar*, \
9587 (const time_put*, ostreambuf_iterator_wchar*, ostreambuf_iterator_wchar, ios_base*, const struct tm*, char, char), \
9588 (this, ret, dest, base, t, spec, mod))
9589 ostreambuf_iterator_wchar* __thiscall time_put_wchar_do_put(const time_put *this,
9590 ostreambuf_iterator_wchar *ret, ostreambuf_iterator_wchar dest, ios_base *base,
9591 const struct tm *t, char spec, char mod)
9593 char buf[64], fmt[4], *p = fmt;
9594 MSVCP_size_t i, len;
9595 wchar_t c;
9597 TRACE("(%p %p %p %p %c %c)\n", this, ret, base, t, spec, mod);
9599 *p++ = '%';
9600 if(mod)
9601 *p++ = mod;
9602 *p++ = spec;
9603 *p++ = 0;
9605 len = _Strftime(buf, sizeof(buf), fmt, t, this->time.timeptr);
9606 for(i=0; i<len; i++) {
9607 c = mb_to_wc(buf[i], &this->cvt);
9608 ostreambuf_iterator_wchar_put(&dest, c);
9611 *ret = dest;
9612 return ret;
9615 /* ?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 */
9616 /* ?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 */
9617 DEFINE_THISCALL_WRAPPER(time_put_wchar_put, 32)
9618 ostreambuf_iterator_wchar* __thiscall time_put_wchar_put(const time_put *this,
9619 ostreambuf_iterator_wchar *ret, ostreambuf_iterator_wchar dest, ios_base *base,
9620 const struct tm *t, char spec, char mod)
9622 TRACE("(%p %p %p %p %c %c)\n", this, ret, base, t, spec, mod);
9623 return call_time_put_wchar_do_put(this, ret, dest, base, t, spec, mod);
9626 /* ?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 */
9627 /* ?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 */
9628 DEFINE_THISCALL_WRAPPER(time_put_wchar_put_format, 32)
9629 ostreambuf_iterator_wchar* __thiscall time_put_wchar_put_format(const time_put *this,
9630 ostreambuf_iterator_wchar *ret, ostreambuf_iterator_wchar dest, ios_base *base,
9631 const struct tm *t, const wchar_t *pat, const wchar_t *pat_end)
9633 wchar_t percent = mb_to_wc('%', &this->cvt);
9634 char c[MB_LEN_MAX];
9636 TRACE("(%p %p %p %p %s)\n", this, ret, base, t, debugstr_wn(pat, pat_end-pat));
9638 while(pat < pat_end) {
9639 if(*pat != percent) {
9640 ostreambuf_iterator_wchar_put(&dest, *pat++);
9641 }else if(++pat == pat_end) {
9642 ostreambuf_iterator_wchar_put(&dest, percent);
9643 }else if(_Wcrtomb(c, *pat, NULL, &this->cvt)!=1 || (*c=='#' && pat+1==pat_end)) {
9644 ostreambuf_iterator_wchar_put(&dest, percent);
9645 ostreambuf_iterator_wchar_put(&dest, *pat++);
9646 }else {
9647 pat++;
9648 if(*c == '#') {
9649 if(_Wcrtomb(c, *pat++, NULL, &this->cvt) != 1) {
9650 ostreambuf_iterator_wchar_put(&dest, percent);
9651 ostreambuf_iterator_wchar_put(&dest, *(pat-2));
9652 ostreambuf_iterator_wchar_put(&dest, *(pat-1));
9653 }else {
9654 time_put_wchar_put(this, &dest, dest, base, t, *c, '#');
9656 }else {
9657 time_put_wchar_put(this, &dest, dest, base, t, *c, 0);
9662 *ret = dest;
9663 return ret;
9666 #endif /* _MSVCP_VER >= 70 */
9668 /* ?id@?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@2V0locale@2@A */
9669 locale_id time_get_char_id = {0};
9671 /* ??_7?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@6B@ */
9672 extern const vtable_ptr MSVCP_time_get_char_vtable;
9674 /* ?_Init@?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@IAEXABV_Locinfo@2@@Z */
9675 /* ?_Init@?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@IEAAXAEBV_Locinfo@2@@Z */
9676 DEFINE_THISCALL_WRAPPER(time_get_char__Init, 8)
9677 void __thiscall time_get_char__Init(time_get_char *this, const _Locinfo *locinfo)
9679 const char *months;
9680 const char *days;
9681 int len;
9683 TRACE("(%p %p)\n", this, locinfo);
9685 days = _Locinfo__Getdays(locinfo);
9686 len = strlen(days)+1;
9687 this->days = MSVCRT_operator_new(len);
9688 if(!this->days)
9690 ERR("Out of memory\n");
9691 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
9693 memcpy((char*)this->days, days, len);
9695 months = _Locinfo__Getmonths(locinfo);
9696 len = strlen(months)+1;
9697 this->months = MSVCRT_operator_new(len);
9698 if(!this->months)
9700 MSVCRT_operator_delete((char*)this->days);
9702 ERR("Out of memory\n");
9703 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
9705 memcpy((char*)this->months, months, len);
9707 this->dateorder = _Locinfo__Getdateorder(locinfo);
9708 _Locinfo__Getcvt(locinfo, &this->cvt);
9711 /* ??0?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAE@ABV_Locinfo@1@I@Z */
9712 /* ??0?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAA@AEBV_Locinfo@1@_K@Z */
9713 DEFINE_THISCALL_WRAPPER(time_get_char_ctor_locinfo, 12)
9714 time_get_char* __thiscall time_get_char_ctor_locinfo(time_get_char *this,
9715 const _Locinfo *locinfo, MSVCP_size_t refs)
9717 TRACE("(%p %p %lu)\n", this, locinfo, refs);
9718 locale_facet_ctor_refs(&this->facet, refs);
9719 this->facet.vtable = &MSVCP_time_get_char_vtable;
9720 time_get_char__Init(this, locinfo);
9721 return this;
9724 /* ??0?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@IAE@PBDI@Z */
9725 /* ??0?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@IEAA@PEBD_K@Z */
9726 DEFINE_THISCALL_WRAPPER(time_get_char_ctor_name, 12)
9727 time_get_char* __thiscall time_get_char_ctor_name(time_get_char *this, const char *name, MSVCP_size_t refs)
9729 _Locinfo locinfo;
9731 TRACE("(%p %s %lu)\n", this, name, refs);
9733 _Locinfo_ctor_cstr(&locinfo, name);
9734 time_get_char_ctor_locinfo(this, &locinfo, refs);
9735 _Locinfo_dtor(&locinfo);
9736 return this;
9739 /* ??0?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAE@I@Z */
9740 /* ??0?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAA@_K@Z */
9741 DEFINE_THISCALL_WRAPPER(time_get_char_ctor_refs, 8)
9742 time_get_char* __thiscall time_get_char_ctor_refs(time_get_char *this, MSVCP_size_t refs)
9744 _Locinfo locinfo;
9746 TRACE("(%p %lu)\n", this, refs);
9748 _Locinfo_ctor(&locinfo);
9749 time_get_char_ctor_locinfo(this, &locinfo, refs);
9750 _Locinfo_dtor(&locinfo);
9751 return this;
9754 /* ??_F?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QAEXXZ */
9755 /* ??_F?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEAAXXZ */
9756 DEFINE_THISCALL_WRAPPER(time_get_char_ctor, 4)
9757 time_get_char* __thiscall time_get_char_ctor(time_get_char *this)
9759 return time_get_char_ctor_refs(this, 0);
9762 /* ?_Tidy@?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@AAEXXZ */
9763 /* ?_Tidy@?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@AEAAXXZ */
9764 DEFINE_THISCALL_WRAPPER(time_get_char__Tidy, 4)
9765 void __thiscall time_get_char__Tidy(time_get_char *this)
9767 TRACE("(%p)\n", this);
9769 MSVCRT_operator_delete((char*)this->days);
9770 MSVCRT_operator_delete((char*)this->months);
9773 /* ??1?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MAE@XZ */
9774 /* ??1?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MEAA@XZ */
9775 DEFINE_THISCALL_WRAPPER(time_get_char_dtor, 4) /* virtual */
9776 void __thiscall time_get_char_dtor(time_get_char *this)
9778 TRACE("(%p)\n", this);
9780 time_get_char__Tidy(this);
9783 DEFINE_THISCALL_WRAPPER(time_get_char_vector_dtor, 8)
9784 time_get_char* __thiscall time_get_char_vector_dtor(time_get_char *this, unsigned int flags)
9786 TRACE("(%p %x)\n", this, flags);
9787 if(flags & 2) {
9788 /* we have an array, with the number of elements stored before the first object */
9789 INT_PTR i, *ptr = (INT_PTR *)this-1;
9791 for(i=*ptr-1; i>=0; i--)
9792 time_get_char_dtor(this+i);
9793 MSVCRT_operator_delete(ptr);
9794 } else {
9795 time_get_char_dtor(this);
9796 if(flags & 1)
9797 MSVCRT_operator_delete(this);
9800 return this;
9803 /* ?_Getcat@?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SAIPAPBVfacet@locale@2@PBV42@@Z */
9804 /* ?_Getcat@?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z */
9805 unsigned int __cdecl time_get_char__Getcat(const locale_facet **facet, const locale *loc)
9807 TRACE("(%p %p)\n", facet, loc);
9809 if(facet && !*facet) {
9810 _Locinfo locinfo;
9812 *facet = MSVCRT_operator_new(sizeof(time_get_char));
9813 if(!*facet) {
9814 ERR("Out of memory\n");
9815 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
9816 return 0;
9819 _Locinfo_ctor_cstr(&locinfo, locale_string_char_c_str(&loc->ptr->name));
9820 time_get_char_ctor_locinfo((time_get_char*)*facet, &locinfo, 0);
9821 _Locinfo_dtor(&locinfo);
9824 return LC_TIME;
9827 static time_get_char* time_get_char_use_facet(const locale *loc)
9829 static time_get_char *obj = NULL;
9831 _Lockit lock;
9832 const locale_facet *fac;
9834 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
9835 fac = locale__Getfacet(loc, locale_id_operator_size_t(&time_get_char_id));
9836 if(fac) {
9837 _Lockit_dtor(&lock);
9838 return (time_get_char*)fac;
9841 if(obj) {
9842 _Lockit_dtor(&lock);
9843 return obj;
9846 time_get_char__Getcat(&fac, loc);
9847 obj = (time_get_char*)fac;
9848 call_locale_facet__Incref(&obj->facet);
9849 locale_facet_register(&obj->facet);
9850 _Lockit_dtor(&lock);
9852 return obj;
9855 /* ?_Getint@?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@ABAHAAV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@0HHAAH@Z */
9856 /* ?_Getint@?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@AEBAHAEAV?$istreambuf_iterator@DU?$char_traits@D@std@@@2@0HHAEAH@Z */
9857 int __cdecl time_get_char__Getint(const time_get_char *this,
9858 istreambuf_iterator_char *b, istreambuf_iterator_char *e,
9859 int unk1, int unk2, int *val)
9861 FIXME("(%p %p %p %d %d %p) stub\n", this, b, e, unk1, unk2, val);
9862 return 0;
9865 /* ?do_date_order@?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MBE?AW4dateorder@time_base@2@XZ */
9866 /* ?do_date_order@?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@MEBA?AW4dateorder@time_base@2@XZ */
9867 DEFINE_THISCALL_WRAPPER(time_get_char_do_date_order, 4) /* virtual */
9868 #if _MSVCP_VER <= 100
9869 #define call_time_get_char_do_date_order(this) CALL_VTBL_FUNC(this, 4, dateorder, (const time_get_char*), (this))
9870 #else
9871 #define call_time_get_char_do_date_order(this) CALL_VTBL_FUNC(this, 12, dateorder, (const time_get_char*), (this))
9872 #endif
9873 dateorder __thiscall time_get_char_do_date_order(const time_get_char *this)
9875 TRACE("(%p)\n", this);
9876 return this->dateorder;
9879 /* ?date_order@?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QBE?AW4dateorder@time_base@2@XZ */
9880 /* ?date_order@?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QEBA?AW4dateorder@time_base@2@XZ */
9881 DEFINE_THISCALL_WRAPPER(time_get_char_date_order, 4)
9882 dateorder __thiscall time_get_char_date_order(const time_get_char *this)
9884 return call_time_get_char_do_date_order(this);
9887 /* ?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 */
9888 /* ?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 */
9889 DEFINE_THISCALL_WRAPPER(time_get_char_do_get_date, 36) /* virtual */
9890 #if _MSVCP_VER <= 100
9891 #define call_time_get_char_do_get_date(this, ret, s, e, base, err, t) CALL_VTBL_FUNC(this, 12, istreambuf_iterator_char*, \
9892 (const time_get_char*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, struct tm*), \
9893 (this, ret, s, e, base, err, t))
9894 #else
9895 #define call_time_get_char_do_get_date(this, ret, s, e, base, err, t) CALL_VTBL_FUNC(this, 20, istreambuf_iterator_char*, \
9896 (const time_get_char*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, struct tm*), \
9897 (this, ret, s, e, base, err, t))
9898 #endif
9899 istreambuf_iterator_char* __thiscall time_get_char_do_get_date(const time_get_char *this,
9900 istreambuf_iterator_char *ret, istreambuf_iterator_char s, istreambuf_iterator_char e,
9901 ios_base *base, int *err, struct tm *t)
9903 FIXME("(%p %p %p %p %p) stub\n", this, ret, base, err, t);
9904 return NULL;
9907 /* ?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 */
9908 /* ?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 */
9909 DEFINE_THISCALL_WRAPPER(time_get_char_get_date, 36)
9910 istreambuf_iterator_char* __thiscall time_get_char_get_date(const time_get_char *this,
9911 istreambuf_iterator_char *ret, istreambuf_iterator_char s, istreambuf_iterator_char e,
9912 ios_base *base, int *err, struct tm *t)
9914 return call_time_get_char_do_get_date(this, ret, s, e, base, err, t);
9917 /* ?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 */
9918 /* ?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 */
9919 DEFINE_THISCALL_WRAPPER(time_get_char_do_get_monthname, 36) /* virtual */
9920 #if _MSVCP_VER <= 100
9921 #define call_time_get_char_do_get_monthname(this, ret, s, e, base, err, t) CALL_VTBL_FUNC(this, 20, istreambuf_iterator_char*, \
9922 (const time_get_char*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, struct tm*), \
9923 (this, ret, s, e, base, err, t))
9924 #else
9925 #define call_time_get_char_do_get_monthname(this, ret, s, e, base, err, t) CALL_VTBL_FUNC(this, 28, istreambuf_iterator_char*, \
9926 (const time_get_char*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, struct tm*), \
9927 (this, ret, s, e, base, err, t))
9928 #endif
9929 istreambuf_iterator_char* __thiscall time_get_char_do_get_monthname(const time_get_char *this,
9930 istreambuf_iterator_char *ret, istreambuf_iterator_char s, istreambuf_iterator_char e,
9931 ios_base *base, int *err, struct tm *t)
9933 FIXME("(%p %p %p %p %p) stub\n", this, ret, base, err, t);
9934 return NULL;
9937 /* ?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 */
9938 /* ?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 */
9939 DEFINE_THISCALL_WRAPPER(time_get_char_get_monthname, 36)
9940 istreambuf_iterator_char* __thiscall time_get_char_get_monthname(const time_get_char *this,
9941 istreambuf_iterator_char *ret, istreambuf_iterator_char s, istreambuf_iterator_char e,
9942 ios_base *base, int *err, struct tm *t)
9944 return call_time_get_char_do_get_monthname(this, ret, s, e, base, err, t);
9947 /* ?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 */
9948 /* ?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 */
9949 DEFINE_THISCALL_WRAPPER(time_get_char_do_get_time, 36) /* virtual */
9950 #if _MSVCP_VER <= 100
9951 #define call_time_get_char_do_get_time(this, ret, s, e, base, err, t) CALL_VTBL_FUNC(this, 8, istreambuf_iterator_char*, \
9952 (const time_get_char*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, struct tm*), \
9953 (this, ret, s, e, base, err, t))
9954 #else
9955 #define call_time_get_char_do_get_time(this, ret, s, e, base, err, t) CALL_VTBL_FUNC(this, 16, istreambuf_iterator_char*, \
9956 (const time_get_char*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, struct tm*), \
9957 (this, ret, s, e, base, err, t))
9958 #endif
9959 istreambuf_iterator_char* __thiscall time_get_char_do_get_time(const time_get_char *this,
9960 istreambuf_iterator_char *ret, istreambuf_iterator_char s, istreambuf_iterator_char e,
9961 ios_base *base, int *err, struct tm *t)
9963 FIXME("(%p %p %p %p %p) stub\n", this, ret, base, err, t);
9964 return NULL;
9967 /* ?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 */
9968 /* ?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 */
9969 DEFINE_THISCALL_WRAPPER(time_get_char_get_time, 36)
9970 istreambuf_iterator_char* __thiscall time_get_char_get_time(const time_get_char *this,
9971 istreambuf_iterator_char *ret, istreambuf_iterator_char s, istreambuf_iterator_char e,
9972 ios_base *base, int *err, struct tm *t)
9974 return call_time_get_char_do_get_time(this, ret, s, e, base, err, t);
9977 /* ?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 */
9978 /* ?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 */
9979 DEFINE_THISCALL_WRAPPER(time_get_char_do_get_weekday, 36) /* virtual */
9980 #if _MSVCP_VER <= 100
9981 #define call_time_get_char_do_get_weekday(this, ret, s, e, base, err, t) CALL_VTBL_FUNC(this, 16, istreambuf_iterator_char*, \
9982 (const time_get_char*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, struct tm*), \
9983 (this, ret, s, e, base, err, t))
9984 #else
9985 #define call_time_get_char_do_get_weekday(this, ret, s, e, base, err, t) CALL_VTBL_FUNC(this, 24, istreambuf_iterator_char*, \
9986 (const time_get_char*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, struct tm*), \
9987 (this, ret, s, e, base, err, t))
9988 #endif
9989 istreambuf_iterator_char* __thiscall time_get_char_do_get_weekday(const time_get_char *this,
9990 istreambuf_iterator_char *ret, istreambuf_iterator_char s, istreambuf_iterator_char e,
9991 ios_base *base, int *err, struct tm *t)
9993 FIXME("(%p %p %p %p %p) stub\n", this, ret, base, err, t);
9994 return NULL;
9997 /* ?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 */
9998 /* ?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 */
9999 DEFINE_THISCALL_WRAPPER(time_get_char_get_weekday, 36)
10000 istreambuf_iterator_char* __thiscall time_get_char_get_weekday(const time_get_char *this,
10001 istreambuf_iterator_char *ret, istreambuf_iterator_char s, istreambuf_iterator_char e,
10002 ios_base *base, int *err, struct tm *t)
10004 return call_time_get_char_do_get_weekday(this, ret, s, e, base, err, t);
10007 /* ?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 */
10008 /* ?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 */
10009 DEFINE_THISCALL_WRAPPER(time_get_char_do_get_year, 36) /* virtual */
10010 #if _MSVCP_VER <= 100
10011 #define call_time_get_char_do_get_year(this, ret, s, e, base, err, t) CALL_VTBL_FUNC(this, 24, istreambuf_iterator_char*, \
10012 (const time_get_char*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, struct tm*), \
10013 (this, ret, s, e, base, err, t))
10014 #else
10015 #define call_time_get_char_do_get_year(this, ret, s, e, base, err, t) CALL_VTBL_FUNC(this, 32, istreambuf_iterator_char*, \
10016 (const time_get_char*, istreambuf_iterator_char*, istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, struct tm*), \
10017 (this, ret, s, e, base, err, t))
10018 #endif
10019 istreambuf_iterator_char* __thiscall time_get_char_do_get_year(const time_get_char *this,
10020 istreambuf_iterator_char *ret, istreambuf_iterator_char s, istreambuf_iterator_char e,
10021 ios_base *base, int *err, struct tm *t)
10023 FIXME("(%p %p %p %p %p) stub\n", this, ret, base, err, t);
10024 return NULL;
10027 /* ?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 */
10028 /* ?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 */
10029 DEFINE_THISCALL_WRAPPER(time_get_char_get_year, 36)
10030 istreambuf_iterator_char* __thiscall time_get_char_get_year(const time_get_char *this,
10031 istreambuf_iterator_char *ret, istreambuf_iterator_char s, istreambuf_iterator_char e,
10032 ios_base *base, int *err, struct tm *t)
10034 return call_time_get_char_do_get_year(this, ret, s, e, base, err, t);
10037 /* ??_7_Locimp@locale@std@@6B@ */
10038 extern const vtable_ptr MSVCP_locale__Locimp_vtable;
10040 /* ??0_Locimp@locale@std@@AAE@_N@Z */
10041 /* ??0_Locimp@locale@std@@AEAA@_N@Z */
10042 DEFINE_THISCALL_WRAPPER(locale__Locimp_ctor_transparent, 8)
10043 locale__Locimp* __thiscall locale__Locimp_ctor_transparent(locale__Locimp *this, MSVCP_bool transparent)
10045 TRACE("(%p %d)\n", this, transparent);
10047 memset(this, 0, sizeof(locale__Locimp));
10048 locale_facet_ctor_refs(&this->facet, 1);
10049 this->facet.vtable = &MSVCP_locale__Locimp_vtable;
10050 this->transparent = transparent;
10051 locale_string_char_ctor_cstr(&this->name, "*");
10052 return this;
10055 /* ??_F_Locimp@locale@std@@QAEXXZ */
10056 /* ??_F_Locimp@locale@std@@QEAAXXZ */
10057 DEFINE_THISCALL_WRAPPER(locale__Locimp_ctor, 4)
10058 locale__Locimp* __thiscall locale__Locimp_ctor(locale__Locimp *this)
10060 return locale__Locimp_ctor_transparent(this, FALSE);
10063 /* ??0_Locimp@locale@std@@AAE@ABV012@@Z */
10064 /* ??0_Locimp@locale@std@@AEAA@AEBV012@@Z */
10065 DEFINE_THISCALL_WRAPPER(locale__Locimp_copy_ctor, 8)
10066 locale__Locimp* __thiscall locale__Locimp_copy_ctor(locale__Locimp *this, const locale__Locimp *copy)
10068 _Lockit lock;
10069 MSVCP_size_t i;
10071 TRACE("(%p %p)\n", this, copy);
10073 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
10074 memcpy(this, copy, sizeof(locale__Locimp));
10075 locale_facet_ctor_refs(&this->facet, 1);
10076 this->facet.vtable = &MSVCP_locale__Locimp_vtable;
10077 if(copy->facetvec) {
10078 this->facetvec = MSVCRT_operator_new(copy->facet_cnt*sizeof(locale_facet*));
10079 if(!this->facetvec) {
10080 _Lockit_dtor(&lock);
10081 ERR("Out of memory\n");
10082 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10083 return NULL;
10085 for(i=0; i<this->facet_cnt; i++)
10087 this->facetvec[i] = copy->facetvec[i];
10088 if(this->facetvec[i])
10089 call_locale_facet__Incref(this->facetvec[i]);
10092 locale_string_char_copy_ctor(&this->name, &copy->name);
10093 _Lockit_dtor(&lock);
10094 return this;
10097 /* ?_Locimp_ctor@_Locimp@locale@std@@CAXPAV123@ABV123@@Z */
10098 /* ?_Locimp_ctor@_Locimp@locale@std@@CAXPEAV123@AEBV123@@Z */
10099 locale__Locimp* __cdecl locale__Locimp__Locimp_ctor(locale__Locimp *this, const locale__Locimp *copy)
10101 return locale__Locimp_copy_ctor(this, copy);
10104 /* ??1_Locimp@locale@std@@MAE@XZ */
10105 /* ??1_Locimp@locale@std@@MEAA@XZ */
10106 DEFINE_THISCALL_WRAPPER(locale__Locimp_dtor, 4)
10107 void __thiscall locale__Locimp_dtor(locale__Locimp *this)
10109 MSVCP_size_t i;
10111 TRACE("(%p)\n", this);
10113 locale_facet_dtor(&this->facet);
10114 for(i=0; i<this->facet_cnt; i++)
10115 if(this->facetvec[i] && call_locale_facet__Decref(this->facetvec[i]))
10116 call_locale_facet_vector_dtor(this->facetvec[i], 1);
10118 MSVCRT_operator_delete(this->facetvec);
10119 locale_string_char_dtor(&this->name);
10122 /* ?_Locimp_dtor@_Locimp@locale@std@@CAXPAV123@@Z */
10123 /* ?_Locimp_dtor@_Locimp@locale@std@@CAXPEAV123@@Z */
10124 void __cdecl locale__Locimp__Locimp_dtor(locale__Locimp *this)
10126 locale__Locimp_dtor(this);
10129 DEFINE_THISCALL_WRAPPER(locale__Locimp_vector_dtor, 8)
10130 locale__Locimp* __thiscall locale__Locimp_vector_dtor(locale__Locimp *this, unsigned int flags)
10132 TRACE("(%p %x)\n", this, flags);
10133 if(flags & 2) {
10134 /* we have an array, with the number of elements stored before the first object */
10135 INT_PTR i, *ptr = (INT_PTR *)this-1;
10137 for(i=*ptr-1; i>=0; i--)
10138 locale__Locimp_dtor(this+i);
10139 MSVCRT_operator_delete(ptr);
10140 } else {
10141 locale__Locimp_dtor(this);
10142 if(flags & 1)
10143 MSVCRT_operator_delete(this);
10146 return this;
10149 /* ?_New_Locimp@_Locimp@locale@std@@CAPAV123@ABV123@@Z */
10150 /* ?_New_Locimp@_Locimp@locale@std@@CAPEAV123@AEBV123@@Z */
10151 locale__Locimp* __cdecl locale__Locimp__New_Locimp(const locale__Locimp *copy)
10153 locale__Locimp *ret;
10155 TRACE("(%p)\n", copy);
10157 ret = MSVCRT_operator_new(sizeof(locale__Locimp));
10158 if(!ret) {
10159 ERR("Out of memory\n");
10160 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10161 return NULL;
10163 return locale__Locimp_copy_ctor(ret, copy);
10166 /* ?_New_Locimp@_Locimp@locale@std@@CAPAV123@_N@Z */
10167 /* ?_New_Locimp@_Locimp@locale@std@@CAPEAV123@_N@Z */
10168 locale__Locimp* __cdecl locale__Locimp__New_Locimp_transparent(MSVCP_bool transparent)
10170 locale__Locimp *ret;
10172 TRACE("(%x)\n", transparent);
10174 ret = MSVCRT_operator_new(sizeof(locale__Locimp));
10175 if(!ret) {
10176 ERR("Out of memory\n");
10177 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10178 return NULL;
10180 return locale__Locimp_ctor_transparent(ret, transparent);
10183 /* ?_Locimp_Addfac@_Locimp@locale@std@@CAXPAV123@PAVfacet@23@I@Z */
10184 /* ?_Locimp_Addfac@_Locimp@locale@std@@CAXPEAV123@PEAVfacet@23@_K@Z */
10185 void __cdecl locale__Locimp__Locimp_Addfac(locale__Locimp *locimp, locale_facet *facet, MSVCP_size_t id)
10187 _Lockit lock;
10189 TRACE("(%p %p %lu)\n", locimp, facet, id);
10191 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
10192 if(id >= locimp->facet_cnt) {
10193 MSVCP_size_t new_size = id+1;
10194 locale_facet **new_facetvec;
10196 if(new_size < locale_id__Id_cnt+1)
10197 new_size = locale_id__Id_cnt+1;
10199 new_facetvec = MSVCRT_operator_new(sizeof(locale_facet*)*new_size);
10200 if(!new_facetvec) {
10201 _Lockit_dtor(&lock);
10202 ERR("Out of memory\n");
10203 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10204 return;
10207 memset(new_facetvec, 0, sizeof(locale_facet*)*new_size);
10208 memcpy(new_facetvec, locimp->facetvec, sizeof(locale_facet*)*locimp->facet_cnt);
10209 MSVCRT_operator_delete(locimp->facetvec);
10210 locimp->facetvec = new_facetvec;
10211 locimp->facet_cnt = new_size;
10214 if(locimp->facetvec[id] && call_locale_facet__Decref(locimp->facetvec[id]))
10215 call_locale_facet_vector_dtor(locimp->facetvec[id], 1);
10217 locimp->facetvec[id] = facet;
10218 if(facet)
10219 call_locale_facet__Incref(facet);
10220 _Lockit_dtor(&lock);
10223 /* ?_Addfac@_Locimp@locale@std@@AAEXPAVfacet@23@I@Z */
10224 /* ?_Addfac@_Locimp@locale@std@@AEAAXPEAVfacet@23@_K@Z */
10225 DEFINE_THISCALL_WRAPPER(locale__Locimp__Addfac, 12)
10226 void __thiscall locale__Locimp__Addfac(locale__Locimp *this, locale_facet *facet, MSVCP_size_t id)
10228 locale__Locimp__Locimp_Addfac(this, facet, id);
10231 /* ?_Clocptr_func@_Locimp@locale@std@@CAAAPAV123@XZ */
10232 /* ?_Clocptr_func@_Locimp@locale@std@@CAAEAPEAV123@XZ */
10233 locale__Locimp** __cdecl locale__Locimp__Clocptr_func(void)
10235 FIXME("stub\n");
10236 return NULL;
10239 /* ?_Makeushloc@_Locimp@locale@std@@CAXABV_Locinfo@3@HPAV123@PBV23@@Z */
10240 /* ?_Makeushloc@_Locimp@locale@std@@CAXAEBV_Locinfo@3@HPEAV123@PEBV23@@Z */
10241 /* List of missing facets:
10242 * messages, money_get, money_put, moneypunct, moneypunct, time_get
10244 void __cdecl locale__Locimp__Makeushloc(const _Locinfo *locinfo, category cat, locale__Locimp *locimp, const locale *loc)
10246 FIXME("(%p %d %p %p) semi-stub\n", locinfo, cat, locimp, loc);
10248 if(cat & (1<<(ctype_short__Getcat(NULL, NULL)-1))) {
10249 ctype_wchar *ctype;
10251 if(loc) {
10252 ctype = ctype_short_use_facet(loc);
10253 }else {
10254 ctype = MSVCRT_operator_new(sizeof(ctype_wchar));
10255 if(!ctype) {
10256 ERR("Out of memory\n");
10257 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10259 ctype_short_ctor_locinfo(ctype, locinfo, 0);
10261 locale__Locimp__Addfac(locimp, &ctype->base.facet, locale_id_operator_size_t(&ctype_short_id));
10264 if(cat & (1<<(num_get_short__Getcat(NULL, NULL)-1))) {
10265 num_get *numget;
10267 if(loc) {
10268 numget = num_get_short_use_facet(loc);
10269 }else {
10270 numget = MSVCRT_operator_new(sizeof(num_get));
10271 if(!numget) {
10272 ERR("Out of memory\n");
10273 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10275 num_get_short_ctor_locinfo(numget, locinfo, 0);
10277 locale__Locimp__Addfac(locimp, &numget->facet, locale_id_operator_size_t(&num_get_short_id));
10280 if(cat & (1<<(num_put_short__Getcat(NULL, NULL)-1))) {
10281 num_put *numput;
10283 if(loc) {
10284 numput = num_put_short_use_facet(loc);
10285 }else {
10286 numput = MSVCRT_operator_new(sizeof(num_put));
10287 if(!numput) {
10288 ERR("Out of memory\n");
10289 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10291 num_put_short_ctor_locinfo(numput, locinfo, 0);
10293 locale__Locimp__Addfac(locimp, &numput->facet, locale_id_operator_size_t(&num_put_short_id));
10296 if(cat & (1<<(numpunct_short__Getcat(NULL, NULL)-1))) {
10297 numpunct_wchar *numpunct;
10299 if(loc) {
10300 numpunct = numpunct_short_use_facet(loc);
10301 }else {
10302 numpunct = MSVCRT_operator_new(sizeof(numpunct_wchar));
10303 if(!numpunct) {
10304 ERR("Out of memory\n");
10305 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10307 numpunct_short_ctor_locinfo(numpunct, locinfo, 0, FALSE);
10309 locale__Locimp__Addfac(locimp, &numpunct->facet, locale_id_operator_size_t(&numpunct_short_id));
10312 if(cat & (1<<(collate_short__Getcat(NULL, NULL)-1))) {
10313 collate *c;
10315 if(loc) {
10316 c = collate_short_use_facet(loc);
10317 }else {
10318 c = MSVCRT_operator_new(sizeof(collate));
10319 if(!c) {
10320 ERR("Out of memory\n");
10321 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10323 collate_short_ctor_locinfo(c, locinfo, 0);
10325 locale__Locimp__Addfac(locimp, &c->facet, locale_id_operator_size_t(&collate_short_id));
10328 if(cat & (1<<(time_put_short__Getcat(NULL, NULL)-1))) {
10329 time_put *t;
10331 if(loc) {
10332 t = time_put_short_use_facet(loc);
10333 }else {
10334 t = MSVCRT_operator_new(sizeof(time_put));
10335 if(!t) {
10336 ERR("Out of memory\n");
10337 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10339 time_put_short_ctor_locinfo(t, locinfo, 0);
10341 locale__Locimp__Addfac(locimp, &t->facet, locale_id_operator_size_t(&time_put_short_id));
10344 if(cat & (1<<(codecvt_short__Getcat(NULL, NULL)-1))) {
10345 codecvt_wchar *codecvt;
10347 if(loc) {
10348 codecvt = codecvt_short_use_facet(loc);
10349 }else {
10350 codecvt = MSVCRT_operator_new(sizeof(codecvt_wchar));
10351 if(!codecvt) {
10352 ERR("Out of memory\n");
10353 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10355 codecvt_short_ctor_locinfo(codecvt, locinfo, 0);
10357 locale__Locimp__Addfac(locimp, &codecvt->base.facet, locale_id_operator_size_t(&codecvt_short_id));
10361 /* ?_Makewloc@_Locimp@locale@std@@CAXABV_Locinfo@3@HPAV123@PBV23@@Z */
10362 /* ?_Makewloc@_Locimp@locale@std@@CAXAEBV_Locinfo@3@HPEAV123@PEBV23@@Z */
10363 /* List of missing facets:
10364 * messages, money_get, money_put, moneypunct, moneypunct, time_get
10366 void __cdecl locale__Locimp__Makewloc(const _Locinfo *locinfo, category cat, locale__Locimp *locimp, const locale *loc)
10368 FIXME("(%p %d %p %p) semi-stub\n", locinfo, cat, locimp, loc);
10370 if(cat & (1<<(ctype_wchar__Getcat(NULL, NULL)-1))) {
10371 ctype_wchar *ctype;
10373 if(loc) {
10374 ctype = ctype_wchar_use_facet(loc);
10375 }else {
10376 ctype = MSVCRT_operator_new(sizeof(ctype_wchar));
10377 if(!ctype) {
10378 ERR("Out of memory\n");
10379 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10381 ctype_wchar_ctor_locinfo(ctype, locinfo, 0);
10383 locale__Locimp__Addfac(locimp, &ctype->base.facet, locale_id_operator_size_t(&ctype_wchar_id));
10386 if(cat & (1<<(num_get_wchar__Getcat(NULL, NULL)-1))) {
10387 num_get *numget;
10389 if(loc) {
10390 numget = num_get_wchar_use_facet(loc);
10391 }else {
10392 numget = MSVCRT_operator_new(sizeof(num_get));
10393 if(!numget) {
10394 ERR("Out of memory\n");
10395 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10397 num_get_wchar_ctor_locinfo(numget, locinfo, 0);
10399 locale__Locimp__Addfac(locimp, &numget->facet, locale_id_operator_size_t(&num_get_wchar_id));
10402 if(cat & (1<<(num_put_wchar__Getcat(NULL, NULL)-1))) {
10403 num_put *numput;
10405 if(loc) {
10406 numput = num_put_wchar_use_facet(loc);
10407 }else {
10408 numput = MSVCRT_operator_new(sizeof(num_put));
10409 if(!numput) {
10410 ERR("Out of memory\n");
10411 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10413 num_put_wchar_ctor_locinfo(numput, locinfo, 0);
10415 locale__Locimp__Addfac(locimp, &numput->facet, locale_id_operator_size_t(&num_put_wchar_id));
10418 if(cat & (1<<(numpunct_wchar__Getcat(NULL, NULL)-1))) {
10419 numpunct_wchar *numpunct;
10421 if(loc) {
10422 numpunct = numpunct_wchar_use_facet(loc);
10423 }else {
10424 numpunct = MSVCRT_operator_new(sizeof(numpunct_wchar));
10425 if(!numpunct) {
10426 ERR("Out of memory\n");
10427 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10429 numpunct_wchar_ctor_locinfo(numpunct, locinfo, 0, FALSE);
10431 locale__Locimp__Addfac(locimp, &numpunct->facet, locale_id_operator_size_t(&numpunct_wchar_id));
10434 if(cat & (1<<(collate_wchar__Getcat(NULL, NULL)-1))) {
10435 collate *c;
10437 if(loc) {
10438 c = collate_wchar_use_facet(loc);
10439 }else {
10440 c = MSVCRT_operator_new(sizeof(collate));
10441 if(!c) {
10442 ERR("Out of memory\n");
10443 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10445 collate_wchar_ctor_locinfo(c, locinfo, 0);
10447 locale__Locimp__Addfac(locimp, &c->facet, locale_id_operator_size_t(&collate_wchar_id));
10450 if(cat & (1<<(time_put_wchar__Getcat(NULL, NULL)-1))) {
10451 time_put *t;
10453 if(loc) {
10454 t = time_put_wchar_use_facet(loc);
10455 }else {
10456 t = MSVCRT_operator_new(sizeof(time_put));
10457 if(!t) {
10458 ERR("Out of memory\n");
10459 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10461 time_put_wchar_ctor_locinfo(t, locinfo, 0);
10463 locale__Locimp__Addfac(locimp, &t->facet, locale_id_operator_size_t(&time_put_wchar_id));
10466 if(cat & (1<<(codecvt_wchar__Getcat(NULL, NULL)-1))) {
10467 codecvt_wchar *codecvt;
10469 if(loc) {
10470 codecvt = codecvt_wchar_use_facet(loc);
10471 }else {
10472 codecvt = MSVCRT_operator_new(sizeof(codecvt_wchar));
10473 if(!codecvt) {
10474 ERR("Out of memory\n");
10475 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10477 codecvt_wchar_ctor_locinfo(codecvt, locinfo, 0);
10479 locale__Locimp__Addfac(locimp, &codecvt->base.facet, locale_id_operator_size_t(&codecvt_wchar_id));
10483 /* ?_Makexloc@_Locimp@locale@std@@CAXABV_Locinfo@3@HPAV123@PBV23@@Z */
10484 /* ?_Makexloc@_Locimp@locale@std@@CAXAEBV_Locinfo@3@HPEAV123@PEBV23@@Z */
10485 /* List of missing facets:
10486 * messages, money_get, money_put, moneypunct, moneypunct, time_get
10488 void __cdecl locale__Locimp__Makexloc(const _Locinfo *locinfo, category cat, locale__Locimp *locimp, const locale *loc)
10490 FIXME("(%p %d %p %p) semi-stub\n", locinfo, cat, locimp, loc);
10492 if(cat & (1<<(ctype_char__Getcat(NULL, NULL)-1))) {
10493 ctype_char *ctype;
10495 if(loc) {
10496 ctype = ctype_char_use_facet(loc);
10497 }else {
10498 ctype = MSVCRT_operator_new(sizeof(ctype_char));
10499 if(!ctype) {
10500 ERR("Out of memory\n");
10501 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10503 ctype_char_ctor_locinfo(ctype, locinfo, 0);
10505 locale__Locimp__Addfac(locimp, &ctype->base.facet, locale_id_operator_size_t(&ctype_char_id));
10508 if(cat & (1<<(num_get_char__Getcat(NULL, NULL)-1))) {
10509 num_get *numget;
10511 if(loc) {
10512 numget = num_get_char_use_facet(loc);
10513 }else {
10514 numget = MSVCRT_operator_new(sizeof(num_get));
10515 if(!numget) {
10516 ERR("Out of memory\n");
10517 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10519 num_get_char_ctor_locinfo(numget, locinfo, 0);
10521 locale__Locimp__Addfac(locimp, &numget->facet, locale_id_operator_size_t(&num_get_char_id));
10524 if(cat & (1<<(num_put_char__Getcat(NULL, NULL)-1))) {
10525 num_put *numput;
10527 if(loc) {
10528 numput = num_put_char_use_facet(loc);
10529 }else {
10530 numput = MSVCRT_operator_new(sizeof(num_put));
10531 if(!numput) {
10532 ERR("Out of memory\n");
10533 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10535 num_put_char_ctor_locinfo(numput, locinfo, 0);
10537 locale__Locimp__Addfac(locimp, &numput->facet, locale_id_operator_size_t(&num_put_char_id));
10540 if(cat & (1<<(numpunct_char__Getcat(NULL, NULL)-1))) {
10541 numpunct_char *numpunct;
10543 if(loc) {
10544 numpunct = numpunct_char_use_facet(loc);
10545 }else {
10546 numpunct = MSVCRT_operator_new(sizeof(numpunct_char));
10547 if(!numpunct) {
10548 ERR("Out of memory\n");
10549 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10551 numpunct_char_ctor_locinfo(numpunct, locinfo, 0, FALSE);
10553 locale__Locimp__Addfac(locimp, &numpunct->facet, locale_id_operator_size_t(&numpunct_char_id));
10556 if(cat & (1<<(collate_char__Getcat(NULL, NULL)-1))) {
10557 collate *c;
10559 if(loc) {
10560 c = collate_char_use_facet(loc);
10561 }else {
10562 c = MSVCRT_operator_new(sizeof(collate));
10563 if(!c) {
10564 ERR("Out of memory\n");
10565 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10567 collate_char_ctor_locinfo(c, locinfo, 0);
10569 locale__Locimp__Addfac(locimp, &c->facet, locale_id_operator_size_t(&collate_char_id));
10572 if(cat & (1<<(time_get_char__Getcat(NULL, NULL)-1))) {
10573 time_get_char *t;
10575 if(loc) {
10576 t = time_get_char_use_facet(loc);
10577 }else {
10578 t = MSVCRT_operator_new(sizeof(time_get_char));
10579 if(!t) {
10580 ERR("Out of memory\n");
10581 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10583 time_get_char_ctor_locinfo(t, locinfo, 0);
10585 locale__Locimp__Addfac(locimp, &t->facet, locale_id_operator_size_t(&time_get_char_id));
10588 if(cat & (1<<(time_put_char__Getcat(NULL, NULL)-1))) {
10589 time_put *t;
10591 if(loc) {
10592 t = time_put_char_use_facet(loc);
10593 }else {
10594 t = MSVCRT_operator_new(sizeof(time_put));
10595 if(!t) {
10596 ERR("Out of memory\n");
10597 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10599 time_put_char_ctor_locinfo(t, locinfo, 0);
10601 locale__Locimp__Addfac(locimp, &t->facet, locale_id_operator_size_t(&time_put_char_id));
10604 if(cat & (1<<(codecvt_char__Getcat(NULL, NULL)-1))) {
10605 codecvt_char *codecvt;
10607 if(loc) {
10608 codecvt = codecvt_char_use_facet(loc);
10609 }else {
10610 codecvt = MSVCRT_operator_new(sizeof(codecvt_char));
10611 if(!codecvt) {
10612 ERR("Out of memory\n");
10613 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10615 codecvt_char_ctor_locinfo(codecvt, locinfo, 0);
10617 locale__Locimp__Addfac(locimp, &codecvt->base.facet, locale_id_operator_size_t(&codecvt_char_id));
10621 /* ?_Makeloc@_Locimp@locale@std@@CAPAV123@ABV_Locinfo@3@HPAV123@PBV23@@Z */
10622 /* ?_Makeloc@_Locimp@locale@std@@CAPEAV123@AEBV_Locinfo@3@HPEAV123@PEBV23@@Z */
10623 locale__Locimp* __cdecl locale__Locimp__Makeloc(const _Locinfo *locinfo, category cat, locale__Locimp *locimp, const locale *loc)
10625 TRACE("(%p %d %p %p)\n", locinfo, cat, locimp, loc);
10627 locale__Locimp__Makexloc(locinfo, cat, locimp, loc);
10628 locale__Locimp__Makewloc(locinfo, cat, locimp, loc);
10629 locale__Locimp__Makeushloc(locinfo, cat, locimp, loc);
10631 locimp->catmask |= cat;
10632 locale_string_char_assign(&locimp->name, &locinfo->newlocname);
10633 return locimp;
10636 /* ??0locale@std@@AAE@PAV_Locimp@01@@Z */
10637 /* ??0locale@std@@AEAA@PEAV_Locimp@01@@Z */
10638 DEFINE_THISCALL_WRAPPER(locale_ctor_locimp, 8)
10639 locale* __thiscall locale_ctor_locimp(locale *this, locale__Locimp *locimp)
10641 TRACE("(%p %p)\n", this, locimp);
10642 /* Don't change locimp reference counter */
10643 this->ptr = locimp;
10644 return this;
10647 /* ?_Init@locale@std@@CAPAV_Locimp@12@XZ */
10648 /* ?_Init@locale@std@@CAPEAV_Locimp@12@XZ */
10649 locale__Locimp* __cdecl locale__Init(void)
10651 _Lockit lock;
10653 TRACE("\n");
10655 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
10656 if(global_locale) {
10657 _Lockit_dtor(&lock);
10658 return global_locale;
10661 global_locale = MSVCRT_operator_new(sizeof(locale__Locimp));
10662 if(!global_locale) {
10663 _Lockit_dtor(&lock);
10664 ERR("Out of memory\n");
10665 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10666 return NULL;
10669 locale__Locimp_ctor(global_locale);
10670 global_locale->catmask = (1<<(LC_MAX+1))-1;
10671 locale_string_char_dtor(&global_locale->name);
10672 locale_string_char_ctor_cstr(&global_locale->name, "C");
10674 locale__Locimp__Clocptr = global_locale;
10675 global_locale->facet.refs++;
10676 locale_ctor_locimp(&classic_locale, locale__Locimp__Clocptr);
10677 _Lockit_dtor(&lock);
10679 return global_locale;
10682 /* ?_Init@locale@std@@CAPAV_Locimp@12@_N@Z */
10683 /* ?_Init@locale@std@@CAPEAV_Locimp@12@_N@Z */
10684 locale__Locimp* __cdecl locale__Init_ref(MSVCP_bool inc_ref)
10686 locale__Locimp *ret;
10687 _Lockit lock;
10689 TRACE("(%x)\n", inc_ref);
10691 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
10692 if(inc_ref && global_locale) {
10693 call_locale_facet__Incref(&global_locale->facet);
10694 _Lockit_dtor(&lock);
10695 return global_locale;
10698 ret = locale__Init();
10699 _Lockit_dtor(&lock);
10700 return ret;
10703 /* ?_Iscloc@locale@std@@QBE_NXZ */
10704 /* ?_Iscloc@locale@std@@QEBA_NXZ */
10705 DEFINE_THISCALL_WRAPPER(locale__Iscloc, 4)
10706 MSVCP_bool __thiscall locale__Iscloc(const locale *this)
10708 TRACE("(%p)\n", this);
10709 return this->ptr == locale__Locimp__Clocptr;
10712 /* ??0locale@std@@QAE@ABV01@0H@Z */
10713 /* ??0locale@std@@QEAA@AEBV01@0H@Z */
10714 DEFINE_THISCALL_WRAPPER(locale_ctor_locale_locale, 16)
10715 locale* __thiscall locale_ctor_locale_locale(locale *this, const locale *loc, const locale *other, category cat)
10717 _Locinfo locinfo;
10719 TRACE("(%p %p %p %d)\n", this, loc, other, cat);
10721 this->ptr = MSVCRT_operator_new(sizeof(locale__Locimp));
10722 if(!this->ptr) {
10723 ERR("Out of memory\n");
10724 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10726 locale__Locimp_copy_ctor(this->ptr, loc->ptr);
10728 _Locinfo_ctor_cat_cstr(&locinfo, loc->ptr->catmask, locale_string_char_c_str(&loc->ptr->name));
10729 _Locinfo__Addcats(&locinfo, cat & other->ptr->catmask, locale_string_char_c_str(&other->ptr->name));
10730 locale__Locimp__Makeloc(&locinfo, cat, this->ptr, other);
10731 _Locinfo_dtor(&locinfo);
10733 return this;
10736 /* ??0locale@std@@QAE@ABV01@@Z */
10737 /* ??0locale@std@@QEAA@AEBV01@@Z */
10738 DEFINE_THISCALL_WRAPPER(locale_copy_ctor, 8)
10739 locale* __thiscall locale_copy_ctor(locale *this, const locale *copy)
10741 TRACE("(%p %p)\n", this, copy);
10742 this->ptr = copy->ptr;
10743 call_locale_facet__Incref(&this->ptr->facet);
10744 return this;
10747 /* ??0locale@std@@QAE@ABV01@PBDH@Z */
10748 /* ??0locale@std@@QEAA@AEBV01@PEBDH@Z */
10749 DEFINE_THISCALL_WRAPPER(locale_ctor_locale_cstr, 16)
10750 locale* __thiscall locale_ctor_locale_cstr(locale *this, const locale *loc, const char *locname, category cat)
10752 _Locinfo locinfo;
10754 TRACE("(%p %p %s %d)\n", this, loc, locname, cat);
10756 _Locinfo_ctor_cat_cstr(&locinfo, cat, locname);
10757 if(!memcmp(locale_string_char_c_str(&locinfo.newlocname), "*", 2)) {
10758 _Locinfo_dtor(&locinfo);
10759 MSVCRT_operator_delete(this->ptr);
10760 throw_exception(EXCEPTION_RUNTIME_ERROR, "bad locale name");
10763 this->ptr = MSVCRT_operator_new(sizeof(locale__Locimp));
10764 if(!this->ptr) {
10765 ERR("Out of memory\n");
10766 _Locinfo_dtor(&locinfo);
10767 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10769 locale__Locimp_copy_ctor(this->ptr, loc->ptr);
10771 locale__Locimp__Makeloc(&locinfo, cat, this->ptr, NULL);
10772 _Locinfo_dtor(&locinfo);
10773 return this;
10776 /* ??0locale@std@@QAE@PBDH@Z */
10777 /* ??0locale@std@@QEAA@PEBDH@Z */
10778 DEFINE_THISCALL_WRAPPER(locale_ctor_cstr, 12)
10779 locale* __thiscall locale_ctor_cstr(locale *this, const char *locname, category cat)
10781 _Locinfo locinfo;
10783 TRACE("(%p %s %d)\n", this, locname, cat);
10785 this->ptr = MSVCRT_operator_new(sizeof(locale__Locimp));
10786 if(!this->ptr) {
10787 ERR("Out of memory\n");
10788 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10790 locale__Locimp_ctor(this->ptr);
10792 locale__Init();
10794 _Locinfo_ctor_cat_cstr(&locinfo, cat, locname);
10795 if(!memcmp(locale_string_char_c_str(&locinfo.newlocname), "*", 2)) {
10796 _Locinfo_dtor(&locinfo);
10797 MSVCRT_operator_delete(this->ptr);
10798 throw_exception(EXCEPTION_RUNTIME_ERROR, "bad locale name");
10801 locale__Locimp__Makeloc(&locinfo, cat, this->ptr, NULL);
10802 _Locinfo_dtor(&locinfo);
10804 return this;
10807 /* ??0locale@std@@QAE@W4_Uninitialized@1@@Z */
10808 /* ??0locale@std@@QEAA@W4_Uninitialized@1@@Z */
10809 DEFINE_THISCALL_WRAPPER(locale_ctor_uninitialized, 8)
10810 locale* __thiscall locale_ctor_uninitialized(locale *this, int uninitialized)
10812 TRACE("(%p)\n", this);
10813 this->ptr = NULL;
10814 return this;
10817 /* ??0locale@std@@QAE@XZ */
10818 /* ??0locale@std@@QEAA@XZ */
10819 DEFINE_THISCALL_WRAPPER(locale_ctor, 4)
10820 locale* __thiscall locale_ctor(locale *this)
10822 TRACE("(%p)\n", this);
10823 this->ptr = locale__Init();
10824 call_locale_facet__Incref(&this->ptr->facet);
10825 return this;
10828 /* ??1locale@std@@QAE@XZ */
10829 /* ??1locale@std@@QEAA@XZ */
10830 DEFINE_THISCALL_WRAPPER(locale_dtor, 4)
10831 void __thiscall locale_dtor(locale *this)
10833 TRACE("(%p)\n", this);
10834 if(this->ptr && call_locale_facet__Decref(&this->ptr->facet))
10836 locale__Locimp_dtor(this->ptr);
10837 MSVCRT_operator_delete(this->ptr);
10841 /* ??4locale@std@@QAEAAV01@ABV01@@Z */
10842 /* ??4locale@std@@QEAAAEAV01@AEBV01@@Z */
10843 DEFINE_THISCALL_WRAPPER(locale_operator_assign, 8)
10844 locale* __thiscall locale_operator_assign(locale *this, const locale *loc)
10846 FIXME("(%p %p) stub\n", this, loc);
10847 return NULL;
10850 /* ??8locale@std@@QBE_NABV01@@Z */
10851 /* ??8locale@std@@QEBA_NAEBV01@@Z */
10852 DEFINE_THISCALL_WRAPPER(locale_operator_equal, 8)
10853 MSVCP_bool __thiscall locale_operator_equal(const locale *this, const locale *loc)
10855 FIXME("(%p %p) stub\n", this, loc);
10856 return 0;
10859 /* ??9locale@std@@QBE_NABV01@@Z */
10860 /* ??9locale@std@@QEBA_NAEBV01@@Z */
10861 DEFINE_THISCALL_WRAPPER(locale_operator_not_equal, 8)
10862 MSVCP_bool __thiscall locale_operator_not_equal(const locale *this, locale const *loc)
10864 FIXME("(%p %p) stub\n", this, loc);
10865 return 0;
10868 /* ?_Addfac@locale@std@@QAEAAV12@PAVfacet@12@II@Z */
10869 /* ?_Addfac@locale@std@@QEAAAEAV12@PEAVfacet@12@_K1@Z */
10870 DEFINE_THISCALL_WRAPPER(locale__Addfac, 16)
10871 locale* __thiscall locale__Addfac(locale *this, locale_facet *facet, MSVCP_size_t id, MSVCP_size_t catmask)
10873 TRACE("(%p %p %lu %lu)\n", this, facet, id, catmask);
10875 if(this->ptr->facet.refs > 1) {
10876 locale__Locimp *new_ptr = MSVCRT_operator_new(sizeof(locale__Locimp));
10877 if(!new_ptr) {
10878 ERR("Out of memory\n");
10879 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10880 return NULL;
10882 locale__Locimp_copy_ctor(new_ptr, this->ptr);
10883 call_locale_facet__Decref(&this->ptr->facet);
10884 this->ptr = new_ptr;
10887 locale__Locimp__Addfac(this->ptr, facet, id);
10889 if(catmask) {
10890 locale_string_char_dtor(&this->ptr->name);
10891 locale_string_char_ctor_cstr(&this->ptr->name, "*");
10893 return this;
10896 /* ?_Getfacet@locale@std@@QBEPBVfacet@12@I_N@Z */
10897 /* ?_Getfacet@locale@std@@QEBAPEBVfacet@12@_K_N@Z */
10898 DEFINE_THISCALL_WRAPPER(locale__Getfacet_bool, 12)
10899 const locale_facet* __thiscall locale__Getfacet_bool(const locale *this,
10900 MSVCP_size_t id, MSVCP_bool allow_transparent)
10902 locale_facet *fac;
10904 TRACE("(%p %lu)\n", this, id);
10906 fac = id < this->ptr->facet_cnt ? this->ptr->facetvec[id] : NULL;
10907 if(fac || !this->ptr->transparent || !allow_transparent)
10908 return fac;
10910 return id < global_locale->facet_cnt ? global_locale->facetvec[id] : NULL;
10913 /* ?_Getfacet@locale@std@@QBEPBVfacet@12@I@Z */
10914 /* ?_Getfacet@locale@std@@QEBAPEBVfacet@12@_K@Z */
10915 DEFINE_THISCALL_WRAPPER(locale__Getfacet, 8)
10916 const locale_facet* __thiscall locale__Getfacet(const locale *this, MSVCP_size_t id)
10918 return locale__Getfacet_bool( this, id, TRUE );
10921 /* ?_Getgloballocale@locale@std@@CAPAV_Locimp@12@XZ */
10922 /* ?_Getgloballocale@locale@std@@CAPEAV_Locimp@12@XZ */
10923 locale__Locimp* __cdecl locale__Getgloballocale(void)
10925 TRACE("\n");
10926 return global_locale;
10929 /* ?_Setgloballocale@locale@std@@CAXPAX@Z */
10930 /* ?_Setgloballocale@locale@std@@CAXPEAX@Z */
10931 void __cdecl locale__Setgloballocale(void *locimp)
10933 TRACE("(%p)\n", locimp);
10934 global_locale = locimp;
10937 /* ?classic@locale@std@@SAABV12@XZ */
10938 /* ?classic@locale@std@@SAAEBV12@XZ */
10939 const locale* __cdecl locale_classic(void)
10941 TRACE("\n");
10942 locale__Init();
10943 return &classic_locale;
10946 /* ?empty@locale@std@@SA?AV12@XZ */
10947 locale* __cdecl locale_empty(locale *ret)
10949 TRACE("\n");
10951 locale__Init();
10953 ret->ptr = MSVCRT_operator_new(sizeof(locale__Locimp));
10954 if(!ret->ptr) {
10955 ERR("Out of memory\n");
10956 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
10958 locale__Locimp_ctor_transparent(ret->ptr, TRUE);
10959 return ret;
10962 /* ?global@locale@std@@SA?AV12@ABV12@@Z */
10963 /* ?global@locale@std@@SA?AV12@AEBV12@@Z */
10964 locale* __cdecl locale_global(locale *ret, const locale *loc)
10966 _Lockit lock;
10967 int i;
10969 TRACE("(%p %p)\n", loc, ret);
10971 _Lockit_ctor_locktype(&lock, _LOCK_LOCALE);
10972 locale_ctor(ret);
10974 if(loc->ptr != global_locale) {
10975 call_locale_facet__Decref(&global_locale->facet);
10976 global_locale = loc->ptr;
10977 call_locale_facet__Incref(&global_locale->facet);
10979 for(i=LC_ALL+1; i<=LC_MAX; i++) {
10980 if((global_locale->catmask & (1<<(i-1))) == 0)
10981 continue;
10982 setlocale(i, locale_string_char_c_str(&global_locale->name));
10985 _Lockit_dtor(&lock);
10986 return ret;
10989 #if _MSVCP_VER < 100
10991 /* ?_Getname@_Locinfo@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
10992 /* ?_Getname@_Locinfo@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
10993 DEFINE_THISCALL_WRAPPER(_Locinfo__Getname, 8)
10994 basic_string_char* __thiscall _Locinfo__Getname(const _Locinfo *this, basic_string_char *ret)
10996 TRACE("(%p)\n", this);
10998 MSVCP_basic_string_char_copy_ctor(ret, &this->newlocname);
10999 return ret;
11002 /* ?name@locale@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
11003 /* ?name@locale@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
11004 DEFINE_THISCALL_WRAPPER(locale_name, 8)
11005 basic_string_char* __thiscall locale_name(const locale *this, basic_string_char *ret)
11007 TRACE( "(%p)\n", this);
11008 MSVCP_basic_string_char_copy_ctor(ret, &this->ptr->name);
11009 return ret;
11012 #else
11014 /* ?_Getname@_Locinfo@std@@QBEPBDXZ */
11015 /* ?_Getname@_Locinfo@std@@QEBAPEBDXZ */
11016 DEFINE_THISCALL_WRAPPER(_Locinfo__Getname, 4)
11017 const char * __thiscall _Locinfo__Getname( const _Locinfo *this )
11019 return locale_string_char_c_str( &this->newlocname );
11022 #endif /* _MSVCP_VER < 100 */
11024 /* wctrans */
11025 wctrans_t __cdecl wctrans(const char *property)
11027 static const char str_tolower[] = "tolower";
11028 static const char str_toupper[] = "toupper";
11030 if(!strcmp(property, str_tolower))
11031 return 2;
11032 if(!strcmp(property, str_toupper))
11033 return 1;
11034 return 0;
11037 /* towctrans */
11038 wint_t __cdecl towctrans(wint_t c, wctrans_t category)
11040 if(category == 1)
11041 return towupper(c);
11042 return towlower(c);
11045 /* btowc */
11046 wint_t __cdecl btowc(int c)
11048 wchar_t ret;
11049 int state = 0;
11050 char ch = c;
11052 if (c == EOF || _Mbrtowc( &ret, &ch, 1, &state, NULL ) != 1) return WEOF;
11053 return ret;
11056 /* mbrlen */
11057 size_t __cdecl mbrlen(const char *str, size_t n, mbstate_t *state)
11059 static int local_state;
11061 if (!state) state = &local_state;
11062 return _Mbrtowc( NULL, str, n, state, NULL );
11065 /* mbrtowc */
11066 size_t __cdecl mbrtowc(wchar_t *dst, const char *str, size_t n, mbstate_t *state)
11068 static int local_state;
11070 if (!state) state = &local_state;
11071 return _Mbrtowc( dst, str, n, state, NULL );
11074 /* mbsrtowcs */
11075 size_t __cdecl mbsrtowcs(wchar_t *dst, const char **pstr, size_t n, mbstate_t *state)
11077 static int local_state;
11078 size_t ret = 0;
11079 wchar_t wc;
11080 const char *src;
11082 src = *pstr;
11083 if (!state) state = &local_state;
11085 while (!dst || n > ret)
11087 int len = _Mbrtowc( &wc, src, 2, state, NULL );
11088 if (len < 0) return -1;
11089 if (!len) break;
11090 if (dst) dst[ret] = wc;
11091 ret++;
11092 if (!wc) break;
11093 src += len;
11095 return ret;
11098 /* wctob */
11099 int __cdecl wctob(wint_t wc)
11101 char ret[MB_LEN_MAX];
11103 if (wc == WEOF || _Wcrtomb( ret, wc, NULL, NULL ) != 1) return EOF;
11104 return ret[0];
11107 /* wcrtomb */
11108 size_t __cdecl wcrtomb(char *dst, wchar_t wc, mbstate_t *state)
11110 return _Wcrtomb( dst, wc, state, NULL );
11113 /* wcsrtombs */
11114 size_t __cdecl wcsrtombs(char *dst, const wchar_t **pstr, size_t n, mbstate_t *state)
11116 const wchar_t *src;
11117 char buffer[MB_LEN_MAX];
11118 size_t ret = 0;
11120 src = *pstr;
11122 while (!dst || n > ret)
11124 int len = _Wcrtomb( buffer, *src, state, NULL );
11125 if (len <= 0) return -1;
11126 if (n < ret + len) break;
11127 memcpy( dst + ret, buffer, len );
11128 ret += len;
11129 if (!buffer[0]) break;
11130 src++;
11132 return ret;
11136 DEFINE_RTTI_DATA0(locale_facet, 0, ".?AVfacet@locale@std@@")
11137 DEFINE_RTTI_DATA1(locale__Locimp, 0, &locale_facet_rtti_base_descriptor, ".?AV_Locimp@locale@std@@")
11138 DEFINE_RTTI_DATA1(collate_char, 0, &locale_facet_rtti_base_descriptor, ".?AV?$collate@D@std@@")
11139 DEFINE_RTTI_DATA1(collate_wchar, 0, &locale_facet_rtti_base_descriptor, ".?AV?$collate@_W@std@@")
11140 DEFINE_RTTI_DATA1(collate_short, 0, &locale_facet_rtti_base_descriptor, ".?AV?$collate@G@std@@")
11141 DEFINE_RTTI_DATA1(ctype_base, 0, &locale_facet_rtti_base_descriptor, ".?AUctype_base@std@@")
11142 DEFINE_RTTI_DATA2(ctype_char, 0, &ctype_base_rtti_base_descriptor, &locale_facet_rtti_base_descriptor, ".?AV?$ctype@D@std@@")
11143 DEFINE_RTTI_DATA2(ctype_wchar, 0, &ctype_base_rtti_base_descriptor, &locale_facet_rtti_base_descriptor, ".?AV?$ctype@_W@std@@")
11144 DEFINE_RTTI_DATA2(ctype_short, 0, &ctype_base_rtti_base_descriptor, &locale_facet_rtti_base_descriptor, ".?AV?$ctype@G@std@@")
11145 DEFINE_RTTI_DATA1(codecvt_base, 0, &locale_facet_rtti_base_descriptor, ".?AVcodecvt_base@std@@")
11146 DEFINE_RTTI_DATA2(codecvt_char, 0, &codecvt_base_rtti_base_descriptor, &locale_facet_rtti_base_descriptor, ".?AV?$codecvt@DDH@std@@")
11147 DEFINE_RTTI_DATA2(codecvt_wchar, 0, &codecvt_base_rtti_base_descriptor, &locale_facet_rtti_base_descriptor, ".?AV?$codecvt@_WDH@std@@")
11148 DEFINE_RTTI_DATA2(codecvt_short, 0, &codecvt_base_rtti_base_descriptor, &locale_facet_rtti_base_descriptor, ".?AV?$codecvt@GDH@std@@")
11149 DEFINE_RTTI_DATA1(numpunct_char, 0, &locale_facet_rtti_base_descriptor, ".?AV?$numpunct@D@std@@")
11150 DEFINE_RTTI_DATA1(numpunct_wchar, 0, &locale_facet_rtti_base_descriptor, ".?AV?$numpunct@_W@std@@")
11151 DEFINE_RTTI_DATA1(numpunct_short, 0, &locale_facet_rtti_base_descriptor, ".?AV?$numpunct@G@std@@")
11152 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@@")
11153 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@@")
11154 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@@")
11155 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@@")
11156 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@@")
11157 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@@")
11158 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@@")
11159 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@@")
11160 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@@")
11161 DEFINE_RTTI_DATA1(time_base, 0, &locale_facet_rtti_base_descriptor, ".?AUtime_base@std@@")
11162 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@@")
11164 #ifndef __GNUC__
11165 void __asm_dummy_vtables(void) {
11166 #endif
11167 __ASM_VTABLE(locale_facet,
11168 VTABLE_ADD_FUNC(locale_facet_vector_dtor)
11169 #if _MSVCP_VER >= 110
11170 VTABLE_ADD_FUNC(locale_facet__Incref)
11171 VTABLE_ADD_FUNC(locale_facet__Decref)
11172 #endif
11174 __ASM_VTABLE(locale__Locimp,
11175 VTABLE_ADD_FUNC(locale__Locimp_vector_dtor)
11176 #if _MSVCP_VER >= 110
11177 VTABLE_ADD_FUNC(locale_facet__Incref)
11178 VTABLE_ADD_FUNC(locale_facet__Decref)
11179 #endif
11181 __ASM_VTABLE(collate_char,
11182 VTABLE_ADD_FUNC(collate_char_vector_dtor)
11183 #if _MSVCP_VER >= 110
11184 VTABLE_ADD_FUNC(locale_facet__Incref)
11185 VTABLE_ADD_FUNC(locale_facet__Decref)
11186 #endif
11187 VTABLE_ADD_FUNC(collate_char_do_compare)
11188 VTABLE_ADD_FUNC(collate_char_do_transform)
11189 VTABLE_ADD_FUNC(collate_char_do_hash));
11190 __ASM_VTABLE(collate_wchar,
11191 VTABLE_ADD_FUNC(collate_wchar_vector_dtor)
11192 #if _MSVCP_VER >= 110
11193 VTABLE_ADD_FUNC(locale_facet__Incref)
11194 VTABLE_ADD_FUNC(locale_facet__Decref)
11195 #endif
11196 VTABLE_ADD_FUNC(collate_wchar_do_compare)
11197 VTABLE_ADD_FUNC(collate_wchar_do_transform)
11198 VTABLE_ADD_FUNC(collate_wchar_do_hash));
11199 __ASM_VTABLE(collate_short,
11200 VTABLE_ADD_FUNC(collate_wchar_vector_dtor)
11201 #if _MSVCP_VER >= 110
11202 VTABLE_ADD_FUNC(locale_facet__Incref)
11203 VTABLE_ADD_FUNC(locale_facet__Decref)
11204 #endif
11205 VTABLE_ADD_FUNC(collate_wchar_do_compare)
11206 VTABLE_ADD_FUNC(collate_wchar_do_transform)
11207 VTABLE_ADD_FUNC(collate_wchar_do_hash));
11208 __ASM_VTABLE(ctype_base,
11209 VTABLE_ADD_FUNC(ctype_base_vector_dtor)
11210 #if _MSVCP_VER >= 110
11211 VTABLE_ADD_FUNC(locale_facet__Incref)
11212 VTABLE_ADD_FUNC(locale_facet__Decref)
11213 #endif
11215 __ASM_VTABLE(ctype_char,
11216 VTABLE_ADD_FUNC(ctype_char_vector_dtor)
11217 #if _MSVCP_VER >= 110
11218 VTABLE_ADD_FUNC(locale_facet__Incref)
11219 VTABLE_ADD_FUNC(locale_facet__Decref)
11220 #endif
11221 VTABLE_ADD_FUNC(ctype_char_do_tolower)
11222 VTABLE_ADD_FUNC(ctype_char_do_tolower_ch)
11223 VTABLE_ADD_FUNC(ctype_char_do_toupper)
11224 VTABLE_ADD_FUNC(ctype_char_do_toupper_ch)
11225 VTABLE_ADD_FUNC(ctype_char_do_widen)
11226 VTABLE_ADD_FUNC(ctype_char_do_widen_ch)
11227 #if _MSVCP_VER >= 80 && _MSVCP_VER <= 90
11228 VTABLE_ADD_FUNC(ctype_char__Do_widen_s)
11229 VTABLE_ADD_FUNC(ctype_char_do_narrow)
11230 VTABLE_ADD_FUNC(ctype_char_do_narrow_ch)
11231 VTABLE_ADD_FUNC(ctype_char__Do_narrow_s)
11232 #else
11233 VTABLE_ADD_FUNC(ctype_char_do_narrow)
11234 VTABLE_ADD_FUNC(ctype_char_do_narrow_ch)
11235 #endif
11237 __ASM_VTABLE(ctype_wchar,
11238 VTABLE_ADD_FUNC(ctype_wchar_vector_dtor)
11239 #if _MSVCP_VER >= 110
11240 VTABLE_ADD_FUNC(locale_facet__Incref)
11241 VTABLE_ADD_FUNC(locale_facet__Decref)
11242 #endif
11243 VTABLE_ADD_FUNC(ctype_wchar_do_is)
11244 VTABLE_ADD_FUNC(ctype_wchar_do_is_ch)
11245 VTABLE_ADD_FUNC(ctype_wchar_do_scan_is)
11246 VTABLE_ADD_FUNC(ctype_wchar_do_scan_not)
11247 VTABLE_ADD_FUNC(ctype_wchar_do_tolower)
11248 VTABLE_ADD_FUNC(ctype_wchar_do_tolower_ch)
11249 VTABLE_ADD_FUNC(ctype_wchar_do_toupper)
11250 VTABLE_ADD_FUNC(ctype_wchar_do_toupper_ch)
11251 VTABLE_ADD_FUNC(ctype_wchar_do_widen)
11252 VTABLE_ADD_FUNC(ctype_wchar_do_widen_ch)
11253 #if _MSVCP_VER >= 80 && _MSVCP_VER <= 90
11254 VTABLE_ADD_FUNC(ctype_wchar__Do_widen_s)
11255 VTABLE_ADD_FUNC(ctype_wchar_do_narrow)
11256 VTABLE_ADD_FUNC(ctype_wchar_do_narrow_ch)
11257 VTABLE_ADD_FUNC(ctype_wchar__Do_narrow_s)
11258 #else
11259 VTABLE_ADD_FUNC(ctype_wchar_do_narrow)
11260 VTABLE_ADD_FUNC(ctype_wchar_do_narrow_ch)
11261 #endif
11263 __ASM_VTABLE(ctype_short,
11264 VTABLE_ADD_FUNC(ctype_wchar_vector_dtor)
11265 #if _MSVCP_VER >= 110
11266 VTABLE_ADD_FUNC(locale_facet__Incref)
11267 VTABLE_ADD_FUNC(locale_facet__Decref)
11268 #endif
11269 VTABLE_ADD_FUNC(ctype_wchar_do_is)
11270 VTABLE_ADD_FUNC(ctype_wchar_do_is_ch)
11271 VTABLE_ADD_FUNC(ctype_wchar_do_scan_is)
11272 VTABLE_ADD_FUNC(ctype_wchar_do_scan_not)
11273 VTABLE_ADD_FUNC(ctype_wchar_do_tolower)
11274 VTABLE_ADD_FUNC(ctype_wchar_do_tolower_ch)
11275 VTABLE_ADD_FUNC(ctype_wchar_do_toupper)
11276 VTABLE_ADD_FUNC(ctype_wchar_do_toupper_ch)
11277 VTABLE_ADD_FUNC(ctype_wchar_do_widen)
11278 VTABLE_ADD_FUNC(ctype_wchar_do_widen_ch)
11279 #if _MSVCP_VER >= 80 && _MSVCP_VER <= 90
11280 VTABLE_ADD_FUNC(ctype_wchar__Do_widen_s)
11281 VTABLE_ADD_FUNC(ctype_wchar_do_narrow)
11282 VTABLE_ADD_FUNC(ctype_wchar_do_narrow_ch)
11283 VTABLE_ADD_FUNC(ctype_wchar__Do_narrow_s)
11284 #else
11285 VTABLE_ADD_FUNC(ctype_wchar_do_narrow)
11286 VTABLE_ADD_FUNC(ctype_wchar_do_narrow_ch)
11287 #endif
11289 __ASM_VTABLE(codecvt_base,
11290 VTABLE_ADD_FUNC(codecvt_base_vector_dtor)
11291 #if _MSVCP_VER >= 110
11292 VTABLE_ADD_FUNC(locale_facet__Incref)
11293 VTABLE_ADD_FUNC(locale_facet__Decref)
11294 #endif
11295 VTABLE_ADD_FUNC(codecvt_base_do_always_noconv)
11296 VTABLE_ADD_FUNC(codecvt_base_do_max_length)
11297 VTABLE_ADD_FUNC(codecvt_base_do_encoding));
11298 __ASM_VTABLE(codecvt_char,
11299 VTABLE_ADD_FUNC(codecvt_char_vector_dtor)
11300 #if _MSVCP_VER >= 110
11301 VTABLE_ADD_FUNC(locale_facet__Incref)
11302 VTABLE_ADD_FUNC(locale_facet__Decref)
11303 #endif
11304 VTABLE_ADD_FUNC(codecvt_base_do_always_noconv)
11305 VTABLE_ADD_FUNC(codecvt_base_do_max_length)
11306 VTABLE_ADD_FUNC(codecvt_base_do_encoding)
11307 VTABLE_ADD_FUNC(codecvt_char_do_in)
11308 VTABLE_ADD_FUNC(codecvt_char_do_out)
11309 VTABLE_ADD_FUNC(codecvt_char_do_unshift)
11310 VTABLE_ADD_FUNC(codecvt_char_do_length));
11311 __ASM_VTABLE(codecvt_wchar,
11312 VTABLE_ADD_FUNC(codecvt_wchar_vector_dtor)
11313 #if _MSVCP_VER >= 110
11314 VTABLE_ADD_FUNC(locale_facet__Incref)
11315 VTABLE_ADD_FUNC(locale_facet__Decref)
11316 #endif
11317 VTABLE_ADD_FUNC(codecvt_wchar_do_always_noconv)
11318 VTABLE_ADD_FUNC(codecvt_wchar_do_max_length)
11319 VTABLE_ADD_FUNC(codecvt_base_do_encoding)
11320 VTABLE_ADD_FUNC(codecvt_wchar_do_in)
11321 VTABLE_ADD_FUNC(codecvt_wchar_do_out)
11322 VTABLE_ADD_FUNC(codecvt_wchar_do_unshift)
11323 VTABLE_ADD_FUNC(codecvt_wchar_do_length));
11324 __ASM_VTABLE(codecvt_short,
11325 VTABLE_ADD_FUNC(codecvt_wchar_vector_dtor)
11326 #if _MSVCP_VER >= 110
11327 VTABLE_ADD_FUNC(locale_facet__Incref)
11328 VTABLE_ADD_FUNC(locale_facet__Decref)
11329 #endif
11330 VTABLE_ADD_FUNC(codecvt_wchar_do_always_noconv)
11331 VTABLE_ADD_FUNC(codecvt_wchar_do_max_length)
11332 VTABLE_ADD_FUNC(codecvt_base_do_encoding)
11333 VTABLE_ADD_FUNC(codecvt_wchar_do_in)
11334 VTABLE_ADD_FUNC(codecvt_wchar_do_out)
11335 VTABLE_ADD_FUNC(codecvt_wchar_do_unshift)
11336 VTABLE_ADD_FUNC(codecvt_wchar_do_length));
11337 __ASM_VTABLE(numpunct_char,
11338 VTABLE_ADD_FUNC(numpunct_char_vector_dtor)
11339 #if _MSVCP_VER >= 110
11340 VTABLE_ADD_FUNC(locale_facet__Incref)
11341 VTABLE_ADD_FUNC(locale_facet__Decref)
11342 #endif
11343 VTABLE_ADD_FUNC(numpunct_char_do_decimal_point)
11344 VTABLE_ADD_FUNC(numpunct_char_do_thousands_sep)
11345 VTABLE_ADD_FUNC(numpunct_char_do_grouping)
11346 VTABLE_ADD_FUNC(numpunct_char_do_falsename)
11347 VTABLE_ADD_FUNC(numpunct_char_do_truename));
11348 __ASM_VTABLE(numpunct_wchar,
11349 VTABLE_ADD_FUNC(numpunct_wchar_vector_dtor)
11350 #if _MSVCP_VER >= 110
11351 VTABLE_ADD_FUNC(locale_facet__Incref)
11352 VTABLE_ADD_FUNC(locale_facet__Decref)
11353 #endif
11354 VTABLE_ADD_FUNC(numpunct_wchar_do_decimal_point)
11355 VTABLE_ADD_FUNC(numpunct_wchar_do_thousands_sep)
11356 VTABLE_ADD_FUNC(numpunct_wchar_do_grouping)
11357 VTABLE_ADD_FUNC(numpunct_wchar_do_falsename)
11358 VTABLE_ADD_FUNC(numpunct_wchar_do_truename));
11359 __ASM_VTABLE(numpunct_short,
11360 VTABLE_ADD_FUNC(numpunct_wchar_vector_dtor)
11361 #if _MSVCP_VER >= 110
11362 VTABLE_ADD_FUNC(locale_facet__Incref)
11363 VTABLE_ADD_FUNC(locale_facet__Decref)
11364 #endif
11365 VTABLE_ADD_FUNC(numpunct_wchar_do_decimal_point)
11366 VTABLE_ADD_FUNC(numpunct_wchar_do_thousands_sep)
11367 VTABLE_ADD_FUNC(numpunct_wchar_do_grouping)
11368 VTABLE_ADD_FUNC(numpunct_wchar_do_falsename)
11369 VTABLE_ADD_FUNC(numpunct_wchar_do_truename));
11370 __ASM_VTABLE(num_get_char,
11371 VTABLE_ADD_FUNC(num_get_char_vector_dtor)
11372 #if _MSVCP_VER >= 110
11373 VTABLE_ADD_FUNC(locale_facet__Incref)
11374 VTABLE_ADD_FUNC(locale_facet__Decref)
11375 #endif
11376 VTABLE_ADD_FUNC(num_get_char_do_get_void)
11377 VTABLE_ADD_FUNC(num_get_char_do_get_double)
11378 VTABLE_ADD_FUNC(num_get_char_do_get_double)
11379 VTABLE_ADD_FUNC(num_get_char_do_get_float)
11380 VTABLE_ADD_FUNC(num_get_char_do_get_uint64)
11381 VTABLE_ADD_FUNC(num_get_char_do_get_int64)
11382 VTABLE_ADD_FUNC(num_get_char_do_get_ulong)
11383 VTABLE_ADD_FUNC(num_get_char_do_get_long)
11384 VTABLE_ADD_FUNC(num_get_char_do_get_uint)
11385 VTABLE_ADD_FUNC(num_get_char_do_get_ushort)
11386 VTABLE_ADD_FUNC(num_get_char_do_get_bool));
11387 __ASM_VTABLE(num_get_short,
11388 VTABLE_ADD_FUNC(num_get_wchar_vector_dtor)
11389 #if _MSVCP_VER >= 110
11390 VTABLE_ADD_FUNC(locale_facet__Incref)
11391 VTABLE_ADD_FUNC(locale_facet__Decref)
11392 #endif
11393 VTABLE_ADD_FUNC(num_get_short_do_get_void)
11394 VTABLE_ADD_FUNC(num_get_short_do_get_double)
11395 VTABLE_ADD_FUNC(num_get_short_do_get_double)
11396 VTABLE_ADD_FUNC(num_get_short_do_get_float)
11397 VTABLE_ADD_FUNC(num_get_short_do_get_uint64)
11398 VTABLE_ADD_FUNC(num_get_short_do_get_int64)
11399 VTABLE_ADD_FUNC(num_get_short_do_get_ulong)
11400 VTABLE_ADD_FUNC(num_get_short_do_get_long)
11401 VTABLE_ADD_FUNC(num_get_short_do_get_uint)
11402 VTABLE_ADD_FUNC(num_get_short_do_get_ushort)
11403 VTABLE_ADD_FUNC(num_get_short_do_get_bool));
11404 __ASM_VTABLE(num_get_wchar,
11405 VTABLE_ADD_FUNC(num_get_wchar_vector_dtor)
11406 #if _MSVCP_VER >= 110
11407 VTABLE_ADD_FUNC(locale_facet__Incref)
11408 VTABLE_ADD_FUNC(locale_facet__Decref)
11409 #endif
11410 VTABLE_ADD_FUNC(num_get_wchar_do_get_void)
11411 VTABLE_ADD_FUNC(num_get_wchar_do_get_double)
11412 VTABLE_ADD_FUNC(num_get_wchar_do_get_double)
11413 VTABLE_ADD_FUNC(num_get_wchar_do_get_float)
11414 VTABLE_ADD_FUNC(num_get_wchar_do_get_uint64)
11415 VTABLE_ADD_FUNC(num_get_wchar_do_get_int64)
11416 VTABLE_ADD_FUNC(num_get_wchar_do_get_ulong)
11417 VTABLE_ADD_FUNC(num_get_wchar_do_get_long)
11418 VTABLE_ADD_FUNC(num_get_wchar_do_get_uint)
11419 VTABLE_ADD_FUNC(num_get_wchar_do_get_ushort)
11420 VTABLE_ADD_FUNC(num_get_wchar_do_get_bool));
11421 __ASM_VTABLE(num_put_char,
11422 VTABLE_ADD_FUNC(num_put_char_vector_dtor)
11423 #if _MSVCP_VER >= 110
11424 VTABLE_ADD_FUNC(locale_facet__Incref)
11425 VTABLE_ADD_FUNC(locale_facet__Decref)
11426 #endif
11427 VTABLE_ADD_FUNC(num_put_char_do_put_ptr)
11428 VTABLE_ADD_FUNC(num_put_char_do_put_double)
11429 VTABLE_ADD_FUNC(num_put_char_do_put_double)
11430 VTABLE_ADD_FUNC(num_put_char_do_put_uint64)
11431 VTABLE_ADD_FUNC(num_put_char_do_put_int64)
11432 VTABLE_ADD_FUNC(num_put_char_do_put_ulong)
11433 VTABLE_ADD_FUNC(num_put_char_do_put_long)
11434 VTABLE_ADD_FUNC(num_put_char_do_put_bool));
11435 __ASM_VTABLE(num_put_wchar,
11436 VTABLE_ADD_FUNC(num_put_wchar_vector_dtor)
11437 #if _MSVCP_VER >= 110
11438 VTABLE_ADD_FUNC(locale_facet__Incref)
11439 VTABLE_ADD_FUNC(locale_facet__Decref)
11440 #endif
11441 VTABLE_ADD_FUNC(num_put_wchar_do_put_ptr)
11442 VTABLE_ADD_FUNC(num_put_wchar_do_put_double)
11443 VTABLE_ADD_FUNC(num_put_wchar_do_put_double)
11444 VTABLE_ADD_FUNC(num_put_wchar_do_put_uint64)
11445 VTABLE_ADD_FUNC(num_put_wchar_do_put_int64)
11446 VTABLE_ADD_FUNC(num_put_wchar_do_put_ulong)
11447 VTABLE_ADD_FUNC(num_put_wchar_do_put_long)
11448 VTABLE_ADD_FUNC(num_put_wchar_do_put_bool));
11449 __ASM_VTABLE(num_put_short,
11450 VTABLE_ADD_FUNC(num_put_wchar_vector_dtor)
11451 #if _MSVCP_VER >= 110
11452 VTABLE_ADD_FUNC(locale_facet__Incref)
11453 VTABLE_ADD_FUNC(locale_facet__Decref)
11454 #endif
11455 VTABLE_ADD_FUNC(num_put_short_do_put_ptr)
11456 VTABLE_ADD_FUNC(num_put_short_do_put_double)
11457 VTABLE_ADD_FUNC(num_put_short_do_put_double)
11458 VTABLE_ADD_FUNC(num_put_short_do_put_uint64)
11459 VTABLE_ADD_FUNC(num_put_short_do_put_int64)
11460 VTABLE_ADD_FUNC(num_put_short_do_put_ulong)
11461 VTABLE_ADD_FUNC(num_put_short_do_put_long)
11462 VTABLE_ADD_FUNC(num_put_short_do_put_bool));
11463 __ASM_VTABLE(time_put_char,
11464 VTABLE_ADD_FUNC(time_put_char_vector_dtor)
11465 #if _MSVCP_VER >= 110
11466 VTABLE_ADD_FUNC(locale_facet__Incref)
11467 VTABLE_ADD_FUNC(locale_facet__Decref)
11468 #endif
11469 VTABLE_ADD_FUNC(time_put_char_do_put));
11470 __ASM_VTABLE(time_put_wchar,
11471 VTABLE_ADD_FUNC(time_put_wchar_vector_dtor)
11472 #if _MSVCP_VER >= 110
11473 VTABLE_ADD_FUNC(locale_facet__Incref)
11474 VTABLE_ADD_FUNC(locale_facet__Decref)
11475 #endif
11476 VTABLE_ADD_FUNC(time_put_wchar_do_put));
11477 __ASM_VTABLE(time_put_short,
11478 VTABLE_ADD_FUNC(time_put_wchar_vector_dtor)
11479 #if _MSVCP_VER >= 110
11480 VTABLE_ADD_FUNC(locale_facet__Incref)
11481 VTABLE_ADD_FUNC(locale_facet__Decref)
11482 #endif
11483 VTABLE_ADD_FUNC(time_put_wchar_do_put));
11484 __ASM_VTABLE(time_get_char,
11485 VTABLE_ADD_FUNC(time_get_char_vector_dtor)
11486 #if _MSVCP_VER >= 110
11487 VTABLE_ADD_FUNC(locale_facet__Incref)
11488 VTABLE_ADD_FUNC(locale_facet__Decref)
11489 #endif
11490 VTABLE_ADD_FUNC(time_get_char_do_date_order)
11491 VTABLE_ADD_FUNC(time_get_char_do_get_time)
11492 VTABLE_ADD_FUNC(time_get_char_do_get_date)
11493 VTABLE_ADD_FUNC(time_get_char_do_get_weekday)
11494 VTABLE_ADD_FUNC(time_get_char_do_get_monthname)
11495 VTABLE_ADD_FUNC(time_get_char_do_get_year));
11496 #ifndef __GNUC__
11498 #endif
11500 void init_locale(void *base)
11502 #ifdef __x86_64__
11503 init_locale_facet_rtti(base);
11504 init_locale__Locimp_rtti(base);
11505 init_collate_char_rtti(base);
11506 init_collate_wchar_rtti(base);
11507 init_collate_short_rtti(base);
11508 init_ctype_base_rtti(base);
11509 init_ctype_char_rtti(base);
11510 init_ctype_wchar_rtti(base);
11511 init_ctype_short_rtti(base);
11512 init_codecvt_base_rtti(base);
11513 init_codecvt_char_rtti(base);
11514 init_codecvt_wchar_rtti(base);
11515 init_codecvt_short_rtti(base);
11516 init_numpunct_char_rtti(base);
11517 init_numpunct_wchar_rtti(base);
11518 init_numpunct_short_rtti(base);
11519 init_num_get_char_rtti(base);
11520 init_num_get_wchar_rtti(base);
11521 init_num_get_short_rtti(base);
11522 init_num_put_char_rtti(base);
11523 init_num_put_wchar_rtti(base);
11524 init_num_put_short_rtti(base);
11525 init_time_put_char_rtti(base);
11526 init_time_put_wchar_rtti(base);
11527 init_time_put_short_rtti(base);
11528 init_time_base_rtti(base);
11529 init_time_get_char_rtti(base);
11530 #endif
11533 void free_locale(void)
11535 facets_elem *iter, *safe;
11537 if(global_locale) {
11538 locale_dtor(&classic_locale);
11539 locale__Locimp_dtor(global_locale);
11540 MSVCRT_operator_delete(global_locale);
11543 LIST_FOR_EACH_ENTRY_SAFE(iter, safe, &lazy_facets, facets_elem, entry) {
11544 list_remove(&iter->entry);
11545 if(call_locale_facet__Decref(iter->fac))
11546 call_locale_facet_vector_dtor(iter->fac, 1);
11547 MSVCRT_operator_delete(iter);